PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/blog/[id]-5300105d45a49ad4.js

js lidomatrip.com collected 2026-10-02 20:25:38 UTC 29,891 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2701],{10239:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/blog/[id]",function(){return a(33475)}])},92161:function(e,t,a){"use strict";a.d(t,{Y:function(){return c},Z:function(){return u}});var l=a(85893),r=a(67294),n=a(44389),s=a(84858),i=a(32474);let d=e=>(0,s.Px)(e),o=e=>e?e>1048576?`${(0,i.N)(Math.round(e/1024/102.4)/10)} مگابایت`:`${(0,i.N)(Math.round(e/1024))} کیلوبایت`:"";function c(e){let{onPick:t,requireAlt:a=!0,confirmLabel:c="انتخاب",active:u=!0}=e,[x,m]=(0,r.useState)(""),[g,h]=(0,r.useState)(null),[p,b]=(0,r.useState)(""),[f,j]=(0,r.useState)(!1),[y,v]=(0,r.useState)(null),N=(0,r.useRef)(null),{data:C,isLoading:E,mutate:I}=(0,n.u)(u?`/api/admin/blog/media?q=${encodeURIComponent(x)}&pageSize=36`:null,d),w=(null==C?void 0:C.items)??[],D=e=>{h(e),b(e.alt??""),v(null)},S=(0,r.useCallback)(async e=>{if(null==e?void 0:e.length){j(!0),v(null);try{let t=null;for(let a of Array.from(e)){let e=new FormData;e.append("image",a),t=await (0,s.SC)("/api/admin/blog/media",{method:"POST",body:e})}await I(),t&&D(t)}catch(e){v((null==e?void 0:e.message)??"آپلود نشد.")}finally{j(!1),N.current&&(N.current.value="")}}},[I]);async function A(){if(g){if(a&&!p.trim()){v("متن جایگزین لازم است — بدون آن انتشار رد می‌شود.");return}if((g.alt??"")!==p.trim())try{await (0,s.SC)(`/api/admin/blog/media/${g.id}`,{method:"PATCH",body:JSON.stringify({alt:p.trim()||null})}),I()}catch{}t({url:g.url,alt:p.trim()})}}async function k(e){window.confirm(`\xab${e.title||e.url}\xbb از کتابخانه برداشته شود؟ فایل پاک نمی‌شود.`)&&(await (0,s.SC)(`/api/admin/blog/media/${e.id}`,{method:"DELETE"}),(null==g?void 0:g.id)===e.id&&h(null),I())}return(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-8",children:[(0,l.jsx)(i.II,{value:x,onChange:e=>m(e.target.value),placeholder:"جستجو در نام یا توضیح فایل",className:"min-w-0 flex-1"}),(0,l.jsx)("input",{ref:N,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:e=>S(e.target.files)}),(0,l.jsx)(i.zx,{onClick:()=>{var e;return null===(e=N.current)||void 0===e?void 0:e.click()},disabled:f,children:f?"در حال آپلود…":"آپلود تصویر"})]}),y&&(0,l.jsx)("div",{className:"rounded-10 border border-red-200 bg-red-50 px-12 py-8 text-12 leading-22 text-red-700",children:y}),(0,l.jsx)("div",{className:"max-h-[46vh] overflow-y-auto rounded-12 border border-gray-E5E5E6 p-8",onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),S(e.dataTransfer.files)},children:E?(0,l.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:Array.from({length:12}).map((e,t)=>(0,l.jsx)("div",{className:"aspect-square animate-pulse rounded-10 bg-gray-F0F0F0"},t))}):0===w.length?(0,l.jsx)("p",{className:"py-40 text-center text-14 text-gray-9B9BAA",children:"چیزی در کتابخانه نیست. فایل را همین‌جا رها کنید یا \xabآپلود تصویر\xbb را بزنید."}):(0,l.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:w.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>D(e),className:`group relative aspect-square overflow-hidden rounded-10 border-2 transition ${(null==g?void 0:g.id)===e.id?"border-primary-main":"border-transparent hover:border-gray-D2D2D7"}`,title:e.title??e.url,children:[(0,l.jsx)("img",{src:(0,i.vD)(e.url,240),alt:e.alt??"",loading:"lazy",className:"h-full w-full object-cover"}),!e.alt&&(0,l.jsx)("span",{className:"absolute bottom-0 right-0 left-0 bg-amber-400 py-2 text-10 text-amber-900",children:"بدون توضیح"})]},e.id))})}),g&&(0,l.jsxs)("div",{className:"flex flex-col gap-12 rounded-12 border border-gray-E5E5E6 p-12 md:flex-row md:items-start",children:[(0,l.jsx)("img",{src:(0,i.vD)(g.url,320),alt:"",className:"h-96 w-128 shrink-0 rounded-10 object-cover"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("p",{className:"truncate text-14 font-m",children:g.title||"بدون نام"}),(0,l.jsx)("p",{dir:"ltr",className:"truncate text-right text-11 text-gray-9B9BAA",children:g.url}),(0,l.jsx)("p",{className:"mt-2 text-11 text-gray-9B9BAA",children:o(g.sizeBytes)}),(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)(i.II,{value:p,onChange:e=>b(e.target.value),placeholder:"متن جایگزین — چه چیزی در تصویر است؟"})})]}),(0,l.jsxs)("div",{className:"flex shrink-0 gap-8",children:[(0,l.jsx)(i.zx,{onClick:A,children:c}),(0,l.jsx)(i.zx,{variant:"ghost",onClick:()=>k(g),children:"حذف"})]})]})]})}function u(e){let{open:t,onClose:a,onPick:r,requireAlt:n=!0,title:s="کتابخانه‌ی رسانه"}=e;return(0,l.jsx)(i.u_,{open:t,onClose:a,title:s,width:"max-w-[900px]",children:(0,l.jsx)(c,{active:t,requireAlt:n,onPick:e=>{r(e),a()}})})}},2251:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var l=a(85893),r=a(41664),n=a.n(r),s=a(11163),i=a(44389),d=a(84858);let o=[{href:"/admin/blog",label:"مقاله‌ها",exact:!0},{href:"/admin/blog/taxonomy",label:"دسته، برچسب، نویسنده"},{href:"/admin/blog/comments",label:"نظرها",badge:"comments"},{href:"/admin/blog/media",label:"رسانه"},{href:"/admin/blog/settings",label:"هدر و فوتر"}];function c(){var e;let t=(0,s.useRouter)(),{data:a}=(0,i.u)("/api/admin/blog/comments?pageSize=1",e=>(0,d.Px)(e)),r=(null===(e=null==a?void 0:a.meta)||void 0===e?void 0:e.pending)??0;return(0,l.jsx)("nav",{className:"mb-16 flex flex-wrap items-center gap-8","aria-label":"بخش‌های مجله",children:o.map(e=>{let a=e.exact?t.pathname===e.href:t.pathname.startsWith(e.href);return(0,l.jsxs)(n(),{href:e.href,className:`inline-flex items-center gap-6 rounded-100 px-14 py-8 text-13 transition ${a?"bg-primary-main text-white":"bg-white text-gray-6C6A7D hover:bg-gray-F0F0F0"}`,children:[e.label,"comments"===e.badge&&r>0&&(0,l.jsx)("span",{className:`inline-flex h-18 min-w-18 items-center justify-center rounded-100 px-4 text-10 ${a?"bg-white text-primary-dark":"bg-red-500 text-white"}
1`,children:r.toLocaleString("fa-IR")})]},e.href)})})}},33475:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return U}});var l=a(85893),r=a(67294),n=a(11163),s=a(5152),i=a.n(s),d=a(44389),o=a(49759),c=a(2251),u=a(92161),x=a(68289),m=a.n(x);let g=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],h=["Ø´","ی","د","س","چ","Ù¾","ج"],p=e=>e.toLocaleString("fa-IR",{useGrouping:!1}),b=e=>String(e).padStart(2,"0");function f(e){let{value:t,onChange:a,minNow:n=!0}=e,s=t?m()(t):m()().add(1,"hour").startOf("hour"),[i,d]=(0,r.useState)(()=>s.clone().startOf("jMonth")),[o,c]=(0,r.useState)(()=>s.clone()),[u,x]=(0,r.useState)(()=>`${b(s.hour())}:${b(s.minute())}`);(0,r.useEffect)(()=>{if(!t)return;let e=m()(t);e.isValid()&&(c(e.clone()),d(e.clone().startOf("jMonth")),x(`${b(e.hour())}:${b(e.minute())}`))},[t]);let f=(e,t)=>{let[l,r]=t.split(":").map(e=>Number(e)||0),n=e.clone().hour(l).minute(r).second(0).millisecond(0);a(n.toISOString())},j=(0,r.useMemo)(()=>{let e=i.clone().startOf("jMonth"),t=m().jDaysInMonth(e.jYear(),e.jMonth()),a=(e.day()+1)%7,l=Array.from({length:a},()=>null);for(let a=1;a<=t;a++)l.push(e.clone().jDate(a));return l},[i]),y=m()().startOf("day"),v=(e,t)=>e.jYear()===t.jYear()&&e.jMonth()===t.jMonth()&&e.jDate()===t.jDate();return(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-12",children:[(0,l.jsxs)("div",{className:"mb-10 flex items-center justify-between",children:[(0,l.jsx)("button",{type:"button","aria-label":"ماه بعد",onClick:()=>d(e=>e.clone().add(1,"jMonth")),className:"h-28 w-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"‹"}),(0,l.jsxs)("span",{className:"text-14 font-m",children:[g[i.jMonth()]," ",p(i.jYear())]}),(0,l.jsx)("button",{type:"button","aria-label":"ماه قبل",onClick:()=>d(e=>e.clone().subtract(1,"jMonth")),className:"h-28 w-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"›"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-7 gap-2 text-center",children:[h.map(e=>(0,l.jsx)("span",{className:"py-2 text-11 text-gray-6C6A7D",children:e},e)),j.map((e,t)=>{if(!e)return(0,l.jsx)("span",{},`e${t}`);let a=n&&e.isBefore(y,"day"),r=v(e,o);return(0,l.jsx)("button",{type:"button",disabled:a,onClick:()=>{c(e),f(e,u)},className:`h-30 rounded-8 text-13 transition ${r?"bg-primary-main text-white":a?"text-gray-C4CAD3 cursor-not-allowed":"hover:bg-gray-F0F0F0"} ${v(e,y)&&!r?"border border-primary-main":""}`,children:p(e.jDate())},e.format("jYYYY-jMM-jDD"))})]}),(0,l.jsxs)("div",{className:"mt-12 flex items-center gap-8 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)("span",{className:"text-13 text-gray-6C6A7D",children:"ساعت"}),(0,l.jsx)("input",{type:"time",dir:"ltr",value:u,onChange:e=>{x(e.target.value),f(o,e.target.value)},className:"rounded-10 border border-gray-E5E5E6 px-10 py-6 text-14 outline-none focus:border-primary-main"}),(0,l.jsx)("span",{className:"mr-auto text-12 text-gray-6C6A7D",children:t?`${p(o.jDate())} ${g[o.jMonth()]} ${p(o.jYear())}، ساعت ${u}`:"هنوز زمانی انتخاب نشده"})]})]})}var j=a(32474);let y={metaTitle:"",metaDescription:"",canonicalUrl:"",ogTitle:"",ogDescription:"",ogImageUrl:"",twitterCard:"",isIndexable:!0,isFollowable:!0},v="https://lidomatrip.com",N=[30,60],C=[80,158];function E(e){let{value:t,range:a,labelShort:r,labelLong:n}=e,[s,i]=a,d=0===t?"empty":t<s?"short":t>i?"long":"ok";return(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("div",{className:"h-4 w-full overflow-hidden rounded-8 bg-gray-F0F0F0",children:(0,l.jsx)("div",{className:`h-full ${"ok"===d?"bg-primary-main":"long"===d?"bg-red-500":"bg-amber-400"} transition-all`,style:{width:`${Math.min(100,Math.round(t/i*100))}%`}})}),(0,l.jsxs)("p",{className:"mt-4 text-11 text-gray-6C6A7D",children:[t.toLocaleString("fa-IR")," کاراکتر","short"===d&&` — ${r}`,"long"===d&&` — ${n}`,"ok"===d&&" — اندازه‌اش خوب است"]})]})}function I(e){let{value:t,onChange:a,postTitle:n,postExcerpt:s,postSlug:i,featuredImageUrl:d}=e,o=(e,l)=>a({...t,[e]:l}),c=(0,r.useMemo)(()=>({title:t.metaTitle.trim()||n||"بدون عنوان",description:t.metaDescription.trim()||s||"",url:t.canonicalUrl.trim()||`${v}/blog/${i||"…"}/`}),[t,n,s,i]);return(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 bg-gray-FAFAFF p-16",children:[(0,l.jsx)("p",{className:"mb-10 text-12 text-gray-6C6A7D",children:"این‌طور در نتایج گوگل دیده می‌شود"}),(0,l.jsxs)("div",{dir:"rtl",className:"rounded-10 bg-white p-14",children:[(0,l.jsx)("p",{dir:"ltr",className:"truncate text-right text-12 text-[#5f6368]",children:c.url}),(0,l.jsx)("p",{className:"mt-2 text-18 leading-28 text-[#1a0dab]",children:c.title}),(0,l.jsx)("p",{className:"mt-2 text-13 leading-24 text-[#4d5156]",children:c.description||(0,l.jsx)("span",{className:"text-gray-C4CAD3",children:"توضیحی نیست — گوگل خودش تکه‌ای از متن را برمی‌دارد، که معمولاً بدترین تکه است."})})]}),!t.isIndexable&&(0,l.jsxs)("p",{className:"mt-10 rounded-8 bg-amber-50 px-10 py-6 text-11 leading-20 text-amber-800",children:["این مقاله ",(0,l.jsx)("b",{children:"noindex"})," است، پس در عمل هیچ‌وقت این‌طور دیده نمی‌شود."]})]}),(0,l.jsxs)(j.gN,{label:"عنوان سئو",hint:"خالی بگذارید تا عنوان خودِ مقاله برود.",children:[(0,l.jsx)(j.II,{value:t.metaTitle,onChange:e=>o("metaTitle",e.target.value),placeholder:n||"عنوان مقاله"}),(0,l.jsx)(E,{value:t.metaTitle.trim().length||(n??"").length,range:N,labelShort:"کوتاه است؛ جای بیشتری Ù
1‡Ø³Øª",labelLong:"گوگل احتمالاً آخرش را می‌برد"})]}),(0,l.jsxs)(j.gN,{label:"توضیح متا",hint:"خالی بگذارید تا چکیده‌ی مقاله برود.",children:[(0,l.jsx)("textarea",{value:t.metaDescription,onChange:e=>o("metaDescription",e.target.value),placeholder:s||"یک یا دو جمله که می‌گوید این مقاله چه جوابی می‌دهد.",rows:3,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"}),(0,l.jsx)(E,{value:t.metaDescription.trim().length||(s??"").length,range:C,labelShort:"کوتاه است؛ جای بیشتری هست",labelLong:"گوگل احتمالاً آخرش را می‌برد"})]}),(0,l.jsx)(j.gN,{label:"آدرس کاننیکال",hint:"فقط وقتی این مقاله نسخه‌ی تکراری چیز دیگری است. خالی یعنی خودش.",children:(0,l.jsx)(j.II,{dir:"ltr",value:t.canonicalUrl,onChange:e=>o("canonicalUrl",e.target.value),placeholder:`${v}/blog/${i||"…"}/`})}),(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-16",children:[(0,l.jsx)("p",{className:"mb-12 text-14 font-m",children:"وقتی لینک در شبکه‌های اجتماعی فرستاده می‌شود"}),(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsx)(j.gN,{label:"عنوان اشتراک‌گذاری",children:(0,l.jsx)(j.II,{value:t.ogTitle,onChange:e=>o("ogTitle",e.target.value),placeholder:c.title})}),(0,l.jsx)(j.gN,{label:"توضیح اشتراک‌گذاری",children:(0,l.jsx)(j.II,{value:t.ogDescription,onChange:e=>o("ogDescription",e.target.value),placeholder:c.description||"همان توضیح متا"})}),(0,l.jsx)(j.gN,{label:"تصویر اشتراک‌گذاری",hint:"خالی یعنی تصویر شاخص. نسبت Û±Ù«Û¹Û± به Û± بهترین نتیجه را می‌دهد.",children:(0,l.jsx)(j.II,{dir:"ltr",value:t.ogImageUrl,onChange:e=>o("ogImageUrl",e.target.value),placeholder:d||"https://…"})})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 rounded-12 border border-gray-E5E5E6 p-16",children:[(0,l.jsx)("p",{className:"text-14 font-m",children:"خزنده‌ها"}),(0,l.jsx)(j.ZD,{checked:t.isIndexable,onChange:e=>o("isIndexable",e),label:"در نتایج جست‌وجو نشان داده شود"}),(0,l.jsx)(j.ZD,{checked:t.isFollowable,onChange:e=>o("isFollowable",e),label:"لینک‌های داخل مقاله دنبال شوند"}),(0,l.jsx)("p",{className:"text-11 leading-20 text-gray-6C6A7D",children:"هر دو پیش‌فرض روشن‌اند. خاموش‌کردن اولی مقاله را از گوگل برمی‌دارد — کاری که برگشتش هفته‌ها طول می‌کشد."})]})]})}var w=a(84858);let D=i()(()=>Promise.all([a.e(6911),a.e(1509),a.e(7877),a.e(1342)]).then(a.bind(a,81342)),{loadableGenerated:{webpack:()=>[81342]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"min-h-[380px] animate-pulse rounded-16 bg-gray-F0F0F0"})}),S={DRAFT:"پیش‌نویس",PENDING_REVIEW:"در انتظار بازبینی",SCHEDULED:"زمان‌بندی‌شده",PUBLISHED:"منتشر شده",ARCHIVED:"بایگانی"},A={DRAFT:"bg-gray-F0F0F0 text-gray-6C6A7D",PENDING_REVIEW:"bg-amber-100 text-amber-800",SCHEDULED:"bg-blue-100 text-blue-800",PUBLISHED:"bg-primary-light text-[#046d62]",ARCHIVED:"bg-gray-F0F0F0 text-gray-9B9BAA"},k=e=>(0,w.SC)(e);function F(e){let{options:t,value:a,onChange:r,empty:n}=e;return t.length?(0,l.jsx)("div",{className:"flex flex-wrap gap-6",children:t.map(e=>{let t=a.includes(e.id);return(0,l.jsx)("button",{type:"button",onClick:()=>r(t?a.filter(t=>t!==e.id):[...a,e.id]),className:`rounded-100 px-12 py-6 text-12 transition ${t?"bg-primary-main text-white":"bg-gray-F0F0F0 text-gray-6C6A7D hover:bg-gray-E5E5E6"}`,children:e.label},e.id)})}):(0,l.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:n})}function $(e){let{value:t,onChange:a}=e,[n,s]=(0,r.useState)(""),{data:i}=(0,d.u)(n.trim().length>=2?`/api/admin/blog/pick/locations?q=${encodeURIComponent(n.trim())}`:null,k),o=e=>{t.some(t=>t.id===e.id)||(a([...t,{id:e.id,name:e.name,type:e.type}]),s(""))};return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[t.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-6",children:t.map((e,r)=>(0,l.jsxs)("span",{className:"inline-flex items-center gap-6 rounded-100 bg-primary-light px-12 py-6 text-12 text-[#046d62]",children:[0===r&&(0,l.jsx)("b",{className:"text-10",children:"اصلی"}),e.name,(0,l.jsx)("span",{className:"text-10 text-gray-6C6A7D",children:"PROVINCE"===e.type?"استان":"شهر"}),(0,l.jsx)("button",{type:"button","aria-label":"حذف",onClick:()=>a(t.filter(t=>t.id!==e.id)),className:"text-gray-6C6A7D",children:"✕"})]},e.id))}),(0,l.jsx)(j.II,{value:n,onChange:e=>s(e.target.value),placeholder:"نام شهر یا استان…"}),(i??[]).length>0&&(0,l.jsx)("div",{className:"max-h-[180px] overflow-y-auto rounded-10 border border-gray-E5E5E6",children:(i??[]).map(e=>{var t;return(0,l.jsxs)("button",{type:"button",onClick:()=>o(e),className:"flex w-full items-center justify-between px-12 py-8 text-12 transition hover:bg-gray-F8F8F8",children:[(0,l.jsx)("span",{children:e.name}),(0,l.jsx)("span",{className:"text-10 text-gray-9B9BAA",children:"PROVINCE"===e.type?"استان":(null===(t=e.parent)||void 0===t?void 0:t.name)??"شهر"})]},e.id)})})]})}function U(){let e=(0,n.useRouter)(),t=e.query.id,a="new"===t,s=a?null:Number(t),i=(0,d.u)(s?`/api/admin/blog/posts/${s}`:null,k),x=(0,d.u)("/api/admin/blog/authors",k),m=(0,d.u)("/api/admin/blog/categories",k),g=(0,d.u)("/api/admin/blog/tags",k),[h,p]=(0,r.useState)("content"),[b,v]=(0,r.useState)({title:"",slug:"",excerpt:"",authorIds:[],tagIds:[]}),[N,C]=(0,r.useState)(null),[E,U]=(0,r.useState)(y),[T,B]=(0,r.useState)([]),[O,R]=(0,r.useState)([]),[L,M]=(0,r.useState)("DRAFT"),[_,z]=(0,r.useState)(""),[H,q]=(0,r.useState)(!1),[Y,V]=(0,r.useState)(!1),[Z,J]=(0,r.useState)(null),[G,W]=(0,r.useState)(null),[X,Q]=(0,r.useState)(null),[K,ee]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=i.data;e&&(v({title:e.title??"",slug:e.slug??"",excerpt:e.excerpt??"",categoryId:e.categoryId??"",featuredImageUrl:e.featuredImageUrl??"",featuredImageAlt:e.featuredImageAlt??"",authorIds:(e.authors??[]).map(e=>e.authorId),tagIds:(e.tags??[]).map(e=>e.tagId)}),C(e.contentJson??null),M(e.status??"DRAFT"),z(e.scheduledAt??""),B((e.faqs??[]).map(e=>({question:e.question,answer:e.answer}))),U({...y,...Object.fromEntries(Object.entries(e.seo??{}).filter(e=>{let[t]=e;return t in y}).map(e=>
1{let[t,a]=e;return[t,a??("boolean"==typeof y[t]||"")]}))}))},[i.data]),(0,r.useEffect)(()=>{var e;let t=((null===(e=i.data)||void 0===e?void 0:e.locations)??[]).map(e=>e.locationId);if(!t.length)return;let a=!1;return(0,w.SC)("/api/admin/blog/pick/locations").then(e=>{if(a)return;let l=e.filter(e=>t.includes(e.id));R(t.map(e=>l.find(t=>t.id===e)).filter(Boolean).map(e=>({id:e.id,name:e.name,type:e.type})))}).catch(()=>void 0),()=>{a=!0}},[i.data]);let et=(e,t)=>v(a=>({...a,[e]:t})),ea=(0,r.useMemo)(()=>{var e,t;return{title:b.title,slug:(null===(e=b.slug)||void 0===e?void 0:e.trim())||void 0,excerpt:b.excerpt||null,contentJson:N??void 0,categoryId:b.categoryId?Number(b.categoryId):null,featuredImageUrl:b.featuredImageUrl||null,featuredImageAlt:b.featuredImageAlt||null,authorIds:b.authorIds??[],tagIds:b.tagIds??[],locationIds:O.map(e=>e.id),primaryLocationId:(null===(t=O[0])||void 0===t?void 0:t.id)??null,faqs:T,seo:E}},[b,N,O,T,E]);async function el(){ee(!0),W(null),Q(null);try{if(a){let t=await (0,w.SC)("/api/admin/blog/posts",{method:"POST",body:JSON.stringify(ea)});return e.replace(`/admin/blog/${t.id}`),Q("ذخیره شد."),t.id}return await (0,w.SC)(`/api/admin/blog/posts/${s}`,{method:"PATCH",body:JSON.stringify(ea)}),await i.mutate(),Q("ذخیره شد."),s}catch(e){return W((null==e?void 0:e.message)??"ذخیره نشد."),null}finally{ee(!1)}}async function er(e){if(a){W("اول مقاله را ذخیره کنید.");return}ee(!0),W(null),Q(null);try{await (0,w.SC)(`/api/admin/blog/posts/${s}/status`,{method:"POST",body:JSON.stringify({status:e,scheduledAt:"SCHEDULED"===e&&_||null})}),await i.mutate(),M(e),Q("PUBLISHED"===e?"منتشر شد.":"SCHEDULED"===e?"زمان‌بندی شد.":"وضعیت تغییر کرد.")}catch(e){W((null==e?void 0:e.message)??"تغییر وضعیت انجام نشد.")}finally{ee(!1)}}async function en(){let e=await el();if(e){ee(!0);try{let{token:t}=await (0,w.SC)(`/api/admin/blog/posts/${e}/preview-token`,{method:"POST"}),a=`/blog/preview/${t}`;J(a),window.open(a,"_blank","noopener")}catch(e){W((null==e?void 0:e.message)??"لینک پیش‌نمایش ساخته نشد.")}finally{ee(!1)}}}let es=!a&&i.isLoading,ei=[{key:"content",label:"محتوا"},{key:"seo",label:"سئو"},{key:"faq",label:`پرسش‌ها${T.length?` (${T.length.toLocaleString("fa-IR")})`:""}`},{key:"meta",label:"دسته و مقصد"}];return(0,l.jsxs)(o.Z,{title:a?"مقاله‌ی تازه":"ویرایش مقاله",children:[(0,l.jsx)(c.Z,{}),(0,l.jsxs)("div",{className:"flex flex-col gap-16 md:flex-row md:items-start",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(j.Zb,{className:"p-16 md:p-20",children:es?(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsx)(j.Od,{className:"h-40"}),(0,l.jsx)(j.Od,{className:"h-[380px]"})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)("input",{value:b.title??"",onChange:e=>et("title",e.target.value),placeholder:"عنوان مقاله",className:"w-full border-0 border-b border-gray-E5E5E6 pb-10 text-24 font-b leading-40 outline-none transition focus:border-primary-main"}),(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-8",children:ei.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>p(e.key),className:`rounded-100 px-14 py-8 text-13 transition ${h===e.key?"bg-black text-white":"bg-gray-F0F0F0 text-gray-6C6A7D hover:bg-gray-E5E5E6"}`,children:e.label},e.key))}),"content"===h&&(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)(j.gN,{label:"اسلاگ",hint:"خالی بگذارید تا از عنوان ساخته شود. فارسی بماند — آدرس‌های فعلی مجله فارسی‌اند.",children:(0,l.jsx)(j.II,{value:b.slug??"",onChange:e=>et("slug",e.target.value)})}),(0,l.jsx)(j.gN,{label:"چکیده",hint:"بالای مقاله و در کارت‌های فهرست دیده می‌شود. اگر توضیح متا خالی باشد، همین می‌رود.",children:(0,l.jsx)("textarea",{value:b.excerpt??"",onChange:e=>et("excerpt",e.target.value),rows:2,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-8 text-14 font-m",children:"متن مقاله"}),(0,l.jsx)(D,{value:N,onChange:C})]})]}
1),"seo"===h&&(0,l.jsx)(I,{value:E,onChange:U,postTitle:b.title??"",postExcerpt:b.excerpt??"",postSlug:b.slug??"",featuredImageUrl:b.featuredImageUrl??""}),"faq"===h&&(0,l.jsx)(P,{value:T,onChange:B}),"meta"===h&&(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)(j.gN,{label:"دسته‌بندی",children:(0,l.jsxs)(j.Ph,{className:"w-full",value:b.categoryId??"",onChange:e=>et("categoryId",e.target.value),children:[(0,l.jsx)("option",{value:"",children:"— بدون دسته‌بندی —"}),(m.data??[]).map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,l.jsx)(j.gN,{label:"مقصد مقاله",hint:"اسلایدر اقامتگاه‌های داخل مقاله از همین ساخته می‌شود. شهر باشد، اسلایدر بالا همان شهر و پایینی استانش را نشان می‌دهد؛ استان باشد، برعکس. اولین مورد، مقصد اصلی است.",children:(0,l.jsx)($,{value:O,onChange:R})}),(0,l.jsx)(j.gN,{label:"نویسنده‌ها",hint:"اولی در byline مقاله می‌آید.",children:(0,l.jsx)(F,{options:(x.data??[]).map(e=>({id:e.id,label:e.displayName})),value:b.authorIds??[],onChange:e=>et("authorIds",e),empty:"هنوز نویسنده‌ای ساخته نشده."})}),(0,l.jsx)(j.gN,{label:"برچسب‌ها",children:(0,l.jsx)(F,{options:(g.data??[]).map(e=>({id:e.id,label:e.name})),value:b.tagIds??[],onChange:e=>et("tagIds",e),empty:"هنوز برچسبی ساخته نشده."})})]})]})})}),(0,l.jsx)("aside",{className:"w-full shrink-0 md:sticky md:top-16 md:w-[330px]",children:(0,l.jsxs)(j.Zb,{className:"flex flex-col gap-14 p-16",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-14 font-b",children:"انتشار"}),(0,l.jsx)("span",{className:`rounded-100 px-10 py-4 text-11 ${A[L]??"bg-gray-F0F0F0 text-gray-6C6A7D"}`,children:S[L]??L})]}),G&&(0,l.jsx)("div",{className:"rounded-10 border border-red-200 bg-red-50 px-12 py-8 text-12 leading-22 text-red-700",children:G}),X&&(0,l.jsx)("div",{className:"rounded-10 border border-green-200 bg-green-50 px-12 py-8 text-12 text-green-700",children:X}),(0,l.jsx)(j.zx,{onClick:el,disabled:K,children:K?"در حال ذخیره…":"ذخیره"}),(0,l.jsx)(j.zx,{variant:"secondary",onClick:en,disabled:K,children:"پیش‌نمایش"}),Z&&(0,l.jsxs)("p",{className:"text-11 leading-20 text-gray-6C6A7D",children:["لینک پیش‌نمایش ساخته شد — بدون ورود باز می‌شود و در گوگل دیده نمی‌شود."," ",(0,l.jsx)("button",{type:"button",className:"text-primary-dark underline",onClick:()=>{var e;return null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText(window.location.origin+Z)},children:"کپی لینک"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)(j.zx,{onClick:()=>er("PUBLISHED"),disabled:K,children:"PUBLISHED"===L?"به‌روزرسانی انتشار":"انتشار"}),(0,l.jsx)("button",{type:"button",onClick:()=>q(e=>!e),className:"text-right text-12 text-gray-6C6A7D underline",children:H?"بستن زمان‌بندی":"به‌جای انتشار فوری، زمان‌بندی کنم"}),H&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{value:_,onChange:z}),(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>er("SCHEDULED"),disabled:K||!_,children:"زمان‌بندی انتشار"})]}),"DRAFT"===L&&(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>er("PENDING_REVIEW"),disabled:K,children:"فرستادن برای بازبینی"}),"PUBLISHED"===L&&(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>er("ARCHIVED"),disabled:K,children:"بایگانی"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)("p",{className:"text-14 font-m",children:"تصویر شاخص"}),b.featuredImageUrl?(0,l.jsxs)("div",{className:"overflow-hidden rounded-12 border border-gray-E5E5E6",children:[(0,l.jsx)("img",{src:(0,j.vD)(b.featuredImageUrl,640),alt:b.featuredImageAlt||"",className:"aspect-[16/10] w-full object-cover"}),(0,l.jsxs)("div",{className:"flex gap-8 p-8",children:[(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>V(!0),children:"تغییر"}),(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>{et("featuredImageUrl",""),et("featuredImageAlt","")},children:"برداشتن"})]})]}):(0,l.jsxs)("button",{type:"button",onClick:()=>V(!0),className:"flex aspect-[16/10] w-full flex-col items-center justify-center gap-6 rounded-12 border border-dashed border-gray-D2D2D7 text-12 text-gray-6C6A7D transition hover:border-primary-main hover:text-primary-dark",children:[(0,l.jsx)("span",{className:"text-24",children:"+"}),"انتخاب از کتابخانه یا آپلود"]}),(0,l.jsx)(j.gN,{label:"متن جایگزین تصویر",hint:"بدون این، انتشار رد می‌شود.",children:(0,l.jsx)(j.II,{value:b.featuredImageAlt??"",onChange:e=>et("featuredImageAlt",e.target.value)})})]})]})})]}),(0,l.jsx)(u.Z,{open:Y,onClose:()=>V(!1),onPick:e=>{let{url:t,alt:a}=e;et("featuredImageUrl",t),a&&et("featuredImageAlt",a)},title:"تصویر شاخص"})]})}function P(e){let{value:t,onChange:a}=e,r=(e,l)=>a(t.map((t,a)=>a===e?{...t,...l}:t));return(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:["این‌ها انتهای مقاله می‌آیند و به‌شکل ",(0,l.jsx)("b",{children:"FAQPage"})," برای گوگل هم فرستاده می‌شوند — یعنی می‌توانند مستقیم در نتیجه‌ی جست‌وجو باز شوند. ردیفی که یکی از دو فیلدش خالی بماند ذخیره نمی‌شود."]}),t.map((e,n)=>(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-12",children:[(0,l.jsxs)("div",{className:"mb-8 flex items-center gap-8",children:[(0,l.jsx)("span",{className:"text-11 text-gray-9B9BAA",children:(n+1).toLocaleStr
1ing("fa-IR")}),(0,l.jsx)(j.II,{value:e.question,onChange:e=>r(n,{question:e.target.value}),placeholder:"پرسش"}),(0,l.jsx)("button",{type:"button","aria-label":"حذف",onClick:()=>a(t.filter((e,t)=>t!==n)),className:"shrink-0 text-gray-6C6A7D",children:"✕"})]}),(0,l.jsx)("textarea",{value:e.answer,onChange:e=>r(n,{answer:e.target.value}),placeholder:"پاسخ — کوتاه و مستقیم؛ گوگل جواب بلند را نمی‌آورد.",rows:2,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"})]},n)),(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>a([...t,{question:"",answer:""}]),children:"افزودن پرسش"})]})}}},function(e){e.O(0,[4885,4389,8289,9759,9774,2888,179],function(){return e(e.s=10239)}),_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.