1import{b as _,j as e}from"./index-CiCw9Duq.js";import{r as u}from"./vendor-i18n-BBu7i065.js";import{L as S}from"./vendor-react-BL5zx_iT.js";import{c as D}from"./clipboard-CRurzJ4W.js";import{s as b}from"./supabase-services-BirnvxuU.js";import{U as T,L as P,aJ as C,aS as U,A,_ as h,$ as F,g as E,a9 as R,z as y,aF as v,aj as I}from"./vendor-ui-Ct1FBp4w.js";import"./vendor-solana-BIelvPCZ.js";import"./vendor-supabase-DbyvBBOg.js";function Z({pool:t,isLight:a,onBack:g,onUpdate:p,onDelete:w}){const{toast:n}=_(),[l,d]=u.useState(!1),[c,i]=u.useState(!1),j=t.unlock_at?Date.now()/1e3>=t.unlock_at:!1,o=`${window.location.origin}/stake/${t.id}`,x=async(s,r="Copied")=>{await D(s),n({title:r})},f=async()=>{i(!0);const s=t.status==="active"?"paused":"active";await b.update(t.id,{status:s})?(p({...t,status:s}),n({title:`Pool ${s==="active"?"activated":"paused"}`})):n({title:"Failed to update",variant:"destructive"}),i(!1)},k=async()=>{if(!confirm("Delete this pool? This cannot be undone."))return;d(!0),await b.delete(t.id)?(w(t.id),n({title:"Pool deleted"})):(n({title:"Failed to delete",variant:"destructive"}),d(!1))},N=s=>new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),m=t.unlock_at?new Date(t.unlock_at*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,$=[{label:"Total Stakers",value:(t.staker_count||0).toLocaleString(),icon:T},{label:"Total Value Locked",value:`${(t.total_staked||0).toLocaleString()} ${t.token_symbol}`,icon:P},{label:"APY Rate",value:`${t.apy_rate||0}%`,icon:C},{label:"Lock Period",value:t.lock_period_days?`${t.lock_period_days} days`:"Flexible",icon:U}];return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:g,className:`w-8 h-8 rounded-full flex items-center justify-center transition-all ${a?"text-gray-500 hover:bg-gray-100":"text-white/50 hover:bg-white/[0.06]"}`,children:e.jsx(A,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:`text-[18px] font-bold ${a?"text-gray-900":"text-white"}`,children:t.name}),e.jsxs("p",{className:`text-[12px] mt-0.5 ${a?"text-gray-400":"text-white/40"}`,children:[t.token_symbol," · ",t.token_standard==="token-2022"?"Token-2022":"SPL"," · Created ",N(t.created_at)]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:f,disabled:c,className:`px-3.5 py-1.5 text-[12px] font-semibold rounded-lg border transition-colors flex items-center gap-1.5 ${t.status==="active"?a?"border-gray-200 text-gray-600 hover:bg-gray-50":"border-white/[0.1] text-white/60 hover:bg-white/[0.04]":a?"bg-gray-900 text-white hover:bg-gray-800":"bg-white text-black hover:bg-white/90"}`,children:[c?e.jsx(h,{className:"w-3 h-3 animate-spin"}):t.status==="active"?e.jsx(F,{className:"w-3 h-3"}):e.jsx(E,{className:"w-3 h-3"}),t.status==="active"?"Pause":"Activate"]})})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:$.map(s=>{const r=s.icon;return e.jsxs("div",{className:`rounded-xl border p-4 ${a?"border-gray-200":"border-white/[0.06]"}`,children:[e.jsx(r,{className:`w-4 h-4 mb-2 ${a?"text-gray-400":"text-white/40"}`}),e.jsx("p",{className:`text-[18px] font-bold tabular-nums ${a?"text-gray-900":"text-white"}`,children:s.value}),e.jsx("p",{className:`text-[10px] font-medium mt-0.5 ${a?"text-gray-400":"text-white/40"}`,children:s.label})]},s.label)})}),e.jsxs("div",{className:`rounded-xl border p-5 ${a?"border-gray-200":"border-white/[0.06]"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(R,{className:`w-4 h-4 ${a?"text-gray-500":"text-white/50"}`}),e.jsx("span",{className:`text-[13px] font-semibold ${a?"text-gray-900":"text-white"}`,children:"Public Staking Page"}),e.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider rounded ${t.status==="active"?a?"bg-gray-900 text-white":"bg-white text-black":a?"bg-gray-200 text-gray-400":"bg-white/[0.06] text-white/30"}`,children:t.status==="active"?"Live":t.status})]}),e.jsx("p",{className:`text-[12px] mb-3 ${a?"text-gray-400":"text-white/40"}`,children:"Share this link to let anyone stake into your pool."}),e.jsxs("div",{className:`flex items-center gap-2 p-3 rounded-lg ${a?"bg-gray-50":"bg-white/[0.02]"}`,children:[e.jsx("code",{className:`flex-1 text-[11px] font-mono truncate ${a?"text-gray-600":"text-white/60"}`,children:o}),e.jsx("button",{onClick:()=>x(o,"Link copied"),className:`p-1.5 rounded-md transition-colors ${a?"hover:bg-gray-200 text-gray-400":"hover:bg-white/[0.06] text-white/40"}`,children:e.jsx(y,{className:"w-3.5 h-3.5"})}),e.jsx(S,{to:`/stake/${t.id}`,className:`p-1.5 rounded-md transition-colors ${a?"hover:bg-gray-200 text-gray-400":"hover:bg-white/[0.06] text-white/40"}`,children:e.jsx(v,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:`rounded-xl border overflow-hidden ${a?"border-gray-200":"border-white/[0.06]"}`,children:[e.jsx("div",{className:`px-5 py-3.5 border-b ${a?"border-gray-100":"border-white/[0.04]"}`,children:e.jsx("span",{className:`text-[13px] font-semibold ${a?"text-gray-900":"text-white"}`,children:"Pool Details"})}),e.jsx("div",{className:"divide-y divide-transparent",children:[{label:"Status",value:t.status==="active"?j?"Claimable":"Locked":t.status},{label:"Token Standard",value:t.token_standard==="token-2022"?"Token-2022":"SPL Token"},...t.token_mint?[{label:"Token Mint",value:t.token_mint,mono:!0,copyable:!0}]:[],...t.vault_address?[{label:"Vault Address",value:t.vault_address,mono:!0,copyable:!0}]:[],...t.program_id?[{label:"Program ID",value:t.program_id,mono:!0,copyable:!0}]:[],...t.tx_signature?[{label:"Deploy TX",value:t.tx_signature,mono:!0,copyable:!0,solscan:!0}]:[],...m?[{label:"Unlock Date",value:m}]:[]].map((s,r)=>e.jsxs("div",{className:`flex items-center justify-between px-5 py-3 ${r>0?`border-t ${a?"border-gray-100":"border-white/[0.04]"}`:""}`,children:[e.jsx("span",{className:`text-[12px] font-medium ${a?"text-gray-500":"text-white/50"}`,children:s.label}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[12px] font-semibold ${"mono"in s?"font-mono text-[11px]":""} ${a?"text-gray-900":"text-white"}`,children:"mono"in s?`${s.value.slice(0,6)}...${s.value.slice(-4)}`:s.value}),"copyable"in s&&e.jsx("button",{onClick:()=>
1x(s.value),className:`p-0.5 ${a?"text-gray-300 hover:text-gray-500":"text-white/20 hover:text-white/50"}`,children:e.jsx(y,{className:"w-3 h-3"})}),"solscan"in s&&e.jsx("a",{href:`https://solscan.io/tx/${s.value}`,target:"_blank",rel:"noopener noreferrer",className:`p-0.5 ${a?"text-gray-300 hover:text-gray-500":"text-white/20 hover:text-white/50"}`,children:e.jsx(v,{className:"w-3 h-3"})})]})]},s.label))})]}),e.jsxs("div",{className:`rounded-xl border overflow-hidden ${a?"border-gray-200":"border-white/[0.06]"}`,children:[e.jsx("div",{className:`px-5 py-3.5 border-b ${a?"border-gray-100":"border-white/[0.04]"}`,children:e.jsx("span",{className:`text-[13px] font-semibold ${a?"text-red-600":"text-red-400"}`,children:"Danger Zone"})}),e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-xl ${a?"bg-red-50":"bg-red-500/[0.04]"}`,children:[e.jsxs("div",{children:[e.jsx("p",{className:`text-[13px] font-medium ${a?"text-gray-700":"text-white/75"}`,children:"Delete this pool"}),e.jsx("p",{className:`text-[11px] mt-0.5 ${a?"text-gray-400":"text-white/40"}`,children:"Remove from your dashboard. On-chain state is not affected."})]}),e.jsxs("button",{onClick:k,disabled:l,className:`px-3.5 py-1.5 text-[12px] font-semibold rounded-lg border transition-colors flex items-center gap-1.5 ${a?"border-red-300 text-red-600 hover:bg-red-50":"border-red-500/30 text-red-400 hover:bg-red-500/[0.06]"}`,children:[l?e.jsx(h,{className:"w-3 h-3 animate-spin"}):e.jsx(I,{className:"w-3 h-3"}),"Delete"]})]})})]})]})}export{Z 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.