var A=Object.defineProperty,G=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var M=(e,o,n)=>o in e?A(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,v=(e,o)=>{for(var n in o||(o={}))T.call(o,n)&&M(e,n,o[n]);if(b)for(var n of b(o))D.call(o,n)&&M(e,n,o[n]);return e},k=(e,o)=>G(e,V(o));var B=(e,o)=>{var n={};for(var t in e)T.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&b)for(var t of b(e))o.indexOf(t)<0&&D.call(e,t)&&(n[t]=e[t]);return n};import{Flex as H,Modal as me,ModalBody as xe,ModalCloseButton as be,ModalContent as ge,ModalHeader as ye,ModalOverlay as Ce,Text as y,useToast as he}from"@chakra-ui/react";import{Flex as z,Spinner as ce,Text as w}from"@chakra-ui/react";import ue from"@emotion/styled";import"react";import{useEffect as h,useState as ee}from"react";import S from"@emotion/styled";import{AddIcon as oe,MinusIcon as te}from"@chakra-ui/icons";import{Box as ne,Button as re,Flex as ie,Text as le}from"@chakra-ui/react";import Y from"react";import{createMultiStyleConfigHelpers as q,defineStyle as N,FormControl as P,Input as J,InputGroup as K,Text as C}from"@chakra-ui/react";import{inputAnatomy as L}from"@chakra-ui/anatomy";import{jsx as g,jsxs as R}from"react/jsx-runtime";var $=Y.forwardRef((a,m)=>{var x=a,{label:e,error:o,placeholder:n,helperText:t,isInvalid:r,as:i=J,InputLeftAddon:l,InputRightAddon:p}=x,s=B(x,["label","error","placeholder","helperText","isInvalid","as","InputLeftAddon","InputRightAddon"]);let{disabled:j}=s;return R(P,{isInvalid:r,opacity:j?.4:1,children:[e&&g(C,{color:r?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),R(K,{mt:"2",children:[l,g(i,k(v({variant:"",placeholder:n},s),{ref:m})),p]}),t&&g(C,{fontSize:"xs",mt:2,color:"mutedForeground",children:t}),r&&o&&g(C,{fontSize:"xs",mt:2,color:"destructive",children:o})]})}),{definePartsStyle:_,defineMultiStyleConfig:Q}=q(L.keys),X=_({field:{color:"foreground",background:"background",boxShadow:"base",borderWidth:"1px",borderStyle:"solid",borderColor:"input",borderRadius:"lg",_focusVisible:{borderColor:"ring"},_hover:{},_disabled:{opacity:1},_placeholder:{color:"mutedForeground"}}}),Z=N({borderRadius:"md"}),U={sm:_({field:Z})},Te=Q({baseStyle:X,sizes:U});import{jsx as c,jsxs as I}from"react/jsx-runtime";var de=S(ne)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,W=S(re)`
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 32px;
  width: 32px;
  //border-radius: 12px;
  //border: none;
  //border: 1px solid ${e=>e.theme.colors.border};
  pointer-events: ${e=>e.disabled?"none":"unset"};
  opacity: ${e=>e.disabled?"0.5":"1"};

  &:active {
    border: 1px solid ${e=>e.theme.colors.foreground};
  }

  svg {
    path {
      fill: ${e=>e.theme.colors.foreground};
    }
  }
`,se=S($)`
  justify-content: center;
  font-size: 18px;
  min-width: 60px;
  user-select: none;
  border: none;
  box-shadow: none;
  max-width: 80px;
  text-align: center;
`,ae=({initialState:e=1,maxState:o,onChange:n,value:t,onError:r})=>{let[i,l]=ee(e);return h(()=>{n(i)},[i]),h(()=>{l(e)},[e]),h(()=>{o>0&&t>o||i<1?r(!0):r(!1)},[o,t,i]),I(ie,{flexDirection:"column",alignItems:"flex-end",children:[I(de,{children:[c(W,{variant:"outline",onClick:()=>{t>e&&l(a=>t-1)},disabled:t===1,children:c(te,{})}),c(se,{value:t,onChange:a=>{let x=Number(a.target.value);l(x)}}),c(W,{variant:"outline",onClick:()=>{o?t<o&&l(a=>t+1):l(a=>t+1)},disabled:o===t||!o,children:c(oe,{})})]}),(o>0&&t>o||i<1)&&I(le,{fontSize:12,mt:10,color:"#E11900",children:["Enter quantity between 1 to ",o]})]})},E=ae;import{jsx as u,jsxs as F}from"react/jsx-runtime";var fe=ue(z)`
  position: relative;
`,pe=({duration:e,setDuration:o,loading:n,subTotalPrice:t,payUsing:r})=>F(fe,{paddingY:4,flexDir:"column",alignItems:"center",children:[u(E,{initialState:1,maxState:1e4,onChange:o,onError:()=>{},value:e}),F(z,{w:"full",justifyContent:"space-between",alignItems:"center",children:[u(w,{fontSize:14,mt:4,fontWeight:"bold",children:`${e} year registration`}),F(z,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[n?u(ce,{size:"xs",mb:"1.5"}):u(w,{fontSize:14,fontWeight:"bold",children:`${t==null?void 0:t.toFixed(5)}`}),u(w,{ml:"1",fontSize:14,fontWeight:"bold",children:r==null?void 0:r.ticker})]})]})]}),O=pe;import{jsx as d,jsxs as f}from"react/jsx-runtime";var Ie=({selectedDomain:e,duration:o,selectDuration:n,onOpen:t,onClose:r,isOpen:i,loading:l,subTotalPrice:p,payUsing:s})=>{let m=he();return f(H,{justifyContent:"space-between",children:[f(H,{alignItems:"center",children:[d(y,{fontSize:"12",mr:"1",children:"Duration:"}),d(y,{textDecoration:"underline",fontSize:"12",cursor:"pointer",onClick:()=>{if(!e)return m({title:"Select Domain",status:"warning"});t()},children:"Edit"})]}),d(y,{fontSize:"12",mr:"1",children:`${o} Year`}),f(me,{blockScrollOnMount:!1,isOpen:i,onClose:r,isCentered:!0,children:[d(Ce,{}),f(ge,{children:[d(ye,{children:"Registration duration"}),d(be,{}),f(xe,{children:[d(y,{fontSize:"12",py:"2",px:"4",borderColor:"mutedForeground",borderWidth:"1px",borderStyle:"solid",borderRadius:"8",children:"Extending for multiple years will save money on network costs by avoiding yearly transactions."}),d(O,{duration:o,setDuration:n,loading:l,subTotalPrice:p,payUsing:s})]})]})]})]})},Ke=Ie;export{Ke as default};
