(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{3293:function(e,t,s){Promise.resolve().then(s.t.bind(s,7960,23)),Promise.resolve().then(s.bind(s,2637)),Promise.resolve().then(s.t.bind(s,8003,23)),Promise.resolve().then(s.t.bind(s,2217,23))},2637:function(e,t,s){"use strict";s.d(t,{ClientBodyWrapper:function(){return W}});var l=s(7437),a=s(2265),r=s(9376),i=s(1769),n=s(5471),o=s(5685),c=s(7769),d=s(2489),x=s(7586),h=s(6247),u=s(4508),p=s(2369),m=s(9525),w=s(3247),b=s(875),f=s(2141);let g=["Технический сбой","Проблема с заказом","Оплата и баланс","Контакты","Аккаунт","Другое"],y={new:"Новое",in_progress:"В работе",resolved:"Решено",closed:"Закрыто"},v={new:"text-blue-400 bg-blue-500/10",in_progress:"text-yellow-400 bg-yellow-500/10",resolved:"text-green-400 bg-green-500/10",closed:"text-white/30 bg-white/5"};async function j(e){let t=f.supabase.schema("pricing").from("faq_articles").select("id, role, category, question, answer, keywords, sort_order").eq("is_active",!0).order("sort_order",{ascending:!0});e&&(t=t.in("role",[e,"both"]));let{data:s}=await t;return s||[]}async function N(e,t){try{var s,l;let a=(s="https://d5dph57nmc3g210eifv5.uvah0e6r.apigw.yandexcloud.net",void 0!==s)?s:"",r=(l="sb_publishable_FfiY2-PDj2Xx3fYvrwNKIQ_gOB8Sdpr",void 0!==l)?l:"";if(!a||!r)return;let i=await fetch("".concat(a,"/functions/v1/send-support-email"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r),apikey:r},body:JSON.stringify({...e,ticket_id:t})});i.ok||console.warn("[support] email send failed:",i.status,await i.text())}catch(e){console.warn("[support] email send exception:",e)}}async function k(e){let t=crypto.randomUUID(),{error:l}=await f.supabase.schema("communications").from("support_tickets").insert([{id:t,...e,status:"new"}]);if(l)throw l;return N(e,t),s.e(6580).then(s.bind(s,6580)).then(t=>{var s,l,a,r,i;let{notifyTelegram:n}=t;n("support_ticket",{role:null!==(s=e.role)&&void 0!==s?s:null,email:null!==(l=e.contact_email)&&void 0!==l?l:null,phone:null!==(a=e.contact_phone)&&void 0!==a?a:null,category:e.category,subject:null!==(r=e.subject)&&void 0!==r?r:e.category,message:e.message,pageUrl:null!==(i=e.page_url)&&void 0!==i?i:null}).catch(()=>{})}).catch(()=>{}),t}async function _(e){let{data:t}=await f.supabase.schema("communications").from("support_tickets").select("id, category, subject, message, status, created_at, service_type, order_id, role").eq("user_id",e).order("created_at",{ascending:!1});return t||[]}function C(e){let{open:t,onClose:s,onOpenSupport:r,defaultRole:n}=e,[o,c]=(0,a.useState)([]),[f,g]=(0,a.useState)(!1),[y,v]=(0,a.useState)(""),[N,k]=(0,a.useState)("Все"),[_,C]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&(g(!0),k("Все"),j(null!=n?n:null).then(c).finally(()=>g(!1)))},[t,n]);let S=(0,a.useMemo)(()=>N&&"Все"!==N?o.filter(e=>e.category===N):o,[o,N]),E=(0,a.useMemo)(()=>(function(e,t){let s=t.toLowerCase().trim();return s?e.filter(e=>e.question.toLowerCase().includes(s)||e.answer.toLowerCase().includes(s)||e.keywords.some(e=>e.toLowerCase().includes(s))):e})(S,y),[S,y]),I=(0,a.useMemo)(()=>["Все",...Array.from(new Set(o.map(e=>e.category)))],[o]);return(0,l.jsx)(x.M,{children:t&&(0,l.jsxs)("div",{className:"fixed inset-0 z-[8000] flex items-end sm:items-center justify-center",children:[(0,l.jsx)(h.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/80 backdrop-blur-md",onClick:s}),(0,l.jsxs)(h.E.div,{initial:{opacity:0,y:60,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:60,scale:.97},transition:{type:"spring",damping:28,stiffness:300},className:"relative w-full max-w-xl bg-[#0a0a0a] border border-white/10 rounded-t-[32px] sm:rounded-[32px] max-h-[90vh] flex flex-col overflow-hidden shadow-[0_0_80px_rgba(234,179,8,0.08)]",children:[(0,l.jsxs)("div",{className:"px-6 pt-6 pb-4 border-b border-white/5 flex-shrink-0",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("h2",{className:"text-xl font-black text-white uppercase tracking-tight flex items-center gap-2",children:[(0,l.jsx)(i.Z,{className:"w-5 h-5 text-yellow-500"}),"Помощь"]}),(0,l.jsx)("button",{onClick:s,className:"w-9 h-9 rounded-full bg-white/5 hover:bg-white/10 flex items-center justify-center transition-colors",children:(0,l.jsx)(d.Z,{className:"w-4 h-4 text-white/50"})})]}),n&&(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsxs)("span",{className:(0,u.cn)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-black uppercase tracking-wider","customer"===n?"bg-yellow-500 text-black":"bg-blue-500 text-white"),children:["customer"===n?(0,l.jsx)(p.Z,{className:"w-3 h-3"}):(0,l.jsx)(m.Z,{className:"w-3 h-3"}),"customer"===n?"Для заказчиков":"Для исполнителей"]}),(0,l.jsx)("span",{className:"text-white/20 text-[10px] font-black uppercase tracking-wider",children:"— персональный раздел"})]}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(w.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/25"}),(0,l.jsx)("input",{type:"text",value:y,onChange:e=>v(e.target.value),placeholder:"Опишите ваш вопрос...",className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-2.5 text-sm text-white placeholder:text-white/25 focus:outline-none focus:border-yellow-500/40 transition-colors"}),y&&(0,l.jsx)("button",{onClick:()=>v(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/30 hover:text-white/60",children:(0,l.jsx)(d.Z,{className:"w-3.5 h-3.5"})})]}),!y&&(0,l.jsx)("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 scrollbar-hide",children:I.map(e=>(0,l.jsx)("button",{onClick:()=>k(e),className:(0,u.cn)("flex-shrink-0 px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-wider transition-all",N===e?"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30":"bg-white/5 text-white/30 hover:text-white/60 hover:bg-white/8"),children:e},e))})]}),(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[f&&(0,l.jsx)("div",{className:"py-12 text-center text-white/30 text-sm",children:"Загрузка..."}),!f&&0===E.length&&(0,l.jsxs)("div",{className:"py-12 text-center space-y-2",children:[(0,l.jsx)(i.Z,{className:"w-8 h-8 text-white/10 mx-auto"}),(0,l.jsx)("p",{className:"text-white/30 text-sm",children:"Ничего не найдено"}),(0,l.jsx)("p",{className:"text-white/20 text-xs",children:"Попробуйте другой запрос или обратитесь в поддержку"})]}),!f&&E.map(e=>(0,l.jsxs)("div",{className:(0,u.cn)("bg-white/[0.03] border rounded-2xl overflow-hidden transition-all",_===e.id?"border-yellow-500/20 bg-yellow-500/[0.04]":"border-white/[0.06] hover:border-white/10"),children:[(0,l.jsxs)("button",{className:"w-full text-left px-4 py-3.5 flex items-center justify-between gap-3",onClick:()=>C(_===e.id?null:e.id),children:[(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,l.jsx)("span",{className:(0,u.cn)("text-[8px] font-black uppercase tracking-widest px-1.5 py-0.5 rounded","customer"===e.role?"text-yellow-500/70 bg-yellow-500/10":"executor"===e.role?"text-blue-400/70 bg-blue-500/10":"text-white/30 bg-white/5"),children:"customer"===e.role?"Заказчик":"executor"===e.role?"Исполнитель":"Для всех"}),(0,l.jsx)("span",{className:"text-[8px] text-white/20 uppercase tracking-widest",children:e.category})]}),(0,l.jsx)("p",{className:"text-sm font-bold text-white/85 leading-snug",children:e.question})]}),(0,l.jsx)(b.Z,{className:(0,u.cn)("w-4 h-4 text-white/30 flex-shrink-0 transition-transform",_===e.id&&"rotate-180")})]}),(0,l.jsx)(x.M,{children:_===e.id&&(0,l.jsx)(h.E.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:(0,l.jsx)("div",{className:"px-4 pb-4 text-sm text-white/55 leading-relaxed border-t border-white/5 pt-3",children:e.answer})})})]},e.id))]}),(0,l.jsx)("div",{className:"px-6 py-4 border-t border-white/5 flex-shrink-0",children:(0,l.jsxs)("p",{className:"text-center text-white/20 text-[11px]",children:["Не нашли ответ?"," ",(0,l.jsx)("button",{onClick:()=>{s(),null==r||r()},className:"text-yellow-500/60 hover:text-yellow-500 underline underline-offset-2 transition-colors",children:"Напишите в поддержку"})]})})]})]})})}var S=s(2934),E=s(9322),I=s(5846),Z=s(1817);function M(e){let t=e.replace(/\D/g,""),s=(t.startsWith("8")?"7"+t.slice(1):t.startsWith("7")?t:"7"+t).slice(0,11);return 0===s.length?"":1===s.length?"+7":s.length<=4?"+7 (".concat(s.slice(1)):s.length<=7?"+7 (".concat(s.slice(1,4),") ").concat(s.slice(4)):s.length<=9?"+7 (".concat(s.slice(1,4),") ").concat(s.slice(4,7),"-").concat(s.slice(7)):"+7 (".concat(s.slice(1,4),") ").concat(s.slice(4,7),"-").concat(s.slice(7,9),"-").concat(s.slice(9,11))}let D=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),L=e=>e.replace(/\D/g,"").length>=10;function P(e){var t;let{open:s,onClose:r,context:i}=e,[o,c]=(0,a.useState)("form"),[p,m]=(0,a.useState)(""),[w,N]=(0,a.useState)(""),[C,P]=(0,a.useState)(""),[q,W]=(0,a.useState)(null!==(t=null==i?void 0:i.userPhone)&&void 0!==t?t:""),[F,z]=(0,a.useState)([]),[O,T]=(0,a.useState)([]),[U,A]=(0,a.useState)(!1),[B,R]=(0,a.useState)(null),[Y,K]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(""),[H,J]=(0,a.useState)(!1),[$,G]=(0,a.useState)(!1),V=!!(null==i?void 0:i.userId);(0,a.useEffect)(()=>{if(!s){var e;c("form"),m(""),N(""),X(""),R(null),P(""),W(null!==(e=null==i?void 0:i.userPhone)&&void 0!==e?e:""),G(!1)}},[s]),(0,a.useEffect)(()=>{if(!s)return;f.supabase.auth.getUser().then(e=>{var t;let{data:s}=e;(null==s?void 0:null===(t=s.user)||void 0===t?void 0:t.email)&&(P(s.user.email),G(!0))});let e=localStorage.getItem("user_phone");e&&W(M(e))},[s]),(0,a.useEffect)(()=>{if(s){var e;j(null!==(e=null==i?void 0:i.role)&&void 0!==e?e:null).then(z)}},[s,null==i?void 0:i.role]),(0,a.useEffect)(()=>{s&&V&&(null==i?void 0:i.userId)&&(A(!0),_(i.userId).then(T).finally(()=>A(!1)))},[s,V,null==i?void 0:i.userId]);let ee=(0,a.useMemo)(()=>p||w.length>10?function(e,t,s){let l=(t+" "+s).toLowerCase();return e.map(e=>{let s=0;return e.category.toLowerCase()===t.toLowerCase()&&(s+=4),l.split(/\s+/).filter(e=>e.length>3).forEach(t=>{e.question.toLowerCase().includes(t)&&(s+=2),e.answer.toLowerCase().includes(t)&&(s+=1)}),e.keywords.forEach(e=>{l.includes(e.toLowerCase())&&(s+=3)}),{article:e,score:s}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,4).map(e=>e.article)}(F,p,w):[],[F,p,w]),et=""!==p.trim()&&D(C)&&L(q)&&w.trim().length>=10,es=async()=>{if(!et)return;let e=localStorage.getItem("support_last_submit");if(e&&Date.now()-parseInt(e)<6e4){X("Подождите минуту перед следующей отправкой");return}K(!0),X("");try{var t,s,l,a,r,n;await k({user_id:null!==(t=null==i?void 0:i.userId)&&void 0!==t?t:null,role:null!==(s=null==i?void 0:i.role)&&void 0!==s?s:null,category:p,message:w,order_id:null!==(l=null==i?void 0:i.orderId)&&void 0!==l?l:null,offer_id:null!==(a=null==i?void 0:i.offerId)&&void 0!==a?a:null,service_type:null!==(r=null==i?void 0:i.serviceType)&&void 0!==r?r:null,source_screen:null!==(n=null==i?void 0:i.screen)&&void 0!==n?n:null,contact_email:C.trim()||null,contact_phone:q.replace(/\D/g,"")||null,page_url:window.location.href,user_agent:"undefined"!=typeof navigator?navigator.userAgent:null}),localStorage.setItem("support_last_submit",Date.now().toString()),c("success")}catch(e){X(e.message||"Не удалось отправить. Попробуйте позже.")}finally{K(!1)}};return(0,l.jsx)(x.M,{children:s&&(0,l.jsxs)("div",{className:"fixed inset-0 z-[8500] flex items-end sm:items-center justify-center",children:[(0,l.jsx)(h.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/80 backdrop-blur-md",onClick:r}),(0,l.jsxs)(h.E.div,{initial:{opacity:0,y:60,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:60,scale:.97},transition:{type:"spring",damping:28,stiffness:300},className:"relative w-full max-w-xl bg-[#0a0a0a] border border-white/10 rounded-t-[32px] sm:rounded-[32px] max-h-[92vh] flex flex-col overflow-hidden shadow-[0_0_80px_rgba(234,179,8,0.06)]",children:[(0,l.jsxs)("div",{className:"px-6 pt-6 pb-4 border-b border-white/5 flex-shrink-0 flex items-center justify-between",children:[(0,l.jsxs)("h2",{className:"text-xl font-black text-white uppercase tracking-tight flex items-center gap-2",children:[(0,l.jsx)(n.Z,{className:"w-5 h-5 text-yellow-500"}),"Тех. поддержка"]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[V&&O.length>0&&(0,l.jsxs)("button",{onClick:()=>c("tickets"===o?"form":"tickets"),className:"text-[10px] font-black text-white/30 hover:text-white/60 uppercase tracking-widest transition-colors",children:["Мои обращения (",O.length,")"]}),(0,l.jsx)("button",{onClick:r,className:"w-9 h-9 rounded-full bg-white/5 hover:bg-white/10 flex items-center justify-center transition-colors",children:(0,l.jsx)(d.Z,{className:"w-4 h-4 text-white/50"})})]})]}),"success"===o&&(0,l.jsxs)(h.E.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"flex-1 flex flex-col items-center justify-center p-10 text-center gap-4",children:[(0,l.jsx)("div",{className:"w-16 h-16 rounded-full bg-green-500/10 border border-green-500/20 flex items-center justify-center",children:(0,l.jsx)(S.Z,{className:"w-8 h-8 text-green-500"})}),(0,l.jsx)("h3",{className:"text-2xl font-black text-white uppercase",children:"Отправлено!"}),(0,l.jsx)("p",{className:"text-white/50 text-sm max-w-xs",children:"Ваше обращение принято. Мы ответим в ближайшее время."}),(0,l.jsx)("button",{onClick:r,className:"mt-4 px-8 py-3 bg-yellow-500 text-black font-black text-sm uppercase tracking-wider rounded-2xl hover:bg-yellow-400 transition-colors",children:"Закрыть"})]}),"tickets"===o&&(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[(0,l.jsx)("button",{onClick:()=>c("form"),className:"text-[10px] text-white/30 hover:text-white/60 font-black uppercase tracking-widest mb-2 flex items-center gap-1 transition-colors",children:"← Новое обращение"}),U&&(0,l.jsx)("div",{className:"py-10 text-center text-white/30 text-sm",children:"Загрузка..."}),!U&&0===O.length&&(0,l.jsx)("div",{className:"py-10 text-center text-white/30 text-sm",children:"У вас нет обращений"}),!U&&O.map(e=>{var t,s;return(0,l.jsxs)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-2xl p-4 space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-black text-white/60",children:e.category}),(0,l.jsx)("span",{className:(0,u.cn)("text-[9px] font-black px-2 py-0.5 rounded-full uppercase tracking-wider",null!==(t=v[e.status])&&void 0!==t?t:"text-white/30 bg-white/5"),children:null!==(s=y[e.status])&&void 0!==s?s:e.status})]}),(0,l.jsx)("p",{className:"text-sm text-white/50 line-clamp-2",children:e.message}),e.service_type&&(0,l.jsx)("p",{className:"text-[9px] text-white/20 uppercase tracking-wider",children:e.service_type}),(0,l.jsx)("p",{className:"text-[9px] text-white/20",children:new Date(e.created_at).toLocaleDateString("ru-RU")})]},e.id)})]}),("form"===o||"contact"===o)&&(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,l.jsxs)("div",{className:"p-6 space-y-5",children:[((null==i?void 0:i.orderId)||(null==i?void 0:i.serviceType))&&(0,l.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-blue-500/5 border border-blue-500/15 rounded-xl",children:[(0,l.jsx)(E.Z,{className:"w-4 h-4 text-blue-400 flex-shrink-0 mt-0.5"}),(0,l.jsxs)("p",{className:"text-[11px] text-blue-400/80 leading-relaxed",children:[i.serviceType&&(0,l.jsxs)("span",{children:[(0,l.jsx)("b",{children:i.serviceType})," \xb7 "]}),i.orderId&&(0,l.jsxs)("span",{children:["Заказ #",i.orderId.slice(-6).toUpperCase()]}),i.screen&&(0,l.jsxs)("span",{children:[" \xb7 ",i.screen]})," ","— данные подставлены автоматически."]})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-[10px] font-black text-white/40 uppercase tracking-widest",children:"Категория проблемы *"}),(0,l.jsx)("div",{className:"grid grid-cols-2 gap-2",children:g.map(e=>(0,l.jsx)("button",{onClick:()=>m(e),className:(0,u.cn)("text-left px-3 py-2.5 rounded-xl text-xs font-bold transition-all border",p===e?"bg-yellow-500/15 border-yellow-500/40 text-yellow-400":"bg-white/[0.03] border-white/[0.07] text-white/50 hover:bg-white/[0.06] hover:text-white/70"),children:e},e))})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-[10px] font-black text-white/40 uppercase tracking-widest",children:"Email *"}),(0,l.jsx)("input",{type:"email",value:C,onChange:e=>{$||P(e.target.value)},readOnly:$,placeholder:"Ваш email",className:(0,u.cn)("w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-white/25 focus:outline-none transition-colors",$?"opacity-60 cursor-default":"focus:border-yellow-500/40",C&&!D(C)&&"border-red-500/30")}),$&&(0,l.jsx)("p",{className:"text-[10px] text-white/20",children:"Email подтянут из вашего аккаунта"})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-[10px] font-black text-white/40 uppercase tracking-widest",children:"Телефон *"}),(0,l.jsx)("input",{type:"tel",value:q,onChange:e=>W(M(e.target.value)),placeholder:"+7 (___) ___-__-__",className:(0,u.cn)("w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-white/25 focus:outline-none focus:border-yellow-500/40 transition-colors",q&&!L(q)&&"border-red-500/30")})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-[10px] font-black text-white/40 uppercase tracking-widest",children:"Описание проблемы *"}),(0,l.jsx)("textarea",{value:w,onChange:e=>N(e.target.value),placeholder:"Опишите проблему подробно...",rows:4,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-white/25 focus:outline-none focus:border-yellow-500/40 transition-colors resize-none"}),(0,l.jsxs)("p",{className:"text-[10px] text-white/20 text-right",children:[w.length," / мин. 10 символов"]})]}),(0,l.jsx)(x.M,{children:ee.length>0&&(0,l.jsxs)(h.E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(I.Z,{className:"w-3.5 h-3.5 text-yellow-500"}),(0,l.jsx)("span",{className:"text-[10px] font-black text-yellow-500/70 uppercase tracking-widest",children:"Возможно, вам поможет"})]}),(0,l.jsx)("div",{className:"space-y-1.5",children:ee.map(e=>(0,l.jsxs)("div",{className:"bg-yellow-500/[0.04] border border-yellow-500/10 rounded-xl overflow-hidden",children:[(0,l.jsxs)("button",{className:"w-full text-left px-4 py-3 flex items-center justify-between gap-2",onClick:()=>R(B===e.id?null:e.id),children:[(0,l.jsx)("span",{className:"text-xs font-bold text-white/70",children:e.question}),(0,l.jsx)(b.Z,{className:(0,u.cn)("w-3.5 h-3.5 text-white/30 flex-shrink-0 transition-transform",B===e.id&&"rotate-180")})]}),(0,l.jsx)(x.M,{children:B===e.id&&(0,l.jsx)(h.E.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:(0,l.jsx)("p",{className:"px-4 pb-3 text-xs text-white/45 leading-relaxed border-t border-yellow-500/10 pt-2",children:e.answer})})})]},e.id))}),(0,l.jsx)("p",{className:"text-[10px] text-white/20 text-center",children:"Если это не помогло — продолжайте заполнять форму"})]})}),Q&&(0,l.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-red-500/10 border border-red-500/20 rounded-xl",children:[(0,l.jsx)(E.Z,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),(0,l.jsx)("p",{className:"text-xs text-red-400",children:Q})]})]}),(0,l.jsxs)("div",{className:"px-6 pb-6 pt-2",children:[(0,l.jsx)("button",{onClick:es,disabled:Y||!et,className:(0,u.cn)("w-full py-4 font-black text-sm uppercase tracking-widest rounded-2xl transition-all flex items-center justify-center gap-2",et?"bg-yellow-500 hover:bg-yellow-400 text-black hover:shadow-[0_0_30px_rgba(234,179,8,0.3)]":"bg-white/5 text-white/20 cursor-not-allowed"),children:Y?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Z.Z,{className:"w-5 h-5 animate-spin"})," Отправка..."]}):(0,l.jsx)(l.Fragment,{children:"Отправить обращение"})}),(0,l.jsx)("p",{className:"text-center text-white/15 text-[10px] mt-2",children:"Мы отвечаем в течение 24 часов"})]})]})]})]})})}function q(e){var t;let{variant:s="floating",context:p,bottomClass:m}=e,w=(0,r.usePathname)(),[b,f]=(0,a.useState)(!1),[g,y]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(!1),[_,S]=(0,a.useState)(!1),[E,I]=(0,a.useState)(!1),Z=e=>e.startsWith("/performer")||e.startsWith("/executor")?"executor":e.startsWith("/customer")||e.startsWith("/form")||e.startsWith("/offer")||e.startsWith("/results")?"customer":null,M=()=>{var e;let t=localStorage.getItem("role");return{role:null!==(e=Z(window.location.pathname))&&void 0!==e?e:"executor"===t||"performer"===t?"executor":"customer"===t||"client"===t?"customer":null,userId:localStorage.getItem("user_id")||null,userPhone:localStorage.getItem("user_phone")||void 0}},[D,L]=(0,a.useState)(p),q=(0,a.useRef)({x:0,y:0});(0,a.useEffect)(()=>{f(!0),S("true"===localStorage.getItem("help_fab_hidden"))},[]),(0,a.useEffect)(()=>{if(p){L(p);return}b&&L(M())},[p,w,b]);let W=()=>{k(!1),y(!0)},F=()=>{k(!1),j(!0)};return b?(0,l.jsxs)(l.Fragment,{children:["inline"===s&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("button",{onClick:W,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-white/5 hover:bg-white/10 border border-white/8 hover:border-white/15 text-white/45 hover:text-white/70 text-[11px] font-black uppercase tracking-wider transition-all",children:[(0,l.jsx)(i.Z,{className:"w-3.5 h-3.5"}),"Помощь"]}),(0,l.jsxs)("button",{onClick:F,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-white/5 hover:bg-white/10 border border-white/8 hover:border-white/15 text-white/45 hover:text-white/70 text-[11px] font-black uppercase tracking-wider transition-all",children:[(0,l.jsx)(n.Z,{className:"w-3.5 h-3.5"}),"Поддержка"]})]}),"floating"===s&&b&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.M,{children:_&&(0,l.jsx)(h.E.button,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:40},onClick:()=>{S(!1),localStorage.setItem("help_fab_hidden","false")},className:(0,u.cn)("fixed right-0 z-[99] w-8 h-14 rounded-l-2xl","bg-neutral-900 border border-r-0 border-yellow-500/30","flex items-center justify-center","shadow-[0_0_12px_rgba(234,179,8,0.12)]",null!=m?m:"bottom-20"),"aria-label":"Показать помощь",children:(0,l.jsx)(o.Z,{className:"w-4 h-4 text-yellow-500/70"})})}),(0,l.jsx)(x.M,{children:!_&&(0,l.jsxs)(h.E.div,{drag:!0,dragMomentum:!1,dragElastic:0,dragConstraints:{top:-(window.innerHeight-120),bottom:0,left:-(window.innerWidth-64),right:0},onDragStart:(e,t)=>{q.current={x:t.point.x,y:t.point.y},I(!0),k(!1)},onDragEnd:(e,t)=>{let s=Math.abs(t.point.x-q.current.x),l=Math.abs(t.point.y-q.current.y);s<6&&l<6?I(!1):setTimeout(()=>I(!1),180)},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:"spring",damping:20,stiffness:300},style:{touchAction:"none"},className:(0,u.cn)("fixed right-4 z-[99] flex flex-col items-end gap-2 cursor-grab active:cursor-grabbing",null!=m?m:"bottom-20"),children:[(0,l.jsx)(x.M,{children:N&&(0,l.jsxs)(h.E.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.15},className:"flex flex-col items-end gap-2",children:[(0,l.jsxs)("button",{onClick:W,className:"flex items-center gap-2 px-4 py-2.5 bg-[#111] border border-white/10 rounded-full text-white/70 hover:text-white text-xs font-black uppercase tracking-widest shadow-lg transition-all hover:border-yellow-500/30 whitespace-nowrap",children:[(0,l.jsx)(i.Z,{className:"w-3.5 h-3.5 text-yellow-500"}),"Помощь"]}),(0,l.jsxs)("button",{onClick:F,className:"flex items-center gap-2 px-4 py-2.5 bg-[#111] border border-white/10 rounded-full text-white/70 hover:text-white text-xs font-black uppercase tracking-widest shadow-lg transition-all hover:border-yellow-500/30 whitespace-nowrap",children:[(0,l.jsx)(n.Z,{className:"w-3.5 h-3.5 text-yellow-500"}),"Поддержка"]}),(0,l.jsxs)("button",{onClick:()=>{k(!1),S(!0),localStorage.setItem("help_fab_hidden","true")},className:"flex items-center gap-2 px-4 py-2.5 bg-[#111] border border-white/8 rounded-full text-white/30 hover:text-white/60 text-xs font-black uppercase tracking-widest shadow-lg transition-all hover:border-white/15 whitespace-nowrap",children:[(0,l.jsx)(c.Z,{className:"w-3.5 h-3.5"}),"Скрыть"]})]})}),(0,l.jsx)("button",{onClick:()=>{E||k(e=>!e)},className:(0,u.cn)("w-12 h-12 rounded-full flex items-center justify-center transition-all select-none","shadow-[0_0_20px_rgba(255,196,0,0.25)] hover:shadow-[0_0_28px_rgba(255,196,0,0.45)]",N?"bg-yellow-500/20 border border-yellow-500/60":"bg-neutral-900 border border-yellow-500/35 hover:border-yellow-500/70 hover:bg-yellow-500/10"),"aria-label":"Помощь и поддержка",children:(0,l.jsx)(x.M,{mode:"wait",children:N?(0,l.jsx)(h.E.div,{initial:{rotate:-45,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:45,opacity:0},children:(0,l.jsx)(d.Z,{className:"w-5 h-5 text-white/60"})},"x"):(0,l.jsx)(h.E.div,{initial:{rotate:45,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-45,opacity:0},children:(0,l.jsx)(o.Z,{className:"w-5 h-5 text-yellow-500"})},"q")})})]})})]}),(0,l.jsx)(C,{open:g,onClose:()=>y(!1),onOpenSupport:F,defaultRole:null!==(t=null==D?void 0:D.role)&&void 0!==t?t:null}),(0,l.jsx)(P,{open:v,onClose:()=>j(!1),context:D})]}):null}function W(e){let{children:t}=e;return(0,l.jsxs)(l.Fragment,{children:[t,(0,l.jsx)(q,{variant:"floating"})]})}},2141:function(e,t,s){"use strict";s.d(t,{supabase:function(){return l}});let l=(0,s(2978).eI)("https://d5dph57nmc3g210eifv5.uvah0e6r.apigw.yandexcloud.net","sb_publishable_FfiY2-PDj2Xx3fYvrwNKIQ_gOB8Sdpr",{auth:{storageKey:"sb-phqkzwdlzyumlsdlodor-auth-token"}})},4508:function(e,t,s){"use strict";function l(){for(var e=arguments.length,t=Array(e),s=0;s