import { ref as o, watchEffect as _, openBlock as p, createElementBlock as f, createBaseVNode as e, normalizeClass as m, createVNode as x, withCtx as k, withDirectives as b, vModelText as h, unref as y, pushScopeId as w, popScopeId as C } from "./composables-108ad332.js";
import { UiLayer as L } from "./components.js";
import { _export_sfc as g } from "./_plugin-vue_export-helper-6a641814.js";
const c = (n) => (w("data-v-d9417bae"), n = n(), C(), n), I = { class: "flex flex-wrap" }, V = /* @__PURE__ */ c(() => /* @__PURE__ */ e("div", { class: "i-la-link" }, null, -1)), $ = [
  V
], B = { class: "p-4 max-w-600px" }, F = { class: "flex items-center gap-4" }, S = /* @__PURE__ */ c(() => /* @__PURE__ */ e("div", { class: "i-la-link text-2xl" }, null, -1)), U = /* @__PURE__ */ c(() => /* @__PURE__ */ e("div", { class: "text-lg" }, "Add a link", -1)), E = { class: "button text-xl" }, N = { class: "button text-xl" }, z = {
  __name: "FormLink",
  emits: ["update"],
  setup(n, { emit: r }) {
    const l = o(), s = o(), i = o(), v = o(!1), d = o();
    return _(() => {
      var u;
      s.value ? (v.value = (u = i == null ? void 0 : i.value) == null ? void 0 : u.checkValidity(), v.value && (d.value = s.value, r("update", s.value))) : d.value = null;
    }), (u, t) => (p(), f("div", I, [
      e("button", {
        class: m(["button m-1", { active: d.value }]),
        onClick: t[0] || (t[0] = (a) => l.value = !l.value)
      }, $, 2),
      x(y(L), {
        class: "mt-20",
        open: l.value,
        onClose: t[4] || (t[4] = (a) => l.value = !1)
      }, {
        default: k(() => [
          e("div", B, [
            e("div", F, [
              S,
              U,
              e("button", E, [
                e("div", {
                  class: "i-la-check",
                  onClick: t[1] || (t[1] = (a) => l.value = !1)
                })
              ]),
              e("button", N, [
                e("div", {
                  class: "i-la-trash-alt",
                  onClick: t[2] || (t[2] = (a) => {
                    s.value = null, l.value = !1;
                  })
                })
              ])
            ]),
            b(e("input", {
              class: "text-sm p-4 my-4 dark-bg-dark-200",
              ref_key: "input",
              ref: i,
              "onUpdate:modelValue": t[3] || (t[3] = (a) => s.value = a),
              type: "url",
              placeholder: "Paste a URL"
            }, null, 512), [
              [h, s.value]
            ])
          ])
        ]),
        _: 1
      }, 8, ["open"])
    ]));
  }
}, P = /* @__PURE__ */ g(z, [["__scopeId", "data-v-d9417bae"]]);
export {
  P as default
};
//# sourceMappingURL=FormLink-3bf2f420.js.map
