PageSourceSearch

https://www.bagchee.com/static/js/1703.de01c85a.chunk.js

js bagchee.com collected 2026-10-02 11:14:50 UTC 5,971 bytes, 3 lines download raw bytes

1/*! For license information please see 1703.de01c85a.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[1703],{1703(e,t,a){a.r(t),a.d(t,{default:()=>h});var s=a(9379),r=a(5043),i=a(7874),l=a(3046),n=a(2024);const c=(0,a(7784).A)("book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);var o=a(2382),d=a(9350),p=a(579);const m=e=>{let{categories:t}=e;const[a,s]=(0,r.useState)(null);return(0,p.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(e=>(0,p.jsx)(x,{category:e,isOpen:a===(e.id||e._id),onToggle:e=>s(t=>t===e?null:e)},e.id||e._id))})},x=e=>{let{category:t,depth:a=0,isOpen:s,onToggle:l}=e;const n=(0,i.Zp)(),d=t.children&&t.children.length>0,[m,u]=(0,r.useState)(!1),g=0===a?null!==s&&void 0!==s&&s:m,h=t.title||t.categorytitle||"",v=["bg-primary hover:bg-primary/90","bg-primary/80 hover:bg-primary","bg-primary/70 hover:bg-primary","bg-primary/60 hover:bg-primary"],y=v[Math.min(a,v.length-1)],b=0===a?"text-sm":"text-xs",f=0===a?16:14,j=0===a?"py-3":"py-2.5";return(0,p.jsxs)("div",{children:[(0,p.jsxs)("button",{type:"button",onClick:()=>{d?0===a&&l?l(t.id||t._id):u(e=>!e):t.slug&&n("/books/".concat(t.slug))},className:"w-full flex items-center justify-between ".concat(y," text-white rounded-lg px-4 ").concat(j," transition-colors duration-150"),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3",children:[(0,p.jsx)(c,{size:f,className:"flex-shrink-0 opacity-90"}),(0,p.jsx)("span",{className:"font-bold ".concat(b," uppercase tracking-wide text-left"),children:h})]}),d&&(0,p.jsx)(o.A,{size:f,className:"flex-shrink-0 transition-transform duration-300 ".concat(g?"rotate-180":"")})]}),d&&g&&(0,p.jsxs)("div",{className:"mt-1 ml-4 space-y-1 border-l-2 border-primary/30 pl-2",children:[t.slug&&(0,p.jsxs)("button",{type:"button",onClick:()=>n("/books/".concat(t.slug)),className:"w-full flex items-center gap-3 bg-primary/50 hover:bg-primary text-white rounded-lg px-4 py-2 transition-colors duration-150",children:[(0,p.jsx)(c,{size:12,className:"flex-shrink-0 opacity-80"}),(0,p.jsxs)("span",{className:"font-semibold text-[11px] uppercase tracking-wide",children:["View all in ",h]})]}),t.children.map(e=>(0,p.jsx)(x,{category:e,depth:a+1},e.id||e._id))]})]})},u=e=>{let{tag:t}=e;const a=(0,i.Zp)();return(0,p.jsxs)("button",{type:"button",onClick:()=>a("/books?tags=".concat(t.id)),className:"w-full flex items-center gap-3 bg-primary hover:bg-primary/90 text-white rounded-lg px-4 py-3 transition-colors duration-150",children:[(0,p.jsx)(d.A,{size:16,className:"flex-shrink-0 opacity-90"}),(0,p.jsx)("span",{className:"font-bold text-sm uppercase tracking-wide text-left",children:t.title})]})},g=(e,t)=>{t||(t=e.filter(e=>{var t,a;return!(null!==(t=null!==(a=e.parentId)&&void 0!==a?a:e.parentid)&&void 0!==t?t:0)}));const a={};return e.forEach(e=>{var t;const r=null!==(t=e.id)&&void 0!==t?t:e._id;r&&(a[r]=(0,s.A)((0,s.A)({},e),{},{children:[]}))}),e.forEach(e=>{var s,r,i;const l=null!==(s=e.id)&&void 0!==s?s:e._id;if(!a[l])return;const n=null!==(r=null!==(i=e.parentId)&&void 0!==i?i:e.parentid)&&void 0!==r?r:0;n&&a[n]&&!t.some(e=>{var t;return(null!==(t=e.id)&&void 0!==t?t:e._id)===l})&&a[n].children.push(a[l])}),t.map(e=>{var t;return a[null!==(t=e.id)&&void 0!==t?t:e._id]||e})},h=()=>{const[e,t]=(0,r.useState)([]),[a,s]=(0,r.useState)(!0),[i,c]=(0,r.useState)([]);return(0,r.useEffect)(()=>{(async()=>{try{const[a,s]=await Promise.all([l.A.get("/category/fetch"),l.A.get("/tags/list?limit=1000")]);if(a.data.status){var e;const s=a.data.data||a.data.categories||[],r={};s.forEach(e=>{var t;const a=null!==(t=e.parentId)&&void 0!==t?t:e.parent_id;a&&(r[a]=(r[a]||0)+1)});const i=Number((null===(e=Object.entries(r).sort((e,t)=>t[1]-e[1])[0])||void 0===e?void 0:e[0])||2),l=s.filter(e=>!1!==e.active&&(e.parentId===i||e.parent_id===i)&&(e.title||"").trim()).sort((e,t)=>(e.title||"").localeCompare(t.title||""));t(g(s,l))}s.data.status&&s.data.data&&c([...s.data.data].sort((e,t)=>(e.title||"").localeCompare(t.title||"")))}catch(a){console.error("Error loading data:",a)}finally{s(!1)}})()},[]),a?(0,p.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-cream-50",children:(0,p.jsx)(n.A,{className:"animate-spin text-primary",size:40})}):(0,p.jsxs)("div",{className:"min-h-screen bg-cream-50 font-body text-text-main pb-16",children:[(0,p.jsxs)("div",{className:"max-w-6xl mx-auto px-6 pt-12 pb-10",children:[(0,p.jsxs)("div",{className:"text-center mb-8",children:[(0,p.jsx)("h1",{className:"text-3xl md:text-4xl font-display font-bold text-text-main uppercase tracking-wide",children:"Browse All Categories"}),(0,p.jsx)("div",{className:"w-16 h-1 bg-primary mx-auto mt-4 rounded-full"})]}),e.length>0?(0,p.jsx)(m,{categories:e}):(0,p.jsx)("p",{className:"text-center text-text-muted font-semibold py-10",children:"No categories found."})]}),i.length>0&&(0,p.jsxs)("div",{className:"max-w-6xl mx-auto px-6 pt-4 pb-10",children:[(0,p.jsxs)("div",{className:"text-center mb-8",children:[(0,p.jsx)("h2",{className:"text-3xl md:text-4xl font-display font-bold text-text-main uppercase tracking-wide",children:"Special Topics"}),(0,p.jsx)("div",{className:"w-16 h-1 bg-primary mx-auto mt-4 rounded-full"})]}),(0,p.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:i.map(e=>(0,p.jsx)(u,{tag:e},e.id||e._id))})]})]})}},2024(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9350(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.
2172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]])}}]);
3//# sourceMappingURL=1703.de01c85a.chunk.js.map

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.