(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6222],{93130:function(e,t,s){Promise.resolve().then(s.bind(s,10543))},90259:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(57437);function l(e){let{article:t}=e,s=new Date(t.datePublished).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"});return(0,r.jsx)("a",{href:"/articles/".concat(t.slug),target:"_blank",children:(0,r.jsx)("div",{className:"flex flex-col sm:flex-row items-start gap-4 mt-4 mb-2 bg-[#fff] dark:bg-[#000] p-8 rounded-2xl",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-[#1B1D21] dark:text-[#fff] text-[26px] font-semibold mb-2",children:t.name}),(0,r.jsx)("p",{className:"text-[#797A7E] dark:text-[#fff] mb-2 line-clamp-2",children:t.description}),(0,r.jsxs)("p",{className:"text-[#1B1D21] dark:text-[#fff] flex flex-col md:flex-row items-start  md:items-center",children:[(0,r.jsxs)("span",{className:"text-primaryColor font-medium",children:[(0,r.jsx)("span",{className:" font-normal text-[#1B1D21] dark:text-[#fff]",children:"By :"})," ",t.author?t.author:"Techbible Admin"]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 md:ml-4",children:[(0,r.jsx)("span",{children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,r.jsx)("path",{d:"M1.66602 9.99992C1.66602 6.85722 1.66602 5.28587 2.64233 4.30956C3.61864 3.33325 5.18999 3.33325 8.33268 3.33325H11.666C14.8087 3.33325 16.3801 3.33325 17.3564 4.30956C18.3327 5.28587 18.3327 6.85722 18.3327 9.99992V11.6666C18.3327 14.8093 18.3327 16.3806 17.3564 17.3569C16.3801 18.3333 14.8087 18.3333 11.666 18.3333H8.33268C5.18999 18.3333 3.61864 18.3333 2.64233 17.3569C1.66602 16.3806 1.66602 14.8093 1.66602 11.6666V9.99992Z",stroke:"#797A7E",strokeWidth:"1.5"}),(0,r.jsx)("path",{d:"M5.83398 3.33325V2.08325",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M14.166 3.33325V2.08325",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M2.08398 7.5H17.9173",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M15.0007 14.1667C15.0007 14.6269 14.6276 15 14.1673 15C13.7071 15 13.334 14.6269 13.334 14.1667C13.334 13.7064 13.7071 13.3333 14.1673 13.3333C14.6276 13.3333 15.0007 13.7064 15.0007 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M15.0007 10.8333C15.0007 11.2936 14.6276 11.6667 14.1673 11.6667C13.7071 11.6667 13.334 11.2936 13.334 10.8333C13.334 10.3731 13.7071 10 14.1673 10C14.6276 10 15.0007 10.3731 15.0007 10.8333Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M10.8327 14.1667C10.8327 14.6269 10.4596 15 9.99935 15C9.53911 15 9.16602 14.6269 9.16602 14.1667C9.16602 13.7064 9.53911 13.3333 9.99935 13.3333C10.4596 13.3333 10.8327 13.7064 10.8327 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M10.8327 10.8333C10.8327 11.2936 10.4596 11.6667 9.99935 11.6667C9.53911 11.6667 9.16602 11.2936 9.16602 10.8333C9.16602 10.3731 9.53911 10 9.99935 10C10.4596 10 10.8327 10.3731 10.8327 10.8333Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M6.66667 14.1667C6.66667 14.6269 6.29357 15 5.83333 15C5.3731 15 5 14.6269 5 14.1667C5 13.7064 5.3731 13.3333 5.83333 13.3333C6.29357 13.3333 6.66667 13.7064 6.66667 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M6.66667 10.8333C6.66667 11.2936 6.29357 11.6667 5.83333 11.6667C5.3731 11.6667 5 11.2936 5 10.8333C5 10.3731 5.3731 10 5.83333 10C6.29357 10 6.66667 10.3731 6.66667 10.8333Z",fill:"#797A7E"})]})}),(0,r.jsx)("span",{className:"text-[#797A7E] mt-1",children:s})]})]})]})})})}s(11856)},10543:function(e,t,s){"use strict";s.d(t,{default:function(){return g}});var r=s(57437),l=s(2265),a=s(90259),n=s(63481),i=s(42126),d=s(64967),o=s(89506),c=s(69842),x=s(42546);function u(e){let{...t}=e;return(0,r.jsx)("span",{...t,children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"22",height:"22",viewBox:"0 0 48 48",children:(0,r.jsx)("path",{d:"M 20.5 4 A 1.50015 1.50015 0 0 0 19.066406 6 L 14.640625 6 C 12.803372 6 11.082924 6.9194511 10.064453 8.4492188 L 7.6972656 12 L 7.5 12 A 1.50015 1.50015 0 1 0 7.5 15 L 8.2636719 15 A 1.50015 1.50015 0 0 0 8.6523438 15.007812 L 11.125 38.085938 C 11.423352 40.868277 13.795836 43 16.59375 43 L 31.404297 43 C 34.202211 43 36.574695 40.868277 36.873047 38.085938 L 39.347656 15.007812 A 1.50015 1.50015 0 0 0 39.728516 15 L 40.5 15 A 1.50015 1.50015 0 1 0 40.5 12 L 40.302734 12 L 37.935547 8.4492188 C 36.916254 6.9202798 35.196001 6 33.359375 6 L 28.933594 6 A 1.50015 1.50015 0 0 0 27.5 4 L 20.5 4 z M 14.640625 9 L 33.359375 9 C 34.196749 9 34.974746 9.4162203 35.439453 10.113281 L 36.697266 12 L 11.302734 12 L 12.560547 10.113281 A 1.50015 1.50015 0 0 0 12.5625 10.111328 C 13.025982 9.4151428 13.801878 9 14.640625 9 z M 11.669922 15 L 36.330078 15 L 33.890625 37.765625 C 33.752977 39.049286 32.694383 40 31.404297 40 L 16.59375 40 C 15.303664 40 14.247023 39.049286 14.109375 37.765625 L 11.669922 15 z",className:" fill-darkText dark:fill-[#fff]"})})})}var f=s(737),m=s(87138),h=s(23085),p=s(28196);function C(e){let{_id:t,title:s,description:l,url:a,date:n,provider:i}=e,d=new Date(n).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"});return(0,r.jsx)(m.default,{href:a,target:"_blank",children:(0,r.jsx)("div",{className:"flex flex-col md:flex-row items-start gap-4 mt-4 mb-2 bg-[#fff] dark:bg-[#000] p-4 lg:p-8 rounded-2xl",children:(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"text-[#1B1D21] dark:text-[#fff] text-[26px] font-semibold mb-2",children:s}),(0,r.jsx)("p",{className:"text-[#797A7E] dark:text-[#fff] mb-2 line-clamp-2",children:l}),(0,r.jsxs)("p",{className:"text-[#1B1D21] dark:text-[#fff] flex flex-col md:flex-row items-start md:items-center",children:[(0,r.jsxs)("span",{className:"text-primaryColor font-medium",children:[(0,r.jsx)("span",{className:"font-normal text-[#1B1D21] dark:text-[#fff]",children:"By :"})," ",i]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 md:ml-4",children:[(0,r.jsx)("span",{children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,r.jsx)("path",{d:"M1.66602 9.99992C1.66602 6.85722 1.66602 5.28587 2.64233 4.30956C3.61864 3.33325 5.18999 3.33325 8.33268 3.33325H11.666C14.8087 3.33325 16.3801 3.33325 17.3564 4.30956C18.3327 5.28587 18.3327 6.85722 18.3327 9.99992V11.6666C18.3327 14.8093 18.3327 16.3806 17.3564 17.3569C16.3801 18.3333 14.8087 18.3333 11.666 18.3333H8.33268C5.18999 18.3333 3.61864 18.3333 2.64233 17.3569C1.66602 16.3806 1.66602 14.8093 1.66602 11.6666V9.99992Z",stroke:"#797A7E",strokeWidth:"1.5"}),(0,r.jsx)("path",{d:"M5.83398 3.33325V2.08325",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M14.166 3.33325V2.08325",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M2.08398 7.5H17.9173",stroke:"#797A7E",strokeWidth:"1.5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M15.0007 14.1667C15.0007 14.6269 14.6276 15 14.1673 15C13.7071 15 13.334 14.6269 13.334 14.1667C13.334 13.7064 13.7071 13.3333 14.1673 13.3333C14.6276 13.3333 15.0007 13.7064 15.0007 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M15.0007 10.8333C15.0007 11.2936 14.6276 11.6667 14.1673 11.6667C13.7071 11.6667 13.334 11.2936 13.334 10.8333C13.334 10.3731 13.7071 10 14.1673 10C14.6276 10 15.0007 10.3731 15.0007 10.8333Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M10.8327 14.1667C10.8327 14.6269 10.4596 15 9.99935 15C9.53911 15 9.16602 14.6269 9.16602 14.1667C9.16602 13.7064 9.53911 13.3333 9.99935 13.3333C10.4596 13.3333 10.8327 13.7064 10.8327 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M10.8327 10.8333C10.8327 11.2936 10.4596 11.6667 9.99935 11.6667C9.53911 11.6667 9.16602 11.2936 9.16602 10.8333C9.16602 10.3731 9.53911 10 9.99935 10C10.4596 10 10.8327 10.3731 10.8327 10.8333Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M6.66667 14.1667C6.66667 14.6269 6.29357 15 5.83333 15C5.3731 15 5 14.6269 5 14.1667C5 13.7064 5.3731 13.3333 5.83333 13.3333C6.29357 13.3333 6.66667 13.7064 6.66667 14.1667Z",fill:"#797A7E"}),(0,r.jsx)("path",{d:"M6.66667 10.8333C6.66667 11.2936 6.29357 11.6667 5.83333 11.6667C5.3731 11.6667 5 11.2936 5 10.8333C5 10.3731 5.3731 10 5.83333 10C6.29357 10 6.66667 10.3731 6.66667 10.8333Z",fill:"#797A7E"})]})}),(0,r.jsx)("span",{className:"text-[#797A7E] mt-1",children:d})]})]})]})})})}var j=s(93639);function g(e){let{blogs:t,news:s,updateNews:g}=e;console.log(t);let{isAdmin:k}=(0,l.useContext)(f.V);function w(e){let t=[...e];return t.sort((e,t)=>{let s=new Date("publish_date"in e?e.publish_date:e.datePublished);return new Date("publish_date"in t?t.publish_date:t.datePublished).getTime()-s.getTime()}),t}let b=w([...t,...s]),[v,N]=(0,l.useState)("All"),[A,y]=(0,l.useState)(b),[L,E]=(0,l.useState)(!1),[M,Z]=(0,l.useState)(!1),B=e=>{switch(N(e),e){case"All":y(b);break;case"News":y(w([...t.filter(e=>"News"===e.category),...s]));break;case"Reviews":y(w(t.filter(e=>"Reviews"===e.category)));break;case"Guides":y(w(t.filter(e=>"Guides"===e.category)));break;default:y([])}},_="All"===v?b:A,[S,D]=(0,l.useState)(12),W=(0,l.useRef)(null),U=(0,l.useCallback)(e=>{W.current&&W.current.disconnect(),W.current=new IntersectionObserver(e=>{e[0].isIntersecting&&S<_.length&&D(e=>e+6)}),e&&W.current.observe(e)},[S,_.length]);(0,l.useEffect)(()=>{D(12)},[v]);let V=async e=>{if(window.confirm("Are you sure that you want to delete this item?"))try{let t=await i.Z.delete("".concat(d._,"/delete-article/").concat(e));console.log("Article deleted:",t.data),g(),document.location.reload()}catch(e){console.error("Error deleting article:",e)}};async function H(e){if(window.confirm("Are you sure that you want to delete this item?"))try{let t=(0,c.JU)(o.db,"blog",e);return await (0,c.oe)(t),console.log("Blog deleted successfully"),document.location.reload(),!0}catch(e){return console.error("Error deleting blog: ",e),!1}}return(0,r.jsxs)(n.Z,{children:[k?(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-4 mt-4 mb-6",children:[(0,r.jsx)(m.default,{href:"/blog/add",className:" block",children:(0,r.jsx)("button",{className:"flex flex-row font-spartan justify-center w-[150px] items-center gap-2 text-[#E36B20] py-2 px-4 rounded-xl bg-[#e8e8e8] dark:bg-[#131619]",children:(0,r.jsx)("span",{children:"+ Add an Article"})})}),(0,r.jsx)(m.default,{href:"/new/add",className:" block",children:(0,r.jsx)("button",{className:"flex flex-row font-spartan justify-center w-[150px] items-center gap-2 text-[#E36B20] py-2 px-4 rounded-xl bg-[#e8e8e8] dark:bg-[#131619]",children:(0,r.jsx)("span",{children:"+ Add News "})})}),(0,r.jsx)("button",{onClick:()=>{(0,h.Fd)()},className:"flex flex-row font-spartan justify-center w-[150px] items-center gap-2 text-[#E36B20] py-2 px-4 rounded-xl bg-[#e8e8e8] dark:bg-[#131619]",children:M?(0,r.jsx)(j.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"Send Test Emails"}),(0,r.jsx)(p.PRb,{})]})})]}):null,(0,r.jsx)("div",{className:"flex flex-col md:flex-row items-start",children:(0,r.jsxs)("div",{className:"bg-[#eeeeee] dark:bg-[#131619] p-2 sm:p-4 rounded-xl w-full",children:[(0,r.jsx)("h2",{className:"text-[#000] dark:text-[#fff] text-[26px] font-semibold mb-4",children:"Curated Tech News & Articles."}),(0,r.jsx)("div",{className:"filteherHeadingContainer pt-[8px] flex flex-row items-center",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>B("All"),className:"p-1 px-4 rounded-md ".concat("All"===v?"bg-primaryColor text-[#fff]":"border-primaryColor text-[#E36B20]"),children:"All"}),(0,r.jsx)("button",{onClick:()=>B("News"),className:"p-1 px-4 rounded-md ".concat("News"===v?"bg-primaryColor text-[#fff]":"border-primaryColor text-[#E36B20]"),children:"News"}),(0,r.jsx)("button",{onClick:()=>B("Reviews"),className:"p-1 px-4 rounded-md ".concat("Reviews"===v?"bg-primaryColor text-[#fff]":"border-primaryColor text-[#E36B20]"),children:"Reviews"}),(0,r.jsx)("button",{onClick:()=>B("Guides"),className:"p-1 px-4 rounded-md ".concat("Guides"===v?"bg-primaryColor text-[#fff]":"border-primaryColor text-[#E36B20]"),children:"Guides"})]})}),(0,r.jsx)("div",{className:"mt-6 mb-4 grid grid-cols-1 sm:grid-cols-2 gap-3",children:_.slice(0,S).map((e,t)=>{var l,n;return(0,r.jsx)("div",{ref:t===S-1?U:null,className:"bg-[#f5f5f5] dark:bg-[#1a1e22] p-3 rounded-lg",children:s.includes(e)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C,{_id:e.id,title:e.name,description:e.description,url:e.url,date:e.datePublished,provider:(null==e?void 0:null===(n=e.provider)||void 0===n?void 0:null===(l=n[0])||void 0===l?void 0:l.name)||"Unknown Provider"}),k&&(0,r.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,r.jsx)("a",{href:"/new/edit/".concat(e._id),target:"_blank",children:(0,r.jsx)(x.Z,{className:"cursor-pointer"})}),(0,r.jsx)(u,{onClick:()=>V(e._id),className:"cursor-pointer"})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{article:e}),k&&(0,r.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,r.jsx)("a",{href:"/blog/edit/".concat(e.slug),target:"_blank",children:(0,r.jsx)(x.Z,{className:"cursor-pointer"})}),(0,r.jsx)(u,{className:"cursor-pointer",onClick:()=>H(e.id)})]})]})},t)})})]})})]})}},42546:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(57437);function l(e){let{...t}=e;return(0,r.jsx)("span",{className:"cursor-pointer",...t,children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,r.jsx)("path",{className:" stroke-[#000] dark:stroke-[#fff]",d:"M3.33398 18.332H16.6673",strokeWidth:"1",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M12.1919 2.43582L11.574 3.05374L5.8932 8.73457C5.50843 9.11934 5.31604 9.31173 5.15058 9.52386C4.95541 9.77409 4.78807 10.0448 4.65155 10.3313C4.53581 10.5742 4.44977 10.8323 4.27769 11.3485L3.54852 13.536L3.37028 14.0707C3.2856 14.3248 3.35172 14.6049 3.54107 14.7942C3.73042 14.9836 4.0105 15.0497 4.26455 14.965L4.79926 14.7868L6.98677 14.0576L6.9868 14.0576C7.50301 13.8855 7.76112 13.7995 8.00397 13.6837C8.29045 13.5472 8.5612 13.3799 8.81143 13.1847C9.02355 13.0192 9.21594 12.8269 9.60071 12.4421L9.60072 12.4421L15.2815 6.76126L15.8995 6.14334C16.9233 5.11954 16.9233 3.45962 15.8995 2.43582C14.8757 1.41202 13.2157 1.41202 12.1919 2.43582Z",className:" stroke-[#000] dark:stroke-[#fff]",strokeWidth:"1"}),(0,r.jsx)("path",{d:"M11.5724 3.05273C11.5724 3.05273 11.6496 4.36581 12.8082 5.52441C13.9668 6.68301 15.2799 6.76025 15.2799 6.76025M4.79762 14.7858L3.54688 13.535",className:" stroke-[#000] dark:stroke-[#fff]",strokeWidth:"1"})]})})}s(2265)},93639:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});var r=s(57437);s(2265);var l=s(27485);function a(){return(0,r.jsx)("div",{className:"loader-spinner-container",children:(0,r.jsx)(l.g4,{height:"40",width:"30",radius:"9",color:"#5a5a5a",ariaLabel:"three-dots-loading",wrapperStyle:{},visible:!0})})}},63481:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(57437);function l(e){let{children:t,className:s,containerClassname:l}=e;return(0,r.jsx)("main",{className:s,children:(0,r.jsx)("div",{className:"mt-[110px] max-w-full lg:max-w-[95vw] mx-auto px-3 md:px-6 ".concat(l),children:t})})}s(2265)},737:function(e,t,s){"use strict";s.d(t,{H:function(){return f},V:function(){return u}});var r=s(57437),l=s(64967),a=s(89506),n=s(42126),i=s(5186),d=s(2265),o=s(93375),c=s(762),x=s(53782);let u=(0,d.createContext)(null),f=e=>{let{children:t}=e,s=(0,x.U0)(),[f,m]=(0,d.useState)(null),[h,p]=(0,d.useState)(null),[C,j]=(0,d.useState)(!1),[g,k]=(0,d.useState)(null),w=async()=>{try{var e,t,r,a,i;let d=await n.Z.get("".concat(l._,"/check-user/").concat(null==f?void 0:f.uid));return null==s||s.identify(null==d?void 0:null===(e=d.data)||void 0===e?void 0:e.uid,{name:null==d?void 0:null===(t=d.data)||void 0===t?void 0:t.username,email:null==d?void 0:null===(r=d.data)||void 0===r?void 0:r.email}),(0,o.setCookie)("isAdmin",null!=d&&null!==(a=d.data)&&void 0!==a&&!!a.isAdmin,c.mb),p(null==d?void 0:d.data),j(null==d?void 0:null===(i=d.data)||void 0===i?void 0:i.isAdmin),d.data}catch(e){return console.error(e),[]}},b=async e=>{try{let t=await fetch("".concat(l._,"/user/stackRecommendations/").concat(e)),s=await t.json();k(s.recommendations)}catch(e){console.error("Failed to fetch user recommendations:",e)}};return(0,d.useEffect)(()=>{let e=(0,i.Aj)(a.I8,e=>{m(e),e?(0,o.setCookie)("currentUserUid",null==e?void 0:e.uid,c.mb):(0,o.setCookie)("currentUserUid","")});return()=>{e()}},[]),(0,d.useEffect)(()=>{(null==f?void 0:f.uid)&&w()},[f]),(0,r.jsx)(u.Provider,{value:{currentUser:f,currentUserData:h,updateUserData:()=>{w()},isAdmin:C,userRecommendations:g,fetchUserRecommendations:b},children:t})}}},function(e){e.O(0,[4358,7205,6990,5878,614,9571,5220,3540,231,7407,494,3661,2971,7023,1744],function(){return e(e.s=93130)}),_N_E=e.O()}]);