import{jsxs as d,jsx as e,Fragment as u}from"react/jsx-runtime";import{useState as i,useEffect as g}from"react";const v=a=>{if(!a)return{part1:"Ser",part2:"v",part3:"er"};const r=a.length,t=Math.max(1,Math.ceil(r*.4)),l=Math.min(r-1,t+Math.max(1,Math.ceil(r*.2)));return{part1:a.slice(0,t),part2:a.slice(t,l),part3:a.slice(l)}};function b({logoUrl:a,appName:r}){const[t,l]=i(!1),[c,m]=i(!1);return g(()=>{document.body.classList.add("preloading");const o=800,n=Date.now(),s=()=>{const p=Date.now()-n,h=Math.max(0,o-p);setTimeout(()=>{l(!0),document.body.classList.remove("preloading"),setTimeout(()=>m(!0),700)},h)};if(document.readyState==="complete")s();else return window.addEventListener("load",s),()=>window.removeEventListener("load",s);return()=>{document.body.classList.remove("preloading")}},[]),c?null:d("div",{id:"preloader",className:t?"hidden":"",children:[e("div",{className:"preloader-bg"}),d("div",{className:"preloader-inner",children:[d("div",{className:"preloader-logo-wrap",children:[e("img",{src:a||"/mostwanted/img/logosmall.png",alt:"MostWanted",className:"preloader-logo",width:100,height:100}),e("div",{className:"preloader-ring"}),e("div",{className:"preloader-ring preloader-ring--2"})]}),e("div",{className:"preloader-name",children:(()=>{const{part1:o,part2:n,part3:s}=v(r||"");return d(u,{children:[e("span",{className:"lin",children:o}),e("span",{className:"two",children:n}),e("span",{className:"death",children:s})]})})()}),e("div",{className:"preloader-bar-wrap",children:e("div",{className:"preloader-bar"})}),e("div",{className:"preloader-tagline",children:"Prepare for battle."})]})]})}export{b as Preload,b as default};
