@angular-wave/angular.ts 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/@types/angular.d.ts +1 -1
  2. package/@types/core/compile/attributes.d.ts +28 -4
  3. package/@types/core/compile/inteface.d.ts +5 -1
  4. package/@types/core/di/inteface.d.ts +11 -0
  5. package/@types/core/parse/ast/ast-node.d.ts +2 -0
  6. package/@types/core/parse/parse.d.ts +4 -1
  7. package/@types/core/scope/interface.d.ts +26 -0
  8. package/@types/directive/bind/bind.d.ts +5 -7
  9. package/@types/directive/form/form.d.ts +12 -9
  10. package/@types/directive/init/init.d.ts +2 -2
  11. package/@types/directive/input/input.d.ts +16 -0
  12. package/@types/directive/listener/listener.d.ts +4 -0
  13. package/@types/directive/model/interface.d.ts +18 -0
  14. package/@types/directive/model/model.d.ts +20 -18
  15. package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
  16. package/@types/directive/select/select.d.ts +2 -2
  17. package/@types/directive/setter/setter.d.ts +2 -2
  18. package/@types/directive/show-hide/show-hide.d.ts +2 -4
  19. package/@types/directive/switch/switch.d.ts +4 -4
  20. package/@types/interface.d.ts +22 -1
  21. package/@types/namespace.d.ts +9 -1
  22. package/@types/router/router.d.ts +5 -3
  23. package/@types/router/scroll/interface.d.ts +1 -1
  24. package/@types/router/state/interface.d.ts +5 -0
  25. package/@types/router/state/state-builder.d.ts +10 -6
  26. package/@types/router/state/state-matcher.d.ts +11 -3
  27. package/@types/router/state/state-object.d.ts +3 -5
  28. package/@types/router/state/state-queue-manager.d.ts +14 -8
  29. package/@types/router/state/state-registry.d.ts +12 -3
  30. package/@types/router/state/state-service.d.ts +8 -2
  31. package/@types/router/transition/hook-registry.d.ts +15 -5
  32. package/@types/router/transition/transition.d.ts +4 -2
  33. package/@types/router/url/url-rules.d.ts +3 -84
  34. package/@types/router/url/url-service.d.ts +9 -8
  35. package/@types/services/cookie/cookie.d.ts +3 -11
  36. package/@types/services/http/http.d.ts +6 -31
  37. package/@types/services/http/interface.d.ts +22 -0
  38. package/@types/services/location/location.d.ts +14 -13
  39. package/@types/services/sce/interface.d.ts +25 -0
  40. package/@types/services/sse/interface.d.ts +8 -1
  41. package/@types/services/sse/sse.d.ts +10 -18
  42. package/@types/services/storage/storage.d.ts +6 -6
  43. package/@types/services/stream/interface.d.ts +1 -1
  44. package/@types/services/stream/stream.d.ts +98 -0
  45. package/@types/shared/common.d.ts +2 -2
  46. package/@types/shared/dom.d.ts +21 -42
  47. package/@types/shared/hof.d.ts +27 -37
  48. package/@types/shared/noderef.d.ts +2 -2
  49. package/@types/shared/strings.d.ts +13 -4
  50. package/@types/shared/utils.d.ts +123 -66
  51. package/@types/shared/validate.d.ts +7 -0
  52. package/dist/angular-ts.esm.js +980 -812
  53. package/dist/angular-ts.umd.js +980 -812
  54. package/dist/angular-ts.umd.min.js +1 -1
  55. package/dist/angular-ts.umd.min.js.gz +0 -0
  56. package/dist/angular-ts.umd.min.js.map +1 -1
  57. package/package.json +1 -1
  58. package/@types/router/state-filters.d.ts +0 -39
  59. package/@types/shared/cache.d.ts +0 -7
@@ -1,4 +1,4 @@
1
- /* Version: 0.15.0 - December 14, 2025 04:42:34 */
1
+ /* Version: 0.15.1 - December 21, 2025 17:06:17 */
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) :
@@ -108,14 +108,14 @@
108
108
  // via the forEach method when constructing the JQLite object in the first place
109
109
  if (isArray(obj) || obj instanceof Array || isString(obj)) return true;
110
110
 
111
- const len = /** @type {Object} */ (obj).length;
111
+ const len = /** @type {ArrayLike<any>} */ (obj).length;
112
112
 
113
113
  // NodeList objects (with `item` method) and
114
114
  // other objects with suitable length characteristics are array-like
115
115
  return (
116
116
  isNumber(len) &&
117
117
  ((len >= 0 && len - 1 in /** @type {Object} */ (obj)) ||
118
- typeof (/** @type {Object} */ (obj).item) === "function")
118
+ typeof (/** @type {NodeList} */ (obj).item) === "function")
119
119
  );
120
120
  }
121
121
 
@@ -155,7 +155,7 @@
155
155
  * @param {new (...args: any[]) => T} type The constructor to test against
156
156
  * @returns {val is T}
157
157
  */
158
- function isIntanceOf(val, type) {
158
+ function isInstanceOf(val, type) {
159
159
  return val instanceof type;
160
160
  }
161
161
 
@@ -174,8 +174,7 @@
174
174
 
175
175
  /**
176
176
  * Determines if a reference is a `string`.
177
- *
178
- * @param value - The value to check.
177
+ * @param {unknown} value - The value to check.
179
178
  * @returns {value is string} True if `value` is a string.
180
179
  */
181
180
  function isString(value) {
@@ -288,7 +287,7 @@
288
287
  * @returns {obj is Window} True if `obj` is a window obj.
289
288
  */
290
289
  function isWindow(obj) {
291
- return obj && isIntanceOf(obj, Window);
290
+ return isInstanceOf(obj, Window);
292
291
  }
293
292
 
294
293
  /**
@@ -347,25 +346,30 @@
347
346
  return isString(value) ? value.trim() : value;
348
347
  }
349
348
 
349
+ /**
350
+ * @param {string} name
351
+ * @param {string} separator
352
+ */
350
353
  function snakeCase(name, separator) {
351
354
  const modseparator = separator;
352
355
 
353
356
  return name.replace(
354
357
  /[A-Z]/g,
355
- (letter, pos) => (pos ? modseparator : "") + letter.toLowerCase(),
358
+ (/** @type {string} */ letter, /** @type {any} */ pos) =>
359
+ (pos ? modseparator : "") + letter.toLowerCase(),
356
360
  );
357
361
  }
358
362
 
359
363
  /**
360
364
  * Set or clear the hashkey for an object.
361
- * @param obj object
362
- * @param hashkey the hashkey (!truthy to delete the hashkey)
365
+ * @param {{ [x: string]: any; _hashKey?: any; }} obj object
366
+ * @param {any} hashkey the hashkey (!truthy to delete the hashkey)
363
367
  */
364
368
  function setHashKey(obj, hashkey) {
365
369
  if (hashkey) {
366
- obj.$$hashKey = hashkey;
370
+ obj._hashKey = hashkey;
367
371
  } else {
368
- delete obj.$$hashKey;
372
+ delete obj._hashKey;
369
373
  }
370
374
  }
371
375
 
@@ -380,7 +384,7 @@
380
384
  * @returns {Object<string, any>} The extended destination object.
381
385
  */
382
386
  function baseExtend(dst, objs, deep = false) {
383
- const hasKey = dst.$$hashKey;
387
+ const hasKey = dst._hashKey;
384
388
 
385
389
  for (let i = 0, ii = objs.length; i < ii; ++i) {
386
390
  const obj = objs[i];
@@ -447,6 +451,10 @@
447
451
  return extend(Object.create(parent), extra);
448
452
  }
449
453
 
454
+ /**
455
+ * @param {{ toString: () => string; }} obj
456
+ * @returns {boolean}
457
+ */
450
458
  function hasCustomToString(obj) {
451
459
  return isFunction(obj.toString) && obj.toString !== toString;
452
460
  }
@@ -457,12 +465,16 @@
457
465
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
458
466
  *
459
467
  * @param {Element} element
460
- * @returns
468
+ * @returns {string}
461
469
  */
462
470
  function getNodeName(element) {
463
471
  return lowercase(element.nodeName);
464
472
  }
465
473
 
474
+ /**
475
+ * @param {any} array
476
+ * @param {string} obj
477
+ */
466
478
  function includes(array, obj) {
467
479
  return Array.prototype.indexOf.call(array, obj) !== -1;
468
480
  }
@@ -485,6 +497,10 @@
485
497
  return index;
486
498
  }
487
499
 
500
+ /**
501
+ * @param {unknown} val1
502
+ * @param {unknown} val2
503
+ */
488
504
  function simpleCompare(val1, val2) {
489
505
  return val1 === val2 || (Number.isNaN(val1) && Number.isNaN(val2));
490
506
  }
@@ -639,6 +655,10 @@
639
655
  }
640
656
  }
641
657
 
658
+ /**
659
+ * @param {unknown} value
660
+ * @returns {string | unknown}
661
+ */
642
662
  function stringify$1(value) {
643
663
  if (isNull(value) || isUndefined(value)) {
644
664
  return "";
@@ -650,10 +670,14 @@
650
670
  value = `${value}`;
651
671
  break;
652
672
  default:
653
- if (hasCustomToString(value) && !isArray(value) && !isDate(value)) {
654
- value = value.toString();
673
+ if (
674
+ hasCustomToString(/** @type {Object} */ (value)) &&
675
+ !isArray(value) &&
676
+ !isDate(value)
677
+ ) {
678
+ value = /** @type {Object} */ (value).toString();
655
679
  } else {
656
- value = toJson(value);
680
+ value = toJson(/** @type {any[]} */ (value));
657
681
  }
658
682
  }
659
683
 
@@ -668,10 +692,19 @@
668
692
  return isNumber(maxDepth) && maxDepth > 0;
669
693
  }
670
694
 
695
+ /**
696
+ * @param {any[]} array1
697
+ * @param {IArguments | any[] | NodeListOf<ChildNode>} array2
698
+ * @param {number | undefined} [index]
699
+ */
671
700
  function concat(array1, array2, index) {
672
701
  return array1.concat(Array.prototype.slice.call(array2, index));
673
702
  }
674
703
 
704
+ /**
705
+ * @param {IArguments | [string, ...any[]]} args
706
+ * @param {number} startIndex
707
+ */
675
708
  function sliceArgs(args, startIndex) {
676
709
  return Array.prototype.slice.call(args, startIndex);
677
710
  }
@@ -707,6 +740,10 @@
707
740
  return fn;
708
741
  }
709
742
 
743
+ /**
744
+ * @param {string} key
745
+ * @param {unknown} value
746
+ */
710
747
  function toJsonReplacer(key, value) {
711
748
  let val = value;
712
749
 
@@ -728,66 +765,41 @@
728
765
  }
729
766
 
730
767
  /**
731
- * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
732
- * stripped since AngularTS uses this notation internally.
768
+ * Serializes input into a JSON-formatted string. Properties with leading `$$` characters
769
+ * will be stripped since AngularTS uses this notation internally.
733
770
  *
734
- * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON.
735
- * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
736
- * If set to an integer, the JSON output will contain that many spaces per indentation.
737
- * @returns {string|undefined} JSON-ified string representing `obj`.
738
- * @knownIssue
739
- *
740
- * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date`
741
- * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the
742
- * `Date.prototype.toJSON` method as follows:
743
- *
744
- * ```
745
- * let _DatetoJSON = Date.prototype.toJSON;
746
- * Date.prototype.toJSON = function() {
747
- * try {
748
- * return _DatetoJSON.call(this);
749
- * } catch(e) {
750
- * if (e instanceof RangeError) {
751
- * return null;
752
- * }
753
- * throw e;
754
- * }
755
- * };
756
- * ```
757
- *
758
- * See https://github.com/angular/angular.js/pull/14221 for more information.
771
+ * @param {Object|Array<any>|Date|string|number|boolean} obj
772
+ * Input to be serialized into JSON.
773
+ * @param {boolean|number} [pretty=2]
774
+ * If `true`, the JSON output will contain newlines and whitespace (2 spaces).
775
+ * If a number, the JSON output will contain that many spaces per indentation.
776
+ * @returns {string|undefined}
777
+ * JSON-ified string representing `obj`, or `undefined` if `obj` is undefined.
759
778
  */
760
779
  function toJson(obj, pretty) {
761
780
  if (isUndefined(obj)) return undefined;
762
781
 
763
782
  if (!isNumber(pretty)) {
764
- pretty = pretty ? 2 : null;
783
+ pretty = pretty ? 2 : undefined;
765
784
  }
766
785
 
767
- return JSON.stringify(obj, toJsonReplacer, /** @type {Number} */ (pretty));
786
+ return JSON.stringify(obj, toJsonReplacer, /** @type {number} */ (pretty));
768
787
  }
769
788
 
770
789
  /**
771
790
  * Deserializes a JSON string.
772
791
  *
773
792
  * @param {string} json JSON string to deserialize.
774
- * @returns {Object|Array|string|number} Deserialized JSON string.
793
+ * @returns {Object|Array<any>|string|number} Deserialized JSON string.
775
794
  */
776
795
  function fromJson(json) {
777
796
  return isString(json) ? JSON.parse(json) : json;
778
797
  }
779
798
 
780
- const MS_PER_MINUTE = 60_000; // 60,000 ms in a minute
781
-
782
- function timezoneToOffset(timezone, fallback) {
783
- const requestedTimezoneOffset =
784
- Date.parse(`Jan 01, 1970 00:00:00 ${timezone}`) / MS_PER_MINUTE;
785
-
786
- return isNumberNaN(requestedTimezoneOffset)
787
- ? fallback
788
- : requestedTimezoneOffset;
789
- }
790
-
799
+ /**
800
+ * @param {Date} date
801
+ * @param {number} minutes
802
+ */
791
803
  function addDateMinutes(date, minutes) {
792
804
  const newDate = new Date(date.getTime());
793
805
 
@@ -796,25 +808,13 @@
796
808
  return newDate;
797
809
  }
798
810
 
799
- function convertTimezoneToLocal(date, timezone, reverse) {
800
- const doReverse = 1;
801
-
802
- const dateTimezoneOffset = date.getTimezoneOffset();
803
-
804
- const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
805
-
806
- return addDateMinutes(
807
- date,
808
- doReverse * (timezoneOffset - dateTimezoneOffset),
809
- );
810
- }
811
-
812
811
  /**
813
812
  * Parses an escaped url query string into key-value pairs.
814
813
  * @param {string} keyValue
815
- * @returns {Object.<string,boolean|Array>}
814
+ * @returns {Object.<string,boolean|Array<any>>}
816
815
  */
817
816
  function parseKeyValue(keyValue) {
817
+ /** @type {Record<string, boolean | string | Array<any>>} */
818
818
  const obj = {};
819
819
 
820
820
  (keyValue || "").split("&").forEach((item) => {
@@ -838,9 +838,9 @@
838
838
  val = isDefined(val) ? tryDecodeURIComponent(val) : true;
839
839
 
840
840
  if (!hasOwn(obj, /** @type {string} */ (key))) {
841
- obj[key] = val;
841
+ obj[key] = /** @type {string } */ (val);
842
842
  } else if (isArray(obj[key])) {
843
- obj[key].push(val);
843
+ /** @type {Array<any>} */ (obj[key]).push(val);
844
844
  } else {
845
845
  obj[key] = [obj[key], val];
846
846
  }
@@ -848,10 +848,16 @@
848
848
  }
849
849
  });
850
850
 
851
- return /** @type {Object.<string,boolean|Array>} */ (obj);
851
+ return /** @type {Object.<string,boolean|Array<any>>} */ (obj);
852
852
  }
853
853
 
854
+ /**
855
+ * @param {string | { [s: string]: any; } | ArrayLike<any> | null} obj
856
+ */
854
857
  function toKeyValue(obj) {
858
+ /**
859
+ * @type {string[]}
860
+ */
855
861
  const parts = [];
856
862
 
857
863
  obj &&
@@ -919,6 +925,8 @@
919
925
  * pct-encoded = "%" HEXDIG HEXDIG
920
926
  * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
921
927
  * / "*" / "+" / "," / ";" / "="
928
+ * @param {string | number | boolean} val
929
+ * @param {boolean | undefined} [pctEncodeSpaces]
922
930
  */
923
931
  function encodeUriQuery(val, pctEncodeSpaces) {
924
932
  return encodeURIComponent(val)
@@ -933,28 +941,39 @@
933
941
  const ngAttrPrefixes = ["ng-", "data-ng-"];
934
942
 
935
943
  /**
936
- * Creates a shallow copy of an object, an array or a primitive.
944
+ * Creates a shallow copy of an object, an array, or returns primitives as-is.
937
945
  *
938
- * Assumes that there are no proto properties for objects.
946
+ * Assumes there are no proto properties.
947
+ *
948
+ * @template T
949
+ * @param {T} src
950
+ * @param {T extends any[] ? T : Record<string, unknown>} [dst]
951
+ * @returns {T}
939
952
  */
940
953
  function shallowCopy(src, dst) {
941
954
  if (isArray(src)) {
942
- dst = dst || [];
955
+ /** @type {any[]} */
956
+ const out = /** @type {any[]} */ (dst) || [];
943
957
 
944
- for (let i = 0, ii = src.length; i < ii; i++) {
945
- dst[i] = src[i];
946
- }
947
- } else if (isObject(src)) {
948
- dst = dst || {};
958
+ out.push(...src);
959
+
960
+ return /** @type {T} */ (out);
961
+ }
962
+
963
+ if (isObject(src)) {
964
+ const out = /** @type {Record<string, unknown>} */ (dst) || {};
949
965
 
950
966
  for (const key in src) {
951
- if (!(key.startsWith("$") && key.charAt(1) === "$")) {
952
- dst[key] = src[key];
967
+ // Copy all properties except $$-prefixed
968
+ if (!key.startsWith("$$")) {
969
+ out[key] = src[key];
953
970
  }
954
971
  }
972
+
973
+ return /** @type {T} */ (out);
955
974
  }
956
975
 
957
- return dst || src;
976
+ return src;
958
977
  }
959
978
 
960
979
  /**
@@ -970,6 +989,9 @@
970
989
 
971
990
  /**
972
991
  * Throw error if the argument is falsy.
992
+ * @param {string | boolean | Object} arg
993
+ * @param {string} name
994
+ * @param {string | undefined} [reason]
973
995
  */
974
996
  function assertArg(arg, name, reason) {
975
997
  if (!arg) {
@@ -984,6 +1006,11 @@
984
1006
  return arg;
985
1007
  }
986
1008
 
1009
+ /**
1010
+ * @param {string | Function | any[]} arg
1011
+ * @param {string} name
1012
+ * @param {boolean | undefined} [acceptArrayAnnotation]
1013
+ */
987
1014
  function assertArgFn(arg, name, acceptArrayAnnotation) {
988
1015
  if (acceptArrayAnnotation && isArray(arg)) {
989
1016
  arg = arg[arg.length - 1];
@@ -1071,7 +1098,7 @@
1071
1098
 
1072
1099
  const templateArgs = sliceArgs(args, 2).map((arg) => toDebugString(arg));
1073
1100
 
1074
- message += template.replace(/\{\d+\}/g, (match) => {
1101
+ message += template.replace(/\{\d+\}/g, (/** @type {string} */ match) => {
1075
1102
  const index = +match.slice(1, -1);
1076
1103
 
1077
1104
  if (index < templateArgs.length) {
@@ -1130,19 +1157,19 @@
1130
1157
  * Hash of a:
1131
1158
  * string is string
1132
1159
  * number is number as string
1133
- * object is either result of calling $$hashKey function on the object or uniquely generated id,
1134
- * that is also assigned to the $$hashKey property of the object.
1160
+ * object is either result of calling _hashKey function on the object or uniquely generated id,
1161
+ * that is also assigned to the _hashKey property of the object.
1135
1162
  *
1136
1163
  * @param {*} obj
1137
1164
  * @returns {string} hash string such that the same input will have the same hash string.
1138
1165
  * The resulting string key is in 'type:hashKey' format.
1139
1166
  */
1140
1167
  function hashKey(obj) {
1141
- const key = obj && obj.$$hashKey;
1168
+ const key = obj && obj._hashKey;
1142
1169
 
1143
1170
  if (key) {
1144
1171
  if (typeof key === "function") {
1145
- return obj.$$hashKey();
1172
+ return obj._hashKey();
1146
1173
  }
1147
1174
 
1148
1175
  return key;
@@ -1151,9 +1178,9 @@
1151
1178
  const objType = typeof obj;
1152
1179
 
1153
1180
  if (objType === "function" || (objType === "object" && obj !== null)) {
1154
- obj.$$hashKey = `${objType}:${nextUid()}`;
1181
+ obj._hashKey = `${objType}:${nextUid()}`;
1155
1182
 
1156
- return obj.$$hashKey;
1183
+ return obj._hashKey;
1157
1184
  }
1158
1185
 
1159
1186
  if (objType === "undefined") {
@@ -1415,14 +1442,6 @@
1415
1442
  return typeof fn === "function" && !fn.prototype;
1416
1443
  }
1417
1444
 
1418
- /**
1419
- * Expando cache for adding properties to DOM nodes with JavaScript.
1420
- * This used to be an Object in JQLite decorator, but swapped out for a Map
1421
- *
1422
- * @type {Map<number, import('../interface.ts').ExpandoStore>}
1423
- */
1424
- const Cache = new Map();
1425
-
1426
1445
  const ADD_CLASS_SUFFIX = "-add";
1427
1446
  const REMOVE_CLASS_SUFFIX = "-remove";
1428
1447
  const EVENT_CLASS_PREFIX = "ng-";
@@ -1849,10 +1868,18 @@
1849
1868
 
1850
1869
  const EXPANDO = "ng";
1851
1870
 
1871
+ /**
1872
+ * Expando cache for adding properties to DOM nodes with JavaScript.
1873
+ * This used to be an Object in JQLite decorator, but swapped out for a Map
1874
+ *
1875
+ * @type {Map<number, import('../interface.ts').ExpandoStore>}
1876
+ */
1877
+ const Cache = new Map();
1878
+
1852
1879
  /**
1853
1880
  * Key for storing scope data, attached to an element
1854
1881
  */
1855
- const SCOPE_KEY = "$scope";
1882
+ const SCOPE_KEY = $injectTokens._scope;
1856
1883
 
1857
1884
  const DASH_LOWERCASE_REGEXP = /-([a-z])/g;
1858
1885
 
@@ -2295,7 +2322,7 @@
2295
2322
  /**
2296
2323
  * Return the DOM siblings between the first and last node in the given array.
2297
2324
  * @param {Array<Node>} nodes An array-like object
2298
- * @returns {Element} the inputted object or a JQLite collection containing the nodes
2325
+ * @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
2299
2326
  */
2300
2327
  function getBlockNodes(nodes) {
2301
2328
  // TODO(perf): update `nodes` instead of creating a new object?
@@ -2405,7 +2432,7 @@
2405
2432
  * @param {HTMLElement | Element} parentElement
2406
2433
  * The parent element that will receive the inserted element.
2407
2434
  *
2408
- * @param {HTMLElement | Element | null} [afterElement]
2435
+ * @param {ChildNode | Element | null} [afterElement]
2409
2436
  * An optional sibling element — if present and valid, `element`
2410
2437
  * will be inserted after it. If omitted or invalid, `element`
2411
2438
  * is prepended to `parentElement`.
@@ -2431,6 +2458,11 @@
2431
2458
  }
2432
2459
  }
2433
2460
 
2461
+ /**
2462
+ * @param {HTMLElement} element
2463
+ * @param {HTMLElement} parent
2464
+ * @param {ChildNode | null | undefined} after
2465
+ */
2434
2466
  function animatedomInsert(element, parent, after) {
2435
2467
  const originalVisibility = element.style.visibility;
2436
2468
 
@@ -2798,11 +2830,11 @@
2798
2830
  * Creates a proxy that automatically persists an object's state
2799
2831
  * into a storage backend whenever a property is set.
2800
2832
  *
2801
- * @param {object} target - The object to wrap
2833
+ * @param {Record<PropertyKey, any>} target - The object to wrap
2802
2834
  * @param {string} key - The storage key
2803
- * @param {object} storage - Any storage-like object with getItem/setItem/removeItem
2835
+ * @param {import("../../core/di/inteface").StorageLike & import("../../core/di/inteface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
2804
2836
  * @param {{serialize?: function, deserialize?: function}} [options] - Optional custom (de)serialization
2805
- * @returns {Proxy}
2837
+ * @returns {Record<PropertyKey, any>}
2806
2838
  */
2807
2839
  function createPersistentProxy(target, key, storage, options = {}) {
2808
2840
  const serialize = options.serialize || JSON.stringify;
@@ -2868,7 +2900,6 @@
2868
2900
  }
2869
2901
 
2870
2902
  const BADARG = "badarg";
2871
- const BADARGVALUE = "badarg: value";
2872
2903
 
2873
2904
  /** @type {Map<ng.Validator, string>} */
2874
2905
  const reasons = new Map([
@@ -2971,6 +3002,25 @@
2971
3002
  /** @type {Map<String|Function, boolean>} */
2972
3003
  const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
2973
3004
 
3005
+ /**
3006
+ * @typedef {{
3007
+ * $provide: {
3008
+ * provider: Function,
3009
+ * factory: Function,
3010
+ * service: Function,
3011
+ * value: Function,
3012
+ * constant: Function,
3013
+ * store: Function,
3014
+ * decorator: Function,
3015
+ * },
3016
+ * $injectorProvider?: {
3017
+ * $get: () => unknown
3018
+ * },
3019
+ * $injector?: ProviderInjector
3020
+ * }} ProviderCache
3021
+ */
3022
+
3023
+ /** @type {ProviderCache} */
2974
3024
  const providerCache = {
2975
3025
  $provide: {
2976
3026
  provider: supportObject(provider),
@@ -3127,12 +3177,11 @@
3127
3177
  * Registers a service persisted in a storage
3128
3178
  *
3129
3179
  * @param {string} name - Service name
3130
- * @param {Function} ctor - Constructor for the service
3180
+ * @param {import("../../interface.ts").Constructor} ctor - Constructor for the service
3131
3181
  * @param {ng.StorageType} type - Type of storage to be instantiated
3132
- * @param {Storage|Object} backendOrConfig - Either a Storage-like object (getItem/setItem) or a config object
3133
- * with { backend, serialize, deserialize }
3182
+ * @param {import("./inteface.ts").StorageLike & import("./inteface.ts").PersistentStoreConfig} [backendOrConfig]
3134
3183
  */
3135
- function store(name, ctor, type, backendOrConfig = {}) {
3184
+ function store(name, ctor, type, backendOrConfig) {
3136
3185
  return provider(name, {
3137
3186
  $get: /** @param {ng.InjectorService} $injector */ ($injector) => {
3138
3187
  switch (type) {
@@ -3151,11 +3200,11 @@
3151
3200
 
3152
3201
  const $cookie = $injector.get($injectTokens._cookie);
3153
3202
 
3154
- const serialize = backendOrConfig.serialize ?? JSON.stringify;
3203
+ const serialize = backendOrConfig?.serialize ?? JSON.stringify;
3155
3204
 
3156
- const deserialize = backendOrConfig.deserialize ?? JSON.parse;
3205
+ const deserialize = backendOrConfig?.deserialize ?? JSON.parse;
3157
3206
 
3158
- const cookieOpts = backendOrConfig.cookie ?? {};
3207
+ const cookieOpts = backendOrConfig?.cookie ?? {};
3159
3208
 
3160
3209
  return createPersistentProxy(instance, name, {
3161
3210
  getItem(key) {
@@ -3205,10 +3254,15 @@
3205
3254
  backend = localStorage;
3206
3255
  }
3207
3256
 
3208
- return createPersistentProxy(instance, name, backend, {
3209
- serialize,
3210
- deserialize,
3211
- });
3257
+ return createPersistentProxy(
3258
+ instance,
3259
+ name,
3260
+ /** @type {import("./inteface.ts").StorageLike} */ (backend),
3261
+ {
3262
+ serialize,
3263
+ deserialize,
3264
+ },
3265
+ );
3212
3266
  }
3213
3267
  }
3214
3268
 
@@ -3685,7 +3739,7 @@
3685
3739
  *
3686
3740
  * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
3687
3741
  * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
3688
- *
3742
+ * @type {import("./interface.ts").HttpProviderDefaults}
3689
3743
  */
3690
3744
  const defaults = (this.defaults = {
3691
3745
  // transform incoming response data
@@ -3754,6 +3808,7 @@
3754
3808
  * array, on request, but reverse order, on response.
3755
3809
  *
3756
3810
  * {@link ng.$http#interceptors Interceptors detailed info}
3811
+ * @type {Array<string | ng.Injectable<import("./interface.ts").HttpInterceptorFactory>>}
3757
3812
  */
3758
3813
  this.interceptors = [];
3759
3814
 
@@ -3797,19 +3852,6 @@
3797
3852
  */
3798
3853
  this.xsrfTrustedOrigins = [];
3799
3854
 
3800
- /**
3801
- * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
3802
- * instead.
3803
- */
3804
- Object.defineProperty(this, "xsrfWhitelistedOrigins", {
3805
- get() {
3806
- return this.xsrfTrustedOrigins;
3807
- },
3808
- set(origins) {
3809
- this.xsrfTrustedOrigins = origins;
3810
- },
3811
- });
3812
-
3813
3855
  const that = this;
3814
3856
 
3815
3857
  this.$get = [
@@ -4694,14 +4736,14 @@
4694
4736
  * @param {import("./interface.ts").SwapModeType} swap
4695
4737
  * @param {ng.Scope} scopeParam
4696
4738
  * @param {ng.Attributes} attrsParam
4697
- * @param {Element} elmenetParam
4739
+ * @param {Element} elementParam
4698
4740
  */
4699
4741
  function handleSwapResponse(
4700
4742
  html,
4701
4743
  swap,
4702
4744
  scopeParam,
4703
4745
  attrsParam,
4704
- elmenetParam,
4746
+ elementParam,
4705
4747
  ) {
4706
4748
  let animationEnabled = false;
4707
4749
 
@@ -4724,7 +4766,7 @@
4724
4766
 
4725
4767
  const target = targetSelector
4726
4768
  ? document.querySelector(targetSelector)
4727
- : elmenetParam;
4769
+ : elementParam;
4728
4770
 
4729
4771
  if (!target) {
4730
4772
  $log.warn(`${attrName}: target "${targetSelector}" not found`);
@@ -5685,14 +5727,14 @@
5685
5727
  * @throws {Error} If the argument is invalid or cannot be wrapped properly.
5686
5728
  */
5687
5729
  constructor(element) {
5688
- /** @private @type {Node | ChildNode | null} */
5689
- this._node = null;
5730
+ /** @private @type {Node | ChildNode | undefined} */
5731
+ this._node = undefined;
5690
5732
 
5691
5733
  /** @type {Element | undefined} */
5692
5734
  this._element = undefined;
5693
5735
 
5694
- /** @private @type {Array<Node> | undefined} a stable list on nodes */
5695
- this._nodes = undefined;
5736
+ /** @private @type {Array<Node>} a stable list on nodes */
5737
+ this._nodes = [];
5696
5738
 
5697
5739
  /** @type {boolean} */
5698
5740
  this._isList = false;
@@ -5810,7 +5852,9 @@
5810
5852
  if (this._isList) {
5811
5853
  return this._nodes[0];
5812
5854
  } else {
5813
- return this._element || this._node;
5855
+ return /** @type {Element | Node | ChildNode} */ (
5856
+ this._element || this._node
5857
+ );
5814
5858
  }
5815
5859
  }
5816
5860
 
@@ -5819,7 +5863,9 @@
5819
5863
  if (this._isList) {
5820
5864
  return this._nodes;
5821
5865
  } else {
5822
- return this._element || this._node;
5866
+ return /** @type {Element | Node | ChildNode} */ (
5867
+ this._element || this._node
5868
+ );
5823
5869
  }
5824
5870
  }
5825
5871
 
@@ -5828,7 +5874,9 @@
5828
5874
  if (this._isList) {
5829
5875
  return Array.from(this._nodes);
5830
5876
  } else {
5831
- return [this._element || this._node];
5877
+ return [
5878
+ /** @type {Element | Node | ChildNode} */ (this._element || this._node),
5879
+ ];
5832
5880
  }
5833
5881
  }
5834
5882
 
@@ -6984,10 +7032,29 @@
6984
7032
 
6985
7033
  const specialAttrHolder = document.createElement("div");
6986
7034
 
7035
+ /**
7036
+ * @extends {Record<string, any>}
7037
+ */
6987
7038
  class Attributes {
6988
7039
  static $nonscope = true;
6989
7040
 
6990
7041
  /**
7042
+ * Creates an Attributes instance.
7043
+ *
7044
+ * There are two construction modes:
7045
+ *
7046
+ * 1. **Fresh instance** (no `attributesToCopy`):
7047
+ * - Used when compiling a DOM element for the first time.
7048
+ * - Initializes a new `$attr` map to track normalized → DOM attribute names.
7049
+ *
7050
+ * 2. **Clone instance** (`attributesToCopy` provided):
7051
+ * - Used when cloning attributes for directive linking / child scopes.
7052
+ * - Performs a shallow copy of all properties from the source Attributes object,
7053
+ * including `$attr`, normalized attribute values, and internal fields
7054
+ * (e.g. `$$observers`).
7055
+ * - `$attr` is intentionally **not reinitialized** in this case, because the
7056
+ * source object already contains the correct normalized → DOM attribute mapping.
7057
+ *
6991
7058
  * @param {ng.AnimateService} $animate
6992
7059
  * @param {ng.ExceptionHandlerService} $exceptionHandler
6993
7060
  * @param {*} $sce
@@ -7008,16 +7075,20 @@
7008
7075
  this[key] = attributesToCopy[key];
7009
7076
  }
7010
7077
  } else {
7078
+ /**
7079
+ * A map of DOM element attribute names to the normalized name. This is needed
7080
+ * to do reverse lookup from normalized name back to actual name.
7081
+ */
7011
7082
  this.$attr = {};
7012
7083
  }
7013
7084
 
7014
7085
  /** @type {import("../../shared/noderef.js").NodeRef} */
7015
- this.$nodeRef = nodeRef;
7086
+ this._nodeRef = nodeRef;
7016
7087
  }
7017
7088
 
7018
7089
  /** @type {Node|Element} */
7019
7090
  get $$element() {
7020
- return this.$nodeRef.node;
7091
+ return this._nodeRef.node;
7021
7092
  }
7022
7093
 
7023
7094
  /**
@@ -7046,7 +7117,7 @@
7046
7117
  classVal,
7047
7118
  );
7048
7119
  } else {
7049
- this.$nodeRef.element.classList.add(classVal);
7120
+ this._nodeRef.element.classList.add(classVal);
7050
7121
  }
7051
7122
  }
7052
7123
  }
@@ -7065,7 +7136,7 @@
7065
7136
  classVal,
7066
7137
  );
7067
7138
  } else {
7068
- this.$nodeRef.element.classList.remove(classVal);
7139
+ this._nodeRef.element.classList.remove(classVal);
7069
7140
  }
7070
7141
  }
7071
7142
  }
@@ -7084,7 +7155,7 @@
7084
7155
  if (hasAnimate(this.$$element)) {
7085
7156
  this._$animate.addClass(/** @type {Element }*/ (this.$$element), toAdd);
7086
7157
  } else {
7087
- this.$nodeRef.element.classList.add(...toAdd.trim().split(/\s+/));
7158
+ this._nodeRef.element.classList.add(...toAdd.trim().split(/\s+/));
7088
7159
  }
7089
7160
  }
7090
7161
  const toRemove = tokenDifference(oldClasses, newClasses);
@@ -7096,7 +7167,7 @@
7096
7167
  toRemove,
7097
7168
  );
7098
7169
  } else {
7099
- this.$nodeRef.element.classList.remove(...toRemove.trim().split(/\s+/));
7170
+ this._nodeRef.element.classList.remove(...toRemove.trim().split(/\s+/));
7100
7171
  }
7101
7172
  }
7102
7173
  }
@@ -7144,7 +7215,7 @@
7144
7215
  }
7145
7216
  }
7146
7217
 
7147
- const nodeName = this.$nodeRef.node.nodeName.toLowerCase();
7218
+ const nodeName = this._nodeRef.node.nodeName.toLowerCase();
7148
7219
 
7149
7220
  let maybeSanitizedValue;
7150
7221
 
@@ -7205,6 +7276,7 @@
7205
7276
  }
7206
7277
 
7207
7278
  /**
7279
+ * @template T
7208
7280
  * Observes an interpolated attribute.
7209
7281
  *
7210
7282
  * The observer function will be invoked once during the next `$digest` following
@@ -7212,11 +7284,11 @@
7212
7284
  * changes.
7213
7285
  *
7214
7286
  * @param {string} key Normalized key. (ie ngAttribute) .
7215
- * @param {any} fn Function that will be called whenever
7287
+ * @param {(value?: T) => any} fn Function that will be called whenever
7216
7288
  the interpolated value of the attribute changes.
7217
7289
  * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
7218
7290
  * guide} for more info.
7219
- * @returns {function()} Returns a deregistration function for this observer.
7291
+ * @returns {Function} Returns a deregistration function for this observer.
7220
7292
  */
7221
7293
  $observe(key, fn) {
7222
7294
  const $$observers =
@@ -8370,7 +8442,7 @@
8370
8442
  * @param {Attributes|any} attrs The shared attrs object which is used to populate the normalized attributes.
8371
8443
  * @param {number=} maxPriority Max directive priority.
8372
8444
  * @param {string} [ignoreDirective]
8373
- * @return {import('../../interface.ts').Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
8445
+ * @return {ng.Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
8374
8446
  */
8375
8447
  function collectDirectives(node, attrs, maxPriority, ignoreDirective) {
8376
8448
  /**
@@ -8621,7 +8693,7 @@
8621
8693
 
8622
8694
  const { index } = previousCompileContext;
8623
8695
 
8624
- templateAttrs.$nodeRef = compileNodeRef;
8696
+ templateAttrs._nodeRef = compileNodeRef;
8625
8697
  let directive;
8626
8698
 
8627
8699
  let directiveName;
@@ -8672,7 +8744,7 @@
8672
8744
 
8673
8745
  if (compileNode === linkNode) {
8674
8746
  attrs = templateAttrs;
8675
- $element = templateAttrs.$nodeRef;
8747
+ $element = templateAttrs._nodeRef;
8676
8748
  } else {
8677
8749
  $element = new NodeRef(linkNode);
8678
8750
  attrs = new Attributes(
@@ -9098,7 +9170,7 @@
9098
9170
  terminalPriority = directive.priority;
9099
9171
  $template = compileNodeRef;
9100
9172
  compileNodeRef = new NodeRef(document.createComment(""));
9101
- templateAttrs.$nodeRef = compileNodeRef;
9173
+ templateAttrs._nodeRef = compileNodeRef;
9102
9174
  compileNode = compileNodeRef.node;
9103
9175
  ctxNodeRef.node = compileNode;
9104
9176
  replaceWith(
@@ -10797,13 +10869,13 @@
10797
10869
  * $nonscope: boolean,
10798
10870
  * $addControl: Function,
10799
10871
  * $getControls: () => any[],
10800
- * $$renameControl: Function,
10872
+ * _renameControl: Function,
10801
10873
  * $removeControl: Function,
10802
10874
  * $setValidity: Function | ((key: any, isValid: boolean, control: any) => any),
10803
10875
  * $setDirty: Function,
10804
10876
  * $setPristine: Function,
10805
10877
  * $setSubmitted: Function,
10806
- * $$setSubmitted: Function
10878
+ * _setSubmitted: Function
10807
10879
  * }}
10808
10880
  */
10809
10881
  const nullFormCtrl = {
@@ -10812,7 +10884,7 @@
10812
10884
  /* empty */
10813
10885
  },
10814
10886
  $getControls: () => [],
10815
- $$renameControl: (control, name) => {
10887
+ _renameControl: (control, name) => {
10816
10888
  control.$name = name;
10817
10889
  },
10818
10890
  $removeControl: () => {
@@ -10830,7 +10902,7 @@
10830
10902
  $setSubmitted: () => {
10831
10903
  /* empty */
10832
10904
  },
10833
- $$setSubmitted: () => {
10905
+ _setSubmitted: () => {
10834
10906
  /* empty */
10835
10907
  },
10836
10908
  };
@@ -10887,11 +10959,11 @@
10887
10959
  class FormController {
10888
10960
  static $nonscope = true;
10889
10961
  /* @ignore */ static $inject = [
10890
- "$element",
10891
- "$attrs",
10892
- "$scope",
10893
- "$animate",
10894
- "$interpolate",
10962
+ $injectTokens._element,
10963
+ $injectTokens._attrs,
10964
+ $injectTokens._scope,
10965
+ $injectTokens._animate,
10966
+ $injectTokens._interpolate,
10895
10967
  ];
10896
10968
 
10897
10969
  /**
@@ -10902,7 +10974,7 @@
10902
10974
  * @param {ng.InterpolateService} $interpolate
10903
10975
  */
10904
10976
  constructor($element, $attrs, $scope, $animate, $interpolate) {
10905
- this.$$controls = [];
10977
+ this._controls = [];
10906
10978
 
10907
10979
  this.$name = $interpolate($attrs.name || $attrs.ngForm || "")($scope);
10908
10980
 
@@ -10931,6 +11003,7 @@
10931
11003
 
10932
11004
  this.$$classCache[VALID_CLASS] = isValid;
10933
11005
  this.$$classCache[INVALID_CLASS] = !isValid;
11006
+ this.$target = {};
10934
11007
  }
10935
11008
 
10936
11009
  /**
@@ -10941,7 +11014,7 @@
10941
11014
  * a form that uses `ng-model-options` to pend updates.
10942
11015
  */
10943
11016
  $rollbackViewValue() {
10944
- this.$$controls.forEach((control) => {
11017
+ this._controls.forEach((control) => {
10945
11018
  control.$rollbackViewValue();
10946
11019
  });
10947
11020
  }
@@ -10954,7 +11027,7 @@
10954
11027
  * usually handles calling this in response to input events.
10955
11028
  */
10956
11029
  $commitViewValue() {
10957
- this.$$controls.forEach((control) => {
11030
+ this._controls.forEach((control) => {
10958
11031
  control.$commitViewValue();
10959
11032
  });
10960
11033
  }
@@ -10978,7 +11051,7 @@
10978
11051
  // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
10979
11052
  // and not added to the scope. Now we throw an error.
10980
11053
  assertNotHasOwnProperty(control.$name, "input");
10981
- this.$$controls.push(control);
11054
+ this._controls.push(control);
10982
11055
 
10983
11056
  if (control.$name) {
10984
11057
  this[control.$name] = control;
@@ -11000,13 +11073,14 @@
11000
11073
  * Likewise, adding a control to, or removing a control from the form is not reflected
11001
11074
  * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time
11002
11075
  * you need access to the controls.
11076
+ * @returns {ReadonlyArray<FormController>}
11003
11077
  */
11004
11078
  $getControls() {
11005
- return shallowCopy(this.$$controls);
11079
+ return shallowCopy(this._controls);
11006
11080
  }
11007
11081
 
11008
11082
  // Private API: rename a form control
11009
- $$renameControl(control, newName) {
11083
+ _renameControl(control, newName) {
11010
11084
  const oldName = control.$name;
11011
11085
 
11012
11086
  if (this[oldName] === control) {
@@ -11025,6 +11099,7 @@
11025
11099
  * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
11026
11100
  * different from case to case. For example, removing the only `$dirty` control from a form may or
11027
11101
  * may not mean that the form is still `$dirty`.
11102
+ * @param {FormController } control
11028
11103
  */
11029
11104
  $removeControl(control) {
11030
11105
  if (control.$name && this[control.$name] === control) {
@@ -11043,7 +11118,7 @@
11043
11118
  this.$setValidity(name, null, control);
11044
11119
  });
11045
11120
 
11046
- arrayRemove(this.$$controls, control);
11121
+ arrayRemove(this._controls, control);
11047
11122
 
11048
11123
  control.$target.$$parentForm = nullFormCtrl;
11049
11124
  }
@@ -11096,7 +11171,7 @@
11096
11171
  this.$dirty = false;
11097
11172
  this.$pristine = true;
11098
11173
  this.$submitted = false;
11099
- this.$$controls.forEach((control) => {
11174
+ this._controls.forEach((control) => {
11100
11175
  control.$setPristine();
11101
11176
  });
11102
11177
  }
@@ -11111,7 +11186,7 @@
11111
11186
  * back to its pristine state.
11112
11187
  */
11113
11188
  $setUntouched() {
11114
- this.$$controls.forEach((control) => {
11189
+ this._controls.forEach((control) => {
11115
11190
  control.$setUntouched();
11116
11191
  });
11117
11192
  }
@@ -11127,19 +11202,19 @@
11127
11202
  while (rootForm.$$parentForm && rootForm.$$parentForm !== nullFormCtrl) {
11128
11203
  rootForm = rootForm.$$parentForm;
11129
11204
  }
11130
- rootForm.$$setSubmitted();
11205
+ rootForm._setSubmitted();
11131
11206
  }
11132
11207
 
11133
- $$setSubmitted() {
11208
+ _setSubmitted() {
11134
11209
  if (hasAnimate(this.$$element)) {
11135
11210
  this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
11136
11211
  } else {
11137
11212
  this.$$element.classList.add(SUBMITTED_CLASS);
11138
11213
  }
11139
11214
  this.$submitted = true;
11140
- this.$$controls.forEach((control) => {
11141
- if (control.$$setSubmitted) {
11142
- control.$$setSubmitted();
11215
+ this._controls.forEach((control) => {
11216
+ if (control._setSubmitted) {
11217
+ control._setSubmitted();
11143
11218
  }
11144
11219
  });
11145
11220
  }
@@ -11457,7 +11532,7 @@
11457
11532
  attrParam.$observe(nameAttr, (newValue) => {
11458
11533
  if (controller.$name === newValue) return;
11459
11534
  scope.$target[controller.$name] = undefined;
11460
- controller.$$parentForm.$$renameControl(controller, newValue);
11535
+ controller.$$parentForm._renameControl(controller, newValue);
11461
11536
 
11462
11537
  if (
11463
11538
  scope.$target !== controller.$$parentForm &&
@@ -11680,12 +11755,12 @@
11680
11755
  */
11681
11756
 
11682
11757
  class NgModelController {
11683
- static $nonscope = true;
11758
+ /* @ignore */ static $nonscope = true;
11684
11759
  /* @ignore */ static $inject = [
11685
- "$scope",
11760
+ $injectTokens._scope,
11686
11761
  $injectTokens._exceptionHandler,
11687
- "$attrs",
11688
- "$element",
11762
+ $injectTokens._attrs,
11763
+ $injectTokens._element,
11689
11764
  $injectTokens._parse,
11690
11765
  $injectTokens._animate,
11691
11766
  $injectTokens._interpolate,
@@ -11717,19 +11792,19 @@
11717
11792
  /** @type {any} */
11718
11793
  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
11719
11794
 
11720
- /** @type {any} */
11795
+ /** @type {import("./interface.ts").ModelValidators} */
11721
11796
  this.$validators = {};
11722
11797
 
11723
- /** @type {any} */
11798
+ /** @type {import("./interface.ts").AsyncModelValidators} */
11724
11799
  this.$asyncValidators = {};
11725
11800
 
11726
- /** @type {Array<any>} */
11801
+ /** @type {Array<import("./interface.ts").ModelParser>} */
11727
11802
  this.$parsers = [];
11728
11803
 
11729
- /** @type {Array<any>} */
11804
+ /** @type {Array<import("./interface.ts").ModelFormatter>} */
11730
11805
  this.$formatters = [];
11731
11806
 
11732
- /** @type {Array<any>} */
11807
+ /** @type {Array<import("./interface.ts").ModelViewChangeListener>} */
11733
11808
  this.$viewChangeListeners = [];
11734
11809
 
11735
11810
  /** @type {boolean} */
@@ -11760,15 +11835,15 @@
11760
11835
  // Attach the correct context to the event handler function for updateOn
11761
11836
  this.$$updateEventHandler = this.$$updateEventHandler.bind(this);
11762
11837
 
11763
- this.$$parsedNgModel = $parse($attr.ngModel);
11764
- this.$$parsedNgModelAssign = this.$$parsedNgModel.assign;
11838
+ this._parsedNgModel = $parse($attr.ngModel);
11839
+ this._parsedNgModelAssign = this._parsedNgModel.assign;
11765
11840
 
11766
11841
  /**
11767
11842
  * @type {import("../../core/parse/interface.ts").CompiledExpression |
11768
11843
  * (function(ng.Scope): any)}
11769
11844
  */
11770
- this.$$ngModelGet = this.$$parsedNgModel;
11771
- this.$$ngModelSet = this.$$parsedNgModelAssign;
11845
+ this._ngModelGet = this._parsedNgModel;
11846
+ this._ngModelSet = this._parsedNgModelAssign;
11772
11847
  this.$$pendingDebounce = null;
11773
11848
  this.$$parserValid = undefined;
11774
11849
 
@@ -11917,8 +11992,8 @@
11917
11992
 
11918
11993
  const invokeModelSetter = this.$$parse(`${this.$$attr.ngModel}($$$p)`);
11919
11994
 
11920
- this.$$ngModelGet = ($scope) => {
11921
- let modelValue = this.$$parsedNgModel($scope);
11995
+ this._ngModelGet = ($scope) => {
11996
+ let modelValue = this._parsedNgModel($scope);
11922
11997
 
11923
11998
  if (isFunction(modelValue)) {
11924
11999
  modelValue = invokeModelGetter($scope);
@@ -11926,14 +12001,14 @@
11926
12001
 
11927
12002
  return modelValue;
11928
12003
  };
11929
- this.$$ngModelSet = ($scope, newValue) => {
11930
- if (isFunction(this.$$parsedNgModel($scope))) {
12004
+ this._ngModelSet = ($scope, newValue) => {
12005
+ if (isFunction(this._parsedNgModel($scope))) {
11931
12006
  invokeModelSetter($scope, { $$$p: newValue });
11932
12007
  } else {
11933
- this.$$parsedNgModelAssign($scope, newValue);
12008
+ this._parsedNgModelAssign($scope, newValue);
11934
12009
  }
11935
12010
  };
11936
- } else if (!this.$$parsedNgModel.assign) {
12011
+ } else if (!this._parsedNgModel.assign) {
11937
12012
  throw ngModelMinErr(
11938
12013
  "nonassign",
11939
12014
  "Expression '{0}' is non-assignable. Element: {1}",
@@ -12409,7 +12484,7 @@
12409
12484
  if (isNumberNaN(this.$modelValue)) {
12410
12485
  // this.$modelValue has not been touched yet...
12411
12486
  // @ts-ignore
12412
- this.$modelValue = this.$$ngModelGet(this.$$scope);
12487
+ this.$modelValue = this._ngModelGet(this.$$scope);
12413
12488
  }
12414
12489
  const prevModelValue = this.$modelValue;
12415
12490
 
@@ -12446,13 +12521,15 @@
12446
12521
  // intentional loose equality
12447
12522
  // eslint-disable-next-line eqeqeq
12448
12523
  if (that.$modelValue != prevModelValue) {
12524
+ if (isNull(that.$modelValue) && prevModelValue === "") return;
12525
+
12449
12526
  that.$$writeModelToScope();
12450
12527
  }
12451
12528
  }
12452
12529
  }
12453
12530
 
12454
12531
  $$writeModelToScope() {
12455
- this.$$ngModelSet(this.$$scope, this.$modelValue);
12532
+ this._ngModelSet(this.$$scope, this.$modelValue);
12456
12533
  Object.values(this.$viewChangeListeners).forEach((listener) => {
12457
12534
  try {
12458
12535
  listener();
@@ -12570,7 +12647,7 @@
12570
12647
  * **Note:** it is not possible to override the `getterSetter` option.
12571
12648
  * </div>
12572
12649
  *
12573
- * @param {Object} options a hash of settings to override the previous options
12650
+ * @param {import("../../interface.ts").NgModelOptions} options a hash of settings to override the previous options
12574
12651
  *
12575
12652
  */
12576
12653
  $overrideModelOptions(options) {
@@ -12769,7 +12846,7 @@
12769
12846
  // ng-change executes in apply phase
12770
12847
  // 4. view should be changed back to 'a'
12771
12848
  ctrl.$$scope.$watch("value", () => {
12772
- const modelValue = ctrl.$$ngModelGet(ctrl.$$scope);
12849
+ const modelValue = ctrl._ngModelGet(ctrl.$$scope);
12773
12850
 
12774
12851
  // if scope model value and ngModel value are out of sync
12775
12852
  // This cannot be moved to the action function, because it would not catch the
@@ -12818,7 +12895,7 @@
12818
12895
 
12819
12896
  attr.$observe("name", (newValue) => {
12820
12897
  if (modelCtrl.$name !== newValue) {
12821
- modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
12898
+ modelCtrl.$$parentForm._renameControl(modelCtrl, newValue);
12822
12899
  }
12823
12900
  });
12824
12901
  const deregisterWatch = scope.$watch(attr.ngModel, (val) => {
@@ -13988,6 +14065,40 @@
13988
14065
  };
13989
14066
  }
13990
14067
 
14068
+ /**
14069
+ * @param {Date} date
14070
+ * @param {any} timezone
14071
+ * @param {undefined} [reverse]
14072
+ */
14073
+ function convertTimezoneToLocal(date, timezone, reverse) {
14074
+ const doReverse = 1;
14075
+
14076
+ const dateTimezoneOffset = date.getTimezoneOffset();
14077
+
14078
+ const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
14079
+
14080
+ return addDateMinutes(
14081
+ date,
14082
+ doReverse * (timezoneOffset - dateTimezoneOffset),
14083
+ );
14084
+ }
14085
+
14086
+ const MS_PER_MINUTE = 60_000; // 60,000 ms in a minute
14087
+
14088
+ /**
14089
+ * @param {any} timezone
14090
+ * @param {number} [fallback]
14091
+ * @returns {number}
14092
+ */
14093
+ function timezoneToOffset(timezone, fallback) {
14094
+ const requestedTimezoneOffset =
14095
+ Date.parse(`Jan 01, 1970 00:00:00 ${timezone}`) / MS_PER_MINUTE;
14096
+
14097
+ return isNumberNaN(requestedTimezoneOffset)
14098
+ ? (fallback ?? 0)
14099
+ : requestedTimezoneOffset;
14100
+ }
14101
+
13991
14102
  scriptDirective.$inject = [$injectTokens._templateCache];
13992
14103
 
13993
14104
  /**
@@ -14017,8 +14128,6 @@
14017
14128
  "selectValueMap",
14018
14129
  "emptyOption",
14019
14130
  "optionsMap",
14020
- "$scope",
14021
- "$element",
14022
14131
  ];
14023
14132
 
14024
14133
  /**
@@ -14046,8 +14155,8 @@
14046
14155
  /** @type {boolean} */
14047
14156
  this.multiple = false;
14048
14157
 
14049
- /** @type {HTMLOptionElement} */
14050
- this.unknownOption = document.createElement("option");
14158
+ /** @private @type {HTMLOptionElement} */
14159
+ this._unknownOption = document.createElement("option");
14051
14160
 
14052
14161
  /** @type {boolean} */
14053
14162
  this.hasEmptyOption = false;
@@ -14079,10 +14188,10 @@
14079
14188
  renderUnknownOption(val) {
14080
14189
  const unknownVal = this.generateUnknownOptionValue(val);
14081
14190
 
14082
- this.unknownOption.value = unknownVal;
14083
- this.$element.prepend(this.unknownOption);
14084
- this.unknownOption.selected = true;
14085
- this.unknownOption.setAttribute("selected", "selected");
14191
+ this._unknownOption.value = unknownVal;
14192
+ this.$element.prepend(this._unknownOption);
14193
+ this._unknownOption.selected = true;
14194
+ this._unknownOption.setAttribute("selected", "selected");
14086
14195
  this.$element.value = unknownVal;
14087
14196
  }
14088
14197
 
@@ -14093,9 +14202,9 @@
14093
14202
  updateUnknownOption(val) {
14094
14203
  const unknownVal = this.generateUnknownOptionValue(val);
14095
14204
 
14096
- this.unknownOption.value = unknownVal;
14097
- this.unknownOption.selected = true;
14098
- this.unknownOption.setAttribute("selected", "selected");
14205
+ this._unknownOption.value = unknownVal;
14206
+ this._unknownOption.selected = true;
14207
+ this._unknownOption.setAttribute("selected", "selected");
14099
14208
  this.$element.value = unknownVal;
14100
14209
  }
14101
14210
 
@@ -14116,7 +14225,7 @@
14116
14225
  * Remove the unknown option from the select element if it exists.
14117
14226
  */
14118
14227
  removeUnknownOption() {
14119
- if (this.unknownOption.parentElement) this.unknownOption.remove();
14228
+ if (this._unknownOption.parentElement) this._unknownOption.remove();
14120
14229
  }
14121
14230
 
14122
14231
  /**
@@ -14241,7 +14350,7 @@
14241
14350
  * @returns {boolean} Whether the unknown option is currently selected.
14242
14351
  */
14243
14352
  $isUnknownOptionSelected() {
14244
- return this.$element.options[0] === this.unknownOption;
14353
+ return this.$element.options[0] === this._unknownOption;
14245
14354
  }
14246
14355
 
14247
14356
  /**
@@ -14262,7 +14371,7 @@
14262
14371
  if (isNullOrUndefined(value) && this.emptyOption) {
14263
14372
  this.removeUnknownOption();
14264
14373
  this.selectEmptyOption();
14265
- } else if (this.unknownOption.parentElement) {
14374
+ } else if (this._unknownOption.parentElement) {
14266
14375
  this.updateUnknownOption(value);
14267
14376
  } else {
14268
14377
  this.renderUnknownOption(value);
@@ -14421,7 +14530,7 @@
14421
14530
  }
14422
14531
 
14423
14532
  /**
14424
- * @returns {import('../../interface.ts').Directive}
14533
+ * @returns {ng.Directive}
14425
14534
  */
14426
14535
  function selectDirective() {
14427
14536
  return {
@@ -14644,7 +14753,9 @@
14644
14753
  scope.$watch(
14645
14754
  attr.ngBind,
14646
14755
  (value) => {
14647
- element.textContent = stringify$1(deProxy(value));
14756
+ element.textContent = /** @type {string} */ (
14757
+ stringify$1(deProxy(value))
14758
+ );
14648
14759
  },
14649
14760
  isDefined(attr.lazy),
14650
14761
  );
@@ -14653,17 +14764,17 @@
14653
14764
  }
14654
14765
 
14655
14766
  /**
14656
- * @returns {import('../../interface.ts').Directive}
14767
+ * @returns {ng.Directive}
14657
14768
  */
14658
14769
  function ngBindTemplateDirective() {
14659
14770
  return {
14660
14771
  /**
14661
14772
  * @param {ng.Scope} _scope
14662
14773
  * @param {Element} element
14663
- * @param {import('../../core/compile/attributes.js').Attributes} attr
14774
+ * @param {ng.Attributes} attr
14664
14775
  */
14665
14776
  link(_scope, element, attr) {
14666
- attr.$observe("ngBindTemplate", (value) => {
14777
+ attr.$observe("ngBindTemplate", (/** @type {string | null} */ value) => {
14667
14778
  element.textContent = isUndefined(value) ? "" : value;
14668
14779
  });
14669
14780
  },
@@ -14672,8 +14783,8 @@
14672
14783
 
14673
14784
  ngBindHtmlDirective.$inject = [$injectTokens._parse];
14674
14785
  /**
14675
- * @param {import('../../core/parse/interface.ts').ParseService} $parse
14676
- * @returns {import('../../interface.ts').Directive}
14786
+ * @param {ng.ParseService} $parse
14787
+ * @returns {ng.Directive}
14677
14788
  */
14678
14789
  function ngBindHtmlDirective($parse) {
14679
14790
  return {
@@ -14962,7 +15073,7 @@
14962
15073
 
14963
15074
  ngHideDirective.$inject = [$injectTokens._animate];
14964
15075
  /**
14965
- * @returns {import('../../interface.ts').Directive}
15076
+ * @returns {ng.Directive}
14966
15077
  */
14967
15078
  function ngHideDirective($animate) {
14968
15079
  return {
@@ -15004,7 +15115,7 @@
15004
15115
  * @param {Element} $element
15005
15116
  * @param {ng.Attributes} $attr
15006
15117
  * @param {*} _ctrl
15007
- * @param {*} $transclude
15118
+ * @param {ng.TranscludeFn} $transclude
15008
15119
  */
15009
15120
  link($scope, $element, $attr, _ctrl, $transclude) {
15010
15121
  /** @type {Element | null | undefined} */
@@ -15019,23 +15130,28 @@
15019
15130
  $scope.$watch($attr.ngIf, (value) => {
15020
15131
  if (value) {
15021
15132
  if (!childScope) {
15022
- $transclude((clone, newScope) => {
15023
- childScope = newScope;
15024
- // Note: We only need the first/last node of the cloned nodes.
15025
- // However, we need to keep the reference to the dom wrapper as it might be changed later
15026
- // by a directive with templateUrl when its template arrives.
15027
- block = clone;
15028
-
15029
- if (hasAnimate(clone)) {
15030
- $animate.enter(
15031
- clone,
15032
- /** @type {Element} */ ($element.parentElement),
15033
- $element,
15034
- );
15035
- } else {
15036
- $element.after(clone);
15037
- }
15038
- });
15133
+ $transclude(
15134
+ (
15135
+ /** @type {Element} */ clone,
15136
+ /** @type {ng.Scope} */ newScope,
15137
+ ) => {
15138
+ childScope = newScope;
15139
+ // Note: We only need the first/last node of the cloned nodes.
15140
+ // However, we need to keep the reference to the dom wrapper as it might be changed later
15141
+ // by a directive with templateUrl when its template arrives.
15142
+ block = clone;
15143
+
15144
+ if (hasAnimate(/** @type {Node} */ (clone))) {
15145
+ $animate.enter(
15146
+ /** @type {Element} */ (clone),
15147
+ /** @type {Element} */ ($element.parentElement),
15148
+ $element,
15149
+ );
15150
+ } else {
15151
+ $element.after(/** @type {Node} */ (clone));
15152
+ }
15153
+ },
15154
+ );
15039
15155
  }
15040
15156
  } else {
15041
15157
  if (previousElements) {
@@ -15231,7 +15347,7 @@
15231
15347
  }
15232
15348
 
15233
15349
  /**
15234
- * @returns {import('../../interface.ts').Directive}
15350
+ * @returns {ng.Directive}
15235
15351
  */
15236
15352
  function ngInitDirective() {
15237
15353
  return {
@@ -15253,7 +15369,7 @@
15253
15369
  }
15254
15370
 
15255
15371
  /**
15256
- * @returns {import('../../interface.ts').Directive}
15372
+ * @returns {ng.Directive}
15257
15373
  */
15258
15374
  function ngNonBindableDirective() {
15259
15375
  return {
@@ -15399,7 +15515,7 @@
15399
15515
  if (keyIdentifier) scope[keyIdentifier] = key;
15400
15516
 
15401
15517
  if (value) {
15402
- scope.$target.$$hashKey = value.$$hashKey;
15518
+ scope.$target._hashKey = value._hashKey;
15403
15519
  }
15404
15520
  scope.$index = index;
15405
15521
  scope.$first = index === 0;
@@ -15727,7 +15843,7 @@
15727
15843
 
15728
15844
  // asks for $scope to fool the BC controller module
15729
15845
  controller: [
15730
- "$scope",
15846
+ $injectTokens._scope,
15731
15847
  class {
15732
15848
  constructor() {
15733
15849
  this.cases = {};
@@ -15756,19 +15872,20 @@
15756
15872
 
15757
15873
  let ii;
15758
15874
 
15875
+ let runner;
15876
+
15759
15877
  // Start with the last, in case the array is modified during the loop
15760
15878
  while (previousLeaveAnimations.length) {
15761
15879
  $animate.cancel(previousLeaveAnimations.pop());
15762
15880
  }
15763
15881
 
15764
15882
  for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
15765
- const selected = getBlockNodes(selectedElements[i].clone);
15883
+ const selected = selectedElements[i].clone;
15766
15884
 
15767
15885
  selectedScopes[i].$destroy();
15768
15886
 
15769
15887
  if (hasAnimate(selected)) {
15770
- const runner = (previousLeaveAnimations[i] =
15771
- $animate.leave(selected));
15888
+ runner = previousLeaveAnimations[i] = $animate.leave(selected);
15772
15889
 
15773
15890
  runner.done(spliceFactory(previousLeaveAnimations, i));
15774
15891
  } else {
@@ -15798,7 +15915,13 @@
15798
15915
  selectedElements.push(block);
15799
15916
 
15800
15917
  if (hasAnimate(caseElement)) {
15801
- $animate.enter(caseElement, anchor.parentElement, anchor);
15918
+ if (runner) {
15919
+ requestAnimationFrame(() => {
15920
+ $animate.enter(caseElement, anchor.parentElement, anchor);
15921
+ });
15922
+ } else {
15923
+ $animate.enter(caseElement, anchor.parentElement, anchor);
15924
+ }
15802
15925
  } else {
15803
15926
  domInsert(caseElement, anchor.parentElement, anchor);
15804
15927
  }
@@ -15811,7 +15934,7 @@
15811
15934
  }
15812
15935
 
15813
15936
  /**
15814
- * @returns {import('../../interface.ts').Directive}
15937
+ * @returns {ng.Directive}
15815
15938
  */
15816
15939
  function ngSwitchWhenDirective() {
15817
15940
  return {
@@ -15841,7 +15964,7 @@
15841
15964
  }
15842
15965
 
15843
15966
  /**
15844
- * @returns {import('../../interface.ts').Directive}
15967
+ * @returns {ng.Directive}
15845
15968
  */
15846
15969
  function ngSwitchDefaultDirective() {
15847
15970
  return {
@@ -17471,13 +17594,21 @@
17471
17594
  *
17472
17595
  * @param {Element} element - the element which will be inserted into the DOM
17473
17596
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
17474
- * @param {Element} [after] - after the sibling element after which the element will be appended
17597
+ * @param {ChildNode | null | undefined} [after] - after the sibling element after which the element will be appended
17475
17598
  * @param {import("./interface.ts").AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
17476
17599
  * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
17477
17600
  */
17478
17601
  enter(element, parent, after, options) {
17479
17602
  parent = parent || after.parentElement;
17480
- animatedomInsert(element, parent, after);
17603
+
17604
+ if (
17605
+ isInstanceOf(element, HTMLElement) &&
17606
+ isInstanceOf(parent, HTMLElement)
17607
+ ) {
17608
+ animatedomInsert(element, parent, after);
17609
+ } else {
17610
+ domInsert(element, parent, after);
17611
+ }
17481
17612
 
17482
17613
  return $$animateQueue.push(
17483
17614
  element,
@@ -17500,7 +17631,15 @@
17500
17631
  */
17501
17632
  move(element, parent, after, options) {
17502
17633
  parent = parent || after.parentElement;
17503
- animatedomInsert(element, parent, after);
17634
+
17635
+ if (
17636
+ isInstanceOf(element, HTMLElement) &&
17637
+ isInstanceOf(parent, HTMLElement)
17638
+ ) {
17639
+ animatedomInsert(element, parent, after);
17640
+ } else {
17641
+ domInsert(element, parent, after);
17642
+ }
17504
17643
 
17505
17644
  return $$animateQueue.push(
17506
17645
  element,
@@ -17539,7 +17678,7 @@
17539
17678
  *
17540
17679
  * @param {Element} element the element which the CSS classes will be applied to
17541
17680
  * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
17542
- * @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
17681
+ * @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
17543
17682
  * @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
17544
17683
  */
17545
17684
  addClass(element, className, options) {
@@ -17559,7 +17698,7 @@
17559
17698
  *
17560
17699
  * @param {Element} element the element which the CSS classes will be applied to
17561
17700
  * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
17562
- * @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
17701
+ * @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
17563
17702
  * @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
17564
17703
  */
17565
17704
  removeClass(element, className, options) {
@@ -18181,55 +18320,6 @@
18181
18320
  }
18182
18321
  }
18183
18322
 
18184
- $IsStateFilter.$inject = [$injectTokens._state];
18185
-
18186
- /**
18187
- * `isState` Filter: truthy if the current state is the parameter
18188
- *
18189
- * Translates to [[StateService.is]] `$state.is("stateName")`.
18190
- *
18191
- * #### Example:
18192
- * ```html
18193
- * <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
18194
- * ```
18195
- *
18196
- * @param {import('./state/state-service.js').StateProvider} $state
18197
- * @returns {ng.FilterFn}
18198
- */
18199
- function $IsStateFilter($state) {
18200
- const isFilter = (state, params, options) =>
18201
- $state.is(state, params, options);
18202
-
18203
- isFilter.$stateful = true;
18204
-
18205
- return isFilter;
18206
- }
18207
-
18208
- $IncludedByStateFilter.$inject = [$injectTokens._state];
18209
-
18210
- /**
18211
- * `includedByState` Filter: truthy if the current state includes the parameter
18212
- *
18213
- * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
18214
- *
18215
- * #### Example:
18216
- * ```html
18217
- * <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
18218
- * ```
18219
- *
18220
- * @param {import('./state/state-service.js').StateProvider} $state
18221
- * @returns {ng.FilterFn}
18222
- */
18223
- function $IncludedByStateFilter($state) {
18224
- const includesFilter = function (state, params, options) {
18225
- return $state.includes(state, params, options);
18226
- };
18227
-
18228
- includesFilter.$stateful = true;
18229
-
18230
- return includesFilter;
18231
- }
18232
-
18233
18323
  /* @ignore */
18234
18324
  const SUFFIX = "Filter";
18235
18325
 
@@ -18253,8 +18343,6 @@
18253
18343
  json: jsonFilter,
18254
18344
  limitTo: limitToFilter,
18255
18345
  orderBy: orderByFilter,
18256
- isState: $IsStateFilter,
18257
- includedByState: $IncludedByStateFilter,
18258
18346
  }).forEach(([k, v]) =>
18259
18347
  this.register(k, /** @type {ng.FilterFactory} */ (v)),
18260
18348
  );
@@ -18378,9 +18466,9 @@
18378
18466
  : function (scope, locals) {
18379
18467
  let lastValue;
18380
18468
 
18381
- expressions.forEach((exp) => {
18382
- lastValue = exp(scope, locals);
18383
- });
18469
+ for (let i = 0, j = expressions.length; i < j; i++) {
18470
+ lastValue = expressions[i](scope, locals);
18471
+ }
18384
18472
 
18385
18473
  return lastValue;
18386
18474
  };
@@ -19027,7 +19115,7 @@
19027
19115
 
19028
19116
  let argsToWatch;
19029
19117
 
19030
- let isStatelessFilter;
19118
+ let isFilter;
19031
19119
 
19032
19120
  const decoratedNode = /** @type {DecoratedASTNode} */ (ast);
19033
19121
 
@@ -19158,10 +19246,8 @@
19158
19246
 
19159
19247
  return decoratedNode;
19160
19248
  case ASTType._CallExpression:
19161
- isStatelessFilter = ast.filter
19162
- ? isStateless($filter, ast.callee.name)
19163
- : false;
19164
- allConstants = isStatelessFilter;
19249
+ isFilter = ast.filter;
19250
+ allConstants = isFilter;
19165
19251
  argsToWatch = [];
19166
19252
  ast.arguments.forEach((expr) => {
19167
19253
  decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
@@ -19169,7 +19255,7 @@
19169
19255
  argsToWatch.push.apply(argsToWatch, decorated.toWatch);
19170
19256
  });
19171
19257
  decoratedNode.constant = allConstants;
19172
- decoratedNode.toWatch = isStatelessFilter ? argsToWatch : [decoratedNode];
19258
+ decoratedNode.toWatch = isFilter ? argsToWatch : [decoratedNode];
19173
19259
 
19174
19260
  return decoratedNode;
19175
19261
  case ASTType._AssignmentExpression:
@@ -19316,12 +19402,6 @@
19316
19402
  return undefined === parentIsPure ? PURITY_RELATIVE : parentIsPure;
19317
19403
  }
19318
19404
 
19319
- function isStateless($filter, filterName) {
19320
- const fn = $filter(filterName);
19321
-
19322
- return !fn.$stateful;
19323
- }
19324
-
19325
19405
  /**
19326
19406
  * Converts parameter to strings property name for use as keys in an object.
19327
19407
  * Any non-string object, including a number, is typecasted into a string via the toString method.
@@ -20363,7 +20443,7 @@
20363
20443
  const fn = this._astCompiler.compile(ast);
20364
20444
 
20365
20445
  fn.literal = isLiteral(ast);
20366
- fn.constant = isConstant(ast);
20446
+ fn.constant = !!ast.constant;
20367
20447
 
20368
20448
  return fn;
20369
20449
  }
@@ -20381,18 +20461,25 @@
20381
20461
  }
20382
20462
  }
20383
20463
 
20464
+ /**
20465
+ * @param {import("../ast/ast-node.d.ts").ASTNode} ast
20466
+ * @returns {boolean}
20467
+ */
20384
20468
  function isLiteral(ast) {
20385
- return (
20386
- ast.body.length === 0 ||
20387
- (ast.body.length === 1 &&
20388
- (ast.body[0].expression.type === ASTType._Literal ||
20389
- ast.body[0].expression.type === ASTType._ArrayExpression ||
20390
- ast.body[0].expression.type === ASTType._ObjectExpression))
20391
- );
20392
- }
20469
+ const { body } = ast;
20393
20470
 
20394
- function isConstant(ast) {
20395
- return ast.constant;
20471
+ if (body && body.length === 1) {
20472
+ switch (body[0].expression?.type) {
20473
+ case ASTType._Literal:
20474
+ case ASTType._ArrayExpression:
20475
+ case ASTType._ObjectExpression:
20476
+ return true;
20477
+ default:
20478
+ return false;
20479
+ }
20480
+ } else {
20481
+ return true;
20482
+ }
20396
20483
  }
20397
20484
 
20398
20485
  class ParseProvider {
@@ -20437,7 +20524,7 @@
20437
20524
  /**
20438
20525
  *
20439
20526
  * @param {(any) => any} $filter
20440
- * @returns {import('./interface').ParseService}
20527
+ * @returns {import('./interface.ts').ParseService}
20441
20528
  */
20442
20529
  function ($filter) {
20443
20530
  /** @type {import("./lexer/lexer.js").LexerOptions} */
@@ -20488,7 +20575,7 @@
20488
20575
  /**
20489
20576
  * @param {Function} parsedExpression
20490
20577
  * @param interceptorFn
20491
- * @returns {import('./interface').CompiledExpression|*}
20578
+ * @returns {import('./interface.ts').CompiledExpression|*}
20492
20579
  */
20493
20580
  function addInterceptor(parsedExpression, interceptorFn) {
20494
20581
  if (!interceptorFn) {
@@ -20617,7 +20704,7 @@
20617
20704
  * @param {ng.Scope} scope
20618
20705
  * @param {Function} listener
20619
20706
  * @param {*} objectEquality
20620
- * @param {import('./interface').CompiledExpression} parsedExpression
20707
+ * @param {import('./interface.ts').CompiledExpression} parsedExpression
20621
20708
  * @returns {any}
20622
20709
  */
20623
20710
  function inputsWatchDelegate(
@@ -21184,19 +21271,19 @@
21184
21271
  * The pathname, beginning with "/"
21185
21272
  * @type {string}
21186
21273
  */
21187
- let $$path;
21274
+ let _path;
21188
21275
 
21189
21276
  /**
21190
- * @type {Object.<string,boolean|Array>}
21277
+ * @type {Object.<string,boolean|Array<any>>}
21191
21278
  */
21192
- let $$search;
21279
+ let _search;
21193
21280
 
21194
21281
  /**
21195
21282
  * @ignore
21196
21283
  * The hash string, minus the hash symbol
21197
21284
  * @type {string}
21198
21285
  */
21199
- let $$hash;
21286
+ let _hash;
21200
21287
 
21201
21288
  class Location {
21202
21289
  /**
@@ -21233,14 +21320,14 @@
21233
21320
  * Current url
21234
21321
  * @type {string}
21235
21322
  */
21236
- this.$$url = undefined;
21323
+ this._url = undefined;
21237
21324
 
21238
21325
  /**
21239
21326
  * @ignore
21240
21327
  * Callback to update browser url
21241
- * @type {Function}
21328
+ * @type {Function | undefined}
21242
21329
  */
21243
- this.$$updateBrowser = undefined;
21330
+ this._updateBrowser = undefined;
21244
21331
  }
21245
21332
 
21246
21333
  /**
@@ -21271,7 +21358,7 @@
21271
21358
  * @return {string} url
21272
21359
  */
21273
21360
  getUrl() {
21274
- return this.$$url;
21361
+ return this._url;
21275
21362
  }
21276
21363
 
21277
21364
  /**
@@ -21283,8 +21370,8 @@
21283
21370
  setPath(path) {
21284
21371
  const newPath = path !== null ? path.toString() : "";
21285
21372
 
21286
- $$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
21287
- this.$$compose();
21373
+ _path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
21374
+ this._compose();
21288
21375
 
21289
21376
  return this;
21290
21377
  }
@@ -21296,7 +21383,7 @@
21296
21383
  * @return {string}
21297
21384
  */
21298
21385
  getPath() {
21299
- return $$path;
21386
+ return _path;
21300
21387
  }
21301
21388
 
21302
21389
  /**
@@ -21305,8 +21392,8 @@
21305
21392
  * @return {Location} hash
21306
21393
  */
21307
21394
  setHash(hash) {
21308
- $$hash = hash !== null ? hash.toString() : "";
21309
- this.$$compose();
21395
+ _hash = hash !== null ? hash.toString() : "";
21396
+ this._compose();
21310
21397
 
21311
21398
  return this;
21312
21399
  }
@@ -21316,7 +21403,7 @@
21316
21403
  * @return {string} hash
21317
21404
  */
21318
21405
  getHash() {
21319
- return $$hash;
21406
+ return _hash;
21320
21407
  }
21321
21408
 
21322
21409
  /**
@@ -21331,7 +21418,7 @@
21331
21418
  case 1:
21332
21419
  if (isString(search) || isNumber(search)) {
21333
21420
  search = search.toString();
21334
- $$search = parseKeyValue(search);
21421
+ _search = parseKeyValue(search);
21335
21422
  } else if (isObject(search)) {
21336
21423
  search = structuredClone(search, {});
21337
21424
  // remove object undefined or null properties
@@ -21339,7 +21426,7 @@
21339
21426
  if (isNull(value)) delete search[key];
21340
21427
  });
21341
21428
 
21342
- $$search = search;
21429
+ _search = search;
21343
21430
  } else {
21344
21431
  throw $locationMinErr(
21345
21432
  "isrcharg",
@@ -21349,14 +21436,14 @@
21349
21436
  break;
21350
21437
  default:
21351
21438
  if (isUndefined(paramValue) || paramValue === null) {
21352
- delete $$search[search];
21439
+ delete _search[search];
21353
21440
  } else {
21354
21441
  // @ts-ignore
21355
- $$search[search] = paramValue;
21442
+ _search[search] = paramValue;
21356
21443
  }
21357
21444
  }
21358
21445
 
21359
- this.$$compose();
21446
+ this._compose();
21360
21447
 
21361
21448
  return this;
21362
21449
  }
@@ -21367,20 +21454,20 @@
21367
21454
  * @returns {Object} Search object or Location object
21368
21455
  */
21369
21456
  getSearch() {
21370
- return $$search;
21457
+ return _search;
21371
21458
  }
21372
21459
 
21373
21460
  /**
21374
21461
  * @private
21375
21462
  * Compose url and update `url` and `absUrl` property
21376
21463
  */
21377
- $$compose() {
21378
- this.$$url = normalizePath($$path, $$search, $$hash);
21464
+ _compose() {
21465
+ this._url = normalizePath(_path, _search, _hash);
21379
21466
  this.absUrl = this.html5
21380
- ? this.appBaseNoFile + this.$$url.substring(1)
21381
- : this.appBase + (this.$$url ? this.hashPrefix + this.$$url : "");
21467
+ ? this.appBaseNoFile + this._url.substring(1)
21468
+ : this.appBase + (this._url ? this.hashPrefix + this._url : "");
21382
21469
  urlUpdatedByLocation = true;
21383
- setTimeout(() => this.$$updateBrowser && this.$$updateBrowser());
21470
+ setTimeout(() => this._updateBrowser && this._updateBrowser());
21384
21471
  }
21385
21472
 
21386
21473
  /**
@@ -21491,11 +21578,11 @@
21491
21578
 
21492
21579
  parseAppUrl(pathUrl, true);
21493
21580
 
21494
- if (!$$path) {
21495
- $$path = "/";
21581
+ if (!_path) {
21582
+ _path = "/";
21496
21583
  }
21497
21584
 
21498
- this.$$compose();
21585
+ this._compose();
21499
21586
  } else {
21500
21587
  const withoutBaseUrl =
21501
21588
  stripBaseUrl(this.appBase, url) ||
@@ -21529,9 +21616,9 @@
21529
21616
 
21530
21617
  parseAppUrl(withoutHashUrl, false);
21531
21618
 
21532
- $$path = removeWindowsDriveName($$path, withoutHashUrl, this.appBase);
21619
+ _path = removeWindowsDriveName(_path, withoutHashUrl, this.appBase);
21533
21620
 
21534
- this.$$compose();
21621
+ this._compose();
21535
21622
 
21536
21623
  /*
21537
21624
  * In Windows, on an anchor node on documents loaded from
@@ -21581,16 +21668,17 @@
21581
21668
  rewriteLinks: true,
21582
21669
  };
21583
21670
 
21584
- /** @type {Array<import("./interface.ts").UrlChangeListener>} */
21585
- this.urlChangeListeners = [];
21586
- this.urlChangeInit = false;
21587
-
21588
- /** @type {History['state']} */
21589
- this.cachedState = null;
21590
- /** @type {History['state']} */
21591
- this.lastHistoryState = null;
21592
- /** @type {string} */
21593
- this.lastBrowserUrl = window.location.href;
21671
+ /** @private @type {Array<import("./interface.ts").UrlChangeListener>} */
21672
+ this._urlChangeListeners = [];
21673
+ /** @private */
21674
+ this._urlChangeInit = false;
21675
+
21676
+ /** @private @type {History['state']} */
21677
+ this._cachedState = null;
21678
+ /** @private @type {History['state']} */
21679
+ this._lastHistoryState = null;
21680
+ /** @private @type {string} */
21681
+ this._lastBrowserUrl = window.location.href;
21594
21682
  this.cacheState();
21595
21683
  }
21596
21684
 
@@ -21613,12 +21701,12 @@
21613
21701
  if (url) {
21614
21702
  url = new URL(url).href;
21615
21703
 
21616
- if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
21704
+ if (this._lastBrowserUrl === url && this._lastHistoryState === state) {
21617
21705
  return this;
21618
21706
  }
21619
21707
 
21620
- this.lastBrowserUrl = url;
21621
- this.lastHistoryState = state;
21708
+ this._lastBrowserUrl = url;
21709
+ this._lastHistoryState = state;
21622
21710
  history.pushState(state, "", url);
21623
21711
  this.cacheState();
21624
21712
  }
@@ -21639,7 +21727,7 @@
21639
21727
  * @returns {History['state']} The cached state.
21640
21728
  */
21641
21729
  state() {
21642
- return this.cachedState;
21730
+ return this._cachedState;
21643
21731
  }
21644
21732
 
21645
21733
  /**
@@ -21651,9 +21739,9 @@
21651
21739
  const currentState = history.state ?? null;
21652
21740
 
21653
21741
  if (!equals$1(currentState, this.lastCachedState)) {
21654
- this.cachedState = currentState;
21742
+ this._cachedState = currentState;
21655
21743
  this.lastCachedState = currentState;
21656
- this.lastHistoryState = currentState;
21744
+ this._lastHistoryState = currentState;
21657
21745
  }
21658
21746
  }
21659
21747
 
@@ -21661,20 +21749,20 @@
21661
21749
  * Fires the state or URL change event.
21662
21750
  */
21663
21751
  #fireStateOrUrlChange() {
21664
- const prevLastHistoryState = this.lastHistoryState;
21752
+ const prevLastHistoryState = this._lastHistoryState;
21665
21753
 
21666
21754
  this.cacheState();
21667
21755
 
21668
21756
  if (
21669
- this.lastBrowserUrl === this.getBrowserUrl() &&
21670
- prevLastHistoryState === this.cachedState
21757
+ this._lastBrowserUrl === this.getBrowserUrl() &&
21758
+ prevLastHistoryState === this._cachedState
21671
21759
  ) {
21672
21760
  return;
21673
21761
  }
21674
- this.lastBrowserUrl = this.getBrowserUrl();
21675
- this.lastHistoryState = this.cachedState;
21676
- this.urlChangeListeners.forEach((listener) => {
21677
- listener(trimEmptyHash(window.location.href), this.cachedState);
21762
+ this._lastBrowserUrl = this.getBrowserUrl();
21763
+ this._lastHistoryState = this._cachedState;
21764
+ this._urlChangeListeners.forEach((listener) => {
21765
+ listener(trimEmptyHash(window.location.href), this._cachedState);
21678
21766
  });
21679
21767
  }
21680
21768
 
@@ -21685,7 +21773,7 @@
21685
21773
  * @returns void
21686
21774
  */
21687
21775
  #onUrlChange(callback) {
21688
- if (!this.urlChangeInit) {
21776
+ if (!this._urlChangeInit) {
21689
21777
  window.addEventListener(
21690
21778
  "popstate",
21691
21779
  this.#fireStateOrUrlChange.bind(this),
@@ -21694,9 +21782,9 @@
21694
21782
  "hashchange",
21695
21783
  this.#fireStateOrUrlChange.bind(this),
21696
21784
  );
21697
- this.urlChangeInit = true;
21785
+ this._urlChangeInit = true;
21698
21786
  }
21699
- this.urlChangeListeners.push(callback);
21787
+ this._urlChangeListeners.push(callback);
21700
21788
  }
21701
21789
 
21702
21790
  $get = [
@@ -21932,12 +22020,16 @@
21932
22020
  }
21933
22021
  };
21934
22022
 
21935
- $location.$$updateBrowser = updateBrowser;
22023
+ $location._updateBrowser = updateBrowser;
21936
22024
  updateBrowser();
21937
22025
  $rootScope.$on("$updateBrowser", updateBrowser);
21938
22026
 
21939
22027
  return $location;
21940
22028
 
22029
+ /**
22030
+ * @param {string} oldUrl
22031
+ * @param {any} oldState
22032
+ */
21941
22033
  function afterLocationChange(oldUrl, oldState) {
21942
22034
  $rootScope.$broadcast(
21943
22035
  "$locationChangeSuccess",
@@ -22091,13 +22183,13 @@
22091
22183
  ? match.pathname.substring(1)
22092
22184
  : match.pathname;
22093
22185
 
22094
- $$path = decodePath(path, html5Mode);
22095
- $$search = parseKeyValue(match.search);
22096
- $$hash = decodeURIComponent(match.hash);
22186
+ _path = decodePath(path, html5Mode);
22187
+ _search = parseKeyValue(match.search);
22188
+ _hash = decodeURIComponent(match.hash);
22097
22189
 
22098
22190
  // make sure path starts with '/';
22099
- if ($$path && $$path.charAt(0) !== "/") {
22100
- $$path = `/${$$path}`;
22191
+ if (_path && _path.charAt(0) !== "/") {
22192
+ _path = `/${_path}`;
22101
22193
  }
22102
22194
  }
22103
22195
 
@@ -22257,7 +22349,8 @@
22257
22349
  * @param {string} type
22258
22350
  */
22259
22351
  _consoleLog(type) {
22260
- const console = window.console || {};
22352
+ const console =
22353
+ window.console || /** @type {Partial<Record<string, Function>>} */ ({});
22261
22354
 
22262
22355
  const logFn =
22263
22356
  console[type] ||
@@ -22266,7 +22359,7 @@
22266
22359
  /* empty */
22267
22360
  });
22268
22361
 
22269
- return (...args) => {
22362
+ return (/** @type {any[]} */ ...args) => {
22270
22363
  const formattedArgs = args.map((arg) => this._formatError(arg));
22271
22364
 
22272
22365
  return logFn.apply(console, formattedArgs);
@@ -22781,7 +22874,7 @@
22781
22874
  let scheduled = foreignListeners;
22782
22875
 
22783
22876
  // filter for repeaters
22784
- const hashKey = this.$target.$$hashKey;
22877
+ const hashKey = this.$target._hashKey;
22785
22878
 
22786
22879
  if (hashKey) {
22787
22880
  scheduled = [];
@@ -22789,7 +22882,7 @@
22789
22882
  for (let i = 0, l = foreignListeners.length; i < l; i++) {
22790
22883
  const listener = foreignListeners[i];
22791
22884
 
22792
- if (listener.originalTarget.$$hashKey === hashKey) {
22885
+ if (listener.originalTarget._hashKey === hashKey) {
22793
22886
  scheduled.push(listener);
22794
22887
  }
22795
22888
  }
@@ -24253,7 +24346,7 @@
24253
24346
  if (isString(html) && !html.trim()) ; else {
24254
24347
  // Non-empty template - compile and link
24255
24348
  $compile(html)($scope, (contents) => {
24256
- isIntanceOf(contents, Node) && element.after(contents);
24349
+ isInstanceOf(contents, Node) && element.after(contents);
24257
24350
  });
24258
24351
  }
24259
24352
  });
@@ -24404,11 +24497,7 @@
24404
24497
  ];
24405
24498
 
24406
24499
  const isNodeOneOf = function (elem, nodeTypeArray) {
24407
- if (nodeTypeArray.indexOf(elem.nodeName) !== -1) {
24408
- return true;
24409
- }
24410
-
24411
- return false;
24500
+ return nodeTypeArray.indexOf(elem.nodeName) !== -1;
24412
24501
  };
24413
24502
 
24414
24503
  /**
@@ -27646,7 +27735,7 @@
27646
27735
  _nextTick() {
27647
27736
  if (!this._queue.length) return;
27648
27737
 
27649
- const items = this._queue.shift();
27738
+ const items = /** @type{Array<() => void>} */ (this._queue.shift());
27650
27739
 
27651
27740
  items.forEach((fn) => fn());
27652
27741
 
@@ -28583,7 +28672,7 @@
28583
28672
  /**
28584
28673
  * Returns the last element of an array, or undefined if the array is empty.
28585
28674
  * @template T
28586
- * @param {T[]} arr - The input array.
28675
+ * @param {any[]|string} arr - The input array.
28587
28676
  * @returns {T | undefined} The last element or undefined.
28588
28677
  */
28589
28678
  function tail(arr) {
@@ -28654,16 +28743,16 @@
28654
28743
  *
28655
28744
  * ```
28656
28745
  *
28657
- * @param fn
28746
+ * @param {Function} fn
28658
28747
  * @returns {*|function(): (*|any)}
28659
28748
  */
28660
28749
  function curry(fn) {
28661
- const curried = (...args) => {
28750
+ const curried = (/** @type {any[]} */ ...args) => {
28662
28751
  if (args.length >= fn.length) {
28663
28752
  return fn(...args);
28664
28753
  }
28665
28754
 
28666
- return (...nextArgs) => curried(...args, ...nextArgs);
28755
+ return (/** @type {any} */ ...nextArgs) => curried(...args, ...nextArgs);
28667
28756
  };
28668
28757
 
28669
28758
  return curried;
@@ -28676,7 +28765,13 @@
28676
28765
  * let getName = propEq("name", "blarg");
28677
28766
  * getName(obj) === true
28678
28767
  */
28679
- const propEq = curry((name, _val, obj) => obj && obj[name] === _val);
28768
+ const propEq = curry(
28769
+ (
28770
+ /** @type {string | number} */ name,
28771
+ /** @type {any} */ _val,
28772
+ /** @type {{ [x: string]: any; }} */ obj,
28773
+ ) => obj && obj[name] === _val,
28774
+ );
28680
28775
  /**
28681
28776
  * Given a dotted property name, returns a function that returns a nested property from an object, or undefined
28682
28777
  * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, };
@@ -28685,10 +28780,11 @@
28685
28780
  * let propNotFound = prop("this.property.doesnt.exist");
28686
28781
  * propNotFound(obj) === undefined
28687
28782
  */
28688
- const parse = (path) => {
28783
+ const parse = (/** @type {string} */ path) => {
28689
28784
  const parts = path.split(".");
28690
28785
 
28691
- return (obj) => parts.reduce((acc, key) => acc && acc[key], obj);
28786
+ return (/** @type {any} */ obj) =>
28787
+ parts.reduce((acc, key) => acc && acc[key], obj);
28692
28788
  };
28693
28789
 
28694
28790
  /**
@@ -28713,7 +28809,12 @@
28713
28809
  };
28714
28810
  }
28715
28811
 
28716
- /** Given a value, returns a function which returns the value */
28812
+ /**
28813
+ * Given a value, returns a function which returns that value.
28814
+ * @template T
28815
+ * @param {T} value - The value to wrap in a function.
28816
+ * @returns {() => T} A function that returns the given value.
28817
+ */
28717
28818
  const val = (value) => () => value;
28718
28819
 
28719
28820
  /**
@@ -28730,31 +28831,28 @@
28730
28831
  * of size 2: [ predicate, mapFn ]
28731
28832
  *
28732
28833
  * These 2-tuples should be put in an outer array.
28733
- *
28734
- * @example
28735
- * ```
28736
- *
28737
- * // Here's a 2-tuple where the first element is the isString predicate
28738
- * // and the second element is a function that returns a description of the input
28739
- * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
28740
- *
28741
- * // Second tuple: predicate "isNumber", mapfn returns a description
28742
- * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
28743
- *
28744
- * let third = [ (input) => input === null, (input) => `Oh, null...` ];
28745
- *
28746
- * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
28747
- *
28748
- * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
28749
- *
28750
- * console.log(descriptionOf(undefined)); // 'notdefined'
28751
- * console.log(descriptionOf(55)); // '(55) That's a number!'
28752
- * console.log(descriptionOf("foo")); // 'Here's your string foo'
28753
- * ```
28754
- *
28755
- * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
28756
- * with a Predicate and a mapping/output function
28757
- * @returns {function(any): *}
28834
+ * @example ```
28835
+
28836
+ // Here's a 2-tuple where the first element is the isString predicate
28837
+ // and the second element is a function that returns a description of the input
28838
+ let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
28839
+
28840
+ // Second tuple: predicate "isNumber", mapfn returns a description
28841
+ let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
28842
+
28843
+ let third = [ (input) => input === null, (input) => `Oh, null...` ];
28844
+
28845
+ let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
28846
+
28847
+ let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
28848
+
28849
+ console.log(descriptionOf(undefined)); // 'notdefined'
28850
+ console.log(descriptionOf(55)); // '(55) That's a number!'
28851
+ console.log(descriptionOf("foo")); // 'Here's your string foo'
28852
+ ```
28853
+ * @param {string | any[]} struct A 2D array. Each element of the array should be an array, a 2-tuple,
28854
+ with a Predicate and a mapping/output function
28855
+ * @returns {function(any):*}
28758
28856
  */
28759
28857
  function pattern(struct) {
28760
28858
  return function (item) {
@@ -29414,17 +29512,23 @@
29414
29512
  /**
29415
29513
  * @type {number}
29416
29514
  */
29417
- this.lastStartedTransitionId = -1;
29515
+ this._lastStartedTransitionId = -1;
29418
29516
 
29419
29517
  /**
29420
29518
  * @type {Queue<import("./transition/transition.js").Transition>}
29421
29519
  */
29422
- this.transitionHistory = new Queue([], 1);
29520
+ this._transitionHistory = new Queue(
29521
+ /** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
29522
+ 1,
29523
+ );
29423
29524
 
29424
29525
  /**
29425
29526
  * @type {Queue<import("./transition/transition.js").Transition>}
29426
29527
  */
29427
- this.successfulTransitions = new Queue([], 1);
29528
+ this._successfulTransitions = new Queue(
29529
+ /** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
29530
+ 1,
29531
+ );
29428
29532
 
29429
29533
  /**
29430
29534
  * @type {import("./state/interface.ts").StateDeclaration|undefined}
@@ -29523,10 +29627,17 @@
29523
29627
  return (_fn && _fn.toString()) || "undefined";
29524
29628
  }
29525
29629
 
29630
+ /**
29631
+ * @param {any} value
29632
+ * @returns {string|*|string}
29633
+ */
29526
29634
  function stringify(value) {
29635
+ /**
29636
+ * @type {any[]}
29637
+ */
29527
29638
  const seen = [];
29528
29639
 
29529
- const isRejection = (obj) => {
29640
+ const isRejection = (/** @type {Promise<any>} */ obj) => {
29530
29641
  return (
29531
29642
  obj &&
29532
29643
  typeof obj.then === "function" &&
@@ -29534,7 +29645,9 @@
29534
29645
  );
29535
29646
  };
29536
29647
 
29537
- const hasToString = (obj) =>
29648
+ const hasToString = (
29649
+ /** @type {{ constructor: ObjectConstructor; toString: any; }} */ obj,
29650
+ ) =>
29538
29651
  isObject(obj) &&
29539
29652
  !isArray(obj) &&
29540
29653
  obj.constructor !== Object &&
@@ -29544,12 +29657,23 @@
29544
29657
  [isUndefined, val("undefined")],
29545
29658
  [isNull, val("null")],
29546
29659
  [isPromise, val("[Promise]")],
29547
- [isRejection, (reg) => reg._transitionRejection.toString()],
29548
- [hasToString, (str) => str.toString()],
29660
+ [
29661
+ isRejection,
29662
+ (
29663
+ /** @type {{ _transitionRejection: { toString: () => any; }; }} */ reg,
29664
+ ) => reg._transitionRejection.toString(),
29665
+ ],
29666
+ [
29667
+ hasToString,
29668
+ (/** @type {{ toString: () => any; }} */ str) => str.toString(),
29669
+ ],
29549
29670
  [isInjectable, functionToString],
29550
- [val(true), (bool) => bool],
29671
+ [val(true), (/** @type {any} */ bool) => bool],
29551
29672
  ]);
29552
29673
 
29674
+ /**
29675
+ * @param {any} item
29676
+ */
29553
29677
  function format(item) {
29554
29678
  if (isObject(item)) {
29555
29679
  if (seen.indexOf(item) !== -1) return "[circular ref]";
@@ -29572,7 +29696,9 @@
29572
29696
  );
29573
29697
  }
29574
29698
 
29575
- const stripLastPathElement = (str) => str.replace(/\/[^/]*$/, "");
29699
+ const stripLastPathElement = (/** @type {string} */ str) =>
29700
+ str.replace(/\/[^/]*$/, "");
29701
+
29576
29702
  /**
29577
29703
  * Splits on a delimiter, but returns the delimiters in the array
29578
29704
  *
@@ -29582,12 +29708,14 @@
29582
29708
  * splitOnSlashes("/foo"); // ["/", "foo"]
29583
29709
  * splitOnSlashes("/foo/"); // ["/", "foo", "/"]
29584
29710
  * ```
29711
+ * @param {string} delim
29585
29712
  */
29586
29713
  function splitOnDelim(delim) {
29587
29714
  const re = new RegExp(`(${delim})`, "g");
29588
29715
 
29589
- return (str) => str.split(re).filter(Boolean);
29716
+ return (/** @type {string} */ str) => str.split(re).filter(Boolean);
29590
29717
  }
29718
+
29591
29719
  /**
29592
29720
  * Reduce fn that joins neighboring strings
29593
29721
  *
@@ -29599,10 +29727,12 @@
29599
29727
  * let arr = ["foo", "bar", 1, "baz", "", "qux" ];
29600
29728
  * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
29601
29729
  * ```
29730
+ * @param {string | any[]} acc
29731
+ * @param {unknown} str
29602
29732
  */
29603
29733
  function joinNeighborsR(acc, str) {
29604
- if (isString(tail(acc)) && isString(str))
29605
- return acc.slice(0, -1).concat(tail(acc) + str);
29734
+ if (isString(tail(/** @type {string} */ (acc))) && isString(str))
29735
+ return acc.slice(0, -1).concat(tail(/** @type {string} */ (acc)) + str);
29606
29736
 
29607
29737
  return pushR(acc, str);
29608
29738
  }
@@ -32172,18 +32302,24 @@
32172
32302
  this._deregistered = true;
32173
32303
  }
32174
32304
  }
32175
- /** Return a registration function of the requested type. */
32176
- function makeEvent(registry, transitionService, eventType) {
32305
+ /**
32306
+ * Return a registration function of the requested type.
32307
+ * @param {ng.TransitionProvider| import("./transition.js").Transition} hookSource
32308
+ * @param {ng.TransitionProvider} transitionService
32309
+ * @param {import("./transition-event-type.js").TransitionEventType} eventType
32310
+ * @returns {( matchObject: any, callback: Function, options?: Record<string, any> ) => () => void }
32311
+ */
32312
+ function makeEvent(hookSource, transitionService, eventType) {
32177
32313
  // Create the object which holds the registered transition hooks.
32178
- const _registeredHooks = (registry._registeredHooks =
32179
- registry._registeredHooks || {});
32314
+ const _registeredHooks = (hookSource._registeredHooks =
32315
+ hookSource._registeredHooks || {});
32180
32316
 
32181
32317
  const hooks = (_registeredHooks[eventType.name] = []);
32182
32318
 
32183
32319
  const removeHookFn = (x) => removeFrom(hooks, x);
32184
32320
 
32185
32321
  // Create hook registration function on the HookRegistry for the event
32186
- registry[eventType.name] = hookRegistrationFn;
32322
+ hookSource[eventType.name] = hookRegistrationFn;
32187
32323
  function hookRegistrationFn(matchObject, callback, options = {}) {
32188
32324
  const registeredHook = new RegisteredHook(
32189
32325
  transitionService,
@@ -32228,7 +32364,7 @@
32228
32364
  * @returns
32229
32365
  */
32230
32366
  buildHooksForPhase(phase) {
32231
- return this.transition._transitionService
32367
+ return this.transition._transitionProvider
32232
32368
  ._getEvents(phase)
32233
32369
  .map((type) => this.buildHooks(type))
32234
32370
  .reduce(unnestR, [])
@@ -32289,7 +32425,7 @@
32289
32425
  state,
32290
32426
  hook,
32291
32427
  _options,
32292
- this.transition._transitionService._$exceptionHandler,
32428
+ this.transition._transitionProvider._$exceptionHandler,
32293
32429
  );
32294
32430
 
32295
32431
  return { hook, node, transitionHook };
@@ -32318,7 +32454,7 @@
32318
32454
  const isCreate = hookType.hookPhase === TransitionHookPhase._CREATE;
32319
32455
 
32320
32456
  // Instance and Global hook registries
32321
- const $transitions = this.transition._transitionService;
32457
+ const $transitions = this.transition._transitionProvider;
32322
32458
 
32323
32459
  const registries = isCreate
32324
32460
  ? [$transitions]
@@ -32383,7 +32519,11 @@
32383
32519
  * @type {import('../router.js').RouterProvider}
32384
32520
  */
32385
32521
  this._globals = globals;
32386
- this._transitionService = transitionService;
32522
+
32523
+ /** @type {ng.TransitionProvider} */
32524
+ this._transitionProvider = transitionService;
32525
+
32526
+ /** @type {PromiseWithResolvers<any>} */
32387
32527
  this._deferred = Promise.withResolvers();
32388
32528
 
32389
32529
  /**
@@ -32439,10 +32579,12 @@
32439
32579
  * (which can then be used to register hooks)
32440
32580
  */
32441
32581
  createTransitionHookRegFns() {
32442
- this._transitionService
32582
+ this._transitionProvider
32443
32583
  ._getEvents()
32444
32584
  .filter((type) => type.hookPhase !== TransitionHookPhase._CREATE)
32445
- .forEach((type) => makeEvent(this, this._transitionService, type));
32585
+ .forEach((type) => {
32586
+ return makeEvent(this, this._transitionProvider, type);
32587
+ });
32446
32588
  }
32447
32589
 
32448
32590
  getHooks(hookName) {
@@ -32453,7 +32595,7 @@
32453
32595
  const enteringStates = this._treeChanges.entering.map((node) => node.state);
32454
32596
 
32455
32597
  PathUtils.applyViewConfigs(
32456
- this._transitionService.$view,
32598
+ this._transitionProvider.$view,
32457
32599
  this._treeChanges.to,
32458
32600
  enteringStates,
32459
32601
  );
@@ -32773,7 +32915,7 @@
32773
32915
  );
32774
32916
 
32775
32917
  targetState = targetState.withOptions(newOptions, true);
32776
- const newTransition = this._transitionService.create(
32918
+ const newTransition = this._transitionProvider.create(
32777
32919
  this._treeChanges.from,
32778
32920
  targetState,
32779
32921
  );
@@ -32959,9 +33101,9 @@
32959
33101
  const startTransition = () => {
32960
33102
  const { _globals } = this;
32961
33103
 
32962
- _globals.lastStartedTransitionId = this.$id;
33104
+ _globals._lastStartedTransitionId = this.$id;
32963
33105
  _globals.transition = this;
32964
- _globals.transitionHistory.enqueue(this);
33106
+ _globals._transitionHistory.enqueue(this);
32965
33107
  trace.traceTransitionStart(this);
32966
33108
 
32967
33109
  return Promise.resolve();
@@ -33302,7 +33444,7 @@
33302
33444
  const globals = trans._globals;
33303
33445
 
33304
33446
  const transitionSuccessful = () => {
33305
- globals.successfulTransitions.enqueue(trans);
33447
+ globals._successfulTransitions.enqueue(trans);
33306
33448
  globals.$current = trans.$to();
33307
33449
  globals.current = globals.$current.self;
33308
33450
  copy(trans.params(), globals.params);
@@ -33351,12 +33493,19 @@
33351
33493
  stateRegistry,
33352
33494
  ) {
33353
33495
  return transitionService.onBefore(
33354
- { entering: (state) => !!state.lazyLoad },
33355
- (transition) => {
33496
+ {
33497
+ entering: (state) => {
33498
+ return !!state.lazyLoad;
33499
+ },
33500
+ },
33501
+ /** @param {import("../transition/transition.js").Transition} transition*/ (
33502
+ transition,
33503
+ ) => {
33356
33504
  function retryTransition() {
33357
33505
  if (transition.originalTransition().options().source !== "url") {
33358
33506
  // The original transition was not triggered via url sync
33359
33507
  // The lazy state should be loaded now, so re-try the original transition
33508
+
33360
33509
  const orig = transition.targetState();
33361
33510
 
33362
33511
  return stateService.target(
@@ -33655,7 +33804,7 @@
33655
33804
 
33656
33805
  /** @type {ng.ExceptionHandlerService} */
33657
33806
  this._$exceptionHandler = $exceptionHandler.handler;
33658
- globals.successfulTransitions.onEvict(treeChangesCleanup);
33807
+ globals._successfulTransitions.onEvict(treeChangesCleanup);
33659
33808
  }
33660
33809
 
33661
33810
  $get = [
@@ -33940,8 +34089,15 @@
33940
34089
  * @param {ng.ExceptionHandlerProvider} exceptionHandlerProvider
33941
34090
  */
33942
34091
  constructor(globals, transitionService, exceptionHandlerProvider) {
34092
+ /**
34093
+ * @type {ng.RouterProvider}
34094
+ */
33943
34095
  this.globals = globals;
34096
+ /**
34097
+ * @type {ng.TransitionProvider}
34098
+ */
33944
34099
  this.transitionService = transitionService;
34100
+
33945
34101
  this.stateRegistry = undefined;
33946
34102
 
33947
34103
  /** @type {ng.UrlService} */
@@ -34096,7 +34252,7 @@
34096
34252
 
34097
34253
  const { globals } = this;
34098
34254
 
34099
- const latestThing = () => globals.transitionHistory.peekTail();
34255
+ const latestThing = () => globals._transitionHistory.peekTail();
34100
34256
 
34101
34257
  const latest = latestThing();
34102
34258
 
@@ -34311,7 +34467,7 @@
34311
34467
  getCurrentPath() {
34312
34468
  const { globals } = this;
34313
34469
 
34314
- const latestSuccess = globals.successfulTransitions.peekTail();
34470
+ const latestSuccess = globals._successfulTransitions.peekTail();
34315
34471
 
34316
34472
  const rootPath = () => [new PathNode(this.stateRegistry.root())];
34317
34473
 
@@ -34370,7 +34526,7 @@
34370
34526
  */
34371
34527
  const rejectedTransitionHandler = (trans) => (error) => {
34372
34528
  if (error instanceof Rejection) {
34373
- const isLatest = this.globals.lastStartedTransitionId <= trans.$id;
34529
+ const isLatest = this.globals._lastStartedTransitionId <= trans.$id;
34374
34530
 
34375
34531
  if (error.type === RejectType._IGNORED) {
34376
34532
  isLatest && this.urlService.update();
@@ -34666,10 +34822,10 @@
34666
34822
  return $anchorScroll;
34667
34823
  }
34668
34824
 
34669
- return async function ($element) {
34825
+ return (/** @type {Element} */ $element) => {
34670
34826
  validateInstanceOf($element, Element, "$element");
34671
34827
 
34672
- return setTimeout(() => {
34828
+ setTimeout(() => {
34673
34829
  $element.scrollIntoView(false);
34674
34830
  }, 0);
34675
34831
  };
@@ -34834,7 +34990,9 @@
34834
34990
  fromProvider(provider, params, context) {
34835
34991
  const deps = annotate(provider);
34836
34992
 
34837
- const providerFn = isArray(provider) ? tail(provider) : provider;
34993
+ const providerFn = isArray(provider)
34994
+ ? /** @type {Function} */ (tail(provider))
34995
+ : provider;
34838
34996
 
34839
34997
  const resolvable = new Resolvable("", providerFn, deps);
34840
34998
 
@@ -35600,8 +35758,6 @@
35600
35758
  );
35601
35759
  }
35602
35760
 
35603
- /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
35604
-
35605
35761
  /**
35606
35762
  * Internal representation of a ng-router state.
35607
35763
  *
@@ -35611,16 +35767,16 @@
35611
35767
  *
35612
35768
  * This class prototypally inherits from the corresponding [[StateDeclaration]].
35613
35769
  * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
35614
- * @implements {StateDeclaration}
35770
+ * @implements {ng.StateDeclaration}
35615
35771
  */
35616
35772
  class StateObject {
35617
- name = undefined;
35618
- navigable = undefined;
35773
+ name;
35774
+ navigable;
35619
35775
  /** @type {?StateObject} */
35620
- parent = undefined;
35621
- params = undefined;
35622
- url = undefined;
35623
- includes = undefined;
35776
+ parent;
35777
+ params;
35778
+ url;
35779
+ includes;
35624
35780
 
35625
35781
  /**
35626
35782
  * @param {import('./interface.ts').StateDeclaration} config
@@ -35639,7 +35795,7 @@
35639
35795
  */
35640
35796
  const nameGlob = this.name ? Glob.fromString(this.name) : null;
35641
35797
 
35642
- this.__stateObjectCache = { nameGlob };
35798
+ this._stateObjectCache = { nameGlob };
35643
35799
  }
35644
35800
 
35645
35801
  /**
@@ -35721,7 +35877,7 @@
35721
35877
  /** Predicate which returns true if the object is a [[StateDeclaration]] object */
35722
35878
  StateObject.isStateDeclaration = (obj) => isFunction(obj.$$state);
35723
35879
  /** Predicate which returns true if the object is an internal [[StateObject]] object */
35724
- StateObject.isState = (obj) => isObject(obj.__stateObjectCache);
35880
+ StateObject.isState = (obj) => isObject(obj._stateObjectCache);
35725
35881
 
35726
35882
  /**
35727
35883
  * Creates a [[UrlRule]]
@@ -36025,20 +36181,6 @@
36025
36181
  return idSort(a, b);
36026
36182
  }
36027
36183
 
36028
- function getHandlerFn(handler) {
36029
- if (
36030
- !isFunction(handler) &&
36031
- !isString(handler) &&
36032
- !is(TargetState)(handler) &&
36033
- !TargetState.isDef(handler)
36034
- ) {
36035
- throw new Error(
36036
- "'handler' must be a string, function, TargetState, or have a state: 'newtarget' property",
36037
- );
36038
- }
36039
-
36040
- return isFunction(handler) ? handler : val(handler);
36041
- }
36042
36184
  /**
36043
36185
  * API for managing URL rules
36044
36186
  *
@@ -36055,102 +36197,7 @@
36055
36197
  this._sortFn = defaultRuleSortFn;
36056
36198
  this._rules = [];
36057
36199
  this._id = 0;
36058
- this.urlRuleFactory = urlRuleFactory;
36059
- }
36060
-
36061
- /**
36062
- * Defines the initial state, path, or behavior to use when the app starts.
36063
- *
36064
- * This rule defines the initial/starting state for the application.
36065
- *
36066
- * This rule is triggered the first time the URL is checked (when the app initially loads).
36067
- * The rule is triggered only when the url matches either `""` or `"/"`.
36068
- *
36069
- * Note: The rule is intended to be used when the root of the application is directly linked to.
36070
- * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
36071
- * This allows 404-like behavior when an unknown URL is deep-linked.
36072
- *
36073
- * #### Example:
36074
- * Start app at `home` state.
36075
- * ```js
36076
- * .initial({ state: 'home' });
36077
- * ```
36078
- *
36079
- * #### Example:
36080
- * Start app at `/home` (by url)
36081
- * ```js
36082
- * .initial('/home');
36083
- * ```
36084
- *
36085
- * #### Example:
36086
- * When no other url rule matches, go to `home` state
36087
- * ```js
36088
- * .initial((matchValue, url, router) => {
36089
- * console.log('initial state');
36090
- * return { state: 'home' };
36091
- * })
36092
- * ```
36093
- *
36094
- * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
36095
- */
36096
- initial(handler) {
36097
- const handlerFn = getHandlerFn(handler);
36098
-
36099
- const matchFn = (urlParts, router) =>
36100
- router.globals.transitionHistory.size() === 0 &&
36101
- !!/^\/?$/.exec(urlParts.path);
36102
-
36103
- this.rule(this.urlRuleFactory.create(matchFn, handlerFn));
36104
- }
36105
-
36106
- /**
36107
- * Defines the state, url, or behavior to use when no other rule matches the URL.
36108
- *
36109
- * This rule is matched when *no other rule* matches.
36110
- * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
36111
- *
36112
- * - If `handler` a string, it is treated as a url redirect
36113
- *
36114
- * #### Example:
36115
- * When no other url rule matches, redirect to `/index`
36116
- * ```js
36117
- * .otherwise('/index');
36118
- * ```
36119
- *
36120
- * - If `handler` is an object with a `state` property, the state is activated.
36121
- *
36122
- * #### Example:
36123
- * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
36124
- * ```js
36125
- * .otherwise({ state: 'home', params: { dashboard: 'default' } });
36126
- * ```
36127
- *
36128
- * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.
36129
- * The function can perform actions, and/or return a value.
36130
- *
36131
- * #### Example:
36132
- * When no other url rule matches, manually trigger a transition to the `home` state
36133
- * ```js
36134
- * .otherwise((matchValue, urlParts, router) => {
36135
- * router.stateService.go('home');
36136
- * });
36137
- * ```
36138
- *
36139
- * #### Example:
36140
- * When no other url rule matches, go to `home` state
36141
- * ```js
36142
- * .otherwise((matchValue, urlParts, router) => {
36143
- * return { state: 'home' };
36144
- * });
36145
- * ```
36146
- *
36147
- * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
36148
- */
36149
- otherwise(handler) {
36150
- const handlerFn = getHandlerFn(handler);
36151
-
36152
- this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);
36153
- this._sorted = false;
36200
+ this._urlRuleFactory = urlRuleFactory;
36154
36201
  }
36155
36202
 
36156
36203
  /**
@@ -36172,7 +36219,7 @@
36172
36219
  * A rule should have a `match` function which returns truthy if the rule matched.
36173
36220
  * It should also have a `handler` function which is invoked if the rule is the best match.
36174
36221
  *
36175
- * @return a function that deregisters the rule
36222
+ * @returns {() => void } a function that deregisters the rule
36176
36223
  */
36177
36224
  rule(rule) {
36178
36225
  if (!UrlRuleFactory.isUrlRule(rule)) throw new Error("invalid rule");
@@ -36192,7 +36239,7 @@
36192
36239
  rules() {
36193
36240
  this.ensureSorted();
36194
36241
 
36195
- return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []);
36242
+ return this._rules;
36196
36243
  }
36197
36244
 
36198
36245
  /**
@@ -36336,7 +36383,7 @@
36336
36383
  * @return the registered [[UrlRule]]
36337
36384
  */
36338
36385
  when(matcher, handler, options) {
36339
- const rule = this.urlRuleFactory.create(matcher, handler);
36386
+ const rule = this._urlRuleFactory.create(matcher, handler);
36340
36387
 
36341
36388
  if (isDefined(options && options.priority))
36342
36389
  rule.priority = options.priority;
@@ -36386,31 +36433,32 @@
36386
36433
 
36387
36434
  /**
36388
36435
  * @param {ng.LocationProvider} $locationProvider
36389
- * @param {import("../../router/state/state-service.js").StateProvider} stateService
36436
+ * @param {import("../../router/state/state-service.js").StateProvider} stateProvider
36390
36437
  * @param {import("../router.js").RouterProvider} globals
36391
36438
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
36392
36439
  */
36393
- constructor($locationProvider, stateService, globals, urlConfigProvider) {
36440
+ constructor($locationProvider, stateProvider, globals, urlConfigProvider) {
36394
36441
  /** @private */
36395
36442
  this._locationProvider = $locationProvider;
36396
- this.stateService = stateService;
36443
+ this.stateService = stateProvider;
36397
36444
 
36398
- /** Provides services related to the URL */
36399
- this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
36445
+ /** @type {UrlRuleFactory} Provides services related to the URL */
36446
+ this._urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
36400
36447
 
36401
36448
  /**
36402
36449
  * The nested [[UrlRules]] API for managing URL rules and rewrites
36450
+ * @ignore
36403
36451
  * @type {UrlRules}
36404
36452
  */
36405
- this.rules = new UrlRules(this.urlRuleFactory);
36453
+ this._rules = new UrlRules(this._urlRuleFactory);
36406
36454
  /**
36407
36455
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
36408
36456
  * @type {import("./url-config.js").UrlConfigProvider}
36409
36457
  */
36410
- this.config = urlConfigProvider;
36458
+ this._config = urlConfigProvider;
36411
36459
 
36412
- /** Creates a new [[Param]] for a given location (DefType) */
36413
- this.paramFactory = new ParamFactory(this.config);
36460
+ /** @type {ParamFactory} Creates a new [[Param]] for a given location (DefType) */
36461
+ this._paramFactory = new ParamFactory(this._config);
36414
36462
 
36415
36463
  this._urlListeners = [];
36416
36464
  }
@@ -36672,7 +36720,7 @@
36672
36720
  */
36673
36721
  match(url) {
36674
36722
  url = Object.assign({ path: "", search: {}, hash: "" }, url);
36675
- const rules = this.rules.rules();
36723
+ const rules = this._rules.rules();
36676
36724
 
36677
36725
  // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined
36678
36726
  /**
@@ -36783,7 +36831,7 @@
36783
36831
  * @returns The UrlMatcher.
36784
36832
  */
36785
36833
  compile(urlPattern, config) {
36786
- const urlConfig = this.config;
36834
+ const urlConfig = this._config;
36787
36835
 
36788
36836
  // backward-compatible support for config.params -> config.state.params
36789
36837
  const params = config && !config.state && config.params;
@@ -36797,7 +36845,7 @@
36797
36845
  return new UrlMatcher(
36798
36846
  urlPattern,
36799
36847
  urlConfig.paramTypes,
36800
- this.paramFactory,
36848
+ this._paramFactory,
36801
36849
  Object.assign(globalConfig, config),
36802
36850
  );
36803
36851
  }
@@ -36834,8 +36882,10 @@
36834
36882
  }
36835
36883
 
36836
36884
  class StateMatcher {
36837
- constructor(_states) {
36838
- this._states = _states;
36885
+ /** @param {import("./interface.ts").StateStore} states */
36886
+ constructor(states) {
36887
+ /** @type {import("./interface.ts").StateStore} */
36888
+ this._states = states;
36839
36889
  }
36840
36890
 
36841
36891
  isRelative(stateName) {
@@ -36860,12 +36910,10 @@
36860
36910
  ) {
36861
36911
  return state;
36862
36912
  } else if (isStr && matchGlob) {
36863
- const _states = Object.values(this._states);
36913
+ const states = Object.values(this._states);
36864
36914
 
36865
- const matches = _states.filter(
36866
- (_state) =>
36867
- _state.__stateObjectCache.nameGlob &&
36868
- _state.__stateObjectCache.nameGlob.matches(name),
36915
+ const matches = states.filter((stateObj) =>
36916
+ stateObj._stateObjectCache.nameGlob?.matches(name),
36869
36917
  );
36870
36918
 
36871
36919
  if (matches.length > 1) {
@@ -37194,11 +37242,11 @@
37194
37242
  class StateBuilder {
37195
37243
  /**
37196
37244
  * @param {import('./state-matcher.js').StateMatcher} matcher
37197
- * @param urlService
37245
+ * @param {ng.UrlService} urlService
37198
37246
  */
37199
37247
  constructor(matcher, urlService) {
37200
- this.matcher = matcher;
37201
- this.$injector = undefined;
37248
+ this._matcher = matcher;
37249
+ this._$injector = undefined;
37202
37250
  const self = this;
37203
37251
 
37204
37252
  const root = () => matcher.find("");
@@ -37208,7 +37256,7 @@
37208
37256
 
37209
37257
  return matcher.find(self.parentName(state)) || root();
37210
37258
  }
37211
- this.builders = {
37259
+ this._builders = {
37212
37260
  name: [(state) => state.name],
37213
37261
  self: [selfBuilder],
37214
37262
  parent: [parentBuilder],
@@ -37218,7 +37266,7 @@
37218
37266
  // Keep track of the closest ancestor state that has a URL (i.e. is navigable)
37219
37267
  navigable: [getNavigableBuilder(isRoot)],
37220
37268
  // TODO
37221
- params: [getParamsBuilder(urlService.paramFactory)],
37269
+ params: [getParamsBuilder(urlService._paramFactory)],
37222
37270
  // Each framework-specific ng-router implementation should define its own `views` builder
37223
37271
  // e.g., src/ng1/statebuilders/views.ts
37224
37272
  views: [],
@@ -37231,7 +37279,7 @@
37231
37279
  }
37232
37280
 
37233
37281
  builder(name, fn) {
37234
- const { builders } = this;
37282
+ const { _builders: builders } = this;
37235
37283
 
37236
37284
  const array = builders[name] || [];
37237
37285
 
@@ -37254,7 +37302,7 @@
37254
37302
  * @returns the built State object
37255
37303
  */
37256
37304
  build(state) {
37257
- const { matcher, builders } = this;
37305
+ const { _matcher: matcher, _builders: builders } = this;
37258
37306
 
37259
37307
  const parent = this.parentName(state);
37260
37308
 
@@ -37330,13 +37378,14 @@
37330
37378
  class StateQueueManager {
37331
37379
  /**
37332
37380
  * @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
37333
- * @param {*} urlServiceRules
37334
- * @param {Record<string, ng.StateObject>} states
37381
+ * @param {import("../url/url-rules.js").UrlRules} urlServiceRules
37382
+ * @param {import("./interface.ts").StateStore} states
37335
37383
  * @param {*} builder
37336
37384
  * @param {*} listeners
37337
37385
  */
37338
37386
  constructor(stateRegistry, urlServiceRules, states, builder, listeners) {
37339
37387
  this.stateRegistry = stateRegistry;
37388
+ /** @type {import("../url/url-rules.js").UrlRules} */
37340
37389
  this.urlServiceRules = urlServiceRules;
37341
37390
  this.states = states;
37342
37391
  this.builder = builder;
@@ -37432,11 +37481,16 @@
37432
37481
  return states;
37433
37482
  }
37434
37483
 
37484
+ /**
37485
+ *
37486
+ * @param {ng.StateDeclaration} state
37487
+ * @returns {() => void} a function that deregisters the rule
37488
+ */
37435
37489
  attachRoute(state) {
37436
37490
  if (state.abstract || !state.url) return;
37437
37491
  const rulesApi = this.urlServiceRules;
37438
37492
 
37439
- rulesApi.rule(rulesApi.urlRuleFactory.create(state));
37493
+ rulesApi.rule(rulesApi._urlRuleFactory.create(state));
37440
37494
  }
37441
37495
  }
37442
37496
 
@@ -37462,12 +37516,12 @@
37462
37516
  * @param {ng.ViewService} viewService
37463
37517
  */
37464
37518
  constructor(urlService, stateService, globals, viewService) {
37465
- /** @type {Record<string, import("./state-object.js").StateObject>} */
37519
+ /** @type {import("./interface.ts").StateStore} */
37466
37520
  this.states = {};
37467
37521
 
37468
37522
  stateService.stateRegistry = this; // <- circular wiring
37469
37523
  this.urlService = urlService;
37470
- this.urlServiceRules = urlService.rules;
37524
+ this.urlServiceRules = urlService._rules;
37471
37525
  this.$injector = undefined;
37472
37526
  this.listeners = [];
37473
37527
  this.matcher = new StateMatcher(this.states);
@@ -37502,7 +37556,7 @@
37502
37556
  */
37503
37557
  ($injector) => {
37504
37558
  this.$injector = $injector;
37505
- this.builder.$injector = $injector;
37559
+ this.builder._$injector = $injector;
37506
37560
 
37507
37561
  return this;
37508
37562
  },
@@ -37628,7 +37682,7 @@
37628
37682
  }
37629
37683
 
37630
37684
  _deregisterTree(state) {
37631
- const all = this.get().map((x) => x.$$state());
37685
+ const all = this.getAll().map((x) => x.$$state());
37632
37686
 
37633
37687
  const getChildren = (states) => {
37634
37688
  const _children = all.filter((x) => states.indexOf(x.parent) !== -1);
@@ -37667,11 +37721,18 @@
37667
37721
  * @returns {import('./state-object').StateObject[]} a list of removed states
37668
37722
  */
37669
37723
  deregister(stateOrName) {
37670
- const _state = this.get(stateOrName);
37724
+ const state =
37725
+ /** @type {import("./interface.ts").BuiltStateDeclaration} */ (
37726
+ this.get(stateOrName)
37727
+ );
37671
37728
 
37672
- if (!_state)
37729
+ if (!state)
37673
37730
  throw new Error(`Can't deregister state; not found: ${stateOrName}`);
37674
- const deregisteredStates = this._deregisterTree(_state.$$state());
37731
+ const deregisteredStates = this._deregisterTree(
37732
+ /** @type {import("./interface.ts").BuiltStateDeclaration} */ (
37733
+ state
37734
+ ).$$state(),
37735
+ );
37675
37736
 
37676
37737
  this.listeners.forEach((listener) =>
37677
37738
  listener(
@@ -38763,15 +38824,18 @@
38763
38824
 
38764
38825
  const hasTemplateContent = element.childNodes.length > 0;
38765
38826
 
38766
- const unsubscribe = $eventBus.subscribe(channel, (value) => {
38767
- if (hasTemplateContent) {
38768
- if (isObject(value)) {
38769
- scope.$merge(value);
38827
+ const unsubscribe = $eventBus.subscribe(
38828
+ channel,
38829
+ (/** @type {string | Object} */ value) => {
38830
+ if (hasTemplateContent) {
38831
+ if (isObject(value)) {
38832
+ scope.$merge(value);
38833
+ }
38834
+ } else if (isString(value)) {
38835
+ element.innerHTML = value;
38770
38836
  }
38771
- } else {
38772
- element.innerHTML = value;
38773
- }
38774
- });
38837
+ },
38838
+ );
38775
38839
 
38776
38840
  scope.$on("$destroy", () => unsubscribe());
38777
38841
  },
@@ -38783,7 +38847,7 @@
38783
38847
  /**
38784
38848
  * @param {ng.ParseService} $parse
38785
38849
  * @param {ng.LogService} $log
38786
- * @returns {import('interface.ts').Directive}
38850
+ * @returns {ng.Directive}
38787
38851
  */
38788
38852
  function ngSetterDirective($parse, $log) {
38789
38853
  return {
@@ -38805,7 +38869,7 @@
38805
38869
  return;
38806
38870
  }
38807
38871
 
38808
- const updateModel = (value) => {
38872
+ const updateModel = (/** @type {string} */ value) => {
38809
38873
  assignModel(scope, value.trim());
38810
38874
  };
38811
38875
 
@@ -38943,7 +39007,7 @@
38943
39007
 
38944
39008
  let called = false;
38945
39009
 
38946
- const wrapper = (...args) => {
39010
+ const wrapper = (/** @type {any[]} */ ...args) => {
38947
39011
  if (called) return;
38948
39012
  called = true;
38949
39013
 
@@ -39090,28 +39154,206 @@
39090
39154
  }
39091
39155
 
39092
39156
  /**
39093
- * SSE Provider
39094
- *
39095
- * Usage:
39096
- * const source = $sse('/events', {
39097
- * onMessage: (data) => console.log(data),
39098
- * onError: (err) => console.error(err),
39099
- * retryDelay: 2000,
39100
- * heartbeatTimeout: 10000,
39101
- * });
39102
- *
39103
- * source.close();
39157
+ * Shared Stream Connection Manager
39158
+ * Handles reconnect, heartbeat, and event callbacks for SSE or WebSocket
39104
39159
  */
39160
+ class StreamConnection {
39161
+ /**
39162
+ * @param {() => EventSource | WebSocket} createFn - Function that creates a new EventSource or WebSocket.
39163
+ * @param {ng.StreamConnectionConfig} config - Configuration object with callbacks, retries, heartbeat, transformMessage.
39164
+ * @param {ng.LogService} log - Optional logger (default: console).
39165
+ */
39166
+ constructor(createFn, config = {}, log = console) {
39167
+ /** @private @type {() => EventSource | WebSocket} */
39168
+ this._createFn = createFn;
39169
+ this._config = {
39170
+ retryDelay: 1000,
39171
+ maxRetries: Infinity,
39172
+ heartbeatTimeout: 15000,
39173
+ transformMessage: (/** @type {string} */ data) => {
39174
+ try {
39175
+ return JSON.parse(data);
39176
+ } catch {
39177
+ return data;
39178
+ }
39179
+ },
39180
+ ...config,
39181
+ };
39182
+ this._log = log;
39183
+ this._retryCount = 0;
39184
+ this._closed = false;
39185
+ this._heartbeatTimer = undefined;
39186
+ /** @type {EventSource | WebSocket | null} */
39187
+ this._connection = null;
39188
+
39189
+ this.connect();
39190
+ }
39191
+
39192
+ /**
39193
+ * Establishes a new connection using the provided createFn.
39194
+ * Closes any existing connection before creating a new one.
39195
+ */
39196
+ connect() {
39197
+ if (this._closed) return;
39198
+
39199
+ // Close the old connection if it exists
39200
+ if (this._connection && typeof this._connection.close === "function") {
39201
+ this._connection.close();
39202
+ }
39203
+
39204
+ // Create new connection
39205
+ this._connection = this._createFn();
39206
+
39207
+ // Bind events for the new connection
39208
+ this._bindEvents();
39209
+ }
39210
+
39211
+ /**
39212
+ * Sends data over a WebSocket connection.
39213
+ * Logs a warning if called on a non-WebSocket connection.
39214
+ * @param {any} data - Data to send.
39215
+ */
39216
+ send(data) {
39217
+ if (this._connection instanceof WebSocket) {
39218
+ this._connection.send(JSON.stringify(data));
39219
+ } else {
39220
+ this._log.warn("Send is only supported on WebSocket connections");
39221
+ }
39222
+ }
39223
+
39224
+ /**
39225
+ * Closes the connection manually and clears the heartbeat timer.
39226
+ */
39227
+ close() {
39228
+ this._closed = true;
39229
+ clearTimeout(this._heartbeatTimer);
39230
+
39231
+ if (this._connection && this._connection.close) {
39232
+ this._connection.close();
39233
+ }
39234
+ }
39235
+
39236
+ /**
39237
+ * @private
39238
+ * Binds event handlers to the underlying connection (EventSource or WebSocket)
39239
+ * for open, message, error, and close events.
39240
+ */
39241
+ _bindEvents() {
39242
+ const conn = this._connection;
39243
+
39244
+ if (conn instanceof EventSource) {
39245
+ conn.addEventListener("open", (err) => this._handleOpen(err));
39246
+ conn.addEventListener("message", (err) =>
39247
+ this._handleMessage(err.data, err),
39248
+ );
39249
+ conn.addEventListener("error", (err) => this._handleError(err));
39250
+ } else if (conn instanceof WebSocket) {
39251
+ conn.onopen = (err) => this._handleOpen(err);
39252
+ conn.onmessage = (err) => this._handleMessage(err.data, err);
39253
+ conn.onerror = (err) => this._handleError(err);
39254
+ conn.onclose = () => this._handleClose();
39255
+ }
39256
+ }
39257
+
39258
+ /**
39259
+ * @private
39260
+ * Handles the open event from the connection.
39261
+ * @param {Event} event - The open event.
39262
+ */
39263
+ _handleOpen(event) {
39264
+ this._retryCount = 0;
39265
+ this._config.onOpen?.(event);
39266
+ this._resetHeartbeat();
39267
+ }
39268
+
39269
+ /**
39270
+ * @private
39271
+ * Handles incoming messages, applies the transformMessage function,
39272
+ * and calls the onMessage callback.
39273
+ * @param {any} data - Raw message data.
39274
+ * @param {Event} event - The message event.
39275
+ */
39276
+ _handleMessage(data, event) {
39277
+ try {
39278
+ data = this._config.transformMessage?.(data) ?? data;
39279
+ } catch {
39280
+ /* empty */
39281
+ }
39282
+ this._config.onMessage?.(data, event);
39283
+ this._resetHeartbeat();
39284
+ }
39285
+
39286
+ /**
39287
+ * @private
39288
+ * Handles errors emitted from the connection.
39289
+ * Calls onError callback and schedules a reconnect.
39290
+ * @param {any} err - Error object or message.
39291
+ */
39292
+ _handleError(err) {
39293
+ this._config.onError?.(err);
39294
+ this._scheduleReconnect();
39295
+ }
39296
+
39297
+ /**
39298
+ * @private
39299
+ * Handles close events for WebSocket connections.
39300
+ * Triggers reconnect logic.
39301
+ */
39302
+ _handleClose() {
39303
+ this._scheduleReconnect();
39304
+ }
39305
+
39306
+ /**
39307
+ * @private
39308
+ * Schedules a reconnect attempt based on retryCount and config.maxRetries.
39309
+ * Calls onReconnect callback if reconnecting.
39310
+ */
39311
+ _scheduleReconnect() {
39312
+ if (this._closed) return;
39313
+
39314
+ if (this._retryCount < this._config.maxRetries) {
39315
+ this._retryCount++;
39316
+ this._config.onReconnect?.(this._retryCount);
39317
+ setTimeout(() => this.connect(), this._config.retryDelay);
39318
+ } else {
39319
+ this._log.warn("StreamConnection: Max retries reached");
39320
+ }
39321
+ }
39322
+
39323
+ /**
39324
+ * @private
39325
+ * Resets the heartbeat timer. If the timer expires, the connection is closed
39326
+ * and a reconnect is attempted.
39327
+ */
39328
+ _resetHeartbeat() {
39329
+ if (!this._config.heartbeatTimeout) return;
39330
+
39331
+ clearTimeout(this._heartbeatTimer);
39332
+ this._heartbeatTimer = setTimeout(() => {
39333
+ this._log.warn("StreamConnection: heartbeat timeout, reconnecting...");
39334
+ this._closeInternal();
39335
+ this._retryCount++;
39336
+ this._config.onReconnect?.(this._retryCount);
39337
+ this.connect();
39338
+ }, this._config.heartbeatTimeout);
39339
+ }
39340
+
39341
+ /**
39342
+ * @private
39343
+ */
39344
+ _closeInternal() {
39345
+ clearTimeout(this._heartbeatTimer);
39346
+ this._connection?.close();
39347
+ }
39348
+ }
39349
+
39105
39350
  class SseProvider {
39106
39351
  constructor() {
39107
- /**
39108
- * Optional provider-level defaults
39109
- * @type {ng.SseConfig}
39110
- */
39352
+ /** @type {ng.SseConfig} */
39111
39353
  this.defaults = {
39112
39354
  retryDelay: 1000,
39113
39355
  maxRetries: Infinity,
39114
- heartbeatTimeout: 15000, // 15 seconds
39356
+ heartbeatTimeout: 15000,
39115
39357
  transformMessage(data) {
39116
39358
  try {
39117
39359
  return JSON.parse(data);
@@ -39124,20 +39366,32 @@
39124
39366
 
39125
39367
  $get = [
39126
39368
  $injectTokens._log,
39127
- /**
39128
- * Returns the $sse service function
39129
- * @param {ng.LogService} log
39130
- * @returns {ng.SseService}
39131
- */
39132
- (log) => {
39369
+ /** @param {ng.LogService} log */ (log) => {
39133
39370
  this._$log = log;
39134
39371
 
39372
+ /** @type {ng.SseService} */
39135
39373
  return (url, config = {}) => {
39136
39374
  const mergedConfig = { ...this.defaults, ...config };
39137
39375
 
39138
39376
  const finalUrl = this.#buildUrl(url, mergedConfig.params);
39139
39377
 
39140
- return this.#createConnection(finalUrl, mergedConfig);
39378
+ return new StreamConnection(
39379
+ () =>
39380
+ new EventSource(finalUrl, {
39381
+ withCredentials: !!mergedConfig.withCredentials,
39382
+ }),
39383
+ {
39384
+ ...mergedConfig,
39385
+ onMessage: (data, event) => {
39386
+ // Cast Event -> MessageEvent safely
39387
+ mergedConfig.onMessage?.(
39388
+ data,
39389
+ /** @type{MessageEvent} */ (event),
39390
+ );
39391
+ },
39392
+ },
39393
+ this._$log,
39394
+ );
39141
39395
  };
39142
39396
  },
39143
39397
  ];
@@ -39147,6 +39401,7 @@
39147
39401
  * @param {string} url
39148
39402
  * @param {Record<string, any>=} params
39149
39403
  * @returns {string}
39404
+ * @throws {URIError}
39150
39405
  */
39151
39406
  #buildUrl(url, params) {
39152
39407
  if (!params) return url;
@@ -39156,91 +39411,6 @@
39156
39411
 
39157
39412
  return url + (url.includes("?") ? "&" : "?") + query;
39158
39413
  }
39159
-
39160
- /**
39161
- * Creates a managed SSE connection with reconnect and heartbeat
39162
- * @param {string} url
39163
- * @param {ng.SseConfig} config
39164
- * @returns {import("./interface.ts").SseConnection}
39165
- */
39166
- #createConnection(url, config) {
39167
- let es;
39168
-
39169
- let retryCount = 0;
39170
-
39171
- let closed = false;
39172
-
39173
- let heartbeatTimer;
39174
-
39175
- const connect = () => {
39176
- if (closed) return;
39177
-
39178
- es = new EventSource(url, {
39179
- withCredentials: !!config.withCredentials,
39180
- });
39181
-
39182
- es.addEventListener("open", (event) => {
39183
- retryCount = 0;
39184
- config.onOpen?.(event);
39185
-
39186
- if (config.heartbeatTimeout) resetHeartbeat();
39187
- });
39188
-
39189
- es.addEventListener("message", (event) => {
39190
- let { data } = event;
39191
-
39192
- try {
39193
- data = config.transformMessage ? config.transformMessage(data) : data;
39194
- } catch {
39195
- /* empty */
39196
- }
39197
- config.onMessage?.(data, event);
39198
-
39199
- if (config.heartbeatTimeout) resetHeartbeat();
39200
- });
39201
-
39202
- es.addEventListener("error", (err) => {
39203
- config.onError?.(err);
39204
-
39205
- if (closed) return;
39206
- es.close();
39207
-
39208
- if (retryCount < config.maxRetries) {
39209
- retryCount++;
39210
- config.onReconnect?.(retryCount);
39211
- setTimeout(connect, config.retryDelay);
39212
- } else {
39213
- this._$log.warn("SSE: Max retries reached");
39214
- }
39215
- });
39216
- };
39217
-
39218
- const resetHeartbeat = () => {
39219
- clearTimeout(heartbeatTimer);
39220
- heartbeatTimer = setTimeout(() => {
39221
- this._$log.warn("SSE: heartbeat timeout, reconnecting...");
39222
- es.close();
39223
- config.onReconnect?.(++retryCount);
39224
- connect();
39225
- }, config.heartbeatTimeout);
39226
- };
39227
-
39228
- connect();
39229
-
39230
- return {
39231
- close() {
39232
- closed = true;
39233
- clearTimeout(heartbeatTimer);
39234
- es.close();
39235
- },
39236
- connect() {
39237
- if (closed === false) {
39238
- close();
39239
- }
39240
- connect();
39241
- },
39242
- };
39243
- }
39244
39414
  }
39245
39415
 
39246
39416
  /**
@@ -39335,11 +39505,7 @@
39335
39505
  this.defaults = {};
39336
39506
  }
39337
39507
 
39338
- $get = [
39339
- $injectTokens._exceptionHandler,
39340
- /** @param {ng.ExceptionHandlerService} $exceptionHandler */
39341
- ($exceptionHandler) => new CookieService(this.defaults, $exceptionHandler),
39342
- ];
39508
+ $get = () => new CookieService(this.defaults);
39343
39509
  }
39344
39510
 
39345
39511
  /**
@@ -39353,14 +39519,10 @@
39353
39519
  /**
39354
39520
  * @param {ng.CookieOptions} defaults
39355
39521
  * Default cookie attributes defined by `$cookiesProvider.defaults`.
39356
- * @param {ng.ExceptionHandlerService} $exceptionHandler
39357
39522
  */
39358
- constructor(defaults, $exceptionHandler) {
39523
+ constructor(defaults) {
39359
39524
  /** @private @type {ng.CookieOptions} */
39360
39525
  this._defaults = Object.freeze({ ...defaults });
39361
-
39362
- /** @private @type {ng.ExceptionHandlerService} */
39363
- this._$exceptionHandler = $exceptionHandler;
39364
39526
  }
39365
39527
 
39366
39528
  /**
@@ -39372,14 +39534,9 @@
39372
39534
  */
39373
39535
  get(key) {
39374
39536
  validateIsString(key, "key");
39537
+ const all = parseCookies();
39375
39538
 
39376
- try {
39377
- const all = parseCookies();
39378
-
39379
- return all[key] || null;
39380
- } catch (err) {
39381
- throw this._$exceptionHandler(err);
39382
- }
39539
+ return all[key] || null;
39383
39540
  }
39384
39541
 
39385
39542
  /**
@@ -39397,13 +39554,7 @@
39397
39554
 
39398
39555
  if (!raw) return null;
39399
39556
 
39400
- try {
39401
- return /** @type {T} */ (JSON.parse(raw));
39402
- } catch (err) {
39403
- this._$exceptionHandler(err);
39404
-
39405
- return null;
39406
- }
39557
+ return /** @type {T} */ (JSON.parse(raw));
39407
39558
  }
39408
39559
 
39409
39560
  /**
@@ -39413,11 +39564,7 @@
39413
39564
  * @throws {URIError} – If decodeURIComponent fails
39414
39565
  */
39415
39566
  getAll() {
39416
- try {
39417
- return parseCookies();
39418
- } catch (err) {
39419
- return this._$exceptionHandler(err);
39420
- }
39567
+ return parseCookies();
39421
39568
  }
39422
39569
 
39423
39570
  /**
@@ -39426,6 +39573,7 @@
39426
39573
  * @param {string} key
39427
39574
  * @param {string} value
39428
39575
  * @param {ng.CookieOptions} [options]
39576
+ * @throws {URIError} if key or value cannot be encoded
39429
39577
  */
39430
39578
  put(key, value, options = {}) {
39431
39579
  validateIsString(key, "key");
@@ -39434,14 +39582,10 @@
39434
39582
 
39435
39583
  const encodedVal = encodeURIComponent(value);
39436
39584
 
39437
- try {
39438
- document.cookie = `${encodedKey}=${encodedVal}${buildOptions({
39439
- ...this._defaults,
39440
- ...options,
39441
- })}`;
39442
- } catch (err) {
39443
- this._$exceptionHandler(err);
39444
- }
39585
+ document.cookie = `${encodedKey}=${encodedVal}${buildOptions({
39586
+ ...this._defaults,
39587
+ ...options,
39588
+ })}`;
39445
39589
  }
39446
39590
 
39447
39591
  /**
@@ -39455,19 +39599,9 @@
39455
39599
  putObject(key, value, options) {
39456
39600
  validateIsString(key, "key");
39457
39601
  validateRequired(value, "value");
39458
- assert(!isNullOrUndefined(value), BADARGVALUE);
39602
+ const str = JSON.stringify(value);
39459
39603
 
39460
- try {
39461
- const str = JSON.stringify(value);
39462
-
39463
- this.put(key, str, options);
39464
- } catch (err) {
39465
- this._$exceptionHandler(
39466
- new TypeError(
39467
- `badserialize: "${key}" => ${/** @type {Error} */ (err).message}`,
39468
- ),
39469
- );
39470
- }
39604
+ this.put(key, str, options);
39471
39605
  }
39472
39606
 
39473
39607
  /**
@@ -40116,6 +40250,37 @@
40116
40250
  ];
40117
40251
  }
40118
40252
 
40253
+ /**
40254
+ * @returns {ng.Directive}
40255
+ */
40256
+ function ngListenerDirective() {
40257
+ return {
40258
+ scope: false,
40259
+ link: (scope, element, attrs) => {
40260
+ const channel = attrs.ngListener || element.id;
40261
+
40262
+ const hasTemplateContent = element.childNodes.length;
40263
+
40264
+ /** @type {EventListener} */
40265
+ const fn = (event) => {
40266
+ const value = /** @type {CustomEvent} */ (event).detail;
40267
+
40268
+ if (hasTemplateContent) {
40269
+ if (isObject(value)) {
40270
+ scope.$merge(value);
40271
+ }
40272
+ } else if (isString(value)) {
40273
+ element.innerHTML = value;
40274
+ }
40275
+ };
40276
+
40277
+ element.addEventListener(channel, fn);
40278
+
40279
+ scope.$on("$destroy", () => element.removeEventListener(channel, fn));
40280
+ },
40281
+ };
40282
+ }
40283
+
40119
40284
  /**
40120
40285
  * Initializes core `ng` module.
40121
40286
  * @param {ng.Angular} angular
@@ -40165,6 +40330,7 @@
40165
40330
  ngInclude: ngIncludeDirective,
40166
40331
  ngInject: ngInjectDirective,
40167
40332
  ngInit: ngInitDirective,
40333
+ ngListener: ngListenerDirective,
40168
40334
  ngMessages: ngMessagesDirective,
40169
40335
  ngMessage: ngMessageDirective,
40170
40336
  ngMessageExp: ngMessageExpDirective,
@@ -40293,8 +40459,10 @@
40293
40459
  /** @type {ModuleRegistry} */
40294
40460
  const moduleRegistry = {};
40295
40461
 
40296
- class Angular {
40462
+ class Angular extends EventTarget {
40297
40463
  constructor() {
40464
+ super();
40465
+
40298
40466
  /** @private @type {!Array<string|any>} */
40299
40467
  this._bootsrappedModules = [];
40300
40468
 
@@ -40308,7 +40476,7 @@
40308
40476
  * @public
40309
40477
  * @type {string} `version` from `package.json`
40310
40478
  */
40311
- this.version = "0.15.0"; //inserted via rollup plugin
40479
+ this.version = "0.15.1"; //inserted via rollup plugin
40312
40480
 
40313
40481
  /**
40314
40482
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"