1import{r,j as e,k as _s,V as Ft,a9 as nn,aa as kn,a1 as rs,ab as Cn,ac as Wt,ad as zn,ae as Mt,C as _n,x as Ts,af as $s,X as Rs,M as Tn,ag as $n,F as Ws,ah as Rn,ai as Wn,aj as rn,ak as an,al as An,B as In,am as Dn,an as ln,ao as Bn,z as Ln,ap as En,aq as Fn,ar as us,as as Un,at as on,au as Ot,av as dn,y as Pn,aw as Mn,I as Ut,ax as Pt,ay as qt,az as cn,aA as ps,U as On,J as As,aB as qn,aC as mn,G as Hn,m as Vn,aD as Gn,aE as Kn,aF as Xn,aG as Yn,aH as Jn,aI as Qn,aJ as Zn,aK as At,l as It,aL as Dt,aM as ei,aN as Is}from"./vendor-B2roeKE5.js";import{O as ti,c as si,u as ni,T as Ds,B as Xe,L as Bs,A as hn}from"./index-B6DZdGhn.js";const yt={violet:"#7C5CFF",cyan:"#22D3EE",green:"#34D399"},un=1180,pn=130,ii=s=>{const t=String(s||"").match(/^(\d{4})-(\d{2})-(\d{2})$/);if(t)return`${t[3]}.${t[2]}`;const m=String(s||"").match(/^(\d{4})-(\d{2})$/);return m?`${m[2]}.${m[1].slice(2)}`:String(s||"")};function xn({data:s,days:t,color:m=yt.violet,fmtValue:n,fmtDay:x=ii,height:i=120,width:C=600}){const u=C,k=30,g=i,I=2,[E,X]=r.useState(null),D=r.useRef(null),W=(Array.isArray(s)?s:[]).map(U=>Number.isFinite(Number(U))?Math.max(0,Number(U)):0),o=Array.isArray(t)?t:[],N=Math.max(1,W.length),v=U=>n?n(U):String(U),_=Math.max(1,...W),B=_/3,Q=Math.pow(10,Math.floor(Math.log10(B))),A=Math.max(1,[1,2,5,10].map(U=>U*Q).find(U=>U>=B)||10*Q),$=[];for(let U=0;U<=_+A*.999;U+=A)$.push(Math.round(U));$.length||$.push(0,1);const V=$[$.length-1]||1,T=Math.max(...$.map(U=>v(U).length))*5.6+10,y=(u-T)/N,q="bg-"+m.replace("#",""),P=U=>{var ee;const ne=(ee=D.current)==null?void 0:ee.getBoundingClientRect();if(!ne)return;const le=(U.clientX-ne.left)/ne.width*u-T;X(Math.max(0,Math.min(N-1,Math.floor(le/y))))},oe=E==null?"":`${x(o[E]||"")} · ${v(W[E]||0)}`,L=E==null?0:T+E*y+y/2,se=Math.max(1,Math.ceil(N/Math.max(1,Math.floor((u-T)/55))));return e.jsxs("div",{style:{position:"relative",width:"100%"},children:[e.jsxs("svg",{ref:D,viewBox:`0 0 ${u} ${k+g+18}`,style:{width:"100%",height:"auto",display:"block",touchAction:"none"},onPointerDown:P,onPointerMove:P,onPointerLeave:()=>X(null),onPointerUp:()=>X(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:q,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0",stopColor:m,stopOpacity:"1"}),e.jsx("stop",{offset:"1",stopColor:m,stopOpacity:"0.45"})]})}),$.map(U=>{const ne=k+g-U/V*g;return e.jsxs("g",{pointerEvents:"none",children:[e.jsx("line",{x1:T,y1:ne,x2:u,y2:ne,stroke:"rgba(128,128,140,0.18)",strokeWidth:"1",strokeDasharray:U?"3 3":void 0}),e.jsx("text",{x:T-6,y:ne+3,textAnchor:"end",fontSize:"9",fill:"#7B8494",children:v(U)})]},"t"+U)}),E!=null&&e.jsx("line",{x1:L,y1:k,x2:L,y2:k+g,stroke:"rgba(255,255,255,0.14)",strokeWidth:"1",pointerEvents:"none"}),W.map((U,ne)=>{const le=Math.max(U>0?3:1,U/V*g),ee=E===ne;return e.jsxs("g",{pointerEvents:"none",children:[e.jsx("rect",{x:T+ne*y+I,y:k+g-le,width:Math.max(1,y-I*2),height:le,rx:2.5,fill:U>0?`url(#${q})`:"rgba(255,255,255,0.06)",opacity:E==null||ee?1:.4}),ee&&U>0&&e.jsx("circle",{cx:L,cy:k+g-le,r:3.5,fill:"#fff"}),(ne%se===0||ne===N-1)&&e.jsx("text",{x:T+ne*y+y/2,y:k+g+13,textAnchor:"middle",fontSize:"9",fill:"#7B8494",children:x(o[ne]||"")})]},ne)})]}),E!=null&&e.jsxs("div",{style:{position:"absolute",top:0,left:`${L/u*100}%`,transform:`translateX(${L>u*.75?"-100%":L<u*.25?"0":"-50%"})`,pointerEvents:"none",display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap",background:"#151821",border:"1px solid rgba(255,255,255,0.22)",borderRadius:8,padding:"5px 10px",fontSize:13,fontWeight:600,color:"#EEF1F7",boxShadow:"0 6px 18px rgba(0,0,0,0.4)",zIndex:2},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:3,background:m,flex:"none"}}),oe]})]})}function Ls(s,t){return s==="stripe"?"СÑÑÑ Stripe живÑÑ ÑÑÑки â поÑом Stripe закÑÑÐ²Ð°ÐµÑ ÐµÐ³Ð¾ Ñам, и Ð¼Ñ Ð¿Ð¾Ð¼ÐµÑаем ÑÑÑÐ¾ÐºÑ Ñем же ÑаÑом.":s==="yookassa"?"СÑÑлка ЮKassa живÑÑ Ð´Ð¾Ð»ÑÑе ÑÑÑок: Ñ Ð½Ð°Ñ ÐµÑÑÑ Ð¾Ð¿Ð»Ð°ÑÑ ÑеÑез 29 ÑаÑов поÑле вÑÑÑавлениÑ. ХоÑоним неоплаÑеннÑй ÑÑÑÑ Ð½Ð° вÑоÑÑе ÑÑÑки.":s==="coingate"?"ÐÑипÑо-ÑÑÑÑ Ð¶Ð´ÑÑ Ð¿Ð¾Ð´ÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ ÑеÑи â Ñ
оÑоÐ
1½Ð¸Ð¼ неоплаÑеннÑй на вÑоÑÑе ÑÑÑки.":t==="sbp"||t==="sberpay"?"QR деÑжиÑÑÑ Ð´Ð¾ ÑаÑа, далÑÑе Ñеловек плаÑÐ¸Ñ Ð·Ð°Ð½Ð¾Ð²Ð¾. ÐеоплаÑеннÑй ÑÑÑÑ Ñ Ð¾Ñоним ÑеÑез ÑÑÑки.":"ÐеоплаÑеннÑй ÑÑÑÑ Ñ Ð¾Ñоним ÑеÑез ÑÑÑки â денег за ним Ð½ÐµÑ Ð½Ð¸ до, ни поÑле."}const ri=["[email protected]"];function Yt(s){var m;const t=String(s||"");return(((m=t.match(/<([^>]+)>/))==null?void 0:m[1])||t).trim().toLowerCase()}const ai=/\b(?:[a-z]{2,12}_[0-9a-f]{6,}_[0-9a-z]{6,}|(?:ep|etpguest|etpimp|etp|recurrent)[0-9a-z]*_[0-9a-z][0-9a-z_-]{3,})\b/gi;function li(s){const t=String(s.html||""),m=t.search(/<blockquote|class="?gmail_quote/i),n=(m>=0?t.slice(0,m):t).replace(/<[^>]+>/g," "),x=String(s.body||""),i=x.search(/\n\s*(>|-{2,}\s*(ÐÑÑ Ð¾Ð´Ð½Ð¾Ðµ|Original)|\d{1,2}[./]\d{1,2}[./]\d{2,4}[^\n]{0,60}(пиÑал|wrote))/i);return`${i>=0?x.slice(0,i):x} ${n}`}const gn={matrix:"[email protected]",wisp:"[email protected]",babka:"[email protected]",petya:"[email protected]",brat:"[email protected]",inside:"[email protected]"},oi={babka:"ÑÑаÑÑÑй 32 Ðакона РоÑÑийÑкой ФедеÑаÑии «РзаÑиÑе пÑав поÑÑебиÑелей»",petya:"ÑÑаÑÑÑй 30 Ðакона РеÑпÑблики ÐÐ°Ð·Ð°Ñ ÑÑан «РзаÑиÑе пÑав поÑÑебиÑелей»"},fn=s=>s.map(t=>`â ${t}`).join(` 2`),di=["адÑÐµÑ ÑлекÑÑонной поÑÑÑ Ð°ÐºÐºÐ°ÑнÑа в ÑеÑвиÑе;","даÑÑ Ð¸ ÑÑÐ¼Ð¼Ñ ÑпиÑаниÑ;","поÑледние ÑеÑÑÑе ÑиÑÑÑ ÐºÐ°ÑÑÑ Ð»Ð¸Ð±Ð¾ Ð½Ð¾Ð¼ÐµÑ Ð¾Ð¿ÐµÑаÑии (Ð´Ð»Ñ Ð¾Ð¿Ð»Ð°ÑÑ ÑеÑез СÐÐ â иденÑиÑикаÑÐ¾Ñ Ð¿Ð»Ð°Ñежа);","ÑеквизиÑÑ Ð´Ð»Ñ Ð²Ð¾Ð·Ð²ÑаÑа â Ñе же, Ñ ÐºÐ¾ÑоÑÑÑ Ð¿ÑоизводилаÑÑ Ð¾Ð¿Ð»Ð°Ñа."],ci=["ÑамилиÑ, Ð¸Ð¼Ñ Ð¸ оÑÑеÑÑво полноÑÑÑÑ;","адÑÐµÑ ÑлекÑÑонной поÑÑÑ Ð°ÐºÐºÐ°ÑнÑа в ÑеÑвиÑе;","даÑÑ, вÑÐµÐ¼Ñ Ð¸ ÑоÑнÑÑ ÑÑÐ¼Ð¼Ñ ÑпиÑаниÑ;","поÑледние ÑеÑÑÑе ÑиÑÑÑ ÐºÐ°ÑÑÑ Ð»Ð¸Ð±Ð¾ Ð½Ð¾Ð¼ÐµÑ Ð¾Ð¿ÐµÑаÑии (Ð´Ð»Ñ Ð¾Ð¿Ð»Ð°ÑÑ ÑеÑез СÐÐ â иденÑиÑикаÑÐ¾Ñ Ð¿Ð»Ð°Ñежа);","ÑеквизиÑÑ Ð´Ð»Ñ Ð²Ð¾Ð·Ð²ÑаÑа â они Ð´Ð¾Ð»Ð¶Ð½Ñ ÑовпадаÑÑ Ñ ÑеквизиÑами, Ñ ÐºÐ¾ÑоÑÑÑ Ð¿ÑоизводилаÑÑ Ð¾Ð¿Ð»Ð°Ñа;","оÑнование ÑÑÐµÐ±Ð¾Ð²Ð°Ð½Ð¸Ñ Ñо ÑÑÑлкой на пÑÐ½ÐºÑ Ð¾ÑеÑÑÑ;","подÑвеÑждение оплаÑÑ â Ñек или вÑпиÑÐºÑ Ð±Ð°Ð½ÐºÐ° Ñайлом;","даÑÑ ÑоÑÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ Ð·Ð°ÑÐ²Ð»ÐµÐ½Ð¸Ñ Ð¸ ваÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÑ (допÑÑкаеÑÑÑ Ñкан или ÑоÑо подпиÑанного докÑменÑа);","ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ Ð² ÑелÑÑ ÑаÑÑмоÑÑÐµÐ½Ð¸Ñ Ð·Ð°ÑвлениÑ."];function mi(s){const t=`https://${s.registrable}/offer`,m=`https://app.${s.registrable}`,n=gn[s.id];return["ÐдÑавÑÑвÑйÑе!",`ÐÑ Ð¿Ð¾Ð»ÑÑили ваÑе обÑаÑение о возвÑаÑе денежнÑÑ ÑÑедÑÑв и гоÑÐ¾Ð²Ñ ÑаÑÑмоÑÑеÑÑ ÐµÐ³Ð¾ в поÑÑдке, ÑÑÑановленном пÑблиÑной оÑеÑÑой ÑеÑвиÑа ${s.name}. ÐÑеÑÑа ÑазмеÑена по адÑеÑÑ ${t}; Ð²Ñ Ð¿ÑинÑли ÐµÑ ÑÑÐ»Ð¾Ð²Ð¸Ñ Ð¿Ñи оплаÑе, и именно они опÑеделÑÑÑ, когда и как возможен возвÑаÑ. Ðиже â поÑÑдок по пÑнкÑам, ÑÑÐ¾Ð±Ñ Ð²Ð°Ñе заÑвление бÑло ÑаÑÑмоÑÑено без задеÑжек.`,`1. ÐÑÐ½Ð¾Ð²Ð°Ð½Ð¸Ñ Ð´Ð»Ñ Ð²Ð¾Ð·Ð²ÑаÑа 3СоглаÑно п. 8.1 оÑеÑÑÑ ÑÑлÑга ÑÑиÑаеÑÑÑ Ð¾ÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ в ÑеÑение 3 календаÑнÑÑ Ð´Ð½ÐµÐ¹ Ñ Ð¼Ð¾Ð¼ÐµÐ½Ñа поÑÑÑÐ¿Ð»ÐµÐ½Ð¸Ñ Ð¾Ð¿Ð»Ð°ÑÑ, а моменÑом Ð¾ÐºÐ°Ð·Ð°Ð½Ð¸Ñ ÑÑиÑаеÑÑÑ Ð¿ÑедоÑÑавление доÑÑÑпа к ÑеÑвиÑÑ. ÐÑÐ½ÐºÑ 8.2 пÑедÑÑмаÑÑÐ¸Ð²Ð°ÐµÑ Ð¿Ñаво поÑÑебоваÑÑ Ð²Ð¾Ð·Ð²ÑаÑ, еÑли ÑÑлÑга не бÑла окаÐ
3·Ð°Ð½Ð° в ÑÑÐ¾Ñ ÑÑок. 4ÐÑли Ð²Ñ ÑообÑаеÑе, ÑÑо доÑÑÑп не ÑабоÑаеÑ, оÑеÑÑа (п. 8.2) пÑедÑÑмаÑÑиваеÑ, ÑÑо Ð²Ñ Ð´Ð°ÑÑе ÑлÑжбе поддеÑжки возможноÑÑÑ ÑÑо пÑовеÑиÑÑ: ÑообÑаеÑе ÑÑÑÑойÑÑво, пÑиложение и ÑпоÑоб подклÑÑениÑ, пÑиÑÑлаеÑе Ñнимки ÑкÑана Ñ Ð¾Ñибкой, вÑполнÑеÑе ÑекомендаÑии поддеÑжки по наÑÑÑойке, а пÑи Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ÑÑи пÑедоÑÑавлÑеÑе доÑÑÑп к ÑÑÑÑойÑÑÐ²Ñ Ð´Ð»Ñ ÑдалÑнной пÑовеÑки. ÐÑли ÑÐ°ÐºÐ°Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑ Ð½Ðµ пÑедоÑÑавлена, а по даннÑм ÑеÑвиÑа доÑÑÑп бÑл вÑдан и иÑполÑзовалÑÑ, ÑÑлÑга ÑÑиÑаеÑÑÑ Ð¾ÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹.`,`2. СÑок подаÑи заÑÐ²Ð»ÐµÐ½Ð¸Ñ 5ÐаÑвление на возвÑÐ°Ñ Ð¿Ð¾Ð´Ð°ÑÑÑÑ Ð² ÑеÑение 7 календаÑнÑÑ Ð´Ð½ÐµÐ¹ Ñ Ð´Ð°ÑÑ Ð¸ÑÑеÑÐµÐ½Ð¸Ñ ÑÑока Ð¾ÐºÐ°Ð·Ð°Ð½Ð¸Ñ ÑÑлÑги (п. 8.3 оÑеÑÑÑ).`,`3. ФоÑма и ÑпоÑоб подаÑи 6СоглаÑно п. 8.4 оÑеÑÑÑ Ð·Ð°Ñвление ÑоÑÑавлÑеÑÑÑ Ð² пиÑÑменной ÑоÑме на Ð¸Ð¼Ñ ÐдминиÑÑÑаÑии ÑеÑвиÑа: ÑÑÑной пÑоÑÑÐ±Ñ Ð¸Ð»Ð¸ коÑоÑкого ÑообÑÐµÐ½Ð¸Ñ Â«Ð²ÐµÑниÑе денÑги» Ð´Ð»Ñ ÑÑого недоÑÑаÑоÑно, нÑжен докÑÐ¼ÐµÐ½Ñ Ñо ÑведениÑми ниже. ÐапÑавиÑÑ ÐµÐ³Ð¾ можно оÑвеÑом в ÑÑо обÑаÑение (Ñаздел «ÐоддеÑжка» в лиÑном кабинеÑе ${m}, ÑÐ°Ð¹Ð»Ñ Ð¿ÑикладÑваÑÑÑÑ Ðº ÑообÑениÑ) либо пиÑÑмом на адÑÐµÑ ${n} Ñ Ñемой «ÐаÑвление о возвÑаÑе». 7РзаÑвлении Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑказаÑÑ: 8${fn(ci)}`,`4. РаÑÑмоÑÑение 9ÐаÑвление, в коÑоÑом Ð½ÐµÑ Ð¿ÐµÑеÑиÑленнÑÑ Ñведений, к ÑаÑÑмоÑÑÐµÐ½Ð¸Ñ Ð½Ðµ пÑинимаеÑÑÑ â в ÑÑом ÑлÑÑае Ð¼Ñ ÑообÑим, Ñего не Ñ Ð²Ð°ÑÐ°ÐµÑ (п. 8.5). ÐадлежаÑе оÑоÑмленное заÑвление ÑаÑÑмаÑÑиваеÑÑÑ Ð² ÑеÑение 30 (ÑÑидÑаÑи) календаÑнÑÑ Ð´Ð½ÐµÐ¹ Ñ Ð´Ð°ÑÑ ÐµÐ³Ð¾ ÑегиÑÑÑаÑии. РеÑение пÑинимаеÑÑÑ Ð¿Ð¾ ÑезÑлÑÑаÑам пÑовеÑки: Ñведений о плаÑеже, даннÑÑ Ð¾ вÑдаÑе и иÑполÑзовании доÑÑÑпа, пеÑепиÑки Ñо ÑлÑжбой поддеÑжки.`,`5. ÐозвÑÐ°Ñ ÑÑедÑÑв 10ÐÑи положиÑелÑном ÑеÑении денежнÑе ÑÑедÑÑва возвÑаÑаÑÑÑÑ Ð² ÑеÑение 30 (ÑÑидÑаÑи) календаÑнÑÑ Ð´Ð½ÐµÐ¹ на Ñе же ÑеквизиÑÑ, Ñ ÐºÐ¾ÑоÑÑÑ Ð¿ÑоизводилаÑÑ Ð¾Ð¿Ð»Ð°Ñа. ÐеÑевод на ÑеквизиÑÑ ÑÑеÑÑÐ¸Ñ Ð»Ð¸Ñ Ð½Ðµ оÑÑÑеÑÑвлÑеÑÑÑ (п. 8.6).`,`6. ÐвÑомаÑиÑеÑкое пÑодление 11СпиÑÐ°Ð½Ð¸Ñ Ð² ÑÐ°Ð¼ÐºÐ°Ñ Ð²ÐºÐ»ÑÑÑнного авÑопÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ Ð¿ÑоизводÑÑÑÑ Ð½Ð° оÑновании ваÑего ÑоглаÑÐ¸Ñ Ð¸ Ñами по Ñебе не ÑвлÑÑÑÑÑ Ð¾Ñнованием Ð´Ð»Ñ Ð²Ð¾Ð·Ð²ÑаÑа (п. 9.1). ÐÑклÑÑиÑÑ Ð°Ð²ÑопÑодление можно в лÑбой Ð¼Ð¾Ð¼ÐµÐ½Ñ Ð² лиÑном кабинеÑе â поÑле ÑÑого новÑе ÑпиÑÐ°Ð½Ð¸Ñ Ð¿ÑекÑаÑаÑÑÑÑ (п. 9.2).`,"ÐаÑаллелÑно Ñ ÑÑим Ð¼Ñ Ð¿Ð¾-пÑÐµÐ¶Ð½ÐµÐ¼Ñ Ð³Ð¾ÑÐ¾Ð²Ñ Ð¿Ð¾Ð¼Ð¾ÑÑ Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑением: еÑли ÑÑо-Ñо не ÑабоÑаеÑ, опиÑиÑе, на каком ÑÑÑÑойÑÑве и в каком пÑиложении Ð²Ð¾Ð·Ð½Ð¸ÐºÐ°ÐµÑ Ð¿Ñоблема, и пÑиÑлиÑе Ñнимок ÑкÑана â ÑазбеÑÑмÑÑ."].join(` 12 13`)}function hi(s){const t=`https://${s.registrable}/offer`,m=`https://app.${s.registrable}`,n=gn[s.id];return["ÐдÑавÑÑвÑйÑе!",`ÐÑ Ð¿Ð¾Ð»ÑÑили ваÑе обÑаÑение о возвÑаÑе денежнÑÑ ÑÑедÑÑв. ÐоÑÑдок оÑказа Ð¾Ñ ÑÑлÑги и возвÑаÑа ÑÑÑановлен Ñазделом 6 пÑблиÑной оÑеÑÑÑ ÑеÑвиÑа ${s.name} (${t}), ÑÑÐ»Ð¾Ð²Ð¸Ñ ÐºÐ¾ÑоÑой Ð²Ñ Ð¿ÑинÑли пÑи оплаÑе. Ðиже â как он ÑабоÑаеÑ, ÑÑÐ¾Ð±Ñ Ð²Ð°Ñе ÑÑебование бÑло ÑаÑÑмоÑÑено без задеÑжек.`,`1. ÐÑаво на оÑказ 14ÐÑ Ð²Ð¿Ñаве оÑказаÑÑÑÑ Ð¾Ñ Ð¸ÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð´Ð¾Ð³Ð¾Ð²Ð¾Ñа в лÑбое вÑемÑ, Ñведомив Ð½Ð°Ñ ÑеÑез лиÑнÑй ÐºÐ°Ð±Ð¸Ð½ÐµÑ Ð¸Ð»Ð¸ по ÑлекÑÑонной поÑÑе (п. 6.1 оÑеÑÑÑ). ÐÑи оÑказе оплаÑиваÑÑÑÑ ÑакÑиÑеÑки понеÑÑннÑе иÑполниÑелем ÑаÑÑ Ð¾Ð´Ñ, ÑвÑзаннÑе Ñ Ð¸Ñполнением обÑзаÑелÑÑÑв, â ÑÑо пÑÑмо пÑедÑÑмоÑÑено ${oi[s.id]} (п. 6.2 оÑеÑÑÑ).`,`2. ÐÑли ÑÑлÑга не бÑла окаÐ
14·Ð°Ð½Ð° 15ÐÑли доÑÑÑп не бÑл пÑедоÑÑавлен или ÑеÑÐ²Ð¸Ñ Ð±Ñл недоÑÑÑпен по наÑей вине, ÑплаÑÐµÐ½Ð½Ð°Ñ ÑÑмма возвÑаÑаеÑÑÑ Ð² полном обÑÑме (п. 6.3). ÐаÑвлÑÑ, ÑÑо доÑÑÑп не ÑабоÑаеÑ, Ð²Ñ Ð´Ð°ÑÑе ÑлÑжбе поддеÑжки возможноÑÑÑ ÑÑо пÑовеÑиÑÑ: ÑообÑаеÑе ÑÑÑÑойÑÑво, пÑиложение и ÑпоÑоб подклÑÑениÑ, пÑиÑÑлаеÑе Ñнимки ÑкÑана Ñ Ð¾Ñибкой, вÑполнÑеÑе ÑекомендаÑии по наÑÑÑойке, а пÑи Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ÑÑи пÑедоÑÑавлÑеÑе доÑÑÑп к ÑÑÑÑойÑÑÐ²Ñ Ð´Ð»Ñ ÑдалÑнной пÑовеÑки. ÐÑли ÑÐ°ÐºÐ°Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑ Ð½Ðµ пÑедоÑÑавлена, а по даннÑм ÑеÑвиÑа доÑÑÑп бÑл вÑдан и иÑполÑзовалÑÑ, ÑÑлÑга ÑÑиÑаеÑÑÑ Ð¾ÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹.`,`3. Ðак подаÑÑ ÑÑебование 16ТÑебование напÑавлÑеÑÑÑ ÑеÑез Ñаздел «ÐоддеÑжка» в лиÑном кабинеÑе (${m}) â можно оÑвеÑом в ÑÑо обÑаÑение â либо на адÑÐµÑ ${n} Ñ Ñемой «ÐаÑвление о возвÑаÑе» (п. 6.5). ЧÑÐ¾Ð±Ñ Ð¼Ñ Ð¼Ð¾Ð³Ð»Ð¸ однознаÑно найÑи плаÑÑж и веÑнÑÑÑ Ð´ÐµÐ½Ñги на веÑнÑе ÑеквизиÑÑ, пожалÑйÑÑа, ÑкажиÑе: 17${fn(di)}`,`4. СÑоки и ÑпоÑоб возвÑаÑа 18ÐозвÑаÑ, еÑли он положен, пÑоизводиÑÑÑ Ñем же ÑпоÑобом, коÑоÑÑм бÑла пÑоизведена оплаÑа, в ÑÑок не более 30 (ÑÑидÑаÑи) календаÑнÑÑ Ð´Ð½ÐµÐ¹ Ñ Ð´Ð°ÑÑ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ ÑÑÐµÐ±Ð¾Ð²Ð°Ð½Ð¸Ñ (п. 6.4). Ð Ð°Ð·Ð¼ÐµÑ ÑÑÐ¼Ð¼Ñ Ðº возвÑаÑÑ Ð¾Ð¿ÑеделÑеÑÑÑ Ñ ÑÑÑÑом ÑакÑиÑеÑки понеÑÑннÑÑ ÑаÑÑ Ð¾Ð´Ð¾Ð² по п. 6.2 и даннÑÑ Ð¾Ð± иÑполÑзовании доÑÑÑпа.`,`5. ÐвÑомаÑиÑеÑкое пÑодление 19ЧÑÐ¾Ð±Ñ Ð¸Ð·Ð±ÐµÐ¶Ð°ÑÑ ÑледÑÑÑÐ¸Ñ ÑпиÑаний, авÑопÑодление можно оÑклÑÑиÑÑ Ð² лиÑном кабинеÑе в лÑбой моменÑ.`,"ÐаÑаллелÑно Ñ ÑÑим Ð¼Ñ Ð¿Ð¾-пÑÐµÐ¶Ð½ÐµÐ¼Ñ Ð³Ð¾ÑÐ¾Ð²Ñ Ð¿Ð¾Ð¼Ð¾ÑÑ Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑением: еÑли ÑÑо-Ñо не ÑабоÑаеÑ, опиÑиÑе, на каком ÑÑÑÑойÑÑве и в каком пÑиложении Ð²Ð¾Ð·Ð½Ð¸ÐºÐ°ÐµÑ Ð¿Ñоблема, и пÑиÑлиÑе Ñнимок ÑкÑана â ÑазбеÑÑмÑÑ."].join(` 20 21`)}function ui(s){return s.id==="babka"||s.id==="petya"?hi(s):s.id==="matrix"||s.id==="wisp"||s.id==="brat"||s.id==="inside"?mi(s):null}const jn=Symbol("cancelled");function pi(s,t){return s===jn?{msg:"ÐÑменено â ниÑего не изменилоÑÑ",changed:!1}:{msg:typeof s=="string"&&s?s:t,changed:!0}}function Ge({icon:s,children:t}){return e.jsxs("span",{className:"dim mu__lbl",children:[e.jsx(s,{size:15,strokeWidth:1.9})," ",t]})}function xt({icon:s,title:t}){return e.jsx("span",{className:"dim mu__flbl",title:t,children:e.jsx(s,{size:15,strokeWidth:1.9})})}const xi={only_subscription:"дейÑÑвÑÑÑÐ°Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñка ÑолÑко Ñ Ð½ÐµÐ³Ð¾",no_subscriptions:"дейÑÑвÑÑÑей подпиÑки Ð½ÐµÑ Ð½Ð¸ Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾",autorenew:"Ñ Ð½ÐµÐ³Ð¾ вклÑÑено авÑопÑодление",usage:"ÑÑим аккаÑнÑом полÑзовалиÑÑ",longer_term:"Ñ Ð½ÐµÐ³Ð¾ долÑÑе оплаÑеннÑй ÑÑок"},gi={purchase:"покÑпка",renewal:"пÑодление",trial:"пÑобнÑй",trial_convert:"поÑле пÑобного",extra_devices:"ÑÑÑÑойÑÑва",refund:"возвÑаÑ",upgrade:"Ñмена ÑаÑиÑа"},fi={pending:"ждÑÑ",failed:"не пÑоÑÑл",canceled:"оÑменÑн",refunded:"возвÑаÑ",chargeback:"ÑаÑджбек"};function Es(s,t){const m=Math.round((s||0)/100),n=String(t||"RUB").toUpperCase();
21return m.toLocaleString("ru-RU")+(n==="RUB"?" â½":n==="USD"?" $":n==="EUR"?" â¬":" "+n)}function xs(s){if(!s||s<0)return"0";const t=s/1073741824;return t>=1?t.toFixed(t>=10?0:1)+" ÐÐ":Math.max(1,Math.round(s/1048576))+" ÐÐ"}const ji={active:"акÑивна",suspended:"пÑиоÑÑановлена",pending:"Ð¾Ð¶Ð¸Ð´Ð°ÐµÑ Ð¾Ð¿Ð»Ð°ÑÑ",cancelled:"оÑменена",expired:"иÑÑекла"};function Ht({api:s,userId:t,email:m,onClose:n,onChanged:x}){var Ct,ot,zt,_t,dt,st,ct;const[i,C]=r.useState(null),[u,k]=r.useState(""),g=r.useRef(!1),I=r.useRef({}),E=(j,J)=>{var Ue;const ie=JSON.stringify(J),ge=I.current[j];if(ge&&ge.sig===ie)return ge.id;const ye=((Ue=crypto.randomUUID)==null?void 0:Ue.call(crypto))||Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,12);return I.current[j]={sig:ie,id:ye},ye},X=j=>{delete I.current[j]},[D,W]=r.useState(""),[o,N]=r.useState(""),[v,_]=r.useState(""),[B,Q]=r.useState(""),[A,$]=r.useState(""),[V,T]=r.useState(null),[y,q]=r.useState(null),[P,oe]=r.useState(!1),[L,se]=r.useState(""),[U,ne]=r.useState(null),[le,ee]=r.useState(""),[be,w]=r.useState(""),[d,b]=r.useState(""),[F,Z]=r.useState("months"),[xe,ue]=r.useState("start"),[Ne,fe]=r.useState(""),[ce,Be]=r.useState("add"),[Ae,Ce]=r.useState(""),[R,ze]=r.useState(""),[ke,Le]=r.useState(!1),[Ee,Fe]=r.useState(""),[l,a]=r.useState(null),[M,f]=r.useState(!1),S=()=>s(`/admin/user/${t}/manage`).then(C).catch(j=>N((j==null?void 0:j.message)||"не оÑкÑÑлоÑÑ")),H=()=>s(`/admin/user/${t}/payments`).then(j=>a({list:(j==null?void 0:j.payments)||[],ltvCents:(j==null?void 0:j.ltvCents)||0,currency:(j==null?void 0:j.currency)||"RUB"})).catch(()=>a(null)),p=()=>{const j=be.trim();if(j)return pe("tk",()=>s(`/admin/user/${t}/ticket`,{subject:le.trim()||void 0,body:j}).then(()=>{ee(""),w("")}),"обÑаÑение Ñоздано â")},K=j=>F==="days"?{days:j}:{months:j},re=()=>{if(u)return;const j=Math.floor(Number(d));if(!j||j<=0)return;const J=Math.floor(Number(Ne)),ie={plan:xe,...K(j)};J>0&&(ie.devices=J);const ge=E("grant-new",ie);pe("grant",()=>s(`/admin/user/${t}/grant-new`,{...ie,requestId:ge}).then(()=>{X("grant-new"),b(""),fe("")}),`вÑдан ${xe} на ${j} ${F==="days"?"дн.":"меÑ."}`)},je=()=>{var j,J;return((j=i==null?void 0:i.panel)==null?void 0:j.deviceLimit)||((J=i==null?void 0:i.subscription)==null?void 0:J.deviceLimit)||(i==null?void 0:i.devices.length)||1},c=()=>{if(u)return;const j=Math.floor(Number(d)),J=Math.floor(Number(Ae));(!j||j<=0)&&(!J||J<=0)||pe("grant",async()=>{j>0&&await s(`/admin/user/${t}/grant-time`,{...K(j),requestId:E("grant-time",K(j))}),J>0&&await s(`/admin/user/${t}/set-devices`,{total:je()+J}),X("grant-time"),b(""),Ce("")},"Ðобавлено")},te=()=>{if(u)return;const j=Math.floor(Number(d)),J=Math.floor(Number(Ae));(!j||j<=0)&&(!J||J<=0)||pe("grant",async()=>{const ie=[];if(J>0){const ge=Math.max(1,je()-J),ye=await s(`/admin/user/${t}/set-devices`,{total:ge}),Ue=ye&&typeof ye.deviceLimit=="number"?ye.deviceLimit:null;Ue!==null&&Ue>ge&&ie.push(Ue===je()?`УбиÑаÑÑ Ð½ÐµÑего: вÑе ${Ue} ÑÑÑÑойÑÑв Ð²Ñ Ð¾Ð´ÑÑ Ð² ÑаÑиÑ, докÑпленнÑÑ ÑвеÑÑ Ñ Ð½ÐµÑ. ÐенÑÑе â ÑолÑко Ñменой ÑаÑиÑа.`:`ÐÑÑалоÑÑ ${Ue} ÑÑÑÑойÑÑв: ÑнÑÑÑ ÑолÑко докÑпленнÑе, Ð¿Ð°ÐºÐµÑ ÑаÑиÑа кнопкой не ÑменÑÑиÑÑ.`)}if(j>0){const ge=await s(`/admin/user/${t}/trim-time`,K(j));ge&&typeof ge.trimmedDays=="number"&&ge.trimmedDays<ge.requestedDays&&ie.push(`СÑезано ${ge.trimmedDays} дн. из ${ge.requestedDays} â акÑивнÑй пеÑиод не гаÑим (Ð´Ð»Ñ Ð¿Ð¾Ð»Ð½Ð¾Ð³Ð¾ â «ÐÑмениÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ»).`)}return b(""),Ce(""),ie.join(" ")},"УбÑано")},ve=()=>{if(u||!R||R===(me==null?void 0:me.plan))return;const j=ke?` 22 23ÐÑÑаÑок оплаÑенного пеÑиода бÑÐ´ÐµÑ Ð¿ÐµÑеÑÑиÑан СРÐÐÐÐ: деÑевле ÑаÑÐ¸Ñ â дней ÑÑÐ°Ð½ÐµÑ Ð±Ð¾Ð»ÑÑе, доÑоже â менÑÑе.`:` 24 25СÑок оÑÑанеÑÑÑ Ð¿Ñежним.`;confirm(`СмениÑÑ ÑаÑÐ¸Ñ ${me==null?void 0:me.plan} â ${R}?${j} 26 27ÐзменÑÑÑÑ Ð»Ð¸Ð¼Ð¸Ñ ÑÑÑÑойÑÑв и ÑÑмма ÑледÑÑÑего авÑопÑодлениÑ. ÐенÑги ÑейÑÐ°Ñ Ð½Ðµ ÑпиÑÑваÑÑÑÑ Ð¸ не возвÑаÑаÑÑÑÑ.`)&&pe("plan",async()=>{const J={plan:R,prorate:ke||void 0},ie=await s(`/admin/user/${t}/set-plan`,{...J,requestId:E("set-plan",J)});X("set-plan"),ze("");const ge=[`ТаÑиÑ: ${(ie==null?void 0:ie.prevPlan)||(me==null?void 0:me.plan)} â ${(ie==null?void 0:ie.plan)||R}`,`ÑÑÑÑойÑÑв ${(ie==null?void 0:ie.deviceLimit)??"â"}`],ye=Number(ie==null?void 0:ie.proratedDays)||0;return ye?ge.push(`ÑÑок ${ye>0?"+":"â"}${Math.abs(ye)} дн.`):ke&&ge.push("пеÑеÑÑÑÑ Ð½Ðµ поÑÑебовалÑÑ"),ie&&ie.panelOk===!1&&ge.push("ÐÐÐÐÐЬ ÐÐ ÐÐÐÐÐÐÐÐСЬ â пÑовеÑÑÑе Ð»Ð¸Ð¼Ð¸Ñ ÑÑÑÑойÑÑв вÑÑÑнÑÑ"),ie&&ie.renewAmountUnknown&&ge.push("СУÐÐÐ ÐÐТÐÐÐ ÐÐÐÐÐÐЯ ÐÐ ÐÐÐ ÐСЧÐТÐÐÐ (Ð½ÐµÑ ÑÐµÐ½Ñ Ð² каÑалоге) â пÑовеÑÑÑе вÑÑÑнÑÑ"),ge.join(", ")+"."},"ТаÑÐ¸Ñ Ð¸Ð·Ð¼ÐµÐ½Ñн")},Se=()=>{u||confirm("ÐÑмениÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ? ÐоÑÑÑп бÑÐ´ÐµÑ Ð¾ÑклÑÑÑн. ÐейÑÑвие Ð´Ð»Ñ Ð¿Ð¾Ð»Ð½Ð¾Ð³Ð¾ гаÑÐµÐ½Ð¸Ñ â не Ð´Ð»Ñ ÑокÑаÑÐµÐ½Ð¸Ñ ÑÑока.")&&pe("revoke",()=>s("/admin/revoke",{userId:t}),"ÐодпиÑка оÑменена")};r.useEffect(()=>{S(),H(),f(!1)},[t]);const pe=async(j,J,ie)=>{if(!g.current){g.current=!0,k(j),N(""),W("");try{const ge=pi(await J(),ie);W(ge.msg),ge.changed&&(await S(),x==null||x())}catch(ge){N((ge==null?void 0:ge.message)||"оÑибка")}finally{g.current=!1,k("")}}};r.useEffect(()=>
27{i&&(Q(String(i.user.tgId??"")),$(String(i.user.tg??"")))},[(Ct=i==null?void 0:i.user)==null?void 0:Ct.tgId,(ot=i==null?void 0:i.user)==null?void 0:ot.tg]);const Re=()=>{const j=B.replace(/[^0-9]/g,"");confirm(j?`ÐÑивÑзаÑÑ Telegram id ${j}${A?" (@"+A.replace(/^@/,"")+")":""} к ÑÑÐ¾Ð¼Ñ Ð°ÐºÐºÐ°ÑнÑÑ?`:"ÐÑвÑзаÑÑ Telegram Ð¾Ñ Ð°ÐºÐºÐ°ÑнÑа?")&&(T(null),pe("tg",async()=>{var J;try{return await s(`/admin/user/${t}/telegram`,{telegramId:j,username:A.replace(/^@/,"")||null}),j?"Telegram пÑивÑзан":"Telegram оÑвÑзан"}catch(ie){throw((J=ie==null?void 0:ie.data)==null?void 0:J.error)==="telegram_taken"?(T({otherId:String(ie.data.otherId),otherEmail:ie.data.otherEmail??null}),new Error("telegram_taken")):ie}},"ÐоÑово"))},Ie=j=>{if(!(y!=null&&y.otherId))return;const J=y.otherId,ie=j==="in"?J:t,ge=j==="in"?t:J;pe("email",async()=>{var pt;const ye=await s(`/admin/users/merge-plan?from=${encodeURIComponent(ie)}&to=${encodeURIComponent(ge)}`);if((pt=ye==null?void 0:ye.blockers)!=null&&pt.length)throw new Error("СлиÑÑ Ð½ÐµÐ»ÑзÑ: "+ye.blockers.join("; "));const Ue=Object.entries((ye==null?void 0:ye.counts)||{}).filter(([,nt])=>nt>0).map(([nt,$t])=>`${nt}: ${$t}`).join(", ")||"ниÑего, кÑоме Ñамого аккаÑнÑа",mt=(ye==null?void 0:ye.fromEmail)||"без поÑÑÑ",Tt=(ye==null?void 0:ye.toEmail)||"без поÑÑÑ",ht=prompt(`ÐеÑенеÑÑи Ñ ${mt} на ${Tt}. 28ÐеÑеедеÑ: ${Ue}. 29ÐккаÑÐ½Ñ ${mt} ÑÑÐ°Ð½ÐµÑ Ð·Ð°ÐºÑÑÑÑм. 30 31ÐÐ»Ñ Ð¿Ð¾Ð´ÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ Ð½Ð°Ð¿ÐµÑаÑайÑе адÑеÑ, Ñ ÐºÐ¾ÑоÑого пеÑеноÑим (или оÑÑавÑÑе пÑÑÑÑм, еÑли поÑÑÑ Ð½ÐµÑ):`);if(ht===null)return jn;await s("/admin/users/merge",{from:ie,to:ge,confirmEmail:ht});const ut=(j==="in"&&y.otherEmail||"").trim().toLowerCase();if(ut)try{await s(`/admin/user/${t}/email`,{email:ut})}catch{}q(null),j==="out"&&n()},"ÐккаÑнÑÑ ÑлиÑÑ")},rt=()=>{if(!V)return;const j=V.otherEmail||"без поÑÑÑ (Telegram)";confirm(`СлиÑÑ Ð°ÐºÐºÐ°ÑÐ½Ñ ${j} (Ñ ÑÑим Telegram) в ÑекÑÑий? Ðго подпиÑка и плаÑежи пеÑеедÑÑ ÑÑда.`)&&pe("tg",async()=>{await s("/admin/users/merge",{from:V.otherId,to:t,confirmEmail:V.otherEmail||""});const J=B.replace(/[^0-9]/g,"");if(J)try{await s(`/admin/user/${t}/telegram`,{telegramId:J})}catch{}return T(null),"ÐккаÑнÑÑ Ð¾Ð±ÑединенÑ, Telegram пÑивÑзан"},"ÐоÑово")},et=()=>{const j=v.trim().toLowerCase();j&&confirm(`СмениÑÑ Ð°Ð´ÑÐµÑ 32${(i==null?void 0:i.user.email)||"â"} 33на 34${j}? 35 36ÐÑе ÑеÑÑии Ñеловека бÑдÑÑ Ð·Ð°Ð²ÐµÑÑенÑ.`)&&(q(null),pe("email",async()=>{var J;try{return await s(`/admin/user/${t}/email`,{email:j})}catch(ie){throw((J=ie==null?void 0:ie.data)==null?void 0:J.error)==="email_taken"?(q({otherId:String(ie.data.otherId||""),otherEmail:ie.data.otherEmail??j}),new Error("email_taken")):ie}},"ÐдÑÐµÑ Ð¸Ð·Ð¼ÐµÐ½Ñн"),_(""))},at=()=>{const j=L.trim().toLowerCase();j&&(ne(null),pe("alias",async()=>{const J=await s(`/admin/user/${t}/alias-plan?email=${encodeURIComponent(j)}`);if(ne(J),J.blockers.length)throw new Error(J.blockers.join("; "));return J.mode==="free"?"ÐдÑÐµÑ Ñвободен â можно добавиÑÑ":"ÐдÑÐµÑ Ð·Ð°Ð½ÑÑ: понадобиÑÑÑ Ð¾Ð±Ñединение"},""))},Ye=j=>{var ge;const J=U;if(!J)return;const ie=J.loserId===J.targetId?J.target:J.owner;if(J.mode==="merge"){const ye=j==="add_days"?`оÑÑаÑок (${J.loserDaysLeft} дн.) добавиÑÑÑ Ðº вÑживÑей`:j==="close_now"?"оÑÑаÑок вÑоÑой подпиÑки ÑгоÑиÑ":"вÑоÑÐ°Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñка закÑоеÑÑÑ";if(!confirm(`ÐбÑединиÑÑ Ð°ÐºÐºÐ°ÑнÑÑ? 37 38ÐÑÑаÑÑÑÑ: ${((ge=J.winnerId===J.targetId?J.target:J.owner)==null?void 0:ge.email)||"â"} 39ÐакÑÑваеÑÑÑ: ${(ie==null?void 0:ie.email)||"â"} 40 41${ye}. 42 43ÐÑмениÑÑ ÑÑо бÑÐ´ÐµÑ Ð½ÐµÐ»ÑзÑ.`))return}pe("alias",async()=>{const ye=await s(`/admin/user/${t}/alias`,{email:J.email,choice:j??null,confirmEmail:(ie==null?void 0:ie.email)||J.loserId||""});return ne(null),se(""),ye!=null&&ye.merged?`ÐккаÑнÑÑ Ð¾Ð±ÑединенÑ${ye.carriedDays?`, пеÑенеÑено ${ye.carriedDays} дн.`:""}`:"ÐдÑÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½"},"ÐоÑово")},lt=j=>{confirm(`УбÑаÑÑ Ð°Ð´ÑÐµÑ ${j}? 44 45ÐÑ Ð¾Ð´Ð¸ÑÑ Ð¿Ð¾ Ð½ÐµÐ¼Ñ ÑÑÐ°Ð½ÐµÑ Ð½ÐµÐ»ÑзÑ. ÐккаÑÐ½Ñ Ð¸ подпиÑка не ÑÑонÑÑÑ.`)&&pe("alias",async()=>(await s(`/admin/user/${t}/alias/remove`,{email:j}),"ÐдÑÐµÑ ÑбÑан"),"ÐоÑово")},Gt=()=>{confirm("УбÑаÑÑ Ð¿Ð°ÑолÑ? Человек бÑÐ´ÐµÑ Ð²Ñ Ð¾Ð´Ð¸ÑÑ Ð¿Ð¾ ÐºÐ¾Ð´Ñ Ð½Ð° поÑÑÑ â ÑÑо Ð½Ð°Ñ Ð¾Ñновной ÑпоÑоб Ð²Ñ Ð¾Ð´Ð°.")&&pe("pw",()=>s(`/admin/user/${t}/password/reset`,{}),"ÐаÑÐ¾Ð»Ñ ÑбÑан, Ð²Ñ Ð¾Ð´ по кодÑ")},Je=()=>{confirm(`СнÑÑÑ Ð´Ð²ÑÑ ÑакÑоÑнÑÑ Ð·Ð°ÑиÑÑ? 46 47СделайÑе ÑÑо, ÑолÑко еÑли ÑвеÑенÑ, ÑÑо пиÑÐµÑ Ð²Ð»Ð°Ð´ÐµÐ»ÐµÑ (пиÑÑмо Ñ Ð°Ð´ÑеÑа аккаÑнÑа). ÐÑ Ð¾Ð´ Ñнова ÑÑÐ°Ð½ÐµÑ Ð¿Ð¾ поÑÑе/паÑÐ¾Ð»Ñ Ð±ÐµÐ· кода из пÑиложениÑ.`)&&pe("2fa",()=>s(`/admin/user/${t}/2fa/reset`,{}),"ÐвÑÑ ÑакÑоÑÐ½Ð°Ñ Ð·Ð°ÑиÑа ÑнÑÑа")},St=async()=>
47{if(confirm("СгенеÑиÑоваÑÑ Ð¿Ð°ÑолÑ? Человек ÑÐ¼Ð¾Ð¶ÐµÑ Ð²Ñ Ð¾Ð´Ð¸ÑÑ Ð¿Ð¾ÑÑой и паÑолем. ÐаÑÐ¾Ð»Ñ ÑÐ¾Ñ ÑанÑеÑÑÑ Ð·Ð°ÑиÑÑованнÑм â позже его можно показаÑÑ Ñнова кнопкой «ÐоказаÑÑ Ð¿Ð°ÑолÑ».")){k("setpw"),N(""),W(""),Fe("");try{const j=await s(`/admin/user/${t}/password/set`,{});j!=null&&j.password&&(Fe(j.password),W(`ÐовÑй паÑолÑ: ${j.password} â ÑкопиÑÑйÑе и пеÑедайÑе`)),await S(),x==null||x()}catch(j){N((j==null?void 0:j.message)||"оÑибка")}finally{k("")}}},tt=async()=>{var j;k("revpw"),N(""),W(""),Fe("");try{const J=await s(`/admin/user/${t}/password/reveal`,{});J!=null&&J.password&&(Fe(J.password),W(`ÐаÑолÑ: ${J.password}`))}catch(J){N((((j=J==null?void 0:J.data)==null?void 0:j.error)||(J==null?void 0:J.message))==="no_stored"?"Ð¡Ð¾Ñ ÑанÑнного паÑÐ¾Ð»Ñ Ð½ÐµÑ â ÐºÐ»Ð¸ÐµÐ½Ñ Ð·Ð°Ð´Ð°Ð» Ñвой":(J==null?void 0:J.message)||"оÑибка"),await S()}finally{k("")}},Ve=async()=>{if(confirm("ÐÑвÑзаÑÑ Ð²Ñе ÑÑÑÑойÑÑва? ÐÐ¸Ð¼Ð¸Ñ ÑаÑиÑа не менÑеÑÑÑ â оÑвобождаÑÑÑÑ Ð·Ð°Ð½ÑÑÑе меÑÑа.")){k("dev"),N(""),W("");try{const j=await s(`/admin/user/${t}/devices/reset`,{});W(j!=null&&j.total?`СнÑÑо ÑÑÑÑойÑÑв: ${j.removed??0} из ${j.total}`:"УÑÑÑойÑÑва оÑвÑзанÑ"),await S(),x==null||x()}catch(j){N((j==null?void 0:j.message)||"оÑибка")}finally{k("")}}},Kt=()=>{confirm(`ÐÑдаÑÑ Ð½Ð¾Ð²ÑÑ ÑÑÑлкÑ-подпиÑкÑ? 48 49СÑаÑÐ°Ñ Ð¿ÐµÑеÑÑÐ°Ð½ÐµÑ ÑабоÑаÑÑ Ð½ÐµÐ¼ÐµÐ´Ð»ÐµÐ½Ð½Ð¾. ÐÑе ÑÑÑÑойÑÑва клиенÑа оÑклÑÑаÑÑÑ, пока он не вÑÑÐ°Ð²Ð¸Ñ Ð½Ð¾Ð²ÑÑ ÑÑÑÐ»ÐºÑ Ð² пÑиложение â оÑпÑавÑÑе ÐµÑ ÐµÐ¼Ñ ÑÑазÑ.`)&&pe("rot",async()=>{var J;const j=await s(`/admin/user/${t}/subscription/rotate`,{});if(j!=null&&j.url)try{await((J=navigator.clipboard)==null?void 0:J.writeText(String(j.url)))}catch{}return await S(),"ÐÐ¾Ð²Ð°Ñ ÑÑÑлка вÑдана и ÑкопиÑована"},"ÐоÑово")},wt=j=>{j&&confirm("ÐÑвÑзаÑÑ ÑÑо ÑÑÑÑойÑÑво? ÐÑли оно ÑейÑÐ°Ñ Ð¿Ð¾Ð´ÐºÐ»ÑÑено, ÑÐ»Ð¾Ñ Ð¾ÑвободиÑÑÑ, но пÑи ÑледÑÑÑем Ñоединении ÑÑÑÑойÑÑво веÑнÑÑÑÑ.")&&pe("dev1:"+j,()=>s(`/admin/user/${t}/device/remove`,{hwid:j}),"УÑÑÑойÑÑво оÑвÑзано")},Nt=async()=>{if(i!=null&&i.subUrl)try{await navigator.clipboard.writeText(i.subUrl),oe(!0),setTimeout(()=>oe(!1),1500)}catch{}},Xt=()=>pe("imp",async()=>{const j=await s("/admin/impersonate",{userId:t});if(!(j!=null&&j.url))throw new Error("Ð½ÐµÑ Ð°Ð´ÑеÑа поÑÑÑ â Ð²Ñ Ð¾Ð´ под полÑзоваÑелем недоÑÑÑпен");window.open(j.url,"_blank","noopener")},"ÐÑкÑÑл его ÐºÐ°Ð±Ð¸Ð½ÐµÑ Ð² новой вкладке"),me=i==null?void 0:i.subscription,kt=o==="email_taken"?"ÐÑÐ¾Ñ Ð°Ð´ÑÐµÑ Ñже занÑÑ Ð´ÑÑгим аккаÑнÑом":o==="bad_email"?"ÐдÑÐµÑ Ð½Ðµ Ð¿Ð¾Ñ Ð¾Ð¶ на поÑÑовÑй":o==="no_subscription"?"У Ñеловека Ð½ÐµÑ Ð¿Ð¾Ð´Ð¿Ð¸Ñки â оÑвÑзÑваÑÑ Ð½ÐµÑего":o==="telegram_taken"?"ÐÑÐ¾Ñ Telegram Ñже пÑивÑзан к дÑÑÐ³Ð¾Ð¼Ñ Ð°ÐºÐºÐ°ÑнÑÑ â ÑÑо ÑлиÑние, не пеÑепÑивÑзка (иÑполÑзÑйÑе меÑж)":o;return e.jsx("div",{className:"mu__back",onClick:j=>{j.target===j.currentTarget&&n()},children:e.jsxs("div",{className:"mu",children:[e.jsxs("div",{className:"mu__head",children:[e.jsx("b",{children:"УпÑавление полÑзоваÑелем"}),e.jsx("span",{className:"dim",style:{overflowWrap:"anywhere"},children:(i==null?void 0:i.user.email)||m||t.slice(0,8)}),e.jsx("button",{className:"btn btn--ghost btn--xs",style:{marginLeft:"auto"},onClick:n,children:"ÐакÑÑÑÑ"})]}),!i&&!o&&e.jsx("p",{className:"dim",children:"ÐагÑÑжаÑâ¦"}),kt&&e.jsx("p",{className:"err",style:{margin:"4px 0"},children:kt}),D&&e.jsx("p",{style:{color:"var(--green)",margin:"4px 0"},children:D}),i&&e.jsxs(e.Fragment,{children:[i.user.blockedAt?e.jsxs("div",{style:{margin:"0 0 12px",padding:"10px 12px",borderRadius:10,background:"rgba(255,90,80,0.12)",border:"1px solid rgba(255,90,80,0.45)",display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:"1 1 260px",minWidth:0},children:[e.jsx("b",{children:"ÐоÑÑÑп заблокиÑован"}),e.jsxs("div",{className:"dim",style:{fontSize:12,marginTop:2}
49,children:[new Date(i.user.blockedAt).toLocaleString("ru-RU"),i.user.blockedReason?` · ${i.user.blockedReason}`:""]})]}),e.jsx("button",{className:"btn btn--sm",disabled:!!u,onClick:()=>pe("block",()=>s(`/admin/user/${t}/block`,{undo:!0}),"ÐлокиÑовка ÑнÑÑа. ÐоÑÑÑп к ÑеÑвиÑÑ Ð²ÐµÑнÑÑ Ð¿Ñодление â авÑомаÑиÑеÑки он не вклÑÑаеÑÑÑ"),children:"РазблокиÑоваÑÑ"})]}):null,e.jsxs("div",{className:"mu__contacts",children:[e.jsxs("span",{className:"mu__contact",children:[e.jsx(_s,{size:14,strokeWidth:1.9}),i.user.email||e.jsx("span",{className:"dim",children:"поÑÑÑ Ð½ÐµÑ"})]}),i.user.tg?e.jsxs("span",{className:"mu__contact",children:[e.jsx(Ft,{size:14,strokeWidth:1.9}),"@",i.user.tg]}):i.user.tgId?e.jsxs("span",{className:"mu__contact",title:"Telegram пÑивÑзан, без @username â Ð±Ð¾Ñ Ð¿Ð¸ÑÐµÑ Ð¿Ð¾ chat_id",children:[e.jsx(Ft,{size:14,strokeWidth:1.9}),"id ",i.user.tgId]}):null]}),e.jsxs("div",{className:"mu__facts",children:[e.jsxs("div",{children:[e.jsx(xt,{icon:nn,title:"ÐодпиÑка"}),e.jsx("b",{children:(me==null?void 0:me.plan)||"неÑ"}),me!=null&&me.status?e.jsx("div",{className:"dim",style:{fontSize:11,marginTop:2},children:ji[me.status]||me.status}):null]}),e.jsxs("div",{children:[e.jsx(xt,{icon:kn,title:"ÐейÑÑвÑÐµÑ Ð´Ð¾"}),e.jsx("b",{children:me!=null&&me.expiresAt?new Date(me.expiresAt).toLocaleDateString("ru-RU"):"â"}),me!=null&&me.paidUntil&&me.expiresAt&&me.paidUntil>me.expiresAt?e.jsxs("div",{className:"dim",style:{fontSize:11,marginTop:2},title:"Ñ ÑÑÑÑом оÑеÑеди бÑдÑÑиÑ
пеÑиодов",children:["до ",new Date(me.paidUntil).toLocaleDateString("ru-RU")]}):null]}),e.jsxs("div",{children:[e.jsx(xt,{icon:rs,title:"УÑÑÑойÑÑв"}),e.jsxs("b",{children:[i.devices.length,(zt=i.panel)!=null&&zt.deviceLimit||me!=null&&me.deviceLimit?` из ${((_t=i.panel)==null?void 0:_t.deviceLimit)||(me==null?void 0:me.deviceLimit)}`:""]})]}),i.panel&&e.jsxs("div",{children:[e.jsx(xt,{icon:Cn,title:"СкаÑано"}),e.jsx("b",{title:i.panel.onlineAt?"ÐоÑледний онлайн: "+new Date(i.panel.onlineAt).toLocaleString("ru-RU"):"Ðи ÑÐ°Ð·Ñ Ð½Ðµ подклÑÑалÑÑ",children:xs(i.panel.lifetimeBytes||i.panel.usedBytes)})]}),e.jsxs("div",{children:[e.jsx(xt,{icon:Wt,title:"ÐаÑолÑ"}),e.jsxs("b",{children:[i.user.genPass?"вÑдан нами":i.user.hasPassword?"задан клиенÑом":"по кодÑ",i.user.twoFactor?" + 2FA":""]})]})]}),e.jsxs("div",{className:"mu__row",children:[e.jsx(Ge,{icon:zn,children:"СÑÑлка подпиÑки"}),i.subUrl?e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"mu__code",children:i.subUrl}),e.jsx("button",{className:"btn btn--ghost btn--xs mu__iconbtn",onClick:Kt,disabled:u==="rot",title:"ÐÑдаÑÑ Ð½Ð¾Ð²ÑÑ ÑÑÑлкÑ, ÑÑаÑÐ°Ñ Ð¿ÐµÑеÑÑÐ°Ð½ÐµÑ ÑабоÑаÑÑ","aria-label":"ÐеÑевÑпÑÑÑиÑÑ ÑÑÑлкÑ",children:u==="rot"?e.jsx("span",{className:"spinner"}):e.jsx(Mt,{size:15,strokeWidth:1.9})}),e.jsxs("button",{className:"btn btn--ghost btn--xs mu__act",onClick:Nt,title:"СкопиÑоваÑÑ ÑÑÑлкÑ",children:[P?e.jsx(_n,{size:15,strokeWidth:2}):e.jsx(Ts,{size:15,strokeWidth:1.9}),P?"гоÑово":"копиÑоваÑÑ"]})]}):e.jsx("span",{className:"dim",style:{whiteSpace:"nowrap"},children:"Ð½ÐµÑ â подпиÑка не вÑдана"})]}),e.jsxs("div",{className:"mu__row",children:[e.jsx(Ge,{icon:$s,children:"СмениÑÑ Ð°Ð´ÑеÑ"}),e.jsx("input",{className:"mu__input",type:"email",placeholder:"новÑй@адÑеÑ.ÑÑ",value:v,onChange:j=>_(j.target.value)}),e.jsx("button",{className:"btn btn--ghost btn--xs mu__act",disabled:!v.trim()||u==="email",onClick:et,children:u==="email"?"менÑÑâ¦":"ÑмениÑÑ"})]}),e.jsxs("div",{className:"mu__row",children:[e.jsx(Ge,{icon:_s,children:"ÐÑÑ Ð°Ð´ÑеÑ"}),e.jsx("input",{className:"mu__input",type:"email",placeholder:"вÑоÑой@адÑеÑ.ÑÑ",value:L,onChange:j=>{se(j.target.value),ne(null)}}),!U||U.email!==L.trim().toLowerCase()||U.blockers.length?e.jsx("button",{className:"btn btn--ghost btn--xs mu__act",disabled:!L.trim()||u==="alias",onClick:at,children:u==="al
49ias"?"â¦":"пÑовеÑиÑÑ"}):U.mode==="free"&&!U.blockers.length?e.jsx("button",{className:"btn btn--ghost btn--xs mu__act",disabled:u==="alias",onClick:()=>Ye(),children:u==="alias"?"â¦":"добавиÑÑ"}):null]}),!!((dt=i.emails)!=null&&dt.length)&&e.jsxs("div",{className:"mu__row",children:[e.jsx(Ge,{icon:$s,children:"ÐÑ
Ð¾Ð´Ð¸Ñ Ñакже"}),e.jsx("span",{style:{flex:"1 1 auto",display:"flex",flexWrap:"wrap",gap:6},children:i.emails.map(j=>e.jsxs("span",{className:"dim",style:{display:"inline-flex",alignItems:"center",gap:4,background:"var(--surface-2)",borderRadius:8,padding:"2px 4px 2px 8px",fontSize:12.5},children:[j.email,e.jsx("button",{className:"btn btn--ghost btn--xs",style:{padding:"0 4px"},disabled:u==="alias",title:"УбÑаÑÑ Ð°Ð´ÑÐµÑ â вÑ
одиÑÑ Ð¿Ð¾ Ð½ÐµÐ¼Ñ ÑÑÐ°Ð½ÐµÑ Ð½ÐµÐ»ÑзÑ",onClick:()=>lt(j.email),children:e.jsx(Rs,{size:13,strokeWidth:2})})]},j.email))})]}),(U==null?void 0:U.mode)==="merge"&&!U.blockers.length&&U.email===L.trim().toLowerCase()&&e.jsxs("div",{className:"mu__row",style:{flexWrap:"wrap",background:"color-mix(in srgb, var(--danger, #E5484D) 8%, var(--surface-2))",border:"1px solid var(--danger, #E5484D)",borderRadius:10,padding:"8px 10px"},children:[e.jsxs("span",{className:"dim",style:{flex:"1 1 100%",fontSize:12.5},children:["ÐдÑÐµÑ ",U.email," Ñже за дÑÑгим аккаÑнÑом â понадобиÑÑÑ Ð¾Ð±ÑединиÑÑ."," ","ÐÑÑанеÑÑÑ ",e.jsx("b",{children:((st=U.winnerId===U.targetId?U.target:U.owner)==null?void 0:st.email)||"â"}),U.reason?` â ${xi[U.reason]}`:"","."," ","ÐакÑоеÑÑÑ ",e.jsx("b",{children:((ct=U.loserId===U.targetId?U.target:U.owner)==null?void 0:ct.email)||"â"}),";"," ","вÑ
одиÑÑ Ð¾Ð±Ð¾Ð¸Ð¼Ð¸ адÑеÑами Ñеловек ÑÐ¼Ð¾Ð¶ÐµÑ Ð¿Ð¾-пÑежнемÑ."]}),U.needsChoice?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"dim",style:{flex:"1 1 100%",fontSize:12.5},children:["ÐейÑÑвÑÑÑ Ð¾Ð±Ðµ подпиÑки. У закÑÑваемой оÑÑаÑÑÑÑ ",U.loserDaysLeft," дн. â ÑÑо Ñ Ð½Ð¸Ð¼Ð¸?"]}),e.jsx("button",{className:"btn btn--ghost btn--xs",disabled:u==="alias",onClick:()=>Ye("add_days"),title:"ÐÑÑаÑок ÑÑока закÑÑваемой подпиÑки пÑибавиÑÑÑ Ðº вÑживÑей",children:u==="alias"?"â¦":`ÐобавиÑÑ ${U.loserDaysLeft} дн.`}),e.jsx("button",{className:"btn btn--danger btn--xs",disabled:u==="alias",onClick:()=>Ye("close_now"),title:"ÐакÑÑÑÑ Ð²ÑоÑÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ ÑÑÐ°Ð·Ñ â ÐµÑ Ð¾ÑÑаÑок ÑгоÑиÑ",children:u==="alias"?"â¦":"ÐакÑÑÑÑ ÑÑазÑ"})]}):e.jsx("button",{className:"btn btn--danger btn--xs",disabled:u==="alias",onClick:()=>Ye(),children:u==="alias"?"â¦":"ÐбÑединиÑÑ"})]}),e.jsxs("div",{className:"mu__row",children:[e.jsx(Ge,{icon:Ft,children:"Telegram"}),e.jsx("input",{className:"mu__input mu__input--sm",inputMode:"numeric",placeholder:"id (ÑиÑлом)",value:B,onChange:j=>Q(j.target.value.replace(/[^0-9]/g,""))}),e.jsx("input",{className:"mu__input mu__input--sm",placeholder:"@username",value:A,onChange:j=>$(j.target.value)}),e.jsx("button",{className:"btn btn--ghost btn--xs mu__act",disabled:u==="tg",onClick:Re,children:u==="tg"?"â¦":i.user.tgId?"измениÑÑ":"пÑивÑзаÑÑ"})]}),(y==null?void 0:y.otherId)&&e.jsxs("div",{className:"mu__row",style:{background:"color-mix(in srgb, var(--danger, #E5484D) 8%, var(--surface-2))",border:"1px solid var(--danger, #E5484D)",borderRadius:10,padding:"8px 10px"},children:[e.jsxs("span",{className:"dim",style:{flex:"1 1 auto",fontSize:12.5},children:["ÐдÑÐµÑ ",y.otherEmail||""," Ñже на дÑÑгом аккаÑнÑе â ÑÑо ÑлиÑние, а не Ñмена адÑеÑа. ÐÑбеÑиÑе, какой аккаÑÐ½Ñ Ð¾ÑÑаÑÑÑÑ."]}),e.jsx("button",{className:"btn btn--danger btn--xs",disabled:u==="email",onClick:()=>Ie("in"),title:"Ð¢Ð¾Ñ Ð°ÐºÐºÐ°ÑÐ½Ñ Ð²Ð»Ð¸Ð²Ð°ÐµÑÑÑ Ð² ÑÑоÑ: его подпиÑка и плаÑежи пеÑеедÑÑ ÑÑда, адÑÐµÑ Ð¾ÑвободиÑÑÑ Ð¸ вÑÑÐ°Ð½ÐµÑ Ð½Ð° ÑекÑÑий",children:u==="email"?"â¦":"Ð¢Ð¾Ñ â ÑÑда"}),e.jsx("button",{className:"btn btn--danger btn--xs",disabled:u==="email",onClick:()=>Ie("out"),title:"ÐÑÐ¾Ñ Ð°ÐºÐºÐ°ÑÐ½Ñ Ð²Ð»Ð¸Ð²Ð°ÐµÑÑÑ Ð² ÑоÑ: ÑекÑÑÐ°Ñ ÐºÐ°ÑÑоÑка ÑÑÐ°Ð½ÐµÑ Ð½Ð°Ð´Ð³Ñобием, вÑÐ¶Ð¸Ð²ÐµÑ Ð²Ð»Ð°Ð´ÐµÐ»ÐµÑ Ð°Ð´ÑеÑа",children:u==="email"?"â¦":"ÐÑÐ¾Ñ â ÑÑда"})]}),V&&e.jsxs("div",{className:"mu__row",style:{background:"color-mix(in srgb, var(--danger, #E5484D) 8%, var(--surface-2))",border:"1px solid var(--danger, #E5484D)",borderRadius:10,padding:"8px 10px"},children:[e.jsxs("span",{className:"dim",style:{flex:"1 1 auto",fontSize:12.5},children:["ÐÑÐ¾Ñ Telegram Ñже пÑивÑзан к аккаÑнÑÑ ",V.otherEmail||"без поÑÑÑ"," â ÑÑо ÑлиÑние."]}),e.jsx("button",{className:"btn btn--danger btn--xs",disabled:u==="tg",onClick:rt,children:u==="tg"?"â¦":"СлиÑÑ ÑÑда"})]}),e.jsxs("div",{className:"mu__row mu__row--col",children:[e.jsx(Ge,{icon:Tn,children:"ÐапиÑаÑÑ Ð¿Ð¾Ð»ÑзоваÑелÑ"}
49),i.tickets&&(i.tickets.total>0?e.jsxs("div",{className:"dim",style:{fontSize:12.5,display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("span",{children:["ÐбÑаÑений: ",e.jsx("b",{style:{color:"var(--text)"},children:i.tickets.total})]}),i.tickets.open>0&&e.jsxs("span",{style:{color:"var(--amber, #f5a623)",fontWeight:600},children:["â в ÑабоÑе: ",i.tickets.open]}),i.tickets.closed>0&&e.jsxs("span",{children:["закÑÑÑÑÑ
: ",i.tickets.closed]}),i.tickets.lastId&&e.jsx("button",{className:"linkbtn",style:{fontWeight:600},onClick:()=>{const j=i.tickets.lastId;n(),location.hash=`tickets/${j}`},children:"оÑкÑÑÑÑ â"})]}):e.jsx("div",{className:"dim",style:{fontSize:12.5},children:"ÐбÑаÑений еÑÑ Ð½Ðµ бÑло."})),e.jsx("input",{className:"mu__input",placeholder:"Ñема (необÑзаÑелÑно)",value:le,onChange:j=>ee(j.target.value)}),e.jsx("textarea",{className:"mu__input mu__area",rows:3,placeholder:"ÑекÑÑ Ð¾Ð±ÑаÑениÑ",value:be,onChange:j=>w(j.target.value)}),e.jsx("button",{className:"btn btn--ghost btn--xs",disabled:!be.trim()||u==="tk",onClick:p,children:u==="tk"?"ÑоздаÑâ¦":"СоздаÑÑ Ð¾Ð±ÑаÑение"})]}),me!=null&&me.plan?e.jsxs("div",{className:"mu__grant",children:[e.jsxs("div",{className:"mu__mode",children:[e.jsx("button",{type:"button",className:"mu__mode-b"+(ce==="add"?" is-on":""),onClick:()=>Be("add"),children:"+ ÐобавиÑÑ"}),e.jsx("button",{type:"button",className:"mu__mode-b mu__mode-b--sub"+(ce==="sub"?" is-on":""),onClick:()=>Be("sub"),children:"â УбÑаÑÑ"})]}),e.jsxs("div",{className:"mu__grant-ctl",children:[e.jsx("span",{className:"mu__ico",title:(ce==="add"?"ÐÑодлиÑÑ":"СокÑаÑиÑÑ")+" · "+me.plan,children:e.jsx($n,{size:17,strokeWidth:1.9})}),e.jsx("input",{className:"mu__num",type:"number",min:"1",inputMode:"numeric",placeholder:"ÑÑок",value:d,onChange:j=>b(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(ce==="add"?c:te)()}}),e.jsxs("select",{value:F,onChange:j=>Z(j.target.value),children:[e.jsx("option",{value:"days",children:"дней"}),e.jsx("option",{value:"months",children:"меÑÑÑев"})]}),e.jsx("span",{className:"mu__grant-sep"}),e.jsx("span",{className:"mu__ico",title:"УÑÑÑойÑÑва",children:e.jsx(rs,{size:17,strokeWidth:1.9})}),e.jsx("input",{className:"mu__num",type:"number",min:"1",inputMode:"numeric",placeholder:(ce==="add"?"+":"â")+" ÑÑÑÑ.",value:Ae,onChange:j=>Ce(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(ce==="add"?c:te)()}}),e.jsx("button",{className:"btn mu__grant-apply"+(ce==="sub"?" mu__grant-apply--sub":""),disabled:!!u||!d.trim()&&!Ae.trim(),onClick:ce==="add"?c:te,children:u==="grant"?ce==="add"?"добавлÑÑâ¦":"ÑбиÑаÑâ¦":ce==="add"?"ÐобавиÑÑ":"УбÑаÑÑ"})]}),e.jsxs("p",{className:"mu__grant-hint dim",children:[`УÑÑÑойÑÑв ÑейÑаÑ: ${je()}`,me.extraDevices?` (докÑплено ${me.extraDevices})`:" â вÑе по ÑаÑиÑÑ, докÑпленнÑÑ
неÑ",ce==="add"?". СÑок пÑибавиÑÑÑ Ðº ÑекÑÑемÑ.":". СÑок ÑежеÑÑÑ Ñ ÐºÐ¾Ð½Ñа, акÑивнÑй пеÑиод не гаÑим."]}),e.jsxs("div",{className:"mu__grant-ctl",style:{marginTop:8},children:[e.jsx("span",{className:"mu__ico",title:"ТаÑиÑ",children:e.jsx(Ws,{size:17,strokeWidth:1.9})}),e.jsxs("select",{value:R||me.plan||"start",onChange:j=>ze(j.target.value),children:[e.jsx("option",{value:"start",children:"start"}),e.jsx("option",{value:"pro",children:"pro"}),e.jsx("option",{value:"plus",children:"plus"})]}),e.jsx("button",{className:"btn btn--ghost mu__grant-apply",disabled:!!u||!R||R===me.plan,onClick:ve,children:u==="plan"?"менÑÑâ¦":"СмениÑÑ ÑаÑиÑ"})]}),e.jsxs("label",{className:"mu__grant-hint dim",style:{display:"flex",alignItems:"flex-start",gap:7,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:ke,onChange:j=>Le(j.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:["ÐеÑеÑÑиÑаÑÑ Ð¾ÑÑаÑок пеÑиода ",e.jsx("b",{children:"ÑÑоком"}),": неизÑаÑÑ
Ð¾Ð´Ð¾Ð²Ð°Ð½Ð½Ð°Ñ ÑÑоимоÑÑÑ Ð´ÐµÐ»Ð¸ÑÑÑ Ð½Ð° дневнÑÑ ÑÐµÐ½Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ ÑаÑиÑа. ÐеÑевле ÑаÑÐ¸Ñ â дней ÑÑÐ°Ð½ÐµÑ Ð±Ð¾Ð»ÑÑе, доÑоже â менÑÑе. ÐенÑги не возвÑаÑаÑÑÑÑ Ð¸ не ÑпиÑÑваÑÑÑÑ Ð² лÑбом ÑлÑÑае."]})]}),e.jsx("p",{className:"mu__grant-hint dim",children:"Ðез галоÑки ÑÑок оÑÑаÑÑÑÑ Ð¿Ñежним. ÐÑегда пеÑеÑÑиÑÑваÑÑÑÑ ÑÑÑÑойÑÑва и ÑÑмма ÑледÑÑÑего авÑоÑпиÑаниÑ; докÑпленнÑе ÑлоÑÑ Ð¿ÐµÑеноÑÑÑÑÑ, еÑли влезаÑÑ Ð² новÑй ÑаÑиÑ."}),ce==="sub"&&e.jsx("button",{className:"btn btn--danger btn--xs mu__cancel",disabled:!!u,onClick:Se,children:u==="revoke"?"оÑменÑÑâ¦":"ÐÑмениÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ Ñеликом"})]}):e.jsx("div",{className:"mu__grant",children:e.jsxs("div",{className:"mu__grant-row",children:[e.jsx(Ge,{icon:Ws,children:"ÐÑдаÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ"}),e.jsxs("div",{className:"mu__grant-ctl",children:[e.jsxs("select",{value:xe,onChange:j=>ue(j.target.value),children:[e.jsx("option",{value:"start",children:"start"}),e.jsx("option",{value:"pro",children:"pro"}),e.jsx("option",{value:"plus",children:"plus"})]}),e.jsx("input",{className:"mu__num",type:"number",min:"1",inputMode:"numeric",placeholder:"ÑÑок",value:d,onChange:j=>b(j.target.value)}),e.jsxs("select",{value:F,onChange:j=>Z(j.target.value),children:[e.jsx("option",{value:"days",children:"дней"}),e.jsx("option",{value:"months",children:"меÑÑÑев"})]}),e.jsx("input",{className:"mu__num",type:"number",min:"1",inputMode:"numeric",placeholder:"ÑÑÑÑойÑÑв",value:Ne,onChange:j=>fe(j.target.value)}),e.jsx("button",{className:"btn btn--ghost btn--xs mu__grant-go",disabled:!!u||!d.trim(),onClick:re,children:u==="grant"?"вÑдаÑâ¦":"ÐÑдаÑÑ"})]})]})}),Ee&&e.jsxs("div",{className:"mu__pw",children:[e.jsx("span",{className:"dim",children:"ÐовÑй паÑолÑ"}),e.jsx("code",{className:"mu__code",children:Ee}),e.jsxs("button",{className:"btn btn--ghost btn--xs",onClick:()=>{var j;(j=navigator.clipboard)==null||j.writeText(Ee).catch(()=>{})},children:[e.jsx(Ts,{size:14,strokeWidth:1.9})," копиÑоваÑÑ"]})]}),e.jsxs("div",{className:"mu__actions",children:[!!i.user.genPass&&e.jsxs("button",{className:"btn btn--ghost btn--xs",disabled:!!u,onClick:tt,title:"ÐаÑолÑ, вÑданнÑй нами (показ пиÑеÑÑÑ Ð² жÑÑнал)",children:[e.jsx(Wt,{size:14,strokeWidth:1.9})," ",u==="revpw"?"показÑваÑâ¦":"ÐоказаÑÑ Ð¿Ð°ÑолÑ"]}),i.user.hasPassword?e.jsxs("button",{className:"btn btn--ghost btn--xs",disabled:!!u,onClick:Gt,children:[e.jsx(Wt,{size:14,strokeWidth:1.9})," ",u==="pw"?"ÑбиÑаÑâ¦":"УбÑаÑÑ Ð¿Ð°ÑолÑ"]}):e.jsxs("button",{className:"btn btn--ghost btn--xs",disabled:!!u,onClick:St,children:[e.jsx(Wt,{size:14,strokeWidth:1.9})," ",u==="setpw"?"генеÑиÑÑÑâ¦":"СгенеÑиÑоваÑÑ Ð¿Ð°ÑолÑ"]}),!!i.user.twoFactor&&e.jsxs("button",{className:"btn btn--danger btn--xs",disabled:!!u,onClick:Je,title:"ÐÐ»Ð¸ÐµÐ½Ñ Ð¿Ð¾ÑеÑÑл пÑиложение-аÑÑенÑиÑикаÑÐ¾Ñ Ð¸ ÑезеÑвнÑе ÐºÐ¾Ð´Ñ (пиÑеÑÑÑ Ð² жÑÑнал)",children:[e.jsx(Rn,{size:14,strokeWidth:1.9})," ",u==="2fa"?"ÑнимаÑâ¦":"СнÑÑÑ 2FA"]}),e.jsxs("button",{className:"btn btn--ghost btn--xs",disabled:!!u||!i.devices.length,onClick:Ve,title:"ÐÑвÑзаÑÑ Ð²Ñе ÑÑÑÑойÑÑва",children:[e.jsx(Wn,{size:14,strokeWidth:1.9})," ",u==="dev"?"оÑвÑзÑваÑâ¦":`ÐÑвÑзаÑÑ${i.devices.length?` (${i.devices.length})`:""}`]}),e.jsxs("button",{className:"btn btn--ghost btn--xs",disabled:!!u,onClick:Xt,title:"ÐойÑи под полÑзоваÑелем",children:[e.jsx(rn,{size:14,strokeWidth:1.9})," ",u==="imp"?"оÑкÑÑваÑâ¦":"ÐойÑи"]})]}),!!i.devices.length&&e.jsx("div",{className:"mu__devs",children:i.devices.map((j,J)=>e.jsxs("div",{className:"mu__dev",children:[e.jsx(ti,{os:(j.platform||"").toLowerCase(),size:15}),e.jsx("b",{children:si(j.deviceModel)||j.platform||"ÑÑÑÑойÑÑво"}),e.jsxs("span",{className:"dim",children:[j.platform||"",j.updatedAt?` · ${new Date(j.updatedAt).toLocaleDateString("ru-RU")}`:""]}),j.hwid&&e.jsx("button",{className:"btn btn--ghost btn--xs mu__dev-x",title:"ÐÑвÑзаÑÑ ÑÑо ÑÑÑÑойÑÑво",disabled:!!u,onClick:()=>wt(j.hwid),children:u==="dev1:"+j.hwid?"â¦":e.jsx(Rs,{size:14,strokeWidth:2})})]},j.hwid||J))}),!!l&&!!l.list.length&&e.jsxs(e.Fragment,{children:[e.jsxs(Ge,{icon:an,children:["ÐлаÑежи · ",l.list.length," · вÑего ",Es(l.ltvCents,l.currency)]}),e.jsx("div",{className:"mu__pays",children:(M?l.list:l.list.slice(0,6)).map(j=>e.jsxs("div",{className:"mu__pay"+(j.status==="succeeded"?"":" mu__pay--off"),children:[e.jsx("span",{className:"dim mu__pay-d",children:new Date(j.createdAt).toLocaleDateString("ru-RU")}),e.jsx("b",{className:"mu__pay-s",children:Es(j.amountCents||0,j.currency||l.currency)}),e.jsx("span",{className:"mu__pay-k",children:gi[String(j.kind)]||j.kind||"â"}),e.jsx("span",{className:"dim mu__pay-p",children:j.provider||""}),j.status!=="succeeded"&&e.jsx("span",{className:"mu__pay-st",children:fi[String(j.status)]||j.status})]},j.id))}),l.list.length>6&&e.jsx("button",{className:"btn btn--ghost btn--xs",onClick:()=>f(!M),children:M?"ÑвеÑнÑÑÑ":`показаÑÑ Ð²Ñе (${l.list.length})`})]})]})]})})}const Fs=5,Us=5*1024*1024;function yi(s,t){const m=[];for(const i of Array.from(s||[]))if(i.kind==="file"&&i.type.startsWith("image/")){const C=i.getAsFile();C&&m.push(C)}m.length||m.push(...Array.from(t||[]).filter(i=>i.type.startsWith("image/")));const n=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-"),x=Math.random().toString(36).slice(2,6);return m.map((i,C)=>i.name&&i.name!=="image.png"?i:new File([i],`screenshot-${n}-${x}${C?"-"+(C+1):""}.${(i.type.split("/")[1]||"png").replace("jpeg","jpg")}`,{type:i.type}))}function Jt(s,t,m,n){if(!s.length)return!1;const x=s.filter(g=>g.size>Us),i=s.filter(g=>g.size<=Us),C=Math.max(0,Fs-t.length),u=i.length-Math.min(C,i.length),k=[u?`болÑÑе ${Fs} каÑÑинок в одно пиÑÑмо не Ð²Ð»ÐµÐ·ÐµÑ â не взÑÑо ${u}`:"",x.length?`не взÑÑо ${x.length}
49: ÑÑжелее 5 ÐÐ`:""].filter(Boolean);return m([...t,...i.slice(0,C)]),k.length&&n(k.join("; ")),!0}const Qt=s=>s.replace(/</g,"<").replace(/>/g,">"),bi=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),vi=s=>{const t=s.trim();return/^(https?:\/\/|tg:\/\/|mailto:)/i.test(t)&&!/[\s"'<>`]/.test(t)?t:null},Si={b:null,strong:null,i:null,em:null,u:null,ins:null,s:null,strike:null,del:null,code:(s,t)=>s==="class"&&/^language-[\w+-]{1,32}$/.test(t)?t:null,pre:null,blockquote:s=>s==="expandable"?"":null,"tg-spoiler":null,span:(s,t)=>s==="class"&&t==="tg-spoiler"?t:null,a:(s,t)=>s==="href"?vi(t):null,"tg-emoji":(s,t)=>s==="emoji-id"&&/^\d{1,32}$/.test(t)?t:null},wi=new Set(["br","hr","img"]),Ni={a:"href",img:"src"},ki=/<(\/?)([a-zA-Z][\w-]*)((?:\s+[^\s=>\/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g,Ci=/([^\s=>\/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;function zi(s,t){const m=String(s??""),n=[];let x=0;for(const i of m.matchAll(ki)){n.push(Qt(m.slice(x,i.index))),x=(i.index??0)+i[0].length;const C=i[1]==="/",u=i[2].toLowerCase();if(!(u in t)){n.push(Qt(i[0]));continue}if(C){wi.has(u)||n.push(`</${u}>`);continue}const k=t[u],g=[];if(!k&&i[3].trim(),k)for(const E of i[3].matchAll(Ci)){const X=E[1].toLowerCase(),D=E[2]??E[3]??E[4]??"",W=k(X,D);W!==null&&g.push(W===""&&X==="expandable"?" expandable":` ${X}="${bi(W)}"`)}const I=Ni[u];I&&!g.some(E=>E.startsWith(` ${I}=`))||n.push(`<${u}${g.join("")}>`)}return n.push(Qt(m.slice(x))),n.join("")}const _i=s=>zi(s,Si),Ps=ui({id:Xe.id,name:Xe.wordmark.join(" ").trim(),registrable:Xe.registrable}),yn=s=>"$"+((s||0)/100).toFixed(2),De=(s,t)=>{const m=s||0;return(t||"USD").toUpperCase()==="RUB"?(m/100).toLocaleString("ru-RU",{maximumFractionDigits:0})+" â½":(t||"USD").toUpperCase()==="USD"?yn(m):(m/100).toFixed(2)+" "+(t||"").toUpperCase()},as=s=>["nx",s.code,s.email,s.contact,s.n!=null?String(s.n):null].filter(Boolean).join(" · "),Me=(s,t=!1)=>new Date(s).toLocaleString("ru-RU",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",...t?{timeZone:"UTC"}:{}});function Ke({label:s,value:t,tone:m}){return e.jsxs("div",{className:"card pad",style:{padding:"16px 18px",minWidth:0},children:[e.jsx("div",{style:{fontFamily:"Space Grotesk",fontSize:30,lineHeight:1.15,color:m||"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),e.jsx("div",{className:"dim",style:{fontSize:13,lineHeight:1.35,marginTop:6},children:s})]})}const We={fontFamily:"inherit",fontSize:14,color:"var(--text)",background:"var(--surface-2)",border:"1px solid var(--border-strong)",borderRadius:10,padding:"9px 12px",outline:"none"},Ti={initial:"пеÑÐ²Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа",renewal:"пÑодление",refund:"возвÑаÑ",trial:"пÑобнÑй пеÑиод",extra_devices:"ÑÑÑÑойÑÑва",upgrade:"апгÑейд"},$i={succeeded:"оплаÑен",pending:"в обÑабоÑке",failed:"не пÑоÑÑл",refunded:"возвÑаÑÑн",canceled:"оÑменÑн",created:"Ñоздан",expired:"иÑÑÑк"},Ri=new Set(["10602","20602"]),Wi=s=>{try{return Ri.has(String(JSON.parse(s||"{}").code||""))}catch{return!1}},ls=s=>Ti[String(s||"")]||s||"â",Ai={active:"акÑивна",expired:"иÑÑекла",cancelled:"оÑменена",canceled:"оÑменена",refunded:"возвÑаÑ",pending:"ожидаеÑ",suspended:"заблокиÑована"},Ii={open:"оÑкÑÑÑ",pending:"в ÑабоÑе",closed:"закÑÑÑ",answered:"оÑвеÑен"},Di={active:"акÑивен",pending:"на модеÑаÑии",suspended:"заблокиÑован"},Zt=s=>Ai[String(s||"")]||s||"â",Bi=s=>Ii[String(s||"")]||s||"â",Ms=s=>s==="reg"?"ÑегиÑÑÑаÑиÑ":s==="dep"?"пеÑÐ²Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа":s==="sale"?"ÑевÑаÑа":s,es=s=>Di[String(s||"")]||s||"â",Li={held:"Ñ
олд",approved:"к вÑплаÑе",paid:"вÑплаÑено",void:"аннÑлиÑована"},Ei={sale:"пеÑÐ²Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа",rebill:"пÑодление",upsell:"ÑÑÑÑойÑÑва",legacy:"пеÑÐµÐ½Ð¾Ñ Ð´Ð¾Ð»Ð³Ð°"},Os=s=>Ei[String(s||"")]||s||"â",qs=s=>Li[String(s||"")]||s||"â",Ze=s=>$i[String(s||"")]||s||"â",Fi=[{re:/nonce already exist/i,text:"ÐÐ¾Ð»Ð»Ð¸Ð·Ð¸Ñ nonce Ñ Ð¿ÑоÑеÑÑинга â ÑеÑ
ниÑеÑÐºÐ°Ñ Ð¾Ñибка на наÑей ÑÑоÑоне, денÑги клиенÑа ни пÑи ÑÑм",ours:!0},{re:/no_token/i,text:"ÐÐµÑ ÑоÑ
ÑанÑнного плаÑÑжного Ñокена â ÑпиÑÑваÑÑ Ð½ÐµÑем",ours:!0},{re:/timeout|timed out/i,text:"ТаймаÑÑ Ð¿ÑоÑеÑÑинга",ours:!0},{re:/insufficient|not enough|недоÑÑаÑоÑно/i,text:"ÐедоÑÑаÑоÑно ÑÑедÑÑв Ñ ÐºÐ»Ð¸ÐµÐ½Ñа",ours:!1},{re:/rejected|declined|оÑклон/i,text:"ÐÑоÑеÑÑинг оÑклонил ÑпиÑание (банк или клиенÑ)",ours:!1},{re:/^KG-[A-Z]+-\d+$/i,text:"ÐÑоÑеÑÑинг веÑнÑл Ñвой код оÑибки â ÑаÑÑиÑÑовка на ÑÑоÑоне FreeKassa",ours:!1},{re:/\b(20201|10204|10206)\b/,text:"Ðанк огÑаниÑил опеÑаÑии по ÑÑÑÑÑ ÐºÐ»Ð¸ÐµÐ½Ñа â повÑоÑÑ Ð±ÐµÑÑмÑÑленнÑ, нÑжен дÑÑгой ÑпоÑоб оплаÑÑ",ours:!1},{re:/\b10110\b/,text:"ÐÐ»Ð¸ÐµÐ½Ñ Ð¾Ñменил авÑоплаÑÑж в ÑвоÑм банке â пÑивÑзка меÑÑва, нÑжна Ð½Ð¾Ð²Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа",ours:!1},{re:/\b(10105|20105|10112)\b/,text:"ÐедоÑÑаÑоÑно ÑÑедÑÑв Ñ ÐºÐ»Ð¸ÐµÐ½Ñа â повÑоÑим по ÑаÑпиÑаниÑ",ours:!1},{re:/\b10113\b/,text:"ÐедоÑÑаÑоÑно ÑÑедÑÑв, ÑмиÑÐµÐ½Ñ Ð·Ð°Ð¿ÑеÑил повÑоÑÑ",ours:!1},{re:/\b(10602|20602)\b/,text:"СÑÑÑ Ð¸ÑÑÑк неоплаÑеннÑм (СÐРживÑÑ ÑаÑ) â Ñеловек не оÑÑканиÑовал QR",ours:!1},{re:/\b(10201|10203|10812|10106|3021|3029)\b/,text:"ÐаÑÑа негодна (пÑоÑÑоÑена, ÑкомпÑомеÑиÑована или заблокиÑована) â нÑжна дÑÑгаÑ",ours:!1},{re:/\b(10402|10403|10404|10405|10807|20402)\b/,text:"ÐÑказ ÑиÑк-ÑиÑÑемÑ/анÑиÑÑода â повÑоÑÑÑÑ Ð½ÐµÐ»ÑзÑ",ours:!1},{re:/\b(3184|3301)\b/,text:"СеÑÐ¸Ñ Ð°Ð²ÑоплаÑежей оÑменена или иÑÑекла на ÑÑоÑоне пÑоÑеÑÑинга",ours:!1},{re:/\b(3027|10102|10103|10502|20502|1070\d)\b/,text:"ÐÑибка в ÐÐШÐРзапÑоÑе к пÑоÑеÑÑÐ¸Ð½Ð³Ñ â ÐºÐ»Ð¸ÐµÐ½Ñ Ð½Ð¸ пÑи ÑÑм, ÑиниÑÑ Ð½Ð°Ð¼",ours:!0},{re:/\b(10202|10505|20202|20601|10601)\b/,text:"Ðанк или плаÑÑÐ¶Ð½Ð°Ñ ÑиÑÑема вÑеменно недоÑÑÑÐ¿Ð½Ñ â повÑоÑим",ours:!1},{re:/\b(20000|10000|10100|20100)\b/,text:"ÐбÑий оÑказ без ÑаÑÑиÑÑовки: пÑоÑеÑÑинг пÑиÑÑÐ»Ð°ÐµÑ Ñакой код по ÑмолÑаниÑ, ÑоÑнÑÑ Ð¿ÑиÑÐ¸Ð½Ñ Ð·Ð½Ð°ÐµÑ ÑолÑко иÑ
поддеÑжка",ours:!1}];function os(s){let t="",m="";try{const i=JSON.parse(s||"{}");t=String(i.reason||""),m=String(i.bucket||"")}catch{t=String(s||"")}const n=Fi.find(i=>i.re.test(t)),x=m==="ours"||(n?n.ours:!1);return{text:n?n.text:t||"пÑиÑина не ÑоÑ
Ñанена",ours:x,raw:t}}function Bt(s){const t=String(s||"").split(`
50`).filter(Boolean).pop();if(!t)return"";try{return JSON.parse(t.slice(t.indexOf("~")+1)||"{}").reason||""}catch{return""}}function ts(s){return s?String(s).split(` 51`).filter(Boolean).map(t=>{const m=t.indexOf("~");return{at:Number(t.slice(0,m))||0,reason:os(t.slice(m+1))}}).sort((t,m)=>m.at-t.at):[]}function vt({onClick:s,label:t}){const[m,n]=r.useState(!1),x=async()=>{if(!m){n(!0);try{await s()}finally{n(!1)}}};return e.jsx("button",{className:"btn btn--ghost btn--xs btn--pill",onClick:x,disabled:m,title:"ÐбновиÑÑ Ð´Ð°Ð½Ð½Ñе",children:m?"обновлÑÑâ¦":t||"⻠обновиÑÑ"})}function Ui(s){if(!s)return{color:"var(--dim)",hint:""};const t=s-Date.now(),m=864e5;return t<=0?{color:"var(--dim)",hint:"иÑÑекла"}:t<m?{color:"var(--coral)",hint:"менÑÑе ÑÑÑок"}:t<7*m?{color:"var(--amber)",hint:`оÑÑалоÑÑ ${Math.ceil(t/m)} дн`}:{color:"var(--green)",hint:`оÑÑалоÑÑ ${Math.ceil(t/m)} дн`}}function ds(s){return s.status==="closed"?{text:"закÑÑÑ",mine:!1,done:!0}:s.lastActor==="user"?{text:"Ð½Ð°Ñ Ñ Ð¾Ð´",mine:!0,done:!1}:s.lastActor==="ai"?{text:"оÑвеÑил боÑ",mine:!1,done:!1}:{text:"ждÑм клиенÑа",mine:!1,done:!1}}const Hs=s=>{const t=ds(s),m=t.done?"var(--muted)":t.mine?"var(--coral)":"var(--green)",n=t.done?"rgba(148,163,184,0.12)":t.mine?"rgba(255,122,92,0.14)":"rgba(52,211,153,0.10)";return e.jsx("span",{title:`ÑÑаÑÑÑ: ${Bi(s.status)}`,style:{fontSize:12,fontWeight:700,padding:"3px 10px",borderRadius:999,color:m,background:n,whiteSpace:"nowrap"},children:t.text})},Pi={active:{icon:qt,color:"var(--green)"},expired:{icon:Ut,color:"var(--coral)"},cancelled:{icon:Pt,color:"var(--coral)"},canceled:{icon:Pt,color:"var(--coral)"},refunded:{icon:ps,color:"var(--amber)"},pending:{icon:mn,color:"var(--amber)"},suspended:{icon:Ot,color:"var(--coral)"}},Mi=s=>{const t=String(s||""),m=Pi[t];if(!m)return e.jsx("span",{className:"dim",title:Zt(t),children:"â"});const n=m.icon;return e.jsx("span",{title:Zt(t),"aria-label":Zt(t),style:{color:m.color,display:"inline-flex"},children:e.jsx(n,{size:16,strokeWidth:2.2})})},bn={start:{icon:Jn,color:"var(--cyan)",bg:"rgba(34,211,238,0.12)"},plus:{icon:Yn,color:"var(--violet-2)",bg:"rgba(124,92,255,0.14)"},pro:{icon:nn,color:"var(--amber)",bg:"rgba(245,183,74,0.14)"}},Oi=s=>{const t=bn[String(s||"")];if(!t)return null;const m=t.icon;return e.jsx("span",{style:{color:t.color,display:"inline-flex"},children:e.jsx(m,{size:15,strokeWidth:2.2})})},vn=s=>{const t=String(s||"");if(!t)return e.jsx("span",{className:"dim",children:"â"});const m=bn[t],n=m==null?void 0:m.icon;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:12,fontWeight:700,padding:"3px 9px",borderRadius:999,whiteSpace:"nowrap",color:(m==null?void 0:m.color)||"var(--text-2)",background:(m==null?void 0:m.bg)||"rgba(255,255,255,0.06)"},children:[n?e.jsx(n,{size:13,strokeWidth:2.2}):null,t]})},qi={initial:{icon:ln,short:"пеÑваÑ"},renewal:{icon:Mt,short:"пÑодление"},refund:{icon:ps,short:"возвÑаÑ"},extra_devices:{icon:rs,short:"ÑÑÑÑойÑÑва"},upgrade:{icon:Zn,short:"апгÑейд"},trial:{icon:Qn,short:"ÑÑиал"}},Hi=s=>{const t=String(s||""),m=qi[t];if(!m)return e.jsx("span",{className:"dim",children:ls(t)});const n=m.icon;return e.jsxs("span",{title:ls(t),style:{display:"inline-flex",alignItems:"center",gap:5,whiteSpace:"nowrap"},children:[e.jsx(n,{size:13,strokeWidth:2,style:{flex:"none",opacity:.8}}),m.short]})},Vi={active:{icon:qt,color:"var(--green)"},pending:{icon:Ut,color:"var(--amber)"},suspended:{icon:Ot,color:"var(--coral)"}},Gi=s=>{const t=String(s||""),m=Vi[t];if(!m)return e.jsx("span",{className:"dim",title:es(t),children:"â"});const n=m.icon;return e.jsx("span",{title:es(t),"aria-label":es(t),style:{color:m.color,display:"inline-flex"},children:e.jsx(n,{size:16,strokeWidth:2.2})})},Vs=(s,t,m)=>e.jsx("span",{style:{fontSize:12,fontWeight:700,padding:"3px 10px",borderRadius:999,color:s?"var(--green)":"var(--coral)",background:s?"rgba(52,211,153,0.12)":"rgba(255,122,92,0.12)"},children:s?t:m}),Ki=[["overview","ÐбзоÑ","analytics"],["analytics","ÐналиÑика","analytics"],["users","ÐолÑзоваÑели","users.read"],["payments","ÐлаÑежи","payments.read"],["tickets","ТикеÑÑ","tickets"],["mail","ÐоÑÑа","mail"],["partners","ÐаÑÑнÑÑÑ","partners"],["servers","СеÑвеÑÑ","nodes"],["processors","ÐÑоÑеÑÑинги","processors"],["tariff","ТаÑиÑÑ","tariff"],["msgcopy","СообÑениÑ","broadcast"],["staff","СоÑÑÑдники","roles"],["help","СпÑавка","help"],["postbacks","ÐоÑÑбеки","analytics"]],ss=s=>{const t=(typeof location<"u"?location.hash:"").replace(/^#/,"").split("/")[0];return s.includes(t)?t:s[0]||"tickets"},Xi=[["auto","Ðак в ÑиÑÑеме"],["light","СвеÑлаÑ"],["dark","ТÑмнаÑ"]],Yi=[["steel","СÑалÑ"],["graphite","ÐÑаÑиÑ"],["indigo","Ðндиго"],["teal","ХвоÑ"]],Gs="adm_theme",Ks="adm_skin";function Xs(){const[s,t]=r.useState(()=>{try{return localStorage.getItem(Gs)||"auto"}catch{return"auto"}}),[m,n]=r.useState(()=>{try{return localStorage.getItem(Ks)||"steel"}catch{return"steel"}});return r.useEffect(()=>{const x=document.documentElement,i=window.matchMedia("(prefers-color-scheme: light)"),C=()=>{s==="light"||s==="auto"&&i.matches?x.setAttribute("data-adm-theme","light"):x.removeAttribute("data-adm-theme")};C(),s==="auto"&&i.addEventListener("change",C);try{localStorage.setItem(Gs,s)}catch{}return()=>{i.removeEventListener("change",C),x.removeAttribute("data-adm-theme")}},[s]),r.useEffect(()=>{const x=document.documentElement;m==="steel"?x.removeAttribute("data-adm-skin"):x.setAttribute("data-adm-skin",m);try{localStorage.setItem(Ks,m)}catch{}return()=>{x.removeAttribute("data-adm-skin")}},[m]),e.jsx("select",{className:"atabs__skin",value:`${s}|${m}
51`,"aria-label":"ÐнеÑний вид админки",onChange:x=>{const[i,C]=x.target.value.split("|");t(i),n(C)},children:Xi.map(([x,i])=>e.jsx("optgroup",{label:i,children:Yi.map(([C,u])=>e.jsxs("option",{value:`${x}|${C}`,children:[i," · ",u]},C))},x))})}function Ji(){return r.useEffect(()=>{var n;const s=navigator.userAgent;return/Chrome\/\d/.test(s)&&!/Edge\//.test(s)&&((n=CSS==null?void 0:CSS.supports)==null?void 0:n.call(CSS,"backdrop-filter","url(#adm-lens) blur(1px)"))&&document.documentElement.setAttribute("data-glass","lens"),()=>{document.documentElement.removeAttribute("data-glass")}},[]),e.jsx("svg",{width:"0",height:"0",style:{position:"absolute"},"aria-hidden":!0,children:e.jsxs("filter",{id:"adm-lens",x:"0",y:"0",width:"100%",height:"100%",children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.008 0.014",numOctaves:2,seed:7,result:"noise"}),e.jsx("feGaussianBlur",{in:"noise",stdDeviation:"3",result:"soft"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"soft",scale:14,xChannelSelector:"R",yChannelSelector:"G"})]})})}function Qi(){const s=r.useRef(null);return r.useEffect(()=>{const t=s.current;if(!t||typeof MutationObserver>"u")return;let m=!1;const n=()=>{m=!1;for(const i of Array.from(t.querySelectorAll("table"))){const C=Array.from(i.querySelectorAll("thead th")).map(u=>(u.textContent||"").replace(/[â¼â²ââââ]/g,"").trim());if(C.length)for(const u of Array.from(i.querySelectorAll("tbody tr"))){let k=0;for(const g of Array.from(u.cells)){const I=Math.max(1,g.colSpan||1),E=I>1?"":C[k]??"";g.getAttribute("data-l")!==E&&g.setAttribute("data-l",E),k+=I}}}},x=new MutationObserver(i=>{i.some(u=>{const k=u.target instanceof Element?u.target:null;return k!=null&&k.closest("table")?!0:Array.from(u.addedNodes).some(g=>{var I;return g instanceof Element&&(g.matches("table, tbody, tr, td")||!!((I=g.querySelector)!=null&&I.call(g,"table")))})})&&!m&&(m=!0,requestAnimationFrame(n))});return n(),x.observe(t,{childList:!0,subtree:!0,attributeFilter:["colspan"]}),()=>x.disconnect()},[]),s}function Dr(){const s=Qi(),[t,m]=r.useState(()=>{try{return localStorage.getItem("adm_tbl")==="wide"?"wide":"cards"}catch{return"cards"}}),n=()=>m(D=>{const W=D==="cards"?"wide":"cards";try{localStorage.setItem("adm_tbl",W)}catch{}return W}),{user:x,loading:i,api:C}=ni(),u=(x==null?void 0:x.adminCaps)||[],k=r.useMemo(()=>Ki.filter(([,,D])=>u.includes(D)),[u.join(",")]),g=r.useMemo(()=>k.map(([D])=>D),[k]),[I,E]=r.useState(()=>ss(g)),X=D=>{E(D);try{history.replaceState(null,"","#"+D)}catch{}};return r.useEffect(()=>{const D=()=>E(ss(g));return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[g.join(",")]),r.useEffect(()=>{g.length&&E(ss(g))},[g.join(",")]),i?e.jsx("div",{className:"dim",style:{padding:40},children:"ÐагÑÑзкаâ¦"}):x!=null&&x.isAdmin?e.jsxs("div",{className:"adm",ref:s,"data-tbl":t,style:{maxWidth:1240,margin:"0 auto",padding:"24px 20px 60px"},children:[e.jsx(Ji,{}),(()=>{const D=Math.ceil(k.length/2),W=k.length>6?[k.slice(0,D),k.slice(D)]:[k],o=Ds[I];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"atabs atabs--wide",children:W.map((N,v)=>e.jsxs("div",{className:"atabs__row",children:[N.map(([_,B])=>{const Q=Ds[_],A=I===_;return e.jsxs("button",{onClick:()=>X(_),title:B,className:"atabs__b"+(A?" atabs__b--on":""),children:[e.jsx("span",{className:"atabs__i",children:Q?e.jsx(Q,{size:15,strokeWidth:2}):null}),B]},_)}),v===W.length-1&&e.jsxs(e.Fragment,{children:[e.jsx(Xs,{}),e.jsx("a",{href:"/",className:"dim atabs__back",children:"â в кабинеÑ"})]})]},v))}),e.jsxs("div",{className:"atabs atabs--narrow",children:[e.jsx("span",{className:"atabs__cur",children:o?e.jsx(o,{size:17,strokeWidth:2}):null}),e.jsx("select",{className:"atabs__sel",value:I,onChange:N=>X(N.target.value),"aria-label":"Раздел админки",children:k.map(([N,v])=>e.jsx("option",{value:N,children:v},N))}),e.jsx(Xs,{}),e.jsx("button",{className:`toggle-pill tblswitch${t==="wide"?" is-on":""}`,onClick:n,title:t==="cards"?"ÐоказаÑÑ ÑаблиÑей â колонки как на компÑÑÑеÑе":"ÐоказаÑÑ ÐºÐ°ÑÑоÑками â по ÑÑÑоке на ÑкÑан",children:t==="cards"?"ÐаÑÑоÑки":"ТаблиÑа"}),e.jsx("a",{href:"/",className:"dim atabs__back",children:"â в кабинеÑ"})]})]})})(),I==="overview"&&e.jsx(sr,{api:C}),I==="analytics"&&e.jsx(nr,{api:C}),I==="users"&&e.jsx(ir,{api:C}),I==="payments"&&e.jsx(or,{api:C}),I==="tickets"&&e.jsx(dr,{api:C}),I==="mail"&&e.jsx(Wr,{api:C}),I==="partners"&&e.jsx(mr,{api:C}),I==="postbacks"&&e.jsx(gr,{api:C}),I==="servers"&&e.jsx(fr,{api:C}),I==="processors"&&e.jsx(Sr,{api:C}),I==="tariff"&&e.jsx(br,{api:C}),I==="msgcopy"&&e.jsx(kr,{api:C}),I==="staff"&&e.jsx(tr,{api:C,me:(x==null?void 0:x.email)||""}),I==="help"&&e.jsx(er,{caps:u,role:(x==null?void 0:x.adminRole)||"owner"})]}):e.jsx("div",{className:"card pad",style:{margin:40},children:e.jsx("p",{className:"lead",children:"ÐÐµÑ Ð´Ð¾ÑÑÑпа."})})}const qe={owner:{label:"ÐладелеÑ",hint:"вÑÑ, вклÑÑÐ°Ñ Ð²Ð¾Ð·Ð²ÑаÑÑ, клÑÑи пÑоÑеÑÑингов, ÑеÑвеÑÑ Ð¸ ÑаздаÑÑ Ñолей",tone:"var(--amber)"},manager:{label:"УпÑавлÑÑÑий",hint:"аналиÑика, клиенÑÑ, паÑÑнÑÑÑ, ÑаÑÑÑлки. Ðез возвÑаÑов, клÑÑей и ÑеÑвеÑов",tone
51:"var(--violet)"},support:{label:"ÐоддеÑжка",hint:"ÑикеÑÑ, поÑÑа, каÑÑоÑка клиенÑа и его оплаÑÑ â ÑолÑко ÑÑение",tone:"var(--cyan)"}},Zi=[{cap:"help",title:"С Ñего наÑаÑÑ",body:["Ðдминка â ÑабоÑее меÑÑо, а не виÑÑина: поÑÑи вÑÑ, ÑÑо ÑÑÑ Ð¿Ð¾ÐºÐ°Ð·Ð°Ð½Ð¾, влиÑÐµÑ Ð½Ð° живого Ñеловека Ñ Ð¾Ð¿Ð»Ð°Ñенной подпиÑкой. ÐÑавило одно: ÑнаÑала понÑÑÑ, ÑÑо видиÑÑ, поÑом нажимаÑÑ.","ÐоÑÑÑп вÑдаÑÑÑÑ ÑолÑÑ, и вкладки ÑобÑÐ°Ð½Ñ Ð¿Ð¾Ð´ неÑ. ÐÑли вкладки Ð½ÐµÑ â знаÑÐ¸Ñ ÑÑо пÑаво не вÑдано, а не «ÑломалоÑÑ». ÐÑжна дÑÑÐ³Ð°Ñ â пиÑи владелÑÑÑ, а не обÑ
оди.","ÐаннÑе поÑÑи везде за пеÑиод. ÐÑежде Ñем ÑдивлÑÑÑÑÑ ÑиÑÑе, поÑмоÑÑи на вÑбÑаннÑй пеÑиод и ÑаÑовой поÑÑ: пеÑеклÑÑаÑÐµÐ»Ñ UTC менÑÐµÑ ÐСРвÑÐµÐ¼Ñ Ð½Ð° ÑÑÑаниÑе."]},{cap:"analytics",title:"ÐÐ±Ð·Ð¾Ñ Ð¸ ÐналиÑика",body:["ÐÐ±Ð·Ð¾Ñ â воÑÐµÐ¼Ñ ÑиÑел за 30 дней и ÑÑи гÑаÑика по днÑм. Ðаведи кÑÑÑÐ¾Ñ Ð½Ð° гÑаÑик: Ð¿Ð¾ÐºÐ°Ð¶ÐµÑ Ð´Ð°ÑÑ Ð¸ знаÑение.","ÐÑÑÑÑка ÑÑиÑаеÑÑÑ Ð¢ÐÐЬÐРпо оплаÑеннÑм плаÑежам. ÐÑÑÑавленнÑе ÑÑеÑа, оÑÐºÐ°Ð·Ñ Ð¸ возвÑаÑÑ Ð² Ð½ÐµÑ Ð½Ðµ попадаÑÑ â еÑли ÑиÑÑа кажеÑÑÑ Ð½Ð¸Ð·ÐºÐ¾Ð¹, ÑÑо не поÑеÑÑ Ð´Ð°Ð½Ð½ÑÑ
.","ÐналиÑика â воÑонка Ð¾Ñ Ð·Ð°Ñ
ода на ÑÐ°Ð¹Ñ Ð´Ð¾ оплаÑÑ, ÑазÑÐµÐ·Ñ Ð¿Ð¾ иÑÑоÑникам и лендингам, LTV и ÑдеÑжание. Там же видно, какие пÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ Ð´Ð¾Ð¶Ð¸Ð²Ð°ÑÑ Ð´Ð¾ вÑоÑого и ÑÑеÑÑего Ñикла."]},{cap:"users.read",title:"ÐолÑзоваÑели",body:["ÐоиÑк живой: набиÑай поÑÑÑ Ð¸Ð»Ð¸ ÑаÑÑÑ â ÑпиÑок ÑÑзиÑÑÑ Ñам, ÐºÐ½Ð¾Ð¿ÐºÑ Ð¶Ð°ÑÑ Ð½Ðµ надо.","Ð ÑÑÑоке видно ÑаÑиÑ, ÑÑок, авÑопÑодление и пÑивÑÐ·ÐºÑ Telegram. ÐÑли Ñеловек пÑиÑÑл Ð¾Ñ Ð¿Ð°ÑÑнÑÑа, ÑÑдом Ñ Ð½Ð¸Ð¼ ÑÑÐ¾Ð¸Ñ ÐºÐ¾Ð´ паÑÑнÑÑа.","Ðлик по ÑÐµÐ»Ð¾Ð²ÐµÐºÑ ÑаÑкÑÑÐ²Ð°ÐµÑ ÐºÐ°ÑÑоÑкÑ: ÑÑÑÑойÑÑва, иÑÑоÑÐ¸Ñ Ð¿Ð»Ð°Ñежей, ÑобÑÑÐ¸Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñки. С ÑÑого и Ð
51½Ð°Ñинай лÑбой ÑÐ°Ð·Ð±Ð¾Ñ â поÑÑи на вÑе вопÑоÑÑ ÑаппоÑÑа оÑÐ²ÐµÑ Ñам."]},{cap:"users.write",title:"ÐÑдаÑÑ Ð¸ оÑозваÑÑ Ð´Ð¾ÑÑÑп",body:["ÐÑдаÑÑ Ð´Ð¾ÑÑÑп â ÑÑо подаÑок за Ð½Ð°Ñ ÑÑÑÑ, а не оплаÑа: денÑги в оÑÑÑÑаÑ
не поÑвÑÑÑÑ. ÐолÑзÑйÑÑ, когда Ð¼Ñ Ð²Ð¸Ð½Ð¾Ð²Ð°ÑÑ (пÑоÑÑой ÑеÑвиÑа, наÑа оÑибка), и пиÑи в комменÑаÑии, за ÑÑо.","ÐÑзÑв доÑÑÑпа гаÑÐ¸Ñ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ Ð½ÐµÐ¼ÐµÐ´Ð»ÐµÐ½Ð½Ð¾. ÐÑли Ñеловек заплаÑил, а доÑÑÑп надо ÑнÑÑÑ â ÑÑо возвÑаÑ, а не оÑзÑв: возвÑÐ°Ñ Ð²ÐµÑнÑÑ Ð´ÐµÐ½Ñги и ÑÐ½Ð¸Ð¼ÐµÑ Ð´Ð¾ÑÑÑп одним дейÑÑвием."]},{cap:"payments.read",title:"ÐлаÑежи: как ÑиÑаÑÑ Ð»ÐµÐ½ÑÑ",body:["Ðдна ÑÑÑока â одно движение денег или один поÑ
од за покÑпкой. СÑаÑÑÑÑ:",["Ñоздан â ÑÑÑÑ Ð²ÑÑÑавлен, денег еÑÑ Ð½ÐµÑ. Ðигде не ÑÑиÑаеÑÑÑ. Ðлик покажеÑ, какими ÑпоÑобами Ñеловек пÑобовал заплаÑиÑÑ.","оплаÑен â денÑги пÑиÑли. ÐÑли ÑÑдом ÑиÑло, Ñеловек доÑÑл не Ñ Ð¿ÐµÑвого заÑ
ода: клик Ð¿Ð¾ÐºÐ°Ð¶ÐµÑ Ð²ÐµÑÑ Ð¿ÑÑÑ.","не пÑоÑÑл â пÑоÑеÑÑинг оÑказал. Ðлик Ð¿Ð¾ÐºÐ°Ð¶ÐµÑ Ð¿ÑиÑÐ¸Ð½Ñ ÑеловеÑеÑким ÑзÑком и ÑÑÑ ÑÑо вина: банка, клиенÑа или наÑа.","иÑÑÑк â ÑÑÑÑ ÑÐ¼ÐµÑ Ð½ÐµÐ¾Ð¿Ð»Ð°ÑеннÑм. Ðенег не ÑпиÑÑвали, ÑаÑе вÑего Ñеловек веÑнÑлÑÑ Ð¸ заплаÑил дÑÑгим ÑпоÑобом.","возвÑаÑÑн â денÑги веÑнÑли полноÑÑÑÑ."],"ÐнаÑок â»N на оплаÑе ознаÑаеÑ, ÑÑо ÑпиÑание ÑдалоÑÑ Ð½Ðµ Ñ Ð¿ÐµÑвого Ñаза: Ð±Ð¸Ð»Ð»ÐµÑ Ð¿Ð¾Ð²ÑоÑÑл. Ðлик â пÑиÑÐ¸Ð½Ñ Ð¿ÑоÑлÑÑ
попÑÑок. #N Ñ Ð¿ÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ â какое ÑÑо пÑодление по ÑÑÑÑÑ, по Ð½ÐµÐ¼Ñ Ð²Ð¸Ð´Ð½Ð¾ глÑÐ±Ð¸Ð½Ñ ÑдеÑжаниÑ.","ТеÑ
ниÑеÑкие повÑоÑÑ Ð¸ ÑозданнÑе ÑÑеÑа, за коÑоÑÑми пÑиÑла оплаÑа, из ленÑÑ ÑбÑÐ°Ð½Ñ Ð½Ð°Ð¼ÐµÑенно: ÑобÑÑие одно, и показÑваÑÑ ÐµÐ³Ð¾ ÑÑÐµÐ¼Ñ ÑÑÑоками знаÑÐ¸Ñ Ð²ÑаÑÑ Ð¿Ñо колиÑеÑÑво плаÑежей."]},{cap:"payments.refund",title:"ÐозвÑÐ°Ñ Ð´ÐµÐ½ÐµÐ³",body:["ÐозвÑÐ°Ñ Ð½ÐµÐ¾Ð±ÑаÑим и ÑÑÐ¾Ð¸Ñ Ð½Ð°Ð¼ болÑÑе ÑÑÐ¼Ð¼Ñ Ð¿Ð»Ð°Ñежа: комиÑÑÐ¸Ñ ÑквайÑинга пÑи возвÑаÑе ÐРвозвÑаÑаеÑÑÑ. Рокне возвÑаÑа ÑÑа Ñена показана â ÑиÑай ÐµÑ Ð¿ÐµÑед нажаÑием.","ÐозвÑÐ°Ñ ÑÐ½Ð¸Ð¼Ð°ÐµÑ Ð´Ð¾ÑÑÑп и гаÑÐ¸Ñ Ð°Ð²ÑопÑодление. ЧаÑÑиÑнÑй возвÑÐ°Ñ Ð¾ÑÑавлÑÐµÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ Ð¶Ð¸Ð²Ð¾Ð¹ â им пеÑеÑÑиÑÑваÑÑ, а не ÑаÑÑÑаÑÑÑÑ.","ÐÑли денÑги не пÑиÑ
одили (ÑÑÑÑ Ð²Ð¸Ñел неоплаÑеннÑм, а доÑÑÑп вÑдан по оÑибке) â ÑÑо не возвÑаÑ, а оÑкаÑ: он ÑÐ½Ð¸Ð¼Ð°ÐµÑ Ð²Ñданное вÑемÑ, не ÑÑÐ¾Ð³Ð°Ñ Ð´ÐµÐ½Ñги."]},{cap:"tickets",title:"ТикеÑÑ",body:["ÐÑвеÑай из каÑÑоÑки клиенÑа, а не по памÑÑи: Ñам видно, ÑÑо Ñ Ð½ÐµÐ³Ð¾ за ÑаÑиÑ, когда плаÑил и ÑÑо Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñкой. Ðоловина вопÑоÑов ÑнимаеÑÑÑ Ð¾Ð´Ð½Ð¸Ð¼ взглÑдом на ÑÑок.","ÐÑÐ²ÐµÑ ÑÑ
Ð¾Ð´Ð¸Ñ ÑÐµÐ»Ð¾Ð²ÐµÐºÑ Ð¿Ð¸ÑÑмом и в Telegram, еÑли он пÑивÑзан. ÐиÑи Ñак, как гоÑов ÑвидеÑÑ ÑÑо в ÑкÑинÑоÑе: пеÑепиÑка ÑаÑÑо ÑÐµÐ·Ð¶Ð°ÐµÑ Ð² ÑаÑÑ Ð¸ оÑзÑвÑ.","Ðикогда не пиÑи Ñлово «VPN» â ни в ÑикеÑаÑ
, ни в пиÑÑмаÑ
, ни в пеÑепиÑке Ñ Ð¿Ð¾Ð´ÑÑдÑиками. ÐÑ Ð¾Ð¿Ð¸ÑÑваем пÑодÑÐºÑ Ð½ÐµÐ¹ÑÑалÑно: веб-ÑеÑÐ²Ð¸Ñ Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñкой."]},{cap:"mail",title:"ÐоÑÑа",body:["СÑда падаÑÑ Ð²Ñ
одÑÑие пиÑÑма на support-адÑеÑ. ÐÑвеÑаÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ пÑÑмо оÑÑÑда â оÑÐ²ÐµÑ ÑйдÑÑ Ñ Ð½Ð°Ñего домена и попадÑÑ Ð² ÑÑ Ð¶Ðµ ÑепоÑкÑ.","ÐомеÑай ÑазобÑанное: непомеÑеннÑе пиÑÑма ÑÑиÑаÑÑÑÑ Ð¾ÑеÑедÑÑ, по ним ÑмоÑÑÑÑ Ð½Ð°Ð³ÑÑзкÑ."]},{cap:"partners",title:"ÐаÑÑнÑÑÑ",body:["ÐаÑвка â ÑÑо Ñеловек, коÑоÑÑй Ñ
оÑÐµÑ Ð»Ð¸ÑÑ ÑÑаÑик. ÐÑежде Ñем вклÑÑаÑÑ, поÑмоÑÑи конÑÐ°ÐºÑ Ð¸ договоÑиÑÑ Ð¾ ÑÑавке: ÑÑавка менÑеÑÑÑ ÑолÑко впеÑÑд, Ñже наÑиÑленнÑе комиÑÑии не пеÑеÑÑиÑÑваÑÑÑÑ.","ÐомиÑÑÐ¸Ñ Ð²Ð¸ÑÐ¸Ñ Ð² Ñ
олде 14 дней â ÑÑо окно возвÑаÑа. ÐозвÑÐ°Ñ Ð¿Ð¾ÐºÑпаÑÐµÐ»Ñ Ð³Ð°ÑÐ¸Ñ Ð½Ð°ÑиÑление за ТÐТ плаÑÑж, оÑÑалÑнÑе оÑÑаÑÑÑÑ.","ÐбоÑÐ¾Ñ Ð¿Ð°ÑÑнÑÑа не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð±Ð¾Ð»ÑÑе наÑей вÑÑÑÑки. ÐÑли видиÑÑ Ñакое â ÑÑо баг, зови владелÑÑа, а не вÑплаÑивай."]},{cap:"processors",title:"ÐÑоÑеÑÑинги",body:["ТÑÐ¼Ð±Ð»ÐµÑ Ð²ÑклÑÑÐ°ÐµÑ Ð¿ÑоÑеÑÑинг мгновенно, без вÑкаÑки. ÐÑклÑÑай, когда он оÑказÑÐ²Ð°ÐµÑ Ð¿Ð¾Ð´ÑÑд: каÑкад ÑведÑÑ Ð»Ñдей на ÑледÑÑÑий, и пÑодажи не вÑÑанÑÑ.","ÐонвеÑÑÐ¸Ñ Ð² ÑаблиÑе â из вÑÑÑавленнÑÑ
ÑÑеÑов в оплаÑеннÑе. ÐÑоÑÑм ÑÑовнем ÑазбиÑÑ ÑпоÑÐ¾Ð±Ñ Ð¾Ð¿Ð»Ð°ÑÑ: Ñ ÐºÐ°ÐºÐ¾Ð³Ð¾ меÑода ÑÑ
одÑÑ, видно ÑанÑÑе, Ñем пÑоÑÑÐ´ÐµÑ Ð²ÑÑÑÑка.","ÐлÑÑи и ÑекÑеÑÑ Ð½Ðµ ÑÑогай без владелÑÑа. Ðез клÑÑей пÑоÑеÑÑинг вклÑÑиÑÑ Ð½ÐµÐ»ÑÐ·Ñ â ÑÑо заÑиÑа, а не оÑибка."]},{cap:"nodes",title:"СеÑвеÑÑ",body:["ÐдеÑÑ ÑоÑÑоÑние нод и панели. ÐÑаÑÐ½Ð°Ñ Ð½Ð¾Ð´Ð° â ÑÑо лÑди без доÑÑÑпа пÑÑмо ÑейÑаÑ, пÑиоÑиÑÐµÑ Ð²ÑÑе лÑбой дÑÑгой задаÑи.","ÐÐ¾Ð´Ñ Ð½Ðµ вÑклÑÑай в одиноÑкÑ: на Ð½ÐµÑ ÑмоÑÑÑÑ Ð¶Ð¸Ð²Ñе подпиÑки, и ÑÑ
од ÑÑаÑика надо гоÑовиÑÑ."]},{cap:"broadcast",title:"СообÑÐµÐ½Ð¸Ñ Ð¸ ÑаÑÑÑлки",body:["ТекÑÑÑ Ñведомлений ÑедакÑиÑÑÑÑÑÑ Ð·Ð´ÐµÑÑ, на двÑÑ
ÑзÑкаÑ
. ÐеÑед ÑоÑ
Ñанением жми пÑедпÑоÑмоÑÑ: плейÑÑ
олдеÑÑ Ð²Ñоде {plan} и {amount} подÑÑавлÑÑÑÑÑ ÑеалÑнÑми знаÑениÑми, и опеÑаÑка в ниÑ
Ð»Ð¾Ð¼Ð°ÐµÑ Ð¿Ð¸ÑÑмо Ñеликом.","РаÑÑÑлка ÑÑ
Ð¾Ð´Ð¸Ñ Ð¶Ð¸Ð²Ñм лÑдÑм и оÑмениÑÑ ÐµÑ Ð½ÐµÐ»ÑзÑ. ÐÑпÑавлÑй ÑолÑко Ñ ÑоглаÑÐ¸Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑа и вÑегда ÑнаÑала Ñебе.","ÐвоÑа пиÑем обÑÐ°Ñ Ð½Ð° веÑÑ Ð°ÐºÐºÐ°ÑнÑ: болÑÑÐ°Ñ ÑаÑÑÑлка Ð¼Ð¾Ð¶ÐµÑ ÑÑеÑÑÑ Ð»Ð¸Ð¼Ð¸Ñ Ð¸ оÑÑавиÑÑ Ð±ÐµÐ· пиÑем ÑегиÑÑÑаÑÐ¸Ñ Ð´ÑÑгого бÑенда. ÐÑо Ñже ÑлÑÑалоÑÑ."]},{cap:"roles",title:"СоÑÑÑдники",body:["Ð Ð¾Ð»Ñ Ð²ÑдаÑÑÑÑ Ð¿Ð¾ поÑÑе â Ñеловек должен ÑнаÑала завеÑÑи обÑÑнÑй аккаÑнÑ. ÐÐ»Ð°Ð´ÐµÐ»ÐµÑ Ð¼Ð¾Ð¶ÐµÑ Ð²ÑÑ, ÑпÑавлÑÑÑий ведÑÑ Ð¿ÑодÑÐºÑ Ð¸ денÑги в оÑÑÑÑаÑ
, поддеÑжка оÑвеÑÐ°ÐµÑ ÐºÐ»Ð¸ÐµÐ½Ñам.","Ð¡ÐµÐ±Ñ ÑазжаловаÑÑ Ð½ÐµÐ»ÑзÑ: инаÑе поÑледний Ð²Ð»Ð°Ð´ÐµÐ»ÐµÑ Ð·Ð°ÐºÑÑл Ð±Ñ Ð°Ð´Ð¼Ð¸Ð½ÐºÑ Ð´Ð»Ñ Ð²ÑеÑ
.","Снимай доÑÑÑп ÑÑазÑ, как Ñеловек пеÑеÑÑал ÑабоÑаÑÑ. ÐÑо одно нажаÑие и оно деÑевле лÑбого ÑазбоÑа поÑом."]}
51,{cap:"help",title:"ÐÑли ÑÑо-Ñо поÑло не Ñак",body:["ÐенÑги ÑпиÑалиÑÑ Ð´Ð²Ð°Ð¶Ð´Ñ, доÑÑÑп пÑопал Ñ Ð¾Ð¿Ð»Ð°ÑивÑего, паÑÑнÑÑÑ Ð½Ð°ÑиÑлено болÑÑе вÑÑÑÑки â не Ñини Ñам, зови владелÑÑа. Такие веÑи поÑÑи вÑегда ознаÑаÑÑ Ð±Ð°Ð³, и вÑоÑое дейÑÑвие повеÑÑ Ð¿ÐµÑвого Ð´ÐµÐ»Ð°ÐµÑ ÑÐ°Ð·Ð±Ð¾Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ñм.","ÐÑежде Ñем зваÑÑ, ÑобеÑи ÑакÑÑ: поÑÑа клиенÑа, вÑемÑ, ÑÑо видно в ленÑе плаÑежей и в каÑÑоÑке. С ÑÑим ÑÐ°Ð·Ð±Ð¾Ñ Ð·Ð°Ð½Ð¸Ð¼Ð°ÐµÑ Ð¼Ð¸Ð½ÑÑÑ, без ÑÑого â ÑаÑÑ."]}];function er({caps:s,role:t}){var x,i;const m=Zi.filter(C=>s.includes(C.cap)),n=((x=qe[t])==null?void 0:x.label)||"СоÑÑÑдник";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:6,fontSize:15},children:["СпÑавка â ",n.toLowerCase()]}),e.jsxs("p",{className:"dim",style:{fontSize:13,margin:0,lineHeight:1.6},children:["ÐдеÑÑ Ð¾Ð¿Ð¸Ñано ÑолÑко Ñо, ÑÑо доÑÑÑпно Ñвоей Ñоли: ",((i=qe[t])==null?void 0:i.hint)||"â",". Ð Ð°Ð·Ð´ÐµÐ»Ñ Ð¸Ð´ÑÑ Ð² Ñом же поÑÑдке, ÑÑо вкладки ÑвеÑÑ Ñ."]})]}),m.map(C=>e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:10,fontSize:14},children:C.title}),C.body.map((u,k)=>Array.isArray(u)?e.jsx("ul",{style:{margin:"0 0 10px",paddingLeft:18,fontSize:13.5,lineHeight:1.7,color:"var(--muted)"},children:u.map((g,I)=>e.jsx("li",{children:g},I))},k):e.jsx("p",{style:{margin:"0 0 10px",fontSize:13.5,lineHeight:1.65,color:"var(--muted)"},children:u},k))]},C.title))]})}function tr({api:s,me:t}){var W;const[m,n]=r.useState([]),[x,i]=r.useState(""),[C,u]=r.useState("support"),[k,g]=r.useState(""),[I,E]=r.useState(!1),X=()=>s("/admin/staff").then(o=>n(o.rows||[])).catch(()=>{});r.useEffect(()=>{X()},[]);const D=async(o,N)=>{E(!0),g("");try{await s("/admin/staff/set",{email:o,role:N}),i(""),await X(),g(N==="none"?"ÐоÑÑÑп ÑнÑÑ":"Ð Ð¾Ð»Ñ Ð½Ð°Ð·Ð½Ð°Ñена")}catch(v){const _=String((v==null?void 0:v.message)||"");g(_==="no_user"?"ÐолÑзоваÑÐµÐ»Ñ Ñ Ñаким адÑеÑом Ð½ÐµÑ â ÑнаÑала он должен завеÑÑи аккаÑнÑ":_==="self_demote"?"Ð¡ÐµÐ±Ñ ÑазжаловаÑÑ Ð½ÐµÐ»ÑÐ·Ñ â инаÑе Ð½ÐµÐºÐ¾Ð¼Ñ Ð±ÑÐ´ÐµÑ Ð²ÐµÑнÑÑÑ Ð¿Ñава":"Ðе полÑÑилоÑÑ: "+_)}finally{E(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card pad",style:{marginBottom:16},children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:12,fontSize:15},children:"ÐÑдаÑÑ Ð´Ð¾ÑÑÑп"}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{style:{...We,minWidth:260,flex:"1 1 260px"},placeholder:"поÑÑа ÑоÑÑÑдника",value:x,onChange:o=>i(o.target.value)}),e.jsx("select",{style:{...We,cursor:"pointer"},value:C,onChange:o=>u(o.target.value),children:Object.entries(qe).map(([o,N])=>e.jsx("option",{value:o,children:N.label},o))}),e.jsx("button",{className:"btn",disabled:I||!x.trim(),onClick:()=>D(x.trim(),C),children:"ÐазнаÑиÑÑ"}),k&&e.jsx("span",{className:"dim",style:{fontSize:13},children:k})]}),e.jsx("div",{className:"dim",style:{fontSize:12.5,marginTop:10,lineHeight:1.5},children:(W=qe[C])==null?void 0:W.hint})]}),e.jsxs("div",{className:"card pad",children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:12,fontSize:15},children:["ÐоÑÑÑп в Ð°Ð´Ð¼Ð¸Ð½ÐºÑ â ",m.length]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx("th",{style:{padding:"6px 8px"},children:"поÑÑа"}),e.jsx("th",{style:{padding:"6px 8px"},children:"ÑолÑ"}),e.jsx("th",{style:{padding:"6px 8px"},children:"ÑÑо можеÑ"}),e.jsx("th",{style:{padding:"6px 8px"},children:"дейÑÑвиÑ"})]})}),e.jsx("tbody",{children:m.map(o=>{const N=qe[o.adminRole]||qe.owner,v=String(o.email||"").toLowerCase()===t.toLowerCase();return e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsxs("td",{style:{padding:"8px"},children:[o.email,v&&e.jsx("span",{className:"dim",style:{marginLeft:6,fontSize:12},children:"(вÑ)"})]}),e.jsx("td",{style:{padding:"8px"},children:e.jsx("select",{style:{...We,padding:"5px 9px",fontSize:13,cursor:v?"not-allowed":"pointer",color:N.tone},value:o.adminRole,disabled:v||I,onChange:_=>{var Q,A;const B=_.target.value;if(!confirm(`СмениÑÑ ÑÐ¾Ð»Ñ ${o.email} на «${((Q=qe[B])==null?void 0:Q.label)||B}»? 52 53${((A=qe[B])==null?void 0:A.hint)||""}`)){_.target.value=o.adminRole;return}D(o.email,B)},children:Object.entries(qe).map(([_,B])=>e.jsx("option",{value:_,children:B.label},_))})}),e.jsx("td",{style:{padding:"8px",whiteSpace:"normal"},className:"dim",children:N.hint}),e.jsx("td",{style:{padding:"8px",textAlign:"right"},children:!v&&e.jsx("button",{className:"iconbtn iconbtn--danger",disabled:I,title:"СнÑÑÑ Ð´Ð¾ÑÑÑп в админкÑ","aria-label":"СнÑÑÑ Ð´Ð¾ÑÑÑп в админкÑ",onClick:()=>{confirm(`СнÑÑÑ Ð´Ð¾ÑÑÑп в Ð°Ð´Ð¼Ð¸Ð½ÐºÑ Ñ ${o.email}? 54 55Человек поÑеÑÑÐµÑ Ð²Ñ Ð¾Ð´ в Ð¿Ð°Ð½ÐµÐ»Ñ Ð½ÐµÐ¼ÐµÐ´Ð»ÐµÐ½Ð½Ð¾. ÐеÑнÑÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ ÑолÑко вÑдав ÑÐ¾Ð»Ñ Ð·Ð°Ð½Ð¾Ð²Ð¾.`)&&D(o.email,"none")},children:e.jsx(Xn,{size:15,strokeWidth:2})})})]},o.id)})})]})})]})]})}function Vt(s,t=[],m=6e4){const n=r.useRef(s);n.current=s,r.useEffect(()=>{const i=setInterval(()=>{document.hidden||n.current()},m),C=()=>{document.hidden||n.current()};return document.addEventListener("visibilitychange",C),()=>{clearInterval(i),document.removeEventListener("visibilitychange",C)}},t)}function sr({api:s}){var u,k,g,I,E,X,D,W,o,N;const[t,m]=r.useState(null),[n,x]=r.useState(null),i=-new Date().getTimezoneOffset(),C=()=>{s("/admin/overview").then(m).catch(()=>{}),s(`/admin/charts?tz=${i}`).then(x).catch(()=>{})};return r.useEffect(()=>{C()},[]),Vt(C),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"kpi-row",children:[e.jsx(Ke,{label:(()=>{const _=((t==null?void 0:t.revenue30ByCurrency)||[]).slice(1).map(Q=>
55`${(Q.cents/100).toLocaleString("ru-RU")} ${gs(Q.currency)}`),B=_.length?`вÑÑÑÑка · 30 дней · еÑÑ ${_.join(" · ")}`:"вÑÑÑÑка · 30 дней";return t!=null&&t.refunded30Cents?`${B} · за вÑÑеÑом возвÑаÑов`:B})(),value:t?De(((k=(u=t.revenue30ByCurrency)==null?void 0:u[0])==null?void 0:k.cents)??t.revenue30NativeCents??t.revenue30Cents,((I=(g=t.revenue30ByCurrency)==null?void 0:g[0])==null?void 0:I.currency)??t.revenue30Currency):"â",tone:"var(--green)"}),e.jsx(Ke,{label:"плаÑежей · 30 дней",value:(t==null?void 0:t.sales30)??"â"}),e.jsx(Ke,{label:"покÑпаÑелей · 30 дней",value:(t==null?void 0:t.buyers30)??"â",tone:"var(--cyan)"}),e.jsx(Ke,{label:"ÑегиÑÑÑаÑий · 30 дней",value:(t==null?void 0:t.users30)??"â"}),e.jsx(Ke,{label:t?`подпиÑок: ${t.subsPaid} плаÑнÑÑ
· ${t.subsTrial} ÑÑиал · ${t.subsGranted} гÑанÑ`:"акÑивнÑÑ
подпиÑок",value:(t==null?void 0:t.subsActive)??"â"}),e.jsx(Ke,{label:t?`авÑопÑодление: ${t.subsCron} на кÑоне`:"под демоном",value:t?`${t.subsDaemon} / ${t.subsDaemon+t.subsCron}`:"â",tone:"var(--violet)"}),e.jsx(Ke,{label:t?`ÑикеÑов: ${t.ticketsOpen??0} оÑкÑÑÑÑÑ
· ${t.ticketsWaiting??0} без оÑвеÑа`:"ÑикеÑÑ",value:t?`${t.ticketsOpen??0} / ${t.ticketsWaiting??0}`:"â",tone:t!=null&&t.ticketsWaiting?"var(--coral)":void 0}),e.jsx(Ke,{label:"заÑвок паÑÑнÑÑов",value:(t==null?void 0:t.partnersPending)??"â",tone:t!=null&&t.partnersPending?"var(--coral)":void 0})]}),!!(t!=null&&t.refunded30Cents)&&e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:-8,marginBottom:16},children:["ÐозвÑаÑено за 30 дней: ",De(t.refunded30Cents,((X=(E=t.revenue30ByCurrency)==null?void 0:E[0])==null?void 0:X.currency)??t.revenue30Currency)," â ÑÑа ÑÑмма из вÑÑÑÑки Ñже вÑÑÑена."]}),!!((D=t==null?void 0:t.revenue30Skipped)!=null&&D.length)&&e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:-8,marginBottom:16},children:["Ðе ÑÑÑено в вÑÑÑÑке: ",t.revenue30Skipped.join(", ")," â Ð½ÐµÑ ÐºÑÑÑа к USD. ÐеÑоÑниÑа Apple иÑклÑÑена."]}),!!((o=(W=t==null?void 0:t.cronFailed)==null?void 0:W.failed)!=null&&o.length)&&e.jsxs("div",{className:"card pad",style:{borderColor:"var(--coral)",marginBottom:16},children:[e.jsxs("div",{style:{color:"var(--coral)",fontWeight:600,fontSize:14,marginBottom:6},children:["ÐÑон: Ñпало Ñагов â ",t.cronFailed.failed.length," (",new Date(t.cronFailed.at).toLocaleString("ru-RU"),")"]}),t.cronFailed.failed.map((v,_)=>e.jsx("div",{className:"dim",style:{fontSize:12.5,fontFamily:"ui-monospace, monospace"},children:v},_))]}),!!((N=t==null?void 0:t.dbSlow)!=null&&N.length)&&e.jsxs("div",{className:"card pad",style:{borderColor:"var(--coral)",marginBottom:16},children:[e.jsxs("div",{style:{color:"var(--coral)",fontWeight:600,fontSize:14,marginBottom:6},children:["Ðаза оÑвеÑÐ°ÐµÑ Ð´Ð¾Ñого â запÑÐ¾Ñ Ð¿ÐµÑеÑÑал попадаÑÑ Ð² Ð¸Ð½Ð´ÐµÐºÑ (",new Date(t.dbSlow[0].at).toLocaleString("ru-RU"),")"]}),t.dbSlow.map((v,_)=>e.jsxs("div",{className:"dim",style:{fontSize:12.5},children:[v.name," â ",v.rows<0?"запÑÐ¾Ñ Ð½Ðµ пÑоÑÑл":`пÑоÑиÑано ${v.rows.toLocaleString("ru-RU")} ÑÑÑок за ${Math.round(v.ms)} мÑ`]},_))]}),n&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr",gap:14},children:[["РегиÑÑÑаÑии / денÑ",n.regs,yt.violet,!1],["ÐлаÑежи / денÑ",n.sales,yt.cyan,!1],["ÐÑÑÑÑка / денÑ",n.revenueCents,yt.green,!0]].map(([v,_,B,Q])=>e.jsxs("div",{className:"card pad",children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:10,fontSize:14},children:v}),e.jsx(xn,{data:_,days:n.days,color:B,width:un,height:pn,fmtValue:Q?(A=>De(A,(n==null?void 0:n.revenueCurrency)||(t==null?void 0:t.revenue30Currency))):void 0})]},v))})]})}const cs=[{id:"today",label:"СегоднÑ",range:s=>{const t=He(s,0);return[t,t]}},{id:"yesterday",label:"ÐÑеÑа",range:s=>{const t=He(s,-1);return[t,t]}},{id:"week",label:"ÐеделÑ",range:s=>[He(s,-6),He(s,0)]},{id:"month",label:"ÐеÑÑÑ",range:s=>[He(s,-29),He(s,0)]},{id:"all",label:"ÐÑÑ",range:s=>["",""]}];function He(s,t){return new Date(Date.now()+s*6e4+t*864e5).toISOString().slice(0,10)}const Ys="2026-03-01";function Sn(s="week",t=!1){const[m,n]=r.useState(!1),x=m?0:-new Date().getTimezoneOffset(),[i,C]=r.useState(s),[u,k]=r.useState(""),[g,I]=r.useState(""),[E,X]=r.useState(""),[D,W]=r.useState("");let[o,N]=i?(cs.find(B=>B.id===i)||cs[2]).range(x):[u,g];i==="all"&&t&&!o&&(o=He(x,-730),N=He(x,0));const v=o&&E?`${o}T${E}`:o,_=N&&D?`${N}T${D}`:N;return{utc:m,setUtc:n,tzMin:x,preset:i,setPreset:C,from:u,setFrom:k,to:g,setTo:I,hFrom:E,setHFrom:X,hTo:D,setHTo:W,rFrom:o,rTo:N,qFrom:v,qTo:_,ready:!!(o&&N)}}function Js({utc:s,setUtc:t,narrow:m}){return e.jsx("button",{type:"button",onClick:()=>t(!s),"aria-pressed":s,className:"pbar__utc"+(s?" pbar__utc--on":"")+(m?" pbar__utc--m":" pbar__utc--d"),title:"СÑÑки ÑежÑÑÑÑ Ð¿Ð¾ UTC вмеÑÑо ÑаÑового поÑÑа бÑаÑзеÑа â Ð´Ð»Ñ ÑвеÑки Ñ ÑÑжими оÑÑÑÑами",children:"UTC"})}function wn({p:s,busy:t,extra:m,allowAll:n}
55){const{preset:x,setPreset:i,from:C,setFrom:u,to:k,setTo:g,utc:I,setUtc:E,hFrom:X,setHFrom:D,hTo:W,setHTo:o}=s,N=He(s.tzMin,0),v=cs;return e.jsxs("div",{className:"card pad pbar",children:[e.jsxs("div",{className:"pbar__presets",style:{"--pcols":(v.length+1)%3===0?3:(v.length+1)%2===0?2:3},children:[v.map(_=>e.jsx("button",{onClick:()=>{i(_.id),u(""),g("")},style:{padding:"7px 16px",fontSize:13,fontWeight:x===_.id?600:400,border:0,borderRadius:8,cursor:"pointer",transition:"background .15s, color .15s",background:x===_.id?"rgba(91,156,255,0.22)":"transparent",color:x===_.id?"var(--text)":"var(--muted)"},children:_.label},_.id)),e.jsx(Js,{utc:I,setUtc:E,narrow:!0})]}),e.jsxs("div",{className:"pbar__dates",children:[e.jsx("input",{type:"date",value:x?s.rFrom||"":C,max:k||N,min:Ys,onChange:_=>{const B=_.target.value;if(!B)return;const Q=k||s.rTo||B;u(B),g(B>Q?B:Q),i("")},style:{...We,padding:"6px 10px",fontSize:12.5,width:"auto"}}),e.jsx("span",{className:"dim",style:{fontSize:13},children:"â"}),e.jsx("input",{type:"date",value:x?s.rTo||"":k,min:C||s.rFrom||Ys,max:N,onChange:_=>{const B=_.target.value;if(!B)return;const Q=C||s.rFrom||B;g(B),u(B<Q?B:Q),i("")},style:{...We,padding:"6px 10px",fontSize:12.5,width:"auto"}}),e.jsx("span",{className:"dim pbar__hsep",style:{fontSize:12},children:"вÑемÑ"}),e.jsx("input",{type:"time",value:X,step:60,"aria-label":"ÐÑÐµÐ¼Ñ Ð½Ð°Ñала пеÑиода",title:"С какого ÑаÑа ÑÑиÑаÑÑ. ÐÑÑÑо â Ñ Ð½Ð°Ñала ÑÑÑок.",onChange:_=>D(_.target.value),onBlur:_=>{const B=_.target.value;B&&W&&W<B&&s.rFrom===s.rTo&&o(B)},style:{...We,padding:"6px 8px",fontSize:12.5,width:"auto"}}),e.jsx("span",{className:"dim",style:{fontSize:13},children:"â"}),e.jsx("input",{type:"time",value:W,step:60,"aria-label":"ÐÑÐµÐ¼Ñ ÐºÐ¾Ð½Ñа пеÑиода",title:"Ðо какой ÑÐ°Ñ ÑÑиÑаÑÑ, вклÑÑиÑелÑно. ÐÑÑÑо â до конÑа ÑÑÑок.",onChange:_=>o(_.target.value),onBlur:_=>{const B=_.target.value;B&&X&&B<X&&s.rFrom===s.rTo&&D(B)},style:{...We,padding:"6px 8px",fontSize:12.5,width:"auto"}}),(X||W)&&e.jsx("button",{className:"btn btn--ghost",style:{padding:"6px 9px",fontSize:12.5},title:"ÐеÑнÑÑÑ Ð¿ÐµÑиод к ÑелÑм ÑÑÑкам",onClick:()=>{D(""),o("")},children:"ÑÑÑки"}),!x&&e.jsx("button",{className:"btn btn--ghost",style:{padding:"6px 11px",fontSize:12.5},onClick:()=>{i(n?"all":"week"),u(""),g(""),D(""),o("")},children:"ÑбÑоÑ"})]}),m,e.jsxs("div",{className:"pbar__right",children:[e.jsx("span",{className:"dim",style:{fontSize:12,opacity:t?1:0,transition:"opacity .2s"},children:"обновлÑÑâ¦"}),e.jsx(Js,{utc:I,setUtc:E})]})]})}function nr({api:s}){var Be,Ae,Ce,R,ze,ke,Le,Ee,Fe;const t=Sn("week",!0),{tzMin:m,utc:n,rFrom:x,rTo:i,qFrom:C,qTo:u,ready:k}=t,[g,I]=r.useState(""),[E,X]=r.useState([]),[D,W]=r.useState([]);r.useEffect(()=>{let l=!0;return s("/partner/admin/list").then(a=>{l&&X(((a==null?void 0:a.partners)||[]).filter(M=>M.code))}).catch(()=>{}),s("/admin/nx-codes").then(a=>{l&&W((a==null?void 0:a.codes)||[])}).catch(()=>{}),()=>{l=!1}},[]);const[o,N]=r.useState(null),[v,_]=r.useState(!0),[B,Q]=r.useState(!0),[A,$]=r.useState(null);r.useEffect(()=>{if(!k)return;let l=!0;const a=new URLSearchParams({from:C,to:u,tz:String(m)});g&&a.set("partner",g);let M=0;const f=(K=!1)=>{K||Q(!0);const re=++M,je=new URLSearchParams(a);je.set("section","core");const c=new URLSearchParams(a);return c.set("section","health"),K||N(te=>te&&{...te,movement:void 0,stickiness:void 0,churned:void 0,rebills:void 0}),s("/admin/funnel?"+c).then(te=>{l&&re===M&&N(ve=>({...ve,...te}))}).catch(()=>{}),s("/admin/funnel?"+je).then(te=>{l&&re===M&&(N(ve=>({...ve,...te})),$(Date.now()))}).catch(()=>{}).finally(()=>{l&&!K&&(Q(!1),_(!1))})};f();const H=setInterval(()=>{document.hidden||f(!0)},6e4),p=()=>{document.hidden||f(!0)};return document.addEventListener("visibilitychange",p),()=>{l=!1,clearInterval(H),document.removeEventListener("visibilitychange",p)}},[C,u,m,g]);const[V,T]=r.useState({k:"revCents",dir:-1}),[y,q]=r.useState(null),[P,oe]=r.useState(null),[L,se]=r.useState({k:"uniques",dir:-1}
55),[U,ne]=r.useState({k:"crPaid",dir:-1}),[le,ee]=r.useState({k:"day",dir:-1}),be=(l,a,M)=>[...l||[]].sort((f,S)=>{const H=a.k==="cr"?f.uniques||f.regs?f.paid/(f.uniques||f.regs):0:f[a.k],p=a.k==="cr"?S.uniques||S.regs?S.paid/(S.uniques||S.regs):0:S[a.k];return a.k===M?String(H).localeCompare(String(p))*a.dir:(H>p?1:H<p?-1:0)*a.dir}),w=({k:l,cur:a,set:M,children:f,right:S})=>e.jsxs("th",{className:S?"r":"",style:{padding:6,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap"},onClick:()=>M(a.k===l?{k:l,dir:-a.dir}:{k:l,dir:-1}),children:[f,a.k===l?a.dir===-1?" â¾":" â´":""]}),d=(l,a,M)=>{var H,p;const f=[a.join(";"),...M.map(K=>K.join(";"))].join(` 56`),S=document.createElement("a");S.href=URL.createObjectURL(new Blob(["\uFEFF"+f],{type:"text/csv;charset=utf-8"})),S.download=`${l}-${((H=o==null?void 0:o.range)==null?void 0:H.from)||""}_${((p=o==null?void 0:o.range)==null?void 0:p.to)||""}.csv`,document.body.appendChild(S),S.click(),document.body.removeChild(S),setTimeout(()=>URL.revokeObjectURL(S.href),1e3)},b=l=>De(l,o==null?void 0:o.currency),F=(l,a)=>a?(l/a*100).toFixed(1)+"%":"â",Z=o==null?void 0:o.totals,xe=(l,a,M,f="var(--text)",S)=>e.jsxs("div",{className:"card pad",style:{flex:1,minWidth:130},children:[e.jsx("div",{className:"dim",style:{fontSize:12.5,marginBottom:4},children:l}),e.jsx("div",{style:{fontSize:24,fontWeight:800,color:f},children:a}),M&&e.jsx("div",{className:"dim",style:{fontSize:12,marginTop:2},title:S,children:M})]}),ue=g.startsWith("nx:"),Ne="клики nexora ÑÑиÑаÑÑÑÑ Ð² nexora",fe=(l,a)=>ue?"â":F(l,a),ce=({n:l,cents:a,money:M,tone:f,dim:S,label:H})=>e.jsx("td",{className:"r"+(S?" dim":""),style:{whiteSpace:"nowrap",color:f,fontWeight:f?600:400},title:l?`${H}: ${l} на ${M(a||0)}`:H,children:l?e.jsxs(e.Fragment,{children:[l,e.jsxs("span",{className:"dim cellsum",style:{fontSize:11.5,fontWeight:400},children:[" · ",M(a||0)]})]}):""});return Math.max(1,...((o==null?void 0:o.revByDay)||[]).map(l=>l.revCents)),e.jsxs(e.Fragment,{children:[e.jsx(wn,{p:t,busy:B&&!v,extra:(E.length>0||D.length>0)&&e.jsxs("select",{value:g,onChange:l=>I(l.target.value),title:"ÐоказаÑÑ Ð²Ð¾ÑÐ¾Ð½ÐºÑ ÑолÑко по Ð¾Ð´Ð½Ð¾Ð¼Ñ Ð¿Ð°ÑÑнÑÑÑ (по его ÑеÑ-кодÑ)",style:{...We,padding:"6px 10px",fontSize:12.5,width:"auto",maxWidth:220},children:[e.jsx("option",{value:"",children:"ÐÑе паÑÑнÑÑÑ"}),E.map(l=>e.jsxs("option",{value:l.code,children:[l.code,l.email||l.contact?` · ${l.email||l.contact}`:""]},l.code)),D.length>0&&e.jsx("optgroup",{label:"nexora",children:D.map(l=>e.jsx("option",{value:"nx:"+l.code,children:as(l)},"nx:"+l.code))})]})}),g&&e.jsxs("div",{className:"dim",style:{fontSize:12,marginTop:-6,marginBottom:8},children:[g.startsWith("nx:")?e.jsxs(e.Fragment,{children:["РазÑез по паÑÑнÑÑÑ nexora ",e.jsx("b",{style:{color:"var(--violet-2)"},children:as(D.find(l=>"nx:"+l.code===g)||{code:g.slice(3)})})," â ÑегиÑÑÑаÑии и оплаÑÑ ÐµÐ³Ð¾ лÑдей (nx_code); визиÑÑ â бÑаÑзеÑÑ, из коÑоÑÑÑ ÐµÐ³Ð¾ лÑди поÑом воÑли."]}):e.jsxs(e.Fragment,{children:["РазÑез по паÑÑнÑÑÑ ",e.jsx("b",{style:{color:"var(--violet-2)"},children:g})," â визиÑÑ Ð¿Ð¾ ref, ÑегиÑÑÑаÑии и оплаÑÑ ÐµÐ³Ð¾ ÑзеÑов."]})," ",e.jsx("button",{className:"linkbtn",onClick:()=>I(""),children:"ÑбÑоÑиÑÑ"})]}),(o==null?void 0:o.range)&&e.jsxs("div",{className:"dim",style:{fontSize:12,marginTop:-6,marginBottom:12},children:[o.range.from===o.range.to?o.range.from:`${o.range.from} â ${o.range.to}`," · ÑÑÑки по ",n?"UTC":`вÑемени бÑаÑзеÑа (UTC${m>=0?"+":""}${m/60})`,A&&e.jsxs("span",{title:"ÐаннÑе обновлÑÑÑÑÑ Ñами, пока ÑÑÑаниÑа оÑкÑÑÑа",children:[" · обновлено ",new Date(A).toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"})]})]}),v||!Z?e.jsxs("div",{className:"card pad",style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{className:"spinner"}),e.jsx("span",{className:"dim",style:{fontSize:13},children:"ÑÑиÑаÑâ¦"})]}):e.jsxs("div",{style:{opacity:B?.45:1,transition:"opacity .18s ease",pointerEvents:B?"none":"auto"},children:[((Be=o.visits)==null?void 0:Be.source)&&e.jsxs("div",{className:"dim",style:{fontSize:12,marginBottom:6},children:["ÐÐ°Ñ Ð¾Ð´Ñ: ",o.visits.source==="ae"?"Analytics Engine (ÑоÑки за поÑледние 3 меÑÑÑа)":o.visits.source==="daily"?"ÑÑÑоÑнÑе агÑегаÑÑ":"ÑаблиÑа visits (D1)",o.visits.sampled&&" · оÑенка (ÑÑмплинг)",o.visits.note&&` · ${o.visits.note}`]}),e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:12},children:[xe("ÐоказÑ",Z.raws,"вÑе пÑоÑмоÑÑÑ ÑÑÑаниÑ"),xe("ÐизиÑÑ",Z.visits,"ÑеÑÑии"),xe("Уники",Z.uniques,"поÑеÑиÑели","var(--cyan)"),xe("РегиÑÑÑаÑии",Z.regs,fe(Z.regs,Z.uniques)+" Ð¾Ñ Ñников","#A855F7",ue?Ne:void 0),xe("ÐокÑпаÑели",Z.paid,F(Z.paid,Z.regs)+" Ð¾Ñ Ñеги","var(--green)"),xe("ÐÑÑÑÑка",b(Z.revCents),(Z.paid?"ÑÑ. Ñек "+b(Math.round(Z.revCents/Z.paid)):"ÑÑ. Ñек â")+(Z.refundCents?` · возвÑаÑÑ ${b(Z.refundCents)} Ñже вÑÑÑенÑ`:""),"var(--green)"),o.cohort&&xe("LTV",o.cohort.paid?b(o.cohort.ltvCents):"â",`на покÑпаÑÐµÐ»Ñ Â· когоÑÑа: ${o.cohort.paid} из ${o.cohort.regs} пÑиÑедÑÐ¸Ñ `,"var(--green)"),o.cohort&&xe("ARPU",o.cohort.regs?b(o.cohort.arpuCents):"â",`на ÑегиÑÑÑаÑÐ¸Ñ Â· вÑÑÑÑка когоÑÑÑ ${b(o.cohort.rev
56Cents)}`,"var(--cyan)")]}),(((Ae=o.currencies)==null?void 0:Ae.length)||0)>1&&e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:-6,marginBottom:12,color:"var(--coral)"},children:["РпеÑиоде оплаÑÑ Ð² ÑазнÑÑ
валÑÑаÑ
(",o.currencies.map(l=>`${(l.cents/100).toLocaleString("ru-RU")} ${gs(l.currency)}`).join(" · "),") â ÑÑÐ¼Ð¼Ñ Ð² ÑаблиÑаÑ
ниже ÑÐ»Ð¾Ð¶ÐµÐ½Ñ ÐºÐ°Ðº еÑÑÑ, без пеÑеÑÑÑÑа по кÑÑÑÑ."]}),((Ce=o.revByDay)==null?void 0:Ce.length)>0&&e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"ÐÑÑÑÑка по днÑм"}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("revenue-by-day",["date","registrations","payments","full","full_rub","trial","trial_rub","from_trial","from_trial_rub","renewals","renewals_rub","devices","devices_rub","revenue","avg"],be(o.revByDay,le,"day").map(l=>[new Date(l.day).toISOString().slice(0,10),l.regs||0,l.n,l.fullN||0,((l.fullCents||0)/100).toFixed(2),l.trialN||0,((l.trialCents||0)/100).toFixed(2),l.trialConvN||0,((l.trialConvCents||0)/100).toFixed(2),l.renewN||0,((l.renewCents||0)/100).toFixed(2),l.devicesN||0,((l.devicesCents||0)/100).toFixed(2),(l.revCents/100).toFixed(2),(l.n?l.revCents/l.n/100:0).toFixed(2)])),children:"CSV"})]}),o.revByDay.length>1&&e.jsx(xn,{data:o.revByDay.map(l=>l.revCents),days:o.revByDay.map(l=>{const a=new Date(l.day);return`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`}),color:yt.green,fmtValue:l=>De(l,o.currency),width:un,height:pn}),e.jsx("div",{style:{maxHeight:260,overflowY:"auto",overflowX:"auto"},children:e.jsxs("table",{className:"revday",style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)",position:"sticky",top:0,background:"var(--surface)"},children:[e.jsx(w,{k:"day",cur:le,set:ee,children:e.jsx("span",{title:"ÐаÑа",children:e.jsx(An,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"regs",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"РегиÑÑÑаÑий за денÑ",children:e.jsx(In,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"n",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"ÐлаÑежей за Ð´ÐµÐ½Ñ â вÑего",children:e.jsx(Dn,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"fullN",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"ÐолнÑй ÑаÑÐ¸Ñ â пеÑÐ²Ð°Ñ Ð¿Ð¾ÐºÑпка по Ñене",children:e.jsx(an,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"trialN",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"ÐÑобнÑй â пеÑÐ²Ð°Ñ Ð¿Ð¾ÐºÑпка по лÑгоÑной Ñене (1 ⽠или 19 â½, завиÑÐ¸Ñ Ð¾Ñ Ð¾ÑÑеÑа паÑÑнÑÑа); Ñазбивка по ÑакÑиÑеÑким Ñенам â в блоке «ÐÑобнÑй пеÑиод»",children:e.jsx(ln,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"trialConvN",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"Ðз пÑобного â доплаÑил полнÑÑ ÑÐµÐ½Ñ Ð¿Ð¾Ñле ÑÑблÑ",children:e.jsx(Bn,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"renewN",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"ÐÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ â оÑеÑедное ÑпиÑание по подпиÑке",children:e.jsx(Mt,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"devicesN",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"УÑÑÑойÑÑва â докÑпка ÑлоÑов ÑвеÑÑ
ÑаÑиÑа",children:e.jsx(Ln,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"revCents",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"ÐÑÑÑÑка за денÑ",children:e.jsx(En,{size:15,strokeWidth:2})})}),e.jsx(w,{k:"avg",cur:le,set:ee,right:!0,children:e.jsx("span",{title:"СÑедний Ñек â вÑÑÑÑка ÷ плаÑежей",children:e.jsx(Fn,{size:15,strokeWidth:2})})})]})}),e.jsxs("tbody",{children:[be(o.revByDay.map(l=>({...l,avg:l.n?l.revCents/l.n:0})),le,"day").map(l=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6},children:new Date(l.day).toLocaleDateString("ru-RU")}),e.jsx("td",{className:"r",style:{color:"var(--violet)"},title:`РегиÑÑÑаÑий за денÑ: ${l.regs||0}`,children:l.regs||0}),e.jsx("td",{className:"r",title:`ÐлаÑежей за денÑ: ${l.n}`,children:l.n}),e.jsx(ce,{n:l.fullN,cents:l.fullCents,money:b,label:"ÐолнÑй ÑаÑиÑ"}),e.jsx(ce,{n:l.trialN,cents:l.trialCents,money:b,label:"ÐÑобнÑй (вÑ
од по лÑгоÑной Ñене)"}),e.jsx(ce,{n:l.trialConvN,cents:l.trialConvCents,money:b,tone:"var(--violet)",label:"Ðз пÑобного в полнÑÑ Ð¾Ð¿Ð»Ð°ÑÑ"}),e.jsx(ce,{n:l.renewN,cents:l.renewCents,money:b,label:"ÐÑодлениÑ"}
56),e.jsx(ce,{n:l.devicesN,cents:l.devicesCents,money:b,dim:!0,label:"ÐокÑпка ÑÑÑÑойÑÑв"}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},title:`ÐÑÑÑÑка: ${b(l.revCents)}`,children:b(l.revCents)}),e.jsx("td",{className:"r dim",title:`СÑедний Ñек: ${b(Math.round(l.avg))}`,children:b(Math.round(l.avg))})]},l.day)),(()=>{const l=o.revByDay.reduce((a,M)=>({n:a.n+(M.n||0),regs:a.regs+(M.regs||0),fullN:a.fullN+(M.fullN||0),fullCents:a.fullCents+(M.fullCents||0),trialN:a.trialN+(M.trialN||0),trialCents:a.trialCents+(M.trialCents||0),trialConvN:a.trialConvN+(M.trialConvN||0),trialConvCents:a.trialConvCents+(M.trialConvCents||0),renewN:a.renewN+(M.renewN||0),renewCents:a.renewCents+(M.renewCents||0),devicesN:a.devicesN+(M.devicesN||0),devicesCents:a.devicesCents+(M.devicesCents||0),revCents:a.revCents+(M.revCents||0)}),{n:0,regs:0,fullN:0,fullCents:0,trialN:0,trialCents:0,trialConvN:0,trialConvCents:0,renewN:0,renewCents:0,devicesN:0,devicesCents:0,revCents:0});return e.jsxs("tr",{style:{borderTop:"2px solid var(--border)",position:"sticky",bottom:0,background:"var(--surface)",fontWeight:600},children:[e.jsxs("td",{style:{padding:6},title:"Ðней, в коÑоÑÑе бÑла Ñ
оÑÑ Ð±Ñ Ð¾Ð´Ð½Ð° оплаÑа или ÑегиÑÑÑаÑиÑ. ÐÑÑÑÑе дни в ÑаблиÑÑ Ð½Ðµ попадаÑÑ.",children:["ÐÑого · ",o.revByDay.length," дн."]}),e.jsx("td",{className:"r",style:{color:"var(--violet)"},title:`РегиÑÑÑаÑий за пеÑиод: ${l.regs}`,children:l.regs}),e.jsx("td",{className:"r",title:`ÐлаÑежей за пеÑиод: ${l.n}`,children:l.n}),e.jsx(ce,{n:l.fullN,cents:l.fullCents,money:b,label:"ÐолнÑй ÑаÑÐ¸Ñ â за пеÑиод"}),e.jsx(ce,{n:l.trialN,cents:l.trialCents,money:b,label:"ÐÑобнÑй â за пеÑиод"}),e.jsx(ce,{n:l.trialConvN,cents:l.trialConvCents,money:b,tone:"var(--violet)",label:"Ðз пÑобного в полнÑÑ Ð¾Ð¿Ð»Ð°ÑÑ â за пеÑиод"}),e.jsx(ce,{n:l.renewN,cents:l.renewCents,money:b,label:"ÐÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ â за пеÑиод"}),e.jsx(ce,{n:l.devicesN,cents:l.devicesCents,money:b,dim:!0,label:"ÐокÑпка ÑÑÑÑойÑÑв â за пеÑиод"}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},title:`ÐÑÑÑÑка за пеÑиод: ${b(l.revCents)}`,children:b(l.revCents)}),e.jsx("td",{className:"r dim",title:"СÑедний Ñек за пеÑиод â вÑÑÑÑка ÷ плаÑежи",children:b(l.n?Math.round(l.revCents/l.n):0)})]})})()]})]})})]}),!!o.movement&&e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10},children:["Ðвижение Ð±Ð°Ð·Ñ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(ÑаÑÑÑм или заÑÑкаем оÑÑок)"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(140px,1fr))",gap:10},children:[e.jsx($e,{label:"новÑе",value:o.movement.fresh,tone:"var(--green)"}),e.jsx($e,{label:"веÑнÑлиÑÑ",value:o.movement.back,tone:"var(--cyan)"}),e.jsx($e,{label:"ÑÑли",value:o.movement.gone,tone:o.movement.gone?"var(--coral)":void 0}),e.jsx($e,{label:"quick ratio",value:o.movement.quickRatio==null?"â":o.movement.quickRatio,tone:o.movement.quickRatio==null?void 0:o.movement.quickRatio>=1?"var(--green)":"var(--coral)"}),((R=o.stickiness)==null?void 0:R.pct)!=null&&e.jsx($e,{label:`липкоÑÑÑ DAU/MAU (${o.stickiness.dau}/${o.stickiness.mau})`,value:o.stickiness.pct+"%"})]}),e.jsx("p",{className:"dim",style:{fontSize:12.5,margin:"10px 0 0",lineHeight:1.5,fontWeight:500,color:"var(--muted)"},children:o.movement.quickRatio==null?"ÐикÑо не ÑÑÑл за пеÑиод â quick ratio не опÑеделÑн.":o.movement.quickRatio>=1?`Ðа каждого ÑÑедÑего пÑиÑ
Ð¾Ð´Ð¸Ñ ${o.movement.quickRatio} пÑиÑедÑиÑ
â база ÑаÑÑÑÑ.`:`Ðа каждого ÑÑедÑего пÑиÑ
Ð¾Ð´Ð¸Ñ Ð»Ð¸ÑÑ ${o.movement.quickRatio} â база ÑжимаеÑÑÑ, пÑивлеÑение не покÑÑÐ²Ð°ÐµÑ Ð¾ÑÑок.`}),e.jsxs("div",{className:"dim",style:{fontSize:12,margin:"10px 0 0",lineHeight:1.6},children:[e.jsx("b",{style:{color:"var(--muted)"},children:"Ðак ÑÑиÑаем (по ÑакÑам оплаÑ/подклÑÑений, не по Ð¿Ð¾Ð»Ñ ÑÑаÑÑÑа â reconcile ÑÑÐ°Ð²Ð¸Ñ ÑÑаÑÑÑ Ñ Ð·Ð°Ð´ÐµÑжкой):"}),e.jsxs("div",{style:{marginTop:4},children:["⢠",e.jsx("b",{children:"новÑе"})," â ÑзеÑÑ, ÑÑÑ ",e.jsx("b",{children:"пеÑÐ²Ð°Ñ Ð² иÑÑоÑии"})," ÑÑпеÑÐ½Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа попала в пеÑиод (MIN даÑÑ Ð¾Ð¿Ð»Ð°ÑÑ Ð½Ð° ÑзеÑа)."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"веÑнÑлиÑÑ"})," â плаÑили ",e.jsx("b",{children:"до"})," пеÑиода, поÑом пеÑеÑÑв ",e.jsx("b",{children:">35 дней"})," без оплаÑ, и Ñнова оплаÑили внÑÑÑи пеÑиода (ÑеакÑиваÑиÑ)."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"ÑÑли"})," â подпиÑка ",e.jsx("b",{children:"иÑÑекла"})," внÑÑÑи пеÑиода Ð Ñеловек ",e.jsx("b",{children:"не веÑнÑлÑÑ"})," (Ð½ÐµÑ Ð½Ð¸ одной ÑÑпеÑной оплаÑÑ Ð¿Ð¾Ñле даÑÑ Ð¸ÑÑеÑениÑ)."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"quick ratio"})," = (новÑе + веÑнÑлиÑÑ) ÷ ÑÑли. ",e.jsx("b",{children:">1"})," â ÑаÑÑÑм, ",e.jsx("b",{children:"<1"})," â ÑжимаемÑÑ. ÐеÑÑика из SaaS: показÑÐ²Ð°ÐµÑ Ð·Ð´Ð¾ÑовÑе ÑоÑÑа, а не голое ÑиÑло."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"липкоÑÑÑ DAU/MAU"}
56)," = заÑ
одивÑиÑ
(ÑеалÑно подклÑÑалиÑÑ Ðº ÑеÑвиÑÑ) за ÑÑÑки ÷ за 30 дней. ÐÑÑÐ¾ÐºÐ°Ñ = полÑзÑÑÑÑÑ ÑаÑÑо; Ð¿Ð°Ð´Ð°ÐµÑ ",e.jsx("b",{children:"ÑанÑÑе"}),", Ñем оÑвал виден в денÑгаÑ
â Ñанний Ñигнал оÑÑока."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"ÐÑÑÑÑка везде ÐÐТТÐ"})," â возвÑаÑÑ Ð²ÑÑÑÐµÐ½Ñ Ñой же ÑÑммой, какой пÑиÑли (и ÑаÑÑиÑнÑе Ñоже). СколÑко веÑнÑли за пеÑиод, напиÑано под каÑÑоÑкой «ÐÑÑÑÑка». ÐеÑоÑниÑа Apple не ÑÑиÑаеÑÑÑ Ð½Ð¸Ð³Ð´Ðµ: Ð³Ð¾Ð´Ð¾Ð²Ð°Ñ Ð¿Ð¾Ð´Ð¿Ð¸Ñка пÑодлеваеÑÑÑ Ñам каждÑе ~12 ÑаÑов и бÑла Ð±Ñ ÑиÑÑой вÑдÑмкой."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"УдалÑннÑе аккаÑнÑÑ Ð² поÑокаÑ
пеÑиода ÑÑиÑаÑÑÑÑ."})," Человек пÑиÑÑл и заплаÑил â ÑÑо пÑоизоÑло, и позднее Ñдаление аккаÑнÑа иÑÑоÑÐ¸Ñ Ð½Ðµ пеÑепиÑÑÐ²Ð°ÐµÑ (денÑги Ð¼Ñ Ð½Ðµ веÑнÑли). Ðз «живÑÑ
» ÑÑÑÑÑиков обзоÑа (вÑего ÑзеÑов, акÑивнÑе подпиÑки) ÑдалÑннÑе, наобоÑоÑ, иÑклÑÑÐµÐ½Ñ â Ñам вопÑÐ¾Ñ Â«ÑколÑко еÑÑÑ ÑейÑаÑ», а не «ÑÑо ÑлÑÑилоÑÑ Ð·Ð° пеÑиод»."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"ÐоÑÐµÐ¼Ñ Ð²ÑÑÑÑка в ÑаблиÑаÑ
ÑазнаÑ."})," «Ðо иÑÑоÑникÑ» и «Ðо лендингÑ» â ",e.jsx("b",{children:"когоÑÑа"}),": лÑди, коÑоÑÑе ÐÐ ÐШÐРв ÑÑом пеÑиоде, и денÑги, коÑоÑÑе пÑинеÑли они. «ÐÑо пÑивÑл покÑпаÑелÑ» â ",e.jsx("b",{children:"каÑÑа"}),": вÑе ÑÑпеÑнÑе оплаÑÑ Ð¿ÐµÑиода, вклÑÑÐ°Ñ Ð¿ÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ Ð´Ð°Ð²Ð½Ð¸Ñ
клиенÑов. ÐоÑÑÐ¾Ð¼Ñ ÐºÐ°ÑÑа обÑÑно болÑÑе когоÑÑÑ, и ÑÑмма по кодам не обÑзана ÑÑ
одиÑÑÑÑ Ñ Ð¸Ñогом «по иÑÑоÑникÑ». ÐеÑвое оÑвеÑÐ°ÐµÑ Â«ÐºÐ°ÐºÐ¾Ð¹ ÑÑаÑик окÑпаеÑÑÑ», вÑоÑое â «оÑкÑда пÑиÑли денÑги в каÑÑÑ»."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"LTV"})," = вÑÑÑÑка когоÑÑÑ Ã· покÑпаÑели â ÑколÑко в ÑÑеднем пÑинÑÑ Ð¿Ð»Ð°ÑÑÑий. ",e.jsx("b",{children:"ARPU"})," = вÑÑÑÑка когоÑÑÑ Ã· ÑегиÑÑÑаÑии â ÑколÑко пÑинÑÑ ÐºÐ°Ð¶Ð´Ñй пÑиÑедÑий, вклÑÑÐ°Ñ ÑеÑ
, кÑо не заплаÑил. ÐогоÑÑа â пÑиÑедÑие в пеÑиоде, денÑги â иÑ
оплаÑÑ Ð² Ñом же пеÑиоде (Ñ Ð¿ÑодлениÑми, за вÑÑеÑом возвÑаÑов). Ðа коÑоÑком пеÑиоде оба заниженÑ: пÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ ÐµÑÑ Ð½Ðµ наÑÑÑпили â ÑÑавнивайÑе иÑÑоÑники Ð¼ÐµÐ¶Ð´Ñ Ñобой, а Ð´Ð»Ñ Â«ÑколÑко ÑÑÐ¾Ð¸Ñ ÐºÐ»Ð¸ÐµÐ½Ñ» беÑиÑе длиннÑй пеÑиод."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"LTV/CAC"})," (в «Ðо иÑÑоÑникÑ») = ÑÑеднÑÑ Ð²ÑÑÑÑка Ñ Ð¿Ð¾ÐºÑпаÑÐµÐ»Ñ Ð¸ÑÑоÑника ÷ ÑÑеднÑÑ ÐºÐ¾Ð¼Ð¸ÑÑÐ¸Ñ Ð¿Ð°ÑÑнÑÑÑ Ð·Ð° покÑпаÑелÑ. ÐÑÑоÑник â паÑÑнÑÑÑкий код, его комиÑÑÐ¸Ñ â наÑа Ñена пÑивлеÑениÑ; Ñвой ÑÑаÑик без ÑаÑÑ
ода в ÑиÑÑеме показÑÐ²Ð°ÐµÑ Â«â», а не Ð½Ð¾Ð»Ñ â «беÑплаÑнÑÑ
» иÑÑоÑников не ÑиÑÑем. ",e.jsx("b",{children:"â¥3"})," â здоÑÐ¾Ð²Ð°Ñ Ñкономика, ",e.jsx("b",{children:"1â3"})," â на гÑани, ",e.jsx("b",{children:"<1"})," â иÑÑоÑник ÑбÑÑоÑен пеÑвÑм же плаÑежом. Ðаведение на ÑиÑло ÑаÑкÑÑÐ²Ð°ÐµÑ LTV и CAC по оÑделÑноÑÑи."]})]})]}),!!o.trials&&(o.trials.taken>0||o.trials.converted>0)&&e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10},children:["ÐÑобнÑй пеÑиод ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(взÑли пÑобнÑй â доплаÑили полнÑй ÑаÑиÑ)"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))",gap:10},children:[e.jsx($e,{label:"взÑли пÑобнÑй",value:o.trials.taken}),e.jsx($e,{label:`в пÑобнÑй Ð¾Ñ Ñеги (${o.totals.regs})`,value:F(o.trials.taken,o.totals.regs)}),e.jsx($e,{label:"ÑконвеÑÑилиÑÑ",value:o.trials.converted,tone:"var(--green)"}),e.jsx($e,{label:"из пÑобного в плаÑнÑй",value:F(o.trials.converted,o.trials.taken),tone:"var(--green)"}),e.jsx($e,{label:"вÑÑÑÑка Ñ ÐºÐ¾Ð½Ð²ÐµÑÑий",value:b(o.trials.convRevCents)})]}),((ze=o.trialPrices)==null?void 0:ze.length)>1&&e.jsx("div",{style:{overflowX:"auto",marginTop:12},children:e.jsxs("table",{className:"tbl",style:{width:"100%",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:5},children:"Ñена вÑ
ода"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"взÑли"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"доплаÑили"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"конвеÑÑиÑ"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"вÑÑÑÑка Ñ Ð½Ð¸Ñ
"})]})}),e.jsx("tbody",{children:o.trialPrices.map(l=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:5,fontWeight:600},children:b(l.amountCents)}),e.jsx("td",{style:{padding:5,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:l.n}),e.jsx("td",{style:{padding:5,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:l.converted}),e.jsx("td",{style:{padding:5,textAlign:"right",color:"var(--green)"},children:F(l.converted,l.n)}),e.jsx("td",{style:{padding:5,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:b(l.convRevCents)})]},l.amountCents))})]})}),o.trials.taken>o.trials.converted&&e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"10px 0 0"},children:["Ðе доплаÑили: ",o.trials.taken-o.trials.converted," â ÑпиÑание идÑÑ Ð·Ð° 4 ÑаÑа до конÑа пÑобного днÑ, ÑаÑÑÑ ÐµÑÑ Ð² пÑоÑеÑÑе."]})]}),!!o.rebills&&(((ke=o.rebills.cohort)==null?void 0:ke.length)>0||o.rebills.newCount>0)&&(()=>{const l=o.rebills,a=l.cohort||[],M=Math.max(1,...a.map(S=>S.count)),f=S=>S==null?"var(--muted)":S>=60?"var(--green)":S>=40?"var(--amber)":"var(--coral)";return e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10},children:["Ð ÐµÐ±Ð¸Ð»Ñ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(ÑдеÑжание за вÑÑ Ð²ÑÐµÐ¼Ñ Â· % = доÑли из подоÑедÑиÑ
к ÑÑокÑ)"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))",gap:10,marginBottom:a.length?16:0},children:[e.jsx($e,{label:"новÑе покÑпки",value:l.newCount,tone:"var(--cyan)"}),e.jsx($e,{label:"вÑÑÑÑка новÑÑ
",value:b(l.newRevCents)}),e.jsx($e,{label:"пÑодлениÑ",value:l.rebillCount,tone:"var(--green)"}),e.jsx($e,{label:"вÑÑÑÑка пÑодлений",value:b(l.rebillRevCents),tone:"var(--green)"}),e.jsx($e,{label:"доÑли до 1-го пÑодлениÑ",value:l.firstRebillPct==null?"â":l.firstRebillPct+"%",tone:f(l.firstRebillPct)})]}),a.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(S=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:13},children:[e.jsxs("span",{className:"dim",style:{width:92,flex:"none"},children:[S.cycle,"-е пÑодление"]}),e.jsx("div",{style:{flex:1,background:"var(--surface-2)",borderRadius:6,overflow:"hidden",height:22},children:e.jsx("div",{style:{width:`${Math.max(4,S.count/M*100)}%`,height:"100%",background:"linear-gradient(90deg,var(--green),var(--cyan))",borderRadius:6}})}),e.jsx("span",{title:"Ð´Ð¾Ð»Ñ Ð´Ð¾ÑедÑиÑ
из ÑеÑ
, Ñ ÐºÐ¾Ð³Ð¾ ÑÑок Ñже конÑилÑÑ",style:{width:48,flex:"none",textAlign:"right",fontWeight:700,color:f(S.ratePct)},children:S.ratePct==null?"â":S.ratePct+"%"}),e.jsx("span",{style:{width:46,flex:"none",textAlign:"right",fontWeight:700},children:S.count})]},S.cycle))}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:14,lineHeight:1.5},children:[e.jsx("b",{children:"Ðак ÑÑо ÑÑиÑаеÑÑÑ (важно):"}),e.jsxs("div",{children:["⢠ÐеÑÑ Ð±Ð»Ð¾Ðº â ",e.jsx("b",{children:"ÐÐ ÐСРÐÐ ÐÐЯ"}),", незавиÑимо Ð¾Ñ Ð²ÑбÑанного пеÑиода ввеÑÑ
Ñ. УдеÑжание â ÑвойÑÑво когоÑÑÑ, а не окна: «ÑколÑко из кÑпивÑиÑ
дожили до N-го пÑодлениÑ» Ð¸Ð¼ÐµÐµÑ ÑмÑÑл ÑолÑко Ñеликом."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"ÐолоÑа и ÑиÑло ÑпÑава"})," â ÑколÑко ÑникалÑнÑÑ
клиенÑов ",e.jsx("b",{children:"доÑли до N-го пÑодлениÑ"})," (Ñделали Ñ
оÑÑ Ð±Ñ N пÑодлений). Ðадение Ð¾Ñ Ð¿Ð¾Ð»Ð¾ÑÑ Ðº полоÑе = где оÑваливаÑÑÑÑ."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"% (ÑвеÑной)"})," â ÑеÑÑÐ½Ð°Ñ ÑÑавка ÑдеÑÐ¶Ð°Ð½Ð¸Ñ Ð½Ð° Ñаге: ",e.jsx("b",{children:"доÑедÑие до N ÷ Ñе, ÐºÐ¾Ð¼Ñ Ð¿Ð¾Ñа бÑло пÑодлеваÑÑ"}),". РзнаменаÑеле ",e.jsx("u",{children:"ÑолÑко подоÑедÑие к ÑÑокÑ"})," â Ñ ÐºÐ¾Ð³Ð¾ Ñ Ð¿Ð¾Ñледнего плаÑежа пÑоÑло ⥠35 дней (меÑÑÑ + запаÑ). ÐÑо еÑÑ Ð²Ð½ÑÑÑи оплаÑенного пеÑиода (кÑпил недавно, пÑодлеваÑÑÑÑ Ñано) â в знаменаÑÐµÐ»Ñ ÐРпопадаеÑ: инаÑе пÑоÑÐµÐ½Ñ Ð·Ð°Ð½Ð¸Ð¶Ð°Ð»ÑÑ Ð±Ñ Ñеми, кÑо ÑизиÑеÑки не мог пÑодлиÑÑÑÑ."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"доÑли до 1-го пÑодлениÑ"})," в Ñапке â Ñа же ÑÑавка Ð´Ð»Ñ Ð¿ÐµÑвого ÑаÐ
56³Ð° (кÑпил â пеÑвое пÑодление): главнÑй индикаÑоÑ, доÑ
одÑÑ Ð»Ð¸ новÑе до вÑоÑого плаÑежа."]}),e.jsxs("div",{children:["⢠",e.jsx("b",{children:"новÑе покÑпки / пÑодлениÑ"})," и иÑ
вÑÑÑÑка â ÑÑммаÑнÑе ÑÑÑÑÑики за вÑÑ Ð²ÑÐµÐ¼Ñ (ÑоÑÑ vs ÑдеÑжание)."]}),e.jsx("div",{children:"⢠СÑиÑаеÑÑÑ ÑÑжело (вÑе оплаÑÑ), поÑÑÐ¾Ð¼Ñ ÐºÑÑиÑÑеÑÑÑ Ð½Ð° ÑÐ°Ñ â ÑиÑÑÑ Ð¼Ð¾Ð³ÑÑ Ð¾ÑÑÑаваÑÑ Ð´Ð¾ 60 мин; пеÑиод ввеÑÑ
Ñ Ð½Ð° ÑÑÐ¾Ñ Ð±Ð»Ð¾Ðº не влиÑеÑ."}),e.jsx("div",{style:{marginTop:4},children:"ÐÑÐ¸Ð¼ÐµÑ ÑÑениÑ: «2-е пÑодление 60%» = из ÑеÑ
, Ñ ÐºÐ¾Ð³Ð¾ 2-й ÑÑок Ñже конÑилÑÑ, пÑодлили 60% â здоÑовÑе; «40%» â на ÑÑом Ñаге ÑеÑÑем болÑÑе половинÑ, повод ÑмоÑÑеÑÑ ÑенÑ/оÑÑеÑ."})]})]})})(),!g&&e.jsxs("div",{className:"card pad",style:{marginBottom:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["Ðо иÑÑоÑÐ½Ð¸ÐºÑ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(first-touch · когоÑÑа: кÑо ÐÐ ÐШÐРза пеÑиод)"})]}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("sources",["source","uniques","regs","paid","CR%","revenue","LTV","ARPU"],be(o.sources,V,"source").map(l=>[l.source,l.uniques,l.regs,l.paid,l.uniques||l.regs?(l.paid/(l.uniques||l.regs)*100).toFixed(1):"0",(l.revCents/100).toFixed(2),((l.ltvCents||0)/100).toFixed(2),((l.arpuCents||0)/100).toFixed(2)])),children:"CSV"})]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx(w,{k:"source",cur:V,set:T,children:"иÑÑоÑник"}),e.jsx(w,{k:"uniques",cur:V,set:T,right:!0,children:"Ñники"}),e.jsx(w,{k:"regs",cur:V,set:T,right:!0,children:"Ñеги"}),e.jsx(w,{k:"paid",cur:V,set:T,right:!0,children:"покÑпаÑелей"}),e.jsx(w,{k:"cr",cur:V,set:T,right:!0,children:"CR"}),e.jsx(w,{k:"revCents",cur:V,set:T,right:!0,children:"вÑÑÑÑка когоÑÑÑ"}),e.jsx(w,{k:"ltvCents",cur:V,set:T,right:!0,children:"LTV"}),e.jsx(w,{k:"arpuCents",cur:V,set:T,right:!0,children:"ARPU"}),e.jsx(w,{k:"ltvCac",cur:V,set:T,right:!0,children:"LTV/CAC"})]})}),e.jsxs("tbody",{children:[be(o.sources,V,"source").map(l=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6},children:l.source}),e.jsx("td",{className:"r",children:l.uniques}),e.jsx("td",{className:"r",children:l.regs}),e.jsx("td",{className:"r",style:{color:"var(--green)"},children:l.paid}),e.jsx("td",{className:"r dim",title:ue?Ne:void 0,children:fe(l.paid,l.uniques||l.regs)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(l.revCents)}),e.jsx("td",{className:"r",children:l.paid?b(l.ltvCents):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{className:"r dim",children:l.regs?b(l.arpuCents):"â"}),e.jsx("td",{className:"r",title:l.cacCents?`LTV ${b(l.ltvCents)} · CAC ${b(l.cacCents)}`:"ÑаÑÑ
од по иÑÑоÑÐ½Ð¸ÐºÑ Ð½ÐµÐ¸Ð·Ð²ÐµÑÑен",children:l.ltvCac==null?e.jsx("span",{className:"dim",children:"â"}):e.jsx("span",{style:{color:l.ltvCac>=3?"var(--green)":l.ltvCac>=1?"var(--amber)":"var(--coral)",fontWeight:600},children:l.ltvCac})})]},l.source)),(!o.sources||!o.sources.length)&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:9,style:{padding:10},children:"Ð½ÐµÑ Ð´Ð°Ð½Ð½ÑÑ
â заÑ
Ð¾Ð´Ñ ÐµÑÑ Ð½Ðµ накопилиÑÑ"})})]})]})]}),(()=>{const l=o.acquisition||[],a=new Map;for(const f of l){const S=f.code||"",H=a.get(S)||{code:f.code,buyers:0,payments:0,revCents:0,subs:[]};H.buyers+=f.buyers,H.payments+=f.payments,H.revCents+=f.revCents,H.subs.push(f),a.set(S,H)}const M=[...a.values()].sort((f,S)=>S.revCents-f.revCents);return e.jsxs("div",{className:"card pad",style:{marginBottom:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["ÐÑо пÑивÑл покÑпаÑÐµÐ»Ñ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(каÑÑа: ÐСРоплаÑÑ Ð¿ÐµÑиода, вклÑÑÐ°Ñ ÑÑаÑÑÑ
клиенÑов)"})]}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("acquisition",["code","subid","buyers","payments","revenue"],l.map(f=>[f.code||"оÑганика",f.subid||"",f.buyers,f.payments,(f.revCents/100).toFixed(2)])),children:"CSV"})]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx("th",{style:{padding:6},children:"кÑо пÑивÑл"}),e.jsx("th",{className:"r",style:{padding:6},children:"покÑпаÑелей"}),e.jsx("th",{className:"r",style:{padding:6},children:"оплаÑ"}),e.jsx("th",{className:"r",style:{padding:6},children:"вÑÑÑÑка за пеÑиод"}),e.jsx("th",{className:"r",style:{padding:6},children:"ÑÑедний Ñек"}),e.jsx("th",{className:"r",style:{padding:6},children:"меÑок"})]})}),e.jsxs("tbody",{children:[M.map(f=>e.jsxs(r.Fragment,{children:[e.jsxs("tr",{style:{borderTop:"1px solid var(--border)",cursor:f.subs.length>1?"pointer":"default"},onClick:()=>f.subs.length>1&&q(y===(f.code||"organic")?null:f.code||"organic"),children:[e.jsxs("td",{style:{padding:6,fontWeight:600},children:[f.code||e.jsx("span",{style:{color:"var(--green)"},children:"оÑганика"}),f.subs.length>1&&e.jsx("span",{className:"dim",style:{marginLeft:6,fontSize:12},children:y===(f.code||"organic")?"â¾":"â¸"})]}),e.jsx("td",{className:"r",children:f.buyers}),e.jsx("td",{className:"r",children:f.payments}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(f.revCents)}),e.jsx("td",{className:"r dim",children:f.payments?b(Math.round(f.revCents/f.payments)):"â"}),e.jsx("td",{className:"r dim",children:f.subs.filter(S=>S.subid).length||"â"})]}),y===(f.code||"organic")&&f.subs.slice().sort((S,H)=>H.revCents-S.revCents).slice(0,30).map((S,H)=>e.jsxs("tr",{style:{color:"var(--muted)",fontSize:12.5},children:[e.jsx("td",{style:{padding:"4px 6px 4px 22px"},className:S.subid?"":"dim",children:S.subid||"без меÑки"}),e.jsx("td",{className:"r",children:S.buyers}),e.jsx("td",{className:"r",children:S.payments}),e.jsx("td",{className:"r",children:b(S.revCents)}),e.jsx("td",{}),e.jsx("td",{})]},H))]},f.code||"organic")),!M.length&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:6,style:{padding:10},children:"за пеÑиод Ð¾Ð¿Ð»Ð°Ñ Ð½Ðµ бÑло"})})]})]}),M.some(f=>f.subs.length>20)&&e.jsx("p",{className:"dim",style:{fontSize:12.5,margin:"10px 0 0",lineHeight:1.5},children:"У кода Ñ Ð´ÐµÑÑÑками меÑок вебмаÑÑÐµÑ ÐºÐ»Ð°Ð´ÑÑ Ð² subid иденÑиÑикаÑÐ¾Ñ ÐºÐ»Ð¸ÐºÐ° â Ñогда меÑка пеÑеÑÑаÑÑ Ð±ÑÑÑ ÑÑезом кампании. ÐÐ»Ñ ÐºÐ»Ð¸ÐºÐ° еÑÑÑ Ð¾ÑделÑное поле clickid: оно ÑÑ
Ð¾Ð´Ð¸Ñ Ð² поÑÑбÑк и не Ð»Ð¾Ð¼Ð°ÐµÑ Ð¾ÑÑÑÑ."})]})})(),e.jsxs("div",{className:"card pad",style:{marginBottom:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["Ðо Ð»ÐµÐ½Ð´Ð¸Ð½Ð³Ñ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(пеÑвÑй вÑ
од · когоÑÑа: кÑо ÐÐ ÐШÐРза пеÑиод; не-Ð»ÐµÐ½Ð´Ñ = «без ленда»)"})]}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("landings",["landing","uniques","regs","paid","CR%","revenue","LTV","ARPU"],be(o.landings,L,"landing").map(l=>[l.landing,l.uniques,l.regs,l.paid,l.uniques||l.regs?(l.paid/(l.uniques||l.regs)*100).toFixed(1):"0",(l.revCents/100).toFixed(2),((l.ltvCents||0)/100).toFixed(2),((l.arpuCents||0)/100).toFixed(2)])),children:"CSV"})]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx(w,{k:"landing",cur:L,set:se,children:"лендинг"}),e.jsx(w,{k:"uniques",cur:L,set:se,right:!0,children:"Ñники"}),e.jsx(w,{k:"regs",cur:L,set:se,right:!0,children:"Ñеги"}),e.jsx(w,{k:"paid",cur:L,set:se,right:!0,children:"покÑпаÑелей"}),e.jsx(w,{k:"cr",cur:L,set:se,right:!0,children:"CR"}),e.jsx(w,{k:"revCents",cur:L,set:se,right:!0,children:"вÑÑÑÑка"}),e.jsx(w,{k:"ltvCents",cur:L,set:se,right:!0,children:"LTV"}),e.jsx(w,{k:"arpuCents",cur:L,set:se,right:!0,children:"ARPU"})]})}),e.jsxs("tbody",{children:[pr(be(o.landings,L,"landing")).map(l
56=>e.jsxs(r.Fragment,{children:[e.jsx("tr",{children:e.jsxs("td",{colSpan:8,style:{padding:"12px 6px 4px",fontSize:12,color:"var(--muted)",textTransform:"uppercase",letterSpacing:".06em"},children:[l.title," ",e.jsxs("span",{style:{opacity:.6},children:["· ",l.rows.length]})]})}),l.rows.map(a=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6,fontFamily:"ui-monospace, monospace"},children:Zs(a.landing)?e.jsx("a",{href:Zs(a.landing),target:"_blank",rel:"noopener noreferrer",children:a.landing}):a.landing}),e.jsx("td",{className:"r",children:a.uniques}),e.jsx("td",{className:"r",children:a.regs}),e.jsx("td",{className:"r",style:{color:"var(--green)"},children:a.paid}),e.jsx("td",{className:"r dim",title:ue?Ne:void 0,children:fe(a.paid,a.uniques||a.regs)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(a.revCents)}),e.jsx("td",{className:"r",children:a.paid?b(a.ltvCents):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{className:"r dim",children:a.regs?b(a.arpuCents):"â"})]},a.landing)),l.rows.length>1&&(()=>{const a=en(l.rows);return e.jsxs("tr",{className:"totrow",style:{borderTop:"1px solid var(--border-strong)"},children:[e.jsxs("td",{style:{padding:6,color:"var(--muted)"},children:["иÑого · ",l.title.toLowerCase()]}),e.jsx("td",{className:"r",style:{fontWeight:700},children:a.uniques}),e.jsx("td",{className:"r",style:{fontWeight:700},children:a.regs}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},children:a.paid}),e.jsx("td",{className:"r dim",title:ue?Ne:void 0,children:fe(a.paid,a.base)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(a.revCents)}),e.jsx("td",{className:"r",children:a.paid?b(Math.round(a.revCents/a.paid)):"â"}),e.jsx("td",{className:"r dim",children:a.regs?b(Math.round(a.revCents/a.regs)):"â"})]})})()]},l.title)),!!(o.landings&&o.landings.length)&&(()=>{const l=en(o.landings);return e.jsxs("tr",{className:"totrow",style:{borderTop:"2px solid var(--border-strong)"},children:[e.jsx("td",{style:{padding:"10px 6px",fontWeight:700},children:"вÑего"}),e.jsx("td",{className:"r",style:{fontWeight:700},children:l.uniques}),e.jsx("td",{className:"r",style:{fontWeight:700},children:l.regs}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},children:l.paid}),e.jsx("td",{className:"r dim",title:ue?Ne:void 0,children:fe(l.paid,l.base)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(l.revCents)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:l.paid?b(Math.round(l.revCents/l.paid)):"â"}),e.jsx("td",{className:"r dim",children:l.regs?b(Math.round(l.revCents/l.regs)):"â"})]})})(),(!o.landings||!o.landings.length)&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:8,style:{padding:10},children:"Ð½ÐµÑ Ð´Ð°Ð½Ð½ÑÑ
â заÑ
Ð¾Ð´Ñ ÐµÑÑ Ð½Ðµ накопилиÑÑ"})})]})]})]}),!g&&(()=>{const l=o.variants||[],a=p=>p.replace(/(light|dark)$/,"")||p,M=`https://order.${Xe.registrable}`,f=new Map;for(const p of l){const K=a(String(p.variant||"")),re=f.get(K)||{key:K,uniques:0,starts:0,paid:0,revCents:0,subs:[]};re.uniques+=p.uniques||0,re.starts+=p.starts||0,re.paid+=p.paid||0,re.revCents+=p.revCents||0,re.subs.push(p),f.set(K,re)}const S=[...f.values()].map(p=>({...p,crStart:p.uniques?Math.round(p.starts/p.uniques*1e3)/10:null,crPaid:p.uniques?Math.round(p.paid/p.uniques*1e3)/10:null})),H=p=>`${M}/?v=${encodeURIComponent(p)}&vpreview=1`;return e.jsxs("div",{className:"card pad",style:{marginBottom:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["Ðо ÑÐ°Ð±Ð»Ð¾Ð½Ñ Ð¾Ð¿Ð»Ð°ÑÑ ",e.jsx("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:"(клик по Ð½Ð°Ð·Ð²Ð°Ð½Ð¸Ñ â пÑедпÑоÑмоÑÑ, по ÑÑÑелке â ÑÑÐ¼Ð½Ð°Ñ Ð¸ ÑвеÑÐ»Ð°Ñ Ð¾ÑделÑно)"})]}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("variants",["variant","uniques","started","paid","CR_start%","CR_paid%","revenue"],be(l,U,"variant").map(p=>[p.variant,p.uniques,p.starts,p.paid,p.crStart??0,p.crPaid??0,(p.revCents/100).toFixed(2)])),children:"CSV"})]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx(w,{k:"key",cur:U,set:ne,children:"Ñаблон"}),e.jsx(w,{k:"uniques",cur:U,set:ne,right:!0,children:"видели"}),e.jsx(w,{k:"starts",cur:U,set:ne,right:!0,children:"доÑли"}),e.jsx(w,{k:"paid",cur:U,set:ne,right:!0,children:"покÑпаÑелей"}),e.jsx(w,{k:"crStart",cur:U,set:ne,right:!0,children:"CRâоплаÑÑ"}),e.jsx(w,{k:"crPaid",cur:U,set:ne,right:!0,children:"CR покÑпки"}),e.jsx(w,{k:"revCents",cur:U,set:ne,right:!0,children:"вÑÑÑÑка"})]})}
56),e.jsxs("tbody",{children:[be(S,U,"key").map(p=>e.jsxs(r.Fragment,{children:[e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsxs("td",{style:{padding:6,fontFamily:"ui-monospace, monospace"},children:[e.jsx("a",{href:H(p.key),target:"_blank",rel:"noopener",style:{color:"var(--violet-2)",textDecoration:"none"},children:p.key}),p.subs.length>1&&e.jsx("button",{onClick:()=>oe(P===p.key?null:p.key),title:"ÑÑÐ¼Ð½Ð°Ñ Ð¸ ÑвеÑÐ»Ð°Ñ Ð¿Ð¾ оÑделÑноÑÑи",style:{marginLeft:6,background:"none",border:"none",color:"var(--muted)",cursor:"pointer",font:"inherit",fontSize:12,padding:0},children:P===p.key?"â¾":"â¸"})]}),e.jsx("td",{className:"r",children:p.uniques}),e.jsx("td",{className:"r",children:p.starts}),e.jsx("td",{className:"r",style:{color:"var(--green)"},children:p.paid}),e.jsx("td",{className:"r dim",children:p.crStart==null?"â":p.crStart+"%"}),e.jsx("td",{className:"r dim",children:p.crPaid==null?"â":p.crPaid+"%"}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(p.revCents)})]}),P===p.key&&p.subs.slice().sort((K,re)=>re.uniques-K.uniques).map(K=>e.jsxs("tr",{style:{color:"var(--muted)",fontSize:12.5},children:[e.jsxs("td",{style:{padding:"4px 6px 4px 22px",fontFamily:"ui-monospace, monospace"},children:[e.jsx("a",{href:H(K.variant),target:"_blank",rel:"noopener",style:{color:"inherit"},children:K.variant}),e.jsx("span",{className:"dim",style:{marginLeft:6},children:/(light)$/.test(K.variant)?"ÑвеÑлаÑ":"ÑÑмнаÑ"})]}),e.jsx("td",{className:"r",children:K.uniques}),e.jsx("td",{className:"r",children:K.starts}),e.jsx("td",{className:"r",children:K.paid}),e.jsx("td",{className:"r",children:K.crStart==null?"â":K.crStart+"%"}),e.jsx("td",{className:"r",children:K.crPaid==null?"â":K.crPaid+"%"}),e.jsx("td",{className:"r",children:b(K.revCents)})]},K.variant))]},p.key)),S.length>1&&(()=>{const p=S.reduce((K,re)=>({uniques:K.uniques+(re.uniques||0),starts:K.starts+(re.starts||0),paid:K.paid+(re.paid||0),revCents:K.revCents+(re.revCents||0)}),{uniques:0,starts:0,paid:0,revCents:0});return e.jsxs("tr",{className:"totrow",style:{borderTop:"2px solid var(--border-strong)"},children:[e.jsx("td",{style:{padding:"10px 6px",fontWeight:700},children:"вÑего"}),e.jsx("td",{className:"r",style:{fontWeight:700},children:p.uniques}),e.jsx("td",{className:"r",style:{fontWeight:700},children:p.starts}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},children:p.paid}),e.jsx("td",{className:"r dim",children:F(p.starts,p.uniques)}),e.jsx("td",{className:"r dim",children:F(p.paid,p.uniques)}),e.jsx("td",{className:"r",style:{fontWeight:700},children:b(p.revCents)})]})})(),!S.length&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:7,style:{padding:10},children:"Ð½ÐµÑ Ð´Ð°Ð½Ð½ÑÑ
â заÑ
Ð¾Ð´Ñ Ð¿Ð¾ Ñаблонам еÑÑ Ð½Ðµ накопилиÑÑ"})})]})]})]})})(),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["ÐаÑегалиÑÑ, но не кÑпили ",e.jsxs("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:["(",((Le=o.notBought)==null?void 0:Le.length)||0,") â база Ð´Ð»Ñ ÑеÑаÑгеÑа"]})]}),!!((Ee=o.notBought)!=null&&Ee.length)&&e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("not-bought",["email","registered"],o.notBought.map(l=>[l.email||l.id,new Date(l.createdAt).toISOString().slice(0,10)])),children:"CSV"})]}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:e.jsxs("tbody",{children:[(o.notBought||[]).slice(0,100).map(l=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6},children:l.email||l.id.slice(0,8)}),e.jsx("td",{className:"dim r",children:new Date(l.createdAt).toLocaleDateString("ru-RU")}),e.jsx("td",{className:"r",children:l.email&&e.jsx("a",{href:"mailto:"+l.email,style:{color:"var(--violet-2)",fontSize:12.5},children:"напиÑаÑÑ"})})]},l.id)),(!o.notBought||!o.notBought.length)&&e.jsx("tr",{children:e.jsx("td",{className:"dim",style:{padding:10},children:"вÑе заÑегавÑиеÑÑ ÐºÑпили ð"})})]})})]}),!!((Fe=o.churned)!=null&&Fe.length)&&e.jsxs("div",{className:"card pad",style:{marginTop:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{children:["УÑедÑие ",e.jsxs("span",{className:"dim",style:{fontSize:12,fontWeight:400},children:["(",o.churned.length,") â подпиÑка конÑилаÑÑ Ð¸ не пÑодлена, база Ð´Ð»Ñ winback"]})]}),e.jsx("button",{className:"btn btn--ghost",style:{marginLeft:"auto",padding:"5px 10px",fontSize:12},onClick:()=>d("churned",["email","plan","expired","last_online"],o.churned.map(l=>[l.email,l.plan||"",new Date(l.expiresAt).toISOString().slice(0,10),l.lastOnlineAt?new Date(l.lastOnlineAt).toISOString().slice(0,10):""])),children:"CSV"})]}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"}
56,children:e.jsx("tbody",{children:o.churned.slice(0,100).map(l=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6},children:l.email}),e.jsx("td",{className:"dim",children:l.plan||"â"}),e.jsx("td",{className:"dim r",title:"когда конÑилаÑÑ Ð¿Ð¾Ð´Ð¿Ð¸Ñка",children:new Date(l.expiresAt).toLocaleDateString("ru-RU")}),e.jsx("td",{className:"dim r",title:"поÑледний онлайн",children:l.lastOnlineAt?new Date(l.lastOnlineAt).toLocaleDateString("ru-RU"):"â"}),e.jsx("td",{className:"r",children:e.jsx("a",{href:"mailto:"+l.email,style:{color:"var(--violet-2)",fontSize:12.5},children:"напиÑаÑÑ"})})]},l.id))})})]})]})]})}function ir({api:s}){var l;const[t,m]=r.useState([]),[n,x]=r.useState(""),[i,C]=r.useState(!1),[u,k]=r.useState(!1),[g,I]=r.useState({email:"",plan:"pro",period:"1y"}),[E,X]=r.useState(""),[D,W]=r.useState({key:"created",dir:"desc"}),[o,N]=r.useState(!1),[v,_]=r.useState(""),[B,Q]=r.useState([]),[A,$]=r.useState([]),[V,T]=r.useState(""),[y,q]=r.useState([]);r.useEffect(()=>{let a=!0;return s("/partner/admin/list").then(M=>{a&&Q(((M==null?void 0:M.partners)||[]).filter(f=>f.code))}).catch(()=>{}),s("/admin/nx-codes").then(M=>{a&&$((M==null?void 0:M.codes)||[])}).catch(()=>{}),()=>{a=!1}},[]),r.useEffect(()=>{let a=!0;return s("/admin/user-subids"+(v&&v!=="-"?"?partner="+encodeURIComponent(v):"")).then(M=>{a&&q((M==null?void 0:M.subids)||[])}).catch(()=>{a&&q([])}),()=>{a=!1}},[v]);const[P,oe]=r.useState([]),L=r.useRef(0),se=(a=0,M=!1,f,S,H,p,K)=>{k(!0);const re=++L.current,je=f||D,c=S===void 0?o:S,te=H===void 0?v:H,ve=(K===void 0?n:K).trim(),Se=new URLSearchParams;ve&&Se.set("q",ve),a&&Se.set("offset",String(a)),(je.key!=="created"||je.dir!=="desc")&&(Se.set("sort",je.key),Se.set("dir",je.dir)),c&&Se.set("paid","1"),te&&Se.set("partner",te);const pe=p===void 0?V:p;return pe&&Se.set("subid",pe),s("/admin/users"+(Se.toString()?"?"+Se:"")).then(Re=>{re===L.current&&(m(Ie=>M?[...Ie,...Re.users||[]]:Re.users||[]),C(!!Re.hasMore))}).catch(()=>{}).finally(()=>{re===L.current&&k(!1)})};r.useEffect(()=>{se(0)},[]);const U=r.useRef(null),ne=a=>{clearTimeout(U.current),U.current=setTimeout(()=>{if(se(0,!1,void 0,void 0,void 0,void 0,a),a.includes("@")&&a.trim().length>5){const M=L.current;s("/admin/users/similar?email="+encodeURIComponent(a.trim())).then(f=>{M===L.current&&oe(f.similar||[])}).catch(()=>{M===L.current&&oe([])})}else oe([])},350)};r.useEffect(()=>()=>clearTimeout(U.current),[]);const le=t,ee=()=>{const M=[["email","telegram","plan","status","autoRenew","expiresAt","createdAt"].join(";"),...t.map(S=>{var H,p,K;return[S.email||S.deletedEmail||S.id,S.telegramUsername?"@"+S.telegramUsername:S.hasTelegram?"id:"+S.telegramId:"",((H=S.subscription)==null?void 0:H.plan)||"",((p=S.subscription)==null?void 0:p.status)||"",S.autoRenew?"1":"0",(K=S.subscription)!=null&&K.expiresAt?new Date(S.subscription.expiresAt).toISOString().slice(0,10):"",new Date(S.createdAt).toISOString()].join(";")})].join(` 57`),f=document.createElement("a");f.href=URL.createObjectURL(new Blob(["\uFEFF"+M],{type:"text/csv;charset=utf-8"})),f.download="users.csv",document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(f.href),1e3)},[be,w]=r.useState(!1),d=r.useRef(null),b=a=>{d.current=null,I(a)},F=async()=>{var a;if(!be){w(!0),X(""),d.current||(d.current=((a=crypto.randomUUID)==null?void 0:a.call(crypto))||Date.now().toString(36)+Math.random().toString(36).slice(2,12));try{await s("/admin/grant",{...g,requestId:d.current}),d.current=null,X("ÐÑдано â"),se()}catch(M){X("ÐÑибка: "+M.message)}finally{w(!1)}}},Z=async a=>{if(confirm(`ÐÑозваÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ ${a}?`))try{await s("/admin/revoke",{email:a}),se()}catch(M){alert("ÐÑибка: "+M.message)}},xe=async a=>{try{const M=await s("/admin/impersonate",{userId:a.id});M!=null&&M.url?window.open(M.url,"_blank","noopener"):(M==null?void 0:M.error)==="two_factor"?alert("У полÑзоваÑÐµÐ»Ñ Ð²ÐºÐ»ÑÑена двÑÑ ÑакÑоÑÐ½Ð°Ñ Ð°ÑÑенÑиÑикаÑÐ¸Ñ â Ð²Ñ Ð¾Ð´ под ним недоÑÑÑпен. ÐаннÑе аккаÑнÑа ÑмоÑÑиÑе ÑеÑез «УпÑавление»."):alert("ÐÐµÑ email â magic-логин недоÑÑÑпен")}catch(M){alert("ÐÑибка: "+M.message)}},[ue,Ne]=r.useState(null),[fe,ce]=r.useState(null),[Be,Ae]=r.useState(""),[Ce,R]=r.useState(!1),[ze,ke]=r.useState(""),Le=fe?String(fe.email||fe.id||"").trim().toLowerCase():"",Ee=!!fe&&!!Le&&Be.trim().toLowerCase()===Le,Fe=async()=>
57{if(!(!Ee||!fe)){R(!0),ke("");try{await s("/admin/delete-user",{userId:fe.id,confirm:Be.trim()}),ce(null),Ae(""),se()}catch(a){ke((a==null?void 0:a.message)||"ÐÑибка")}finally{R(!1)}}};return e.jsxs(e.Fragment,{children:[ue&&e.jsx(Ht,{api:s,userId:ue.id,email:ue.email,onClose:()=>Ne(null),onChanged:se}),e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:10},children:"ÐÑдаÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ"}),e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{style:{...We,flex:2,minWidth:200},placeholder:"email",value:g.email,onChange:a=>b({...g,email:a.target.value})}),e.jsxs("select",{style:{...We,flex:1},value:g.plan,onChange:a=>b({...g,plan:a.target.value}),children:[e.jsx("option",{value:"start",children:"start"}),e.jsx("option",{value:"pro",children:"pro"}),e.jsx("option",{value:"plus",children:"plus"})]}),e.jsxs("select",{style:{...We,flex:1},value:g.period,onChange:a=>b({...g,period:a.target.value}),children:[e.jsx("option",{value:"mo",children:"1 меÑ"}),e.jsx("option",{value:"1y",children:"1 год"}),e.jsx("option",{value:"2y",children:"2 года"})]}),e.jsx("button",{className:"btn",disabled:be,onClick:F,children:be?"ÐÑдаÑâ¦":"ÐÑдаÑÑ"}),E&&e.jsx("span",{className:"dim",style:{fontSize:13},children:E})]})]}),e.jsxs("div",{className:"atools",children:[e.jsx("input",{className:"atools__q",style:We,placeholder:"ÐоиÑк по emailâ¦",value:n,onChange:a=>{x(a.target.value),ne(a.target.value)},onKeyDown:a=>{a.key==="Enter"&&se(0)}}),e.jsxs("div",{className:"atools__btns",children:[e.jsx("button",{className:"btn",style:{padding:9},onClick:()=>se(0),title:"ÐайÑи","aria-label":"ÐайÑи",children:e.jsx(us,{size:16,strokeWidth:2.2})}),e.jsx(vt,{onClick:()=>se(0)}),e.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:7,fontSize:12.5,color:"var(--muted)",cursor:"pointer",whiteSpace:"nowrap"},title:"ÐоказÑваÑÑ ÑолÑко ÑеÑ
, Ñ ÐºÐ¾Ð³Ð¾ еÑÑÑ ÑÑпеÑнÑй плаÑÑж",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:a=>{N(a.target.checked),se(0,!1,void 0,a.target.checked)}}),"ÑолÑко покÑпавÑие"]}),e.jsxs("select",{style:{...We,padding:"8px 10px",fontSize:12.5,maxWidth:190},value:v,onChange:a=>{_(a.target.value),T(""),se(0,!1,void 0,void 0,a.target.value,"")},title:"Чей ÑÑаÑик",children:[e.jsx("option",{value:"",children:"вÑе паÑÑнÑÑÑ"}),e.jsx("option",{value:"-",children:"без паÑÑнÑÑа (Ñвои)"}),B.map(a=>e.jsxs("option",{value:a.code,children:[a.code,a.contact?" · "+String(a.contact).slice(0,18):""]},a.code)),!!A.length&&e.jsx("optgroup",{label:"nexora",children:A.map(a=>e.jsx("option",{value:"nx:"+a.code,children:as(a)},"nx:"+a.code))})]}),e.jsxs("select",{style:{...We,padding:"8px 10px",fontSize:12.5,maxWidth:190},value:V,onChange:a=>{T(a.target.value),se(0,!1,void 0,void 0,void 0,a.target.value)},title:"ÐеÑка кампании (subid)",children:[e.jsx("option",{value:"",children:"вÑе меÑки"}),e.jsx("option",{value:"-",children:"без меÑки"}),y.map(a=>e.jsxs("option",{value:a.subid,children:[String(a.subid).slice(0,22)," · ",a.n]},a.subid))]}),!!t.length&&e.jsx("button",{className:"btn btn--ghost",style:{padding:"9px 14px",fontSize:12.5},onClick:ee,children:"CSV"})]})]}),!!P.length&&e.jsxs("div",{className:"card pad",style:{marginBottom:10,borderColor:"var(--amber)"},children:[e.jsxs("div",{style:{fontWeight:700,fontSize:13.5,marginBottom:6},children:["ÐоÑ
ожие адÑеÑа ",e.jsx("span",{className:"dim",style:{fontWeight:400,fontSize:12},children:"â возможно, ÑÐ¾Ñ Ð¶Ðµ Ñеловек плаÑил оÑÑÑда"})]}),P.map(a=>{var M;return e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",padding:"4px 0",fontSize:13},children:[e.jsx("button",{onClick:()=>{x(a.email),ne(a.email)},title:"иÑкаÑÑ ÑÑÐ¾Ñ Ð°Ð´ÑеÑ",style:{background:"none",border:"none",padding:0,font:"inherit",color:"var(--violet-2)",cursor:"pointer",fontWeight:600},children:a.email}),e.jsx("span",{className:"dim",children:((M=a.subscription)==null?void 0:M.status)==="active"?`${a.subscription.plan} · до ${new Date(a.subscription.expiresAt).toLocaleDateString("ru-RU")}`:"без подпиÑки"}),e.jsx("span",{className:"dim",children:a.paidCount?`оплаÑ: ${a.paidCount}
57 · ${(a.paidCents/100).toLocaleString("ru-RU",{maximumFractionDigits:0})} â½`:"не плаÑил"}),e.jsxs("span",{className:"dim",style:{marginLeft:"auto",fontSize:12},children:["Ñег ",new Date(a.createdAt).toLocaleDateString("ru-RU")]})]},a.id)})]}),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[[["email","email"],["tg","tg"],["plan","ÑаÑиÑ"],["status","ÑÑаÑÑÑ"],["auto","авÑо"],["until","до"],["created","Ñега"]].map(([a,M],f)=>{const S=D.key===a,H={key:a,dir:S&&D.dir==="desc"?"asc":"desc"};return e.jsxs("th",{style:{padding:f===0?6:void 0,cursor:"pointer",userSelect:"none",color:S?"var(--text)":void 0},title:`СоÑÑиÑоваÑÑ Ð¿Ð¾ «${M}»`,onClick:()=>{W(H),se(0,!1,H)},children:[M,e.jsx("span",{style:{marginLeft:4,opacity:S?.9:.25,fontSize:10},children:S&&D.dir==="asc"?"â²":"â¼"})]},a)}),e.jsx("th",{})]})}),e.jsx("tbody",{children:le.map(a=>{var M,f;return e.jsxs("tr",{style:{borderTop:"1px solid var(--border)",opacity:a.deletedAt?.5:1},children:[e.jsxs("td",{style:{padding:6},children:[a.email||(a.deletedEmail?e.jsx("span",{className:"dim",title:"ÐдÑÐµÑ Ð½Ð° Ð¼Ð¾Ð¼ÐµÐ½Ñ ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ (войÑи по Ð½ÐµÐ¼Ñ Ð½ÐµÐ»ÑзÑ)",children:e.jsx("s",{children:a.deletedEmail})}):e.jsx("span",{className:"dim",title:a.deletedAt?a.deletedBy==="self"?"Удалил ÑÐµÐ±Ñ Ñам":a.deletedBy?"Удалил опеÑаÑоÑ: "+String(a.deletedBy).replace(/^admin:/,""):"ÐÑо Ñдалил â неизвеÑÑно (до поÑÐ²Ð»ÐµÐ½Ð¸Ñ Ð¿Ð¾Ð¼ÐµÑки)":"ÐоÑÑÑ Ñ Ð°ÐºÐºÐ°ÑнÑа неÑ",children:a.hasTelegram?"ÑелегÑам â":a.deletedAt?"â "+a.id.slice(0,8):"без поÑÑÑ"})),a.isAdmin?" ð":"",a.deletedAt?e.jsx("span",{title:"УдалÑн "+new Date(a.deletedAt).toLocaleString(),style:{marginLeft:6,fontSize:11,color:"var(--coral)",border:"1px solid var(--coral)",borderRadius:4,padding:"0 5px"},children:"ÑдалÑн"}):"",a.partner&&e.jsxs("span",{title:a.partner.nx?`nexora · паÑÑнÑÑ ${a.partner.code||"â"}${a.partner.email?" ("+a.partner.email+(a.partner.contact?", "+a.partner.contact:"")+")":""}${a.partner.flow?" · поÑок "+a.partner.flow+(a.partner.flowTitle?" «"+a.partner.flowTitle+"»":""):""}${a.partner.subid?" · меÑка "+a.partner.subid:""}`:`ÐаÑÑнÑÑ ${a.partner.code}${a.partner.subid?" · меÑка "+a.partner.subid:""}`,className:"pbadge",children:[a.partner.nx?"nx · "+(a.partner.flowTitle||a.partner.flow||a.partner.code)+(a.partner.email?" · "+String(a.partner.email).split("@")[0]:""):a.partner.code,a.partner.subid?" · "+String(a.partner.subid):""]})]}),e.jsx("td",{style:{whiteSpace:"nowrap"},children:a.telegramUsername?e.jsxs("a",{href:`https://t.me/${a.telegramUsername}`,target:"_blank",rel:"noopener",style:{color:"var(--violet-2)",fontSize:12.5},children:["@",a.telegramUsername]}):a.hasTelegram?e.jsx("a",{href:`tg://user?id=${a.telegramId}`,title:`Telegram пÑивÑзан, без @username · id ${a.telegramId} · пиÑаÑÑ Ð¼Ð¾Ð¶Ð½Ð¾, Ð±Ð¾Ñ ÑлÑÑ Ð¿Ð¾ chat_id`,style:{color:"var(--green)",fontSize:12.5},children:a.name||"пÑивÑзан"}):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{children:vn((M=a.subscription)==null?void 0:M.plan)}),e.jsx("td",{children:a.subscription?Mi(a.subscription.status):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{children:a.autoRenew?a.hasToken?e.jsx("span",{style:{color:"var(--green)",display:"inline-flex"},title:"ÐвÑопÑодление вклÑÑено, Ñокен/каÑÑа еÑÑÑ","aria-label":"ÐвÑопÑодление вклÑÑено",children:e.jsx(Mt,{size:15,strokeWidth:2.2})}):e.jsx("span",{style:{color:"var(--amber)",display:"inline-flex"},title:"ÐклÑÑено, но Ñокена/каÑÑÑ Ð½ÐµÑ â ÑпиÑаÑÑ Ð½ÐµÑем","aria-label":"ÐвÑопÑодление без Ñокена",children:e.jsx(Un,{size:15,strokeWidth:2.2})}):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{style:{whiteSpace:"nowrap"},children:(()=>{var H;if(!((H=a.subscription)!=null&&H.expiresAt))return e.jsx("span",{className:"dim",children:"â"});const S=Ui(a.subscription.expiresAt);return e.jsx("span",{style:{color:S.color,fontWeight:600},title:S.hint,children:new Date(a.subscription.expiresAt).toLocaleDateString("ru-RU")})})()}),e.jsx("td",{className:"dim",title:new Date(a.createdAt).toLocaleStr
57ing("ru-RU"),children:Me(a.createdAt)}),e.jsxs("td",{style:{whiteSpace:"nowrap"},children:[e.jsx("button",{className:"iconbtn",title:"УпÑавление полÑзоваÑелем","aria-label":"УпÑавление полÑзоваÑелем",onClick:()=>Ne({id:a.id,email:a.email}),children:e.jsx(on,{size:15,strokeWidth:2})}),a.email&&e.jsx("button",{className:"iconbtn",title:"ÐойÑи под полÑзоваÑелем","aria-label":"ÐойÑи под полÑзоваÑелем",onClick:()=>xe(a),children:e.jsx(rn,{size:15,strokeWidth:2})}),((f=a.subscription)==null?void 0:f.status)==="active"&&a.email&&e.jsx("button",{className:"iconbtn iconbtn--danger",title:"ÐÑозваÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ","aria-label":"ÐÑозваÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ",onClick:()=>Z(a.email),children:e.jsx(Ot,{size:15,strokeWidth:2})}),!a.isAdmin&&!a.deletedAt&&e.jsx("button",{className:"iconbtn iconbtn--muted",title:"ÐолноÑÑÑÑ ÑдалиÑÑ ÑзеÑа (нода + ÐÐ)","aria-label":"УдалиÑÑ Ð¿Ð¾Ð»ÑзоваÑелÑ",onClick:()=>{ke(""),Ae(""),ce(a)},children:e.jsx(dn,{size:15,strokeWidth:2})})]})]},a.id)})})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:12,marginTop:12},children:[e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["показано ",t.length]}),i&&e.jsx("button",{className:"btn btn--ghost",disabled:u,onClick:()=>se(t.length,!0),children:u?"â¦":"ÐоказаÑÑ ÐµÑÑ"})]})]}),fe&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>!Ce&&ce(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:460,width:"100%"},onClick:a=>a.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 10px",fontSize:17,color:"var(--coral)"},children:"УдалиÑÑ ÑзеÑа полноÑÑÑÑ?"}),e.jsxs("div",{style:{background:"rgba(255,122,92,0.10)",border:"1px solid rgba(255,122,92,0.3)",borderRadius:8,padding:"10px 12px",fontSize:13,lineHeight:1.5,marginBottom:14},children:[e.jsx("b",{children:fe.email||((l=fe.id)==null?void 0:l.slice(0,8))})," бÑÐ´ÐµÑ ",e.jsx("b",{children:"ÑдалÑн навÑегда"}),": доÑÑÑп на ноде (Remnawave), подпиÑка, плаÑежи, пÑоÑилÑ, ÑеÑÑии, ÑеÑеÑал/паÑÑнÑÑÑкие даннÑе. ÐÑо ",e.jsx("b",{children:"необÑаÑимо"})," и ÐРвозвÑаÑÐ°ÐµÑ Ð´ÐµÐ½Ñги."]}),e.jsxs("label",{className:"dim",style:{display:"block",marginBottom:6,fontSize:13},children:[fe.email?"ÐведиÑе email ÑзеÑа Ð´Ð»Ñ Ð¿Ð¾Ð´ÑвеÑждениÑ":"ÐоÑÑÑ Ð½ÐµÑ â введиÑе id аккаÑнÑа Ð´Ð»Ñ Ð¿Ð¾Ð´ÑвеÑждениÑ",": ",e.jsx("b",{style:{color:"var(--text)"},children:fe.email||fe.id})]}),e.jsx("input",{value:Be,onChange:a=>Ae(a.target.value),autoFocus:!0,placeholder:fe.email||fe.id,style:{...We,width:"100%",marginBottom:12}}),ze&&e.jsxs("p",{style:{color:"var(--coral)",fontSize:13,margin:"0 0 12px"},children:["ÐÑибка: ",ze]}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:Ce,onClick:()=>ce(null),children:"ÐÑмена"}),e.jsx("button",{className:"btn btn--danger btn--sm",disabled:!Ee||Ce,onClick:Fe,children:Ce?"УдалÑÑâ¦":"УдалиÑÑ Ð½Ð°Ð²Ñегда"})]})]})})]})}function gt(s){return Math.max(0,Number(s.amountCents||0)-Math.max(0,Number(s.refundedCents||0)))}function Lt(s){return s.currency?s.currency==="USD"?yn(s.amountCents):`${(s.amountCents/100).toFixed(2)} ${s.currency}`:`${(s.amountCents/100).toFixed(2)} ?`}function jt(s){try{const t=JSON.parse((s==null?void 0:s.meta)||"{}");return[t.method,t.test?"ÑеÑÑ":""].filter(Boolean).join(" · ")||null}catch{return null}}function Qs(s){try{const t=String(JSON.parse((s==null?void 0:s.meta)||"{}").country||"").toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}catch{return null}}const rr=s=>s.replace(/[A-Z]/g,t=>String.fromCodePoint(127397+t.charCodeAt(0))),bt={etoplatezhi:{label:"ÐÑоÐлаÑежи",color:"var(--cyan)"},freekassa:{label:"FreeKassa",color:"var(--amber)"},unitpay:{label:"UnitPay",color:"var(--violet-2)"}
57,stripe:{label:"Stripe",color:"#635BFF"},coingate:{label:"CoinGate",color:"var(--green)"},apple:{label:"App Store",color:"var(--muted)"},lava:{label:"Lava",color:"var(--coral)"}};function ar({id:s}){const t=String(s||"").toLowerCase(),m=bt[t];return t?m?e.jsxs("span",{title:t,style:{display:"inline-flex",alignItems:"center",gap:6,whiteSpace:"nowrap",fontSize:12.5,fontWeight:600,color:"var(--text)"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:2,background:m.color,flex:"none"}}),m.label]}):e.jsx("span",{className:"dim",children:s}):e.jsx("span",{className:"dim",children:"â"})}const it=(()=>{const s={size:13,style:{flex:"none",opacity:.85}},t={icon:e.jsx(Is,{...s}),label:"СÐÐ"},m={icon:e.jsx(It,{...s}),label:"ÐаÑÑа"},n={icon:e.jsx(Dt,{...s}),label:"SberPay"},x={icon:e.jsx(At,{...s}),label:"ЮMoney"};return{"sbp-qr":t,sbp:t,sbp2:t,us_kgt:{icon:e.jsx(Is,{...s}),label:"СÐзÑокен"},card:m,"card-partner":m,"card partner":m,cc:m,sberpay:n,"yoomoney-wallet":x,yoomoney:x,crypto:{icon:e.jsx(ei,{...s}),label:"ÐÑипÑа"},bank_card:m,sberbank:n,yoo_money:x,tinkoff_bank:{icon:e.jsx(Dt,{...s}),label:"Т-Ðанк"},b2b_sberbank:{icon:e.jsx(Dt,{...s}),label:"Ð¡Ð±ÐµÑ Â· B2B"},sber_loan:{icon:e.jsx(Dt,{...s}),label:"ÐÑÐµÐ´Ð¸Ñ Ð¡Ð±ÐµÑа"},installments:{icon:e.jsx(It,{...s}),label:"РаÑÑÑоÑка"},apple_pay:{icon:e.jsx(It,{...s}),label:"Apple Pay"},google_pay:{icon:e.jsx(It,{...s}),label:"Google Pay"},mobile_balance:{icon:e.jsx(At,{...s}),label:"Со ÑÑÑÑа ÑелеÑона"},electronic_certificate:{icon:e.jsx(At,{...s}),label:"СеÑÑиÑикаÑ"},cash:{icon:e.jsx(At,{...s}),label:"ÐалиÑнÑе"}}})();function lr(s){const t=jt(s);if(!t)return"â";const[m,...n]=t.split(" · "),x=it[m]||it[m.toLowerCase()];return x?e.jsxs("span",{title:t,style:{display:"inline-flex",alignItems:"center",gap:5,whiteSpace:"nowrap"},children:[x.icon,x.label,n.length?` · ${n.join(" · ")}`:""]}):t}function ns(s){try{return!!JSON.parse((s==null?void 0:s.meta)||"{}").trial}catch{return!1}}function or({api:s}){var S,H,p,K,re,je;const[t,m]=r.useState([]),[n,x]=r.useState(""),[i,C]=r.useState(null),[u,k]=r.useState(!1),[g,I]=r.useState(""),[E,X]=r.useState(!1),[D,W]=r.useState(null),[o,N]=r.useState(null),[v,_]=r.useState(null),[B,Q]=r.useState(null),A=async c=>{W({loading:!0});try{W(await s("/admin/user/"+c+"/payments"))}catch{W({error:!0})}},[$,V]=r.useState(!0),[T,y]=r.useState(null),q=r.useRef(!1),P=r.useRef(null),oe=async c=>{I(""),X(!1),V(!1),y(null),q.current=!1,P.current=c,C(c);try{const te=await s("/admin/user/"+c.userId+"/payments");if(P.current!==c)return;const ve=((te==null?void 0:te.payments)||[]).filter(Se=>Se.status==="succeeded"&&Se.kind!=="refund").length;y(ve),q.current||V(!c.userDeletedAt&&ve<=1)}catch{}},L=c=>{q.current=!0,V(c)},[se,U]=r.useState(!1),[ne,le]=r.useState(!1),[ee,be]=r.useState(""),[w,d]=r.useState(""),[b,F]=r.useState(""),[Z,xe]=r.useState(!1),[ue,Ne]=r.useState(null),fe=!1,ce=Sn(""),{tzMin:Be,rFrom:Ae,rTo:Ce,qFrom:R,qTo:ze,utc:ke}=ce,Le=r.useRef(0),[Ee,Fe]=r.useState(null),l=(c=n,te=null,ve=!1,Se=!1)=>{Se||le(!0);const pe=++Le.current,Re=new URLSearchParams;return c&&Re.set("q",c),ve&&te&&(Re.set("before",String(te.b)),Re.set("beforeId",te.id)),R&&ze&&(Re.set("from",R),Re.set("to",ze),Re.set("tz",String(Be))),ee&&Re.set("status",ee),w&&Re.set("kind",w),b&&Re.set("method",b),s("/admin/payments"+(Re.toString()?"?"+Re:"")).then(Ie=>{pe===Le.current&&(m(rt=>ve?[...rt,...Ie.payments||[]]:Ie.payments||[]),U(!!Ie.hasMore),Fe(Ie.nextBefore!=null&&Ie.nextBeforeId?{b:Number(Ie.nextBefore),id:String(Ie.nextBeforeId)}:null))}).catch(()=>{}).finally(()=>{Se||le(!1)})};r.useEffect(()=>{l(n)},[R,ze,Be,fe,ee,w,b]),Vt(()=>{t.length<=100&&l(n,null,!1,!0)},[n,R,ze,Be,fe,ee,w,b,t.length,se]);const a=r.useRef(null),M=c=>{clearTimeout(a.current),a.current=setTimeout(()=>l(c.trim(),null,!1),350)};r.useEffect(()=>()=>clearTimeout(a.current),[]);const f=async()=>{var te;const c=i;k(!0),I(""),X(!1);try{await s("/admin/refund",{userId:c.userId,provider:c.provider,txnId:c.txnId,amountCents:gt(c),currency:c.currency,disableSub:$}),C(null),l()}catch(ve){(te=ve==null?void 0:ve.data)!=null&&te.pending?X(!0):I((ve==null?void 0:ve.message)||"ÐÑибка")}finally{k(!1)}};return e.jsxs(e.Fragment,{children:[ue&&e.jsx(Ht,{api:s,userId:ue.i
57d,email:ue.email,onClose:()=>Ne(null),onChanged:()=>l(n)}),e.jsx(wn,{p:ce,busy:ne,allowAll:!0}),(()=>{const c=[ee,w,b].filter(Boolean).length;return e.jsxs("button",{type:"button",className:"pfilters-toggle","aria-expanded":Z,onClick:()=>xe(te=>!te),children:[e.jsx(on,{size:15,strokeWidth:2}),"ФилÑÑÑÑ",c?` · ${c}`:"",e.jsx(Pn,{size:15,strokeWidth:2,style:{marginLeft:"auto",transform:Z?"rotate(180deg)":"none",transition:"transform .15s"}})]})})(),e.jsxs("div",{className:"pfilters"+(Z?"":" pfilters--collapsed"),children:[e.jsx(Oe,{options:[["","ÐÑе"],["ok","УÑпеÑнÑе"],["fail","ÐÑказ"],["expired","ÐÑÑÑк ÑÑÑÑ"],["wait","Ð ÑабоÑе"]],value:ee,onChange:be}),e.jsx("span",{"aria-hidden":!0,className:"pfilters__sep"}),e.jsx(Oe,{options:[["","ÐÑбой Ñип"],["initial","ÐеÑвÑе"],["renewal","ÐÑодлениÑ"],["trial","ÐÑобнÑе"],["extra_devices","УÑÑÑойÑÑва"],["refund","ÐозвÑаÑÑ"]],value:w,onChange:d}),e.jsx("span",{"aria-hidden":!0,className:"pfilters__sep"}),e.jsx(Oe,{options:[["","ÐÑбой ÑпоÑоб"],["sbp","СÐÐ"],["card","ÐаÑÑа"],["sberpay","SberPay"],["yoomoney","ЮMoney"]],value:b,onChange:F})]}),e.jsxs("div",{className:"atools",children:[e.jsx("input",{className:"atools__q",style:We,title:"ÐÑÐµÑ Ð¿Ð¾ вÑей иÑÑоÑии плаÑежей: email, id плаÑежа/опеÑаÑии (external_id / payment_id / txn), id полÑзоваÑелÑ",placeholder:"ÐоиÑк: email / id плаÑежа / txn / ÑÑммаâ¦",value:n,onChange:c=>{x(c.target.value),M(c.target.value)},onKeyDown:c=>{c.key==="Enter"&&l()}}),e.jsxs("div",{className:"atools__btns",children:[e.jsx("button",{className:"btn",style:{padding:9},onClick:()=>l(),title:"ÐайÑи","aria-label":"ÐайÑи",children:e.jsx(us,{size:16,strokeWidth:2.2})}),e.jsx(vt,{onClick:()=>l()}),!!t.length&&e.jsx("button",{className:"btn btn--ghost",style:{padding:"9px 14px",fontSize:12.5},onClick:()=>{const c=Xe.id==="aurora",ve=[["date","email","provider",...c?["country"]:[],"kind","amount","currency","status","plan","period","txn"].join(";"),...t.map(pe=>[new Date(pe.createdAt).toISOString(),pe.email||pe.userDeletedEmail||pe.userId,pe.provider,...c?[Qs(pe)||""]:[],pe.kind||"initial",((pe.amountCents||0)/100).toFixed(2),pe.currency||"",pe.status,pe.plan||"",pe.period||"",pe.txnId||""].join(";"))].join(` 58`),Se=document.createElement("a");Se.href=URL.createObjectURL(new Blob(["\uFEFF"+ve],{type:"text/csv;charset=utf-8"})),Se.download=`payments-${Ae||"all"}_${Ce||""}.csv`,document.body.appendChild(Se),Se.click(),document.body.removeChild(Se),setTimeout(()=>URL.revokeObjectURL(Se.href),1e3)},children:"CSV"})]})]}),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx("th",{style:{padding:6},children:"когда"}),e.jsx("th",{children:"email"}),e.jsx("th",{children:"ÑÑмма"}),e.jsx("th",{children:"ÑаÑиÑ"}),e.jsx("th",{children:"пÑовайдеÑ"}),Xe.id==="aurora"&&e.jsx("th",{children:"ÑÑÑана"}),e.jsx("th",{children:"меÑод"}),e.jsx("th",{children:"Ñип"}),e.jsx("th",{children:"ÑÑаÑÑÑ"}),e.jsx("th",{children:"дейÑÑвиÑ"})]})}),e.jsx("tbody",{children:t.map(c=>{var te,ve;return e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsxs("td",{style:{padding:6},className:"dim",title:new Date(c.createdAt).toLocaleString("ru-RU")+(ke?" (в поÑÑе бÑаÑзеÑа)":""),children:[Me(c.createdAt,ke),ke?" UTC":""]}),e.jsx("td",{children:c.email?e.jsx("button",{type:"button",className:"linkbtn",title:"УпÑавление аккаÑнÑом",onClick:()=>Ne({id:c.userId,email:c.email}),children:c.email}):c.userDeletedEmail?e.jsx("span",{title:"ÐккаÑÐ½Ñ ÑдалÑн â адÑÐµÑ Ð½Ð° Ð¼Ð¾Ð¼ÐµÐ½Ñ ÑдалениÑ",children:e.jsx("s",{className:"dim",children:c.userDeletedEmail})}):e.jsx("button",{type:"button",className:"linkbtn",title:"УпÑавление аккаÑнÑом",onClick:()=>Ne({id:c.userId}),children:(te=c.userId)==null?void 0:te.slice(0,8)})}),e.jsx("td",{style:{fontWeight:700},title:c.currency?void 0:"ÐалÑÑа не запиÑана â ÑÑмма показана как еÑÑÑ",children:Lt(c)}),e.jsx("td",{children:c.plan?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[vn(c.plan),c.period?e.jsx("span",{className:"dim",style:{fontSize:12},children:c.period}):null]}):e.jsx("span",{className:"dim",children:"â"})}),e.jsx("td",{children:e.jsx(ar,{id:c.provider})}),Xe.id==="aurora"&&e.jsx("td",{className:"dim",children:(()=>{const Se=Qs(c);return Se?e.jsxs("span",{title:`СÑÑана: ${Se}`,style:{whiteSpace:"nowrap"},children:[rr(Se)," ",e.jsx("span",{style:{fontSize:12},children:Se})]}):e.jsx("span",{className:"dim",children:"â"})})()}),e.jsx("td",{className:"dim",children:lr(c)}),e.jsxs("td",{className:"dim",children:[Hi(ns(c)?"trial":c.kind),ns(c)&&e.jsx("span",{className:"dim",style:{fontSize:11,marginLeft:6,padding:"1px 5px",borderRadius:4,border:"1px solid rgba(168,85,247,0.4)",color:"#C084FC"},children:"1 денÑ"}),c.kind==="renewal"&&c.status==="succeeded"&&c.renewalNo>0&&e.jsxs("button",{title:"Ðакое ÑÑо пÑодление по ÑÑÑÑÑ. ÐÑкÑÑÑÑ Ð²ÑÑ Ð¸ÑÑоÑÐ¸Ñ Ð¿Ð»Ð°Ñежей и LTV",onClick:()=>c.userId&&A(c.userId),className:"chipb chipb--xs chipb--info",style:{marginLeft:6},children:["#",c.renewalNo]}),c.kind==="renewal"&&c.status==="failed"&&e.jsxs("button",{title:"Ðакое пÑодление ÑоÑвалоÑÑ. ÐÑкÑÑÑÑ Ð¿ÑиÑÐ¸Ð½Ñ Ð¾Ñказа",onClick:()=>N({email:c.email||c.userDeletedEmail||c.userId,list:[{at:c.createdAt,reason:os(c.meta)}],single:!0,flow:c.flow,method:jt(c),provider:c.provider}),className:"chipb chipb--xs chipb--danger",style:{marginLeft:6},children:["#",(c.renewalNo||0)+1]}),c.status==="failed"&&c.priorFails>0&&e.jsxs("button",{title:"ÐовÑоÑнÑе попÑÑки ÑÑого же ÑпиÑÐ°Ð½Ð¸Ñ â показаÑÑ Ð¿ÑиÑинÑ",onClick:()=>N({email:c.email||c.userDeletedEmail||c.userId,list:ts(c.priorFailsInfo)}),className:"chipb chipb--xs chipb--warn",style:{marginLeft:6},children:["â»",c.priorFails+1]}),c.status==="succeeded"&&c.priorFails>0&&e.jsxs("button",{title:"ÐоказаÑÑ, поÑÐµÐ¼Ñ Ð½Ðµ пÑоÑли пÑедÑдÑÑие попÑÑки",onClick:()=>N({email:c.email||c.userDeletedEmail||c.userId,list:ts(c.priorFailsInfo)}),className:"chipb chipb--xs chipb--warn",style:{marginLeft:6},children:["â»",c.priorFails+1]}),c.refundedAt>0&&e.jsxs("button",{title:`ÐозвÑÐ°Ñ ${De(c.refundedCents,c.currency)} · ${Me(c.refundedAt,ke)}${Bt(c.refundInfo)?" · "+Bt(c.refundInfo):""}. ÐÑкÑÑÑÑ Ð¸ÑÑоÑÐ¸Ñ Ð¿Ð»Ð°Ñежей.`,onClick:()=>c.userId&&A(c.userId),className:"chipb chipb--xs chipb--danger",style:{marginLeft:6},children:["â©",c.refundedCents<c.amountCents?" "+De(c.refundedCents,c.currency):""]})]}),e.jsx("td",{children:c.refundedAt>0&&c.refundedCents>=c.amountCents?Vs(!1,Ze("refunded"),Ze("refunded")):c.status==="created"||c.status==="expired"?e.jsxs("button",{title:"ÐоказаÑÑ Ð·Ð°Ñ Ð¾Ð´Ñ Ð½Ð° оплаÑÑ: меÑод, пÑоÑеÑÑинг, Ñем законÑилÑÑ",onClick:()=>Q({email:c.email||c.userDeletedEmail||c.userId,list:c.flow||[],paidAt:null,currency:c.currency}),className:"chipb",children:[c.status==="created"?e.jsx(Mn,{size:12,strokeWidth:2.2}):e.jsx(Ut,{size:12,strokeWidth:2.2}),c.status==="created"?"Ñоздан":"иÑÑÑк"]}):c.status==="failed"&&Wi(c.meta)?e.jsxs("button",{title:"ÐоказаÑÑ Ð´ÐµÑали ÑÑÑÑа",onClick:()=>_({email:c.email||c.userDeletedEmail||c.userId,invoicedAt:c.invoicedAt,at:c.createdAt,amountCents:c.amountCents,currency:c.currency,method:jt(c),provider:c.provider,plan:c.plan,peri
58od:c.period}),className:"chipb",children:[e.jsx(Ut,{size:12,strokeWidth:2.2}),"иÑÑÑк"]}):c.status==="failed"?e.jsxs("button",{title:"ÐоказаÑÑ Ð¿ÑиÑÐ¸Ð½Ñ Ð¾Ñказа",onClick:()=>N({email:c.email||c.userDeletedEmail||c.userId,list:[{at:c.createdAt,reason:os(c.meta)}],single:!0,flow:c.flow,method:jt(c),provider:c.provider}),className:"chipb chipb--danger",children:[e.jsx(Pt,{size:12,strokeWidth:2.2}),Ze("failed")]}):c.status==="succeeded"?e.jsxs("button",{title:"ÐоказаÑÑ Ð²ÑÑ Ð¸ÑÑоÑÐ¸Ñ Ð¿Ð»Ð°Ñежа: ÑÑеÑа, попÑÑки, оплаÑа, возвÑаÑ",onClick:()=>Q({email:c.email||c.userDeletedEmail||c.userId,list:c.flow||[],paidAt:c.createdAt,currency:c.currency,amountCents:c.amountCents,method:jt(c),provider:c.provider,fails:ts(c.priorFailsInfo),refundedAt:c.refundedAt,refundedCents:c.refundedCents,refundInfo:c.refundInfo}),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:6,fontSize:12,fontWeight:600,cursor:"pointer",color:"var(--green)",background:"rgba(52,211,153,0.12)",border:"1px solid rgba(52,211,153,0.35)"},children:[e.jsx(qt,{size:12,strokeWidth:2.2}),Ze("succeeded"),(((ve=c.flow)==null?void 0:ve.length)||0)>1?" · "+c.flow.length:""]}):Vs(c.status==="succeeded",Ze("succeeded"),Ze(c.status))}),e.jsx("td",{children:c.status==="succeeded"&&(c.kind==="initial"||c.kind==="renewal")&&(c.refundedAt>0&&c.refundedCents>=c.amountCents?e.jsx("span",{className:"dim",style:{display:"inline-flex"},"aria-label":"ÐозвÑаÑено",title:`ÐозвÑаÑено ${De(c.refundedCents,c.currency)} · ${Me(c.refundedAt,ke)}`,children:e.jsx(cn,{size:15,strokeWidth:2})}):c.provider==="apple"?e.jsx("span",{className:"dim",style:{fontSize:12},title:"ÐозвÑÐ°Ñ Ð¿Ð¾ покÑпке в App Store Ð´ÐµÐ»Ð°ÐµÑ Apple. ÐÑ Ð¿Ð¾Ð»ÑÑаем Ñведомление и оÑклÑÑаем подпиÑÐºÑ Ð°Ð²ÑомаÑиÑеÑки.",children:"ÑеÑез Apple"}):e.jsx("button",{className:"iconbtn iconbtn--danger","aria-label":"ÐозвÑаÑ",title:c.userDeletedAt?"ÐозвÑаÑ. ÐккаÑÐ½Ñ ÑдалÑн: веÑнÑм денÑги и запиÑем в ledger, оÑклÑÑаÑÑ Ð½ÐµÑего":"ÐозвÑаÑ",onClick:()=>{oe(c)},children:e.jsx(ps,{size:15,strokeWidth:2})}))})]},c.id)})})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:12,marginTop:12},children:[e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["показано ",t.length]}),se&&e.jsx("button",{className:"btn btn--ghost",disabled:ne,onClick:()=>l(n,Ee,!0),children:ne?"â¦":"ÐоказаÑÑ ÐµÑÑ"})]})]}),v&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>_(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:520,width:"100%"},onClick:c=>c.stopPropagation(),children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:4},children:"СÑÑÑ Ð¸ÑÑÑк неоплаÑеннÑм"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 14px"},children:[v.email," · денег не ÑпиÑÑвали"]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"8px 14px",fontSize:14},children:[e.jsx("span",{className:"dim",children:"СÑÑÑ Ð²ÑÑÑавлен"}),e.jsx("span",{children:v.invoicedAt?new Date(v.invoicedAt).toLocaleString("ru-RU"):"â"}),e.jsx("span",{className:"dim",children:"ÐÑÑÑк"}),e.jsx("span",{children:new Date(v.at).toLocaleString("ru-RU")}),e.jsx("span",{className:"dim",children:"СÑмма"}),e.jsx("span",{children:De(v.amountCents,v.currency)}),e.jsx("span",{className:"dim",children:"ТаÑиÑ"}),e.jsxs("span",{children:[v.plan||"â",v.period?"/"+v.period:""]}),e.jsx("span",{className:"dim",children:"ÐеÑод"}),e.jsx("span",{children:v.method||"â"})]}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,marginTop:14,marginBottom:0},children:[Ls(v.provider,v.method)," Человек не оплаÑил â ÑаÑÑо поÑомÑ, ÑÑо веÑнÑлÑÑ Ð¸ заплаÑил дÑÑгим ÑпоÑобом."]}),e.jsx("button",{className:"btn btn--ghost",style:{marginTop:12},onClick:()=>_(null),children:"ÐакÑÑÑÑ"})]})}),B&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>Q(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:640,width:"100%",maxHeight:"82vh",overflowY:"auto"},onClick:c=>c.stopPropagation(),children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:4},children:B.paidAt?"ÐÑÑоÑÐ¸Ñ Ð¿Ð»Ð°Ñежа":"ÐаÑ
Ð¾Ð´Ñ Ð½Ð° оплаÑÑ"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 14px"},children:[B.email," · заÑ
одов: ",B.list.length,B.paidAt?", денÑги пÑиÑли":", денег пока неÑ"]}),e.jsx("div",{style:{display:"grid",gap:2,marginBottom:14},children:[...B.list.flatMap(c=>{var te,ve;return[{at:c.createdAt,t:`ÑÑÑÑ Ð²ÑÑÑавлен · ${((te=it[c.method])==null?void 0:te.label)||c.method||"меÑод не Ñказан"} · ${((ve=bt[c.provider])==null?void 0:ve.label)||c.provider||"â"}`,c:"var(--muted)",url:c.payUrl},...c.stageAt?[{at:c.stageAt,t:c.stage==="shown"?"Ñеловек оÑкÑÑл плаÑÑжнÑÑ ÑÑÑаниÑÑ, код показан":"банк наÑал пÑоводиÑÑ",c:"var(--muted)"}]:[]]}),...(B.fails||[]).map(c=>({at:c.at,t:`попÑÑка не пÑоÑла · ${c.reason.text}`,c:"var(--coral)"})),...B.paidAt?[{at:B.paidAt,t:`денÑги пÑиÑли${B.amountCents?" · "+De(B.amountCents,B.currency):""}`,c:"var(--green)",bold:!0}]:[],...B.refundedAt?[{at:B.refundedAt,t:`возвÑаÑ${B.refundedCents?" · "+De(B.refundedCents,B.currency):""}${Bt(B.refundInfo)?" · "+Bt(B.refundInfo):""}`,c:"var(--coral)"}]:[]].sort((c,te)=>(c.at||0)-(te.at||0)).map((c,te)=>e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13.5,padding:"4px 0",color:c.c,fontWeight:c.bold?700:400},children:[e.jsx("span",{className:"dim",style:{minWidth:112,flex:"none"},children:c.at?Me(c.at,ke):"â"}),e.jsxs("span",{style:{whiteSpace:"normal"},children:[c.t,c.url&&e.jsx("a",{href:c.url,target:"_blank",rel:"noopener",style:{marginLeft:8,color:"var(--violet-2)"},children:"оÑкÑÑÑÑ ÑÑÑÑ â"})]})]},te))}),e.jsx("p",{className:"dim",style:{fontSize:12.5,marginTop:0,marginBottom:0,lineHeight:1.5},children:B.paidAt?"ÐаÑ
Ð¾Ð´Ñ Ð±ÐµÐ· денег â не поÑеÑÑ: Ñеловек ÑаÑе вÑего возвÑаÑалÑÑ Ð¸ плаÑил дÑÑгим ÑпоÑобом. СмоÑÑеÑÑ ÑÑÐ¾Ð¸Ñ Ð½Ð° меÑод, Ñ ÐºÐ¾ÑоÑого ÑÑ
одÑÑ.":Ls((S=B.list[B.list.length-1])==null?void 0:S.provider,(H=B.list[B.list.length-1])==null?void 0:H.method)}),e.jsx("button",{className:"btn btn--ghost",style:{marginTop:12},onClick:()=>Q(null),children:"ÐакÑÑÑÑ"})]})}),o&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>N(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:620,width:"100%",maxHeight:"82vh",overflowY:"auto"},onClick:c=>c.stopPropagation(),children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:4},children:o.single?"ÐоÑÐµÐ¼Ñ Ð½Ðµ пÑоÑло ÑпиÑание":"ÐеÑдаÑнÑе попÑÑки ÑпиÑаниÑ"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 14px"},children:[o.email,o.single?" · денÑги ÐÐ ÑпиÑанÑ":" · ÑпиÑание в иÑоге пÑоÑло"]}),!!((p=o.flow)!=null&&p.length)&&e.jsxs("div",{style:{marginBottom:14,padding:"10px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border)"},children:[e.jsx("div",{className:"dim",style:{fontSize:11.5,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",marginBottom:8},children:"ЧÑо бÑло Ñо ÑÑÑÑом"}),[...o.flow].sort((c,te)=>c.createdAt-te.createdAt).map((c,te)=>{var ve,Se;return e.jsxs(r.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13,padding:"3px 0"},children:[e.jsx("span",{className:"dim",style:{minWidth:108},children:Me(c.createdAt,ke)}),e.jsxs("span",{children:["ÑÑÑÑ Ð²ÑÑÑавлен · ",((ve=it[c.method])==null?void 0:ve.label)||c.method||"меÑод не Ñказан"," · ",((Se=bt[c.provider])==null?void 0:Se.label)||c.provider]})]}),c.stageAt&&e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13,padding:"3px 0"},children:[e.jsx("span",{className:"dim",style:{minWidth:108},children:Me(c.stageAt,ke)}),e.jsx("span",{children:c.stage==="shown"?"Ñеловек оÑкÑÑл плаÑÑжнÑÑ ÑÑÑаниÑÑ, код показан":"банк наÑал пÑоводиÑÑ"})]})]},te)}),((K=o.list[0])==null?void 0:K.at)&&e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13,padding:"3px 0",color:"var(--coral)"},children:[e.jsx("span",{style:{minWidth:108,opacity:.8},children:Me(o.list[0].at,ke)}),e.jsxs("span",{children:["оÑказ",(re=o.flow[0])!=null&&re.createdAt?` · ÑеÑез ${Math.max(1,Math.round((o.list[0].at-Math.min(...o.flow.map(c=>c.createdAt)))/6e4))} мин поÑле вÑÑÑавлениÑ`:""]})]})]}),!o.list.length&&e.jsx("p",{className:"dim",style:{margin:0},children:"ÐÑиÑÐ¸Ð½Ñ Ð½Ðµ ÑоÑ
ÑанилиÑÑ."}),o.list.map((c,te)=>e.jsxs("div",{style:{borderTop:te?"1px solid var(--border)":"none",padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"baseline",flexWrap:"wrap"},children:[e.jsx("span",{className:"dim",style:{fontSize:12.5}
58,children:c.at?new Date(c.at).toLocaleString("ru-RU"):"â"}),e.jsx("span",{style:{fontSize:11,fontWeight:700,padding:"1px 7px",borderRadius:4,color:c.reason.ours?"var(--coral)":"var(--amber)",background:c.reason.ours?"rgba(255,122,92,0.10)":"rgba(245,166,35,0.10)",border:"1px solid "+(c.reason.ours?"rgba(255,122,92,0.35)":"rgba(245,166,35,0.35)")},children:c.reason.ours?"наÑа оÑибка":"оÑказ пÑоÑеÑÑинга"})]}),e.jsx("div",{style:{fontSize:14,marginTop:6},children:c.reason.text}),c.reason.raw&&c.reason.raw!==c.reason.text&&e.jsx("div",{className:"dim",style:{fontSize:12,marginTop:4,fontFamily:"ui-monospace, monospace",wordBreak:"break-word"},children:c.reason.raw})]},te)),e.jsx("button",{className:"btn btn--ghost",style:{marginTop:12},onClick:()=>N(null),children:"ÐакÑÑÑÑ"})]})}),D&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>W(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:720,width:"100%",maxHeight:"82vh",overflowY:"auto"},onClick:c=>c.stopPropagation(),children:[D.loading&&e.jsx("p",{className:"dim",style:{margin:0},children:"ÐагÑÑжаÑâ¦"}),D.error&&e.jsx("p",{className:"err",style:{margin:0},children:"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¸ÑÑоÑиÑ."}),D.payments&&e.jsxs(e.Fragment,{children:[e.jsxs("h3",{style:{margin:"0 0 4px",fontSize:17,overflowWrap:"anywhere"},children:[D.user.email||D.user.id.slice(0,8),D.user.deleted&&e.jsx("span",{style:{marginLeft:8,fontSize:11,color:"var(--coral)",border:"1px solid var(--coral)",borderRadius:4,padding:"0 5px"},children:"ÑдалÑн"})]}),e.jsxs("p",{className:"dim",style:{margin:"0 0 12px",fontSize:12.5},children:["Ñ ",D.user.createdAt?new Date(D.user.createdAt).toLocaleDateString("ru-RU"):"â"," · плаÑежей ",D.payments.length]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(130px,1fr))",gap:10,marginBottom:14},children:[e.jsx($e,{label:"LTV (за вÑÑеÑом возвÑаÑов)",value:De(D.ltvCents,D.currency),tone:"var(--green)"}),e.jsx($e,{label:"пÑодлений",value:D.renewals})]}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:e.jsxs("tbody",{children:[D.payments.map(c=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)",opacity:c.status==="succeeded"?1:.55},children:[e.jsx("td",{className:"dim",style:{padding:5,whiteSpace:"nowrap"},children:new Date(c.createdAt).toLocaleString("ru-RU")}),e.jsx("td",{className:"dim",children:ns(c)?"ÑÑиал":ls(c.kind)}),e.jsxs("td",{className:"dim",children:[c.plan||"â",c.period?"/"+c.period:""]}),e.jsx("td",{className:"dim",children:c.provider||"â"}),e.jsx("td",{className:"r",style:{fontWeight:700,whiteSpace:"nowrap"},children:De(c.amountCents,c.currency||D.currency)}),e.jsx("td",{className:"r dim",children:Ze(c.status)})]},c.id)),D.payments.length===0&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:6,style:{padding:8},children:"ÐлаÑежей неÑ."})})]})}),e.jsx("div",{style:{marginTop:14},children:e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>W(null),children:"ÐакÑÑÑÑ"})})]})]})}),i&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:16},onClick:()=>!u&&C(null),children:e.jsxs("div",{className:"modal pad",style:{maxWidth:460,width:"100%"},onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 10px",fontSize:17,color:"var(--coral)"},children:"ÐеÑнÑÑÑ Ð¿Ð»Ð°ÑÑж?"}),e.jsxs("p",{style:{margin:"0 0 12px",fontSize:14},children:[e.jsx("b",{children:Lt({...i,amountCents:gt(i)})}),gt(i)<i.amountCents&&e.jsxs("span",{className:"dim",children:[" (оÑÑаÑок из ",Lt(i),")"]})," ","· ",i.email||((je=i.userId)==null?void 0:je.slice(0,8))," · ",i.provider]}),i.feePct>0&&e.jsxs("p",{style:{margin:"0 0 12px",padding:"8px 10px",borderRadius:8,background:"rgba(255,122,92,0.10)",border:"1px solid rgba(255,122,92,0.30
58)",fontSize:12.5,lineHeight:1.5},children:["ÐомиÑÑÐ¸Ñ Ð¿ÑоÑеÑÑинга ",e.jsxs("b",{children:[i.feePct,"%"]})," пÑи возвÑаÑе не возвÑаÑаеÑÑÑ. ÐÐ»Ð¸ÐµÐ½Ñ Ð¿Ð¾Ð»ÑÑÐ¸Ñ ",e.jsx("b",{children:Lt({...i,amountCents:gt(i)})}),", наÑа поÑеÑÑ â ",e.jsx("b",{children:De(Math.round(gt(i)+i.amountCents*i.feePct/100),i.currency)}),"."]}),e.jsxs("div",{style:{fontSize:12.5,color:"var(--muted)",marginBottom:6},children:["У ÑзеÑа ÑÑпеÑнÑÑ Ð¿Ð»Ð°Ñежей: ",e.jsx("b",{style:{color:"var(--text)"},children:T??"â¦"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:12},children:[e.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",cursor:"pointer",fontSize:13,lineHeight:1.45},children:[e.jsx("input",{type:"radio",name:"refmode",checked:!$,onChange:()=>L(!1),style:{marginTop:3}}),e.jsxs("span",{children:[e.jsx("b",{children:"ÐеÑнÑÑÑ ÑолÑко ÑÑÐ¾Ñ Ð¿Ð»Ð°ÑÑж"})," â подпиÑка оÑÑаÑÑÑÑ Ð°ÐºÑивной. ÐаÑим комиÑÑÐ¸Ñ ÑÑого плаÑежа. ÐÐ»Ñ ÑлÑÑайного дÑблÑ."]})]}),e.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",cursor:"pointer",fontSize:13,lineHeight:1.45},children:[e.jsx("input",{type:"radio",name:"refmode",checked:$,onChange:()=>L(!0),style:{marginTop:3}}),e.jsxs("span",{children:[e.jsx("b",{children:"ÐолнÑй возвÑÐ°Ñ + оÑклÑÑиÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑкÑ"})," â доÑÑÑп к ÑеÑвиÑÑ, авÑопÑодление, ÑеÑеÑал/паÑÑнÑÑÑÐºÐ°Ñ ÐºÐ¾Ð¼Ð¸ÑÑиÑ. ÐÑклÑÑаеÑÑÑ ",e.jsx("b",{children:"вÑÑ"})," подпиÑка."]})]})]}),e.jsx("div",{style:{background:"rgba(255,122,92,0.10)",border:"1px solid rgba(255,122,92,0.3)",borderRadius:8,padding:"10px 12px",fontSize:13,lineHeight:1.5,marginBottom:14},children:$?e.jsxs(e.Fragment,{children:["ÐенÑги веÑнÑÑÑÑ ÑеÑез ",e.jsx("b",{children:i.provider}),", подпиÑка ",e.jsx("b",{children:"полноÑÑÑÑ Ð¾ÑклÑÑиÑÑÑ"}),", не ÑолÑко ÑÑÐ¾Ñ Ð¿Ð»Ð°ÑÑж. ÐейÑÑвие ",e.jsx("b",{children:"необÑаÑимо"}),"."]}):e.jsxs(e.Fragment,{children:["ÐенÑги за ",e.jsx("b",{children:"ÑÑÐ¾Ñ Ð¿Ð»Ð°ÑÑж"})," веÑнÑÑÑÑ ÑеÑез ",e.jsx("b",{children:i.provider}),". ÐодпиÑка и доÑÑÑп ",e.jsx("b",{children:"ÑÐ¾Ñ ÑанÑÑÑÑ"}),". ÐейÑÑвие ",e.jsx("b",{children:"необÑаÑимо"}),"."]})}),g&&e.jsxs("p",{style:{color:"var(--coral)",fontSize:13,margin:"0 0 12px"},children:["ÐÑибка: ",g]}),E&&e.jsxs("p",{className:"dim",style:{fontSize:13,lineHeight:1.5,margin:"0 0 12px"},children:["ÐозвÑÐ°Ñ Ð² обÑабоÑке Ñ Ð¿ÑоÑеÑÑинга â ",e.jsx("b",{children:"не повÑоÑÑйÑе"}),". ÐенÑги ÑйдÑÑ ÐºÐ»Ð¸ÐµÐ½ÑÑ, как ÑолÑко пÑоÑеÑÑинг подÑвеÑдиÑ; ÑÑÑока возвÑаÑа поÑвиÑÑÑ Ð² ленÑе Ñама."]}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:u,onClick:()=>{C(null),E&&l()},children:E?"ÐакÑÑÑÑ":"ÐÑмена"}),!E&&e.jsx("button",{className:"btn btn--danger btn--sm",disabled:u,onClick:f,children:u?"ÐозвÑаÑâ¦":$?"ÐеÑнÑÑÑ Ð´ÐµÐ½Ñги и оÑклÑÑиÑÑ":"ÐеÑнÑÑÑ Ð¿Ð»Ð°ÑÑж"})]})]})})]})}function dr({api:s}){var Ce,R,ze,ke,Le,Ee,Fe,l,a,M;const[t,m]=r.useState([]),[n,x]=r.useState(null),[i,C]=r.useState(""),[u,k]=r.useState([]),[g,I]=r.useState(!1),E=r.useRef(!1),[X,D]=r.useState(""),[W,o]=r.useState({}),[N,v]=r.useState({}),[_,B]=r.useState(!1),[Q,A]=r.useState(null),[$,V]=r.useState(null),[T,y]=r.useState(!1),[q,P]=r.useState(""),oe=()=>s("/admin/tickets").then(f=>m(f.tickets||[])).catch(()=>{}),L=()=>s("/admin/supportcfg").then(A).catch(()=>{}),se=async f=>{const S=await s("/admin/supportcfg",f).catch(()=>null);S!=null&&S.cfg&&A(H=>({...H,cfg:S.cfg})),L()},U=r.useMemo(()=>q?t.filter(f=>{const S=ds(f);return q==="closed"?S.done:S.done?!1:q==="mine"?S.mine:q==="bot"?f.lastActor==="ai":!S.mine&&f.lastActor!=="ai"}):t,[t,q]),ne=()=>location.hash.replace(/^#/,"").split("/")[1]||"",le=f=>{try{history.replaceState(null,"","#tickets/"+f)}catch{}return s(`/admin/tickets/${f}`).then(x).catch(()=>{})},ee=()=>{x(null);try{history.replaceState(null,"","#tickets")}catch{}oe()},[be,w]=r.useState(!1),d=async(f,S)=>{if(!be){w(!0);try{await b(f,S)}finally{w(!1)}}},b=async(f,S)=>{var je,c;const H=await s(`/admin/users/merge-plan?from=${encodeURIComponent(f.id)}&to=${encodeURIComponent(S.userId)}`).catch(()=>null);if(!H)return alert("Ðе ÑдалоÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ Ð¿Ð»Ð°Ð½ ÑлиÑниÑ");if((je=H.blockers)!=null&&je.length)return alert(`СлиÑÑ Ð½ÐµÐ»ÑзÑ: 59· `+H.blockers.join(` 60· `));const p=Object.entries(H.counts||{}).filter(([,te])=>te>0).map(([te,ve])=>`${te}: ${ve}`).join(", ")||"ниÑего, кÑоме Ñамого аккаÑнÑа",K=prompt(`ÐеÑенеÑÑи Ñ ${H.fromEmail} на ${H.toEmail}. 61ÐеÑеедеÑ: ${p}. 62ÐккаÑÐ½Ñ ${H.fromEmail} ÑÑÐ°Ð½ÐµÑ Ð·Ð°ÐºÑÑÑÑм. 63 64ÐÐ»Ñ Ð¿Ð¾Ð´ÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ Ð½Ð°Ð¿ÐµÑаÑайÑе адÑеÑ, Ñ ÐºÐ¾ÑоÑого пеÑеноÑим:`);if(!K)return;const re=await s("/admin/users/merge",{from:f.id,to:S.userId,confirmEmail:K}
64).catch(te=>({error:String((te==null?void 0:te.message)||te),...(te==null?void 0:te.data)||{}}));if(re!=null&&re.error){const te=re.expected?`адÑÐµÑ Ð½Ðµ Ñовпал, ожидалÑÑ ${re.expected}`:(c=re.blockers)!=null&&c.length?re.blockers.join("; "):re.error;return alert("Ðе ÑлилоÑÑ: "+te)}alert("ÐоÑово. ÐлаÑежи и подпиÑка ÑепеÑÑ Ð½Ð° "+H.toEmail),le(n.ticket.id)};r.useEffect(()=>{oe(),L();const f=ne();f&&le(f)},[]);const F=r.useRef(null),Z=r.useRef({id:"",n:0}),xe=r.useRef(!0);r.useEffect(()=>{const f=()=>{xe.current=window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-160};return window.addEventListener("scroll",f,{passive:!0}),()=>window.removeEventListener("scroll",f)},[]),r.useEffect(()=>{var p;const f=((p=n==null?void 0:n.ticket)==null?void 0:p.id)||"",S=((n==null?void 0:n.messages)||[]).length;if(!f){Z.current={id:"",n:0};return}if(!S)return;const H=Z.current.id!==f;!H&&S===Z.current.n||(Z.current={id:f,n:S},(H||xe.current)&&requestAnimationFrame(()=>{var K;return(K=F.current)==null?void 0:K.scrollIntoView({block:"end",behavior:H?"auto":"smooth"})}))},[(Ce=n==null?void 0:n.ticket)==null?void 0:Ce.id,((n==null?void 0:n.messages)||[]).length]),r.useEffect(()=>{if(!n)return;const f=n.ticket.id,S=setInterval(()=>s(`/admin/tickets/${f}`).then(x).catch(()=>{}),7e3);return()=>clearInterval(S)},[n==null?void 0:n.ticket.id]);const ue=async(f,S,H)=>{const p=await s("/admin/translate",{text:f,to:S,messageId:H}).catch(()=>null);return{text:String((p==null?void 0:p.text)||""),from:p!=null&&p.from?String(p.from):null}},Ne=f=>{const S=(f.match(new RegExp("\\p{L}","gu"))||[]).length;return S<8?!0:(f.match(/[а-ÑÑÐ-ЯÐ]/g)||[]).length/S>.3};r.useEffect(()=>{const f=((n==null?void 0:n.messages)||[]).filter(S=>S.bodyRu&&S.bodyRu!=="â");f.length&&(o(S=>{const H={...S};for(const p of f)H[p.id]=p.bodyRu;return H}),v(S=>{const H={...S};for(const p of f)p.bodyLang&&(H[p.id]=p.bodyLang);return H}))},[(R=n==null?void 0:n.ticket)==null?void 0:R.id,((n==null?void 0:n.messages)||[]).length]),r.useEffect(()=>{const f=((n==null?void 0:n.messages)||[]).filter(H=>H.body&&!H.bodyRu&&!Ne(H.body)&&!W[H.id]);if(!f.length)return;let S=!1;return(async()=>{for(const H of f.slice(0,12)){const p=await ue(H.body,"ru",H.id);if(S)return;p.text&&o(K=>({...K,[H.id]:p.text})),p.from&&v(K=>({...K,[H.id]:p.from}))}})(),()=>{S=!0}},[(ze=n==null?void 0:n.ticket)==null?void 0:ze.id,((n==null?void 0:n.messages)||[]).length]);const fe=async()=>{var f;if(n){if(u.length){await ce(u);return}if(i.trim()&&!E.current){E.current=!0,I(!0),D("");try{await s(`/admin/tickets/${n.ticket.id}/reply`,{body:i.trim()}),C(""),le(n.ticket.id),oe()}catch(S){D((f=S==null?void 0:S.data)!=null&&f.error?`Ðе оÑпÑавилоÑÑ: ${S.data.error}`:"Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ â попÑобÑйÑе еÑÑ Ñаз")}finally{E.current=!1,I(!1)}}}},ce=async f=>{if(!(!n||!f.length)){I(!0),D("");try{const S=new FormData;for(const K of f.slice(0,5))S.append("file",K);i.trim()&&S.append("body",i.trim());const H=await fetch(`/api/admin/tickets/${n.ticket.id}/files`,{method:"POST",body:S,credentials:"include"}),p=await H.json().catch(()=>({}));if(!H.ok){D((p==null?void 0:p.error)==="too_big"?`Файл болÑÑе ${p.maxMb||5} ÐÐ`:(p==null?void 0:p.error)==="not_an_image"?"Ðе пÑинимаем Ñакой Ñайл â можно png, jpg, gif, webp и pdf":(p==null?void 0:p.error)==="too_many"?`Ðа Ñаз не болÑÑе ${p.max||5} каÑÑинок`:(p==null?void 0:p.error)==="ticket_full"?"Ð ÑикеÑе Ñже ÑлиÑком много вложений":(p==null?void 0:p.error)==="storage_off"?"Ð¥ÑанилиÑе Ñайлов не наÑÑÑоено":"Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ");return}C(""),k([]),await le(n.ticket.id),oe()}catch{D("СеÑÑ Ð½Ðµ оÑвеÑÐ°ÐµÑ â попÑобÑйÑе еÑÑ Ñаз")}finally{I(!1)}}};r.useEffect(()=>{if(!n)return;const f=S=>{if(S.key!=="Enter"||!(S.metaKey||S.ctrlKey))return;const H=S.target;H&&(H.tagName==="INPUT"||H.tagName==="TEXTAREA")||(S.preventDefault(),g||fe())};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)});const Be=async(f=!1)=>{n&&(await s(`/admin/tickets/${n.ticket.id}/status`,{status:"closed",review:f}),ee())},Ae=async f=>{try{const S=await s("/admin/impersonate",{userId:f});S!=null&&S.url?window.open(S.url,"_blank","noopener"):(S==null?void 0:S.error)==="two_factor"?alert("У полÑзоваÑÐµÐ»Ñ Ð²ÐºÐ»ÑÑена двÑÑ
ÑакÑоÑÐ½Ð°Ñ Ð°ÑÑенÑиÑикаÑÐ¸Ñ â вÑ
од под ним недоÑÑÑпен. ÐаннÑе аккаÑнÑа ÑмоÑÑиÑе ÑеÑез «УпÑавление»."):alert("ÐÐµÑ email â magic-логин недоÑÑÑпен")}
64catch(S){alert("ÐÑибка: "+((S==null?void 0:S.message)||S))}};if(n){const f=n.author,S=p=>p==="agent"?"Ð²Ñ (агенÑ)":p==="ai"?"ð¤ боÑ":(f==null?void 0:f.email)||"клиенÑ",H=p=>p==="agent"||p==="ai";return e.jsxs("div",{className:"card pad",children:[$&&e.jsx(Ht,{api:s,userId:$.id,email:$.email,onClose:()=>V(null),onChanged:()=>le(n.ticket.id)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",marginBottom:12},children:[e.jsx("button",{className:"btn btn--ghost btn--xs btn--pill",onClick:ee,children:"â к ÑпиÑкÑ"}),e.jsx("span",{className:"sec-row__t",style:{fontWeight:700},children:n.ticket.subject}),n.ticket.subjectRu&&e.jsxs("span",{className:"dim",style:{fontWeight:400,fontSize:13},children:["· ",n.ticket.subjectRu]}),Hs(n.ticket),e.jsx("span",{title:"нажми â ÑкопиÑоваÑÑ ID ÑикеÑа",onClick:()=>{var p;(p=navigator.clipboard)==null||p.writeText(n.ticket.id),y(!0),setTimeout(()=>y(!1),1500)},style:{marginLeft:"auto",cursor:"pointer",fontSize:12,fontFamily:"monospace",padding:"4px 10px",borderRadius:8,background:T?"rgba(52,211,153,0.18)":"var(--surface-2)",border:"1px solid var(--border-strong)",color:T?"var(--green)":void 0},children:T?"â ÑкопиÑовано":`#${n.ticket.id.slice(0,8)} ð`})]}),f&&e.jsxs("div",{style:{marginTop:12,padding:14,borderRadius:14,background:"var(--surface)",border:"1px solid var(--border)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsx("div",{style:{fontWeight:700,fontSize:15,overflowWrap:"anywhere"},children:f.email||f.userId.slice(0,8)}),e.jsx("button",{className:"btn btn--ghost btn--sm",style:{marginLeft:"auto"},onClick:()=>V({id:f.userId,email:f.email}),children:"УпÑавление"}),e.jsx("button",{className:"btn",style:{padding:"8px 18px",fontSize:13},onClick:()=>Ae(f.userId),children:"ÐойÑи под ÑзеÑом"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(120px,1fr))",gap:8,marginTop:12},children:[e.jsx(ft,{label:"подпиÑка",children:f.plan?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:f.plan})," · ",e.jsx("span",{style:{color:f.subStatus==="active"?"var(--green)":"var(--amber)"},children:f.subStatus==="active"?"акÑивна":f.subStatus||"â"})]}):e.jsx("span",{className:"dim",children:"неÑ"})}),e.jsx(ft,{label:"дейÑÑвÑÐµÑ Ð´Ð¾",children:f.expiresAt?new Date(f.expiresAt).toLocaleDateString("ru-RU"):e.jsx("span",{className:"dim",children:"â"})}),e.jsx(ft,{label:"авÑопÑодление",children:f.autoRenew?e.jsx("span",{style:{color:f.hasToken?"var(--green)":"var(--amber)"},children:f.hasToken?"вкл":"вкл (без Ñокена)"}):e.jsx("span",{className:"dim",children:"вÑкл"})}),e.jsx(ft,{label:"полÑзование",children:f.used?e.jsxs("span",{style:{color:"var(--green)"},title:f.lastOnline?"поÑл. онлайн "+new Date(f.lastOnline).toLocaleString("ru-RU"):"",children:["â заÑ
одил",f.trafficBytes>0?` · ${xs(f.trafficBytes)}`:""]}):e.jsx("span",{style:{color:"var(--amber)"},children:"ни ÑазÑ"})}),e.jsxs(ft,{label:"заплаÑил",children:[(f.paidByCurrency||[]).length?f.paidByCurrency.map(p=>De(p.cents,p.currency)).join(" + "):De(0,(Le=(ke=f.paidByCurrency)==null?void 0:ke[0])==null?void 0:Le.currency)," ",e.jsxs("span",{className:"dim",children:["· ",f.paidCount]})]})]}),!!(n.similar||[]).length&&e.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("div",{className:"dim",style:{fontSize:12,marginBottom:8},children:"ÐоÑ
ожие адÑеÑа"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:(n.similar||[]).map(p=>{var K;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",fontSize:13},children:[e.jsx("span",{style:{overflowWrap:"anywhere",fontWeight:p.paidCount?700:400},children:p.email}),e.jsxs("span",{className:"dim",children:[p.paidCount?`${De(p.paidCents,"RUB")} · ${p.paidCount} опл.`:"без оплаÑ",((K=p.subscription)==null?void 0:K.status)==="active"?" · подпиÑка акÑивна":""]}),e.jsx("button",{className:"btn btn--ghost btn--xs",style:{marginLeft:"auto"},disabled:be,onClick:()=>d(p,f),children:be?"СливаÑâ¦":"СлиÑÑ ÑÑда â"})]}
64,p.id)})})]})]}),e.jsx("div",{style:{margin:"14px 0",display:"flex",flexDirection:"column",gap:10},children:(n.messages||[]).map(p=>e.jsxs("div",{style:{alignSelf:H(p.author)?"flex-end":"flex-start",maxWidth:"80%",minWidth:0,overflowWrap:"anywhere",padding:"10px 14px",borderRadius:12,fontSize:14,background:p.author==="ai"?"rgba(52,211,153,0.13)":p.author==="agent"?"rgba(91,156,255,0.15)":"var(--surface-2)"},children:[e.jsxs("div",{className:"dim",style:{fontSize:11,marginBottom:3},children:[S(p.author)," · ",Me(p.createdAt)]}),e.jsx(Bs,{text:p.body}),W[p.id]&&e.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px dashed var(--border)",fontSize:13,opacity:.85},children:[e.jsx("span",{className:"dim",style:{fontSize:11},children:"пеÑевод"}),e.jsx("div",{style:{marginTop:2},children:e.jsx(Bs,{text:W[p.id]})})]}),e.jsx(hn,{files:p.files||[],size:200})]},p.id))}),e.jsx("textarea",{style:{...We,width:"100%",minHeight:80},value:i,onChange:p=>C(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),g||fe())},onPaste:p=>{var re;const K=[...((re=p.clipboardData)==null?void 0:re.items)||[]].filter(je=>je.kind==="file"&&je.type.startsWith("image/")).map(je=>je.getAsFile()).filter(je=>!!je);K.length&&(p.preventDefault(),k(je=>[...je,...K].slice(0,5)))},placeholder:"оÑвеÑ⦠(каÑÑÐ¸Ð½ÐºÑ Ð¼Ð¾Ð¶Ð½Ð¾ вÑÑавиÑÑ Ð¸Ð· бÑÑеÑа · â/Ctrl+Enter â оÑпÑавиÑÑ)"}),!!u.length&&e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:8},children:u.map((p,K)=>e.jsxs("span",{className:"linkbtn",style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12.5},children:["ð ",p.name||"ÑкÑинÑоÑ"," · ",Math.round(p.size/1024)," ÐÐ",e.jsx("button",{type:"button",className:"linkbtn linkbtn--danger",title:"УбÑаÑÑ",onClick:()=>k(re=>re.filter((je,c)=>c!==K)),children:"Ã"})]},K))}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:"btn btn--sm",onClick:fe,disabled:g||!i.trim()&&!u.length,title:"â/Ctrl + Enter",children:g?"ÐÑпÑавлÑÑâ¦":u.length?`ÐÑвеÑиÑÑ Â· ${u.length} ð`:"ÐÑвеÑиÑÑ"}),n.subNote&&e.jsx("button",{className:"btn btn--sm",style:{background:"var(--green)",color:"#07130E",fontWeight:700},title:`ÐÑÑавиÑÑ Ð² оÑÐ²ÐµÑ ÑÑÑÐ»ÐºÑ Ð¿Ð¾Ð´Ð¿Ð¸Ñки и обÑÑÑнение${n.subUrl?` · ${n.subUrl}`:""}`,onClick:()=>C(p=>(p.trim()?p.replace(/\s+$/,"")+` 65 66`:"")+n.subNote),children:"ð ÐÑÑавиÑÑ ÑÑÑлкÑ-подпиÑкÑ"}),Ps&&e.jsx("button",{className:"btn btn--ghost btn--sm",title:"ÐÑÑавиÑÑ Ð² оÑÐ²ÐµÑ Ð¿Ð¾ÑÑдок возвÑаÑа по оÑеÑÑе (пÑнкÑÑ, ÑоÑма заÑвлениÑ, ÑÑоки)",onClick:()=>C(p=>(p.trim()?p.replace(/\s+$/,"")+` 67 68`:"")+Ps),children:"ð ÐоÑÑдок возвÑаÑа"}),(()=>{var re,je;const p=[...n.messages||[]].reverse().find(c=>c.author==="user");if(!p)return null;const K=N[p.id]||String(((re=n.ticket)==null?void 0:re.lang)||"")||(Ne(p.body)||W[p.id]?"":String(((je=n.author)==null?void 0:je.lang)||""));return!K||K.slice(0,2)==="ru"?null:e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:_||i.trim().length<2,title:`ÐеÑевеÑÑи оÑÐ²ÐµÑ Ð½Ð° ÑзÑк поÑледнего ÑообÑÐµÐ½Ð¸Ñ ÐºÐ»Ð¸ÐµÐ½Ñа (${K})`,onClick:async()=>{B(!0);try{const c=await ue(i.trim(),K);c.text&&C(c.text)}finally{B(!1)}},children:_?"ÐеÑевожÑâ¦":`ð Ðа ÑзÑк клиенÑа (${K})`})})(),e.jsxs("label",{className:"btn btn--ghost btn--sm",style:{cursor:g?"default":"pointer"},children:[g?"ÐÑпÑавлÑÑâ¦":"ð ÐаÑÑинка",e.jsx("input",{type:"file",accept:"image/*,application/pdf",multiple:!0,hidden:!0,disabled:g,onChange:p=>{const K=Array.from(p.target.files||[]);p.target.value="",k(re=>[...re,...K].slice(0,5))}})]}),e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>Be(!1),children:"ÐакÑÑÑÑ ÑикеÑ"}),e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>Be(!0),title:"ÐÑпÑÐ°Ð²Ð¸Ñ ÐºÐ»Ð¸ÐµÐ½ÑÑ ÑÑÑлки на Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ñ Ð¸ закÑÐ¾ÐµÑ ÑикеÑ",children:"â ÐакÑÑÑÑ Ð¸ попÑоÑиÑÑ Ð¾ÑзÑв"}),X&&e.jsx("span",{style:{color:"var(--coral)",fontSize:13},children:X})]}),e.jsx("div",{ref:F})]})}return e.jsxs("div",{className:"card pad",children:[Q&&e.jsxs("div",{style:{marginBottom:12,padding:"10px 12px",borderRadius:12,background:"var(--surface)",border:"1px solid var(--border)",fontSize:13},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("b",{style:{flex:1,minWidth:0}
68,children:"ð¤ СаппоÑÑ-агенÑ"}),e.jsx("button",{className:"toggle-pill"+((Ee=Q.cfg)!=null&&Ee.enabled?" is-on":""),onClick:()=>{var f,S,H;confirm(`${(f=Q.cfg)!=null&&f.enabled?"ÐÑклÑÑиÑÑ":"ÐклÑÑиÑÑ"} агенÑа поддеÑжки? 69 70${(S=Q.cfg)!=null&&S.enabled?"ÐбÑаÑÐµÐ½Ð¸Ñ Ð±ÑдÑÑ Ð¶Ð´Ð°ÑÑ Ñеловека â никÑо не оÑвеÑÐ¸Ñ Ð°Ð²ÑомаÑиÑеÑки.":"ÐÐ³ÐµÐ½Ñ Ñнова наÑнÑÑ Ð¾ÑвеÑаÑÑ Ñам, ÑÑжÑлое ÑÑкалиÑоваÑÑ."}`)&&se({enabled:!((H=Q.cfg)!=null&&H.enabled)})},children:(Fe=Q.cfg)!=null&&Fe.enabled?"вклÑÑÑн":"вÑклÑÑен"})]}),e.jsxs("div",{style:{fontSize:12,marginTop:6,lineHeight:1.5},children:[!Q.llmConfigured&&e.jsx("div",{style:{color:"var(--amber)"},children:"â Ð½ÐµÑ LLM-пÑокÑи (LLM_API_URL/KEY) â молÑиÑ"}),Q.llmConfigured&&((l=Q.cfg)==null?void 0:l.enabled)&&e.jsx("div",{style:{color:"var(--green)"},children:"â оÑвеÑÐ°ÐµÑ Ñам, ÑÑжÑлое ÑÑкалиÑÑеÑ"}),e.jsxs("div",{className:"dim",style:{overflowWrap:"anywhere"},children:[(a=Q.cfg)==null?void 0:a.model," · поÑог ",Math.round((((M=Q.cfg)==null?void 0:M.minConfidence)??.6)*100),"%"]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",marginBottom:10},children:[(()=>{const f=p=>{const K=ds(p);return K.done?"closed":K.mine?"mine":p.lastActor==="ai"?"bot":"wait"},S=p=>t.filter(K=>f(K)===p).length;return[["","вÑе","var(--violet)"],["mine","Ð½Ð°Ñ Ñ Ð¾Ð´","var(--red)"],["bot","оÑвеÑил боÑ","var(--green)"],["wait","ждÑм клиенÑа","var(--muted)"],["closed","закÑÑÑ","var(--muted)"]].map(([p,K,re])=>{const je=p===""?t.length:S(p);return e.jsxs("button",{className:"toggle-pill"+(q===p?" is-on":""),style:{borderColor:q===p?re:"var(--line)",fontWeight:q===p?700:400},onClick:()=>P(p),children:[K,je?` · ${je}`:""]},p||"all")})})(),e.jsx("div",{style:{marginLeft:"auto"},children:e.jsx(vt,{onClick:oe})})]}),t.length===0&&e.jsx("p",{className:"dim",children:"ТикеÑов неÑ."}),t.length>0&&U.length===0&&e.jsx("p",{className:"dim",children:"Ð ÑÑом ÑÑезе пÑÑÑо."}),U.map(f=>{var S;return e.jsxs("div",{onClick:()=>le(f.id),style:{display:"flex",gap:10,alignItems:"center",padding:"10px 6px",borderTop:"1px solid var(--border)",cursor:"pointer"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.subject}),f.subjectRu&&e.jsx("div",{className:"dim",style:{fontSize:12.5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.subjectRu}),e.jsxs("div",{className:"dim",style:{fontSize:12,marginTop:2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[f.email||((S=f.userId)==null?void 0:S.slice(0,8))," · ",Me(f.updatedAt)]})]}),e.jsx("span",{style:{flexShrink:0},children:Hs(f)})]},f.id)})]})}function cr({api:s}){const[t,m]=r.useState([]),[n,x]=r.useState("requested"),i=()=>s(`/partner/admin/payouts${n?"?status="+n:""}`).then(g=>m(g.rows||[])).catch(()=>{});r.useEffect(()=>{i()},[n]);const C=(g,I)=>De(g||0,I),u=async(g,I)=>{const E=prompt(I==="paid"?`Ð¥ÐµÑ Ð¿ÐµÑевода или Ð½Ð¾Ð¼ÐµÑ Ð¿Ð»Ð°ÑÑжки Ð´Ð»Ñ ${C(g.amount_cents,g.currency)} â ${g.dest}:`:"ÐÑиÑина оÑказа (ÐµÑ ÑÐ²Ð¸Ð´Ð¸Ñ Ð¿Ð°ÑÑнÑÑ):","");if(E!==null){if(I==="paid"&&!E.trim()){alert("Ðез Ñ ÐµÑа пеÑевода закÑÑваÑÑ Ð½ÐµÐ»ÑзÑ");return}try{await s("/partner/admin/payout/set-status",I==="paid"?{id:g.id,status:I,txn:E.trim()}:{id:g.id,status:I,note:E.trim()})}catch(X){alert(String(X==null?void 0:X.message)==="not_open"?"ÐаÑвка Ñже закÑÑÑа â обновиÑе ÑпиÑок.":"Ðе ÑдалоÑÑ: "+((X==null?void 0:X.message)||"ÑеÑÑ"))}i()}},k={requested:["в ÑабоÑе","var(--amber)"],paid:["вÑплаÑено","var(--green)"],rejected:["оÑклонено","var(--coral)"]};return e.jsxs("div",{className:"card pad",style:{marginBottom:12,overflowX:"auto"},children:[e.jsxs("div",{className:"sec-row__t",style:{marginBottom:10,display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{children:"ÐаÑвки на вÑплаÑÑ"}),t.length>0&&n==="requested"&&e.jsx("span",{className:"chipb",title:"ÐдÑÑ Ð¾Ð±ÑабоÑки",children:t.length}),e.jsxs("select",{value:n,onChange:g=>x(g.target.value),style:{...We,marginLeft:"auto",padding:"5px 9px",fontSize:12.5,width:"auto"},children:[e.jsx("option",{value:"requested",children:"в ÑабоÑе"}),e.jsx("option",{value:"paid",children:"вÑплаÑеннÑе"}),e.jsx("option",{value:"rejected",children:"оÑклонÑннÑе"}),e.jsx("option",{value:"",children:"вÑе"})]}),e.jsx(vt,{onClick:i})]}),t.length?e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:e.jsx("tbody",{children:t.map(g=>{const[I,E]=k[g.status]||[g.status,"var(--muted)"];return e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{className:"dim",style:{padding:8}
70,children:new Date(g.created_at).toLocaleString("ru-RU")}),e.jsx("td",{children:g.email||g.code||"â"}),e.jsx("td",{style:{fontWeight:700},children:C(g.amount_cents,g.currency)}),e.jsx("td",{className:"dim",children:g.method==="usdt"?"USDT":"ÐаÑÑа"}),e.jsx("td",{style:{fontFamily:"ui-monospace, monospace",fontSize:12.5,maxWidth:260,overflow:"hidden",textOverflow:"ellipsis"},title:g.dest,children:g.dest}),e.jsx("td",{style:{color:E},children:I}),e.jsx("td",{className:"dim",style:{maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},title:g.txn||g.note||"",children:g.txn||g.note||""}),e.jsx("td",{style:{textAlign:"right"},children:g.status==="requested"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"linkbtn",onClick:()=>u(g,"paid"),children:"вÑплаÑено"}),e.jsx("button",{className:"linkbtn linkbtn--danger",style:{marginLeft:10},onClick:()=>u(g,"rejected"),children:"оÑклониÑÑ"})]})})]},g.id)})})}):e.jsx("p",{className:"dim",style:{margin:0},children:"ÐаÑвок неÑ."})]})}function mr({api:s}){const[t,m]=r.useState([]),[n,x]=r.useState(null),[i,C]=r.useState(null),[u,k]=r.useState(30),g=()=>s("/partner/admin/list").then(o=>m(o.partners||[])).catch(()=>{});r.useEffect(()=>{g()},[]);const I=async(o,N)=>{await s("/partner/admin/set-status",{id:o,status:N}),g()},E=async(o,N)=>{const v=prompt("СÑавка паÑÑнÑÑа, % Ð¾Ñ Ð¿Ð»Ð°Ñежа (Ñже наÑиÑленнÑе комиÑÑии не пеÑеÑÑиÑÑваÑÑÑÑ):",String(N));if(v==null)return;const _=Number(String(v).replace(",","."));!isFinite(_)||_<0||_>100||(await s("/partner/admin/set-rate",{id:o,ratePercent:_}),g(),n===o&&D(o,!0))},X=async(o,N)=>{const v=prompt("Холд в днÑÑ . ÐÑÑÑо â обÑий ÑÑок, 0 â без Ñ Ð¾Ð»Ð´Ð°:",N==null?"":String(N));if(v===null)return;const _=v.trim()===""?null:Number(v.trim());if(_!==null&&(!isFinite(_)||_<0||_>365)){alert("ÐÑ 0 до 365 или пÑÑÑо");return}await s("/partner/admin/set-hold",{id:o,days:_}),g()},D=async(o,N=!1)=>{if(n===o&&!N){x(null),C(null);return}x(o),C(null);try{C(await s(`/partner/admin/${o}/detail?days=${u}`))}catch{C({error:!0})}};r.useEffect(()=>{n&&D(n,!0)},[u]);const W=o=>De(o||0,i==null?void 0:i.currency);return e.jsxs(e.Fragment,{children:[e.jsx(cr,{api:s}),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:10},children:e.jsx(vt,{onClick:g})}),t.length===0&&e.jsx("p",{className:"dim",children:"ÐаÑвок неÑ."}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:e.jsx("tbody",{children:t.map(o=>{var N;return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{style:{borderTop:"1px solid var(--border)",cursor:"pointer",background:n===o.id?"var(--surface)":void 0},onClick:()=>D(o.id),children:[e.jsxs("td",{style:{padding:8},children:[e.jsx("span",{className:"dim",style:{marginRight:6},children:n===o.id?"â¾":"â¸"}),o.email||"â"]}),e.jsx("td",{className:"dim",style:{maxWidth:260,overflow:"hidden",textOverflow:"ellipsis"},title:o.contact||void 0,children:o.contact||"â"}),e.jsxs("td",{children:[o.rateBps/100,"%"]}),e.jsx("td",{children:Gi(o.status)}),e.jsx("td",{className:"dim",children:new Date(o.createdAt).toLocaleDateString("ru-RU")}),e.jsxs("td",{style:{textAlign:"right"},onClick:v=>v.stopPropagation(),children:[e.jsx("button",{className:"iconbtn",title:"ÐзмениÑÑ ÑÑавкÑ","aria-label":"ÐзмениÑÑ ÑÑавкÑ",onClick:()=>E(o.id,o.rateBps/100),children:e.jsx(qn,{size:15,strokeWidth:2})}),e.jsxs("button",{className:"chipb",style:{marginLeft:6,marginRight:6},title:"СÑок Ñ Ð¾Ð»Ð´Ð° комиÑÑии",onClick:()=>X(o.id,o.holdDays),children:[e.jsx(mn,{size:12,strokeWidth:2.2}),o.holdDays===0?"неÑ":o.holdDays?`${o.holdDays} дн`:"Ñ Ð¾Ð»Ð´"]}),o.status!=="active"&&e.jsx("button",{className:"iconbtn",title:"ÐкÑивиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа","aria-label":"ÐкÑивиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа",onClick:()=>{confirm(`ÐкÑивиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа ${o.email||o.id}? 71 72Ðго ÑÑÑлки наÑнÑÑ ÑÑиÑаÑÑ ÐºÐ¾Ð½Ð²ÐµÑÑии, а комиÑÑÐ¸Ñ â наÑиÑлÑÑÑÑÑ.`)&&I(o.id,"active")},children:e.jsx(cn,{size:15,strokeWidth:2})}),o.status==="active"&&e.jsx("button",{className:"iconbtn iconbtn--danger",title:"ÐаблокиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа","aria-label":"ÐаблокиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа",onClick:()=>{confirm(`ÐаблокиÑоваÑÑ Ð¿Ð°ÑÑнÑÑа ${o.email||o.id}? 73 74ÐаÑиÑÐ»ÐµÐ½Ð¸Ñ Ð¿Ð¾ его ÑÑаÑÐ¸ÐºÑ Ð¾ÑÑановÑÑÑÑ.`)&&I(o.id,"suspended")},children:e.jsx(Ot,{size:15,strokeWidth:2})})]})]}),n===o.id&&e.jsx("tr",{children:e.jsxs("td",{colSpan:6,style:{padding:"4px 8px 18px"},children:[!i&&e.jsx("p",{className:"dim",style:{margin:0},children:"ÐагÑÑжаÑâ¦"}),(i==null?void 0:i.error)&&e.jsx("p",{className:"err",style:{margin:0},children:"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ ÑÑаÑиÑÑикÑ."}),i&&!i.error&&e.jsxs("div",{style:{whiteSpace:"normal"},children:[e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginBottom:10},children:["код ",e.jsx("b",{style:{color:"var(--violet-2)"},children:i.user.code||"â"}),i.user.telegram&&e.jsxs(e.Fragment,{children:[" · @",i.user.telegram]}),i.partner.postbackUrl&&e.jsx(e.Fragment,{children:" · поÑÑбÑк наÑÑÑоен"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(120px,1fr))",gap:10,marginBottom:14},children:[e.jsx($e,{label:"кликов",value:i.clicks}),e.jsx($e,{label:"пÑивÑл ÑзеÑов",value:i.referrals}),e.jsx($e,{label:"конвеÑÑий",value:i.byKind.reduce((v,_)=>v+_.n,0)}),e.jsx($e,{label:"обоÑоÑ",value:W(i.byKind.reduce((v,_)=>v+_.amt,0))}),e.jsx($e,{label:"комиÑÑиÑ",value:W(i.byKind.reduce((v,_)=>v+_.com,0)),tone:"var(--green)"})]}),e.jsx(is,{title:"Ðо ÑипÑ",rows:i.byKind.map(v=>[Os(v.kind),v.n,W(v.com)])}),e.jsx(is,{title:"Ðо ÑÑаÑÑÑÑ Ð²ÑплаÑÑ",rows:[...i.b
74yStatus.map(v=>[qs(v.status),v.n,W(v.com)]),...i.payouts?[["вÑплаÑено",i.payouts.paidCount,W(i.payouts.paidCents)],...i.payouts.openCount?[["в заÑвке",i.payouts.openCount,W(i.payouts.openCents)]]:[],["оÑÑаÑок к вÑплаÑе","â",W(i.payouts.leftCents)]]:[]]}),i.bySubid.length>0&&e.jsx(is,{title:"Ðо subid",rows:i.bySubid.map(v=>[v.subid,v.n,W(v.com)])}),e.jsx(xr,{funnel:i.funnel,days:u,setDays:k,cur:W}),e.jsx("div",{className:"sec-row__t",style:{fontSize:13,margin:"14px 0 6px"},children:"ÐоÑледние конвеÑÑии"}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:e.jsxs("tbody",{children:[i.recent.map((v,_)=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{className:"dim",style:{padding:5},children:new Date(v.created_at).toLocaleString("ru-RU")}),e.jsx("td",{style:{overflowWrap:"anywhere"},children:v.email||"â"}),e.jsx("td",{className:"dim",children:Os(v.kind)}),e.jsx("td",{className:"dim",children:v.subid||"â"}),e.jsx("td",{className:"r",children:W(v.amount_cents)}),e.jsx("td",{className:"r",style:{fontWeight:700,color:"var(--green)"},children:W(v.commission_cents)}),e.jsx("td",{className:"r dim",children:qs(v.status)})]},_)),i.recent.length===0&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:7,style:{padding:8},children:"ÐонвеÑÑий пока неÑ."})})]})}),e.jsxs("div",{className:"sec-row__t",style:{fontSize:13,margin:"14px 0 6px"},children:["ÐоÑÑбÑки",((N=i.postbackStats)==null?void 0:N.length)>0&&e.jsx("span",{className:"dim",style:{fontWeight:400,marginLeft:8},children:i.postbackStats.map(v=>`${Ms(v.slot)}: ${v.ok_n}/${v.n}`).join(" · ")})]}),e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:e.jsxs("tbody",{children:[(i.postbacks||[]).map((v,_)=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{className:"dim",style:{padding:5},children:new Date(v.created_at).toLocaleString("ru-RU")}),e.jsx("td",{className:"dim",children:Ms(v.slot)}),e.jsx("td",{style:{overflowWrap:"anywhere",maxWidth:420},title:v.url,children:String(v.url||"").slice(0,90)}),e.jsx("td",{className:"r dim",children:v.ms!=null?`${v.ms} мÑ`:"â"}),e.jsx("td",{className:"r",style:{fontWeight:700,color:v.ok?"var(--green)":"var(--red)"},children:v.ok?"пÑинÑÑ":v.status?`код ${v.status}`:v.error||"не оÑвеÑил"})]},_)),(i.postbacks||[]).length===0&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:5,style:{padding:8},children:"ÐоÑÑбÑков не бÑло â пÑовеÑÑÑе адÑеÑа и галоÑки ÑобÑÑий."})})]})})]})]})})]},o.id)})})})]})]})}function $e({label:s,value:t,tone:m,hint:n}){const[x,i]=r.useState(!1);return e.jsxs("div",{onClick:()=>n&&i(C=>!C),style:{padding:"8px 10px",borderRadius:10,background:"var(--surface)",border:"1px solid "+(x?"rgba(91,156,255,0.5)":"var(--border)"),cursor:n?"pointer":void 0},children:[e.jsx("div",{style:{fontSize:17,fontWeight:700,color:m||"var(--text)"},children:t}),e.jsxs("div",{className:"dim",style:{fontSize:11.5,display:"flex",alignItems:"center",gap:4},children:[s,n&&e.jsx("span",{style:{opacity:x?1:.5,color:x?"var(--violet-2)":void 0},children:"â"})]}),x&&n&&e.jsx("div",{style:{fontSize:12,lineHeight:1.45,color:"var(--muted)",marginTop:8,paddingTop:8,borderTop:"1px solid var(--border)"},children:n})]})}const hr=`https://lp.${Xe.registrable}`;function Zs(s){const t=String(s||"");return t.startsWith("lp/")?hr+t.slice(2):null}const ur=["vps","vps2"];function en(s){return s.reduce((t,m)=>({uniques:t.uniques+(m.uniques||0),regs:t.regs+(m.regs||0),paid:t.paid+(m.paid||0),revCents:t.revCents+(m.revCents||0),base:t.base+(m.uniques||0||m.regs||0)}),{uniques:0,regs:0,paid:0,revCents:0,base:0})}function pr(s){const t=x=>{const i=String(x||"");if(!i.startsWith("lp/"))return"ÐÑÑмÑе заÑ
одÑ";if(i.startsWith("lp/r/"))return"РейÑинги";if(i.startsWith("lp/q/"))return"ÐвизÑ";if(i.startsWith("lp/s/")){const C=i.slice(5).replace(/\/+$/,"");return ur.includes(C)?"Ðендинги":"ÐоÑода"}return"ÐÑоÑее"},m=["РейÑинги","Ðендинги","ÐвизÑ","ÐоÑода","ÐÑоÑее","ÐÑÑмÑе заÑ
одÑ"],n=new Map;for(const x of s||[]){const i=t(x.landing);n.has(i)||n.set(i,[]),n.get(i).push(x)}return m.filter(x=>n.has(x)).map(x=>({title:x,rows:n.get(x)}
74))}function ft({label:s,children:t}){return e.jsxs("div",{style:{padding:"7px 10px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border)"},children:[e.jsx("div",{className:"dim",style:{fontSize:10.5,textTransform:"uppercase",letterSpacing:.3,marginBottom:3},children:s}),e.jsx("div",{style:{fontSize:13.5,fontWeight:600,overflowWrap:"anywhere"},children:t})]})}function xr({funnel:s,days:t,setDays:m,cur:n}){if(!s)return null;const x=s.total||{},i=u=>u>=60?"var(--green)":u>=35?"var(--amber)":"var(--coral)",C=({label:u,r:k,sub:g})=>e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:g?"5px 5px 5px 18px":5,fontWeight:g?400:700,color:g?"var(--muted)":void 0},children:u}),e.jsx("td",{className:"r dim",children:k.attempts||0}),e.jsx("td",{className:"r",children:k.people||0}),e.jsx("td",{className:"r",children:k.paid||0}),e.jsx("td",{className:"r",style:{fontWeight:700,color:k.people?i(k.conversion):"var(--muted)"},children:k.people?`${k.conversion}%`:"â"}),e.jsx("td",{className:"r dim",title:"конвеÑÑÐ¸Ñ Ð¿Ð¾ попÑÑкам â занижена пеÑебоÑом ÑпоÑобов",children:k.attempts?`${k.conversionAttempts}%`:"â"}),e.jsx("td",{className:"r",style:{fontWeight:g?400:700},children:n(k.revenueCents||0)})]});return e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"14px 0 6px",flexWrap:"wrap"},children:[e.jsx("span",{className:"sec-row__t",style:{fontSize:13},children:"ÐÑÑÑ Ð´Ð¾ оплаÑÑ"}),e.jsx("span",{style:{marginLeft:"auto",display:"flex",gap:6},children:[7,30,90].map(u=>e.jsxs("button",{className:"toggle-pill"+(t===u?" is-on":""),onClick:()=>m(u),children:[u," дней"]},u))})]}),e.jsx("p",{className:"dim",style:{fontSize:12,margin:"0 0 6px"},children:"ÐопÑÑок â вÑе наÑаÑÑе оплаÑÑ; один Ñеловек, пеÑебиÑаÑÑий ÑпоÑобÑ, Ð´ÐµÐ»Ð°ÐµÑ Ð½ÐµÑколÑко. ÐÑдей â ÑколÑко ÑÑо ÑникалÑнÑÑ
покÑпаÑелей. ÐонвеÑÑÐ¸Ñ ÑÑиÑаеÑÑÑ Ð¿Ð¾ лÑдÑм â по попÑÑкам она занижена."}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{className:"dim",style:{textAlign:"left",fontSize:11.5},children:[e.jsx("th",{style:{padding:5},children:"ÑпоÑоб"}),e.jsx("th",{className:"r",children:"попÑÑок"}),e.jsx("th",{className:"r",children:"лÑдей"}),e.jsx("th",{className:"r",children:"оплаÑ"}),e.jsx("th",{className:"r",children:"конвеÑÑиÑ"}),e.jsx("th",{className:"r",children:"по попÑÑкам"}),e.jsx("th",{className:"r",children:"вÑÑÑÑка"})]})}),e.jsxs("tbody",{children:[e.jsx(C,{label:"вÑего",r:x}),(s.methods||[]).map((u,k)=>{var g;return e.jsx(C,{sub:!0,label:((g=it[u.method])==null?void 0:g.label)||u.method||"â",r:u},k)}),!x.attempts&&e.jsx("tr",{children:e.jsx("td",{className:"dim",colSpan:7,style:{padding:8},children:"Ðа ÑÑÐ¾Ñ Ð¿ÐµÑиод попÑÑок оплаÑÑ Ð½Ðµ бÑло."})})]})]})]})}function is({title:s,rows:t}){return t.length?e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("div",{className:"dim",style:{fontSize:11.5,textTransform:"uppercase",letterSpacing:.4,marginBottom:4},children:s}),t.map((m,n)=>e.jsxs("div",{style:{display:"flex",gap:10,fontSize:12.5,padding:"2px 0"},children:[e.jsx("span",{style:{minWidth:150,overflowWrap:"anywhere"},children:m[0]}),e.jsxs("span",{className:"dim",children:[m[1]," ÑÑ"]}),e.jsx("span",{style:{marginLeft:"auto",fontWeight:700},children:m[2]})]},n))]}):null}function gr({api:s}){var be,w;const[t,m]=r.useState("metrika"),[n,x]=r.useState(null),[i,C]=r.useState(""),[u,k]=r.useState(""),[g,I]=r.useState(""),[E,X]=r.useState(null),[D,W]=r.useState(""),[o,N]=r.useState("");r.useEffect(()=>{const d=setTimeout(()=>{N(D.trim()),V(0)},350);return()=>clearTimeout(d)},[D]);const[v,_]=r.useState(null),[B,Q]=r.useState(!1);r.useEffect(()=>{t==="metrika"&&s("/admin/analytics-cfg").then(_).catch(()=>_(null))},[t]);const A=d=>{B||(v==null?void 0:v.transport)===d||(Q(!0),s("/admin/analytics-cfg",{transport:d}).then(b=>_(F=>({...F,transport:b.transport,stored:d}))).catch(b=>alert(String((b==null?void 0:b.message)||b).includes("no_measurement_key")?"ÐÐµÑ ÐºÐ»ÑÑа измеÑений â пÑоÑокол ÑабоÑаÑÑ Ð½Ðµ бÑдеÑ. ÐлÑÑ Ð²ÐºÐ»ÑÑаеÑÑÑ Ð² наÑÑÑойкаÑ
ÑÑÑÑÑика, Ñаздел «ÐезопаÑноÑÑÑ Ð¸ иÑполÑзование даннÑÑ
».":"Ðе ÑдалоÑÑ Ð¿ÐµÑеклÑÑиÑÑ")).finally(()=>Q(!1)))},[$,V]=r.useState(0),[T,y]=r.useState(!0),[q,P]=r.useState(null);r.useEffect(()=>{V(0),P(null),C(""),k(""),I(""),X(null),W(""),N("")},[t]),r.useEffect(()=>{let d=!0;y(!0);let b;if(t==="metrika"){const F=new URLSearchParams({offset:String($)});i&&F.set("outcome",i),u&&F.set("target",u),g&&F.set("cid",g),E&&F.set("user_id",E.id),o&&F.set("q",o),b=s("/admin/analytics-log?"+F)}else{const F=new URLSearchParams({limit:"200"});i==="failed"&&F.set("failed","1"),b=s("/partner/admin/postbacks?"+F).then(
74Z=>({rows:((Z==null?void 0:Z.postbacks)||[]).map(xe=>({...xe,ts:xe.created_at})),hasMore:!1}))}return b.then(F=>{d&&x(F)}).catch(()=>{d&&x(null)}).finally(()=>{d&&y(!1)}),()=>{d=!1}},[t,i,$,u,g,E,o]);const oe=d=>new Date(d).toLocaleString("ru-RU",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),L=d=>d==="sent"?"var(--green)":d==="error"?"var(--red)":String(d).startsWith("skip")?"var(--muted)":"var(--text)",se=(n==null?void 0:n.rows)||[],U=t!=="metrika"?se:(()=>{const d=[],b=new Map;for(const F of se){const Z=F.conv_id;if(!Z){d.push({...F,kids:[],worst:null});continue}const xe=b.get(Z);if(xe==null){b.set(Z,d.length),d.push({...F,kids:[],worst:null});continue}const ue=d[xe];ue.kids.push(F);const Ne=fe=>fe==="error"?3:String(fe).startsWith("skip")?2:1;Ne(F.outcome)>Ne(ue.worst??ue.outcome)&&(ue.worst=F.outcome,ue.worstErr=F.err,ue.worstHttp=F.http)}return d})(),ne=(n==null?void 0:n.summary)||{},le=[["","вÑе"],["sent","оÑпÑавлено"],["error","оÑибки"],["skip_nocid","без cid"],["skip_noconf","Ð½ÐµÑ Ð½Ð°ÑÑÑойки"]],ee=({k:d,v:b})=>b==null||b===""?null:e.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0"},children:[e.jsx("span",{className:"dim",style:{width:90,flex:"none"},children:d}),e.jsx("span",{style:{wordBreak:"break-all",fontFamily:"ui-monospace,monospace",fontSize:12},children:String(b)})]});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{className:"toggle-pill"+(t==="metrika"?" is-on":""),style:{borderColor:t==="metrika"?"var(--violet)":"var(--line)",fontWeight:t==="metrika"?700:400},onClick:()=>m("metrika"),children:"ÐеÑÑика / GA"}),e.jsx("button",{className:"toggle-pill"+(t==="trackers"?" is-on":""),style:{borderColor:t==="trackers"?"var(--violet)":"var(--line)",fontWeight:t==="trackers"?700:400},onClick:()=>m("trackers"),children:"ТÑекеÑÑ Ð¿Ð°ÑÑнÑÑов"}),e.jsx("span",{className:"dim",style:{fontSize:12},children:t==="metrika"?"ÑеÑвеÑнÑе конвеÑÑии в ЯндекÑ.ÐеÑÑÐ¸ÐºÑ / GA4":"S2S-поÑÑбеки в ÑеÑи вебмаÑÑеÑов"}),e.jsx("span",{className:"dim",style:{fontSize:12,marginLeft:"auto",opacity:T?1:0},children:"обновлÑÑâ¦"})]}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:t==="metrika"?le.map(([d,b])=>e.jsxs("button",{className:"toggle-pill",style:{borderColor:i===d?L(d||"sent"):"var(--line)",fontWeight:i===d?700:400},onClick:()=>{C(d),V(0)},children:[b,d&&ne[d]!=null?` · ${ne[d]}`:""]},d)):[["","вÑе"],["failed","ÑолÑко оÑибки"]].map(([d,b])=>e.jsx("button",{className:"toggle-pill",style:{borderColor:i===d?"var(--red)":"var(--line)",fontWeight:i===d?700:400},onClick:()=>{C(d),P(null)},children:b},d))}),e.jsx("div",{className:"dim",style:{fontSize:12,marginTop:8},children:"Ðлик по ÑÑÑоке â полнÑй лог: URL, HTTP, Ñело оÑвеÑа, оÑибка, вÑемÑ, повÑоÑÑ."}),t==="metrika"&&v&&e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid var(--line)",display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:"ÐÑÑÑ Ð´Ð¾ÑÑавки:"}),[["mp","пÑоÑокол измеÑений"],["offline","оÑлайн-загÑÑзка"]].map(([d,b])=>e.jsx("button",{className:"toggle-pill"+(v.transport===d?" is-on":""),disabled:B||d==="mp"&&!v.hasKey||d==="offline"&&!v.hasToken,style:{borderColor:v.transport===d?"var(--violet)":"var(--line)",fontWeight:v.transport===d?700:400,opacity:d==="mp"&&!v.hasKey||d==="offline"&&!v.hasToken?.45:1},onClick:()=>A(d),children:b},d)),e.jsxs("span",{className:"dim",style:{fontSize:12},children:[v.transport==="mp"?"наполнÑÐµÑ Ð¾ÑÑÑÑÑ ÑлекÑÑонной ÑоÑговли; пÑÑÑ Ð¿Ð¾ ÐºÐ»Ð¸ÐºÑ Ð¾ÑклÑÑÑн, ÑÑÐ¾Ð±Ñ Ð²ÑÑÑÑка не двоилаÑÑ":"ÑÐ¼ÐµÐµÑ Ð¿ÑивÑÐ·ÐºÑ Ðº ÑÐµÐºÐ»Ð°Ð¼Ð½Ð¾Ð¼Ñ ÐºÐ»Ð¸ÐºÑ, но в ÑлекÑÑоннÑÑ ÑоÑÐ³Ð¾Ð²Ð»Ñ Ð½Ðµ попадаеÑ",!v.hasKey&&" · клÑÑа измеÑений неÑ",v.stored==null&&" · знаÑение из конÑига"]})]}),t==="metrika"&&(v==null?void 0:v.visitSink)&&e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid var(--line)",display:"grid",gap:8},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:"ÐапиÑÑ Ð·Ð°Ñ
одов:"}),e.jsxs("span",{className:"dim",style:{fontSize:12},children:[v.aeBound?"Analytics Engine подклÑÑÑн":"биндинга AE Ð½ÐµÑ â ae/both пиÑÑÑ ÑолÑко в D1",v.aeBound&&(v.aeSql?" · SQL API наÑÑÑоен":" · SQL API не наÑÑÑоен (оÑÑÑÑÑ Ð¸Ð· AE недоÑÑÑпнÑ)")]})]}),["lp","order","web","app"].map(d=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("code",{style:{width:48,fontSize:12},children:d}),(v.visitSinks||["d1","both","ae","converters","off"]).map(b=>e.jsx("button",{className:"toggle-pill"+(v.visitSink[d]===b?" is-on":""),disabled:B,style:{borderColor:v.visitSink[d]===b?"var(--violet)":"var(--line)",fontWeight:v.visitSink[d]===b?700:400,fontSize:12},onClick:()=>{B||v.visitSink[d]===b||(Q(!0),s("/admin/analytics-sink",{visitSink:{[d]:b}}).then(F=>_(Z=>({...Z,visitSink:F.visitSink}))).catch(()=>alert("Ðе ÑдалоÑÑ Ð¿ÐµÑеклÑÑиÑÑ")).finally(()=>Q(!1)))},children:b},b))]},d)),e.jsx("span",{className:"dim",style:{fontSize:12},children:"both â D1 + AE (пеÑеÑ
од), ae â ÑолÑко AE (ÑелÑ), d1 â как ÑанÑÑе, converters â в D1 ÑолÑко воÑедÑие и заÑ
Ð¾Ð´Ñ Ñ Ð½Ð¾Ð¼ÐµÑом Ð
74ºÐ»Ð¸ÐºÐ°, off â не пиÑаÑÑ."}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:"ÐÑÑÑÑÑ ÑиÑаÑÑ:"}),[["d1","ÑаблиÑÑ visits (D1)"],["auto","AE (⤠3 меÑ) / ÑÑÑоÑнÑе агÑегаÑÑ"]].map(([d,b])=>e.jsx("button",{className:"toggle-pill"+(v.visitReaders===d?" is-on":""),disabled:B,style:{borderColor:v.visitReaders===d?"var(--violet)":"var(--line)",fontWeight:v.visitReaders===d?700:400,fontSize:12},onClick:()=>{B||v.visitReaders===d||(Q(!0),s("/admin/analytics-sink",{visitReaders:d}).then(F=>_(Z=>({...Z,visitReaders:F.visitReaders}))).catch(()=>alert("Ðе ÑдалоÑÑ Ð¿ÐµÑеклÑÑиÑÑ")).finally(()=>Q(!1)))},children:b},d)),e.jsx("span",{className:"dim",style:{fontSize:12},children:"d1 â пока идÑÑ ÑвеÑка D1âAE (две недели); auto â поÑле неÑ. Ðогда Ñ
оÑÑ Ð¾Ð´Ð½Ð° повеÑÑ
ноÑÑÑ Ð¿Ð¸ÑÐµÑ ÑолÑко в AE, оÑÑÑÑÑ ÑиÑаÑÑ AE незавиÑимо Ð¾Ñ ÑÑого."})]})]}),t==="metrika"&&e.jsxs("details",{style:{marginTop:10},children:[e.jsx("summary",{style:{cursor:"pointer",fontSize:13,fontWeight:600},children:"ЧÑо Ð¼Ñ ÑлÑм и заÑем"}),e.jsxs("div",{style:{fontSize:12.5,lineHeight:1.65,marginTop:8,display:"grid",gap:10},children:[e.jsxs("div",{children:[e.jsx("b",{children:"Цели."})," ÐÐ°Ð¶Ð´Ð°Ñ ÑÑÑока â одно ÑобÑÑие, оÑпÑавленное в ЯндекÑ.ÐеÑÑÐ¸ÐºÑ (и в GA4, где он наÑÑÑоен). Ð¦ÐµÐ»Ñ Ð² ÑÑÑÑÑике Ð»Ð¾Ð²Ð¸Ñ ÐµÐ³Ð¾ по ÐÐÐÐÐ: заводиÑÑÑ ÐºÐ°Ðº «JavaScript-ÑобÑÑие», и в поле иденÑиÑикаÑоÑа ÑÑÐ¾Ð¸Ñ Ñовно Ñо Ñлово, ÑÑо видно в колонке «ÑелÑ». ÐенÑги неÑÑÑ ",e.jsx("code",{children:"purchase"})," â пеÑÐ²Ð°Ñ Ð¿Ð¾ÐºÑпка, ",e.jsx("code",{children:"renewal"})," â пÑодление,",e.jsx("code",{children:" trial_convert"})," â пеÑеÑ
од Ñ Ð¿Ñобного на плаÑнÑй, ",e.jsx("code",{children:"extra_devices"})," â докÑпка ÑÑÑÑойÑÑв, ",e.jsx("code",{children:"trial"})," â вклÑÑение пÑобного. Ðез денег: ",e.jsx("code",{children:"registration"})," â заведÑн аккаÑнÑ, ",e.jsx("code",{children:"checkout"})," â Ñеловек доÑÑл до плаÑÑжной ÑоÑмÑ, ",e.jsx("code",{children:"connected"})," â пеÑвое подклÑÑение. ÐÐ°Ð¶Ð´Ð°Ñ Ð´ÐµÐ½ÐµÐ¶Ð½Ð°Ñ ÑÐµÐ»Ñ Ð´ÑблиÑÑеÑÑÑ Ð² обÑÑÑ ",e.jsx("code",{children:"ct_payment"})," â «оплаÑа вÑеÑ
видов»: ÑÐµÐºÐ»Ð°Ð¼Ð½Ð°Ñ ÑÑÑаÑÐµÐ³Ð¸Ñ Ð¾Ð¿ÑимизиÑÑеÑÑÑ Ð¿Ð¾ ÐÐÐÐÐ Ñели Ñ Ð´Ð¾Ñ
одом, и по лÑбой оÑделÑной она видела Ð±Ñ Ð»Ð¸ÑÑ ÑаÑÑÑ Ð²ÑÑÑÑки."]}),e.jsxs("div",{children:[e.jsxs("b",{children:["ÐоÑÐµÐ¼Ñ ",e.jsx("code",{children:"checkout"})," ÑÑиÑаеÑÑÑ."]})," ÐокÑпок в Ð´ÐµÐ½Ñ ÑÑолÑко, ÑÑо ÑÑÑаÑÐµÐ³Ð¸Ñ ÑÑиÑÑÑ Ð½ÐµÐ´ÐµÐ»Ñми. ÐоведÑннÑÑ
до ÑоÑÐ¼Ñ Ð² ÑÐ°Ð·Ñ Ð±Ð¾Ð»ÑÑе, и ÑÑо Ñже не ÑлÑÑайнÑй поÑеÑиÑÐµÐ»Ñ â по ÑÐ°ÐºÐ¾Ð¼Ñ ÑобÑÑÐ¸Ñ Ð¾Ð½Ð° набиÑÐ°ÐµÑ ÑÑаÑиÑÑÐ¸ÐºÑ Ð±ÑÑÑÑее. Ðенег он не неÑÑÑ Ð¸ вÑÑÑÑÐºÑ Ð½Ðµ задваиваеÑ. Ðдна оÑпÑавка на поÑ
од: ÑÑÑÑ Ð·Ð°Ð²Ð¾Ð´Ð¸ÑÑÑ Ð·Ð°Ð½Ð¾Ð²Ð¾ на каждÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ Ð¾Ð¿Ð»Ð°ÑÑ, а иÑ
Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ Ñеловека бÑÐ²Ð°ÐµÑ Ð¸ девÑÑÑ Ð¿Ð¾Ð´ÑÑд."]}),e.jsxs("div",{children:[e.jsx("b",{children:"Чем ÑвÑзано Ñ Ñеловеком."})," ÐеÑÑика ÑÐºÐ»ÐµÐ¸Ð²Ð°ÐµÑ Ð½Ð°Ñи ÑеÑвеÑнÑе ÑобÑÑÐ¸Ñ Ñ Ð¿Ð¾ÑеÑиÑелем ÑолÑко по ClientID â кÑке ",e.jsx("code",{children:"_ym_uid"}),", коÑоÑÑÑ Ð¼Ñ ÑоÑ
ÑанÑем на аккаÑнÑ. ÐÑÑÑ Ð¶Ð¸Ð²Ð¾Ð¹ иденÑиÑикаÑÐ¾Ñ â она Ñама наÑ
Ð¾Ð´Ð¸Ñ Ð² иÑÑоÑии Ñекламн
74Ñй клик и пÑипиÑÑÐ²Ð°ÐµÑ Ð´ÐµÐ½Ñги емÑ. ÐÐµÑ (Ñеловек пÑиÑÑл из боÑа, где наÑиÑ
кÑк не бÑваеÑ) â ÑÑÑока полÑÑÐ°ÐµÑ Ð¸ÑÑ
од «без cid», и ÑобÑÑие никÑда не ÑÑ
одиÑ: пÑивÑзаÑÑ ÐµÐ³Ð¾ не к комÑ."]}),e.jsxs("div",{children:[e.jsx("b",{children:"ЧÑо ÑÑ
Ð¾Ð´Ð¸Ñ Ð²Ð¼ÐµÑÑе Ñ ÑобÑÑием."})," ÐÑÐµÐ¼Ñ Ñамой оплаÑÑ â ÑÑÐ¾Ð±Ñ Ð¾Ð½Ð° легла в Ñвой ÑаÑ, а не в ÑÐ°Ñ Ð¾ÑпÑавки. РазÑезÑ: ÑаÑиÑ, ÑÑок, ÑпоÑоб оплаÑÑ, пÑоÑеÑÑинг, поÑок закÑпки, виÑÑина, вÑÑÑÑка ÑÑÑаниÑÑ â по ним ÑÑÑаÑÐµÐ³Ð¸Ñ Ð²Ð¸Ð´Ð¸Ñ, ЧТРокÑпаеÑÑÑ, а не ÑолÑко «бÑло/не бÑло». ÐÑоÑÐ¸Ð»Ñ Ñеловека: ÑколÑко заплаÑил за вÑÑ Ð²ÑемÑ, ÑколÑко Ñаз, давно ли Ñ Ð½Ð°Ð¼Ð¸, жив ли ÑейÑÐ°Ñ â из ÑÑого ÑобиÑаÑÑÑÑ ÑегменÑÑ Ð¸ ÑеÑаÑгеÑ. ÐÑпÑавленное видно в ÑаÑкÑÑÑии ÑÑÑоки."]}),e.jsxs("div",{children:[e.jsx("b",{children:"Ðак ÑиÑаÑÑ Ð¸ÑÑ
одÑ."})," «ÑÑло» â ÐеÑÑика пÑинÑла. «оÑибки» â оÑвеÑгла, и пÑиÑина напиÑана ÐµÑ Ñловами в ÑаÑкÑÑÑии (напÑимеÑ, занÑÑое ÐµÑ Ð¸Ð¼Ñ Ð¿Ð°ÑамеÑÑа: Ñакой Ñ
Ð¸Ñ Ð¾ÑвеÑгаеÑÑÑ Ñеликом). «без cid» â Ñеловека не к ÑÐµÐ¼Ñ Ð¿ÑивÑзаÑÑ, Ñм. вÑÑе. Â«Ð½ÐµÑ Ð½Ð°ÑÑÑойки» â Ñ Ð±Ñенда не заведÑн ÑÑÑÑÑик, ÑÑо не поломка."]}),e.jsxs("div",{children:[e.jsx("b",{children:"ÐлекÑÑÐ¾Ð½Ð½Ð°Ñ ÑоÑÐ³Ð¾Ð²Ð»Ñ â оÑделÑнÑм Ñ
иÑом."})," ÐбÑÑÐ½Ð°Ñ ÑÐµÐ»Ñ ÑÑиÑаеÑÑÑ Ð¿Ð¾ ÐÐÐÐÐ ÑобÑÑÐ¸Ñ (",e.jsx("code",{children:"purchase"}),", ",e.jsx("code",{children:"renewal"}),"â¦), а оÑÑÑÑ Ð¿Ð¾ ÑлекÑÑонной ÑоÑговле â неÑ: он наполнÑеÑÑÑ ÑолÑко ÑпеÑиалÑнÑм ecommerce-Ñ
иÑом, и ÑÐµÐ»Ñ Ð¿Ð¾Ð´ него в ÑÑÑÑÑике Ð¸Ð¼ÐµÐµÑ Ñип",e.jsx("code",{children:"e_purchase"})," (на matrix ÑÑо «Ecommerce: покÑпка»). ÐоÑÑÐ¾Ð¼Ñ Ð½Ð° покÑпке, пÑодлении и пеÑеÑ
оде Ñ Ð¿Ñобного Ð¼Ñ ÑлÑм ÐТÐÐ ÐÐ Ñ
иÑ: дейÑÑвие ",e.jsx("code",{children:"ecom"}),", Ñип опеÑаÑии",e.jsx("code",{children:"purchase"}),", Ð½Ð¾Ð¼ÐµÑ Ð·Ð°ÐºÐ°Ð·Ð°, ÑÑмма и валÑÑа, а ÑоваÑом â ÑеалÑнÑй ÑаÑÐ¸Ñ Ñо ÑÑоком (",e.jsx("code",{children:"start_mo"}),"), названием, каÑегоÑией по Ð²Ð¸Ð´Ñ ÑпиÑÐ°Ð½Ð¸Ñ Ð¸ бÑендом. ÐейÑÑвие названо",e.jsx("code",{children:"ecom"}),", а не ",e.jsx("code",{children:"purchase"}),", ÑпеÑиалÑно: Ñовпади оно Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ обÑÑной Ñели â Ñа ÑÑабаÑÑвала Ð±Ñ Ð²ÑоÑой Ñаз, и пÑÐ¾Ð´Ð»ÐµÐ½Ð¸Ñ ÑÑиÑалиÑÑ Ð±Ñ Ð¿Ð¾ÐºÑпками.",e.jsx("br",{}),"ÐÑÑÑда же беÑÑÑÑÑ Ð¿Ñавило пÑо пÑÑи доÑÑавки: оÑлайн-загÑÑзка ecommerce ÐРнаполнÑÐµÑ â Ñ Ð½ÐµÑ ÐµÑÑÑ ÐºÐ¾Ð½Ð²ÐµÑÑиÑ, но Ð½ÐµÑ Ð¿Ð¾ÐºÑпки. ÐоÑÑÐ¾Ð¼Ñ Ð½Ð° бÑенде Ñ Ð¿ÑоÑоколом измеÑений вÑÑ Ð²ÑÑÑÑка идÑÑ Ð¸Ð¼ одним, без запаÑного пÑÑи по ÑÐµÐºÐ»Ð°Ð¼Ð½Ð¾Ð¼Ñ ÐºÐ»Ð¸ÐºÑ."]}),e.jsxs("div",{children:[e.jsx("b",{children:"Ðдна конвеÑÑÐ¸Ñ â одна ÑÑÑока."})," ÐплаÑа ÑÑ
Ð¾Ð´Ð¸Ñ Ð²ÐµÐµÑом: ÑÐ²Ð¾Ñ ÑелÑ, обÑаÑ, наÑледнÑй алиаÑ, ecommerce â и по ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÐºÐ°Ð½Ð°Ð»Ñ. СÑÑоки ÑÑ
лопнÑÑÑ, в заголовке ХУÐШÐРиÑÑ
од вееÑа, инаÑе ÑаÑÑиÑÐ½Ð°Ñ Ð´Ð¾ÑÑавка вÑглÑдела Ð±Ñ Ð¿Ð¾Ð»Ð½Ñм ÑÑпеÑ
ом. РаÑкÑÑÑие пеÑеÑиÑлÑÐµÑ ÐºÐ°Ð½Ð°Ð»Ñ."]})]})]})]}),t==="metrika"&&e.jsxs("div",{className:"card pad",style:{marginBottom:12,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(us,{size:15,strokeWidth:1.9,className:"dim"}),e.jsx("input",{value:D,onChange:d=>W(d.target.value),placeholder:"поÑÑа, ClientID, id аккаÑнÑа или @ник",style:{flex:"1 1 260px",padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),!!o&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["найдено ÑобÑÑий: ",Object.values((n==null?void 0:n.summary)||{}).reduce((d,b)=>d+Number(b||0),0)]}),e.jsx("button",{className:"btn btn--ghost btn--xs",onClick:()=>W(""),children:"ÑбÑоÑиÑÑ"})]})]}),t==="metrika"&&(((be=n==null?void 0:n.byTarget)==null?void 0:be.length)>0||((w=n==null?void 0:n.byCid)==null?void 0:w.length)>0)&&e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(320px,1fr))",gap:18},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["Ðо ÑелÑм ",e.jsx("span",{className:"dim",style:{fontWeight:400,fontSize:12}
74,children:o?"по найденномÑ":"за ÑÑÑки"})]}),e.jsxs("table",{className:"tbl",style:{width:"100%",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:5},children:"ÑелÑ"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"ÑÑло"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"оÑибки"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"пÑопÑÑк"})]})}),e.jsx("tbody",{children:((n==null?void 0:n.byTarget)||[]).map(d=>{const b=d.target!=="загÑÑзка паÑкой",F=u===d.target;return e.jsxs("tr",{style:{cursor:b?"pointer":"default",background:F?"var(--surface-2)":void 0},onClick:()=>{b&&(k(F?"":d.target),I(""),V(0))},children:[e.jsx("td",{style:{padding:5,fontWeight:F?700:400},children:d.target}),e.jsx("td",{style:{padding:5,textAlign:"right",color:"var(--green)"},children:d.sent||""}),e.jsx("td",{style:{padding:5,textAlign:"right",color:d.error?"var(--red)":"var(--muted)",fontWeight:d.error?700:400},children:d.error||""}),e.jsx("td",{style:{padding:5,textAlign:"right"},className:"dim",children:d.skipped||""})]},d.target)})})]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["Ðо поÑеÑиÑелÑм ",e.jsxs("span",{className:"dim",style:{fontWeight:400,fontSize:12},children:["ClientID ÐеÑÑики, ",o?"по найденномÑ":"за ÑÑÑки"]})]}),e.jsxs("table",{className:"tbl",style:{width:"100%",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:5},children:"кÑо"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"ÑобÑÑий"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"Ñелей"}),e.jsx("th",{style:{textAlign:"right",padding:5},children:"оÑибки"})]})}),e.jsxs("tbody",{children:[((n==null?void 0:n.byCid)||[]).map(d=>{const b=g===d.cid;return e.jsxs("tr",{style:{cursor:"pointer",background:b?"var(--surface-2)":void 0},onClick:()=>{I(b?"":d.cid),k(""),X(null),V(0)},children:[e.jsx("td",{style:{padding:5,fontWeight:b?700:400,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:d.cid,children:d.people>1?e.jsxs(e.Fragment,{children:[d.email||d.cid," ",e.jsxs("span",{className:"dim",style:{fontSize:11},children:["и еÑÑ ",d.people-1]})]}):d.email||e.jsx("span",{style:{fontFamily:"ui-monospace,monospace"},className:"dim",children:d.cid})}),e.jsx("td",{style:{padding:5,textAlign:"right"},children:d.n}),e.jsx("td",{style:{padding:5,textAlign:"right"},className:"dim",children:d.targets}),e.jsx("td",{style:{padding:5,textAlign:"right",color:d.error?"var(--red)":"var(--muted)",fontWeight:d.error?700:400},children:d.error||""})]},d.cid)}),((n==null?void 0:n.byCid)||[]).length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"dim",style:{padding:6},children:"Ðа ÑÑÑки ни одного ÑобÑÑÐ¸Ñ Ñ ClientID."})})]})]})]})]}),(u||g||E)&&e.jsxs("div",{style:{marginTop:10,display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{className:"dim",style:{fontSize:12},children:"ленÑа оÑÑилÑÑÑована:"}),u&&e.jsxs("span",{className:"toggle-pill is-on",children:["ÑÐµÐ»Ñ ",u]}),g&&e.jsx("span",{className:"toggle-pill is-on",style:{fontFamily:"ui-monospace,monospace"},children:g}),E&&e.jsx("span",{className:"toggle-pill is-on",children:E.email||E.id}),e.jsx("button",{className:"btn btn--ghost",onClick:()=>{k(""),I(""),X(null),V(0)},children:"ÑбÑоÑиÑÑ"})]})]}),e.jsxs("div",{className:"card pad",children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"tbl",style:{width:"100%",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:6},children:"когда"}),t==="metrika"?e.jsxs(e.Fragment,{children:[e.jsx("th",{style:{textAlign:"left",padding:6},children:"ÑелÑ"}),e.jsx("th",{style:{textAlign:"left",padding:6},children:"Ñеловек"}),e.jsx("th",{style:{textAlign:"left",padding:6},children:"иÑÑ
од"})]}):e.jsxs(e.Fragment,{children:[e.jsx("th",{style:{textAlign:"left",padding:6},children:"паÑÑнÑÑ"}),e.jsx("th",{style:{textAlign:"left",padding:6},children:"ÑобÑÑие"}),e.jsx("th",{style:{textAlign:"left",padding:6},children:"пÑиÑм"})]}),e.jsx("th",{style:{textAlign:"left",padding:6},children:"http"}),e.jsx("th",{style:{textAlign:"left",padding:6}})]})}),e.jsxs("tbody",{children:[U.map(d=>{var Z,xe;const b=d.id,F=q===b;return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{style:{cursor:"pointer"},onClick:()=>P(F?null:b),children:[e.jsx("td",{className:"dim",style:{padding:6,whiteSpace:"nowrap"},children:oe(d.ts)}),t==="metrika"?e.jsxs(e.Fragment,{children:[e.jsx("td",{style:{padding:6},children:d.target||"â"}),e.jsx("td",{style:{padding:6,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.email||d.tg||(d.user_id?e.jsx("span",{className:"dim",children:"без поÑÑÑ"}):e.jsx("span",{className:"dim",children:"â"}))}),e.jsx("td",{style:{padding:6,color:L(d.worst||d.outcome),fontWeight:600},children:d.worst||d.outcome})]}):e.jsxs(e.Fragment,{children:[e.jsx("td",{style:{padding:6},children:d.code||"â"}),e.jsx("td",{className:"dim",style:{padding:6},children:{reg:"ÑегиÑÑÑаÑиÑ",dep:"пеÑÐ²Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа",sale:"пÑодажа"}[d.slot]||d.slot}),e.jsxs("td",{style:{padding:6,color:d.ok?"var(--green)":"var(--red)",fontWeight:600},children:[d.ok?"пÑинÑÑ":"оÑибка",d.retries?` · ${d.retries}Ã`:""]})]}),e.jsx("td",{className:"dim",style:{padding:6},children:(d.worst?d.worstHttp:d.http)||d.status||""}),e.jsxs("td",{className:"dim",style:{padding:6,whiteSpace:"nowrap"},children:[(Z=d.kids)!=null&&Z.length?`${d.kids.length+1} канала`:"",F?" â¾":" â¸"]})]}),F&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,style:{padding:"4px 10px 12px",background:"var(--surface-2)"},children:t==="metrika"?e.jsxs(e.Fragment,{children:[e.jsx(ee,{k:"пÑовайдеÑ",v:d.provider}),e.jsx(ee,{k:"ÑелÑ",v:d.target}),e.jsx(ee,{k:"иÑÑ
од",v:d.outcome}),e.jsx(ee,{k:"http",v:d.http}),e.jsx(ee,{k:"ms",v:d.ms}),e.jsx(ee,{k:"оÑибка",v:d.err}),e.jsx(ee,{k:"ÑÑмма",v:d.amount_cents!=null?`${(d.amount_cents/100).toLocaleStr
74ing("ru-RU")} ${d.currency||""}`.trim():null}),e.jsx(ee,{k:"ÑазÑезÑ",v:d.params}),d.cid&&e.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0",alignItems:"center"},children:[e.jsx("span",{className:"dim",style:{width:90,flex:"none"},children:"cid"}),e.jsx("button",{className:"linkbtn",style:{fontFamily:"ui-monospace,monospace",fontSize:12},onClick:ue=>{ue.stopPropagation(),I(d.cid),k(""),X(null),V(0)},children:d.cid}),e.jsx("span",{className:"dim",style:{fontSize:11},children:"â показаÑÑ Ð²ÑÑ Ð¿Ð¾ ÑÑÐ¾Ð¼Ñ Ð¿Ð¾ÑеÑиÑелÑ"})]}),d.user_id&&e.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0",alignItems:"center"},children:[e.jsx("span",{className:"dim",style:{width:90,flex:"none"},children:"Ñеловек"}),e.jsx("button",{className:"linkbtn",style:{fontSize:12},onClick:ue=>{ue.stopPropagation(),X({id:d.user_id,email:d.email}),I(""),k(""),V(0)},children:d.email||d.tg||d.user_id}),e.jsx("span",{className:"dim",style:{fontSize:11},children:"â вÑе его ÑобÑÑиÑ"})]}),((xe=d.kids)==null?void 0:xe.length)>0&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{className:"dim",style:{fontSize:12,marginBottom:4},children:"ÐºÐ°Ð½Ð°Ð»Ñ ÑÑой конвеÑÑии:"}),e.jsx("table",{className:"tbl",style:{width:"100%",fontSize:12},children:e.jsx("tbody",{children:[d,...d.kids].map(ue=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:4},children:ue.provider}),e.jsx("td",{style:{padding:4,color:L(ue.outcome),fontWeight:600},children:ue.outcome}),e.jsx("td",{className:"dim",style:{padding:4},children:ue.http||""}),e.jsx("td",{className:"dim",style:{padding:4,fontFamily:"ui-monospace,monospace"},children:ue.cid||""}),e.jsx("td",{className:"dim",style:{padding:4,wordBreak:"break-all"},children:ue.err||""})]},ue.id))})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{k:"паÑÑнÑÑ",v:(d.code||"")+(d.partner_email?" · "+d.partner_email:"")}),e.jsx(ee,{k:"ÑобÑÑие",v:d.slot}),e.jsx(ee,{k:"пÑиÑм",v:d.ok?"пÑинÑÑ":"оÑибка"}),e.jsx(ee,{k:"http",v:d.status}),e.jsx(ee,{k:"повÑоÑÑ",v:d.retries}),e.jsx(ee,{k:"ms",v:d.ms}),e.jsx(ee,{k:"оÑибка",v:d.error}),e.jsx(ee,{k:"conversion",v:d.conversion_id}),e.jsx(ee,{k:"URL",v:d.url}),e.jsxs("div",{style:{marginTop:6},children:[e.jsx("span",{className:"dim",style:{fontSize:12},children:"Ñело оÑвеÑа ÑÑекеÑа:"}),e.jsx("pre",{style:{margin:"4px 0 0",padding:8,background:"var(--surface)",borderRadius:6,fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:240,overflow:"auto"},children:d.body||"(пÑÑÑо)"})]})]})})})]},b)}),!T&&!U.length&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"dim",style:{padding:12,textAlign:"center"},children:"пÑÑÑо"})})]})]})}),t==="metrika"&&($>0||(n==null?void 0:n.hasMore))&&e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{className:"btn btn--ghost btn--xs",disabled:$<=0,onClick:()=>{V(Math.max(0,$-100)),P(null)},children:"â назад"}),e.jsx("button",{className:"btn btn--ghost btn--xs",disabled:!(n!=null&&n.hasMore),onClick:()=>{V((n==null?void 0:n.nextOffset)??$+100),P(null)},children:"впеÑÑд â"})]})]})]})}function fr({api:s}){const[t,m]=r.useState(null),n=()=>s("/admin/nodes").then(x=>m(x.nodes||[])).catch(()=>m(x=>x??[]));return r.useEffect(()=>{n()},[]),Vt(n,[],3e4),t?e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:12},children:[t.map((x,i)=>e.jsxs("div",{className:"card pad",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:10,padding:16},children:[e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontWeight:700,fontSize:14,wordBreak:"break-word",lineHeight:1.3},children:x.name||"â"}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:4,display:"flex",gap:12,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},title:"ÑÑÑана",children:[e.jsx(Hn,{size:13,strokeWidth:2}),x.country||"??"]}),typeof x.usersOnline=="number"&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},title:"ÑзеÑов онлайн",children:[e.jsx(Vn,{size:13,strokeWidth:2}),x.usersOnline]}),typeof x.trafficUsedBytes=="number"&&x.trafficUsedBytes>0&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},title:"ÑÑаÑик",children:[e.jsx(Gn,{size:13,strokeWidth:2}),xs(x.trafficUsedBytes)]})]})]}),e.jsx("span",{style:{flex:"none",display:"inline-flex",color:x.disabled?"var(--muted)":x.online?"var(--green)":"var(--coral)"},title:x.disabled?"ÐÑклÑÑена":x.online?"Ðнлайн":"Ðе оÑвеÑаеÑ","aria-label":x.disabled?"ÐÑклÑÑена":x.online?"Ðнлайн":"Ðе оÑвеÑаеÑ",children:x.disabled?e.jsx(Kn,{size:17,strokeWidth:2.2}):x.online?e.jsx(qt,{size:17,strokeWidth:2.2}):e.jsx(Pt,{size:17,strokeWidth:2.2})})]},i)),t.length===0&&e.jsx("p",{className:"dim",children:"ÐÐ°Ð½ÐµÐ»Ñ Ð½ÐµÐ´Ð¾ÑÑÑпна или нод неÑ."})]}):e.jsx("p",{className:"dim",children:"ÐагÑÑзкаâ¦"})}const jr=s=>s==="sbp2"?"sbp":s;function yr(s){const t=[];for(const m of s){const n=jr(m),x=t.find(i=>i.label===n);x?x.codes.push(m):t.push({label:n,codes:[m]})}return t}const ms=[{id:"aurora",label:"Aurora VPN · миÑ"},{id:"babka",label:"Ðабка · РоÑÑиÑ"}];function hs({shop:s,setShop:t}){return ms.length?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("span",{className:"dim",style:{fontSize:12.5},children:"ÐиÑÑина"}),ms.map(m=>e.jsx("button",{onClick:()=>t(m.id),className:"chipb"+(s===m.id?" chipb--info":""),style:{fontSize:12.5,padding:"5px 11px"},children:m.label},m.id))]}):null}function br({api:s}){const[t,m]=r.useState("aurora");return e.jsx(vr,{api:s,shop:t,setShop:m},t)}function vr({api:s,shop:t,setShop:m}){var be;const[n,x]=r.useState(null),[i,C]=r.useState({}),[u,k]=r.useState({}),[g,I]=r.useState([]),[E,X]=r.useState([]),[D,W]=r.useState(!1),[o,N]=r.useState(""),[v,_]=r.useState("default");if(r.useEffect(()=>{let w=!0;return s("/admin/tariff?shop="+t).then(d=>{var b,F,Z,xe,ue;w&&(x(d.doc),k(d),X(d.warnings||[]),_(((F=(((b=d.doc)==null?void 0:b.grids)||[]).find(Ne=>Ne.isDefault))==null?void 0:F.id)||((ue=(xe=(Z=d.doc)==null?void 0:Z.grids)==null?void 0:xe[0])==null?void 0:ue.id)||"default"))}).catch(()=>{}),()=>{w=!1}},[t]),!n)return e.jsxs(e.Fragment,{children:[e.jsx(hs,{shop:t,setShop:m}),e.jsx("div",{className:"card pad dim",children:"ÐагÑÑзкаâ¦"})]});const B=n.currency==="rub"?"â½":"$",Q=w=>
74(w/100).toLocaleString("ru-RU",{maximumFractionDigits:2}),A=w=>Math.round((parseFloat(String(w).replace(",","."))||0)*100),$=(n.grids||[]).find(w=>w.id===v)||((be=n.grids)==null?void 0:be[0]),V=w=>{x(w),N("")},T=(w,d)=>V({...n,grids:n.grids.map(b=>b.id===w?d({...b}):b)}),y=(w,d)=>T(v,b=>({...b,offers:b.offers.map(F=>F.id===w?d({...F}):F)})),q=()=>T(v,w=>{var Z;const d=((Z=n.plans[0])==null?void 0:Z.id)||"start";let b=`${d}-30`,F=1;for(;w.offers.some(xe=>xe.id===b);)b=`${d}-30-${++F}`;return{...w,offers:[...w.offers,{id:b,planId:d,days:30,priceCents:0,order:w.offers.length+1}]}}),P=w=>{confirm(`УдалиÑÑ Ð¿Ñедложение из ÑеÑки? 75 76ÐмеÑÑе Ñ Ð½Ð¸Ð¼ ÑйдÑÑ ÐµÐ³Ð¾ Ñена и пÑобнÑй пеÑиод. ÐÑавка пÑимениÑÑÑ Ð¿Ð¾Ñле пÑбликаÑии.`)&&T(v,d=>({...d,offers:d.offers.filter(b=>b.id!==w)}))},oe=()=>{const w=$||{offers:[]};let d="grid2",b=1;for(;n.grids.some(Z=>Z.id===d);)d=`grid${++b+1}`;const F={id:d,name:"ÐÐ¾Ð¿Ð¸Ñ "+(w.name||""),offers:JSON.parse(JSON.stringify(w.offers||[])),forPartners:!1};V({...n,grids:[...n.grids,F]}),_(d)},L=w=>{var b,F;if(n.grids.length<2)return;const d=n.grids.find(Z=>Z.id===w);d!=null&&d.isDefault||confirm(`УдалиÑÑ ÑеÑÐºÑ Â«${(d==null?void 0:d.name)||w}»? 77 78ÐмеÑÑе Ñ Ð½ÐµÐ¹ ÑйдÑÑ Ð²Ñе ÐµÑ Ð¿ÑÐµÐ´Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ (${((b=d==null?void 0:d.offers)==null?void 0:b.length)||0}). СÑÑлки Ñ ?g=${w} поÑле пÑбликаÑии оÑкÑоÑÑ Ð¾Ñновной пÑайÑ.`)&&(V({...n,grids:n.grids.filter(Z=>Z.id!==w)}),_(((F=n.grids.find(Z=>Z.isDefault))==null?void 0:F.id)||n.grids[0].id))},se=w=>V({...n,grids:n.grids.map(d=>({...d,isDefault:d.id===w}))}),U=async()=>{var w,d;if(ms.length&&u.brand&&u.brand!==t){I([`ÐагÑÑжен пÑÐ°Ð¹Ñ Ð²Ð¸ÑÑÐ¸Ð½Ñ Â«${u.brand}», вÑбÑана «${t}». ÐеÑезагÑÑзиÑе ÑÑÑаниÑÑ.`]);return}W(!0),I([]),N("");try{const b=await s("/admin/tariff?shop="+t,{doc:n});X(b.warnings||[]),N(`ÐпÑбликовано, веÑÑÐ¸Ñ ${b.version}`),x({...n,version:b.version})}catch(b){const F=(w=b==null?void 0:b.data)==null?void 0:w.errors;I(Array.isArray(F)&&F.length?F:[((d=b==null?void 0:b.data)==null?void 0:d.error)||"не ÑдалоÑÑ Ð¾Ð¿ÑбликоваÑÑ"])}finally{W(!1)}},ne=w=>{var d,b;return((b=(d=n.plans.find(F=>F.id===w))==null?void 0:d.names)==null?void 0:b.ru)||w},le=w=>w.days>0?w.priceCents/w.days:0,ee=`${u.previewBase||""}${$!=null&&$.isDefault?"":`?g=${$==null?void 0:$.id}`}`;return e.jsxs(e.Fragment,{children:[e.jsx(hs,{shop:t,setShop:m}),e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:6,fontSize:14},children:"СеÑки ÑаÑиÑов"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 12px"},children:["СеÑка â Ð½Ð°Ð±Ð¾Ñ Ð¿Ñедложений, коÑоÑÑй Ð²Ð¸Ð´Ð¸Ñ Ð¿Ð¾ÐºÑпаÑелÑ. ÐеÑолÑÐ½Ð°Ñ Ð¿Ð¾ÐºÐ°Ð·ÑваеÑÑÑ Ð¿Ñи пÑÑмом Ð·Ð°Ñ Ð¾Ð´Ðµ, оÑÑалÑнÑе оÑкÑÑваÑÑÑÑ ÑÑÑлкой ",e.jsx("code",{children:"?g=<id>"}),". ÐÑмеÑеннÑе «паÑÑнÑÑам» поÑвÑÑÑÑ Ñ Ð²ÐµÐ±Ð¼Ð°ÑÑеÑов в конÑÑÑÑкÑоÑе ÑÑÑлок. ÐÑавки пÑименÑÑÑÑÑ ÑолÑко поÑле пÑбликаÑии."]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center",marginBottom:12},children:[n.grids.map(w=>e.jsxs("button",{className:"toggle-pill"+(w.id===v?" is-on":""),onClick:()=>_(w.id),children:[w.name||w.id,w.isDefault?" ·":""]},w.id)),e.jsx("button",{className:"linkbtn linkbtn--sm",onClick:oe,children:"+ ÑеÑка (копией)"})]}),$&&e.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:12},children:[e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center",marginBottom:10},children:[e.jsx("input",{value:$.name||"",onChange:w=>T($.id,d=>({...d,name:w.target.value})),placeholder:"Ðазвание",style:{width:190}}),e.jsx("input",{value:$.id,onChange:w=>{const d=w.target.value.replace(/[^a-z0-9-]/gi,"").toLowerCase(),b=$.id;V({...n,grids:n.grids.map(F=>F.id===b?{...F,id:d}:F)}),_(d)},placeholder:"id в ÑÑÑлке",style:{width:130}}),e.jsxs("label",{className:"dim",style:{fontSize:12.5},title:$.isDefault?"ÐÑÐ½Ð¾Ð²Ð½Ð°Ñ ÑеÑка доÑÑÑпна паÑÑнÑÑам вÑегда":"",children:[e.jsx("input",{type:"checkbox",checked:!!$.forPartners||!!$.isDefault,disabled:!!$.isDefault,onCh
78ange:w=>T($.id,d=>({...d,forPartners:w.target.checked}))})," паÑÑнÑÑам"]}),!$.isDefault&&e.jsx("button",{className:"linkbtn linkbtn--sm",onClick:()=>se($.id),children:"ÑделаÑÑ Ð¾Ñновной"}),!$.isDefault&&e.jsx("button",{className:"linkbtn linkbtn--sm linkbtn--danger",onClick:()=>L($.id),children:"ÑдалиÑÑ ÑеÑкÑ"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",marginBottom:10},children:[e.jsx("span",{className:"dim",style:{fontSize:12.5},children:"ÐÐ»Ð°Ð½Ñ Ð½Ð° виÑÑине"}),n.plans.map(w=>e.jsxs("label",{className:"dim",style:{fontSize:12.5,display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer"},title:w.visible===!1?"СкÑÑÑ: покÑпаÑÐµÐ»Ñ ÐµÐ³Ð¾ не ÑвидиÑ, Ñ Ð´ÐµÐ¹ÑÑвÑÑÑÐ¸Ñ Ð¿Ð¾Ð´Ð¿Ð¸ÑÑиков пÑодление ÑабоÑаеÑ":"ÐоказÑваеÑÑÑ Ð¿Ð¾ÐºÑпаÑелÑ",children:[e.jsx("input",{type:"checkbox",checked:w.visible!==!1,onChange:d=>x(b=>({...b,plans:b.plans.map(F=>F.id===w.id?{...F,visible:d.target.checked}:F)}))}),ne(w.id)]},w.id))]}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginBottom:12},children:["СÑÑлка: ",e.jsx("a",{href:ee,target:"_blank",rel:"noreferrer",children:ee}),(()=>{const w=($.offers||[]).filter(d=>d.intro).length;return w?e.jsxs("span",{style:{marginLeft:10,color:"var(--green)"},children:["· пÑобнÑй пеÑиод еÑÑÑ Ñ ",w," пÑедложени",w===1?"Ñ":"й"]}):e.jsx("span",{style:{marginLeft:10},children:"· пÑобного пеÑиода неÑ"})})()]}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:10},children:(()=>{const w=[...new Set(($.offers||[]).map(d=>d.planId))];return w.length<2?null:w.map(d=>{const b=(i[$.id]??null)===d,F=($.offers||[]).filter(Z=>Z.planId===d).length;return e.jsxs("button",{className:"chipb"+(b?" chipb--info":""),style:{fontSize:12.5,padding:"5px 11px"},onClick:()=>C(Z=>({...Z,[$.id]:b?null:d})),children:[ne(d)," · ",F]},d)}).concat(e.jsx("button",{className:"chipb"+((i[$.id]??null)===null?" chipb--info":""),style:{fontSize:12.5,padding:"5px 11px"},onClick:()=>C(d=>({...d,[$.id]:null})),children:"вÑе"},"__all"))})()}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"tbl",style:{minWidth:720},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Ðлан"}),e.jsx("th",{children:"СÑок, дней"}),e.jsxs("th",{children:["Цена, ",B]}),e.jsxs("th",{title:"Цена пеÑвого пеÑиода: ÑÑо и еÑÑÑ Ð¿ÑобнÑй. ÐÑÑÑо â плаÑÐ¸Ñ Ð¿Ð¾Ð»Ð½ÑÑ ÑÑазÑ",children:["ÐÑÐ¾Ð±Ð½Ð°Ñ Ñена, ",B]}),e.jsx("th",{title:"СколÑко длиÑÑÑ Ð¿ÑобнÑй пеÑиод",children:"ÐÑобнÑÑ Ð´Ð½ÐµÐ¹"}),e.jsx("th",{children:"РденÑ"}),e.jsx("th",{children:"дейÑÑвиÑ"})]})}),e.jsx("tbody",{children:[...$.offers].filter(w=>!i[$.id]||w.planId===i[$.id]).sort((w,d)=>(w.order||0)-(d.order||0)).map(w=>{var d;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[Oi(w.planId),e.jsx("select",{value:w.planId,onChange:b=>y(w.id,F=>({...F,planId:b.target.value})),children:n.plans.map(b=>e.jsx("option",{value:b.id,children:ne(b.id)},b.id))})]})}),e.jsx("td",{children:e.jsx("input",{value:w.days,onChange:b=>y(w.id,F=>({...F,days:parseInt(b.target.value,10)||0})),style:{width:64}})}),e.jsx("td",{children:e.jsx("input",{value:Q(w.priceCents),onChange:b=>y(w.id,F=>({...F,priceCents:A(b.target.value)})),style:{width:92}})}),e.jsx("td",{children:e.jsx("input",{value:w.intro?Q(w.intro.priceCents):"",placeholder:"â",onChange:b=>{const F=b.target.value.trim();y(w.id,Z=>{var xe;return F?{...Z,intro:{priceCents:A(F),days:((xe=Z.intro)==null?void 0:xe.days)||7,once:!0}}:{...Z,intro:void 0}})},style:{width:92}})}),e.jsx("td",{children:e.jsx("input",{value:((d=w.intro)==null?void 0:d.days)??"",placeholder:"â",disabled:!w.intro,onChange:b=>y(w.id,F=>({...F,intro:{...F.intro,days:parseInt(b.target.value,10)||0}})),style:{width:60}})}),e.jsxs("td",{className:"dim",style:{fontSize:12.5},children:[Q(le(w))," ",B]}),e.jsx("td",{children:e.jsx("button",{className:"iconbtn iconbtn--danger",title:"УдалиÑÑ Ð¿Ñедложение","aria-label":"УдалиÑÑ Ð¿Ñедложение",onClick:()=>P(w.id),children:e.jsx(dn,{size:15,strokeWidth:2})})})]},w.id)})})]})}),e.jsx("button",{className:"linkbtn linkbtn--sm",style:{marginTop:10},onClick:q,children:"+ пÑедложение"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"10px 0 0"},children:[e.jsx("b",{children:"ÐÑобнÑй пеÑиод â ÑÑо две колонки ÑпÑава Ð¾Ñ ÑенÑ."})," СÑавиÑÑ Â«1 â½Â» и «1 денÑ» â Ñеловек плаÑÐ¸Ñ ÑÑÐ±Ð»Ñ Ð·Ð° пеÑвÑе ÑÑÑки, далÑÑе ÑпиÑÑваеÑÑÑ Ð¾Ð±ÑÑÐ½Ð°Ñ Ñена ÑÑого же пÑедложениÑ. «99 â½Â» и «7 дней» â пеÑÐ²Ð°Ñ Ð½ÐµÐ´ÐµÐ»Ñ Ð·Ð° 99 â½, далÑÑе как в колонке «Цена». ÐÑÑÑо â пÑобного неÑ."," ÐÑобнÑй не ÑаздаÑÑÑÑ Ð²Ñем подÑÑд: он ÑÑабаÑÑÐ²Ð°ÐµÑ ÑолÑко по ÑÑÑлке Ñ ",e.jsx("code",{children:"?trial=1"})," â паÑÑнÑÑ Ð²ÐºÐ»ÑÑÐ°ÐµÑ ÐµÐ³Ð¾ Ñам в ÑвоÑм конÑÑÑÑкÑоÑе ÑÑÑлок."]})]})]}),e.jsxs("div",{className:"card pad",children:[g.length>0&&e.jsx("div",{style:{marginBottom:10,color:"var(--coral)",fontSize:13},children:g.map((w,d)=>e.jsxs("div",{children:["⢠",w]},d))}),E.length>0&&e.jsx("div",{style:{marginBottom:10,color:"var(--amber)",fontSize:13},children:E.map((w,d)=>e.jsxs("div",{children:["⢠",w]},d))}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:"btn",disabled:D,onClick:U,children:D?"ÐÑбликÑÑâ¦":"ÐпÑбликоваÑÑ"}),e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["ÐеÑÑÐ¸Ñ ",n.version,n.updatedBy?` · ${n.updatedBy}`:"",u.isDefaultDoc?" · пока дейÑÑвÑÐµÑ ÑаÑÐ¸Ñ Ð¸Ð· кода":""]}),o&&e.jsx("span",{style:{color:"var(--green)",fontSize:13},children:o})]}),e.jsx("p",{className:"dim",style:{fontSize:12.5,margin:"10px 0 0"},children:"ÐейÑÑвÑÑÑим подпиÑÑикам Ñена не менÑеÑÑÑ: она заÑикÑиÑована в Ð¼Ð¾Ð¼ÐµÐ½Ñ Ð¿Ð¾ÐºÑпки. ÐовÑÑение Ð´Ð»Ñ Ð½Ð¸Ñ â оÑделÑÐ½Ð°Ñ Ð¾Ð¿ÐµÑаÑÐ¸Ñ Ñ Ð¿ÑедÑпÑеждением за 7 дней, как напиÑано в оÑеÑÑе."})]})]})}const gs=s=>({RUB:"â½",USD:"$",EUR:"â¬"})[String(s||"").toUpperCase()]||s||"";function Sr({api:s}){const[t,m]=r.useState("aurora"),[n,x]=r.useState(""),[i,C]=r.useState([]),[u,k]=r.useState("30"),[g,I]=r.useState(!1),[E,X]=r.useState([]),[D,W]=r.useState([]),[o,N]=r.useState([]),[v,_]=r.useState(null);r.useEffect(()=>{s("/admin/appcfg").then(y=>_(y)).catch(()=>{})},[]);const B=y=>s("/admin/appcfg",y).then(q=>_(q)).catch(()=>{});r.useEffect(()=>{I(!1),s("/admin/processors?days="+u).then(y=>{x(gs(y.currency)),C(y.processors||[]),W(y.methods||[]),N(y.renewals||[]),I(!0)}).catch(()=>I(!0))},[u]),r.useEffect(()=>{s("/admin/paycfg?shop="+t).then(y=>X(y.providers||[])).catch(()=>{})},[t]);const Q=(y,q)=>confirm(`${q?"ÐклÑÑиÑÑ":"ÐÑклÑÑиÑÑ"} пÑоÑеÑÑинг «${y}»? 79 80Ðзменение пÑименÑеÑÑÑ ÑÑÐ°Ð·Ñ Ð¸ менÑÐµÑ Ñо, Ñем плаÑÑÑ Ð»Ñди пÑÑмо ÑейÑаÑ.`)?s("/admin/paycfg?shop="+t,{id:y,on:q}).then(P=>X(P.providers||[])).catch(()=>{}):Promise.resolve(),A=async(y,q,P,oe)=>
80{if(!confirm(`${P?"ÐклÑÑиÑÑ":"ÐÑклÑÑиÑÑ"} ÑпоÑоб «${q.join(", ")}» Ñ Â«${y}» (${oe==="recurring"?"подпиÑки":"ÑазовÑе"})? 81 82ÐÑименÑеÑÑÑ ÑÑазÑ.`))return;let L=null;for(const se of q)try{L=await s("/admin/paycfg?shop="+t,{id:y,method:se,on:P,mode:oe})}catch{}L!=null&&L.providers&&X(L.providers)},$=y=>y>=60?"var(--green)":y>=30?"var(--amber)":"var(--coral)",V=i.reduce((y,q)=>y+q.attempts,0),T=i.reduce((y,q)=>y+q.paid,0);return e.jsxs(e.Fragment,{children:[e.jsx(hs,{shop:t,setShop:m}),v&&e.jsx("div",{className:"card pad",style:{marginBottom:14},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{className:"sec-row__t",style:{fontSize:14},children:"УÑÑановка кабинеÑа на ÑелеÑон"}),e.jsx("p",{className:"dim",style:{fontSize:12.5,margin:"4px 0 0",maxWidth:620},children:"ÐÐ°Ð±Ð¸Ð½ÐµÑ ÑÑавиÑÑÑ Ð½Ð° ÑкÑан «Ðомой» как пÑиложение. ÐевÑй ÑÑÐ¼Ð±Ð»ÐµÑ â показÑваÑÑ Ð»Ð¸ пÑедложение в кабинеÑе; вÑклÑÑенное пÑедложение не меÑÐ°ÐµÑ Ð¿Ð¾ÑÑавиÑÑ ÐµÐ³Ð¾ ÑÑками. ÐÑавÑй вÑклÑÑÐ°ÐµÑ ÑÑÑÐ°Ð½Ð¾Ð²ÐºÑ Ñеликом: маниÑеÑÑ Ð¿ÐµÑеÑÑаÑÑ Ð¾ÑдаваÑÑÑÑ, а Ñже поÑÑавленнÑй обÑабоÑÑик ÑнимаеÑÑÑ Ñ Ð»Ñдей пÑи ÑледÑÑÑем Ð·Ð°Ñ Ð¾Ð´Ðµ. ÐÐºÐ¾Ð½ÐºÑ Ñ ÑкÑана ÑелеÑона Ñеловек ÑдалÑÐµÑ Ñам â ÑÑого не Ð¼Ð¾Ð¶ÐµÑ Ð½Ð¸ÐºÑо, кÑоме него."})]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("button",{className:"toggle-pill"+(v.installHint?" is-on":""),onClick:()=>B({installHint:!v.installHint}),children:v.installHint?"пÑедлагаем":"не пÑедлагаем"}),e.jsx("button",{className:"toggle-pill"+(v.pwa?" is-on":""),onClick:()=>{confirm(`${v.pwa?"ÐÑклÑÑиÑÑ":"ÐклÑÑиÑÑ"} ÑÑÑÐ°Ð½Ð¾Ð²ÐºÑ ÐºÐ°Ð±Ð¸Ð½ÐµÑа на ÑелеÑон? 83 84${v.pwa?"У ÑÐµÑ , кÑо Ñже поÑÑавил, обÑабоÑÑик ÑнимеÑÑÑ Ð¿Ñи ÑледÑÑÑем Ð·Ð°Ñ Ð¾Ð´Ðµ.":"ÐÐ°Ð±Ð¸Ð½ÐµÑ Ñнова можно бÑÐ´ÐµÑ Ð¿Ð¾ÑÑавиÑÑ ÐºÐ°Ðº пÑиложение."}`)&&B({pwa:!v.pwa})},children:v.pwa?"ÑÑÑановка вклÑÑена":"ÑÑÑановка вÑклÑÑена"})]})]})}),e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsx("div",{className:"sec-row__t",style:{marginBottom:6,fontSize:14},children:"ÐклÑÑение пÑоÑеÑÑингов"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 12px"},children:["ТÑÐ¼Ð±Ð»ÐµÑ Ð¼Ð³Ð½Ð¾Ð²ÐµÐ½Ð½Ð¾ (KV, без деплоÑ). ",e.jsx("b",{children:"Ðез ÑекÑеÑов вклÑÑиÑÑ Ð½ÐµÐ»ÑзÑ"})," â ÑнаÑала Ð´Ð¾Ð±Ð°Ð²Ñ ÐºÐ»ÑÑи. У каждого пÑоÑеÑÑинга две ÑÑÑоки: ",e.jsx("b",{children:"подпиÑки"})," â Ñем пÑодлеваем авÑомаÑиÑеÑки, ",e.jsx("b",{children:"ÑазовÑе"})," â Ñем плаÑÑÑ ÐµÐ´Ð¸Ð½Ð¾Ð¶Ð´Ñ (докÑпка ÑÑÑÑойÑÑв, коÑоÑкие пеÑиодÑ)."]}),E.map(y=>{const q=y.enabled&&y.configured&&y.registered,P=new Set(y.offRecurring||[]),oe=new Set(y.offOneoff||[]);return e.jsxs("div",{style:{padding:"12px 0",borderTop:"1px solid var(--border)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:700},children:y.id}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:q?"var(--green)":"var(--dim)",display:"inline-block",margin:"0 8px 0 10px"}}),!y.configured&&e.jsx("span",{style:{fontSize:11,color:"var(--coral)"},children:"Ð½ÐµÑ ÑекÑеÑов"}),!y.registered&&e.jsx("span",{style:{marginLeft:8,fontSize:11,color:"var(--coral)"},children:"не заÑегиÑÑÑиÑован"})]}),e.jsx("button",{className:"toggle-pill"+(y.enabled?" is-on":""),onClick:()=>y.configured&&Q(y.id,!y.enabled),disabled:!y.configured,title:y.configured?"":"Ð½ÐµÑ ÑекÑеÑов â вклÑÑиÑÑ Ð½ÐµÐ»ÑзÑ",children:y.enabled?"ÐÐÐ":"вÑкл"})]}),[["подпиÑки",y.recurringMethods||[],"Ñем пÑодлеваем авÑомаÑиÑеÑки","recurring"],["ÑазовÑе",y.methods||[],"докÑпка ÑÑÑÑойÑÑв, коÑоÑкие пеÑиодÑ","oneoff"]].map(([L,se,U,ne])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8,opacity:y.enabled?1:.45,flexWrap:"wrap"},children:[e.jsx("span",{className:"dim",style:{fontSize:12,minWidth:66},title:U,children:L}),se.length?yr(se).map(le=>{const ee=ne==="recurring"?P:oe,be=le.codes.some(d=>!ee.has(d)),w=le.codes.map(d=>{var b;return(b=y.fees)==null?void 0:b[d]}).find(d=>d!=null);return e.jsxs("button",{className:"toggle-pill toggle-pill--xs"+(be?" is-on":""),onClick:()=>A(y.id,le.codes,!be,ne),disabled:!y.enabled,title:le.codes.length>1?`${U} · кодÑ: ${le.codes.join(", ")}`:U,children:[le.label,w!=null?` · ${w}%`:""]},L+le.label)}):e.jsx("span",{className:"dim",style:{fontSize:12},children:"â"})]},L))]},y.id)}),!E.length&&e.jsx("p",{className:"dim",style:{margin:0,fontSize:13},children:"ÐагÑÑзкаâ¦"})]}),e.jsx("div",{style:{marginBottom:14},children:e.jsx(Oe,{options:[["7","7 дней"],["30","30 дней"],["90","90 дней"]],value:u,onChange:k})}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 10px",lineHeight:1.55},children:[e.jsx("b",{children:"ÐопÑÑок"})," â вÑе наÑаÑÑе оплаÑÑ. Ðдин Ñеловек, пеÑебиÑаÑÑий ÑпоÑÐ¾Ð±Ñ (СÐРне оÑкÑÑлÑÑ â каÑÑа â SberPay), Ð´ÐµÐ»Ð°ÐµÑ Ð½ÐµÑколÑко попÑÑок. ",e.jsx("b",{children:"ÐÑдей"})," â ÑколÑко ÑÑо ÑникалÑнÑÑ Ð¿Ð¾ÐºÑпаÑелей. ÐонвеÑÑÐ¸Ñ ÑÑиÑаеÑÑÑ Ð¿Ð¾ лÑдÑм: по попÑÑкам она занижена, поÑÐ¾Ð¼Ñ ÑÑо пеÑÐµÐ±Ð¾Ñ ÑпоÑобов вÑглÑÐ´Ð¸Ñ ÐºÐ°Ðº неÑколÑко оÑказов."]}),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx("th",{style:{padding:6},children:"пÑоÑеÑÑинг"}),e.jsx("th",{title:"ÐÑе попÑÑки оплаÑÑ. Ðдин Ñеловек, пÑобÑÑÑий ÑазнÑе ÑпоÑÐ¾Ð±Ñ (СÐÐ, каÑÑа, SberPay), Ð´ÐµÐ»Ð°ÐµÑ Ð½ÐµÑколÑко попÑÑок â здеÑÑ Ð¾Ð½Ð¸ поÑÑиÑÐ°Ð½Ñ Ð²Ñе",children:"попÑÑок"}),e.jsx("th",{title:"УникалÑнÑе лÑди. Ð¢Ð¾Ñ Ð¶Ðµ Ñеловек Ñ ÑÑÐµÐ¼Ñ Ð¿Ð¾Ð¿ÑÑками â ÑÑо один Ñеловек, а не ÑÑи",children:"лÑдей"}),e.jsx("th",{children:"плаÑежей"}),e.jsx("th",{title:"ÐплаÑивÑие лÑди ÷ вÑе лÑди. Ðо коÑзинам конвеÑÑÐ¸Ñ Ð·Ð°Ð½Ð¸Ð¶ÐµÐ½Ð°: пеÑÐµÐ±Ð¾Ñ ÑпоÑобов оплаÑÑ Ð²ÑглÑÐ´Ð¸Ñ ÐºÐ°Ðº ÑÑи оÑказа",children:"конвеÑÑиÑ"}
84),e.jsx("th",{title:"ÐплаÑеннÑе коÑÐ·Ð¸Ð½Ñ Ã· вÑе коÑзинÑ",children:"по коÑзинам"}),e.jsx("th",{children:"вÑÑÑÑка"})]})}),e.jsxs("tbody",{children:[i.map(y=>{var q;return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6,fontWeight:600},children:((q=bt[y.provider])==null?void 0:q.label)||y.provider}),e.jsx("td",{children:y.attempts}),e.jsx("td",{title:`ÐплаÑили ${y.paidPeople} из ${y.people}`,children:y.people}),e.jsx("td",{children:y.paid}),e.jsxs("td",{style:{fontWeight:700,color:$(y.conversionPeople)},children:[y.conversionPeople,"%"]}),e.jsxs("td",{className:"dim",children:[y.conversion,"%"]}),e.jsxs("td",{children:[(y.revenueCents/100).toLocaleString("ru-RU"),n?" "+n:""]})]}),D.filter(P=>P.provider===y.provider).map(P=>{var oe;return e.jsxs("tr",{style:{color:"var(--muted)",fontSize:12.5},children:[e.jsx("td",{style:{padding:"4px 6px 4px 22px"},children:P.method?((oe=it[P.method])==null?void 0:oe.label)||P.method:"меÑод не запиÑан"}),e.jsx("td",{children:P.attempts}),e.jsx("td",{title:`ÐплаÑили ${P.paidPeople} из ${P.people}`,children:P.people}),e.jsx("td",{children:P.paid}),e.jsxs("td",{style:{color:$(P.conversionPeople)},children:[P.conversionPeople,"%"]}),e.jsxs("td",{style:{opacity:.6},children:[P.conversion,"%"]}),e.jsxs("td",{children:[(P.revenueCents/100).toLocaleString("ru-RU"),n?" "+n:""]})]},y.provider+":"+P.method)})]},y.provider)}),i.length>1&&e.jsxs("tr",{style:{borderTop:"1px solid rgba(255,255,255,0.14)",color:"var(--muted)"},children:[e.jsx("td",{style:{padding:6},children:"иÑого"}),e.jsx("td",{children:V}),e.jsx("td",{children:T}),e.jsxs("td",{children:[V?Math.round(T/V*1e3)/10:0,"%"]}),e.jsx("td",{children:"â"})]})]})]}),g&&!i.length&&e.jsx("p",{className:"dim",style:{margin:"10px 0 0",fontSize:14},children:"Ðока Ð½ÐµÑ Ð¿Ð¾Ð¿ÑÑок оплаÑÑ Ð·Ð° пеÑиод."}),!g&&e.jsx("p",{className:"dim",style:{margin:"10px 0 0"},children:"ÐагÑÑзкаâ¦"})]}),e.jsx("p",{className:"dim",style:{fontSize:12,marginTop:10,lineHeight:1.6},children:"ÐонвеÑÑÐ¸Ñ = оплаÑено ÷ попÑÑок (даннÑе из checkout_attempts). ÐÑо оÑнова каÑкада: по конвеÑÑии/здоÑовÑÑ Ð¿ÑоÑеÑÑинга вÑбиÑаеÑÑÑ Ð¿ÑиоÑиÑеÑ. ÐÑказÑ/ÑоÑаÑÐ¸Ñ Ð½Ð° возвÑаÑе поÑвÑÑÑÑ, когда вклÑÑим диÑпеÑÑеÑ."}),e.jsx("h3",{style:{margin:"22px 0 6px",fontSize:15.5},children:"ÐвÑоÑпиÑÐ°Ð½Ð¸Ñ (пÑодлениÑ)"}),e.jsxs("p",{className:"dim",style:{fontSize:12.5,margin:"0 0 10px",lineHeight:1.55},children:["ÐдеÑÑ Ð½ÐµÑ ÐºÐ¾ÑзинÑ: ÑпиÑание иниÑииÑÑем Ð¼Ñ Ð¿Ð¾ ÑоÑ
ÑанÑÐ½Ð½Ð¾Ð¼Ñ ÑоглаÑиÑ. ",e.jsx("b",{children:"ÐопÑÑок"})," â вÑе ÑпиÑÐ°Ð½Ð¸Ñ Ð·Ð° пеÑиод, ",e.jsx("b",{children:"пÑоÑло"})," â ÑдаÑнÑе, ",e.jsx("b",{children:"не пÑоÑло"})," â оÑÑалÑнÑе. Ðизкий пÑоÑÐµÐ½Ñ Ð·Ð½Ð°ÑÐ¸Ñ Ð½Ðµ «плоÑ
о пÑодаÑм», а ÑÑо пÑивÑзки ÑмиÑаÑÑ: оÑозванное ÑоглаÑие, иÑÑÑкÑÐ°Ñ ÐºÐ°ÑÑа, оÑказ банка.",e.jsx("b",{children:" ÐонвеÑÑÐ¸Ñ ÑÑиÑаеÑÑÑ Ð¿Ð¾ лÑдÑм"}),", а «не пÑоÑло» â по попÑÑкам: по Ð¾Ð´Ð½Ð¾Ð¼Ñ Ð¿Ð¾Ð´Ð¿Ð¸ÑÑÐ¸ÐºÑ Ð±Ð¸Ð»Ð»ÐµÑ Ð¿Ð¾Ð²ÑоÑÑÐµÑ ÑпиÑание неÑколÑко Ñаз, поÑÑÐ¾Ð¼Ñ Ð¾Ñказов в ленÑе плаÑежей вÑегда болÑÑе, Ñем лÑдей."]}),e.jsxs("div",{className:"card pad",style:{overflowX:"auto"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13.5,whiteSpace:"nowrap"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{textAlign:"left",color:"var(--muted)"},children:[e.jsx("th",{style:{padding:6},children:"пÑоÑеÑÑинг"}),e.jsx("th",{title:"ÐÑе ÑпиÑÐ°Ð½Ð¸Ñ Ð¿Ð¾ ÑоÑ
ÑанÑÐ½Ð½Ð¾Ð¼Ñ ÑоглаÑÐ¸Ñ Ð·Ð° пеÑиод, вклÑÑÐ°Ñ Ð¿Ð¾Ð²ÑоÑÑ Ð¿Ð¾Ñле оÑказа",children:"попÑÑок"}),e.jsx("th",{title:"УникалÑнÑе подпиÑÑики, по коÑоÑÑм Ñли ÑпиÑаниÑ",children:"лÑдей"}),e.jsx("th",{children:"пÑоÑло"}),e.jsx("th",{title:"СпиÑаниÑ, коÑоÑÑе не пÑоÑли. Ðо Ð¾Ð´Ð½Ð¾Ð¼Ñ ÑÐµÐ»Ð¾Ð²ÐµÐºÑ Ð¿Ð¾Ð¿ÑÑок бÑÐ²Ð°ÐµÑ Ð½ÐµÑколÑко: Ð±Ð¸Ð»Ð»ÐµÑ Ð¿Ð¾Ð²ÑоÑÑÐµÑ Ð¸Ñ
по леÑÑниÑе",children:"не пÑоÑло"}),e.jsx("th",{title:"ÐÑди Ñ ÑдаÑнÑм ÑпиÑанием ÷ вÑе, по ÐºÐ¾Ð¼Ñ Ð¿ÑÑалиÑÑ",children:"конвеÑÑиÑ"}),e.jsx("th",{title:"УдаÑнÑе ÑпиÑÐ°Ð½Ð¸Ñ Ã· вÑе попÑÑки",children:"по попÑÑкам"}),e.jsx("th",{children:"вÑÑÑÑка"})]})}),e.jsx("tbody",{children:o.map(y=>{var q;return e.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[e.jsx("td",{style:{padding:6,fontWeight:600},children:((q=bt[y.provider])==null?void 0:q.label)||y.provider}),e.jsx("td",{children:y.attempts}),e.jsx("td",{title:`СпиÑалоÑÑ Ñ ${y.paidPeople} из ${y.people}`,children:y.people}),e.jsx("td",{children:y.paid}),e.jsx("td",{title:`ÐÑдей без единого ÑÑпеÑного ÑпиÑаниÑ: ${Math.max(0,y.people-y.paidPeople)}`,children:Math.max(0,y.attempts-y.paid)}),e.jsxs("td",{style:{fontWeight:700,color:$(y.conversionPeople)},children:[y.conversionPeople,"%"]}),e.jsxs("td",{className:"dim",children:[y.conversion,"%"]}
84),e.jsxs("td",{children:[(y.revenueCents/100).toLocaleString("ru-RU"),n?" "+n:""]})]},"ren:"+y.provider)})})]}),g&&!o.length&&e.jsx("p",{className:"dim",style:{margin:"10px 0 0",fontSize:14},children:"Ðа пеÑиод авÑоÑпиÑаний не бÑло."}),!g&&e.jsx("p",{className:"dim",style:{margin:"10px 0 0"},children:"ÐагÑÑзкаâ¦"})]})]})}const wr={trial_push:"ÐÑобнÑй Ð´ÐµÐ½Ñ Ð·Ð° 1 â½",abandoned_cart:"ÐÑоÑÐµÐ½Ð½Ð°Ñ ÐºÐ¾Ñзина",renew_due:"ÐоÑа пÑодлиÑÑ (ÑÑÑÐ½Ð°Ñ Ð¾Ð¿Ð»Ð°Ñа)",payment_failed:"Ðе пÑоÑла оплаÑа",expired:"ÐодпиÑка иÑÑекла",not_connected:"Ðе подклÑÑилÑÑ",winback:"ÐозвÑÐ°Ñ (win-back)",reactivation:"РеакÑиваÑÐ¸Ñ (давно не бÑло)",upsell:"ÐпÑейл на долгий ÑÑок",invite:"ÐÑиглаÑи дÑÑга",renewed:"ÐодпиÑка пÑодлена",granted:"ÐодпиÑка вÑдана (пÑивеÑÑÑвие)",refunded:"ÐозвÑÐ°Ñ ÑÑедÑÑв",loyalty:"ÐоÑлÑноÑÑÑ / ÑпаÑибо",referral_reward:"ÐонÑÑ Ð·Ð° дÑÑга (ÑеÑеÑал)"},Et=[{key:"tg",label:"ТекÑÑ ÑообÑениÑ",chan:"telegram",min:130},{key:"email_subject",label:"Тема пиÑÑма",chan:"email",single:!0},{key:"email_body",label:"ТекÑÑ Ð¿Ð¸ÑÑма (необÑзаÑелÑно)",chan:"email",min:130,hint:"Ðо ÑмолÑÐ°Ð½Ð¸Ñ Ð¿Ð¸ÑÑмо ÑвÑÑÑÑано кÑаÑивÑм Ñаблоном (нажми «ÐÑедпÑоÑмоÑÑ»). Ðаполни ÑÑо поле, ÑолÑко еÑли Ñ
оÑеÑÑ Ð·Ð°Ð¼ÐµÐ½Ð¸ÑÑ Ñаблон пÑоÑÑÑм ÑекÑÑом в бÑендовой Ñамке."}],Nn={ru:"Ð ÑÑÑкий",en:"English",es:"Español",de:"Deutsch",fr:"Français",uk:"УкÑаÑнÑÑка",ar:"Ø§ÙØ¹Ø±Ø¨ÙØ©",zh:"䏿",tr:"Türkçe"};function Nr({item:s,api:t,lang:m,chan:n}){var V;const x=Object.keys(s.defaults||{}),i=(T,y)=>{var q,P;return((P=(q=s.defaults)==null?void 0:q[T])==null?void 0:P[y])??""},C=()=>{var y,q;const T={};for(const P of x){T[P]={};for(const oe of Et)T[P][oe.key]=((q=(y=s.override)==null?void 0:y[P])==null?void 0:q[oe.key])??i(P,oe.key)}return T},[u,k]=r.useState(C),[g,I]=r.useState(u),[E,X]=r.useState(!1),[D,W]=r.useState(""),[o,N]=r.useState(null),v=JSON.stringify(u)!==JSON.stringify(g),_=(T,y,q)=>k(P=>({...P,[T]:{...P[T],[y]:q}})),B=async()=>{X(!0),W("");const T={kind:s.kind};for(const y of x){T[y]={};for(const q of Et)T[y][q.key]=u[y][q.key]===i(y,q.key)?"":u[y][q.key]}try{await t("/admin/msgcopy",T),I(u),W("СоÑ
Ñанено â")}catch(y){W("ÐÑибка: "+y.message)}finally{X(!1)}},Q=async()=>{var y,q;W("");const T={};for(const P of Et)T[P.key]=((y=u[m])==null?void 0:y[P.key])===i(m,P.key)?"":(q=u[m])==null?void 0:q[P.key];try{N(await t("/admin/msgcopy/preview",{kind:s.kind,lang:m,chan:n,draft:T}))}catch(P){W("ÐÑибка пÑевÑÑ: "+P.message)}},A=Et.filter(T=>T.chan===n),$=x.filter(T=>T!==m).some(T=>A.some(y=>{var q;return((q=u[T])==null?void 0:q[y.key])!==i(T,y.key)}));return e.jsxs("div",{className:"card pad",style:{marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:10,flexWrap:"wrap",marginBottom:10},children:[e.jsx("div",{style:{fontWeight:700,fontSize:15},children:wr[s.kind]||s.kind}),e.jsx("span",{className:"dim",style:{fontSize:12},children:s.kind})]}),A.map(T=>{var q,P,oe,L,se;const y=((q=u[m])==null?void 0:q[T.key])!==i(m,T.key);return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{fontSize:11.5,marginBottom:3,color:y?"var(--violet-2)":"var(--dim)"},children:[T.label,y?" ⢠изменено":""]}),T.single?e.jsx("input",{style:{...We,width:"100%"},value:((P=u[m])==null?void 0:P[T.key])??"",onChange:U=>_(m,T.key,U.target.value)}):e.jsx("textarea",{style:{...We,width:"100%",minHeight:T.min,resize:"vertical",lineHeight:1.5},placeholder:T.key==="email_body"&&!i(m,T.key)?"ÐÑÑÑо â пиÑÑмо ÑйдÑÑ ÑÑандаÑÑнÑм ÑвÑÑÑÑаннÑм Ñаблоном. «ÐÑедпÑоÑмоÑÑ» Ð¿Ð¾ÐºÐ°Ð¶ÐµÑ ÐµÐ³Ð¾ Ñеликом.":void 0,value:((oe=u[m])==null?void 0:oe[T.key])??"",onChange:U=>_(m,T.key,U.target.value)}),T.hint&&e.jsx("div",{className:"dim",style:{fontSize:11,marginTop:4,lineHeight:1.5},children:T.hint}),T.key==="tg"&&((se=(L=s.defaults)==null?void 0:L[m])==null?void 0:se.tg_rich)&&e.jsxs("div",{className:"dim",style:{fontSize:11,marginTop:4,lineHeight:1.5},children:["У ÑÑого ÑообÑÐµÐ½Ð¸Ñ ÑÐ»Ð¾Ð¶Ð½Ð°Ñ Ð²ÑÑÑÑка (ÑаблиÑа/ÑпиÑок), она задана в коде â нажми «ÐÑедпÑоÑмоÑÑ». ÐÑли впиÑеÑÑ Ñвой ÑекÑÑ, ÑйдÑÑ Ð¾Ð½ ",e.jsx("b",{children:"вмеÑÑо"})," вÑÑÑÑки."]})]},T.key)}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[e.jsx("button",{className:"btn btn--sm",disabled:E||!v,onClick:B,children:E?"СоÑ
Ñанениеâ¦":"СоÑ
ÑаниÑÑ"}),e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:E,onClick:Q,title:"ÐоказаÑÑ, как ÑообÑение бÑÐ´ÐµÑ Ð²ÑглÑдеÑÑ Ð¿Ñи оÑпÑавке",children:"ÐÑедпÑоÑмоÑÑ"}),e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:E,onClick:()=>{for(const T of A)_(m,T.key,i(m,T.key))},title:"ÐеÑнÑÑÑ ÑекÑÑ ÑÑого ÑзÑка/канала к заводÑÐºÐ¾Ð¼Ñ (Ð
84¿Ð¾Ñле «СоÑ
ÑаниÑÑ» овеÑÑайд оÑиÑÑиÑÑÑ)",children:"СбÑоÑиÑÑ Ðº ÑмолÑаниÑ"}),$&&e.jsx("span",{className:"dim",style:{fontSize:12},children:"еÑÑÑ Ð½ÐµÑоÑ
ÑанÑннÑе пÑавки на дÑÑгиÑ
ÑзÑкаÑ
"}),D&&e.jsx("span",{className:"dim",style:{fontSize:13},children:D})]}),o&&e.jsx("div",{onClick:()=>N(null),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.65)",zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:e.jsxs("div",{onClick:T=>T.stopPropagation(),style:{background:"var(--surface-2)",border:"1px solid var(--border)",borderRadius:16,maxWidth:620,width:"100%",maxHeight:"90vh",overflow:"auto",padding:18},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:["ÐÑедпÑоÑмоÑÑ Â· ",n==="email"?"ÐоÑÑа":"Telegram"," · ",Nn[m]||m.toUpperCase()]}),e.jsx("button",{className:"btn btn--ghost btn--xs",onClick:()=>N(null),children:"â"})]}),o.stripped&&e.jsx("div",{style:{fontSize:12.5,lineHeight:1.45,marginBottom:10,color:"var(--coral)"},children:"ЧаÑÑÑ Ð¾ÑоÑÐ¼Ð»ÐµÐ½Ð¸Ñ Ð²ÑÑезана из ÑообÑажений безопаÑноÑÑи â в ÑообÑении ÐµÑ Ð½Ðµ бÑдеÑ."}),n==="email"?e.jsxs(e.Fragment,{children:[o.subject!==void 0&&e.jsxs("div",{className:"dim",style:{fontSize:13,marginBottom:8},children:["Тема: ",e.jsx("span",{style:{color:"var(--text)"},children:o.subject})]}),e.jsx("iframe",{title:"email-preview",sandbox:"allow-same-origin",srcDoc:o.html||"",style:{width:"100%",height:320,maxHeight:"72vh",border:"1px solid var(--border)",borderRadius:10,background:"#fff",display:"block"},onLoad:T=>{var y,q,P;try{const oe=T.currentTarget,L=(P=(q=(y=oe.contentWindow)==null?void 0:y.document)==null?void 0:q.documentElement)==null?void 0:P.scrollHeight;L&&(oe.style.height=Math.min(L+4,Math.round(window.innerHeight*.72))+"px")}catch{}}})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"var(--bg)",border:"1px solid var(--border)",borderRadius:12,padding:"14px 16px",fontSize:14.5,lineHeight:1.5,wordBreak:"break-word",...o.blocksHtml?{}:{whiteSpace:"pre-wrap"}},dangerouslySetInnerHTML:{__html:o.blocksHtml||_i(o.text||"")}}),((V=o.button)==null?void 0:V.text)&&e.jsx("div",{style:{marginTop:10},children:e.jsx("a",{href:o.button.url,target:"_blank",rel:"noreferrer",style:{display:"block",textAlign:"center",padding:"11px 16px",borderRadius:10,background:"rgba(91,156,255,0.16)",border:"1px solid rgba(91,156,255,0.4)",color:"var(--violet-2)",fontWeight:700,fontSize:14,textDecoration:"none"},children:o.button.text})}),e.jsxs("div",{className:"dim",style:{fontSize:11.5,marginTop:8},children:[o.rich?"ÐÑо ÑообÑение Ñо Ñложной вÑÑÑÑкой (ÑаблиÑа/ÑпиÑок) â показана ÑаÑкладка. ":"","ÐнимиÑованнÑе Ñмодзи и ÑоÑо-Ð±Ð°Ð½Ð½ÐµÑ Ð¾ÑобÑажаÑÑÑÑ ÑолÑко в Ñамом Telegram."]})]})]})})]})}function Oe({options:s,value:t,onChange:m}){return e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:s.map(([n,x])=>e.jsx("button",{onClick:()=>m(n),style:{fontFamily:"inherit",fontWeight:700,fontSize:12.5,padding:"6px 13px",borderRadius:999,cursor:"pointer",border:"1px solid "+(t===n?"rgba(91,156,255,0.55)":"rgba(255,255,255,0.1)"),background:t===n?"rgba(91,156,255,0.22)":"var(--surface)",color:"var(--text)"},children:x},n))})}function kr({api:s}){const[t,m]=r.useState([]),[n,x]=r.useState([]),[i,C]=r.useState(!1),[u,k]=r.useState("telegram"),[g,I]=r.useState("ru"),E=()=>s("/admin/msgcopy").then(W=>{m(W.kinds||[]),x(W.placeholders||[]),C(!0)}).catch(()=>C(!0));r.useEffect(()=>{E()},[]);const X=t.length?Object.keys(t[0].defaults||{}):["ru","en"],D=u==="telegram"?t.filter(W=>X.some(o=>{var N,v;return(v=(N=W.defaults)==null?void 0:N[o])==null?void 0:v.tg})):t;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"card pad",style:{marginBottom:14,fontSize:13.5,lineHeight:1.6},children:[e.jsx("div",{style:{fontWeight:700,marginBottom:6},children:"Ðак ÑÑо ÑабоÑаеÑ"}),e.jsxs("p",{className:"dim",style:{margin:0},children:["ТекÑÑÑ Ñведомлений (маÑкеÑинг + жизненнÑй Ñикл подпиÑки). ÐÑбеÑиÑе канал (Telegram или ÐоÑÑа) и ÑзÑк â ниже покажÑÑÑÑ ÑообÑÐµÐ½Ð¸Ñ ÑолÑко Ð´Ð»Ñ ÑÑой паÑÑ. «ÐÑедпÑоÑмоÑÑ» показÑваеÑ, как ÑообÑение ÑйдÑÑ Ð½Ð° Ñамом деле. ÐÑавки пÑименÑÑÑÑÑ ÑÑазÑ, без деплоÑ. ÐÑавки на ÑазнÑÑ
ÑзÑкаÑ
копÑÑÑÑ â ÑоÑ
ÑанÑÑÑÑÑ Ð¿Ð¾ кнопке.",e.jsx("br",{}),e.jsx("b",{children:"Telegram:"})," поле «ТекÑÑ ÑообÑениÑ» â ÑÑо и еÑÑÑ Ñамо ÑообÑение (HTML ",e.jsx("code",{children:"<b>"}),", ",e.jsx("code",{children:"<i>"})," ÑоÑ
ÑанÑеÑÑÑ).",e.jsx("br",{}),e.jsx("b",{children:"ÐоÑÑа:"})," пиÑÑмо ÑвÑÑÑÑано кÑаÑивÑм Ñаблоном в коде â ÑедакÑиÑÑеÑÑÑ Â«Ð¢ÐµÐ¼Ð°Â», а «ТекÑÑ Ð¿Ð¸ÑÑма» заполнÑеÑÑÑ, ÑолÑко еÑли нÑжно замениÑÑ Ñаблон пÑоÑÑÑм ÑекÑÑом."]}),!!n.length&&e.jsxs("p",{className:"dim",style:{margin:"8px 0 0"},children:["ÐлейÑÑ
олдеÑÑ (одна ÑигÑÑÐ½Ð°Ñ Ñкобка): ",n.map(W=>`{${W}}`).join(" ")," â подÑÑавлÑÑÑÑÑ Ð°Ð²ÑомаÑиÑеÑки пÑи оÑпÑавке; еÑли знаÑÐµÐ½Ð¸Ñ Ð½ÐµÑ, подÑÑавиÑÑÑ Ð¿ÑÑÑÐ°Ñ ÑÑÑока (оÑибки не бÑдеÑ)."]})]}),e.jsxs("div",{style:{display:"flex",gap:20,flexWrap:"wrap",alignItems:"flex-end",marginBottom:16},children:[e.jsxs("div",{children:[e.jsx("div",{className:"dim",style:{fontSize:11.5,marginBottom:5,textTransform:"uppercase",letterSpacing:"0.04em"},children:"Ðанал"}),e.jsx(Oe,{options:[["telegram","Telegram"],["email","ÐоÑÑа"]],value:u,onChange:W=>k(W)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"dim",style:{fontSize:11.5,marginBottom:5,textTransform:"uppercase",letterSpacing:"0.04em"},children:"ЯзÑк"}),e.jsx(Oe,{options:X.map(W=>[W,Nn[W]||W.toUpperCase()]),value:g,onChange:I})]})]}),D.map(W=>e.jsx(Nr,{item:W,api:s,lang:g,chan:u},W.kind)),i&&!t.length&&e.jsx("p",{className:"dim",children:"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ."}),i&&!!t.length&&!D.length&&e.jsx("p",{className:"dim",children:"Ðл
84Ñ ÑÑого канала Ð½ÐµÑ ÑообÑений."}),!i&&e.jsx("p",{className:"dim",children:"ÐагÑÑзкаâ¦"})]})}function Cr(s){return s.replace(/(^|[\s([])_([^_\n]+)_(?=$|[\s).,!?:;])/g,"$1$2").replace(/(^|[\s([])\*([^*\n]+)\*(?=$|[\s).,!?:;])/g,"$1$2")}function tn({body:s}){const t=/(https?:\/\/[^\s<>()"'\][]+)/g,m=(s||"(пÑÑÑое Ñело)").split(` 85`);return e.jsx("div",{style:{marginTop:8,padding:"14px 16px",borderRadius:12,border:"1px solid var(--border)",background:"#fff",color:"#1a1d23",wordBreak:"break-word",fontSize:14,lineHeight:1.6},children:m.map((n,x)=>{if(/^\s*[-ââ_=]{3,}\s*$/.test(n))return e.jsx("hr",{style:{border:"none",borderTop:"1px solid var(--border)",margin:"14px 0"}},x);const i=n.split(t);return e.jsx("div",{style:{minHeight:n.trim()?void 0:"0.9em",whiteSpace:"pre-wrap"},children:i.map((C,u)=>/^https?:\/\//.test(C)?e.jsx("a",{href:C,target:"_blank",rel:"noopener noreferrer",style:{color:"#5b3df5",wordBreak:"break-all"},children:C},u):e.jsx("span",{children:Cr(C)},u))},x)})})}function sn({files:s,onDrop:t}){const[m,n]=r.useState([]);return r.useEffect(()=>{const x=s.map(i=>URL.createObjectURL(i));return n(x),()=>{for(const i of x)URL.revokeObjectURL(i)}},[s]),s.length?e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginTop:8},children:s.map((x,i)=>e.jsxs("div",{style:{position:"relative",width:132},children:[e.jsx("a",{href:m[i]||"#",target:"_blank",rel:"noopener noreferrer",title:"оÑкÑÑÑÑ Ð² полнÑй ÑазмеÑ",style:{display:"block",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",background:"#fff"},children:m[i]&&e.jsx("img",{src:m[i],alt:x.name,style:{display:"block",width:"100%",height:96,objectFit:"cover",objectPosition:"top"}})}),e.jsx("button",{className:"btn btn--ghost btn--xs",title:"ÑбÑаÑÑ",onClick:()=>t(i),style:{position:"absolute",top:4,right:4,padding:"0 6px",background:"var(--surface)",borderRadius:6},children:"Ã"}),e.jsxs("div",{className:"dim",style:{fontSize:11.5,marginTop:4,lineHeight:1.3,overflowWrap:"anywhere"},children:[x.name," · ",Math.max(1,Math.round(x.size/1024))," ÐÐ"]})]},x.name+i))}):null}function zr({body:s,html:t}){const m=(t||"").trim()||(/^\s*(?:<!doctype|<html|<table|<div|<body|<p\b|<a\b|<img)/i.test(s||"")?s:""),[n,x]=r.useState(!1);return m?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,margin:"8px 0 6px"},children:[e.jsx("button",{className:"toggle-pill toggle-pill--xs"+(n?"":" is-on"),onClick:()=>x(!1),children:"пиÑÑмо"}),e.jsx("button",{className:"toggle-pill toggle-pill--xs"+(n?" is-on":""),onClick:()=>x(!0),children:"ÑекÑÑ"})]}),n?e.jsx(tn,{body:s||"(ÑекÑÑовой ÑаÑÑи неÑ)"}):e.jsx("iframe",{title:"email",sandbox:"",srcDoc:`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>html,body{margin:0;padding:0}body{-webkit-text-size-adjust:100%;overflow-wrap:break-word;overflow-x:auto;font:15px/1.5 -apple-system,Segoe UI,Roboto,sans-serif}img{max-width:min(100%,420px)!important;max-height:480px!important;height:auto!important;object-fit:contain}table{max-width:100%}th,td{word-break:normal;overflow-wrap:normal}a{overflow-wrap:anywhere;word-break:break-word}pre{white-space:pre-wrap}*{box-sizing:border-box}</style></head><body>${m}</body></html>`,style:{width:"100%",height:560,maxHeight:"70vh",border:"1px solid var(--border)",borderRadius:12,background:"#fff"}})]}):e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,margin:"8px 0 6px"},children:[e.jsx("button",{className:"toggle-pill toggle-pill--xs",disabled:!0,title:"У ÑÑого пиÑÑма Ð½ÐµÑ html-ÑаÑÑи â оÑпÑавиÑÐµÐ»Ñ Ð¿ÑиÑлал ÑолÑко ÑекÑÑ",children:"пиÑÑмо"}),e.jsx("button",{className:"toggle-pill toggle-pill--xs is-on",children:"ÑекÑÑ"})]}),e.jsx(tn,{body:s||"(пÑÑÑое Ñело)"})]})}function _r({api:s}){const[t,m]=r.useState(null),[n,x]=r.useState(!1);if(r.useEffect(()=>{s("/admin/mail/deliverability").then(m).catch(()=>x(!0))},[]),n||!t)return null;const i=g=>{const I=((g==null?void 0:g.delivered)||0)+((g==null?void 0:g.failed)||0);return I?Math.round(100*g.delivered/I):null},C=i(t.week),u=i(t.today),k=g=>g==null?"var(--muted)":g>=95?"var(--green)":g>=85?"var(--amber)":"var(--coral)";return e.jsx("div",{className:"card pad",style:{marginBottom:14},children:e.jsxs("div",{className:"row",style:{alignItems:"baseline"},children:[e.jsxs("div",{style:{display:"flex",gap:22,flexWrap:"wrap",alignItems:"baseline"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:24,fontWeight:700,color:k(u)},children:u==null?"â":u+"%"}),e.jsxs("div",{className:"dim",style:{fontSize:12},children:["доÑло ÑÐµÐ³Ð¾Ð´Ð½Ñ Â· ",t.today.delivered+t.today.failed," пиÑем"]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:24,fontWeight:700,color:k(C)},children:C==null?"â":C+"%"}),e.jsxs("div",{className:"dim",style:{fontSize:12},children:["за Ð½ÐµÐ´ÐµÐ»Ñ Â· ",t.week.delivered+t.week.failed," пиÑем"]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:24,fontWeight:700},children:t.rep.green}),e.jsx("div",{className:"dim",style:{fontSize:12},children:"адÑеÑов Ñ Ð¿Ð¾Ð´ÑвеÑждÑнной доÑÑавкой"})]})]}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",maxWidth:460,justifyContent:"flex-end"},children:t.causes.slice(0,5).map(g=>e.jsxs("span",{className:"chipb",title:"пÑиÑина оÑказа за неделÑ",children:[g.cause," · ",g.n]},g.cause))})]})})}function Tr({api:s}){const[t,m]=r.useState(null),[n,x]=r.useState(""),[i,C]=r.useState(""),[u,k]=r.useState(""),[g,I]=r.useState(null),[E,X]=r.useState(null),[D,W]=r.useState(null),[o,N]=r.useState(null),[v,_]=r.useState(!1),B=r.useRef(0),Q=r.useRef(0),A=()=>{const L=++B.current,se=new URLSearchParams;n.trim()&&se.set("q",n.trim()),i&&se.set("state",i),u&&se.set("kind",u),s(`/admin/mail/sent?${se}`).then(U=>{L===B.current&&m(U.sent||[])}).catch(()=>{L===B.current&&_(!0)})};if(r.useEffect(()=>{const L=setTimeout(A,n?350:0);return()=>clearTimeout(L)},[n,i,u]),v)return null;const $=async L=>{if(g===L){Q.current++,I(null),X(null),W(null),N(null);return}const se=++Q.current;I(L),X(null),W(null),N(null);try{const U=await s(`/admin/mail/sent/${encodeURIComponent(L)}/log`);se===Q.current&&X(U)}catch{se===Q.current&&X({steps:[]})}},V=async(L,se)=>{const U=Q.current;W(se?null:"загÑÑжаÑâ¦"),se&&N("загÑÑжаÑâ¦");try{const ne=await s(`/admin/mail/sent/${encodeURIComponent(L)}/raw${se?`?part=${se}`:""}`);if(U!==Q.current)return;se?N(ne.raw||""):W(ne.raw||"(пÑÑÑо)")}catch{if(U!==Q.current)return;const ne="ÐедоÑÑÑпно: пиÑÑмо ÑÑло дÑÑгим каналом либо ÑÑаÑÑе двÑÑ Ð½ÐµÐ´ÐµÐ»Ñ.";se?N(ne):W(ne)}},T=L=>
85new Date(L).toLocaleString("ru-RU",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}),y={delivered:["доÑло","var(--green)"],bounced:["оÑбиÑо","var(--coral)"],failed:["не ÑÑло","var(--coral)"],deferred:["оÑложено","var(--amber)"],complained:["жалоба","var(--coral)"],suppressed:["не Ñлали","var(--muted)"],rejected:["Ñпам-ÑилÑÑÑ","var(--coral)"],soft:["не пÑинÑл ÑÑик","var(--amber)"],unknown:["Ð½ÐµÑ Ð´Ð°Ð½Ð½ÑÑ
","var(--muted)"]},q=L=>String(L||"").split(":")[0].trim(),P=L=>String(L||"").split(":").slice(1).join(":").trim(),oe={delivered:"пÑинÑÑо поÑÑовиком",bounced:"оÑказ",deferred:"пÑидеÑжано, попÑобÑÐµÑ ÐµÑÑ",failed:"не доÑÑавлено",complained:"пожаловалиÑÑ Ð½Ð° Ñпам",suppressed:"не оÑпÑавлÑли",accepted:"пÑинÑÑо поÑÑовиком",rejected:"оÑклонено (Ñпам-ÑилÑÑÑ Ð¸Ð»Ð¸ полиÑика поÑÑовика)"};return e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsxs("div",{className:"row",style:{alignItems:"baseline",marginBottom:10,gap:12,flexWrap:"wrap"},children:[e.jsx("div",{style:{fontWeight:700},children:"ÐиÑÑма · ÑÑо ÑÑло каждомÑ"}),e.jsx(Oe,{options:[["","вÑе"],["bounced","оÑбиÑÑе"],["pending","в пÑÑи"],["delivered","доÑли"]],value:i,onChange:L=>C(String(L))}),e.jsx(Oe,{options:[["","лÑбÑе"],["transactional","важное"],["marketing","ÑаÑÑÑлка"]],value:u,onChange:L=>k(String(L))}),e.jsx("input",{className:"field",value:n,onChange:L=>x(L.target.value),placeholder:"адÑÐµÑ Ð¿Ð¾Ð»ÑÑаÑелÑ",style:{maxWidth:240,marginLeft:"auto"}})]}),!t&&e.jsx("div",{className:"dim",children:"ÑÑиÑаÑâ¦"}),t&&!t.length&&e.jsx("div",{className:"dim",children:"пиÑем неÑ"}),t&&!!t.length&&e.jsx("div",{className:"ms-rows",children:t.map(L=>{var le;const[se,U]=y[q(L.state)]||["в пÑÑи","var(--muted)"],ne=g===L.msg_id;return e.jsxs("div",{className:"ms-row"+(ne?" is-open":""),children:[e.jsxs("button",{className:"ms-main",onClick:()=>$(L.msg_id),children:[e.jsxs("span",{className:"ms-text",children:[e.jsx("span",{className:"ms-subj",children:L.subject||(L.kind==="marketing"?"РаÑÑÑлка":"ÐиÑÑмо без ÑемÑ")}),e.jsx("span",{className:"ms-to",children:L.email})]}),e.jsxs("span",{className:"ms-meta",children:[e.jsx("span",{style:{color:U,fontWeight:700},children:se}),e.jsx("span",{className:"dim",children:T(L.sent_at)}),e.jsxs("span",{className:"dim",children:[L.kind==="marketing"?"ÑаÑÑÑлка":"важное"," · ",L.channel]})]})]}),ne&&e.jsxs("div",{className:"ms-trail",children:[!E&&e.jsx("div",{className:"dim",children:"ÑмоÑÑÑ Ð¿ÑÑÑâ¦"}),E&&!(E.steps||[]).length&&(L.state?e.jsxs("div",{children:[((le=y[q(L.state)])==null?void 0:le[0])||L.state,P(L.state)&&e.jsx("div",{className:"mv-why",children:P(L.state)})]}):e.jsx("div",{className:"dim",children:"ÐÑÑÑÑ Ð¿Ð¾ÑÑовика еÑÑ Ð½Ðµ пÑиÑÑл: жÑÑнал Cloudflare оÑÑÑаÑÑ Ð¾Ñ Ð¾ÑпÑавки на минÑÑÑâÑаÑÑ, ÑÐ°Ð·Ð±Ð¾Ñ Ð¸Ð´ÑÑ ÐºÐ°Ð¶Ð´Ñе 15 минÑÑ."})),E&&!!(E.steps||[]).length&&e.jsx("ol",{className:"ms-steps",children:E.steps.map((ee,be)=>e.jsxs("li",{children:[e.jsx("span",{className:"dim",children:T(ee.created_at)})," · ",oe[ee.event]||ee.event,!!ee.smtp_code&&e.jsxs(e.Fragment,{children:[" "," · ","код ",ee.smtp_code]}),!!ee.enhanced&&e.jsxs(e.Fragment,{children:[" (",ee.enhanced,")"]}),!!ee.message&&e.jsx("div",{className:"mv-why",children:ee.message}),ee.dead&&e.jsx("div",{className:"dim",style:{fontSize:12},children:"адÑÐµÑ Ð¿Ð¾Ð³Ð°Ñен по ÑÑÐ¾Ð¼Ñ Ð¾ÑвеÑÑ"})]},be))}),L.channel==="cf"?e.jsx("div",{className:"dim",style:{marginTop:8,fontSize:13},children:"ÐиÑÑмо ÑÑло ÑеÑез Cloudflare â его ÑекÑÑ Ð½Ðµ Ñ
ÑаниÑÑÑ."}):e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>V(L.msg_id,"html"),children:"ÐоказаÑÑ Ð¿Ð¸ÑÑмо"}),e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>V(L.msg_id),children:"ÐÑÑ
одник"})]}),o!==null&&(o==="загÑÑжаÑâ¦"?e.jsx("div",{className:"dim",style:{marginTop:10},children:o}):e.jsx("iframe",{className:"ms-letter",sandbox:"",title:"пиÑÑмо",srcDoc:o})),D&&e.jsx("pre",{className:"ms-raw",children:D})]})]},L.msg_id)})})]})}function $r({api:s}){const[t,m]=r.useState(null),[n,x]=r.useState(1),[i,C]=r.useState(!1),[u,k]=r.useState(!1);if(r.useEffect(()=>{m(null),s(`/admin/mail/verdicts?days=${n}`).then(m).catch(()=>k(!0))},[n]),u)return null;const g=(t==null?void 0:t.domains)||[],I=g.reduce((A,$)=>A+($.delivered||0)+($.bounced||0),0);if(t&&!I)return null;const E=A=>{const $=(A.delivered||0)+(A.bounced||0);return $?Math.round(100*(A.delivered||0)/$):0},X=A=>A>=95?"var(--green)":A>=60?"var(--amber)":"var(--coral)",D=A=>(A.delivered||0)+(A.bounced||0)+(A.deferred||0),W=g.filter(A=>
85D(A)>=3),o=g.filter(A=>D(A)<3),N=A=>{const $=A%100,V=A%10;return`${A} ${$>=11&&$<=14||V===1?"Ñеловек":V>=2&&V<=4?"Ñеловека":"Ñеловек"}`},v=A=>String(A||"").replace(/^\(?host\s+\S+\s+said:\s*/i,"").replace(/\s*\(in reply to [^)]*\)\)?\s*$/i,"").trim(),_=(A,$,V,T)=>{const y=Math.abs(A)%100,q=y%10;return y>10&&y<20?T:q>1&&q<5?V:q===1?$:T},B=A=>`${A} ${_(A,"пиÑÑмо","пиÑÑма","пиÑем")}`,Q=(()=>{const A=new Map;for(const $ of(t==null?void 0:t.reasons)||[]){const V=v($.reason),T=`${$.domain}|${$.smtp_code}|${V}`,y=A.get(T);y?(y.n+=$.n||0,y.dead+=$.dead||0):A.set(T,{...$,reason:V,n:$.n||0,dead:$.dead||0})}return[...A.values()].sort(($,V)=>V.n-$.n)})();return e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsxs("div",{className:"row",style:{alignItems:"baseline",marginBottom:10},children:[e.jsx("div",{style:{fontWeight:700},children:"ÐоÑÑавка · кÑо пÑинимаеÑ"}),e.jsx(Oe,{options:[[1,"ÑÑÑки"],[7,"неделÑ"],[30,"меÑÑÑ"]],value:n,onChange:A=>x(Number(A))})]}),!t&&e.jsx("div",{className:"dim",children:"ÑÑиÑаÑâ¦"}),t&&e.jsxs(e.Fragment,{children:[!!(t.channels||[]).length&&e.jsx("div",{className:"mv-rows mv-stats",style:{marginBottom:12},children:(t.channels||[]).map(A=>{const $=A.sent?Math.round((A.known||0)/A.sent*100):0,V={own:"Ñвой ÑеÑвеÑ",cf:"Cloudflare",smtpbz:"SMTP.bz",resend:"Resend",relay:"Relay"};return e.jsxs("div",{className:"mv-row",children:[e.jsxs("div",{className:"mv-head",children:[e.jsx("span",{className:"mv-dom",children:V[A.channel]||A.channel||"â"}),e.jsxs("span",{style:{color:X($),fontWeight:700},children:[$,"%"]})]}),e.jsxs("div",{className:"mv-nums",children:[e.jsxs("span",{children:[e.jsx("b",{children:A.sent||0})," оÑпÑавлено"]}),e.jsxs("span",{children:[e.jsx("b",{children:A.known||0})," знаем ÑÑдÑбÑ"]}),e.jsxs("span",{className:"dim",children:[e.jsx("b",{children:A.bounced||0})," оÑбиÑо"]})]})]},A.channel||"?")})}),e.jsx("div",{className:"mv-rows mv-stats",children:(i?g:W).map(A=>e.jsxs("div",{className:"mv-row",children:[e.jsxs("div",{className:"mv-head",children:[e.jsx("span",{className:"mv-dom",children:A.domain||"â"}),e.jsxs("span",{style:{color:X(E(A)),fontWeight:700},children:[E(A),"%"]})]}),e.jsxs("div",{className:"mv-nums",children:[e.jsxs("span",{children:[e.jsx("b",{children:A.delivered||0})," доÑло"]}),e.jsxs("span",{children:[e.jsx("b",{children:A.bounced||0})," оÑбиÑо"]}),e.jsxs("span",{className:"dim",children:[e.jsx("b",{children:A.deferred||0})," оÑложено"]}),e.jsx("span",{className:"dim",children:N(A.people||0)})]})]},A.domain))}),!!o.length&&e.jsx("button",{className:"linkbtn linkbtn--muted linkbtn--sm",style:{alignSelf:"flex-start",marginTop:2},onClick:()=>C(!i),children:i?"ÑвеÑнÑÑÑ Ñедкие доменÑ":`еÑÑ ${o.length} ${o.length===1?"домен":o.length<5?"домена":"доменов"} по одномÑ-двÑм пиÑÑмам`}),!!Q.length&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontWeight:700,margin:"14px 0 6px"},children:"Чем оÑказÑваÑÑ"}),e.jsx("div",{className:"mv-rows",children:Object.entries(Q.reduce((A,$)=>{var V;return(A[V=$.domain||"â"]||(A[V]=[])).push($),A},{})).sort((A,$)=>$[1].reduce((V,T)=>V+T.n,0)-A[1].reduce((V,T)=>V+T.n,0)).map(([A,$])=>{const V=$.reduce((y,q)=>y+q.n,0),T=$.reduce((y,q)=>y+(q.dead||0),0);return e.jsxs("div",{className:"mv-row",children:[e.jsxs("div",{className:"mv-head",children:[e.jsx("span",{className:"mv-dom",children:A}),e.jsxs("span",{className:"dim",children:[B(V),T?` · ${T} ${_(T,"адÑÐµÑ Ð¿Ð¾Ð³Ð°Ñен","адÑеÑа погаÑено","адÑеÑов погаÑено")}`:""]})]}),$.sort((y,q)=>q.n-y.n).map((y,q)=>e.jsxs("details",{className:"mv-why-wrap",children:[e.jsxs("summary",{className:"mv-why",children:[y.family||y.reason,e.jsxs("span",{className:"dim",children:[" · ",B(y.n)," · код ",y.smtp_code||"â"]})]}),e.jsx("div",{className:"mv-why mv-why--full",children:y.reason}),e.jsx("div",{className:"dim",style:{fontSize:12,marginTop:4},children:y.dead?`${y.dead} â адÑÐµÑ Ð¿Ð¾Ð³Ð°Ñен`:"адÑÐµÑ Ð½Ðµ ÑÑонÑÑ: дело Ð
85½Ðµ в нÑм"})]},q))]},A)})})]})]})]})}function Rr({api:s}){var u;const[t,m]=r.useState(null);if(r.useEffect(()=>{s("/admin/dmarc?days=30").then(m).catch(()=>m(null))},[]),!((u=t==null?void 0:t.byOrg)!=null&&u.length))return null;const n=t.byOrg.reduce((k,g)=>k+g.messages,0),x=(k,g)=>g?Math.round(100*k/g):0,i=k=>k>=95?"var(--green)":k>=85?"var(--amber)":"var(--coral)",C={"google.com":"Gmail","mail.ru":"Mail.ru","corp.mail.ru":"Mail.ru","yandex.ru":"ЯндекÑ","zohomail.com":"Zoho","yahoo.com":"Yahoo","protection.outlook.com":"Outlook"};return e.jsxs("div",{className:"card pad",style:{marginBottom:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap",marginBottom:10},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700},children:"ЧÑо видÑÑ Ð¿Ð¾ÑÑовики"}),e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["оÑÑÑÑÑ DMARC за 30 дней · ",n.toLocaleString("ru-RU")," пиÑем"]})]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"tbl",style:{width:"100%",fontSize:13},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:6},children:"поÑÑовик"}),e.jsx("th",{style:{textAlign:"right",padding:6},children:"пиÑем"}),e.jsx("th",{style:{textAlign:"right",padding:6},title:"пÑоÑли пÑовеÑÐºÑ DMARC â вÑÑовнен DKIM или SPF",children:"пÑинÑÑо"}),e.jsx("th",{style:{textAlign:"right",padding:6},title:"подпиÑÑ DKIM ÑоÑлаÑÑ",children:"DKIM"}),e.jsx("th",{style:{textAlign:"right",padding:6},title:"SPF ÑоÑÑлÑÑ",children:"SPF"}),e.jsx("th",{style:{textAlign:"right",padding:6},title:"положили в Ñпам или оÑбили",children:"в Ñпам · оÑбиÑо"})]})}),e.jsx("tbody",{children:t.byOrg.map(k=>{const g=x(k.pass,k.messages);return e.jsxs("tr",{children:[e.jsx("td",{style:{padding:6},children:C[k.org]||k.org}),e.jsx("td",{style:{padding:6,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:k.messages.toLocaleString("ru-RU")}),e.jsxs("td",{style:{padding:6,textAlign:"right",color:i(g),fontWeight:600},children:[g,"%"]}),e.jsxs("td",{className:"dim",style:{padding:6,textAlign:"right"},children:[x(k.dkim,k.messages),"%"]}),e.jsxs("td",{className:"dim",style:{padding:6,textAlign:"right"},children:[x(k.spf,k.messages),"%"]}),e.jsx("td",{style:{padding:6,textAlign:"right",color:k.quarantined+k.rejected?"var(--coral)":void 0},children:k.quarantined+k.rejected||"â"})]},k.org)})})]})})]})}function Wr({api:s}){var Tt,ht,ut,pt,nt,$t,fs,js,ys,bs,vs,Ss,ws,Ns,ks,Cs,zs;const[t,m]=r.useState([]),[n,x]=r.useState([]),[i,C]=r.useState(!1),[u,k]=r.useState(!1),[g,I]=r.useState(!1),[E,X]=r.useState(""),[D,W]=r.useState(""),o=r.useRef(!1),[N,v]=r.useState(null),[_,B]=r.useState(""),[Q,A]=r.useState(""),[$,V]=r.useState([]),[T,y]=r.useState(!1),[q,P]=r.useState(""),[oe,L]=r.useState(null),[se,U]=r.useState(null),ne=r.useRef(0),[le,ee]=r.useState(!1),[be,w]=r.useState(""),[d,b]=r.useState(""),[F,Z]=r.useState(""),[xe,ue]=r.useState(""),[Ne,fe]=r.useState([]),[ce,Be]=r.useState("inbox"),[Ae,Ce]=r.useState(""),[R,ze]=r.useState(null),[ke,Le]=r.useState(!1),[Ee,Fe]=r.useState(!1),[l,a]=r.useState(""),[M,f]=r.useState(""),[S,H]=r.useState(""),[p,K]=r.useState(""),re=r.useRef(0),je=(h,z)=>{const O=new URLSearchParams;z&&O.set("disputes","1"),D&&O.set("q",D),h&&(O.set("before",String(h.ts)),h.id&&O.set("before_id",String(h.id)));const Y=O.toString();return Y?"?"+Y:""},c=h=>h.length?{ts:h[h.length-1].ts,id:h[h.length-1].id}:null,te=(h=re.current)=>s("/admin/mail"+je()).then(z=>{if(h!==re.current)return;const O=z.mail||[];o.current||k(!!z.more),m(Y=>{if(!O.length)return O;const G=O[O.length-1],ae=new Set(O.map(he=>he.id)),de=Y.filter(he=>!ae.has(he.id)&&(he.ts<G.ts||he.ts===G.ts&&String(he.id)<String(G.id)));return[...O,...de]})}).catch(()=>{}),ve=async()=>{const h=ce==="disputes",z=c(h?n:t);if(!z)return;const O=re.current;I(!0);try{const Y=await s("/admin/mail"+je(z,h));if(O!==re.current)return;const G=Y.mail||[];h||(o.current=!0);const ae=new Set((h?n:t).map(we=>we.id)),de=G.filter(we=>!ae.has(we.id));(h?x:m)(we=>{const _e=new Set(we.map(Te=>Te.id));return[...we,...de.filter(Te=>!_e.has(Te.id))]}),(h?C:k)(!!Y.more&&de.length>0)}catch{}finally{I(!1)}},Se=(h=re.current)=>s("/admin/mail"+je(void 0,!0)).then(z=>{h===re.current&&(x(z.mail||[]),C(!!z.more))}).catch(()=>{});r.useEffect(()=>{re.current+=1,o.current=!1,m([]),x([]),k(!1),C(!1),te(re.current),Se(re.current)},[D]),Vt(()=>{te(),ce==="disputes"&&Se()},[D]);const pe=h=>(h||"").replace(/[\u00a0\u202f\u2007]/g," ").replace(/^(?:\s*(?:re|rе|fwd?|fw|оÑв|оÑвеÑ|пеÑеÑ(?:л|Ñлка))\s*(?:\[\d+\]|\(\d+\))?\s*:\s*)+/i,"").trim().toLowerCase().replace(/^\((?:no subject|без ÑемÑ|Ð½ÐµÑ ÑемÑ)\)$/,""),Re=h=>typeof h.peer=="string"?h.peer:Yt(h.direction==="out"?h.toAddr:h.fromAddr),Ie=h=>ri.includes(Yt(h.peer||h.from)),rt=h=>Re(h)+"|"+pe(h.subject),et=()=>{ne.current++,v(null)},at=ai,Ye=h=>[(h==null?void 0:h.subject)||"",...((h==null?void 0:h.msgs)||[]).map(z=>`${z.subject||""} ${z.body||""} ${z.html||""}`)].join(" "),lt=h=>{var z;return((z=Ye(h).match(at))==null?void 0:z[0])||""},Gt=h=>[...new Set(Ye(h).match(at)||[])],Je=r.useRef(0),St=r.useRef(null);r.useEffect(()=>{var O,Y;const h=((O=N==null?void 0:N.thread)==null?void 0:O.key)??null;if(h===St.current||(St.current=h,Je.current++,Ce(""),ze(null),a(""),Le(!1),!N||!Ie(N.thread||N)))return;const z=lt({subject:(Y=N.thread)==null?void 0:Y.subject,msgs:N.msgs});z&&Ce(z)},[N]);const tt=h=>{var ae;if(!N)return"";const z=[((ae=N.thread)==null?void 0:ae.subject)||"",...(N.msgs||[]).map(de=>
85de.subject||"")].filter(Boolean).join(" | "),O=(N.msgs||[]).map(de=>de.body||"").join(` 86`),Y=h?O.toLowerCase().indexOf(h.toLowerCase()):-1,G=O.length<=900?O:Y>=0?O.slice(Math.max(0,Y-300),Y+300):O.slice(0,900);return`${z} 87${G}`.slice(0,1200)},Ve=async(h,z,O)=>{var _e;const Y=String(h||"").trim();if(!Y){a("УкажиÑе Ð½Ð¾Ð¼ÐµÑ Ð¾Ð¿ÐµÑаÑии из пиÑÑма пÑоÑеÑÑинга");return}const G=String(tt(Y)).trim(),ae=String(O??"").trim();f(ae);const de=S.trim()?`&traffic_gb=${encodeURIComponent(S.trim())}`:"",he=p.trim()?`&online_ms=${Date.parse(p.trim())||""}`:"",we=++Je.current;Le(!0),a(""),ze(null);try{const Te=await s(`/admin/dispute/report?txn=${encodeURIComponent(Y)}${G?`&reason=${encodeURIComponent(G)}`:""}${ae?`&reason_code=${encodeURIComponent(ae)}`:""}${de}${he}`);if(we!==Je.current)return;ze(Te),Te!=null&&Te.found||a(((_e=Te==null?void 0:Te.verdict)==null?void 0:_e.note)||"ÐпеÑаÑÐ¸Ñ Ð½Ðµ найдена")}catch(Te){we===Je.current&&a((Te==null?void 0:Te.message)||"Ðе ÑдалоÑÑ ÑобÑаÑÑ Ð´Ð¾ÑÑе")}finally{we===Je.current&&Le(!1)}},Kt=async h=>{const z=String(h||"").trim();if(z){Fe(!0),a("");try{const O=tt(z),Y=await fetch("/api/admin/dispute/build-reply",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({txn:z,reason:O||void 0,reason_code:M||void 0,traffic_gb:S.trim()||void 0,online_ms:p.trim()?String(Date.parse(p.trim())||""):void 0})}),G=await Y.json().catch(()=>({}));if(!Y.ok)throw new Error(G.error||"request_failed");const ae=(we,_e,Te)=>{const Pe=atob(we),Qe=new Uint8Array(Pe.length);for(let Rt=0;Rt<Pe.length;Rt++)Qe[Rt]=Pe.charCodeAt(Rt);return new File([Qe],_e,{type:Te})},de=(G.shots||[]).map(we=>ae(we.b64,we.name,we.mime||"image/png"));B(String(G.text||"")),V(de);const he=Array.isArray(G.missing)?G.missing:[];a(G.failed?`СобÑано ${de.length} из ${G.planned||3}. Ðе ÑнÑлоÑÑ: ${he.join(", ")||"ÑаÑÑÑ ÐºÐ°Ð´Ñов"} â доÑнимиÑе вÑÑÑнÑÑ ÐºÐ½Ð¾Ð¿ÐºÐ¾Ð¹ «ÐÑкÑÑÑÑ Ð¿Ð¾Ð´ ÑкÑинÑоÑÑ».`:""),setTimeout(()=>{var we;return(we=document.querySelector(".mail-reply-box"))==null?void 0:we.scrollIntoView({behavior:"smooth",block:"center"})},60)}catch(O){a("Ðе ÑдалоÑÑ ÑобÑаÑÑ Ð¿Ð¸ÑÑмо: "+((O==null?void 0:O.message)||O))}finally{Fe(!1)}}},[wt,Nt]=r.useState(!1),Xt=async(h,z)=>{var Y,G;const O=((Y=R==null?void 0:R.user)==null?void 0:Y.email)||"клиенÑа";if(!(!z&&!confirm(`ÐаблокиÑоваÑÑ ${O}? 88 89ÐакÑоеÑÑÑ Ð²Ñ Ð¾Ð´ в кабинеÑ, доÑÑÑп к ÑеÑвиÑÑ Ð¿Ð¾Ð³Ð°ÑнеÑ, авÑопÑодление вÑклÑÑиÑÑÑ. СнÑÑÑ Ð±Ð»Ð¾ÐºÐ¸ÑÐ¾Ð²ÐºÑ Ð¼Ð¾Ð¶Ð½Ð¾ ÑÑой же кнопкой.`))){Nt(!0),a("");try{const ae=await fetch("/api/admin/dispute/block",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({txn:h,undo:z,userId:((G=R==null?void 0:R.user)==null?void 0:G.id)||void 0,reason:tt(h)?"ÑÐ¿Ð¾Ñ Ð¿Ð¾ опеÑаÑии "+h:"ÑаÑджбек"})}),de=await ae.json().catch(()=>({}));if(de.error==="user_mismatch")throw new Error("по ÑÑÐ¾Ð¼Ñ Ð½Ð¾Ð¼ÐµÑÑ ÑеÑÐ²ÐµÑ Ð½Ð°ÑÑл дÑÑгого клиенÑа, никого не заблокиÑовали â пеÑеÑобеÑиÑе доÑÑе");if(!ae.ok)throw new Error(de.error||"request_failed");ze(he=>he&&{...he,user:{...he.user||{},blockedAt:z?null:Date.now()}}),P(z?"ÐлокиÑовка ÑнÑÑа":`ÐÐ»Ð¸ÐµÐ½Ñ Ð·Ð°Ð±Ð»Ð¾ÐºÐ¸Ñован${de.panelOff?", доÑÑÑп в панели погаÑен":" (Ð¿Ð°Ð½ÐµÐ»Ñ Ð½Ðµ оÑвеÑила â добÑÑÑ ÐºÑон)"}`)}catch(ae){a("Ðе ÑдалоÑÑ: "+((ae==null?void 0:ae.message)||ae))}finally{Nt(!1)}}},me=(h,z)=>O=>{var de,he,we,_e,Te;const Y=yi((de=O.clipboardData)==null?void 0:de.items,(he=O.clipboardData)==null?void 0:he.files),ae=!((((_e=(we=O.clipboardData)==null?void 0:we.files)==null?void 0:_e.length)??0)>0)&&!!((Te=O.clipboardData)!=null&&Te.getData("text/plain"));Jt(Y,h,Pe=>z(Pe),P)&&!ae&&O.preventDefault()},kt=async()=>{const h=be.trim(),z=F.trim(),O=xe.trim();if(!h||!z||!O){P("ÐаполниÑе адÑеÑ, ÑÐµÐ¼Ñ Ð¸ ÑекÑÑ");return}y(!0),P("");try{if(Ne.length){const Y=new FormData;Y.set("to",h),Y.set("subject",z),Y.set("text",O),d.trim()&&Y.set("cc",d.trim());for(const de of Ne)Y.append("file",de);const G=await fetch("/api/admin/mail/send",{method:"POST",credentials:"include",body:Y}),ae=await G.json().catch(()=>({}));if(!G.ok)throw new Error(ae.error||"request_failed")}else await s("/admin/mail/send",{to:h,subject:z,text:O,cc:d.trim()||void 0});P("ÐÑпÑавлено â"),w(""),b(""),Z(""),ue(""),fe([]),ee(!1),await te()}catch(Y){P("ÐÑибка: "+((Y==null?void 0:Y.message)||Y))}finally{y(!1)}},Ct=async h=>{const z=++ne.current;B(""),P(""),L(null),V([]);const O=Yt(h.peer||h.from);O.includes("@")&&s("/admin/users?q="+encodeURIComponent(O)).then(Y=>{if(ne.current!==z)return;const G=((Y==null?void 0:Y.users)||[]).find(ae=>String(ae.email||"").toLowerCase()===O||(ae.aliases||[]).some(de=>String(de).toLowerCase()===O));G&&L({id:G.id,email:G.email??null,sub:G.subscription??null})}).catch(()=>{});try{const Y=h.msgs.slice().sort((he,we)=>he.ts-we.ts),G=await Promise.all(Y.map(he=>s("/admin/mail/"+he.id)));if(ne.current!==z)return;v({thread:h,msgs:G});const de=String(h.to||"").toLowerCase().startsWith("privacy@")?[]:h.msgs.filter(he=>!he.handled).map(he=>he.id);de.length&&(m(he=>he.map(we=>de.includes(we.id)?{...we,handled:!0}:we)),de.forEach(he=>
89s("/admin/mail/"+he+"/handled",{handled:!0}).catch(()=>{})))}catch{ne.current===z&&P("Ðе ÑдалоÑÑ Ð¾ÑкÑÑÑÑ")}},ot=async(h,z)=>{y(!0),P("");try{return await s(h,z??{}),await te(),!0}catch(O){return P("ÐÑибка: "+O.message),!1}finally{y(!1)}},zt=async()=>{if(_.trim().length<2||!N)return;const h=N.msgs.filter(de=>de.direction!=="out"),z=Ie(N.thread||N),O=60*864e5,Y=h[h.length-1],G=Y?h.filter(de=>Y.ts-de.ts<=O):[],ae=(z?G[0]:Y)||N.msgs[N.msgs.length-1];if($.length){y(!0),P("");try{const de=new FormData;de.set("text",_),Q.trim()&&de.set("cc",Q.trim());for(const _e of $)de.append("file",_e);const he=await fetch("/api/admin/mail/"+ae.id+"/reply",{method:"POST",credentials:"include",body:de}),we=await he.json().catch(()=>({}));if(!he.ok)throw new Error(we.error||"request_failed");await te(),P("ÐÑпÑавлено â"),A(""),V([]),et()}catch(de){P("ÐÑибка: "+((de==null?void 0:de.message)||de))}finally{y(!1)}return}await ot("/admin/mail/"+ae.id+"/reply",{text:_,cc:Q.trim()||void 0})&&(P("ÐÑпÑавлено â"),A(""),et())},_t=async()=>{if(!(!N||!confirm("УдалиÑÑ Ð²ÐµÑÑ ÑÑед безвозвÑаÑно?"))){y(!0),P("");try{await Promise.all(N.msgs.map(h=>s("/admin/mail/"+h.id+"/delete"))),await te(),et()}catch(h){P("ÐÑибка: "+h.message)}finally{y(!1)}}},dt=r.useMemo(()=>{const h=new Map(n.map(z=>[z.id,z]));return[...t.map(z=>h.get(z.id)||z),...n.filter(z=>!t.some(O=>O.id===z.id))]},[t,n]),st=r.useMemo(()=>{const h=new Map;for(const z of dt){const O=rt(z);let Y=h.get(O);Y||(Y={key:O,from:Re(z),to:z.direction==="out"?z.fromAddr:z.toAddr,subject:z.subject,msgs:[],latestTs:0,unread:0},h.set(O,Y)),Y.msgs.push(z),z.ts>=Y.latestTs&&(Y.latestTs=z.ts,Y.subject=z.subject,Y.subjectRu=z.subjectRu||null,Y.to=z.direction==="out"?z.fromAddr:z.toAddr,Y.peer=Re(z)),!Y.subjectRu&&z.subjectRu&&(Y.subjectRu=z.subjectRu),z.handled||Y.unread++}for(const[z,O]of[...h.entries()]){if(!z.startsWith("|"))continue;const Y=z.slice(1),G=[...h.values()].filter(ae=>ae!==O&&pe(ae.subject)===Y);G.length===1&&(G[0].msgs.push(...O.msgs),G[0].unread+=O.unread,O.latestTs>G[0].latestTs&&(G[0].latestTs=O.latestTs),h.delete(z))}for(const z of h.values()){z.msgs.sort((Y,G)=>Y.ts-G.ts);const O=z.msgs[z.msgs.length-1];z.replied=O&&O.direction==="out",z.resolved=z.msgs.length>0&&z.msgs.every(Y=>Y.resolved)}return[...h.values()].sort((z,O)=>z.unread>0==O.unread>0?O.latestTs-z.latestTs:z.unread>0?-1:1)},[dt]),ct=st.filter(Ie),j=st.filter(h=>!Ie(h)),J=ce==="disputes"?ct:j,ie=j.filter(h=>h.unread>0).length,ge=ct.filter(h=>h.unread>0).length,ye=N&&Ie(N.thread||N)?Gt({subject:(Tt=N.thread)==null?void 0:Tt.subject,msgs:N.msgs}):[],Ue=(()=>{const h=new Set;if(!N)return h;const z=G=>li(G),O=(N.msgs||[]).filter(G=>G.direction==="out").map(z).join(" "),Y=new Set(O.match(at)||[]);for(const G of ye)Y.has(G)&&h.add(G);return h})(),mt=e.jsxs("div",{style:{marginBottom:16},children:[ye.length>1&&e.jsxs("div",{style:{marginBottom:12,padding:12,borderRadius:10,background:"var(--surface-2)",border:"1px solid var(--border)"},children:[e.jsxs("div",{style:{fontSize:12.5,fontWeight:700,marginBottom:8},children:["ÐапÑоÑов в ÑÑом пиÑÑме: ",ye.length]}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:ye.map(h=>{const z=Ue.has(h),O=(R==null?void 0:R.txn)===h;return e.jsxs("button",{onClick:()=>{Ce(h),Ve(h)},title:z?"Ðо ÑÑÐ¾Ð¼Ñ Ð·Ð°Ð¿ÑоÑÑ Ñже оÑпÑавлен оÑвеÑ":void 0,style:{fontFamily:"inherit",fontSize:12,fontWeight:600,padding:"5px 11px",borderRadius:8,cursor:"pointer",border:"1px solid "+(z?"rgba(61,220,132,0.6)":O?"rgba(91,156,255,0.55)":"var(--border-strong)"),background:z?"rgba(61,220,132,0.16)":O?"rgba(91,156,255,0.2)":"var(--surface)",color:z?"var(--green, #1c6b34)":"var(--text)"},children:[z?"â ":"",h]},h)})}),e.jsxs("div",{className:"dim",style:{fontSize:11.5,marginTop:8},children:["ÐелÑнÑм â запÑоÑÑ, по коÑоÑÑм оÑÐ²ÐµÑ Ñже оÑпÑавлен (",Ue.size," из ",ye.length,")."]})]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{value:Ae,onChange:h=>Ce(h.target.value),onKeyDown:h=>{h.key==="Enter"&&Ve(Ae)},placeholder:"ÐÐ¾Ð¼ÐµÑ Ð¾Ð¿ÐµÑаÑии из пиÑÑма â напÑÐ¸Ð¼ÐµÑ ep_bfb64d87_84dc4aa8bb31",style:{flex:"1 1 320px",padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("button",{className:"btn btn--sm",disabled:ke,onClick:()=>Ve(Ae),children:ke?"СобиÑаÑâ¦":"СÑоÑмиÑоваÑÑ Ð¾ÑÑÑÑ"}),(R==null?void 0:R.found)&&e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>{const h=tt(R.txn),z=S.trim()?`&traffic_gb=${encodeURIComponent(S.trim())}`:"",O=p.trim()?`&online_ms=${Date.parse(p.trim())||""}`:"";window.open(`/api/admin/dispute/report.html?txn=${encodeURIComponent(R.txn)}${h?`&reason=${encodeURIComponent(h)}`:""}${M?`&reason_code=${encodeURIComponent(M)}`:""}${z}${O}`,"_blank","noopener")},children:"ÐÑкÑÑÑÑ Ð¿Ð¾Ð´ ÑкÑинÑоÑÑ"}),(R==null?void 0:R.found)&&N&&e.jsx("button",{className:"btn btn--sm",disabled:Ee,onClick:()=>Kt(R.txn),title:"СобеÑÑÑ ÑекÑÑ Ð¸ 3 ÑкÑинÑоÑа (опеÑаÑии, ÑÑÑаниÑа оплаÑÑ, пеÑепиÑка) и вÑÑÐ°Ð²Ð¸Ñ Ð² поле оÑвеÑа",children:Ee?"СобиÑÐ°Ñ Ð¿Ð¸ÑÑмоâ¦":"СÑоÑмиÑоваÑÑ Ð¾ÑÐ²ÐµÑ Ð½Ð° поÑÑÑ"}
89),(R==null?void 0:R.found)&&((ht=R.user)==null?void 0:ht.id)&&e.jsx("button",{className:"btn btn--sm "+((ut=R.user)!=null&&ut.blockedAt?"btn--ghost":"btn--danger"),disabled:wt,onClick:()=>{var h;return Xt(R.txn,!!((h=R.user)!=null&&h.blockedAt))},title:(pt=R.user)!=null&&pt.blockedAt?"СнÑÑÑ Ð±Ð»Ð¾ÐºÐ¸ÑовкÑ: вÑ
од в ÐºÐ°Ð±Ð¸Ð½ÐµÑ Ð¾ÑкÑоеÑÑÑ, доÑÑÑп веÑнÑÑ Ð¾Ð±ÑÑное пÑодление":"ÐакÑÑÑÑ Ð²Ñ
од в кабинеÑ, погаÑиÑÑ Ð´Ð¾ÑÑÑп в панели и вÑклÑÑиÑÑ Ð°Ð²ÑопÑодление",children:wt?"СекÑндÑâ¦":(nt=R.user)!=null&&nt.blockedAt?"РазблокиÑоваÑÑ":"ÐаблокиÑоваÑÑ ÐºÐ»Ð¸ÐµÐ½Ñа"}),R&&e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>{ze(null),a("")},children:"ÐакÑÑÑÑ"})]}),(R==null?void 0:R.found)&&R.payPage&&e.jsxs("div",{style:{marginTop:10,padding:12,borderRadius:10,background:"var(--surface-2)",border:"1px solid var(--border)"},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,marginBottom:8},children:"СÑÑаниÑа оплаÑÑ Ð´Ð»Ñ ÑкÑинÑоÑа"}),e.jsxs("div",{className:"dim",style:{fontSize:12,marginBottom:8,lineHeight:1.45},children:["ÐÑиложиÑе ÐºÐ°Ð´Ñ Ð¢ÐÐ ÑÑÑаниÑÑ, ÑÑо видел клиенÑ.",R.payPage.promoPrice&&e.jsxs(e.Fragment,{children:[" ÐеÑвое ÑпиÑание клиенÑа â ",e.jsx("b",{style:{color:R.payPage.isPromo?"var(--amber, #f5a623)":"var(--text)"},children:R.payPage.promoPrice}),R.payPage.isPromo?" â ÑÑо ÐÐ ÐÐÐ-подпиÑка: беÑиÑе пÑомо-ÑÑÑаниÑÑ, инаÑе банк ÑÐ²Ð¸Ð´Ð¸Ñ Ð½Ðµ ÑÑ ÑÐµÐ½Ñ Ð¸ ÑÐ¿Ð¾Ñ Ð¿ÑоигÑан.":" â обÑÑÐ½Ð°Ñ Ñена, пÑомо не бÑло."]})]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("a",{className:"btn btn--ghost btn--sm",href:R.payPage.promo,target:"_blank",rel:"noopener",children:["ÐÑомо-ÑÑÑаниÑа",R.payPage.isPromo&&R.payPage.promoPrice?` (${R.payPage.promoPrice} â далее полнаÑ)`:" (1 â½ â далее полнаÑ)"]}),e.jsx("a",{className:"btn btn--ghost btn--sm",href:R.payPage.normal,target:"_blank",rel:"noopener",children:"ÐбÑÑÐ½Ð°Ñ ÑÑÑаниÑа"})]})]}),l&&e.jsx("div",{style:{marginTop:8,fontSize:13,color:"var(--coral)"},children:l}),(R==null?void 0:R.found)&&e.jsxs("div",{style:{marginTop:14,display:"grid",gap:12},children:[e.jsxs("div",{className:"card pad",style:{background:"var(--surface-2)",borderLeft:`3px solid ${(($t=R.verdict)==null?void 0:$t.level)==="strong"?"var(--green)":((fs=R.verdict)==null?void 0:fs.level)==="mixed"?"var(--amber)":"var(--coral)"}`},children:[R.reasonLabel&&e.jsxs("div",{style:{fontSize:12.5,fontWeight:700,color:"var(--muted)",marginBottom:4},children:["ÐÑиÑина ÑпоÑа: ",R.reasonLabel]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",alignItems:"center",margin:"2px 0 8px"},children:[e.jsx("span",{className:"dim",style:{fontSize:11.5},children:"ÑказаÑÑ Ð¿ÑиÑинÑ:"}),[["","авÑо"],["fraud","ФÑод"],["sub_not_made","ÐодпиÑка/оÑмена"],["not_provided","УÑлÑга не оказана"],["duplicate","Ðвойное ÑпиÑание"],["arbitration","ÐÑе-аÑбиÑÑаж"],["not_recognized","Ðе ÑзнаÑÑ Ð¾Ð¿ÐµÑаÑиÑ"]].map(([h,z])=>{const O=(M||"")===h;return e.jsx("button",{onClick:()=>Ve(R.txn,void 0,h||void 0),style:{fontFamily:"inherit",fontSize:11.5,fontWeight:600,padding:"3px 10px",borderRadius:999,cursor:"pointer",border:"1px solid "+(O?"rgba(91,156,255,0.55)":"var(--border)"),background:O?"rgba(91,156,255,0.2)":"var(--surface)",color:"var(--text)"},children:z},h||"auto")})]}),e.jsx("div",{style:{fontSize:14,fontWeight:600},children:(js=R.verdict)==null?void 0:js.note}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginTop:6},children:[(ys=R.payment)==null?void 0:ys.txnId," · ",(bs=R.payment)==null?void 0:bs.amount," · ",(vs=R.payment)==null?void 0:vs.provider," · ",new Date((Ss=R.payment)==null?void 0:Ss.at).toLocaleString("ru-RU"),(ws=R.user)!=null&&ws.email?` · ${R.user.email}`:""]})]}),e.jsx("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))"},children:(R.exhibits||[]).map((h,z)=>e.jsxs("div",{className:"card pad",style:{background:"var(--surface)"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--muted)"},children:z+1}),e.jsx("span",{style:{fontSize:14.5,fontWeight:700},children:h.title}),e.jsx("span",{style:{marginLeft:"auto",fontSize:11.5,fontWeight:600,padding:"2px 8px",borderRadius:999,color:h.status==="ok"?"var(--green)":h.status==="weak"?"var(--amber)":"var(--coral)",border:`1px solid ${h.status==="ok"?"var(--green)":h.status==="weak"?"var(--amber)":"var(--coral)"}`},children:h.status==="ok"?"закÑÑÑ":h.status==="weak"?"ÑлабÑй":"неÑем закÑÑÑÑ"})]}),e.jsx("div",{className:"dim",style:{fontSize:11.5,marginTop:4,lineHeight:1.4},children:h.ask}),e.jsx("div",{style:{marginTop:10,display:"grid",gap:5},children:(h.rows||[]).map(O=>e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13,borderTop:"1px solid var(--border)",paddingTop:5},children:[e.jsx("span",{className:"dim",style:{flex:"0 0 auto",maxWidth:"45%"},children:O.k}),e.jsx("span",{style:{flex:"1 1 auto",minWidth:0,fontWeight:600,fontVariantNumeric:"tabular-nums",textAlign:"right",overflowWrap:"anywhere"},children:O.v})]},O.k))}),h.gap&&e.jsx("div",{style:{marginTop:10,fontSize:12.5,lineHeight:1.45,color:"var(--amber)"},children:h.gap})]},h.key))}),R.needsUsageInput&&e.jsxs("div",{className:"card pad",style:{background:"var(--surface-2)",border:"1px solid var(--amber, #f5a623)"},children:[(()=>{var Y,G;const h=((Y=R.usageMissing)==null?void 0:Y.traffic)??!0,z=((G=R.usageMissing)==null?void 0:G.online)??!0,O=h&&z?"ТÑаÑик и поÑледний онлайн":h?"ТÑаÑик":"ÐоÑледний онлайн";return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:700,marginBottom:4},children:h&&z?"ÐеÑÑики полÑÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¿ÑÑÑÑ":`${O} â Ð¿Ð°Ð½ÐµÐ»Ñ Ð½Ðµ оÑдала`}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginBottom:10,lineHeight:1.45},children:[O," Ñ Ð½Ð°Ñ Ð½ÐµÑ (мигÑиÑованнÑй пÑоÑÐ¸Ð»Ñ Ð»Ð¸Ð±Ð¾ Ð¿Ð°Ð½ÐµÐ»Ñ Ð½Ðµ оÑдала ÑиÑÑÑ). ÐÐ ÐÐÐРЬ ÑеалÑнÑе знаÑÐµÐ½Ð¸Ñ Ð¸ впиÑи â доÑÑе пеÑеÑобеÑÑÑÑÑ Ñ Ð½Ð¸Ð¼Ð¸. ÐÑÑÑо оÑÑавиÑÑ â Ñаздел пойдÑÑ Ð¿Ð¾ ÑакÑÑ Ð¾Ð¿Ð»Ð°Ñ. ÐивÑе даннÑе ÑÑÑной ввод не заÑиÑаеÑ: подÑÑавлÑеÑÑÑ ÑолÑко ÑÑда, где Ñ Ð½Ð°Ñ Ð½Ð¾Ð»Ñ."]})]})})(),e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"flex-end"},children:[(((Ns=R.usageMissing)==null?void 0:Ns.traffic)??!0)&&e.jsxs("label",{style:{fontSize:12},children:["ТÑаÑик, ÐÐ",e.jsx("br",{}),e.jsx("input",{type:"number",min:"0",step:"0.1",value:S,onChange:h=>H(h.target.value),placeholder:"напÑÐ¸Ð¼ÐµÑ 42",style:{marginTop:4,padding:"7px 10px",borderRadius:8,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13,width:120}})]}),(((ks=R.usageMissing)==null?void 0:ks.online)??!0)&&e.jsxs("label",{style:{fontSize:12},children:["ÐоÑледний онлайн",e.jsx("br",{}),e.jsx("input",{type:"date",value:p,onChange:h=>K(h.target.value),style:{marginTop:4,padding:"7px 10px",borderRadius:8,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13}})]}),e.jsx("button",{className:"btn btn--sm",disabled:ke,onClick:()=>Ve(R.txn,void 0,M||void 0),children:"ÐеÑеÑобÑаÑÑ Ñ Ð´Ð°Ð½Ð½Ñми"})]})]}),R.profile&&e.jsxs("div",{className:"card pad",style:{background:"var(--surface)"},children:[e.jsx("div",{style:{fontSize:14.5,fontWeight:700,marginBottom:8},children:"ÐоÑÑÑÐµÑ ÐºÐ»Ð¸ÐµÐ½Ñа · оÑÐ²ÐµÑ Ð² наÑÑ Ð¿Ð¾Ð»ÑзÑ"}),e.jsx("div",{style:{display:"grid",gap:5},children:[["СÑаж аккаÑнÑа",R.profile.tenureDays==null?"â":R.profile.tenureDays<45?`${R.profile.tenureDays} дн.`:R.profile.tenureDays<365?`${Math.round(R.profile.tenureDays/30)} меÑ.`:`${(R.profile.tenureDays/365).toFixed(1)} г.`],["ÐÐ¿Ð»Ð°Ñ / ÑÑмма",`${R.profile.paymentsOk} · ${R.profile.ltv}`],["ÐÐ¿Ð»Ð°Ñ Ð¿Ð¾Ñле ÑпоÑной",String(R.profile.paymentsAfter)],["ÐолÑзовалÑÑ",R.profile.usedAfter?"да, поÑле ÑпиÑаниÑ":R.profile.usedEver?"да":"не заÑикÑиÑовано"],["ÐбÑаÑений в поддеÑжкÑ",`${R.profile.complaints}${R.profile.complaints===0?" â ÑÑÐ°Ð·Ñ Ð² ÑаÑджбек":""}`]].map(([h,z])=>e.jsxs("div",{style:{display:"flex",gap:10,fontSize:13,borderTop:"1px solid var(--border)",paddingTop:5},children:[e.jsx("span",{className:"dim",style:{flex:"1 1 auto"},children:h}),e.jsx("span",{style:{flex:"none",fontWeight:600,textAlign:"right"},children:z})]},h))}),!!(R.profile.pro||[]).length&&e.jsxs("div",{style:{marginTop:10,fontSize:12.5,lineHeight:1.5,color:"var(--green)"},children:[e.jsx("b",{children:"РнаÑÑ Ð¿Ð¾Ð»ÑзÑ:"})," ",R.profile.pro.join("; "),"."]}),!!(R.profile.con||[]).length&&e.jsxs("div",{style:{marginTop:8,fontSize:12.5,lineHeight:1.5,color:"var(--amber)"},children:[e.jsx("b",{children:"СлабÑе меÑÑа (ÑолÑко вам, не в оÑпÑавкÑ):"})," ",R.profile.con.join("; "),"."]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,margin:"14px 0 6px"},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:700},children:"ÐомменÑаÑий по ÑиÑÑаÑии"}),e.jsx("button",{className:"btn btn--ghost btn--xs",style:{marginLeft:"auto"},onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(R.profile.comment||""),P("ÐомменÑаÑий ÑкопиÑован")},children:"СкопиÑоваÑÑ"})]}),e.jsx("textarea",{readOnly:!0,value:R.profile.comment||"",rows:7,style:{width:"100%",padding:12,borderRadius:10,background:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5,lineHeight:1.5}})]}),e.jsxs("div",{className:"card pad",style:{background:"var(--surface)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,marginBottom:8},children:[e.jsx("div",{style:{fontSize:14.5,fontWeight:700},children:"ЧеÑновик оÑвеÑа"}),e.jsx("span",{className:"dim",style:{fontSize:12.5},children:"пÑоÑиÑайÑе и оÑпÑавÑÑе Ñами â оÑÑÑда ниÑего не ÑÑ
одиÑ"}),e.jsx("button",{className:"btn btn--ghost btn--xs",style:{marginLeft:"auto"},onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(R.draft||""),P("ЧеÑновик ÑкопиÑован")},children:"СкопиÑоваÑÑ"})]}),e.jsx("textarea",{readOnly:!0,value:R.draft||"",rows:16,style:{width:"100%",padding:12,borderRadius:10,background:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5,lineHeight:1.5}})]})]})]});if(N){const h=N.thread,z=((Cs=String(h.to||"").match(/<([^>]+)>/))==null?void 0:Cs[1])||h.to||"noreply",O=((zs=String(h.peer||h.from||"").match(/<([^>]+)>/))==null?void 0:zs[1])||h.peer||h.from||"â",Y=String(h.to||"").startsWith("privacy@");return e.jsxs("div",{className:"card pad",children:[e.jsx("button",{className:"btn btn--ghost btn--xs btn--pill",onClick:()=>et(),children:"â к ÑпиÑкÑ"}),e.jsxs("div",{style:{marginTop:14,fontSize:18,fontWeight:700},children:[h.subject||"(без ÑемÑ)",N.msgs.length>1&&e.jsxs("span",{className:"dim",style:{fontSize:13,fontWeight:500},children:[" · ",N.msgs.length," пиÑем"]})]}),e.jsxs("div",{className:"dim",style:{fontSize:13,marginTop:4,overflowWrap:"anywhere"},children:["ÐлиенÑ: ",h.peer||h.from," · Ð½Ð°Ñ Ð°Ð´ÑеÑ: ",h.to]}),Ie(h)&&e.jsx("div",{style:{marginTop:14},children:mt}),oe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:10},children:[e.jsxs("button",{className:"btn btn--ghost btn--xs",onClick:()=>U(oe),children:[e.jsx(On,{size:14,strokeWidth:1.9})," УпÑавление пÑоÑилем"]}),e.jsx("span",{className:"dim",style:{fontSize:12.5},children:oe.sub?`${oe.sub.plan||"ÑаÑиÑ"} · ${oe.sub.status||""}${oe.sub.expiresAt?" до "+new Date(oe.sub.expiresAt).toLocaleDateString("ru-RU"):""}`:"аккаÑÐ½Ñ ÐµÑÑÑ, подпиÑки неÑ"})]}),se&&e.jsx(Ht,{api:s,userId:se.id,email:se.email,onClose:()=>U(null),onChanged:te}),Y&&e.jsx("div",{style:{marginTop:12,padding:"10px 12px",borderRadius:10,background:"rgba(224,169,59,0.10)",border:"1px solid rgba(224,169,59,0.3)",fontSize:13},children:"ÐапÑÐ¾Ñ Ð½Ð° адÑÐµÑ Ð¿Ñав ÑÑбÑекÑа даннÑÑ
. Ðо GDPR оÑвеÑиÑÑ Ð½Ñжно в ÑеÑение меÑÑÑа Ñ Ð¼Ð¾Ð¼ÐµÐ½Ñа полÑÑениÑ."}),N.msgs.map((G,ae)=>{var de;return e.jsxs("div",{style:{marginTop:16,paddingTop:ae?16:0,borderTop:ae?"1px solid var(--border)":"none"},children:[e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginBottom:6,overflowWrap:"anywhere"}
89,children:[new Date(G.ts).toLocaleString()," · ",G.fromAddr,G.direction==="out"&&e.jsx("span",{style:{marginLeft:6,fontSize:11,color:"var(--green)",border:"1px solid rgba(52,211,153,0.45)",borderRadius:4,padding:"0 5px"},children:"Ð½Ð°Ñ Ð¾ÑвеÑ"})]}),e.jsxs("div",{style:G.direction==="out"?{borderLeft:"2px solid rgba(52,211,153,0.5)",paddingLeft:10}:void 0,children:[e.jsx(zr,{body:G.body||"(пÑÑÑое Ñело)",html:G.html}),G.bodyRu&&G.bodyRu!=="â"&&e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px dashed var(--border)",fontSize:13.5,opacity:.9,whiteSpace:"pre-wrap"},children:[e.jsxs("div",{className:"dim",style:{fontSize:11,marginBottom:3},children:["пеÑевод",G.lang?` · ${G.lang}`:""]}),G.bodyRu]}),!!((de=G.files)!=null&&de.length)&&e.jsx(hn,{files:G.files,srcOf:he=>`/api/admin/mail/file/${he.id}`})]})]},G.id)}),e.jsx("textarea",{className:"mail-reply-box",value:_,onChange:G=>B(G.target.value),rows:6,onPaste:me($,V),placeholder:`ÐÑÐ²ÐµÑ ÑйдÑÑ ${O} â Ñ Ð°Ð´ÑеÑа ${z}. ÐаÑÑÐ¸Ð½ÐºÑ Ð¼Ð¾Ð¶Ð½Ð¾ вÑÑавиÑÑ Ð¿ÑÑмо ÑÑда (âV)â¦`,style:{width:"100%",marginTop:18,padding:12,borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:14}}),e.jsx("input",{value:Q,onChange:G=>A(G.target.value),placeholder:"ÐÐ¾Ð¿Ð¸Ñ (ÑеÑез запÑÑÑÑ) â необÑзаÑелÑно",style:{width:"100%",marginTop:8,padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",marginTop:8},children:e.jsxs("label",{className:"btn btn--ghost btn--xs",style:{cursor:"pointer"},children:[e.jsx(As,{size:14,strokeWidth:1.9})," ÐÑикÑепиÑÑ",e.jsx("input",{type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:G=>{const ae=Array.from(G.target.files||[]);Jt(ae,$,V,P),G.target.value=""}})]})}),e.jsx(sn,{files:$,onDrop:G=>V(ae=>ae.filter((de,he)=>he!==G))}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:12,flexWrap:"wrap"},children:[e.jsx("button",{className:"btn btn--sm",disabled:T||_.trim().length<2,title:"ÐÑÐ²ÐµÑ ÑйдÑÑ Ð² ÑÑ Ð¶Ðµ веÑкÑ, Ñ Ð¿ÑоÑиÑиÑованнÑм иÑÑ
однÑм пиÑÑмом",onClick:zt,children:"ÐÑвеÑиÑÑ"}),(()=>{const G=N.msgs.length>0&&N.msgs.every(ae=>ae.resolved);return e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:T,onClick:async()=>{const ae=N.msgs.map(he=>he.id);await ot("/admin/mail/resolve",{ids:ae,resolved:!G})&&v(null)},children:G?"СнÑÑÑ Â«ÑазобÑано»":"â РазобÑано"})})(),e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:T,onClick:async()=>{await Promise.all(N.msgs.map(G=>s("/admin/mail/"+G.id+"/handled",{handled:!1}))),await te(),v(null)},children:"ÐеÑнÑÑÑ Ð² непÑоÑиÑаннÑе"}),e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:T,style:{color:"var(--red, #ff6b6b)"},onClick:_t,children:"УдалиÑÑ ÑÑед"})]}),q&&e.jsx("div",{className:"dim",style:{marginTop:10,fontSize:13},children:q})]})}return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{marginBottom:12},children:e.jsx(Oe,{options:[["inbox",ie>0?`ÐеÑепиÑка · ${ie}`:"ÐеÑепиÑка"],["disputes",ge>0?`ÐиÑпÑÑÑ Â· ${ge}`:"ÐиÑпÑÑÑ"],["health","ÐоÑÑавка"]],value:ce,onChange:h=>Be(h)})}),ce==="health"?e.jsxs(e.Fragment,{children:[e.jsx(_r,{api:s}),e.jsx($r,{api:s}),e.jsx(Tr,{api:s}),e.jsx(Rr,{api:s})]}):e.jsxs("div",{className:"card pad",children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12,marginBottom:14},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700},children:ce==="disputes"?"ÐиÑпÑÑÑ":"ÐÑ
одÑÑÐ°Ñ Ð¿Ð¾ÑÑа"}),ce!=="disputes"&&e.jsxs("button",{className:"btn btn--sm",style:{marginLeft:"auto"},onClick:()=>ee(h=>!h),children:[e.jsx(Ft,{size:14,strokeWidth:1.9})," ",le?"СвеÑнÑÑÑ":"ÐапиÑаÑÑ Ð¿Ð¸ÑÑмо"]}),ce==="disputes"?e.jsxs("span",{className:"dim",style:{marginLeft:"auto",fontSize:13},children:[ge>0?`${ge} непÑоÑиÑаннÑÑ
· `:"","оÑвеÑаÑÑ Ð¿Ð¾ÐºÐ° не оÑвеÑаем â ÑекÑÑ ÑоглаÑÑем"]}):ie>0&&e.jsxs("span",{className:"dim",style:{fontSize:13},children:[ie," непÑоÑиÑаннÑÑ
"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12},children:[e.jsx("input",{value:E,onChange:h=>X(h.target.value),onKeyDown:h=>{h.key==="Enter"&&W(E.trim())},placeholder:"ÐоиÑк по адÑеÑÑ, Ñеме или ÑекÑÑÑ Ð¿Ð¸ÑÑма",style:{flex:1,minWidth:0,padding:"8px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("button",{className:"btn btn--sm",onClick:()=>W(E.trim()),children:"ÐайÑи"}),!!D&&e.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>{X(""),W("")},children:"СбÑоÑиÑÑ"})]}),!!D&&e.jsxs("div",{className:"dim",style:{fontSize:12.5,marginBottom:10},children:["ÐоиÑк: «",D,"» · найдено пиÑем: ",t.length,u?"+":""]}),le&&e.jsx("div",{className:"card pad",style:{marginBottom:14,background:"var(--surface-2)"},children:e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("input",{value:be,onChange:h=>w(h.target.value),placeholder:"ÐÐ¾Ð¼Ñ â адÑÐµÑ Ð¿Ð¾Ð»ÑÑаÑелÑ",style:{padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("input",{value:d,onChange:h=>b(h.target.value),placeholder:"ÐÐ¾Ð¿Ð¸Ñ (ÑеÑез запÑÑÑÑ) â необÑзаÑелÑно",style:{padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("input",{value:F,onChange:h=>Z(h.target.value),placeholder:"Тема",style:{padding:"9px 12px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:13.5}}),e.jsx("textarea",{value:xe,onChange:h=>
89ue(h.target.value),rows:7,onPaste:me(Ne,fe),placeholder:"ТекÑÑ Ð¿Ð¸ÑÑма â каÑÑÐ¸Ð½ÐºÑ Ð¼Ð¾Ð¶Ð½Ð¾ вÑÑавиÑÑ Ð¿ÑÑмо ÑÑда (âV)",style:{padding:12,borderRadius:10,background:"var(--surface)",border:"1px solid var(--border-strong)",color:"var(--text)",fontFamily:"inherit",fontSize:14}}),e.jsx("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:e.jsxs("label",{className:"btn btn--ghost btn--xs",style:{cursor:"pointer"},children:[e.jsx(As,{size:14,strokeWidth:1.9})," ÐÑикÑепиÑÑ",e.jsx("input",{type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:h=>{const z=Array.from(h.target.files||[]);Jt(z,Ne,fe,P),h.target.value=""}})]})}),e.jsx(sn,{files:Ne,onDrop:h=>fe(z=>z.filter((O,Y)=>Y!==h))}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:"btn btn--sm",disabled:T,onClick:kt,children:"ÐÑпÑавиÑÑ"}),e.jsx("span",{className:"dim",style:{fontSize:12.5},children:"УйдÑÑ Ñ Ð°Ð´ÑеÑа поддеÑжки ÑÑой виÑÑинÑ. ÐиÑÑмо лÑÐ¶ÐµÑ Ð² пеÑепиÑÐºÑ â оÑÐ²ÐµÑ Ð¿ÑидÑÑ ÑÑда же."})]})]})}),ce==="disputes"&&mt,!st.length&&e.jsx("div",{className:"dim",style:{fontSize:14},children:"ÐÑÑÑо."}),J.map(h=>{const z=h.unread>0,O=Math.floor((Date.now()-h.latestTs)/864e5),Y=String(h.peer||h.from||"").split("@")[0].toLowerCase(),G=/(^|[._-])(no.?reply|donotreply|mailer.?daemon|postmaster|notifications?|bounces?|dmarc|abuse|robot|noreply)([._-]|$)/.test(Y),ae=new Set,de=new Set;if(ce==="disputes")for(const Pe of h.msgs)for(const Qe of Pe.txns||[])(Pe.direction==="out"?de:ae).add(Qe);const he=[...ae].filter(Pe=>de.has(Pe)).length,we=ae.size>1&&he<ae.size,_e=z?"new":h.resolved?"resolved":h.replied&&!we?"replied":G?"info":"waiting",Te=_e==="new"?"var(--green, #3ddc84)":_e==="waiting"?"var(--amber, #f5a623)":"transparent";return e.jsxs("div",{onClick:()=>Ct(h),style:{display:"flex",gap:12,alignItems:"center",padding:"11px 0",borderTop:"1px solid var(--border)",cursor:"pointer",opacity:z?1:.62},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",flex:"none",background:Te}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontWeight:z?700:600,fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[h.subject||"(без ÑемÑ)",h.msgs.length>1&&e.jsxs("span",{className:"dim",style:{fontWeight:500},children:[" · ",h.msgs.length]})]}),h.subjectRu&&e.jsx("div",{className:"dim",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.subjectRu}),e.jsxs("div",{className:"dim",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[h.from," â ",h.to]})]}),_e!=="info"&&e.jsx("span",{style:{flex:"none",fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:999,color:_e==="new"?"var(--green, #3ddc84)":_e==="waiting"?"var(--amber, #f5a623)":"var(--dim, #8b97a7)",background:_e==="new"?"rgba(61,220,132,0.13)":_e==="waiting"?"rgba(245,166,35,0.13)":"var(--surface-2, rgba(255,255,255,0.05))"},children:_e==="new"?h.unread>1?`новое · ${h.unread}`:"новое":_e==="resolved"?"â ÑазобÑано":_e==="replied"?ae.size>1?`â оÑвеÑено ${he} из ${ae.size}`:"â оÑвеÑено":ae.size>1&&he>0?`оÑвеÑено ${he} из ${ae.size}`:"ждÑÑ"}),ce==="disputes"&&!!lt(h)&&e.jsx("button",{className:"btn btn--ghost btn--xs",style:{flex:"none"},onClick:Pe=>{Pe.stopPropagation();const Qe=lt(h);Ce(Qe),Ve(Qe)},children:"ÐÑÑÑÑ"}),e.jsx("div",{className:"dim",style:{fontSize:12.5,flex:"none"},children:O===0?"ÑегоднÑ":O+" дн."})]},h.key)}),(ce==="disputes"?i:u)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:14},children:[e.jsx("button",{className:"btn btn--ghost btn--sm",disabled:g,onClick:ve,children:g?"ÐÑÑжÑâ¦":"ÐоказаÑÑ Ð¿Ð¸ÑÑма поÑÑаÑÑе"}),e.jsxs("span",{className:"dim",style:{fontSize:12.5},children:["загÑÑжено ",(ce==="disputes"?n:t).length," пиÑем"]})]}),q&&e.jsx("div",{className:"dim",style:{marginTop:12,fontSize:13},children:q})]})]})}export{Dr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.