import { jsxs as l, jsx as t } from "react/jsx-runtime";
import { S as s } from "./shared.EdGf6tcG.js";
import { useState as k, useMemo as c, useCallback as m } from "react";
import { i as h } from "./url.D3ItqZWD.js";
import { B as g } from "./ButtonGroup.GFy-lPs3.js";
import { a as v } from "./TextInput.63vMRxAK.js";
import { O as S } from "./Onboarding.BDRBUM0D.js";
import { a as y } from "./Stack.XB4icBMm.js";
import { T as u } from "./Typography.a1p6WNM8.js";
import { a as C } from "./index.CfQlFjZU.js";
function I({
  onNext: r,
  onNoLinkInBio: o,
  loading: i
}) {
  const [e, a] = k(""), n = c(() => h(e), [e]), d = c(() => e.trim() === "" || n ? null : "Please enter a valid link", [n, e]), f = m(
    (b) => {
      a(b.target.value);
    },
    []
  ), p = m(() => {
    n && r(n.toString());
  }, [e, r, n]);
  return {
    buttons: [
      {
        label: "Next",
        semantic: s.PRIMARY,
        disabled: !n || i,
        loading: i,
        onClick: p
      },
      {
        label: "I don't have a link in bio",
        semantic: s.SECONDARY,
        onClick: o,
        disabled: i,
        casing: "sentence"
      }
    ],
    linkInBio: e,
    error: d,
    setLinkInBio: f,
    loading: i
  };
}
function B({ buttons: r, linkInBio: o, setLinkInBio: i, error: e, loading: a }) {
  return /* @__PURE__ */ l(S, { layout: "section", children: [
    /* @__PURE__ */ l(y, { direction: "column", spacing: 1, children: [
      /* @__PURE__ */ t(u, { variant: "header", size: "xlarge", children: "Tell us more about yourself" }),
      /* @__PURE__ */ t(u, { variant: "body", size: "medium", color: "charcoal", children: "Enter your main website or link in bio page and we will get you started." })
    ] }),
    /* @__PURE__ */ t(
      v,
      {
        label: "Website or link in bio",
        helper: e || void 0,
        isError: !!e,
        value: o,
        onChange: i,
        isDisabled: a
      }
    ),
    /* @__PURE__ */ t(g, { buttons: r, orientation: "vertical" })
  ] });
}
const z = C(B, I);
export {
  z as Q
};
