import { a$ as ht, r as I, m as pt, bC as gt, j as Q, c as me, aI as mt, aJ as vt, b0 as bt, aK as yt, ap as wt, be as Tt, ao as ze, br as kt, b9 as xt, aY as G, aX as Z, bD as Se, aC as Ke, bs as Ot, bt as Rt } from "./index-6wLGsgHc.js";
import { _ as Ne } from "./sprintf-D5E86llw-yUkJWEcD.js";
import { S as Mt } from "./useBasicWidgetState-DqA4I-I_-Cy-zNgyc.js";
var he = {}, X = {}, pe = {}, ie = {}, _e;
function Ee() {
  if (_e) return ie;
  _e = 1, Object.defineProperty(ie, "__esModule", {
    value: !0
  }), ie.Direction = void 0;
  var e;
  return (function(r) {
    r.Right = "to right", r.Left = "to left", r.Down = "to bottom", r.Up = "to top";
  })(e || (ie.Direction = e = {})), ie;
}
var Ae;
function qe() {
  return Ae || (Ae = 1, (function(e) {
    var r = pe && pe.__spreadArray || function(o, i, u) {
      if (u || arguments.length === 2) for (var f = 0, b = i.length, m; f < b; f++) (m || !(f in i)) && (m || (m = Array.prototype.slice.call(i, 0, f)), m[f] = i[f]);
      return o.concat(m || Array.prototype.slice.call(i));
    };
    Object.defineProperty(e, "__esModule", {
      value: !0
    }), e.isIOS = e.useThumbOverlap = e.assertUnreachable = e.voidFn = e.getTrackBackground = e.replaceAt = e.schd = e.translate = e.getClosestThumbIndex = e.translateThumbs = e.getPaddingAndBorder = e.getMargin = e.checkInitialOverlap = e.checkValuesAgainstBoundaries = e.checkBoundaries = e.isVertical = e.relativeValue = e.normalizeValue = e.isStepDivisible = e.isTouchEvent = e.getStepDecimals = void 0;
    var n = Ke, s = /* @__PURE__ */ Ee(), g = function(o) {
      var i = o.toString().split(".")[1];
      return i ? i.length : 0;
    };
    e.getStepDecimals = g;
    function T(o) {
      return o.touches && o.touches.length || o.changedTouches && o.changedTouches.length;
    }
    e.isTouchEvent = T;
    function c(o, i, u) {
      var f = (i - o) / u, b = 8, m = Number(f.toFixed(b));
      return parseInt(m.toString(), 10) === m;
    }
    e.isStepDivisible = c;
    function p(o, i, u, f, b, m, w) {
      var E = 1e11;
      if (o = Math.round(o * E) / E, !m) {
        var P = w[i - 1], C = w[i + 1];
        if (P && P > o) return P;
        if (C && C < o) return C;
      }
      if (o > f) return f;
      if (o < u) return u;
      var U = Math.floor(o * E - u * E) % Math.floor(b * E), _ = Math.floor(o * E - Math.abs(U)), Y = U === 0 ? o : _ / E, L = Math.abs(U / E) < b / 2 ? Y : Y + b, $ = (0, e.getStepDecimals)(b);
      return parseFloat(L.toFixed($));
    }
    e.normalizeValue = p;
    function V(o, i, u) {
      return (o - i) / (u - i);
    }
    e.relativeValue = V;
    function z(o) {
      return o === s.Direction.Up || o === s.Direction.Down;
    }
    e.isVertical = z;
    function A(o, i, u) {
      if (i >= u) throw new RangeError("min (".concat(i, ") is equal/bigger than max (").concat(u, ")"));
      if (o < i) throw new RangeError("value (".concat(o, ") is smaller than min (").concat(i, ")"));
      if (o > u) throw new RangeError("value (".concat(o, ") is bigger than max (").concat(u, ")"));
    }
    e.checkBoundaries = A;
    function M(o, i, u) {
      return o < i ? i : o > u ? u : o;
    }
    e.checkValuesAgainstBoundaries = M;
    function y(o) {
      if (!(o.length < 2) && !o.slice(1).every(function(i, u) {
        return o[u] <= i;
      })) throw new RangeError("values={[".concat(o, "]} needs to be sorted when allowOverlap={false}"));
    }
    e.checkInitialOverlap = y;
    function h(o) {
      var i = window.getComputedStyle(o);
      return {
        top: parseInt(i["margin-top"], 10),
        bottom: parseInt(i["margin-bottom"], 10),
        left: parseInt(i["margin-left"], 10),
        right: parseInt(i["margin-right"], 10)
      };
    }
    e.getMargin = h;
    function t(o) {
      var i = window.getComputedStyle(o);
      return {
        top: parseInt(i["padding-top"], 10) + parseInt(i["border-top-width"], 10),
        bottom: parseInt(i["padding-bottom"], 10) + parseInt(i["border-bottom-width"], 10),
        left: parseInt(i["padding-left"], 10) + parseInt(i["border-left-width"], 10),
        right: parseInt(i["padding-right"], 10) + parseInt(i["border-right-width"], 10)
      };
    }
    e.getPaddingAndBorder = t;
    function a(o, i, u) {
      var f = u ? -1 : 1;
      o.forEach(function(b, m) {
        return d(b, f * i[m].x, i[m].y);
      });
    }
    e.translateThumbs = a;
    function l(o, i, u, f) {
      for (var b = 0, m = D(o[0], i, u, f), w = 1; w < o.length; w++) {
        var E = D(o[w], i, u, f);
        E < m && (m = E, b = w);
      }
      return b;
    }
    e.getClosestThumbIndex = l;
    function d(o, i, u) {
      o.style.transform = "translate(".concat(i, "px, ").concat(u, "px)");
    }
    e.translate = d;
    var v = function(o) {
      var i = [], u = null, f = function() {
        for (var b = [], m = 0; m < arguments.length; m++) b[m] = arguments[m];
        i = b, !u && (u = requestAnimationFrame(function() {
          u = null, o.apply(void 0, i);
        }));
      };
      return f;
    };
    e.schd = v;
    function k(o, i, u) {
      var f = o.slice(0);
      return f[i] = u, f;
    }
    e.replaceAt = k;
    function j(o) {
      var i = o.values, u = o.colors, f = o.min, b = o.max, m = o.direction, w = m === void 0 ? s.Direction.Right : m, E = o.rtl, P = E === void 0 ? !1 : E;
      P && w === s.Direction.Right ? w = s.Direction.Left : P && s.Direction.Left && (w = s.Direction.Right);
      var C = i.slice(0).sort(function(_, Y) {
        return _ - Y;
      }).map(function(_) {
        return (_ - f) / (b - f) * 100;
      }), U = C.reduce(function(_, Y, L) {
        return "".concat(_, ", ").concat(u[L], " ").concat(Y, "%, ").concat(u[L + 1], " ").concat(Y, "%");
      }, "");
      return "linear-gradient(".concat(w, ", ").concat(u[0], " 0%").concat(U, ", ").concat(u[u.length - 1], " 100%)");
    }
    e.getTrackBackground = j;
    function x() {
    }
    e.voidFn = x;
    function O(o) {
      throw new Error("Didn't expect to get here");
    }
    e.assertUnreachable = O;
    var S = function(o, i, u, f, b) {
      b === void 0 && (b = function(w) {
        return w;
      });
      var m = Math.ceil(r([o], Array.from(o.children), !0).reduce(function(w, E) {
        var P = Math.ceil(E.getBoundingClientRect().width);
        if (E.innerText && E.innerText.includes(u) && E.childElementCount === 0) {
          var C = E.cloneNode(!0);
          C.innerHTML = b(i.toFixed(f)), C.style.visibility = "hidden", document.body.appendChild(C), P = Math.ceil(C.getBoundingClientRect().width), document.body.removeChild(C);
        }
        return P > w ? P : w;
      }, o.getBoundingClientRect().width));
      return m;
    }, B = function(o, i, u, f, b, m, w) {
      w === void 0 && (w = function(C) {
        return C;
      });
      var E = [], P = function(C) {
        var U = S(u[C], f[C], b, m, w), _ = i[C].x;
        i.forEach(function(Y, L) {
          var $ = Y.x, J = S(u[L], f[L], b, m, w);
          C !== L && (_ >= $ && _ <= $ + J || _ + U >= $ && _ + U <= $ + J) && (E.includes(L) || (E.push(C), E.push(L), E = r(r([], E, !0), [C, L], !1), P(L)));
        });
      };
      return P(o), Array.from(new Set(E.sort()));
    }, R = function(o, i, u, f, b, m) {
      f === void 0 && (f = 0.1), b === void 0 && (b = " - "), m === void 0 && (m = function(L) {
        return L;
      });
      var w = (0, e.getStepDecimals)(f), E = (0, n.useState)({}), P = E[0], C = E[1], U = (0, n.useState)(m(i[u].toFixed(w))), _ = U[0], Y = U[1];
      return (0, n.useEffect)(function() {
        if (o) {
          var L = o.getThumbs();
          if (L.length < 1) return;
          var $ = {}, J = o.getOffsets(), re = B(u, J, L, i, b, w, m), se = m(i[u].toFixed(w));
          if (re.length) {
            var ee = re.reduce(function(te, oe, de, fe) {
              return te.length ? r(r([], te, !0), [J[fe[de]].x], !1) : [J[fe[de]].x];
            }, []);
            if (Math.min.apply(Math, ee) === J[u].x) {
              var ue = [];
              re.forEach(function(te) {
                ue.push(i[te].toFixed(w));
              }), se = Array.from(new Set(ue.sort(function(te, oe) {
                return parseFloat(te) - parseFloat(oe);
              }))).map(m).join(b);
              var le = Math.min.apply(Math, ee), ce = Math.max.apply(Math, ee), Me = L[re[ee.indexOf(ce)]].getBoundingClientRect().width;
              $.left = "".concat(Math.abs(le - (ce + Me)) / 2, "px"), $.transform = "translate(-50%, 0)";
            } else $.visibility = "hidden";
          }
          Y(se), C($);
        }
      }, [o, i]), [_, P];
    };
    e.useThumbOverlap = R;
    function D(o, i, u, f) {
      var b = o.getBoundingClientRect(), m = b.left, w = b.top, E = b.width, P = b.height;
      return z(f) ? Math.abs(u - (w + P / 2)) : Math.abs(i - (m + E / 2));
    }
    var N = function() {
      var o, i = ((o = navigator.userAgentData) === null || o === void 0 ? void 0 : o.platform) || navigator.platform;
      return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(i) || // iPad on iOS 13 detection
      navigator.userAgent.includes("Mac") && "ontouchend" in document;
    };
    e.isIOS = N;
  })(pe)), pe;
}
var Ue;
function St() {
  if (Ue) return X;
  Ue = 1;
  var e = X && X.__extends || /* @__PURE__ */ (function() {
    var M = function(y, h) {
      return M = Object.setPrototypeOf || {
        __proto__: []
      } instanceof Array && function(t, a) {
        t.__proto__ = a;
      } || function(t, a) {
        for (var l in a) Object.prototype.hasOwnProperty.call(a, l) && (t[l] = a[l]);
      }, M(y, h);
    };
    return function(y, h) {
      if (typeof h != "function" && h !== null) throw new TypeError("Class extends value " + String(h) + " is not a constructor or null");
      M(y, h);
      function t() {
        this.constructor = y;
      }
      y.prototype = h === null ? Object.create(h) : (t.prototype = h.prototype, new t());
    };
  })(), r = X && X.__createBinding || (Object.create ? function(M, y, h, t) {
    t === void 0 && (t = h);
    var a = Object.getOwnPropertyDescriptor(y, h);
    (!a || ("get" in a ? !y.__esModule : a.writable || a.configurable)) && (a = {
      enumerable: !0,
      get: function() {
        return y[h];
      }
    }), Object.defineProperty(M, t, a);
  } : function(M, y, h, t) {
    t === void 0 && (t = h), M[t] = y[h];
  }), n = X && X.__setModuleDefault || (Object.create ? function(M, y) {
    Object.defineProperty(M, "default", {
      enumerable: !0,
      value: y
    });
  } : function(M, y) {
    M.default = y;
  }), s = X && X.__importStar || function(M) {
    if (M && M.__esModule) return M;
    var y = {};
    if (M != null) for (var h in M) h !== "default" && Object.prototype.hasOwnProperty.call(M, h) && r(y, M, h);
    return n(y, M), y;
  }, g = X && X.__spreadArray || function(M, y, h) {
    if (h || arguments.length === 2) for (var t = 0, a = y.length, l; t < a; t++) (l || !(t in y)) && (l || (l = Array.prototype.slice.call(y, 0, t)), l[t] = y[t]);
    return M.concat(l || Array.prototype.slice.call(y));
  };
  Object.defineProperty(X, "__esModule", {
    value: !0
  });
  var T = s(Ke), c = /* @__PURE__ */ qe(), p = /* @__PURE__ */ Ee(), V = ["ArrowRight", "ArrowUp", "k", "PageUp"], z = ["ArrowLeft", "ArrowDown", "j", "PageDown"], A = (
    /** @class */
    (function(M) {
      e(y, M);
      function y(h) {
        var t = M.call(this, h) || this;
        if (t.trackRef = T.createRef(), t.thumbRefs = [], t.state = {
          draggedTrackPos: [-1, -1],
          draggedThumbIndex: -1,
          thumbZIndexes: new Array(t.props.values.length).fill(0).map(function(a, l) {
            return l;
          }),
          isChanged: !1,
          markOffsets: []
        }, t.getOffsets = function() {
          var a = t.props, l = a.direction, d = a.values, v = a.min, k = a.max, j = t.trackRef.current;
          if (!j) return console.warn("No track element found."), [];
          var x = j.getBoundingClientRect(), O = (0, c.getPaddingAndBorder)(j);
          return t.getThumbs().map(function(S, B) {
            var R = {
              x: 0,
              y: 0
            }, D = S.getBoundingClientRect(), N = (0, c.getMargin)(S);
            switch (l) {
              case p.Direction.Right:
                return R.x = (N.left + O.left) * -1, R.y = ((D.height - x.height) / 2 + O.top) * -1, R.x += x.width * (0, c.relativeValue)(d[B], v, k) - D.width / 2, R;
              case p.Direction.Left:
                return R.x = (N.right + O.right) * -1, R.y = ((D.height - x.height) / 2 + O.top) * -1, R.x += x.width - x.width * (0, c.relativeValue)(d[B], v, k) - D.width / 2, R;
              case p.Direction.Up:
                return R.x = ((D.width - x.width) / 2 + N.left + O.left) * -1, R.y = -O.left, R.y += x.height - x.height * (0, c.relativeValue)(d[B], v, k) - D.height / 2, R;
              case p.Direction.Down:
                return R.x = ((D.width - x.width) / 2 + N.left + O.left) * -1, R.y = -O.left, R.y += x.height * (0, c.relativeValue)(d[B], v, k) - D.height / 2, R;
              default:
                return (0, c.assertUnreachable)(l);
            }
          });
        }, t.getThumbs = function() {
          return t.trackRef && t.trackRef.current ? Array.from(t.trackRef.current.children).filter(function(a) {
            return a.hasAttribute("aria-valuenow");
          }) : (console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"), []);
        }, t.getTargetIndex = function(a) {
          return t.getThumbs().findIndex(function(l) {
            return l === a.target || l.contains(a.target);
          });
        }, t.addTouchEvents = function(a) {
          document.addEventListener("touchmove", t.schdOnTouchMove, {
            passive: !1
          }), document.addEventListener("touchend", t.schdOnEnd, {
            passive: !1
          }), document.addEventListener("touchcancel", t.schdOnEnd, {
            passive: !1
          });
        }, t.addMouseEvents = function(a) {
          document.addEventListener("mousemove", t.schdOnMouseMove), document.addEventListener("mouseup", t.schdOnEnd);
        }, t.onMouseDownTrack = function(a) {
          var l;
          if (!(a.button !== 0 || (0, c.isIOS)())) if (a.persist(), a.preventDefault(), t.addMouseEvents(a.nativeEvent), t.props.values.length > 1 && t.props.draggableTrack) {
            if (t.thumbRefs.some(function(v) {
              var k;
              return (k = v.current) === null || k === void 0 ? void 0 : k.contains(a.target);
            })) return;
            t.setState({
              draggedTrackPos: [a.clientX, a.clientY]
            }, function() {
              return t.onMove(a.clientX, a.clientY);
            });
          } else {
            var d = (0, c.getClosestThumbIndex)(t.thumbRefs.map(function(v) {
              return v.current;
            }), a.clientX, a.clientY, t.props.direction);
            (l = t.thumbRefs[d].current) === null || l === void 0 || l.focus(), t.setState({
              draggedThumbIndex: d
            }, function() {
              return t.onMove(a.clientX, a.clientY);
            });
          }
        }, t.onResize = function() {
          (0, c.translateThumbs)(t.getThumbs(), t.getOffsets(), t.props.rtl), t.calculateMarkOffsets();
        }, t.onTouchStartTrack = function(a) {
          var l;
          if (a.persist(), t.addTouchEvents(a.nativeEvent), t.props.values.length > 1 && t.props.draggableTrack) {
            if (t.thumbRefs.some(function(v) {
              var k;
              return (k = v.current) === null || k === void 0 ? void 0 : k.contains(a.target);
            })) return;
            t.setState({
              draggedTrackPos: [a.touches[0].clientX, a.touches[0].clientY]
            }, function() {
              return t.onMove(a.touches[0].clientX, a.touches[0].clientY);
            });
          } else {
            var d = (0, c.getClosestThumbIndex)(t.thumbRefs.map(function(v) {
              return v.current;
            }), a.touches[0].clientX, a.touches[0].clientY, t.props.direction);
            (l = t.thumbRefs[d].current) === null || l === void 0 || l.focus(), t.setState({
              draggedThumbIndex: d
            }, function() {
              return t.onMove(a.touches[0].clientX, a.touches[0].clientY);
            });
          }
        }, t.onMouseOrTouchStart = function(a) {
          if (!t.props.disabled) {
            var l = (0, c.isTouchEvent)(a);
            if (!(!l && a.button !== 0)) {
              var d = t.getTargetIndex(a);
              d !== -1 && (l ? t.addTouchEvents(a) : t.addMouseEvents(a), t.setState({
                draggedThumbIndex: d,
                thumbZIndexes: t.state.thumbZIndexes.map(function(v, k) {
                  return k === d ? Math.max.apply(Math, t.state.thumbZIndexes) : v <= t.state.thumbZIndexes[d] ? v : v - 1;
                })
              }));
            }
          }
        }, t.onMouseMove = function(a) {
          a.preventDefault(), t.onMove(a.clientX, a.clientY);
        }, t.onTouchMove = function(a) {
          a.preventDefault(), t.onMove(a.touches[0].clientX, a.touches[0].clientY);
        }, t.onKeyDown = function(a) {
          var l = t.props, d = l.values, v = l.onChange, k = l.step, j = l.rtl, x = l.direction, O = t.state.isChanged, S = t.getTargetIndex(a.nativeEvent), B = j || x === p.Direction.Left || x === p.Direction.Down ? -1 : 1;
          S !== -1 && (V.includes(a.key) ? (a.preventDefault(), t.setState({
            draggedThumbIndex: S,
            isChanged: !0
          }), v((0, c.replaceAt)(d, S, t.normalizeValue(d[S] + B * (a.key === "PageUp" ? k * 10 : k), S)))) : z.includes(a.key) ? (a.preventDefault(), t.setState({
            draggedThumbIndex: S,
            isChanged: !0
          }), v((0, c.replaceAt)(d, S, t.normalizeValue(d[S] - B * (a.key === "PageDown" ? k * 10 : k), S)))) : a.key === "Tab" ? t.setState({
            draggedThumbIndex: -1
          }, function() {
            O && t.fireOnFinalChange();
          }) : O && t.fireOnFinalChange());
        }, t.onKeyUp = function(a) {
          var l = t.state.isChanged;
          t.setState({
            draggedThumbIndex: -1
          }, function() {
            l && t.fireOnFinalChange();
          });
        }, t.onMove = function(a, l) {
          var d = t.state, v = d.draggedThumbIndex, k = d.draggedTrackPos, j = t.props, x = j.direction, O = j.min, S = j.max, B = j.onChange, R = j.values, D = j.step, N = j.rtl;
          if (v === -1 && k[0] === -1 && k[1] === -1) return null;
          var o = t.trackRef.current;
          if (!o) return null;
          var i = o.getBoundingClientRect(), u = (0, c.isVertical)(x) ? i.height : i.width;
          if (k[0] !== -1 && k[1] !== -1) {
            var f = a - k[0], b = l - k[1], m = 0;
            switch (x) {
              case p.Direction.Right:
              case p.Direction.Left:
                m = f / u * (S - O);
                break;
              case p.Direction.Down:
              case p.Direction.Up:
                m = b / u * (S - O);
                break;
              default:
                (0, c.assertUnreachable)(x);
            }
            if (N && (m *= -1), Math.abs(m) >= D / 2) {
              for (var w = 0; w < t.thumbRefs.length; w++) {
                if (R[w] === S && Math.sign(m) === 1 || R[w] === O && Math.sign(m) === -1) return;
                var E = R[w] + m;
                E > S ? m = S - R[w] : E < O && (m = O - R[w]);
              }
              for (var P = R.slice(0), w = 0; w < t.thumbRefs.length; w++) P = (0, c.replaceAt)(P, w, t.normalizeValue(R[w] + m, w));
              t.setState({
                draggedTrackPos: [a, l]
              }), B(P);
            }
          } else {
            var C = 0;
            switch (x) {
              case p.Direction.Right:
                C = (a - i.left) / u * (S - O) + O;
                break;
              case p.Direction.Left:
                C = (u - (a - i.left)) / u * (S - O) + O;
                break;
              case p.Direction.Down:
                C = (l - i.top) / u * (S - O) + O;
                break;
              case p.Direction.Up:
                C = (u - (l - i.top)) / u * (S - O) + O;
                break;
              default:
                (0, c.assertUnreachable)(x);
            }
            N && (C = S + O - C), Math.abs(R[v] - C) >= D / 2 && B((0, c.replaceAt)(R, v, t.normalizeValue(C, v)));
          }
        }, t.normalizeValue = function(a, l) {
          var d = t.props, v = d.min, k = d.max, j = d.step, x = d.allowOverlap, O = d.values;
          return (0, c.normalizeValue)(a, l, v, k, j, x, O);
        }, t.onEnd = function(a) {
          if (a.preventDefault(), document.removeEventListener("mousemove", t.schdOnMouseMove), document.removeEventListener("touchmove", t.schdOnTouchMove), document.removeEventListener("mouseup", t.schdOnEnd), document.removeEventListener("touchend", t.schdOnEnd), document.removeEventListener("touchcancel", t.schdOnEnd), t.state.draggedThumbIndex === -1 && t.state.draggedTrackPos[0] === -1 && t.state.draggedTrackPos[1] === -1) return null;
          t.setState({
            draggedThumbIndex: -1,
            draggedTrackPos: [-1, -1]
          }, function() {
            t.fireOnFinalChange();
          });
        }, t.fireOnFinalChange = function() {
          t.setState({
            isChanged: !1
          });
          var a = t.props, l = a.onFinalChange, d = a.values;
          l && l(d);
        }, t.updateMarkRefs = function(a) {
          if (!a.renderMark) {
            t.numOfMarks = void 0, t.markRefs = void 0;
            return;
          }
          t.numOfMarks = (a.max - a.min) / t.props.step, t.markRefs = [];
          for (var l = 0; l < t.numOfMarks + 1; l++) t.markRefs[l] = T.createRef();
        }, t.calculateMarkOffsets = function() {
          if (!(!t.props.renderMark || !t.trackRef || !t.numOfMarks || !t.markRefs || t.trackRef.current === null)) {
            for (var a = window.getComputedStyle(t.trackRef.current), l = parseInt(a.width, 10), d = parseInt(a.height, 10), v = parseInt(a.paddingLeft, 10), k = parseInt(a.paddingTop, 10), j = [], x = 0; x < t.numOfMarks + 1; x++) {
              var O = 9999, S = 9999;
              if (t.markRefs[x].current) {
                var B = t.markRefs[x].current.getBoundingClientRect();
                O = B.height, S = B.width;
              }
              t.props.direction === p.Direction.Left || t.props.direction === p.Direction.Right ? j.push([Math.round(l / t.numOfMarks * x + v - S / 2), -Math.round((O - d) / 2)]) : j.push([Math.round(d / t.numOfMarks * x + k - O / 2), -Math.round((S - l) / 2)]);
            }
            t.setState({
              markOffsets: j
            });
          }
        }, h.step === 0) throw new Error('"step" property should be a positive number');
        return t.schdOnMouseMove = (0, c.schd)(t.onMouseMove), t.schdOnTouchMove = (0, c.schd)(t.onTouchMove), t.schdOnEnd = (0, c.schd)(t.onEnd), t.thumbRefs = h.values.map(function() {
          return T.createRef();
        }), t.updateMarkRefs(h), t;
      }
      return y.prototype.componentDidMount = function() {
        var h = this, t = this.props, a = t.values, l = t.min, d = t.step;
        this.resizeObserver = window.ResizeObserver ? new window.ResizeObserver(this.onResize) : {
          observe: function() {
            return window.addEventListener("resize", h.onResize);
          },
          unobserve: function() {
            return window.removeEventListener("resize", h.onResize);
          }
        }, document.addEventListener("touchstart", this.onMouseOrTouchStart, {
          passive: !1
        }), document.addEventListener("mousedown", this.onMouseOrTouchStart, {
          passive: !1
        }), !this.props.allowOverlap && (0, c.checkInitialOverlap)(this.props.values), this.props.values.forEach(function(v) {
          return (0, c.checkBoundaries)(v, h.props.min, h.props.max);
        }), this.resizeObserver.observe(this.trackRef.current), (0, c.translateThumbs)(this.getThumbs(), this.getOffsets(), this.props.rtl), this.calculateMarkOffsets(), a.forEach(function(v) {
          (0, c.isStepDivisible)(l, v, d) || console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.");
        });
      }, y.prototype.componentDidUpdate = function(h, t) {
        var a = this.props, l = a.max, d = a.min, v = a.step, k = a.values, j = a.rtl;
        (h.max !== l || h.min !== d || h.step !== v) && this.updateMarkRefs(this.props), (0, c.translateThumbs)(this.getThumbs(), this.getOffsets(), j), (h.max !== l || h.min !== d || h.step !== v || t.markOffsets.length !== this.state.markOffsets.length) && (this.calculateMarkOffsets(), k.forEach(function(x) {
          (0, c.isStepDivisible)(d, x, v) || console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.");
        }));
      }, y.prototype.componentWillUnmount = function() {
        var h = {
          passive: !1
        };
        document.removeEventListener("mousedown", this.onMouseOrTouchStart, h), document.removeEventListener("mousemove", this.schdOnMouseMove), document.removeEventListener("touchmove", this.schdOnTouchMove), document.removeEventListener("touchstart", this.onMouseOrTouchStart), document.removeEventListener("mouseup", this.schdOnEnd), document.removeEventListener("touchend", this.schdOnEnd), this.resizeObserver.unobserve(this.trackRef.current);
      }, y.prototype.render = function() {
        var h = this, t = this.props, a = t.label, l = t.labelledBy, d = t.renderTrack, v = t.renderThumb, k = t.renderMark, j = k === void 0 ? function() {
          return null;
        } : k, x = t.values, O = t.min, S = t.max, B = t.allowOverlap, R = t.disabled, D = this.state, N = D.draggedThumbIndex, o = D.thumbZIndexes, i = D.markOffsets;
        return d({
          props: {
            style: {
              // creates stacking context that prevents z-index applied to thumbs
              // interfere with other elements
              transform: "scale(1)",
              cursor: N > -1 ? "grabbing" : this.props.draggableTrack ? (0, c.isVertical)(this.props.direction) ? "ns-resize" : "ew-resize" : x.length === 1 && !R ? "pointer" : "inherit"
            },
            onMouseDown: R ? c.voidFn : this.onMouseDownTrack,
            onTouchStart: R ? c.voidFn : this.onTouchStartTrack,
            ref: this.trackRef
          },
          isDragged: this.state.draggedThumbIndex > -1,
          disabled: R,
          children: g(g([], i.map(function(u, f, b) {
            return j({
              props: {
                style: h.props.direction === p.Direction.Left || h.props.direction === p.Direction.Right ? {
                  position: "absolute",
                  left: "".concat(u[0], "px"),
                  marginTop: "".concat(u[1], "px")
                } : {
                  position: "absolute",
                  top: "".concat(u[0], "px"),
                  marginLeft: "".concat(u[1], "px")
                },
                key: "mark".concat(f),
                ref: h.markRefs[f]
              },
              index: f
            });
          }), !0), x.map(function(u, f) {
            var b = h.state.draggedThumbIndex === f;
            return v({
              index: f,
              value: u,
              isDragged: b,
              props: {
                style: {
                  position: "absolute",
                  zIndex: o[f],
                  cursor: R ? "inherit" : b ? "grabbing" : "grab",
                  userSelect: "none",
                  touchAction: "none",
                  WebkitUserSelect: "none",
                  MozUserSelect: "none",
                  msUserSelect: "none"
                },
                key: f,
                tabIndex: R ? void 0 : 0,
                "aria-valuemax": B ? S : x[f + 1] || S,
                "aria-valuemin": B ? O : x[f - 1] || O,
                "aria-valuenow": u,
                draggable: !1,
                ref: h.thumbRefs[f],
                "aria-label": a,
                "aria-labelledby": l,
                role: "slider",
                onKeyDown: R ? c.voidFn : h.onKeyDown,
                onKeyUp: R ? c.voidFn : h.onKeyUp
              }
            });
          }), !0)
        });
      }, y.defaultProps = {
        label: "Accessibility label",
        labelledBy: null,
        step: 1,
        direction: p.Direction.Right,
        rtl: !1,
        disabled: !1,
        allowOverlap: !1,
        draggableTrack: !1,
        min: 0,
        max: 100
      }, y;
    })(T.Component)
  );
  return X.default = A, X;
}
var Xe;
function Dt() {
  return Xe || (Xe = 1, (function(e) {
    var r = he && he.__importDefault || function(T) {
      return T && T.__esModule ? T : {
        default: T
      };
    };
    Object.defineProperty(e, "__esModule", {
      value: !0
    }), e.checkValuesAgainstBoundaries = e.relativeValue = e.useThumbOverlap = e.Direction = e.getTrackBackground = e.Range = void 0;
    var n = r(/* @__PURE__ */ St());
    e.Range = n.default;
    var s = /* @__PURE__ */ qe();
    Object.defineProperty(e, "getTrackBackground", {
      enumerable: !0,
      get: function() {
        return s.getTrackBackground;
      }
    }), Object.defineProperty(e, "useThumbOverlap", {
      enumerable: !0,
      get: function() {
        return s.useThumbOverlap;
      }
    }), Object.defineProperty(e, "relativeValue", {
      enumerable: !0,
      get: function() {
        return s.relativeValue;
      }
    }), Object.defineProperty(e, "checkValuesAgainstBoundaries", {
      enumerable: !0,
      get: function() {
        return s.checkValuesAgainstBoundaries;
      }
    });
    var g = /* @__PURE__ */ Ee();
    Object.defineProperty(e, "Direction", {
      enumerable: !0,
      get: function() {
        return g.Direction;
      }
    });
  })(he)), he;
}
var Qe = /* @__PURE__ */ Dt();
function Ye(e, r) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var s = Object.getOwnPropertySymbols(e);
    r && (s = s.filter(function(g) {
      return Object.getOwnPropertyDescriptor(e, g).enumerable;
    })), n.push.apply(n, s);
  }
  return n;
}
function ge(e) {
  for (var r = 1; r < arguments.length; r++) {
    var n = arguments[r] != null ? arguments[r] : {};
    r % 2 ? Ye(Object(n), !0).forEach(function(s) {
      Et(e, s, n[s]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ye(Object(n)).forEach(function(s) {
      Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(n, s));
    });
  }
  return e;
}
function Et(e, r, n) {
  return r in e ? Object.defineProperty(e, r, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = n, e;
}
var ve = Z("div", {
  position: "relative",
  width: "100%"
});
ve.displayName = "Root";
ve.displayName = "Root";
ve.displayName = "StyledRoot";
var be = Z("div", function(e) {
  var r = e.$theme, n = e.$value, s = n === void 0 ? [] : n, g = e.$disabled, T = e.$isDragged, c = r.sizing, p = "inherit";
  return g ? p = "not-allowed" : T ? p = "grabbing" : s.length === 1 && (p = "pointer"), {
    paddingTop: c.scale600,
    paddingBottom: c.scale600,
    paddingRight: c.scale600,
    paddingLeft: c.scale600,
    display: "flex",
    cursor: p,
    backgroundColor: r.colors.sliderTrackFill
  };
});
be.displayName = "Track";
be.displayName = "Track";
be.displayName = "StyledTrack";
var ye = Z("div", function(e) {
  var r = e.$theme, n = e.$value, s = n === void 0 ? [] : n, g = e.$min, T = e.$max, c = e.$disabled, p = r.colors, V = r.borders, z = r.direction, A = r.borders.useRoundedCorners ? V.radius100 : 0;
  return {
    borderTopLeftRadius: A,
    borderTopRightRadius: A,
    borderBottomRightRadius: A,
    borderBottomLeftRadius: A,
    background: Qe.getTrackBackground({
      values: s,
      colors: s.length === 1 ? [c ? p.borderOpaque : p.primary, c ? p.backgroundSecondary : p.borderOpaque] : [c ? p.backgroundSecondary : p.borderOpaque, c ? p.borderOpaque : p.primary, c ? p.backgroundSecondary : p.borderOpaque],
      min: g || 0,
      max: T || 0,
      rtl: z === "rtl"
    }),
    height: "2px",
    width: "100%",
    alignSelf: "center",
    cursor: c ? "not-allowed" : "inherit"
  };
});
ye.displayName = "InnerTrack";
ye.displayName = "InnerTrack";
ye.displayName = "StyledInnerTrack";
var we = Z("div", function(e) {
  return {
    width: "4px",
    height: "2px",
    backgroundColor: e.$theme.colors.backgroundPrimary,
    marginLeft: "16px"
  };
});
we.displayName = "Mark";
we.displayName = "Mark";
we.displayName = "StyledMark";
var Te = Z("div", function(e) {
  return ge(ge({}, e.$theme.typography.font200), {}, {
    color: e.$theme.colors.contentPrimary
  });
});
Te.displayName = "Tick";
Te.displayName = "Tick";
Te.displayName = "StyledTick";
var ke = Z("div", function(e) {
  var r = e.$theme, n = r.sizing;
  return {
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    paddingRight: n.scale600,
    paddingLeft: n.scale600,
    paddingBottom: n.scale400
  };
});
ke.displayName = "TickBar";
ke.displayName = "TickBar";
ke.displayName = "StyledTickBar";
var xe = Z("div", function(e) {
  var r = e.$theme, n = e.$value, s = n === void 0 ? [] : n, g = e.$thumbIndex, T = e.$disabled, c = s.length === 2 && g === 0, p = s.length === 2 && g === 1;
  return r.direction === "rtl" && (p || c) && (c = !c, p = !p), {
    height: "24px",
    width: "24px",
    borderTopLeftRadius: "24px",
    borderTopRightRadius: "24px",
    borderBottomLeftRadius: "24px",
    borderBottomRightRadius: "24px",
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: T ? r.colors.sliderHandleFillDisabled : r.colors.sliderHandleFill,
    outline: "none",
    boxShadow: e.$isFocusVisible ? "0 0 0 3px ".concat(r.colors.accent) : "0 1px 4px rgba(0, 0, 0, 0.12)",
    cursor: T ? "not-allowed" : "inherit"
  };
});
xe.displayName = "Thumb";
xe.displayName = "Thumb";
xe.displayName = "StyledThumb";
var Oe = Z("div", function(e) {
  var r = e.$disabled, n = e.$theme;
  return {
    position: "absolute",
    top: "-16px",
    width: "4px",
    height: "20px",
    backgroundColor: r ? n.colors.sliderHandleFillDisabled : n.colors.sliderHandleInnerFill
  };
});
Oe.displayName = "InnerThumb";
Oe.displayName = "InnerThumb";
Oe.displayName = "StyledInnerThumb";
var Re = Z("div", function(e) {
  var r = e.$disabled, n = e.$theme;
  return ge(ge({
    position: "absolute",
    top: "-".concat(n.sizing.scale1400)
  }, n.typography.font200), {}, {
    backgroundColor: r ? n.colors.sliderHandleFillDisabled : n.colors.sliderHandleInnerFill,
    color: n.colors.contentInversePrimary,
    paddingLeft: n.sizing.scale600,
    paddingRight: n.sizing.scale600,
    paddingTop: n.sizing.scale500,
    paddingBottom: n.sizing.scale500,
    borderBottomLeftRadius: "48px",
    borderBottomRightRadius: "48px",
    borderTopLeftRadius: "48px",
    borderTopRightRadius: "48px",
    whiteSpace: "nowrap"
  });
});
Re.displayName = "ThumbValue";
Re.displayName = "ThumbValue";
Re.displayName = "StyledThumbValue";
function We(e, r) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var s = Object.getOwnPropertySymbols(e);
    r && (s = s.filter(function(g) {
      return Object.getOwnPropertyDescriptor(e, g).enumerable;
    })), n.push.apply(n, s);
  }
  return n;
}
function It(e) {
  for (var r = 1; r < arguments.length; r++) {
    var n = arguments[r] != null ? arguments[r] : {};
    r % 2 ? We(Object(n), !0).forEach(function(s) {
      Ct(e, s, n[s]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : We(Object(n)).forEach(function(s) {
      Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(n, s));
    });
  }
  return e;
}
function Ct(e, r, n) {
  return r in e ? Object.defineProperty(e, r, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = n, e;
}
function K() {
  return K = Object.assign ? Object.assign.bind() : function(e) {
    for (var r = 1; r < arguments.length; r++) {
      var n = arguments[r];
      for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
    }
    return e;
  }, K.apply(this, arguments);
}
function H(e, r) {
  return Lt(e) || Bt(e, r) || Pt(e, r) || jt();
}
function jt() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Pt(e, r) {
  if (e) {
    if (typeof e == "string") return He(e, r);
    var n = Object.prototype.toString.call(e).slice(8, -1);
    if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return He(e, r);
  }
}
function He(e, r) {
  (r == null || r > e.length) && (r = e.length);
  for (var n = 0, s = new Array(r); n < r; n++) s[n] = e[n];
  return s;
}
function Bt(e, r) {
  var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (n != null) {
    var s = [], g = !0, T = !1, c, p;
    try {
      for (n = n.call(e); !(g = (c = n.next()).done) && (s.push(c.value), !(r && s.length === r)); g = !0) ;
    } catch (V) {
      T = !0, p = V;
    } finally {
      try {
        !g && n.return != null && n.return();
      } finally {
        if (T) throw p;
      }
    }
    return s;
  }
}
function Lt(e) {
  if (Array.isArray(e)) return e;
}
var $t = function(e) {
  if (e.length > 2 || e.length === 0) throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");
  return e;
};
function Ft(e) {
  var r = e.overrides, n = r === void 0 ? {} : r, s = e.disabled, g = s === void 0 ? !1 : s, T = e.marks, c = T === void 0 ? !1 : T, p = e.onChange, V = p === void 0 ? function() {
  } : p, z = e.onFinalChange, A = z === void 0 ? function() {
  } : z, M = e.min, y = M === void 0 ? 0 : M, h = e.max, t = h === void 0 ? 100 : h, a = e.step, l = a === void 0 ? 1 : a, d = e.persistentThumb, v = d === void 0 ? !1 : d, k = e.valueToLabel, j = k === void 0 ? function(F) {
    return F;
  } : k, x = e.value, O = I.useContext(kt), S = I.useState(!1), B = H(S, 2), R = B[0], D = B[1], N = I.useState(!1), o = H(N, 2), i = o[0], u = o[1], f = I.useState(!1), b = H(f, 2), m = b[0], w = b[1], E = I.useState(-1), P = H(E, 2), C = P[0], U = P[1], _ = I.useCallback(function(F) {
    xt(F) && w(!0);
    var q = F.target.parentNode.firstChild === F.target ? 0 : 1;
    U(q);
  }, []), Y = I.useCallback(function(F) {
    m !== !1 && w(!1), U(-1);
  }, []), L = $t(x), $ = {
    $disabled: g,
    $step: l,
    $min: y,
    $max: t,
    $marks: c,
    $value: L,
    $isFocusVisible: m
  }, J = G(n.Root, ve), re = H(J, 2), se = re[0], ee = re[1], ue = G(n.Track, be), le = H(ue, 2), ce = le[0], Me = le[1], te = G(n.InnerTrack, ye), oe = H(te, 2), de = oe[0], fe = oe[1], Je = G(n.Thumb, xe), Ie = H(Je, 2), Ge = Ie[0], Ze = Ie[1], et = G(n.InnerThumb, Oe), Ce = H(et, 2), tt = Ce[0], rt = Ce[1], nt = G(n.ThumbValue, Re), je = H(nt, 2), at = je[0], ot = je[1], it = G(n.Tick, Te), Pe = H(it, 2), Be = Pe[0], Le = Pe[1], st = G(n.TickBar, ke), $e = H(st, 2), ut = $e[0], lt = $e[1], ct = G(n.Mark, we), Fe = H(ct, 2), dt = Fe[0], ft = Fe[1];
  return /* @__PURE__ */ I.createElement(se, K({
    "data-baseweb": "slider"
  }, $, ee, {
    onFocus: Rt(ee, _),
    onBlur: Ot(ee, Y)
  }), /* @__PURE__ */ I.createElement(Qe.Range, K({
    step: l,
    min: y,
    max: t,
    values: L,
    disabled: g,
    onChange: function(F) {
      return V({
        value: F
      });
    },
    onFinalChange: function(F) {
      return A({
        value: F
      });
    },
    rtl: O.direction === "rtl",
    renderTrack: function(F) {
      var q = F.props, W = F.children, ne = F.isDragged;
      return /* @__PURE__ */ I.createElement(ce, K({
        onMouseDown: q.onMouseDown,
        onTouchStart: q.onTouchStart,
        $isDragged: ne
      }, $, Me), /* @__PURE__ */ I.createElement(de, K({
        $isDragged: ne,
        ref: q.ref
      }, $, fe), W));
    },
    renderThumb: function(F) {
      var q = F.props, W = F.index, ne = F.isDragged, Ve = v || (!!W && i || !W && R || ne) && !g;
      return /* @__PURE__ */ I.createElement(Ge, K({}, q, {
        onMouseEnter: function() {
          W === 0 ? D(!0) : u(!0);
        },
        onMouseLeave: function() {
          W === 0 ? D(!1) : u(!1);
        },
        $thumbIndex: W,
        $isDragged: ne,
        style: It({}, q.style)
      }, $, Ze, {
        $isFocusVisible: m && C === W
      }), Ve && /* @__PURE__ */ I.createElement(at, K({
        $thumbIndex: W,
        $isDragged: ne
      }, $, ot), j(L[W])), Ve && /* @__PURE__ */ I.createElement(tt, K({
        $thumbIndex: W,
        $isDragged: ne
      }, $, rt)));
    }
  }, c ? {
    // eslint-disable-next-line react/display-name
    renderMark: function(F) {
      var q = F.props, W = F.index;
      return /* @__PURE__ */ I.createElement(dt, K({
        $markIndex: W
      }, q, $, ft));
    }
  } : {})), /* @__PURE__ */ I.createElement(ut, K({}, $, lt), /* @__PURE__ */ I.createElement(Be, K({}, $, Le), j(y)), /* @__PURE__ */ I.createElement(Be, K({}, $, Le), j(t))));
}
const Vt = /* @__PURE__ */ me("div", {
  target: "ew7r33m3"
})({
  name: "bjn8wh",
  styles: "position:relative"
}), zt = /* @__PURE__ */ me("div", {
  target: "ew7r33m2"
})(({
  disabled: e,
  theme: r,
  isDragged: n
}) => ({
  alignItems: "center",
  backgroundColor: e ? r.colors.gray60 : r.colors.primary,
  borderTopLeftRadius: "100%",
  borderTopRightRadius: "100%",
  borderBottomLeftRadius: "100%",
  borderBottomRightRadius: "100%",
  borderTopStyle: "none",
  borderBottomStyle: "none",
  borderRightStyle: "none",
  borderLeftStyle: "none",
  display: "flex",
  justifyContent: "center",
  height: r.sizes.sliderThumb,
  width: r.sizes.sliderThumb,
  boxShadow: n ? `0 0 0 0.2rem ${ze(r.colors.primary, 0.5)}` : "none",
  ":focus": {
    outline: "none"
  },
  ":focus-visible": {
    boxShadow: `0 0 0 0.2rem ${ze(r.colors.primary, 0.5)}`
  }
}), ""), Nt = /* @__PURE__ */ me("div", {
  target: "ew7r33m1"
})(({
  disabled: e,
  theme: r
}) => ({
  fontFamily: r.genericFonts.bodyFont,
  fontSize: r.fontSizes.sm,
  color: e ? r.colors.gray60 : r.colors.primary,
  top: "-1.6em",
  position: "absolute",
  whiteSpace: "nowrap",
  backgroundColor: r.colors.transparent,
  lineHeight: r.lineHeights.base,
  fontWeight: r.fontWeights.normal,
  // If values are clickable, it's hard to move the right thumb when they're
  // very close. So make them unclickable:
  pointerEvents: "none"
}), ""), _t = /* @__PURE__ */ me("div", {
  target: "ew7r33m0"
})(({
  theme: e,
  isHovered: r,
  isDisabled: n
}) => ({
  position: "absolute",
  left: 0,
  right: 0,
  top: "100%",
  display: "flex",
  justifyContent: "space-between",
  pointerEvents: "none",
  marginTop: `-${e.spacing.md}`,
  fontSize: e.fontSizes.sm,
  lineHeight: e.lineHeights.base,
  fontWeight: e.fontWeights.normal,
  color: n ? e.colors.fadedText40 : e.colors.fadedText60,
  opacity: r ? 1 : 0,
  transition: "opacity 70ms ease-in-out"
}), "");
function At({
  minLabel: e,
  maxLabel: r,
  isHovered: n,
  isDisabled: s
}) {
  return /* @__PURE__ */ Q.jsxs(_t, {
    "data-testid": "stSliderTickBar",
    isHovered: n,
    isDisabled: s,
    children: [/* @__PURE__ */ Q.jsx("span", {
      children: e
    }), /* @__PURE__ */ Q.jsx("span", {
      children: r
    })]
  });
}
function Ut({
  disabled: e,
  element: r,
  widgetMgr: n,
  fragmentId: s
}) {
  const [g, T] = Mt({
    getStateFromWidgetMgr: Xt,
    getDefaultStateFromProto: Yt,
    getCurrStateFromProto: Wt,
    updateWidgetMgrState: Ht,
    element: r,
    widgetMgr: n,
    fragmentId: s
  }), [c, p] = I.useState(g), [V, z] = I.useState(!1), [A, M] = I.useState(!1), y = I.useCallback(() => z(!0), []), h = I.useCallback(() => z(!1), []), t = I.useRef(null), [a] = I.useState([]), [l] = I.useState([]), d = pt(), v = c.map((D) => De(D, r)), k = De(r.min, r), j = De(r.max, r), x = r.label;
  I.useEffect(() => {
    p(g);
  }, [g]);
  const O = I.useCallback(({
    value: D
  }) => {
    T({
      value: D,
      fromUi: !0
    }), M(!1);
  }, [T]), S = I.useCallback(({
    value: D
  }) => {
    p(D), M(!0);
  }, []), B = I.useCallback(
    I.forwardRef(function(D, N) {
      const {
        $thumbIndex: o
      } = D, i = o || 0;
      a[i] = N, l[i] ||= I.createRef();
      const u = gt(D, ["role", "style", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabIndex", "onKeyUp", "onKeyDown", "onMouseEnter", "onMouseLeave", "draggable"]), f = v[i];
      return /* @__PURE__ */ Q.jsx(zt, {
        ...u,
        disabled: D.$disabled === !0,
        isDragged: D.$isDragged === !0,
        ref: a[i],
        "aria-valuetext": f,
        "aria-label": x,
        children: /* @__PURE__ */ Q.jsx(Nt, {
          "data-testid": "stSliderThumbValue",
          disabled: D.$disabled === !0,
          ref: l[i],
          children: f
        })
      });
    }),
    // Only run this on first render, to avoid losing the focus state.
    // Then, when the value written about the thumb needs to change, that
    // happens with the function below instead.
    []
  );
  I.useEffect(() => {
    l.map((f, b) => {
      f.current && (f.current.innerText = v[b]);
    }), a.map((f, b) => {
      f.current && f.current.setAttribute("aria-valuetext", v[b]);
    });
    const D = t.current ?? null, N = a[0].current, o = a[1]?.current, i = l[0].current, u = l[1]?.current;
    Qt(D, N, o, i, u);
  });
  const R = I.useCallback(({
    $disabled: D
  }) => ({
    height: d.spacing.twoXS,
    ...D ? {
      background: d.colors.darkenedBgMix25
    } : {}
  }), [d.colors.darkenedBgMix25, d.spacing.twoXS]);
  return /* @__PURE__ */ Q.jsxs(Vt, {
    ref: t,
    className: "stSlider",
    "data-testid": "stSlider",
    onMouseEnter: y,
    onMouseLeave: h,
    children: [/* @__PURE__ */ Q.jsx(mt, {
      label: r.label,
      disabled: e,
      labelVisibility: vt(r.labelVisibility?.value),
      children: r.help && /* @__PURE__ */ Q.jsx(bt, {
        children: /* @__PURE__ */ Q.jsx(yt, {
          content: r.help,
          placement: wt.TOP_RIGHT
        })
      })
    }), /* @__PURE__ */ Q.jsx(Ft, {
      min: r.min,
      max: r.max,
      step: r.step,
      value: qt(c, r),
      onChange: S,
      onFinalChange: O,
      disabled: e,
      overrides: {
        Thumb: B,
        Track: {
          style: {
            backgroundColor: "none !important",
            paddingLeft: d.spacing.none,
            paddingRight: d.spacing.none,
            // Set padding so total height equals minElementHeight (40px)
            // Total height = paddingTop + innerTrack height + paddingBottom
            paddingTop: `calc((${d.sizes.minElementHeight} - ${d.spacing.twoXS}) / 2)`,
            paddingBottom: `calc((${d.sizes.minElementHeight} - ${d.spacing.twoXS}) / 2)`
          }
        },
        InnerTrack: {
          style: R
        },
        // Show min/max labels when hovering the slider or dragging it
        TickBar: {
          component: At,
          props: {
            minLabel: k,
            maxLabel: j,
            isHovered: V || A,
            isDisabled: e
          }
        }
      }
    })]
  });
}
function Xt(e, r) {
  return e.getDoubleArrayValue(r);
}
function Yt(e) {
  return e.default;
}
function Wt(e) {
  return e.value;
}
function Ht(e, r, n, s) {
  r.setDoubleArrayValue(e, n.value, {
    fromUi: n.fromUi
  }, s);
}
function Kt(e) {
  const {
    dataType: r
  } = e;
  return r === Se.DataType.DATETIME || r === Se.DataType.DATE || r === Se.DataType.TIME;
}
function De(e, r) {
  const {
    format: n,
    options: s
  } = r;
  return Kt(r) ? Tt.utc(e / 1e3).format(n) : s.length > 0 ? Ne.sprintf(n, s[e]) : Ne.sprintf(n, e);
}
function qt(e, r) {
  const {
    min: n,
    max: s
  } = r;
  let g = e[0], T = e.length > 1 ? e[1] : e[0];
  return g > T && (g = T), g < n && (g = n), g > s && (g = s), T < n && (T = n), T > s && (T = s), e.length > 1 ? [g, T] : [g];
}
function Qt(e, r, n, s, g) {
  !e || !r || !s || (ae(e, r, s), n && g && (ae(e, n, g), Jt(e, r, n, s, g)));
}
function ae(e, r, n) {
  const s = e.getBoundingClientRect(), g = r.getBoundingClientRect(), T = n.getBoundingClientRect(), c = g.left + g.width / 2, p = c - T.width / 2 < s.left, V = c + T.width / 2 > s.right;
  n.style.left = p ? "0" : "", n.style.right = V ? "0" : "";
}
function Jt(e, r, n, s, g) {
  const T = e.getBoundingClientRect(), c = r.getBoundingClientRect(), p = n.getBoundingClientRect(), V = s.getBoundingClientRect(), z = g.getBoundingClientRect(), A = T.left + T.width / 2, M = c.left + c.width / 2, y = p.left + p.width / 2, h = M - V.width / 2 >= T.left, t = y + z.width / 2 <= T.right, a = c.left - V.width >= T.left, l = p.right + z.width <= T.right, d = h ? V.width / 2 : V.width, v = t ? z.width / 2 : z.width, k = M + d;
  if (y - v - k > 24) {
    ae(e, r, s), ae(e, n, g);
    return;
  }
  if (a && l) {
    s.style.left = "", s.style.right = `${Math.round(c.width)}px`, g.style.left = `${Math.round(p.width)}px`, g.style.right = "";
    return;
  }
  M < A ? (ae(e, r, s), g.style.left = `${Math.round(M + d + 24 - y)}px`, g.style.right = "") : (ae(e, n, g), s.style.left = "", s.style.right = `${-Math.round(y - v - 24 - M)}px`);
}
const tr = ht(I.memo(Ut));
export {
  tr as default
};
//# sourceMappingURL=index-D0GcWpyX-e4zGWI3t.js.map
