@angular-wave/angular.ts 0.7.8 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/@types/{loader.d.ts → angular.d.ts} +3 -3
  2. package/@types/core/di/ng-module.d.ts +61 -25
  3. package/@types/core/parse/parse.d.ts +6 -7
  4. package/@types/directive/bind/bind.d.ts +2 -1
  5. package/@types/index.d.ts +1 -1
  6. package/@types/interface.d.ts +4 -2
  7. package/@types/{public.d.ts → ng.d.ts} +2 -2
  8. package/@types/router/directives/state-directives.d.ts +2 -2
  9. package/@types/router/directives/view-directive.d.ts +1 -1
  10. package/@types/router/params/param-type.d.ts +0 -1
  11. package/@types/router/path/path-utils.d.ts +8 -11
  12. package/@types/router/{globals.d.ts → router.d.ts} +2 -2
  13. package/@types/router/state/interface.d.ts +1 -1
  14. package/@types/router/state/state-object.d.ts +1 -1
  15. package/@types/router/state/state-registry.d.ts +2 -2
  16. package/@types/router/state/state-service.d.ts +14 -16
  17. package/@types/router/state-filters.d.ts +24 -2
  18. package/@types/router/transition/transition-service.d.ts +3 -3
  19. package/@types/router/transition/transition.d.ts +16 -19
  20. package/@types/router/url/url-matcher.d.ts +3 -4
  21. package/@types/router/url/url-rule.d.ts +14 -4
  22. package/@types/router/url/url-rules.d.ts +26 -6
  23. package/@types/router/url/url-service.d.ts +28 -38
  24. package/@types/services/http/http.d.ts +48 -1
  25. package/@types/services/http-backend/http-backend.d.ts +48 -35
  26. package/@types/services/location/interface.d.ts +55 -0
  27. package/@types/services/location/location.d.ts +225 -252
  28. package/@types/shared/common.d.ts +0 -2
  29. package/@types/shared/hof.d.ts +0 -6
  30. package/@types/shared/interface.d.ts +0 -4
  31. package/@types/{router/common → shared}/queue.d.ts +2 -2
  32. package/@types/shared/url-utils/interface.d.ts +0 -1
  33. package/@types/shared/url-utils/url-utils.d.ts +0 -5
  34. package/@types/shared/utils.d.ts +29 -6
  35. package/CHANGELOG.md +0 -72
  36. package/CONTRIBUTING.md +0 -1
  37. package/DEVELOPERS.md +0 -1
  38. package/Makefile +6 -3
  39. package/TRIAGING.md +0 -1
  40. package/dist/angular-ts.esm.js +1048 -1150
  41. package/dist/angular-ts.umd.js +1048 -1150
  42. package/dist/angular-ts.umd.min.js +1 -1
  43. package/docs/assets/scss/index.scss +23 -0
  44. package/docs/content/_index.md +9 -8
  45. package/docs/content/docs/_index.md +1 -1
  46. package/docs/content/docs/directive/app.md +1 -1
  47. package/docs/content/docs/directive/bind.md +1 -1
  48. package/docs/content/docs/directive/blur.md +1 -1
  49. package/docs/content/docs/directive/channel.md +2 -2
  50. package/docs/content/docs/directive/class-even.md +1 -1
  51. package/docs/content/docs/directive/class-odd.md +1 -1
  52. package/docs/content/docs/directive/class.md +1 -1
  53. package/docs/content/docs/directive/click.md +1 -1
  54. package/docs/content/docs/directive/copy.md +1 -1
  55. package/docs/content/docs/directive/cut.md +1 -1
  56. package/docs/content/docs/directive/dblclick.md +1 -1
  57. package/docs/content/docs/directive/focus.md +1 -1
  58. package/docs/content/docs/directive/get.md +3 -3
  59. package/docs/content/docs/directive/keydown.md +1 -1
  60. package/docs/content/docs/directive/keyup.md +1 -1
  61. package/docs/content/docs/directive/load.md +1 -1
  62. package/docs/content/docs/directive/mousedown.md +1 -1
  63. package/docs/content/docs/directive/mouseenter.md +1 -1
  64. package/docs/content/docs/directive/mouseleave.md +1 -1
  65. package/docs/content/docs/directive/mousemove.md +1 -1
  66. package/docs/content/docs/directive/mouseout.md +1 -1
  67. package/docs/content/docs/directive/mouseover.md +1 -1
  68. package/docs/content/docs/directive/mouseup.md +1 -1
  69. package/docs/content/docs/directive/non-bindable.md +28 -0
  70. package/docs/content/docs/provider/locationProvider.md +26 -0
  71. package/docs/content/docs/provider/templateCacheProvider.md +2 -2
  72. package/docs/content/docs/service/location.md +57 -0
  73. package/docs/content/docs/service/url.md +5 -0
  74. package/docs/layouts/partials/hooks/head-end.html +1 -1
  75. package/docs/layouts/shortcodes/version.html +1 -0
  76. package/docs/static/examples/counter/counter-test.html +0 -4
  77. package/docs/static/examples/eventbus/eventbus-test.html +0 -4
  78. package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
  79. package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
  80. package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
  81. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  82. package/docs/static/typedoc/assets/highlight.css +6 -6
  83. package/docs/static/typedoc/assets/navigation.js +1 -1
  84. package/docs/static/typedoc/assets/search.js +1 -1
  85. package/docs/static/typedoc/classes/Location.html +55 -0
  86. package/docs/static/typedoc/classes/LocationProvider.html +20 -0
  87. package/docs/static/typedoc/classes/NgModule.html +3 -3
  88. package/docs/static/typedoc/index.html +1 -1
  89. package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
  90. package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
  91. package/docs/static/typedoc/interfaces/Provider.html +2 -1
  92. package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
  93. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  94. package/docs/static/typedoc/types/Expression.html +1 -1
  95. package/docs/static/typedoc/types/Injectable.html +4 -1
  96. package/docs/static/typedoc/types/InjectableFactory.html +1 -4
  97. package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
  98. package/docs/static/version.js +13 -0
  99. package/docs/test-results/.last-run.json +4 -0
  100. package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
  101. package/package.json +2 -2
  102. package/src/{loader.js → angular.js} +11 -11
  103. package/src/angular.spec.js +189 -21
  104. package/src/animations/animate-css.js +17 -18
  105. package/src/animations/animate.spec.js +1 -1
  106. package/src/animations/shared.js +2 -3
  107. package/src/binding.spec.js +1 -1
  108. package/src/core/compile/compile.js +4 -7
  109. package/src/core/compile/compile.spec.js +1 -1
  110. package/src/core/controller/controller.spec.js +1 -1
  111. package/src/core/controller/controller.test.js +1 -0
  112. package/src/core/di/injector.js +7 -8
  113. package/src/core/di/injector.spec.js +2 -2
  114. package/src/core/di/injector.test.js +2 -2
  115. package/src/core/di/internal-injector.js +3 -6
  116. package/src/core/di/ng-module.js +26 -21
  117. package/src/core/filter/filter.js +1 -1
  118. package/src/core/filter/filter.spec.js +1 -1
  119. package/src/core/filter/filter.test.js +1 -0
  120. package/src/core/interpolate/interpolate.js +4 -6
  121. package/src/core/interpolate/interpolate.spec.js +1 -1
  122. package/src/core/interpolate/interpolate.test.js +1 -0
  123. package/src/core/parse/ast/ast.spec.js +1 -1
  124. package/src/core/parse/ast/ast.test.js +1 -1
  125. package/src/core/parse/lexer/lexer.spec.js +1 -1
  126. package/src/core/parse/parse.js +150 -146
  127. package/src/core/parse/parse.spec.js +46 -46
  128. package/src/core/prop.spec.js +1 -1
  129. package/src/core/root-element.spec.js +1 -1
  130. package/src/core/scope/scope.js +10 -11
  131. package/src/core/scope/scope.spec.js +3 -4
  132. package/src/directive/aria/aria.spec.js +1 -1
  133. package/src/directive/aria/aria.test.js +1 -0
  134. package/src/directive/attrs/attrs.spec.js +1 -1
  135. package/src/directive/attrs/attrs.test.js +1 -0
  136. package/src/directive/attrs/boolean.spec.js +1 -1
  137. package/src/directive/attrs/boolean.test.js +1 -0
  138. package/src/directive/attrs/element-style.spec.js +1 -1
  139. package/src/directive/attrs/element-style.test.js +1 -0
  140. package/src/directive/attrs/src.spec.js +1 -1
  141. package/src/directive/attrs/src.test.js +1 -0
  142. package/src/directive/bind/bind-html.spec.js +1 -1
  143. package/src/directive/bind/bind.js +1 -0
  144. package/src/directive/bind/bind.spec.js +1 -1
  145. package/src/directive/bind/bind.test.js +1 -0
  146. package/src/directive/channel/channel.spec.js +1 -1
  147. package/src/directive/channel/channel.test.js +1 -0
  148. package/src/directive/class/class.spec.js +1 -1
  149. package/src/directive/class/class.test.js +1 -0
  150. package/src/directive/cloak/cloak.spec.js +1 -1
  151. package/src/directive/cloak/cloak.test.js +1 -0
  152. package/src/directive/controller/controller.spec.js +1 -1
  153. package/src/directive/controller/controller.test.js +1 -0
  154. package/src/directive/events/click.spec.js +1 -1
  155. package/src/directive/events/event.spec.js +6 -6
  156. package/src/directive/events/events.test.js +1 -0
  157. package/src/directive/form/form.js +8 -5
  158. package/src/directive/form/form.spec.js +1 -1
  159. package/src/directive/form/form.test.js +1 -0
  160. package/src/directive/http/delete.spec.js +1 -1
  161. package/src/directive/http/form-test.html +18 -0
  162. package/src/directive/http/get.spec.js +1 -1
  163. package/src/directive/http/http.js +12 -3
  164. package/src/directive/http/post.spec.js +504 -9
  165. package/src/directive/http/put.spec.js +1 -1
  166. package/src/directive/if/if.spec.js +1 -1
  167. package/src/directive/include/include.spec.js +1 -1
  168. package/src/directive/init/init.spec.js +1 -1
  169. package/src/directive/init/init.test.js +1 -0
  170. package/src/directive/input/input.js +13 -15
  171. package/src/directive/input/input.spec.js +1 -2
  172. package/src/directive/input/input.test.js +1 -0
  173. package/src/directive/messages/messages.md +0 -4
  174. package/src/directive/messages/messages.spec.js +1 -1
  175. package/src/directive/messages/messages.test.js +1 -0
  176. package/src/directive/model/model.js +13 -13
  177. package/src/directive/model/model.spec.js +1 -1
  178. package/src/directive/model/model.test.js +1 -0
  179. package/src/directive/model-options/model-option.test.js +1 -0
  180. package/src/directive/model-options/model-options.js +1 -1
  181. package/src/directive/model-options/model-options.spec.js +1 -1
  182. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  183. package/src/directive/non-bindable/non-bindable.test.js +1 -0
  184. package/src/directive/observe/observe.spec.js +1 -1
  185. package/src/directive/observe/observe.test.js +1 -0
  186. package/src/directive/on/on.spec.js +1 -1
  187. package/src/directive/on/on.test.js +1 -0
  188. package/src/directive/options/options.spec.js +1 -1
  189. package/src/directive/options/options.test.js +1 -0
  190. package/src/directive/ref/href.spec.js +1 -1
  191. package/src/directive/ref/href.test.js +2 -0
  192. package/src/directive/ref/ref.spec.js +1 -1
  193. package/src/directive/repeat/repeat.js +1 -1
  194. package/src/directive/repeat/repeat.spec.js +2 -3
  195. package/src/directive/repeat/repeat.test.js +1 -0
  196. package/src/directive/script/script.spec.js +1 -1
  197. package/src/directive/script/script.test.js +1 -0
  198. package/src/directive/select/select.js +1 -1
  199. package/src/directive/select/select.spec.js +1 -1
  200. package/src/directive/select/select.test.js +1 -0
  201. package/src/directive/setter/setter.spec.js +1 -1
  202. package/src/directive/setter/setter.test.js +1 -0
  203. package/src/directive/show-hide/show-hide.spec.js +1 -1
  204. package/src/directive/show-hide/show-hide.test.js +1 -0
  205. package/src/directive/style/style.spec.js +1 -1
  206. package/src/directive/style/style.test.js +1 -0
  207. package/src/directive/switch/switch.spec.js +1 -1
  208. package/src/directive/switch/switch.test.js +1 -0
  209. package/src/directive/validators/validators.js +82 -84
  210. package/src/directive/validators/validators.spec.js +5 -4
  211. package/src/directive/validators/validators.test.js +1 -0
  212. package/src/filters/filter.spec.js +1 -1
  213. package/src/filters/filters.spec.js +1 -1
  214. package/src/filters/limit-to.js +2 -3
  215. package/src/filters/limit-to.spec.js +1 -1
  216. package/src/filters/order-by.spec.js +1 -1
  217. package/src/index.js +1 -1
  218. package/src/injection-tokens.js +7 -3
  219. package/src/interface.ts +4 -3
  220. package/src/loader.md +0 -155
  221. package/src/{public.js → ng.js} +11 -12
  222. package/src/{public.spec.js → ng.spec.js} +2 -2
  223. package/src/router/directives/state-directives.js +5 -5
  224. package/src/router/directives/state-directives.spec.js +8 -7
  225. package/src/router/directives/view-directive.js +7 -13
  226. package/src/router/directives/view-directive.spec.js +22 -23
  227. package/src/router/{common/common.html → glob/glob.html} +2 -3
  228. package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
  229. package/src/router/params/param-type.js +0 -1
  230. package/src/router/params/param.js +1 -1
  231. package/src/router/path/path-utils.js +5 -0
  232. package/src/router/router-test-hashbang.html +45 -0
  233. package/src/router/{globals.js → router.js} +2 -2
  234. package/src/router/services.spec.js +8 -9
  235. package/src/router/state/interface.ts +1 -1
  236. package/src/router/state/state-builder.js +3 -3
  237. package/src/router/state/state-builder.spec.js +1 -1
  238. package/src/router/state/state-object.js +1 -1
  239. package/src/router/state/state-registry.js +4 -4
  240. package/src/router/state/state-service.js +14 -14
  241. package/src/router/state/state.spec.js +23 -22
  242. package/src/router/state/state.test.js +1 -0
  243. package/src/router/state/views.js +1 -1
  244. package/src/router/state-filter.spec.js +1 -1
  245. package/src/router/state-filters.js +13 -9
  246. package/src/router/template-factory.js +5 -4
  247. package/src/router/template-factory.spec.js +7 -7
  248. package/src/router/transition/hook-registry.js +1 -1
  249. package/src/router/transition/transition-service.js +7 -6
  250. package/src/router/transition/transition.js +6 -6
  251. package/src/router/url/url-matcher.js +12 -14
  252. package/src/router/url/url-rule.js +8 -2
  253. package/src/router/url/url-rules.js +8 -5
  254. package/src/router/url/url-service.js +80 -76
  255. package/src/router/url/url-service.spec.js +61 -78
  256. package/src/router/url/url.test.js +1 -0
  257. package/src/router/view/view.js +4 -5
  258. package/src/router/view/view.spec.js +10 -12
  259. package/src/router/view/view.test.js +1 -0
  260. package/src/router/view-hook.spec.js +1 -1
  261. package/src/router/view-scroll.js +3 -1
  262. package/src/router/view-scroll.spec.js +12 -12
  263. package/src/services/anchor-scroll.html +2 -2
  264. package/src/services/anchor-scroll.js +5 -4
  265. package/src/services/http/http.js +9 -4
  266. package/src/services/http/http.spec.js +2 -7
  267. package/src/services/http/template-request.spec.js +1 -1
  268. package/src/services/http-backend/http-backend.js +51 -77
  269. package/src/services/http-backend/http-backend.spec.js +1 -2
  270. package/src/services/http-backend/http-backend.test.js +1 -0
  271. package/src/services/location/interface.ts +62 -0
  272. package/src/services/location/location.js +439 -519
  273. package/src/services/location/location.spec.js +915 -530
  274. package/src/services/location/location.test.js +2 -2
  275. package/src/services/log/log.spec.js +1 -1
  276. package/src/services/log/log.test.js +1 -0
  277. package/src/services/pubsub/pubsub.spec.js +1 -1
  278. package/src/services/sce/sce.js +5 -7
  279. package/src/services/sce/sce.md +2 -2
  280. package/src/services/sce/sce.spec.js +1 -1
  281. package/src/services/template-cache/template-cache.spec.js +1 -1
  282. package/src/services/template-cache/template-cache.test.js +1 -0
  283. package/src/shared/common.js +5 -10
  284. package/src/shared/common.spec.js +1 -1
  285. package/src/shared/hof.js +0 -14
  286. package/src/shared/interface.ts +0 -4
  287. package/src/{router/common → shared}/queue.js +7 -7
  288. package/src/shared/shared.html +1 -0
  289. package/src/shared/shared.test.js +1 -0
  290. package/src/shared/url-utils/interface.ts +0 -2
  291. package/src/shared/url-utils/url-utils.js +6 -30
  292. package/src/shared/url-utils/url-utils.spec.js +10 -9
  293. package/src/shared/utils.js +32 -9
  294. package/src/shared/utils.spec.js +35 -1
  295. package/src/src.html +1 -2
  296. package/typedoc.json +0 -1
  297. package/utils/express.js +27 -1
  298. package/utils/version.cjs +23 -0
  299. package/@types/router/state-provider.d.ts +0 -123
  300. package/src/directive/non-bindable/non-bindable.md +0 -17
  301. package/src/loader.spec.js +0 -169
  302. package/src/router/state-provider.js +0 -146
  303. package/src/services/location/location.md +0 -114
  304. package/src/shared/url-utils/url-utils.md +0 -46
  305. /package/@types/router/{common → glob}/glob.d.ts +0 -0
  306. /package/src/router/{common → glob}/glob.js +0 -0
  307. /package/src/router/{common → glob}/glob.spec.js +0 -0
  308. /package/src/{router/common → shared}/queue.spec.js +0 -0
@@ -1,4 +1,4 @@
1
- /* Version: 0.7.8 - July 17, 2025 02:51:20 */
1
+ /* Version: 0.8.1 - August 7, 2025 18:30:09 */
2
2
  const VALID_CLASS = "ng-valid";
3
3
  const INVALID_CLASS = "ng-invalid";
4
4
  const PRISTINE_CLASS = "ng-pristine";
@@ -349,14 +349,6 @@ function extend(dst, ...src) {
349
349
  return baseExtend(dst, src);
350
350
  }
351
351
 
352
- /**
353
- * @param {string} str
354
- * @returns {number}
355
- */
356
- function toInt(str) {
357
- return parseInt(str, 10);
358
- }
359
-
360
352
  /**
361
353
  * @param {any} num
362
354
  * @returns {boolean}
@@ -789,7 +781,7 @@ function tryDecodeURIComponent(value) {
789
781
  try {
790
782
  return decodeURIComponent(value);
791
783
  } catch {
792
- return;
784
+ /* empty */
793
785
  }
794
786
  }
795
787
 
@@ -803,6 +795,7 @@ function tryDecodeURIComponent(value) {
803
795
  * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
804
796
  * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
805
797
  * / "*" / "+" / "," / ";" / "="
798
+ * @param {string} val
806
799
  */
807
800
  function encodeUriSegment(val) {
808
801
  return encodeUriQuery(val, true)
@@ -1176,6 +1169,36 @@ function wait(t = 0) {
1176
1169
  return new Promise((resolve) => setTimeout(resolve, t));
1177
1170
  }
1178
1171
 
1172
+ /**
1173
+ * Checks if a given string starts with a specified substring.
1174
+ *
1175
+ * This is a simple polyfill-like function that mimics the behavior of
1176
+ * `String.prototype.startsWith` without using the built-in method.
1177
+ *
1178
+ * @param {string} str - The full string to evaluate.
1179
+ * @param {string} search - The substring to test against the beginning of `str`.
1180
+ * @returns {boolean} `true` if `str` starts with `search`, otherwise `false`.
1181
+ *
1182
+ * @example
1183
+ * startsWith("hello world", "hello");
1184
+ * // returns true
1185
+ *
1186
+ * @example
1187
+ * startsWith("hello world", "world");
1188
+ * // returns false
1189
+ *
1190
+ * @example
1191
+ * startsWith("test", "");
1192
+ * // returns true (empty search string always matches)
1193
+ *
1194
+ * @example
1195
+ * startsWith("abc", "abcd");
1196
+ * // returns false
1197
+ */
1198
+ function startsWith(str, search) {
1199
+ return str.slice(0, search.length) === search;
1200
+ }
1201
+
1179
1202
  /**
1180
1203
  * Expando cache for adding properties to DOM nodes with JavaScript.
1181
1204
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -1759,6 +1782,9 @@ function getBaseHref() {
1759
1782
  * @type Readonly<Record<string, string>>
1760
1783
  */
1761
1784
  const $injectTokens = Object.freeze({
1785
+ $attrs: "$attrs",
1786
+ $scope: "$scope",
1787
+ $element: "$element",
1762
1788
  $$AnimateRunner: "$$AnimateRunner",
1763
1789
  $$animateAsyncRun: "$$animateAsyncRun",
1764
1790
  $$animateCache: "$$animateCache",
@@ -1784,10 +1810,11 @@ const $injectTokens = Object.freeze({
1784
1810
  $interpolate: "$interpolate",
1785
1811
  $location: "$location",
1786
1812
  $log: "$log",
1787
- $ngViewScroll: "$ngViewScroll",
1813
+ $viewScroll: "$viewScroll",
1788
1814
  $parse: "$parse",
1789
1815
  $rootScope: "$rootScope",
1790
- $routerGlobals: "$routerGlobals",
1816
+ $rootElement: "$rootElement",
1817
+ $router: "$router",
1791
1818
  $sce: "$sce",
1792
1819
  $sceDelegate: "$sceDelegate",
1793
1820
  $state: "$state",
@@ -1797,7 +1824,7 @@ const $injectTokens = Object.freeze({
1797
1824
  $templateRequest: "$templateRequest",
1798
1825
  $transitions: "$transitions",
1799
1826
  $urlConfig: "$urlConfig",
1800
- $urlService: "$urlService",
1827
+ $url: "$url",
1801
1828
  $view: "$view",
1802
1829
  // provide literals
1803
1830
  $provide: "$provide",
@@ -1841,7 +1868,7 @@ class NgModule {
1841
1868
  /**
1842
1869
  * @param {string} name - Name of the module
1843
1870
  * @param {Array<string>} requires - List of modules which the injector will load before the current module
1844
- * @param {Function} [configFn]
1871
+ * @param {import("../../interface.js").Injectable} [configFn]
1845
1872
  */
1846
1873
  constructor(name, requires, configFn) {
1847
1874
  assert(isString(name), "name required");
@@ -1867,7 +1894,7 @@ class NgModule {
1867
1894
  /** @type {!Array<Array<*>>} */
1868
1895
  this.configBlocks = [];
1869
1896
 
1870
- /** @type {!Array.<Function>} */
1897
+ /** @type {!Array.<import("../../interface.js").Injectable>} */
1871
1898
  this.runBlocks = [];
1872
1899
 
1873
1900
  if (configFn) {
@@ -1897,7 +1924,7 @@ class NgModule {
1897
1924
 
1898
1925
  /**
1899
1926
  *
1900
- * @param {Function} configFn
1927
+ * @param {import("../../interface.js").Injectable} configFn
1901
1928
  * @returns {NgModule}
1902
1929
  */
1903
1930
  config(configFn) {
@@ -1906,7 +1933,7 @@ class NgModule {
1906
1933
  }
1907
1934
 
1908
1935
  /**
1909
- * @param {Function} block
1936
+ * @param {import("../../interface.js").Injectable} block
1910
1937
  * @returns {NgModule}
1911
1938
  */
1912
1939
  run(block) {
@@ -1916,12 +1943,12 @@ class NgModule {
1916
1943
 
1917
1944
  /**
1918
1945
  * @param {string} name
1919
- * @param {*} options
1946
+ * @param {import("../../interface.js").Injectable} options
1920
1947
  * @returns {NgModule}
1921
1948
  */
1922
1949
  component(name, options) {
1923
1950
  if (options && isFunction(options)) {
1924
- options.$$moduleName = name;
1951
+ options["$$moduleName"] = name;
1925
1952
  }
1926
1953
  this.invokeQueue.push([COMPILE_LITERAL, "component", [name, options]]);
1927
1954
  return this;
@@ -1929,12 +1956,12 @@ class NgModule {
1929
1956
 
1930
1957
  /**
1931
1958
  * @param {string} name
1932
- * @param {*} providerFunction
1959
+ * @param {import("../../interface.js").Injectable} providerFunction
1933
1960
  * @returns {NgModule}
1934
1961
  */
1935
1962
  factory(name, providerFunction) {
1936
1963
  if (providerFunction && isFunction(providerFunction)) {
1937
- providerFunction.$$moduleName = name;
1964
+ providerFunction["$$moduleName"] = name;
1938
1965
  }
1939
1966
  this.invokeQueue.push([$injectTokens.$provide, "factory", [name, providerFunction]]);
1940
1967
  return this;
@@ -1942,12 +1969,12 @@ class NgModule {
1942
1969
 
1943
1970
  /**
1944
1971
  * @param {string} name
1945
- * @param {*} serviceFunction
1972
+ * @param {import("../../interface.js").Injectable} serviceFunction
1946
1973
  * @returns {NgModule}
1947
1974
  */
1948
1975
  service(name, serviceFunction) {
1949
1976
  if (serviceFunction && isFunction(serviceFunction)) {
1950
- serviceFunction.$$moduleName = name;
1977
+ serviceFunction["$$moduleName"] = name;
1951
1978
  }
1952
1979
  this.invokeQueue.push([$injectTokens.$provide, "service", [name, serviceFunction]]);
1953
1980
  return this;
@@ -1955,12 +1982,12 @@ class NgModule {
1955
1982
 
1956
1983
  /**
1957
1984
  * @param {string} name
1958
- * @param {*} providerType
1985
+ * @param {import("../../interface.js").Injectable} providerType
1959
1986
  * @returns {NgModule}
1960
1987
  */
1961
1988
  provider(name, providerType) {
1962
1989
  if (providerType && isFunction(providerType)) {
1963
- providerType.$$moduleName = name;
1990
+ providerType["$$moduleName"] = name;
1964
1991
  }
1965
1992
  this.invokeQueue.push([$injectTokens.$provide, "provider", [name, providerType]]);
1966
1993
  return this;
@@ -1968,12 +1995,12 @@ class NgModule {
1968
1995
 
1969
1996
  /**
1970
1997
  * @param {string} name
1971
- * @param {*} decorFn
1998
+ * @param {import("../../interface.js").Injectable} decorFn
1972
1999
  * @returns {NgModule}
1973
2000
  */
1974
2001
  decorator(name, decorFn) {
1975
2002
  if (decorFn && isFunction(decorFn)) {
1976
- decorFn.$$moduleName = name;
2003
+ decorFn["$$moduleName"] = name;
1977
2004
  }
1978
2005
  this.configBlocks.push([$injectTokens.$provide, "decorator", [name, decorFn]]);
1979
2006
  return this;
@@ -1981,12 +2008,12 @@ class NgModule {
1981
2008
 
1982
2009
  /**
1983
2010
  * @param {string} name
1984
- * @param {*} directiveFactory
2011
+ * @param {import("../../interface.js").Injectable} directiveFactory
1985
2012
  * @returns {NgModule}
1986
2013
  */
1987
2014
  directive(name, directiveFactory) {
1988
2015
  if (directiveFactory && isFunction(directiveFactory)) {
1989
- directiveFactory.$$moduleName = name;
2016
+ directiveFactory["$$moduleName"] = name;
1990
2017
  }
1991
2018
  this.invokeQueue.push([
1992
2019
  COMPILE_LITERAL,
@@ -1998,12 +2025,12 @@ class NgModule {
1998
2025
 
1999
2026
  /**
2000
2027
  * @param {string} name
2001
- * @param {*} animationFactory
2028
+ * @param {import("../../interface.js").Injectable} animationFactory
2002
2029
  * @returns {NgModule}
2003
2030
  */
2004
2031
  animation(name, animationFactory) {
2005
2032
  if (animationFactory && isFunction(animationFactory)) {
2006
- animationFactory.$$moduleName = name;
2033
+ animationFactory["$$moduleName"] = name;
2007
2034
  }
2008
2035
  this.invokeQueue.push([
2009
2036
  ANIMATION_LITERAL,
@@ -2013,9 +2040,14 @@ class NgModule {
2013
2040
  return this;
2014
2041
  }
2015
2042
 
2043
+ /**
2044
+ * @param {string} name
2045
+ * @param {import("../../interface.js").Injectable} filterFn
2046
+ * @return {NgModule}
2047
+ */
2016
2048
  filter(name, filterFn) {
2017
2049
  if (filterFn && isFunction(filterFn)) {
2018
- filterFn.$$moduleName = name;
2050
+ filterFn["$$moduleName"] = name;
2019
2051
  }
2020
2052
  this.invokeQueue.push([FILTER_LITERAL, "register", [name, filterFn]]);
2021
2053
  return this;
@@ -2023,12 +2055,12 @@ class NgModule {
2023
2055
 
2024
2056
  /**
2025
2057
  * @param {string} name
2026
- * @param {*} ctlFn
2058
+ * @param {import("../../interface.js").Injectable} ctlFn
2027
2059
  * @returns {NgModule}
2028
2060
  */
2029
2061
  controller(name, ctlFn) {
2030
2062
  if (ctlFn && isFunction(ctlFn)) {
2031
- ctlFn.$$moduleName = name;
2063
+ ctlFn["$$moduleName"] = name;
2032
2064
  }
2033
2065
  this.invokeQueue.push([CONTROLLER_LITERAL, "register", [name, ctlFn]]);
2034
2066
  return this;
@@ -2143,8 +2175,7 @@ class AbstractInjector {
2143
2175
 
2144
2176
  if (isClass(/** @type {Function} */ (fn))) {
2145
2177
  args.unshift(null);
2146
- const res = new (Function.prototype.bind.apply(fn, args))();
2147
- return res;
2178
+ return new (Function.prototype.bind.apply(fn, args))();
2148
2179
  } else {
2149
2180
  return /** @type {Function} */ (fn).apply(self, args);
2150
2181
  }
@@ -2233,8 +2264,7 @@ class InjectorService extends AbstractInjector {
2233
2264
  */
2234
2265
  factory(serviceName) {
2235
2266
  const provider = this.providerInjector.get(serviceName + providerSuffix$1);
2236
- const res = this.invoke(provider.$get, provider, undefined, serviceName);
2237
- return res;
2267
+ return this.invoke(provider.$get, provider, undefined, serviceName);
2238
2268
  }
2239
2269
 
2240
2270
  /**
@@ -2268,8 +2298,7 @@ function stringifyFn$1(fn) {
2268
2298
  */
2269
2299
  function extractArgs$1(fn) {
2270
2300
  const fnText = stringifyFn$1(fn).replace(STRIP_COMMENTS$1, "");
2271
- const args = fnText.match(ARROW_ARG$1) || fnText.match(FN_ARGS$1);
2272
- return args;
2301
+ return fnText.match(ARROW_ARG$1) || fnText.match(FN_ARGS$1);
2273
2302
  }
2274
2303
 
2275
2304
  /**
@@ -2560,8 +2589,7 @@ function stringifyFn(fn) {
2560
2589
  */
2561
2590
  function extractArgs(fn) {
2562
2591
  const fnText = stringifyFn(fn).replace(STRIP_COMMENTS, "");
2563
- const args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
2564
- return args;
2592
+ return fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
2565
2593
  }
2566
2594
 
2567
2595
  /**
@@ -3018,11 +3046,7 @@ class ControllerProvider {
3018
3046
  }
3019
3047
  }
3020
3048
 
3021
- const urlParsingNode = document.createElement("a");
3022
3049
  const originUrl = urlResolve(window.location.href);
3023
- let baseUrlParsingNode;
3024
-
3025
- urlParsingNode.href = "http://[::1]";
3026
3050
 
3027
3051
  /**
3028
3052
  * @param {import("./interface.js").ResolvableUrl} url
@@ -3032,7 +3056,10 @@ function urlResolve(url) {
3032
3056
  if (!isString(url))
3033
3057
  return /** @type {import("./interface.js").ParsedUrl} */ (url);
3034
3058
 
3035
- urlParsingNode.setAttribute("href", /** @type {string} */ (url));
3059
+ const urlParsingNode = new URL(
3060
+ /** @type {string} */ (url),
3061
+ window.location.href,
3062
+ );
3036
3063
 
3037
3064
  const hostname = urlParsingNode.hostname.includes(":")
3038
3065
  ? `[${urlParsingNode.hostname}]`
@@ -3040,9 +3067,7 @@ function urlResolve(url) {
3040
3067
 
3041
3068
  return {
3042
3069
  href: urlParsingNode.href,
3043
- protocol: urlParsingNode.protocol
3044
- ? urlParsingNode.protocol.replace(/:$/, "")
3045
- : "",
3070
+ protocol: urlParsingNode.protocol,
3046
3071
  host: urlParsingNode.host,
3047
3072
  search: urlParsingNode.search
3048
3073
  ? urlParsingNode.search.replace(/^\?/, "")
@@ -3080,7 +3105,7 @@ function urlIsSameOrigin(requestUrl) {
3080
3105
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
3081
3106
  */
3082
3107
  function urlIsSameOriginAsBaseUrl(requestUrl) {
3083
- return urlsAreSameOrigin(requestUrl, getBaseUrl());
3108
+ return urlsAreSameOrigin(requestUrl, document.baseURI);
3084
3109
  }
3085
3110
 
3086
3111
  /**
@@ -3132,27 +3157,6 @@ function urlsAreSameOrigin(url1, url2) {
3132
3157
  return url1.protocol === url2.protocol && url1.host === url2.host;
3133
3158
  }
3134
3159
 
3135
- /**
3136
- * Returns the current document base URL.
3137
- * @returns {string}
3138
- */
3139
- function getBaseUrl() {
3140
- if (document.baseURI) {
3141
- return document.baseURI;
3142
- }
3143
-
3144
- // `document.baseURI` is available everywhere except IE
3145
- if (!baseUrlParsingNode) {
3146
- baseUrlParsingNode = document.createElement("a");
3147
- baseUrlParsingNode.href = ".";
3148
-
3149
- // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not
3150
- // suitable here because we need to track changes to the base URL.
3151
- baseUrlParsingNode = baseUrlParsingNode.cloneNode(false);
3152
- }
3153
- return baseUrlParsingNode.href;
3154
- }
3155
-
3156
3160
  /**
3157
3161
  * Removes a trailing hash ('#') from the given URL if it exists.
3158
3162
  *
@@ -3474,7 +3478,6 @@ class SceDelegateProvider {
3474
3478
  "Attempting to use an unsafe value in a safe context.",
3475
3479
  ),
3476
3480
  );
3477
- return;
3478
3481
  };
3479
3482
 
3480
3483
  if ($injector.has("$sanitize")) {
@@ -3709,7 +3712,6 @@ class SceDelegateProvider {
3709
3712
  "Attempting to use an unsafe value in a safe context.",
3710
3713
  ),
3711
3714
  );
3712
- return;
3713
3715
  }
3714
3716
 
3715
3717
  return { trustAs, getTrusted, valueOf };
@@ -3908,7 +3910,7 @@ function SceProvider() {
3908
3910
 
3909
3911
  /**
3910
3912
  * Shorthand method. `$sce.parseAsHtml(expression string)` →
3911
- * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
3913
+ * {@link ng.$sceparseAs `$sce.parseAs($sce.HTML, value)`}
3912
3914
  *
3913
3915
  * @param {string} expression String expression to compile.
3914
3916
  * @return {function(context, locals)} A function which represents the compiled expression:
@@ -3921,7 +3923,7 @@ function SceProvider() {
3921
3923
 
3922
3924
  /**
3923
3925
  * Shorthand method. `$sce.parseAsCss(value)` →
3924
- * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
3926
+ * {@link ng.$sceparseAs `$sce.parseAs($sce.CSS, value)`}
3925
3927
  *
3926
3928
  * @param {string} expression String expression to compile.
3927
3929
  * @return {function(context, locals)} A function which represents the compiled expression:
@@ -3934,7 +3936,7 @@ function SceProvider() {
3934
3936
 
3935
3937
  /**
3936
3938
  * Shorthand method. `$sce.parseAsUrl(value)` →
3937
- * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
3939
+ * {@link ng.$sceparseAs `$sce.parseAs($sce.URL, value)`}
3938
3940
  *
3939
3941
  * @param {string} expression String expression to compile.
3940
3942
  * @return {function(context, locals)} A function which represents the compiled expression:
@@ -3947,7 +3949,7 @@ function SceProvider() {
3947
3949
 
3948
3950
  /**
3949
3951
  * Shorthand method. `$sce.parseAsResourceUrl(value)` →
3950
- * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
3952
+ * {@link ng.$sceparseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
3951
3953
  *
3952
3954
  * @param {string} expression String expression to compile.
3953
3955
  * @return {function(context, locals)} A function which represents the compiled expression:
@@ -3960,7 +3962,7 @@ function SceProvider() {
3960
3962
 
3961
3963
  /**
3962
3964
  * Shorthand method. `$sce.parseAsJs(value)` →
3963
- * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
3965
+ * {@link ng.$sceparseAs `$sce.parseAs($sce.JS, value)`}
3964
3966
  *
3965
3967
  * @param {string} expression String expression to compile.
3966
3968
  * @return {function(context, locals)} A function which represents the compiled expression:
@@ -4517,7 +4519,7 @@ const EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
4517
4519
  const DirectiveSuffix = "Directive";
4518
4520
 
4519
4521
  class CompileProvider {
4520
- static $inject = ["$provide", "$$sanitizeUriProvider"];
4522
+ /* @ignore */ static $inject = ["$provide", "$$sanitizeUriProvider"];
4521
4523
 
4522
4524
  /**
4523
4525
  * @param {import('../../interface.js').Provider} $provide
@@ -5592,8 +5594,7 @@ class CompileProvider {
5592
5594
  // Null out all of these references for garbage collection
5593
5595
  compileNodes = transcludeFn = previousCompileContext = null;
5594
5596
  }
5595
- const linked = compiled.apply(this, arguments);
5596
- return linked;
5597
+ return compiled.apply(this, arguments);
5597
5598
  };
5598
5599
  }
5599
5600
 
@@ -5937,14 +5938,13 @@ class CompileProvider {
5937
5938
  // * `undefined` - a slot that was not declared (i.e. invalid)
5938
5939
  const slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
5939
5940
  if (slotTranscludeFn) {
5940
- const slotTranscludeRes = slotTranscludeFn(
5941
+ return slotTranscludeFn(
5941
5942
  scope,
5942
5943
  cloneAttachFn,
5943
5944
  transcludeControllers,
5944
5945
  futureParentElement,
5945
5946
  scopeToChild,
5946
5947
  );
5947
- return slotTranscludeRes;
5948
5948
  }
5949
5949
 
5950
5950
  if (isUndefined(slotTranscludeFn)) {
@@ -5957,14 +5957,13 @@ class CompileProvider {
5957
5957
  );
5958
5958
  }
5959
5959
  } else {
5960
- const boundTranscludeRes = boundTranscludeFn(
5960
+ return boundTranscludeFn(
5961
5961
  scope,
5962
5962
  cloneAttachFn,
5963
5963
  transcludeControllers,
5964
5964
  futureParentElement,
5965
5965
  scopeToChild,
5966
5966
  );
5967
- return boundTranscludeRes;
5968
5967
  }
5969
5968
  }
5970
5969
  };
@@ -7728,7 +7727,13 @@ const SUBMITTED_CLASS = "ng-submitted";
7728
7727
 
7729
7728
  class FormController {
7730
7729
  static $nonscope = true;
7731
- static $inject = ["$element", "$attrs", "$scope", "$animate", "$interpolate"];
7730
+ /* @ignore */ static $inject = [
7731
+ "$element",
7732
+ "$attrs",
7733
+ "$scope",
7734
+ "$animate",
7735
+ "$interpolate",
7736
+ ];
7732
7737
 
7733
7738
  /**
7734
7739
  * @param {Element} $element
@@ -8192,7 +8197,7 @@ const formDirectiveFactory = function (isNgForm) {
8192
8197
  return [
8193
8198
  "$parse",
8194
8199
  function ($parse) {
8195
- const formDirective = {
8200
+ return {
8196
8201
  name: "form",
8197
8202
  restrict: isNgForm ? "EA" : "E",
8198
8203
  require: ["form", "^^?form"], // first is the form's own ctrl, second is an optional parent form
@@ -8271,9 +8276,6 @@ const formDirectiveFactory = function (isNgForm) {
8271
8276
  };
8272
8277
  },
8273
8278
  };
8274
-
8275
- return formDirective;
8276
-
8277
8279
  function getSetter(expression) {
8278
8280
  if (expression === "") {
8279
8281
  // create an assignable expression, so forms with an empty name can be renamed later
@@ -8301,7 +8303,7 @@ const DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
8301
8303
 
8302
8304
  class NgModelOptionsController {
8303
8305
  static $nonscope = true;
8304
- static $inject = ["$attrs", "$scope"];
8306
+ /* @ignore */ static $inject = ["$attrs", "$scope"];
8305
8307
 
8306
8308
  /**
8307
8309
  * @param {import('../../core/compile/attributes.js').Attributes} $attrs
@@ -8470,14 +8472,14 @@ const ngModelMinErr = minErr("ngModel");
8470
8472
 
8471
8473
  class NgModelController {
8472
8474
  static $nonscope = true;
8473
- static $inject = [
8475
+ /* @ignore */ static $inject = [
8474
8476
  "$scope",
8475
- "$exceptionHandler",
8477
+ $injectTokens.$exceptionHandler,
8476
8478
  "$attrs",
8477
8479
  "$element",
8478
- "$parse",
8479
- "$animate",
8480
- "$interpolate",
8480
+ $injectTokens.$parse,
8481
+ $injectTokens.$animate,
8482
+ $injectTokens.$interpolate,
8481
8483
  ];
8482
8484
 
8483
8485
  /**
@@ -9124,8 +9126,7 @@ class NgModelController {
9124
9126
  }
9125
9127
 
9126
9128
  $$parseAndValidate() {
9127
- const viewValue = this.$$lastCommittedViewValue;
9128
- let modelValue = viewValue;
9129
+ let modelValue = this.$$lastCommittedViewValue;
9129
9130
  const that = this;
9130
9131
 
9131
9132
  this.$$parserValid = isUndefined(modelValue) ? undefined : true;
@@ -10048,9 +10049,8 @@ function createDateInputType(type, regexp, parseDate) {
10048
10049
  }
10049
10050
 
10050
10051
  function badInputChecker(scope, element, attr, ctrl, parserName) {
10051
- const node = element;
10052
10052
  const nativeValidation = (ctrl.$$hasNativeValidators = isObject(
10053
- node.validity,
10053
+ element.validity,
10054
10054
  ));
10055
10055
 
10056
10056
  if (nativeValidation) {
@@ -10597,12 +10597,11 @@ function ngValueDirective() {
10597
10597
  // TODO REMOVE IS SUPPORT
10598
10598
  // Support: IE9 only
10599
10599
  // In IE9 values are converted to string (e.g. `input.value = null` results in `input.value === 'null'`).
10600
- const propValue = isDefined(value)
10600
+ element["value"] = isDefined(value)
10601
10601
  ? isProxy(value)
10602
10602
  ? value.$target
10603
10603
  : value
10604
10604
  : null;
10605
- element["value"] = propValue;
10606
10605
  attr.$set("value", value);
10607
10606
  }
10608
10607
 
@@ -10661,7 +10660,7 @@ class SelectController {
10661
10660
  /**
10662
10661
  * @type {Array<string>}
10663
10662
  */
10664
- static $inject = ["$element", "$scope"];
10663
+ /* @ignore */ static $inject = ["$element", "$scope"];
10665
10664
 
10666
10665
  /**
10667
10666
  * @param {HTMLSelectElement} $element
@@ -11269,6 +11268,7 @@ function ngBindTemplateDirective() {
11269
11268
 
11270
11269
  ngBindHtmlDirective.$inject = [$injectTokens.$parse];
11271
11270
  /**
11271
+ * @param {import('../../core/parse/interface.ts').ParseService} $parse
11272
11272
  * @returns {import('../../interface.ts').Directive}
11273
11273
  */
11274
11274
  function ngBindHtmlDirective($parse) {
@@ -11971,7 +11971,7 @@ function ngRepeatDirective($animate) {
11971
11971
  transclude: "element",
11972
11972
  priority: 1000,
11973
11973
  terminal: true,
11974
- compile: ($element, $attr) => {
11974
+ compile: (_$element, $attr) => {
11975
11975
  const expression = $attr["ngRepeat"];
11976
11976
  const hasAnimate = !!$attr["animate"];
11977
11977
 
@@ -13151,7 +13151,7 @@ Object.entries(ALIASED_ATTR).forEach(([ngAttr]) => {
13151
13151
  *
13152
13152
  */
13153
13153
  const requiredDirective = [
13154
- "$parse",
13154
+ $injectTokens.$parse,
13155
13155
  /**
13156
13156
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
13157
13157
  * @returns {import("../../interface.ts").Directive}
@@ -13233,75 +13233,72 @@ const requiredDirective = [
13233
13233
  * </div>
13234
13234
  */
13235
13235
  const patternDirective = [
13236
- "$parse",
13236
+ $injectTokens.$parse,
13237
13237
  /**
13238
13238
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
13239
13239
  * @returns {import("../../interface.ts").Directive}
13240
13240
  */
13241
- ($parse) => {
13242
- return {
13243
- restrict: "A",
13244
- require: "?ngModel",
13245
- compile: (_Elm, tAttr) => {
13246
- let patternExp;
13247
- let parseFn;
13241
+ ($parse) => ({
13242
+ restrict: "A",
13243
+ require: "?ngModel",
13244
+ compile: (_Elm, tAttr) => {
13245
+ let patternExp;
13246
+ let parseFn;
13248
13247
 
13249
- if (tAttr["ngPattern"]) {
13250
- patternExp = tAttr["ngPattern"];
13248
+ if (tAttr["ngPattern"]) {
13249
+ patternExp = tAttr["ngPattern"];
13251
13250
 
13252
- // ngPattern might be a scope expression, or an inlined regex, which is not parsable.
13253
- // We get value of the attribute here, so we can compare the old and the new value
13254
- // in the observer to avoid unnecessary validations
13255
- if (
13256
- tAttr["ngPattern"].charAt(0) === "/" &&
13257
- REGEX_STRING_REGEXP.test(tAttr["ngPattern"])
13258
- ) {
13259
- parseFn = function () {
13260
- return tAttr["ngPattern"];
13261
- };
13262
- } else {
13263
- parseFn = $parse(tAttr["ngPattern"]);
13264
- }
13251
+ // ngPattern might be a scope expression, or an inlined regex, which is not parsable.
13252
+ // We get value of the attribute here, so we can compare the old and the new value
13253
+ // in the observer to avoid unnecessary validations
13254
+ if (
13255
+ tAttr["ngPattern"].charAt(0) === "/" &&
13256
+ REGEX_STRING_REGEXP.test(tAttr["ngPattern"])
13257
+ ) {
13258
+ parseFn = function () {
13259
+ return tAttr["ngPattern"];
13260
+ };
13261
+ } else {
13262
+ parseFn = $parse(tAttr["ngPattern"]);
13265
13263
  }
13264
+ }
13266
13265
 
13267
- return function (scope, elm, attr, ctrl) {
13268
- if (!ctrl) return;
13269
-
13270
- let attrVal = attr["pattern"];
13266
+ return function (scope, elm, attr, ctrl) {
13267
+ if (!ctrl) return;
13268
+ let attrVal = attr["pattern"];
13271
13269
 
13272
- if (attr["ngPattern"]) {
13273
- attrVal = parseFn(scope);
13274
- } else {
13275
- patternExp = attr["pattern"];
13276
- }
13270
+ if (attr["ngPattern"]) {
13271
+ attrVal = parseFn(scope);
13272
+ } else {
13273
+ patternExp = attr["pattern"];
13274
+ }
13277
13275
 
13278
- let regexp = parsePatternAttr(attrVal, patternExp, elm);
13279
- attr.$observe("pattern", function (newVal) {
13280
- const oldRegexp = regexp;
13276
+ let regexp = parsePatternAttr(attrVal, patternExp, elm);
13277
+ attr.$observe("pattern", (newVal) => {
13278
+ const oldRegexp = regexp;
13281
13279
 
13282
- regexp = parsePatternAttr(newVal, patternExp, elm);
13280
+ regexp = parsePatternAttr(newVal, patternExp, elm);
13283
13281
 
13284
- if (
13285
- (oldRegexp && oldRegexp.toString()) !==
13286
- (regexp && regexp.toString())
13287
- ) {
13288
- ctrl["$validate"]();
13289
- }
13290
- });
13282
+ if (
13283
+ (oldRegexp && oldRegexp.toString()) !==
13284
+ (regexp && regexp.toString())
13285
+ ) {
13286
+ ctrl["$validate"]();
13287
+ }
13288
+ });
13291
13289
 
13292
- ctrl["$validators"]["pattern"] = function (modelValue, viewValue) {
13293
- // HTML5 pattern constraint validates the input value, so we validate the viewValue
13294
- return (
13295
- // @ts-ignore
13296
- ctrl.$isEmpty(viewValue) ||
13297
- isUndefined(regexp) ||
13298
- regexp.test(viewValue)
13299
- );
13300
- };
13290
+ ctrl["$validators"]["pattern"] = (_modelValue, viewValue) => {
13291
+ // HTML5 pattern constraint validates the input value, so we validate the viewValue
13292
+ return (
13293
+ // @ts-ignore
13294
+ ctrl.$isEmpty(viewValue) ||
13295
+ isUndefined(regexp) ||
13296
+ regexp.test(viewValue)
13297
+ );
13301
13298
  };
13302
- },
13303
- };
13304
- },
13299
+ };
13300
+ },
13301
+ }),
13305
13302
  ];
13306
13303
 
13307
13304
  /**
@@ -13335,7 +13332,7 @@ const patternDirective = [
13335
13332
  *
13336
13333
  */
13337
13334
  const maxlengthDirective = [
13338
- "$parse",
13335
+ $injectTokens.$parse,
13339
13336
  /**
13340
13337
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
13341
13338
  * @returns {import("../../interface.ts").Directive}
@@ -13407,32 +13404,28 @@ const maxlengthDirective = [
13407
13404
  *
13408
13405
  */
13409
13406
  const minlengthDirective = [
13410
- "$parse",
13411
- function ($parse) {
13412
- return {
13413
- restrict: "A",
13414
- require: "?ngModel",
13415
- link(scope, elm, attr, ctrl) {
13416
- if (!ctrl) return;
13407
+ $injectTokens.$parse,
13408
+ ($parse) => ({
13409
+ restrict: "A",
13410
+ require: "?ngModel",
13411
+ link(scope, elm, attr, ctrl) {
13412
+ if (!ctrl) return;
13417
13413
 
13418
- let minlength = attr.minlength || $parse(attr.ngMinlength)(scope);
13419
- let minlengthParsed = parseLength(minlength) || -1;
13414
+ let minlength = attr.minlength || $parse(attr.ngMinlength)(scope);
13415
+ let minlengthParsed = parseLength(minlength) || -1;
13420
13416
 
13421
- attr.$observe("minlength", (value) => {
13422
- if (minlength !== value) {
13423
- minlengthParsed = parseLength(value) || -1;
13424
- minlength = value;
13425
- ctrl.$validate();
13426
- }
13427
- });
13428
- ctrl.$validators.minlength = function (modelValue, viewValue) {
13429
- return (
13430
- ctrl.$isEmpty(viewValue) || viewValue.length >= minlengthParsed
13431
- );
13432
- };
13433
- },
13434
- };
13435
- },
13417
+ attr.$observe("minlength", (value) => {
13418
+ if (minlength !== value) {
13419
+ minlengthParsed = parseLength(value) || -1;
13420
+ minlength = value;
13421
+ ctrl.$validate();
13422
+ }
13423
+ });
13424
+ ctrl.$validators.minlength = function (modelValue, viewValue) {
13425
+ return ctrl.$isEmpty(viewValue) || viewValue.length >= minlengthParsed;
13426
+ };
13427
+ },
13428
+ }),
13436
13429
  ];
13437
13430
 
13438
13431
  function parsePatternAttr(regex, patternExp, elm) {
@@ -13443,7 +13436,12 @@ function parsePatternAttr(regex, patternExp, elm) {
13443
13436
  }
13444
13437
 
13445
13438
  if (isString(regex)) {
13446
- regex = new RegExp(`^${regex}$`);
13439
+ const match = regex.match(/^\/(.*)\/([gimsuy]*)$/);
13440
+ if (match) {
13441
+ regex = new RegExp(match[1], match[2]);
13442
+ } else {
13443
+ regex = new RegExp(`^${regex}$`);
13444
+ }
13447
13445
  }
13448
13446
 
13449
13447
  if (!regex.test) {
@@ -13460,7 +13458,7 @@ function parsePatternAttr(regex, patternExp, elm) {
13460
13458
  }
13461
13459
 
13462
13460
  function parseLength(val) {
13463
- const intVal = toInt(val);
13461
+ const intVal = parseInt(val, 10);
13464
13462
  return isNumberNaN(intVal) ? -1 : intVal;
13465
13463
  }
13466
13464
 
@@ -13483,8 +13481,8 @@ class AnchorScrollProvider {
13483
13481
  }
13484
13482
 
13485
13483
  $get = [
13486
- "$location",
13487
- "$rootScope",
13484
+ $injectTokens.$location,
13485
+ $injectTokens.$rootScope,
13488
13486
  /**
13489
13487
  *
13490
13488
  * @param {import('../services/location/location.js').Location} $location
@@ -13562,7 +13560,7 @@ class AnchorScrollProvider {
13562
13560
  ? hash
13563
13561
  : isNumber(hash)
13564
13562
  ? hash.toString()
13565
- : $location.hash();
13563
+ : $location.getHash();
13566
13564
  let elm;
13567
13565
 
13568
13566
  // empty hash, scroll to the top of the page
@@ -13579,7 +13577,7 @@ class AnchorScrollProvider {
13579
13577
  };
13580
13578
 
13581
13579
  // does not scroll when user clicks on anchor link that is currently on
13582
- // (no url change, no $location.hash() change), browser native does scroll
13580
+ // (no url change, no $location.getHash() change), browser native does scroll
13583
13581
  if (this.autoScrollingEnabled) {
13584
13582
  $rootScope["$location"] = $location;
13585
13583
  $rootScope.$watch("$location.$$hash", (newVal, oldVal) => {
@@ -13952,8 +13950,7 @@ function blockKeyframeAnimations(node, applyBlock) {
13952
13950
 
13953
13951
  function applyInlineStyle(node, styleTuple) {
13954
13952
  const prop = styleTuple[0];
13955
- const value = styleTuple[1];
13956
- node.style[prop] = value;
13953
+ node.style[prop] = styleTuple[1];
13957
13954
  }
13958
13955
 
13959
13956
  function concatWithSpace(a, b) {
@@ -15023,7 +15020,7 @@ function limitToFilter() {
15023
15020
  if (Math.abs(Number(limit)) === Infinity) {
15024
15021
  limit = Number(limit);
15025
15022
  } else {
15026
- limit = toInt(/** @type {string} */ (limit));
15023
+ limit = parseInt(/** @type {string} */ (limit), 10);
15027
15024
  }
15028
15025
  if (isNumberNaN(limit)) return input;
15029
15026
 
@@ -15033,7 +15030,7 @@ function limitToFilter() {
15033
15030
  begin =
15034
15031
  !begin || isNaN(/** @type {any} */ (begin))
15035
15032
  ? 0
15036
- : toInt(/** @type {string} */ (begin));
15033
+ : parseInt(/** @type {string} */ (begin), 10);
15037
15034
  begin =
15038
15035
  begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
15039
15036
 
@@ -15227,6 +15224,8 @@ function orderByFilter($parse) {
15227
15224
  }
15228
15225
  }
15229
15226
 
15227
+ $IsStateFilter.$inject = [$injectTokens.$state];
15228
+
15230
15229
  /**
15231
15230
  * `isState` Filter: truthy if the current state is the parameter
15232
15231
  *
@@ -15236,18 +15235,19 @@ function orderByFilter($parse) {
15236
15235
  * ```html
15237
15236
  * <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
15238
15237
  * ```
15239
- */
15240
- $IsStateFilter.$inject = ["$state"];
15241
- /**
15238
+ *
15239
+ * @param {import('./state/state-service.js').StateProvider} $state
15242
15240
  * @returns {import('../interface.ts').FilterFn}
15243
15241
  */
15244
15242
  function $IsStateFilter($state) {
15245
- const isFilter = function (state, params, options) {
15246
- return $state.is(state, params, options);
15247
- };
15243
+ const isFilter = (state, params, options) =>
15244
+ $state.is(state, params, options);
15248
15245
  isFilter.$stateful = true;
15249
15246
  return isFilter;
15250
15247
  }
15248
+
15249
+ $IncludedByStateFilter.$inject = [$injectTokens.$state];
15250
+
15251
15251
  /**
15252
15252
  * `includedByState` Filter: truthy if the current state includes the parameter
15253
15253
  *
@@ -15257,9 +15257,8 @@ function $IsStateFilter($state) {
15257
15257
  * ```html
15258
15258
  * <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
15259
15259
  * ```
15260
- */
15261
- $IncludedByStateFilter.$inject = ["$state"];
15262
- /**
15260
+ *
15261
+ * @param {import('./state/state-service.js').StateProvider} $state
15263
15262
  * @returns {import('../interface.ts').FilterFn}
15264
15263
  */
15265
15264
  function $IncludedByStateFilter($state) {
@@ -15273,7 +15272,7 @@ function $IncludedByStateFilter($state) {
15273
15272
  const SUFFIX = "Filter";
15274
15273
 
15275
15274
  class FilterProvider {
15276
- static $inject = [$injectTokens.$provide];
15275
+ /* @ignore */ static $inject = [$injectTokens.$provide];
15277
15276
 
15278
15277
  /**
15279
15278
  * @param {import('../../interface.ts').Provider} $provide
@@ -17176,173 +17175,177 @@ function isConstant(ast) {
17176
17175
  return ast.constant;
17177
17176
  }
17178
17177
 
17179
- function ParseProvider() {
17180
- const cache = Object.create(null);
17178
+ class ParseProvider {
17179
+ constructor() {
17180
+ const cache = Object.create(null);
17181
17181
 
17182
- /** @type {function(any):boolean?} */
17183
- let identStart;
17182
+ /** @type {function(any):boolean?} */
17183
+ let identStart;
17184
17184
 
17185
- /** @type {function(any):boolean?} */
17186
- let identContinue;
17185
+ /** @type {function(any):boolean?} */
17186
+ let identContinue;
17187
17187
 
17188
- /**
17189
- * Allows defining the set of characters that are allowed in AngularTS expressions. The function
17190
- * `identifierStart` will get called to know if a given character is a valid character to be the
17191
- * first character for an identifier. The function `identifierContinue` will get called to know if
17192
- * a given character is a valid character to be a follow-up identifier character. The functions
17193
- * `identifierStart` and `identifierContinue` will receive as arguments the single character to be
17194
- * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
17195
- * mind that the `string` parameter can be two characters long depending on the character
17196
- * representation. It is expected for the function to return `true` or `false`, whether that
17197
- * character is allowed or not.
17198
- *
17199
- * Since this function will be called extensively, keep the implementation of these functions fast,
17200
- * as the performance of these functions have a direct impact on the expressions parsing speed.
17201
- *
17202
- * @param {function(any):boolean} [identifierStart] The function that will decide whether the given character is
17203
- * a valid identifier start character.
17204
- * @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
17205
- * a valid identifier continue character.
17206
- * @returns {ParseProvider}
17207
- */
17208
- this.setIdentifierFns = function (identifierStart, identifierContinue) {
17209
- identStart = identifierStart;
17210
- identContinue = identifierContinue;
17211
- return this;
17212
- };
17213
-
17214
- this.$get = [
17215
- "$filter",
17216
17188
  /**
17189
+ * Allows defining the set of characters that are allowed in AngularTS expressions. The function
17190
+ * `identifierStart` will get called to know if a given character is a valid character to be the
17191
+ * first character for an identifier. The function `identifierContinue` will get called to know if
17192
+ * a given character is a valid character to be a follow-up identifier character. The functions
17193
+ * `identifierStart` and `identifierContinue` will receive as arguments the single character to be
17194
+ * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
17195
+ * mind that the `string` parameter can be two characters long depending on the character
17196
+ * representation. It is expected for the function to return `true` or `false`, whether that
17197
+ * character is allowed or not.
17198
+ *
17199
+ * Since this function will be called extensively, keep the implementation of these functions fast,
17200
+ * as the performance of these functions have a direct impact on the expressions parsing speed.
17217
17201
  *
17218
- * @param {(any) => any} $filter
17219
- * @returns {import('./interface').ParseService}
17202
+ * @param {function(any):boolean} [identifierStart] The function that will decide whether the given character is
17203
+ * a valid identifier start character.
17204
+ * @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
17205
+ * a valid identifier continue character.
17206
+ * @returns {ParseProvider}
17220
17207
  */
17221
- function ($filter) {
17222
- /** @type {import("./lexer/lexer.js").LexerOptions} */
17223
- const $lexerOptions = {
17224
- isIdentifierStart: isFunction(identStart) && identStart,
17225
- isIdentifierContinue: isFunction(identContinue) && identContinue,
17226
- };
17227
- return $parse;
17208
+ this.setIdentifierFns = function (identifierStart, identifierContinue) {
17209
+ identStart = identifierStart;
17210
+ identContinue = identifierContinue;
17211
+ return this;
17212
+ };
17228
17213
 
17214
+ this.$get = [
17215
+ "$filter",
17229
17216
  /**
17230
- * @param {string} exp
17231
- * @param interceptorFn
17232
- * @returns any
17217
+ *
17218
+ * @param {(any) => any} $filter
17219
+ * @returns {import('./interface').ParseService}
17233
17220
  */
17234
- function $parse(exp, interceptorFn) {
17235
- let parsedExpression, cacheKey;
17221
+ function ($filter) {
17222
+ /** @type {import("./lexer/lexer.js").LexerOptions} */
17223
+ const $lexerOptions = {
17224
+ isIdentifierStart: isFunction(identStart) && identStart,
17225
+ isIdentifierContinue: isFunction(identContinue) && identContinue,
17226
+ };
17227
+ return $parse;
17236
17228
 
17237
- switch (typeof exp) {
17238
- case "string":
17239
- exp = exp.trim();
17240
- cacheKey = exp;
17229
+ /**
17230
+ * @param {string} exp
17231
+ * @param interceptorFn
17232
+ * @returns any
17233
+ */
17234
+ function $parse(exp, interceptorFn) {
17235
+ let parsedExpression, cacheKey;
17241
17236
 
17242
- parsedExpression = cache[cacheKey];
17237
+ switch (typeof exp) {
17238
+ case "string":
17239
+ exp = exp.trim();
17240
+ cacheKey = exp;
17243
17241
 
17244
- if (!parsedExpression) {
17245
- const lexer = new Lexer($lexerOptions);
17246
- const parser = new Parser(lexer, $filter);
17247
- parsedExpression = parser.parse(exp);
17242
+ parsedExpression = cache[cacheKey];
17248
17243
 
17249
- cache[cacheKey] = addWatchDelegate(parsedExpression);
17250
- }
17251
- return addInterceptor(parsedExpression, interceptorFn);
17244
+ if (!parsedExpression) {
17245
+ const lexer = new Lexer($lexerOptions);
17246
+ const parser = new Parser(lexer, $filter);
17247
+ parsedExpression = parser.parse(exp);
17252
17248
 
17253
- case "function":
17254
- return addInterceptor(exp, interceptorFn);
17249
+ cache[cacheKey] = addWatchDelegate(parsedExpression);
17250
+ }
17251
+ return addInterceptor(parsedExpression, interceptorFn);
17255
17252
 
17256
- default:
17257
- return addInterceptor(() => {}, interceptorFn);
17258
- }
17259
- }
17253
+ case "function":
17254
+ return addInterceptor(exp, interceptorFn);
17260
17255
 
17261
- /**
17262
- * @param {Function} parsedExpression
17263
- * @param interceptorFn
17264
- * @returns {import('./interface').CompiledExpression|*}
17265
- */
17266
- function addInterceptor(parsedExpression, interceptorFn) {
17267
- if (!interceptorFn) return parsedExpression;
17268
-
17269
- // Extract any existing interceptors out of the parsedExpression
17270
- // to ensure the original parsedExpression is always the $$intercepted
17271
- // @ts-ignore
17272
- if (parsedExpression.$$interceptor) {
17273
- interceptorFn = chainInterceptors(
17274
- // @ts-ignore
17275
- parsedExpression.$$interceptor,
17276
- interceptorFn,
17277
- );
17278
- // @ts-ignore
17279
- parsedExpression = parsedExpression.$$intercepted;
17256
+ default:
17257
+ return addInterceptor(() => {}, interceptorFn);
17258
+ }
17280
17259
  }
17281
17260
 
17282
- let useInputs = false;
17261
+ /**
17262
+ * @param {Function} parsedExpression
17263
+ * @param interceptorFn
17264
+ * @returns {import('./interface').CompiledExpression|*}
17265
+ */
17266
+ function addInterceptor(parsedExpression, interceptorFn) {
17267
+ if (!interceptorFn) {
17268
+ return parsedExpression;
17269
+ }
17283
17270
 
17284
- const fn = function interceptedExpression(
17285
- scope,
17286
- locals,
17287
- assign,
17288
- inputs,
17289
- ) {
17290
- const value =
17291
- useInputs && inputs
17292
- ? inputs[0]
17293
- : parsedExpression(scope, locals, assign, inputs);
17294
- // Do not invoke for getters
17295
- if (scope?.getter) {
17296
- return;
17271
+ // Extract any existing interceptors out of the parsedExpression
17272
+ // to ensure the original parsedExpression is always the $$intercepted
17273
+ // @ts-ignore
17274
+ if (parsedExpression.$$interceptor) {
17275
+ interceptorFn = chainInterceptors(
17276
+ // @ts-ignore
17277
+ parsedExpression.$$interceptor,
17278
+ interceptorFn,
17279
+ );
17280
+ // @ts-ignore
17281
+ parsedExpression = parsedExpression.$$intercepted;
17297
17282
  }
17298
- const res = isFunction(value) ? value() : value;
17299
- return interceptorFn(isProxy(res) ? res.$target : res);
17300
- };
17301
17283
 
17302
- // Maintain references to the interceptor/intercepted
17303
- fn.$$intercepted = parsedExpression;
17304
- fn.$$interceptor = interceptorFn;
17284
+ let useInputs = false;
17305
17285
 
17306
- // Propagate the literal/oneTime/constant attributes
17307
- // @ts-ignore
17308
- fn.literal = parsedExpression.literal;
17309
- // @ts-ignore
17310
- fn.oneTime = parsedExpression.oneTime;
17311
- // @ts-ignore
17312
- fn.constant = parsedExpression.constant;
17313
- // @ts-ignore
17314
- fn.decoratedNode = parsedExpression.decoratedNode;
17286
+ const fn = function interceptedExpression(
17287
+ scope,
17288
+ locals,
17289
+ assign,
17290
+ inputs,
17291
+ ) {
17292
+ const value =
17293
+ useInputs && inputs
17294
+ ? inputs[0]
17295
+ : parsedExpression(scope, locals, assign, inputs);
17296
+ // Do not invoke for getters
17297
+ if (scope?.getter) {
17298
+ return;
17299
+ }
17300
+ const res = isFunction(value) ? value() : value;
17301
+ return interceptorFn(isProxy(res) ? res.$target : res);
17302
+ };
17315
17303
 
17316
- // Treat the interceptor like filters.
17317
- // If it is not $stateful then only watch its inputs.
17318
- // If the expression itself has no inputs then use the full expression as an input.
17319
- if (!interceptorFn.$stateful) {
17304
+ // Maintain references to the interceptor/intercepted
17305
+ fn.$$intercepted = parsedExpression;
17306
+ fn.$$interceptor = interceptorFn;
17307
+
17308
+ // Propagate the literal/oneTime/constant attributes
17320
17309
  // @ts-ignore
17321
- useInputs = !parsedExpression.inputs;
17310
+ fn.literal = parsedExpression.literal;
17322
17311
  // @ts-ignore
17323
- fn.inputs = parsedExpression.inputs
17324
- ? // @ts-ignore
17325
- parsedExpression.inputs
17326
- : [parsedExpression];
17327
-
17328
- if (!interceptorFn.$$pure) {
17329
- fn.inputs = fn.inputs.map(function (e) {
17330
- // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a
17331
- // non-pure interceptor function.
17332
- if (e.isPure === PURITY_RELATIVE) {
17333
- return function depurifier(s) {
17334
- return e(s);
17335
- };
17336
- }
17337
- return e;
17338
- });
17312
+ fn.oneTime = parsedExpression.oneTime;
17313
+ // @ts-ignore
17314
+ fn.constant = parsedExpression.constant;
17315
+ // @ts-ignore
17316
+ fn.decoratedNode = parsedExpression.decoratedNode;
17317
+
17318
+ // Treat the interceptor like filters.
17319
+ // If it is not $stateful then only watch its inputs.
17320
+ // If the expression itself has no inputs then use the full expression as an input.
17321
+ if (!interceptorFn.$stateful) {
17322
+ // @ts-ignore
17323
+ useInputs = !parsedExpression.inputs;
17324
+ // @ts-ignore
17325
+ fn.inputs = parsedExpression.inputs
17326
+ ? // @ts-ignore
17327
+ parsedExpression.inputs
17328
+ : [parsedExpression];
17329
+
17330
+ if (!interceptorFn.$$pure) {
17331
+ fn.inputs = fn.inputs.map(function (e) {
17332
+ // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a
17333
+ // non-pure interceptor function.
17334
+ if (e.isPure === PURITY_RELATIVE) {
17335
+ return function depurifier(s) {
17336
+ return e(s);
17337
+ };
17338
+ }
17339
+ return e;
17340
+ });
17341
+ }
17339
17342
  }
17340
- }
17341
17343
 
17342
- return addWatchDelegate(fn);
17343
- }
17344
- },
17345
- ];
17344
+ return addWatchDelegate(fn);
17345
+ }
17346
+ },
17347
+ ];
17348
+ }
17346
17349
  }
17347
17350
 
17348
17351
  function constantWatchDelegate(
@@ -17820,8 +17823,7 @@ class InterpolateProvider {
17820
17823
  let j = 0;
17821
17824
  for (; j < ii; j++) {
17822
17825
  let fn = parseFns[j];
17823
- let res = fn(context);
17824
- vals[j] = res;
17826
+ vals[j] = fn(context);
17825
17827
  }
17826
17828
  cb(compute(vals));
17827
17829
  });
@@ -17830,8 +17832,7 @@ class InterpolateProvider {
17830
17832
  values[i] = parseFns[i](context);
17831
17833
  }
17832
17834
 
17833
- let res = compute(values);
17834
- return res;
17835
+ return compute(values);
17835
17836
  } catch (err) {
17836
17837
  interr(text, err);
17837
17838
  }
@@ -18223,6 +18224,7 @@ function HttpProvider() {
18223
18224
  });
18224
18225
 
18225
18226
  let useApplyAsync = false;
18227
+
18226
18228
  /**
18227
18229
  * Configure $http service to combine processing of multiple http responses received at around
18228
18230
  * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
@@ -18255,7 +18257,7 @@ function HttpProvider() {
18255
18257
  *
18256
18258
  * {@link ng.$http#interceptors Interceptors detailed info}
18257
18259
  */
18258
- const interceptorFactories = (this.interceptors = []);
18260
+ this.interceptors = [];
18259
18261
 
18260
18262
  /**
18261
18263
  * Array containing URLs whose origins are trusted to receive the XSRF token. See the
@@ -18292,8 +18294,10 @@ function HttpProvider() {
18292
18294
  * $http.get('https://stats.example.com/activity').then(...);
18293
18295
  * }]);
18294
18296
  * ```
18297
+ *
18298
+ * @type {string[]}
18295
18299
  */
18296
- const xsrfTrustedOrigins = (this.xsrfTrustedOrigins = []);
18300
+ this.xsrfTrustedOrigins = [];
18297
18301
 
18298
18302
  /**
18299
18303
  * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
@@ -18339,7 +18343,7 @@ function HttpProvider() {
18339
18343
  */
18340
18344
  const reversedInterceptors = [];
18341
18345
 
18342
- interceptorFactories.forEach((interceptorFactory) => {
18346
+ this.interceptors.forEach((interceptorFactory) => {
18343
18347
  reversedInterceptors.unshift(
18344
18348
  isString(interceptorFactory)
18345
18349
  ? $injector.get(interceptorFactory)
@@ -18350,7 +18354,9 @@ function HttpProvider() {
18350
18354
  /**
18351
18355
  * A function to check request URLs against a list of allowed origins.
18352
18356
  */
18353
- const urlIsAllowedOrigin = urlIsAllowedOriginFactory(xsrfTrustedOrigins);
18357
+ const urlIsAllowedOrigin = urlIsAllowedOriginFactory(
18358
+ this.xsrfTrustedOrigins,
18359
+ );
18354
18360
 
18355
18361
  /**
18356
18362
  * @property {Array.<Object>} requestConfig Array of config objects for currently pending
@@ -18849,24 +18855,13 @@ function HttpProvider() {
18849
18855
  }
18850
18856
 
18851
18857
  /**
18852
- * HTTP backend used by the {@link ng.$http service} that delegates to
18853
- * XMLHttpRequest object and deals with browser incompatibilities.
18854
- *
18855
- * You should never need to use this service directly, instead use the higher-level abstractions:
18856
- * {@link ng.$http $http}.
18857
- *
18858
- */
18859
- /**
18860
- * HTTP backend used by the {@link ng.$http service} that delegates to
18858
+ * HTTP backend used by the `$http` that delegates to
18861
18859
  * XMLHttpRequest object and deals with browser incompatibilities.
18862
- *
18863
- * You should never need to use this service directly, instead use the higher-level abstractions:
18864
- * {@link ng.$http $http}.
18865
- *
18860
+ * You should never need to use this service directly.
18866
18861
  */
18867
18862
  class HttpBackendProvider {
18868
18863
  constructor() {
18869
- this.$get = [() => createHttpBackend()];
18864
+ this.$get = () => createHttpBackend();
18870
18865
  }
18871
18866
  }
18872
18867
 
@@ -18874,7 +18869,21 @@ class HttpBackendProvider {
18874
18869
  * @returns
18875
18870
  */
18876
18871
  function createHttpBackend() {
18877
- // TODO(vojta): fix the signature
18872
+ /**
18873
+ * Makes an HTTP request using XMLHttpRequest with flexible options.
18874
+ *
18875
+ * @param {string} method - The HTTP method (e.g., "GET", "POST").
18876
+ * @param {string} [url] - The URL to send the request to. Defaults to the current page URL.
18877
+ * @param {*} [post] - The body to send with the request, if any.
18878
+ * @param {function(number, any, string|null, string, string): void} [callback] - Callback invoked when the request completes.
18879
+ * @param {Object<string, string|undefined>} [headers] - Headers to set on the request.
18880
+ * @param {number|Promise<any>} [timeout] - Timeout in ms or a cancellable promise.
18881
+ * @param {boolean} [withCredentials] - Whether to send credentials with the request.
18882
+ * @param {XMLHttpRequestResponseType} [responseType] - The type of data expected in the response.
18883
+ * @param {Object<string, EventListener>} [eventHandlers] - Event listeners for the XMLHttpRequest object.
18884
+ * @param {Object<string, EventListener>} [uploadEventHandlers] - Event listeners for the XMLHttpRequest.upload object.
18885
+ * @returns {void}
18886
+ */
18878
18887
  return function (
18879
18888
  method,
18880
18889
  url,
@@ -18891,34 +18900,31 @@ function createHttpBackend() {
18891
18900
 
18892
18901
  const xhr = new XMLHttpRequest();
18893
18902
  let abortedByTimeout = false;
18903
+ let timeoutId;
18894
18904
 
18895
18905
  xhr.open(method, url, true);
18906
+
18896
18907
  if (headers) {
18897
- Object.entries(headers).forEach(([key, value]) => {
18908
+ for (const [key, value] of Object.entries(headers)) {
18898
18909
  if (isDefined(value)) {
18899
18910
  xhr.setRequestHeader(key, value);
18900
18911
  }
18901
- });
18912
+ }
18902
18913
  }
18903
18914
 
18904
- xhr.onload = function () {
18915
+ xhr.onload = () => {
18916
+ let status = xhr.status || 0;
18905
18917
  const statusText = xhr.statusText || "";
18906
18918
 
18907
- let status = xhr.status;
18908
-
18909
- // fix status code when it is 0 (0 status is undocumented).
18910
- // Occurs when accessing file resources or on Android 4.1 stock browser
18911
- // while retrieving files from application cache.
18912
18919
  if (status === 0) {
18913
18920
  status = xhr.response
18914
18921
  ? 200
18915
- : urlResolve(url).protocol === "file"
18922
+ : new URL(url).protocol === "file:"
18916
18923
  ? 404
18917
18924
  : 0;
18918
18925
  }
18919
18926
 
18920
18927
  completeRequest(
18921
- callback,
18922
18928
  status,
18923
18929
  xhr.response,
18924
18930
  xhr.getAllResponseHeaders(),
@@ -18927,20 +18933,11 @@ function createHttpBackend() {
18927
18933
  );
18928
18934
  };
18929
18935
 
18930
- xhr.onerror = function () {
18931
- // The response is always empty
18932
- // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
18933
- completeRequest(callback, -1, null, null, "", "error");
18934
- };
18935
- xhr.ontimeout = function () {
18936
- // The response is always empty
18937
- // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
18938
- completeRequest(callback, -1, null, null, "", "timeout");
18939
- };
18936
+ xhr.onerror = () => completeRequest(-1, null, null, "", "error");
18937
+ xhr.ontimeout = () => completeRequest(-1, null, null, "", "timeout");
18940
18938
 
18941
- xhr.onabort = function () {
18939
+ xhr.onabort = () => {
18942
18940
  completeRequest(
18943
- callback,
18944
18941
  -1,
18945
18942
  null,
18946
18943
  null,
@@ -18950,16 +18947,15 @@ function createHttpBackend() {
18950
18947
  };
18951
18948
 
18952
18949
  if (eventHandlers) {
18953
- eventHandlers &&
18954
- Object.entries(eventHandlers).forEach(([key, value]) => {
18955
- xhr.addEventListener(key, value);
18956
- });
18950
+ for (const [key, handler] of Object.entries(eventHandlers)) {
18951
+ xhr.addEventListener(key, handler);
18952
+ }
18957
18953
  }
18958
18954
 
18959
18955
  if (uploadEventHandlers) {
18960
- Object.entries(uploadEventHandlers).forEach(([key, value]) => {
18961
- xhr.upload.addEventListener(key, value);
18962
- });
18956
+ for (const [key, handler] of Object.entries(uploadEventHandlers)) {
18957
+ xhr.upload.addEventListener(key, handler);
18958
+ }
18963
18959
  }
18964
18960
 
18965
18961
  if (withCredentials) {
@@ -18970,317 +18966,205 @@ function createHttpBackend() {
18970
18966
  try {
18971
18967
  xhr.responseType = responseType;
18972
18968
  } catch (e) {
18973
- // WebKit added support for the json responseType value on 09/03/2013
18974
- // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
18975
- // known to throw when setting the value "json" as the response type. Other older
18976
- // browsers implementing the responseType
18977
- //
18978
- // The json response type can be ignored if not supported, because JSON payloads are
18979
- // parsed on the client-side regardless.
18980
- if (responseType !== "json") {
18981
- throw e;
18982
- }
18969
+ if (responseType !== "json") throw e;
18983
18970
  }
18984
18971
  }
18985
18972
 
18986
18973
  xhr.send(isUndefined(post) ? null : post);
18987
18974
 
18988
- // Since we are using xhr.abort() when a request times out, we have to set a flag that
18989
- // indicates to requestAborted if the request timed out or was aborted.
18990
- //
18991
- // http.timeout = numerical timeout timeout
18992
- // http.timeout = $timeout timeout
18993
- // http.timeout = promise abort
18994
- // xhr.abort() abort (The xhr object is normally inaccessible, but
18995
- // can be exposed with the xhrFactory)
18996
- /** @type {number} */
18997
- let timeoutId;
18998
- if (timeout > 0) {
18999
- timeoutId = setTimeout(() => {
19000
- timeoutRequest("timeout");
19001
- }, timeout);
18975
+ if (typeof timeout === "number" && timeout > 0) {
18976
+ timeoutId = setTimeout(() => timeoutRequest("timeout"), timeout);
19002
18977
  } else if (isPromiseLike(timeout)) {
19003
- timeout.then(() => {
19004
- timeoutRequest(isDefined(timeout.$$timeoutId) ? "timeout" : "abort");
18978
+ /** @type {Promise} */ (timeout).then(() => {
18979
+ timeoutRequest(isDefined(timeout["$$timeoutId"]) ? "timeout" : "abort");
19005
18980
  });
19006
18981
  }
19007
18982
 
18983
+ /**
18984
+ * @param {"timeout"|"abort"} reason
18985
+ */
19008
18986
  function timeoutRequest(reason) {
19009
18987
  abortedByTimeout = reason === "timeout";
19010
- if (xhr) {
19011
- xhr.abort();
19012
- }
18988
+ if (xhr) xhr.abort();
19013
18989
  }
19014
18990
 
18991
+ /**
18992
+ * @param {number} status - HTTP status code or -1 for network errors.
18993
+ * @param {*} response - The parsed or raw response from the server.
18994
+ * @param {string|null} headersString - The raw response headers as a string.
18995
+ * @param {string} statusText - The status text returned by the server.
18996
+ * @param {"complete"|"error"|"timeout"|"abort"} xhrStatus - Final status of the request.
18997
+ */
19015
18998
  function completeRequest(
19016
- callback,
19017
18999
  status,
19018
19000
  response,
19019
19001
  headersString,
19020
19002
  statusText,
19021
19003
  xhrStatus,
19022
19004
  ) {
19023
- // cancel timeout and subsequent timeout promise resolution
19024
19005
  if (isDefined(timeoutId)) {
19025
19006
  clearTimeout(timeoutId);
19026
19007
  }
19027
-
19028
19008
  callback(status, response, headersString, statusText, xhrStatus);
19029
19009
  }
19030
19010
  };
19031
19011
  }
19032
19012
 
19013
+ const PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/;
19014
+ const $locationMinErr = minErr("$location");
19015
+
19016
+ let urlUpdatedByLocation = false;
19017
+
19033
19018
  /**
19034
- * @typedef {Object} DefaultPorts
19035
- * @property {number} http
19036
- * @property {number} https
19037
- * @property {number} ftp
19019
+ * @ignore
19020
+ * The pathname, beginning with "/"
19021
+ * @type {string}
19038
19022
  */
19023
+ let $$path;
19039
19024
 
19040
19025
  /**
19041
- * Represents the configuration options for HTML5 mode.
19042
- *
19043
- * @typedef {Object} Html5Mode
19044
- * @property {boolean} enabled - (default: false) If true, will rely on `history.pushState` to
19045
- * change URLs where supported. Falls back to hash-prefixed paths in browsers that do not
19046
- * support `pushState`.
19047
- * @property {boolean} requireBase - (default: `true`) When html5Mode is enabled, specifies
19048
- * whether or not a `<base>` tag is required to be present. If both `enabled` and `requireBase`
19049
- * are true, and a `<base>` tag is not present, an error will be thrown when `$location` is injected.
19050
- * See the {@link guide/$location $location guide} for more information.
19051
- * @property {boolean|string} rewriteLinks - (default: `true`) When html5Mode is enabled, enables or
19052
- * disables URL rewriting for relative links. If set to a string, URL rewriting will only apply to links
19053
- * with an attribute that matches the given string. For example, if set to `'internal-link'`, URL rewriting
19054
- * will only occur for `<a internal-link>` links. Note that [attribute name normalization](guide/directive#normalization)
19055
- * does not apply here, so `'internalLink'` will **not** match `'internal-link'`.
19026
+ * @type {Object.<string,boolean|Array>}
19056
19027
  */
19057
-
19058
- /** @type {DefaultPorts} */
19059
- const DEFAULT_PORTS = { http: 80, https: 443, ftp: 21 };
19060
- const PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/;
19061
- const $locationMinErr = minErr("$location");
19028
+ let $$search;
19062
19029
 
19063
19030
  /**
19064
- * @abstract
19031
+ * @ignore
19032
+ * The hash string, minus the hash symbol
19033
+ * @type {string}
19065
19034
  */
19035
+ let $$hash;
19036
+
19066
19037
  class Location {
19067
19038
  /**
19068
19039
  * @param {string} appBase application base URL
19069
19040
  * @param {string} appBaseNoFile application base URL stripped of any filename
19041
+ * @param {boolean} [html5] Defaults to true
19042
+ * @param {string} [prefix] URL path prefix for html5 mode or hash prefix for hashbang mode
19070
19043
  */
19071
- constructor(appBase, appBaseNoFile) {
19072
- const parsedUrl = urlResolve(appBase);
19073
-
19044
+ constructor(appBase, appBaseNoFile, html5 = true, prefix) {
19074
19045
  /** @type {string} */
19075
19046
  this.appBase = appBase;
19076
19047
 
19077
19048
  /** @type {string} */
19078
19049
  this.appBaseNoFile = appBaseNoFile;
19079
19050
 
19080
- /**
19081
- * An absolute URL is the full URL, including protocol (http/https ), the optional subdomain (e.g. www ), domain (example.com), and path (which includes the directory and slug).
19082
- * @type {string}
19083
- */
19084
- this.$$absUrl = "";
19085
-
19086
- /**
19087
- * If html5 mode is enabled
19088
- * @type {boolean}
19089
- */
19090
- this.$$html5 = false;
19091
-
19092
- /**
19093
- * Has any change been replacing?
19094
- * @type {boolean}
19095
- */
19096
- this.$$replace = false;
19051
+ /** @type {boolean} */
19052
+ this.html5 = html5;
19097
19053
 
19098
- /** @type {string} */
19099
- this.$$protocol = parsedUrl.protocol;
19054
+ /** @type {string | undefined} */
19055
+ this.basePrefix = html5 ? prefix || "" : undefined;
19100
19056
 
19101
- /** @type {string} */
19102
- this.$$host = parsedUrl.hostname;
19057
+ /** @type {string | undefined} */
19058
+ this.hashPrefix = html5 ? undefined : prefix;
19103
19059
 
19104
19060
  /**
19105
- * The port, without ":"
19106
- * @type {number}
19107
- */
19108
- this.$$port =
19109
- toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
19110
-
19111
- /**
19112
- * The pathname, beginning with "/"
19061
+ * An absolute URL is the full URL, including protocol (http/https ), the optional subdomain (e.g. www ), domain (example.com), and path (which includes the directory and slug)
19062
+ * with all segments encoded according to rules specified in [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
19113
19063
  * @type {string}
19114
19064
  */
19115
- this.$$path = undefined;
19065
+ this.absUrl = "";
19116
19066
 
19117
19067
  /**
19118
- * The hash string, minus the hash symbol
19068
+ * @ignore
19069
+ * Current url
19119
19070
  * @type {string}
19120
19071
  */
19121
- this.$$hash = undefined;
19072
+ this.$$url = undefined;
19122
19073
 
19123
19074
  /**
19124
- * Helper property for scope watch changes
19125
- * @type {boolean}
19075
+ * @ignore
19076
+ * Callback to update browser url
19077
+ * @type {Function}
19126
19078
  */
19127
- this.$$urlUpdatedByLocation = false;
19128
- }
19129
-
19130
- /**
19131
- * Return full URL representation with all segments encoded according to rules specified in
19132
- * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
19133
- *
19134
- * @return {string} full URL
19135
- */
19136
- absUrl() {
19137
- return this.$$absUrl;
19079
+ this.$$updateBrowser = undefined;
19138
19080
  }
19139
19081
 
19140
19082
  /**
19141
- * This method is getter / setter.
19142
- *
19143
- * Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
19144
19083
  * Change path, search and hash, when called with parameter and return `$location`.
19145
19084
  *
19146
- * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`)
19147
- * @return {Location|string} url
19085
+ * @param {string} url New URL without base prefix (e.g. `/path?a=b#hash`)
19086
+ * @return {Location} url
19148
19087
  */
19149
- url(url) {
19150
- if (isUndefined(url)) {
19151
- return this.$$url;
19088
+ setUrl(url) {
19089
+ const match = PATH_MATCH.exec(url);
19090
+
19091
+ if (match[1] !== undefined || url === "") {
19092
+ this.setPath(match[1] || "");
19152
19093
  }
19153
19094
 
19154
- const match = PATH_MATCH.exec(url);
19155
- if (match[1] || url === "") this.path(decodeURIComponent(match[1]));
19156
- if (match[2] || match[1] || url === "") this.search(match[3] || "");
19157
- this.hash(match[5] || "");
19095
+ if (match[2] !== undefined || match[1] !== undefined || url === "") {
19096
+ this.setSearch(match[3] || "");
19097
+ }
19098
+
19099
+ this.setHash(match[5] || "");
19158
19100
 
19159
19101
  return this;
19160
19102
  }
19161
19103
 
19162
19104
  /**
19105
+ * Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
19163
19106
  *
19164
- * Return protocol of current URL.
19165
- * @return {string} protocol of current URL
19107
+ * @return {string} url
19166
19108
  */
19167
- protocol() {
19168
- return this.$$protocol;
19109
+ getUrl() {
19110
+ return this.$$url;
19169
19111
  }
19170
19112
 
19171
19113
  /**
19172
- * This method is getter only.
19173
- *
19174
- * Return host of current URL.
19114
+ * Change path parameter and return `$location`.
19175
19115
  *
19176
- * Note: compared to the non-AngularTS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
19177
- *
19178
- *
19179
- * @return {string} host of current URL.
19116
+ * @param {(string|number)} path New path
19117
+ * @return {Location}
19180
19118
  */
19181
- host() {
19182
- return this.$$host;
19183
- }
19184
-
19185
- /**
19186
- * This method is getter only.
19187
- *
19188
- * Return port of current URL.
19189
- *
19190
- *
19191
- * ```js
19192
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
19193
- * let port = $location.port();
19194
- * // => 80
19195
- * ```
19196
- *
19197
- * @return {number} port
19198
- */
19199
- port() {
19200
- return this.$$port;
19119
+ setPath(path) {
19120
+ let newPath = path !== null ? path.toString() : "";
19121
+ $$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
19122
+ this.$$compose();
19123
+ return this;
19201
19124
  }
19202
19125
 
19203
19126
  /**
19204
- * This method is getter / setter.
19205
19127
  *
19206
- * Return path of current URL when called without any parameter.
19128
+ * Return path of current URL
19207
19129
  *
19208
- * Change path when called with parameter and return `$location`.
19209
- *
19210
- * Note: Path should always begin with forward slash (/), this method will add the forward slash
19211
- * if it is missing.
19212
- *
19213
- *
19214
- * ```js
19215
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
19216
- * let path = $location.path();
19217
- * // => "/some/path"
19218
- * ```
19219
- *
19220
- * @param {(string|number)=} path New path
19221
- * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
19130
+ * @return {string}
19222
19131
  */
19223
- path(path) {
19224
- if (isUndefined(path)) {
19225
- return this.$$path;
19226
- }
19227
- let newPath = path !== null ? path.toString() : "";
19228
- this.$$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
19229
- this.$$compose();
19230
- return this;
19132
+ getPath() {
19133
+ return $$path;
19231
19134
  }
19232
19135
 
19233
19136
  /**
19234
- * This method is getter / setter.
19235
- *
19236
- * Returns the hash fragment when called without any parameters.
19237
- *
19238
19137
  * Changes the hash fragment when called with a parameter and returns `$location`.
19239
- *
19240
- *
19241
- * ```js
19242
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
19243
- * let hash = $location.hash();
19244
- * // => "hashValue"
19245
- * ```
19246
- *
19247
- * @param {(string|number)=} hash New hash fragment
19248
- * @return {string|Location} hash
19138
+ * @param {(string|number)} hash New hash fragment
19139
+ * @return {Location} hash
19249
19140
  */
19250
- hash(hash) {
19251
- if (isUndefined(hash)) {
19252
- return this.$$hash;
19253
- }
19254
-
19255
- this.$$hash = hash !== null ? hash.toString() : "";
19141
+ setHash(hash) {
19142
+ $$hash = hash !== null ? hash.toString() : "";
19256
19143
  this.$$compose();
19257
19144
  return this;
19258
19145
  }
19259
19146
 
19260
19147
  /**
19261
- * If called, all changes to $location during the current `$digest` will replace the current history
19262
- * record, instead of adding a new one.
19148
+ * Returns the hash fragment when called without any parameters.
19149
+ * @return {string} hash
19263
19150
  */
19264
- replace() {
19265
- this.$$replace = true;
19266
- return this;
19151
+ getHash() {
19152
+ return $$hash;
19267
19153
  }
19268
19154
 
19269
19155
  /**
19270
- * Returns or sets the search part (as object) of current URL when called without any parameter
19156
+ * Sets the search part (as object) of current URL
19271
19157
  *
19272
- * @param {string|Object=} search New search params - string or hash object.
19158
+ * @param {string|Object} search New search params - string or hash object.
19273
19159
  * @param {(string|number|Array<string>|boolean)=} paramValue If search is a string or number, then paramValue will override only a single search property.
19274
- * @returns {Object|Location} Search object or Location object
19160
+ * @returns {Object} Search object or Location object
19275
19161
  */
19276
- search(search, paramValue) {
19162
+ setSearch(search, paramValue) {
19277
19163
  switch (arguments.length) {
19278
- case 0:
19279
- return this.$$search;
19280
19164
  case 1:
19281
19165
  if (isString(search) || isNumber(search)) {
19282
19166
  search = search.toString();
19283
- this.$$search = parseKeyValue(search);
19167
+ $$search = parseKeyValue(search);
19284
19168
  } else if (isObject(search)) {
19285
19169
  search = structuredClone(search, {});
19286
19170
  // remove object undefined or null properties
@@ -19288,7 +19172,7 @@ class Location {
19288
19172
  if (value == null) delete search[key];
19289
19173
  });
19290
19174
 
19291
- this.$$search = search;
19175
+ $$search = search;
19292
19176
  } else {
19293
19177
  throw $locationMinErr(
19294
19178
  "isrcharg",
@@ -19298,9 +19182,10 @@ class Location {
19298
19182
  break;
19299
19183
  default:
19300
19184
  if (isUndefined(paramValue) || paramValue === null) {
19301
- delete this.$$search[search];
19185
+ delete $$search[search];
19302
19186
  } else {
19303
- this.$$search[search] = paramValue;
19187
+ // @ts-ignore
19188
+ $$search[search] = paramValue;
19304
19189
  }
19305
19190
  }
19306
19191
 
@@ -19309,28 +19194,28 @@ class Location {
19309
19194
  }
19310
19195
 
19311
19196
  /**
19312
- * Compose url and update `url` and `absUrl` property
19313
- * @returns {void}
19197
+ * Returns the search part (as object) of current URL
19198
+ *
19199
+ * @returns {Object} Search object or Location object
19314
19200
  */
19315
- $$compose() {
19316
- this.$$url = normalizePath(this.$$path, this.$$search, this.$$hash);
19317
- this.$$absUrl = this.$$normalizeUrl(this.$$url);
19318
- this.$$urlUpdatedByLocation = true;
19201
+ getSearch() {
19202
+ return $$search;
19319
19203
  }
19320
19204
 
19321
19205
  /**
19322
- * @param {string} _url
19323
- * @returns {string}
19206
+ * @private
19207
+ * Compose url and update `url` and `absUrl` property
19324
19208
  */
19325
- $$normalizeUrl(_url) {
19326
- throw new Error(`Method not implemented ${_url}`);
19209
+ $$compose() {
19210
+ this.$$url = normalizePath($$path, $$search, $$hash);
19211
+ this.absUrl = this.html5
19212
+ ? this.appBaseNoFile + this.$$url.substring(1)
19213
+ : this.appBase + (this.$$url ? this.hashPrefix + this.$$url : "");
19214
+ urlUpdatedByLocation = true;
19215
+ setTimeout(() => this.$$updateBrowser && this.$$updateBrowser());
19327
19216
  }
19328
19217
 
19329
19218
  /**
19330
- * This method is getter / setter.
19331
- *
19332
- * Return the history state object when called without any parameter.
19333
- *
19334
19219
  * Change the history state object when called with one parameter and return `$location`.
19335
19220
  * The state object is later passed to `pushState` or `replaceState`.
19336
19221
  * See {@link https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#state|History.state}
@@ -19338,85 +19223,30 @@ class Location {
19338
19223
  * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
19339
19224
  * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
19340
19225
  * older browsers (like IE9 or Android < 4.0), don't use this method.
19341
- *
19342
- * @param {any} state State object for pushState or replaceState
19343
- * @return {any} state
19226
+ * @param {any} state
19227
+ * @returns {Location}
19344
19228
  */
19345
- state(state) {
19346
- if (!arguments.length) {
19347
- return this.$$state;
19348
- }
19349
-
19350
- if (!(this instanceof LocationHtml5Url) || !this.$$html5) {
19229
+ setState(state) {
19230
+ if (!this.html5) {
19351
19231
  throw $locationMinErr(
19352
19232
  "nostate",
19353
- "History API state support is available only " +
19354
- "in HTML5 mode and only in browsers supporting HTML5 History API",
19233
+ "History API state support is available only in HTML5 mode",
19355
19234
  );
19356
19235
  }
19357
- // The user might modify `stateObject` after invoking `$location.state(stateObject)`
19236
+ // The user might modify `stateObject` after invoking `$location.setState(stateObject)`
19358
19237
  // but we're changing the $$state reference to $browser.state() during the $digest
19359
19238
  // so the modification window is narrow.
19360
19239
  this.$$state = isUndefined(state) ? null : state;
19361
- this.$$urlUpdatedByLocation = true;
19240
+ urlUpdatedByLocation = true;
19362
19241
  return this;
19363
19242
  }
19364
19243
 
19365
19244
  /**
19366
- * @param {string} _url
19367
- * @param {string} _url2
19368
- * @returns {boolean}
19369
- */
19370
- $$parseLinkUrl(_url, _url2) {
19371
- throw new Error(`Method not implemented ${_url} ${_url2}`);
19372
- }
19373
-
19374
- $$parse(_url) {
19375
- throw new Error(`Method not implemented ${_url}`);
19376
- }
19377
- }
19378
-
19379
- /**
19380
- * This object is exposed as $location service when HTML5 mode is enabled and supported
19381
- */
19382
- class LocationHtml5Url extends Location {
19383
- /**
19384
- * @param {string} appBase application base URL
19385
- * @param {string} appBaseNoFile application base URL stripped of any filename
19386
- * @param {string} basePrefix URL path prefix
19387
- */
19388
- constructor(appBase, appBaseNoFile, basePrefix) {
19389
- super(appBase, appBaseNoFile);
19390
- this.$$html5 = true;
19391
- this.basePrefix = basePrefix || "";
19392
- }
19393
-
19394
- /**
19395
- * Parse given HTML5 (regular) URL string into properties
19396
- * @param {string} url HTML5 URL
19245
+ * Return the history state object
19246
+ * @returns {any}
19397
19247
  */
19398
- $$parse(url) {
19399
- const pathUrl = stripBaseUrl(this.appBaseNoFile, url);
19400
- if (!isString(pathUrl)) {
19401
- throw $locationMinErr(
19402
- "ipthprfx",
19403
- 'Invalid url "{0}", missing path prefix "{1}".',
19404
- url,
19405
- this.appBaseNoFile,
19406
- );
19407
- }
19408
-
19409
- parseAppUrl(pathUrl, this, true);
19410
-
19411
- if (!this.$$path) {
19412
- this.$$path = "/";
19413
- }
19414
-
19415
- this.$$compose();
19416
- }
19417
-
19418
- $$normalizeUrl(url) {
19419
- return this.appBaseNoFile + url.substring(1); // first char is always '/'
19248
+ getState() {
19249
+ return this.$$state;
19420
19250
  }
19421
19251
 
19422
19252
  /**
@@ -19424,148 +19254,138 @@ class LocationHtml5Url extends Location {
19424
19254
  * @param {string} relHref
19425
19255
  * @returns {boolean}
19426
19256
  */
19427
- $$parseLinkUrl(url, relHref) {
19428
- if (relHref && relHref[0] === "#") {
19429
- // special case for links to hash fragments:
19430
- // keep the old url and only replace the hash fragment
19431
- this.hash(relHref.slice(1));
19432
- return true;
19433
- }
19434
- let appUrl;
19435
- let prevAppUrl;
19436
- let rewrittenUrl;
19257
+ parseLinkUrl(url, relHref) {
19258
+ if (this.html5) {
19259
+ if (relHref && relHref[0] === "#") {
19260
+ // special case for links to hash fragments:
19261
+ // keep the old url and only replace the hash fragment
19262
+ this.setHash(relHref.slice(1));
19263
+ return true;
19264
+ }
19265
+ let appUrl;
19266
+ let prevAppUrl;
19267
+ let rewrittenUrl;
19437
19268
 
19438
- if (isDefined((appUrl = stripBaseUrl(this.appBase, url)))) {
19439
- prevAppUrl = appUrl;
19440
- if (
19441
- this.basePrefix &&
19442
- isDefined((appUrl = stripBaseUrl(this.basePrefix, appUrl)))
19443
- ) {
19444
- rewrittenUrl =
19445
- this.appBaseNoFile + (stripBaseUrl("/", appUrl) || appUrl);
19446
- } else {
19447
- rewrittenUrl = this.appBase + prevAppUrl;
19269
+ if (isDefined((appUrl = stripBaseUrl(this.appBase, url)))) {
19270
+ prevAppUrl = appUrl;
19271
+ if (
19272
+ this.basePrefix &&
19273
+ isDefined((appUrl = stripBaseUrl(this.basePrefix, appUrl)))
19274
+ ) {
19275
+ rewrittenUrl =
19276
+ this.appBaseNoFile + (stripBaseUrl("/", appUrl) || appUrl);
19277
+ } else {
19278
+ rewrittenUrl = this.appBase + prevAppUrl;
19279
+ }
19280
+ } else if (isDefined((appUrl = stripBaseUrl(this.appBaseNoFile, url)))) {
19281
+ rewrittenUrl = this.appBaseNoFile + appUrl;
19282
+ } else if (this.appBaseNoFile === `${url}/`) {
19283
+ rewrittenUrl = this.appBaseNoFile;
19448
19284
  }
19449
- } else if (isDefined((appUrl = stripBaseUrl(this.appBaseNoFile, url)))) {
19450
- rewrittenUrl = this.appBaseNoFile + appUrl;
19451
- } else if (this.appBaseNoFile === `${url}/`) {
19452
- rewrittenUrl = this.appBaseNoFile;
19453
- }
19454
- if (rewrittenUrl) {
19455
- this.$$parse(rewrittenUrl);
19285
+ if (rewrittenUrl) {
19286
+ this.parse(rewrittenUrl);
19287
+ }
19288
+ return !!rewrittenUrl;
19289
+ } else {
19290
+ if (stripHash(this.appBase) === stripHash(url)) {
19291
+ this.parse(url);
19292
+ return true;
19293
+ }
19294
+ return false;
19456
19295
  }
19457
- return !!rewrittenUrl;
19458
19296
  }
19459
- }
19460
19297
 
19461
- /**
19462
- * LocationHashbangUrl represents URL
19463
- * This object is exposed as $location service when developer doesn't opt into html5 mode.
19464
- * It also serves as the base class for html5 mode fallback on legacy browsers.
19465
- *
19466
- */
19467
- class LocationHashbangUrl extends Location {
19468
19298
  /**
19469
- * @param {string} appBase application base URL
19470
- * @param {string} appBaseNoFile application base URL stripped of any filename
19471
- * @param {string} hashPrefix hashbang prefix
19299
+ * Parse given HTML5 (regular) URL string into properties
19300
+ * @param {string} url HTML5 URL
19472
19301
  */
19473
- constructor(appBase, appBaseNoFile, hashPrefix) {
19474
- super(appBase, appBaseNoFile);
19475
- this.hashPrefix = hashPrefix;
19476
- }
19302
+ parse(url) {
19303
+ if (this.html5) {
19304
+ const pathUrl = stripBaseUrl(this.appBaseNoFile, url);
19305
+ if (!isString(pathUrl)) {
19306
+ throw $locationMinErr(
19307
+ "ipthprfx",
19308
+ 'Invalid url "{0}", missing path prefix "{1}".',
19309
+ url,
19310
+ this.appBaseNoFile,
19311
+ );
19312
+ }
19477
19313
 
19478
- /**
19479
- * Parse given hashbang URL into properties
19480
- * @param {string} url Hashbang URL
19481
- */
19482
- $$parse(url) {
19483
- const withoutBaseUrl =
19484
- stripBaseUrl(this.appBase, url) || stripBaseUrl(this.appBaseNoFile, url);
19485
- let withoutHashUrl;
19314
+ parseAppUrl(pathUrl, true);
19486
19315
 
19487
- if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === "#") {
19488
- // The rest of the URL starts with a hash so we have
19489
- // got either a hashbang path or a plain hash fragment
19490
- withoutHashUrl = stripBaseUrl(this.hashPrefix, withoutBaseUrl);
19491
- if (isUndefined(withoutHashUrl)) {
19492
- // There was no hashbang prefix so we just have a hash fragment
19493
- withoutHashUrl = withoutBaseUrl;
19316
+ if (!$$path) {
19317
+ $$path = "/";
19494
19318
  }
19319
+
19320
+ this.$$compose();
19495
19321
  } else {
19496
- // There was no hashbang path nor hash fragment:
19497
- // If we are in HTML5 mode we use what is left as the path;
19498
- // Otherwise we ignore what is left
19499
- if (this.$$html5) {
19500
- withoutHashUrl = withoutBaseUrl;
19322
+ const withoutBaseUrl =
19323
+ stripBaseUrl(this.appBase, url) ||
19324
+ stripBaseUrl(this.appBaseNoFile, url);
19325
+ let withoutHashUrl;
19326
+
19327
+ if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === "#") {
19328
+ // The rest of the URL starts with a hash so we have
19329
+ // got either a hashbang path or a plain hash fragment
19330
+ withoutHashUrl = stripBaseUrl(this.hashPrefix, withoutBaseUrl);
19331
+ if (isUndefined(withoutHashUrl)) {
19332
+ // There was no hashbang prefix so we just have a hash fragment
19333
+ withoutHashUrl = withoutBaseUrl;
19334
+ }
19501
19335
  } else {
19502
- withoutHashUrl = "";
19503
- if (isUndefined(withoutBaseUrl)) {
19504
- this.appBase = url;
19505
- /** @type {?} */ (this).replace();
19336
+ // There was no hashbang path nor hash fragment:
19337
+ // If we are in HTML5 mode we use what is left as the path;
19338
+ // Otherwise we ignore what is left
19339
+ if (this.html5) {
19340
+ withoutHashUrl = withoutBaseUrl;
19341
+ } else {
19342
+ withoutHashUrl = "";
19343
+ if (isUndefined(withoutBaseUrl)) {
19344
+ this.appBase = url;
19345
+ }
19506
19346
  }
19507
19347
  }
19508
- }
19509
19348
 
19510
- parseAppUrl(withoutHashUrl, this, false);
19349
+ parseAppUrl(withoutHashUrl, false);
19511
19350
 
19512
- this.$$path = removeWindowsDriveName(
19513
- this.$$path,
19514
- withoutHashUrl,
19515
- this.appBase,
19516
- );
19351
+ $$path = removeWindowsDriveName($$path, withoutHashUrl, this.appBase);
19517
19352
 
19518
- this.$$compose();
19353
+ this.$$compose();
19519
19354
 
19520
- /*
19521
- * In Windows, on an anchor node on documents loaded from
19522
- * the filesystem, the browser will return a pathname
19523
- * prefixed with the drive name ('/C:/path') when a
19524
- * pathname without a drive is set:
19525
- * * a.setAttribute('href', '/foo')
19526
- * * a.pathname === '/C:/foo' //true
19527
- *
19528
- * Inside of AngularTS, we're always using pathnames that
19529
- * do not include drive names for routing.
19530
- */
19531
- function removeWindowsDriveName(path, url, base) {
19532
19355
  /*
19533
- Matches paths for file protocol on windows,
19534
- such as /C:/foo/bar, and captures only /foo/bar.
19535
- */
19536
- const windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
19537
-
19538
- let firstPathSegmentMatch;
19539
-
19540
- // Get the relative path from the input URL.
19541
- if (startsWith(url, base)) {
19542
- url = url.replace(base, "");
19543
- }
19356
+ * In Windows, on an anchor node on documents loaded from
19357
+ * the filesystem, the browser will return a pathname
19358
+ * prefixed with the drive name ('/C:/path') when a
19359
+ * pathname without a drive is set:
19360
+ * * a.setAttribute('href', '/foo')
19361
+ * * a.pathname === '/C:/foo' //true
19362
+ *
19363
+ * Inside of AngularTS, we're always using pathnames that
19364
+ * do not include drive names for routing.
19365
+ */
19366
+ function removeWindowsDriveName(path, url, base) {
19367
+ /*
19368
+ Matches paths for file protocol on windows,
19369
+ such as /C:/foo/bar, and captures only /foo/bar.
19370
+ */
19371
+ const windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
19544
19372
 
19545
- // The input URL intentionally contains a first path segment that ends with a colon.
19546
- if (windowsFilePathExp.exec(url)) {
19547
- return path;
19548
- }
19373
+ let firstPathSegmentMatch;
19549
19374
 
19550
- firstPathSegmentMatch = windowsFilePathExp.exec(path);
19551
- return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
19552
- }
19553
- }
19375
+ // Get the relative path from the input URL.
19376
+ if (startsWith(url, base)) {
19377
+ url = url.replace(base, "");
19378
+ }
19554
19379
 
19555
- $$normalizeUrl(url) {
19556
- return this.appBase + (url ? this.hashPrefix + url : "");
19557
- }
19380
+ // The input URL intentionally contains a first path segment that ends with a colon.
19381
+ if (windowsFilePathExp.exec(url)) {
19382
+ return path;
19383
+ }
19558
19384
 
19559
- /**
19560
- * @param {string} url
19561
- * @returns {boolean}
19562
- */
19563
- $$parseLinkUrl(url) {
19564
- if (stripHash(this.appBase) === stripHash(url)) {
19565
- this.$$parse(url);
19566
- return true;
19385
+ firstPathSegmentMatch = windowsFilePathExp.exec(path);
19386
+ return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
19387
+ }
19567
19388
  }
19568
- return false;
19569
19389
  }
19570
19390
  }
19571
19391
 
@@ -19574,20 +19394,20 @@ class LocationProvider {
19574
19394
  /** @type {string} */
19575
19395
  this.hashPrefixConf = "!";
19576
19396
 
19577
- /** @type {Html5Mode} */
19397
+ /** @type {import("./interface.ts").Html5Mode} */
19578
19398
  this.html5ModeConf = {
19579
- enabled: false,
19580
- requireBase: true,
19399
+ enabled: true,
19400
+ requireBase: false,
19581
19401
  rewriteLinks: true,
19582
19402
  };
19583
19403
 
19584
- /** @type {Array<import("./interface.js").UrlChangeListener>} */
19404
+ /** @type {Array<import("./interface.ts").UrlChangeListener>} */
19585
19405
  this.urlChangeListeners = [];
19586
19406
  this.urlChangeInit = false;
19587
19407
 
19588
19408
  /** @type {History['state']} */
19589
19409
  this.cachedState = null;
19590
- /** @typeof {History.state} */
19410
+ /** @type {History['state']} */
19591
19411
  this.lastHistoryState = null;
19592
19412
  /** @type {string} */
19593
19413
  this.lastBrowserUrl = window.location.href;
@@ -19598,14 +19418,19 @@ class LocationProvider {
19598
19418
  // URL API
19599
19419
  /// ///////////////////////////////////////////////////////////
19600
19420
 
19421
+ /**
19422
+ * Updates the browser's current URL and history state.
19423
+ *
19424
+ * @param {string|undefined} url - The target URL to navigate to.
19425
+ * @param {*} [state=null] - Optional history state object to associate with the new URL.
19426
+ * @returns {LocationProvider}
19427
+ */
19601
19428
  setUrl(url, state) {
19602
19429
  if (state === undefined) {
19603
19430
  state = null;
19604
19431
  }
19605
-
19606
- // setter
19607
19432
  if (url) {
19608
- url = urlResolve(url).href;
19433
+ url = new URL(url).href;
19609
19434
 
19610
19435
  if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
19611
19436
  return this;
@@ -19622,7 +19447,7 @@ class LocationProvider {
19622
19447
  * Returns the current URL with any empty hash (`#`) removed.
19623
19448
  * @return {string}
19624
19449
  */
19625
- getUrl() {
19450
+ getBrowserUrl() {
19626
19451
  return trimEmptyHash(window.location.href);
19627
19452
  }
19628
19453
 
@@ -19650,19 +19475,17 @@ class LocationProvider {
19650
19475
 
19651
19476
  /**
19652
19477
  * Fires the state or URL change event.
19653
- *
19654
- * @private
19655
19478
  */
19656
- fireStateOrUrlChange() {
19479
+ #fireStateOrUrlChange() {
19657
19480
  const prevLastHistoryState = this.lastHistoryState;
19658
19481
  this.cacheState();
19659
19482
  if (
19660
- this.lastBrowserUrl === this.getUrl() &&
19483
+ this.lastBrowserUrl === this.getBrowserUrl() &&
19661
19484
  prevLastHistoryState === this.cachedState
19662
19485
  ) {
19663
19486
  return;
19664
19487
  }
19665
- this.lastBrowserUrl = this.getUrl();
19488
+ this.lastBrowserUrl = this.getBrowserUrl();
19666
19489
  this.lastHistoryState = this.cachedState;
19667
19490
  this.urlChangeListeners.forEach((listener) => {
19668
19491
  listener(trimEmptyHash(window.location.href), this.cachedState);
@@ -19675,131 +19498,75 @@ class LocationProvider {
19675
19498
  * @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
19676
19499
  * @returns void
19677
19500
  */
19678
- onUrlChange(callback) {
19501
+ #onUrlChange(callback) {
19679
19502
  if (!this.urlChangeInit) {
19680
- window.addEventListener("popstate", this.fireStateOrUrlChange.bind(this));
19503
+ window.addEventListener(
19504
+ "popstate",
19505
+ this.#fireStateOrUrlChange.bind(this),
19506
+ );
19681
19507
  window.addEventListener(
19682
19508
  "hashchange",
19683
- this.fireStateOrUrlChange.bind(this),
19509
+ this.#fireStateOrUrlChange.bind(this),
19684
19510
  );
19685
19511
  this.urlChangeInit = true;
19686
19512
  }
19687
19513
  this.urlChangeListeners.push(callback);
19688
19514
  }
19689
19515
 
19690
- /**
19691
- * The default value for the prefix is `'!'`.
19692
- * @param {string=} prefix Prefix for hash part (containing path and search)
19693
- * @returns {void}
19694
- */
19695
- setHashPrefix(prefix) {
19696
- this.hashPrefixConf = prefix;
19697
- }
19698
-
19699
- /**
19700
- * Current hash prefix
19701
- * @returns {string}
19702
- */
19703
- getHashPrefix() {
19704
- return this.hashPrefixConf;
19705
- }
19706
-
19707
- /**
19708
- * Configures html5 mode
19709
- * @param {(boolean|Html5Mode)=} mode If boolean, sets `html5Mode.enabled` to value. Otherwise, accepts html5Mode object
19710
- *
19711
- * @returns {void}
19712
- */
19713
- setHtml5Mode(mode) {
19714
- if (isBoolean(mode)) {
19715
- this.html5ModeConf.enabled = /** @type {boolean} */ (mode);
19716
- }
19717
- if (isObject(mode)) {
19718
- const html5Mode = /** @type {Html5Mode} */ (mode);
19719
- if (isDefined(html5Mode.enabled) && isBoolean(html5Mode.enabled)) {
19720
- this.html5ModeConf.enabled = html5Mode.enabled;
19721
- }
19722
-
19723
- if (
19724
- isDefined(html5Mode.requireBase) &&
19725
- isBoolean(html5Mode.requireBase)
19726
- ) {
19727
- this.html5ModeConf.requireBase = html5Mode.requireBase;
19728
- }
19729
-
19730
- if (
19731
- isDefined(html5Mode.rewriteLinks) &&
19732
- (isBoolean(html5Mode.rewriteLinks) || isString(html5Mode.rewriteLinks))
19733
- ) {
19734
- this.html5ModeConf.rewriteLinks = html5Mode.rewriteLinks;
19735
- }
19736
- }
19737
- }
19738
-
19739
- /**
19740
- * Returns html5 mode cofiguration
19741
- * @returns {Html5Mode}
19742
- */
19743
- getHtml5Mode() {
19744
- return this.html5ModeConf;
19745
- }
19746
-
19747
19516
  $get = [
19748
- "$rootScope",
19749
- "$rootElement",
19517
+ $injectTokens.$rootScope,
19518
+ $injectTokens.$rootElement,
19750
19519
  /**
19751
19520
  *
19752
19521
  * @param {import('../../core/scope/scope.js').Scope} $rootScope
19753
19522
  * @param {Element} $rootElement
19754
- * @returns
19523
+ * @returns {Location}
19755
19524
  */
19756
19525
  ($rootScope, $rootElement) => {
19757
19526
  /** @type {Location} */
19758
19527
  let $location;
19759
- let LocationMode;
19760
19528
  const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
19761
19529
  const initialUrl = trimEmptyHash(window.location.href);
19762
19530
  let appBase;
19763
19531
 
19764
- if (this.getHtml5Mode().enabled) {
19765
- if (!baseHref && this.getHtml5Mode().requireBase) {
19532
+ if (this.html5ModeConf.enabled) {
19533
+ if (!baseHref && this.html5ModeConf.requireBase) {
19766
19534
  throw $locationMinErr(
19767
19535
  "nobase",
19768
19536
  "$location in HTML5 mode requires a <base> tag to be present!",
19769
19537
  );
19770
19538
  }
19771
19539
  appBase = serverBase(initialUrl) + (baseHref || "/");
19772
- LocationMode = LocationHtml5Url;
19773
19540
  } else {
19774
19541
  appBase = stripHash(initialUrl);
19775
- LocationMode = LocationHashbangUrl;
19776
19542
  }
19777
19543
  const appBaseNoFile = stripFile(appBase);
19778
19544
 
19779
- $location = new LocationMode(
19545
+ $location = new Location(
19780
19546
  appBase,
19781
19547
  appBaseNoFile,
19782
- `#${this.getHashPrefix()}`,
19548
+ this.html5ModeConf.enabled,
19549
+ `#${this.hashPrefixConf}`,
19783
19550
  );
19784
- $location.$$parseLinkUrl(initialUrl, initialUrl);
19551
+ $location.parseLinkUrl(initialUrl, initialUrl);
19785
19552
 
19786
19553
  $location.$$state = this.state();
19787
19554
 
19788
19555
  const IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
19789
19556
 
19790
19557
  const setBrowserUrlWithFallback = (url, state) => {
19791
- const oldUrl = $location.url();
19558
+ const oldUrl = $location.getUrl();
19792
19559
  const oldState = $location.$$state;
19793
19560
  try {
19794
19561
  this.setUrl(url, state);
19795
19562
 
19796
- // Make sure $location.state() returns referentially identical (not just deeply equal)
19563
+ // Make sure $location.getState() returns referentially identical (not just deeply equal)
19797
19564
  // state object; this makes possible quick checking if the state changed in the digest
19798
19565
  // loop. Checking deep equality would be too expensive.
19799
19566
  $location.$$state = this.state();
19800
19567
  } catch (e) {
19801
19568
  // Restore old values if pushState fails
19802
- $location.url(/** @type {string} */ (oldUrl));
19569
+ $location.setUrl(/** @type {string} */ (oldUrl));
19803
19570
  $location.$$state = oldState;
19804
19571
 
19805
19572
  throw e;
@@ -19810,7 +19577,7 @@ class LocationProvider {
19810
19577
  "click",
19811
19578
  /** @param {MouseEvent} event */
19812
19579
  (event) => {
19813
- const rewriteLinks = this.getHtml5Mode().rewriteLinks;
19580
+ const rewriteLinks = this.html5ModeConf.rewriteLinks;
19814
19581
  // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
19815
19582
  // currently we open nice url link and redirect then
19816
19583
 
@@ -19819,7 +19586,6 @@ class LocationProvider {
19819
19586
  event.ctrlKey ||
19820
19587
  event.metaKey ||
19821
19588
  event.shiftKey ||
19822
- event.which === 2 ||
19823
19589
  event.button === 2
19824
19590
  ) {
19825
19591
  return;
@@ -19854,7 +19620,7 @@ class LocationProvider {
19854
19620
  // an animation.
19855
19621
 
19856
19622
  const scvAnimatedString = /** @type {unknown} */ (absHref);
19857
- absHref = urlResolve(
19623
+ absHref = new URL(
19858
19624
  /** @type {SVGAnimatedString } */ (scvAnimatedString).animVal,
19859
19625
  ).href;
19860
19626
  }
@@ -19867,7 +19633,7 @@ class LocationProvider {
19867
19633
  !elm.getAttribute("target") &&
19868
19634
  !event.defaultPrevented
19869
19635
  ) {
19870
- if ($location.$$parseLinkUrl(absHref, relHref)) {
19636
+ if ($location.parseLinkUrl(absHref, relHref)) {
19871
19637
  // We do a preventDefault for all urls that are part of the AngularTS application,
19872
19638
  // in html5mode and also without, so that we are able to abort navigation without
19873
19639
  // getting double entries in the location history.
@@ -19878,14 +19644,14 @@ class LocationProvider {
19878
19644
  );
19879
19645
 
19880
19646
  // rewrite hashbang url <> html5 url
19881
- if ($location.absUrl() !== initialUrl) {
19882
- this.setUrl($location.absUrl(), true);
19647
+ if ($location.absUrl !== initialUrl) {
19648
+ this.setUrl($location.absUrl, true);
19883
19649
  }
19884
19650
 
19885
19651
  let initializing = true;
19886
19652
 
19887
19653
  // update $location when $browser url changes
19888
- this.onUrlChange((newUrl, newState) => {
19654
+ this.#onUrlChange((newUrl, newState) => {
19889
19655
  if (!startsWith(newUrl, appBaseNoFile)) {
19890
19656
  // If we are navigating outside of the app then force a reload
19891
19657
  window.location.href = newUrl;
@@ -19893,10 +19659,10 @@ class LocationProvider {
19893
19659
  }
19894
19660
 
19895
19661
  Promise.resolve().then(() => {
19896
- const oldUrl = $location.absUrl();
19662
+ const oldUrl = $location.absUrl;
19897
19663
  const oldState = $location.$$state;
19898
19664
  let defaultPrevented;
19899
- $location.$$parse(newUrl);
19665
+ $location.parse(newUrl);
19900
19666
  $location.$$state = newState;
19901
19667
 
19902
19668
  defaultPrevented = $rootScope.$broadcast(
@@ -19909,10 +19675,10 @@ class LocationProvider {
19909
19675
 
19910
19676
  // if the location was changed by a `$locationChangeStart` handler then stop
19911
19677
  // processing this location change
19912
- if ($location.absUrl() !== newUrl) return;
19678
+ if ($location.absUrl !== newUrl) return;
19913
19679
 
19914
19680
  if (defaultPrevented) {
19915
- $location.$$parse(oldUrl);
19681
+ $location.parse(oldUrl);
19916
19682
  $location.$$state = oldState;
19917
19683
  setBrowserUrlWithFallback(oldUrl, oldState);
19918
19684
  } else {
@@ -19924,21 +19690,21 @@ class LocationProvider {
19924
19690
 
19925
19691
  // update browser
19926
19692
  const updateBrowser = () => {
19927
- if (initializing || $location.$$urlUpdatedByLocation) {
19928
- $location.$$urlUpdatedByLocation = false;
19693
+ if (initializing || urlUpdatedByLocation) {
19694
+ urlUpdatedByLocation = false;
19929
19695
 
19930
- const oldUrl = /** @type {string} */ (this.getUrl());
19931
- const newUrl = $location.absUrl();
19696
+ const oldUrl = /** @type {string} */ (this.getBrowserUrl());
19697
+ const newUrl = $location.absUrl;
19932
19698
  const oldState = this.state();
19933
19699
  const urlOrStateChanged =
19934
19700
  !urlsEqual(oldUrl, newUrl) ||
19935
- ($location.$$html5 && oldState !== $location.$$state);
19701
+ ($location.html5 && oldState !== $location.$$state);
19936
19702
 
19937
19703
  if (initializing || urlOrStateChanged) {
19938
19704
  initializing = false;
19939
19705
 
19940
19706
  setTimeout(() => {
19941
- const newUrl = $location.absUrl();
19707
+ const newUrl = $location.absUrl;
19942
19708
  const { defaultPrevented } = $rootScope.$broadcast(
19943
19709
  "$locationChangeStart",
19944
19710
  newUrl,
@@ -19949,10 +19715,10 @@ class LocationProvider {
19949
19715
 
19950
19716
  // if the location was changed by a `$locationChangeStart` handler then stop
19951
19717
  // processing this location change
19952
- if ($location.absUrl() !== newUrl) return;
19718
+ if ($location.absUrl !== newUrl) return;
19953
19719
 
19954
19720
  if (defaultPrevented) {
19955
- $location.$$parse(oldUrl);
19721
+ $location.parse(oldUrl);
19956
19722
  $location.$$state = oldState;
19957
19723
  } else {
19958
19724
  if (urlOrStateChanged) {
@@ -19966,13 +19732,8 @@ class LocationProvider {
19966
19732
  });
19967
19733
  }
19968
19734
  }
19969
-
19970
- $location.$$replace = false;
19971
-
19972
- // we don't need to return anything because $evalAsync will make the digest loop dirty when
19973
- // there is a change
19974
19735
  };
19975
-
19736
+ $location.$$updateBrowser = updateBrowser;
19976
19737
  updateBrowser();
19977
19738
  $rootScope.$on("$updateBrowser", updateBrowser);
19978
19739
 
@@ -19981,7 +19742,7 @@ class LocationProvider {
19981
19742
  function afterLocationChange(oldUrl, oldState) {
19982
19743
  $rootScope.$broadcast(
19983
19744
  "$locationChangeSuccess",
19984
- $location.absUrl(),
19745
+ $location.absUrl,
19985
19746
  oldUrl,
19986
19747
  $location.$$state,
19987
19748
  oldState,
@@ -19993,28 +19754,63 @@ class LocationProvider {
19993
19754
 
19994
19755
  /**
19995
19756
  * ///////////////////////////
19996
- * HELPERS
19757
+ * PRIVATE HELPERS
19997
19758
  * ///////////////////////////
19998
19759
  */
19999
19760
 
20000
19761
  /**
20001
- * Encode path using encodeUriSegment, ignoring forward slashes
19762
+ * @ignore
19763
+ * Encodes a URL path by encoding each path segment individually using `encodeUriSegment`,
19764
+ * while preserving forward slashes (`/`) as segment separators.
20002
19765
  *
20003
- * @param {string} path Path to encode
20004
- * @returns {string}
19766
+ * This function first decodes any existing percent-encodings (such as `%20` or `%2F`)
19767
+ * in each segment to prevent double encoding, except for encoded forward slashes (`%2F`),
19768
+ * which are replaced with literal slashes before decoding to keep path boundaries intact.
19769
+ *
19770
+ * After decoding, each segment is re-encoded with `encodeUriSegment` according to RFC 3986,
19771
+ * encoding only characters that must be encoded in a path segment.
19772
+ *
19773
+ * The encoded segments are then rejoined with `/` to form the encoded path.
19774
+ *
19775
+ * @param {string} path - The URL path string to encode. May contain multiple segments separated by `/`.
19776
+ * @returns {string} The encoded path, where each segment is encoded, but forward slashes are preserved.
19777
+ *
19778
+ * @example
19779
+ * encodePath("user profile/images/pic 1.jpg")
19780
+ * // returns "user%20profile/images/pic%201.jpg"
19781
+ *
19782
+ * @example
19783
+ * encodePath("folder1%2Fsub/folder2")
19784
+ * // returns "folder1%2Fsub/folder2"
20005
19785
  */
20006
19786
  function encodePath(path) {
20007
19787
  const segments = path.split("/");
20008
19788
  let i = segments.length;
20009
19789
 
20010
19790
  while (i--) {
20011
- // decode forward slashes to prevent them from being double encoded
20012
- segments[i] = encodeUriSegment(segments[i].replace(/%2F/g, "/"));
19791
+ // Decode any existing encodings (e.g. %20, %2F) to prevent double-encoding
19792
+ // But keep slashes intact (they were split on)
19793
+ const decodedSegment = decodeURIComponent(
19794
+ segments[i].replace(/%2F/gi, "/"),
19795
+ );
19796
+ segments[i] = encodeUriSegment(decodedSegment);
20013
19797
  }
20014
19798
 
20015
19799
  return segments.join("/");
20016
19800
  }
20017
19801
 
19802
+ /**
19803
+ * @ignore
19804
+ * Decodes each segment of a URL path.
19805
+ *
19806
+ * Splits the input path by "/", decodes each segment using decodeURIComponent,
19807
+ * and if html5Mode is enabled, re-encodes any forward slashes inside segments
19808
+ * as "%2F" to avoid confusion with path separators.
19809
+ *
19810
+ * @param {string} path - The URL path to decode.
19811
+ * @param {boolean} html5Mode - If true, encodes forward slashes in segments as "%2F".
19812
+ * @returns {string} The decoded path with segments optionally encoding slashes.
19813
+ */
20018
19814
  function decodePath(path, html5Mode) {
20019
19815
  const segments = path.split("/");
20020
19816
  let i = segments.length;
@@ -20030,6 +19826,33 @@ function decodePath(path, html5Mode) {
20030
19826
  return segments.join("/");
20031
19827
  }
20032
19828
 
19829
+ /**
19830
+ * @ignore
19831
+ * Normalizes a URL path by encoding the path segments, query parameters, and hash fragment.
19832
+ *
19833
+ * - Path segments are encoded using `encodePath`, which encodes each segment individually.
19834
+ * - Query parameters (`searchValue`) are converted to a query string using `toKeyValue`.
19835
+ * - Hash fragment (`hashValue`) is encoded using `encodeUriSegment` and prefixed with `#`.
19836
+ *
19837
+ * This function returns a fully constructed URL path with optional query and hash components.
19838
+ *
19839
+ * @param {string} pathValue - The base URL path (e.g., "folder/item name").
19840
+ * @param {Object.<string, any> | string | null} searchValue - An object or string representing query parameters.
19841
+ * - If an object, it can contain strings, numbers, booleans, or arrays of values.
19842
+ * - If a string, it is assumed to be a raw query string.
19843
+ * - If null or undefined, no query string is added.
19844
+ * @param {string | null} hashValue - The URL fragment (everything after `#`). If null or undefined, no hash is added.
19845
+ *
19846
+ * @returns {string} The normalized URL path including encoded path, optional query string, and optional hash.
19847
+ *
19848
+ * @example
19849
+ * normalizePath("products/list", { category: "books", page: 2 }, "section1")
19850
+ * // returns "products/list?category=books&page=2#section1"
19851
+ *
19852
+ * @example
19853
+ * normalizePath("user profile/images", null, null)
19854
+ * // returns "user%20profile/images"
19855
+ */
20033
19856
  function normalizePath(pathValue, searchValue, hashValue) {
20034
19857
  const search = toKeyValue(searchValue);
20035
19858
  const hash = hashValue ? `#${encodeUriSegment(hashValue)}` : "";
@@ -20038,7 +19861,15 @@ function normalizePath(pathValue, searchValue, hashValue) {
20038
19861
  return path + (search ? `?${search}` : "") + hash;
20039
19862
  }
20040
19863
 
20041
- function parseAppUrl(url, locationObj, html5Mode) {
19864
+ /**
19865
+ * @ignore
19866
+ * Parses the application URL and updates the location object with path, search, and hash.
19867
+ *
19868
+ * @param {string} url - The URL string to parse.
19869
+ * @param {boolean} html5Mode - Whether HTML5 mode is enabled (affects decoding).
19870
+ * @throws Will throw an error if the URL starts with invalid slashes.
19871
+ */
19872
+ function parseAppUrl(url, html5Mode) {
20042
19873
  if (/^\s*[\\/]{2,}/.test(url)) {
20043
19874
  throw $locationMinErr("badpath", 'Invalid url "{0}".', url);
20044
19875
  }
@@ -20052,22 +19883,20 @@ function parseAppUrl(url, locationObj, html5Mode) {
20052
19883
  prefixed && match.pathname.charAt(0) === "/"
20053
19884
  ? match.pathname.substring(1)
20054
19885
  : match.pathname;
20055
- locationObj.$$path = decodePath(path, html5Mode);
20056
- locationObj.$$search = parseKeyValue(match.search);
20057
- locationObj.$$hash = decodeURIComponent(match.hash);
19886
+ $$path = decodePath(path, html5Mode);
19887
+ $$search = parseKeyValue(match.search);
19888
+ $$hash = decodeURIComponent(match.hash);
20058
19889
 
20059
19890
  // make sure path starts with '/';
20060
- if (locationObj.$$path && locationObj.$$path.charAt(0) !== "/") {
20061
- locationObj.$$path = `/${locationObj.$$path}`;
19891
+ if ($$path && $$path.charAt(0) !== "/") {
19892
+ $$path = `/${$$path}`;
20062
19893
  }
20063
19894
  }
20064
19895
 
20065
- function startsWith(str, search) {
20066
- return str.slice(0, search.length) === search;
20067
- }
20068
-
20069
19896
  /**
20070
- *
19897
+ * @ignore
19898
+ * Returns the substring of `url` after the `base` string if `url` starts with `base`.
19899
+ * Returns `undefined` if `url` does not start with `base`.
20071
19900
  * @param {string} base
20072
19901
  * @param {string} url
20073
19902
  * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
@@ -20079,25 +19908,96 @@ function stripBaseUrl(base, url) {
20079
19908
  }
20080
19909
  }
20081
19910
 
19911
+ /**
19912
+ * @ignore
19913
+ * Removes the hash fragment (including the '#') from the given URL string.
19914
+ *
19915
+ * @param {string} url - The URL string to process.
19916
+ * @returns {string} The URL without the hash fragment.
19917
+ */
20082
19918
  function stripHash(url) {
20083
19919
  const index = url.indexOf("#");
20084
19920
  return index === -1 ? url : url.substring(0, index);
20085
19921
  }
20086
19922
 
19923
+ /**
19924
+ * @ignore
19925
+ * Removes the file name (and any hash) from a URL, returning the base directory path.
19926
+ *
19927
+ * For example:
19928
+ * - Input: "https://example.com/path/to/file.js"
19929
+ * Output: "https://example.com/path/to/"
19930
+ *
19931
+ * - Input: "https://example.com/path/to/file.js#section"
19932
+ * Output: "https://example.com/path/to/"
19933
+ *
19934
+ * @param {string} url - The URL from which to strip the file name and hash.
19935
+ * @returns {string} The base path of the URL, ending with a slash.
19936
+ */
20087
19937
  function stripFile(url) {
20088
19938
  return url.substring(0, stripHash(url).lastIndexOf("/") + 1);
20089
19939
  }
20090
19940
 
20091
- /* return the server only (scheme://host:port) */
19941
+ /**
19942
+ * @ignore
19943
+ * Extracts the base server URL (scheme, host, and optional port) from a full URL.
19944
+ *
19945
+ * If no path is present, returns the full URL.
19946
+ *
19947
+ * For example:
19948
+ * - Input: "https://example.com/path/to/file"
19949
+ * Output: "https://example.com"
19950
+ *
19951
+ * - Input: "http://localhost:3000/api/data"
19952
+ * Output: "http://localhost:3000"
19953
+ *
19954
+ * @param {string} url - The full URL to extract the server base from.
19955
+ * @returns {string} The server base, including scheme and host (and port if present).
19956
+ */
20092
19957
  function serverBase(url) {
20093
- return url.substring(0, url.indexOf("/", url.indexOf("//") + 2));
19958
+ const start = url.indexOf("//") + 2;
19959
+ const slashIndex = url.indexOf("/", start);
19960
+ return slashIndex === -1 ? url : url.substring(0, slashIndex);
20094
19961
  }
20095
19962
 
20096
- // Determine if two URLs are equal despite potentially having different encoding/normalizing
20097
- // such as $location.absUrl() vs $browser.url()
20098
- // See https://github.com/angular/angular.js/issues/16592
19963
+ /**
19964
+ * @ignore
19965
+ * Determine if two URLs are equal despite potential differences in encoding,
19966
+ * trailing slashes, or empty hash fragments, such as between $location.absUrl() and $browser.url().
19967
+ *
19968
+ * @param {string} a - First URL to compare.
19969
+ * @param {string} b - Second URL to compare.
19970
+ * @returns {boolean} True if URLs are equivalent after normalization.
19971
+ */
20099
19972
  function urlsEqual(a, b) {
20100
- return a === b || urlResolve(a).href === urlResolve(b).href;
19973
+ return normalizeUrl(a) === normalizeUrl(b);
19974
+ }
19975
+
19976
+ /**
19977
+ * @ignore
19978
+ * Normalize a URL by resolving it via a DOM anchor element,
19979
+ * removing trailing slashes (except root), and trimming empty hashes.
19980
+ *
19981
+ * @param {string} url - URL to normalize.
19982
+ * @returns {string} Normalized URL string.
19983
+ */
19984
+ function normalizeUrl(url) {
19985
+ const anchor = document.createElement("a");
19986
+ anchor.href = url;
19987
+
19988
+ let normalized = anchor.href;
19989
+
19990
+ // Remove trailing slash unless it's root (e.g., https://example.com/)
19991
+ if (normalized.endsWith("/") && !/^https?:\/\/[^/]+\/$/.test(normalized)) {
19992
+ normalized = normalized.slice(0, -1);
19993
+ }
19994
+
19995
+ // Remove empty hash (e.g., https://example.com/foo# -> https://example.com/foo)
19996
+ if (normalized.endsWith("#")) {
19997
+ normalized = normalized.slice(0, -1);
19998
+ }
19999
+
20000
+ return normalized;
20101
20001
  }
20102
20002
 
20103
20003
  /**
@@ -20251,7 +20151,7 @@ function createScope(target = {}, context) {
20251
20151
  Array.isArray(target.$nonscope) &&
20252
20152
  target.$nonscope.includes(key))
20253
20153
  ) {
20254
- continue;
20154
+ /* empty */
20255
20155
  } else {
20256
20156
  target[key] = createScope(target[key], proxy.$handler);
20257
20157
  }
@@ -20730,6 +20630,7 @@ class Scope {
20730
20630
 
20731
20631
  /**
20732
20632
  * @param {Listener[]} listeners
20633
+ * @param {Function} filter
20733
20634
  */
20734
20635
  #scheduleListener(listeners, filter = (val) => val) {
20735
20636
  Promise.resolve().then(() => {
@@ -21380,8 +21281,7 @@ class Scope {
21380
21281
  function calculateWatcherCount(model) {
21381
21282
  const childIds = collectChildIds(model).add(model.$id);
21382
21283
 
21383
- /** @type {number} */
21384
- const count = Array.from(model.watchers.values()).reduce(
21284
+ return Array.from(model.watchers.values()).reduce(
21385
21285
  (count, watcherArray) =>
21386
21286
  count +
21387
21287
  watcherArray.reduce(
@@ -21391,7 +21291,6 @@ function calculateWatcherCount(model) {
21391
21291
  ),
21392
21292
  0,
21393
21293
  );
21394
- return count;
21395
21294
  }
21396
21295
 
21397
21296
  /**
@@ -23082,8 +22981,7 @@ function AnimateCssProvider() {
23082
22981
 
23083
22982
  temporaryStyles.forEach((entry) => {
23084
22983
  const key = entry[0];
23085
- const value = entry[1];
23086
- node.style[key] = value;
22984
+ node.style[key] = entry[1];
23087
22985
  });
23088
22986
 
23089
22987
  applyAnimationClasses(element, options);
@@ -25609,20 +25507,6 @@ const parse = (name) =>
25609
25507
  name.split(".").map((name) => (obj) => obj && obj[name]),
25610
25508
  );
25611
25509
 
25612
- /**
25613
- * Given two functions that return truthy or falsey values, returns a function that returns truthy
25614
- * if at least one of the functions returns truthy for the given arguments
25615
- */
25616
- function or(fn1, fn2) {
25617
- return (...args) => fn1.apply(null, args) || fn2.apply(null, args);
25618
- }
25619
- /**
25620
- * Check if all the elements of an array match a predicate function
25621
- *
25622
- * @param fn1 a predicate function `fn1`
25623
- * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array
25624
- */
25625
- const all = (fn1) => (arr) => arr.reduce((b, x) => b && !!fn1(x), true);
25626
25510
  /** Given a class, returns a Predicate function that returns true if the object is of that class */
25627
25511
  const is = (ctor) => (obj) =>
25628
25512
  (obj != null && obj.constructor === ctor) || obj instanceof ctor;
@@ -25685,10 +25569,10 @@ function equals(o1, o2) {
25685
25569
  t2 = typeof o2;
25686
25570
  if (t1 !== t2 || t1 !== "object") return false;
25687
25571
  const tup = [o1, o2];
25688
- if (all(Array.isArray)(tup)) return _arraysEq(o1, o2);
25689
- if (all(isDate)(tup)) return o1.getTime() === o2.getTime();
25690
- if (all(isRegExp)(tup)) return o1.toString() === o2.toString();
25691
- if (all(isFunction)(tup)) return true; // meh
25572
+ if (tup.every(Array.isArray)) return _arraysEq(o1, o2);
25573
+ if (tup.every(isDate)) return o1.getTime() === o2.getTime();
25574
+ if (tup.every(isRegExp)) return o1.toString() === o2.toString();
25575
+ if (tup.every(isFunction)) return true; // meh
25692
25576
  if ([isFunction, Array.isArray, isDate, isRegExp].some((fn) => !!fn(tup))) {
25693
25577
  return false;
25694
25578
  }
@@ -25809,11 +25693,6 @@ function _removeFrom(array, obj) {
25809
25693
  if (idx >= 0) array.splice(idx, 1);
25810
25694
  return array;
25811
25695
  }
25812
- /** pushes a values to an array and returns the value */
25813
- const pushTo = curry((arr, val) => {
25814
- arr.push(val);
25815
- return val;
25816
- });
25817
25696
 
25818
25697
  /**
25819
25698
  * Applies a set of defaults to an options object. The options object is filtered
@@ -26135,7 +26014,6 @@ class ParamType {
26135
26014
  /**
26136
26015
  * @param def A configuration object which contains the custom type definition. The object's
26137
26016
  * properties will override the default methods and/or pattern in `ParamType`'s public interface.
26138
- * @returns a new ParamType object
26139
26017
  */
26140
26018
  constructor(def) {
26141
26019
  this.pattern = /.*/;
@@ -26598,12 +26476,14 @@ class Queue {
26598
26476
 
26599
26477
  /** @type {Array<(item: T) => void>} */
26600
26478
  this._evictListeners = [];
26479
+ }
26601
26480
 
26602
- /**
26603
- * Register a listener that will be called with the evicted item.
26604
- * @type {(listener: (item: T) => void) => void}
26605
- */
26606
- this.onEvict = pushTo(this._evictListeners);
26481
+ /**
26482
+ * Register a listener that will be called with the evicted item.
26483
+ * @param {(item: T) => void} listener
26484
+ */
26485
+ onEvict(listener) {
26486
+ this._evictListeners.push(listener);
26607
26487
  }
26608
26488
 
26609
26489
  /**
@@ -26692,7 +26572,7 @@ class Queue {
26692
26572
  * This is where we hold the global mutable state such as current state, current
26693
26573
  * params, current transition, etc.
26694
26574
  */
26695
- class RouterGlobals {
26575
+ class Router {
26696
26576
  constructor() {
26697
26577
  /**
26698
26578
  * Current parameter values
@@ -27586,7 +27466,7 @@ class Param {
27586
27466
  const normalized = this.type.$normalize(value);
27587
27467
  if (!this.type.is(normalized)) return false;
27588
27468
  // The value was of the correct type, but when encoded, did not match the ParamType's regexp
27589
- const encoded = this.type.encode(normalized);
27469
+ const encoded = normalized; // this.type.encode(normalized);
27590
27470
  return !(isString(encoded) && !this.type.pattern.exec(encoded));
27591
27471
  }
27592
27472
  toString() {
@@ -27798,8 +27678,13 @@ class PathUtils {
27798
27678
  // The param keys specified by the incoming toParams
27799
27679
  return toPath.map(makeInheritedParamsNode);
27800
27680
  }
27681
+
27801
27682
  /**
27802
27683
  * Computes the tree changes (entering, exiting) between a fromPath and toPath.
27684
+ * @param {PathNode[]} fromPath
27685
+ * @param {PathNode[]} toPath
27686
+ * @param {boolean} [reloadState]
27687
+ * @returns {import("../transition/interface.js").TreeChanges}
27803
27688
  */
27804
27689
  static treeChanges(fromPath, toPath, reloadState) {
27805
27690
  const max = Math.min(fromPath.length, toPath.length);
@@ -28165,7 +28050,7 @@ function ng1ViewsBuilder(state) {
28165
28050
  name = name || "$default";
28166
28051
  // Account for views: { header: "headerComponent" }
28167
28052
  if (isString(config)) config = { component: config };
28168
- // Make a shallow copy of the config object
28053
+ // Make a shallow copy of the urlConfig object
28169
28054
  config = Object.assign({}, config);
28170
28055
  // Do not allow a view to mix props for component-style view with props for template/controller-style view
28171
28056
  if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
@@ -28319,8 +28204,7 @@ class ViewService {
28319
28204
  this._listeners = [];
28320
28205
  this._pluginapi = {
28321
28206
  _registeredUIView: (id) => {
28322
- const res = find(this._ngViews, (view) => view.id === id);
28323
- return res;
28207
+ return find(this._ngViews, (view) => view.id === id);
28324
28208
  },
28325
28209
  _registeredUIViews: () => this._ngViews,
28326
28210
  _activeViewConfigs: () => this._viewConfigs,
@@ -28358,8 +28242,7 @@ class ViewService {
28358
28242
  throw new Error(
28359
28243
  "ViewService: No view config factory registered for type " + decl.$type,
28360
28244
  );
28361
- const cfgs = cfgFactory(path, decl);
28362
- return cfgs;
28245
+ return cfgFactory(path, decl);
28363
28246
  }
28364
28247
  /**
28365
28248
  * Deactivates a ViewConfig.
@@ -29666,15 +29549,15 @@ class Transition {
29666
29549
  *
29667
29550
  * If the target state is not valid, an error is thrown.
29668
29551
  *
29669
- * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
29552
+ * @param {Array<import('../path/path-node.js').PathNode>} fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
29670
29553
  * encapsulates the "from state".
29671
- * @param targetState The target state and parameters being transitioned to (also, the transition options)
29554
+ * @param {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
29672
29555
  * @param {import('../transition/transition-service.js').TransitionProvider} transitionService The [[TransitionService]] instance
29673
- * @param {import('../globals.js').RouterGlobals} globals
29556
+ * @param {import('../router.js').Router} globals
29674
29557
  */
29675
29558
  constructor(fromPath, targetState, transitionService, globals) {
29676
29559
  /**
29677
- * @type {import('../globals.js').RouterGlobals}
29560
+ * @type {import('../router.js').Router}
29678
29561
  */
29679
29562
  this.globals = globals;
29680
29563
  this.transitionService = transitionService;
@@ -30212,8 +30095,8 @@ class Transition {
30212
30095
  ).length
30213
30096
  );
30214
30097
  };
30215
- const newTC = this.treeChanges();
30216
- const pendTC = pending && pending.treeChanges();
30098
+ const newTC = this._treeChanges;
30099
+ const pendTC = pending && pending._treeChanges;
30217
30100
  if (
30218
30101
  pendTC &&
30219
30102
  same(pendTC.to, newTC.to) &&
@@ -30854,10 +30737,10 @@ let defaultTransOpts = {
30854
30737
  * This API is located at `router.transitionService` ([[UIRouter.transitionService]])
30855
30738
  */
30856
30739
  class TransitionProvider {
30857
- static $inject = ["$routerGlobalsProvider", "$viewProvider"];
30740
+ /* @ignore */ static $inject = provider([$injectTokens.$router, $injectTokens.$view]);
30858
30741
 
30859
30742
  /**
30860
- * @param {import('../globals.js').RouterGlobals} globals
30743
+ * @param {import('../router.js').Router} globals
30861
30744
  * @param viewService
30862
30745
  */
30863
30746
  constructor(globals, viewService) {
@@ -30885,10 +30768,10 @@ class TransitionProvider {
30885
30768
  }
30886
30769
 
30887
30770
  $get = [
30888
- "$state",
30889
- "$urlService",
30890
- "$stateRegistry",
30891
- "$view",
30771
+ $injectTokens.$state,
30772
+ $injectTokens.$url,
30773
+ $injectTokens.$stateRegistry,
30774
+ $injectTokens.$view,
30892
30775
  (stateService, urlService, stateRegistry, viewService) => {
30893
30776
  // Lazy load state trees
30894
30777
  this._deregisterHookFns.lazyLoad = registerLazyLoadHook(
@@ -31104,7 +30987,7 @@ class StateProvider {
31104
30987
  /**
31105
30988
  * The latest successful state parameters
31106
30989
  *
31107
- * @deprecated This is a passthrough through to [[RouterGlobals.params]]
30990
+ * @deprecated This is a passthrough through to [[Router.params]]
31108
30991
  */
31109
30992
  get params() {
31110
30993
  return this.globals.params;
@@ -31112,7 +30995,7 @@ class StateProvider {
31112
30995
  /**
31113
30996
  * The current [[StateDeclaration]]
31114
30997
  *
31115
- * @deprecated This is a passthrough through to [[RouterGlobals.current]]
30998
+ * @deprecated This is a passthrough through to [[Router.current]]
31116
30999
  */
31117
31000
  get current() {
31118
31001
  return this.globals.current;
@@ -31120,18 +31003,18 @@ class StateProvider {
31120
31003
  /**
31121
31004
  * The current [[StateObject]] (an internal API)
31122
31005
  *
31123
- * @deprecated This is a passthrough through to [[RouterGlobals.$current]]
31006
+ * @deprecated This is a passthrough through to [[Router.$current]]
31124
31007
  */
31125
31008
  get $current() {
31126
31009
  return this.globals.$current;
31127
31010
  }
31128
31011
 
31129
- static $inject = ["$routerGlobalsProvider", "$transitionsProvider"];
31012
+ /* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
31130
31013
 
31131
31014
  // Needs access to urlService, stateRegistry
31132
31015
  /**
31133
31016
  *
31134
- * @param {import('../globals.js').RouterGlobals} globals
31017
+ * @param {import('../router.js').Router} globals
31135
31018
  * @param {*} transitionService
31136
31019
  */
31137
31020
  constructor(globals, transitionService) {
@@ -31205,9 +31088,9 @@ class StateProvider {
31205
31088
  * - **params** `{object}` - returns an array of state params that are ensured to
31206
31089
  * be a super-set of parent's params.
31207
31090
  * - **views** `{object}` - returns a views object where each key is an absolute view
31208
- * name (i.e. "viewName@stateName") and each value is the config object
31091
+ * name (i.e. "viewName@stateName") and each value is the urlConfig object
31209
31092
  * (template, controller) for the view. Even when you don't use the views object
31210
- * explicitly on a state config, one is still created for you internally.
31093
+ * explicitly on a state urlConfig, one is still created for you internally.
31211
31094
  * So by decorating this builder function you have access to decorating template
31212
31095
  * and controller properties.
31213
31096
  * - **ownParams** `{object}` - returns an array of params that belong to the state,
@@ -31225,10 +31108,10 @@ class StateProvider {
31225
31108
  * let result = {},
31226
31109
  * views = parent(state);
31227
31110
  *
31228
- * angular.forEach(views, function (config, name) {
31111
+ * angular.forEach(views, function (urlConfig, name) {
31229
31112
  * let autoName = (state.name + '.' + name).replace('.', '/');
31230
- * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
31231
- * result[name] = config;
31113
+ * urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
31114
+ * result[name] = urlConfig;
31232
31115
  * });
31233
31116
  * return result;
31234
31117
  * });
@@ -31252,7 +31135,7 @@ class StateProvider {
31252
31135
  * @param {object} func A function that is responsible for decorating the original
31253
31136
  * builder function. The function receives two parameters:
31254
31137
  *
31255
- * - `{object}` - state - The state config object.
31138
+ * - `{object}` - state - The state urlConfig object.
31256
31139
  * - `{object}` - super - The original builder function.
31257
31140
  *
31258
31141
  * @return {object} $stateProvider - $stateProvider instance
@@ -31485,7 +31368,7 @@ class StateProvider {
31485
31368
  const globals = this.globals;
31486
31369
  const latestSuccess = globals.successfulTransitions.peekTail();
31487
31370
  const rootPath = () => [new PathNode(this.stateRegistry.root())];
31488
- return latestSuccess ? latestSuccess.treeChanges().to : rootPath();
31371
+ return latestSuccess ? latestSuccess._treeChanges.to : rootPath();
31489
31372
  }
31490
31373
  /**
31491
31374
  * Low-level method for transitioning to a new state.
@@ -31782,7 +31665,7 @@ class ViewScrollProvider {
31782
31665
  }
31783
31666
 
31784
31667
  $get = [
31785
- "$anchorScroll",
31668
+ $injectTokens.$anchorScroll,
31786
31669
  /**
31787
31670
  * @param {import('../services/anchor-scroll.js').AnchorScrollObject} $anchorScroll
31788
31671
  * @returns {import('../services/anchor-scroll.js').AnchorScrollObject|Function}
@@ -31820,10 +31703,10 @@ class TemplateFactoryProvider {
31820
31703
  }
31821
31704
 
31822
31705
  $get = [
31823
- "$http",
31824
- "$templateCache",
31825
- "$templateRequest",
31826
- "$injector",
31706
+ $injectTokens.$http,
31707
+ $injectTokens.$templateCache,
31708
+ $injectTokens.$templateRequest,
31709
+ $injectTokens.$injector,
31827
31710
  /**
31828
31711
  * @param {import("interface.ts").HttpService} $http
31829
31712
  * @param {import("../services/template-cache/interface.ts").TemplateCache} $templateCache
@@ -32125,13 +32008,6 @@ const defaultConfig = {
32125
32008
  *
32126
32009
  */
32127
32010
  class UrlMatcher {
32128
- static encodeDashes(str) {
32129
- // Replace dashes with encoded "\-"
32130
- return encodeURIComponent(str).replace(
32131
- /-/g,
32132
- (c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
32133
- );
32134
- }
32135
32011
  /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */
32136
32012
  static pathSegmentsAndParams(matcher) {
32137
32013
  const staticSegments = matcher._segments;
@@ -32342,9 +32218,6 @@ class UrlMatcher {
32342
32218
  return this.pattern;
32343
32219
  }
32344
32220
  _getDecodedParamValue(value, param) {
32345
- if (isDefined(value)) {
32346
- value = param.type.decode(value);
32347
- }
32348
32221
  return param.value(value);
32349
32222
  }
32350
32223
  /**
@@ -32366,9 +32239,9 @@ class UrlMatcher {
32366
32239
  * // returns { id: 'bob', q: 'hello', r: null }
32367
32240
  * ```
32368
32241
  *
32369
- * @param path The URL path to match, e.g. `$location.path()`.
32370
- * @param search URL search parameters, e.g. `$location.search()`.
32371
- * @param hash URL hash e.g. `$location.hash()`.
32242
+ * @param path The URL path to match, e.g. `$location.getPath()`.
32243
+ * @param search URL search parameters, e.g. `$location.getSearch()`.
32244
+ * @param hash URL hash e.g. `$location.getHash()`.
32372
32245
  *
32373
32246
  * @returns The captured parameter values.
32374
32247
  */
@@ -32535,7 +32408,7 @@ class UrlMatcher {
32535
32408
  if (encoded == null) return acc;
32536
32409
  // If this parameter value is an array, encode the value using encodeDashes
32537
32410
  if (Array.isArray(encoded))
32538
- return acc + map(encoded, UrlMatcher.encodeDashes).join("-");
32411
+ return acc + map(encoded, encodeDashes).join("-");
32539
32412
  // If the parameter type is "raw", then do not encodeURIComponent
32540
32413
  if (param.raw) return acc + encoded;
32541
32414
  // Encode the value
@@ -32565,6 +32438,14 @@ class UrlMatcher {
32565
32438
 
32566
32439
  UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/;
32567
32440
 
32441
+ function encodeDashes(str) {
32442
+ // Replace dashes with encoded "\-"
32443
+ return encodeURIComponent(str).replace(
32444
+ /-/g,
32445
+ (c) => `%5C%${c.charCodeAt(0).toString(16).toUpperCase()}`,
32446
+ );
32447
+ }
32448
+
32568
32449
  /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
32569
32450
 
32570
32451
  /**
@@ -32690,6 +32571,11 @@ StateObject.isState = (obj) => isObject(obj["__stateObjectCache"]);
32690
32571
  * - [[StateObject]]
32691
32572
  */
32692
32573
  class UrlRuleFactory {
32574
+ /**
32575
+ * @param {import('../url/url-service.js').UrlService} urlService
32576
+ * @param {import('../state/state-service.js').StateProvider} stateService
32577
+ * @param {import('../router.js').Router} routerGlobals
32578
+ */
32693
32579
  constructor(urlService, stateService, routerGlobals) {
32694
32580
  this.urlService = urlService;
32695
32581
  this.stateService = stateService;
@@ -32708,7 +32594,7 @@ class UrlRuleFactory {
32708
32594
  [isString, (_what) => makeRule(this.urlService.compile(_what))],
32709
32595
  [is(UrlMatcher), (_what) => this.fromUrlMatcher(_what, handler)],
32710
32596
  [
32711
- or(isState, isStateDeclaration),
32597
+ (...args) => isState(...args) || isStateDeclaration(...args),
32712
32598
  (_what) => this.fromState(_what, this.stateService, this.routerGlobals),
32713
32599
  ],
32714
32600
  [is(RegExp), (_what) => this.fromRegExp(_what, handler)],
@@ -32882,6 +32768,7 @@ class BaseUrlRule {
32882
32768
  this.$id = -1;
32883
32769
  this._group = undefined;
32884
32770
  this.handler = handler || ((x) => x);
32771
+ this.priority = undefined;
32885
32772
  }
32886
32773
 
32887
32774
  /**
@@ -32895,7 +32782,9 @@ class BaseUrlRule {
32895
32782
  }
32896
32783
  }
32897
32784
 
32898
- const prioritySort = (a, b) => (b.priority || 0) - (a.priority || 0);
32785
+ function prioritySort(a, b) {
32786
+ return (b.priority || 0) - (a.priority || 0);
32787
+ }
32899
32788
 
32900
32789
  const typeSort = (a, b) => {
32901
32790
  const weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 };
@@ -32926,8 +32815,7 @@ const idSort = (a, b) => {
32926
32815
  * - Equally sorted State and UrlMatcher rules will each match the URL.
32927
32816
  * Then, the *best* match is chosen based on how many parameter values were matched.
32928
32817
  */
32929
- let defaultRuleSortFn;
32930
- defaultRuleSortFn = (a, b) => {
32818
+ function defaultRuleSortFn(a, b) {
32931
32819
  let cmp = prioritySort(a, b);
32932
32820
  if (cmp !== 0) return cmp;
32933
32821
  cmp = typeSort(a, b);
@@ -32935,7 +32823,8 @@ defaultRuleSortFn = (a, b) => {
32935
32823
  cmp = urlMatcherSort(a, b);
32936
32824
  if (cmp !== 0) return cmp;
32937
32825
  return idSort(a, b);
32938
- };
32826
+ }
32827
+
32939
32828
  function getHandlerFn(handler) {
32940
32829
  if (
32941
32830
  !isFunction(handler) &&
@@ -32957,9 +32846,10 @@ function getHandlerFn(handler) {
32957
32846
  *
32958
32847
  * The most commonly used methods are [[otherwise]] and [[when]].
32959
32848
  *
32960
- * This API is found at `$urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
32849
+ * This API is found at `$url.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
32961
32850
  */
32962
32851
  class UrlRules {
32852
+ /** @param {UrlRuleFactory} urlRuleFactory */
32963
32853
  constructor(urlRuleFactory) {
32964
32854
  this._sortFn = defaultRuleSortFn;
32965
32855
  this._rules = [];
@@ -33262,39 +33152,37 @@ class ParamFactory {
33262
33152
  * API for URL management
33263
33153
  */
33264
33154
  class UrlService {
33265
- static $inject = [
33266
- "$locationProvider",
33267
- "$stateProvider",
33268
- "$routerGlobalsProvider",
33269
- "$urlConfigProvider",
33270
- ];
33155
+ static $inject = provider([
33156
+ $injectTokens.$location,
33157
+ $injectTokens.$state,
33158
+ $injectTokens.$router,
33159
+ $injectTokens.$urlConfig,
33160
+ ]);
33161
+
33162
+ /** @type {import("../../services/location/location").Location} */
33163
+ $location;
33271
33164
 
33272
33165
  /**
33273
33166
  * @param {import("../../services/location/location").LocationProvider} $locationProvider
33274
33167
  * @param {import("../../router/state/state-service.js").StateProvider} stateService
33275
- * @param globals
33168
+ * @param {import("../router.js").Router} globals
33276
33169
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
33277
33170
  */
33278
33171
  constructor($locationProvider, stateService, globals, urlConfigProvider) {
33172
+ this.$locationProvider = $locationProvider;
33279
33173
  this.stateService = stateService;
33280
33174
  this.stateService.urlService = this; // circular wiring
33281
- this.$locationProvider = $locationProvider;
33282
- this.$location = undefined;
33283
33175
 
33284
33176
  /** Provides services related to the URL */
33285
33177
  this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
33286
33178
 
33287
33179
  /**
33288
33180
  * The nested [[UrlRules]] API for managing URL rules and rewrites
33289
- *
33290
- * See: [[UrlRules]] for details
33291
33181
  * @type {UrlRules}
33292
33182
  */
33293
33183
  this.rules = new UrlRules(this.urlRuleFactory);
33294
33184
  /**
33295
33185
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
33296
- *
33297
- * See: [[UrlConfig]] for details
33298
33186
  * @type {import("./url-config.js").UrlConfigProvider}
33299
33187
  */
33300
33188
  this.config = urlConfigProvider;
@@ -33302,37 +33190,44 @@ class UrlService {
33302
33190
  /** Creates a new [[Param]] for a given location (DefType) */
33303
33191
  this.paramFactory = new ParamFactory(this.config);
33304
33192
 
33305
- /**
33306
- * Gets the path part of the current url
33307
- *
33308
- * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
33309
- *
33310
- * @return the path portion of the url
33311
- */
33312
- this.path = () => this.$location.path();
33313
- /**
33314
- * Gets the search part of the current url as an object
33315
- *
33316
- * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
33317
- *
33318
- * @return the search (query) portion of the url, as an object
33319
- */
33320
- this.search = () => this.$location.search();
33321
- /**
33322
- * Gets the hash part of the current url
33323
- *
33324
- * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
33325
- *
33326
- * @return the hash (anchor) portion of the url
33327
- */
33328
- this.hash = () => this.$location.hash();
33329
-
33330
33193
  this._urlListeners = [];
33331
33194
  }
33332
33195
 
33196
+ /**
33197
+ * Gets the path part of the current url
33198
+ *
33199
+ * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
33200
+ *
33201
+ * @return {string} the path portion of the url
33202
+ */
33203
+ getPath() {
33204
+ return this.$location.getPath();
33205
+ }
33206
+
33207
+ /**
33208
+ * Gets the search part of the current url as an object
33209
+ *
33210
+ * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
33211
+ *
33212
+ * @return {Object} the search (query) portion of the url, as an object
33213
+ */
33214
+ getSearch() {
33215
+ return this.$location.getSearch();
33216
+ }
33217
+ /**
33218
+ * Gets the hash part of the current url
33219
+ *
33220
+ * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
33221
+ *
33222
+ * @return {string} the hash (anchor) portion of the url
33223
+ */
33224
+ getHash() {
33225
+ return this.$location.getHash();
33226
+ }
33227
+
33333
33228
  $get = [
33334
- "$location",
33335
- "$rootScope",
33229
+ $injectTokens.$location,
33230
+ $injectTokens.$rootScope,
33336
33231
  /**
33337
33232
  *
33338
33233
  * @param {import('../../services/location/location.js').Location} $location
@@ -33346,21 +33241,14 @@ class UrlService {
33346
33241
  fn(evt);
33347
33242
  });
33348
33243
  });
33349
- this.listen();
33244
+ this.listen(true);
33350
33245
  return this;
33351
33246
  },
33352
33247
  ];
33353
33248
 
33354
33249
  /**
33355
- * @returns {boolean}
33250
+ * @returns {string}
33356
33251
  */
33357
- html5Mode() {
33358
- return (
33359
- this.$locationProvider.getHtml5Mode().enabled &&
33360
- typeof history !== "undefined"
33361
- );
33362
- }
33363
-
33364
33252
  baseHref() {
33365
33253
  return (
33366
33254
  this._baseHref ||
@@ -33415,20 +33303,21 @@ class UrlService {
33415
33303
  * @param {string} [newUrl] The new value for the URL.
33416
33304
  * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
33417
33305
  * It should not include the protocol, site, port, or base path of an absolute HREF.
33418
- * @param {boolean} [replace] When true, replaces the current history entry (instead of appending it) with this new url
33419
33306
  * @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
33420
33307
  *
33421
33308
  * @return the url (after potentially being processed)
33422
33309
  */
33423
- url(newUrl, replace = false, state) {
33424
- if (isDefined(newUrl)) this.$location.url(newUrl);
33425
- if (replace) this.$location.replace();
33426
- if (state) this.$location.state(state);
33427
- return this.$location.url();
33310
+ url(newUrl, state) {
33311
+ if (isDefined(newUrl)) {
33312
+ const decodeUri = decodeURIComponent(newUrl);
33313
+ this.$location.setUrl(decodeUri);
33314
+ }
33315
+ if (state) this.$location.setState(state);
33316
+ return this.$location.getUrl();
33428
33317
  }
33429
33318
 
33430
33319
  /**
33431
- * @internal
33320
+ * @private
33432
33321
  *
33433
33322
  * Registers a low level url change handler
33434
33323
  *
@@ -33439,8 +33328,8 @@ class UrlService {
33439
33328
  * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
33440
33329
  * ```
33441
33330
  *
33442
- * @param callback a function that will be called when the url is changing
33443
- * @return a function that de-registers the callback
33331
+ * @param {Function} callback a function that will be called when the url is changing
33332
+ * @return {Function} a function that de-registers the callback
33444
33333
  */
33445
33334
  onChange(callback) {
33446
33335
  this._urlListeners.push(callback);
@@ -33448,13 +33337,21 @@ class UrlService {
33448
33337
  }
33449
33338
 
33450
33339
  /**
33451
- * Gets the current URL parts
33340
+ * Gets the current URL parts.
33341
+ *
33342
+ * Returns an object with the `path`, `search`, and `hash` components
33343
+ * of the current browser location.
33452
33344
  *
33453
- * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object.
33345
+ * @returns {import("../../services/location/interface.ts").UrlParts} The current URL's path, search, and hash.
33454
33346
  */
33455
33347
  parts() {
33456
- return { path: this.path(), search: this.search(), hash: this.hash() };
33348
+ return {
33349
+ path: this.$location.getPath(),
33350
+ search: this.$location.getSearch(),
33351
+ hash: this.$location.getHash(),
33352
+ };
33457
33353
  }
33354
+
33458
33355
  /**
33459
33356
  * Activates the best rule for the current URL
33460
33357
  *
@@ -33478,16 +33375,16 @@ class UrlService {
33478
33375
  if (evt && evt.defaultPrevented) return;
33479
33376
  const stateService = this.stateService;
33480
33377
  const url = {
33481
- path: this.path(),
33482
- search: this.search(),
33483
- hash: this.hash(),
33378
+ path: this.$location.getPath(),
33379
+ search: this.$location.getSearch(),
33380
+ hash: this.$location.getHash(),
33484
33381
  };
33485
33382
  /**
33486
33383
  * @type {*}
33487
33384
  */
33488
33385
  const best = this.match(url);
33489
33386
  const applyResult = pattern([
33490
- [isString, (newurl) => this.url(newurl, true)],
33387
+ [isString, (newurl) => this.url(newurl)],
33491
33388
  [
33492
33389
  TargetState.isDef,
33493
33390
  (def) => stateService.go(def.state, def.params, def.options),
@@ -33520,7 +33417,7 @@ class UrlService {
33520
33417
  * });
33521
33418
  * ```
33522
33419
  *
33523
- * @param enabled `true` or `false` to start or stop listening to URL changes
33420
+ * @param {boolean} enabled `true` or `false` to start or stop listening to URL changes
33524
33421
  */
33525
33422
  listen(enabled) {
33526
33423
  if (enabled === false) {
@@ -33598,7 +33495,7 @@ class UrlService {
33598
33495
  * ```js
33599
33496
  * matcher = $umf.compile("/about/:person");
33600
33497
  * params = { person: "bob" };
33601
- * $bob = $urlService.href(matcher, params);
33498
+ * $bob = $url.href(matcher, params);
33602
33499
  * // $bob == "/about/bob";
33603
33500
  * ```
33604
33501
  *
@@ -33614,22 +33511,18 @@ class UrlService {
33614
33511
  let url = urlMatcher.format(params);
33615
33512
  if (url == null) return null;
33616
33513
  options = options || { absolute: false };
33617
- const isHtml5 = this.html5Mode();
33618
- if (!isHtml5 && url !== null) {
33619
- url = "#" + this.$locationProvider.getHashPrefix() + url;
33514
+ const isHtml5 = this.$locationProvider.html5ModeConf.enabled;
33515
+ if (!isHtml5) {
33516
+ url = "#" + this.$locationProvider.hashPrefixConf + url;
33620
33517
  }
33621
33518
  url = appendBasePath(url, isHtml5, options.absolute, this.baseHref());
33622
33519
  if (!options.absolute || !url) {
33623
33520
  return url;
33624
33521
  }
33625
33522
  const slash = !isHtml5 && url ? "/" : "";
33626
- const cfgPort = this.$location.port();
33627
- const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
33628
33523
  return [
33629
- this.$location.protocol(),
33630
- "://",
33631
- this.$location.host(),
33632
- port,
33524
+ `${window.location.protocol}//`,
33525
+ window.location.host,
33633
33526
  slash,
33634
33527
  url,
33635
33528
  ].join("");
@@ -33767,7 +33660,7 @@ function dataBuilder(state) {
33767
33660
  return state.data;
33768
33661
  }
33769
33662
 
33770
- function getUrlBuilder($urlService, root) {
33663
+ function getUrlBuilder($url, root) {
33771
33664
  return function (stateObject) {
33772
33665
  let stateDec = stateObject.self;
33773
33666
  // For future states, i.e., states whose name ends with `.**`,
@@ -33787,9 +33680,9 @@ function getUrlBuilder($urlService, root) {
33787
33680
  const parsed = parseUrl(stateDec.url);
33788
33681
  const url = !parsed
33789
33682
  ? stateDec.url
33790
- : $urlService.compile(parsed.val, { state: stateDec });
33683
+ : $url.compile(parsed.val, { state: stateDec });
33791
33684
  if (!url) return null;
33792
- if (!$urlService.isMatcher(url))
33685
+ if (!$url.isMatcher(url))
33793
33686
  throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
33794
33687
  return parsed && parsed.root
33795
33688
  ? url
@@ -34213,17 +34106,17 @@ class StateQueueManager {
34213
34106
  *
34214
34107
  */
34215
34108
  class StateRegistryProvider {
34216
- static $inject = provider([
34217
- $injectTokens.$urlService,
34109
+ /* @ignore */ static $inject = provider([
34110
+ $injectTokens.$url,
34218
34111
  $injectTokens.$state,
34219
- $injectTokens.$routerGlobals,
34112
+ $injectTokens.$router,
34220
34113
  $injectTokens.$view,
34221
34114
  ]);
34222
34115
 
34223
34116
  /**
34224
34117
  * @param urlService
34225
34118
  * @param stateService
34226
- * @param {import('../globals.js').RouterGlobals} globals
34119
+ * @param {import('../router.js').Router} globals
34227
34120
  * @param viewService
34228
34121
  */
34229
34122
  constructor(urlService, stateService, globals, viewService) {
@@ -34702,7 +34595,7 @@ function $StateRefDynamicDirective(
34702
34595
 
34703
34596
  $StateRefActiveDirective.$inject = [
34704
34597
  "$state",
34705
- "$routerGlobals",
34598
+ "$router",
34706
34599
  "$interpolate",
34707
34600
  "$stateRegistry",
34708
34601
  "$transitions",
@@ -34710,7 +34603,7 @@ $StateRefActiveDirective.$inject = [
34710
34603
 
34711
34604
  /**
34712
34605
  * @param {*} $state
34713
- * @param {import('../globals.js').RouterGlobals} $routerGlobals
34606
+ * @param {import('../router.js').Router} $router
34714
34607
  * @param {*} $interpolate
34715
34608
  * @param {*} $stateRegistry
34716
34609
  * @param {*} $transitions
@@ -34718,7 +34611,7 @@ $StateRefActiveDirective.$inject = [
34718
34611
  */
34719
34612
  function $StateRefActiveDirective(
34720
34613
  $state,
34721
- $routerGlobals,
34614
+ $router,
34722
34615
  $interpolate,
34723
34616
  $stateRegistry,
34724
34617
  $transitions,
@@ -34757,8 +34650,8 @@ function $StateRefActiveDirective(
34757
34650
  trans.promise.then(update, () => {});
34758
34651
  }
34759
34652
  $scope.$on("$destroy", setupEventListeners());
34760
- if ($routerGlobals.transition) {
34761
- updateAfterTransition($routerGlobals.transition);
34653
+ if ($router.transition) {
34654
+ updateAfterTransition($router.transition);
34762
34655
  }
34763
34656
  function setupEventListeners() {
34764
34657
  const deregisterStatesChangedListener =
@@ -34860,7 +34753,7 @@ function $StateRefActiveDirective(
34860
34753
  * The ng-view can be targeted in a View using the name ([[StateDeclaration.views]]).
34861
34754
  *
34862
34755
  * - `autoscroll`: an expression. When it evaluates to true, the `ng-view` will be scrolled into view when it is activated.
34863
- * Uses [[$ngViewScroll]] to do the scrolling.
34756
+ * Uses [[$viewScroll]] to do the scrolling.
34864
34757
  *
34865
34758
  * - `onload`: Expression to evaluate whenever the view updates.
34866
34759
  *
@@ -34979,16 +34872,16 @@ function $StateRefActiveDirective(
34979
34872
  let ngView = [
34980
34873
  "$view",
34981
34874
  "$animate",
34982
- "$ngViewScroll",
34875
+ "$viewScroll",
34983
34876
  "$interpolate",
34984
34877
  /**
34985
34878
  * @param {*} $view
34986
34879
  * @param {*} $animate
34987
- * @param {*} $ngViewScroll
34880
+ * @param {*} $viewScroll
34988
34881
  * @param {*} $interpolate
34989
34882
  * @returns {import("../../interface.js").Directive}
34990
34883
  */
34991
- function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
34884
+ function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
34992
34885
  function getRenderer() {
34993
34886
  return {
34994
34887
  enter: function (element, target, cb) {
@@ -35114,7 +35007,7 @@ let ngView = [
35114
35007
  * @param {string} viewName Name of the view.
35115
35008
  */
35116
35009
  newScope.$emit("$viewContentLoading", name);
35117
- const cloned = $transclude(newScope, function (clone) {
35010
+ currentEl = $transclude(newScope, function (clone) {
35118
35011
  setCacheData(clone, "$ngViewAnim", $ngViewAnim);
35119
35012
  setCacheData(clone, "$ngView", $ngViewData);
35120
35013
  renderer.enter(clone, $element, function () {
@@ -35125,12 +35018,11 @@ let ngView = [
35125
35018
  (isDefined(autoScrollExp) && !autoScrollExp) ||
35126
35019
  scope.$eval(autoScrollExp)
35127
35020
  ) {
35128
- $ngViewScroll(clone);
35021
+ $viewScroll(clone);
35129
35022
  }
35130
35023
  });
35131
35024
  cleanupLastView();
35132
35025
  });
35133
- currentEl = cloned;
35134
35026
  currentScope = newScope;
35135
35027
  /**
35136
35028
  * Fired once the view is **loaded**, *after* the DOM is rendered.
@@ -35613,7 +35505,6 @@ function createHttpDirective(method, attrName) {
35613
35505
 
35614
35506
  return {
35615
35507
  restrict: "A",
35616
- terminal: true,
35617
35508
  link(scope, element, attrs) {
35618
35509
  const eventName =
35619
35510
  attrs["trigger"] ||
@@ -35725,8 +35616,17 @@ function createHttpDirective(method, attrName) {
35725
35616
  }
35726
35617
 
35727
35618
  if (method === "post" || method === "put") {
35728
- const data = collectFormData(element);
35729
- $http[method](url, data).then(handler).catch(handler);
35619
+ let data;
35620
+ const config = {};
35621
+ if (attrs["enctype"]) {
35622
+ config.headers = {
35623
+ "Content-Type": attrs["enctype"],
35624
+ };
35625
+ data = toKeyValue(collectFormData(element));
35626
+ } else {
35627
+ data = collectFormData(element);
35628
+ }
35629
+ $http[method](url, data, config).then(handler).catch(handler);
35730
35630
  } else {
35731
35631
  $http[method](url).then(handler).catch(handler);
35732
35632
  }
@@ -35740,7 +35640,7 @@ function createHttpDirective(method, attrName) {
35740
35640
 
35741
35641
  /**
35742
35642
  * Initializes core `ng` module.
35743
- * @param {import('./loader.js').Angular} angular
35643
+ * @param {import('./angular.js').Angular} angular
35744
35644
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
35745
35645
  */
35746
35646
  function registerNgModule(angular) {
@@ -35749,7 +35649,7 @@ function registerNgModule(angular) {
35749
35649
  "ng",
35750
35650
  [],
35751
35651
  [
35752
- "$provide",
35652
+ $injectTokens.$provide,
35753
35653
  /** @param {import("./interface.js").Provider} $provide */
35754
35654
  ($provide) => {
35755
35655
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
@@ -35757,7 +35657,7 @@ function registerNgModule(angular) {
35757
35657
  $$sanitizeUri: SanitizeUriProvider,
35758
35658
  });
35759
35659
  $provide
35760
- .provider("$compile", CompileProvider)
35660
+ .provider($injectTokens.$compile, CompileProvider)
35761
35661
  .directive({
35762
35662
  input: inputDirective,
35763
35663
  textarea: inputDirective,
@@ -35863,7 +35763,7 @@ function registerNgModule(angular) {
35863
35763
  $parse: ParseProvider,
35864
35764
  $$rAFScheduler: RafSchedulerProvider,
35865
35765
  $rootScope: RootScopeProvider,
35866
- $routerGlobals: RouterGlobals,
35766
+ $router: Router,
35867
35767
  $sce: SceProvider,
35868
35768
  $sceDelegate: SceDelegateProvider,
35869
35769
  $templateCache: TemplateCacheProvider,
@@ -35872,9 +35772,9 @@ function registerNgModule(angular) {
35872
35772
  $view: ViewService,
35873
35773
  $transitions: TransitionProvider,
35874
35774
  $state: StateProvider,
35875
- $ngViewScroll: ViewScrollProvider,
35775
+ $viewScroll: ViewScrollProvider,
35876
35776
  $templateFactory: TemplateFactoryProvider,
35877
- $urlService: UrlService,
35777
+ $url: UrlService,
35878
35778
  $stateRegistry: StateRegistryProvider,
35879
35779
  $eventBus: PubSubProvider,
35880
35780
  });
@@ -35882,14 +35782,12 @@ function registerNgModule(angular) {
35882
35782
  ],
35883
35783
  )
35884
35784
  .factory("$stateParams", [
35885
- "$routerGlobals",
35785
+ $injectTokens.$router,
35886
35786
  /**
35887
- * @param {import('./router/globals.js').RouterGlobals} globals
35787
+ * @param {import('./router/router.js').Router} globals
35888
35788
  * @returns {import('./router/params/state-params.js').StateParams }
35889
35789
  */
35890
- function (globals) {
35891
- return globals.params;
35892
- },
35790
+ (globals) => globals.params,
35893
35791
  ])
35894
35792
  .value("$trace", trace);
35895
35793
  }
@@ -35917,7 +35815,7 @@ class Angular {
35917
35815
  /**
35918
35816
  * @type {string} `version` from `package.json`
35919
35817
  */
35920
- this.version = "0.7.8"; //inserted via rollup plugin
35818
+ this.version = "0.8.1"; //inserted via rollup plugin
35921
35819
 
35922
35820
  /** @type {!Array<string|any>} */
35923
35821
  this.bootsrappedModules = [];
@@ -35926,9 +35824,9 @@ class Angular {
35926
35824
  this.getInjector = getInjector;
35927
35825
  this.getScope = getScope;
35928
35826
  this.errorHandlingConfig = errorHandlingConfig;
35827
+ this.$t = $injectTokens;
35929
35828
 
35930
35829
  window["angular"] = this;
35931
- this.$injectTokens = $injectTokens;
35932
35830
  registerNgModule(this);
35933
35831
  }
35934
35832
 
@@ -36005,14 +35903,14 @@ class Angular {
36005
35903
 
36006
35904
  const injector = createInjector(this.bootsrappedModules, config.strictDi);
36007
35905
  injector.invoke([
36008
- "$rootScope",
36009
- "$rootElement",
36010
- "$compile",
36011
- "$injector",
35906
+ $injectTokens.$rootScope,
35907
+ $injectTokens.$rootElement,
35908
+ $injectTokens.$compile,
35909
+ $injectTokens.$injector,
36012
35910
  /**
36013
35911
  * @param {import('./core/scope/scope.js').Scope} scope
36014
35912
  * @param {Element} el
36015
- * @param {*} compile
35913
+ * @param {import("./core/compile/compile.js").CompileFn} compile
36016
35914
  * @param {import("./core/di/internal-injector.js").InjectorService} $injector
36017
35915
  */
36018
35916
  (scope, el, compile, $injector) => {
@@ -36035,7 +35933,7 @@ class Angular {
36035
35933
  }
36036
35934
 
36037
35935
  $injector
36038
- .get("$stateRegistry")
35936
+ .get($injectTokens.$stateRegistry)
36039
35937
  .get()
36040
35938
  .map((x) => x.$$state().resolvables)
36041
35939
  .reduce(unnestR, [])
@@ -36140,7 +36038,7 @@ class Angular {
36140
36038
  * @param {string} name The name of the module to create or retrieve.
36141
36039
  * @param {Array.<string>} [requires] If specified then new module is being created. If
36142
36040
  * unspecified then the module is being retrieved for further configuration.
36143
- * @param {Array<any>|Function} [configFn] Optional configuration function for the module that gets
36041
+ * @param {import("./interface.js").Injectable} [configFn] Optional configuration function for the module that gets
36144
36042
  * passed to {@link NgModule.config NgModule.config()}.
36145
36043
  * @returns {NgModule} A newly registered module.
36146
36044
  */
@@ -36157,7 +36055,7 @@ class Angular {
36157
36055
  name,
36158
36056
  );
36159
36057
  }
36160
- return new NgModule(name, requires, /** @type {Function} */ (configFn));
36058
+ return new NgModule(name, requires, configFn);
36161
36059
  });
36162
36060
  }
36163
36061
  }