(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4063],{90726:function(e,t,a){Promise.resolve().then(a.bind(a,27806))},46578:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},37841:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},6339:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]])},69475:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},18994:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},77731:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},70094:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},28670:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},50489:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},52235:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a(87461).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},27806:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return E}});var s=a(3827),r=a(64090),i=a(71774),l=a(89966),n=a(8792),d=a(46578),o=a(69475),c=a(6339),x=a(37841),h=a(87461);/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let m=(0,h.Z)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var u=a(28670),g=a(70094),p=a(18994),b=a(77731),y=a(50489),f=a(52235);/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let v=(0,h.Z)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 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"}]]);var j=a(22169);function w(e,t){return t?e.ar:e.en}let N=[{name:"Indigo",value:"indigo"},{name:"Purple",value:"purple"},{name:"Blue",value:"blue"},{name:"Violet",value:"violet"},{name:"Pink",value:"pink"},{name:"Cyan",value:"cyan"},{name:"Emerald",value:"emerald"}],k={indigo:"bg-indigo-500",purple:"bg-purple-500",blue:"bg-blue-500",violet:"bg-violet-500",pink:"bg-pink-500",cyan:"bg-cyan-500",emerald:"bg-emerald-500"},C={indigo:"bg-indigo-500/10 text-indigo-400",purple:"bg-purple-500/10 text-purple-400",blue:"bg-blue-500/10 text-blue-400",violet:"bg-violet-500/10 text-violet-400",pink:"bg-pink-500/10 text-pink-400",cyan:"bg-cyan-500/10 text-cyan-400",emerald:"bg-emerald-500/10 text-emerald-400"},Z={title:{en:"Blog Management",ar:"إدارة المدونة"},subtitle:{en:"Manage posts and categories",ar:"إدارة المقالات والتصنيفات"},newPost:{en:"New Post",ar:"مقال جديد"},posts:{en:"Posts",ar:"المقالات"},categories:{en:"Categories",ar:"التصنيفات"},totalPublished:{en:"Total Published",ar:"المنشورة"},drafts:{en:"Drafts",ar:"المسودات"},totalViews:{en:"Total Views",ar:"إجمالي المشاهدات"},categoriesCount:{en:"Categories",ar:"التصنيفات"},searchPlaceholder:{en:"Search posts...",ar:"بحث في المقالات..."},allStatuses:{en:"All",ar:"الكل"},published:{en:"Published",ar:"منشور"},draft:{en:"Draft",ar:"مسودة"},archived:{en:"Archived",ar:"مؤرشف"},postTitle:{en:"Title",ar:"العنوان"},category:{en:"Category",ar:"التصنيف"},status:{en:"Status",ar:"الحالة"},views:{en:"Views",ar:"المشاهدات"},date:{en:"Date",ar:"التاريخ"},actions:{en:"Actions",ar:"إجراءات"},noPosts:{en:"No posts found",ar:"لا توجد مقالات"},noCategories:{en:"No categories found",ar:"لا توجد تصنيفات"},addCategory:{en:"Add Category",ar:"إضافة تصنيف"},nameEn:{en:"Name (English)",ar:"الاسم (إنجليزي)"},nameAr:{en:"Name (Arabic)",ar:"الاسم (عربي)"},color:{en:"Color",ar:"اللون"},save:{en:"Save",ar:"حفظ"},cancel:{en:"Cancel",ar:"إلغاء"},edit:{en:"Edit",ar:"تعديل"},delete:{en:"Delete",ar:"حذف"},postCount:{en:"Posts",ar:"المقالات"},deleteConfirm:{en:"Are you sure you want to delete this post?",ar:"هل أنت متأكد من حذف هذا المقال؟"},deleteCatConfirm:{en:"Are you sure you want to delete this category?",ar:"هل أنت متأكد من حذف هذا التصنيف؟"},deleteCatBlocked:{en:"Cannot delete category with existing posts",ar:"لا يمكن حذف تصنيف يحتوي على مقالات"},uncategorized:{en:"Uncategorized",ar:"بدون تصنيف"}};function A(){let{lang:e}=(0,i.Z)(),t="ar"===e,[a,h]=(0,r.useState)("posts"),[A,E]=(0,r.useState)(""),[P,S]=(0,r.useState)("all"),[M,T]=(0,r.useState)(""),[D,H]=(0,r.useState)(!1),[V,L]=(0,r.useState)(""),[z,F]=(0,r.useState)(""),[q,I]=(0,r.useState)("indigo"),[B,_]=(0,r.useState)(null),[R,O]=(0,r.useState)(!1),{data:U=[],isLoading:J,mutate:W}=(0,l.ZP)("/api/admin/blog"),{data:X=[],isLoading:G,mutate:K}=(0,l.ZP)("/api/admin/blog/categories"),Q=U.filter(e=>"PUBLISHED"===e.status).length,Y=U.filter(e=>"DRAFT"===e.status).length,$=U.reduce((e,t)=>e+(t.viewsCount||0),0),ee=X.length,et=U.filter(e=>{let t=!A||e.titleEn.toLowerCase().includes(A.toLowerCase())||e.titleAr.includes(A),a="all"===P||e.status===P;return t&&a}),ea=e=>{T(e),setTimeout(()=>T(""),3e3)},es=async e=>{confirm(w(Z.deleteConfirm,t))&&(await fetch("/api/admin/blog?id=".concat(e),{method:"DELETE"})).ok&&(W(),ea(t?"تم حذف المقال":"Post deleted"))},er=e=>{e?(_(e.id),L(e.nameEn),F(e.nameAr),I(e.color)):(_(null),L(""),F(""),I("indigo")),H(!0)},ei=()=>{H(!1),_(null),L(""),F(""),I("indigo")},el=async()=>{if(V.trim()&&z.trim()){O(!0);try{let e={nameEn:V,nameAr:z,color:q},a=B?await fetch("/api/admin/blog/categories",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:B,...e})}):await fetch("/api/admin/blog/categories",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(a.ok)K(),ei(),ea(B?t?"تم تحديث التصنيف":"Category updated":t?"تم إضافة التصنيف":"Category added");else{let e=await a.json().catch(()=>null);alert((null==e?void 0:e.error)||"Failed")}}finally{O(!1)}}},en=async e=>{var a,s;if((null!==(s=null===(a=e._count)||void 0===a?void 0:a.posts)&&void 0!==s?s:0)>0){alert(w(Z.deleteCatBlocked,t));return}confirm(w(Z.deleteCatConfirm,t))&&(await fetch("/api/admin/blog/categories?id=".concat(e.id),{method:"DELETE"})).ok&&(K(),ea(t?"تم حذف التصنيف":"Category deleted"))},ed=e=>({PUBLISHED:"bg-green-500/10 text-green-400",DRAFT:"bg-yellow-500/10 text-yellow-400",ARCHIVED:"bg-white/[0.05] text-gray-400"})[e]||"bg-white/[0.05] text-gray-400",eo=e=>w({PUBLISHED:Z.published,DRAFT:Z.draft,ARCHIVED:Z.archived}[e]||{en:e,ar:e},t),ec=[{key:"all",label:Z.allStatuses},{key:"PUBLISHED",label:Z.published},{key:"DRAFT",label:Z.draft},{key:"ARCHIVED",label:Z.archived}];return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white",children:w(Z.title,t)}),(0,s.jsx)("p",{className:"text-sm text-gray-400",children:w(Z.subtitle,t)})]}),M&&(0,s.jsxs)("div",{className:"mb-4 px-4 py-2.5 rounded-lg bg-green-500/10 border border-green-500/20 text-green-400 text-sm flex items-center gap-2",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4 shrink-0"}),M]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,s.jsx)("div",{className:"p-2 rounded-lg bg-green-500/10",children:(0,s.jsx)(o.Z,{className:"h-5 w-5 text-green-400"})})}),(0,s.jsx)("div",{className:"text-3xl font-bold text-white",children:Q}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:w(Z.totalPublished,t)})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,s.jsx)("div",{className:"p-2 rounded-lg bg-yellow-500/10",children:(0,s.jsx)(c.Z,{className:"h-5 w-5 text-yellow-400"})})}),(0,s.jsx)("div",{className:"text-3xl font-bold text-white",children:Y}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:w(Z.drafts,t)})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,s.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10",children:(0,s.jsx)(x.Z,{className:"h-5 w-5 text-blue-400"})})}),(0,s.jsx)("div",{className:"text-3xl font-bold text-white",children:$}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:w(Z.totalViews,t)})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,s.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10",children:(0,s.jsx)(m,{className:"h-5 w-5 text-purple-400"})})}),(0,s.jsx)("div",{className:"text-3xl font-bold text-white",children:ee}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:w(Z.categoriesCount,t)})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 mb-6",children:[(0,s.jsx)("button",{onClick:()=>h("posts"),className:"px-4 py-2 rounded-lg text-sm font-medium border transition-colors ".concat("posts"===a?"bg-indigo-500/10 text-indigo-400 border-indigo-500/30":"text-gray-400 border-transparent hover:text-white hover:bg-white/[0.06]"),children:w(Z.posts,t)}),(0,s.jsx)("button",{onClick:()=>h("categories"),className:"px-4 py-2 rounded-lg text-sm font-medium border transition-colors ".concat("categories"===a?"bg-indigo-500/10 text-indigo-400 border-indigo-500/30":"text-gray-400 border-transparent hover:text-white hover:bg-white/[0.06]"),children:w(Z.categories,t)})]}),"posts"===a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-6",children:[(0,s.jsxs)("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[(0,s.jsx)(u.Z,{className:"absolute ".concat(t?"right-3":"left-3"," top-1/2 -translate-y-1/2 h-4 w-4 text-gray-500")}),(0,s.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:w(Z.searchPlaceholder,t),className:"w-full ".concat(t?"pr-10 pl-4":"pl-10 pr-4"," py-2 border rounded-lg text-sm bg-white/[0.03] border-white/[0.08] text-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/30")})]}),(0,s.jsx)("select",{value:P,onChange:e=>S(e.target.value),className:"px-3 py-2 border rounded-lg text-sm bg-[#12121f] border-white/[0.1] text-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/30",children:ec.map(e=>(0,s.jsx)("option",{value:e.key,children:w(e.label,t)},e.key))}),(0,s.jsxs)(n.default,{href:"/admin/blog/new",className:"flex items-center gap-2 px-4 py-2 bg-indigo-500 text-white rounded-lg text-sm font-medium hover:bg-indigo-400 transition-colors",children:[(0,s.jsx)(g.Z,{className:"h-4 w-4"}),w(Z.newPost,t)]})]}),J||G?(0,s.jsx)("div",{className:"flex justify-center py-12",children:(0,s.jsx)(p.Z,{className:"h-8 w-8 animate-spin text-gray-500"})}):0===et.length?(0,s.jsx)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] overflow-hidden",children:(0,s.jsx)("div",{className:"text-center py-12 text-gray-500",children:w(Z.noPosts,t)})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"hidden md:block rounded-2xl border border-white/[0.06] bg-white/[0.03] overflow-hidden",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-sm min-w-[900px]",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-white/[0.03] text-gray-400 ".concat(t?"text-right":"text-left"),children:[(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.postTitle,t)}),(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.category,t)}),(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.status,t)}),(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.views,t)}),(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.date,t)}),(0,s.jsx)("th",{className:"py-3 px-4 font-medium",children:w(Z.actions,t)})]})}),(0,s.jsx)("tbody",{children:et.map(e=>(0,s.jsxs)("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.02] transition-colors",children:[(0,s.jsxs)("td",{className:"py-3 px-4",children:[(0,s.jsx)("div",{className:"text-white font-medium",children:t?e.titleAr:e.titleEn}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e.slug})]}),(0,s.jsx)("td",{className:"py-3 px-4",children:e.category?(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(C[e.category.color]||"bg-white/[0.05] text-gray-400"),children:t?e.category.nameAr:e.category.nameEn}):(0,s.jsx)("span",{className:"text-gray-500 text-xs",children:w(Z.uncategorized,t)})}),(0,s.jsx)("td",{className:"py-3 px-4",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(ed(e.status)),children:eo(e.status)})}),(0,s.jsx)("td",{className:"py-3 px-4 text-gray-400",children:e.viewsCount}),(0,s.jsx)("td",{className:"py-3 px-4 text-gray-400 text-xs",children:(0,j.p)(e.publishedAt||e.createdAt)}),(0,s.jsx)("td",{className:"py-3 px-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.default,{href:"/admin/blog/".concat(e.id,"/edit"),className:"p-1.5 rounded-lg text-gray-400 hover:text-white hover:bg-white/[0.06] transition-colors",title:w(Z.edit,t),children:(0,s.jsx)(b.Z,{className:"h-4 w-4"})}),(0,s.jsx)("button",{onClick:()=>es(e.id),className:"p-1.5 rounded-lg text-gray-400 hover:text-red-400 hover:bg-red-500/[0.06] transition-colors",title:w(Z.delete,t),children:(0,s.jsx)(y.Z,{className:"h-4 w-4"})})]})})]},e.id))})]})})}),(0,s.jsx)("div",{className:"md:hidden flex flex-col gap-3",children:et.map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.03] p-4",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,s.jsx)("div",{className:"text-white font-medium text-sm",children:t?e.titleAr:e.titleEn}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium shrink-0 ".concat(ed(e.status)),children:eo(e.status)})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-400 mb-3",children:[e.category&&(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full font-medium ".concat(C[e.category.color]||"bg-white/[0.05] text-gray-400"),children:t?e.category.nameAr:e.category.nameEn}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(x.Z,{className:"h-3 w-3"})," ",e.viewsCount]}),(0,s.jsx)("span",{children:(0,j.p)(e.publishedAt||e.createdAt)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.default,{href:"/admin/blog/".concat(e.id,"/edit"),className:"flex-1 text-center px-3 py-1.5 rounded-lg text-xs font-medium text-gray-300 bg-white/[0.06] hover:bg-white/[0.1] transition-colors",children:w(Z.edit,t)}),(0,s.jsx)("button",{onClick:()=>es(e.id),className:"px-3 py-1.5 rounded-lg text-xs font-medium text-red-400 bg-red-500/[0.06] hover:bg-red-500/[0.1] transition-colors",children:w(Z.delete,t)})]})]},e.id))})]})]}),"categories"===a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-6",children:D?(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h3",{className:"text-white font-medium text-sm",children:B?w(Z.edit,t):w(Z.addCategory,t)}),(0,s.jsx)("button",{onClick:ei,className:"text-gray-400 hover:text-white",children:(0,s.jsx)(f.Z,{className:"h-4 w-4"})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-400 mb-1",children:w(Z.nameEn,t)}),(0,s.jsx)("input",{type:"text",value:V,onChange:e=>L(e.target.value),className:"w-full px-3 py-2 border rounded-lg text-sm bg-white/[0.03] border-white/[0.08] text-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/30",placeholder:"Technology"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-400 mb-1",children:w(Z.nameAr,t)}),(0,s.jsx)("input",{type:"text",value:z,onChange:e=>F(e.target.value),className:"w-full px-3 py-2 border rounded-lg text-sm bg-white/[0.03] border-white/[0.08] text-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/30",placeholder:"تقنية",dir:"rtl"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-400 mb-1",children:w(Z.color,t)}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:N.map(e=>(0,s.jsx)("button",{onClick:()=>I(e.value),className:"w-7 h-7 rounded-full ".concat(k[e.value]," transition-all ").concat(q===e.value?"ring-2 ring-white ring-offset-2 ring-offset-[#0a0a0f] scale-110":"opacity-60 hover:opacity-100"),title:e.name},e.value))})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 mt-4",children:[(0,s.jsxs)("button",{onClick:el,disabled:R||!V.trim()||!z.trim(),className:"flex items-center gap-2 px-4 py-2 bg-indigo-500 text-white rounded-lg text-sm font-medium hover:bg-indigo-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[R&&(0,s.jsx)(p.Z,{className:"h-4 w-4 animate-spin"}),w(Z.save,t)]}),(0,s.jsx)("button",{onClick:ei,className:"px-4 py-2 rounded-lg text-sm font-medium text-gray-400 hover:text-white hover:bg-white/[0.06] transition-colors",children:w(Z.cancel,t)})]})]}):(0,s.jsxs)("button",{onClick:()=>er(),className:"flex items-center gap-2 px-4 py-2 bg-indigo-500 text-white rounded-lg text-sm font-medium hover:bg-indigo-400 transition-colors",children:[(0,s.jsx)(g.Z,{className:"h-4 w-4"}),w(Z.addCategory,t)]})}),G?(0,s.jsx)("div",{className:"flex justify-center py-12",children:(0,s.jsx)(p.Z,{className:"h-8 w-8 animate-spin text-gray-500"})}):0===X.length?(0,s.jsx)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] overflow-hidden",children:(0,s.jsx)("div",{className:"text-center py-12 text-gray-500",children:w(Z.noCategories,t)})}):(0,s.jsx)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] overflow-hidden divide-y divide-white/[0.04]",children:X.map(e=>{var a,r;return(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 hover:bg-white/[0.02] transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full ".concat(k[e.color]||"bg-gray-500")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-white text-sm font-medium",children:t?e.nameAr:e.nameEn}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:t?e.nameEn:e.nameAr})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[(0,s.jsx)(v,{className:"h-3 w-3"}),null!==(r=null===(a=e._count)||void 0===a?void 0:a.posts)&&void 0!==r?r:0," ",w(Z.postCount,t)]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:()=>er(e),className:"p-1.5 rounded-lg text-gray-400 hover:text-white hover:bg-white/[0.06] transition-colors",title:w(Z.edit,t),children:(0,s.jsx)(b.Z,{className:"h-4 w-4"})}),(0,s.jsx)("button",{onClick:()=>en(e),className:"p-1.5 rounded-lg text-gray-400 hover:text-red-400 hover:bg-red-500/[0.06] transition-colors",title:w(Z.delete,t),children:(0,s.jsx)(y.Z,{className:"h-4 w-4"})})]})]})]},e.id)})})]})]})}function E(){return(0,s.jsx)(A,{})}},22169:function(e,t,a){"use strict";a.d(t,{cn:function(){return i},p:function(){return l}});var s=a(75504),r=a(51367);function i(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,r.m6)((0,s.W)(t))}function l(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e))}}},function(e){e.O(0,[9966,2807,2150,1774,2971,8069,1744],function(){return e(e.s=90726)}),_N_E=e.O()}]);