1import{c0 as Le,r as o,j as a,bg as H,c1 as Fe,d as _,ax as me,c2 as he,bf as fe,c3 as Ne,ai as y,c4 as $e,c5 as ze,c6 as Ae,F as J,t as S,ab as Oe,c as De,R as Ge,b3 as ee,b4 as Be,c7 as Pe,f as Re,am as Ve,an as qe,aL as te,c8 as We,c9 as Ye,bl as Ue,aO as He,bc as Qe,bX as ne,bk as Ke}from"./index-D6h6POgK.js";import{r as Xe}from"./ArrowClockwise.es-C8elHHK1.js";import{r as Ze}from"./identity-CdjJNdvM.js";import{u as Je}from"./usePlayerData-XBlMaULM.js";import{S as ye,a as p,b as B,d as P,T as ea,e as xe}from"./TierFilter-DdnFT0y3.js";import{F as k,a as b}from"./FilterButton-G2ptpqqN.js";var V,re;function aa(){if(re)return V;re=1;function l(n,e){for(var s,r=-1,g=n.length;++r<g;){var x=e(n[r]);x!==void 0&&(s=s===void 0?x:s+x)}return s}return V=l,V}var q,ie;function la(){if(ie)return q;ie=1;var l=aa(),n=Ze();function e(s){return s&&s.length?l(s,n):0}return q=e,q}var sa=la();const ta=Le(sa),na={HT:"Heavy",MT:"Medium",LT:"Light",TD:"Triangle",SPG:"Clicker"},Q=Fe.map(l=>({label:na[l],value:l})),ra=_.div.withConfig({displayName:"ClassFilter__OptionContainer",componentId:"sc-5pk66q-0"})(["display:flex;align-items:center;gap:8px;"]);o.memo(({classes:l,setClasses:n})=>a.jsx(ye,{placeholder:"Classes...",options:Q,isMulti:!0,components:{Option:e=>a.jsx(p.Option,{...e,children:a.jsxs(ra,{children:[a.jsx(H,{type:e.data.value,isPrem:!1}),e.label]})}),MultiValueLabel:e=>a.jsx(p.MultiValueLabel,{...e,children:a.jsx(H,{type:e.data.value,isPrem:!1})})},value:Object.entries(l).map(([e,s])=>s?Q.find(r=>r.value===e):null).filter(Boolean),onChange:e=>{const s={HT:!1,MT:!1,LT:!1,SPG:!1,TD:!1};e?.forEach(({value:r})=>s[r]=!0),n(s)}}));const ia=o.memo(({classes:l,setClasses:n,isPrem:e})=>a.jsx(k,{children:Q.map(s=>a.jsx(b,{onClick:()=>{n((()=>{const r={...l};return r[s.value]=!r[s.value],r})())},$selected:l[s.value],children:a.jsx(H,{type:s.value,isPrem:e})},s.value))})),W=[{value:"all",label:"All"},{value:"in-garage",label:"In my Garage"},{value:"not-in-garage",label:"Not in my Garage"}];o.memo(({active:l,tankInGarageType:n,setTankInGarageType:e})=>a.jsx("div",{style:{width:125},children:a.jsx(B,{placeholder:"Garage...",options:W,isDisabled:!l,styles:{...P},value:W.find(({value:s})=>s===n)??W[0],onChange:s=>{l&&e(s?.value)}})}));const oa=o.memo(({tankInGarageType:l,setTankInGarageType:n})=>(me(),a.jsxs(k,{children:[a.jsx(b,{onClick:()=>{if(l==="in-garage"){n("all");return}n("in-garage")},$selected:l==="in-garage",children:a.jsx("img",{decoding:"async",width:24,height:24,src:"/missions/slot.webp",alt:"World of Tanks in-garage",loading:"lazy"})},"in-garage"),a.jsx(b,{onClick:()=>{if(l==="not-in-garage"){n("all");return}n("not-in-garage")},$selected:l==="not-in-garage",children:a.jsx("img",{decoding:"async",width:24,height:24,src:"/missions/not-slot.webp",alt:"World of Tanks not-in-garage",loading:"lazy"})},"not-in-garage")]}))),oe=[{label:"0",value:"0"},{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"}];o.memo(({masteryFilter:l,setMasteryFilter:n})=>a.jsx(B,{placeholder:"Mastery...",options:oe,isMulti:!0,styles:P,components:{Option:e=>a.jsx(p.Option,{...e,children:a.jsx("img",{decoding:"async",width:24,height:24,src:`/masteryIcons/${e.label}.webp`,alt:e.label,loading:"lazy"})}),MultiValueLabel:e=>a.jsx(p.MultiValueLabel,{...e,children:a.jsx("img",{decoding:"async",width:24,height:24,src:`/masteryIcons/${e.data.label}.webp`,alt:e.data.label,loading:"lazy"})})},value:l.map(e=>oe.find(s=>s.value===String(e))).filter(Boolean),onChange:e=>n(e?.map(s=>Number(s.label))??[])}));const ca=[{label:"0",value:0},{label:"1",value:1},{label:"2",value:2},{label:"3",value:3},{label:"4",value:4}],ua=o.memo(({masteryFilter:l,setMasteryFilter:n})=>a.jsx(k,{children:ca.map(e=>a.jsx(b,{onClick:()=>{n((()=>{const s=[...l],r=s.indexOf(e.value);return r===-1?s.push(e.value):s.splice(r,1),s})())},$selected:l.includes(e.value),children:a.jsx("img",{decoding:"async",width:20,height:20,src:`/masteryIcons/${e.value}.webp`,alt:`World of Tanks ${e.label}`,loading:"lazy"})},e.value))})),da=_.input.withConfig({displayName:"shared___Filter",componentId:"sc-15k5vcc-0"})(["font-family:var(--font-inter);width:",";border:1px solid var(--gray-a1);border-radius:3px;padding:4px 10px;height:32px;color:var(--gray-a11);caret-color:var(--gray-a11);background:var(--gray-a3);transition:0.2s;&:hover{background:var(--gray-a4);box-shadow:0px 3px 7px rgb(20,20,20);border:1px solid var(--gray-a8);}&:focus{background:var(--gray-a4);outline:none;box-shadow:0px 4px 8px rgb(20,20,20);}::placeholder{color:var(--gray-a7);}"],({$width:l})=>l??"120px"),be=l=>a.jsx(da,{...l}),ga=o.memo(({minBattles:l,setMinBattles:n})=>
1a.jsx(be,{value:l,onChange:({target:e})=>{if(e.value===""){n(void 0);return}isNaN(Number(e.value))||n(Number(e.value)??void 0)},placeholder:"Min Battles..."})),ce=[{label:"0",value:"0"},{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"}];o.memo(({moeFilter:l,setMoeFilter:n})=>a.jsx(B,{placeholder:"MoE...",options:ce,isMulti:!0,styles:P,components:{Option:e=>a.jsx(p.Option,{...e,children:a.jsx("img",{decoding:"async",width:24,height:24,src:`/markIcons/mark_${Math.max(1,Number(e.label))}.webp`,alt:`World of Tanks ${e.label} Marks of Excellence `,style:{opacity:e.label==="0"?.3:1},loading:"lazy"})}),MultiValueLabel:e=>a.jsx(p.MultiValueLabel,{...e,children:a.jsx("img",{decoding:"async",width:24,height:24,src:`/markIcons/mark_${Math.max(1,Number(e.data.label))}.webp`,alt:`World of Tanks ${e.data.label} Marks of Excellence `,style:{opacity:e.data.label==="0"?.3:1},loading:"lazy"})})},value:l.map(e=>ce.find(s=>s.value===String(e))).filter(Boolean),onChange:e=>n(e?.map(s=>Number(s.label))??[])}));const ma=[{label:"0",value:0},{label:"1",value:1},{label:"2",value:2},{label:"3",value:3}],ha=o.memo(({moeFilter:l,setMoeFilter:n})=>a.jsx(k,{children:ma.map(e=>a.jsx(b,{onClick:()=>{n((()=>{const s=[...l],r=s.indexOf(e.value);return r===-1?s.push(e.value):s.splice(r,1),s})())},$selected:l.includes(e.value),children:a.jsx("img",{decoding:"async",width:20,height:20,src:`/markIcons/mark_${Math.max(1,Number(e.value))}.webp`,alt:`World of Tanks ${e.label} Marks of Excellence `,style:{opacity:e.label==="0"?.3:1},loading:"lazy"})},e.value))})),fa=he.map(l=>({label:fe[l],value:l})),ue=[...he.map(l=>({label:fe[l],value:l})),...Ne.map(l=>({label:l.name,value:l.nations.join(",")}))],ya=_.div.withConfig({displayName:"NationFilter__OptionContainer",componentId:"sc-1ulqlkt-0"})(["display:flex;align-items:center;gap:8px;"]);function xa(l,n){return n.split(",").every(e=>l[e])}o.memo(({nations:l,setNations:n})=>a.jsx(ye,{placeholder:"Nations...",options:ue,isMulti:!0,components:{Option:e=>e.data.value.includes(",")&&xa(l,e.data.value)?null:a.jsx(p.Option,{...e,children:a.jsxs(ya,{children:[a.jsx("img",{decoding:"async",width:29,height:18,src:e.data.value.includes(",")?`/alliances/alliance_${e.data.label}.webp`:`/flags/${e.data.label}.webp`,style:{objectFit:"cover"},alt:e.data.label+"Flag",loading:"lazy"}),e.label]})}),MultiValueLabel:e=>a.jsx(p.MultiValueLabel,{...e,children:a.jsx("img",{decoding:"async",width:29,height:18,src:`/flags/${e.data.label}.webp`,style:{objectFit:"cover",borderRadius:3},alt:e.data.label+"Flag",loading:"lazy"})})},value:Object.entries(l).map(([e,s])=>s?ue.find(r=>r.value===e):null).filter(Boolean),onChange:e=>{const s={usa:!1,china:!1,czech:!1,france:!1,germany:!1,italy:!1,japan:!1,poland:!1,sweden:!1,uk:!1,ussr:!1};e?.forEach(({value:r})=>{r.includes(",")?r.split(",").forEach(x=>{s[x]=!0}):s[r]=!0}),n(s)}}));const ba=o.memo(({nations:l,setNations:n})=>a.jsx(k,{children:fa.map(e=>a.jsx(b,{onClick:()=>{n((()=>{const s={...l};return s[e.value]=!s[e.value],s})())},$selected:l[e.value],children:a.jsx("img",{decoding:"async",width:29,height:18,src:`/flags/${e.label}.webp`,style:{objectFit:"cover",borderRadius:3},alt:e.value+"Flag",loading:"lazy"})},e.value))})),pa=Ae.map(l=>({label:l,value:l})),va=o.memo(({roles:l,setRoles:n})=>a.jsx(k,{children:pa.map(e=>a.jsx(y,{message:$e[e.value],children:a.jsx(b,{onClick:()=>{n((()=>{const s={...l};return s[e.value]=!s[e.value],s})())},$selected:l[e.value],children:a.jsx(ze,{role:e.value,width:16})})},e.value))}));function ja({value:l,setValue:n,placeholder:e,width:s}){return a.jsx(be,{value:l,onChange:({target:r})=>n(r.value),placeholder:e,$width:s})}const Y=[{value:"all",label:"All"},{value:"premium",label:"Premium"},{value:"tech-tree",label:"Tech Tree"}];o.memo(({tankType:l,setTankType:n})=>a.jsx("div",{style:{width:125},children:a.jsx(B,{placeholder:"Tier...",options:Y,styles:{...P},value:Y.find(({value:e})=>e===l)??Y[0],onChange:e=>{n(e?.value)}})}));const wa=o.memo(({tankType:l,setTankType:n})=>a.jsxs(k,{children:[a.jsx(b,{onClick:()=>{if(l==="tech-tree"){n("all");return}n("tech-tree")},$selected:l==="tech-tree",children:a.jsx("img",{decoding:"async",width:24,height:24,src:"/missions/techtree.webp",alt:"World of Tanks techtree tanks",loading:"lazy"})},"tech-tree"),a.jsx(b,{onClick:()=>
1{if(l==="premium"){n("all");return}n("premium")},$selected:l==="premium",children:a.jsx("img",{decoding:"async",width:24,height:24,src:"/missions/premium.webp",alt:"World of Tanks premium tanks",loading:"lazy"})},"premium")]})),ka=_.span.withConfig({displayName:"ConnectWg__Container",componentId:"sc-2wk66f-0"})(["display:flex;align-items:center;gap:4px;cursor:pointer;color:",";&:hover{color:white;}"],S.gray1);function Ma(){const{setWgLoginOpen:l}=J();return a.jsxs(ka,{onClick:()=>l(!0),children:[a.jsx("img",{loading:"lazy",decoding:"async",src:"/wg.webp",alt:"WG",width:16,height:16}),"Link Wargaming"]})}const c=20;function Ca(){const{wgId:l,wgIdLoading:n}=J(),{data:e}=Oe.useSession();return a.jsx(a.Fragment,{children:e?l?a.jsxs("span",{style:{color:S.gray3,display:"flex",alignItems:"center",gap:8},children:[a.jsx("img",{loading:"lazy",decoding:"async",src:"/worries/worrylove.webp",alt:"Love",width:c,height:c})," ","You linked your wargaming account and can filter for your own"," ",a.jsx(y,{message:"MoEs",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/markIcons/mark_3.webp",alt:"MoEs",width:c,height:c})}),", ",a.jsx(y,{message:"Mastery",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/masteryIcons/4.webp",alt:"Master",width:c,height:c})})," ","and"," ",a.jsx(y,{message:"Garage",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/missions/slot.webp",alt:"Garage",width:c,height:c})}),"now!"]}):n?a.jsxs("span",{style:{color:S.gray3,display:"flex",alignItems:"center",gap:8},children:[a.jsx("img",{loading:"lazy",decoding:"async",src:"/worries/worrylove.webp",alt:"Love",width:c,height:c})," ","Loading your wargaming account..."]}):a.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[a.jsx(Ma,{}),a.jsxs("span",{style:{color:S.gray3,display:"flex",gap:4,alignItems:"center"},children:["to filter for your own"," ",a.jsx(y,{message:"MoEs",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/markIcons/mark_3.webp",alt:"MoEs",width:c,height:c})}),", ",a.jsx(y,{message:"Mastery",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/masteryIcons/4.webp",alt:"Master",width:c,height:c})})," ","and"," ",a.jsx(y,{message:"Garage",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/missions/slot.webp",alt:"Garage",width:c,height:c})})]})]}):a.jsx("div",{style:{display:"flex",gap:8,alignItems:"center"},children:a.jsxs("span",{style:{color:S.gray3,display:"flex",gap:4},children:[a.jsx(De,{to:Ge.LOGIN,children:"Login"}),"to filter for your own"," ",a.jsx(y,{message:"MoEs",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/markIcons/mark_3.webp",alt:"MoEs",width:c,height:c})}),", ",a.jsx(y,{message:"Mastery",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/masteryIcons/4.webp",alt:"Master",width:c,height:c})})," ","and"," ",a.jsx(y,{message:"Garage",children:a.jsx("img",{loading:"lazy",decoding:"async",src:"/missions/slot.webp",alt:"Garage",width:c,height:c})})]})})})}function U(l){const n=Object.keys(l);return ee({parse:e=>{const s=new Set(e.split(",")),r={...l};for(const g of n)r[g]=s.has(g);return r},serialize:e=>n.filter(s=>e[s]).join(","),eq:(e,s)=>n.every(r=>e[r]===s[r])})}function Ta(l){return ee({parse:n=>{const e=Array(l).fill(!1);for(const s of n.split(",")){const r=Number(s);Number.isInteger(r)&&r>=0&&r<l&&(e[r]=!0)}return e},serialize:n=>n.reduce((e,s,r)=>s?[...e,r]:e,[]).join(","),eq:(n,e)=>n.length===e.length&&n.every((s,r)=>s===e[r])})}function de(l){const n=new Set(l);return ee({parse:e=>{const s=[];for(const r of e.split(",")){const g=Number(r);n.has(g)&&s.push(g)}return s},serialize:e=>e.join(","),eq:(e,s)=>e.length===s.length&&e.every((r,g)=>r===s[g])})}const Ea=_.div.withConfig({displayName:"TankFilters2__Container",componentId:"sc-o2ki4-0"})(["display:flex;gap:8px;flex-wrap:wrap;align-items:center;"]),K={usa:!1,china:!1,czech:!1,france:!1,germany:!1,italy:!1,japan:!1,poland:!1,sweden:!1,uk:!1,ussr:!1},X={HT:!1,MT:!1,LT:!1,SPG:!1,TD:!1},Z={support:!1,assault:!1,universal:!1,break:!1,sniper:!1,wheeled:!1,scout:!1,spg:!1},pe=xe.map(()=>!1),Ia=["all","premium","tech-tree"],Sa=["all","in-garage","not-in-garage"],_a=[0,1,2,3],La=[0,1,2,3,4],ve=[],je=[],G=0,Fa={filter:Ke.withDefault(""),tiers:Ta(xe.length).withDefault(pe),classes:U(X).withDefault(X),nations:U(K).withDefault(K),roles:U(Z).withDefault(Z),tankType:ne(Ia).withDefault("all"),tankInGarageType:ne(Sa).withDefault("all"),minBattles:Qe.withDefault(G),moe:de(_a).withDefault(ve),mastery:de(La).withDefault(je)},ge={filter:"",tiers:pe,classes:X,nations:K,roles:Z,tankType:"all",tankInGarageType:"all",minBattles:G,moe:ve,mastery:je};function Na({data:l,setFilteredData:n,disableFilters:e={},noLowTier:s=!1,saveInUrl:r=!0,setAverages:g,filterAverageKeys:x,customElement:we,customWgId:m}){const[R,ae]=o.useState(l);o.useEffect(()=>{ae(l)},[l]);const{wgId:v}=J(),{data:L}=Je(),[ke,F]=Be(Fa),[Me,le]=o.useState(ge),Ce=r?ke:Me,h=o.useCallback(t=>{r?F(t):le(i=>({...i,...t}))},[r,F]),{filter:se,tiers:N,classes:$,nations:z,roles:A,tankType:C,tankInGarageType:O,minBattles:T,moe:E,mastery:I}=Ce,[D]=Pe(se,200),[Te,Ee]=o.useState(R.length),M=L?.private?.garage,Ie=o.useCallback(()=>{r?F({filter:null,tiers:null,classes:null,nations:null,roles:null,tankType:null,tankInGarageType:null,minBattles:null,moe:null,mastery:null}):le(ge)},[r,F]),{data:j}=Re({queryKey:["moeAndMasteryDataForPlayer",v,m],queryFn:()=>fetch(`https://api.worldoftanks.${qe(m||v)}/wot/tanks/achievements/?application_id=${Ve}&account_id=${m||v}&fields=achievements%2C+tank_id`).then(t=>t.json()),enabled:m?!!m:!!v});o.useEffect(()=>{if(!v||!j)return;const t=l.map(i=>{const f=j.data[m||v];if(!f)return{...i,moe:0,mastery:0};const d=f.find(u=>u.tank_id===(i.tank_id||i.tankId||i.id));return d?{...i,moe:d.achievements.marksOnGun??0,mastery:d.achievements.markOfMastery??0}:{...i,moe:0,mastery:0}});ae(t)},[v,m,j,l]);const Se=o.useCallback(t=>{const i=t.some(u=>typeof u.battles=="number"),f=ta(t.map(u=>typeof u.battles=="number"?u.battles:1)),d={};x?.forEach(([u])=>d[u]=0),t.forEach(u=>{x?.forEach(([w])=>{w==="battles"?d[w]+=u[w]:d[w]+=u[w]*(i?u.battles:1)})}),x?.forEach(([u,w])=>{u==="battles"?d[u]=te(d[u]/t.length,0):d[u]=te(d[u]/f,w)}),g?.(d)},[]);o.useEffect(()=>{let t=[...R];N.every(i=>!i)||(t=t.filter(({tier:i})=>N[i-1])),Object.values(z).every(i=>!i)||(t=t.filter(({nation:i})=>z[i.toLowerCase()])),Object.values($).every(i=>!i)||(t=t.filter(({class:i})=>$[i])),Object.values(A).every(i=>!i)||(t=t.filter(({role:i})=>i&&A[i])),C==="premium"&&(t=t.filter(({isPrem:i})=>i)),C==="tech-tree"&&(t=t.filter(({isPrem:i})=>!i)),D&&(t=t.filter(({name:i})=>We(i).toLowerCase().replace(/[\W_]+/g,"").includes(D.toLowerCase().replace(/[\W_]+/g,""))||Ye(i,D,{ignoreCase:!0,normalizeWhitespace:!0})>.75)),E.length>0&&j&&(t=t.filter(({moe:i})=>E.includes(i))),I.length>0&&j&&(t=t.filter(({mastery:i})=>I.includes(i))),T&&(t=t.filter(({battles:i})=>i>=T)),O==="in-garage"&&L&&(t=t.filter(({id:i,tank_id:f,tankId:d})=>d?M?.includes(d):f?M?.includes(f):i?M?.includes(i):!1)),O==="not-in-garage"&&L&&(t=t.filter(({id:i,tank_id:f})=>f?!M?.includes(f):i?!M?.includes(i):!1)),Ue.unstable_batchedUpdates(()=>{n(t),Se(t),Ee(t.length)})},[R,D,N,z,$,A,C,E,I,n,T,M,O]);const _e=me();return a.jsxs(Ea,{children:[a.jsx(ja,{value:se,setValue:t=>h({filter:t}),placeholder:`Search ${Te} tanks...`,width:_e?"100%":"160px"}),!e.tier&&a.jsx(ea,{tiers:N,setTiers:t=>h({tiers:t}),noLowTier:s}),!e.nation&&a.jsx(ba,{nations:z,setNations:t=>h({nations:t})}),!e.class&&a.jsx(ia,{classes:$,setClasses:t=>h({classes:t}),isPrem:C==="premium"}),!e.role&&a.jsx(va,{roles:A,setRoles:t=>h({roles:t})}),!e.type&&a.jsx(wa,{tankType:C,setTankType:t=>h({tankType:t})}),!e.minBattles&&a.jsx(ga,{minBattles:T===G?void 0:T,setMinBattles:t=>h({minBattles:t??G})}),!e.mastery&&j&&a.jsx(ua,{masteryFilter:I,setMasteryFilter:t=>h({mastery:typeof t=="function"?t(I):t})}),!e.moe&&j&&a.jsx(ha,{moeFilter:E,setMoeFilter:t=>h({moe:typeof t=="function"?t(E):t})}),!e.inGarage&&L&&a.jsx(oa,{tankInGarageType:O,setTankInGarageType:t=>h({tankInGarageType:t})}),a.jsx("div",{children:a.jsx(He,{onClick:()=>Ie(),color:"red",variant:"soft",children:a.jsx(Xe,{size:16,weight:"bold"})})}),we,a.jsx(Ca,{})]})}const Ba=o.memo(Na);export{ia as C,ba as N,va as R,Ba as T,Ta as a,wa as b,U as c,de as d,Ma as e,ta as s};
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.