@phila/layerboard 3.0.0-beta.10 → 3.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),G=require("@phila/phila-ui-map-core"),R=require("@phila/phila-ui-core");var pe=typeof document<"u"?document.currentScript:null;function Pe(t,l,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=l||{},n.geometry=t,n}function at(t,l,o={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<r[r.length-1].length;i++)if(r[r.length-1][i]!==r[0][i])throw new Error("First and last Position are not equivalent.")}return Pe({type:"Polygon",coordinates:t},l,o)}function rt(t,l,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Pe({type:"LineString",coordinates:t},l,o)}function it(t,l,o={}){return Pe({type:"MultiLineString",coordinates:t},l,o)}function st(t,l,o={}){return Pe({type:"MultiPolygon",coordinates:t},l,o)}function ct(t){return t.type==="Feature"?t.geometry:t}function ut(t,l,o){var n=t.length,r=me(t[0],l),i=[],d,v,m;let S,h;for(o||(o=[]),d=1;d<n;d++){for(S=t[d-1],h=t[d],v=m=me(h,l);;)if(r|v){if(r&v)break;r?(S=je(S,h,r,l),r=me(S,l)):(h=je(S,h,v,l),v=me(h,l))}else{i.push(S),v!==m?(i.push(h),d<n-1&&(o.push(i),i=[])):d===n-1&&i.push(h);break}r=m}return i.length&&o.push(i),o}function dt(t,l){var o,n,r,i,d,v,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(me(r,l)&n),d=0;d<t.length;d++)v=t[d],m=!(me(v,l)&n),m!==i&&o.push(je(r,v,n,l)),m&&o.push(v),r=v,i=m;if(t=o,!t.length)break}return o}function je(t,l,o,n){return o&8?[t[0]+(l[0]-t[0])*(n[3]-t[1])/(l[1]-t[1]),n[3]]:o&4?[t[0]+(l[0]-t[0])*(n[1]-t[1])/(l[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(l[1]-t[1])*(n[2]-t[0])/(l[0]-t[0])]:o&1?[n[0],t[1]+(l[1]-t[1])*(n[0]-t[0])/(l[0]-t[0])]:null}function me(t,l){var o=0;return t[0]<l[0]?o|=1:t[0]>l[2]&&(o|=2),t[1]<l[1]?o|=4:t[1]>l[3]&&(o|=8),o}function ft(t,l){const o=ct(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const d=[];return n==="LineString"&&(i=[i]),i.forEach(v=>{ut(v,l,d)}),d.length===1?rt(d[0],r):it(d,r)}case"Polygon":return at(He(i,l),r);case"MultiPolygon":return st(i.map(d=>He(d,l)),r);default:throw new Error("geometry "+n+" not supported")}}function He(t,l){const o=[];for(const n of t){const r=dt(n,l);r.length>0&&((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]),r.length>=4&&o.push(r))}return o}var pt=ft;const mt={class:"map-panel"},yt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{},visibleTiledLayers:{},tiledLayerOpacities:{},cyclomediaConfig:{},pictometryCredentials:{},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{},initialCenter:{}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:l}){const o=t,n=l,r=e.ref(null),i=e.ref(null),d=e.ref(0);function v(a){n("zoom",a),i.value&&(d.value=m(i.value))}function m(a){const p=a.getZoom(),B=a.getCenter().lat,E=559082264028e-3,N=B*Math.PI/180;return E*Math.cos(N)/Math.pow(2,p)}const S=e.ref({}),h=e.ref(null),L=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(a,p,c,B){const E=encodeURIComponent(B||"1=1"),N=JSON.stringify({xmin:p.west,ymin:p.south,xmax:p.east,ymax:p.north,spatialReference:{wkid:4326}}),$=2e3;let T=0,F=[],Z=!0;for(;Z;){const O=`${a}/query?where=${E}&geometry=${encodeURIComponent(N)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${T}&f=geojson`,z=await fetch(O);if(!z.ok)throw new Error(`HTTP ${z.status}: ${z.statusText}`);const D=await z.json();D.features&&D.features.length>0?(F=F.concat(D.features),T+=D.features.length,Z=D.features.length===$):Z=!1}if(s.includes(c)){const O=[p.west,p.south,p.east,p.north];F=F.map(z=>{if(z.geometry&&(z.geometry.type==="Polygon"||z.geometry.type==="MultiPolygon"))try{return pt(z,O)}catch{return z}return z})}return{type:"FeatureCollection",features:F}}async function b(a,p){const c=p.map(async B=>{const E=o.layerList.find(N=>N.config.id===B)?.config;if(E){n("layerLoading",B,!0);try{const N=await g(E.url,a,B,E.where);S.value={...S.value,[B]:N},n("layerError",B,null)}catch(N){const $=N instanceof Error?N.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(a){const p=[...o.visibleLayers];await b(a,p)}function f(a){h.value=a.bounds,y(a.bounds)}function u(a){i.value=a;const p=a.getBounds();h.value={west:p.getWest(),south:p.getSouth(),east:p.getEast(),north:p.getNorth()};const c=a.getZoom();n("zoom",c),d.value=m(a),y(h.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(U.value.length>0&&ie(),h.value){const a=new Set(o.visibleLayers),p=[...a].filter(c=>!L.value.has(c));L.value=new Set(a),p.length>0&&await b(h.value,p)}});function k(a){return o.visibleLayers.has(a)}function V(a){return!!S.value[a.id]}const x=e.computed(()=>o.layerList.filter(a=>a.config.type==="circle"&&k(a.config.id)&&V(a.config)).map(a=>a.config)),_=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&k(a.config.id)&&V(a.config)).map(a=>a.config)),I=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&a.config.outlinePaint&&k(a.config.id)&&V(a.config)).map(a=>a.config)),X=e.computed(()=>o.layerList.filter(a=>a.config.type==="line"&&k(a.config.id)&&V(a.config)).map(a=>a.config));function se(a){return o.visibleTiledLayers?.has(a)??!1}function ce(a){return o.tiledLayerOpacities?.[a]??1}function Te(a){return`${a.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Me(a){return{type:"raster",tiles:[Te(a.url)],tileSize:256,attribution:a.attribution||""}}const he=e.ref({}),we=e.ref(new Set);async function ve(a){if(!we.value.has(a.id)){we.value.add(a.id);try{const p=a.url.replace(/\/$/,""),c=await fetch(`${p}?f=json`);if(!c.ok)return;const B=await c.json();let E=B.minScale||0,N=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(N===0||$.maxScale<N)&&(N=$.maxScale);N===0&&(N=72e3),he.value={...he.value,[a.id]:{minScale:E,maxScale:N}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const a of o.tiledLayers)a.scaleBasedRendering&&ve(a)});function Ce(a){if(!a.scaleBasedRendering)return"tiled";const p=he.value[a.id];if(!p)return"tiled";const c=d.value;return c===0||c>p.maxScale?"tiled":"dynamic"}const Fe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>se(a.id)?a.scaleBasedRendering?Ce(a)==="tiled":!0:!1):[]),Ie=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>se(a.id)&&a.scaleBasedRendering?Ce(a)==="dynamic":!1):[]);function ue(a){return{type:"raster",tiles:[`${a.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:a.attribution||""}}function oe(a){return{type:"geojson",data:S.value[a.id]}}function de(a){return o.layerOpacities[a]??1}function ne(a){const p=de(a.id),c=a.type==="circle"?"circle-opacity":a.type==="fill"?"fill-opacity":"line-opacity";if(a.type==="fill"&&a.paint["fill-opacity"]===0)return{...a.paint,"fill-opacity":0};const B=a.type==="circle"?"circle-color":a.type==="fill"?"fill-color":"line-color",E={...a.paint},N=E[B],$=E[c]===1,T=typeof N=="string"&&N.startsWith("rgba(");if($&&T){if(p===1)return E;{const F=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F&&F[4]){const[,Z,O,z,D]=F,Ue=parseFloat(D)*p;E[B]=`rgba(${Z}, ${O}, ${z}, ${Ue})`,E[c]=1}return E}}if(T){const F=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F){const[,Z,O,z]=F;E[B]=`rgb(${Z}, ${O}, ${z})`}}return E[c]=p,E}function Oe(a){const p=de(a.id);return{...a.outlinePaint,"line-opacity":p}}const U=e.ref([]),le=e.ref(null),W=e.ref(0);function re(a){const p=a.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===p)?.config}function De(a,p){return a.replace(/\{([^}]+)\}/g,(c,B)=>{const E=p[B];return E==null?"":String(E)})}function Se(a,p){if(a==null)return"-";if(p?.dateFormat&&typeof a=="number"){const c=new Date(a);switch(p.dateFormat){case"shortDateShortTime":return c.toLocaleString();case"longMonthDayYear":return c.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return c.toLocaleDateString();case"longDate":return c.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return c.toLocaleDateString()}}if(typeof a=="number"){if(a>1e12&&!p)return new Date(a).toLocaleDateString();const c=p?.places,B=p?.digitSeparator??!0;if(c!==void 0){const E=a.toFixed(c);if(B){const N=E.split("."),$=N[0]||"0",T=N[1],F=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return T?`${F}.${T}`:F}return E}return B?a.toLocaleString():String(a)}return String(a)}function be(a){const p=new Set;return a.filter(c=>{const E=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return p.has(E)?!1:(p.add(E),!0)})}function Ee(a,p){const c=new Map;return p.forEach((B,E)=>{c.set(B.id,E)}),a.sort((B,E)=>{const N=B.layer.id.replace(/-outline$/,""),$=E.layer.id.replace(/-outline$/,""),T=c.get(N)??-1;return(c.get($)??-1)-T})}function H(a){const p=i.value;if(!p)return;const c=[];o.layerList.forEach(O=>{const z=O.config;o.visibleLayers.has(z.id)&&(c.push(z.id),z.outlinePaint&&c.push(`${z.id}-outline`))});const B=p.project([a.lngLat.lng,a.lngLat.lat]),E=p.queryRenderedFeatures(B,{layers:c});if(E.length===0)return;const N=be(E),$=o.layerList.map(O=>O.config),T=Ee(N,$),F=T.map(O=>{const z=O.layer.id.replace(/-outline$/,""),D=re(z);return D?{layerId:D.id,layerTitle:D.title,properties:O.properties||{},popupConfig:D.popup}:null}).filter(O=>O!==null);if(F.length===0)return;U.value=F,W.value=0,le.value=[a.lngLat.lng,a.lngLat.lat];const Z=T[0];if(Z&&Z.geometry){const O=Z.layer.id.replace(/-outline$/,""),z=re(O);if(z){const D=ke(Z.geometry),Ue=w(z.id,z.type);Q.value={geometry:Z.geometry,geometryType:D,layerId:z.id,properties:Z.properties||{},originalStyle:Ue}}}}function ie(){U.value=[],le.value=null,W.value=0,Q.value=null}function J(a){if(U.value.length===0)return;const p=a.target;if(!(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable))switch(a.key){case"ArrowLeft":case"ArrowUp":a.preventDefault(),fe();break;case"ArrowRight":case"ArrowDown":a.preventDefault(),Be();break;case"Escape":a.preventDefault(),ie();break}}e.onMounted(()=>{window.addEventListener("keydown",J)}),e.onUnmounted(()=>{window.removeEventListener("keydown",J)});function Be(){const a=U.value.length;a<=1||(W.value=(W.value+1)%a)}function fe(){const a=U.value.length;a<=1||(W.value=(W.value-1+a)%a)}const j=e.computed(()=>U.value.length===0?null:U.value[W.value]),Re=e.computed(()=>{const a=j.value;return!a||!a.popupConfig?a?.layerTitle||"":De(a.popupConfig.title,a.properties)}),Y=e.computed(()=>{const a=j.value;if(!a)return"";let p='<div class="popup-content">';if(p+=`<h3 class="popup-title">${Re.value}</h3>`,a.popupConfig?.fields?.length){p+='<table class="popup-table">';for(const c of a.popupConfig.fields){const B=Se(a.properties[c.field],c.format);p+=`<tr><th>${c.label}</th><td>${B}</td></tr>`}p+="</table>"}else p+='<p class="popup-no-fields">No additional information available.</p>';return p+="</div>",p}),ae=e.ref({type:"FeatureCollection",features:[]}),ee=e.ref({type:"FeatureCollection",features:[]}),K={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Ze={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},Q=e.ref(null);function ke(a){return a.type}function w(a,p){const c=re(a);if(!c)return{radius:5,width:2};const B=c.paint||{};if(p==="circle"){const E=B["circle-radius"];return typeof E=="number"?{radius:E}:{radius:5}}if(p==="line"||p==="fill"){const E=B["line-width"];if(typeof E=="number")return{width:E};if(c.outlinePaint&&c.outlinePaint["line-width"]){const N=c.outlinePaint["line-width"];if(typeof N=="number")return{width:N}}return{width:2}}return{radius:5,width:2}}function C(a){return!a||a.length===0?[]:a[0]??[]}function A(a){const{geometry:p,geometryType:c,originalStyle:B}=a;if(c==="Point"||c==="MultiPoint"){const N=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightRadius:N}}]}}if(c==="LineString"||c==="MultiLineString"){const N=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightWidth:N}}]}}if(c==="Polygon"){const E=p.coordinates,N=C(E),T=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:N},properties:{highlightWidth:T}}]}}if(c==="MultiPolygon"){const E=p.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:E.map(F=>({type:"Feature",geometry:{type:"LineString",coordinates:C(F)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function M(a){if(!a){q();return}const p=A(a);a.geometryType==="Point"||a.geometryType==="MultiPoint"?(ae.value=p,ee.value={type:"FeatureCollection",features:[]}):(ee.value=p,ae.value={type:"FeatureCollection",features:[]})}function q(){ae.value={type:"FeatureCollection",features:[]},ee.value={type:"FeatureCollection",features:[]}}e.watch(Q,a=>{M(a)}),e.watch(()=>o.visibleLayers,a=>{Q.value&&!a.has(Q.value.layerId)&&(Q.value=null,ie())},{deep:!0}),e.watch(W,()=>{const a=j.value;if(!a){Q.value=null;return}const p=i.value;if(!p||!le.value)return;const c=[];o.layerList.forEach($=>{const T=$.config;o.visibleLayers.has(T.id)&&(c.push(T.id),T.outlinePaint&&c.push(`${T.id}-outline`))});const B=p.project(le.value),N=p.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===a.layerId&&JSON.stringify($.properties)===JSON.stringify(a.properties));if(N&&N.geometry){const $=re(a.layerId);if($){const T=ke(N.geometry),F=w($.id,$.type);Q.value={geometry:N.geometry,geometryType:T,layerId:$.id,properties:N.properties||{},originalStyle:F}}}});const Ne=e.ref(null);function Ae(a){const[p,c]=a.geometry.coordinates;Ne.value=[p,c]}return(a,p)=>(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(G.Map),{ref_key:"mapRef",ref:r,zoom:o.initialZoom,center:o.initialCenter,"navigation-controls":{position:o.navigationControlPosition},"geolocation-control":{position:o.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:o.basemapControlPosition},"map-search-control":{position:o.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":o.cyclomediaConfig,"cyclomedia-button-position":o.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":o.pictometryCredentials,"pictometry-button-position":o.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:v,onClick:ie,onMoveend:f,onLoad:u,onSearchResult:Ae},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(G.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Fe.value,c=>(e.openBlock(),e.createBlock(e.unref(G.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Me(c),paint:{"raster-opacity":ce(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ie.value,c=>(e.openBlock(),e.createBlock(e.unref(G.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:ue(c),paint:{"raster-opacity":ce(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,c=>(e.openBlock(),e.createBlock(e.unref(G.CircleLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:H},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,c=>(e.openBlock(),e.createBlock(e.unref(G.FillLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:H},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,c=>(e.openBlock(),e.createBlock(e.unref(G.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:oe(c),paint:Oe(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:H},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,c=>(e.openBlock(),e.createBlock(e.unref(G.LineLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:H},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(G.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:ae.value},paint:K},null,8,["source"]),e.createVNode(e.unref(G.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:ee.value},paint:Ze},null,8,["source"]),e.createVNode(e.unref(G.MapMarker),{"lng-lat":Ne.value,color:"#2176d2"},null,8,["lng-lat"]),j.value&&le.value?(e.openBlock(),e.createBlock(e.unref(G.MapPopup),{key:1,"lng-lat":le.value,html:Y.value,"close-on-click":!1,"show-navigation":U.value.length>1,"current-feature-index":W.value,"total-features":U.value.length,"layer-name":j.value.layerTitle,onClose:ie,onNext:Be,onPrevious:fe},null,8,["lng-lat","html","show-navigation","current-feature-index","total-features","layer-name"])):e.createCommentVNode("",!0)]),_:1},8,["zoom","center","navigation-controls","geolocation-control","basemap-change-controls","map-search-control","cyclomedia-config","cyclomedia-button-position","pictometry-credentials","pictometry-button-position"])]))}}),ge=(t,l)=>{const o=t.__vccOpts||t;for(const[n,r]of l)o[n]=r;return o},Ye=ge(yt,[["__scopeId","data-v-98ba7f8b"]]),gt=["disabled"],ht=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const l=t,o=d=>"href"in d&&d.href!==void 0||"to"in d&&d.to!==void 0,n=e.computed(()=>R.cn("phila-button",`phila-button--${l.variant}`,l.size&&`is-${l.size}`,l.iconOnly&&"icon-button",l.iconOnly&&l.variant==="standard"&&"icon-button--standard",l.className)),r=e.computed(()=>o(l)?"to"in l&&l.to!==void 0?{to:l.to,disabled:l.disabled,className:n.value}:{href:l.href,target:l.target,rel:l.rel,disabled:l.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:l.iconDefinition,iconClass:l.iconClass,src:l.src,iconRight:l.iconRight,iconOnly:l.iconOnly,text:l.text,size:l.size}));return(d,v)=>o(l)?(e.openBlock(),e.createBlock(e.unref(R.BaseLink),e.mergeProps({key:0},{...r.value,...d.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(R.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:l.disabled,class:n.value},d.$attrs),[e.createVNode(e.unref(R.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)],16,gt))}});var vt={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]},bt=vt,kt={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Lt=kt;const wt=["for"],Ct={class:"state-layer"},St={class:"content"},Et={class:"input-text-container"},Bt=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},xt={key:2,class:"has-text-body-small phila-error-text"},Vt=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:l}){const o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),d=l,v=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:v.value,set:g=>{d("update:modelValue",g),v.value=g}}),S=e.computed(()=>{const g=["default-class"];return o.disabled!=null&&g.push("phila-input--disabled"),r.value&&g.push("phila-input--error"),o.required!=null&&g.push("phila-input--required"),R.cn(...g)}),h=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),R.cn(...g)}),L=e.ref(null),s=g=>{g.target.closest("button")||L.value?.focus()};return(g,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",S.value])},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:i.value,class:"has-text-label-small phila-label"},e.toDisplayString(n.label),9,wt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",h.value]),onClick:s},[e.createElementVNode("div",Ct,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(R.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",St,[e.createElementVNode("div",Et,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:L,"onUpdate:modelValue":b[0]||(b[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,Bt),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(ht),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(Lt),onClick:b[1]||(b[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(R.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Nt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",xt,[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref(bt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var $t={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},Pt={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z"]},zt={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M7.7 235.8c-10.3 12.6-9.5 31.1 2.2 42.8l128 128c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-256c0-12.9-7.8-24.6-19.8-29.6s-25.7-2.2-34.9 6.9l-128 128-2.2 2.4z"]},Je={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},_t={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]},Tt={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"]};const Mt={class:"layer-panel"},Ft={key:0,class:"search-box"},It={key:1,class:"topics-container"},Ot={class:"layer-row"},Dt=["href"],Rt={key:1,class:"metadata-placeholder"},Zt=["checked","disabled","onChange"],At={class:"layer-title"},Ut={key:0,class:"loading-indicator"},Wt=["aria-label"],jt={key:2,class:"zoom-indicator"},qt={key:0,class:"opacity-control"},Gt=["for"],Ht=["id","value","aria-label","onInput"],Jt={key:1,class:"layer-legend"},Kt={class:"legend-label"},Qt={key:0,class:"no-results"},Xt=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:l}){const o=t,n=l,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const f=o.searchQuery.toLowerCase();return o.layerList.filter(u=>u.config.title.toLowerCase().includes(f))});function i(f){let u=f.split("?")[0]||f;return u=u.replace(/\/query$/,""),u=u.replace(/\/$/,""),u.toLowerCase()}function d(f){const u=i(f);return o.layerMetadata[u]||null}const v=e.computed(()=>o.layerList.some(f=>d(f.config.url)));function m(f){return o.visibleLayers.has(f)}function S(f){return o.layerOpacities[f]??1}function h(f){return o.loadingLayers.has(f)}function L(f){return o.layerErrors[f]||null}function s(f){const u=o.currentZoom,k=f.minZoom,V=f.maxZoom;return!(k!==void 0&&u<k||V!==void 0&&u>V)}const g=e.computed({get:()=>o.searchQuery,set:f=>n("updateSearch",f)});function b(f){n("toggleLayer",f)}function y(f,u){const k=u.target,V=parseFloat(k.value);n("setOpacity",f,V)}return(f,u)=>(e.openBlock(),e.createElementBlock("aside",Mt,[t.showSearch?(e.openBlock(),e.createElementBlock("div",Ft,[e.createVNode(e.unref(Vt),{modelValue:g.value,"onUpdate:modelValue":u[0]||(u[0]=k=>g.value=k),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref($t),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",It,[e.renderSlot(f.$slots,"topics",{},()=>[u[2]||(u[2]=e.createElementVNode("div",{class:"no-topics"},' No topic components provided. Use the "topics" slot to add TopicAccordion components. ',-1))],!0)])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["layer-list",{"has-metadata":v.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.config.id,class:"layer-item"},[e.createElementVNode("div",Ot,[d(k.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:d(k.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link",title:"View metadata",onClick:u[1]||(u[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref(Tt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Dt)):v.value?(e.openBlock(),e.createElementBlock("span",Rt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(k.config),"layer-error":L(k.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(k.config.id),disabled:!s(k.config),onChange:V=>b(k.config.id)},null,40,Zt),e.createElementVNode("span",At,[e.createTextVNode(e.toDisplayString(k.config.title)+" ",1),h(k.config.id)?(e.openBlock(),e.createElementBlock("span",Ut," Loading... ")):e.createCommentVNode("",!0),L(k.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":L(k.config.id)||"Error"}," Error ",8,Wt)):e.createCommentVNode("",!0),s(k.config)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",jt," (zoom in) "))])],2)]),t.showOpacity&&m(k.config.id)?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+k.config.id}," Opacity: "+e.toDisplayString(Math.round(S(k.config.id)*100))+"% ",9,Gt),e.createElementVNode("input",{id:"opacity-"+k.config.id,type:"range",min:"0",max:"1",step:"0.05",value:S(k.config.id),"aria-label":"Opacity for "+k.config.title,class:"opacity-slider",onInput:V=>y(k.config.id,V)},null,40,Ht)])):e.createCommentVNode("",!0),t.showLegend&&m(k.config.id)&&k.config.legend?.length?(e.openBlock(),e.createElementBlock("ul",Jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.config.legend,(V,x)=>(e.openBlock(),e.createElementBlock("li",{key:x,class:"legend-item"},[V.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):V.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:V.color,height:`${V.width||2}px`}),"aria-hidden":"true"},null,4)):V.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Kt,e.toDisplayString(V.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Qt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),et=ge(Xt,[["__scopeId","data-v-d8c0326b"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const l=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${l.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${l}, ${o}, ${n}, ${i.toFixed(2)})`}function te(t){return t!==void 0?t:1}const Yt=559082264;function Ke(t){return!t||t<=0?null:Math.round(Math.log2(Yt/t)*100)/100}function eo(t,l){const o={};if(t&&t>0){const n=Ke(t);n!==null&&(o.minZoom=n)}if(l&&l>0){const n=Ke(l);n!==null&&(o.maxZoom=n)}return o}function ze(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function ye(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function We(t){return String(t)}function tt(t,l,o){const n=t.symbol,r=ze(n);let i={},d=[],v=null;if(r==="fill"&&n){const m=n.color===null?0:n.color?.[3]??255,S=m===0?"rgba(0, 0, 0, 0)":P(n.color),h=m===0?0:m<255?1:te(l);if(i={"fill-color":S,"fill-opacity":h},ye(n.outline)){const L=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(L>1||m===0)&&(v={"line-color":s,"line-width":L})}d=[{type:"fill",color:P(n.color),label:t.label||"Feature"}]}else if(r==="line"&&n)i={"line-color":P(n.color),"line-width":n.width||1,"line-opacity":te(l)},d=[{type:"line",color:P(n.color),width:n.width||1,label:t.label||"Feature"}];else if(r==="circle"&&n){const m=Math.round((n.size||6)*.71*100)/100;i={"circle-color":P(n.color),"circle-radius":m,"circle-opacity":te(l)},ye(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),d=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:d,geomType:r,outlinePaint:v}}function to(t,l,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return tt({...t,symbol:i},l);const d=r[0]?.symbol||i,v=ze(d);let m={},S=[],h=null;if(v==="fill"){const L=["match",["to-string",["get",n]]];for(const s of r){L.push(We(s.value)),L.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"fill",color:P(s.symbol?.color),label:y})}if(L.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":L,"fill-opacity":te(l)},ye(d?.outline)){const s=d.outline.width||1,g=P(d.outline.color);m["fill-outline-color"]=g,s>1&&(h={"line-color":g,"line-width":s})}}else if(v==="line"){const L=["match",["to-string",["get",n]]];for(const s of r){L.push(We(s.value)),L.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"line",color:P(s.symbol?.color),width:s.symbol?.width||1,label:y})}L.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":L,"line-width":d?.width||2,"line-opacity":te(l)}}else if(v==="circle"){const L=["match",["to-string",["get",n]]];for(const g of r){L.push(We(g.value)),L.push(P(g.symbol?.color));const b=String(g.value),f=o?.get(b)||g.label||b;S.push({type:"circle",color:P(g.symbol?.color),label:f})}L.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((d?.size||6)*.71*100)/100;m={"circle-color":L,"circle-radius":s,"circle-opacity":te(l)},ye(d?.outline)&&(m["circle-stroke-color"]=P(d.outline.color),m["circle-stroke-width"]=d.outline.width||1)}return{paint:m,legend:S,geomType:v,outlinePaint:h}}function oo(t,l){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(h=>h.type==="colorInfo");if(r?.stops&&r.stops.length>0)return no(r,o,t,l);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,d=ze(i);let v={},m=[],S=null;if(d==="fill"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));for(let L=0;L<n.length;L++){const s=n[L];L>0&&(h.push(n[L-1].classMaxValue),h.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(v={"fill-color":h,"fill-opacity":te(l)},ye(i?.outline)){const L=i.outline.width||1,s=P(i.outline.color);v["fill-outline-color"]=s,L>1&&(S={"line-color":s,"line-width":L})}}else if(d==="line"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));let L=t.minValue??0;for(let g=0;g<n.length;g++){const b=n[g];g>0&&(h.push(n[g-1].classMaxValue),h.push(P(b.symbol?.color))),m.push({type:"line",color:P(b.symbol?.color),width:b.symbol?.width||i?.width||2,label:b.label||`${L} - ${b.classMaxValue}`}),L=b.classMaxValue+1}const s=i?.width||2;v={"line-color":h,"line-width":s,"line-opacity":te(l)}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function no(t,l,o,n){const r=t.stops||[];if(r.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=o.classBreakInfos?.[0]?.symbol||o.defaultSymbol,d=ze(i);let v={},m=[],S=null;if(d==="fill"){const h=["interpolate",["linear"],["get",l]];for(const s of r)h.push(s.value),h.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(v={"fill-color":["case",["==",["get",l],null],"rgba(0, 0, 0, 0)",h],"fill-opacity":te(n)},ye(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);v["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function lo(t,l,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return tt(r,l);case"uniqueValue":return to(r,l,o);case"classBreaks":return oo(r,l);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ao(t){if(!t)return null;const l=t.title||"",n=(t.fieldInfos||[]).filter(r=>r.visible===!0).map(r=>{const i={field:r.fieldName,label:r.label||r.fieldName};return r.format&&(i.format={},r.format.dateFormat&&(i.format.dateFormat=r.format.dateFormat),r.format.digitSeparator!==void 0&&(i.format.digitSeparator=r.format.digitSeparator),r.format.places!==void 0&&(i.format.places=r.format.places),Object.keys(i.format).length===0&&delete i.format),i});return{title:l,fields:n}}function ro(t){return t?.definitionExpression}function io(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function so(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function co(t){const l=new Map;if(!t)return l;const o=t.split(`
2
- `),n=/^(\d{1,3})\s+(.+)$/;for(const r of o){const i=r.trim().match(n);if(i){const[,d,v]=i;d&&v&&l.set(d,v.trim())}}return l}async function uo(t){try{const l=await fetch(`${t}?f=json`);if(!l.ok)return null;const o=await l.json();return o.drawingInfo?{drawingInfo:o.drawingInfo,description:o.description}:null}catch{return null}}async function qe(t){const l=t.operationalLayers||[],o=[],n=["Zoning and Planning_Land Use"];for(const r of l)if(r.url&&r.itemId!=="4f39b829b96d437da9231727d9c91fab")try{let i=r.layerDefinition?.drawingInfo,d;const v=!i||!i.renderer,m=n.includes(r.title);if((v||m)&&r.url){const x=await uo(r.url);x&&(i=x.drawingInfo,x.description&&(d=co(x.description),d.size>0))}const{paint:S,legend:h,geomType:L,outlinePaint:s}=lo(i,r.opacity,d,r.title),g=ao(r.popupInfo),b=ro(r.layerDefinition),y=eo(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),f=io(r.title),u=so(r.title);let k=r.opacity??1;const V={id:f,title:u,type:L,url:r.url,opacity:k,paint:S,legend:h,popup:g};b&&(V.where=b),y.minZoom!==void 0&&(V.minZoom=y.minZoom),y.maxZoom!==void 0&&(V.maxZoom=y.maxZoom),s&&(V.outlinePaint=s),o.push(V)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Qe={},Ge="376af635c84643cd816a8c5d017a53aa",fo=Ge;function _e(t,l){let o=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return l&&(o+=`&token=${l}`),o}function po(){return _e(Ge)}const Ve=new Map,Le=new Map;function ot(t){t?(Ve.delete(t),Le.delete(t)):(Ve.clear(),Le.clear())}let xe,Xe=0;async function mo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:pe&&pe.tagName.toUpperCase()==="SCRIPT"&&pe.src||new URL("index.js",document.baseURI).href}<"u"&&Qe?.VITE_AGO_USERNAME,l=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:pe&&pe.tagName.toUpperCase()==="SCRIPT"&&pe.src||new URL("index.js",document.baseURI).href}<"u"&&Qe?.VITE_AGO_PASSWORD;if(!(!t||!l)){if(xe&&Date.now()<Xe-3e5)return xe;try{const n=await(await fetch("https://www.arcgis.com/sharing/rest/generateToken",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({f:"json",username:t,password:l,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return n.error?void 0:(xe=n.token,Xe=n.expires,xe)}catch{return}}}async function yo(t,l){const o=_e(t,l),n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const r=await n.json();if(r.error)throw new Error(`ArcGIS error: ${r.error.message||r.error.code||"Unknown error"}`);return r}async function go(t){try{const l=await mo(),o=await yo(t,l);return await qe(o)}catch(l){throw new Error(`Failed to load dynamic layer configs: ${l instanceof Error?l.message:"Unknown error"}`)}}async function $e(t=Ge){const l=Ve.get(t);if(l)return l;const o=Le.get(t);if(o)return o;const n=(async()=>{try{const r=await go(t);return Ve.set(t,r),r}finally{Le.delete(t)}})();return Le.set(t,n),n}function nt(t){const l=e.ref({}),o=new Map;for(const s of t)l.value[s.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(s){const g=s.id;l.value={...l.value,[g]:{data:l.value[g]?.data??null,lastFetched:l.value[g]?.lastFetched??null,loading:!0,error:null}};try{let b;if(s.type==="http-get"){const y=await fetch(s.url,{method:"GET",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="http-post"){const y=await fetch(s.url,{method:"POST",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="esri"){const f=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,u=await fetch(f,s.options);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);b=(await u.json()).features?.map(V=>V.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(b=s.transform(b)),l.value={...l.value,[g]:{data:b,loading:!1,error:null,lastFetched:Date.now()}}}catch(b){const y=b instanceof Error?b.message:"Unknown error";l.value={...l.value,[g]:{data:l.value[g]?.data??null,lastFetched:l.value[g]?.lastFetched??null,loading:!1,error:y}}}}async function r(){await Promise.all(t.map(s=>n(s)))}async function i(s){const g=t.find(b=>b.id===s);g&&await n(g)}function d(s){return l.value[s]?.data??null}const v=e.computed(()=>Object.values(l.value).some(s=>s.loading));function m(s){return l.value[s]?.loading??!1}function S(s){return l.value[s]?.error??null}function h(){for(const s of t)if(s.pollInterval&&s.pollInterval>0){const g=window.setInterval(()=>{n(s)},s.pollInterval);o.set(s.id,g)}}function L(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),h()}),e.onUnmounted(()=>{L()}),{state:e.readonly(l),isLoading:v,fetchAll:r,refetch:i,getData:d,isSourceLoading:m,getError:S,stopPolling:L}}const ho={class:"layerboard-layout"},vo=["aria-expanded"],bo={key:0,class:"layerboard-subtitle"},ko={class:"layerboard-mobile-menu-content"},Lo={class:"layerboard-main"},wo={key:0,class:"layerboard-loading"},Co={key:1,class:"layerboard-error"},So={key:0},Eo={key:1},Bo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{},pictometryCredentials:{},showDefaultSidebar:{type:Boolean,default:!0},sidebarWidth:{default:"30%"},sidebarLabel:{default:"Layers"},mapLabel:{default:"Map"},fetchMetadata:{type:Boolean,default:!1},tiledLayers:{default:()=>[]},dataSources:{default:()=>[]},layerStyleOverrides:{default:()=>({})},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{},initialCenter:{}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:l,emit:o}){const n=t,r=o,i=e.ref([]),d=e.ref(!0),v=e.ref(null),m=e.ref(12),S=e.ref(""),h=e.ref(new Set),L=e.ref({}),s=e.ref(new Set),g=e.ref({}),b=e.ref({}),y=e.ref(new Set),f=e.ref({});function u(){const w={};for(const C of n.tiledLayers)w[C.id]=C.opacity??1;f.value=w}function k(w){y.value.has(w)?y.value.delete(w):y.value.add(w),y.value=new Set(y.value)}function V(w,C){C?y.value.add(w):y.value.delete(w),y.value=new Set(y.value)}function x(w,C){f.value={...f.value,[w]:C}}const _=n.dataSources.length>0?nt(n.dataSources):null,I=e.computed(()=>_?.state.value??{}),X=e.computed(()=>_?.isLoading.value??!1);function se(w){return _?.getData(w)??null}function ce(w){return _?.refetch(w)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",h),e.provide("layerboard-opacities",L),e.provide("layerboard-loading",e.readonly(s)),e.provide("layerboard-errors",e.readonly(g)),e.provide("layerboard-zoom",e.readonly(m)),e.provide("layerboard-toggle-layer",ue),e.provide("layerboard-set-layer-visible",oe),e.provide("layerboard-set-layers-visible",de),e.provide("layerboard-set-opacity",ne),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",f),e.provide("layerboard-toggle-tiled",k),e.provide("layerboard-set-tiled-opacity",x),e.provide("layerboard-set-tiled-visible",V),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",X),e.provide("layerboard-get-data-source",se),e.provide("layerboard-refetch-data-source",ce);const Te=e.computed(()=>({backgroundColor:n.themeColor})),Me=e.computed(()=>({backgroundColor:n.themeColor})),he=e.computed(()=>({backgroundColor:n.themeColor})),we=e.computed(()=>({width:j.value?"0":n.sidebarWidth}));async function ve(){try{d.value=!0,v.value=null;const C=(await $e(n.webMapId)).map(M=>{const q=n.layerStyleOverrides[M.id];return q?{...M,paint:q.paint??M.paint,outlinePaint:q.outlinePaint??M.outlinePaint,legend:q.legend??M.legend,type:q.type??M.type}:M});i.value=C.map(M=>({config:M,component:M.type}));const A={};C.forEach(M=>{A[M.id]=M.opacity??1}),L.value=A,r("configs-loaded",C)}catch(w){const C=w instanceof Error?w.message:"Failed to load layer configurations";v.value=C,r("load-error",C)}finally{d.value=!1}}function Ce(w){let C=w.split("?")[0]||w;return C=C.replace(/\/query$/,""),C=C.replace(/\/$/,""),C.toLowerCase()}async function Fe(){if(n.fetchMetadata)try{const w="https://phl.carto.com/api/v2/sql?q="+encodeURIComponent("select url_text, COALESCE(representation, '') as representation from phl.knack_metadata_reps_endpoints_join WHERE ( format = 'API' OR format = 'GeoService' ) AND url_text IS NOT null"),C=await fetch(w);if(!C.ok)return;const A=await C.json(),M={};for(const q of A.rows||[])if(q.url_text&&q.representation){const Ne=Ce(q.url_text),Ae=`https://metadata.phila.gov/#home/representationdetails/${q.representation}/`;M[Ne]=Ae}b.value=M}catch{}}function Ie(w){m.value=w,r("zoom",w)}function ue(w){h.value.has(w)?h.value.delete(w):h.value.add(w),h.value=new Set(h.value)}function oe(w,C){C?h.value.add(w):h.value.delete(w),h.value=new Set(h.value)}function de(w,C){for(const A of w)C?h.value.add(A):h.value.delete(A);h.value=new Set(h.value)}function ne(w,C){L.value={...L.value,[w]:C}}function Oe(w,C){C?s.value.add(w):s.value.delete(w),s.value=new Set(s.value)}function U(w,C){if(C)g.value={...g.value,[w]:C};else{const{[w]:A,...M}=g.value;g.value=M}}function le(w){S.value=w}const W=e.ref(null),re=e.ref(null),De=e.ref(null),Se=e.ref(null),be=e.ref(null),Ee=e.ref(null),H=e.ref("map");function ie(){H.value=H.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{H.value==="sidebar"&&W.value?.focus()})}const J=e.ref(!1);function Be(){J.value=!J.value,J.value&&e.nextTick(()=>{Se.value?.focus()})}function fe(){J.value=!1,e.nextTick(()=>{re.value?.focus()})}const j=e.ref(!1);function Re(){j.value=!j.value}const Y=e.ref(!1),ae=e.ref(null);function ee(){ae.value=document.activeElement,Y.value=!0,e.nextTick(()=>{Ee.value?.focus()})}function K(){Y.value=!1,e.nextTick(()=>{ae.value?.focus(),ae.value=null})}function Ze(w){w.target.classList.contains("layerboard-modal-backdrop")&&K()}function Q(w){if(w.key==="Escape"){K();return}if(w.key==="Tab"&&be.value){const C=Array.from(be.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const A=C[0],M=C[C.length-1];w.shiftKey?document.activeElement===A&&(w.preventDefault(),M.focus()):document.activeElement===M&&(w.preventDefault(),A.focus())}}e.provide("layerboard-open-modal",ee),e.provide("layerboard-close-modal",K),e.provide("layerboard-is-modal-open",e.readonly(Y)),l({layerList:i,visibleLayers:h,layerOpacities:L,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:ue,setLayerVisible:oe,setLayersVisible:de,setLayerOpacity:ne,reloadConfigs:ve,clearCache:()=>ot(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:f,toggleTiledLayer:k,setTiledLayerVisible:V,setTiledLayerOpacity:x,dataSourcesState:I,dataSourcesLoading:X,getDataSourceData:se,refetchDataSource:ce,isModalOpen:Y,openModal:ee,closeModal:K});function ke(w){w.key==="Escape"&&J.value&&fe()}return e.onMounted(()=>{ve(),Fe(),u(),document.addEventListener("keydown",ke)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",ke)}),(w,C)=>(e.openBlock(),e.createElementBlock("div",ho,[C[5]||(C[5]=e.createElementVNode("a",{href:"#main-content",class:"skip-to-main-content-link"},"Skip to main content",-1)),e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(Te.value)},[C[1]||(C[1]=e.createElementVNode("a",{href:"https://www.phila.gov/",class:"layerboard-logo layerboard-desktop-only"},[e.createElementVNode("img",{src:"https://standards.phila.gov/img/logo/city-of-philadelphia-yellow-white.png",alt:"City of Philadelphia"})],-1)),C[2]||(C[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only"},null,-1)),e.createElementVNode("button",{ref_key:"hamburgerRef",ref:re,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":J.value,onClick:Be,"aria-label":"Toggle menu"},[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref(_t),size:"medium",decorative:""},null,8,["icon-definition"])],8,vo),e.renderSlot(w.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",bo,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),J.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor})},[e.createElementVNode("div",ko,[e.renderSlot(w.$slots,"footer",{openModal:ee,closeModal:K,isModalOpen:Y.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:Se,class:"layerboard-mobile-menu-close",onClick:fe,"aria-label":"Close menu"},[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512)],4)):e.createCommentVNode("",!0),J.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:fe})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",Lo,[d.value?(e.openBlock(),e.createElementBlock("div",wo,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):v.value?(e.openBlock(),e.createElementBlock("div",Co,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(v.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:ve}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{ref_key:"sidebarRef",ref:W,id:"main-content",class:e.normalizeClass(["layerboard-sidebar",{"is-active":H.value==="sidebar"}]),style:e.normalizeStyle(we.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(w.$slots,"sidebar",{layers:i.value,visibleLayers:h.value,layerOpacities:L.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:ue,setLayerVisible:oe,setLayersVisible:de,setOpacity:ne,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:f.value,toggleTiledLayer:k,setTiledLayerVisible:V,setTiledLayerOpacity:x,dataSourcesState:I.value,dataSourcesLoading:X.value,getDataSource:se,refetchDataSource:ce},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(et,{key:0,"layer-list":i.value,"visible-layers":h.value,"layer-opacities":L.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":b.value,onToggleLayer:ue,onSetOpacity:ne,onUpdateSearch:le},null,8,["layer-list","visible-layers","layer-opacities","loading-layers","layer-errors","current-zoom","search-query","layer-metadata"])):e.createCommentVNode("",!0)],!0)],6),e.createElementVNode("div",{role:"main","aria-label":"Map",class:e.normalizeClass(["layerboard-map",{"is-active":H.value==="map"}])},[e.createVNode(Ye,{"visible-layers":h.value,"layer-opacities":L.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":f.value,"cyclomedia-config":t.cyclomediaConfig,"pictometry-credentials":t.pictometryCredentials,"basemap-control-position":t.basemapControlPosition,"navigation-control-position":t.navigationControlPosition,"geolocation-control-position":t.geolocationControlPosition,"search-control-position":t.searchControlPosition,"draw-control-position":t.drawControlPosition,"cyclomedia-button-position":t.cyclomediaButtonPosition,"pictometry-button-position":t.pictometryButtonPosition,"initial-zoom":t.initialZoom,"initial-center":t.initialCenter,onZoom:Ie,onLayerLoading:Oe,onLayerError:U},null,8,["visible-layers","layer-opacities","layer-list","tiled-layers","visible-tiled-layers","tiled-layer-opacities","cyclomedia-config","pictometry-credentials","basemap-control-position","navigation-control-position","geolocation-control-position","search-control-position","draw-control-position","cyclomedia-button-position","pictometry-button-position","initial-zoom","initial-center"])],2),e.createElementVNode("button",{class:e.normalizeClass(["layerboard-sidebar-toggle",{"is-collapsed":j.value}]),style:e.normalizeStyle({left:j.value?"0":n.sidebarWidth}),onClick:Re,"aria-label":"Toggle sidebar"},[e.createVNode(e.unref(R.Icon),{"icon-definition":j.value?e.unref(Pt):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],6)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:De,class:"layerboard-mobile-toggle",style:e.normalizeStyle(he.value),onClick:ie},[H.value==="map"?(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",Eo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Me.value)},[e.renderSlot(w.$slots,"footer",{openModal:ee,closeModal:K,isModalOpen:Y.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),Y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:Ze,onKeydown:Q},[e.createElementVNode("div",{ref_key:"modalRef",ref:be,class:"layerboard-modal",role:"dialog","aria-modal":"true"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Ee,class:"layerboard-modal-close",onClick:K,"aria-label":"Close modal"},[e.createVNode(e.unref(R.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(w.$slots,"modal",{closeModal:K},void 0,!0)],512)],32)):e.createCommentVNode("",!0)]))}}),No=ge(Bo,[["__scopeId","data-v-b6286f9f"]]),xo=["aria-expanded"],Vo={key:0,class:"topic-icon"},$o={class:"topic-title"},Po=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{}},emits:["toggle","layerChange"],setup(t,{emit:l}){const o=t,n=l,r=e.ref(o.expanded),i=`topic-panel-${e.useId()}`,d=`topic-header-${e.useId()}`;e.watch(()=>o.expanded,m=>{r.value=m});function v(){r.value=!r.value,n("toggle",r.value)}return(m,S)=>{const h=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{id:d,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,"aria-controls":i,onClick:v},[t.icon||m.$slots.icon?(e.openBlock(),e.createElementBlock("span",Vo,[e.renderSlot(m.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:["fas",t.icon]},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",$o,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":r.value}])},[...S[0]||(S[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,xo),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":d,class:"topic-content"},[e.renderSlot(m.$slots,"default",{},()=>[S[1]||(S[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),zo=ge(Po,[["__scopeId","data-v-d477f7ce"]]),_o={class:"layer-checkbox-set"},To=["checked","disabled","onChange"],Mo={class:"layer-title"},Fo={key:0,class:"loading-indicator"},Io=["aria-label"],Oo={key:2,class:"zoom-indicator"},Do={class:"layer-title"},Ro={key:0,class:"loading-indicator"},Zo=["aria-label"],Ao={key:2,class:"zoom-indicator"},Uo={key:2,class:"opacity-control"},Wo=["for"],jo=["id","value","aria-label","onInput"],qo={key:3,class:"layer-legend"},Go={class:"legend-label"},Ho={key:0,class:"empty-state"},Jo=e.defineComponent({__name:"LayerCheckboxSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0}},emits:["toggleLayer","setOpacity"],setup(t,{emit:l}){const o=t,n=l;function r(y){return o.visibleLayerIds.has(y)}function i(y){return o.layerOpacities[y]??1}function d(y){return o.loadingLayerIds.has(y)}function v(y){return o.layerErrors[y]||null}function m(y){const f=o.currentZoom,u=y.minZoom,k=y.maxZoom;return!(u!==void 0&&f<u||k!==void 0&&f>k)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function h(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function L(y){return o.showLegend?y.displayOptions?.shouldShowLegendBox!==!1:!1}function s(y){return y.displayOptions?.layerNameChange||y.title}function g(y){n("toggleLayer",y)}function b(y,f){const u=f.target;n("setOpacity",y,parseFloat(u.value))}return(y,f)=>(e.openBlock(),e.createElementBlock("div",_o,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:"layer-item"},[S(u)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(u.id),disabled:!m(u),onChange:k=>g(u.id)},null,40,To),e.createElementVNode("span",Mo,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Fo," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error"}," Error ",8,Io)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Oo," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("span",Do,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Ro," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error"}," Error ",8,Zo)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ao," (zoom in) "))])],2)),h(u)&&r(u.id)?(e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+u.id}," Opacity: "+e.toDisplayString(Math.round(i(u.id)*100))+"% ",9,Wo),e.createElementVNode("input",{id:"opacity-"+u.id,type:"range",min:"0",max:"1",step:"0.05",value:i(u.id),"aria-label":"Opacity for "+s(u),class:"opacity-slider",onInput:k=>b(u.id,k)},null,40,jo)])):e.createCommentVNode("",!0),L(u)&&r(u.id)&&u.legend?.length?(e.openBlock(),e.createElementBlock("ul",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.legend,(k,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[k.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:k.color}),"aria-hidden":"true"},null,4)):k.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:k.color,height:`${k.width||2}px`}),"aria-hidden":"true"},null,4)):k.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:k.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Go,e.toDisplayString(k.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Ho," No layers available ")):e.createCommentVNode("",!0)]))}}),Ko=ge(Jo,[["__scopeId","data-v-e07d84cd"]]),Qo={class:"layer-radio-set"},Xo=["name","checked","disabled","onChange"],Yo={class:"layer-title"},en={key:0,class:"loading-indicator"},tn=["aria-label"],on={key:2,class:"zoom-indicator"},nn={key:0,class:"opacity-control"},ln=["for"],an=["id","value","aria-label","onInput"],rn={key:1,class:"layer-legend"},sn={class:"legend-label"},cn={key:0,class:"empty-state"},un=e.defineComponent({__name:"LayerRadioButtonSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupName:{default:"layer-radio-group"}},emits:["selectLayer","setOpacity"],setup(t,{emit:l}){const o=t,n=l;function r(b){return o.visibleLayerIds.has(b)}function i(b){return o.layerOpacities[b]??1}function d(b){return o.loadingLayerIds.has(b)}function v(b){return o.layerErrors[b]||null}function m(b){const y=o.currentZoom,f=b.minZoom,u=b.maxZoom;return!(f!==void 0&&y<f||u!==void 0&&y>u)}function S(b){return o.showOpacity?b.displayOptions?.shouldShowSlider!==!1:!1}function h(b){return o.showLegend?b.displayOptions?.shouldShowLegendBox!==!1:!1}function L(b){return b.displayOptions?.layerNameChange||b.title}function s(b){const y=o.layers.filter(f=>o.visibleLayerIds.has(f.id)&&f.id!==b).map(f=>f.id);n("selectLayer",b,y)}function g(b,y){const f=y.target;n("setOpacity",b,parseFloat(f.value))}return(b,y)=>(e.openBlock(),e.createElementBlock("div",Qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(f),"layer-error":v(f.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(f.id),disabled:!m(f),onChange:u=>s(f.id)},null,40,Xo),e.createElementVNode("span",Yo,[e.createTextVNode(e.toDisplayString(L(f))+" ",1),d(f.id)?(e.openBlock(),e.createElementBlock("span",en," Loading... ")):e.createCommentVNode("",!0),v(f.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(f.id)||"Error"}," Error ",8,tn)):e.createCommentVNode("",!0),m(f)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",on," (zoom in) "))])],2),S(f)&&r(f.id)?(e.openBlock(),e.createElementBlock("div",nn,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+f.id}," Opacity: "+e.toDisplayString(Math.round(i(f.id)*100))+"% ",9,ln),e.createElementVNode("input",{id:"opacity-"+f.id,type:"range",min:"0",max:"1",step:"0.05",value:i(f.id),"aria-label":"Opacity for "+L(f),class:"opacity-slider",onInput:u=>g(f.id,u)},null,40,an)])):e.createCommentVNode("",!0),h(f)&&r(f.id)&&f.legend?.length?(e.openBlock(),e.createElementBlock("ul",rn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.legend,(u,k)=>(e.openBlock(),e.createElementBlock("li",{key:k,class:"legend-item"},[u.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):u.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:u.color,height:`${u.width||2}px`}),"aria-hidden":"true"},null,4)):u.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",sn,e.toDisplayString(u.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",cn," No layers available ")):e.createCommentVNode("",!0)]))}}),dn=ge(un,[["__scopeId","data-v-f6d42644"]]);function fn(t){const l=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),d=e.ref(""),v=e.ref(!1),m=e.ref(!1),S=e.ref(null),h=e.computed(()=>{if(!d.value.trim())return l.value;const x=d.value.toLowerCase();return l.value.filter(_=>_.title.toLowerCase().includes(x))}),L=e.computed(()=>l.value.map(x=>({config:x,component:x.type})));async function s(){if(!m.value){v.value=!0,S.value=null;try{let x;t.mode==="dynamic"||!t.mode?t.webMapId?x=await g(t.webMapId):x=await $e():x=await $e(),l.value=x;const _={};x.forEach(I=>{_[I.id]=I.opacity??1}),n.value=_,m.value=!0}catch(x){S.value=x instanceof Error?x:new Error("Failed to initialize layerboard")}finally{v.value=!1}}}async function g(x){const _=_e(x),I=await fetch(_);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const X=await I.json();return qe(X)}function b(x){const _=new Set(o.value);_.has(x)?_.delete(x):_.add(x),o.value=_}function y(x,_){n.value={...n.value,[x]:Math.max(0,Math.min(1,_))}}function f(x){d.value=x}function u(x,_){const I=new Set(r.value);_?I.add(x):I.delete(x),r.value=I}function k(x,_){if(_)i.value={...i.value,[x]:_};else{const{[x]:I,...X}=i.value;i.value=X}}function V(){l.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},d.value="",v.value=!1,m.value=!1,S.value=null}return{layerConfigs:e.readonly(l),visibleLayers:e.readonly(o),layerOpacities:e.readonly(n),loadingLayers:e.readonly(r),layerErrors:e.readonly(i),searchQuery:e.readonly(d),isLoading:e.readonly(v),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:h,layerList:L,config:t,initialize:s,toggleLayer:b,setLayerOpacity:y,filterLayers:f,setLayerLoading:u,setLayerError:k,reset:V}}function pn(){const t=e.ref([]),l=e.ref(new Set),o=e.ref(new Set);function n(i){l.value.has(i)?l.value.delete(i):l.value.add(i)}function r(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>l.value),loadingLayerIds:e.computed(()=>o.value),toggleLayer:n,setLayers:r}}function lt(t){const l=e.ref(null),o=e.ref(!1),n=e.ref(null),r=e.ref(0);async function i(m={}){o.value=!0,n.value=null;const S=t.pageSize||2e3;let h=0,L=[],s=!0;try{for(;s;){const b=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let f=`${b}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${h}&f=geojson`;if(m.bounds){const V=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});f+=`&geometry=${encodeURIComponent(V)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const u=await fetch(f);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);const k=await u.json();k.features&&k.features.length>0?(L=L.concat(k.features),h+=k.features.length,s=k.features.length===S):s=!1}const g={type:"FeatureCollection",features:L};return l.value=g,r.value=L.length,g}catch(g){const b=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=b,b}finally{o.value=!1}}function d(){l.value=null,r.value=0,n.value=null}async function v(m={}){return i(m)}return{data:e.readonly(l),isLoading:e.readonly(o),error:e.readonly(n),totalFeatures:e.readonly(r),config:t,fetch:i,refetch:v,clear:d}}function mn(t,l,o){const n=lt(t);return e.watch(l,async r=>{if(r){const i=o(r);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=Ko;exports.LayerPanel=et;exports.LayerRadioButtonSet=dn;exports.Layerboard=No;exports.MapPanel=Ye;exports.TopicAccordion=zo;exports.WEBMAP_ID=fo;exports.buildWebMapUrl=_e;exports.clearCache=ot;exports.getLayerConfigs=$e;exports.getWebMapUrl=po;exports.transformWebMapToLayerConfigs=qe;exports.useApiDataSources=nt;exports.useDataSource=lt;exports.useLayerConfig=pn;exports.useLayerboard=fn;exports.useReactiveDataSource=mn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@phila/phila-ui-map-core"),Z=require("@phila/phila-ui-core");var me=typeof document<"u"?document.currentScript:null;function ze(t,a,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=a||{},n.geometry=t,n}function rt(t,a,o={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<r[r.length-1].length;i++)if(r[r.length-1][i]!==r[0][i])throw new Error("First and last Position are not equivalent.")}return ze({type:"Polygon",coordinates:t},a,o)}function it(t,a,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ze({type:"LineString",coordinates:t},a,o)}function st(t,a,o={}){return ze({type:"MultiLineString",coordinates:t},a,o)}function ct(t,a,o={}){return ze({type:"MultiPolygon",coordinates:t},a,o)}function ut(t){return t.type==="Feature"?t.geometry:t}function dt(t,a,o){var n=t.length,r=ye(t[0],a),i=[],d,v,m;let S,h;for(o||(o=[]),d=1;d<n;d++){for(S=t[d-1],h=t[d],v=m=ye(h,a);;)if(r|v){if(r&v)break;r?(S=je(S,h,r,a),r=ye(S,a)):(h=je(S,h,v,a),v=ye(h,a))}else{i.push(S),v!==m?(i.push(h),d<n-1&&(o.push(i),i=[])):d===n-1&&i.push(h);break}r=m}return i.length&&o.push(i),o}function ft(t,a){var o,n,r,i,d,v,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(ye(r,a)&n),d=0;d<t.length;d++)v=t[d],m=!(ye(v,a)&n),m!==i&&o.push(je(r,v,n,a)),m&&o.push(v),r=v,i=m;if(t=o,!t.length)break}return o}function je(t,a,o,n){return o&8?[t[0]+(a[0]-t[0])*(n[3]-t[1])/(a[1]-t[1]),n[3]]:o&4?[t[0]+(a[0]-t[0])*(n[1]-t[1])/(a[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(a[1]-t[1])*(n[2]-t[0])/(a[0]-t[0])]:o&1?[n[0],t[1]+(a[1]-t[1])*(n[0]-t[0])/(a[0]-t[0])]:null}function ye(t,a){var o=0;return t[0]<a[0]?o|=1:t[0]>a[2]&&(o|=2),t[1]<a[1]?o|=4:t[1]>a[3]&&(o|=8),o}function pt(t,a){const o=ut(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const d=[];return n==="LineString"&&(i=[i]),i.forEach(v=>{dt(v,a,d)}),d.length===1?it(d[0],r):st(d,r)}case"Polygon":return rt(Ke(i,a),r);case"MultiPolygon":return ct(i.map(d=>Ke(d,a)),r);default:throw new Error("geometry "+n+" not supported")}}function Ke(t,a){const o=[];for(const n of t){const r=ft(n,a);r.length>0&&((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]),r.length>=4&&o.push(r))}return o}var mt=pt;const yt={class:"map-panel"},gt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{},visibleTiledLayers:{},tiledLayerOpacities:{},cyclomediaConfig:{},pictometryCredentials:{},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{},initialCenter:{}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(null),i=e.ref(null),d=e.ref(0);function v(l){n("zoom",l),i.value&&(d.value=m(i.value))}function m(l){const p=l.getZoom(),B=l.getCenter().lat,E=559082264028e-3,x=B*Math.PI/180;return E*Math.cos(x)/Math.pow(2,p)}const S=e.ref({}),h=e.ref(null),w=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(l,p,c,B){const E=encodeURIComponent(B||"1=1"),x=JSON.stringify({xmin:p.west,ymin:p.south,xmax:p.east,ymax:p.north,spatialReference:{wkid:4326}}),$=2e3;let M=0,F=[],U=!0;for(;U;){const O=`${l}/query?where=${E}&geometry=${encodeURIComponent(x)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${M}&f=geojson`,_=await fetch(O);if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);const R=await _.json();R.features&&R.features.length>0?(F=F.concat(R.features),M+=R.features.length,U=R.features.length===$):U=!1}if(s.includes(c)){const O=[p.west,p.south,p.east,p.north];F=F.map(_=>{if(_.geometry&&(_.geometry.type==="Polygon"||_.geometry.type==="MultiPolygon"))try{return mt(_,O)}catch{return _}return _})}return{type:"FeatureCollection",features:F}}async function b(l,p){const c=p.map(async B=>{const E=o.layerList.find(x=>x.config.id===B)?.config;if(E){n("layerLoading",B,!0);try{const x=await g(E.url,l,B,E.where);S.value={...S.value,[B]:x},n("layerError",B,null)}catch(x){const $=x instanceof Error?x.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(l){const p=[...o.visibleLayers];await b(l,p)}function f(l){h.value=l.bounds,y(l.bounds)}function u(l){i.value=l;const p=l.getBounds();h.value={west:p.getWest(),south:p.getSouth(),east:p.getEast(),north:p.getNorth()};const c=l.getZoom();n("zoom",c),d.value=m(l),y(h.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(q.value.length>0&&se(),h.value){const l=new Set(o.visibleLayers),p=[...l].filter(c=>!w.value.has(c));w.value=new Set(l),p.length>0&&await b(h.value,p)}});function L(l){return o.visibleLayers.has(l)}function V(l){return!!S.value[l.id]}const N=e.computed(()=>o.layerList.filter(l=>l.config.type==="circle"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),T=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),I=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&l.config.outlinePaint&&L(l.config.id)&&V(l.config)).map(l=>l.config)),X=e.computed(()=>o.layerList.filter(l=>l.config.type==="line"&&L(l.config.id)&&V(l.config)).map(l=>l.config));function ue(l){return o.visibleTiledLayers?.has(l)??!1}function de(l){return o.tiledLayerOpacities?.[l]??1}function Fe(l){return`${l.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ie(l){return{type:"raster",tiles:[Fe(l.url)],tileSize:256,attribution:l.attribution||""}}const ve=e.ref({}),Se=e.ref(new Set);async function be(l){if(!Se.value.has(l.id)){Se.value.add(l.id);try{const p=l.url.replace(/\/$/,""),c=await fetch(`${p}?f=json`);if(!c.ok)return;const B=await c.json();let E=B.minScale||0,x=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(x===0||$.maxScale<x)&&(x=$.maxScale);x===0&&(x=72e3),ve.value={...ve.value,[l.id]:{minScale:E,maxScale:x}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const l of o.tiledLayers)l.scaleBasedRendering&&be(l)});function Ee(l){if(!l.scaleBasedRendering)return"tiled";const p=ve.value[l.id];if(!p)return"tiled";const c=d.value;return c===0||c>p.maxScale?"tiled":"dynamic"}const Oe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)?l.scaleBasedRendering?Ee(l)==="tiled":!0:!1):[]),De=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)&&l.scaleBasedRendering?Ee(l)==="dynamic":!1):[]);function fe(l){return{type:"raster",tiles:[`${l.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:l.attribution||""}}function oe(l){return{type:"geojson",data:S.value[l.id]}}function pe(l){return o.layerOpacities[l]??1}function ne(l){const p=pe(l.id),c=l.type==="circle"?"circle-opacity":l.type==="fill"?"fill-opacity":"line-opacity";if(l.type==="fill"&&l.paint["fill-opacity"]===0)return{...l.paint,"fill-opacity":0};const B=l.type==="circle"?"circle-color":l.type==="fill"?"fill-color":"line-color",E={...l.paint},x=E[B],$=E[c]===1,M=typeof x=="string"&&x.startsWith("rgba(");if($&&M){if(p===1)return E;{const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F&&F[4]){const[,U,O,_,R]=F,We=parseFloat(R)*p;E[B]=`rgba(${U}, ${O}, ${_}, ${We})`,E[c]=1}return E}}if(M){const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F){const[,U,O,_]=F;E[B]=`rgb(${U}, ${O}, ${_})`}}return E[c]=p,E}function Re(l){const p=pe(l.id);return{...l.outlinePaint,"line-opacity":p}}const q=e.ref([]),le=e.ref(null),j=e.ref(0);function re(l){const p=l.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===p)?.config}function Ze(l,p){return l.replace(/\{([^}]+)\}/g,(c,B)=>{const E=p[B];return E==null?"":String(E)})}function ie(l){return l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ke(l,p){if(l==null)return"-";if(p?.dateFormat&&typeof l=="number"){const c=new Date(l);switch(p.dateFormat){case"shortDateShortTime":return c.toLocaleString();case"longMonthDayYear":return c.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return c.toLocaleDateString();case"longDate":return c.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return c.toLocaleDateString()}}if(typeof l=="number"){if(l>1e12&&!p)return new Date(l).toLocaleDateString();const c=p?.places,B=p?.digitSeparator??!0;if(c!==void 0){const E=l.toFixed(c);if(B){const x=E.split("."),$=x[0]||"0",M=x[1],F=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return M?`${F}.${M}`:F}return E}return B?l.toLocaleString():String(l)}return String(l)}function Le(l){const p=new Set;return l.filter(c=>{const E=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return p.has(E)?!1:(p.add(E),!0)})}function Be(l,p){const c=new Map;return p.forEach((B,E)=>{c.set(B.id,E)}),l.sort((B,E)=>{const x=B.layer.id.replace(/-outline$/,""),$=E.layer.id.replace(/-outline$/,""),M=c.get(x)??-1;return(c.get($)??-1)-M})}function G(l){const p=i.value;if(!p)return;const c=[];o.layerList.forEach(O=>{const _=O.config;o.visibleLayers.has(_.id)&&(c.push(_.id),_.outlinePaint&&c.push(`${_.id}-outline`))});const B=p.project([l.lngLat.lng,l.lngLat.lat]),E=p.queryRenderedFeatures(B,{layers:c});if(E.length===0)return;const x=Le(E),$=o.layerList.map(O=>O.config),M=Be(x,$),F=M.map(O=>{const _=O.layer.id.replace(/-outline$/,""),R=re(_);return R?{layerId:R.id,layerTitle:R.title,properties:O.properties||{},popupConfig:R.popup}:null}).filter(O=>O!==null);if(F.length===0)return;q.value=F,j.value=0,le.value=[l.lngLat.lng,l.lngLat.lat];const U=M[0];if(U&&U.geometry){const O=U.layer.id.replace(/-outline$/,""),_=re(O);if(_){const R=Ve(U.geometry),We=we(_.id,_.type);Q.value={geometry:U.geometry,geometryType:R,layerId:_.id,properties:U.properties||{},originalStyle:We}}}}function se(){q.value=[],le.value=null,j.value=0,Q.value=null}function K(l){if(q.value.length===0)return;const p=l.target;if(!(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable))switch(l.key){case"ArrowLeft":case"ArrowUp":l.preventDefault(),ce();break;case"ArrowRight":case"ArrowDown":l.preventDefault(),xe();break;case"Escape":l.preventDefault(),se();break}}e.onMounted(()=>{window.addEventListener("keydown",K)}),e.onUnmounted(()=>{window.removeEventListener("keydown",K)});function xe(){const l=q.value.length;l<=1||(j.value=(j.value+1)%l)}function ce(){const l=q.value.length;l<=1||(j.value=(j.value-1+l)%l)}const A=e.computed(()=>q.value.length===0?null:q.value[j.value]),Ne=e.computed(()=>{const l=A.value;return!l||!l.popupConfig?l?.layerTitle||"":Ze(l.popupConfig.title,l.properties)}),Y=e.computed(()=>{const l=A.value;if(!l)return"";let p='<div class="popup-content">';if(p+=`<h3 class="popup-title">${ie(Ne.value)}</h3>`,l.popupConfig?.fields?.length){p+=`<table class="popup-table" aria-label="${ie(Ne.value)}">`;for(const c of l.popupConfig.fields){const B=ke(l.properties[c.field],c.format);p+=`<tr><th scope="row">${ie(c.label)}</th><td>${ie(B)}</td></tr>`}p+="</table>"}else p+='<p class="popup-no-fields">No additional information available.</p>';return p+="</div>",p}),ae=e.ref({type:"FeatureCollection",features:[]}),ee=e.ref({type:"FeatureCollection",features:[]}),J={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Ae={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},Q=e.ref(null);function Ve(l){return l.type}function we(l,p){const c=re(l);if(!c)return{radius:5,width:2};const B=c.paint||{};if(p==="circle"){const E=B["circle-radius"];return typeof E=="number"?{radius:E}:{radius:5}}if(p==="line"||p==="fill"){const E=B["line-width"];if(typeof E=="number")return{width:E};if(c.outlinePaint&&c.outlinePaint["line-width"]){const x=c.outlinePaint["line-width"];if(typeof x=="number")return{width:x}}return{width:2}}return{radius:5,width:2}}function k(l){return!l||l.length===0?[]:l[0]??[]}function C(l){const{geometry:p,geometryType:c,originalStyle:B}=l;if(c==="Point"||c==="MultiPoint"){const x=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightRadius:x}}]}}if(c==="LineString"||c==="MultiLineString"){const x=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightWidth:x}}]}}if(c==="Polygon"){const E=p.coordinates,x=k(E),M=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:x},properties:{highlightWidth:M}}]}}if(c==="MultiPolygon"){const E=p.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:E.map(F=>({type:"Feature",geometry:{type:"LineString",coordinates:k(F)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function D(l){if(!l){z();return}const p=C(l);l.geometryType==="Point"||l.geometryType==="MultiPoint"?(ae.value=p,ee.value={type:"FeatureCollection",features:[]}):(ee.value=p,ae.value={type:"FeatureCollection",features:[]})}function z(){ae.value={type:"FeatureCollection",features:[]},ee.value={type:"FeatureCollection",features:[]}}e.watch(Q,l=>{D(l)}),e.watch(()=>o.visibleLayers,l=>{Q.value&&!l.has(Q.value.layerId)&&(Q.value=null,se())},{deep:!0}),e.watch(j,()=>{const l=A.value;if(!l){Q.value=null;return}const p=i.value;if(!p||!le.value)return;const c=[];o.layerList.forEach($=>{const M=$.config;o.visibleLayers.has(M.id)&&(c.push(M.id),M.outlinePaint&&c.push(`${M.id}-outline`))});const B=p.project(le.value),x=p.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===l.layerId&&JSON.stringify($.properties)===JSON.stringify(l.properties));if(x&&x.geometry){const $=re(l.layerId);if($){const M=Ve(x.geometry),F=we($.id,$.type);Q.value={geometry:x.geometry,geometryType:M,layerId:$.id,properties:x.properties||{},originalStyle:F}}}});const W=e.ref(null);function Ue(l){const[p,c]=l.geometry.coordinates;W.value=[p,c]}return(l,p)=>(e.openBlock(),e.createElementBlock("div",yt,[e.createVNode(e.unref(H.Map),{ref_key:"mapRef",ref:r,zoom:o.initialZoom,center:o.initialCenter,"navigation-controls":{position:o.navigationControlPosition},"geolocation-control":{position:o.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:o.basemapControlPosition},"map-search-control":{position:o.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":o.cyclomediaConfig,"cyclomedia-button-position":o.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":o.pictometryCredentials,"pictometry-button-position":o.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:v,onClick:se,onMoveend:f,onLoad:u,onSearchResult:Ue},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(H.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Oe.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ie(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(De.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:fe(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,c=>(e.openBlock(),e.createBlock(e.unref(H.CircleLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,c=>(e.openBlock(),e.createBlock(e.unref(H.FillLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:oe(c),paint:Re(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(H.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:ae.value},paint:J},null,8,["source"]),e.createVNode(e.unref(H.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:ee.value},paint:Ae},null,8,["source"]),e.createVNode(e.unref(H.MapMarker),{"lng-lat":W.value,color:"#2176d2"},null,8,["lng-lat"]),A.value&&le.value?(e.openBlock(),e.createBlock(e.unref(H.MapPopup),{key:1,"lng-lat":le.value,html:Y.value,"close-on-click":!1,"show-navigation":q.value.length>1,"current-feature-index":j.value,"total-features":q.value.length,"layer-name":A.value.layerTitle,onClose:se,onNext:xe,onPrevious:ce},null,8,["lng-lat","html","show-navigation","current-feature-index","total-features","layer-name"])):e.createCommentVNode("",!0)]),_:1},8,["zoom","center","navigation-controls","geolocation-control","basemap-change-controls","map-search-control","cyclomedia-config","cyclomedia-button-position","pictometry-credentials","pictometry-button-position"])]))}}),he=(t,a)=>{const o=t.__vccOpts||t;for(const[n,r]of a)o[n]=r;return o},et=he(gt,[["__scopeId","data-v-669444d6"]]),ht=["disabled"],vt=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const a=t,o=d=>"href"in d&&d.href!==void 0||"to"in d&&d.to!==void 0,n=e.computed(()=>Z.cn("phila-button",`phila-button--${a.variant}`,a.size&&`is-${a.size}`,a.iconOnly&&"icon-button",a.iconOnly&&a.variant==="standard"&&"icon-button--standard",a.className)),r=e.computed(()=>o(a)?"to"in a&&a.to!==void 0?{to:a.to,disabled:a.disabled,className:n.value}:{href:a.href,target:a.target,rel:a.rel,disabled:a.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:a.iconDefinition,iconClass:a.iconClass,src:a.src,iconRight:a.iconRight,iconOnly:a.iconOnly,text:a.text,size:a.size}));return(d,v)=>o(a)?(e.openBlock(),e.createBlock(e.unref(Z.BaseLink),e.mergeProps({key:0},{...r.value,...d.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(Z.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:a.disabled,class:n.value},d.$attrs),[e.createVNode(e.unref(Z.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.text),1)])]),_:3},16)],16,ht))}});var bt={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]},kt=bt,Lt={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},wt=Lt;const Ct=["for"],St={class:"state-layer"},Et={class:"content"},Bt={class:"input-text-container"},xt=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},$t=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:a}){const o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),d=a,v=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:v.value,set:g=>{d("update:modelValue",g),v.value=g}}),S=e.computed(()=>{const g=["default-class"];return o.disabled!=null&&g.push("phila-input--disabled"),r.value&&g.push("phila-input--error"),o.required!=null&&g.push("phila-input--required"),Z.cn(...g)}),h=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),Z.cn(...g)}),w=e.ref(null),s=g=>{g.target.closest("button")||w.value?.focus()};return(g,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",S.value])},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:i.value,class:"has-text-label-small phila-label"},e.toDisplayString(n.label),9,Ct)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",h.value]),onClick:s},[e.createElementVNode("div",St,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",Et,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:w,"onUpdate:modelValue":b[0]||(b[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,xt),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(vt),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(wt),onClick:b[1]||(b[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Nt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Vt,[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(kt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var Pt={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},_t={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z"]},zt={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M7.7 235.8c-10.3 12.6-9.5 31.1 2.2 42.8l128 128c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-256c0-12.9-7.8-24.6-19.8-29.6s-25.7-2.2-34.9 6.9l-128 128-2.2 2.4z"]},Je={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Tt={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]},Mt={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"]};const Ft={class:"layer-panel"},It={key:0,class:"search-box"},Ot={key:1,class:"topics-container"},Dt={class:"layer-row"},Rt=["href","aria-label"],Zt={key:1,class:"metadata-placeholder"},At=["checked","disabled","onChange"],Ut={class:"layer-title"},Wt={key:0,class:"loading-indicator",role:"status"},qt=["aria-label"],jt={key:2,class:"zoom-indicator"},Gt={key:0,class:"opacity-control"},Ht=["for"],Kt=["id","value","aria-label","onInput"],Jt=["aria-label"],Qt={class:"legend-label"},Xt={key:0,class:"no-results"},Yt=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:a}){const o=t,n=a,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const f=o.searchQuery.toLowerCase();return o.layerList.filter(u=>u.config.title.toLowerCase().includes(f))});function i(f){let u=f.split("?")[0]||f;return u=u.replace(/\/query$/,""),u=u.replace(/\/$/,""),u.toLowerCase()}function d(f){const u=i(f);return o.layerMetadata[u]||null}const v=e.computed(()=>o.layerList.some(f=>d(f.config.url)));function m(f){return o.visibleLayers.has(f)}function S(f){return o.layerOpacities[f]??1}function h(f){return o.loadingLayers.has(f)}function w(f){return o.layerErrors[f]||null}function s(f){const u=o.currentZoom,L=f.minZoom,V=f.maxZoom;return!(L!==void 0&&u<L||V!==void 0&&u>V)}const g=e.computed({get:()=>o.searchQuery,set:f=>n("updateSearch",f)});function b(f){n("toggleLayer",f)}function y(f,u){const L=u.target,V=parseFloat(L.value);n("setOpacity",f,V)}return(f,u)=>(e.openBlock(),e.createElementBlock("div",Ft,[t.showSearch?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(e.unref($t),{modelValue:g.value,"onUpdate:modelValue":u[0]||(u[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Pt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",Ot,[e.renderSlot(f.$slots,"topics",{},()=>[u[2]||(u[2]=e.createElementVNode("div",{class:"no-topics"},' No topic components provided. Use the "topics" slot to add TopicAccordion components. ',-1))],!0)])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["layer-list",{"has-metadata":v.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,L=>(e.openBlock(),e.createElementBlock("div",{key:L.config.id,class:"layer-item"},[e.createElementVNode("div",Dt,[d(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:d(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+L.config.title,onClick:u[1]||(u[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Mt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Rt)):v.value?(e.openBlock(),e.createElementBlock("span",Zt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":w(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:V=>b(L.config.id)},null,40,At),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),h(L.config.id)?(e.openBlock(),e.createElementBlock("span",Wt," Loading... ")):e.createCommentVNode("",!0),w(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":w(L.config.id)||"Error",role:"status"}," Error ",8,qt)):e.createCommentVNode("",!0),s(L.config)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",jt," (zoom in) "))])],2)]),t.showOpacity&&m(L.config.id)?(e.openBlock(),e.createElementBlock("div",Gt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+L.config.id}," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",9,Ht),e.createElementVNode("input",{id:"opacity-"+L.config.id,type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),"aria-label":"Opacity for "+L.config.title,class:"opacity-slider",onInput:V=>y(L.config.id,V)},null,40,Kt)])):e.createCommentVNode("",!0),t.showLegend&&m(L.config.id)&&L.config.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:1,class:"layer-legend","aria-label":"Legend for "+L.config.title},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.config.legend,(V,N)=>(e.openBlock(),e.createElementBlock("li",{key:N,class:"legend-item"},[V.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):V.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:V.color,height:`${V.width||2}px`}),"aria-hidden":"true"},null,4)):V.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(V.label),1)]))),128))],8,Jt)):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Xt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),tt=he(Yt,[["__scopeId","data-v-a0dcf4f0"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const a=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${a}, ${o}, ${n}, ${i.toFixed(2)})`}function te(t){return t!==void 0?t:1}const eo=559082264;function Qe(t){return!t||t<=0?null:Math.round(Math.log2(eo/t)*100)/100}function to(t,a){const o={};if(t&&t>0){const n=Qe(t);n!==null&&(o.minZoom=n)}if(a&&a>0){const n=Qe(a);n!==null&&(o.maxZoom=n)}return o}function Te(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function ge(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function qe(t){return String(t)}function ot(t,a,o){const n=t.symbol,r=Te(n);let i={},d=[],v=null;if(r==="fill"&&n){const m=n.color===null?0:n.color?.[3]??255,S=m===0?"rgba(0, 0, 0, 0)":P(n.color),h=m===0?0:m<255?1:te(a);if(i={"fill-color":S,"fill-opacity":h},ge(n.outline)){const w=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(w>1||m===0)&&(v={"line-color":s,"line-width":w})}d=[{type:"fill",color:P(n.color),label:t.label||"Feature"}]}else if(r==="line"&&n)i={"line-color":P(n.color),"line-width":n.width||1,"line-opacity":te(a)},d=[{type:"line",color:P(n.color),width:n.width||1,label:t.label||"Feature"}];else if(r==="circle"&&n){const m=Math.round((n.size||6)*.71*100)/100;i={"circle-color":P(n.color),"circle-radius":m,"circle-opacity":te(a)},ge(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),d=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:d,geomType:r,outlinePaint:v}}function oo(t,a,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return ot({...t,symbol:i},a);const d=r[0]?.symbol||i,v=Te(d);let m={},S=[],h=null;if(v==="fill"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"fill",color:P(s.symbol?.color),label:y})}if(w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":w,"fill-opacity":te(a)},ge(d?.outline)){const s=d.outline.width||1,g=P(d.outline.color);m["fill-outline-color"]=g,s>1&&(h={"line-color":g,"line-width":s})}}else if(v==="line"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"line",color:P(s.symbol?.color),width:s.symbol?.width||1,label:y})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":w,"line-width":d?.width||2,"line-opacity":te(a)}}else if(v==="circle"){const w=["match",["to-string",["get",n]]];for(const g of r){w.push(qe(g.value)),w.push(P(g.symbol?.color));const b=String(g.value),f=o?.get(b)||g.label||b;S.push({type:"circle",color:P(g.symbol?.color),label:f})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((d?.size||6)*.71*100)/100;m={"circle-color":w,"circle-radius":s,"circle-opacity":te(a)},ge(d?.outline)&&(m["circle-stroke-color"]=P(d.outline.color),m["circle-stroke-width"]=d.outline.width||1)}return{paint:m,legend:S,geomType:v,outlinePaint:h}}function no(t,a){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(h=>h.type==="colorInfo");if(r?.stops&&r.stops.length>0)return lo(r,o,t,a);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));for(let w=0;w<n.length;w++){const s=n[w];w>0&&(h.push(n[w-1].classMaxValue),h.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(v={"fill-color":h,"fill-opacity":te(a)},ge(i?.outline)){const w=i.outline.width||1,s=P(i.outline.color);v["fill-outline-color"]=s,w>1&&(S={"line-color":s,"line-width":w})}}else if(d==="line"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));let w=t.minValue??0;for(let g=0;g<n.length;g++){const b=n[g];g>0&&(h.push(n[g-1].classMaxValue),h.push(P(b.symbol?.color))),m.push({type:"line",color:P(b.symbol?.color),width:b.symbol?.width||i?.width||2,label:b.label||`${w} - ${b.classMaxValue}`}),w=b.classMaxValue+1}const s=i?.width||2;v={"line-color":h,"line-width":s,"line-opacity":te(a)}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function lo(t,a,o,n){const r=t.stops||[];if(r.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=o.classBreakInfos?.[0]?.symbol||o.defaultSymbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["interpolate",["linear"],["get",a]];for(const s of r)h.push(s.value),h.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(v={"fill-color":["case",["==",["get",a],null],"rgba(0, 0, 0, 0)",h],"fill-opacity":te(n)},ge(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);v["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function ao(t,a,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return ot(r,a);case"uniqueValue":return oo(r,a,o);case"classBreaks":return no(r,a);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ro(t){if(!t)return null;const a=t.title||"",n=(t.fieldInfos||[]).filter(r=>r.visible===!0).map(r=>{const i={field:r.fieldName,label:r.label||r.fieldName};return r.format&&(i.format={},r.format.dateFormat&&(i.format.dateFormat=r.format.dateFormat),r.format.digitSeparator!==void 0&&(i.format.digitSeparator=r.format.digitSeparator),r.format.places!==void 0&&(i.format.places=r.format.places),Object.keys(i.format).length===0&&delete i.format),i});return{title:a,fields:n}}function io(t){return t?.definitionExpression}function so(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function co(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function uo(t){const a=new Map;if(!t)return a;const o=t.split(`
2
+ `),n=/^(\d{1,3})\s+(.+)$/;for(const r of o){const i=r.trim().match(n);if(i){const[,d,v]=i;d&&v&&a.set(d,v.trim())}}return a}async function fo(t){try{const a=await fetch(`${t}?f=json`);if(!a.ok)return null;const o=await a.json();return o.drawingInfo?{drawingInfo:o.drawingInfo,description:o.description}:null}catch{return null}}async function Ge(t){const a=t.operationalLayers||[],o=[],n=["Zoning and Planning_Land Use"];for(const r of a)if(r.url&&r.itemId!=="4f39b829b96d437da9231727d9c91fab")try{let i=r.layerDefinition?.drawingInfo,d;const v=!i||!i.renderer,m=n.includes(r.title);if((v||m)&&r.url){const N=await fo(r.url);N&&(i=N.drawingInfo,N.description&&(d=uo(N.description),d.size>0))}const{paint:S,legend:h,geomType:w,outlinePaint:s}=ao(i,r.opacity,d,r.title),g=ro(r.popupInfo),b=io(r.layerDefinition),y=to(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),f=so(r.title),u=co(r.title);let L=r.opacity??1;const V={id:f,title:u,type:w,url:r.url,opacity:L,paint:S,legend:h,popup:g};b&&(V.where=b),y.minZoom!==void 0&&(V.minZoom=y.minZoom),y.maxZoom!==void 0&&(V.maxZoom=y.maxZoom),s&&(V.outlinePaint=s),o.push(V)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Xe={},He="376af635c84643cd816a8c5d017a53aa",po=He;function Me(t,a){let o=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return a&&(o+=`&token=${a}`),o}function mo(){return Me(He)}const Pe=new Map,Ce=new Map;function nt(t){t?(Pe.delete(t),Ce.delete(t)):(Pe.clear(),Ce.clear())}let $e,Ye=0;async function yo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_USERNAME,a=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_PASSWORD;if(!(!t||!a)){if($e&&Date.now()<Ye-3e5)return $e;try{const n=await(await fetch("https://www.arcgis.com/sharing/rest/generateToken",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({f:"json",username:t,password:a,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return n.error?void 0:($e=n.token,Ye=n.expires,$e)}catch{return}}}async function go(t,a){const o=Me(t,a),n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const r=await n.json();if(r.error)throw new Error(`ArcGIS error: ${r.error.message||r.error.code||"Unknown error"}`);return r}async function ho(t){try{const a=await yo(),o=await go(t,a);return await Ge(o)}catch(a){throw new Error(`Failed to load dynamic layer configs: ${a instanceof Error?a.message:"Unknown error"}`)}}async function _e(t=He){const a=Pe.get(t);if(a)return a;const o=Ce.get(t);if(o)return o;const n=(async()=>{try{const r=await ho(t);return Pe.set(t,r),r}finally{Ce.delete(t)}})();return Ce.set(t,n),n}function lt(t){const a=e.ref({}),o=new Map;for(const s of t)a.value[s.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(s){const g=s.id;a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!0,error:null}};try{let b;if(s.type==="http-get"){const y=await fetch(s.url,{method:"GET",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="http-post"){const y=await fetch(s.url,{method:"POST",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="esri"){const f=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,u=await fetch(f,s.options);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);b=(await u.json()).features?.map(V=>V.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(b=s.transform(b)),a.value={...a.value,[g]:{data:b,loading:!1,error:null,lastFetched:Date.now()}}}catch(b){const y=b instanceof Error?b.message:"Unknown error";a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!1,error:y}}}}async function r(){await Promise.all(t.map(s=>n(s)))}async function i(s){const g=t.find(b=>b.id===s);g&&await n(g)}function d(s){return a.value[s]?.data??null}const v=e.computed(()=>Object.values(a.value).some(s=>s.loading));function m(s){return a.value[s]?.loading??!1}function S(s){return a.value[s]?.error??null}function h(){for(const s of t)if(s.pollInterval&&s.pollInterval>0){const g=window.setInterval(()=>{n(s)},s.pollInterval);o.set(s.id,g)}}function w(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),h()}),e.onUnmounted(()=>{w()}),{state:e.readonly(a),isLoading:v,fetchAll:r,refetch:i,getData:d,isSourceLoading:m,getError:S,stopPolling:w}}const vo={class:"layerboard-layout"},bo=["aria-expanded"],ko={key:0,class:"layerboard-subtitle"},Lo={class:"layerboard-mobile-menu-content"},wo={class:"layerboard-main"},Co={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},So={key:1,class:"layerboard-error",role:"alert"},Eo=["aria-expanded","aria-label"],Bo={key:0},xo={key:1},No={class:"sr-only","aria-live":"polite"},Vo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{},pictometryCredentials:{},showDefaultSidebar:{type:Boolean,default:!0},sidebarWidth:{default:"30%"},sidebarLabel:{default:"Layers"},mapLabel:{default:"Map"},fetchMetadata:{type:Boolean,default:!1},tiledLayers:{default:()=>[]},dataSources:{default:()=>[]},layerStyleOverrides:{default:()=>({})},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{},initialCenter:{}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:a,emit:o}){const n=t,r=o,i=e.ref([]),d=e.ref(!0),v=e.ref(null),m=e.ref(12),S=e.ref(""),h=e.ref(new Set),w=e.ref({}),s=e.ref(new Set),g=e.ref({}),b=e.ref({}),y=e.ref(new Set),f=e.ref({});function u(){const k={};for(const C of n.tiledLayers)k[C.id]=C.opacity??1;f.value=k}function L(k){y.value.has(k)?y.value.delete(k):y.value.add(k),y.value=new Set(y.value)}function V(k,C){C?y.value.add(k):y.value.delete(k),y.value=new Set(y.value)}function N(k,C){f.value={...f.value,[k]:C}}const T=n.dataSources.length>0?lt(n.dataSources):null,I=e.computed(()=>T?.state.value??{}),X=e.computed(()=>T?.isLoading.value??!1);function ue(k){return T?.getData(k)??null}function de(k){return T?.refetch(k)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",h),e.provide("layerboard-opacities",w),e.provide("layerboard-loading",e.readonly(s)),e.provide("layerboard-errors",e.readonly(g)),e.provide("layerboard-zoom",e.readonly(m)),e.provide("layerboard-toggle-layer",fe),e.provide("layerboard-set-layer-visible",oe),e.provide("layerboard-set-layers-visible",pe),e.provide("layerboard-set-opacity",ne),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",f),e.provide("layerboard-toggle-tiled",L),e.provide("layerboard-set-tiled-opacity",N),e.provide("layerboard-set-tiled-visible",V),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",X),e.provide("layerboard-get-data-source",ue),e.provide("layerboard-refetch-data-source",de);const Fe=e.computed(()=>({backgroundColor:n.themeColor})),Ie=e.computed(()=>({backgroundColor:n.themeColor})),ve=e.computed(()=>({backgroundColor:n.themeColor})),Se=e.computed(()=>({width:A.value?"0":n.sidebarWidth}));async function be(){try{d.value=!0,v.value=null;const C=(await _e(n.webMapId)).map(z=>{const W=n.layerStyleOverrides[z.id];return W?{...z,paint:W.paint??z.paint,outlinePaint:W.outlinePaint??z.outlinePaint,legend:W.legend??z.legend,type:W.type??z.type}:z});i.value=C.map(z=>({config:z,component:z.type}));const D={};C.forEach(z=>{D[z.id]=z.opacity??1}),w.value=D,r("configs-loaded",C)}catch(k){const C=k instanceof Error?k.message:"Failed to load layer configurations";v.value=C,r("load-error",C)}finally{d.value=!1}}function Ee(k){let C=k.split("?")[0]||k;return C=C.replace(/\/query$/,""),C=C.replace(/\/$/,""),C.toLowerCase()}async function Oe(){if(n.fetchMetadata)try{const k="https://phl.carto.com/api/v2/sql?q="+encodeURIComponent("select url_text, COALESCE(representation, '') as representation from phl.knack_metadata_reps_endpoints_join WHERE ( format = 'API' OR format = 'GeoService' ) AND url_text IS NOT null"),C=await fetch(k);if(!C.ok)return;const D=await C.json(),z={};for(const W of D.rows||[])if(W.url_text&&W.representation){const Ue=Ee(W.url_text),l=`https://metadata.phila.gov/#home/representationdetails/${W.representation}/`;z[Ue]=l}b.value=z}catch{}}function De(k){m.value=k,r("zoom",k)}function fe(k){h.value.has(k)?h.value.delete(k):h.value.add(k),h.value=new Set(h.value)}function oe(k,C){C?h.value.add(k):h.value.delete(k),h.value=new Set(h.value)}function pe(k,C){for(const D of k)C?h.value.add(D):h.value.delete(D);h.value=new Set(h.value)}function ne(k,C){w.value={...w.value,[k]:C}}function Re(k,C){C?s.value.add(k):s.value.delete(k),s.value=new Set(s.value)}function q(k,C){if(C)g.value={...g.value,[k]:C};else{const{[k]:D,...z}=g.value;g.value=z}}function le(k){S.value=k}const j=e.ref(null),re=e.ref(null),Ze=e.ref(null),ie=e.ref(null),ke=e.ref(null),Le=e.ref(null),Be=e.ref(null),G=e.ref("map");function se(){G.value=G.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{G.value==="sidebar"&&j.value?.focus()})}const K=e.ref(!1);function xe(){K.value=!K.value,K.value&&e.nextTick(()=>{ie.value?.focus()})}function ce(){K.value=!1,e.nextTick(()=>{re.value?.focus()})}const A=e.ref(!1);function Ne(){A.value=!A.value}const Y=e.ref(!1),ae=e.ref(null);function ee(){ae.value=document.activeElement,Y.value=!0,e.nextTick(()=>{Be.value?.focus()})}function J(){Y.value=!1,e.nextTick(()=>{ae.value?.focus(),ae.value=null})}function Ae(k){k.target.classList.contains("layerboard-modal-backdrop")&&J()}function Q(k){if(k.key==="Escape"){ce();return}if(k.key==="Tab"&&ke.value){const C=Array.from(ke.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}function Ve(k){if(k.key==="Escape"){J();return}if(k.key==="Tab"&&Le.value){const C=Array.from(Le.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}e.provide("layerboard-open-modal",ee),e.provide("layerboard-close-modal",J),e.provide("layerboard-is-modal-open",e.readonly(Y)),a({layerList:i,visibleLayers:h,layerOpacities:w,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setLayerOpacity:ne,reloadConfigs:be,clearCache:()=>nt(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:f,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I,dataSourcesLoading:X,getDataSourceData:ue,refetchDataSource:de,isModalOpen:Y,openModal:ee,closeModal:J});function we(k){k.key==="Escape"&&K.value&&ce()}return e.onMounted(()=>{be(),Oe(),u(),document.addEventListener("keydown",we)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",we)}),(k,C)=>(e.openBlock(),e.createElementBlock("div",vo,[C[5]||(C[5]=e.createElementVNode("a",{href:"#main-content",class:"skip-to-main-content-link"},"Skip to main content",-1)),e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(Fe.value)},[C[1]||(C[1]=e.createElementVNode("a",{href:"https://www.phila.gov/",class:"layerboard-logo layerboard-desktop-only"},[e.createElementVNode("img",{src:"https://standards.phila.gov/img/logo/city-of-philadelphia-yellow-white.png",alt:"City of Philadelphia"})],-1)),C[2]||(C[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only","aria-hidden":"true"},null,-1)),e.createElementVNode("button",{ref_key:"hamburgerRef",ref:re,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":K.value,onClick:xe,"aria-label":"Toggle menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Tt),size:"medium",decorative:""},null,8,["icon-definition"])],8,bo),e.renderSlot(k.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",ko,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:ke,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor}),onKeydown:Q},[e.createElementVNode("div",Lo,[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:ie,class:"layerboard-mobile-menu-close",onClick:ce,"aria-label":"Close menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):e.createCommentVNode("",!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:ce})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",wo,[d.value?(e.openBlock(),e.createElementBlock("div",Co,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):v.value?(e.openBlock(),e.createElementBlock("div",So,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(v.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:be}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{ref_key:"sidebarRef",ref:j,id:"main-content",class:e.normalizeClass(["layerboard-sidebar",{"is-active":G.value==="sidebar"}]),style:e.normalizeStyle(Se.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(k.$slots,"sidebar",{layers:i.value,visibleLayers:h.value,layerOpacities:w.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setOpacity:ne,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:f.value,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I.value,dataSourcesLoading:X.value,getDataSource:ue,refetchDataSource:de},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(tt,{key:0,"layer-list":i.value,"visible-layers":h.value,"layer-opacities":w.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":b.value,onToggleLayer:fe,onSetOpacity:ne,onUpdateSearch:le},null,8,["layer-list","visible-layers","layer-opacities","loading-layers","layer-errors","current-zoom","search-query","layer-metadata"])):e.createCommentVNode("",!0)],!0)],6),e.createElementVNode("div",{role:"main","aria-label":"Map",class:e.normalizeClass(["layerboard-map",{"is-active":G.value==="map"}])},[e.createVNode(et,{"visible-layers":h.value,"layer-opacities":w.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":f.value,"cyclomedia-config":t.cyclomediaConfig,"pictometry-credentials":t.pictometryCredentials,"basemap-control-position":t.basemapControlPosition,"navigation-control-position":t.navigationControlPosition,"geolocation-control-position":t.geolocationControlPosition,"search-control-position":t.searchControlPosition,"draw-control-position":t.drawControlPosition,"cyclomedia-button-position":t.cyclomediaButtonPosition,"pictometry-button-position":t.pictometryButtonPosition,"initial-zoom":t.initialZoom,"initial-center":t.initialCenter,onZoom:De,onLayerLoading:Re,onLayerError:q},null,8,["visible-layers","layer-opacities","layer-list","tiled-layers","visible-tiled-layers","tiled-layer-opacities","cyclomedia-config","pictometry-credentials","basemap-control-position","navigation-control-position","geolocation-control-position","search-control-position","draw-control-position","cyclomedia-button-position","pictometry-button-position","initial-zoom","initial-center"])],2),e.createElementVNode("button",{class:e.normalizeClass(["layerboard-sidebar-toggle",{"is-collapsed":A.value}]),style:e.normalizeStyle({left:A.value?"0":n.sidebarWidth}),onClick:Ne,"aria-expanded":!A.value,"aria-label":A.value?"Expand sidebar":"Collapse sidebar"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":A.value?e.unref(_t):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],14,Eo)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:Ze,class:"layerboard-mobile-toggle",style:e.normalizeStyle(ve.value),onClick:se},[G.value==="map"?(e.openBlock(),e.createElementBlock("span",Bo,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",xo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Ie.value)},[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),Y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:Ae,onKeydown:Ve},[e.createElementVNode("div",{ref_key:"modalRef",ref:Le,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Be,class:"layerboard-modal-close",onClick:J,"aria-label":"Close modal"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(k.$slots,"modal",{closeModal:J},void 0,!0)],512)],32)):e.createCommentVNode("",!0),e.createElementVNode("span",No,e.toDisplayString(G.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),$o=he(Vo,[["__scopeId","data-v-458c0bb3"]]),Po=["aria-expanded"],_o={key:0,class:"topic-icon"},zo={class:"topic-title"},To=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{}},emits:["toggle","layerChange"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(o.expanded),i=`topic-panel-${e.useId()}`,d=`topic-header-${e.useId()}`;e.watch(()=>o.expanded,m=>{r.value=m});function v(){r.value=!r.value,n("toggle",r.value)}return(m,S)=>{const h=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{id:d,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,"aria-controls":i,onClick:v},[t.icon||m.$slots.icon?(e.openBlock(),e.createElementBlock("span",_o,[e.renderSlot(m.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:["fas",t.icon],"aria-hidden":"true"},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",zo,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":r.value}])},[...S[0]||(S[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,Po),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":d,class:"topic-content"},[e.renderSlot(m.$slots,"default",{},()=>[S[1]||(S[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),Mo=he(To,[["__scopeId","data-v-13853397"]]),Fo={class:"layer-checkbox-set",role:"group"},Io=["checked","disabled","onChange"],Oo={class:"layer-title"},Do={key:0,class:"loading-indicator",role:"status"},Ro=["aria-label"],Zo={key:2,class:"zoom-indicator"},Ao={class:"layer-title"},Uo={key:0,class:"loading-indicator",role:"status"},Wo=["aria-label"],qo={key:2,class:"zoom-indicator"},jo={key:2,class:"opacity-control"},Go=["for"],Ho=["id","value","aria-label","onInput"],Ko=["aria-label"],Jo={class:"legend-label"},Qo={key:0,class:"empty-state"},Xo=e.defineComponent({__name:"LayerCheckboxSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0}},emits:["toggleLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(y){return o.visibleLayerIds.has(y)}function i(y){return o.layerOpacities[y]??1}function d(y){return o.loadingLayerIds.has(y)}function v(y){return o.layerErrors[y]||null}function m(y){const f=o.currentZoom,u=y.minZoom,L=y.maxZoom;return!(u!==void 0&&f<u||L!==void 0&&f>L)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function h(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function w(y){return o.showLegend?y.displayOptions?.shouldShowLegendBox!==!1:!1}function s(y){return y.displayOptions?.layerNameChange||y.title}function g(y){n("toggleLayer",y)}function b(y,f){const u=f.target;n("setOpacity",y,parseFloat(u.value))}return(y,f)=>(e.openBlock(),e.createElementBlock("fieldset",Fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:"layer-item"},[S(u)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(u.id),disabled:!m(u),onChange:L=>g(u.id)},null,40,Io),e.createElementVNode("span",Oo,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Do," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Ro)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Zo," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("span",Ao,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Uo," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Wo)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",qo," (zoom in) "))])],2)),h(u)&&r(u.id)?(e.openBlock(),e.createElementBlock("div",jo,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+u.id}," Opacity: "+e.toDisplayString(Math.round(i(u.id)*100))+"% ",9,Go),e.createElementVNode("input",{id:"opacity-"+u.id,type:"range",min:"0",max:"1",step:"0.05",value:i(u.id),"aria-label":"Opacity for "+s(u),class:"opacity-slider",onInput:L=>b(u.id,L)},null,40,Ho)])):e.createCommentVNode("",!0),w(u)&&r(u.id)&&u.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:3,class:"layer-legend","aria-label":"Legend for "+s(u)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.legend,(L,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[L.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):L.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:L.color,height:`${L.width||2}px`}),"aria-hidden":"true"},null,4)):L.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Jo,e.toDisplayString(L.label),1)]))),128))],8,Ko)):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Qo," No layers available ")):e.createCommentVNode("",!0)]))}}),Yo=he(Xo,[["__scopeId","data-v-431c0f6d"]]),en={class:"layer-radio-set",role:"radiogroup"},tn=["name","checked","disabled","onChange"],on={class:"layer-title"},nn={key:0,class:"loading-indicator",role:"status"},ln=["aria-label"],an={key:2,class:"zoom-indicator"},rn={key:0,class:"opacity-control"},sn=["for"],cn=["id","value","aria-label","onInput"],un=["aria-label"],dn={class:"legend-label"},fn={key:0,class:"empty-state"},pn=e.defineComponent({__name:"LayerRadioButtonSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupName:{default:"layer-radio-group"}},emits:["selectLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(b){return o.visibleLayerIds.has(b)}function i(b){return o.layerOpacities[b]??1}function d(b){return o.loadingLayerIds.has(b)}function v(b){return o.layerErrors[b]||null}function m(b){const y=o.currentZoom,f=b.minZoom,u=b.maxZoom;return!(f!==void 0&&y<f||u!==void 0&&y>u)}function S(b){return o.showOpacity?b.displayOptions?.shouldShowSlider!==!1:!1}function h(b){return o.showLegend?b.displayOptions?.shouldShowLegendBox!==!1:!1}function w(b){return b.displayOptions?.layerNameChange||b.title}function s(b){const y=o.layers.filter(f=>o.visibleLayerIds.has(f.id)&&f.id!==b).map(f=>f.id);n("selectLayer",b,y)}function g(b,y){const f=y.target;n("setOpacity",b,parseFloat(f.value))}return(b,y)=>(e.openBlock(),e.createElementBlock("div",en,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(f),"layer-error":v(f.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(f.id),disabled:!m(f),onChange:u=>s(f.id)},null,40,tn),e.createElementVNode("span",on,[e.createTextVNode(e.toDisplayString(w(f))+" ",1),d(f.id)?(e.openBlock(),e.createElementBlock("span",nn," Loading... ")):e.createCommentVNode("",!0),v(f.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(f.id)||"Error",role:"status"}," Error ",8,ln)):e.createCommentVNode("",!0),m(f)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",an," (zoom in) "))])],2),S(f)&&r(f.id)?(e.openBlock(),e.createElementBlock("div",rn,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+f.id}," Opacity: "+e.toDisplayString(Math.round(i(f.id)*100))+"% ",9,sn),e.createElementVNode("input",{id:"opacity-"+f.id,type:"range",min:"0",max:"1",step:"0.05",value:i(f.id),"aria-label":"Opacity for "+w(f),class:"opacity-slider",onInput:u=>g(f.id,u)},null,40,cn)])):e.createCommentVNode("",!0),h(f)&&r(f.id)&&f.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:1,class:"layer-legend","aria-label":"Legend for "+w(f)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.legend,(u,L)=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"legend-item"},[u.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):u.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:u.color,height:`${u.width||2}px`}),"aria-hidden":"true"},null,4)):u.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",dn,e.toDisplayString(u.label),1)]))),128))],8,un)):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",fn," No layers available ")):e.createCommentVNode("",!0)]))}}),mn=he(pn,[["__scopeId","data-v-0de645b0"]]);function yn(t){const a=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),d=e.ref(""),v=e.ref(!1),m=e.ref(!1),S=e.ref(null),h=e.computed(()=>{if(!d.value.trim())return a.value;const N=d.value.toLowerCase();return a.value.filter(T=>T.title.toLowerCase().includes(N))}),w=e.computed(()=>a.value.map(N=>({config:N,component:N.type})));async function s(){if(!m.value){v.value=!0,S.value=null;try{let N;t.mode==="dynamic"||!t.mode?t.webMapId?N=await g(t.webMapId):N=await _e():N=await _e(),a.value=N;const T={};N.forEach(I=>{T[I.id]=I.opacity??1}),n.value=T,m.value=!0}catch(N){S.value=N instanceof Error?N:new Error("Failed to initialize layerboard")}finally{v.value=!1}}}async function g(N){const T=Me(N),I=await fetch(T);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const X=await I.json();return Ge(X)}function b(N){const T=new Set(o.value);T.has(N)?T.delete(N):T.add(N),o.value=T}function y(N,T){n.value={...n.value,[N]:Math.max(0,Math.min(1,T))}}function f(N){d.value=N}function u(N,T){const I=new Set(r.value);T?I.add(N):I.delete(N),r.value=I}function L(N,T){if(T)i.value={...i.value,[N]:T};else{const{[N]:I,...X}=i.value;i.value=X}}function V(){a.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},d.value="",v.value=!1,m.value=!1,S.value=null}return{layerConfigs:e.readonly(a),visibleLayers:e.readonly(o),layerOpacities:e.readonly(n),loadingLayers:e.readonly(r),layerErrors:e.readonly(i),searchQuery:e.readonly(d),isLoading:e.readonly(v),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:h,layerList:w,config:t,initialize:s,toggleLayer:b,setLayerOpacity:y,filterLayers:f,setLayerLoading:u,setLayerError:L,reset:V}}function gn(){const t=e.ref([]),a=e.ref(new Set),o=e.ref(new Set);function n(i){a.value.has(i)?a.value.delete(i):a.value.add(i)}function r(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>a.value),loadingLayerIds:e.computed(()=>o.value),toggleLayer:n,setLayers:r}}function at(t){const a=e.ref(null),o=e.ref(!1),n=e.ref(null),r=e.ref(0);async function i(m={}){o.value=!0,n.value=null;const S=t.pageSize||2e3;let h=0,w=[],s=!0;try{for(;s;){const b=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let f=`${b}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${h}&f=geojson`;if(m.bounds){const V=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});f+=`&geometry=${encodeURIComponent(V)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const u=await fetch(f);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);const L=await u.json();L.features&&L.features.length>0?(w=w.concat(L.features),h+=L.features.length,s=L.features.length===S):s=!1}const g={type:"FeatureCollection",features:w};return a.value=g,r.value=w.length,g}catch(g){const b=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=b,b}finally{o.value=!1}}function d(){a.value=null,r.value=0,n.value=null}async function v(m={}){return i(m)}return{data:e.readonly(a),isLoading:e.readonly(o),error:e.readonly(n),totalFeatures:e.readonly(r),config:t,fetch:i,refetch:v,clear:d}}function hn(t,a,o){const n=at(t);return e.watch(a,async r=>{if(r){const i=o(r);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=Yo;exports.LayerPanel=tt;exports.LayerRadioButtonSet=mn;exports.Layerboard=$o;exports.MapPanel=et;exports.TopicAccordion=Mo;exports.WEBMAP_ID=po;exports.buildWebMapUrl=Me;exports.clearCache=nt;exports.getLayerConfigs=_e;exports.getWebMapUrl=mo;exports.transformWebMapToLayerConfigs=Ge;exports.useApiDataSources=lt;exports.useDataSource=at;exports.useLayerConfig=gn;exports.useLayerboard=yn;exports.useReactiveDataSource=hn;