"use strict";var e=require("react/jsx-runtime"),r=require("lucide-react"),o=require("react"),t=require("styled-components"),n=require("./index-BoiKFBqR.js"),l=require("./ScreenLayout-DaFW0I3a.js");let i=t.styled.span`
  background-color: var(--privy-color-background);
  width: 100%;
  text-align: center;
  border: none;
  font-kerning: none;
  font-feature-settings: 'calt' off;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  cursor: pointer;

  &:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  && {
    color: var(--privy-color-foreground);
    font-size: 3.75rem;
    font-style: normal;
    font-weight: 600;
    line-height: 5.375rem;
  }
`,s=t.styled.span`
  color: var(--privy-color-foreground);
  font-kerning: none;
  font-feature-settings: 'calt' off;
  font-size: 1rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.5rem;
  margin-top: 0.75rem;
`,d=t.styled.button`
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
  gap: 0.5rem;
  border: 1px solid var(--privy-color-border-default);
  border-radius: var(--privy-border-radius-full);

  && {
    margin: auto;
    padding: 0.5rem 1rem;
  }
`,a=t.styled.div`
  svg {
    width: 1rem;
    height: 1rem;
    border-radius: var(--privy-border-radius-full);
    overflow: hidden;
    border: solid 0.1px var(--privy-color-border-default);
  }
`,c=t.styled.span`
  color: var(--privy-color-foreground);
  font-kerning: none;
  font-feature-settings: 'calt' off;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1.375rem;
`,u=t.styled.div`
  color: var(--privy-color-foreground);

  svg {
    width: 1.25rem;
    height: 1.25rem;
  }
`;let p=t.styled.div`
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-height: 20.875rem;
  overflow-y: auto;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }
`,f=t.styled.button`
  border-color: var(--privy-color-border-default);
  border-width: 1px;
  border-radius: var(--privy-border-radius-mdlg);
  border-style: solid;
  display: flex;

  && {
    padding: 0.75rem 1rem;
  }
`,h=t.styled.div`
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
`,y=t.styled.div`
  svg {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--privy-border-radius-full);
    overflow: hidden;
    border: solid 0.1px var(--privy-color-border-default);
  }
`,g=t.styled.div`
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
`,m=t.styled.span`
  color: var(--privy-color-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
`,v=t.styled.span`
  color: var(--privy-color-foreground-3);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.125rem;
`;exports.AmountInput=({currency:r="usd",value:t,onChange:l,inputMode:d="decimal",autoFocus:a})=>{let[c,u]=o.useState("0"),p=o.useRef(null),f=t??c,h=n.SUPPORTED_CURRENCIES[r]?.symbol??"$",y=o.useCallback((e=>{let r=e.target.value,o=(r=r.replace(/[^\d.]/g,"")).split(".");o.length>2&&(r=o[0]+"."+o.slice(1).join("")),2===o.length&&o[1].length>2&&(r=`${o[0]}.${o[1].slice(0,2)}`),r.length>1&&"0"===r[0]&&"."!==r[1]&&(r=r.slice(1)),(""===r||"."===r)&&(r="0"),l?l(r):u(r)}),[l]),g=o.useCallback((e=>{!(["Delete","Backspace","Tab","Escape","Enter",".","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||(e.ctrlKey||e.metaKey)&&["a","c","v","x"].includes(e.key.toLowerCase()))&&(e.key>="0"&&e.key<="9"||e.preventDefault())}),[]),m=o.useMemo((()=>(f.includes("."),f)),[f]);/*#__PURE__*/return e.jsxs(i,{onClick:()=>p.current?.focus(),children:[/*#__PURE__*/e.jsx(s,{children:h}),m,/*#__PURE__*/e.jsx("input",{ref:p,type:"text",inputMode:d,value:m,onChange:y,onKeyDown:g,autoFocus:a,placeholder:"0",style:{width:1,height:"1rem",opacity:0,alignSelf:"center",fontSize:"1rem"}}),/*#__PURE__*/e.jsx(s,{style:{opacity:0},children:h})]})},exports.CurrencySelector=({selectedAsset:o,onEditSourceAsset:t})=>{let{icon:l}=n.SUPPORTED_CURRENCIES[o];/*#__PURE__*/return e.jsxs(d,{onClick:t,children:[/*#__PURE__*/e.jsx(a,{children:l}),/*#__PURE__*/e.jsx(c,{children:o.toLocaleUpperCase()}),/*#__PURE__*/e.jsx(u,{children:/*#__PURE__*/e.jsx(r.ChevronDown,{})})]})},exports.SelectSourceAsset=({opts:r,isLoading:o,onSelectSource:t})=>/*#__PURE__*/e.jsx(l.ScreenLayout,{showClose:!1,showBack:!0,onBack:()=>t(r.source.selectedAsset),title:"Select currency",children:/*#__PURE__*/e.jsx(p,{children:r.source.assets.map((r=>{let{icon:l,name:i}=n.SUPPORTED_CURRENCIES[r];/*#__PURE__*/return e.jsx(f,{onClick:()=>t(r),disabled:o,children:/*#__PURE__*/e.jsxs(h,{children:[/*#__PURE__*/e.jsx(y,{children:l}),/*#__PURE__*/e.jsxs(g,{children:[/*#__PURE__*/e.jsx(m,{children:i}),/*#__PURE__*/e.jsx(v,{children:r.toLocaleUpperCase()})]})]})},r)}))})});
//# sourceMappingURL=SelectSourceAsset-D8gSMS4p.js.map
