"use strict";const s=require("./base-iCmnU-fv.js"),n=require("./index-Ul6uY51t.js");require("js-cookie");require("decimal.js");class t{_fun;_time;_cb;constructor(e,i=200){this._cb=e,this._time=i}stopRun(){this._fun&&(clearTimeout(this._fun),this._fun=null)}run(e){const i=e||this._cb;i&&(this.stopRun(),this._fun=setTimeout(()=>{i()},this._time))}}class r{options;_isWinResize;_isRunDelay;_runDelayFun;_bindWinResize;_objResizeObserver;constructor(e){this._isWinResize=s.CommonBase.isUndefined(e.element),this._isRunDelay=!!(!s.CommonBase.isBoolean(e.isDelay)||e.isDelay),this.options=e,this._init()}_init(){this._isRunDelay&&(this._runDelayFun=new t(this.options.callback,this.options.delayTime)),this._isWinResize?(this._bindWinResize=this._onWinResize.bind(this),n.CommonElement.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(e=>{const i=e[0];this._isRunDelay?this._runDelayFun.run(()=>{this.options.callback(i)}):this.options.callback(i)}),this._objResizeObserver.observe(this.options.element))}destroy(){this._isWinResize?n.CommonElement.offListener(window,"resize",this._bindWinResize):this._objResizeObserver&&(this._objResizeObserver.disconnect(),this._objResizeObserver=null)}}exports.DelayFun=t;exports.Resize=r;
//# sourceMappingURL=resize-COkswDOq.js.map
