laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
62 lines (61 loc) • 1.74 kB
JavaScript
"use client";
import { __require as j } from "./isObject.js";
import { __require as A } from "./now.js";
import { __require as D } from "./toNumber.js";
var h, p;
function z() {
if (p) return h;
p = 1;
var W = j(), v = A(), b = D(), C = "Expected a function", L = Math.max, M = Math.min;
function N(q, i, u) {
var a, o, l, f, n, t, c = 0, x = !1, d = !1, g = !0;
if (typeof q != "function")
throw new TypeError(C);
i = b(i) || 0, W(u) && (x = !!u.leading, d = "maxWait" in u, l = d ? L(b(u.maxWait) || 0, i) : l, g = "trailing" in u ? !!u.trailing : g);
function T(e) {
var r = a, m = o;
return a = o = void 0, c = e, f = q.apply(m, r), f;
}
function R(e) {
return c = e, n = setTimeout(s, i), x ? T(e) : f;
}
function S(e) {
var r = e - t, m = e - c, k = i - r;
return d ? M(k, l - m) : k;
}
function E(e) {
var r = e - t, m = e - c;
return t === void 0 || r >= i || r < 0 || d && m >= l;
}
function s() {
var e = v();
if (E(e))
return I(e);
n = setTimeout(s, S(e));
}
function I(e) {
return n = void 0, g && a ? T(e) : (a = o = void 0, f);
}
function y() {
n !== void 0 && clearTimeout(n), c = 0, a = t = o = n = void 0;
}
function O() {
return n === void 0 ? f : I(v());
}
function _() {
var e = v(), r = E(e);
if (a = arguments, o = this, t = e, r) {
if (n === void 0)
return R(t);
if (d)
return clearTimeout(n), n = setTimeout(s, i), T(t);
}
return n === void 0 && (n = setTimeout(s, i)), f;
}
return _.cancel = y, _.flush = O, _;
}
return h = N, h;
}
export {
z as __require
};