/
opt
/
canhelp
/
apps
/
web
/
.next
/
static
/
chunks
/
app
/
admin
/
/opt/canhelp/apps/web/.next/static/chunks/app/admin
mkdir
upload
Name
Size
Mode
Actions
page-e1bbbd0a7f93104a.js
278226
0644
edit
dl
rm
Edit:
/opt/canhelp/apps/web/.next/static/chunks/app/admin/page-e1bbbd0a7f93104a.js
(278226B)
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3698],{1258:(e,t,a)=>{"use strict";function s(e){if(!(null==e?void 0:e.trim()))return"—";let t=e.trim().split(/\s+/);return t.length<2||!t[1]?t[0]:"".concat(t[0]," ").concat(t[1][0].toUpperCase(),".")}function l(e,t,a){if(null==e?void 0:e.trim()){let a=null==t?void 0:t.trim();return a?"".concat(e.trim()," ").concat(a[0].toUpperCase(),"."):e.trim()}return s(a)}a.d(t,{E:()=>s,H:()=>l})},1592:(e,t,a)=>{"use strict";a.d(t,{CI:()=>n,Hh:()=>r,Jv:()=>l,wV:()=>i,yK:()=>s});let s=(0,a(6504).M)({baseURL:"https://api.canhelp.gr"}),{signIn:l,signOut:n,signUp:r,useSession:i}=s},4017:(e,t,a)=>{"use strict";function s(e,t){return"el"===t&&e.titleEl?e.titleEl:"en"===t&&e.titleEn?e.titleEn:"ru"===t&&e.titleRu?e.titleRu:e.title}function l(e){return null==e||""===e?"":Math.round(Number(e)).toString()}function n(e,t){return"el"===t&&e.descriptionEl?e.descriptionEl:"en"===t&&e.descriptionEn?e.descriptionEn:"ru"===t&&e.descriptionRu?e.descriptionRu:e.description}a.d(t,{$g:()=>l,GZ:()=>n,Oj:()=>s})},5940:(e,t,a)=>{"use strict";a.d(t,{Ez:()=>r,V:()=>n});var s=a(4568),l=a(7620);function n(e){if(!e)return!1;let t=e.trim();return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")}function r(e){let{icon:t,alt:a="",className:r,fallback:i="\uD83D\uDCE6"}=e,o=(t||"").trim(),[d,c]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c(!1)},[o]);let m=(0,l.useMemo)(()=>n(o)?o.startsWith("/api/")?"".concat("https://api.canhelp.gr").concat(o):o:"",[o]),x="/category-icons/package.svg";return n(o)?d&&o!==x?(0,s.jsx)("img",{src:x,alt:a,className:r,loading:"lazy",onError:()=>c(!0)}):d&&o===x?(0,s.jsx)("span",{className:r,children:i}):(0,s.jsx)("img",{src:m,alt:a,className:r,loading:"lazy",onError:()=>c(!0)}):(0,s.jsx)("span",{className:r,children:o||i})}},6961:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var s=a(4568),l=a(7620),n=a(7541),r=a(9664),i=a.n(r),o=a(1592),d=a(9906),c=a(2982),m=a(1258),x=a(4017),u=a(5940);let g={registration_success:["userName","link","siteName","siteUrl"],email_verification:["userName","link","siteName","siteUrl"],password_reset:["userName","link","siteName","siteUrl"],new_offer:["userName","taskTitle","taskId","specialistName","price","link"],new_task:["userName","taskTitle","taskId","customerName","link"],offer_accepted:["userName","taskTitle","price","link"],new_message:["userName","senderName","preview","link"],offer_declined:["userName","taskTitle","taskId","link"],offer_other_accepted:["userName","taskTitle","taskId","link"],task_updated:["userName","taskTitle","taskId","link"],deadline_reminder:["userName","taskTitle","taskId","link"],task_archived:["userName","taskTitle","taskId","link"],referral_reward:["userName","days","planName","link"],plan_activated:["userName","planName","price","expiresAt","link"],plan_upgraded:["userName","oldPlanName","newPlanName","charged","expiresAt","link"],plan_downgrade_scheduled:["userName","currentPlanName","newPlanName","scheduledDate","link"],plan_downgrade_applied:["userName","planName","link"],plan_renewal_reminder:["userName","planName","amount","expiresAt","link"],plan_insufficient_funds:["userName","currentPlanName","requiredAmount","currentBalance","expiresAt","topUpLink"]},p=Array.from(new Set(Object.values(g).flat())),h=[{value:"/category-icons/repairs.svg",label:"Repairs & Construction"},{value:"/category-icons/repairs-alt-wrench.svg",label:"Repairs Alt: Wrench"},{value:"/category-icons/repairs-alt-hard-hat.svg",label:"Repairs Alt: Hard Hat"},{value:"/category-icons/cleaning.svg",label:"Cleaning"},{value:"/category-icons/cleaning-alt-broom.svg",label:"Cleaning Alt: Broom"},{value:"/category-icons/cleaning-alt-sparkles.svg",label:"Cleaning Alt: Sparkles"},{value:"/category-icons/moving.svg",label:"Moving & Transport"},{value:"/category-icons/moving-alt-bus.svg",label:"Moving Alt: Bus"},{value:"/category-icons/moving-alt-train.svg",label:"Moving Alt: Train"},{value:"/category-icons/tutoring.svg",label:"Tutoring & Education"},{value:"/category-icons/tutoring-alt-book-open.svg",label:"Tutoring Alt: Book Open"},{value:"/category-icons/tutoring-alt-notebook.svg",label:"Tutoring Alt: Notebook"},{value:"/category-icons/it.svg",label:"IT & Technology"},{value:"/category-icons/it-alt-monitor.svg",label:"IT Alt: Monitor"},{value:"/category-icons/it-alt-settings.svg",label:"IT Alt: Settings"},{value:"/category-icons/design.svg",label:"Design"},{value:"/category-icons/design-alt-brush.svg",label:"Design Alt: Brush"},{value:"/category-icons/design-alt-paintbrush.svg",label:"Design Alt: Paintbrush"},{value:"/category-icons/beauty.svg",label:"Beauty & Health"},{value:"/category-icons/beauty-alt-heart.svg",label:"Beauty Alt: Heart"},{value:"/category-icons/beauty-alt-stethoscope.svg",label:"Beauty Alt: Stethoscope"},{value:"/category-icons/tech-repair.svg",label:"Device Repair"},{value:"/category-icons/tech-repair-alt-smartphone.svg",label:"Device Repair Alt: Smartphone"},{value:"/category-icons/tech-repair-alt-wrench.svg",label:"Device Repair Alt: Wrench"},{value:"/category-icons/events.svg",label:"Events"},{value:"/category-icons/events-alt-calendar.svg",label:"Events Alt: Calendar"},{value:"/category-icons/events-alt-clock.svg",label:"Events Alt: Clock"},{value:"/category-icons/photo-video.svg",label:"Photo & Video"},{value:"/category-icons/photo-video-alt-image.svg",label:"Photo & Video Alt: Image"},{value:"/category-icons/photo-video-alt-video.svg",label:"Photo & Video Alt: Video"},{value:"/category-icons/pets.svg",label:"Pets"},{value:"/category-icons/pets-alt-dog.svg",label:"Pets Alt: Dog"},{value:"/category-icons/pets-alt-cat.svg",label:"Pets Alt: Cat"},{value:"/category-icons/auto.svg",label:"Automotive"},{value:"/category-icons/auto-alt-carfront.svg",label:"Automotive Alt: Car Front"},{value:"/category-icons/auto-alt-car.svg",label:"Automotive Alt: Car"},{value:"/category-icons/legal.svg",label:"Legal Services"},{value:"/category-icons/legal-alt-gavel.svg",label:"Legal Alt: Gavel"},{value:"/category-icons/legal-alt-landmark.svg",label:"Legal Alt: Landmark"},{value:"/category-icons/accounting.svg",label:"Accounting"},{value:"/category-icons/accounting-alt-receipt.svg",label:"Accounting Alt: Receipt"},{value:"/category-icons/accounting-alt-wallet.svg",label:"Accounting Alt: Wallet"},{value:"/category-icons/other.svg",label:"Other"},{value:"/category-icons/other-alt-briefcase.svg",label:"Other Alt: Briefcase"},{value:"/category-icons/other-alt-search.svg",label:"Other Alt: Search"}];function b(e,t){return e?"en"===t?e.namesEn||e.namesEl||e.slug||"":"ru"===t?e.namesRu||e.namesEl||e.slug||"":"uk"===t?e.namesUk||e.namesEl||e.slug||"":e.namesEl||e.namesEn||e.slug||"":""}function f(e,t){return e?"en"===t?e.nameEn||e.nameEl||e.slug||"":"ru"===t?e.nameRu||e.nameEl||e.slug||"":"uk"===t?e.nameUk||e.nameEl||e.slug||"":e.nameEl||e.nameEn||e.slug||"":""}function y(e){let{value:t,onChange:a,onUpload:l,uploading:n,error:r,presets:i}=e;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border border-gray-200 bg-white px-3 py-2",children:[(0,s.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-green-50",children:(0,s.jsx)(u.Ez,{icon:t,alt:"category icon",className:"h-9 w-9 object-contain text-3xl leading-none",fallback:"\uD83D\uDCE6"})}),(0,s.jsx)("input",{value:t,onChange:e=>a(e.target.value),className:"flex-1 border-0 bg-transparent p-0 text-sm outline-none ring-0",placeholder:"/category-icons/package.svg"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("label",{className:"inline-flex cursor-pointer items-center rounded-lg border px-3 py-1.5 text-xs font-medium transition ".concat(n?"border-gray-200 bg-gray-100 text-gray-400":"border-green-300 bg-green-50 text-green-700 hover:bg-green-100"),children:[n?"Uploading...":"Upload SVG",(0,s.jsx)("input",{type:"file",accept:".svg,image/svg+xml",className:"hidden",disabled:n,onChange:async e=>{var t;let a=null==(t=e.target.files)?void 0:t[0];a&&(await l(a),e.target.value="")}})]}),(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"or choose from presets"})]}),(0,s.jsx)("p",{className:"text-[11px] text-gray-500",children:"Preset source: /public/category-icons/presets.json"}),r?(0,s.jsx)("p",{className:"text-xs text-red-600",children:r}):null,(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:i.map(e=>{let l=t===e.value;return(0,s.jsxs)("button",{type:"button",onClick:()=>a(e.value),className:"flex h-20 flex-col items-center justify-center gap-1 rounded-lg border px-2 transition ".concat(l?"border-green-500 bg-green-50 shadow-sm":"border-gray-200 bg-white hover:border-green-300 hover:bg-green-50"),"aria-label":e.label,title:e.label,children:[(0,s.jsx)(u.Ez,{icon:e.value,alt:e.label,className:"h-8 w-8 object-contain text-3xl leading-none",fallback:"\uD83D\uDCE6"}),(0,s.jsx)("span",{className:"max-w-full truncate text-[11px] font-medium text-gray-600 leading-tight",children:e.label})]},e.value)})})]})}function v(e){let{catRows:t,locale:a,selected:n,onAdd:r,addLabel:i}=e,[o,d]=(0,l.useState)(!1),[c,m]=(0,l.useState)(""),[x,g]=(0,l.useState)(null),p=(0,l.useRef)(null);(0,l.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&(d(!1),m(""))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let h=t.filter(e=>!e.parentId),f=c.toLowerCase(),y=e=>{var t;return!c||b(e,a).toLowerCase().includes(f)||(null!=(t=e.slug)?t:"").toLowerCase().includes(f)};return(0,s.jsxs)("div",{className:"relative",ref:p,children:[(0,s.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ".concat(o?"rounded-t-lg border border-green-400 bg-white text-gray-900":"rounded-lg border border-gray-300 bg-white hover:bg-gray-50 text-gray-500 hover:text-gray-700"),children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 10h16M4 14h16M4 18h16"})}),(0,s.jsx)("span",{className:"flex-1 text-left truncate",children:i}),(0,s.jsx)("svg",{className:"w-3 h-3 text-gray-400 shrink-0 transition-transform ".concat(o?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),o&&(0,s.jsxs)("div",{className:"absolute left-0 top-full w-full min-w-[240px] bg-white border border-t-0 border-green-400 rounded-b-xl shadow-lg z-50 max-h-72 overflow-y-auto",children:[(0,s.jsx)("div",{className:"sticky top-0 bg-white px-3 py-2 border-b border-gray-100",children:(0,s.jsx)("input",{autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:"Поиск...",className:"w-full text-xs border border-gray-200 rounded-lg px-2.5 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-300"})}),h.map(e=>{let l=t.filter(t=>t.parentId===e.id),i=b(e,a),o=x===e.id,p=l.filter(e=>!n.includes(e.slug)&&y(e)),h=!n.includes(e.slug)&&y(e),f=l.length>0;return!h&&0===p.length&&c?null:(0,s.jsxs)("div",{children:[(0,s.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-gray-50 text-gray-800",onClick:()=>{f&&!c?g(o?null:e.id):h&&(r(e.slug),d(!1),m(""))},children:[e.icon?(0,s.jsx)(u.Ez,{icon:e.icon,alt:i,className:"h-5 w-5 shrink-0 object-contain text-sm leading-none",fallback:"\uD83D\uDCE6"}):null,(0,s.jsx)("span",{className:"flex-1 font-medium",children:i}),f&&!c?(0,s.jsx)("svg",{className:"w-3.5 h-3.5 text-gray-400 shrink-0 transition-transform ".concat(o?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):null]}),(o||!!c)&&p.map(e=>(0,s.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 pl-8 pr-3 py-1.5 text-xs text-left bg-gray-50 hover:bg-gray-100 text-gray-600",onClick:()=>{r(e.slug),d(!1),m("")},children:[(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:b(e,a)})]},e.id))]},e.id)})]})]})}function j(e){let{locRows:t,locale:a,selected:n,onAdd:r,addLabel:i}=e,[o,d]=(0,l.useState)(!1),[c,m]=(0,l.useState)(""),[x,u]=(0,l.useState)(null),g=(0,l.useRef)(null);(0,l.useEffect)(()=>{function e(e){g.current&&!g.current.contains(e.target)&&(d(!1),m(""))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let p=t.filter(e=>!e.parentId),h=c.toLowerCase(),b=e=>{var t;return!c||f(e,a).toLowerCase().includes(h)||(null!=(t=e.slug)?t:"").toLowerCase().includes(h)};return(0,s.jsxs)("div",{className:"relative",ref:g,children:[(0,s.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ".concat(o?"rounded-t-lg border border-green-400 bg-white text-gray-900":"rounded-lg border border-gray-300 bg-white hover:bg-gray-50 text-gray-500 hover:text-gray-700"),children:[(0,s.jsxs)("svg",{className:"w-3.5 h-3.5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),(0,s.jsx)("span",{className:"flex-1 text-left truncate",children:i}),(0,s.jsx)("svg",{className:"w-3 h-3 text-gray-400 shrink-0 transition-transform ".concat(o?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),o&&(0,s.jsxs)("div",{className:"absolute left-0 top-full w-full min-w-[220px] bg-white border border-t-0 border-green-400 rounded-b-xl shadow-lg z-50 max-h-72 overflow-y-auto",children:[(0,s.jsx)("div",{className:"sticky top-0 bg-white px-3 py-2 border-b border-gray-100",children:(0,s.jsx)("input",{autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:"Поиск...",className:"w-full text-xs border border-gray-200 rounded-lg px-2.5 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-300"})}),p.map(e=>{let l=t.filter(t=>t.parentId===e.id),i=f(e,a),o=x===e.id,g=l.length>0,p=l.filter(e=>!n.includes(e.slug)&&b(e)),h=!n.includes(e.slug)&&b(e);return!h&&0===p.length&&c?null:(0,s.jsxs)("div",{children:[(0,s.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-gray-50 text-gray-800",onClick:()=>{g&&!c?u(o?null:e.id):h&&(r(e.slug),d(!1),m(""))},children:[(0,s.jsx)("svg",{className:"w-3 h-3 text-gray-300 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"})}),(0,s.jsx)("span",{className:"flex-1 font-medium",children:i}),g&&!c?(0,s.jsx)("svg",{className:"w-3.5 h-3.5 text-gray-400 shrink-0 transition-transform ".concat(o?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):null]}),(o||!!c)&&p.map(e=>(0,s.jsxs)("button",{type:"button",className:"w-full flex items-center gap-2 pl-8 pr-3 py-1.5 text-xs text-left bg-gray-50 hover:bg-gray-100 text-gray-600",onClick:()=>{r(e.slug),d(!1),m("")},children:[(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:f(e,a)})]},e.id))]},e.id)})]})]})}function N(){var e,t,a,r,u,N,_,S,L,M,T,I,R,P,W,z,F,H,V,O,K,q,G,X,Y,J,$,Q,Z,ee,et,ea,es,el,en;let er=(0,n.useRouter)(),{data:ei,isPending:eo}=(0,o.wV)(),{t:ed,locale:ec}=(0,d.Y)(),[em,ex]=(0,l.useState)("stats"),[eu,eg]=(0,l.useState)(!1);(0,l.useEffect)(()=>{eg(window.innerWidth<1024)},[]);let[ep,eh]=(0,l.useState)(null),[eb,ef]=(0,l.useState)([]),[ey,ev]=(0,l.useState)(1),[ej,eN]=(0,l.useState)(0),[ek,ew]=(0,l.useState)(""),[eC,e_]=(0,l.useState)(""),[eS,eL]=(0,l.useState)(""),[eE,eD]=(0,l.useState)([]),[eM,eA]=(0,l.useState)(1),[eB,eT]=(0,l.useState)(0),[eI,eU]=(0,l.useState)(""),[eR,eP]=(0,l.useState)(""),[eW,ez]=(0,l.useState)(""),[eF,eH]=(0,l.useState)([]),[eV,eO]=(0,l.useState)(1),[eK,eq]=(0,l.useState)(0),[eG,eX]=(0,l.useState)(0),[eY,eJ]=(0,l.useState)([]),[e$,eQ]=(0,l.useState)(1),[eZ,e0]=(0,l.useState)(0),[e1,e2]=(0,l.useState)(!1),[e4,e5]=(0,l.useState)(0),[e3,e6]=(0,l.useState)({}),[e7,e8]=(0,l.useState)({}),[e9,te]=(0,l.useState)(null),[tt,ta]=(0,l.useState)([]),[ts,tl]=(0,l.useState)(1),[tn,tr]=(0,l.useState)(0),[ti,to]=(0,l.useState)(""),[td,tc]=(0,l.useState)(""),[tm,tx]=(0,l.useState)(""),[tu,tg]=(0,l.useState)(""),[tp,th]=(0,l.useState)(null),[tb,tf]=(0,l.useState)(""),[ty,tv]=(0,l.useState)(!1),[tj,tN]=(0,l.useState)([]),[tk,tw]=(0,l.useState)(1),[tC,t_]=(0,l.useState)(0),[tS,tL]=(0,l.useState)([]),[tE,tD]=(0,l.useState)(0),[tM,tA]=(0,l.useState)(1),[tB,tT]=(0,l.useState)(""),[tI,tU]=(0,l.useState)(""),[tR,tP]=(0,l.useState)(""),[tW,tz]=(0,l.useState)(""),[tF,tH]=(0,l.useState)([]),[tV,tO]=(0,l.useState)([]),[tK,tq]=(0,l.useState)(0),[tG,tX]=(0,l.useState)(1),[tY,tJ]=(0,l.useState)(""),[t$,tQ]=(0,l.useState)(""),[tZ,t0]=(0,l.useState)(""),[t1,t2]=(0,l.useState)([]),[t4,t5]=(0,l.useState)("ai"),[t3,t6]=(0,l.useState)([]),[t7,t8]=(0,l.useState)(1),[t9,ae]=(0,l.useState)(0),[at,aa]=(0,l.useState)(""),[as,al]=(0,l.useState)([]),[an,ar]=(0,l.useState)(""),[ai,ao]=(0,l.useState)(""),[ad,ac]=(0,l.useState)([]),[am,ax]=(0,l.useState)([]),[au,ag]=(0,l.useState)([]),[ap,ah]=(0,l.useState)(0),[ab,af]=(0,l.useState)(1),[ay,av]=(0,l.useState)(""),[aj,aN]=(0,l.useState)(""),[ak,aw]=(0,l.useState)(!1),[aC,a_]=(0,l.useState)(!1),[aS,aL]=(0,l.useState)(null),[aE,aD]=(0,l.useState)(!1),[aM,aA]=(0,l.useState)(!1),[aB,aT]=(0,l.useState)("profile"),[aI,aU]=(0,l.useState)(null),[aR,aP]=(0,l.useState)(""),[aW,az]=(0,l.useState)([]),[aF,aH]=(0,l.useState)(!1),[aV,aO]=(0,l.useState)({}),[aK,aq]=(0,l.useState)({}),[aG,aX]=(0,l.useState)({}),[aY,aJ]=(0,l.useState)({}),[a$,aQ]=(0,l.useState)([]),[aZ,a0]=(0,l.useState)(null),[a1,a2]=(0,l.useState)(!1),[a4,a5]=(0,l.useState)([]),[a3,a6]=(0,l.useState)(null),[a7,a8]=(0,l.useState)(!1),[a9,se]=(0,l.useState)(new Set),[st,sa]=(0,l.useState)([]),[ss,sl]=(0,l.useState)(null),[sn,sr]=(0,l.useState)(!1),[si,so]=(0,l.useState)(new Set),[sd,sc]=(0,l.useState)(!1),[sm,sx]=(0,l.useState)(null),[su,sg]=(0,l.useState)(h),[sp,sh]=(0,l.useState)(new Set),[sb,sf]=(0,l.useState)({}),[sy,sv]=(0,l.useState)(new Set),[sj,sN]=(0,l.useState)(null),[sk,sw]=(0,l.useState)(!1),[sC,s_]=(0,l.useState)("general"),[sS,sL]=(0,l.useState)({siteName:"CanHelp",siteUrl:"",contactEmail:"",supportPhone:"",showPricing:!0}),[sE,sD]=(0,l.useState)(!1),[sM,sA]=(0,l.useState)(!1),[sB,sT]=(0,l.useState)({host:"",port:"587",username:"",password:"",fromName:"CanHelp",fromEmail:"",encryption:"tls"}),[sI,sU]=(0,l.useState)(!1),[sR,sP]=(0,l.useState)(!1),[sW,sz]=(0,l.useState)(!1),[sF,sH]=(0,l.useState)(null),[sV,sO]=(0,l.useState)({email_verification:{subject:"Подтвердите ваш email — {{siteName}}",body:""},registration_success:{subject:"Добро пожаловать в {{siteName}}!",body:""},password_reset:{subject:"Восстановление пароля — {{siteName}}",body:""},new_offer:{subject:"Новое предложение по вашей задаче \xab{{taskTitle}}\xbb",body:""},new_task:{subject:"Новая задача: {{taskTitle}}",body:""},offer_accepted:{subject:"Ваше предложение принято: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Ваше предложение принято! \uD83C\uDF89</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Заказчик принял ваше предложение на выполнение задачи:</p><div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#1e40af;font-weight:600">{{taskTitle}}</p><p style="margin:4px 0 0;color:#374151">Сумма: <strong>{{price}}€</strong></p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Открыть чат →</a>'},new_message:{subject:"Новое сообщение от {{senderName}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Новое сообщение</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Вам написал(а) <strong>{{senderName}}</strong>:</p><div style="background:#f9fafb;border-left:4px solid #2563eb;padding:16px;margin:16px 0"><p style="margin:0;color:#374151;font-style:italic">"{{preview}}"</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Ответить →</a>'},offer_declined:{subject:"Ваше предложение отклонено: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Ваше предложение отклонено</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">К сожалению, заказчик отклонил ваше предложение на:</p><div style="background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#b91c1c;font-weight:600">{{taskTitle}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Найти другие заказы →</a>'},offer_other_accepted:{subject:"Выбран другой исполнитель: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Выбран другой исполнитель</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Заказчик выбрал другого исполнителя для задания:</p><div style="background:#fff7ed;border:1px solid #fed7aa;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#c2410c;font-weight:600">{{taskTitle}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Найти другие заказы →</a>'},task_updated:{subject:"Задание обновлено: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Задание обновлено</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Заказчик обновил детали задания:</p><div style="background:#eff6ff;border:1px solid #bfdbfe;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#1d4ed8;font-weight:600">{{taskTitle}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Смотреть заказ →</a>'},deadline_reminder:{subject:"Задание истекает завтра: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Напоминание о дедлайне</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Ваше задание истекает через 24 часа. Обновите дедлайн, иначе задание будет автоматически снято с публикации.</p><div style="background:#fefce8;border:1px solid #fde68a;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#92400e;font-weight:600">{{taskTitle}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Редактировать задание →</a>'},task_archived:{subject:"Задание снято с публикации: {{taskTitle}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Задание переведено в черновик</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Ваше задание истекло и было автоматически переведено в черновик. Обновите дедлайн, чтобы опубликовать его снова.</p><div style="background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#b91c1c;font-weight:600">{{taskTitle}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Редактировать задание →</a>'},referral_reward:{subject:"Вы получили реферальную награду — {{siteName}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Вы получили реферальную награду! \uD83C\uDF81</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Друг зарегистрировался по вашей реферальной ссылке. На ваш аккаунт добавлено <strong>{{days}} дней</strong> доступа к плану <strong>{{planName}}</strong>!</p><div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#15803d;font-weight:600">+{{days}} дней — {{planName}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Перейти к аккаунту →</a>'},referral_reward_el:{subject:"Λάβατε ανταμοιβή παραπομπής — {{siteName}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Λάβατε ανταμοιβή παραπομπής! \uD83C\uDF81</h2><p style="color:#6b7280;margin:0 0 20px">Γεια {{userName}},</p><p style="color:#374151">Ένας φίλος εγγράφηκε χρησιμοποιώντας τον σύνδεσμο παραπομπής σας. Στον λογαριασμό σας προστέθηκαν <strong>{{days}} ημέρες</strong> πρόσβασης στο πλάνο <strong>{{planName}}</strong>!</p><div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#15803d;font-weight:600">+{{days}} ημέρες — {{planName}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Δες τον λογαριασμό σου →</a>'},referral_reward_en:{subject:"You received a referral reward — {{siteName}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">You received a referral reward! \uD83C\uDF81</h2><p style="color:#6b7280;margin:0 0 20px">Hi {{userName}},</p><p style="color:#374151">A friend registered using your referral link. <strong>{{days}} days</strong> of <strong>{{planName}}</strong> access have been added to your account!</p><div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#15803d;font-weight:600">+{{days}} days — {{planName}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">View your account →</a>'},referral_reward_ru:{subject:"Вы получили реферальную награду — {{siteName}}",body:'<h2 style="margin:0 0 8px;color:#111827;font-size:20px">Вы получили реферальную награду! \uD83C\uDF81</h2><p style="color:#6b7280;margin:0 0 20px">Привет, {{userName}}!</p><p style="color:#374151">Друг зарегистрировался по вашей реферальной ссылке. На ваш аккаунт добавлено <strong>{{days}} дней</strong> доступа к плану <strong>{{planName}}</strong>!</p><div style="background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px;margin:16px 0"><p style="margin:0;color:#15803d;font-weight:600">+{{days}} дней — {{planName}}</p></div><a href="{{link}}" style="display:inline-block;background:#2563eb;color:#fff;text-decoration:none;padding:12px 24px;border-radius:8px;font-weight:600;margin-top:8px">Перейти к аккаунту →</a>'}}),[sK,sq]=(0,l.useState)(null),[sG,sX]=(0,l.useState)("el"),[sY,sJ]=(0,l.useState)(!1),[s$,sQ]=(0,l.useState)(!1),[sZ,s0]=(0,l.useState)({merchantId:"",apiUser:"",apiPassword:"",environment:"test",confirmationUrl:"",cancelUrl:"",enabled:!1}),[s1,s2]=(0,l.useState)(!1),[s4,s5]=(0,l.useState)(!1),[s3,s6]=(0,l.useState)({enabled:!1,planId:"",days:"30"}),[s7,s8]=(0,l.useState)(!1),[s9,le]=(0,l.useState)(!1),[lt,la]=(0,l.useState)({maintenanceMode:!1,indexingEnabled:!0,headScripts:"",siteTitleEl:"",siteTitleEn:"",siteTitleRu:"",siteTitleUk:"",siteDescriptionEl:"",siteDescriptionEn:"",siteDescriptionRu:"",siteDescriptionUk:""}),[ls,ll]=(0,l.useState)(!1),[ln,lr]=(0,l.useState)(!1),[li,lo]=(0,l.useState)("el"),[ld,lc]=(0,l.useState)({telegram:"",instagram:"",facebook:"",twitter:"",youtube:"",tiktok:"",whatsapp:"",viber:""}),[lm,lx]=(0,l.useState)(!1),[lu,lg]=(0,l.useState)(!1),[lp,lh]=(0,l.useState)({botToken:"",adminChatId:"",channelIdEl:"",channelIdEn:"",channelIdRu:"",channelIdUk:"",notifyRegistrations:!1,postNewTasks:!1}),[lb,lf]=(0,l.useState)(!1),[ly,lv]=(0,l.useState)(!1),[lj,lN]=(0,l.useState)(!1),[lk,lw]=(0,l.useState)(!1),[lC,l_]=(0,l.useState)(null),[lS,lL]=(0,l.useState)(null),[lE,lD]=(0,l.useState)(null),[lM,lA]=(0,l.useState)({}),[lB,lT]=(0,l.useState)(!1),[lI,lU]=(0,l.useState)(null),[lR,lP]=(0,l.useState)(!1),[lW,lz]=(0,l.useState)(!1),[lF,lH]=(0,l.useState)([]),[lV,lO]=(0,l.useState)(!1),[lK,lq]=(0,l.useState)([]),[lG,lX]=(0,l.useState)(!1),[lY,lJ]=(0,l.useState)(null),[l$,lQ]=(0,l.useState)(null),[lZ,l0]=(0,l.useState)(null),[l1,l2]=(0,l.useState)(!1),l4=e=>{l0(e),l2(!1)},l5=e=>{l0(e),l2(!0)},[l3,l6]=(0,l.useState)(null),[l7,l8]=(0,l.useState)(!1),[l9,ne]=(0,l.useState)("uk"),[nt,na]=(0,l.useState)("el"),[ns,nl]=(0,l.useState)({}),[nn,nr]=(0,l.useState)(null),[ni,no]=(0,l.useState)(null),[nd,nc]=(0,l.useState)(null),[nm,nx]=(0,l.useState)(!1),[nu,ng]=(0,l.useState)(new Set),[np,nh]=(0,l.useState)("broadcast"),[nb,nf]=(0,l.useState)(""),[ny,nv]=(0,l.useState)(""),[nj,nN]=(0,l.useState)(""),[nk,nw]=(0,l.useState)("general"),[nC,n_]=(0,l.useState)(""),[nS,nL]=(0,l.useState)(!0),[nE,nD]=(0,l.useState)(!1),[nM,nA]=(0,l.useState)(null),[nB,nT]=(0,l.useState)(null),[nI,nU]=(0,l.useState)(!1),nR=!eo&&ei&&(null==(e=ei.user)?void 0:e.role)==="admin";async function nP(){if(ny.trim()){if("user"===np&&!nb.trim())return void nT("Укажите ID пользователя");nD(!0),nT(null),nA(null);try{let e={title:ny.trim(),body:nj.trim()||void 0,type:nk.trim()||void 0,referenceId:nC.trim()||void 0};if("broadcast"===np){let t=await c.V7({...e,onlyActive:nS});nA(t)}else{let t=await c.g1(nb.trim(),e);nA(t)}}catch(e){nT((null==e?void 0:e.message)||"Не удалось отправить push")}finally{nD(!1)}}}async function nW(e,t){let a=t?c.Wi:c.He,s=await a(e).catch(()=>null);s&&ef(t=>t.map(t=>t.id===e?s:t))}function nz(e,t){return e?"THIRD_PARTY_AUTH_ERROR"===e?"Ошибка APNs/Firebase iOS: проверьте Apple APNs Auth Key (.p8) и связку Firebase проекта для iOS-приложения":"UNREGISTERED"===e?"Токен устройства больше не валиден":"INVALID_ARGUMENT"===e?"Некорректный токен или payload":"REQUEST_FAILED"===e?t||"FCM request failed before response":t?"".concat(e,": ").concat(t):e:t||"FCM принял 0 сообщений"}async function nF(){if(aS){aD(!0);try{var e,t,a,s,l,n;let r=await c.wl(aS.id,{firstName:aS.firstName,lastName:aS.lastName,phone:aS.phone||null,bio:aS.bio||null,role:aS.role,planId:aS.planId||null,isActive:aS.isActive,locale:aS.locale,languages:null!=(e=aS.languages)?e:[],personalSiteSlug:aS.personalSiteSlug||null,showContactInfo:null!=(t=aS.showContactInfo)&&t,notifyNewTasks:null!=(a=aS.notifyNewTasks)&&a,notifMessages:null==(s=aS.notifMessages)||s,skills:null!=(l=aS.skills)?l:[],siteSettings:null!=(n=aS.siteSettings)?n:{}});await Promise.all(aW.map(e=>{var t,a,s;return c.oq(e.id,{title:e.title,description:e.description||null,skills:null!=(t=e.skills)?t:[],categories:null!=(a=e.categories)?a:[],locations:null!=(s=e.locations)?s:[],publicationStatus:e.publicationStatus,isActive:e.isActive}).catch(()=>null)})),ef(e=>e.map(e=>e.id===aS.id?r:e)),aL(null)}catch(e){}finally{aD(!1)}}}async function nH(){if(aS){aA(!0);try{let e=await c.uQ(aS.id);aL(t=>t?{...t,emailVerified:e.emailVerified}:t),ef(t=>t.map(t=>t.id===aS.id?{...t,emailVerified:e.emailVerified}:t))}catch(e){}finally{aA(!1)}}}async function nV(){if(!aS)return;let e=Number(aS.topUpAmount);if(e&&!(e<=0)){aw(!0);try{let t=await c.P0(aS.id,{amount:e,description:aS.topUpDescription||void 0});ef(e=>e.map(e=>e.id===aS.id?t.user:e)),aL(e=>e?{...e,...t.user,topUpAmount:"",topUpDescription:""}:e),"balances"===em&&c.g0({page:ab,userId:ay||void 0,kind:aj||void 0}).then(e=>{ag(e.data),ah(e.total)}).catch(()=>{})}catch(e){}finally{aw(!1)}}}async function nO(){if(!aS)return;let e=Number(aS.withdrawAmount);if(e&&!(e<=0)){a_(!0);try{let t=await c.hD(aS.id,{amount:e,description:aS.withdrawDescription||void 0});ef(e=>e.map(e=>e.id===aS.id?t.user:e)),aL(e=>e?{...e,...t.user,withdrawAmount:"",withdrawDescription:""}:e),"balances"===em&&c.g0({page:ab,userId:ay||void 0,kind:aj||void 0}).then(e=>{ag(e.data),ah(e.total)}).catch(()=>{})}catch(e){}finally{a_(!1)}}}async function nK(e){let t=aW.find(t=>t.id===e);if(t){aq(t=>({...t,[e]:!0}));try{var a,s,l;let n=await c.oq(e,{title:t.title,description:t.description||null,skills:null!=(a=t.skills)?a:[],categories:null!=(s=t.categories)?s:[],locations:null!=(l=t.locations)?l:[],publicationStatus:t.publicationStatus,isActive:t.isActive});az(t=>t.map(t=>t.id===e?n:t))}catch(e){}finally{aq(t=>({...t,[e]:!1}))}}}async function nq(e,t){let a=await c.oq(e,{publicationStatus:t,isActive:"active"===t}).catch(()=>null);a&&(eJ(t=>t.map(t=>t.id===e?a:t)),(null==aS?void 0:aS.id)===a.specialistId&&az(t=>t.map(t=>t.id===e?a:t)),c.z5(1,"pending").then(e=>eX(e.total)).catch(()=>{}),c.s_(1,"pending").then(e=>e5(e.total)).catch(()=>{}))}async function nG(e,t,a){let s=e3[t.id],l=e7[t.id];("map"!==a||s)&&("create"!==a||(null==l?void 0:l.trim()))&&(te(t.id),await c.M6(e,t.id,{action:a,..."map"===a?{categoryId:s}:{},..."create"===a?{slug:l.trim()}:{}}).catch(()=>null)&&eJ(n=>n.map(n=>{var r,i,o;return n.id===e?{...n,categorySuggestions:(null!=(i=n.categorySuggestions)?i:[]).filter(e=>e.id!==t.id),..."reject"!==a?{categories:[...new Set([...null!=(o=n.categories)?o:[],"map"===a?null==(r=st.find(e=>e.id===s))?void 0:r.slug:l.trim()])]}:{}}:n})),te(null))}async function nX(e){let t=await c.nf(e).catch(()=>null);if(t){let a=t.task||t;eD(t=>t.map(t=>(t.task||t).id===e?{...t,task:a}:t))}}async function nY(e,t){window.confirm("".concat(ed("admin.tasks.delete.confirm"),'\n"').concat(t,'"'))&&await c.GB(e).catch(()=>null)&&eD(t=>t.filter(t=>{var a;return((null==(a=t.task)?void 0:a.id)||t.id)!==e}))}async function nJ(e,t){let a=await c.eU(e,t).catch(()=>null);a&&eH(t=>t.map(t=>t.id===e?{...t,...a}:t))}function n$(e){a6({parentId:null!=e?e:null,slug:"",nameEl:"",nameEn:"",nameRu:"",nameUk:"",order:0,isActive:!0})}async function nQ(){if(a3){a8(!0);try{if(a3.id){let e=await c.Nt(a3.id,a3);a5(t=>t.map(t=>t.id===a3.id?e:t))}else{let e=await c.yJ({slug:a3.slug,nameEl:a3.nameEl,nameEn:a3.nameEn,nameRu:a3.nameRu,nameUk:a3.nameUk,parentId:a3.parentId,order:a3.order});a5(t=>[...t,e])}a6(null)}catch(e){}finally{a8(!1)}}}async function nZ(e,t){window.confirm("".concat(ed("admin.loc.delete.confirm"),'\n"').concat(t,'"'))&&await c.zR(e).catch(()=>null)&&a5(t=>t.filter(t=>t.id!==e))}function n0(e){sx(null),sl({parentId:null!=e?e:null,slug:"",icon:"/category-icons/package.svg",namesEl:"",namesEn:"",namesRu:"",namesUk:"",order:0,isActive:!0})}async function n1(e){if("image/svg+xml"!==e.type)return void sx("Only SVG files are allowed");sc(!0),sx(null);try{let t=new FormData;t.append("file",e);let a=await fetch("".concat("https://api.canhelp.gr","/api/uploads"),{method:"POST",credentials:"include",body:t});if(!a.ok){let e=await a.json().catch(()=>({error:"Upload failed"}));throw Error(e.error||"Upload failed")}let s=await a.json();sl(e=>e?{...e,icon:s.url}:e)}catch(e){sx((null==e?void 0:e.message)||"Upload failed")}finally{sc(!1)}}async function n2(){if(ss){sr(!0);try{if(ss.id){let e=await c.$7(ss.id,ss);sa(t=>t.map(t=>t.id===ss.id?e:t))}else{let e=await c.zZ({slug:ss.slug,icon:ss.icon,namesEl:ss.namesEl,namesEn:ss.namesEn,namesRu:ss.namesRu,namesUk:ss.namesUk,parentId:ss.parentId,order:ss.order});sa(t=>[...t,e])}sl(null)}catch(e){}finally{sr(!1)}}}async function n4(e,t){window.confirm("".concat(ed("admin.cat.delete.confirm"),'\n"').concat(t,'"'))&&await c.K7(e).catch(()=>null)&&sa(t=>t.filter(t=>t.id!==e))}async function n5(e){let t=e.id,a=e.slug;if(sh(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a}),!sb[a]){sv(e=>new Set(e).add(t));try{let e=await c.i_(a);sf(t=>({...t,[a]:e}))}catch(e){}finally{sv(e=>{let a=new Set(e);return a.delete(t),a})}}}async function n3(){if(sj){sw(!0);try{if(sj.id){let e=await c.fP(sj.id,{nameEl:sj.nameEl,nameEn:sj.nameEn,nameRu:sj.nameRu,nameUk:sj.nameUk,order:sj.order});sf(t=>{var a;return{...t,[sj.catSlug]:(null!=(a=t[sj.catSlug])?a:[]).map(t=>t.id===sj.id?e:t)}})}else{let e=await c.S9({categorySlug:sj.catSlug,nameEl:sj.nameEl,nameEn:sj.nameEn,nameRu:sj.nameRu,nameUk:sj.nameUk,order:sj.order});sf(t=>{var a;return{...t,[sj.catSlug]:[...null!=(a=t[sj.catSlug])?a:[],e]}})}sN(null)}catch(e){}finally{sw(!1)}}}async function n6(e,t){(e._skipConfirm||window.confirm('Удалить навык "'.concat(e.nameEl,'"?')))&&(e._skipConfirm||await c.hp(e.id).catch(()=>null))&&sf(a=>{var s;return{...a,[t]:(null!=(s=a[t])?s:[]).filter(t=>t.id!==e.id)}})}async function n7(){if(aZ){a2(!0);try{let e={name:aZ.name,description:aZ.description||void 0,role:aZ.role,tier:aZ.tier,price:aZ.price,oldPrice:aZ.oldPrice||null,currency:aZ.currency,maxTasks:aZ.maxTasks?Number(aZ.maxTasks):null,maxOffers:aZ.maxOffers?Number(aZ.maxOffers):null,maxCards:aZ.maxCards?Number(aZ.maxCards):null,maxMessagesPerDay:aZ.maxMessagesPerDay?Number(aZ.maxMessagesPerDay):null,maxOrdersPerDay:aZ.maxOrdersPerDay?Number(aZ.maxOrdersPerDay):null,maxSkills:aZ.maxSkills?Number(aZ.maxSkills):null,durationDays:aZ.durationDays?Number(aZ.durationDays):null,notifyNewTasks:aZ.notifyNewTasks,searchBoost:aZ.searchBoost,offersMultiplier:aZ.offersMultiplier,canContactFreePlan:aZ.canContactFreePlan,canContactProPlan:aZ.canContactProPlan,canContactAll:aZ.canContactAll,canShowContactInfo:aZ.canShowContactInfo,canViewPhone:aZ.canViewPhone,canUploadVideo:aZ.canUploadVideo,hasFavorites:aZ.hasFavorites,hasGoogleCalendar:aZ.hasGoogleCalendar,hasVerifiedBadge:aZ.hasVerifiedBadge,highlightedReviews:aZ.highlightedReviews,hasPersonalSite:aZ.hasPersonalSite,hasCanHelpNowStatus:aZ.hasCanHelpNowStatus,hasNeedHelpStatus:aZ.hasNeedHelpStatus,hasAutoResponse:aZ.hasAutoResponse,hasAutoMatch:aZ.hasAutoMatch,hasPriceList:aZ.hasPriceList,receiveInstantDispatchFree:aZ.receiveInstantDispatchFree,receiveInstantDispatchPro:aZ.receiveInstantDispatchPro,features:aZ.features?aZ.features.split("\n").map(e=>e.trim()).filter(Boolean):[],isDefault:aZ.isDefault,isActive:aZ.isActive,order:aZ.order};if(aZ.id){let t=await c.td(aZ.id,e);aQ(e=>e.map(e=>e.id===aZ.id?t:e))}else{let t=await c.qT(e);aQ(e=>[...e,t])}aZ.isDefault&&c.OX().then(aQ).catch(()=>{}),a0(null)}catch(e){}finally{a2(!1)}}}async function n8(e,t){window.confirm('Delete plan "'.concat(t,'"?'))&&await c.bR(e).catch(()=>null)&&aQ(t=>t.filter(t=>t.id!==e))}async function n9(){sD(!0);try{await c.CX({"general.siteName":sS.siteName,"general.siteUrl":sS.siteUrl,"general.contactEmail":sS.contactEmail,"general.supportPhone":sS.supportPhone,"general.showPricing":String(sS.showPricing)}),sA(!0),setTimeout(()=>sA(!1),2500)}catch(e){}finally{sD(!1)}}async function re(){sU(!0);try{await c.CX({"smtp.host":sB.host,"smtp.port":sB.port,"smtp.username":sB.username,"smtp.password":sB.password,"smtp.fromName":sB.fromName,"smtp.fromEmail":sB.fromEmail,"smtp.encryption":sB.encryption}),sP(!0),setTimeout(()=>sP(!1),2500)}catch(e){}finally{sU(!1)}}async function rt(e){var t,a;let s="".concat(e,"_").concat(sG),l=null!=(a=null!=(t=sV[s])?t:sV[e])?a:{subject:"",body:""};if(l.subject||l.body){sQ(!0);try{await c.jg(s,l);let t=await c.wc({subject:l.subject,body:l.body,fromLocale:sG});sO(a=>{let n={...a,[s]:l};for(let[a,s]of Object.entries(t))n["".concat(e,"_").concat(a)]=s;return n}),await Promise.all(Object.entries(t).map(t=>{let[a,s]=t;return c.jg("".concat(e,"_").concat(a),s)}))}catch(e){}finally{sQ(!1)}}}async function ra(e){let t="".concat(e,"_").concat(sG);sJ(!0);try{var a;await c.jg(t,null!=(a=sV[t])?a:{subject:"",body:""}),sq(null)}catch(e){}finally{sJ(!1)}}async function rs(){s2(!0);try{await c.CX({"payment.epay.merchantId":sZ.merchantId,"payment.epay.apiUser":sZ.apiUser,"payment.epay.apiPassword":sZ.apiPassword,"payment.epay.environment":sZ.environment,"payment.epay.confirmationUrl":sZ.confirmationUrl,"payment.epay.cancelUrl":sZ.cancelUrl,"payment.epay.enabled":String(sZ.enabled)}),s5(!0),setTimeout(()=>s5(!1),2500)}catch(e){}finally{s2(!1)}}async function rl(){s8(!0);try{await c.CX({referral_enabled:String(s3.enabled),referral_plan_id:s3.planId,referral_days:s3.days}),le(!0),setTimeout(()=>le(!1),2500)}catch(e){}finally{s8(!1)}}async function rn(){ll(!0);try{await c.CX({"seo.maintenanceMode":String(lt.maintenanceMode),"seo.indexingEnabled":String(lt.indexingEnabled),"seo.headScripts":lt.headScripts,"seo.siteTitle.el":lt.siteTitleEl,"seo.siteTitle.en":lt.siteTitleEn,"seo.siteTitle.ru":lt.siteTitleRu,"seo.siteTitle.uk":lt.siteTitleUk,"seo.siteDescription.el":lt.siteDescriptionEl,"seo.siteDescription.en":lt.siteDescriptionEn,"seo.siteDescription.ru":lt.siteDescriptionRu,"seo.siteDescription.uk":lt.siteDescriptionUk}),lr(!0),setTimeout(()=>lr(!1),2500)}catch(e){}finally{ll(!1)}}async function rr(){lx(!0);try{await c.CX({"social.telegram":ld.telegram,"social.instagram":ld.instagram,"social.facebook":ld.facebook,"social.twitter":ld.twitter,"social.youtube":ld.youtube,"social.tiktok":ld.tiktok,"social.whatsapp":ld.whatsapp,"social.viber":ld.viber}),lg(!0),setTimeout(()=>lg(!1),2500)}catch(e){}finally{lx(!1)}}async function ri(){lf(!0);try{await c.CX({"telegram.botToken":lp.botToken,"telegram.adminChatId":lp.adminChatId,"telegram.channelId.el":lp.channelIdEl,"telegram.channelId.en":lp.channelIdEn,"telegram.channelId.ru":lp.channelIdRu,"telegram.channelId.uk":lp.channelIdUk,"telegram.notifyRegistrations":String(lp.notifyRegistrations),"telegram.postNewTasks":String(lp.postNewTasks)}),lv(!0),setTimeout(()=>lv(!1),2500)}catch(e){}finally{lf(!1)}}async function ro(e){var t,a;let s=null!=(t=({admin:lp.adminChatId,el:lp.channelIdEl,en:lp.channelIdEn,ru:lp.channelIdRu,uk:lp.channelIdUk})[e])?t:"";"admin"===e?(lN(!0),l_(null)):(lD(e),lA(t=>{let a={...t};return delete a[e],a}));try{let t=await c.qX(lp.botToken,s),l={ok:t.ok,msg:t.ok?t.botName?"@".concat(t.botName):ed("admin.settings.telegram.test_ok"):null!=(a=t.error)?a:ed("admin.settings.telegram.test_fail")};"admin"===e?l_(l):lA(t=>({...t,[e]:l}))}catch(a){let t={ok:!1,msg:ed("admin.settings.telegram.test_fail")};"admin"===e?l_(t):lA(a=>({...a,[e]:t}))}finally{"admin"===e?lN(!1):lD(null)}}async function rd(){lT(!0),lU(null);try{var e;let t=await c.cl(lp.botToken);lU({ok:t.ok,msg:t.ok?"@".concat(t.botName):null!=(e=t.error)?e:ed("admin.settings.telegram.test_fail")})}catch(e){lU({ok:!1,msg:ed("admin.settings.telegram.test_fail")})}finally{lT(!1)}}if((0,l.useEffect)(()=>{var e;eo||ei||er.push("/login"),!eo&&ei&&(null==(e=ei.user)?void 0:e.role)!=="admin"&&er.push("/")},[ei,eo]),(0,l.useEffect)(()=>{nR&&(c.dE().then(eh).catch(()=>{}),c.bi().then(ac).catch(()=>{}),c.u4().then(ax).catch(()=>{}),c.z5(1,"pending").then(e=>eX(e.total)).catch(()=>{}),c.s_(1,"pending").then(e=>e5(e.total)).catch(()=>{}))},[nR]),(0,l.useEffect)(()=>{nR&&"users"===em&&(nU(!0),c.cS(ey,ek||void 0,eS||void 0).then(e=>{ef(e.data),eN(e.total)}).catch(()=>{}).finally(()=>nU(!1)))},[nR,em,ey,ek,eS]),(0,l.useEffect)(()=>{nR&&"tasks"===em&&(nU(!0),c.Yj(eM,eI||void 0,eW||void 0).then(e=>{eD(e.data),eT(e.total)}).catch(()=>{}).finally(()=>nU(!1)))},[nR,em,eM,eI,eW]),(0,l.useEffect)(()=>{nR&&"reports"===em&&(nU(!0),c.z5(eV).then(e=>{eH(e.data),eq(e.total)}).catch(()=>{}).finally(()=>nU(!1)))},[nR,em,eV]),(0,l.useEffect)(()=>{nR&&"moderation"===em&&(e2(!0),Promise.all([c.s_(e$,"review"),0===st.length?c.KD():Promise.resolve(st)]).then(e=>{let[t,a]=e;eJ(t.data),e0(t.total),0===st.length&&sa(a)}).catch(()=>{}).finally(()=>e2(!1)))},[nR,em,e$]),(0,l.useEffect)(()=>{if(!nR||"support"!==em)return;nU(!0);let e={page:String(ts),limit:"30"};ti&&(e.status=ti),td&&(e.type=td),tm&&(e.q=tm),c.KZ(e).then(e=>{ta(e.data),tr(e.total)}).catch(()=>{}).finally(()=>nU(!1))},[nR,em,ts,ti,td,tm]),(0,l.useEffect)(()=>{nR&&"balances"===em&&(nU(!0),c.g0({page:ab,userId:ay||void 0,kind:aj||void 0}).then(e=>{ag(e.data),ah(e.total)}).catch(()=>{}).finally(()=>nU(!1)))},[nR,em,ab,ay,aj]),(0,l.useEffect)(()=>{nR&&"logs"===em&&("ai"===t4?(nU(!0),c.j_(tk).then(e=>{tN(e.data),t_(e.total)}).catch(()=>{}).finally(()=>nU(!1))):"activity"===t4?c.yO({page:tM,event:tB||void 0,userId:tI||void 0,dateFrom:tR||void 0,dateTo:tW||void 0}).then(e=>{var t;tL(e.data),tD(e.total),(null==(t=e.eventTypes)?void 0:t.length)&&tH(e.eventTypes)}).catch(()=>{}):"mail"===t4?c.qt({page:tG,event:tY||void 0,dateFrom:t$||void 0,dateTo:tZ||void 0}).then(e=>{var t;tO(e.data),tq(e.total),(null==(t=e.eventTypes)?void 0:t.length)&&t2(e.eventTypes)}).catch(()=>{}):"notifications"===t4&&c.Br({page:t7,type:at||void 0,dateFrom:an||void 0,dateTo:ai||void 0}).then(e=>{var t;t6(e.data),ae(e.total),(null==(t=e.notifTypes)?void 0:t.length)&&al(e.notifTypes)}).catch(()=>{}))},[nR,em,t4,tk,tM,tB,tI,tR,tW,tG,tY,t$,tZ,t7,at,an,ai]),(0,l.useEffect)(()=>{tA(1)},[tB,tI,tR,tW]),(0,l.useEffect)(()=>{tX(1)},[tY,t$,tZ]),(0,l.useEffect)(()=>{t8(1)},[at,an,ai]),(0,l.useEffect)(()=>{nR&&"plans"===em&&c.OX().then(aQ).catch(()=>{})},[nR,em]),(0,l.useEffect)(()=>{nR&&"translations"===em&&(l8(!0),c.YQ().then(e=>l6(e.tables)).catch(()=>{}).finally(()=>l8(!1)))},[nR,em]),(0,l.useEffect)(()=>{nR&&"backup"===em&&((0,c.Em)("/admin/backup/settings").then(e=>lP(!!e.autoEnabled)).catch(()=>{}),lO(!0),(0,c.Em)("/admin/backup/tables").then(e=>lH(e.tables||[])).catch(()=>{}).finally(()=>lO(!1)),(0,c.Em)("/admin/backup/list").then(e=>lq(e.files||[])).catch(()=>{}))},[nR,em]),(0,l.useEffect)(()=>{nR&&"referrals"===em&&(nx(!0),c.cJ().then(e=>nc(e)).catch(()=>{}).finally(()=>nx(!1)))},[nR,em]),(0,l.useEffect)(()=>{nR&&"users"===em&&0===a$.length&&c.OX().then(aQ).catch(()=>{})},[nR,em]),(0,l.useEffect)(()=>{ev(1)},[ek,eS]),(0,l.useEffect)(()=>{eA(1)},[eI,eW]),(0,l.useEffect)(()=>{af(1)},[ay,aj]),(0,l.useEffect)(()=>{nR&&"locations"===em&&c.k_().then(a5).catch(()=>{})},[nR,em]),(0,l.useEffect)(()=>{nR&&"categories"===em&&c.KD().then(sa).catch(()=>{})},[nR,em]),(0,l.useEffect)(()=>{nR&&fetch("/category-icons/presets.json").then(e=>e.ok?e.json():Promise.reject(Error("Failed to load presets"))).then(e=>{if(!Array.isArray(e))return;let t=e.filter(e=>!!e&&"object"==typeof e&&"string"==typeof e.value&&"string"==typeof e.label).filter(e=>e.value.startsWith("/category-icons/"));t.length>0&&sg(t)}).catch(()=>{})},[nR]),(0,l.useEffect)(()=>{nR&&"settings"===em&&(0===a$.length&&c.OX().then(aQ).catch(()=>{}),c.rC().then(e=>{var t,a,s,l,n,r,i,o,d,c,m,x,u,g,p,h,b,f,y,v,j,N,k,w,C,_,S,L,E,D,M,A,B,T,I,U,R,P,W,z,F,H,V,O,K,q,G,X;sL({siteName:null!=(t=e["general.siteName"])?t:"CanHelp",siteUrl:null!=(a=e["general.siteUrl"])?a:"",contactEmail:null!=(s=e["general.contactEmail"])?s:"",supportPhone:null!=(l=e["general.supportPhone"])?l:"",showPricing:"false"!==e["general.showPricing"]}),sT({host:null!=(n=e["smtp.host"])?n:"",port:null!=(r=e["smtp.port"])?r:"587",username:null!=(i=e["smtp.username"])?i:"",password:null!=(o=e["smtp.password"])?o:"",fromName:null!=(d=e["smtp.fromName"])?d:"CanHelp",fromEmail:null!=(c=e["smtp.fromEmail"])?c:"",encryption:null!=(m=e["smtp.encryption"])?m:"tls"}),s0({merchantId:null!=(x=e["payment.epay.merchantId"])?x:"",apiUser:null!=(u=e["payment.epay.apiUser"])?u:"",apiPassword:null!=(g=e["payment.epay.apiPassword"])?g:"",environment:null!=(p=e["payment.epay.environment"])?p:"test",confirmationUrl:null!=(h=e["payment.epay.confirmationUrl"])?h:"",cancelUrl:null!=(b=e["payment.epay.cancelUrl"])?b:"",enabled:"true"===e["payment.epay.enabled"]}),s6({enabled:"true"===e.referral_enabled,planId:null!=(v=null!=(y=null!=(f=e.referral_plan_id)?f:e.referral_customer_plan_id)?y:e.referral_specialist_plan_id)?v:"",days:null!=(k=null!=(N=null!=(j=e.referral_days)?j:e.referral_customer_days)?N:e.referral_specialist_days)?k:"30"}),la({maintenanceMode:"true"===e["seo.maintenanceMode"],indexingEnabled:"false"!==e["seo.indexingEnabled"],headScripts:null!=(w=e["seo.headScripts"])?w:"",siteTitleEl:null!=(_=null!=(C=e["seo.siteTitle.el"])?C:e["seo.siteTitle"])?_:"",siteTitleEn:null!=(S=e["seo.siteTitle.en"])?S:"",siteTitleRu:null!=(L=e["seo.siteTitle.ru"])?L:"",siteTitleUk:null!=(E=e["seo.siteTitle.uk"])?E:"",siteDescriptionEl:null!=(M=null!=(D=e["seo.siteDescription.el"])?D:e["seo.siteDescription"])?M:"",siteDescriptionEn:null!=(A=e["seo.siteDescription.en"])?A:"",siteDescriptionRu:null!=(B=e["seo.siteDescription.ru"])?B:"",siteDescriptionUk:null!=(T=e["seo.siteDescription.uk"])?T:""}),lc({telegram:null!=(I=e["social.telegram"])?I:"",instagram:null!=(U=e["social.instagram"])?U:"",facebook:null!=(R=e["social.facebook"])?R:"",twitter:null!=(P=e["social.twitter"])?P:"",youtube:null!=(W=e["social.youtube"])?W:"",tiktok:null!=(z=e["social.tiktok"])?z:"",whatsapp:null!=(F=e["social.whatsapp"])?F:"",viber:null!=(H=e["social.viber"])?H:""}),lh({botToken:null!=(V=e["telegram.botToken"])?V:"",adminChatId:null!=(O=e["telegram.adminChatId"])?O:"",channelIdEl:null!=(K=e["telegram.channelId.el"])?K:"",channelIdEn:null!=(q=e["telegram.channelId.en"])?q:"",channelIdRu:null!=(G=e["telegram.channelId.ru"])?G:"",channelIdUk:null!=(X=e["telegram.channelId.uk"])?X:"",notifyRegistrations:"true"===e["telegram.notifyRegistrations"],postNewTasks:"true"===e["telegram.postNewTasks"]})}).catch(()=>{}),c.Lp().then(e=>{let t={};for(let a of e)t[a.key]={subject:a.subject,body:a.body};sO(e=>({...e,...t}))}).catch(()=>{}))},[nR,em]),eo)return(0,s.jsx)("div",{className:"text-center py-20 text-gray-500",children:ed("common.loading")});let rc="ru"===ec?"ru-RU":"en"===ec?"en-US":"el-GR",rm=[{key:"stats",label:ed("admin.tab.stats"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})},{key:"users",label:ed("admin.tab.users"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"}),(0,s.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75"})]})},{key:"tasks",label:ed("admin.tab.tasks"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"})})},{key:"reports",label:ed("admin.tab.reports"),badge:eG||void 0,icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})},{key:"moderation",label:ed("admin.tab.moderation"),badge:e4||void 0,icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.1 0-2 .9-2 2v1H9a1 1 0 00-1 1v5a1 1 0 001 1h6a1 1 0 001-1v-5a1 1 0 00-1-1h-1v-1c0-1.1-.9-2-2-2zm0 0V6m0 12v-2"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 20h12"})]})},{key:"categories",label:ed("admin.tab.categories"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm10 0a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zm10 0a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})})},{key:"locations",label:ed("admin.tab.locations"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]})},{key:"balances",label:ed("admin.tab.balances","Balance"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-2"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 12h-6m0 0a2 2 0 100 4h6v-8h-6a2 2 0 100 4z"})]})},{key:"plans",label:ed("admin.tab.plans"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),(0,s.jsx)("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]})},{key:"logs",label:ed("admin.tab.logs"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,s.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})},{key:"settings",label:ed("admin.tab.settings"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]})},{key:"support",label:ed("admin.tab.support","Support"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"})})},{key:"push",label:ed("admin.tab.push","Push"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.4-1.4A2 2 0 0118 14.17V11a6 6 0 10-12 0v3.17a2 2 0 01-.6 1.43L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})})},{key:"backup",label:ed("admin.tab.backup","Backup"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})},{key:"translations",label:ed("admin.tab.translations","Translations"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})})},{key:"dbcheck",label:ed("admin.tab.dbcheck","DB check"),icon:(0,s.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12c0 1.66-4.03 3-9 3S3 13.66 3 12"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5v14c0 1.66 4.03 3 9 3s9-1.34 9-3V5"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})},{key:"referrals",label:ed("admin.tab.referrals","Referrals"),icon:(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"})})}],rx={open:"bg-green-100 text-green-700",in_progress:"bg-green-100 text-green-700",completed:"bg-gray-100 text-gray-600",cancelled:"bg-red-100 text-red-600",draft:"bg-yellow-100 text-yellow-700"},ru={pending:"bg-yellow-100 text-yellow-700",reviewed:"bg-green-100 text-green-700",dismissed:"bg-gray-100 text-gray-500"},rg={spam:"bg-green-100 text-green-700",inappropriate:"bg-red-100 text-red-700",fraud:"bg-purple-100 text-purple-700",duplicate:"bg-green-100 text-green-700",other:"bg-gray-100 text-gray-600"},rp=e=>{var t;return null!=(t=e.publicationStatus)?t:e.isActive?"active":"inactive"},rh=eY.filter(e=>"pending"===rp(e)),rb=eY.filter(e=>"active"===rp(e));return(0,s.jsx)("div",{className:"min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("svg",{className:"w-7 h-7 text-yellow-500",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M5 16L3 5l5.5 5L12 4l3.5 6L21 5l-2 11H5zm0 3a1 1 0 000 2h14a1 1 0 000-2H5z"})}),(0,s.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:ed("admin.title")})]}),(0,s.jsxs)(i(),{href:"/",className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-green-600 transition",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),ed("admin.back_home")]})]}),(0,s.jsxs)("div",{className:"flex gap-6",children:[(0,s.jsx)("aside",{className:"shrink-0 transition-all duration-200 ".concat(eu?"w-12":"w-52"),children:(0,s.jsxs)("nav",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsx)("button",{type:"button",onClick:()=>eg(e=>!e),title:eu?"Развернуть меню":"Свернуть меню",className:"w-full flex items-center justify-center py-2.5 text-gray-400 hover:text-gray-600 hover:bg-gray-50 border-b border-gray-100 transition",children:(0,s.jsx)("svg",{className:"w-4 h-4 transition-transform duration-200 ".concat(eu?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),rm.map(e=>{let{key:t,label:a,icon:l,badge:n}=e;return(0,s.jsxs)("button",{onClick:()=>ex(t),title:eu?a:void 0,className:"w-full flex items-center py-3 text-sm font-medium text-left transition ".concat(em===t?"bg-green-50 text-green-700 border-r-2 border-green-600":"text-gray-600 hover:bg-gray-50 hover:text-gray-900"," ").concat(eu?"justify-center px-3":"gap-3 px-4"),children:[(0,s.jsx)("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:l}),!eu&&(0,s.jsxs)("span",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)("span",{children:a}),n?(0,s.jsx)("span",{className:"ml-auto inline-flex min-w-5 h-5 items-center justify-center rounded-full bg-red-100 px-1.5 text-[11px] font-semibold text-red-700",children:n}):null]})]},t)})]})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:["stats"===em&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[{label:ed("admin.stats.users"),value:null==ep?void 0:ep.userCount,icon:(0,s.jsx)("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),color:"text-green-600"},{label:ed("admin.stats.specialists"),value:null==ep?void 0:ep.specialistCount,icon:(0,s.jsxs)("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),color:"text-purple-600"},{label:ed("admin.stats.tasks"),value:null==ep?void 0:ep.taskCount,icon:(0,s.jsx)("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),color:"text-green-600"},{label:ed("admin.stats.offers"),value:null==ep?void 0:ep.offerCount,icon:(0,s.jsx)("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),color:"text-green-600"},{label:ed("admin.stats.reviews"),value:null==ep?void 0:ep.reviewCount,icon:(0,s.jsx)("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})}),color:"text-yellow-500"}].map(e=>{let{label:t,value:a,icon:l,color:n}=e;return(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("div",{className:"mb-2 ".concat(n),children:l}),(0,s.jsx)("div",{className:"text-3xl font-bold ".concat(n),children:null!=a?a:"—"}),(0,s.jsx)("div",{className:"text-sm text-gray-500 mt-1",children:t})]},t)})}),(null==ep?void 0:ep.tasksByDay)&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800",children:ed("admin.stats.activity_30d")}),(0,s.jsxs)("div",{className:"flex gap-4 text-xs text-gray-500",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-green-500 inline-block rounded"}),ed("admin.stats.users_label")]}),(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-purple-400 inline-block rounded"}),ed("admin.stats.specialists_label")]}),(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-green-500 inline-block rounded"}),ed("admin.stats.tasks_label")]})]})]}),(0,s.jsx)(U,{series:[{data:ep.usersByDay,color:"#3b82f6",fill:"#3b82f615",label:ed("admin.stats.users_label")},{data:ep.specialistsByDay,color:"#a855f7",fill:"#a855f710",label:ed("admin.stats.specialists_label")},{data:ep.tasksByDay,color:"#22c55e",fill:"#22c55e10",label:ed("admin.stats.tasks_label")}]})]}),(null==ep?void 0:ep.tasksByStatus)&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800 mb-5",children:ed("admin.stats.tasks_by_status")}),(0,s.jsx)("div",{className:"space-y-3",children:(()=>{let e=ep.tasksByStatus.reduce((e,t)=>e+Number(t.count),0)||1,t={open:{label:ed("admin.task_status.open"),bg:"bg-green-50",bar:"bg-green-500"},in_progress:{label:ed("admin.task_status.in_progress"),bg:"bg-green-50",bar:"bg-green-500"},completed:{label:ed("admin.task_status.completed"),bg:"bg-gray-50",bar:"bg-gray-400"},cancelled:{label:ed("admin.task_status.cancelled"),bg:"bg-red-50",bar:"bg-red-400"},draft:{label:ed("admin.task_status.draft"),bg:"bg-yellow-50",bar:"bg-yellow-400"}},a=["open","in_progress","completed","draft","cancelled"];return[...ep.tasksByStatus].sort((e,t)=>a.indexOf(e.status)-a.indexOf(t.status)).map(a=>{var l;let{status:n,count:r}=a,i=null!=(l=t[n])?l:{label:n,bg:"bg-gray-50",bar:"bg-gray-300"},o=Math.round(Number(r)/e*100);return(0,s.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg ".concat(i.bg),children:[(0,s.jsx)("span",{className:"text-sm text-gray-600 w-28 shrink-0",children:i.label}),(0,s.jsx)("div",{className:"flex-1 bg-gray-200 rounded-full h-2 overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full ".concat(i.bar," transition-all"),style:{width:"".concat(o,"%")}})}),(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-700 w-8 text-right",children:r}),(0,s.jsxs)("span",{className:"text-xs text-gray-400 w-8",children:[o,"%"]})]},n)})})()})]}),ad.length>0&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800",children:ed("admin.stats.notif_chart_title")}),(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-orange-500 inline-block rounded"}),ed("admin.stats.notif_label")]})]}),(0,s.jsx)(U,{series:[{data:ad,color:"#f97316",fill:"#f9731615",label:ed("admin.stats.notif_label")}]})]}),am.length>0&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800",children:ed("admin.stats.mail_chart_title")}),(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-sky-500 inline-block rounded"}),ed("admin.stats.mail_label")]})]}),(0,s.jsx)(U,{series:[{data:am,color:"#0ea5e9",fill:"#0ea5e915",label:ed("admin.stats.mail_label")}]})]}),ep&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800",children:ed("admin.stats.tokens_title")}),(0,s.jsxs)("div",{className:"flex gap-4 text-xs text-gray-500",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-violet-500 inline-block rounded"}),ed("admin.stats.tokens_out")]}),(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"w-3 h-0.5 bg-sky-500 inline-block rounded"}),ed("admin.stats.tokens_in")]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{className:"rounded-lg bg-violet-50 border border-violet-100 px-4 py-3",children:[(0,s.jsx)("div",{className:"text-xs text-violet-600 mb-1",children:ed("admin.stats.tokens_out_label")}),(0,s.jsx)("div",{className:"text-2xl font-bold text-violet-700",children:Number(ep.totalOutputTokens).toLocaleString()})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-sky-50 border border-sky-100 px-4 py-3",children:[(0,s.jsx)("div",{className:"text-xs text-sky-600 mb-1",children:ed("admin.stats.tokens_in_label")}),(0,s.jsx)("div",{className:"text-2xl font-bold text-sky-700",children:Number(ep.totalInputTokens).toLocaleString()})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-emerald-50 border border-emerald-100 px-4 py-3",children:[(0,s.jsx)("div",{className:"text-xs text-emerald-600 mb-1",children:ed("admin.stats.cost_label")}),(0,s.jsxs)("div",{className:"text-2xl font-bold text-emerald-700",children:["$",Number(null!=(a=ep.totalCostUsd)?a:0).toFixed(4)]})]})]}),(null==(t=ep.tokensByMonth)?void 0:t.length)>0&&(0,s.jsx)(B,{dateLocale:rc,series:[{data:ep.tokensByMonth.map(e=>({month:e.month,count:Number(e.output)})),color:"#8b5cf6",fill:"#8b5cf610",label:ed("admin.stats.tokens_out_label")},{data:ep.tokensByMonth.map(e=>({month:e.month,count:Number(e.input)})),color:"#0ea5e9",fill:"#0ea5e915",label:ed("admin.stats.tokens_in_label")}]})]})]}),"users"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex gap-3 mb-4",children:[(0,s.jsxs)("form",{className:"flex gap-2 flex-1",onSubmit:e=>{e.preventDefault(),ew(eC)},children:[(0,s.jsx)("input",{value:eC,onChange:e=>e_(e.target.value),placeholder:ed("admin.users.search.placeholder"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsx)("button",{type:"submit",className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700",children:ed("tasks.search.btn")})]}),(0,s.jsxs)("select",{value:eS,onChange:e=>eL(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"",children:ed("admin.filter.all_roles")}),(0,s.jsx)("option",{value:"user",children:ed("admin.user_edit.role.user")}),(0,s.jsx)("option",{value:"admin",children:ed("profile.role.admin")})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-left",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.user")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.email")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.role")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.plan","Plan")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.registered")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.status")}),(0,s.jsx)("th",{className:"px-4 py-3"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:nI?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:ed("common.loading")})}):0===eb.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:"—"})}):eb.map(e=>{var t,a;return(0,s.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"px-4 py-3 font-medium text-gray-800",children:(0,m.H)(e.firstName,e.lastName,e.name)}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500",children:e.email}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat("admin"===e.role?"bg-red-100 text-red-700":"specialist"===e.role?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:ed("profile.role.".concat(e.role))||e.role})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-400 text-xs",children:e.planId?null!=(a=null==(t=a$.find(t=>t.id===e.planId))?void 0:t.name)?a:(0,s.jsxs)("span",{className:"font-mono",children:[e.planId.slice(0,8),"…"]}):(0,s.jsx)("span",{className:"text-gray-300",children:"—"})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-400",children:new Date(e.createdAt).toLocaleDateString(rc)}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(!1!==e.isActive?"bg-green-100 text-green-700":"bg-red-100 text-red-600"),children:!1!==e.isActive?ed("admin.users.active"):ed("admin.users.inactive")})}),(0,s.jsx)("td",{className:"px-4 py-3 text-right",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,s.jsx)("button",{onClick:()=>{aT("profile"),aP(""),aU(null),az([]),aO({}),aq({}),aX({}),aJ({}),aL({...e,topUpAmount:"",topUpDescription:"",withdrawAmount:"",withdrawDescription:""}),c.jd(e.id).then(e=>aL(t=>t&&t.id===e.id?{...e,topUpAmount:"",topUpDescription:"",withdrawAmount:"",withdrawDescription:""}:t)).catch(()=>{})},className:"text-xs px-2.5 py-1 rounded-lg font-medium bg-gray-50 text-gray-600 hover:bg-gray-100 border border-gray-200",children:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),"admin"!==e.role&&(0,s.jsx)("button",{onClick:()=>nW(e.id,!1!==e.isActive),className:"text-xs px-3 py-1 rounded-lg font-medium ".concat(!1!==e.isActive?"bg-red-50 text-red-600 hover:bg-red-100":"bg-green-50 text-green-600 hover:bg-green-100"),children:!1!==e.isActive?ed("admin.users.deactivate"):ed("admin.users.activate")})]})})]},e.id)})})]}),(0,s.jsx)(E,{page:ey,total:ej,limit:20,onChange:ev,totalLabel:ed("admin.pagination.total")})]})]}),"balances"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4",children:[(0,s.jsx)("input",{value:ay,onChange:e=>av(e.target.value),placeholder:ed("admin.balance.filter.user_id","Filter by userId"),className:"flex-1 min-w-72 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsxs)("select",{value:aj,onChange:e=>aN(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"",children:ed("admin.balance.filter.all","All operations")}),(0,s.jsx)("option",{value:"topup",children:ed("admin.balance.kind.topup","Top-up")}),(0,s.jsx)("option",{value:"plan_purchase",children:ed("admin.balance.kind.plan_purchase","Plan charge")}),(0,s.jsx)("option",{value:"admin_topup",children:ed("admin.balance.kind.admin_topup","Admin top-up")}),(0,s.jsx)("option",{value:"admin_adjustment",children:ed("admin.balance.kind.admin_adjustment","Adjustment")})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-left",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.user")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.balance.col.operation","Operation")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.balance.col.amount","Amount")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.balance.col.result","Balance")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.balance.col.description","Description")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.balance.col.date","Date")})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:nI?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:ed("common.loading")})}):0===au.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:ed("admin.balance.empty","No records yet")})}):au.map(e=>{let t="credit"===e.direction,a="topup"===e.kind?ed("admin.balance.kind.topup","Top-up"):"plan_purchase"===e.kind?ed("admin.balance.kind.plan_purchase","Plan charge"):"admin_topup"===e.kind?ed("admin.balance.kind.admin_topup","Admin top-up"):ed("admin.balance.kind.admin_adjustment","Adjustment");return(0,s.jsxs)("tr",{className:"hover:bg-gray-50 align-top",children:[(0,s.jsxs)("td",{className:"px-4 py-3",children:[(0,s.jsx)("div",{className:"font-medium text-gray-800",children:e.userName||"—"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e.userEmail||e.userId})]}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"inline-flex rounded-full px-2 py-0.5 text-xs font-medium ".concat(t?"bg-emerald-50 text-emerald-700":"bg-rose-50 text-rose-700"),children:a})}),(0,s.jsxs)("td",{className:"px-4 py-3 font-semibold ".concat(t?"text-emerald-700":"text-rose-700"),children:[t?"+":"-",Number(e.amount).toFixed(2)," ",e.currency]}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600",children:(0,s.jsxs)("div",{children:[Number(e.balanceBefore).toFixed(2)," → ",Number(e.balanceAfter).toFixed(2)," ",e.currency]})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 max-w-sm",children:e.description||"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleString(rc)})]},e.id)})})]}),(0,s.jsx)(E,{page:ab,total:ap,limit:50,onChange:af,totalLabel:ed("admin.pagination.total")})]})]}),"tasks"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex gap-3 mb-4",children:[(0,s.jsxs)("form",{className:"flex gap-2 flex-1",onSubmit:e=>{e.preventDefault(),eU(eR)},children:[(0,s.jsx)("input",{value:eR,onChange:e=>eP(e.target.value),placeholder:ed("admin.tasks.search.placeholder"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsx)("button",{type:"submit",className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700",children:ed("tasks.search.btn")})]}),(0,s.jsxs)("select",{value:eW,onChange:e=>ez(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"",children:ed("admin.filter.all_statuses")}),["open","in_progress","completed","cancelled","draft"].map(e=>(0,s.jsx)("option",{value:e,children:ed("task.status.".concat(e),e)},e))]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-left",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.title")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.customer")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.status")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.budget")}),(0,s.jsx)("th",{className:"px-4 py-3 font-medium text-gray-600",children:ed("admin.col.created")}),(0,s.jsx)("th",{className:"px-4 py-3"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:nI?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:ed("common.loading")})}):0===eE.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:"—"})}):eE.map(e=>{var t,a;let l=e.task||e,n=e.customer;return(0,s.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"px-4 py-3 font-medium text-gray-800 max-w-xs",children:(0,s.jsx)(i(),{href:"/tasks/".concat(l.id),className:"hover:text-green-600 truncate block",target:"_blank",children:"en"===ec&&l.titleEn||"ru"===ec&&l.titleRu||"uk"===ec&&l.titleUk||l.titleEl||l.title})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 text-xs",children:null!=(t=null==n?void 0:n.name)?t:"—"}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(null!=(a=rx[l.status])?a:"bg-gray-100 text-gray-600"),children:ed("task.status.".concat(l.status),l.status)})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500",children:l.budget?"".concat((0,x.$g)(l.budget),"€"):"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-400",children:new Date(l.createdAt).toLocaleDateString(rc)}),(0,s.jsx)("td",{className:"px-4 py-3 text-right",children:(0,s.jsxs)("div",{className:"flex gap-1.5 justify-end",children:["cancelled"!==l.status&&"completed"!==l.status&&(0,s.jsx)("button",{onClick:()=>nX(l.id),className:"text-xs px-2.5 py-1 rounded-lg font-medium bg-yellow-50 text-yellow-700 hover:bg-yellow-100",children:ed("admin.tasks.cancel")}),(0,s.jsx)("button",{onClick:()=>nY(l.id,"en"===ec&&l.titleEn||"ru"===ec&&l.titleRu||"uk"===ec&&l.titleUk||l.titleEl||l.title),className:"text-xs px-2.5 py-1 rounded-lg font-medium bg-red-50 text-red-600 hover:bg-red-100",children:ed("admin.tasks.delete")})]})})]},l.id)})})]}),(0,s.jsx)(E,{page:eM,total:eB,limit:20,onChange:eA,totalLabel:ed("admin.pagination.total")})]})]}),"categories"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)("p",{className:"text-sm text-gray-500",children:ed("admin.cat.hint")}),(0,s.jsxs)("button",{onClick:()=>n0(null),className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700",children:["+ ",ed("admin.cat.add_root")]})]}),ss&&(0,s.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5 mb-4",children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-800 mb-4",children:[ss.id?ed("admin.cat.edit"):ed("admin.cat.new"),ss.parentId&&(0,s.jsxs)("span",{className:"text-xs text-gray-400 ml-2",children:["(",ed("admin.cat.subcategory"),")"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3 mb-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.cat.slug")}),(0,s.jsx)("input",{value:ss.slug,onChange:e=>sl(t=>t&&{...t,slug:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm",placeholder:"e.g. repairs"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.cat.icon")}),(0,s.jsx)(y,{value:ss.icon,onChange:e=>sl(t=>t&&{...t,icon:e}),onUpload:n1,uploading:sd,error:sm,presets:su})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.cat.order")}),(0,s.jsx)("input",{type:"number",value:ss.order,onChange:e=>sl(t=>t&&{...t,order:Number(e.target.value)}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_el")," \uD83C\uDDEC\uD83C\uDDF7"]}),(0,s.jsx)("input",{value:ss.namesEl,onChange:e=>sl(t=>t&&{...t,namesEl:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_en")," \uD83C\uDDEC\uD83C\uDDE7"]}),(0,s.jsx)("input",{value:ss.namesEn,onChange:e=>sl(t=>t&&{...t,namesEn:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_ru")," \uD83C\uDDF7\uD83C\uDDFA"]}),(0,s.jsx)("input",{value:ss.namesRu,onChange:e=>sl(t=>t&&{...t,namesRu:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_uk")," \uD83C\uDDFA\uD83C\uDDE6"]}),(0,s.jsx)("input",{value:ss.namesUk,onChange:e=>sl(t=>t&&{...t,namesUk:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]})]}),ss.id&&(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-700 mb-3",children:[(0,s.jsx)("input",{type:"checkbox",checked:ss.isActive,onChange:e=>sl(t=>t&&{...t,isActive:e.target.checked})}),ed("admin.cat.active")]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:n2,disabled:sn,className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:sn?ed("common.saving"):ed("common.save")}),(0,s.jsx)("button",{onClick:()=>sl(null),className:"px-4 py-2 bg-white border border-gray-300 text-gray-700 rounded-lg text-sm font-medium hover:bg-gray-50",children:ed("common.cancel")})]})]}),(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 divide-y divide-gray-100",children:0===st.length?(0,s.jsx)("div",{className:"px-4 py-8 text-center text-gray-400",children:ed("admin.cat.empty")}):(0,s.jsx)(C,{rows:st,parentId:null,depth:0,locale:ec,expanded:si,onToggle:function(e){so(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},onEdit:function(e){var t,a,s,l,n,r,i,o,d,c,m,x,u,g,p;let h="string"==typeof e.icon?e.icon:"",b=new Set(su.map(e=>e.value)),f=h.startsWith("/category-icons/")&&!b.has(h)?"/category-icons/package.svg":h||"/category-icons/package.svg";sx(null),sl({id:e.id,parentId:null!=(n=e.parentId)?n:null,slug:e.slug,icon:f,namesEl:null!=(i=null!=(r=e.namesEl)?r:null==(t=e.names)?void 0:t.el)?i:"",namesEn:null!=(d=null!=(o=e.namesEn)?o:null==(a=e.names)?void 0:a.en)?d:"",namesRu:null!=(m=null!=(c=e.namesRu)?c:null==(s=e.names)?void 0:s.ru)?m:"",namesUk:null!=(u=null!=(x=e.namesUk)?x:null==(l=e.names)?void 0:l.uk)?u:"",order:null!=(g=e.order)?g:0,isActive:null==(p=e.isActive)||p})},onDelete:n4,onAddChild:n0,skillsExpanded:sp,skillsCache:sb,skillsLoading:sy,onToggleSkills:n5,skillForm:sj,skillSaving:sk,onOpenAddSkill:function(e){sN({catSlug:e,nameEl:"",nameEn:"",nameRu:"",nameUk:"",order:0})},onOpenEditSkill:function(e,t){var a,s,l,n,r;sN({id:e.id,catSlug:t,nameEl:null!=(a=e.nameEl)?a:"",nameEn:null!=(s=e.nameEn)?s:"",nameRu:null!=(l=e.nameRu)?l:"",nameUk:null!=(n=e.nameUk)?n:"",order:null!=(r=e.order)?r:0})},onSaveSkill:n3,onDeleteSkill:n6,onCancelSkillForm:()=>sN(null),onSkillFormChange:sN,t:ed})})]}),"locations"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)("p",{className:"text-sm text-gray-500",children:ed("admin.loc.hint")}),(0,s.jsxs)("button",{onClick:()=>n$(null),className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700",children:["+ ",ed("admin.loc.add_city")]})]}),a3&&(0,s.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5 mb-4",children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-800 mb-4",children:[a3.id?ed("admin.loc.edit"):ed("admin.loc.new"),a3.parentId&&(0,s.jsxs)("span",{className:"text-xs text-gray-400 ml-2",children:["(",ed("admin.loc.district"),")"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.cat.slug")}),(0,s.jsx)("input",{value:a3.slug,onChange:e=>a6(t=>t&&{...t,slug:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm",placeholder:"e.g. athens-center"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_el")," \uD83C\uDDEC\uD83C\uDDF7"]}),(0,s.jsx)("input",{value:a3.nameEl,onChange:e=>a6(t=>t&&{...t,nameEl:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_en")," \uD83C\uDDEC\uD83C\uDDE7"]}),(0,s.jsx)("input",{value:a3.nameEn,onChange:e=>a6(t=>t&&{...t,nameEn:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_ru")," \uD83C\uDDF7\uD83C\uDDFA"]}),(0,s.jsx)("input",{value:a3.nameRu,onChange:e=>a6(t=>t&&{...t,nameRu:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ed("admin.cat.name_uk")," \uD83C\uDDFA\uD83C\uDDE6"]}),(0,s.jsx)("input",{value:a3.nameUk,onChange:e=>a6(t=>t&&{...t,nameUk:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,s.jsxs)("div",{className:"w-24",children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.cat.order")}),(0,s.jsx)("input",{type:"number",value:a3.order,onChange:e=>a6(t=>t&&{...t,order:Number(e.target.value)}),className:"w-full border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),a3.id&&(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-700 mt-4",children:[(0,s.jsx)("input",{type:"checkbox",checked:a3.isActive,onChange:e=>a6(t=>t&&{...t,isActive:e.target.checked})}),ed("admin.cat.active")]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:nQ,disabled:a7,className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:a7?ed("common.saving"):ed("common.save")}),(0,s.jsx)("button",{onClick:()=>a6(null),className:"px-4 py-2 bg-white border border-gray-300 text-gray-700 rounded-lg text-sm font-medium hover:bg-gray-50",children:ed("common.cancel")})]})]}),(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 divide-y divide-gray-100",children:0===a4.length?(0,s.jsx)("div",{className:"px-4 py-8 text-center text-gray-400",children:ed("admin.loc.empty")}):(0,s.jsx)(w,{rows:a4,parentId:null,depth:0,locale:ec,expanded:a9,onToggle:function(e){se(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},onEdit:function(e){var t,a,s,l,n,r,i,o,d,c,m,x,u,g,p;a6({id:e.id,parentId:null!=(n=e.parentId)?n:null,slug:e.slug,nameEl:null!=(i=null!=(r=e.nameEl)?r:null==(t=e.names)?void 0:t.el)?i:"",nameEn:null!=(d=null!=(o=e.nameEn)?o:null==(a=e.names)?void 0:a.en)?d:"",nameRu:null!=(m=null!=(c=e.nameRu)?c:null==(s=e.names)?void 0:s.ru)?m:"",nameUk:null!=(u=null!=(x=e.nameUk)?x:null==(l=e.names)?void 0:l.uk)?u:"",order:null!=(g=e.order)?g:0,isActive:null==(p=e.isActive)||p})},onDelete:nZ,onAddChild:n$,t:ed})})]}),"reports"===em&&(0,s.jsxs)("div",{className:"space-y-3",children:[nI?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("common.loading")}):0===eF.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.reports.none")}):eF.map(e=>{var t,a,l;return(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(null!=(a=ru[e.status])?a:"bg-gray-100 text-gray-500"),children:e.status}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(null!=(l=rg[e.reason])?l:"bg-gray-100 text-gray-600"),children:e.reason}),(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["task"===e.targetType?ed("admin.reports.target.task"):ed("admin.reports.target.user"),":"," ",e.targetTitle?(0,s.jsx)(i(),{href:"task"===e.targetType?"/tasks/".concat(e.targetId):"/users/".concat(e.targetId),className:"text-green-600 hover:underline font-medium",target:"_blank",children:e.targetTitle}):(0,s.jsxs)("span",{className:"font-mono",children:["#",null==(t=e.targetId)?void 0:t.slice(0,8)]})]})]}),e.reporterName&&(0,s.jsxs)("p",{className:"text-xs text-gray-400 mb-1",children:[ed("admin.col.reporter"),": ",(0,s.jsx)("span",{className:"font-medium text-gray-600",children:e.reporterName})]}),e.description&&(0,s.jsx)("p",{className:"text-sm text-gray-700",children:e.description}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1.5",children:new Date(e.createdAt).toLocaleString(rc)})]}),"pending"===e.status&&(0,s.jsxs)("div",{className:"flex gap-2 flex-shrink-0",children:[(0,s.jsx)("button",{onClick:()=>nJ(e.id,"reviewed"),className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-green-50 text-green-700 hover:bg-green-100",children:ed("admin.reports.reviewed")}),(0,s.jsx)("button",{onClick:()=>nJ(e.id,"dismissed"),className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-gray-100 text-gray-600 hover:bg-gray-200",children:ed("admin.reports.dismiss")})]})]})},e.id)}),(0,s.jsx)(E,{page:eV,total:eK,limit:20,onChange:eO,totalLabel:ed("admin.pagination.total")})]}),"moderation"===em&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("div",{className:"text-sm text-gray-500",children:ed("admin.moderation.pending_count","Pending")}),(0,s.jsx)("div",{className:"text-3xl font-bold text-gray-900 mt-1",children:rh.length}),(0,s.jsx)("div",{className:"text-xs text-gray-400 mt-1",children:ed("admin.moderation.pending_hint","New proposals waiting for approval")})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("div",{className:"text-sm text-gray-500",children:ed("admin.moderation.active_count","Active")}),(0,s.jsx)("div",{className:"text-3xl font-bold text-gray-900 mt-1",children:rb.length}),(0,s.jsx)("div",{className:"text-xs text-gray-400 mt-1",children:ed("admin.moderation.active_hint","Visible cards that can be blocked")})]})]}),e1?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("common.loading")}):0===eY.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.moderation.none","No specialist cards found")}):(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-3",children:ed("admin.moderation.pending_title","Pending approval")}),(0,s.jsx)("div",{className:"space-y-3",children:0===rh.length?(0,s.jsx)("div",{className:"text-sm text-gray-400 bg-white border border-dashed border-gray-200 rounded-xl p-4",children:ed("admin.moderation.pending_empty","No pending proposals right now")}):rh.map(e=>{var t,a,l;return(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-700",children:ed("admin.moderation.pending","Pending")}),(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-800 truncate",children:e.title})]}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:(0,s.jsx)(i(),{href:"/users/".concat(e.specialistId),className:"hover:text-green-600 hover:underline font-medium",children:null!=(a=null!=(t=e.specialistName)?t:e.specialistEmail)?a:e.specialistId})}),e.description&&(0,s.jsx)("p",{className:"text-sm text-gray-700 line-clamp-3",children:e.description}),(null!=(l=e.categorySuggestions)?l:[]).length>0&&(0,s.jsxs)("div",{className:"mt-3 border-t border-amber-100 pt-3 space-y-2",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-amber-800",children:ed("admin.moderation.category_suggestions","Requested categories")}),e.categorySuggestions.map(t=>{var a,l,n;return(0,s.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-2.5",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-gray-800",children:t.name}),(0,s.jsxs)("div",{className:"mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]",children:[(0,s.jsxs)("select",{value:null!=(l=e3[t.id])?l:"",onChange:e=>e6(a=>({...a,[t.id]:e.target.value})),className:"min-w-0 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-700",children:[(0,s.jsx)("option",{value:"",children:ed("admin.moderation.map_category","Map to existing category")}),st.map(e=>(0,s.jsx)("option",{value:e.id,children:b(e,ec)},e.id))]}),(0,s.jsx)("button",{onClick:()=>nG(e.id,t,"map"),disabled:!e3[t.id]||e9===t.id,className:"rounded-lg bg-green-600 px-2.5 py-1.5 text-xs font-medium text-white disabled:opacity-50",children:ed("admin.moderation.map","Map")}),(0,s.jsx)("button",{onClick:()=>nG(e.id,t,"reject"),disabled:e9===t.id,className:"rounded-lg bg-white px-2.5 py-1.5 text-xs font-medium text-gray-600 ring-1 ring-gray-300 disabled:opacity-50",children:ed("admin.moderation.reject","Reject")})]}),(0,s.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,s.jsx)("input",{value:null!=(n=e7[t.id])?n:"",onChange:e=>e8(a=>({...a,[t.id]:e.target.value})),placeholder:ed("admin.moderation.new_category_slug","New category slug"),className:"min-w-0 flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-700"}),(0,s.jsx)("button",{onClick:()=>nG(e.id,t,"create"),disabled:!(null==(a=e7[t.id])?void 0:a.trim())||e9===t.id,className:"rounded-lg bg-amber-600 px-2.5 py-1.5 text-xs font-medium text-white disabled:opacity-50",children:ed("admin.moderation.create_category","Create category")})]})]},t.id)})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-shrink-0",children:[(0,s.jsx)("button",{onClick:()=>nq(e.id,"active"),className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-green-600 text-white hover:bg-green-700",children:ed("admin.moderation.approve","Approve")}),(0,s.jsx)("button",{onClick:()=>nq(e.id,"inactive"),className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-gray-100 text-gray-700 hover:bg-gray-200",children:ed("admin.moderation.block","Block")})]})]})},e.id)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-3",children:ed("admin.moderation.active_title","Active cards")}),(0,s.jsx)("div",{className:"space-y-3",children:0===rb.length?(0,s.jsx)("div",{className:"text-sm text-gray-400 bg-white border border-dashed border-gray-200 rounded-xl p-4",children:ed("admin.moderation.active_empty","No active cards found")}):rb.map(e=>{var t,a;return(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700",children:ed("admin.moderation.active","Active")}),(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-800 truncate",children:e.title})]}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:(0,s.jsx)(i(),{href:"/users/".concat(e.specialistId),className:"hover:text-green-600 hover:underline font-medium",children:null!=(a=null!=(t=e.specialistName)?t:e.specialistEmail)?a:e.specialistId})}),e.description&&(0,s.jsx)("p",{className:"text-sm text-gray-700 line-clamp-3",children:e.description})]}),(0,s.jsx)("button",{onClick:()=>nq(e.id,"inactive"),className:"px-3 py-1.5 rounded-lg text-xs font-medium bg-red-50 text-red-700 hover:bg-red-100",children:ed("admin.moderation.block","Block")})]})},e.id)})})]}),(0,s.jsx)(E,{page:e$,total:eZ,limit:20,onChange:eQ,totalLabel:ed("admin.pagination.total")})]})]}),"logs"===em&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex gap-1 bg-gray-100 rounded-xl p-1 mb-5 w-fit",children:[{key:"ai",label:ed("admin.logs.subtab.ai")},{key:"activity",label:ed("admin.logs.subtab.activity")},{key:"mail",label:ed("admin.logs.subtab.mail")},{key:"notifications",label:ed("admin.logs.subtab.notifications")}].map(e=>{let{key:t,label:a}=e;return(0,s.jsx)("button",{onClick:()=>t5(t),className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(t4===t?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"),children:a},t)})}),"ai"===t4&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-500",children:[ed("admin.pagination.total"),": ",tC]}),(0,s.jsxs)("button",{onClick:()=>{tw(1),c.j_(1).then(e=>{tN(e.data),t_(e.total)}).catch(()=>{})},className:"text-xs px-3 py-1.5 rounded-lg bg-gray-100 text-gray-600 hover:bg-gray-200 flex items-center gap-1.5",children:[(0,s.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("polyline",{points:"23 4 23 10 17 10"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),ed("common.refresh")]})]}),nI?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("common.loading")}):0===tj.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.logs.empty")}):(0,s.jsx)("div",{className:"overflow-x-auto rounded-xl border border-gray-200",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.date")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.provider")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.model")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.action")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.langs")}),(0,s.jsx)("th",{className:"px-4 py-3 text-right",children:ed("admin.logs.in")}),(0,s.jsx)("th",{className:"px-4 py-3 text-right",children:ed("admin.logs.out")}),(0,s.jsx)("th",{className:"px-4 py-3 text-right",children:ed("admin.logs.total")}),(0,s.jsx)("th",{className:"px-4 py-3 text-right",children:ed("admin.logs.ms")}),(0,s.jsx)("th",{className:"px-4 py-3 text-center",children:ed("admin.logs.status")})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:tj.map(e=>{var t,a,l,n,r;return(0,s.jsxs)("tr",{className:"bg-white hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleString(rc)}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat("anthropic"===e.provider?"bg-purple-100 text-purple-700":"bg-green-100 text-green-700"),children:e.provider})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600 font-mono text-xs",children:e.model}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600",children:e.action}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500",children:e.fromLocale&&e.toLocale?"".concat(e.fromLocale," → ").concat(e.toLocale):"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-right text-gray-600",children:null!=(t=e.inputTokens)?t:"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-right text-gray-600",children:null!=(a=e.outputTokens)?a:"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-right font-medium",children:null!=(l=e.totalTokens)?l:"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-right text-gray-500",children:null!=(n=e.durationMs)?n:"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-center",children:e.success?(0,s.jsx)("span",{className:"text-green-600 flex justify-center",children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})}):(0,s.jsx)("span",{className:"text-red-500 flex justify-center",title:null!=(r=e.error)?r:"",children:(0,s.jsxs)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]},e.id)})})]})}),(0,s.jsx)(E,{page:tk,total:tC,limit:50,onChange:tw,totalLabel:ed("admin.pagination.total")})]}),"activity"===t4&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-4 mb-4 flex flex-wrap gap-3 items-end",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.activity.event")}),(0,s.jsxs)("select",{value:tB,onChange:e=>tT(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm min-w-[180px]",children:[(0,s.jsx)("option",{value:"",children:ed("admin.activity.all_events")}),tF.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.activity.from")}),(0,s.jsx)("input",{type:"date",value:tR,onChange:e=>tP(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.activity.to")}),(0,s.jsx)("input",{type:"date",value:tW,onChange:e=>tz(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(tB||tR||tW||tI)&&(0,s.jsxs)("button",{onClick:()=>{tT(""),tP(""),tz(""),tU("")},className:"text-xs px-3 py-1.5 rounded-lg bg-gray-100 text-gray-500 hover:bg-gray-200 self-end flex items-center gap-1.5",children:[(0,s.jsxs)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),ed("admin.activity.reset")]}),(0,s.jsxs)("p",{className:"text-xs text-gray-400 self-end ml-auto",children:[ed("admin.activity.total"),": ",tE]})]}),0===tS.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.activity.empty")}):(0,s.jsx)("div",{className:"space-y-2",children:tS.map(e=>(0,s.jsx)(A,{entry:e,dateLocale:rc,onFilterUser:e=>{tU(e),tT("")},t:ed},e.id))}),(0,s.jsx)(E,{page:tM,total:tE,limit:50,onChange:tA,totalLabel:ed("admin.pagination.total")})]}),"mail"===t4&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-4 mb-4 flex flex-wrap gap-3 items-end",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.mail.event")}),(0,s.jsxs)("select",{value:tY,onChange:e=>tJ(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm min-w-[200px]",children:[(0,s.jsx)("option",{value:"",children:ed("admin.mail.all_events")}),t1.map(e=>(0,s.jsx)("option",{value:e,children:ed("admin.event.".concat(e.replace(/\./g,"_")),e)},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.mail.from")}),(0,s.jsx)("input",{type:"date",value:t$,onChange:e=>tQ(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.mail.to")}),(0,s.jsx)("input",{type:"date",value:tZ,onChange:e=>t0(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(tY||t$||tZ)&&(0,s.jsxs)("button",{onClick:()=>{tJ(""),tQ(""),t0("")},className:"text-xs px-3 py-1.5 rounded-lg bg-gray-100 text-gray-500 hover:bg-gray-200 self-end flex items-center gap-1.5",children:[(0,s.jsxs)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),ed("admin.mail.reset")]}),(0,s.jsxs)("p",{className:"text-xs text-gray-400 self-end ml-auto",children:[ed("admin.mail.total"),": ",tK]})]}),0===tV.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.mail.empty")}):(0,s.jsx)("div",{className:"overflow-x-auto rounded-xl border border-gray-200",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.date")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.mail.recipient")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.mail.event")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.mail.provider")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.mail.details")}),(0,s.jsx)("th",{className:"px-4 py-3 text-center",children:ed("admin.mail.status")})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:tV.map(e=>{let t=D(e.details),a="string"==typeof(null==t?void 0:t.provider)?t.provider:"—",l="string"==typeof(null==t?void 0:t.to)?t.to:e.userEmail||"—",n="string"==typeof(null==t?void 0:t.subject)?t.subject:"",r="string"==typeof(null==t?void 0:t.error)?t.error:"",i="email.sent"===e.event||"admin.email.test.sent"===e.event;return(0,s.jsxs)("tr",{className:"bg-white hover:bg-gray-50 align-top",children:[(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleString(rc)}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-700",children:l}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-sky-50 text-sky-700",children:ed("admin.event.".concat(e.event.replace(/\./g,"_")),e.event)})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600",children:a}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600 max-w-md",children:(0,s.jsx)("div",{className:"truncate",title:n||r||void 0,children:n||r||"—"})}),(0,s.jsx)("td",{className:"px-4 py-3 text-center",children:i?(0,s.jsx)("span",{className:"text-green-600 inline-flex justify-center",title:ed("admin.mail.success"),children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})}):(0,s.jsx)("span",{className:"text-red-500 inline-flex justify-center",title:r||ed("admin.mail.failed"),children:(0,s.jsxs)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]},e.id)})})]})}),(0,s.jsx)(E,{page:tG,total:tK,limit:50,onChange:tX,totalLabel:ed("admin.pagination.total")})]}),"notifications"===t4&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-4 mb-4 flex flex-wrap gap-3 items-end",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.notif_logs.type")}),(0,s.jsxs)("select",{value:at,onChange:e=>aa(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm min-w-[200px]",children:[(0,s.jsx)("option",{value:"",children:ed("admin.filter.all")}),as.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.activity.from")}),(0,s.jsx)("input",{type:"date",value:an,onChange:e=>ar(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.activity.to")}),(0,s.jsx)("input",{type:"date",value:ai,onChange:e=>ao(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm"})]}),(at||an||ai)&&(0,s.jsxs)("button",{onClick:()=>{aa(""),ar(""),ao("")},className:"text-xs px-3 py-1.5 rounded-lg bg-gray-100 text-gray-500 hover:bg-gray-200 self-end flex items-center gap-1.5",children:[(0,s.jsxs)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),ed("admin.activity.reset")]}),(0,s.jsxs)("p",{className:"text-xs text-gray-400 self-end ml-auto",children:[ed("admin.pagination.total"),": ",t9]})]}),0===t3.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.notif_logs.empty")}):(0,s.jsx)("div",{className:"overflow-x-auto rounded-xl border border-gray-200",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-gray-500 text-xs uppercase",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.logs.date")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.col.user")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.notif_logs.type")}),(0,s.jsx)("th",{className:"px-4 py-3 text-left",children:ed("admin.notif_logs.title")}),(0,s.jsx)("th",{className:"px-4 py-3 text-center",children:ed("admin.notif_logs.read")})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:t3.map(e=>{var t,a;return(0,s.jsxs)("tr",{className:"bg-white hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleString(rc)}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-700",children:null!=(a=null!=(t=e.recipientName)?t:e.recipientEmail)?a:e.recipientId}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700",children:e.type})}),(0,s.jsx)("td",{className:"px-4 py-3 text-gray-600 max-w-xs truncate",children:e.title}),(0,s.jsx)("td",{className:"px-4 py-3 text-center",children:e.isRead?(0,s.jsx)("span",{className:"text-green-600 flex justify-center",children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})}):(0,s.jsx)("span",{className:"text-gray-400 flex justify-center",children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"})})})})]},e.id)})})]})}),(0,s.jsx)(E,{page:t7,total:t9,limit:50,onChange:t8,totalLabel:ed("admin.pagination.total")})]})]}),"plans"===em&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,s.jsxs)("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,s.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),(0,s.jsx)("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]}),ed("admin.plans.title")]}),(0,s.jsx)("button",{onClick:function(){a0({name:"",description:"",role:"customer",tier:"free",price:"0",oldPrice:"",currency:"EUR",maxTasks:"",maxOffers:"",maxCards:"",maxMessagesPerDay:"",maxOrdersPerDay:"",maxSkills:"",durationDays:"",searchBoost:0,offersMultiplier:"1.00",features:"",isDefault:!1,isActive:!0,order:0,notifyNewTasks:!1,canContactFreePlan:!1,canContactProPlan:!0,canContactAll:!1,canShowContactInfo:!1,canViewPhone:!1,canUploadVideo:!1,hasFavorites:!1,hasGoogleCalendar:!1,hasVerifiedBadge:!1,highlightedReviews:!1,hasPersonalSite:!1,hasCanHelpNowStatus:!1,hasNeedHelpStatus:!1,hasAutoResponse:!1,hasAutoMatch:!1,hasPriceList:!1,receiveInstantDispatchFree:!1,receiveInstantDispatchPro:!1})},className:"bg-green-600 text-white text-sm px-4 py-2 rounded-lg hover:bg-green-700 font-medium",children:ed("admin.plans.add")})]}),aZ&&(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-xl p-5 mb-4 space-y-3",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800",children:aZ.id?ed("admin.plans.form.edit"):ed("admin.plans.form.new")}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.name")}),(0,s.jsx)("input",{value:aZ.name,onChange:e=>a0({...aZ,name:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.price")}),(0,s.jsx)("input",{type:"number",min:"0",step:"0.01",value:aZ.price,onChange:e=>a0({...aZ,price:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.old_price")}),(0,s.jsx)("input",{type:"number",min:"0",step:"0.01",value:null!=(r=aZ.oldPrice)?r:"",onChange:e=>a0({...aZ,oldPrice:e.target.value}),placeholder:"—",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.tier")}),(0,s.jsxs)("select",{value:aZ.tier,onChange:e=>a0({...aZ,tier:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"free",children:ed("admin.plans.form.tier.free")}),(0,s.jsx)("option",{value:"pro",children:ed("admin.plans.form.tier.pro")}),(0,s.jsx)("option",{value:"ultimate",children:ed("admin.plans.form.tier.ultimate")})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.description")}),(0,s.jsx)("input",{value:aZ.description,onChange:e=>a0({...aZ,description:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide pt-1",children:ed("admin.plans.form.section.limits")}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_tasks")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxTasks,onChange:e=>a0({...aZ,maxTasks:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_offers")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxOffers,onChange:e=>a0({...aZ,maxOffers:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_cards")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxCards,onChange:e=>a0({...aZ,maxCards:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_messages_day")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxMessagesPerDay,onChange:e=>a0({...aZ,maxMessagesPerDay:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_orders_day")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxOrdersPerDay,onChange:e=>a0({...aZ,maxOrdersPerDay:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.max_skills")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.maxSkills,onChange:e=>a0({...aZ,maxSkills:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.duration_days")}),(0,s.jsx)("input",{type:"number",min:"0",placeholder:"∞",value:aZ.durationDays,onChange:e=>a0({...aZ,durationDays:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide pt-1",children:ed("admin.plans.form.section.boost")}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.search_boost")}),(0,s.jsx)("input",{type:"number",min:"0",value:aZ.searchBoost,onChange:e=>a0({...aZ,searchBoost:Number(e.target.value)}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.offers_multiplier")}),(0,s.jsx)("input",{type:"number",min:"0",step:"0.01",value:aZ.offersMultiplier,onChange:e=>a0({...aZ,offersMultiplier:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.plans.form.features")}),(0,s.jsx)("textarea",{rows:3,value:aZ.features,onChange:e=>a0({...aZ,features:e.target.value}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]}),(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide pt-1",children:ed("admin.plans.form.section.contact")}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[["canContactFreePlan",ed("admin.plans.form.can_contact_free")],["canContactProPlan",ed("admin.plans.form.can_contact_pro")],["canContactAll",ed("admin.plans.form.can_contact_all")],["canShowContactInfo",ed("admin.plans.form.can_show_contact")],["canViewPhone",ed("admin.plans.form.can_view_phone")]].map(e=>{let[t,a]=e;return(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-gray-700",children:[(0,s.jsx)("input",{type:"checkbox",checked:aZ[t],onChange:e=>a0({...aZ,[t]:e.target.checked}),className:"w-4 h-4 rounded text-green-600"}),a]},t)})}),(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide pt-1",children:ed("admin.plans.form.section.features")}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[["notifyNewTasks",ed("admin.plans.form.notify")],["canUploadVideo",ed("admin.plans.form.upload_video")],["hasFavorites",ed("admin.plans.form.favorites")],["hasGoogleCalendar",ed("admin.plans.form.google_calendar")],["hasVerifiedBadge",ed("admin.plans.form.verified_badge")],["highlightedReviews",ed("admin.plans.form.highlighted_reviews")],["hasPersonalSite",ed("admin.plans.form.personal_site")],["hasCanHelpNowStatus",ed("admin.plans.form.can_help_now")],["hasNeedHelpStatus",ed("admin.plans.form.need_help")],["hasAutoResponse",ed("admin.plans.form.auto_response")],["hasAutoMatch",ed("admin.plans.form.auto_match")],["hasPriceList",ed("admin.plans.form.price_list")],["receiveInstantDispatchFree",ed("admin.plans.form.instant_dispatch_free")],["receiveInstantDispatchPro",ed("admin.plans.form.instant_dispatch_pro")]].map(e=>{let[t,a]=e;return(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-gray-700",children:[(0,s.jsx)("input",{type:"checkbox",checked:aZ[t],onChange:e=>a0({...aZ,[t]:e.target.checked}),className:"w-4 h-4 rounded text-green-600"}),a]},t)})}),(0,s.jsxs)("div",{className:"flex items-center gap-6 pt-1",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-gray-700",children:[(0,s.jsx)("input",{type:"checkbox",checked:aZ.isDefault,onChange:e=>a0({...aZ,isDefault:e.target.checked}),className:"w-4 h-4 rounded text-green-600"}),ed("admin.plans.form.default")]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-gray-700",children:[(0,s.jsx)("input",{type:"checkbox",checked:aZ.isActive,onChange:e=>a0({...aZ,isActive:e.target.checked}),className:"w-4 h-4 rounded text-green-600"}),ed("admin.plans.form.active")]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("label",{className:"text-xs text-gray-600",children:ed("admin.plans.form.order")}),(0,s.jsx)("input",{type:"number",value:aZ.order,onChange:e=>a0({...aZ,order:Number(e.target.value)}),className:"w-16 border border-gray-300 rounded-lg px-2 py-1 text-sm focus:outline-none"})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{onClick:n7,disabled:a1||!aZ.name,className:"bg-green-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:a1?"...":ed("common.save")}),(0,s.jsx)("button",{onClick:()=>a0(null),className:"px-4 py-2 rounded-lg text-sm font-medium text-gray-600 hover:bg-gray-100",children:ed("common.cancel")})]})]}),(0,s.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:0===a$.length?(0,s.jsx)("div",{className:"px-4 py-8 text-center text-gray-400 text-sm",children:ed("admin.plans.empty")}):(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:a$.sort((e,t)=>{var a,s;return(null!=(a=e.order)?a:0)-(null!=(s=t.order)?s:0)}).map(e=>{var t;return(0,s.jsxs)("div",{className:"flex items-start gap-4 px-4 py-4 ".concat(e.isActive?"":"opacity-50"),children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-900",children:e.name}),e.isDefault&&(0,s.jsx)("span",{className:"bg-green-100 text-green-700 text-xs px-2 py-0.5 rounded-full font-medium",children:ed("admin.plans.badge.default")}),!e.isActive&&(0,s.jsx)("span",{className:"bg-gray-100 text-gray-500 text-xs px-2 py-0.5 rounded-full",children:ed("admin.plans.badge.inactive")})]}),e.description&&(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:e.description}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 mt-1 text-xs text-gray-500",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5 font-semibold text-gray-800",children:[e.oldPrice&&(0,s.jsxs)("span",{className:"font-normal text-gray-400 line-through",children:[e.oldPrice," ",e.currency]}),(0,s.jsxs)("span",{children:[e.price," ",e.currency]})]}),null!=e.maxTasks&&(0,s.jsxs)("span",{children:[ed("admin.plans.tasks"),": ",e.maxTasks]}),null!=e.maxOffers&&(0,s.jsxs)("span",{children:[ed("admin.plans.offers"),": ",e.maxOffers]}),null!=e.maxCards&&(0,s.jsxs)("span",{children:[ed("admin.plans.cards"),": ",e.maxCards]}),e.notifyNewTasks&&(0,s.jsxs)("span",{className:"text-green-700 flex items-center gap-1",children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),ed("admin.plans.notify_tasks")]})]}),(null!=(t=e.features)?t:[]).length>0&&(0,s.jsx)("ul",{className:"mt-1.5 space-y-0.5",children:e.features.map((e,t)=>(0,s.jsxs)("li",{className:"text-xs text-gray-600 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-green-500",children:(0,s.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})})," ",e]},t))})]}),(0,s.jsxs)("div",{className:"flex gap-1 shrink-0",children:[!e.isDefault&&(0,s.jsx)("button",{onClick:()=>c.td(e.id,{isDefault:!0}).then(()=>c.OX().then(aQ)).catch(()=>{}),className:"text-xs px-2 py-1 rounded-lg bg-green-50 text-green-600 hover:bg-green-100 font-medium",title:ed("admin.plans.make_default"),children:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),(0,s.jsx)("button",{onClick:()=>{var t,a,s,l,n,r,i,o,d,c,m,x,u,g,p,h,b,f,y,v,j,N,k,w,C,_,S,L,E,D,M;a0({id:e.id,name:e.name,description:null!=(t=e.description)?t:"",role:null!=(a=e.role)?a:"customer",tier:null!=(s=e.tier)?s:"free",price:null!=(l=e.price)?l:"0",oldPrice:null!=(n=e.oldPrice)?n:"",currency:null!=(r=e.currency)?r:"EUR",maxTasks:null!=e.maxTasks?String(e.maxTasks):"",maxOffers:null!=e.maxOffers?String(e.maxOffers):"",maxCards:null!=e.maxCards?String(e.maxCards):"",maxMessagesPerDay:null!=e.maxMessagesPerDay?String(e.maxMessagesPerDay):"",maxOrdersPerDay:null!=e.maxOrdersPerDay?String(e.maxOrdersPerDay):"",maxSkills:null!=e.maxSkills?String(e.maxSkills):"",durationDays:null!=e.durationDays?String(e.durationDays):"",searchBoost:null!=(i=e.searchBoost)?i:0,offersMultiplier:null!=(o=e.offersMultiplier)?o:"1.00",features:(null!=(d=e.features)?d:[]).join("\n"),isDefault:null!=(c=e.isDefault)&&c,isActive:null==(m=e.isActive)||m,order:null!=(x=e.order)?x:0,notifyNewTasks:null!=(u=e.notifyNewTasks)&&u,canContactFreePlan:null!=(g=e.canContactFreePlan)&&g,canContactProPlan:null==(p=e.canContactProPlan)||p,canContactAll:null!=(h=e.canContactAll)&&h,canShowContactInfo:null!=(b=e.canShowContactInfo)&&b,canViewPhone:null!=(f=e.canViewPhone)&&f,canUploadVideo:null!=(y=e.canUploadVideo)&&y,hasFavorites:null!=(v=e.hasFavorites)&&v,hasGoogleCalendar:null!=(j=e.hasGoogleCalendar)&&j,hasVerifiedBadge:null!=(N=e.hasVerifiedBadge)&&N,highlightedReviews:null!=(k=e.highlightedReviews)&&k,hasPersonalSite:null!=(w=e.hasPersonalSite)&&w,hasCanHelpNowStatus:null!=(C=e.hasCanHelpNowStatus)&&C,hasNeedHelpStatus:null!=(_=e.hasNeedHelpStatus)&&_,hasAutoResponse:null!=(S=e.hasAutoResponse)&&S,hasAutoMatch:null!=(L=e.hasAutoMatch)&&L,hasPriceList:null!=(E=e.hasPriceList)&&E,receiveInstantDispatchFree:null!=(D=e.receiveInstantDispatchFree)&&D,receiveInstantDispatchPro:null!=(M=e.receiveInstantDispatchPro)&&M})},className:"text-xs px-2 py-1 rounded-lg bg-gray-100 text-gray-600 hover:bg-gray-200 font-medium",children:ed("common.edit")}),(0,s.jsx)("button",{onClick:()=>n8(e.id,e.name),className:"text-xs px-2 py-1 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 font-medium",children:ed("common.delete")})]})]},e.id)})})})]}),"settings"===em&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex gap-1 mb-6 bg-white rounded-xl border border-gray-200 p-1 w-fit",children:["general","smtp","notifications","payment","referral","seo","socials","telegram"].map(e=>{let t={general:ed("admin.settings.tab.general"),smtp:ed("admin.settings.tab.smtp"),notifications:ed("admin.settings.tab.notifications"),payment:ed("admin.settings.tab.payment"),referral:ed("admin.settings.tab.referral"),seo:ed("admin.settings.tab.seo"),socials:ed("admin.settings.tab.socials"),telegram:ed("admin.settings.tab.telegram")};return(0,s.jsx)("button",{onClick:()=>s_(e),className:"px-4 py-2 rounded-lg text-sm font-medium transition ".concat(sC===e?"bg-green-600 text-white shadow-sm":"text-gray-600 hover:bg-gray-100"),children:t[e]},e)})}),"general"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-5",children:ed("admin.settings.general.title")}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.general.site_name")}),(0,s.jsx)("input",{value:sS.siteName,onChange:e=>sL(t=>({...t,siteName:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"CanHelp"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.general.site_url")}),(0,s.jsx)("input",{value:sS.siteUrl,onChange:e=>sL(t=>({...t,siteUrl:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"https://canhelp.com"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.general.contact_email")}),(0,s.jsx)("input",{type:"email",value:sS.contactEmail,onChange:e=>sL(t=>({...t,contactEmail:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"contact@canhelp.com"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.general.support_phone")}),(0,s.jsx)("input",{value:sS.supportPhone,onChange:e=>sL(t=>({...t,supportPhone:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"+30 21 000 0000"})]}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 rounded-lg border border-gray-200 px-3 py-3",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-gray-700",children:ed("admin.settings.general.show_pricing")}),(0,s.jsx)("span",{className:"mt-0.5 block text-xs text-gray-500",children:ed("admin.settings.general.show_pricing_hint")})]}),(0,s.jsx)("input",{type:"checkbox",checked:sS.showPricing,onChange:e=>sL(t=>({...t,showPricing:e.target.checked})),className:"h-5 w-5 accent-green-600"})]}),(0,s.jsx)("button",{onClick:n9,disabled:sE,className:"w-full py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50 transition",children:sE?ed("admin.settings.saving"):sM?ed("admin.settings.saved"):ed("common.save")})]})]}),"smtp"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-1",children:ed("admin.settings.smtp.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mb-5",children:ed("admin.settings.smtp.hint")}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{className:"col-span-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.host")}),(0,s.jsx)("input",{value:sB.host,onChange:e=>sT(t=>({...t,host:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"smtp.gmail.com"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.port")}),(0,s.jsx)("input",{value:sB.port,onChange:e=>sT(t=>({...t,port:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"587"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.encryption")}),(0,s.jsxs)("select",{value:sB.encryption,onChange:e=>sT(t=>({...t,encryption:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"none",children:ed("admin.settings.smtp.enc.none")}),(0,s.jsx)("option",{value:"tls",children:"STARTTLS (587)"}),(0,s.jsx)("option",{value:"ssl",children:"SSL/TLS (465)"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.username")}),(0,s.jsx)("input",{value:sB.username,onChange:e=>sT(t=>({...t,username:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"user@gmail.com",autoComplete:"off"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.password")}),(0,s.jsx)("input",{type:"password",value:sB.password,onChange:e=>sT(t=>({...t,password:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",autoComplete:"new-password",placeholder:"••••••••••••"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.from_name")}),(0,s.jsx)("input",{value:sB.fromName,onChange:e=>sT(t=>({...t,fromName:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"CanHelp"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.smtp.from_email")}),(0,s.jsx)("input",{type:"email",value:sB.fromEmail,onChange:e=>sT(t=>({...t,fromEmail:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",placeholder:"noreply@canhelp.com"})]})]}),(0,s.jsx)("button",{onClick:re,disabled:sI,className:"w-full py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50 transition",children:sI?ed("admin.settings.saving"):sR?ed("admin.settings.saved"):ed("common.save")}),(0,s.jsx)("button",{onClick:async()=>{sz(!0),sH(null);try{let e=await c.FI();sH("✓ Sent to ".concat(e.to))}catch(e){sH("✗ Error: ".concat(e.message))}finally{sz(!1),setTimeout(()=>sH(null),5e3)}},disabled:sW,className:"w-full py-2 bg-gray-100 text-gray-700 rounded-lg text-sm font-medium hover:bg-gray-200 disabled:opacity-50 transition",children:sW?ed("admin.settings.smtp.sending"):(0,s.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),ed("admin.settings.smtp.test")]})}),sF&&(0,s.jsx)("p",{className:"text-sm text-center font-medium ".concat(sF.startsWith("✓")?"text-green-600":"text-red-500"),children:sF})]})]}),"payment"===sC&&(0,s.jsxs)("div",{className:"space-y-6 max-w-lg",children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[#003087] flex items-center justify-center text-white text-xs font-bold shrink-0",children:"PB"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800",children:"ePay — Piraeus Bank"}),(0,s.jsx)("p",{className:"text-xs text-gray-400",children:"Греческий платёжный шлюз"})]})]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("span",{className:"text-sm text-gray-500",children:ed("admin.settings.active")}),(0,s.jsx)("button",{type:"button",onClick:()=>s0(e=>({...e,enabled:!e.enabled})),className:"relative w-10 h-6 rounded-full p-0 transition-colors cursor-pointer ".concat(sZ.enabled?"bg-green-600":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute left-0 top-1 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(sZ.enabled?"translate-x-5":"translate-x-1")})})]})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.env.label")}),(0,s.jsxs)("select",{value:sZ.environment,onChange:e=>s0(t=>({...t,environment:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"test",children:ed("admin.settings.env.test")}),(0,s.jsx)("option",{value:"production",children:ed("admin.settings.env.prod")})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.merchant_id")}),(0,s.jsx)("input",{value:sZ.merchantId,onChange:e=>s0(t=>({...t,merchantId:e.target.value})),placeholder:ed("admin.settings.merchant_id"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"API User"}),(0,s.jsx)("input",{value:sZ.apiUser,onChange:e=>s0(t=>({...t,apiUser:e.target.value})),autoComplete:"off",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"API Password"}),(0,s.jsx)("input",{type:"password",value:sZ.apiPassword,onChange:e=>s0(t=>({...t,apiPassword:e.target.value})),autoComplete:"new-password",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Confirmation URL (webhook)"}),(0,s.jsx)("input",{value:sZ.confirmationUrl,onChange:e=>s0(t=>({...t,confirmationUrl:e.target.value})),placeholder:"https://yoursite.com/api/payments/epay/confirm",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Cancel URL"}),(0,s.jsx)("input",{value:sZ.cancelUrl,onChange:e=>s0(t=>({...t,cancelUrl:e.target.value})),placeholder:"https://yoursite.com/payment/cancelled",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-5",children:[(0,s.jsx)("button",{onClick:rs,disabled:s1,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:s1?ed("admin.settings.saving"):ed("common.save")}),s4&&(0,s.jsx)("span",{className:"text-sm text-green-600",children:ed("admin.settings.saved")})]})]}),(0,s.jsxs)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-xl text-xs text-amber-700 flex items-start gap-2",children:[(0,s.jsxs)("svg",{className:"w-4 h-4 shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,s.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,s.jsx)("span",{children:ed("admin.settings.payment.hint")})]})]}),"notifications"===sC&&(0,s.jsxs)("div",{className:"space-y-3 max-w-2xl",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 mb-4 p-3 bg-green-50 border border-green-100 rounded-xl text-sm text-green-700",children:[(0,s.jsxs)("svg",{className:"w-4 h-4 shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,s.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,s.jsxs)("p",{children:[ed("admin.notif.vars_hint")," ",p.map(e=>{let t="{{".concat(e,"}}");return(0,s.jsx)("code",{className:"mx-0.5 bg-green-100 text-gray-800 px-1.5 py-0.5 rounded text-xs font-mono",children:t},t)})]})]}),[{key:"email_verification",label:ed("admin.notif.email_verification"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})},{key:"registration_success",label:ed("admin.notif.registration_success"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})},{key:"password_reset",label:ed("admin.notif.password_reset"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-amber-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})})},{key:"new_offer",label:ed("admin.notif.new_offer"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-purple-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})},{key:"new_task",label:ed("admin.notif.new_task"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-indigo-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})},{key:"offer_accepted",label:ed("admin.notif.offer_accepted"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})},{key:"new_message",label:ed("admin.notif.new_message"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-pink-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})},{key:"offer_declined",label:ed("admin.notif.offer_declined"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-red-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})},{key:"offer_other_accepted",label:ed("admin.notif.offer_other_accepted"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})})},{key:"task_updated",label:ed("admin.notif.task_updated"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})},{key:"deadline_reminder",label:ed("admin.notif.deadline_reminder"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-yellow-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})},{key:"task_archived",label:ed("admin.notif.task_archived"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8l1 12a2 2 0 002 2h8a2 2 0 002-2l1-12M10 12v6m4-6v6"})})},{key:"referral_reward",label:ed("admin.notif.referral_reward"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-emerald-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v13m0-13V6a2 2 0 112.83 2.83l-2.83 2.83zm0 0V5.5A2.5 2.5 0 119.27 8H12zm-7 4h14M5 12a2 2 0 110-4h3.586a1 1 0 01.707.293l2.414 2.414M19 12a2 2 0 110-4h-3.586a1 1 0 00-.707.293l-2.414 2.414"})})},{key:"plan_activated",label:ed("admin.email_template.plan_activated"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})},{key:"plan_upgraded",label:ed("admin.email_template.plan_upgraded"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 10l7-7m0 0l7 7m-7-7v18"})})},{key:"plan_downgrade_scheduled",label:ed("admin.email_template.plan_downgrade_scheduled"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-orange-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})},{key:"plan_downgrade_applied",label:ed("admin.email_template.plan_downgrade_applied"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})},{key:"plan_renewal_reminder",label:ed("admin.email_template.plan_renewal_reminder"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-yellow-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})})},{key:"plan_insufficient_funds",label:ed("admin.email_template.plan_insufficient_funds"),icon:(0,s.jsx)("svg",{className:"w-5 h-5 text-red-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}].map(e=>{var t,a,l;let{key:n,label:r,icon:i}=e,o="".concat(n,"_").concat(sG),d=null!=(a=null!=(t=sV[o])?t:sV[n])?a:{subject:"",body:""},c=sK===n,m=null!=(l=g[n])?l:[];return(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-5 py-4 cursor-pointer hover:bg-gray-50 select-none",onClick:()=>sq(c?null:n),children:[(0,s.jsx)("span",{className:"text-xl shrink-0",children:i}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"font-medium text-gray-800 text-sm",children:r}),d.subject?(0,s.jsxs)("div",{className:"text-xs text-gray-400 mt-0.5 truncate",children:[ed("admin.notif.tmpl.subject_label"),": ",d.subject]}):(0,s.jsx)("div",{className:"text-xs text-gray-300 mt-0.5 italic",children:ed("admin.notif.tmpl.not_set")})]}),(0,s.jsx)("span",{className:"text-gray-400 transition-transform ".concat(c?"rotate-90":""),children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"9 18 15 12 9 6"})})})]}),c&&(0,s.jsxs)("div",{className:"px-5 pb-5 border-t border-gray-100 pt-4 space-y-3",children:[(0,s.jsx)("div",{className:"flex gap-1 pb-2",children:["el","en","uk","ru"].map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>sX(e),className:"px-3 py-1 text-xs font-medium rounded-md transition-colors ".concat(sG===e?"bg-green-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"el"===e?"Ελληνικά":"en"===e?"English":"uk"===e?"Українська":"Русский"},e))}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.notif.tmpl.subject_label")}),(0,s.jsx)("input",{value:d.subject,onChange:e=>sO(t=>{var a;return{...t,[o]:{...null!=(a=t[o])?a:{subject:"",body:""},subject:e.target.value}}}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:ed("admin.notif.tmpl.body_label")}),(0,s.jsx)("textarea",{rows:7,value:d.body,onChange:e=>sO(t=>{var a;return{...t,[o]:{...null!=(a=t[o])?a:{subject:"",body:""},body:e.target.value}}}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 font-mono resize-y",placeholder:"<p>Уважаемый {{userName}},</p>..."})]}),m.length>0&&(0,s.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-amber-800 mb-1",children:ed("admin.notif.vars_hint")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.map(e=>{let t="{{".concat(e,"}}");return(0,s.jsx)("code",{className:"bg-amber-100 text-amber-900 px-1.5 py-0.5 rounded text-xs font-mono",children:t},t)})})]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsx)("button",{onClick:()=>ra(n),disabled:sY||s$,className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:sY?ed("admin.notif.tmpl.saving"):ed("admin.notif.tmpl.save")}),(0,s.jsxs)("button",{onClick:()=>rt(n),disabled:sY||s$,className:"px-4 py-2 bg-purple-600 text-white rounded-lg text-sm font-medium hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1.5",children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})}),s$?ed("admin.notif.tmpl.translating"):ed("admin.notif.tmpl.translate")]}),(0,s.jsx)("button",{onClick:()=>sq(null),className:"px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm font-medium hover:bg-gray-200",children:ed("admin.notif.tmpl.close")})]})]})]},n)})]}),"referral"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800",children:ed("admin.settings.referral.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:ed("admin.settings.referral.hint")})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700",children:ed("admin.settings.referral.enabled_label")}),(0,s.jsx)("p",{className:"text-xs text-gray-400",children:ed("admin.settings.referral.enabled_hint")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>s6(e=>({...e,enabled:!e.enabled})),className:"relative w-10 h-6 rounded-full p-0 transition-colors cursor-pointer ".concat(s3.enabled?"bg-green-600":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute left-0 top-1 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(s3.enabled?"translate-x-5":"translate-x-1")})})]}),(0,s.jsxs)("div",{className:"border border-gray-100 rounded-lg p-4 space-y-4",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:ed("admin.settings.referral.shared_section")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.referral.plan_label")}),(0,s.jsxs)("select",{value:s3.planId,onChange:e=>s6(t=>({...t,planId:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"",children:ed("admin.settings.referral.no_plan")}),a$.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:ed("admin.settings.referral.plan_hint")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.referral.days_label")}),(0,s.jsx)("input",{type:"number",min:"1",max:"365",value:s3.days,onChange:e=>s6(t=>({...t,days:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:ed("admin.settings.referral.days_hint")})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{onClick:rl,disabled:s7,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:s7?ed("admin.settings.saving"):ed("common.save")}),s9&&(0,s.jsx)("span",{className:"text-sm text-green-600",children:ed("admin.settings.saved")})]})]}),"socials"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-1",children:ed("admin.settings.socials.title")}),(0,s.jsx)("p",{className:"text-xs text-gray-400",children:ed("admin.settings.socials.hint")})]}),[{key:"telegram",label:"Telegram",placeholder:"https://t.me/yourname",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})})},{key:"instagram",label:"Instagram",placeholder:"https://instagram.com/yourname",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z"})})},{key:"facebook",label:"Facebook",placeholder:"https://facebook.com/yourpage",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})})},{key:"twitter",label:"X (Twitter)",placeholder:"https://x.com/yourname",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})},{key:"youtube",label:"YouTube",placeholder:"https://youtube.com/@yourchannel",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})})},{key:"tiktok",label:"TikTok",placeholder:"https://tiktok.com/@yourname",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-2.88 2.5 2.89 2.89 0 0 1-2.89-2.89 2.89 2.89 0 0 1 2.89-2.89c.28 0 .54.04.79.1V9.01a6.27 6.27 0 0 0-.79-.05 6.34 6.34 0 0 0-6.34 6.34 6.34 6.34 0 0 0 6.34 6.34 6.34 6.34 0 0 0 6.33-6.34V8.73a8.16 8.16 0 0 0 4.77 1.52V6.79a4.85 4.85 0 0 1-1-.1z"})})},{key:"whatsapp",label:"WhatsApp",placeholder:"https://wa.me/30xxxxxxxxxx",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413z"})})},{key:"viber",label:"Viber",placeholder:"viber://chat?number=30xxxxxxxxxx",icon:(0,s.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M11.398.002C8.473.028 4.414.625 2.138 4.15.2 7.044-.054 10.74.009 13.092c.064 2.352.277 4.799 1.97 6.758 1.32 1.527 3.276 2.39 5.262 2.674l.006 1.92c0 .307.368.47.592.257l2.245-2.143c.666.037 1.338.046 2.001.023 3.05-.107 6.238-.671 8.39-2.988 2.27-2.45 2.476-5.915 2.515-9.093.038-3.178-.15-6.648-2.467-9.052C18.337.606 14.323-.024 11.398.002zm.11 1.55c2.73-.023 6.267.538 8.3 2.688 1.878 2.004 2.034 5.155 2.001 8.172-.033 3.017-.245 5.967-2.069 7.944-1.792 1.943-4.607 2.44-7.265 2.533a18.35 18.35 0 0 1-2.198-.051l-.301-.028L7.8 24.51l-.004-2.463-.359-.064c-1.875-.333-3.693-1.152-4.832-2.47-1.377-1.597-1.574-3.702-1.632-5.915-.058-2.213.173-5.593 1.85-8.145C4.519 2.967 8.03 1.576 11.508 1.552zm-.082 2.19a8.79 8.79 0 0 0-2.65.399c-1.567.494-2.953 1.497-3.9 2.786C3.67 8.347 3.19 10.01 3.16 11.704c-.03 1.695.392 3.435 1.465 4.754.767.94 1.833 1.603 2.978 1.95l.004 1.232 1.197-1.143c.545.094 1.102.139 1.655.134 1.614-.015 3.27-.444 4.584-1.46 1.314-1.016 2.14-2.578 2.355-4.217.216-1.64-.017-3.369-.85-4.773-.832-1.403-2.23-2.412-3.773-2.74a8.777 8.777 0 0 0-1.459-.12zm.076 1.56c.39.003.784.049 1.165.14 1.215.27 2.319 1.066 2.975 2.17.657 1.103.843 2.518.66 3.857-.183 1.339-.826 2.596-1.87 3.408-1.044.813-2.41 1.172-3.76 1.185a10.75 10.75 0 0 1-1.675-.131l-.395-.064-1.017.97-.003-1.02-.384-.117c-1.027-.314-1.95-.925-2.574-1.693-.893-1.095-1.225-2.58-1.198-4.017.028-1.437.427-2.866 1.236-3.98.809-1.113 1.959-1.905 3.236-2.296a7.298 7.298 0 0 1 1.609-.412z"})})}].map(e=>{let{key:t,label:a,placeholder:l,icon:n}=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"".concat(ld[t]?"text-green-600":"text-gray-300"),children:n}),a,!ld[t]&&(0,s.jsx)("span",{className:"text-xs font-normal text-gray-400 ml-auto",children:"не заполнено"})]}),(0,s.jsx)("input",{type:"url",value:ld[t],onChange:e=>lc(a=>({...a,[t]:e.target.value})),placeholder:l,className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 ".concat(ld[t]?"border-green-300 bg-green-50/30":"border-gray-300")})]},t)}),(0,s.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,s.jsx)("button",{onClick:rr,disabled:lm,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:lm?ed("admin.settings.saving"):ed("common.save")}),lu&&(0,s.jsx)("span",{className:"text-sm text-green-600",children:ed("admin.settings.saved")})]})]}),"seo"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg space-y-6",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800",children:ed("admin.settings.seo.title")}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700",children:ed("admin.settings.seo.maintenance_label")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:ed("admin.settings.seo.maintenance_hint")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>la(e=>({...e,maintenanceMode:!e.maintenanceMode})),className:"relative w-10 h-6 rounded-full p-0 transition-colors cursor-pointer flex-shrink-0 ".concat(lt.maintenanceMode?"bg-red-500":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute left-0 top-1 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(lt.maintenanceMode?"translate-x-5":"translate-x-1")})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700",children:ed("admin.settings.seo.indexing_label")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:ed("admin.settings.seo.indexing_hint")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>la(e=>({...e,indexingEnabled:!e.indexingEnabled})),className:"relative w-10 h-6 rounded-full p-0 transition-colors cursor-pointer flex-shrink-0 ".concat(lt.indexingEnabled?"bg-green-600":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute left-0 top-1 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(lt.indexingEnabled?"translate-x-5":"translate-x-1")})})]}),(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"text-sm font-medium text-gray-700 mb-2",children:[ed("admin.settings.seo.site_title_label")," / ",ed("admin.settings.seo.site_description_label")]}),(0,s.jsx)("div",{className:"flex gap-1 mb-3",children:[{code:"el",flag:"\uD83C\uDDEC\uD83C\uDDF7",label:"EL"},{code:"en",flag:"\uD83C\uDDEC\uD83C\uDDE7",label:"EN"},{code:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",label:"RU"},{code:"uk",flag:"\uD83C\uDDFA\uD83C\uDDE6",label:"UK"}].map(e=>{let{code:t,flag:a,label:l}=e;return(0,s.jsxs)("button",{type:"button",onClick:()=>lo(t),className:"flex items-center gap-1 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(li===t?"bg-green-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:[a," ",l]},t)})}),(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.settings.seo.site_title_label")}),(0,s.jsx)("input",{value:lt["siteTitle".concat(li.charAt(0).toUpperCase()+li.slice(1))],onChange:e=>la(t=>({...t,["siteTitle".concat(li.charAt(0).toUpperCase()+li.slice(1))]:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 mb-3",placeholder:"el"===li?"CanHelp — Κάθε άνθρωπος έχει κάτι να προσφέρει":"en"===li?"CanHelp — Everyone has something valuable to offer":"ru"===li?"CanHelp — Каждый человек может чем-то помочь":"CanHelp — Кожен має навичку, яка може допомогти іншому"}),(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:ed("admin.settings.seo.site_description_label")}),(0,s.jsx)("textarea",{rows:3,value:lt["siteDescription".concat(li.charAt(0).toUpperCase()+li.slice(1))],onChange:e=>la(t=>({...t,["siteDescription".concat(li.charAt(0).toUpperCase()+li.slice(1))]:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none",placeholder:"el"===li?"Η ελληνική πλατφόρμα για online ανάθεση εργασιών...":"en"===li?"The Greek platform for online task delegation...":"ru"===li?"Греческая платформа для онлайн-поиска специалистов...":"Грецька платформа для пошуку фахівців онлайн..."})]})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.seo.head_scripts_label")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mb-2",children:ed("admin.settings.seo.head_scripts_hint")}),(0,s.jsx)("textarea",{rows:6,value:lt.headScripts,onChange:e=>la(t=>({...t,headScripts:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-400 resize-y",placeholder:"\x3c!-- Google Tag Manager --\x3e\n<script>...<\/script>",spellCheck:!1})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{onClick:rn,disabled:ls,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:ls?ed("admin.settings.saving"):ed("common.save")}),ln&&(0,s.jsx)("span",{className:"text-sm text-green-600",children:ed("admin.settings.saved")})]})]}),"telegram"===sC&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-6 max-w-lg space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-1",children:ed("admin.settings.telegram.title")}),(0,s.jsx)("p",{className:"text-xs text-gray-400",children:ed("admin.settings.telegram.help")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.telegram.bot_token")}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:lp.botToken,onChange:e=>{lh(t=>({...t,botToken:e.target.value})),lU(null)},placeholder:"1234567890:ABCDefgh...",className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 font-mono"}),(0,s.jsx)("button",{onClick:rd,disabled:lB||!lp.botToken,className:"px-3 py-2 border border-gray-300 rounded-lg text-sm hover:bg-gray-50 disabled:opacity-40 flex-shrink-0",children:lB?"...":ed("admin.settings.telegram.verify")})]}),lI&&(0,s.jsx)("p",{className:"text-xs mt-1 font-medium ".concat(lI.ok?"text-green-600":"text-red-500"),children:lI.ok?"✓ ".concat(lI.msg):"✗ ".concat(lI.msg)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.settings.telegram.admin_chat_id")}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:lp.adminChatId,onChange:e=>lh(t=>({...t,adminChatId:e.target.value})),placeholder:"-100123456789",className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 font-mono"}),(0,s.jsx)("button",{onClick:()=>ro("admin"),disabled:lj||!lp.botToken||!lp.adminChatId,className:"px-3 py-2 border border-gray-300 rounded-lg text-sm hover:bg-gray-50 disabled:opacity-40 flex-shrink-0",children:lj?"...":ed("admin.settings.telegram.test")})]}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:ed("admin.settings.telegram.admin_chat_hint")}),lC&&(0,s.jsx)("p",{className:"text-xs mt-1 font-medium ".concat(lC.ok?"text-green-600":"text-red-500"),children:lC.ok?"✓ ".concat(lC.msg):"✗ ".concat(lC.msg)})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700",children:ed("admin.settings.telegram.channels_title")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 -mt-2",children:ed("admin.settings.telegram.channel_hint")}),[{locale:"el",flag:"\uD83C\uDDEC\uD83C\uDDF7",label:"Ελληνικά",field:"channelIdEl"},{locale:"en",flag:"\uD83C\uDDEC\uD83C\uDDE7",label:"English",field:"channelIdEn"},{locale:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",label:"Русский",field:"channelIdRu"},{locale:"uk",flag:"\uD83C\uDDFA\uD83C\uDDE6",label:"Українська",field:"channelIdUk"}].map(e=>{let{locale:t,flag:a,label:l,field:n}=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,s.jsx)("span",{className:"text-base leading-none",children:a}),(0,s.jsx)("span",{className:"text-xs font-medium text-gray-600",children:l})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:lp[n],onChange:e=>lh(t=>({...t,[n]:e.target.value})),placeholder:"@channel или -100...",className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 font-mono"}),(0,s.jsx)("button",{onClick:()=>ro(t),disabled:lE===t||!lp.botToken||!lp[n],className:"px-3 py-2 border border-gray-300 rounded-lg text-sm hover:bg-gray-50 disabled:opacity-40 flex-shrink-0",children:lE===t?"...":ed("admin.settings.telegram.test")})]}),lM[t]&&(0,s.jsx)("p",{className:"text-xs mt-1 font-medium ".concat(lM[t].ok?"text-green-600":"text-red-500"),children:lM[t].ok?"✓ ".concat(lM[t].msg):"✗ ".concat(lM[t].msg)})]},t)})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700",children:ed("admin.settings.telegram.notify_registrations")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:ed("admin.settings.telegram.notify_registrations_hint")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>lh(e=>({...e,notifyRegistrations:!e.notifyRegistrations})),className:"relative w-10 h-6 rounded-full transition-colors cursor-pointer flex-shrink-0 p-0 border-0 outline-none ".concat(lp.notifyRegistrations?"bg-green-600":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute top-1 left-0 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(lp.notifyRegistrations?"translate-x-5":"translate-x-1")})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700",children:ed("admin.settings.telegram.post_new_tasks")}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:ed("admin.settings.telegram.post_new_tasks_hint")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>lh(e=>({...e,postNewTasks:!e.postNewTasks})),className:"relative w-10 h-6 rounded-full transition-colors cursor-pointer flex-shrink-0 p-0 border-0 outline-none ".concat(lp.postNewTasks?"bg-green-600":"bg-gray-300"),children:(0,s.jsx)("span",{className:"absolute top-1 left-0 w-4 h-4 bg-white rounded-full shadow transition-transform ".concat(lp.postNewTasks?"translate-x-5":"translate-x-1")})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,s.jsx)("button",{onClick:ri,disabled:lb,className:"px-5 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:lb?ed("admin.settings.saving"):ed("common.save")}),ly&&(0,s.jsx)("span",{className:"text-sm text-green-600",children:ed("admin.settings.saved")})]})]})]}),"support"===em&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 mb-2",children:[(0,s.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),tx(tu),tl(1)},children:[(0,s.jsx)("input",{value:tu,onChange:e=>tg(e.target.value),placeholder:ed("admin.support.search","Search..."),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 w-52"}),(0,s.jsx)("button",{type:"submit",className:"bg-green-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-green-700",children:ed("admin.search","Search")}),tm&&(0,s.jsx)("button",{type:"button",onClick:()=>{tg(""),tx(""),tl(1)},className:"text-sm text-gray-500 hover:text-gray-700 px-2",children:"✕"})]}),(0,s.jsxs)("select",{value:ti,onChange:e=>{to(e.target.value),tl(1)},className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"",children:ed("admin.support.all_statuses","All statuses")}),(0,s.jsx)("option",{value:"open",children:ed("admin.support.status.open","Open")}),(0,s.jsx)("option",{value:"in_progress",children:ed("admin.support.status.in_progress","In progress")}),(0,s.jsx)("option",{value:"resolved",children:ed("admin.support.status.resolved","Resolved")}),(0,s.jsx)("option",{value:"closed",children:ed("admin.support.status.closed","Closed")})]}),(0,s.jsxs)("select",{value:td,onChange:e=>{tc(e.target.value),tl(1)},className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"",children:ed("admin.support.all_types","All types")}),(0,s.jsxs)("option",{value:"bug",children:["\uD83D\uDC1B ",ed("support.type.bug","Bug")]}),(0,s.jsxs)("option",{value:"suggestion",children:["\uD83D\uDCA1 ",ed("support.type.suggestion","Suggestion")]}),(0,s.jsxs)("option",{value:"other",children:["\uD83D\uDCAC ",ed("support.type.other","Other")]})]}),(0,s.jsxs)("span",{className:"ml-auto text-sm text-gray-400 self-center",children:[tn," ",ed("admin.pagination.total","total")]})]}),nI?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("common.loading")}):0===tt.length?(0,s.jsx)("div",{className:"text-center py-10 text-gray-400",children:ed("admin.support.none","No tickets")}):tt.map(e=>{var t,a;let l=tp===e.id;return(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[(0,s.jsxs)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(null!=(t=({bug:"bg-red-100 text-red-700",suggestion:"bg-green-100 text-green-700",other:"bg-gray-100 text-gray-600"})[e.type])?t:"bg-gray-100 text-gray-600"),children:[{bug:"\uD83D\uDC1B",suggestion:"\uD83D\uDCA1",other:"\uD83D\uDCAC"}[e.type]," ",e.type]}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(null!=(a=({open:"bg-green-100 text-green-700",in_progress:"bg-green-100 text-green-700",resolved:"bg-gray-100 text-gray-500",closed:"bg-gray-200 text-gray-400"})[e.status])?a:"bg-gray-100 text-gray-500"),children:e.status}),(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["#",e.id.slice(0,8)]})]}),(0,s.jsx)("h3",{className:"font-semibold text-gray-900 text-sm",children:e.subject}),e.userName&&(0,s.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:[e.userName," \xb7 ",e.userEmail]}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:new Date(e.createdAt).toLocaleString(rc)})]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-shrink-0",children:["closed"!==e.status&&(0,s.jsx)("button",{onClick:()=>{th(l?null:e.id),tf(e.adminReply||"")},className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-green-50 text-green-700 hover:bg-green-100",children:l?ed("admin.support.cancel","Cancel"):ed("admin.support.reply","Reply")}),"open"===e.status&&(0,s.jsx)("button",{onClick:()=>c.u0(e.id,"closed").then(()=>ta(t=>t.map(t=>t.id===e.id?{...t,status:"closed"}:t))),className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-gray-100 text-gray-600 hover:bg-gray-200",children:ed("admin.support.close","Close")})]})]}),(0,s.jsx)("p",{className:"text-sm text-gray-700 whitespace-pre-wrap bg-gray-50 rounded-lg p-3 mb-3",children:e.body}),e.adminReply&&!l&&(0,s.jsxs)("div",{className:"bg-green-50 border border-green-100 rounded-lg p-3 mb-2",children:[(0,s.jsxs)("p",{className:"text-xs font-medium text-green-600 mb-1",children:[ed("admin.support.your_reply","Your reply"),":"]}),(0,s.jsx)("p",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:e.adminReply})]}),l&&(0,s.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,s.jsx)("textarea",{rows:3,value:tb,onChange:e=>tf(e.target.value),placeholder:ed("admin.support.reply_placeholder","Write a reply..."),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"}),(0,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsxs)("select",{id:"status-".concat(e.id),defaultValue:"resolved",className:"border border-gray-300 rounded-lg px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",children:[(0,s.jsx)("option",{value:"open",children:ed("admin.support.status.open","Open")}),(0,s.jsx)("option",{value:"in_progress",children:ed("admin.support.status.in_progress","In progress")}),(0,s.jsx)("option",{value:"resolved",children:ed("admin.support.status.resolved","Resolved")}),(0,s.jsx)("option",{value:"closed",children:ed("admin.support.status.closed","Closed")})]}),(0,s.jsx)("button",{disabled:ty||!tb.trim(),onClick:async()=>{let t=document.getElementById("status-".concat(e.id));tv(!0);try{let a=await c.nT(e.id,{adminReply:tb,status:null==t?void 0:t.value});ta(t=>t.map(t=>t.id===e.id?{...t,...a}:t)),th(null)}catch(e){}finally{tv(!1)}},className:"bg-green-600 text-white px-4 py-1.5 rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:ty?"...":ed("admin.support.send_reply","Send")})]})]})]},e.id)}),(0,s.jsx)(E,{page:ts,total:tn,limit:30,onChange:tl,totalLabel:ed("admin.pagination.total")})]}),"push"===em&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5 space-y-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-800",children:"Push-рассылка"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>nh("broadcast"),className:"px-3 py-1.5 text-sm rounded-lg border ".concat("broadcast"===np?"bg-green-600 text-white border-green-600":"bg-white text-gray-700 border-gray-300"),children:"Всем пользователям"}),(0,s.jsx)("button",{type:"button",onClick:()=>nh("user"),className:"px-3 py-1.5 text-sm rounded-lg border ".concat("user"===np?"bg-green-600 text-white border-green-600":"bg-white text-gray-700 border-gray-300"),children:"Конкретному пользователю"})]}),"user"===np&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"User ID"}),(0,s.jsx)("input",{value:nb,onChange:e=>nf(e.target.value),placeholder:"UUID пользователя",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),"broadcast"===np&&(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-700",children:[(0,s.jsx)("input",{type:"checkbox",checked:nS,onChange:e=>nL(e.target.checked)}),"Только активным пользователям"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"Заголовок"}),(0,s.jsx)("input",{value:ny,onChange:e=>nv(e.target.value),placeholder:"Например: Новые задачи рядом с вами",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"Текст"}),(0,s.jsx)("textarea",{rows:3,value:nj,onChange:e=>nN(e.target.value),placeholder:"Короткий текст уведомления",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"Тип"}),(0,s.jsx)("input",{value:nk,onChange:e=>nw(e.target.value),placeholder:"task_update / chat_message / referral_reward",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-gray-600 block mb-1",children:"Reference ID (опционально)"}),(0,s.jsx)("input",{value:nC,onChange:e=>n_(e.target.value),placeholder:"taskId, chatId и т.д.",className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:nP,disabled:nE||!ny.trim()||"user"===np&&!nb.trim(),className:"px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700 disabled:opacity-50",children:nE?"Отправка...":"Отправить Push"}),nB&&(0,s.jsx)("span",{className:"text-sm text-red-600",children:nB})]})]}),nM&&(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 mb-3",children:"Результат"}),"usersTotal"in nM?(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 text-sm",children:[(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Пользователей"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.usersTotal})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Получили"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.usersWithSent})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Отправлено push"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.pushesSent})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Невалидные токены"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.invalidTokens})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Ошибки по userId"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.failedUsers.length})]})]}):(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"User ID"}),(0,s.jsx)("div",{className:"text-gray-900 font-mono text-xs break-all",children:nM.targetUserId})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Токенов найдено"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:null!=(u=nM.tokensFound)?u:0})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Отправлено push"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.sent})]}),(0,s.jsxs)("div",{className:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-2",children:[(0,s.jsx)("div",{className:"text-gray-500",children:"Невалидные токены"}),(0,s.jsx)("div",{className:"text-gray-900 font-semibold",children:nM.invalidTokens})]})]}),"usersTotal"in nM?(0,s.jsx)(s.Fragment,{children:(null!=(N=nM.usersWithoutTokens)?N:0)>0||(null!=(_=nM.usersConfigBlocked)?_:0)>0||(null!=(S=nM.usersAuthFailed)?S:0)>0||(null!=(L=nM.usersAllFailed)?L:0)>0?(0,s.jsxs)("div",{className:"mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[(0,s.jsxs)("div",{children:["Диагностика: без токенов — ",null!=(M=nM.usersWithoutTokens)?M:0,", FCM не настроен — ",null!=(T=nM.usersConfigBlocked)?T:0,", ошибка auth FCM — ",null!=(I=nM.usersAuthFailed)?I:0,", FCM send failed — ",null!=(R=nM.usersAllFailed)?R:0]}),nM.failedReasonStats&&Object.keys(nM.failedReasonStats).length>0?(0,s.jsxs)("div",{className:"mt-1",children:["Коды ошибок FCM: ",Object.entries(nM.failedReasonStats).map(e=>{let[t,a]=e;return"".concat(t,": ").concat(a)}).join(", ")]}):null,nM.failedReasonSample?(0,s.jsxs)("div",{className:"mt-1",children:["Пример ошибки: ",nz(nM.failedReasonStats?Object.keys(nM.failedReasonStats)[0]:null,nM.failedReasonSample)]}):null]}):null}):(0,s.jsx)(s.Fragment,{children:nM.reason?(0,s.jsxs)("div",{className:"mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[(0,s.jsxs)("div",{children:["Диагностика: ","no_tokens"===nM.reason?"у пользователя нет push-токенов":"fcm_not_configured"===nM.reason?"FCM не настроен на API (переменные FCM_*)":"fcm_auth_failed"===nM.reason?"ошибка авторизации FCM (service account)":nz(nM.failureKey,nM.failureMessage)]}),nM.failureKey?(0,s.jsxs)("div",{className:"mt-1",children:["Код FCM: ",nM.failureKey]}):null,nM.failureMessage?(0,s.jsxs)("div",{className:"mt-1",children:["Сообщение FCM: ",nM.failureMessage]}):null]}):null})]})]}),"backup"===em&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold text-gray-800 flex items-center gap-2",children:[(0,s.jsx)("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),ed("admin.backup.title","Backup")]}),lZ&&(0,s.jsxs)("div",{className:"".concat(l1?"bg-red-50 border-red-200 text-red-700":"bg-green-50 border-green-200 text-green-700"," border rounded-lg px-4 py-2 text-sm flex items-center justify-between"),children:[(0,s.jsx)("span",{children:lZ}),(0,s.jsx)("button",{onClick:()=>l0(null),className:"".concat(l1?"text-red-500 hover:text-red-700":"text-green-500 hover:text-green-700"," ml-4"),children:"\xd7"})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5 flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-gray-800 text-sm",children:ed("admin.backup.autoBackup","Auto Backup")}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:ed("admin.backup.autoBackupDesc","Create a backup every day automatically")})]}),(0,s.jsx)("button",{disabled:lW,onClick:async()=>{lz(!0);try{await (0,c.Em)("/admin/backup/settings",{method:"PUT",body:JSON.stringify({autoEnabled:!lR})}),lP(e=>!e)}catch(e){}lz(!1)},className:"relative w-11 h-6 rounded-full transition-colors ".concat(lR?"bg-green-600":"bg-gray-300"," ").concat(lW?"opacity-50":""),children:(0,s.jsx)("span",{className:"absolute top-0.5 left-0.5 w-5 h-5 rounded-full bg-white shadow transition-transform ".concat(lR?"translate-x-5":"translate-x-0")})})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 text-sm mb-4",children:ed("admin.backup.title","Database Backup")}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,s.jsxs)("button",{disabled:lG,onClick:async()=>{lX(!0);try{let e=await fetch("".concat("https://api.canhelp.gr","/api/admin/backup/export"),{credentials:"include"});if(!e.ok)throw Error("Export failed");let t=await e.blob(),a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download="backup_".concat(new Date().toISOString().slice(0,10),".sql.gz"),s.click(),URL.revokeObjectURL(a),l4(ed("admin.backup.exportSuccess","Export successful"))}catch(e){l5(e.message||"Error")}lX(!1)},className:"bg-green-600 hover:bg-green-700 text-white text-sm px-4 py-2 rounded-lg font-medium disabled:opacity-50 flex items-center gap-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),lG?ed("admin.backup.exporting","Exporting..."):ed("admin.backup.exportAll","Export Full DB")]}),(0,s.jsxs)("label",{className:"bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm px-4 py-2 rounded-lg font-medium cursor-pointer flex items-center gap-2 ".concat("full"===lY?"opacity-50 pointer-events-none":""),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l4-4m0 0l4 4m-4-4v12"})}),"full"===lY?ed("admin.backup.importing","Importing..."):ed("admin.backup.importAll","Import Full DB"),(0,s.jsx)("input",{type:"file",accept:".sql.gz,.gz",className:"hidden",onChange:async e=>{var t;let a=null==(t=e.target.files)?void 0:t[0];if(a&&window.confirm(ed("admin.backup.restoreConfirm","Restore from this backup?"))){lJ("full");try{let e=new FormData;if(e.append("file",a),!(await fetch("".concat("https://api.canhelp.gr","/api/admin/backup/import"),{method:"POST",credentials:"include",body:e})).ok)throw Error("Import failed");l4(ed("admin.backup.importSuccess","Import successful"))}catch(e){l5(e.message||"Error")}lJ(null),e.target.value=""}}})]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 text-sm mb-4",children:ed("admin.backup.storedBackups","Stored Backups")}),0===lK.length?(0,s.jsx)("p",{className:"text-sm text-gray-400",children:ed("admin.backup.noStoredBackups","No stored backups")}):(0,s.jsx)("div",{className:"space-y-2",children:lK.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 bg-gray-50 rounded-lg border border-gray-100",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-800",children:"backup_today"===e.name?ed("admin.backup.today","Today"):ed("admin.backup.yesterday","Yesterday")}),(0,s.jsxs)("p",{className:"text-xs text-gray-400",children:[ed("admin.backup.size","Size"),": ",(e.size/1024).toFixed(1)," KB \xb7 ",ed("admin.backup.date","Date"),": ",new Date(e.date).toLocaleString()]})]}),(0,s.jsx)("button",{disabled:l$===e.name,onClick:async()=>{if(window.confirm(ed("admin.backup.restoreConfirm","Restore from this backup?"))){lQ(e.name);try{await (0,c.Em)("/admin/backup/restore",{method:"POST",body:JSON.stringify({name:e.name})}),l4(ed("admin.backup.restoreSuccess","Restore successful"))}catch(e){l5(e.message||"Error")}lQ(null)}},className:"text-sm text-green-600 hover:text-gray-800 font-medium disabled:opacity-50",children:l$===e.name?ed("admin.backup.restoring","Restoring..."):ed("admin.backup.restore","Restore")})]},e.name))})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-800 text-sm mb-4",children:ed("admin.backup.tables","Tables")}),lV?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[(0,s.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),ed("common.loading","Loading...")]}):0===lF.length?(0,s.jsx)("p",{className:"text-sm text-gray-400",children:ed("admin.noData","No data")}):(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsx)("table",{className:"w-full text-sm",children:(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:lF.map(e=>(0,s.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"py-2 pr-4 font-mono text-gray-700",children:e}),(0,s.jsx)("td",{className:"py-2 text-right",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,s.jsx)("button",{onClick:async()=>{try{let t=await fetch("".concat("https://api.canhelp.gr","/api/admin/backup/export/").concat(e),{credentials:"include"});if(!t.ok)throw Error("Export failed");let a=await t.blob(),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download="".concat(e,"_").concat(new Date().toISOString().slice(0,10),".sql.gz"),l.click(),URL.revokeObjectURL(s)}catch(e){l5(e.message||"Error")}},className:"text-green-600 hover:text-gray-800 font-medium text-xs px-2 py-1 rounded border border-green-200 hover:bg-green-50",children:ed("admin.backup.exportTable","Export")}),(0,s.jsxs)("label",{className:"text-gray-600 hover:text-gray-800 font-medium text-xs px-2 py-1 rounded border border-gray-200 hover:bg-gray-100 cursor-pointer",children:[lY===e?ed("admin.backup.importing","Importing..."):ed("admin.backup.importTable","Import"),(0,s.jsx)("input",{type:"file",accept:".sql.gz,.gz",className:"hidden",onChange:async t=>{var a;let s=null==(a=t.target.files)?void 0:a[0];if(s&&window.confirm(ed("admin.backup.restoreConfirm","Restore from this backup?"))){lJ(e);try{let t=new FormData;t.append("file",s);let a=await fetch("".concat("https://api.canhelp.gr","/api/admin/backup/import/").concat(e),{method:"POST",credentials:"include",body:t});if(!a.ok){let e=await a.json().catch(()=>({error:"Import failed"}));throw Error(e.error||"Import failed")}l4(ed("admin.backup.importSuccess","Import successful"))}catch(e){l5(e.message||"Error")}lJ(null),t.target.value=""}}})]})]})})]},e))})})})]})]}),"translations"===em&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:"Переводы"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:"Автоматический перевод пропущенных значений по таблицам"})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-4 flex flex-wrap gap-4 items-end",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Источник"}),(0,s.jsxs)("select",{value:nt,onChange:e=>na(e.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-1.5 focus:outline-none focus:ring-2 focus:ring-green-500",children:[(0,s.jsx)("option",{value:"el",children:"\uD83C\uDDEC\uD83C\uDDF7 Greek"}),(0,s.jsx)("option",{value:"en",children:"\uD83C\uDDEC\uD83C\uDDE7 English"}),(0,s.jsx)("option",{value:"ru",children:"\uD83C\uDDF7\uD83C\uDDFA Russian"}),(0,s.jsx)("option",{value:"uk",children:"\uD83C\uDDFA\uD83C\uDDE6 Ukrainian"})]})]}),(0,s.jsx)("svg",{className:"w-5 h-5 text-gray-400 mb-1 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5-5 5M6 12h12"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Перевести на"}),(0,s.jsxs)("select",{value:l9,onChange:e=>ne(e.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-1.5 focus:outline-none focus:ring-2 focus:ring-green-500",children:[(0,s.jsx)("option",{value:"el",children:"\uD83C\uDDEC\uD83C\uDDF7 Greek"}),(0,s.jsx)("option",{value:"en",children:"\uD83C\uDDEC\uD83C\uDDE7 English"}),(0,s.jsx)("option",{value:"ru",children:"\uD83C\uDDF7\uD83C\uDDFA Russian"}),(0,s.jsx)("option",{value:"uk",children:"\uD83C\uDDFA\uD83C\uDDE6 Ukrainian"})]})]}),(0,s.jsx)("div",{className:"ml-auto self-end",children:(0,s.jsxs)("span",{className:"text-sm font-semibold text-gray-700 flex items-center gap-2",children:[{el:"\uD83C\uDDEC\uD83C\uDDF7",en:"\uD83C\uDDEC\uD83C\uDDE7",ru:"\uD83C\uDDF7\uD83C\uDDFA",uk:"\uD83C\uDDFA\uD83C\uDDE6"}[nt]," ",nt.toUpperCase(),(0,s.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5-5 5M6 12h12"})}),{el:"\uD83C\uDDEC\uD83C\uDDF7",en:"\uD83C\uDDEC\uD83C\uDDE7",ru:"\uD83C\uDDF7\uD83C\uDDFA",uk:"\uD83C\uDDFA\uD83C\uDDE6"}[l9]," ",l9.toUpperCase()]})})]}),nn&&(0,s.jsx)("div",{className:"text-sm px-4 py-2 rounded-lg ".concat(nn.error?"bg-red-50 text-red-700":"bg-green-50 text-green-700"),children:nn.text}),l7?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-400 py-6",children:[(0,s.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Загрузка…"]}):(0,s.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:(null!=l3?l3:[]).map(e=>{var t;let a="tasks"===e.name,l=Object.values(e.missing).reduce((e,t)=>e+t,0),n=a?l:null!=(t=e.missing[l9])?t:0,r=!!ns[e.name],i=Object.values(ns).some(Boolean);return(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 p-5 flex flex-col",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-semibold text-gray-900 text-sm",children:e.label}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:e.name})]}),(0,s.jsx)("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full ".concat(n>0?"bg-red-100 text-red-700":"bg-green-100 text-green-700"),children:n>0?"".concat(n," missing"):"Complete"})]}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 mt-3",children:["Всего: ",e.total,a&&" \xb7 с языка оригинала на все остальные"]}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:["el","en","ru","uk"].map(t=>{var l;let n=null!=(l=e.missing[t])?l:0,r=a&&n>0;return(0,s.jsxs)("button",{type:"button",disabled:!r,onClick:r?async()=>{no({lang:t,loading:!0,rows:[]});try{let e=await c.QY(t,50);no({lang:t,loading:!1,rows:e.rows})}catch(e){no({lang:t,loading:!1,rows:[]})}}:void 0,className:"text-xs px-2 py-0.5 rounded-full border transition ".concat(n>0?"border-red-200 bg-red-50 text-red-600"+(r?" cursor-pointer hover:bg-red-100":""):"border-green-200 bg-green-50 text-green-600 cursor-default"),children:[t,": ",n>0?"-".concat(n):"✓"]},t)})}),(0,s.jsx)("div",{className:"mt-4 mt-auto pt-4",children:0===n?(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-emerald-600",children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Все переводы заполнены"]}):(0,s.jsx)("button",{disabled:i,onClick:async()=>{if(!a&&nt===l9)return void nr({text:"Исходный и целевой язык совпадают",error:!0});nl(t=>({...t,[e.name]:!0})),nr(null);try{let t=a?await c.I(500):"email_templates"===e.name?await c.fu(l9,nt):await c.cp(e.name,l9,nt,500);nr({text:"".concat(e.label,": translated ").concat(t.translated," of ").concat(t.total)+(t.failed>0?" \xb7 errors: ".concat(t.failed):""),error:t.failed>0&&0===t.translated}),c.YQ().then(e=>l6(e.tables)).catch(()=>{})}catch(t){let e=(null==t?void 0:t.response)?await t.response.text().catch(()=>t.message):t.message||"Error";nr({text:"Error: ".concat(e),error:!0})}finally{nl(t=>{let a={...t};return delete a[e.name],a})}},className:"w-full text-sm px-3 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 flex items-center justify-center gap-2 transition font-medium",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"w-3.5 h-3.5 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Translating..."]}):a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})}),"Fill all missing \xb7 ",n]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"})}),"Translate ",n," \xb7 ",{el:"\uD83C\uDDEC\uD83C\uDDF7",en:"\uD83C\uDDEC\uD83C\uDDE7",ru:"\uD83C\uDDF7\uD83C\uDDFA",uk:"\uD83C\uDDFA\uD83C\uDDE6"}[nt]," ",nt.toUpperCase(),(0,s.jsx)("svg",{className:"w-3 h-3 opacity-60 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5-5 5M6 12h12"})}),{el:"\uD83C\uDDEC\uD83C\uDDF7",en:"\uD83C\uDDEC\uD83C\uDDE7",ru:"\uD83C\uDDF7\uD83C\uDDFA",uk:"\uD83C\uDDFA\uD83C\uDDE6"}[l9]," ",l9.toUpperCase()]})})})]},e.name)})})]}),"dbcheck"===em&&(0,s.jsx)(k,{}),"referrals"===em&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{className:"grid grid-cols-3 gap-4",children:[{label:"Рефереров",value:null!=(P=null==nd?void 0:nd.totalReferrers)?P:"—",color:"text-green-600"},{label:"Приглашений",value:null!=(W=null==nd?void 0:nd.totalReferrals)?W:"—",color:"text-purple-600"},{label:"Активных наград",value:null!=(z=null==nd?void 0:nd.activeRewards)?z:"—",color:"text-green-600"}].map(e=>{let{label:t,value:a,color:l}=e;return(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 p-5 text-center",children:[(0,s.jsx)("div",{className:"text-3xl font-bold ".concat(l),children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:t})]},t)})}),(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"font-semibold text-gray-800",children:"Дерево рефералов"}),(0,s.jsxs)("button",{onClick:()=>{nx(!0),c.cJ().then(nc).catch(()=>{}).finally(()=>nx(!1))},className:"text-xs text-green-600 hover:underline flex items-center gap-1",children:[nm&&(0,s.jsxs)("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Обновить"]})]}),nm&&!nd?(0,s.jsx)("div",{className:"flex justify-center py-16",children:(0,s.jsxs)("svg",{className:"w-6 h-6 animate-spin text-purple-600",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}):nd&&0!==nd.tree.length?(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:nd.tree.map(e=>{var t,a,l,n,r;let i=null!=(l=null==(t=e.referrer)?void 0:t.id)?l:"unknown",o=nu.has(i),d=e.referrer?"".concat(null!=(n=e.referrer.firstName)?n:""," ").concat(null!=(r=e.referrer.lastName)?r:"").trim()||e.referrer.email:"(удалён)";return(0,s.jsxs)("div",{children:[(0,s.jsxs)("button",{className:"w-full flex items-center gap-3 px-5 py-3.5 hover:bg-gray-50 text-left transition-colors",onClick:()=>ng(e=>{let t=new Set(e);return t.has(i)?t.delete(i):t.add(i),t}),children:[(0,s.jsx)("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0 transition-transform ".concat(o?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"font-medium text-sm text-gray-900",children:d}),e.referrer&&(0,s.jsx)("span",{className:"ml-2 text-xs text-gray-400",children:e.referrer.email})]}),(null==(a=e.referrer)?void 0:a.referralCode)&&(0,s.jsx)("code",{className:"text-xs bg-gray-100 text-gray-600 px-2 py-0.5 rounded font-mono",children:e.referrer.referralCode}),(0,s.jsxs)("span",{className:"ml-3 text-xs font-semibold text-purple-700 bg-purple-50 px-2 py-0.5 rounded-full",children:[e.referees.length," реф."]})]}),o&&(0,s.jsx)("div",{className:"bg-gray-50 border-t border-gray-100",children:(0,s.jsxs)("table",{className:"w-full text-xs",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("th",{className:"text-left px-10 py-2 font-semibold text-gray-500",children:"Приглашённый"}),(0,s.jsx)("th",{className:"text-left px-3 py-2 font-semibold text-gray-500",children:"Email"}),(0,s.jsx)("th",{className:"text-center px-3 py-2 font-semibold text-gray-500",children:"+дней"}),(0,s.jsx)("th",{className:"text-center px-3 py-2 font-semibold text-gray-500",children:"Истекает"}),(0,s.jsx)("th",{className:"text-center px-3 py-2 font-semibold text-gray-500",children:"Дата"})]})}),(0,s.jsx)("tbody",{children:e.referees.map(e=>{var t,a;let l="".concat(null!=(t=e.firstName)?t:""," ").concat(null!=(a=e.lastName)?a:"").trim()||e.email,n=new Date(e.expiresAt),r=new Date(e.createdAt),i=n>new Date;return(0,s.jsxs)("tr",{className:"border-b border-gray-100 last:border-0 hover:bg-white transition-colors",children:[(0,s.jsx)("td",{className:"px-10 py-2.5 font-medium text-gray-800",children:l}),(0,s.jsx)("td",{className:"px-3 py-2.5 text-gray-500",children:e.email}),(0,s.jsx)("td",{className:"px-3 py-2.5 text-center",children:(0,s.jsxs)("span",{className:"font-semibold text-green-700",children:["+",e.daysAdded]})}),(0,s.jsx)("td",{className:"px-3 py-2.5 text-center",children:(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium ".concat(i?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"),children:n.toLocaleDateString("ru-RU",{day:"2-digit",month:"2-digit",year:"2-digit"})})}),(0,s.jsx)("td",{className:"px-3 py-2.5 text-center text-gray-400",children:r.toLocaleDateString("ru-RU",{day:"2-digit",month:"2-digit",year:"2-digit"})})]},e.id)})})]})})]},i)})}):(0,s.jsx)("div",{className:"py-16 text-center text-sm text-gray-400",children:"Нет данных о рефералах"})]})]}),ni&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4",onClick:()=>no(null),children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-3xl max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 flex-shrink-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-900",children:["Задачи без перевода: ",(0,s.jsx)("span",{className:"uppercase font-bold text-red-600",children:ni.lang})]}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:"Показаны первые 50 записей"})]}),(0,s.jsx)("button",{onClick:()=>no(null),className:"text-gray-400 hover:text-gray-600 p-1",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsx)("div",{className:"overflow-y-auto flex-1 px-6 py-4",children:ni.loading?(0,s.jsx)("div",{className:"flex justify-center py-12",children:(0,s.jsxs)("svg",{className:"w-6 h-6 animate-spin text-purple-600",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}):0===ni.rows.length?(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center py-12",children:"Нет задач без перевода"}):(0,s.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("th",{className:"text-left py-2 pr-3 font-semibold text-gray-600 w-[35%]",children:"Оригинал (title)"}),(0,s.jsx)("th",{className:"text-center py-2 px-2 font-semibold text-gray-600",children:"orig"}),["el","en","ru","uk"].map(e=>(0,s.jsx)("th",{className:"text-center py-2 px-2 font-semibold text-gray-600 w-[14%]",children:e},e))]})}),(0,s.jsx)("tbody",{children:ni.rows.map(e=>(0,s.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[(0,s.jsx)("td",{className:"py-2 pr-3 text-gray-800 truncate max-w-[200px]",title:e.title,children:e.title}),(0,s.jsx)("td",{className:"py-2 px-2 text-center",children:(0,s.jsx)("span",{className:"uppercase font-semibold text-purple-700 bg-purple-50 px-1.5 py-0.5 rounded",children:e.originalLocale})}),[["el",e.titleEl],["en",e.titleEn],["ru",e.titleRu],["uk",e.titleUk]].map(e=>{let[t,a]=e;return(0,s.jsx)("td",{className:"py-2 px-2 text-center",title:null!=a?a:"",children:a?(0,s.jsx)("span",{className:"text-emerald-600 font-semibold",children:"✓"}):(0,s.jsx)("span",{className:"text-red-500 font-semibold",children:"✗"})},t)})]},e.id))})]})})]})}),aS&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 flex-shrink-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:ed("admin.user_edit.title")}),(0,s.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:[aS.email," \xb7 ID: ",aS.id]})]}),(0,s.jsx)("button",{onClick:()=>aL(null),className:"text-gray-400 hover:text-gray-600 text-2xl leading-none",children:"\xd7"})]}),(0,s.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,s.jsx)("nav",{className:"w-44 flex-shrink-0 border-r border-gray-100 py-3 space-y-0.5 px-2",children:[{id:"profile",label:ed("admin.user_edit.tab.profile")},{id:"account",label:ed("admin.user_edit.tab.account")},{id:"balance",label:ed("admin.user_edit.tab.balance")},{id:"settings",label:ed("admin.user_edit.tab.settings")},{id:"site",label:ed("admin.user_edit.tab.site")},{id:"specialist",label:ed("admin.user_edit.tab.specialist")}].map(e=>(0,s.jsx)("button",{onClick:()=>{if(aT(e.id),"specialist"===e.id&&aS){aH(!0);let e=c.vy(aS.id).then(az).catch(()=>{});Promise.all([e,0===st.length?c.KD().then(sa).catch(()=>{}):Promise.resolve(),0===a4.length?c.k_().then(a5).catch(()=>{}):Promise.resolve()]).finally(()=>aH(!1))}},className:"w-full text-left px-3 py-2.5 text-sm rounded-lg transition-colors ".concat(aB===e.id?"bg-green-50 text-green-700 font-medium":"text-gray-600 hover:bg-gray-50"),children:e.label},e.id))}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto p-6",children:["profile"===aB&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg text-xs text-gray-500 space-y-0.5",children:[(0,s.jsxs)("p",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[ed("admin.user_edit.registered"),":"]})," ",new Date(aS.createdAt).toLocaleDateString(rc)]}),aS.lastSeenAt&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[ed("admin.user_edit.last_seen"),":"]})," ",new Date(aS.lastSeenAt).toLocaleDateString(rc)]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.first_name")}),(0,s.jsx)("input",{value:null!=(F=aS.firstName)?F:"",onChange:e=>aL(t=>({...t,firstName:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.last_name")}),(0,s.jsx)("input",{value:null!=(H=aS.lastName)?H:"",onChange:e=>aL(t=>({...t,lastName:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.phone")}),(0,s.jsx)("input",{value:null!=(V=aS.phone)?V:"",onChange:e=>aL(t=>({...t,phone:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.bio")}),(0,s.jsx)("textarea",{value:null!=(O=aS.bio)?O:"",onChange:e=>aL(t=>({...t,bio:e.target.value})),rows:5,className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]})]}),"account"===aB&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.email")}),(0,s.jsx)("div",{className:"w-full border border-gray-200 bg-gray-50 rounded-lg px-3 py-2 text-sm text-gray-600 select-all",children:aS.email})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[aS.emailVerified?(0,s.jsx)("svg",{className:"w-4 h-4 text-green-500 shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):(0,s.jsx)("svg",{className:"w-4 h-4 text-red-400 shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L10 8.586 7.707 6.293a1 1 0 00-1.414 1.414L8.586 10l-2.293 2.293a1 1 0 101.414 1.414L10 11.414l2.293 2.293a1 1 0 001.414-1.414L11.414 10l2.293-2.293z",clipRule:"evenodd"})}),(0,s.jsx)("span",{className:"text-sm font-medium ".concat(aS.emailVerified?"text-green-700":"text-red-600"),children:aS.emailVerified?ed("admin.user_edit.email_verified"):ed("admin.user_edit.email_not_verified")})]}),!aS.emailVerified&&(0,s.jsx)("button",{onClick:nH,disabled:aM,className:"text-xs px-3 py-1 rounded-md bg-green-600 text-white hover:bg-green-700 disabled:opacity-50 transition-colors",children:aM?"...":ed("admin.user_edit.verify_email_btn")})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.role")}),(0,s.jsxs)("select",{value:aS.role,onChange:e=>aL(t=>({...t,role:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"user",children:ed("admin.user_edit.role.user")}),(0,s.jsx)("option",{value:"admin",children:ed("admin.user_edit.role.admin")})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.plan")}),(0,s.jsxs)("select",{value:null!=(K=aS.planId)?K:"",onChange:e=>aL(t=>({...t,planId:e.target.value||null})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"",children:ed("admin.user_edit.no_plan")}),a$.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),aS.planExpiresAt&&(0,s.jsxs)("p",{className:"text-xs text-gray-500",children:[ed("admin.user_edit.plan_expires"),": ",new Date(aS.planExpiresAt).toLocaleDateString(rc)]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:!1!==aS.isActive,onChange:e=>aL(t=>({...t,isActive:e.target.checked})),className:"w-4 h-4 rounded border-gray-300 text-green-600"}),(0,s.jsx)("span",{className:"text-sm text-gray-700",children:ed("admin.user_edit.active")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.interface_lang")}),(0,s.jsxs)("select",{value:null!=(q=aS.locale)?q:"el",onChange:e=>aL(t=>({...t,locale:e.target.value})),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"el",children:"Ελληνικά"}),(0,s.jsx)("option",{value:"en",children:"English"}),(0,s.jsx)("option",{value:"ru",children:"Русский"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:ed("admin.user_edit.comm_languages")}),(0,s.jsx)("div",{className:"flex gap-5",children:["el","en","uk","ru"].map(e=>{var t;return(0,s.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:(null!=(t=aS.languages)?t:[]).includes(e),onChange:t=>{var a;let s=null!=(a=aS.languages)?a:[];aL(a=>({...a,languages:t.target.checked?[...s.filter(t=>t!==e),e]:s.filter(t=>t!==e)}))},className:"w-4 h-4 rounded border-gray-300 text-green-600"}),(0,s.jsx)("span",{className:"text-sm text-gray-700",children:"el"===e?"Ελληνικά":"en"===e?"English":"uk"===e?"Українська":"Русский"})]},e)})})]})]}),"balance"===aB&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-5 bg-gray-50 rounded-xl border border-gray-200",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:ed("admin.user_edit.balance")}),(0,s.jsxs)("div",{className:"text-2xl font-bold text-gray-900",children:[Number(null!=(G=aS.balance)?G:0).toFixed(2)," EUR"]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("button",{onClick:()=>aU("topup"),className:"flex items-center gap-1.5 px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white rounded-lg text-sm font-medium",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),ed("admin.balance.topup.btn")]}),(0,s.jsxs)("button",{onClick:()=>aU("withdraw"),className:"flex items-center gap-1.5 px-4 py-2 bg-rose-600 hover:bg-rose-700 text-white rounded-lg text-sm font-medium",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})}),ed("admin.balance.withdraw.btn")]})]})]}),(0,s.jsx)("p",{className:"text-xs text-center text-gray-400",children:ed("admin.balance.modal_hint")})]}),"settings"===aB&&(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsxs)("div",{className:"space-y-3 pt-1 divide-y divide-gray-100",children:[(0,s.jsxs)("label",{className:"flex items-center justify-between cursor-pointer py-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:ed("admin.user_edit.show_contact_info")}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:ed("admin.user_edit.show_contact_info.hint")})]}),(0,s.jsx)("input",{type:"checkbox",checked:null!=(X=aS.showContactInfo)&&X,onChange:e=>aL(t=>({...t,showContactInfo:e.target.checked})),className:"w-4 h-4 rounded border-gray-300 text-green-600"})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between cursor-pointer py-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:ed("admin.user_edit.notify_new_tasks")}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:ed("admin.user_edit.notify_new_tasks.hint")})]}),(0,s.jsx)("input",{type:"checkbox",checked:null!=(Y=aS.notifyNewTasks)&&Y,onChange:e=>aL(t=>({...t,notifyNewTasks:e.target.checked})),className:"w-4 h-4 rounded border-gray-300 text-green-600"})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between cursor-pointer py-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:ed("admin.user_edit.notif_messages")}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:ed("admin.user_edit.notif_messages.hint")})]}),(0,s.jsx)("input",{type:"checkbox",checked:null==(J=aS.notifMessages)||J,onChange:e=>aL(t=>({...t,notifMessages:e.target.checked})),className:"w-4 h-4 rounded border-gray-300 text-green-600"})]})]})}),"site"===aB&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:ed("admin.user_edit.personal_site_slug")}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-1 items-center border border-gray-300 rounded-lg overflow-hidden focus-within:ring-2 focus-within:ring-blue-400",children:[(0,s.jsx)("span",{className:"px-3 py-2 text-sm text-gray-400 bg-gray-50 border-r border-gray-300 flex-shrink-0",children:"canhelp.gr/site/"}),(0,s.jsx)("input",{value:null!=($=aS.personalSiteSlug)?$:"",onChange:e=>aL(t=>({...t,personalSiteSlug:e.target.value||null})),placeholder:"my-username",className:"flex-1 px-3 py-2 text-sm focus:outline-none"})]}),aS.personalSiteSlug&&(0,s.jsx)("a",{href:"/site/".concat(aS.personalSiteSlug),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 px-3 py-2 border border-gray-300 rounded-lg text-sm text-green-600 hover:bg-green-50 flex items-center gap-1",children:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})]})]}),aS.personalSiteSlug&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{className:"text-sm font-semibold text-gray-800 pt-3 border-t border-gray-100",children:ed("profile.site.visible_title")}),(0,s.jsx)("div",{className:"space-y-1",children:[{key:"showBio",label:ed("profile.site.visible.bio")},{key:"showRating",label:ed("profile.site.visible.rating")},{key:"showServices",label:ed("profile.site.visible.services")},{key:"showPortfolio",label:ed("profile.site.visible.portfolio")},{key:"showReviews",label:ed("profile.site.visible.reviews")},{key:"showPhone",label:ed("profile.site.visible.contacts")},{key:"showFullLastName",label:ed("profile.site.visible.full_last_name")},{key:"showStatus",label:ed("profile.site.visible.status")}].map(e=>{var t;return(0,s.jsxs)("label",{className:"flex items-center justify-between cursor-pointer py-1.5",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:e.label}),(0,s.jsx)("input",{type:"checkbox",checked:!1!==(null!=(t=aS.siteSettings)?t:{})[e.key],onChange:t=>aL(a=>{var s;return{...a,siteSettings:{...null!=(s=a.siteSettings)?s:{},[e.key]:t.target.checked}}}),className:"w-4 h-4 rounded border-gray-300 text-green-600"})]},e.key)})}),(0,s.jsxs)("div",{className:"pt-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:ed("profile.site.theme")}),(0,s.jsxs)("select",{value:null!=(Z=(null!=(Q=aS.siteSettings)?Q:{}).siteTheme)?Z:"dark",onChange:e=>aL(t=>{var a;return{...t,siteSettings:{...null!=(a=t.siteSettings)?a:{},siteTheme:e.target.value}}}),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm",children:[(0,s.jsx)("option",{value:"dark",children:ed("profile.site.theme.dark")}),(0,s.jsx)("option",{value:"light",children:ed("profile.site.theme.light")})]})]})]})]}),"specialist"===aB&&(0,s.jsxs)("div",{className:"space-y-6",children:[(()=>{var e;if((null==aS?void 0:aS.role)==="specialist")return null;let t=String(null!=(e=null==aS?void 0:aS.bio)?e:"").trim(),a=(null!=aW?aW:[]).filter(e=>{var t;return(null!=(t=e.publicationStatus)?t:e.isActive?"active":"inactive")==="active"}),l=a.length>0,n=a.some(e=>{var t,a;return(null!=(a=null==(t=e.categories)?void 0:t.length)?a:0)>0}),r=a.some(e=>{var t,a;return(null!=(a=null==(t=e.locations)?void 0:t.length)?a:0)>0}),i=[];return(t||i.push(ed("admin.user_edit.visibility_requirements.bio","Fill in bio")),l||i.push(ed("admin.user_edit.visibility_requirements.published_card","Publish at least one card")),n||i.push(ed("admin.user_edit.visibility_requirements.categories","Add a category in a published card")),r||i.push(ed("admin.user_edit.visibility_requirements.locations","Add a location in a published card")),0===i.length)?null:(0,s.jsxs)("div",{className:"rounded-xl border border-amber-300 bg-amber-50 p-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-amber-900",children:ed("admin.user_edit.visibility_requirements.title","Profile is not yet visible in Offers")}),(0,s.jsx)("p",{className:"text-xs text-amber-800 mt-1",children:ed("admin.user_edit.visibility_requirements.hint","Visibility requirements to complete:")}),(0,s.jsx)("ul",{className:"mt-2 text-xs text-amber-900 list-disc pl-5 space-y-0.5",children:i.map(e=>(0,s.jsx)("li",{children:e},e))})]})})(),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:ed("admin.user_edit.skills")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:(null!=(ee=aS.skills)?ee:[]).map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs bg-green-50 text-green-700 px-2 py-0.5 rounded-full",children:[e,(0,s.jsx)("button",{onClick:()=>aL(t=>{var a;return{...t,skills:(null!=(a=t.skills)?a:[]).filter(t=>t!==e)}}),className:"text-gray-400 hover:text-green-700 leading-none",children:"\xd7"})]},e))}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{value:aR,onChange:e=>aP(e.target.value),onKeyDown:e=>{if(("Enter"===e.key||","===e.key)&&aR.trim()){var t;e.preventDefault();let a=aR.trim().replace(/,$/,"");a&&!(null!=(t=aS.skills)?t:[]).includes(a)&&aL(e=>{var t;return{...e,skills:[...null!=(t=e.skills)?t:[],a]}}),aP("")}},placeholder:ed("admin.user_edit.skill_placeholder"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsx)("button",{onClick:()=>{var e;let t=aR.trim();t&&!(null!=(e=aS.skills)?e:[]).includes(t)&&aL(e=>{var a;return{...e,skills:[...null!=(a=e.skills)?a:[],t]}}),aP("")},className:"px-3 py-2 bg-green-600 text-white rounded-lg text-sm hover:bg-green-700",children:ed("common.add")})]})]}),(0,s.jsxs)("div",{className:"border-t border-gray-100 pt-4",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700 mb-3",children:ed("admin.user_edit.specialist_cards")}),aF?(0,s.jsx)("p",{className:"text-xs text-gray-400 py-2",children:ed("common.loading")}):0===aW.length?(0,s.jsx)("p",{className:"text-xs text-gray-400 py-4 text-center",children:ed("admin.user_edit.no_cards")}):(0,s.jsx)("div",{className:"space-y-4",children:aW.map(e=>{var t,a,l,n,r,i,o,d,c;return(0,s.jsxs)("div",{className:"border border-gray-200 bg-gray-50 rounded-xl p-4 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("input",{value:null!=(t=e.title)?t:"",onChange:t=>az(a=>a.map(a=>a.id===e.id?{...a,title:t.target.value}:a)),placeholder:ed("admin.user_edit.card_title"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsxs)("select",{value:null!=(a=e.publicationStatus)?a:e.isActive?"active":"inactive",onChange:t=>az(a=>a.map(a=>a.id===e.id?{...a,publicationStatus:t.target.value,isActive:"active"===t.target.value}:a)),className:"rounded-lg border border-gray-300 bg-white px-2 py-2 text-xs text-gray-700",children:[(0,s.jsx)("option",{value:"inactive",children:ed("admin.moderation.inactive","Draft")}),(0,s.jsx)("option",{value:"pending",children:ed("admin.moderation.pending","Under review")}),(0,s.jsx)("option",{value:"active",children:ed("admin.moderation.active","Active")})]})]}),(0,s.jsx)("textarea",{value:null!=(l=e.description)?l:"",onChange:t=>az(a=>a.map(a=>a.id===e.id?{...a,description:t.target.value}:a)),rows:3,placeholder:ed("admin.user_edit.card_description"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-1.5",children:ed("admin.user_edit.skills")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-1.5 min-h-[24px]",children:(null!=(n=e.skills)?n:[]).map(t=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs bg-green-50 text-green-700 px-2 py-0.5 rounded-full",children:[t,(0,s.jsx)("button",{onClick:()=>az(a=>a.map(a=>{var s;return a.id===e.id?{...a,skills:(null!=(s=a.skills)?s:[]).filter(e=>e!==t)}:a})),className:"text-gray-400 hover:text-green-700 leading-none",children:"\xd7"})]},t))}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{value:null!=(r=aV[e.id])?r:"",onChange:t=>aO(a=>({...a,[e.id]:t.target.value})),onKeyDown:t=>{var a,s,l;if(("Enter"===t.key||","===t.key)&&(null!=(a=aV[e.id])?a:"").trim()){t.preventDefault();let a=(null!=(s=aV[e.id])?s:"").trim().replace(/,$/,"");a&&!(null!=(l=e.skills)?l:[]).includes(a)&&az(t=>t.map(t=>{var s;return t.id===e.id?{...t,skills:[...null!=(s=t.skills)?s:[],a]}:t})),aO(t=>({...t,[e.id]:""}))}},placeholder:ed("admin.user_edit.skill_placeholder"),className:"flex-1 border border-gray-300 rounded-lg px-3 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-blue-400"}),(0,s.jsx)("button",{onClick:()=>{var t,a;let s=(null!=(t=aV[e.id])?t:"").trim();s&&!(null!=(a=e.skills)?a:[]).includes(s)&&az(t=>t.map(t=>{var a;return t.id===e.id?{...t,skills:[...null!=(a=t.skills)?a:[],s]}:t})),aO(t=>({...t,[e.id]:""}))},className:"px-2.5 py-1.5 bg-green-600 text-white rounded-lg text-xs hover:bg-green-700",children:"+"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-1.5",children:ed("admin.user_edit.categories")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-1.5 min-h-[24px]",children:(null!=(i=e.categories)?i:[]).map(t=>{var a;return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs bg-purple-50 text-purple-700 px-2 py-0.5 rounded-full",children:[b(null!=(a=st.find(e=>e.slug===t))?a:{slug:t},ec),(0,s.jsx)("button",{onClick:()=>az(a=>a.map(a=>{var s;return a.id===e.id?{...a,categories:(null!=(s=a.categories)?s:[]).filter(e=>e!==t)}:a})),className:"text-purple-400 hover:text-purple-700 leading-none",children:"\xd7"})]},t)})}),(0,s.jsx)(v,{catRows:st,locale:ec,selected:null!=(o=e.categories)?o:[],onAdd:t=>az(a=>a.map(a=>{var s;return a.id===e.id?{...a,categories:[...null!=(s=a.categories)?s:[],t]}:a})),addLabel:ed("admin.user_edit.add_category")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-1.5",children:ed("admin.user_edit.locations")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-1.5 min-h-[24px]",children:(null!=(d=e.locations)?d:[]).map(t=>{var a;return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs bg-green-50 text-green-700 px-2 py-0.5 rounded-full",children:[f(null!=(a=a4.find(e=>e.slug===t))?a:{slug:t},ec),(0,s.jsx)("button",{onClick:()=>az(a=>a.map(a=>{var s;return a.id===e.id?{...a,locations:(null!=(s=a.locations)?s:[]).filter(e=>e!==t)}:a})),className:"text-green-400 hover:text-green-700 leading-none",children:"\xd7"})]},t)})}),(0,s.jsx)(j,{locRows:a4,locale:ec,selected:null!=(c=e.locations)?c:[],onAdd:t=>az(a=>a.map(a=>{var s;return a.id===e.id?{...a,locations:[...null!=(s=a.locations)?s:[],t]}:a})),addLabel:ed("admin.user_edit.add_location")})]}),(0,s.jsx)("div",{className:"flex justify-end pt-1",children:(0,s.jsx)("button",{onClick:()=>nK(e.id),disabled:aK[e.id],className:"px-4 py-1.5 bg-green-600 hover:bg-green-700 text-white rounded-lg text-xs font-medium disabled:opacity-50",children:aK[e.id]?"...":ed("common.save")})})]},e.id)})})]})]})]})]}),"balance"!==aB?(0,s.jsxs)("div",{className:"border-t border-gray-100 px-6 py-4 flex gap-3 flex-shrink-0",children:[(0,s.jsx)("button",{onClick:nF,disabled:aE,className:"flex-1 bg-green-600 hover:bg-green-700 text-white py-2 rounded-lg text-sm font-semibold disabled:opacity-50",children:aE?"...":ed("common.save")}),(0,s.jsx)("button",{onClick:()=>aL(null),className:"flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 rounded-lg text-sm font-medium",children:ed("common.cancel")})]}):(0,s.jsx)("div",{className:"border-t border-gray-100 px-6 py-4 flex-shrink-0",children:(0,s.jsx)("button",{onClick:()=>aL(null),className:"w-full bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 rounded-lg text-sm font-medium",children:ed("common.close")})})]})}),aS&&aI&&(0,s.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 px-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl p-6 w-full max-w-sm border-t-4 ".concat("topup"===aI?"border-emerald-500":"border-rose-500"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h3",{className:"text-base font-semibold ".concat("topup"===aI?"text-emerald-900":"text-rose-900"),children:"topup"===aI?ed("admin.balance.topup.title"):ed("admin.balance.withdraw.title")}),(0,s.jsx)("button",{onClick:()=>aU(null),className:"text-gray-400 hover:text-gray-600 text-2xl leading-none",children:"\xd7"})]}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 mb-4",children:[ed("admin.user_edit.balance"),": ",(0,s.jsxs)("span",{className:"font-semibold text-gray-700",children:[Number(null!=(et=aS.balance)?et:0).toFixed(2)," EUR"]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium mb-1 ".concat("topup"===aI?"text-emerald-800":"text-rose-800"),children:"topup"===aI?ed("admin.balance.topup.amount"):ed("admin.balance.withdraw.amount")}),(0,s.jsx)("input",{type:"number",min:"0.01",step:"0.01",value:"topup"===aI?null!=(ea=aS.topUpAmount)?ea:"":null!=(es=aS.withdrawAmount)?es:"",onChange:e=>aL(t=>"topup"===aI?{...t,topUpAmount:e.target.value}:{...t,withdrawAmount:e.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 ".concat("topup"===aI?"border-emerald-300 focus:ring-emerald-400":"border-rose-300 focus:ring-rose-400")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium mb-1 ".concat("topup"===aI?"text-emerald-800":"text-rose-800"),children:"topup"===aI?ed("admin.balance.topup.description"):ed("admin.balance.withdraw.description")}),(0,s.jsx)("input",{value:"topup"===aI?null!=(el=aS.topUpDescription)?el:"":null!=(en=aS.withdrawDescription)?en:"",onChange:e=>aL(t=>"topup"===aI?{...t,topUpDescription:e.target.value}:{...t,withdrawDescription:e.target.value}),placeholder:"topup"===aI?ed("admin.balance.topup.description.placeholder"):ed("admin.balance.withdraw.description.placeholder"),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 ".concat("topup"===aI?"border-emerald-300 focus:ring-emerald-400":"border-rose-300 focus:ring-rose-400")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 mt-5",children:[(0,s.jsx)("button",{onClick:async()=>{"topup"===aI?await nV():await nO(),aU(null)},disabled:"topup"===aI?ak||!Number(aS.topUpAmount):aC||!Number(aS.withdrawAmount),className:"flex-1 text-white py-2 rounded-lg text-sm font-semibold disabled:opacity-50 ".concat("topup"===aI?"bg-emerald-600 hover:bg-emerald-700":"bg-rose-600 hover:bg-rose-700"),children:("topup"===aI?ak:aC)?ed("common.loading"):"topup"===aI?ed("admin.balance.topup.submit"):ed("admin.balance.withdraw.submit")}),(0,s.jsx)("button",{onClick:()=>aU(null),className:"flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 rounded-lg text-sm font-medium",children:ed("common.cancel")})]})]})})]})]})]})})}function k(){var e;let[t,a]=(0,l.useState)(!1),[n,r]=(0,l.useState)(null),[i,o]=(0,l.useState)({}),[d,m]=(0,l.useState)(null);function x(e){var t,a,s,l;return null!=(l=null==(a=e[0])||null==(t=a.nameEl)?void 0:t.toLowerCase().trim())?l:null==(s=e[0])?void 0:s.id}async function u(){a(!0),r(null),o({});try{let e=await c.GE();r(e);let t={};e.forEach(e=>{let a=[...e].sort((e,t)=>{var a,s;return(null!=(a=t.usageCount)?a:0)-(null!=(s=e.usageCount)?s:0)})[0];t[x(e)]=a.id}),o(t)}catch(e){r([])}finally{a(!1)}}async function g(e,t){let a=i[e];if(!a)return;let s=t.filter(e=>e.id!==a).map(e=>e.id);if(s.length){m(e);try{await c.Uq(a,s),r(t=>t?t.filter(t=>x(t)!==e):t)}catch(e){}finally{m(null)}}}async function p(){if(null==n?void 0:n.length){for(let e of(m("__all__"),[...n])){let t=x(e),a=i[t];if(!a)continue;let s=e.filter(e=>e.id!==a).map(e=>e.id);if(s.length)try{await c.Uq(a,s),r(e=>e?e.filter(e=>x(e)!==t):e)}catch(e){}}m(null)}}let h=null!=(e=null==n?void 0:n.reduce((e,t)=>e+t.length-1,0))?e:0;return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:"Проверка базы данных"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:"Диагностика и исправление проблем в базе данных"})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[(0,s.jsxs)("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-800",children:"Дубликаты навыков"}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:"Поиск навыков с одинаковым именем в одной категории. При объединении — ссылки в карточках специалистов обновляются автоматически."})]}),(0,s.jsxs)("button",{onClick:u,disabled:t,className:"text-sm px-4 py-2 rounded-lg bg-orange-50 text-green-700 border border-orange-200 hover:bg-green-100 font-medium flex items-center gap-2 transition disabled:opacity-50",children:[(0,s.jsxs)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35"})]}),t?"Ищу…":"Найти дубликаты"]})]}),null!==n&&(0,s.jsx)("div",{className:"p-5",children:0===n.length?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-emerald-700 bg-emerald-50 border border-emerald-200 rounded-lg px-4 py-3",children:[(0,s.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Дубликатов не найдено — база в порядке"]}):(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("p",{className:"text-sm text-green-700 font-semibold",children:["Найдено ",n.length," групп \xb7 ",h," лишних записей"]}),(0,s.jsx)("button",{onClick:p,disabled:"__all__"===d,className:"text-sm px-4 py-1.5 bg-red-600 text-white rounded-lg font-semibold hover:bg-red-700 disabled:opacity-50 transition",children:"__all__"===d?"Объединяю…":"Объединить все (".concat(n.length,")")})]}),n.map(e=>{var t,a;let l=x(e);return(0,s.jsxs)("div",{className:"bg-white border border-orange-200 rounded-xl overflow-hidden shadow-sm",children:[(0,s.jsxs)("div",{className:"px-4 py-2.5 bg-orange-50 border-b border-orange-100 flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("span",{className:"text-sm font-semibold text-orange-800",children:["\xab",null==(t=e[0])?void 0:t.nameEl,"\xbb"]}),(0,s.jsx)("span",{className:"ml-2 text-xs text-green-600 font-mono",children:null==(a=e[0])?void 0:a.categorySlug}),(0,s.jsxs)("span",{className:"ml-2 text-xs text-orange-400",children:[e.length," варианта"]})]}),(0,s.jsx)("button",{onClick:()=>g(l,e),disabled:!!d,className:"shrink-0 text-xs px-3 py-1 bg-orange-600 text-white rounded-lg font-semibold hover:bg-orange-700 disabled:opacity-50 transition",children:d===l?"Объединяю…":"Объединить"})]}),(0,s.jsx)("div",{className:"divide-y divide-gray-50",children:e.map(e=>(0,s.jsxs)("label",{className:"flex items-center gap-3 px-4 py-2.5 cursor-pointer hover:bg-gray-50 transition",children:[(0,s.jsx)("input",{type:"radio",name:"dedup-global-".concat(l),checked:i[l]===e.id,onChange:()=>o(t=>({...t,[l]:e.id})),className:"accent-amber-600 shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-800",children:e.nameEl}),e.nameEn&&e.nameEn!==e.nameEl&&(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["EN: ",e.nameEn]}),e.nameRu&&e.nameRu!==e.nameEl&&(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["RU: ",e.nameRu]}),e.nameUk&&(0,s.jsxs)("span",{className:"text-xs text-gray-400",children:["UK: ",e.nameUk]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-0.5",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold ".concat(e.usageCount>0?"text-green-600":"text-gray-400"),children:e.usageCount>0?"".concat(e.usageCount," использований"):"не использовался"}),(0,s.jsxs)("span",{className:"text-[11px] text-gray-300",children:["order: ",e.order]}),i[l]===e.id&&(0,s.jsx)("span",{className:"text-[11px] font-bold text-amber-600 uppercase",children:"← оставить"})]})]})]},e.id))})]},l)})]})})]})]})}function w(e){let{rows:t,parentId:a,depth:l,locale:n,expanded:r,onToggle:i,onEdit:o,onDelete:d,onAddChild:c,t:m}=e,x=t.filter(e=>{var t;return(null!=(t=e.parentId)?t:null)===a});return 0===x.length?null:(0,s.jsx)(s.Fragment,{children:x.sort((e,t)=>{var a,s;return(null!=(a=e.order)?a:0)-(null!=(s=t.order)?s:0)}).map(e=>{let a=t.some(t=>t.parentId===e.id),x=r.has(e.id),u=("en"===n?e.nameEn:"ru"===n?e.nameRu:"uk"===n?e.nameUk:e.nameEl)||e.nameEl||e.slug;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 hover:bg-gray-50 ".concat(e.isActive?"":"opacity-50"),style:{paddingLeft:"".concat(16+24*l,"px")},children:[(0,s.jsx)("button",{onClick:()=>a&&i(e.id),className:"w-5 h-5 flex items-center justify-center text-gray-400 rounded ".concat(a?"hover:bg-gray-200 cursor-pointer":"cursor-default"),children:a?x?(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"6 9 12 15 18 9"})}):(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"9 18 15 12 9 6"})}):(0,s.jsx)("span",{className:"w-3.5 h-3.5 block"})}),0===l?(0,s.jsx)("svg",{className:"w-5 h-5 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})}):(0,s.jsxs)("svg",{className:"w-4 h-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"font-medium text-gray-800 text-sm",children:u}),(0,s.jsx)("span",{className:"ml-2 text-xs text-gray-400",children:e.nameEn}),(0,s.jsxs)("span",{className:"ml-1.5 font-mono text-xs text-gray-300",children:["/",e.slug]})]}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(e.isActive?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"),children:e.isActive?m("admin.cat.active"):m("admin.cat.inactive")}),(0,s.jsxs)("div",{className:"flex gap-1 flex-shrink-0",children:[0===l&&(0,s.jsx)("button",{onClick:()=>c(e.id),className:"text-xs px-2 py-1 rounded-lg bg-green-50 text-green-600 hover:bg-green-100 font-medium",title:m("admin.loc.add_district"),children:"+"}),(0,s.jsx)("button",{onClick:()=>o(e),className:"text-xs px-2 py-1 rounded-lg bg-gray-100 text-gray-600 hover:bg-gray-200 font-medium",children:m("common.edit")}),(0,s.jsx)("button",{onClick:()=>d(e.id,u),className:"text-xs px-2 py-1 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 font-medium",children:m("common.delete")})]})]}),a&&x&&(0,s.jsx)(w,{rows:t,parentId:e.id,depth:l+1,locale:n,expanded:r,onToggle:i,onEdit:o,onDelete:d,onAddChild:c,t:m})]},e.id)})})}function C(e){let{rows:t,parentId:a,depth:l,locale:n,expanded:r,onToggle:i,onEdit:o,onDelete:d,onAddChild:c,skillsExpanded:m,skillsCache:x,skillsLoading:g,onToggleSkills:p,skillForm:h,skillSaving:b,onOpenAddSkill:f,onOpenEditSkill:y,onSaveSkill:v,onDeleteSkill:j,onCancelSkillForm:N,onSkillFormChange:k,t:w}=e,_=t.filter(e=>{var t;return(null!=(t=e.parentId)?t:null)===a});return 0===_.length?null:(0,s.jsx)(s.Fragment,{children:_.sort((e,t)=>{var a,s;return(null!=(a=e.order)?a:0)-(null!=(s=t.order)?s:0)}).map(e=>{var a,_;let S=t.some(t=>t.parentId===e.id),E=r.has(e.id),D=m.has(e.id),M=g.has(e.id),A=null!=(_=x[e.slug])?_:[],B=("en"===n?e.namesEn:"ru"===n?e.namesRu:"uk"===n?e.namesUk:e.namesEl)||e.namesEl||e.slug;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 hover:bg-gray-50 ".concat(e.isActive?"":"opacity-50"),style:{paddingLeft:"".concat(16+24*l,"px")},children:[(0,s.jsx)("button",{onClick:()=>S&&i(e.id),className:"w-5 h-5 flex items-center justify-center text-gray-400 rounded ".concat(S?"hover:bg-gray-200 cursor-pointer":"cursor-default"),children:S?E?(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"6 9 12 15 18 9"})}):(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,s.jsx)("polyline",{points:"9 18 15 12 9 6"})}):(0,s.jsx)("span",{className:"w-3.5 h-3.5 block"})}),(0,s.jsx)("span",{className:"w-10 h-10 flex items-center justify-center rounded-xl bg-green-50",children:(0,s.jsx)(u.Ez,{icon:e.icon,alt:B,className:"h-7 w-7 object-contain text-2xl leading-none",fallback:"\uD83D\uDCE6"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"font-medium text-gray-800 text-sm",children:B}),(0,s.jsx)("span",{className:"ml-2 text-xs text-gray-400",children:e.namesEn||(null==(a=e.names)?void 0:a.en)}),(0,s.jsxs)("span",{className:"ml-1.5 font-mono text-xs text-gray-300",children:["/",e.slug]})]}),(0,s.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium ".concat(e.isActive?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"),children:e.isActive?w("admin.cat.active"):w("admin.cat.inactive")}),(0,s.jsxs)("div",{className:"flex gap-1 flex-shrink-0",children:[(0,s.jsxs)("button",{onClick:()=>p(e),className:"text-xs px-2 py-1 rounded-lg font-medium flex items-center gap-1 ".concat(D?"bg-amber-100 text-amber-700":"bg-amber-50 text-amber-600 hover:bg-amber-100"),title:"Навыки",children:[(0,s.jsx)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"})}),x[e.slug]?x[e.slug].length:w("admin.cat.skills","Skills")]}),(0,s.jsx)("button",{onClick:()=>c(e.id),className:"text-xs px-2 py-1 rounded-lg bg-green-50 text-green-600 hover:bg-green-100 font-medium",title:w("admin.cat.add_child"),children:"+"}),(0,s.jsx)("button",{onClick:()=>o(e),className:"text-xs px-2 py-1 rounded-lg bg-gray-100 text-gray-600 hover:bg-gray-200 font-medium",children:w("common.edit")}),(0,s.jsx)("button",{onClick:()=>d(e.id,B),className:"text-xs px-2 py-1 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 font-medium",children:w("common.delete")})]})]}),D&&(0,s.jsx)(L,{cat:e,locale:n,depth:l,t:w,skills:A,isLoading:M,skillForm:h,skillSaving:b,onOpenAddSkill:f,onOpenEditSkill:y,onSaveSkill:v,onDeleteSkill:j,onCancelSkillForm:N,onSkillFormChange:k}),S&&E&&(0,s.jsx)(C,{rows:t,parentId:e.id,depth:l+1,locale:n,expanded:r,onToggle:i,onEdit:o,onDelete:d,onAddChild:c,skillsExpanded:m,skillsCache:x,skillsLoading:g,onToggleSkills:p,skillForm:h,skillSaving:b,onOpenAddSkill:f,onOpenEditSkill:y,onSaveSkill:v,onDeleteSkill:j,onCancelSkillForm:N,onSkillFormChange:k,t:w})]},e.id)})})}let _={nameEl:"\uD83C\uDDEC\uD83C\uDDF7 EL",nameEn:"\uD83C\uDDEC\uD83C\uDDE7 EN",nameRu:"\uD83C\uDDF7\uD83C\uDDFA RU",nameUk:"\uD83C\uDDFA\uD83C\uDDE6 UK"};function S(e){var t,a;let{form:l,saving:n,onSave:r,onCancel:i,onChange:o}=e;return(0,s.jsxs)("div",{className:"bg-white border border-amber-200 rounded-xl p-4 shadow-sm",children:[(0,s.jsx)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:["nameEl","nameEn","nameRu","nameUk"].map((e,t)=>{var a;return(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] font-semibold text-gray-500 mb-1 uppercase tracking-wide",children:_[e]}),(0,s.jsx)("input",{value:null!=(a=l[e])?a:"",onChange:t=>o({...l,[e]:t.target.value}),className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-amber-400 focus:border-transparent transition",autoFocus:0===t,placeholder:"nameUk"===e?"необовʼязково":""})]},e)})}),(0,s.jsxs)("div",{className:"flex items-center gap-3 pt-1 border-t border-gray-100",children:[(0,s.jsx)("label",{className:"text-xs text-gray-400 font-medium",children:"Порядок"}),(0,s.jsx)("input",{type:"number",value:null!=(a=l.order)?a:0,onChange:e=>o({...l,order:Number(e.target.value)}),className:"w-16 border border-gray-200 rounded-lg px-2 py-1 text-xs text-center"}),(0,s.jsxs)("div",{className:"flex gap-2 ml-auto",children:[(0,s.jsx)("button",{onClick:i,className:"px-3 py-1.5 bg-gray-100 text-gray-600 rounded-lg text-xs font-medium hover:bg-gray-200 transition",children:"Отмена"}),(0,s.jsx)("button",{onClick:r,disabled:n||!(null==(t=l.nameEl)?void 0:t.trim()),className:"px-4 py-1.5 bg-amber-600 text-white rounded-lg text-xs font-semibold hover:bg-amber-700 disabled:opacity-40 transition",children:n?"Сохраняю…":"Сохранить"})]})]})]})}function L(e){let{cat:t,locale:a,depth:l,t:n,skills:r,isLoading:i,skillForm:o,skillSaving:d,onOpenAddSkill:c,onOpenEditSkill:m,onSaveSkill:x,onDeleteSkill:u,onCancelSkillForm:g,onSkillFormChange:p}=e,h=(null==o?void 0:o.catSlug)===t.slug&&!(null==o?void 0:o.id);return(0,s.jsxs)("div",{className:"border-t border-amber-100 bg-gradient-to-b from-amber-50/60 to-white",style:{paddingLeft:"".concat(16+24*l+36,"px"),paddingRight:"16px",paddingTop:"14px",paddingBottom:"14px"},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-amber-700 uppercase tracking-wider",children:"Навыки"}),(0,s.jsxs)("span",{className:"text-xs text-amber-500 font-mono",children:["/",t.slug]}),(0,s.jsxs)("span",{className:"ml-1 text-xs text-amber-400",children:["(",r.length,")"]}),(0,s.jsx)("div",{className:"ml-auto",children:(0,s.jsxs)("button",{onClick:()=>{g(),c(t.slug)},className:"text-xs px-2.5 py-1 rounded-lg bg-amber-600 text-white hover:bg-amber-700 font-semibold flex items-center gap-1 transition",children:[(0,s.jsxs)("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:[(0,s.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,s.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Добавить"]})})]}),i?(0,s.jsxs)("div",{className:"flex items-center gap-2 py-3 text-xs text-gray-400",children:[(0,s.jsxs)("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",className:"opacity-25"}),(0,s.jsx)("path",{fill:"currentColor",d:"M4 12a8 8 0 018-8v8z",className:"opacity-75"})]}),"Загрузка…"]}):(0,s.jsxs)("div",{className:"space-y-1",children:[0===r.length&&!h&&(0,s.jsx)("p",{className:"text-xs text-gray-400 italic py-2",children:"Навыки не добавлены"}),r.map(e=>{let l=(null==o?void 0:o.id)===e.id,r="en"===a?e.nameEn:"ru"===a?e.nameRu:"uk"===a?e.nameUk||e.nameEn:e.nameEl;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 group transition ".concat(l?"bg-amber-50 border border-amber-200":"bg-white border border-gray-100 hover:border-amber-200 hover:bg-amber-50/30"),children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-800",children:r}),"en"!==a&&e.nameEn&&(0,s.jsx)("span",{className:"ml-2 text-xs text-gray-400",children:e.nameEn}),"ru"!==a&&e.nameRu&&e.nameRu!==e.nameEl&&(0,s.jsx)("span",{className:"ml-1.5 text-xs text-gray-300",children:e.nameRu})]}),e.order>0&&(0,s.jsxs)("span",{className:"text-[10px] text-gray-300 font-mono",children:["#",e.order]}),(0,s.jsxs)("div",{className:"flex gap-1 transition-opacity ".concat(l?"opacity-100":"opacity-0 group-hover:opacity-100"),children:[(0,s.jsx)("button",{onClick:()=>l?g():(g(),m(e,t.slug)),className:"text-xs px-2 py-0.5 rounded-md font-medium transition ".concat(l?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600 hover:bg-amber-100 hover:text-amber-700"),children:l?"✕":n("common.edit")}),(0,s.jsx)("button",{onClick:()=>u(e,t.slug),className:"text-xs px-2 py-0.5 rounded-md bg-red-50 text-red-600 hover:bg-red-100 transition",children:n("common.delete")})]})]}),l&&(0,s.jsx)("div",{className:"mt-1 mb-1 ml-0",children:(0,s.jsx)(S,{form:o,saving:d,onSave:x,onCancel:g,onChange:p})})]},e.id)}),h&&(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(S,{form:o,saving:d,onSave:x,onCancel:g,onChange:p})})]})]})}function E(e){let{page:t,total:a,limit:l,onChange:n,totalLabel:r}=e,i=Math.ceil(a/l);return i<=1?null:(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-100 text-sm text-gray-500",children:[(0,s.jsxs)("span",{children:[r,": ",a]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{onClick:()=>n(t-1),disabled:1===t,className:"px-3 py-1 rounded-lg border border-gray-200 disabled:opacity-40 hover:bg-gray-50",children:"←"}),(0,s.jsxs)("span",{className:"px-3 py-1",children:[t," / ",i]}),(0,s.jsx)("button",{onClick:()=>n(t+1),disabled:t>=i,className:"px-3 py-1 rounded-lg border border-gray-200 disabled:opacity-40 hover:bg-gray-50",children:"→"})]})]})}function D(e){try{return e?JSON.parse(e):null}catch(e){return null}}let M={"user.login":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),labelKey:"admin.event.user_login",color:"bg-green-50 text-green-700 border-green-100"},"user.register":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})}),labelKey:"admin.event.user_register",color:"bg-green-50 text-green-700 border-green-100"},"admin.user.deactivate":{icon:(0,s.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]}),labelKey:"admin.event.admin_user_deactivate",color:"bg-red-50 text-red-700 border-red-100"},"admin.user.activate":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),labelKey:"admin.event.admin_user_activate",color:"bg-emerald-50 text-emerald-700 border-emerald-100"},"admin.user.role_changed":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})}),labelKey:"admin.event.admin_user_role_changed",color:"bg-purple-50 text-purple-700 border-purple-100"},"admin.task.cancelled":{icon:(0,s.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,s.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),labelKey:"admin.event.admin_task_cancelled",color:"bg-orange-50 text-green-700 border-orange-100"},"admin.task.deleted":{icon:(0,s.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6m5 0V4a1 1 0 011-1h2a1 1 0 011 1v2"})]}),labelKey:"admin.event.admin_task_deleted",color:"bg-red-50 text-red-700 border-red-100"},"admin.report.reviewed":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})}),labelKey:"admin.event.admin_report_reviewed",color:"bg-teal-50 text-teal-700 border-teal-100"},"admin.report.dismissed":{icon:(0,s.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),labelKey:"admin.event.admin_report_dismissed",color:"bg-gray-50 text-gray-600 border-gray-200"},"task.created":{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),labelKey:"admin.event.task_created",color:"bg-indigo-50 text-indigo-700 border-indigo-100"}};function A(e){var t;let{entry:a,dateLocale:l,onFilterUser:n,t:r}=e,i=null!=(t=M[a.event])?t:{icon:(0,s.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),labelKey:a.event,color:"bg-gray-50 text-gray-700 border-gray-200"},o=D(a.details);return(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 px-4 py-3 flex items-start gap-3",children:[(0,s.jsxs)("span",{className:"shrink-0 mt-0.5 px-2.5 py-1 rounded-lg border text-xs font-semibold flex items-center gap-1.5 ".concat(i.color),children:[i.icon," ",r(i.labelKey,i.labelKey)]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[a.userName&&(0,s.jsx)("button",{onClick:()=>a.userId&&n(a.userId),className:"text-sm font-medium text-gray-800 hover:text-green-600",children:a.userName}),a.userEmail&&(0,s.jsx)("span",{className:"text-xs text-gray-400",children:a.userEmail})]}),o&&Object.keys(o).length>0&&(0,s.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:Object.entries(o).map(e=>{let[t,a]=e;return(0,s.jsxs)("span",{className:"text-xs bg-gray-100 text-gray-600 px-2 py-0.5 rounded",children:[t,": ",(0,s.jsx)("span",{className:"font-medium",children:String(a)})]},t)})}),a.ipAddress&&(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:a.ipAddress})]}),(0,s.jsx)("time",{className:"shrink-0 text-xs text-gray-400 whitespace-nowrap",children:new Date(a.createdAt).toLocaleString(l)})]})}function B(e){let{series:t,dateLocale:a="en-US"}=e,l=new Set;t.forEach(e=>e.data.forEach(e=>l.add(e.month)));let n=Array.from(l).sort();if(0===n.length)return null;let r=t.map(e=>{let t={};return e.data.forEach(e=>{t[e.month]=Number(e.count)}),n.map(e=>{var a;return null!=(a=t[e])?a:0})}),i=Math.max(...r.flat(),1),o=i>=1e6?50:i>=1e4?44:i>=1e3?40:36;n.length,t.length;let d=(700-o-8)/n.length,c=Math.max(4,Math.min(20,d/t.length-2)),m=[0,Math.round(i/3),Math.round(2*i/3),i];return(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("svg",{viewBox:"0 0 ".concat(700," ").concat(174),className:"w-full",style:{minWidth:Math.max(360,40*n.length)},children:[m.map((e,t)=>{let a=136-e/i*136;return(0,s.jsxs)("g",{children:[(0,s.jsx)("line",{x1:o,y1:a,x2:696,y2:a,stroke:"#f3f4f6",strokeWidth:1}),(0,s.jsx)("text",{x:o-5,y:a+3.5,textAnchor:"end",fontSize:9,fill:"#9ca3af",children:I(e)})]},t)}),n.map((e,a)=>t.map((e,l)=>{let n=r[l][a]/i*136,m=o+a*d+(d-t.length*(c+1))/2+l*(c+1);return(0,s.jsx)("rect",{x:m,y:136-n,width:c,height:n,fill:e.color,opacity:.8,rx:2},"bar-".concat(a,"-").concat(l))})),n.map((e,t)=>{let[l,n]=e.slice(0,7).split("-").map(Number),r=new Date(Date.UTC(l,n-1,2)),i=new Intl.DateTimeFormat(a,{month:"short"}).format(r)+(0===t||1===n?" ".concat(l):""),c=o+t*d+d/2;return(0,s.jsx)("text",{x:c,y:172,textAnchor:"middle",fontSize:9,fill:"#9ca3af",children:i},"xl-".concat(t))}),(0,s.jsx)("line",{x1:o,y1:136,x2:696,y2:136,stroke:"#e5e7eb",strokeWidth:1})]})})}function T(e){if(e.length<2)return"";let t="M ".concat(e[0][0].toFixed(1)," ").concat(e[0][1].toFixed(1));for(let a=1;a<e.length;a++){let s=((e[a-1][0]+e[a][0])/2).toFixed(1);t+=" C ".concat(s," ").concat(e[a-1][1].toFixed(1)," ").concat(s," ").concat(e[a][1].toFixed(1)," ").concat(e[a][0].toFixed(1)," ").concat(e[a][1].toFixed(1))}return t}function I(e){return e>=1e6?"".concat(+(e/1e6).toFixed(1),"M"):e>=1e3?"".concat(Math.round(e/1e3),"K"):String(e)}function U(e){let{series:t,days:a}=e,l=null!=a?a:function(){let e=[];for(let t=29;t>=0;t--){let a=new Date(Date.now()-864e5*t);e.push(a.toISOString().slice(0,10))}return e}(),n=t.map(e=>{let t={};return e.data.forEach(e=>{t[e.day]=Number(e.count)}),l.map(e=>{var a;return null!=(a=t[e])?a:0})}),r=Math.max(...n.flat(),1),i=r>=1e4?44:r>=1e3?40:36,o=(700-i-4)/(l.length-1);function d(e){return e.map((e,t)=>[i+t*o,138-e/r*138])}let c=[0,Math.round(r/3),Math.round(2*r/3),r],m=l.map((e,t)=>({i:t,label:e.slice(8)})).filter((e,t)=>t%7==0||t===l.length-1);return(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("svg",{viewBox:"0 0 ".concat(700," ").concat(172),className:"w-full",style:{minWidth:360},children:[c.map((e,t)=>{let a=138-e/r*138;return(0,s.jsxs)("g",{children:[(0,s.jsx)("line",{x1:i,y1:a,x2:696,y2:a,stroke:"#f3f4f6",strokeWidth:1}),(0,s.jsx)("text",{x:i-5,y:a+3.5,textAnchor:"end",fontSize:9,fill:"#9ca3af",children:I(e)})]},t)}),m.map(e=>{let{i:t}=e,a=i+t*o;return(0,s.jsx)("line",{x1:a,y1:0,x2:a,y2:138,stroke:"#f9fafb",strokeWidth:1},"vg-".concat(t))}),m.map(e=>{let{i:t,label:a}=e;return(0,s.jsx)("text",{x:i+t*o,y:170,textAnchor:"middle",fontSize:9,fill:"#9ca3af",children:a},t)}),t.map((e,t)=>(0,s.jsx)("path",{d:function(e){let t=d(e),a=T(t);if(!a)return"";let s=t[t.length-1][0].toFixed(1);return"".concat(a," L ").concat(s," ").concat("138.0"," L ").concat(i.toFixed(1)," ").concat("138.0"," Z")}(n[t]),fill:e.fill},"fill-".concat(t))),t.map((e,t)=>(0,s.jsx)("path",{d:T(d(n[t])),fill:"none",stroke:e.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},"line-".concat(t))),t.map((e,t)=>{let a=d(n[t]),l=a[a.length-1];return(0,s.jsx)("g",{children:(0,s.jsx)("circle",{cx:l[0],cy:l[1],r:4,fill:"white",stroke:e.color,strokeWidth:2})},"dot-".concat(t))}),(0,s.jsx)("line",{x1:i,y1:138,x2:696,y2:138,stroke:"#e5e7eb",strokeWidth:1})]})})}},7067:(e,t,a)=>{Promise.resolve().then(a.bind(a,6961))}},e=>{e.O(0,[1516,9664,9906,2982,587,18,7358],()=>e(e.s=7067)),_N_E=e.O()}]);
Save
cmd:
run