1import{cp as u,j as s,F as k,M as m,a as o,Z as f,N as x,cJ as g,s as j,a4 as b,ct as P,a6 as v}from"./index-Chd_Wa1n.js";import{P as y}from"./PoolItemPosition-9ykCbsaB.js";import{T as N}from"./TokenAmountSlider-JMRZdQXt.js";function S({amountPct:e,setAmountPct:i,lpAmount:l,unstaking:t,setUnstaking:r,success:n}){const{position:a,isBasicPool:c}=u(),d=!a.unlocks_at&&c&&a.staked!==0n;return t?s.jsxs(k,{title:"Unstaking amount",onEdit:n?void 0:()=>r(!1),children:[e,"%"]}):s.jsxs("div",{className:"space-y-5 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:space-y-8 sm:p-8",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Unstaking amount"}),!d&&s.jsx("div",{className:"text-sm text-accent-50",children:"Partial unstaking is not available for this pool."})]}),s.jsx(N,{enabled:d,amountPct:e,setAmountPct:i,tokenAmounts:[{amount:a.staked0,token:a.token0},{amount:a.staked1,token:a.token1}]}),s.jsx("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:s.jsx(m,{size:"lg",onClick:()=>r(!0),disabled:l===0n,children:"Unstake"})})]})}function U({lpAmount:e,setSuccess:i,setUnstaking:l}){const{position:t,refetch:r}=u(),[n,a]=o.useState(),[c,d]=o.useState(!1),[p,h]=o.useState(void 0);return o.useEffect(()=>{i(!!n)},[n]),s.jsx("div",{className:"-m-px rounded-[17px] bg-gradient-to-b from-primary/50 to-background p-px",children:s.jsxs("div",{className:"space-y-4 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:p-8",children:[s.jsx(f,{title:n?"You have unstaked your deposit":"Confirm unstake",success:!!n,loading:c,error:p,txId:n,chainId:t.chainId}),s.jsx("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:n?s.jsxs(s.Fragment,{children:[s.jsx(x,{href:"/dash",color:"secondary",size:"lg",useButton:!0,children:"Go to dashboard"}),s.jsx(x,{className:"flex w-full",href:`/withdraw?pool=${t.pool.address}&chain=${t.pool.chainId}&position=${t.id}`,useButton:!0,color:"secondary",size:"lg",children:"Withdraw"})]}):s.jsxs(s.Fragment,{children:[s.jsx(m,{size:"lg",color:"secondary",disabled:c,onClick:()=>l(!1),children:"Edit amount"}),s.jsx(g,{position:t,lpAmount:e,setTx:a,refetch:r,onPendingStateChange:d,onError:h})]})})]})})}function w(){const{position:e}=u(),[i,l]=o.useState("100"),[t,r]=o.useState(!1),[n,a]=o.useState(!1),c=o.useMemo(()=>e?.staked>0n?j(e.staked,e.pool.decimals,0,i):0n,[e,i]);return s.jsxs(s.Fragment,{children:[s.jsx(b,{pool:e.pool,title:"Unstake"}),s.jsx(y,{position:e,showActions:!1}),s.jsx(S,{amountPct:i,setAmountPct:l,lpAmount:c,unstaking:t,setUnstaking:r,success:n}),t&&s.jsx(U,{lpAmount:c,setSuccess:a,setUnstaking:r})]})}function F(){return s.jsx("div",{className:"mx-auto max-w-screen-sm space-y-2",children:s.jsx(P,{placeholder:s.jsx(v,{message:"Loading onchain data..."}),children:s.jsx(w,{})})})}export{F as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.