1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86588],{86588:(e,s,a)=>{a.d(s,{A:()=>j});var l=a(95155),i=a(12115),t=a(90346),r=a(60180),n=a(409),d=a(94245),c=a(93745),o=a(53129);function m(e){if(!e)return"";let s=e.split("?")[0].split("#")[0].split(".");return(s.length>1?s.pop():"")?.toLowerCase()??""}function x(e){return String(e.contentType??"").toLowerCase()}function h(e){let s=x(e),a=m(e.filePath);return!!s.startsWith("image/")||["jpg","jpeg","png","gif","webp","bmp","svg","ico"].includes(a)}function f(e){let s=x(e),a=m(e.filePath);return!!s.startsWith("video/")||["mp4","webm","mov","mkv","avi","m4v"].includes(a)}function u(e){let s=x(e),a=m(e.filePath);return!!s.startsWith("audio/")||["mp3","wav","ogg","aac","m4a"].includes(a)}function p(e){let s=x(e),a=m(e.filePath);return"application/pdf"===s||"pdf"===a}let{Dragger:g}=t._O;function j({multiselect:e,value:s=e?[]:"",onChange:a,filter:b="all",showFilterSelector:v=!1,open:N,onOpenChange:$,hideTrigger:w=!1,allowedExtensions:y,accept:k,restrictionMessage:C}){let[P,S]=(0,i.useState)(!1),[A,I]=(0,i.useState)(b),[_,L]=(0,i.useState)(""),[F,M]=(0,i.useState)(),[B,D]=(0,i.useState)(!1),[O,z]=(0,i.useState)([]),[E,G]=(0,i.useState)(""),[T,W]=(0,i.useState)(""),[K,R]=(0,i.useState)(!1),[U,V]=t.iU.useMessage(),H=(0,i.useRef)(null),q="dark"===(0,o.f)(e=>e.themeMode),J="boolean"==typeof N,Q=J?N:P,X=()=>{R(!1),D(!1),z([]),G(""),Y(!1)},Y=e=>{J||S(e),$?.(e)},Z=n.PW({pageSize:18,searchTerm:_,folderId:F,enabled:Q}),ee=n.p(),es=n.lg(),ea=d._9(Q),el=n.Si();(0,i.useEffect)(()=>{I(b)},[b]);let ei=ee.data||[],et=(0,i.useMemo)(()=>ei.find(e=>e.id===F),[ei,F]),er=(0,i.useMemo)(()=>{if(!F)return ei.filter(e=>e.level<=1).slice(0,16);let e=ei.find(e=>e.id===F);if(!e)return ei.slice(0,16);let s=ei.filter(s=>s.parentId===e.id);return s.length>0?s.slice(0,16):ei.filter(s=>s.parentId===e.parentId).slice(0,16)},[ei,F]),en=Z.data?.pages.flatMap(e=>e.items||[])||[],ed=(0,i.useMemo)(()=>(y||[]).map(e=>e.replace(/^\./,"").toLowerCase()).filter(Boolean),[y]),ec=ed.length>0,eo=C||`ÙÙØ· ÙØ§ÛÙâÙØ§Û ${ed.map(e=>`.${e}`).join("Ø ")} ÙØ§Ø¨Ù Ø§ÙØªØ®Ø§Ø¨ ÙØ³ØªÙد.`,em=e=>!ec||ed.includes(m(e)),ex=(0,i.useMemo)(()=>en.filter(e=>(function(e,s){switch(s){case"all":default:return!0;case"image":return h(e);case"video":return f(e);case"audio":return u(e);case"pdf":return p(e);case"svg":let a,l;return a=x(e),l=m(e.filePath),"image/svg+xml"===a||a.includes("svg")||"svg"===l;case"ico":let i,t;return i=x(e),t=m(e.filePath),"image/x-icon"===i||"image/vnd.microsoft.icon"===i||"ico"===t;case"other":return!h(e)&&!f(e)&&!u(e)&&!p(e)}})(e,A)&&em(e.filePath)),[en,A,ed.join("|")]),eh=Z.data?.pages[Z.data.pages.length-1],ef=eh?.hasMore||!1,eu=Z.isFetchingNextPage;(0,i.useEffect)(()=>{if(!Q||!H.current)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&ef&&!eu&&Z.fetchNextPage()},{threshold:1});return e.observe(H.current),()=>e.disconnect()},[Q,ef,eu,Z.fetchNextPage]);let ep=async()=>{let e=T.trim();if(!e)return void U.warning("ÙØ§Ù
Ù¾ÙØ´Ù را ÙØ§Ø±Ø¯ Ú©ÙÛØ¯");try{let s=await el.mutateAsync({name:e,parentId:F??null});M(s.id),W(""),U.success("Ù¾ÙØ´Ù با Ù
ÙÙÙÛØª ساخت٠شد")}catch{U.error("ساخت Ù¾ÙØ´Ù ÙØ§Ù
ÙÙÙ Ø¨ÙØ¯")}},eg=async()=>{let l=O.map(e=>e.originFileObj).filter(Boolean);if(0===l.length)return void U.warning("ØØ¯Ø§ÙÙ ÛÚ© ÙØ§ÛÙ Ø¨Ø±Ø§Û Ø¢Ù¾ÙÙØ¯ Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯");try{let i=await es.mutateAsync({files:l,description:E,folderId:F,applyImageCopyright:K}),t=Array.isArray(i.data)?i.data:[];if(!e&&t[0]&&(a?.(t[0].filePath),X()),e&&t.length>0){let e=Array.isArray(s)?s:[],l=Array.from(new Set([...e,...t.map(e=>e.filePath)]));a?.(l)}z([]),G(""),R(!1),D(!1),U.success("ÙØ§ÛÙâÙØ§ با Ù
ÙÙÙÛØª آپÙÙØ¯ Ø´Ø¯ÙØ¯")}catch{U.error("آپÙÙØ¯ ÙØ§ÛÙ ÙØ§Ù
ÙÙÙ Ø¨ÙØ¯")}},ej=q?"border-slate-700":"border-gray-200",eb=q?"text-gray-100":"text-gray-800",ev=q?"text-gray-400":"text-gray-500",eN=q?"bg-slate-700 border-slate-600":"",e$=q?"bg-slate-800":"bg-white",ew=q?"ant-select-dark":"";return(0,l.jsxs)("div",{children:[V,w?null:(0,l.jsx)(t.$n,{onClick:()=>Y(!0),loading:Z.isLoading,type:"primary",icon:(0,l.jsx)("i",{className:"fas fa-folder-open ml-1"}),className:"file-selector-dialog-trigger rounded-xl font-iran bg-[#00D5A7] hover:bg-[#00b894]",children:"Ø§ÙØªØ®Ø§Ø¨ ÙØ§ÛÙ"}),(0,l.jsxs)(t.aF,{width:1100,open:Q,footer:null,onCancel:X,title:(0,l.jsx)("span",{className:`font-iran ${eb}`,children:"Ø§ÙØªØ®Ø§Ø¨ ÙØ§ÛÙ"}),className:`font-iran ${q?"ant-modal-dark":""}`,children:[(0,l.jsxs)("div",{className:`mb-4 rounded-3xl border ${ej} p-4 ${q?"bg-slate-900/70":"bg-slate-50"}`,children:[(0,l.jsxs)("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:`text-sm font-bold ${eb}`,children:"جستج٠٠ÙÛÙØªØ± ÙØ§ÛÙâÙØ§"}),(0,l.jsx)("div",{className:`mt-1 text-xs ${ev}`,children:"با ÙØ§Ù
ÙØ§ÛÙØ Ù¾ÙØ´Ù ÛØ§ ÙÙØ¹ رساÙÙ Ø³Ø±ÛØ¹âتر Ø¨Ù ÙØ§ÛÙ Ù
ÙØ±Ø¯Ùظر Ø¨Ø±Ø³ÛØ¯."})]}),(0,l.jsx)(t.$n,{icon:(0,l.jsx)("i",{className:"fas fa-upload ml-1"}),onClick:()=>D(e=>!e),className:"rounded-xl",children:"آپÙÙØ¯ درجا"})]}),(0,l.jsxs)("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.5fr)_260px_220p
1x]",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("label",{className:`mb-1.5 block text-xs font-semibold ${ev}`,children:"جستجÙ"}),(0,l.jsx)(t.pd,{allowClear:!0,prefix:(0,l.jsx)(r.Vr,{className:"text-gray-400"}),value:_,onChange:e=>L(e.target.value),placeholder:"ÙØ§Ù
ÙØ§ÛÙØ ØªÙØ¶ÛØØ ÙÙØ¹ ÛØ§ ÙØ§Ù
Ù¾ÙØ´Ù",className:`rounded-xl shadow-sm ${eN}`})]}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("label",{className:`mb-1.5 block text-xs font-semibold ${ev}`,children:"Ù¾ÙØ´Ù"}),(0,l.jsx)(t.l6,{allowClear:!0,placeholder:"ÙÙ
Ù Ù¾ÙØ´ÙâÙØ§",value:F,onChange:e=>M(e),className:ew,options:ei.map(e=>({label:`${e.path} (${e.mediaCount})`,value:e.id}))})]}),v?(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("label",{className:`mb-1.5 block text-xs font-semibold ${ev}`,children:"ÙÙØ¹ ÙØ§ÛÙ"}),(0,l.jsx)(t.l6,{value:A,onChange:e=>I(e),className:ew,options:[{value:"all",label:"ÙÙ
Ù ÙØ§ÛÙâÙØ§"},{value:"image",label:"تصÙÛØ±"},{value:"video",label:"ÙÛØ¯Ø¦Ù"},{value:"audio",label:"ØµÙØª"},{value:"pdf",label:"PDF"},{value:"svg",label:"SVG"},{value:"other",label:"Ø³Ø§ÛØ±"}]})]}):(0,l.jsx)("div",{className:`flex min-h-[42px] items-end text-xs ${ev}`,children:"ÙÛÙØªØ± ÙÙØ¹ ÙØ§Û٠بر اساس Ù
ØÙ Ø§Ø³ØªÙØ§Ø¯Ù ØªÙØ¸ÛÙ
شد٠است."})]}),(0,l.jsxs)("div",{className:`mt-3 grid gap-3 rounded-2xl border ${ej} p-3 ${q?"bg-slate-950/40":"bg-white/70"} md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,l.jsx)(t.pd,{value:T,onChange:e=>W(e.target.value),placeholder:et?`Ø²ÛØ±Ù¾ÙØ´Ù Ø¨Ø±Ø§Û ${et.path}`:"ÙØ§Ù
Ù¾ÙØ´Ù Ø¬Ø¯ÛØ¯",className:`rounded-xl ${eN}`}),(0,l.jsx)(t.$n,{icon:(0,l.jsx)("i",{className:"fas fa-folder-plus ml-1"}),loading:el.isPending,onClick:ep,className:"rounded-xl",children:et?"ساخت Ø²ÛØ±Ù¾ÙØ´Ù":"ساخت Ù¾ÙØ´Ù"})]}),(0,l.jsxs)("div",{className:`mt-3 rounded-2xl border ${ej} p-3 ${q?"bg-slate-950/30":"bg-white/70"}`,children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)(t.$n,{size:"small",type:F?"default":"primary",onClick:()=>M(void 0),className:"rounded-full",children:"Ø±ÛØ´Ù ÙØ§ÛÙâÙØ§"}),er.map(e=>(0,l.jsx)(t.$n,{size:"small",type:F===e.id?"primary":"default",onClick:()=>M(e.id),className:"rounded-full",children:e.name},e.id))]}),(0,l.jsxs)("div",{className:`mt-3 text-xs ${ev}`,children:["Ù
Ø³ÛØ± جارÛ:",(0,l.jsx)("span",{className:`mr-2 font-semibold ${eb}`,children:et?.path||"Ø±ÛØ´Ù"})]})]})]}),B&&(0,l.jsxs)("div",{className:`mb-5 rounded-3xl border border-dashed ${ej} p-4 md:p-5 ${q?"bg-slate-900":"bg-gray-50"}`,children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:`text-sm font-bold ${eb}`,children:"آپÙÙØ¯ درجا"}),(0,l.jsx)("div",{className:`mt-1 text-xs leading-6 ${ev}`,children:et?`Ù
ÙØµØ¯ آپÙÙØ¯: ${et.path}`:"Ù
ÙØµØ¯ آپÙÙØ¯: Ø±ÛØ´Ù ÙØ§ÛÙâÙØ§"})]}),O.length>0?(0,l.jsxs)("span",{className:"w-fit rounded-full bg-emerald-500/10 px-3 py-1 text-xs font-bold text-emerald-700 dark:text-emerald-300",children:[O.length.toLocaleString("fa-IR")," ÙØ§ÛÙ Ø§ÙØªØ®Ø§Ø¨ شدÙ"]}):null]}),(0,l.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_340px]",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[(0,l.jsx)(t.pd.TextArea,{rows:4,value:E,onChange:e=>G(e.target.value),placeholder:"ØªÙØ¶ÛØ ÙØ§ÛÙâÙØ§Û آپÙÙØ¯Û",className:eN}),ea.data?.enableImageCopyrightText||ea.data?.enableImageWatermark?(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-2xl border border-amber-200/70 bg-amber-50 px-3 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",children:[(0,l.jsx)("div",{className:`text-sm ${eb}`,children:"اعÙ
Ø§Ù ÙØ§ØªØ±Ù
ارک / Ú©Ù¾ÛâØ±Ø§ÛØª رÙÛ ØªØµØ§ÙÛØ± آپÙÙØ¯Û"}),(0,l.jsx)(t.dO,{checked:K,onChange:R,checkedChildren:"ÙØ¹Ø§Ù",unCheckedChildren:"ØºÛØ±ÙعاÙ"})]}):null,es.isPending&&(0,l.jsxs)("div",{className:`rounded-2xl border ${ej} p-3 ${q?"bg-slate-950/60":"bg-white"}`,children:[(0,l.jsxs)("div",{className:`mb-2 flex items-center justify-between text-xs ${ev}`,children:[(0,l.jsx)("span",{children:"در ØØ§Ù آپÙÙØ¯..."}),(0,l.jsxs)("span",{children:[es.progress||0,"%"]})]}),(0,l.jsx)(t.ke,{percent:es.progress||0,showInfo:!1})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 pt-1",children:[(0,l.jsx)(t.$n,{onClick:()=>{R(!1),D(!1)},children:"بستÙ"}),(0,l.jsx)(t.$n,{type:"primary",loading:es.isPending,onClick:eg,children:"آپÙÙØ¯ ÙØ§ÛÙâÙØ§"})]})]}),(0,l.jsxs)(g,{multiple:!0,accept:k||(ec?ed.map(e=>`.${e}`).join(","):void 0),beforeUpload:e=>!em(e.name)&&(U.warning(eo),t._O.LIST_IGNORE),fileList:O,onChange:e=>z(e.fileList),showUploadList:!0,uploadListClassName:"max-h-56 overflow-y-auto pr-1",className:`${q?"bg-slate-800 border-slate-600":"bg-white"} min-h-[220px]`,children:[(0,l.jsx)("p",{className:"ant-upload-drag-icon mb-0",children:(0,l.jsx)("i",{className:"fas fa-inbox text-4xl text-[#00D5A7]"})}),(0,l.jsx)("p",{className:`mt-2 text-sm font-medium ${eb}`,children:"ÙØ§ÛÙâÙØ§ را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯"}),(0,l.jsx)("p",{className:`mt-1 text-xs ${ev}`,children:"در ØµÙØ±Øª Ø²ÛØ§Ø¯ Ø¨ÙØ¯Ù ÙØ§ÛÙâÙØ§Ø ÙÛØ³Øª Ø§ÙØªØ®Ø§Ø¨âÙØ§ اسکرÙÙ Ù
ÛâØ´ÙØ¯."})]})]})]}),(0,l.jsxs)("div",{style:{maxHeight:520,overflow:"auto",display:"flex",flexDirection:"column"},children:[Z.isLoading?(0,l.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,l.jsx)(t.tK,{})}):0===ex.length?(0,l.jsx)("div",{className:"py-10",children:(0,l.jsx)(t.Sv,{description:"ÙØ§ÛÙÛ Ø¨Ø±Ø§Û ÙÙ
Ø§ÛØ´ Ù¾ÛØ¯Ø§ ÙØ´Ø¯"})}):(0,l.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ex.map((i,r)=>{var n;let d,o=(d=i.filePath,e?s.includes(d):s===d);return(0,l.jsxs)("div",{onClick:()=>(l=>{let i=l.filePath;if(!em(i))return void U.warning(eo);if(e){let e=s.includes(i)?s.filter(e=>e!==i):[...s,i];a?.(e)}else a?.(i),X()}
1)(i),className:`cursor-pointer overflow-hidden rounded-2xl border ${e$} transition-all duration-200 ${o?"border-[#00D5A7] shadow-lg shadow-[#00D5A7]/10":`${ej} hover:border-gray-300 dark:hover:border-slate-600 hover:shadow-md`}`,children:[(0,l.jsx)(c.A,{file:i,variant:"compact"}),(0,l.jsxs)("div",{className:"space-y-2 p-3",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:`truncate text-sm font-bold ${eb}`,children:i.displayName||i.originalFileName||i.fileName}),(0,l.jsx)("div",{className:`truncate text-xs ${ev}`,children:i.contentType})]}),o&&(0,l.jsx)(t.vw,{color:"green",children:"Ø§ÙØªØ®Ø§Ø¨ شد"})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px]",children:[(0,l.jsx)(t.vw,{children:(n=i.size)?n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:n<0x40000000?`${(n/1048576).toFixed(1)} MB`:`${(n/0x40000000).toFixed(1)} GB`:"0 B"}),i.folderName?(0,l.jsx)(t.vw,{color:"blue",children:i.folderName}):(0,l.jsx)(t.vw,{children:"بدÙÙ Ù¾ÙØ´Ù"}),i.extension?(0,l.jsx)(t.vw,{children:i.extension}):null]}),i.description&&(0,l.jsx)("div",{className:`line-clamp-2 text-xs ${ev}`,children:i.description})]})]},`${i.id||i.filePath||"media"}-${i.filePath||r}-${r}`)})}),(0,l.jsx)("div",{ref:H,className:"mt-4 flex h-10 items-center justify-center",children:eu&&(0,l.jsx)(t.tK,{})})]}),e&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(t.cG,{className:"my-4"}),(0,l.jsxs)("div",{className:"sticky bottom-0 z-[2] flex items-center justify-between gap-3 rounded-2xl border border-slate-200 bg-white/95 p-3 backdrop-blur dark:border-slate-700 dark:bg-slate-900/95",children:[(0,l.jsxs)("div",{className:`text-sm ${ev}`,children:["تعداد ÙØ§ÛÙâÙØ§Û Ø§ÙØªØ®Ø§Ø¨âشدÙ: ",Array.isArray(s)?s.length:0]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(t.$n,{onClick:X,children:"بستÙ"}),(0,l.jsx)(t.$n,{type:"primary",icon:(0,l.jsx)("i",{className:"fas fa-check ml-1"}),onClick:X,children:"تاÛÛØ¯ Ø§ÙØªØ®Ø§Ø¨"})]})]})]}),e?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(t.cG,{className:"my-4"}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)(t.$n,{onClick:X,children:"بستÙ"})})]})]})]})}}}]);
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.