@angular-wave/angular.ts 0.7.7 → 0.7.8

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 (157) hide show
  1. package/@types/animations/raf-scheduler.d.ts +2 -2
  2. package/@types/animations/shared.d.ts +0 -1
  3. package/@types/core/compile/attributes.d.ts +3 -3
  4. package/@types/core/compile/compile.d.ts +1 -1
  5. package/@types/core/di/injector.d.ts +0 -1
  6. package/@types/core/di/internal-injector.d.ts +1 -0
  7. package/@types/core/di/ng-module.d.ts +5 -0
  8. package/@types/core/filter/filter.d.ts +11 -13
  9. package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
  10. package/@types/core/scope/scope.d.ts +1 -1
  11. package/@types/directive/attrs/attrs.d.ts +7 -1
  12. package/@types/directive/events/events.d.ts +9 -3
  13. package/@types/directive/http/http.d.ts +6 -2
  14. package/@types/directive/include/include.d.ts +2 -2
  15. package/@types/directive/input/input.d.ts +2 -12
  16. package/@types/directive/messages/messages.d.ts +9 -48
  17. package/@types/directive/model/model.d.ts +3 -3
  18. package/@types/directive/options/options.d.ts +13 -20
  19. package/@types/directive/switch/switch.d.ts +1 -0
  20. package/@types/directive/transclude/transclude.d.ts +10 -6
  21. package/@types/interface.d.ts +54 -18
  22. package/@types/router/common/glob.d.ts +5 -1
  23. package/@types/router/directives/view-directive.d.ts +2 -19
  24. package/@types/router/globals.d.ts +1 -2
  25. package/@types/router/state/state-registry.d.ts +1 -2
  26. package/@types/router/url/url-service.d.ts +7 -9
  27. package/@types/services/anchor-scroll.d.ts +1 -1
  28. package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
  29. package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
  30. package/@types/services/http/http.d.ts +0 -2
  31. package/@types/services/http/interface.d.ts +2 -2
  32. package/@types/services/http-backend/http-backend.d.ts +13 -21
  33. package/@types/services/location/interface.d.ts +8 -0
  34. package/@types/{core → services}/location/location.d.ts +52 -12
  35. package/@types/{core → services}/sce/sce.d.ts +1 -1
  36. package/@types/services/template-cache/interface.d.ts +8 -2
  37. package/@types/services/template-cache/template-cache.d.ts +1 -1
  38. package/@types/services/template-request.d.ts +1 -1
  39. package/@types/shared/cache.d.ts +0 -2
  40. package/@types/shared/dom.d.ts +6 -0
  41. package/@types/shared/test-utils.d.ts +1 -0
  42. package/@types/shared/url-utils/interface.d.ts +47 -0
  43. package/@types/{core → shared}/url-utils/url-utils.d.ts +26 -13
  44. package/@types/shared/utils.d.ts +15 -0
  45. package/Makefile +3 -2
  46. package/dist/angular-ts.esm.js +982 -1190
  47. package/dist/angular-ts.umd.js +982 -1190
  48. package/dist/angular-ts.umd.min.js +1 -1
  49. package/docs/content/docs/directive/bind.md +9 -7
  50. package/docs/content/docs/directive/get.md +203 -0
  51. package/docs/content/docs/provider/templateCacheProvider.md +66 -1
  52. package/docs/content/docs/service/templateCache.md +2 -2
  53. package/docs/layouts/partials/hooks/head-end.html +1 -1
  54. package/docs/layouts/shortcodes/showcss.html +2 -0
  55. package/docs/static/examples/ng-bind/ng-bind.html +2 -2
  56. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  57. package/docs/static/typedoc/assets/navigation.js +1 -1
  58. package/docs/static/typedoc/assets/search.js +1 -1
  59. package/docs/static/typedoc/classes/NgModule.html +32 -0
  60. package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
  61. package/docs/static/typedoc/hierarchy.html +1 -1
  62. package/docs/static/typedoc/index.html +1 -1
  63. package/docs/static/typedoc/interfaces/Directive.html +5 -4
  64. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
  65. package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
  66. package/docs/static/typedoc/interfaces/Provider.html +15 -10
  67. package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
  68. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
  69. package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
  70. package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
  71. package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
  72. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
  73. package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
  74. package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
  75. package/docs/static/typedoc/variables/SwapMode.html +11 -0
  76. package/legacy.d.ts +0 -10
  77. package/package.json +1 -3
  78. package/src/animations/animate-children-directive.js +2 -2
  79. package/src/animations/raf-scheduler.js +1 -1
  80. package/src/animations/shared.js +0 -9
  81. package/src/core/compile/attributes.js +1 -1
  82. package/src/core/compile/compile.js +3 -3
  83. package/src/core/di/injector.js +4 -17
  84. package/src/core/di/internal-injector.js +4 -1
  85. package/src/core/di/ng-module.js +12 -27
  86. package/src/core/filter/filter.js +28 -28
  87. package/src/core/parse/interpreter.js +32 -38
  88. package/src/core/sanitize/sanitize-uri.js +3 -3
  89. package/src/core/scope/scope.js +2 -2
  90. package/src/directive/attrs/attrs.js +7 -4
  91. package/src/directive/events/events.js +6 -2
  92. package/src/directive/http/delete.spec.js +2 -0
  93. package/src/directive/http/get.spec.js +280 -3
  94. package/src/directive/http/http.js +100 -12
  95. package/src/directive/http/http.test.js +2 -2
  96. package/src/directive/http/post.spec.js +2 -0
  97. package/src/directive/http/put.spec.js +2 -0
  98. package/src/directive/include/include.js +7 -7
  99. package/src/directive/input/input.js +6 -28
  100. package/src/directive/messages/messages.js +4 -0
  101. package/src/directive/model/model.js +1 -1
  102. package/src/directive/options/options.js +454 -464
  103. package/src/directive/setter/setter.js +12 -14
  104. package/src/directive/setter/setter.spec.js +39 -16
  105. package/src/directive/switch/switch.js +1 -0
  106. package/src/directive/transclude/transclude.js +87 -89
  107. package/src/injection-tokens.js +1 -1
  108. package/src/interface.ts +68 -19
  109. package/src/loader.js +4 -9
  110. package/src/public.js +9 -15
  111. package/src/router/common/glob.js +5 -0
  112. package/src/router/directives/state-directives.spec.js +1 -1
  113. package/src/router/directives/view-directive.js +9 -1
  114. package/src/router/globals.js +0 -1
  115. package/src/router/state/state-registry.js +0 -1
  116. package/src/router/state-filters.js +2 -2
  117. package/src/router/url/url-service.js +5 -9
  118. package/src/services/anchor-scroll.html +0 -7
  119. package/src/services/anchor-scroll.js +1 -1
  120. package/src/{core → services/exception}/exception-handler.js +2 -2
  121. package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
  122. package/src/services/http/http.js +2 -13
  123. package/src/services/http/interface.ts +2 -2
  124. package/src/services/http-backend/http-backend.js +4 -14
  125. package/src/services/http-backend/http-backend.spec.js +1 -4
  126. package/src/services/location/interface.ts +8 -0
  127. package/src/{core → services}/location/location.html +4 -1
  128. package/src/{core → services}/location/location.js +128 -26
  129. package/src/{core → services}/location/location.spec.js +2 -2
  130. package/src/{core → services}/location/location.test.js +1 -1
  131. package/src/{core → services}/sce/sce.html +1 -1
  132. package/src/{core → services}/sce/sce.js +9 -3
  133. package/src/{core → services}/sce/sce.spec.js +2 -3
  134. package/src/{core → services}/sce/sce.test.js +1 -1
  135. package/src/services/template-cache/interface.ts +8 -2
  136. package/src/services/template-cache/template-cache.js +3 -1
  137. package/src/services/template-cache/template-cache.spec.js +72 -0
  138. package/src/services/template-request.js +2 -1
  139. package/src/shared/cache.js +0 -2
  140. package/src/shared/dom.js +10 -0
  141. package/src/shared/test-utils.js +1 -0
  142. package/src/shared/url-utils/interface.ts +56 -0
  143. package/src/{core → shared}/url-utils/url-utils.html +4 -1
  144. package/src/{core → shared}/url-utils/url-utils.js +26 -23
  145. package/src/{core → shared}/url-utils/url-utils.spec.js +0 -8
  146. package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
  147. package/src/shared/utils.js +28 -0
  148. package/utils/express.js +9 -1
  149. package/@types/core/task-tracker-factory.d.ts +0 -76
  150. package/@types/services/browser.d.ts +0 -101
  151. package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
  152. package/jsdoc.json +0 -22
  153. package/src/core/task-tracker-factory.js +0 -145
  154. package/src/services/browser.js +0 -212
  155. /package/src/{core → services}/location/location.md +0 -0
  156. /package/src/{core → services}/sce/sce.md +0 -0
  157. /package/src/{core → shared}/url-utils/url-utils.md +0 -0
@@ -1,4 +1,4 @@
1
- /* Version: 0.7.7 - July 13, 2025 16:59:16 */
1
+ /* Version: 0.7.8 - July 17, 2025 02:51:18 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1154,11 +1154,37 @@
1154
1154
  };
1155
1155
  }
1156
1156
 
1157
+ /**
1158
+ * Wraps a function so it will only be called starting from the second invocation.
1159
+ * The first call does nothing and returns undefined.
1160
+ *
1161
+ * @param {Function} fn - The function to wrap.
1162
+ * @returns {Function} A new function that will skip the first call.
1163
+ */
1164
+ function callBackAfterFirst(fn) {
1165
+ let calledOnce = false;
1166
+
1167
+ return function (...args) {
1168
+ if (calledOnce) {
1169
+ return fn.apply(this, args);
1170
+ }
1171
+ calledOnce = true;
1172
+ };
1173
+ }
1174
+
1175
+ /**
1176
+ * Delays execution for a specified number of milliseconds.
1177
+ *
1178
+ * @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
1179
+ * @returns {Promise<void>} A promise that resolves after the delay.
1180
+ */
1181
+ function wait(t = 0) {
1182
+ return new Promise((resolve) => setTimeout(resolve, t));
1183
+ }
1184
+
1157
1185
  /**
1158
1186
  * Expando cache for adding properties to DOM nodes with JavaScript.
1159
1187
  * This used to be an Object in JQLite decorator, but swapped out for a Map
1160
- * for performance reasons and convenience methods. A proxy is available for
1161
- * additional logic handling.
1162
1188
  *
1163
1189
  * @type {Map<number, import('../interface.ts').ExpandoStore>}
1164
1190
  */
@@ -1711,6 +1737,16 @@
1711
1737
  }
1712
1738
  }
1713
1739
 
1740
+ /**
1741
+ * Returns the base href of the document.
1742
+ *
1743
+ * @returns {string} The base href.
1744
+ */
1745
+ function getBaseHref() {
1746
+ const href = document.querySelector("base")?.getAttribute("href");
1747
+ return href ? href.replace(/^(https?:)?\/\/[^/]*/, "") : "";
1748
+ }
1749
+
1714
1750
  /**
1715
1751
  * A helper list of tokens matching the standard injectables that come predefined in the core `ng` module.
1716
1752
  * These string tokens are commonly injected into services, directives, or components via `$inject`.
@@ -1743,7 +1779,7 @@
1743
1779
  $animate: "$animate",
1744
1780
  $animateCss: "$animateCss",
1745
1781
  $aria: "$aria",
1746
- $browser: "$browser",
1782
+ $compile: "$compile",
1747
1783
  $controller: "$controller",
1748
1784
  $eventBus: "$eventBus",
1749
1785
  $exceptionHandler: "$exceptionHandler",
@@ -1786,10 +1822,15 @@
1786
1822
  return services.map((x) => x + "Provider");
1787
1823
  }
1788
1824
 
1825
+ /** @private */
1789
1826
  const INJECTOR_LITERAL = "$injector";
1827
+ /** @private */
1790
1828
  const COMPILE_LITERAL = "$compileProvider";
1829
+ /** @private */
1791
1830
  const ANIMATION_LITERAL = "$animateProvider";
1831
+ /** @private */
1792
1832
  const FILTER_LITERAL = "$filterProvider";
1833
+ /** @private */
1793
1834
  const CONTROLLER_LITERAL = "$controllerProvider";
1794
1835
 
1795
1836
  /**
@@ -1856,11 +1897,7 @@
1856
1897
  * @returns {NgModule}
1857
1898
  */
1858
1899
  constant(name, object) {
1859
- this.invokeQueue.unshift([
1860
- $injectTokens.$provide,
1861
- "constant",
1862
- [name, object],
1863
- ]);
1900
+ this.invokeQueue.unshift([$injectTokens.$provide, "constant", [name, object]]);
1864
1901
  return this;
1865
1902
  }
1866
1903
 
@@ -1905,11 +1942,7 @@
1905
1942
  if (providerFunction && isFunction(providerFunction)) {
1906
1943
  providerFunction.$$moduleName = name;
1907
1944
  }
1908
- this.invokeQueue.push([
1909
- $injectTokens.$provide,
1910
- "factory",
1911
- [name, providerFunction],
1912
- ]);
1945
+ this.invokeQueue.push([$injectTokens.$provide, "factory", [name, providerFunction]]);
1913
1946
  return this;
1914
1947
  }
1915
1948
 
@@ -1922,11 +1955,7 @@
1922
1955
  if (serviceFunction && isFunction(serviceFunction)) {
1923
1956
  serviceFunction.$$moduleName = name;
1924
1957
  }
1925
- this.invokeQueue.push([
1926
- $injectTokens.$provide,
1927
- "service",
1928
- [name, serviceFunction],
1929
- ]);
1958
+ this.invokeQueue.push([$injectTokens.$provide, "service", [name, serviceFunction]]);
1930
1959
  return this;
1931
1960
  }
1932
1961
 
@@ -1939,11 +1968,7 @@
1939
1968
  if (providerType && isFunction(providerType)) {
1940
1969
  providerType.$$moduleName = name;
1941
1970
  }
1942
- this.invokeQueue.push([
1943
- $injectTokens.$provide,
1944
- "provider",
1945
- [name, providerType],
1946
- ]);
1971
+ this.invokeQueue.push([$injectTokens.$provide, "provider", [name, providerType]]);
1947
1972
  return this;
1948
1973
  }
1949
1974
 
@@ -1956,11 +1981,7 @@
1956
1981
  if (decorFn && isFunction(decorFn)) {
1957
1982
  decorFn.$$moduleName = name;
1958
1983
  }
1959
- this.configBlocks.push([
1960
- $injectTokens.$provide,
1961
- "decorator",
1962
- [name, decorFn],
1963
- ]);
1984
+ this.configBlocks.push([$injectTokens.$provide, "decorator", [name, decorFn]]);
1964
1985
  return this;
1965
1986
  }
1966
1987
 
@@ -2205,8 +2226,11 @@
2205
2226
  */
2206
2227
  constructor(providerInjector, strictDi) {
2207
2228
  super(strictDi);
2229
+
2230
+ /** @type {ProviderInjector} */
2208
2231
  this.providerInjector = providerInjector;
2209
- this.modules = this.providerInjector.modules;
2232
+ /** @type {Object.<string, import("./ng-module.js").NgModule>} */
2233
+ this.modules = providerInjector.modules;
2210
2234
  }
2211
2235
 
2212
2236
  /**
@@ -2323,9 +2347,6 @@
2323
2347
  const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
2324
2348
 
2325
2349
  const providerCache = {
2326
- /**
2327
- * @type {import('../../interface.ts').Provider}
2328
- */
2329
2350
  $provide: {
2330
2351
  provider: supportObject(provider),
2331
2352
  factory: supportObject(factory),
@@ -2352,15 +2373,10 @@
2352
2373
  const runBlocks = loadModules(modulesToLoad);
2353
2374
  instanceInjector = protoInstanceInjector.get(INJECTOR_LITERAL);
2354
2375
 
2355
- runBlocks.forEach((fn) => {
2356
- if (fn) instanceInjector.invoke(fn);
2357
- });
2376
+ runBlocks.forEach((fn) => fn && instanceInjector.invoke(fn));
2358
2377
 
2359
- instanceInjector.loadNewModules = function (mods) {
2360
- loadModules(mods).forEach((fn) => {
2361
- if (fn) instanceInjector.invoke(fn);
2362
- });
2363
- };
2378
+ instanceInjector.loadNewModules = (mods) =>
2379
+ loadModules(mods).forEach((fn) => fn && instanceInjector.invoke(fn));
2364
2380
 
2365
2381
  return instanceInjector;
2366
2382
 
@@ -2489,7 +2505,7 @@
2489
2505
 
2490
2506
  try {
2491
2507
  if (isString(module)) {
2492
- /** @type {import('./ng-module').NgModule} */
2508
+ /** @type {import('./ng-module.js').NgModule} */
2493
2509
  const moduleFn = window["angular"].module(module);
2494
2510
  instanceInjector.modules[/** @type {string } */ (module)] = moduleFn;
2495
2511
  runBlocks = runBlocks
@@ -2555,7 +2571,6 @@
2555
2571
  }
2556
2572
 
2557
2573
  /**
2558
- *
2559
2574
  * @param {any} fn
2560
2575
  * @param {boolean} [strictDi]
2561
2576
  * @param {String} [name]
@@ -2594,10 +2609,6 @@
2594
2609
  return $inject;
2595
2610
  }
2596
2611
 
2597
- /**
2598
- * @param {function(string, any):any} delegate
2599
- * @returns {any}
2600
- */
2601
2612
  function supportObject(delegate) {
2602
2613
  return function (key, value) {
2603
2614
  if (isObject(key)) {
@@ -3013,32 +3024,25 @@
3013
3024
  }
3014
3025
  }
3015
3026
 
3016
- /**
3017
- * HTTP protocol
3018
- * @typedef {"http"|"https"} HttpProtocol
3019
- */
3020
-
3021
3027
  const urlParsingNode = document.createElement("a");
3022
3028
  const originUrl = urlResolve(window.location.href);
3023
3029
  let baseUrlParsingNode;
3024
3030
 
3025
3031
  urlParsingNode.href = "http://[::1]";
3026
3032
 
3033
+ /**
3034
+ * @param {import("./interface.js").ResolvableUrl} url
3035
+ * @return {import("./interface.js").ParsedUrl}
3036
+ */
3027
3037
  function urlResolve(url) {
3028
- if (!isString(url)) return url;
3029
-
3030
- const href = url;
3038
+ if (!isString(url))
3039
+ return /** @type {import("./interface.js").ParsedUrl} */ (url);
3031
3040
 
3032
- urlParsingNode.setAttribute("href", href);
3041
+ urlParsingNode.setAttribute("href", /** @type {string} */ (url));
3033
3042
 
3034
- let { hostname } = urlParsingNode;
3035
- // Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview)
3036
- // IE/Edge don't wrap IPv6 addresses' hostnames in square brackets
3037
- // when parsed out of an anchor element.
3038
- const ipv6InBrackets = urlParsingNode.hostname === "[::1]";
3039
- if (!ipv6InBrackets && hostname.indexOf(":") > -1) {
3040
- hostname = `[${hostname}]`;
3041
- }
3043
+ const hostname = urlParsingNode.hostname.includes(":")
3044
+ ? `[${urlParsingNode.hostname}]`
3045
+ : urlParsingNode.hostname;
3042
3046
 
3043
3047
  return {
3044
3048
  href: urlParsingNode.href,
@@ -3063,7 +3067,7 @@
3063
3067
  * Parse a request URL and determine whether this is a same-origin request as the application
3064
3068
  * document.
3065
3069
  *
3066
- * @param {string|object} requestUrl The url of the request as a string that will be resolved
3070
+ * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3067
3071
  * or a parsed URL object.
3068
3072
  * @returns {boolean} Whether the request is for the same origin as the application document.
3069
3073
  */
@@ -3077,7 +3081,7 @@
3077
3081
  * Note: The base URL is usually the same as the document location (`location.href`) but can
3078
3082
  * be overriden by using the `<base>` tag.
3079
3083
  *
3080
- * @param {string|object} requestUrl The url of the request as a string that will be resolved
3084
+ * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3081
3085
  * or a parsed URL object.
3082
3086
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
3083
3087
  */
@@ -3091,7 +3095,7 @@
3091
3095
  *
3092
3096
  * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
3093
3097
  *
3094
- * @returns {Function} - A function that receives a URL (string or parsed URL object) and returns
3098
+ * @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3095
3099
  * whether it is of an allowed origin.
3096
3100
  */
3097
3101
  function urlIsAllowedOriginFactory(trustedOriginUrls) {
@@ -3104,7 +3108,7 @@
3104
3108
  * based on a list of trusted-origin URLs. The current location's origin is implicitly
3105
3109
  * trusted.
3106
3110
  *
3107
- * @param {string|Object} requestUrl - The URL to be checked (provided as a string that will be
3111
+ * @param {import("./interface.js").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3108
3112
  * resolved or a parsed URL object).
3109
3113
  *
3110
3114
  * @returns {boolean} - Whether the specified URL is of an allowed origin.
@@ -3120,9 +3124,9 @@
3120
3124
  /**
3121
3125
  * Determine if two URLs share the same origin.
3122
3126
  *
3123
- * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of
3127
+ * @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3124
3128
  * a dictionary object returned by `urlResolve()`.
3125
- * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form
3129
+ * @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3126
3130
  * of a dictionary object returned by `urlResolve()`.
3127
3131
  *
3128
3132
  * @returns {boolean} - True if both URLs have the same origin, and false otherwise.
@@ -3155,7 +3159,17 @@
3155
3159
  return baseUrlParsingNode.href;
3156
3160
  }
3157
3161
 
3158
- /** @typedef {import("../error-handler.ts").ErrorHandler } ErrorHandler */
3162
+ /**
3163
+ * Removes a trailing hash ('#') from the given URL if it exists.
3164
+ *
3165
+ * @param {string} url
3166
+ * @returns {string}
3167
+ */
3168
+ function trimEmptyHash(url) {
3169
+ return url.replace(/#$/, "");
3170
+ }
3171
+
3172
+ /** @typedef {import("../exception/interface.ts").Interface } ErrorHandler */
3159
3173
 
3160
3174
  const $sceMinErr = minErr("$sce");
3161
3175
 
@@ -3211,6 +3225,7 @@
3211
3225
  .replace(/\\\*/g, "[^:/.?&;]*");
3212
3226
  return new RegExp(`^${matcher}$`);
3213
3227
  }
3228
+
3214
3229
  if (isRegExp(matcher)) {
3215
3230
  // The only other type of matcher allowed is a Regexp.
3216
3231
  // Match entire URL / disallow partial matches.
@@ -3472,6 +3487,11 @@
3472
3487
  htmlSanitizer = $injector.get("$sanitize");
3473
3488
  }
3474
3489
 
3490
+ /**
3491
+ * @param {string|RegExp} matcher
3492
+ * @param {import("../../shared/url-utils/interface").ParsedUrl} parsedUrl
3493
+ * @return {boolean}
3494
+ */
3475
3495
  function matchUrl(matcher, parsedUrl) {
3476
3496
  if (matcher === "self") {
3477
3497
  return (
@@ -3479,7 +3499,7 @@
3479
3499
  );
3480
3500
  }
3481
3501
  // definitely a regex. See adjustMatchers()
3482
- return !!matcher.exec(parsedUrl.href);
3502
+ return !!(/** @type {RegExp} */ (matcher).exec(parsedUrl.href));
3483
3503
  }
3484
3504
 
3485
3505
  function isResourceUrlAllowedByPolicy(url) {
@@ -3984,6 +4004,10 @@
3984
4004
  * A collection of directives that allows creation of custom event handlers that are defined as
3985
4005
  * AngularTS expressions and are compiled and executed within the current scope.
3986
4006
  */
4007
+
4008
+ /**
4009
+ * @type {Record<string, import("../../interface.js").DirectiveFactory>}
4010
+ */
3987
4011
  const ngEventDirectives = {};
3988
4012
 
3989
4013
  "click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove"
@@ -3995,7 +4019,7 @@
3995
4019
  "$exceptionHandler",
3996
4020
  /**
3997
4021
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
3998
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
4022
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
3999
4023
  * @returns
4000
4024
  */
4001
4025
  ($parse, $exceptionHandler) => {
@@ -4012,7 +4036,7 @@
4012
4036
  /**
4013
4037
  *
4014
4038
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
4015
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
4039
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
4016
4040
  * @param {string} directiveName
4017
4041
  * @param {string} eventName
4018
4042
  * @returns {import("../../interface.ts").Directive}
@@ -4053,7 +4077,7 @@
4053
4077
  /**
4054
4078
  * @param {import('../scope/scope.js').Scope} $rootScope
4055
4079
  * @param {*} $animate
4056
- * @param {import("../exception-handler.js").ErrorHandler} $exceptionHandler
4080
+ * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4057
4081
  * @param {*} $sce
4058
4082
  * @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
4059
4083
  * @param {Object} [attributesToCopy]
@@ -4651,7 +4675,7 @@
4651
4675
  "$exceptionHandler",
4652
4676
  /**
4653
4677
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
4654
- * @param {import('../exception-handler.js').ErrorHandler} $exceptionHandler
4678
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
4655
4679
  */
4656
4680
  function ($injector, $exceptionHandler) {
4657
4681
  const directives = [];
@@ -4979,7 +5003,7 @@
4979
5003
  /**
4980
5004
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
4981
5005
  * @param {*} $interpolate
4982
- * @param {import("../exception-handler.js").ErrorHandler} $exceptionHandler
5006
+ * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4983
5007
  * @param {*} $templateRequest
4984
5008
  * @param {import("../parse/interface.ts").ParseService} $parse
4985
5009
  * @param {*} $controller
@@ -8464,7 +8488,7 @@
8464
8488
 
8465
8489
  /**
8466
8490
  * @param {import('../../core/scope/scope.js').Scope} $scope
8467
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
8491
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
8468
8492
  * @param {import('../../core/compile/attributes.js').Attributes} $attr
8469
8493
  * @param {Element} $element
8470
8494
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
@@ -9861,7 +9885,6 @@
9861
9885
  element,
9862
9886
  attr,
9863
9887
  ctrl,
9864
- $browser,
9865
9888
  $filter,
9866
9889
  $parse,
9867
9890
  ) {
@@ -10138,15 +10161,7 @@
10138
10161
  return (value - stepBase) % step === 0;
10139
10162
  }
10140
10163
 
10141
- function numberInputType(
10142
- scope,
10143
- element,
10144
- attr,
10145
- ctrl,
10146
- $browser,
10147
- $filter,
10148
- $parse,
10149
- ) {
10164
+ function numberInputType(scope, element, attr, ctrl, $filter, $parse) {
10150
10165
  badInputChecker(scope, element, attr, ctrl, "number");
10151
10166
  numberFormatterParser(ctrl);
10152
10167
  baseInputType(scope, element, attr, ctrl);
@@ -10462,15 +10477,7 @@
10462
10477
  return fallback;
10463
10478
  }
10464
10479
 
10465
- function checkboxInputType(
10466
- scope,
10467
- element,
10468
- attr,
10469
- ctrl,
10470
- $browser,
10471
- $filter,
10472
- $parse,
10473
- ) {
10480
+ function checkboxInputType(scope, element, attr, ctrl, $filter, $parse) {
10474
10481
  const trueValue = parseConstantExpr(
10475
10482
  $parse,
10476
10483
  scope,
@@ -10508,30 +10515,25 @@
10508
10515
  ctrl.$parsers.push((value) => (value ? trueValue : falseValue));
10509
10516
  }
10510
10517
 
10511
- /**
10512
- * @returns {import('../../interface.ts').Directive}
10513
- */
10514
- inputDirective.$inject = ["$browser", "$filter", "$parse"];
10518
+ inputDirective.$inject = ["$filter", "$parse"];
10515
10519
 
10516
10520
  /**
10517
- * @param {import('../../services/browser').Browser} $browser
10518
10521
  * @param {*} $filter
10519
10522
  * @param {*} $parse
10520
- * @returns
10523
+ * @returns {import('../../interface.ts').Directive}
10521
10524
  */
10522
- function inputDirective($browser, $filter, $parse) {
10525
+ function inputDirective($filter, $parse) {
10523
10526
  return {
10524
10527
  restrict: "E",
10525
10528
  require: ["?ngModel"],
10526
10529
  link: {
10527
10530
  pre(scope, element, attr, ctrls) {
10528
10531
  if (ctrls[0]) {
10529
- (inputType[lowercase(attr.type)] || inputType.text)(
10532
+ (inputType[lowercase(attr["type"])] || inputType.text)(
10530
10533
  scope,
10531
10534
  element,
10532
10535
  attr,
10533
10536
  ctrls[0],
10534
- $browser,
10535
10537
  $filter,
10536
10538
  $parse,
10537
10539
  );
@@ -11650,7 +11652,7 @@
11650
11652
  * @param {*} $templateRequest
11651
11653
  * @param {import("../../services/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
11652
11654
  * @param {*} $animate
11653
- * @param {import('../../core/error-handler.js').ErrorHandler} $exceptionHandler
11655
+ * @param {import('../../services/exception/interface.ts').Interface} $exceptionHandler
11654
11656
  * @returns {import('../../interface.js').Directive}
11655
11657
  */
11656
11658
  function ngIncludeDirective(
@@ -11769,7 +11771,7 @@
11769
11771
  // We need this directive so that the element content is already filled when
11770
11772
  // the link function of another directive on the same element as ngInclude
11771
11773
  // is called.
11772
- ngIncludeFillContentDirective.$inject = ["$compile"];
11774
+ ngIncludeFillContentDirective.$inject = [$injectTokens.$compile];
11773
11775
 
11774
11776
  /**
11775
11777
  * @param {import("../../core/compile/compile.js").CompileFn} $compile
@@ -12251,6 +12253,7 @@
12251
12253
  ngSwitchDirective.$inject = ["$animate"];
12252
12254
 
12253
12255
  /**
12256
+ * @param {*} $animate
12254
12257
  * @returns {import('../../interface.ts').Directive}
12255
12258
  */
12256
12259
  function ngSwitchDirective($animate) {
@@ -12398,525 +12401,515 @@
12398
12401
  // 8: collection expression
12399
12402
  // 9: track by expression
12400
12403
 
12401
- const ngOptionsDirective = [
12402
- "$compile",
12403
- "$parse",
12404
+ ngOptionsDirective.$inject = ["$compile", "$parse"];
12405
+ /**
12406
+ *
12407
+ * @param {import("../../core/compile/compile.js").CompileFn} $compile
12408
+ * @param {import("../../core/parse/interface.ts").ParseService} $parse
12409
+ * @returns {import("../../interface.ts").Directive}
12410
+ */
12411
+ function ngOptionsDirective($compile, $parse) {
12404
12412
  /**
12405
- *
12406
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12407
- * @param {import("../../core/parse/interface.ts").ParseService} $parse
12413
+ * @param {import('../../interface.ts').Expression} optionsExp
12414
+ * @param {HTMLSelectElement} selectElement
12415
+ * @param {import('../../core/scope/scope.js').Scope} scope
12408
12416
  * @returns
12409
12417
  */
12410
- function ($compile, $parse) {
12411
- /**
12412
- * @param {import('../../interface.ts').Expression} optionsExp
12413
- * @param {HTMLSelectElement} selectElement
12414
- * @param {import('../../core/scope/scope.js').Scope} scope
12415
- * @returns
12416
- */
12417
- function parseOptionsExpression(optionsExp, selectElement, scope) {
12418
- const match = optionsExp.match(NG_OPTIONS_REGEXP);
12419
- if (!match) {
12420
- throw ngOptionsMinErr(
12421
- "iexp",
12422
- "Expected expression in form of " +
12423
- "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
12424
- " but got '{0}'. Element: {1}",
12425
- optionsExp,
12426
- startingTag(selectElement),
12427
- );
12428
- }
12429
- // Extract the parts from the ngOptions expression
12430
-
12431
- // The variable name for the value of the item in the collection
12432
- const valueName = match[5] || match[7];
12433
- // The variable name for the key of the item in the collection
12434
- const keyName = match[6];
12435
-
12436
- // An expression that generates the viewValue for an option if there is a label expression
12437
- const selectAs = / as /.test(match[0]) && match[1];
12438
- // An expression that is used to track the id of each object in the options collection
12439
- const trackBy = match[9];
12440
- // An expression that generates the viewValue for an option if there is no label expression
12441
- const valueFn = $parse(match[2] ? match[1] : valueName);
12442
- const selectAsFn = selectAs && $parse(selectAs);
12443
- const viewValueFn = selectAsFn || valueFn;
12444
- const trackByFn = trackBy && $parse(trackBy);
12445
-
12446
- // Get the value by which we are going to track the option
12447
- // if we have a trackFn then use that (passing scope and locals)
12448
- // otherwise just hash the given viewValue
12449
- const getTrackByValueFn = trackBy
12450
- ? function (value, locals) {
12451
- return trackByFn(scope, locals);
12452
- }
12453
- : function getHashOfValue(value) {
12454
- return hashKey(value);
12455
- };
12456
- const getTrackByValue = function (value, key) {
12457
- return getTrackByValueFn(value, getLocals(value, key));
12458
- };
12418
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
12419
+ const match = optionsExp.match(NG_OPTIONS_REGEXP);
12420
+ if (!match) {
12421
+ throw ngOptionsMinErr(
12422
+ "iexp",
12423
+ "Expected expression in form of " +
12424
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
12425
+ " but got '{0}'. Element: {1}",
12426
+ optionsExp,
12427
+ startingTag(selectElement),
12428
+ );
12429
+ }
12430
+ // Extract the parts from the ngOptions expression
12431
+
12432
+ // The variable name for the value of the item in the collection
12433
+ const valueName = match[5] || match[7];
12434
+ // The variable name for the key of the item in the collection
12435
+ const keyName = match[6];
12436
+
12437
+ // An expression that generates the viewValue for an option if there is a label expression
12438
+ const selectAs = / as /.test(match[0]) && match[1];
12439
+ // An expression that is used to track the id of each object in the options collection
12440
+ const trackBy = match[9];
12441
+ // An expression that generates the viewValue for an option if there is no label expression
12442
+ const valueFn = $parse(match[2] ? match[1] : valueName);
12443
+ const selectAsFn = selectAs && $parse(selectAs);
12444
+ const viewValueFn = selectAsFn || valueFn;
12445
+ const trackByFn = trackBy && $parse(trackBy);
12446
+
12447
+ // Get the value by which we are going to track the option
12448
+ // if we have a trackFn then use that (passing scope and locals)
12449
+ // otherwise just hash the given viewValue
12450
+ const getTrackByValueFn = trackBy
12451
+ ? function (value, locals) {
12452
+ return trackByFn(scope, locals);
12453
+ }
12454
+ : function getHashOfValue(value) {
12455
+ return hashKey(value);
12456
+ };
12457
+ const getTrackByValue = function (value, key) {
12458
+ return getTrackByValueFn(value, getLocals(value, key));
12459
+ };
12459
12460
 
12460
- const displayFn = $parse(match[2] || match[1]);
12461
- const groupByFn = $parse(match[3] || "");
12462
- const disableWhenFn = $parse(match[4] || "");
12463
- const valuesFn = $parse(match[8]);
12464
-
12465
- const locals = {};
12466
- let getLocals = keyName
12467
- ? function (value, key) {
12468
- locals[keyName] = key;
12469
- locals[valueName] = value;
12470
- return locals;
12471
- }
12472
- : function (value) {
12473
- locals[valueName] = value;
12474
- return locals;
12475
- };
12461
+ const displayFn = $parse(match[2] || match[1]);
12462
+ const groupByFn = $parse(match[3] || "");
12463
+ const disableWhenFn = $parse(match[4] || "");
12464
+ const valuesFn = $parse(match[8]);
12465
+
12466
+ const locals = {};
12467
+ let getLocals = keyName
12468
+ ? function (value, key) {
12469
+ locals[keyName] = key;
12470
+ locals[valueName] = value;
12471
+ return locals;
12472
+ }
12473
+ : function (value) {
12474
+ locals[valueName] = value;
12475
+ return locals;
12476
+ };
12476
12477
 
12477
- class Option {
12478
- constructor(selectValue, viewValue, label, group, disabled) {
12479
- this.selectValue = selectValue;
12480
- this.viewValue = viewValue;
12481
- this.label = label;
12482
- this.group = group;
12483
- this.disabled = disabled;
12484
- }
12478
+ class Option {
12479
+ constructor(selectValue, viewValue, label, group, disabled) {
12480
+ this.selectValue = selectValue;
12481
+ this.viewValue = viewValue;
12482
+ this.label = label;
12483
+ this.group = group;
12484
+ this.disabled = disabled;
12485
12485
  }
12486
+ }
12486
12487
 
12487
- function getOptionValuesKeys(optionValues) {
12488
- let optionValuesKeys;
12488
+ function getOptionValuesKeys(optionValues) {
12489
+ let optionValuesKeys;
12489
12490
 
12490
- if (!keyName && isArrayLike(optionValues)) {
12491
- optionValuesKeys = optionValues;
12492
- } else {
12493
- // if object, extract keys, in enumeration order, unsorted
12494
- optionValuesKeys = [];
12495
- for (const itemKey in optionValues) {
12496
- if (hasOwn(optionValues, itemKey) && itemKey.charAt(0) !== "$") {
12497
- optionValuesKeys.push(itemKey);
12498
- }
12491
+ if (!keyName && isArrayLike(optionValues)) {
12492
+ optionValuesKeys = optionValues;
12493
+ } else {
12494
+ // if object, extract keys, in enumeration order, unsorted
12495
+ optionValuesKeys = [];
12496
+ for (const itemKey in optionValues) {
12497
+ if (hasOwn(optionValues, itemKey) && itemKey.charAt(0) !== "$") {
12498
+ optionValuesKeys.push(itemKey);
12499
12499
  }
12500
12500
  }
12501
- return optionValuesKeys;
12502
12501
  }
12502
+ return optionValuesKeys;
12503
+ }
12503
12504
 
12504
- return {
12505
- trackBy,
12506
- getTrackByValue,
12507
- getWatchables: $parse(valuesFn, (optionValues) => {
12508
- // Create a collection of things that we would like to watch (watchedArray)
12509
- // so that they can all be watched using a single $watchCollection
12510
- // that only runs the handler once if anything changes
12511
- const watchedArray = [];
12512
- optionValues = optionValues || [];
12513
-
12514
- const optionValuesKeys = getOptionValuesKeys(optionValues);
12515
- const optionValuesLength = optionValuesKeys.length;
12516
- for (let index = 0; index < optionValuesLength; index++) {
12517
- const key =
12518
- optionValues === optionValuesKeys
12519
- ? index
12520
- : optionValuesKeys[index];
12521
- const value = optionValues[key];
12522
-
12523
- const locals = getLocals(value, key);
12524
- const selectValue = getTrackByValueFn(value, locals);
12525
- watchedArray.push(selectValue);
12526
-
12527
- // Only need to watch the displayFn if there is a specific label expression
12528
- if (match[2] || match[1]) {
12529
- const label = displayFn(scope, locals);
12530
- watchedArray.push(label);
12531
- }
12532
-
12533
- // Only need to watch the disableWhenFn if there is a specific disable expression
12534
- if (match[4]) {
12535
- const disableWhen = disableWhenFn(scope, locals);
12536
- watchedArray.push(disableWhen);
12537
- }
12538
- }
12539
- return watchedArray;
12540
- }),
12541
-
12542
- getOptions() {
12543
- /** @type {Option[]} */
12544
- const optionItems = [];
12545
- /** @type {Object.<string, Option>} */
12546
- const selectValueMap = {};
12547
-
12548
- // The option values were already computed in the `getWatchables` fn,
12549
- // which must have been called to trigger `getOptions`
12550
- const optionValues = valuesFn(scope) || [];
12551
- const optionValuesKeys = getOptionValuesKeys(optionValues);
12552
- const optionValuesLength = optionValuesKeys.length;
12553
-
12554
- for (let index = 0; index < optionValuesLength; index++) {
12555
- const key =
12556
- optionValues === optionValuesKeys
12557
- ? index
12558
- : optionValuesKeys[index];
12559
- const value = optionValues[key];
12560
- const locals = getLocals(value, key);
12561
- const viewValue = viewValueFn(scope, locals);
12562
- const selectValue = getTrackByValueFn(viewValue, locals);
12505
+ return {
12506
+ trackBy,
12507
+ getTrackByValue,
12508
+ getWatchables: $parse(valuesFn, (optionValues) => {
12509
+ // Create a collection of things that we would like to watch (watchedArray)
12510
+ // so that they can all be watched using a single $watchCollection
12511
+ // that only runs the handler once if anything changes
12512
+ const watchedArray = [];
12513
+ optionValues = optionValues || [];
12514
+
12515
+ const optionValuesKeys = getOptionValuesKeys(optionValues);
12516
+ const optionValuesLength = optionValuesKeys.length;
12517
+ for (let index = 0; index < optionValuesLength; index++) {
12518
+ const key =
12519
+ optionValues === optionValuesKeys ? index : optionValuesKeys[index];
12520
+ const value = optionValues[key];
12521
+
12522
+ const locals = getLocals(value, key);
12523
+ const selectValue = getTrackByValueFn(value, locals);
12524
+ watchedArray.push(selectValue);
12525
+
12526
+ // Only need to watch the displayFn if there is a specific label expression
12527
+ if (match[2] || match[1]) {
12563
12528
  const label = displayFn(scope, locals);
12564
- const group = groupByFn(scope, locals);
12565
- const disabled = disableWhenFn(scope, locals);
12566
- const optionItem = new Option(
12567
- selectValue,
12568
- viewValue,
12569
- label,
12570
- group,
12571
- disabled,
12572
- );
12529
+ watchedArray.push(label);
12530
+ }
12531
+
12532
+ // Only need to watch the disableWhenFn if there is a specific disable expression
12533
+ if (match[4]) {
12534
+ const disableWhen = disableWhenFn(scope, locals);
12535
+ watchedArray.push(disableWhen);
12536
+ }
12537
+ }
12538
+ return watchedArray;
12539
+ }),
12540
+
12541
+ getOptions() {
12542
+ /** @type {Option[]} */
12543
+ const optionItems = [];
12544
+ /** @type {Object.<string, Option>} */
12545
+ const selectValueMap = {};
12546
+
12547
+ // The option values were already computed in the `getWatchables` fn,
12548
+ // which must have been called to trigger `getOptions`
12549
+ const optionValues = valuesFn(scope) || [];
12550
+ const optionValuesKeys = getOptionValuesKeys(optionValues);
12551
+ const optionValuesLength = optionValuesKeys.length;
12552
+
12553
+ for (let index = 0; index < optionValuesLength; index++) {
12554
+ const key =
12555
+ optionValues === optionValuesKeys ? index : optionValuesKeys[index];
12556
+ const value = optionValues[key];
12557
+ const locals = getLocals(value, key);
12558
+ const viewValue = viewValueFn(scope, locals);
12559
+ const selectValue = getTrackByValueFn(viewValue, locals);
12560
+ const label = displayFn(scope, locals);
12561
+ const group = groupByFn(scope, locals);
12562
+ const disabled = disableWhenFn(scope, locals);
12563
+ const optionItem = new Option(
12564
+ selectValue,
12565
+ viewValue,
12566
+ label,
12567
+ group,
12568
+ disabled,
12569
+ );
12573
12570
 
12574
- optionItems.push(optionItem);
12575
- selectValueMap[selectValue] = optionItem;
12576
- }
12571
+ optionItems.push(optionItem);
12572
+ selectValueMap[selectValue] = optionItem;
12573
+ }
12577
12574
 
12578
- return {
12579
- items: optionItems,
12580
- selectValueMap,
12581
- getOptionFromViewValue(value) {
12582
- return selectValueMap[getTrackByValue(value)];
12583
- },
12584
- getViewValueFromOption(option) {
12585
- // If the viewValue could be an object that may be mutated by the application,
12586
- // we need to make a copy and not return the reference to the value on the option.
12587
- return trackBy
12588
- ? structuredClone(option.viewValue)
12589
- : option.viewValue;
12590
- },
12591
- };
12592
- },
12593
- };
12594
- }
12575
+ return {
12576
+ items: optionItems,
12577
+ selectValueMap,
12578
+ getOptionFromViewValue(value) {
12579
+ return selectValueMap[getTrackByValue(value)];
12580
+ },
12581
+ getViewValueFromOption(option) {
12582
+ // If the viewValue could be an object that may be mutated by the application,
12583
+ // we need to make a copy and not return the reference to the value on the option.
12584
+ return trackBy
12585
+ ? structuredClone(option.viewValue)
12586
+ : option.viewValue;
12587
+ },
12588
+ };
12589
+ },
12590
+ };
12591
+ }
12595
12592
 
12596
- /**
12597
- *
12598
- * @param {import("../../core/scope/scope.js").Scope} scope
12599
- * @param {HTMLSelectElement} selectElement
12600
- * @param {import("../../core/compile/attributes.js").Attributes} attr
12601
- * @param {*} ctrls
12602
- */
12603
- function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
12604
- const selectCtrl = ctrls[0];
12605
- const ngModelCtrl = ctrls[1];
12606
- const multiple = attr["multiple"];
12607
-
12608
- // The emptyOption allows the application developer to provide their own custom "empty"
12609
- // option when the viewValue does not match any of the option values.
12610
- for (
12611
- let i = 0, children = selectElement.childNodes, ii = children.length;
12612
- i < ii;
12613
- i++
12614
- ) {
12615
- if (/** @type {HTMLOptionElement} */ (children[i]).value === "") {
12616
- selectCtrl.hasEmptyOption = true;
12617
- selectCtrl.emptyOption = children[i];
12618
- break;
12619
- }
12593
+ /**
12594
+ *
12595
+ * @param {import("../../core/scope/scope.js").Scope} scope
12596
+ * @param {HTMLSelectElement} selectElement
12597
+ * @param {import("../../core/compile/attributes.js").Attributes} attr
12598
+ * @param {*} ctrls
12599
+ */
12600
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
12601
+ const selectCtrl = ctrls[0];
12602
+ const ngModelCtrl = ctrls[1];
12603
+ const multiple = attr["multiple"];
12604
+
12605
+ // The emptyOption allows the application developer to provide their own custom "empty"
12606
+ // option when the viewValue does not match any of the option values.
12607
+ for (
12608
+ let i = 0, children = selectElement.childNodes, ii = children.length;
12609
+ i < ii;
12610
+ i++
12611
+ ) {
12612
+ if (/** @type {HTMLOptionElement} */ (children[i]).value === "") {
12613
+ selectCtrl.hasEmptyOption = true;
12614
+ selectCtrl.emptyOption = children[i];
12615
+ break;
12620
12616
  }
12617
+ }
12621
12618
 
12622
- // The empty option will be compiled and rendered before we first generate the options
12623
- emptyElement(selectElement);
12619
+ // The empty option will be compiled and rendered before we first generate the options
12620
+ emptyElement(selectElement);
12624
12621
 
12625
- const providedEmptyOption = !!selectCtrl.emptyOption;
12622
+ const providedEmptyOption = !!selectCtrl.emptyOption;
12626
12623
 
12627
- const unknownOption = optionTemplate.cloneNode(false);
12628
- // TODO double check
12629
- unknownOption.nodeValue = "?";
12624
+ const unknownOption = optionTemplate.cloneNode(false);
12625
+ // TODO double check
12626
+ unknownOption.nodeValue = "?";
12630
12627
 
12631
- let options;
12632
- const ngOptions = parseOptionsExpression(
12633
- attr["ngOptions"],
12634
- selectElement,
12635
- scope,
12636
- );
12637
- // This stores the newly created options before they are appended to the select.
12638
- // Since the contents are removed from the fragment when it is appended,
12639
- // we only need to create it once.
12640
- const listFragment = document.createDocumentFragment();
12641
-
12642
- // Overwrite the implementation. ngOptions doesn't use hashes
12643
- selectCtrl.generateUnknownOptionValue = () => "?";
12644
-
12645
- // Update the controller methods for multiple selectable options
12646
- if (!multiple) {
12647
- selectCtrl.writeValue = function writeNgOptionsValue(value) {
12648
- // The options might not be defined yet when ngModel tries to render
12649
- if (!options) return;
12650
-
12651
- const selectedOption =
12652
- selectElement.options[selectElement.selectedIndex];
12653
- const option = options.getOptionFromViewValue(value);
12654
-
12655
- // Make sure to remove the selected attribute from the previously selected option
12656
- // Otherwise, screen readers might get confused
12657
- if (selectedOption) selectedOption.removeAttribute("selected");
12658
-
12659
- if (option) {
12660
- // Don't update the option when it is already selected.
12661
- // For example, the browser will select the first option by default. In that case,
12662
- // most properties are set automatically - except the `selected` attribute, which we
12663
- // set always
12664
-
12665
- if (selectElement.value !== option.selectValue) {
12666
- selectCtrl.removeUnknownOption();
12667
-
12668
- selectElement.value = option.selectValue;
12669
- option.element.selected = true;
12670
- }
12628
+ let options;
12629
+ const ngOptions = parseOptionsExpression(
12630
+ attr["ngOptions"],
12631
+ selectElement,
12632
+ scope,
12633
+ );
12634
+ // This stores the newly created options before they are appended to the select.
12635
+ // Since the contents are removed from the fragment when it is appended,
12636
+ // we only need to create it once.
12637
+ const listFragment = document.createDocumentFragment();
12638
+
12639
+ // Overwrite the implementation. ngOptions doesn't use hashes
12640
+ selectCtrl.generateUnknownOptionValue = () => "?";
12641
+
12642
+ // Update the controller methods for multiple selectable options
12643
+ if (!multiple) {
12644
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
12645
+ // The options might not be defined yet when ngModel tries to render
12646
+ if (!options) return;
12647
+
12648
+ const selectedOption =
12649
+ selectElement.options[selectElement.selectedIndex];
12650
+ const option = options.getOptionFromViewValue(value);
12651
+
12652
+ // Make sure to remove the selected attribute from the previously selected option
12653
+ // Otherwise, screen readers might get confused
12654
+ if (selectedOption) selectedOption.removeAttribute("selected");
12655
+
12656
+ if (option) {
12657
+ // Don't update the option when it is already selected.
12658
+ // For example, the browser will select the first option by default. In that case,
12659
+ // most properties are set automatically - except the `selected` attribute, which we
12660
+ // set always
12661
+
12662
+ if (selectElement.value !== option.selectValue) {
12663
+ selectCtrl.removeUnknownOption();
12671
12664
 
12672
- option.element.setAttribute("selected", "selected");
12673
- } else {
12674
- selectCtrl.selectUnknownOrEmptyOption(value);
12665
+ selectElement.value = option.selectValue;
12666
+ option.element.selected = true;
12675
12667
  }
12676
- };
12677
12668
 
12678
- selectCtrl.readValue = function readNgOptionsValue() {
12679
- const selectedOption = options.selectValueMap[selectElement.value];
12669
+ option.element.setAttribute("selected", "selected");
12670
+ } else {
12671
+ selectCtrl.selectUnknownOrEmptyOption(value);
12672
+ }
12673
+ };
12680
12674
 
12681
- if (selectedOption && !selectedOption.disabled) {
12682
- selectCtrl.unselectEmptyOption();
12683
- selectCtrl.removeUnknownOption();
12684
- return options.getViewValueFromOption(selectedOption);
12685
- }
12686
- return null;
12687
- };
12675
+ selectCtrl.readValue = function readNgOptionsValue() {
12676
+ const selectedOption = options.selectValueMap[selectElement.value];
12688
12677
 
12689
- // If we are using `track by` then we must watch the tracked value on the model
12690
- // since ngModel only watches for object identity change
12691
- // FIXME: When a user selects an option, this watch will fire needlessly
12692
- if (ngOptions.trackBy) {
12693
- scope.$watch(
12694
- ngOptions.getTrackByValue(ngModelCtrl.$viewValue),
12695
- () => {
12696
- ngModelCtrl.$render();
12697
- },
12698
- );
12678
+ if (selectedOption && !selectedOption.disabled) {
12679
+ selectCtrl.unselectEmptyOption();
12680
+ selectCtrl.removeUnknownOption();
12681
+ return options.getViewValueFromOption(selectedOption);
12699
12682
  }
12700
- } else {
12701
- selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
12702
- // The options might not be defined yet when ngModel tries to render
12703
- if (!options) return;
12704
-
12705
- // Only set `<option>.selected` if necessary, in order to prevent some browsers from
12706
- // scrolling to `<option>` elements that are outside the `<select>` element's viewport.
12707
- const selectedOptions =
12708
- (values && values.map(getAndUpdateSelectedOption)) || [];
12709
-
12710
- options.items.forEach((option) => {
12711
- if (option.element.selected && !includes(selectedOptions, option)) {
12712
- option.element.selected = false;
12713
- }
12714
- });
12715
- };
12683
+ return null;
12684
+ };
12716
12685
 
12717
- selectCtrl.readValue = function readNgOptionsMultiple() {
12718
- const selectedValues = selectElement.value || [];
12719
- const selections = [];
12720
- // @ts-ignore
12721
- selectedValues.forEach((value) => {
12722
- const option = options.selectValueMap[value];
12723
- if (option && !option.disabled)
12724
- selections.push(options.getViewValueFromOption(option));
12725
- });
12686
+ // If we are using `track by` then we must watch the tracked value on the model
12687
+ // since ngModel only watches for object identity change
12688
+ // FIXME: When a user selects an option, this watch will fire needlessly
12689
+ if (ngOptions.trackBy) {
12690
+ scope.$watch(ngOptions.getTrackByValue(ngModelCtrl.$viewValue), () => {
12691
+ ngModelCtrl.$render();
12692
+ });
12693
+ }
12694
+ } else {
12695
+ selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
12696
+ // The options might not be defined yet when ngModel tries to render
12697
+ if (!options) return;
12726
12698
 
12727
- return selections;
12728
- };
12699
+ // Only set `<option>.selected` if necessary, in order to prevent some browsers from
12700
+ // scrolling to `<option>` elements that are outside the `<select>` element's viewport.
12701
+ const selectedOptions =
12702
+ (values && values.map(getAndUpdateSelectedOption)) || [];
12729
12703
 
12730
- // If we are using `track by` then we must watch these tracked values on the model
12731
- // since ngModel only watches for object identity change
12732
- // if (ngOptions.trackBy) {
12733
- // scope.$watchCollection(
12734
- // () => {
12735
- // if (Array.isArray(ngModelCtrl.$viewValue)) {
12736
- // return ngModelCtrl.$viewValue.map((value) =>
12737
- // ngOptions.getTrackByValue(value),
12738
- // );
12739
- // }
12740
- // },
12741
- // () => {
12742
- // ngModelCtrl.$render();
12743
- // },
12744
- // );
12745
- // }
12746
- }
12704
+ options.items.forEach((option) => {
12705
+ if (option.element.selected && !includes(selectedOptions, option)) {
12706
+ option.element.selected = false;
12707
+ }
12708
+ });
12709
+ };
12747
12710
 
12748
- if (providedEmptyOption) {
12749
- // compile the element since there might be bindings in it
12750
- const linkFn = $compile(selectCtrl.emptyOption);
12751
- assertArg$1(linkFn, "LinkFn required");
12752
- selectElement.prepend(selectCtrl.emptyOption);
12753
- linkFn(scope);
12711
+ selectCtrl.readValue = function readNgOptionsMultiple() {
12712
+ const selectedValues = selectElement.value || [];
12713
+ const selections = [];
12714
+ // @ts-ignore
12715
+ selectedValues.forEach((value) => {
12716
+ const option = options.selectValueMap[value];
12717
+ if (option && !option.disabled)
12718
+ selections.push(options.getViewValueFromOption(option));
12719
+ });
12754
12720
 
12755
- if (selectCtrl.emptyOption.nodeType === Node.COMMENT_NODE) {
12756
- // This means the empty option has currently no actual DOM node, probably because
12757
- // it has been modified by a transclusion directive.
12758
- selectCtrl.hasEmptyOption = false;
12721
+ return selections;
12722
+ };
12759
12723
 
12760
- // Redefine the registerOption function, which will catch
12761
- // options that are added by ngIf etc. (rendering of the node is async because of
12762
- // lazy transclusion)
12763
- selectCtrl.registerOption = function (optionScope, optionEl) {
12764
- if (optionEl.value === "") {
12765
- selectCtrl.hasEmptyOption = true;
12766
- selectCtrl.emptyOption = optionEl;
12767
- // This ensures the new empty option is selected if previously no option was selected
12768
- ngModelCtrl.$render();
12724
+ // If we are using `track by` then we must watch these tracked values on the model
12725
+ // since ngModel only watches for object identity change
12726
+ // if (ngOptions.trackBy) {
12727
+ // scope.$watchCollection(
12728
+ // () => {
12729
+ // if (Array.isArray(ngModelCtrl.$viewValue)) {
12730
+ // return ngModelCtrl.$viewValue.map((value) =>
12731
+ // ngOptions.getTrackByValue(value),
12732
+ // );
12733
+ // }
12734
+ // },
12735
+ // () => {
12736
+ // ngModelCtrl.$render();
12737
+ // },
12738
+ // );
12739
+ // }
12740
+ }
12769
12741
 
12770
- optionEl.addEventListener("$destroy", () => {
12771
- const needsRerender = selectCtrl.$isEmptyOptionSelected();
12742
+ if (providedEmptyOption) {
12743
+ // compile the element since there might be bindings in it
12744
+ const linkFn = $compile(selectCtrl.emptyOption);
12745
+ assertArg$1(linkFn, "LinkFn required");
12746
+ selectElement.prepend(selectCtrl.emptyOption);
12747
+ linkFn(scope);
12748
+
12749
+ if (selectCtrl.emptyOption.nodeType === Node.COMMENT_NODE) {
12750
+ // This means the empty option has currently no actual DOM node, probably because
12751
+ // it has been modified by a transclusion directive.
12752
+ selectCtrl.hasEmptyOption = false;
12753
+
12754
+ // Redefine the registerOption function, which will catch
12755
+ // options that are added by ngIf etc. (rendering of the node is async because of
12756
+ // lazy transclusion)
12757
+ selectCtrl.registerOption = function (optionScope, optionEl) {
12758
+ if (optionEl.value === "") {
12759
+ selectCtrl.hasEmptyOption = true;
12760
+ selectCtrl.emptyOption = optionEl;
12761
+ // This ensures the new empty option is selected if previously no option was selected
12762
+ ngModelCtrl.$render();
12772
12763
 
12773
- selectCtrl.hasEmptyOption = false;
12774
- selectCtrl.emptyOption = undefined;
12764
+ optionEl.addEventListener("$destroy", () => {
12765
+ const needsRerender = selectCtrl.$isEmptyOptionSelected();
12775
12766
 
12776
- if (needsRerender) ngModelCtrl.$render();
12777
- });
12778
- }
12779
- };
12780
- }
12767
+ selectCtrl.hasEmptyOption = false;
12768
+ selectCtrl.emptyOption = undefined;
12769
+
12770
+ if (needsRerender) ngModelCtrl.$render();
12771
+ });
12772
+ }
12773
+ };
12781
12774
  }
12775
+ }
12782
12776
 
12783
- // We will re-render the option elements if the option values or labels change
12777
+ // We will re-render the option elements if the option values or labels change
12784
12778
 
12785
- // let watchables = ngOptions.getWatchables();
12786
- // watchables.forEach((i) => {
12787
- // scope.$watch(i, updateOptions);
12788
- // });
12789
- scope.$watch(
12790
- ngOptions.getWatchables.decoratedNode.body[0].expression.name,
12791
- updateOptions,
12792
- );
12779
+ // let watchables = ngOptions.getWatchables();
12780
+ // watchables.forEach((i) => {
12781
+ // scope.$watch(i, updateOptions);
12782
+ // });
12783
+ scope.$watch(
12784
+ ngOptions.getWatchables.decoratedNode.body[0].expression.name,
12785
+ updateOptions,
12786
+ );
12793
12787
 
12794
- // ------------------------------------------------------------------ //
12788
+ // ------------------------------------------------------------------ //
12795
12789
 
12796
- function addOptionElement(option, parent) {
12797
- /**
12798
- * @type {HTMLOptionElement}
12799
- */
12800
- const optionElement = /** @type {HTMLOptionElement} */ (
12801
- optionTemplate.cloneNode(false)
12802
- );
12803
- parent.appendChild(optionElement);
12804
- updateOptionElement(option, optionElement);
12805
- }
12790
+ function addOptionElement(option, parent) {
12791
+ /**
12792
+ * @type {HTMLOptionElement}
12793
+ */
12794
+ const optionElement = /** @type {HTMLOptionElement} */ (
12795
+ optionTemplate.cloneNode(false)
12796
+ );
12797
+ parent.appendChild(optionElement);
12798
+ updateOptionElement(option, optionElement);
12799
+ }
12806
12800
 
12807
- function getAndUpdateSelectedOption(viewValue) {
12808
- const option = options.getOptionFromViewValue(viewValue);
12809
- const element = option && option.element;
12801
+ function getAndUpdateSelectedOption(viewValue) {
12802
+ const option = options.getOptionFromViewValue(viewValue);
12803
+ const element = option && option.element;
12810
12804
 
12811
- if (element && !element.selected) element.selected = true;
12805
+ if (element && !element.selected) element.selected = true;
12812
12806
 
12813
- return option;
12814
- }
12807
+ return option;
12808
+ }
12815
12809
 
12816
- function updateOptionElement(option, element) {
12817
- option.element = element;
12818
- element.disabled = option.disabled;
12819
- // Support: IE 11 only, Edge 12-13 only
12820
- // NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
12821
- // selects in certain circumstances when multiple selects are next to each other and display
12822
- // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
12823
- // See https://github.com/angular/angular.js/issues/11314 for more info.
12824
- // This is unfortunately untestable with unit / e2e tests
12825
- if (option.label !== element.label) {
12826
- element.label = option.label;
12827
- element.textContent = option.label;
12828
- }
12829
- element.value = option.selectValue;
12810
+ function updateOptionElement(option, element) {
12811
+ option.element = element;
12812
+ element.disabled = option.disabled;
12813
+ // Support: IE 11 only, Edge 12-13 only
12814
+ // NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
12815
+ // selects in certain circumstances when multiple selects are next to each other and display
12816
+ // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
12817
+ // See https://github.com/angular/angular.js/issues/11314 for more info.
12818
+ // This is unfortunately untestable with unit / e2e tests
12819
+ if (option.label !== element.label) {
12820
+ element.label = option.label;
12821
+ element.textContent = option.label;
12830
12822
  }
12823
+ element.value = option.selectValue;
12824
+ }
12831
12825
 
12832
- function updateOptions() {
12833
- const previousValue = options && selectCtrl.readValue();
12826
+ function updateOptions() {
12827
+ const previousValue = options && selectCtrl.readValue();
12834
12828
 
12835
- // We must remove all current options, but cannot simply set innerHTML = null
12836
- // since the providedEmptyOption might have an ngIf on it that inserts comments which we
12837
- // must preserve.
12838
- // Instead, iterate over the current option elements and remove them or their optgroup
12839
- // parents
12840
- if (options) {
12841
- for (let i = options.items.length - 1; i >= 0; i--) {
12842
- const option = options.items[i];
12843
- if (isDefined(option.group)) {
12844
- removeElement(option.element.parentNode);
12845
- } else {
12846
- removeElement(option.element);
12847
- }
12829
+ // We must remove all current options, but cannot simply set innerHTML = null
12830
+ // since the providedEmptyOption might have an ngIf on it that inserts comments which we
12831
+ // must preserve.
12832
+ // Instead, iterate over the current option elements and remove them or their optgroup
12833
+ // parents
12834
+ if (options) {
12835
+ for (let i = options.items.length - 1; i >= 0; i--) {
12836
+ const option = options.items[i];
12837
+ if (isDefined(option.group)) {
12838
+ removeElement(option.element.parentNode);
12839
+ } else {
12840
+ removeElement(option.element);
12848
12841
  }
12849
12842
  }
12843
+ }
12850
12844
 
12851
- options = ngOptions.getOptions();
12845
+ options = ngOptions.getOptions();
12852
12846
 
12853
- const groupElementMap = {};
12847
+ const groupElementMap = {};
12854
12848
 
12855
- options.items.forEach((option) => {
12856
- let groupElement;
12849
+ options.items.forEach((option) => {
12850
+ let groupElement;
12857
12851
 
12858
- if (isDefined(option.group)) {
12859
- // This option is to live in a group
12860
- // See if we have already created this group
12861
- groupElement = groupElementMap[option.group];
12862
-
12863
- if (!groupElement) {
12864
- groupElement = optGroupTemplate.cloneNode(false);
12865
- listFragment.appendChild(groupElement);
12866
-
12867
- // Update the label on the group element
12868
- // "null" is special cased because of Safari
12869
- /** @type {HTMLOptGroupElement} */
12870
- (groupElement).label =
12871
- option.group === null ? "null" : option.group;
12872
-
12873
- // Store it for use later
12874
- groupElementMap[option.group] = groupElement;
12875
- }
12852
+ if (isDefined(option.group)) {
12853
+ // This option is to live in a group
12854
+ // See if we have already created this group
12855
+ groupElement = groupElementMap[option.group];
12876
12856
 
12877
- addOptionElement(option, groupElement);
12878
- } else {
12879
- // This option is not in a group
12880
- addOptionElement(option, listFragment);
12857
+ if (!groupElement) {
12858
+ groupElement = optGroupTemplate.cloneNode(false);
12859
+ listFragment.appendChild(groupElement);
12860
+
12861
+ // Update the label on the group element
12862
+ // "null" is special cased because of Safari
12863
+ /** @type {HTMLOptGroupElement} */
12864
+ (groupElement).label =
12865
+ option.group === null ? "null" : option.group;
12866
+
12867
+ // Store it for use later
12868
+ groupElementMap[option.group] = groupElement;
12881
12869
  }
12882
- });
12883
12870
 
12884
- selectElement.appendChild(listFragment);
12871
+ addOptionElement(option, groupElement);
12872
+ } else {
12873
+ // This option is not in a group
12874
+ addOptionElement(option, listFragment);
12875
+ }
12876
+ });
12885
12877
 
12886
- ngModelCtrl.$render();
12878
+ selectElement.appendChild(listFragment);
12887
12879
 
12888
- // Check to see if the value has changed due to the update to the options
12889
- if (!ngModelCtrl.$isEmpty(previousValue)) {
12890
- const nextValue = selectCtrl.readValue();
12891
- const isNotPrimitive = ngOptions.trackBy || multiple;
12892
- if (
12893
- isNotPrimitive
12894
- ? !equals$1(previousValue, nextValue)
12895
- : previousValue !== nextValue
12896
- ) {
12897
- ngModelCtrl.$setViewValue(nextValue);
12898
- ngModelCtrl.$render();
12899
- }
12880
+ ngModelCtrl.$render();
12881
+
12882
+ // Check to see if the value has changed due to the update to the options
12883
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
12884
+ const nextValue = selectCtrl.readValue();
12885
+ const isNotPrimitive = ngOptions.trackBy || multiple;
12886
+ if (
12887
+ isNotPrimitive
12888
+ ? !equals$1(previousValue, nextValue)
12889
+ : previousValue !== nextValue
12890
+ ) {
12891
+ ngModelCtrl.$setViewValue(nextValue);
12892
+ ngModelCtrl.$render();
12900
12893
  }
12901
12894
  }
12902
12895
  }
12896
+ }
12903
12897
 
12904
- return {
12905
- restrict: "A",
12906
- terminal: true,
12907
- require: ["select", "ngModel"],
12908
- link: {
12909
- pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
12910
- // Deactivate the SelectController.register method to prevent
12911
- // option directives from accidentally registering themselves
12912
- // (and unwanted $destroy handlers etc.)
12913
- ctrls[0].registerOption = () => {};
12914
- },
12915
- post: ngOptionsPostLink,
12898
+ return {
12899
+ restrict: "A",
12900
+ terminal: true,
12901
+ require: ["select", "ngModel"],
12902
+ link: {
12903
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
12904
+ // Deactivate the SelectController.register method to prevent
12905
+ // option directives from accidentally registering themselves
12906
+ // (and unwanted $destroy handlers etc.)
12907
+ ctrls[0].registerOption = () => {};
12916
12908
  },
12917
- };
12918
- },
12919
- ];
12909
+ post: ngOptionsPostLink,
12910
+ },
12911
+ };
12912
+ }
12920
12913
 
12921
12914
  /**
12922
12915
  * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
@@ -12935,113 +12928,114 @@
12935
12928
  * or its value is the same as the name of the attribute then the default slot is used.
12936
12929
  */
12937
12930
  const ngTranscludeMinErr = minErr("ngTransclude");
12938
- const ngTranscludeDirective = [
12939
- "$compile",
12940
12931
 
12941
- /**
12942
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12943
- * @returns {import("../../interface.ts").Directive}
12944
- */
12945
- function ($compile) {
12946
- return {
12947
- compile: function ngTranscludeCompile(tElement) {
12948
- // Remove and cache any original content to act as a fallback
12949
- const fallbackLinkFn = $compile(tElement.childNodes);
12950
- emptyElement(tElement);
12932
+ ngTranscludeDirective.$inject = ["$compile"];
12933
+ /**
12934
+ * @param {import("../../core/compile/compile.js").CompileFn} $compile
12935
+ * @returns {import("../../interface.ts").Directive}
12936
+ */
12937
+ function ngTranscludeDirective($compile) {
12938
+ return {
12939
+ compile: function ngTranscludeCompile(tElement) {
12940
+ // Remove and cache any original content to act as a fallback
12941
+ const fallbackLinkFn = $compile(tElement.childNodes);
12942
+ emptyElement(tElement);
12951
12943
 
12952
- /**
12953
- *
12954
- * @param {import("../../core/scope/scope.js").Scope} $scope
12955
- * @param {Element} $element
12956
- * @param {import("../../core/compile/attributes.js").Attributes} $attrs
12957
- * @param {*} _controller
12958
- * @param {*} $transclude
12959
- */
12960
- function ngTranscludePostLink(
12961
- $scope,
12962
- $element,
12963
- $attrs,
12964
- _controller,
12965
- $transclude,
12966
- ) {
12967
- if (!$transclude) {
12968
- throw ngTranscludeMinErr(
12969
- "orphan",
12970
- "Illegal use of ngTransclude directive in the template! " +
12971
- "No parent directive that requires a transclusion found. " +
12972
- "Element: {0}",
12973
- startingTag($element),
12974
- );
12975
- }
12944
+ /**
12945
+ *
12946
+ * @param {import("../../core/scope/scope.js").Scope} $scope
12947
+ * @param {Element} $element
12948
+ * @param {import("../../core/compile/attributes.js").Attributes} $attrs
12949
+ * @param {*} _controller
12950
+ * @param {*} $transclude
12951
+ */
12952
+ function ngTranscludePostLink(
12953
+ $scope,
12954
+ $element,
12955
+ $attrs,
12956
+ _controller,
12957
+ $transclude,
12958
+ ) {
12959
+ if (!$transclude) {
12960
+ throw ngTranscludeMinErr(
12961
+ "orphan",
12962
+ "Illegal use of ngTransclude directive in the template! " +
12963
+ "No parent directive that requires a transclusion found. " +
12964
+ "Element: {0}",
12965
+ startingTag($element),
12966
+ );
12967
+ }
12976
12968
 
12977
- // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
12978
- if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
12979
- $attrs["ngTransclude"] = "";
12980
- }
12981
- const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
12969
+ // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
12970
+ if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
12971
+ $attrs["ngTransclude"] = "";
12972
+ }
12973
+ const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
12982
12974
 
12983
- // If the slot is required and no transclusion content is provided then this call will throw an error
12984
- $transclude(ngTranscludeCloneAttachFn, null, slotName);
12975
+ // If the slot is required and no transclusion content is provided then this call will throw an error
12976
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
12985
12977
 
12986
- // If the slot is optional and no transclusion content is provided then use the fallback content
12987
- if (slotName && !$transclude.isSlotFilled(slotName)) {
12988
- useFallbackContent();
12989
- }
12978
+ // If the slot is optional and no transclusion content is provided then use the fallback content
12979
+ if (slotName && !$transclude.isSlotFilled(slotName)) {
12980
+ useFallbackContent();
12981
+ }
12990
12982
 
12991
- /**
12992
- * @param {NodeList | Node} clone
12993
- * @param {import("../../core/scope/scope.js").Scope} transcludedScope
12994
- */
12995
- function ngTranscludeCloneAttachFn(clone, transcludedScope) {
12996
- if (notWhitespace(clone)) {
12997
- if (clone instanceof NodeList) {
12998
- Array.from(clone).forEach((el) => {
12999
- $element.append(el);
13000
- });
13001
- } else {
13002
- $element.append(/** @type {Node} */ (clone));
13003
- }
12983
+ /**
12984
+ * @param {NodeList | Node} clone
12985
+ * @param {import("../../core/scope/scope.js").Scope} transcludedScope
12986
+ */
12987
+ function ngTranscludeCloneAttachFn(clone, transcludedScope) {
12988
+ if (notWhitespace(clone)) {
12989
+ if (clone instanceof NodeList) {
12990
+ Array.from(clone).forEach((el) => {
12991
+ $element.append(el);
12992
+ });
13004
12993
  } else {
13005
- useFallbackContent();
13006
- // There is nothing linked against the transcluded scope since no content was available,
13007
- // so it should be safe to clean up the generated scope.
13008
- transcludedScope.$destroy();
12994
+ $element.append(/** @type {Node} */ (clone));
13009
12995
  }
12996
+ } else {
12997
+ useFallbackContent();
12998
+ // There is nothing linked against the transcluded scope since no content was available,
12999
+ // so it should be safe to clean up the generated scope.
13000
+ transcludedScope.$destroy();
13010
13001
  }
13002
+ }
13011
13003
 
13012
- function useFallbackContent() {
13013
- // Since this is the fallback content rather than the transcluded content,
13014
- // we link against the scope of this directive rather than the transcluded scope
13015
- fallbackLinkFn(
13016
- $scope,
13004
+ function useFallbackContent() {
13005
+ // Since this is the fallback content rather than the transcluded content,
13006
+ // we link against the scope of this directive rather than the transcluded scope
13007
+ fallbackLinkFn(
13008
+ $scope,
13017
13009
 
13018
- (clone) => {
13019
- // @ts-ignore
13020
- $element.append(clone);
13021
- },
13022
- );
13023
- }
13010
+ (clone) => {
13011
+ // @ts-ignore
13012
+ $element.append(clone);
13013
+ },
13014
+ );
13015
+ }
13024
13016
 
13025
- function notWhitespace(node) {
13026
- if (node instanceof Array) {
13027
- return false;
13028
- } else if (
13029
- node.nodeType !== Node.TEXT_NODE ||
13030
- node.nodeValue.trim()
13031
- ) {
13032
- return true;
13033
- }
13017
+ function notWhitespace(node) {
13018
+ if (node instanceof Array) {
13019
+ return false;
13020
+ } else if (
13021
+ node.nodeType !== Node.TEXT_NODE ||
13022
+ node.nodeValue.trim()
13023
+ ) {
13024
+ return true;
13034
13025
  }
13035
13026
  }
13027
+ }
13036
13028
 
13037
- return ngTranscludePostLink;
13038
- },
13039
- };
13040
- },
13041
- ];
13029
+ return ngTranscludePostLink;
13030
+ },
13031
+ };
13032
+ }
13042
13033
 
13043
13034
  const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
13044
13035
 
13036
+ /**
13037
+ * @type {Record<string, import("../../interface.js").DirectiveFactory>}
13038
+ */
13045
13039
  const ngAttributeAliasDirectives = {};
13046
13040
 
13047
13041
  // boolean attrs are evaluated
@@ -13084,10 +13078,10 @@
13084
13078
  link(scope, element, attr) {
13085
13079
  // special case ngPattern when a literal regular expression value
13086
13080
  // is used as the expression (this way we don't have to watch anything).
13087
- if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) === "/") {
13088
- const match = attr.ngPattern.match(REGEX_STRING_REGEXP);
13081
+ if (ngAttr === "ngPattern" && attr["ngPattern"].charAt(0) === "/") {
13082
+ const match = attr["ngPattern"].match(REGEX_STRING_REGEXP);
13089
13083
  if (match) {
13090
- attr.$set("ngPattern", new RegExp(match[1], match[2]));
13084
+ attr.$set("ngPattern", new RegExp(match[1], match[2]).toString());
13091
13085
  return;
13092
13086
  }
13093
13087
  }
@@ -13113,7 +13107,7 @@
13113
13107
 
13114
13108
  if (
13115
13109
  attrName === "href" &&
13116
- toString.call(element.href) === "[object SVGAnimatedString]"
13110
+ toString.call(element["href"]) === "[object SVGAnimatedString]"
13117
13111
  ) {
13118
13112
  name = "xlinkHref";
13119
13113
  attr.$attr[name] = "href";
@@ -13499,7 +13493,7 @@
13499
13493
  "$rootScope",
13500
13494
  /**
13501
13495
  *
13502
- * @param {import('../core/location/location.js').Location} $location
13496
+ * @param {import('../services/location/location.js').Location} $location
13503
13497
  * @param {import('../core/scope/scope.js').Scope} $rootScope
13504
13498
  * @returns
13505
13499
  */
@@ -14517,216 +14511,6 @@
14517
14511
  ];
14518
14512
  }
14519
14513
 
14520
- /**
14521
- * Removes a trailing hash ('#') from the given URL if it exists.
14522
- *
14523
- * @param {string} url
14524
- * @returns {string}
14525
- */
14526
- function trimEmptyHash(url) {
14527
- return url.replace(/#$/, "");
14528
- }
14529
-
14530
- /**
14531
- * @typedef {function(string, string|null): any} UrlChangeListener
14532
- */
14533
-
14534
- /**
14535
- * This object has two goals:
14536
- *
14537
- * - hide all the global state in the browser caused by the window object
14538
- * - abstract away all the browser specific features and inconsistencies
14539
- */
14540
- class Browser {
14541
- /**
14542
- * @param {import('../core/task-tracker-factory.js').TaskTracker} taskTracker
14543
- */
14544
- constructor(taskTracker) {
14545
- /**
14546
- * @type {import('../core/task-tracker-factory.js').TaskTracker} taskTracker
14547
- */
14548
- this.taskTracker = taskTracker;
14549
- this.pendingDeferIds = {};
14550
- /** @type {Array<UrlChangeListener>} */
14551
- this.urlChangeListeners = [];
14552
- this.urlChangeInit = false;
14553
-
14554
- /** @type {any} */
14555
- this.cachedState = null;
14556
- /** @type {any} */
14557
- this.lastHistoryState = null;
14558
- /** @type {string} */
14559
- this.lastBrowserUrl = window.location.href;
14560
- /** @type {HTMLBaseElement | null} */
14561
- this.baseElement = document.querySelector("base");
14562
-
14563
- // Task-tracking API
14564
- this.$$completeOutstandingRequest =
14565
- this.taskTracker.completeTask.bind(taskTracker);
14566
- this.$$incOutstandingRequestCount =
14567
- this.taskTracker.incTaskCount.bind(taskTracker);
14568
- this.notifyWhenNoOutstandingRequests =
14569
- this.taskTracker.notifyWhenNoPendingTasks.bind(taskTracker);
14570
-
14571
- this.cacheState();
14572
- }
14573
-
14574
- /// ///////////////////////////////////////////////////////////
14575
- // URL API
14576
- /// ///////////////////////////////////////////////////////////
14577
-
14578
- url(url, state) {
14579
- if (state === undefined) {
14580
- state = null;
14581
- }
14582
-
14583
- // setter
14584
- if (url) {
14585
- url = urlResolve(url).href;
14586
-
14587
- if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
14588
- return this;
14589
- }
14590
-
14591
- this.lastBrowserUrl = url;
14592
- this.lastHistoryState = state;
14593
- history.pushState(state, "", url);
14594
- this.cacheState();
14595
- return this;
14596
- }
14597
-
14598
- // getter
14599
- return trimEmptyHash(window.location.href);
14600
- }
14601
-
14602
- /**
14603
- * Returns the cached state.
14604
- *
14605
- * @returns {any} The cached state.
14606
- */
14607
- state() {
14608
- return this.cachedState;
14609
- }
14610
-
14611
- /**
14612
- * Caches the current state and fires the URL change event.
14613
- *
14614
- * @private
14615
- */
14616
- cacheStateAndFireUrlChange() {
14617
- this.fireStateOrUrlChange();
14618
- }
14619
-
14620
- /**
14621
- * Caches the current state.
14622
- *
14623
- * @private
14624
- */
14625
- cacheState() {
14626
- const currentState = history.state ?? null;
14627
- if (!equals$1(currentState, this.lastCachedState)) {
14628
- this.cachedState = currentState;
14629
- this.lastCachedState = currentState;
14630
- this.lastHistoryState = currentState;
14631
- }
14632
- }
14633
-
14634
- /**
14635
- * Fires the state or URL change event.
14636
- *
14637
- * @private
14638
- */
14639
- fireStateOrUrlChange() {
14640
- const prevLastHistoryState = this.lastHistoryState;
14641
- this.cacheState();
14642
-
14643
- if (
14644
- this.lastBrowserUrl === this.url() &&
14645
- prevLastHistoryState === this.cachedState
14646
- ) {
14647
- return;
14648
- }
14649
-
14650
- this.lastBrowserUrl = /** @type {string} */ (this.url());
14651
- this.lastHistoryState = this.cachedState;
14652
- this.urlChangeListeners.forEach((listener) => {
14653
- listener(trimEmptyHash(window.location.href), this.cachedState);
14654
- });
14655
- }
14656
-
14657
- /**
14658
- * Registers a callback to be called when the URL changes.
14659
- *
14660
- * @param {UrlChangeListener} callback - The callback function to register.
14661
- * @returns {UrlChangeListener} The registered callback function.
14662
- */
14663
- onUrlChange(callback) {
14664
- if (!this.urlChangeInit) {
14665
- window.addEventListener(
14666
- "popstate",
14667
- this.cacheStateAndFireUrlChange.bind(this),
14668
- );
14669
- window.addEventListener(
14670
- "hashchange",
14671
- this.cacheStateAndFireUrlChange.bind(this),
14672
- );
14673
-
14674
- this.urlChangeInit = true;
14675
- }
14676
-
14677
- this.urlChangeListeners.push(callback);
14678
- return callback;
14679
- }
14680
-
14681
- $$applicationDestroyed() {
14682
- window.removeEventListener(
14683
- "popstate",
14684
- this.cacheStateAndFireUrlChange.bind(this),
14685
- );
14686
- window.removeEventListener(
14687
- "hashchange",
14688
- this.cacheStateAndFireUrlChange.bind(this),
14689
- );
14690
- }
14691
-
14692
- $$checkUrlChange() {
14693
- this.fireStateOrUrlChange();
14694
- }
14695
-
14696
- /// ///////////////////////////////////////////////////////////
14697
- // Misc API
14698
- /// ///////////////////////////////////////////////////////////
14699
-
14700
- /**
14701
- * Returns the base href of the document.
14702
- *
14703
- * @returns {string} The base href.
14704
- */
14705
- baseHref() {
14706
- const href = this.baseElement?.getAttribute("href");
14707
- return href ? href.replace(/^(https?:)?\/\/[^/]*/, "") : "";
14708
- }
14709
- }
14710
-
14711
- /**
14712
- * This object has two goals:
14713
- *
14714
- * - hide all the global state in the browser caused by the window object
14715
- * - abstract away all the browser specific features and inconsistencies
14716
- *
14717
- * Remove this in the future
14718
- */
14719
- class BrowserProvider {
14720
- $get = [
14721
- "$$taskTrackerFactory",
14722
- /**
14723
- * @param {import('../core/task-tracker-factory.js').TaskTracker} $$taskTrackerFactory
14724
- * @returns {Browser}
14725
- */
14726
- ($$taskTrackerFactory) => new Browser($$taskTrackerFactory),
14727
- ];
14728
- }
14729
-
14730
14514
  function AnimateAsyncRunFactoryProvider() {
14731
14515
  this.$get = [
14732
14516
  function () {
@@ -14932,7 +14716,9 @@
14932
14716
  /**
14933
14717
  * @returns {import('./interface.ts').TemplateCache}
14934
14718
  */
14935
- $get = () => this.cache;
14719
+ $get() {
14720
+ return this.cache;
14721
+ }
14936
14722
  }
14937
14723
 
14938
14724
  /**
@@ -14979,9 +14765,9 @@
14979
14765
  * @see {@link angular.ErrorHandler AngularTS ErrorHandler}
14980
14766
  */
14981
14767
 
14982
- /** @typedef {import('../services/log/interface.ts').LogService} LogService */
14768
+ /** @typedef {import('../log/interface.ts').LogService} LogService */
14983
14769
 
14984
- /** @typedef {import("./error-handler.ts").ErrorHandler} ErrorHandler */
14770
+ /** @typedef {import("./interface.ts").Interface} ErrorHandler */
14985
14771
 
14986
14772
  /**
14987
14773
  * Provider for `$exceptionHandler` service. Delegates uncaught exceptions to `$log.error()` by default.
@@ -15465,7 +15251,7 @@
15465
15251
  const isFilter = function (state, params, options) {
15466
15252
  return $state.is(state, params, options);
15467
15253
  };
15468
- //isFilter.$stateful = true;
15254
+ isFilter.$stateful = true;
15469
15255
  return isFilter;
15470
15256
  }
15471
15257
  /**
@@ -15486,53 +15272,52 @@
15486
15272
  const includesFilter = function (state, params, options) {
15487
15273
  return $state.includes(state, params, options);
15488
15274
  };
15489
- //includesFilter.$stateful = true;
15275
+ includesFilter.$stateful = true;
15490
15276
  return includesFilter;
15491
15277
  }
15492
15278
 
15493
- FilterProvider.$inject = ["$provide"];
15279
+ const SUFFIX = "Filter";
15494
15280
 
15495
- /**
15496
- * @param {import('../../interface.ts').Provider} $provide
15497
- */
15498
- function FilterProvider($provide) {
15499
- const suffix = "Filter";
15281
+ class FilterProvider {
15282
+ static $inject = [$injectTokens.$provide];
15283
+
15284
+ /**
15285
+ * @param {import('../../interface.ts').Provider} $provide
15286
+ */
15287
+ constructor($provide) {
15288
+ this.$provide = $provide;
15289
+ this.register({
15290
+ filter: filterFilter,
15291
+ json: jsonFilter,
15292
+ limitTo: limitToFilter,
15293
+ orderBy: orderByFilter,
15294
+ isState: $IsStateFilter,
15295
+ includedByState: $IncludedByStateFilter,
15296
+ });
15297
+ }
15500
15298
 
15501
15299
  /**
15502
15300
  * @param {string|Record<string, import('../../interface.ts').FilterFactory>} name
15503
- * @param {import('../../interface.ts').FilterFactory} factory
15504
- * @return {import('../../interface.ts').ServiceProvider}
15301
+ * @param {import('../../interface.ts').FilterFactory} [factory]
15302
+ * @return {import('../../interface.ts').Provider}
15505
15303
  */
15506
- function register(name, factory) {
15304
+ register(name, factory) {
15507
15305
  if (isObject(name)) {
15508
15306
  Object.entries(name).forEach(([key, filter]) => {
15509
- register(key, filter);
15307
+ this.register(key, filter);
15510
15308
  });
15511
15309
  }
15512
- return $provide.factory(name + suffix, factory);
15310
+ return this.$provide.factory(name + SUFFIX, factory);
15513
15311
  }
15514
15312
 
15515
- this.register = register;
15516
-
15517
- this.$get = [
15518
- "$injector",
15313
+ $get = [
15314
+ $injectTokens.$injector,
15519
15315
  /**
15520
15316
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
15521
- * @returns
15317
+ * @returns {import('../../interface.ts').FilterFn}
15522
15318
  */
15523
- function ($injector) {
15524
- return function (name) {
15525
- return $injector.get(name + suffix);
15526
- };
15527
- },
15319
+ ($injector) => (/** @type {string} */ name) => $injector.get(name + SUFFIX),
15528
15320
  ];
15529
-
15530
- register("filter", filterFilter);
15531
- register("json", jsonFilter);
15532
- register("limitTo", limitToFilter);
15533
- register("orderBy", orderByFilter);
15534
- register("isState", $IsStateFilter);
15535
- register("includedByState", $IncludedByStateFilter);
15536
15321
  }
15537
15322
 
15538
15323
  const PURITY_ABSOLUTE = 1;
@@ -15671,7 +15456,7 @@
15671
15456
  if (ast.filter) right = this.$filter(ast.callee.name);
15672
15457
  if (!ast.filter) right = this.recurse(ast.callee, true);
15673
15458
  return ast.filter
15674
- ? function (scope, locals, assign) {
15459
+ ? (scope, locals, assign) => {
15675
15460
  const values = [];
15676
15461
  for (let i = 0; i < args.length; ++i) {
15677
15462
  const res = args[i](scope, locals, assign);
@@ -15684,7 +15469,7 @@
15684
15469
  ? { context: undefined, name: undefined, value }
15685
15470
  : value;
15686
15471
  }
15687
- : function (scope, locals, assign) {
15472
+ : (scope, locals, assign) => {
15688
15473
  const rhs = right(scope, locals, assign);
15689
15474
  let value;
15690
15475
  if (rhs.value != null && isFunction(rhs.value)) {
@@ -15700,7 +15485,7 @@
15700
15485
  case ASTType.AssignmentExpression:
15701
15486
  left = this.recurse(ast.left, true, 1);
15702
15487
  right = this.recurse(ast.right);
15703
- return function (scope, locals, assign) {
15488
+ return (scope, locals, assign) => {
15704
15489
  const lhs = left(scope, locals, assign);
15705
15490
  const rhs = right(scope, locals, assign);
15706
15491
  lhs.context[lhs.name] = rhs;
@@ -15711,7 +15496,7 @@
15711
15496
  ast.elements.forEach((expr) => {
15712
15497
  args.push(self.recurse(expr));
15713
15498
  });
15714
- return function (scope, locals, assign) {
15499
+ return (scope, locals, assign) => {
15715
15500
  const value = [];
15716
15501
  for (let i = 0; i < args.length; ++i) {
15717
15502
  value.push(args[i](scope, locals, assign));
@@ -15738,7 +15523,7 @@
15738
15523
  });
15739
15524
  }
15740
15525
  });
15741
- return function (scope, locals, assign) {
15526
+ return (scope, locals, assign) => {
15742
15527
  const value = {};
15743
15528
  for (let i = 0; i < args.length; ++i) {
15744
15529
  if (args[i].computed) {
@@ -15754,17 +15539,12 @@
15754
15539
  return context ? { value } : value;
15755
15540
  };
15756
15541
  case ASTType.ThisExpression:
15757
- return function (scope) {
15758
- return context ? { value: scope } : scope;
15759
- };
15542
+ return (scope) => (context ? { value: scope } : scope);
15760
15543
  case ASTType.LocalsExpression:
15761
- return function (scope, locals) {
15762
- return context ? { value: locals } : locals;
15763
- };
15544
+ return (scope, locals) => (context ? { value: locals } : locals);
15764
15545
  case ASTType.NGValueParameter:
15765
- return function (scope, locals, assign) {
15766
- return context ? { value: assign } : assign;
15767
- };
15546
+ return (scope, locals, assign) =>
15547
+ context ? { value: assign } : assign;
15768
15548
  }
15769
15549
  }
15770
15550
 
@@ -15775,7 +15555,7 @@
15775
15555
  * @returns {function} The unary plus function.
15776
15556
  */
15777
15557
  "unary+"(argument, context) {
15778
- return function (scope, locals, assign) {
15558
+ return (scope, locals, assign) => {
15779
15559
  let arg = argument(scope, locals, assign);
15780
15560
  if (isDefined(arg)) {
15781
15561
  arg = +arg;
@@ -15793,7 +15573,7 @@
15793
15573
  * @returns {function} The unary minus function.
15794
15574
  */
15795
15575
  "unary-"(argument, context) {
15796
- return function (scope, locals, assign) {
15576
+ return (scope, locals, assign) => {
15797
15577
  let arg = argument(scope, locals, assign);
15798
15578
  if (isDefined(arg)) {
15799
15579
  arg = -arg;
@@ -15811,7 +15591,7 @@
15811
15591
  * @returns {function} The unary negation function.
15812
15592
  */
15813
15593
  "unary!"(argument, context) {
15814
- return function (scope, locals, assign) {
15594
+ return (scope, locals, assign) => {
15815
15595
  const arg = !argument(scope, locals, assign);
15816
15596
  return context ? { value: arg } : arg;
15817
15597
  };
@@ -15825,7 +15605,7 @@
15825
15605
  * @returns {function} The binary plus function.
15826
15606
  */
15827
15607
  "binary+"(left, right, context) {
15828
- return function (scope, locals, assign) {
15608
+ return (scope, locals, assign) => {
15829
15609
  const lhs = left(scope, locals, assign);
15830
15610
  const rhs = right(scope, locals, assign);
15831
15611
  const arg = plusFn(lhs, rhs);
@@ -15841,7 +15621,7 @@
15841
15621
  * @returns {function} The binary minus function.
15842
15622
  */
15843
15623
  "binary-"(left, right, context) {
15844
- return function (scope, locals, assign) {
15624
+ return (scope, locals, assign) => {
15845
15625
  const lhs = left(scope, locals, assign);
15846
15626
  const rhs = right(scope, locals, assign);
15847
15627
  const arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
@@ -15857,14 +15637,14 @@
15857
15637
  * @returns {function} The binary multiplication function.
15858
15638
  */
15859
15639
  "binary*"(left, right, context) {
15860
- return function (scope, locals, assign) {
15640
+ return (scope, locals, assign) => {
15861
15641
  const arg = left(scope, locals, assign) * right(scope, locals, assign);
15862
15642
  return context ? { value: arg } : arg;
15863
15643
  };
15864
15644
  }
15865
15645
 
15866
15646
  "binary/"(left, right, context) {
15867
- return function (scope, locals, assign) {
15647
+ return (scope, locals, assign) => {
15868
15648
  const arg = left(scope, locals, assign) / right(scope, locals, assign);
15869
15649
  return context ? { value: arg } : arg;
15870
15650
  };
@@ -15878,7 +15658,7 @@
15878
15658
  * @returns {function} The binary division function.
15879
15659
  */
15880
15660
  "binary%"(left, right, context) {
15881
- return function (scope, locals, assign) {
15661
+ return (scope, locals, assign) => {
15882
15662
  const arg = left(scope, locals, assign) % right(scope, locals, assign);
15883
15663
  return context ? { value: arg } : arg;
15884
15664
  };
@@ -15892,7 +15672,7 @@
15892
15672
  * @returns {function} The binary strict equality function.
15893
15673
  */
15894
15674
  "binary==="(left, right, context) {
15895
- return function (scope, locals, assign) {
15675
+ return (scope, locals, assign) => {
15896
15676
  const arg = left(scope, locals, assign) === right(scope, locals, assign);
15897
15677
  return context ? { value: arg } : arg;
15898
15678
  };
@@ -15906,7 +15686,7 @@
15906
15686
  * @returns {function} The binary strict inequality function.
15907
15687
  */
15908
15688
  "binary!=="(left, right, context) {
15909
- return function (scope, locals, assign) {
15689
+ return (scope, locals, assign) => {
15910
15690
  const arg = left(scope, locals, assign) !== right(scope, locals, assign);
15911
15691
  return context ? { value: arg } : arg;
15912
15692
  };
@@ -15920,7 +15700,7 @@
15920
15700
  * @returns {function} The binary equality function.
15921
15701
  */
15922
15702
  "binary=="(left, right, context) {
15923
- return function (scope, locals, assign) {
15703
+ return (scope, locals, assign) => {
15924
15704
  const arg = left(scope, locals, assign) == right(scope, locals, assign);
15925
15705
  return context ? { value: arg } : arg;
15926
15706
  };
@@ -15934,7 +15714,7 @@
15934
15714
  * @returns {function} The binary inequality function.
15935
15715
  */
15936
15716
  "binary!="(left, right, context) {
15937
- return function (scope, locals, assign) {
15717
+ return (scope, locals, assign) => {
15938
15718
  const arg = left(scope, locals, assign) != right(scope, locals, assign);
15939
15719
  return context ? { value: arg } : arg;
15940
15720
  };
@@ -15948,7 +15728,7 @@
15948
15728
  * @returns {function} The binary less-than function.
15949
15729
  */
15950
15730
  "binary<"(left, right, context) {
15951
- return function (scope, locals, assign) {
15731
+ return (scope, locals, assign) => {
15952
15732
  const arg = left(scope, locals, assign) < right(scope, locals, assign);
15953
15733
  return context ? { value: arg } : arg;
15954
15734
  };
@@ -15962,7 +15742,7 @@
15962
15742
  * @returns {function} The binary greater-than function.
15963
15743
  */
15964
15744
  "binary>"(left, right, context) {
15965
- return function (scope, locals, assign) {
15745
+ return (scope, locals, assign) => {
15966
15746
  const arg = left(scope, locals, assign) > right(scope, locals, assign);
15967
15747
  return context ? { value: arg } : arg;
15968
15748
  };
@@ -15976,7 +15756,7 @@
15976
15756
  * @returns {function} The binary less-than-or-equal-to function.
15977
15757
  */
15978
15758
  "binary<="(left, right, context) {
15979
- return function (scope, locals, assign) {
15759
+ return (scope, locals, assign) => {
15980
15760
  const arg = left(scope, locals, assign) <= right(scope, locals, assign);
15981
15761
  return context ? { value: arg } : arg;
15982
15762
  };
@@ -15990,7 +15770,7 @@
15990
15770
  * @returns {function} The binary greater-than-or-equal-to function.
15991
15771
  */
15992
15772
  "binary>="(left, right, context) {
15993
- return function (scope, locals, assign) {
15773
+ return (scope, locals, assign) => {
15994
15774
  const arg = left(scope, locals, assign) >= right(scope, locals, assign);
15995
15775
  return context ? { value: arg } : arg;
15996
15776
  };
@@ -16017,7 +15797,7 @@
16017
15797
  * @returns {function} The binary logical OR function.
16018
15798
  */
16019
15799
  "binary||"(left, right, context) {
16020
- return function (scope, locals, assign) {
15800
+ return (scope, locals, assign) => {
16021
15801
  const arg = left(scope, locals, assign) || right(scope, locals, assign);
16022
15802
  return context ? { value: arg } : arg;
16023
15803
  };
@@ -16032,7 +15812,7 @@
16032
15812
  * @returns {function} The ternary conditional function.
16033
15813
  */
16034
15814
  "ternary?:"(test, alternate, consequent, context) {
16035
- return function (scope, locals, assign) {
15815
+ return (scope, locals, assign) => {
16036
15816
  const arg = test(scope, locals, assign)
16037
15817
  ? alternate(scope, locals, assign)
16038
15818
  : consequent(scope, locals, assign);
@@ -16047,9 +15827,8 @@
16047
15827
  * @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the literal value.
16048
15828
  */
16049
15829
  value(value, context) {
16050
- return function () {
16051
- return context ? { context: undefined, name: undefined, value } : value;
16052
- };
15830
+ return () =>
15831
+ context ? { context: undefined, name: undefined, value } : value;
16053
15832
  }
16054
15833
 
16055
15834
  /**
@@ -16060,7 +15839,7 @@
16060
15839
  * @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the identifier value.
16061
15840
  */
16062
15841
  identifier(name, context, create) {
16063
- return function (scope, locals) {
15842
+ return (scope, locals) => {
16064
15843
  const base = locals && name in locals ? locals : scope;
16065
15844
  if (create && create !== 1 && base && base[name] == null) {
16066
15845
  base[name] = {};
@@ -16085,7 +15864,7 @@
16085
15864
  * @returns {function} The function returning the computed member value.
16086
15865
  */
16087
15866
  computedMember(left, right, context, create) {
16088
- return function (scope, locals, assign) {
15867
+ return (scope, locals, assign) => {
16089
15868
  const lhs = left(scope, locals, assign);
16090
15869
  let rhs;
16091
15870
  let value;
@@ -16115,7 +15894,7 @@
16115
15894
  * @returns {function} The function returning the non-computed member value.
16116
15895
  */
16117
15896
  nonComputedMember(left, right, context, create) {
16118
- return function (scope, locals, assign) {
15897
+ return (scope, locals, assign) => {
16119
15898
  const lhs = left(scope, locals, assign);
16120
15899
  if (create && create !== 1) {
16121
15900
  if (lhs && lhs[right] == null) {
@@ -18536,21 +18315,17 @@
18536
18315
  });
18537
18316
 
18538
18317
  this.$get = [
18539
- "$browser",
18540
18318
  "$httpBackend",
18541
- "$rootScope",
18542
18319
  "$injector",
18543
18320
  "$sce",
18544
18321
  /**
18545
18322
  *
18546
- * @param {*} $browser
18547
18323
  * @param {*} $httpBackend
18548
- * @param {import("../../core/scope/scope.js").Scope} $rootScope
18549
18324
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
18550
18325
  * @param {*} $sce
18551
18326
  * @returns
18552
18327
  */
18553
- function ($browser, $httpBackend, $rootScope, $injector, $sce) {
18328
+ function ($httpBackend, $injector, $sce) {
18554
18329
  /**
18555
18330
  * @type {Map<string, string>}
18556
18331
  */
@@ -18620,8 +18395,6 @@
18620
18395
  ? $injector.get(config.paramSerializer)
18621
18396
  : config.paramSerializer;
18622
18397
 
18623
- $browser.$$incOutstandingRequestCount("$http");
18624
-
18625
18398
  const requestInterceptors = [];
18626
18399
  const responseInterceptors = [];
18627
18400
  let promise = Promise.resolve(config);
@@ -18645,7 +18418,6 @@
18645
18418
  promise = chainInterceptors(promise, requestInterceptors);
18646
18419
  promise = promise.then(serverRequest);
18647
18420
  promise = chainInterceptors(promise, responseInterceptors);
18648
- promise = promise.finally(completeOutstandingRequest);
18649
18421
 
18650
18422
  return promise;
18651
18423
 
@@ -18662,10 +18434,6 @@
18662
18434
  return promise;
18663
18435
  }
18664
18436
 
18665
- function completeOutstandingRequest() {
18666
- $browser.$$completeOutstandingRequest(() => {}, "$http");
18667
- }
18668
-
18669
18437
  function executeHeaderFns(headers, config) {
18670
18438
  let headerContent;
18671
18439
  const processedHeaders = {};
@@ -19104,24 +18872,14 @@
19104
18872
  */
19105
18873
  class HttpBackendProvider {
19106
18874
  constructor() {
19107
- this.$get = [
19108
- "$browser",
19109
- /**
19110
- * @param {import('../browser.js').Browser} $browser
19111
- * @returns
19112
- */
19113
- function ($browser) {
19114
- return createHttpBackend($browser);
19115
- },
19116
- ];
18875
+ this.$get = [() => createHttpBackend()];
19117
18876
  }
19118
18877
  }
19119
18878
 
19120
18879
  /**
19121
- * @param {import('../browser.js').Browser} $browser
19122
18880
  * @returns
19123
18881
  */
19124
- function createHttpBackend($browser) {
18882
+ function createHttpBackend() {
19125
18883
  // TODO(vojta): fix the signature
19126
18884
  return function (
19127
18885
  method,
@@ -19135,7 +18893,7 @@
19135
18893
  eventHandlers,
19136
18894
  uploadEventHandlers,
19137
18895
  ) {
19138
- url = url || $browser.url();
18896
+ url = url || trimEmptyHash(window.location.href);
19139
18897
 
19140
18898
  const xhr = new XMLHttpRequest();
19141
18899
  let abortedByTimeout = false;
@@ -19343,7 +19101,7 @@
19343
19101
  */
19344
19102
  this.$$replace = false;
19345
19103
 
19346
- /** @type {import('../url-utils/url-utils').HttpProtocol} */
19104
+ /** @type {string} */
19347
19105
  this.$$protocol = parsedUrl.protocol;
19348
19106
 
19349
19107
  /** @type {string} */
@@ -19410,7 +19168,7 @@
19410
19168
  /**
19411
19169
  *
19412
19170
  * Return protocol of current URL.
19413
- * @return {import("../url-utils/url-utils").HttpProtocol} protocol of current URL
19171
+ * @return {string} protocol of current URL
19414
19172
  */
19415
19173
  protocol() {
19416
19174
  return this.$$protocol;
@@ -19711,12 +19469,13 @@
19711
19469
  * This object is exposed as $location service when developer doesn't opt into html5 mode.
19712
19470
  * It also serves as the base class for html5 mode fallback on legacy browsers.
19713
19471
  *
19714
- * @constructor
19715
- * @param {string} appBase application base URL
19716
- * @param {string} appBaseNoFile application base URL stripped of any filename
19717
- * @param {string} hashPrefix hashbang prefix
19718
19472
  */
19719
19473
  class LocationHashbangUrl extends Location {
19474
+ /**
19475
+ * @param {string} appBase application base URL
19476
+ * @param {string} appBaseNoFile application base URL stripped of any filename
19477
+ * @param {string} hashPrefix hashbang prefix
19478
+ */
19720
19479
  constructor(appBase, appBaseNoFile, hashPrefix) {
19721
19480
  super(appBase, appBaseNoFile);
19722
19481
  this.hashPrefix = hashPrefix;
@@ -19827,6 +19586,111 @@
19827
19586
  requireBase: true,
19828
19587
  rewriteLinks: true,
19829
19588
  };
19589
+
19590
+ /** @type {Array<import("./interface.js").UrlChangeListener>} */
19591
+ this.urlChangeListeners = [];
19592
+ this.urlChangeInit = false;
19593
+
19594
+ /** @type {History['state']} */
19595
+ this.cachedState = null;
19596
+ /** @typeof {History.state} */
19597
+ this.lastHistoryState = null;
19598
+ /** @type {string} */
19599
+ this.lastBrowserUrl = window.location.href;
19600
+ this.cacheState();
19601
+ }
19602
+
19603
+ /// ///////////////////////////////////////////////////////////
19604
+ // URL API
19605
+ /// ///////////////////////////////////////////////////////////
19606
+
19607
+ setUrl(url, state) {
19608
+ if (state === undefined) {
19609
+ state = null;
19610
+ }
19611
+
19612
+ // setter
19613
+ if (url) {
19614
+ url = urlResolve(url).href;
19615
+
19616
+ if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
19617
+ return this;
19618
+ }
19619
+
19620
+ this.lastBrowserUrl = url;
19621
+ this.lastHistoryState = state;
19622
+ history.pushState(state, "", url);
19623
+ this.cacheState();
19624
+ }
19625
+ }
19626
+
19627
+ /**
19628
+ * Returns the current URL with any empty hash (`#`) removed.
19629
+ * @return {string}
19630
+ */
19631
+ getUrl() {
19632
+ return trimEmptyHash(window.location.href);
19633
+ }
19634
+
19635
+ /**
19636
+ * Returns the cached state.
19637
+ * @returns {History['state']} The cached state.
19638
+ */
19639
+ state() {
19640
+ return this.cachedState;
19641
+ }
19642
+
19643
+ /**
19644
+ * Caches the current state.
19645
+ *
19646
+ * @private
19647
+ */
19648
+ cacheState() {
19649
+ const currentState = history.state ?? null;
19650
+ if (!equals$1(currentState, this.lastCachedState)) {
19651
+ this.cachedState = currentState;
19652
+ this.lastCachedState = currentState;
19653
+ this.lastHistoryState = currentState;
19654
+ }
19655
+ }
19656
+
19657
+ /**
19658
+ * Fires the state or URL change event.
19659
+ *
19660
+ * @private
19661
+ */
19662
+ fireStateOrUrlChange() {
19663
+ const prevLastHistoryState = this.lastHistoryState;
19664
+ this.cacheState();
19665
+ if (
19666
+ this.lastBrowserUrl === this.getUrl() &&
19667
+ prevLastHistoryState === this.cachedState
19668
+ ) {
19669
+ return;
19670
+ }
19671
+ this.lastBrowserUrl = this.getUrl();
19672
+ this.lastHistoryState = this.cachedState;
19673
+ this.urlChangeListeners.forEach((listener) => {
19674
+ listener(trimEmptyHash(window.location.href), this.cachedState);
19675
+ });
19676
+ }
19677
+
19678
+ /**
19679
+ * Registers a callback to be called when the URL changes.
19680
+ *
19681
+ * @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
19682
+ * @returns void
19683
+ */
19684
+ onUrlChange(callback) {
19685
+ if (!this.urlChangeInit) {
19686
+ window.addEventListener("popstate", this.fireStateOrUrlChange.bind(this));
19687
+ window.addEventListener(
19688
+ "hashchange",
19689
+ this.fireStateOrUrlChange.bind(this),
19690
+ );
19691
+ this.urlChangeInit = true;
19692
+ }
19693
+ this.urlChangeListeners.push(callback);
19830
19694
  }
19831
19695
 
19832
19696
  /**
@@ -19888,21 +19752,19 @@
19888
19752
 
19889
19753
  $get = [
19890
19754
  "$rootScope",
19891
- "$browser",
19892
19755
  "$rootElement",
19893
19756
  /**
19894
19757
  *
19895
- * @param {import('../scope/scope.js').Scope} $rootScope
19896
- * @param {import('../../services/browser').Browser} $browser
19758
+ * @param {import('../../core/scope/scope.js').Scope} $rootScope
19897
19759
  * @param {Element} $rootElement
19898
19760
  * @returns
19899
19761
  */
19900
- ($rootScope, $browser, $rootElement) => {
19762
+ ($rootScope, $rootElement) => {
19901
19763
  /** @type {Location} */
19902
19764
  let $location;
19903
19765
  let LocationMode;
19904
- const baseHref = $browser.baseHref(); // if base[href] is undefined, it defaults to ''
19905
- const initialUrl = /** @type {string} */ ($browser.url());
19766
+ const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
19767
+ const initialUrl = trimEmptyHash(window.location.href);
19906
19768
  let appBase;
19907
19769
 
19908
19770
  if (this.getHtml5Mode().enabled) {
@@ -19927,20 +19789,20 @@
19927
19789
  );
19928
19790
  $location.$$parseLinkUrl(initialUrl, initialUrl);
19929
19791
 
19930
- $location.$$state = $browser.state();
19792
+ $location.$$state = this.state();
19931
19793
 
19932
19794
  const IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
19933
19795
 
19934
- function setBrowserUrlWithFallback(url, state) {
19796
+ const setBrowserUrlWithFallback = (url, state) => {
19935
19797
  const oldUrl = $location.url();
19936
19798
  const oldState = $location.$$state;
19937
19799
  try {
19938
- $browser.url(url, state);
19800
+ this.setUrl(url, state);
19939
19801
 
19940
19802
  // Make sure $location.state() returns referentially identical (not just deeply equal)
19941
19803
  // state object; this makes possible quick checking if the state changed in the digest
19942
19804
  // loop. Checking deep equality would be too expensive.
19943
- $location.$$state = $browser.state();
19805
+ $location.$$state = this.state();
19944
19806
  } catch (e) {
19945
19807
  // Restore old values if pushState fails
19946
19808
  $location.url(/** @type {string} */ (oldUrl));
@@ -19948,7 +19810,7 @@
19948
19810
 
19949
19811
  throw e;
19950
19812
  }
19951
- }
19813
+ };
19952
19814
 
19953
19815
  $rootElement.addEventListener(
19954
19816
  "click",
@@ -20016,10 +19878,6 @@
20016
19878
  // in html5mode and also without, so that we are able to abort navigation without
20017
19879
  // getting double entries in the location history.
20018
19880
  event.preventDefault();
20019
- // update location manually
20020
- // if ($location.absUrl() !== $browser.url()) {
20021
- // $rootScope.$apply();
20022
- // }
20023
19881
  }
20024
19882
  }
20025
19883
  },
@@ -20027,13 +19885,13 @@
20027
19885
 
20028
19886
  // rewrite hashbang url <> html5 url
20029
19887
  if ($location.absUrl() !== initialUrl) {
20030
- $browser.url($location.absUrl(), true);
19888
+ this.setUrl($location.absUrl(), true);
20031
19889
  }
20032
19890
 
20033
19891
  let initializing = true;
20034
19892
 
20035
19893
  // update $location when $browser url changes
20036
- $browser.onUrlChange((newUrl, newState) => {
19894
+ this.onUrlChange((newUrl, newState) => {
20037
19895
  if (!startsWith(newUrl, appBaseNoFile)) {
20038
19896
  // If we are navigating outside of the app then force a reload
20039
19897
  window.location.href = newUrl;
@@ -20075,9 +19933,9 @@
20075
19933
  if (initializing || $location.$$urlUpdatedByLocation) {
20076
19934
  $location.$$urlUpdatedByLocation = false;
20077
19935
 
20078
- const oldUrl = /** @type {string} */ ($browser.url());
19936
+ const oldUrl = /** @type {string} */ (this.getUrl());
20079
19937
  const newUrl = $location.absUrl();
20080
- const oldState = $browser.state();
19938
+ const oldState = this.state();
20081
19939
  const urlOrStateChanged =
20082
19940
  !urlsEqual(oldUrl, newUrl) ||
20083
19941
  ($location.$$html5 && oldState !== $location.$$state);
@@ -20336,7 +20194,7 @@
20336
20194
  */
20337
20195
  let $parse;
20338
20196
 
20339
- /**@type {import('../exception-handler.js').ErrorHandler} */
20197
+ /**@type {import('../../services/exception/exception-handler.js').ErrorHandler} */
20340
20198
  let $exceptionHandler;
20341
20199
 
20342
20200
  /**
@@ -20357,7 +20215,7 @@
20357
20215
  "$exceptionHandler",
20358
20216
  "$parse",
20359
20217
  /**
20360
- * @param {import('../exception-handler.js').ErrorHandler} exceptionHandler
20218
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} exceptionHandler
20361
20219
  * @param {import('../parse/interface.ts').ParseService} parse
20362
20220
  */
20363
20221
  (exceptionHandler, parse) => {
@@ -21554,152 +21412,6 @@
21554
21412
  return ids;
21555
21413
  }
21556
21414
 
21557
- /** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider */
21558
- /** @typedef {import('../interface.ts').AnnotatedFactory} AnnotatedFactory */
21559
-
21560
- /**
21561
- * @implements {ServiceProvider}
21562
- */
21563
- class TaskTrackerFactoryProvider {
21564
- /** @type {AnnotatedFactory} */
21565
- $get = [
21566
- "$log",
21567
- /**
21568
- * Creates a new `TaskTracker` instance.
21569
- *
21570
- * @param {import('../services/log/interface.ts').LogService} log - The logging service.
21571
- * @returns {TaskTracker} A new `TaskTracker` instance.
21572
- */
21573
- (log) => new TaskTracker(log),
21574
- ];
21575
- }
21576
-
21577
- /**
21578
- * A factory function to create `TaskTracker` instances.
21579
- *
21580
- * A `TaskTracker` tracks pending tasks (grouped by type) and notifies interested
21581
- * parties when all pending tasks (or tasks of a specific type) have been completed.
21582
- */
21583
- class TaskTracker {
21584
- /**
21585
- * @param {import('../services/log/interface.ts').LogService} log - The logging service.
21586
- */
21587
- constructor(log) {
21588
- /** @private */
21589
- this.log = log;
21590
-
21591
- /** @private */
21592
- this.taskCounts = {};
21593
-
21594
- /** @private */
21595
- this.taskCallbacks = [];
21596
-
21597
- /**
21598
- * Special task types used for tracking all tasks and default tasks.
21599
- * @type {string}
21600
- */
21601
- this.ALL_TASKS_TYPE = "$$all$$";
21602
-
21603
- /**
21604
- * Default task type.
21605
- * @type {string}
21606
- */
21607
- this.DEFAULT_TASK_TYPE = "$$default$$";
21608
- }
21609
-
21610
- /**
21611
- * Completes a task and decrements the associated task counter.
21612
- * If the counter reaches 0, all corresponding callbacks are executed.
21613
- *
21614
- * @param {Function} fn - The function to execute when completing the task.
21615
- * @param {string} [taskType=this.DEFAULT_TASK_TYPE] - The type of task being completed.
21616
- */
21617
- completeTask(fn, taskType = this.DEFAULT_TASK_TYPE) {
21618
- try {
21619
- fn();
21620
- } finally {
21621
- if (this.taskCounts[taskType]) {
21622
- this.taskCounts[taskType]--;
21623
- this.taskCounts[this.ALL_TASKS_TYPE]--;
21624
- }
21625
-
21626
- const countForType = this.taskCounts[taskType];
21627
- const countForAll = this.taskCounts[this.ALL_TASKS_TYPE];
21628
-
21629
- // If either the overall task queue or the specific task type queue is empty, run callbacks.
21630
- if (!countForAll || !countForType) {
21631
- const getNextCallback = !countForAll
21632
- ? this.getLastCallback.bind(this)
21633
- : () => this.getLastCallbackForType(taskType);
21634
-
21635
- let nextCb;
21636
- while ((nextCb = getNextCallback())) {
21637
- try {
21638
- nextCb();
21639
- } catch (e) {
21640
- this.log.error(e);
21641
- }
21642
- }
21643
- }
21644
- }
21645
- }
21646
-
21647
- /**
21648
- * Increments the task count for the specified task type.
21649
- *
21650
- * @param {string} [taskType=this.DEFAULT_TASK_TYPE] - The type of task whose count will be increased.
21651
- */
21652
- incTaskCount(taskType = this.DEFAULT_TASK_TYPE) {
21653
- this.taskCounts[taskType] = (this.taskCounts[taskType] || 0) + 1;
21654
- this.taskCounts[this.ALL_TASKS_TYPE] =
21655
- (this.taskCounts[this.ALL_TASKS_TYPE] || 0) + 1;
21656
- }
21657
-
21658
- /**
21659
- * Registers a callback to be executed when all pending tasks of the specified type are completed.
21660
- * If there are no pending tasks of the specified type, the callback is executed immediately.
21661
- *
21662
- * @param {Function} callback - The function to execute when no pending tasks remain.
21663
- * @param {string} [taskType=this.ALL_TASKS_TYPE] - The type of tasks to wait for completion.
21664
- */
21665
- notifyWhenNoPendingTasks(callback, taskType = this.ALL_TASKS_TYPE) {
21666
- if (!this.taskCounts[taskType]) {
21667
- callback();
21668
- } else {
21669
- this.taskCallbacks.push({ type: taskType, cb: callback });
21670
- }
21671
- }
21672
-
21673
- /**
21674
- * Retrieves and removes the last registered callback from the queue.
21675
- *
21676
- * @private
21677
- * @returns {Function|undefined} The last callback function or undefined if none exist.
21678
- */
21679
- getLastCallback() {
21680
- const cbInfo = this.taskCallbacks.pop();
21681
- return cbInfo ? cbInfo.cb : undefined;
21682
- }
21683
-
21684
- /**
21685
- * Retrieves and removes the last registered callback for the specified task type.
21686
- *
21687
- * @private
21688
- * @param {string} taskType - The type of task for which the callback was registered.
21689
- * @returns {Function|undefined} The last callback function for the task type, or undefined if none exist.
21690
- */
21691
- getLastCallbackForType(taskType) {
21692
- for (let i = this.taskCallbacks.length - 1; i >= 0; --i) {
21693
- const cbInfo = this.taskCallbacks[i];
21694
- if (cbInfo.type === taskType) {
21695
- this.taskCallbacks.splice(i, 1);
21696
- return cbInfo.cb;
21697
- }
21698
- }
21699
- return undefined;
21700
- }
21701
- }
21702
-
21703
21415
  const $templateRequestMinErr = minErr("$templateRequest");
21704
21416
 
21705
21417
  /**
@@ -21759,7 +21471,7 @@
21759
21471
  "$sce",
21760
21472
  /**
21761
21473
  *
21762
- * @param {import('../core/exception-handler.js').ErrorHandler} $exceptionHandler
21474
+ * @param {import('./exception/exception-handler.js').ErrorHandler} $exceptionHandler
21763
21475
  * @param {import('../services/template-cache/interface.ts').TemplateCache} $templateCache
21764
21476
  * @param {import("interface.ts").HttpService} $http
21765
21477
  * @param {*} $sce
@@ -21774,6 +21486,7 @@
21774
21486
  // resources for keys that already are included in there. This also makes
21775
21487
  // AngularTS accept any script directive, no matter its name. However, we
21776
21488
  // still need to unwrap trusted types.
21489
+
21777
21490
  if (!isString(tpl) || !$templateCache.has(tpl)) {
21778
21491
  try {
21779
21492
  tpl = $sce.getTrustedResourceUrl(tpl);
@@ -21839,7 +21552,7 @@
21839
21552
  ];
21840
21553
  }
21841
21554
 
21842
- /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider } */
21555
+ /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider */
21843
21556
 
21844
21557
  /**
21845
21558
  * Private service to sanitize uris for links and images. Used by $compile.
@@ -21891,7 +21604,7 @@
21891
21604
  }
21892
21605
 
21893
21606
  /**
21894
- * @returns {import("./interface.js").SanitizerFn} Sanitizer function.
21607
+ * @returns {import("./interface").SanitizerFn}
21895
21608
  */
21896
21609
  $get() {
21897
21610
  return (uri, isMediaUrl) => {
@@ -22148,6 +21861,10 @@
22148
21861
  const ngMessageExpDirective = ngMessageDirectiveFactory(false);
22149
21862
  const ngMessageDefaultDirective = ngMessageDirectiveFactory(true);
22150
21863
 
21864
+ /**
21865
+ * @param {boolean} isDefault
21866
+ * @returns {(any) => import("../../interface.js").Directive}
21867
+ */
22151
21868
  function ngMessageDirectiveFactory(isDefault) {
22152
21869
  ngMessageDirective.$inject = ["$animate"];
22153
21870
  function ngMessageDirective($animate) {
@@ -25228,7 +24945,7 @@
25228
24945
 
25229
24946
  /**
25230
24947
  * Service provider that creates a requestAnimationFrame-based scheduler.
25231
- * @implements {ServiceProvider}
24948
+ * @type {ServiceProvider}
25232
24949
  */
25233
24950
  class RafSchedulerProvider {
25234
24951
  constructor() {
@@ -26980,7 +26697,6 @@
26980
26697
  *
26981
26698
  * This is where we hold the global mutable state such as current state, current
26982
26699
  * params, current transition, etc.
26983
- * @implements {ServiceProvider}
26984
26700
  */
26985
26701
  class RouterGlobals {
26986
26702
  constructor() {
@@ -29621,6 +29337,11 @@
29621
29337
  */
29622
29338
  this.regexp = new RegExp("^" + regexpString + "$");
29623
29339
  }
29340
+
29341
+ /**
29342
+ * @param {string} name
29343
+ * @return {boolean}
29344
+ */
29624
29345
  matches(name) {
29625
29346
  return this.regexp.test("." + name);
29626
29347
  }
@@ -33555,7 +33276,7 @@
33555
33276
  ];
33556
33277
 
33557
33278
  /**
33558
- * @param {import("../../core/location/location").LocationProvider} $locationProvider
33279
+ * @param {import("../../services/location/location").LocationProvider} $locationProvider
33559
33280
  * @param {import("../../router/state/state-service.js").StateProvider} stateService
33560
33281
  * @param globals
33561
33282
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
@@ -33564,9 +33285,7 @@
33564
33285
  this.stateService = stateService;
33565
33286
  this.stateService.urlService = this; // circular wiring
33566
33287
  this.$locationProvider = $locationProvider;
33567
-
33568
33288
  this.$location = undefined;
33569
- this.$browser = undefined;
33570
33289
 
33571
33290
  /** Provides services related to the URL */
33572
33291
  this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
@@ -33619,18 +33338,15 @@
33619
33338
 
33620
33339
  $get = [
33621
33340
  "$location",
33622
- "$browser",
33623
33341
  "$rootScope",
33624
33342
  /**
33625
33343
  *
33626
- * @param {import('../../core/location/location.js').Location} $location
33627
- * @param {import('../../services/browser.js').Browser} $browser
33344
+ * @param {import('../../services/location/location.js').Location} $location
33628
33345
  * @param {import('../../core/scope/scope.js').Scope} $rootScope
33629
33346
  * @returns {UrlService}
33630
33347
  */
33631
- ($location, $browser, $rootScope) => {
33348
+ ($location, $rootScope) => {
33632
33349
  this.$location = $location;
33633
- this.$browser = $browser;
33634
33350
  $rootScope.$on("$locationChangeSuccess", (evt) => {
33635
33351
  this._urlListeners.forEach((fn) => {
33636
33352
  fn(evt);
@@ -33654,7 +33370,7 @@
33654
33370
  baseHref() {
33655
33371
  return (
33656
33372
  this._baseHref ||
33657
- (this._baseHref = this.$browser.baseHref() || window.location.pathname)
33373
+ (this._baseHref = getBaseHref() || window.location.pathname)
33658
33374
  );
33659
33375
  }
33660
33376
 
@@ -34501,7 +34217,6 @@
34501
34217
  *
34502
34218
  * This API is found at `$stateRegistry` ([[UIRouter.stateRegistry]])
34503
34219
  *
34504
- * @implements {ServiceProvider}
34505
34220
  */
34506
34221
  class StateRegistryProvider {
34507
34222
  static $inject = provider([
@@ -35265,11 +34980,20 @@
35265
34980
  * });
35266
34981
  * ```
35267
34982
  */
34983
+
34984
+ /** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
35268
34985
  let ngView = [
35269
34986
  "$view",
35270
34987
  "$animate",
35271
34988
  "$ngViewScroll",
35272
34989
  "$interpolate",
34990
+ /**
34991
+ * @param {*} $view
34992
+ * @param {*} $animate
34993
+ * @param {*} $ngViewScroll
34994
+ * @param {*} $interpolate
34995
+ * @returns {import("../../interface.js").Directive}
34996
+ */
35273
34997
  function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
35274
34998
  function getRenderer() {
35275
34999
  return {
@@ -35300,7 +35024,6 @@
35300
35024
  };
35301
35025
  const directive = {
35302
35026
  count: 0,
35303
-
35304
35027
  terminal: true,
35305
35028
  priority: 400,
35306
35029
  transclude: "element",
@@ -35637,7 +35360,8 @@
35637
35360
  };
35638
35361
  }
35639
35362
 
35640
- ngSetterDirective.$inject = ["$parse", "$log"];
35363
+ ngSetterDirective.$inject = [$injectTokens.$parse, $injectTokens.$log];
35364
+
35641
35365
  /**
35642
35366
  * @param {import('../../core/parse/interface.ts').ParseService} $parse
35643
35367
  * @param {import('../../services/log/interface.ts').LogService} $log
@@ -35650,19 +35374,19 @@
35650
35374
  const modelExpression = attrs["ngSetter"];
35651
35375
 
35652
35376
  if (!modelExpression) {
35653
- $log.warn("ngSetter: Model expression is not provided.");
35377
+ $log.warn("ng-setter: expression null");
35654
35378
  return;
35655
35379
  }
35656
35380
 
35657
35381
  const assignModel = $parse(modelExpression).assign;
35658
35382
 
35659
35383
  if (!assignModel) {
35660
- $log.warn("ngSetter: Invalid model expression.");
35384
+ $log.warn("ng-setter: expression invalid");
35661
35385
  return;
35662
35386
  }
35663
35387
 
35664
35388
  const updateModel = (value) => {
35665
- assignModel(scope, value);
35389
+ assignModel(scope, value.trim());
35666
35390
  };
35667
35391
 
35668
35392
  const observer = new MutationObserver((mutationsList) => {
@@ -35682,16 +35406,11 @@
35682
35406
  }
35683
35407
  });
35684
35408
 
35685
- if (element && element) {
35686
- observer.observe(element, {
35687
- childList: true,
35688
- subtree: true,
35689
- characterData: true,
35690
- });
35691
- } else {
35692
- $log.warn("ngSetter: Element is not a valid DOM node.");
35693
- return;
35694
- }
35409
+ observer.observe(element, {
35410
+ childList: true,
35411
+ subtree: true,
35412
+ characterData: true,
35413
+ });
35695
35414
 
35696
35415
  scope.$on("$destroy", () => observer.disconnect());
35697
35416
  updateModel(element.innerHTML);
@@ -35706,13 +35425,20 @@
35706
35425
  function defineDirective(method) {
35707
35426
  const attrName = "ng" + method.charAt(0).toUpperCase() + method.slice(1);
35708
35427
  const directive = createHttpDirective(method, attrName);
35709
- directive["$inject"] = ["$http", "$compile", "$log"];
35428
+ directive["$inject"] = [$injectTokens.$http, $injectTokens.$compile, $injectTokens.$log, $injectTokens.$parse, $injectTokens.$state];
35710
35429
  return directive;
35711
35430
  }
35712
35431
 
35432
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35713
35433
  const ngGetDirective = defineDirective("get");
35434
+
35435
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35714
35436
  const ngDeleteDirective = defineDirective("delete");
35437
+
35438
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35715
35439
  const ngPostDirective = defineDirective("post");
35440
+
35441
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35716
35442
  const ngPutDirective = defineDirective("put");
35717
35443
 
35718
35444
  /**
@@ -35739,7 +35465,7 @@
35739
35465
  * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35740
35466
  *
35741
35467
  * @param {string} html - The HTML string returned from the server.
35742
- * @param {import("../../interface.ts").SwapInsertPosition} swap
35468
+ * @param {import("../../interface.ts").SwapModeType} swap
35743
35469
  * @param {Element} target - The target DOM element to apply the swap to.
35744
35470
  * @param {import('../../core/scope/scope.js').Scope} scope
35745
35471
  * @param {import('../../core/compile/compile.js').CompileFn} $compile
@@ -35830,9 +35556,11 @@
35830
35556
  * @param {import("interface.ts").HttpService} $http
35831
35557
  * @param {import("../../core/compile/compile.js").CompileFn} $compile
35832
35558
  * @param {import("../../services/log/interface.ts").LogService} $log
35559
+ * @param {import("../../core/parse/interface.ts").ParseService} $parse
35560
+ * @param {import("../../router/state/state-service.js").StateProvider} $state
35833
35561
  * @returns {import('../../interface.ts').Directive}
35834
35562
  */
35835
- return function ($http, $compile, $log) {
35563
+ return function ($http, $compile, $log, $parse, $state) {
35836
35564
  /**
35837
35565
  * Collects form data from the element or its associated form.
35838
35566
  *
@@ -35893,16 +35621,38 @@
35893
35621
  restrict: "A",
35894
35622
  terminal: true,
35895
35623
  link(scope, element, attrs) {
35896
- /** @type {EventType} */
35897
- const eventName = getEventNameForElement(element);
35624
+ const eventName =
35625
+ attrs["trigger"] ||
35626
+ /** @type {EventType} */ getEventNameForElement(element);
35627
+
35898
35628
  const tag = element.tagName.toLowerCase();
35899
35629
 
35900
- element.addEventListener(eventName, (event) => {
35630
+ if (isDefined(attrs["latch"])) {
35631
+ attrs.$observe(
35632
+ "latch",
35633
+ callBackAfterFirst(() =>
35634
+ element.dispatchEvent(new Event(eventName)),
35635
+ ),
35636
+ );
35637
+ }
35638
+
35639
+ let throttled = false;
35640
+ let intervalId;
35641
+
35642
+ if (isDefined(attrs["interval"])) {
35643
+ element.dispatchEvent(new Event(eventName));
35644
+ intervalId = setInterval(
35645
+ () => element.dispatchEvent(new Event(eventName)),
35646
+ parseInt(attrs["interval"]) || 1000,
35647
+ );
35648
+ }
35649
+
35650
+ element.addEventListener(eventName, async (event) => {
35901
35651
  if (/** @type {HTMLButtonElement} */ (element).disabled) return;
35902
35652
  if (tag === "form") event.preventDefault();
35903
35653
 
35904
- const swap = element.dataset.swap || "innerHTML";
35905
- const targetSelector = element.dataset.target;
35654
+ const swap = attrs["swap"] || "innerHTML";
35655
+ const targetSelector = attrs["target"];
35906
35656
  const target = targetSelector
35907
35657
  ? document.querySelector(targetSelector)
35908
35658
  : element;
@@ -35919,18 +35669,67 @@
35919
35669
  }
35920
35670
 
35921
35671
  const handler = (res) => {
35672
+ if (isDefined(attrs["loading"])) {
35673
+ attrs.$set("loading", false);
35674
+ }
35675
+
35676
+ if (isDefined(attrs["loadingClass"])) {
35677
+ attrs.$removeClass(attrs["loadingClass"]);
35678
+ }
35679
+
35922
35680
  const html = res.data;
35681
+ if (200 <= res.status && res.status <= 299) {
35682
+ if (isDefined(attrs["success"])) {
35683
+ $parse(attrs["success"])(scope, { $res: html });
35684
+ }
35685
+
35686
+ if (isDefined(attrs["stateSuccess"])) {
35687
+ $state.go(attrs["stateSuccess"]);
35688
+ }
35689
+ } else if (400 <= res.status && res.status <= 599) {
35690
+ if (isDefined(attrs["error"])) {
35691
+ $parse(attrs["error"])(scope, { $res: html });
35692
+ }
35693
+
35694
+ if (isDefined(attrs["stateError"])) {
35695
+ $state.go(attrs["stateError"]);
35696
+ }
35697
+ }
35698
+
35923
35699
  handleSwapResponse(
35924
35700
  html,
35925
- /** @type {import("../../interface.ts").SwapInsertPosition} */ (
35926
- swap
35927
- ),
35701
+ /** @type {import("../../interface.ts").SwapModeType} */ (swap),
35928
35702
  target,
35929
35703
  scope,
35930
35704
  $compile,
35931
35705
  );
35932
35706
  };
35933
35707
 
35708
+ if (isDefined(attrs["delay"])) {
35709
+ await wait(parseInt(attrs["delay"]) | 0);
35710
+ }
35711
+
35712
+ if (throttled) {
35713
+ return;
35714
+ }
35715
+
35716
+ if (isDefined(attrs["throttle"])) {
35717
+ throttled = true;
35718
+ attrs.$set("throttled", true);
35719
+ setTimeout(() => {
35720
+ attrs.$set("throttled", false);
35721
+ throttled = false;
35722
+ }, parseInt(attrs["throttle"]));
35723
+ }
35724
+
35725
+ if (isDefined(attrs["loading"])) {
35726
+ attrs.$set("loading", true);
35727
+ }
35728
+
35729
+ if (isDefined(attrs["loadingClass"])) {
35730
+ attrs.$addClass(attrs["loadingClass"]);
35731
+ }
35732
+
35934
35733
  if (method === "post" || method === "put") {
35935
35734
  const data = collectFormData(element);
35936
35735
  $http[method](url, data).then(handler).catch(handler);
@@ -35938,6 +35737,8 @@
35938
35737
  $http[method](url).then(handler).catch(handler);
35939
35738
  }
35940
35739
  });
35740
+
35741
+ scope.$on("$destroy", () => clearInterval(intervalId));
35941
35742
  },
35942
35743
  };
35943
35744
  };
@@ -35949,13 +35750,13 @@
35949
35750
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
35950
35751
  */
35951
35752
  function registerNgModule(angular) {
35952
- const ng = angular
35753
+ return angular
35953
35754
  .module(
35954
35755
  "ng",
35955
35756
  [],
35956
35757
  [
35957
35758
  "$provide",
35958
- /** @type {import('./interface.js').Provider} */
35759
+ /** @param {import("./interface.js").Provider} $provide */
35959
35760
  ($provide) => {
35960
35761
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
35961
35762
  $provide.provider({
@@ -36056,7 +35857,6 @@
36056
35857
  $$animateQueue: AnimateQueueProvider,
36057
35858
  $$AnimateRunner: AnimateRunnerFactoryProvider,
36058
35859
  $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
36059
- $browser: BrowserProvider,
36060
35860
  $controller: ControllerProvider,
36061
35861
  $exceptionHandler: ExceptionHandlerProvider,
36062
35862
  $filter: FilterProvider,
@@ -36072,7 +35872,6 @@
36072
35872
  $routerGlobals: RouterGlobals,
36073
35873
  $sce: SceProvider,
36074
35874
  $sceDelegate: SceDelegateProvider,
36075
- $$taskTrackerFactory: TaskTrackerFactoryProvider,
36076
35875
  $templateCache: TemplateCacheProvider,
36077
35876
  $templateRequest: TemplateRequestProvider,
36078
35877
  $urlConfig: UrlConfigProvider,
@@ -36099,8 +35898,6 @@
36099
35898
  },
36100
35899
  ])
36101
35900
  .value("$trace", trace);
36102
-
36103
- return ng;
36104
35901
  }
36105
35902
 
36106
35903
  const ngMinErr = minErr("ng");
@@ -36126,7 +35923,7 @@
36126
35923
  /**
36127
35924
  * @type {string} `version` from `package.json`
36128
35925
  */
36129
- this.version = "0.7.7"; //inserted via rollup plugin
35926
+ this.version = "0.7.8"; //inserted via rollup plugin
36130
35927
 
36131
35928
  /** @type {!Array<string|any>} */
36132
35929
  this.bootsrappedModules = [];
@@ -36366,12 +36163,7 @@
36366
36163
  name,
36367
36164
  );
36368
36165
  }
36369
- const moduleInstance = new NgModule(
36370
- name,
36371
- requires,
36372
- /** @type {Function} */ (configFn),
36373
- );
36374
- return moduleInstance;
36166
+ return new NgModule(name, requires, /** @type {Function} */ (configFn));
36375
36167
  });
36376
36168
  }
36377
36169
  }