var z=Object.defineProperty;var c=(o,n)=>()=>(o&&(n=o(o=0)),n);var $=(o,n)=>{for(var t in n)z(o,t,{get:n[t],enumerable:!0})};var O=(o,n,t)=>new Promise((l,i)=>{var f=e=>{try{a(t.next(e))}catch(s){i(s)}},r=e=>{try{a(t.throw(e))}catch(s){i(s)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(f,r);a((t=t.apply(o,n)).next())});import{createContext as P,useContext as G,useRef as mt}from"react";import{jsx as xt}from"react/jsx-runtime";var K,h,L=c(()=>{K=P(void 0),h=()=>G(K)});import H from"posthog-js";function g(o,n){try{H.capture(o,n)}catch(t){}}var M=c(()=>{});var A=c(()=>{});var T=c(()=>{A()});var _=c(()=>{});var E=c(()=>{_()});var w=c(()=>{T();E()});var b=c(()=>{M();w()});var k={};$(k,{default:()=>et});import"react";import{Button as B,Flex as x,Icon as S,Modal as j,ModalBody as V,ModalCloseButton as W,ModalContent as Y,ModalHeader as q,ModalOverlay as J,Text as v}from"@chakra-ui/react";import{BsApple as Q,BsGoogle as X}from"react-icons/bs";import{createEvent as Z}from"ics";import{jsx as p,jsxs as u}from"react/jsx-runtime";var tt,ot,et,F=c(()=>{L();b();tt=o=>{let n=o.getFullYear(),t=o.getMonth()+1,l=o.getDate(),i=o.getHours(),f=o.getMinutes();return[n,t,l,i,f]},ot=({isOpen:o,onClose:n,reminderCollection:t})=>{let{rootRef:l}=h(),i=(r,a,e)=>O(void 0,null,function*(){let s={start:tt(new Date(r*1e3)),duration:{hours:24},title:a,description:e},m=`${a}.ics`,D=yield new Promise((R,N)=>{Z(s,(I,U)=>{I&&N(I),R(new File([U],m,{type:"plain/text"}))})}),C=URL.createObjectURL(D),d=document.createElement("a");d.href=C,d.download=m,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(C)}),f=(r,a,e)=>{let s=new Date(r*1e3).toISOString().replace(/-|:|\.\d+/g,""),m=new Date(r*1e3+1*24*60*60*1e3).toISOString().replace(/-|:|\.\d+/g,""),D=encodeURIComponent(a),C=encodeURIComponent(e),d="https://calendar.google.com/calendar/u/0/r/eventedit",R=`dates=${s}/${m}&text=${D}&details=${C}&location=&allday=false`;return`${d}?${R}`};return u(j,{blockScrollOnMount:!1,isOpen:o,onClose:n,portalProps:{containerRef:l},children:[p(J,{}),u(Y,{children:[p(q,{color:"foreground",fontSize:"md",children:"Add reminder to your calender"}),p(W,{}),u(V,{pb:4,children:[u(x,{justifyContent:"space-between",alignItems:"center",mb:1,children:[u(x,{alignItems:"center",children:[p(S,{as:X,h:"4",w:"4",color:"mutedForeground"}),p(v,{ml:"2",fontSize:"sm",children:"Google Calender"})]}),p(B,{variant:"outline",size:"sm",onClick:()=>{var a,e,s;g("Add To Calendar Clicked",{type:"google"});let r=f((a=t==null?void 0:t.stats)==null?void 0:a.startDate,(e=t==null?void 0:t.profile)==null?void 0:e.name,`Get your hands on ${(s=t==null?void 0:t.profile)==null?void 0:s.name} NFT Collection. Mint powered by Bandit.`);window.open(r)},children:"Add"})]}),u(x,{justifyContent:"space-between",alignItems:"center",mv:"6",children:[u(x,{alignItems:"center",children:[p(S,{as:Q,h:"4",w:"4",color:"mutedForeground"}),p(v,{ml:"2",fontSize:"sm",children:"iCalender"})]}),p(B,{variant:"outline",size:"sm",onClick:()=>{var r,a,e;g("Add To Calendar Clicked",{type:"apple"}),i((r=t==null?void 0:t.stats)==null?void 0:r.startDate,(a=t==null?void 0:t.profile)==null?void 0:a.name,`Get your hands on ${(e=t==null?void 0:t.profile)==null?void 0:e.name} NFT Collection. Mint powered by Bandit.`).catch(s=>console.log(s))},children:"Add"})]})]})]})]})},et=ot});import{lazy as nt,Suspense as at}from"react";import{Button as st,useDisclosure as rt}from"@chakra-ui/react";import{Fragment as lt,jsx as y,jsxs as dt}from"react/jsx-runtime";var ct=nt(()=>Promise.resolve().then(()=>(F(),k))),pt=({collection:o})=>{let{isOpen:n,onOpen:t,onClose:l}=rt();return dt(lt,{children:[y(st,{fontSize:"sm",fontWeight:500,variant:"outline",size:"sm",onClick:t,children:"Add"}),y(at,{fallback:null,children:y(ct,{isOpen:n,onClose:l,reminderCollection:o})})]})},Vt=pt;export{Vt as default};
