1import{W as q,r as o,j as e,aq as Z,B as y,C as n,b as i,d as c,f as G,g as H,h as Y,x as Q,a as w,z as S,M as E,L as T}from"./index-Do7gCgTf.js";import{S as K,C as A,F as V}from"./separator-DC-q8O1p.js";import{g as W,E as z}from"./useEnvironmentalLayers-DSKsQLHx.js";import{A as J}from"./arrow-left-CSAX1adD.js";import{D as u,E as C,Z as F,a as X,C as D}from"./zap-BcqC4-X-.js";import{C as x,T as h,R as $,a as I,F as ee}from"./triangle-alert-dkNl1DfS.js";import{G as R}from"./globe-D4UjWWDL.js";const de=()=>{const U=q(),[d,k]=o.useState([]),[se,g]=o.useState(!0),[N,b]=o.useState(null),O=()=>{const s=[];s.push({id:"hifld-substations",name:"HIFLD Electric Substations",description:"Homeland Infrastructure Foundation-Level Data for electric substations including voltage ratings, ownership, and status.",category:"infrastructure",provider:"DHS/HIFLD",url:"https://hifld-geoplatform.opendata.arcgis.com/datasets/electric-substations",updateFrequency:"Monthly",lastUpdated:"2024-12-01",icon:e.jsx(F,{className:"w-5 h-5 text-amber-500"}),apiType:"REST",cacheKey:"hifld",apiEndpoint:"https://services1.arcgis.com/Hp6G80Pky0om7QvQ/arcgis/rest/services/Electric_Substations/FeatureServer/0",dataFields:["NAME","CITY","STATE","ZIP","TYPE","STATUS","COUNTY","COUNTYFIPS","COUNTRY","NAESSION","MAX_VOLT","MIN_VOLT"]},{id:"hifld-transmission",name:"HIFLD Transmission Lines",description:"High-voltage electric transmission line routes with voltage class, ownership, and operational status.",category:"infrastru
1cture",provider:"DHS/HIFLD",url:"https://hifld-geoplatform.opendata.arcgis.com/datasets/electric-power-transmission-lines",updateFrequency:"Monthly",lastUpdated:"2024-12-01",icon:e.jsx(F,{className:"w-5 h-5 text-yellow-500"}),apiType:"REST",cacheKey:"hifld",apiEndpoint:"https://services1.arcgis.com/Hp6G80Pky0om7QvQ/arcgis/rest/services/Electric_Power_Transmission_Lines/FeatureServer/0",dataFields:["ID","TYPE","STATUS","NAESSION","VOLTAGE","VOLT_CLASS","INFERRED","SUB_1","SUB_2","OWNER"]}),s.push({id:"report-all-parcels",name:"Report All USA Parcels",description:"Nationwide parcel boundary data with ownership, zoning, and assessment information.",category:"parcels",provider:"Report All USA",url:"https://reportallusa.com",updateFrequency:"Weekly",lastUpdated:null,icon:e.jsx(E,{className:"w-5 h-5 text-blue-500"}),apiType:"REST",cacheKey:"parcels",apiEndpoint:"https://reportallusa.com/api",dataFields:["APN","OWNER","ADDRESS","CITY","STATE","ZIP","ACRES","SQFT","LAND_USE","ZONING","ASSESSED_VALUE","MARKET_VALUE","YEAR_BUILT"]}),s.push({id:"census-tracts",name:"Census Tracts",description:"Census tract boundaries with GEOID and tract names for demographic analysis.",category:"boundaries",provider:"US Census Bureau",url:"https://www.census.gov/geographies/mapping-files/time-series/geo/cartographic-boundary.html",updateFrequency:"Annually",lastUpdated:"2024-01-01",icon:e.jsx(T,{className:"w-5 h-5 text-cyan-500"}),apiType:"REST",cacheKey:"boundaries",apiEndpoint:"https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Tracts_Blocks/MapServer/8/query",dataFields:["BASENAME","NAME","GEOID","TRACTCE","STATEFP","COUNTYFP"]},{id:"census-boundaries",name:"US Census Boundaries",description:"State, county, municipal, and census tract boundaries from the US Census Bureau.",category:"boundaries",provider:"US Census Bureau",url:"https://www.census.gov/geographies/mapping-files/time-series/geo/cartographic-boundary.html",updateFrequency:"Annually",lastUpdated:"2024-01-01",icon:e.jsx(R,{className:"w-5 h-5 text-green-500"}),apiType:"REST",cacheKey:"boundaries",apiEndpoint:"https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/tigerWMS_Current/MapServer",dataFields:["NAME","GEOID","AREALAND","AREAWATER","FUNCSTAT","LSAD"]},{id:"zip-codes",name:"ZIP Code Boundaries",description:"ZIP code tabulation areas (ZCTAs) with demographic overlay capabilities.",category:"boundaries",provider:"US Census Bureau",url:"https://www.census.gov/cgi-bin/geo/shapefiles/index.php?year=2023&layergroup=ZIP+Code+Tabulation+Areas",updateFrequency:"Annually",lastUpdated:"2024-01-01",icon:e.jsx(T,{className:"w-5 h-5 text-indigo-500"}),apiType:"REST",cacheKey:"zipCodes",apiEndpoint:"https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/PUMA_TAD_TAZ_UGA_ZCTA/MapServer/4/query",dataFields:["ZCTA5CE20","GEOID20","ALAND20","AWATER20"]},{id:"county-boundaries",name:"County Boundaries",description:"County and equivalent boundaries for the United States.",category:"boundaries",provider:"US Census Bureau",url:"https://www.census.gov/geographies/mapping-files/time-series/geo/cartographic-boundary.html",updateFrequency:"Annually",lastUpdated:"2024-01-01",icon:e.jsx(R,{className:"w-5 h-5 text-emerald-500"}),apiType:"REST",cacheKey:"counties",apiEndpoint:"https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/State_County/MapServer/1/query",dataFields:["NAME","GEOID","STATEFP","COUNTYFP","COUNTYNS","AREALAND","AREAWATER"]}),s.push({id:"opportunity-zones",name:"Qualified Opportunity Zones",description:"Federally designated Qualified Opportunity Zones (QOZs) with EPA-enhanced data including population, poverty rates, and investment status.",category:"boundaries",provider:"EPA / CDFI Fund / US Treasury",url:"https://www.cdfifund.gov/opportunity-zones",updateFrequency:"As designations change",lastUpdated:"2024-06-01",icon:e.jsx(E,{className:"w-5 h-5 text-teal-500"}),apiType:"REST",apiEndpoint:"https://services.arcgis.com/cJ9YHowT8TU7DUyn/arcgis/rest/services/Designated_QOZs_EPA_Enhancements/FeatureServer/0",dataFields:["GEOID","STATE","COUNTY","TRACT","Designated_QOZ","QOZ_Type","Total_Pop","Pov_Rate","Med_Inc_Pct","InvestmentFlag"]});const t={floodZones:e.jsx(X,{className:"w-5 h-5 text-blue-500"}),wetlands:e.jsx(V,{className:"w-5 h-5 text-teal-500"}),brownfields:e.jsx(ee,{className:"w-5 h-5 text-amber-700"}),superfund:e.jsx(D,{className:"w-5 h-5 text-red-500"}),toxicRelease:e.jsx(D,{className:"w-5 h-5 text-purple-500"})};return Object.entries(z).forEach(([a,r])=>{s.push({id:`env-${a}`,name:r.label,description:r.description,category:"environmental",provider:r.provider,url:r.sourceUrl,updateFrequency:r.updateFrequency,lastUpdated:null,icon:t[a],apiType:r.isWMS?"WMS":"REST",apiEndpoint:r.apiEndpoint,dataFields:r.dataFields})}),s.push({id:"mapbox-streets",name:"Mapbox Streets",description:"Vector street map tiles with detailed road network and POI data.",category:"basemaps",provider:"Mapbox",url:"https://www.mapbox.com/maps/streets",updateFrequency:"Continuous",lastUpdated:null,icon:e.jsx(S,{className:"w-5 h-5 text-sky-500"}),apiType:"Tiles"},{id:"mapbox-satellite",name:"Mapbox Satellite",description:"High-resolution satellite imagery with global coverage.",category:"basemaps",provider:"Mapbox",url:"https://www.mapbox.com/maps/satellite",updateFrequency:"Quarterly",lastUpdated:null,icon:e.jsx(S,{className:"w-5 h-5 text-green-600"}),apiType:"Tiles"}),s};o.useEffect(()=>{(async()=>{g(!0);try{const t=await W(),r=O().map(m=>{let j=0,f=null,p="unknown";if(m.cacheKey){const l=t.stats.find(v=>v.cacheType===m.cacheKey);
1l&&(j=l.itemCount,l.newestItemAge!==null&&(f=new Date(Date.now()-l.newestItemAge).toISOString(),p=l.newestItemAge<30*24*60*60*1e3?"active":"inactive"))}else p="active";return{...m,lastChecked:f,cachedItems:j,status:p}});k(r)}catch(t){console.error("Error loading source stats:",t),w.error("Failed to load source information")}finally{g(!1)}})()},[]);const _=async s=>{b(s),await new Promise(t=>setTimeout(t,2e3)),w.success("Data source refreshed"),b(null)},P=s=>{switch(s){case"infrastructure":return"bg-amber-500/10 text-amber-600 border-amber-500/20";case"boundaries":return"bg-green-500/10 text-green-600 border-green-500/20";case"parcels":return"bg-blue-500/10 text-blue-600 border-blue-500/20";case"environmental":return"bg-teal-500/10 text-teal-600 border-teal-500/20";case"basemaps":return"bg-sky-500/10 text-sky-600 border-sky-500/20";default:return"bg-muted text-muted-foreground"}},L=s=>{switch(s){case"active":return e.jsxs(c,{variant:"outline",className:"bg-green-500/10 text-green-600 border-green-500/20",children:[e.jsx(x,{className:"w-3 h-3 mr-1"}),"Active"]});case"inactive":return e.jsxs(c,{variant:"outline",className:"bg-amber-500/10 text-amber-600 border-amber-500/20",children:[e.jsx(h,{className:"w-3 h-3 mr-1"}),"Inactive"]});default:return e.jsxs(c,{variant:"outline",className:"bg-muted text-muted-foreground",children:[e.jsx(I,{className:"w-3 h-3 mr-1"}),"Unknown"]})}},M=d.reduce((s,t)=>(s[t.category]||(s[t.category]=[]),s[t.category].push(t),s),{}),B={infrastructure:"Infrastructure",boundaries:"Boundaries & Geography",parcels:"Parcel Data",environmental:"Environmental",basemaps:"Base Maps"};return e.jsxs(e.Fragment,{children:[e.jsxs(Z,{children:[e.jsx("title",{children:"Data Sources | Site Architect"}),e.jsx("meta",{name:"description",content:"View and manage external data sources including HIFLD infrastructure, parcel data, and boundary information."})]}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"sticky top-0 z-50 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 items-center gap-4 px-4",children:[e.jsxs(y,{variant:"ghost",size:"sm",onClick:()=>U("/app"),className:"gap-2",children:[e.jsx(J,{className:"w-4 h-4"}),"Back to Map"]}),e.jsx(K,{orientation:"vertical",className:"h-6"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"text-lg font-semibold",children:"Data Sources"})]})]})}),e.jsxs("main",{className:"container py-6 px-4 max-w-5xl",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-2",children:"External Data Sources"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage and monitor the external data sources that power Site Architect. Data is cached locally and refreshed according to each source's update schedule."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-8",children:[e.jsx(n,{children:e.jsx(i,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(u,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Data Sources"})]})]})})}),e.jsx(n,{children:e.jsx(i,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-green-500/10",children:e.jsx(x,{className:"w-5 h-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.filter(s=>s.status==="active").length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Sources"})]})]})})}),e.jsx(n,{children:e.jsx(i,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-amber-500/10",children:e.jsx(h,{className:"w-5 h-5 text-amber-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.filter(s=>s.status==="inactive").length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Inactive"})]})]})})}),e.jsx(n,{children:e.jsx(i,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:e.jsx(A,{className:"w-5 h-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:"30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Days Freshness"})]})]})})})]}),Object.entries(M).map(([s,t])=>e.jsxs("div",{className:"mb-8",children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(c,{variant:"outline",className:P(s),children:B[s]}),e.jsxs("span",{className:"text-sm text-muted-foreground font-normal",children:["(",t.length," sources)"]})]}),e.jsx("div",{className:"space-y-4",children:t.map(a=>e.jsx(n,{className:"overflow-hidden",children:e.jsx(i,{className:"p-0",children:e.jsxs("div",{className:"flex items-start gap-4 p-4",children:[e.jsx("div",{className:"p-3 rounded-lg bg-muted shrink-0",children:a.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[a.name,L(a.status)]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.description})]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>_(a.id),disabled:N===a.id,className:"shrink-0",children:[e.jsx($,{className:G("w-4 h-4 mr-1",N===a.id&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm mt-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Provider"}),e.jsx("span",{className:"font-medium",children:a.provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Update Frequency"}),e.jsx("span",{className:"font-medium",children:a.updateFrequency})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground block text-xs",children:"API Type"}),e.jsx(c,{variant:"outline",className:"text-xs",children:a.apiType||"Unknown"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Cached Items"}),e.jsx("span",{className:"font-medium",children:a.cachedItems.toLocaleStr
1ing()})]})]}),a.apiEndpoint&&e.jsxs("div",{className:"mt-4",children:[e.jsx("span",{className:"text-muted-foreground block text-xs mb-1",children:"API Endpoint"}),e.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded block overflow-x-auto whitespace-nowrap",children:a.apiEndpoint})]}),a.dataFields&&a.dataFields.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("span",{className:"text-muted-foreground block text-xs mb-1",children:"Available Data Fields"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:a.dataFields.map(r=>e.jsx(c,{variant:"secondary",className:"text-xs font-mono",children:r},r))})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-4",children:[e.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View Source Documentation",e.jsx(C,{className:"w-3 h-3"})]}),a.apiEndpoint&&e.jsxs("a",{href:a.apiEndpoint,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:underline flex items-center gap-1",children:["API Endpoint",e.jsx(C,{className:"w-3 h-3"})]})]})]})]})})},a.id))})]}
1,s)),e.jsxs(n,{className:"mt-8",children:[e.jsxs(H,{children:[e.jsxs(Y,{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5 text-primary"}),"Data Change Tracking"]}),e.jsx(Q,{children:"Monthly comparison of data source changes. Refreshing a source will compare the new data against the cached version and highlight additions, removals, and modifications."})]}),e.jsx(i,{children:e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(A,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"font-medium",children:"No changes detected yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Refresh a data source to start tracking changes"})]})})]}),e.jsx(n,{className:"mt-8 bg-muted/50",children:e.jsxs(i,{className:"pt-6",children:[e.jsx("h4",{className:"font-semibold mb-2",children:"About Data Freshness"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:'Data sources are considered "fresh" if they were last checked within the past 30 days. Stale data will still be displayed but may not reflect the latest information from the provider.'}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"w-4 h-4 text-green-500"}),e.jsx("span",{children:"Fresh: < 30 days"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{children:"Stale: > 30 days"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{children:"Unknown: Never cached"})]})]})]})})]})]})]})};export{de 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.