import{Flex as h,Spinner as K,Text as b}from"@chakra-ui/react";import L from"@emotion/styled";import{useEffect as a,useState as j}from"react";import g from"@emotion/styled";import{AddIcon as A,MinusIcon as G}from"@chakra-ui/icons";import{Box as H,Button as V,Flex as q,Text as N}from"@chakra-ui/react";import k from"react";import{createMultiStyleConfigHelpers as B,defineStyle as R,FormControl as _,Input as $,InputGroup as v,Text as f}from"@chakra-ui/react";import{inputAnatomy as D}from"@chakra-ui/anatomy";import{jsx as u,jsxs as w}from"react/jsx-runtime";var F=k.forwardRef(({label:e,error:t,placeholder:d,helperText:o,isInvalid:n,as:r=$,InputLeftAddon:i,InputRightAddon:y,...p},C)=>{let{disabled:s}=p;return w(_,{isInvalid:n,opacity:s?.4:1,children:[e&&u(f,{color:n?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),w(v,{mt:"2",children:[i,u(r,{variant:"",placeholder:d,...p,ref:C}),y]}),o&&u(f,{fontSize:"xs",mt:2,color:"mutedForeground",children:o}),n&&t&&u(f,{fontSize:"xs",mt:2,color:"destructive",children:t})]})}),{definePartsStyle:T,defineMultiStyleConfig:W}=B(D.keys),P=T({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"}}}),E=R({borderRadius:"md"}),M={sm:T({field:E})},oe=W({baseStyle:P,sizes:M});import{jsx as l,jsxs as m}from"react/jsx-runtime";var U=g(H)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,z=g(V)`
  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};
    }
  }
`,Y=g(F)`
  justify-content: center;
  font-size: 18px;
  min-width: 60px;
  user-select: none;
  border: none;
  box-shadow: none;
  max-width: 80px;
  text-align: center;
`,J=({initialState:e=1,maxState:t,onChange:d,value:o,onError:n})=>{let[r,i]=j(e);return a(()=>{d(r)},[r]),a(()=>{i(e)},[e]),a(()=>{t>0&&o>t||r<1?n(!0):n(!1)},[t,o,r]),m(q,{flexDirection:"column",alignItems:"flex-end",children:[m(U,{children:[l(z,{variant:"outline",onClick:()=>{o>e&&i(s=>o-1)},disabled:o===1,children:l(G,{})}),l(Y,{value:o,onChange:s=>{let I=Number(s.target.value);i(I)}}),l(z,{variant:"outline",onClick:()=>{t?o<t&&i(s=>o+1):i(s=>o+1)},disabled:t===o||!t,children:l(A,{})})]}),(t>0&&o>t||r<1)&&m(N,{fontSize:12,mt:10,color:"#E11900",children:["Enter quantity between 1 to ",t]})]})},S=J;import{jsx as c,jsxs as x}from"react/jsx-runtime";var O=L(h)`
  position: relative;
`,Q=({duration:e,setDuration:t,loading:d,subTotalPrice:o,payUsing:n})=>x(O,{paddingY:4,flexDir:"column",alignItems:"center",children:[c(S,{initialState:1,maxState:1e4,onChange:t,onError:()=>{},value:e}),x(h,{w:"full",justifyContent:"space-between",alignItems:"center",children:[c(b,{fontSize:14,mt:4,fontWeight:"bold",children:`${e} year registration`}),x(h,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[d?c(K,{size:"xs",mb:"1.5"}):c(b,{fontSize:14,fontWeight:"bold",children:`${o?.toFixed(5)}`}),c(b,{ml:"1",fontSize:14,fontWeight:"bold",children:n?.ticker})]})]})]}),ge=Q;export{ge as default};
