1import{o as e,c as a,b as t,F as s,f as l,K as r,w as o,t as i,d as n,u,i as d,U as c,a4 as v,e as m,af as h,aW as p,a0 as f,R as y,aa as g,O as w,S as x,bg as _,E as b,ad as q,r as k,Q as S,W as j,J as F,bh as R,bi as C,aX as E,bj as L,D as K,C as I,T as M}from"./index-CcZ45_S5.js";import{S as T}from"./SearchForm-BO2fa65f.js";import{n as W,a as A,b as J,S as N,g as O,c as $}from"./SearchResults-BWz1UAml.js";import{F as D}from"./index.es-0vjt-INv.js";import{a as P,b as Q,g as z}from"./locationFormatters-B5SIoJWC.js";import{u as H}from"./useQueryClient-D_RWsVuD.js";import{u as G}from"./useQuery-CfbMjajd.js";import{u as U}from"./useMutation-Ca8CgNX9.js";import{g as B,a as X}from"./locations-9kelygEn.js";import{s as V,b as Y,c as Z,f as ee}from"./search-CcyELERH.js";import{u as ae}from"./search-CuDkYLOj.js";import{P as te,e as se,S as le,c as re,D as oe}from"./queryKeys-DpAWY-q4.js";import{T as ie}from"./test-ids-C_9vcHPk.js";import{_ as ne}from"./_plugin-vue_export-helper-BCo6x5W8.js";import"./typeahead-BamTYUl9.js";import"./searchParams-C9f9AeG4.js";const ue={class:"grid grid-cols-3 gap-4 relative overflow-y-scroll max-h-[40vh]"},de={key:0,class:"col-span-3 text-neutral-500 text-left"},ce={key:1,class:"col-span-3 text-neutral-500 text-left"},ve={key:2,class:"col-span-3 grid grid-cols-subgrid justify-center sticky top-0 bg-neutral-50 p-2"},me={class:"text-left"},he={class:"text-left"},pe={key:0},fe={class:"text-right"},ye=["href"],ge={__name:"Requests",props:{requests:Array,error:Boolean},setup:f=>(y,g)=>{var w;return e(),a("div",ue,[f.error?(e(),a("p",de," Error loading requests, please try again later ")):f.error||(null==(w=f.requests)?void 0:w.length)?(e(),a("div",ve,[...g[2]||(g[2]=[t("h4",{class:"text-left m-0"},"Request Title",-1),t("h4",{class:"text-left m-0"},"Location",-1),t("h4",{class:"text-right m-0"},"Details",-1)])])):(e(),a("p",ce," No requests found ")),(e(!0),a(s,null,l(f.requests,f=>(e(),r(u(p),{key:f.id,to:`/data-requests/${f.id}`,class:"col-span-3 grid grid-cols-subgrid gap-4 p-2 border-solid border-neutral-300 border-2 rounded-sm [&>*]:text-sm [&>*]:md:text-med [&>*]:lg:text-lg text-neutral-950 hover:bg-neutral-100"},{default:o(()=>[t("p",me,i(f.title),1),t("div",he,[(e(!0),a(s,null,l(f.locations,(t,s)=>(e(),a("p",{key:t.id},[n(i(u(P)(t))+" ",1),s!==f.locations.length-1?(e(),a("span",pe,"â¢")):d("",!0)]))),128))]),t("div",fe,[f.github_issue_url?(e(),a("a",{key:0,href:f.github_issue_url,target:"_blank",rel:"noopener noreferrer",onKeydown:g[0]||(g[0]=v(c(()=>{},["stop"]),["enter"])),onClick:g[1]||(g[1]=c(()=>{},["stop"]))},[m(u(D),{icon:u(h)},null,8,["icon"]),g[3]||(g[3]=n(" GitHub ",-1))],40,ye)):d("",!0)])]),_:2},1032,["to"]))),128))])}};const we={class:"grid grid-cols-1 grid-rows-[auto_1fr] xl:grid-cols-[1fr_340px] gap-4 max-w-[1800px] mx-auto"},xe={class:"w-full row-start-0 row-end-1 xl:col-start-2 xl:col-end-3 relative"},_e={key:0,class:"max-h-[900px] overflow-hidden mb-8"},be={class:"@container"},qe={class:"w-full h-full"},ke={class:"grid grid-cols-1 md:grid-cols-[1fr,auto] md:grid-rows-[repeat(3,35px)]"},Se={class:"text-3xl mb-4"},je={key:0,class:"flex flex-col md:items-end md:row-start-1 md:row-span-2 md:col-start-2 md:col-span-1"},Fe={key:0,class:"text-med text-neutral-500"},Re={key:1,class:"flex flex-col md:items-end md:max-w-80"},Ce={key:0,class:"text-med text-neutral-500 max-w-full md:text-right"},Ee={key:1,class:"flex gap-2 mb-4 [&>*]:text-[.72rem] [&>*]:xs:text-med [&>*]:sm:text-lg md:col-start-1 md:col-span-1 md:row-start-2 md:row-span-2 justify-baseline mt-2"},Le={key:0},Ke={key:0},Ie={key:0,class:"like-h4"},Me=ne({__name:"results",setup(c){const v=ae(),h=f(),p=y(),ne=g(),ue=K(),de=K(!1),ce=M({width:window.innerWidth,height:window.innerHeight}),ve=K(new Map),me=H(),he=I(()=>({location_id:p.query.location_id,record_categories:p.query.record_categories,record_types:p.query.record_types})),pe=I(()=>[re,he.value]),fe=I(()=>[le,he.value]),ye=I(()=>[oe,he.value]),{isLoading:Me,isFetching:Te,data:We,error:Ae}=G({queryKey:pe,queryFn:async()=>{const e=await async function(e){const a=e.query.location_id?await B(e.query.location_id):void 0,t=(null==a?void 0:a.data)??null,s=Q(t),l=await V(e.query);return{response:l.data,searched:s,location:t,hash:W(s,l.data)}}(p);
1return me.invalidateQueries({queryKey:[te]}),e},staleTime:3e5,onError:e=>{var a,t;e&&(b.error(`Error fetching search results for ${z(null==(a=null==We?void 0:We.value)?void 0:a.location)}. Please try again!`,{autoClose:!1,onClose(){de.value=!0}}),ve.value.set(JSON.stringify(null==(t=null==We?void 0:We.value)?void 0:t.location),!0))}}),{isLoading:Je,isFetching:Ne,data:Oe,error:$e}=G({queryKey:[se],queryFn:()=>Z(),staleTime:9e5}),{isLoading:De,isFetching:Pe,data:Qe,isError:ze}=G({queryKey:fe,queryFn:()=>async function(e){try{return!!(await Y(e.query.location_id))}catch{return!1}}(p),staleTime:3e5}),{isLoading:He,isFetching:Ge,data:Ue,error:Be}=G({queryKey:ye,queryFn:()=>async function(e){if(e.query.location_id)return(await X(e.query.location_id)).data.data;return null}(p),staleTime:3e5,onSuccess:e=>{(null==e?void 0:e.length)&&v.setMostRecentRequestIds(e.map(e=>e.id))}}),Xe=U({mutationFn:async()=>{var e;await ee(p.query.location_id),b.success(`Search followed for ${z(null==(e=null==We?void 0:We.value)?void 0:e.location)}.`)},onSuccess:()=>{me.invalidateQueries({queryKey:[le]}),me.invalidateQueries({queryKey:[te]})},onError:()=>{var e;b.error(`Error following search for ${z(null==(e=null==We?void 0:We.value)?void 0:e.location)}. Please try again.`)}}),Ve=I(()=>Me.value||Je.value),Ye=I(()=>Te.value||Ne.value),Ze=I(()=>Ae.value||$e.value),ea=I(()=>{var e,a;const t=null==(e=We.value)?void 0:e.response,s=null==(a=Oe.value)?void 0:a.data;if(!t)return null;const l=JSON.parse(JSON.stringify(t)),r=JSON.parse(JSON.stringify(s||{}));return l.count=(l.count||0)+(r.count||0),l.data.federal=r,O(l)});function aa(){window.innerWidth!==ce.width&&(window.innerWidth>1280?de.value=!0:de.value=!1,ce.value={width:window.innerWidth,height:window.innerHeight})}function ta(){window.innerWidth<1280&&(de.value=!1)}return w(ea,e=>{e&&v.setMostRecentSearchIds(A(e))}),w(()=>p.query.location_id,e=>{e!==v.activeLocationId&&v.setActiveLocationId(e)},{immediate:!0}),w(()=>{var e;return null==(e=We.value)?void 0:e.location},e=>{e&&v.setActiveLocation(e)},{immediate:!0}),w(()=>ea.value,e=>{if(e&&!p.hash){const a=$(e);a&&ne.replace({...p,hash:a})}},{immediate:!0}),x(()=>{window.innerWidth>1280&&(de.value=!0),(null==ea?void 0:ea.value)&&v.setMostRecentSearchIds(A(ea.value)),(null==Ue?void 0:Ue.value)&&v.setMostRecentRequestIds(Ue.value.map(e=>e.id)),window.addEventListener("resize",aa)}),_(async()=>{var e,a;Ae.value&&(b.error(`Error fetching search results for ${z(null==(e=null==We?void 0:We.value)?void 0:e.location)}. Please try again!`,{autoClose:!1,onClose(){de.value=!0}}),ve.value.set(JSON.stringify(null==(a=null==We?void 0:We.value)?void 0:a.location),!0)),ea.value&&v.setMostRecentSearchIds(A(ea.value)),(null==Ue?void 0:Ue.value)&&v.setMostRecentRequestIds(Ue.value.map(e=>e.id))}),q(()=>{ve.value.clear(),window.removeEventListener("resize",aa)}),(c,v)=>{var f,y;const g=k("RouterLink"),w=k("LoadingSpinner");return e(),a("main",we,[t("aside",xe,[m(u(S),{class:"mb-2 w-full xl:hidden","data-test":u(ie).search_toggle,intent:"primary",onClick:v[0]||(v[0]=e=>de.value=!de.value)},{default:o(()=>[n(i(de.value?"Hide search":"Show search"),1)]),_:1},8,["data-test"]),m(j,null,{default:o(()=>{var s;return[de.value?(e(),a("div",_e,[t("div",be,[m(T,{placeholder:(null==(s=u(We))?void 0:s.location)?u(P)(u(We).location):"Enter a place","button-copy":"Update search",onSearched:ta},null,8,["placeholder"])])])):d("",!0)]}),_:1})]),t("section",qe,[t("div",ke,[t("h1",Se," Data "+i((null==(f=u(We))?void 0:f.location)&&!Ve.value&&"about "+u(P)(u(We).location)),1),u(De)||u(ze)?d("",!0):(e(),a("div",{key:0,class:F({"loading-shimmer":u(Pe)})},[u(Qe)?(e(),a("div",Re,[u(h).isAuthenticated()?(e(),a("p",Ce,[m(u(D),{class:"[&>svg]:m-0",icon:u(C)},null,8,["icon"]),v[6]||(v[6]=n(" Following this location ",-1)),v[7]||(v[7]=t("br",null,null,-1)),v[8]||(v[8]=n(" See ",-1)),m(g,{to:"/profile"},{default:o(()=>[...v[5]||(v[5]=[n("your profile",-1)])]),_:1}),v[9]||(v[9]=n(" for more. ",-1))])):d("",!0)])):(e(),a("div",je,[m(u(S),{disabled:!u(h).isAuthenticated(),class:"sm:block max-h-12",intent:"primary",onClick:v[1]||(v[1]=()=>{u(Xe).mutate()})},{default:o(()=>[m(u(D),{class:"[&>svg]:m-0",icon:u(R)},null,8,["icon"]),v[2]||(v[2]=n(" Follow ",-1))]),_:1},8,["disabled"]),u(h).isAuthenticated()?d("",!0):(e(),a("p",Fe,[m(g,{to:"/sign-in"},{default:o(()=>[...v[3]||(v[3]=[n("Sign in",-1)])]),_:1}),v[4]||(v[4]=n(" to follow this location ",-1))]))]))],2)),!Ze.value&&ea.value?(e(),a("nav",Ee,[v[10]||(v[10]=t("span",{class:"font-semibold text-neutral-600 dar
1k:text-neutral-300 border-2 border-transparent px-0 py-2"}," Geographic level: ",-1)),(e(!0),a(s,null,l(u(E),t=>{var s,l;return e(),r(g,{key:`${t} anchor`,class:F([{"text-goldneutral-500 pointer-events-none cursor-auto":!(null==(l=null==(s=ea.value)?void 0:s[t])?void 0:l.count)},"capitalize border-2 border-transparent p-2"]),to:{...u(p),hash:`#${t}`},replace:"",onClick:()=>u(p).hash.includes(t)&&ue.value.handleScrollTo()},{default:o(()=>{var s,l,r;return[n(i(u(J)(t))+" ",1),(null==(l=null==(s=ea.value)?void 0:s[t])?void 0:l.count)?(e(),a("span",Le," ("+i(null==(r=ea.value)?void 0:r[t].count)+") ",1)):d("",!0)]}),_:2},1032,["class","to","onClick"])}),128))])):d("",!0)]),(e(),r(L,null,{default:o(()=>[m(N,{ref_key:"searchResultsRef",ref:ue,results:ea.value,"is-loading":Ve.value||Ye.value},null,8,["results","is-loading"])]),fallback:o(()=>[m(w)]),_:1})),(null==(y=u(We))?void 0:y.location)?(e(),a("div",Ke,[u(We)?(e(),a("h2",Ie," Data requested about "+i(u(P)(u(We).location)),1)):d("",!0),m(ge,{class:F({"loading-shimmer":u(Ge)||u(He)}),requests:u(Ue),error:!!u(Be)},null,8,["class","requests","error"])])):d("",!0)])])}}},[["__scopeId","data-v-3c959b37"]]);export{Me 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.