PageSourceSearch

https://planeta-avtodv.ru/_next/static/chunks/2282.645460b4846992a5.js

js planeta-avtodv.ru collected 2026-10-08 10:01:17 UTC 41,815 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2282],{2282:function(e,s,t){t.r(s),t.d(s,{default:function(){return K}});var a=t(5893),l=t(7294),r=t(1664),i=t.n(r),n=t(5675),d=t.n(n);let c="font-black uppercase italic leading-none tracking-tight",o={fontFamily:'Impact, "Arial Narrow", var(--font-inter), sans-serif'},x="border-[3px] border-[#182127] bg-[#fffaf0] shadow-[4px_4px_0_#182127]",m=`${c} border-b-[3px] border-[#182127] bg-[#ffdc39] px-4 py-4 text-xl sm:text-2xl`,h="inline-flex min-h-[44px] items-center justify-center gap-2 border-[3px] border-[#182127] px-4 py-2.5 font-bold shadow-[3px_3px_0_#182127] transition-[transform,box-shadow,background-color] hover:-translate-y-0.5 active:translate-x-0.5 active:translate-y-0.5 active:shadow-none focus-visible:!outline focus-visible:!outline-[3px] focus-visible:!outline-offset-4 focus-visible:!outline-[#007baf] disabled:translate-x-0 disabled:translate-y-0 disabled:cursor-not-allowed disabled:opacity-50 disabled:shadow-none motion-reduce:transition-none",f=`${h} bg-[#ed242a] text-white hover:bg-[#d51b23]`,p=`${h} bg-[#fffaf0] text-[#182127] hover:bg-[#ffed9a]`,u=`${h} bg-[#ffdc39] text-[#182127] hover:bg-[#ffeb80]`,g=`${h} bg-[#24aa43] text-white hover:bg-[#1b8833]`,b="min-h-[44px] border-[3px] border-[#182127] p-4 text-left lg:p-3 focus-visible:!outline focus-visible:!outline-[3px] focus-visible:!outline-offset-4 focus-visible:!outline-[#007baf] disabled:cursor-not-allowed disabled:opacity-40";function j({name:e,className:s=""}){return(0,a.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:`h-6 w-6 shrink-0 ${s}`,children:(0,a.jsx)("path",{d:{garage:"M3 21V8l9-6 9 6v13M7 21V11h10v10M7 15h10M7 18h10",journal:"M5 3h14v18H5zM9 7h6M9 11h6M9 15h4",wrench:"M14 3a6 6 0 0 0-7 7L2 17a3 3 0 0 0 5 4l7-8a6 6 0 0 0 7-7l-4 4-4-4 4-4z",fuel:"M4 21V3h10v18M4 10h10M2 21h14M14 9h3v8a2 2 0 0 0 4 0V7l-3-3",trophy:"M7 3h10v6a5 5 0 0 1-10 0zM7 5H3v3a4 4 0 0 0 4 4M17 5h4v3a4 4 0 0 1-4 4M12 14v5M7 21h10M9 19h6"}[e]})})}function v({className:e=""}){return(0,a.jsx)("span",{"aria-hidden":"true",className:`inline-block h-7 w-9 shrink-0 -skew-x-12 ${e}`,children:(0,a.jsx)("span",{className:"grid h-full w-full grid-cols-4 grid-rows-3",children:Array.from({length:12},(e,s)=>(0,a.jsx)("span",{className:(s+Math.floor(s/4))%2==0?"bg-current":""},s))})})}function y({children:e,aside:s,compact:t=!1}){return(0,a.jsxs)("div",{className:`mb-4 flex flex-wrap items-center gap-x-5 gap-y-2 ${t?"lg:mb-2":""}`,children:[(0,a.jsx)("h2",{style:o,className:`${c} -rotate-1 bg-[#ffdc39] px-4 py-2 text-2xl sm:text-3xl ${t?"lg:py-1 lg:text-xl":""}`,children:e}),s?(0,a.jsx)("p",{className:"text-xs font-bold italic text-[#51565a] sm:text-sm",children:s}):null]})}let N="planeta-garage:v1",w=[{id:"engine",name:"Двигатель",effect:"Разгон и скорость на короткой дистанции"},{id:"tires",name:"Шины",effect:"Сцепление и стабильный темп в любом заезде"},{id:"suspension",name:"Подвеска",effect:"Выносливость на длинной дистанции"}],k={sprint:{name:"Спринт",meters:400,fuel:18,wear:6,hint:"Короткий заезд. Решают разгон и сцепление."},endurance:{name:"Длинный заезд",meters:1200,fuel:28,wear:9,hint:"Береги темп: выносливость важна на финише."}},$=[{id:"attack",name:"Рывок",hint:"Быстрый старт, но выше усталость к финишу"},{id:"balanced",name:"Ровный темп",hint:"Стабильный ход от старта до финиша"},{id:"steady",name:"Беречь силы",hint:"Спокойный старт и сильный финиш"}],M=[{id:"yard",name:"Дворовая лига",level:1,power:1,multiplier:1},{id:"city",name:"Кубок города",level:3,power:4,multiplier:1.5},{id:"champion",name:"Лига мастеров",level:5,power:7,multiplier:2}],_={dry:{name:"Сухой асфальт",hint:"Быстрая трасса: двигатель помогает на разгоне."}
1,wet:{name:"После дождя",hint:"Мокрый асфальт: шины уменьшают пробуксовку."},rough:{name:"Неровный асфальт",hint:"На стыках трясёт: подвеска снижает потерю темпа."}},S={clean:{name:"Удачный разгон",short:"Разгон!",positive:!0},boost:{name:"Турбоускорение",short:"ТУРБО!",positive:!0},comeback:{name:"Финишный рывок",short:"ДОГОНЯЕМ!",positive:!0},slip:{name:"Пробуксовка",short:"Занос!",positive:!1},bump:{name:"Кочка на трассе",short:"Кочка!",positive:!1}};function A(){return{version:1,parts:160,xp:0,fuel:100,condition:100,upgrades:{engine:0,tires:0,suspension:0},history:[],activeRace:null}}let W=e=>1+Math.floor(e.xp/100),R=(e,s)=>45+35*e.upgrades[s],C=e=>e.segments.reduce((e,s)=>e+s,0),F=e=>Math.max(...e.racers.map(C)),L=e=>e.racers.slice().sort((e,s)=>C(e)-C(s));function z(e,s){if(s>=C(e))return 1;let t=Math.max(0,s),a=0;for(let s of e.segments){if(t<s){var l;let r=null===(l=e.events)||void 0===l?void 0:l.find(e=>e.segment===a);if(!r)return(a+t/s)/e.segments.length;let i=(s-r.delta)/2;return(a+(t<=i?.5*t/i:.5+.5*(t-i)/(s-i)))/e.segments.length}t-=s,a++}return 1}function E(e){return e.activeRace?e:{...e,fuel:100,condition:100}}function I(e,s,t){if(e.activeRace)return"Сначала закончи текущий заезд.";let a=M.find(e=>e.id===t);return W(e)<a.level?`Эта лига откроется на уровне ${a.level}.`:e.fuel<k[s].fuel?"Нужно заправить машину. Обслуживание в гараже бесплатно.":e.condition<25?"Машина требует обслуживания. Заезжай в гараж.":null}function O(e,s){let t=0;for(let l=0;l<e.segments.length;l++){var a;let r=e.segments[l],i=null===(a=e.events)||void 0===a?void 0:a.find(e=>e.segment===l);if(i&&s>=t+(r-i.delta)*.5&&s<t+r)return i;t+=r}}function V(e){if(!e)return null;try{let s=JSON.parse(e),t=(e,s)=>"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=s,a=e=>void 0===e||"dry"===e||"wet"===e||"rough"===e,l=e=>"sprint"===e||"endurance"===e,r=e=>M.some(s=>s.id===e);if(!s||1!==s.version||!t(s.parts,1e9)||!t(s.xp,1e9)||!t(s.fuel,100)||!t(s.condition,100)||!w.every(e=>{var a;return t(null===(a=s.upgrades)||void 0===a?void 0:a[e.id],8)})||!Array.isArray(s.history)||s.history.length>10||!s.history.every(e=>e&&"string"==typeof e.id&&l(e.distance)&&r(e.league)&&a(e.surface)&&t(e.rank,5)&&e.rank>=1&&Number.isFinite(e.time)&&e.time>0&&e.time<500&&t(e.parts,1e3)&&t(e.xp,100)))return null;let i=s.activeRace;if(null!==i&&(!i||"string"!=typeof i.id||!l(i.distance)||!r(i.league)||!a(i.surface)||!$.some(e=>e.id===i.tactic)||!Array.isArray(i.racers)||5!==i.racers.length||1!==i.racers.filter(e=>(null==e?void 0:e.player)===!0).length||!i.racers.every(e=>e&&"string"==typeof e.name&&e.name.length<=40&&"boolean"==typeof e.player&&t(e.color,360)&&Array.isArray(e.segments)&&4===e.segments.length&&e.segments.every(e=>Number.isFinite(e)&&e>=1&&e<=120)&&(void 0===e.events||Array.isArray(e.events)&&e.events.length<=4&&new Set(e.events.map(e=>null==e?void 0:e.segment)).size===e.events.length&&e.events.every(s=>s&&t(s.segment,3)&&["clean","boost","comeback","slip","bump"].includes(s.kind)&&Number.isFinite(s.delta)&&20>=Math.abs(s.delta)&&e.segments[s.segment]-s.delta>0&&Math.abs(s.delta)<(e.segments[s.segment]-s.delta)*.5&&(["clean","boost","comeback"].includes(s.kind)?s.delta<0:s.delta>0))))))return null;return{version:1,parts:s.parts,xp:s.xp,fuel:s.fuel,condition:s.condition,upgrades:{engine:s.upgrades.engine,tires:s.upgrades.tires,suspension:s.upgrades.suspension},history:s.history,activeRace:i}}catch{return null}}let q=e=>12*Math.sin((e-90)/500)+4*Math.sin((e-90)/190),D=e=>Number(e.toFixed(3)),H=e=>"endurance"===e?7200:4e3;function Z(e,s,t=4e3){let a=90+Math.max(0,Math.min(1,e))*t,l=12*Math.cos((a-90)/500)/500+4*Math.cos((a-90)/190)/190;return{x:a,y:D(108+60*s+q(a)),angle:D(90+180*Math.atan(l)/Math.PI)}}function B(e,s=4e3){return Array.from({length:Math.ceil((s+1e3)/20)+1},(s,t)=>{let a=-400+20*t;return`${t?"L":"M"}${a} ${D(108+60*e+q(a))}`}).join(" ")}function J({race:e,elapsed:s}){let t=e.surface||"dry",r=k[e.distance].meters,i=H(e.distance),n=(0,l.useMemo)(()=>({road:B(2,i),player:B(0,i),curbs:[-.55,4.55].map(e=>B(e,i)),dividers:[.5,1.5,2.5,3.5].map(e=>B(e,i))}),[i]),d=e.racers.find(e=>e.player),c=z(d,s),x=function(e,s=4e3){return Math.max(0,Math.min(s-820,Z(e,0,s).x-320))}(c,i),m=O(d,s),h=m&&S[m.kind].positive,f=s<0||c>=1?0:Math.round((z(d,s+.01)-c)*r*360),p=Z(1,0,i);return(0,a.jsxs)("svg",{viewBox:"0 0 1000 440",role:"img","aria-label":`Прямая трасса: ${_[t].name}. Камера следует за игроком. Пройдено ${Math.round(c*r)} метров.`,className:"h-full w-full",children:[(0,a.jsx)("rect",{width:"1000",height:"440",fill:"#9aa66e"}),(0,a.jsxs)("g",{transform:`translate(${-x} 0)`,children:[(0,a.jsx)("path",{d:`M-40 418H${i+220}`,stroke:"#7d8958",strokeWidth:"44"}),Array.from({length:Math.ceil(i/180)+2},(e,s)=>(0,a.jsxs)("g",{transform:`translate(${180*s}
1 0)`,children:[(0,a.jsx)("path",{d:"M0 412l32 16m64-21 24 22",stroke:"#b5be8a",strokeWidth:"3"}),(0,a.jsx)("rect",{x:"58",y:"411",width:"28",height:"7",fill:s%3?"#fff4d8":"#e74939",stroke:"#182127",strokeWidth:"2"}),(0,a.jsx)("path",{d:"M151 422l7-17 7 17Z",fill:"#e78539",stroke:"#182127",strokeWidth:"1.5"})]},s)),(0,a.jsx)("path",{d:n.road,fill:"none",stroke:"#182127",strokeWidth:"324"}),(0,a.jsx)("path",{d:n.road,fill:"none",stroke:"#fff6db",strokeWidth:"316"}),n.curbs.map((e,s)=>(0,a.jsx)("path",{d:e,fill:"none",stroke:"#df4336",strokeWidth:"14",strokeDasharray:"24 24"},s)),(0,a.jsx)("path",{d:n.road,fill:"none",stroke:"wet"===t?"#354954":"#42464a",strokeWidth:"298"}),(0,a.jsx)("path",{d:n.player,fill:"none",stroke:"#ffdc39",strokeOpacity:"0.08",strokeWidth:"57"}),n.dividers.map((e,s)=>(0,a.jsx)("path",{d:e,fill:"none",stroke:"#d4d1bc",strokeOpacity:"0.7",strokeWidth:"2.5",strokeDasharray:"32 46"},s)),Array.from({length:Math.ceil(i/350)},(e,s)=>(0,a.jsxs)("g",{transform:`translate(${210+350*s} 0)`,children:[(0,a.jsx)("path",{d:"M0 132h18m65 137h26m-81 79h13",stroke:"#e3dec9",strokeWidth:"1.5",opacity:"0.18"}),"wet"===t?(0,a.jsx)("ellipse",{cx:"80",cy:112+s%4*61,rx:"45",ry:"8",fill:"#9dd1df",opacity:"0.25"}):null,"rough"===t?(0,a.jsx)("path",{d:`M80 ${112+s%4*61}l15 8-8 14 18 8`,stroke:"#b9aa8c",strokeWidth:"3",opacity:"0.5",fill:"none"}):null]},s)),Array.from({length:r/100-1},(e,s)=>{let t=(s+1)*100,l=Z(t/r,0,i);return(0,a.jsxs)("g",{children:[(0,a.jsx)("path",{d:`M${l.x} ${l.y-27}v294`,stroke:"#fff5d9",strokeWidth:"2",opacity:"0.15"}),(0,a.jsx)("rect",{x:l.x-37,y:"397",width:"74",height:"29",fill:"#fff4d8",stroke:"#182127",strokeWidth:"2"}),(0,a.jsxs)("text",{x:l.x,y:"417",textAnchor:"middle",fill:"#182127",fontSize:"17",fontWeight:"800",children:[t," м"]})]},t)}),(0,a.jsx)("path",{d:"M90 79v298",stroke:"#fff5d9",strokeWidth:"4"}),(0,a.jsx)("text",{x:"90",y:"422",textAnchor:"middle",fill:"#182127",fontSize:"20",style:o,children:"СТАРТ →"}),(0,a.jsx)("g",{children:Array.from({length:50},(e,s)=>(0,a.jsx)("rect",{x:p.x-5+s%2*10,y:p.y-30+12*Math.floor(s/2),width:"10",height:"12",fill:(s+Math.floor(s/2))%2?"#fffaf0":"#182127"},s))}),(0,a.jsx)("text",{x:p.x,y:"422",textAnchor:"middle",fill:"#182127",fontSize:"22",style:o,children:"ФИНИШ"}),e.racers.map((e,t)=>{let l=z(e,s),r=Z(l,t,i),n=O(e,s),d=n&&S[n.kind].positive,c=s>=0&&l<1,o=76+12*Math.sin(32*s+t);return(0,a.jsxs)("g",{children:[(0,a.jsxs)("g",{transform:`translate(${r.x} ${r.y}) rotate(${r.angle-90})`,children:[c?(0,a.jsx)("g",{className:"motion-reduce:hidden",stroke:d?"#ffdc39":"#dedac7",strokeWidth:d?3:1.5,strokeLinecap:"round",opacity:d?.9:.5,children:(0,a.jsx)("path",{d:`M-50 -16h-${d?60:28}M-54 0h-${d?76:42}M-50 16h-${d?50:24}`})}):null,d?(0,a.jsxs)("g",{className:"motion-reduce:hidden",children:[(0,a.jsx)("path",{d:`M-37-10L-${o}-5-60 0-${o+8} 7-37 11Z`,fill:"#f16821"}),(0,a.jsx)("path",{d:"M-38-5L-62 0-38 6Z",fill:"#ffdc39"})]}):null,e.player?(0,a.jsx)("rect",{x:"-48",y:"-24",width:"96",height:"48",rx:"13",fill:"none",stroke:"#ffdc39",strokeWidth:"2.5"}):null,(0,a.jsx)("image",{href:"/images/game/car.png",x:"-27",y:"-45",width:"54",height:"90",transform:"rotate(90)",style:{filter:e.player?void 0:`hue-rotate(${e.color}deg)`}}),(0,a.jsx)("circle",{cx:"0",cy:"0",r:"9",fill:e.player?"#ffdc39":"#fffaf0",stroke:"#182127",strokeWidth:"1.5"}),(0,a.jsx)("text",{x:"0",y:"4",textAnchor:"middle",fontSize:"12",fontWeight:"900",fill:"#182127",children:t+1})]}),n?(0,a.jsx)("text",{x:r.x,y:r.y-30,textAnchor:"middle",fontSize:"14",fontWeight:"900",fill:d?"#ffdc39":"#fff4d8",stroke:"#182127",strokeWidth:"3",paintOrder:"stroke",children:S[n.kind].short}):null]},e.name)})]}),e.racers.map((e,t)=>{let l=Z(z(e,s),t,i),r=l.x-x;return r>=35&&r<=965?null:(0,a.jsxs)("g",{transform:`translate(${r<35?28:972} ${l.y})`,children:[(0,a.jsx)("rect",{x:"-24",y:"-13",width:"48",height:"26",fill:"#fff4d8",stroke:"#182127",strokeWidth:"2"}),(0,a.jsx)("text",{y:"5",textAnchor:"middle",fontSize:"15",fontWeight:"900",fill:"#182127",children:r<35?`‹ ${t+1}`:`${t+1} ›`})]},e.name)}),(0,a.jsx)("rect",{width:"1000",height:"50",fill:"#9aa66e"}
1),(0,a.jsx)("text",{x:"26",y:"33",fill:"#182127",fontSize:"23",style:o,children:"ПЛАНЕТА ДРАЙВ"}),(0,a.jsx)("text",{x:"500",y:"32",textAnchor:"middle",fill:"#182127",fontSize:"17",fontWeight:"800",children:c>.85&&c<1?`ДО ФИНИША ${Math.ceil((1-c)*r)} м`:`${Math.round(c*r)} / ${r} м`}),(0,a.jsxs)("g",{transform:"translate(746 8)",children:[(0,a.jsx)("rect",{width:"230",height:"36",fill:h?"#ffdc39":"#fff4d8",stroke:"#182127",strokeWidth:"2"}),(0,a.jsxs)("text",{x:"12",y:"25",fill:"#182127",fontSize:"17",fontWeight:"900",children:[h?S[m.kind].short:"СКОРОСТЬ",(0,a.jsxs)("tspan",{x:"218",textAnchor:"end",children:[f," км/ч"]})]})]})]})}function P({race:e,onFinish:s}){let[t,r]=(0,l.useState)(-3),[i,n]=(0,l.useState)(!1),[d,c]=(0,l.useState)(1),o=(0,l.useRef)(-3),x=(0,l.useRef)(!1),m=(0,l.useRef)(1),h=(0,l.useRef)(s),f=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{h.current=s},[s]),(0,l.useEffect)(()=>{let s=0,t=0,a=0,l=F(e),i=()=>{x.current=!0,n(!0)},d=()=>{document.hidden&&i()},c=e=>{"Escape"!==e.code||e.repeat||(x.current=!x.current,n(x.current))},p=i=>{let n=t?Math.min((i-t)/1e3,.1):0;if(t=i,!x.current&&(o.current=Math.min(l,o.current+n*(o.current<0?1:m.current)),(i-a>32||o.current>=l)&&(r(o.current),a=i),o.current>=l&&!f.current)){f.current=!0,h.current(e.id,l);return}s=requestAnimationFrame(p)};return s=requestAnimationFrame(p),window.addEventListener("blur",i),document.addEventListener("visibilitychange",d),window.addEventListener("keydown",c),()=>{cancelAnimationFrame(s),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",d),window.removeEventListener("keydown",c)}},[e]),(0,a.jsx)(T,{race:e,elapsed:t,paused:i,speed:d,onTogglePause:()=>{x.current=!x.current,n(x.current)},onToggleSpeed:()=>{m.current=1===m.current?2:1,c(m.current)},onResume:()=>{x.current=!1,n(!1)}})}function T({race:e,elapsed:s,paused:t,speed:l,onTogglePause:r,onToggleSpeed:i,onResume:n}){let d=Math.max(0,s)/F(e),m=e.racers.slice().sort((e,t)=>z(t,s)-z(e,s)||(1===z(e,s)?C(e)-C(t):0)),h=e.racers.flatMap((e,s)=>(e.events||[]).map(t=>({...t,racer:e,racerIndex:s,at:e.segments.slice(0,t.segment).reduce((e,s)=>e+s,0)+(e.segments[t.segment]-t.delta)*.5}))).filter(e=>e.at<=s).sort((e,s)=>s.at-e.at||e.racerIndex-s.racerIndex)[0],u=_[e.surface||"dry"];return(0,a.jsxs)("div",{className:`${x} overflow-hidden`,children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b-[3px] border-[#182127] bg-[#ffdc39] px-4 py-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{style:o,className:`${c} text-xl sm:text-2xl`,children:[k[e.distance].name," \xb7 ",k[e.distance].meters," м"]}),(0,a.jsxs)("p",{className:"mt-1 text-xs",children:[u.name," \xb7 ",s<0?"Готовимся к старту":`${Math.max(0,s).toFixed(1)} с`]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:`${p} text-xs`,onClick:r,children:t?"Продолжить":"Пауза"}),(0,a.jsxs)("button",{className:`${p} text-xs`,"aria-label":"Скорость просмотра",onClick:i,children:["\xd7",l]})]})]}),(0,a.jsxs)("div",{className:"grid lg:grid-cols-[minmax(0,1fr)_220px]",children:[(0,a.jsxs)("div",{className:"relative h-[230px] overflow-hidden bg-[#9aa66e] sm:h-[320px] lg:h-[clamp(220px,calc(100dvh-370px),390px)]",children:[(0,a.jsx)(J,{race:e,elapsed:s}),s<0||t?(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:(0,a.jsxs)("div",{className:`${x} -rotate-2 px-6 py-4 text-center`,children:[(0,a.jsx)("p",{style:o,className:`${c} text-5xl`,children:t?"Пауза":Math.ceil(-s)}),t?(0,a.jsx)("button",{className:`${f} mt-3 text-sm`,onClick:n,children:"Продолжить заезд"}):(0,a.jsx)("p",{className:"mt-1 text-sm",children:"На старт!"})]})}):null]}),(0,a.jsxs)("section",{"aria-label":"Текущие места",className:"border-t-[3px] border-[#182127] p-3 lg:border-l-[3px] lg:border-t-0",children:[(0,a.jsx)("h3",{style:o,className:`${c} mb-2 text-lg`,children:"Позиции"}),(0,a.jsx)("ol",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-3 lg:grid-cols-1",children:m.map((t,l)=>(0,a.jsxs)("li",{className:`flex items-center gap-2 px-2 py-2 text-xs ${t.player?"bg-[#ffdc39]":"bg-[#ece5d6]"}`,children:[(0,a.jsx)("strong",{className:"text-base",children:l+1}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("b",{className:"block truncate",children:t.name}),(0,a.jsxs)("span",{className:"mt-0.5 block text-[10px] text-[#51565a]",children:["№",e.racers.indexOf(t)+1," \xb7 ",z(t,s)>=1?`${C(t).toFixed(2)} с \xb7 финиш`:`${Math.round(z(t,s)*k[e.distance].meters)} м`]})]})]},t.name))})]})]}),(0,a.jsxs)("div",{className:"border-t-[3px] border-[#182127] px-4 py-3",children:[(0,a.jsx)("p",{className:"min-h-[32px] text-xs leading-4",role:"status","aria-live":"polite",children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("b",{children:[h.racer.name,": ",S[h.kind].name.toLowerCase(),"."]})," ",h.delta>0?"Потеря":"Выигрыш"," ",Math.abs(h.delta).toFixed(2)," с на участке ",h.segment+1,"."]}):u.hint}),(0,a.jsx)("div",{className:"mt-2 h-2 overflow-hidden bg-[#d5d9d9]",role:"progressbar","aria-label":"Ход заезда","aria-valuenow":Math.round(100*d),"aria-valuemin":0,"aria-valuemax":100,children:(0,a.jsx)("div",{className:"h-full bg-[#ed242a]",style:{width:`${100*d}%`}})})]})]})}let U=e=>
1e.toLocaleString("ru-RU");function G({name:e,value:s,icon:t}){return(0,a.jsxs)("div",{className:`${x} flex items-center gap-3 p-3 lg:gap-2 lg:p-1.5`,children:[(0,a.jsx)("div",{className:`hidden -rotate-12 border-b-4 border-[#159ac5] p-2 sm:block lg:hidden ${"fuel"===t?"text-[#e62329]":"text-[#182127]"}`,children:(0,a.jsx)(j,{name:t,className:"!h-10 !w-10 lg:!h-7 lg:!w-7"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{style:o,className:`${c} text-lg lg:text-base`,children:e}),(0,a.jsxs)("p",{style:o,className:"my-1 text-3xl italic lg:my-0 lg:text-2xl",children:[s,"%"]}),(0,a.jsxs)("div",{className:"relative h-5 -skew-x-6 lg:h-3.5 overflow-hidden border-2 border-[#182127] bg-[#d5d9d9]",role:"meter","aria-label":e,"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,children:[(0,a.jsx)("div",{className:`h-full ${s<25?"bg-[#ed242a]":"bg-[#32c950]"}`,style:{width:`${s}%`}}),(0,a.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 grid grid-cols-5 divide-x-2 divide-[#182127]",children:Array.from({length:5},(e,s)=>(0,a.jsx)("span",{},s))})]})]})]})}function K(){var e,s;let[t,r]=(0,l.useState)(()=>A()),n=(0,l.useRef)(t),[h,O]=(0,l.useState)(!1),[q,D]=(0,l.useState)(!1),H=(0,l.useRef)(!0),[Z,B]=(0,l.useState)("garage"),[J,T]=(0,l.useState)("sprint"),[K,Q]=(0,l.useState)("balanced"),[X,Y]=(0,l.useState)("yard"),[ee,es]=(0,l.useState)(""),[et,ea]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=null;try{e=V(localStorage.getItem(N))}catch{H.current=!1,D(!0)}let s=e||A();n.current=s,r(s),s.activeRace&&(B("race"),es("Незавершённый заезд восстановлен. Просмотр начнётся со старта, топливо повторно не списывается.")),O(!0);let t=e=>{if(e.key!==N)return;let s=V(e.newValue);s&&(n.current=s,r(s),ea(null),s.activeRace&&B("race"),es("Гараж обновлён из другой вкладки."))};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);let el=e=>{let s=n.current;if(H.current)try{s=V(localStorage.getItem(N))||s}catch{H.current=!1}let t=e(s);n.current=t,r(t);try{localStorage.setItem(N,JSON.stringify(t)),H.current=!0,D(!1)}catch{H.current=!1,D(!0)}return t},er=W(t),ei=!!t.activeRace,en=I(t,J,X),ed=et?t.history.find(e=>e.id===et.id):null;return h?(0,a.jsxs)("div",{className:"mx-auto max-w-[1480px] lg:flex lg:h-[calc(100dvh-24px)] lg:min-h-[576px] lg:flex-col",children:[(0,a.jsxs)("header",{className:"mb-4 grid items-center gap-3 lg:mb-3 lg:shrink-0 lg:grid-cols-[180px_minmax(0,1fr)_260px]",children:[(0,a.jsxs)("h1",{"aria-label":"Планета Драйв",className:"relative w-fit -rotate-3 pl-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"absolute -inset-x-1 inset-y-3 -skew-x-12 bg-[#ffdc39]"}),(0,a.jsxs)("span",{style:o,className:`${c} relative block text-[32px] lg:text-[30px]`,children:["Планета",(0,a.jsxs)("span",{className:"mt-1 flex items-center gap-3 text-[#e62329]",children:["Драйв ",(0,a.jsx)(v,{className:"text-[#182127]"})]})]})]}),(0,a.jsx)("nav",{"aria-label":"Разделы игры",className:"grid grid-cols-3 gap-2",children:[["garage","Гараж"],["race","Заезды"],["journal","Журнал"]].map(([e,s])=>(0,a.jsxs)("button",{type:"button",disabled:ei&&"race"!==e,"aria-pressed":Z===e,onClick:()=>{B(e),es("")},className:`flex min-h-[58px] items-center justify-center gap-2 border-[3px] border-[#182127] px-2 py-3 focus-visible:!outline focus-visible:!outline-[3px] focus-visible:!outline-offset-4 focus-visible:!outline-[#007baf] disabled:cursor-not-allowed disabled:opacity-40 lg:min-h-[52px] lg:py-2 ${Z===e?"bg-[#ffdc39] text-[#182127] shadow-[3px_3px_0_#182127]":"bg-[#182127] text-white hover:bg-[#35414a]"}`,children:["race"===e?(0,a.jsx)(v,{className:"hidden !h-5 !w-6 sm:inline-block"}):(0,a.jsx)(j,{name:"garage"===e?"garage":"journal",className:"hidden sm:block"}),(0,a.jsx)("span",{style:o,className:"text-lg uppercase lg:text-xl",children:s})]},e))}),(0,a.jsxs)("div",{className:"border-[3px] border-[#182127] bg-[#fffaf0] px-4 py-3 lg:px-3 lg:py-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 font-bold",children:[(0,a.jsxs)("span",{children:["Уровень ",er]}
1),(0,a.jsxs)("span",{className:"flex items-center gap-2","aria-label":`Запас деталей: ${U(t.parts)}`,children:[(0,a.jsx)(j,{name:"wrench",className:"!h-5 !w-5"}),U(t.parts)," деталей"]})]}),(0,a.jsx)("div",{className:"mt-2 h-2.5 overflow-hidden border-2 border-[#182127] bg-[#d5d9d9]",role:"progressbar","aria-label":"Опыт до следующего уровня","aria-valuenow":t.xp%100,"aria-valuemin":0,"aria-valuemax":100,children:(0,a.jsx)("div",{className:"h-full bg-[#159ac5]",style:{width:`${t.xp%100}%`}})}),(0,a.jsxs)("p",{className:"mt-1 text-center text-[10px] font-bold text-[#51565a]",children:[t.xp%100," / 100 опыта"]})]})]}),q?(0,a.jsx)("p",{role:"status",className:"mb-4 border-[3px] border-[#182127] bg-[#ffdc39] p-3 text-sm",children:"Браузер не разрешает сохранение. Прогресс доступен только до закрытия страницы."}):null,ee?(0,a.jsx)("p",{role:"status",className:"mb-4 border-l-4 border-[#182127] bg-[#fffaf0] px-4 py-3 lg:px-3 lg:py-2 text-sm font-medium",children:ee}):null,(0,a.jsxs)("div",{className:"lg:min-h-0 lg:flex-1 lg:overflow-auto lg:p-1",children:["garage"===Z?(0,a.jsxs)("div",{className:"lg:flex lg:h-full lg:min-h-0 lg:flex-col",children:[(0,a.jsxs)("div",{className:"grid gap-4 lg:min-h-[180px] lg:flex-1 lg:grid-cols-[minmax(0,1fr)_260px] lg:grid-rows-[minmax(0,1fr)]",children:[(0,a.jsxs)("section",{"aria-label":"Моя машина",className:"relative isolate aspect-[3/2] overflow-hidden border-[4px] border-[#182127] bg-[#c9ad85] sm:aspect-[16/9] lg:aspect-auto lg:min-h-0",children:[(0,a.jsx)(d(),{src:"/images/game/comic/garage-background.png",alt:"",width:1536,height:1024,priority:!0,sizes:"(min-width: 1560px) 1160px, (min-width: 1024px) 75vw, 100vw",className:"absolute inset-0 h-full w-full object-cover"}),(0,a.jsx)(d(),{src:"/images/game/comic/car.png",alt:"Красная машинка Планеты в гараже",width:1536,height:1024,priority:!0,sizes:"(min-width: 1560px) 960px, (min-width: 1024px) 60vw, 85vw",className:"absolute bottom-[1%] left-[6%] h-[90%] w-[83%] object-contain"}),(0,a.jsxs)("span",{className:"absolute left-3 top-3 -rotate-2 border-2 border-[#182127] bg-[#fffaf0] px-3 py-1 text-xs font-black uppercase sm:left-5 sm:top-5 sm:text-sm",children:["Твоя Планета \xb7 ур. ",er]})]}),(0,a.jsxs)("section",{"aria-label":"Состояние машины",className:"flex flex-col gap-3 lg:gap-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:gap-2",children:[(0,a.jsx)(G,{name:"Топливо",value:t.fuel,icon:"fuel"}),(0,a.jsx)(G,{name:"Состояние",value:t.condition,icon:"wrench"})]}),(0,a.jsxs)("button",{type:"button",className:`${g} w-full text-sm lg:px-2 lg:py-2`,disabled:100===t.fuel&&100===t.condition,onClick:()=>{el(E),es("Полный бак и отличное состояние. Можно ехать!")},children:[(0,a.jsx)(j,{name:"wrench"}),"Обслужить \xb7 бесплатно"]}),(0,a.jsx)("p",{className:"text-center text-xs leading-5 text-[#51565a] lg:leading-4",children:100===t.fuel&&100===t.condition?"Полный бак. Машина готова к заезду!":"Заправка и ремонт перед следующим заездом."})]})]}),(0,a.jsxs)("div",{className:"mt-5 grid items-end gap-4 lg:mt-3 lg:shrink-0 lg:grid-cols-[minmax(0,1fr)_260px]",children:[(0,a.jsxs)("div",{className:"pb-1 lg:order-last lg:self-center lg:pb-0",children:[(0,a.jsxs)("button",{type:"button",className:`${f} w-full -rotate-2 !border-[4px] !px-5 !py-4 lg:!py-3 !shadow-[6px_6px_0_#182127]`,onClick:()=>{B("race"),es("")},children:[(0,a.jsx)(v,{}),(0,a.jsx)("span",{style:o,className:`${c} whitespace-nowrap text-4xl lg:text-3xl`,children:"На старт"}),(0,a.jsx)("span",{"aria-hidden":"true",className:"text-4xl font-black",children:"\xbb"})]}),(0,a.jsx)("p",{className:"mt-4 text-center text-xs font-bold italic lg:mt-3",children:"Выбери дистанцию. Покажи, на что способен."})]}),(0,a.jsxs)("section",{className:"min-w-0",children:[(0,a.jsx)(y,{aside:"Делают твою машину сильнее!",compact:!0,children:"Улучшения"}),(0,a.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:w.map(e=>{let s=t.upgrades[e.id],l=R(t,e.id),r=s>=8;return(0,a.jsxs)("div",{className:`${x} relative flex min-w-0 flex-col p-3 lg:p-2`,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"relative -ml-1 w-[42%] shrink-0 lg:w-[68px] bg-[radial-gradient(#159ac5_1px,transparent_1px)] bg-[length:5px_5px]",children:(0,a.jsx)(d(),{src:`/images/game/comic/${e.id}.png`,width:1280,height:1280,sizes:"(min-width: 768px) 160px, 42vw",alt:"",className:"relative aspect-square w-full object-contain"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{style:o,className:`${c} text-xl lg:text-lg xl:text-xl`,children:e.name}),(0,a.jsxs)("p",{className:"mt-2 text-sm font-bold lg:mt-1",children:[s," / ",8]}),(0,a.jsx)("div",{className:"mt-2 flex gap-0.5 lg:mt-1","aria-hidden":"true",children:Array.from({length:8},(e,t)=>(0,a.jsx)("span",{className:`h-4 min-w-0 flex-1 lg:h-3 -skew-x-6 border border-[#182127] ${t<s?"bg-[#ffdc39]":"bg-[#d5d9d9]"}`},t))})]})]}),(0,a.jsx)("p",{className:"mb-3 mt-2 min-h-[36px] text-xs leading-[18px] lg:mb-2 lg:mt-1 lg:min-h-[32px] lg:text-[11px] lg:leading-4 text-[#51565a]",children:e.effect}),(0,a.jsx)("button",{type:"button",className:`${u} mt-auto w-full text-sm lg:gap-1 lg:px-2 lg:py-1.5`,disabled:r||t.parts<l,"aria-label":r?`${e.name}: максимальный уровень`:`Улучшить ${"suspension"===e.id?"подвеску":e.name.toLowerCase()} за ${l} деталей`,onClick:()=>{let s=n.current.upgrades[e.id],t=el(s=>
1(function(e,s){let t=R(e,s);return e.activeRace||e.upgrades[s]>=8||e.parts<t?e:{...e,parts:e.parts-t,upgrades:{...e.upgrades,[s]:e.upgrades[s]+1}}})(s,e.id));es(t.upgrades[e.id]>s?`${e.name}: установлен уровень ${t.upgrades[e.id]}.`:"Улучшение недоступно: проверь запас деталей.")},children:r?"Максимальный уровень":(0,a.jsxs)(a.Fragment,{children:["Улучшить ",(0,a.jsx)(j,{name:"wrench",className:"!h-4 !w-4"}),l]})}),!r&&t.parts<l?(0,a.jsxs)("p",{className:"mt-2 text-xs font-medium lg:mt-1 lg:text-[11px]",children:["Не хватает ",l-t.parts," деталей"]}):null]},e.id)})})]})]})]}):null,"race"===Z?(0,a.jsxs)(a.Fragment,{children:[t.activeRace?(0,a.jsx)(P,{race:t.activeRace,onFinish:(e,s)=>{var t;let a=n.current.activeRace,l=el(t=>(function(e,s,t){let a=e.activeRace;if(!a||a.id!==s||!Number.isFinite(t)||t<F(a))return e;let l=L(a),r=l.findIndex(e=>e.player)+1,i=Math.round([65,48,35,25,20][r-1]*M.find(e=>e.id===a.league).multiplier*("endurance"===a.distance?1.3:1)),n=[35,26,20,15,12][r-1],d={id:s,distance:a.distance,league:a.league,rank:r,time:C(l[r-1]),parts:i,xp:n,...a.surface?{surface:a.surface}:{}};return{...e,activeRace:null,parts:e.parts+i,xp:e.xp+n,history:[d,...e.history].slice(0,10)}})(t,e,s));a&&(null===(t=l.history[0])||void 0===t?void 0:t.id)===e&&(ea(a),es("Награда уже в гараже. Можно улучшить машину и снова на старт."))}},t.activeRace.id):ed&&et?(0,a.jsxs)("section",{className:x,children:[(0,a.jsx)("h2",{style:o,className:m,children:"Финиш! Результаты заезда"}),(0,a.jsxs)("div",{className:"grid gap-6 p-5 sm:grid-cols-[240px_minmax(0,1fr)] lg:p-4",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center bg-[#ffdc39] p-5",children:[(0,a.jsx)(j,{name:"trophy",className:"!h-16 !w-16"}),(0,a.jsxs)("p",{style:o,className:`${c} mt-4 text-5xl`,children:[ed.rank," место"]}),(0,a.jsxs)("p",{className:"mt-4 text-xl font-black",children:["+",ed.parts," деталей"]}),(0,a.jsxs)("p",{className:"mt-1 text-sm font-bold",children:["+",ed.xp," опыта"]}),(0,a.jsx)("ul",{className:"mt-3 space-y-1 text-left text-xs",children:null===(s=et.racers.find(e=>e.player))||void 0===s?void 0:null===(e=s.events)||void 0===e?void 0:e.map(e=>(0,a.jsxs)("li",{children:[e.segment+1,". ",S[e.kind].name,": ",e.delta>0?"+":"−",Math.abs(e.delta).toFixed(2)," с"]},e.segment))})]}),(0,a.jsx)("div",{className:"min-w-0 overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-left text-sm",children:[(0,a.jsxs)("caption",{className:"mb-3 text-left font-bold",children:[k[ed.distance].name," \xb7 ",k[ed.distance].meters," м",ed.surface?` \xb7 ${_[ed.surface].name}`:""]}),(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b-2 border-[#182127]",children:[(0,a.jsx)("th",{className:"py-3 pr-2",children:"Место"}),(0,a.jsx)("th",{children:"Машина"}),(0,a.jsx)("th",{className:"text-right",children:"Время"})]})}),(0,a.jsx)("tbody",{children:L(et).map((e,s)=>(0,a.jsxs)("tr",{className:`border-b border-[#d7ceba] ${e.player?"bg-[#ffed9a] font-bold":""}`,children:[(0,a.jsx)("td",{className:"px-2 py-4 lg:py-2",children:s+1}),(0,a.jsxs)("td",{children:[e.name,e.player?" \xb7 ты":""]}),(0,a.jsxs)("td",{className:"whitespace-nowrap pr-2 text-right",children:[C(e).toFixed(2)," с"]})]},e.name))})]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap justify-end gap-4 border-t-[3px] border-[#182127] p-5 lg:p-3",children:[(0,a.jsx)("button",{className:p,onClick:()=>{B("garage"),es("")},children:"В гараж"}),(0,a.jsx)("button",{className:f,onClick:()=>{ea(null),es("")},children:"Следующий заезд →"})]})]}):(0,a.jsxs)("section",{children:[(0,a.jsx)(y,{aside:"Новый состав соперников и покрытие в каждом заезде.",children:"На старт!"}),(0,a.jsxs)("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_300px]",children:[(0,a.jsxs)("div",{className:`${x} space-y-5 p-4 lg:space-y-4`,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:o,className:`${c} mb-3 text-2xl lg:mb-2 lg:text-xl`,children:"01 / Дистанция"}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:Object.keys(k).map(e=>(0,a.jsxs)("button",{type:"button","aria-pressed":J===e,onClick:()=>T(e),className:`${b} ${J===e?"bg-[#ffdc39] shadow-[3px_3px_0_#182127]":"bg-[#f7f1e3] hover:bg-[#ffed9a]"}`,children:[(0,a.jsxs)("span",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("b",{className:"text-lg",children:k[e].name}),(0,a.jsxs)("span",{className:"text-lg font-black",children:[k[e].meters," м"]})]}),(0,a.jsx)("p",{className:"mt-2 text-xs leading-5",children:k[e].hint}),(0,a.jsxs)("p",{className:"mt-3 text-xs font-bold",children:["Топливо −",k[e].fuel," \xb7 состояние −",k[e].wear]})]},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:o,className:`${c} mb-3 text-2xl lg:mb-2 lg:text-xl`,children:"02 / Тактика"}),(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-3",children:$.map(e=>(0,a.jsxs)("button",{"aria-pressed":K===e.id,onClick:()=>Q(e.id),className:`${b} ${K===e.id?"bg-[#ffdc39] shadow-[3px_3px_0_#182127]":"bg-[#f7f1e3] hover:bg-[#ffed9a]"}`,children:[(0,a.jsx)("b",{className:"text-base",children:e.name}),(0,a.jsx)("p",{className:"mt-2 text-xs leading-5",children:e.hint})]},e.id))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:o,className:`${c} mb-3 text-2xl lg:mb-2 lg:text-xl`,children:"03 / Лига"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-3",children:M.map(e=>(0,a.jsxs)("button",{disabled:er<e.level,"aria-pressed":X===e.id,onClick:()=>Y(e.id),className:`${p} text-sm ${X===e.id?"!bg-[#ffdc39]":""}`,children:[e.name,er<e.level?` \xb7 с ур. ${e.level}`:` \xb7 \xd7${e.multiplier}`]},e.id))})]})]}),(0,a.jsxs)("aside",{className:`${x} flex flex-col p-5`,children:[(0,a.jsx)(v,{className:"mb-5 !h-10 !w-14"}),(0,a.jsx)("h3",{style:o,className:`${c} text-3xl`,children:"Готов к гонке?"}),(0,a.jsxs)("dl",{className:"my-6 space-y-4 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,a.jsx)("dt",{children:"Дистанция"}),(0,a.jsxs)("dd",{className:"font-bold",children:[k[J].meters," м"]})]}),(0,a.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,a.jsx)("dt",{children:"Топливо"}),(0,a.jsxs)("dd",{className:"font-bold",children:[t.fuel,"%"]})]}),(0,a.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,a.jsx)("dt",{children:"Состояние"}),(0,a.jsxs)("dd",{className:"font-bold",children:[t.condition,"%"]})]})]}),(0,a.jsx)("p",{className:"mb-6 text-xs leading-5",children:en||"Покрытие и события меняются каждый заезд. Шины помогают на мокром, подвеска — на кочках. Улучшения и тактика дают преимущество."}),en?(0,a.jsx)("button",{className:`${p} mt-auto`,onClick:()=>B("garage"),children:"В гараж"}):(0,a.jsx)("button",{className:`${f} mt-auto`,onClick:()=>{let e=null,s=el(s=>(e=I(s,J,X))?s:function(e,s,t,a,l,r=Math.random){var i;if(I(e,s,a))return e;let n=M.find(e=>e.id===a),d=()=>{let e=r();return Number.isFinite(e)?Math.max(0,Math.min(.999999,e)):.5},c=e=>e[Math.floor(d()*e.length)],o=c(["dry","wet","rough"]),x=(e,t,a,l,r,i)=>{let n="endurance"===s,x=n?7:4.3,m=.86+.28*d(),h=[];return{name:e,color:t,player:a,segments:Array.from({length:4},(e,s)=>{let t=1+l.engine*(n?.024:.043)+.027*l.tires+l.suspension*(n?.044:.014),a=x*(1+(n?.048:.018)*s/(1+.22*l.suspension)+("attack"===r?[-.15,-.07,.06,n?.22:.025][s]:"steady"===r?[.1,.025,-.06,n?-.15:-.04][s]:0)+(d()-.5)*.12/(1+.18*l.tires)+("wet"===o?.09/(1+.3*l.tires):"rough"===o?.09/(1+.3*l.suspension):0))*(1+(100-i)*.002)*m/t,f=0,p=.38>d(),u=c("wet"===o?["clean","slip","slip","bump"]:"rough"===o?["clean","slip","bump","bump"]:["clean","clean","slip","bump"]),g=.8+.4*d();if(p){let e="attack"===r?1.25:"steady"===r?.7:1;f=a*("clean"===u?-.22*("attack"===r?1.15:1):"slip"===u?.3*e/(1+.24*l.tires):.26*e/(1+.26*l.suspension))*g,h.push({segment:s,kind:u,delta:f})}return a+f}),events:h}},m=[x("Твоя Планета",0,!0,e.upgrades,t,e.condition)],h=["Синий вихрь","Лимон","Зелёный свет","Сиреневый дым"];for(let e=0;e<4;e++){let s=Math.round(n.power-2+5*d()),t=()=>Math.max(0,Math.min(8,s+Math.floor(3*d())-1));m.push(x(h[e],[185,55,110,275][e],!1,{engine:t(),tires:t(),suspension:t()},c($).id,100))}let f=m[0],p=1+Math.floor(2*d()),u=.2+.06*d(),g=(e,s,t)=>{let a=f.events.find(s=>s.segment===e);f.segments[e]+=t-((null==a?void 0:a.delta)||0),f.events=[...f.events.filter(s=>s.segment!==e),{segment:e,kind:s,delta:t}].sort((e,s)=>e.segment-s.segment)},b=f.segments[p]-((null===(i=f.events.find(e=>e.segment===p))||void 0===i?void 0:i.delta)||0);g(p,"boost",-b*u);let j=f.segments.slice(0,3).reduce((e,s)=>e+s,0),v=Math.max(0,...m.slice(1).map(e=>z(e,j)-.75)),y=f.events.find(e=>3===e.segment),N=f.segments[3]-((null==y?void 0:y.delta)||0),w=Math.max(-(.32*N),((null==y?void 0:y.delta)||0)-N*Math.min(.42,2.4*v));return v>0&&w<0?g(3,"comeback",w):v>0&&y&&w>0&&g(3,y.kind,w),{...e,fuel:e.fuel-k[s].fuel,condition:Math.max(0,e.condition-k[s].wear),activeRace:{i
1d:l,distance:s,tactic:t,league:a,racers:m,surface:o}}}(s,J,K,X,`${Date.now()}-${Math.random().toString(36).slice(2,10)}`));e?es(e):s.activeRace&&(ea(null),es(""),B("race"))},children:"Участвовать в заезде →"})]})]})]}),(0,a.jsx)("p",{className:"mt-5 text-center text-xs leading-5 text-[#51565a]",children:"Соперники — компьютерные машины. Детали и награды используются только внутри игры."})]}):null,"journal"===Z?(0,a.jsxs)("section",{className:x,children:[(0,a.jsx)("h2",{style:o,className:m,children:"Журнал заездов"}),t.history.length?(0,a.jsxs)("div",{className:"overflow-x-auto p-4",children:[(0,a.jsxs)("table",{className:"w-full text-left text-xs sm:text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b-2 border-[#182127]",children:[(0,a.jsx)("th",{className:"pb-3",children:"Заезд"}),(0,a.jsx)("th",{className:"px-2",children:"Место"}),(0,a.jsx)("th",{className:"px-2",children:"Время"}),(0,a.jsx)("th",{children:"Награда"})]})}),(0,a.jsx)("tbody",{children:t.history.map(e=>{var s;return(0,a.jsxs)("tr",{className:"border-b border-[#d7ceba]",children:[(0,a.jsxs)("td",{className:"py-4",children:[(0,a.jsx)("b",{children:k[e.distance].name}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-[#51565a]",children:[null===(s=M.find(s=>s.id===e.league))||void 0===s?void 0:s.name,e.surface?` \xb7 ${_[e.surface].name}`:""]})]}),(0,a.jsxs)("td",{className:"whitespace-nowrap px-2 font-bold",children:[e.rank," / 5"]}),(0,a.jsxs)("td",{className:"whitespace-nowrap px-2",children:[e.time.toFixed(2)," с"]}),(0,a.jsxs)("td",{className:"font-bold",children:["+",e.parts," деталей",(0,a.jsxs)("span",{className:"mt-1 block text-xs font-normal",children:["+",e.xp," опыта"]})]})]},e.id)})})]}),(0,a.jsx)("p",{className:"mt-4 text-xs text-[#51565a]",children:"Последние 10 заездов"})]}):(0,a.jsxs)("div",{className:"px-6 py-16 text-center",children:[(0,a.jsx)(j,{name:"journal",className:"mx-auto mb-5 !h-12 !w-12"}),(0,a.jsx)("p",{style:o,className:`${c} text-3xl`,children:"Твоя история начинается здесь"}),(0,a.jsx)("p",{className:"mt-4 text-sm",children:"Здесь появятся результаты и награды твоих заездов."}),(0,a.jsx)("button",{className:`${f} mt-7`,onClick:()=>B("race"),children:"На стадион →"})]})]}):null]}),(0,a.jsxs)("footer",{className:"mt-5 flex flex-wrap items-center justify-between gap-x-6 gap-y-4 border-t-2 border-[#182127] pt-3 text-xs lg:mt-3 lg:shrink-0 lg:pt-1",children:[(0,a.jsx)(i(),{href:"/catalog",className:"py-2 text-sm font-bold lg:py-1 text-[#00749d] underline underline-offset-4 focus-visible:outline focus-visible:!outline-offset-4",children:"← В каталог"}),(0,a.jsx)("p",{className:"text-[#51565a]",children:"Прогресс сохраняется в этом браузере"}),(0,a.jsx)(i(),{href:"/game/arcade",className:"py-2 font-bold lg:py-1 underline underline-offset-4 focus-visible:outline focus-visible:!outline-offset-4",children:"Аркада →"})]})]}):(0,a.jsx)("div",{className:"py-24 text-center text-lg font-bold",children:"Открываем гараж…"})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.