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