chunk-WSRBH7BF.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // node_modules/@arcgis/core/core/ObjectPool.js
  2. function t(t3) {
  3. return t3 && t3.release && typeof t3.release == "function";
  4. }
  5. function i(t3) {
  6. return t3 && t3.acquire && typeof t3.acquire == "function";
  7. }
  8. var e = class {
  9. constructor(t3, i2, e2, o2 = 1, s = 0) {
  10. if (this.ctor = t3, this.acquireFunction = i2, this.releaseFunction = e2, this.allocationSize = o2, this._pool = new Array(s), this._initialSize = s, this.ctor)
  11. for (let n = 0; n < s; n++)
  12. this._pool[n] = new this.ctor();
  13. this.allocationSize = Math.max(o2, 1);
  14. }
  15. destroy() {
  16. this.prune(0);
  17. }
  18. acquire(...t3) {
  19. let o2;
  20. if (e.test.disabled)
  21. o2 = new this.ctor();
  22. else {
  23. if (this._pool.length === 0) {
  24. const t4 = this.allocationSize;
  25. for (let i2 = 0; i2 < t4; i2++)
  26. this._pool[i2] = new this.ctor();
  27. }
  28. o2 = this._pool.pop();
  29. }
  30. return this.acquireFunction ? this.acquireFunction(o2, ...t3) : i(o2) && o2.acquire(...t3), o2;
  31. }
  32. release(i2) {
  33. i2 && !e.test.disabled && (this.releaseFunction ? this.releaseFunction(i2) : t(i2) && i2.release(), this._pool.push(i2));
  34. }
  35. prune(t3 = this._initialSize) {
  36. if (!(t3 >= this._pool.length)) {
  37. for (let i2 = t3; i2 < this._pool.length; ++i2) {
  38. const t4 = this._pool[i2];
  39. this._dispose(t4);
  40. }
  41. this._pool.length = t3;
  42. }
  43. }
  44. _dispose(t3) {
  45. t3.dispose && typeof t3.dispose == "function" && t3.dispose();
  46. }
  47. };
  48. e.test = { disabled: false };
  49. // node_modules/@arcgis/core/core/ArrayPool.js
  50. function r(e2) {
  51. e2.length = 0;
  52. }
  53. var t2 = class {
  54. constructor(t3 = 50, o2 = 50) {
  55. this._pool = new e(Array, void 0, r, o2, t3);
  56. }
  57. acquire() {
  58. return this._pool.acquire();
  59. }
  60. release(e2) {
  61. this._pool.release(e2);
  62. }
  63. prune() {
  64. this._pool.prune(0);
  65. }
  66. static acquire() {
  67. return o.acquire();
  68. }
  69. static release(e2) {
  70. return o.release(e2);
  71. }
  72. static prune() {
  73. o.prune();
  74. }
  75. };
  76. var o = new t2(100);
  77. export {
  78. e,
  79. t2 as t
  80. };
  81. //# sourceMappingURL=chunk-WSRBH7BF.js.map