import { c as b, p as W, f as E, b as S, d as q, u as O, h as j, n as A, o as w } from "./AssetItem-ufNA-vj9.js";
import { t as z, p as x, z as y, r as B, l as H, I, K, E as L, F as M, bt as P, L as R, W as U } from "./index-DRgrWhNH.js";
import { C as G } from "./App-C7TSmMh1.js";
import { C as J } from "./ContentHeader-B8i-EqEU.js";
import { B as k } from "./Button-Dvas4qfY.js";
import { s as N } from "./socket-io-Nm8Genck.js";
var Q = E("<!> <!>", 1), V = E("<!> <!>", 1);
function D(i, s) {
  if (new.target) return b({ component: D, ...i });
  z(s, !1);
  let a = W(s, "options", 12), { title: d, description: p, onConfirm: m, onCancel: _ } = a();
  var f = {
    get options() {
      return a();
    },
    set options(t) {
      a(t), H();
    },
    $set: O,
    $on: (t, r) => q(s, t, r)
  }, l = V(), u = x(l);
  J(u, {
    get text() {
      return d;
    },
    get description() {
      return p;
    }
  });
  var v = y(u, 2);
  return G(v, {
    class: "crtw-flex crtw-justify-between crtw-gap-10",
    children: (t, r) => {
      var e = Q(), n = x(e);
      k(n, {
        text: "Cancel",
        get onClick() {
          return _;
        }
      });
      var $ = y(n, 2);
      k($, {
        text: "Sign the message",
        get onClick() {
          return m;
        }
      }), S(t, e);
    },
    $$slots: { default: !0 }
  }), S(i, l), B(f);
}
function X(i, s) {
  if (new.target) return b({ component: X, ...i });
  z(s, !1);
  const a = () => w(R, "$pageOptsStore", p), d = () => w(U, "$configStore", p), [p, m] = A();
  var _ = this && this.__awaiter || function(t, r, e, n) {
    function $(c) {
      return c instanceof e ? c : new e(function(g) {
        g(c);
      });
    }
    return new (e || (e = Promise))(function(c, g) {
      function F(o) {
        try {
          h(n.next(o));
        } catch (C) {
          g(C);
        }
      }
      function T(o) {
        try {
          h(n.throw(o));
        } catch (C) {
          g(C);
        }
      }
      function h(o) {
        o.done ? c(o.value) : $(o.value).then(F, T);
      }
      h((n = n.apply(t, r || [])).next());
    });
  };
  const { close: f } = I(K), l = () => _(void 0, void 0, void 0, function* () {
    const { signature: t } = yield P.sui.signPersonalMessage(a().message);
    N.signDataAndEmitEvent(d().credenza.generalWssUrl, t, a().socketEventData), f();
  });
  var u = {
    $set: O,
    $on: (t, r) => q(s, t, r)
  };
  j();
  {
    let t = M(() => ({
      title: "Sign Transaction Request",
      description: "Please sign the requested transaction.",
      onCancel: f,
      onConfirm: l
    }));
    D(i, {
      get options() {
        return L(t);
      }
    });
  }
  var v = B(u);
  return m(), v;
}
export {
  X as default
};
//# sourceMappingURL=Sign-hFHCZENy.js.map
