import { g as R, p as t, l as H, i as k, k as U, m as Z, c as w, u as X, s as Y, a0 as re, r as G, X as $, t as F, a as q, a2 as B, a1 as ne, j as l, e as ie, Y as K, d as D, w as ee, z as y, I as J, f as M, B as d, ci as se, cc as ue, c9 as oe, W as ce, q as N, bS as de, n as ve, cz as fe, H as Q, ca as ge } from "./index-G5Vdjjso.js";
var me = M('<div class="error-icon svelte-1rlhaz8"><!></div>'), he = M('<button type="button" tabindex="-1"><!></button>'), be = M('<div aria-required="false" aria-haspopup="true"><div><!> <input data-input="" type="text"/></div> <!></div>');
function _e(V, e) {
  R(e, !1);
  const p = y();
  let v = t(e, "anchor", 12), c = t(e, "disabled", 8), f = t(e, "readonly", 8), g = t(e, "error", 8), C = t(e, "focused", 8), m = t(e, "placeholder", 8), z = t(e, "id", 8), P = t(e, "value", 8), h = t(e, "icon", 8), x = t(e, "enableTime", 8), I = t(e, "timeOnly", 8);
  H(
    () => (k(P()), k(x()), k(I())),
    () => {
      d(p, se(P(), { enableTime: x(), timeOnly: I() }));
    }
  ), U(), Z();
  var s = be();
  let S;
  var b = w(s);
  let W;
  var O = w(b);
  {
    var _ = (a) => {
      var r = me(), o = w(r);
      J(o, {
        name: "warning",
        color: "var(--spectrum-semantic-negative-color-icon)"
      }), G(r), D(a, r);
    };
    X(O, (a) => {
      g() && a(_);
    });
  }
  var i = Y(O, 2);
  re(i);
  let u;
  G(b);
  var L = Y(b, 2);
  {
    var j = (a) => {
      var r = he();
      let o;
      var T = w(r);
      J(T, {
        get name() {
          return h();
        }
      }), G(r), F((n) => o = q(r, 1, "spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button", null, o, n), [() => ({ "is-invalid": !!g() })]), D(a, r);
    };
    X(L, (a) => {
      !c() && !f() && a(j);
    });
  }
  G(s), $(s, (a) => v(a), () => v()), F(
    (a, r, o) => {
      S = q(s, 1, "spectrum-InputGroup spectrum-Datepicker svelte-1rlhaz8", null, S, a), B(s, "aria-readonly", f()), W = q(b, 1, "spectrum-Textfield spectrum-InputGroup-textfield svelte-1rlhaz8", null, W, r), i.disabled = c(), i.readOnly = f(), u = q(i, 1, "spectrum-Textfield-input spectrum-InputGroup-input svelte-1rlhaz8", null, u, o), B(i, "placeholder", m()), B(i, "id", z()), ne(i, l(p));
    },
    [
      () => ({
        "is-disabled": c() || f(),
        "is-invalid": !!g(),
        "is-focused": C()
      }),
      () => ({ "is-disabled": c(), "is-invalid": !!g() }),
      () => ({ "is-disabled": c() })
    ]
  ), ie("click", s, function(a) {
    K.call(this, e, a);
  }), D(V, s), ee();
}
var ye = M("<!> <!>", 1);
function Oe(V, e) {
  R(e, !1);
  const p = y(), v = y();
  let c = t(e, "id", 8, null), f = t(e, "disabled", 8, !1), g = t(e, "readonly", 8, !1), C = t(e, "error", 8, null), m = t(e, "enableTime", 8, !0), z = t(e, "value", 8, null), P = t(e, "placeholder", 8, null), h = t(e, "timeOnly", 8, !1), x = t(e, "ignoreTimezones", 8, !1), I = t(e, "useKeyboardShortcuts", 8, !0), s = t(e, "appendTo", 24, () => {
  }), S = t(e, "api", 12, null), b = t(e, "align", 24, () => ue.Left);
  const W = oe();
  let O = t(e, "startDayOfWeek", 24, () => {
  }), _ = y(!1), i = y(), u = y();
  const L = () => {
    d(_, !0);
  }, j = () => {
    d(_, !1);
  };
  ce(() => {
    S({
      open: () => l(u)?.show(),
      close: () => l(u)?.hide()
    });
  }), H(() => k(O()), () => {
    d(p, O() ?? W);
  }), H(
    () => (k(z()), k(m())),
    () => {
      d(v, ge(z(), { enableTime: m() }));
    }
  ), U(), Z();
  var a = ye(), r = N(a);
  {
    let T = Q(() => h() ? "clock" : "calendar");
    _e(r, {
      get disabled() {
        return f();
      },
      get readonly() {
        return g();
      },
      get error() {
        return C();
      },
      get placeholder() {
        return P();
      },
      get id() {
        return c();
      },
      get enableTime() {
        return m();
      },
      get timeOnly() {
        return h();
      },
      get focused() {
        return l(_);
      },
      get value() {
        return l(v);
      },
      get icon() {
        return l(T);
      },
      get anchor() {
        return l(i);
      },
      set anchor(n) {
        d(i, n);
      },
      $$events: {
        click(...n) {
          l(u)?.show?.apply(this, n);
        }
      },
      $$legacy: !0
    });
  }
  var o = Y(r, 2);
  {
    let T = Q(() => h() ? "fixed-to-anchor" : "no-anchor");
    $(
      de(o, {
        get portalTarget() {
          return s();
        },
        get anchor() {
          return l(i);
        },
        get align() {
          return b();
        },
        get widthMode() {
          return l(T);
        },
        resizable: !1,
        $$events: {
          open: [
            function(n) {
              K.call(this, e, n);
            },
            L
          ],
          close: [
            function(n) {
              K.call(this, e, n);
            },
            j
          ]
        },
        children: (n, ke) => {
          var E = ve(), te = N(E);
          {
            var ae = (A) => {
              fe(A, {
                get useKeyboardShortcuts() {
                  return I();
                },
                get ignoreTimezones() {
                  return x();
                },
                get enableTime() {
                  return m();
                },
                get timeOnly() {
                  return h();
                },
                get startDayOfWeek() {
                  return l(p);
                },
                get value() {
                  return l(v);
                },
                $$events: {
                  change(le) {
                    K.call(this, e, le);
                  }
                }
              });
            };
            X(te, (A) => {
              l(_) && A(ae);
            });
          }
          D(n, E);
        },
        $$slots: { default: !0 },
        $$legacy: !0
      }),
      (n) => d(u, n),
      () => l(u)
    );
  }
  D(V, a), ee();
}
export {
  Oe as D
};
