diff --git a/assets/ast-CRAGgpBz.js.map b/assets/ast-CRAGgpBz.js.map deleted file mode 100644 index 7bcd1da5..00000000 --- a/assets/ast-CRAGgpBz.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ast-CRAGgpBz.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/assets/ast-CRAGgpBz.js b/assets/ast_ES-CRAGgpBz.js similarity index 99% rename from assets/ast-CRAGgpBz.js rename to assets/ast_ES-CRAGgpBz.js index defff925..d9a0a6d9 100644 --- a/assets/ast-CRAGgpBz.js +++ b/assets/ast_ES-CRAGgpBz.js @@ -1,2 +1,2 @@ const e={"nav.run":"Executar","nav.run_tt":"executar esta consulta na API d'Overpass","nav.rerender_tt":"parse the MapCSS and rerender the map","nav.share":"Compartir","nav.share_tt":"enllaz permanente a la consulta","nav.export":"Esportar","nav.export_tt":"delles ferramientes d'esportación","nav.save":"Guardar","nav.save_tt":"Guardar esta consulta","nav.load":"Cargar","nav.load_tt":"cargar un exemplu o consulta guardáu","nav.wizard":"Asistente","nav.wizard_tt":"constructor de consultes","nav.settings":"Configuración","nav.settings_tt":"delles configuraciones","nav.help":"Ayuda","nav.help_tt":"ayuda, tocante a, y atribuciones","nav.logout":"Colar","nav.logout_tt":"colar de la cuenta d'osm sincronizada actualmente","tabs.map":"Mapa","tabs.map_tt":"vista de mapa","tabs.data":"Datos","tabs.data_tt":"vista de datos","map_controlls.zoom_to_data":"averar a los datos","map_controlls.localize_user":"¡alcontrame!","map_controlls.localize_user_disabled":"disabled because overpass turbo has not been loaded via https://","map_controlls.select_bbox":"seleicionar bbox a mano","map_controlls.select_bbox_disabled":"desactiváu porque la consulta actual nun rique bbox","map_controlls.toggle_wide_map":"cambiar el mapa anchu","map_controlls.toggle_data":"ver o nun ver la capa de datos","map_controlls.suggest_zoom_to_data":"primi equí pa ver los datos","settings.title":"Configuración","settings.section.general":"Configuración xeneral","settings.ui_lang":"Llingua de la interfaz","settings.server":"Sirvidor","settings.disable_autorepair":"Desactivar el mensaxe d'avisu/autoreparación cuando la API d'Overpass nun devuelve datos visibles.","settings.section.editor":"Editor","settings.enable_rich_editor":"Activar l'editor de códigu arriquecíu","settings.enable_rich_editor_expl":"desactivar esto nos preseos móviles, rique una recarga de páxina pa tener efeutu","settings.editor_width":"Anchor del editor","settings.editor_width_expl":'p.ex. "400px", dexar en blancu pal predetermináu',"settings.section.map":"Mapa","settings.tile_server":"Sirvidor de cuadros","settings.tile_opacity":"Tresparencia de los cuadros","settings.tile_opacity_expl":"transparency of background tiles: 0=transparent … 1=visible","settings.show_crosshairs":"Ver cruz de filos nel centru del mapa.","settings.disable_poiomatic":"Nun amosar les resultancies pequeñes como PDI.","settings.show_data_stats":"Ver delles estadístiques de los datos cargaos y amosaos.","settings.section.sharing":"Compartir","settings.include_map_state":"Incluir l'estáu actual del mapa nos enllaces compartíos","settings.compression":"Compresión","settings.section.export":"Esportar","settings.export_image_scale":"Amosar la escala nes imáxenes esportaes.","settings.export_image_attr":"Amosar l'atribución nes imáxenes esportaes.","save.title":"Guardar","save.enter_name":"Escribi un nome pa esta consulta","load.title":"Cargar","load.delete_query":"desaniciar esta consulta","load.saved_queries-local":"Consultes guardaes (llocal)","load.saved_queries-osm":"Consultes guardaes (osm.org)","load.saved_queries-osm-loading":"Cargando consultes guardaes d'osm.org...","load.saved_queries-osm-error":"An error occurred while loading saved queries from osm.org :(","load.examples":"Exemplos","load.no_saved_query":"entá nun hai consultes guardaes","export.title":"Esportar","export.download-error":"Export - Error","export.copy_to_clipboard":"Copy this text to clipboard","export.copy_to_clipboard_success":"Export - Successfully copied to clipboard","export.copy_to_clipboard_success-message":' was successfully copied to the clipboard.',"export.section.map":"Mapa","export.as_png":'como imaxe png',"export.as_interactive_map":'como Mapa interactivu',"export.current_map_view":'vista del mapa actual',"export.map_view_expl":"bbox, centru, etc.","export.section.data":"Datos","export.generic_download_copy":'
{if(x)return B(x);const D=S.querySelector("preferences"),H=D.querySelectorAll(`preference[k^="${configs.settingNamespace}_query"]`);for(const Y of H)Y.remove();let P=!0;Q.forEach((Y,G)=>{Y.name==g.name&&(Y.query=g.query,P=G)}),P===!0?Q.push(g):g.deleteMe&&Q.splice(P,1);const R=S.createElement("preference");R.setAttribute("k",`${configs.settingNamespace}_query-count`),R.setAttribute("v",Q.length),D.appendChild(R);for(let Y=0;Y200)return B(new Error("query name too long to be saved on osm.org"));const X=Math.ceil((G.query.length+G.name.length+8)/255);if(X>9)return B(new Error("query too long to be saved on osm.org"));let ee=`p=${X}`;ee+=`&n=${G.name}`,ee+=`&q=${G.query}`,ee=ee.match(/.{1,255}/g);for(let Ae=0;Ae {if(Y)return B(Y);B(null,Q)})})}const cache={};class nominatim{static request(B,x){$.ajax(`https://nominatim.openstreetmap.org/search?X-Requested-With=${configs.appname}`,{data:{format:"json",q:B},success(Q){if(typeof Q=="string")try{Q=JSON.parse(Q)}catch{}cache[B]=Q,x(void 0,Q)},error(){const Q="An error occurred while contacting the osm search server nominatim.openstreetmap.org :(";console.log(Q),x(Q,null)}})}static get(B,x){return cache[B]===void 0?this.request(B,x):x(void 0,cache[B]),this}static getBest(B,x,Q){return Q||(Q=x,x=null),this.get(B,(S,D)=>{if(S){Q(S,null);return}x&&(D=D.filter(x)),D.length===0?Q("No result found",null):Q(S,D[0])}),this}}function map2bbox(g){let B;ide.map.bboxfilter&&ide.map.bboxfilter.isEnabled()?B=ide.map.bboxfilter.getBounds():B=ide.map.getBounds();const x=Math.min(Math.max(B.getSouthWest().lat,-90),90),Q=Math.min(Math.max(B.getNorthEast().lat,-90),90),S=Math.min(Math.max(B.getSouthWest().lng,-180),180),D=Math.min(Math.max(B.getNorthEast().lng,-180),180);if(g=="OverpassQL")return`${x},${S},${Q},${D}`;if(g=="xml")return`s="${x}" w="${S}" n="${Q}" e="${D}"`}function map2coord(g){const B=ide.map.getCenter();if(g=="OverpassQL")return`${B.lat},${B.lng}`;if(g=="xml")return`lat="${B.lat}" lon="${B.lng}"`}function relativeTime(g,B){const x=Date.now();if(g==""&&(g="0 seconds"),g=g.toLowerCase().match(/(-?[0-9]+) ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?/),g===null){B("");return}const Q=parseInt(g[1]);let S;switch(g[2]){case"second":case"seconds":S=1;break;case"minute":case"minutes":S=60;break;case"hour":case"hours":S=3600;break;case"day":case"days":default:S=86400;break;case"week":case"weeks":S=604800;break;case"month":case"months":S=2628e3;break;case"year":case"years":S=31536e3;break}const D=x-Q*S*1e3;B(new Date(D).toISOString())}function geocodeId(g,B){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Id");x=="OverpassQL"?D=`${D.osm_type}(${D.osm_id})`:x=="xml"&&(D=`type="${D.osm_type}" ref="${D.osm_id}"`),B(D)})}function geocodeArea(g,B){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id&&S.osm_type!=="node"}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Area");let H=1*D.osm_id;if(D.osm_type=="way"&&(H+=24e8),D.osm_type=="relation"&&(H+=36e8),x=="OverpassQL")return D.osm_type==="way"&&(H+=`,${D.osm_id}`),B(`area(id:${H})`);if(x=="xml")return D.osm_type==="way"&&(H+=`" ref_1="${D.osm_id}`),B(`type="area" ref="${H}"`)})}function geocodeBbox(g,B){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Bbox");const D=Math.min(Math.max(S.boundingbox[0],-90),90),H=Math.min(Math.max(S.boundingbox[1],-90),90),P=Math.min(Math.max(S.boundingbox[2],-180),180),R=Math.min(Math.max(S.boundingbox[3],-180),180);x=="OverpassQL"?S=`${D},${P},${H},${R}`:x=="xml"&&(S=`s="${D}" w="${P}" n="${H}" e="${R}"`),B(S)})}function geocodeCoords(g,B){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Coords");x=="OverpassQL"?S=`${S.lat},${S.lon}`:x=="xml"&&(S=`lat="${S.lat}" lon="${S.lon}"`),B(S)})}function shortcuts(){const g=ide.getQueryLang();return{bbox:map2bbox(g),center:map2coord(g),__bbox__global_bbox_xml__ezs4K8__:map2bbox("OverpassQL"),date:relativeTime,geocodeId,geocodeArea,geocodeBbox,geocodeCoords,nominatimId:g=="xml"?geocodeId:(B,x)=>geocodeId(B,Q=>x(`${Q};`)),nominatimArea:g=="xml"?geocodeArea:(B,x)=>geocodeArea(B,Q=>x(`${Q};`)),nominatimBbox:geocodeBbox,nominatimCoords:geocodeCoords}}let copyData;$(document).on("copy",g=>{copyData&&g.originalEvent&&g.originalEvent.clipboardData?(Object.keys(copyData).forEach(B=>{g.originalEvent.clipboardData.setData(B,copyData[B])}),g.originalEvent.preventDefault(),copyData=void 0):copyData&©Data["text/plain"]&&(prompt(i18n.t("export.copy_to_clipboard"),copyData["text/plain"]),copyData=null)});function make_combobox(g,B,x,Q){if(g[0].is_combobox){g.autocomplete("option",{source:B});return}const S=g.wrap("").parent().addClass("ui-combobox");g.autocomplete({source:B,minLength:0}).addClass("ui-widget ui-widget-content ui-corner-left ui-state-default").autocomplete("instance")._renderItem=(D,H)=>$(" ").append(x&&x.indexOf(H.value)!==-1?` ${H.label}`:`${H.label}`).on("click",function(P){if(P.shiftKey&&x.indexOf(H.value)!==-1){Q(H.value),$(this).remove();const R=g.autocomplete("option","source");return R.splice(R.indexOf(H),1),g.autocomplete("option","source",R),!1}}).appendTo(D),$("").attr("tabIndex",-1).attr("title","show all items").appendTo(S).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("ui-corner-right ui-combobox-toggle").click(()=>{if(g.autocomplete("widget").is(":visible")){g.autocomplete("close");return}g.autocomplete("search",""),g.focus()}),g[0].is_combobox=!0}function showDialog(g,B,x){const Q=``,S=$(Q);$(".delete",S).click(()=>$(S).remove());for(const D in x){const H=x[D];$(``).click(()=>{var P;(P=H.callback)==null||P.call(H),$(S).remove()}).appendTo($("footer .level-item",S))}S.appendTo("body")}class IDE{constructor(){this.attribControl=null,this.scaleControl=null,this.queryParser=new parser,this.run_query_on_startup=!1,this.codeEditor=null,this.dataViewer=null,this.map=null,this.waiter=new class{constructor(){this.opened=!0,this.frames=["◴","◷","◶","◵"],this.frameDelay=250,this.onAbort=void 0,this.interval=0,this._initialTitle=document.title}open(x){x?($(".modal .wait-info h4").text(x),$(".wait-info").show()):$(".wait-info").hide(),$("#loading-dialog").addClass("is-active"),document.title=`${this.frames[0]} ${this._initialTitle}`;let Q=0;this.interval=setInterval(()=>{const S=this.isAlert?this.alertFrame:this.frames[++Q%this.frames.length];document.title=`${S} ${this._initialTitle}`},this.frameDelay),this.opened=!0}close(x=""){this.opened&&(clearInterval(this.interval),document.title=`${x}${this._initialTitle}`,$("#loading-dialog").removeClass("is-active"),$(".wait-info ul li").remove(),delete this.onAbort,this.opened=!1)}addInfo(x,Q){$("#aborter").remove(),$(".wait-info ul li:nth-child(n+1)").css("opacity",.5),$(".wait-info ul li span.fas").removeClass("fa-spinner").removeClass("fa-spin").addClass("fa-check"),$(".wait-info ul li:nth-child(n+4)").hide();const S=$(`${g}
${B} ${x} `);if(typeof Q=="function"){this.onAbort=Q;const D=$(' (abort)').on("click",()=>(this.abort(),!1));S.append(D)}$(".wait-info ul").prepend(S)}abort(){typeof this.onAbort=="function"&&(this.addInfo("aborting"),this.onAbort(this.close))}}}init(){this.waiter.addInfo("ide starting up"),$("#overpass-turbo-version").html("overpass-turbo2024-11-03/59ec758
"),$("#overpass-turbo-dependencies").html('@fortawesome/fontawesome-free 5.15.4 ((CC-BY-4.0 AND OFL-1.1 AND MIT)), @openstreetmap/id-tagging-schema 3.5.1 (ISC), bulma 0.9.4 (MIT), canvg 4.0.1 (MIT), codemirror 2.38.00 (undefined), html2canvas 1.4.1 (MIT), jquery 3.7.1 (MIT), jquery-ui 1.13.2 (MIT), jquery-ui-dist 1.13.2 (MIT), leaflet 1.9.4 (BSD-2-Clause), leaflet-polylineoffset 1.1.1 (MIT), leaflet-locationfilter 0.1.3 (MIT), lodash 4.17.21 (MIT), osm-auth 2.2.0 (ISC), osmtogeojson 3.0.0-beta.5 (MIT), rgbcolor 1.0.1 (MIT OR SEE LICENSE IN FEEL-FREE.md), stackblur 1.0.0 (BSD-2-Clause), tag2link 2024.05.21 (ISC), togpx 0.5.4 (MIT), tokml 0.4.0 (BSD-2-Clause)'),($.support.cors!=!0||typeof function(){let B;try{localStorage.setItem("startup_localstorage_quota_test",123),localStorage.removeItem("startup_localstorage_quota_test"),B=localStorage}catch{}return B}()!="object")&&(this.not_supported=!0,$("#warning-unsupported-browser").addClass("is-active")),this.waiter.addInfo("load settings"),settings.load(),this.waiter.addInfo("translate ui"),i18n.translate().then(()=>this.initAfterI18n()),sync.enabled&&($("#load-dialog .osm").show(),sync.authenticated()&&($("#logout").show(),$("#logout").appendTo($("#logout").parent())))}initAfterI18n(){const B=this;B.waiter.addInfo("parse url parameters");const x=urlParameters();x.has_coords&&(settings.coords_lat=x.coords.lat,settings.coords_lon=x.coords.lng),x.has_zoom&&(settings.coords_zoom=x.zoom),x.run_query&&(B.run_query_on_startup=!0),settings.save(),B.waiter.addInfo("initialize page");const Q=$(window).width()/$(window).height()<.8;if(settings.editor_width!=""&&!Q&&($("#editor").css("width",settings.editor_width),$("#dataviewer").css("left",settings.editor_width)),Q&&$("#editor, #dataviewer").addClass("portrait"),$("#editor").resizable({handles:Q?"s":"e",minWidth:Q?void 0:"200",resize(){if(!Q)$(this).next().css("left",`${$(this).outerWidth()}px`);else{const G=$(this).offset().top+$(this).outerHeight();$(this).next().css("top",`${G}px`)}B.map.invalidateSize(!1)},stop(){Q||(settings.editor_width=$("#editor").css("width"),settings.save())}}),$("#editor").prepend(""),$("#editor textarea")[0].value=settings.code.overpass,settings.use_rich_editor){let G=0;CodeMirror.defineMIME("text/x-overpassQL",{name:"clike",keywords:function(X){const ee={},Ae=X.split(" ");for(const le of Ae)ee[le]=!0;return ee}("out json xml custom popup timeout maxsize bbox date diff adiff foreach relation rel way node is_in area around user uid newer changed poly pivot nwr nw nr wr derived out meta body skel tags ids count qt asc center bb geom")}),CodeMirror.defineMIME("text/x-overpassXML","xml"),CodeMirror.defineMode("xml+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"xml"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),CodeMirror.defineMode("ql+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"text/x-overpassQL"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),B.codeEditor=CodeMirror.fromTextArea($("#editor textarea")[0],{lineNumbers:!0,lineWrapping:!0,mode:"text/plain",onChange(X){clearTimeout(G),G=setTimeout(()=>{B.getQueryLang()=="xml"?X.getOption("mode")!="xml+mustache"&&(X.closeTagEnabled=!0,X.setOption("matchBrackets",!1),X.setOption("mode","xml+mustache")):X.getOption("mode")!="ql+mustache"&&(X.closeTagEnabled=!1,X.setOption("matchBrackets",!0),X.setOption("mode","ql+mustache"));const ee=$(".leaflet-control-buttons-bboxfilter");B.getRawQuery().match(/\{\{bbox\}\}/)?ee.hasClass("disabled")&&(ee.removeClass("disabled"),ee.attr("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(ee[0])):ee.hasClass("disabled")||(ee.addClass("disabled"),ee.attr("data-t","[title]map_controlls.select_bbox_disabled"),i18n.translate_ui(ee[0]))},500),settings.code.overpass=X.getValue(),settings.save()},closeTagEnabled:!0,closeTagIndent:["osm-script","query","union","foreach","difference"],extraKeys:{"'>'"(X){X.closeTag(X,">")},"'/'"(X){X.closeTag(X,"/")}}}),B.codeEditor.getOption("onChange")(B.codeEditor)}else B.codeEditor=$("#editor textarea")[0],B.codeEditor.getValue=function(){return this.value},B.codeEditor.setValue=function(G){this.value=G},B.codeEditor.lineCount=function(){return this.value.split(/\r\n|\r|\n/).length},B.codeEditor.setLineClass=function(){},$("#editor textarea").bind("input change",G=>{settings.code.overpass=G.target.getValue(),settings.save()});x.has_query&&B.codeEditor.setValue(x.query),B.dataViewer=CodeMirror($("#data")[0],{value:"no data loaded yet",lineNumbers:!0,readOnly:!0,mode:"javascript"}),B.map=new L.Map("map",{attributionControl:!0,minZoom:0,maxZoom:configs.maxMapZoom,worldCopyJump:!1});const S=settings.tile_server,D=configs.tileServerAttribution,H=new L.TileLayer(S,{attribution:D,noWrap:!0,maxNativeZoom:19,maxZoom:B.map.options.maxZoom});B.attribControl=new L.Control.Attribution({prefix:!1}),B.attribControl.addAttribution(D);const P=new L.LatLng(settings.coords_lat,settings.coords_lon);B.map.setView(P,settings.coords_zoom).addLayer(H),B.map.tile_layer=H,B.map.inv_opacity_layer=L.tileLayer("data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==").setOpacity(1-settings.background_opacity),settings.background_opacity!=1&&B.map.inv_opacity_layer.addTo(B.map),B.scaleControl=new L.Control.Scale({metric:!0,imperial:!1}),B.scaleControl.addTo(B.map),B.map.on("moveend",()=>{settings.coords_lat=B.map.getCenter().lat,settings.coords_lon=B.map.getCenter().lng,settings.coords_zoom=B.map.getZoom(),settings.save()}),$("#dataviewer > div#data")[0].style.zIndex=-1001,$(".tabs li").bind("click",G=>{$(G.target).hasClass("is-active")||($("#dataviewer > div#data")[0].style.zIndex=-1*$("#dataviewer > div#data")[0].style.zIndex,$(".tabs li").toggleClass("is-active"))}),$(document).keydown(G=>B.onKeyPress(G));const R=L.Control.extend({options:{position:"topleft"},onAdd(){const G=L.DomUtil.create("div","leaflet-control-buttons leaflet-bar");let X=L.DomUtil.create("a","leaflet-control-buttons-fitdata leaflet-bar-part leaflet-bar-part-top",G);return $('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.zoom_to_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{B.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}return!1},B.map),X=L.DomUtil.create("a","leaflet-control-buttons-myloc leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.localize_user"),window.isSecureContext||(X.className+=" disabled",X.setAttribute("data-t","[title]map_controlls.localize_user_disabled")),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{navigator.geolocation.getCurrentPosition(ee=>{const Ae=new L.LatLng(ee.coords.latitude,ee.coords.longitude);B.map.setView(Ae,settings.coords_zoom)})}catch{}return!1},B.map),X=L.DomUtil.create("a","leaflet-control-buttons-bboxfilter leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>($(ee.target).parent().hasClass("disabled")||(B.map.bboxfilter.isEnabled()?B.map.bboxfilter.disable():(B.map.bboxfilter.setBounds(B.map.getBounds().pad(-.2)),B.map.bboxfilter.enable()),$(ee.target).toggleClass("fa-times-circle").toggleClass("fa-image")),!1),B.map),X=L.DomUtil.create("a","leaflet-control-buttons-fullscreen leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_wide_map"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>($("#dataviewer").toggleClass("fullscreen"),B.map.invalidateSize(),$(ee.target).toggleClass("fa-step-forward").toggleClass("fa-step-backward"),$("#editor").toggleClass("hidden"),$("#editor").resizable("option","disabled")?$("#editor").resizable("enable"):$("#editor").resizable("disable"),!1),B.map),X=L.DomUtil.create("a","leaflet-control-buttons-clearoverlay leaflet-bar-part leaflet-bar-part-bottom",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>(ee.preventDefault(),B.map.hasLayer(overpass.osmLayer)?B.map.removeLayer(overpass.osmLayer):B.map.addLayer(overpass.osmLayer),!1),B.map),G}});B.map.addControl(new R),$(".leaflet-control-buttons > a").bind("dblclick",G=>G.stopPropagation()),$(".leaflet-control-buttons > a").tooltip({items:"a[title]",hide:{effect:"fadeOut",duration:100},position:{my:"left+5 center",at:"right center"}});const Y=L.Control.extend({options:{position:"topright"},onAdd(){const G=L.DomUtil.create("div","leaflet-control-search control has-icons-left");G.style.position="absolute",G.style.right="0";const X=L.DomUtil.create("input","input is-rounded",G);return $('').click(function(){$(this).prev().autocomplete("search")}).insertAfter(X),X.id="search",X.type="search",X.onclick=function(){this.focus()},G.ondblclick=function(ee){ee.stopPropagation()},$(X).autocomplete({source(ee,Ae){$.ajax(`https://search.osmnames.org/q/${encodeURIComponent(ee.term)}.js?key=${configs.osmnamesApiKey}`,{success(le){if(typeof le=="string")try{le=$.parseJSON(le)}catch{}Ae($.map(le.results.slice(0,10),ae=>({label:ae.display_name,value:ae.display_name,lat:ae.lat,lon:ae.lon,boundingbox:ae.boundingbox})))},error(){console.error("An error occured while contacting the search server osmnames.org :(")}})},minLength:2,autoFocus:!0,select(ee,Ae){return Ae.item.boundingbox&&Ae.item.boundingbox instanceof Array?B.map.fitBounds(L.latLngBounds([[Ae.item.boundingbox[1],Ae.item.boundingbox[0]],[Ae.item.boundingbox[3],Ae.item.boundingbox[2]]]),{maxZoom:18}):B.map.panTo(new L.LatLng(Ae.item.lat,Ae.item.lon)),this.value="",!1},open(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close(){$(this).addClass("ui-corner-all").removeClass("ui-corner-top")}}),$(X).autocomplete("option","delay",20),G}});B.map.addControl(new Y),$('').addClass("crosshairs").hide().appendTo("#map"),settings.enable_crosshairs&&$(".crosshairs").show(),B.map.bboxfilter=new L.LocationFilter({enable:!1,adjustButton:!1,enableButton:!1}).addTo(B.map),B.map.on("popupopen popupclose",G=>{if(typeof G.popup.layer<"u"){const X=G.popup.layer.placeholder||G.popup.layer,ee=overpass.osmLayer._baseLayer.options.style(X.feature,G.type=="popupopen");typeof X.eachLayer!="function"?typeof X.setStyle=="function"&&X.setStyle(ee):X.eachLayer(Ae=>{typeof Ae.setStyle=="function"&&Ae.setStyle(ee)})}}),overpass.init(),overpass.handlers.onProgress=function(G,X){B.waiter.addInfo(G,X)},overpass.handlers.onDone=function(){const G=B.getRawQuery().match(/@name ([^\n]+)/),X=G?`${G[1]} | `:"";B.waiter.close(X);const ee=B.map.getBounds(),Ae=overpass.osmLayer.getBaseLayer().getBounds();if(Ae.isValid()&&!ee.intersects(Ae)){const le=$(".leaflet-control-buttons-fitdata").tooltip("option","content");$(".leaflet-control-buttons-fitdata").tooltip("option","content",`← ${i18n.t("map_controlls.suggest_zoom_to_data")}`),$(".leaflet-control-buttons-fitdata").tooltip("open"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:1e3}),setTimeout(()=>{$(".leaflet-control-buttons-fitdata").tooltip("option","content",le),$(".leaflet-control-buttons-fitdata").tooltip("close"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:100})},2600)}},overpass.handlers.onEmptyMap=function(G,X){const ee=B.getRawQuery(),Ae=/out[^;]+?count/.test(ee);if(G=="no visible data")if(!Ae&&!settings.no_autorepair){const le=`${i18n.t("warning.incomplete.expl.1")}
${i18n.t("warning.incomplete.expl.2")}
${i18n.t("warning.incomplete.not_again")}
`,ae=[{name:i18n.t("dialog.repair_query"),callback(){B.repairQuery("no visible data")}},{name:i18n.t("dialog.show_data"),callback(){var ge,fe;(fe=(ge=$("input[name=hide_incomplete_data_warning]"))==null?void 0:ge[0])!=null&&fe.checked&&(settings.no_autorepair=!0,settings.save()),B.switchTab("Data")}}];showDialog(i18n.t("warning.incomplete.title"),le,ae)}else Ae&&B.switchTab("Data");G=="only areas returned"&&B.switchTab("Data"),G=="no coordinates returned"&&B.switchTab("Data"),X=="unknown"&&B.switchTab("Data"),$(`${i18n.t("map.intentionally_blank")} (${G})`).appendTo("#map")},overpass.handlers.onDataReceived=function(G,X,ee,Ae){if(G>1e6){B.waiter.close();const le=document.title;document.title=`❗ ${le}`;const ae=[{name:i18n.t("dialog.abort"),callback(){document.title=le,ee()}},{name:i18n.t("dialog.continue_anyway"),callback(){document.title=le,Ae()}}],ge=`${i18n.t("warning.huge_data.expl.1").replace("{{amount_txt}}",X)}
${i18n.t("warning.huge_data.expl.2")}
`;showDialog(i18n.t("warning.huge_data.title"),ge,ae)}else Ae()},overpass.handlers.onAbort=function(){B.waiter.close()},overpass.handlers.onAjaxError=function(G){B.waiter.close();const X=document.title;document.title=`❗ ${X}`;const ee=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],Ae=`${i18n.t("error.ajax.expl")}
${G}`;showDialog(i18n.t("error.ajax.title"),Ae,ee),overpass.resultText&&B.dataViewer.setValue(overpass.resultText)},overpass.handlers.onQueryError=function(G){B.waiter.close();const X=document.title;document.title=`❗ ${X}`;const ee=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],Ae=`${i18n.t("error.query.expl")}`;showDialog(i18n.t("error.query.title"),Ae,ee)},overpass.handlers.onStyleError=function(G){const X=[{name:i18n.t("dialog.dismiss")}],ee=`
${G}${i18n.t("error.mapcss.expl")}
${G}`;showDialog(i18n.t("error.mapcss.title"),ee,X)},overpass.handlers.onQueryErrorLine=function(G){B.highlightError(G)},overpass.handlers.onRawDataPresent=function(){B.dataViewer.setOption("mode",overpass.resultType),B.dataViewer.setValue(overpass.resultText)},overpass.handlers.onGeoJsonReady=function(){if(B.map.addLayer(overpass.osmLayer),typeof B.run_query_on_startup=="function"&&B.run_query_on_startup(),settings.show_data_stats){const G=overpass.stats,X=`${i18n.t("data_stats.loaded")} – ${i18n.t("data_stats.nodes")}: ${G.data.nodes}, ${i18n.t("data_stats.ways")}: ${G.data.ways}, ${i18n.t("data_stats.relations")}: ${G.data.relations}${G.data.areas>0?`, ${i18n.t("data_stats.areas")}: ${G.data.areas}`:""}
${i18n.t("data_stats.displayed")} – ${i18n.t("data_stats.pois")}: ${G.geojson.pois}, ${i18n.t("data_stats.lines")}: ${G.geojson.lines}, ${i18n.t("data_stats.polygons")}: ${G.geojson.polys}`;$(`${X}`).insertAfter("#map .leaflet-control-attribution");const ee=overpass.timestamp&&Date.now()-Date.parse(overpass.timestamp),Ae=overpass.timestampAreas&&Date.now()-Date.parse(overpass.timestampAreas);$("#data_stats").tooltip({items:"div",tooltipClass:"stats",content(){let le="";if(overpass.ajax_request_duration){let ae=overpass.ajax_request_duration;ae.toLocaleString&&(ae=ae.toLocaleString()),le+=`${i18n.t("data_stats.request_duration")}: ${ae}ms",le},hide:{effect:"fadeOut",duration:100},position:{my:"right bottom-5",at:"right top"}}),(ee>24*60*60*1e3||Ae>96*60*60*1e3)&&$("#data_stats").css("background-color","yellow")}},overpass.handlers.onPopupReady=function(G){G.openOn(B.map)},B.waiter.close(),B.run_query_on_startup===!0&&(B.update_map(),!x.has_coords&&x.has_query&&x.query.match(/\{\{(bbox|center)\}\}/)===null&&(B.run_query_on_startup=function(){B.run_query_on_startup=null;try{B.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}}))}onNominatimError(B,x){this.waiter.close();let Q=this.getRawQuery();Q=Q.split(` +`+H+"}":"{"+P.join(",")+"}",gap=H,S}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(g,B,x){var Q;if(gap="",indent="",typeof x=="number")for(Q=0;Q
`}return overpass.timestamp&&(le+=`${i18n.t("data_stats.lag")}: ${Math.floor(ee/1e3)}s ${i18n.t("data_stats.lag.expl")}`),overpass.timestampAreas&&(le+=`
${i18n.t("data_stats.lag_areas")}: ${Math.floor(Ae/1e3)}s ${i18n.t("data_stats.lag.expl")}`),le+="{var R=(Y,G)=>{Y?P(new Error(Y)):H(G)};_generatePkceChallenge(Y=>x(Y,R))}))};function x(H,P){var R=generateState(),Y=g.url+"/oauth2/authorize?"+utilQsString({client_id:g.client_id,redirect_uri:g.redirect_uri,response_type:"code",scope:g.scope,state:R,code_challenge:H.code_challenge,code_challenge_method:H.code_challenge_method});if(g.singlepage){if(!store.enabled){var G=new Error("local storage unavailable, but require in singlepage mode");G.status="pkce-localstorage-unavailable",P(G);return}var X=utilStringQs(window.location.search.slice(1));X.code?B.bootstrapToken(X.code,P):(S("oauth2_state",R),S("oauth2_pkce_code_verifier",H.code_verifier),window.location=Y)}else{var ee=600,Ae=550,le=[["width",ee],["height",Ae],["left",window.screen.width/2-ee/2],["top",window.screen.height/2-Ae/2]].map(function(fe){return fe.join("=")}).join(","),ae=window.open("about:blank","oauth_window",le);B.popupWindow=ae,ae.location=Y,ae||(G=new Error("Popup was blocked"),G.status="popup-blocked",P(G))}window.authComplete=function(fe){var ye=utilStringQs(fe.split("?")[1]);if(ye.state!==R){G=new Error("Invalid state"),G.status="invalid-state",P(G);return}Q(ye.code,H.code_verifier,ge),delete window.authComplete};function ge(fe,ye){if(g.done(),fe){P(fe);return}var me=JSON.parse(ye.response);S("oauth2_access_token",me.access_token),P(null,B)}}function Q(H,P,R){var Y=g.url+"/oauth2/token?"+utilQsString({client_id:g.client_id,redirect_uri:g.redirect_uri,grant_type:"authorization_code",code:H,code_verifier:P});B.rawxhr("POST",Y,null,null,null,R),g.loading()}B.bringPopupWindowToFront=function(){var H=!1;try{B.popupWindow&&!B.popupWindow.closed&&(B.popupWindow.focus(),H=!0)}catch{}return H},B.bootstrapToken=function(H,P){var R=S("oauth2_state");S("oauth2_state","");var Y=utilStringQs(window.location.search.slice(1));if(Y.state!==R){var G=new Error("Invalid state");G.status="invalid-state",P(G);return}var X=S("oauth2_pkce_code_verifier");S("oauth2_pkce_code_verifier",""),Q(H,X,ee);function ee(Ae,le){if(g.done(),Ae){P(Ae);return}var ae=JSON.parse(le.response);S("oauth2_access_token",ae.access_token),P(null,B)}},B.fetch=function(H,P){if(B.authenticated())return R();return g.auto?B.authenticateAsync().then(R):Promise.reject(new Error("not authenticated"));function R(){return P=P||{},P.headers||(P.headers={"Content-Type":"application/x-www-form-urlencoded"}),P.headers.Authorization="Bearer "+S("oauth2_access_token"),fetch(H,P)}},B.xhr=function(H,P){if(B.authenticated())return R();if(g.auto){B.authenticate(R);return}else{P("not authenticated",null);return}function R(){var G=H.prefix!==!1?g.url+H.path:H.path;return B.rawxhr(H.method,G,S("oauth2_access_token"),H.content,H.headers,Y)}function Y(G,X){G?P(G):X.responseXML?P(G,X.responseXML):P(G,X.response)}},B.rawxhr=function(H,P,R,Y,G,X){G=G||{"Content-Type":"application/x-www-form-urlencoded"},R&&(G.Authorization="Bearer "+R);var ee=new XMLHttpRequest;ee.onreadystatechange=function(){ee.readyState===4&&ee.status!==0&&(/^20\d$/.test(ee.status)?X(null,ee):X(ee,null))},ee.onerror=function(le){X(le,null)},ee.open(H,P,!0);for(var Ae in G)ee.setRequestHeader(Ae,G[Ae]);return ee.send(Y),ee},B.preauth=function(H){return H&&H.access_token&&S("oauth2_access_token",H.access_token),B},B.options=function(H){return arguments.length?(g=H,g.url=g.url||"https://www.openstreetmap.org",g.auto=g.auto||!1,g.singlepage=g.singlepage||!1,g.loading=g.loading||function(){},g.done=g.done||function(){},B.preauth(g)):g};var S;if(store.enabled)S=function(H,P){if(arguments.length===1)return store.get(g.url+H);if(arguments.length===2)return store.set(g.url+H,P)};else{var D={};S=function(H,P){if(arguments.length===1)return D[g.url+H];if(arguments.length===2)return D[g.url+H]=P}}return B.options(g),B}function utilQsString(g){return Object.keys(g).filter(function(B){return g[B]!==void 0}).sort().map(function(B){return encodeURIComponent(B)+"="+encodeURIComponent(g[B])}).join("&")}function utilStringQs(g){for(var B=0;B {if(B)return g(B);loadQueries(g)})},save(g,B){auth.authenticated()?saveQuery(g,B):auth.authenticate(x=>{if(x)return B(x);saveQuery(g,B)})},delete(g,B){if(!auth.authenticated())return B(new Error("must be logged in to delete a synced query"));g={name:g,deleteMe:!0},saveQuery(g,B)},logout(){auth.authenticated()&&auth.logout()},authenticated(){return enabled&&auth.authenticated()}};function loadQueries(g){auth.xhr({method:"GET",path:"/api/0.6/user/preferences"},(B,x)=>{if(B)return g(B);let Q=0,S;(S=x.querySelector(`preference[k="${configs.settingNamespace}_query-count"]`))&&(Q=+S.getAttribute("v"));const D=[];for(let H=0;H {if(x)return B(x);const D=S.querySelector("preferences"),H=D.querySelectorAll(`preference[k^="${configs.settingNamespace}_query"]`);for(const Y of H)Y.remove();let P=!0;Q.forEach((Y,G)=>{Y.name==g.name&&(Y.query=g.query,P=G)}),P===!0?Q.push(g):g.deleteMe&&Q.splice(P,1);const R=S.createElement("preference");R.setAttribute("k",`${configs.settingNamespace}_query-count`),R.setAttribute("v",Q.length),D.appendChild(R);for(let Y=0;Y200)return B(new Error("query name too long to be saved on osm.org"));const X=Math.ceil((G.query.length+G.name.length+8)/255);if(X>9)return B(new Error("query too long to be saved on osm.org"));let ee=`p=${X}`;ee+=`&n=${G.name}`,ee+=`&q=${G.query}`,ee=ee.match(/.{1,255}/g);for(let Ae=0;Ae {if(Y)return B(Y);B(null,Q)})})}const cache={};class nominatim{static request(B,x){$.ajax(`https://nominatim.openstreetmap.org/search?X-Requested-With=${configs.appname}`,{data:{format:"json",q:B},success(Q){if(typeof Q=="string")try{Q=JSON.parse(Q)}catch{}cache[B]=Q,x(void 0,Q)},error(){const Q="An error occurred while contacting the osm search server nominatim.openstreetmap.org :(";console.log(Q),x(Q,null)}})}static get(B,x){return cache[B]===void 0?this.request(B,x):x(void 0,cache[B]),this}static getBest(B,x,Q){return Q||(Q=x,x=null),this.get(B,(S,D)=>{if(S){Q(S,null);return}x&&(D=D.filter(x)),D.length===0?Q("No result found",null):Q(S,D[0])}),this}}function map2bbox(g){let B;ide.map.bboxfilter&&ide.map.bboxfilter.isEnabled()?B=ide.map.bboxfilter.getBounds():B=ide.map.getBounds();const x=Math.min(Math.max(B.getSouthWest().lat,-90),90),Q=Math.min(Math.max(B.getNorthEast().lat,-90),90),S=Math.min(Math.max(B.getSouthWest().lng,-180),180),D=Math.min(Math.max(B.getNorthEast().lng,-180),180);if(g=="OverpassQL")return`${x},${S},${Q},${D}`;if(g=="xml")return`s="${x}" w="${S}" n="${Q}" e="${D}"`}function map2coord(g){const B=ide.map.getCenter();if(g=="OverpassQL")return`${B.lat},${B.lng}`;if(g=="xml")return`lat="${B.lat}" lon="${B.lng}"`}function relativeTime(g,B){const x=Date.now();if(g==""&&(g="0 seconds"),g=g.toLowerCase().match(/(-?[0-9]+) ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?/),g===null){B("");return}const Q=parseInt(g[1]);let S;switch(g[2]){case"second":case"seconds":S=1;break;case"minute":case"minutes":S=60;break;case"hour":case"hours":S=3600;break;case"day":case"days":default:S=86400;break;case"week":case"weeks":S=604800;break;case"month":case"months":S=2628e3;break;case"year":case"years":S=31536e3;break}const D=x-Q*S*1e3;B(new Date(D).toISOString())}function geocodeId(g,B){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Id");x=="OverpassQL"?D=`${D.osm_type}(${D.osm_id})`:x=="xml"&&(D=`type="${D.osm_type}" ref="${D.osm_id}"`),B(D)})}function geocodeArea(g,B){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id&&S.osm_type!=="node"}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Area");let H=1*D.osm_id;if(D.osm_type=="way"&&(H+=24e8),D.osm_type=="relation"&&(H+=36e8),x=="OverpassQL")return D.osm_type==="way"&&(H+=`,${D.osm_id}`),B(`area(id:${H})`);if(x=="xml")return D.osm_type==="way"&&(H+=`" ref_1="${D.osm_id}`),B(`type="area" ref="${H}"`)})}function geocodeBbox(g,B){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Bbox");const D=Math.min(Math.max(S.boundingbox[0],-90),90),H=Math.min(Math.max(S.boundingbox[1],-90),90),P=Math.min(Math.max(S.boundingbox[2],-180),180),R=Math.min(Math.max(S.boundingbox[3],-180),180);x=="OverpassQL"?S=`${D},${P},${H},${R}`:x=="xml"&&(S=`s="${D}" w="${P}" n="${H}" e="${R}"`),B(S)})}function geocodeCoords(g,B){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Coords");x=="OverpassQL"?S=`${S.lat},${S.lon}`:x=="xml"&&(S=`lat="${S.lat}" lon="${S.lon}"`),B(S)})}function shortcuts(){const g=ide.getQueryLang();return{bbox:map2bbox(g),center:map2coord(g),__bbox__global_bbox_xml__ezs4K8__:map2bbox("OverpassQL"),date:relativeTime,geocodeId,geocodeArea,geocodeBbox,geocodeCoords,nominatimId:g=="xml"?geocodeId:(B,x)=>geocodeId(B,Q=>x(`${Q};`)),nominatimArea:g=="xml"?geocodeArea:(B,x)=>geocodeArea(B,Q=>x(`${Q};`)),nominatimBbox:geocodeBbox,nominatimCoords:geocodeCoords}}let copyData;$(document).on("copy",g=>{copyData&&g.originalEvent&&g.originalEvent.clipboardData?(Object.keys(copyData).forEach(B=>{g.originalEvent.clipboardData.setData(B,copyData[B])}),g.originalEvent.preventDefault(),copyData=void 0):copyData&©Data["text/plain"]&&(prompt(i18n.t("export.copy_to_clipboard"),copyData["text/plain"]),copyData=null)});function make_combobox(g,B,x,Q){if(g[0].is_combobox){g.autocomplete("option",{source:B});return}const S=g.wrap("").parent().addClass("ui-combobox");g.autocomplete({source:B,minLength:0}).addClass("ui-widget ui-widget-content ui-corner-left ui-state-default").autocomplete("instance")._renderItem=(D,H)=>$(" ").append(x&&x.indexOf(H.value)!==-1?` ${H.label}`:`${H.label}`).on("click",function(P){if(P.shiftKey&&x.indexOf(H.value)!==-1){Q(H.value),$(this).remove();const R=g.autocomplete("option","source");return R.splice(R.indexOf(H),1),g.autocomplete("option","source",R),!1}}).appendTo(D),$("").attr("tabIndex",-1).attr("title","show all items").appendTo(S).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("ui-corner-right ui-combobox-toggle").click(()=>{if(g.autocomplete("widget").is(":visible")){g.autocomplete("close");return}g.autocomplete("search",""),g.focus()}),g[0].is_combobox=!0}function showDialog(g,B,x){const Q=``,S=$(Q);$(".delete",S).click(()=>$(S).remove());for(const D in x){const H=x[D];$(``).click(()=>{var P;(P=H.callback)==null||P.call(H),$(S).remove()}).appendTo($("footer .level-item",S))}S.appendTo("body")}class IDE{constructor(){this.attribControl=null,this.scaleControl=null,this.queryParser=new parser,this.run_query_on_startup=!1,this.codeEditor=null,this.dataViewer=null,this.map=null,this.waiter=new class{constructor(){this.opened=!0,this.frames=["◴","◷","◶","◵"],this.frameDelay=250,this.onAbort=void 0,this.interval=0,this._initialTitle=document.title}open(x){x?($(".modal .wait-info h4").text(x),$(".wait-info").show()):$(".wait-info").hide(),$("#loading-dialog").addClass("is-active"),document.title=`${this.frames[0]} ${this._initialTitle}`;let Q=0;this.interval=setInterval(()=>{const S=this.isAlert?this.alertFrame:this.frames[++Q%this.frames.length];document.title=`${S} ${this._initialTitle}`},this.frameDelay),this.opened=!0}close(x=""){this.opened&&(clearInterval(this.interval),document.title=`${x}${this._initialTitle}`,$("#loading-dialog").removeClass("is-active"),$(".wait-info ul li").remove(),delete this.onAbort,this.opened=!1)}addInfo(x,Q){$("#aborter").remove(),$(".wait-info ul li:nth-child(n+1)").css("opacity",.5),$(".wait-info ul li span.fas").removeClass("fa-spinner").removeClass("fa-spin").addClass("fa-check"),$(".wait-info ul li:nth-child(n+4)").hide();const S=$(`${g}
${B} ${x} `);if(typeof Q=="function"){this.onAbort=Q;const D=$(' (abort)').on("click",()=>(this.abort(),!1));S.append(D)}$(".wait-info ul").prepend(S)}abort(){typeof this.onAbort=="function"&&(this.addInfo("aborting"),this.onAbort(this.close))}}}init(){this.waiter.addInfo("ide starting up"),$("#overpass-turbo-version").html("overpass-turbo2024-11-03/8d4856a
"),$("#overpass-turbo-dependencies").html('@fortawesome/fontawesome-free 5.15.4 ((CC-BY-4.0 AND OFL-1.1 AND MIT)), @openstreetmap/id-tagging-schema 3.5.1 (ISC), bulma 0.9.4 (MIT), canvg 4.0.1 (MIT), codemirror 2.38.00 (undefined), html2canvas 1.4.1 (MIT), jquery 3.7.1 (MIT), jquery-ui 1.13.2 (MIT), jquery-ui-dist 1.13.2 (MIT), leaflet 1.9.4 (BSD-2-Clause), leaflet-polylineoffset 1.1.1 (MIT), leaflet-locationfilter 0.1.3 (MIT), lodash 4.17.21 (MIT), osm-auth 2.2.0 (ISC), osmtogeojson 3.0.0-beta.5 (MIT), rgbcolor 1.0.1 (MIT OR SEE LICENSE IN FEEL-FREE.md), stackblur 1.0.0 (BSD-2-Clause), tag2link 2024.05.21 (ISC), togpx 0.5.4 (MIT), tokml 0.4.0 (BSD-2-Clause)'),($.support.cors!=!0||typeof function(){let B;try{localStorage.setItem("startup_localstorage_quota_test",123),localStorage.removeItem("startup_localstorage_quota_test"),B=localStorage}catch{}return B}()!="object")&&(this.not_supported=!0,$("#warning-unsupported-browser").addClass("is-active")),this.waiter.addInfo("load settings"),settings.load(),this.waiter.addInfo("translate ui"),i18n.translate().then(()=>this.initAfterI18n()),sync.enabled&&($("#load-dialog .osm").show(),sync.authenticated()&&($("#logout").show(),$("#logout").appendTo($("#logout").parent())))}initAfterI18n(){const B=this;B.waiter.addInfo("parse url parameters");const x=urlParameters();x.has_coords&&(settings.coords_lat=x.coords.lat,settings.coords_lon=x.coords.lng),x.has_zoom&&(settings.coords_zoom=x.zoom),x.run_query&&(B.run_query_on_startup=!0),settings.save(),B.waiter.addInfo("initialize page");const Q=$(window).width()/$(window).height()<.8;if(settings.editor_width!=""&&!Q&&($("#editor").css("width",settings.editor_width),$("#dataviewer").css("left",settings.editor_width)),Q&&$("#editor, #dataviewer").addClass("portrait"),$("#editor").resizable({handles:Q?"s":"e",minWidth:Q?void 0:"200",resize(){if(!Q)$(this).next().css("left",`${$(this).outerWidth()}px`);else{const G=$(this).offset().top+$(this).outerHeight();$(this).next().css("top",`${G}px`)}B.map.invalidateSize(!1)},stop(){Q||(settings.editor_width=$("#editor").css("width"),settings.save())}}),$("#editor").prepend(""),$("#editor textarea")[0].value=settings.code.overpass,settings.use_rich_editor){let G=0;CodeMirror.defineMIME("text/x-overpassQL",{name:"clike",keywords:function(X){const ee={},Ae=X.split(" ");for(const le of Ae)ee[le]=!0;return ee}("out json xml custom popup timeout maxsize bbox date diff adiff foreach relation rel way node is_in area around user uid newer changed poly pivot nwr nw nr wr derived out meta body skel tags ids count qt asc center bb geom")}),CodeMirror.defineMIME("text/x-overpassXML","xml"),CodeMirror.defineMode("xml+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"xml"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),CodeMirror.defineMode("ql+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"text/x-overpassQL"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),B.codeEditor=CodeMirror.fromTextArea($("#editor textarea")[0],{lineNumbers:!0,lineWrapping:!0,mode:"text/plain",onChange(X){clearTimeout(G),G=setTimeout(()=>{B.getQueryLang()=="xml"?X.getOption("mode")!="xml+mustache"&&(X.closeTagEnabled=!0,X.setOption("matchBrackets",!1),X.setOption("mode","xml+mustache")):X.getOption("mode")!="ql+mustache"&&(X.closeTagEnabled=!1,X.setOption("matchBrackets",!0),X.setOption("mode","ql+mustache"));const ee=$(".leaflet-control-buttons-bboxfilter");B.getRawQuery().match(/\{\{bbox\}\}/)?ee.hasClass("disabled")&&(ee.removeClass("disabled"),ee.attr("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(ee[0])):ee.hasClass("disabled")||(ee.addClass("disabled"),ee.attr("data-t","[title]map_controlls.select_bbox_disabled"),i18n.translate_ui(ee[0]))},500),settings.code.overpass=X.getValue(),settings.save()},closeTagEnabled:!0,closeTagIndent:["osm-script","query","union","foreach","difference"],extraKeys:{"'>'"(X){X.closeTag(X,">")},"'/'"(X){X.closeTag(X,"/")}}}),B.codeEditor.getOption("onChange")(B.codeEditor)}else B.codeEditor=$("#editor textarea")[0],B.codeEditor.getValue=function(){return this.value},B.codeEditor.setValue=function(G){this.value=G},B.codeEditor.lineCount=function(){return this.value.split(/\r\n|\r|\n/).length},B.codeEditor.setLineClass=function(){},$("#editor textarea").bind("input change",G=>{settings.code.overpass=G.target.getValue(),settings.save()});x.has_query&&B.codeEditor.setValue(x.query),B.dataViewer=CodeMirror($("#data")[0],{value:"no data loaded yet",lineNumbers:!0,readOnly:!0,mode:"javascript"}),B.map=new L.Map("map",{attributionControl:!0,minZoom:0,maxZoom:configs.maxMapZoom,worldCopyJump:!1});const S=settings.tile_server,D=configs.tileServerAttribution,H=new L.TileLayer(S,{attribution:D,noWrap:!0,maxNativeZoom:19,maxZoom:B.map.options.maxZoom});B.attribControl=new L.Control.Attribution({prefix:!1}),B.attribControl.addAttribution(D);const P=new L.LatLng(settings.coords_lat,settings.coords_lon);B.map.setView(P,settings.coords_zoom).addLayer(H),B.map.tile_layer=H,B.map.inv_opacity_layer=L.tileLayer("data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==").setOpacity(1-settings.background_opacity),settings.background_opacity!=1&&B.map.inv_opacity_layer.addTo(B.map),B.scaleControl=new L.Control.Scale({metric:!0,imperial:!1}),B.scaleControl.addTo(B.map),B.map.on("moveend",()=>{settings.coords_lat=B.map.getCenter().lat,settings.coords_lon=B.map.getCenter().lng,settings.coords_zoom=B.map.getZoom(),settings.save()}),$("#dataviewer > div#data")[0].style.zIndex=-1001,$(".tabs li").bind("click",G=>{$(G.target).hasClass("is-active")||($("#dataviewer > div#data")[0].style.zIndex=-1*$("#dataviewer > div#data")[0].style.zIndex,$(".tabs li").toggleClass("is-active"))}),$(document).keydown(G=>B.onKeyPress(G));const R=L.Control.extend({options:{position:"topleft"},onAdd(){const G=L.DomUtil.create("div","leaflet-control-buttons leaflet-bar");let X=L.DomUtil.create("a","leaflet-control-buttons-fitdata leaflet-bar-part leaflet-bar-part-top",G);return $('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.zoom_to_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{B.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}return!1},B.map),X=L.DomUtil.create("a","leaflet-control-buttons-myloc leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.localize_user"),window.isSecureContext||(X.className+=" disabled",X.setAttribute("data-t","[title]map_controlls.localize_user_disabled")),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{navigator.geolocation.getCurrentPosition(ee=>{const Ae=new L.LatLng(ee.coords.latitude,ee.coords.longitude);B.map.setView(Ae,settings.coords_zoom)})}catch{}return!1},B.map),X=L.DomUtil.create("a","leaflet-control-buttons-bboxfilter leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>($(ee.target).parent().hasClass("disabled")||(B.map.bboxfilter.isEnabled()?B.map.bboxfilter.disable():(B.map.bboxfilter.setBounds(B.map.getBounds().pad(-.2)),B.map.bboxfilter.enable()),$(ee.target).toggleClass("fa-times-circle").toggleClass("fa-image")),!1),B.map),X=L.DomUtil.create("a","leaflet-control-buttons-fullscreen leaflet-bar-part",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_wide_map"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>($("#dataviewer").toggleClass("fullscreen"),B.map.invalidateSize(),$(ee.target).toggleClass("fa-step-forward").toggleClass("fa-step-backward"),$("#editor").toggleClass("hidden"),$("#editor").resizable("option","disabled")?$("#editor").resizable("enable"):$("#editor").resizable("disable"),!1),B.map),X=L.DomUtil.create("a","leaflet-control-buttons-clearoverlay leaflet-bar-part leaflet-bar-part-bottom",G),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",ee=>(ee.preventDefault(),B.map.hasLayer(overpass.osmLayer)?B.map.removeLayer(overpass.osmLayer):B.map.addLayer(overpass.osmLayer),!1),B.map),G}});B.map.addControl(new R),$(".leaflet-control-buttons > a").bind("dblclick",G=>G.stopPropagation()),$(".leaflet-control-buttons > a").tooltip({items:"a[title]",hide:{effect:"fadeOut",duration:100},position:{my:"left+5 center",at:"right center"}});const Y=L.Control.extend({options:{position:"topright"},onAdd(){const G=L.DomUtil.create("div","leaflet-control-search control has-icons-left");G.style.position="absolute",G.style.right="0";const X=L.DomUtil.create("input","input is-rounded",G);return $('').click(function(){$(this).prev().autocomplete("search")}).insertAfter(X),X.id="search",X.type="search",X.onclick=function(){this.focus()},G.ondblclick=function(ee){ee.stopPropagation()},$(X).autocomplete({source(ee,Ae){$.ajax(`https://search.osmnames.org/q/${encodeURIComponent(ee.term)}.js?key=${configs.osmnamesApiKey}`,{success(le){if(typeof le=="string")try{le=$.parseJSON(le)}catch{}Ae($.map(le.results.slice(0,10),ae=>({label:ae.display_name,value:ae.display_name,lat:ae.lat,lon:ae.lon,boundingbox:ae.boundingbox})))},error(){console.error("An error occured while contacting the search server osmnames.org :(")}})},minLength:2,autoFocus:!0,select(ee,Ae){return Ae.item.boundingbox&&Ae.item.boundingbox instanceof Array?B.map.fitBounds(L.latLngBounds([[Ae.item.boundingbox[1],Ae.item.boundingbox[0]],[Ae.item.boundingbox[3],Ae.item.boundingbox[2]]]),{maxZoom:18}):B.map.panTo(new L.LatLng(Ae.item.lat,Ae.item.lon)),this.value="",!1},open(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close(){$(this).addClass("ui-corner-all").removeClass("ui-corner-top")}}),$(X).autocomplete("option","delay",20),G}});B.map.addControl(new Y),$('').addClass("crosshairs").hide().appendTo("#map"),settings.enable_crosshairs&&$(".crosshairs").show(),B.map.bboxfilter=new L.LocationFilter({enable:!1,adjustButton:!1,enableButton:!1}).addTo(B.map),B.map.on("popupopen popupclose",G=>{if(typeof G.popup.layer<"u"){const X=G.popup.layer.placeholder||G.popup.layer,ee=overpass.osmLayer._baseLayer.options.style(X.feature,G.type=="popupopen");typeof X.eachLayer!="function"?typeof X.setStyle=="function"&&X.setStyle(ee):X.eachLayer(Ae=>{typeof Ae.setStyle=="function"&&Ae.setStyle(ee)})}}),overpass.init(),overpass.handlers.onProgress=function(G,X){B.waiter.addInfo(G,X)},overpass.handlers.onDone=function(){const G=B.getRawQuery().match(/@name ([^\n]+)/),X=G?`${G[1]} | `:"";B.waiter.close(X);const ee=B.map.getBounds(),Ae=overpass.osmLayer.getBaseLayer().getBounds();if(Ae.isValid()&&!ee.intersects(Ae)){const le=$(".leaflet-control-buttons-fitdata").tooltip("option","content");$(".leaflet-control-buttons-fitdata").tooltip("option","content",`← ${i18n.t("map_controlls.suggest_zoom_to_data")}`),$(".leaflet-control-buttons-fitdata").tooltip("open"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:1e3}),setTimeout(()=>{$(".leaflet-control-buttons-fitdata").tooltip("option","content",le),$(".leaflet-control-buttons-fitdata").tooltip("close"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:100})},2600)}},overpass.handlers.onEmptyMap=function(G,X){const ee=B.getRawQuery(),Ae=/out[^;]+?count/.test(ee);if(G=="no visible data")if(!Ae&&!settings.no_autorepair){const le=`${i18n.t("warning.incomplete.expl.1")}
${i18n.t("warning.incomplete.expl.2")}
${i18n.t("warning.incomplete.not_again")}
`,ae=[{name:i18n.t("dialog.repair_query"),callback(){B.repairQuery("no visible data")}},{name:i18n.t("dialog.show_data"),callback(){var ge,fe;(fe=(ge=$("input[name=hide_incomplete_data_warning]"))==null?void 0:ge[0])!=null&&fe.checked&&(settings.no_autorepair=!0,settings.save()),B.switchTab("Data")}}];showDialog(i18n.t("warning.incomplete.title"),le,ae)}else Ae&&B.switchTab("Data");G=="only areas returned"&&B.switchTab("Data"),G=="no coordinates returned"&&B.switchTab("Data"),X=="unknown"&&B.switchTab("Data"),$(`${i18n.t("map.intentionally_blank")} (${G})`).appendTo("#map")},overpass.handlers.onDataReceived=function(G,X,ee,Ae){if(G>1e6){B.waiter.close();const le=document.title;document.title=`❗ ${le}`;const ae=[{name:i18n.t("dialog.abort"),callback(){document.title=le,ee()}},{name:i18n.t("dialog.continue_anyway"),callback(){document.title=le,Ae()}}],ge=`${i18n.t("warning.huge_data.expl.1").replace("{{amount_txt}}",X)}
${i18n.t("warning.huge_data.expl.2")}
`;showDialog(i18n.t("warning.huge_data.title"),ge,ae)}else Ae()},overpass.handlers.onAbort=function(){B.waiter.close()},overpass.handlers.onAjaxError=function(G){B.waiter.close();const X=document.title;document.title=`❗ ${X}`;const ee=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],Ae=`${i18n.t("error.ajax.expl")}
${G}`;showDialog(i18n.t("error.ajax.title"),Ae,ee),overpass.resultText&&B.dataViewer.setValue(overpass.resultText)},overpass.handlers.onQueryError=function(G){B.waiter.close();const X=document.title;document.title=`❗ ${X}`;const ee=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],Ae=`${i18n.t("error.query.expl")}`;showDialog(i18n.t("error.query.title"),Ae,ee)},overpass.handlers.onStyleError=function(G){const X=[{name:i18n.t("dialog.dismiss")}],ee=`
${G}${i18n.t("error.mapcss.expl")}
${G}`;showDialog(i18n.t("error.mapcss.title"),ee,X)},overpass.handlers.onQueryErrorLine=function(G){B.highlightError(G)},overpass.handlers.onRawDataPresent=function(){B.dataViewer.setOption("mode",overpass.resultType),B.dataViewer.setValue(overpass.resultText)},overpass.handlers.onGeoJsonReady=function(){if(B.map.addLayer(overpass.osmLayer),typeof B.run_query_on_startup=="function"&&B.run_query_on_startup(),settings.show_data_stats){const G=overpass.stats,X=`${i18n.t("data_stats.loaded")} – ${i18n.t("data_stats.nodes")}: ${G.data.nodes}, ${i18n.t("data_stats.ways")}: ${G.data.ways}, ${i18n.t("data_stats.relations")}: ${G.data.relations}${G.data.areas>0?`, ${i18n.t("data_stats.areas")}: ${G.data.areas}`:""}
${i18n.t("data_stats.displayed")} – ${i18n.t("data_stats.pois")}: ${G.geojson.pois}, ${i18n.t("data_stats.lines")}: ${G.geojson.lines}, ${i18n.t("data_stats.polygons")}: ${G.geojson.polys}`;$(`${X}`).insertAfter("#map .leaflet-control-attribution");const ee=overpass.timestamp&&Date.now()-Date.parse(overpass.timestamp),Ae=overpass.timestampAreas&&Date.now()-Date.parse(overpass.timestampAreas);$("#data_stats").tooltip({items:"div",tooltipClass:"stats",content(){let le="";if(overpass.ajax_request_duration){let ae=overpass.ajax_request_duration;ae.toLocaleString&&(ae=ae.toLocaleString()),le+=`${i18n.t("data_stats.request_duration")}: ${ae}ms",le},hide:{effect:"fadeOut",duration:100},position:{my:"right bottom-5",at:"right top"}}),(ee>24*60*60*1e3||Ae>96*60*60*1e3)&&$("#data_stats").css("background-color","yellow")}},overpass.handlers.onPopupReady=function(G){G.openOn(B.map)},B.waiter.close(),B.run_query_on_startup===!0&&(B.update_map(),!x.has_coords&&x.has_query&&x.query.match(/\{\{(bbox|center)\}\}/)===null&&(B.run_query_on_startup=function(){B.run_query_on_startup=null;try{B.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}}))}onNominatimError(B,x){this.waiter.close();let Q=this.getRawQuery();Q=Q.split(` `),Q.forEach((H,P)=>{H.indexOf(`{{geocode${x}:${B}}}`)!==-1&&this.highlightError(P+1)});const S=[{name:i18n.t("dialog.dismiss")}],D=`
`}return overpass.timestamp&&(le+=`${i18n.t("data_stats.lag")}: ${Math.floor(ee/1e3)}s ${i18n.t("data_stats.lag.expl")}`),overpass.timestampAreas&&(le+=`
${i18n.t("data_stats.lag_areas")}: ${Math.floor(Ae/1e3)}s ${i18n.t("data_stats.lag.expl")}`),le+="${i18n.t("error.nominatim.expl")}
${htmlentities(B)}
`;showDialog(i18n.t("error.nominatim.title"),D,S)}getRawQuery(){return this.codeEditor.getValue()}async getQuery(){let B=this.getRawQuery();B=B.replace(/(]+bbox[^=]*=[^"'']*["'])({{bbox}})(["'])/,"$1{{__bbox__global_bbox_xml__ezs4K8__}}$3"),B=await this.queryParser.parse(B,shortcuts());let x="";this.queryParser.hasStatement("style")&&(x=this.queryParser.getStatement("style")),this.mapcss=x;let Q=null;if(this.queryParser.hasStatement("data")){Q=this.queryParser.getStatement("data"),Q=Q.split(",");const S=Q[0].toLowerCase();Q=Q.slice(1);const D={};for(const H of Q){const P=H.split("=");D[P[0]]=P[1]}Q={mode:S,options:D}}return this.data_source=Q,B}setQuery(B){this.codeEditor.setValue(B)}getQueryLang(){return $.trim(this.getRawQuery().replace(/{{.*?}}/g,"")).match(/^)?"xml":"OverpassQL"}repairQuery(B){const x=this.getRawQuery(),Q=this.getQueryLang(),S=autorepair(x,Q);B=="no visible data"?S.recurse():B=="xml+metadata"&&S.editors(),this.setQuery(S.getQuery())}highlightError(B){this.codeEditor.setLineClass(B-1,null,"errorline")}resetErrors(){for(let B=0;B {delete settings.saves[B],settings.save(),this.onLoadClick()}},{name:i18n.t("dialog.cancel")}],Q=` ${i18n.t("dialog.delete_query.expl")}: "${B}"?
`;showDialog(i18n.t("dialog.delete_query.title"),Q,x)}removeExampleSync(B,x){const Q=[{name:i18n.t("dialog.delete"),callback(){sync.delete(B.name,D=>{if(D)return console.error(D);$(x).parent().remove()})}},{name:i18n.t("dialog.cancel")}],S=`${i18n.t("dialog.delete_query.expl-osm")}: "${B.name}"?
`;showDialog(i18n.t("dialog.delete_query.title"),S,Q)}onLoadClick(){const B=this;$("#load-dialog .panel.saved_query .panel-block").remove(),$("#load-dialog .panel.example .panel-block").remove();let x=!1;for(const Q in settings.saves){const S=settings.saves[Q].type;S!="template"&&($('').attr("href","#").text(Q).on("click",()=>(B.loadExample(Q),$("#load-dialog").removeClass("is-active"),!1)).append($('