From a7b25b477592282c8f66da1567366ed7f441eb73 Mon Sep 17 00:00:00 2001 From: Austin Orr Date: Tue, 30 Jan 2024 16:01:21 -0800 Subject: [PATCH] add build stage to dockerfile for frontend --- nereid/Dockerfile.multi | 14 +- .../frontend/dist/assets/index-m-Qkl2xL.js | 707 ------------------ .../frontend/dist/assets/index-pTGsNcoA.js | 707 ++++++++++++++++++ nereid/nereid/static/frontend/dist/index.html | 3 +- nereid/nereid/static/frontend/src/index.html | 1 + .../src/js/components/base/load-blob.js | 4 +- .../src/js/components/graph-interface/map.js | 2 +- .../js/components/graph-interface/points.js | 8 +- .../drawer-content-node-treatment-facility.js | 2 +- .../src/js/components/tabs/howto-tab.js | 1 - .../result_summary/land_surface_summary.js | 2 +- .../static/frontend/src/js/lib/nereid-api.js | 23 +- .../nereid/static/frontend/src/js/lib/util.js | 23 +- 13 files changed, 763 insertions(+), 734 deletions(-) delete mode 100644 nereid/nereid/static/frontend/dist/assets/index-m-Qkl2xL.js create mode 100644 nereid/nereid/static/frontend/dist/assets/index-pTGsNcoA.js diff --git a/nereid/Dockerfile.multi b/nereid/Dockerfile.multi index c8f6f9b5..e4d2bc76 100644 --- a/nereid/Dockerfile.multi +++ b/nereid/Dockerfile.multi @@ -1,9 +1,15 @@ # Austin Orr 11/27/2019 # This approach is the fastest to build and yields reasonably -# small images at ~500mb each. The alipine+install variant of this +# small images at ~500mb each. The alpine+install variant of this # pattern is able to reduce each image to ~250MB but takes considerable # time to build and is considerably more complex for scipy and pandas. +FROM node:lts-bullseye as frontend +WORKDIR /app +COPY ./nereid/static/frontend . +RUN npm install . && npm run build +CMD ["bash", "-c", "while true; do sleep 1; done"] + FROM python:3.11-bullseye as nereid_install RUN apt-get update -y \ @@ -58,6 +64,8 @@ COPY ./scripts / RUN chmod +x /start.sh /start-reload.sh /prestart.sh /prestart-worker.sh /run-worker.sh ENV PYTHONPATH=/nereid ENV PATH=/opt/venv/bin:$PATH +COPY ./nereid /nereid/nereid +COPY --from=frontend /app/dist /nereid/nereid/static/frontend # you are here, trying to get the requirements loaded, and rearranging the shared containers. @@ -83,7 +91,6 @@ RUN addgroup --gid 1000 ${IMG_USER} \ && chown -R ${IMG_USER}:${IMG_USER} /nereid USER ${IMG_USER} COPY --from=core-env --chown=${IMG_USER} /opt/venv /opt/venv -COPY --chown=${IMG_USER} ./nereid /nereid/nereid CMD /run-worker.sh @@ -108,7 +115,6 @@ COPY --from=server-env /opt/venv /opt/venv COPY gunicorn_conf.py /gunicorn_conf.py EXPOSE 80 CMD /start.sh -COPY ./nereid /nereid/nereid FROM core-env as test-env @@ -131,7 +137,6 @@ COPY .coveragerc /nereid/.coveragerc COPY conftest.py /nereid/conftest.py ## This will make the container wait, doing nothing, but alive CMD ["bash", "-c", "while true; do sleep 1; done"] -COPY ./nereid /nereid/nereid FROM python:3.11-bullseye as nereid-edge @@ -141,6 +146,7 @@ RUN awk -F"==" '{print $1}' /requirements_dev.txt > /requirements_edge.txt RUN cat requirements_edge.txt RUN pip install -r /requirements_edge.txt COPY ./nereid /nereid/nereid +COPY --from=frontend /app/dist /nereid/nereid/static/frontend COPY ./scripts / RUN chmod +x /start.sh /start-reload.sh /prestart.sh /prestart-worker.sh /run-worker.sh WORKDIR /nereid diff --git a/nereid/nereid/static/frontend/dist/assets/index-m-Qkl2xL.js b/nereid/nereid/static/frontend/dist/assets/index-m-Qkl2xL.js deleted file mode 100644 index 70376eec..00000000 --- a/nereid/nereid/static/frontend/dist/assets/index-m-Qkl2xL.js +++ /dev/null @@ -1,707 +0,0 @@ -var me=Object.defineProperty;var fe=(i,e,t)=>e in i?me(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var R=(i,e,t)=>(fe(i,typeof e!="symbol"?e+"":e,t),t);import{j as ye,D as he,s as ge,a as be,b as ve,e as we,f as ke,g as Se,c as xe,d as Te,h as $e,i as je,k as Re,q as Fe,l as De,t as Ee,m as Ne,n as Ae,o as qe,p as Oe,r as Le,z as Ce,u as Y,v as Ie,F as W}from"./vendor-QiQdsv75.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const n of s.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&a(n)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();class Me{constructor(){this.events={}}subscribe(e,t){let a=this;return a.events.hasOwnProperty(e)||(a.events[e]=[]),a.events[e].push(t),!0}publish(e,t={}){let a=this;return m.state.DEBUG&&console.log("published event: ",e),a.events.hasOwnProperty(e)?(a.events[e].map(r=>r(t)),!0):(m.state.DEBUG&&console.log(`no subscribers for event ${e}`),a.events[e]=[],!1)}}class z{constructor(e){let t=this;t.actions={},t.mutations={},t.state={},t.status="resting",t.events=new Me,t.state=new Proxy(e.state||{},{set:function(a,r,s){return a[r]=s,m.state.DEBUG&&console.log(`stateChange: ${r}`,s),t.status!=="mutation"&&(m.state.DEBUG&&console.warn(`You should use a mutation to set ${r}`),t.events.publish("stateChange",t.state)),!0}})}dispatch(e,t){let a=this;return typeof a.actions[e]!="function"&&(m.state.DEBUG&&console.log(`Action "${e} doesn't exist.`),a.actions[e]=(r,s)=>{r.commit(e,s)}),m.state.DEBUG&&console.groupCollapsed(`ACTION: ${e}`),a.status="action",a.actions[e](a,t),m.state.DEBUG&&console.groupEnd(),!0}commit(e,t){let a=this;typeof a.mutations[e]!="function"&&(m.state.DEBUG&&console.log(`Mutation "${e}" doesn't exist`),a.mutations[e]=(s,n)=>n),a.status="mutation";let r=a.mutations[e](a.state,t);return a.state=Object.assign(a.state,r),a.events.publish("stateChange",a.state),a.events.publish(e,a.state),a.status="resting",!0}}const Pe={DEBUG:!1,config:{},scenario_name:"New Scenario",nereid_host:"",nereid_api_latest:"/api/v1",nereid_state:"state",nereid_region:"region",facility_types:[],facility_type_map:{},initialScale:1<<20,initialCenter:[-116.9337,32.74337],staged_changes:{},default_nodesize:20,max_graph_size:100,map_mode:!0,show_states:!0,graph_edit_mode:!0,show_info_tooltip:!0,treatment_facility_fields:{state:{region:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type"]}},ca:{cosd:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type","ref_data_key","design_storm_depth_inches"]},soc:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type"]}}},node_types:{land_surface:{title:"Land Surface",color:"limegreen"},treatment_facility:{title:"Treatment Facility",color:"steelblue"},treatment_site:{title:"Treatment Site",color:"orangered",disabled:!0},none:{title:"None",color:"dimgrey"}},default_graph:{nodes:[{id:"0",node_type:"treatment_facility"},{id:"1",node_type:"land_surface"}],edges:[{source:"1",target:"0"}]}},m=new z({state:Pe}),Ve=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="land_surface"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),X=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="treatment_facility"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),We=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="treatment_site"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),Z=()=>({edges:(p(m,"state.graph.edges")||[]).map(e=>({source:e.source.id.toString(),target:e.target.id.toString()})),directed:!0,multigraph:!0}),ze=()=>({graph:Z(),land_surfaces:Ve()||[],treatment_facilities:X()||[],treatment_sites:We()||[]}),D={getOpenApi:async i=>{let e;try{return e=await A(`${i}/openapi.json`),e}catch(t){return console.error(t),Be}},getConfig:async(i,e,t)=>{var r,s;let a;try{return a=await A(`${i}/config?state=${e}®ion=${t}`),(s=(r=a==null?void 0:a.detail)==null?void 0:r.toLowerCase())!=null&&s.includes("no config")?(console.warn(`no config for ${e} ${t}`),G):a}catch(n){return console.error(n),G}},getReferenceData:async(i,e,t,a,r)=>{let s;try{return s=await A(`${i}${e}/reference_data_file?state=${t}®ion=${a}&filename=${r}`),s}catch(n){console.error(n)}},postValidateNetwork:async(i,e,t,a,r)=>{var c;let s=`${i}${e}/network/validate?state=${t}®ion=${a}`,n;try{return n=await C(s,r),(c=n==null?void 0:n.data)!=null&&c.isvalid?{title:"Validation Succeeded",msg:"Success",alert_type:"success"}:{title:"Validation Errors",msg:`
${JSON.stringify(n==null?void 0:n.data,void 0,2)}
`,alert_type:"error"}}catch(_){return{title:"Validation Error",msg:`
${JSON.stringify(_,void 0,2)}
`,alert_type:"error"}}},postValidateTreatmentFacilities:async(i,e,t,a,r)=>{var c,_;let s=`${i}${e}/treatment_facility/validate?state=${t}®ion=${a}`,n;try{n=await C(s,r);let u=[];for(let o of(c=n==null?void 0:n.data)==null?void 0:c.treatment_facilities)o!=null&&o.errors&&u.push(o==null?void 0:o.errors.replace(/\n/g," "));for(let o of(_=n==null?void 0:n.data)==null?void 0:_.errors)o.toLowerCase().substring(0,6).includes("error")&&u.push(o);return u.length==0?{title:"Validation Succeeded",msg:"",alert_type:"success"}:{title:"Validation Errors",msg:`
${JSON.stringify(u,void 0,2)}
`,alert_type:"error"}}catch(u){return{title:"Validation Error",msg:`
${JSON.stringify(u,void 0,2)}
`,alert_type:"error"}}},postSolveWatershed:async(i,e,t,a,r)=>{var c,_,u;let s=`${i}${e}/watershed/solve?state=${t}®ion=${a}`,n;try{if(n=await C(s,r),((_=(c=n==null?void 0:n.data)==null?void 0:c.errors)==null?void 0:_.length)==0)return n}catch(o){console.error(o)}return console.error(n,(u=n==null?void 0:n.data)==null?void 0:u.errors),n}},ee=async i=>{let{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await D.getReferenceData(e,t,a,r,i)}catch(n){console.error(n)}return s},te=async()=>{let i=Z(),{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await D.postValidateNetwork(e,t,a,r,i)}catch(n){console.error(n)}return s},ae=async()=>{let i={treatment_facilities:X()},{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await D.postValidateTreatmentFacilities(e,t,a,r,i)}catch(n){console.error(n)}return s},re=async()=>{let i=ze(),{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await D.postSolveWatershed(e,t,a,r,i)}catch(n){console.error(n)}return s};function se(i,e){for(let t in i)if(typeof i[t]=="object"&&i[t]!==null)se(i[t],e);else if(t=="$ref"){let a=i[t].split("/").slice(-1).pop();a&&(delete i.$ref,i=Object.assign(i,e[a]))}}const ie=async({nereid_host:i,nereid_state:e,nereid_region:t})=>{i||(i=window.location.origin);const a=await D.getOpenApi(i),r=await D.getConfig(i,e,t),s=v(a.components.schemas);for(let l in s)se(s[l],s);const n=r.api_recognize.treatment_facility.facility_type,c={};for(const[l,d]of Object.entries(n))c[l]=d.validator;const _={};for(const[l,d]of Object.entries(n))if(d!=null&&d.alias)for(let f of d==null?void 0:d.alias)_[f]=l;else _[l]=l;const u={};for(const[l,d]of Object.entries(n))u[(d==null?void 0:d.label)||l]=l;const o=Object.keys(u);return{nereid_host:i,nereid_state:e,nereid_region:t,config:r,openapi:a,schema:s,facility_types:o,facility_type_map:c,facility_alias_map:_,facility_label_map:u}},G={default_data_directory:"default_data",project_data_directory:"project_data",version:"0.4.3",author:"Austin Orr",contact:"aorr@geosyntec.com",state:"state",region:"region",test:!0,pint_unit_registry:["MPN = count = mpn","_100ml = 100 * milliliter = _100mL"],api_recognize:{land_surfaces:{preprocess:[{expand_fields:[{field:"surface_key",sep:"-",new_column_names:["subbasin","land_use","soil","slope"]}]},{collapse_fields:[{new_column_name:"fuzzy_key",sep:"-",fields:["land_use"]}]},{joins:[{other:"land_surface_table",how:"left",left_on:"surface_key",right_on:"surface_id",validate:"many_to_one",indicator:!0,fuzzy_on:["fuzzy_key"]},{other:"land_surface_emc_table",how:"left",left_on:"land_use",right_on:"land_use",validate:"many_to_one",indicator:!0},{other:"dry_weather_land_surface_emc_table",how:"left",left_on:"land_use",right_on:"land_use",validate:"many_to_one",indicator:!0},{other:"met_table",how:"left",left_on:"subbasin",right_on:"subbasin",validate:"many_to_one",indicator:!0},{other:"dry_weather_flow_table",how:"left",left_on:"rain_gauge",right_on:"rain_gauge",validate:"many_to_one",indicator:!0}]},{remaps:[{left:"soil",right:"imp_pct",how:"addend",mapping:{water:100}},{left:"land_use",right:"is_developed",how:"left",fillna:!1,mapping:{COMM:!0,EDU:!0,IND:!0,UTIL:!0,RESSFH:!0,RESSFL:!0,RESMF:!0,TRFWY:!0,TRANS:!0,TROTH:!0}}]}]},treatment_facility:{preprocess:[{joins:[{other:"met_table",how:"left",left_on:"ref_data_key",right_on:"subbasin",validate:"many_to_one",indicator:!0}]},{remaps:[{left:"hsg",right:"inf_rate_inhr",how:"left",fillna:1e-6,mapping:{a:2.5,b:.8,c:.24,d:.024,lined:1e-6}}]}],facility_type:{no_treatment:{validator:"NTFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_extended_detention:{validator:"RetAndTmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Detention Basin"},infiltration:{validator:"RetentionFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},bioretention:{validator:"BioInfFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Biofiltration"},biofiltration:{validator:"TmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Biofiltration"},wet_detention:{validator:"PermPoolFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Wet Pond"},sand_filter:{validator:"TmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Sand Filter"},swale:{validator:"FlowAndRetFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Vegetated Swale"},hydrodynamic_separator:{validator:"FlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Hydrodynamic Separator"},dry_well:{validator:"DryWellFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},cistern:{validator:"CisternFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_weather_diversion:{validator:"DryWeatherDiversionLowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_weather_treatment:{validator:"DryWeatherTreatmentLowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Sand Filter"},low_flow_facility:{validator:"LowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"}}}},project_reference_data:{dry_weather_flow_table:{file:"dry_weather_flow.json",seasons:{winter:["oct","nov","dec","jan","feb","mar"],summer:["apr","may","jun","jul","aug","sep"]}},met_table:{file:"met_data.json",volume_nomo:{x_col:"size_fraction",t_col:"ddt_hr",y_col:"capture_fraction"},flow_nomo:{x_col:"intensity_inhr",t_col:"tc_minutes",y_col:"performance_frac"},preprocess:[{remaps:[{left:"rain_gauge",right:"volume_nomograph",how:"left",mapping:{"100_LAGUNABEACH":"nomographs/100_LAGUNABEACH_volume_nomo.csv","1130_LAGUNA_AUDUBON":"nomographs/1130_LAGUNA_AUDUBON_volume_nomo.csv"}},{left:"rain_gauge",right:"flow_nomograph",how:"left",mapping:{"100_LAGUNABEACH":"nomographs/100_LAGUNABEACH_flow_nomo.csv","1130_LAGUNA_AUDUBON":"nomographs/1130_LAGUNA_AUDUBON_flow_nomo.csv"}}]}]},dry_weather_tmnt_performance_table:{file:"dry_weather_bmp_params.json",facility_column:"facility_type",pollutant_column:"pollutant",preprocess:[{remaps:[{left:"unit",right:"--",how:"replace",mapping:{"MPN/100mL":"MPN/_100ml","MPN/100 mL":"MPN/_100ml"}}]}]},tmnt_performance_table:{file:"bmp_params.json",facility_column:"facility_type",pollutant_column:"pollutant",preprocess:[{remaps:[{left:"unit",right:"--",how:"replace",mapping:{"MPN/100mL":"MPN/_100ml","MPN/100 mL":"MPN/_100ml"}}]}]},land_surface_table:{file:"land_surface_data.json"},land_surface_emc_table:{file:"land_surface_emc.json",parameters:[{long_name:"Total Suspended Solids",short_name:"TSS",concentration_unit:"mg/L",load_unit:"lbs"},{long_name:"Total Copper",short_name:"TCu",concentration_unit:"ug/L",load_unit:"lbs"},{long_name:"Fecal Coliform",short_name:"FC",concentration_unit:"MPN/_100mL",load_unit:"mpn"}]},dry_weather_land_surface_emc_table:{file:"dry_weather_land_surface_emc.json",parameters:[{long_name:"Dry Weather Total Suspended Solids",short_name:"dwTSS",concentration_unit:"mg/L",load_unit:"lbs"},{long_name:"Dry Weather Total Copper",short_name:"dwTCu",concentration_unit:"ug/L",load_unit:"lbs"},{long_name:"Dry Weather Fecal Coliform",short_name:"dwFC",concentration_unit:"MPN/_100mL",load_unit:"mpn"}]}},data_path:"nereid/data/default_data/state/region"},Be={openapi:"3.0.2",info:{title:"nereid",version:"0.4.3"},paths:{"/api/v1/network/validate":{post:{tags:["network","validate"],summary:"Validate Network",operationId:"validate_network_api_v1_network_validate_post",requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Graph"},example:{directed:!0,nodes:[{id:"A"},{id:"B"}],edges:[{source:"A",target:"B"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/NetworkValidationResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/validate/{task_id}":{get:{tags:["network","validate"],summary:"Get Validate Network Result",operationId:"get_validate_network_result_api_v1_network_validate__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/NetworkValidationResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph":{post:{tags:["network","subgraph"],summary:"Subgraph Network",operationId:"subgraph_network_api_v1_network_subgraph_post",requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphRequest"},example:{graph:{directed:!0,edges:[{source:"3",target:"1"},{source:"5",target:"3"},{source:"7",target:"1"},{source:"9",target:"1"},{source:"11",target:"1"},{source:"13",target:"3"},{source:"15",target:"9"},{source:"17",target:"7"},{source:"19",target:"17"},{source:"21",target:"15"},{source:"23",target:"1"},{source:"25",target:"5"},{source:"27",target:"11"},{source:"29",target:"7"},{source:"31",target:"11"},{source:"33",target:"25"},{source:"35",target:"23"},{source:"4",target:"2"},{source:"6",target:"2"},{source:"8",target:"6"},{source:"10",target:"2"},{source:"12",target:"2"},{source:"14",target:"2"},{source:"16",target:"12"},{source:"18",target:"12"},{source:"20",target:"8"},{source:"22",target:"6"},{source:"24",target:"12"}]},nodes:[{id:"3"},{id:"29"},{id:"18"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph/{task_id}":{get:{tags:["network","subgraph"],summary:"Get Subgraph Network Result",operationId:"get_subgraph_network_result_api_v1_network_subgraph__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph/{task_id}/img":{get:{tags:["network","visualize"],summary:"Get Subgraph Network As Img",operationId:"get_subgraph_network_as_img_api_v1_network_subgraph__task_id__img_get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"},{required:!1,schema:{title:"Media Type",type:"string",default:"svg"},name:"media_type",in:"query"},{required:!1,schema:{title:"Npi",type:"number",default:4},name:"npi",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence":{post:{tags:["network","sequence"],summary:"Network Solution Sequence",operationId:"network_solution_sequence_api_v1_network_solution_sequence_post",parameters:[{required:!1,schema:{title:"Min Branch Size",type:"integer",default:4},name:"min_branch_size",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Graph"},example:{directed:!0,edges:[{source:"3",target:"1"},{source:"5",target:"3"},{source:"7",target:"1"},{source:"9",target:"1"},{source:"11",target:"1"},{source:"13",target:"3"},{source:"15",target:"9"},{source:"17",target:"7"},{source:"19",target:"17"},{source:"21",target:"15"},{source:"23",target:"1"},{source:"25",target:"5"},{source:"27",target:"11"},{source:"29",target:"7"},{source:"31",target:"11"},{source:"33",target:"25"},{source:"35",target:"23"},{source:"4",target:"2"},{source:"6",target:"2"},{source:"8",target:"6"},{source:"10",target:"2"},{source:"12",target:"2"},{source:"14",target:"2"},{source:"16",target:"12"},{source:"18",target:"12"},{source:"20",target:"8"},{source:"22",target:"6"},{source:"24",target:"12"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence/{task_id}":{get:{tags:["network","sequence"],summary:"Get Network Solution Sequence",operationId:"get_network_solution_sequence_api_v1_network_solution_sequence__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence/{task_id}/img":{get:{tags:["network","sequence","visualize"],summary:"Get Network Solution Sequence As Img",operationId:"get_network_solution_sequence_as_img_api_v1_network_solution_sequence__task_id__img_get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"},{required:!1,schema:{title:"Media Type",type:"string",default:"svg"},name:"media_type",in:"query"},{required:!1,schema:{title:"Npi",type:"number",default:4},name:"npi",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data":{get:{tags:["reference_data"],summary:"Get Reference Data Json",operationId:"get_reference_data_json_api_v1_reference_data_get",parameters:[{required:!1,schema:{title:"Filename",type:"string",default:""},name:"filename",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/ReferenceDataResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data/nomograph":{get:{tags:["reference_data"],summary:"Get Nomograph",operationId:"get_nomograph_api_v1_reference_data_nomograph_get",parameters:[{required:!1,schema:{title:"Filename",type:"string",default:""},name:"filename",in:"query"},{required:!1,schema:{title:"Type",type:"string"},name:"type",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data/{table}":{get:{tags:["reference_data"],summary:"Get Reference Data Table",operationId:"get_reference_data_table_api_v1_reference_data__table__get",parameters:[{required:!0,schema:{title:"Table",type:"string"},name:"table",in:"path"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/land_surface/loading":{post:{tags:["land_surface","loading"],summary:"Calculate Loading",operationId:"calculate_loading_api_v1_land_surface_loading_post",parameters:[{required:!1,schema:{title:"Details",type:"boolean",default:!1},name:"details",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaces"},example:{land_surfaces:[{node_id:"1",surface_key:"10101100-RESMF-A-5",area_acres:1.834347898661638,imp_area_acres:1.430224547955745},{node_id:"0",surface_key:"10101100-OSDEV-A-0",area_acres:4.458327528535912,imp_area_acres:.4457209193544626},{node_id:"0",surface_key:"10101000-IND-A-10",area_acres:3.337086111390218,imp_area_acres:.47675887386582366},{node_id:"0",surface_key:"10101100-COMM-C-0",area_acres:.5641157902710026,imp_area_acres:.40729090799199347},{node_id:"1",surface_key:"10101200-TRANS-C-5",area_acres:.007787658410143283,imp_area_acres:.007727004694355631}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/land_surface/loading/{task_id}":{get:{tags:["land_surface","loading"],summary:"Get Land Surface Loading Result",operationId:"get_land_surface_loading_result_api_v1_land_surface_loading__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_facility/validate":{post:{tags:["treatment_facility","validate"],summary:"Initialize Treatment Facility Parameters",operationId:"initialize_treatment_facility_parameters_api_v1_treatment_facility_validate_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{title:"Treatment Facilities",anyOf:[{$ref:"#/components/schemas/TreatmentFacilities"},{$ref:"#/components/schemas/TreatmentFacilitiesStrict"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentFacilitiesResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_facility/validate/{task_id}":{get:{tags:["treatment_facility","validate"],summary:"Get Treatment Facility Parameters",operationId:"get_treatment_facility_parameters_api_v1_treatment_facility_validate__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentFacilitiesResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_site/validate":{post:{tags:["treatment_site","validate"],summary:"Initialize Treatment Site",operationId:"initialize_treatment_site_api_v1_treatment_site_validate_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentSites"},example:{treatment_sites:[{node_id:"WQMP-1a-tmnt",facility_type:"bioretention",area_pct:75,captured_pct:80,retained_pct:10},{node_id:"WQMP-1a-tmnt",facility_type:"nt",area_pct:25,captured_pct:0,retained_pct:0},{node_id:"WQMP-1b-tmnt",facility_type:"bioretention",area_pct:75,captured_pct:50,retained_pct:10},{node_id:"WQMP-1b-tmnt",facility_type:"nt",area_pct:25,captured_pct:0,retained_pct:0}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentSiteResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/watershed/solve":{post:{tags:["watershed","main"],summary:"Post Solve Watershed",operationId:"post_solve_watershed_api_v1_watershed_solve_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Watershed"}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/WatershedResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/watershed/solve/{task_id}":{get:{tags:["watershed","main"],summary:"Get Watershed Result",operationId:"get_watershed_result_api_v1_watershed_solve__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/WatershedResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}}},components:{schemas:{BioInfFacility:{title:"BioInfFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","retention_volume_cuft","area_sqft","media_filtration_rate_inhr","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},retention_volume_cuft:{title:"Retention Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},media_filtration_rate_inhr:{title:"Media Filtration Rate Inhr",type:"number"},hsg:{title:"Hsg",type:"string"}}},CisternFacility:{title:"CisternFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","winter_demand_cfs","summer_demand_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},winter_demand_cfs:{title:"Winter Demand Cfs",type:"number"},summer_demand_cfs:{title:"Summer Demand Cfs",type:"number"}}},DryWeatherDiversionLowFlowFacility:{title:"DryWeatherDiversionLowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},DryWeatherTreatmentLowFlowFacility:{title:"DryWeatherTreatmentLowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},DryWellFacility:{title:"DryWellFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","treatment_rate_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"}}},Edge:{title:"Edge",required:["source","target"],type:"object",properties:{source:{title:"Source",type:"string"},target:{title:"Target",type:"string"},metadata:{title:"Metadata",type:"object",default:{}}}},FlowAndRetFacility:{title:"FlowAndRetFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","treatment_rate_cfs","area_sqft","depth_ft","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},depth_ft:{title:"Depth Ft",type:"number"},hsg:{title:"Hsg",type:"string"}}},FlowFacility:{title:"FlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","treatment_rate_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5}}},Graph:{title:"Graph",required:["edges"],type:"object",properties:{edges:{title:"Edges",type:"array",items:{$ref:"#/components/schemas/Edge"}},nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}},directed:{title:"Directed",type:"boolean",default:!0},multigraph:{title:"Multigraph",type:"boolean",default:!0},type:{title:"Type",type:"string"},label:{title:"Label",type:"string"},metadata:{title:"Metadata",type:"object"}}},HTTPValidationError:{title:"HTTPValidationError",type:"object",properties:{detail:{title:"Detail",type:"array",items:{$ref:"#/components/schemas/ValidationError"}}}},LandSurface:{title:"LandSurface",required:["node_id","surface_key","area_acres","imp_area_acres"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},surface_key:{title:"Surface Key",type:"string",example:"104506-RESSFH-B-5"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"}}},LandSurfaceDetails:{title:"LandSurfaceDetails",required:["node_id","surface_key","area_acres","imp_area_acres","surface_id","perv_ro_depth_inches","imp_ro_depth_inches","perv_ro_coeff","imp_ro_coeff","perv_area_acres","imp_area_sqft","perv_area_sqft","imp_ro_depth_feet","perv_ro_depth_feet","imp_ro_volume_cuft","perv_ro_volume_cuft","runoff_volume_cuft","imp_eff_area_acres","perv_eff_area_acres","eff_area_acres"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},surface_key:{title:"Surface Key",type:"string"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"},surface_id:{title:"Surface Id",type:"string"},perv_ro_depth_inches:{title:"Perv Ro Depth Inches",type:"number"},imp_ro_depth_inches:{title:"Imp Ro Depth Inches",type:"number"},perv_ro_coeff:{title:"Perv Ro Coeff",type:"number"},imp_ro_coeff:{title:"Imp Ro Coeff",type:"number"},perv_area_acres:{title:"Perv Area Acres",type:"number"},imp_area_sqft:{title:"Imp Area Sqft",type:"number"},perv_area_sqft:{title:"Perv Area Sqft",type:"number"},imp_ro_depth_feet:{title:"Imp Ro Depth Feet",type:"number"},perv_ro_depth_feet:{title:"Perv Ro Depth Feet",type:"number"},imp_ro_volume_cuft:{title:"Imp Ro Volume Cuft",type:"number"},perv_ro_volume_cuft:{title:"Perv Ro Volume Cuft",type:"number"},runoff_volume_cuft:{title:"Runoff Volume Cuft",type:"number"},imp_eff_area_acres:{title:"Imp Eff Area Acres",type:"number"},perv_eff_area_acres:{title:"Perv Eff Area Acres",type:"number"},eff_area_acres:{title:"Eff Area Acres",type:"number"}}},LandSurfaceResponse:{title:"LandSurfaceResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/LandSurfaceResults"}}},LandSurfaceResults:{title:"LandSurfaceResults",required:["summary"],type:"object",properties:{summary:{title:"Summary",type:"array",items:{$ref:"#/components/schemas/LandSurfaceSummary"}},details:{title:"Details",type:"array",items:{$ref:"#/components/schemas/LandSurfaceDetails"}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},LandSurfaceSummary:{title:"LandSurfaceSummary",required:["node_id","area_acres","imp_area_acres","perv_area_acres","imp_ro_volume_cuft","perv_ro_volume_cuft","runoff_volume_cuft","eff_area_acres","land_surfaces_count","imp_pct","ro_coeff"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"},perv_area_acres:{title:"Perv Area Acres",type:"number"},imp_ro_volume_cuft:{title:"Imp Ro Volume Cuft",type:"number"},perv_ro_volume_cuft:{title:"Perv Ro Volume Cuft",type:"number"},runoff_volume_cuft:{title:"Runoff Volume Cuft",type:"number"},eff_area_acres:{title:"Eff Area Acres",type:"number"},land_surfaces_count:{title:"Land Surfaces Count",type:"number"},imp_pct:{title:"Imp Pct",type:"number"},ro_coeff:{title:"Ro Coeff",type:"number"}}},LandSurfaces:{title:"LandSurfaces",required:["land_surfaces"],type:"object",properties:{land_surfaces:{title:"Land Surfaces",type:"array",items:{$ref:"#/components/schemas/LandSurface"}}}},LowFlowFacility:{title:"LowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},NTFacility:{title:"NTFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},NetworkValidation:{title:"NetworkValidation",required:["isvalid"],type:"object",properties:{isvalid:{title:"Isvalid",type:"boolean"},node_cycles:{title:"Node Cycles",type:"array",items:{type:"array",items:{type:"string"}}},edge_cycles:{title:"Edge Cycles",type:"array",items:{type:"array",items:{type:"string"}}},multiple_out_edges:{title:"Multiple Out Edges",type:"array",items:{type:"array",items:{type:"string"}}},duplicate_edges:{title:"Duplicate Edges",type:"array",items:{type:"array",items:{type:"string"}}}}},NetworkValidationResponse:{title:"NetworkValidationResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/NetworkValidation"}}},Node:{title:"Node",type:"object",properties:{id:{title:"Id",type:"string"},metadata:{title:"Metadata",type:"object",default:{}}}},Nodes:{title:"Nodes",required:["nodes"],type:"object",properties:{nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}}}},ParallelSeriesSequence:{title:"ParallelSeriesSequence",required:["parallel"],type:"object",properties:{parallel:{title:"Parallel",type:"array",items:{$ref:"#/components/schemas/SeriesSequence"}}}},PermPoolFacility:{title:"PermPoolFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","pool_volume_cuft","pool_drawdown_time_hr","treatment_volume_cuft","treatment_drawdown_time_hr","winter_demand_cfs","summer_demand_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},pool_volume_cuft:{title:"Pool Volume Cuft",type:"number"},pool_drawdown_time_hr:{title:"Pool Drawdown Time Hr",type:"number"},treatment_volume_cuft:{title:"Treatment Volume Cuft",type:"number"},treatment_drawdown_time_hr:{title:"Treatment Drawdown Time Hr",type:"number"},winter_demand_cfs:{title:"Winter Demand Cfs",type:"number"},summer_demand_cfs:{title:"Summer Demand Cfs",type:"number"}}},PreviousResult:{title:"PreviousResult",required:["node_id"],type:"object",properties:{node_id:{title:"Node Id",type:"string"}}},ReferenceData:{title:"ReferenceData",required:["state","region","file"],type:"object",properties:{state:{title:"State",type:"string"},region:{title:"Region",type:"string"},file:{title:"File",type:"string"},filedata:{title:"Filedata"}}},ReferenceDataResponse:{title:"ReferenceDataResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/ReferenceData"}}},Result:{title:"Result",required:["node_id"],type:"object",properties:{node_id:{title:"Node Id",type:"string"}}},RetAndTmntFacility:{title:"RetAndTmntFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","retention_volume_cuft","area_sqft","treatment_drawdown_time_hr","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},retention_volume_cuft:{title:"Retention Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},treatment_drawdown_time_hr:{title:"Treatment Drawdown Time Hr",type:"number"},hsg:{title:"Hsg",type:"string"}}},RetentionFacility:{title:"RetentionFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","area_sqft","inf_rate_inhr"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},inf_rate_inhr:{title:"Inf Rate Inhr",type:"number"}}},SeriesSequence:{title:"SeriesSequence",required:["series"],type:"object",properties:{series:{title:"Series",type:"array",items:{$ref:"#/components/schemas/Nodes"}}}},SolutionSequence:{title:"SolutionSequence",required:["solution_sequence"],type:"object",properties:{solution_sequence:{$ref:"#/components/schemas/ParallelSeriesSequence"}}},SolutionSequenceResponse:{title:"SolutionSequenceResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/SolutionSequence"}}},SubgraphNodes:{title:"SubgraphNodes",required:["subgraph_nodes"],type:"object",properties:{subgraph_nodes:{title:"Subgraph Nodes",type:"array",items:{$ref:"#/components/schemas/Nodes"}}}},SubgraphRequest:{title:"SubgraphRequest",required:["graph","nodes"],type:"object",properties:{graph:{$ref:"#/components/schemas/Graph"},nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}}}},SubgraphResponse:{title:"SubgraphResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/SubgraphNodes"}}},TmntFacility:{title:"TmntFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","area_sqft","media_filtration_rate_inhr"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},media_filtration_rate_inhr:{title:"Media Filtration Rate Inhr",type:"number"}}},TreatmentFacilities:{title:"TreatmentFacilities",required:["treatment_facilities"],type:"object",properties:{treatment_facilities:{title:"Treatment Facilities",type:"array",items:{type:"object"}},errors:{title:"Errors",type:"array",items:{type:"string"}}},example:{treatment_facilities:[{node_id:"1",facility_type:"no_treatment",ref_data_key:"10101200",design_storm_depth_inches:1.45},{node_id:"1",facility_type:"dry_extended_detention",ref_data_key:"10101200",design_storm_depth_inches:1.05,is_online:!0,tributary_area_tc_min:30,total_volume_cuft:5500,retention_volume_cuft:4400,area_sqft:1600,treatment_drawdown_time_hr:72,hsg:"d",offline_diversion_rate_cfs:2.9,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"infiltration",ref_data_key:"10101200",design_storm_depth_inches:.88,is_online:!0,tributary_area_tc_min:25,total_volume_cuft:6200,area_sqft:2e3,inf_rate_inhr:3.5,offline_diversion_rate_cfs:5,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"bioretention",ref_data_key:"10101200",design_storm_depth_inches:.85,is_online:!0,tributary_area_tc_min:15,total_volume_cuft:5800,retention_volume_cuft:3500,area_sqft:1300,media_filtration_rate_inhr:12,hsg:"a",offline_diversion_rate_cfs:6,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"biofiltration",ref_data_key:"10101200",design_storm_depth_inches:.95,is_online:!0,tributary_area_tc_min:40,total_volume_cuft:4400,area_sqft:1200,media_filtration_rate_inhr:15,offline_diversion_rate_cfs:6,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"wet_detention",ref_data_key:"10101200",design_storm_depth_inches:.78,is_online:!0,tributary_area_tc_min:45,pool_volume_cuft:5550,pool_drawdown_time_hr:720,treatment_volume_cuft:2500,treatment_drawdown_time_hr:12,winter_demand_cfs:.05,summer_demand_cfs:.88,offline_diversion_rate_cfs:4,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"sand_filter",ref_data_key:"10101200",design_storm_depth_inches:.78,total_volume_cuft:5e3,area_sqft:2700,media_filtration_rate_inhr:12,is_online:!0,offline_diversion_rate_cfs:2.1,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:20},{node_id:"1",facility_type:"swale",ref_data_key:"10101200",design_storm_depth_inches:1,treatment_rate_cfs:.55,area_sqft:15600,depth_ft:1.5,hsg:"b",is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:25},{node_id:"1",facility_type:"hydrodynamic_separator",ref_data_key:"10101200",design_storm_depth_inches:1.12,treatment_rate_cfs:.2,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:50,is_online:!0},{node_id:"1",facility_type:"dry_well",ref_data_key:"10101200",design_storm_depth_inches:.85,total_volume_cuft:800,treatment_rate_cfs:.5,is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:5},{node_id:"1",facility_type:"cistern",ref_data_key:"10101200",design_storm_depth_inches:1.3,total_volume_cuft:5500,winter_demand_cfs:.05,summer_demand_cfs:.25,is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:55},{node_id:"1",facility_type:"dry_weather_diversion",ref_data_key:"10101200",design_storm_depth_inches:1.43,design_capacity_cfs:3.5,months_operational:"summer",tributary_area_tc_min:30,treatment_rate_cfs:2.92,eliminate_all_dry_weather_flow_override:!1,is_online:!0},{node_id:"1",facility_type:"dry_weather_treatment",ref_data_key:"10101200",design_storm_depth_inches:1.32,design_capacity_cfs:6.1,months_operational:"summer",tributary_area_tc_min:10,treatment_rate_cfs:3.5,eliminate_all_dry_weather_flow_override:!1,is_online:!0},{node_id:"1",facility_type:"low_flow_facility",ref_data_key:"10101200",design_storm_depth_inches:.91,design_capacity_cfs:5.1,months_operational:"summer",tributary_area_tc_min:20,treatment_rate_cfs:5,eliminate_all_dry_weather_flow_override:!1,is_online:!0}]}},TreatmentFacilitiesResponse:{title:"TreatmentFacilitiesResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/TreatmentFacilities"}}},TreatmentFacilitiesStrict:{title:"TreatmentFacilitiesStrict",required:["treatment_facilities"],type:"object",properties:{treatment_facilities:{title:"Treatment Facilities",type:"array",items:{anyOf:[{$ref:"#/components/schemas/PermPoolFacility"},{$ref:"#/components/schemas/RetAndTmntFacility"},{$ref:"#/components/schemas/BioInfFacility"},{$ref:"#/components/schemas/FlowAndRetFacility"},{$ref:"#/components/schemas/RetentionFacility"},{$ref:"#/components/schemas/TmntFacility"},{$ref:"#/components/schemas/CisternFacility"},{$ref:"#/components/schemas/DryWellFacility"},{$ref:"#/components/schemas/DryWeatherTreatmentLowFlowFacility"},{$ref:"#/components/schemas/DryWeatherDiversionLowFlowFacility"},{$ref:"#/components/schemas/LowFlowFacility"},{$ref:"#/components/schemas/FlowFacility"},{$ref:"#/components/schemas/NTFacility"}]}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},TreatmentSite:{title:"TreatmentSite",required:["node_id","facility_type","area_pct","captured_pct","retained_pct"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},area_pct:{title:"Area Pct",type:"number"},captured_pct:{title:"Captured Pct",type:"number"},retained_pct:{title:"Retained Pct",type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},TreatmentSiteGroup:{title:"TreatmentSiteGroup",required:["node_id","node_type","treatment_facilities"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},node_type:{title:"Node Type",type:"string"},treatment_facilities:{title:"Treatment Facilities",type:"array",items:{$ref:"#/components/schemas/TreatmentSiteGroupBase"}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},TreatmentSiteGroupBase:{title:"TreatmentSiteGroupBase",required:["node_id","facility_type","area_pct","captured_pct","retained_pct"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},area_pct:{title:"Area Pct",type:"number"},captured_pct:{title:"Captured Pct",type:"number"},retained_pct:{title:"Retained Pct",type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},TreatmentSiteGroups:{title:"TreatmentSiteGroups",required:["treatment_sites"],type:"object",properties:{treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSiteGroup"}}}},TreatmentSiteResponse:{title:"TreatmentSiteResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/TreatmentSiteGroups"}}},TreatmentSites:{title:"TreatmentSites",required:["treatment_sites"],type:"object",properties:{treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSite"}}}},ValidationError:{title:"ValidationError",required:["loc","msg","type"],type:"object",properties:{loc:{title:"Location",type:"array",items:{type:"string"}},msg:{title:"Message",type:"string"},type:{title:"Error Type",type:"string"}}},Watershed:{title:"Watershed",required:["graph","land_surfaces"],type:"object",properties:{graph:{$ref:"#/components/schemas/Graph"},land_surfaces:{title:"Land Surfaces",type:"array",items:{$ref:"#/components/schemas/LandSurface"}},treatment_facilities:{title:"Treatment Facilities",anyOf:[{type:"array",items:{type:"object"}},{type:"array",items:{anyOf:[{$ref:"#/components/schemas/PermPoolFacility"},{$ref:"#/components/schemas/RetAndTmntFacility"},{$ref:"#/components/schemas/BioInfFacility"},{$ref:"#/components/schemas/FlowAndRetFacility"},{$ref:"#/components/schemas/RetentionFacility"},{$ref:"#/components/schemas/TmntFacility"},{$ref:"#/components/schemas/CisternFacility"},{$ref:"#/components/schemas/DryWellFacility"},{$ref:"#/components/schemas/DryWeatherTreatmentLowFlowFacility"},{$ref:"#/components/schemas/DryWeatherDiversionLowFlowFacility"},{$ref:"#/components/schemas/LowFlowFacility"},{$ref:"#/components/schemas/FlowFacility"},{$ref:"#/components/schemas/NTFacility"}]}}]},treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSite"}},previous_results:{title:"Previous Results",type:"array",items:{$ref:"#/components/schemas/PreviousResult"}}},example:{graph:{directed:!0,multigraph:!1,graph:{},nodes:[{metadata:{},id:"0"},{metadata:{},id:"1"},{metadata:{},id:"2"},{metadata:{},id:"3"},{metadata:{},id:"4"},{metadata:{},id:"5"},{metadata:{},id:"6"}],edges:[{metadata:{},source:"1",target:"0"},{metadata:{},source:"2",target:"1"},{metadata:{},source:"3",target:"2"},{metadata:{},source:"4",target:"2"},{metadata:{},source:"5",target:"2"},{metadata:{},source:"6",target:"1"}]},treatment_facilities:[{node_id:"0",facility_type:"sand_filter",ref_data_key:"10101200",design_storm_depth_inches:.85,total_volume_cuft:335,area_sqft:1532,media_filtration_rate_inhr:22.5,constructor:"treatment_facility_constructor",tributary_area_tc_min:30,is_online:!0},{node_id:"2",facility_type:"bioretention",ref_data_key:"10101000",design_storm_depth_inches:.85,total_volume_cuft:382,retention_volume_cuft:333,area_sqft:2658,media_filtration_rate_inhr:14.6,hsg:"a",constructor:"bioinfiltration_facility_constructor",tributary_area_tc_min:55,is_online:!0}],treatment_sites:[{facility_type:"wet_detention",node_id:"1",area_pct:6,captured_pct:57,retained_pct:38},{facility_type:"cistern",node_id:"1",area_pct:80,captured_pct:74,retained_pct:49},{facility_type:"swale",node_id:"1",area_pct:0,captured_pct:61,retained_pct:44},{facility_type:"dry_weather_diversion",node_id:"1",area_pct:12,captured_pct:80,retained_pct:56},{facility_type:"dry_extended_detention",node_id:"1",area_pct:1,captured_pct:40,retained_pct:0},{facility_type:"infiltration",node_id:"1",area_pct:1,captured_pct:73,retained_pct:59}],land_surfaces:[{node_id:"3",surface_key:"10101000-RESSFH-rock-5",area_acres:.3984569310124453,imp_area_acres:.009673489252693119},{node_id:"3",surface_key:"10101100-RESSFH-D-0",area_acres:8.065001059380828,imp_area_acres:2.16741977121951},{node_id:"3",surface_key:"10101100-EDU-D-5",area_acres:2.5839358997133957,imp_area_acres:2.55343628659585},{node_id:"3",surface_key:"10101100-UTIL-A-5",area_acres:4.312089428850966,imp_area_acres:4.131205425493061},{node_id:"3",surface_key:"10101200-RESSFL-D-5",area_acres:3.9337442224446297,imp_area_acres:.7661658366327859},{node_id:"4",surface_key:"10101200-COMM-A-0",area_acres:.28767325522239817,imp_area_acres:.08026707777353169},{node_id:"4",surface_key:"10101200-TRANS-rock-10",area_acres:6.9571538459344495,imp_area_acres:1.2273914932176564},{node_id:"4",surface_key:"10101200-OSLOW-rock-0",area_acres:2.403387703304852,imp_area_acres:.9959985713261311},{node_id:"4",surface_key:"10101200-OSWET-D-5",area_acres:2.79314881649118,imp_area_acres:.15499820430359323},{node_id:"4",surface_key:"10101100-OSFOR-D-5",area_acres:2.905930886150414,imp_area_acres:1.4925738336538064},{node_id:"4",surface_key:"10101000-TRANS-A-5",area_acres:9.350620373618705,imp_area_acres:5.232513213963891},{node_id:"4",surface_key:"10101200-COMM-C-0",area_acres:2.1979646924219196,imp_area_acres:.2053466380605771},{node_id:"4",surface_key:"10101000-OSWET-D-0",area_acres:9.316054897695937,imp_area_acres:8.379096506045641},{node_id:"4",surface_key:"10101200-TRFWY-A-0",area_acres:1.4272661923917718,imp_area_acres:1.2613822514526472},{node_id:"4",surface_key:"10101200-OSDEV-C-10",area_acres:4.221871721446085,imp_area_acres:.4549400198109034},{node_id:"4",surface_key:"10101100-RESSFH-C-0",area_acres:.26360615441130775,imp_area_acres:.13605449920172205},{node_id:"4",surface_key:"10101000-OSDEV-D-5",area_acres:7.289650539203478,imp_area_acres:6.077668638347337},{node_id:"5",surface_key:"10101000-IND-A-10",area_acres:4.930498275495615,imp_area_acres:4.450757471699112},{node_id:"5",surface_key:"10101200-OSLOW-rock-0",area_acres:7.814106399568224,imp_area_acres:1.078526163782842},{node_id:"5",surface_key:"10101200-RESSFL-D-5",area_acres:6.185417372804003,imp_area_acres:5.76250105686173},{node_id:"5",surface_key:"10101200-OSIRR-water-10",area_acres:.36715726648133273,imp_area_acres:.23531606583046188},{node_id:"5",surface_key:"10101200-RESMF-D-5",area_acres:5.3935429017017515,imp_area_acres:3.810512599072686},{node_id:"5",surface_key:"10101100-RESSFH-A-5",area_acres:2.3620796715469004,imp_area_acres:1.870944109794398},{node_id:"5",surface_key:"10101200-WATER-A-10",area_acres:5.506805596166197,imp_area_acres:2.0512411750860533},{node_id:"5",surface_key:"10101200-TRFWY-A-5",area_acres:2.2549267594382885,imp_area_acres:.059337765905655114},{node_id:"5",surface_key:"10101200-EDU-A-5",area_acres:6.945443095820329,imp_area_acres:2.426366435613679},{node_id:"5",surface_key:"10101100-IND-D-0",area_acres:3.8291536983619254,imp_area_acres:2.4237194475207304},{node_id:"5",surface_key:"10101000-RESSFH-D-10",area_acres:4.720854566650611,imp_area_acres:1.9563886575871627},{node_id:"5",surface_key:"10101000-EDU-C-10",area_acres:1.7804423698966843,imp_area_acres:.3371318723066817},{node_id:"6",surface_key:"10101200-TRANS-D-0",area_acres:2.2754330855140923,imp_area_acres:1.0211331313414405},{node_id:"6",surface_key:"10101100-OSLOW-D-5",area_acres:6.214500618686376,imp_area_acres:.6340460489422389},{node_id:"6",surface_key:"10101100-UTIL-A-10",area_acres:2.555615240745477,imp_area_acres:2.131208949421928},{node_id:"6",surface_key:"10101000-RESSFH-A-5",area_acres:8.175748802007071,imp_area_acres:1.8980919101830314},{node_id:"6",surface_key:"10101200-RESSFH-A-0",area_acres:3.860268456910725,imp_area_acres:1.9184629017741963},{node_id:"6",surface_key:"10101200-OSDEV-C-5",area_acres:.5748050245941472,imp_area_acres:.1411875823737466},{node_id:"6",surface_key:"10101000-RESSFH-D-0",area_acres:7.945535238259879,imp_area_acres:.6302494865328522},{node_id:"6",surface_key:"10101000-RESMF-D-0",area_acres:6.915337959629758,imp_area_acres:3.162694892687792},{node_id:"6",surface_key:"10101000-IND-A-5",area_acres:5.262089934922299,imp_area_acres:.012019588367122497},{node_id:"6",surface_key:"10101200-EDU-D-10",area_acres:9.142141560695912,imp_area_acres:8.229015560695975},{node_id:"6",surface_key:"10101200-OSAGIR-A-10",area_acres:1.1171651349206269,imp_area_acres:.5990037582520297},{node_id:"6",surface_key:"10101100-OSAGIR-C-0",area_acres:3.304545692925136,imp_area_acres:.36222350149989435},{node_id:"6",surface_key:"10101000-RESSFH-D-0",area_acres:9.63416946726306,imp_area_acres:7.1542071673930625},{node_id:"6",surface_key:"10101100-OSLOW-D-0",area_acres:4.8579106327541695,imp_area_acres:.25541389152635474},{node_id:"6",surface_key:"10101200-OSDEV-C-5",area_acres:6.798391444820259,imp_area_acres:2.2112485428708193},{node_id:"6",surface_key:"10101000-RESSFH-D-10",area_acres:3.4948300942486963,imp_area_acres:3.233078107164885},{node_id:"6",surface_key:"10101000-OSAGIR-A-10",area_acres:3.6289953644281625,imp_area_acres:.38263683466075843},{node_id:"6",surface_key:"10101100-OSDEV-D-0",area_acres:5.376760581619445,imp_area_acres:4.5257872671756365}]}},WatershedResponse:{title:"WatershedResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/WatershedResults"}}},WatershedResults:{title:"WatershedResults",type:"object",properties:{results:{title:"Results",type:"array",items:{$ref:"#/components/schemas/Result"}},leaf_results:{title:"Leaf Results",type:"array",items:{$ref:"#/components/schemas/Result"}},previous_results_keys:{title:"Previous Results Keys",type:"array",items:{type:"string"}},errors:{title:"Errors",type:"array",items:{type:"string"}},warnings:{title:"Warnings",type:"array",items:{type:"string"}}}}}}},Ue=Object.freeze(Object.defineProperty({__proto__:null,getConfig:ie,getReferenceData:ee,solveWatershed:re,validateNetwork:te,validateTreatmentFacilities:ae},Symbol.toStringTag,{value:"Module"})),p=(i,e="")=>e.split(".").reduce((t,a)=>t==null?t:t[a],i),x=(i,e="")=>{let t=p(i,e);return t===void 0?!1:t};function ne(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=t.length;for(let r=0;rObject.keys(i).filter(r=>e.length?e.includes(r):!0).filter(r=>!t.includes(r)).reduce((r,s)=>({...r,[s]:i[s]}),{});function q(i){return Object.entries(i).filter(([e,t])=>t!=""&&t!=null).reduce((e,[t,a])=>({...e,[t]:a===Object(a)?q(a):a}),{})}function v(i){return JSON.parse(JSON.stringify(i))}function B(i){return i.length?i.reduce((e,t)=>e+t)/i.length:void 0}function w(i){return Array.isArray(i)?[].concat(...i.map(w)):i}const O=()=>{let i=(p(m,"state.waiting")||0)+1;m.dispatch("Waiting",{waiting:i})},L=()=>{let i=(p(m,"state.waiting")||0)-1;i<0&&(console.error("waiting counter is negative"),i=0),m.dispatch("Waiting",{waiting:i})};async function A(i){return console.log("fetching with get",i),O(),await fetch(i,{method:"GET"}).then(t=>{if(console.log("getJsonResponse response:",t),t.status==200)return t.json();if(t.status==422)return t.json();throw new Error("got back "+t.content)}).then(t=>(console.log("getJsonResponse data returned:",t),t)).finally(L)}async function C(i,e){return console.log("fetching with post",i,e),O(),await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(a=>{if(console.log("postJsonResponse response:",a),a.status==200)return a.json();if(a.status==422)return a.json();throw new Error("got back "+a)}).then(a=>(console.log("postJsonResponse data returned:",a),a)).finally(L)}const He=({fn:i,validate:e,interval:t,maxAttempts:a})=>{console.log("Start poll...");let r=0;const s=async(n,c)=>{console.log("- poll");const _=await i();if(r++,e(_))return n(_);if(a&&r===a)return c(new Error("Exceeded max attempts"));setTimeout(s,t,n,c)};return new Promise(s)};function U(i){var e,t,a,r,s,n;return n=i.data||null,n==null||!n.length?null:(r=i.columnDelimiter||",",s=i.lineDelimiter||` -`,a=i.keys||Object.keys(n[0]),e="",e+=a.map(c=>String(c).includes(",")?`"${c}"`:`${c}`).join(r),e+=s,n.forEach(function(c){t=0,a.forEach(function(_){t>0&&(e+=r);const u=String(c[_]);u.includes(",")?e+=`"${u}"`:e+=`${u}`,t++}),e+=s}),e)}const le=async()=>{const i=new URLSearchParams(window.location.search);let{state:e,region:t}=Object.fromEntries(i.entries());const a=await ie({nereid_state:e||m.state.nereid_state,nereid_region:t||m.state.nereid_region});return m.dispatch("updateConfig",a),console.log(a),!1},Ge=Object.freeze(Object.defineProperty({__proto__:null,cleanObject:q,convertArrayOfObjectsToCSV:U,decr_waiting:L,deepCopy:v,filter:oe,flatten:w,get:p,getConfigFromUrlQueryParams:le,getJsonResponse:A,getTruthy:x,incr_waiting:O,mean:B,poll:He,postJsonResponse:C,randomString:ne},Symbol.toStringTag,{value:"Module"}));class F{constructor(e,t,a){this.nodes=e||[],this.edges=t||[],this.options=a||{},this.resolve_links(),m.dispatch("newGraph",{graph:this})}resolve_links(){let e=this;e.nodes=e.nodes.filter(r=>r.id!=null),this.edges.forEach(function(r){let s=r.source,n=r.target;r.source=e.nodes.find(c=>c.id===s),r.target=e.nodes.find(c=>c.id===n)});let t=this.options.width||600,a=this.options.height||400;this.nodes.forEach(function(r){r.x||(r.x=t/2+t/3*(Math.random()-1)),r.y||(r.y=a/2+a/3*(Math.random()-1))})}spliceLinksForNode(e){const t=this.edges.filter(a=>a.source.id===e||a.target.id===e);for(const a of t)this.edges.splice(this.edges.indexOf(a),1)}}function M(){let{nodes:i,edges:e,scenario_name:t}=v(p(m,"state.staged_changes"));new F(i,e),m.dispatch("clearStagedChanges",{staged_changes:{}}),t&&m.dispatch("updateScenarioName",{scenario_name:t})}function de(){let i=v(p(m,"state.staged_changes.nodes")),e=v(p(m,"state.staged_changes.edges")),t=v(p(m,"state.graph.nodes")),a=v(p(m,"state.graph.edges")),r=[...a,...e].map(n=>{var c,_;return{source:((c=n.source)==null?void 0:c.id)||n.source,target:((_=n.target)==null?void 0:_.id)||n.target}}),s=i;for(let n of t)i.map(c=>c.id).includes(n.id)||s.push(n);new F(s,r),m.dispatch("clearStagedChanges",{staged_changes:{}})}const Je=()=>{let{graph:i,scenario_name:e}=p(m,"state");sessionStorage.setItem("autosave_graph",JSON.stringify({graph:i,scenario_name:e}))},Ke=()=>{var t;let i=sessionStorage.getItem("autosave_graph"),e=v(p(m,"state.default_graph"));if(i){const{graph:a,scenario_name:r}=JSON.parse(i);sessionStorage.removeItem("autosave_graph"),((t=a==null?void 0:a.nodes)==null?void 0:t.length)>0?new F(a.nodes,a.edges.map(s=>({source:s.source.id,target:s.target.id}))):new F(e.nodes,e.edges),r&&m.dispatch("restoreScenarioName",{scenario_name:r})}else new F(e.nodes,e.edges)};window.addEventListener("beforeunload",Je);window.addEventListener("load",i=>{const t=new URLSearchParams(window.location.search).get("tab");t&&m.dispatch("changedTab",{current_tab:t})});const y=Object.assign({json:ye,Delaunay:he},ge,be,ve,we,ke,Se,xe,Te,$e,je,Re,Fe,De,Ee,Ne,Ae,qe,Oe,Le,Ce);window.d3=y;class b{constructor(e={}){let t=this;this.element,this.element_string,this.id,this._render=this._render||e._render||function(){},e.store instanceof z&&(t.store=e.store),e.hasOwnProperty("events")&&e.store instanceof z&&e.events.forEach(a=>e.store.events.subscribe(a,()=>t.render())),e.hasOwnProperty("element")&&(t.element=e.element),e.hasOwnProperty("element_string")&&(t.element_string=e.element_string,t.element=y.select(element)),e.hasOwnProperty("id")&&(t.id=e.id,t.element_string=`#${t.id}`,t.element=y.select(t.element_string)),e.hasOwnProperty("children")&&(t.children=e.children)}render(){let e=this;this._render(),this!=null&&this.children&&this.children.forEach(t=>{t!=null&&t.parent_id||(t.parent_id=e.id),t.render()})}}class Qe extends b{constructor(e){super({store:m,id:e.id})}enter(){let e=this;e.element.classed("pointer-events-none",!1);let t;t=e.element.select(".background-overlay").node(),t.classList.remove("opacity-0"),t.classList.add("duration-300","opacity-40"),t=e.element.select(".modal-main").node(),t.classList.remove("opacity-0","translate-y-4"),t.classList.add("opacity-100","translate-y-0")}exit(){let e=this,t=e.element;e.element.classed("pointer-events-none",!0);let a;a=t.select(".background-overlay").node(),a.classList.remove("opacity-40","duration-300"),a.classList.add("opacity-0"),a=t.select(".modal-main").node(),a.classList.remove("opacity-100","translate-y-0"),a.classList.add("opacity-0","translate-y-4")}_base_template(){return` - - `}_render(){let e=this;e.element=d3.select("body").append("div").attr("id",e.id),e.element.html(e._base_template()),e.store.events.subscribe("Waiting",({waiting:t})=>{t>0&&e.enter()}),e.store.events.subscribe("Waiting",({waiting:t})=>{t===0&&e.exit()}),d3.select("body")}}const Ye=new Qe({id:"spinner-popup"});class Xe extends b{constructor(e){super({store:m,id:e.id})}enter(e){let t=this;t.element.classed("pointer-events-none",!1);let a=t.element.select("#modal-content");a.html(t._content_template(e)),a.selectAll("button").on("click",this.exit.bind(t));let r;r=t.element.select(".background-overlay").node(),r.classList.remove("opacity-0"),r.classList.add("duration-300","opacity-40"),r=t.element.select(".modal-main").node(),r.classList.remove("opacity-0","translate-y-4"),r.classList.add("opacity-100","translate-y-0")}exit(){let e=this,t=e.element;e.element.classed("pointer-events-none",!0);let a;a=t.select(".background-overlay").node(),a.classList.remove("opacity-40","duration-300"),a.classList.add("opacity-0"),a=t.select(".modal-main").node(),a.classList.remove("opacity-100","translate-y-0"),a.classList.add("opacity-0","translate-y-4")}_content_template(e){e||(e={});let t={icon:` - - - `};switch(e.alert_type){case"error":t.bgcolor="bg-red-300",t.button_style="bg-red-600 hover:bg-red-700 focus:ring-red-500",t.icon_color="text-red-600",t.icon_bgcolor="bg-red-100";break;case"success":t.bgcolor="bg-green-300",t.button_style="bg-green-600 hover:bg-green-700 focus:ring-green-500",t.icon_color="text-green-600",t.icon_bgcolor="bg-green-100",t.icon=` - - - - - `;break;default:t.bgcolor="bg-yellow-300",t.button_style="bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500",t.icon_color="text-yellow-600",t.icon_bgcolor="bg-yellow-100"}return` -
-
- -
-
-
- ${t.icon} -
-
-
- -
-

- ${(e==null?void 0:e.msg)||""} -

-
-
-
-
-
- -
- `}_base_template(){return` - - `}_render(){let e=this;e.element=d3.select("body").append("div").attr("id",e.id).classed("pointer-events-none",!0),e.element.html(e._base_template()),e.store.events.subscribe("raiseModal",({modal_content:t})=>e.enter(t)),e.exit()}}const Ze=new Xe({id:"modal-popup"});class et{constructor(e){this.store=m,this.namespace=e,this.registry_underline={0:"translate-x-0",1:"translate-x-full",2:"translate-x-double",3:"translate-x-triple",4:"translate-x-quad",5:"translate-x-pent",6:"translate-x-sext",7:"translate-x-sept",8:"translate-x-octa"},this.registry={}}init(){let e=this,t=this.namespace;document.querySelectorAll(`${t}`).forEach(r=>{Array.from(r.children).forEach((s,n)=>{e.registry[s.dataset.target]=e.registry_underline[n],s.dataset.target&&(s.addEventListener("click",()=>{e.store.dispatch("changedTab",{current_tab:s.dataset.target}),e.toggle.bind(e)(s.dataset.target)}),s.className.includes("active")&&e.toggle.bind(e)(s.dataset.target))})}),e.store.events.subscribe("changedTab",({current_tab:r})=>{e.toggle(r)});let a=p(e.store,"state.current_tab");a&&e.toggle(a)}toggle(e){let t=this,a=this.namespace,r=document.querySelector(`${a} .tab-slider`);r.className=r.className.replace(/\btranslate-x-.+?\b/g,""),r.classList.add(t.registry[e]),document.querySelectorAll(`${a} .tab-content`).forEach(s=>{s.classList[s.id===e?"remove":"add"]("hidden"),document.querySelector(`[data-target="${s.id}"]`).classList.toggle("active",s.id===e)})}}class tt extends b{constructor({children:e}){super({store:m,children:e}),this.classname="main-tab-group-namespace"}_template(){return` - -
-
- Editor -
-
-
How To
-
Treatment Results
-
Land Surface Results
- Logout -
- - - - - -
-
-
-
-
-
- - - `}_render(){let e=this;y.select("body").append("div").classed("min-w-[700px]",!0).html(e._template()),new et(`.${this.classname}`).init()}}class at extends b{constructor(e){super({store:m,id:e.id,children:e.children}),this.store.events.subscribe("updateScenarioName",this._update_scenario_name.bind(this))}get scenario_name(){return p(this.store,"state.scenario_name")}_update_scenario_name(){let e=this;y.select(`#${e.id}`).select("#scenario-name").text(e.scenario_name)}_template(){return` -
- Scenario:  - - ${this.scenario_name} - -
-
-
-
-
-
-
- -
-
-
-
- `}_render(){let e=this,t=y.select(`#${e.id}`).classed("flex flex-col justify-center max-w-[1000px]",!0).html(e._template());t.select("#scenario-name").on("input",()=>{let a=t.select("#scenario-name").text().trim();e.store.dispatch("changeScenarioName",{scenario_name:a})})}}class E extends b{constructor(e){super({store:m,id:e.id}),this.parent_id=e.parent_id,this.text=e.text,this.callback=e.callback,this.isActive=e.isActive,this.scale=e.scale||"scale-100",this.button,this._class=e.class_string||""}get class(){return this._class}_render(){let e=this;e.toggle=y.select(`#${e.parent_id}`).append("div"),e.toggle.html(` - -
- -
- `),e.toggle.select("input[type=checkbox]").property("checked",e.isActive),e.toggle.select("input").on("change",e.callback.bind(e))}}const N="scale-75",rt=new E({id:"map-edit-toggle",text:"Show BaseMap",isActive:x(m,"state.map_mode"),scale:N,callback:function(){let i=!x(this,"store.state.map_mode");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isMapMode",{map_mode:i})}}),st=new E({id:"graph-edit-toggle",text:"Edit Graph",isActive:x(m,"state.graph_edit_mode"),scale:N,callback:function(){let i=!x(this,"store.state.graph_edit_mode");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isGraphEditMode",{graph_edit_mode:i})}}),it=new E({id:"states-vector-toggle",text:"Show States",isActive:x(m,"state.show_states"),scale:N,callback:function(){let i=!x(this,"store.state.show_states");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowStatesMode",{show_states:i})}}),nt=new E({id:"design-storm-vector-toggle",text:"Show Design Storm",isActive:x(m,"state.show_design_storm"),scale:N,callback:function(){let i=!x(this,"store.state.show_design_storm");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowDesignStorm",{show_design_storm:i})}}),ot=new E({id:"rain-zone-vector-toggle",text:"Show Rain Zones",isActive:x(m,"state.show_rain_zone"),scale:N,callback:function(){let i=!x(this,"store.state.show_rain_zone");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowRainZones",{show_rain_zone:i})}}),lt=new E({id:"into-tooltip-toggle",text:"Show Node Info",isActive:x(m,"state.show_info_tooltip"),scale:N,callback:function(){let i=!x(this,"store.state.show_info_tooltip");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowInfoTooltip",{show_info_tooltip:i})}}),dt=new b({id:"toggle-container",children:[rt,it,nt,ot,st,lt]});class ct extends b{constructor(t){super({store:m,id:t.id});R(this,"width",()=>y.select(`#${this.id}`).node().getBoundingClientRect().width);R(this,"height",()=>y.select(`#${this.id}`).node().getBoundingClientRect().height);let a=this;a.store.events.subscribe("isMapMode",()=>a.toggleMapMode()),a.store.events.subscribe("changedTransform",r=>a.zoomed(r)),a.svg=t.svg,a.initialScale=p(a,"store.state.initialScale"),a._k={},a.initialCenter=p(a,"store.state.config.project_spatial_data.app.centroid")||p(a,"store.state.initialCenter"),a.tilesize=256,a._current_point,a._zoomed=!1,a.url=(r,s,n)=>`https://${"abc"[Math.abs(r+s)%3]}.basemaps.cartocdn.com/rastertiles/voyager/${n}/${r}/${s}${devicePixelRatio>1?"@2x":""}.png`,a.projection=y.geoMercator().scale(1/(2*Math.PI)).translate([0,0]),a.store.dispatch("setProjection",{projection:a.projection}),a.transform=y.zoomIdentity.translate(a.projection([0,0])[0],a.projection([0,0])[1]).scale(a.projection.scale()*2*Math.PI),a.store.dispatch("setTransform",{transform:a.transform}),a.renderer=y.geoPath(a.projection),a.tile=y.tile().extent([[0,0],[a.width(),a.height()]]).tileSize(a.tilesize),a.image_bg=a.svg.append("svg:g").classed("bg basemap",!0).attr("pointer-events","none").style("overflow","hidden").attr("pointer-events","none").classed("hidden",!a.store.state.map_mode).selectAll("image"),a.image_fg=a.svg.append("svg:g").classed("fg basemap",!0).attr("pointer-events","none").style("overflow","hidden").classed("hidden",!a.store.state.map_mode).selectAll("image"),a.image_group=a.svg.selectAll(".basemap"),a.vector=a.svg.append("svg:g").attr("id","vectors").attr("pointer-events","none"),a.zoom=y.zoom().scaleExtent([64,1<<30]).extent([[0,0],[a.width(),a.height()]]).filter(()=>!a.drag_lock).on("start",r=>{}).on("zoom",r=>{a.store.dispatch("changedTransform",{transform:r.transform})}).on("end",r=>{a.store.dispatch("changedZoomTransform",{zoomTransform:a.zoom.transform})})}get drag_lock(){return p(this,"store.state.drag_lock")}toggleMapMode(){let t=this;t.image_group.classed("hidden",!t.store.state.map_mode),console.log("map mode toggled!")}zoomed({transform:t}){let a=this;a.transform=t,a._k=t.k;const r=a.tile(t);a.image_bg=a.image_bg.data(r,s=>s).join("image").attr("xlink:href",s=>a.url(...s)).attr("x",([s])=>(s+r.translate[0])*r.scale-.5).attr("y",([,s])=>(s+r.translate[1])*r.scale-.5).attr("width",r.scale+1).attr("height",r.scale+1),a.image_fg=a.image_fg.data(r,s=>s).join("image").attr("xlink:href",s=>a.url(...s)).attr("x",([s])=>(s+r.translate[0])*r.scale).attr("y",([,s])=>(s+r.translate[1])*r.scale).attr("width",r.scale).attr("height",r.scale),a.vector.attr("transform",t)}_render(){let t=this;t.svg.call(t.zoom).call(t.zoom.transform,y.zoomIdentity.translate(t.width()/2,t.height()/2).scale(-t.initialScale).translate(...t.projection(t.initialCenter)).scale(-1))}}class _t extends b{constructor(e){super({store:m});let t=this;t.stroke_width=1,t.store.events.subscribe("changedTransform",()=>{t.path.style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowStatesMode",()=>{t.path.classed("hidden",t.hidden)}),t.projection=p(t,"store.state.projection"),t.renderer=y.geoPath(t.projection).digits(15),t.url="https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json",t.vector=e.vector,t.path=t.vector.append("path").attr("pointer-events","all").attr("fill","none").attr("stroke","green").attr("stroke-linecap","round").attr("stroke-linejoin","round").classed("hidden",t.hidden).style("stroke-width",t.stroke_width/t.transform.k)}get hidden(){return!p(this,"store.state.show_states")}get transform(){return p(this,"store.state.transform")}async _render(){let e=this,t=await y.json(e.url),a=Y(t,t.objects.states);e.geojson=a,e.store.dispatch("setStateQuery",{state_query:a}),e.path.attr("d",e.renderer(a))}}class ce extends b{constructor({vector:e}){super({store:m});let t=this;t.group=e.append("g"),t.stroke_width=0,t.domain=[0,1],t.projection=p(t,"store.state.projection"),t.renderer=d3.geoPath(t.projection).digits(15)}get transform(){return p(this,"store.state.transform")}async _load_data(e){let t=this;if(!e)return;let a,r;try{if(e!=null&&e.filepath)r=await ee(e.filepath);else if(e!=null&&e.url)r=await A(e.url);else return}catch(s){console.error(s);return}try{if((r==null?void 0:r.type)==="Topology"){let s=r;a=Y(s,s.objects[e.name])}else(r==null?void 0:r.type)==="FeatureCollection"&&(a=r,a.features=a.features.map(s=>Ie(s,{reverse:!0})))}catch(s){console.error(s);return}if(a){a._field=e.field;let s=a.features.map(n=>n.properties[e.field]);t.domain=[Math.min(...s),Math.max(...s)],t.geojson=a}}}class pt extends ce{constructor({vector:e}){super({vector:e});let t=this;t.store.events.subscribe("changedTransform",()=>{t.group.selectAll("path").style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowDesignStorm",async()=>{let a=p(t,"store.state.design_storm_geojson");if(!a){await t.load_data();return}t._draw(a)}),t.store.events.subscribe("setDesignStormQuery",({design_storm_geojson:a})=>t._draw(a))}get hidden(){return!p(this,"store.state.show_design_storm")}async load_data(){var r;let e=this,t=p(e.store,"state.config"),a=v((r=t==null?void 0:t.project_spatial_data)==null?void 0:r.design_storm);await e._load_data(a),e.geojson&&e.store.dispatch("setDesignStormQuery",{design_storm_geojson:e.geojson})}_draw(e){if(!e)return;let t=this;t.group.selectAll("path").remove(),!t.hidden&&(t.colorScale=y.scaleLinear().domain(t.domain).range(["white","blue"]),t.group.selectAll("path").data(e.features).enter().append("path").attr("d",t.renderer).attr("pointer-events","all").attr("fill",a=>t.colorScale(a.properties[e._field])).attr("stroke",y.gray(.2)).attr("stroke-linecap","round").attr("stroke-linejoin","round").style("stroke-width",t.stroke_width/t.transform.k))}async _render(){let e=this;e.store.events.subscribe("updateConfig",e.load_data.bind(e))}}class ut extends ce{constructor({vector:e}){super({vector:e});let t=this;t.stroke_width=1,t.store.events.subscribe("changedTransform",()=>{t.group.selectAll("path").style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowRainZones",async()=>{let a=p(t,"store.state.ref_data_key_geojson");if(!a){await t.load_data();return}t._draw(a)}),t.store.events.subscribe("setRefDataQuery",({ref_data_key_geojson:a})=>t._draw(a))}get hidden(){return!p(this,"store.state.show_rain_zone")}async load_data(){var r;let e=this,t=p(e.store,"state.config"),a=v((r=t==null?void 0:t.project_spatial_data)==null?void 0:r.ref_data_key);await e._load_data(a),e.geojson&&e.store.dispatch("setRefDataQuery",{ref_data_key_geojson:e.geojson})}_draw(e){if(!e)return;let t=this;t.group.selectAll("path").remove(),!t.hidden&&(t.colorScale=y.scaleOrdinal().domain(t.domain).range(y.schemeSet3),t.group.selectAll("path").data(e.features).enter().append("path").attr("d",t.renderer).attr("pointer-events","all").attr("fill",a=>t.colorScale(a.properties[e._field])).attr("stroke",y.gray(.2)).attr("stroke-linecap","round").attr("stroke-linejoin","round").style("stroke-width",t.stroke_width/t.transform.k))}async _render(){let e=this;e.store.events.subscribe("updateConfig",e.load_data.bind(e))}}class mt extends b{constructor(t){super({store:m,id:t.id});R(this,"fixedScale",()=>!1);R(this,"getScale",()=>{let t=this;return t.fixedScale()?p(t,"store.state.transform.k")/p(t,"store.state.initialScale"):1});R(this,"getLoc",t=>this.longLatToPoint(t.longlat));let a=this;a.svg=t.svg,a.options=t||{},a.default_nodesize=a.options.default_nodesize||12,a.charge=a.options.charge||-300,a.edge_distance=a.options.edge_distance||80,a.node_types=a.options.node_types||{},a.onNodeSelected=typeof a.options.onNodeSelected<"u"?a.options.onNodeSelected:function(){},a.onNodeUnSelected=typeof a.options.onNodeUnSelected<"u"?a.options.onNodeUnSelected:function(){},a._selected_node_id=null,a._mousedown_edge=null,a._mousedown_node=null,a._mouseup_node=null,a._lastKeyDown=-1,a.container=a.svg.append("svg:g").classed("graph-editor",!0).style("pointer-events","all"),a.container.append("svg:defs").append("svg:marker").attr("id","end-arrow").attr("viewBox","0 -5 10 10").attr("refX",5).attr("markerWidth",3).attr("markerHeight",3).attr("orient","auto").style("fill",y.gray(20)).append("svg:path").attr("d","M0,-5L10,0L0,5"),a.dragLine=a.container.append("svg:path").attr("class","link dragline hidden").attr("d","M0,0L0,0"),a.path=a.container.append("svg:g").selectAll("path"),a.circle=a.container.append("svg:g").selectAll("g"),a.drag=y.drag().filter(r=>r.button===0||r.button===2).on("drag",(r,s)=>{s.longlat=a.pointToLongLat([r.x,r.y]),a.update()}).on("end",()=>a.store.dispatch("stateChange")),y.select(window).on("mousemove.graph-editor",a.mousemove.bind(a)).on("keydown.graph-editor",a.keydown.bind(a)).on("keyup.graph-editor",a.keyup.bind(a)),a.svg.on("click.graph-editor",a.mousedown_addNode.bind(a)).on("mouseup.graph-editor",a.mouseup.bind(a)).on("mouseenter",a.mouseenter.bind(a)).on("mouseleave",a.mouseleave.bind(a))}subscribe(){let t=this;t.store.events.subscribe("isConstNodeArea",()=>t.toggleConstNodeArea()),t.store.events.subscribe("changedTransform",()=>t.update()),t.store.events.subscribe("editorUpdate",()=>{t.update()}),t.store.events.subscribe("newGraph",()=>{t.update()}),t.store.events.subscribe("setRefDataQuery",()=>{t.update()}),t.store.events.subscribe("setDesignStormQuery",()=>{t.update()})}get bbox(){return this.svg.node().getBoundingClientRect()}get width(){return this.bbox.width}get height(){return this.bbox.height}get transform(){return p(this,"store.state.transform")}get projection(){return p(this,"store.state.projection")}get editing_mode(){return p(this,"store.state.graph_edit_mode")}get graph(){return p(this,"store.state.graph")}get_node_by_id(t){return this.graph.nodes.find(a=>a.id===t)}pointToLongLat(t){let a=this;return a.projection.invert(a.transform.invert(t))}longLatToPoint(t){let a=this;return a.transform.apply(a.projection(t))}recalculateNodeSize(t){let a=this;return Math.max(3,t.size*a.getScale())*(t.id===a._selected_node_id?1.3:1)}getColor(t){let a=this;if(t!=null&&t.color)return y.rgb(t.color);let r=p(a.store.state.node_types,t.node_type);return y.rgb((r==null?void 0:r.color)||"lightgrey")}tick(){let t=this;t.path.attr("d",a=>{const r=a.target.x-a.source.x,s=a.target.y-a.source.y,n=Math.sqrt(r*r+s*s),c=r/n,_=s/n,u=t.recalculateNodeSize(a.source),o=5+t.recalculateNodeSize(a.target),l=a.source.x+u*c,d=a.source.y+u*_,f=a.target.x-o*c,h=a.target.y-o*_;return r*(f-l)<0||s*(h-d)<0?`M${a.source.x},${a.source.y}L${a.target.x},${a.target.y}`:`M${l},${d}L${f},${h}`}),t.circle.selectAll(".node").attr("r",a=>t.recalculateNodeSize(a)*.95),t.circle.attr("transform",a=>`translate(${a.x},${a.y})`)}getState(t){var c;let r=p(this,"store.state.state_query"),s="undefined",n;return r!=null?(n=r.features.find(_=>y.geoContains(_,t)),((c=n==null?void 0:n.properties)==null?void 0:c.name)||"undefined"):s}getDesignStormDepth(t){var n;let r=p(this,"store.state.design_storm_geojson"),s;if(r!=null)return s=r.features.find(c=>y.geoContains(c,t)),(n=s==null?void 0:s.properties)==null?void 0:n[r._field]}getRefDataKey(t){var n;let r=p(this,"store.state.ref_data_key_geojson"),s;if(r!=null)return s=r.features.find(c=>y.geoContains(c,t)),(n=s==null?void 0:s.properties)==null?void 0:n[r._field]}setNodeDefaults(t){let a=this;t.map(r=>r!=null&&r.size?r:Object.assign(r,{size:a.default_nodesize})),t.map(r=>r!=null&&r.longlat?r:Object.assign(r,{longlat:a.pointToLongLat([r.x,r.y])})),t.map(r=>{let[s,n]=a.longLatToPoint(r.longlat);return r.x=s,r.y=n,r}),t.map(r=>(r.state=a.getState(r.longlat),r)),t.map(r=>{var s;if(!((s=r==null?void 0:r.node_type)!=null&&s.includes("land_surface"))){let n=a.getDesignStormDepth(r.longlat);if(n==null)return r;r.design_storm_depth_inches=+parseFloat(n).toFixed(2),r!=null&&r.data&&(r.data.design_storm_depth_inches=r.design_storm_depth_inches)}return r}),t.map(r=>{var s;if(!((s=r==null?void 0:r.node_type)!=null&&s.includes("land_surface"))){let n=a.getRefDataKey(r.longlat);if(n==null)return r;r.ref_data_key=n,r!=null&&r.data&&(r.data.ref_data_key=r.ref_data_key)}return r})}update(){let t=this,a;a=t.graph.nodes,t.setNodeDefaults(a),t.path=t.path.data(t.graph.edges),t.path.classed("selected",s=>s===t._selected_edge).style("marker-end","url(#end-arrow)"),t.path.exit().remove(),t.path=t.path.enter().append("svg:path").classed("link",!0).classed("selected",s=>s===t._selected_edge).style("marker-end","url(#end-arrow)").on("mousedown",(s,n)=>{s.ctrlKey||(t._mousedown_edge=n,t._selected_edge=t._mousedown_edge===t._selected_edge?null:t._mousedown_edge,t._selected_node_id=null,t.update())}).merge(t.path),t.circle=t.circle.data(a,s=>JSON.stringify(s)),t.circle.selectAll(".node").attr("r",s=>t.recalculateNodeSize(s)).style("fill",s=>{let n=t.getColor(s);return s.id===t._selected_node_id?n.brighter(3):n}).style("stroke",s=>t.getColor(s).darker().toString()),t.circle.selectAll("text").text(s=>s.id),t.circle.exit().remove();const r=t.circle.enter().append("svg:g");r.append("circle").classed("node has-tooltip",!0).attr("r",s=>t.recalculateNodeSize(s)).style("fill",s=>{let n=t.getColor(s);return s.id===t._selected_node_id?n.brighter(3):n}).style("stroke",s=>t.getColor(s).darker().toString()).on("mouseover",function(s,n){t._hovered_node=n,t.store.dispatch("isNodeHovered",{node_hovered:n.id}),!t._selected_node_id&&(p(t,"store.state.current_node_data.id"),n.id),!(!t._mousedown_node||n.id===t._mousedown_node.id)&&y.select(s.target).attr("transform","scale(1.25)")}).on("mouseout",(s,n)=>{t._hovered_node=void 0,t.store.dispatch("isNodeHovered",{node_hovered:void 0}),!(!t._mousedown_node||n.id===t._mousedown_node.id)&&y.select(s.target).attr("transform","")}).on("mousedown",(s,n)=>{s.shiftKey||s.ctrlKey||(t.store.dispatch("drag_lock",{drag_lock:!0}),t._mousedown_node=n,t._mousedown_node.id===t._selected_node_id?(t._selected_node_id=null,t.onNodeUnSelected(n),t.store.dispatch("changedSelectedNode",{selected_node_id:null})):(t._selected_node_id=t._mousedown_node.id,m.dispatch("changedSelectedNode",{selected_node_id:n.id}),t.onNodeSelected(n)),t._selected_edge=null,t.update())}).on("mouseup",(s,n)=>{if(t.dragLine.classed("hidden",!0).style("marker-end",""),t.store.dispatch("drag_lock",{drag_lock:!1}),!t._mousedown_node||!t.editing_mode)return;if(t._mouseup_node=n,t._mouseup_node.id===t._mousedown_node.id){t.resetMouseVars();return}y.select(s.target).attr("transform","");const c=t._mousedown_node.id,_=t._mouseup_node.id,u=t.graph.edges.find(o=>o.source===c&&o.target===_);if(!u){let o=t.graph.nodes.find(d=>d.id===c),l=t.graph.nodes.find(d=>d.id===_);t.graph.edges.push({source:o,target:l})}t._selected_edge=u,t._selected_node_id=null,t.update()}),r.append("text").attr("x",0).attr("y","0.3rem").attr("class","id no-select align-middle text-center font-bold text-base pointer-events-none").text(s=>s.id),t.circle=r.merge(t.circle),t.tick()}zoom_to_group(t){let a=this;const r=a.container.node().getBBox(),[[s,n],[c,_]]=[[r.x,r.y],[r.x+r.width,r.y+r.height]];t==null&&(t=1);let u=a.transform.k;for(;t>0;)t-=1,u=Math.min(1<<28,u*(.9/Math.max((c-s)/a.width,(_-n)/a.height)));const o=[s+r.width/2,n+r.height/2];let l=p(a,"store.state.zoomTransform");a.svg.interrupt().transition().duration(800).call(l,y.zoomIdentity.translate(a.width/2,a.height/2).scale(-u).translate(...a.transform.invert(o)).scale(-1))}mouseenter(){this.svg.classed("listening-to-keys",!0)}mouseleave(){this.svg.classed("listening-to-keys",!1)}keydown(t){let a=this;if(a.svg.classed("listening-to-keys")&&(t.keyCode,t.keyCode===71&&a.zoom_to_group(),!!a.editing_mode)){if(t.keyCode===17){a.circle.call(a.drag),a.svg.classed("ctrl",!0);return}if(!(!this._selected_node_id&&!this._selected_edge))switch(t.keyCode){case 8:case 46:this._selected_node_id?(this.graph.nodes.splice(this.graph.nodes.map(r=>r.id).indexOf(this._selected_node_id),1),this.graph.spliceLinksForNode(this._selected_node_id)):this._selected_edge&&this.graph.edges.splice(this.graph.edges.indexOf(this._selected_edge),1),this._selected_edge=null,this._selected_node_id=null,a.store.dispatch("changedSelectedNode",{selected_node_id:null}),this.resetMouseVars(),this.update();break}}}keyup(t){let a=this;t.keyCode===17&&(a.circle.on(".drag",null),a.svg.classed("ctrl",!1))}mousedown_addNode(t){var u;let a=this;if(this.svg.classed("active",!0),t.shiftKey||t.ctrlKey||!a.editing_mode||a._mousedown_node||a._mousedown_edge||a._hovered_node){a.resetMouseVars();return}const r=y.pointer(t);let[s,n]=r,c=a.pointToLongLat([s,n]);const _={id:ne(5),x:s,y:n,size:a.default_nodesize,longlat:c};_.design_storm_depth_inches=+parseFloat(a.getDesignStormDepth(_.longlat)).toFixed(2),_.ref_data_key=a.getRefDataKey(_.longlat),this.graph.nodes.push(_),a.store.dispatch("changedSelectedNode",{selected_node_id:_.id}),a._selected_node_id=(u=this.graph.nodes.find(o=>o.id===_.id))==null?void 0:u.id,a.update(),a.mouseup()}mouseup(){if(this.svg.classed("active",!1),this._mousedown_node){this.dragLine.classed("hidden",!0).style("marker-end","");return}this.resetMouseVars()}mousemove(t){let a=this;if(!this._mousedown_node||!this.editing_mode)return;let{x:r,y:s}=p(this,"store.state.graph.nodes").find(c=>c.id===this._mousedown_node.id);a.dragLine.style("marker-end","url(#end-arrow)").classed("hidden",!1).attr("d",`M${a._mousedown_node.x},${a._mousedown_node.y}L${a._mousedown_node.x},${a._mousedown_node.y}`);const n=y.pointer(t,this.container.node());this.dragLine.attr("d",`M${r},${s}L${n[0]},${n[1]}`)}resetMouseVars(){this._mousedown_node=null,this._mouseup_node=null,this._mousedown_edge=null}_render(){let t=this;t.subscribe(),t.update(),t.zoom_to_group()}}class ft extends b{constructor(){super({store:m})}_render(){let e=this;e.svg=y.select("#map").append("svg").attr("viewBox",[0,0,y.select("#map").node().getBoundingClientRect().width,y.select("#map").node().getBoundingClientRect().height]),e.map=new ct({id:"map",svg:e.svg});const t=e.map.vector;e.states=new _t({vector:t}),e.designStorm=new pt({vector:t}),e.refData=new ut({vector:t}),e.graphEditor=new mt({svg:e.svg}),e.map.render(),e.states.render(),e.designStorm.render(),e.refData.render(),e.graphEditor.render()}}Ke();const I=new ft;class yt extends b{constructor(e){super({store:m});let t=this;t.parent_id=e.parent_id,t.id=e.id||""}get current_node_data(){let e=p(this,"store.state.selected_node_id")||p(this,"store.state.node_hovered");if(e)return p(this,"store.state.graph.nodes").find(t=>t.id===e)}get show_info_tooltip(){return p(this,"store.state.show_info_tooltip")}tooltip_move(e){let t=this.element.node().getBoundingClientRect().width,a=null,r=null;e.type=="touchstart"?(a=e.touches[0].pageX,r=e.touches[0].pageY):(a=e.pageX,r=e.pageY);let s=Math.max(0,window.innerWidth-aNode ID: ${t.id}`);let r=` - - Node Type: - ${t.node_type||"No Data"} - - `;a.select(".info-tooltip-content table").html(r);let s=Object.keys(t).filter(_=>_.charAt(0)==="_"),n=oe(t,[],s),c=`
${JSON.stringify(n,void 0,2)}
`;a.select(".info-tooltip-json").html(c)}_render(){let e=this,t=d3.select(`#${e.parent_id}`);e.element=t.append("div").attr("id",e.id||"").classed("transition-opacity opacity-0 tooltip rounded shadow-lg p-1 bg-gray-50",!0);let a=e.element.html("");a=a.append("div").classed("info-tooltip p-2",!0),a.append("div").classed("info-tooltip-header mt-2 uppercase text-lg font-bold",!0),a.append("div").classed("info-tooltip-content text-sm",!0).append("table"),a.select(".info-tooltip-content").append("div").classed("info-tooltip-json",!0),a.append("div").classed("info-tooltip-footer",!0),e.store.events.subscribe("stateChange",()=>this.update_contents())}}const ht=new yt({parent_id:"editor-info",id:"node-info-tooltip"});class gt extends b{constructor(e){super({store:m});let t=this;t.parent_id=e.parent_id,t.id=e.id||""}get show_tips(){return p(this,"store.state.graph_edit_mode")}hide(){let e=this.element;e.classed("opacity-100 h-auto",!1),e.classed("opacity-0 h-0",!0)}show(){let e=this.element;e.classed("opacity-100 h-auto",!0),e.classed("opacity-0 h-0",!1)}update_contents(){let e=this;if(!e.show_tips){e.hide();return}e.show()}_template(){return` -
- Edit Graph is Active -
-
- Click in the open space to add a node. - -
- Drag from one node to another to add an edge - -
- Click a node or an edge to select it. - -
- Press Ctrl & Drag a node to move the graph node layout. - Dragging will pin the node to the location. - -
- Press Delete to remove the selected node or edge. - This is possible only when the mouse is within the map editor. - -
- Press G to zoom the map to the graph extents. - -
- `}_render(){let e=this,t=d3.select(`#${e.parent_id}`);e.element=t.append("div").attr("id",e.id||"").classed("transition-opacity opacity-0 p-2 h-auto text-justify",!0).html(e._template()),this.update_contents(),e.store.events.subscribe("isGraphEditMode",()=>this.update_contents())}}const bt=new gt({parent_id:"editor-info",id:"editor-tips"});class j extends b{constructor(e){super({store:m});let t=this;t.id=e.id,t.title=e.title,t.icon=e.icon,t.callback=e.callback}_template(){return` - `}_render(){let e=this,t=y.select(`#${this.parent_id}-button-container`).append("div").classed("flex",!0),a=t.html();a+=this._template(),t.html(a),this.button=t.select(`button#${this.id}-button`),this.button.on("click",e.callback.bind(e))}}const vt=new j({id:"node_editor",title:"Configuration",icon:` - - - - `,callback:function(){this.store.dispatch("changedPanel",{active_panel:"node-editor-panel"})}}),wt=new j({id:"load_table",title:"Load from File",icon:` - - - - `,callback:function(){this.store.dispatch("changedPanel",{active_panel:"load-table-panel"})}}),kt=new j({id:"save_files",title:"Save Files",icon:` - - - - -`,callback:function(){this.store.dispatch("changedPanel",{active_panel:"save-files-panel"})}}),St=new j({id:"clear_scenario",title:"Clear Scenario",icon:` -
- - - - - -
-`,callback:function(){confirm("Are you sure you want to clear all data?")&&new F([],[])}}),xt=new j({id:"check_scenario",title:"Verify Inputs",icon:` -
- - - - - -
-`,callback:async function(){Promise.all([ae(),te()]).then(i=>{i.length;const e=i.filter(a=>a.alert_type.toLowerCase()=="error");if(e.length>0){let a=e[0];a.msg=`
${e.map(r=>r.msg).join("
")}
`,this.store.dispatch("raiseModal",{modal_content:a});return}if(i.filter(a=>a.alert_type.toLowerCase()=="success").length===i.length){let a={title:"Validation Successful",msg:"",alert_type:"success"};this.store.dispatch("raiseModal",{modal_content:a});return}}).catch(i=>{let e={title:"Validation Failed",msg:`
${JSON.stringify(i,void 0,2)}
`,alert_type:"error"};this.store.dispatch("raiseModal",{modal_content:e})})}}),Tt=new j({id:"run_scenario",title:"Run Scenario",icon:` -
- - - - - - -
-`,callback:async function(){var e;let i=await re();if(((e=i==null?void 0:i.status)==null?void 0:e.toLowerCase())==="success"){let t=p(i,"data.results")||[],a=p(i,"data.leaf_results")||[];this.store.dispatch("newResults",{results:t.concat(a)})}}}),$t=new j({id:"find_node",title:"Find",icon:` - - - - -`,callback:function(){this.store.dispatch("changedPanel",{active_panel:"find-node-panel"})}});class jt extends b{constructor(e){super({store:m,id:e.id,children:e.children})}_template(){return` -
-
- -
-
- `}_render(){this.element=y.select(`#${this.id}`),this.element.html(this._template())}}const Rt=new jt({id:"editor-menu",children:[$t,vt,wt,kt,St,xt,Tt]});class P extends b{constructor(e){super({store:m,id:e.id,children:e.children});let t=this;t.title=e.title,t.options=e}enter(){var r;let e=this,t=e.element;e.transition_direction="entering";let a;a=t.select(".drawer-overlay").node(),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-40"),a=t.select(".drawer-panel").node(),a.className=a.className.replace(/\btranslate-x-.+?\b/g,""),a.classList.add("translate-x-0"),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-100"),(r=e==null?void 0:e.options)!=null&&r.enter_callback&&e.options.enter_callback()}exit(){var r;let e=this,t=document.querySelector(`#${this.id}`),a;e.transition_direction="exiting",a=t.querySelector(".drawer-overlay"),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-0"),a=t.querySelector(".drawer-panel"),a.className=a.className.replace(/\btranslate-x-.+?\b/g,""),a.classList.add("translate-x-full"),(r=e==null?void 0:e.options)!=null&&r.exit_callback&&e.options.exit_callback()}_template(){return` -
- - -
- `}_render(){var a;let e=this;e.element=y.select(`#${this.id}`).append("div").classed("drawer-container",!0),e.element.html(this._template()),e.element.select(`#${this.id}-close-button`).on("click",this.exit.bind(this)),((a=this==null?void 0:this.children)==null?void 0:a.length)>0&&e.element.select(`#${this.id}-content`).html("");let t=e.element.select(".drawer-container").classed("hidden",!0);e.exit(),t.classed("hidden",!1)}}class Ft extends P{constructor(e){super(e);let t=this;t.store.events.subscribe("changedPanel",({active_panel:a})=>a==="find-node-panel"?t.enter():null)}}class Dt extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="node-editor-panel"?r.enter():null)}}class Et extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="load-table-panel"?r.enter():null)}}class Nt extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="save-files-panel"?r.enter():null)}}class At extends b{constructor({children:e}){super({store:m,children:e})}_template(){return` -
-
-
-
- `}_render(){y.select("body").append("div").html(this._template())}}class qt extends b{constructor(e){super({store:m,id:e.id});let t=this;t.primary_callback=a=>{Ct(a.find_node)},t.primary_button_label=e.primary_button_label||"Find"}_template_primary_button(){return this.primary_callback==null?"":``}_template(){return` -
- - -
-
-
- - -
- ${this._template_primary_button()} -
-
-
`}_render(){let e=this;e.element=d3.select(`#${e.parent_id}-content`).append("div"),e.element.html(e._template());let t=e.element.select("form");t.attr("method","get").on("submit",function(a){a.preventDefault(),t.selectAll("input").property("disabled",!1);const r=new FormData(a.target),s=q(Object.fromEntries(r.entries()));return e.primary_callback.bind(e)(s),!1})}}const Ot=new Ft({id:"find-node-drawer",title:"Find Node",children:[new qt({id:"find-node-ui"})],exit_callback:()=>{p(m,"state.graph.nodes").map(e=>_e(e)),m.dispatch("foundNodeIds",{}),m.dispatch("editorUpdate")}}),Lt=i=>{i.color="orange",i.size=40},_e=i=>{i.color=void 0,i.size=void 0},Ct=i=>{let e=p(m,"state.graph.nodes"),t=e.filter(r=>r.id.includes(i));e.map(r=>_e(r));let a=[];for(let r of t)r&&a.push(r);if(a.length){for(let r of a)Lt(r);m.dispatch("foundNodeIds",{found_node_ids:a.map(r=>r.id)})}m.dispatch("editorUpdate")};class It extends b{constructor(e){super({store:m})}get selected_node_id(){return p(this,"store.state.selected_node_id")}update(){let e=this.selected_node_id?`Node: ${this.selected_node_id.toString()}`:'
🡄 Select a Node in the Editor Map
';this.element.html(e)}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("text-lg font-bold pb-2",!0),e.update(),e.store.events.subscribe("changedSelectedNode",()=>e.update())}}class Mt extends b{constructor(e){super({store:m});let t=this;t.store.events.subscribe("changedSelectedNode",()=>t.update())}get nodes(){return p(this,"store.state.graph.nodes")}get selected_node_id(){return p(this,"store.state.selected_node_id")}toggleNodeType(){let e=this.element.select("input:checked").property("value");this.store.dispatch("nodeEditorType",{node_editor_type:e||"none"})}_template(){return` -
- - -
-
- - -
-
- - -
- -
- - -
- -
- - -
-
- - -
`}update(){let e=this;e.element.classed("hidden",e.selected_node_id==null);let t=this.nodes.find(a=>a.id===this.selected_node_id);e.element.select(`input[value=${(t==null?void 0:t.node_type)||"none"}]`).property("checked",!0).dispatch("change"),e.toggleNodeType()}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("hidden",!0),e.element.html(e._template()),e.element.selectAll("input").on("change",this.toggleNodeType.bind(this)),e.update()}}const Pt="modulepreload",Vt=function(i){return"/app/"+i},J={},pe=function(e,t,a){let r=Promise.resolve();if(t&&t.length>0){const s=document.getElementsByTagName("link");r=Promise.all(t.map(n=>{if(n=Vt(n),n in J)return;J[n]=!0;const c=n.endsWith(".css"),_=c?'[rel="stylesheet"]':"";if(!!a)for(let l=s.length-1;l>=0;l--){const d=s[l];if(d.href===n&&(!c||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${_}`))return;const o=document.createElement("link");if(o.rel=c?"stylesheet":Pt,c||(o.as="script",o.crossOrigin=""),o.href=n,document.head.appendChild(o),c)return new Promise((l,d)=>{o.addEventListener("load",l),o.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${n}`)))})}))}return r.then(()=>e()).catch(s=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=s,window.dispatchEvent(n),!n.defaultPrevented)throw s})};async function Wt(i,e){let a=Object.assign({data:[{}],clipboard:!0,clipboardPasteAction:"update",minHeight:100,autoResize:!1,layout:"fitData",responsiveLayout:!1,history:!0,tooltipsHeader:!0,footerElement:'',columns:[]},e),{default:r}=await pe(()=>import("./tabulator.es2015-fNsKARNq.js"),__vite__mapDeps([]));return new r(i,a)}class zt extends b{constructor(e){super({store:m})}get node_editor_type(){return p(this,"store.state.node_editor_type")}get selected_node(){let e=p(this,"store.state.selected_node_id");return p(this,"store.state.graph.nodes").find(a=>a.id===e)}landSurfaceTableOptions(){var a,r;let e=this,t=[{}];return(a=e.selected_node)!=null&&a.data?t=v(e.selected_node.data):t=[{node_id:(r=e.selected_node)==null?void 0:r.id}],{data:t,maxHeight:"500px",rowContextMenu:[{label:" Select Row",action:function(s,n){n.select()}},{label:" Add Row",action:function(s,n){var c;e.table.addRow({node_id:(c=e.selected_node)==null?void 0:c.id})}},{label:" Delete Row",action:function(s,n){n.delete()}}],initialSort:[{column:"surface_key",dir:"asc"}],columns:[{title:"Node Id",field:"node_id",editor:"input",editable:s=>s.getRow().getPosition()<1},{title:"Surface Key",field:"surface_key",editor:"input"},{title:"Area (acres)",field:"area_acres",hozAlign:"center",editor:!0,width:90},{title:"Impervious Area (acres)",field:"imp_area_acres",hozAlign:"center",editor:!0,width:90}]}}setCurrentNodeDataToTableData(){var r;if(!this.selected_node)return alert("no node selected"),!1;let e=v(this.table.getData()),t=this.selected_node,a=(r=e[0])==null?void 0:r.node_id;e.forEach(s=>s.node_id=a),t.node_type=this.node_editor_type,t.id!==a&&(t.id=a,m.dispatch("changedSelectedNode",{selected_node_id:a})),t.data=e,this.store.dispatch("newGraph"),this.update()}async buildLandSurfaceTable({id:e}){let t=this;t.element.select(`#${e}`).remove();let a=t.element.append("div").attr("id",e).classed("grid grid-cols-1 grid-rows-auto pt-8",!0);const r=e+"-landsurface-tabulator";let s=a.append("div").classed("flex flex-row p-2 gap-2",!0),n=s.append("button").classed("btn btn-gray flex flex-row",!0).html(` - - - - - - undo - `),c=s.append("button").classed("btn btn-gray flex flex-row",!0).html(` - redo - - - - - - - `);a.append("div").attr("id",r);let _=t.landSurfaceTableOptions();t.table=await Wt(`#${r}`,_),n.on("click",()=>t.table.undo()),c.on("click",()=>t.table.redo()),a.append("div").classed("flex flex-row justify-end py-4",!0).append("button").classed("btn btn-blue",!0).on("click",()=>{this.setCurrentNodeDataToTableData.bind(this)()}).text("Apply")}async update(){let e=this;if(e.node_editor_type!=="land_surface"){e.element.classed("hidden",!0);return}e.element.classed("hidden",!1);let t=`${e.parent_id}-content-editor`;await e.buildLandSurfaceTable({id:t})}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("mt-4",!0).classed("hidden",!0),e.update(),e.store.events.subscribe("nodeEditorType",()=>e.update()),e.store.events.subscribe("changedSelectedNode",()=>e.update()),e.store.events.subscribe("changedPanel",()=>e.update()),e.store.events.subscribe("newGraph",()=>e.update())}}class Bt extends b{constructor(e){super({store:m})}get node_editor_type(){return p(this,"store.state.node_editor_type")}get selected_node(){let e=p(this,"store.state.selected_node_id");return p(this,"store.state.graph.nodes").find(a=>a.id===e)}get config(){let{schema:e,facility_types:t,facility_type_map:a,facility_alias_map:r,facility_label_map:s}=p(this,"store.state");return{schema:e,facility_types:t,facility_type_map:a,facility_alias_map:r,facility_label_map:s}}update(){let e=this;e.element.html("").classed("flex flex-col w-full",!0),e.element.classed("hidden",e.node_editor_type!=="treatment_facility");let t=e.element.append("select").classed("px-2 my-4 h-8 border rounded-md",!0).attr("id","facility-picker").on("change",function(){var f,h,S,g,k,T;let s=e.element.select("#facility-picker").property("value");if(!s.length)return!1;let n=e.config.facility_type_map[s],c=v(p(e,"selected_node.data")||{});Array.isArray(c)&&(c={});let _={node_id:e.selected_node.id,facility_type:s,ref_data_key:((h=(f=e.selected_node)==null?void 0:f.data)==null?void 0:h.ref_data_key)||((S=e.selected_node)==null?void 0:S.ref_data_key),design_storm_depth_inches:((k=(g=e.selected_node)==null?void 0:g.data)==null?void 0:k.design_storm_depth_inches)||((T=e.selected_node)==null?void 0:T.design_storm_depth_inches)};_=Object.assign(c,_);const u=$=>{e.selected_node.node_type=e.node_editor_type,e.selected_node.data=Object.assign({facility_type:e.element.select("#facility-picker").property("value")},v($)),e.selected_node.id=$.node_id,e.store.dispatch("newGraph")};let o=p(e,"store.state.nereid_state"),l=p(e,"store.state.nereid_region"),d=p(e,`store.state.treatment_facility_fields.${o}.${l}`)||p(e,"store.state.treatment_facility_fields.state.region");console.log("tmnt facility fields:",d),Ut("#facility-form",e.config.schema[n],_,d.disabled,d.ignored,u.bind(e))});e.element.append("div").attr("id","facility-form");let a=v(e.config.facility_types||[]);a.unshift(""),t.selectAll("option").data(a).enter().append("option").attr("value",s=>s&&e.config.facility_label_map[s]).text(s=>s);let r=p(e,"selected_node.data.facility_type");r&&(e.element.select("#facility-picker").property("value",r),t.on("change")())}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div"),e.id=`${e.parent_id}-content-treatment-form`,e.element.attr("id",e.id),e.update(),e.store.events.subscribe("stateChange",()=>this.update())}}function Ut(i,e,t,a,r,s){let n=[...e.required],c=Object.keys(e.properties).filter(d=>!n.includes(d));n.push(...c);let _=[];for(const d of n.filter(f=>!r.includes(f))){let f=e.properties[d];f.name=d,_.push(f)}let u=y.select(i);u.html("");let o=u.append("form");o.attr("id",i.replace("#","")+"-form").attr("name",i.replace("#","")+"-form").attr("method","get").on("submit",function(d){d.preventDefault(),o.selectAll("input").property("disabled",!1);const f=new FormData(d.target),h=q(Object.fromEntries(f.entries()));return s&&s(h),!1}),o.selectAll("div").data(_).enter().append("div").classed("form-group flex flex-row w-full gap-4 text-sm my-4 h-8 items-center",!0).classed("required",d=>e.required.includes(d.name)).each(function(d,f){let h=e.required.includes(d.name),S=(d.description||d.name)+(h?" (required)":" (optional)"),g=y.select(this);g.append("label").classed("control-label py-2 flex w-1/2 ",!0).attr("title",S).text(d.title);let k;switch(d.type){case"string":k=g.append("input").attr("name",d.name).attr("id",d.name).attr("title",S).property("required",e.required.includes(d.name||"")).property("disabled",a.includes(d.name)).classed("border-2 rounded-md px-2 py-1",!0),k.attr("type","text").attr("pattern",d.pattern||".*").attr("value",d.example||d.default||"");break;case"number":k=g.append("input").attr("name",d.name).attr("id",d.name).attr("title",S).property("required",e.required.includes(d.name||"")).property("disabled",a.includes(d.name)).classed("border-2 rounded-md px-2 py-1",!0),k.attr("type","number").attr("step","0.001").attr("value",d.example||d.default||"");break;case"boolean":k=g.append("div").classed("flex flex-row",!0);for(let T of[!0,!1]){let $=d.name+T.toString(),H=k.append("div").classed("flex flex-row items-center",!0);H.append("input").classed("form-check-input p-2",!0).classed("p-2",!0).attr("type","radio").attr("name",d.name).attr("id",$).attr("title",S).property("checked",d.default==T).property("disabled",a.includes(d.name)).attr("value",T),H.append("label").classed("p-2",!0).attr("for",$).attr("title",S).text(T.toString())}break}});for(let[d,f]of Object.entries(t))if(["true","false"].includes(f))for(let h of["true","false"])y.select("#"+d+h).property("checked",f==h);else y.select("#"+d).property("value",f);let l=o.append("div").classed("flex justify-end",!0);l.append("div"),l.append("button").classed("btn btn-blue",!0).attr("type","submit").text("Apply")}const Ht=new It,Gt=new Mt,Jt=new zt,Kt=new Bt,Qt=new Dt({id:"node-editor-drawer",title:"Edit Nodes",children:[Ht,Gt,Jt,Kt]});class V extends b{constructor(e){super({store:m});let t=this;t.id=e.id,t.title=e.title,t.data=[{}],t.data_callback=e.data_callback||function(a){console.log("loaded data: ",a)},t.primary_callback=e.primary_callback||function(){console.log(`clicked primary button load files UI ${t.id}`)},t.primary_button_label=e.primary_button_label||"Apply",t.secondary_callback=e.secondary_callback||null,t.secondary_button_label=e.secondary_button_label||"Update"}_template_primary_button(){return this.primary_callback==null?"":``}_template_secondary_button(){return this.secondary_callback==null?"":``}_template(){return` -
-
${this.title}
- -
-
-
- - -
- ${this._template_secondary_button()} - ${this._template_primary_button()} -
-
-
`}loadFileAsJson(e,t){let a=e.target.files[0];if(!a.type.match("csv|excel|json")){alert("csv or json please");return}let r=this,s=new FileReader;s.onload=function(n){return function(c){let _;n.type.match("csv|excel")?_=y.csvParse(c.target.result):n.type.match("json")&&(_=JSON.parse(c.target.result)),_=Array.isArray(_)?_.map(u=>q(u)):_,r.data=_,e.target.value=""}}(a),s.readAsText(a)}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div"),e.element.html(e._template()),e.primary_button=e.element.select(`#${this.id}-primary-button`),e.primary_button.on("click",()=>{e.data_callback.bind(e)(e.data),e.primary_callback.bind(e)(),e.element.select(`#${this.id} label`)}),e.secondary_button=e.element.select(`#${this.id}-secondary-button`),e.secondary_button.on("click",()=>{e.data_callback.bind(e)(e.data),e.secondary_callback.bind(e)(),e.element.select(`#${this.id} label`)}),e.input=e.element.select(`#${this.id} input`),e.input.on("change",t=>{e.loadFileAsJson.bind(e)(t);let a=e.element.select(`#${this.id} label`);a.text(t.target.files[0].name),a.classed("font-bold",!0);let r=a.node();r.className=r.className.replace(/\btext-gray-.+?\b/g,""),r.classList.add("text-gray-700")})}}const Yt=new V({id:"graph-file-loader",title:"Load Graph (.csv)",primary_callback:M,secondary_callback:de,data_callback:function(e){let t=[...new Set(e.map(u=>u.source).concat(e.map(u=>u.target)))],a=v(this.store.state.graph.nodes.filter(u=>t.includes(u.id))||[{}]),r=a.map(u=>u.id),s=[],n=50,c=50,_;for(let u of t){if(r.includes(u))_=a.find(o=>o.id===u);else{let o=e.find(l=>l.source===u);_={id:u,x:+(o==null?void 0:o.x)||n+10*Math.random(),y:+(o==null?void 0:o.y)||c+10*Math.random()},(o!=null&&o.x||o!=null&&o.y)&&(_.fx=+(o==null?void 0:o.x),_.fy=+(o==null?void 0:o.y))}s.push(_)}this.store.dispatch("setStagedChanges",{staged_changes:{edges:e,nodes:s}})}}),Xt=new V({id:"land-surface-file-loader",title:"Load Land Surfaces (.csv)",primary_callback:M,data_callback:function(e){var _,u;let t=[...new Set(e.map(o=>o.node_id))],a=v(p(this,"store.state.graph.nodes")),r=v(p(this,"store.state.graph.edges")).map(o=>({source:o.source.id,target:o.target.id})),s=a.map(o=>o.id),n=[],c=()=>400*Math.random();for(let o of t){let l=e.filter(g=>g.node_id===o),d,f=B((_=l.filter(g=>g==null?void 0:g.long))==null?void 0:_.map(g=>+g.long)),h=B((u=l.filter(g=>g==null?void 0:g.lat))==null?void 0:u.map(g=>+g.lat)),S=l.map(({node_id:g,surface_key:k,area_acres:T,imp_area_acres:$})=>({node_id:g,surface_key:k,area_acres:T,imp_area_acres:$}));s.includes(o)?(d=a.find(g=>g.id===o),d.node_type="land_surface",d.data=S,f&&h&&(d.longlat=[+f,+h])):(d={id:o,node_type:"land_surface",x:c(),y:c(),data:S},f&&h&&(d.longlat=[+f,+h]),n.push(d))}a=a.concat(n),this.store.dispatch("setStagedChanges",{staged_changes:{edges:r,nodes:a}})}}),Zt=new V({id:"treatment-facilities-file-loader",title:"Load Treatment Facilities (.csv)",primary_callback:M,data_callback:function(e){let t=[...new Set(e.map(_=>_.node_id))],a=v(p(this,"store.state.graph.nodes")||[{}]),r=v(p(this,"store.state.graph.edges")||[{}]).map(_=>({source:_.source.id,target:_.target.id})),s=a.map(_=>_.id),n=[],c=()=>400*Math.random();for(let _ of t){let u=e.find(f=>f.node_id===_),o,{long:l,lat:d}=u;s.includes(_)?(o=a.find(f=>f.id===_),o.data=u,o.node_type="treatment_facility",l&&d&&(o.longlat=[+l,+d])):(o={id:_,node_type:"treatment_facility",x:c(),y:c(),data:u},l&&d&&(o.longlat=[+l,+d]),n.push(o))}a=a.concat(n),this.store.dispatch("setStagedChanges",{staged_changes:{edges:r,nodes:a}})}}),ea=new V({id:"scenario-file-loader",title:"Load Scenario (.json)",primary_callback:M,secondary_callback:de,data_callback:function(e){let t=e.graph,a=e.name,r=v(t.nodes||[{}]);for(let n of r)n.id==null&&console.error("bad egg:",n);let s=t.edges.map(n=>({source:n.source.id,target:n.target.id}));this.store.dispatch("setStagedChanges",{staged_changes:{edges:s,nodes:r,scenario_name:a}})}}),ta=new Et({id:"load-table-drawer",title:"Load from File",children:[Yt,Xt,Zt,ea]});class aa extends b{constructor(e){super({store:m,id:e.id})}get scenario_name(){return p(this.store,"state.scenario_name")}get scenario(){return{name:this.scenario_name,graph:p(this,"store.state.graph")}}saveScenarioBlob(){let e={filename:(this.scenario.name.replaceAll(" ","_")||"scenario")+".json",json:JSON.stringify(this.scenario,void 0,2)},t=new Blob([e.json],{type:"text/plain;charset=utf-8"});W.saveAs(t,e.filename)}dumpScenario(){let e=`
${JSON.stringify(this.scenario,void 0,2)}
`;this.element.select("#dump-scenario-text").html(e)}clearScenario(){this.element.select("#dump-scenario-text").html("")}_template(){return` -
-
Save Scenario to File (json) - -
-
- Print Scenario for Review (json) - - -
-
-
- - `}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").attr("id",e.id),e.element.html(e._template()),e.button=e.element.select("#save-scenario"),e.button.on("click",e.saveScenarioBlob.bind(e)),e.button=e.element.select("#dump-scenario"),e.button.on("click",e.dumpScenario.bind(e)),e.button=e.element.select("#clear-scenario"),e.button.on("click",e.clearScenario.bind(e))}}class ra extends b{constructor(e){super({store:m,id:e.id})}get facility_types(){return Object.keys(p(this,"store.state.facility_type_map"))}get facility_type_map(){return p(this,"store.state.facility_type_map")}get schema(){return p(this,"store.state.schema")}get scenario_name(){return p(this.store,"state.scenario_name")}get facility_properties(){let e=new Set;for(let t of this.facility_types){let a=this.facility_type_map[t],r=this.schema[a];Object.keys(r.properties).forEach(e.add,e)}return["long","lat"].forEach(e.add,e),e}get facility_data(){let e=this.facility_properties,t=[],a=v(p(this,"store.state.graph.nodes")||[{}]).filter(r=>r.node_type=="treatment_facility");return a.length==0&&(a=[{}]),a.forEach(r=>{let s={};for(let c of e)s[c]=p(r.data,c)||"";let n=(r==null?void 0:r.longlat)||["",""];s.long=n[0],s.lat=n[1],t.push(s)}),t}facility_template(){let e=this,t=[],a=p(e,"store.state.nereid_state"),r=p(e,"store.state.nereid_region"),s=p(e,`store.state.treatment_facility_fields.${a}.${r}`),n=[...this.facility_properties].filter(c=>!s.ignored.includes(c));for(let[c,_]of Object.entries(this.facility_type_map)){let u=this.schema[_],o={};for(let l of n){let d=p(u.properties[l],"type")||"";u.required.includes(l)&&(d+="-req"),s.disabled.includes(l)&&(d+="-uneditable"),o[l]=d}o.long="number",o.lat="number",o.facility_type=c,t.push(o)}return t}saveTreatmentCSV(){let e=this.facility_data,a={filename:`${this.scenario_name.replaceAll(" ","-")}-treatment_facilities.csv`,csv:U({data:e})},r=new Blob([a.csv],{type:"text/plain;charset=utf-8"});W.saveAs(r,a.filename)}saveTreatmentTemplateCSV(){let e=this.facility_template(),t=p(this,"store.state.nereid_state"),a=p(this,"store.state.nereid_region"),r={filename:`${t}-${a}-treatment_facilities-template.csv`,csv:U({data:e})},s=new Blob([r.csv],{type:"text/plain;charset=utf-8"});W.saveAs(s,r.filename)}_template(){return` -
-
Save Treatment Facility Info to File (csv) - -
-
-
Save Treatment Facility Template to File (csv) - -
-
{}),e.element.select("#save-tmnt").on("click",e.saveTreatmentCSV.bind(e)),e.element.select("#save-tmnt-template").on("click",e.saveTreatmentTemplateCSV.bind(e))}}const sa=new aa({id:"save-scenario"}),ia=new ra({id:"save-tmnt-facility"}),na=new Nt({id:"save-files-drawer",title:"Save to File",children:[sa,ia]}),oa=new At({children:[Ot,Qt,ta,na]}),la=new at({id:"editor-tab",children:[dt,I,ht,bt,Rt,oa]});async function K(i,e){let a=Object.assign({data:[{}],maxHeight:"500px",minHeight:80,autoResize:!1,layout:"fitData",responsiveLayout:!1,history:!1,tooltipsHeader:!0,footerElement:'',columns:[],initialSort:[{column:"node_id",dir:"asc"}]},e),{default:r}=await pe(()=>import("./tabulator.es2015-fNsKARNq.js"),__vite__mapDeps([]));return r.prototype.extendModule("format","formatters",{gscwmp:function(s,n){let{precision:c}=n;return"before "+s.getValue()+` after ${c}`}}),new r(i,a)}class ue extends b{constructor(e){super({store:m,id:e.id});let t=this;t.table_builders=e.table_builders||[],t.tables=[]}get scenario_name(){return p(this.store,"state.scenario_name")}async buildResultsSummary({id:e,data:t,prep_fnx:a,title:r,description:s,filename_csv:n}){let c=this;c.element.select(`#${e}`).remove();let _=c.element.append("div").attr("id",e).classed("grid grid-cols-1 grid-rows-auto pt-8",!0),u=_.append("div").classed(" flex flex-row w-full justify-between items-center",!0);u.append("div").classed("font-bold",!0).html(r);const[o,l]=a(t);if(!o.length){_.append("div").classed("flex justify-center",!0).html("no results to show for this summary yet...");return}let d=u.append("div").classed("py-2",!0).append("button").text("Download Data (csv)").classed("btn btn-blue",!0);s!=null&&_.append("div").html(s);const f=e+"-results-tabulator";_.append("div").attr("id",f);let h=await K(`#${f}`,{data:o,columns:l.map(g=>{let k={title:g.replaceAll("_"," "),field:g,titleDownload:g};return["_acres","_coeff","_load","_pct","_conc","_lbs","_cuft","_cfs","_mpn","_inhr"].some($=>g.includes($))&&(k.formatter="money",k.formatterParams={precision:2}),g.includes("_pct")&&(k.formatterParams={precision:2,symbol:"%",symbolAfter:"p"}),g.includes("_mpn")&&(k.formatterParams={precision:0}),k})});c.tables.push(h);let S=c.scenario_name.replaceAll(" ","-");d.on("click",()=>h.download("csv",S+"-"+n))}async update(e){let t=this;e=e||[],t.element.html(""),(e==null?void 0:e.length)>0&&t.element.append("div").append("button").classed("btn btn-blue",!0).text("Download All Data Summaries (xlsx)").on("click",async()=>{let r={};t.element.selectAll("[id$='-results-tabulator']").nodes().forEach(n=>{let c=y.select(n).attr("id"),_=c.replace("-results-tabulator","").replace("table-","").replace("facility-","bmp-").slice(0,30);c.includes("table-all-data")||(r[_]="#"+c)}),t.element.select("#dummy_table").remove(),t.element.append("div").attr("id","dummy_table").classed("hidden",!0),(await K("#dummy_table")).download("xlsx","AllData.xlsx",{sheets:r})}),O();try{for(let a of t.table_builders)await t.buildResultsSummary(a(e))}finally{L()}}_template(){return` -
Click 'Run Scenario' in the Editor to calculate results.
- `}_render(){let e=this;e.element=y.select(`#${e.id}`).classed("relative flex justify-center",!0).append("div").classed("flex flex-col relative max-w-screen-md py-10 ",!0).html(e._template()),e.store.events.subscribe("newResults",({results:t})=>e.update(t)),e.store.events.subscribe("changedTab",({current_tab:t})=>{if(t===e.id){let a=p(e,"store.state.results");e.update(a)}})}}const da=i=>({data:i,id:"table-facility-design-summary",title:"Facility design Summary",filename_csv:"facility_design_summary.csv",prep_fnx:t=>{const a=["node_id","facility_type","valid_model","design_intensity_inhr","design_volume_cuft_cumul"];return[(t||[]).filter(s=>s.node_type).filter(s=>s.node_type.includes("facility")).map(s=>Object.fromEntries(Object.entries(s).filter(([n,c])=>a.includes(n)))),a]}}),ca=i=>({data:i,id:"table-facility-wet-weather-capture",title:"Facility Wet Weather Volume Capture Results",filename_csv:"wet_weather_volume_capture_results.csv",prep_fnx:t=>{const a=["node_id","facility_type","valid_model","captured_pct","treated_pct","retained_pct","bypassed_pct","peak_flow_mitigated_pct"];return[(t||[]).filter(s=>s.node_type).filter(s=>s.node_type.includes("facility")).map(s=>Object.fromEntries(Object.entries(s).filter(([n,c])=>a.includes(n)))),a]}});function _a(i){return{data:i,id:"table-facility-volume-reduction",title:"Facility Volume Reduction Results",filename_csv:"volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(h=>l.endsWith(`dry_weather_flow_cuft_${h}`)),f=r.some(h=>l.endsWith(`runoff_volume_cuft_${h}`));return d||f}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).sort((f,h)=>f.includes("winter")||f.includes("summer")?1:-1);o.push(...d)}return[_,o]}}}function pa(i){return{data:i,id:"table-facility-wet-weather-volume-reduction",title:"Facility Wet Weather Volume Reduction Results",filename_csv:"wet_weather_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>(r.some(f=>l.endsWith(`dry_weather_flow_cuft_${f}`)),r.some(f=>l.endsWith(`runoff_volume_cuft_${f}`)))),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l));o.push(...d)}return[_,o]}}}function ua(i){return{data:i,id:"table-facility-dry-weather-volume-reduction",title:"Facility Dry Weather Volume Reduction Results",description:"(calculated as total of summer + winter)",filename_csv:"dry_weather_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(f=>l.endsWith(`dry_weather_flow_cuft_${f}`));return r.some(f=>l.endsWith(`runoff_volume_cuft_${f}`)),d}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));for(let l of _)for(let d of r){let f=l[`summer_dry_weather_flow_cuft_${d}`],h=l[`winter_dry_weather_flow_cuft_${d}`];l[`total_dry_weather_volume_cuft_${d}`]=f+h}const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).sort((f,h)=>f.includes("total")||f.includes("winter")||f.includes("summer")?1:-1);o.push(...d)}return[_,o]}}}function ma(i){return{data:i,id:"table-facility-total-volume-reduction",title:"Facility Total Volume Reduction Results",description:"(calculated as total of results for wet + summer + winter)",filename_csv:"total_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(h=>l.endsWith(`dry_weather_flow_cuft_${h}`)),f=r.some(h=>l.endsWith(`runoff_volume_cuft_${h}`));return d||f}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));for(let l of _)for(let d of r){let f=l[`runoff_volume_cuft_${d}`],h=l[`summer_dry_weather_flow_cuft_${d}`],S=l[`winter_dry_weather_flow_cuft_${d}`];l[`total_volume_cuft_${d}`]=f+h+S}const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).filter(f=>f.includes("total"));o.push(...d)}return[_,o]}}}function fa(i){return{data:i,id:"table-facility-load-reduction",title:"Facility Load Reduction Results",description:`These results are separated in to wet weather results, - summer dry weather results, and winter dry weather results.`,filename_csv:"load_reduction_results.csv",prep_fnx:t=>{const a=["node_id"],r=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed");return a.includes(o)||l},n=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d});let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>r(l))));const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of n.sort()){let l=_.filter(d=>d.includes(o)).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}function ya(i){return{data:i,id:"table-facility-total-load-reduction",title:"Facility Total Load Reduction Results",description:"(calculated as total of results for wet + summer + dry)",filename_csv:"total_load_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const s=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d}),n=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed");return a.includes(o)||l};let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>n(l))));for(let o of c)for(let l of s){let d=o[l],f=o[`summer_dw${l}`],h=o[`winter_dw${l}`];o[`total_${l}`]=d+f+h}const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of s.sort()){let l=_.filter(d=>d.includes(o)).filter(d=>d.includes("total")).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}function ha(i){return{data:i,id:"table-facility-wet-weather-load-reduction",title:"Facility Wet Weather Load Reduction Results",filename_csv:"wet_weather_load_reduction_results.csv",prep_fnx:t=>{const a=function(n){let c=["node_id"].includes(n),_=n.endsWith("lbs_removed")||n.endsWith("mpn_removed"),u=n.includes("dw");return c||_&&!u};let r=(t||[]).filter(n=>n.node_type).filter(n=>n.node_type.includes("facility")).map(n=>Object.fromEntries(Object.entries(n).filter(([c,_])=>a(c))));const s=[...new Set(w(r.map(n=>Object.keys(n))))];return[r,s]}}}function ga(i){return{data:i,id:"table-facility-dry-weather-load-reduction",title:"Facility Dry Weather Load Reduction Results",description:`Includes summer dry weather, winter dry weather, and total dry - weather results (calculated as summer + winter)`,filename_csv:"dry_weather_load_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const s=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d}),n=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=o.includes("dw");return a.includes(o)||l&&d};let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>n(l))));for(let o of c)for(let l of s){let d=o[`summer_dw${l}`],f=o[`winter_dw${l}`];o[`total_dw${l}`]=d+f}const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of s.sort()){let l=_.filter(d=>d.includes(o)).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}const ba=i=>({data:i,id:"table-land-surface-summary",title:"Land Surface Summary",filename_csv:"land_surface_summary.csv",prep_fnx:t=>{let a=["node_id","area_acres","ro_coeff","imp_pct"];return[(t||[]).filter(s=>(s==null?void 0:s.land_surfaces_count)>0).map(s=>Object.fromEntries(Object.entries(s))),a]}}),va=i=>({data:i,id:"table-land-surface-load-summary",title:"Land Surface Loading Summary",filename_csv:"land_surface_load_summary.csv",prep_fnx:t=>{let a=["node_id"];const r=function(c){let _=c.endsWith("_load_lbs")||c.endsWith("_load_mpn");return a.includes(c)||_};let s=(t||[]).filter(c=>(c==null?void 0:c.land_surfaces_count)>0).map(c=>Object.fromEntries(Object.entries(c).filter(([_,u])=>r(_))));const n=[...new Set(w(s.map(c=>Object.keys(c))))];return console.log("landsurface load summary:",s),[s,n]}}),wa=[da,ca,_a,ma,pa,ua,fa,ya,ha,ga],ka=[ba,va],Sa=new ue({id:"treatment-facility-results-tab",table_builders:wa}),xa=new ue({id:"land-surface-results-tab",table_builders:ka});class Ta extends b{constructor(e){super({store:m,id:e.id})}_template(){return` -
-
-
- how to coming soon... -
-
-
- `}async fetch_page(){let e=this,t=`${m.state.nereid_host}/static/pages/how_to`;console.log(t),O(),fetch(t,{method:"GET"}).then(a=>{if(a.status_code===200)return a.text().then(function(r){e.element.select(".markdown_content").html(r)})}).finally(L)}_render(){let e=this;e.element=y.select(`#${e.id}`).classed("relative flex flex-col justify-center",!0).html(e._template()),e.fetch_page()}}const $a=new Ta({id:"how-to-tab"}),Q=new tt({children:[la,Sa,xa,$a]});async function ja(){await le(),Ye.render(),Q.render(),Ze.render(),window.nereid={tabs:Q,editor:I,util:Ge,nereidUtil:Ue,state:I.store.state},I.store.dispatch("updateConfig",{})}ja(); -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = [] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} diff --git a/nereid/nereid/static/frontend/dist/assets/index-pTGsNcoA.js b/nereid/nereid/static/frontend/dist/assets/index-pTGsNcoA.js new file mode 100644 index 00000000..385cb247 --- /dev/null +++ b/nereid/nereid/static/frontend/dist/assets/index-pTGsNcoA.js @@ -0,0 +1,707 @@ +var fe=Object.defineProperty;var ye=(i,e,t)=>e in i?fe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var F=(i,e,t)=>(ye(i,typeof e!="symbol"?e+"":e,t),t);import{j as he,D as ge,s as be,a as ve,b as we,e as ke,f as Se,g as xe,c as Te,d as $e,h as je,i as Re,k as Fe,q as De,l as Ee,t as Ne,m as Ae,n as qe,o as Oe,p as Le,r as Ce,z as Ie,u as Y,v as Me,F as W}from"./vendor-QiQdsv75.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const n of s.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&a(n)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();class Pe{constructor(){this.events={}}subscribe(e,t){let a=this;return a.events.hasOwnProperty(e)||(a.events[e]=[]),a.events[e].push(t),!0}publish(e,t={}){let a=this;return m.state.DEBUG&&console.log("published event: ",e),a.events.hasOwnProperty(e)?(a.events[e].map(r=>r(t)),!0):(m.state.DEBUG&&console.log(`no subscribers for event ${e}`),a.events[e]=[],!1)}}class z{constructor(e){let t=this;t.actions={},t.mutations={},t.state={},t.status="resting",t.events=new Pe,t.state=new Proxy(e.state||{},{set:function(a,r,s){return a[r]=s,m.state.DEBUG&&console.log(`stateChange: ${r}`,s),t.status!=="mutation"&&(m.state.DEBUG&&console.warn(`You should use a mutation to set ${r}`),t.events.publish("stateChange",t.state)),!0}})}dispatch(e,t){let a=this;return typeof a.actions[e]!="function"&&(m.state.DEBUG&&console.log(`Action "${e} doesn't exist.`),a.actions[e]=(r,s)=>{r.commit(e,s)}),m.state.DEBUG&&console.groupCollapsed(`ACTION: ${e}`),a.status="action",a.actions[e](a,t),m.state.DEBUG&&console.groupEnd(),!0}commit(e,t){let a=this;typeof a.mutations[e]!="function"&&(m.state.DEBUG&&console.log(`Mutation "${e}" doesn't exist`),a.mutations[e]=(s,n)=>n),a.status="mutation";let r=a.mutations[e](a.state,t);return a.state=Object.assign(a.state,r),a.events.publish("stateChange",a.state),a.events.publish(e,a.state),a.status="resting",!0}}const Ve={DEBUG:!1,config:{},scenario_name:"New Scenario",nereid_host:"",nereid_api_latest:"/api/v1",nereid_state:"state",nereid_region:"region",facility_types:[],facility_type_map:{},initialScale:1<<20,initialCenter:[-116.9337,32.74337],staged_changes:{},default_nodesize:20,max_graph_size:100,map_mode:!0,show_states:!0,graph_edit_mode:!0,show_info_tooltip:!0,treatment_facility_fields:{state:{region:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type"]}},ca:{cosd:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type","ref_data_key","design_storm_depth_inches"]},soc:{ignored:["is_online","offline_diversion_rate_cfs","eliminate_all_dry_weather_flow_override"],disabled:["facility_type"]}}},node_types:{land_surface:{title:"Land Surface",color:"limegreen"},treatment_facility:{title:"Treatment Facility",color:"steelblue"},treatment_site:{title:"Treatment Site",color:"orangered",disabled:!0},none:{title:"None",color:"dimgrey"}},default_graph:{nodes:[{id:"0",node_type:"treatment_facility"},{id:"1",node_type:"land_surface"}],edges:[{source:"1",target:"0"}]}},m=new z({state:Ve}),We=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="land_surface"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),X=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="treatment_facility"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),ze=()=>w((p(m,"state.graph.nodes")||[]).filter(i=>(i==null?void 0:i.node_type)==="treatment_site"&&(i==null?void 0:i.data)).map(i=>i==null?void 0:i.data)),Z=()=>({edges:(p(m,"state.graph.edges")||[]).map(e=>({source:e.source.id.toString(),target:e.target.id.toString()})),directed:!0,multigraph:!0}),Be=()=>({graph:Z(),land_surfaces:We()||[],treatment_facilities:X()||[],treatment_sites:ze()||[]}),j={getOpenApi:async i=>{let e;try{return e=await D(`${i}/openapi.json`),e}catch(t){return console.error(t),Ue}},getConfig:async(i,e,t)=>{var r,s;let a;try{return a=await D(`${i}/config?state=${e}®ion=${t}`),(s=(r=a==null?void 0:a.detail)==null?void 0:r.toLowerCase())!=null&&s.includes("no config")?(console.warn(`no config for ${e} ${t}`),G):a}catch(n){return console.error(n),G}},getReferenceData:async(i,e,t,a,r)=>{let s;try{return s=await D(`${i}${e}/reference_data_file?state=${t}®ion=${a}&filename=${r}`),s}catch(n){console.error(n)}},getTaskData:async(i,e,t)=>{let a;try{return a=await D(`${i}${e}/task/${t}`),a}catch(r){console.error(r)}},postValidateNetwork:async(i,e,t,a,r)=>{var c;let s=`${i}${e}/network/validate?state=${t}®ion=${a}`,n;try{return n=await C(s,r),(c=n==null?void 0:n.data)!=null&&c.isvalid?{title:"Validation Succeeded",msg:"Success",alert_type:"success"}:{title:"Validation Errors",msg:`
${JSON.stringify(n==null?void 0:n.data,void 0,2)}
`,alert_type:"error"}}catch(_){return{title:"Validation Error",msg:`
${JSON.stringify(_,void 0,2)}
`,alert_type:"error"}}},postValidateTreatmentFacilities:async(i,e,t,a,r)=>{var c,_;let s=`${i}${e}/treatment_facility/validate?state=${t}®ion=${a}`,n;try{n=await C(s,r);let u=[];for(let o of(c=n==null?void 0:n.data)==null?void 0:c.treatment_facilities)o!=null&&o.errors&&u.push(o==null?void 0:o.errors.replace(/\n/g," "));for(let o of(_=n==null?void 0:n.data)==null?void 0:_.errors)o.toLowerCase().substring(0,6).includes("error")&&u.push(o);return u.length==0?{title:"Validation Succeeded",msg:"",alert_type:"success"}:{title:"Validation Errors",msg:`
${JSON.stringify(u,void 0,2)}
`,alert_type:"error"}}catch(u){return{title:"Validation Error",msg:`
${JSON.stringify(u,void 0,2)}
`,alert_type:"error"}}},postSolveWatershed:async(i,e,t,a,r)=>{var c,_,u,o;let s=`${i}${e}/watershed/solve?state=${t}®ion=${a}`,n;try{if(n=await C(s,r),((_=(c=n==null?void 0:n.data)==null?void 0:c.errors)==null?void 0:_.length)==0)return n;if((n==null?void 0:n.data)==null&["pending","started"].includes((u=n==null?void 0:n.status)==null?void 0:u.toLowerCase())&(n==null?void 0:n.task_id)!=null)return n=await le({fn:()=>j.getTaskData(i,e,n.task_id),validate:l=>(l==null?void 0:l.data)!=null,interval_milli:333,maxAttempts:20}),n}catch(l){console.error(l)}return console.error(n,(o=n==null?void 0:n.data)==null?void 0:o.errors),n}},ee=async i=>{let{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await j.getReferenceData(e,t,a,r,i)}catch(n){console.error(n)}return s},te=async()=>{let i=Z(),{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await j.postValidateNetwork(e,t,a,r,i)}catch(n){console.error(n)}return s},ae=async()=>{let i={treatment_facilities:X()},{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await j.postValidateTreatmentFacilities(e,t,a,r,i)}catch(n){console.error(n)}return s},re=async()=>{let i=Be(),{nereid_host:e,nereid_api_latest:t,nereid_state:a,nereid_region:r}=p(m,"state"),s;try{s=await j.postSolveWatershed(e,t,a,r,i)}catch(n){console.error(n)}return s};function se(i,e){for(let t in i)if(typeof i[t]=="object"&&i[t]!==null)se(i[t],e);else if(t=="$ref"){let a=i[t].split("/").slice(-1).pop();a&&(delete i.$ref,i=Object.assign(i,e[a]))}}const ie=async({nereid_host:i,nereid_state:e,nereid_region:t})=>{i||(i=window.location.origin);const a=await j.getOpenApi(i),r=await j.getConfig(i,e,t),s=v(a.components.schemas);for(let l in s)se(s[l],s);const n=r.api_recognize.treatment_facility.facility_type,c={};for(const[l,d]of Object.entries(n))c[l]=d.validator;const _={};for(const[l,d]of Object.entries(n))if(d!=null&&d.alias)for(let f of d==null?void 0:d.alias)_[f]=l;else _[l]=l;const u={};for(const[l,d]of Object.entries(n))u[(d==null?void 0:d.label)||l]=l;const o=Object.keys(u);return{nereid_host:i,nereid_state:e,nereid_region:t,config:r,openapi:a,schema:s,facility_types:o,facility_type_map:c,facility_alias_map:_,facility_label_map:u}},G={default_data_directory:"default_data",project_data_directory:"project_data",version:"0.4.3",author:"Austin Orr",contact:"aorr@geosyntec.com",state:"state",region:"region",test:!0,pint_unit_registry:["MPN = count = mpn","_100ml = 100 * milliliter = _100mL"],api_recognize:{land_surfaces:{preprocess:[{expand_fields:[{field:"surface_key",sep:"-",new_column_names:["subbasin","land_use","soil","slope"]}]},{collapse_fields:[{new_column_name:"fuzzy_key",sep:"-",fields:["land_use"]}]},{joins:[{other:"land_surface_table",how:"left",left_on:"surface_key",right_on:"surface_id",validate:"many_to_one",indicator:!0,fuzzy_on:["fuzzy_key"]},{other:"land_surface_emc_table",how:"left",left_on:"land_use",right_on:"land_use",validate:"many_to_one",indicator:!0},{other:"dry_weather_land_surface_emc_table",how:"left",left_on:"land_use",right_on:"land_use",validate:"many_to_one",indicator:!0},{other:"met_table",how:"left",left_on:"subbasin",right_on:"subbasin",validate:"many_to_one",indicator:!0},{other:"dry_weather_flow_table",how:"left",left_on:"rain_gauge",right_on:"rain_gauge",validate:"many_to_one",indicator:!0}]},{remaps:[{left:"soil",right:"imp_pct",how:"addend",mapping:{water:100}},{left:"land_use",right:"is_developed",how:"left",fillna:!1,mapping:{COMM:!0,EDU:!0,IND:!0,UTIL:!0,RESSFH:!0,RESSFL:!0,RESMF:!0,TRFWY:!0,TRANS:!0,TROTH:!0}}]}]},treatment_facility:{preprocess:[{joins:[{other:"met_table",how:"left",left_on:"ref_data_key",right_on:"subbasin",validate:"many_to_one",indicator:!0}]},{remaps:[{left:"hsg",right:"inf_rate_inhr",how:"left",fillna:1e-6,mapping:{a:2.5,b:.8,c:.24,d:.024,lined:1e-6}}]}],facility_type:{no_treatment:{validator:"NTFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_extended_detention:{validator:"RetAndTmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Detention Basin"},infiltration:{validator:"RetentionFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},bioretention:{validator:"BioInfFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Biofiltration"},biofiltration:{validator:"TmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Biofiltration"},wet_detention:{validator:"PermPoolFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Wet Pond"},sand_filter:{validator:"TmntFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Sand Filter"},swale:{validator:"FlowAndRetFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Vegetated Swale"},hydrodynamic_separator:{validator:"FlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Hydrodynamic Separator"},dry_well:{validator:"DryWellFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},cistern:{validator:"CisternFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_weather_diversion:{validator:"DryWeatherDiversionLowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"},dry_weather_treatment:{validator:"DryWeatherTreatmentLowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"Sand Filter"},low_flow_facility:{validator:"LowFlowFacility",validation_fallback:"NTFacility",tmnt_performance_facility_type:"¯\\_(ツ)_/¯"}}}},project_reference_data:{dry_weather_flow_table:{file:"dry_weather_flow.json",seasons:{winter:["oct","nov","dec","jan","feb","mar"],summer:["apr","may","jun","jul","aug","sep"]}},met_table:{file:"met_data.json",volume_nomo:{x_col:"size_fraction",t_col:"ddt_hr",y_col:"capture_fraction"},flow_nomo:{x_col:"intensity_inhr",t_col:"tc_minutes",y_col:"performance_frac"},preprocess:[{remaps:[{left:"rain_gauge",right:"volume_nomograph",how:"left",mapping:{"100_LAGUNABEACH":"nomographs/100_LAGUNABEACH_volume_nomo.csv","1130_LAGUNA_AUDUBON":"nomographs/1130_LAGUNA_AUDUBON_volume_nomo.csv"}},{left:"rain_gauge",right:"flow_nomograph",how:"left",mapping:{"100_LAGUNABEACH":"nomographs/100_LAGUNABEACH_flow_nomo.csv","1130_LAGUNA_AUDUBON":"nomographs/1130_LAGUNA_AUDUBON_flow_nomo.csv"}}]}]},dry_weather_tmnt_performance_table:{file:"dry_weather_bmp_params.json",facility_column:"facility_type",pollutant_column:"pollutant",preprocess:[{remaps:[{left:"unit",right:"--",how:"replace",mapping:{"MPN/100mL":"MPN/_100ml","MPN/100 mL":"MPN/_100ml"}}]}]},tmnt_performance_table:{file:"bmp_params.json",facility_column:"facility_type",pollutant_column:"pollutant",preprocess:[{remaps:[{left:"unit",right:"--",how:"replace",mapping:{"MPN/100mL":"MPN/_100ml","MPN/100 mL":"MPN/_100ml"}}]}]},land_surface_table:{file:"land_surface_data.json"},land_surface_emc_table:{file:"land_surface_emc.json",parameters:[{long_name:"Total Suspended Solids",short_name:"TSS",concentration_unit:"mg/L",load_unit:"lbs"},{long_name:"Total Copper",short_name:"TCu",concentration_unit:"ug/L",load_unit:"lbs"},{long_name:"Fecal Coliform",short_name:"FC",concentration_unit:"MPN/_100mL",load_unit:"mpn"}]},dry_weather_land_surface_emc_table:{file:"dry_weather_land_surface_emc.json",parameters:[{long_name:"Dry Weather Total Suspended Solids",short_name:"dwTSS",concentration_unit:"mg/L",load_unit:"lbs"},{long_name:"Dry Weather Total Copper",short_name:"dwTCu",concentration_unit:"ug/L",load_unit:"lbs"},{long_name:"Dry Weather Fecal Coliform",short_name:"dwFC",concentration_unit:"MPN/_100mL",load_unit:"mpn"}]}},data_path:"nereid/data/default_data/state/region"},Ue={openapi:"3.0.2",info:{title:"nereid",version:"0.4.3"},paths:{"/api/v1/network/validate":{post:{tags:["network","validate"],summary:"Validate Network",operationId:"validate_network_api_v1_network_validate_post",requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Graph"},example:{directed:!0,nodes:[{id:"A"},{id:"B"}],edges:[{source:"A",target:"B"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/NetworkValidationResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/validate/{task_id}":{get:{tags:["network","validate"],summary:"Get Validate Network Result",operationId:"get_validate_network_result_api_v1_network_validate__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/NetworkValidationResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph":{post:{tags:["network","subgraph"],summary:"Subgraph Network",operationId:"subgraph_network_api_v1_network_subgraph_post",requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphRequest"},example:{graph:{directed:!0,edges:[{source:"3",target:"1"},{source:"5",target:"3"},{source:"7",target:"1"},{source:"9",target:"1"},{source:"11",target:"1"},{source:"13",target:"3"},{source:"15",target:"9"},{source:"17",target:"7"},{source:"19",target:"17"},{source:"21",target:"15"},{source:"23",target:"1"},{source:"25",target:"5"},{source:"27",target:"11"},{source:"29",target:"7"},{source:"31",target:"11"},{source:"33",target:"25"},{source:"35",target:"23"},{source:"4",target:"2"},{source:"6",target:"2"},{source:"8",target:"6"},{source:"10",target:"2"},{source:"12",target:"2"},{source:"14",target:"2"},{source:"16",target:"12"},{source:"18",target:"12"},{source:"20",target:"8"},{source:"22",target:"6"},{source:"24",target:"12"}]},nodes:[{id:"3"},{id:"29"},{id:"18"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph/{task_id}":{get:{tags:["network","subgraph"],summary:"Get Subgraph Network Result",operationId:"get_subgraph_network_result_api_v1_network_subgraph__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/subgraph/{task_id}/img":{get:{tags:["network","visualize"],summary:"Get Subgraph Network As Img",operationId:"get_subgraph_network_as_img_api_v1_network_subgraph__task_id__img_get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"},{required:!1,schema:{title:"Media Type",type:"string",default:"svg"},name:"media_type",in:"query"},{required:!1,schema:{title:"Npi",type:"number",default:4},name:"npi",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SubgraphResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence":{post:{tags:["network","sequence"],summary:"Network Solution Sequence",operationId:"network_solution_sequence_api_v1_network_solution_sequence_post",parameters:[{required:!1,schema:{title:"Min Branch Size",type:"integer",default:4},name:"min_branch_size",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Graph"},example:{directed:!0,edges:[{source:"3",target:"1"},{source:"5",target:"3"},{source:"7",target:"1"},{source:"9",target:"1"},{source:"11",target:"1"},{source:"13",target:"3"},{source:"15",target:"9"},{source:"17",target:"7"},{source:"19",target:"17"},{source:"21",target:"15"},{source:"23",target:"1"},{source:"25",target:"5"},{source:"27",target:"11"},{source:"29",target:"7"},{source:"31",target:"11"},{source:"33",target:"25"},{source:"35",target:"23"},{source:"4",target:"2"},{source:"6",target:"2"},{source:"8",target:"6"},{source:"10",target:"2"},{source:"12",target:"2"},{source:"14",target:"2"},{source:"16",target:"12"},{source:"18",target:"12"},{source:"20",target:"8"},{source:"22",target:"6"},{source:"24",target:"12"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence/{task_id}":{get:{tags:["network","sequence"],summary:"Get Network Solution Sequence",operationId:"get_network_solution_sequence_api_v1_network_solution_sequence__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/network/solution_sequence/{task_id}/img":{get:{tags:["network","sequence","visualize"],summary:"Get Network Solution Sequence As Img",operationId:"get_network_solution_sequence_as_img_api_v1_network_solution_sequence__task_id__img_get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"},{required:!1,schema:{title:"Media Type",type:"string",default:"svg"},name:"media_type",in:"query"},{required:!1,schema:{title:"Npi",type:"number",default:4},name:"npi",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/SolutionSequenceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data":{get:{tags:["reference_data"],summary:"Get Reference Data Json",operationId:"get_reference_data_json_api_v1_reference_data_get",parameters:[{required:!1,schema:{title:"Filename",type:"string",default:""},name:"filename",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/ReferenceDataResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data/nomograph":{get:{tags:["reference_data"],summary:"Get Nomograph",operationId:"get_nomograph_api_v1_reference_data_nomograph_get",parameters:[{required:!1,schema:{title:"Filename",type:"string",default:""},name:"filename",in:"query"},{required:!1,schema:{title:"Type",type:"string"},name:"type",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reference_data/{table}":{get:{tags:["reference_data"],summary:"Get Reference Data Table",operationId:"get_reference_data_table_api_v1_reference_data__table__get",parameters:[{required:!0,schema:{title:"Table",type:"string"},name:"table",in:"path"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/land_surface/loading":{post:{tags:["land_surface","loading"],summary:"Calculate Loading",operationId:"calculate_loading_api_v1_land_surface_loading_post",parameters:[{required:!1,schema:{title:"Details",type:"boolean",default:!1},name:"details",in:"query"},{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaces"},example:{land_surfaces:[{node_id:"1",surface_key:"10101100-RESMF-A-5",area_acres:1.834347898661638,imp_area_acres:1.430224547955745},{node_id:"0",surface_key:"10101100-OSDEV-A-0",area_acres:4.458327528535912,imp_area_acres:.4457209193544626},{node_id:"0",surface_key:"10101000-IND-A-10",area_acres:3.337086111390218,imp_area_acres:.47675887386582366},{node_id:"0",surface_key:"10101100-COMM-C-0",area_acres:.5641157902710026,imp_area_acres:.40729090799199347},{node_id:"1",surface_key:"10101200-TRANS-C-5",area_acres:.007787658410143283,imp_area_acres:.007727004694355631}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/land_surface/loading/{task_id}":{get:{tags:["land_surface","loading"],summary:"Get Land Surface Loading Result",operationId:"get_land_surface_loading_result_api_v1_land_surface_loading__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/LandSurfaceResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_facility/validate":{post:{tags:["treatment_facility","validate"],summary:"Initialize Treatment Facility Parameters",operationId:"initialize_treatment_facility_parameters_api_v1_treatment_facility_validate_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{title:"Treatment Facilities",anyOf:[{$ref:"#/components/schemas/TreatmentFacilities"},{$ref:"#/components/schemas/TreatmentFacilitiesStrict"}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentFacilitiesResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_facility/validate/{task_id}":{get:{tags:["treatment_facility","validate"],summary:"Get Treatment Facility Parameters",operationId:"get_treatment_facility_parameters_api_v1_treatment_facility_validate__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentFacilitiesResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treatment_site/validate":{post:{tags:["treatment_site","validate"],summary:"Initialize Treatment Site",operationId:"initialize_treatment_site_api_v1_treatment_site_validate_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentSites"},example:{treatment_sites:[{node_id:"WQMP-1a-tmnt",facility_type:"bioretention",area_pct:75,captured_pct:80,retained_pct:10},{node_id:"WQMP-1a-tmnt",facility_type:"nt",area_pct:25,captured_pct:0,retained_pct:0},{node_id:"WQMP-1b-tmnt",facility_type:"bioretention",area_pct:75,captured_pct:50,retained_pct:10},{node_id:"WQMP-1b-tmnt",facility_type:"nt",area_pct:25,captured_pct:0,retained_pct:0}]}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/TreatmentSiteResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/watershed/solve":{post:{tags:["watershed","main"],summary:"Post Solve Watershed",operationId:"post_solve_watershed_api_v1_watershed_solve_post",parameters:[{required:!1,schema:{title:"State",type:"string",default:"state"},name:"state",in:"query"},{required:!1,schema:{title:"Region",type:"string",default:"region"},name:"region",in:"query"}],requestBody:{content:{"application/json":{schema:{$ref:"#/components/schemas/Watershed"}}},required:!0},responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/WatershedResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/watershed/solve/{task_id}":{get:{tags:["watershed","main"],summary:"Get Watershed Result",operationId:"get_watershed_result_api_v1_watershed_solve__task_id__get",parameters:[{required:!0,schema:{title:"Task Id",type:"string"},name:"task_id",in:"path"}],responses:{200:{description:"Successful Response",content:{"application/json":{schema:{$ref:"#/components/schemas/WatershedResponse"}}}},422:{description:"Validation Error",content:{"application/json":{schema:{$ref:"#/components/schemas/HTTPValidationError"}}}}}}}},components:{schemas:{BioInfFacility:{title:"BioInfFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","retention_volume_cuft","area_sqft","media_filtration_rate_inhr","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},retention_volume_cuft:{title:"Retention Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},media_filtration_rate_inhr:{title:"Media Filtration Rate Inhr",type:"number"},hsg:{title:"Hsg",type:"string"}}},CisternFacility:{title:"CisternFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","winter_demand_cfs","summer_demand_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},winter_demand_cfs:{title:"Winter Demand Cfs",type:"number"},summer_demand_cfs:{title:"Summer Demand Cfs",type:"number"}}},DryWeatherDiversionLowFlowFacility:{title:"DryWeatherDiversionLowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},DryWeatherTreatmentLowFlowFacility:{title:"DryWeatherTreatmentLowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},DryWellFacility:{title:"DryWellFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","treatment_rate_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"}}},Edge:{title:"Edge",required:["source","target"],type:"object",properties:{source:{title:"Source",type:"string"},target:{title:"Target",type:"string"},metadata:{title:"Metadata",type:"object",default:{}}}},FlowAndRetFacility:{title:"FlowAndRetFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","treatment_rate_cfs","area_sqft","depth_ft","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},depth_ft:{title:"Depth Ft",type:"number"},hsg:{title:"Hsg",type:"string"}}},FlowFacility:{title:"FlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","treatment_rate_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5}}},Graph:{title:"Graph",required:["edges"],type:"object",properties:{edges:{title:"Edges",type:"array",items:{$ref:"#/components/schemas/Edge"}},nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}},directed:{title:"Directed",type:"boolean",default:!0},multigraph:{title:"Multigraph",type:"boolean",default:!0},type:{title:"Type",type:"string"},label:{title:"Label",type:"string"},metadata:{title:"Metadata",type:"object"}}},HTTPValidationError:{title:"HTTPValidationError",type:"object",properties:{detail:{title:"Detail",type:"array",items:{$ref:"#/components/schemas/ValidationError"}}}},LandSurface:{title:"LandSurface",required:["node_id","surface_key","area_acres","imp_area_acres"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},surface_key:{title:"Surface Key",type:"string",example:"104506-RESSFH-B-5"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"}}},LandSurfaceDetails:{title:"LandSurfaceDetails",required:["node_id","surface_key","area_acres","imp_area_acres","surface_id","perv_ro_depth_inches","imp_ro_depth_inches","perv_ro_coeff","imp_ro_coeff","perv_area_acres","imp_area_sqft","perv_area_sqft","imp_ro_depth_feet","perv_ro_depth_feet","imp_ro_volume_cuft","perv_ro_volume_cuft","runoff_volume_cuft","imp_eff_area_acres","perv_eff_area_acres","eff_area_acres"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},surface_key:{title:"Surface Key",type:"string"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"},surface_id:{title:"Surface Id",type:"string"},perv_ro_depth_inches:{title:"Perv Ro Depth Inches",type:"number"},imp_ro_depth_inches:{title:"Imp Ro Depth Inches",type:"number"},perv_ro_coeff:{title:"Perv Ro Coeff",type:"number"},imp_ro_coeff:{title:"Imp Ro Coeff",type:"number"},perv_area_acres:{title:"Perv Area Acres",type:"number"},imp_area_sqft:{title:"Imp Area Sqft",type:"number"},perv_area_sqft:{title:"Perv Area Sqft",type:"number"},imp_ro_depth_feet:{title:"Imp Ro Depth Feet",type:"number"},perv_ro_depth_feet:{title:"Perv Ro Depth Feet",type:"number"},imp_ro_volume_cuft:{title:"Imp Ro Volume Cuft",type:"number"},perv_ro_volume_cuft:{title:"Perv Ro Volume Cuft",type:"number"},runoff_volume_cuft:{title:"Runoff Volume Cuft",type:"number"},imp_eff_area_acres:{title:"Imp Eff Area Acres",type:"number"},perv_eff_area_acres:{title:"Perv Eff Area Acres",type:"number"},eff_area_acres:{title:"Eff Area Acres",type:"number"}}},LandSurfaceResponse:{title:"LandSurfaceResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/LandSurfaceResults"}}},LandSurfaceResults:{title:"LandSurfaceResults",required:["summary"],type:"object",properties:{summary:{title:"Summary",type:"array",items:{$ref:"#/components/schemas/LandSurfaceSummary"}},details:{title:"Details",type:"array",items:{$ref:"#/components/schemas/LandSurfaceDetails"}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},LandSurfaceSummary:{title:"LandSurfaceSummary",required:["node_id","area_acres","imp_area_acres","perv_area_acres","imp_ro_volume_cuft","perv_ro_volume_cuft","runoff_volume_cuft","eff_area_acres","land_surfaces_count","imp_pct","ro_coeff"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},area_acres:{title:"Area Acres",type:"number"},imp_area_acres:{title:"Imp Area Acres",type:"number"},perv_area_acres:{title:"Perv Area Acres",type:"number"},imp_ro_volume_cuft:{title:"Imp Ro Volume Cuft",type:"number"},perv_ro_volume_cuft:{title:"Perv Ro Volume Cuft",type:"number"},runoff_volume_cuft:{title:"Runoff Volume Cuft",type:"number"},eff_area_acres:{title:"Eff Area Acres",type:"number"},land_surfaces_count:{title:"Land Surfaces Count",type:"number"},imp_pct:{title:"Imp Pct",type:"number"},ro_coeff:{title:"Ro Coeff",type:"number"}}},LandSurfaces:{title:"LandSurfaces",required:["land_surfaces"],type:"object",properties:{land_surfaces:{title:"Land Surfaces",type:"array",items:{$ref:"#/components/schemas/LandSurface"}}}},LowFlowFacility:{title:"LowFlowFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},treatment_rate_cfs:{title:"Treatment Rate Cfs",type:"number"},design_capacity_cfs:{title:"Design Capacity Cfs",type:"number"},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},months_operational:{title:"Months Operational",pattern:"summer$|winter$|both$",type:"string",default:"both"}}},NTFacility:{title:"NTFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},NetworkValidation:{title:"NetworkValidation",required:["isvalid"],type:"object",properties:{isvalid:{title:"Isvalid",type:"boolean"},node_cycles:{title:"Node Cycles",type:"array",items:{type:"array",items:{type:"string"}}},edge_cycles:{title:"Edge Cycles",type:"array",items:{type:"array",items:{type:"string"}}},multiple_out_edges:{title:"Multiple Out Edges",type:"array",items:{type:"array",items:{type:"string"}}},duplicate_edges:{title:"Duplicate Edges",type:"array",items:{type:"array",items:{type:"string"}}}}},NetworkValidationResponse:{title:"NetworkValidationResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/NetworkValidation"}}},Node:{title:"Node",type:"object",properties:{id:{title:"Id",type:"string"},metadata:{title:"Metadata",type:"object",default:{}}}},Nodes:{title:"Nodes",required:["nodes"],type:"object",properties:{nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}}}},ParallelSeriesSequence:{title:"ParallelSeriesSequence",required:["parallel"],type:"object",properties:{parallel:{title:"Parallel",type:"array",items:{$ref:"#/components/schemas/SeriesSequence"}}}},PermPoolFacility:{title:"PermPoolFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","pool_volume_cuft","pool_drawdown_time_hr","treatment_volume_cuft","treatment_drawdown_time_hr","winter_demand_cfs","summer_demand_cfs"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},pool_volume_cuft:{title:"Pool Volume Cuft",type:"number"},pool_drawdown_time_hr:{title:"Pool Drawdown Time Hr",type:"number"},treatment_volume_cuft:{title:"Treatment Volume Cuft",type:"number"},treatment_drawdown_time_hr:{title:"Treatment Drawdown Time Hr",type:"number"},winter_demand_cfs:{title:"Winter Demand Cfs",type:"number"},summer_demand_cfs:{title:"Summer Demand Cfs",type:"number"}}},PreviousResult:{title:"PreviousResult",required:["node_id"],type:"object",properties:{node_id:{title:"Node Id",type:"string"}}},ReferenceData:{title:"ReferenceData",required:["state","region","file"],type:"object",properties:{state:{title:"State",type:"string"},region:{title:"Region",type:"string"},file:{title:"File",type:"string"},filedata:{title:"Filedata"}}},ReferenceDataResponse:{title:"ReferenceDataResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/ReferenceData"}}},Result:{title:"Result",required:["node_id"],type:"object",properties:{node_id:{title:"Node Id",type:"string"}}},RetAndTmntFacility:{title:"RetAndTmntFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","retention_volume_cuft","area_sqft","treatment_drawdown_time_hr","hsg"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},retention_volume_cuft:{title:"Retention Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},treatment_drawdown_time_hr:{title:"Treatment Drawdown Time Hr",type:"number"},hsg:{title:"Hsg",type:"string"}}},RetentionFacility:{title:"RetentionFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","area_sqft","inf_rate_inhr"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},inf_rate_inhr:{title:"Inf Rate Inhr",type:"number"}}},SeriesSequence:{title:"SeriesSequence",required:["series"],type:"object",properties:{series:{title:"Series",type:"array",items:{$ref:"#/components/schemas/Nodes"}}}},SolutionSequence:{title:"SolutionSequence",required:["solution_sequence"],type:"object",properties:{solution_sequence:{$ref:"#/components/schemas/ParallelSeriesSequence"}}},SolutionSequenceResponse:{title:"SolutionSequenceResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/SolutionSequence"}}},SubgraphNodes:{title:"SubgraphNodes",required:["subgraph_nodes"],type:"object",properties:{subgraph_nodes:{title:"Subgraph Nodes",type:"array",items:{$ref:"#/components/schemas/Nodes"}}}},SubgraphRequest:{title:"SubgraphRequest",required:["graph","nodes"],type:"object",properties:{graph:{$ref:"#/components/schemas/Graph"},nodes:{title:"Nodes",type:"array",items:{$ref:"#/components/schemas/Node"}}}},SubgraphResponse:{title:"SubgraphResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/SubgraphNodes"}}},TmntFacility:{title:"TmntFacility",required:["node_id","facility_type","ref_data_key","design_storm_depth_inches","total_volume_cuft","area_sqft","media_filtration_rate_inhr"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},ref_data_key:{title:"Ref Data Key",type:"string"},design_storm_depth_inches:{title:"Design Storm Depth Inches",exclusiveMinimum:0,type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1},is_online:{title:"Is Online",type:"boolean",default:!0},tributary_area_tc_min:{title:"Tributary Area Tc Min",maximum:60,type:"number",default:5},offline_diversion_rate_cfs:{title:"Offline Diversion Rate Cfs",type:"number"},total_volume_cuft:{title:"Total Volume Cuft",type:"number"},area_sqft:{title:"Area Sqft",type:"number"},media_filtration_rate_inhr:{title:"Media Filtration Rate Inhr",type:"number"}}},TreatmentFacilities:{title:"TreatmentFacilities",required:["treatment_facilities"],type:"object",properties:{treatment_facilities:{title:"Treatment Facilities",type:"array",items:{type:"object"}},errors:{title:"Errors",type:"array",items:{type:"string"}}},example:{treatment_facilities:[{node_id:"1",facility_type:"no_treatment",ref_data_key:"10101200",design_storm_depth_inches:1.45},{node_id:"1",facility_type:"dry_extended_detention",ref_data_key:"10101200",design_storm_depth_inches:1.05,is_online:!0,tributary_area_tc_min:30,total_volume_cuft:5500,retention_volume_cuft:4400,area_sqft:1600,treatment_drawdown_time_hr:72,hsg:"d",offline_diversion_rate_cfs:2.9,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"infiltration",ref_data_key:"10101200",design_storm_depth_inches:.88,is_online:!0,tributary_area_tc_min:25,total_volume_cuft:6200,area_sqft:2e3,inf_rate_inhr:3.5,offline_diversion_rate_cfs:5,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"bioretention",ref_data_key:"10101200",design_storm_depth_inches:.85,is_online:!0,tributary_area_tc_min:15,total_volume_cuft:5800,retention_volume_cuft:3500,area_sqft:1300,media_filtration_rate_inhr:12,hsg:"a",offline_diversion_rate_cfs:6,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"biofiltration",ref_data_key:"10101200",design_storm_depth_inches:.95,is_online:!0,tributary_area_tc_min:40,total_volume_cuft:4400,area_sqft:1200,media_filtration_rate_inhr:15,offline_diversion_rate_cfs:6,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"wet_detention",ref_data_key:"10101200",design_storm_depth_inches:.78,is_online:!0,tributary_area_tc_min:45,pool_volume_cuft:5550,pool_drawdown_time_hr:720,treatment_volume_cuft:2500,treatment_drawdown_time_hr:12,winter_demand_cfs:.05,summer_demand_cfs:.88,offline_diversion_rate_cfs:4,eliminate_all_dry_weather_flow_override:!1},{node_id:"1",facility_type:"sand_filter",ref_data_key:"10101200",design_storm_depth_inches:.78,total_volume_cuft:5e3,area_sqft:2700,media_filtration_rate_inhr:12,is_online:!0,offline_diversion_rate_cfs:2.1,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:20},{node_id:"1",facility_type:"swale",ref_data_key:"10101200",design_storm_depth_inches:1,treatment_rate_cfs:.55,area_sqft:15600,depth_ft:1.5,hsg:"b",is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:25},{node_id:"1",facility_type:"hydrodynamic_separator",ref_data_key:"10101200",design_storm_depth_inches:1.12,treatment_rate_cfs:.2,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:50,is_online:!0},{node_id:"1",facility_type:"dry_well",ref_data_key:"10101200",design_storm_depth_inches:.85,total_volume_cuft:800,treatment_rate_cfs:.5,is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:5},{node_id:"1",facility_type:"cistern",ref_data_key:"10101200",design_storm_depth_inches:1.3,total_volume_cuft:5500,winter_demand_cfs:.05,summer_demand_cfs:.25,is_online:!0,offline_diversion_rate_cfs:.5,eliminate_all_dry_weather_flow_override:!1,tributary_area_tc_min:55},{node_id:"1",facility_type:"dry_weather_diversion",ref_data_key:"10101200",design_storm_depth_inches:1.43,design_capacity_cfs:3.5,months_operational:"summer",tributary_area_tc_min:30,treatment_rate_cfs:2.92,eliminate_all_dry_weather_flow_override:!1,is_online:!0},{node_id:"1",facility_type:"dry_weather_treatment",ref_data_key:"10101200",design_storm_depth_inches:1.32,design_capacity_cfs:6.1,months_operational:"summer",tributary_area_tc_min:10,treatment_rate_cfs:3.5,eliminate_all_dry_weather_flow_override:!1,is_online:!0},{node_id:"1",facility_type:"low_flow_facility",ref_data_key:"10101200",design_storm_depth_inches:.91,design_capacity_cfs:5.1,months_operational:"summer",tributary_area_tc_min:20,treatment_rate_cfs:5,eliminate_all_dry_weather_flow_override:!1,is_online:!0}]}},TreatmentFacilitiesResponse:{title:"TreatmentFacilitiesResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/TreatmentFacilities"}}},TreatmentFacilitiesStrict:{title:"TreatmentFacilitiesStrict",required:["treatment_facilities"],type:"object",properties:{treatment_facilities:{title:"Treatment Facilities",type:"array",items:{anyOf:[{$ref:"#/components/schemas/PermPoolFacility"},{$ref:"#/components/schemas/RetAndTmntFacility"},{$ref:"#/components/schemas/BioInfFacility"},{$ref:"#/components/schemas/FlowAndRetFacility"},{$ref:"#/components/schemas/RetentionFacility"},{$ref:"#/components/schemas/TmntFacility"},{$ref:"#/components/schemas/CisternFacility"},{$ref:"#/components/schemas/DryWellFacility"},{$ref:"#/components/schemas/DryWeatherTreatmentLowFlowFacility"},{$ref:"#/components/schemas/DryWeatherDiversionLowFlowFacility"},{$ref:"#/components/schemas/LowFlowFacility"},{$ref:"#/components/schemas/FlowFacility"},{$ref:"#/components/schemas/NTFacility"}]}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},TreatmentSite:{title:"TreatmentSite",required:["node_id","facility_type","area_pct","captured_pct","retained_pct"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},area_pct:{title:"Area Pct",type:"number"},captured_pct:{title:"Captured Pct",type:"number"},retained_pct:{title:"Retained Pct",type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},TreatmentSiteGroup:{title:"TreatmentSiteGroup",required:["node_id","node_type","treatment_facilities"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},node_type:{title:"Node Type",type:"string"},treatment_facilities:{title:"Treatment Facilities",type:"array",items:{$ref:"#/components/schemas/TreatmentSiteGroupBase"}},errors:{title:"Errors",type:"array",items:{type:"string"}}}},TreatmentSiteGroupBase:{title:"TreatmentSiteGroupBase",required:["node_id","facility_type","area_pct","captured_pct","retained_pct"],type:"object",properties:{node_id:{title:"Node Id",type:"string"},facility_type:{title:"Facility Type",type:"string"},area_pct:{title:"Area Pct",type:"number"},captured_pct:{title:"Captured Pct",type:"number"},retained_pct:{title:"Retained Pct",type:"number"},eliminate_all_dry_weather_flow_override:{title:"Eliminate All Dry Weather Flow Override",type:"boolean",default:!1}}},TreatmentSiteGroups:{title:"TreatmentSiteGroups",required:["treatment_sites"],type:"object",properties:{treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSiteGroup"}}}},TreatmentSiteResponse:{title:"TreatmentSiteResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/TreatmentSiteGroups"}}},TreatmentSites:{title:"TreatmentSites",required:["treatment_sites"],type:"object",properties:{treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSite"}}}},ValidationError:{title:"ValidationError",required:["loc","msg","type"],type:"object",properties:{loc:{title:"Location",type:"array",items:{type:"string"}},msg:{title:"Message",type:"string"},type:{title:"Error Type",type:"string"}}},Watershed:{title:"Watershed",required:["graph","land_surfaces"],type:"object",properties:{graph:{$ref:"#/components/schemas/Graph"},land_surfaces:{title:"Land Surfaces",type:"array",items:{$ref:"#/components/schemas/LandSurface"}},treatment_facilities:{title:"Treatment Facilities",anyOf:[{type:"array",items:{type:"object"}},{type:"array",items:{anyOf:[{$ref:"#/components/schemas/PermPoolFacility"},{$ref:"#/components/schemas/RetAndTmntFacility"},{$ref:"#/components/schemas/BioInfFacility"},{$ref:"#/components/schemas/FlowAndRetFacility"},{$ref:"#/components/schemas/RetentionFacility"},{$ref:"#/components/schemas/TmntFacility"},{$ref:"#/components/schemas/CisternFacility"},{$ref:"#/components/schemas/DryWellFacility"},{$ref:"#/components/schemas/DryWeatherTreatmentLowFlowFacility"},{$ref:"#/components/schemas/DryWeatherDiversionLowFlowFacility"},{$ref:"#/components/schemas/LowFlowFacility"},{$ref:"#/components/schemas/FlowFacility"},{$ref:"#/components/schemas/NTFacility"}]}}]},treatment_sites:{title:"Treatment Sites",type:"array",items:{$ref:"#/components/schemas/TreatmentSite"}},previous_results:{title:"Previous Results",type:"array",items:{$ref:"#/components/schemas/PreviousResult"}}},example:{graph:{directed:!0,multigraph:!1,graph:{},nodes:[{metadata:{},id:"0"},{metadata:{},id:"1"},{metadata:{},id:"2"},{metadata:{},id:"3"},{metadata:{},id:"4"},{metadata:{},id:"5"},{metadata:{},id:"6"}],edges:[{metadata:{},source:"1",target:"0"},{metadata:{},source:"2",target:"1"},{metadata:{},source:"3",target:"2"},{metadata:{},source:"4",target:"2"},{metadata:{},source:"5",target:"2"},{metadata:{},source:"6",target:"1"}]},treatment_facilities:[{node_id:"0",facility_type:"sand_filter",ref_data_key:"10101200",design_storm_depth_inches:.85,total_volume_cuft:335,area_sqft:1532,media_filtration_rate_inhr:22.5,constructor:"treatment_facility_constructor",tributary_area_tc_min:30,is_online:!0},{node_id:"2",facility_type:"bioretention",ref_data_key:"10101000",design_storm_depth_inches:.85,total_volume_cuft:382,retention_volume_cuft:333,area_sqft:2658,media_filtration_rate_inhr:14.6,hsg:"a",constructor:"bioinfiltration_facility_constructor",tributary_area_tc_min:55,is_online:!0}],treatment_sites:[{facility_type:"wet_detention",node_id:"1",area_pct:6,captured_pct:57,retained_pct:38},{facility_type:"cistern",node_id:"1",area_pct:80,captured_pct:74,retained_pct:49},{facility_type:"swale",node_id:"1",area_pct:0,captured_pct:61,retained_pct:44},{facility_type:"dry_weather_diversion",node_id:"1",area_pct:12,captured_pct:80,retained_pct:56},{facility_type:"dry_extended_detention",node_id:"1",area_pct:1,captured_pct:40,retained_pct:0},{facility_type:"infiltration",node_id:"1",area_pct:1,captured_pct:73,retained_pct:59}],land_surfaces:[{node_id:"3",surface_key:"10101000-RESSFH-rock-5",area_acres:.3984569310124453,imp_area_acres:.009673489252693119},{node_id:"3",surface_key:"10101100-RESSFH-D-0",area_acres:8.065001059380828,imp_area_acres:2.16741977121951},{node_id:"3",surface_key:"10101100-EDU-D-5",area_acres:2.5839358997133957,imp_area_acres:2.55343628659585},{node_id:"3",surface_key:"10101100-UTIL-A-5",area_acres:4.312089428850966,imp_area_acres:4.131205425493061},{node_id:"3",surface_key:"10101200-RESSFL-D-5",area_acres:3.9337442224446297,imp_area_acres:.7661658366327859},{node_id:"4",surface_key:"10101200-COMM-A-0",area_acres:.28767325522239817,imp_area_acres:.08026707777353169},{node_id:"4",surface_key:"10101200-TRANS-rock-10",area_acres:6.9571538459344495,imp_area_acres:1.2273914932176564},{node_id:"4",surface_key:"10101200-OSLOW-rock-0",area_acres:2.403387703304852,imp_area_acres:.9959985713261311},{node_id:"4",surface_key:"10101200-OSWET-D-5",area_acres:2.79314881649118,imp_area_acres:.15499820430359323},{node_id:"4",surface_key:"10101100-OSFOR-D-5",area_acres:2.905930886150414,imp_area_acres:1.4925738336538064},{node_id:"4",surface_key:"10101000-TRANS-A-5",area_acres:9.350620373618705,imp_area_acres:5.232513213963891},{node_id:"4",surface_key:"10101200-COMM-C-0",area_acres:2.1979646924219196,imp_area_acres:.2053466380605771},{node_id:"4",surface_key:"10101000-OSWET-D-0",area_acres:9.316054897695937,imp_area_acres:8.379096506045641},{node_id:"4",surface_key:"10101200-TRFWY-A-0",area_acres:1.4272661923917718,imp_area_acres:1.2613822514526472},{node_id:"4",surface_key:"10101200-OSDEV-C-10",area_acres:4.221871721446085,imp_area_acres:.4549400198109034},{node_id:"4",surface_key:"10101100-RESSFH-C-0",area_acres:.26360615441130775,imp_area_acres:.13605449920172205},{node_id:"4",surface_key:"10101000-OSDEV-D-5",area_acres:7.289650539203478,imp_area_acres:6.077668638347337},{node_id:"5",surface_key:"10101000-IND-A-10",area_acres:4.930498275495615,imp_area_acres:4.450757471699112},{node_id:"5",surface_key:"10101200-OSLOW-rock-0",area_acres:7.814106399568224,imp_area_acres:1.078526163782842},{node_id:"5",surface_key:"10101200-RESSFL-D-5",area_acres:6.185417372804003,imp_area_acres:5.76250105686173},{node_id:"5",surface_key:"10101200-OSIRR-water-10",area_acres:.36715726648133273,imp_area_acres:.23531606583046188},{node_id:"5",surface_key:"10101200-RESMF-D-5",area_acres:5.3935429017017515,imp_area_acres:3.810512599072686},{node_id:"5",surface_key:"10101100-RESSFH-A-5",area_acres:2.3620796715469004,imp_area_acres:1.870944109794398},{node_id:"5",surface_key:"10101200-WATER-A-10",area_acres:5.506805596166197,imp_area_acres:2.0512411750860533},{node_id:"5",surface_key:"10101200-TRFWY-A-5",area_acres:2.2549267594382885,imp_area_acres:.059337765905655114},{node_id:"5",surface_key:"10101200-EDU-A-5",area_acres:6.945443095820329,imp_area_acres:2.426366435613679},{node_id:"5",surface_key:"10101100-IND-D-0",area_acres:3.8291536983619254,imp_area_acres:2.4237194475207304},{node_id:"5",surface_key:"10101000-RESSFH-D-10",area_acres:4.720854566650611,imp_area_acres:1.9563886575871627},{node_id:"5",surface_key:"10101000-EDU-C-10",area_acres:1.7804423698966843,imp_area_acres:.3371318723066817},{node_id:"6",surface_key:"10101200-TRANS-D-0",area_acres:2.2754330855140923,imp_area_acres:1.0211331313414405},{node_id:"6",surface_key:"10101100-OSLOW-D-5",area_acres:6.214500618686376,imp_area_acres:.6340460489422389},{node_id:"6",surface_key:"10101100-UTIL-A-10",area_acres:2.555615240745477,imp_area_acres:2.131208949421928},{node_id:"6",surface_key:"10101000-RESSFH-A-5",area_acres:8.175748802007071,imp_area_acres:1.8980919101830314},{node_id:"6",surface_key:"10101200-RESSFH-A-0",area_acres:3.860268456910725,imp_area_acres:1.9184629017741963},{node_id:"6",surface_key:"10101200-OSDEV-C-5",area_acres:.5748050245941472,imp_area_acres:.1411875823737466},{node_id:"6",surface_key:"10101000-RESSFH-D-0",area_acres:7.945535238259879,imp_area_acres:.6302494865328522},{node_id:"6",surface_key:"10101000-RESMF-D-0",area_acres:6.915337959629758,imp_area_acres:3.162694892687792},{node_id:"6",surface_key:"10101000-IND-A-5",area_acres:5.262089934922299,imp_area_acres:.012019588367122497},{node_id:"6",surface_key:"10101200-EDU-D-10",area_acres:9.142141560695912,imp_area_acres:8.229015560695975},{node_id:"6",surface_key:"10101200-OSAGIR-A-10",area_acres:1.1171651349206269,imp_area_acres:.5990037582520297},{node_id:"6",surface_key:"10101100-OSAGIR-C-0",area_acres:3.304545692925136,imp_area_acres:.36222350149989435},{node_id:"6",surface_key:"10101000-RESSFH-D-0",area_acres:9.63416946726306,imp_area_acres:7.1542071673930625},{node_id:"6",surface_key:"10101100-OSLOW-D-0",area_acres:4.8579106327541695,imp_area_acres:.25541389152635474},{node_id:"6",surface_key:"10101200-OSDEV-C-5",area_acres:6.798391444820259,imp_area_acres:2.2112485428708193},{node_id:"6",surface_key:"10101000-RESSFH-D-10",area_acres:3.4948300942486963,imp_area_acres:3.233078107164885},{node_id:"6",surface_key:"10101000-OSAGIR-A-10",area_acres:3.6289953644281625,imp_area_acres:.38263683466075843},{node_id:"6",surface_key:"10101100-OSDEV-D-0",area_acres:5.376760581619445,imp_area_acres:4.5257872671756365}]}},WatershedResponse:{title:"WatershedResponse",type:"object",properties:{status:{title:"Status",type:"string",default:"SUCCESS"},task_id:{title:"Task Id",type:"string"},result_route:{title:"Result Route",type:"string"},data:{$ref:"#/components/schemas/WatershedResults"}}},WatershedResults:{title:"WatershedResults",type:"object",properties:{results:{title:"Results",type:"array",items:{$ref:"#/components/schemas/Result"}},leaf_results:{title:"Leaf Results",type:"array",items:{$ref:"#/components/schemas/Result"}},previous_results_keys:{title:"Previous Results Keys",type:"array",items:{type:"string"}},errors:{title:"Errors",type:"array",items:{type:"string"}},warnings:{title:"Warnings",type:"array",items:{type:"string"}}}}}}},He=Object.freeze(Object.defineProperty({__proto__:null,getConfig:ie,getReferenceData:ee,solveWatershed:re,validateNetwork:te,validateTreatmentFacilities:ae},Symbol.toStringTag,{value:"Module"})),p=(i,e="")=>e.split(".").reduce((t,a)=>t==null?t:t[a],i),x=(i,e="")=>{let t=p(i,e);return t===void 0?!1:t};function ne(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=t.length;for(let r=0;rObject.keys(i).filter(r=>e.length?e.includes(r):!0).filter(r=>!t.includes(r)).reduce((r,s)=>({...r,[s]:i[s]}),{});function q(i){return Object.entries(i).filter(([e,t])=>t!=""&&t!=null).reduce((e,[t,a])=>({...e,[t]:a===Object(a)?q(a):a}),{})}function v(i){return JSON.parse(JSON.stringify(i))}function B(i){return i.length?i.reduce((e,t)=>e+t)/i.length:void 0}function w(i){return Array.isArray(i)?[].concat(...i.map(w)):i}const O=()=>{let i=(p(m,"state.waiting")||0)+1;m.dispatch("Waiting",{waiting:i})},L=()=>{let i=(p(m,"state.waiting")||0)-1;i<0&&(console.error("waiting counter is negative"),i=0),m.dispatch("Waiting",{waiting:i})};async function D(i){return console.debug("fetching with get",i),O(),await fetch(i,{method:"GET"}).then(t=>{if(console.debug("getJsonResponse response:",t),t.status==200)return t.json();if(t.status==422)return t.json();throw new Error("got back "+t.content)}).then(t=>(console.debug("getJsonResponse data returned:",t),t)).finally(L)}async function C(i,e){return console.debug("fetching with post",i,e),O(),await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(a=>{if(console.debug("postJsonResponse response:",a),a.status==200)return a.json();if(a.status==422)return a.json();throw new Error("got back "+a)}).then(a=>(console.debug("postJsonResponse data returned:",a),a)).finally(L)}const le=({fn:i,validate:e,interval_milli:t,maxAttempts:a})=>{console.debug("Start poll...");let r=0;const s=async(n,c)=>{console.debug("- poll");const _=await i();if(r++,console.debug(r,_),e(_))return n(_);if(a&&r===a)return c(new Error("Exceeded max attempts"));setTimeout(s,t,n,c)};return new Promise(s)};function U(i){var e,t,a,r,s,n;return n=i.data||null,n==null||!n.length?null:(r=i.columnDelimiter||",",s=i.lineDelimiter||` +`,a=i.keys||Object.keys(n[0]),e="",e+=a.map(c=>String(c).includes(",")?`"${c}"`:`${c}`).join(r),e+=s,n.forEach(function(c){t=0,a.forEach(function(_){t>0&&(e+=r);const u=String(c[_]);u.includes(",")?e+=`"${u}"`:e+=`${u}`,t++}),e+=s}),e)}const de=async()=>{const i=new URLSearchParams(window.location.search);let{state:e,region:t}=Object.fromEntries(i.entries());const a=await ie({nereid_state:e||m.state.nereid_state,nereid_region:t||m.state.nereid_region});return m.dispatch("updateConfig",a),console.debug(a),!1},Ge=Object.freeze(Object.defineProperty({__proto__:null,cleanObject:q,convertArrayOfObjectsToCSV:U,decr_waiting:L,deepCopy:v,filter:oe,flatten:w,get:p,getConfigFromUrlQueryParams:de,getJsonResponse:D,getTruthy:x,incr_waiting:O,mean:B,poll:le,postJsonResponse:C,randomString:ne},Symbol.toStringTag,{value:"Module"}));class E{constructor(e,t,a){this.nodes=e||[],this.edges=t||[],this.options=a||{},this.resolve_links(),m.dispatch("newGraph",{graph:this})}resolve_links(){let e=this;e.nodes=e.nodes.filter(r=>r.id!=null),this.edges.forEach(function(r){let s=r.source,n=r.target;r.source=e.nodes.find(c=>c.id===s),r.target=e.nodes.find(c=>c.id===n)});let t=this.options.width||600,a=this.options.height||400;this.nodes.forEach(function(r){r.x||(r.x=t/2+t/3*(Math.random()-1)),r.y||(r.y=a/2+a/3*(Math.random()-1))})}spliceLinksForNode(e){const t=this.edges.filter(a=>a.source.id===e||a.target.id===e);for(const a of t)this.edges.splice(this.edges.indexOf(a),1)}}function M(){let{nodes:i,edges:e,scenario_name:t}=v(p(m,"state.staged_changes"));new E(i,e),m.dispatch("clearStagedChanges",{staged_changes:{}}),t&&m.dispatch("updateScenarioName",{scenario_name:t})}function ce(){let i=v(p(m,"state.staged_changes.nodes")),e=v(p(m,"state.staged_changes.edges")),t=v(p(m,"state.graph.nodes")),a=v(p(m,"state.graph.edges")),r=[...a,...e].map(n=>{var c,_;return{source:((c=n.source)==null?void 0:c.id)||n.source,target:((_=n.target)==null?void 0:_.id)||n.target}}),s=i;for(let n of t)i.map(c=>c.id).includes(n.id)||s.push(n);new E(s,r),m.dispatch("clearStagedChanges",{staged_changes:{}})}const Je=()=>{let{graph:i,scenario_name:e}=p(m,"state");sessionStorage.setItem("autosave_graph",JSON.stringify({graph:i,scenario_name:e}))},Ke=()=>{var t;let i=sessionStorage.getItem("autosave_graph"),e=v(p(m,"state.default_graph"));if(i){const{graph:a,scenario_name:r}=JSON.parse(i);sessionStorage.removeItem("autosave_graph"),((t=a==null?void 0:a.nodes)==null?void 0:t.length)>0?new E(a.nodes,a.edges.map(s=>({source:s.source.id,target:s.target.id}))):new E(e.nodes,e.edges),r&&m.dispatch("restoreScenarioName",{scenario_name:r})}else new E(e.nodes,e.edges)};window.addEventListener("beforeunload",Je);window.addEventListener("load",i=>{const t=new URLSearchParams(window.location.search).get("tab");t&&m.dispatch("changedTab",{current_tab:t})});const y=Object.assign({json:he,Delaunay:ge},be,ve,we,ke,Se,xe,Te,$e,je,Re,Fe,De,Ee,Ne,Ae,qe,Oe,Le,Ce,Ie);window.d3=y;class b{constructor(e={}){let t=this;this.element,this.element_string,this.id,this._render=this._render||e._render||function(){},e.store instanceof z&&(t.store=e.store),e.hasOwnProperty("events")&&e.store instanceof z&&e.events.forEach(a=>e.store.events.subscribe(a,()=>t.render())),e.hasOwnProperty("element")&&(t.element=e.element),e.hasOwnProperty("element_string")&&(t.element_string=e.element_string,t.element=y.select(element)),e.hasOwnProperty("id")&&(t.id=e.id,t.element_string=`#${t.id}`,t.element=y.select(t.element_string)),e.hasOwnProperty("children")&&(t.children=e.children)}render(){let e=this;this._render(),this!=null&&this.children&&this.children.forEach(t=>{t!=null&&t.parent_id||(t.parent_id=e.id),t.render()})}}class Qe extends b{constructor(e){super({store:m,id:e.id})}enter(){let e=this;e.element.classed("pointer-events-none",!1);let t;t=e.element.select(".background-overlay").node(),t.classList.remove("opacity-0"),t.classList.add("duration-300","opacity-40"),t=e.element.select(".modal-main").node(),t.classList.remove("opacity-0","translate-y-4"),t.classList.add("opacity-100","translate-y-0")}exit(){let e=this,t=e.element;e.element.classed("pointer-events-none",!0);let a;a=t.select(".background-overlay").node(),a.classList.remove("opacity-40","duration-300"),a.classList.add("opacity-0"),a=t.select(".modal-main").node(),a.classList.remove("opacity-100","translate-y-0"),a.classList.add("opacity-0","translate-y-4")}_base_template(){return` + + `}_render(){let e=this;e.element=d3.select("body").append("div").attr("id",e.id),e.element.html(e._base_template()),e.store.events.subscribe("Waiting",({waiting:t})=>{t>0&&e.enter()}),e.store.events.subscribe("Waiting",({waiting:t})=>{t===0&&e.exit()}),d3.select("body")}}const Ye=new Qe({id:"spinner-popup"});class Xe extends b{constructor(e){super({store:m,id:e.id})}enter(e){let t=this;t.element.classed("pointer-events-none",!1);let a=t.element.select("#modal-content");a.html(t._content_template(e)),a.selectAll("button").on("click",this.exit.bind(t));let r;r=t.element.select(".background-overlay").node(),r.classList.remove("opacity-0"),r.classList.add("duration-300","opacity-40"),r=t.element.select(".modal-main").node(),r.classList.remove("opacity-0","translate-y-4"),r.classList.add("opacity-100","translate-y-0")}exit(){let e=this,t=e.element;e.element.classed("pointer-events-none",!0);let a;a=t.select(".background-overlay").node(),a.classList.remove("opacity-40","duration-300"),a.classList.add("opacity-0"),a=t.select(".modal-main").node(),a.classList.remove("opacity-100","translate-y-0"),a.classList.add("opacity-0","translate-y-4")}_content_template(e){e||(e={});let t={icon:` + + + `};switch(e.alert_type){case"error":t.bgcolor="bg-red-300",t.button_style="bg-red-600 hover:bg-red-700 focus:ring-red-500",t.icon_color="text-red-600",t.icon_bgcolor="bg-red-100";break;case"success":t.bgcolor="bg-green-300",t.button_style="bg-green-600 hover:bg-green-700 focus:ring-green-500",t.icon_color="text-green-600",t.icon_bgcolor="bg-green-100",t.icon=` + + + + + `;break;default:t.bgcolor="bg-yellow-300",t.button_style="bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500",t.icon_color="text-yellow-600",t.icon_bgcolor="bg-yellow-100"}return` +
+
+ +
+
+
+ ${t.icon} +
+
+
+ +
+

+ ${(e==null?void 0:e.msg)||""} +

+
+
+
+
+
+ +
+ `}_base_template(){return` + + `}_render(){let e=this;e.element=d3.select("body").append("div").attr("id",e.id).classed("pointer-events-none",!0),e.element.html(e._base_template()),e.store.events.subscribe("raiseModal",({modal_content:t})=>e.enter(t)),e.exit()}}const Ze=new Xe({id:"modal-popup"});class et{constructor(e){this.store=m,this.namespace=e,this.registry_underline={0:"translate-x-0",1:"translate-x-full",2:"translate-x-double",3:"translate-x-triple",4:"translate-x-quad",5:"translate-x-pent",6:"translate-x-sext",7:"translate-x-sept",8:"translate-x-octa"},this.registry={}}init(){let e=this,t=this.namespace;document.querySelectorAll(`${t}`).forEach(r=>{Array.from(r.children).forEach((s,n)=>{e.registry[s.dataset.target]=e.registry_underline[n],s.dataset.target&&(s.addEventListener("click",()=>{e.store.dispatch("changedTab",{current_tab:s.dataset.target}),e.toggle.bind(e)(s.dataset.target)}),s.className.includes("active")&&e.toggle.bind(e)(s.dataset.target))})}),e.store.events.subscribe("changedTab",({current_tab:r})=>{e.toggle(r)});let a=p(e.store,"state.current_tab");a&&e.toggle(a)}toggle(e){let t=this,a=this.namespace,r=document.querySelector(`${a} .tab-slider`);r.className=r.className.replace(/\btranslate-x-.+?\b/g,""),r.classList.add(t.registry[e]),document.querySelectorAll(`${a} .tab-content`).forEach(s=>{s.classList[s.id===e?"remove":"add"]("hidden"),document.querySelector(`[data-target="${s.id}"]`).classList.toggle("active",s.id===e)})}}class tt extends b{constructor({children:e}){super({store:m,children:e}),this.classname="main-tab-group-namespace"}_template(){return` + +
+
+ Editor +
+
+
How To
+
Treatment Results
+
Land Surface Results
+ Logout +
+ + + + + +
+
+
+
+
+
+ + + `}_render(){let e=this;y.select("body").append("div").classed("min-w-[700px]",!0).html(e._template()),new et(`.${this.classname}`).init()}}class at extends b{constructor(e){super({store:m,id:e.id,children:e.children}),this.store.events.subscribe("updateScenarioName",this._update_scenario_name.bind(this))}get scenario_name(){return p(this.store,"state.scenario_name")}_update_scenario_name(){let e=this;y.select(`#${e.id}`).select("#scenario-name").text(e.scenario_name)}_template(){return` +
+ Scenario:  + + ${this.scenario_name} + +
+
+
+
+
+
+
+ +
+
+
+
+ `}_render(){let e=this,t=y.select(`#${e.id}`).classed("flex flex-col justify-center max-w-[1000px]",!0).html(e._template());t.select("#scenario-name").on("input",()=>{let a=t.select("#scenario-name").text().trim();e.store.dispatch("changeScenarioName",{scenario_name:a})})}}class N extends b{constructor(e){super({store:m,id:e.id}),this.parent_id=e.parent_id,this.text=e.text,this.callback=e.callback,this.isActive=e.isActive,this.scale=e.scale||"scale-100",this.button,this._class=e.class_string||""}get class(){return this._class}_render(){let e=this;e.toggle=y.select(`#${e.parent_id}`).append("div"),e.toggle.html(` + +
+ +
+ `),e.toggle.select("input[type=checkbox]").property("checked",e.isActive),e.toggle.select("input").on("change",e.callback.bind(e))}}const A="scale-75",rt=new N({id:"map-edit-toggle",text:"Show BaseMap",isActive:x(m,"state.map_mode"),scale:A,callback:function(){let i=!x(this,"store.state.map_mode");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isMapMode",{map_mode:i})}}),st=new N({id:"graph-edit-toggle",text:"Edit Graph",isActive:x(m,"state.graph_edit_mode"),scale:A,callback:function(){let i=!x(this,"store.state.graph_edit_mode");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isGraphEditMode",{graph_edit_mode:i})}}),it=new N({id:"states-vector-toggle",text:"Show States",isActive:x(m,"state.show_states"),scale:A,callback:function(){let i=!x(this,"store.state.show_states");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowStatesMode",{show_states:i})}}),nt=new N({id:"design-storm-vector-toggle",text:"Show Design Storm",isActive:x(m,"state.show_design_storm"),scale:A,callback:function(){let i=!x(this,"store.state.show_design_storm");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowDesignStorm",{show_design_storm:i})}}),ot=new N({id:"rain-zone-vector-toggle",text:"Show Rain Zones",isActive:x(m,"state.show_rain_zone"),scale:A,callback:function(){let i=!x(this,"store.state.show_rain_zone");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowRainZones",{show_rain_zone:i})}}),lt=new N({id:"into-tooltip-toggle",text:"Show Node Info",isActive:x(m,"state.show_info_tooltip"),scale:A,callback:function(){let i=!x(this,"store.state.show_info_tooltip");this.toggle.select("input[type=checkbox]").property("checked",!!i),this.store.dispatch("isShowInfoTooltip",{show_info_tooltip:i})}}),dt=new b({id:"toggle-container",children:[rt,it,nt,ot,st,lt]});class ct extends b{constructor(t){super({store:m,id:t.id});F(this,"width",()=>y.select(`#${this.id}`).node().getBoundingClientRect().width);F(this,"height",()=>y.select(`#${this.id}`).node().getBoundingClientRect().height);let a=this;a.store.events.subscribe("isMapMode",()=>a.toggleMapMode()),a.store.events.subscribe("changedTransform",r=>a.zoomed(r)),a.svg=t.svg,a.initialScale=p(a,"store.state.initialScale"),a._k={},a.initialCenter=p(a,"store.state.config.project_spatial_data.app.centroid")||p(a,"store.state.initialCenter"),a.tilesize=256,a._current_point,a._zoomed=!1,a.url=(r,s,n)=>`https://${"abc"[Math.abs(r+s)%3]}.basemaps.cartocdn.com/rastertiles/voyager/${n}/${r}/${s}${devicePixelRatio>1?"@2x":""}.png`,a.projection=y.geoMercator().scale(1/(2*Math.PI)).translate([0,0]),a.store.dispatch("setProjection",{projection:a.projection}),a.transform=y.zoomIdentity.translate(a.projection([0,0])[0],a.projection([0,0])[1]).scale(a.projection.scale()*2*Math.PI),a.store.dispatch("setTransform",{transform:a.transform}),a.renderer=y.geoPath(a.projection),a.tile=y.tile().extent([[0,0],[a.width(),a.height()]]).tileSize(a.tilesize),a.image_bg=a.svg.append("svg:g").classed("bg basemap",!0).attr("pointer-events","none").style("overflow","hidden").attr("pointer-events","none").classed("hidden",!a.store.state.map_mode).selectAll("image"),a.image_fg=a.svg.append("svg:g").classed("fg basemap",!0).attr("pointer-events","none").style("overflow","hidden").classed("hidden",!a.store.state.map_mode).selectAll("image"),a.image_group=a.svg.selectAll(".basemap"),a.vector=a.svg.append("svg:g").attr("id","vectors").attr("pointer-events","none"),a.zoom=y.zoom().scaleExtent([64,1<<30]).extent([[0,0],[a.width(),a.height()]]).filter(()=>!a.drag_lock).on("start",r=>{}).on("zoom",r=>{a.store.dispatch("changedTransform",{transform:r.transform})}).on("end",r=>{a.store.dispatch("changedZoomTransform",{zoomTransform:a.zoom.transform})})}get drag_lock(){return p(this,"store.state.drag_lock")}toggleMapMode(){let t=this;t.image_group.classed("hidden",!t.store.state.map_mode),console.debug("map mode toggled!")}zoomed({transform:t}){let a=this;a.transform=t,a._k=t.k;const r=a.tile(t);a.image_bg=a.image_bg.data(r,s=>s).join("image").attr("xlink:href",s=>a.url(...s)).attr("x",([s])=>(s+r.translate[0])*r.scale-.5).attr("y",([,s])=>(s+r.translate[1])*r.scale-.5).attr("width",r.scale+1).attr("height",r.scale+1),a.image_fg=a.image_fg.data(r,s=>s).join("image").attr("xlink:href",s=>a.url(...s)).attr("x",([s])=>(s+r.translate[0])*r.scale).attr("y",([,s])=>(s+r.translate[1])*r.scale).attr("width",r.scale).attr("height",r.scale),a.vector.attr("transform",t)}_render(){let t=this;t.svg.call(t.zoom).call(t.zoom.transform,y.zoomIdentity.translate(t.width()/2,t.height()/2).scale(-t.initialScale).translate(...t.projection(t.initialCenter)).scale(-1))}}class _t extends b{constructor(e){super({store:m});let t=this;t.stroke_width=1,t.store.events.subscribe("changedTransform",()=>{t.path.style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowStatesMode",()=>{t.path.classed("hidden",t.hidden)}),t.projection=p(t,"store.state.projection"),t.renderer=y.geoPath(t.projection).digits(15),t.url="https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json",t.vector=e.vector,t.path=t.vector.append("path").attr("pointer-events","all").attr("fill","none").attr("stroke","green").attr("stroke-linecap","round").attr("stroke-linejoin","round").classed("hidden",t.hidden).style("stroke-width",t.stroke_width/t.transform.k)}get hidden(){return!p(this,"store.state.show_states")}get transform(){return p(this,"store.state.transform")}async _render(){let e=this,t=await y.json(e.url),a=Y(t,t.objects.states);e.geojson=a,e.store.dispatch("setStateQuery",{state_query:a}),e.path.attr("d",e.renderer(a))}}class _e extends b{constructor({vector:e}){super({store:m});let t=this;t.group=e.append("g"),t.stroke_width=0,t.domain=[0,1],t.projection=p(t,"store.state.projection"),t.renderer=d3.geoPath(t.projection).digits(15)}get transform(){return p(this,"store.state.transform")}async _load_data(e){let t=this;if(!e)return;let a,r;try{if(e!=null&&e.filepath)r=await ee(e.filepath);else if(e!=null&&e.url)r=await D(e.url);else return}catch(s){console.error(s);return}try{if((r==null?void 0:r.type)==="Topology"){let s=r;a=Y(s,s.objects[e.name])}else(r==null?void 0:r.type)==="FeatureCollection"&&(a=r,a.features=a.features.map(s=>Me(s,{reverse:!0})))}catch(s){console.error(s);return}if(a){a._field=e.field;let s=a.features.map(n=>n.properties[e.field]);t.domain=[Math.min(...s),Math.max(...s)],t.geojson=a}}}class pt extends _e{constructor({vector:e}){super({vector:e});let t=this;t.store.events.subscribe("changedTransform",()=>{t.group.selectAll("path").style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowDesignStorm",async()=>{let a=p(t,"store.state.design_storm_geojson");if(!a){await t.load_data();return}t._draw(a)}),t.store.events.subscribe("setDesignStormQuery",({design_storm_geojson:a})=>t._draw(a))}get hidden(){return!p(this,"store.state.show_design_storm")}async load_data(){var r;let e=this,t=p(e.store,"state.config"),a=v((r=t==null?void 0:t.project_spatial_data)==null?void 0:r.design_storm);await e._load_data(a),e.geojson&&e.store.dispatch("setDesignStormQuery",{design_storm_geojson:e.geojson})}_draw(e){if(!e)return;let t=this;t.group.selectAll("path").remove(),!t.hidden&&(t.colorScale=y.scaleLinear().domain(t.domain).range(["white","blue"]),t.group.selectAll("path").data(e.features).enter().append("path").attr("d",t.renderer).attr("pointer-events","all").attr("fill",a=>t.colorScale(a.properties[e._field])).attr("stroke",y.gray(.2)).attr("stroke-linecap","round").attr("stroke-linejoin","round").style("stroke-width",t.stroke_width/t.transform.k))}async _render(){let e=this;e.store.events.subscribe("updateConfig",e.load_data.bind(e))}}class ut extends _e{constructor({vector:e}){super({vector:e});let t=this;t.stroke_width=1,t.store.events.subscribe("changedTransform",()=>{t.group.selectAll("path").style("stroke-width",t.stroke_width/t.transform.k)}),t.store.events.subscribe("isShowRainZones",async()=>{let a=p(t,"store.state.ref_data_key_geojson");if(!a){await t.load_data();return}t._draw(a)}),t.store.events.subscribe("setRefDataQuery",({ref_data_key_geojson:a})=>t._draw(a))}get hidden(){return!p(this,"store.state.show_rain_zone")}async load_data(){var r;let e=this,t=p(e.store,"state.config"),a=v((r=t==null?void 0:t.project_spatial_data)==null?void 0:r.ref_data_key);await e._load_data(a),e.geojson&&e.store.dispatch("setRefDataQuery",{ref_data_key_geojson:e.geojson})}_draw(e){if(!e)return;let t=this;t.group.selectAll("path").remove(),!t.hidden&&(t.colorScale=y.scaleOrdinal().domain(t.domain).range(y.schemeSet3),t.group.selectAll("path").data(e.features).enter().append("path").attr("d",t.renderer).attr("pointer-events","all").attr("fill",a=>t.colorScale(a.properties[e._field])).attr("stroke",y.gray(.2)).attr("stroke-linecap","round").attr("stroke-linejoin","round").style("stroke-width",t.stroke_width/t.transform.k))}async _render(){let e=this;e.store.events.subscribe("updateConfig",e.load_data.bind(e))}}class mt extends b{constructor(t){super({store:m,id:t.id});F(this,"fixedScale",()=>!1);F(this,"getScale",()=>{let t=this;return t.fixedScale()?p(t,"store.state.transform.k")/p(t,"store.state.initialScale"):1});F(this,"getLoc",t=>this.longLatToPoint(t.longlat));let a=this;a.svg=t.svg,a.options=t||{},a.default_nodesize=a.options.default_nodesize||12,a.charge=a.options.charge||-300,a.edge_distance=a.options.edge_distance||80,a.node_types=a.options.node_types||{},a.onNodeSelected=typeof a.options.onNodeSelected<"u"?a.options.onNodeSelected:function(){},a.onNodeUnSelected=typeof a.options.onNodeUnSelected<"u"?a.options.onNodeUnSelected:function(){},a._selected_node_id=null,a._mousedown_edge=null,a._mousedown_node=null,a._mouseup_node=null,a._lastKeyDown=-1,a.container=a.svg.append("svg:g").classed("graph-editor",!0).style("pointer-events","all"),a.container.append("svg:defs").append("svg:marker").attr("id","end-arrow").attr("viewBox","0 -5 10 10").attr("refX",5).attr("markerWidth",3).attr("markerHeight",3).attr("orient","auto").style("fill",y.gray(20)).append("svg:path").attr("d","M0,-5L10,0L0,5"),a.dragLine=a.container.append("svg:path").attr("class","link dragline hidden").attr("d","M0,0L0,0"),a.path=a.container.append("svg:g").selectAll("path"),a.circle=a.container.append("svg:g").selectAll("g"),a.drag=y.drag().filter(r=>r.button===0||r.button===2).on("drag",(r,s)=>{s.longlat=a.pointToLongLat([r.x,r.y]),a.update()}).on("end",()=>a.store.dispatch("stateChange")),y.select(window).on("mousemove.graph-editor",a.mousemove.bind(a)).on("keydown.graph-editor",a.keydown.bind(a)).on("keyup.graph-editor",a.keyup.bind(a)),a.svg.on("click.graph-editor",a.mousedown_addNode.bind(a)).on("mouseup.graph-editor",a.mouseup.bind(a)).on("mouseenter",a.mouseenter.bind(a)).on("mouseleave",a.mouseleave.bind(a))}subscribe(){let t=this;t.store.events.subscribe("isConstNodeArea",()=>t.toggleConstNodeArea()),t.store.events.subscribe("changedTransform",()=>t.update()),t.store.events.subscribe("editorUpdate",()=>{t.update()}),t.store.events.subscribe("newGraph",()=>{t.update()}),t.store.events.subscribe("setRefDataQuery",()=>{t.update()}),t.store.events.subscribe("setDesignStormQuery",()=>{t.update()})}get bbox(){return this.svg.node().getBoundingClientRect()}get width(){return this.bbox.width}get height(){return this.bbox.height}get transform(){return p(this,"store.state.transform")}get projection(){return p(this,"store.state.projection")}get editing_mode(){return p(this,"store.state.graph_edit_mode")}get graph(){return p(this,"store.state.graph")}get_node_by_id(t){return this.graph.nodes.find(a=>a.id===t)}pointToLongLat(t){let a=this;return a.projection.invert(a.transform.invert(t))}longLatToPoint(t){let a=this;return a.transform.apply(a.projection(t))}recalculateNodeSize(t){let a=this;return Math.max(3,t.size*a.getScale())*(t.id===a._selected_node_id?1.3:1)}getColor(t){let a=this;if(t!=null&&t.color)return y.rgb(t.color);let r=p(a.store.state.node_types,t.node_type);return y.rgb((r==null?void 0:r.color)||"lightgrey")}tick(){let t=this;t.path.attr("d",a=>{const r=a.target.x-a.source.x,s=a.target.y-a.source.y,n=Math.sqrt(r*r+s*s),c=r/n,_=s/n,u=t.recalculateNodeSize(a.source),o=5+t.recalculateNodeSize(a.target),l=a.source.x+u*c,d=a.source.y+u*_,f=a.target.x-o*c,h=a.target.y-o*_;return r*(f-l)<0||s*(h-d)<0?`M${a.source.x},${a.source.y}L${a.target.x},${a.target.y}`:`M${l},${d}L${f},${h}`}),t.circle.selectAll(".node").attr("r",a=>t.recalculateNodeSize(a)*.95),t.circle.attr("transform",a=>`translate(${a.x},${a.y})`)}getState(t){var c;let r=p(this,"store.state.state_query"),s="undefined",n;return r!=null?(n=r.features.find(_=>y.geoContains(_,t)),((c=n==null?void 0:n.properties)==null?void 0:c.name)||"undefined"):s}getDesignStormDepth(t){var n;let r=p(this,"store.state.design_storm_geojson"),s;if(r!=null)return s=r.features.find(c=>y.geoContains(c,t)),(n=s==null?void 0:s.properties)==null?void 0:n[r._field]}getRefDataKey(t){var n;let r=p(this,"store.state.ref_data_key_geojson"),s;if(r!=null)return s=r.features.find(c=>y.geoContains(c,t)),(n=s==null?void 0:s.properties)==null?void 0:n[r._field]}setNodeDefaults(t){let a=this;t.map(r=>r!=null&&r.size?r:Object.assign(r,{size:a.default_nodesize})),t.map(r=>r!=null&&r.longlat?r:Object.assign(r,{longlat:a.pointToLongLat([r.x,r.y])})),t.map(r=>{let[s,n]=a.longLatToPoint(r.longlat);return r.x=s,r.y=n,r}),t.map(r=>(r.state=a.getState(r.longlat),r)),t.map(r=>{var s;if(!((s=r==null?void 0:r.node_type)!=null&&s.includes("land_surface"))){let n=a.getDesignStormDepth(r.longlat);if(n==null)return r;r.design_storm_depth_inches=+parseFloat(n).toFixed(2),r!=null&&r.data&&(r.data.design_storm_depth_inches=r.design_storm_depth_inches)}return r}),t.map(r=>{var s;if(!((s=r==null?void 0:r.node_type)!=null&&s.includes("land_surface"))){let n=a.getRefDataKey(r.longlat);if(n==null)return r;r.ref_data_key=n,r!=null&&r.data&&(r.data.ref_data_key=r.ref_data_key)}return r})}update(){let t=this,a;a=t.graph.nodes,t.setNodeDefaults(a),t.path=t.path.data(t.graph.edges),t.path.classed("selected",s=>s===t._selected_edge).style("marker-end","url(#end-arrow)"),t.path.exit().remove(),t.path=t.path.enter().append("svg:path").classed("link",!0).classed("selected",s=>s===t._selected_edge).style("marker-end","url(#end-arrow)").on("mousedown",(s,n)=>{s.ctrlKey||(t._mousedown_edge=n,t._selected_edge=t._mousedown_edge===t._selected_edge?null:t._mousedown_edge,t._selected_node_id=null,t.update())}).merge(t.path),t.circle=t.circle.data(a,s=>JSON.stringify(s)),t.circle.selectAll(".node").attr("r",s=>t.recalculateNodeSize(s)).style("fill",s=>{let n=t.getColor(s);return s.id===t._selected_node_id?n.brighter(3):n}).style("stroke",s=>t.getColor(s).darker().toString()),t.circle.selectAll("text").text(s=>s.id),t.circle.exit().remove();const r=t.circle.enter().append("svg:g");r.append("circle").classed("node has-tooltip",!0).attr("r",s=>t.recalculateNodeSize(s)).style("fill",s=>{let n=t.getColor(s);return s.id===t._selected_node_id?n.brighter(3):n}).style("stroke",s=>t.getColor(s).darker().toString()).on("mouseover",function(s,n){t._hovered_node=n,t.store.dispatch("isNodeHovered",{node_hovered:n.id}),!t._selected_node_id&&(p(t,"store.state.current_node_data.id"),n.id),!(!t._mousedown_node||n.id===t._mousedown_node.id)&&y.select(s.target).attr("transform","scale(1.25)")}).on("mouseout",(s,n)=>{t._hovered_node=void 0,t.store.dispatch("isNodeHovered",{node_hovered:void 0}),!(!t._mousedown_node||n.id===t._mousedown_node.id)&&y.select(s.target).attr("transform","")}).on("mousedown",(s,n)=>{s.shiftKey||s.ctrlKey||(t.store.dispatch("drag_lock",{drag_lock:!0}),t._mousedown_node=n,t._mousedown_node.id===t._selected_node_id?(t._selected_node_id=null,t.onNodeUnSelected(n),t.store.dispatch("changedSelectedNode",{selected_node_id:null})):(t._selected_node_id=t._mousedown_node.id,m.dispatch("changedSelectedNode",{selected_node_id:n.id}),t.onNodeSelected(n)),t._selected_edge=null,t.update())}).on("mouseup",(s,n)=>{if(t.dragLine.classed("hidden",!0).style("marker-end",""),t.store.dispatch("drag_lock",{drag_lock:!1}),!t._mousedown_node||!t.editing_mode)return;if(t._mouseup_node=n,t._mouseup_node.id===t._mousedown_node.id){t.resetMouseVars();return}y.select(s.target).attr("transform","");const c=t._mousedown_node.id,_=t._mouseup_node.id,u=t.graph.edges.find(o=>o.source===c&&o.target===_);if(!u){let o=t.graph.nodes.find(d=>d.id===c),l=t.graph.nodes.find(d=>d.id===_);t.graph.edges.push({source:o,target:l})}t._selected_edge=u,t._selected_node_id=null,t.update()}),r.append("text").attr("x",0).attr("y","0.3rem").attr("class","id no-select align-middle text-center font-bold text-base pointer-events-none").text(s=>s.id),t.circle=r.merge(t.circle),t.tick()}zoom_to_group(t){let a=this;const r=a.container.node().getBBox(),[[s,n],[c,_]]=[[r.x,r.y],[r.x+r.width,r.y+r.height]];t==null&&(t=1);let u=a.transform.k;for(;t>0;)t-=1,u=Math.min(1<<28,u*(.9/Math.max((c-s)/a.width,(_-n)/a.height)));const o=[s+r.width/2,n+r.height/2];let l=p(a,"store.state.zoomTransform");a.svg.interrupt().transition().duration(800).call(l,y.zoomIdentity.translate(a.width/2,a.height/2).scale(-u).translate(...a.transform.invert(o)).scale(-1))}mouseenter(){this.svg.classed("listening-to-keys",!0)}mouseleave(){this.svg.classed("listening-to-keys",!1)}keydown(t){let a=this;if(a.svg.classed("listening-to-keys")&&(t.keyCode,t.keyCode===71&&a.zoom_to_group(),!!a.editing_mode)){if(t.keyCode===17){a.circle.call(a.drag),a.svg.classed("ctrl",!0);return}if(!(!this._selected_node_id&&!this._selected_edge))switch(t.keyCode){case 8:case 46:this._selected_node_id?(this.graph.nodes.splice(this.graph.nodes.map(r=>r.id).indexOf(this._selected_node_id),1),this.graph.spliceLinksForNode(this._selected_node_id)):this._selected_edge&&this.graph.edges.splice(this.graph.edges.indexOf(this._selected_edge),1),this._selected_edge=null,this._selected_node_id=null,a.store.dispatch("changedSelectedNode",{selected_node_id:null}),this.resetMouseVars(),this.update();break}}}keyup(t){let a=this;t.keyCode===17&&(a.circle.on(".drag",null),a.svg.classed("ctrl",!1))}mousedown_addNode(t){var u;let a=this;if(this.svg.classed("active",!0),t.shiftKey||t.ctrlKey||!a.editing_mode||a._mousedown_node||a._mousedown_edge||a._hovered_node){a.resetMouseVars();return}const r=y.pointer(t);let[s,n]=r,c=a.pointToLongLat([s,n]);const _={id:ne(5),x:s,y:n,size:a.default_nodesize,longlat:c};_.design_storm_depth_inches=+parseFloat(a.getDesignStormDepth(_.longlat)).toFixed(2),_.ref_data_key=a.getRefDataKey(_.longlat),this.graph.nodes.push(_),a.store.dispatch("changedSelectedNode",{selected_node_id:_.id}),a._selected_node_id=(u=this.graph.nodes.find(o=>o.id===_.id))==null?void 0:u.id,a.update(),a.mouseup()}mouseup(){if(this.svg.classed("active",!1),this._mousedown_node){this.dragLine.classed("hidden",!0).style("marker-end","");return}this.resetMouseVars()}mousemove(t){let a=this;if(!this._mousedown_node||!this.editing_mode)return;let{x:r,y:s}=p(this,"store.state.graph.nodes").find(c=>c.id===this._mousedown_node.id);a.dragLine.style("marker-end","url(#end-arrow)").classed("hidden",!1).attr("d",`M${a._mousedown_node.x},${a._mousedown_node.y}L${a._mousedown_node.x},${a._mousedown_node.y}`);const n=y.pointer(t,this.container.node());this.dragLine.attr("d",`M${r},${s}L${n[0]},${n[1]}`)}resetMouseVars(){this._mousedown_node=null,this._mouseup_node=null,this._mousedown_edge=null}_render(){let t=this;t.subscribe(),t.update(),t.zoom_to_group()}}class ft extends b{constructor(){super({store:m})}_render(){let e=this;e.svg=y.select("#map").append("svg").attr("viewBox",[0,0,y.select("#map").node().getBoundingClientRect().width,y.select("#map").node().getBoundingClientRect().height]),e.map=new ct({id:"map",svg:e.svg});const t=e.map.vector;e.states=new _t({vector:t}),e.designStorm=new pt({vector:t}),e.refData=new ut({vector:t}),e.graphEditor=new mt({svg:e.svg}),e.map.render(),e.states.render(),e.designStorm.render(),e.refData.render(),e.graphEditor.render()}}Ke();const I=new ft;class yt extends b{constructor(e){super({store:m});let t=this;t.parent_id=e.parent_id,t.id=e.id||""}get current_node_data(){let e=p(this,"store.state.selected_node_id")||p(this,"store.state.node_hovered");if(e)return p(this,"store.state.graph.nodes").find(t=>t.id===e)}get show_info_tooltip(){return p(this,"store.state.show_info_tooltip")}tooltip_move(e){let t=this.element.node().getBoundingClientRect().width,a=null,r=null;e.type=="touchstart"?(a=e.touches[0].pageX,r=e.touches[0].pageY):(a=e.pageX,r=e.pageY);let s=Math.max(0,window.innerWidth-aNode ID: ${t.id}`);let r=` + + Node Type: + ${t.node_type||"No Data"} + + `;a.select(".info-tooltip-content table").html(r);let s=Object.keys(t).filter(_=>_.charAt(0)==="_"),n=oe(t,[],s),c=`
${JSON.stringify(n,void 0,2)}
`;a.select(".info-tooltip-json").html(c)}_render(){let e=this,t=d3.select(`#${e.parent_id}`);e.element=t.append("div").attr("id",e.id||"").classed("transition-opacity opacity-0 tooltip rounded shadow-lg p-1 bg-gray-50",!0);let a=e.element.html("");a=a.append("div").classed("info-tooltip p-2",!0),a.append("div").classed("info-tooltip-header mt-2 uppercase text-lg font-bold",!0),a.append("div").classed("info-tooltip-content text-sm",!0).append("table"),a.select(".info-tooltip-content").append("div").classed("info-tooltip-json",!0),a.append("div").classed("info-tooltip-footer",!0),e.store.events.subscribe("stateChange",()=>this.update_contents())}}const ht=new yt({parent_id:"editor-info",id:"node-info-tooltip"});class gt extends b{constructor(e){super({store:m});let t=this;t.parent_id=e.parent_id,t.id=e.id||""}get show_tips(){return p(this,"store.state.graph_edit_mode")}hide(){let e=this.element;e.classed("opacity-100 h-auto",!1),e.classed("opacity-0 h-0",!0)}show(){let e=this.element;e.classed("opacity-100 h-auto",!0),e.classed("opacity-0 h-0",!1)}update_contents(){let e=this;if(!e.show_tips){e.hide();return}e.show()}_template(){return` +
+ Edit Graph is Active +
+
+ Click in the open space to add a node. + +
+ Drag from one node to another to add an edge + +
+ Click a node or an edge to select it. + +
+ Press Ctrl & Drag a node to move the graph node layout. + Dragging will pin the node to the location. + +
+ Press Delete to remove the selected node or edge. + This is possible only when the mouse is within the map editor. + +
+ Press G to zoom the map to the graph extents. + +
+ `}_render(){let e=this,t=d3.select(`#${e.parent_id}`);e.element=t.append("div").attr("id",e.id||"").classed("transition-opacity opacity-0 p-2 h-auto text-justify",!0).html(e._template()),this.update_contents(),e.store.events.subscribe("isGraphEditMode",()=>this.update_contents())}}const bt=new gt({parent_id:"editor-info",id:"editor-tips"});class R extends b{constructor(e){super({store:m});let t=this;t.id=e.id,t.title=e.title,t.icon=e.icon,t.callback=e.callback}_template(){return` + `}_render(){let e=this,t=y.select(`#${this.parent_id}-button-container`).append("div").classed("flex",!0),a=t.html();a+=this._template(),t.html(a),this.button=t.select(`button#${this.id}-button`),this.button.on("click",e.callback.bind(e))}}const vt=new R({id:"node_editor",title:"Configuration",icon:` + + + + `,callback:function(){this.store.dispatch("changedPanel",{active_panel:"node-editor-panel"})}}),wt=new R({id:"load_table",title:"Load from File",icon:` + + + + `,callback:function(){this.store.dispatch("changedPanel",{active_panel:"load-table-panel"})}}),kt=new R({id:"save_files",title:"Save Files",icon:` + + + + +`,callback:function(){this.store.dispatch("changedPanel",{active_panel:"save-files-panel"})}}),St=new R({id:"clear_scenario",title:"Clear Scenario",icon:` +
+ + + + + +
+`,callback:function(){confirm("Are you sure you want to clear all data?")&&new E([],[])}}),xt=new R({id:"check_scenario",title:"Verify Inputs",icon:` +
+ + + + + +
+`,callback:async function(){Promise.all([ae(),te()]).then(i=>{i.length;const e=i.filter(a=>a.alert_type.toLowerCase()=="error");if(e.length>0){let a=e[0];a.msg=`
${e.map(r=>r.msg).join("
")}
`,this.store.dispatch("raiseModal",{modal_content:a});return}if(i.filter(a=>a.alert_type.toLowerCase()=="success").length===i.length){let a={title:"Validation Successful",msg:"",alert_type:"success"};this.store.dispatch("raiseModal",{modal_content:a});return}}).catch(i=>{let e={title:"Validation Failed",msg:`
${JSON.stringify(i,void 0,2)}
`,alert_type:"error"};this.store.dispatch("raiseModal",{modal_content:e})})}}),Tt=new R({id:"run_scenario",title:"Run Scenario",icon:` +
+ + + + + + +
+`,callback:async function(){var e;let i=await re();if(((e=i==null?void 0:i.status)==null?void 0:e.toLowerCase())==="success"){let t=p(i,"data.results")||[],a=p(i,"data.leaf_results")||[];this.store.dispatch("newResults",{results:t.concat(a)})}}}),$t=new R({id:"find_node",title:"Find",icon:` + + + + +`,callback:function(){this.store.dispatch("changedPanel",{active_panel:"find-node-panel"})}});class jt extends b{constructor(e){super({store:m,id:e.id,children:e.children})}_template(){return` +
+
+ +
+
+ `}_render(){this.element=y.select(`#${this.id}`),this.element.html(this._template())}}const Rt=new jt({id:"editor-menu",children:[$t,vt,wt,kt,St,xt,Tt]});class P extends b{constructor(e){super({store:m,id:e.id,children:e.children});let t=this;t.title=e.title,t.options=e}enter(){var r;let e=this,t=e.element;e.transition_direction="entering";let a;a=t.select(".drawer-overlay").node(),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-40"),a=t.select(".drawer-panel").node(),a.className=a.className.replace(/\btranslate-x-.+?\b/g,""),a.classList.add("translate-x-0"),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-100"),(r=e==null?void 0:e.options)!=null&&r.enter_callback&&e.options.enter_callback()}exit(){var r;let e=this,t=document.querySelector(`#${this.id}`),a;e.transition_direction="exiting",a=t.querySelector(".drawer-overlay"),a.className=a.className.replace(/\bopacity-.+?\b/g,""),a.classList.add("opacity-0"),a=t.querySelector(".drawer-panel"),a.className=a.className.replace(/\btranslate-x-.+?\b/g,""),a.classList.add("translate-x-full"),(r=e==null?void 0:e.options)!=null&&r.exit_callback&&e.options.exit_callback()}_template(){return` +
+ + +
+ `}_render(){var a;let e=this;e.element=y.select(`#${this.id}`).append("div").classed("drawer-container",!0),e.element.html(this._template()),e.element.select(`#${this.id}-close-button`).on("click",this.exit.bind(this)),((a=this==null?void 0:this.children)==null?void 0:a.length)>0&&e.element.select(`#${this.id}-content`).html("");let t=e.element.select(".drawer-container").classed("hidden",!0);e.exit(),t.classed("hidden",!1)}}class Ft extends P{constructor(e){super(e);let t=this;t.store.events.subscribe("changedPanel",({active_panel:a})=>a==="find-node-panel"?t.enter():null)}}class Dt extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="node-editor-panel"?r.enter():null)}}class Et extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="load-table-panel"?r.enter():null)}}class Nt extends P{constructor({id:e,title:t,children:a}){super({store:m,id:e,title:t,children:a});let r=this;r.store.events.subscribe("changedPanel",({active_panel:s})=>s==="save-files-panel"?r.enter():null)}}class At extends b{constructor({children:e}){super({store:m,children:e})}_template(){return` +
+
+
+
+ `}_render(){y.select("body").append("div").html(this._template())}}class qt extends b{constructor(e){super({store:m,id:e.id});let t=this;t.primary_callback=a=>{Ct(a.find_node)},t.primary_button_label=e.primary_button_label||"Find"}_template_primary_button(){return this.primary_callback==null?"":``}_template(){return` +
+ + +
+
+
+ + +
+ ${this._template_primary_button()} +
+
+
`}_render(){let e=this;e.element=d3.select(`#${e.parent_id}-content`).append("div"),e.element.html(e._template());let t=e.element.select("form");t.attr("method","get").on("submit",function(a){a.preventDefault(),t.selectAll("input").property("disabled",!1);const r=new FormData(a.target),s=q(Object.fromEntries(r.entries()));return e.primary_callback.bind(e)(s),!1})}}const Ot=new Ft({id:"find-node-drawer",title:"Find Node",children:[new qt({id:"find-node-ui"})],exit_callback:()=>{p(m,"state.graph.nodes").map(e=>pe(e)),m.dispatch("foundNodeIds",{}),m.dispatch("editorUpdate")}}),Lt=i=>{i.color="orange",i.size=40},pe=i=>{i.color=void 0,i.size=void 0},Ct=i=>{let e=p(m,"state.graph.nodes"),t=e.filter(r=>r.id.includes(i));e.map(r=>pe(r));let a=[];for(let r of t)r&&a.push(r);if(a.length){for(let r of a)Lt(r);m.dispatch("foundNodeIds",{found_node_ids:a.map(r=>r.id)})}m.dispatch("editorUpdate")};class It extends b{constructor(e){super({store:m})}get selected_node_id(){return p(this,"store.state.selected_node_id")}update(){let e=this.selected_node_id?`Node: ${this.selected_node_id.toString()}`:'
🡄 Select a Node in the Editor Map
';this.element.html(e)}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("text-lg font-bold pb-2",!0),e.update(),e.store.events.subscribe("changedSelectedNode",()=>e.update())}}class Mt extends b{constructor(e){super({store:m});let t=this;t.store.events.subscribe("changedSelectedNode",()=>t.update())}get nodes(){return p(this,"store.state.graph.nodes")}get selected_node_id(){return p(this,"store.state.selected_node_id")}toggleNodeType(){let e=this.element.select("input:checked").property("value");this.store.dispatch("nodeEditorType",{node_editor_type:e||"none"})}_template(){return` +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
`}update(){let e=this;e.element.classed("hidden",e.selected_node_id==null);let t=this.nodes.find(a=>a.id===this.selected_node_id);e.element.select(`input[value=${(t==null?void 0:t.node_type)||"none"}]`).property("checked",!0).dispatch("change"),e.toggleNodeType()}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("hidden",!0),e.element.html(e._template()),e.element.selectAll("input").on("change",this.toggleNodeType.bind(this)),e.update()}}const Pt="modulepreload",Vt=function(i){return"/app/"+i},J={},ue=function(e,t,a){let r=Promise.resolve();if(t&&t.length>0){const s=document.getElementsByTagName("link");r=Promise.all(t.map(n=>{if(n=Vt(n),n in J)return;J[n]=!0;const c=n.endsWith(".css"),_=c?'[rel="stylesheet"]':"";if(!!a)for(let l=s.length-1;l>=0;l--){const d=s[l];if(d.href===n&&(!c||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${_}`))return;const o=document.createElement("link");if(o.rel=c?"stylesheet":Pt,c||(o.as="script",o.crossOrigin=""),o.href=n,document.head.appendChild(o),c)return new Promise((l,d)=>{o.addEventListener("load",l),o.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${n}`)))})}))}return r.then(()=>e()).catch(s=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=s,window.dispatchEvent(n),!n.defaultPrevented)throw s})};async function Wt(i,e){let a=Object.assign({data:[{}],clipboard:!0,clipboardPasteAction:"update",minHeight:100,autoResize:!1,layout:"fitData",responsiveLayout:!1,history:!0,tooltipsHeader:!0,footerElement:'',columns:[]},e),{default:r}=await ue(()=>import("./tabulator.es2015-fNsKARNq.js"),__vite__mapDeps([]));return new r(i,a)}class zt extends b{constructor(e){super({store:m})}get node_editor_type(){return p(this,"store.state.node_editor_type")}get selected_node(){let e=p(this,"store.state.selected_node_id");return p(this,"store.state.graph.nodes").find(a=>a.id===e)}landSurfaceTableOptions(){var a,r;let e=this,t=[{}];return(a=e.selected_node)!=null&&a.data?t=v(e.selected_node.data):t=[{node_id:(r=e.selected_node)==null?void 0:r.id}],{data:t,maxHeight:"500px",rowContextMenu:[{label:" Select Row",action:function(s,n){n.select()}},{label:" Add Row",action:function(s,n){var c;e.table.addRow({node_id:(c=e.selected_node)==null?void 0:c.id})}},{label:" Delete Row",action:function(s,n){n.delete()}}],initialSort:[{column:"surface_key",dir:"asc"}],columns:[{title:"Node Id",field:"node_id",editor:"input",editable:s=>s.getRow().getPosition()<1},{title:"Surface Key",field:"surface_key",editor:"input"},{title:"Area (acres)",field:"area_acres",hozAlign:"center",editor:!0,width:90},{title:"Impervious Area (acres)",field:"imp_area_acres",hozAlign:"center",editor:!0,width:90}]}}setCurrentNodeDataToTableData(){var r;if(!this.selected_node)return alert("no node selected"),!1;let e=v(this.table.getData()),t=this.selected_node,a=(r=e[0])==null?void 0:r.node_id;e.forEach(s=>s.node_id=a),t.node_type=this.node_editor_type,t.id!==a&&(t.id=a,m.dispatch("changedSelectedNode",{selected_node_id:a})),t.data=e,this.store.dispatch("newGraph"),this.update()}async buildLandSurfaceTable({id:e}){let t=this;t.element.select(`#${e}`).remove();let a=t.element.append("div").attr("id",e).classed("grid grid-cols-1 grid-rows-auto pt-8",!0);const r=e+"-landsurface-tabulator";let s=a.append("div").classed("flex flex-row p-2 gap-2",!0),n=s.append("button").classed("btn btn-gray flex flex-row",!0).html(` + + + + + + undo + `),c=s.append("button").classed("btn btn-gray flex flex-row",!0).html(` + redo + + + + + + + `);a.append("div").attr("id",r);let _=t.landSurfaceTableOptions();t.table=await Wt(`#${r}`,_),n.on("click",()=>t.table.undo()),c.on("click",()=>t.table.redo()),a.append("div").classed("flex flex-row justify-end py-4",!0).append("button").classed("btn btn-blue",!0).on("click",()=>{this.setCurrentNodeDataToTableData.bind(this)()}).text("Apply")}async update(){let e=this;if(e.node_editor_type!=="land_surface"){e.element.classed("hidden",!0);return}e.element.classed("hidden",!1);let t=`${e.parent_id}-content-editor`;await e.buildLandSurfaceTable({id:t})}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").classed("mt-4",!0).classed("hidden",!0),e.update(),e.store.events.subscribe("nodeEditorType",()=>e.update()),e.store.events.subscribe("changedSelectedNode",()=>e.update()),e.store.events.subscribe("changedPanel",()=>e.update()),e.store.events.subscribe("newGraph",()=>e.update())}}class Bt extends b{constructor(e){super({store:m})}get node_editor_type(){return p(this,"store.state.node_editor_type")}get selected_node(){let e=p(this,"store.state.selected_node_id");return p(this,"store.state.graph.nodes").find(a=>a.id===e)}get config(){let{schema:e,facility_types:t,facility_type_map:a,facility_alias_map:r,facility_label_map:s}=p(this,"store.state");return{schema:e,facility_types:t,facility_type_map:a,facility_alias_map:r,facility_label_map:s}}update(){let e=this;e.element.html("").classed("flex flex-col w-full",!0),e.element.classed("hidden",e.node_editor_type!=="treatment_facility");let t=e.element.append("select").classed("px-2 my-4 h-8 border rounded-md",!0).attr("id","facility-picker").on("change",function(){var f,h,S,g,k,T;let s=e.element.select("#facility-picker").property("value");if(!s.length)return!1;let n=e.config.facility_type_map[s],c=v(p(e,"selected_node.data")||{});Array.isArray(c)&&(c={});let _={node_id:e.selected_node.id,facility_type:s,ref_data_key:((h=(f=e.selected_node)==null?void 0:f.data)==null?void 0:h.ref_data_key)||((S=e.selected_node)==null?void 0:S.ref_data_key),design_storm_depth_inches:((k=(g=e.selected_node)==null?void 0:g.data)==null?void 0:k.design_storm_depth_inches)||((T=e.selected_node)==null?void 0:T.design_storm_depth_inches)};_=Object.assign(c,_);const u=$=>{e.selected_node.node_type=e.node_editor_type,e.selected_node.data=Object.assign({facility_type:e.element.select("#facility-picker").property("value")},v($)),e.selected_node.id=$.node_id,e.store.dispatch("newGraph")};let o=p(e,"store.state.nereid_state"),l=p(e,"store.state.nereid_region"),d=p(e,`store.state.treatment_facility_fields.${o}.${l}`)||p(e,"store.state.treatment_facility_fields.state.region");console.debug("tmnt facility fields:",d),Ut("#facility-form",e.config.schema[n],_,d.disabled,d.ignored,u.bind(e))});e.element.append("div").attr("id","facility-form");let a=v(e.config.facility_types||[]);a.unshift(""),t.selectAll("option").data(a).enter().append("option").attr("value",s=>s&&e.config.facility_label_map[s]).text(s=>s);let r=p(e,"selected_node.data.facility_type");r&&(e.element.select("#facility-picker").property("value",r),t.on("change")())}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div"),e.id=`${e.parent_id}-content-treatment-form`,e.element.attr("id",e.id),e.update(),e.store.events.subscribe("stateChange",()=>this.update())}}function Ut(i,e,t,a,r,s){let n=[...e.required],c=Object.keys(e.properties).filter(d=>!n.includes(d));n.push(...c);let _=[];for(const d of n.filter(f=>!r.includes(f))){let f=e.properties[d];f.name=d,_.push(f)}let u=y.select(i);u.html("");let o=u.append("form");o.attr("id",i.replace("#","")+"-form").attr("name",i.replace("#","")+"-form").attr("method","get").on("submit",function(d){d.preventDefault(),o.selectAll("input").property("disabled",!1);const f=new FormData(d.target),h=q(Object.fromEntries(f.entries()));return s&&s(h),!1}),o.selectAll("div").data(_).enter().append("div").classed("form-group flex flex-row w-full gap-4 text-sm my-4 h-8 items-center",!0).classed("required",d=>e.required.includes(d.name)).each(function(d,f){let h=e.required.includes(d.name),S=(d.description||d.name)+(h?" (required)":" (optional)"),g=y.select(this);g.append("label").classed("control-label py-2 flex w-1/2 ",!0).attr("title",S).text(d.title);let k;switch(d.type){case"string":k=g.append("input").attr("name",d.name).attr("id",d.name).attr("title",S).property("required",e.required.includes(d.name||"")).property("disabled",a.includes(d.name)).classed("border-2 rounded-md px-2 py-1",!0),k.attr("type","text").attr("pattern",d.pattern||".*").attr("value",d.example||d.default||"");break;case"number":k=g.append("input").attr("name",d.name).attr("id",d.name).attr("title",S).property("required",e.required.includes(d.name||"")).property("disabled",a.includes(d.name)).classed("border-2 rounded-md px-2 py-1",!0),k.attr("type","number").attr("step","0.001").attr("value",d.example||d.default||"");break;case"boolean":k=g.append("div").classed("flex flex-row",!0);for(let T of[!0,!1]){let $=d.name+T.toString(),H=k.append("div").classed("flex flex-row items-center",!0);H.append("input").classed("form-check-input p-2",!0).classed("p-2",!0).attr("type","radio").attr("name",d.name).attr("id",$).attr("title",S).property("checked",d.default==T).property("disabled",a.includes(d.name)).attr("value",T),H.append("label").classed("p-2",!0).attr("for",$).attr("title",S).text(T.toString())}break}});for(let[d,f]of Object.entries(t))if(["true","false"].includes(f))for(let h of["true","false"])y.select("#"+d+h).property("checked",f==h);else y.select("#"+d).property("value",f);let l=o.append("div").classed("flex justify-end",!0);l.append("div"),l.append("button").classed("btn btn-blue",!0).attr("type","submit").text("Apply")}const Ht=new It,Gt=new Mt,Jt=new zt,Kt=new Bt,Qt=new Dt({id:"node-editor-drawer",title:"Edit Nodes",children:[Ht,Gt,Jt,Kt]});class V extends b{constructor(e){super({store:m});let t=this;t.id=e.id,t.title=e.title,t.data=[{}],t.data_callback=e.data_callback||function(a){console.debug("loaded data: ",a)},t.primary_callback=e.primary_callback||function(){console.debug(`clicked primary button load files UI ${t.id}`)},t.primary_button_label=e.primary_button_label||"Apply",t.secondary_callback=e.secondary_callback||null,t.secondary_button_label=e.secondary_button_label||"Update"}_template_primary_button(){return this.primary_callback==null?"":``}_template_secondary_button(){return this.secondary_callback==null?"":``}_template(){return` +
+
${this.title}
+ +
+
+
+ + +
+ ${this._template_secondary_button()} + ${this._template_primary_button()} +
+
+
`}loadFileAsJson(e,t){let a=e.target.files[0];if(!a.type.match("csv|excel|json")){alert("csv or json please");return}let r=this,s=new FileReader;s.onload=function(n){return function(c){let _;n.type.match("csv|excel")?_=y.csvParse(c.target.result):n.type.match("json")&&(_=JSON.parse(c.target.result)),_=Array.isArray(_)?_.map(u=>q(u)):_,r.data=_,e.target.value=""}}(a),s.readAsText(a)}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div"),e.element.html(e._template()),e.primary_button=e.element.select(`#${this.id}-primary-button`),e.primary_button.on("click",()=>{e.data_callback.bind(e)(e.data),e.primary_callback.bind(e)(),e.element.select(`#${this.id} label`)}),e.secondary_button=e.element.select(`#${this.id}-secondary-button`),e.secondary_button.on("click",()=>{e.data_callback.bind(e)(e.data),e.secondary_callback.bind(e)(),e.element.select(`#${this.id} label`)}),e.input=e.element.select(`#${this.id} input`),e.input.on("change",t=>{e.loadFileAsJson.bind(e)(t);let a=e.element.select(`#${this.id} label`);a.text(t.target.files[0].name),a.classed("font-bold",!0);let r=a.node();r.className=r.className.replace(/\btext-gray-.+?\b/g,""),r.classList.add("text-gray-700")})}}const Yt=new V({id:"graph-file-loader",title:"Load Graph (.csv)",primary_callback:M,secondary_callback:ce,data_callback:function(e){let t=[...new Set(e.map(u=>u.source).concat(e.map(u=>u.target)))],a=v(this.store.state.graph.nodes.filter(u=>t.includes(u.id))||[{}]),r=a.map(u=>u.id),s=[],n=50,c=50,_;for(let u of t){if(r.includes(u))_=a.find(o=>o.id===u);else{let o=e.find(l=>l.source===u);_={id:u,x:+(o==null?void 0:o.x)||n+10*Math.random(),y:+(o==null?void 0:o.y)||c+10*Math.random()},(o!=null&&o.x||o!=null&&o.y)&&(_.fx=+(o==null?void 0:o.x),_.fy=+(o==null?void 0:o.y))}s.push(_)}this.store.dispatch("setStagedChanges",{staged_changes:{edges:e,nodes:s}})}}),Xt=new V({id:"land-surface-file-loader",title:"Load Land Surfaces (.csv)",primary_callback:M,data_callback:function(e){var _,u;let t=[...new Set(e.map(o=>o.node_id))],a=v(p(this,"store.state.graph.nodes")),r=v(p(this,"store.state.graph.edges")).map(o=>({source:o.source.id,target:o.target.id})),s=a.map(o=>o.id),n=[],c=()=>400*Math.random();for(let o of t){let l=e.filter(g=>g.node_id===o),d,f=B((_=l.filter(g=>g==null?void 0:g.long))==null?void 0:_.map(g=>+g.long)),h=B((u=l.filter(g=>g==null?void 0:g.lat))==null?void 0:u.map(g=>+g.lat)),S=l.map(({node_id:g,surface_key:k,area_acres:T,imp_area_acres:$})=>({node_id:g,surface_key:k,area_acres:T,imp_area_acres:$}));s.includes(o)?(d=a.find(g=>g.id===o),d.node_type="land_surface",d.data=S,f&&h&&(d.longlat=[+f,+h])):(d={id:o,node_type:"land_surface",x:c(),y:c(),data:S},f&&h&&(d.longlat=[+f,+h]),n.push(d))}a=a.concat(n),this.store.dispatch("setStagedChanges",{staged_changes:{edges:r,nodes:a}})}}),Zt=new V({id:"treatment-facilities-file-loader",title:"Load Treatment Facilities (.csv)",primary_callback:M,data_callback:function(e){let t=[...new Set(e.map(_=>_.node_id))],a=v(p(this,"store.state.graph.nodes")||[{}]),r=v(p(this,"store.state.graph.edges")||[{}]).map(_=>({source:_.source.id,target:_.target.id})),s=a.map(_=>_.id),n=[],c=()=>400*Math.random();for(let _ of t){let u=e.find(f=>f.node_id===_),o,{long:l,lat:d}=u;s.includes(_)?(o=a.find(f=>f.id===_),o.data=u,o.node_type="treatment_facility",l&&d&&(o.longlat=[+l,+d])):(o={id:_,node_type:"treatment_facility",x:c(),y:c(),data:u},l&&d&&(o.longlat=[+l,+d]),n.push(o))}a=a.concat(n),this.store.dispatch("setStagedChanges",{staged_changes:{edges:r,nodes:a}})}}),ea=new V({id:"scenario-file-loader",title:"Load Scenario (.json)",primary_callback:M,secondary_callback:ce,data_callback:function(e){let t=e.graph,a=e.name,r=v(t.nodes||[{}]);for(let n of r)n.id==null&&console.error("bad egg:",n);let s=t.edges.map(n=>({source:n.source.id,target:n.target.id}));this.store.dispatch("setStagedChanges",{staged_changes:{edges:s,nodes:r,scenario_name:a}})}}),ta=new Et({id:"load-table-drawer",title:"Load from File",children:[Yt,Xt,Zt,ea]});class aa extends b{constructor(e){super({store:m,id:e.id})}get scenario_name(){return p(this.store,"state.scenario_name")}get scenario(){return{name:this.scenario_name,graph:p(this,"store.state.graph")}}saveScenarioBlob(){let e={filename:(this.scenario.name.replaceAll(" ","_")||"scenario")+".json",json:JSON.stringify(this.scenario,void 0,2)},t=new Blob([e.json],{type:"text/plain;charset=utf-8"});W.saveAs(t,e.filename)}dumpScenario(){let e=`
${JSON.stringify(this.scenario,void 0,2)}
`;this.element.select("#dump-scenario-text").html(e)}clearScenario(){this.element.select("#dump-scenario-text").html("")}_template(){return` +
+
Save Scenario to File (json) + +
+
+ Print Scenario for Review (json) + + +
+
+
+ + `}_render(){let e=this;e.element=y.select(`#${e.parent_id}-content`).append("div").attr("id",e.id),e.element.html(e._template()),e.button=e.element.select("#save-scenario"),e.button.on("click",e.saveScenarioBlob.bind(e)),e.button=e.element.select("#dump-scenario"),e.button.on("click",e.dumpScenario.bind(e)),e.button=e.element.select("#clear-scenario"),e.button.on("click",e.clearScenario.bind(e))}}class ra extends b{constructor(e){super({store:m,id:e.id})}get facility_types(){return Object.keys(p(this,"store.state.facility_type_map"))}get facility_type_map(){return p(this,"store.state.facility_type_map")}get schema(){return p(this,"store.state.schema")}get scenario_name(){return p(this.store,"state.scenario_name")}get facility_properties(){let e=new Set;for(let t of this.facility_types){let a=this.facility_type_map[t],r=this.schema[a];Object.keys(r.properties).forEach(e.add,e)}return["long","lat"].forEach(e.add,e),e}get facility_data(){let e=this.facility_properties,t=[],a=v(p(this,"store.state.graph.nodes")||[{}]).filter(r=>r.node_type=="treatment_facility");return a.length==0&&(a=[{}]),a.forEach(r=>{let s={};for(let c of e)s[c]=p(r.data,c)||"";let n=(r==null?void 0:r.longlat)||["",""];s.long=n[0],s.lat=n[1],t.push(s)}),t}facility_template(){let e=this,t=[],a=p(e,"store.state.nereid_state"),r=p(e,"store.state.nereid_region"),s=p(e,`store.state.treatment_facility_fields.${a}.${r}`),n=[...this.facility_properties].filter(c=>!s.ignored.includes(c));for(let[c,_]of Object.entries(this.facility_type_map)){let u=this.schema[_],o={};for(let l of n){let d=p(u.properties[l],"type")||"";u.required.includes(l)&&(d+="-req"),s.disabled.includes(l)&&(d+="-uneditable"),o[l]=d}o.long="number",o.lat="number",o.facility_type=c,t.push(o)}return t}saveTreatmentCSV(){let e=this.facility_data,a={filename:`${this.scenario_name.replaceAll(" ","-")}-treatment_facilities.csv`,csv:U({data:e})},r=new Blob([a.csv],{type:"text/plain;charset=utf-8"});W.saveAs(r,a.filename)}saveTreatmentTemplateCSV(){let e=this.facility_template(),t=p(this,"store.state.nereid_state"),a=p(this,"store.state.nereid_region"),r={filename:`${t}-${a}-treatment_facilities-template.csv`,csv:U({data:e})},s=new Blob([r.csv],{type:"text/plain;charset=utf-8"});W.saveAs(s,r.filename)}_template(){return` +
+
Save Treatment Facility Info to File (csv) + +
+
+
Save Treatment Facility Template to File (csv) + +
+
{}),e.element.select("#save-tmnt").on("click",e.saveTreatmentCSV.bind(e)),e.element.select("#save-tmnt-template").on("click",e.saveTreatmentTemplateCSV.bind(e))}}const sa=new aa({id:"save-scenario"}),ia=new ra({id:"save-tmnt-facility"}),na=new Nt({id:"save-files-drawer",title:"Save to File",children:[sa,ia]}),oa=new At({children:[Ot,Qt,ta,na]}),la=new at({id:"editor-tab",children:[dt,I,ht,bt,Rt,oa]});async function K(i,e){let a=Object.assign({data:[{}],maxHeight:"500px",minHeight:80,autoResize:!1,layout:"fitData",responsiveLayout:!1,history:!1,tooltipsHeader:!0,footerElement:'',columns:[],initialSort:[{column:"node_id",dir:"asc"}]},e),{default:r}=await ue(()=>import("./tabulator.es2015-fNsKARNq.js"),__vite__mapDeps([]));return r.prototype.extendModule("format","formatters",{gscwmp:function(s,n){let{precision:c}=n;return"before "+s.getValue()+` after ${c}`}}),new r(i,a)}class me extends b{constructor(e){super({store:m,id:e.id});let t=this;t.table_builders=e.table_builders||[],t.tables=[]}get scenario_name(){return p(this.store,"state.scenario_name")}async buildResultsSummary({id:e,data:t,prep_fnx:a,title:r,description:s,filename_csv:n}){let c=this;c.element.select(`#${e}`).remove();let _=c.element.append("div").attr("id",e).classed("grid grid-cols-1 grid-rows-auto pt-8",!0),u=_.append("div").classed(" flex flex-row w-full justify-between items-center",!0);u.append("div").classed("font-bold",!0).html(r);const[o,l]=a(t);if(!o.length){_.append("div").classed("flex justify-center",!0).html("no results to show for this summary yet...");return}let d=u.append("div").classed("py-2",!0).append("button").text("Download Data (csv)").classed("btn btn-blue",!0);s!=null&&_.append("div").html(s);const f=e+"-results-tabulator";_.append("div").attr("id",f);let h=await K(`#${f}`,{data:o,columns:l.map(g=>{let k={title:g.replaceAll("_"," "),field:g,titleDownload:g};return["_acres","_coeff","_load","_pct","_conc","_lbs","_cuft","_cfs","_mpn","_inhr"].some($=>g.includes($))&&(k.formatter="money",k.formatterParams={precision:2}),g.includes("_pct")&&(k.formatterParams={precision:2,symbol:"%",symbolAfter:"p"}),g.includes("_mpn")&&(k.formatterParams={precision:0}),k})});c.tables.push(h);let S=c.scenario_name.replaceAll(" ","-");d.on("click",()=>h.download("csv",S+"-"+n))}async update(e){let t=this;e=e||[],t.element.html(""),(e==null?void 0:e.length)>0&&t.element.append("div").append("button").classed("btn btn-blue",!0).text("Download All Data Summaries (xlsx)").on("click",async()=>{let r={};t.element.selectAll("[id$='-results-tabulator']").nodes().forEach(n=>{let c=y.select(n).attr("id"),_=c.replace("-results-tabulator","").replace("table-","").replace("facility-","bmp-").slice(0,30);c.includes("table-all-data")||(r[_]="#"+c)}),t.element.select("#dummy_table").remove(),t.element.append("div").attr("id","dummy_table").classed("hidden",!0),(await K("#dummy_table")).download("xlsx","AllData.xlsx",{sheets:r})}),O();try{for(let a of t.table_builders)await t.buildResultsSummary(a(e))}finally{L()}}_template(){return` +
Click 'Run Scenario' in the Editor to calculate results.
+ `}_render(){let e=this;e.element=y.select(`#${e.id}`).classed("relative flex justify-center",!0).append("div").classed("flex flex-col relative max-w-screen-md py-10 ",!0).html(e._template()),e.store.events.subscribe("newResults",({results:t})=>e.update(t)),e.store.events.subscribe("changedTab",({current_tab:t})=>{if(t===e.id){let a=p(e,"store.state.results");e.update(a)}})}}const da=i=>({data:i,id:"table-facility-design-summary",title:"Facility design Summary",filename_csv:"facility_design_summary.csv",prep_fnx:t=>{const a=["node_id","facility_type","valid_model","design_intensity_inhr","design_volume_cuft_cumul"];return[(t||[]).filter(s=>s.node_type).filter(s=>s.node_type.includes("facility")).map(s=>Object.fromEntries(Object.entries(s).filter(([n,c])=>a.includes(n)))),a]}}),ca=i=>({data:i,id:"table-facility-wet-weather-capture",title:"Facility Wet Weather Volume Capture Results",filename_csv:"wet_weather_volume_capture_results.csv",prep_fnx:t=>{const a=["node_id","facility_type","valid_model","captured_pct","treated_pct","retained_pct","bypassed_pct","peak_flow_mitigated_pct"];return[(t||[]).filter(s=>s.node_type).filter(s=>s.node_type.includes("facility")).map(s=>Object.fromEntries(Object.entries(s).filter(([n,c])=>a.includes(n)))),a]}});function _a(i){return{data:i,id:"table-facility-volume-reduction",title:"Facility Volume Reduction Results",filename_csv:"volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(h=>l.endsWith(`dry_weather_flow_cuft_${h}`)),f=r.some(h=>l.endsWith(`runoff_volume_cuft_${h}`));return d||f}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).sort((f,h)=>f.includes("winter")||f.includes("summer")?1:-1);o.push(...d)}return[_,o]}}}function pa(i){return{data:i,id:"table-facility-wet-weather-volume-reduction",title:"Facility Wet Weather Volume Reduction Results",filename_csv:"wet_weather_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>(r.some(f=>l.endsWith(`dry_weather_flow_cuft_${f}`)),r.some(f=>l.endsWith(`runoff_volume_cuft_${f}`)))),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l));o.push(...d)}return[_,o]}}}function ua(i){return{data:i,id:"table-facility-dry-weather-volume-reduction",title:"Facility Dry Weather Volume Reduction Results",description:"(calculated as total of summer + winter)",filename_csv:"dry_weather_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(f=>l.endsWith(`dry_weather_flow_cuft_${f}`));return r.some(f=>l.endsWith(`runoff_volume_cuft_${f}`)),d}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));for(let l of _)for(let d of r){let f=l[`summer_dry_weather_flow_cuft_${d}`],h=l[`winter_dry_weather_flow_cuft_${d}`];l[`total_dry_weather_volume_cuft_${d}`]=f+h}const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).sort((f,h)=>f.includes("total")||f.includes("winter")||f.includes("summer")?1:-1);o.push(...d)}return[_,o]}}}function ma(i){return{data:i,id:"table-facility-total-volume-reduction",title:"Facility Total Volume Reduction Results",description:"(calculated as total of results for wet + summer + winter)",filename_csv:"total_volume_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const r=["inflow","treated","retained","captured","bypassed"],n=[...new Set(w(t.map(l=>Object.keys(l))))].filter(l=>{let d=r.some(h=>l.endsWith(`dry_weather_flow_cuft_${h}`)),f=r.some(h=>l.endsWith(`runoff_volume_cuft_${h}`));return d||f}),c=function(l){return a.includes(l)||n.includes(l)};let _=(t||[]).filter(l=>l.node_type).filter(l=>l.node_type.includes("facility")).map(l=>Object.fromEntries(Object.entries(l).filter(([d,f])=>c(d))));for(let l of _)for(let d of r){let f=l[`runoff_volume_cuft_${d}`],h=l[`summer_dry_weather_flow_cuft_${d}`],S=l[`winter_dry_weather_flow_cuft_${d}`];l[`total_volume_cuft_${d}`]=f+h+S}const u=[...new Set(w(_.map(l=>Object.keys(l))))],o=a;for(let l of r){let d=u.filter(f=>f.includes(l)).filter(f=>f.includes("total"));o.push(...d)}return[_,o]}}}function fa(i){return{data:i,id:"table-facility-load-reduction",title:"Facility Load Reduction Results",description:`These results are separated in to wet weather results, + summer dry weather results, and winter dry weather results.`,filename_csv:"load_reduction_results.csv",prep_fnx:t=>{const a=["node_id"],r=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed");return a.includes(o)||l},n=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d});let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>r(l))));const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of n.sort()){let l=_.filter(d=>d.includes(o)).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}function ya(i){return{data:i,id:"table-facility-total-load-reduction",title:"Facility Total Load Reduction Results",description:"(calculated as total of results for wet + summer + dry)",filename_csv:"total_load_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const s=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d}),n=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed");return a.includes(o)||l};let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>n(l))));for(let o of c)for(let l of s){let d=o[l],f=o[`summer_dw${l}`],h=o[`winter_dw${l}`];o[`total_${l}`]=d+f+h}const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of s.sort()){let l=_.filter(d=>d.includes(o)).filter(d=>d.includes("total")).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}function ha(i){return{data:i,id:"table-facility-wet-weather-load-reduction",title:"Facility Wet Weather Load Reduction Results",filename_csv:"wet_weather_load_reduction_results.csv",prep_fnx:t=>{const a=function(n){let c=["node_id"].includes(n),_=n.endsWith("lbs_removed")||n.endsWith("mpn_removed"),u=n.includes("dw");return c||_&&!u};let r=(t||[]).filter(n=>n.node_type).filter(n=>n.node_type.includes("facility")).map(n=>Object.fromEntries(Object.entries(n).filter(([c,_])=>a(c))));const s=[...new Set(w(r.map(n=>Object.keys(n))))];return[r,s]}}}function ga(i){return{data:i,id:"table-facility-dry-weather-load-reduction",title:"Facility Dry Weather Load Reduction Results",description:`Includes summer dry weather, winter dry weather, and total dry + weather results (calculated as summer + winter)`,filename_csv:"dry_weather_load_reduction_results.csv",prep_fnx:t=>{let a=["node_id"];const s=[...new Set(w(t.map(o=>Object.keys(o))))].filter(o=>{let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=!o.includes("dw");return l&&d}),n=function(o){let l=o.endsWith("lbs_removed")||o.endsWith("mpn_removed"),d=o.includes("dw");return a.includes(o)||l&&d};let c=(t||[]).filter(o=>o.node_type).filter(o=>o.node_type.includes("facility")).map(o=>Object.fromEntries(Object.entries(o).filter(([l,d])=>n(l))));for(let o of c)for(let l of s){let d=o[`summer_dw${l}`],f=o[`winter_dw${l}`];o[`total_dw${l}`]=d+f}const _=[...new Set(w(c.map(o=>Object.keys(o))))],u=a;for(let o of s.sort()){let l=_.filter(d=>d.includes(o)).sort((d,f)=>d.includes("total")||d.includes("winter")||d.includes("summer")?1:-1);u.push(...l)}return[c,u]}}}const ba=i=>({data:i,id:"table-land-surface-summary",title:"Land Surface Summary",filename_csv:"land_surface_summary.csv",prep_fnx:t=>{let a=["node_id","area_acres","ro_coeff","imp_pct"];return[(t||[]).filter(s=>(s==null?void 0:s.land_surfaces_count)>0).map(s=>Object.fromEntries(Object.entries(s))),a]}}),va=i=>({data:i,id:"table-land-surface-load-summary",title:"Land Surface Loading Summary",filename_csv:"land_surface_load_summary.csv",prep_fnx:t=>{let a=["node_id"];const r=function(c){let _=c.endsWith("_load_lbs")||c.endsWith("_load_mpn");return a.includes(c)||_};let s=(t||[]).filter(c=>(c==null?void 0:c.land_surfaces_count)>0).map(c=>Object.fromEntries(Object.entries(c).filter(([_,u])=>r(_))));const n=[...new Set(w(s.map(c=>Object.keys(c))))];return console.debug("landsurface load summary:",s),[s,n]}}),wa=[da,ca,_a,ma,pa,ua,fa,ya,ha,ga],ka=[ba,va],Sa=new me({id:"treatment-facility-results-tab",table_builders:wa}),xa=new me({id:"land-surface-results-tab",table_builders:ka});class Ta extends b{constructor(e){super({store:m,id:e.id})}_template(){return` +
+
+
+ how to coming soon... +
+
+
+ `}async fetch_page(){let e=this,t=`${m.state.nereid_host}/static/pages/how_to`;O(),fetch(t,{method:"GET"}).then(a=>{if(a.status_code===200)return a.text().then(function(r){e.element.select(".markdown_content").html(r)})}).finally(L)}_render(){let e=this;e.element=y.select(`#${e.id}`).classed("relative flex flex-col justify-center",!0).html(e._template()),e.fetch_page()}}const $a=new Ta({id:"how-to-tab"}),Q=new tt({children:[la,Sa,xa,$a]});async function ja(){await de(),Ye.render(),Q.render(),Ze.render(),window.nereid={tabs:Q,editor:I,util:Ge,nereidUtil:He,state:I.store.state},I.store.dispatch("updateConfig",{})}ja(); +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = [] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} diff --git a/nereid/nereid/static/frontend/dist/index.html b/nereid/nereid/static/frontend/dist/index.html index 7cfb6646..e8d2941c 100644 --- a/nereid/nereid/static/frontend/dist/index.html +++ b/nereid/nereid/static/frontend/dist/index.html @@ -4,6 +4,7 @@ + Nereid UI - + diff --git a/nereid/nereid/static/frontend/src/index.html b/nereid/nereid/static/frontend/src/index.html index 18e8c35f..c6eca8ac 100644 --- a/nereid/nereid/static/frontend/src/index.html +++ b/nereid/nereid/static/frontend/src/index.html @@ -4,6 +4,7 @@ + { - console.log("enter add point"); + console.debug("enter add point"); let self = this; if (!get(self, "store.state.add_node_mode")) { @@ -157,7 +157,7 @@ export default class Points extends Component { ) return; // event.preventDefault(); - console.log("adding Point"); + console.debug("adding Point"); let id = data.length > 0 ? data[data.length - 1].id + 1 : 0; let point = [self.width() / 2 + id * 40, self.height() / 2 + id * 40]; @@ -236,7 +236,7 @@ export default class Points extends Component { let self = this; let scale = get(self, "store.state.initialScale"); let center = get(self, "store.state.initialCenter"); - console.log("reset"); + console.debug("reset"); let zoom_transform = get(self, "store.state.zoomTransform"); self.svg @@ -255,7 +255,7 @@ export default class Points extends Component { } zoom_to_group() { - console.log("z to g"); + console.debug("z to g"); let self = this; const bb = self.circle_group.node().getBBox(); const [[x0, y0], [x1, y1]] = [ diff --git a/nereid/nereid/static/frontend/src/js/components/tabs/editor-tab/editor-menu/drawers/drawer-content-node-treatment-facility.js b/nereid/nereid/static/frontend/src/js/components/tabs/editor-tab/editor-menu/drawers/drawer-content-node-treatment-facility.js index 64aba1e7..7ceb5a8f 100644 --- a/nereid/nereid/static/frontend/src/js/components/tabs/editor-tab/editor-menu/drawers/drawer-content-node-treatment-facility.js +++ b/nereid/nereid/static/frontend/src/js/components/tabs/editor-tab/editor-menu/drawers/drawer-content-node-treatment-facility.js @@ -116,7 +116,7 @@ export class TreatmentFacilityNodeEditorUI extends Component { ) || util.get(self, "store.state.treatment_facility_fields.state.region"); - console.log("tmnt facility fields:", treatment_facility_fields); + console.debug("tmnt facility fields:", treatment_facility_fields); build_form( "#facility-form", diff --git a/nereid/nereid/static/frontend/src/js/components/tabs/howto-tab.js b/nereid/nereid/static/frontend/src/js/components/tabs/howto-tab.js index 164e2124..e21fe68c 100644 --- a/nereid/nereid/static/frontend/src/js/components/tabs/howto-tab.js +++ b/nereid/nereid/static/frontend/src/js/components/tabs/howto-tab.js @@ -21,7 +21,6 @@ export class HowTab extends Component { async fetch_page() { let self = this; let url = `${store.state.nereid_host}` + "/static/pages/how_to"; - console.log(url); util.incr_waiting(); fetch(url, { method: "GET" }) .then((resp) => { diff --git a/nereid/nereid/static/frontend/src/js/components/tabs/results-tab/result_summary/land_surface_summary.js b/nereid/nereid/static/frontend/src/js/components/tabs/results-tab/result_summary/land_surface_summary.js index 8c8d39a4..a76f5337 100644 --- a/nereid/nereid/static/frontend/src/js/components/tabs/results-tab/result_summary/land_surface_summary.js +++ b/nereid/nereid/static/frontend/src/js/components/tabs/results-tab/result_summary/land_surface_summary.js @@ -43,7 +43,7 @@ export const table_land_surface_load_summary = (data) => { ...new Set(util.flatten(summary.map((d) => Object.keys(d)))), ]; - console.log("landsurface load summary:", summary); + console.debug("landsurface load summary:", summary); return [summary, summary_keys]; }, diff --git a/nereid/nereid/static/frontend/src/js/lib/nereid-api.js b/nereid/nereid/static/frontend/src/js/lib/nereid-api.js index 8fed99e5..ccbe97a8 100644 --- a/nereid/nereid/static/frontend/src/js/lib/nereid-api.js +++ b/nereid/nereid/static/frontend/src/js/lib/nereid-api.js @@ -101,6 +101,16 @@ const nereid = { } }, + getTaskData: async (host, api, task_id) => { + let rsp; + try { + rsp = await util.getJsonResponse(`${host}${api}/task/${task_id}`); + return rsp; + } catch (err) { + console.error(err); // TypeError: failed to fetch + } + }, + postValidateNetwork: async (host, api, state, region, data) => { let route = `${host}${api}/network/validate?state=${state}®ion=${region}`; let rsp; @@ -185,6 +195,18 @@ const nereid = { rsp = await util.postJsonResponse(route, data); if (rsp?.data?.errors?.length == 0) { return rsp; + } else if ( + (rsp?.data == null) & + ["pending", "started"].includes(rsp?.status?.toLowerCase()) & + (rsp?.task_id != null) + ) { + rsp = await util.poll({ + fn: () => nereid.getTaskData(host, api, rsp.task_id), + validate: (_result) => _result?.data != null, + interval_milli: 333, + maxAttempts: 20, + }); + return rsp; } } catch (e) { console.error(e); @@ -292,7 +314,6 @@ export const getConfig = async ({ nereid_state, nereid_region, }) => { - // console.log(nereid_host, nereid_state, nereid_region); if (!nereid_host) { nereid_host = window.location.origin; //await nereid.getHost(); } diff --git a/nereid/nereid/static/frontend/src/js/lib/util.js b/nereid/nereid/static/frontend/src/js/lib/util.js index cc5682fb..6737b187 100644 --- a/nereid/nereid/static/frontend/src/js/lib/util.js +++ b/nereid/nereid/static/frontend/src/js/lib/util.js @@ -74,7 +74,7 @@ export const decr_waiting = () => { // fetch API wrappers for json retrieval export async function getJsonResponse(url) { - console.log("fetching with get", url); + console.debug("fetching with get", url); incr_waiting(); const response = await fetch(url, { method: "GET" }) // .catch((error) => { @@ -82,7 +82,7 @@ export async function getJsonResponse(url) { // return {}; // }) .then((resp) => { - console.log("getJsonResponse response:", resp); + console.debug("getJsonResponse response:", resp); if (resp.status == 200) { return resp.json(); } else if (resp.status == 422) { @@ -95,7 +95,7 @@ export async function getJsonResponse(url) { } }) .then((data) => { - console.log("getJsonResponse data returned:", data); + console.debug("getJsonResponse data returned:", data); return data; }) .finally(decr_waiting); @@ -104,7 +104,7 @@ export async function getJsonResponse(url) { } export async function postJsonResponse(url, data) { - console.log("fetching with post", url, data); + console.debug("fetching with post", url, data); incr_waiting(); const response = await fetch(url, { @@ -115,7 +115,7 @@ export async function postJsonResponse(url, data) { body: JSON.stringify(data), }) .then((resp) => { - console.log("postJsonResponse response:", resp); + console.debug("postJsonResponse response:", resp); if (resp.status == 200) { return resp.json(); } else if (resp.status == 422) { @@ -126,28 +126,29 @@ export async function postJsonResponse(url, data) { } }) .then((data) => { - console.log("postJsonResponse data returned:", data); + console.debug("postJsonResponse data returned:", data); return data; }) .finally(decr_waiting); return response; } -export const poll = ({ fn, validate, interval, maxAttempts }) => { - console.log("Start poll..."); +export const poll = ({ fn, validate, interval_milli, maxAttempts }) => { + console.debug("Start poll..."); let attempts = 0; const executePoll = async (resolve, reject) => { - console.log("- poll"); + console.debug("- poll"); const result = await fn(); attempts++; + console.debug(attempts, result); if (validate(result)) { return resolve(result); } else if (maxAttempts && attempts === maxAttempts) { return reject(new Error("Exceeded max attempts")); } else { - setTimeout(executePoll, interval, resolve, reject); + setTimeout(executePoll, interval_milli, resolve, reject); } }; @@ -203,7 +204,7 @@ export const getConfigFromUrlQueryParams = async () => { nereid_region: region || store.state.nereid_region, }); store.dispatch("updateConfig", cfg); - console.log(cfg); + console.debug(cfg); return false; };