import{Flex as m,Modal as R,ModalBody as W,ModalCloseButton as v,ModalContent as B,ModalHeader as k,ModalOverlay as L,Spinner as D,Text as r,useToast as I}from"@chakra-ui/react";import{LAMPORTS_PER_SOL as j}from"@solana/web3.js";import{Box as b,Flex as l,Slider as z,SliderFilledTrack as T,SliderThumb as y,SliderTrack as C,Spinner as h,Text as n}from"@chakra-ui/react";import F from"@emotion/styled";import{LAMPORTS_PER_SOL as w}from"@solana/web3.js";import{jsx as t,jsxs as o}from"react/jsx-runtime";var M="https://docs.bonfida.org/collection/naming-service/how-to-create-a-solana-domain-name/purchasing-a-domain-name/direct-registration",O=F(l)`
  position: relative;
`,P=({size:a,setSize:d,loading:s,subTotalPrice:c})=>o(O,{paddingY:4,flexDir:"column",alignItems:"center",children:[o(z,{defaultValue:0,min:1,max:10,step:1,w:"94%",onChange:d,value:a,children:[o(C,{bg:"muted",children:[t(b,{position:"relative",right:10}),t(T,{bg:"mutedForeground"})]}),t(y,{boxSize:4,borderColor:"mutedForeground",borderWidth:"1"})]}),o(l,{justifyContent:"space-between",w:"full",mt:"1",children:[t(n,{fontSize:"12",children:"1 Kb"}),t(n,{fontSize:"12",children:"10 Kb"})]}),o(l,{w:"full",justifyContent:"space-between",children:[o(n,{fontSize:14,mt:4,fontWeight:"semibold",children:["Selected Size: ",`${a} Kb`]}),t(n,{fontSize:14,mt:4,textDecoration:"underline",cursor:"pointer",onClick:()=>window.open(M),textAlign:"right",children:"How much storage is right for you?"})]}),o(l,{w:"full",justifyContent:"space-between",alignItems:"center",children:[t(n,{fontSize:14,mt:4,fontWeight:"bold",children:"Storage cost"}),o(l,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[s?t(h,{size:"xs",mb:"1"}):o(n,{fontSize:14,fontWeight:"bold",children:["+",`${(c/w).toFixed(5)}`]}),t(n,{ml:"1",fontSize:14,fontWeight:"bold",children:"SOL"})]})]})]}),u=P;import{jsx as e,jsxs as i}from"react/jsx-runtime";var E=({selectedDomain:a,size:d,setSize:s,onOpen:c,onClose:x,isOpen:g,loading:f,subTotalPrice:S})=>{let p=I();return i(m,{mt:"2",justifyContent:"space-between",children:[i(m,{alignItems:"center",children:[e(r,{fontSize:"12",mr:"1",children:"Storage Cost:"}),e(r,{textDecoration:"underline",fontSize:"12",cursor:"pointer",onClick:()=>{if(!a)return p({title:"Select Domain",status:"warning"});c()},children:"Edit"})]}),i(m,{alignItems:"center",justifyContent:"center",children:[f?e(D,{size:"xs"}):i(r,{fontSize:"12",fontWeight:"bold",children:["+",`${(S/j).toFixed(5)}`]}),e(r,{ml:"1",fontSize:"12",fontWeight:"bold",children:"SOL"}),e(r,{fontSize:"12",mx:"1",children:`(${d} KB)`})]}),i(R,{blockScrollOnMount:!1,isOpen:g,onClose:x,isCentered:!0,children:[e(L,{}),i(B,{children:[e(k,{children:"Edit storage size"}),e(v,{}),i(W,{children:[e(r,{fontSize:"12",py:"2",px:"4",borderColor:"mutedForeground",borderWidth:"1px",borderStyle:"solid",borderRadius:"8",children:"Storage size cannot be changed after initial registration."}),e(u,{size:d,setSize:s,loading:f,subTotalPrice:S})]})]})]})]})},q=E;export{q as default};
