@phila/layerboard 3.0.0-beta.9 → 3.0.0
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/README.md +172 -44
- package/dist/components/LayerCheckboxSet.vue.d.ts +37 -0
- package/dist/components/LayerLegend.vue.d.ts +7 -0
- package/dist/components/LayerOpacitySlider.vue.d.ts +11 -0
- package/dist/components/LayerPanel.vue.d.ts +63 -0
- package/dist/components/LayerRadioButtonSet.vue.d.ts +40 -0
- package/dist/components/LayerStatusIndicators.vue.d.ts +7 -0
- package/dist/components/Layerboard.vue.d.ts +352 -0
- package/dist/components/MapPanel.vue.d.ts +52 -0
- package/dist/components/TopicAccordion.vue.d.ts +41 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/composables/index.d.ts +4 -0
- package/dist/composables/useApiDataSources.d.ts +38 -0
- package/dist/composables/useDataSource.d.ts +340 -0
- package/dist/composables/useLayerConfig.d.ts +50 -0
- package/dist/composables/useLayerState.d.ts +16 -0
- package/dist/composables/useLayerboard.d.ts +231 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +4619 -1876
- package/dist/layerboard.css +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/layerConfigService.d.ts +40 -0
- package/dist/types/config.d.ts +76 -0
- package/dist/types/dataSource.d.ts +40 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/layer.d.ts +133 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/layer-display.d.ts +20 -0
- package/dist/utils/url.d.ts +4 -0
- package/dist/utils/webmap-transformer.d.ts +231 -0
- package/package.json +16 -8
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),q=require("@phila/phila-ui-map-core"),U=require("@phila/phila-ui-core");var ue=typeof document<"u"?document.currentScript:null;function Se(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 Se({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 Se({type:"LineString",coordinates:t},l,o)}function it(t,l,o={}){return Se({type:"MultiLineString",coordinates:t},l,o)}function st(t,l,o={}){return Se({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=de(t[0],l),i=[],u,h,m;let S,b;for(o||(o=[]),u=1;u<n;u++){for(S=t[u-1],b=t[u],h=m=de(b,l);;)if(r|h){if(r&h)break;r?(S=Ie(S,b,r,l),r=de(S,l)):(b=Ie(S,b,h,l),h=de(b,l))}else{i.push(S),h!==m?(i.push(b),u<n-1&&(o.push(i),i=[])):u===n-1&&i.push(b);break}r=m}return i.length&&o.push(i),o}function dt(t,l){var o,n,r,i,u,h,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(de(r,l)&n),u=0;u<t.length;u++)h=t[u],m=!(de(h,l)&n),m!==i&&o.push(Ie(r,h,n,l)),m&&o.push(h),r=h,i=m;if(t=o,!t.length)break}return o}function Ie(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 de(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 u=[];return n==="LineString"&&(i=[i]),i.forEach(h=>{ut(h,l,u)}),u.length===1?rt(u[0],r):it(u,r)}case"Polygon":return at(We(i,l),r);case"MultiPolygon":return st(i.map(u=>We(u,l)),r);default:throw new Error("geometry "+n+" not supported")}}function We(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),u=e.ref(0);function h(a){n("zoom",a),i.value&&(u.value=m(i.value))}function m(a){const f=a.getZoom(),B=a.getCenter().lat,C=559082264028e-3,N=B*Math.PI/180;return C*Math.cos(N)/Math.pow(2,f)}const S=e.ref({}),b=e.ref(null),k=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(a,f,c,B){const C=encodeURIComponent(B||"1=1"),N=JSON.stringify({xmin:f.west,ymin:f.south,xmax:f.east,ymax:f.north,spatialReference:{wkid:4326}}),$=2e3;let F=0,M=[],A=!0;for(;A;){const O=`${a}/query?where=${C}&geometry=${encodeURIComponent(N)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${F}&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?(M=M.concat(D.features),F+=D.features.length,A=D.features.length===$):A=!1}if(s.includes(c)){const O=[f.west,f.south,f.east,f.north];M=M.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:M}}async function v(a,f){const c=f.map(async B=>{const C=o.layerList.find(N=>N.config.id===B)?.config;if(C){n("layerLoading",B,!0);try{const N=await g(C.url,a,B,C.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 f=[...o.visibleLayers];await v(a,f)}function p(a){b.value=a.bounds,y(a.bounds)}function d(a){i.value=a;const f=a.getBounds();b.value={west:f.getWest(),south:f.getSouth(),east:f.getEast(),north:f.getNorth()};const c=a.getZoom();n("zoom",c),u.value=m(a),y(b.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(j.value.length>0&&W(),b.value){const a=new Set(o.visibleLayers),f=[...a].filter(c=>!k.value.has(c));k.value=new Set(a),f.length>0&&await v(b.value,f)}});function L(a){return o.visibleLayers.has(a)}function x(a){return!!S.value[a.id]}const V=e.computed(()=>o.layerList.filter(a=>a.config.type==="circle"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),_=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),I=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&a.config.outlinePaint&&L(a.config.id)&&x(a.config)).map(a=>a.config)),J=e.computed(()=>o.layerList.filter(a=>a.config.type==="line"&&L(a.config.id)&&x(a.config)).map(a=>a.config));function le(a){return o.visibleTiledLayers?.has(a)??!1}function ae(a){return o.tiledLayerOpacities?.[a]??1}function Ne(a){return`${a.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ve(a){return{type:"raster",tiles:[Ne(a.url)],tileSize:256,attribution:a.attribution||""}}const me=e.ref({}),he=e.ref(new Set);async function ye(a){if(!he.value.has(a.id)){he.value.add(a.id);try{const f=a.url.replace(/\/$/,""),c=await fetch(`${f}?f=json`);if(!c.ok)return;const B=await c.json();let C=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),me.value={...me.value,[a.id]:{minScale:C,maxScale:N}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const a of o.tiledLayers)a.scaleBasedRendering&&ye(a)});function ve(a){if(!a.scaleBasedRendering)return"tiled";const f=me.value[a.id];if(!f)return"tiled";const c=u.value;return c===0||c>f.maxScale?"tiled":"dynamic"}const xe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)?a.scaleBasedRendering?ve(a)==="tiled":!0:!1):[]),$e=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)&&a.scaleBasedRendering?ve(a)==="dynamic":!1):[]);function re(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 K(a){return{type:"geojson",data:S.value[a.id]}}function ie(a){return o.layerOpacities[a]??1}function X(a){const f=ie(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",C={...a.paint},N=C[B],$=C[c]===1,F=typeof N=="string"&&N.startsWith("rgba(");if($&&F){if(f===1)return C;{const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M&&M[4]){const[,A,O,z,D]=M,Te=parseFloat(D)*f;C[B]=`rgba(${A}, ${O}, ${z}, ${Te})`,C[c]=1}return C}}if(F){const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M){const[,A,O,z]=M;C[B]=`rgb(${A}, ${O}, ${z})`}}return C[c]=f,C}function Pe(a){const f=ie(a.id);return{...a.outlinePaint,"line-opacity":f}}const j=e.ref([]),Y=e.ref(null),R=e.ref(0);function se(a){const f=a.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===f)?.config}function oe(a,f){return a.replace(/\{([^}]+)\}/g,(c,B)=>{const C=f[B];return C==null?"":String(C)})}function ze(a,f){if(a==null)return"-";if(f?.dateFormat&&typeof a=="number"){const c=new Date(a);switch(f.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&&!f)return new Date(a).toLocaleDateString();const c=f?.places,B=f?.digitSeparator??!0;if(c!==void 0){const C=a.toFixed(c);if(B){const N=C.split("."),$=N[0]||"0",F=N[1],M=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return F?`${M}.${F}`:M}return C}return B?a.toLocaleString():String(a)}return String(a)}function be(a){const f=new Set;return a.filter(c=>{const C=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return f.has(C)?!1:(f.add(C),!0)})}function ee(a,f){const c=new Map;return f.forEach((B,C)=>{c.set(B.id,C)}),a.sort((B,C)=>{const N=B.layer.id.replace(/-outline$/,""),$=C.layer.id.replace(/-outline$/,""),F=c.get(N)??-1;return(c.get($)??-1)-F})}function ce(a){const f=i.value;if(!f)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=f.project([a.lngLat.lng,a.lngLat.lat]),C=f.queryRenderedFeatures(B,{layers:c});if(C.length===0)return;const N=be(C),$=o.layerList.map(O=>O.config),F=ee(N,$),M=F.map(O=>{const z=O.layer.id.replace(/-outline$/,""),D=se(z);return D?{layerId:D.id,layerTitle:D.title,properties:O.properties||{},popupConfig:D.popup}:null}).filter(O=>O!==null);if(M.length===0)return;j.value=M,R.value=0,Y.value=[a.lngLat.lng,a.lngLat.lat];const A=F[0];if(A&&A.geometry){const O=A.layer.id.replace(/-outline$/,""),z=se(O);if(z){const D=Re(A.geometry),Te=Ze(z.id,z.type);te.value={geometry:A.geometry,geometryType:D,layerId:z.id,properties:A.properties||{},originalStyle:Te}}}}function W(){j.value=[],Y.value=null,R.value=0,te.value=null}function ne(a){if(j.value.length===0)return;const f=a.target;if(!(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.isContentEditable))switch(a.key){case"ArrowLeft":case"ArrowUp":a.preventDefault(),ke();break;case"ArrowRight":case"ArrowDown":a.preventDefault(),G();break;case"Escape":a.preventDefault(),W();break}}e.onMounted(()=>{window.addEventListener("keydown",ne)}),e.onUnmounted(()=>{window.removeEventListener("keydown",ne)});function G(){const a=j.value.length;a<=1||(R.value=(R.value+1)%a)}function ke(){const a=j.value.length;a<=1||(R.value=(R.value-1+a)%a)}const w=e.computed(()=>j.value.length===0?null:j.value[R.value]),E=e.computed(()=>{const a=w.value;return!a||!a.popupConfig?a?.layerTitle||"":oe(a.popupConfig.title,a.properties)}),H=e.computed(()=>{const a=w.value;if(!a)return"";let f='<div class="popup-content">';if(f+=`<h3 class="popup-title">${E.value}</h3>`,a.popupConfig?.fields?.length){f+='<table class="popup-table">';for(const c of a.popupConfig.fields){const B=ze(a.properties[c.field],c.format);f+=`<tr><th>${c.label}</th><td>${B}</td></tr>`}f+="</table>"}else f+='<p class="popup-no-fields">No additional information available.</p>';return f+="</div>",f}),T=e.ref({type:"FeatureCollection",features:[]}),Z=e.ref({type:"FeatureCollection",features:[]}),_e={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Fe={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},te=e.ref(null);function Re(a){return a.type}function Ze(a,f){const c=se(a);if(!c)return{radius:5,width:2};const B=c.paint||{};if(f==="circle"){const C=B["circle-radius"];return typeof C=="number"?{radius:C}:{radius:5}}if(f==="line"||f==="fill"){const C=B["line-width"];if(typeof C=="number")return{width:C};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 Ue(a){return!a||a.length===0?[]:a[0]??[]}function tt(a){const{geometry:f,geometryType:c,originalStyle:B}=a;if(c==="Point"||c==="MultiPoint"){const N=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightRadius:N}}]}}if(c==="LineString"||c==="MultiLineString"){const N=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightWidth:N}}]}}if(c==="Polygon"){const C=f.coordinates,N=Ue(C),F=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:N},properties:{highlightWidth:F}}]}}if(c==="MultiPolygon"){const C=f.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:C.map(M=>({type:"Feature",geometry:{type:"LineString",coordinates:Ue(M)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function ot(a){if(!a){nt();return}const f=tt(a);a.geometryType==="Point"||a.geometryType==="MultiPoint"?(T.value=f,Z.value={type:"FeatureCollection",features:[]}):(Z.value=f,T.value={type:"FeatureCollection",features:[]})}function nt(){T.value={type:"FeatureCollection",features:[]},Z.value={type:"FeatureCollection",features:[]}}e.watch(te,a=>{ot(a)}),e.watch(()=>o.visibleLayers,a=>{te.value&&!a.has(te.value.layerId)&&(te.value=null,W())},{deep:!0}),e.watch(R,()=>{const a=w.value;if(!a){te.value=null;return}const f=i.value;if(!f||!Y.value)return;const c=[];o.layerList.forEach($=>{const F=$.config;o.visibleLayers.has(F.id)&&(c.push(F.id),F.outlinePaint&&c.push(`${F.id}-outline`))});const B=f.project(Y.value),N=f.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===a.layerId&&JSON.stringify($.properties)===JSON.stringify(a.properties));if(N&&N.geometry){const $=se(a.layerId);if($){const F=Re(N.geometry),M=Ze($.id,$.type);te.value={geometry:N.geometry,geometryType:F,layerId:$.id,properties:N.properties||{},originalStyle:M}}}});const Ae=e.ref(null);function lt(a){const[f,c]=a.geometry.coordinates;Ae.value=[f,c]}return(a,f)=>(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(q.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:h,onClick:W,onMoveend:p,onLoad:d,onSearchResult:lt},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(q.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(xe.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ve(c),paint:{"raster-opacity":ae(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($e.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:re(c),paint:{"raster-opacity":ae(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(V.value,c=>(e.openBlock(),e.createBlock(e.unref(q.CircleLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},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(q.FillLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},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(q.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:K(c),paint:Pe(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,c=>(e.openBlock(),e.createBlock(e.unref(q.LineLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(q.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:T.value},paint:_e},null,8,["source"]),e.createVNode(e.unref(q.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:Z.value},paint:Fe},null,8,["source"]),e.createVNode(e.unref(q.MapMarker),{"lng-lat":Ae.value,color:"#2176d2"},null,8,["lng-lat"]),w.value&&Y.value?(e.openBlock(),e.createBlock(e.unref(q.MapPopup),{key:1,"lng-lat":Y.value,html:H.value,"close-on-click":!1,"show-navigation":j.value.length>1,"current-feature-index":R.value,"total-features":j.value.length,"layer-name":w.value.layerTitle,onClose:W,onNext:G,onPrevious:ke},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"])]))}}),pe=(t,l)=>{const o=t.__vccOpts||t;for(const[n,r]of l)o[n]=r;return o},Je=pe(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=u=>"href"in u&&u.href!==void 0||"to"in u&&u.to!==void 0,n=e.computed(()=>U.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(u,h)=>o(l)?(e.openBlock(),e.createBlock(e.unref(U.BaseLink),e.mergeProps({key:0},{...r.value,...u.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$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},u.$attrs),[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$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"},Bt={class:"input-text-container"},Et=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},xt=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"),u=l,h=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:h.value,set:g=>{u("update:modelValue",g),h.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"),U.cn(...g)}),b=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),U.cn(...g)}),k=e.ref(null),s=g=>{g.target.closest("button")||k.value?.focus()};return(g,v)=>(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",b.value]),onClick:s},[e.createElementVNode("div",Ct,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(U.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:k,"onUpdate:modelValue":v[0]||(v[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,Et),[[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:v[1]||(v[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(U.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(U.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"]},Ft={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 Tt={class:"layer-panel"},Mt={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"],Ut={class:"layer-title"},At={key:0,class:"loading-indicator"},Wt=["title"],jt={key:2,class:"zoom-indicator"},qt={key:0,class:"opacity-control"},Gt={class:"opacity-label"},Ht=["value","onInput"],Jt={key:1,class:"layer-legend"},Qt={class:"legend-label"},Kt={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 p=o.searchQuery.toLowerCase();return o.layerList.filter(d=>d.config.title.toLowerCase().includes(p))});function i(p){let d=p.split("?")[0]||p;return d=d.replace(/\/query$/,""),d=d.replace(/\/$/,""),d.toLowerCase()}function u(p){const d=i(p);return o.layerMetadata[d]||null}const h=e.computed(()=>o.layerList.some(p=>u(p.config.url)));function m(p){return o.visibleLayers.has(p)}function S(p){return o.layerOpacities[p]??1}function b(p){return o.loadingLayers.has(p)}function k(p){return o.layerErrors[p]||null}function s(p){const d=o.currentZoom,L=p.minZoom,x=p.maxZoom;return!(L!==void 0&&d<L||x!==void 0&&d>x)}const g=e.computed({get:()=>o.searchQuery,set:p=>n("updateSearch",p)});function v(p){n("toggleLayer",p)}function y(p,d){const L=d.target,x=parseFloat(L.value);n("setOpacity",p,x)}return(p,d)=>(e.openBlock(),e.createElementBlock("aside",Tt,[t.showSearch?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(xt),{modelValue:g.value,"onUpdate:modelValue":d[0]||(d[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(U.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(p.$slots,"topics",{},()=>[d[2]||(d[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":h.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",Ot,[u(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:u(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link",title:"View metadata",onClick:d[1]||(d[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(Ft),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Dt)):h.value?(e.openBlock(),e.createElementBlock("span",Rt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":k(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:x=>v(L.config.id)},null,40,Zt),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),b(L.config.id)?(e.openBlock(),e.createElementBlock("span",At," Loading... ")):e.createCommentVNode("",!0),k(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:k(L.config.id)||""}," Error ",8,Wt)):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",qt,[e.createElementVNode("label",Gt," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),class:"opacity-slider",onInput:x=>y(L.config.id,x)},null,40,Ht)])):e.createCommentVNode("",!0),t.showLegend&&m(L.config.id)&&L.config.legend?.length?(e.openBlock(),e.createElementBlock("ul",Jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.config.legend,(x,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[x.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):x.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:x.color,height:`${x.width||2}px`})},null,4)):x.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(x.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Kt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),Qe=pe(Xt,[["__scopeId","data-v-d2e878e2"]]);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 Q(t){return t!==void 0?t:1}const Yt=559082264;function qe(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=qe(t);n!==null&&(o.minZoom=n)}if(l&&l>0){const n=qe(l);n!==null&&(o.maxZoom=n)}return o}function Be(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 fe(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function Me(t){return String(t)}function Ke(t,l,o){const n=t.symbol,r=Be(n);let i={},u=[],h=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),b=m===0?0:m<255?1:Q(l);if(i={"fill-color":S,"fill-opacity":b},fe(n.outline)){const k=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(k>1||m===0)&&(h={"line-color":s,"line-width":k})}u=[{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":Q(l)},u=[{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":Q(l)},fe(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),u=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:u,geomType:r,outlinePaint:h}}function to(t,l,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return Ke({...t,symbol:i},l);const u=r[0]?.symbol||i,h=Be(u);let m={},S=[],b=null;if(h==="fill"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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(k.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":k,"fill-opacity":Q(l)},fe(u?.outline)){const s=u.outline.width||1,g=P(u.outline.color);m["fill-outline-color"]=g,s>1&&(b={"line-color":g,"line-width":s})}}else if(h==="line"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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})}k.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":k,"line-width":u?.width||2,"line-opacity":Q(l)}}else if(h==="circle"){const k=["match",["to-string",["get",n]]];for(const g of r){k.push(Me(g.value)),k.push(P(g.symbol?.color));const v=String(g.value),p=o?.get(v)||g.label||v;S.push({type:"circle",color:P(g.symbol?.color),label:p})}k.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((u?.size||6)*.71*100)/100;m={"circle-color":k,"circle-radius":s,"circle-opacity":Q(l)},fe(u?.outline)&&(m["circle-stroke-color"]=P(u.outline.color),m["circle-stroke-width"]=u.outline.width||1)}return{paint:m,legend:S,geomType:h,outlinePaint:b}}function oo(t,l){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(b=>b.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,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));for(let k=0;k<n.length;k++){const s=n[k];k>0&&(b.push(n[k-1].classMaxValue),b.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(h={"fill-color":b,"fill-opacity":Q(l)},fe(i?.outline)){const k=i.outline.width||1,s=P(i.outline.color);h["fill-outline-color"]=s,k>1&&(S={"line-color":s,"line-width":k})}}else if(u==="line"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));let k=t.minValue??0;for(let g=0;g<n.length;g++){const v=n[g];g>0&&(b.push(n[g-1].classMaxValue),b.push(P(v.symbol?.color))),m.push({type:"line",color:P(v.symbol?.color),width:v.symbol?.width||i?.width||2,label:v.label||`${k} - ${v.classMaxValue}`}),k=v.classMaxValue+1}const s=i?.width||2;h={"line-color":b,"line-width":s,"line-opacity":Q(l)}}return{paint:h,legend:m,geomType:u,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,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["interpolate",["linear"],["get",l]];for(const s of r)b.push(s.value),b.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(h={"fill-color":["case",["==",["get",l],null],"rgba(0, 0, 0, 0)",b],"fill-opacity":Q(n)},fe(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);h["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:h,legend:m,geomType:u,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 Ke(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[,u,h]=i;u&&h&&l.set(u,h.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 Oe(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,u;const h=!i||!i.renderer,m=n.includes(r.title);if((h||m)&&r.url){const V=await uo(r.url);V&&(i=V.drawingInfo,V.description&&(u=co(V.description),u.size>0))}const{paint:S,legend:b,geomType:k,outlinePaint:s}=lo(i,r.opacity,u,r.title),g=ao(r.popupInfo),v=ro(r.layerDefinition),y=eo(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),p=io(r.title),d=so(r.title);let L=r.opacity??1;const x={id:p,title:d,type:k,url:r.url,opacity:L,paint:S,legend:b,popup:g};v&&(x.where=v),y.minZoom!==void 0&&(x.minZoom=y.minZoom),y.maxZoom!==void 0&&(x.maxZoom=y.maxZoom),s&&(x.outlinePaint=s),o.push(x)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Ge={},De="376af635c84643cd816a8c5d017a53aa",fo=De;function Ee(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 Ee(De)}const we=new Map,ge=new Map;function Xe(t){t?(we.delete(t),ge.delete(t)):(we.clear(),ge.clear())}let Le,He=0;async function mo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ue&&ue.tagName.toUpperCase()==="SCRIPT"&&ue.src||new URL("index.js",document.baseURI).href}<"u"&&Ge?.VITE_AGO_USERNAME,l=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ue&&ue.tagName.toUpperCase()==="SCRIPT"&&ue.src||new URL("index.js",document.baseURI).href}<"u"&&Ge?.VITE_AGO_PASSWORD;if(!(!t||!l)){if(Le&&Date.now()<He-3e5)return Le;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:(Le=n.token,He=n.expires,Le)}catch{return}}}async function yo(t,l){const o=Ee(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 Oe(o)}catch(l){throw new Error(`Failed to load dynamic layer configs: ${l instanceof Error?l.message:"Unknown error"}`)}}async function Ce(t=De){const l=we.get(t);if(l)return l;const o=ge.get(t);if(o)return o;const n=(async()=>{try{const r=await go(t);return we.set(t,r),r}finally{ge.delete(t)}})();return ge.set(t,n),n}function Ye(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 v;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}`);v=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}`);v=await y.json()}else if(s.type==="esri"){const p=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,d=await fetch(p,s.options);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);v=(await d.json()).features?.map(x=>x.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(v=s.transform(v)),l.value={...l.value,[g]:{data:v,loading:!1,error:null,lastFetched:Date.now()}}}catch(v){const y=v instanceof Error?v.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(v=>v.id===s);g&&await n(g)}function u(s){return l.value[s]?.data??null}const h=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 b(){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 k(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),b()}),e.onUnmounted(()=>{k()}),{state:e.readonly(l),isLoading:h,fetchAll:r,refetch:i,getData:u,isSourceLoading:m,getError:S,stopPolling:k}}const ho={class:"layerboard-layout"},vo={key:0,class:"layerboard-subtitle"},bo={class:"layerboard-mobile-menu-content"},ko={class:"layerboard-main"},Lo={key:0,class:"layerboard-loading"},wo={key:1,class:"layerboard-error"},Co={key:0},So={key:1},Bo={class:"layerboard-modal"},Eo=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([]),u=e.ref(!0),h=e.ref(null),m=e.ref(12),S=e.ref(""),b=e.ref(new Set),k=e.ref({}),s=e.ref(new Set),g=e.ref({}),v=e.ref({}),y=e.ref(new Set),p=e.ref({});function d(){const w={};for(const E of n.tiledLayers)w[E.id]=E.opacity??1;p.value=w}function L(w){y.value.has(w)?y.value.delete(w):y.value.add(w),y.value=new Set(y.value)}function x(w,E){E?y.value.add(w):y.value.delete(w),y.value=new Set(y.value)}function V(w,E){p.value={...p.value,[w]:E}}const _=n.dataSources.length>0?Ye(n.dataSources):null,I=e.computed(()=>_?.state.value??{}),J=e.computed(()=>_?.isLoading.value??!1);function le(w){return _?.getData(w)??null}function ae(w){return _?.refetch(w)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",b),e.provide("layerboard-opacities",k),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",re),e.provide("layerboard-set-layer-visible",K),e.provide("layerboard-set-layers-visible",ie),e.provide("layerboard-set-opacity",X),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",p),e.provide("layerboard-toggle-tiled",L),e.provide("layerboard-set-tiled-opacity",V),e.provide("layerboard-set-tiled-visible",x),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",J),e.provide("layerboard-get-data-source",le),e.provide("layerboard-refetch-data-source",ae);const Ne=e.computed(()=>({backgroundColor:n.themeColor})),Ve=e.computed(()=>({backgroundColor:n.themeColor})),me=e.computed(()=>({backgroundColor:n.themeColor})),he=e.computed(()=>({width:ee.value?"0":n.sidebarWidth}));async function ye(){try{u.value=!0,h.value=null;const E=(await Ce(n.webMapId)).map(T=>{const Z=n.layerStyleOverrides[T.id];return Z?{...T,paint:Z.paint??T.paint,outlinePaint:Z.outlinePaint??T.outlinePaint,legend:Z.legend??T.legend,type:Z.type??T.type}:T});i.value=E.map(T=>({config:T,component:T.type}));const H={};E.forEach(T=>{H[T.id]=T.opacity??1}),k.value=H,r("configs-loaded",E)}catch(w){const E=w instanceof Error?w.message:"Failed to load layer configurations";h.value=E,r("load-error",E)}finally{u.value=!1}}function ve(w){let E=w.split("?")[0]||w;return E=E.replace(/\/query$/,""),E=E.replace(/\/$/,""),E.toLowerCase()}async function xe(){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"),E=await fetch(w);if(!E.ok)return;const H=await E.json(),T={};for(const Z of H.rows||[])if(Z.url_text&&Z.representation){const _e=ve(Z.url_text),Fe=`https://metadata.phila.gov/#home/representationdetails/${Z.representation}/`;T[_e]=Fe}v.value=T}catch{}}function $e(w){m.value=w,r("zoom",w)}function re(w){b.value.has(w)?b.value.delete(w):b.value.add(w),b.value=new Set(b.value)}function K(w,E){E?b.value.add(w):b.value.delete(w),b.value=new Set(b.value)}function ie(w,E){for(const H of w)E?b.value.add(H):b.value.delete(H);b.value=new Set(b.value)}function X(w,E){k.value={...k.value,[w]:E}}function Pe(w,E){E?s.value.add(w):s.value.delete(w),s.value=new Set(s.value)}function j(w,E){if(E)g.value={...g.value,[w]:E};else{const{[w]:H,...T}=g.value;g.value=T}}function Y(w){S.value=w}const R=e.ref("map");function se(){R.value=R.value==="sidebar"?"map":"sidebar"}const oe=e.ref(!1);function ze(){oe.value=!oe.value}function be(){oe.value=!1}const ee=e.ref(!1);function ce(){ee.value=!ee.value}const W=e.ref(!1);function ne(){W.value=!0}function G(){W.value=!1}function ke(w){w.target.classList.contains("layerboard-modal-backdrop")&&G()}return e.provide("layerboard-open-modal",ne),e.provide("layerboard-close-modal",G),e.provide("layerboard-is-modal-open",e.readonly(W)),l({layerList:i,visibleLayers:b,layerOpacities:k,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:re,setLayerVisible:K,setLayersVisible:ie,setLayerOpacity:X,reloadConfigs:ye,clearCache:()=>Xe(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:p,toggleTiledLayer:L,setTiledLayerVisible:x,setTiledLayerOpacity:V,dataSourcesState:I,dataSourcesLoading:J,getDataSourceData:le,refetchDataSource:ae,isModalOpen:W,openModal:ne,closeModal:G}),e.onMounted(()=>{ye(),xe(),d()}),(w,E)=>(e.openBlock(),e.createElementBlock("div",ho,[e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(Ne.value)},[E[1]||(E[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)),E[2]||(E[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only"},null,-1)),e.createElementVNode("button",{class:"layerboard-hamburger layerboard-mobile-only",onClick:ze,"aria-label":"Toggle menu"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(_t),size:"medium",decorative:""},null,8,["icon-definition"])]),e.renderSlot(w.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),oe.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor})},[e.createElementVNode("div",bo,[e.renderSlot(w.$slots,"footer",{openModal:ne,closeModal:G,isModalOpen:W.value},()=>[E[0]||(E[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{class:"layerboard-mobile-menu-close",onClick:be,"aria-label":"Close menu"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(je),size:"medium",decorative:""},null,8,["icon-definition"])])],4)):e.createCommentVNode("",!0),oe.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:be})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",ko,[u.value?(e.openBlock(),e.createElementBlock("div",Lo,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):h.value?(e.openBlock(),e.createElementBlock("div",wo,[E[3]||(E[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(h.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:ye}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{class:e.normalizeClass(["layerboard-sidebar",{"is-active":R.value==="sidebar"}]),style:e.normalizeStyle(he.value)},[e.renderSlot(w.$slots,"sidebar",{layers:i.value,visibleLayers:b.value,layerOpacities:k.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:re,setLayerVisible:K,setLayersVisible:ie,setOpacity:X,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:p.value,toggleTiledLayer:L,setTiledLayerVisible:x,setTiledLayerOpacity:V,dataSourcesState:I.value,dataSourcesLoading:J.value,getDataSource:le,refetchDataSource:ae},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(Qe,{key:0,"layer-list":i.value,"visible-layers":b.value,"layer-opacities":k.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":v.value,onToggleLayer:re,onSetOpacity:X,onUpdateSearch:Y},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",{class:e.normalizeClass(["layerboard-map",{"is-active":R.value==="map"}])},[e.createVNode(Je,{"visible-layers":b.value,"layer-opacities":k.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":p.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:$e,onLayerLoading:Pe,onLayerError:j},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":ee.value}]),style:e.normalizeStyle({left:ee.value?"0":n.sidebarWidth}),onClick:ce,"aria-label":"Toggle sidebar"},[e.createVNode(e.unref(U.Icon),{"icon-definition":ee.value?e.unref(Pt):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],6)],64))]),e.createElementVNode("button",{class:"layerboard-mobile-toggle",style:e.normalizeStyle(me.value),onClick:se},[R.value==="map"?(e.openBlock(),e.createElementBlock("span",Co,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Ve.value)},[e.renderSlot(w.$slots,"footer",{openModal:ne,closeModal:G,isModalOpen:W.value},()=>[E[4]||(E[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),W.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:ke},[e.createElementVNode("div",Bo,[e.createElementVNode("button",{class:"layerboard-modal-close",onClick:G,"aria-label":"Close modal"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(je),size:"medium",decorative:""},null,8,["icon-definition"])]),e.renderSlot(w.$slots,"modal",{closeModal:G},void 0,!0)])])):e.createCommentVNode("",!0)]))}}),No=pe(Eo,[["__scopeId","data-v-dac16679"]]),Vo=["aria-expanded"],xo={key:0,class:"topic-icon"},$o={class:"topic-title"},Po={class:"topic-content"},zo=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);e.watch(()=>o.expanded,u=>{r.value=u});function i(){r.value=!r.value,n("toggle",r.value)}return(u,h)=>{const m=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,onClick:i},[t.icon||u.$slots.icon?(e.openBlock(),e.createElementBlock("span",xo,[e.renderSlot(u.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(m,{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}])},[...h[0]||(h[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"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,Vo),e.withDirectives(e.createElementVNode("div",Po,[e.renderSlot(u.$slots,"default",{},()=>[h[1]||(h[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),_o=pe(zo,[["__scopeId","data-v-fb48c75b"]]),Fo={class:"layer-checkbox-set"},To=["checked","disabled","onChange"],Mo={class:"layer-title"},Io={key:0,class:"loading-indicator"},Oo=["title"],Do={key:2,class:"zoom-indicator"},Ro={class:"layer-title"},Zo={key:0,class:"loading-indicator"},Uo=["title"],Ao={key:2,class:"zoom-indicator"},Wo={key:2,class:"opacity-control"},jo={class:"opacity-label"},qo=["value","onInput"],Go={key:3,class:"layer-legend"},Ho={class:"legend-label"},Jo={key:0,class:"empty-state"},Qo=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 u(y){return o.loadingLayerIds.has(y)}function h(y){return o.layerErrors[y]||null}function m(y){const p=o.currentZoom,d=y.minZoom,L=y.maxZoom;return!(d!==void 0&&p<d||L!==void 0&&p>L)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function b(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function k(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 v(y,p){const d=p.target;n("setOpacity",y,parseFloat(d.value))}return(y,p)=>(e.openBlock(),e.createElementBlock("div",Fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,d=>(e.openBlock(),e.createElementBlock("div",{key:d.id,class:"layer-item"},[S(d)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(d),"layer-error":h(d.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(d.id),disabled:!m(d),onChange:L=>g(d.id)},null,40,To),e.createElementVNode("span",Mo,[e.createTextVNode(e.toDisplayString(s(d))+" ",1),u(d.id)?(e.openBlock(),e.createElementBlock("span",Io," Loading... ")):e.createCommentVNode("",!0),h(d.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(d.id)||""}," Error ",8,Oo)):e.createCommentVNode("",!0),m(d)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Do," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(d),"layer-error":h(d.id)}])},[e.createElementVNode("span",Ro,[e.createTextVNode(e.toDisplayString(s(d))+" ",1),u(d.id)?(e.openBlock(),e.createElementBlock("span",Zo," Loading... ")):e.createCommentVNode("",!0),h(d.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(d.id)||""}," Error ",8,Uo)):e.createCommentVNode("",!0),m(d)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ao," (zoom in) "))])],2)),b(d)&&r(d.id)?(e.openBlock(),e.createElementBlock("div",Wo,[e.createElementVNode("label",jo," Opacity: "+e.toDisplayString(Math.round(i(d.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:i(d.id),class:"opacity-slider",onInput:L=>v(d.id,L)},null,40,qo)])):e.createCommentVNode("",!0),k(d)&&r(d.id)&&d.legend?.length?(e.openBlock(),e.createElementBlock("ul",Go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.legend,(L,x)=>(e.openBlock(),e.createElementBlock("li",{key:x,class:"legend-item"},[L.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:L.color})},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`})},null,4)):L.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:L.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Ho,e.toDisplayString(L.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Jo," No layers available ")):e.createCommentVNode("",!0)]))}}),Ko=pe(Qo,[["__scopeId","data-v-cc5e50fd"]]),Xo={class:"layer-radio-set"},Yo=["name","checked","disabled","onChange"],en={class:"layer-title"},tn={key:0,class:"loading-indicator"},on=["title"],nn={key:2,class:"zoom-indicator"},ln={key:0,class:"opacity-control"},an={class:"opacity-label"},rn=["value","onInput"],sn={key:1,class:"layer-legend"},cn={class:"legend-label"},un={key:0,class:"empty-state"},dn=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(v){return o.visibleLayerIds.has(v)}function i(v){return o.layerOpacities[v]??1}function u(v){return o.loadingLayerIds.has(v)}function h(v){return o.layerErrors[v]||null}function m(v){const y=o.currentZoom,p=v.minZoom,d=v.maxZoom;return!(p!==void 0&&y<p||d!==void 0&&y>d)}function S(v){return o.showOpacity?v.displayOptions?.shouldShowSlider!==!1:!1}function b(v){return o.showLegend?v.displayOptions?.shouldShowLegendBox!==!1:!1}function k(v){return v.displayOptions?.layerNameChange||v.title}function s(v){const y=o.layers.filter(p=>o.visibleLayerIds.has(p.id)&&p.id!==v).map(p=>p.id);n("selectLayer",v,y)}function g(v,y){const p=y.target;n("setOpacity",v,parseFloat(p.value))}return(v,y)=>(e.openBlock(),e.createElementBlock("div",Xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,p=>(e.openBlock(),e.createElementBlock("div",{key:p.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(p),"layer-error":h(p.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(p.id),disabled:!m(p),onChange:d=>s(p.id)},null,40,Yo),e.createElementVNode("span",en,[e.createTextVNode(e.toDisplayString(k(p))+" ",1),u(p.id)?(e.openBlock(),e.createElementBlock("span",tn," Loading... ")):e.createCommentVNode("",!0),h(p.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(p.id)||""}," Error ",8,on)):e.createCommentVNode("",!0),m(p)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",nn," (zoom in) "))])],2),S(p)&&r(p.id)?(e.openBlock(),e.createElementBlock("div",ln,[e.createElementVNode("label",an," Opacity: "+e.toDisplayString(Math.round(i(p.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:i(p.id),class:"opacity-slider",onInput:d=>g(p.id,d)},null,40,rn)])):e.createCommentVNode("",!0),b(p)&&r(p.id)&&p.legend?.length?(e.openBlock(),e.createElementBlock("ul",sn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.legend,(d,L)=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"legend-item"},[d.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):d.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:d.color,height:`${d.width||2}px`})},null,4)):d.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",cn,e.toDisplayString(d.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",un," No layers available ")):e.createCommentVNode("",!0)]))}}),fn=pe(dn,[["__scopeId","data-v-c0e5f6f1"]]);function pn(t){const l=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),u=e.ref(""),h=e.ref(!1),m=e.ref(!1),S=e.ref(null),b=e.computed(()=>{if(!u.value.trim())return l.value;const V=u.value.toLowerCase();return l.value.filter(_=>_.title.toLowerCase().includes(V))}),k=e.computed(()=>l.value.map(V=>({config:V,component:V.type})));async function s(){if(!m.value){h.value=!0,S.value=null;try{let V;t.mode==="dynamic"||!t.mode?t.webMapId?V=await g(t.webMapId):V=await Ce():V=await Ce(),l.value=V;const _={};V.forEach(I=>{_[I.id]=I.opacity??1}),n.value=_,m.value=!0}catch(V){S.value=V instanceof Error?V:new Error("Failed to initialize layerboard")}finally{h.value=!1}}}async function g(V){const _=Ee(V),I=await fetch(_);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const J=await I.json();return Oe(J)}function v(V){const _=new Set(o.value);_.has(V)?_.delete(V):_.add(V),o.value=_}function y(V,_){n.value={...n.value,[V]:Math.max(0,Math.min(1,_))}}function p(V){u.value=V}function d(V,_){const I=new Set(r.value);_?I.add(V):I.delete(V),r.value=I}function L(V,_){if(_)i.value={...i.value,[V]:_};else{const{[V]:I,...J}=i.value;i.value=J}}function x(){l.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},u.value="",h.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(u),isLoading:e.readonly(h),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:b,layerList:k,config:t,initialize:s,toggleLayer:v,setLayerOpacity:y,filterLayers:p,setLayerLoading:d,setLayerError:L,reset:x}}function mn(){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 et(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 b=0,k=[],s=!0;try{for(;s;){const v=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let p=`${v}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${b}&f=geojson`;if(m.bounds){const x=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});p+=`&geometry=${encodeURIComponent(x)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const d=await fetch(p);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const L=await d.json();L.features&&L.features.length>0?(k=k.concat(L.features),b+=L.features.length,s=L.features.length===S):s=!1}const g={type:"FeatureCollection",features:k};return l.value=g,r.value=k.length,g}catch(g){const v=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=v,v}finally{o.value=!1}}function u(){l.value=null,r.value=0,n.value=null}async function h(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:h,clear:u}}function yn(t,l,o){const n=et(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=Qe;exports.LayerRadioButtonSet=fn;exports.Layerboard=No;exports.MapPanel=Je;exports.TopicAccordion=_o;exports.WEBMAP_ID=fo;exports.buildWebMapUrl=Ee;exports.clearCache=Xe;exports.getLayerConfigs=Ce;exports.getWebMapUrl=po;exports.transformWebMapToLayerConfigs=Oe;exports.useApiDataSources=Ye;exports.useDataSource=et;exports.useLayerConfig=mn;exports.useLayerboard=pn;exports.useReactiveDataSource=yn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),ie=require("@phila/phila-ui-map-core"),X=require("@phila/phila-ui-core");var Pe=typeof document<"u"?document.currentScript:null;const ea={class:"map-panel"},ta=a.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{default:void 0},visibleTiledLayers:{default:void 0},tiledLayerOpacities:{default:void 0},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},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:{default:void 0},initialCenter:{default:void 0}},emits:["zoom","layerLoading","layerError"],setup(s,{emit:e}){const t=s,i=e,o=a.ref(null),n=a.ref(null),r=a.ref(0);function c(u){i("zoom",u),n.value&&(r.value=d(n.value))}function d(u){const v=u.getZoom(),_=u.getCenter().lat,E=559082264028e-3,A=_*Math.PI/180;return E*Math.cos(A)/Math.pow(2,v)}const p=a.ref({}),h=a.ref(null),y=a.ref(new Set);async function l(u,v,f,_,E){const A=encodeURIComponent(_||"1=1"),N=JSON.stringify({xmin:v.west,ymin:v.south,xmax:v.east,ymax:v.north,spatialReference:{wkid:4326}}),H=E!==void 0&&E<14?`&maxAllowableOffset=${360/(Math.pow(2,E)*512)}`:"",q=2e3;let ue=0,he=[],ne=!0;for(;ne;){const Y=`${u}/query?where=${A}&geometry=${encodeURIComponent(N)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${q}&resultOffset=${ue}${H}&f=geojson`,R=await fetch(Y);if(!R.ok)throw new Error(`HTTP ${R.status}: ${R.statusText}`);const U=await R.json();U.features&&U.features.length>0?(he=he.concat(U.features),ue+=U.features.length,ne=U.features.length===q):ne=!1}return he=he.map(Y=>{if(Y.properties){const R={};for(const U of Object.keys(Y.properties))R[U.toLowerCase()]=Y.properties[U];return{...Y,properties:R}}return Y}),{type:"FeatureCollection",features:he}}async function g(u,v,f){const _=v.map(async E=>{const A=t.layerList.find(N=>N.config.id===E)?.config;if(A){i("layerLoading",E,!0);try{const N=await l(A.url,u,E,A.where,f);p.value={...p.value,[E]:N},i("layerError",E,null)}catch(N){const H=N instanceof Error?N.message:"Failed to load";i("layerError",E,H)}finally{i("layerLoading",E,!1)}}});await Promise.all(_)}function m(u){const v=new Set(u);for(const f of t.layerList)f.config.parentId&&v.has(f.config.parentId)&&v.add(f.config.id);return[...v]}async function k(u,v){const f=m([...t.visibleLayers]);await g(u,f,v)}function b(u){h.value=u.bounds,k(u.bounds,u.zoom)}function L(u){n.value=u;const v=u.getBounds();h.value={west:v.getWest(),south:v.getSouth(),east:v.getEast(),north:v.getNorth()};const f=u.getZoom();i("zoom",f),r.value=d(u),k(h.value,f)}a.watch(()=>t.visibleLayers,async()=>{if(oe.value.length>0&&Fe(),h.value){const u=new Set(t.visibleLayers),v=[...u].filter(_=>!y.value.has(_));y.value=new Set(u);const f=m(v);if(f.length>0){const _=n.value?.getZoom();await g(h.value,f,_)}}});function F(u){if(t.visibleLayers.has(u))return!0;const v=t.layerList.find(f=>f.config.id===u)?.config;return!!v?.parentId&&t.visibleLayers.has(v.parentId)}function P(u){return!!p.value[u.id]}const x=a.computed(()=>t.layerList.filter(u=>u.config.type==="circle"&&F(u.config.id)&&P(u.config)).map(u=>u.config)),B=a.computed(()=>t.layerList.filter(u=>u.config.type==="fill"&&F(u.config.id)&&P(u.config)).map(u=>u.config)),T=a.computed(()=>t.layerList.filter(u=>u.config.type==="fill"&&u.config.outlinePaint&&F(u.config.id)&&P(u.config)).map(u=>u.config)),W=a.computed(()=>t.layerList.filter(u=>u.config.type==="line"&&F(u.config.id)&&P(u.config)).map(u=>u.config));a.watch(W,async u=>{if(u.length<2)return;await a.nextTick();const v=n.value;if(v)for(let f=u.length-1;f>=0;f--){const _=f<u.length-1?u[f+1].id:"highlight-lines";try{v.getLayer(u[f].id)&&v.moveLayer(u[f].id,_)}catch{}}});function O(u){return t.visibleTiledLayers?.has(u)??!1}function J(u){return t.tiledLayerOpacities?.[u]??1}function M(u){return`${u.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ee(u){return{type:"raster",tiles:[M(u.url)],tileSize:256,attribution:u.attribution||""}}const Re=a.ref({}),qe=a.ref(new Set);async function Ne(u){if(!qe.value.has(u.id)){qe.value.add(u.id);try{const v=u.url.replace(/\/$/,""),f=await fetch(`${v}?f=json`);if(!f.ok)return;const _=await f.json(),E=_.minScale||0;let A=_.maxScale||0;if(_.layers&&_.layers.length>0)for(const N of _.layers)N.maxScale&&N.maxScale>0&&(A===0||N.maxScale<A)&&(A=N.maxScale);A===0&&(A=72e3),Re.value={...Re.value,[u.id]:{minScale:E,maxScale:A}}}catch{}}}a.onMounted(()=>{if(t.tiledLayers)for(const u of t.tiledLayers)u.scaleBasedRendering&&Ne(u)});function We(u){if(!u.scaleBasedRendering)return"tiled";const v=Re.value[u.id];if(!v)return"tiled";const f=r.value;return f===0||f>v.maxScale?"tiled":"dynamic"}const dt=a.computed(()=>t.tiledLayers?t.tiledLayers.filter(u=>O(u.id)?u.scaleBasedRendering?We(u)==="tiled":!0:!1):[]),Be=a.computed(()=>t.tiledLayers?t.tiledLayers.filter(u=>O(u.id)&&u.scaleBasedRendering?We(u)==="dynamic":!1):[]);function Oe(u){return{type:"raster",tiles:[`${u.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:u.attribution||""}}function be(u){return{type:"geojson",data:p.value[u.id],tolerance:0}}function Se(u){return t.layerOpacities[u]??1}function $e(u){const v=Se(u.id),f=u.type==="circle"?"circle-opacity":u.type==="fill"?"fill-opacity":"line-opacity";if(u.type==="fill"&&u.paint["fill-opacity"]===0)return{...u.paint,"fill-opacity":0};const _=u.type==="circle"?"circle-color":u.type==="fill"?"fill-color":"line-color",E={...u.paint},A=E[_],N=E[f]===1,H=typeof A=="string"&&A.startsWith("rgba(");if(N&&H){if(v===1)return E;{const q=A.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(q&&q[4]){const[,ue,he,ne,Y]=q,R=parseFloat(Y)*v;E[_]=`rgba(${ue}, ${he}, ${ne}, ${R})`,E[f]=1}return E}}if(H){const q=A.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(q){const[,ue,he,ne]=q;E[_]=`rgb(${ue}, ${he}, ${ne})`}}return E[f]=v,E}function ht(u){const v=Se(u.id);return{...u.outlinePaint,"line-opacity":v}}const oe=a.ref([]),we=a.ref(null),Q=a.ref(0);function Ae(u){const v=u.replace(/-outline$/,"");return t.layerList.find(_=>_.config.id===v)?.config}function He(u,v){return u.replace(/\{([^}]+)\}/g,(f,_)=>{const E=v[_];return E==null?"":String(E)})}function de(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ze(u,v,f){if(u==null)return"-";if(v?.dateFormat&&typeof u=="number"){const _=new Date(u);if(f&&v.dateFormat==="shortDateShortTime")return _.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"});switch(v.dateFormat){case"shortDateShortTime":return _.toLocaleDateString();case"longMonthDayYear":return _.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return _.toLocaleDateString();case"longDate":return _.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return _.toLocaleDateString()}}if(typeof u=="number"){if(u>1e12&&!v)return new Date(u).toLocaleDateString();const _=v?.places,E=v?.digitSeparator??!0;if(_!==void 0){if(Number.isInteger(u)&&_>=0)return String(u);const A=u.toFixed(_);if(E){const N=A.split("."),H=N[0]||"0",q=N[1],ue=H.replace(/\B(?=(\d{3})+(?!\d))/g,",");return q?`${ue}.${q}`:ue}return A}return Number.isInteger(u)?String(u):E?u.toLocaleString():String(u)}return String(u)}function Ge(u){const v=new Set;return u.filter(f=>{const E=`${f.layer.id.replace(/-outline$/,"")}:${JSON.stringify(f.properties)}`;return v.has(E)?!1:(v.add(E),!0)})}function fe(u,v){const f=p.value[u];if(!f?.features)return null;const _=v.objectid??v.OBJECTID??v.FID;if(_!=null){const E=f.features.find(A=>(A.properties?.objectid??A.properties?.OBJECTID??A.properties?.FID)===_);if(E)return E.geometry}return null}function pt(u,v){const f=new Map;return v.forEach((_,E)=>{f.set(_.id,E)}),u.sort((_,E)=>{const A=_.layer.id.replace(/-outline$/,""),N=E.layer.id.replace(/-outline$/,""),H=f.get(A)??-1;return(f.get(N)??-1)-H})}function ee(u){const v=n.value;if(!v)return;const f=[];t.layerList.forEach(R=>{const U=R.config;F(U.id)&&(f.push(U.id),U.outlinePaint&&f.push(`${U.id}-outline`))});const _=f.filter(R=>v.getLayer(R));if(_.length===0)return;const E=v.project([u.lngLat.lng,u.lngLat.lat]),A=10,N=[[E.x-A,E.y-A],[E.x+A,E.y+A]],H=v.queryRenderedFeatures(N,{layers:_});if(H.length===0)return;const q=Ge(H),ue=t.layerList.map(R=>R.config),ne=pt(q,ue).map(R=>{const U=R.layer.id.replace(/-outline$/,""),re=Ae(U);if(!re)return null;const mt=fe(re.id,R.properties||{});return{layerId:re.id,layerTitle:re.title,properties:R.properties||{},geometry:mt||R.geometry,popupConfig:re.popup}}).filter(R=>R!==null);if(ne.length===0)return;ne.sort((R,U)=>{const re=R.popupConfig?.popupSortField,mt=U.popupConfig?.popupSortField;if(!re||re!==mt)return 0;const gt=R.properties[re],yt=U.properties[re];if(gt==null||yt==null)return 0;const At=R.popupConfig?.popupSortOrder!=="asc";return gt<yt?At?1:-1:gt>yt?At?-1:1:0}),oe.value=ne,Q.value=0,we.value=[u.lngLat.lng,u.lngLat.lat];const Y=ne[0];if(Y){const R=Ae(Y.layerId);if(R){const U=j(Y.geometry),re=$(R.id,R.type);S.value={geometry:Y.geometry,geometryType:U,layerId:R.id,properties:Y.properties,originalStyle:re}}}}function Fe(){oe.value=[],we.value=null,Q.value=0,S.value=null}function xe(u){if(oe.value.length===0)return;const v=u.target;if(!(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable))switch(u.key){case"ArrowLeft":case"ArrowUp":u.preventDefault(),Ke();break;case"ArrowRight":case"ArrowDown":u.preventDefault(),le();break;case"Escape":u.preventDefault(),Fe();break}}a.onMounted(()=>{window.addEventListener("keydown",xe)}),a.onUnmounted(()=>{window.removeEventListener("keydown",xe)});function le(){const u=oe.value.length;u<=1||Q.value>=u-1||(Q.value=Q.value+1)}function Ke(){oe.value.length<=1||Q.value<=0||(Q.value=Q.value-1)}const te=a.computed(()=>oe.value.length===0?null:oe.value[Q.value]),Ve=a.computed(()=>{const u=te.value;return!u||!u.popupConfig?u?.layerTitle||"":He(u.popupConfig.title,u.properties)}),De=a.computed(()=>{const u=te.value;if(!u)return"";let v='<div class="popup-content">';if(v+=`<h3 class="popup-title">${de(Ve.value)}</h3>`,u.popupConfig?.fields?.length){v+=`<table class="popup-table" aria-label="${de(Ve.value)}">`;for(const f of u.popupConfig.fields){const _=ze(u.properties[f.field],f.format,u.popupConfig.showTime),E=f.label.toLowerCase(),A=E.includes("url")||E.includes("website"),N=_.startsWith("http://")||_.startsWith("https://")||_.startsWith("www.")||A&&_.includes("."),H=_.startsWith("http://")||_.startsWith("https://")?_:`https://${_}`,q=N?`<a href="${de(H)}" target="_blank" rel="noopener noreferrer">${de(_)}</a>`:de(_);v+=`<tr><th scope="row">${de(f.label)}</th><td>${q}</td></tr>`}v+="</table>"}return v+="</div>",v}),ae=a.ref({type:"FeatureCollection",features:[]}),Ie=a.ref({type:"FeatureCollection",features:[]}),Te=a.ref({type:"FeatureCollection",features:[]}),ft={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Ye={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},C={"fill-color":"#808080","fill-opacity":.5},S=a.ref(null);function j(u){return u.type}function $(u,v){const f=Ae(u);if(!f)return{radius:5,width:2};const _=f.paint||{};if(v==="circle"){const E=_["circle-radius"];return typeof E=="number"?{radius:E}:{radius:5}}if(v==="line"||v==="fill"){const E=_["line-width"];if(typeof E=="number")return{width:E};if(f.outlinePaint&&f.outlinePaint["line-width"]){const A=f.outlinePaint["line-width"];if(typeof A=="number")return{width:A}}return{width:2}}return{radius:5,width:2}}function Z(u){return!u||u.length===0?[]:u[0]??[]}function me(u){const{geometry:v,geometryType:f,originalStyle:_}=u;if(f==="Point"||f==="MultiPoint"){const A=(_.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:v,properties:{highlightRadius:A}}]}}if(f==="LineString"||f==="MultiLineString"){const A=(_.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:v,properties:{highlightWidth:A}}]}}if(f==="Polygon"){const E=v.coordinates,A=Z(E),H=(_.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:A},properties:{highlightWidth:H}}]}}if(f==="MultiPolygon"){const E=v.coordinates,N=(_.width||2)+3;return{type:"FeatureCollection",features:E.map(q=>({type:"Feature",geometry:{type:"LineString",coordinates:Z(q)},properties:{highlightWidth:N}}))}}return{type:"FeatureCollection",features:[]}}function Me(u){const{geometry:v,geometryType:f}=u;return f==="Polygon"||f==="MultiPolygon"?{type:"FeatureCollection",features:[{type:"Feature",geometry:v,properties:{}}]}:{type:"FeatureCollection",features:[]}}function Xt(u){if(!u){Jt();return}const v=me(u);u.geometryType==="Point"||u.geometryType==="MultiPoint"?(ae.value=v,Ie.value={type:"FeatureCollection",features:[]},Te.value={type:"FeatureCollection",features:[]}):(Ie.value=v,ae.value={type:"FeatureCollection",features:[]},Te.value=Me(u))}function Jt(){ae.value={type:"FeatureCollection",features:[]},Ie.value={type:"FeatureCollection",features:[]},Te.value={type:"FeatureCollection",features:[]}}a.watch(S,u=>{Xt(u)}),a.watch(()=>t.visibleLayers,u=>{S.value&&!u.has(S.value.layerId)&&(S.value=null,Fe())},{deep:!0}),a.watch(Q,()=>{const u=te.value;if(!u){S.value=null;return}const v=Ae(u.layerId);if(v){const f=j(u.geometry),_=$(v.id,v.type);S.value={geometry:u.geometry,geometryType:f,layerId:v.id,properties:u.properties,originalStyle:_}}});const Bt=a.ref(null);function Qt(u){const[v,f]=u.geometry.coordinates;Bt.value=[v,f]}return(u,v)=>(a.openBlock(),a.createElementBlock("div",ea,[a.createVNode(a.unref(ie.Map),{ref_key:"mapRef",ref:o,zoom:t.initialZoom,center:t.initialCenter,"navigation-controls":{position:t.navigationControlPosition},"geolocation-control":{position:t.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:t.basemapControlPosition},"map-search-control":{position:t.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":t.cyclomediaConfig,"cyclomedia-button-position":t.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":t.pictometryCredentials,"pictometry-button-position":t.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:c,onClick:Fe,onMoveend:b,onLoad:L,onSearchResult:Qt},{default:a.withCtx(()=>[t.drawControlPosition!==null?(a.openBlock(),a.createBlock(a.unref(ie.DrawTool),{key:0,position:t.drawControlPosition},null,8,["position"])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(dt.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.RasterLayer),{id:"tiled-"+f.id,key:"tiled-"+f.id,source:Ee(f),paint:{"raster-opacity":J(f.id)},minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Be.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.RasterLayer),{id:"dynamic-"+f.id,key:"dynamic-"+f.id,source:Oe(f),paint:{"raster-opacity":J(f.id)},minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(x.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.CircleLayer),{id:f.id,key:f.id,source:be(f),paint:$e(f),minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-circles",onClick:ee},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(B.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.FillLayer),{id:f.id,key:f.id,source:be(f),paint:$e(f),minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-circles",onClick:ee},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(T.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.LineLayer),{id:f.id+"-outline",key:f.id+"-outline",source:be(f),paint:ht(f),minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-lines",onClick:ee},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(W.value,f=>(a.openBlock(),a.createBlock(a.unref(ie.LineLayer),{id:f.id,key:f.id,source:be(f),paint:$e(f),minzoom:f.minZoom,maxzoom:f.maxZoom,"before-id":"highlight-lines",onClick:ee},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),a.createVNode(a.unref(ie.CircleLayer),{id:"highlight-circles",key:"highlight-circles-layer",source:{type:"geojson",data:ae.value},paint:ft},null,8,["source"]),a.createVNode(a.unref(ie.FillLayer),{id:"highlight-fill",key:"highlight-fill-layer",source:{type:"geojson",data:Te.value},paint:C},null,8,["source"]),a.createVNode(a.unref(ie.LineLayer),{id:"highlight-lines",key:"highlight-lines-layer",source:{type:"geojson",data:Ie.value},paint:Ye},null,8,["source"]),a.createVNode(a.unref(ie.MapMarker),{"lng-lat":Bt.value,color:"#2176d2"},null,8,["lng-lat"]),te.value&&we.value?(a.openBlock(),a.createBlock(a.unref(ie.MapPopup),{key:1,"lng-lat":we.value,html:De.value,"close-on-click":!1,offset:[0,-15],"show-navigation":oe.value.length>1,"current-feature-index":Q.value,"total-features":oe.value.length,"layer-name":te.value.layerTitle,onClose:Fe,onNext:le,onPrevious:Ke},null,8,["lng-lat","html","show-navigation","current-feature-index","total-features","layer-name"])):a.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"])]))}}),ke=(s,e)=>{const t=s.__vccOpts||s;for(const[i,o]of e)t[i]=o;return t},Nt=ke(ta,[["__scopeId","data-v-1f8b1f59"]]);function bt(s){let e=s.split("?")[0]||s;return e=e.replace(/\/query$/,""),e=e.replace(/\/$/,""),e=e.replace(/^https?:\/\//,""),e.toLowerCase()}const aa=["disabled"],ia=a.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(s){const e=s,t=r=>"href"in r&&r.href!==void 0||"to"in r&&r.to!==void 0,i=a.computed(()=>X.cn("phila-button",`phila-button--${e.variant}`,e.size&&`is-${e.size}`,e.iconOnly&&"icon-button",e.iconOnly&&e.variant==="standard"&&"icon-button--standard",e.className)),o=a.computed(()=>t(e)?"to"in e&&e.to!==void 0?{to:e.to,disabled:e.disabled,className:i.value}:{href:e.href,target:e.target,rel:e.rel,disabled:e.disabled,className:i.value}:{}),n=a.computed(()=>({iconDefinition:e.iconDefinition,iconClass:e.iconClass,src:e.src,iconRight:e.iconRight,iconOnly:e.iconOnly,text:e.text,size:e.size}));return(r,c)=>t(e)?(a.openBlock(),a.createBlock(a.unref(X.BaseLink),a.mergeProps({key:0},{...o.value,...r.$attrs},{role:"button"}),{default:a.withCtx(()=>[a.createVNode(a.unref(X.ActionContent),a.normalizeProps(a.guardReactiveProps(n.value)),{default:a.withCtx(()=>[a.renderSlot(r.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(e.text),1)])]),_:3},16)]),_:3},16)):(a.openBlock(),a.createElementBlock("button",a.mergeProps({key:1,type:"button",disabled:e.disabled,class:i.value},r.$attrs),[a.createVNode(a.unref(X.ActionContent),a.normalizeProps(a.guardReactiveProps(n.value)),{default:a.withCtx(()=>[a.renderSlot(r.$slots,"default",{},()=>[a.createTextVNode(a.toDisplayString(e.text),1)])]),_:3},16)],16,aa))}});var sa={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"]},oa=sa,na={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"]},ra=na;function _e(s){return typeof s=="string"||s instanceof String}function Vt(s){var e;return typeof s=="object"&&s!=null&&(s==null||(e=s.constructor)==null?void 0:e.name)==="Object"}function Ot(s,e){return Array.isArray(e)?Ot(s,(t,i)=>e.includes(i)):Object.entries(s).reduce((t,i)=>{let[o,n]=i;return e(n,o)&&(t[o]=n),t},{})}const w={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function la(s){switch(s){case w.LEFT:return w.FORCE_LEFT;case w.RIGHT:return w.FORCE_RIGHT;default:return s}}function vt(s){return s.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function et(s,e){if(e===s)return!0;const t=Array.isArray(e),i=Array.isArray(s);let o;if(t&&i){if(e.length!=s.length)return!1;for(o=0;o<e.length;o++)if(!et(e[o],s[o]))return!1;return!0}if(t!=i)return!1;if(e&&s&&typeof e=="object"&&typeof s=="object"){const n=e instanceof Date,r=s instanceof Date;if(n&&r)return e.getTime()==s.getTime();if(n!=r)return!1;const c=e instanceof RegExp,d=s instanceof RegExp;if(c&&d)return e.toString()==s.toString();if(c!=d)return!1;const p=Object.keys(e);for(o=0;o<p.length;o++)if(!Object.prototype.hasOwnProperty.call(s,p[o]))return!1;for(o=0;o<p.length;o++)if(!et(s[p[o]],e[p[o]]))return!1;return!0}else if(e&&s&&typeof e=="function"&&typeof s=="function")return e.toString()===s.toString();return!1}class ua{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?w.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?w.RIGHT:w.LEFT}}function V(s,e){return new V.InputMask(s,e)}function $t(s){if(s==null)throw new Error("mask property should be defined");return s instanceof RegExp?V.MaskedRegExp:_e(s)?V.MaskedPattern:s===Date?V.MaskedDate:s===Number?V.MaskedNumber:Array.isArray(s)||s===Array?V.MaskedDynamic:V.Masked&&s.prototype instanceof V.Masked?s:V.Masked&&s instanceof V.Masked?s.constructor:s instanceof Function?V.MaskedFunction:V.Masked}function je(s){if(!s)throw new Error("Options in not defined");if(V.Masked){if(s.prototype instanceof V.Masked)return{mask:s};const{mask:e=void 0,...t}=s instanceof V.Masked?{mask:s}:Vt(s)&&s.mask instanceof V.Masked?s:{};if(e){const i=e.mask;return{...Ot(e,(o,n)=>!n.startsWith("_")),mask:e.constructor,_mask:i,...t}}}return Vt(s)?{...s}:{mask:s}}function ve(s){if(V.Masked&&s instanceof V.Masked)return s;const e=je(s),t=$t(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}V.createMask=ve;class Ct{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}V.MaskElement=Ct;const Dt=90,ca=89;class ot extends Ct{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,i;return(e=(t=(i=this.input).getRootNode)==null?void 0:t.call(i))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===Dt&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===ca&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Dt&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}V.HTMLMaskElement=ot;class da extends ot{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}V.HTMLMaskElement=ot;class zt extends ot{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),i=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||i==null||i<o?i:o}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),i=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||i==null||i>o?i:o}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const i=this.rootElement.createRange();i.setStart(this.input.firstChild||this.input,e),i.setEnd(this.input.lastChild||this.input,t);const o=this.rootElement,n=o.getSelection&&o.getSelection();n&&(n.removeAllRanges(),n.addRange(i))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}V.HTMLContenteditableMaskElement=zt;class nt{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>nt.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}nt.MAX_LENGTH=100;class ha{constructor(e,t){this.el=e instanceof Ct?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new zt(e):new da(e),this.masked=ve(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new nt,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof V.Masked)&&this.masked.constructor===$t(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof V.Masked?e:ve({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const i=this._listeners[e];i&&i.forEach(o=>o(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue,this.el.value,this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,i=this.masked.value,o=this.masked.rawInputValue,n=this.displayValue,r=this.unmaskedValue!==t||this.value!==i||this._rawInputValue!==o;this._unmaskedValue=t,this._value=i,this._rawInputValue=o,this.el.value!==n&&(this.el.value=n),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),r&&this._fireChangeEvents(),!this._historyChanging&&(r||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...i}=e,o=!this.maskEquals(t),n=this.masked.optionsIsChanged(i);o&&(this.mask=t),n&&this.masked.updateOptions(i),(o||n)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,w.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const i=this._listeners[e].indexOf(t);return i>=0&&this._listeners[e].splice(i,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new ua({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),i=this.masked.rawInputValue,o=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,n=i===this.masked.rawInputValue?t.removeDirection:w.NONE;let r=this.masked.nearestInputPos(t.startChangePos+o,n);n!==w.NONE&&(r=this.masked.nearestInputPos(r,w.NONE)),this.updateControl(r),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}V.InputMask=ha;class I{static normalize(e){return Array.isArray(e)?e:[e,new I]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}V.ChangeDetails=I;class pe{constructor(e,t,i){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=i}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class G{constructor(e){this._value="",this._update({...G.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new pe(this.extractInput(e,t),e)}appendTail(e){return _e(e)&&(e=new pe(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new I({inserted:e,rawInserted:e})):new I}_appendChar(e,t,i){t===void 0&&(t={});const o=this.state;let n;if([e,n]=this.doPrepareChar(e,t),e&&(n=n.aggregate(this._appendCharRaw(e,t)),!n.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=o;let c=this.pad(t);const d=this._appendCharRaw(e,t);c=c.aggregate(d),d.rawInserted||c.equals(n)?n=c:this.state=r}if(n.inserted){let r,c=this.doValidate(t)!==!1;if(c&&i!=null){const d=this.state;if(this.overwrite===!0){r=i.state;for(let h=0;h<n.rawInserted.length;++h)i.unshift(this.displayValue.length-n.tailShift)}let p=this.appendTail(i);if(c=p.rawInserted.length===i.toString().length,!(c&&p.inserted)&&this.overwrite==="shift"){this.state=d,r=i.state;for(let h=0;h<n.rawInserted.length;++h)i.shift();p=this.appendTail(i),c=p.rawInserted.length===i.toString().length}c&&p.inserted&&(this.state=d)}c||(n=new I,this.state=o,i&&r&&(i.state=r))}return n}_appendPlaceholder(){return new I}_appendEager(){return new I}append(e,t,i){if(!_e(e))throw new Error("value should be string");const o=_e(i)?new pe(String(i)):i;t!=null&&t.tail&&(t._beforeTailState=this.state);let n;[e,n]=this.doPrepare(e,t);for(let r=0;r<e.length;++r){const c=this._appendChar(e[r],t,o);if(!c.rawInserted&&!this.doSkipInvalid(e[r],t,o))break;n.aggregate(c)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&n.aggregate(this._appendEager()),o!=null&&(n.tailShift+=this.appendTail(o).tailShift),n}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new I}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,i=this.value,o=e();return this.rawInputValue=t,this.value&&this.value!==i&&i.indexOf(this.value)===0&&(this.append(i.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,i=e(this);return this.state=t,delete this._isolated,i}doSkipInvalid(e,t,i){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),I.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),I.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,i,o,n){i===void 0&&(i=""),o===void 0&&(o=w.NONE),n===void 0&&(n={input:!0});const r=e+t,c=this.extractTail(r),d=this.eager===!0||this.eager==="remove";let p;d&&(o=la(o),p=this.extractInput(0,r,{raw:!0}));let h=e;const y=new I;if(o!==w.NONE&&(h=this.nearestInputPos(e,t>1&&e!==0&&!d?w.NONE:o),y.tailShift=h-e),y.aggregate(this.remove(h)),d&&o!==w.NONE&&p===this.rawInputValue)if(o===w.FORCE_LEFT){let l;for(;p===this.rawInputValue&&(l=this.displayValue.length);)y.aggregate(new I({tailShift:-1})).aggregate(this.remove(l-1))}else o===w.FORCE_RIGHT&&c.unshift();return y.aggregate(this.append(i,n,c))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!et(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||G.EMPTY_VALUES.includes(e)&&G.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new I}}G.DEFAULTS={skipInvalid:!0};G.EMPTY_VALUES=[void 0,null,""];V.Masked=G;class Le{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=_e(e)?new pe(String(e)):e;const t=this.chunks[this.chunks.length-1],i=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof pe)i?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof Le){if(e.stop==null){let o;for(;e.chunks.length&&e.chunks[0].stop==null;)o=e.chunks.shift(),o.from+=e.from,this.extend(o)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof V.MaskedPattern))return new pe(this.toString()).appendTo(e);const t=new I;for(let i=0;i<this.chunks.length;++i){const o=this.chunks[i],n=e._mapPosToBlock(e.displayValue.length),r=o.stop;let c;if(r!=null&&(!n||n.index<=r)&&((o instanceof Le||e._stops.indexOf(r)>=0)&&t.aggregate(e._appendPlaceholder(r)),c=o instanceof Le&&e._blocks[r]),c){const d=c.appendTail(o);t.aggregate(d);const p=o.toString().slice(d.rawInserted.length);p&&t.aggregate(e.append(p,{tail:!0}))}else t.aggregate(e.append(o.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...i}=e;Object.assign(this,i),this.chunks=t.map(o=>{const n="chunks"in o?new Le:new pe;return n.state=o,n})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let i=0;for(;i<this.chunks.length;){const o=this.chunks[i],n=o.unshift(t);if(o.toString()){if(!n)break;++i}else this.chunks.splice(i,1);if(n)return n}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],i=t.shift();if(t.toString()){if(!i)break;--e}else this.chunks.splice(e,1);if(i)return i}return""}}class pa{constructor(e,t){this.masked=e,this._log=[];const{offset:i,index:o}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=i,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,w.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,w.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,w.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,w.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,w.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,w.NONE),!0})}}class Ut{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new I}nearestInputPos(e,t){t===void 0&&(t=w.NONE);const i=0,o=this._value.length;switch(t){case w.LEFT:case w.FORCE_LEFT:return i;case w.NONE:case w.RIGHT:case w.FORCE_RIGHT:default:return o}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),i===void 0&&(i={}),i.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new I;const i=this.eager===!0||this.eager==="append",o=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!i)&&!t.tail,n=new I({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(t.raw||t.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new I;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new pe("")}appendTail(e){return _e(e)&&(e=new pe(String(e))),e.appendTo(this)}append(e,t,i){const o=this._appendChar(e[0],t);return i!=null&&(o.tailShift+=this.appendTail(i).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class tt{constructor(e){const{parent:t,isOptional:i,placeholderChar:o,displayChar:n,lazy:r,eager:c,...d}=e;this.masked=ve(d),Object.assign(this,{parent:t,isOptional:i,placeholderChar:o,displayChar:n,lazy:r,eager:c})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new I}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new I;const i=this.masked.state;let o=this.masked._appendChar(e,this.currentMaskFlags(t));return o.inserted&&this.doValidate(t)===!1&&(o=new I,this.masked.state=i),!o.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(e,t,i){return this.masked.append(e,this.currentMaskFlags(t),i)}_appendPlaceholder(){return this.isFilled||this.isOptional?new I:(this.isFilled=!0,new I({inserted:this.placeholderChar}))}_appendEager(){return new I}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,i)}nearestInputPos(e,t){t===void 0&&(t=w.NONE);const i=0,o=this.value.length,n=Math.min(Math.max(e,i),o);switch(t){case w.LEFT:case w.FORCE_LEFT:return this.isComplete?n:i;case w.RIGHT:case w.FORCE_RIGHT:return this.isComplete?n:o;case w.NONE:default:return n}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new I}}tt.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class fa extends G{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=i=>i.search(t)>=0),super._update(e)}}V.MaskedRegExp=fa;class K extends G{constructor(e){super({...K.DEFAULTS,...e,definitions:Object.assign({},tt.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let i=!1,o=!1;for(let n=0;n<t.length;++n){if(this.blocks){const p=t.slice(n),h=Object.keys(this.blocks).filter(l=>p.indexOf(l)===0);h.sort((l,g)=>g.length-l.length);const y=h[0];if(y){const{expose:l,repeat:g,...m}=je(this.blocks[y]),k={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:g,parent:this},b=g!=null?new V.RepeatBlock(k):ve(k);b&&(this._blocks.push(b),l&&(this.exposeBlock=b),this._maskedBlocks[y]||(this._maskedBlocks[y]=[]),this._maskedBlocks[y].push(this._blocks.length-1)),n+=y.length-1;continue}}let r=t[n],c=r in e;if(r===K.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){i=!i;continue}if(r==="["||r==="]"){o=!o;continue}if(r===K.ESCAPE_CHAR){if(++n,r=t[n],!r)break;c=!1}const d=c?new tt({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...je(e[r]),parent:this}):new Ut({char:r,eager:this.eager,isUnmasking:i});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...i}=e;this._blocks.forEach((o,n)=>o.state=t[n]),super.state=i}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new I;let i=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(i==null)return t;this._blocks[i].isFilled&&++i;for(let o=i;o<this._blocks.length;++o){const n=this._blocks[o]._appendEager();if(!n.inserted)break;t.aggregate(n)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const i=this._mapPosToBlock(this.displayValue.length),o=new I;if(!i)return o;for(let r=i.index,c;c=this._blocks[r];++r){var n;const d=c._appendChar(e,{...t,_beforeTailState:(n=t._beforeTailState)==null||(n=n._blocks)==null?void 0:n[r]});if(o.aggregate(d),d.consumed)break}return o}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const i=new Le;return e===t||this._forEachBlocksInRange(e,t,(o,n,r,c)=>{const d=o.extractTail(r,c);d.stop=this._findStopBefore(n),d.from=this._blockStartPos(n),d instanceof Le&&(d.blockIndex=n),i.extend(d)}),i}extractInput(e,t,i){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),i===void 0&&(i={}),e===t)return"";let o="";return this._forEachBlocksInRange(e,t,(n,r,c,d)=>{o+=n.extractInput(c,d,i)}),o}_findStopBefore(e){let t;for(let i=0;i<this._stops.length;++i){const o=this._stops[i];if(o<=e)t=o;else break}return t}_appendPlaceholder(e){const t=new I;if(this.lazy&&e==null)return t;const i=this._mapPosToBlock(this.displayValue.length);if(!i)return t;const o=i.index,n=e??this._blocks.length;return this._blocks.slice(o,n).forEach(r=>{if(!r.lazy||e!=null){var c;t.aggregate(r._appendPlaceholder((c=r._blocks)==null?void 0:c.length))}}),t}_mapPosToBlock(e){let t="";for(let i=0;i<this._blocks.length;++i){const o=this._blocks[i],n=t.length;if(t+=o.displayValue,e<=t.length)return{index:i,offset:e-n}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,i)=>t+=i.displayValue.length,0)}_forEachBlocksInRange(e,t,i){t===void 0&&(t=this.displayValue.length);const o=this._mapPosToBlock(e);if(o){const n=this._mapPosToBlock(t),r=n&&o.index===n.index,c=o.offset,d=n&&r?n.offset:this._blocks[o.index].displayValue.length;if(i(this._blocks[o.index],o.index,c,d),n&&!r){for(let p=o.index+1;p<n.index;++p)i(this._blocks[p],p,0,this._blocks[p].displayValue.length);i(this._blocks[n.index],n.index,0,n.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const i=super.remove(e,t);return this._forEachBlocksInRange(e,t,(o,n,r,c)=>{i.aggregate(o.remove(r,c))}),i}nearestInputPos(e,t){if(t===void 0&&(t=w.NONE),!this._blocks.length)return 0;const i=new pa(this,e);if(t===w.NONE)return i.pushRightBeforeInput()||(i.popState(),i.pushLeftBeforeInput())?i.pos:this.displayValue.length;if(t===w.LEFT||t===w.FORCE_LEFT){if(t===w.LEFT){if(i.pushRightBeforeFilled(),i.ok&&i.pos===e)return e;i.popState()}if(i.pushLeftBeforeInput(),i.pushLeftBeforeRequired(),i.pushLeftBeforeFilled(),t===w.LEFT){if(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.ok&&i.pos<=e||(i.popState(),i.ok&&i.pos<=e))return i.pos;i.popState()}return i.ok?i.pos:t===w.FORCE_LEFT?0:(i.popState(),i.ok||(i.popState(),i.ok)?i.pos:0)}return t===w.RIGHT||t===w.FORCE_RIGHT?(i.pushRightBeforeInput(),i.pushRightBeforeRequired(),i.pushRightBeforeFilled()?i.pos:t===w.FORCE_RIGHT?this.displayValue.length:(i.popState(),i.ok||(i.popState(),i.ok)?i.pos:this.nearestInputPos(e,w.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let i=0;return this._forEachBlocksInRange(e,t,(o,n,r,c)=>{i+=o.totalInputPositions(r,c)}),i}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(i=>this._blocks[i]):[]}pad(e){const t=new I;return this._forEachBlocksInRange(0,this.displayValue.length,i=>t.aggregate(i.pad(e))),t}}K.DEFAULTS={...G.DEFAULTS,lazy:!0,placeholderChar:"_"};K.STOP_CHAR="`";K.ESCAPE_CHAR="\\";K.InputDefinition=tt;K.FixedDefinition=Ut;V.MaskedPattern=K;class Je extends K{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:i=this.from||0,maxLength:o=this.maxLength||0,autofix:n=this.autofix,...r}=e;this.to=t,this.from=i,this.maxLength=Math.max(String(t).length,o),this.autofix=n;const c=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let p=0;for(;p<d.length&&d[p]===c[p];)++p;r.mask=d.slice(0,p).replace(/0/g,"\\0")+"0".repeat(this.maxLength-p),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",i="";const[,o,n]=e.match(/^(\D*)(\d*)(\D*)/)||[];return n&&(t="0".repeat(o.length)+n,i="9".repeat(o.length)+n),t=t.padEnd(this.maxLength,"0"),i=i.padEnd(this.maxLength,"9"),[t,i]}doPrepareChar(e,t){t===void 0&&(t={});let i;return[e,i]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(i.skip=!this.isComplete),[e,i]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const i=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[n,r]=this.boundaries(this.value+e);return Number(r)<this.from?super._appendCharRaw(i[this.value.length],t):Number(n)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(i[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(o[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[i,o]=this.boundaries(t);return this.from<=Number(o)&&Number(i)<=this.to&&super.doValidate(e)}pad(e){const t=new I;if(this.value.length===this.maxLength)return t;const i=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let n=0;n<o;++n)t.aggregate(super._appendCharRaw("0",e));i.split("").forEach(n=>this._appendCharRaw(n))}return t}}V.MaskedRange=Je;const ma="d{.}`m{.}`Y";class ge extends K{static extractPatternOptions(e){const{mask:t,pattern:i,...o}=e;return{...o,mask:_e(t)?t:i}}constructor(e){super(ge.extractPatternOptions({...ge.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:i,blocks:o,...n}={...ge.DEFAULTS,...e},r=Object.assign({},ge.GET_DEFAULT_BLOCKS());e.min&&(r.Y.from=e.min.getFullYear()),e.max&&(r.Y.to=e.max.getFullYear()),e.min&&e.max&&r.Y.from===r.Y.to&&(r.m.from=e.min.getMonth()+1,r.m.to=e.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=e.min.getDate(),r.d.to=e.max.getDate())),Object.assign(r,this.blocks,o),super._update({...n,mask:_e(t)?t:i,blocks:r})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(ge.extractPatternOptions(e))}}ge.GET_DEFAULT_BLOCKS=()=>({d:{mask:Je,from:1,to:31,maxLength:2},m:{mask:Je,from:1,to:12,maxLength:2},Y:{mask:Je,from:1900,to:9999}});ge.DEFAULTS={...K.DEFAULTS,mask:Date,pattern:ma,format:(s,e)=>{if(!s)return"";const t=String(s.getDate()).padStart(2,"0"),i=String(s.getMonth()+1).padStart(2,"0"),o=s.getFullYear();return[t,i,o].join(".")},parse:(s,e)=>{const[t,i,o]=s.split(".").map(Number);return new Date(o,i-1,t)}};V.MaskedDate=ge;class rt extends G{constructor(e){super({...rt.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:i,...o}=je(t),n=ve({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return i&&(this.exposeMask=n),n}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const i=this._applyDispatch(e,t);return this.currentMask&&i.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),i}_applyDispatch(e,t,i){e===void 0&&(e=""),t===void 0&&(t={}),i===void 0&&(i="");const o=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,n=this.rawInputValue,r=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:n,c=n.slice(r.length),d=this.currentMask,p=new I,h=d?.state;return this.currentMask=this.doDispatch(e,{...t},i),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),p.tailShift=this.currentMask.value.length-o.length),c&&(p.tailShift+=this.currentMask.append(c,{raw:!0,tail:!0}).tailShift)):h&&(this.currentMask.state=h)),p}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new I;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,i;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((i=e._beforeTailState)==null?void 0:i.currentMask)||e._beforeTailState}}doDispatch(e,t,i){return t===void 0&&(t={}),i===void 0&&(i=""),this.dispatch(e,this,t,i)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[i,o]=super.doPrepare(e,t);if(this.currentMask){let n;[i,n]=super.doPrepare(i,this.currentMaskFlags(t)),o=o.aggregate(n)}return[i,o]}doPrepareChar(e,t){t===void 0&&(t={});let[i,o]=super.doPrepareChar(e,t);if(this.currentMask){let n;[i,n]=super.doPrepareChar(i,this.currentMaskFlags(t)),o=o.aggregate(n)}return[i,o]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const i=new I;return this.currentMask&&i.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),i}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:i,currentMask:o,...n}=e;t&&this.compiledMasks.forEach((r,c)=>r.state=t[c]),i!=null&&(this.currentMask=i,this.currentMask.state=o),super.state=n}extractInput(e,t,i){return this.currentMask?this.currentMask.extractInput(e,t,i):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,i)=>{if(!e[i])return;const{mask:o,...n}=e[i];return et(t,n)&&t.maskEquals(o)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}rt.DEFAULTS={...G.DEFAULTS,dispatch:(s,e,t,i)=>{if(!e.compiledMasks.length)return;const o=e.rawInputValue,n=e.compiledMasks.map((r,c)=>{const d=e.currentMask===r,p=d?r.displayValue.length:r.nearestInputPos(r.displayValue.length,w.FORCE_LEFT);return r.rawInputValue!==o?(r.reset(),r.append(o,{raw:!0})):d||r.remove(p),r.append(s,e.currentMaskFlags(t)),r.appendTail(i),{index:c,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(p,r.nearestInputPos(r.displayValue.length,w.FORCE_LEFT)))}});return n.sort((r,c)=>c.weight-r.weight||c.totalInputPositions-r.totalInputPositions),e.compiledMasks[n[0].index]}};V.MaskedDynamic=rt;class lt extends K{constructor(e){super({...lt.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...i}=e;if(t){const o=t.map(c=>c.length),n=Math.min(...o),r=Math.max(...o)-n;i.mask="*".repeat(n),r&&(i.mask+="["+"*".repeat(r)+"]"),this.enum=t}super._update(i)}_appendCharRaw(e,t){t===void 0&&(t={});const i=Math.min(this.nearestInputPos(0,w.FORCE_RIGHT),this.value.length),o=this.enum.filter(n=>this.matchValue(n,this.unmaskedValue+e,i));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,c)=>{const d=o[0][c];c>=this.value.length||d===r.value||(r.reset(),r._appendChar(d,t))});const n=super._appendCharRaw(o[0][this.value.length],t);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(r=>n.aggregate(super._appendCharRaw(r))),n}return new I({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new pe("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new I;const i=Math.min(super.nearestInputPos(0,w.FORCE_RIGHT),this.value.length);let o;for(o=e;o>=0&&!(this.enum.filter(r=>this.matchValue(r,this.value.slice(i,o),i)).length>1);--o);const n=super.remove(o,t);return n.tailShift+=o-e,n}get isComplete(){return this.enum.indexOf(this.value)>=0}}lt.DEFAULTS={...K.DEFAULTS,matchValue:(s,e,t)=>s.indexOf(e,t)===t};V.MaskedEnum=lt;class ga extends G{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}V.MaskedFunction=ga;var jt;class se extends G{constructor(e){super({...se.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",i=(this.scale?"("+vt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+i),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(vt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(vt(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[i,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!i&&(o.skip=!0),i&&!this.allowPositive&&!this.value&&i!=="-"&&o.aggregate(this._appendChar("-")),[i,o]}_separatorsCount(e,t){t===void 0&&(t=!1);let i=0;for(let o=0;o<e;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++i,t&&(e+=this.thousandsSeparator.length));return i}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,i))}_appendCharRaw(e,t){t===void 0&&(t={});const i=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(i);this._value=this._removeThousandsSeparators(this.value);const n=this._value;this._value+=e;const r=this.number;let c=!isNaN(r),d=!1;if(c){let l;this.min!=null&&this.min<0&&this.number<this.min&&(l=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(l=this.max),l!=null&&(this.autofix?(this._value=this.format(l,this).replace(se.UNMASKED_RADIX,this.radix),d||(d=n===this._value&&!t.tail)):c=!1),c&&(c=!!this._value.match(this._numberRegExp))}let p;c?p=new I({inserted:this._value.slice(n.length),rawInserted:d?"":e,skip:d}):(this._value=n,p=new I),this._value=this._insertThousandsSeparators(this._value);const h=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,y=this._separatorsCountFromSlice(h);return p.tailShift+=(y-o)*this.thousandsSeparator.length,p}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,i=this.value.indexOf(this.thousandsSeparator,t);if(i<=e)return i}return-1}_adjustRangeWithSeparators(e,t){const i=this._findSeparatorAround(e);i>=0&&(e=i);const o=this._findSeparatorAround(t);return o>=0&&(t=o+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const i=this.value.slice(0,e),o=this.value.slice(t),n=this._separatorsCount(i.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(i+o));const r=this._separatorsCountFromSlice(i);return new I({tailShift:(r-n)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case w.NONE:case w.LEFT:case w.FORCE_LEFT:{const i=this._findSeparatorAround(e-1);if(i>=0){const o=i+this.thousandsSeparator.length;if(e<o||this.value.length<=o||t===w.FORCE_LEFT)return i}break}case w.RIGHT:case w.FORCE_RIGHT:{const i=this._findSeparatorAround(e);if(i>=0)return i+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let i=this.value;this.normalizeZeros&&(i=this._normalizeZeros(i)),this.padFractionalZeros&&this.scale>0&&(i=this._padFractionalZeros(i)),this._value=i}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(i,o,n,r)=>o+r),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,i){t===void 0&&(t={});const o=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===se.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,i)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,se.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(se.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||se.EMPTY_VALUES.includes(e)&&se.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}jt=se;se.UNMASKED_RADIX=".";se.EMPTY_VALUES=[...G.EMPTY_VALUES,0];se.DEFAULTS={...G.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[jt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:s=>s.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})};V.MaskedNumber=se;const kt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Zt(s,e,t){e===void 0&&(e=kt.MASKED),t===void 0&&(t=kt.MASKED);const i=ve(s);return o=>i.runIsolated(n=>(n[e]=o,n[t]))}function ya(s,e,t,i){return Zt(e,t,i)(s)}V.PIPE_TYPE=kt;V.createPipe=Zt;V.pipe=ya;class va extends K{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,i,o;const{repeat:n,...r}=je(e);this._blockOpts=Object.assign({},this._blockOpts,r);const c=ve(this._blockOpts);this.repeat=(t=(i=n??c.repeat)!=null?i:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:c},eager:c.eager,overwrite:c.overwrite,skipInvalid:c.skipInvalid,lazy:c.lazy,placeholderChar:c.placeholderChar,displayChar:c.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(ve(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const i=new I;for(let d=(o=(n=this._mapPosToBlock(this.displayValue.length))==null?void 0:n.index)!=null?o:Math.max(this._blocks.length-1,0),p,h;p=(r=this._blocks[d])!=null?r:h=!h&&this._allocateBlock(d);++d){var o,n,r,c;const y=p._appendChar(e,{...t,_beforeTailState:(c=t._beforeTailState)==null||(c=c._blocks)==null?void 0:c[d]});if(y.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(i.aggregate(y),y.consumed)break}return i}_trimEmptyTail(e,t){var i,o;e===void 0&&(e=0);const n=Math.max(((i=this._mapPosToBlock(e))==null?void 0:i.index)||0,this.repeatFrom,0);let r;t!=null&&(r=(o=this._mapPosToBlock(t))==null?void 0:o.index),r==null&&(r=this._blocks.length-1);let c=0;for(let d=r;n<=d&&!this._blocks[d].unmaskedValue;--d,++c);c&&(this._blocks.splice(r-c+1,c),this.mask=this.mask.slice(c))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const i=super.remove(e,t);return this._trimEmptyTail(e,t),i}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}V.RepeatBlock=va;try{globalThis.IMask=V}catch{}var ka={mask:void 0,prepare:Function,prepareChar:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},eager:{required:!1,default:void 0,validator:s=>["append","remove"].includes(s)||typeof s=="boolean"},skipInvalid:{type:Boolean,required:!1,default:void 0},placeholderChar:String,displayChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,enum:Array,maxLength:Number,from:Number,to:Number,pattern:String,format:Function,parse:Function,autofix:{required:!1,default:void 0,validator:s=>s==="pad"||typeof s=="boolean"},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function ba(s,e){let{emit:t,onAccept:i,onComplete:o,defaultValue:n,defaultUnmaskedValue:r,defaultTypedValue:c}=e===void 0?{}:e;const d=a.isRef(s)?s:a.ref(s),p=a.ref(),h=a.ref(),y=a.ref(""),l=a.ref(""),g=a.ref();let m,k=y.value,b=l.value,L=g.value;function F(){L=g.value=h.value.typedValue,b=l.value=h.value.unmaskedValue,k=y.value=h.value.value}function P(M){F(),t&&(t("accept",y.value,M),t("accept:masked",y.value,M),t("accept:typed",g.value,M),t("accept:unmasked",l.value,M)),i?.(M)}function x(M){t&&(t("complete",h.value.value,M),t("complete:masked",h.value.value,M),t("complete:typed",h.value.typedValue,M),t("complete:unmasked",h.value.unmaskedValue,M)),o?.(M)}const B=()=>{!h.value||l.value===void 0||(b!==l.value&&(h.value.unmaskedValue=l.value,h.value.unmaskedValue!==l.value&&P()),b=void 0)};a.watch(l,B);const T=()=>{!h.value||y.value===void 0||(k!==y.value&&(h.value.value=y.value,h.value.value!==y.value&&P()),k=void 0)};a.watch(y,T);const W=()=>{!h.value||g.value===void 0||(L!==g.value&&(h.value.typedValue=g.value,h.value.masked.typedValueEquals(g.value)||P()),L=void 0)};a.watch(g,W);function O(){m=p.value;const M=d.value;!m||!(M!=null&&M.mask)||(h.value=V(m,M),n!==void 0&&(y.value=n),r!==void 0&&(l.value=r),c!==void 0&&(g.value=c),B(),T(),W(),F(),h.value.on("accept",P).on("complete",x))}function J(){var M;(M=h.value)==null||M.destroy(),h.value=void 0}return a.onMounted(O),a.onUnmounted(J),a.watch([p,d],()=>{const M=p.value,Ee=d.value;(!(Ee!=null&&Ee.mask)||M!==m)&&J(),M&&(h.value?h.value.updateOptions(Ee):O())}),{el:p,mask:a.readonly(h),masked:y,unmasked:l,typed:g}}function Ca(s,e){return s={...s},Object.keys(s).forEach(t=>{(s[t]===void 0||e.includes(t))&&delete s[t]}),s}const _a=["typed","unmasked","value","modelValue"];var Ea=a.defineComponent({name:"imask-input",inheritAttrs:!1,props:{modelValue:String,value:String,unmasked:String,typed:{validator:()=>!0},...ka},emits:["update:modelValue","update:masked","update:value","update:unmasked","update:typed","accept","accept:value","accept:masked","accept:unmasked","accept:typed","complete","complete:value","complete:masked","complete:unmasked","complete:typed"],setup(s,e){let{attrs:t,emit:i}=e;const{el:o,mask:n,masked:r,unmasked:c,typed:d}=ba(Ca(s,_a),{emit:i,onAccept:g=>{const m=r.value;i("accept:value",m,g),i("update:value",m,g),i("update:masked",m,g),i("update:modelValue",m,g),i("update:unmasked",c.value,g),i("update:typed",d.value,g)},onComplete:g=>{i("complete:value",r.value,g)}}),p=a.toRef(s,"value"),h=a.toRef(s,"modelValue"),y=a.toRef(s,"unmasked"),l=a.toRef(s,"typed");return r.value=h.value||p.value||"",c.value=y.value||"",d.value=l.value,a.watch(p,g=>r.value=g),a.watch(h,g=>r.value=g),a.watch(y,g=>c.value=g),a.watch(l,g=>d.value=g),()=>{const g={...t,value:s.value!=null?s.value:s.modelValue!=null?s.modelValue:n.value?n.value.displayValue:"",ref:o};return s.mask||(g.onInput=m=>{i("update:modelValue",m.target.value),i("update:value",m.target.value)}),a.h("input",g)}}}),Sa=Ea;const wa=["for"],Fa={class:"state-layer"},xa={class:"content"},La={class:"input-text-container"},Ba=["id","placeholder","aria-label"],Aa={key:1,class:"has-text-body-small phila-supporting-text"},Va={key:2,class:"has-text-body-small phila-error-text"},Da=a.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)}`},imaskProps:{default:void 0},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue","complete"],setup(s,{emit:e}){const t=a.useAttrs(),i=s,o=a.computed(()=>typeof i.error=="string"?i.error:i.error[0]),n=a.toRef(i,"id"),r=e,c=a.ref(""),d=a.computed({get:()=>i.modelValue!==void 0?i.modelValue:c.value,set:m=>{r("update:modelValue",m),c.value=m}}),p=a.computed(()=>{const m=["default-class"];return t.disabled!=null&&m.push("phila-input--disabled"),o.value&&m.push("phila-input--error"),t.required!=null&&m.push("phila-input--required"),X.cn(...m)}),h=a.computed(()=>{const m=[];return d.value!==""&&m.push("phila-text-field--filled"),i.className&&m.push(i.className),X.cn(...m)}),y=a.computed(()=>{if(!(i.label||t["aria-label"]))return i.placeholder||void 0}),l=a.ref(null),g=m=>{m.target.closest("button")||l.value?.focus()};return(m,k)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["phila-input",p.value])},[i.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:n.value,class:"has-text-label-small phila-label"},a.toDisplayString(i.label),9,wa)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["phila-text-field",h.value]),onClick:a.withModifiers(g,["prevent"])},[a.createElementVNode("div",Fa,[i.leadingIcon?(a.openBlock(),a.createBlock(a.unref(X.Icon),{key:0,"icon-class":i.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):a.createCommentVNode("",!0),a.createElementVNode("div",xa,[a.createElementVNode("div",La,[i.imaskProps?.mask?(a.openBlock(),a.createBlock(a.unref(Sa),a.mergeProps({key:0},{...a.unref(t),...i.imaskProps},{id:n.value,modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=b=>d.value=b),class:"phila-text-field-input has-text-body-default",placeholder:i.placeholder,onComplete:k[1]||(k[1]=()=>r("complete",c.value))}),null,16,["id","modelValue","placeholder"])):a.withDirectives((a.openBlock(),a.createElementBlock("input",a.mergeProps({key:1},a.unref(t),{id:n.value,"onUpdate:modelValue":k[2]||(k[2]=b=>d.value=b),class:"phila-text-field-input has-text-body-default",placeholder:i.placeholder,"aria-label":y.value}),null,16,Ba)),[[a.vModelDynamic,d.value]])])]),d.value!=""?(a.openBlock(),a.createBlock(a.unref(ia),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":a.unref(ra),onClick:k[3]||(k[3]=b=>d.value="")},null,8,["icon-definition"])):a.createCommentVNode("",!0),i.trailingIcon?(a.openBlock(),a.createBlock(a.unref(X.Icon),{key:2,size:"small","icon-class":i.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):a.createCommentVNode("",!0),a.renderSlot(m.$slots,"trailing-action")])],2),i.supportingText?(a.openBlock(),a.createElementBlock("div",Aa,a.toDisplayString(i.supportingText),1)):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createElementBlock("div",Va,[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(oa),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),a.createTextVNode(" "+a.toDisplayString(o.value),1)])):a.createCommentVNode("",!0)],2))}});var Ia={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"]},Ta={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"]},Ma={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"]},It={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"]},Pa={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"]},Ra={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 Na={key:0,class:"loading-indicator",role:"status"},Oa=["aria-label"],$a={key:2,class:"zoom-indicator"},za=a.defineComponent({__name:"LayerStatusIndicators",props:{loading:{type:Boolean},error:{},unavailable:{type:Boolean}},setup(s){return(e,t)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[s.loading&&!s.unavailable?(a.openBlock(),a.createElementBlock("span",Na," Loading... ")):a.createCommentVNode("",!0),s.error?(a.openBlock(),a.createElementBlock("span",{key:1,class:"error-indicator","aria-label":s.error,role:"status"}," Error ",8,Oa)):a.createCommentVNode("",!0),s.unavailable?(a.openBlock(),a.createElementBlock("span",$a," (zoom in) ")):a.createCommentVNode("",!0)],64))}}),at=ke(za,[["__scopeId","data-v-19b1b402"]]),Ua={class:"opacity-control"},ja=["for"],Za=["id","value","aria-label"],qa=a.defineComponent({__name:"LayerOpacitySlider",props:{layerId:{},layerName:{},opacity:{}},emits:["update:opacity"],setup(s,{emit:e}){const t=e;function i(o){const n=o.target;t("update:opacity",parseFloat(n.value))}return(o,n)=>(a.openBlock(),a.createElementBlock("div",Ua,[a.createElementVNode("label",{class:"opacity-label",for:"opacity-"+s.layerId}," Opacity: "+a.toDisplayString(Math.round(s.opacity*100))+"% ",9,ja),a.createElementVNode("input",{id:"opacity-"+s.layerId,type:"range",min:"0",max:"1",step:"0.05",value:s.opacity,"aria-label":"Opacity for "+s.layerName,class:"opacity-slider",onInput:i},null,40,Za)]))}}),_t=ke(qa,[["__scopeId","data-v-1a025f6a"]]),Wa=["aria-label"],Ha={key:3,class:"legend-label"},Ga=a.defineComponent({__name:"LayerLegend",props:{items:{},label:{}},setup(s){return(e,t)=>(a.openBlock(),a.createElementBlock("ul",{class:"layer-legend","aria-label":s.label},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.items,(i,o)=>(a.openBlock(),a.createElementBlock("li",{key:o,class:"legend-item"},[i.type==="circle"?(a.openBlock(),a.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:a.normalizeStyle({backgroundColor:i.color}),"aria-hidden":"true"},null,4)):i.type==="line"?(a.openBlock(),a.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:a.normalizeStyle({backgroundColor:i.color,height:`${i.width||2}px`}),"aria-hidden":"true"},null,4)):i.type==="fill"?(a.openBlock(),a.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:a.normalizeStyle({backgroundColor:i.color,borderColor:i.outlineColor||"#666",borderWidth:i.outlineColor?`${Math.max(i.outlineWidth||2,2)}px`:void 0}),"aria-hidden":"true"},null,4)):a.createCommentVNode("",!0),s.items.length>1?(a.openBlock(),a.createElementBlock("span",Ha,a.toDisplayString(i.label),1)):a.createCommentVNode("",!0)]))),128))],8,Wa))}}),Et=ke(Ga,[["__scopeId","data-v-3a9206ab"]]);function St(s){function e(r){return s().visibleLayerIds.has(r)}function t(r){return s().layerOpacities[r]??1}function i(r){return s().loadingLayerIds.has(r)}function o(r){return s().layerErrors[r]||null}function n(r){const c=s().currentZoom,d=r.minZoom,p=r.maxZoom;return!(d!==void 0&&c<d||p!==void 0&&c>p)}return{isVisible:e,getLayerOpacity:t,isLayerLoading:i,getLayerError:o,isLayerAvailableAtZoom:n}}const Ka={class:"layer-panel"},Ya={key:0,class:"search-box"},Xa={key:1,class:"topics-container"},Ja={class:"layer-row"},Qa=["href","aria-label"],ei={key:1,class:"metadata-placeholder"},ti=["checked","disabled","onChange"],ai={class:"layer-title"},ii={key:0,class:"no-results"},si=a.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(s,{emit:e}){const t=s,i=e,o=a.computed(()=>{if(!t.searchQuery.trim())return t.layerList;const m=t.searchQuery.toLowerCase();return t.layerList.filter(k=>k.config.title.toLowerCase().includes(m))});function n(m){const k=bt(m);return t.layerMetadata[k]||null}const r=a.computed(()=>t.layerList.some(m=>n(m.config.url))),{isVisible:c,getLayerOpacity:d,isLayerLoading:p,getLayerError:h,isLayerAvailableAtZoom:y}=St(()=>({visibleLayerIds:t.visibleLayers,layerOpacities:t.layerOpacities,loadingLayerIds:t.loadingLayers,layerErrors:t.layerErrors,currentZoom:t.currentZoom})),l=a.computed({get:()=>t.searchQuery,set:m=>i("updateSearch",m)});function g(m){i("toggleLayer",m)}return(m,k)=>(a.openBlock(),a.createElementBlock("div",Ka,[s.showSearch?(a.openBlock(),a.createElementBlock("div",Ya,[a.createVNode(a.unref(Da),{modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=b=>l.value=b),placeholder:s.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":a.withCtx(()=>[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(Ia),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):a.createCommentVNode("",!0),s.mode==="topics"?(a.openBlock(),a.createElementBlock("div",Xa,[a.renderSlot(m.$slots,"topics",{},()=>[k[2]||(k[2]=a.createElementVNode("div",{class:"no-topics"},' No topic components provided. Use the "topics" slot to add TopicAccordion components. ',-1))],!0)])):(a.openBlock(),a.createElementBlock("div",{key:2,class:a.normalizeClass(["layer-list",{"has-metadata":r.value}])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,b=>(a.openBlock(),a.createElementBlock("div",{key:b.config.id,class:"layer-item"},[a.createElementVNode("div",Ja,[n(b.config.url)?(a.openBlock(),a.createElementBlock("a",{key:0,href:n(b.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+b.config.title,onClick:k[1]||(k[1]=a.withModifiers(()=>{},["stop"]))},[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(Ra),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Qa)):r.value?(a.openBlock(),a.createElementBlock("span",ei)):a.createCommentVNode("",!0),a.createElementVNode("label",{class:a.normalizeClass(["layer-checkbox",{"layer-unavailable":!a.unref(y)(b.config),"layer-error":a.unref(h)(b.config.id)}])},[a.createElementVNode("input",{type:"checkbox",checked:a.unref(c)(b.config.id),disabled:!a.unref(y)(b.config),onChange:L=>g(b.config.id)},null,40,ti),a.createElementVNode("span",ai,[a.createTextVNode(a.toDisplayString(b.config.title)+" ",1),a.createVNode(at,{loading:a.unref(p)(b.config.id),error:a.unref(h)(b.config.id),unavailable:!a.unref(y)(b.config)},null,8,["loading","error","unavailable"])])],2)]),s.showOpacity&&a.unref(c)(b.config.id)&&a.unref(y)(b.config)?(a.openBlock(),a.createBlock(_t,{key:0,"layer-id":b.config.id,"layer-name":b.config.title,opacity:a.unref(d)(b.config.id),"onUpdate:opacity":L=>i("setOpacity",b.config.id,L)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):a.createCommentVNode("",!0),s.showLegend&&a.unref(c)(b.config.id)&&a.unref(y)(b.config)&&b.config.legend?.length?(a.openBlock(),a.createBlock(Et,{key:1,items:b.config.legend,label:"Legend for "+b.config.title},null,8,["items","label"])):a.createCommentVNode("",!0)]))),128)),o.value.length===0?(a.openBlock(),a.createElementBlock("div",ii,'No layers match "'+a.toDisplayString(s.searchQuery)+'"',1)):a.createCommentVNode("",!0)],2))]))}}),qt=ke(si,[["__scopeId","data-v-e48bb978"]]),oi={esriSLSSolid:null,esriSLSDash:[6,1.5],esriSLSDot:[1,1.5],esriSLSDashDot:[6,1.5,1,1.5],esriSLSDashDotDot:[6,1.5,1,1.5,1,1.5],esriSLSNull:null};function Ze(s){if(s)return oi[s]??void 0}function ni(s,e,t,i,o){const n=[];let r=e[0],c=[s[0]],d=0;for(let l=1;l<s.length;l++)e[l]===r?c.push(s[l]):(n.push({style:r,breaks:c,startIndex:d}),r=e[l],c=[s[l]],d=l);n.push({style:r,breaks:c,startIndex:d});const p=[],h=new Set;let y=i.minValue??0;for(let l=0;l<n.length;l++){const g=n[l],m=g.breaks,k=Ze(g.style),b=l===0?null:n[l-1].breaks[n[l-1].breaks.length-1].classMaxValue,L=m[m.length-1].classMaxValue;let F;const P=!!i.defaultSymbol;b===null?F=`${!P&&i.minValue!=null?`${t} >= ${i.minValue} AND `:""}${t} <= ${L}`:l===n.length-1&&P?F=`${t} > ${b}`:F=`${t} > ${b} AND ${t} <= ${L}`;const x={"line-opacity":ce(o)};if(k&&(x["line-dasharray"]=k),m.length===1)x["line-color"]=D(m[0].symbol?.color),x["line-width"]=z(m[0].symbol?.width||2);else{const O=["step",["get",t]],J=["step",["get",t]];O.push(D(m[0].symbol?.color)),J.push(z(m[0].symbol?.width||2));for(let M=1;M<m.length;M++)O.push(m[M-1].classMaxValue),O.push(D(m[M].symbol?.color)),J.push(m[M-1].classMaxValue),J.push(z(m[M].symbol?.width||2));x["line-color"]=O,x["line-width"]=J}const B=[];for(const O of m)B.push({type:"line",color:D(O.symbol?.color),width:z(O.symbol?.width||2),label:O.label||`${y} - ${O.classMaxValue}`}),y=O.classMaxValue+1;const T=g.style.replace("esriSLS","").toLowerCase();let W;l===0?W="":h.has(T)?W=`-${T}-${l}`:W=`-${T}`,h.add(T),p.push({suffix:W,where:F,paint:x,legend:B})}return p}function ri(s,e,t,i,o){const n=new Map;for(const p of s){const h=p.symbol?.style||"esriSLSSolid";n.has(h)||n.set(h,[]),n.get(h).push(p)}const r=[],c=new Set;let d=!0;for(const[p,h]of n){const y=Ze(p),g=h.map(F=>`${e} = '${String(F.value).replace(/'/g,"''")}'`).join(" OR "),m={"line-opacity":ce(i)};if(y&&(m["line-dasharray"]=y),h.length===1)m["line-color"]=D(h[0].symbol?.color),m["line-width"]=z(h[0].symbol?.width||2);else{const F=["match",["to-string",["get",e]]];for(const P of h)F.push(Qe(P.value)),F.push(D(P.symbol?.color));F.push(t?D(t.color):"rgba(0, 0, 0, 0)"),m["line-color"]=F,m["line-width"]=z(h[0].symbol?.width||2)}const k=[];for(const F of h){const P=String(F.value),B=o?.get(P)||F.label||P;k.push({type:"line",color:D(F.symbol?.color),width:z(F.symbol?.width||1),label:B})}const b=p.replace("esriSLS","").toLowerCase();let L;d?L="":c.has(b)?L=`-${b}-${r.length}`:L=`-${b}`,c.add(b),d=!1,r.push({suffix:L,where:g,paint:m,legend:k})}return r}function D(s){if(!s||!Array.isArray(s)||s.length<3)return"#888888";const e=s[0],t=s[1],i=s[2],n=(s[3]??255)/255;return n===1?`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`:`rgba(${e}, ${t}, ${i}, ${n.toFixed(2)})`}function ce(s){return s!==void 0?s:1}function z(s){return Math.round(s*(96/72)*10)/10}const li=559082264;function Tt(s){return!s||s<=0?null:Math.round(Math.log2(li/s)*100)/100}function ui(s,e){const t={};if(s&&s>0){const i=Tt(s);i!==null&&(t.minZoom=i)}if(e&&e>0){const i=Tt(e);i!==null&&(t.maxZoom=i)}return t}function ut(s){if(!s)return"fill";switch(s.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(s){return!(!s||s.style==="esriSLSNull"||s.color===null||s.width===0||s.color&&s.color[3]===0)}function Qe(s){return String(s)}function Wt(s,e,t){const i=s.symbol,o=ut(i);let n={},r=[],c=null;if(o==="fill"&&i){const d=i.color===null?0:i.color?.[3]??255,p=d===0?"rgba(0, 0, 0, 0)":D(i.color),h=d===0?0:d<255?1:ce(e);if(n={"fill-color":p,"fill-opacity":h},ye(i.outline)){const y=z(i.outline.width||1);c={"line-color":D(i.outline.color),"line-width":y}}d===0&&ye(i.outline)?r=[{type:"fill",color:"transparent",outlineColor:D(i.outline.color),outlineWidth:z(i.outline.width||1),label:s.label||"Feature"}]:r=[{type:"fill",color:D(i.color),label:s.label||"Feature"}]}else if(o==="line"&&i){n={"line-color":D(i.color),"line-width":z(i.width||1),"line-opacity":ce(e)};const d=Ze(i.style);d&&(n["line-dasharray"]=d),r=[{type:"line",color:D(i.color),width:z(i.width||1),label:s.label||"Feature"}]}else if(o==="circle"&&i){const d=Math.round((i.size||6)*.71*100)/100;n={"circle-color":D(i.color),"circle-radius":d,"circle-opacity":ce(e)},ye(i.outline)&&(n["circle-stroke-color"]=D(i.outline.color),n["circle-stroke-width"]=z(i.outline.width||1)),r=[{type:"circle",color:D(i.color),label:s.label||"Feature"}]}return{paint:n,legend:r,geomType:o,outlinePaint:c}}function ci(s,e,t){const i=s.field1.toLowerCase(),o=s.uniqueValueInfos||[],n=s.defaultSymbol;if(o.length===0)return Wt({...s,symbol:n},e);const r=o[0]?.symbol||n,c=ut(r);let d={};const p=[];let h=null;if(c==="fill"){const y=["match",["to-string",["get",i]]];for(const l of o){y.push(Qe(l.value)),y.push(D(l.symbol?.color));const g=String(l.value),k=t?.get(g)||l.label||g;p.push({type:"fill",color:D(l.symbol?.color),label:k})}if(y.push(n?D(n.color):"rgba(0, 0, 0, 0)"),n&&p.push({type:"fill",color:D(n.color),label:s.defaultLabel||"Other"}),d={"fill-color":y,"fill-opacity":ce(e)},ye(r?.outline)){const l=z(Math.max(r.outline.width||1,1));h={"line-color":D(r.outline.color),"line-width":l}}}else if(c==="line"){const y=["match",["to-string",["get",i]]];for(const m of o){y.push(Qe(m.value)),y.push(D(m.symbol?.color));const k=String(m.value),L=t?.get(k)||m.label||k;p.push({type:"line",color:D(m.symbol?.color),width:z(m.symbol?.width||1),label:L})}y.push(n?D(n.color):"rgba(0, 0, 0, 0)"),n&&p.push({type:"line",color:D(n.color),width:z(n.width||1),label:s.defaultLabel||"Other"}),d={"line-color":y,"line-width":z(r?.width||2),"line-opacity":ce(e)};const l=o.map(m=>m.symbol?.style||"esriSLSSolid"),g=[...new Set(l)];if(g.length>1){const m=ri(o,i,n,e,t);return{paint:{},legend:[],geomType:c,outlinePaint:h,splitLayers:m}}if(g.length===1){const m=Ze(g[0]);m&&(d["line-dasharray"]=m)}}else if(c==="circle"){const y=["match",["to-string",["get",i]]];for(const g of o){y.push(Qe(g.value)),y.push(D(g.symbol?.color));const m=String(g.value),b=t?.get(m)||g.label||m;p.push({type:"circle",color:D(g.symbol?.color),label:b})}y.push(n?D(n.color):"rgba(0, 0, 0, 0)"),n&&p.push({type:"circle",color:D(n.color),label:s.defaultLabel||"Other"});const l=Math.round((r?.size||6)*.71*100)/100;d={"circle-color":y,"circle-radius":l,"circle-opacity":ce(e)},ye(r?.outline)&&(d["circle-stroke-color"]=D(r.outline.color),d["circle-stroke-width"]=z(r.outline.width||1))}return{paint:d,legend:p,geomType:c,outlinePaint:h}}function di(s,e){const t=s.field.toLowerCase(),i=s.classBreakInfos||[],o=s.visualVariables?.find(h=>h.type==="colorInfo");if(o?.stops&&o.stops.length>0)return hi(o,t,s,e);if(i.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const n=i[0]?.symbol,r=ut(n);let c={};const d=[];let p=null;if(r==="fill"){const h=["step",["get",t]];h.push(D(i[0]?.symbol?.color));for(let y=0;y<i.length;y++){const l=i[y];y>0&&(h.push(i[y-1].classMaxValue),h.push(D(l.symbol?.color))),d.push({type:"fill",color:D(l.symbol?.color),label:l.label||`${l.classMaxValue}`})}if(c={"fill-color":h,"fill-opacity":ce(e)},ye(n?.outline)){const y=z(n.outline.width||1);p={"line-color":D(n.outline.color),"line-width":y}}}else if(r==="line"){const h=i.map(L=>L.symbol?.style||"esriSLSSolid"),y=[...new Set(h)];if(y.length>1){const L=ni(i,h,t,s,e);return{paint:{},legend:[],geomType:r,outlinePaint:p,splitLayers:L}}const g=["step",["get",t]];g.push(D(i[0]?.symbol?.color));let m=s.minValue??0;for(let L=0;L<i.length;L++){const F=i[L];L>0&&(g.push(i[L-1].classMaxValue),g.push(D(F.symbol?.color))),d.push({type:"line",color:D(F.symbol?.color),width:z(F.symbol?.width||n?.width||2),label:F.label||`${m} - ${F.classMaxValue}`}),m=F.classMaxValue+1}const k=z(n?.width||2);c={"line-color":g,"line-width":k,"line-opacity":ce(e)};const b=Ze(y[0]);b&&(c["line-dasharray"]=b)}return{paint:c,legend:d,geomType:r,outlinePaint:p}}function hi(s,e,t,i){const o=s.stops||[];if(o.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const n=t.classBreakInfos?.[0]?.symbol||t.defaultSymbol,r=ut(n);let c={};const d=[];let p=null;if(r==="fill"){const h=["interpolate",["linear"],["get",e]];for(const l of o)h.push(l.value),h.push(D(l.color)),d.push({type:"fill",color:D(l.color),label:l.label||`${l.value}`});if(c={"fill-color":["case",["==",["get",e],null],"rgba(0, 0, 0, 0)",h],"fill-opacity":ce(i)},ye(n?.outline)){const l=z(n.outline.width||1);p={"line-color":D(n.outline.color),"line-width":l}}}return{paint:c,legend:d,geomType:r,outlinePaint:p}}function pi(s,e,t,i){if(!s?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const o=s.renderer;switch(o.type){case"simple":return Wt(o,e);case"uniqueValue":return ci(o,e,t);case"classBreaks":return di(o,e);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function fi(s){if(!s)return null;const e=(s.title||"").replace(/\{([^}]+)\}/g,(n,r)=>`{${r.toLowerCase()}}`),i=(s.fieldInfos||[]).filter(n=>n.visible===!0).map(n=>{const r={field:n.fieldName.toLowerCase(),label:n.label||n.fieldName};return n.format&&(r.format={},n.format.dateFormat&&(r.format.dateFormat=n.format.dateFormat),n.format.digitSeparator!==void 0&&(r.format.digitSeparator=n.format.digitSeparator),n.format.places!==void 0&&(r.format.places=n.format.places),Object.keys(r.format).length===0&&delete r.format),r}),o={title:e,fields:i};return s.showTime&&(o.showTime=!0),o}function mi(s){return s?.definitionExpression}function gi(s){return(s.includes("_")?s.split("_").slice(1).join(" "):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function yi(s){return s.includes("_")?s.split("_").slice(1).join(" "):s}function vi(s){const e=new Map;if(!s)return e;const t=s.split(`
|
|
2
|
+
`),i=/^(\d{1,3})\s+(.+)$/;for(const o of t){const n=o.trim().match(i);if(n){const[,r,c]=n;r&&c&&e.set(r,c.trim())}}return e}async function ki(s){try{const e=await fetch(`${s}?f=json`);if(!e.ok)return null;const t=await e.json();return t.drawingInfo?{drawingInfo:t.drawingInfo,description:t.description}:null}catch{return null}}function Mt(s){const e={id:s.id,title:s.title,type:s.type,url:s.url,opacity:s.opacity,paint:s.paint,legend:s.legend,popup:s.popup};return s.where&&(e.where=s.where),s.minZoom!==void 0&&(e.minZoom=s.minZoom),s.maxZoom!==void 0&&(e.maxZoom=s.maxZoom),s.outlinePaint&&(e.outlinePaint=s.outlinePaint),s.parentId&&(e.parentId=s.parentId),e}async function wt(s){const e=s.operationalLayers||[],t=[],i=["Zoning and Planning_Land Use"];for(const o of e)if(o.url&&!o.title?.toLowerCase().includes("(under construction)")&&!(o.url&&/\/MapServer(\/\d+)?$/i.test(o.url)))try{let n=o.layerDefinition?.drawingInfo,r;const c=!n||!n.renderer,d=i.includes(o.title),p=n?.renderer?.uniqueValueInfos?.[0]?.symbol?.outline||n?.renderer?.defaultSymbol?.outline;if((c||d)&&o.url){const B=await ki(o.url);if(B){if(n=B.drawingInfo,p&&ye(p)&&n?.renderer){const T=n.renderer,W=T.uniqueValueInfos?.[0]?.symbol?.outline||T.defaultSymbol?.outline;if(!ye(W)){for(const O of T.uniqueValueInfos||[])O.symbol&&(O.symbol.outline=p);T.defaultSymbol&&(T.defaultSymbol.outline=p)}}B.description&&(r=vi(B.description),r.size>0)}}const{paint:h,legend:y,geomType:l,outlinePaint:g,splitLayers:m}=pi(n,o.opacity,r,o.title),k=fi(o.popupInfo),b=mi(o.layerDefinition),L=ui(o.layerDefinition?.minScale,o.layerDefinition?.maxScale),F=gi(o.title),P=yi(o.title),x=o.opacity??1;if(m&&m.length>0)for(const B of m){const T=`${F}${B.suffix}`;t.push(Mt({id:T,title:P,type:l,url:o.url,opacity:x,paint:B.paint,legend:B.legend,popup:k,where:b?`(${b}) AND (${B.where})`:B.where,minZoom:L.minZoom,maxZoom:L.maxZoom,parentId:B.suffix?F:void 0}))}else t.push(Mt({id:F,title:P,type:l,url:o.url,opacity:x,paint:h,legend:y,popup:k,where:b,minZoom:L.minZoom,maxZoom:L.maxZoom,outlinePaint:g}))}catch{}return t.sort((o,n)=>o.title.localeCompare(n.title)),t}const Pt={},Ft="376af635c84643cd816a8c5d017a53aa",bi=Ft;function ct(s,e){let t=`https://www.arcgis.com/sharing/rest/content/items/${s}/data?f=json`;return e&&(t+=`&token=${e}`),t}function Ci(){return ct(Ft)}const it=new Map,Ue=new Map;function Ht(s){s?(it.delete(s),Ue.delete(s)):(it.clear(),Ue.clear())}let Xe,Rt=0;async function _i(){const s=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"&&Pt?.VITE_AGO_USERNAME,e=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"&&Pt?.VITE_AGO_PASSWORD;if(!(!s||!e)){if(Xe&&Date.now()<Rt-3e5)return Xe;try{const i=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:s,password:e,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return i.error?void 0:(Xe=i.token,Rt=i.expires,Xe)}catch{return}}}async function Ei(s,e){const t=ct(s,e),i=await fetch(t,{cache:"no-store"});if(!i.ok)throw new Error(`Failed to fetch WebMap: ${i.status} ${i.statusText}`);const o=await i.json();if(o.error)throw new Error(`ArcGIS error: ${o.error.message||o.error.code||"Unknown error"}`);return o}async function Si(s){try{const e=await _i(),t=await Ei(s,e);return await wt(t)}catch(e){throw new Error(`Failed to load dynamic layer configs: ${e instanceof Error?e.message:"Unknown error"}`)}}async function st(s=Ft){const e=it.get(s);if(e)return e;const t=Ue.get(s);if(t)return t;const i=(async()=>{try{const o=await Si(s);return it.set(s,o),o}finally{Ue.delete(s)}})();return Ue.set(s,i),i}function Gt(s){const e=a.ref({}),t=new Map;for(const l of s)e.value[l.id]={data:null,loading:!1,error:null,lastFetched:null};async function i(l){const g=l.id;e.value={...e.value,[g]:{data:e.value[g]?.data??null,lastFetched:e.value[g]?.lastFetched??null,loading:!0,error:null}};try{let m;if(l.type==="http-get"){const k=await fetch(l.url,{method:"GET",...l.options});if(!k.ok)throw new Error(`HTTP ${k.status}: ${k.statusText}`);m=await k.json()}else if(l.type==="http-post"){const k=await fetch(l.url,{method:"POST",...l.options});if(!k.ok)throw new Error(`HTTP ${k.status}: ${k.statusText}`);m=await k.json()}else if(l.type==="esri"){const b=`${l.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,L=await fetch(b,l.options);if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);m=(await L.json()).features?.map(P=>P.attributes)||[]}else throw new Error(`Unknown data source type: ${l.type}`);l.transform&&(m=l.transform(m)),e.value={...e.value,[g]:{data:m,loading:!1,error:null,lastFetched:Date.now()}}}catch(m){const k=m instanceof Error?m.message:"Unknown error";e.value={...e.value,[g]:{data:e.value[g]?.data??null,lastFetched:e.value[g]?.lastFetched??null,loading:!1,error:k}}}}async function o(){await Promise.all(s.map(l=>i(l)))}async function n(l){const g=s.find(m=>m.id===l);g&&await i(g)}function r(l){return e.value[l]?.data??null}const c=a.computed(()=>Object.values(e.value).some(l=>l.loading));function d(l){return e.value[l]?.loading??!1}function p(l){return e.value[l]?.error??null}function h(){for(const l of s)if(l.pollInterval&&l.pollInterval>0){const g=window.setInterval(()=>{i(l)},l.pollInterval);t.set(l.id,g)}}function y(){for(const[,l]of t)window.clearInterval(l);t.clear()}return a.onMounted(()=>{o(),h()}),a.onUnmounted(()=>{y()}),{state:a.readonly(e),isLoading:c,fetchAll:o,refetch:n,getData:r,isSourceLoading:d,getError:p,stopPolling:y}}const wi={class:"layerboard-layout"},Fi=["aria-expanded"],xi={key:0,class:"layerboard-subtitle"},Li={class:"layerboard-mobile-menu-content"},Bi={class:"layerboard-main"},Ai={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},Vi={key:1,class:"layerboard-error",role:"alert"},Di=["aria-expanded","aria-label"],Ii={key:0},Ti={key:1},Mi={class:"sr-only","aria-live":"polite"},Pi=a.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{default:void 0},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},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:()=>({})},popupOverrides:{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:{default:void 0},initialCenter:{default:void 0}},emits:["configs-loaded","load-error","zoom"],setup(s,{expose:e,emit:t}){const i=s,o=t,n=a.ref([]),r=a.ref(!0),c=a.ref(null),d=a.ref(12),p=a.ref(""),h=a.ref(new Set),y=a.ref({}),l=a.ref(new Set),g=a.ref({}),m=a.ref({}),k=a.ref(new Set),b=a.ref({});function L(){const C={};for(const S of i.tiledLayers)C[S.id]=S.opacity??1;b.value=C}function F(C){k.value.has(C)?k.value.delete(C):k.value.add(C),k.value=new Set(k.value)}function P(C,S){S?k.value.add(C):k.value.delete(C),k.value=new Set(k.value)}function x(C,S){b.value={...b.value,[C]:S}}const B=i.dataSources.length>0?Gt(i.dataSources):null,T=a.computed(()=>B?.state.value??{}),W=a.computed(()=>B?.isLoading.value??!1);function O(C){return B?.getData(C)??null}function J(C){return B?.refetch(C)??Promise.resolve()}a.provide("layerboard-layers",a.readonly(n)),a.provide("layerboard-visible",h),a.provide("layerboard-opacities",y),a.provide("layerboard-loading",a.readonly(l)),a.provide("layerboard-errors",a.readonly(g)),a.provide("layerboard-zoom",a.readonly(d)),a.provide("layerboard-toggle-layer",Be),a.provide("layerboard-set-layer-visible",Oe),a.provide("layerboard-set-layers-visible",be),a.provide("layerboard-set-opacity",Se),a.provide("layerboard-tiled-layers",a.readonly(a.computed(()=>i.tiledLayers))),a.provide("layerboard-visible-tiled",k),a.provide("layerboard-tiled-opacities",b),a.provide("layerboard-toggle-tiled",F),a.provide("layerboard-set-tiled-opacity",x),a.provide("layerboard-set-tiled-visible",P),a.provide("layerboard-data-sources-state",T),a.provide("layerboard-data-sources-loading",W),a.provide("layerboard-get-data-source",O),a.provide("layerboard-refetch-data-source",J);const M=a.computed(()=>({backgroundColor:i.themeColor})),Ee=a.computed(()=>({backgroundColor:i.themeColor})),Re=a.computed(()=>({backgroundColor:i.themeColor})),qe=a.computed(()=>({width:le.value?"0":i.sidebarWidth}));async function Ne(){try{r.value=!0,c.value=null;const S=(await st(i.webMapId)).map($=>{let Z=$;const me=i.layerStyleOverrides[$.id];me&&(Z={...Z,paint:me.paint??Z.paint,outlinePaint:me.outlinePaint??Z.outlinePaint,legend:me.legend??Z.legend,type:me.type??Z.type});const Me=i.popupOverrides[$.id]||($.parentId?i.popupOverrides[$.parentId]:void 0);return Me&&Z.popup&&(Z={...Z,popup:{...Z.popup,...Me}}),Z});n.value=S.map($=>({config:$,component:$.type}));const j={};S.forEach($=>{j[$.id]=$.opacity??1}),y.value=j,o("configs-loaded",S)}catch(C){const S=C instanceof Error?C.message:"Failed to load layer configurations";c.value=S,o("load-error",S)}finally{r.value=!1}}async function We(){if(i.fetchMetadata)try{const C="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"),S=await fetch(C);if(!S.ok)return;const j=await S.json(),$={};for(const Z of j.rows||[])if(Z.url_text&&Z.representation){const me=bt(Z.url_text),Me=`https://metadata.phila.gov/#home/representationdetails/${Z.representation}/`;$[me]=Me}m.value=$}catch{}}function dt(C){d.value=C,o("zoom",C)}function Be(C){h.value.has(C)?h.value.delete(C):h.value.add(C),h.value=new Set(h.value)}function Oe(C,S){S?h.value.add(C):h.value.delete(C),h.value=new Set(h.value)}function be(C,S){for(const j of C)S?h.value.add(j):h.value.delete(j);h.value=new Set(h.value)}function Se(C,S){y.value={...y.value,[C]:S}}function $e(C,S){S?l.value.add(C):l.value.delete(C),l.value=new Set(l.value)}function ht(C,S){if(S)g.value={...g.value,[C]:S};else{const j={...g.value};delete j[C],g.value=j}}function oe(C){p.value=C}const we=a.ref(null),Q=a.ref(null),Ae=a.ref(null),He=a.ref(null),de=a.ref(null),ze=a.ref(null),Ge=a.ref(null),fe=a.ref("sidebar");function pt(){fe.value=fe.value==="sidebar"?"map":"sidebar",a.nextTick(()=>{fe.value==="sidebar"&&we.value?.focus()})}const ee=a.ref(!1);function Fe(){ee.value=!ee.value,ee.value&&a.nextTick(()=>{He.value?.focus()})}function xe(){ee.value=!1,a.nextTick(()=>{Q.value?.focus()})}const le=a.ref(!1);function Ke(){le.value=!le.value}const te=a.ref(!1),Ve=a.ref(null);function De(){Ve.value=document.activeElement,te.value=!0,a.nextTick(()=>{Ge.value?.focus()})}function ae(){te.value=!1,a.nextTick(()=>{Ve.value?.focus(),Ve.value=null})}function Ie(C){C.target.classList.contains("layerboard-modal-backdrop")&&ae()}function Te(C){if(C.key==="Escape"){xe();return}if(C.key==="Tab"&&de.value){const S=Array.from(de.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(S.length===0)return;const j=S[0],$=S[S.length-1];C.shiftKey?document.activeElement===j&&(C.preventDefault(),$.focus()):document.activeElement===$&&(C.preventDefault(),j.focus())}}function ft(C){if(C.key==="Escape"){ae();return}if(C.key==="Tab"&&ze.value){const S=Array.from(ze.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(S.length===0)return;const j=S[0],$=S[S.length-1];C.shiftKey?document.activeElement===j&&(C.preventDefault(),$.focus()):document.activeElement===$&&(C.preventDefault(),j.focus())}}a.provide("layerboard-open-modal",De),a.provide("layerboard-close-modal",ae),a.provide("layerboard-is-modal-open",a.readonly(te)),e({layerList:n,visibleLayers:h,layerOpacities:y,loadingLayers:l,layerErrors:g,currentZoom:d,toggleLayer:Be,setLayerVisible:Oe,setLayersVisible:be,setLayerOpacity:Se,reloadConfigs:Ne,clearCache:()=>Ht(i.webMapId),visibleTiledLayers:k,tiledLayerOpacities:b,toggleTiledLayer:F,setTiledLayerVisible:P,setTiledLayerOpacity:x,dataSourcesState:T,dataSourcesLoading:W,getDataSourceData:O,refetchDataSource:J,isModalOpen:te,openModal:De,closeModal:ae});function Ye(C){C.key==="Escape"&&ee.value&&xe()}return a.onMounted(()=>{Ne(),We(),L(),document.addEventListener("keydown",Ye)}),a.onBeforeUnmount(()=>{document.removeEventListener("keydown",Ye)}),(C,S)=>(a.openBlock(),a.createElementBlock("div",wi,[S[5]||(S[5]=a.createElementVNode("a",{href:"#main-content",class:"skip-to-main-content-link"},"Skip to main content",-1)),a.createElementVNode("header",{class:"layerboard-header",style:a.normalizeStyle(M.value)},[S[1]||(S[1]=a.createElementVNode("a",{href:"https://www.phila.gov/",class:"layerboard-logo layerboard-desktop-only"},[a.createElementVNode("img",{src:"https://standards.phila.gov/img/logo/city-of-philadelphia-yellow-white.png",alt:"City of Philadelphia"})],-1)),S[2]||(S[2]=a.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only","aria-hidden":"true"},null,-1)),a.createElementVNode("button",{ref_key:"hamburgerRef",ref:Q,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":ee.value,"aria-label":"Toggle menu",onClick:Fe},[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(Pa),size:"medium",inline:"",decorative:""},null,8,["icon-definition"])],8,Fi),a.renderSlot(C.$slots,"header",{},()=>[a.createElementVNode("h1",null,a.toDisplayString(s.title),1),s.subtitle?(a.openBlock(),a.createElementBlock("span",xi,a.toDisplayString(s.subtitle),1)):a.createCommentVNode("",!0)],!0),ee.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:de,class:"layerboard-mobile-menu",role:"dialog","aria-modal":"true","aria-label":"Site menu",style:a.normalizeStyle({backgroundColor:s.themeColor}),onKeydown:Te},[a.createElementVNode("div",Li,[a.renderSlot(C.$slots,"footer",{openModal:De,closeModal:ae,isModalOpen:te.value},()=>[S[0]||(S[0]=a.createTextVNode(" City of Philadelphia ",-1))],!0)]),a.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:He,class:"layerboard-mobile-menu-close","aria-label":"Close menu",onClick:xe},[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(It),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):a.createCommentVNode("",!0),ee.value?(a.openBlock(),a.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:xe})):a.createCommentVNode("",!0)],4),a.createElementVNode("div",Bi,[r.value?(a.openBlock(),a.createElementBlock("div",Ai,[a.createElementVNode("div",{class:"layerboard-spinner",style:a.normalizeStyle({borderTopColor:s.themeColor})},null,4),a.createElementVNode("p",null,"Loading "+a.toDisplayString(s.title)+"...",1)])):c.value?(a.openBlock(),a.createElementBlock("div",Vi,[S[3]||(S[3]=a.createElementVNode("h2",null,"Error Loading Layers",-1)),a.createElementVNode("p",null,a.toDisplayString(c.value),1),a.createElementVNode("button",{class:"layerboard-retry-button",style:a.normalizeStyle({backgroundColor:s.themeColor}),onClick:Ne}," Retry ",4)])):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createElementVNode("aside",{id:"main-content",ref_key:"sidebarRef",ref:we,class:a.normalizeClass(["layerboard-sidebar",{"is-active":fe.value==="sidebar"}]),style:a.normalizeStyle(qe.value),"aria-label":"Map layers",tabindex:"-1"},[a.renderSlot(C.$slots,"sidebar",{layers:n.value,visibleLayers:h.value,layerOpacities:y.value,loadingLayers:l.value,layerErrors:g.value,currentZoom:d.value,toggleLayer:Be,setLayerVisible:Oe,setLayersVisible:be,setOpacity:Se,tiledLayers:s.tiledLayers,visibleTiledLayers:k.value,tiledLayerOpacities:b.value,toggleTiledLayer:F,setTiledLayerVisible:P,setTiledLayerOpacity:x,dataSourcesState:T.value,dataSourcesLoading:W.value,getDataSource:O,refetchDataSource:J},()=>[s.showDefaultSidebar?(a.openBlock(),a.createBlock(qt,{key:0,"layer-list":n.value,"visible-layers":h.value,"layer-opacities":y.value,"loading-layers":l.value,"layer-errors":g.value,"current-zoom":d.value,"search-query":p.value,"layer-metadata":m.value,onToggleLayer:Be,onSetOpacity:Se,onUpdateSearch:oe},null,8,["layer-list","visible-layers","layer-opacities","loading-layers","layer-errors","current-zoom","search-query","layer-metadata"])):a.createCommentVNode("",!0)],!0)],6),a.createElementVNode("div",{role:"main","aria-label":"Map",class:a.normalizeClass(["layerboard-map",{"is-active":fe.value==="map"}])},[a.createVNode(Nt,{"visible-layers":h.value,"layer-opacities":y.value,"layer-list":n.value,"tiled-layers":s.tiledLayers,"visible-tiled-layers":k.value,"tiled-layer-opacities":b.value,"cyclomedia-config":s.cyclomediaConfig,"pictometry-credentials":s.pictometryCredentials,"basemap-control-position":s.basemapControlPosition,"navigation-control-position":s.navigationControlPosition,"geolocation-control-position":s.geolocationControlPosition,"search-control-position":s.searchControlPosition,"draw-control-position":s.drawControlPosition,"cyclomedia-button-position":s.cyclomediaButtonPosition,"pictometry-button-position":s.pictometryButtonPosition,"initial-zoom":s.initialZoom,"initial-center":s.initialCenter,onZoom:dt,onLayerLoading:$e,onLayerError:ht},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),a.createElementVNode("button",{class:a.normalizeClass(["layerboard-sidebar-toggle",{"is-collapsed":le.value}]),style:a.normalizeStyle({left:le.value?"0":i.sidebarWidth}),"aria-expanded":!le.value,"aria-label":le.value?"Expand sidebar":"Collapse sidebar",onClick:Ke},[a.createVNode(a.unref(X.Icon),{"icon-definition":le.value?a.unref(Ta):a.unref(Ma),size:"medium",decorative:""},null,8,["icon-definition"])],14,Di)],64))]),a.createElementVNode("button",{ref_key:"mobileToggleRef",ref:Ae,class:"layerboard-mobile-toggle",style:a.normalizeStyle(Re.value),onClick:pt},[fe.value==="map"?(a.openBlock(),a.createElementBlock("span",Ii,a.toDisplayString(s.sidebarLabel),1)):(a.openBlock(),a.createElementBlock("span",Ti,a.toDisplayString(s.mapLabel),1))],4),a.createElementVNode("footer",{class:"layerboard-footer",style:a.normalizeStyle(Ee.value)},[a.renderSlot(C.$slots,"footer",{openModal:De,closeModal:ae,isModalOpen:te.value},()=>[S[4]||(S[4]=a.createTextVNode(" City of Philadelphia ",-1))],!0)],4),te.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:Ie,onKeydown:ft},[a.createElementVNode("div",{ref_key:"modalRef",ref:ze,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[a.createElementVNode("button",{ref_key:"modalCloseRef",ref:Ge,class:"layerboard-modal-close","aria-label":"Close modal",onClick:ae},[a.createVNode(a.unref(X.Icon),{"icon-definition":a.unref(It),size:"medium",decorative:""},null,8,["icon-definition"])],512),a.renderSlot(C.$slots,"modal",{closeModal:ae},void 0,!0)],512)],32)):a.createCommentVNode("",!0),a.createElementVNode("span",Mi,a.toDisplayString(fe.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),Ri=ke(Pi,[["__scopeId","data-v-1c88d9ba"]]),Ni=["aria-expanded"],Oi={key:0,class:"topic-icon"},$i={class:"topic-title"},zi=a.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{default:void 0},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{default:void 0}},emits:["toggle","layerChange"],setup(s,{emit:e}){const t=s,i=e,o=a.ref(t.expanded),n=`topic-panel-${a.useId()}`,r=`topic-header-${a.useId()}`;a.watch(()=>t.expanded,d=>{o.value=d});function c(){o.value=!o.value,i("toggle",o.value)}return(d,p)=>{const h=a.resolveComponent("font-awesome-icon");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["topic-accordion",{"is-expanded":o.value}])},[a.createElementVNode("button",{id:r,class:a.normalizeClass(["topic-header",s.headerClass]),type:"button","aria-expanded":o.value,"aria-controls":n,onClick:c},[s.icon||d.$slots.icon?(a.openBlock(),a.createElementBlock("span",Oi,[a.renderSlot(d.$slots,"icon",{},()=>[s.icon?(a.openBlock(),a.createBlock(h,{key:0,icon:["fas",s.icon],"aria-hidden":"true"},null,8,["icon"])):a.createCommentVNode("",!0)],!0)])):a.createCommentVNode("",!0),a.createElementVNode("span",$i,a.toDisplayString(s.title),1),a.createElementVNode("span",{class:a.normalizeClass(["topic-chevron",{"is-rotated":o.value}])},[...p[0]||(p[0]=[a.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"},[a.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,Ni),a.withDirectives(a.createElementVNode("div",{id:n,role:"region","aria-labelledby":r,class:"topic-content"},[a.renderSlot(d.$slots,"default",{},()=>[p[1]||(p[1]=a.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[a.vShow,o.value]])],2)}}}),Ui=ke(zi,[["__scopeId","data-v-a2023afa"]]);function Kt(s){return s.displayOptions?.shouldShowCheckbox!==!1}function xt(s,e){return e?s.displayOptions?.shouldShowSlider!==!1:!1}function Lt(s,e){return e?s.displayOptions?.shouldShowLegendBox!==!1:!1}function Ce(s){return s.displayOptions?.layerNameChange||s.title}const ji=["aria-label"],Zi=["checked","disabled","onChange"],qi={class:"layer-title"},Wi={class:"layer-title"},Hi={key:0,class:"empty-state"},Gi=a.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},groupLabel:{default:void 0}},emits:["toggleLayer","setOpacity"],setup(s,{emit:e}){const t=s,i=e,{isVisible:o,getLayerOpacity:n,isLayerLoading:r,getLayerError:c,isLayerAvailableAtZoom:d}=St(()=>t);function p(h){i("toggleLayer",h)}return(h,y)=>(a.openBlock(),a.createElementBlock("fieldset",{class:"layer-checkbox-set",role:"group","aria-label":s.groupLabel},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.layers,l=>(a.openBlock(),a.createElementBlock("div",{key:l.id,class:"layer-item"},[a.unref(Kt)(l)?(a.openBlock(),a.createElementBlock("label",{key:0,class:a.normalizeClass(["layer-checkbox",{"layer-unavailable":!a.unref(d)(l),"layer-error":a.unref(c)(l.id)}])},[a.createElementVNode("input",{type:"checkbox",checked:a.unref(o)(l.id),disabled:!a.unref(d)(l),onChange:g=>p(l.id)},null,40,Zi),a.createElementVNode("span",qi,[a.createTextVNode(a.toDisplayString(a.unref(Ce)(l))+" ",1),a.createVNode(at,{loading:a.unref(r)(l.id),error:a.unref(c)(l.id),unavailable:!a.unref(d)(l)},null,8,["loading","error","unavailable"])])],2)):(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["layer-label-only",{"layer-unavailable":!a.unref(d)(l),"layer-error":a.unref(c)(l.id)}])},[a.createElementVNode("span",Wi,[a.createTextVNode(a.toDisplayString(a.unref(Ce)(l))+" ",1),a.createVNode(at,{loading:a.unref(r)(l.id),error:a.unref(c)(l.id),unavailable:!a.unref(d)(l)},null,8,["loading","error","unavailable"])])],2)),a.unref(xt)(l,s.showOpacity)&&a.unref(o)(l.id)&&a.unref(d)(l)?(a.openBlock(),a.createBlock(_t,{key:2,"layer-id":l.id,"layer-name":a.unref(Ce)(l),opacity:a.unref(n)(l.id),"onUpdate:opacity":g=>i("setOpacity",l.id,g)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):a.createCommentVNode("",!0),a.unref(Lt)(l,s.showLegend)&&a.unref(o)(l.id)&&a.unref(d)(l)&&l.legend?.length?(a.openBlock(),a.createBlock(Et,{key:3,items:l.legend,label:"Legend for "+a.unref(Ce)(l)},null,8,["items","label"])):a.createCommentVNode("",!0)]))),128)),s.layers.length===0?(a.openBlock(),a.createElementBlock("div",Hi,"No layers available")):a.createCommentVNode("",!0)],8,ji))}}),Ki=ke(Gi,[["__scopeId","data-v-bfcd7855"]]),Yi=["aria-label"],Xi=["name","checked","disabled","onChange"],Ji={class:"layer-title"},Qi={key:0,class:"empty-state"},es=a.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"},groupLabel:{default:void 0}},emits:["selectLayer","setOpacity"],setup(s,{emit:e}){const t=s,i=e,{isVisible:o,getLayerOpacity:n,isLayerLoading:r,getLayerError:c,isLayerAvailableAtZoom:d}=St(()=>t);function p(h){const y=t.layers.filter(l=>t.visibleLayerIds.has(l.id)&&l.id!==h).map(l=>l.id);i("selectLayer",h,y)}return(h,y)=>(a.openBlock(),a.createElementBlock("div",{class:"layer-radio-set",role:"radiogroup","aria-label":s.groupLabel},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.layers,l=>(a.openBlock(),a.createElementBlock("div",{key:l.id,class:"layer-item"},[a.createElementVNode("label",{class:a.normalizeClass(["layer-radio",{"layer-unavailable":!a.unref(d)(l),"layer-error":a.unref(c)(l.id)}])},[a.createElementVNode("input",{type:"radio",name:s.groupName,checked:a.unref(o)(l.id),disabled:!a.unref(d)(l),onChange:g=>p(l.id)},null,40,Xi),a.createElementVNode("span",Ji,[a.createTextVNode(a.toDisplayString(a.unref(Ce)(l))+" ",1),a.createVNode(at,{loading:a.unref(r)(l.id),error:a.unref(c)(l.id),unavailable:!a.unref(d)(l)},null,8,["loading","error","unavailable"])])],2),a.unref(xt)(l,s.showOpacity)&&a.unref(o)(l.id)&&a.unref(d)(l)?(a.openBlock(),a.createBlock(_t,{key:0,"layer-id":l.id,"layer-name":a.unref(Ce)(l),opacity:a.unref(n)(l.id),"onUpdate:opacity":g=>i("setOpacity",l.id,g)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):a.createCommentVNode("",!0),a.unref(Lt)(l,s.showLegend)&&a.unref(o)(l.id)&&a.unref(d)(l)&&l.legend?.length?(a.openBlock(),a.createBlock(Et,{key:1,items:l.legend,label:"Legend for "+a.unref(Ce)(l)},null,8,["items","label"])):a.createCommentVNode("",!0)]))),128)),s.layers.length===0?(a.openBlock(),a.createElementBlock("div",Qi,"No layers available")):a.createCommentVNode("",!0)],8,Yi))}}),ts=ke(es,[["__scopeId","data-v-c368d815"]]);function as(s){const e=a.ref([]),t=a.ref(new Set),i=a.ref({}),o=a.ref(new Set),n=a.ref({}),r=a.ref(""),c=a.ref(!1),d=a.ref(!1),p=a.ref(null),h=a.computed(()=>{if(!r.value.trim())return e.value;const x=r.value.toLowerCase();return e.value.filter(B=>B.title.toLowerCase().includes(x))}),y=a.computed(()=>e.value.map(x=>({config:x,component:x.type})));async function l(){if(!d.value){c.value=!0,p.value=null;try{let x;s.mode==="dynamic"||!s.mode?s.webMapId?x=await g(s.webMapId):x=await st():x=await st(),e.value=x;const B={};x.forEach(T=>{B[T.id]=T.opacity??1}),i.value=B,d.value=!0}catch(x){p.value=x instanceof Error?x:new Error("Failed to initialize layerboard")}finally{c.value=!1}}}async function g(x){const B=ct(x),T=await fetch(B,{cache:"no-store"});if(!T.ok)throw new Error(`Failed to fetch WebMap: ${T.status} ${T.statusText}`);const W=await T.json();return wt(W)}function m(x){const B=new Set(t.value);B.has(x)?B.delete(x):B.add(x),t.value=B}function k(x,B){i.value={...i.value,[x]:Math.max(0,Math.min(1,B))}}function b(x){r.value=x}function L(x,B){const T=new Set(o.value);B?T.add(x):T.delete(x),o.value=T}function F(x,B){if(B)n.value={...n.value,[x]:B};else{const T={...n.value};delete T[x],n.value=T}}function P(){e.value=[],t.value=new Set,i.value={},o.value=new Set,n.value={},r.value="",c.value=!1,d.value=!1,p.value=null}return{layerConfigs:a.readonly(e),visibleLayers:a.readonly(t),layerOpacities:a.readonly(i),loadingLayers:a.readonly(o),layerErrors:a.readonly(n),searchQuery:a.readonly(r),isLoading:a.readonly(c),isInitialized:a.readonly(d),error:a.readonly(p),filteredLayerConfigs:h,layerList:y,config:s,initialize:l,toggleLayer:m,setLayerOpacity:k,filterLayers:b,setLayerLoading:L,setLayerError:F,reset:P}}function is(){const s=a.ref([]),e=a.ref(new Set),t=a.ref(new Set);function i(n){e.value.has(n)?e.value.delete(n):e.value.add(n)}function o(n){s.value=n}return{layers:a.computed(()=>s.value),visibleLayerIds:a.computed(()=>e.value),loadingLayerIds:a.computed(()=>t.value),toggleLayer:i,setLayers:o}}function Yt(s){const e=a.ref(null),t=a.ref(!1),i=a.ref(null),o=a.ref(0);async function n(d={}){t.value=!0,i.value=null;const p=s.pageSize||2e3;let h=0,y=[],l=!0;try{for(;l;){const m=s.url.replace(/\/$/,""),k=encodeURIComponent(d.where||s.where||"1=1");let b=`${m}/query?where=${k}&outFields=*&returnGeometry=true&resultRecordCount=${p}&resultOffset=${h}&f=geojson`;if(d.bounds){const P=JSON.stringify({xmin:d.bounds.west,ymin:d.bounds.south,xmax:d.bounds.east,ymax:d.bounds.north,spatialReference:{wkid:4326}});b+=`&geometry=${encodeURIComponent(P)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const L=await fetch(b);if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);const F=await L.json();F.features&&F.features.length>0?(y=y.concat(F.features),h+=F.features.length,l=F.features.length===p):l=!1}const g={type:"FeatureCollection",features:y};return e.value=g,o.value=y.length,g}catch(g){const m=g instanceof Error?g:new Error("Failed to fetch features");throw i.value=m,m}finally{t.value=!1}}function r(){e.value=null,o.value=0,i.value=null}async function c(d={}){return n(d)}return{data:a.readonly(e),isLoading:a.readonly(t),error:a.readonly(i),totalFeatures:a.readonly(o),config:s,fetch:n,refetch:c,clear:r}}function ss(s,e,t){const i=Yt(s);return a.watch(e,async o=>{if(o){const n=t(o);await i.fetch(n)}},{immediate:!0}),i}exports.LayerCheckboxSet=Ki;exports.LayerPanel=qt;exports.LayerRadioButtonSet=ts;exports.Layerboard=Ri;exports.MapPanel=Nt;exports.TopicAccordion=Ui;exports.WEBMAP_ID=bi;exports.buildWebMapUrl=ct;exports.clearCache=Ht;exports.getLayerConfigs=st;exports.getLayerDisplayName=Ce;exports.getWebMapUrl=Ci;exports.normalizeUrl=bt;exports.shouldShowCheckbox=Kt;exports.shouldShowLegendBox=Lt;exports.shouldShowSlider=xt;exports.transformWebMapToLayerConfigs=wt;exports.useApiDataSources=Gt;exports.useDataSource=Yt;exports.useLayerConfig=is;exports.useLayerboard=as;exports.useReactiveDataSource=ss;
|