var j=Object.defineProperty,A=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var z=(e,o,n)=>o in e?j(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,v=(e,o)=>{for(var n in o||(o={}))D.call(o,n)&&z(e,n,o[n]);if(b)for(var n of b(o))M.call(o,n)&&z(e,n,o[n]);return e},R=(e,o)=>A(e,G(o));var k=(e,o)=>{var n={};for(var t in e)D.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&&M.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 T,Spinner as ce,Text as F}from"@chakra-ui/react";import ue from"@emotion/styled";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 V from"react";import{createMultiStyleConfigHelpers as Y,defineStyle as q,FormControl as N,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 B}from"react/jsx-runtime";var $=V.forwardRef((a,m)=>{var x=a,{label:e,error:o,placeholder:n,helperText:t,isInvalid:r,as:i=J,InputLeftAddon:l,InputRightAddon:f}=x,s=k(x,["label","error","placeholder","helperText","isInvalid","as","InputLeftAddon","InputRightAddon"]);let{disabled:P}=s;return B(N,{isInvalid:r,opacity:P?.4:1,children:[e&&g(C,{color:r?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),B(K,{mt:"2",children:[l,g(i,R(v({variant:"",placeholder:n},s),{ref:m})),f]}),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}=Y(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=q({borderRadius:"md"}),U={sm:_({field:Z})},De=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 w}from"react/jsx-runtime";var pe=ue(T)`
  position: relative;
`,fe=({duration:e,setDuration:o,loading:n,subTotalPrice:t,payUsing:r})=>w(pe,{paddingY:4,flexDir:"column",alignItems:"center",children:[u(E,{initialState:1,maxState:1e4,onChange:o,onError:()=>{},value:e}),w(T,{w:"full",justifyContent:"space-between",alignItems:"center",children:[u(F,{fontSize:14,mt:4,fontWeight:"bold",children:`${e} year registration`}),w(T,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[n?u(ce,{size:"xs",mb:"1.5"}):u(F,{fontSize:14,fontWeight:"bold",children:`${t==null?void 0:t.toFixed(5)}`}),u(F,{ml:"1",fontSize:14,fontWeight:"bold",children:r==null?void 0:r.ticker})]})]})]}),O=fe;import{jsx as d,jsxs as p}from"react/jsx-runtime";var Ie=({selectedDomain:e,duration:o,selectDuration:n,onOpen:t,onClose:r,isOpen:i,loading:l,subTotalPrice:f,payUsing:s})=>{let m=he();return p(H,{justifyContent:"space-between",children:[p(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`}),p(me,{blockScrollOnMount:!1,isOpen:i,onClose:r,isCentered:!0,children:[d(Ce,{}),p(ge,{children:[d(ye,{children:"Registration duration"}),d(be,{}),p(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:f,payUsing:s})]})]})]})]})},Ne=Ie;export{Ne as default};
