1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/finderAssist-DGqy8FTE.js","assets/index-Cc-3hq20.js","assets/vendor-react-COL_fmx_.js","assets/vendor-three-CoHYrz5L.js","assets/index-2kgOCIUw.css"])))=>i.map(i=>d[i]); 2import{e_ as V,e$ as ne,f0 as be,f1 as A,f2 as E,f3 as ge,f4 as Se,f5 as Ne,f6 as Ce,u as P,_ as J,f7 as Me}from"./index-Cc-3hq20.js";import{r as y,j as i}from"./vendor-react-COL_fmx_.js";import{A as ve}from"./AnimatedCollapse-Bm3IYixi.js";import"./vendor-three-CoHYrz5L.js";const N={"orbital-zones":"all","zone-moon-counts":"all","world-family":"any","landscape-signals":"any","nebula-types":"any","ancient-civilizations":"any","system-state":"any","transient-mass":"any",stars:"any",planets:"all",moons:"all","system-features":"all"},ae=["O","B","A","F","G","K","M"],Fe=new Set(ae);function oe(e,a,t){return`${e}:${a}:${re(t,a).toLowerCase()}`}function Q(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()){const a=Number(e);return Number.isFinite(a)?a:null}return null}function ie(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`#${e.toString(16).padStart(6,"0")}`}function O(e,a,t){return e[a]??`${t} ${a}`}function Te(e){return e.trim().split(/[\s._-]+/).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()).join(" ")}function re(e,a){const t=e.replace(/\s+/g," ").trim();return t?t.replace(/^Planet\s*[-:]\s*/i,"").replace(/^Moon\s*[-:]\s*/i,"Moon "):`Type ${a}`}function xe(e,a){const t=new Map;for(const s of Object.values(e.solar_systems)){if(!s||s.hidden||!s.position)continue;const o=Number(s.id);if(!Number.isFinite(o))continue;const n=e.regions?.[String(s.region_id)],l=e.constellations?.[String(s.constellation_id)];t.set(o,{systemId:o,name:s.name,regionName:n?.name??null,constellationName:l?.name??null,starType:null,planetTypeKeys:new Set,moonTypeKeys:new Set,orbitalZoneIds:new Set,orbitalZoneGroups:new Set,hasNaturalFamily:!1,hasBrokenFamily:!1,hasTransitionalFamily:!1,landscapeZoneTags:new Set,hasNonZeroDangerLevelTag:!1,hasOuterIcyTag:!1,nebulaId:Q(n?.nebula_id),ancientCivilizationId:Q(s.faction_id),systemState:null,transientMassBucket:null,hasStation:a?.has(o)??!1,hasHumanHabitablePlanet:!1,hasHumanHabitableMoon:!1,stargateCount:0,planetCount:Number(s.planets)||0,moonCount:0,orbitalZoneCount:0})}return t}function Oe(e,a){for(const t of Object.values(a.stargates)){const s=Number(t.source_system_id),o=e.get(s);o&&(o.stargateCount+=1)}}function Ie(e,a){for(const t of a.stars){const s=e.get(t.solarSystemId);if(!s||!t.spectralClass)continue;const o=t.spectralClass.trim().charAt(0).toUpperCase();Fe.has(o)&&(s.starType=o)}for(const t of a.celestialTypes){const s=e.get(t.solarSystemId);if(!s)continue;const o=oe(t.bodyKind,t.typeId,t.typeDescription);t.bodyKind==="moon"?s.moonTypeKeys.add(o):s.planetTypeKeys.add(o)}for(const t of a.stargateCounts){const s=e.get(t.solarSystemId);s&&(s.stargateCount=t.stargateCount)}for(const t of a.moonCounts){const s=e.get(t.solarSystemId);s&&(s.moonCount=t.moonCount)}for(const t of a.orbitalZoneCounts){const s=e.get(t.solarSystemId);s&&(s.orbitalZoneCount=t.orbitalZoneCount)}for(const t of a.humanHabitability){const s=e.get(t.solarSystemId);s&&(s.hasHumanHabitablePlanet=t.hasHumanHabitablePlanet,s.hasHumanHabitableMoon=t.hasHumanHabitableMoon)}for(const t of a.systemStates){const s=e.get(t.solarSystemId);s&&(s.systemState=t.systemState?t.systemState.trim().toUpperCase():null,s.transientMassBucket=t.transientMassBucket)}for(const[t,s]of a.landscapeSummaries){const o=e.get(t);if(!o)continue;o.hasNaturalFamily=s.hasNaturalFamily,o.hasBrokenFamily=s.hasBrokenFamily,o.hasTransitionalFamily=s.hasTransitionalFamily,o.landscapeZoneTags=new Set(s.zoneTags),o.hasNonZeroDangerLevelTag=s.hasNonZeroDangerLevelTag,o.hasOuterIcyTag=s.hasOuterIcyTag;const n=new Set;for(const l of s.ecosystemIds){const r=V({ecosystemId:l});r&&n.add(r.zoneId)}for(const l of s.ecosystemNames){const r=V({ecosystemName:l});r&&n.add(r.zoneId)}for(const l of n){o.orbitalZoneIds.add(l);const r=ne.find(m=>m.id===l);r&&o.orbitalZoneGroups.add(r.group)}}}function we(e){const a=new Map;for(const t of e)t.starType&&a.set(t.starType,(a.get(t.starType)??0)+1);return ae.map(t=>({id:`star:${t}`,section:"stars",label:`${t}-type`,value:t,count:a.get(t)??0,predicate:s=>s.starType===t}))}function je(e,a){const t=new Map,s=new Map,o=new Map(e.map(n=>[n.systemId,n]));for(const n of a.celestialTypes){const l=o.get(n.solarSystemId);if(!l)continue;const r=oe(n.bodyKind,n.typeId,n.typeDescription);if(!(n.bodyKind==="moon"?l.moonTypeKeys:l.planetTypeKeys).has(r))continue;
2const u=n.bodyKind==="moon"?s:t,b=u.get(r);b?b.systemIds.add(n.solarSystemId):u.set(r,{key:r,typeId:n.typeId,label:re(n.typeDescription,n.typeId),systemIds:new Set([n.solarSystemId])})}return{planetOptions:X("planets",t,n=>n.planetTypeKeys),moonOptions:X("moons",s,n=>n.moonTypeKeys)}}function X(e,a,t){return Array.from(a.values()).sort((s,o)=>o.systemIds.size-s.systemIds.size||s.label.localeCompare(o.label)).map(s=>({id:`${e}:${s.typeId}`,section:e,label:s.label,value:s.key,count:s.systemIds.size,detail:`Type ${s.typeId}`,predicate:o=>t(o).has(s.key)}))}function ze(e){const a=n=>e.reduce((l,r)=>l+(n(r)?1:0),0),t=e.reduce((n,l)=>Math.max(n,l.planetCount),0),s=(n,l)=>`${n} ${l}${n===1?"":"s"}`;return[{label:"Has station",value:"feature:station",predicate:n=>n.hasStation},{label:"Human-habitable planet",value:"feature:human-habitable-planet",help:"Candidate world with human-tolerable gravity, temperature and pressure. Includes Temperate and Oceanic planets; excludes gas, plasma, puffy, lava, barren and other hostile types. Atmosphere composition is unknown.",predicate:n=>n.hasHumanHabitablePlanet},{label:"Human-habitable moon",value:"feature:human-habitable-moon",help:"Candidate moon with human-tolerable gravity, temperature and pressure, excluding obviously hostile moon types. Atmosphere composition is unknown.",predicate:n=>n.hasHumanHabitableMoon},{label:"0 stargates",value:"feature:stargates:0",predicate:n=>n.stargateCount===0},{label:"1 stargate",value:"feature:stargates:1",predicate:n=>n.stargateCount===1},{label:"2 stargates",value:"feature:stargates:2",predicate:n=>n.stargateCount===2},{label:"3 stargates",value:"feature:stargates:3",predicate:n=>n.stargateCount===3},{label:"4+ stargates",value:"feature:stargates:4plus",predicate:n=>n.stargateCount>=4},...Array.from({length:t+1},(n,l)=>({label:s(l,"planet"),value:`feature:planets:${l}`,predicate:r=>r.planetCount===l}))].map(n=>({...n,id:n.value,section:"system-features",count:a(n.predicate)})).filter(n=>n.value==="feature:station"||n.value.startsWith("feature:planets:")?n.count>0:!0)}const _e=["belt","trojan","inner","outer"],Ae=[{id:"orbital-zones:0",label:"0 zone
2s",min:0,max:0,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"},{id:"orbital-zones:1-3",label:"1-3 zones",min:1,max:3,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"},{id:"orbital-zones:4-5",label:"4-5 zones",min:4,max:5,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"},{id:"orbital-zones:6-8",label:"6-8 zones",min:6,max:8,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"},{id:"orbital-zones:9-11",label:"9-11 zones",min:9,max:11,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"},{id:"orbital-zones:12plus",label:"12+ zones",min:12,max:null,group:"Orbital zones",field:"orbitalZoneCount",color:"#78d6ff"}],Ee=[{id:"moons:0",label:"0 moons",min:0,max:0,group:"Moons",field:"moonCount",color:"#c7d0ff"},{id:"moons:1-3",label:"1-3 moons",min:1,max:3,group:"Moons",field:"moonCount",color:"#c7d0ff"},{id:"moons:4-8",label:"4-8 moons",min:4,max:8,group:"Moons",field:"moonCount",color:"#c7d0ff"},{id:"moons:9-15",label:"9-15 moons",min:9,max:15,group:"Moons",field:"moonCount",color:"#c7d0ff"},{id:"moons:16-25",label:"16-25 moons",min:16,max:25,group:"Moons",field:"moonCount",color:"#c7d0ff"},{id:"moons:26plus",label:"26+ moons",min:26,max:null,group:"Moons",field:"moonCount",color:"#c7d0ff"}];function ee(e,a){const t=e[a.field];return a.max===null?t>=a.min:a.min===a.max?t===a.min:t>=a.min&&t<=a.max}function Le(e,a){const t=ke(e),s=$e(e),o=De(e),n=Ze(e),l=Pe(e),r=Be(e),m=He(e),u=Ke(e),b=we(e),{planetOptions:S,moonOptions:C}=je(e,a),M=ze(e);return[{id:"orbital-zones",title:"Orbital Zones",defaultMatchMode:N["orbital-zones"],options:t},{id:"zone-moon-counts",title:"Zone / Moon Counts",defaultMatchMode:N["zone-moon-counts"],options:s},{id:"world-family",title:"World Family",defaultMatchMode:N["world-family"],options:o},{id:"landscape-signals",title:"Landscape Signals",defaultMatchMode:N["landscape-signals"],options:n},{id:"nebula-types",title:"Nebula Type",defaultMatchMode:N["nebula-types"],options:l},{id:"ancient-civilizations",title:"Ancient Civilizations",defaultMatchMode:N["ancient-civilizations"],options:r},{id:"system-state",title:"System State",defaultMatchMode:N["system-state"],options:m},{id:"transient-mass",title:"Transient Mass",defaultMatchMode:N["transient-mass"],options:u},{id:"stars",title:"Stars",defaultMatchMode:N.stars,options:b},{id:"planets",title:"Planets",defaultMatchMode:N.planets,options:S},{id:"moons",title:"Moons",defaultMatchMode:N.moons,options:C},{id:"system-features",title:"System Features",defaultMatchMode:N["system-features"],options:M}]}function ke(e){const a=new Map;for(const s of e)for(const o of s.orbitalZoneIds)a.set(o,(a.get(o)??0)+1);const t=new Map(be.map(s=>[s.label,s.color]));return ne.map(s=>({id:`orbital-zone:${s.id}`,section:"orbital-zones",label:s.short,value:s.id,count:a.get(s.id)??0,color:t.get(s.group),group:s.group,detail:s.label,predicate:o=>o.orbitalZoneIds.has(s.id)}))}function $e(e){return[...Ae,...Ee].map(a=>({id:`count:${a.id}`,section:"zone-moon-counts",label:a.label,value:a.id,count:e.reduce((t,s)=>t+(ee(s,a)?1:0),0),color:a.color,group:a.group,predicate:t=>ee(t,a)}))}function De(e){const a=s=>e.reduce((o,n)=>o+(s(n)?1:0),0);return[{label:"Natural World",value:"world-family:natural",predicate:s=>s.hasNaturalFamily},{label:"Broken World",value:"world-family:broken",predicate:s=>s.hasBrokenFamily},{label:"Transitional World",value:"world-family:transitional",predicate:s=>s.hasTransitionalFamily}].map(s=>({...s,id:s.value,section:"world-family",count:a(s.predicate)}))}function Ze(e){const a=r=>e.reduce((m,u)=>m+(r(u)?1:0),0),t=new Set;for(const r of e)for(const m of r.landscapeZoneTags)t.add(m);const s=_e.filter(r=>t.has(r)).map(r=>te(r,e)),o=Array.from(t).filter(r=>r.trim().toLowerCase().endsWith("host")).sort((r,m)=>Z(m,e)-Z(r,e)||r.localeCompare(m)).map(r=>te(r,e));return[...[{label:"Danger Tagged or Danger Level > 0",value:"landscape-signal:danger-tagged",predicate:r=>r.hasNonZeroDangerLevelTag}].map(r=>({...r,id:r.value,section:"landscape-signals",count:a(r.predicate)})),...s,...o]}function te(e,a){return{id:`landscape-tag:${e}`,section:"landscape-signals",label:Te(e),value:e,count:Z(e,a),predicate:t=>t.landscapeZoneTags.has(e)}}function Z(e,a){return a.reduce((t,s)=>t+(s.landscapeZoneTags.has(e)?1:0),0)}function Pe(e){const a=new Set([...Object.keys(A).map(Number),...e.map(t=>t.nebulaId).filter(t=>t!==null)]);return Array.from(a).filter(Number.isFinite).sort((t,s)=>O(A,t,"Nebula").localeCompare(O(A,s,"Nebula"))).map(t=>{const s=O(A,t,"Nebula");return{id:`nebula-type:${t}`,section:"nebula-types",label:s,value:`nebula-type:${t}`,count:e.reduce((o,n)=>o+(n.nebulaId===t?1:0),0),color:ie(Se[t]),detail:`ID ${t}`,predicate:o=>o.nebulaId===t}})}function Be(e){const a=new Set([...Object.keys(E).map(Number),...e.map(t=>t.ancientCivilizationId).filter(t=>t!==null)]);return Array.from(a).filter(Number.isFinite).sort((t,s)=>O(E,t,"Civilization").localeCompare(O(E,s,"Civilization"))).map(t=>{const s=O(E,t,"Civilization");return{id:`ancient-civilization:${t}`,section:"ancient-civilizations",label:s,value:`ancient-civilization:${t}`,count:e.reduce((o,n)=>o+(n.ancientCivilizationId===t?1:0),0),color:ie(Ne[t]),detail:`ID ${t}`,predicate:o=>o.ancientCivilizationId===t}})}const Re=[{state:"PRISTINE",label:"Pristine",color:"#9ecfff",help:"Untouched systems with no recorded settlement history."},{state:"SETTLED",label:"Settled",color:"#e8c47a",help:"Systems the extinct civilizations settled, per the in-game classification."},{state:"DEVASTATED",label:"Devastated",color:"#e86a4a",help:"Systems the in-game classification marks as devastated."}];function He(e){return Re.map(a=>({id:`system-state:${a.state.toLowerCase()}`,section:"system-state",label:a.label,value:`system-state:${a.state.toLowerCase()}`,count:e.reduce((t,s)=>t+(s.systemState===a.state?1:0),0),color:a.color,help:a.help,predicate:t=>t.systemState===a.state}))}function Ke(e){return[1,2,3,4,5].map(a=>({id:`transient-mass:${a}`,section:"transient-mass",label:ge[a]??`Tier ${a}`,value:`transient-mass:${a}`,count:e.reduce((t,s)=>t+(s.transientMassBucket===a?1:0),0),color:"#d8b878",detail:`Tier ${a}/5`,help:"In-game Transient Mass tier (remnant dust + gas mass, bucketed like the in-game System Resource Potential meter).",predicate:t=>t.transientMassBucket===a}))}let $=null,x=null,D="";async function Ue(e){const a=We(e.mapData,e.stationSystemIds);return $&&D===a?$:(x&&D===a||(D=a,x=Ge(e).then(t=>($=t,x=null,t)).catch(t=>{throw x=null,t})),x)}function le(e){return Object.values(e).some(a=>a&&a.size>0)}function Ye(e,a,t={}){if(!le(a))return new Set;const s=new Map;for(const n of e.sections)s.set(n.id,new Map(n.options.map(l=>
2[l.value,l])));const o=new Set;for(const n of e.entries){let l=!0;for(const r of e.sections){const m=a[r.id];if(!m||m.size===0)continue;const u=s.get(r.id),b=t[r.id]??r.defaultMatchMode;let S;if(b==="all"&&r.id==="zone-moon-counts"){const C=new Map;for(const M of m){const f=M.split(":")[0];C.set(f,[...C.get(f)??[],M])}S=!0;for(const M of C.values()){let f=!1;for(const I of M)if(u?.get(I)?.predicate(n)){f=!0;break}if(!f){S=!1;break}}}else if(b==="all"){S=!0;for(const C of m)if(!u?.get(C)?.predicate(n)){S=!1;break}}else{S=!1;for(const C of m)if(u?.get(C)?.predicate(n)){S=!0;break}}if(!S){l=!1;break}}l&&o.add(n.systemId)}return o}function We(e,a){return[Object.keys(e.solar_systems).length,Object.keys(e.stargates).length,a?.size??0].join(":")}async function Ge(e){const a=await Ce(e.onProgress),t=xe(e.mapData,e.stationSystemIds);Oe(t,e.mapData),Ie(t,a);const s=Array.from(t.values()).sort((n,l)=>n.name.localeCompare(l.name)),o=Le(s,a);return{entries:s,entryBySystemId:t,sections:o,builtAt:Date.now(),stats:{indexedSystems:s.length,orbitalZoneOptions:o.find(n=>n.id==="orbital-zones")?.options.length??0,zoneMoonCountOptions:o.find(n=>n.id==="zone-moon-counts")?.options.length??0,worldFamilyOptions:o.find(n=>n.id==="world-family")?.options.length??0,landscapeSignalOptions:o.find(n=>n.id==="landscape-signals")?.options.length??0,nebulaTypeOptions:o.find(n=>n.id==="nebula-types")?.options.length??0,ancientCivilizationOptions:o.find(n=>n.id==="ancient-civilizations")?.options.length??0,systemStateOptions:o.find(n=>n.id==="system-state")?.options.length??0,transientMassOptions:o.find(n=>n.id==="transient-mass")?.options.length??0,starTypeOptions:o.find(n=>n.id==="stars")?.options.length??0,planetTypeOptions:o.find(n=>n.id==="planets")?.options.length??0,moonTypeOptions:o.find(n=>n.id==="moons")?.options.length??0,systemFeatureOptions:o.find(n=>n.id==="system-features")?.options.length??0,landscapeSummarySystems:a.landscapeSummaries.size,stationSystems:e.stationSystemIds?.size??0}}}const qe=4,B="ef.systemFinder.sectionOpenState.v1",Ve={"orbital-zones":"systemFinder.sectionSummary.orbitalZones","zone-moon-counts":"systemFinder.sectionSummary.zoneMoonCounts","world-family":"systemFinder.sectionSummary.worldFamily","landscape-signals":"systemFinder.sectionSummary.landscapeSignals","nebula-types":"systemFinder.sectionSummary.nebulaTypes","ancient-civilizations":"systemFinder.sectionSummary.ancientCivilizations","system-state":"systemFinder.sectionSummary.systemState","transient-mass":"systemFinder.sectionSummary.transientMass",stars:"systemFinder.sectionSummary.stars",planets:"systemFinder.sectionSummary.planets",moons:"systemFinder.sectionSummary.moons","system-features":"systemFinder.sectionSummary.systemFeatures"},Je=e=>{const a={};for(const[t,s]of Object.entries(e))s.size>0&&(a[t]=new Set(s));return a},Qe=()=>{if(typeof window>"u")return{};try{const e=window.localStorage.getItem(B);if(!e)return{};const a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[s,o]of Object.entries(a))typeof o=="boolean"&&(t[s]=o);return t}catch{return{}}},Xe=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(B,JSON.stringify(e))}catch{}},et=(e,a)=>a("systemFinder.results.distanceLy",{value:e.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}),se=(e,a)=>a[e.id]??e.defaultMatchMode,tt=(e,a)=>e.id==="stars"?a.value:a.label,st=(e,a,t,s)=>{if(!a||a.size===0)return null;const o=e.options.filter(m=>a.has(m.value));if(o.length===0)return null;const n=s(Ve[e.id]),l=s(t==="all"?"systemFinder.matchMode.allUpper":"systemFinder.matchMode.anyUpper"),r=o.length>qe?s("systemFinder.querySummary.selectedCount",{count:o.length}):o.map(m=>tt(e,m)).join(", ");return s("systemFinder.querySummary.chip",{section:n,mode:l,selection:r})},ct=({mapData:e,stationSystemIds:a,selectedSystem:t,onMatchesChange:s,onSelectSystem:o})=>{const{t:n}=P(),[l,r]=y.useState(null),[m,u]=y.useState("idle"),[b,S]=y.useState(null),[C,M]=y.useState(""),[f,I]=y.useState({}),[F,R]=y.useState({}),[L,H]=y.useState(()=>Qe()),[ce,K]=y.useState(!1),[z,de]=y.useState(""),[w,U]=y.useState(!1),[Y,k]=y.useState(null),W=y.useCallback(async()=>{const c=z.trim();if(!(!c||!l||w)){U(!0),k(null);try{const{askFinderAssist:d}
2=await J(async()=>{const{askFinderAssist:g}=await import("./finderAssist-DGqy8FTE.js");return{askFinderAssist:g}},__vite__mapDeps([0,1,2,3,4])),{applied:p,note:h}=await d(l,c,n);p&&(I(p.filters),R(p.matchModes),H(()=>{const g={};for(const he of p.sections)g[he]=!0;try{localStorage.setItem(B,JSON.stringify(g))}catch{}return g})),k(h)}catch(d){k(d instanceof Error?d.message:String(d))}finally{U(!1)}}},[z,l,w,n]);y.useEffect(()=>{let c=!1;if(!e){r(null),u("idle");return}return u("loading"),M(""),Ue({mapData:e,stationSystemIds:a,onProgress:d=>{c||S(d)}}).then(d=>{c||(r(d),u("ready"),S(100))}).catch(d=>{c||(r(null),u("error"),M(d instanceof Error?d.message:""))}),()=>{c=!0}},[e,a]),y.useEffect(()=>{Xe(L)},[L]);const G=y.useMemo(()=>Object.values(f).reduce((c,d)=>c+(d?.size??0),0),[f]),j=y.useMemo(()=>l?Ye(l,f,F):new Set,[f,l,F]),v=le(f),q=y.useMemo(()=>!l||!v?[]:l.sections.map(c=>st(c,f[c.id],se(c,F),n)).filter(c=>!!c),[f,v,l,F,n]);y.useEffect(()=>{s(j)},[j,s]),y.useEffect(()=>()=>{s(new Set)},[s]);const T=ce&&!!t&&!!e,_=y.useMemo(()=>{if(!l||!v)return[];const c=Array.from(j).map(d=>l.entryBySystemId.get(d)).filter(d=>!!d);if(T&&t&&e){const d=t.position;return c.map(p=>{const h=e.solar_systems[String(p.systemId)]?.position,g=h?Math.hypot(h.x-d.x,h.y-d.y,h.z-d.z):Number.POSITIVE_INFINITY;return{entry:p,distanceLy:g}}).sort((p,h)=>p.distanceLy-h.distanceLy||p.entry.name.localeCompare(h.entry.name))}return c.sort((d,p)=>d.name.localeCompare(p.name)).map(d=>({entry:d,distanceLy:null}))},[T,v,l,e,j,t]),me=y.useCallback((c,d)=>{I(p=>{const h=Je(p),g=h[c]??new Set;return g.has(d)?g.delete(d):g.add(d),g.size>0?h[c]=g:delete h[c],h})},[]),ue=y.useCallback(()=>{I({})},[]),ye=y.useCallback((c,d)=>{R(p=>p[c]===d?p:{...p,[c]:d})},[]),pe=y.useCallback((c,d)=>{H(p=>p[c]===d?p:{...p,[c]:d})},[]),fe=n("systemFinder.summary.systemCount",{count:v?j.size.toLocaleString():"0"});return i.jsxs("div",{className:"system-finder-panel",children:[m==="ready"&&l&&i.jsxs("div",{className:"system-finder-ask",children:[i.jsxs("div",{className:"system-finder-ask-row",children:[i.jsx("input",{className:"system-finder-ask-input",type:"text",placeholder:n("systemFinder.ask.placeholder"),maxLength:300,value:z,onChange:c=>de(c.target.value),onKeyDown:c=>{c.key==="Enter"&&W()},disabled:w,"aria-label":n("systemFinder.ask.ariaLabel")}),i.jsx("button",{type:"button",className:"system-finder-ask-btn",onClick:()=>{W()},disabled:w||!z.trim(),children:n(w?"systemFinder.ask.thinking":"systemFinder.ask.submit")})]}),Y&&i.jsx("p",{className:"system-finder-ask-note",children:Y}),i.jsxs("p",{className:"system-finder-ask-hint",children:[n("systemFinder.ask.hint.before"),i.jsx("button",{type:"button",className:"system-finder-ask-link",onClick:()=>{J(()=>import("./finderAssist-DGqy8FTE.js"),__vite__mapDeps([0,1,2,3,4])).then(c=>c.downloadFinderBriefing(l))},children:n("systemFinder.ask.hint.link")}),n("systemFinder.ask.hint.after")]})]}),i.jsxs("div",{className:"system-finder-summary",children:[i.jsxs("div",{className:"system-finder-count",children:[i.jsx("span",{className:"system-finder-count-value",children:fe}),i.jsxs("span",{className:"system-finder-count-meta",children:[G,n("systemFinder.summary.filterCountSuffix")]}),i.jsx("div",{className:`system-finder-query-summary ${v?"":"is-empty"}`,"aria-label":n("systemFinder.summary.queryAriaLabel"),children:q.length>0?q.map(c=>i.jsx("span",{className:"system-finder-query-chip",children:c},c)):i.jsx("span",{children:n("systemFinder.summary.noQuery")})})]}),i.jsxs("button",{type:"button",className:"system-finder-clear",onClick:ue,disabled:G===0,children:[i.jsx(Me,{size:14,"aria-hidden":"true"}),i.jsx("span",{children:n("systemFinder.summary.clear")})]})]}),m==="loading"&&i.jsx("div",{className:"system-finder-state",children:typeof b=="number"&&b<100?n("systemFinder.state.loadingWithProgress",{percent:b}):n("systemFinder.state.loading")}),m==="error"&&i.jsx("div",{className:"system-finder-state system-finder-state--error",children:C||n("systemFinder.state.unavailable")}),m==="ready"&&l&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"system-finder-sections",children:l.sections.map(c=>i.jsx(nt,{section:c,activeValues:f[c.id]??new Set,matchMode:se(c,F),open:L[c.id]??!1,onToggle:me,onMatchModeChange:ye,onOpenChange:pe},c.id))}),v&&i.jsxs("div",{className:"system-finder-results",children:[i.jsxs("div",{className:"system-finder-results-header",children:[i.jsx("div",{className:"system-finder-results-title",children:n("systemFinder.results.title")}),i.jsxs("div",{className:"system-finder-match-mode","aria-label":n("systemFinder.results.sortAriaLabel"),children:[i.jsx("span",{className:"system-finder-match-label",children:n("systemFinder.results.sortL
2abel")}),i.jsx("button",{type:"button",className:`system-finder-match-button ${T?"":"is-active"}`,"aria-pressed":!T,onClick:()=>K(!1),children:n("systemFinder.results.sortName")}),i.jsx("button",{type:"button",className:`system-finder-match-button ${T?"is-active":""}`,"aria-pressed":T,disabled:!t,title:t?n("systemFinder.results.sortDistanceTitle",{name:t.name}):n("systemFinder.results.sortDistanceDisabledTitle"),onClick:()=>K(!0),children:n("systemFinder.results.sortDistance")})]})]}),_.length===0?i.jsx("div",{className:"system-finder-empty",children:n("systemFinder.results.empty")}):i.jsxs("div",{className:"system-finder-results-list",children:[_.slice(0,100).map(({entry:c,distanceLy:d})=>i.jsxs("button",{type:"button",className:"system-finder-result-row",onClick:()=>o?.(c.systemId),children:[i.jsxs("span",{className:"system-finder-result-topline",children:[i.jsx("span",{className:"system-finder-result-name",children:c.name}),d!==null&&Number.isFinite(d)&&i.jsx("span",{className:"system-finder-result-distance",children:et(d,n)})]}),i.jsx("span",{className:"system-finder-result-meta",children:[c.regionName,c.constellationName].filter(Boolean).join(" / ")})]},c.systemId)),_.length>100&&i.jsx("div",{className:"system-finder-result-more",children:n("systemFinder.results.more",{count:(_.length-100).toLocaleString()})})]})]})]})]})},nt=({section:e,activeValues:a,matchMode:t,open:s,onToggle:o,onMatchModeChange:n,onOpenChange:l})=>{const{t:r}=P(),m=a.size;return i.jsxs("section",{className:`system-finder-section ${s?"is-open":""}`,children:[i.jsxs("div",{className:"system-finder-section-header",children:[i.jsxs("button",{type:"button",className:"system-finder-section-toggle",onClick:()=>l(e.id,!s),"aria-expanded":s,children:[i.jsx("span",{className:`system-finder-section-caret ${s?"is-open":""}`,"aria-hidden":"true",children:">"}),i.jsx("span",{children:e.title})]}),i.jsxs("div",{className:"system-finder-section-actions",children:[i.jsxs("div",{className:"system-finder-match-mode","aria-label":r("systemFinder.section.matchModeAriaLabel",{section:e.title}),children:[i.jsx("span",{className:"system-finder-match-label",children:r("systemFinder.section.matchLabel")}),["any","all"].map(u=>i.jsx("button",{type:"button",className:`system-finder-match-button ${t===u?"is-active":""}`,"aria-pressed":t===u,onClick:b=>{b.stopPropagation(),n(e.id,u)},children:r(u==="any"?"systemFinder.section.matchAny":"systemFinder.section.matchAll")},u))]}),i.jsx("span",{className:"system-finder-section-meta",children:m>0?m:e.options.length})]})]}),i.jsx(ve,{open:s,children:i.jsx("div",{className:"system-finder-options",children:e.options.length===0?i.jsx("div",{className:"system-finder-empty",children:r("systemFinder.section.noData")}):e.options.map(u=>i.jsx(at,{option:u,checked:a.has(u.value),onToggle:o},u.id))})})]})},at=({option:e,checked:a,onToggle:t})=>{const{t:s}=P(),o=e.help??e.detail;return i.jsxs("label",{className:`system-finder-option ${a?"is-active":""}`,title:o,children:[i.jsx("input",{type:"checkbox",checked:a,onChange:()=>t(e.section,e.value),"aria-label":e.help?s("systemFinder.option.ariaWithHelp",{label:e.label,help:e.help}):e.label,title:o}),i.jsx("span",{className:`system-finder-swatch ${e.color?"":"system-finder-swatch--empty"}`,style:e.color?{backgroundColor:e.color,color:e.color}:void 0,"aria-hidden":"true"}),i.jsxs("span",{className:"system-finder-option-label",children:[i.jsx("span",{className:"system-finder-option-name",children:e.label}),e.group&&i.jsx("span",{className:"system-finder-option-group",children:e.group}),!e.group&&e.detail&&i.jsx("span",{className:"system-finder-option-group",children:e.detail})]}),i.jsx("span",{className:"system-finder-option-count",children:e.count.toLocaleString()})]})};export{ct 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.