1let banApiEndpoint="https://api-adresse.data.gouv.fr/";const autoCompleteLive=document.createElement("div");autoCompleteLive.setAttribute("aria-live","polite"),autoCompleteLive.setAttribute("aria-atomic","true"),autoCompleteLive.className="sr-only",document.body.appendChild(autoCompleteLive);const autoCompleteJS=new autoComplete({selector:"#location",threshold:3,searchEngine:"loose",diacritics:!0,data:{src:async e=>{try{const t=await fetch(`${banApiEndpoint}search/?type=municipality&autocomplete=1&limit=50&q=${e}`);return(await t.json()).features.map((e=>{let t=e.properties;return t.geometry=e.geometry,t}))}catch(e){return e}},keys:["label","postcode"]},resultsList:{element:(e,t)=>{autoCompleteLive.textContent=t.results.length?`${t.results.length} résultat(s) disponible(s). Utilisez les flèches pour naviguer.`:`Aucun résultat pour "${t.query}".`},noResults:!0,maxResults:8,tabSelect:!0},resultItem:{element:(e,t)=>{e.setAttribute("aria-label",`${t.value.city}, ${t.value.postcode}, ${t.value.context}`),e.innerHTML=`\n <span aria-hidden="true" style="text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:#fe6000;font-weight:bold;">${t.value.city}</span><br>\n <span aria-hidden="true" style="text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-size:0.8em;">${t.value.postcode} - ${t.value.context}</span>`},highlight:!0},events:{input:{selection:e=>{const t=e.detail.selection.value;sessionStorage.setItem("cityCoord",t.geometry.coordinates),autoCompleteJS.input.value=t.label,autoCompleteLive.textContent=""}}}});document.addEventListener("DOMContentLoaded",(()=>{const e=document.querySelector("#location");e&&(e.addEventListener("navigate",(e=>{const t=e.detail.selection.value;t&&(autoCompleteLive.textContent=`${t.city}, ${t.postcode}, ${t.context}`)})),e.addEventListener("keydown",(e=>{"Enter"===e.key&&document.querySelector("#autoComplete_list_1")&&e.preventDefault()})),e.addEventListener("open",(()=>{e.setAttribute("aria-expanded","true")})),e.addEventListener("close",(()=>{e.setAttribute("aria-expanded","false")})));const w=document.querySelector(".autoComplete_wrapper");w&&w.removeAttribute("role")}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.