1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8024],{9720:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/category/[slug]",function(){return r(9534)}])},9534:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return g}});var n=r(1549),o=r(8988);async function readCategory(e){try{return(await (0,o.Z)({method:"GET",url:"/v1/category/".concat(e),headers:{Accept:"application/json"}})).data}catch(t){let e=t;return t instanceof Error&&(e=t.message),console.error("An error occurred:",e),null}}var a=r(9509),i=r(3156),s=r(8230),l=r(260),c=r(3403),u=r(4152),d=r(4194),h=r(7664),f=r(9126);function CategoryPage(){var e;let t=null===(e=(0,u.useRouter)().query)||void 0===e?void 0:e.slug,r=Array.isArray(t)?t[0]:t,[o,c]=(0,d.useState)(null),[g,y]=(0,d.useState)([]),[v,m]=(0,d.useState)({fetch:!1,posts:!1,loadmore:!1}),[p,w]=(0,d.useState)({searchQuery:"",skip:0,limit:5}),[b,j]=(0,d.useState)(0),[,k]=(0,d.useState)(1),x=(0,d.useCallback)(e=>{m(t=>({...t,...e}))},[]),C=(0,d.useCallback)(async e=>{x({fetch:!0});try{var t;let r=await readCategory(e);if(x({fetch:!1}),!(null==r?void 0:r.data))return;c(r.data);let n={...p,categories:[r.data._id]};w(n);let o=await (0,a.aA)(n);y(o.data),j(o.count),k(Math.ceil(o.count/(null!==(t=p.limit)&&void 0!==t?t:5)))}catch(e){x({fetch:!1}),console.error("Error fetching category and posts",e)}},[p,x]);(0,d.useEffect)(()=>{"string"==typeof r&&0!==r.length&&C(r)},[r,C]);let E=(0,d.useCallback)(async()=>{if(!v.loadmore){x({loadmore:!0});try{let e={...p,skip:g.length};w(e);let t=await (0,a.aA)(e);x({loadmore:!1}),y(e=>[...e,...t.data]),j(t.count)}catch(e){x({loadmore:!1}),console.error("Error loading more category posts",e)}}},[p,v.loadmore,g.length,x]),{ref:_,inView:N}=(0,h.YD)({threshold:0});return(0,d.useEffect)(()=>{N&&!v.loadmore&&E()},[N,v.loadmore,E]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"frontend-content-container",children:(0,n.jsx)("div",{className:"content-wrapper",children:(0,n.jsxs)("div",{className:"main-container",children:[(0,n.jsx)(i.Z,{data:g,destination:"post",header:null==o?void 0:o.name}),v.loadmore?(0,n.jsx)("div",{className:"py-3 d-flex justify-content-center"}):0===g.length?null:(0,n.jsx)("div",{className:"px-3 pb-3",children:g.length<b?(0,n.jsx)(f.Z,{block:!0,className:"mt-3",onClick:()=>{E()},innerRef:_,children:"See more"}):(0,n.jsx)(f.Z,{block:!0,disabled:!0,className:"mt-3",children:"No more posts to load"})})]})})}),(0,n.jsx)(s.Z,{children:(0,n.jsx)(l.Z,{})})]})}CategoryPage.layout=c.Z;var g=CategoryPage},7664:function(e,t,r){"use strict";r.d(t,{YD:function(){return useInView}});var n=r(4194),o=Object.defineProperty,a=new Map,i=new WeakMap,s=0,l=void 0;function useInView({threshold:e,delay:t,trackVisibility:r,rootMargin:o,root:c,triggerOnce:u,skip:d,initialInView:h,fallbackInView:f,onChange:g}={}){var y;let[v,m]=n.useState(null),p=n.useRef(g),[w,b]=n.useState({inView:!!h,entry:void 0});p.current=g,n.useEffect(()=>{let n;if(!d&&v)return n=function(e,t,r={},n=l){if(void 0===window.IntersectionObserver&&void 0!==n){let o=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:o,intersectionRect:o,rootBounds:o}),()=>{}}let{id:o,observer:c,elements:u}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var r;return`${t}_${"root"===t?(r=e.root)?(i.has(r)||(s+=1,i.set(r,s.toString())),i.get(r)):"0":e[t]}`}).toString(),r=a.get(t);if(!r){let n;let o=new Map,i=new IntersectionObserver(t=>{t.forEach(t=>{var r;let a=t.isIntersecting&&n.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null==(r=o.get(t.target))||r.forEach(e=>{e(a,t)})})},e);n=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:o},a.set(t,r)}return r}(r),d=u.get(e)||[];return u.has(e)||u.set(e,d),d.push(t),c.observe(e),function(){d.splice(d.indexOf(t),1),0===d.length&&(u.delete(e),c.unobserve(e)),0===u.size&&(c.disconnect(),a.delete(o))}}(v,(e,t)=>{b({inView:e,entry:t}),p.current&&p.current(e,t),t.isIntersecting&&u&&n&&(n(),n=void 0)},{root:c,rootMargin:o,threshold:e,trackVisibility:r,delay:t},f),()=>{n&&n()}},[Array.isArray(e)?e.toString():e,v,c,o,u,d,r,f,t]);let j=null==(y=w.entry)?void 0:y.target,k=n.useRef(void 0);v||!j||u||d||k.current===j||(k.current=j,b({inView:!!h,entry:void 0}));let x=[m,w.inView,w.entry];return x.ref=x[0],x.inView=x[1],x.entry=x[2],x}n.Component}},function(e){e.O(0,[9341,8718,1340,2919,623,2281,2576,9774,2888,179],function(){return e(e.s=9720)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.