module.exports=[94195,a=>{"use strict";var b=a.i(63672);function c(){return"https://api.banglayon.com/api".replace(/\/+$/,"")}function d(){let a=c();if(!a)throw{status:0,message:"API Base URL সেট করা নেই। `nextjsadmin/.env.local` এ NEXT_PUBLIC_API_BASE_URL দিন (example দেখুন), তারপর dev server restart করুন।"};return a}function e(a){let c=(0,b.getAdminApiKey)(),d=new Headers(a?.headers);return c&&d.set("x-admin-key",c),{...a,headers:d}}async function f(a){return await a.json().catch(()=>null)}async function g(a){let b=await f(a),c=(()=>{if(b&&"object"==typeof b&&"message"in b){let a=b.message;if(null!=a)return String(a)}return`Request failed (${a.status})`})();return{status:a.status,message:c}}async function h(a,b){let c=new URL(`${d()}${a}`);b&&Object.entries(b).forEach(([a,b])=>c.searchParams.set(a,b));let h=await fetch(c.toString(),e({method:"GET"}));if(!h.ok)throw await g(h);let i=await f(h);return i?.data??i}async function i(a,b){let c=await fetch(`${d()}${a}`,e({method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(b)}));if(!c.ok)throw await g(c);let h=await f(c);return h?.data??h}async function j(a,b){let c=await fetch(`${d()}${a}`,e({method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)}));if(!c.ok)throw await g(c);let h=await f(c);return h?.data??h}async function k(a){let b=await fetch(`${d()}${a}`,e({method:"DELETE"}));if(!b.ok)throw await g(b);return!0}async function l(a){let b=`${d()}/admin/books`,c=new Headers;c.set("x-admin-key",a.trim());let e=await fetch(b,{method:"GET",headers:c});if(401===e.status)throw{status:401,message:"ভুল Admin API Key। সঠিক key দিন।"};if(!e.ok)throw await g(e)}async function m(a,b,c){let h=new FormData;for(let[a,b]of Object.entries(c))h.set(a,b);h.set("file",b,b.name);let i=await fetch(`${d()}${a}`,e({method:"POST",body:h}));if(!i.ok)throw await g(i);let j=await f(i);return j?.data??j}async function n(a,b,c=!1){let h=new FormData;h.set("file",b,b.name);let i=await fetch(`${d()}/admin/contents/${a}/file${c?"?keepName=true":""}`,e({method:"PUT",body:h}));if(!i.ok)throw await g(i);let j=await f(i);return j?.data??j}a.s(["apiDelete",0,k,"apiGet",0,h,"apiPost",0,j,"apiPut",0,i,"apiReplacePdf",0,n,"apiUploadPdf",0,m,"getApiBaseUrl",0,c,"validateAdminKey",0,l])},6087,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(94195);a.s(["default",0,function(){let[a,f]=(0,d.useState)([]),[g,h]=(0,d.useState)(!0),[i,j]=(0,d.useState)(null);async function k(){h(!0),j(null);try{let a=await (0,e.apiGet)("/admin/council");f(a??[])}catch(a){j(a?.message??String(a))}finally{h(!1)}}return(0,d.useEffect)(()=>{k()},[]),(0,b.jsxs)("div",{className:"space-y-5",children:[(0,b.jsxs)("div",{className:"flex items-start gap-4",children:[(0,b.jsx)("div",{className:"flex-1",children:(0,b.jsx)("div",{className:"text-xl font-semibold",children:"Council"})}),(0,b.jsx)("button",{onClick:()=>void k(),className:"px-3 py-2 rounded-lg border border-zinc-800 hover:border-zinc-700 text-sm",children:"Refresh"})]}),(0,b.jsx)("div",{className:"flex gap-2",children:(0,b.jsx)(c.default,{href:"/admin/council/new",className:"px-4 py-2 rounded-xl bg-[#D4AF37] text-zinc-950 font-semibold text-sm",children:"Add Member"})}),g?(0,b.jsx)("div",{className:"py-10 text-center text-zinc-300 text-sm",children:"Loading…"}):0===a.length?(0,b.jsx)("div",{className:"py-10 text-center text-zinc-300 text-sm",children:"No council members"}):(0,b.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,b.jsxs)("div",{className:"rounded-2xl border border-zinc-800 bg-black/40 p-4 flex items-start gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"font-semibold truncate",children:String(a.name??"")}),(0,b.jsxs)("div",{className:"text-sm text-zinc-400 truncate",children:[String(a.designation??""),!1===a.isPublished?" • Draft":""]})]}),(0,b.jsx)(c.default,{href:`/admin/council/${a._id}`,className:"px-3 py-2 rounded-lg border border-zinc-800 hover:border-zinc-700 text-sm",children:"Edit"}),(0,b.jsx)("button",{className:"px-3 py-2 rounded-lg border border-red-900/60 text-red-200 hover:border-red-800 text-sm",onClick:async()=>{if(confirm("Delete member?"))try{await (0,e.apiDelete)(`/admin/council/${a._id}`),await k()}catch(a){j(a?.message??String(a))}},children:"Delete"})]},String(a._id)))}),i?(0,b.jsx)("div",{className:"text-sm text-red-300",children:i}):null]})}])}];

//# sourceMappingURL=src_0og18c4._.js.map