@maptiler/geocoding-control 3.0.0-rc.7 → 3.0.0-rc.8

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.
Files changed (39) hide show
  1. package/check-version.js +69 -0
  2. package/dist/check-version.d.ts +1 -0
  3. package/dist/index.js +9 -9
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +3 -3
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/leaflet.public.js +9 -9
  8. package/dist/leaflet.public.js.map +1 -1
  9. package/dist/leaflet.public.umd.js +3 -3
  10. package/dist/leaflet.public.umd.js.map +1 -1
  11. package/dist/maplibregl.js +67 -67
  12. package/dist/maplibregl.js.map +1 -1
  13. package/dist/maplibregl.umd.js +4 -4
  14. package/dist/maplibregl.umd.js.map +1 -1
  15. package/dist/maptilersdk.js +102 -102
  16. package/dist/maptilersdk.js.map +1 -1
  17. package/dist/maptilersdk.umd.js +4 -4
  18. package/dist/maptilersdk.umd.js.map +1 -1
  19. package/dist/openlayers.public.js +11 -10
  20. package/dist/openlayers.public.js.map +1 -1
  21. package/dist/openlayers.public.umd.js +4 -4
  22. package/dist/openlayers.public.umd.js.map +1 -1
  23. package/dist/src/components/clear-icon.d.ts +1 -0
  24. package/dist/src/components/fail-icon.d.ts +1 -0
  25. package/dist/src/components/loading-icon.d.ts +1 -0
  26. package/dist/src/components/marker.d.ts +1 -0
  27. package/dist/src/components/reverse-geocoding-icon.d.ts +1 -0
  28. package/dist/src/components/search-icon.d.ts +1 -0
  29. package/dist/src/controls/maplibregl-control.d.ts +2 -7
  30. package/dist/src/controls/maplibregl-events.d.ts +2 -3
  31. package/dist/src/controls/maplibregl-options.d.ts +1 -9
  32. package/dist/src/geocoder/geocoder-feature-item.d.ts +1 -0
  33. package/dist/src/geocoder/geocoder.d.ts +1 -0
  34. package/dist/src/index.d.ts +1 -0
  35. package/dist/src/leaflet.public.d.ts +1 -0
  36. package/dist/src/maplibregl.d.ts +1 -0
  37. package/dist/src/maptilersdk.d.ts +1 -0
  38. package/dist/src/openlayers.public.d.ts +1 -0
  39. package/package.json +20 -10
@@ -176,7 +176,7 @@
176
176
  </li>
177
177
  `}};B=new WeakSet,pt=function(){return this.feature?.properties?.categories},Ye=function(){return this.feature?.place_type[0]==="reverse"},Y=function(){return this.feature?.properties?.categories?.join(", ")??this.feature?.place_type_name?.[0]??this.feature?.place_type[0]},zi=function(){Vi??=fetch(`${this.iconsBaseUrl}sprite${ji}.json`).then(i=>i.json()).then(i=>{Ie=i}).catch(()=>{Ie=null})},qi=function(){this.imageUrl&&this.missingIconsCache.add(this.imageUrl),Fe(this,B,Dt).call(this)},Dt=function(){Ie!==void 0?Fe(this,B,Wt).call(this):(Fe(this,B,zi).call(this),Vi?.then(()=>{Fe(this,B,Wt).call(this)}))},Wt=function(){do{if(this.index--,this.category=z(this,B,pt)?.[this.index],this.spriteIcon=this.category?Ie?.icons[this.category]:void 0,this.spriteIcon)break;this.imageUrl=this.category?this.iconsBaseUrl+this.category.replace(/ /g,"_")+".svg":void 0}while(this.index>-1&&(!this.imageUrl||this.missingIconsCache.has(this.imageUrl)))},le.styles=Le`
178
178
  ${at(Ms)}
179
- `,me([N({type:Object})],le.prototype,"feature",2),me([N({type:String})],le.prototype,"itemStyle",2),me([N({type:String})],le.prototype,"showPlaceType",2),me([N({attribute:!1})],le.prototype,"missingIconsCache",2),me([N({type:String})],le.prototype,"iconsBaseUrl",2),me([ee()],le.prototype,"category",2),me([ee()],le.prototype,"imageUrl",2),me([ee()],le.prototype,"spriteIcon",2),me([ee()],le.prototype,"index",2),le=me([$e("maptiler-geocoder-feature-item")],le);const Os="form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";var ks=Object.defineProperty,Is=Object.getOwnPropertyDescriptor,Zi=i=>{throw TypeError(i)},k=(i,e,t,r)=>{for(var s=r>1?void 0:r?Is(e,t):e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&ks(e,t,s),s},zt=(i,e,t)=>e.has(i)||Zi("Cannot "+t),ae=(i,e,t)=>(zt(i,e,"read from private field"),t?t.call(i):e.get(i)),Xe=(i,e,t)=>e.has(i)?Zi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),qt=(i,e,t,r)=>(zt(i,e,"write to private field"),e.set(i,t),t),I=(i,e,t)=>(zt(i,e,"access private method"),t),mt,Qe,Ht,Je,T,gt,Ki,jt,te,Vt,yt,Zt,Kt,Me,Yt,vt,Yi,Xt,Xi,Qi,Ji,er,tr,ir,rr;$.MaptilerGeocoderElement=class extends oe{constructor(){super(...arguments),Xe(this,T),this.clearListOnPick=!1,this.clearOnBlur=!1,this.collapsed=!1,this.excludeTypes=!1,this.exhaustiveReverseGeocoding=!1,this.fetchFullGeometryOnPick=!1,this.keepListOpen=!1,this.openListOnTop=!1,this.reverseActive=!1,this.searchValue="",this.selectedItemIndex=-1,this.cachedFeatures=[],this.lastSearchUrl="",this.focused=!1,this.isFeatureListVisible=!1,this.isFeatureListInteractedWith=!1,Xe(this,mt,!1),Xe(this,Qe),Xe(this,Ht,new Set),Xe(this,Je)}firstUpdated(){qt(this,mt,!0)}setOptions(e){const t={...e};for(const r of Object.keys(t))Ns.includes(r)||delete t[r];Object.assign(this,t)}setQuery(e){I(this,T,Kt).call(this,e,{external:!0}),I(this,T,Zt).call(this)}submitQuery(e){I(this,T,Yt).call(this,e)}clearList(){I(this,T,Me).call(this),this.picked=void 0,this.selectedItemIndex=-1}focus(e){this.input.focus(e)}blur(){this.input.blur()}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}handleMapChange(e){qt(this,Je,e)}handleMapClick(e){this.reverseActive&&I(this,T,Yi).call(this,e)}willUpdate(e){e.has("error")&&this.error&&console.error("[MapTilerGeocodingControl] Error:",this.error),e.has("enableReverse")&&(this.reverseActive=this.enableReverse==="always"),["picked"].some(t=>e.has(t))&&this.picked&&(this.clearListOnPick&&I(this,T,Me).call(this),this.selectedItemIndex=-1),["searchValue","minLength"].some(t=>e.has(t))&&ae(this,T,jt)&&(I(this,T,Me).call(this),this.error=void 0),["focused","listIsInteractedWith"].some(t=>e.has(t))&&this.clearOnBlur&&!this.focused&&!this.isFeatureListInteractedWith&&(this.searchValue=""),["selectFirst","listFeatures","selectedItemIndex","picked"].some(t=>e.has(t))&&this.selectFirst!==!1&&this.listFeatures?.length&&this.selectedItemIndex==-1&&!this.picked&&(this.selectedItemIndex=0),["listFeatures","selectedItemIndex"].some(t=>e.has(t))&&I(this,T,te).call(this,"select",{feature:ae(this,T,gt)}),["picked"].some(t=>e.has(t))&&this.picked&&this.picked.id!==e.get("picked")?.id&&(this.fetchFullGeometryOnPick&&!this.picked.address&&this.picked.geometry.type==="Point"&&this.picked.place_type[0]!=="reverse"?I(this,T,vt).call(this,this.picked.id,{byId:!0}):Promise.resolve()).then(()=>{I(this,T,te).call(this,"pick",{feature:this.picked})},t=>{t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"||(this.error=t,I(this,T,te).call(this,"pick",{feature:this.picked}))}),["listFeatures","focused","isFeatureListInteractedWith","keepListOpen"].some(t=>e.has(t))&&(this.isFeatureListVisible=!!this.listFeatures?.length&&(this.focused||this.isFeatureListInteractedWith||this.keepListOpen)),["isFeatureListVisible"].some(t=>e.has(t))&&(this.isFeatureListVisible?I(this,T,te).call(this,"featuresshow"):I(this,T,te).call(this,"featureshide")),["reverseActive"].some(t=>e.has(t))&&I(this,T,te).call(this,"reversetoggle",{reverse:this.reverseActive})}render(){return Z`
179
+ `,me([N({type:Object})],le.prototype,"feature",2),me([N({type:String})],le.prototype,"itemStyle",2),me([N({type:String})],le.prototype,"showPlaceType",2),me([N({attribute:!1})],le.prototype,"missingIconsCache",2),me([N({type:String})],le.prototype,"iconsBaseUrl",2),me([ee()],le.prototype,"category",2),me([ee()],le.prototype,"imageUrl",2),me([ee()],le.prototype,"spriteIcon",2),me([ee()],le.prototype,"index",2),le=me([$e("maptiler-geocoder-feature-item")],le);const Os="form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";var ks=Object.defineProperty,Is=Object.getOwnPropertyDescriptor,Zi=i=>{throw TypeError(i)},k=(i,e,t,r)=>{for(var s=r>1?void 0:r?Is(e,t):e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&ks(e,t,s),s},zt=(i,e,t)=>e.has(i)||Zi("Cannot "+t),ae=(i,e,t)=>(zt(i,e,"read from private field"),t?t.call(i):e.get(i)),Xe=(i,e,t)=>e.has(i)?Zi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),qt=(i,e,t,r)=>(zt(i,e,"write to private field"),e.set(i,t),t),I=(i,e,t)=>(zt(i,e,"access private method"),t),mt,Qe,Ht,Je,T,gt,Ki,jt,te,Vt,yt,Zt,Kt,Me,Yt,vt,Yi,Xt,Xi,Qi,Ji,er,tr,ir,rr;$.MaptilerGeocoderElement=class extends oe{constructor(){super(...arguments),Xe(this,T),this.clearListOnPick=!1,this.clearOnBlur=!1,this.collapsed=!1,this.excludeTypes=!1,this.exhaustiveReverseGeocoding=!1,this.fetchFullGeometryOnPick=!1,this.keepListOpen=!1,this.openListOnTop=!1,this.reverseActive=!1,this.searchValue="",this.selectedItemIndex=-1,this.cachedFeatures=[],this.lastSearchUrl="",this.focused=!1,this.isFeatureListVisible=!1,this.isFeatureListInteractedWith=!1,Xe(this,mt,!1),Xe(this,Qe),Xe(this,Ht,new Set),Xe(this,Je)}firstUpdated(){qt(this,mt,!0)}setOptions(e){const t={...e};for(const r of Object.keys(t))Ns.includes(r)||delete t[r];Object.assign(this,t)}setQuery(e){I(this,T,Kt).call(this,e,{external:!0}),I(this,T,Zt).call(this)}submitQuery(e){I(this,T,Yt).call(this,e,{external:!0})}clearList(){I(this,T,Me).call(this),this.picked=void 0,this.selectedItemIndex=-1}focus(e){this.input.focus(e)}blur(){this.input.blur()}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}handleMapChange(e){qt(this,Je,e)}handleMapClick(e){this.reverseActive&&I(this,T,Yi).call(this,e)}willUpdate(e){e.has("error")&&this.error&&console.error("[MapTilerGeocodingControl] Error:",this.error),e.has("enableReverse")&&(this.reverseActive=this.enableReverse==="always"),["picked"].some(t=>e.has(t))&&this.picked&&(this.clearListOnPick&&I(this,T,Me).call(this),this.selectedItemIndex=-1),["searchValue","minLength"].some(t=>e.has(t))&&ae(this,T,jt)&&(I(this,T,Me).call(this),this.error=void 0),["focused","listIsInteractedWith"].some(t=>e.has(t))&&this.clearOnBlur&&!this.focused&&!this.isFeatureListInteractedWith&&(this.searchValue=""),["selectFirst","listFeatures","selectedItemIndex","picked"].some(t=>e.has(t))&&this.selectFirst!==!1&&this.listFeatures?.length&&this.selectedItemIndex==-1&&!this.picked&&(this.selectedItemIndex=0),["listFeatures","selectedItemIndex"].some(t=>e.has(t))&&I(this,T,te).call(this,"select",{feature:ae(this,T,gt)}),["picked"].some(t=>e.has(t))&&this.picked&&this.picked.id!==e.get("picked")?.id&&(this.fetchFullGeometryOnPick&&!this.picked.address&&this.picked.geometry.type==="Point"&&this.picked.place_type[0]!=="reverse"?I(this,T,vt).call(this,this.picked.id,{byId:!0}):Promise.resolve()).then(()=>{I(this,T,te).call(this,"pick",{feature:this.picked})},t=>{t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"||(this.error=t,I(this,T,te).call(this,"pick",{feature:this.picked}))}),["listFeatures","focused","isFeatureListInteractedWith","keepListOpen"].some(t=>e.has(t))&&(this.isFeatureListVisible=!!this.listFeatures?.length&&(this.focused||this.isFeatureListInteractedWith||this.keepListOpen)),["isFeatureListVisible"].some(t=>e.has(t))&&(this.isFeatureListVisible?I(this,T,te).call(this,"featuresshow"):I(this,T,te).call(this,"featureshide")),["reverseActive"].some(t=>e.has(t))&&I(this,T,te).call(this,"reversetoggle",{reverse:this.reverseActive})}render(){return Z`
180
180
  <form @submit=${I(this,T,Vt)} class=${ft({"can-collapse":this.collapsed&&this.searchValue===""})}>
181
181
  <div class="input-group">
182
182
  <button
@@ -256,13 +256,13 @@
256
256
  @pointerenter=${()=>{I(this,T,Ji).call(this,t)}}
257
257
  @select=${()=>{I(this,T,Qi).call(this,e)}}
258
258
  .missingIconsCache=${ae(this,Ht)}
259
- .iconsBaseUrl=${this.iconsBaseUrl??"https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
259
+ .iconsBaseUrl=${this.iconsBaseUrl??"https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.8/icons/"}
260
260
  />
261
261
  `)}
262
262
  </ul>
263
263
  `}
264
264
  </form>
265
- `}},mt=new WeakMap,Qe=new WeakMap,Ht=new WeakMap,Je=new WeakMap,T=new WeakSet,gt=function(){return this.listFeatures?.[this.selectedItemIndex]},Ki=function(){return this.abortController!==void 0},jt=function(){return this.searchValue.length<(this.minLength??2)},te=function(i,...[e]){ae(this,mt)&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,composed:!0,detail:e}))},Vt=function(i){i?.preventDefault(),this.focused=!1,clearTimeout(ae(this,Qe)),this.selectedItemIndex>-1&&this.listFeatures?(this.picked=this.listFeatures[this.selectedItemIndex],this.searchValue=this.picked.place_type[0]==="reverse"?this.picked.place_name:this.picked.place_name.replace(/,.*/,""),this.error=void 0,this.selectedItemIndex=-1):this.searchValue&&I(this,T,vt).call(this,this.searchValue,{exact:!0,external:i===void 0}).then(()=>{this.picked=void 0}).catch(e=>this.error=e)},yt=function(i){try{return ps(i,6)}catch{return!1}},Zt=function(){setTimeout(()=>{this.input.focus(),this.focused=!0,this.input.select()})},Kt=function(i,{external:e=!1}={}){if(this.searchValue=i,I(this,T,te).call(this,"querychange",{query:this.searchValue,reverseCoords:I(this,T,yt).call(this,i)}),this.error=void 0,this.picked=void 0,this.showResultsWhileTyping!==!1){if(clearTimeout(ae(this,Qe)),ae(this,T,jt))return;const t=this.searchValue;qt(this,Qe,window.setTimeout(()=>{I(this,T,vt).call(this,t,{external:e}).catch(r=>this.error=r)},this.debounceSearch??200))}else I(this,T,Me).call(this)},Me=function(){this.listFeatures!==void 0&&(this.listFeatures=void 0,I(this,T,te).call(this,"featuresclear"))},Yt=function(i){this.searchValue=i,I(this,T,te).call(this,"querychange",{query:this.searchValue,reverseCoords:I(this,T,yt).call(this,i)}),this.selectedItemIndex=-1,I(this,T,Vt).call(this)},vt=async function(i,{byId:e=!1,exact:t=!1,external:r=!1}={}){this.error=void 0,this.abortController?.abort();const s=new AbortController;this.abortController=s;try{const n=this.apiUrl??"https://api.maptiler.com/geocoding",o=I(this,T,yt).call(this,i),l=new URL(n+"/"+encodeURIComponent(o?`${o.decimalLongitude},${o.decimalLatitude}`:i)+".json"),u=l.searchParams;this.language!==void 0&&u.set("language",Array.isArray(this.language)?this.language.join(","):this.language??"");const[f]=ae(this,Je)??[void 0];let x=(!o||this.reverseGeocodingTypes===void 0?this.types:this.reverseGeocodingTypes)?.map(G=>typeof G=="string"?G:f===void 0||(G[0]??0)<=f&&f<(G[1]??1/0)?G[2]:void 0).filter(G=>G!==void 0);x&&(x=[...new Set(x)],u.set("types",x.join(",")));const w=!o||this.reverseGeocodingExcludeTypes===void 0?this.excludeTypes:this.reverseGeocodingExcludeTypes;if(w&&u.set("excludeTypes",String(w)),this.bbox&&u.set("bbox",this.bbox.map(G=>G.toFixed(6)).join(",")),this.country&&u.set("country",Array.isArray(this.country)?this.country.join(","):this.country),this.worldview&&u.set("worldview",this.worldview),!e&&!o){const G=this.proximity??[{type:"server-geolocation"}],L=await Ls(ae(this,Je),G,s);L&&u.set("proximity",L),(t||this.showResultsWhileTyping===!1)&&u.set("autocomplete","false"),u.set("fuzzyMatch",String(this.fuzzyMatch!==!1))}const _=this.limit??5,M=this.reverseGeocodingLimit??_;M>1&&x?.length!==1&&console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."),o?(M===1||this.exhaustiveReverseGeocoding||x?.length===1)&&u.set("limit",String(M)):u.set("limit",String(_)),this.apiKey&&u.set("key",this.apiKey),this.adjustUrl?.(l);const C=l.searchParams.get("types")===""&&l.searchParams.get("excludeTypes")!=="true",R=l.toString();if(R===this.lastSearchUrl){e?(this.clearListOnPick&&I(this,T,Me).call(this),this.picked=this.cachedFeatures[0]):(this.listFeatures=this.cachedFeatures,I(this,T,te).call(this,"featureslisted",{features:this.listFeatures,external:r}),this.listFeatures[this.selectedItemIndex]?.id!==ae(this,T,gt)?.id&&(this.selectedItemIndex=-1));return}I(this,T,te).call(this,"request",{urlObj:l}),this.lastSearchUrl=R;let F;if(C)F={type:"FeatureCollection",features:[]};else{const G=await fetch(R,{signal:s.signal,...this.fetchParameters});if(!G.ok)throw new Error(await G.text());F=await G.json()}I(this,T,te).call(this,"response",{url:R,featureCollection:F}),e?(this.clearListOnPick&&I(this,T,Me).call(this),this.picked=F.features[0],this.cachedFeatures=[this.picked]):(this.listFeatures=F.features.filter(this.filter??(()=>!0)),o&&this.listFeatures.unshift({type:"Feature",properties:{},id:`reverse_${o.decimalLongitude}_${o.decimalLatitude}`,text:`${o.decimalLatitude}, ${o.decimalLongitude}`,place_name:o.toCoordinateFormat("DMS"),place_type:["reverse"],place_type_name:["reverse"],center:[o.decimalLongitude,o.decimalLatitude],bbox:[o.decimalLongitude,o.decimalLatitude,o.decimalLongitude,o.decimalLatitude],geometry:{type:"Point",coordinates:[o.decimalLongitude,o.decimalLatitude]}}),I(this,T,te).call(this,"featureslisted",{features:this.listFeatures,external:r}),this.cachedFeatures=this.listFeatures,this.listFeatures[this.selectedItemIndex]?.id!==ae(this,T,gt)?.id&&(this.selectedItemIndex=-1),o&&this.input.focus())}catch(n){if(n&&typeof n=="object"&&"name"in n&&n.name==="AbortError")return;throw n}finally{s===this.abortController&&(this.abortController=void 0)}},Yi=function(i){this.reverseActive=this.enableReverse==="always",I(this,T,Me).call(this),this.picked=void 0,I(this,T,Yt).call(this,`${i[1].toFixed(6)}, ${Ss(i[0],[-180,180],!0).toFixed(6)}`),I(this,T,Zt).call(this)},Xt=function(i){if(!this.listFeatures)return;const e=i.key==="ArrowDown"?1:i.key==="ArrowUp"?-1:0;e&&(this.input.focus(),this.focused=!0,i.preventDefault(),this.picked&&this.selectedItemIndex===-1&&(this.selectedItemIndex=this.listFeatures.findIndex(t=>t.id===this.picked?.id)),this.selectedItemIndex===(this.picked||this.selectFirst!==!1?0:-1)&&e===-1&&(this.selectedItemIndex=this.listFeatures.length),this.selectedItemIndex+=e,this.selectedItemIndex>=this.listFeatures.length&&(this.selectedItemIndex=-1),this.selectedItemIndex<0&&(this.picked||this.selectFirst!==!1)&&(this.selectedItemIndex=0))},Xi=function(i){I(this,T,Kt).call(this,i.target.value)},Qi=function(i){(!this.picked||this.picked.id!==i.id)&&(this.picked=i,this.searchValue=i.place_name)},Ji=function(i){this.selectedItemIndex=i},er=function(){(!this.selectFirst||this.picked)&&(this.selectedItemIndex=-1),this.isFeatureListInteractedWith&&(this.isFeatureListInteractedWith=!1)},tr=function(){this.isFeatureListInteractedWith=!0},ir=function(){setTimeout(()=>{this.isFeatureListInteractedWith=!1})},rr=function(){this.searchValue="",I(this,T,te).call(this,"queryclear"),this.picked=void 0,this.input.focus()},$.MaptilerGeocoderElement.styles=Le`
265
+ `}},mt=new WeakMap,Qe=new WeakMap,Ht=new WeakMap,Je=new WeakMap,T=new WeakSet,gt=function(){return this.listFeatures?.[this.selectedItemIndex]},Ki=function(){return this.abortController!==void 0},jt=function(){return this.searchValue.length<(this.minLength??2)},te=function(i,...[e]){ae(this,mt)&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,composed:!0,detail:e}))},Vt=function(i,{external:e=!1}={}){i?.preventDefault(),this.focused=!1,clearTimeout(ae(this,Qe)),this.selectedItemIndex>-1&&this.listFeatures?(this.picked=this.listFeatures[this.selectedItemIndex],this.searchValue=this.picked.place_type[0]==="reverse"?this.picked.place_name:this.picked.place_name.replace(/,.*/,""),this.error=void 0,this.selectedItemIndex=-1):this.searchValue&&I(this,T,vt).call(this,this.searchValue,{exact:!0,external:e}).then(()=>{this.picked=void 0}).catch(t=>this.error=t)},yt=function(i){try{return ps(i,6)}catch{return!1}},Zt=function(){setTimeout(()=>{this.input.focus(),this.focused=!0,this.input.select()})},Kt=function(i,{external:e=!1}={}){if(this.searchValue=i,I(this,T,te).call(this,"querychange",{query:this.searchValue,reverseCoords:I(this,T,yt).call(this,i)}),this.error=void 0,this.picked=void 0,this.showResultsWhileTyping!==!1){if(clearTimeout(ae(this,Qe)),ae(this,T,jt))return;const t=this.searchValue;qt(this,Qe,window.setTimeout(()=>{I(this,T,vt).call(this,t,{external:e}).catch(r=>this.error=r)},this.debounceSearch??200))}else I(this,T,Me).call(this)},Me=function(){this.listFeatures!==void 0&&(this.listFeatures=void 0,I(this,T,te).call(this,"featuresclear"))},Yt=function(i,{external:e=!1}={}){this.searchValue=i,I(this,T,te).call(this,"querychange",{query:this.searchValue,reverseCoords:I(this,T,yt).call(this,i)}),this.selectedItemIndex=-1,I(this,T,Vt).call(this,void 0,{external:e})},vt=async function(i,{byId:e=!1,exact:t=!1,external:r=!1}={}){this.error=void 0,this.abortController?.abort();const s=new AbortController;this.abortController=s;try{const n=this.apiUrl??"https://api.maptiler.com/geocoding",o=I(this,T,yt).call(this,i),l=new URL(n+"/"+encodeURIComponent(o?`${o.decimalLongitude},${o.decimalLatitude}`:i)+".json"),u=l.searchParams;this.language!==void 0&&u.set("language",Array.isArray(this.language)?this.language.join(","):this.language??"");const[f]=ae(this,Je)??[void 0];let x=(!o||this.reverseGeocodingTypes===void 0?this.types:this.reverseGeocodingTypes)?.map(G=>typeof G=="string"?G:f===void 0||(G[0]??0)<=f&&f<(G[1]??1/0)?G[2]:void 0).filter(G=>G!==void 0);x&&(x=[...new Set(x)],u.set("types",x.join(",")));const w=!o||this.reverseGeocodingExcludeTypes===void 0?this.excludeTypes:this.reverseGeocodingExcludeTypes;if(w&&u.set("excludeTypes",String(w)),this.bbox&&u.set("bbox",this.bbox.map(G=>G.toFixed(6)).join(",")),this.country&&u.set("country",Array.isArray(this.country)?this.country.join(","):this.country),this.worldview&&u.set("worldview",this.worldview),!e&&!o){const G=this.proximity??[{type:"server-geolocation"}],L=await Ls(ae(this,Je),G,s);L&&u.set("proximity",L),(t||this.showResultsWhileTyping===!1)&&u.set("autocomplete","false"),u.set("fuzzyMatch",String(this.fuzzyMatch!==!1))}const _=this.limit??5,M=this.reverseGeocodingLimit??_;M>1&&x?.length!==1&&console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."),o?(M===1||this.exhaustiveReverseGeocoding||x?.length===1)&&u.set("limit",String(M)):u.set("limit",String(_)),this.apiKey&&u.set("key",this.apiKey),this.adjustUrl?.(l);const C=l.searchParams.get("types")===""&&l.searchParams.get("excludeTypes")!=="true",R=l.toString();if(R===this.lastSearchUrl){e?(this.clearListOnPick&&I(this,T,Me).call(this),this.picked=this.cachedFeatures[0]):(this.listFeatures=this.cachedFeatures,I(this,T,te).call(this,"featureslisted",{features:this.listFeatures,external:r}),this.listFeatures[this.selectedItemIndex]?.id!==ae(this,T,gt)?.id&&(this.selectedItemIndex=-1));return}I(this,T,te).call(this,"request",{urlObj:l}),this.lastSearchUrl=R;let F;if(C)F={type:"FeatureCollection",features:[]};else{const G=await fetch(R,{signal:s.signal,...this.fetchParameters});if(!G.ok)throw new Error(await G.text());F=await G.json()}I(this,T,te).call(this,"response",{url:R,featureCollection:F}),e?(this.clearListOnPick&&I(this,T,Me).call(this),this.picked=F.features[0],this.cachedFeatures=[this.picked]):(this.listFeatures=F.features.filter(this.filter??(()=>!0)),o&&this.listFeatures.unshift({type:"Feature",properties:{},id:`reverse_${o.decimalLongitude}_${o.decimalLatitude}`,place_name:`${o.decimalLatitude}, ${o.decimalLongitude}`,text:o.toCoordinateFormat("DMS"),place_type:["reverse"],place_type_name:["reverse"],center:[o.decimalLongitude,o.decimalLatitude],bbox:[o.decimalLongitude,o.decimalLatitude,o.decimalLongitude,o.decimalLatitude],geometry:{type:"Point",coordinates:[o.decimalLongitude,o.decimalLatitude]}}),I(this,T,te).call(this,"featureslisted",{features:this.listFeatures,external:r}),this.cachedFeatures=this.listFeatures,this.listFeatures[this.selectedItemIndex]?.id!==ae(this,T,gt)?.id&&(this.selectedItemIndex=-1),o&&this.input.focus())}catch(n){if(n&&typeof n=="object"&&"name"in n&&n.name==="AbortError")return;throw n}finally{s===this.abortController&&(this.abortController=void 0)}},Yi=function(i){this.reverseActive=this.enableReverse==="always",I(this,T,Me).call(this),this.picked=void 0,I(this,T,Yt).call(this,`${i[1].toFixed(6)}, ${Ss(i[0],[-180,180],!0).toFixed(6)}`),I(this,T,Zt).call(this)},Xt=function(i){if(!this.listFeatures)return;const e=i.key==="ArrowDown"?1:i.key==="ArrowUp"?-1:0;e&&(this.input.focus(),this.focused=!0,i.preventDefault(),this.picked&&this.selectedItemIndex===-1&&(this.selectedItemIndex=this.listFeatures.findIndex(t=>t.id===this.picked?.id)),this.selectedItemIndex===(this.picked||this.selectFirst!==!1?0:-1)&&e===-1&&(this.selectedItemIndex=this.listFeatures.length),this.selectedItemIndex+=e,this.selectedItemIndex>=this.listFeatures.length&&(this.selectedItemIndex=-1),this.selectedItemIndex<0&&(this.picked||this.selectFirst!==!1)&&(this.selectedItemIndex=0))},Xi=function(i){I(this,T,Kt).call(this,i.target.value)},Qi=function(i){(!this.picked||this.picked.id!==i.id)&&(this.picked=i,this.searchValue=i.place_name)},Ji=function(i){this.selectedItemIndex=i},er=function(){(!this.selectFirst||this.picked)&&(this.selectedItemIndex=-1),this.isFeatureListInteractedWith&&(this.isFeatureListInteractedWith=!1)},tr=function(){this.isFeatureListInteractedWith=!0},ir=function(){setTimeout(()=>{this.isFeatureListInteractedWith=!1})},rr=function(){this.searchValue="",I(this,T,te).call(this,"queryclear"),this.picked=void 0,this.input.focus()},$.MaptilerGeocoderElement.styles=Le`
266
266
  ${at(Os)}
267
267
  `,k([N({attribute:!1})],$.MaptilerGeocoderElement.prototype,"adjustUrl",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"apiKey",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"apiUrl",2),k([N({type:Array})],$.MaptilerGeocoderElement.prototype,"bbox",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"clearButtonTitle",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"clearListOnPick",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"clearOnBlur",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"collapsed",2),k([N({attribute:!1})],$.MaptilerGeocoderElement.prototype,"country",2),k([N({type:Number})],$.MaptilerGeocoderElement.prototype,"debounceSearch",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"enableReverse",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"errorMessage",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"excludeTypes",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"exhaustiveReverseGeocoding",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"fetchFullGeometryOnPick",2),k([N({type:Object})],$.MaptilerGeocoderElement.prototype,"fetchParameters",2),k([N({attribute:!1})],$.MaptilerGeocoderElement.prototype,"filter",2),k([N({type:Object})],$.MaptilerGeocoderElement.prototype,"fuzzyMatch",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"iconsBaseUrl",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"keepListOpen",2),k([N({attribute:!1})],$.MaptilerGeocoderElement.prototype,"language",2),k([N({type:Number})],$.MaptilerGeocoderElement.prototype,"limit",2),k([N({type:Number})],$.MaptilerGeocoderElement.prototype,"minLength",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"noResultsMessage",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"openListOnTop",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"placeholder",2),k([N({type:Array})],$.MaptilerGeocoderElement.prototype,"proximity",2),k([N({type:Boolean})],$.MaptilerGeocoderElement.prototype,"reverseActive",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"reverseButtonTitle",2),k([N({type:Object})],$.MaptilerGeocoderElement.prototype,"reverseGeocodingExcludeTypes",2),k([N({type:Number})],$.MaptilerGeocoderElement.prototype,"reverseGeocodingLimit",2),k([N({type:Array})],$.MaptilerGeocoderElement.prototype,"reverseGeocodingTypes",2),k([N({type:Object})],$.MaptilerGeocoderElement.prototype,"selectFirst",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"showPlaceType",2),k([N({type:Object})],$.MaptilerGeocoderElement.prototype,"showResultsWhileTyping",2),k([N({type:Array})],$.MaptilerGeocoderElement.prototype,"types",2),k([N({type:String})],$.MaptilerGeocoderElement.prototype,"worldview",2),k([Vr("input")],$.MaptilerGeocoderElement.prototype,"input",2),k([ee()],$.MaptilerGeocoderElement.prototype,"searchValue",2),k([ee()],$.MaptilerGeocoderElement.prototype,"listFeatures",2),k([ee()],$.MaptilerGeocoderElement.prototype,"selectedItemIndex",2),k([ee()],$.MaptilerGeocoderElement.prototype,"picked",2),k([ee()],$.MaptilerGeocoderElement.prototype,"cachedFeatures",2),k([ee()],$.MaptilerGeocoderElement.prototype,"lastSearchUrl",2),k([ee()],$.MaptilerGeocoderElement.prototype,"error",2),k([ee()],$.MaptilerGeocoderElement.prototype,"abortController",2),k([ee()],$.MaptilerGeocoderElement.prototype,"focused",2),k([ee()],$.MaptilerGeocoderElement.prototype,"isFeatureListVisible",2),k([ee()],$.MaptilerGeocoderElement.prototype,"isFeatureListInteractedWith",2),$.MaptilerGeocoderElement=k([$e("maptiler-geocoder")],$.MaptilerGeocoderElement);const Ns=["adjustUrl","apiKey","apiUrl","bbox","clearButtonTitle","clearListOnPick","clearOnBlur","collapsed","country","debounceSearch","enableReverse","errorMessage","excludeTypes","reverseGeocodingExcludeTypes","exhaustiveReverseGeocoding","fetchParameters","fetchFullGeometryOnPick","filter","fuzzyMatch","iconsBaseUrl","keepListOpen","language","limit","reverseGeocodingLimit","minLength","noResultsMessage","openListOnTop","placeholder","proximity","reverseActive","reverseButtonTitle","selectFirst","showPlaceType","showResultsWhileTyping","types","reverseGeocodingTypes","worldview"],Ps="svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";var Rs=Object.getOwnPropertyDescriptor,Gs=(i,e,t,r)=>{for(var s=r>1?void 0:r?Rs(e,t):e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=o(s)||s);return s};$.MaptilerGeocodeMarkerElement=class extends oe{render(){return qe`
268
268
  <svg