import { C as s } from "./base-PQGakkrl.js";
import { C as n } from "./index-BnerInzC.js";
import "js-cookie";
import "decimal.js";
class o {
  _fun;
  _time;
  _cb;
  constructor(i, e = 200) {
    this._cb = i, this._time = e;
  }
  stopRun() {
    this._fun && (clearTimeout(this._fun), this._fun = null);
  }
  run(i) {
    const e = i || this._cb;
    e && (this.stopRun(), this._fun = setTimeout(() => {
      e();
    }, this._time));
  }
}
class a {
  options;
  _isWinResize;
  _isRunDelay;
  _runDelayFun;
  _bindWinResize;
  _objResizeObserver;
  constructor(i) {
    this._isWinResize = s.isUndefined(i.element), this._isRunDelay = !!(!s.isBoolean(i.isDelay) || i.isDelay), this.options = i, this._init();
  }
  _init() {
    this._isRunDelay && (this._runDelayFun = new o(this.options.callback, this.options.delayTime)), this._isWinResize ? (this._bindWinResize = this._onWinResize.bind(this), n.onListener(window, "resize", this._bindWinResize)) : this._initResizeObserver();
  }
  _onWinResize() {
    this._isRunDelay ? this._runDelayFun.run() : this.options.callback && this.options.callback();
  }
  _initResizeObserver() {
    window && "ResizeObserver" in window && (this._objResizeObserver = new ResizeObserver((i) => {
      const e = i[0];
      this._isRunDelay ? this._runDelayFun.run(() => {
        this.options.callback(e);
      }) : this.options.callback(e);
    }), this._objResizeObserver.observe(this.options.element));
  }
  destroy() {
    this._isWinResize ? n.offListener(window, "resize", this._bindWinResize) : this._objResizeObserver && (this._objResizeObserver.disconnect(), this._objResizeObserver = null);
  }
}
export {
  o as D,
  a as R
};
//# sourceMappingURL=resize-kOWxHVSP.js.map
