chunk-YBSUITLL.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import {
  2. e,
  3. n2 as n,
  4. y3 as y
  5. } from "./chunk-Y3WMVFTW.js";
  6. import {
  7. T,
  8. g,
  9. m
  10. } from "./chunk-ULGDPLM2.js";
  11. import {
  12. q
  13. } from "./chunk-GZT4BVFP.js";
  14. // node_modules/@arcgis/core/core/Promise.js
  15. var h;
  16. !function(s) {
  17. s[s.PENDING = 0] = "PENDING", s[s.RESOLVED = 1] = "RESOLVED", s[s.REJECTED = 2] = "REJECTED";
  18. }(h || (h = {}));
  19. var n2 = class {
  20. constructor(s) {
  21. this.instance = s, this._resolver = T(), this._status = h.PENDING, this._resolvingPromises = [], this._resolver.promise.then(() => {
  22. this._status = h.RESOLVED, this._cleanUp();
  23. }, () => {
  24. this._status = h.REJECTED, this._cleanUp();
  25. });
  26. }
  27. addResolvingPromise(s) {
  28. this._resolvingPromises.push(s), this._tryResolve();
  29. }
  30. isResolved() {
  31. return this._status === h.RESOLVED;
  32. }
  33. isRejected() {
  34. return this._status === h.REJECTED;
  35. }
  36. isFulfilled() {
  37. return this._status !== h.PENDING;
  38. }
  39. abort() {
  40. this._resolver.reject(m());
  41. }
  42. when(s, e2) {
  43. return this._resolver.promise.then(s, e2);
  44. }
  45. _cleanUp() {
  46. this._allPromise = this._resolvingPromises = this._allPromise = null;
  47. }
  48. _tryResolve() {
  49. if (this.isFulfilled())
  50. return;
  51. const s = T(), e2 = [...this._resolvingPromises, q(s.promise)], t = this._allPromise = Promise.all(e2);
  52. t.then(() => {
  53. this.isFulfilled() || this._allPromise !== t || this._resolver.resolve(this.instance);
  54. }, (s2) => {
  55. this.isFulfilled() || this._allPromise !== t || g(s2) || this._resolver.reject(s2);
  56. }), s.resolve();
  57. }
  58. };
  59. var m2 = (e2) => {
  60. let i = class extends e2 {
  61. constructor(...s) {
  62. super(...s), this._promiseProps = new n2(this), this.addResolvingPromise(Promise.resolve());
  63. }
  64. isResolved() {
  65. return this._promiseProps.isResolved();
  66. }
  67. isRejected() {
  68. return this._promiseProps.isRejected();
  69. }
  70. isFulfilled() {
  71. return this._promiseProps.isFulfilled();
  72. }
  73. when(s, e3) {
  74. return new Promise((s2, e4) => {
  75. this._promiseProps.when(s2, e4);
  76. }).then(s, e3);
  77. }
  78. catch(s) {
  79. return this.when(null, s);
  80. }
  81. addResolvingPromise(s) {
  82. s && !this._promiseProps.isFulfilled() && this._promiseProps.addResolvingPromise("_promiseProps" in s ? s.when() : s);
  83. }
  84. };
  85. return i = e([n("esri.core.Promise")], i), i;
  86. };
  87. var _ = class extends m2(y) {
  88. };
  89. _ = e([n("esri.core.Promise")], _);
  90. export {
  91. m2 as m,
  92. _
  93. };
  94. //# sourceMappingURL=chunk-YBSUITLL.js.map