// Metro module 636 (f637). import * as _toNumber from "./toNumber"; import * as _isObject from "./isObject"; import * as _Module641 from "./Module641"; const { max, min } = Math; module.exports = function debounce(a0, a1, a2) { let c12406_2, _this, c12406_4, _this2, c12406_6, c12406_7, c12406_8, c12406_9, c12406_10, c12406_11; let c12406_1 = a1; const timerExpired2 = function timerExpired() { let r36; const r16 = _Module641(); const r18 = r16 - c12406_7; if (c12406_7 === void 0 || r18 >= c12406_1 || r18 < 0 || c12406_10 && r16 - c12406_8 >= c12406_4) { c12406_6 = void 0; if (c12406_11) { const r35 = c12406_2; if (r35) { _this = void 0; c12406_2 = void 0; c12406_8 = r16; _this2 = a0.apply(_this, r35); r36 = _this2; } else { _this = void 0; c12406_2 = void 0; r36 = _this2; } } else { _this = void 0; c12406_2 = void 0; r36 = _this2; } return r36; } const r9 = setTimeout; const r12 = c12406_1 - (r16 - c12406_7); c12406_6 = r9(timerExpired2, c12406_10 ? min(r12, c12406_4 - (r16 - c12406_8)) : r12); }; c12406_8 = 0; c12406_9 = false; c12406_10 = false; c12406_11 = true; if (typeof a0 !== "function") { throw new TypeError("Expected a function"); } const r9 = _toNumber(a1) || 0; c12406_1 = r9; if (_isObject(a2)) { c12406_9 = !!a2.leading; const r25 = "maxWait" in a2; c12406_10 = r25; c12406_4 = r25 ? max(_toNumber(a2.maxWait) || 0, r9) : void 0; c12406_11 = "trailing" in a2 ? !!a2.trailing : true; } const debounced = function debounced() { let r51; const r14 = _Module641(); const r16 = r14 - c12406_7; const r1 = c12406_7 === void 0 || r16 >= c12406_1 || r16 < 0 || c12406_10 && r14 - c12406_8 >= c12406_4; c12406_2 = arguments; _this = this; c12406_7 = r14; if (r1) { if (c12406_6 === void 0) { c12406_8 = r14; c12406_6 = setTimeout(timerExpired2, c12406_1); if (c12406_9) { const r52 = c12406_2; _this = void 0; c12406_2 = void 0; c12406_8 = r14; _this2 = a0.apply(_this, r52); r51 = _this2; } else { r51 = _this2; } return r51; } if (c12406_10) { clearTimeout(c12406_6); c12406_6 = setTimeout(timerExpired2, c12406_1); const r40 = c12406_7; const r10 = c12406_2; _this = void 0; c12406_2 = void 0; c12406_8 = r40; _this2 = a0.apply(_this, r10); return _this2; } } if (c12406_6 === void 0) { c12406_6 = setTimeout(timerExpired2, c12406_1); } return _this2; }; debounced.cancel = function cancel() { if (c12406_6 !== void 0) { clearTimeout(c12406_6); } c12406_8 = 0; c12406_6 = void 0; _this = void 0; c12406_7 = void 0; c12406_2 = void 0; }; debounced.flush = function flush() { let r13; L7: { if (c12406_6 === void 0) { r13 = _this2; } else { const r12 = _Module641(); c12406_6 = void 0; if (c12406_11) { const r7 = c12406_2; if (r7) { _this = void 0; c12406_2 = void 0; c12406_8 = r12; _this2 = a0.apply(_this, r7); r13 = _this2; break L7; } } _this = void 0; c12406_2 = void 0; r13 = _this2; } } return r13; }; return debounced; };