import { __exports as p } from "./index-_virtual72.js";
import k from "react";
import { __require as K } from "./index-prop-types.js";
import { __require as L } from "./index-classnames2.js";
import U from "./index-_virtual73.js";
import z from "./index-_virtual74.js";
import A from "./index-_virtual75.js";
import V from "./index-_virtual55.js";
var q;
function te() {
  if (q) return p;
  q = 1;
  function s(e) {
    "@babel/helpers - typeof";
    return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? s = function(r) {
      return typeof r;
    } : s = function(r) {
      return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
    }, s(e);
  }
  Object.defineProperty(p, "__esModule", {
    value: !0
  }), p.default = void 0;
  var d = I(k), i = f(/* @__PURE__ */ K()), R = f(L()), S = f(U), P = f(z), $ = f(A), F = f(V);
  function f(e) {
    return e && e.__esModule ? e : { default: e };
  }
  function w(e) {
    if (typeof WeakMap != "function") return null;
    var t = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap();
    return (w = function(u) {
      return u ? r : t;
    })(e);
  }
  function I(e, t) {
    if (e && e.__esModule)
      return e;
    if (e === null || s(e) !== "object" && typeof e != "function")
      return { default: e };
    var r = w(t);
    if (r && r.has(e))
      return r.get(e);
    var n = {}, u = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var a in e)
      if (a !== "default" && Object.prototype.hasOwnProperty.call(e, a)) {
        var o = u ? Object.getOwnPropertyDescriptor(e, a) : null;
        o && (o.get || o.set) ? Object.defineProperty(n, a, o) : n[a] = e[a];
      }
    return n.default = e, r && r.set(e, n), n;
  }
  function C(e, t) {
    if (!(e instanceof t))
      throw new TypeError("Cannot call a class as a function");
  }
  function M(e, t) {
    for (var r = 0; r < t.length; r++) {
      var n = t[r];
      n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
    }
  }
  function E(e, t, r) {
    return t && M(e.prototype, t), e;
  }
  function N(e, t) {
    if (typeof t != "function" && t !== null)
      throw new TypeError("Super expression must either be null or a function");
    e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), t && m(e, t);
  }
  function m(e, t) {
    return m = Object.setPrototypeOf || function(n, u) {
      return n.__proto__ = u, n;
    }, m(e, t);
  }
  function W(e) {
    var t = T();
    return function() {
      var n = y(e), u;
      if (t) {
        var a = y(this).constructor;
        u = Reflect.construct(n, arguments, a);
      } else
        u = n.apply(this, arguments);
      return B(this, u);
    };
  }
  function B(e, t) {
    return t && (s(t) === "object" || typeof t == "function") ? t : v(e);
  }
  function v(e) {
    if (e === void 0)
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return e;
  }
  function T() {
    if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
    if (typeof Proxy == "function") return !0;
    try {
      return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
      })), !0;
    } catch {
      return !1;
    }
  }
  function y(e) {
    return y = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
      return r.__proto__ || Object.getPrototypeOf(r);
    }, y(e);
  }
  function O(e, t, r) {
    return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
  }
  var g = /* @__PURE__ */ (function(e) {
    N(r, e);
    var t = W(r);
    function r(n, u) {
      var a;
      return C(this, r), a = t.call(this, n, u), O(v(a), "onKeyDown", function(o) {
        var l = a.state.value;
        o.key === "Enter" && a.update(l);
      }), O(v(a), "onChange", function(o) {
        a.setState({
          value: o.target.value,
          changed: !0,
          invalid: !1
        });
      }), O(v(a), "onBlur", function() {
        var o = a.state.value;
        a.update(o);
      }), a.state = {
        invalid: !1,
        changed: !1,
        value: a.formatDate(n)
      }, a;
    }
    return E(r, [{
      key: "componentDidUpdate",
      value: function(u) {
        var a = u.value;
        (0, S.default)(a, this.props.value) || this.setState({
          value: this.formatDate(this.props)
        });
      }
    }, {
      key: "formatDate",
      value: function(u) {
        var a = u.value, o = u.dateDisplayFormat, l = u.dateOptions;
        return a && (0, P.default)(a) ? (0, F.default)(a, o, l) : "";
      }
    }, {
      key: "update",
      value: function(u) {
        var a = this.state, o = a.invalid, l = a.changed;
        if (!(o || !l || !u)) {
          var c = this.props, b = c.onChange, D = c.dateDisplayFormat, h = c.dateOptions, _ = (0, $.default)(u, D, /* @__PURE__ */ new Date(), h);
          (0, P.default)(_) ? this.setState({
            changed: !1
          }, function() {
            return b(_);
          }) : this.setState({
            invalid: !0
          });
        }
      }
    }, {
      key: "render",
      value: function() {
        var u = this.props, a = u.className, o = u.readOnly, l = u.placeholder, c = u.ariaLabel, b = u.disabled, D = u.onFocus, h = this.state, _ = h.value, Y = h.invalid;
        return /* @__PURE__ */ d.default.createElement("span", {
          className: (0, R.default)("rdrDateInput", a)
        }, /* @__PURE__ */ d.default.createElement("input", {
          readOnly: o,
          disabled: b,
          value: _,
          placeholder: l,
          "aria-label": c,
          onKeyDown: this.onKeyDown,
          onChange: this.onChange,
          onBlur: this.onBlur,
          onFocus: D
        }), Y && /* @__PURE__ */ d.default.createElement("span", {
          className: "rdrWarning"
        }, "⚠"));
      }
    }]), r;
  })(d.PureComponent);
  g.propTypes = {
    value: i.default.object,
    placeholder: i.default.string,
    disabled: i.default.bool,
    readOnly: i.default.bool,
    dateOptions: i.default.object,
    dateDisplayFormat: i.default.string,
    ariaLabel: i.default.string,
    className: i.default.string,
    onFocus: i.default.func.isRequired,
    onChange: i.default.func.isRequired
  }, g.defaultProps = {
    readOnly: !0,
    disabled: !1,
    dateDisplayFormat: "MMM D, YYYY"
  };
  var x = g;
  return p.default = x, p;
}
export {
  te as __require
};
