var K=Object.create;var g=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var _=(t,r)=>{for(var n in r)g(t,n,{get:r[n],enumerable:!0})},A=(t,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of D(r))!X.call(t,a)&&a!==n&&g(t,a,{get:()=>r[a],enumerable:!(l=Y(r,a))||l.enumerable});return t};var v=(t,r,n)=>(n=t!=null?K(L(t)):{},A(r||!t||!t.__esModule?g(n,"default",{value:t,enumerable:!0}):n,t)),q=t=>A(g({},"__esModule",{value:!0}),t);var h=(t,r,n)=>new Promise((l,a)=>{var w=s=>{try{f(n.next(s))}catch(d){a(d)}},p=s=>{try{f(n.throw(s))}catch(d){a(d)}},f=s=>s.done?l(s.value):Promise.resolve(s.value).then(w,p);f((n=n.apply(t,r)).next())});var V={};_(V,{default:()=>H});module.exports=q(V);var x=require("@chakra-ui/icons"),e=require("@chakra-ui/react"),c=require("react");var y=v(require("react-jazzicon"),1),I=v(require("react-shadow/emotion"),1),k=require("react/jsx-runtime"),J=({address:t})=>{let r=Object.keys(I.default).length?y.default.default:y.default;return(0,k.jsx)(r,{diameter:"24",seed:(0,y.jsNumberForAddress)(t),svgStyles:{display:"block",verticalAlign:"middle"},paperStyles:{border:"1px solid #ffffff"}})},C=J;var z=v(require("axios"),1);var P=require("react"),U=require("react/jsx-runtime"),ot=(0,P.createContext)(void 0),M="production";var E=M==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var T=(t,r,n,l)=>h(void 0,null,function*(){try{return(yield z.default.get(`${E}/collection/contest/${t}/participants?offset=${r}&limit=${n}`,{headers:{"X-API-KEY":l}})).data}catch(a){throw a}});var B=(t,r)=>t?t.length>r?t.substr(0,r-1)+"..."+t.substr(t.length-(r-1),t.length-1):t:"";var o=require("react/jsx-runtime"),j=({collectionId:t,accessKey:r})=>{let[n,l]=(0,c.useState)(0),[a,w]=(0,c.useState)(1),[p,f]=(0,c.useState)(0),[s,d]=(0,c.useState)([]),[R,N]=(0,c.useState)(!0),[W,b]=(0,c.useState)(!0),{isOpen:O,onOpen:F,onClose:G}=(0,e.useDisclosure)(),m=12,S=(0,c.useCallback)(()=>h(void 0,null,function*(){try{if(!t||!r)return;b(!0);let{data:i,totalResult:u}=yield T(t,n,m,r);d(i),f(u)}catch(i){console.log(i)}finally{b(!1),N(!1)}}),[t,r,n,a]);(0,c.useEffect)(()=>{S()},[S]);let $=i=>{w(i),l((i-1)*m)};return R?(0,o.jsx)(e.Skeleton,{mt:2,ml:"2",isLoaded:!1,fadeDuration:.1,minW:"40",minH:8,startColor:"muted",endColor:"input",borderRadius:"8"}):s.length?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.Flex,{onClick:F,alignItems:"flex-end",cursor:"pointer",children:[s.slice(0,11).map((i,u)=>(0,o.jsx)(e.Box,{h:"24px",ml:u>0?"-15px":"0",children:(0,o.jsx)(C,{address:i},i)},i)),(0,o.jsxs)(e.Text,{fontWeight:"medium",fontSize:14,ml:2,children:[p," Participants"]})]}),(0,o.jsxs)(e.Modal,{isOpen:O,onClose:G,size:"2xl",isCentered:!0,blockScrollOnMount:!1,children:[(0,o.jsx)(e.ModalOverlay,{}),(0,o.jsxs)(e.ModalContent,{children:[(0,o.jsx)(e.ModalHeader,{pb:"0",children:`Participants (${p})`}),(0,o.jsx)(e.ModalCloseButton,{}),(0,o.jsx)(e.ModalBody,{children:(0,o.jsxs)(e.Box,{mr:3,mt:2,children:[(0,o.jsx)(e.Grid,{templateColumns:["repeat(2, 1fr)","repeat(2, 1fr)","repeat(3, 1fr)"],gap:4,mt:4,children:s.map((i,u)=>(0,o.jsx)(e.GridItem,{children:(0,o.jsxs)(e.Flex,{align:"center",children:[(0,o.jsx)(C,{address:i}),(0,o.jsx)(e.Text,{ml:2,fontSize:14,children:B(i,6)})]})},u))}),(0,o.jsx)(e.Flex,{alignItems:"center",mt:"2",justifyContent:"center",children:(0,o.jsxs)(e.Flex,{children:[(0,o.jsx)(x.ChevronLeftIcon,{w:"7",h:"7",color:a===1?"brand.400":"mutedForeground",cursor:a===1?"not-allowed":"pointer",mx:"1",onClick:a===1?()=>{}:()=>$(a-1)}),(0,o.jsx)(x.ChevronRightIcon,{w:"7",h:"7",color:n+m>=p?"brand.400":"mutedForeground",cursor:n+m>=p?"not-allowed":"pointer",mx:"1",onClick:n+m>=p?()=>{}:()=>$(a+1)})]})})]})})]})]})]}):null},H=j;
