(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6797],{33294:function(e,t,r){Promise.resolve().then(r.bind(r,79909)),Promise.resolve().then(r.bind(r,19322)),Promise.resolve().then(r.bind(r,82133)),Promise.resolve().then(r.bind(r,44347)),Promise.resolve().then(r.t.bind(r,50894,23)),Promise.resolve().then(r.t.bind(r,94236,23)),Promise.resolve().then(r.t.bind(r,38173,23)),Promise.resolve().then(r.t.bind(r,231,23)),Promise.resolve().then(r.bind(r,96e3)),Promise.resolve().then(r.bind(r,40408))},79909:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return j}});var a=r(57437),n=r(84008),s=r(30998),o=r(80473),l=r(66648),i=r(87138),d=r(2265),c=r(49591),u=r(8e3),m=r(34479),x=r(37134),h=r(80765),g=r(98591),b=()=>(0,a.jsxs)("div",{className:"flex w-full flex-row items-center justify-center gap-2 py-8",children:[(0,a.jsx)("div",{className:"h-4 w-4 animate-bounce rounded-full bg-blue-700 [animation-delay:.7s] dark:bg-blue-600"}),(0,a.jsx)("div",{className:"h-4 w-4 animate-bounce rounded-full bg-blue-700 [animation-delay:.3s] dark:bg-blue-600"}),(0,a.jsx)("div",{className:"h-4 w-4 animate-bounce rounded-full bg-blue-700 [animation-delay:.7s] dark:bg-blue-600"})]}),p=r(68082);let f=async e=>{let t=await fetch(e,{headers:{"x-api-key":"42Z1dFZZP0BsiRsLnab/Z1SXqW+tyetUPmOfzewgFxY="}});if(!t.ok)throw Error("Network response was not ok");return await t.json()};var v=e=>{let{postSlug:t}=e,{data:r,error:n}=(0,m.ZP)("/api/comments/count?postSlug=".concat(t),f);return n?(0,a.jsx)("div",{className:"text-xs md:text-sm",children:"Failed to load comments count"}):r?(0,a.jsxs)("div",{className:"flex w-fit cursor-default items-center justify-center gap-1 text-sm font-medium text-neutral-600 dark:text-neutral-200 sm:gap-2 xl:text-base",children:[(0,a.jsx)(p.iSW,{className:"text-2xl text-gray-400 dark:text-gray-500"}),(0,a.jsx)("span",{className:"text-lg font-normal text-yellow-600 dark:text-yellow-500",children:r.count})]}):(0,a.jsx)("div",{className:"text-sm font-medium text-green-500 dark:text-green-400 xl:text-base",children:"Comments Loading..."})};let w=async e=>{let t=await fetch(e,{headers:{"x-api-key":"42Z1dFZZP0BsiRsLnab/Z1SXqW+tyetUPmOfzewgFxY="}}),r=await t.json();if(!t.ok){let e=Error(r.message||"Failed to fetch data");throw e.info=r,e}return r};var j=e=>{let{slug:t}=e,[r,p]=(0,d.useState)(!1),{theme:f}=(0,o.F)(),[j,y]=(0,d.useState)(""),[k,N]=(0,d.useState)({}),{status:C,data:P}=(0,s.useSession)(),[S,A]=(0,d.useState)({}),{data:F,mutate:E,isLoading:z}=(0,m.ZP)("/api/comments?postSlug=".concat(t),w),{mutate:T}=(0,m.ZP)("/api/comments/count?postSlug=".concat(t),w),L=(0,d.useMemo)(()=>null==F?void 0:F.sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()),[F]),R=async()=>{if(!j){u.Am.error("Comment is required");return}if(j.length<10){u.Am.error("Comment must be at least 10 characters");return}if(j.length>1e3){u.Am.error("Comment cannot exceed 1000 characters");return}let e=await fetch("/api/comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({desc:j,slug:t})});if(e.ok)E(),T(),y(""),u.Am.success("Comment posted successfully");else{let t=await e.json();u.Am.error(t.message||"An error occurred while submitting your comment")}},M=e=>{A({...S,[e]:!S[e]})},Z=async e=>{if(!k[e]||k[e].length<=0){u.Am.error("Reply is required");return}if(k[e].length<10){u.Am.error("Reply must be at least 10 characters");return}if(k[e].length>1e3){u.Am.error("Reply cannot exceed 1000 characters");return}let r=await fetch("/api/comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({desc:k[e],slug:t,parentId:e})});if(r.ok)E(),T(),N({...k,[e]:""}),u.Am.success("Reply posted successfully");else{let e=await r.json();u.Am.error(e.message||"An error occurred while submitting your reply")}},H=async function(e){var t,r;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=a?L.find(t=>t.replies.some(t=>t.id===e)):L.find(t=>t.id===e);if(!n){u.Am.error(a?"Reply not found":"Comment not found");return}if((a?null===(t=n.replies.find(t=>t.id===e))||void 0===t?void 0:t.userEmail:n.userEmail)!==(null==P?void 0:null===(r=P.user)||void 0===r?void 0:r.email)){u.Am.warning("You can delete your own comments/replies only");return}if(!a&&n.replies.length>0){u.Am.warning("Your comment contains replies. Delete the replies first.");return}let s=await fetch("/api/comments/".concat(e),{method:"DELETE"});if(s.ok)E(),T(),u.Am.success(a?"Reply deleted successfully":"Comment deleted successfully");else{let e=await s.json();u.Am.error(e.message||"An error occurred while deleting your ".concat(a?"reply":"comment"))}};return((0,d.useEffect)(()=>{p(!0)},[]),r)?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,a.jsx)("h1",{className:"font-robotoMono text-xl font-medium tracking-wide text-neutral-700 dark:text-neutral-100 xl:text-2xl xl:font-semibold",children:"Comments"}),(0,a.jsx)(v,{postSlug:t})]}),"authenticated"===C?(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"sr-only",htmlFor:"comment",children:"Your comment"}),(0,a.jsx)(x.g,{as:d.Fragment,children:e=>{let{focus:t,hover:r}=e;return(0,a.jsx)("textarea",{className:(0,g.Z)("h-full w-full rounded-md border-2 border-gray-200 border-opacity-60 bg-white px-4 py-2 text-sm outline-none ring-0 transition-all duration-300 ease-in dark:border-gray-700 dark:bg-transparent md:text-base",t&&"focus:border-blue-500 focus:bg-white focus:ring-0 dark:focus:border-greenHo dark:focus:bg-transparent",r&&"bg-gray-200 dark:bg-zinc-800"),placeholder:"Write a comment...",rows:6,value:j,onChange:e=>y(e.target.value)})}})]}),(0,a.jsx)(h.z,{as:d.Fragment,children:e=>{let{hover:t,active:r}=e;return(0,a.jsx)("button",{"aria-label":"Post comment",onClick:R,className:(0,g.Z)("rounded-md px-6 py-2.5 text-sm font-medium text-neutral-100 transition-all duration-300 ease-in-out dark:text-neutral-800",!t&&!r&&"bg-blue-600 dark:bg-greenHo",t&&!r&&"hover:bg-blue-500 dark:hover:bg-green-500",r&&"active:bg-blue-700 dark:active:bg-green-700"),children:"Post Comment"})}})]}):(0,a.jsx)(i.default,{className:"mb-6 inline-block text-blue-600 transition-all duration-200 ease-in-out hover:text-blue-500 dark:text-blue-500 dark:hover:text-blue-400",href:"/login",children:"Login to write a comment"}),z?(0,a.jsx)(b,{}):L&&Array.isArray(L)&&L.map(e=>{var t;return(0,a.jsxs)("article",{className:"mb-3 rounded-md border border-gray-200 bg-white p-6 text-base dark:border-gray-400/20 dark:bg-zinc-900",children:[(0,a.jsx)("footer",{className:"mb-4",children:(0,a.jsxs)("div",{className:"flex flex-col items-start justify-start gap-2 sm:flex-row sm:items-center sm:gap-3",children:[(0,a.jsxs)("p",{className:"inline-flex items-center text-sm font-semibold text-neutral-900 dark:text-white",children:[e.user.image&&(0,a.jsx)(l.default,{alt:e.user.name,className:"mr-2 h-6 w-6 rounded-full",height:60,src:e.user.image,width:60}),e.user.name]}),(0,a.jsx)("p",{className:"text-sm text-neutral-600 dark:text-gray-400",children:(0,n.WU)(new Date(e.createdAt),"d MMMM, yyyy 'at' HH:mm:ss")})]})}),(0,a.jsx)("p",{className:"text-sm text-neutral-500 dark:text-neutral-300 slg:text-base",children:e.desc}),(0,a.jsx)("div",{className:"mt-4 flex items-center gap-4",children:"authenticated"===C?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.z,{as:d.Fragment,children:(0,a.jsx)("button",{className:"rounded-md border-none bg-purple-600 px-2 py-1.5 text-white outline-none ring-0 transition-all duration-300 ease-in hover:bg-purple-500 focus:outline-none focus:ring-0",onClick:()=>M(e.id),"aria-label":"Reply",children:(0,a.jsx)(c.cql,{className:"text-base"})})}),e.userEmail===(null==P?void 0:null===(t=P.user)||void 0===t?void 0:t.email)&&(0,a.jsx)(h.z,{as:d.Fragment,children:(0,a.jsx)("button",{className:"rounded-md border-none bg-red-600 px-2 py-1.5 text-white outline-none ring-0 transition-all duration-300 ease-in hover:bg-red-500 focus:outline-none focus:ring-0",onClick:()=>H(e.id),"aria-label":"Delete",children:(0,a.jsx)(c.z2n,{className:"text-base"})})})]}):(0,a.jsx)(i.default,{className:"text-blue-600 transition-all duration-200 ease-in-out hover:text-blue-500 dark:text-blue-500 dark:hover:text-blue-400",href:"/login",children:"Login to reply"})}),S[e.id]&&(0,a.jsxs)("div",{className:"mb-4 mt-5",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"sr-only",htmlFor:"comment",children:"Your reply"}),(0,a.jsx)(x.g,{as:d.Fragment,children:t=>{let{focus:r,hover:n}=t;return(0,a.jsx)("textarea",{className:(0,g.Z)("h-full w-full rounded-md border-2 border-gray-200 border-opacity-60 bg-white px-4 py-2 text-sm outline-none ring-0 transition-all duration-300 ease-in dark:border-gray-700 dark:bg-transparent md:text-base",r&&"focus:border-blue-500 focus:bg-white focus:ring-0 dark:focus:border-greenHo dark:focus:bg-transparent",n&&"bg-gray-200 dark:bg-zinc-800"),placeholder:"Write a reply...",rows:3,value:k[e.id]||"",onChange:t=>N({...k,[e.id]:t.target.value})})}})]}),(0,a.jsx)(h.z,{as:d.Fragment,children:t=>{let{hover:r,active:n}=t;return(0,a.jsx)("button",{onClick:()=>Z(e.id),"aria-label":"Post reply",className:(0,g.Z)("rounded-md border-2 border-gray-200 px-6 py-2 text-sm font-medium text-neutral-700 transition-all duration-300 ease-in-out dark:border-gray-700 dark:text-neutral-100",!r&&!n&&"bg-transparent dark:bg-transparent",r&&!n&&"hover:border-blue-500 hover:text-blue-500 dark:hover:border-green-500 dark:hover:text-green-500",n&&"active:border-blue-700 active:text-blue-700 dark:active:border-green-700 dark:active:text-green-700"),children:"Post Reply"})}})]}),(0,a.jsx)("div",{className:"mt-5",children:e.replies.map(e=>{var t;return(0,a.jsxs)("article",{className:"mb-3 rounded-md border border-gray-200 bg-gray-50 p-4 text-base dark:border-gray-400/20 dark:bg-zinc-800",children:[(0,a.jsx)("footer",{className:"mb-2 sm:mb-3",children:(0,a.jsxs)("div",{className:"flex flex-col items-start justify-start gap-2 sm:flex-row sm:items-center sm:gap-3",children:[(0,a.jsxs)("p",{className:"inline-flex items-center text-sm font-semibold text-neutral-900 dark:text-white",children:[e.user.image&&(0,a.jsx)(l.default,{alt:e.user.name,className:"mr-2 h-6 w-6 rounded-full",height:60,src:e.user.image,width:60}),e.user.name]}),(0,a.jsx)("p",{className:"text-sm text-neutral-600 dark:text-gray-400",children:(0,n.WU)(new Date(e.createdAt),"d MMMM, yyyy 'at' HH:mm:ss")})]})}),(0,a.jsx)("p",{className:"text-sm text-neutral-500 dark:text-neutral-300 slg:text-base",children:e.desc}),"authenticated"===C&&e.userEmail===(null==P?void 0:null===(t=P.user)||void 0===t?void 0:t.email)&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(h.z,{as:d.Fragment,children:(0,a.jsx)("button",{"aria-label":"Delete",onClick:()=>H(e.id,!0),className:"rounded-md border-none bg-red-600 px-2 py-1.5 text-white outline-none ring-0 transition-all duration-300 ease-in hover:bg-red-500 focus:outline-none focus:ring-0",children:(0,a.jsx)(c.z2n,{})})})})]},e.id)})})]},e.id)})]}):null}},19322:function(e,t,r){"use strict";r.r(t);var a=r(57437);r(2265);var n=r(54187),s=r(36801),o=r(8e3);t.default=e=>{let{postUrl:t}=e;return(0,a.jsxs)("div",{className:"order-2 flex flex-col justify-start",children:[(0,a.jsx)("h4",{className:"font-robotoMono text-start text-lg font-semibold text-neutral-700 dark:text-neutral-100 xl:text-xl 2xl:text-2xl",children:"Share this post"}),(0,a.jsxs)("div",{className:"mt-4 flex items-center justify-start gap-4 text-neutral-500 transition-all duration-200 ease-in dark:text-neutral-400 md:gap-6",children:[(0,a.jsx)("button",{className:"duration-200 ease-in hover:scale-105 hover:text-blue-600 dark:hover:text-blue-500",onClick:()=>{let e="https://www.facebook.com/sharer/sharer.php?u=".concat(encodeURIComponent(t));window.open(e,"_blank")},children:(0,a.jsx)(n.Am9,{className:"text-3xl"})}),(0,a.jsx)("button",{className:"duration-200 ease-in hover:scale-105 hover:text-orange-500 dark:hover:text-orange-400",onClick:()=>{let e="https://www.instagram.com/?text=".concat(encodeURIComponent("Check out this post: ".concat(t)));window.open(e,"_blank")},children:(0,a.jsx)(n.Zf_,{className:"text-3xl"})}),(0,a.jsx)("button",{className:"duration-200 ease-in hover:scale-105 hover:text-green-600 dark:hover:text-green-500",onClick:()=>{let e;let r=navigator.userAgent.toLowerCase(),a=/android/.test(r),n=/windows/.test(r);e=a||n?"whatsapp://send?text=".concat(encodeURIComponent(t)):"https://web.whatsapp.com/send?text=".concat(encodeURIComponent(t)),window.open(e,"_blank")},children:(0,a.jsx)(n.xpo,{className:"text-3xl"})}),(0,a.jsx)("button",{className:"duration-200 ease-in hover:scale-105 hover:text-blue-600 dark:hover:text-blue-500",onClick:()=>{navigator.clipboard.writeText(t).then(()=>{o.Am.success("Link copied to clipboard!")}).catch(e=>{o.Am.error("Failed to copy the link.")})},children:(0,a.jsx)(s.gjK,{className:"text-3xl"})})]})]})}},82133:function(e,t,r){"use strict";r.r(t);var a=r(57437),n=r(80765),s=r(30998),o=r(2265),l=r(74800),i=r(6782),d=r(51100),c=r(8e3),u=r(34479);let m=async e=>{let t=await fetch(e,{headers:{"x-api-key":"42Z1dFZZP0BsiRsLnab/Z1SXqW+tyetUPmOfzewgFxY="}}),r=await t.json();if(!t.ok){let e=Error(r.message||"Failed to fetch data");throw e.info=r,e}return r};t.default=e=>{let{postSlug:t}=e,[r,x]=(0,o.useState)(""),{data:h}=(0,s.useSession)(),{data:g,error:b,isLoading:p,mutate:f}=(0,u.ZP)(()=>t?"/api/reactions?postSlug=".concat(t):null,m),{likeCount:v=0,heartCount:w=0,fireCount:j=0}=g||{},y=async e=>{if(!h){c.Am.error("Please login to react to the post!");return}try{let a=await fetch("/api/reactions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({postSlug:t,reactionType:e})});(await a.json()).reaction?("LIKE"===e?f({likeCount:"like"===r?v-1:v+1,heartCount:"heart"===r?w-1:w,fireCount:"fire"===r?j-1:j},!1):"HEART"===e?f({likeCount:"like"===r?v-1:v,heartCount:"heart"===r?w-1:w+1,fireCount:"fire"===r?j-1:j},!1):"FIRE"===e&&f({likeCount:"like"===r?v-1:v,heartCount:"heart"===r?w-1:w,fireCount:"fire"===r?j-1:j+1},!1),x(e.toLowerCase())):x(""),await f()}catch(e){c.Am.error("Something went wrong while reacting to the post.")}};return b?(0,a.jsx)("div",{children:"Failed to load reactions"}):p?(0,a.jsx)("div",{children:"Loading reactions..."}):(0,a.jsxs)("div",{className:"order-1 flex flex-col justify-start",children:[(0,a.jsx)("h4",{className:"font-robotoMono text-start text-lg font-semibold text-neutral-700 dark:text-neutral-100 xl:text-xl 2xl:text-2xl",children:"React on this post"}),(0,a.jsxs)("div",{className:"reaction-buttons mt-4 flex gap-4 transition-all duration-200 ease-in md:gap-6",children:[(0,a.jsx)(n.z,{as:o.Fragment,children:(0,a.jsxs)("button",{"aria-label":"Like",onClick:()=>y("LIKE"),children:["like"===r?(0,a.jsx)(l.UZT,{className:"text-3xl text-green-500"}):(0,a.jsx)(l.UZT,{className:"text-3xl text-neutral-400"})," ",(0,a.jsx)("span",{className:"text-xl",children:v})]})}),(0,a.jsx)(n.z,{as:o.Fragment,children:(0,a.jsxs)("button",{"aria-label":"Heart",onClick:()=>y("HEART"),children:["heart"===r?(0,a.jsx)(i.OBE,{className:"text-3xl text-rose-500"}):(0,a.jsx)(i.OBE,{className:"text-3xl text-neutral-400"})," ",(0,a.jsx)("span",{className:"text-xl",children:w})]})}),(0,a.jsxs)(n.z,{"aria-label":"Fire",onClick:()=>y("FIRE"),children:["fire"===r?(0,a.jsx)(d.dWH,{className:"text-3xl text-orange-500"}):(0,a.jsx)(d.dWH,{className:"text-3xl text-neutral-400"})," ",(0,a.jsx)("span",{className:"text-xl",children:j})]})]})]})}},44347:function(e,t,r){"use strict";r.r(t);var a=r(57437),n=r(44450),s=r.n(n),o=r(2265);t.default=()=>{var e;let[t,r]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let e=()=>{window.scrollY>50?r(!0):r(!1)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,a.jsxs)("div",{className:"fixed bottom-14 right-4 z-30 hidden flex-col gap-3 xl:right-6 2xl:right-8 ".concat(t?"md:flex":"md:hidden"),children:[(null===(e=s().comments)||void 0===e?void 0:e.provider)&&(0,a.jsx)("button",{"aria-label":"Scroll To Comment",onClick:()=>{var e;null===(e=document.getElementById("comment"))||void 0===e||e.scrollIntoView()},className:"rounded-full bg-zinc-200 p-2 text-neutral-700 outline-none ring-0 transition-all duration-300 ease-in hover:bg-indigo-200 focus:outline-none focus:ring-0 dark:bg-zinc-800 dark:text-neutral-100 dark:hover:bg-zinc-700",children:(0,a.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),(0,a.jsx)("button",{"aria-label":"Scroll To Top",onClick:()=>{window.scrollTo({top:0})},className:"rounded-full bg-zinc-200 p-2 text-neutral-700 outline-none ring-0 transition-all duration-300 ease-in hover:bg-indigo-200 focus:outline-none focus:ring-0 dark:bg-zinc-800 dark:text-neutral-100 dark:hover:bg-zinc-700",children:(0,a.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z",clipRule:"evenodd"})})})]})}},44450:function(e,t,r){"use strict";var a=r(20357);let n={title:"Kunwar Pratap",author:"Kunwar Pratap",headerTitle:"Kunwar Pratap",description:"Welcome to Kunwar Pratap's official website. Explore a portfolio of cutting-edge web development projects, innovative software solutions, and insightful blog posts. Discover Kunwar's expertise in various programming languages, frameworks, and technologies. Connect for collaboration opportunities, project inquiries, and professional networking. Stay updated with the latest in tech through tutorials, guides, and industry insights.",language:"en-us",theme:"system",siteUrl:"https://kunwarpratap.dev",siteLogo:"".concat(a.env.BASE_PATH||"","/assets/logo/Kunwar-Pratap-Trans.png"),socialBanner:"".concat(a.env.BASE_PATH||"","/static/images/banners/twitter-banner.png"),email:"kunwarkudos@gmail.com",github:"https://github.com/Kunwar-Pratap",x:"https://x.com/Kunwar_P_15",facebook:"https://www.facebook.com/kunwar.pratap.23",youtube:"https://youtube.com",linkedin:"https://www.linkedin.com/in/kunwar-pratap-0127a9225",instagram:"https://www.instagram.com/kunwar_pratap_23",locale:"en-US",stickyNav:!0,blurNav:!0,search:{provider:"kbar",kbarConfig:{searchDocumentsPath:"".concat(a.env.BASE_PATH||"","/search.json")}}};e.exports=n},37134:function(e,t,r){"use strict";r.d(t,{g:function(){return u}});var a=r(28700),n=r(64123),s=r(2265),o=r(93360),l=r(22343),i=r(49026),d=r(77253),c=r(55456);let u=(0,i.yV)(function(e,t){let r=(0,s.useId)(),u=(0,l.Q)(),m=(0,o.B)(),{id:x=u||"headlessui-textarea-".concat(r),disabled:h=m||!1,autoFocus:g=!1,invalid:b=!1,...p}=e,f=(0,c.wp)(),v=(0,d.zH)(),{isFocused:w,focusProps:j}=(0,a.F)({autoFocus:g}),{isHovered:y,hoverProps:k}=(0,n.X)({isDisabled:h}),N=(0,i.dG)({ref:t,id:x,"aria-labelledby":f,"aria-describedby":v,"aria-invalid":b?"":void 0,disabled:h||void 0,autoFocus:g},j,k),C=(0,s.useMemo)(()=>({disabled:h,invalid:b,hover:y,focus:w,autofocus:g}),[h,b,y,w,g]);return(0,i.L6)()({ourProps:N,theirProps:p,slot:C,defaultTag:"textarea",name:"Textarea"})})},96e3:function(e,t,r){"use strict";r.d(t,{default:function(){return l}});var a=r(2265),n=r(57437),s=(e,t,r)=>new Promise((a,n)=>{var s=e=>{try{l(r.next(e))}catch(e){n(e)}},o=e=>{try{l(r.throw(e))}catch(e){n(e)}},l=e=>e.done?a(e.value):Promise.resolve(e.value).then(s,o);l((r=r.apply(e,t)).next())}),o=e=>{let{title:t="Subscribe to the newsletter",apiUrl:r="/api/newsletter"}=e,o=(0,a.useRef)(null),[l,i]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1);return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"pb-1 text-lg font-semibold text-gray-800 dark:text-gray-100",children:t}),(0,n.jsxs)("form",{className:"flex flex-col sm:flex-row",onSubmit:e=>s(void 0,null,function*(){e.preventDefault();let t=yield fetch(r,{body:JSON.stringify({email:o.current.value}),headers:{"Content-Type":"application/json"},method:"POST"}),{error:a}=yield t.json();if(a){i(!0),c("Your e-mail address is invalid or you are already subscribed!");return}o.current.value="",i(!1),m(!0)}),children:[(0,n.jsx)("div",{children:(0,n.jsxs)("label",{htmlFor:"email-input",children:[(0,n.jsx)("span",{className:"sr-only",children:"Email address"}),(0,n.jsx)("input",{autoComplete:"email",className:"focus:ring-primary-600 w-72 rounded-md px-4 focus:border-transparent focus:outline-none focus:ring-2 dark:bg-black",id:"email-input",name:"email",placeholder:u?"You're subscribed !  \uD83C\uDF89":"Enter your email",ref:o,required:!0,type:"email",disabled:u})]})}),(0,n.jsx)("div",{className:"mt-2 flex w-full rounded-md shadow-sm sm:mt-0 sm:ml-3",children:(0,n.jsx)("button",{className:"bg-primary-500 w-full rounded-md py-2 px-4 font-medium text-white sm:py-0 ".concat(u?"cursor-default":"hover:bg-primary-700 dark:hover:bg-primary-400"," focus:ring-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 dark:ring-offset-black"),type:"submit",disabled:u,children:u?"Thank you!":"Sign up"})})]}),l&&(0,n.jsx)("div",{className:"w-72 pt-2 text-sm text-red-500 dark:text-red-400 sm:w-96",children:d})]})},l=e=>{let{title:t,apiUrl:r}=e;return(0,n.jsx)("div",{className:"flex items-center justify-center",children:(0,n.jsx)("div",{className:"bg-gray-100 p-6 dark:bg-gray-800 sm:px-14 sm:py-8",children:(0,n.jsx)(o,{title:t,apiUrl:r})})})}},40408:function(e,t,r){"use strict";r.d(t,{default:function(){return s}});var a=r(2265),n=r(57437),s=e=>{let{children:t}=e,r=(0,a.useRef)(null),[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1);return(0,n.jsxs)("div",{ref:r,onMouseEnter:()=>{o(!0)},onMouseLeave:()=>{o(!1),i(!1)},className:"relative",children:[s&&(0,n.jsx)("button",{"aria-label":"Copy code",className:"absolute right-2 top-2 h-8 w-8 rounded border-2 bg-gray-700 p-1 dark:bg-gray-800 ".concat(l?"border-green-400 focus:border-green-400 focus:outline-none":"border-gray-300"),onClick:()=>{i(!0),navigator.clipboard.writeText(r.current.textContent),setTimeout(()=>{i(!1)},2e3)},children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",className:l?"text-green-400":"text-gray-300",children:l?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})})}),(0,n.jsx)("pre",{children:t})]})}},50894:function(){},94236:function(){}},function(e){e.O(0,[1329,6305,2376,522,6051,7240,7699,614,231,9528,8173,8e3,3374,7599,998,2971,7023,1744],function(){return e(e.s=33294)}),_N_E=e.O()}]);