diff --git a/docs/static/js/main.5937fa8b.chunk.js b/docs/static/js/main.5937fa8b.chunk.js new file mode 100644 index 0000000..943fda6 --- /dev/null +++ b/docs/static/js/main.5937fa8b.chunk.js @@ -0,0 +1,2 @@ +(this["webpackJsonpOpenStreetMap Localization"]=this["webpackJsonpOpenStreetMap Localization"]||[]).push([[0],{48:function(e){e.exports=JSON.parse('{"name":"OpenStreetMap Localization","version":"0.1.18","private":true,"homepage":"/","dependencies":{"@fortawesome/fontawesome-free":"^5.15.2","@react-leaflet/core":">=1.0.0 <1.1.0 || ^1.1.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@testing-library/user-event":"^12.2.2","bootstrap":"^4.6.0","history":"^5.0.0","leaflet":"^1.7.1","leaflet.awesome-markers":"^2.0.5","osm-auth":"^2.4.0","react":"^17.0.2","react-bootstrap":"^1.4.3","react-dom":"^17.0.2","react-leaflet":"^3.2.5","react-scripts":"4.0.1","web-vitals":"^0.2.4"},"scripts":{"start":"react-scripts --openssl-legacy-provider start","build":"react-scripts --openssl-legacy-provider build","test":"react-scripts test","eject":"react-scripts eject"},"eslintConfig":{"extends":["react-app","react-app/jest"]},"browserslist":[">0.2%","not dead","not op_mini all"],"devDependencies":{"@babel/plugin-proposal-private-property-in-object":"^7.21.11","@types/leaflet":"^1.5.19"}}')},57:function(e,t,s){},67:function(e,t,s){},68:function(e,t,s){},69:function(e,t,s){},70:function(e,t,s){},72:function(e,t,s){},73:function(e,t,s){"use strict";s.r(t);var a=s(0),n=s.n(a),i=s(12),o=s.n(i),c=(s(57),s(51)),r=s(19),l=s(78),h=s(80),d=s(79),u=s(76);const g=e=>[e.lat,e.lng];function m(e){let{onLoad:t,onMove:s,onClick:a,center:n,zoom:i}=e;const o=Object(u.a)();let c=o.getCenter();return c.lat===n[0]&&c.lng===n[1]||o.flyTo(n,i),Object(u.b)({moveend:()=>{let e=o.getCenter();s({bbox:Object.values(o.getBounds()).map(g),center:g(e),zoom:o.getZoom()})},click:()=>{a()}}),t({bbox:Object.values(o.getBounds()).map(g)}),null}var p=s(77),b=s(13),j=s.n(b);s(58),s(59),s(60),s(61);const f=(e,t,s)=>j.a.AwesomeMarkers.icon({icon:e,prefix:"fa",markerColor:t,className:"awesome-marker awesome-marker-"+s}),y=e=>{let{type:t,shape:s,color:a="blue"}=e;return{icon:f(t,a,s),touched:f(t,"orange",s),focused:f(t,"red",s)}},x=y({type:"circle"}),O=[{cat:"tourism",tag:["hotel","hostel"],iconType:"hotel"},{cat:"place",tag:["city","town","neighborhood"],iconType:"city"},{cat:"place",tag:["village","hamlet"],iconType:"home"},{cat:"aeroway",iconType:"plane"},{cat:"shop",iconType:"store"},{cat:"historic",iconType:"monument"},{cat:"leisure",iconType:"futbol"},{cat:"tourism",iconType:"compass"},{cat:"highway",iconType:"road"},{cat:"building",iconType:"building"},{cat:"natural",iconType:"tree"},{cat:"waterway",iconType:"water"}].map((e=>({...e,...y({type:e.iconType})})));var k=(e,t,s)=>(O.find((t=>!t.tag&&e[t.cat]||e.tags[t.cat]&&-1!==e.tags[t.cat].indexOf(t.tag)))||x)[s?"focused":t?"touched":"icon"],C=s(1);function v(e){let{item:t,touched:s,focused:n,position:i,onClick:o}=e;const c=Object(a.useRef)(null),r=Object(a.useMemo)((()=>({click:o})),[o]);return Object(C.jsx)(p.a,{position:i,icon:k(t,s,n),eventHandlers:r,ref:c})}var w={tileUrl:"https://tile.tracestrack.com/en/{z}/{x}/{y}.png?key=ad185d84befbbb5463e093c682930866",attribution:'© OpenStreetMap contributors',minZoom:3,maxZoom:19};const S=e=>{return[(t=e.center||e).lat,t.lon];var t};var I=function(e){let{center:t,zoom:s,items:a,touched:n,lang:i="en",focused:o,handlers:{onMove:c,onLoad:r,onClickItem:u,onClickMap:g}}=e,p=w.tileUrl;return w.addLang&&(p+="?lang="+i),Object(C.jsxs)(l.a,{center:t,zoom:s,scrollWheelZoom:!0,minZoom:w.minZoom,maxZoom:w.maxZoom,children:[Object(C.jsx)(h.a,{attribution:w.attribution,url:p,minZoom:w.minZoom,maxZoom:w.maxZoom}),Object(C.jsx)(m,{center:t,zoom:s,onMove:c,onLoad:r,onClick:g}),a.map((e=>Object(C.jsx)(v,{item:e,position:S(e),touched:-1!==n.indexOf(e.id),focused:o===e.id,onClick:()=>u(e.id)},e.id))),Object(C.jsx)(d.a,{})]})};function L(){return Object(C.jsxs)("div",{children:[Object(C.jsx)("h2",{children:"Welcome"}),Object(C.jsxs)("p",{children:["OpenStreetMap Localization Tool (OsmLT) is started by Tracestrack.com. It greately faciliates localizing OpenStreetMap. It is open sourced on ",Object(C.jsx)("a",{href:"https://github.com/tracestrack/openstreetmap-localization-tool",children:"Github"}),"."]}),Object(C.jsx)("p",{children:"Login with your OpenStreetMap account and start editing today!"})]})}var T=s(8),M=s(18),z=s(28),U=s(14);function N(e){let{vkey:t,title:s,onChange:a,checked:n}=e;return Object(C.jsxs)(T.a,{className:"btn d-flex",variant:n?"primary":"outline-primary",size:"sm",onClick:()=>a(t),children:[s,Object(C.jsx)(U.a,{checked:n,onChange:()=>a(t)})]})}var _=function(e){let{itemsList:t,selected:s,onChange:n,min:i=0,Checkbox:o=N}=e;return Object(C.jsx)(a.Fragment,{children:t.map((e=>{let{key:t,title:a}=e;return Object(C.jsx)(o,{vkey:t,title:a,checked:-1!==s.indexOf(t),onChange:()=>n(function(e,t,s){const a=e.indexOf(t);return-1===a?[...e,t]:e.length<=s?e:[...e.slice(0,a),...e.slice(a+1)]}(s,t,i))},t)}))})},F=s(45),A=s(38);function q(e){let{vkey:t,title:s,onChange:a,checked:n}=e;return Object(C.jsxs)(A.a.Item,{onMouseDown:e=>a(t),onClick:e=>e.stopPropagation(),active:n,children:[s,Object(C.jsx)(U.a,{checked:n,onMouseDown:e=>a(t),onChange:()=>{}})]})}function P(e){let{title:t,itemsList:s,selected:n,onChange:i,min:o}=e;const[c,r]=Object(a.useState)(!1);Object(a.useEffect)((()=>{if(c){const e=document.addEventListener("click",(()=>{r(!1),document.removeEventListener("click",e)}))}}),[c]);return Object(C.jsx)(F.a,{title:t,show:c,onClick:e=>{r(!c),e.preventDefault(),e.stopPropagation()},variant:"outline-primary",children:Object(C.jsx)(_,{Checkbox:q,itemsList:s,selected:n,rootCloseEvent:"mousedown",onChange:i,min:o})})}var E=s(46);function R(e){let{title:t,onClick:s,loading:a,disabled:n,...i}=e;return Object(C.jsxs)(T.a,{disabled:n||a,onClick:s,...i,children:[t,a?Object(C.jsx)(E.a,{as:"span",animation:"border",size:"sm",className:"spinner-border ml-2"}):null]})}s(67);var B=function(e){let{filters:t,setFilter:s,tagsList:n,languages:i,languagesList:o,getItems:c,disabled:r,loading:l,updateItems:h,setLanguages:d}=e;const u=Object(a.useCallback)((e=>{13===e.charCode&&c()}),[c]),g=Object(a.useCallback)((e=>{let t=e.target.innerText;console.log(t),s(t,(()=>{c()}))}),[s,c]);return Object(C.jsxs)(M.a,{className:"item-filters",children:[Object(C.jsx)(P,{title:"Choose Languages",itemsList:o,selected:i,onChange:d,min:1}),Object(C.jsxs)(M.a.Group,{controlId:"exampleForm.ControlInput1",children:[Object(C.jsx)(M.a.Label,{children:"Tag to search: "}),Object(C.jsx)(T.a,{variant:"outline-secondary",size:"sm",onClick:g,children:"place=city"}),Object(C.jsx)(T.a,{variant:"outline-secondary",size:"sm",onClick:g,children:"boundary"}),Object(C.jsx)(T.a,{variant:"outline-secondary",size:"sm",onClick:g,children:"leisure"}),Object(C.jsx)(T.a,{variant:"outline-secondary",size:"sm",onClick:g,children:"highway"}),Object(C.jsx)(T.a,{variant:"outline-secondary",size:"sm",onClick:g,children:"waterway"}),Object(C.jsx)(M.a.Control,{type:"text",value:t.tags,onChange:e=>s(e.target.value),onKeyPress:u})]}),Object(C.jsxs)(z.a,{className:"d-flex justify-content-end",children:[Object(C.jsx)(R,{title:"Get names",variant:"primary",onClick:c,loading:l.items}),Object(C.jsx)(R,{title:"Update names",variant:"success",disabled:r.updates,onClick:h,loading:l.updates})]})]})},Z=s(47);function J(e){let{languages:t,onClick:s}=e;const a=["Category","Name",...t.map((e=>"Name:".concat(e)))];return Object(C.jsx)("tr",{children:a.map((e=>Object(C.jsx)("th",{style:{cursor:"pointer"},onClick:()=>s(e.toLowerCase()),children:e},e)))})}var D=s(43);function G(e){let{item:t,category:s,languages:n,focused:i,handlers:{onFocus:o,onBlur:c,onChange:r,onIconClick:l}}=e;const h=Object(a.useRef)(null);return Object(a.useEffect)((()=>{i&&0!==document.activeElement.id.indexOf(t.id+"")&&h.current.focus()}),[i,t]),Object(C.jsxs)("tr",{children:[Object(C.jsxs)("td",{className:"category",children:[Object(C.jsx)(D.a,{variant:"info",children:s}),Object(C.jsx)("br",{}),Object(C.jsx)(D.a,{variant:"light",children:t.tags[s]})]}),Object(C.jsxs)("td",{children:[t.tags.wikidata&&Object(C.jsx)("span",{children:Object(C.jsx)("a",{target:"_blank",rel:"noreferrer",href:"https://www.wikidata.org/wiki/".concat(t.tags.wikidata),children:t.tags.name})}),!t.tags.wikidata&&Object(C.jsx)("span",{children:t.tags.name}),Object(C.jsx)("i",{className:"fa fa-crosshairs icon-btn mt-1",style:{float:"right"},onClick:()=>l(t)})]}),n.map(((e,s)=>Object(C.jsx)("td",{children:Object(C.jsx)("input",{type:"text",id:t.id+e,ref:s?null:h,value:t.tags["name:".concat(e)]||"",onChange:s=>r(t,e,s.target.value),onFocus:()=>i?null:o(t.id),onBlur:()=>i?c(t.id):null})},e)))]})}s(68);const H=(e,t,s)=>"category"===s?((e,t)=>e.category.localeCompare(t.caterory)||it.item.tags[e.category].localeCompare(t.item.tags[t.category]))(e,t):((e,t,s)=>(e.tags[s]||"").localeCompare(t.tags[s]||""))(e.item,t.item,s);var K=function(e){let{languages:t,handlers:s,items:n,focused:i,categories:o}=e;const[c,r]=Object(a.useState)("name"),[l,h]=Object(a.useState)(1);return Object(C.jsx)(a.Fragment,{children:Object(C.jsxs)(Z.a,{size:"sm",children:[Object(C.jsx)("thead",{children:Object(C.jsx)(J,{languages:t,onClick:e=>{e===c?h(-l):r(e)}})}),Object(C.jsx)("tbody",{children:n.filter((e=>e.tags.name)).map((e=>({item:e,category:o.find((t=>!!e.tags[t]))}))).sort(((e,t)=>l*H(e,t,c))).map((e=>{let{item:a,category:n}=e;return Object(C.jsx)(G,{category:n,languages:t,item:a,focused:i===a.id,handlers:s},a.id)}))})]})})},Q=s(29),W=(s(69),s(48)),V=s(49);function Y(e){let{user:t,logout:s}=e;return Object(C.jsxs)(a.Fragment,{children:[t.img?Object(C.jsx)(V.a,{src:t.img.href,className:"avatar",thumbnail:!0,rounded:!0}):null,Object(C.jsx)(Q.a.Text,{className:"mx-2",children:t.display_name}),Object(C.jsx)(T.a,{onClick:s,children:"Logout"})]})}function X(e){let{login:t,loading:s}=e;return Object(C.jsx)(R,{title:"Login",loading:s,onClick:t})}var $=function(e){let{user:t,login:s,logout:a,loading:n}=e;return Object(C.jsxs)(Q.a,{variant:"light",bg:"white",children:[Object(C.jsxs)(Q.a.Brand,{className:"mr-auto",children:["OSM Localization Tool (OsmLT) ",Object(C.jsxs)("span",{className:"version",children:["v",W.version," by Tracestrack"]})]}),t.loggedIn?Object(C.jsx)(Y,{logout:a,user:t}):Object(C.jsx)(X,{login:s,loading:n})]})};function ee(e){let{changeset:t,handlers:{onUpdate:s,onClose:n}}=e;const[i,o]=Object(a.useState)((null===t||void 0===t?void 0:t.tags.comment)||"");return Object(a.useEffect)((()=>{o((null===t||void 0===t?void 0:t.tags.comment)||function(e){const t="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===t.length)return t.pop().split(";").shift()}("lastComment")||"")}),[t]),Object(C.jsx)(r.a,{id:"changeset-box",className:"p-2",children:Object(C.jsxs)(r.a.Body,{children:[Object(C.jsxs)(z.a,{className:"pb-2 justify-content-center",children:[Object(C.jsx)(M.a.Label,{children:"Comment:"}),Object(C.jsx)(M.a.Control,{as:"textarea",value:i,onChange:e=>o(e.target.value)})]}),Object(C.jsx)(z.a,{className:"justify-content-center",children:Object(C.jsx)(T.a,{className:"m-1",onClick:()=>n({comment:i}),children:"Close changeset"})})]})})}s(70);var te=function(e){let{changeset:t,handlers:s}=e;const[n,i]=Object(a.useState)();return Object(a.useEffect)((()=>{t||i(!1)}),[t]),Object(C.jsxs)("div",{id:"changeset",children:[Object(C.jsx)(T.a,{id:"changeset-button",onClick:()=>i(!n),disabled:!t,children:t?"Active changeset: ".concat(t.id):"No active changeset"}),n?Object(C.jsx)(ee,{changeset:t,handlers:s}):null]})},se=s(50);const ae="qt body meta center";class ne{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiUrl=e.apiUrl||"https://overpass-api.de/api/interpreter"}request(e){const t=new FormData;t.append("data",e);const s=performance.now();return this.reqId=s,new Promise(((e,a)=>{fetch(this.apiUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:new URLSearchParams(t)}).then((t=>t.ok?t.json().then((t=>{let{elements:n,remark:i}=t;this.reqId!==s?a():(i&&-1!==i.indexOf("error")&&a(i),e(n))})):t.text().then(a))).catch((e=>a(e)))}))}query(e){let{bbox:t,zoom:s,center:a,filters:n,languages:i}=e;var o=n.tags;o.indexOf("=")>-1&&(o=o.replace("=",'"="'));const c=['nwr["'.concat(o,'"]["name"]')],r=n.hideFilled?c.map((e=>i.map((t=>"".concat(e,'[!"name:').concat(t,'"]'))).join(";\n"))):c.join(";\n"),l=n.limit?" "+n.limit:"",h="[out:json][timeout:25][bbox:".concat(t.join(","),"];\n (\n ").concat(r,";\n );\n out ").concat(ae," ").concat(l,";");return this.request(h)}getById(e){const t=e.map((e=>{let[t,s]=e;return"".concat(t,"(").concat(s,")")})).join(";"),s="[out:json][timeout:25];\n (\n ".concat(t,";\n );\n out ").concat(ae,";");return this.request(s)}}class ie{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiUrl=e.apiUrl||"https://nominatim.openstreetmap.org"}query(e){let{bbox:t,filters:s}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=[..."simple"===s.searchMode?["q="+s.search.q]:Object.entries(s.search).filter((e=>{let[t,s]=e;return"q"!==t&&!!s})).map((e=>{let[t,s]=e;return"".concat(t,"=").concat(s)})),"limit="+Math.min(s.limit,50),"format=json","bounded=1","dedupe=1"];a.length&&n.push("exclude_place_ids="+a.join(","));const i=performance.now();return this.reqId=i,new Promise(((e,t)=>{fetch(this.apiUrl+"/search?"+n.join("&")).then((s=>s.ok?s.json().then((s=>{s.error&&t(s),this.reqId!==i?t():e(s)})):s.text().then(t))).catch((e=>t(e)))}))}}const oe="OSM Localization Tool (OsmLT): https://localize.osm.tracestrack.com";var ce={"<":"<",">":">","&":"&",'"':""","'":"'"};function re(e){return Object.entries(e).map((e=>{let[t,s]=e,a=[],n="";Object.entries(s).forEach((e=>{let[t,s]=e;if(Array.isArray(s)){const e=t.replace(/s$/,"");n+=s.map((t=>re({[e]:t}))).join("")}else"object"===typeof s?n+=re({[t]:s}):a.push([t,(i=s,"string"!==typeof i?i:i.replace(/[<>&"']/g,(function(e){return ce[e]})))]);var i}));const i=a.map((e=>{let[t,s]=e;return"".concat(t,'="').concat(s,'"')})).join(" ");return n?"<".concat(t," ").concat(i,">").concat(n,""):"<".concat(t," ").concat(i,"/>")})).join("")}function le(e){return re({osm:{changeset:{tags:Object.entries(e.tags).map((e=>{let[t,s]=e;return{k:t,v:s}}))}}})}function he(e,t){return re({osmChange:{version:"0.6",generator:oe,modify:Object.values(e).map((e=>{let{type:s,tags:a,nodes:n,members:i,...o}=e;return{[s]:{...o,changeset:t,tags:Object.entries(a).map((e=>{let[t,s]=e;return{k:t,v:s}})),...n?{nd:n.map((e=>({ref:e})))}:{},...i?{members:i}:{}}}}))}})}const de=e=>e.map(((e,t)=>t%2?(e+180)%360-180:e%90));class ue{constructor(e){this.config=e,this.auth=Object(se.a)({...e}),this.overpass=new ne({apiUrl:e.overpassApiUrl}),this.nominatim=new ie,this.apiRoute="/api/0.6",this.currentChangeset=e.changeset||!1}fetch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{method:s,body:a,headers:n={},...i}=t;return new Promise(((t,o)=>this.auth.xhr({method:s||"GET",path:this.apiRoute+e,content:a,options:{header:n,...i}},(function(e,s){e?o(e):t(s)}))))}fetchJson(e,t){return this.fetch(e,t).then((e=>JSON.parse(e)))}authenticated(){return this.auth.authenticated()}login(){return new Promise((e=>this.auth.authenticate((t=>{e(t)}))))}logout(){this.auth.logout()}getUser(){return this.fetchJson("/user/details.json")}getElements(e){return"search"===(e={...e,bbox:e.bbox.map(de)}).filters.mode?this.nominatimIncSearch(e):this.overpass.query(e).then((e=>e))}nominatimIncSearch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const s=e.filters.limit,a=t.map((e=>e.place_id));return this.nominatim.query(e,a).then((e=>(t=[...e,...t],t.length?(s&&e.length&&t.length,this.overpass.getById(t.map((e=>[e.osm_type,e.osm_id])))):[]))).catch((e=>{if(console.log(e),t.length)return this.overpass.getById(t.map((e=>[e.osm_type,e.osm_id])))}))}getTwins(e,t){return this.overpass.getTwins(e,t)}updateElements(e){return this.currentChangeset?this.checkChangesetOpen().then((t=>t?this.updateChangeset(e):this.createChangeset().then((()=>this.updateChangeset(e))))):this.createChangeset().then((()=>this.updateChangeset(e)))}getChangesets(){return this.fetch("/changesets")}getCurrentChangeset(){return this.checkChangesetOpen().then((e=>e?this._getCurrentChangeset():this.createChangeset().then((()=>this._getCurrentChangeset()))))}_getCurrentChangeset(){return this.fetchJson("/changeset/".concat(this.currentChangeset,".json")).then((e=>e.elements[0]))}createChangeset(){return this.fetch("/changeset/create",{method:"PUT",body:re({osm:{changeset:[{tag:{k:"created_by",v:oe}},{tag:{k:"comment",v:""}}]}}),headers:{"Content-Type":"text/plain"}}).then((e=>{this.currentChangeset=e}))}checkChangesetOpen(){return this.fetchJson("/changeset/".concat(this.currentChangeset,".json")).then((e=>{var t;return null===(t=e.elements)||void 0===t?void 0:t.pop().open}))}closeChangeset(e,t){this.fetch("/changeset/".concat(this.currentChangeset),{method:"PUT",body:le(e),headers:{"Content-Type":"text/plain"}}).then((()=>{this.fetch("/changeset/".concat(this.currentChangeset,"/close"),{method:"PUT"}).then((()=>{this.currentChangeset=!1,t()}))}))}updateChangeset(e){return this.fetch("/changeset/".concat(this.currentChangeset,"/upload"),{method:"POST",body:he(e,this.currentChangeset),headers:{"Content-Type":"text/plain"}}).then((e=>Object.fromEntries(Array.from(e.children[0].children).map((e=>[e.getAttribute("new_id"),{version:+e.getAttribute("new_version")}])))))}}class ge{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:31536e3;this.cookieDuration=e}get(e){const t=document.cookie.split(";").find((t=>-1!==t.indexOf(e+"=")));return!!t&&t.replace(e+"=","").trim()}write(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.cookieDuration;const s=new Date(Date.now()+1e3*t).toUTCString();Object.entries(e).forEach((e=>{let[t,a]=e;document.cookie="".concat(t,"=").concat(a,"; path=/; expires=").concat(s)}))}clear(){document.cookie.split(";").forEach((e=>{const t=e.split("=")[0];document.cookie="".concat(t,"=; path=/")}))}}const me=(e,t)=>t.find((t=>!e.tags["name:".concat(t)]));class pe{constructor(){this.updates={},this.storageKey="osm-localizer_updated-items"}load(){if(window.localStorage){const e=localStorage.getItem(this.storageKey);e&&(this.updates=JSON.parse(e))}}store(){window.localStorage&&localStorage.setItem(this.storageKey,JSON.stringify(this.updates))}patchAndStore(e,t){for(let s in t)e[s]&&(e[s]={...e[s],...t[s]},this.updates[s]=e[s]);this.store()}sync(e,t,s){const a=[];for(let n=0,i=e.length;ne[n].version?t&&!me(this.updates[i],s)||a.push(this.updates[i]):(delete this.updates[i],a.push(e[n])):a.push(e[n])}return this.store(),a}}s(71),s(72);var be={client_id:"M8nzCZPZGnlJoSrGAMbzsGXXZYtMPg_eyoyEjCyCydo",client_secret:"SdRMd2ReOVMO0VeWVdNuhY0hyYgbbLwMGAusMnO47Hs ",url:"https://www.openstreetmap.org",redirect_uri:"https://localize.osm.tracestrack.com/land.html",apiUrl:"https://api.openstreetmap.org",scope:"openid write_api read_prefs",auto:!0,overpassApiUrl:"https://overpass.kumi.systems/api/interpreter"};const je=[{key:"de",title:"Deutsch"},{key:"en",title:"English"},{key:"fr",title:"Fran\xe7ais"},{key:"ja",title:"\u65e5\u672c\u8a9e"},{key:"ru",title:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439"},{key:"zh-Hans",title:"\u7b80\u4f53\u4e2d\u6587"},{key:"zh-Hant",title:"\u7e41\u4f53\u4e2d\u6587"},{key:"zh",title:"\u4e2d\u6587"},{key:"ml",title:"\u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02"},{key:"ta",title:"\u0ba4\u0bae\u0bbf\u0bb4\u0bcd"},{key:"kn",title:"\u0c95\u0ca8\u0ccd\u0ca8\u0ca1"},{key:"bn",title:"\u09ac\u09be\u0982\u09b2\u09be"},{key:"te",title:"\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41"},{key:"pa",title:"\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40"},{key:"hi",title:"\u0939\u093f\u0928\u094d\u0926\u0940"},{key:"it",title:"Italiano"},{key:"or",title:"\u0b13\u0b21\u0b3c\u0b3f\u0b06"}],fe=[{key:"amenity",title:"Amenity"},{key:"building",title:"Building"},{key:"highway",title:"Highway"},{key:"landuse",title:"Landuse"},{key:"leisure",title:"Leisure"},{key:"man_made",title:"Man-made"},{key:"natural",title:"Natural"},{key:"place",title:"Place"},{key:"public_transport",title:"Public transport"},{key:"railway",title:"Railway"},{key:"route",title:"Route"},{key:"tourism",title:"Tourism"},{key:"waterway",title:"Waterway"}],ye="_osm-localization_languages",xe="_osm-locatization_changeset",Oe=e=>e.center?[e.center.lat,e.center.lon]:[e.lat,e.lon];class ke extends a.Component{constructor(e){super(e),this.cookieManager=new ge,this.osmApi=new ue({...be,changeset:this.cookieManager.get(xe)}),this.updatesStorage=new pe,this.updatesStorage.load();const{zoom:t,center:s}=this.parseURLPath(),a=this.parseURLQuery();this.bbox=[],this.state={user:{loggedIn:!1},center:s,zoom:t,filters:a,items:[],itemsToUpdate:{},focusedItem:!1,watchFocus:!1,loading:{items:!1,updates:!1,auth:!1},serverMsg:{error:!1,text:""},changeset:null,lastReqTags:[]}}parseURLPath(){let e=6,t=[0,0];const s=window.location.hash.replace("#/","");if(s){const[a,n,i]=s.split("/");e=+a,t=[+n,+i]}return{zoom:e,center:t}}parseURLQuery(){const e={tags:["place"],limit:100,hideFilled:!1,search:{q:"",street:"",city:"",county:"",state:"",country:"",postalcode:""},searchMode:"simple",mode:"tags"},t=window.location.search.replace("?","");if(t){const a=Object.fromEntries(t.split("&").map((e=>e.split("="))));if(a.tags&&(e.tags=decodeURIComponent(a.tags)),a.search)try{const t=JSON.parse(decodeURI(a.search));for(let s in e.search)e.search[s]=t[s]||e.search[s],"q"!==s&&t[s]&&(e.searchMode="structured");a.tags||(e.mode="search")}catch(s){}if(a.limit){const t=parseInt(a.limit);isNaN(t)||(e.limit=t)}a.hide_filled&&(e.hideFilled=a.hide_filled&&0!==+a.hide_filled)}return e}loadChangeset(){this.osmApi.currentChangeset&&this.osmApi.getCurrentChangeset().then((e=>{console.log(e),this.setState({changeset:e})}))}closeChangeset(e){let{comment:t}=e,s={...this.state.changeset,tags:{...this.state.changeset.tags,comment:t}};""===s.tags.comment&&alert("Please add a commit message first."),console.log(s);let a=this;this.osmApi.closeChangeset(s,(()=>{a.cookieManager.write({lastComment:t}),window.location.reload()}))}updateLocation(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{zoom:t,center:[s,a],filters:{tags:n,limit:i,hideFilled:o,search:c,mode:r,searchMode:l}}=this.state,h=["/#",t,s.toFixed(4),a.toFixed(4)].join("/"),d=[];if("search"===r){const{q:e,...t}=c,s="simple"===l?{q:e}:t;d.push("search=".concat(JSON.stringify(s)))}else d.push("tags=".concat(encodeURIComponent(n))),o&&d.push("hide_filled=1");i&&d.push("limit=".concat(i));const u="?"+d.join("&");let g=window.location.protocol+"//"+window.location.host+window.location.pathname+u+h;e?window.history.replaceState({searchQ:u,hash:h},"",g):window.history.pushState({searchQ:u,hash:h},"",g)}componentDidMount(){this.osmApi.authenticated()&&this.getUser()}setServerMsg(e){console.log(e),this.setState({serverMsg:e});const t=()=>{document.removeEventListener("click",t),this.setState({serverMsg:{error:!1,text:""}})};document.addEventListener("click",t)}login(){this.setState({loading:{...this.state.loading,auth:!0}}),this.osmApi.login().then((()=>{this.getUser()}))}getLanguages(){const e=this.cookieManager.get(ye);return!!e&&e.split("+")}setLanguages(e){this.setState({user:{...this.state.user,languages:e}}),this.storeLanguages(e)}storeLanguages(e){this.cookieManager.write({[ye]:e.join("+")})}getUser(){this.osmApi.getUser().then((e=>{let t=this.getLanguages()||e.user.languages.filter((e=>je.find((t=>{let{key:s}=t;return s===e}))));this.setState({loading:{...this.state.loading,auth:!1},user:{loggedIn:!0,...e.user,languages:t}}),this.storeLanguages(t),this.loadChangeset()}))}logout(){this.osmApi.logout(),this.setState({user:{loggedIn:!1}})}getItems(){this.setState({loading:{...this.state.loading,items:!0}}),this.osmApi.getElements({center:this.state.center,zoom:this.state.zoom,bbox:this.bbox,filters:this.state.filters,languages:this.state.user.languages}).then((e=>{this.setState({items:this.updatesStorage.sync(e,this.state.filters.hideFilled,this.state.user.languages),itemsToUpdate:{},loading:{...this.state.loading,items:!1},lastReqTags:"search"===this.state.filters.mode?fe.map((e=>e.key)):this.state.filters.tags.slice()})})).catch((e=>{console.log(e),this.setState({loading:{...this.state.loading,items:!1}}),this.setServerMsg({text:e,error:!0})}))}updatePosition(e){let{bbox:t,center:s,zoom:a}=e;this.setState({center:s,zoom:a},(()=>this.updateLocation(!0))),this.bbox=t}updateBbox(e){let{bbox:t}=e;this.bbox=t}updateItem(e,t,s){e.tags["name:".concat(t)]=s,this.setState({itemsToUpdate:{...this.state.itemsToUpdate,[e.id]:e}})}setFilter(e,t){console.log(e),this.setState({filters:{...this.state.filters,tags:e}},(()=>{this.updateLocation(),t&&t()}))}updateItems(){this.setState({loading:{...this.state.loading,updates:!0}});let e=this.state.itemsToUpdate;console.log(e),this.osmApi.updateElements(e).then((e=>{this.updatesStorage.patchAndStore(this.state.itemsToUpdate,e),this.cookieManager.write({[xe]:this.osmApi.currentChangeset}),this.setServerMsg({text:"Items are successfully updated.",error:!1}),this.setState({itemsToUpdate:{},loading:{...this.state.loading,updates:!1}}),this.loadChangeset()})).catch((e=>{this.setServerMsg({text:String.toString(e),error:!0}),this.setState({loading:{...this.state.loading,updates:!1}})}))}focusItem(e){if(this.state.watchFocus){const t=this.state.items.find((t=>t.id===e));this.setState({center:Oe(t),focusedItem:e})}else this.setState({focusedItem:e})}blurItem(){this.setState({focusedItem:!1})}centerItem(e){this.setState({center:Oe(e),zoom:Math.max(this.state.zoom,14)})}render(){const e={items:this.state.loading.updates||("tags"===this.state.filters.mode?this.state.zoom<10:!("simple"===this.state.filters.searchMode?this.state.filters.search.q:Object.entries(this.state.filters.search).find((e=>{let[t,s]=e;return"q"!==t&&!!s})))),updates:!Object.keys(this.state.itemsToUpdate).length},t=Object.keys(this.state.itemsToUpdate).map((e=>+e)),s={onLoad:this.updateBbox.bind(this),onMove:this.updatePosition.bind(this),onClickItem:this.focusItem.bind(this),onClickMap:this.blurItem.bind(this)},n={onFocus:this.focusItem.bind(this),onBlur:this.blurItem.bind(this),onChange:this.updateItem.bind(this),onIconClick:this.centerItem.bind(this)},i={onClose:this.closeChangeset.bind(this)},o=this.state.user.languages?this.state.user.languages[0]:"en",l=fe.map((e=>e.key));return Object(C.jsxs)(c.a,{className:"App",fluid:!0,children:[Object(C.jsx)($,{login:this.login.bind(this),logout:this.logout.bind(this),user:this.state.user,loading:this.state.loading.auth}),Object(C.jsx)(I,{zoom:this.state.zoom,center:this.state.center,items:this.state.items,lang:o,touched:t,focused:this.state.focusedItem,watchFocus:this.state.watchFocus,handlers:s}),Object(C.jsx)(r.a,{className:"card-items card p-1",children:this.state.user.loggedIn?Object(C.jsxs)(a.Fragment,{children:[Object(C.jsxs)(r.a.Header,{children:[Object(C.jsx)(B,{filters:this.state.filters,setFilter:this.setFilter.bind(this),tagsList:fe,loading:this.state.loading,languages:this.state.user.languages||[],languagesList:je,setLanguages:this.setLanguages.bind(this),items:this.state.items,getItems:this.getItems.bind(this),disabled:e,updateItems:this.updateItems.bind(this)}),Object(C.jsx)("div",{className:this.state.serverMsg.error?"text-danger":"text-success",children:this.state.serverMsg.text})]}),Object(C.jsx)(r.a.Body,{className:this.state.loading.items?"items-loading":"",children:Object(C.jsx)(K,{categories:l,languages:this.state.user.languages||[],items:this.state.items,focused:this.state.focusedItem,handlers:n})})]}):Object(C.jsx)(r.a.Body,{className:"d-flex align-items-center justify-content-center",children:Object(C.jsx)(L,{})})}),Object(C.jsx)(te,{changeset:this.state.changeset,handlers:i})]})}}var Ce=ke;var ve=e=>{e&&e instanceof Function&&s.e(3).then(s.bind(null,81)).then((t=>{let{getCLS:s,getFID:a,getFCP:n,getLCP:i,getTTFB:o}=t;s(e),a(e),n(e),i(e),o(e)}))};o.a.render(Object(C.jsx)(n.a.StrictMode,{children:Object(C.jsx)(Ce,{})}),document.getElementById("root")),ve()}},[[73,1,2]]]); +//# sourceMappingURL=main.5937fa8b.chunk.js.map \ No newline at end of file diff --git a/docs/static/js/main.5937fa8b.chunk.js.map b/docs/static/js/main.5937fa8b.chunk.js.map new file mode 100644 index 0000000..8a30b56 --- /dev/null +++ b/docs/static/js/main.5937fa8b.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["components/Map/MapView.js","components/Map/getIcon.js","components/Map/MarkerWithFocus.js","config/map.js","components/Map/Map.js","components/Map/index.js","components/NotLoggedInGreeting.js","components/ItemsFilters/CheckboxButton.js","components/ItemsFilters/CheckboxGroup.js","components/ItemsFilters/CheckboxDropdownItem.js","components/ItemsFilters/CheckboxDropdownGroup.js","components/common/LoadingButton.js","components/ItemsFilters/ItemsFilters.js","components/ItemsFilters/index.js","components/ItemsTable/ItemTableHeader.js","components/ItemsTable/ItemTableRow.js","components/ItemsTable/ItemsTable.js","components/ItemsTable/index.js","components/AppNavbar/UserLoggedIn.js","components/AppNavbar/UserLoggedOut.js","components/AppNavbar/index.js","components/AppNavbar/AppNavbar.js","components/ChangesetSettings/ChangesetBox.js","components/ChangesetSettings/index.js","components/ChangesetSettings/ChangesetSettings.js","api/Overpass.js","api/Nominatim.js","api/OSM.js","utils/CookieManager.js","utils/UpdatesStorage.js","config/auth.js","config/interface.js","App.js","reportWebVitals.js","index.js"],"names":["toArray","coord","lat","lng","MapView","_ref","onLoad","onMove","onClick","center","zoom","map","useMap","c","getCenter","flyTo","useMapEvents","moveend","bbox","Object","values","getBounds","getZoom","click","createIcon","type","color","shape","L","AwesomeMarkers","icon","prefix","markerColor","className","createIcons","touched","focused","defaultIcon","iconTypes","cat","tag","iconType","getIcon","item","find","tags","indexOf","MarkerWithFocus","position","markerRef","useRef","eventHandlers","useMemo","_jsx","Marker","ref","mapConfig","tileUrl","attribution","minZoom","maxZoom","getItemPosition","osmCoordsArr","lon","Map","items","lang","handlers","onClickItem","onClickMap","addLang","_jsxs","MapContainer","scrollWheelZoom","children","TileLayer","url","id","ScaleControl","NotLoggedInGreeting","href","CheckboxButton","vkey","title","onChange","checked","Button","variant","size","FormCheck","CheckboxGroup","itemsList","selected","min","Checkbox","Fragment","_ref2","key","i","length","slice","toggle","CheckboxDropdownItem","Dropdown","Item","onMouseDown","e","stopPropagation","active","CheckboxDropdownGroup","dpShow","setDpShow","useState","useEffect","fn","document","addEventListener","removeEventListener","DropdownButton","show","preventDefault","rootCloseEvent","LoadingButton","loading","disabled","props","Spinner","as","animation","ItemsFilters","filters","setFilter","tagsList","languages","languagesList","getItems","updateItems","setLanguages","onKeyUp","useCallback","charCode","onClickShortcut","t","target","innerText","console","log","Form","Group","controlId","Label","Control","value","onKeyPress","Row","updates","ItemTableHeader","titles","concat","style","cursor","toLowerCase","category","onFocus","onBlur","onIconClick","firstInput","activeElement","current","focus","Badge","wikidata","rel","name","float","compareTags","i1","i2","field","compareCategoryTag","localeCompare","caterory","it","compareNames","ItemsTable","categories","sortField","setField","sortOrder","setOrder","Table","filter","sort","ItemTableRow","UserLoggedIn","user","logout","img","Image","src","thumbnail","rounded","Navbar","Text","display_name","UserLoggedOut","login","AppNavbar","bg","Brand","packageJson","loggedIn","ChangesetBox","changeset","onUpdate","onClose","newComment","setComment","comment","parts","cookie","split","pop","shift","getCookie","Card","Body","ChangesetSettings","visible","setVisible","outTypes","Overpass","constructor","config","arguments","undefined","this","apiUrl","request","query","data","FormData","append","reqId","performance","now","Promise","resolve","reject","fetch","method","headers","body","URLSearchParams","then","response","ok","json","elements","remark","text","catch","err","condition","replace","baseEls","elementsQuery","hideFilled","base","l","join","limit","getById","typesIds","_ref3","NominatimAPI","excludeIds","params","searchMode","search","q","entries","k","val","Math","push","resp","error","appTag","XML_CHAR_MAP","json2xml","v","attrs","forEach","k1","v1","Array","isArray","k11","obj","s","ch","attrsStr","createOsm","osm","_ref4","createOsmChange","changesetId","osmChange","version","generator","modify","_ref5","nodes","members","_ref6","nd","constrain","coords","OSMApi","auth","osmAuth","overpass","overpassApiUrl","nominatim","Nominatim","apiRoute","currentChangeset","route","options","opts","xhr","path","content","header","res","fetchJson","JSON","parse","authenticated","authenticate","getUser","getElements","mode","nominatimIncSearch","collected","exclude","el","place_id","elemsNom","osm_type","osm_id","getTwins","updateElements","checkChangesetOpen","open","updateChangeset","createChangeset","getChangesets","getCurrentChangeset","_getCurrentChangeset","createdId","_res$elements","closeChangeset","cb","diffRes","fromEntries","from","getAttribute","CookieManager","duration","cookieDuration","get","trim","write","dict","dateStr","Date","toUTCString","clear","hasEmpty","langs","UpdatesStorage","storageKey","load","window","localStorage","getItem","store","setItem","stringify","patchAndStore","diff","sync","itemsSync","n","authConfig","client_id","client_secret","redirect_uri","scope","auto","cookieKeys","itemCenter","App","Component","super","cookieManager","osmApi","updatesStorage","parseURLPath","parseURLQuery","state","itemsToUpdate","focusedItem","watchFocus","serverMsg","lastReqTags","hash","location","z","street","city","county","country","postalcode","decodeURIComponent","searchParams","decodeURI","parseInt","isNaN","hide_filled","loadChangeset","setState","alert","_t","reload","updateLocation","toFixed","searchParts","structured","searchObj","encodeURIComponent","searchQ","protocol","host","pathname","history","replaceState","pushState","componentDidMount","setServerMsg","getLanguages","str","storeLanguages","updatePosition","updateBbox","updateItem","doneCb","String","toString","focusItem","itemId","blurItem","centerItem","max","render","btnsDisabled","keys","touchedItems","mapHandlers","bind","itemHandlers","changesetHandlers","Container","fluid","Header","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","React","StrictMode","getElementById"],"mappings":"61CAEA,MAAMA,EAAUC,GAAS,CAACA,EAAMC,IAAKD,EAAME,KAE5B,SAASC,EAAOC,GAA2C,IAA1C,OAACC,EAAM,OAAEC,EAAM,QAAEC,EAAO,OAAEC,EAAM,KAAEC,GAAKL,EACnE,MAAMM,EAAMC,cACZ,IAAIC,EAAIF,EAAIG,YAqBZ,OApBGD,EAAEX,MAAQO,EAAO,IAAMI,EAAEV,MAAQM,EAAO,IACvCE,EAAII,MAAMN,EAAQC,GAEtBM,YAAa,CACTC,QAASA,KACL,IAAIJ,EAAIF,EAAIG,YACZP,EAAO,CACHW,KAAMC,OAAOC,OAAOT,EAAIU,aAAaV,IAAIX,GACzCS,OAAQT,EAAQa,GAChBH,KAAMC,EAAIW,WACZ,EAENC,MAAOA,KACHf,GAAS,IAGjBF,EAAO,CACHY,KAAMC,OAAOC,OAAOT,EAAIU,aACnBV,IAAIX,KAEN,IACX,C,qDCtBA,MAiBMwB,EAAaA,CAACC,EAAMC,EAAOC,IAAUC,IAAEC,eAAeC,KAAK,CAC7DA,KAAML,EACNM,OAAQ,KACRC,YAAaN,EACbO,UAAW,iCAAmCN,IAG5CO,EAAc7B,IAAA,IAAC,KAACoB,EAAI,MAAEE,EAAK,MAAED,EAAQ,QAAOrB,EAAA,MAAM,CACpDyB,KAAMN,EAAWC,EAA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nG,aAAa8U,KAAK3O,MACrC3K,MAAO2K,KAAKgL,MAAM3V,MAClBsE,SAAUqG,KAAKrG,SAASgV,KAAK3O,MAC7BhH,SAAUuV,EACV3U,YAAaoG,KAAKpG,YAAY+U,KAAK3O,QAEvCvL,cAAA,OAAKpB,UAAW2M,KAAKgL,MAAMI,UAAUjI,MACnB,cACA,eAAerN,SAC5BkK,KAAKgL,MAAMI,UAAU5J,UAG9B/M,cAAC4K,IAAKC,KAAI,CACNjM,UAAW2M,KAAKgL,MAAMjS,QAAQ1D,MACpB,gBACE,GAAGS,SAEfrB,cAACmI,EAAU,CACPC,WAAY5I,EACZwF,UAAWuG,KAAKgL,MAAMzN,KAAK9D,WAAW,GACtCpE,MAAO2K,KAAKgL,MAAM3V,MAClB7B,QAASwM,KAAKgL,MAAME,YACpB3V,SAAUqZ,SAKnBna,cAAC4K,IAAKC,KAAI,CAACjM,UAAU,mDAAkDyC,SAClErB,cAAC0B,EAAmB,QAGhC1B,cAAC8K,GAAiB,CACdd,UAAWuB,KAAKgL,MAAMvM,UACtBlJ,SAAUsZ,MAI1B,EAGWrE,UC3hBAyE,OAZSC,IAClBA,GAAeA,aAAuBC,UACxC,6BAAqBjO,MAAKzP,IAAkD,IAAjD,OAAE2d,EAAM,OAAEC,EAAM,OAAEC,EAAM,OAAEC,EAAM,QAAEC,GAAS/d,EACpE2d,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,EAAY,GAExB,ECHFO,IAASnB,OACP7Z,cAACib,IAAMC,WAAU,CAAA7Z,SACfrB,cAAC+V,GAAG,MAENjS,SAASqX,eAAe,SAM1BX,I","file":"static/js/main.5937fa8b.chunk.js","sourcesContent":["import {useMapEvents, useMap} from 'react-leaflet';\n\nconst toArray = coord => [coord.lat, coord.lng];\n\nexport default function MapView({onLoad, onMove, onClick, center, zoom}) {\n const map = useMap();\n let c = map.getCenter();\n if(c.lat !== center[0] || c.lng !== center[1])\n map.flyTo(center, zoom);\n \n useMapEvents({\n moveend: () => {\n let c = map.getCenter();\n onMove({\n bbox: Object.values(map.getBounds()).map(toArray),\n center: toArray(c),\n zoom: map.getZoom()\n });\n },\n click: () => {\n onClick();\n }\n });\n onLoad({\n bbox: Object.values(map.getBounds())\n .map(toArray),\n });\n return null;\n}\n","import L from 'leaflet';\nimport \"leaflet/dist/leaflet.css\";\nimport \"leaflet.awesome-markers/dist/leaflet.awesome-markers.js\";\nimport \"leaflet.awesome-markers/dist/leaflet.awesome-markers.css\";\nimport \"@fortawesome/fontawesome-free/css/all.css\";\n\nconst icons = [\n\n {cat: \"tourism\", tag: [\"hotel\", \"hostel\"], iconType: \"hotel\"},\n {cat: \"place\", tag: [\"city\", \"town\", \"neighborhood\"], iconType: \"city\"},\n {cat: \"place\", tag: [\"village\", \"hamlet\"], iconType: \"home\"},\n\n {cat: \"aeroway\", iconType: \"plane\"},\n {cat: \"shop\", iconType: \"store\"},\n {cat: \"historic\", iconType: \"monument\"},\n {cat: \"leisure\", iconType: \"futbol\"},\n {cat: \"tourism\", iconType: \"compass\"},\n {cat: \"highway\", iconType: \"road\"},\n {cat: \"building\", iconType: \"building\"},\n {cat: \"natural\", iconType: \"tree\"},\n {cat: \"waterway\", iconType: \"water\"}\n];\n\nconst createIcon = (type, color, shape) => L.AwesomeMarkers.icon({\n icon: type,\n prefix: \"fa\",\n markerColor: color,\n className: \"awesome-marker awesome-marker-\" + shape\n});\n\nconst createIcons = ({type, shape, color = \"blue\"}) => ({\n icon: createIcon(type, color, shape),\n touched: createIcon(type, \"orange\", shape),\n focused: createIcon(type, \"red\", shape),\n})\n\nconst defaultIcon = createIcons({type: \"circle\"});\n\nconst iconTypes = icons.map(icon => ({\n ...icon,\n ...createIcons({type: icon.iconType})\n}));\n \nconst getIcon = (item, touched, focused) => {\n return (\n iconTypes.find(icon => \n (!icon.tag && item[icon.cat]) || \n (item.tags[icon.cat] && item.tags[icon.cat].indexOf(icon.tag) !== -1)\n ) || \n defaultIcon\n )[focused ? \"focused\" : touched ? \"touched\" : \"icon\"];\n};\n\nexport default getIcon;\n","\nimport {useMemo, useRef} from \"react\";\nimport {Marker} from 'react-leaflet';\nimport getIcon from \"./getIcon\";\n\nexport default function MarkerWithFocus({\n item, touched, focused, position, onClick\n}) {\n const markerRef = useRef(null)\n const eventHandlers = useMemo(\n () => ({\n click: onClick\n }),\n [onClick],\n );\n return (\n \n \n )\n}","/* eslint-disable */\n\nconst OSMtiles = {\n tileUrl: \"https://tile.tracestrack.com/en/{z}/{x}/{y}.png?key=ad185d84befbbb5463e093c682930866\",\n attribution: '© OpenStreetMap contributors',\n};\n\n// localized tiles \n// note that new translations are applied after while\nconst WikimediaTiles = {\n tileUrl: \"https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png\",\n attribution: `Wikimedia maps | Map data © OpenStreetMap contributors`,\n // this will tell Map component to add ?lang={lang} to tileUrl\n // lang = first language you will choose in the interface\n addLang: true\n};\n\nconst mapConfig = {\n ...OSMtiles, \n minZoom: 3,\n maxZoom: 19\n};\nexport default mapConfig;\n","\nimport {MapContainer, TileLayer, ScaleControl} from 'react-leaflet';\nimport MapView from \"./MapView\";\nimport MarkerWithFocus from \"./MarkerWithFocus\";\nimport mapConfig from \"../../config/map\";\n\nconst osmCoordsArr = coord => [coord.lat, coord.lon];\nconst getItemPosition = item => osmCoordsArr(item.center || item);\n\nexport default function Map({\n center, \n zoom, \n items, \n touched,\n lang = \"en\",\n focused, \n handlers: {onMove, onLoad, onClickItem, onClickMap}\n}) {\n let tileUrl = mapConfig.tileUrl;\n if(mapConfig.addLang) {\n tileUrl += \"?lang=\" + lang;\n }\n return (\n \n \n \n {items\n .map(item => (\n onClickItem(item.id)}\n key={item.id} \n />\n ))}\n \n \n );\n}","import Map from \"./Map\"\nexport default Map;","export default function NotLoggedInGreeting() {\n return (\n
\n

Welcome

\n

OpenStreetMap Localization Tool (OsmLT) is started by Tracestrack.com. It greately faciliates localizing OpenStreetMap. It is open sourced on Github.

\n\n

Login with your OpenStreetMap account and start editing today!

\n
\n );\n}\n","import FormCheck from \"react-bootstrap/FormCheck\";\nimport Button from \"react-bootstrap/Button\";\n\nexport default function CheckboxButton({vkey, title, onChange, checked}) {\n return (\n \n );\n}\n\n","import CheckboxButton from \"./CheckboxButton\";\nimport {Fragment} from \"react\";\n\nfunction toggle(selected, key, min) {\n const i = selected.indexOf(key);\n if(i === -1) {\n return [...selected, key];\n }\n if(selected.length <= min) {\n return selected;\n }\n return [\n ...selected.slice(0, i),\n ...selected.slice(i+1)\n ];\n}\n\nfunction CheckboxGroup({\n itemsList, \n selected, \n onChange, \n min = 0,\n Checkbox = CheckboxButton\n}) {\n return (\n \n {itemsList.map(({key, title}) => \n onChange(toggle(selected, key, min))}\n />\n )}\n \n );\n}\n\nexport default CheckboxGroup;","import Dropdown from \"react-bootstrap/Dropdown\";\nimport FormCheck from \"react-bootstrap/FormCheck\";\n\nexport default function CheckboxDropdownItem({vkey, title, onChange, checked}) {\n return (\n onChange(vkey)}\n onClick={e => e.stopPropagation()}\n active={checked}\n >\n {title}\n onChange(vkey)}\n onChange={() => {}}\n />\n \n );\n}\n\n","import CheckboxGroup from \"../ItemsFilters/CheckboxGroup\";\nimport DropdownButton from \"react-bootstrap/DropdownButton\";\nimport CheckboxDropdownItem from \"./CheckboxDropdownItem\";\n\nimport {useEffect, useState} from \"react\";\n\nexport default function CheckboxDropdownGroup({title, itemsList, selected, onChange, min}) {\n // react-bootstrap dropdown has a bad habit to close after selecting an item\n // that's working with menus okay, but not with checkbox group\n\n const [dpShow, setDpShow] = useState(false);\n\n useEffect(() => {\n if(dpShow) {\n const fn = document.addEventListener(\"click\", () => {\n setDpShow(false);\n document.removeEventListener(\"click\", fn);\n });\n }\n }, [dpShow]);\n\n const onClickDp = e => {\n setDpShow(!dpShow);\n e.preventDefault();\n e.stopPropagation();\n }\n\n return (\n \n \n \n );\n}","import Button from \"react-bootstrap/Button\";\nimport Spinner from \"react-bootstrap/Spinner\";\n\nexport default function LoadingButton({title, onClick, loading, disabled, ...props}) {\n return (\n \n );\n}\n","import Button from 'react-bootstrap/Button';\nimport Form from 'react-bootstrap/Form';\nimport Row from \"react-bootstrap/Row\";\nimport CheckboxDropdownGroup from \"./CheckboxDropdownGroup\";\nimport LoadingButton from \"../common/LoadingButton\";\nimport \"./ItemsFilters.css\";\nimport React, { useCallback } from 'react';\n\n\nfunction ItemsFilters({\n filters,\n setFilter,\n tagsList,\n languages,\n languagesList,\n getItems,\n disabled,\n loading,\n updateItems,\n setLanguages\n}) {\n\n const onKeyUp = useCallback(\n (e) => {\n if (e.charCode === 13) {\n getItems();\n }\n },\n [getItems], // Tells React to memoize regardless of arguments.\n );\n\n\n const onClickShortcut = useCallback(\n (e) => {\n let t = e.target.innerText;\n console.log(t);\n setFilter(t, () => {getItems();});\n },\n [setFilter, getItems], // Tells React to memoize regardless of arguments.\n );\n\n return (\n
\n\n \n\n\n \n Tag to search: \n \n \n \n \n \n setFilter(tags.target.value)} onKeyPress={onKeyUp} />\n \n\n \n \n \n \n\n \n );\n}\n\nexport default ItemsFilters;\n","import ItemsFilters from \"./ItemsFilters\";\nexport default ItemsFilters;","\nexport default function ItemTableHeader({languages, onClick}) {\n const titles = [\"Category\", \"Name\",...languages.map(lang => `Name:${lang}`)];\n return (\n \n {titles.map(title => \n ( onClick(title.toLowerCase())}\n >{title}\n ))\n }\n \n );\n}","import {useRef, useEffect} from \"react\";\nimport Badge from \"react-bootstrap/Badge\";\n\nexport default function Item({\n item, \n category,\n languages, \n focused,\n handlers: {onFocus, onBlur, onChange, onIconClick}\n}) {\n const firstInput = useRef(null);\n useEffect(() => {\n if (focused && \n document.activeElement.id.indexOf(item.id+\"\") !== 0) {\n firstInput.current.focus();\n }\n }, [focused, item]);\n \n return (\n \n \n \n {category}\n
\n \n {item.tags[category]}\n \n \n \n\n {item.tags.wikidata && ({item.tags.name})}\n {!item.tags.wikidata && ({item.tags.name})}\n\n onIconClick(item)}\n />\n \n {languages.map((lang, i) => (\n \n onChange(item, lang, e.target.value)}\n onFocus={() => focused ? null : onFocus(item.id)}\n onBlur={() => focused ? onBlur(item.id) : null}\n />\n ))}\n \n );\n}\n","\nimport {Fragment, useState} from \"react\";\nimport Table from \"react-bootstrap/Table\";\nimport ItemTableHeader from \"./ItemTableHeader\";\nimport ItemTableRow from \"./ItemTableRow\"\nimport \"./ItemsTable.css\";\n\n\nconst compareNames = (i1, i2, field) =>\n (i1.tags[field]||\"\").localeCompare(i2.tags[field]||\"\");\n\nconst compareCategoryTag = (i1, i2) =>\n i1.category.localeCompare(i2.caterory) ||\n it.item.tags[i1.category].localeCompare(i2.item.tags[i2.category]);\n\nconst compareTags = (i1, i2, field) => field === \"category\" ?\n compareCategoryTag(i1, i2)\n : compareNames(i1.item, i2.item, field)\n\n\nfunction ItemsTable({\n languages,\n handlers,\n items,\n focused,\n categories\n}) {\n const [sortField, setField] = useState(\"name\");\n const [sortOrder, setOrder] = useState(1);\n\n const setSort = field => {\n if(field === sortField)\n setOrder(-sortOrder);\n else\n setField(field);\n };\n\n return (\n \n \n \n \n \n \n {items\n .filter(i => i.tags.name)\n .map(item => ({\n item,\n category: categories.find(t => !!item.tags[t])\n }))\n .sort((i1, i2) => sortOrder * compareTags(i1, i2, sortField))\n .map(({item, category}) => (\n )\n )}\n \n
\n
\n );\n\n}\n\nexport default ItemsTable;\n","import ItemsTable from \"./ItemsTable\";\nexport default ItemsTable;","import {Fragment} from \"react\";\nimport Navbar from \"react-bootstrap/Navbar\";\nimport Button from \"react-bootstrap/Button\";\nimport Image from \"react-bootstrap/Image\";\n\nexport default function UserLoggedIn({user, logout}) {\n return (\n \n {user.img ? \n \n : null\n }\n {user.display_name}\n \n \n \n );\n}","import LoadingButton from \"../common/LoadingButton\";\n\nexport default function UserLoggedOut({login, loading}) {\n return (\n \n );\n}\n","import AppNavbar from \"./AppNavbar\";\n\nexport default AppNavbar;","\nimport Navbar from \"react-bootstrap/Navbar\";\nimport \"./AppNavbar.css\";\nimport packageJson from '../../package.alias.json';\nimport UserLoggedIn from \"./UserLoggedIn\";\nimport UserLoggedOut from \"./UserLoggedOut\";\n//import logo from \"../../assets/logo.svg\";\n\nexport default function AppNavbar({user, login, logout, loading}) {\n return (\n \n \n OSM Localization Tool (OsmLT) v{packageJson[\"version\"]} by Tracestrack\n \n {user.loggedIn ? \n \n : \n }\n \n );\n}\n","import {useState, useEffect} from \"react\";\nimport Card from \"react-bootstrap/Card\";\nimport Button from \"react-bootstrap/Button\";\nimport Row from \"react-bootstrap/Row\";\nimport Form from \"react-bootstrap/Form\";\n\n\nfunction getCookie(name) {\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) return parts.pop().split(';').shift();\n}\n\nexport default function ChangesetBox({\n changeset, \n handlers: {onUpdate, onClose}}\n) {\n const [newComment, setComment] = useState(changeset?.tags.comment||\"\");\n\n useEffect(() => {\n setComment(changeset?.tags.comment||getCookie(\"lastComment\")||\"\");\n }, [changeset]);\n\n return (\n \n \n \n Comment:\n setComment(e.target.value)}\n />\n \n \n \n \n \n \n )\n}\n","import ChangesetSettings from \"./ChangesetSettings\";\nexport default ChangesetSettings;","import Button from \"react-bootstrap/Button\";\nimport ChangesetBox from \"./ChangesetBox\";\nimport \"./ChangesetSettings.css\";\nimport {useState, useEffect} from \"react\";\n\n\nexport default function ChangesetSettings({changeset, handlers}) {\n const [visible, setVisible] = useState();\n\n useEffect(() => {\n if(!changeset)\n setVisible(false);\n }, [changeset]);\n\n return (\n
\n \n {visible ?\n \n : null}\n
\n );\n}","const defaultApiUrl = \"https://overpass-api.de/api/interpreter\";\n\nconst outTypes = \"qt body meta center\"; //we need meta for \"version\" field\n\nexport default class Overpass {\n constructor(config = {}) {\n this.apiUrl = config.apiUrl || defaultApiUrl;\n }\n request(query) {\n const data = new FormData();\n data.append(\"data\", query);\n const reqId = performance.now();\n this.reqId = reqId;\n return new Promise((resolve, reject) => {\n fetch(this.apiUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=utf-8\"\n },\n body: new URLSearchParams(data)\n })\n .then(response => response.ok ?\n response.json()\n .then(({elements, remark}) => {\n if(this.reqId !== reqId)\n reject();\n else {\n if(remark && remark.indexOf(\"error\") !== -1) {\n reject(remark);\n }\n resolve(elements);\n }\n }) :\n response.text()\n .then(reject)\n\n )\n .catch(err => reject(err));\n })\n }\n /*\n getTwins(el, tags) {\n\n var condition = filters.tags;\n if (condition.indexOf(\"=\") > -1) {\n condition = condition.replace(\"=\", '\"=\"');\n }\n\n const tagsStr = tags.filter(t => el.tags[t])\n .map(t => `[\"${t}\"=\"${el.tags[t]}\"]`);\n const query =\n `[out:json][timeout:25];\n ${el.type}(${el.id});\n complete(100) {\n nwr(around:500)${tagsStr}[\"name\"=\"${el.tags.name}\"];\n }\n out ${outTypes};`\n\n return this.request(query);\n }*/\n query({bbox, zoom, center, filters, languages}) {\n\n var condition = filters.tags;\n if (condition.indexOf(\"=\") > -1) {\n condition = condition.replace(\"=\", '\"=\"');\n }\n\n const baseEls = [`nwr[\"${condition}\"][\"name\"]`];\n const elementsQuery = filters.hideFilled ?\n baseEls.map(base =>\n languages.map(l => `${base}[!\"name:${l}\"]`)\n .join(\";\\n\")\n )\n : baseEls.join(\";\\n\");\n\n\n const limit = filters.limit ? \" \" + filters.limit : \"\";\n const query =\n `[out:json][timeout:25][bbox:${bbox.join(\",\")}];\n (\n ${elementsQuery};\n );\n out ${outTypes} ${limit};`;\n\n return this.request(query);\n }\n getById(typesIds) {\n const elementsQuery = typesIds.map(\n ([type, id]) => `${type}(${id})`).join(\";\");\n const query =\n `[out:json][timeout:25];\n (\n ${elementsQuery};\n );\n out ${outTypes};`;\n\n return this.request(query);\n }\n}\n","const apiUrl = \"https://nominatim.openstreetmap.org\";\nconst apiElemLimit = 50;\n\n\n\nexport default class NominatimAPI {\n constructor(config = {}) {\n this.apiUrl = config.apiUrl || apiUrl;\n }\n query({bbox, filters}, excludeIds=[]) {\n const searchQuery = filters.searchMode === \"simple\" ?\n [\"q=\" + filters.search.q]\n : Object.entries(filters.search)\n .filter(([k,val]) => k !== \"q\" && !!val)\n .map(([k, val]) => `${k}=${val}`)\n const params = [\n ...searchQuery,\n \"limit=\" + Math.min(filters.limit, apiElemLimit),\n //\"viewbox=\" + bbox.map(c => c.reverse().join(\",\")).join(\",\"),\n \"format=json\",\n \"bounded=1\",\n \"dedupe=1\"\n ];\n\n if(excludeIds.length) {\n params.push(\"exclude_place_ids=\" + excludeIds.join(\",\"));\n }\n const reqId = performance.now();\n this.reqId = reqId;\n return new Promise((resolve, reject) => {\n fetch(this.apiUrl + \"/search?\" + params.join(\"&\"))\n .then(response => response.ok ?\n response.json()\n .then((resp) => {\n if(resp.error)\n reject(resp);\n if(this.reqId !== reqId)\n reject();\n else {\n resolve(resp);\n }\n }) :\n response.text()\n .then(reject)\n\n )\n .catch(err => reject(err));\n })\n }\n}\n","import {osmAuth} from \"osm-auth\";\nimport Overpass from \"./Overpass\";\nimport Nominatim from \"./Nominatim\";\n\n// tag to identify changesets created by app\nconst appTag = \"OSM Localization Tool (OsmLT): https://localize.osm.tracestrack.com\";\n\n\nvar XML_CHAR_MAP = {\n\t'<': '<',\n\t'>': '>',\n\t'&': '&',\n\t'\"': '"',\n\t\"'\": '''\n};\n\nfunction escapeXml (s) {\n if (typeof s !== \"string\") return s;\n\n return s.replace(/[<>&\"']/g, function (ch) {\n return XML_CHAR_MAP[ch];\n });\n}\n\nfunction json2xml(json) {\n return Object.entries(json)\n .map(([k, v]) => {\n let attrs = [];\n let children = \"\";\n Object.entries(v)\n .forEach(([k1, v1]) => {\n if(Array.isArray(v1)) {\n const k11 = k1.replace(/s$/, \"\");\n children += v1.map(obj => json2xml({[k11]: obj}))\n .join(\"\");\n } else if(typeof(v1) === \"object\") {\n children += json2xml({[k1]: v1});\n } else {\n attrs.push([k1, escapeXml(v1)]);\n }\n });\n\n const attrsStr = attrs.map(([k1, v1]) => `${k1}=\"${v1}\"`).join(\" \");\n return children ?\n `<${k} ${attrsStr}>${children}`\n : `<${k} ${attrsStr}/>`;\n })\n .join(\"\");\n}\n\nfunction createChangeset() {\n return json2xml({\n osm: {\n changeset: [\n {tag: {k: \"created_by\", v: appTag}},\n {tag: {k: \"comment\", v: \"\"}}\n ]\n }\n });\n}\nfunction createOsm(changeset) {\n return json2xml({\n osm: {\n changeset: {\n tags: Object.entries(changeset.tags)\n .map(([k, v]) => ({k, v}))\n }\n }\n });\n}\n\nfunction createOsmChange(updates, changesetId) {\n return json2xml({\n osmChange: {\n version: \"0.6\",\n generator: appTag,\n modify: Object.values(updates)\n .map(({type, tags, nodes, members, ...attrs}) => ({\n [type]: {\n ...attrs,\n changeset: changesetId,\n tags: Object.entries(tags)\n .map(([k, v]) => ({k, v})),\n // way\n ...(nodes ? {nd: nodes.map(id => ({ref: id}))} : {}),\n // relation\n ...(members ? {members} : {})\n }\n }))\n }\n });\n}\n\nconst constrain = coords => coords.map((c, i) => i % 2 ? (c+180) % 360 - 180 : c % 90);\n\n/*\nfunction uniq(items, tags) {\n const un = {};\n return items.filter(i => {\n const k = i.tags.name + tags.map(t => t + i.tags[t] ).join(\"\");\n if(!un[k]) {\n un[k] = 1;\n return true;\n }\n return false;\n });\n}*/\n\nexport default class OSMApi {\n constructor(config) {\n this.config = config;\n this.auth = osmAuth({\n ...config\n });\n this.overpass = new Overpass({\n apiUrl: config.overpassApiUrl\n });\n this.nominatim = new Nominatim();\n this.apiRoute = \"/api/0.6\";\n this.currentChangeset = config.changeset || false;\n }\n fetch(route, options = {}) {\n // wrapper for osm-auth and underlying ohauth to provide\n // more fetch-alike interface\n const {method, body, headers = {}, ...opts} = options;\n return new Promise((resolve, reject) =>\n this.auth.xhr({\n method: method || 'GET',\n path: this.apiRoute + route,\n content: body,\n options: {\n header: headers,\n ...opts\n }\n }, function(err, res) {\n if(!err) {\n resolve(res);\n } else {\n reject(err);\n }\n })\n );\n }\n fetchJson(route, options) {\n return this.fetch(route, options)\n .then(res => JSON.parse(res));\n }\n authenticated() {\n return this.auth.authenticated();\n }\n login() {\n return new Promise(resolve =>\n this.auth.authenticate(res => {\n resolve(res);\n })\n );\n }\n logout() {\n this.auth.logout();\n }\n getUser() {\n return this.fetchJson(\"/user/details.json\");\n }\n getElements(opts) {\n opts = {\n ...opts,\n bbox: opts.bbox.map(constrain)\n };\n if(opts.filters.mode === \"search\") {\n return this.nominatimIncSearch(opts);\n }\n return this.overpass.query(opts)\n .then(items => {\n // filter out the items with the same name and selected category tags\n // eg. there are could be multiple ways representing one street\n\n //items = uniq(items, opts.filters.tags);\n return items;\n });\n }\n nominatimIncSearch(opts, collected = []) {\n // Limit of results in Nominatim is just 50\n // to load more, we need to repeat the request to its API\n // with query param \"exclude_place_ids\" to exclude already loaded.\n // Nominatim objects are places, but we need nodes, ways and relations,\n // so it neccessary to get them from Overpass then.\n const limit = opts.filters.limit;\n const exclude = collected.map(el => el.place_id);\n return this.nominatim.query(opts, exclude)\n .then(elemsNom => {\n collected = [...elemsNom, ...collected];\n if(!collected.length)\n return [];\n\n if(limit && elemsNom.length &&\n collected.length < limit) {\n // to keep it simple, we don't need to support limit\n //return this.nominatimIncSearch(opts, collected);\n }\n return this.overpass.getById(\n collected.map(el => [el.osm_type, el.osm_id])\n );\n })\n .catch((err) => {\n console.log(err);\n if(collected.length) {\n return this.overpass.getById(\n collected.map(el => [el.osm_type, el.osm_id])\n );\n }\n });\n }\n getTwins(el, tags) {\n return this.overpass.getTwins(el, tags);\n }\n\n updateElements(updates) {\n if(!this.currentChangeset) {\n return this.createChangeset()\n .then(() => this.updateChangeset(updates));\n }\n return this.checkChangesetOpen()\n .then(open => {\n if(!open) {\n return this.createChangeset()\n .then(() => this.updateChangeset(updates));\n }\n return this.updateChangeset(updates);\n });\n }\n getChangesets() {\n return this.fetch(\"/changesets\");\n }\n getCurrentChangeset() {\n return this.checkChangesetOpen()\n .then(open => {\n if(!open) {\n return this.createChangeset()\n .then(() => this._getCurrentChangeset());\n }\n return this._getCurrentChangeset();\n })\n }\n _getCurrentChangeset() {\n return this.fetchJson(`/changeset/${this.currentChangeset}.json`)\n .then(res => res.elements[0]);\n }\n createChangeset() {\n return this.fetch(\"/changeset/create\", {\n method: \"PUT\",\n body: createChangeset(),\n headers: {\n 'Content-Type': \"text/plain\"\n }\n }).then(createdId => {\n this.currentChangeset = createdId;\n });\n }\n checkChangesetOpen() {\n return this.fetchJson(`/changeset/${this.currentChangeset}.json`)\n .then(res => {\n return res.elements?.pop().open;\n })\n }\n closeChangeset(changeset, cb) {\n\n this.fetch(`/changeset/${this.currentChangeset}`, {\n method: \"PUT\",\n body: createOsm(changeset),\n headers: {\n 'Content-Type': \"text/plain\"\n }\n }).then(() => {\n this.fetch(`/changeset/${this.currentChangeset}/close`, {\n method: \"PUT\",\n }).then(() => {\n this.currentChangeset = false;\n cb();\n });\n });\n }\n\n updateChangeset(updates) {\n return this.fetch(`/changeset/${this.currentChangeset}/upload`, {\n method: \"POST\",\n body: createOsmChange(updates, this.currentChangeset),\n headers: {\n 'Content-Type': \"text/plain\"\n }\n })\n .then(diffRes => {\n // the format of responce is xml document like:\n //\n // \n\t // \n // \n //\n // old_id == new_id, because we apply only modify\n\n return Object.fromEntries(\n Array.from(diffRes.children[0].children)\n .map(el => [\n el.getAttribute(\"new_id\"), {\n version: +el.getAttribute(\"new_version\")\n }]));\n });\n }\n\n}\n","// Some abstraction for document.cookie handling\n\nexport default class CookieManager {\n constructor(duration = 365 * 24 * 3600) {\n this.cookieDuration = duration;\n }\n \n get(key) {\n const value = document.cookie.split(';')\n .find(s => s.indexOf(key + '=') !== -1);\n return value ? \n value.replace(key + '=', '').trim() \n : false;\n }\n write(dict, duration = this.cookieDuration) {\n const dateStr = new Date(Date.now() + duration * 1000)\n .toUTCString();\n\n Object.entries(dict)\n .forEach(([k, v]) => {\n document.cookie = `${k}=${v}; path=/; expires=${dateStr}`;\n });\n }\n\n clear() { \n document.cookie.split(';')\n .forEach(s => {\n const k = s.split('=')[0];\n document.cookie = `${k}=; path=/`;\n });\n }\n}\n","// helper class to sync results from overpass api with latest updates\n\nconst hasEmpty = (item, langs) => langs.find(l => !(item.tags[`name:${l}`]));\n\n\nexport default class UpdatesStorage {\n updates = {};\n storageKey = \"osm-localizer_updated-items\";\n load() {\n if(window.localStorage) {\n const data = localStorage.getItem(this.storageKey);\n if(data) {\n this.updates = JSON.parse(data);\n }\n }\n }\n store() {\n if(window.localStorage) {\n localStorage.setItem(this.storageKey, JSON.stringify(this.updates));\n }\n }\n patchAndStore(items, diff) {\n for(let id in diff) {\n if(items[id]) {\n items[id] = {...items[id], ...diff[id]};\n this.updates[id] = items[id];\n }\n }\n this.store();\n }\n sync(items, hideFilled, langs) {\n const itemsSync = [];\n for(let i = 0, n = items.length; i < n; i++) {\n const id = items[i].id;\n if(this.updates[id]) {\n if(this.updates[id].version > items[i].version) {\n // if hideFilled = true, then we need manually filter out\n // items with filled fields, which operass doesn't know\n // about yet.\n if(!hideFilled || hasEmpty(this.updates[id], langs))\n itemsSync.push(this.updates[id]);\n } else {\n delete this.updates[id];\n itemsSync.push(items[i]);\n }\n } else {\n itemsSync.push(items[i]);\n }\n }\n this.store();\n return itemsSync;\n }\n}","/* eslint-disable */\n\nconst mainServer = {\n client_id: \"M8nzCZPZGnlJoSrGAMbzsGXXZYtMPg_eyoyEjCyCydo\",\n client_secret: \"SdRMd2ReOVMO0VeWVdNuhY0hyYgbbLwMGAusMnO47Hs \",\n url: \"https://www.openstreetmap.org\",\n redirect_uri: 'https://localize.osm.tracestrack.com/land.html',\n apiUrl: 'https://api.openstreetmap.org',\n scope: 'openid write_api read_prefs',\n auto: true\n};\n\n// use this when testing new features to not spoil main osm database\nconst devServer = {\n client_id: 'M8nzCZPZGnlJoSrGAMbzsGXXZYtMPg_eyoyEjCyCydo',\n client_secret: 'SdRMd2ReOVMO0VeWVdNuhY0hyYgbbLwMGAusMnO47Hs',\n url: \"https://master.apis.dev.openstreetmap.org\",\n redirect_uri: 'http://127.0.0.1:8080/land.html',\n apiUrl: 'https://api.openstreetmap.org',\n};\n\nconst authConfig = { \n ...mainServer,\n overpassApiUrl: \"https://overpass.kumi.systems/api/interpreter\"\n //overpassApiUrl: \"https://overpass.nchc.org.tw/api/interpreter\"\n};\nexport default authConfig;\n","\nconst languagesList = [ \n { key: \"de\", title: \"Deutsch\" },\n { key: \"en\", title: \"English\" },\n { key: \"fr\", title: \"Français\"},\n { key: \"ja\", title: \"日本語\" },\n { key: \"ru\", title: \"Русский\" },\n { key: \"zh-Hans\", title: \"简体中文\" },\n { key: \"zh-Hant\", title: \"繁体中文\" },\n { key: \"zh\", title: \"中文\" },\n { key: \"ml\", title: \"മലയാളം\" },\n { key: \"ta\", title: \"தமிழ்\" },\n { key: \"kn\", title: \"ಕನ್ನಡ\" },\n { key: \"bn\", title: \"বাংলা\" },\n { key: \"te\", title: \"తెలుగు\" },\n { key: \"pa\", title: \"ਪੰਜਾਬੀ\" },\n { key: \"hi\", title: \"हिन्दी\" },\n { key: \"it\", title: \"Italiano\" },\n { key: \"or\", title: \"ଓଡ଼ିଆ\" }\n];\n\nconst tagsList = [\n //{key: \"aerialway\", title: \"Aerialway\"},\n //{key: \"aerolway\", title: \"Aeroway\"},\n {key: \"amenity\", title: \"Amenity\"},\n //{key: \"barrier\", title: \"Barrier\"},\n //{key: \"boundary\", title: \"Boundary\" },\n {key: \"building\", title: \"Building\" },\n //{key: \"craft\", title: \"Craft\" },\n //{key: \"emergency\", title: \"Emergency\" },\n //{key: \"geological\", title: \"Geological\" },\n //{key: \"healthcare\", title: \"Healthcare\"},\n {key: \"highway\", title: \"Highway\"},\n //{key: \"historic\", title: \"Historic\"},\n {key: \"landuse\", title: \"Landuse\"},\n {key: \"leisure\", title: \"Leisure\"},\n {key: \"man_made\", title: \"Man-made\"},\n //{key: \"military\", title: \"Military\"},\n {key: \"natural\", title: \"Natural\"},\n //{key: \"office\", title: \"Office\"},\n {key: \"place\", title: \"Place\" },\n //{key: \"power\", title: \"Power\" },\n {key: \"public_transport\", title: \"Public transport\" },\n {key: \"railway\", title: \"Railway\" },\n {key: \"route\", title: \"Route\" },\n //{key: \"shop\", title: \"Shop\" },\n //{key: \"telecom\", title: \"Telecom\" },\n {key: \"tourism\", title: \"Tourism\" },\n {key: \"waterway\", title: \"Waterway\"}\n];\n\nexport {\n languagesList, \n tagsList\n};\n","import {Fragment, Component} from \"react\";\nimport Container from 'react-bootstrap/Container';\nimport Card from \"react-bootstrap/Card\";\nimport Map from \"./components/Map\";\nimport NotLoggedInGreeting from \"./components/NotLoggedInGreeting\";\nimport ItemsFilters from \"./components/ItemsFilters\";\nimport ItemsTable from \"./components/ItemsTable\";\nimport AppNavbar from \"./components/AppNavbar\";\nimport ChangesetSettings from \"./components/ChangesetSettings\";\nimport OSMApi from \"./api/OSM\";\nimport CookieManager from \"./utils/CookieManager\";\nimport UpdatesStorage from \"./utils/UpdatesStorage\";\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport './App.css';\n\nimport authConfig from \"./config/auth\";\nimport {languagesList, tagsList} from \"./config/interface\";\n\nconst cookieKeys = {\n languages: \"_osm-localization_languages\",\n changeset: \"_osm-locatization_changeset\"\n};\n\nconst itemCenter = item => item.center ?\n [item.center.lat, item.center.lon]\n : [item.lat, item.lon];\nconst itemMinZoom = 14;\n\nclass App extends Component {\n constructor(props) {\n super(props);\n this.cookieManager = new CookieManager();\n this.osmApi = new OSMApi({\n ...authConfig,\n changeset: this.cookieManager.get(cookieKeys.changeset)\n });\n this.updatesStorage = new UpdatesStorage();\n this.updatesStorage.load();\n const {zoom, center} = this.parseURLPath();\n const filters = this.parseURLQuery();\n\n this.bbox = [];\n this.state = {\n user: {\n loggedIn: false\n },\n center,\n zoom,\n filters,\n items: [],\n itemsToUpdate: {},\n focusedItem: false,\n watchFocus: false, // center map on focused item\n loading: {\n items: false,\n updates: false,\n auth: false\n },\n serverMsg: {\n error: false,\n text: \"\"\n },\n changeset: null,\n lastReqTags: []\n };\n }\n parseURLPath() {\n let zoom = 6;\n let center = [0, 0];\n const hash = window.location.hash.replace(\"#/\", \"\");\n if (hash) {\n const [z, lat, lng] = hash.split(\"/\");\n zoom = +z;\n center = [+lat, +lng];\n }\n\n return {zoom, center};\n }\n parseURLQuery() {\n const filters = {\n tags: [\"place\"],\n limit: 100,\n hideFilled: false,\n search: {\n q: \"\",\n street: \"\",\n city: \"\",\n county: \"\",\n state: \"\",\n country: \"\",\n postalcode: \"\"\n },\n searchMode: \"simple\",\n mode: \"tags\"\n };\n const search = window.location.search.replace(\"?\", \"\");\n if(search) {\n const params = Object.fromEntries(\n search.split(\"&\")\n .map(e => e.split(\"=\"))\n );\n if(params.tags) {\n filters.tags = decodeURIComponent(params.tags);\n }\n if(params.search) {\n try {\n const searchParams = JSON.parse(decodeURI(params.search));\n for(let k in filters.search) {\n filters.search[k] = searchParams[k] || filters.search[k];\n if(k !== \"q\" && !!searchParams[k])\n filters.searchMode = \"structured\";\n }\n if(!params.tags) {\n filters.mode = \"search\";\n }\n } catch (e) {\n\n }\n }\n if(params.limit) {\n const n = parseInt(params.limit);\n if(!isNaN(n))\n filters.limit = n;\n }\n if(params.hide_filled) {\n filters.hideFilled = params.hide_filled &&\n +params.hide_filled !== 0;\n }\n }\n return filters;\n }\n loadChangeset() {\n if(this.osmApi.currentChangeset) {\n this.osmApi.getCurrentChangeset()\n .then(changeset => {\n console.log(changeset)\n this.setState({changeset});\n })\n }\n }\n\n closeChangeset({comment}) {\n let changeset = {\n ...this.state.changeset,\n tags: {\n ...this.state.changeset.tags,\n comment\n }\n };\n\n if (changeset.tags.comment === \"\") {\n alert(\"Please add a commit message first.\");\n }\n\n console.log(changeset);\n\n let _t = this;\n this.osmApi.closeChangeset(changeset, () => {\n //_t.setState({changeset: null});\n _t.cookieManager.write({\n \"lastComment\": comment\n });\n window.location.reload();\n }\n );\n }\n\n updateLocation(replace=false) {\n const {\n zoom,\n center: [lat, lng],\n filters: {tags, limit, hideFilled, search, mode, searchMode}\n } = this.state;\n\n const hash = [\"/#\", zoom, lat.toFixed(4), lng.toFixed(4)].join(\"/\");\n const searchParts = [];\n if(mode === \"search\") {\n const {q, ...structured} = search;\n const searchObj = (searchMode === \"simple\") ?\n {q}\n : structured;\n\n searchParts.push(`search=${JSON.stringify(searchObj)}`);\n }\n else {\n searchParts.push(`tags=${encodeURIComponent(tags)}`);\n if(hideFilled)\n searchParts.push(`hide_filled=1`);\n }\n if(limit)\n searchParts.push(`limit=${limit}`);\n\n const searchQ = \"?\" + searchParts.join(\"&\");\n\n let url = window.location.protocol + \"//\" + window.location.host + window.location.pathname + searchQ + hash;\n\n if(replace)\n window.history.replaceState({searchQ, hash}, '', url);\n else\n window.history.pushState({searchQ, hash}, '', url);\n }\n componentDidMount() {\n if(this.osmApi.authenticated()) {\n this.getUser();\n }\n }\n setServerMsg(serverMsg) {\n console.log(serverMsg);\n this.setState({serverMsg});\n const fn = () => {\n document.removeEventListener(\"click\", fn);\n this.setState({serverMsg: {\n error: false,\n text: \"\"\n }});\n }\n document.addEventListener(\"click\", fn);\n }\n login() {\n this.setState({\n loading: {\n ...this.state.loading,\n auth: true\n }\n });\n this.osmApi.login()\n .then(() => {\n this.getUser();\n });\n }\n getLanguages() {\n const str = this.cookieManager.get(cookieKeys.languages);\n return str ? str.split(\"+\") : false;\n }\n setLanguages(languages) {\n this.setState({\n user: {\n ...this.state.user,\n languages\n }\n });\n this.storeLanguages(languages);\n }\n storeLanguages(languages) {\n this.cookieManager.write({\n [cookieKeys.languages]: languages.join(\"+\")\n });\n }\n getUser() {\n this.osmApi.getUser()\n .then(res => {\n let languages = this.getLanguages() ||\n res.user.languages.filter(l =>\n languagesList.find(({key}) => key === l)\n );\n this.setState({\n loading: {\n ...this.state.loading,\n auth: false\n },\n user: {\n loggedIn: true,\n ...res.user,\n languages\n }\n });\n this.storeLanguages(languages);\n this.loadChangeset();\n });\n }\n logout() {\n this.osmApi.logout();\n this.setState({\n user: {\n loggedIn: false\n }\n });\n }\n getItems() {\n this.setState({\n loading: {\n ...this.state.loading,\n items: true\n }\n });\n this.osmApi.getElements({\n center: this.state.center,\n zoom: this.state.zoom,\n bbox: this.bbox,\n filters: this.state.filters,\n languages: this.state.user.languages\n })\n .then(items => {\n this.setState({\n items: this.updatesStorage.sync(items,\n this.state.filters.hideFilled,\n this.state.user.languages),\n itemsToUpdate: {},\n loading: {\n ...this.state.loading,\n items: false\n },\n lastReqTags: this.state.filters.mode === \"search\" ?\n tagsList.map(t => t.key)\n : this.state.filters.tags.slice()\n });\n })\n .catch(err => {\n console.log(err)\n this.setState({\n loading: {\n ...this.state.loading,\n items: false\n }\n });\n this.setServerMsg({\n text: err,\n error: true\n });\n });\n }\n updatePosition({bbox, center, zoom}) {\n this.setState(\n {center, zoom},\n () => this.updateLocation(true));\n this.bbox = bbox;\n }\n updateBbox({bbox}) {\n this.bbox = bbox;\n }\n updateItem(item, lang, value) {\n item.tags[`name:${lang}`] = value;\n /*\n if(!item.twins) {\n // get all the items with the same name and tags\n item.twins = [];\n this.osmApi.getTwins(item, this.state.filters.tags)\n .then(twins => {\n item.twins = twins;\n item.twins.forEach(i => {\n i.tags[`name:${lang}`] = value;\n });\n });\n } else {\n item.twins.forEach(i => {\n i.tags[`name:${lang}`] = value;\n });\n }*/\n this.setState({itemsToUpdate: {\n ...this.state.itemsToUpdate,\n [item.id]: item\n }});\n }\n setFilter(updates, doneCb) {\n console.log(updates);\n this.setState({\n filters: {\n ...this.state.filters,\n ...{tags: updates}\n }\n }, () => {this.updateLocation();\n if (doneCb) doneCb();\n });\n }\n updateItems() {\n this.setState({\n loading: {\n ...this.state.loading,\n updates: true\n }\n });\n let items = this.state.itemsToUpdate;\n/* Object.values(this.state.itemsToUpdate)\n .forEach(i => {\n let {twins, ...self} = i;\n items[self.id] = self;\n twins.forEach(t => {\n items[t.id] = t;\n });\n }); */\n console.log(items);\n this.osmApi.updateElements(items)\n .then(diff => {\n this.updatesStorage.patchAndStore(\n this.state.itemsToUpdate, diff\n );\n this.cookieManager.write({\n [cookieKeys.changeset]: this.osmApi.currentChangeset\n });\n\n this.setServerMsg({\n text: \"Items are successfully updated.\",\n error: false\n });\n\n this.setState({\n itemsToUpdate: {},\n loading: {\n ...this.state.loading,\n updates: false\n }\n });\n this.loadChangeset();\n })\n .catch(err => {\n this.setServerMsg({\n text: String.toString(err),\n error: true\n });\n\n this.setState({\n loading: {\n ...this.state.loading,\n updates: false\n }\n });\n });\n }\n focusItem(itemId) {\n if(this.state.watchFocus) {\n const item = this.state.items.find(i => i.id === itemId);\n this.setState({\n center: itemCenter(item),\n focusedItem: itemId\n });\n } else {\n this.setState({\n focusedItem: itemId\n });\n }\n }\n blurItem() {\n this.setState({\n focusedItem: false\n });\n }\n centerItem(item) {\n this.setState({\n center: itemCenter(item),\n zoom: Math.max(this.state.zoom, itemMinZoom)\n });\n }\n render() {\n const btnsDisabled = {\n // query for a large bbox is too slow and won't work\n // also don't load new items till updates are not done and synced\n items: this.state.loading.updates ||\n (this.state.filters.mode === \"tags\" ?\n this.state.zoom < 10\n : !(this.state.filters.searchMode === \"simple\" ?\n this.state.filters.search.q\n : Object.entries(this.state.filters.search)\n .find(([k,v]) => k !== \"q\" && !!v)\n )),\n // nothing to update\n updates: !Object.keys(this.state.itemsToUpdate).length\n };\n const touchedItems = Object.keys(this.state.itemsToUpdate).map(s => +s);\n const mapHandlers = {\n onLoad: this.updateBbox.bind(this),\n onMove: this.updatePosition.bind(this),\n onClickItem: this.focusItem.bind(this),\n onClickMap: this.blurItem.bind(this),\n };\n\n const itemHandlers = {\n onFocus: this.focusItem.bind(this),\n onBlur: this.blurItem.bind(this),\n onChange: this.updateItem.bind(this),\n onIconClick: this.centerItem.bind(this)\n };\n const changesetHandlers = {\n onClose: this.closeChangeset.bind(this)\n };\n\n const lang = this.state.user.languages ?\n this.state.user.languages[0]\n : \"en\";\n\n const tags = tagsList.map(t => t.key);\n return (\n \n \n \n {\n this.state.user.loggedIn ?\n \n \n \n
\n {this.state.serverMsg.text}\n
\n
\n \n \n\n \n
\n : \n \n \n }\n \n
\n );\n }\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""} \ No newline at end of file