From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Tue, 21 Jul 2020 13:22:23 +0000 (-0400) Subject: Use legacy build of iD X-Git-Tag: live~2039^2~1 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/1c8fbe329dc85ae06599c20a9d385e3af396d380 Use legacy build of iD --- diff --git a/Vendorfile b/Vendorfile index e1d57fc61..f940b9ece 100644 --- a/Vendorfile +++ b/Vendorfile @@ -59,7 +59,7 @@ folder 'vendor/assets' do end end - file 'iD.js', 'dist/iD.js' + file 'iD.js', 'dist/iD.legacy.js' end end diff --git a/vendor/assets/iD/iD.js b/vendor/assets/iD/iD.js index 72e021e61..3ce4ca9be 100644 --- a/vendor/assets/iD/iD.js +++ b/vendor/assets/iD/iD.js @@ -21,23 +21,23 @@ var isImplemented = function () { var set, iterator, result; - if (typeof Set !== 'function') return false; + if (typeof Set !== 'function') { return false; } set = new Set(['raz', 'dwa', 'trzy']); - if (String(set) !== '[object Set]') return false; - if (set.size !== 3) return false; - if (typeof set.add !== 'function') return false; - if (typeof set.clear !== 'function') return false; - if (typeof set.delete !== 'function') return false; - if (typeof set.entries !== 'function') return false; - if (typeof set.forEach !== 'function') return false; - if (typeof set.has !== 'function') return false; - if (typeof set.keys !== 'function') return false; - if (typeof set.values !== 'function') return false; + if (String(set) !== '[object Set]') { return false; } + if (set.size !== 3) { return false; } + if (typeof set.add !== 'function') { return false; } + if (typeof set.clear !== 'function') { return false; } + if (typeof set.delete !== 'function') { return false; } + if (typeof set.entries !== 'function') { return false; } + if (typeof set.forEach !== 'function') { return false; } + if (typeof set.has !== 'function') { return false; } + if (typeof set.keys !== 'function') { return false; } + if (typeof set.values !== 'function') { return false; } iterator = set.values(); result = iterator.next(); - if (result.done !== false) return false; - if (result.value !== 'raz') return false; + if (result.done !== false) { return false; } + if (result.value !== 'raz') { return false; } return true; }; @@ -50,7 +50,7 @@ var isValue = function (val) { return val !== _undefined && val !== null; }; var validValue = function (value) { - if (!isValue(value)) throw new TypeError("Cannot use null or undefined"); + if (!isValue(value)) { throw new TypeError("Cannot use null or undefined"); } return value; }; @@ -61,7 +61,7 @@ var isImplemented$1 = function () { var numberIsNaN = Number.isNaN; - if (typeof numberIsNaN !== "function") return false; + if (typeof numberIsNaN !== "function") { return false; } return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34); }; @@ -74,13 +74,13 @@ var isImplemented$2 = function () { var sign = Math.sign; - if (typeof sign !== "function") return false; + if (typeof sign !== "function") { return false; } return sign(10) === 1 && sign(-20) === -1; }; var shim$1 = function (value) { value = Number(value); - if (isNaN(value) || value === 0) return value; + if (isNaN(value) || value === 0) { return value; } return value > 0 ? 1 : -1; }; @@ -90,9 +90,9 @@ , floor = Math.floor; var toInteger = function (value) { - if (isNaN(value)) return 0; + if (isNaN(value)) { return 0; } value = Number(value); - if (value === 0 || !isFinite(value)) return value; + if (value === 0 || !isFinite(value)) { return value; } return sign(value) * floor(abs(value)); }; @@ -107,18 +107,18 @@ var eIndexOf = function (searchElement/*, fromIndex*/) { var i, length, fromIndex, val; - if (!isNan(searchElement)) return indexOf.apply(this, arguments); + if (!isNan(searchElement)) { return indexOf.apply(this, arguments); } length = toPosInteger(validValue(this).length); fromIndex = arguments[1]; - if (isNaN(fromIndex)) fromIndex = 0; - else if (fromIndex >= 0) fromIndex = floor$1(fromIndex); - else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex)); + if (isNaN(fromIndex)) { fromIndex = 0; } + else if (fromIndex >= 0) { fromIndex = floor$1(fromIndex); } + else { fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex)); } for (i = fromIndex; i < length; ++i) { if (objHasOwnProperty.call(this, i)) { val = this[i]; - if (isNan(val)) return i; // Jslint: ignore + if (isNan(val)) { return i; } // Jslint: ignore } } return -1; @@ -128,7 +128,7 @@ var isImplemented$3 = function (/* CustomCreate*/) { var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create; - if (typeof setPrototypeOf !== "function") return false; + if (typeof setPrototypeOf !== "function") { return false; } return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject; }; @@ -144,8 +144,8 @@ var create_1 = (function () { var nullObject, polyProps, desc; - if (!shim$2) return create$1; - if (shim$2.level !== 1) return create$1; + if (!shim$2) { return create$1; } + if (shim$2.level !== 1) { return create$1; } nullObject = {}; polyProps = {}; @@ -183,13 +183,13 @@ validate = function (obj, prototype) { validValue(obj); - if (prototype === null || isObject(prototype)) return obj; + if (prototype === null || isObject(prototype)) { return obj; } throw new TypeError("Prototype must be null or an object"); }; var shim$3 = (function (status) { var fn, set; - if (!status) return null; + if (!status) { return null; } if (status.level === 2) { if (status.set) { set = status.set; @@ -208,10 +208,10 @@ var isNullBase; validate(obj, prototype); isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj); - if (isNullBase) delete self.nullPolyfill.__proto__; - if (prototype === null) prototype = self.nullPolyfill; + if (isNullBase) { delete self.nullPolyfill.__proto__; } + if (prototype === null) { prototype = self.nullPolyfill; } obj.__proto__ = prototype; - if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc); + if (isNullBase) { defineProperty(self.nullPolyfill, "__proto__", nullDesc); } return obj; }; } @@ -233,15 +233,15 @@ set = desc.set; // Opera crashes at this point set.call(tmpObj1, tmpObj2); } catch (ignore) {} - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { set: set, level: 2 }; + if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { set: set, level: 2 }; } } tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 2 }; + if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { level: 2 }; } tmpObj1 = {}; tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 1 }; + if (Object.getPrototypeOf(tmpObj1) === tmpObj2) { return { level: 1 }; } return false; })() @@ -250,7 +250,7 @@ var setPrototypeOf = isImplemented$3() ? Object.setPrototypeOf : shim$3; var validCallable = function (fn) { - if (typeof fn !== "function") throw new TypeError(fn + " is not a function"); + if (typeof fn !== "function") { throw new TypeError(fn + " is not a function"); } return fn; }; @@ -263,14 +263,14 @@ var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ }; var is$1 = function (value) { - if (!is(value)) return false; + if (!is(value)) { return false; } return hasOwnProperty.call(possibleTypes, typeof value); }; var is$2 = function (value) { - if (!is$1(value)) return false; + if (!is$1(value)) { return false; } try { - if (!value.constructor) return false; + if (!value.constructor) { return false; } return value.constructor.prototype === value; } catch (error) { return false; @@ -278,14 +278,14 @@ }; var is$3 = function (value) { - if (typeof value !== "function") return false; + if (typeof value !== "function") { return false; } - if (!hasOwnProperty.call(value, "length")) return false; + if (!hasOwnProperty.call(value, "length")) { return false; } try { - if (typeof value.length !== "number") return false; - if (typeof value.call !== "function") return false; - if (typeof value.apply !== "function") return false; + if (typeof value.length !== "number") { return false; } + if (typeof value.call !== "function") { return false; } + if (typeof value.apply !== "function") { return false; } } catch (error) { return false; } @@ -296,14 +296,14 @@ var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString; var is$4 = function (value) { - if (!is$3(value)) return false; - if (classRe.test(functionToString.call(value))) return false; + if (!is$3(value)) { return false; } + if (classRe.test(functionToString.call(value))) { return false; } return true; }; var isImplemented$4 = function () { var assign = Object.assign, obj; - if (typeof assign !== "function") return false; + if (typeof assign !== "function") { return false; } obj = { foo: "raz" }; assign(obj, { bar: "dwa" }, { trzy: "trzy" }); return obj.foo + obj.bar + obj.trzy === "razdwatrzy"; @@ -327,20 +327,22 @@ var max$1 = Math.max; var shim$5 = function (dest, src/*, …srcn*/) { + var arguments$1 = arguments; + var error, i, length = max$1(arguments.length, 2), assign; dest = Object(validValue(dest)); assign = function (key) { try { dest[key] = src[key]; } catch (e) { - if (!error) error = e; + if (!error) { error = e; } } }; for (i = 1; i < length; ++i) { - src = arguments[i]; + src = arguments$1[i]; keys$1(src).forEach(assign); } - if (error !== undefined) throw error; + if (error !== undefined) { throw error; } return dest; }; @@ -350,14 +352,14 @@ var process$1 = function (src, obj) { var key; - for (key in src) obj[key] = src[key]; + for (key in src) { obj[key] = src[key]; } }; // eslint-disable-next-line no-unused-vars var normalizeOptions = function (opts1/*, …options*/) { var result = create$2(null); forEach.call(arguments, function (options) { - if (!isValue(options)) return; + if (!isValue(options)) { return; } process$1(Object(options), result); }); return result; @@ -366,7 +368,7 @@ var str = "razdwatrzy"; var isImplemented$6 = function () { - if (typeof str.contains !== "function") return false; + if (typeof str.contains !== "function") { return false; } return str.contains("dwa") === true && str.contains("foo") === false; }; @@ -460,9 +462,9 @@ } else { data = this.__ee__; } - if (!data[type]) data[type] = listener; - else if (typeof data[type] === 'object') data[type].push(listener); - else data[type] = [data[type], listener]; + if (!data[type]) { data[type] = listener; } + else if (typeof data[type] === 'object') { data[type].push(listener); } + else { data[type] = [data[type], listener]; } return this; }; @@ -486,17 +488,17 @@ validCallable(listener); - if (!hasOwnProperty.call(this, '__ee__')) return this; + if (!hasOwnProperty.call(this, '__ee__')) { return this; } data = this.__ee__; - if (!data[type]) return this; + if (!data[type]) { return this; } listeners = data[type]; if (typeof listeners === 'object') { for (i = 0; (candidate = listeners[i]); ++i) { if ((candidate === listener) || (candidate.__eeOnceListener__ === listener)) { - if (listeners.length === 2) data[type] = listeners[i ? 0 : 1]; - else listeners.splice(i, 1); + if (listeners.length === 2) { data[type] = listeners[i ? 0 : 1]; } + else { listeners.splice(i, 1); } } } } else { @@ -510,16 +512,18 @@ }; emit = function (type) { + var arguments$1 = arguments; + var i, l, listener, listeners, args; - if (!hasOwnProperty.call(this, '__ee__')) return; + if (!hasOwnProperty.call(this, '__ee__')) { return; } listeners = this.__ee__[type]; - if (!listeners) return; + if (!listeners) { return; } if (typeof listeners === 'object') { l = arguments.length; args = new Array(l - 1); - for (i = 1; i < l; ++i) args[i - 1] = arguments[i]; + for (i = 1; i < l; ++i) { args[i - 1] = arguments$1[i]; } listeners = listeners.slice(); for (i = 0; (listener = listeners[i]); ++i) { @@ -540,7 +544,7 @@ l = arguments.length; args = new Array(l - 1); for (i = 1; i < l; ++i) { - args[i - 1] = arguments[i]; + args[i - 1] = arguments$1[i]; } apply.call(listeners, this, args); } @@ -573,28 +577,28 @@ var isImplemented$7 = function () { var symbol; - if (typeof Symbol !== 'function') return false; + if (typeof Symbol !== 'function') { return false; } symbol = Symbol('test symbol'); try { String(symbol); } catch (e) { return false; } // Return 'true' also for polyfills - if (!validTypes[typeof Symbol.iterator]) return false; - if (!validTypes[typeof Symbol.toPrimitive]) return false; - if (!validTypes[typeof Symbol.toStringTag]) return false; + if (!validTypes[typeof Symbol.iterator]) { return false; } + if (!validTypes[typeof Symbol.toPrimitive]) { return false; } + if (!validTypes[typeof Symbol.toStringTag]) { return false; } return true; }; var isSymbol = function (x) { - if (!x) return false; - if (typeof x === 'symbol') return true; - if (!x.constructor) return false; - if (x.constructor.name !== 'Symbol') return false; + if (!x) { return false; } + if (typeof x === 'symbol') { return true; } + if (!x.constructor) { return false; } + if (x.constructor.name !== 'Symbol') { return false; } return (x[x.constructor.toStringTag] === 'Symbol'); }; var validateSymbol = function (value) { - if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); + if (!isSymbol(value)) { throw new TypeError(value + " is not a symbol"); } return value; }; @@ -615,7 +619,7 @@ var created = create$3(null); return function (desc) { var postfix = 0, name, ie11BugWorkaround; - while (created[desc + (postfix || '')]) ++postfix; + while (created[desc + (postfix || '')]) { ++postfix; } desc += (postfix || ''); created[desc] = true; name = '@@' + desc; @@ -624,7 +628,7 @@ // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/ // ie11-broken-getters-on-dom-objects // https://github.com/medikoo/es6-symbol/issues/12 - if (ie11BugWorkaround) return; + if (ie11BugWorkaround) { return; } ie11BugWorkaround = true; defineProperty$1(this, name, d_1(value)); ie11BugWorkaround = false; @@ -636,7 +640,7 @@ // Internal constructor (not one exposed) for creating Symbol instances. // This one is used to ensure that `someSymbol instanceof Symbol` always return false HiddenSymbol = function Symbol(description) { - if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor'); + if (this instanceof HiddenSymbol) { throw new TypeError('Symbol is not a constructor'); } return SymbolPolyfill(description); }; @@ -644,8 +648,8 @@ // (returns instances of HiddenSymbol) var polyfill = SymbolPolyfill = function Symbol(description) { var symbol; - if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor'); - if (isNativeSafe) return NativeSymbol(description); + if (this instanceof Symbol) { throw new TypeError('Symbol is not a constructor'); } + if (isNativeSafe) { return NativeSymbol(description); } symbol = create$3(HiddenSymbol.prototype); description = (description === undefined ? '' : String(description)); return defineProperties(symbol, { @@ -655,13 +659,13 @@ }; defineProperties(SymbolPolyfill, { for: d_1(function (key) { - if (globalSymbols[key]) return globalSymbols[key]; + if (globalSymbols[key]) { return globalSymbols[key]; } return (globalSymbols[key] = SymbolPolyfill(String(key))); }), keyFor: d_1(function (s) { var key; validateSymbol(s); - for (key in globalSymbols) if (globalSymbols[key] === s) return key; + for (key in globalSymbols) { if (globalSymbols[key] === s) { return key; } } }), // To ensure proper interoperability with other native functions (e.g. Array.from) @@ -694,7 +698,7 @@ }); defineProperty$1(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () { var symbol = validateSymbol(this); - if (typeof symbol === 'symbol') return symbol; + if (typeof symbol === 'symbol') { return symbol; } return symbol.toString(); })); defineProperty$1(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol')); @@ -730,19 +734,19 @@ }; var isImplemented$8 = function () { - if (typeof globalThis !== "object") return false; - if (!globalThis) return false; + if (typeof globalThis !== "object") { return false; } + if (!globalThis) { return false; } return globalThis.Array === Array; }; var naiveFallback = function () { - if (typeof self === "object" && self) return self; - if (typeof window === "object" && window) return window; + if (typeof self === "object" && self) { return self; } + if (typeof window === "object" && window) { return window; } throw new Error("Unable to resolve global `this`"); }; var implementation = (function () { - if (this) return this; + if (this) { return this; } // Unexpected strict mode (may happen if e.g. bundled into ESM module) @@ -760,7 +764,7 @@ } try { // Safari case (window.__global__ is resolved with global context, but __global__ does not) - if (!__global__) return naiveFallback(); + if (!__global__) { return naiveFallback(); } return __global__; } finally { delete Object.prototype.__global__; @@ -774,29 +778,29 @@ var isImplemented$9 = function () { var Symbol = globalThis_1.Symbol; var symbol; - if (typeof Symbol !== "function") return false; + if (typeof Symbol !== "function") { return false; } symbol = Symbol("test symbol"); try { String(symbol); } catch (e) { return false; } // Return 'true' also for polyfills - if (!validTypes$1[typeof Symbol.iterator]) return false; - if (!validTypes$1[typeof Symbol.toPrimitive]) return false; - if (!validTypes$1[typeof Symbol.toStringTag]) return false; + if (!validTypes$1[typeof Symbol.iterator]) { return false; } + if (!validTypes$1[typeof Symbol.toPrimitive]) { return false; } + if (!validTypes$1[typeof Symbol.toStringTag]) { return false; } return true; }; var isSymbol$1 = function (value) { - if (!value) return false; - if (typeof value === "symbol") return true; - if (!value.constructor) return false; - if (value.constructor.name !== "Symbol") return false; + if (!value) { return false; } + if (typeof value === "symbol") { return true; } + if (!value.constructor) { return false; } + if (value.constructor.name !== "Symbol") { return false; } return value[value.constructor.toStringTag] === "Symbol"; }; var validateSymbol$1 = function (value) { - if (!isSymbol$1(value)) throw new TypeError(value + " is not a symbol"); + if (!isSymbol$1(value)) { throw new TypeError(value + " is not a symbol"); } return value; }; @@ -805,7 +809,7 @@ var created = create$4(null); var generateName$1 = function (desc) { var postfix = 0, name, ie11BugWorkaround; - while (created[desc + (postfix || "")]) ++postfix; + while (created[desc + (postfix || "")]) { ++postfix; } desc += postfix || ""; created[desc] = true; name = "@@" + desc; @@ -817,7 +821,7 @@ // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/ // ie11-broken-getters-on-dom-objects // https://github.com/medikoo/es6-symbol/issues/12 - if (ie11BugWorkaround) return; + if (ie11BugWorkaround) { return; } ie11BugWorkaround = true; defineProperty$2(this, name, d_1(value)); ie11BugWorkaround = false; @@ -863,14 +867,14 @@ var symbolRegistry = function (SymbolPolyfill) { return Object.defineProperties(SymbolPolyfill, { for: d_1(function (key) { - if (registry[key]) return registry[key]; + if (registry[key]) { return registry[key]; } return (registry[key] = SymbolPolyfill(String(key))); }), keyFor: d_1(function (symbol) { var key; validateSymbol$1(symbol); for (key in registry) { - if (registry[key] === symbol) return key; + if (registry[key] === symbol) { return key; } } return undefined; }) @@ -897,7 +901,7 @@ // Internal constructor (not one exposed) for creating Symbol instances. // This one is used to ensure that `someSymbol instanceof Symbol` always return false HiddenSymbol$1 = function Symbol(description) { - if (this instanceof HiddenSymbol$1) throw new TypeError("Symbol is not a constructor"); + if (this instanceof HiddenSymbol$1) { throw new TypeError("Symbol is not a constructor"); } return SymbolPolyfill$1(description); }; @@ -905,8 +909,8 @@ // (returns instances of HiddenSymbol) var polyfill$1 = SymbolPolyfill$1 = function Symbol(description) { var symbol; - if (this instanceof Symbol) throw new TypeError("Symbol is not a constructor"); - if (isNativeSafe$1) return NativeSymbol$2(description); + if (this instanceof Symbol) { throw new TypeError("Symbol is not a constructor"); } + if (isNativeSafe$1) { return NativeSymbol$2(description); } symbol = create$5(HiddenSymbol$1.prototype); description = description === undefined ? "" : String(description); return defineProperties$1(symbol, { @@ -935,7 +939,7 @@ SymbolPolyfill$1.toPrimitive, d_1("", function () { var symbol = validateSymbol$1(this); - if (typeof symbol === "symbol") return symbol; + if (typeof symbol === "symbol") { return symbol; } return symbol.toString(); }) ); @@ -964,27 +968,27 @@ , isArray = Array.isArray; var isIterable = function (value) { - if (!isValue(value)) return false; - if (isArray(value)) return true; - if (isString(value)) return true; - if (isArguments(value)) return true; + if (!isValue(value)) { return false; } + if (isArray(value)) { return true; } + if (isString(value)) { return true; } + if (isArguments(value)) { return true; } return typeof value[iteratorSymbol] === "function"; }; var validIterable = function (value) { - if (!isIterable(value)) throw new TypeError(value + " is not iterable"); + if (!isIterable(value)) { throw new TypeError(value + " is not iterable"); } return value; }; var objectToString = Object.prototype.toString; var coerce = function (value) { - if (!is(value)) return null; + if (!is(value)) { return null; } if (is$1(value)) { // Reject Object.prototype.toString coercion var valueToString = value.toString; - if (typeof valueToString !== "function") return null; - if (valueToString === objectToString) return null; + if (typeof valueToString !== "function") { return null; } + if (valueToString === objectToString) { return null; } // Note: It can be object coming from other realm, still as there's no ES3 and CSP compliant // way to resolve its realm's Object.prototype.toString it's left as not addressed edge case } @@ -1008,9 +1012,9 @@ var toShortString = function (value) { var string = safeToString(value); - if (string === null) return ""; + if (string === null) { return ""; } // Trim if too long - if (string.length > 100) string = string.slice(0, 99) + "…"; + if (string.length > 100) { string = string.slice(0, 99) + "…"; } // Replace eventual new lines string = string.replace(reNewLine, function (char) { switch (char) { @@ -1035,29 +1039,29 @@ }; var resolveException = function (value, defaultMessage, inputOptions) { - if (!is$1(inputOptions)) throw new TypeError(resolveMessage(defaultMessage, value)); + if (!is$1(inputOptions)) { throw new TypeError(resolveMessage(defaultMessage, value)); } if (!is(value)) { - if ("default" in inputOptions) return inputOptions["default"]; - if (inputOptions.isOptional) return null; + if ("default" in inputOptions) { return inputOptions["default"]; } + if (inputOptions.isOptional) { return null; } } var errorMessage = coerce(inputOptions.errorMessage); - if (!is(errorMessage)) errorMessage = defaultMessage; + if (!is(errorMessage)) { errorMessage = defaultMessage; } throw new TypeError(resolveMessage(errorMessage, value)); }; var ensure = function (value/*, options*/) { - if (is(value)) return value; + if (is(value)) { return value; } return resolveException(value, "Cannot use %v", arguments[1]); }; var ensure$1 = function (value/*, options*/) { - if (is$4(value)) return value; + if (is$4(value)) { return value; } return resolveException(value, "%v is not a plain function", arguments[1]); }; var isImplemented$a = function () { var from = Array.from, arr, result; - if (typeof from !== "function") return false; + if (typeof from !== "function") { return false; } arr = ["raz", "dwa"]; result = from(arr); return Boolean(result && result !== arr && result[1] === "dwa"); @@ -1093,14 +1097,14 @@ arrayLike = Object(validValue(arrayLike)); - if (isValue(mapFn)) validCallable(mapFn); + if (isValue(mapFn)) { validCallable(mapFn); } if (!this || this === Array || !isFunction(this)) { // Result: Plain array if (!mapFn) { if (isArguments(arrayLike)) { // Source: Arguments length = arrayLike.length; - if (length !== 1) return Array.apply(null, arrayLike); + if (length !== 1) { return Array.apply(null, arrayLike); } arr = new Array(1); arr[0] = arrayLike[0]; return arr; @@ -1108,7 +1112,7 @@ if (isArray$1(arrayLike)) { // Source: Array arr = new Array((length = arrayLike.length)); - for (i = 0; i < length; ++i) arr[i] = arrayLike[i]; + for (i = 0; i < length; ++i) { arr[i] = arrayLike[i]; } return arr; } } @@ -1122,7 +1126,7 @@ if ((getIterator = arrayLike[iteratorSymbol$1]) !== undefined) { // Source: Iterator iterator = validCallable(getIterator).call(arrayLike); - if (Context) arr = new Context(); + if (Context) { arr = new Context(); } result = iterator.next(); i = 0; while (!result.done) { @@ -1140,13 +1144,13 @@ } else if (isString(arrayLike)) { // Source: String length = arrayLike.length; - if (Context) arr = new Context(); + if (Context) { arr = new Context(); } for (i = 0, j = 0; i < length; ++i) { value = arrayLike[i]; if (i + 1 < length) { code = value.charCodeAt(0); // eslint-disable-next-line max-depth - if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i]; + if (code >= 0xd800 && code <= 0xdbff) { value += arrayLike[++i]; } } value = mapFn ? call.call(mapFn, thisArg, value, j) : value; if (Context) { @@ -1163,7 +1167,7 @@ if (length === undefined) { // Source: array or array-like length = toPosInteger(arrayLike.length); - if (Context) arr = new Context(length); + if (Context) { arr = new Context(length); } for (i = 0; i < length; ++i) { value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; if (Context) { @@ -1185,11 +1189,11 @@ var copy = function (obj/*, propertyNames, options*/) { var copy = Object(validValue(obj)), propertyNames = arguments[1], options = Object(arguments[2]); - if (copy !== obj && !propertyNames) return copy; + if (copy !== obj && !propertyNames) { return copy; } var result = {}; if (propertyNames) { from_1(propertyNames, function (propertyName) { - if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName]; + if (options.ensure || propertyName in obj) { result[propertyName] = obj[propertyName]; } }); } else { assign(result, obj); @@ -1212,9 +1216,9 @@ if (compareFn) { list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined); } - if (typeof method !== "function") method = list[method]; + if (typeof method !== "function") { method = list[method]; } return call$1.call(method, list, function (key, index) { - if (!objPropertyIsEnumerable.call(obj, key)) return defVal; + if (!objPropertyIsEnumerable.call(obj, key)) { return defVal; } return call$1.call(cb, thisArg, obj[key], key, obj, index); }); }; @@ -1244,7 +1248,7 @@ delete dgs.writable; delete dgs.value; dgs.get = function () { - if (!options.overwriteDefinition && hasOwnProperty$1.call(this, name)) return value; + if (!options.overwriteDefinition && hasOwnProperty$1.call(this, name)) { return value; } desc.value = bind$1.call(value, options.resolveContext ? options.resolveContext(this) : this); defineProperty$5(this, name, desc); return this[name]; @@ -1254,20 +1258,20 @@ var autoBind = function (props/*, options*/) { var options = normalizeOptions(arguments[1]); - if (is(options.resolveContext)) ensure$1(options.resolveContext); + if (is(options.resolveContext)) { ensure$1(options.resolveContext); } return map$1(props, function (desc, name) { return define(name, desc, options); }); }; var defineProperty$6 = Object.defineProperty, defineProperties$2 = Object.defineProperties, Iterator; var es6Iterator = Iterator = function (list, context) { - if (!(this instanceof Iterator)) throw new TypeError("Constructor requires 'new'"); + if (!(this instanceof Iterator)) { throw new TypeError("Constructor requires 'new'"); } defineProperties$2(this, { __list__: d_1("w", validValue(list)), __context__: d_1("w", context), __nextIndex__: d_1("w", 0) }); - if (!context) return; + if (!context) { return; } validCallable(context.on); context.on("_add", this._onAdd); context.on("_delete", this._onDelete); @@ -1283,12 +1287,12 @@ { _next: d_1(function () { var i; - if (!this.__list__) return undefined; + if (!this.__list__) { return undefined; } if (this.__redo__) { i = this.__redo__.shift(); - if (i !== undefined) return i; + if (i !== undefined) { return i; } } - if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; + if (this.__nextIndex__ < this.__list__.length) { return this.__nextIndex__++; } this._unBind(); return undefined; }), @@ -1296,7 +1300,7 @@ return this._createResult(this._next()); }), _createResult: d_1(function (i) { - if (i === undefined) return { done: true, value: undefined }; + if (i === undefined) { return { done: true, value: undefined }; } return { done: false, value: this._resolve(i) }; }), _resolve: d_1(function (i) { @@ -1305,7 +1309,7 @@ _unBind: d_1(function () { this.__list__ = null; delete this.__redo__; - if (!this.__context__) return; + if (!this.__context__) { return; } this.__context__.off("_add", this._onAdd); this.__context__.off("_delete", this._onDelete); this.__context__.off("_clear", this._onClear); @@ -1317,30 +1321,30 @@ }, autoBind({ _onAdd: d_1(function (index) { - if (index >= this.__nextIndex__) return; + if (index >= this.__nextIndex__) { return; } ++this.__nextIndex__; if (!this.__redo__) { defineProperty$6(this, "__redo__", d_1("c", [index])); return; } this.__redo__.forEach(function (redo, i) { - if (redo >= index) this.__redo__[i] = ++redo; + if (redo >= index) { this.__redo__[i] = ++redo; } }, this); this.__redo__.push(index); }), _onDelete: d_1(function (index) { var i; - if (index >= this.__nextIndex__) return; + if (index >= this.__nextIndex__) { return; } --this.__nextIndex__; - if (!this.__redo__) return; + if (!this.__redo__) { return; } i = this.__redo__.indexOf(index); - if (i !== -1) this.__redo__.splice(i, 1); + if (i !== -1) { this.__redo__.splice(i, 1); } this.__redo__.forEach(function (redo, j) { - if (redo > index) this.__redo__[j] = --redo; + if (redo > index) { this.__redo__[j] = --redo; } }, this); }), _onClear: d_1(function () { - if (this.__redo__) clear.call(this.__redo__); + if (this.__redo__) { clear.call(this.__redo__); } this.__nextIndex__ = 0; }) }) @@ -1362,23 +1366,23 @@ var defineProperty = Object.defineProperty, ArrayIterator; ArrayIterator = module.exports = function (arr, kind) { - if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'"); + if (!(this instanceof ArrayIterator)) { throw new TypeError("Constructor requires 'new'"); } es6Iterator.call(this, arr); - if (!kind) kind = "value"; - else if (contains.call(kind, "key+value")) kind = "key+value"; - else if (contains.call(kind, "key")) kind = "key"; - else kind = "value"; + if (!kind) { kind = "value"; } + else if (contains.call(kind, "key+value")) { kind = "key+value"; } + else if (contains.call(kind, "key")) { kind = "key"; } + else { kind = "value"; } defineProperty(this, "__kind__", d_1("", kind)); }; - if (setPrototypeOf) setPrototypeOf(ArrayIterator, es6Iterator); + if (setPrototypeOf) { setPrototypeOf(ArrayIterator, es6Iterator); } // Internal %ArrayIteratorPrototype% doesn't expose its constructor delete ArrayIterator.prototype.constructor; ArrayIterator.prototype = Object.create(es6Iterator.prototype, { _resolve: d_1(function (i) { - if (this.__kind__ === "value") return this.__list__[i]; - if (this.__kind__ === "key+value") return [i, this.__list__[i]]; + if (this.__kind__ === "value") { return this.__list__[i]; } + if (this.__kind__ === "key+value") { return [i, this.__list__[i]]; } return i; }) }); @@ -1392,28 +1396,28 @@ var defineProperty = Object.defineProperty, StringIterator; StringIterator = module.exports = function (str) { - if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'"); + if (!(this instanceof StringIterator)) { throw new TypeError("Constructor requires 'new'"); } str = String(str); es6Iterator.call(this, str); defineProperty(this, "__length__", d_1("", str.length)); }; - if (setPrototypeOf) setPrototypeOf(StringIterator, es6Iterator); + if (setPrototypeOf) { setPrototypeOf(StringIterator, es6Iterator); } // Internal %ArrayIteratorPrototype% doesn't expose its constructor delete StringIterator.prototype.constructor; StringIterator.prototype = Object.create(es6Iterator.prototype, { _next: d_1(function () { - if (!this.__list__) return undefined; - if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; + if (!this.__list__) { return undefined; } + if (this.__nextIndex__ < this.__length__) { return this.__nextIndex__++; } this._unBind(); return undefined; }), _resolve: d_1(function (i) { var char = this.__list__[i], code; - if (this.__nextIndex__ === this.__length__) return char; + if (this.__nextIndex__ === this.__length__) { return char; } code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) return char + this.__list__[this.__nextIndex__++]; + if (code >= 0xd800 && code <= 0xdbff) { return char + this.__list__[this.__nextIndex__++]; } return char; }) }); @@ -1423,9 +1427,9 @@ var iteratorSymbol$2 = es6Symbol$1.iterator; var get = function (obj) { - if (typeof validIterable(obj)[iteratorSymbol$2] === "function") return obj[iteratorSymbol$2](); - if (isArguments(obj)) return new array(obj); - if (isString(obj)) return new string(obj); + if (typeof validIterable(obj)[iteratorSymbol$2] === "function") { return obj[iteratorSymbol$2](); } + if (isArguments(obj)) { return new array(obj); } + if (isString(obj)) { return new string(obj); } return new array(obj); }; @@ -1433,9 +1437,9 @@ var forOf = function (iterable, cb /*, thisArg*/) { var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code; - if (isArray$2(iterable) || isArguments(iterable)) mode = "array"; - else if (isString(iterable)) mode = "string"; - else iterable = get(iterable); + if (isArray$2(iterable) || isArguments(iterable)) { mode = "array"; } + else if (isString(iterable)) { mode = "string"; } + else { iterable = get(iterable); } validCallable(cb); doBreak = function () { @@ -1454,10 +1458,10 @@ char = iterable[i]; if (i + 1 < length) { code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) char += iterable[++i]; + if (code >= 0xd800 && code <= 0xdbff) { char += iterable[++i]; } } call$3.call(cb, thisArg, char, doBreak); - if (broken) break; + if (broken) { break; } } return; } @@ -1465,7 +1469,7 @@ while (!result.done) { call$3.call(cb, thisArg, result.value, doBreak); - if (broken) return; + if (broken) { return; } result = iterable.next(); } }; @@ -1478,19 +1482,19 @@ , SetIterator; SetIterator = module.exports = function (set, kind) { - if (!(this instanceof SetIterator)) return new SetIterator(set, kind); + if (!(this instanceof SetIterator)) { return new SetIterator(set, kind); } es6Iterator.call(this, set.__setData__, set); - if (!kind) kind = 'value'; - else if (contains.call(kind, 'key+value')) kind = 'key+value'; - else kind = 'value'; + if (!kind) { kind = 'value'; } + else if (contains.call(kind, 'key+value')) { kind = 'key+value'; } + else { kind = 'value'; } defineProperty(this, '__kind__', d_1('', kind)); }; - if (setPrototypeOf) setPrototypeOf(SetIterator, es6Iterator); + if (setPrototypeOf) { setPrototypeOf(SetIterator, es6Iterator); } SetIterator.prototype = Object.create(es6Iterator.prototype, { constructor: d_1(SetIterator), _resolve: d_1(function (i) { - if (this.__kind__ === 'value') return this.__list__[i]; + if (this.__kind__ === 'value') { return this.__list__[i]; } return [this.__list__[i], this.__list__[i]]; }), toString: d_1(function () { return '[object Set Iterator]'; }) @@ -1501,7 +1505,7 @@ // Exports true if environment provides native `Set` implementation, var isNativeImplemented = (function () { - if (typeof Set === 'undefined') return false; + if (typeof Set === 'undefined') { return false; } return (Object.prototype.toString.call(Set.prototype) === '[object Set]'); }()); @@ -1511,42 +1515,42 @@ , defineProperty$7 = Object.defineProperty, getPrototypeOf$1 = Object.getPrototypeOf , SetPoly, getValues, NativeSet; - if (isNativeImplemented) NativeSet = Set; + if (isNativeImplemented) { NativeSet = Set; } var polyfill$2 = SetPoly = function Set(/*iterable*/) { var iterable = arguments[0], self; - if (!(this instanceof SetPoly)) throw new TypeError('Constructor requires \'new\''); - if (isNativeImplemented && setPrototypeOf) self = setPrototypeOf(new NativeSet(), getPrototypeOf$1(this)); - else self = this; - if (iterable != null) iterator$1(iterable); + if (!(this instanceof SetPoly)) { throw new TypeError('Constructor requires \'new\''); } + if (isNativeImplemented && setPrototypeOf) { self = setPrototypeOf(new NativeSet(), getPrototypeOf$1(this)); } + else { self = this; } + if (iterable != null) { iterator$1(iterable); } defineProperty$7(self, '__setData__', d_1('c', [])); - if (!iterable) return self; + if (!iterable) { return self; } forOf(iterable, function (value) { - if (eIndexOf.call(this, value) !== -1) return; + if (eIndexOf.call(this, value) !== -1) { return; } this.push(value); }, self.__setData__); return self; }; if (isNativeImplemented) { - if (setPrototypeOf) setPrototypeOf(SetPoly, NativeSet); + if (setPrototypeOf) { setPrototypeOf(SetPoly, NativeSet); } SetPoly.prototype = Object.create(NativeSet.prototype, { constructor: d_1(SetPoly) }); } eventEmitter(Object.defineProperties(SetPoly.prototype, { add: d_1(function (value) { - if (this.has(value)) return this; + if (this.has(value)) { return this; } this.emit('_add', this.__setData__.push(value) - 1, value); return this; }), clear: d_1(function () { - if (!this.__setData__.length) return; + if (!this.__setData__.length) { return; } clear.call(this.__setData__); this.emit('_clear'); }), delete: d_1(function (value) { var index = eIndexOf.call(this.__setData__, value); - if (index === -1) return false; + if (index === -1) { return false; } this.__setData__.splice(index, 1); this.emit('_delete', index, value); return true; @@ -1578,31 +1582,31 @@ var isImplemented$b = function () { var map, iterator, result; - if (typeof Map !== 'function') return false; + if (typeof Map !== 'function') { return false; } try { // WebKit doesn't support arguments and crashes map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]); } catch (e) { return false; } - if (String(map) !== '[object Map]') return false; - if (map.size !== 3) return false; - if (typeof map.clear !== 'function') return false; - if (typeof map.delete !== 'function') return false; - if (typeof map.entries !== 'function') return false; - if (typeof map.forEach !== 'function') return false; - if (typeof map.get !== 'function') return false; - if (typeof map.has !== 'function') return false; - if (typeof map.keys !== 'function') return false; - if (typeof map.set !== 'function') return false; - if (typeof map.values !== 'function') return false; + if (String(map) !== '[object Map]') { return false; } + if (map.size !== 3) { return false; } + if (typeof map.clear !== 'function') { return false; } + if (typeof map.delete !== 'function') { return false; } + if (typeof map.entries !== 'function') { return false; } + if (typeof map.forEach !== 'function') { return false; } + if (typeof map.get !== 'function') { return false; } + if (typeof map.has !== 'function') { return false; } + if (typeof map.keys !== 'function') { return false; } + if (typeof map.set !== 'function') { return false; } + if (typeof map.values !== 'function') { return false; } iterator = map.entries(); result = iterator.next(); - if (result.done !== false) return false; - if (!result.value) return false; - if (result.value[0] !== 'raz') return false; - if (result.value[1] !== 'one') return false; + if (result.done !== false) { return false; } + if (!result.value) { return false; } + if (result.value[0] !== 'raz') { return false; } + if (result.value[1] !== 'one') { return false; } return true; }; @@ -1628,21 +1632,21 @@ , MapIterator; MapIterator = module.exports = function (map, kind) { - if (!(this instanceof MapIterator)) return new MapIterator(map, kind); + if (!(this instanceof MapIterator)) { return new MapIterator(map, kind); } es6Iterator.call(this, map.__mapKeysData__, map); - if (!kind || !iteratorKinds[kind]) kind = 'key+value'; + if (!kind || !iteratorKinds[kind]) { kind = 'key+value'; } defineProperties(this, { __kind__: d_1('', kind), __values__: d_1('w', map.__mapValuesData__) }); }; - if (setPrototypeOf) setPrototypeOf(MapIterator, es6Iterator); + if (setPrototypeOf) { setPrototypeOf(MapIterator, es6Iterator); } MapIterator.prototype = Object.create(es6Iterator.prototype, { constructor: d_1(MapIterator), _resolve: d_1(function (i) { - if (this.__kind__ === 'value') return this.__values__[i]; - if (this.__kind__ === 'key') return this.__list__[i]; + if (this.__kind__ === 'value') { return this.__values__[i]; } + if (this.__kind__ === 'key') { return this.__list__[i]; } return [this.__list__[i], this.__values__[i]]; }), _unBind: d_1(function () { @@ -1658,7 +1662,7 @@ // Exports true if environment provides native `Map` implementation, var isNativeImplemented$1 = (function () { - if (typeof Map === 'undefined') return false; + if (typeof Map === 'undefined') { return false; } return (Object.prototype.toString.call(new Map()) === '[object Map]'); }()); @@ -1670,22 +1674,22 @@ var polyfill$3 = MapPoly = function (/*iterable*/) { var iterable = arguments[0], keys, values, self; - if (!(this instanceof MapPoly)) throw new TypeError('Constructor requires \'new\''); + if (!(this instanceof MapPoly)) { throw new TypeError('Constructor requires \'new\''); } if (isNativeImplemented$1 && setPrototypeOf && (Map !== MapPoly)) { self = setPrototypeOf(new Map(), getPrototypeOf$2(this)); } else { self = this; } - if (iterable != null) iterator$3(iterable); + if (iterable != null) { iterator$3(iterable); } defineProperties$3(self, { __mapKeysData__: d_1('c', keys = []), __mapValuesData__: d_1('c', values = []) }); - if (!iterable) return self; + if (!iterable) { return self; } forOf(iterable, function (value) { var key = validValue(value)[0]; value = value[1]; - if (eIndexOf.call(keys, key) !== -1) return; + if (eIndexOf.call(keys, key) !== -1) { return; } keys.push(key); values.push(value); }, self); @@ -1693,7 +1697,7 @@ }; if (isNativeImplemented$1) { - if (setPrototypeOf) setPrototypeOf(MapPoly, Map); + if (setPrototypeOf) { setPrototypeOf(MapPoly, Map); } MapPoly.prototype = Object.create(Map.prototype, { constructor: d_1(MapPoly) }); @@ -1701,14 +1705,14 @@ eventEmitter(defineProperties$3(MapPoly.prototype, { clear: d_1(function () { - if (!this.__mapKeysData__.length) return; + if (!this.__mapKeysData__.length) { return; } clear.call(this.__mapKeysData__); clear.call(this.__mapValuesData__); this.emit('_clear'); }), delete: d_1(function (key) { var index = eIndexOf.call(this.__mapKeysData__, key); - if (index === -1) return false; + if (index === -1) { return false; } this.__mapKeysData__.splice(index, 1); this.__mapValuesData__.splice(index, 1); this.emit('_delete', index, key); @@ -1728,7 +1732,7 @@ }), get: d_1(function (key) { var index = eIndexOf.call(this.__mapKeysData__, key); - if (index === -1) return; + if (index === -1) { return; } return this.__mapValuesData__[index]; }), has: d_1(function (key) { @@ -1742,7 +1746,7 @@ emit = true; } this.__mapValuesData__[index] = value; - if (emit) this.emit('_add', index, key); + if (emit) { this.emit('_add', index, key); } return this; }), size: d_1.gs(function () { return this.__mapKeysData__.length; }), @@ -1831,7 +1835,7 @@ return true; } } - } catch (e) { + } catch (e$1) { return true; } } @@ -3305,15 +3309,15 @@ return String(obj); } - if (!opts) opts = {}; + if (!opts) { opts = {}; } var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; - if (typeof depth === 'undefined') depth = 0; + if (typeof depth === 'undefined') { depth = 0; } if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { return '[Object]'; } - if (typeof seen === 'undefined') seen = []; + if (typeof seen === 'undefined') { seen = []; } else if (indexOf$2(seen, obj) >= 0) { return '[Circular]'; } @@ -3341,17 +3345,17 @@ s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"'; } s += '>'; - if (obj.childNodes && obj.childNodes.length) s += '...'; + if (obj.childNodes && obj.childNodes.length) { s += '...'; } s += ''; return s; } if (isArray$3(obj)) { - if (obj.length === 0) return '[]'; + if (obj.length === 0) { return '[]'; } return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]'; } if (isError(obj)) { var parts = arrObjKeys(obj, inspect); - if (parts.length === 0) return '[' + String(obj) + ']'; + if (parts.length === 0) { return '[' + String(obj) + ']'; } return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }'; } if (typeof obj === 'object' && typeof obj.inspect === 'function') { @@ -3382,7 +3386,7 @@ } if (!isDate(obj) && !isRegExp(obj)) { var xs = arrObjKeys(obj, inspect); - if (xs.length === 0) return '{}'; + if (xs.length === 0) { return '{}'; } return '{ ' + xs.join(', ') + ' }'; } return String(obj); @@ -3411,15 +3415,15 @@ } function nameOf (f) { - if (f.name) return f.name; + if (f.name) { return f.name; } var m = String(f).match(/^function\s*([\w$]+)/); - if (m) return m[1]; + if (m) { return m[1]; } } function indexOf$2 (xs, x) { - if (xs.indexOf) return xs.indexOf(x); + if (xs.indexOf) { return xs.indexOf(x); } for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; + if (xs[i] === x) { return i; } } return -1; } @@ -3457,7 +3461,7 @@ } function isElement (x) { - if (!x || typeof x !== 'object') return false; + if (!x || typeof x !== 'object') { return false; } if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { return true; } @@ -3474,7 +3478,7 @@ function lowbyte (c) { var n = c.charCodeAt(0); var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; - if (x) return '\\' + x; + if (x) { return '\\' + x; } return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16); } @@ -3496,8 +3500,8 @@ } } for (var key in obj) { - if (!has$1(obj, key)) continue; - if (isArr && String(Number(key)) === key && key < obj.length) continue; + if (!has$1(obj, key)) { continue; } + if (isArr && String(Number(key)) === key && key < obj.length) { continue; } if (/[^\w$]/.test(key)) { xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); } else { @@ -3774,7 +3778,7 @@ } } return x instanceof $Map; // core-js workaround, pre-v2.5.0 - } catch (e) {} + } catch (e$1) {} return false; }; @@ -3815,7 +3819,7 @@ } } return x instanceof $Set$1; // core-js workaround, pre-v2.5.0 - } catch (e) {} + } catch (e$1) {} return false; }; @@ -4229,11 +4233,13 @@ var originalGetSymbols = hasSymbols$5 ? Object.getOwnPropertySymbols : null; var implementation$7 = function assign(target, source1) { + var arguments$1 = arguments; + if (!canBeObject(target)) { throw new TypeError('target must be an object'); } var objTarget = toObject(target); var s, source, i, props, syms, value, key; for (s = 1; s < arguments.length; ++s) { - source = toObject(arguments[s]); + source = toObject(arguments$1[s]); props = objectKeys(source); var getSymbols = hasSymbols$5 && (Object.getOwnPropertySymbols || originalGetSymbols); if (getSymbols) { @@ -4369,8 +4375,8 @@ */ function Promise$1(fn) { if (!(this instanceof Promise$1)) - throw new TypeError('Promises must be constructed via new'); - if (typeof fn !== 'function') throw new TypeError('not a function'); + { throw new TypeError('Promises must be constructed via new'); } + if (typeof fn !== 'function') { throw new TypeError('not a function'); } /** @type {!number} */ this._state = 0; /** @type {!boolean} */ @@ -4413,7 +4419,7 @@ try { // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure if (newValue === self) - throw new TypeError('A promise cannot be resolved with itself.'); + { throw new TypeError('A promise cannot be resolved with itself.'); } if ( newValue && (typeof newValue === 'object' || typeof newValue === 'function') @@ -4478,18 +4484,18 @@ try { fn( function(value) { - if (done) return; + if (done) { return; } done = true; resolve(self, value); }, function(reason) { - if (done) return; + if (done) { return; } done = true; reject(self, reason); } ); } catch (ex) { - if (done) return; + if (done) { return; } done = true; reject(self, ex); } @@ -4516,7 +4522,7 @@ } var args = Array.prototype.slice.call(arr); - if (args.length === 0) return resolve([]); + if (args.length === 0) { return resolve([]); } var remaining = args.length; function res(i, val) { @@ -5473,6 +5479,8 @@ var StringFromCharCodeSpread = callBind.apply(String.fromCharCode, null); var implementation$8 = function fromCodePoint(_ /* fromCodePoint.length is 1 */) { + var arguments$1 = arguments; + var MAX_SIZE = 0x4000; var codeUnits = []; var highSurrogate; @@ -5484,7 +5492,7 @@ } var result = ''; while (++index < length) { - var codePoint = ToNumber$1(arguments[index]); + var codePoint = ToNumber$1(arguments$1[index]); if ( !IsInteger(codePoint) || codePoint < 0 || codePoint > 0x10FFFF // not a valid Unicode code point @@ -5541,14 +5549,14 @@ var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; + if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); + if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } + if (staticProps) { _defineProperties(Constructor, staticProps); } return Constructor; } @@ -5564,7 +5572,7 @@ configurable: true } }); - if (superClass) _setPrototypeOf(subClass, superClass); + if (superClass) { _setPrototypeOf(subClass, superClass); } } function _getPrototypeOf(o) { @@ -5602,7 +5610,7 @@ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); - if (object === null) break; + if (object === null) { break; } } return object; @@ -5615,7 +5623,7 @@ _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); - if (!base) return; + if (!base) { return; } var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { @@ -6097,7 +6105,7 @@ function reverseValue(key, value, includeAbsolute) { - if (ignoreKey.test(key)) return value; + if (ignoreKey.test(key)) { return value; } // Turn lanes are left/right to key (not way) direction - #5674 if (turn_lanes.test(key)) { @@ -6110,7 +6118,7 @@ return onewayReplacements[value] || value; } else if (includeAbsolute && directionKey.test(key)) { - if (compassReplacements[value]) return compassReplacements[value]; + if (compassReplacements[value]) { return compassReplacements[value]; } var degrees = parseFloat(value); if (typeof degrees === 'number' && !isNaN(degrees)) { @@ -6131,7 +6139,7 @@ function reverseNodeTags(graph, nodeIDs) { for (var i = 0; i < nodeIDs.length; i++) { var node = graph.hasEntity(nodeIDs[i]); - if (!node || !Object.keys(node.tags).length) continue; + if (!node || !Object.keys(node.tags).length) { continue; } var tags = {}; for (var key in node.tags) { @@ -6178,7 +6186,7 @@ action.disabled = function(graph) { var entity = graph.hasEntity(entityID); - if (!entity || entity.type === 'way') return false; + if (!entity || entity.type === 'way') { return false; } for (var key in entity.tags) { var value = entity.tags[key]; @@ -6213,8 +6221,8 @@ // returns an object with the tag from `tags` that implies an area geometry, if any function osmTagSuggestingArea(tags) { - if (tags.area === 'yes') return { area: 'yes' }; - if (tags.area === 'no') return null; + if (tags.area === 'yes') { return { area: 'yes' }; } + if (tags.area === 'no') { return null; } // `highway` and `railway` are typically linear features, but there // are a few exceptions that should be treated as areas, even in the @@ -6271,7 +6279,7 @@ geometries.vertex = true; } // break early if both are already supported - if (geometries.point && geometries.vertex) break; + if (geometries.point && geometries.vertex) { break; } } return geometries; } @@ -6410,8 +6418,8 @@ add: function(y) { add(temp, y, this.t); add(this, temp.s, this.s); - if (this.s) this.t += temp.t; - else this.s = temp.t; + if (this.s) { this.t += temp.t; } + else { this.s = temp.t; } }, valueOf: function() { return this.s; @@ -6470,7 +6478,7 @@ }, FeatureCollection: function(object, stream) { var features = object.features, i = -1, n = features.length; - while (++i < n) streamGeometry(features[i].geometry, stream); + while (++i < n) { streamGeometry(features[i].geometry, stream); } } }; @@ -6484,39 +6492,39 @@ }, MultiPoint: function(object, stream) { var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); + while (++i < n) { object = coordinates[i], stream.point(object[0], object[1], object[2]); } }, LineString: function(object, stream) { streamLine(object.coordinates, stream, 0); }, MultiLineString: function(object, stream) { var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamLine(coordinates[i], stream, 0); + while (++i < n) { streamLine(coordinates[i], stream, 0); } }, Polygon: function(object, stream) { streamPolygon(object.coordinates, stream); }, MultiPolygon: function(object, stream) { var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) streamPolygon(coordinates[i], stream); + while (++i < n) { streamPolygon(coordinates[i], stream); } }, GeometryCollection: function(object, stream) { var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) streamGeometry(geometries[i], stream); + while (++i < n) { streamGeometry(geometries[i], stream); } } }; function streamLine(coordinates, stream, closed) { var i = -1, n = coordinates.length - closed, coordinate; stream.lineStart(); - while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); + while (++i < n) { coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); } stream.lineEnd(); } function streamPolygon(coordinates, stream) { var i = -1, n = coordinates.length; stream.polygonStart(); - while (++i < n) streamLine(coordinates[i], stream, 1); + while (++i < n) { streamLine(coordinates[i], stream, 1); } stream.polygonEnd(); } @@ -6654,9 +6662,9 @@ boundsStream.point = boundsPoint; boundsStream.lineStart = boundsLineStart; boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon) phi1 = 90; - else if (deltaSum < -epsilon) phi0 = -90; + if (areaRingSum < 0) { lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); } + else if (deltaSum > epsilon) { phi1 = 90; } + else if (deltaSum < -epsilon) { phi0 = -90; } range[0] = lambda0$1, range[1] = lambda1; }, sphere: function() { @@ -6666,8 +6674,8 @@ function boundsPoint(lambda, phi) { ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; + if (phi < phi0) { phi0 = phi; } + if (phi > phi1) { phi1 = phi; } } function linePoint(lambda, phi) { @@ -6685,37 +6693,37 @@ antimeridian = abs$2(delta) > 180; if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { phii = inflection[1] * degrees; - if (phii > phi1) phi1 = phii; + if (phii > phi1) { phi1 = phii; } } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { phii = -inflection[1] * degrees; - if (phii < phi0) phi0 = phii; + if (phii < phi0) { phi0 = phii; } } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; + if (phi < phi0) { phi0 = phi; } + if (phi > phi1) { phi1 = phi; } } if (antimeridian) { if (lambda < lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; + if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) { lambda1 = lambda; } } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; + if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) { lambda0$1 = lambda; } } } else { if (lambda1 >= lambda0$1) { - if (lambda < lambda0$1) lambda0$1 = lambda; - if (lambda > lambda1) lambda1 = lambda; + if (lambda < lambda0$1) { lambda0$1 = lambda; } + if (lambda > lambda1) { lambda1 = lambda; } } else { if (lambda > lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; + if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) { lambda1 = lambda; } } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; + if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) { lambda0$1 = lambda; } } } } } else { ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); } - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; + if (phi < phi0) { phi0 = phi; } + if (phi > phi1) { phi1 = phi; } p0 = p, lambda2 = lambda; } @@ -6747,7 +6755,7 @@ function boundsRingEnd() { boundsRingPoint(lambda00$1, phi00$1); areaStream.lineEnd(); - if (abs$2(deltaSum) > epsilon) lambda0$1 = -(lambda1 = 180); + if (abs$2(deltaSum) > epsilon) { lambda0$1 = -(lambda1 = 180); } range[0] = lambda0$1, range[1] = lambda1; p0 = null; } @@ -6782,8 +6790,8 @@ for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { b = ranges[i]; if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; + if (angle(a[0], b[1]) > angle(a[0], a[1])) { a[1] = b[1]; } + if (angle(b[0], a[1]) > angle(a[0], a[1])) { a[0] = b[0]; } } else { merged.push(a = b); } @@ -6793,7 +6801,7 @@ // The final bounding box will be the inverse of this gap. for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; + if ((delta = angle(a[1], b[0])) > deltaMax) { deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; } } } @@ -6932,10 +6940,10 @@ if (m < epsilon2) { x = X1, y = Y1, z = Z1; // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < epsilon) x = X0, y = Y0, z = Z0; + if (W1 < epsilon) { x = X0, y = Y0, z = Z0; } m = x * x + y * y + z * z; // If the feature still has an undefined ccentroid, then return. - if (m < epsilon2) return [NaN, NaN]; + if (m < epsilon2) { return [NaN, NaN]; } } return [atan2(y, x) * degrees, asin(z / sqrt(m)) * degrees]; @@ -6947,9 +6955,9 @@ return x = a(x, y), b(x[0], x[1]); } - if (a.invert && b.invert) compose.invert = function(x, y) { + if (a.invert && b.invert) { compose.invert = function(x, y) { return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; + }; } return compose; } @@ -7030,7 +7038,7 @@ // Generates a circle centered at [0°, 0°], with a given radius and precision. function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; + if (!delta) { return; } var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta; @@ -7040,7 +7048,7 @@ } else { t0 = circleRadius(cosRadius, t0); t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau; + if (direction > 0 ? t0 < t1 : t0 > t1) { t0 += direction * tau; } } for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]); @@ -7068,7 +7076,7 @@ }, lineEnd: noop$2, rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + if (lines.length > 1) { lines.push(lines.pop().concat(lines.shift())); } }, result: function() { var result = lines; @@ -7102,13 +7110,13 @@ n; segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; + if ((n = segment.length - 1) <= 0) { return; } var n, p0 = segment[0], p1 = segment[n], x; if (pointEqual(p0, p1)) { if (!p0[2] && !p1[2]) { stream.lineStart(); - for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); + for (i = 0; i < n; ++i) { stream.point((p0 = segment[i])[0], p0[1]); } stream.lineEnd(); return; } @@ -7122,7 +7130,7 @@ clip.push(x.o = new Intersection(p1, null, x, true)); }); - if (!subject.length) return; + if (!subject.length) { return; } clip.sort(compareIntersection); link(subject); @@ -7140,14 +7148,14 @@ // Find first unvisited intersection. var current = start, isSubject = true; - while (current.v) if ((current = current.n) === start) return; + while (current.v) { if ((current = current.n) === start) { return; } } points = current.z; stream.lineStart(); do { current.v = current.o.v = true; if (current.e) { if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); + for (i = 0, n = points.length; i < n; ++i) { stream.point((point = points[i])[0], point[1]); } } else { interpolate(current.x, current.n.x, 1, stream); } @@ -7155,7 +7163,7 @@ } else { if (isSubject) { points = current.p.z; - for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); + for (i = points.length - 1; i >= 0; --i) { stream.point((point = points[i])[0], point[1]); } } else { interpolate(current.x, current.p.x, -1, stream); } @@ -7170,7 +7178,7 @@ } function link(array) { - if (!(n = array.length)) return; + if (!(n = array.length)) { return; } var n, i = 0, a = array[0], @@ -7188,9 +7196,9 @@ function longitude(point) { if (abs$2(point[0]) <= pi) - return point[0]; + { return point[0]; } else - return sign$2(point[0]) * ((abs$2(point[0]) + pi) % tau - pi); + { return sign$2(point[0]) * ((abs$2(point[0]) + pi) % tau - pi); } } function polygonContains(polygon, point) { @@ -7203,11 +7211,11 @@ sum.reset(); - if (sinPhi === 1) phi = halfPi + epsilon; - else if (sinPhi === -1) phi = -halfPi - epsilon; + if (sinPhi === 1) { phi = halfPi + epsilon; } + else if (sinPhi === -1) { phi = -halfPi - epsilon; } for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; + if (!(m = (ring = polygon[i]).length)) { continue; } var ring, m, point0 = ring[m - 1], @@ -7265,25 +7273,25 @@ } function d3_bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); + if (compare.length === 1) { compare = ascendingComparator(compare); } return { left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; + if (lo == null) { lo = 0; } + if (hi == null) { hi = a.length; } while (lo < hi) { var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1; - else hi = mid; + if (compare(a[mid], x) < 0) { lo = mid + 1; } + else { hi = mid; } } return lo; }, right: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; + if (lo == null) { lo = 0; } + if (hi == null) { hi = a.length; } while (lo < hi) { var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid; - else lo = mid + 1; + if (compare(a[mid], x) > 0) { hi = mid; } + else { lo = mid + 1; } } return lo; } @@ -7333,23 +7341,23 @@ step; stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; + if (start === stop && count > 0) { return [start]; } + if (reverse = stop < start) { n = start, start = stop, stop = n; } + if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) { return []; } if (step > 0) { start = Math.ceil(start / step); stop = Math.floor(stop / step); ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; + while (++i < n) { ticks[i] = (start + i) * step; } } else { start = Math.floor(start * step); stop = Math.ceil(stop * step); ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; + while (++i < n) { ticks[i] = (start - i) / step; } } - if (reverse) ticks.reverse(); + if (reverse) { ticks.reverse(); } return ticks; } @@ -7367,17 +7375,17 @@ var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; + if (error >= e10) { step1 *= 10; } + else if (error >= e5) { step1 *= 5; } + else if (error >= e2) { step1 *= 2; } return stop < start ? -step1 : step1; } function threshold(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); + if (valueof == null) { valueof = number; } + if (!(n = values.length)) { return; } + if ((p = +p) <= 0 || n < 2) { return +valueof(values[0], 0, values); } + if (p >= 1) { return +valueof(values[n - 1], n - 1, values); } var n, i = (n - 1) * p, i0 = Math.floor(i), @@ -7419,7 +7427,7 @@ merged, array; - while (++i < n) j += arrays[i].length; + while (++i < n) { j += arrays[i].length; } merged = new Array(j); while (--n >= 0) { @@ -7461,15 +7469,15 @@ segments = merge(segments); var startInside = polygonContains(polygon, start); if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + if (!polygonStarted) { sink.polygonStart(), polygonStarted = true; } clipRejoin(segments, compareIntersection, startInside, interpolate, sink); } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + if (!polygonStarted) { sink.polygonStart(), polygonStarted = true; } sink.lineStart(); interpolate(null, null, 1, sink); sink.lineEnd(); } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + if (polygonStarted) { sink.polygonEnd(), polygonStarted = false; } segments = polygon = null; }, sphere: function() { @@ -7482,7 +7490,7 @@ }; function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); + if (pointVisible(lambda, phi)) { sink.point(lambda, phi); } } function pointLine(lambda, phi) { @@ -7523,15 +7531,15 @@ polygon.push(ring); ring = null; - if (!n) return; + if (!n) { return; } // No intersections. if (clean & 1) { segment = ringSegments[0]; if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + if (!polygonStarted) { sink.polygonStart(), polygonStarted = true; } sink.lineStart(); - for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); + for (i = 0; i < m; ++i) { sink.point((point = segment[i])[0], point[1]); } sink.lineEnd(); } return; @@ -7539,7 +7547,7 @@ // Rejoin connected segments. // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + if (n > 1 && clean & 2) { ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); } segments.push(ringSegments.filter(validSegment)); } @@ -7592,8 +7600,8 @@ stream.point(lambda1, phi0); clean = 0; } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian - if (abs$2(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies - if (abs$2(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon; + if (abs$2(lambda0 - sign0) < epsilon) { lambda0 -= sign0 * epsilon; } // handle degeneracies + if (abs$2(lambda1 - sign1) < epsilon) { lambda1 -= sign1 * epsilon; } phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); stream.point(sign0, phi0); stream.lineEnd(); @@ -7685,11 +7693,11 @@ c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); + if (!point0 && (v00 = v0 = v)) { stream.lineStart(); } if (v !== v0) { point2 = intersect(point0, point1); if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) - point1[2] = 1; + { point1[2] = 1; } } if (v !== v0) { clean = 0; @@ -7730,7 +7738,7 @@ point0 = point1, v0 = v, c0 = c; }, lineEnd: function() { - if (v0) stream.lineEnd(); + if (v0) { stream.lineEnd(); } point0 = null; }, // Rejoin first and last segments if there were intersections and the first @@ -7755,7 +7763,7 @@ determinant = n2n2 - n1n2 * n1n2; // Two polar points. - if (!determinant) return !two && a; + if (!determinant) { return !two && a; } var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, @@ -7770,14 +7778,14 @@ uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1); - if (t2 < 0) return; + if (t2 < 0) { return; } var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu); cartesianAddInPlace(q, A); q = spherical(q); - if (!two) return q; + if (!two) { return q; } // Two intersection points. var lambda0 = a[0], @@ -7786,13 +7794,13 @@ phi1 = b[1], z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; + if (lambda1 < lambda0) { z = lambda0, lambda0 = lambda1, lambda1 = z; } var delta = lambda1 - lambda0, polar = abs$2(delta - pi) < epsilon, meridian = polar || delta < epsilon; - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; + if (!polar && phi1 < phi0) { z = phi0, phi0 = phi1, phi1 = z; } // Check that the first point is between a and b. if (meridian @@ -7811,10 +7819,10 @@ function code(lambda, phi) { var r = smallRadius ? radius : pi - radius, code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above + if (lambda < -r) { code |= 1; } // left + else if (lambda > r) { code |= 2; } // right + if (phi < -r) { code |= 4; } // below + else if (phi > r) { code |= 8; } // above return code; } @@ -7833,51 +7841,51 @@ r; r = x0 - ax; - if (!dx && r > 0) return; + if (!dx && r > 0) { return; } r /= dx; if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; + if (r < t0) { return; } + if (r < t1) { t1 = r; } } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; + if (r > t1) { return; } + if (r > t0) { t0 = r; } } r = x1 - ax; - if (!dx && r < 0) return; + if (!dx && r < 0) { return; } r /= dx; if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; + if (r > t1) { return; } + if (r > t0) { t0 = r; } } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; + if (r < t0) { return; } + if (r < t1) { t1 = r; } } r = y0 - ay; - if (!dy && r > 0) return; + if (!dy && r > 0) { return; } r /= dy; if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; + if (r < t0) { return; } + if (r < t1) { t1 = r; } } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; + if (r > t1) { return; } + if (r > t0) { t0 = r; } } r = y1 - ay; - if (!dy && r < 0) return; + if (!dy && r < 0) { return; } r /= dy; if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; + if (r > t1) { return; } + if (r > t0) { t0 = r; } } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; + if (r < t0) { return; } + if (r < t1) { t1 = r; } } - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; + if (t0 > 0) { a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; } + if (t1 < 1) { b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; } return true; } @@ -7897,7 +7905,7 @@ if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { - do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + do { stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); } while ((a = (a + direction + 4) % 4) !== a1); } else { stream.point(to[0], to[1]); @@ -7945,7 +7953,7 @@ }; function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); + if (visible(x, y)) { activeStream.point(x, y); } } function polygonInside() { @@ -7954,8 +7962,8 @@ for (var i = 0, n = polygon.length; i < n; ++i) { for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } - else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; } + if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) { ++winding; } } + else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) { --winding; } } } } @@ -7988,7 +7996,7 @@ function lineStart() { clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); + if (polygon) { polygon.push(ring = []); } first = true; v_ = false; x_ = y_ = NaN; @@ -8000,16 +8008,16 @@ function lineEnd() { if (segments) { linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); + if (v__ && v_) { bufferStream.rejoin(); } segments.push(bufferStream.result()); } clipStream.point = point; - if (v_) activeStream.lineEnd(); + if (v_) { activeStream.lineEnd(); } } function linePoint(x, y) { var v = visible(x, y); - if (polygon) ring.push([x, y]); + if (polygon) { ring.push([x, y]); } if (first) { x__ = x, y__ = y, v__ = v; first = false; @@ -8018,7 +8026,7 @@ activeStream.point(x, y); } } else { - if (v && v_) activeStream.point(x, y); + if (v && v_) { activeStream.point(x, y); } else { var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; @@ -8028,7 +8036,7 @@ activeStream.point(a[0], a[1]); } activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); + if (!v) { activeStream.lineEnd(); } clean = false; } else if (v) { activeStream.lineStart(); @@ -8161,10 +8169,10 @@ }; function boundsPoint$1(x, y) { - if (x < x0$2) x0$2 = x; - if (x > x1) x1 = x; - if (y < y0$2) y0$2 = y; - if (y > y1) y1 = y; + if (x < x0$2) { x0$2 = x; } + if (x > x1) { x1 = x; } + if (y < y0$2) { y0$2 = y; } + if (y > y1) { y1 = y; } } // TODO Enforce positive area for exterior, negative area for interior? @@ -8283,7 +8291,7 @@ this._point = 0; }, lineEnd: function() { - if (this._line === 0) this._context.closePath(); + if (this._line === 0) { this._context.closePath(); } this._point = NaN; }, point: function(x, y) { @@ -8320,7 +8328,7 @@ lengthStream$1.point = lengthPointFirst$1; }, lineEnd: function() { - if (lengthRing) lengthPoint$1(x00$2, y00$2); + if (lengthRing) { lengthPoint$1(x00$2, y00$2); } lengthStream$1.point = noop$2; }, polygonStart: function() { @@ -8355,7 +8363,7 @@ _radius: 4.5, _circle: circle(4.5), pointRadius: function(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; + if ((_ = +_) !== this._radius) { this._radius = _, this._circle = null; } return this; }, polygonStart: function() { @@ -8368,7 +8376,7 @@ this._point = 0; }, lineEnd: function() { - if (this._line === 0) this._string.push("Z"); + if (this._line === 0) { this._string.push("Z"); } this._point = NaN; }, point: function(x, y) { @@ -8383,7 +8391,7 @@ break; } default: { - if (this._circle == null) this._circle = circle(this._radius); + if (this._circle == null) { this._circle = circle(this._radius); } this._string.push("M", x, ",", y, this._circle); break; } @@ -8414,7 +8422,7 @@ function path(object) { if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + if (typeof pointRadius === "function") { contextStream.pointRadius(+pointRadius.apply(this, arguments)); } d3_geoStream(object, projectionStream(contextStream)); } return contextStream.result(); @@ -8445,14 +8453,14 @@ }; path.context = function(_) { - if (!arguments.length) return context; + if (!arguments.length) { return context; } contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + if (typeof pointRadius !== "function") { contextStream.pointRadius(pointRadius); } return path; }; path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; + if (!arguments.length) { return pointRadius; } pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); return path; }; @@ -8469,7 +8477,7 @@ function transformer(methods) { return function(stream) { var s = new TransformStream; - for (var key in methods) s[key] = methods[key]; + for (var key in methods) { s[key] = methods[key]; } s.stream = stream; return s; }; @@ -8490,10 +8498,10 @@ function fit(projection, fitBounds, object) { var clip = projection.clipExtent && projection.clipExtent(); projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); + if (clip != null) { projection.clipExtent(null); } d3_geoStream(object, projection.stream(boundsStream$1)); fitBounds(boundsStream$1.result()); - if (clip != null) projection.clipExtent(clip); + if (clip != null) { projection.clipExtent(clip); } return projection; } @@ -9042,7 +9050,7 @@ extend: function(obj) { - if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) { obj = new geoExtent(obj); } return geoExtent( [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])], [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])] @@ -9090,7 +9098,7 @@ contains: function(obj) { - if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) { obj = new geoExtent(obj); } return obj[0][0] >= this[0][0] && obj[0][1] >= this[0][1] && obj[1][0] <= this[1][0] && @@ -9099,7 +9107,7 @@ intersects: function(obj) { - if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) { obj = new geoExtent(obj); } return obj[0][0] <= this[1][0] && obj[0][1] <= this[1][1] && obj[1][0] >= this[0][0] && @@ -9108,7 +9116,7 @@ intersection: function(obj) { - if (!this.intersects(obj)) return new geoExtent(); + if (!this.intersects(obj)) { return new geoExtent(); } return new geoExtent( [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])], [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])] @@ -9117,7 +9125,7 @@ percentContainedIn: function(obj) { - if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) { obj = new geoExtent(obj); } var a1 = this.intersection(obj).area(); var a2 = this.area(); @@ -9208,7 +9216,7 @@ size = 2; for (var i = 2; i < n; ++i) { - while (size > 1 && cross(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size; + while (size > 1 && cross(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) { --size; } indexes[size++] = i; } @@ -9216,16 +9224,16 @@ } function d3_polygonHull(points) { - if ((n = points.length) < 3) return null; + if ((n = points.length) < 3) { return null; } var i, n, sortedPoints = new Array(n), flippedPoints = new Array(n); - for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i]; + for (i = 0; i < n; ++i) { sortedPoints[i] = [+points[i][0], +points[i][1], i]; } sortedPoints.sort(lexicographicOrder); - for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]]; + for (i = 0; i < n; ++i) { flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]]; } var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints); @@ -9237,8 +9245,8 @@ // Add upper hull in right-to-l order. // Then add lower hull in left-to-right order. - for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]); - for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]); + for (i = upperIndexes.length - 1; i >= 0; --i) { hull.push(points[sortedPoints[upperIndexes[i]][2]]); } + for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) { hull.push(points[sortedPoints[lowerIndexes[i]][2]]); } return hull; } @@ -9409,7 +9417,7 @@ var loc; for (var i = 0; i < points.length - 1; i++) { - if (ids[i] === activeID || ids[i + 1] === activeID) continue; + if (ids[i] === activeID || ids[i + 1] === activeID) { continue; } var o = points[i]; var s = geoVecSubtract(points[i + 1], o); @@ -9611,7 +9619,7 @@ var intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); - if (intersect) inside = !inside; + if (intersect) { inside = !inside; } } return inside; @@ -9687,13 +9695,13 @@ var y = 0; if (point[0] > dimensions[0] - pad[1]) - x = -10; + { x = -10; } if (point[0] < pad[3]) - x = 10; + { x = 10; } if (point[1] > dimensions[1] - pad[2]) - y = -10; + { y = -10; } if (point[1] < pad[0]) - y = 10; + { y = 10; } if (x || y) { return [x, y]; @@ -9705,8 +9713,10 @@ var noop$3 = {value: function() {}}; function dispatch() { + var arguments$1 = arguments; + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t); + if (!(t = arguments$1[i] + "") || (t in _) || /[\s.]/.test(t)) { throw new Error("illegal type: " + t); } _[t] = []; } return new Dispatch(_); @@ -9719,8 +9729,8 @@ function parseTypenames(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); + if (i >= 0) { name = t.slice(i + 1), t = t.slice(0, i); } + if (t && !types.hasOwnProperty(t)) { throw new Error("unknown type: " + t); } return {type: t, name: name}; }); } @@ -9736,33 +9746,35 @@ // If no callback was specified, return the callback of the given type and name. if (arguments.length < 2) { - while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t; + while (++i < n) { if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) { return t; } } return; } // If a type was specified, set the callback for the given type and name. // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + if (callback != null && typeof callback !== "function") { throw new Error("invalid callback: " + callback); } while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); + if (t = (typename = T[i]).type) { _[t] = set(_[t], typename.name, callback); } + else if (callback == null) { for (t in _) { _[t] = set(_[t], typename.name, null); } } } return this; }, copy: function() { var copy = {}, _ = this._; - for (var t in _) copy[t] = _[t].slice(); + for (var t in _) { copy[t] = _[t].slice(); } return new Dispatch(copy); }, call: function(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + var arguments$1 = arguments; + + if ((n = arguments.length - 2) > 0) { for (var args = new Array(n), i = 0, n, t; i < n; ++i) { args[i] = arguments$1[i + 2]; } } + if (!this._.hasOwnProperty(type)) { throw new Error("unknown type: " + type); } + for (t = this._[type], i = 0, n = t.length; i < n; ++i) { t[i].value.apply(that, args); } }, apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + if (!this._.hasOwnProperty(type)) { throw new Error("unknown type: " + type); } + for (var t = this._[type], i = 0, n = t.length; i < n; ++i) { t[i].value.apply(that, args); } } }; @@ -9781,7 +9793,7 @@ break; } } - if (callback != null) type.push({name: name, value: callback}); + if (callback != null) { type.push({name: name, value: callback}); } return type; } @@ -9797,7 +9809,7 @@ function namespace(name) { var prefix = name += "", i = prefix.indexOf(":"); - if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") { name = name.slice(i + 1); } return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; } @@ -9833,12 +9845,12 @@ } function selection_select(select) { - if (typeof select !== "function") select = selector(select); + if (typeof select !== "function") { select = selector(select); } for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { - if ("__data__" in node) subnode.__data__ = node.__data__; + if ("__data__" in node) { subnode.__data__ = node.__data__; } subgroup[i] = subnode; } } @@ -9858,7 +9870,7 @@ } function selection_selectAll(select) { - if (typeof select !== "function") select = selectorAll(select); + if (typeof select !== "function") { select = selectorAll(select); } for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { @@ -9879,7 +9891,7 @@ } function selection_filter(match) { - if (typeof match !== "function") match = matcher(match); + if (typeof match !== "function") { match = matcher(match); } for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { @@ -10005,7 +10017,7 @@ parents = this._parents, groups = this._groups; - if (typeof value !== "function") value = constant(value); + if (typeof value !== "function") { value = constant(value); } for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { var parent = parents[j], @@ -10024,8 +10036,8 @@ // rather than at the end of the parent node. for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { if (previous = enterGroup[i0]) { - if (i0 >= i1) i1 = i0 + 1; - while (!(next = updateGroup[i1]) && ++i1 < dataLength); + if (i0 >= i1) { i1 = i0 + 1; } + while (!(next = updateGroup[i1]) && ++i1 < dataLength){ } previous._next = next || null; } } @@ -10044,8 +10056,8 @@ function selection_join(onenter, onupdate, onexit) { var enter = this.enter(), update = this, exit = this.exit(); enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + ""); - if (onupdate != null) update = onupdate(update); - if (onexit == null) exit.remove(); else onexit(exit); + if (onupdate != null) { update = onupdate(update); } + if (onexit == null) { exit.remove(); } else { onexit(exit); } return enter && update ? enter.merge(update).order() : update; } @@ -10071,7 +10083,7 @@ for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { if (node = group[i]) { - if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next); + if (next && node.compareDocumentPosition(next) ^ 4) { next.parentNode.insertBefore(node, next); } next = node; } } @@ -10081,7 +10093,7 @@ } function selection_sort(compare) { - if (!compare) compare = ascending; + if (!compare) { compare = ascending; } function compareNode(a, b) { return a && b ? compare(a.__data__, b.__data__) : !a - !b; @@ -10121,7 +10133,7 @@ for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { var node = group[i]; - if (node) return node; + if (node) { return node; } } } @@ -10142,7 +10154,7 @@ for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { - if (node = group[i]) callback.call(node, node.__data__, i, group); + if (node = group[i]) { callback.call(node, node.__data__, i, group); } } } @@ -10176,16 +10188,16 @@ function attrFunction(name, value) { return function() { var v = value.apply(this, arguments); - if (v == null) this.removeAttribute(name); - else this.setAttribute(name, v); + if (v == null) { this.removeAttribute(name); } + else { this.setAttribute(name, v); } }; } function attrFunctionNS(fullname, value) { return function() { var v = value.apply(this, arguments); - if (v == null) this.removeAttributeNS(fullname.space, fullname.local); - else this.setAttributeNS(fullname.space, fullname.local, v); + if (v == null) { this.removeAttributeNS(fullname.space, fullname.local); } + else { this.setAttributeNS(fullname.space, fullname.local, v); } }; } @@ -10226,8 +10238,8 @@ function styleFunction(name, value, priority) { return function() { var v = value.apply(this, arguments); - if (v == null) this.style.removeProperty(name); - else this.style.setProperty(name, v, priority); + if (v == null) { this.style.removeProperty(name); } + else { this.style.setProperty(name, v, priority); } }; } @@ -10260,8 +10272,8 @@ function propertyFunction(name, value) { return function() { var v = value.apply(this, arguments); - if (v == null) delete this[name]; - else this[name] = v; + if (v == null) { delete this[name]; } + else { this[name] = v; } }; } @@ -10309,12 +10321,12 @@ function classedAdd(node, names) { var list = classList(node), i = -1, n = names.length; - while (++i < n) list.add(names[i]); + while (++i < n) { list.add(names[i]); } } function classedRemove(node, names) { var list = classList(node), i = -1, n = names.length; - while (++i < n) list.remove(names[i]); + while (++i < n) { list.remove(names[i]); } } function classedTrue(names) { @@ -10340,7 +10352,7 @@ if (arguments.length < 2) { var list = classList(this.node()), i = -1, n = names.length; - while (++i < n) if (!list.contains(names[i])) return false; + while (++i < n) { if (!list.contains(names[i])) { return false; } } return true; } @@ -10403,7 +10415,7 @@ } function raise() { - if (this.nextSibling) this.parentNode.appendChild(this); + if (this.nextSibling) { this.parentNode.appendChild(this); } } function selection_raise() { @@ -10411,7 +10423,7 @@ } function lower() { - if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); + if (this.previousSibling) { this.parentNode.insertBefore(this, this.parentNode.firstChild); } } function selection_lower() { @@ -10439,7 +10451,7 @@ function remove() { var parent = this.parentNode; - if (parent) parent.removeChild(this); + if (parent) { parent.removeChild(this); } } function selection_remove() { @@ -10502,7 +10514,7 @@ function parseTypenames$1(typenames) { return typenames.trim().split(/^|\s+/).map(function(t) { var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (i >= 0) { name = t.slice(i + 1), t = t.slice(0, i); } return {type: t, name: name}; }); } @@ -10510,7 +10522,7 @@ function onRemove(typename) { return function() { var on = this.__on; - if (!on) return; + if (!on) { return; } for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.capture); @@ -10518,8 +10530,8 @@ on[++i] = o; } } - if (++i) on.length = i; - else delete this.__on; + if (++i) { on.length = i; } + else { delete this.__on; } }; } @@ -10527,18 +10539,18 @@ var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener; return function(d, i, group) { var on = this.__on, o, listener = wrap(value, i, group); - if (on) for (var j = 0, m = on.length; j < m; ++j) { + if (on) { for (var j = 0, m = on.length; j < m; ++j) { if ((o = on[j]).type === typename.type && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.capture); this.addEventListener(o.type, o.listener = listener, o.capture = capture); o.value = value; return; } - } + } } this.addEventListener(typename.type, listener, capture); o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture}; - if (!on) this.__on = [o]; - else on.push(o); + if (!on) { this.__on = [o]; } + else { on.push(o); } }; } @@ -10547,19 +10559,19 @@ if (arguments.length < 2) { var on = this.node().__on; - if (on) for (var j = 0, m = on.length, o; j < m; ++j) { + if (on) { for (var j = 0, m = on.length, o; j < m; ++j) { for (i = 0, o = on[j]; i < n; ++i) { if ((t = typenames[i]).type === o.type && t.name === o.name) { return o.value; } } - } + } } return; } on = value ? onAdd : onRemove; - if (capture == null) capture = false; - for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); + if (capture == null) { capture = false; } + for (i = 0; i < n; ++i) { this.each(on(typenames[i], value, capture)); } return this; } @@ -10582,8 +10594,8 @@ event = new event(type, params); } else { event = window.document.createEvent("Event"); - if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; - else event.initEvent(type, false, false); + if (params) { event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; } + else { event.initEvent(type, false, false); } } node.dispatchEvent(event); @@ -10661,7 +10673,7 @@ function sourceEvent() { var current = event, source; - while (source = current.sourceEvent) current = source; + while (source = current.sourceEvent) { current = source; } return current; } @@ -10681,7 +10693,7 @@ function mouse(node) { var event = sourceEvent(); - if (event.changedTouches) event = event.changedTouches[0]; + if (event.changedTouches) { event = event.changedTouches[0]; } return point(node, event); } @@ -10692,7 +10704,7 @@ } function touch(node, touches, identifier) { - if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches; + if (arguments.length < 3) { identifier = touches, touches = sourceEvent().changedTouches; } for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { if ((touch = touches[i]).identifier === identifier) { @@ -10805,9 +10817,9 @@ } function mousedowned() { - if (touchending || !filter.apply(this, arguments)) return; + if (touchending || !filter.apply(this, arguments)) { return; } var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments); - if (!gesture) return; + if (!gesture) { return; } select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true); dragDisable(event.view); nopropagation(); @@ -10834,13 +10846,15 @@ } function touchstarted() { - if (!filter.apply(this, arguments)) return; + var arguments$1 = arguments; + + if (!filter.apply(this, arguments)) { return; } var touches = event.changedTouches, c = container.apply(this, arguments), n = touches.length, i, gesture; for (i = 0; i < n; ++i) { - if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) { + if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments$1)) { nopropagation(); gesture("start"); } @@ -10863,7 +10877,7 @@ var touches = event.changedTouches, n = touches.length, i, gesture; - if (touchending) clearTimeout(touchending); + if (touchending) { clearTimeout(touchending); } touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed! for (i = 0; i < n; ++i) { if (gesture = gestures[touches[i].identifier]) { @@ -10878,11 +10892,11 @@ sublisteners = listeners.copy(); if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() { - if ((event.subject = s = subject.apply(that, args)) == null) return false; + if ((event.subject = s = subject.apply(that, args)) == null) { return false; } dx = s.x - p[0] || 0; dy = s.y - p[1] || 0; return true; - })) return; + })) { return; } return function gesture(type) { var p0 = p, n; @@ -10930,7 +10944,7 @@ function extend(parent, definition) { var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; + for (var key in definition) { prototype[key] = definition[key]; } return prototype; } @@ -11151,13 +11165,13 @@ } function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; + if (a <= 0) { r = g = b = NaN; } return new Rgb(r, g, b, a); } function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; + if (!(o instanceof Color)) { o = color(o); } + if (!o) { return new Rgb; } o = o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); } @@ -11216,17 +11230,17 @@ } function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; + if (a <= 0) { h = s = l = NaN; } + else if (l <= 0 || l >= 1) { h = s = NaN; } + else if (s <= 0) { h = NaN; } return new Hsl(h, s, l, a); } function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; + if (o instanceof Hsl) { return new Hsl(o.h, o.s, o.l, o.opacity); } + if (!(o instanceof Color)) { o = color(o); } + if (!o) { return new Hsl; } + if (o instanceof Hsl) { return o; } o = o.rgb(); var r = o.r / 255, g = o.g / 255, @@ -11237,9 +11251,9 @@ s = max - min, l = (max + min) / 2; if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; + if (r === max) { h = (g - b) / s + (g < b) * 6; } + else if (g === max) { h = (b - r) / s + 2; } + else { h = (r - g) / s + 4; } s /= l < 0.5 ? max + min : 2 - max - min; h *= 60; } else { @@ -11356,12 +11370,12 @@ })(1); function numberArray(a, b) { - if (!b) b = []; + if (!b) { b = []; } var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; return function(t) { - for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; + for (i = 0; i < n; ++i) { c[i] = a[i] * (1 - t) + b[i] * t; } return c; }; } @@ -11377,11 +11391,11 @@ c = new Array(nb), i; - for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); - for (; i < nb; ++i) c[i] = b[i]; + for (i = 0; i < na; ++i) { x[i] = interpolate(a[i], b[i]); } + for (; i < nb; ++i) { c[i] = b[i]; } return function(t) { - for (i = 0; i < na; ++i) c[i] = x[i](t); + for (i = 0; i < na; ++i) { c[i] = x[i](t); } return c; }; } @@ -11404,8 +11418,8 @@ c = {}, k; - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; + if (a === null || typeof a !== "object") { a = {}; } + if (b === null || typeof b !== "object") { b = {}; } for (k in b) { if (k in a) { @@ -11416,7 +11430,7 @@ } return function(t) { - for (k in i) c[k] = i[k](t); + for (k in i) { c[k] = i[k](t); } return c; }; } @@ -11453,12 +11467,12 @@ && (bm = reB.exec(b))) { if ((bs = bm.index) > bi) { // a string precedes the next number in b bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; + if (s[i]) { s[i] += bs; } // coalesce with previous string + else { s[++i] = bs; } } if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; + if (s[i]) { s[i] += bm; } // coalesce with previous string + else { s[++i] = bm; } } else { // interpolate non-matching numbers s[++i] = null; q.push({i: i, x: d3_interpolateNumber(am, bm)}); @@ -11469,8 +11483,8 @@ // Add remains of b. if (bi < b.length) { bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; + if (s[i]) { s[i] += bs; } // coalesce with previous string + else { s[++i] = bs; } } // Special optimization for only a single match. @@ -11479,7 +11493,7 @@ ? one(q[0].x) : zero(b)) : (b = q.length, function(t) { - for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + for (var i = 0, o; i < b; ++i) { s[(o = q[i]).i] = o.x(t); } return s.join(""); }); } @@ -11516,10 +11530,10 @@ function decompose(a, b, c, d, e, f) { var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; + if (scaleX = Math.sqrt(a * a + b * b)) { a /= scaleX, b /= scaleX; } + if (skewX = a * c + b * d) { c -= a * skewX, d -= b * skewX; } + if (scaleY = Math.sqrt(c * c + d * d)) { c /= scaleY, d /= scaleY, skewX /= scaleY; } + if (a * d < b * c) { a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; } return { translateX: e, translateY: f, @@ -11536,8 +11550,8 @@ svgNode; function parseCss(value) { - if (value === "none") return identity$1; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; + if (value === "none") { return identity$1; } + if (!cssNode) { cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; } cssNode.style.transform = value; value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); cssRoot.removeChild(cssNode); @@ -11546,10 +11560,10 @@ } function parseSvg(value) { - if (value == null) return identity$1; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + if (value == null) { return identity$1; } + if (!svgNode) { svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); } svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1; + if (!(value = svgNode.transform.baseVal.consolidate())) { return identity$1; } value = value.matrix; return decompose(value.a, value.b, value.c, value.d, value.e, value.f); } @@ -11571,7 +11585,7 @@ function rotate(a, b, s, q) { if (a !== b) { - if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path + if (a - b > 180) { b += 360; } else if (b - a > 180) { a += 360; } // shortest path q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: d3_interpolateNumber(a, b)}); } else if (b) { s.push(pop(s) + "rotate(" + b + degParen); @@ -11606,7 +11620,7 @@ a = b = null; // gc return function(t) { var i = -1, n = q.length, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); + while (++i < n) { s[(o = q[i]).i] = o.x(t); } return s.join(""); }; }; @@ -11682,7 +11696,7 @@ function d3_quantize(interpolator, n) { var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + for (var i = 0; i < n; ++i) { samples[i] = interpolator(i / (n - 1)); } return samples; } @@ -11715,11 +11729,11 @@ Timer.prototype = timer.prototype = { constructor: Timer, restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); + if (typeof callback !== "function") { throw new TypeError("callback is not a function"); } time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; + if (taskTail) { taskTail._next = this; } + else { taskHead = this; } taskTail = this; } this._call = callback; @@ -11746,7 +11760,7 @@ ++frame; // Pretend we’ve set an alarm, if we haven’t already. var t = taskHead, e; while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); + if ((e = clockNow - t._time) >= 0) { t._call.call(null, e); } t = t._next; } --frame; @@ -11766,14 +11780,14 @@ function poke() { var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; + if (delay > pokeDelay) { clockSkew -= delay, clockLast = now; } } function nap() { var t0, t1 = taskHead, t2, time = Infinity; while (t1) { if (t1._call) { - if (time > t1._time) time = t1._time; + if (time > t1._time) { time = t1._time; } t0 = t1, t1 = t1._next; } else { t2 = t1._next, t1._next = null; @@ -11785,14 +11799,14 @@ } function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); + if (frame) { return; } // Soonest alarm already set, or will be. + if (timeout) { timeout = clearTimeout(timeout); } var delay = time - clockNow; // Strictly less than if we recomputed clockNow. if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); + if (time < Infinity) { timeout = setTimeout(wake, time - clock.now() - clockSkew); } + if (interval) { interval = clearInterval(interval); } } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); + if (!interval) { clockLast = clock.now(), interval = setInterval(poke, pokeDelay); } frame = 1, setFrame(wake); } } @@ -11820,8 +11834,8 @@ function schedule(node, name, id, index, group, timing) { var schedules = node.__transition; - if (!schedules) node.__transition = {}; - else if (id in schedules) return; + if (!schedules) { node.__transition = {}; } + else if (id in schedules) { return; } create$7(node, id, { name: name, index: index, // For context during callback. @@ -11839,19 +11853,19 @@ function init(node, id) { var schedule = get$2(node, id); - if (schedule.state > CREATED) throw new Error("too late; already scheduled"); + if (schedule.state > CREATED) { throw new Error("too late; already scheduled"); } return schedule; } function set$1(node, id) { var schedule = get$2(node, id); - if (schedule.state > STARTED) throw new Error("too late; already running"); + if (schedule.state > STARTED) { throw new Error("too late; already running"); } return schedule; } function get$2(node, id) { var schedule = node.__transition; - if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found"); + if (!schedule || !(schedule = schedule[id])) { throw new Error("transition not found"); } return schedule; } @@ -11869,23 +11883,23 @@ self.timer.restart(start, self.delay, self.time); // If the elapsed delay is less than our first sleep, start immediately. - if (self.delay <= elapsed) start(elapsed - self.delay); + if (self.delay <= elapsed) { start(elapsed - self.delay); } } function start(elapsed) { var i, j, n, o; // If the state is not SCHEDULED, then we previously errored on start. - if (self.state !== SCHEDULED) return stop(); + if (self.state !== SCHEDULED) { return stop(); } for (i in schedules) { o = schedules[i]; - if (o.name !== self.name) continue; + if (o.name !== self.name) { continue; } // While this element already has a starting transition during this frame, // defer starting an interrupting transition until that transition has a // chance to tick (and possibly end); see d3/d3-transition#54! - if (o.state === STARTED) return d3_timeout(start); + if (o.state === STARTED) { return d3_timeout(start); } // Interrupt the active transition, if any. if (o.state === RUNNING) { @@ -11920,7 +11934,7 @@ // Note this must be done before the tween are initialized. self.state = STARTING; self.on.call("start", node, node.__data__, self.index, self.group); - if (self.state !== STARTING) return; // interrupted + if (self.state !== STARTING) { return; } // interrupted self.state = STARTED; // Initialize the tween, deleting null tween. @@ -11953,7 +11967,7 @@ self.state = ENDED; self.timer.stop(); delete schedules[id]; - for (var i in schedules) return; // eslint-disable-line no-unused-vars + for (var i in schedules) { return; } // eslint-disable-line no-unused-vars delete node.__transition; } } @@ -11965,7 +11979,7 @@ empty = true, i; - if (!schedules) return; + if (!schedules) { return; } name = name == null ? null : name + ""; @@ -11978,7 +11992,7 @@ delete schedules[i]; } - if (empty) delete node.__transition; + if (empty) { delete node.__transition; } } function selection_interrupt(name) { @@ -12013,7 +12027,7 @@ function tweenFunction(id, name, value) { var tween0, tween1; - if (typeof value !== "function") throw new Error; + if (typeof value !== "function") { throw new Error; } return function() { var schedule = set$1(this, id), tween = schedule.tween; @@ -12029,7 +12043,7 @@ break; } } - if (i === n) tween1.push(t); + if (i === n) { tween1.push(t); } } schedule.tween = tween1; @@ -12117,7 +12131,7 @@ interpolate0; return function() { var string0, value1 = value(this), string1; - if (value1 == null) return void this.removeAttribute(name); + if (value1 == null) { return void this.removeAttribute(name); } string0 = this.getAttribute(name); string1 = value1 + ""; return string0 === string1 ? null @@ -12132,7 +12146,7 @@ interpolate0; return function() { var string0, value1 = value(this), string1; - if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); + if (value1 == null) { return void this.removeAttributeNS(fullname.space, fullname.local); } string0 = this.getAttributeNS(fullname.space, fullname.local); string1 = value1 + ""; return string0 === string1 ? null @@ -12165,7 +12179,7 @@ var t0, i0; function tween() { var i = value.apply(this, arguments); - if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i); + if (i !== i0) { t0 = (i0 = i) && attrInterpolateNS(fullname, i); } return t0; } tween._value = value; @@ -12176,7 +12190,7 @@ var t0, i0; function tween() { var i = value.apply(this, arguments); - if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i); + if (i !== i0) { t0 = (i0 = i) && attrInterpolate(name, i); } return t0; } tween._value = value; @@ -12185,9 +12199,9 @@ function transition_attrTween(name, value) { var key = "attr." + name; - if (arguments.length < 2) return (key = this.tween(key)) && key._value; - if (value == null) return this.tween(key, null); - if (typeof value !== "function") throw new Error; + if (arguments.length < 2) { return (key = this.tween(key)) && key._value; } + if (value == null) { return this.tween(key, null); } + if (typeof value !== "function") { throw new Error; } var fullname = namespace(name); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); } @@ -12237,7 +12251,7 @@ } function easeConstant(id, value) { - if (typeof value !== "function") throw new Error; + if (typeof value !== "function") { throw new Error; } return function() { set$1(this, id).ease = value; }; @@ -12252,7 +12266,7 @@ } function transition_filter(match) { - if (typeof match !== "function") match = matcher(match); + if (typeof match !== "function") { match = matcher(match); } for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { @@ -12266,7 +12280,7 @@ } function transition_merge(transition) { - if (transition._id !== this._id) throw new Error; + if (transition._id !== this._id) { throw new Error; } for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { @@ -12286,7 +12300,7 @@ function start(name) { return (name + "").trim().split(/^|\s+/).every(function(t) { var i = t.indexOf("."); - if (i >= 0) t = t.slice(0, i); + if (i >= 0) { t = t.slice(0, i); } return !t || t === "start"; }); } @@ -12300,7 +12314,7 @@ // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we’re done! // Otherwise, copy-on-write. - if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener); + if (on !== on0) { (on1 = (on0 = on).copy()).on(name, listener); } schedule.on = on1; }; @@ -12317,8 +12331,8 @@ function removeFunction(id) { return function() { var parent = this.parentNode; - for (var i in this.__transition) if (+i !== id) return; - if (parent) parent.removeChild(this); + for (var i in this.__transition) { if (+i !== id) { return; } } + if (parent) { parent.removeChild(this); } }; } @@ -12330,12 +12344,12 @@ var name = this._name, id = this._id; - if (typeof select !== "function") select = selector(select); + if (typeof select !== "function") { select = selector(select); } for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { - if ("__data__" in node) subnode.__data__ = node.__data__; + if ("__data__" in node) { subnode.__data__ = node.__data__; } subgroup[i] = subnode; schedule(subgroup[i], name, id, i, subgroup, get$2(node, id)); } @@ -12349,7 +12363,7 @@ var name = this._name, id = this._id; - if (typeof select !== "function") select = selectorAll(select); + if (typeof select !== "function") { select = selectorAll(select); } for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { @@ -12413,7 +12427,7 @@ var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + ""; - if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name)); + if (value1 == null) { string1 = value1 = (this.style.removeProperty(name), styleValue(this, name)); } return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); @@ -12430,7 +12444,7 @@ // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we’re done! // Otherwise, copy-on-write. - if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener); + if (on !== on0 || listener0 !== listener) { (on1 = (on0 = on).copy()).on(event, listener0 = listener); } schedule.on = on1; }; @@ -12459,7 +12473,7 @@ var t, i0; function tween() { var i = value.apply(this, arguments); - if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority); + if (i !== i0) { t = (i0 = i) && styleInterpolate(name, i, priority); } return t; } tween._value = value; @@ -12468,9 +12482,9 @@ function transition_styleTween(name, value, priority) { var key = "style." + (name += ""); - if (arguments.length < 2) return (key = this.tween(key)) && key._value; - if (value == null) return this.tween(key, null); - if (typeof value !== "function") throw new Error; + if (arguments.length < 2) { return (key = this.tween(key)) && key._value; } + if (value == null) { return this.tween(key, null); } + if (typeof value !== "function") { throw new Error; } return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); } @@ -12503,7 +12517,7 @@ var t0, i0; function tween() { var i = value.apply(this, arguments); - if (i !== i0) t0 = (i0 = i) && textInterpolate(i); + if (i !== i0) { t0 = (i0 = i) && textInterpolate(i); } return t0; } tween._value = value; @@ -12512,9 +12526,9 @@ function transition_textTween(value) { var key = "text"; - if (arguments.length < 1) return (key = this.tween(key)) && key._value; - if (value == null) return this.tween(key, null); - if (typeof value !== "function") throw new Error; + if (arguments.length < 1) { return (key = this.tween(key)) && key._value; } + if (value == null) { return this.tween(key, null); } + if (typeof value !== "function") { throw new Error; } return this.tween(key, textTween(value)); } @@ -12544,7 +12558,7 @@ var on0, on1, that = this, id = that._id, size = that.size(); return new Promise(function(resolve, reject) { var cancel = {value: reject}, - end = {value: function() { if (--size === 0) resolve(); }}; + end = {value: function() { if (--size === 0) { resolve(); } }}; that.each(function() { var schedule = set$1(this, id), @@ -12884,7 +12898,7 @@ b = typeof transform === "function" ? transform.apply(that, args) : transform, i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k)); return function(t) { - if (t === 1) t = b; // Avoid rounding error on end. + if (t === 1) { t = b; } // Avoid rounding error on end. else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); } g.zoom(null, t); }; @@ -12912,9 +12926,9 @@ return this; }, zoom: function(key, transform) { - if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]); - if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]); - if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]); + if (this.mouse && key !== "mouse") { this.mouse[1] = transform.invert(this.mouse[0]); } + if (this.touch0 && key !== "touch") { this.touch0[1] = transform.invert(this.touch0[0]); } + if (this.touch1 && key !== "touch") { this.touch1[1] = transform.invert(this.touch1[0]); } this.that.__zoom = transform; this.emit("zoom"); return this; @@ -12932,7 +12946,7 @@ }; function wheeled() { - if (!filter.apply(this, arguments)) return; + if (!filter.apply(this, arguments)) { return; } var g = gesture(this, arguments), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), @@ -12948,7 +12962,7 @@ } // If this wheel event won’t trigger a transform change, ignore it. - else if (t.k === k) return; + else if (t.k === k) { return; } // Otherwise, capture the mouse point and location at the start. else { @@ -12968,7 +12982,7 @@ } function mousedowned() { - if (touchending || !filter.apply(this, arguments)) return; + if (touchending || !filter.apply(this, arguments)) { return; } var g = gesture(this, arguments, true), v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = mouse(this), @@ -12999,7 +13013,7 @@ } function dblclicked() { - if (!filter.apply(this, arguments)) return; + if (!filter.apply(this, arguments)) { return; } var t0 = this.__zoom, p0 = mouse(this), p1 = t0.invert(p0), @@ -13007,12 +13021,12 @@ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent); noevent$1(); - if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0); - else select(this).call(zoom.transform, t1); + if (duration > 0) { select(this).transition().duration(duration).call(schedule, t1, p0); } + else { select(this).call(zoom.transform, t1); } } function touchstarted() { - if (!filter.apply(this, arguments)) return; + if (!filter.apply(this, arguments)) { return; } var touches = event.touches, n = touches.length, g = gesture(this, arguments, event.changedTouches.length === n), @@ -13022,32 +13036,32 @@ for (i = 0; i < n; ++i) { t = touches[i], p = touch(this, touches, t.identifier); p = [p, this.__zoom.invert(p), t.identifier]; - if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting; - else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0; + if (!g.touch0) { g.touch0 = p, started = true, g.taps = 1 + !!touchstarting; } + else if (!g.touch1 && g.touch0[2] !== p[2]) { g.touch1 = p, g.taps = 0; } } - if (touchstarting) touchstarting = clearTimeout(touchstarting); + if (touchstarting) { touchstarting = clearTimeout(touchstarting); } if (started) { - if (g.taps < 2) touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay); + if (g.taps < 2) { touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay); } interrupt(this); g.start(); } } function touchmoved() { - if (!this.__zooming) return; + if (!this.__zooming) { return; } var g = gesture(this, arguments), touches = event.changedTouches, n = touches.length, i, t, p, l; noevent$1(); - if (touchstarting) touchstarting = clearTimeout(touchstarting); + if (touchstarting) { touchstarting = clearTimeout(touchstarting); } g.taps = 0; for (i = 0; i < n; ++i) { t = touches[i], p = touch(this, touches, t.identifier); - if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p; - else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p; + if (g.touch0 && g.touch0[2] === t.identifier) { g.touch0[0] = p; } + else if (g.touch1 && g.touch1[2] === t.identifier) { g.touch1[0] = p; } } t = g.that.__zoom; if (g.touch1) { @@ -13059,33 +13073,33 @@ p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2]; l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; } - else if (g.touch0) p = g.touch0[0], l = g.touch0[1]; - else return; + else if (g.touch0) { p = g.touch0[0], l = g.touch0[1]; } + else { return; } g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent)); } function touchended() { - if (!this.__zooming) return; + if (!this.__zooming) { return; } var g = gesture(this, arguments), touches = event.changedTouches, n = touches.length, i, t; nopropagation$1(); - if (touchending) clearTimeout(touchending); + if (touchending) { clearTimeout(touchending); } touchending = setTimeout(function() { touchending = null; }, touchDelay); for (i = 0; i < n; ++i) { t = touches[i]; - if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0; - else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1; + if (g.touch0 && g.touch0[2] === t.identifier) { delete g.touch0; } + else if (g.touch1 && g.touch1[2] === t.identifier) { delete g.touch1; } } - if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1; - if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]); + if (g.touch1 && !g.touch0) { g.touch0 = g.touch1, delete g.touch1; } + if (g.touch0) { g.touch0[1] = this.__zoom.invert(g.touch0[0]); } else { g.end(); // If this was a dbltap, reroute to the (optional) dblclick.zoom handler. if (g.taps === 2) { var p = select(this).on("dblclick.zoom"); - if (p) p.apply(this, arguments); + if (p) { p.apply(this, arguments); } } } } @@ -13165,14 +13179,14 @@ projection.scale = function(_) { - if (!arguments.length) return k; + if (!arguments.length) { return k; } k = +_; return projection; }; projection.translate = function(_) { - if (!arguments.length) return [x, y]; + if (!arguments.length) { return [x, y]; } x = +_[0]; y = +_[1]; return projection; @@ -13180,14 +13194,14 @@ projection.clipExtent = function(_) { - if (!arguments.length) return clipExtent; + if (!arguments.length) { return clipExtent; } clipExtent = _; return projection; }; projection.transform = function(obj) { - if (!arguments.length) return identity$2.translate(x, y).scale(k); + if (!arguments.length) { return identity$2.translate(x, y).scale(k); } x = +obj.x; y = +obj.y; k = +obj.k; @@ -13243,7 +13257,7 @@ var b = coords[(i + 1) % coords.length]; var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon, lowerThreshold, upperThreshold); - if (dotp === null) continue; // ignore vertex + if (dotp === null) { continue; } // ignore vertex score = score + 2.0 * Math.min(Math.abs(dotp - 1.0), Math.min(Math.abs(dotp), Math.abs(dotp + 1))); } @@ -13265,14 +13279,14 @@ var angle = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI; - if (angle > 45) angle = 90 - angle; + if (angle > 45) { angle = 90 - angle; } - if (angle >= lessThan) continue; + if (angle >= lessThan) { continue; } - if (angle > max) max = angle; + if (angle > max) { max = angle; } } - if (max === -Infinity) return null; + if (max === -Infinity) { return null; } return max; } @@ -13293,8 +13307,8 @@ var b = coords[(i + 1) % coords.length]; var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon, lowerThreshold, upperThreshold, allowStraightAngles); - if (dotp === null) continue; // ignore vertex - if (Math.abs(dotp) > 0) return 1; // something to do + if (dotp === null) { continue; } // ignore vertex + if (Math.abs(dotp) > 0) { return 1; } // something to do score = 0; // already square } @@ -13304,12 +13318,12 @@ // Returns true if a and b have the same elements at the same indices. function utilArrayIdentical(a, b) { // an array is always identical to itself - if (a === b) return true; + if (a === b) { return true; } var i = a.length; - if (i !== b.length) return false; + if (i !== b.length) { return false; } while (i--) { - if (a[i] !== b[i]) return false; + if (a[i] !== b[i]) { return false; } } return true; } @@ -13366,7 +13380,7 @@ // utilArrayChunk(a, 3); // [[1,2,3],[4,5,6],[7]]; function utilArrayChunk(a, chunkSize) { - if (!chunkSize || chunkSize < 0) return [a.slice()]; + if (!chunkSize || chunkSize < 0) { return [a.slice()]; } var result = new Array(Math.ceil(a.length / chunkSize)); return Array.from(result, function(item, i) { @@ -13777,7 +13791,7 @@ var isArabic_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); - const arabicBlocks = [ + var arabicBlocks = [ [0x0600, 0x06FF], [0x0750, 0x077F], [0x08A0, 0x08FF], @@ -13792,9 +13806,9 @@ // allow the newer chars? throw new Error('isArabic works on only one-character strings'); } - let code = char.charCodeAt(0); - for (let i = 0; i < arabicBlocks.length; i++) { - let block = arabicBlocks[i]; + var code = char.charCodeAt(0); + for (var i = 0; i < arabicBlocks.length; i++) { + var block = arabicBlocks[i]; if (code >= block[0] && code <= block[1]) { return true; } @@ -13807,7 +13821,7 @@ // allow the newer chars? throw new Error('isMath works on only one-character strings'); } - let code = char.charCodeAt(0); + var code = char.charCodeAt(0); return ((code >= 0x660 && code <= 0x66C) || (code >= 0x6F0 && code <= 0x6F9)); } exports.isMath = isMath; @@ -13815,7 +13829,7 @@ var unicodeArabic = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); - const arabicReference = { + var arabicReference = { "alef": { "normal": [ "\u0627" @@ -14908,7 +14922,7 @@ var unicodeLigatures = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); - const ligatureReference = { + var ligatureReference = { "\u0626\u0627": { "isolated": "\uFBEA", "final": "\uFBEB" @@ -15934,15 +15948,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); - const letterList = Object.keys(unicodeArabic.default); + var letterList = Object.keys(unicodeArabic.default); exports.letterList = letterList; - const ligatureList = Object.keys(unicodeLigatures.default); + var ligatureList = Object.keys(unicodeLigatures.default); exports.ligatureList = ligatureList; - const ligatureWordList = Object.keys(unicodeLigatures.default.words); + var ligatureWordList = Object.keys(unicodeLigatures.default.words); exports.ligatureWordList = ligatureWordList; - const lams = '\u0644\u06B5\u06B6\u06B7\u06B8'; + var lams = '\u0644\u06B5\u06B6\u06B7\u06B8'; exports.lams = lams; - const alefs = '\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774'; + var alefs = '\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774'; exports.alefs = alefs; // for (var l = 1; l < lams.length; l++) { // console.log('-'); @@ -15950,7 +15964,7 @@ // console.log(a + ': ' + lams[l] + alefs[a]); // } // } - let tashkeel = '\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8'; + var tashkeel = '\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8'; exports.tashkeel = tashkeel; function addToTashkeel(start, finish) { for (var i = start; i <= finish; i++) { @@ -15965,7 +15979,7 @@ addToTashkeel(0x08D3, 0x08E1); addToTashkeel(0x08E3, 0x08FF); addToTashkeel(0xFE70, 0xFE7F); - let lineBreakers = '\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9'; + var lineBreakers = '\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9'; exports.lineBreakers = lineBreakers; function addToLineBreakers(start, finish) { for (var i = start; i <= finish; i++) { @@ -15996,9 +16010,9 @@ function GlyphSplitter(word) { - let letters = []; - let lastLetter = ''; - word.split('').forEach((letter) => { + var letters = []; + var lastLetter = ''; + word.split('').forEach(function (letter) { if (isArabic_1.isArabic(letter)) { if (reference.tashkeel.indexOf(letter) > -1) { letters[letters.length - 1] += letter; @@ -16028,9 +16042,9 @@ function BaselineSplitter(word) { - let letters = []; - let lastLetter = ''; - word.split('').forEach((letter) => { + var letters = []; + var lastLetter = ''; + word.split('').forEach(function (letter) { if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) { if (lastLetter.length && reference.tashkeel.indexOf(letter) > -1) { letters[letters.length - 1] += letter; @@ -16066,23 +16080,23 @@ if (typeof breakPresentationForm === 'undefined') { breakPresentationForm = true; } - let returnable = ''; - word.split('').forEach((letter) => { + var returnable = ''; + word.split('').forEach(function (letter) { if (!isArabic_1.isArabic(letter)) { returnable += letter; return; } - for (let w = 0; w < reference.letterList.length; w++) { + for (var w = 0; w < reference.letterList.length; w++) { // ok so we are checking this potential lettertron - let letterForms = unicodeArabic.default[reference.letterList[w]]; - let versions = Object.keys(letterForms); - for (let v = 0; v < versions.length; v++) { - let localVersion = letterForms[versions[v]]; + var letterForms = unicodeArabic.default[reference.letterList[w]]; + var versions = Object.keys(letterForms); + for (var v = 0; v < versions.length; v++) { + var localVersion = letterForms[versions[v]]; if (typeof localVersion === 'object' && typeof localVersion.indexOf === 'undefined') { // look at this embedded object - let embeddedForms = Object.keys(localVersion); - for (let ef = 0; ef < embeddedForms.length; ef++) { - let form = localVersion[embeddedForms[ef]]; + var embeddedForms = Object.keys(localVersion); + for (var ef = 0; ef < embeddedForms.length; ef++) { + var form = localVersion[embeddedForms[ef]]; if (form === letter || (typeof form === 'object' && form.indexOf && form.indexOf(letter) > -1)) { // match // console.log('embedded match'); @@ -16138,11 +16152,11 @@ } } // try ligatures - for (let v2 = 0; v2 < reference.ligatureList.length; v2++) { - let normalForm = reference.ligatureList[v2]; + for (var v2 = 0; v2 < reference.ligatureList.length; v2++) { + var normalForm = reference.ligatureList[v2]; if (normalForm !== 'words') { - let ligForms = Object.keys(unicodeLigatures.default[normalForm]); - for (let f = 0; f < ligForms.length; f++) { + var ligForms = Object.keys(unicodeLigatures.default[normalForm]); + for (var f = 0; f < ligForms.length; f++) { if (unicodeLigatures.default[normalForm][ligForms[f]] === letter) { returnable += normalForm; return; @@ -16151,10 +16165,10 @@ } } // try words ligatures - for (let v3 = 0; v3 < reference.ligatureWordList.length; v3++) { - let normalForm = reference.ligatureWordList[v3]; - if (unicodeLigatures.default.words[normalForm] === letter) { - returnable += normalForm; + for (var v3 = 0; v3 < reference.ligatureWordList.length; v3++) { + var normalForm$1 = reference.ligatureWordList[v3]; + if (unicodeLigatures.default.words[normalForm$1] === letter) { + returnable += normalForm$1; return; } } @@ -16180,12 +16194,12 @@ // hamza alone return "\u0621"; } - for (let w = 0; w < reference.letterList.length; w++) { + for (var w = 0; w < reference.letterList.length; w++) { // ok so we are checking this potential lettertron - let letterForms = unicodeArabic.default[reference.letterList[w]]; - let versions = Object.keys(letterForms); - for (let v = 0; v < versions.length; v++) { - let localVersion = letterForms[versions[v]]; + var letterForms = unicodeArabic.default[reference.letterList[w]]; + var versions = Object.keys(letterForms); + for (var v = 0; v < versions.length; v++) { + var localVersion = letterForms[versions[v]]; if ((localVersion === letter) || (typeof localVersion === 'object' && localVersion.indexOf && localVersion.indexOf(letter) > -1)) { if (versions.indexOf(form) > -1) { @@ -16194,8 +16208,8 @@ } else if (typeof localVersion === 'object' && typeof localVersion.indexOf === 'undefined') { // check embedded - let embeddedVersions = Object.keys(localVersion); - for (let ev = 0; ev < embeddedVersions.length; ev++) { + var embeddedVersions = Object.keys(localVersion); + for (var ev = 0; ev < embeddedVersions.length; ev++) { if ((localVersion[embeddedVersions[ev]] === letter) || (typeof localVersion[embeddedVersions[ev]] === 'object' && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1)) { if (embeddedVersions.indexOf(form) > -1) { @@ -16217,11 +16231,11 @@ function WordShaper(word) { - let state = 'initial'; - let output = ''; - for (let w = 0; w < word.length; w++) { - let nextLetter = ' '; - for (let nxw = w + 1; nxw < word.length; nxw++) { + var state = 'initial'; + var output = ''; + for (var w = 0; w < word.length; w++) { + var nextLetter = ' '; + for (var nxw = w + 1; nxw < word.length; nxw++) { if (!isArabic_1.isArabic(word[nxw])) { break; } @@ -16271,17 +16285,17 @@ if (!isArabic_1.isArabic(letter)) { throw new Error('Not an Arabic letter'); } - for (let w = 0; w < reference.letterList.length; w++) { + for (var w = 0; w < reference.letterList.length; w++) { // ok so we are checking this potential lettertron - let letterForms = unicodeArabic.default[reference.letterList[w]]; - let versions = Object.keys(letterForms); - for (let v = 0; v < versions.length; v++) { - let localVersion = letterForms[versions[v]]; + var letterForms = unicodeArabic.default[reference.letterList[w]]; + var versions = Object.keys(letterForms); + for (var v = 0; v < versions.length; v++) { + var localVersion = letterForms[versions[v]]; if (typeof localVersion === 'object' && typeof localVersion.indexOf === 'undefined') { // look at this embedded object - let embeddedForms = Object.keys(localVersion); - for (let ef = 0; ef < embeddedForms.length; ef++) { - let form = localVersion[embeddedForms[ef]]; + var embeddedForms = Object.keys(localVersion); + for (var ef = 0; ef < embeddedForms.length; ef++) { + var form = localVersion[embeddedForms[ef]]; if (form === letter || (typeof form === 'object' && form.indexOf && form.indexOf(letter) > -1)) { // match return localVersion; @@ -16301,17 +16315,17 @@ if (!isArabic_1.isArabic(letter)) { throw new Error('Not an Arabic letter'); } - for (let w = 0; w < reference.letterList.length; w++) { + for (var w = 0; w < reference.letterList.length; w++) { // ok so we are checking this potential lettertron - let letterForms = unicodeArabic.default[reference.letterList[w]]; - let versions = Object.keys(letterForms); - for (let v = 0; v < versions.length; v++) { - let localVersion = letterForms[versions[v]]; + var letterForms = unicodeArabic.default[reference.letterList[w]]; + var versions = Object.keys(letterForms); + for (var v = 0; v < versions.length; v++) { + var localVersion = letterForms[versions[v]]; if (typeof localVersion === 'object' && typeof localVersion.indexOf === 'undefined') { // look at this embedded object - let embeddedForms = Object.keys(localVersion); - for (let ef = 0; ef < embeddedForms.length; ef++) { - let form = localVersion[embeddedForms[ef]]; + var embeddedForms = Object.keys(localVersion); + for (var ef = 0; ef < embeddedForms.length; ef++) { + var form = localVersion[embeddedForms[ef]]; if (form === letter || (typeof form === 'object' && form.indexOf && form.indexOf(letter) > -1)) { // match return letterForms; @@ -16399,14 +16413,14 @@ // https://github.com/openstreetmap/iD/issues/772 // http://mathiasbynens.be/notes/localstorage-pattern#comment-9 - let _storage; + var _storage; try { _storage = localStorage; } catch (e) {} // eslint-disable-line no-empty - _storage = _storage || (() => { - let s = {}; + _storage = _storage || (function () { + var s = {}; return { - getItem: (k) => s[k], - setItem: (k, v) => s[k] = v, - removeItem: (k) => delete s[k] + getItem: function (k) { return s[k]; }, + setItem: function (k, v) { return s[k] = v; }, + removeItem: function (k) { return delete s[k]; } }; })(); @@ -16417,9 +16431,9 @@ function corePreferences(k, v) { try { - if (arguments.length === 1) return _storage.getItem(k); - else if (v === null) _storage.removeItem(k); - else _storage.setItem(k, v); + if (arguments.length === 1) { return _storage.getItem(k); } + else if (v === null) { _storage.removeItem(k); } + else { _storage.setItem(k, v); } } catch (e) { /* eslint-disable no-console */ if (typeof console !== 'undefined') { @@ -16431,7 +16445,7 @@ } function responseText(response) { - if (!response.ok) throw new Error(response.status + " " + response.statusText); + if (!response.ok) { throw new Error(response.status + " " + response.statusText); } return response.text(); } @@ -16440,8 +16454,8 @@ } function responseJson(response) { - if (!response.ok) throw new Error(response.status + " " + response.statusText); - if (response.status === 204 || response.status === 205) return; + if (!response.ok) { throw new Error(response.status + " " + response.statusText); } + if (response.status === 204 || response.status === 205) { return; } return response.json(); } @@ -16461,15 +16475,15 @@ var svg = parser("image/svg+xml"); - let _mainFileFetcher = coreFileFetcher(); // singleton + var _mainFileFetcher = coreFileFetcher(); // singleton // // coreFileFetcher asynchronously fetches data from JSON files // function coreFileFetcher() { - let _this = {}; - let _inflight = {}; - let _fileMap = { + var _this = {}; + var _inflight = {}; + var _fileMap = { 'address_formats': 'data/address_formats.min.json', 'deprecated': 'data/deprecated.min.json', 'discarded': 'data/discarded.min.json', @@ -16493,36 +16507,36 @@ 'wmf_sitematrix': 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@0.1/wikipedia.min.json' }; - let _cachedData = {}; + var _cachedData = {}; // expose the cache; useful for tests - _this.cache = () => _cachedData; + _this.cache = function () { return _cachedData; }; // Returns a Promise to fetch data // (resolved with the data if we have it already) - _this.get = (which) => { + _this.get = function (which) { if (_cachedData[which]) { return Promise.resolve(_cachedData[which]); } - const file = _fileMap[which]; - const url = file && _this.asset(file); + var file = _fileMap[which]; + var url = file && _this.asset(file); if (!url) { - return Promise.reject(`Unknown data file for "${which}"`); + return Promise.reject(("Unknown data file for \"" + which + "\"")); } - let prom = _inflight[url]; + var prom = _inflight[url]; if (!prom) { _inflight[url] = prom = d3_json(url) - .then(result => { + .then(function (result) { delete _inflight[url]; if (!result) { - throw new Error(`No data loaded for "${which}"`); + throw new Error(("No data loaded for \"" + which + "\"")); } _cachedData[which] = result; return result; }) - .catch(err => { + .catch(function (err) { delete _inflight[url]; throw err; }); @@ -16534,42 +16548,42 @@ // Accessor for the file map _this.fileMap = function(val) { - if (!arguments.length) return _fileMap; + if (!arguments.length) { return _fileMap; } _fileMap = val; return _this; }; - let _assetPath = ''; + var _assetPath = ''; _this.assetPath = function(val) { - if (!arguments.length) return _assetPath; + if (!arguments.length) { return _assetPath; } _assetPath = val; return _this; }; - let _assetMap = {}; + var _assetMap = {}; _this.assetMap = function(val) { - if (!arguments.length) return _assetMap; + if (!arguments.length) { return _assetMap; } _assetMap = val; return _this; }; - _this.asset = (val) => { - if (/^http(s)?:\/\//i.test(val)) return val; - const filename = _assetPath + val; + _this.asset = function (val) { + if (/^http(s)?:\/\//i.test(val)) { return val; } + var filename = _assetPath + val; return _assetMap[filename] || filename; }; return _this; } - let _detected; + var _detected; function utilDetect(refresh) { - if (_detected && !refresh) return _detected; + if (_detected && !refresh) { return _detected; } _detected = {}; - const ua = navigator.userAgent; - let m = null; + var ua = navigator.userAgent; + var m = null; /* Browser */ m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i); // Edge @@ -16597,7 +16611,7 @@ _detected.browser = m[1]; _detected.version = m[2]; m = ua.match(/version\/([\.\d]+)/i); - if (m !== null) _detected.version = m[1]; + if (m !== null) { _detected.version = m[1]; } } } if (!_detected.browser) { @@ -16667,8 +16681,8 @@ /* Host */ - const loc = window.top.location; - let origin = loc.origin; + var loc = window.top.location; + var origin = loc.origin; if (!origin) { // for unpatched IE11 origin = loc.protocol + '//' + loc.hostname + (loc.port ? ':' + loc.port: ''); } @@ -17477,32 +17491,32 @@ // To generate a random key: window.crypto.getRandomValues(new Uint8Array(16)); // This default signing key is built into iD and can be used to mask/unmask sensitive values. - const DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208]; + var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208]; function utilAesEncrypt(text, key) { key = key || DEFAULT_128; - const textBytes = aesJs.utils.utf8.toBytes(text); - const aesCtr = new aesJs.ModeOfOperation.ctr(key); - const encryptedBytes = aesCtr.encrypt(textBytes); - const encryptedHex = aesJs.utils.hex.fromBytes(encryptedBytes); + var textBytes = aesJs.utils.utf8.toBytes(text); + var aesCtr = new aesJs.ModeOfOperation.ctr(key); + var encryptedBytes = aesCtr.encrypt(textBytes); + var encryptedHex = aesJs.utils.hex.fromBytes(encryptedBytes); return encryptedHex; } function utilAesDecrypt(encryptedHex, key) { key = key || DEFAULT_128; - const encryptedBytes = aesJs.utils.hex.toBytes(encryptedHex); - const aesCtr = new aesJs.ModeOfOperation.ctr(key); - const decryptedBytes = aesCtr.decrypt(encryptedBytes); - const text = aesJs.utils.utf8.fromBytes(decryptedBytes); + var encryptedBytes = aesJs.utils.hex.toBytes(encryptedHex); + var aesCtr = new aesJs.ModeOfOperation.ctr(key); + var decryptedBytes = aesCtr.decrypt(encryptedBytes); + var text = aesJs.utils.utf8.fromBytes(decryptedBytes); return text; } function utilCleanTags(tags) { var out = {}; for (var k in tags) { - if (!k) continue; + if (!k) { continue; } var v = tags[k]; if (v !== undefined) { out[k] = cleanValue(k, v); @@ -17521,7 +17535,7 @@ return /^(description|note|fixme)$/.test(k); } - if (skip(k)) return v; + if (skip(k)) { return v; } var cleaned = v .split(';') @@ -17595,8 +17609,8 @@ // priority match shifted keybindings first for (i = 0; i < bindings.length; i++) { binding = bindings[i]; - if (!binding.event.modifiers.shiftKey) continue; // no shift - if (!!binding.capture !== isCapturing) continue; + if (!binding.event.modifiers.shiftKey) { continue; } // no shift + if (!!binding.capture !== isCapturing) { continue; } if (matches(binding, true)) { binding.callback(); didMatch = true; @@ -17604,11 +17618,11 @@ } // then unshifted keybindings - if (didMatch) return; + if (didMatch) { return; } for (i = 0; i < bindings.length; i++) { binding = bindings[i]; - if (binding.event.modifiers.shiftKey) continue; // shift - if (!!binding.capture !== isCapturing) continue; + if (binding.event.modifiers.shiftKey) { continue; } // shift + if (!!binding.capture !== isCapturing) { continue; } if (matches(binding, false)) { binding.callback(); } @@ -17629,10 +17643,10 @@ isMatch = false; } else if (Array.isArray(binding.event.key)) { if (binding.event.key.map(function(s) { return s.toLowerCase(); }).indexOf(event$1.key.toLowerCase()) === -1) - isMatch = false; + { isMatch = false; } } else { if (event$1.key.toLowerCase() !== binding.event.key.toLowerCase()) - isMatch = false; + { isMatch = false; } } } @@ -17643,15 +17657,15 @@ isMatch = (event$1.keyCode === binding.event.keyCode); } - if (!isMatch) return false; + if (!isMatch) { return false; } // test modifier keys if (!(event$1.ctrlKey && event$1.altKey)) { // if both are set, assume AltGr and skip it - #4096 - if (event$1.ctrlKey !== binding.event.modifiers.ctrlKey) return false; - if (event$1.altKey !== binding.event.modifiers.altKey) return false; + if (event$1.ctrlKey !== binding.event.modifiers.ctrlKey) { return false; } + if (event$1.altKey !== binding.event.modifiers.altKey) { return false; } } - if (event$1.metaKey !== binding.event.modifiers.metaKey) return false; - if (testShift && event$1.shiftKey !== binding.event.modifiers.shiftKey) return false; + if (event$1.metaKey !== binding.event.modifiers.metaKey) { return false; } + if (testShift && event$1.shiftKey !== binding.event.modifiers.shiftKey) { return false; } return true; } @@ -17742,7 +17756,7 @@ var matches = arr[i].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g); for (var j = 0; j < matches.length; j++) { // Normalise matching errors - if (matches[j] === '++') matches[j] = '+'; + if (matches[j] === '++') { matches[j] = '+'; } if (matches[j] in utilKeybinding.modifierCodes) { var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j]]]; @@ -17997,9 +18011,11 @@ // Copies a variable number of methods from source to target. function utilRebind(target, source) { + var arguments$1 = arguments; + var i = 1, n = arguments.length, method; while (++i < n) { - target[method = arguments[i]] = d3_rebind(target, source, source[method]); + target[method = arguments$1[i]] = d3_rebind(target, source, source[method]); } return target; } @@ -18030,16 +18046,16 @@ } mutex.lock = function () { - if (intervalID) return true; + if (intervalID) { return true; } var cookie = document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + name + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1'); - if (cookie) return false; + if (cookie) { return false; } renew(); intervalID = window.setInterval(renew, 4000); return true; }; mutex.unlock = function () { - if (!intervalID) return; + if (!intervalID) { return; } document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict'; clearInterval(intervalID); intervalID = null; @@ -18187,35 +18203,35 @@ tiler.tileSize = function(val) { - if (!arguments.length) return _tileSize; + if (!arguments.length) { return _tileSize; } _tileSize = val; return tiler; }; tiler.zoomExtent = function(val) { - if (!arguments.length) return _zoomExtent; + if (!arguments.length) { return _zoomExtent; } _zoomExtent = val; return tiler; }; tiler.size = function(val) { - if (!arguments.length) return _size; + if (!arguments.length) { return _size; } _size = val; return tiler; }; tiler.scale = function(val) { - if (!arguments.length) return _scale; + if (!arguments.length) { return _scale; } _scale = val; return tiler; }; tiler.translate = function(val) { - if (!arguments.length) return _translate; + if (!arguments.length) { return _translate; } _translate = val; return tiler; }; @@ -18223,14 +18239,14 @@ // number to extend the rows/columns beyond those covering the viewport tiler.margin = function(val) { - if (!arguments.length) return _margin; + if (!arguments.length) { return _margin; } _margin = +val; return tiler; }; tiler.skipNullIsland = function(val) { - if (!arguments.length) return _skipNullIsland; + if (!arguments.length) { return _skipNullIsland; } _skipNullIsland = val; return tiler; }; @@ -18247,17 +18263,17 @@ }); } - let _mainLocalizer = coreLocalizer(); // singleton - let _t = _mainLocalizer.t; + var _mainLocalizer = coreLocalizer(); // singleton + var _t = _mainLocalizer.t; // // coreLocalizer manages language and locale parameters including translated strings // function coreLocalizer() { - let localizer = {}; + var localizer = {}; - let _dataLanguages = {}; + var _dataLanguages = {}; // `localeData` is an object containing all _supported_ locale codes -> language info. // { @@ -18265,7 +18281,7 @@ // de: { rtl: false, languageNames: {…}, scriptNames: {…} }, // … // } - let _dataLocales = {}; + var _dataLocales = {}; // `localeStrings` is an object containing all _loaded_ locale codes -> string data. // { @@ -18273,30 +18289,30 @@ // de: { icons: {…}, toolbar: {…}, modes: {…}, operations: {…}, … }, // … // } - let _localeStrings = {}; + var _localeStrings = {}; // the current locale parameters - let _localeCode = 'en-US'; - let _languageCode = 'en'; - let _textDirection = 'ltr'; - let _usesMetric = false; - let _languageNames = {}; - let _scriptNames = {}; + var _localeCode = 'en-US'; + var _languageCode = 'en'; + var _textDirection = 'ltr'; + var _usesMetric = false; + var _languageNames = {}; + var _scriptNames = {}; // getters for the current locale parameters - localizer.localeCode = () => _localeCode; - localizer.languageCode = () => _languageCode; - localizer.textDirection = () => _textDirection; - localizer.usesMetric = () => _usesMetric; - localizer.languageNames = () => _languageNames; - localizer.scriptNames = () => _scriptNames; + localizer.localeCode = function () { return _localeCode; }; + localizer.languageCode = function () { return _languageCode; }; + localizer.textDirection = function () { return _textDirection; }; + localizer.usesMetric = function () { return _usesMetric; }; + localizer.languageNames = function () { return _languageNames; }; + localizer.scriptNames = function () { return _scriptNames; }; // The client app may want to manually set the locale, regardless of the // settings provided by the browser - let _preferredLocaleCodes = []; + var _preferredLocaleCodes = []; localizer.preferredLocaleCodes = function(codes) { - if (!arguments.length) return _preferredLocaleCodes; + if (!arguments.length) { return _preferredLocaleCodes; } if (typeof codes === 'string') { // be generous and accept delimited strings as input _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean); @@ -18309,9 +18325,9 @@ var _loadPromise; - localizer.ensureLoaded = () => { + localizer.ensureLoaded = function () { - if (_loadPromise) return _loadPromise; + if (_loadPromise) { return _loadPromise; } return _loadPromise = Promise.all([ // load the list of langauges @@ -18319,12 +18335,12 @@ // load the list of supported locales _mainFileFetcher.get('locales') ]) - .then(results => { + .then(function (results) { _dataLanguages = results[0]; _dataLocales = results[1]; }) - .then(() => { - let requestedLocales = (_preferredLocaleCodes || []) + .then(function () { + var requestedLocales = (_preferredLocaleCodes || []) // list of locales preferred by the browser in priority order .concat(utilDetect().browserLocales); _localeCode = bestSupportedLocale(requestedLocales); @@ -18336,52 +18352,58 @@ localizer.loadLocale(_localeCode) ]); }) - .then(() => { + .then(function () { updateForCurrentLocale(); }) - .catch(err => console.error(err)); // eslint-disable-line + .catch(function (err) { return console.error(err); }); // eslint-disable-line }; // Returns the best locale from `locales` supported by iD, if any function bestSupportedLocale(locales) { - let supportedLocales = _dataLocales; + var supportedLocales = _dataLocales; - for (let i in locales) { - let locale = locales[i]; + var loop = function ( i ) { + var locale = locales[i]; if (locale.includes('-')) { // full locale ('es-ES') - if (supportedLocales[locale]) return locale; + if (supportedLocales[locale]) { return { v: locale }; } // If full locale not supported ('es-FAKE'), fallback to the base ('es') - let langPart = locale.split('-')[0]; - if (supportedLocales[langPart]) return langPart; + var langPart = locale.split('-')[0]; + if (supportedLocales[langPart]) { return { v: langPart }; } } else { // base locale ('es') // prefer a lower-priority full locale with this base ('es' < 'es-ES') - let fullLocale = locales.find((locale2, index) => { + var fullLocale = locales.find(function (locale2, index) { return index > i && locale2 !== locale && locale2.split('-')[0] === locale && supportedLocales[locale2]; }); - if (fullLocale) return fullLocale; + if (fullLocale) { return { v: fullLocale }; } - if (supportedLocales[locale]) return locale; + if (supportedLocales[locale]) { return { v: locale }; } } + }; + + for (var i in locales) { + var returned = loop( i ); + + if ( returned ) return returned.v; } return null; } function updateForCurrentLocale() { - if (!_localeCode) return; + if (!_localeCode) { return; } _languageCode = _localeCode.split('-')[0]; - const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode]; + var currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode]; - const hash = utilStringQs(window.location.hash); + var hash = utilStringQs(window.location.hash); if (hash.rtl === 'true') { _textDirection = 'rtl'; @@ -18400,31 +18422,31 @@ /* Locales */ // Returns a Promise to load the strings for the requested locale - localizer.loadLocale = (requested) => { + localizer.loadLocale = function (requested) { if (!_dataLocales) { return Promise.reject('loadLocale called before init'); } - let locale = requested; + var locale = requested; // US English is the default - if (locale.toLowerCase() === 'en-us') locale = 'en'; + if (locale.toLowerCase() === 'en-us') { locale = 'en'; } if (!_dataLocales[locale]) { - return Promise.reject(`Unsupported locale: ${requested}`); + return Promise.reject(("Unsupported locale: " + requested)); } if (_localeStrings[locale]) { // already loaded return Promise.resolve(locale); } - let fileMap = _mainFileFetcher.fileMap(); - const key = `locale_${locale}`; - fileMap[key] = `locales/${locale}.json`; + var fileMap = _mainFileFetcher.fileMap(); + var key = "locale_" + locale; + fileMap[key] = "locales/" + locale + ".json"; return _mainFileFetcher.get(key) - .then(d => { + .then(function (d) { _localeStrings[locale] = d[locale]; return locale; }); @@ -18444,14 +18466,14 @@ locale = locale || _localeCode; // US English is the default - if (locale.toLowerCase() === 'en-us') locale = 'en'; + if (locale.toLowerCase() === 'en-us') { locale = 'en'; } - let path = s + var path = s .split('.') - .map(s => s.replace(//g, '.')) + .map(function (s) { return s.replace(//g, '.'); }) .reverse(); - let result = _localeStrings[locale]; + var result = _localeStrings[locale]; while (result !== undefined && path.length) { result = result[path.pop()]; @@ -18459,9 +18481,9 @@ if (result !== undefined) { if (replacements) { - for (let k in replacements) { - const token = `{${k}}`; - const regex = new RegExp(token, 'g'); + for (var k in replacements) { + var token = "{" + k + "}"; + var regex = new RegExp(token, 'g'); result = result.replace(regex, replacements[k]); } } @@ -18476,13 +18498,13 @@ return replacements.default; // fallback - replacements.default } - const missing = `Missing ${locale} translation: ${s}`; - if (typeof console !== 'undefined') console.error(missing); // eslint-disable-line + var missing = "Missing " + locale + " translation: " + s; + if (typeof console !== 'undefined') { console.error(missing); } // eslint-disable-line return missing; }; - localizer.languageName = (code, options) => { + localizer.languageName = function (code, options) { if (_languageNames[code]) { // name in locale langauge // e.g. "German" @@ -18490,20 +18512,20 @@ } // sometimes we only want the local name - if (options && options.localOnly) return null; + if (options && options.localOnly) { return null; } - const langInfo = _dataLanguages[code]; + var langInfo = _dataLanguages[code]; if (langInfo) { if (langInfo.nativeName) { // name in native language // e.g. "Deutsch (de)" return localizer.t('translate.language_and_code', { language: langInfo.nativeName, code: code }); } else if (langInfo.base && langInfo.script) { - const base = langInfo.base; // the code of the langauge this is based on + var base = langInfo.base; // the code of the langauge this is based on if (_languageNames[base]) { // base language name in locale langauge - const scriptCode = langInfo.script; - const script = _scriptNames[scriptCode] || scriptCode; + var scriptCode = langInfo.script; + var script = _scriptNames[scriptCode] || scriptCode; // e.g. "Serbian (Cyrillic)" return localizer.t('translate.language_and_code', { language: _languageNames[base], code: script }); @@ -18524,134 +18546,134 @@ // and decorated with some extra methods for searching and matching geometry // function presetCollection(collection) { - const MAXRESULTS = 50; - let _this = {}; - let _memo = {}; + var MAXRESULTS = 50; + var _this = {}; + var _memo = {}; _this.collection = collection; - _this.item = (id) => { - if (_memo[id]) return _memo[id]; - const found = _this.collection.find(d => d.id === id); - if (found) _memo[id] = found; + _this.item = function (id) { + if (_memo[id]) { return _memo[id]; } + var found = _this.collection.find(function (d) { return d.id === id; }); + if (found) { _memo[id] = found; } return found; }; - _this.index = (id) => _this.collection.findIndex(d => d.id === id); + _this.index = function (id) { return _this.collection.findIndex(function (d) { return d.id === id; }); }; - _this.matchGeometry = (geometry) => { + _this.matchGeometry = function (geometry) { return presetCollection( - _this.collection.filter(d => d.matchGeometry(geometry)) + _this.collection.filter(function (d) { return d.matchGeometry(geometry); }) ); }; - _this.matchAllGeometry = (geometries) => { + _this.matchAllGeometry = function (geometries) { return presetCollection( - _this.collection.filter(d => d && d.matchAllGeometry(geometries)) + _this.collection.filter(function (d) { return d && d.matchAllGeometry(geometries); }) ); }; - _this.matchAnyGeometry = (geometries) => { + _this.matchAnyGeometry = function (geometries) { return presetCollection( - _this.collection.filter(d => geometries.some(geom => d.matchGeometry(geom))) + _this.collection.filter(function (d) { return geometries.some(function (geom) { return d.matchGeometry(geom); }); }) ); }; - _this.fallback = (geometry) => { - let id = geometry; - if (id === 'vertex') id = 'point'; + _this.fallback = function (geometry) { + var id = geometry; + if (id === 'vertex') { id = 'point'; } return _this.item(id); }; - _this.search = (value, geometry, countryCode) => { - if (!value) return _this; + _this.search = function (value, geometry, countryCode) { + if (!value) { return _this; } value = value.toLowerCase().trim(); // match at name beginning or just after a space (e.g. "office" -> match "Law Office") function leading(a) { - const index = a.indexOf(value); + var index = a.indexOf(value); return index === 0 || a[index - 1] === ' '; } // match at name beginning only function leadingStrict(a) { - const index = a.indexOf(value); + var index = a.indexOf(value); return index === 0; } function sortNames(a, b) { - let aCompare = (a.suggestion ? a.originalName : a.name()).toLowerCase(); - let bCompare = (b.suggestion ? b.originalName : b.name()).toLowerCase(); + var aCompare = (a.suggestion ? a.originalName : a.name()).toLowerCase(); + var bCompare = (b.suggestion ? b.originalName : b.name()).toLowerCase(); // priority if search string matches preset name exactly - #4325 - if (value === aCompare) return -1; - if (value === bCompare) return 1; + if (value === aCompare) { return -1; } + if (value === bCompare) { return 1; } // priority for higher matchScore - let i = b.originalScore - a.originalScore; - if (i !== 0) return i; + var i = b.originalScore - a.originalScore; + if (i !== 0) { return i; } // priority if search string appears earlier in preset name i = aCompare.indexOf(value) - bCompare.indexOf(value); - if (i !== 0) return i; + if (i !== 0) { return i; } // priority for shorter preset names return aCompare.length - bCompare.length; } - let pool = _this.collection; + var pool = _this.collection; if (countryCode) { - pool = pool.filter(a => { - if (a.countryCodes && a.countryCodes.indexOf(countryCode) === -1) return false; - if (a.notCountryCodes && a.notCountryCodes.indexOf(countryCode) !== -1) return false; + pool = pool.filter(function (a) { + if (a.countryCodes && a.countryCodes.indexOf(countryCode) === -1) { return false; } + if (a.notCountryCodes && a.notCountryCodes.indexOf(countryCode) !== -1) { return false; } return true; }); } - const searchable = pool.filter(a => a.searchable !== false && a.suggestion !== true); - const suggestions = pool.filter(a => a.suggestion === true); + var searchable = pool.filter(function (a) { return a.searchable !== false && a.suggestion !== true; }); + var suggestions = pool.filter(function (a) { return a.suggestion === true; }); // matches value to preset.name - const leading_name = searchable - .filter(a => leading(a.name().toLowerCase())) + var leading_name = searchable + .filter(function (a) { return leading(a.name().toLowerCase()); }) .sort(sortNames); // matches value to preset suggestion name (original name is unhyphenated) - const leading_suggestions = suggestions - .filter(a => leadingStrict(a.originalName.toLowerCase())) + var leading_suggestions = suggestions + .filter(function (a) { return leadingStrict(a.originalName.toLowerCase()); }) .sort(sortNames); // matches value to preset.terms values - const leading_terms = searchable - .filter(a => (a.terms() || []).some(leading)); + var leading_terms = searchable + .filter(function (a) { return (a.terms() || []).some(leading); }); // matches value to preset.tags values - const leading_tag_values = searchable - .filter(a => Object.values(a.tags || {}).filter(val => val !== '*').some(leading)); + var leading_tag_values = searchable + .filter(function (a) { return Object.values(a.tags || {}).filter(function (val) { return val !== '*'; }).some(leading); }); // finds close matches to value in preset.name - const similar_name = searchable - .map(a => ({ preset: a, dist: utilEditDistance(value, a.name()) })) - .filter(a => a.dist + Math.min(value.length - a.preset.name().length, 0) < 3) - .sort((a, b) => a.dist - b.dist) - .map(a => a.preset); + var similar_name = searchable + .map(function (a) { return ({ preset: a, dist: utilEditDistance(value, a.name()) }); }) + .filter(function (a) { return a.dist + Math.min(value.length - a.preset.name().length, 0) < 3; }) + .sort(function (a, b) { return a.dist - b.dist; }) + .map(function (a) { return a.preset; }); // finds close matches to value to preset suggestion name (original name is unhyphenated) - const similar_suggestions = suggestions - .map(a => ({ preset: a, dist: utilEditDistance(value, a.originalName.toLowerCase()) })) - .filter(a => a.dist + Math.min(value.length - a.preset.originalName.length, 0) < 1) - .sort((a, b) => a.dist - b.dist) - .map(a => a.preset); + var similar_suggestions = suggestions + .map(function (a) { return ({ preset: a, dist: utilEditDistance(value, a.originalName.toLowerCase()) }); }) + .filter(function (a) { return a.dist + Math.min(value.length - a.preset.originalName.length, 0) < 1; }) + .sort(function (a, b) { return a.dist - b.dist; }) + .map(function (a) { return a.preset; }); // finds close matches to value in preset.terms - const similar_terms = searchable - .filter(a => { - return (a.terms() || []).some(b => { + var similar_terms = searchable + .filter(function (a) { + return (a.terms() || []).some(function (b) { return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3; }); }); - let results = leading_name.concat( + var results = leading_name.concat( leading_suggestions, leading_terms, leading_tag_values, @@ -18664,7 +18686,7 @@ if (typeof geometry === 'string') { results.push(_this.fallback(geometry)); } else { - geometry.forEach(geom => results.push(_this.fallback(geom))); + geometry.forEach(function (geom) { return results.push(_this.fallback(geom)); }); } } @@ -18680,18 +18702,18 @@ // decorated with some extra methods for searching and matching geometry // function presetCategory(categoryID, category, all) { - let _this = Object.assign({}, category); // shallow copy + var _this = Object.assign({}, category); // shallow copy _this.id = categoryID; _this.members = presetCollection( - category.members.map(presetID => all.item(presetID)).filter(Boolean) + category.members.map(function (presetID) { return all.item(presetID); }).filter(Boolean) ); _this.geometry = _this.members.collection - .reduce((acc, preset) => { - for (let i in preset.geometry) { - const geometry = preset.geometry[i]; + .reduce(function (acc, preset) { + for (var i in preset.geometry) { + var geometry = preset.geometry[i]; if (acc.indexOf(geometry) === -1) { acc.push(geometry); } @@ -18699,16 +18721,16 @@ return acc; }, []); - _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0; + _this.matchGeometry = function (geom) { return _this.geometry.indexOf(geom) >= 0; }; - _this.matchAllGeometry = (geometries) => _this.members.collection - .some(preset => preset.matchAllGeometry(geometries)); + _this.matchAllGeometry = function (geometries) { return _this.members.collection + .some(function (preset) { return preset.matchAllGeometry(geometries); }); }; - _this.matchScore = () => -1; + _this.matchScore = function () { return -1; }; - _this.name = () => _t(`presets.categories.${categoryID}.name`, { 'default': categoryID }); + _this.name = function () { return _t(("presets.categories." + categoryID + ".name"), { 'default': categoryID }); }; - _this.terms = () => []; + _this.terms = function () { return []; }; return _this; @@ -18719,30 +18741,30 @@ // with some extra methods for searching and matching geometry // function presetField(fieldID, field) { - let _this = Object.assign({}, field); // shallow copy + var _this = Object.assign({}, field); // shallow copy _this.id = fieldID; // for use in classes, element ids, css selectors _this.safeid = utilSafeClassName(fieldID); - _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1; + _this.matchGeometry = function (geom) { return !_this.geometry || _this.geometry.indexOf(geom) !== -1; }; - _this.matchAllGeometry = (geometries) => { - return !_this.geometry || geometries.every(geom => _this.geometry.indexOf(geom) !== -1); + _this.matchAllGeometry = function (geometries) { + return !_this.geometry || geometries.every(function (geom) { return _this.geometry.indexOf(geom) !== -1; }); }; - _this.t = (scope, options) => _t(`presets.fields.${fieldID}.${scope}`, options); + _this.t = function (scope, options) { return _t(("presets.fields." + fieldID + "." + scope), options); }; - _this.label = () => _this.overrideLabel || _this.t('label', { 'default': fieldID }); + _this.label = function () { return _this.overrideLabel || _this.t('label', { 'default': fieldID }); }; - const _placeholder = _this.placeholder; - _this.placeholder = () => _this.t('placeholder', { 'default': _placeholder }); + var _placeholder = _this.placeholder; + _this.placeholder = function () { return _this.t('placeholder', { 'default': _placeholder }); }; _this.originalTerms = (_this.terms || []).join(); - _this.terms = () => _this.t('terms', { 'default': _this.originalTerms }) - .toLowerCase().trim().split(/\s*,+\s*/); + _this.terms = function () { return _this.t('terms', { 'default': _this.originalTerms }) + .toLowerCase().trim().split(/\s*,+\s*/); }; return _this; @@ -18755,10 +18777,10 @@ function presetPreset(presetID, preset, addable, allFields, allPresets) { allFields = allFields || {}; allPresets = allPresets || {}; - let _this = Object.assign({}, preset); // shallow copy - let _addable = addable || false; - let _resolvedFields; // cache - let _resolvedMoreFields; // cache + var _this = Object.assign({}, preset); // shallow copy + var _addable = addable || false; + var _resolvedFields; // cache + var _resolvedMoreFields; // cache _this.id = presetID; @@ -18776,11 +18798,11 @@ _this.originalMoreFields = (_this.moreFields || []); - _this.fields = () => _resolvedFields || (_resolvedFields = resolve('fields')); + _this.fields = function () { return _resolvedFields || (_resolvedFields = resolve('fields')); }; - _this.moreFields = () => _resolvedMoreFields || (_resolvedMoreFields = resolve('moreFields')); + _this.moreFields = function () { return _resolvedMoreFields || (_resolvedMoreFields = resolve('moreFields')); }; - _this.resetFields = () => _resolvedFields = _resolvedMoreFields = null; + _this.resetFields = function () { return _resolvedFields = _resolvedMoreFields = null; }; _this.tags = _this.tags || {}; @@ -18790,17 +18812,17 @@ _this.geometry = (_this.geometry || []); - _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0; + _this.matchGeometry = function (geom) { return _this.geometry.indexOf(geom) >= 0; }; - _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry); + _this.matchAllGeometry = function (geoms) { return geoms.every(_this.matchGeometry); }; - _this.matchScore = (entityTags) => { - const tags = _this.tags; - let seen = {}; - let score = 0; + _this.matchScore = function (entityTags) { + var tags = _this.tags; + var seen = {}; + var score = 0; // match on tags - for (let k in tags) { + for (var k in tags) { seen[k] = true; if (entityTags[k] === tags[k]) { score += _this.originalScore; @@ -18812,9 +18834,9 @@ } // boost score for additional matches in addTags - #6802 - const addTags = _this.addTags; - for (let k in addTags) { - if (!seen[k] && entityTags[k] === addTags[k]) { + var addTags = _this.addTags; + for (var k$1 in addTags) { + if (!seen[k$1] && entityTags[k$1] === addTags[k$1]) { score += _this.originalScore; } } @@ -18823,17 +18845,17 @@ }; - let _textCache = {}; - _this.t = (scope, options) => { - const textID = `presets.presets.${presetID}.${scope}`; - if (_textCache[textID]) return _textCache[textID]; + var _textCache = {}; + _this.t = function (scope, options) { + var textID = "presets.presets." + presetID + "." + scope; + if (_textCache[textID]) { return _textCache[textID]; } return _textCache[textID] = _t(textID, options); }; - _this.name = () => { + _this.name = function () { if (_this.suggestion) { - let path = presetID.split('/'); + var path = presetID.split('/'); path.pop(); // remove brand name // NOTE: insert an en-dash, not a hypen (to avoid conflict with fr - nl names in Brussels etc) return _this.originalName + ' – ' + _t('presets.presets.' + path.join('/') + '.name'); @@ -18842,33 +18864,33 @@ }; - _this.terms = () => _this.t('terms', { 'default': _this.originalTerms }) - .toLowerCase().trim().split(/\s*,+\s*/); + _this.terms = function () { return _this.t('terms', { 'default': _this.originalTerms }) + .toLowerCase().trim().split(/\s*,+\s*/); }; - _this.isFallback = () => { - const tagCount = Object.keys(_this.tags).length; + _this.isFallback = function () { + var tagCount = Object.keys(_this.tags).length; return tagCount === 0 || (tagCount === 1 && _this.tags.hasOwnProperty('area')); }; _this.addable = function(val) { - if (!arguments.length) return _addable; + if (!arguments.length) { return _addable; } _addable = val; return _this; }; - _this.reference = (geom) => { + _this.reference = function (geom) { // Lookup documentation on Wikidata... - const qid = _this.tags.wikidata || _this.tags['brand:wikidata'] || _this.tags['operator:wikidata']; + var qid = _this.tags.wikidata || _this.tags['brand:wikidata'] || _this.tags['operator:wikidata']; if (qid) { return { qid: qid }; } // Lookup documentation on OSM Wikibase... - let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, 'name'))[0]; - let value = _this.originalReference.value || _this.tags[key]; + var key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, 'name'))[0]; + var value = _this.originalReference.value || _this.tags[key]; if (geom === 'relation' && key === 'type') { if (value in _this.tags) { @@ -18887,11 +18909,11 @@ }; - _this.unsetTags = (tags, geometry, skipFieldDefaults) => { + _this.unsetTags = function (tags, geometry, skipFieldDefaults) { tags = utilObjectOmit(tags, Object.keys(_this.removeTags)); if (geometry && !skipFieldDefaults) { - _this.fields().forEach(field => { + _this.fields().forEach(function (field) { if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key]) { delete tags[field.key]; } @@ -18903,11 +18925,11 @@ }; - _this.setTags = (tags, geometry, skipFieldDefaults) => { - const addTags = _this.addTags; + _this.setTags = function (tags, geometry, skipFieldDefaults) { + var addTags = _this.addTags; tags = Object.assign({}, tags); // shallow copy - for (let k in addTags) { + for (var k in addTags) { if (addTags[k] === '*') { tags[k] = 'yes'; } else { @@ -18922,10 +18944,10 @@ if (!addTags.hasOwnProperty('area')) { delete tags.area; if (geometry === 'area') { - let needsAreaTag = true; + var needsAreaTag = true; if (_this.geometry.indexOf('line') === -1) { - for (let k in addTags) { - if (k in osmAreaKeys) { + for (var k$1 in addTags) { + if (k$1 in osmAreaKeys) { needsAreaTag = false; break; } @@ -18938,7 +18960,7 @@ } if (geometry && !skipFieldDefaults) { - _this.fields().forEach(field => { + _this.fields().forEach(function (field) { if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) { tags[field.key] = field.default; } @@ -18952,24 +18974,24 @@ // For a preset without fields, use the fields of the parent preset. // Replace {preset} placeholders with the fields of the specified presets. function resolve(which) { - const fieldIDs = (which === 'fields' ? _this.originalFields : _this.originalMoreFields); - let resolved = []; + var fieldIDs = (which === 'fields' ? _this.originalFields : _this.originalMoreFields); + var resolved = []; - fieldIDs.forEach(fieldID => { - const match = fieldID.match(/\{(.*)\}/); + fieldIDs.forEach(function (fieldID) { + var match = fieldID.match(/\{(.*)\}/); if (match !== null) { // a presetID wrapped in braces {} resolved = resolved.concat(inheritFields(match[1], which)); } else if (allFields[fieldID]) { // a normal fieldID resolved.push(allFields[fieldID]); } else { - console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`); // eslint-disable-line no-console + console.log(("Cannot resolve \"" + fieldID + "\" found in " + (_this.id) + "." + which)); // eslint-disable-line no-console } }); // no fields resolved, so use the parent's if possible if (!resolved.length) { - const endIndex = _this.id.lastIndexOf('/'); - const parentID = endIndex && _this.id.substring(0, endIndex); + var endIndex = _this.id.lastIndexOf('/'); + var parentID = endIndex && _this.id.substring(0, endIndex); if (parentID) { resolved = inheritFields(parentID, which); } @@ -18980,8 +19002,8 @@ // returns an array of fields to inherit from the given presetID, if found function inheritFields(presetID, which) { - const parent = allPresets[presetID]; - if (!parent) return []; + var parent = allPresets[presetID]; + if (!parent) { return []; } if (which === 'fields') { return parent.fields().filter(shouldInherit); @@ -18999,7 +19021,7 @@ if (f.key && _this.tags[f.key] !== undefined && // inherit anyway if multiple values are allowed or just a checkbox f.type !== 'multiCombo' && f.type !== 'semiCombo' && f.type !== 'check' - ) return false; + ) { return false; } return true; } @@ -19009,26 +19031,26 @@ return _this; } - let _mainPresetIndex = presetIndex(); // singleton + var _mainPresetIndex = presetIndex(); // singleton // // `presetIndex` wraps a `presetCollection` // with methods for loading new data and returning defaults // function presetIndex() { - const dispatch$1 = dispatch('favoritePreset', 'recentsChange'); - const MAXRECENTS = 30; + var dispatch$1 = dispatch('favoritePreset', 'recentsChange'); + var MAXRECENTS = 30; // seed the preset lists with geometry fallbacks - const POINT = presetPreset('point', { name: 'Point', tags: {}, geometry: ['point', 'vertex'], matchScore: 0.1 } ); - const LINE = presetPreset('line', { name: 'Line', tags: {}, geometry: ['line'], matchScore: 0.1 } ); - const AREA = presetPreset('area', { name: 'Area', tags: { area: 'yes' }, geometry: ['area'], matchScore: 0.1 } ); - const RELATION = presetPreset('relation', { name: 'Relation', tags: {}, geometry: ['relation'], matchScore: 0.1 } ); + var POINT = presetPreset('point', { name: 'Point', tags: {}, geometry: ['point', 'vertex'], matchScore: 0.1 } ); + var LINE = presetPreset('line', { name: 'Line', tags: {}, geometry: ['line'], matchScore: 0.1 } ); + var AREA = presetPreset('area', { name: 'Area', tags: { area: 'yes' }, geometry: ['area'], matchScore: 0.1 } ); + var RELATION = presetPreset('relation', { name: 'Relation', tags: {}, geometry: ['relation'], matchScore: 0.1 } ); - let _this = presetCollection([POINT, LINE, AREA, RELATION]); - let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION }; + var _this = presetCollection([POINT, LINE, AREA, RELATION]); + var _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION }; - let _defaults = { + var _defaults = { point: presetCollection([POINT]), vertex: presetCollection([POINT]), line: presetCollection([LINE]), @@ -19036,20 +19058,20 @@ relation: presetCollection([RELATION]) }; - let _fields = {}; - let _categories = {}; - let _universal = []; - let _addablePresetIDs = null; // Set of preset IDs that the user can add - let _recents; - let _favorites; + var _fields = {}; + var _categories = {}; + var _universal = []; + var _addablePresetIDs = null; // Set of preset IDs that the user can add + var _recents; + var _favorites; // Index of presets by (geometry, tag key). - let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} }; + var _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} }; - let _loadPromise; + var _loadPromise; - _this.ensureLoaded = () => { - if (_loadPromise) return _loadPromise; + _this.ensureLoaded = function () { + if (_loadPromise) { return _loadPromise; } return _loadPromise = Promise.all([ _mainFileFetcher.get('preset_categories'), @@ -19057,7 +19079,7 @@ _mainFileFetcher.get('preset_presets'), _mainFileFetcher.get('preset_fields') ]) - .then(vals => { + .then(function (vals) { _this.merge({ categories: vals[0], defaults: vals[1], @@ -19071,11 +19093,11 @@ }; - _this.merge = (d) => { + _this.merge = function (d) { // Merge Fields if (d.fields) { - Object.keys(d.fields).forEach(fieldID => { - const f = d.fields[fieldID]; + Object.keys(d.fields).forEach(function (fieldID) { + var f = d.fields[fieldID]; if (f) { // add or replace _fields[fieldID] = presetField(fieldID, f); } else { // remove @@ -19086,13 +19108,13 @@ // Merge Presets if (d.presets) { - Object.keys(d.presets).forEach(presetID => { - const p = d.presets[presetID]; + Object.keys(d.presets).forEach(function (presetID) { + var p = d.presets[presetID]; if (p) { // add or replace - const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID); + var isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID); _presets[presetID] = presetPreset(presetID, p, isAddable, _fields, _presets); } else { // remove (but not if it's a fallback) - const existing = _presets[presetID]; + var existing = _presets[presetID]; if (existing && !existing.isFallback()) { delete _presets[presetID]; } @@ -19105,8 +19127,8 @@ // Merge Categories if (d.categories) { - Object.keys(d.categories).forEach(categoryID => { - const c = d.categories[categoryID]; + Object.keys(d.categories).forEach(function (categoryID) { + var c = d.categories[categoryID]; if (c) { // add or replace _categories[categoryID] = presetCategory(categoryID, c, _this); } else { // remove @@ -19120,11 +19142,11 @@ // Merge Defaults if (d.defaults) { - Object.keys(d.defaults).forEach(geometry => { - const def = d.defaults[geometry]; + Object.keys(d.defaults).forEach(function (geometry) { + var def = d.defaults[geometry]; if (Array.isArray(def)) { // add or replace _defaults[geometry] = presetCollection( - def.map(id => _presets[id] || _categories[id]).filter(Boolean) + def.map(function (id) { return _presets[id] || _categories[id]; }).filter(Boolean) ); } else { // remove delete _defaults[geometry]; @@ -19133,17 +19155,17 @@ } // Rebuild universal fields array - _universal = Object.values(_fields).filter(field => field.universal); + _universal = Object.values(_fields).filter(function (field) { return field.universal; }); // Reset all the preset fields - they'll need to be resolved again - Object.values(_presets).forEach(preset => preset.resetFields()); + Object.values(_presets).forEach(function (preset) { return preset.resetFields(); }); // Rebuild geometry index _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} }; - _this.collection.forEach(preset => { - (preset.geometry || []).forEach(geometry => { - let g = _geometryIndex[geometry]; - for (let key in preset.tags) { + _this.collection.forEach(function (preset) { + (preset.geometry || []).forEach(function (geometry) { + var g = _geometryIndex[geometry]; + for (var key in preset.tags) { (g[key] = g[key] || []).push(preset); } }); @@ -19153,9 +19175,9 @@ }; - _this.match = (entity, resolver) => { - return resolver.transient(entity, 'presetMatch', () => { - let geometry = entity.geometry(resolver); + _this.match = function (entity, resolver) { + return resolver.transient(entity, 'presetMatch', function () { + var geometry = entity.geometry(resolver); // Treat entities on addr:interpolation lines as points, not vertices - #3241 if (geometry === 'vertex' && entity.isOnAddressLine(resolver)) { geometry = 'point'; @@ -19165,23 +19187,23 @@ }; - _this.matchTags = (tags, geometry) => { - const geometryMatches = _geometryIndex[geometry]; - let address; - let best = -1; - let match; + _this.matchTags = function (tags, geometry) { + var geometryMatches = _geometryIndex[geometry]; + var address; + var best = -1; + var match; - for (let k in tags) { + for (var k in tags) { // If any part of an address is present, allow fallback to "Address" preset - #4353 if (/^addr:/.test(k) && geometryMatches['addr:*']) { address = geometryMatches['addr:*'][0]; } - const keyMatches = geometryMatches[k]; - if (!keyMatches) continue; + var keyMatches = geometryMatches[k]; + if (!keyMatches) { continue; } - for (let i = 0; i < keyMatches.length; i++) { - const score = keyMatches[i].matchScore(tags); + for (var i = 0; i < keyMatches.length; i++) { + var score = keyMatches[i].matchScore(tags); if (score > best) { best = score; match = keyMatches[i]; @@ -19196,17 +19218,17 @@ }; - _this.allowsVertex = (entity, resolver) => { - if (entity.type !== 'node') return false; - if (Object.keys(entity.tags).length === 0) return true; + _this.allowsVertex = function (entity, resolver) { + if (entity.type !== 'node') { return false; } + if (Object.keys(entity.tags).length === 0) { return true; } - return resolver.transient(entity, 'vertexMatch', () => { + return resolver.transient(entity, 'vertexMatch', function () { // address lines allow vertices to act as standalone points - if (entity.isOnAddressLine(resolver)) return true; + if (entity.isOnAddressLine(resolver)) { return true; } - const geometries = osmNodeGeometriesForTags(entity.tags); - if (geometries.vertex) return true; - if (geometries.point) return false; + var geometries = osmNodeGeometriesForTags(entity.tags); + if (geometries.vertex) { return true; } + if (geometries.point) { return false; } // allow vertices for unspecified points return true; }); @@ -19224,20 +19246,20 @@ // with a tag (k, v) is considered to be an area if `k in L && !(v in L[k])` // (see `Way#isArea()`). In other words, the keys of L form the keeplist, // and the subkeys form the discardlist. - _this.areaKeys = () => { + _this.areaKeys = function () { // The ignore list is for keys that imply lines. (We always add `area=yes` for exceptions) - const ignore = ['barrier', 'highway', 'footway', 'railway', 'junction', 'type']; - let areaKeys = {}; + var ignore = ['barrier', 'highway', 'footway', 'railway', 'junction', 'type']; + var areaKeys = {}; // ignore name-suggestion-index and deprecated presets - const presets = _this.collection.filter(p => !p.suggestion && !p.replacement); + var presets = _this.collection.filter(function (p) { return !p.suggestion && !p.replacement; }); // keeplist - presets.forEach(p => { - let key; - for (key in p.tags) break; // pick the first tag - if (!key) return; - if (ignore.indexOf(key) !== -1) return; + presets.forEach(function (p) { + var key; + for (key in p.tags) { break; } // pick the first tag + if (!key) { return; } + if (ignore.indexOf(key) !== -1) { return; } if (p.geometry.indexOf('area') !== -1) { // probably an area.. areaKeys[key] = areaKeys[key] || {}; @@ -19245,11 +19267,11 @@ }); // discardlist - presets.forEach(p => { - let key; + presets.forEach(function (p) { + var key; for (key in p.addTags) { // examine all addTags to get a better sense of what can be tagged on lines - #6800 - const value = p.addTags[key]; + var value = p.addTags[key]; if (key in areaKeys && // probably an area... p.geometry.indexOf('line') !== -1 && // but sometimes a line value !== '*') { @@ -19262,15 +19284,15 @@ }; - _this.pointTags = () => { - return _this.collection.reduce((pointTags, d) => { + _this.pointTags = function () { + return _this.collection.reduce(function (pointTags, d) { // ignore name-suggestion-index, deprecated, and generic presets - if (d.suggestion || d.replacement || d.searchable === false) return pointTags; + if (d.suggestion || d.replacement || d.searchable === false) { return pointTags; } // only care about the primary tag - let key; - for (key in d.tags) break; // pick the first tag - if (!key) return pointTags; + var key; + for (key in d.tags) { break; } // pick the first tag + if (!key) { return pointTags; } // if this can be a point if (d.geometry.indexOf('point') !== -1) { @@ -19282,15 +19304,15 @@ }; - _this.vertexTags = () => { - return _this.collection.reduce((vertexTags, d) => { + _this.vertexTags = function () { + return _this.collection.reduce(function (vertexTags, d) { // ignore name-suggestion-index, deprecated, and generic presets - if (d.suggestion || d.replacement || d.searchable === false) return vertexTags; + if (d.suggestion || d.replacement || d.searchable === false) { return vertexTags; } // only care about the primary tag - let key; - for (key in d.tags) break; // pick the first tag - if (!key) return vertexTags; + var key; + for (key in d.tags) { break; } // pick the first tag + if (!key) { return vertexTags; } // if this can be a vertex if (d.geometry.indexOf('vertex') !== -1) { @@ -19302,21 +19324,21 @@ }; - _this.field = (id) => _fields[id]; + _this.field = function (id) { return _fields[id]; }; - _this.universal = () => _universal; + _this.universal = function () { return _universal; }; - _this.defaults = (geometry, n, startWithRecents) => { - let recents = []; + _this.defaults = function (geometry, n, startWithRecents) { + var recents = []; if (startWithRecents) { recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4); } - let defaults; + var defaults; if (_addablePresetIDs) { defaults = Array.from(_addablePresetIDs).map(function(id) { var preset = _this.item(id); - if (preset && preset.matchGeometry(geometry)) return preset; + if (preset && preset.matchGeometry(geometry)) { return preset; } return null; }).filter(Boolean); } else { @@ -19330,20 +19352,20 @@ // pass a Set of addable preset ids _this.addablePresetIDs = function(val) { - if (!arguments.length) return _addablePresetIDs; + if (!arguments.length) { return _addablePresetIDs; } // accept and convert arrays - if (Array.isArray(val)) val = new Set(val); + if (Array.isArray(val)) { val = new Set(val); } _addablePresetIDs = val; if (_addablePresetIDs) { // reset all presets - _this.collection.forEach(p => { + _this.collection.forEach(function (p) { // categories aren't addable - if (p.addable) p.addable(_addablePresetIDs.has(p.id)); + if (p.addable) { p.addable(_addablePresetIDs.has(p.id)); } }); } else { - _this.collection.forEach(p => { - if (p.addable) p.addable(true); + _this.collection.forEach(function (p) { + if (p.addable) { p.addable(true); } }); } @@ -19351,22 +19373,22 @@ }; - _this.recent = () => { + _this.recent = function () { return presetCollection( - utilArrayUniq(_this.getRecents().map(d => d.preset)) + utilArrayUniq(_this.getRecents().map(function (d) { return d.preset; })) ); }; function RibbonItem(preset, source) { - let item = {}; + var item = {}; item.preset = preset; item.source = source; - item.isFavorite = () => item.source === 'favorite'; - item.isRecent = () => item.source === 'recent'; - item.matches = (preset) => item.preset.id === preset.id; - item.minified = () => ({ pID: item.preset.id }); + item.isFavorite = function () { return item.source === 'favorite'; }; + item.isRecent = function () { return item.source === 'recent'; }; + item.matches = function (preset) { return item.preset.id === preset.id; }; + item.minified = function () { return ({ pID: item.preset.id }); }; return item; } @@ -19374,24 +19396,24 @@ function ribbonItemForMinified(d, source) { if (d && d.pID) { - const preset = _this.item(d.pID); - if (!preset) return null; + var preset = _this.item(d.pID); + if (!preset) { return null; } return RibbonItem(preset, source); } return null; } - _this.getGenericRibbonItems = () => { - return ['point', 'line', 'area'].map(id => RibbonItem(_this.item(id), 'generic')); + _this.getGenericRibbonItems = function () { + return ['point', 'line', 'area'].map(function (id) { return RibbonItem(_this.item(id), 'generic'); }); }; - _this.getAddable = () => { - if (!_addablePresetIDs) return []; + _this.getAddable = function () { + if (!_addablePresetIDs) { return []; } - return _addablePresetIDs.map((id) => { - const preset = _this.item(id); + return _addablePresetIDs.map(function (id) { + var preset = _this.item(id); if (preset) { return RibbonItem(preset, 'addable'); } @@ -19401,19 +19423,19 @@ function setRecents(items) { _recents = items; - const minifiedItems = items.map(d => d.minified()); + var minifiedItems = items.map(function (d) { return d.minified(); }); corePreferences('preset_recents', JSON.stringify(minifiedItems)); dispatch$1.call('recentsChange'); } - _this.getRecents = () => { + _this.getRecents = function () { if (!_recents) { // fetch from local storage _recents = (JSON.parse(corePreferences('preset_recents')) || []) - .reduce((acc, d) => { - let item = ribbonItemForMinified(d, 'recent'); - if (item && item.preset.addable()) acc.push(item); + .reduce(function (acc, d) { + var item = ribbonItemForMinified(d, 'recent'); + if (item && item.preset.addable()) { acc.push(item); } return acc; }, []); } @@ -19421,32 +19443,32 @@ }; - _this.addRecent = (preset, besidePreset, after) => { - const recents = _this.getRecents(); + _this.addRecent = function (preset, besidePreset, after) { + var recents = _this.getRecents(); - const beforeItem = _this.recentMatching(besidePreset); - let toIndex = recents.indexOf(beforeItem); - if (after) toIndex += 1; + var beforeItem = _this.recentMatching(besidePreset); + var toIndex = recents.indexOf(beforeItem); + if (after) { toIndex += 1; } - const newItem = RibbonItem(preset, 'recent'); + var newItem = RibbonItem(preset, 'recent'); recents.splice(toIndex, 0, newItem); setRecents(recents); }; - _this.removeRecent = (preset) => { - const item = _this.recentMatching(preset); + _this.removeRecent = function (preset) { + var item = _this.recentMatching(preset); if (item) { - let items = _this.getRecents(); + var items = _this.getRecents(); items.splice(items.indexOf(item), 1); setRecents(items); } }; - _this.recentMatching = (preset) => { - const items = _this.getRecents(); - for (let i in items) { + _this.recentMatching = function (preset) { + var items = _this.getRecents(); + for (var i in items) { if (items[i].matches(preset)) { return items[i]; } @@ -19455,31 +19477,31 @@ }; - _this.moveItem = (items, fromIndex, toIndex) => { + _this.moveItem = function (items, fromIndex, toIndex) { if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length - ) return null; + ) { return null; } items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]); return items; }; - _this.moveRecent = (item, beforeItem) => { - const recents = _this.getRecents(); - const fromIndex = recents.indexOf(item); - const toIndex = recents.indexOf(beforeItem); - const items = _this.moveItem(recents, fromIndex, toIndex); - if (items) setRecents(items); + _this.moveRecent = function (item, beforeItem) { + var recents = _this.getRecents(); + var fromIndex = recents.indexOf(item); + var toIndex = recents.indexOf(beforeItem); + var items = _this.moveItem(recents, fromIndex, toIndex); + if (items) { setRecents(items); } }; - _this.setMostRecent = (preset) => { - if (preset.searchable === false) return; + _this.setMostRecent = function (preset) { + if (preset.searchable === false) { return; } - let items = _this.getRecents(); - let item = _this.recentMatching(preset); + var items = _this.getRecents(); + var item = _this.recentMatching(preset); if (item) { items.splice(items.indexOf(item), 1); } else { @@ -19498,28 +19520,28 @@ function setFavorites(items) { _favorites = items; - const minifiedItems = items.map(d => d.minified()); + var minifiedItems = items.map(function (d) { return d.minified(); }); corePreferences('preset_favorites', JSON.stringify(minifiedItems)); // call update dispatch$1.call('favoritePreset'); } - _this.addFavorite = (preset, besidePreset, after) => { - const favorites = _this.getFavorites(); + _this.addFavorite = function (preset, besidePreset, after) { + var favorites = _this.getFavorites(); - const beforeItem = _this.favoriteMatching(besidePreset); - let toIndex = favorites.indexOf(beforeItem); - if (after) toIndex += 1; + var beforeItem = _this.favoriteMatching(besidePreset); + var toIndex = favorites.indexOf(beforeItem); + if (after) { toIndex += 1; } - const newItem = RibbonItem(preset, 'favorite'); + var newItem = RibbonItem(preset, 'favorite'); favorites.splice(toIndex, 0, newItem); setFavorites(favorites); }; - _this.toggleFavorite = (preset) => { - const favs = _this.getFavorites(); - const favorite = _this.favoriteMatching(preset); + _this.toggleFavorite = function (preset) { + var favs = _this.getFavorites(); + var favorite = _this.favoriteMatching(preset); if (favorite) { favs.splice(favs.indexOf(favorite), 1); } else { @@ -19535,30 +19557,30 @@ }; - _this.removeFavorite = (preset) => { - const item = _this.favoriteMatching(preset); + _this.removeFavorite = function (preset) { + var item = _this.favoriteMatching(preset); if (item) { - const items = _this.getFavorites(); + var items = _this.getFavorites(); items.splice(items.indexOf(item), 1); setFavorites(items); } }; - _this.getFavorites = () => { + _this.getFavorites = function () { if (!_favorites) { // fetch from local storage - let rawFavorites = JSON.parse(corePreferences('preset_favorites')); + var rawFavorites = JSON.parse(corePreferences('preset_favorites')); if (!rawFavorites) { rawFavorites = []; corePreferences('preset_favorites', JSON.stringify(rawFavorites)); } - _favorites = rawFavorites.reduce((output, d) => { - const item = ribbonItemForMinified(d, 'favorite'); - if (item && item.preset.addable()) output.push(item); + _favorites = rawFavorites.reduce(function (output, d) { + var item = ribbonItemForMinified(d, 'favorite'); + if (item && item.preset.addable()) { output.push(item); } return output; }, []); } @@ -19566,9 +19588,9 @@ }; - _this.favoriteMatching = (preset) => { - const favs = _this.getFavorites(); - for (let index in favs) { + _this.favoriteMatching = function (preset) { + var favs = _this.getFavorites(); + for (var index in favs) { if (favs[index].matches(preset)) { return favs[index]; } @@ -19647,7 +19669,7 @@ function collectShallowDescendants(id) { var entity = graph.hasEntity(id); - if (!entity || entity.type !== 'relation') return; + if (!entity || entity.type !== 'relation') { return; } entity.members .map(function(member) { return member.id; }) @@ -19673,11 +19695,11 @@ return Array.from(seen); function collectDeepDescendants(id) { - if (seen.has(id)) return; + if (seen.has(id)) { return; } seen.add(id); var entity = graph.hasEntity(id); - if (!entity || entity.type !== 'relation') return; + if (!entity || entity.type !== 'relation') { return; } entity.members .map(function(member) { return member.id; }) @@ -19695,7 +19717,7 @@ return utilEntitySelector(Array.from(returners)); function collectDeepDescendants(id) { - if (seen.has(id)) return; + if (seen.has(id)) { return; } seen.add(id); if (!idsSet.has(id)) { @@ -19703,8 +19725,8 @@ } var entity = graph.hasEntity(id); - if (!entity || entity.type !== 'relation') return; - if (skipMultipolgonMembers && entity.isMultipolygon()) return; + if (!entity || entity.type !== 'relation') { return; } + if (skipMultipolgonMembers && entity.isMultipolygon()) { return; } entity.members .map(function(member) { return member.id; }) .forEach(collectDeepDescendants); // recurse @@ -19732,11 +19754,11 @@ return Array.from(nodes); function collectNodes(id) { - if (seen.has(id)) return; + if (seen.has(id)) { return; } seen.add(id); var entity = graph.hasEntity(id); - if (!entity) return; + if (!entity) { return; } if (entity.type === 'node') { nodes.add(entity); @@ -19873,13 +19895,13 @@ } var tagHash = key + '=' + value; - if (!tagCounts[tagHash]) tagCounts[tagHash] = 0; + if (!tagCounts[tagHash]) { tagCounts[tagHash] = 0; } tagCounts[tagHash] += 1; }); }); for (var key in tags) { - if (!Array.isArray(tags[key])) continue; + if (!Array.isArray(tags[key])) { continue; } // sort values by frequency then alphabetically tags[key] = tags[key].sort(function(val1, val2) { @@ -19902,7 +19924,7 @@ function utilStringQs(str) { var i = 0; // advance past any leading '?' or '#' characters - while (i < str.length && (str[i] === '?' || str[i] === '#')) i++; + while (i < str.length && (str[i] === '?' || str[i] === '#')) { i++; } str = str.slice(i); return str.split('&').reduce(function(obj, pair){ @@ -19936,7 +19958,7 @@ var s = document.body; if (property in s) - return property; + { return property; } property = property.substr(0, 1).toUpperCase() + property.substr(1); @@ -19985,8 +20007,8 @@ function utilEditDistance(a, b) { a = remove$1(a.toLowerCase()); b = remove$1(b.toLowerCase()); - if (a.length === 0) return b.length; - if (b.length === 0) return a.length; + if (a.length === 0) { return b.length; } + if (b.length === 0) { return a.length; } var matrix = []; for (var i = 0; i <= b.length; i++) { matrix[i] = [i]; } for (var j = 0; j <= a.length; j++) { matrix[0][j] = j; } @@ -20032,7 +20054,7 @@ errors[i] = err; results[i] = data; remaining--; - if (!remaining) callback(errors, results); + if (!remaining) { callback(errors, results); } }); }); } @@ -20054,7 +20076,7 @@ * @returns {Function} a function that returns that value or the value if it's a function */ function utilFunctor(value) { - if (typeof value === 'function') return value; + if (typeof value === 'function') { return value; } return function() { return value; }; @@ -20117,7 +20139,7 @@ function osmEntity(attrs) { // For prototypal inheritance. - if (this instanceof osmEntity) return; + if (this instanceof osmEntity) { return; } // Create the appropriate subtype. if (attrs && attrs.type) { @@ -20217,7 +20239,7 @@ copy: function(resolver, copies) { if (copies[this.id]) - return copies[this.id]; + { return copies[this.id]; } var copy = osmEntity(this, { id: undefined, user: undefined, version: undefined }); copies[this.id] = copy; @@ -20295,14 +20317,14 @@ var tags = this.tags; // if there are no tags, none can be deprecated - if (Object.keys(tags).length === 0) return []; + if (Object.keys(tags).length === 0) { return []; } var deprecated = []; dataDeprecated.forEach(function(d) { var oldKeys = Object.keys(d.old); var matchesDeprecatedTags = oldKeys.every(function(oldKey) { - if (!tags[oldKey]) return false; - if (d.old[oldKey] === '*') return true; + if (!tags[oldKey]) { return false; } + if (d.old[oldKey] === '*') { return true; } var vals = tags[oldKey].split(';').filter(Boolean); if (vals.length === 0) { @@ -20333,8 +20355,8 @@ }; function osmLanes(entity) { - if (entity.type !== 'way') return null; - if (!entity.tags.highway) return null; + if (entity.type !== 'way') { return null; } + if (!entity.tags.highway) { return null; } var tags = entity.tags; var isOneWay = entity.isOneWay(); @@ -20451,10 +20473,10 @@ function parseMaxspeed(tags) { var maxspeed = tags.maxspeed; - if (!maxspeed) return; + if (!maxspeed) { return; } var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/; - if (!maxspeedRegex.test(maxspeed)) return; + if (!maxspeedRegex.test(maxspeed)) { return; } return parseInt(maxspeed, 10); } @@ -20500,7 +20522,7 @@ function parseTurnLanes(tag){ - if (!tag) return; + if (!tag) { return; } var validValues = [ 'left', 'slight_left', 'sharp_left', 'through', 'right', 'slight_right', @@ -20509,7 +20531,7 @@ return tag.split('|') .map(function (s) { - if (s === '') s = 'none'; + if (s === '') { s = 'none'; } return s.split(';') .map(function (d) { return validValues.indexOf(d) === -1 ? 'unknown': d; @@ -20519,20 +20541,20 @@ function parseMaxspeedLanes(tag, maxspeed) { - if (!tag) return; + if (!tag) { return; } return tag.split('|') .map(function (s) { - if (s === 'none') return s; + if (s === 'none') { return s; } var m = parseInt(s, 10); - if (s === '' || m === maxspeed) return null; + if (s === '' || m === maxspeed) { return null; } return isNaN(m) ? 'unknown': m; }); } function parseMiscLanes(tag) { - if (!tag) return; + if (!tag) { return; } var validValues = [ 'yes', 'no', 'designated' @@ -20540,14 +20562,14 @@ return tag.split('|') .map(function (s) { - if (s === '') s = 'no'; + if (s === '') { s = 'no'; } return validValues.indexOf(s) === -1 ? 'unknown': s; }); } function parseBicycleWay(tag) { - if (!tag) return; + if (!tag) { return; } var validValues = [ 'yes', 'no', 'designated', 'lane' @@ -20555,25 +20577,25 @@ return tag.split('|') .map(function (s) { - if (s === '') s = 'no'; + if (s === '') { s = 'no'; } return validValues.indexOf(s) === -1 ? 'unknown': s; }); } function mapToLanesObj(lanesObj, data, key) { - if (data.forward) data.forward.forEach(function(l, i) { - if (!lanesObj.forward[i]) lanesObj.forward[i] = {}; + if (data.forward) { data.forward.forEach(function(l, i) { + if (!lanesObj.forward[i]) { lanesObj.forward[i] = {}; } lanesObj.forward[i][key] = l; - }); - if (data.backward) data.backward.forEach(function(l, i) { - if (!lanesObj.backward[i]) lanesObj.backward[i] = {}; + }); } + if (data.backward) { data.backward.forEach(function(l, i) { + if (!lanesObj.backward[i]) { lanesObj.backward[i] = {}; } lanesObj.backward[i][key] = l; - }); - if (data.unspecified) data.unspecified.forEach(function(l, i) { - if (!lanesObj.unspecified[i]) lanesObj.unspecified[i] = {}; + }); } + if (data.unspecified) { data.unspecified.forEach(function(l, i) { + if (!lanesObj.unspecified[i]) { lanesObj.unspecified[i] = {}; } lanesObj.unspecified[i][key] = l; - }); + }); } } function osmWay() { @@ -20596,7 +20618,7 @@ copy: function(resolver, copies) { - if (copies[this.id]) return copies[this.id]; + if (copies[this.id]) { return copies[this.id]; } var copy = osmEntity.prototype.copy.call(this, resolver, copies); @@ -20641,8 +20663,8 @@ affix: function(node) { - if (this.nodes[0] === node) return 'prefix'; - if (this.nodes[this.nodes.length - 1] === node) return 'suffix'; + if (this.nodes[0] === node) { return 'prefix'; } + if (this.nodes[this.nodes.length - 1] === node) { return 'suffix'; } }, @@ -20653,20 +20675,20 @@ } // implied layer tag.. - if (this.tags.covered === 'yes') return -1; - if (this.tags.location === 'overground') return 1; - if (this.tags.location === 'underground') return -1; - if (this.tags.location === 'underwater') return -10; - - if (this.tags.power === 'line') return 10; - if (this.tags.power === 'minor_line') return 10; - if (this.tags.aerialway) return 10; - if (this.tags.bridge) return 1; - if (this.tags.cutting) return -1; - if (this.tags.tunnel) return -1; - if (this.tags.waterway) return -1; - if (this.tags.man_made === 'pipeline') return -10; - if (this.tags.boundary) return -10; + if (this.tags.covered === 'yes') { return -1; } + if (this.tags.location === 'overground') { return 1; } + if (this.tags.location === 'underground') { return -1; } + if (this.tags.location === 'underwater') { return -10; } + + if (this.tags.power === 'line') { return 10; } + if (this.tags.power === 'minor_line') { return 10; } + if (this.tags.aerialway) { return 10; } + if (this.tags.bridge) { return 1; } + if (this.tags.cutting) { return -1; } + if (this.tags.tunnel) { return -1; } + if (this.tags.waterway) { return -1; } + if (this.tags.man_made === 'pipeline') { return -10; } + if (this.tags.boundary) { return -10; } return 0; }, @@ -20696,7 +20718,7 @@ var width = averageWidths[key][this.tags[key]]; if (key === 'highway') { var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10); - if (!laneCount) laneCount = this.isOneWay() ? 1 : 2; + if (!laneCount) { laneCount = this.isOneWay() ? 1 : 2; } return width * laneCount; } @@ -20725,7 +20747,7 @@ // implied oneway tag.. for (var key in this.tags) { if (key in osmOneWayTags && (this.tags[key] in osmOneWayTags[key])) - return true; + { return true; } } return false; }, @@ -20771,7 +20793,7 @@ isConvex: function(resolver) { - if (!this.isClosed() || this.isDegenerate()) return null; + if (!this.isClosed() || this.isDegenerate()) { return null; } var nodes = utilArrayUniq(resolver.childNodes(this)); var coords = nodes.map(function(n) { return n.loc; }); @@ -20802,9 +20824,9 @@ isArea: function() { if (this.tags.area === 'yes') - return true; + { return true; } if (!this.isClosed() || this.tags.area === 'no') - return false; + { return false; } return this.tagSuggestingArea() !== null; }, @@ -20817,8 +20839,8 @@ areAdjacent: function(n1, n2) { for (var i = 0; i < this.nodes.length; i++) { if (this.nodes[i] === n1) { - if (this.nodes[i - 1] === n2) return true; - if (this.nodes[i + 1] === n2) return true; + if (this.nodes[i - 1] === n2) { return true; } + if (this.nodes[i + 1] === n2) { return true; } } } return false; @@ -20868,7 +20890,7 @@ // If this way is not closed, append the beginning node to the end of the nodelist to close it. close: function() { - if (this.isClosed() || !this.nodes.length) return this; + if (this.isClosed() || !this.nodes.length) { return this; } var nodes = this.nodes.slice(); nodes = nodes.filter(noRepeatNodes); @@ -20879,7 +20901,7 @@ // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it. unclose: function() { - if (!this.isClosed()) return this; + if (!this.isClosed()) { return this; } var nodes = this.nodes.slice(); var connector = this.first(); @@ -20923,14 +20945,14 @@ var i = 1; while (i < nodes.length && nodes.length > 2 && nodes[i] === connector) { nodes.splice(i, 1); - if (index > i) index--; + if (index > i) { index--; } } // trailing connectors.. i = nodes.length - 1; while (i > 0 && nodes.length > 1 && nodes[i] === connector) { nodes.splice(i, 1); - if (index > i) index--; + if (index > i) { index--; } i = nodes.length - 1; } } @@ -20968,14 +20990,14 @@ var i = 1; while (i < nodes.length && nodes.length > 2 && nodes[i] === connector) { nodes.splice(i, 1); - if (index > i) index--; + if (index > i) { index--; } } // trailing connectors.. i = nodes.length - 1; while (i > 0 && nodes.length > 1 && nodes[i] === connector) { nodes.splice(i, 1); - if (index === i) index = 0; // update leading connector instead + if (index === i) { index = 0; } // update leading connector instead i = nodes.length - 1; } } @@ -21128,9 +21150,9 @@ for (var memberIndex in entity.members) { var member = entity.members[memberIndex]; if (!member.role || member.role === 'outer') { - if (outerMember) return false; - if (member.type !== 'way') return false; - if (!graph.hasEntity(member.id)) return false; + if (outerMember) { return false; } + if (member.type !== 'way') { return false; } + if (!graph.hasEntity(member.id)) { return false; } outerMember = graph.entity(member.id); @@ -21147,23 +21169,23 @@ // https://github.com/openstreetmap/iD/issues/613 function osmIsOldMultipolygonOuterMember(entity, graph) { if (entity.type !== 'way' || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) - return false; + { return false; } var parents = graph.parentRelations(entity); if (parents.length !== 1) - return false; + { return false; } var parent = parents[0]; if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) - return false; + { return false; } var members = parent.members, member; for (var i = 0; i < members.length; i++) { member = members[i]; if (member.id === entity.id && member.role && member.role !== 'outer') - return false; // Not outer member + { return false; } // Not outer member if (member.id !== entity.id && (!member.role || member.role === 'outer')) - return false; // Not a simple multipolygon + { return false; } // Not a simple multipolygon } return parent; @@ -21172,32 +21194,32 @@ function osmOldMultipolygonOuterMember(entity, graph) { if (entity.type !== 'way') - return false; + { return false; } var parents = graph.parentRelations(entity); if (parents.length !== 1) - return false; + { return false; } var parent = parents[0]; if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) - return false; + { return false; } var members = parent.members, member, outerMember; for (var i = 0; i < members.length; i++) { member = members[i]; if (!member.role || member.role === 'outer') { if (outerMember) - return false; // Not a simple multipolygon + { return false; } // Not a simple multipolygon outerMember = member; } } if (!outerMember) - return false; + { return false; } var outerEntity = graph.hasEntity(outerMember.id); if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) - return false; + { return false; } return outerEntity; } @@ -21458,7 +21480,7 @@ var wayMembers = []; for (i = 0; i < members.length; i++) { item = members[i]; - if (item.index === -1) continue; + if (item.index === -1) { continue; } if (item.pair) { wayMembers.push(item.pair[0]); @@ -21570,8 +21592,8 @@ var geometry = entity.geometry(graph); var tags = entity.tags; - if (oldPreset) tags = oldPreset.unsetTags(tags, geometry); - if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults); + if (oldPreset) { tags = oldPreset.unsetTags(tags, geometry); } + if (newPreset) { tags = newPreset.setTags(tags, geometry, skipFieldDefaults); } return graph.replace(entity.update({tags: tags})); }; @@ -21650,7 +21672,7 @@ } } - if (val === '') return []; + if (val === '') { return []; } var cardinal = { north: 0, n: 0, @@ -21693,7 +21715,7 @@ var lookForward = (this.tags['traffic_sign:forward'] || v === 'forward' || v === 'both' || v === 'all'); - if (!lookForward && !lookBackward) return; + if (!lookForward && !lookBackward) { return; } var nodeIds = {}; resolver.parentWays(this).forEach(function(parent) { @@ -21741,7 +21763,7 @@ // vertex is connected to multiple parent ways for (var i in parents) { if (parents[i].geometry(resolver) === 'line' && - parents[i].hasInterestingTags()) return true; + parents[i].hasInterestingTags()) { return true; } } } else if (parents.length === 1) { var way = parents[0]; @@ -21806,7 +21828,7 @@ }, this) } }; - if (changeset_id) r.node['@changeset'] = changeset_id; + if (changeset_id) { r.node['@changeset'] = changeset_id; } return r; }, @@ -21824,14 +21846,14 @@ var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var way = graph.entity(wayId); var origNodes = {}; graph.childNodes(way).forEach(function(node) { - if (!origNodes[node.id]) origNodes[node.id] = node; + if (!origNodes[node.id]) { origNodes[node.id] = node; } }); if (!way.isConvex(graph)) { @@ -21964,7 +21986,7 @@ var parentWays = graph.parentWays(keyNodes[i]); for (j = 0; j < parentWays.length; j++) { var sharedWay = parentWays[j]; - if (sharedWay === way) continue; + if (sharedWay === way) { continue; } if (sharedWay.areAdjacent(startNode.id, endNode.id)) { var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id); @@ -22094,13 +22116,13 @@ function canDeleteNode(node, graph) { // don't delete nodes still attached to ways or relations if (graph.parentWays(node).length || - graph.parentRelations(node).length) return false; + graph.parentRelations(node).length) { return false; } var geometries = osmNodeGeometriesForTags(node.tags); // don't delete if this node can be a standalone point - if (geometries.point) return false; + if (geometries.point) { return false; } // delete if this node only be a vertex - if (geometries.vertex) return true; + if (geometries.vertex) { return true; } // iD doesn't know if this should be a point or vertex, // so only delete if there are no interesting tags @@ -22254,13 +22276,13 @@ // Choose a survivor node, prefer an existing (not new) node - #4974 for (i = 0; i < nodeIDs.length; i++) { survivor = graph.entity(nodeIDs[i]); - if (survivor.version) break; // found one + if (survivor.version) { break; } // found one } // Replace all non-surviving nodes with the survivor and merge tags. for (i = 0; i < nodeIDs.length; i++) { node = graph.entity(nodeIDs[i]); - if (node.id === survivor.id) continue; + if (node.id === survivor.id) { continue; } parents = graph.parentWays(node); for (j = 0; j < parents.length; j++) { @@ -22301,7 +22323,7 @@ // Choose a survivor node, prefer an existing (not new) node - #4974 for (i = 0; i < nodeIDs.length; i++) { survivor = graph.entity(nodeIDs[i]); - if (survivor.version) break; // found one + if (survivor.version) { break; } // found one } // 1. disable if the nodes being connected have conflicting relation roles @@ -22349,7 +22371,7 @@ restrictionIDs = utilArrayUniq(restrictionIDs); for (i = 0; i < restrictionIDs.length; i++) { relation = graph.entity(restrictionIDs[i]); - if (!relation.isComplete(graph)) continue; + if (!relation.isComplete(graph)) { continue; } var memberWays = relation.members .filter(function(m) { return m.type === 'way'; }) @@ -22427,7 +22449,7 @@ for (j = 0; j < memberWays.length; j++) { way = memberWays[j].update({}); // make copy for (k = 0; k < nodeIDs.length; k++) { - if (nodeIDs[k] === survivor.id) continue; + if (nodeIDs[k] === survivor.id) { continue; } if (way.areAdjacent(nodeIDs[k], survivor.id)) { way = way.removeNode(nodeIDs[k]); @@ -22457,7 +22479,7 @@ function collectNodes(member, collection) { var entity = graph.hasEntity(member.id); - if (!entity) return; + if (!entity) { return; } var role = member.role || ''; if (!collection[role]) { @@ -22522,7 +22544,7 @@ graph = graph.replace(relation); if (relation.isDegenerate()) - graph = actionDeleteRelation(relation.id)(graph); + { graph = actionDeleteRelation(relation.id)(graph); } return graph; }; @@ -22531,18 +22553,18 @@ function actionDiscardTags(difference, discardTags) { discardTags = discardTags || {}; - return (graph) => { + return function (graph) { difference.modified().forEach(checkTags); difference.created().forEach(checkTags); return graph; function checkTags(entity) { - const keys = Object.keys(entity.tags); - let didDiscard = false; - let tags = {}; + var keys = Object.keys(entity.tags); + var didDiscard = false; + var tags = {}; - for (let i = 0; i < keys.length; i++) { - const k = keys[i]; + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; if (discardTags[k] || !entity.tags[k]) { didDiscard = true; } else { @@ -22637,7 +22659,7 @@ action.disabled = function(graph) { var connections = action.connections(graph); if (connections.length === 0) - return 'not_connected'; + { return 'not_connected'; } var parentWays = graph.parentWays(graph.entity(nodeId)); var seenRelationIds = {}; @@ -22662,12 +22684,12 @@ }); if (sharedRelation) - return 'relation'; + { return 'relation'; } }; action.limitWays = function(val) { - if (!arguments.length) return wayIds; + if (!arguments.length) { return wayIds; } wayIds = val; return action; }; @@ -22743,7 +22765,7 @@ // don't transfer building-related tags if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || - key.match(/^roof:.{1,}/)) continue; + key.match(/^roof:.{1,}/)) { continue; } } // copy the tag from the entity to the point @@ -22832,7 +22854,7 @@ graph = graph.replace(survivor); joined.forEach(function(way) { - if (way.id === survivorID) return; + if (way.id === survivorID) { return; } graph.parentRelations(way).forEach(function(parent) { graph = graph.replace(parent.replaceMember(way, survivor)); @@ -22847,7 +22869,7 @@ // Finds if the join created a single-member multipolygon, // and if so turns it into a basic area instead function checkForSimpleMultipolygon() { - if (!survivor.isClosed()) return; + if (!survivor.isClosed()) { return; } var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon) { // find multipolygons where the survivor is the only member @@ -22855,14 +22877,14 @@ }); // skip if this is the single member of multiple multipolygons - if (multipolygons.length !== 1) return; + if (multipolygons.length !== 1) { return; } var multipolygon = multipolygons[0]; for (var key in survivor.tags) { if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged - multipolygon.tags[key] !== survivor.tags[key]) return; + multipolygon.tags[key] !== survivor.tags[key]) { return; } } survivor = survivor.mergeTags(multipolygon.tags); @@ -23043,7 +23065,7 @@ // If there is a single "interesting" node, use that as the location. // Otherwise return the average location of all the nodes. function chooseLoc(graph) { - if (!nodeIDs.length) return null; + if (!nodeIDs.length) { return null; } var sum = [0,0]; var interestingCount = 0; var interestingLoc; @@ -23061,7 +23083,7 @@ var action = function(graph) { - if (nodeIDs.length < 2) return graph; + if (nodeIDs.length < 2) { return graph; } var toLoc = loc; if (!toLoc) { toLoc = chooseLoc(graph); @@ -23079,11 +23101,11 @@ action.disabled = function(graph) { - if (nodeIDs.length < 2) return 'not_eligible'; + if (nodeIDs.length < 2) { return 'not_eligible'; } for (var i = 0; i < nodeIDs.length; i++) { var entity = graph.entity(nodeIDs[i]); - if (entity.type !== 'node') return 'not_eligible'; + if (entity.type !== 'node') { return 'not_eligible'; } } return actionConnect(nodeIDs).disabled(graph); @@ -23144,12 +23166,12 @@ var groups = {}; for (var i = 0; i < x.length; i++) { var tagName = Object.keys(x[i])[0]; - if (!groups[tagName]) groups[tagName] = []; + if (!groups[tagName]) { groups[tagName] = []; } groups[tagName].push(x[i][tagName]); } var ordered = {}; order.forEach(function(o) { - if (groups[o]) ordered[o] = groups[o]; + if (groups[o]) { ordered[o] = groups[o]; } }); return ordered; } @@ -23177,7 +23199,7 @@ var sorted = {}; var relations = changes.relation; - if (!relations) return changes; + if (!relations) { return changes; } for (var i = 0; i < relations.length; i++) { var relation = relations[i]; @@ -23303,7 +23325,7 @@ var aId = parseInt(osmEntity.id.toOSM(a.id), 10); var bId = parseInt(osmEntity.id.toOSM(b.id), 10); - if (aId < 0 || bId < 0) return aId - bId; + if (aId < 0 || bId < 0) { return aId - bId; } return bId - aId; }; @@ -23314,7 +23336,7 @@ copy: function(resolver, copies) { - if (copies[this.id]) return copies[this.id]; + if (copies[this.id]) { return copies[this.id]; } var copy = osmEntity.prototype.copy.call(this, resolver, copies); @@ -23331,7 +23353,7 @@ extent: function(resolver, memo) { return resolver.transient(this, 'extent', function() { - if (memo && memo[this.id]) return geoExtent(); + if (memo && memo[this.id]) { return geoExtent(); } memo = memo || {}; memo[this.id] = true; @@ -23451,7 +23473,7 @@ // By default, adding a duplicate member (by id and role) is prevented. // Return an updated relation. replaceMember: function(needle, replacement, keepDuplicates) { - if (!this.memberById(needle.id)) return this; + if (!this.memberById(needle.id)) { return this; } var members = []; @@ -23551,20 +23573,20 @@ isValidRestriction: function() { - if (!this.isRestriction()) return false; + if (!this.isRestriction()) { return false; } var froms = this.members.filter(function(m) { return m.role === 'from'; }); var vias = this.members.filter(function(m) { return m.role === 'via'; }); var tos = this.members.filter(function(m) { return m.role === 'to'; }); - if (froms.length !== 1 && this.tags.restriction !== 'no_entry') return false; - if (froms.some(function(m) { return m.type !== 'way'; })) return false; + if (froms.length !== 1 && this.tags.restriction !== 'no_entry') { return false; } + if (froms.some(function(m) { return m.type !== 'way'; })) { return false; } - if (tos.length !== 1 && this.tags.restriction !== 'no_exit') return false; - if (tos.some(function(m) { return m.type !== 'way'; })) return false; + if (tos.length !== 1 && this.tags.restriction !== 'no_exit') { return false; } + if (tos.some(function(m) { return m.type !== 'way'; })) { return false; } - if (vias.length === 0) return false; - if (vias.length > 1 && vias.some(function(m) { return m.type !== 'way'; })) return false; + if (vias.length === 0) { return false; } + if (vias.length > 1 && vias.some(function(m) { return m.type !== 'way'; })) { return false; } return true; }, @@ -23611,13 +23633,13 @@ for (o = 0; o < outers.length; o++) { outer = outers[o]; if (geoPolygonContainsPolygon(outer, inner)) - return o; + { return o; } } for (o = 0; o < outers.length; o++) { outer = outers[o]; if (geoPolygonIntersectsPolygon(outer, inner, false)) - return o; + { return o; } } } @@ -23640,45 +23662,49 @@ } }); - class QAItem { - constructor(loc, service, itemType, id, props) { - // Store required properties - this.loc = loc; - this.service = service.title; - this.itemType = itemType; + var QAItem = function QAItem(loc, service, itemType, id, props) { + // Store required properties + this.loc = loc; + this.service = service.title; + this.itemType = itemType; - // All issues must have an ID for selection, use generic if none specified - this.id = id ? id : `${QAItem.id()}`; + // All issues must have an ID for selection, use generic if none specified + this.id = id ? id : ("" + (QAItem.id())); - this.update(props); + this.update(props); - // Some QA services have marker icons to differentiate issues - if (service && typeof service.getIcon === 'function') { - this.icon = service.getIcon(itemType); - } - - return this; + // Some QA services have marker icons to differentiate issues + if (service && typeof service.getIcon === 'function') { + this.icon = service.getIcon(itemType); } - update(props) { - // You can't override this inital information - const { loc, service, itemType, id } = this; + return this; + }; - Object.keys(props).forEach(prop => this[prop] = props[prop]); + QAItem.prototype.update = function update (props) { + var this$1 = this; - this.loc = loc; - this.service = service; - this.itemType = itemType; - this.id = id; + // You can't override this inital information + var ref = this; + var loc = ref.loc; + var service = ref.service; + var itemType = ref.itemType; + var id = ref.id; - return this; - } + Object.keys(props).forEach(function (prop) { return this$1[prop] = props[prop]; }); - // Generic handling for newly created QAItems - static id() { - return this.nextId--; - } - } + this.loc = loc; + this.service = service; + this.itemType = itemType; + this.id = id; + + return this; + }; + + // Generic handling for newly created QAItems + QAItem.id = function id () { + return this.nextId--; + }; QAItem.nextId = -1; // Split a way at the given node. @@ -23906,10 +23932,10 @@ return parents.filter(function(parent) { if (_wayIDs && _wayIDs.indexOf(parent.id) === -1) - return false; + { return false; } if (!_wayIDs && hasLines && parent.geometry(graph) !== 'line') - return false; + { return false; } if (parent.isClosed()) { return true; @@ -23935,7 +23961,7 @@ action.limitWays = function(val) { - if (!arguments.length) return _wayIDs; + if (!arguments.length) { return _wayIDs; } _wayIDs = val; return action; }; @@ -23945,7 +23971,7 @@ } function coreGraph(other, mutable) { - if (!(this instanceof coreGraph)) return new coreGraph(other, mutable); + if (!(this instanceof coreGraph)) { return new coreGraph(other, mutable); } if (other instanceof coreGraph) { var base = other.base(); @@ -24050,8 +24076,8 @@ childNodes: function(entity) { - if (this._childNodes[entity.id]) return this._childNodes[entity.id]; - if (!entity.nodes) return []; + if (this._childNodes[entity.id]) { return this._childNodes[entity.id]; } + if (!entity.nodes) { return []; } var nodes = []; for (var i = 0; i < entity.nodes.length; i++) { @@ -24084,7 +24110,7 @@ var entity = entities[i]; if (!entity.visible || (!force && base.entities[entity.id])) - continue; + { continue; } // Merging data into the base graph base.entities[entity.id] = entity; @@ -24201,7 +24227,7 @@ replace: function(entity) { - if (this.entities[entity.id] === entity) return this; + if (this.entities[entity.id] === entity) { return this; } return this.update(function() { this._updateCalculated(this.entities[entity.id], entity); @@ -24221,7 +24247,7 @@ revert: function(id) { var baseEntity = this.base().entities[id]; var headEntity = this.entities[id]; - if (headEntity === baseEntity) return this; + if (headEntity === baseEntity) { return this; } return this.update(function() { this._updateCalculated(headEntity, baseEntity); @@ -24231,12 +24257,14 @@ update: function() { + var arguments$1 = arguments; + var graph = this.frozen ? coreGraph(this, true) : this; for (var i = 0; i < arguments.length; i++) { - arguments[i].call(graph, graph); + arguments$1[i].call(graph, graph); } - if (this.frozen) graph.frozen = true; + if (this.frozen) { graph.frozen = true; } return graph; }, @@ -24276,7 +24304,7 @@ } function isRoad(way) { - if (way.isArea() || way.isDegenerate()) return false; + if (way.isArea() || way.isDegenerate()) { return false; } var roads = { 'motorway': true, 'motorway_link': true, @@ -24332,7 +24360,7 @@ var hasWays = false; for (i = 0; i < checkWays.length; i++) { way = checkWays[i]; - if (!isRoad(way) && !memberOfRestriction(way)) continue; + if (!isRoad(way) && !memberOfRestriction(way)) { continue; } ways.push(way); // it's a road, or it's already in a turn restriction hasWays = true; @@ -24341,18 +24369,18 @@ nodes = utilArrayUniq(graph.childNodes(way)); for (j = 0; j < nodes.length; j++) { node = nodes[j]; - if (node === vertex) continue; // same thing - if (vertices.indexOf(node) !== -1) continue; // seen it already - if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue; // too far from start + if (node === vertex) { continue; } // same thing + if (vertices.indexOf(node) !== -1) { continue; } // seen it already + if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) { continue; } // too far from start // a key vertex will have parents that are also roads var hasParents = false; parents = graph.parentWays(node); for (k = 0; k < parents.length; k++) { parent = parents[k]; - if (parent === way) continue; // same thing - if (ways.indexOf(parent) !== -1) continue; // seen it already - if (!isRoad(parent)) continue; // not a road + if (parent === way) { continue; } // same thing + if (ways.indexOf(parent) !== -1) { continue; } // seen it already + if (!isRoad(parent)) { continue; } // not a road hasParents = true; break; } @@ -24587,14 +24615,14 @@ // For each path found, generate and return a `osmTurn` datastructure. // intersection.turns = function(fromWayId, maxViaWay) { - if (!fromWayId) return []; - if (!maxViaWay) maxViaWay = 0; + if (!fromWayId) { return []; } + if (!maxViaWay) { maxViaWay = 0; } var vgraph = intersection.graph; var keyVertexIds = intersection.vertices.map(function(v) { return v.id; }); var start = vgraph.entity(fromWayId); - if (!start || !(start.__from || start.__via)) return []; + if (!start || !(start.__from || start.__via)) { return []; } // maxViaWay=0 from-*-to (0 vias) // maxViaWay=1 from-*-via-*-to (1 via max) @@ -24609,7 +24637,7 @@ // traverse the intersection graph and find all the valid paths function step(entity, currPath, currRestrictions, matchedRestriction) { currPath = (currPath || []).slice(); // shallow copy - if (currPath.length >= maxPathLength) return; + if (currPath.length >= maxPathLength) { return; } currPath.push(entity.id); currRestrictions = (currRestrictions || []).slice(); // shallow copy var i, j; @@ -24623,10 +24651,10 @@ var way = parents[i]; // if next way is a oneway incoming to this vertex, skip - if (way.__oneWay && way.nodes[0] !== entity.id) continue; + if (way.__oneWay && way.nodes[0] !== entity.id) { continue; } // if we have seen it before (allowing for an initial u-turn), skip - if (currPath.indexOf(way.id) !== -1 && currPath.length >= 3) continue; + if (currPath.indexOf(way.id) !== -1 && currPath.length >= 3) { continue; } // Check all "current" restrictions (where we've already walked the `FROM`) var restrict = undefined; @@ -24691,7 +24719,7 @@ // stop looking if we find a "direct" restriction (matching FROM, VIA, TO) if (restrict && restrict.direct) - break; + { break; } } nextWays.push({ way: way, restrict: restrict }); @@ -24727,10 +24755,10 @@ turns.push(osmTurn(turn)); } - if (currPath[0] === currPath[2]) return; // if we made a u-turn - stop here + if (currPath[0] === currPath[2]) { return; } // if we made a u-turn - stop here } - if (matchedRestriction && matchedRestriction.end) return; // don't advance any further + if (matchedRestriction && matchedRestriction.end) { return; } // don't advance any further // which nodes can we step into? var n1 = vgraph.entity(entity.first()); @@ -24739,8 +24767,8 @@ var nextNodes = []; if (currPath.length > 1) { - if (dist > maxDistance) return; // the next node is too far - if (!entity.__via) return; // this way is a leaf / can't be a via + if (dist > maxDistance) { return; } // the next node is too far + if (!entity.__via) { return; } // this way is a leaf / can't be a via } if (!entity.__oneWay && // bidirectional.. @@ -24756,13 +24784,13 @@ nextNodes.forEach(function(nextNode) { // gather restrictions FROM this way var fromRestrictions = vgraph.parentRelations(entity).filter(function(r) { - if (!r.isRestriction()) return false; + if (!r.isRestriction()) { return false; } var f = r.memberByRole('from'); - if (!f || f.id !== entity.id) return false; + if (!f || f.id !== entity.id) { return false; } var isOnly = /^only_/.test(r.tags.restriction); - if (!isOnly) return true; + if (!isOnly) { return true; } // `only_` restrictions only matter along the direction of the VIA - #4849 var isOnlyVia = false; @@ -24771,7 +24799,7 @@ isOnlyVia = (v[0].id === nextNode.id); } else { // via way(s) for (var i = 0; i < v.length; i++) { - if (v[i].type !== 'way') continue; + if (v[i].type !== 'way') { continue; } var viaWay = vgraph.entity(v[i].id); if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) { isOnlyVia = true; @@ -24790,7 +24818,7 @@ // assumes path is alternating way-node-way of odd length function pathToTurn(path) { - if (path.length < 3) return; + if (path.length < 3) { return; } var fromWayId, fromNodeId, fromVertexId; var toWayId, toNodeId, toVertexId; var viaWayIds, viaNodeId, isUturn; @@ -24800,7 +24828,7 @@ if (path.length === 3 && fromWayId === toWayId) { // u turn var way = vgraph.entity(fromWayId); - if (way.__oneWay) return null; + if (way.__oneWay) { return null; } isUturn = true; viaNodeId = fromVertexId = toVertexId = path[1]; @@ -24857,18 +24885,18 @@ geoAngle(toVertex, toNode, projection)) * 180 / Math.PI; while (angle < 0) - angle += 360; + { angle += 360; } if (fromNode === toNode) - return 'no_u_turn'; + { return 'no_u_turn'; } if ((angle < 23 || angle > 336) && fromOneWay && toOneWay) - return 'no_u_turn'; // wider tolerance for u-turn if both ways are oneway + { return 'no_u_turn'; } // wider tolerance for u-turn if both ways are oneway if ((angle < 40 || angle > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) - return 'no_u_turn'; // even wider tolerance for u-turn if there is a via way (from !== to) + { return 'no_u_turn'; } // even wider tolerance for u-turn if there is a via way (from !== to) if (angle < 158) - return 'no_right_turn'; + { return 'no_right_turn'; } if (angle > 202) - return 'no_left_turn'; + { return 'no_left_turn'; } return 'no_straight_on'; } @@ -24914,7 +24942,7 @@ // contained by the kth way. var contained = polygons.map(function(w, i) { return polygons.map(function(d, n) { - if (i === n) return null; + if (i === n) { return null; } return geoPolygonContainsPolygon( d.nodes.map(function(n) { return n.loc; }), w.nodes.map(function(n) { return n.loc; }) @@ -25024,37 +25052,37 @@ var fastDeepEqual = function equal(a, b) { - if (a === b) return true; + if (a === b) { return true; } if (a && b && typeof a == 'object' && typeof b == 'object') { - if (a.constructor !== b.constructor) return false; + if (a.constructor !== b.constructor) { return false; } var length, i, keys; if (Array.isArray(a)) { length = a.length; - if (length != b.length) return false; + if (length != b.length) { return false; } for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; + { if (!equal(a[i], b[i])) { return false; } } return true; } - if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + if (a.constructor === RegExp) { return a.source === b.source && a.flags === b.flags; } + if (a.valueOf !== Object.prototype.valueOf) { return a.valueOf() === b.valueOf(); } + if (a.toString !== Object.prototype.toString) { return a.toString() === b.toString(); } keys = Object.keys(a); length = keys.length; - if (length !== Object.keys(b).length) return false; + if (length !== Object.keys(b).length) { return false; } for (i = length; i-- !== 0;) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + { if (!Object.prototype.hasOwnProperty.call(b, keys[i])) { return false; } } for (i = length; i-- !== 0;) { var key = keys[i]; - if (!equal(a[key], b[key])) return false; + if (!equal(a[key], b[key])) { return false; } } return true; @@ -25073,9 +25101,9 @@ // Expects two arrays, finds longest common sequence function LCS(buffer1, buffer2) { - let equivalenceClasses = {}; - for (let j = 0; j < buffer2.length; j++) { - const item = buffer2[j]; + var equivalenceClasses = {}; + for (var j = 0; j < buffer2.length; j++) { + var item = buffer2[j]; if (equivalenceClasses[item]) { equivalenceClasses[item].push(j); } else { @@ -25083,27 +25111,27 @@ } } - const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null }; - let candidates = [NULLRESULT]; + var NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null }; + var candidates = [NULLRESULT]; - for (let i = 0; i < buffer1.length; i++) { - const item = buffer1[i]; - const buffer2indices = equivalenceClasses[item] || []; - let r = 0; - let c = candidates[0]; + for (var i = 0; i < buffer1.length; i++) { + var item$1 = buffer1[i]; + var buffer2indices = equivalenceClasses[item$1] || []; + var r = 0; + var c = candidates[0]; - for (let jx = 0; jx < buffer2indices.length; jx++) { - const j = buffer2indices[jx]; + for (var jx = 0; jx < buffer2indices.length; jx++) { + var j$1 = buffer2indices[jx]; - let s; + var s = (void 0); for (s = r; s < candidates.length; s++) { - if ((candidates[s].buffer2index < j) && ((s === candidates.length - 1) || (candidates[s + 1].buffer2index > j))) { + if ((candidates[s].buffer2index < j$1) && ((s === candidates.length - 1) || (candidates[s + 1].buffer2index > j$1))) { break; } } if (s < candidates.length) { - const newCandidate = { buffer1index: i, buffer2index: j, chain: candidates[s] }; + var newCandidate = { buffer1index: i, buffer2index: j$1, chain: candidates[s] }; if (r === candidates.length) { candidates.push(c); } else { @@ -25131,14 +25159,14 @@ // offsets and lengths of mismatched chunks in the input // buffers. This is used by diff3MergeRegions. function diffIndices(buffer1, buffer2) { - const lcs = LCS(buffer1, buffer2); - let result = []; - let tail1 = buffer1.length; - let tail2 = buffer2.length; - - for (let candidate = lcs; candidate !== null; candidate = candidate.chain) { - const mismatchLength1 = tail1 - candidate.buffer1index - 1; - const mismatchLength2 = tail2 - candidate.buffer2index - 1; + var lcs = LCS(buffer1, buffer2); + var result = []; + var tail1 = buffer1.length; + var tail2 = buffer2.length; + + for (var candidate = lcs; candidate !== null; candidate = candidate.chain) { + var mismatchLength1 = tail1 - candidate.buffer1index - 1; + var mismatchLength2 = tail2 - candidate.buffer2index - 1; tail1 = candidate.buffer1index; tail2 = candidate.buffer2index; @@ -25173,7 +25201,7 @@ // "hunks" are array subsets where `a` or `b` are different from `o` // https://www.gnu.org/software/diffutils/manual/html_node/diff3-Hunks.html - let hunks = []; + var hunks = []; function addHunk(h, ab) { hunks.push({ ab: ab, @@ -25185,12 +25213,12 @@ }); } - diffIndices(o, a).forEach(item => addHunk(item, 'a')); - diffIndices(o, b).forEach(item => addHunk(item, 'b')); - hunks.sort((x,y) => x.oStart - y.oStart); + diffIndices(o, a).forEach(function (item) { return addHunk(item, 'a'); }); + diffIndices(o, b).forEach(function (item) { return addHunk(item, 'b'); }); + hunks.sort(function (x,y) { return x.oStart - y.oStart; }); - let results = []; - let currOffset = 0; + var results = []; + var currOffset = 0; function advanceTo(endOffset) { if (endOffset > currOffset) { @@ -25206,17 +25234,17 @@ } while (hunks.length) { - let hunk = hunks.shift(); - let regionStart = hunk.oStart; - let regionEnd = hunk.oStart + hunk.oLength; - let regionHunks = [hunk]; + var hunk = hunks.shift(); + var regionStart = hunk.oStart; + var regionEnd = hunk.oStart + hunk.oLength; + var regionHunks = [hunk]; advanceTo(regionStart); // Try to pull next overlapping hunk into this region while (hunks.length) { - const nextHunk = hunks[0]; - const nextHunkStart = nextHunk.oStart; - if (nextHunkStart > regionEnd) break; // no overlap + var nextHunk = hunks[0]; + var nextHunkStart = nextHunk.oStart; + if (nextHunkStart > regionEnd) { break; } // no overlap regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength); regionHunks.push(hunks.shift()); @@ -25226,7 +25254,7 @@ // Only one hunk touches this region, meaning that there is no conflict here. // Either `a` or `b` is inserting into a region of `o` unchanged by the other. if (hunk.abLength > 0) { - const buffer = (hunk.ab === 'a' ? a : b); + var buffer = (hunk.ab === 'a' ? a : b); results.push({ stable: true, buffer: hunk.ab, @@ -25240,29 +25268,29 @@ // Effectively merge all the `a` hunks into one giant hunk, then do the // same for the `b` hunks; then, correct for skew in the regions of `o` // that each side changed, and report appropriate spans for the three sides. - let bounds = { + var bounds = { a: [a.length, -1, o.length, -1], b: [b.length, -1, o.length, -1] }; while (regionHunks.length) { hunk = regionHunks.shift(); - const oStart = hunk.oStart; - const oEnd = oStart + hunk.oLength; - const abStart = hunk.abStart; - const abEnd = abStart + hunk.abLength; - let b = bounds[hunk.ab]; - b[0] = Math.min(abStart, b[0]); - b[1] = Math.max(abEnd, b[1]); - b[2] = Math.min(oStart, b[2]); - b[3] = Math.max(oEnd, b[3]); - } - - const aStart = bounds.a[0] + (regionStart - bounds.a[2]); - const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]); - const bStart = bounds.b[0] + (regionStart - bounds.b[2]); - const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]); - - let result = { + var oStart = hunk.oStart; + var oEnd = oStart + hunk.oLength; + var abStart = hunk.abStart; + var abEnd = abStart + hunk.abLength; + var b$1 = bounds[hunk.ab]; + b$1[0] = Math.min(abStart, b$1[0]); + b$1[1] = Math.max(abEnd, b$1[1]); + b$1[2] = Math.min(oStart, b$1[2]); + b$1[3] = Math.max(oEnd, b$1[3]); + } + + var aStart = bounds.a[0] + (regionStart - bounds.a[2]); + var aEnd = bounds.a[1] + (regionEnd - bounds.a[3]); + var bStart = bounds.b[0] + (regionStart - bounds.b[2]); + var bEnd = bounds.b[1] + (regionEnd - bounds.b[3]); + + var result = { stable: false, aStart: aStart, aLength: aEnd - aStart, @@ -25290,24 +25318,24 @@ // between 'ok' and 'conflict' blocks. // A "false conflict" is where `a` and `b` both change the same from `o` function diff3Merge(a, o, b, options) { - let defaults = { + var defaults = { excludeFalseConflicts: true, stringSeparator: /\s+/ }; options = Object.assign(defaults, options); - const aString = (typeof a === 'string'); - const oString = (typeof o === 'string'); - const bString = (typeof b === 'string'); + var aString = (typeof a === 'string'); + var oString = (typeof o === 'string'); + var bString = (typeof b === 'string'); - if (aString) a = a.split(options.stringSeparator); - if (oString) o = o.split(options.stringSeparator); - if (bString) b = b.split(options.stringSeparator); + if (aString) { a = a.split(options.stringSeparator); } + if (oString) { o = o.split(options.stringSeparator); } + if (bString) { b = b.split(options.stringSeparator); } - let results = []; - const regions = diff3MergeRegions(a, o, b); + var results = []; + var regions = diff3MergeRegions(a, o, b); - let okBuffer = []; + var okBuffer = []; function flushOk() { if (okBuffer.length) { results.push({ ok: okBuffer }); @@ -25316,19 +25344,19 @@ } function isFalseConflict(a, b) { - if (a.length !== b.length) return false; - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; + if (a.length !== b.length) { return false; } + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { return false; } } return true; } - regions.forEach(region => { + regions.forEach(function (region) { if (region.stable) { - okBuffer.push(...region.bufferContent); + okBuffer.push.apply(okBuffer, region.bufferContent); } else { if (options.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) { - okBuffer.push(...region.aContent); + okBuffer.push.apply(okBuffer, region.aContent); } else { flushOk(); results.push({ @@ -25463,7 +25491,7 @@ _conflicts.push(_t('merge_remote_changes.conflict.deleted', { user: user(remote.user) })); } - if (_conflicts.length !== ccount) break; + if (_conflicts.length !== ccount) { break; } updates.replacements.push(target); } } @@ -25617,15 +25645,15 @@ function setupCache(graph) { function canMove(nodeID) { // Allow movement of any node that is in the selectedIDs list.. - if (moveIDs.indexOf(nodeID) !== -1) return true; + if (moveIDs.indexOf(nodeID) !== -1) { return true; } // Allow movement of a vertex where 2 ways meet.. var parents = graph.parentWays(graph.entity(nodeID)); - if (parents.length < 3) return true; + if (parents.length < 3) { return true; } // Restrict movement of a vertex where >2 ways meet, unless all parentWays are moving too.. var parentsMoving = parents.every(function(way) { return cache.moving[way.id]; }); - if (!parentsMoving) delete cache.moving[nodeID]; + if (!parentsMoving) { delete cache.moving[nodeID]; } return parentsMoving; } @@ -25633,11 +25661,11 @@ function cacheEntities(ids) { for (var i = 0; i < ids.length; i++) { var id = ids[i]; - if (cache.moving[id]) continue; + if (cache.moving[id]) { continue; } cache.moving[id] = true; var entity = graph.hasEntity(id); - if (!entity) continue; + if (!entity) { continue; } if (entity.type === 'node') { cache.nodes.push(id); @@ -25666,7 +25694,7 @@ for (var j = 0; j < childNodes.length; j++) { var node = childNodes[j]; var parents = graph.parentWays(node); - if (parents.length !== 2) continue; + if (parents.length !== 2) { continue; } var moved = graph.entity(id); var unmoved = null; @@ -25677,11 +25705,11 @@ break; } } - if (!unmoved) continue; + if (!unmoved) { continue; } // exclude ways that are overly connected.. - if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue; - if (moved.isArea() || unmoved.isArea()) continue; + if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) { continue; } + if (moved.isArea() || unmoved.isArea()) { continue; } cache.intersections.push({ nodeId: node.id, @@ -25751,7 +25779,7 @@ var next = graph.hasEntity(way.nodes[nextIndex]); // Don't add orig vertex at endpoint.. - if (!prev || !next) return graph; + if (!prev || !next) { return graph; } var key = wayId + '_' + nodeId; var orig = cache.replacedVertex[key]; @@ -25774,7 +25802,7 @@ geoAngle(orig, next, projection)) * 180 / Math.PI; // Don't add orig vertex if it would just make a straight line.. - if (angle > 175 && angle < 185) return graph; + if (angle > 175 && angle < 185) { return graph; } // moving forward or backward along way? var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection); @@ -25784,7 +25812,7 @@ var insertAt = (d1 <= d2) ? movedIndex : nextIndex; // moving around closed loop? - if (way.isClosed() && insertAt === 0) insertAt = len; + if (way.isClosed() && insertAt === 0) { insertAt = len; } way = way.addNode(orig.id, insertAt); return graph.replace(orig).replace(way); @@ -25849,13 +25877,13 @@ var isEP2 = intersection.unmovedIsEP; // don't move the vertex if it is the endpoint of both ways. - if (isEP1 && isEP2) return graph; + if (isEP1 && isEP2) { return graph; } var nodes1 = graph.childNodes(way1).filter(function(n) { return n !== vertex; }); var nodes2 = graph.childNodes(way2).filter(function(n) { return n !== vertex; }); - if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]); - if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]); + if (way1.isClosed() && way1.first() === vertex.id) { nodes1.push(nodes1[0]); } + if (way2.isClosed() && way2.first() === vertex.id) { nodes2.push(nodes2[0]); } var edge1 = !isEP1 && geoChooseEdge(nodes1, projection(vertex.loc), projection); var edge2 = !isEP2 && geoChooseEdge(nodes2, projection(vertex.loc), projection); @@ -25868,7 +25896,7 @@ loc = geoVecInterp(edge1.loc, edge2.loc, 0.5); edge1 = geoChooseEdge(nodes1, projection(loc), projection); edge2 = geoChooseEdge(nodes2, projection(loc), projection); - if (Math.abs(edge1.distance - edge2.distance) < epsilon) break; + if (Math.abs(edge1.distance - edge2.distance) < epsilon) { break; } } } else if (!isEP1) { loc = edge1.loc; @@ -25916,9 +25944,9 @@ var obj = cache.intersections[i]; // Don't limit movement if this is vertex joins 2 endpoints.. - if (obj.movedIsEP && obj.unmovedIsEP) continue; + if (obj.movedIsEP && obj.unmovedIsEP) { continue; } // Don't limit movement if this vertex is not an endpoint anyway.. - if (!obj.movedIsEP) continue; + if (!obj.movedIsEP) { continue; } var node = graph.entity(obj.nodeId); var start = projection(node.loc); @@ -25930,7 +25958,7 @@ var hits = geoPathIntersections(movedPath, unmovedPath); for (var j = 0; i < hits.length; i++) { - if (geoVecEqual(hits[j], end)) continue; + if (geoVecEqual(hits[j], end)) { continue; } var edge = geoChooseEdge(unmovedNodes, end, projection); _delta = geoVecSubtract(projection(edge.loc), start); } @@ -25939,7 +25967,7 @@ var action = function(graph) { - if (_delta[0] === 0 && _delta[1] === 0) return graph; + if (_delta[0] === 0 && _delta[1] === 0) { return graph; } setupCache(graph); @@ -25979,7 +26007,7 @@ function actionMoveNode(nodeID, toLoc) { var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var node = graph.entity(nodeID); @@ -26009,7 +26037,7 @@ var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var way = graph.entity(wayID); @@ -26026,11 +26054,11 @@ var isClosed = way.isClosed(); var nodes = graph.childNodes(way).slice(); // shallow copy - if (isClosed) nodes.pop(); + if (isClosed) { nodes.pop(); } if (vertexID !== undefined) { nodes = nodeSubset(nodes, vertexID, isClosed); - if (nodes.length !== 3) return graph; + if (nodes.length !== 3) { return graph; } } // note: all geometry functions here use the unclosed node/point/coord list @@ -26106,7 +26134,7 @@ } var bestCoords = bestPoints.map(function(p) { return p.coord; }); - if (isClosed) bestCoords.push(bestCoords[0]); + if (isClosed) { bestCoords.push(bestCoords[0]); } // move the nodes that should move for (i = 0; i < bestPoints.length; i++) { @@ -26121,7 +26149,7 @@ // move the nodes along straight segments for (i = 0; i < straights.length; i++) { point = straights[i]; - if (nodeCount[point.id] > 1) continue; // skip self-intersections + if (nodeCount[point.id] > 1) { continue; } // skip self-intersections node = graph.entity(point.id); @@ -26156,9 +26184,9 @@ function calcMotion(point, i, array) { // don't try to move the endpoints of a non-closed way. - if (!isClosed && (i === 0 || i === array.length - 1)) return [0, 0]; + if (!isClosed && (i === 0 || i === array.length - 1)) { return [0, 0]; } // don't try to move a node that appears more than once (self intersection) - if (nodeCount[array[i].id] > 1) return [0, 0]; + if (nodeCount[array[i].id] > 1) { return [0, 0]; } var a = array[(i - 1 + array.length) % array.length].coord; var origin = point.coord; @@ -26212,13 +26240,13 @@ var isClosed = way.isClosed(); var nodes = graph.childNodes(way).slice(); // shallow copy - if (isClosed) nodes.pop(); + if (isClosed) { nodes.pop(); } var allowStraightAngles = false; if (vertexID !== undefined) { allowStraightAngles = true; nodes = nodeSubset(nodes, vertexID, isClosed); - if (nodes.length !== 3) return 'end_vertex'; + if (nodes.length !== 3) { return 'end_vertex'; } } var coords = nodes.map(function(n) { return projection(n.loc); }); @@ -26364,7 +26392,7 @@ var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var nodes = nodeIDs.map(function(id) { return graph.entity(id); }); @@ -26506,7 +26534,7 @@ var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var nodes = allNodes(graph); @@ -26605,7 +26633,7 @@ var action = function(graph, t) { - if (t === null || !isFinite(t)) t = 1; + if (t === null || !isFinite(t)) { t = 1; } t = Math.min(Math.max(+t, 0), 1); var nodes = utilGetAllNodes(reflectIds, graph); @@ -26653,7 +26681,7 @@ action.useLongAxis = function(val) { - if (!arguments.length) return _useLongAxis; + if (!arguments.length) { return _useLongAxis; } _useLongAxis = val; return action; }; @@ -26817,7 +26845,7 @@ function eventTarget() { var datum = event.target && event.target.__data__; - if (typeof datum !== 'object') return null; + if (typeof datum !== 'object') { return null; } if (!(datum instanceof osmEntity) && datum.properties && (datum.properties.entity instanceof osmEntity)) { return datum.properties.entity; } @@ -26828,7 +26856,7 @@ // ignore mouse hovers with buttons pressed unless dragging if (context.mode().id.indexOf('drag') === -1 && (!event.pointerType || event.pointerType === 'mouse') && - event.buttons) return; + event.buttons) { return; } var target = eventTarget(); if (target && _targets.indexOf(target) === -1) { @@ -26947,13 +26975,13 @@ behavior.altDisables = function(val) { - if (!arguments.length) return _altDisables; + if (!arguments.length) { return _altDisables; } _altDisables = val; return behavior; }; behavior.ignoreVertex = function(val) { - if (!arguments.length) return _ignoreVertex; + if (!arguments.length) { return _ignoreVertex; } _ignoreVertex = val; return behavior; }; @@ -27000,7 +27028,7 @@ function datum() { var mode = context.mode(); var isNote = mode && (mode.id.indexOf('note') !== -1); - if (event.altKey || isNote) return {}; + if (event.altKey || isNote) { return {}; } var element; if (event.type === 'keydown') { @@ -27017,7 +27045,7 @@ function pointerdown() { - if (_downPointer) return; + if (_downPointer) { return; } var pointerLocGetter = utilFastMouse(this); _downPointer = { @@ -27032,14 +27060,14 @@ function pointerup() { - if (!_downPointer || _downPointer.id !== (event.pointerId || 'mouse')) return; + if (!_downPointer || _downPointer.id !== (event.pointerId || 'mouse')) { return; } var downPointer = _downPointer; _downPointer = null; _lastPointerUpEvent = event; - if (downPointer.isCancelled) return; + if (downPointer.isCancelled) { return; } var t2 = +new Date(); var p2 = downPointer.pointerLocGetter(event); @@ -27076,13 +27104,13 @@ if ((event.pointerType && event.pointerType !== 'mouse') || event.buttons || - _downPointer) return; + _downPointer) { return; } // HACK: Mobile Safari likes to send one or more `mouse` type pointermove // events immediately after non-mouse pointerup events; detect and ignore them. if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== 'mouse' && - event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return; + event.timeStamp - _lastPointerUpEvent.timeStamp < 100) { return; } _lastMouse = event; dispatch$1.call('move', this, datum()); @@ -27154,7 +27182,7 @@ } } - if (_disableSpace || _mouseLeave || !_lastMouse) return; + if (_disableSpace || _mouseLeave || !_lastMouse) { return; } // user must move mouse or release space bar to allow another click _lastSpace = currSpace; @@ -27283,34 +27311,34 @@ return property in this && delete this[property]; }, clear: function() { - for (var property in this) if (property[0] === prefix) delete this[property]; + for (var property in this) { if (property[0] === prefix) { delete this[property]; } } }, keys: function() { var keys = []; - for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); + for (var property in this) { if (property[0] === prefix) { keys.push(property.slice(1)); } } return keys; }, values: function() { var values = []; - for (var property in this) if (property[0] === prefix) values.push(this[property]); + for (var property in this) { if (property[0] === prefix) { values.push(this[property]); } } return values; }, entries: function() { var entries = []; - for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); + for (var property in this) { if (property[0] === prefix) { entries.push({key: property.slice(1), value: this[property]}); } } return entries; }, size: function() { var size = 0; - for (var property in this) if (property[0] === prefix) ++size; + for (var property in this) { if (property[0] === prefix) { ++size; } } return size; }, empty: function() { - for (var property in this) if (property[0] === prefix) return false; + for (var property in this) { if (property[0] === prefix) { return false; } } return true; }, each: function(f) { - for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); + for (var property in this) { if (property[0] === prefix) { f(this[property], property.slice(1), this); } } } }; @@ -27318,7 +27346,7 @@ var map = new Map$1; // Copy constructor. - if (object instanceof Map$1) object.each(function(value, key) { map.set(key, value); }); + if (object instanceof Map$1) { object.each(function(value, key) { map.set(key, value); }); } // Index array by numeric index or specified key function. else if (Array.isArray(object)) { @@ -27326,12 +27354,12 @@ n = object.length, o; - if (f == null) while (++i < n) map.set(i, object[i]); - else while (++i < n) map.set(f(o = object[i], i, object), o); + if (f == null) { while (++i < n) { map.set(i, object[i]); } } + else { while (++i < n) { map.set(f(o = object[i], i, object), o); } } } // Convert object to map. - else if (object) for (var key in object) map.set(key, object[key]); + else if (object) { for (var key in object) { map.set(key, object[key]); } } return map; } @@ -27360,13 +27388,13 @@ var set = new Set$1; // Copy constructor. - if (object instanceof Set$1) object.each(function(value) { set.add(value); }); + if (object instanceof Set$1) { object.each(function(value) { set.add(value); }); } // Otherwise, assume it’s an array. else if (object) { var i = -1, n = object.length; - if (f == null) while (++i < n) set.add(object[i]); - else while (++i < n) set.add(f(object[i], i, object)); + if (f == null) { while (++i < n) { set.add(object[i]); } } + else { while (++i < n) { set.add(f(object[i], i, object)); } } } return set; @@ -27401,7 +27429,7 @@ function clamper(domain) { var a = domain[0], b = domain[domain.length - 1], t; - if (a > b) t = a, a = b, b = t; + if (a > b) { t = a, a = b, b = t; } return function(x) { return Math.max(a, Math.min(b, x)); }; } @@ -27409,8 +27437,8 @@ // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. function bimap(domain, range, interpolate) { var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); + if (d1 < d0) { d0 = normalize(d1, d0), r0 = interpolate(r1, r0); } + else { d0 = normalize(d0, d1), r0 = interpolate(r0, r1); } return function(x) { return r0(d0(x)); }; } @@ -27510,7 +27538,7 @@ // significant digits p, where x is positive and p is in [1, 21] or undefined. // For example, formatDecimal(1.23) returns ["123", 0]. function formatDecimal(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity + if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) { return null; } // NaN, ±Infinity var i, coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ @@ -27534,9 +27562,9 @@ length = 0; while (i > 0 && g > 0) { - if (length + g + 1 > width) g = Math.max(1, width - length); + if (length + g + 1 > width) { g = Math.max(1, width - length); } t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; + if ((length += g + 1) > width) { break; } g = grouping[j = (j + 1) % grouping.length]; } @@ -27556,7 +27584,7 @@ var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); + if (!(match = re.exec(specifier))) { throw new Error("invalid format: " + specifier); } var match; return new FormatSpecifier({ fill: match[1], @@ -27605,8 +27633,8 @@ out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { switch (s[i]) { case ".": i0 = i1 = i; break; - case "0": if (i0 === 0) i0 = i; i1 = i; break; - default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; + case "0": if (i0 === 0) { i0 = i; } i1 = i; break; + default: if (!+s[i]) { break out; } if (i0 > 0) { i0 = 0; } break; } } return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; @@ -27616,7 +27644,7 @@ function formatPrefixAuto(x, p) { var d = formatDecimal(x, p); - if (!d) return x + ""; + if (!d) { return x + ""; } var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, @@ -27629,7 +27657,7 @@ function formatRounded(x, p) { var d = formatDecimal(x, p); - if (!d) return x + ""; + if (!d) { return x + ""; } var coefficient = d[0], exponent = d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient @@ -27685,13 +27713,13 @@ type = specifier.type; // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; + if (type === "n") { comma = true, type = "g"; } // The "" type, and any invalid type, is an alias for ".12~g". - else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; + else if (!formatTypes[type]) { precision === undefined && (precision = 12), trim = true, type = "g"; } // If zero fill is specified, padding goes after sign and before digits. - if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; + if (zero || (fill === "0" && align === "=")) { zero = true, fill = "0", align = "="; } // Compute the prefix and suffix. // For SI-prefix, the suffix is lazily computed. @@ -27730,10 +27758,10 @@ value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros. - if (trim) value = formatTrim(value); + if (trim) { value = formatTrim(value); } // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; + if (valueNegative && +value === 0 && sign !== "+") { valueNegative = false; } // Compute the prefix and suffix. valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; @@ -27754,14 +27782,14 @@ } // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); + if (comma && !zero) { value = group(value, Infinity); } // Compute the padding. var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; + if (comma && zero) { value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; } // Reconstruct the final output based on the desired alignment. switch (align) { @@ -27836,7 +27864,7 @@ switch (specifier.type) { case "s": { var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) { specifier.precision = precision; } return formatPrefix(specifier, value); } case "": @@ -27844,12 +27872,12 @@ case "g": case "p": case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) { specifier.precision = precision - (specifier.type === "e"); } break; } case "f": case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) { specifier.precision = precision - (specifier.type === "%") * 2; } break; } } @@ -27870,7 +27898,7 @@ }; scale.nice = function(count) { - if (count == null) count = 10; + if (count == null) { count = 10; } var d = domain(), i0 = 0, @@ -27939,7 +27967,7 @@ function rescale() { var i = -1; domain = new Array(n); - while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); + while (++i < n) { domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); } return scale; } @@ -28158,7 +28186,7 @@ function keypress() { // prevent operations during low zoom selection - if (!context.map().withinEditableZoom()) return; + if (!context.map().withinEditableZoom()) { return; } event.preventDefault(); var disabled = _operation.disabled(); @@ -28177,7 +28205,7 @@ .iconClass('operation') .text(_operation.annotation() || _operation.title)(); - if (_operation.point) _operation.point(null); + if (_operation.point) { _operation.point(null); } _operation(); } } @@ -28200,7 +28228,7 @@ behavior.which = function (_) { - if (!arguments.length) return _operation; + if (!arguments.length) { return _operation; } _operation = _; return behavior; }; @@ -28220,7 +28248,7 @@ var entity = context.entity(entityID); - if (entity.type !== 'way' || new Set(entity.nodes).size <= 1) return null; + if (entity.type !== 'way' || new Set(entity.nodes).size <= 1) { return null; } if (!_extent) { _extent = entity.extent(context.graph()); @@ -28232,7 +28260,7 @@ } var operation = function() { - if (!_actions.length) return; + if (!_actions.length) { return; } var combinedAction = function(graph, t) { _actions.forEach(function(action) { @@ -28259,7 +28287,7 @@ // don't cache this because the visible extent could change operation.disabled = function() { - if (!_actions.length) return ''; + if (!_actions.length) { return ''; } var actionDisableds = _actions.map(function(action) { return action.disabled(context.graph()); @@ -28284,7 +28312,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = _coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -28329,7 +28357,7 @@ } if (detected.os === 'win') { - if (code === '⌘⇧Z') return 'Ctrl+Y'; + if (code === '⌘⇧Z') { return 'Ctrl+Y'; } } var result = '', @@ -28355,7 +28383,7 @@ // return a display-focused string for a given keyboard code uiCmd.display = function(code) { - if (code.length !== 1) return code; + if (code.length !== 1) { return code; } var detected = utilDetect(); var mac = (detected.os === 'mac'); @@ -28458,7 +28486,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -28482,7 +28510,7 @@ function protectedMember(id) { var entity = context.entity(id); - if (entity.type !== 'way') return false; + if (entity.type !== 'way') { return false; } var parents = context.graph().parentRelations(entity); for (var i = 0; i < parents.length; i++) { @@ -28543,13 +28571,13 @@ // square a line/area if (entity.type === 'way' && new Set(entity.nodes).size > 2 ) { - if (_type && _type !== 'feature') return null; + if (_type && _type !== 'feature') { return null; } _type = 'feature'; return actionOrthogonalize(entityID, context.projection); // square a single vertex } else if (geometry === 'vertex') { - if (_type && _type !== 'corner') return null; + if (_type && _type !== 'corner') { return null; } _type = 'corner'; var graph = context.graph(); var parents = graph.parentWays(entity); @@ -28566,7 +28594,7 @@ var operation = function() { - if (!_actions.length) return; + if (!_actions.length) { return; } var combinedAction = function(graph, t) { _actions.forEach(function(action) { @@ -28593,7 +28621,7 @@ // don't cache this because the visible extent could change operation.disabled = function() { - if (!_actions.length) return ''; + if (!_actions.length) { return ''; } var actionDisableds = _actions.map(function(action) { return action.disabled(context.graph()); @@ -28619,7 +28647,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = _coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -28705,7 +28733,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -28778,7 +28806,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -28874,7 +28902,7 @@ var currMouse = context.map().mouse(); var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]); - if (typeof _prevAngle === 'undefined') _prevAngle = currAngle; + if (typeof _prevAngle === 'undefined') { _prevAngle = currAngle; } var delta = currAngle - _prevAngle; fn(actionRotate(entityIDs, _pivot, delta, projection)); @@ -28959,7 +28987,7 @@ mode.selectedIDs = function() { - if (!arguments.length) return entityIDs; + if (!arguments.length) { return entityIDs; } // no assign return mode; }; @@ -29001,7 +29029,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -29093,7 +29121,7 @@ function startNudge(nudge) { - if (_nudgeInterval) window.clearInterval(_nudgeInterval); + if (_nudgeInterval) { window.clearInterval(_nudgeInterval); } _nudgeInterval = window.setInterval(function() { context.map().pan(nudge); doMove(nudge); @@ -29130,7 +29158,7 @@ function cancel() { if (baseGraph) { - while (context.graph() !== baseGraph) context.pop(); + while (context.graph() !== baseGraph) { context.pop(); } context.enter(modeBrowse(context)); } else { context.pop(); @@ -29192,7 +29220,7 @@ mode.selectedIDs = function() { - if (!arguments.length) return entityIDs; + if (!arguments.length) { return entityIDs; } // no assign return mode; }; @@ -29206,7 +29234,7 @@ function doPaste() { // prevent paste during low zoom selection - if (!context.map().withinEditableZoom()) return; + if (!context.map().withinEditableZoom()) { return; } event.preventDefault(); @@ -29215,10 +29243,10 @@ var projection = context.projection; var viewport = geoExtent(projection.clipExtent()).polygon(); - if (!geoPointInPolygon(mouse, viewport)) return; + if (!geoPointInPolygon(mouse, viewport)) { return; } var oldIDs = context.copyIDs(); - if (!oldIDs.length) return; + if (!oldIDs.length) { return; } var extent = geoExtent(); var oldGraph = context.copyGraph(); @@ -29324,7 +29352,7 @@ function pointerdown() { - if (_pointerId) return; + if (_pointerId) { return; } _pointerId = event.pointerId || 'mouse'; @@ -29354,7 +29382,7 @@ function pointermove() { - if (_pointerId !== (event.pointerId || 'mouse')) return; + if (_pointerId !== (event.pointerId || 'mouse')) { return; } var p = pointerLocGetter(event); @@ -29362,7 +29390,7 @@ var dist = geoVecLength(startOrigin, p); var tolerance = event.pointerType === 'pen' ? _penTolerancePx : _tolerancePx; // don't start until the drag has actually moved somewhat - if (dist < tolerance) return; + if (dist < tolerance) { return; } started = true; _event({ type: 'start' }); @@ -29387,7 +29415,7 @@ function pointerup() { - if (_pointerId !== (event.pointerId || 'mouse')) return; + if (_pointerId !== (event.pointerId || 'mouse')) { return; } _pointerId = null; @@ -29440,14 +29468,14 @@ behavior.selector = function(_) { - if (!arguments.length) return _selector; + if (!arguments.length) { return _selector; } _selector = _; return behavior; }; behavior.origin = function(_) { - if (!arguments.length) return _origin; + if (!arguments.length) { return _origin; } _origin = _; return behavior; }; @@ -29462,7 +29490,7 @@ behavior.target = function() { - if (!arguments.length) return _target; + if (!arguments.length) { return _target; } _target = arguments[0]; _event = eventOf(_target, Array.prototype.slice.call(arguments, 1)); return behavior; @@ -29470,7 +29498,7 @@ behavior.surface = function() { - if (!arguments.length) return _surface; + if (!arguments.length) { return _surface; } _surface = arguments[0]; return behavior; }; @@ -29498,7 +29526,7 @@ function startNudge(entity, nudge) { - if (_nudgeInterval) window.clearInterval(_nudgeInterval); + if (_nudgeInterval) { window.clearInterval(_nudgeInterval); } _nudgeInterval = window.setInterval(function() { context.map().pan(nudge); doMove(entity, nudge); @@ -29540,7 +29568,7 @@ function shouldSnapToNode(target) { - if (!_activeEntity) return false; + if (!_activeEntity) { return false; } return _activeEntity.geometry(context.graph()) !== 'vertex' || (target.geometry(context.graph()) === 'vertex' || _mainPresetIndex.allowsVertex(target, context.graph())); } @@ -29753,7 +29781,7 @@ // test any parent multipolygons for valid geometry var relations = graph.parentRelations(parent); for (j = 0; j < relations.length; j++) { - if (!relations[j].isMultipolygon()) continue; + if (!relations[j].isMultipolygon()) { continue; } var rings = osmJoinWays(relations[j].members, graph); @@ -29771,7 +29799,7 @@ // test active ring for intersections with other rings in the multipolygon for (k = 0; k < rings.length; k++) { - if (k === activeIndex) continue; + if (k === activeIndex) { continue; } // make sure active ring doesnt cross passive rings if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) { @@ -29797,7 +29825,7 @@ function move(entity) { - if (_isCancelled) return; + if (_isCancelled) { return; } event.sourceEvent.stopPropagation(); context.surface().classed('nope-disabled', event.sourceEvent.altKey); @@ -29814,7 +29842,7 @@ } function end(entity) { - if (_isCancelled) return; + if (_isCancelled) { return; } var wasPoint = entity.geometry(context.graph()) === 'point'; @@ -29878,7 +29906,7 @@ var action = function(graph, t) { // last time through, pop off the bounceback perform. // it will then overwrite the initial perform with a moveNode that does nothing - if (t === 1) context.pop(); + if (t === 1) { context.pop(); } return moveNode(graph, t); }; action.transitionable = true; @@ -29940,21 +29968,21 @@ mode.selectedIDs = function() { - if (!arguments.length) return _activeEntity ? [_activeEntity.id] : []; + if (!arguments.length) { return _activeEntity ? [_activeEntity.id] : []; } // no assign return mode; }; mode.activeID = function() { - if (!arguments.length) return _activeEntity && _activeEntity.id; + if (!arguments.length) { return _activeEntity && _activeEntity.id; } // no assign return mode; }; mode.restoreSelectedIDs = function(_) { - if (!arguments.length) return _restoreSelectedIDs; + if (!arguments.length) { return _restoreSelectedIDs; } _restoreSelectedIDs = _; return mode; }; @@ -29989,24 +30017,24 @@ var j = right; swap(arr, left, k); - if (compare(arr[right], t) > 0) swap(arr, left, right); + if (compare(arr[right], t) > 0) { swap(arr, left, right); } while (i < j) { swap(arr, i, j); i++; j--; - while (compare(arr[i], t) < 0) i++; - while (compare(arr[j], t) > 0) j--; + while (compare(arr[i], t) < 0) { i++; } + while (compare(arr[j], t) > 0) { j--; } } - if (compare(arr[left], t) === 0) swap(arr, left, j); + if (compare(arr[left], t) === 0) { swap(arr, left, j); } else { j++; swap(arr, j, right); } - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; + if (j <= k) { left = j + 1; } + if (k <= j) { right = j - 1; } } } @@ -30020,418 +30048,418 @@ return a < b ? -1 : a > b ? 1 : 0; } - class RBush { - constructor(maxEntries = 9) { - // max entries in a node is 9 by default; min node fill is 40% for best performance - this._maxEntries = Math.max(4, maxEntries); - this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); - this.clear(); - } + var RBush = function RBush(maxEntries) { + if ( maxEntries === void 0 ) maxEntries = 9; - all() { - return this._all(this.data, []); - } + // max entries in a node is 9 by default; min node fill is 40% for best performance + this._maxEntries = Math.max(4, maxEntries); + this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); + this.clear(); + }; + + RBush.prototype.all = function all () { + return this._all(this.data, []); + }; - search(bbox) { - let node = this.data; - const result = []; + RBush.prototype.search = function search (bbox) { + var node = this.data; + var result = []; - if (!intersects(bbox, node)) return result; + if (!intersects(bbox, node)) { return result; } - const toBBox = this.toBBox; - const nodesToSearch = []; + var toBBox = this.toBBox; + var nodesToSearch = []; - while (node) { - for (let i = 0; i < node.children.length; i++) { - const child = node.children[i]; - const childBBox = node.leaf ? toBBox(child) : child; - - if (intersects(bbox, childBBox)) { - if (node.leaf) result.push(child); - else if (contains$1(bbox, childBBox)) this._all(child, result); - else nodesToSearch.push(child); - } + while (node) { + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var childBBox = node.leaf ? toBBox(child) : child; + + if (intersects(bbox, childBBox)) { + if (node.leaf) { result.push(child); } + else if (contains$1(bbox, childBBox)) { this._all(child, result); } + else { nodesToSearch.push(child); } } - node = nodesToSearch.pop(); } - - return result; + node = nodesToSearch.pop(); } - collides(bbox) { - let node = this.data; + return result; + }; - if (!intersects(bbox, node)) return false; + RBush.prototype.collides = function collides (bbox) { + var node = this.data; - const nodesToSearch = []; - while (node) { - for (let i = 0; i < node.children.length; i++) { - const child = node.children[i]; - const childBBox = node.leaf ? this.toBBox(child) : child; + if (!intersects(bbox, node)) { return false; } - if (intersects(bbox, childBBox)) { - if (node.leaf || contains$1(bbox, childBBox)) return true; - nodesToSearch.push(child); - } + var nodesToSearch = []; + while (node) { + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var childBBox = node.leaf ? this.toBBox(child) : child; + + if (intersects(bbox, childBBox)) { + if (node.leaf || contains$1(bbox, childBBox)) { return true; } + nodesToSearch.push(child); } - node = nodesToSearch.pop(); } - - return false; + node = nodesToSearch.pop(); } - load(data) { - if (!(data && data.length)) return this; + return false; + }; - if (data.length < this._minEntries) { - for (let i = 0; i < data.length; i++) { - this.insert(data[i]); - } - return this; + RBush.prototype.load = function load (data) { + if (!(data && data.length)) { return this; } + + if (data.length < this._minEntries) { + for (var i = 0; i < data.length; i++) { + this.insert(data[i]); } + return this; + } - // recursively build the tree with the given data from scratch using OMT algorithm - let node = this._build(data.slice(), 0, data.length - 1, 0); + // recursively build the tree with the given data from scratch using OMT algorithm + var node = this._build(data.slice(), 0, data.length - 1, 0); - if (!this.data.children.length) { - // save as is if tree is empty - this.data = node; - - } else if (this.data.height === node.height) { - // split root if trees have the same height - this._splitRoot(this.data, node); + if (!this.data.children.length) { + // save as is if tree is empty + this.data = node; - } else { - if (this.data.height < node.height) { - // swap trees if inserted one is bigger - const tmpNode = this.data; - this.data = node; - node = tmpNode; - } + } else if (this.data.height === node.height) { + // split root if trees have the same height + this._splitRoot(this.data, node); - // insert the small tree into the large tree at appropriate level - this._insert(node, this.data.height - node.height - 1, true); + } else { + if (this.data.height < node.height) { + // swap trees if inserted one is bigger + var tmpNode = this.data; + this.data = node; + node = tmpNode; } - return this; + // insert the small tree into the large tree at appropriate level + this._insert(node, this.data.height - node.height - 1, true); } - insert(item) { - if (item) this._insert(item, this.data.height - 1); - return this; - } + return this; + }; - clear() { - this.data = createNode([]); - return this; - } + RBush.prototype.insert = function insert (item) { + if (item) { this._insert(item, this.data.height - 1); } + return this; + }; - remove(item, equalsFn) { - if (!item) return this; + RBush.prototype.clear = function clear () { + this.data = createNode([]); + return this; + }; - let node = this.data; - const bbox = this.toBBox(item); - const path = []; - const indexes = []; - let i, parent, goingUp; + RBush.prototype.remove = function remove (item, equalsFn) { + if (!item) { return this; } - // depth-first iterative tree traversal - while (node || path.length) { + var node = this.data; + var bbox = this.toBBox(item); + var path = []; + var indexes = []; + var i, parent, goingUp; - if (!node) { // go up - node = path.pop(); - parent = path[path.length - 1]; - i = indexes.pop(); - goingUp = true; - } + // depth-first iterative tree traversal + while (node || path.length) { - if (node.leaf) { // check current node - const index = findItem(item, node.children, equalsFn); + if (!node) { // go up + node = path.pop(); + parent = path[path.length - 1]; + i = indexes.pop(); + goingUp = true; + } - if (index !== -1) { - // item found, remove the item and condense tree upwards - node.children.splice(index, 1); - path.push(node); - this._condense(path); - return this; - } - } + if (node.leaf) { // check current node + var index = findItem(item, node.children, equalsFn); - if (!goingUp && !node.leaf && contains$1(node, bbox)) { // go down + if (index !== -1) { + // item found, remove the item and condense tree upwards + node.children.splice(index, 1); path.push(node); - indexes.push(i); - i = 0; - parent = node; - node = node.children[0]; + this._condense(path); + return this; + } + } - } else if (parent) { // go right - i++; - node = parent.children[i]; - goingUp = false; + if (!goingUp && !node.leaf && contains$1(node, bbox)) { // go down + path.push(node); + indexes.push(i); + i = 0; + parent = node; + node = node.children[0]; - } else node = null; // nothing found - } + } else if (parent) { // go right + i++; + node = parent.children[i]; + goingUp = false; - return this; + } else { node = null; } // nothing found } - toBBox(item) { return item; } + return this; + }; - compareMinX(a, b) { return a.minX - b.minX; } - compareMinY(a, b) { return a.minY - b.minY; } + RBush.prototype.toBBox = function toBBox (item) { return item; }; - toJSON() { return this.data; } + RBush.prototype.compareMinX = function compareMinX (a, b) { return a.minX - b.minX; }; + RBush.prototype.compareMinY = function compareMinY (a, b) { return a.minY - b.minY; }; - fromJSON(data) { - this.data = data; - return this; - } + RBush.prototype.toJSON = function toJSON () { return this.data; }; - _all(node, result) { - const nodesToSearch = []; - while (node) { - if (node.leaf) result.push(...node.children); - else nodesToSearch.push(...node.children); + RBush.prototype.fromJSON = function fromJSON (data) { + this.data = data; + return this; + }; - node = nodesToSearch.pop(); - } - return result; + RBush.prototype._all = function _all (node, result) { + var nodesToSearch = []; + while (node) { + if (node.leaf) { result.push.apply(result, node.children); } + else { nodesToSearch.push.apply(nodesToSearch, node.children); } + + node = nodesToSearch.pop(); } + return result; + }; - _build(items, left, right, height) { + RBush.prototype._build = function _build (items, left, right, height) { - const N = right - left + 1; - let M = this._maxEntries; - let node; + var N = right - left + 1; + var M = this._maxEntries; + var node; - if (N <= M) { - // reached leaf level; return leaf - node = createNode(items.slice(left, right + 1)); - calcBBox(node, this.toBBox); - return node; - } + if (N <= M) { + // reached leaf level; return leaf + node = createNode(items.slice(left, right + 1)); + calcBBox(node, this.toBBox); + return node; + } - if (!height) { - // target height of the bulk-loaded tree - height = Math.ceil(Math.log(N) / Math.log(M)); + if (!height) { + // target height of the bulk-loaded tree + height = Math.ceil(Math.log(N) / Math.log(M)); - // target number of root entries to maximize storage utilization - M = Math.ceil(N / Math.pow(M, height - 1)); - } + // target number of root entries to maximize storage utilization + M = Math.ceil(N / Math.pow(M, height - 1)); + } - node = createNode([]); - node.leaf = false; - node.height = height; + node = createNode([]); + node.leaf = false; + node.height = height; - // split the items into M mostly square tiles + // split the items into M mostly square tiles - const N2 = Math.ceil(N / M); - const N1 = N2 * Math.ceil(Math.sqrt(M)); + var N2 = Math.ceil(N / M); + var N1 = N2 * Math.ceil(Math.sqrt(M)); - multiSelect(items, left, right, N1, this.compareMinX); + multiSelect(items, left, right, N1, this.compareMinX); - for (let i = left; i <= right; i += N1) { + for (var i = left; i <= right; i += N1) { - const right2 = Math.min(i + N1 - 1, right); + var right2 = Math.min(i + N1 - 1, right); - multiSelect(items, i, right2, N2, this.compareMinY); + multiSelect(items, i, right2, N2, this.compareMinY); - for (let j = i; j <= right2; j += N2) { + for (var j = i; j <= right2; j += N2) { - const right3 = Math.min(j + N2 - 1, right2); + var right3 = Math.min(j + N2 - 1, right2); - // pack each entry recursively - node.children.push(this._build(items, j, right3, height - 1)); - } + // pack each entry recursively + node.children.push(this._build(items, j, right3, height - 1)); } + } - calcBBox(node, this.toBBox); + calcBBox(node, this.toBBox); - return node; - } + return node; + }; - _chooseSubtree(bbox, node, level, path) { - while (true) { - path.push(node); + RBush.prototype._chooseSubtree = function _chooseSubtree (bbox, node, level, path) { + while (true) { + path.push(node); - if (node.leaf || path.length - 1 === level) break; + if (node.leaf || path.length - 1 === level) { break; } - let minArea = Infinity; - let minEnlargement = Infinity; - let targetNode; + var minArea = Infinity; + var minEnlargement = Infinity; + var targetNode = (void 0); - for (let i = 0; i < node.children.length; i++) { - const child = node.children[i]; - const area = bboxArea(child); - const enlargement = enlargedArea(bbox, child) - area; + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + var area = bboxArea(child); + var enlargement = enlargedArea(bbox, child) - area; - // choose entry with the least area enlargement - if (enlargement < minEnlargement) { - minEnlargement = enlargement; - minArea = area < minArea ? area : minArea; - targetNode = child; + // choose entry with the least area enlargement + if (enlargement < minEnlargement) { + minEnlargement = enlargement; + minArea = area < minArea ? area : minArea; + targetNode = child; - } else if (enlargement === minEnlargement) { - // otherwise choose one with the smallest area - if (area < minArea) { - minArea = area; - targetNode = child; - } + } else if (enlargement === minEnlargement) { + // otherwise choose one with the smallest area + if (area < minArea) { + minArea = area; + targetNode = child; } } - - node = targetNode || node.children[0]; } - return node; + node = targetNode || node.children[0]; } - _insert(item, level, isNode) { - const bbox = isNode ? item : this.toBBox(item); - const insertPath = []; + return node; + }; - // find the best node for accommodating the item, saving all nodes along the path too - const node = this._chooseSubtree(bbox, this.data, level, insertPath); + RBush.prototype._insert = function _insert (item, level, isNode) { + var bbox = isNode ? item : this.toBBox(item); + var insertPath = []; - // put the item into the node - node.children.push(item); - extend$1(node, bbox); + // find the best node for accommodating the item, saving all nodes along the path too + var node = this._chooseSubtree(bbox, this.data, level, insertPath); - // split on node overflow; propagate upwards if necessary - while (level >= 0) { - if (insertPath[level].children.length > this._maxEntries) { - this._split(insertPath, level); - level--; - } else break; - } + // put the item into the node + node.children.push(item); + extend$1(node, bbox); - // adjust bboxes along the insertion path - this._adjustParentBBoxes(bbox, insertPath, level); + // split on node overflow; propagate upwards if necessary + while (level >= 0) { + if (insertPath[level].children.length > this._maxEntries) { + this._split(insertPath, level); + level--; + } else { break; } } - // split overflowed node into two - _split(insertPath, level) { - const node = insertPath[level]; - const M = node.children.length; - const m = this._minEntries; + // adjust bboxes along the insertion path + this._adjustParentBBoxes(bbox, insertPath, level); + }; - this._chooseSplitAxis(node, m, M); + // split overflowed node into two + RBush.prototype._split = function _split (insertPath, level) { + var node = insertPath[level]; + var M = node.children.length; + var m = this._minEntries; - const splitIndex = this._chooseSplitIndex(node, m, M); + this._chooseSplitAxis(node, m, M); - const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); - newNode.height = node.height; - newNode.leaf = node.leaf; + var splitIndex = this._chooseSplitIndex(node, m, M); - calcBBox(node, this.toBBox); - calcBBox(newNode, this.toBBox); + var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); + newNode.height = node.height; + newNode.leaf = node.leaf; - if (level) insertPath[level - 1].children.push(newNode); - else this._splitRoot(node, newNode); - } + calcBBox(node, this.toBBox); + calcBBox(newNode, this.toBBox); - _splitRoot(node, newNode) { - // split root node - this.data = createNode([node, newNode]); - this.data.height = node.height + 1; - this.data.leaf = false; - calcBBox(this.data, this.toBBox); - } + if (level) { insertPath[level - 1].children.push(newNode); } + else { this._splitRoot(node, newNode); } + }; - _chooseSplitIndex(node, m, M) { - let index; - let minOverlap = Infinity; - let minArea = Infinity; + RBush.prototype._splitRoot = function _splitRoot (node, newNode) { + // split root node + this.data = createNode([node, newNode]); + this.data.height = node.height + 1; + this.data.leaf = false; + calcBBox(this.data, this.toBBox); + }; - for (let i = m; i <= M - m; i++) { - const bbox1 = distBBox(node, 0, i, this.toBBox); - const bbox2 = distBBox(node, i, M, this.toBBox); + RBush.prototype._chooseSplitIndex = function _chooseSplitIndex (node, m, M) { + var index; + var minOverlap = Infinity; + var minArea = Infinity; - const overlap = intersectionArea(bbox1, bbox2); - const area = bboxArea(bbox1) + bboxArea(bbox2); + for (var i = m; i <= M - m; i++) { + var bbox1 = distBBox(node, 0, i, this.toBBox); + var bbox2 = distBBox(node, i, M, this.toBBox); - // choose distribution with minimum overlap - if (overlap < minOverlap) { - minOverlap = overlap; - index = i; + var overlap = intersectionArea(bbox1, bbox2); + var area = bboxArea(bbox1) + bboxArea(bbox2); - minArea = area < minArea ? area : minArea; + // choose distribution with minimum overlap + if (overlap < minOverlap) { + minOverlap = overlap; + index = i; - } else if (overlap === minOverlap) { - // otherwise choose distribution with minimum area - if (area < minArea) { - minArea = area; - index = i; - } + minArea = area < minArea ? area : minArea; + + } else if (overlap === minOverlap) { + // otherwise choose distribution with minimum area + if (area < minArea) { + minArea = area; + index = i; } } - - return index || M - m; } - // sorts node children by the best axis for split - _chooseSplitAxis(node, m, M) { - const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX; - const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY; - const xMargin = this._allDistMargin(node, m, M, compareMinX); - const yMargin = this._allDistMargin(node, m, M, compareMinY); + return index || M - m; + }; - // if total distributions margin value is minimal for x, sort by minX, - // otherwise it's already sorted by minY - if (xMargin < yMargin) node.children.sort(compareMinX); - } + // sorts node children by the best axis for split + RBush.prototype._chooseSplitAxis = function _chooseSplitAxis (node, m, M) { + var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX; + var compareMinY = node.leaf ? this.compareMinY : compareNodeMinY; + var xMargin = this._allDistMargin(node, m, M, compareMinX); + var yMargin = this._allDistMargin(node, m, M, compareMinY); - // total margin of all possible split distributions where each node is at least m full - _allDistMargin(node, m, M, compare) { - node.children.sort(compare); + // if total distributions margin value is minimal for x, sort by minX, + // otherwise it's already sorted by minY + if (xMargin < yMargin) { node.children.sort(compareMinX); } + }; - const toBBox = this.toBBox; - const leftBBox = distBBox(node, 0, m, toBBox); - const rightBBox = distBBox(node, M - m, M, toBBox); - let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox); + // total margin of all possible split distributions where each node is at least m full + RBush.prototype._allDistMargin = function _allDistMargin (node, m, M, compare) { + node.children.sort(compare); - for (let i = m; i < M - m; i++) { - const child = node.children[i]; - extend$1(leftBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(leftBBox); - } + var toBBox = this.toBBox; + var leftBBox = distBBox(node, 0, m, toBBox); + var rightBBox = distBBox(node, M - m, M, toBBox); + var margin = bboxMargin(leftBBox) + bboxMargin(rightBBox); - for (let i = M - m - 1; i >= m; i--) { - const child = node.children[i]; - extend$1(rightBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(rightBBox); - } + for (var i = m; i < M - m; i++) { + var child = node.children[i]; + extend$1(leftBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(leftBBox); + } - return margin; + for (var i$1 = M - m - 1; i$1 >= m; i$1--) { + var child$1 = node.children[i$1]; + extend$1(rightBBox, node.leaf ? toBBox(child$1) : child$1); + margin += bboxMargin(rightBBox); } - _adjustParentBBoxes(bbox, path, level) { - // adjust bboxes along the given tree path - for (let i = level; i >= 0; i--) { - extend$1(path[i], bbox); - } + return margin; + }; + + RBush.prototype._adjustParentBBoxes = function _adjustParentBBoxes (bbox, path, level) { + // adjust bboxes along the given tree path + for (var i = level; i >= 0; i--) { + extend$1(path[i], bbox); } + }; - _condense(path) { - // go through the path, removing empty nodes and updating bboxes - for (let i = path.length - 1, siblings; i >= 0; i--) { - if (path[i].children.length === 0) { - if (i > 0) { - siblings = path[i - 1].children; - siblings.splice(siblings.indexOf(path[i]), 1); + RBush.prototype._condense = function _condense (path) { + // go through the path, removing empty nodes and updating bboxes + for (var i = path.length - 1, siblings = (void 0); i >= 0; i--) { + if (path[i].children.length === 0) { + if (i > 0) { + siblings = path[i - 1].children; + siblings.splice(siblings.indexOf(path[i]), 1); - } else this.clear(); + } else { this.clear(); } - } else calcBBox(path[i], this.toBBox); - } + } else { calcBBox(path[i], this.toBBox); } } - } + }; function findItem(item, items, equalsFn) { - if (!equalsFn) return items.indexOf(item); + if (!equalsFn) { return items.indexOf(item); } - for (let i = 0; i < items.length; i++) { - if (equalsFn(item, items[i])) return i; + for (var i = 0; i < items.length; i++) { + if (equalsFn(item, items[i])) { return i; } } return -1; } @@ -30443,14 +30471,14 @@ // min bounding rectangle of node children from k to p-1 function distBBox(node, k, p, toBBox, destNode) { - if (!destNode) destNode = createNode(null); + if (!destNode) { destNode = createNode(null); } destNode.minX = Infinity; destNode.minY = Infinity; destNode.maxX = -Infinity; destNode.maxY = -Infinity; - for (let i = k; i < p; i++) { - const child = node.children[i]; + for (var i = k; i < p; i++) { + var child = node.children[i]; extend$1(destNode, node.leaf ? toBBox(child) : child); } @@ -30477,10 +30505,10 @@ } function intersectionArea(a, b) { - const minX = Math.max(a.minX, b.minX); - const minY = Math.max(a.minY, b.minY); - const maxX = Math.min(a.maxX, b.maxX); - const maxY = Math.min(a.maxY, b.maxY); + var minX = Math.max(a.minX, b.minX); + var minY = Math.max(a.minY, b.minY); + var maxX = Math.min(a.maxX, b.maxX); + var maxY = Math.min(a.maxY, b.maxY); return Math.max(0, maxX - minX) * Math.max(0, maxY - minY); @@ -30502,7 +30530,7 @@ function createNode(children) { return { - children, + children: children, height: 1, leaf: true, minX: Infinity, @@ -30516,31 +30544,31 @@ // combines selection algorithm with binary divide & conquer approach function multiSelect(arr, left, right, n, compare) { - const stack = [left, right]; + var stack = [left, right]; while (stack.length) { right = stack.pop(); left = stack.pop(); - if (right - left <= n) continue; + if (right - left <= n) { continue; } - const mid = left + Math.ceil((right - left) / n / 2) * n; + var mid = left + Math.ceil((right - left) / n / 2) * n; quickselect(arr, mid, left, right, compare); stack.push(left, mid, mid, right); } } - const tiler = utilTiler(); - const dispatch$1 = dispatch('loaded'); - const _tileZoom = 14; - const _krUrlRoot = 'https://www.keepright.at'; - let _krData = { errorTypes: {}, localizeStrings: {} }; + var tiler = utilTiler(); + var dispatch$1 = dispatch('loaded'); + var _tileZoom = 14; + var _krUrlRoot = 'https://www.keepright.at'; + var _krData = { errorTypes: {}, localizeStrings: {} }; // This gets reassigned if reset - let _cache; + var _cache; - const _krRuleset = [ + var _krRuleset = [ // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads 30, 40, 50, 60, 70, 90, 100, 110, 120, 130, 150, 160, 170, 180, 190, 191, 192, 193, 194, 195, 196, 197, 198, @@ -30558,8 +30586,8 @@ } function abortUnwantedRequests(cache, tiles) { - Object.keys(cache.inflightTile).forEach(k => { - const wanted = tiles.find(tile => k === tile.id); + Object.keys(cache.inflightTile).forEach(function (k) { + var wanted = tiles.find(function (tile) { return k === tile.id; }); if (!wanted) { abortRequest(cache.inflightTile[k]); delete cache.inflightTile[k]; @@ -30575,7 +30603,7 @@ // Replace or remove QAItem from rtree function updateRtree(item, replace) { - _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id); + _cache.rtree.remove(item, function (a, b) { return a.data.id === b.data.id; }); if (replace) { _cache.rtree.insert(item); @@ -30584,12 +30612,12 @@ function tokenReplacements(d) { - if (!(d instanceof QAItem)) return; + if (!(d instanceof QAItem)) { return; } - const htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/); - const replacements = {}; + var htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/); + var replacements = {}; - const issueTemplate = _krData.errorTypes[d.whichType]; + var issueTemplate = _krData.errorTypes[d.whichType]; if (!issueTemplate) { /* eslint-disable no-console */ console.log('No Template: ', d.whichType); @@ -30599,11 +30627,11 @@ } // some descriptions are just fixed text - if (!issueTemplate.regex) return; + if (!issueTemplate.regex) { return; } // regex pattern should match description with variable details captured - const errorRegex = new RegExp(issueTemplate.regex, 'i'); - const errorMatch = errorRegex.exec(d.description); + var errorRegex = new RegExp(issueTemplate.regex, 'i'); + var errorMatch = errorRegex.exec(d.description); if (!errorMatch) { /* eslint-disable no-console */ console.log('Unmatched: ', d.whichType); @@ -30613,9 +30641,9 @@ return; } - for (let i = 1; i < errorMatch.length; i++) { // skip first - let capture = errorMatch[i]; - let idType; + for (var i = 1; i < errorMatch.length; i++) { // skip first + var capture = errorMatch[i]; + var idType = (void 0); idType = 'IDs' in issueTemplate ? issueTemplate.IDs[i-1] : ''; if (idType && capture) { // link IDs if present in the capture @@ -30623,7 +30651,7 @@ } else if (htmlRegex.test(capture)) { // escape any html in non-IDs capture = '\\' + capture + '\\'; } else { - const compare = capture.toLowerCase(); + var compare = capture.toLowerCase(); if (_krData.localizeStrings[compare]) { // some replacement strings can be localized capture = _t('QA.keepRight.error_parts.' + _krData.localizeStrings[compare]); } @@ -30637,7 +30665,7 @@ function parseError(capture, idType) { - const compare = capture.toLowerCase(); + var compare = capture.toLowerCase(); if (_krData.localizeStrings[compare]) { // some replacement strings can be localized capture = _t('QA.keepRight.error_parts.' + _krData.localizeStrings[compare]); } @@ -30681,25 +30709,25 @@ function linkErrorObject(d) { - return `${d}`; + return ("" + d + ""); } function linkEntity(d) { - return `${d}`; + return ("" + d + ""); } function linkURL(d) { - return `${d}`; + return ("" + d + ""); } // arbitrary node list of form: #ID, #ID, #ID... function parse211(capture) { - let newList = []; - const items = capture.split(', '); + var newList = []; + var items = capture.split(', '); - items.forEach(item => { + items.forEach(function (item) { // ID has # at the front - let id = linkEntity('n' + item.slice(1)); + var id = linkEntity('n' + item.slice(1)); newList.push(id); }); @@ -30708,12 +30736,12 @@ // arbitrary way list of form: #ID(layer),#ID(layer),#ID(layer)... function parse231(capture) { - let newList = []; + var newList = []; // unfortunately 'layer' can itself contain commas, so we split on '),' - const items = capture.split('),'); + var items = capture.split('),'); - items.forEach(item => { - const match = item.match(/\#(\d+)\((.+)\)?/); + items.forEach(function (item) { + var match = item.match(/\#(\d+)\((.+)\)?/); if (match !== null && match.length > 2) { newList.push(linkEntity('w' + match[1]) + ' ' + _t('QA.keepRight.errorTypes.231.layer', { layer: match[2] }) @@ -30726,24 +30754,24 @@ // arbitrary node/relation list of form: from node #ID,to relation #ID,to node #ID... function parse294(capture) { - let newList = []; - const items = capture.split(','); + var newList = []; + var items = capture.split(','); - items.forEach(item => { + items.forEach(function (item) { // item of form "from/to node/relation #ID" item = item.split(' '); // to/from role is more clear in quotes - const role = `"${item[0]}"`; + var role = "\"" + (item[0]) + "\""; // first letter of node/relation provides the type - const idType = item[1].slice(0,1); + var idType = item[1].slice(0,1); // ID has # at the front - let id = item[2].slice(1); + var id = item[2].slice(1); id = linkEntity(idType + id); - newList.push(`${role} ${item[1]} ${id}`); + newList.push((role + " " + (item[1]) + " " + id)); }); return newList.join(', '); @@ -30751,9 +30779,9 @@ // may or may not include the string "(including the name 'name')" function parse370(capture) { - if (!capture) return ''; + if (!capture) { return ''; } - const match = capture.match(/\(including the name (\'.+\')\)/); + var match = capture.match(/\(including the name (\'.+\')\)/); if (match && match.length) { return _t('QA.keepRight.errorTypes.370.including_the_name', { name: match[1] }); } @@ -30762,12 +30790,12 @@ // arbitrary node list of form: #ID,#ID,#ID... function parse20(capture) { - let newList = []; - const items = capture.split(','); + var newList = []; + var items = capture.split(','); - items.forEach(item => { + items.forEach(function (item) { // ID has # at the front - const id = linkEntity('n' + item.slice(1)); + var id = linkEntity('n' + item.slice(1)); newList.push(id); }); @@ -30779,9 +30807,9 @@ var serviceKeepRight = { title: 'keepRight', - init() { + init: function init() { _mainFileFetcher.get('keepRight') - .then(d => _krData = d); + .then(function (d) { return _krData = d; }); if (!_cache) { this.reset(); @@ -30790,7 +30818,7 @@ this.event = utilRebind(this, dispatch$1, 'on'); }, - reset() { + reset: function reset() { if (_cache) { Object.values(_cache.inflightTile).forEach(abortRequest); } @@ -30807,14 +30835,16 @@ // KeepRight API: http://osm.mueschelsoft.de/keepright/interfacing.php - loadIssues(projection) { - const options = { + loadIssues: function loadIssues(projection) { + var this$1 = this; + + var options = { format: 'geojson', ch: _krRuleset }; // determine the needed tiles to cover the view - const tiles = tiler + var tiles = tiler .zoomExtent([_tileZoom, _tileZoom]) .getTiles(projection); @@ -30822,56 +30852,55 @@ abortUnwantedRequests(_cache, tiles); // issue new requests.. - tiles.forEach(tile => { - if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return; - - const [ left, top, right, bottom ] = tile.extent.rectangle(); - const params = Object.assign({}, options, { left, bottom, right, top }); - const url = `${_krUrlRoot}/export.php?` + utilQsString(params); - const controller = new AbortController(); + tiles.forEach(function (tile) { + if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) { return; } + + var ref = tile.extent.rectangle(); + var left = ref[0]; + var top = ref[1]; + var right = ref[2]; + var bottom = ref[3]; + var params = Object.assign({}, options, { left: left, bottom: bottom, right: right, top: top }); + var url = _krUrlRoot + "/export.php?" + utilQsString(params); + var controller = new AbortController(); _cache.inflightTile[tile.id] = controller; d3_json(url, { signal: controller.signal }) - .then(data => { + .then(function (data) { delete _cache.inflightTile[tile.id]; _cache.loadedTile[tile.id] = true; if (!data || !data.features || !data.features.length) { throw new Error('No Data'); } - data.features.forEach(feature => { - const { - properties: { - error_type: itemType, - error_id: id, - comment = null, - object_id: objectId, - object_type: objectType, - schema, - title - } - } = feature; - let { - geometry: { coordinates: loc }, - properties: { description = '' } - } = feature; + data.features.forEach(function (feature) { + var feature_properties = feature.properties; + var itemType = feature_properties.error_type; + var id = feature_properties.error_id; + var comment = feature_properties.comment; if ( comment === void 0 ) comment = null; + var objectId = feature_properties.object_id; + var objectType = feature_properties.object_type; + var schema = feature_properties.schema; + var title = feature_properties.title; + var loc = feature.geometry.coordinates; + var description = feature.properties.description; if ( description === void 0 ) description = ''; // if there is a parent, save its error type e.g.: // Error 191 = "highway-highway" // Error 190 = "intersections without junctions" (parent) - const issueTemplate = _krData.errorTypes[itemType]; - const parentIssueType = (Math.floor(itemType / 10) * 10).toString(); + var issueTemplate = _krData.errorTypes[itemType]; + var parentIssueType = (Math.floor(itemType / 10) * 10).toString(); // try to handle error type directly, fallback to parent error type. - const whichType = issueTemplate ? itemType : parentIssueType; - const whichTemplate = _krData.errorTypes[whichType]; + var whichType = issueTemplate ? itemType : parentIssueType; + var whichTemplate = _krData.errorTypes[whichType]; // Rewrite a few of the errors at this point.. // This is done to make them easier to linkify and translate. switch (whichType) { case '170': - description = `This feature has a FIXME tag: ${description}`; + description = "This feature has a FIXME tag: " + description; break; case '292': case '293': @@ -30882,7 +30911,7 @@ case '296': case '297': case '298': - description = `This turn-restriction~${description}`; + description = "This turn-restriction~" + description; break; case '300': description = 'This highway is missing a maxspeed tag'; @@ -30890,31 +30919,31 @@ case '411': case '412': case '413': - description = `This feature~${description}`; + description = "This feature~" + description; break; } // move markers slightly so it doesn't obscure the geometry, // then move markers away from other coincident markers - let coincident = false; + var coincident = false; do { // first time, move marker up. after that, move marker right. - let delta = coincident ? [0.00001, 0] : [0, 0.00001]; + var delta = coincident ? [0.00001, 0] : [0, 0.00001]; loc = geoVecAdd(loc, delta); - let bbox = geoExtent(loc).bbox(); + var bbox = geoExtent(loc).bbox(); coincident = _cache.rtree.search(bbox).length; } while (coincident); - let d = new QAItem(loc, this, itemType, id, { - comment, - description, - whichType, - parentIssueType, + var d = new QAItem(loc, this$1, itemType, id, { + comment: comment, + description: description, + whichType: whichType, + parentIssueType: parentIssueType, severity: whichTemplate.severity || 'error', - objectId, - objectType, - schema, - title + objectId: objectId, + objectType: objectType, + schema: schema, + title: title }); d.replacements = tokenReplacements(d); @@ -30925,7 +30954,7 @@ dispatch$1.call('loaded'); }) - .catch(() => { + .catch(function () { delete _cache.inflightTile[tile.id]; _cache.loadedTile[tile.id] = true; }); @@ -30934,12 +30963,14 @@ }, - postUpdate(d, callback) { + postUpdate: function postUpdate(d, callback) { + var this$1 = this; + if (_cache.inflightPost[d.id]) { return callback({ message: 'Error update already inflight', status: -2 }, d); } - const params = { schema: d.schema, id: d.id }; + var params = { schema: d.schema, id: d.id }; if (d.newStatus) { params.st = d.newStatus; @@ -30950,55 +30981,55 @@ // NOTE: This throws a CORS err, but it seems successful. // We don't care too much about the response, so this is fine. - const url = `${_krUrlRoot}/comment.php?` + utilQsString(params); - const controller = new AbortController(); + var url = _krUrlRoot + "/comment.php?" + utilQsString(params); + var controller = new AbortController(); _cache.inflightPost[d.id] = controller; // Since this is expected to throw an error just continue as if it worked // (worst case scenario the request truly fails and issue will show up if iD restarts) d3_json(url, { signal: controller.signal }) - .finally(() => { + .finally(function () { delete _cache.inflightPost[d.id]; if (d.newStatus === 'ignore') { // ignore permanently (false positive) - this.removeItem(d); + this$1.removeItem(d); } else if (d.newStatus === 'ignore_t') { // ignore temporarily (error fixed) - this.removeItem(d); - _cache.closed[`${d.schema}:${d.id}`] = true; + this$1.removeItem(d); + _cache.closed[((d.schema) + ":" + (d.id))] = true; } else { - d = this.replaceItem(d.update({ + d = this$1.replaceItem(d.update({ comment: d.newComment, newComment: undefined, newState: undefined })); } - if (callback) callback(null, d); + if (callback) { callback(null, d); } }); }, // Get all cached QAItems covering the viewport - getItems(projection) { - const viewport = projection.clipExtent(); - const min = [viewport[0][0], viewport[1][1]]; - const max = [viewport[1][0], viewport[0][1]]; - const bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); + getItems: function getItems(projection) { + var viewport = projection.clipExtent(); + var min = [viewport[0][0], viewport[1][1]]; + var max = [viewport[1][0], viewport[0][1]]; + var bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); - return _cache.rtree.search(bbox).map(d => d.data); + return _cache.rtree.search(bbox).map(function (d) { return d.data; }); }, // Get a QAItem from cache // NOTE: Don't change method name until UI v3 is merged - getError(id) { + getError: function getError(id) { return _cache.data[id]; }, // Replace a single QAItem in the cache - replaceItem(item) { - if (!(item instanceof QAItem) || !item.id) return; + replaceItem: function replaceItem(item) { + if (!(item instanceof QAItem) || !item.id) { return; } _cache.data[item.id] = item; updateRtree(encodeIssueRtree(item), true); // true = replace @@ -31006,41 +31037,41 @@ }, // Remove a single QAItem from the cache - removeItem(item) { - if (!(item instanceof QAItem) || !item.id) return; + removeItem: function removeItem(item) { + if (!(item instanceof QAItem) || !item.id) { return; } delete _cache.data[item.id]; updateRtree(encodeIssueRtree(item), false); // false = remove }, - issueURL(item) { - return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`; + issueURL: function issueURL(item) { + return (_krUrlRoot + "/report_map.php?schema=" + (item.schema) + "&error=" + (item.id)); }, // Get an array of issues closed during this session. // Used to populate `closed:keepright` changeset tag - getClosedIDs() { + getClosedIDs: function getClosedIDs() { return Object.keys(_cache.closed).sort(); } }; - const tiler$1 = utilTiler(); - const dispatch$2 = dispatch('loaded'); - const _tileZoom$1 = 14; - const _impOsmUrls = { + var tiler$1 = utilTiler(); + var dispatch$2 = dispatch('loaded'); + var _tileZoom$1 = 14; + var _impOsmUrls = { ow: 'https://grab.community.improve-osm.org/directionOfFlowService', mr: 'https://grab.community.improve-osm.org/missingGeoService', tr: 'https://grab.community.improve-osm.org/turnRestrictionService' }; - let _impOsmData = { icons: {} }; + var _impOsmData = { icons: {} }; // This gets reassigned if reset - let _cache$1; + var _cache$1; function abortRequest$1(i) { - Object.values(i).forEach(controller => { + Object.values(i).forEach(function (controller) { if (controller) { controller.abort(); } @@ -31048,8 +31079,8 @@ } function abortUnwantedRequests$1(cache, tiles) { - Object.keys(cache.inflightTile).forEach(k => { - const wanted = tiles.find(tile => k === tile.id); + Object.keys(cache.inflightTile).forEach(function (k) { + var wanted = tiles.find(function (tile) { return k === tile.id; }); if (!wanted) { abortRequest$1(cache.inflightTile[k]); delete cache.inflightTile[k]; @@ -31063,7 +31094,7 @@ // Replace or remove QAItem from rtree function updateRtree$1(item, replace) { - _cache$1.rtree.remove(item, (a, b) => a.data.id === b.data.id); + _cache$1.rtree.remove(item, function (a, b) { return a.data.id === b.data.id; }); if (replace) { _cache$1.rtree.insert(item); @@ -31071,17 +31102,17 @@ } function linkErrorObject(d) { - return `${d}`; + return ("" + d + ""); } function linkEntity(d) { - return `${d}`; + return ("" + d + ""); } function pointAverage(points) { if (points.length) { - const sum = points.reduce( - (acc, point) => geoVecAdd(acc, [point.lon, point.lat]), + var sum = points.reduce( + function (acc, point) { return geoVecAdd(acc, [point.lon, point.lat]); }, [0,0] ); return geoVecScale(sum, 1 / points.length); @@ -31091,7 +31122,7 @@ } function relativeBearing(p1, p2) { - let angle = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat); + var angle = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat); if (angle < 0) { angle += 2 * Math.PI; } @@ -31102,8 +31133,8 @@ // Assuming range [0,360) function cardinalDirection(bearing) { - const dir = 45 * Math.round(bearing / 45); - const compass = { + var dir = 45 * Math.round(bearing / 45); + var compass = { 0: 'north', 45: 'northeast', 90: 'east', @@ -31115,17 +31146,17 @@ 360: 'north' }; - return _t(`QA.improveOSM.directions.${compass[dir]}`); + return _t(("QA.improveOSM.directions." + (compass[dir]))); } // Errors shouldn't obscure eachother function preventCoincident(loc, bumpUp) { - let coincident = false; + var coincident = false; do { // first time, move marker up. after that, move marker right. - let delta = coincident ? [0.00001, 0] : (bumpUp ? [0, 0.00001] : [0, 0]); + var delta = coincident ? [0.00001, 0] : (bumpUp ? [0, 0.00001] : [0, 0]); loc = geoVecAdd(loc, delta); - let bbox = geoExtent(loc).bbox(); + var bbox = geoExtent(loc).bbox(); coincident = _cache$1.rtree.search(bbox).length; } while (coincident); @@ -31135,9 +31166,9 @@ var serviceImproveOSM = { title: 'improveOSM', - init() { + init: function init() { _mainFileFetcher.get('qa_data') - .then(d => _impOsmData = d.improveOSM); + .then(function (d) { return _impOsmData = d.improveOSM; }); if (!_cache$1) { this.reset(); @@ -31146,7 +31177,7 @@ this.event = utilRebind(this, dispatch$2, 'on'); }, - reset() { + reset: function reset() { if (_cache$1) { Object.values(_cache$1.inflightTile).forEach(abortRequest$1); } @@ -31160,15 +31191,17 @@ }; }, - loadIssues(projection) { - const options = { + loadIssues: function loadIssues(projection) { + var this$1 = this; + + var options = { client: 'iD', status: 'OPEN', zoom: '19' // Use a high zoom so that clusters aren't returned }; // determine the needed tiles to cover the view - const tiles = tiler$1 + var tiles = tiler$1 .zoomExtent([_tileZoom$1, _tileZoom$1]) .getTiles(projection); @@ -31176,29 +31209,33 @@ abortUnwantedRequests$1(_cache$1, tiles); // issue new requests.. - tiles.forEach(tile => { - if (_cache$1.loadedTile[tile.id] || _cache$1.inflightTile[tile.id]) return; + tiles.forEach(function (tile) { + if (_cache$1.loadedTile[tile.id] || _cache$1.inflightTile[tile.id]) { return; } - const [ east, north, west, south ] = tile.extent.rectangle(); - const params = Object.assign({}, options, { east, south, west, north }); + var ref = tile.extent.rectangle(); + var east = ref[0]; + var north = ref[1]; + var west = ref[2]; + var south = ref[3]; + var params = Object.assign({}, options, { east: east, south: south, west: west, north: north }); // 3 separate requests to store for each tile - const requests = {}; + var requests = {}; - Object.keys(_impOsmUrls).forEach(k => { + Object.keys(_impOsmUrls).forEach(function (k) { // We exclude WATER from missing geometry as it doesn't seem useful // We use most confident one-way and turn restrictions only, still have false positives - const kParams = Object.assign({}, + var kParams = Object.assign({}, params, (k === 'mr') ? { type: 'PARKING,ROAD,BOTH,PATH' } : { confidenceLevel: 'C1' } ); - const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams); - const controller = new AbortController(); + var url = (_impOsmUrls[k]) + "/search?" + utilQsString(kParams); + var controller = new AbortController(); requests[k] = controller; d3_json(url, { signal: controller.signal }) - .then(data => { + .then(function (data) { delete _cache$1.inflightTile[tile.id][k]; if (!Object.keys(_cache$1.inflightTile[tile.id]).length) { delete _cache$1.inflightTile[tile.id]; @@ -31207,12 +31244,15 @@ // Road segments at high zoom == oneways if (data.roadSegments) { - data.roadSegments.forEach(feature => { + data.roadSegments.forEach(function (feature) { // Position error at the approximate middle of the segment - const { points, wayId, fromNodeId, toNodeId } = feature; - const itemId = `${wayId}${fromNodeId}${toNodeId}`; - let mid = points.length / 2; - let loc; + var points = feature.points; + var wayId = feature.wayId; + var fromNodeId = feature.fromNodeId; + var toNodeId = feature.toNodeId; + var itemId = "" + wayId + fromNodeId + toNodeId; + var mid = points.length / 2; + var loc; // Even number of points, find midpoint of the middle two // Odd number of points, use position of very middle point @@ -31226,12 +31266,12 @@ // One-ways can land on same segment in opposite direction loc = preventCoincident(loc, false); - let d = new QAItem(loc, this, k, itemId, { + var d = new QAItem(loc, this$1, k, itemId, { issueKey: k, // used as a category identifier: { // used to post changes - wayId, - fromNodeId, - toNodeId + wayId: wayId, + fromNodeId: fromNodeId, + toNodeId: toNodeId }, objectId: wayId, objectType: 'way' @@ -31253,24 +31293,27 @@ // Tiles at high zoom == missing roads if (data.tiles) { - data.tiles.forEach(feature => { - const { type, x, y, numberOfTrips } = feature; - const geoType = type.toLowerCase(); - const itemId = `${geoType}${x}${y}${numberOfTrips}`; + data.tiles.forEach(function (feature) { + var type = feature.type; + var x = feature.x; + var y = feature.y; + var numberOfTrips = feature.numberOfTrips; + var geoType = type.toLowerCase(); + var itemId = "" + geoType + x + y + numberOfTrips; // Average of recorded points should land on the missing geometry // Missing geometry could happen to land on another error - let loc = pointAverage(feature.points); + var loc = pointAverage(feature.points); loc = preventCoincident(loc, false); - let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, { + var d = new QAItem(loc, this$1, (k + "-" + geoType), itemId, { issueKey: k, - identifier: { x, y } + identifier: { x: x, y: y } }); d.replacements = { num_trips: numberOfTrips, - geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`) + geometry_type: _t(("QA.improveOSM.geometry_types." + geoType)) }; // -1 trips indicates data came from a 3rd party @@ -31285,21 +31328,25 @@ // Entities at high zoom == turn restrictions if (data.entities) { - data.entities.forEach(feature => { - const { point, id, segments, numberOfPasses, turnType } = feature; - const itemId = `${id.replace(/[,:+#]/g, '_')}`; + data.entities.forEach(function (feature) { + var point = feature.point; + var id = feature.id; + var segments = feature.segments; + var numberOfPasses = feature.numberOfPasses; + var turnType = feature.turnType; + var itemId = "" + (id.replace(/[,:+#]/g, '_')); // Turn restrictions could be missing at same junction // We also want to bump the error up so node is accessible - const loc = preventCoincident([point.lon, point.lat], true); + var loc = preventCoincident([point.lon, point.lat], true); // Elements are presented in a strange way - const ids = id.split(','); - const from_way = ids[0]; - const via_node = ids[3]; - const to_way = ids[2].split(':')[1]; + var ids = id.split(','); + var from_way = ids[0]; + var via_node = ids[3]; + var to_way = ids[2].split(':')[1]; - let d = new QAItem(loc, this, k, itemId, { + var d = new QAItem(loc, this$1, k, itemId, { issueKey: k, identifier: id, objectId: via_node, @@ -31307,8 +31354,10 @@ }); // Travel direction along from_way clarifies the turn restriction - const [ p1, p2 ] = segments[0].points; - const dir_of_travel = cardinalDirection(relativeBearing(p1, p2)); + var ref = segments[0].points; + var p1 = ref[0]; + var p2 = ref[1]; + var dir_of_travel = cardinalDirection(relativeBearing(p1, p2)); // Variables used in the description d.replacements = { @@ -31327,7 +31376,7 @@ }); } }) - .catch(() => { + .catch(function () { delete _cache$1.inflightTile[tile.id][k]; if (!Object.keys(_cache$1.inflightTile[tile.id]).length) { delete _cache$1.inflightTile[tile.id]; @@ -31340,14 +31389,16 @@ }); }, - getComments(item) { + getComments: function getComments(item) { + var this$1 = this; + // If comments already retrieved no need to do so again if (item.comments) { return Promise.resolve(item); } - const key = item.issueKey; - let qParams = {}; + var key = item.issueKey; + var qParams = {}; if (key === 'ow') { qParams = item.identifier; @@ -31358,18 +31409,18 @@ qParams.targetId = item.identifier; } - const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams); - const cacheComments = data => { + var url = (_impOsmUrls[key]) + "/retrieveComments?" + utilQsString(qParams); + var cacheComments = function (data) { // Assign directly for immediate use afterwards // comments are served newest to oldest item.comments = data.comments ? data.comments.reverse() : []; - this.replaceItem(item); + this$1.replaceItem(item); }; - return d3_json(url).then(cacheComments).then(() => item); + return d3_json(url).then(cacheComments).then(function () { return item; }); }, - postUpdate(d, callback) { + postUpdate: function postUpdate(d, callback) { if (!serviceOsm.authenticated()) { // Username required in payload return callback({ message: 'Not Authenticated', status: -3}, d); } @@ -31381,11 +31432,13 @@ serviceOsm.userDetails(sendPayload.bind(this)); function sendPayload(err, user) { + var this$1 = this; + if (err) { return callback(err, d); } - const key = d.issueKey; - const url = `${_impOsmUrls[key]}/comment`; - const payload = { + var key = d.issueKey; + var url = (_impOsmUrls[key]) + "/comment"; + var payload = { username: user.display_name, targetIds: [ d.identifier ] }; @@ -31400,23 +31453,23 @@ payload.text = d.newComment; } - const controller = new AbortController(); + var controller = new AbortController(); _cache$1.inflightPost[d.id] = controller; - const options = { + var options = { method: 'POST', signal: controller.signal, body: JSON.stringify(payload) }; d3_json(url, options) - .then(() => { + .then(function () { delete _cache$1.inflightPost[d.id]; // Just a comment, update error in cache if (!d.newStatus) { - const now = new Date(); - let comments = d.comments ? d.comments : []; + var now = new Date(); + var comments = d.comments ? d.comments : []; comments.push({ username: payload.username, @@ -31424,12 +31477,12 @@ timestamp: now.getTime() / 1000 }); - this.replaceItem(d.update({ + this$1.replaceItem(d.update({ comments: comments, newComment: undefined })); } else { - this.removeItem(d); + this$1.removeItem(d); if (d.newStatus === 'SOLVED') { // Keep track of the number of issues closed per type to tag the changeset if (!(d.issueKey in _cache$1.closed)) { @@ -31438,40 +31491,40 @@ _cache$1.closed[d.issueKey] += 1; } } - if (callback) callback(null, d); + if (callback) { callback(null, d); } }) - .catch(err => { + .catch(function (err) { delete _cache$1.inflightPost[d.id]; - if (callback) callback(err.message); + if (callback) { callback(err.message); } }); } }, // Get all cached QAItems covering the viewport - getItems(projection) { - const viewport = projection.clipExtent(); - const min = [viewport[0][0], viewport[1][1]]; - const max = [viewport[1][0], viewport[0][1]]; - const bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); + getItems: function getItems(projection) { + var viewport = projection.clipExtent(); + var min = [viewport[0][0], viewport[1][1]]; + var max = [viewport[1][0], viewport[0][1]]; + var bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); - return _cache$1.rtree.search(bbox).map(d => d.data); + return _cache$1.rtree.search(bbox).map(function (d) { return d.data; }); }, // Get a QAItem from cache // NOTE: Don't change method name until UI v3 is merged - getError(id) { + getError: function getError(id) { return _cache$1.data[id]; }, // get the name of the icon to display for this item - getIcon(itemType) { + getIcon: function getIcon(itemType) { return _impOsmData.icons[itemType]; }, // Replace a single QAItem in the cache - replaceItem(issue) { - if (!(issue instanceof QAItem) || !issue.id) return; + replaceItem: function replaceItem(issue) { + if (!(issue instanceof QAItem) || !issue.id) { return; } _cache$1.data[issue.id] = issue; updateRtree$1(encodeIssueRtree$1(issue), true); // true = replace @@ -31479,15 +31532,15 @@ }, // Remove a single QAItem from the cache - removeItem(issue) { - if (!(issue instanceof QAItem) || !issue.id) return; + removeItem: function removeItem(issue) { + if (!(issue instanceof QAItem) || !issue.id) { return; } delete _cache$1.data[issue.id]; updateRtree$1(encodeIssueRtree$1(issue), false); // false = remove }, // Used to populate `closed:improveosm:*` changeset tags - getClosedCounts() { + getClosedCounts: function getClosedCounts() { return _cache$1.closed; } }; @@ -31521,26 +31574,26 @@ module.exports = { defaults: getDefaults(), - getDefaults, - changeDefaults + getDefaults: getDefaults, + changeDefaults: changeDefaults }; }); /** * Helpers */ - const escapeTest = /[&<>"']/; - const escapeReplace = /[&<>"']/g; - const escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; - const escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; - const escapeReplacements = { + var escapeTest = /[&<>"']/; + var escapeReplace = /[&<>"']/g; + var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; + var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; + var escapeReplacements = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; - const getEscapeReplacement = (ch) => escapeReplacements[ch]; + var getEscapeReplacement = function (ch) { return escapeReplacements[ch]; }; function escape$1(html, encode) { if (encode) { if (escapeTest.test(html)) { @@ -31555,13 +31608,13 @@ return html; } - const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; + var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; function unescape$1(html) { // explicitly match decimal, hex, and named HTML entities - return html.replace(unescapeTest, (_, n) => { + return html.replace(unescapeTest, function (_, n) { n = n.toLowerCase(); - if (n === 'colon') return ':'; + if (n === 'colon') { return ':'; } if (n.charAt(0) === '#') { return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) @@ -31571,29 +31624,29 @@ }); } - const caret = /(^|[^\[])\^/g; + var caret = /(^|[^\[])\^/g; function edit(regex, opt) { regex = regex.source || regex; opt = opt || ''; - const obj = { - replace: (name, val) => { + var obj = { + replace: function (name, val) { val = val.source || val; val = val.replace(caret, '$1'); regex = regex.replace(name, val); return obj; }, - getRegex: () => { + getRegex: function () { return new RegExp(regex, opt); } }; return obj; } - const nonWordAndColonTest = /[^\w:]/g; - const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; + var nonWordAndColonTest = /[^\w:]/g; + var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; function cleanUrl(sanitize, base, href) { if (sanitize) { - let prot; + var prot; try { prot = decodeURIComponent(unescape$1(href)) .replace(nonWordAndColonTest, '') @@ -31610,16 +31663,16 @@ } try { href = encodeURI(href).replace(/%25/g, '%'); - } catch (e) { + } catch (e$1) { return null; } return href; } - const baseUrls = {}; - const justDomain = /^[^:]+:\/*[^/]*$/; - const protocol = /^([^:]+:)[\s\S]*$/; - const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; + var baseUrls = {}; + var justDomain = /^[^:]+:\/*[^/]*$/; + var protocol = /^([^:]+:)[\s\S]*$/; + var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; function resolveUrl(base, href) { if (!baseUrls[' ' + base]) { @@ -31633,7 +31686,7 @@ } } base = baseUrls[' ' + base]; - const relativeBase = base.indexOf(':') === -1; + var relativeBase = base.indexOf(':') === -1; if (href.substring(0, 2) === '//') { if (relativeBase) { @@ -31650,15 +31703,17 @@ } } - const noopTest = { exec: function noopTest() {} }; + var noopTest = { exec: function noopTest() {} }; function merge$1(obj) { - let i = 1, + var arguments$1 = arguments; + + var i = 1, target, key; for (; i < arguments.length; i++) { - target = arguments[i]; + target = arguments$1[i]; for (key in target) { if (Object.prototype.hasOwnProperty.call(target, key)) { obj[key] = target[key]; @@ -31672,10 +31727,10 @@ function splitCells(tableRow, count) { // ensure that every cell-delimiting pipe has a space // before it to distinguish it from an escaped pipe - const row = tableRow.replace(/\|/g, (match, offset, str) => { - let escaped = false, + var row = tableRow.replace(/\|/g, function (match, offset, str) { + var escaped = false, curr = offset; - while (--curr >= 0 && str[curr] === '\\') escaped = !escaped; + while (--curr >= 0 && str[curr] === '\\') { escaped = !escaped; } if (escaped) { // odd number of slashes means | is escaped // so we leave it alone @@ -31686,12 +31741,12 @@ } }), cells = row.split(/ \|/); - let i = 0; + var i = 0; if (cells.length > count) { cells.splice(count); } else { - while (cells.length < count) cells.push(''); + while (cells.length < count) { cells.push(''); } } for (; i < cells.length; i++) { @@ -31705,17 +31760,17 @@ // /c*$/ is vulnerable to REDOS. // invert: Remove suffix of non-c chars instead. Default falsey. function rtrim(str, c, invert) { - const l = str.length; + var l = str.length; if (l === 0) { return ''; } // Length of suffix matching the invert condition. - let suffLen = 0; + var suffLen = 0; // Step left until we fail to match the invert condition. while (suffLen < l) { - const currChar = str.charAt(l - suffLen - 1); + var currChar = str.charAt(l - suffLen - 1); if (currChar === c && !invert) { suffLen++; } else if (currChar !== c && invert) { @@ -31732,8 +31787,8 @@ if (str.indexOf(b[1]) === -1) { return -1; } - const l = str.length; - let level = 0, + var l = str.length; + var level = 0, i = 0; for (; i < l; i++) { if (str[i] === '\\') { @@ -31759,44 +31814,42 @@ var helpers = { escape: escape$1, unescape: unescape$1, - edit, - cleanUrl, - resolveUrl, - noopTest, + edit: edit, + cleanUrl: cleanUrl, + resolveUrl: resolveUrl, + noopTest: noopTest, merge: merge$1, - splitCells, - rtrim, - findClosingBracket, - checkSanitizeDeprecation + splitCells: splitCells, + rtrim: rtrim, + findClosingBracket: findClosingBracket, + checkSanitizeDeprecation: checkSanitizeDeprecation }; - const { defaults: defaults$1 } = defaults; - const { - rtrim: rtrim$1, - splitCells: splitCells$1, - escape: escape$2, - findClosingBracket: findClosingBracket$1 - } = helpers; + var defaults$1 = defaults.defaults; + var rtrim$1 = helpers.rtrim; + var splitCells$1 = helpers.splitCells; + var escape$2 = helpers.escape; + var findClosingBracket$1 = helpers.findClosingBracket; function outputLink(cap, link, raw) { - const href = link.href; - const title = link.title ? escape$2(link.title) : null; + var href = link.href; + var title = link.title ? escape$2(link.title) : null; if (cap[0].charAt(0) !== '!') { return { type: 'link', - raw, - href, - title, + raw: raw, + href: href, + title: title, text: cap[1] }; } else { return { type: 'image', - raw, + raw: raw, text: escape$2(cap[1]), - href, - title + href: href, + title: title }; } } @@ -31804,13 +31857,13 @@ /** * Tokenizer */ - var Tokenizer_1 = class Tokenizer { - constructor(options) { + var Tokenizer_1 = /*@__PURE__*/(function () { + function Tokenizer(options) { this.options = options || defaults$1; } - space(src) { - const cap = this.rules.block.newline.exec(src); + Tokenizer.prototype.space = function space (src) { + var cap = this.rules.block.newline.exec(src); if (cap) { if (cap[0].length > 1) { return { @@ -31820,12 +31873,12 @@ } return { raw: '\n' }; } - } + }; - code(src, tokens) { - const cap = this.rules.block.code.exec(src); + Tokenizer.prototype.code = function code (src, tokens) { + var cap = this.rules.block.code.exec(src); if (cap) { - const lastToken = tokens[tokens.length - 1]; + var lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph. if (lastToken && lastToken.type === 'paragraph') { tokens.pop(); @@ -31833,7 +31886,7 @@ lastToken.raw += '\n' + cap[0]; return lastToken; } else { - const text = cap[0].replace(/^ {4}/gm, ''); + var text = cap[0].replace(/^ {4}/gm, ''); return { type: 'code', raw: cap[0], @@ -31844,10 +31897,10 @@ }; } } - } + }; - fences(src) { - const cap = this.rules.block.fences.exec(src); + Tokenizer.prototype.fences = function fences (src) { + var cap = this.rules.block.fences.exec(src); if (cap) { return { type: 'code', @@ -31856,10 +31909,10 @@ text: cap[3] || '' }; } - } + }; - heading(src) { - const cap = this.rules.block.heading.exec(src); + Tokenizer.prototype.heading = function heading (src) { + var cap = this.rules.block.heading.exec(src); if (cap) { return { type: 'heading', @@ -31868,12 +31921,12 @@ text: cap[2] }; } - } + }; - nptable(src) { - const cap = this.rules.block.nptable.exec(src); + Tokenizer.prototype.nptable = function nptable (src) { + var cap = this.rules.block.nptable.exec(src); if (cap) { - const item = { + var item = { type: 'table', header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), @@ -31882,8 +31935,8 @@ }; if (item.header.length === item.align.length) { - let l = item.align.length; - let i; + var l = item.align.length; + var i; for (i = 0; i < l; i++) { if (/^ *-+: *$/.test(item.align[i])) { item.align[i] = 'right'; @@ -31904,41 +31957,41 @@ return item; } } - } + }; - hr(src) { - const cap = this.rules.block.hr.exec(src); + Tokenizer.prototype.hr = function hr (src) { + var cap = this.rules.block.hr.exec(src); if (cap) { return { type: 'hr', raw: cap[0] }; } - } + }; - blockquote(src) { - const cap = this.rules.block.blockquote.exec(src); + Tokenizer.prototype.blockquote = function blockquote (src) { + var cap = this.rules.block.blockquote.exec(src); if (cap) { - const text = cap[0].replace(/^ *> ?/gm, ''); + var text = cap[0].replace(/^ *> ?/gm, ''); return { type: 'blockquote', raw: cap[0], - text + text: text }; } - } + }; - list(src) { - const cap = this.rules.block.list.exec(src); + Tokenizer.prototype.list = function list (src) { + var cap = this.rules.block.list.exec(src); if (cap) { - let raw = cap[0]; - const bull = cap[2]; - const isordered = bull.length > 1; + var raw = cap[0]; + var bull = cap[2]; + var isordered = bull.length > 1; - const list = { + var list = { type: 'list', - raw, + raw: raw, ordered: isordered, start: isordered ? +bull : '', loose: false, @@ -31946,9 +31999,9 @@ }; // Get each top-level item. - const itemMatch = cap[0].match(this.rules.block.item); + var itemMatch = cap[0].match(this.rules.block.item); - let next = false, + var next = false, item, space, b, @@ -31957,8 +32010,8 @@ istask, ischecked; - const l = itemMatch.length; - for (let i = 0; i < l; i++) { + var l = itemMatch.length; + for (var i = 0; i < l; i++) { item = itemMatch[i]; raw = item; @@ -31994,7 +32047,7 @@ loose = next || /\n\n(?!\s*$)/.test(item); if (i !== l - 1) { next = item.charAt(item.length - 1) === '\n'; - if (!loose) loose = next; + if (!loose) { loose = next; } } if (loose) { @@ -32010,7 +32063,7 @@ } list.items.push({ - raw, + raw: raw, task: istask, checked: ischecked, loose: loose, @@ -32020,10 +32073,10 @@ return list; } - } + }; - html(src) { - const cap = this.rules.block.html.exec(src); + Tokenizer.prototype.html = function html (src) { + var cap = this.rules.block.html.exec(src); if (cap) { return { type: this.options.sanitize @@ -32035,26 +32088,26 @@ text: this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$2(cap[0])) : cap[0] }; } - } + }; - def(src) { - const cap = this.rules.block.def.exec(src); + Tokenizer.prototype.def = function def (src) { + var cap = this.rules.block.def.exec(src); if (cap) { - if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1); - const tag = cap[1].toLowerCase().replace(/\s+/g, ' '); + if (cap[3]) { cap[3] = cap[3].substring(1, cap[3].length - 1); } + var tag = cap[1].toLowerCase().replace(/\s+/g, ' '); return { - tag, + tag: tag, raw: cap[0], href: cap[2], title: cap[3] }; } - } + }; - table(src) { - const cap = this.rules.block.table.exec(src); + Tokenizer.prototype.table = function table (src) { + var cap = this.rules.block.table.exec(src); if (cap) { - const item = { + var item = { type: 'table', header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), @@ -32064,8 +32117,8 @@ if (item.header.length === item.align.length) { item.raw = cap[0]; - let l = item.align.length; - let i; + var l = item.align.length; + var i; for (i = 0; i < l; i++) { if (/^ *-+: *$/.test(item.align[i])) { item.align[i] = 'right'; @@ -32088,10 +32141,10 @@ return item; } } - } + }; - lheading(src) { - const cap = this.rules.block.lheading.exec(src); + Tokenizer.prototype.lheading = function lheading (src) { + var cap = this.rules.block.lheading.exec(src); if (cap) { return { type: 'heading', @@ -32100,10 +32153,10 @@ text: cap[1] }; } - } + }; - paragraph(src) { - const cap = this.rules.block.paragraph.exec(src); + Tokenizer.prototype.paragraph = function paragraph (src) { + var cap = this.rules.block.paragraph.exec(src); if (cap) { return { type: 'paragraph', @@ -32113,10 +32166,10 @@ : cap[1] }; } - } + }; - text(src) { - const cap = this.rules.block.text.exec(src); + Tokenizer.prototype.text = function text (src) { + var cap = this.rules.block.text.exec(src); if (cap) { return { type: 'text', @@ -32124,10 +32177,10 @@ text: cap[0] }; } - } + }; - escape(src) { - const cap = this.rules.inline.escape.exec(src); + Tokenizer.prototype.escape = function escape$1 (src) { + var cap = this.rules.inline.escape.exec(src); if (cap) { return { type: 'escape', @@ -32135,10 +32188,10 @@ text: escape$2(cap[1]) }; } - } + }; - tag(src, inLink, inRawBlock) { - const cap = this.rules.inline.tag.exec(src); + Tokenizer.prototype.tag = function tag (src, inLink, inRawBlock) { + var cap = this.rules.inline.tag.exec(src); if (cap) { if (!inLink && /^ -1) { - const start = cap[0].indexOf('!') === 0 ? 5 : 4; - const linkLen = start + cap[1].length + lastParenIndex; + var start = cap[0].indexOf('!') === 0 ? 5 : 4; + var linkLen = start + cap[1].length + lastParenIndex; cap[2] = cap[2].substring(0, lastParenIndex); cap[0] = cap[0].substring(0, linkLen).trim(); cap[3] = ''; } - let href = cap[2]; - let title = ''; + var href = cap[2]; + var title = ''; if (this.options.pedantic) { - const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); + var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); if (link) { href = link[1]; @@ -32193,35 +32246,35 @@ title = cap[3] ? cap[3].slice(1, -1) : ''; } href = href.trim().replace(/^<([\s\S]*)>$/, '$1'); - const token = outputLink(cap, { + var token = outputLink(cap, { href: href ? href.replace(this.rules.inline._escapes, '$1') : href, title: title ? title.replace(this.rules.inline._escapes, '$1') : title }, cap[0]); return token; } - } + }; - reflink(src, links) { - let cap; + Tokenizer.prototype.reflink = function reflink (src, links) { + var cap; if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { - let link = (cap[2] || cap[1]).replace(/\s+/g, ' '); + var link = (cap[2] || cap[1]).replace(/\s+/g, ' '); link = links[link.toLowerCase()]; if (!link || !link.href) { - const text = cap[0].charAt(0); + var text = cap[0].charAt(0); return { type: 'text', raw: text, - text + text: text }; } - const token = outputLink(cap, link, cap[0]); + var token = outputLink(cap, link, cap[0]); return token; } - } + }; - strong(src) { - const cap = this.rules.inline.strong.exec(src); + Tokenizer.prototype.strong = function strong (src) { + var cap = this.rules.inline.strong.exec(src); if (cap) { return { type: 'strong', @@ -32229,10 +32282,10 @@ text: cap[4] || cap[3] || cap[2] || cap[1] }; } - } + }; - em(src) { - const cap = this.rules.inline.em.exec(src); + Tokenizer.prototype.em = function em (src) { + var cap = this.rules.inline.em.exec(src); if (cap) { return { type: 'em', @@ -32240,10 +32293,10 @@ text: cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1] }; } - } + }; - codespan(src) { - const cap = this.rules.inline.code.exec(src); + Tokenizer.prototype.codespan = function codespan (src) { + var cap = this.rules.inline.code.exec(src); if (cap) { return { type: 'codespan', @@ -32251,20 +32304,20 @@ text: escape$2(cap[2].trim(), true) }; } - } + }; - br(src) { - const cap = this.rules.inline.br.exec(src); + Tokenizer.prototype.br = function br (src) { + var cap = this.rules.inline.br.exec(src); if (cap) { return { type: 'br', raw: cap[0] }; } - } + }; - del(src) { - const cap = this.rules.inline.del.exec(src); + Tokenizer.prototype.del = function del (src) { + var cap = this.rules.inline.del.exec(src); if (cap) { return { type: 'del', @@ -32272,12 +32325,12 @@ text: cap[1] }; } - } + }; - autolink(src, mangle) { - const cap = this.rules.inline.autolink.exec(src); + Tokenizer.prototype.autolink = function autolink (src, mangle) { + var cap = this.rules.inline.autolink.exec(src); if (cap) { - let text, href; + var text, href; if (cap[2] === '@') { text = escape$2(this.options.mangle ? mangle(cap[1]) : cap[1]); href = 'mailto:' + text; @@ -32289,29 +32342,29 @@ return { type: 'link', raw: cap[0], - text, - href, + text: text, + href: href, tokens: [ { type: 'text', raw: text, - text + text: text } ] }; } - } + }; - url(src, mangle) { - let cap; + Tokenizer.prototype.url = function url (src, mangle) { + var cap; if (cap = this.rules.inline.url.exec(src)) { - let text, href; + var text, href; if (cap[2] === '@') { text = escape$2(this.options.mangle ? mangle(cap[0]) : cap[0]); href = 'mailto:' + text; } else { // do extended autolink path validation - let prevCapZero; + var prevCapZero; do { prevCapZero = cap[0]; cap[0] = this.rules.inline._backpedal.exec(cap[0])[0]; @@ -32326,23 +32379,23 @@ return { type: 'link', raw: cap[0], - text, - href, + text: text, + href: href, tokens: [ { type: 'text', raw: text, - text + text: text } ] }; } - } + }; - inlineText(src, inRawBlock, smartypants) { - const cap = this.rules.inline.text.exec(src); + Tokenizer.prototype.inlineText = function inlineText (src, inRawBlock, smartypants) { + var cap = this.rules.inline.text.exec(src); if (cap) { - let text; + var text; if (inRawBlock) { text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$2(cap[0])) : cap[0]; } else { @@ -32351,22 +32404,22 @@ return { type: 'text', raw: cap[0], - text + text: text }; } - } - }; + }; - const { - noopTest: noopTest$1, - edit: edit$1, - merge: merge$2 - } = helpers; + return Tokenizer; + }()); + + var noopTest$1 = helpers.noopTest; + var edit$1 = helpers.edit; + var merge$2 = helpers.merge; /** * Block-Level Grammar */ - const block = { + var block = { newline: /^\n+/, code: /^( {4}[^\n]+\n*)+/, fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, @@ -32514,7 +32567,7 @@ /** * Inline-Level Grammar */ - const inline = { + var inline = { escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, url: noopTest$1, @@ -32620,12 +32673,13 @@ }); var rules = { - block, - inline + block: block, + inline: inline }; - const { defaults: defaults$2 } = defaults; - const { block: block$1, inline: inline$1 } = rules; + var defaults$2 = defaults.defaults; + var block$1 = rules.block; + var inline$1 = rules.inline; /** * smartypants text replacement @@ -32652,11 +32706,11 @@ * mangle email addresses */ function mangle(text) { - let out = '', + var out = '', i, ch; - const l = text.length; + var l = text.length; for (i = 0; i < l; i++) { ch = text.charCodeAt(i); if (Math.random() > 0.5) { @@ -32671,8 +32725,8 @@ /** * Block Lexer */ - var Lexer_1 = class Lexer { - constructor(options) { + var Lexer_1 = /*@__PURE__*/(function () { + function Lexer(options) { this.tokens = []; this.tokens.links = Object.create(null); this.options = options || defaults$2; @@ -32680,7 +32734,7 @@ this.tokenizer = this.options.tokenizer; this.tokenizer.options = this.options; - const rules = { + var rules = { block: block$1.normal, inline: inline$1.normal }; @@ -32699,28 +32753,30 @@ this.tokenizer.rules = rules; } + var staticAccessors = { rules: { configurable: true } }; + /** * Expose Rules */ - static get rules() { + staticAccessors.rules.get = function () { return { block: block$1, inline: inline$1 }; - } + }; /** * Static Lex Method */ - static lex(src, options) { - const lexer = new Lexer(options); + Lexer.lex = function lex (src, options) { + var lexer = new Lexer(options); return lexer.lex(src); - } + }; /** * Preprocessing */ - lex(src) { + Lexer.prototype.lex = function lex (src) { src = src .replace(/\r\n|\r/g, '\n') .replace(/\t/g, ' '); @@ -32730,14 +32786,17 @@ this.inline(this.tokens); return this.tokens; - } + }; /** * Lexing */ - blockTokens(src, tokens = [], top = true) { + Lexer.prototype.blockTokens = function blockTokens (src, tokens, top) { + if ( tokens === void 0 ) tokens = []; + if ( top === void 0 ) top = true; + src = src.replace(/^ +$/gm, ''); - let token, i, l; + var token, i, l; while (src) { // newline @@ -32851,7 +32910,7 @@ } if (src) { - const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); + var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); if (this.options.silent) { console.error(errMsg); break; @@ -32862,17 +32921,17 @@ } return tokens; - } + }; - inline(tokens) { - let i, + Lexer.prototype.inline = function inline (tokens) { + var i, j, k, l2, row, token; - const l = tokens.length; + var l = tokens.length; for (i = 0; i < l; i++) { token = tokens[i]; switch (token.type) { @@ -32924,13 +32983,17 @@ } return tokens; - } + }; /** * Lexing/Compiling */ - inlineTokens(src, tokens = [], inLink = false, inRawBlock = false) { - let token; + Lexer.prototype.inlineTokens = function inlineTokens (src, tokens, inLink, inRawBlock) { + if ( tokens === void 0 ) tokens = []; + if ( inLink === void 0 ) inLink = false; + if ( inRawBlock === void 0 ) inRawBlock = false; + + var token; while (src) { // escape @@ -33029,7 +33092,7 @@ } if (src) { - const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); + var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); if (this.options.silent) { console.error(errMsg); break; @@ -33040,36 +33103,38 @@ } return tokens; - } - }; + }; + + Object.defineProperties( Lexer, staticAccessors ); + + return Lexer; + }()); - const { defaults: defaults$3 } = defaults; - const { - cleanUrl: cleanUrl$1, - escape: escape$3 - } = helpers; + var defaults$3 = defaults.defaults; + var cleanUrl$1 = helpers.cleanUrl; + var escape$3 = helpers.escape; /** * Renderer */ - var Renderer_1 = class Renderer { - constructor(options) { + var Renderer_1 = /*@__PURE__*/(function () { + function Renderer(options) { this.options = options || defaults$3; } - code(code, infostring, escaped) { - const lang = (infostring || '').match(/\S*/)[0]; + Renderer.prototype.code = function code (code$1, infostring, escaped) { + var lang = (infostring || '').match(/\S*/)[0]; if (this.options.highlight) { - const out = this.options.highlight(code, lang); - if (out != null && out !== code) { + var out = this.options.highlight(code$1, lang); + if (out != null && out !== code$1) { escaped = true; - code = out; + code$1 = out; } } if (!lang) { return '
'
-	        + (escaped ? code : escape$3(code, true))
+	        + (escaped ? code$1 : escape$3(code$1, true))
 	        + '
'; } @@ -33077,19 +33142,19 @@ + this.options.langPrefix + escape$3(lang, true) + '">' - + (escaped ? code : escape$3(code, true)) + + (escaped ? code$1 : escape$3(code$1, true)) + '\n'; - } + }; - blockquote(quote) { + Renderer.prototype.blockquote = function blockquote (quote) { return '
\n' + quote + '
\n'; - } + }; - html(html) { - return html; - } + Renderer.prototype.html = function html (html$1) { + return html$1; + }; - heading(text, level, raw, slugger) { + Renderer.prototype.heading = function heading (text, level, raw, slugger) { if (this.options.headerIds) { return '' + text + '\n'; - } + }; - hr() { + Renderer.prototype.hr = function hr () { return this.options.xhtml ? '
\n' : '
\n'; - } + }; - list(body, ordered, start) { - const type = ordered ? 'ol' : 'ul', + Renderer.prototype.list = function list (body, ordered, start) { + var type = ordered ? 'ol' : 'ul', startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; return '<' + type + startatt + '>\n' + body + '\n'; - } + }; - listitem(text) { + Renderer.prototype.listitem = function listitem (text) { return '
  • ' + text + '
  • \n'; - } + }; - checkbox(checked) { + Renderer.prototype.checkbox = function checkbox (checked) { return ' '; - } + }; - paragraph(text) { + Renderer.prototype.paragraph = function paragraph (text) { return '

    ' + text + '

    \n'; - } + }; - table(header, body) { - if (body) body = '' + body + ''; + Renderer.prototype.table = function table (header, body) { + if (body) { body = '' + body + ''; } return '\n' + '\n' @@ -33141,129 +33206,134 @@ + '\n' + body + '
    \n'; - } + }; - tablerow(content) { + Renderer.prototype.tablerow = function tablerow (content) { return '\n' + content + '\n'; - } + }; - tablecell(content, flags) { - const type = flags.header ? 'th' : 'td'; - const tag = flags.align + Renderer.prototype.tablecell = function tablecell (content, flags) { + var type = flags.header ? 'th' : 'td'; + var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>'; return tag + content + '\n'; - } + }; // span level renderer - strong(text) { + Renderer.prototype.strong = function strong (text) { return '' + text + ''; - } + }; - em(text) { + Renderer.prototype.em = function em (text) { return '' + text + ''; - } + }; - codespan(text) { + Renderer.prototype.codespan = function codespan (text) { return '' + text + ''; - } + }; - br() { + Renderer.prototype.br = function br () { return this.options.xhtml ? '
    ' : '
    '; - } + }; - del(text) { + Renderer.prototype.del = function del (text) { return '' + text + ''; - } + }; - link(href, title, text) { + Renderer.prototype.link = function link (href, title, text) { href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href); if (href === null) { return text; } - let out = '
    '; return out; - } + }; - image(href, title, text) { + Renderer.prototype.image = function image (href, title, text) { href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href); if (href === null) { return text; } - let out = '' + text + '' : '>'; return out; - } + }; - text(text) { - return text; - } - }; + Renderer.prototype.text = function text (text$1) { + return text$1; + }; + + return Renderer; + }()); /** * TextRenderer * returns only the textual part of the token */ - var TextRenderer_1 = class TextRenderer { - // no need for block level renderers - strong(text) { - return text; - } + var TextRenderer_1 = /*@__PURE__*/(function () { + function TextRenderer () {} - em(text) { + TextRenderer.prototype.strong = function strong (text) { return text; - } + }; - codespan(text) { + TextRenderer.prototype.em = function em (text) { return text; - } + }; - del(text) { + TextRenderer.prototype.codespan = function codespan (text) { return text; - } + }; - html(text) { + TextRenderer.prototype.del = function del (text) { return text; - } + }; - text(text) { + TextRenderer.prototype.html = function html (text) { return text; - } + }; + + TextRenderer.prototype.text = function text (text$1) { + return text$1; + }; - link(href, title, text) { + TextRenderer.prototype.link = function link (href, title, text) { return '' + text; - } + }; - image(href, title, text) { + TextRenderer.prototype.image = function image (href, title, text) { return '' + text; - } + }; - br() { + TextRenderer.prototype.br = function br () { return ''; - } - }; + }; + + return TextRenderer; + }()); /** * Slugger generates header id */ - var Slugger_1 = class Slugger { - constructor() { + var Slugger_1 = /*@__PURE__*/(function () { + function Slugger() { this.seen = {}; } /** * Convert string to unique id */ - slug(value) { - let slug = value + Slugger.prototype.slug = function slug (value) { + var slug = value .toLowerCase() .trim() // remove html tags @@ -33273,7 +33343,7 @@ .replace(/\s/g, '-'); if (this.seen.hasOwnProperty(slug)) { - const originalSlug = slug; + var originalSlug = slug; do { this.seen[originalSlug]++; slug = originalSlug + '-' + this.seen[originalSlug]; @@ -33282,19 +33352,19 @@ this.seen[slug] = 0; return slug; - } - }; + }; + + return Slugger; + }()); - const { defaults: defaults$4 } = defaults; - const { - unescape: unescape$2 - } = helpers; + var defaults$4 = defaults.defaults; + var unescape$2 = helpers.unescape; /** * Parsing & Compiling */ - var Parser_1 = class Parser { - constructor(options) { + var Parser_1 = /*@__PURE__*/(function () { + function Parser(options) { this.options = options || defaults$4; this.options.renderer = this.options.renderer || new Renderer_1(); this.renderer = this.options.renderer; @@ -33306,16 +33376,18 @@ /** * Static Parse Method */ - static parse(tokens, options) { - const parser = new Parser(options); + Parser.parse = function parse (tokens, options) { + var parser = new Parser(options); return parser.parse(tokens); - } + }; /** * Parse Loop */ - parse(tokens, top = true) { - let out = '', + Parser.prototype.parse = function parse (tokens, top) { + if ( top === void 0 ) top = true; + + var out = '', i, j, k, @@ -33335,7 +33407,7 @@ task, checkbox; - const l = tokens.length; + var l = tokens.length; for (i = 0; i < l; i++) { token = tokens[i]; switch (token.type) { @@ -33456,7 +33528,7 @@ continue; } default: { - const errMsg = 'Token with "' + token.type + '" type was not found.'; + var errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return; @@ -33468,18 +33540,18 @@ } return out; - } + }; /** * Parse Inline Tokens */ - parseInline(tokens, renderer) { + Parser.prototype.parseInline = function parseInline (tokens, renderer) { renderer = renderer || this.renderer; - let out = '', + var out = '', i, token; - const l = tokens.length; + var l = tokens.length; for (i = 0; i < l; i++) { token = tokens[i]; switch (token.type) { @@ -33524,7 +33596,7 @@ break; } default: { - const errMsg = 'Token with "' + token.type + '" type was not found.'; + var errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return; @@ -33535,19 +33607,17 @@ } } return out; - } - }; + }; + + return Parser; + }()); - const { - merge: merge$3, - checkSanitizeDeprecation: checkSanitizeDeprecation$1, - escape: escape$4 - } = helpers; - const { - getDefaults, - changeDefaults, - defaults: defaults$5 - } = defaults; + var merge$3 = helpers.merge; + var checkSanitizeDeprecation$1 = helpers.checkSanitizeDeprecation; + var escape$4 = helpers.escape; + var getDefaults = defaults.getDefaults; + var changeDefaults = defaults.changeDefaults; + var defaults$5 = defaults.defaults; /** * Marked @@ -33570,8 +33640,8 @@ opt = merge$3({}, marked.defaults, opt || {}); checkSanitizeDeprecation$1(opt); - const highlight = opt.highlight; - let tokens, + var highlight = opt.highlight; + var tokens, pending, i = 0; @@ -33583,13 +33653,13 @@ pending = tokens.length; - const done = function(err) { + var done = function(err) { if (err) { opt.highlight = highlight; return callback(err); } - let out; + var out; try { out = Parser_1.parse(tokens, opt); @@ -33610,7 +33680,7 @@ delete opt.highlight; - if (!pending) return done(); + if (!pending) { return done(); } for (; i < tokens.length; i++) { (function(token) { @@ -33618,7 +33688,7 @@ return --pending || done(); } return highlight(token.text, token.lang, function(err, code) { - if (err) return done(err); + if (err) { return done(err); } if (code == null || code === token.text) { return --pending || done(); } @@ -33635,14 +33705,14 @@ opt = merge$3({}, marked.defaults, opt || {}); checkSanitizeDeprecation$1(opt); return Parser_1.parse(Lexer_1.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/markedjs/marked.'; + } catch (e$1) { + e$1.message += '\nPlease report this to https://github.com/markedjs/marked.'; if ((opt || marked.defaults).silent) { return '

    An error occurred:

    '
    -	        + escape$4(e.message + '', true)
    +	        + escape$4(e$1.message + '', true)
     	        + '
    '; } - throw e; + throw e$1; } } @@ -33666,33 +33736,43 @@ */ marked.use = function(extension) { - const opts = merge$3({}, extension); + var opts = merge$3({}, extension); if (extension.renderer) { - const renderer = marked.defaults.renderer || new Renderer_1(); - for (const prop in extension.renderer) { - const prevRenderer = renderer[prop]; - renderer[prop] = (...args) => { - let ret = extension.renderer[prop].apply(renderer, args); + var renderer = marked.defaults.renderer || new Renderer_1(); + var loop = function ( prop ) { + var prevRenderer = renderer[prop]; + renderer[prop] = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ret = extension.renderer[prop].apply(renderer, args); if (ret === false) { ret = prevRenderer.apply(renderer, args); } return ret; }; - } + }; + + for (var prop in extension.renderer) loop( prop ); opts.renderer = renderer; } if (extension.tokenizer) { - const tokenizer = marked.defaults.tokenizer || new Tokenizer_1(); - for (const prop in extension.tokenizer) { - const prevTokenizer = tokenizer[prop]; - tokenizer[prop] = (...args) => { - let ret = extension.tokenizer[prop].apply(tokenizer, args); + var tokenizer = marked.defaults.tokenizer || new Tokenizer_1(); + var loop$1 = function ( prop ) { + var prevTokenizer = tokenizer[prop$1]; + tokenizer[prop$1] = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ret = extension.tokenizer[prop$1].apply(tokenizer, args); if (ret === false) { ret = prevTokenizer.apply(tokenizer, args); } return ret; }; - } + }; + + for (var prop$1 in extension.tokenizer) loop$1( prop ); opts.tokenizer = tokenizer; } marked.setOptions(opts); @@ -33719,14 +33799,14 @@ var marked_1 = marked; - const tiler$2 = utilTiler(); - const dispatch$3 = dispatch('loaded'); - const _tileZoom$2 = 14; - const _osmoseUrlRoot = 'https://osmose.openstreetmap.fr/api/0.3'; - let _osmoseData = { icons: {}, items: [] }; + var tiler$2 = utilTiler(); + var dispatch$3 = dispatch('loaded'); + var _tileZoom$2 = 14; + var _osmoseUrlRoot = 'https://osmose.openstreetmap.fr/api/0.3'; + var _osmoseData = { icons: {}, items: [] }; // This gets reassigned if reset - let _cache$2; + var _cache$2; function abortRequest$2(controller) { if (controller) { @@ -33735,8 +33815,8 @@ } function abortUnwantedRequests$2(cache, tiles) { - Object.keys(cache.inflightTile).forEach(k => { - let wanted = tiles.find(tile => k === tile.id); + Object.keys(cache.inflightTile).forEach(function (k) { + var wanted = tiles.find(function (tile) { return k === tile.id; }); if (!wanted) { abortRequest$2(cache.inflightTile[k]); delete cache.inflightTile[k]; @@ -33750,7 +33830,7 @@ // Replace or remove QAItem from rtree function updateRtree$2(item, replace) { - _cache$2.rtree.remove(item, (a, b) => a.data.id === b.data.id); + _cache$2.rtree.remove(item, function (a, b) { return a.data.id === b.data.id; }); if (replace) { _cache$2.rtree.insert(item); @@ -33759,12 +33839,12 @@ // Issues shouldn't obscure eachother function preventCoincident$1(loc) { - let coincident = false; + var coincident = false; do { // first time, move marker up. after that, move marker right. - let delta = coincident ? [0.00001, 0] : [0, 0.00001]; + var delta = coincident ? [0.00001, 0] : [0, 0.00001]; loc = geoVecAdd(loc, delta); - let bbox = geoExtent(loc).bbox(); + var bbox = geoExtent(loc).bbox(); coincident = _cache$2.rtree.search(bbox).length; } while (coincident); @@ -33774,13 +33854,13 @@ var serviceOsmose = { title: 'osmose', - init() { + init: function init() { _mainFileFetcher.get('qa_data') - .then(d => { + .then(function (d) { _osmoseData = d.osmose; _osmoseData.items = Object.keys(d.osmose.icons) - .map(s => s.split('-')[0]) - .reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []); + .map(function (s) { return s.split('-')[0]; }) + .reduce(function (unique, item) { return unique.indexOf(item) !== -1 ? unique : unique.concat( [item]); }, []); }); if (!_cache$2) { @@ -33790,9 +33870,9 @@ this.event = utilRebind(this, dispatch$3, 'on'); }, - reset() { - let _strings = {}; - let _colors = {}; + reset: function reset() { + var _strings = {}; + var _colors = {}; if (_cache$2) { Object.values(_cache$2.inflightTile).forEach(abortRequest$2); // Strings and colors are static and should not be re-populated @@ -33811,15 +33891,17 @@ }; }, - loadIssues(projection) { - let params = { + loadIssues: function loadIssues(projection) { + var this$1 = this; + + var params = { // Tiles return a maximum # of issues // So we want to filter our request for only types iD supports item: _osmoseData.items }; // determine the needed tiles to cover the view - let tiles = tiler$2 + var tiles = tiler$2 .zoomExtent([_tileZoom$2, _tileZoom$2]) .getTiles(projection); @@ -33827,33 +33909,39 @@ abortUnwantedRequests$2(_cache$2, tiles); // issue new requests.. - tiles.forEach(tile => { - if (_cache$2.loadedTile[tile.id] || _cache$2.inflightTile[tile.id]) return; + tiles.forEach(function (tile) { + if (_cache$2.loadedTile[tile.id] || _cache$2.inflightTile[tile.id]) { return; } - let [ x, y, z ] = tile.xyz; - let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.json?` + utilQsString(params); + var ref = tile.xyz; + var x = ref[0]; + var y = ref[1]; + var z = ref[2]; + var url = _osmoseUrlRoot + "/issues/" + z + "/" + x + "/" + y + ".json?" + utilQsString(params); - let controller = new AbortController(); + var controller = new AbortController(); _cache$2.inflightTile[tile.id] = controller; d3_json(url, { signal: controller.signal }) - .then(data => { + .then(function (data) { delete _cache$2.inflightTile[tile.id]; _cache$2.loadedTile[tile.id] = true; if (data.features) { - data.features.forEach(issue => { - const { item, class: cl, uuid: id } = issue.properties; + data.features.forEach(function (issue) { + var ref = issue.properties; + var item = ref.item; + var cl = ref.class; + var id = ref.uuid; /* Osmose issues are uniquely identified by a unique `item` and `class` combination (both integer values) */ - const itemType = `${item}-${cl}`; + var itemType = item + "-" + cl; // Filter out unsupported issue types (some are too specific or advanced) if (itemType in _osmoseData.icons) { - let loc = issue.geometry.coordinates; // lon, lat + var loc = issue.geometry.coordinates; // lon, lat loc = preventCoincident$1(loc); - let d = new QAItem(loc, this, itemType, id, { item }); + var d = new QAItem(loc, this$1, itemType, id, { item: item }); // Setting elems here prevents UI detail requests if (item === 8300 || item === 8360) { @@ -33868,36 +33956,40 @@ dispatch$3.call('loaded'); }) - .catch(() => { + .catch(function () { delete _cache$2.inflightTile[tile.id]; _cache$2.loadedTile[tile.id] = true; }); }); }, - loadIssueDetail(issue) { + loadIssueDetail: function loadIssueDetail(issue) { + var this$1 = this; + // Issue details only need to be fetched once if (issue.elems !== undefined) { return Promise.resolve(issue); } - const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`; - const cacheDetails = data => { + var url = _osmoseUrlRoot + "/issue/" + (issue.id) + "?langs=" + (_mainLocalizer.localeCode()); + var cacheDetails = function (data) { // Associated elements used for highlighting // Assign directly for immediate use in the callback - issue.elems = data.elems.map(e => e.type.substring(0,1) + e.id); + issue.elems = data.elems.map(function (e) { return e.type.substring(0,1) + e.id; }); // Some issues have instance specific detail in a subtitle issue.detail = data.subtitle ? marked_1(data.subtitle.auto) : ''; - this.replaceItem(issue); + this$1.replaceItem(issue); }; - return d3_json(url).then(cacheDetails).then(() => issue); + return d3_json(url).then(cacheDetails).then(function () { return issue; }); }, - loadStrings(locale=_mainLocalizer.localeCode()) { - const items = Object.keys(_osmoseData.icons); + loadStrings: function loadStrings(locale) { + if ( locale === void 0 ) locale=_mainLocalizer.localeCode(); + + var items = Object.keys(_osmoseData.icons); if ( locale in _cache$2.strings @@ -33913,76 +34005,89 @@ // Only need to cache strings for supported issue types // Using multiple individual item + class requests to reduce fetched data size - const allRequests = items.map(itemType => { + var allRequests = items.map(function (itemType) { // No need to request data we already have - if (itemType in _cache$2.strings[locale]) return; + if (itemType in _cache$2.strings[locale]) { return; } - const cacheData = data => { + var cacheData = function (data) { // Bunch of nested single value arrays of objects - const [ cat = {items:[]} ] = data.categories; - const [ item = {class:[]} ] = cat.items; - const [ cl = null ] = item.class; + var ref = data.categories; + var cat = ref[0]; if ( cat === void 0 ) cat = {items:[]}; + var ref$1 = cat.items; + var item = ref$1[0]; if ( item === void 0 ) item = {class:[]}; + var ref$2 = item.class; + var cl = ref$2[0]; if ( cl === void 0 ) cl = null; // If null default value is reached, data wasn't as expected (or was empty) if (!cl) { /* eslint-disable no-console */ - console.log(`Osmose strings request (${itemType}) had unexpected data`); + console.log(("Osmose strings request (" + itemType + ") had unexpected data")); /* eslint-enable no-console */ return; } // Cache served item colors to automatically style issue markers later - const { item: itemInt, color } = item; + var itemInt = item.item; + var color = item.color; if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color)) { _cache$2.colors[itemInt] = color; } // Value of root key will be null if no string exists // If string exists, value is an object with key 'auto' for string - const { title, detail, fix, trap } = cl; + var title = cl.title; + var detail = cl.detail; + var fix = cl.fix; + var trap = cl.trap; // Osmose titles shouldn't contain markdown - let issueStrings = {}; - if (title) issueStrings.title = title.auto; - if (detail) issueStrings.detail = marked_1(detail.auto); - if (trap) issueStrings.trap = marked_1(trap.auto); - if (fix) issueStrings.fix = marked_1(fix.auto); + var issueStrings = {}; + if (title) { issueStrings.title = title.auto; } + if (detail) { issueStrings.detail = marked_1(detail.auto); } + if (trap) { issueStrings.trap = marked_1(trap.auto); } + if (fix) { issueStrings.fix = marked_1(fix.auto); } _cache$2.strings[locale][itemType] = issueStrings; }; - const [ item, cl ] = itemType.split('-'); + var ref = itemType.split('-'); + var item = ref[0]; + var cl = ref[1]; // Osmose API falls back to English strings where untranslated or if locale doesn't exist - const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale}`; + var url = _osmoseUrlRoot + "/items/" + item + "/class/" + cl + "?langs=" + locale; return d3_json(url).then(cacheData); }); - return Promise.all(allRequests).then(() => _cache$2.strings[locale]); + return Promise.all(allRequests).then(function () { return _cache$2.strings[locale]; }); }, - getStrings(itemType, locale=_mainLocalizer.localeCode()) { + getStrings: function getStrings(itemType, locale) { + if ( locale === void 0 ) locale=_mainLocalizer.localeCode(); + // No need to fallback to English, Osmose API handles this for us return (locale in _cache$2.strings) ? _cache$2.strings[locale][itemType] : {}; }, - getColor(itemType) { + getColor: function getColor(itemType) { return (itemType in _cache$2.colors) ? _cache$2.colors[itemType] : '#FFFFFF'; }, - postUpdate(issue, callback) { + postUpdate: function postUpdate(issue, callback) { + var this$1 = this; + if (_cache$2.inflightPost[issue.id]) { return callback({ message: 'Issue update already inflight', status: -2 }, issue); } // UI sets the status to either 'done' or 'false' - const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`; - const controller = new AbortController(); - const after = () => { + var url = _osmoseUrlRoot + "/issue/" + (issue.id) + "/" + (issue.newStatus); + var controller = new AbortController(); + var after = function () { delete _cache$2.inflightPost[issue.id]; - this.removeItem(issue); + this$1.removeItem(issue); if (issue.newStatus === 'done') { // Keep track of the number of issues closed per `item` to tag the changeset if (!(issue.item in _cache$2.closed)) { @@ -33990,43 +34095,43 @@ } _cache$2.closed[issue.item] += 1; } - if (callback) callback(null, issue); + if (callback) { callback(null, issue); } }; _cache$2.inflightPost[issue.id] = controller; fetch(url, { signal: controller.signal }) .then(after) - .catch(err => { + .catch(function (err) { delete _cache$2.inflightPost[issue.id]; - if (callback) callback(err.message); + if (callback) { callback(err.message); } }); }, // Get all cached QAItems covering the viewport - getItems(projection) { - const viewport = projection.clipExtent(); - const min = [viewport[0][0], viewport[1][1]]; - const max = [viewport[1][0], viewport[0][1]]; - const bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); + getItems: function getItems(projection) { + var viewport = projection.clipExtent(); + var min = [viewport[0][0], viewport[1][1]]; + var max = [viewport[1][0], viewport[0][1]]; + var bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); - return _cache$2.rtree.search(bbox).map(d => d.data); + return _cache$2.rtree.search(bbox).map(function (d) { return d.data; }); }, // Get a QAItem from cache // NOTE: Don't change method name until UI v3 is merged - getError(id) { + getError: function getError(id) { return _cache$2.data[id]; }, // get the name of the icon to display for this item - getIcon(itemType) { + getIcon: function getIcon(itemType) { return _osmoseData.icons[itemType]; }, // Replace a single QAItem in the cache - replaceItem(item) { - if (!(item instanceof QAItem) || !item.id) return; + replaceItem: function replaceItem(item) { + if (!(item instanceof QAItem) || !item.id) { return; } _cache$2.data[item.id] = item; updateRtree$2(encodeIssueRtree$2(item), true); // true = replace @@ -34034,20 +34139,20 @@ }, // Remove a single QAItem from the cache - removeItem(item) { - if (!(item instanceof QAItem) || !item.id) return; + removeItem: function removeItem(item) { + if (!(item instanceof QAItem) || !item.id) { return; } delete _cache$2.data[item.id]; updateRtree$2(encodeIssueRtree$2(item), false); // false = remove }, // Used to populate `closed:osmose:*` changeset tags - getClosedCounts() { + getClosedCounts: function getClosedCounts() { return _cache$2.closed; }, - itemURL(item) { - return `https://osmose.openstreetmap.fr/en/error/${item.id}`; + itemURL: function itemURL(item) { + return ("https://osmose.openstreetmap.fr/en/error/" + (item.id)); } }; @@ -34309,12 +34414,12 @@ function maxPageAtZoom(z) { - if (z < 15) return 2; - if (z === 15) return 5; - if (z === 16) return 10; - if (z === 17) return 20; - if (z === 18) return 40; - if (z > 18) return 80; + if (z < 15) { return 2; } + if (z === 15) { return 5; } + if (z === 16) { return 10; } + if (z === 17) { return 20; } + if (z === 18) { return 40; } + if (z > 18) { return 80; } } @@ -34351,10 +34456,10 @@ bbox: [rect[0], rect[1], rect[2], rect[3]].join(','), }); - if (nextPage > maxPages) return; + if (nextPage > maxPages) { return; } var id = tile.id + ',' + String(nextPage); - if (cache.loaded[id] || cache.inflight[id]) return; + if (cache.loaded[id] || cache.inflight[id]) { return; } var controller = new AbortController(); cache.inflight[id] = controller; @@ -34703,7 +34808,7 @@ } var viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(null); + if (!viewer.empty()) { viewer.datum(null); } viewer .classed('hide', true) @@ -34721,7 +34826,7 @@ updateViewer: function(context, imageKey) { - if (!imageKey) return this; + if (!imageKey) { return this; } if (!_mlyViewer) { this.initViewer(context, imageKey); @@ -34818,7 +34923,7 @@ var d = _mlyCache.images.forImageKey[imageKey]; var viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(d); + if (!viewer.empty()) { viewer.datum(d); } imageKey = (d && d.key) || imageKey; if (!fromViewer && imageKey) { @@ -34908,10 +35013,10 @@ updateDetections: function(d) { - if (!_mlyViewer || _mlyFallback) return; + if (!_mlyViewer || _mlyFallback) { return; } var imageKey = d && d.key; - if (!imageKey) return; + if (!imageKey) { return; } var detections = _mlyCache.image_detections.forImageKey[imageKey] || []; detections.forEach(function(data) { @@ -34924,7 +35029,7 @@ function makeTag(data) { var valueParts = data.value.split('--'); - if (valueParts.length !== 3) return; + if (valueParts.length !== 3) { return; } var text = valueParts[1].replace(/-/g, ' '); var tag; @@ -35342,14 +35447,14 @@ ); if (cached.length > 0) { - if (callback) callback(null, cached[0].data); + if (callback) { callback(null, cached[0].data); } return; } var params = { zoom: 13, format: 'json', addressdetails: 1, lat: loc[1], lon: loc[0] }; var url = apibase$1 + 'reverse?' + utilQsString(params); - if (_inflight[url]) return; + if (_inflight[url]) { return; } var controller = new AbortController(); _inflight[url] = controller; @@ -35361,12 +35466,12 @@ } var extent = geoExtent(loc).padByMeters(200); _nominatimCache.insert(Object.assign(extent.bbox(), {data: result})); - if (callback) callback(null, result); + if (callback) { callback(null, result); } }) .catch(function(err) { delete _inflight[url]; - if (err.name === 'AbortError') return; - if (callback) callback(err.message); + if (err.name === 'AbortError') { return; } + if (callback) { callback(err.message); } }); }, @@ -35375,7 +35480,7 @@ var searchVal = encodeURIComponent(val); var url = apibase$1 + 'search/' + searchVal + '?limit=10&format=json'; - if (_inflight[url]) return; + if (_inflight[url]) { return; } var controller = new AbortController(); _inflight[url] = controller; @@ -35385,12 +35490,12 @@ if (result && result.error) { throw new Error(result.error); } - if (callback) callback(null, result); + if (callback) { callback(null, result); } }) .catch(function(err) { delete _inflight[url]; - if (err.name === 'AbortError') return; - if (callback) callback(err.message); + if (err.name === 'AbortError') { return; } + if (callback) { callback(err.message); } }); } @@ -35415,12 +35520,12 @@ function maxPageAtZoom$1(z) { - if (z < 15) return 2; - if (z === 15) return 5; - if (z === 16) return 10; - if (z === 17) return 20; - if (z === 18) return 40; - if (z > 18) return 80; + if (z < 15) { return 2; } + if (z === 15) { return 5; } + if (z === 16) { return 10; } + if (z === 17) { return 20; } + if (z === 18) { return 40; } + if (z > 18) { return 80; } } @@ -35457,10 +35562,10 @@ bbBottomRight: [bbox.minY, bbox.maxX].join(',') }, true); - if (nextPage > maxPages) return; + if (nextPage > maxPages) { return; } var id = tile.id + ',' + String(nextPage); - if (cache.loaded[id] || cache.inflight[id]) return; + if (cache.loaded[id] || cache.inflight[id]) { return; } var controller = new AbortController(); cache.inflight[id] = controller; @@ -35689,16 +35794,16 @@ function rotate(deg) { return function() { - if (!_oscSelectedImage) return; + if (!_oscSelectedImage) { return; } var sequenceKey = _oscSelectedImage.sequence_id; var sequence = _oscCache.sequences[sequenceKey]; - if (!sequence) return; + if (!sequence) { return; } var r = sequence.rotation || 0; r += deg; - if (r > 180) r -= 360; - if (r < -180) r += 360; + if (r > 180) { r -= 360; } + if (r < -180) { r += 360; } sequence.rotation = r; var wrap = context.container().select('.photoviewer .osc-wrapper'); @@ -35717,14 +35822,14 @@ function step(stepBy) { return function() { - if (!_oscSelectedImage) return; + if (!_oscSelectedImage) { return; } var sequenceKey = _oscSelectedImage.sequence_id; var sequence = _oscCache.sequences[sequenceKey]; - if (!sequence) return; + if (!sequence) { return; } var nextIndex = _oscSelectedImage.sequence_index + stepBy; var nextImage = sequence.images[nextIndex]; - if (!nextImage) return; + if (!nextImage) { return; } context.map().centerEase(nextImage.loc); @@ -35760,7 +35865,7 @@ _oscSelectedImage = null; var viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(null); + if (!viewer.empty()) { viewer.datum(null); } viewer .classed('hide', true) @@ -35834,10 +35939,10 @@ function localeDateString(s) { - if (!s) return null; + if (!s) { return null; } var options = { day: 'numeric', month: 'short', year: 'numeric' }; var d = new Date(s); - if (isNaN(d.getTime())) return null; + if (isNaN(d.getTime())) { return null; } return d.toLocaleDateString(_mainLocalizer.localeCode(), options); } }, @@ -35846,7 +35951,7 @@ selectImage: function(context, d) { _oscSelectedImage = d; var viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(d); + if (!viewer.empty()) { viewer.datum(d); } this.setStyles(context, null, true); @@ -38178,10 +38283,12 @@ var hasOwnProperty$3 = Object.prototype.hasOwnProperty; function extend$2() { + var arguments$1 = arguments; + var target = {}; for (var i = 0; i < arguments.length; i++) { - var source = arguments[i]; + var source = arguments$1[i]; for (var key in source) { if (hasOwnProperty$3.call(source, key)) { @@ -38220,13 +38327,13 @@ twoHundred = /^20\d$/; xhr.onreadystatechange = function() { if (4 === xhr.readyState && 0 !== xhr.status) { - if (twoHundred.test(xhr.status)) callback(null, xhr); - else return callback(xhr, null); + if (twoHundred.test(xhr.status)) { callback(null, xhr); } + else { return callback(xhr, null); } } }; xhr.onerror = function(e) { return callback(e, null); }; xhr.open(method, url, true); - for (var h in headers) xhr.setRequestHeader(h, headers[h]); + for (var h in headers) { xhr.setRequestHeader(h, headers[h]); } xhr.send(data); return xhr; }; @@ -38261,7 +38368,7 @@ }; ohauth.baseString = function(method, url, params) { - if (params.oauth_signature) delete params.oauth_signature; + if (params.oauth_signature) { delete params.oauth_signature; } return [ method, ohauth.percentEncode(url), @@ -38319,7 +38426,7 @@ oauth_nonce: ohauth.nonce() }; - if (token) oauth_params.oauth_token = token; + if (token) { oauth_params.oauth_token = token; } var all_params = immutable({}, oauth_params, query_params, extra_params), base_str = ohauth.baseString(method, base_uri, all_params); @@ -38343,6 +38450,8 @@ }(commonjsGlobal, function() { function resolveUrl(/* ...urls */) { + var arguments$1 = arguments; + var numUrls = arguments.length; if (numUrls === 0) { @@ -38363,7 +38472,7 @@ var resolved; for (var index = 1; index < numUrls; index++) { - a.href = arguments[index]; + a.href = arguments$1[index]; resolved = a.href; base.href = resolved; } @@ -38403,8 +38512,10 @@ return Object.assign } else { return function shimAssign(obj, props1, props2, etc) { + var arguments$1 = arguments; + for (var i = 1; i < arguments.length; i++) { - each(Object(arguments[i]), function(val, key) { + each(Object(arguments$1[i]), function(val, key) { obj[key] = val; }); } @@ -39636,7 +39747,7 @@ // TODO: detect lack of click event oauth.authenticate = function(callback) { - if (oauth.authenticated()) return callback(); + if (oauth.authenticated()) { return callback(); } oauth.logout(); @@ -39667,7 +39778,7 @@ function reqTokenDone(err, xhr) { o.done(); - if (err) return callback(err); + if (err) { return callback(err); } var resp = ohauth_1.stringQs(xhr.response); token('oauth_request_token_secret', resp.oauth_token_secret); var authorize_url = o.url + '/oauth/authorize?' + ohauth_1.qsString({ @@ -39714,7 +39825,7 @@ function accessTokenDone(err, xhr) { o.done(); - if (err) return callback(err); + if (err) { return callback(err); } var access_token = ohauth_1.stringQs(xhr.response); token('oauth_token', access_token.oauth_token); token('oauth_token_secret', access_token.oauth_token_secret); @@ -39745,7 +39856,7 @@ function accessTokenDone(err, xhr) { o.done(); - if (err) return callback(err); + if (err) { return callback(err); } var access_token = ohauth_1.stringQs(xhr.response); token('oauth_token', access_token.oauth_token); token('oauth_token_secret', access_token.oauth_token_secret); @@ -39797,23 +39908,23 @@ } function done(err, xhr) { - if (err) return callback(err); - else if (xhr.responseXML) return callback(err, xhr.responseXML); - else return callback(err, xhr.response); + if (err) { return callback(err); } + else if (xhr.responseXML) { return callback(err, xhr.responseXML); } + else { return callback(err, xhr.response); } } }; // pre-authorize this object, if we can just get a token and token_secret // from the start oauth.preauth = function(c) { - if (!c) return; - if (c.oauth_token) token('oauth_token', c.oauth_token); - if (c.oauth_token_secret) token('oauth_token_secret', c.oauth_token_secret); + if (!c) { return; } + if (c.oauth_token) { token('oauth_token', c.oauth_token); } + if (c.oauth_token_secret) { token('oauth_token_secret', c.oauth_token_secret); } return oauth; }; oauth.options = function(_) { - if (!arguments.length) return o; + if (!arguments.length) { return o; } o = _; o.url = o.url || 'https://www.openstreetmap.org'; @@ -39844,14 +39955,14 @@ if (store_legacy.enabled) { token = function (x, y) { - if (arguments.length === 1) return store_legacy.get(o.url + x); - else if (arguments.length === 2) return store_legacy.set(o.url + x, y); + if (arguments.length === 1) { return store_legacy.get(o.url + x); } + else if (arguments.length === 2) { return store_legacy.set(o.url + x, y); } }; } else { var storage = {}; token = function (x, y) { - if (arguments.length === 1) return storage[o.url + x]; - else if (arguments.length === 2) return storage[o.url + x] = y; + if (arguments.length === 1) { return storage[o.url + x]; } + else if (arguments.length === 2) { return storage[o.url + x] = y; } }; } @@ -40069,8 +40180,8 @@ function abortUnwantedRequests$3(cache, visibleTiles) { Object.keys(cache.inflight).forEach(function(k) { - if (cache.toLoad[k]) return; - if (visibleTiles.find(function(tile) { return k === tile.id; })) return; + if (cache.toLoad[k]) { return; } + if (visibleTiles.find(function(tile) { return k === tile.id; })) { return; } abortRequest$5(cache.inflight[k]); delete cache.inflight[k]; @@ -40161,7 +40272,7 @@ for (var j = 0; j < childNodes.length; j++) { var node = childNodes[j]; var nodeName = node.nodeName; - if (nodeName === '#text') continue; + if (nodeName === '#text') { continue; } parsedComment[nodeName] = node.textContent; if (nodeName === 'uid') { @@ -40245,10 +40356,10 @@ var json = payload; if (typeof json !== 'object') - json = JSON.parse(payload); + { json = JSON.parse(payload); } if (!json.elements) - return callback({ message: 'No JSON', status: -1 }); + { return callback({ message: 'No JSON', status: -1 }); } var children = json.elements; @@ -40257,7 +40368,7 @@ var result; for (var i = 0; i < children.length; i++) { result = parseChild(children[i]); - if (result) results.push(result); + if (result) { results.push(result); } } callback(null, results); }); @@ -40266,13 +40377,13 @@ function parseChild(child) { var parser = jsonparsers[child.type]; - if (!parser) return null; + if (!parser) { return null; } var uid; uid = osmEntity.id.fromOSM(child.type, child.id); if (options.skipSeen) { - if (_tileCache.seen[uid]) return null; // avoid reparsing a "seen" entity + if (_tileCache.seen[uid]) { return null; } // avoid reparsing a "seen" entity _tileCache.seen[uid] = true; } @@ -40349,7 +40460,7 @@ for (var i = 0; i < childNodes.length; i++) { var node = childNodes[i]; var nodeName = node.nodeName; - if (nodeName === '#text') continue; + if (nodeName === '#text') { continue; } // if the element is comments, parse the comments if (nodeName === 'comments') { @@ -40416,7 +40527,7 @@ var result; for (var i = 0; i < children.length; i++) { result = parseChild(children[i]); - if (result) results.push(result); + if (result) { results.push(result); } } callback(null, results); }); @@ -40426,7 +40537,7 @@ function parseChild(child) { var parser = parsers[child.nodeName]; - if (!parser) return null; + if (!parser) { return null; } var uid; if (child.nodeName === 'user') { @@ -40442,7 +40553,7 @@ } else { uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value); if (options.skipSeen) { - if (_tileCache.seen[uid]) return null; // avoid reparsing a "seen" entity + if (_tileCache.seen[uid]) { return null; } // avoid reparsing a "seen" entity _tileCache.seen[uid] = true; } } @@ -40502,7 +40613,7 @@ Object.values(_tileCache.inflight).forEach(abortRequest$5); Object.values(_noteCache.inflight).forEach(abortRequest$5); Object.values(_noteCache.inflightPost).forEach(abortRequest$5); - if (_changeset.inflight) abortRequest$5(_changeset.inflight); + if (_changeset.inflight) { abortRequest$5(_changeset.inflight); } _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() }; _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() }; @@ -40567,7 +40678,7 @@ function done(err, payload) { if (that.getConnectionId() !== cid) { - if (callback) callback({ message: 'Connection Switched', status: -1 }); + if (callback) { callback({ message: 'Connection Switched', status: -1 }); } return; } @@ -40621,7 +40732,7 @@ done(null, data); }) .catch(function(err) { - if (err.name === 'AbortError') return; + if (err.name === 'AbortError') { return; } // d3-fetch includes status in the error message, // but we can't access the response itself // https://github.com/d3/d3-fetch/issues/27 @@ -40648,7 +40759,7 @@ this.loadFromAPI( '/api/0.6/' + type + '/' + osmID + (type !== 'node' ? '/full' : '') + '.json', function(err, entities) { - if (callback) callback(err, { data: entities }); + if (callback) { callback(err, { data: entities }); } }, options ); @@ -40665,7 +40776,7 @@ this.loadFromAPI( '/api/0.6/' + type + '/' + osmID + '/' + version + '.json', function(err, entities) { - if (callback) callback(err, { data: entities }); + if (callback) { callback(err, { data: entities }); } }, options ); @@ -40689,7 +40800,7 @@ that.loadFromAPI( '/api/0.6/' + type + '.json?' + type + '=' + arr.join(), function(err, entities) { - if (callback) callback(err, { data: entities }); + if (callback) { callback(err, { data: entities }); } }, options ); @@ -40748,7 +40859,7 @@ function uploadedChangeset(err) { _changeset.inflight = null; - if (err) return callback(err, changeset); + if (err) { return callback(err, changeset); } // Upload was successful, safe to call the callback. // Add delay to allow for postgres replication #1646 #2678 @@ -40787,7 +40898,7 @@ if (cached.length || !this.authenticated()) { callback(undefined, cached); - if (!this.authenticated()) return; // require auth + if (!this.authenticated()) { return; } // require auth } utilArrayChunk(toLoad, 150).forEach(function(arr) { @@ -40938,7 +41049,7 @@ } else { var waynodes = xml.getElementsByTagName('waynodes'); var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute('maximum'), 10); - if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes; + if (maxWayNodes && isFinite(maxWayNodes)) { _maxWayNodes = maxWayNodes; } var apiStatus = xml.getElementsByTagName('status'); var val = apiStatus[0].getAttribute('api'); @@ -40975,7 +41086,7 @@ // Load data (entities) from the API in tiles // GET /api/0.6/map?bbox= loadTiles: function(projection, callback) { - if (_off) return; + if (_off) { return; } // determine the needed tiles to cover the view var tiles = tiler$5.zoomExtent([_tileZoom$3, _tileZoom$3]).getTiles(projection); @@ -40997,8 +41108,8 @@ // Load a single data tile // GET /api/0.6/map?bbox= loadTile: function(tile, callback) { - if (_off) return; - if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return; + if (_off) { return; } + if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) { return; } if (!hasInflightRequests(_tileCache)) { dispatch$6.call('loading'); // start the spinner @@ -41043,7 +41154,7 @@ // Back off if the toLoad queue is filling up.. re #6417 // (Currently `loadTileAtLoc` requests are considered low priority - used by operations to // let users safely edit geometries which extend to unloaded tiles. We can drop some.) - if (Object.keys(_tileCache.toLoad).length > 50) return; + if (Object.keys(_tileCache.toLoad).length > 50) { return; } var k = geoZoomToScale(_tileZoom$3 + 1); var offset = geoRawMercator().scale(k)(loc); @@ -41051,7 +41162,7 @@ var tiles = tiler$5.zoomExtent([_tileZoom$3, _tileZoom$3]).getTiles(projection); tiles.forEach(function(tile) { - if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return; + if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) { return; } _tileCache.toLoad[tile.id] = true; this.loadTile(tile, callback); @@ -41063,13 +41174,13 @@ // GET /api/0.6/notes?bbox= loadNotes: function(projection, noteOptions) { noteOptions = Object.assign({ limit: 10000, closed: 7 }, noteOptions); - if (_off) return; + if (_off) { return; } var that = this; var path = '/api/0.6/notes?limit=' + noteOptions.limit + '&closed=' + noteOptions.closed + '&bbox='; var throttleLoadUsers = throttle(function() { var uids = Object.keys(_userCache.toLoad); - if (!uids.length) return; + if (!uids.length) { return; } that.loadUsers(uids, function() {}); // eagerly load user details }, 750); @@ -41081,7 +41192,7 @@ // issue new requests.. tiles.forEach(function(tile) { - if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return; + if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) { return; } var options = { skipSeen: false }; _noteCache.inflight[tile.id] = that.loadFromAPI( @@ -41110,7 +41221,7 @@ return callback({ message: 'Note update already inflight', status: -2 }, note); } - if (!note.loc[0] || !note.loc[1] || !note.newComment) return; // location & description required + if (!note.loc[0] || !note.loc[1] || !note.newComment) { return; } // location & description required var comment = note.newComment; if (note.newCategory && note.newCategory !== 'None') { comment += ' #' + note.newCategory; } @@ -41161,7 +41272,7 @@ action = 'reopen'; } else { action = 'comment'; - if (!note.newComment) return; // when commenting, comment required + if (!note.newComment) { return; } // when commenting, comment required } var path = '/api/0.6/notes/' + note.id + '/' + action; @@ -41305,16 +41416,16 @@ function done(err, res) { if (err) { - if (callback) callback(err); + if (callback) { callback(err); } return; } if (that.getConnectionId() !== cid) { - if (callback) callback({ message: 'Connection Switched', status: -1 }); + if (callback) { callback({ message: 'Connection Switched', status: -1 }); } return; } _rateLimitError = undefined; dispatch$6.call('change'); - if (callback) callback(err, res); + if (callback) { callback(err, res); } that.userChangesets(function() {}); // eagerly load user details/changesets } @@ -41328,7 +41439,7 @@ tileZoom: function(val) { - if (!arguments.length) return _tileZoom$3; + if (!arguments.length) { return _tileZoom$3; } _tileZoom$3 = val; return this; }, @@ -41354,7 +41465,7 @@ // remove a single note from the cache removeNote: function(note) { - if (!(note instanceof osmNote) || !note.id) return; + if (!(note instanceof osmNote) || !note.id) { return; } delete _noteCache.note[note.id]; updateRtree$3(encodeNoteRtree(note), false); // false = remove @@ -41363,7 +41474,7 @@ // replace a single note in the cache replaceNote: function(note) { - if (!(note instanceof osmNote) || !note.id) return; + if (!(note instanceof osmNote) || !note.id) { return; } _noteCache.note[note.id] = note; updateRtree$3(encodeNoteRtree(note), true); // true = replace @@ -41388,19 +41499,19 @@ var debouncedRequest = debounce(request, 500, { leading: false }); function request(url, callback) { - if (_inflight$1[url]) return; + if (_inflight$1[url]) { return; } var controller = new AbortController(); _inflight$1[url] = controller; d3_json(url, { signal: controller.signal }) .then(function(result) { delete _inflight$1[url]; - if (callback) callback(null, result); + if (callback) { callback(null, result); } }) .catch(function(err) { delete _inflight$1[url]; - if (err.name === 'AbortError') return; - if (callback) callback(err.message); + if (err.name === 'AbortError') { return; } + if (callback) { callback(err.message); } }); } @@ -41443,7 +41554,7 @@ * @param langCode string e.g. 'fr' for French */ claimToValue: function(entity, property, langCode) { - if (!entity.claims[property]) return undefined; + if (!entity.claims[property]) { return undefined; } var locale = _localeIDs[langCode]; var preferredPick, localePick; @@ -41476,7 +41587,7 @@ * @param property string e.g. 'P31' for monolingual wiki page title */ monolingualClaimToValueObj: function(entity, property) { - if (!entity || !entity.claims[property]) return undefined; + if (!entity || !entity.claims[property]) { return undefined; } return entity.claims[property].reduce(function(acc, obj) { var value = obj.mainsnak.datavalue.value; @@ -41720,7 +41831,7 @@ apibase: function(val) { - if (!arguments.length) return apibase$3; + if (!arguments.length) { return apibase$3; } apibase$3 = val; return this; } @@ -41753,7 +41864,7 @@ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; var c = ''; var i = -1; - while (++i < 15) c += chars.charAt(Math.floor(Math.random() * 52)); + while (++i < 15) { c += chars.charAt(Math.floor(Math.random() * 52)); } return c; } @@ -41787,26 +41898,26 @@ return request; } - const bubbleApi = 'https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?'; - const streetsideImagesApi = 'https://t.ssl.ak.tiles.virtualearth.net/tiles/'; - const bubbleAppKey = 'AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm'; - const pannellumViewerCSS = 'pannellum-streetside/pannellum.css'; - const pannellumViewerJS = 'pannellum-streetside/pannellum.js'; - const maxResults$2 = 2000; - const tileZoom$2 = 16.5; - const tiler$6 = utilTiler().zoomExtent([tileZoom$2, tileZoom$2]).skipNullIsland(true); - const dispatch$7 = dispatch('loadedBubbles', 'viewerChanged'); - const minHfov = 10; // zoom in degrees: 20, 10, 5 - const maxHfov = 90; // zoom out degrees - const defaultHfov = 45; - - let _hires = false; - let _resolution = 512; // higher numbers are slower - 512, 1024, 2048, 4096 - let _currScene = 0; - let _ssCache; - let _pannellumViewer; - let _sceneOptions; - let _dataUrlArray = []; + var bubbleApi = 'https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?'; + var streetsideImagesApi = 'https://t.ssl.ak.tiles.virtualearth.net/tiles/'; + var bubbleAppKey = 'AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm'; + var pannellumViewerCSS = 'pannellum-streetside/pannellum.css'; + var pannellumViewerJS = 'pannellum-streetside/pannellum.js'; + var maxResults$2 = 2000; + var tileZoom$2 = 16.5; + var tiler$6 = utilTiler().zoomExtent([tileZoom$2, tileZoom$2]).skipNullIsland(true); + var dispatch$7 = dispatch('loadedBubbles', 'viewerChanged'); + var minHfov = 10; // zoom in degrees: 20, 10, 5 + var maxHfov = 90; // zoom out degrees + var defaultHfov = 45; + + var _hires = false; + var _resolution = 512; // higher numbers are slower - 512, 1024, 2048, 4096 + var _currScene = 0; + var _ssCache; + var _pannellumViewer; + var _sceneOptions; + var _dataUrlArray = []; /** @@ -41821,10 +41932,10 @@ * localeTimeStamp(). */ function localeTimestamp(s) { - if (!s) return null; - const options = { day: 'numeric', month: 'short', year: 'numeric' }; - const d = new Date(s); - if (isNaN(d.getTime())) return null; + if (!s) { return null; } + var options = { day: 'numeric', month: 'short', year: 'numeric' }; + var d = new Date(s); + if (isNaN(d.getTime())) { return null; } return d.toLocaleString(_mainLocalizer.localeCode(), options); } @@ -41833,19 +41944,19 @@ * loadTiles() wraps the process of generating tiles and then fetching image points for each tile. */ function loadTiles$2(which, url, projection, margin) { - const tiles = tiler$6.margin(margin).getTiles(projection); + var tiles = tiler$6.margin(margin).getTiles(projection); // abort inflight requests that are no longer needed - const cache = _ssCache[which]; - Object.keys(cache.inflight).forEach(k => { - const wanted = tiles.find(tile => k.indexOf(tile.id + ',') === 0); + var cache = _ssCache[which]; + Object.keys(cache.inflight).forEach(function (k) { + var wanted = tiles.find(function (tile) { return k.indexOf(tile.id + ',') === 0; }); if (!wanted) { abortRequest$6(cache.inflight[k]); delete cache.inflight[k]; } }); - tiles.forEach(tile => loadNextTilePage$2(which, url, tile)); + tiles.forEach(function (tile) { return loadNextTilePage$2(which, url, tile); }); } @@ -41853,24 +41964,24 @@ * loadNextTilePage() load data for the next tile page in line. */ function loadNextTilePage$2(which, url, tile) { - const cache = _ssCache[which]; - const nextPage = cache.nextPage[tile.id] || 0; - const id = tile.id + ',' + String(nextPage); - if (cache.loaded[id] || cache.inflight[id]) return; + var cache = _ssCache[which]; + var nextPage = cache.nextPage[tile.id] || 0; + var id = tile.id + ',' + String(nextPage); + if (cache.loaded[id] || cache.inflight[id]) { return; } - cache.inflight[id] = getBubbles(url, tile, (bubbles) => { + cache.inflight[id] = getBubbles(url, tile, function (bubbles) { cache.loaded[id] = true; delete cache.inflight[id]; - if (!bubbles) return; + if (!bubbles) { return; } // [].shift() removes the first element, some statistics info, not a bubble point bubbles.shift(); - const features = bubbles.map(bubble => { - if (cache.points[bubble.id]) return null; // skip duplicates + var features = bubbles.map(function (bubble) { + if (cache.points[bubble.id]) { return null; } // skip duplicates - const loc = [bubble.lo, bubble.la]; - const d = { + var loc = [bubble.lo, bubble.la]; + var d = { loc: loc, key: bubble.id, ca: bubble.he, @@ -41912,16 +42023,16 @@ // call this sometimes to connect the bubbles into sequences function connectSequences() { - let cache = _ssCache.bubbles; - let keepLeaders = []; + var cache = _ssCache.bubbles; + var keepLeaders = []; - for (let i = 0; i < cache.leaders.length; i++) { - let bubble = cache.points[cache.leaders[i]]; - let seen = {}; + for (var i = 0; i < cache.leaders.length; i++) { + var bubble = cache.points[cache.leaders[i]]; + var seen = {}; // try to make a sequence.. use the key of the leader bubble. - let sequence = { key: bubble.key, bubbles: [] }; - let complete = false; + var sequence = { key: bubble.key, bubbles: [] }; + var complete = false; do { sequence.bubbles.push(bubble); @@ -41939,7 +42050,7 @@ _ssCache.sequences[sequence.key] = sequence; // assign bubbles to the sequence - for (let j = 0; j < sequence.bubbles.length; j++) { + for (var j = 0; j < sequence.bubbles.length; j++) { sequence.bubbles[j].sequenceKey = sequence.key; } @@ -41947,7 +42058,7 @@ sequence.geojson = { type: 'LineString', properties: { key: sequence.key }, - coordinates: sequence.bubbles.map(d => d.loc) + coordinates: sequence.bubbles.map(function (d) { return d.loc; }) }; } else { @@ -41964,8 +42075,8 @@ * getBubbles() handles the request to the server for a tile extent of 'bubbles' (streetside image locations). */ function getBubbles(url, tile, callback) { - let rect = tile.extent.rectangle(); - let urlForRequest = url + utilQsString({ + var rect = tile.extent.rectangle(); + var urlForRequest = url + utilQsString({ n: rect[3], s: rect[1], e: rect[2], @@ -41975,7 +42086,7 @@ jsCallback: '{callback}' }); - return jsonpRequest(urlForRequest, (data) => { + return jsonpRequest(urlForRequest, function (data) { if (!data || data.error) { callback(null); } else { @@ -41987,12 +42098,12 @@ // partition viewport into higher zoom tiles function partitionViewport$2(projection) { - let z = geoScaleToZoom(projection.scale()); - let z2 = (Math.ceil(z * 2) / 2) + 2.5; // round to next 0.5 and add 2.5 - let tiler = utilTiler().zoomExtent([z2, z2]); + var z = geoScaleToZoom(projection.scale()); + var z2 = (Math.ceil(z * 2) / 2) + 2.5; // round to next 0.5 and add 2.5 + var tiler = utilTiler().zoomExtent([z2, z2]); return tiler.getTiles(projection) - .map(tile => tile.extent); + .map(function (tile) { return tile.extent; }); } @@ -42001,10 +42112,10 @@ limit = limit || 5; return partitionViewport$2(projection) - .reduce((result, extent) => { - let found = rtree.search(extent.bbox()) + .reduce(function (result, extent) { + var found = rtree.search(extent.bbox()) .slice(0, limit) - .map(d => d.data); + .map(function (d) { return d.data; }); return (found.length ? result.concat(found) : result); }, []); @@ -42015,15 +42126,15 @@ * loadImage() */ function loadImage(imgInfo) { - return new Promise(resolve => { - let img = new Image(); - img.onload = () => { - let canvas = document.getElementById('ideditor-canvas' + imgInfo.face); - let ctx = canvas.getContext('2d'); + return new Promise(function (resolve) { + var img = new Image(); + img.onload = function () { + var canvas = document.getElementById('ideditor-canvas' + imgInfo.face); + var ctx = canvas.getContext('2d'); ctx.drawImage(img, imgInfo.x, imgInfo.y); resolve({ imgInfo: imgInfo, status: 'ok' }); }; - img.onerror = () => { + img.onerror = function () { resolve({ data: imgInfo, status: 'error' }); }; img.setAttribute('crossorigin', ''); @@ -42037,10 +42148,10 @@ */ function loadCanvas(imageGroup) { return Promise.all(imageGroup.map(loadImage)) - .then((data) => { - let canvas = document.getElementById('ideditor-canvas' + data[0].imgInfo.face); - const which = { '01': 0, '02': 1, '03': 2, '10': 3, '11': 4, '12': 5 }; - let face = data[0].imgInfo.face; + .then(function (data) { + var canvas = document.getElementById('ideditor-canvas' + data[0].imgInfo.face); + var which = { '01': 0, '02': 1, '03': 2, '10': 3, '11': 4, '12': 5 }; + var face = data[0].imgInfo.face; _dataUrlArray[which[face]] = canvas.toDataURL('image/jpeg', 1.0); return { status: 'loadCanvas for face ' + data[0].imgInfo.face + 'ok'}; }); @@ -42052,7 +42163,7 @@ */ function loadFaces(faceGroup) { return Promise.all(faceGroup.map(loadCanvas)) - .then(() => { return { status: 'loadFaces done' }; }); + .then(function () { return { status: 'loadFaces done' }; }); } @@ -42074,18 +42185,18 @@ .data(['canvas01', 'canvas02', 'canvas03', 'canvas10', 'canvas11', 'canvas12']) .enter() .append('canvas') - .attr('id', d => 'ideditor-' + d) + .attr('id', function (d) { return 'ideditor-' + d; }) .attr('width', _resolution) .attr('height', _resolution); } function qkToXY(qk) { - let x = 0; - let y = 0; - let scale = 256; - for (let i = qk.length; i > 0; i--) { - const key = qk[i-1]; + var x = 0; + var y = 0; + var scale = 256; + for (var i = qk.length; i > 0; i--) { + var key = qk[i-1]; x += (+(key === '1' || key === '3')) * scale; y += (+(key === '2' || key === '3')) * scale; scale *= 2; @@ -42095,8 +42206,8 @@ function getQuadKeys() { - let dim = _resolution / 256; - let quadKeys; + var dim = _resolution / 256; + var quadKeys; if (dim === 16) { quadKeys = [ @@ -42183,23 +42294,23 @@ * bubbles() */ bubbles: function(projection) { - const limit = 5; + var limit = 5; return searchLimited$2(limit, projection, _ssCache.bubbles.rtree); }, sequences: function(projection) { - const viewport = projection.clipExtent(); - const min = [viewport[0][0], viewport[1][1]]; - const max = [viewport[1][0], viewport[0][1]]; - const bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); - let seen = {}; - let results = []; + var viewport = projection.clipExtent(); + var min = [viewport[0][0], viewport[1][1]]; + var max = [viewport[1][0], viewport[0][1]]; + var bbox = geoExtent(projection.invert(min), projection.invert(max)).bbox(); + var seen = {}; + var results = []; // all sequences for bubbles in viewport _ssCache.bubbles.rtree.search(bbox) - .forEach(d => { - const key = d.data.sequenceKey; + .forEach(function (d) { + var key = d.data.sequenceKey; if (key && !seen[key]) { seen[key] = true; results.push(_ssCache.sequences[key].geojson); @@ -42215,7 +42326,7 @@ */ loadBubbles: function(projection, margin) { // by default: request 2 nearby tiles so we can connect sequences. - if (margin === undefined) margin = 2; + if (margin === undefined) { margin = 2; } loadTiles$2('bubbles', bubbleApi, projection, margin); }, @@ -42227,11 +42338,11 @@ initViewer: function () { - if (!window.pannellum) return; - if (_pannellumViewer) return; + if (!window.pannellum) { return; } + if (_pannellumViewer) { return; } - const sceneID = ++_currScene + ''; - const options = { + var sceneID = ++_currScene + ''; + var options = { 'default': { firstScene: sceneID }, scenes: {} }; @@ -42245,17 +42356,17 @@ * loadViewer() create the streeside viewer. */ loadViewer: function(context) { - let that = this; + var that = this; - let pointerPrefix = 'PointerEvent' in window ? 'pointer' : 'mouse'; + var pointerPrefix = 'PointerEvent' in window ? 'pointer' : 'mouse'; // create ms-wrapper, a photo wrapper class - let wrap = context.container().select('.photoviewer').selectAll('.ms-wrapper') + var wrap = context.container().select('.photoviewer').selectAll('.ms-wrapper') .data([0]); // inject ms-wrapper into the photoviewer div // (used by all to house each custom photo viewer) - let wrapEnter = wrap.enter() + var wrapEnter = wrap.enter() .append('div') .attr('class', 'photo-wrapper ms-wrapper') .classed('hide', true); @@ -42264,18 +42375,18 @@ wrapEnter .append('div') .attr('id', 'ideditor-viewer-streetside') - .on(pointerPrefix + 'down.streetside', () => { + .on(pointerPrefix + 'down.streetside', function () { select(window) - .on(pointerPrefix + 'move.streetside', () => { + .on(pointerPrefix + 'move.streetside', function () { dispatch$7.call('viewerChanged'); }, true); }) - .on(pointerPrefix + 'up.streetside pointercancel.streetside', () => { + .on(pointerPrefix + 'up.streetside pointercancel.streetside', function () { select(window) .on(pointerPrefix + 'move.streetside', null); // continue dispatching events for a few seconds, in case viewer has inertia. - let t = timer(elapsed => { + var t = timer(function (elapsed) { dispatch$7.call('viewerChanged'); if (elapsed > 2000) { t.stop(); @@ -42285,7 +42396,7 @@ .append('div') .attr('class', 'photo-attribution fillD'); - let controlsEnter = wrapEnter + var controlsEnter = wrapEnter .append('div') .attr('class', 'photo-controls-wrap') .append('div') @@ -42326,7 +42437,7 @@ // Register viewer resize handler - context.ui().photoviewer.on('resize.streetside', () => { + context.ui().photoviewer.on('resize.streetside', function () { if (_pannellumViewer) { _pannellumViewer.resize(); } @@ -42334,55 +42445,55 @@ function step(stepBy) { - return () => { - let viewer = context.container().select('.photoviewer'); - let selected = viewer.empty() ? undefined : viewer.datum(); - if (!selected) return; + return function () { + var viewer = context.container().select('.photoviewer'); + var selected = viewer.empty() ? undefined : viewer.datum(); + if (!selected) { return; } - let nextID = (stepBy === 1 ? selected.ne : selected.pr); - let yaw = _pannellumViewer.getYaw(); - let ca = selected.ca + yaw; - let origin = selected.loc; + var nextID = (stepBy === 1 ? selected.ne : selected.pr); + var yaw = _pannellumViewer.getYaw(); + var ca = selected.ca + yaw; + var origin = selected.loc; // construct a search trapezoid pointing out from current bubble - const meters = 35; - let p1 = [ + var meters = 35; + var p1 = [ origin[0] + geoMetersToLon(meters / 5, origin[1]), origin[1] ]; - let p2 = [ + var p2 = [ origin[0] + geoMetersToLon(meters / 2, origin[1]), origin[1] + geoMetersToLat(meters) ]; - let p3 = [ + var p3 = [ origin[0] - geoMetersToLon(meters / 2, origin[1]), origin[1] + geoMetersToLat(meters) ]; - let p4 = [ + var p4 = [ origin[0] - geoMetersToLon(meters / 5, origin[1]), origin[1] ]; - let poly = [p1, p2, p3, p4, p1]; + var poly = [p1, p2, p3, p4, p1]; // rotate it to face forward/backward - let angle = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180); + var angle = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180); poly = geoRotate(poly, -angle, origin); - let extent = poly.reduce((extent, point) => { + var extent = poly.reduce(function (extent, point) { return extent.extend(geoExtent(point)); }, geoExtent()); // find nearest other bubble in the search polygon - let minDist = Infinity; + var minDist = Infinity; _ssCache.bubbles.rtree.search(extent.bbox()) - .forEach(d => { - if (d.data.key === selected.key) return; - if (!geoPointInPolygon(d.data.loc, poly)) return; + .forEach(function (d) { + if (d.data.key === selected.key) { return; } + if (!geoPointInPolygon(d.data.loc, poly)) { return; } - let dist = geoVecLength(d.data.loc, selected.loc); - let theta = selected.ca - d.data.ca; - let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta)); + var dist = geoVecLength(d.data.loc, selected.loc); + var theta = selected.ca - d.data.ca; + var minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta)); if (minTheta > 20) { dist += 5; // penalize distance if camera angles don't match } @@ -42393,13 +42504,13 @@ } }); - let nextBubble = nextID && _ssCache.bubbles.points[nextID]; - if (!nextBubble) return; + var nextBubble = nextID && _ssCache.bubbles.points[nextID]; + if (!nextBubble) { return; } context.map().centerEase(nextBubble.loc); that.selectImage(context, nextBubble) - .then(response => { + .then(function (response) { if (response.status === 'ok') { _sceneOptions.yaw = yaw; that.showViewer(context); @@ -42414,7 +42525,7 @@ * showViewer() */ showViewer: function(context, yaw) { - if (!_sceneOptions) return; + if (!_sceneOptions) { return; } if (yaw !== undefined) { _sceneOptions.yaw = yaw; @@ -42424,7 +42535,7 @@ this.initViewer(); } else { // make a new scene - let sceneID = ++_currScene + ''; + var sceneID = ++_currScene + ''; _pannellumViewer .addScene(sceneID, _sceneOptions) .loadScene(sceneID); @@ -42437,10 +42548,10 @@ } } - let wrap = context.container().select('.photoviewer') + var wrap = context.container().select('.photoviewer') .classed('hide', false); - let isHidden = wrap.selectAll('.photo-wrapper.ms-wrapper.hide').size(); + var isHidden = wrap.selectAll('.photo-wrapper.ms-wrapper.hide').size(); if (isHidden) { wrap @@ -42460,8 +42571,8 @@ * hideViewer() */ hideViewer: function (context) { - let viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(null); + var viewer = context.container().select('.photoviewer'); + if (!viewer.empty()) { viewer.datum(null); } viewer .classed('hide', true) @@ -42479,14 +42590,14 @@ * selectImage(). */ selectImage: function (context, d) { - let that = this; - let viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(d); + var that = this; + var viewer = context.container().select('.photoviewer'); + if (!viewer.empty()) { viewer.datum(d); } this.setStyles(context, null, true); - let wrap = context.container().select('.photoviewer .ms-wrapper'); - let attribution = wrap.selectAll('.photo-attribution').html(''); + var wrap = context.container().select('.photoviewer .ms-wrapper'); + var attribution = wrap.selectAll('.photo-attribution').html(''); wrap.selectAll('.pnlm-load-box') // display "loading.." .style('display', 'block'); @@ -42495,14 +42606,14 @@ return Promise.resolve({ status: 'ok' }); } - let line1 = attribution + var line1 = attribution .append('div') .attr('class', 'attribution-row'); - const hiresDomId = utilUniqueDomId('streetside-hires'); + var hiresDomId = utilUniqueDomId('streetside-hires'); // Add hires checkbox - let label = line1 + var label = line1 .append('label') .attr('for', hiresDomId) .attr('class', 'streetside-hires'); @@ -42512,21 +42623,21 @@ .attr('type', 'checkbox') .attr('id', hiresDomId) .property('checked', _hires) - .on('click', () => { + .on('click', function () { event.stopPropagation(); _hires = !_hires; _resolution = _hires ? 1024 : 512; wrap.call(setupCanvas, true); - let viewstate = { + var viewstate = { yaw: _pannellumViewer.getYaw(), pitch: _pannellumViewer.getPitch(), hfov: _pannellumViewer.getHfov() }; that.selectImage(context, d) - .then(response => { + .then(function (response) { if (response.status === 'ok') { _sceneOptions = Object.assign(_sceneOptions, viewstate); that.showViewer(context); @@ -42539,13 +42650,13 @@ .text(_t('streetside.hires')); - let captureInfo = line1 + var captureInfo = line1 .append('div') .attr('class', 'attribution-capture-info'); // Add capture date if (d.captured_by) { - const yyyy = (new Date()).getFullYear(); + var yyyy = (new Date()).getFullYear(); captureInfo .append('a') @@ -42567,7 +42678,7 @@ } // Add image links - let line2 = attribution + var line2 = attribution .append('div') .attr('class', 'attribution-row'); @@ -42588,22 +42699,22 @@ .text(_t('streetside.report')); - let bubbleIdQuadKey = d.key.toString(4); - const paddingNeeded = 16 - bubbleIdQuadKey.length; - for (let i = 0; i < paddingNeeded; i++) { + var bubbleIdQuadKey = d.key.toString(4); + var paddingNeeded = 16 - bubbleIdQuadKey.length; + for (var i = 0; i < paddingNeeded; i++) { bubbleIdQuadKey = '0' + bubbleIdQuadKey; } - const imgUrlPrefix = streetsideImagesApi + 'hs' + bubbleIdQuadKey; - const imgUrlSuffix = '.jpg?g=6338&n=z'; + var imgUrlPrefix = streetsideImagesApi + 'hs' + bubbleIdQuadKey; + var imgUrlSuffix = '.jpg?g=6338&n=z'; // Cubemap face code order matters here: front=01, right=02, back=03, left=10, up=11, down=12 - const faceKeys = ['01','02','03','10','11','12']; + var faceKeys = ['01','02','03','10','11','12']; // Map images to cube faces - let quadKeys = getQuadKeys(); - let faces = faceKeys.map((faceKey) => { - return quadKeys.map((quadKey) =>{ - const xy = qkToXY(quadKey); + var quadKeys = getQuadKeys(); + var faces = faceKeys.map(function (faceKey) { + return quadKeys.map(function (quadKey) { + var xy = qkToXY(quadKey); return { face: faceKey, url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix, @@ -42614,7 +42725,7 @@ }); return loadFaces(faces) - .then(() => { + .then(function () { _sceneOptions = { showFullscreenCtrl: false, autoLoad: true, @@ -42659,36 +42770,36 @@ .classed('currentView', false); } - let hoveredBubbleKey = hovered && hovered.key; - let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered); - let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey]; - let hoveredBubbleKeys = (hoveredSequence && hoveredSequence.bubbles.map(d => d.key)) || []; + var hoveredBubbleKey = hovered && hovered.key; + var hoveredSequenceKey = this.getSequenceKeyForBubble(hovered); + var hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey]; + var hoveredBubbleKeys = (hoveredSequence && hoveredSequence.bubbles.map(function (d) { return d.key; })) || []; - let viewer = context.container().select('.photoviewer'); - let selected = viewer.empty() ? undefined : viewer.datum(); - let selectedBubbleKey = selected && selected.key; - let selectedSequenceKey = this.getSequenceKeyForBubble(selected); - let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey]; - let selectedBubbleKeys = (selectedSequence && selectedSequence.bubbles.map(d => d.key)) || []; + var viewer = context.container().select('.photoviewer'); + var selected = viewer.empty() ? undefined : viewer.datum(); + var selectedBubbleKey = selected && selected.key; + var selectedSequenceKey = this.getSequenceKeyForBubble(selected); + var selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey]; + var selectedBubbleKeys = (selectedSequence && selectedSequence.bubbles.map(function (d) { return d.key; })) || []; // highlight sibling viewfields on either the selected or the hovered sequences - let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys); + var highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys); context.container().selectAll('.layer-streetside-images .viewfield-group') - .classed('highlighted', d => highlightedBubbleKeys.indexOf(d.key) !== -1) - .classed('hovered', d => d.key === hoveredBubbleKey) - .classed('currentView', d => d.key === selectedBubbleKey); + .classed('highlighted', function (d) { return highlightedBubbleKeys.indexOf(d.key) !== -1; }) + .classed('hovered', function (d) { return d.key === hoveredBubbleKey; }) + .classed('currentView', function (d) { return d.key === selectedBubbleKey; }); context.container().selectAll('.layer-streetside-images .sequence') - .classed('highlighted', d => d.properties.key === hoveredSequenceKey) - .classed('currentView', d => d.properties.key === selectedSequenceKey); + .classed('highlighted', function (d) { return d.properties.key === hoveredSequenceKey; }) + .classed('currentView', function (d) { return d.properties.key === selectedSequenceKey; }); // update viewfields if needed context.container().selectAll('.viewfield-group .viewfield') .attr('d', viewfieldPath); function viewfieldPath() { - let d = this.parentNode.__data__; + var d = this.parentNode.__data__; if (d.pano && d.key !== selectedBubbleKey) { return 'M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0'; } else { @@ -42789,8 +42900,8 @@ function filterValues(allowUpperCase) { return function(d) { - if (d.value.match(/[;,]/) !== null) return false; // exclude some punctuation - if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null) return false; // exclude uppercase letters + if (d.value.match(/[;,]/) !== null) { return false; } // exclude some punctuation + if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null) { return false; } // exclude uppercase letters return parseFloat(d.fraction) > 0.0; }; } @@ -42798,8 +42909,8 @@ function filterRoles(geometry) { return function(d) { - if (d.role === '') return false; // exclude empty role - if (d.role.match(/[A-Z*;,]/) !== null) return false; // exclude uppercase letters and some punctuation + if (d.role === '') { return false; } // exclude empty role + if (d.role.match(/[A-Z*;,]/) !== null) { return false; } // exclude uppercase letters and some punctuation return parseFloat(d[tag_members_fractions[geometry]]) > 0.0; }; } @@ -42844,9 +42955,9 @@ var debouncedRequest$1 = debounce(request$1, 300, { leading: false }); function request$1(url, params, exactMatch, callback, loaded) { - if (_inflight$2[url]) return; + if (_inflight$2[url]) { return; } - if (checkCache(url, params, exactMatch, callback)) return; + if (checkCache(url, params, exactMatch, callback)) { return; } var controller = new AbortController(); _inflight$2[url] = controller; @@ -42854,12 +42965,12 @@ d3_json(url, { signal: controller.signal }) .then(function(result) { delete _inflight$2[url]; - if (loaded) loaded(null, result); + if (loaded) { loaded(null, result); } }) .catch(function(err) { delete _inflight$2[url]; - if (err.name === 'AbortError') return; - if (loaded) loaded(err.message); + if (err.name === 'AbortError') { return; } + if (loaded) { loaded(err.message); } }); } @@ -42879,7 +42990,7 @@ } // don't try to shorten the query - if (exactMatch || !testQuery.length) return false; + if (exactMatch || !testQuery.length) { return false; } // do shorten the query to see if we already have a cached result // that has returned fewer than max results (rp) @@ -42922,9 +43033,9 @@ lang: _mainLocalizer.languageCode() }; this.keys(params, function(err, data) { - if (err) return; + if (err) { return; } data.forEach(function(d) { - if (d.value === 'opening_hours') return; // exception + if (d.value === 'opening_hours') { return; } // exception _popularKeys[d.value] = true; }); }); @@ -43077,7 +43188,7 @@ apibase: function(_) { - if (!arguments.length) return apibase$4; + if (!arguments.length) { return apibase$4; } apibase$4 = _; return this; } @@ -44048,7 +44159,7 @@ part = [], i, a, b, codeB, lastCode; - if (!result) result = []; + if (!result) { result = []; } for (i = 1; i < len; i++) { a = points[i - 1]; @@ -44088,7 +44199,7 @@ codeA = lastCode; } - if (part.length) result.push(part); + if (part.length) { result.push(part); } return result; } @@ -44110,9 +44221,9 @@ inside = !(bitCode(p, bbox) & edge); // if segment goes through the clip window, add an intersection - if (inside !== prevInside) result.push(intersect(prev, p, edge, bbox)); + if (inside !== prevInside) { result.push(intersect(prev, p, edge, bbox)); } - if (inside) result.push(p); // add a point if it's inside + if (inside) { result.push(p); } // add a point if it's inside prev = p; prevInside = inside; @@ -44120,7 +44231,7 @@ points = result; - if (!points.length) break; + if (!points.length) { break; } } return result; @@ -44146,11 +44257,11 @@ function bitCode(p, bbox) { var code = 0; - if (p[0] < bbox[0]) code |= 1; // left - else if (p[0] > bbox[2]) code |= 2; // right + if (p[0] < bbox[0]) { code |= 1; } // left + else if (p[0] > bbox[2]) { code |= 2; } // right - if (p[1] < bbox[1]) code |= 4; // bottom - else if (p[1] > bbox[3]) code |= 8; // top + if (p[1] < bbox[1]) { code |= 4; } // bottom + else if (p[1] > bbox[3]) { code |= 8; } // top return code; } @@ -44158,9 +44269,9 @@ var bboxClip_1 = createCommonjsModule(function (module, exports) { var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) { return mod; } var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } result["default"] = mod; return result; }; @@ -44235,8 +44346,8 @@ }); var fastJsonStableStringify = function (data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; + if (!opts) { opts = {}; } + if (typeof opts === 'function') { opts = { cmp: opts }; } var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; var cmp = opts.cmp && (function (f) { @@ -44255,24 +44366,24 @@ node = node.toJSON(); } - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (typeof node !== 'object') return JSON.stringify(node); + if (node === undefined) { return; } + if (typeof node == 'number') { return isFinite(node) ? '' + node : 'null'; } + if (typeof node !== 'object') { return JSON.stringify(node); } var i, out; if (Array.isArray(node)) { out = '['; for (i = 0; i < node.length; i++) { - if (i) out += ','; + if (i) { out += ','; } out += stringify(node[i]) || 'null'; } return out + ']'; } - if (node === null) return 'null'; + if (node === null) { return 'null'; } if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); + if (cycles) { return JSON.stringify('__cycle__'); } throw new TypeError('Converting circular structure to JSON'); } @@ -44283,8 +44394,8 @@ var key = keys[i]; var value = stringify(node[key]); - if (!value) continue; - if (out) out += ','; + if (!value) { continue; } + if (out) { out += ','; } out += JSON.stringify(key) + ':' + value; } seen.splice(seenIndex, 1); @@ -44294,578 +44405,590 @@ function DEFAULT_COMPARE (a, b) { return a > b ? 1 : a < b ? -1 : 0; } - class SplayTree { + var SplayTree = function SplayTree(compare, noDuplicates) { + if ( compare === void 0 ) compare = DEFAULT_COMPARE; + if ( noDuplicates === void 0 ) noDuplicates = false; - constructor(compare = DEFAULT_COMPARE, noDuplicates = false) { - this._compare = compare; - this._root = null; - this._size = 0; - this._noDuplicates = !!noDuplicates; - } + this._compare = compare; + this._root = null; + this._size = 0; + this._noDuplicates = !!noDuplicates; + }; + var prototypeAccessors = { size: { configurable: true } }; - rotateLeft(x) { - var y = x.right; - if (y) { - x.right = y.left; - if (y.left) y.left.parent = x; - y.parent = x.parent; - } - if (!x.parent) this._root = y; - else if (x === x.parent.left) x.parent.left = y; - else x.parent.right = y; - if (y) y.left = x; - x.parent = y; + SplayTree.prototype.rotateLeft = function rotateLeft (x) { + var y = x.right; + if (y) { + x.right = y.left; + if (y.left) { y.left.parent = x; } + y.parent = x.parent; } + if (!x.parent) { this._root = y; } + else if (x === x.parent.left) { x.parent.left = y; } + else { x.parent.right = y; } + if (y) { y.left = x; } + x.parent = y; + }; - rotateRight(x) { - var y = x.left; - if (y) { - x.left = y.right; - if (y.right) y.right.parent = x; - y.parent = x.parent; - } - if (!x.parent) this._root = y; - else if(x === x.parent.left) x.parent.left = y; - else x.parent.right = y; - if (y) y.right = x; - x.parent = y; + SplayTree.prototype.rotateRight = function rotateRight (x) { + var y = x.left; + if (y) { + x.left = y.right; + if (y.right) { y.right.parent = x; } + y.parent = x.parent; } + if (!x.parent) { this._root = y; } + else if(x === x.parent.left) { x.parent.left = y; } + else { x.parent.right = y; } + if (y) { y.right = x; } + x.parent = y; + }; - _splay(x) { - while (x.parent) { - var p = x.parent; - if (!p.parent) { - if (p.left === x) this.rotateRight(p); - else this.rotateLeft(p); - } else if (p.left === x && p.parent.left === p) { - this.rotateRight(p.parent); - this.rotateRight(p); - } else if (p.right === x && p.parent.right === p) { - this.rotateLeft(p.parent); - this.rotateLeft(p); - } else if (p.left === x && p.parent.right === p) { - this.rotateRight(p); - this.rotateLeft(p); - } else { - this.rotateLeft(p); - this.rotateRight(p); - } + + SplayTree.prototype._splay = function _splay (x) { + while (x.parent) { + var p = x.parent; + if (!p.parent) { + if (p.left === x) { this.rotateRight(p); } + else { this.rotateLeft(p); } + } else if (p.left === x && p.parent.left === p) { + this.rotateRight(p.parent); + this.rotateRight(p); + } else if (p.right === x && p.parent.right === p) { + this.rotateLeft(p.parent); + this.rotateLeft(p); + } else if (p.left === x && p.parent.right === p) { + this.rotateRight(p); + this.rotateLeft(p); + } else { + this.rotateLeft(p); + this.rotateRight(p); } } + }; - splay(x) { - var p, gp, ggp, l, r; + SplayTree.prototype.splay = function splay (x) { + var p, gp, ggp, l, r; - while (x.parent) { - p = x.parent; - gp = p.parent; + while (x.parent) { + p = x.parent; + gp = p.parent; - if (gp && gp.parent) { - ggp = gp.parent; - if (ggp.left === gp) ggp.left = x; - else ggp.right = x; - x.parent = ggp; - } else { - x.parent = null; - this._root = x; - } + if (gp && gp.parent) { + ggp = gp.parent; + if (ggp.left === gp) { ggp.left= x; } + else { ggp.right = x; } + x.parent = ggp; + } else { + x.parent = null; + this._root = x; + } - l = x.left; r = x.right; + l = x.left; r = x.right; - if (x === p.left) { // left - if (gp) { - if (gp.left === p) { - /* zig-zig */ - if (p.right) { - gp.left = p.right; - gp.left.parent = gp; - } else gp.left = null; + if (x === p.left) { // left + if (gp) { + if (gp.left === p) { + /* zig-zig */ + if (p.right) { + gp.left = p.right; + gp.left.parent = gp; + } else { gp.left = null; } - p.right = gp; - gp.parent = p; - } else { - /* zig-zag */ - if (l) { - gp.right = l; - l.parent = gp; - } else gp.right = null; - - x.left = gp; - gp.parent = x; - } - } - if (r) { - p.left = r; - r.parent = p; - } else p.left = null; - - x.right = p; - p.parent = x; - } else { // right - if (gp) { - if (gp.right === p) { - /* zig-zig */ - if (p.left) { - gp.right = p.left; - gp.right.parent = gp; - } else gp.right = null; - - p.left = gp; - gp.parent = p; - } else { - /* zig-zag */ - if (r) { - gp.left = r; - r.parent = gp; - } else gp.left = null; - - x.right = gp; - gp.parent = x; - } - } - if (l) { - p.right = l; - l.parent = p; - } else p.right = null; + p.right = gp; + gp.parent = p; + } else { + /* zig-zag */ + if (l) { + gp.right = l; + l.parent = gp; + } else { gp.right = null; } + + x.left = gp; + gp.parent = x; + } + } + if (r) { + p.left = r; + r.parent = p; + } else { p.left = null; } + + x.right= p; + p.parent = x; + } else { // right + if (gp) { + if (gp.right === p) { + /* zig-zig */ + if (p.left) { + gp.right = p.left; + gp.right.parent = gp; + } else { gp.right = null; } + + p.left = gp; + gp.parent = p; + } else { + /* zig-zag */ + if (r) { + gp.left = r; + r.parent = gp; + } else { gp.left = null; } - x.left = p; - p.parent = x; + x.right = gp; + gp.parent = x; + } } + if (l) { + p.right = l; + l.parent = p; + } else { p.right = null; } + + x.left = p; + p.parent = x; } } + }; - replace(u, v) { - if (!u.parent) this._root = v; - else if (u === u.parent.left) u.parent.left = v; - else u.parent.right = v; - if (v) v.parent = u.parent; - } + SplayTree.prototype.replace = function replace (u, v) { + if (!u.parent) { this._root = v; } + else if (u === u.parent.left) { u.parent.left = v; } + else { u.parent.right = v; } + if (v) { v.parent = u.parent; } + }; - minNode(u = this._root) { - if (u) while (u.left) u = u.left; - return u; - } + SplayTree.prototype.minNode = function minNode (u) { + if ( u === void 0 ) u = this._root; + if (u) { while (u.left) { u = u.left; } } + return u; + }; - maxNode(u = this._root) { - if (u) while (u.right) u = u.right; - return u; - } + SplayTree.prototype.maxNode = function maxNode (u) { + if ( u === void 0 ) u = this._root; - insert(key, data) { - var z = this._root; - var p = null; - var comp = this._compare; - var cmp; + if (u) { while (u.right) { u = u.right; } } + return u; + }; - if (this._noDuplicates) { - while (z) { - p = z; - cmp = comp(z.key, key); - if (cmp === 0) return; - else if (comp(z.key, key) < 0) z = z.right; - else z = z.left; - } - } else { - while (z) { - p = z; - if (comp(z.key, key) < 0) z = z.right; - else z = z.left; - } + + SplayTree.prototype.insert = function insert (key, data) { + var z = this._root; + var p = null; + var comp = this._compare; + var cmp; + + if (this._noDuplicates) { + while (z) { + p = z; + cmp = comp(z.key, key); + if (cmp === 0) { return; } + else if (comp(z.key, key) < 0) { z = z.right; } + else { z = z.left; } } + } else { + while (z) { + p = z; + if (comp(z.key, key) < 0) { z = z.right; } + else { z = z.left; } + } + } - z = { key, data, left: null, right: null, parent: p }; + z = { key: key, data: data, left: null, right: null, parent: p }; - if (!p) this._root = z; - else if (comp(p.key, z.key) < 0) p.right = z; - else p.left = z; + if (!p) { this._root = z; } + else if (comp(p.key, z.key) < 0) { p.right = z; } + else { p.left= z; } - this.splay(z); - this._size++; - return z; - } + this.splay(z); + this._size++; + return z; + }; - find (key) { - var z = this._root; - var comp = this._compare; - while (z) { - var cmp = comp(z.key, key); - if (cmp < 0) z = z.right; - else if (cmp > 0) z = z.left; - else return z; - } - return null; + SplayTree.prototype.find = function find (key) { + var z = this._root; + var comp = this._compare; + while (z) { + var cmp = comp(z.key, key); + if (cmp < 0) { z = z.right; } + else if (cmp > 0) { z = z.left; } + else { return z; } } + return null; + }; - /** - * Whether the tree contains a node with the given key - * @param {Key} key - * @return {boolean} true/false - */ - contains (key) { - var node = this._root; - var comparator = this._compare; - while (node) { - var cmp = comparator(key, node.key); - if (cmp === 0) return true; - else if (cmp < 0) node = node.left; - else node = node.right; - } - - return false; + /** + * Whether the tree contains a node with the given key + * @param{Key} key + * @return {boolean} true/false + */ + SplayTree.prototype.contains = function contains (key) { + var node = this._root; + var comparator = this._compare; + while (node){ + var cmp = comparator(key, node.key); + if (cmp === 0) { return true; } + else if (cmp < 0) { node = node.left; } + else { node = node.right; } } + return false; + }; - remove (key) { - var z = this.find(key); - if (!z) return false; + SplayTree.prototype.remove = function remove (key) { + var z = this.find(key); - this.splay(z); + if (!z) { return false; } - if (!z.left) this.replace(z, z.right); - else if (!z.right) this.replace(z, z.left); - else { - var y = this.minNode(z.right); - if (y.parent !== z) { - this.replace(y, y.right); - y.right = z.right; - y.right.parent = y; - } - this.replace(z, y); - y.left = z.left; - y.left.parent = y; - } + this.splay(z); - this._size--; - return true; + if (!z.left) { this.replace(z, z.right); } + else if (!z.right) { this.replace(z, z.left); } + else { + var y = this.minNode(z.right); + if (y.parent !== z) { + this.replace(y, y.right); + y.right = z.right; + y.right.parent = y; + } + this.replace(z, y); + y.left = z.left; + y.left.parent = y; } + this._size--; + return true; + }; - removeNode(z) { - if (!z) return false; - this.splay(z); + SplayTree.prototype.removeNode = function removeNode (z) { + if (!z) { return false; } - if (!z.left) this.replace(z, z.right); - else if (!z.right) this.replace(z, z.left); - else { - var y = this.minNode(z.right); - if (y.parent !== z) { - this.replace(y, y.right); - y.right = z.right; - y.right.parent = y; - } - this.replace(z, y); - y.left = z.left; - y.left.parent = y; - } + this.splay(z); - this._size--; - return true; + if (!z.left) { this.replace(z, z.right); } + else if (!z.right) { this.replace(z, z.left); } + else { + var y = this.minNode(z.right); + if (y.parent !== z) { + this.replace(y, y.right); + y.right = z.right; + y.right.parent = y; + } + this.replace(z, y); + y.left = z.left; + y.left.parent = y; } + this._size--; + return true; + }; - erase (key) { - var z = this.find(key); - if (!z) return; - this.splay(z); + SplayTree.prototype.erase = function erase (key) { + var z = this.find(key); + if (!z) { return; } - var s = z.left; - var t = z.right; + this.splay(z); - var sMax = null; - if (s) { - s.parent = null; - sMax = this.maxNode(s); - this.splay(sMax); - this._root = sMax; - } - if (t) { - if (s) sMax.right = t; - else this._root = t; - t.parent = sMax; - } + var s = z.left; + var t = z.right; - this._size--; + var sMax = null; + if (s) { + s.parent = null; + sMax = this.maxNode(s); + this.splay(sMax); + this._root = sMax; + } + if (t) { + if (s) { sMax.right = t; } + else { this._root = t; } + t.parent = sMax; } - /** - * Removes and returns the node with smallest key - * @return {?Node} - */ - pop () { - var node = this._root, returnValue = null; - if (node) { - while (node.left) node = node.left; - returnValue = { key: node.key, data: node.data }; - this.remove(node.key); - } - return returnValue; + this._size--; + }; + + /** + * Removes and returns the node with smallest key + * @return {?Node} + */ + SplayTree.prototype.pop = function pop () { + var node = this._root, returnValue = null; + if (node) { + while (node.left) { node = node.left; } + returnValue = { key: node.key, data: node.data }; + this.remove(node.key); } + return returnValue; + }; - /* eslint-disable class-methods-use-this */ + /* eslint-disable class-methods-use-this */ - /** - * Successor node - * @param {Node} node - * @return {?Node} - */ - next (node) { - var successor = node; - if (successor) { - if (successor.right) { - successor = successor.right; - while (successor && successor.left) successor = successor.left; - } else { - successor = node.parent; - while (successor && successor.right === node) { - node = successor; successor = successor.parent; - } + /** + * Successor node + * @param{Node} node + * @return {?Node} + */ + SplayTree.prototype.next = function next (node) { + var successor = node; + if (successor) { + if (successor.right) { + successor = successor.right; + while (successor && successor.left) { successor = successor.left; } + } else { + successor = node.parent; + while (successor && successor.right === node) { + node = successor; successor = successor.parent; } } - return successor; } + return successor; + }; - /** - * Predecessor node - * @param {Node} node - * @return {?Node} - */ - prev (node) { - var predecessor = node; - if (predecessor) { - if (predecessor.left) { - predecessor = predecessor.left; - while (predecessor && predecessor.right) predecessor = predecessor.right; - } else { - predecessor = node.parent; - while (predecessor && predecessor.left === node) { - node = predecessor; - predecessor = predecessor.parent; - } + /** + * Predecessor node + * @param{Node} node + * @return {?Node} + */ + SplayTree.prototype.prev = function prev (node) { + var predecessor = node; + if (predecessor) { + if (predecessor.left) { + predecessor = predecessor.left; + while (predecessor && predecessor.right) { predecessor = predecessor.right; } + } else { + predecessor = node.parent; + while (predecessor && predecessor.left === node) { + node = predecessor; + predecessor = predecessor.parent; } } - return predecessor; } - /* eslint-enable class-methods-use-this */ + return predecessor; + }; + /* eslint-enable class-methods-use-this */ - /** - * @param {forEachCallback} callback - * @return {SplayTree} - */ - forEach(callback) { - var current = this._root; - var s = [], done = false, i = 0; - - while (!done) { - // Reach the left most Node of the current Node - if (current) { - // Place pointer to a tree node on the stack - // before traversing the node's left subtree - s.push(current); - current = current.left; - } else { - // BackTrack from the empty subtree and visit the Node - // at the top of the stack; however, if the stack is - // empty you are done - if (s.length > 0) { - current = s.pop(); - callback(current, i++); - - // We have visited the node and its left - // subtree. Now, it's right subtree's turn - current = current.right; - } else done = true; - } + /** + * @param{forEachCallback} callback + * @return {SplayTree} + */ + SplayTree.prototype.forEach = function forEach (callback) { + var current = this._root; + var s = [], done = false, i = 0; + + while (!done) { + // Reach the left most Node of the current Node + if (current) { + // Place pointer to a tree node on the stack + // before traversing the node's left subtree + s.push(current); + current = current.left; + } else { + // BackTrack from the empty subtree and visit the Node + // at the top of the stack; however, if the stack is + // empty you are done + if (s.length > 0) { + current = s.pop(); + callback(current, i++); + + // We have visited the node and its left + // subtree. Now, it's right subtree's turn + current = current.right; + } else { done = true; } } - return this; } + return this; + }; - /** - * Walk key range from `low` to `high`. Stops if `fn` returns a value. - * @param {Key} low - * @param {Key} high - * @param {Function} fn - * @param {*?} ctx - * @return {SplayTree} - */ - range(low, high, fn, ctx) { - const Q = []; - const compare = this._compare; - let node = this._root, cmp; - - while (Q.length !== 0 || node) { - if (node) { - Q.push(node); - node = node.left; - } else { - node = Q.pop(); - cmp = compare(node.key, high); - if (cmp > 0) { - break; - } else if (compare(node.key, low) >= 0) { - if (fn.call(ctx, node)) return this; // stop if smth is returned - } - node = node.right; + /** + * Walk key range from `low` to `high`. Stops if `fn` returns a value. + * @param{Key} low + * @param{Key} high + * @param{Function} fn + * @param{*?} ctx + * @return {SplayTree} + */ + SplayTree.prototype.range = function range (low, high, fn, ctx) { + var Q = []; + var compare = this._compare; + var node = this._root, cmp; + + while (Q.length !== 0 || node) { + if (node) { + Q.push(node); + node = node.left; + } else { + node = Q.pop(); + cmp = compare(node.key, high); + if (cmp > 0) { + break; + } else if (compare(node.key, low) >= 0) { + if (fn.call(ctx, node)) { return this; } // stop if smth is returned } + node = node.right; } - return this; } + return this; + }; - /** - * Returns all keys in order - * @return {Array} - */ - keys () { - var current = this._root; - var s = [], r = [], done = false; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - r.push(current.key); - current = current.right; - } else done = true; - } + /** + * Returns all keys in order + * @return {Array} + */ + SplayTree.prototype.keys = function keys () { + var current = this._root; + var s = [], r = [], done = false; + + while (!done) { + if (current) { + s.push(current); + current = current.left; + } else { + if (s.length > 0) { + current = s.pop(); + r.push(current.key); + current = current.right; + } else { done = true; } } - return r; } + return r; + }; - /** - * Returns `data` fields of all nodes in order. - * @return {Array} - */ - values () { - var current = this._root; - var s = [], r = [], done = false; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - r.push(current.data); - current = current.right; - } else done = true; - } + /** + * Returns `data` fields of all nodes in order. + * @return {Array} + */ + SplayTree.prototype.values = function values () { + var current = this._root; + var s = [], r = [], done = false; + + while (!done) { + if (current) { + s.push(current); + current = current.left; + } else { + if (s.length > 0) { + current = s.pop(); + r.push(current.data); + current = current.right; + } else { done = true; } } - return r; } + return r; + }; - /** - * Returns node at given index - * @param {number} index - * @return {?Node} - */ - at (index) { - // removed after a consideration, more misleading than useful - // index = index % this.size; - // if (index < 0) index = this.size - index; - - var current = this._root; - var s = [], done = false, i = 0; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - if (i === index) return current; - i++; - current = current.right; - } else done = true; - } + /** + * Returns node at given index + * @param{number} index + * @return {?Node} + */ + SplayTree.prototype.at = function at (index) { + // removed after a consideration, more misleading than useful + // index = index % this.size; + // if (index < 0) index = this.size - index; + + var current = this._root; + var s = [], done = false, i = 0; + + while (!done) { + if (current) { + s.push(current); + current = current.left; + } else { + if (s.length > 0) { + current = s.pop(); + if (i === index) { return current; } + i++; + current = current.right; + } else { done = true; } } - return null; } + return null; + }; - /** - * Bulk-load items. Both array have to be same size - * @param {Array} keys - * @param {Array} [values] - * @param {Boolean} [presort=false] Pre-sort keys and values, using - * tree's comparator. Sorting is done - * in-place - * @return {AVLTree} - */ - load(keys = [], values = [], presort = false) { - if (this._size !== 0) throw new Error('bulk-load: tree is not empty'); - const size = keys.length; - if (presort) sort(keys, values, 0, size - 1, this._compare); - this._root = loadRecursive(null, keys, values, 0, size); - this._size = size; - return this; - } + /** + * Bulk-load items. Both array have to be same size + * @param{Array} keys + * @param{Array}[values] + * @param{Boolean} [presort=false] Pre-sort keys and values, using + * tree's comparator. Sorting is done + * in-place + * @return {AVLTree} + */ + SplayTree.prototype.load = function load (keys, values, presort) { + if ( keys === void 0 ) keys = []; + if ( values === void 0 ) values = []; + if ( presort === void 0 ) presort = false; + + if (this._size !== 0) { throw new Error('bulk-load: tree is not empty'); } + var size = keys.length; + if (presort) { sort(keys, values, 0, size - 1, this._compare); } + this._root = loadRecursive(null, keys, values, 0, size); + this._size = size; + return this; + }; - min() { - var node = this.minNode(this._root); - if (node) return node.key; - else return null; - } + SplayTree.prototype.min = function min () { + var node = this.minNode(this._root); + if (node) { return node.key; } + else { return null; } + }; - max() { - var node = this.maxNode(this._root); - if (node) return node.key; - else return null; - } + SplayTree.prototype.max = function max () { + var node = this.maxNode(this._root); + if (node) { return node.key; } + else { return null; } + }; - isEmpty() { return this._root === null; } - get size() { return this._size; } + SplayTree.prototype.isEmpty = function isEmpty () { return this._root === null; }; + prototypeAccessors.size.get = function () { return this._size; }; - /** - * Create a tree and load it with items - * @param {Array} keys - * @param {Array?} [values] - - * @param {Function?} [comparator] - * @param {Boolean?} [presort=false] Pre-sort keys and values, using - * tree's comparator. Sorting is done - * in-place - * @param {Boolean?} [noDuplicates=false] Allow duplicates - * @return {SplayTree} - */ - static createTree(keys, values, comparator, presort, noDuplicates) { - return new SplayTree(comparator, noDuplicates).load(keys, values, presort); - } - } + /** + * Create a tree and load it with items + * @param{Array} keys + * @param{Array?} [values] + + * @param{Function?} [comparator] + * @param{Boolean?} [presort=false] Pre-sort keys and values, using + * tree's comparator. Sorting is done + * in-place + * @param{Boolean?} [noDuplicates=false] Allow duplicates + * @return {SplayTree} + */ + SplayTree.createTree = function createTree (keys, values, comparator, presort, noDuplicates) { + return new SplayTree(comparator, noDuplicates).load(keys, values, presort); + }; + + Object.defineProperties( SplayTree.prototype, prototypeAccessors ); function loadRecursive (parent, keys, values, start, end) { - const size = end - start; + var size = end - start; if (size > 0) { - const middle = start + Math.floor(size / 2); - const key = keys[middle]; - const data = values[middle]; - const node = { key, data, parent }; + var middle = start + Math.floor(size / 2); + var key = keys[middle]; + var data = values[middle]; + var node = { key: key, data: data, parent: parent }; node.left = loadRecursive(node, keys, values, start, middle); node.right = loadRecursive(node, keys, values, middle + 1, end); return node; @@ -44875,18 +44998,18 @@ function sort(keys, values, left, right, compare) { - if (left >= right) return; + if (left >= right) { return; } - const pivot = keys[(left + right) >> 1]; - let i = left - 1; - let j = right + 1; + var pivot = keys[(left + right) >> 1]; + var i = left - 1; + var j = right + 1; while (true) { - do i++; while (compare(keys[i], pivot) < 0); - do j--; while (compare(keys[j], pivot) > 0); - if (i >= j) break; + do { i++; } while (compare(keys[i], pivot) < 0); + do { j--; } while (compare(keys[j], pivot) > 0); + if (i >= j) { break; } - let tmp = keys[i]; + var tmp = keys[i]; keys[i] = keys[j]; keys[j] = tmp; @@ -44899,15 +45022,15 @@ sort(keys, values, j + 1, right, compare); } - const NORMAL = 0; - const NON_CONTRIBUTING = 1; - const SAME_TRANSITION = 2; - const DIFFERENT_TRANSITION = 3; + var NORMAL = 0; + var NON_CONTRIBUTING = 1; + var SAME_TRANSITION = 2; + var DIFFERENT_TRANSITION = 3; - const INTERSECTION = 0; - const UNION = 1; - const DIFFERENCE = 2; - const XOR = 3; + var INTERSECTION = 0; + var UNION = 1; + var DIFFERENCE = 2; + var XOR = 3; /** * @param {SweepEvent} event @@ -44940,7 +45063,7 @@ } // check if the line segment belongs to the Boolean operation - let isInResult = inResult(event, operation); + var isInResult = inResult(event, operation); if (isInResult) { event.resultTransition = determineResultTransition(event, operation); } else { @@ -44980,10 +45103,10 @@ function determineResultTransition(event, operation) { - let thisIn = !event.inOut; - let thatIn = !event.otherInOut; + var thisIn = !event.inOut; + var thatIn = !event.otherInOut; - let isIn; + var isIn; switch (operation) { case INTERSECTION: isIn = thisIn && thatIn; break; @@ -45002,145 +45125,135 @@ return isIn ? +1 : -1; } - class SweepEvent { + var SweepEvent = function SweepEvent (point, left, otherEvent, isSubject, edgeType) { + /** + * Is left endpoint? + * @type {Boolean} + */ + this.left = left; /** - * Sweepline event - * - * @class {SweepEvent} - * @param {Array.} point - * @param {Boolean} left - * @param {SweepEvent=} otherEvent - * @param {Boolean} isSubject - * @param {Number} edgeType + * @type {Array.} */ - constructor (point, left, otherEvent, isSubject, edgeType) { + this.point = point; - /** - * Is left endpoint? - * @type {Boolean} - */ - this.left = left; + /** + * Other edge reference + * @type {SweepEvent} + */ + this.otherEvent = otherEvent; - /** - * @type {Array.} - */ - this.point = point; + /** + * Belongs to source or clipping polygon + * @type {Boolean} + */ + this.isSubject = isSubject; - /** - * Other edge reference - * @type {SweepEvent} - */ - this.otherEvent = otherEvent; + /** + * Edge contribution type + * @type {Number} + */ + this.type = edgeType || NORMAL; - /** - * Belongs to source or clipping polygon - * @type {Boolean} - */ - this.isSubject = isSubject; - /** - * Edge contribution type - * @type {Number} - */ - this.type = edgeType || NORMAL; + /** + * In-out transition for the sweepline crossing polygon + * @type {Boolean} + */ + this.inOut = false; - /** - * In-out transition for the sweepline crossing polygon - * @type {Boolean} - */ - this.inOut = false; + /** + * @type {Boolean} + */ + this.otherInOut = false; + /** + * Previous event in result? + * @type {SweepEvent} + */ + this.prevInResult = null; - /** - * @type {Boolean} - */ - this.otherInOut = false; + /** + * Type of result transition (0 = not in result, +1 = out-in, -1, in-out) + * @type {Number} + */ + this.resultTransition = 0; - /** - * Previous event in result? - * @type {SweepEvent} - */ - this.prevInResult = null; + // connection step - /** - * Type of result transition (0 = not in result, +1 = out-in, -1, in-out) - * @type {Number} - */ - this.resultTransition = 0; + /** + * @type {Number} + */ + this.otherPos = -1; - // connection step + /** + * @type {Number} + */ + this.outputContourId = -1; - /** - * @type {Number} - */ - this.otherPos = -1; + this.isExteriorRing = true; // TODO: Looks unused, remove? + }; - /** - * @type {Number} - */ - this.outputContourId = -1; + var prototypeAccessors$1 = { inResult: { configurable: true } }; - this.isExteriorRing = true; // TODO: Looks unused, remove? - } + /** + * @param{Array.}p + * @return {Boolean} + */ + SweepEvent.prototype.isBelow = function isBelow (p) { + var p0 = this.point, p1 = this.otherEvent.point; + return this.left + ? (p0[0] - p[0]) * (p1[1] - p[1]) - (p1[0] - p[0]) * (p0[1] - p[1]) > 0 + // signedArea(this.point, this.otherEvent.point, p) > 0 : + : (p1[0] - p[0]) * (p0[1] - p[1]) - (p0[0] - p[0]) * (p1[1] - p[1]) > 0; + //signedArea(this.otherEvent.point, this.point, p) > 0; + }; - /** - * @param {Array.} p - * @return {Boolean} - */ - isBelow (p) { - const p0 = this.point, p1 = this.otherEvent.point; - return this.left - ? (p0[0] - p[0]) * (p1[1] - p[1]) - (p1[0] - p[0]) * (p0[1] - p[1]) > 0 - // signedArea(this.point, this.otherEvent.point, p) > 0 : - : (p1[0] - p[0]) * (p0[1] - p[1]) - (p0[0] - p[0]) * (p1[1] - p[1]) > 0; - //signedArea(this.otherEvent.point, this.point, p) > 0; - } + /** + * @param{Array.}p + * @return {Boolean} + */ + SweepEvent.prototype.isAbove = function isAbove (p) { + return !this.isBelow(p); + }; - /** - * @param {Array.} p - * @return {Boolean} - */ - isAbove (p) { - return !this.isBelow(p); - } + /** + * @return {Boolean} + */ + SweepEvent.prototype.isVertical = function isVertical () { + return this.point[0] === this.otherEvent.point[0]; + }; - /** - * @return {Boolean} - */ - isVertical () { - return this.point[0] === this.otherEvent.point[0]; - } + /** + * Does event belong to result? + * @return {Boolean} + */ + prototypeAccessors$1.inResult.get = function () { + return this.resultTransition !== 0; + }; - /** - * Does event belong to result? - * @return {Boolean} - */ - get inResult() { - return this.resultTransition !== 0; - } + SweepEvent.prototype.clone = function clone () { + var copy = new SweepEvent( + this.point, this.left, this.otherEvent, this.isSubject, this.type); - clone () { - const copy = new SweepEvent( - this.point, this.left, this.otherEvent, this.isSubject, this.type); + copy.contourId = this.contourId; + copy.resultTransition = this.resultTransition; + copy.prevInResult = this.prevInResult; + copy.isExteriorRing = this.isExteriorRing; + copy.inOut = this.inOut; + copy.otherInOut = this.otherInOut; - copy.contourId = this.contourId; - copy.resultTransition = this.resultTransition; - copy.prevInResult = this.prevInResult; - copy.isExteriorRing = this.isExteriorRing; - copy.inOut = this.inOut; - copy.otherInOut = this.otherInOut; + return copy; + }; - return copy; - } - } + Object.defineProperties( SweepEvent.prototype, prototypeAccessors$1 ); function equals(p1, p2) { if (p1[0] === p2[0]) { @@ -45162,17 +45275,17 @@ // return abs(p1[0] - p2[0]) <= EPSILON && abs(p1[1] - p2[1]) <= EPSILON; // }; - const epsilon$1 = 1.1102230246251565e-16; - const splitter = 134217729; - const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; + var epsilon$1 = 1.1102230246251565e-16; + var splitter = 134217729; + var resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; // fast_expansion_sum_zeroelim routine from oritinal code function sum$1(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; + var Q, Qnew, hh, bvirt; + var enow = e[0]; + var fnow = f[0]; + var eindex = 0; + var findex = 0; if ((fnow > enow) === (fnow > -enow)) { Q = enow; enow = e[++eindex]; @@ -45180,7 +45293,7 @@ Q = fnow; fnow = f[++findex]; } - let hindex = 0; + var hindex = 0; if (eindex < elen && findex < flen) { if ((fnow > enow) === (fnow > -enow)) { Qnew = enow + Q; @@ -45240,8 +45353,8 @@ } function estimate(elen, e) { - let Q = e[0]; - for (let i = 1; i < elen; i++) Q += e[i]; + var Q = e[0]; + for (var i = 1; i < elen; i++) { Q += e[i]; } return Q; } @@ -45249,24 +45362,24 @@ return new Float64Array(n); } - const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; - const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; - const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; + var ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; + var ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; + var ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; - const B = vec(4); - const C1 = vec(8); - const C2 = vec(12); - const D = vec(16); - const u = vec(4); + var B = vec(4); + var C1 = vec(8); + var C2 = vec(12); + var D = vec(16); + var u = vec(4); function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; + var acxtail, acytail, bcxtail, bcytail; + var bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; + var acx = ax - cx; + var bcx = bx - cx; + var acy = ay - cy; + var bcy = by - cy; s1 = acx * bcy; c = splitter * acx; @@ -45298,8 +45411,8 @@ B[2] = _j - (u3 - bvirt) + (_i - bvirt); B[3] = u3; - let det = estimate(4, B); - let errbound = ccwerrboundB * detsum; + var det = estimate(4, B); + var errbound = ccwerrboundB * detsum; if (det >= errbound || -det >= errbound) { return det; } @@ -45319,7 +45432,7 @@ errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) return det; + if (det >= errbound || -det >= errbound) { return det; } s1 = acxtail * bcy; c = splitter * acxtail; @@ -45350,7 +45463,7 @@ bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; - const C1len = sum$1(4, B, 4, u, C1); + var C1len = sum$1(4, B, 4, u, C1); s1 = acx * bcytail; c = splitter * acx; @@ -45381,7 +45494,7 @@ bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; - const C2len = sum$1(C1len, C1, 4, u, C2); + var C2len = sum$1(C1len, C1, 4, u, C2); s1 = acxtail * bcytail; c = splitter * acxtail; @@ -45412,20 +45525,20 @@ bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; - const Dlen = sum$1(C2len, C2, 4, u, D); + var Dlen = sum$1(C2len, C2, 4, u, D); return D[Dlen - 1]; } function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; + var detleft = (ay - cy) * (bx - cx); + var detright = (ax - cx) * (by - cy); + var det = detleft - detright; - if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) return det; + if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) { return det; } - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) return det; + var detsum = Math.abs(detleft + detright); + if (Math.abs(det) >= ccwerrboundA * detsum) { return det; } return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); } @@ -45438,9 +45551,9 @@ * @return {Number} */ function signedArea(p0, p1, p2) { - const res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]); - if (res > 0) return -1; - if (res < 0) return 1; + var res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]); + if (res > 0) { return -1; } + if (res < 0) { return 1; } return 0; } @@ -45450,16 +45563,16 @@ * @return {Number} */ function compareEvents(e1, e2) { - const p1 = e1.point; - const p2 = e2.point; + var p1 = e1.point; + var p2 = e2.point; // Different x-coordinate - if (p1[0] > p2[0]) return 1; - if (p1[0] < p2[0]) return -1; + if (p1[0] > p2[0]) { return 1; } + if (p1[0] < p2[0]) { return -1; } // Different points, but same x-coordinate // Event with lower y-coordinate is processed first - if (p1[1] !== p2[1]) return p1[1] > p2[1] ? 1 : -1; + if (p1[1] !== p2[1]) { return p1[1] > p2[1] ? 1 : -1; } return specialCases(e1, e2, p1); } @@ -45470,7 +45583,7 @@ // Same coordinates, but one is a left endpoint and the other is // a right endpoint. The right endpoint is processed first if (e1.left !== e2.left) - return e1.left ? 1 : -1; + { return e1.left ? 1 : -1; } // const p2 = e1.otherEvent.point, p3 = e2.otherEvent.point; // const sa = (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]) @@ -45493,8 +45606,8 @@ * @return {Queue} */ function divideSegment(se, p, queue) { - const r = new SweepEvent(p, false, se, se.isSubject); - const l = new SweepEvent(p, true, se.otherEvent, se.isSubject); + var r = new SweepEvent(p, false, se, se.isSubject); + var l = new SweepEvent(p, true, se.otherEvent, se.isSubject); /* eslint-disable no-console */ if (equals(se.point, se.otherEvent.point)) { @@ -45575,8 +45688,8 @@ // vector, then, could be thought of as the distance (in x and y components) // from the first point to the second point. // So first, let's make our vectors: - const va = [a2[0] - a1[0], a2[1] - a1[1]]; - const vb = [b2[0] - b1[0], b2[1] - b1[1]]; + var va = [a2[0] - a1[0], a2[1] - a1[1]]; + var vb = [b2[0] - b1[0], b2[1] - b1[1]]; // We also define a function to convert back to regular point form: /* eslint-disable arrow-body-style */ @@ -45591,10 +45704,10 @@ /* eslint-enable arrow-body-style */ // The rest is pretty much a straight port of the algorithm. - const e = [b1[0] - a1[0], b1[1] - a1[1]]; - let kross = crossProduct(va, vb); - let sqrKross = kross * kross; - const sqrLenA = dotProduct(va, va); + var e = [b1[0] - a1[0], b1[1] - a1[1]]; + var kross = crossProduct(va, vb); + var sqrKross = kross * kross; + var sqrLenA = dotProduct(va, va); //const sqrLenB = dotProduct(vb, vb); // Check for line intersection. This works because of the properties of the @@ -45606,12 +45719,12 @@ // If they're not parallel, then (because these are line segments) they // still might not actually intersect. This code checks that the // intersection point of the lines is actually on both line segments. - const s = crossProduct(e, vb) / kross; + var s = crossProduct(e, vb) / kross; if (s < 0 || s > 1) { // not on line segment a return null; } - const t = crossProduct(e, va) / kross; + var t = crossProduct(e, va) / kross; if (t < 0 || t > 1) { // not on line segment b return null; @@ -45642,10 +45755,10 @@ return null; } - const sa = dotProduct(va, e) / sqrLenA; - const sb = sa + dotProduct(va, vb) / sqrLenA; - const smin = Math.min(sa, sb); - const smax = Math.max(sa, sb); + var sa = dotProduct(va, e) / sqrLenA; + var sb = sa + dotProduct(va, vb) / sqrLenA; + var smin = Math.min(sa, sb); + var smax = Math.max(sa, sb); // this is, essentially, the FindIntersection acting on floats from // Schneider & Eberly, just inlined into this function. @@ -45660,7 +45773,7 @@ return noEndpointTouch ? null : [toPoint(a1, smax < 1 ? smax : 1, va)]; } - if (noEndpointTouch && smin === 0 && smax === 1) return null; + if (noEndpointTouch && smin === 0 && smax === 1) { return null; } // There's overlap on a segment -- two points of intersection. Return both. return [ @@ -45683,13 +45796,13 @@ // did cost us half a day, so I'll leave it // out of respect // if (se1.isSubject === se2.isSubject) return; - const inter = intersection( + var inter = intersection( se1.point, se1.otherEvent.point, se2.point, se2.otherEvent.point ); - const nintersections = inter ? inter.length : 0; - if (nintersections === 0) return 0; // no intersection + var nintersections = inter ? inter.length : 0; + if (nintersections === 0) { return 0; } // no intersection // the line segments intersect at an endpoint of both line segments if ((nintersections === 1) && @@ -45723,9 +45836,9 @@ } // The line segments associated to se1 and se2 overlap - const events = []; - let leftCoincide = false; - let rightCoincide = false; + var events = []; + var leftCoincide = false; + var rightCoincide = false; if (equals(se1.point, se2.point)) { leftCoincide = true; // linked @@ -45783,21 +45896,21 @@ * @return {Number} */ function compareSegments(le1, le2) { - if (le1 === le2) return 0; + if (le1 === le2) { return 0; } // Segments are not collinear if (signedArea(le1.point, le1.otherEvent.point, le2.point) !== 0 || signedArea(le1.point, le1.otherEvent.point, le2.otherEvent.point) !== 0) { // If they share their left endpoint use the right endpoint to sort - if (equals(le1.point, le2.point)) return le1.isBelow(le2.otherEvent.point) ? -1 : 1; + if (equals(le1.point, le2.point)) { return le1.isBelow(le2.otherEvent.point) ? -1 : 1; } // Different left endpoint: use the left endpoint to sort - if (le1.point[0] === le2.point[0]) return le1.point[1] < le2.point[1] ? -1 : 1; + if (le1.point[0] === le2.point[0]) { return le1.point[1] < le2.point[1] ? -1 : 1; } // has the line segment associated to e1 been inserted // into S after the line segment associated to e2 ? - if (compareEvents(le1, le2) === 1) return le2.isAbove(le1.point) ? -1 : 1; + if (compareEvents(le1, le2) === 1) { return le2.isAbove(le1.point) ? -1 : 1; } // The line segment associated to e2 has been inserted // into S after the line segment associated to e1 @@ -45805,11 +45918,11 @@ } if (le1.isSubject === le2.isSubject) { // same polygon - let p1 = le1.point, p2 = le2.point; + var p1 = le1.point, p2 = le2.point; if (p1[0] === p2[0] && p1[1] === p2[1]/*equals(le1.point, le2.point)*/) { p1 = le1.otherEvent.point; p2 = le2.otherEvent.point; - if (p1[0] === p2[0] && p1[1] === p2[1]) return 0; - else return le1.contourId > le2.contourId ? 1 : -1; + if (p1[0] === p2[0] && p1[1] === p2[1]) { return 0; } + else { return le1.contourId > le2.contourId ? 1 : -1; } } } else { // Segments are collinear, but belong to separate polygons return le1.isSubject ? -1 : 1; @@ -45819,15 +45932,15 @@ } function subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation) { - const sweepLine = new SplayTree(compareSegments); - const sortedEvents = []; + var sweepLine = new SplayTree(compareSegments); + var sortedEvents = []; - const rightbound = Math.min(sbbox[2], cbbox[2]); + var rightbound = Math.min(sbbox[2], cbbox[2]); - let prev, next, begin; + var prev, next, begin; while (eventQueue.length !== 0) { - let event = eventQueue.pop(); + var event = eventQueue.pop(); sortedEvents.push(event); // optimization by bboxes for intersection and difference goes here @@ -45840,13 +45953,13 @@ next = prev = sweepLine.insert(event); begin = sweepLine.minNode(); - if (prev !== begin) prev = sweepLine.prev(prev); - else prev = null; + if (prev !== begin) { prev = sweepLine.prev(prev); } + else { prev = null; } next = sweepLine.next(next); - const prevEvent = prev ? prev.key : null; - let prevprevEvent; + var prevEvent = prev ? prev.key : null; + var prevprevEvent = (void 0); computeFields(event, prevEvent, operation); if (next) { if (possibleIntersection(event, next.key, eventQueue) === 2) { @@ -45857,9 +45970,9 @@ if (prev) { if (possibleIntersection(prev.key, event, eventQueue) === 2) { - let prevprev = prev; - if (prevprev !== begin) prevprev = sweepLine.prev(prevprev); - else prevprev = null; + var prevprev = prev; + if (prevprev !== begin) { prevprev = sweepLine.prev(prevprev); } + else { prevprev = null; } prevprevEvent = prevprev ? prevprev.key : null; computeFields(prevEvent, prevprevEvent, operation); @@ -45872,8 +45985,8 @@ if (prev && next) { - if (prev !== begin) prev = sweepLine.prev(prev); - else prev = null; + if (prev !== begin) { prev = sweepLine.prev(prev); } + else { prev = null; } next = sweepLine.next(next); sweepLine.remove(event); @@ -45887,33 +46000,24 @@ return sortedEvents; } - class Contour { - - /** - * Contour - * - * @class {Contour} - */ - constructor() { - this.points = []; - this.holeIds = []; - this.holeOf = null; - this.depth = null; - } - - isExterior() { - return this.holeOf == null; - } + var Contour = function Contour() { + this.points = []; + this.holeIds = []; + this.holeOf = null; + this.depth = null; + }; - } + Contour.prototype.isExterior = function isExterior () { + return this.holeOf == null; + }; /** * @param {Array.} sortedEvents * @return {Array.} */ function orderEvents(sortedEvents) { - let event, i, len, tmp; - const resultEvents = []; + var event, i, len, tmp; + var resultEvents = []; for (i = 0, len = sortedEvents.length; i < len; i++) { event = sortedEvents[i]; if ((event.left && event.inResult) || @@ -45922,7 +46026,7 @@ } } // Due to overlapping edges the resultEvents array can be not wholly sorted - let sorted = false; + var sorted = false; while (!sorted) { sorted = true; for (i = 0, len = resultEvents.length; i < len; i++) { @@ -45964,13 +46068,13 @@ * @return {Number} */ function nextPos(pos, resultEvents, processed, origPos) { - let newPos = pos + 1, + var newPos = pos + 1, p = resultEvents[pos].point, p1; - const length = resultEvents.length; + var length = resultEvents.length; if (newPos < length) - p1 = resultEvents[newPos].point; + { p1 = resultEvents[newPos].point; } while (newPos < length && p1[0] === p[0] && p1[1] === p[1]) { if (!processed[newPos]) { @@ -45992,23 +46096,23 @@ function initializeContourFromContext(event, contours, contourId) { - const contour = new Contour(); + var contour = new Contour(); if (event.prevInResult != null) { - const prevInResult = event.prevInResult; + var prevInResult = event.prevInResult; // Note that it is valid to query the "previous in result" for its output contour id, // because we must have already processed it (i.e., assigned an output contour id) // in an earlier iteration, otherwise it wouldn't be possible that it is "previous in // result". - const lowerContourId = prevInResult.outputContourId; - const lowerResultTransition = prevInResult.resultTransition; + var lowerContourId = prevInResult.outputContourId; + var lowerResultTransition = prevInResult.resultTransition; if (lowerResultTransition > 0) { // We are inside. Now we have to check if the thing below us is another hole or // an exterior contour. - const lowerContour = contours[lowerContourId]; + var lowerContour = contours[lowerContourId]; if (lowerContour.holeOf != null) { // The lower contour is a hole => Connect the new contour as a hole to its parent, // and use same depth. - const parentContourId = lowerContour.holeOf; + var parentContourId = lowerContour.holeOf; contours[parentContourId].holeIds.push(contourId); contour.holeOf = parentContourId; contour.depth = contours[lowerContourId].depth; @@ -46037,32 +46141,32 @@ * @return {Array.<*>} polygons */ function connectEdges(sortedEvents) { - let i, len; - const resultEvents = orderEvents(sortedEvents); + var i, len; + var resultEvents = orderEvents(sortedEvents); // "false"-filled array - const processed = {}; - const contours = []; + var processed = {}; + var contours = []; - for (i = 0, len = resultEvents.length; i < len; i++) { + var loop = function ( ) { if (processed[i]) { - continue; + return; } - const contourId = contours.length; - const contour = initializeContourFromContext(resultEvents[i], contours, contourId); + var contourId = contours.length; + var contour = initializeContourFromContext(resultEvents[i], contours, contourId); // Helper function that combines marking an event as processed with assigning its output contour ID - const markAsProcessed = (pos) => { + var markAsProcessed = function (pos) { processed[pos] = true; resultEvents[pos].outputContourId = contourId; }; - let pos = i; - let origPos = i; + var pos = i; + var origPos = i; - const initial = resultEvents[i].point; + var initial = resultEvents[i].point; contour.points.push(initial); /* eslint no-constant-condition: "off" */ @@ -46082,7 +46186,9 @@ } contours.push(contour); - } + }; + + for (i = 0, len = resultEvents.length; i < len; i++) loop( ); return contours; } @@ -46091,14 +46197,14 @@ var _default$1 = TinyQueue; function TinyQueue(data, compare) { - if (!(this instanceof TinyQueue)) return new TinyQueue(data, compare); + if (!(this instanceof TinyQueue)) { return new TinyQueue(data, compare); } this.data = data || []; this.length = this.data.length; this.compare = compare || defaultCompare$1; if (this.length > 0) { - for (var i = (this.length >> 1) - 1; i >= 0; i--) this._down(i); + for (var i = (this.length >> 1) - 1; i >= 0; i--) { this._down(i); } } } @@ -46115,7 +46221,7 @@ }, pop: function () { - if (this.length === 0) return undefined; + if (this.length === 0) { return undefined; } var top = this.data[0]; this.length--; @@ -46141,7 +46247,7 @@ while (pos > 0) { var parent = (pos - 1) >> 1; var current = data[parent]; - if (compare(item, current) >= 0) break; + if (compare(item, current) >= 0) { break; } data[pos] = current; pos = parent; } @@ -46164,7 +46270,7 @@ left = right; best = data[right]; } - if (compare(best, item) >= 0) break; + if (compare(best, item) >= 0) { break; } data[pos] = best; pos = left; @@ -46175,14 +46281,14 @@ }; tinyqueue.default = _default$1; - const max$2 = Math.max; - const min = Math.min; + var max$2 = Math.max; + var min = Math.min; - let contourId = 0; + var contourId = 0; function processPolygon(contourOrHole, isSubject, depth, Q, bbox, isExteriorRing) { - let i, len, s1, s2, e1, e2; + var i, len, s1, s2, e1, e2; for (i = 0, len = contourOrHole.length - 1; i < len; i++) { s1 = contourOrHole[i]; s2 = contourOrHole[i + 1]; @@ -46205,7 +46311,7 @@ e1.left = true; } - const x = s1[0], y = s1[1]; + var x = s1[0], y = s1[1]; bbox[0] = min(bbox[0], x); bbox[1] = min(bbox[1], y); bbox[2] = max$2(bbox[2], x); @@ -46220,14 +46326,14 @@ function fillQueue(subject, clipping, sbbox, cbbox, operation) { - const eventQueue = new tinyqueue(null, compareEvents); - let polygonSet, isExteriorRing, i, ii, j, jj; //, k, kk; + var eventQueue = new tinyqueue(null, compareEvents); + var polygonSet, isExteriorRing, i, ii, j, jj; //, k, kk; for (i = 0, ii = subject.length; i < ii; i++) { polygonSet = subject[i]; for (j = 0, jj = polygonSet.length; j < jj; j++) { isExteriorRing = j === 0; - if (isExteriorRing) contourId++; + if (isExteriorRing) { contourId++; } processPolygon(polygonSet[j], true, contourId, eventQueue, sbbox, isExteriorRing); } } @@ -46236,8 +46342,8 @@ polygonSet = clipping[i]; for (j = 0, jj = polygonSet.length; j < jj; j++) { isExteriorRing = j === 0; - if (operation === DIFFERENCE) isExteriorRing = false; - if (isExteriorRing) contourId++; + if (operation === DIFFERENCE) { isExteriorRing = false; } + if (isExteriorRing) { contourId++; } processPolygon(polygonSet[j], false, contourId, eventQueue, cbbox, isExteriorRing); } } @@ -46245,11 +46351,11 @@ return eventQueue; } - const EMPTY = []; + var EMPTY = []; function trivialOperation(subject, clipping, operation) { - let result = null; + var result = null; if (subject.length * clipping.length === 0) { if (operation === INTERSECTION) { result = EMPTY; @@ -46265,7 +46371,7 @@ function compareBBoxes(subject, clipping, sbbox, cbbox, operation) { - let result = null; + var result = null; if (sbbox[0] > cbbox[2] || cbbox[0] > sbbox[2] || sbbox[1] > cbbox[3] || @@ -46290,15 +46396,15 @@ if (typeof clipping[0][0][0] === 'number') { clipping = [clipping]; } - let trivial = trivialOperation(subject, clipping, operation); + var trivial = trivialOperation(subject, clipping, operation); if (trivial) { return trivial === EMPTY ? null : trivial; } - const sbbox = [Infinity, Infinity, -Infinity, -Infinity]; - const cbbox = [Infinity, Infinity, -Infinity, -Infinity]; + var sbbox = [Infinity, Infinity, -Infinity, -Infinity]; + var cbbox = [Infinity, Infinity, -Infinity, -Infinity]; // console.time('fill queue'); - const eventQueue = fillQueue(subject, clipping, sbbox, cbbox, operation); + var eventQueue = fillQueue(subject, clipping, sbbox, cbbox, operation); //console.timeEnd('fill queue'); trivial = compareBBoxes(subject, clipping, sbbox, cbbox, operation); @@ -46306,23 +46412,23 @@ return trivial === EMPTY ? null : trivial; } // console.time('subdivide edges'); - const sortedEvents = subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation); + var sortedEvents = subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation); //console.timeEnd('subdivide edges'); // console.time('connect vertices'); - const contours = connectEdges(sortedEvents); + var contours = connectEdges(sortedEvents); //console.timeEnd('connect vertices'); // Convert contours to polygons - const polygons = []; - for (let i = 0; i < contours.length; i++) { - let contour = contours[i]; + var polygons = []; + for (var i = 0; i < contours.length; i++) { + var contour = contours[i]; if (contour.isExterior()) { // The exterior ring goes first - let rings = [contour.points]; + var rings = [contour.points]; // Followed by holes if any - for (let j = 0; j < contour.holeIds.length; j++) { - let holeId = contour.holeIds[j]; + for (var j = 0; j < contour.holeIds.length; j++) { + var holeId = contour.holeIds[j]; rings.push(contours[holeId].points); } polygons.push(rings); @@ -46469,7 +46575,7 @@ this.type = val & 0x7; readField(tag, result, this); - if (this.pos === startPos) this.skip(val); + if (this.pos === startPos) { this.skip(val); } } return result; }, @@ -46520,10 +46626,10 @@ var buf = this.buf, val, b; - b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val; - b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val; - b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val; - b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val; + b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) { return val; } + b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) { return val; } + b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) { return val; } + b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) { return val; } b = buf[this.pos]; val |= (b & 0x0f) << 28; return readVarintRemainder(val, isSigned, this); @@ -46565,76 +46671,76 @@ // verbose for performance reasons; doesn't affect gzipped size readPackedVarint: function(arr, isSigned) { - if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned)); + if (this.type !== Pbf.Bytes) { return arr.push(this.readVarint(isSigned)); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readVarint(isSigned)); + while (this.pos < end) { arr.push(this.readVarint(isSigned)); } return arr; }, readPackedSVarint: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readSVarint()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readSVarint()); + while (this.pos < end) { arr.push(this.readSVarint()); } return arr; }, readPackedBoolean: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readBoolean()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readBoolean()); + while (this.pos < end) { arr.push(this.readBoolean()); } return arr; }, readPackedFloat: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readFloat()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readFloat()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readFloat()); + while (this.pos < end) { arr.push(this.readFloat()); } return arr; }, readPackedDouble: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readDouble()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readDouble()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readDouble()); + while (this.pos < end) { arr.push(this.readDouble()); } return arr; }, readPackedFixed32: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readFixed32()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readFixed32()); + while (this.pos < end) { arr.push(this.readFixed32()); } return arr; }, readPackedSFixed32: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readSFixed32()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readSFixed32()); + while (this.pos < end) { arr.push(this.readSFixed32()); } return arr; }, readPackedFixed64: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readFixed64()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readFixed64()); + while (this.pos < end) { arr.push(this.readFixed64()); } return arr; }, readPackedSFixed64: function(arr) { - if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64()); + if (this.type !== Pbf.Bytes) { return arr.push(this.readSFixed64()); } var end = readPackedEnd(this); arr = arr || []; - while (this.pos < end) arr.push(this.readSFixed64()); + while (this.pos < end) { arr.push(this.readSFixed64()); } return arr; }, skip: function(val) { var type = val & 0x7; - if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {} - else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos; - else if (type === Pbf.Fixed32) this.pos += 4; - else if (type === Pbf.Fixed64) this.pos += 8; - else throw new Error('Unimplemented type: ' + type); + if (type === Pbf.Varint) { while (this.buf[this.pos++] > 0x7f) {} } + else if (type === Pbf.Bytes) { this.pos = this.readVarint() + this.pos; } + else if (type === Pbf.Fixed32) { this.pos += 4; } + else if (type === Pbf.Fixed64) { this.pos += 8; } + else { throw new Error('Unimplemented type: ' + type); } }, // === WRITING ================================================================= @@ -46646,7 +46752,7 @@ realloc: function(min) { var length = this.length || 16; - while (length < this.pos + min) length *= 2; + while (length < this.pos + min) { length *= 2; } if (length !== this.length) { var buf = new Uint8Array(length); @@ -46698,9 +46804,9 @@ this.realloc(4); - this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return; - this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return; - this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return; + this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) { return; } + this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) { return; } + this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) { return; } this.buf[this.pos++] = (val >>> 7) & 0x7f; }, @@ -46723,7 +46829,7 @@ this.pos = writeUtf8(this.buf, str, this.pos); var len = this.pos - startPos; - if (len >= 0x80) makeRoomForExtraLength(startPos, len, this); + if (len >= 0x80) { makeRoomForExtraLength(startPos, len, this); } // finally, write the message length in the reserved place and restore the position this.pos = startPos - 1; @@ -46747,7 +46853,7 @@ var len = buffer.length; this.writeVarint(len); this.realloc(len); - for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i]; + for (var i = 0; i < len; i++) { this.buf[this.pos++] = buffer[i]; } }, writeRawMessage: function(fn, obj) { @@ -46758,7 +46864,7 @@ fn(obj, this); var len = this.pos - startPos; - if (len >= 0x80) makeRoomForExtraLength(startPos, len, this); + if (len >= 0x80) { makeRoomForExtraLength(startPos, len, this); } // finally, write the message length in the reserved place and restore the position this.pos = startPos - 1; @@ -46771,15 +46877,15 @@ this.writeRawMessage(fn, obj); }, - writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); }, - writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); }, - writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); }, - writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); }, - writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); }, - writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); }, - writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); }, - writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); }, - writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); }, + writePackedVarint: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedVarint, arr); } }, + writePackedSVarint: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedSVarint, arr); } }, + writePackedBoolean: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedBoolean, arr); } }, + writePackedFloat: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedFloat, arr); } }, + writePackedDouble: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedDouble, arr); } }, + writePackedFixed32: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedFixed32, arr); } }, + writePackedSFixed32: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedSFixed32, arr); } }, + writePackedFixed64: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedFixed64, arr); } }, + writePackedSFixed64: function(tag, arr) { if (arr.length) { this.writeMessage(tag, writePackedSFixed64, arr); } }, writeBytesField: function(tag, buffer) { this.writeTag(tag, Pbf.Bytes); @@ -46830,12 +46936,12 @@ var buf = p.buf, h, b; - b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s); - b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s); - b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s); - b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s); - b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s); - b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s); + b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) { return toNum(l, h, s); } + b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) { return toNum(l, h, s); } + b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) { return toNum(l, h, s); } + b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) { return toNum(l, h, s); } + b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) { return toNum(l, h, s); } + b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) { return toNum(l, h, s); } throw new Error('Expected varint not more than 10 bytes'); } @@ -46892,11 +46998,11 @@ function writeBigVarintHigh(high, pbf) { var lsb = (high & 0x07) << 4; - pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return; - pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return; - pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return; - pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return; - pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return; + pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) { return; } + pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) { return; } + pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) { return; } + pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) { return; } + pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) { return; } pbf.buf[pbf.pos++] = high & 0x7f; } @@ -46908,18 +47014,18 @@ // if 1 byte isn't enough for encoding message length, shift the data to the right pbf.realloc(extraLen); - for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i]; + for (var i = pbf.pos - 1; i >= startPos; i--) { pbf.buf[i + extraLen] = pbf.buf[i]; } } - function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); } - function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); } - function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); } - function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); } - function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); } - function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); } - function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); } - function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); } - function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } + function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeVarint(arr[i]); } } + function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeSVarint(arr[i]); } } + function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeFloat(arr[i]); } } + function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeDouble(arr[i]); } } + function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeBoolean(arr[i]); } } + function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeFixed32(arr[i]); } } + function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeSFixed32(arr[i]); } } + function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeFixed64(arr[i]); } } + function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) { pbf.writeSFixed64(arr[i]); } } // Buffer code below from https://github.com/feross/buffer, MIT-licensed @@ -46956,7 +47062,7 @@ b0 > 0xDF ? 3 : b0 > 0xBF ? 2 : 1; - if (i + bytesPerSequence > end) break; + if (i + bytesPerSequence > end) { break; } var b1, b2, b3; @@ -47396,10 +47502,10 @@ } function readFeature(tag, feature, pbf) { - if (tag == 1) feature.id = pbf.readVarint(); - else if (tag == 2) readTag(pbf, feature); - else if (tag == 3) feature.type = pbf.readVarint(); - else if (tag == 4) feature._geometry = pbf.pos; + if (tag == 1) { feature.id = pbf.readVarint(); } + else if (tag == 2) { readTag(pbf, feature); } + else if (tag == 3) { feature.type = pbf.readVarint(); } + else if (tag == 4) { feature._geometry = pbf.pos; } } function readTag(pbf, feature) { @@ -47440,7 +47546,7 @@ y += pbf.readSVarint(); if (cmd === 1) { // moveTo - if (line) lines.push(line); + if (line) { lines.push(line); } line = []; } @@ -47458,7 +47564,7 @@ } } - if (line) lines.push(line); + if (line) { lines.push(line); } return lines; }; @@ -47489,10 +47595,10 @@ if (cmd === 1 || cmd === 2) { x += pbf.readSVarint(); y += pbf.readSVarint(); - if (x < x1) x1 = x; - if (x > x2) x2 = x; - if (y < y1) y1 = y; - if (y > y2) y2 = y; + if (x < x1) { x1 = x; } + if (x > x2) { x2 = x; } + if (y < y1) { y1 = y; } + if (y > y2) { y2 = y; } } else if (cmd !== 7) { throw new Error('unknown command ' + cmd); @@ -47573,7 +47679,7 @@ function classifyRings(rings) { var len = rings.length; - if (len <= 1) return [rings]; + if (len <= 1) { return [rings]; } var polygons = [], polygon, @@ -47581,19 +47687,19 @@ for (var i = 0; i < len; i++) { var area = signedArea$1(rings[i]); - if (area === 0) continue; + if (area === 0) { continue; } - if (ccw === undefined) ccw = area < 0; + if (ccw === undefined) { ccw = area < 0; } if (ccw === area < 0) { - if (polygon) polygons.push(polygon); + if (polygon) { polygons.push(polygon); } polygon = [rings[i]]; } else { polygon.push(rings[i]); } } - if (polygon) polygons.push(polygon); + if (polygon) { polygons.push(polygon); } return polygons; } @@ -47629,12 +47735,12 @@ } function readLayer(tag, layer, pbf) { - if (tag === 15) layer.version = pbf.readVarint(); - else if (tag === 1) layer.name = pbf.readString(); - else if (tag === 5) layer.extent = pbf.readVarint(); - else if (tag === 2) layer._features.push(pbf.pos); - else if (tag === 3) layer._keys.push(pbf.readString()); - else if (tag === 4) layer._values.push(readValueMessage(pbf)); + if (tag === 15) { layer.version = pbf.readVarint(); } + else if (tag === 1) { layer.name = pbf.readString(); } + else if (tag === 5) { layer.extent = pbf.readVarint(); } + else if (tag === 2) { layer._features.push(pbf.pos); } + else if (tag === 3) { layer._keys.push(pbf.readString()); } + else if (tag === 4) { layer._values.push(readValueMessage(pbf)); } } function readValueMessage(pbf) { @@ -47658,7 +47764,7 @@ // return feature `i` from this layer as a `VectorTileFeature` VectorTileLayer.prototype.feature = function(i) { - if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds'); + if (i < 0 || i >= this._features.length) { throw new Error('feature index out of bounds'); } this._pbf.pos = this._features[i]; @@ -47675,7 +47781,7 @@ function readTile(tag, layers, pbf) { if (tag === 3) { var layer = new vectortilelayer(pbf, pbf.readVarint() + pbf.pos); - if (layer.length) layers[layer.name] = layer; + if (layer.length) { layers[layer.name] = layer; } } } @@ -47726,8 +47832,8 @@ // feature = featureClip; isClipped = true; } - if (!feature.geometry.coordinates.length) continue; // not actually on this tile - if (!feature.geometry.coordinates[0].length) continue; // not actually on this tile + if (!feature.geometry.coordinates.length) { continue; } // not actually on this tile + if (!feature.geometry.coordinates[0].length) { continue; } // not actually on this tile } // Generate some unique IDs and add some metadata @@ -47770,7 +47876,7 @@ function loadTile(source, tile) { - if (source.loaded[tile.id] || source.inflight[tile.id]) return; + if (source.loaded[tile.id] || source.inflight[tile.id]) { return; } var url = source.template .replace('{x}', tile.xyz[0]) @@ -47847,7 +47953,7 @@ data: function(sourceID, projection) { var source = _vtCache[sourceID]; - if (!source) return []; + if (!source) { return []; } var tiles = tiler$7.getTiles(projection); var seen = {}; @@ -47855,12 +47961,12 @@ for (var i = 0; i < tiles.length; i++) { var features = source.loaded[tiles[i].id]; - if (!features || !features.length) continue; + if (!features || !features.length) { continue; } for (var j = 0; j < features.length; j++) { var feature = features[j]; var hash = feature.__featurehash__; - if (seen[hash]) continue; + if (seen[hash]) { continue; } seen[hash] = true; // return a shallow copy, because the hash may change @@ -47918,7 +48024,7 @@ // Search for Wikidata items matching the query itemsForSearchQuery: function(query, callback) { if (!query) { - if (callback) callback('No query', {}); + if (callback) { callback('No query', {}); } return; } @@ -47943,10 +48049,10 @@ if (result && result.error) { throw new Error(result.error); } - if (callback) callback(null, result.search || {}); + if (callback) { callback(null, result.search || {}); } }) .catch(function(err) { - if (callback) callback(err.message, {}); + if (callback) { callback(err.message, {}); } }); }, @@ -47955,7 +48061,7 @@ // return an array of corresponding Wikidata entities. itemsByTitle: function(lang, title, callback) { if (!title) { - if (callback) callback('No title', {}); + if (callback) { callback('No title', {}); } return; } @@ -47975,10 +48081,10 @@ if (result && result.error) { throw new Error(result.error); } - if (callback) callback(null, result.entities || {}); + if (callback) { callback(null, result.entities || {}); } }) .catch(function(err) { - if (callback) callback(err.message, {}); + if (callback) { callback(err.message, {}); } }); }, @@ -47987,7 +48093,7 @@ var localeCode = _mainLocalizer.localeCode().toLowerCase(); // HACK: en-us isn't a wikidata language. We should really be filtering by // the languages known to be supported by wikidata. - if (localeCode === 'en-us') localeCode = 'en'; + if (localeCode === 'en-us') { localeCode = 'en'; } return utilArrayUniq([ localeCode, _mainLocalizer.languageCode().toLowerCase(), @@ -48002,7 +48108,7 @@ return; } if (_wikidataCache[qid]) { - if (callback) callback(null, _wikidataCache[qid]); + if (callback) { callback(null, _wikidataCache[qid]); } return; } @@ -48024,10 +48130,10 @@ if (result && result.error) { throw new Error(result.error); } - if (callback) callback(null, result.entities[qid] || {}); + if (callback) { callback(null, result.entities[qid] || {}); } }) .catch(function(err) { - if (callback) callback(err.message, {}); + if (callback) { callback(err.message, {}); } }); }, @@ -48126,7 +48232,7 @@ search: function(lang, query, callback) { if (!query) { - if (callback) callback('No Query', []); + if (callback) { callback('No Query', []); } return; } @@ -48155,14 +48261,14 @@ } }) .catch(function(err) { - if (callback) callback(err, []); + if (callback) { callback(err, []); } }); }, suggestions: function(lang, query, callback) { if (!query) { - if (callback) callback('', []); + if (callback) { callback('', []); } return; } @@ -48184,17 +48290,17 @@ } else if (!result || result.length < 2) { throw new Error('No Results'); } - if (callback) callback(null, result[1] || []); + if (callback) { callback(null, result[1] || []); } }) .catch(function(err) { - if (callback) callback(err.message, []); + if (callback) { callback(err.message, []); } }); }, translations: function(lang, title, callback) { if (!title) { - if (callback) callback('No Title'); + if (callback) { callback('No Title'); } return; } @@ -48225,7 +48331,7 @@ } }) .catch(function(err) { - if (callback) callback(err.message); + if (callback) { callback(err.message); } }); } @@ -48266,7 +48372,7 @@ function noteComments(selection) { - if (_note.isNew()) return; // don't draw .comments-container + if (_note.isNew()) { return; } // don't draw .comments-container var comments = selection.selectAll('.comments-container') .data([0]); @@ -48333,16 +48439,16 @@ function replaceAvatars(selection) { var showThirdPartyIcons = corePreferences('preferences.privacy.thirdpartyicons') || 'true'; var osm = services.osm; - if (showThirdPartyIcons !== 'true' || !osm) return; + if (showThirdPartyIcons !== 'true' || !osm) { return; } var uids = {}; // gather uids in the comment thread _note.comments.forEach(function(d) { - if (d.uid) uids[d.uid] = true; + if (d.uid) { uids[d.uid] = true; } }); Object.keys(uids).forEach(function(uid) { osm.loadUser(uid, function(err, user) { - if (!user || !user.image_url) return; + if (!user || !user.image_url) { return; } selection.selectAll('.comment-avatar.user-' + uid) .html('') @@ -48356,17 +48462,17 @@ function localeDateString(s) { - if (!s) return null; + if (!s) { return null; } var options = { day: 'numeric', month: 'short', year: 'numeric' }; s = s.replace(/-/g, '/'); // fix browser-specific Date() issues var d = new Date(s); - if (isNaN(d.getTime())) return null; + if (isNaN(d.getTime())) { return null; } return d.toLocaleDateString(_mainLocalizer.localeCode(), options); } noteComments.note = function(val) { - if (!arguments.length) return _note; + if (!arguments.length) { return _note; } _note = val; return noteComments; }; @@ -48423,7 +48529,7 @@ noteHeader.note = function(val) { - if (!arguments.length) return _note; + if (!arguments.length) { return _note; } _note = val; return noteHeader; }; @@ -48463,7 +48569,7 @@ noteReport.note = function(val) { - if (!arguments.length) return _note; + if (!arguments.length) { return _note; } _note = val; return noteReport; }; @@ -48506,7 +48612,7 @@ viewOnOSM.what = function(_) { - if (!arguments.length) return _what; + if (!arguments.length) { return _what; } _what = _; return viewOnOSM; }; @@ -48668,15 +48774,15 @@ // fast submit if user presses cmd+enter function keydown() { - if (!(event.keyCode === 13 && event.metaKey)) return; + if (!(event.keyCode === 13 && event.metaKey)) { return; } var osm = services.osm; - if (!osm) return; + if (!osm) { return; } var hasAuth = osm.authenticated(); - if (!hasAuth) return; + if (!hasAuth) { return; } - if (!_note.newComment) return; + if (!_note.newComment) { return; } event.preventDefault(); @@ -48724,7 +48830,7 @@ .merge(detailSection); var osm = services.osm; - if (!osm) return; + if (!osm) { return; } // Add warning if user is not logged in var hasAuth = osm.authenticated(); @@ -48779,7 +48885,7 @@ .merge(prose); osm.userDetails(function(err, user) { - if (err) return; + if (err) { return; } var userLink = select(document.createElement('div')); @@ -48921,13 +49027,13 @@ noteEditor.note = function(val) { - if (!arguments.length) return _note; + if (!arguments.length) { return _note; } _note = val; return noteEditor; }; noteEditor.newNote = function(val) { - if (!arguments.length) return _newNote; + if (!arguments.length) { return _newNote; } _newNote = val; return noteEditor; }; @@ -48947,7 +49053,7 @@ .on('change', function() { context.map().pan([0,0]); // trigger a redraw var note = checkSelectedID(); - if (!note) return; + if (!note) { return; } context.ui().sidebar .show(_noteEditor.note(note)); }); @@ -48965,7 +49071,7 @@ function checkSelectedID() { - if (!services.osm) return; + if (!services.osm) { return; } var note = services.osm.getNote(selectedNoteID); if (!note) { context.enter(modeBrowse(context)); @@ -48976,7 +49082,7 @@ // class the note as selected, or return to browse mode if the note is gone function selectNote(drawn) { - if (!checkSelectedID()) return; + if (!checkSelectedID()) { return; } var selection = context.surface().selectAll('.layer-notes .note-' + selectedNoteID); @@ -48998,13 +49104,13 @@ function esc() { - if (context.container().select('.combobox').size()) return; + if (context.container().select('.combobox').size()) { return; } context.enter(modeBrowse(context)); } mode.zoomToSelected = function() { - if (!services.osm) return; + if (!services.osm) { return; } var note = services.osm.getNote(selectedNoteID); if (note) { context.map().centerZoomEase(note.loc, 20); @@ -49013,7 +49119,7 @@ mode.newFeature = function(val) { - if (!arguments.length) return _newFeature; + if (!arguments.length) { return _newFeature; } _newFeature = val; return mode; }; @@ -49021,7 +49127,7 @@ mode.enter = function() { var note = checkSelectedID(); - if (!note) return; + if (!note) { return; } _behaviors.forEach(context.install); @@ -49082,7 +49188,7 @@ function startNudge(nudge) { - if (_nudgeInterval) window.clearInterval(_nudgeInterval); + if (_nudgeInterval) { window.clearInterval(_nudgeInterval); } _nudgeInterval = window.setInterval(function() { context.map().pan(nudge); doMove(nudge); @@ -49227,7 +49333,7 @@ dataHeader.datum = function(val) { - if (!arguments.length) return _datum; + if (!arguments.length) { return _datum; } _datum = val; return this; }; @@ -49274,7 +49380,7 @@ }; var combobox = function(input, attachTo) { - if (!input || input.empty()) return; + if (!input || input.empty()) { return; } input .classed('combobox-input', true) @@ -49307,7 +49413,7 @@ function mousedown() { - if (event.button !== 0) return; // left click only + if (event.button !== 0) { return; } // left click only _tDown = +new Date(); // clear selection @@ -49325,19 +49431,19 @@ function mouseup() { input.on('mouseup.combo-input', null); - if (event.button !== 0) return; // left click only - if (input.node() !== document.activeElement) return; // exit if this input is not focused + if (event.button !== 0) { return; } // left click only + if (input.node() !== document.activeElement) { return; } // exit if this input is not focused var start = input.property('selectionStart'); var end = input.property('selectionEnd'); - if (start !== end) return; // exit if user is selecting + if (start !== end) { return; } // exit if user is selecting // not showing or showing for a different field - try to show it. var combo = container.selectAll('.combobox'); if (combo.empty() || combo.datum() !== input.node()) { var tOrig = _tDown; window.setTimeout(function() { - if (tOrig !== _tDown) return; // exit if user double clicked + if (tOrig !== _tDown) { return; } // exit if user double clicked fetchComboData('', function() { show(); render(); @@ -49421,7 +49527,7 @@ break; case 38: // ↑ Up arrow - if (tagName === 'textarea' && !shown) return; + if (tagName === 'textarea' && !shown) { return; } event.preventDefault(); if (tagName === 'input' && !shown) { show(); @@ -49430,7 +49536,7 @@ break; case 40: // ↓ Down arrow - if (tagName === 'textarea' && !shown) return; + if (tagName === 'textarea' && !shown) { return; } event.preventDefault(); if (tagName === 'input' && !shown) { show(); @@ -49509,7 +49615,7 @@ function ensureVisible() { var combo = container.selectAll('.combobox'); - if (combo.empty()) return; + if (combo.empty()) { return; } var containerRect = container.node().getBoundingClientRect(); var comboRect = combo.node().getBoundingClientRect(); @@ -49546,7 +49652,7 @@ _fetcher.call(input, v, function(results) { // already chose a value, don't overwrite or autocomplete it - if (_cancelFetch) return; + if (_cancelFetch) { return; } _suggestions = results; results.forEach(function(d) { _fetched[d.value] = d; }); @@ -49559,13 +49665,13 @@ function tryAutocomplete() { - if (!_canAutocomplete) return; + if (!_canAutocomplete) { return; } var val = _caseSensitive ? value() : value().toLowerCase(); - if (!val) return; + if (!val) { return; } // Don't autocomplete if user is typing a number - #4935 - if (!isNaN(parseFloat(val)) && isFinite(val)) return; + if (!isNaN(parseFloat(val)) && isFinite(val)) { return; } var bestIndex = -1; for (var i = 0; i < _suggestions.length; i++) { @@ -49599,7 +49705,7 @@ } var shown = !container.selectAll('.combobox').empty(); - if (!shown) return; + if (!shown) { return; } var combo = container.selectAll('.combobox'); var options = combo.selectAll('.combobox-option') @@ -49675,43 +49781,43 @@ combobox.canAutocomplete = function(val) { - if (!arguments.length) return _canAutocomplete; + if (!arguments.length) { return _canAutocomplete; } _canAutocomplete = val; return combobox; }; combobox.caseSensitive = function(val) { - if (!arguments.length) return _caseSensitive; + if (!arguments.length) { return _caseSensitive; } _caseSensitive = val; return combobox; }; combobox.data = function(val) { - if (!arguments.length) return _data; + if (!arguments.length) { return _data; } _data = val; return combobox; }; combobox.fetcher = function(val) { - if (!arguments.length) return _fetcher; + if (!arguments.length) { return _fetcher; } _fetcher = val; return combobox; }; combobox.minItems = function(val) { - if (!arguments.length) return _minItems; + if (!arguments.length) { return _minItems; } _minItems = val; return combobox; }; combobox.itemsMouseEnter = function(val) { - if (!arguments.length) return _mouseEnterHandler; + if (!arguments.length) { return _mouseEnterHandler; } _mouseEnterHandler = val; return combobox; }; combobox.itemsMouseLeave = function(val) { - if (!arguments.length) return _mouseLeaveHandler; + if (!arguments.length) { return _mouseLeaveHandler; } _mouseLeaveHandler = val; return combobox; }; @@ -49750,7 +49856,7 @@ select(this) .classed('hide', !show) .style('opacity', null); - if (callback) callback.apply(this); + if (callback) { callback.apply(this); } }); }; } @@ -49850,28 +49956,28 @@ disclosure.title = function(val) { - if (!arguments.length) return _title; + if (!arguments.length) { return _title; } _title = utilFunctor(val); return disclosure; }; disclosure.expanded = function(val) { - if (!arguments.length) return _expanded; + if (!arguments.length) { return _expanded; } _expanded = val; return disclosure; }; disclosure.updatePreference = function(val) { - if (!arguments.length) return _updatePreference; + if (!arguments.length) { return _updatePreference; } _updatePreference = val; return disclosure; }; disclosure.content = function(val) { - if (!arguments.length) return _content; + if (!arguments.length) { return _content; } _content = val; return disclosure; }; @@ -49901,43 +50007,43 @@ }; section.classes = function(val) { - if (!arguments.length) return _classes; + if (!arguments.length) { return _classes; } _classes = utilFunctor(val); return section; }; section.title = function(val) { - if (!arguments.length) return _title; + if (!arguments.length) { return _title; } _title = utilFunctor(val); return section; }; section.expandedByDefault = function(val) { - if (!arguments.length) return _expandedByDefault; + if (!arguments.length) { return _expandedByDefault; } _expandedByDefault = utilFunctor(val); return section; }; section.shouldDisplay = function(val) { - if (!arguments.length) return _shouldDisplay; + if (!arguments.length) { return _shouldDisplay; } _shouldDisplay = utilFunctor(val); return section; }; section.content = function(val) { - if (!arguments.length) return _content; + if (!arguments.length) { return _content; } _content = val; return section; }; section.disclosureContent = function(val) { - if (!arguments.length) return _disclosureContent; + if (!arguments.length) { return _disclosureContent; } _disclosureContent = val; return section; }; section.disclosureExpanded = function(val) { - if (!arguments.length) return _disclosureExpanded; + if (!arguments.length) { return _disclosureExpanded; } _disclosureExpanded = val; return section; }; @@ -50038,7 +50144,7 @@ function load() { - if (!wikibase) return; + if (!wikibase) { return; } _button .classed('tag-reference-loading', true); @@ -50205,7 +50311,7 @@ tagReference.showing = function(val) { - if (!arguments.length) return _showing; + if (!arguments.length) { return _showing; } _showing = val; return tagReference; }; @@ -50494,7 +50600,7 @@ } function setTextareaHeight() { - if (_tagView !== 'text') return; + if (_tagView !== 'text') { return; } var selection = select(this); selection.style('height', null); @@ -50524,7 +50630,7 @@ .filter(function(row) { return row.key && row.key.trim() !== ''; }) .map(function(row) { var rawVal = row.value; - if (typeof rawVal !== 'string') rawVal = '*'; + if (typeof rawVal !== 'string') { rawVal = '*'; } var val = rawVal ? stringify(rawVal) : ''; return stringify(row.key) + '=' + val; }) @@ -50549,15 +50655,15 @@ }); var tagDiff = utilTagDiff(_tags, newTags); - if (!tagDiff.length) return; + if (!tagDiff.length) { return; } _pendingChange = _pendingChange || {}; tagDiff.forEach(function(change) { - if (isReadOnly({ key: change.key })) return; + if (isReadOnly({ key: change.key })) { return; } // skip unchanged multiselection placeholders - if (change.newVal === '*' && typeof change.oldVal !== 'string') return; + if (change.newVal === '*' && typeof change.oldVal !== 'string') { return; } if (change.type === '-') { _pendingChange[change.key] = undefined; @@ -50584,14 +50690,14 @@ } function bindTypeahead(key, value) { - if (isReadOnly(key.datum())) return; + if (isReadOnly(key.datum())) { return; } if (Array.isArray(value.datum().value)) { value.call(uiCombobox(context, 'tag-value') .minItems(1) .fetcher(function(value, callback) { var keyString = utilGetSetValue(key); - if (!_tags[keyString]) return; + if (!_tags[keyString]) { return; } var data = _tags[keyString].filter(Boolean).map(function(tagValue) { return { value: tagValue, @@ -50627,7 +50733,7 @@ geometry: geometry, query: value }, function(err, data) { - if (!err) callback(sort(value, data)); + if (!err) { callback(sort(value, data)); } }); })); @@ -50657,12 +50763,12 @@ } function keyChange(d) { - if (select(this).attr('readonly')) return; + if (select(this).attr('readonly')) { return; } var kOld = d.key; // exit if we are currently about to delete this row anyway - #6366 - if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === undefined) return; + if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === undefined) { return; } var kNew = context.cleanTagKey(this.value.trim()); @@ -50704,7 +50810,7 @@ // update the ordered key index so this row doesn't change position var existingKeyIndex = _orderedKeys.indexOf(kOld); - if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew; + if (existingKeyIndex !== -1) { _orderedKeys[existingKeyIndex] = kNew; } d.key = kNew; // update datum to avoid exit/enter on tag update d.value = vNew; @@ -50715,13 +50821,13 @@ } function valueChange(d) { - if (isReadOnly(d)) return; + if (isReadOnly(d)) { return; } // exit if this is a multiselection and no value was entered - if (typeof d.value !== 'string' && !this.value) return; + if (typeof d.value !== 'string' && !this.value) { return; } // exit if we are currently about to delete this row anyway - #6366 - if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === undefined) return; + if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === undefined) { return; } _pendingChange = _pendingChange || {}; @@ -50730,7 +50836,7 @@ } function removeTag(d) { - if (isReadOnly(d)) return; + if (isReadOnly(d)) { return; } if (d.key === '') { // removing the blank row _showBlank = false; @@ -50762,7 +50868,7 @@ // Delay change in case this change is blurring an edited combo. - #5878 window.setTimeout(function() { - if (!_pendingChange) return; + if (!_pendingChange) { return; } dispatch$1.call('change', this, entityIDs, _pendingChange); _pendingChange = null; @@ -50771,7 +50877,7 @@ section.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } if (_state !== val) { _orderedKeys = []; _state = val; @@ -50781,7 +50887,7 @@ section.presets = function(val) { - if (!arguments.length) return _presets; + if (!arguments.length) { return _presets; } _presets = val; if (_presets && _presets.length && _presets[0].isFallback()) { section.disclosureExpanded(true); @@ -50793,14 +50899,14 @@ section.tags = function(val) { - if (!arguments.length) return _tags; + if (!arguments.length) { return _tags; } _tags = val; return section; }; section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) { _entityIDs = val; _orderedKeys = []; @@ -50811,7 +50917,7 @@ // pass an array of regular expressions to test against the tag key section.readOnlyTags = function(val) { - if (!arguments.length) return _readOnlyTags; + if (!arguments.length) { return _readOnlyTags; } _readOnlyTags = val; return section; }; @@ -50888,7 +50994,7 @@ dataEditor.datum = function(val) { - if (!arguments.length) return _datum; + if (!arguments.length) { return _datum; } _datum = val; return this; }; @@ -50934,7 +51040,7 @@ function esc() { - if (context.container().select('.combobox').size()) return; + if (context.container().select('.combobox').size()) { return; } context.enter(modeBrowse(context)); } @@ -50991,11 +51097,11 @@ } function uiImproveOsmComments() { - let _qaItem; + var _qaItem; function issueComments(selection) { // make the div immediately so it appears above the buttons - let comments = selection.selectAll('.comments-container') + var comments = selection.selectAll('.comments-container') .data([0]); comments = comments.enter() @@ -51005,10 +51111,10 @@ // must retrieve comments from API before they can be displayed services.improveOSM.getComments(_qaItem) - .then(d => { - if (!d.comments) return; // nothing to do here + .then(function (d) { + if (!d.comments) { return; } // nothing to do here - const commentEnter = comments.selectAll('.comment') + var commentEnter = comments.selectAll('.comment') .data(d.comments) .enter() .append('div') @@ -51019,11 +51125,11 @@ .attr('class', 'comment-avatar') .call(svgIcon('#iD-icon-avatar', 'comment-avatar-icon')); - const mainEnter = commentEnter + var mainEnter = commentEnter .append('div') .attr('class', 'comment-main'); - const metadataEnter = mainEnter + var metadataEnter = mainEnter .append('div') .attr('class', 'comment-metadata'); @@ -51031,8 +51137,8 @@ .append('div') .attr('class', 'comment-author') .each(function(d) { - const osm = services.osm; - let selection = select(this); + var osm = services.osm; + var selection = select(this); if (osm && d.username) { selection = selection .append('a') @@ -51042,35 +51148,35 @@ .attr('target', '_blank'); } selection - .text(d => d.username); + .text(function (d) { return d.username; }); }); metadataEnter .append('div') .attr('class', 'comment-date') - .text(d => _t('note.status.commented', { when: localeDateString(d.timestamp) })); + .text(function (d) { return _t('note.status.commented', { when: localeDateString(d.timestamp) }); }); mainEnter .append('div') .attr('class', 'comment-text') .append('p') - .text(d => d.text); + .text(function (d) { return d.text; }); }) - .catch(err => { + .catch(function (err) { console.log(err); // eslint-disable-line no-console }); } function localeDateString(s) { - if (!s) return null; - const options = { day: 'numeric', month: 'short', year: 'numeric' }; - const d = new Date(s * 1000); // timestamp is served in seconds, date takes ms - if (isNaN(d.getTime())) return null; + if (!s) { return null; } + var options = { day: 'numeric', month: 'short', year: 'numeric' }; + var d = new Date(s * 1000); // timestamp is served in seconds, date takes ms + if (isNaN(d.getTime())) { return null; } return d.toLocaleDateString(_mainLocalizer.localeCode(), options); } issueComments.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return issueComments; }; @@ -51079,41 +51185,41 @@ } function uiImproveOsmDetails(context) { - let _qaItem; + var _qaItem; function issueDetail(d) { - if (d.desc) return d.desc; - const issueKey = d.issueKey; + if (d.desc) { return d.desc; } + var issueKey = d.issueKey; d.replacements = d.replacements || {}; d.replacements.default = _t('inspector.unknown'); // special key `default` works as a fallback string - return _t(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements); + return _t(("QA.improveOSM.error_types." + issueKey + ".description"), d.replacements); } function improveOsmDetails(selection) { - const details = selection.selectAll('.error-details') + var details = selection.selectAll('.error-details') .data( (_qaItem ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); details.exit() .remove(); - const detailsEnter = details.enter() + var detailsEnter = details.enter() .append('div') .attr('class', 'error-details qa-details-container'); // description - const descriptionEnter = detailsEnter + var descriptionEnter = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); descriptionEnter .append('h4') - .text(() => _t('QA.keepRight.detail_description')); + .text(function () { return _t('QA.keepRight.detail_description'); }); descriptionEnter .append('div') @@ -51121,32 +51227,32 @@ .html(issueDetail); // If there are entity links in the error message.. - let relatedEntities = []; + var relatedEntities = []; descriptionEnter.selectAll('.error_entity_link, .error_object_link') .each(function() { - const link = select(this); - const isObjectLink = link.classed('error_object_link'); - const entityID = isObjectLink ? + var link = select(this); + var isObjectLink = link.classed('error_object_link'); + var entityID = isObjectLink ? (utilEntityRoot(_qaItem.objectType) + _qaItem.objectId) : this.textContent; - const entity = context.hasEntity(entityID); + var entity = context.hasEntity(entityID); relatedEntities.push(entityID); // Add click handler link - .on('mouseenter', () => { + .on('mouseenter', function () { utilHighlightEntities([entityID], true, context); }) - .on('mouseleave', () => { + .on('mouseleave', function () { utilHighlightEntities([entityID], false, context); }) - .on('click', () => { + .on('click', function () { event.preventDefault(); utilHighlightEntities([entityID], false, context); - const osmlayer = context.layers().layer('osm'); + var osmlayer = context.layers().layer('osm'); if (!osmlayer.enabled()) { osmlayer.enabled(true); } @@ -51156,7 +51262,7 @@ if (entity) { context.enter(modeSelect(context, [entityID])); } else { - context.loadEntity(entityID, () => { + context.loadEntity(entityID, function () { context.enter(modeSelect(context, [entityID])); }); } @@ -51165,10 +51271,10 @@ // Replace with friendly name if possible // (The entity may not yet be loaded into the graph) if (entity) { - let name = utilDisplayName(entity); // try to use common name + var name = utilDisplayName(entity); // try to use common name if (!name && !isObjectLink) { - const preset = _mainPresetIndex.match(entity, context.graph()); + var preset = _mainPresetIndex.match(entity, context.graph()); name = preset && !preset.isFallback() && preset.name(); // fallback to preset name } @@ -51184,7 +51290,7 @@ } improveOsmDetails.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return improveOsmDetails; }; @@ -51193,40 +51299,40 @@ } function uiImproveOsmHeader() { - let _qaItem; + var _qaItem; function issueTitle(d) { - const issueKey = d.issueKey; + var issueKey = d.issueKey; d.replacements = d.replacements || {}; d.replacements.default = _t('inspector.unknown'); // special key `default` works as a fallback string - return _t(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements); + return _t(("QA.improveOSM.error_types." + issueKey + ".title"), d.replacements); } function improveOsmHeader(selection) { - const header = selection.selectAll('.qa-header') + var header = selection.selectAll('.qa-header') .data( (_qaItem ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); header.exit() .remove(); - const headerEnter = header.enter() + var headerEnter = header.enter() .append('div') .attr('class', 'qa-header'); - const svgEnter = headerEnter + var svgEnter = headerEnter .append('div') .attr('class', 'qa-header-icon') - .classed('new', d => d.id < 0) + .classed('new', function (d) { return d.id < 0; }) .append('svg') .attr('width', '20px') .attr('height', '30px') .attr('viewbox', '0 0 20 30') - .attr('class', d => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`); + .attr('class', function (d) { return ("preset-icon-28 qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.itemType)); }); svgEnter .append('polygon') @@ -51240,13 +51346,13 @@ .attr('width', '13px') .attr('height', '13px') .attr('transform', 'translate(3.5, 5)') - .attr('xlink:href', d => { - const picon = d.icon; + .attr('xlink:href', function (d) { + var picon = d.icon; if (!picon) { return ''; } else { - const isMaki = /^maki-/.test(picon); - return `#${picon}${isMaki ? '-11' : ''}`; + var isMaki = /^maki-/.test(picon); + return ("#" + picon + (isMaki ? '-11' : '')); } }); @@ -51257,7 +51363,7 @@ } improveOsmHeader.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return improveOsmHeader; }; @@ -51266,16 +51372,16 @@ } function uiImproveOsmEditor(context) { - const dispatch$1 = dispatch('change'); - const qaDetails = uiImproveOsmDetails(context); - const qaComments = uiImproveOsmComments(); - const qaHeader = uiImproveOsmHeader(); + var dispatch$1 = dispatch('change'); + var qaDetails = uiImproveOsmDetails(context); + var qaComments = uiImproveOsmComments(); + var qaHeader = uiImproveOsmHeader(); - let _qaItem; + var _qaItem; function improveOsmEditor(selection) { - const headerEnter = selection.selectAll('.header') + var headerEnter = selection.selectAll('.header') .data([0]) .enter() .append('div') @@ -51284,14 +51390,14 @@ headerEnter .append('button') .attr('class', 'close') - .on('click', () => context.enter(modeBrowse(context))) + .on('click', function () { return context.enter(modeBrowse(context)); }) .call(svgIcon('#iD-icon-close')); headerEnter .append('h3') .text(_t('QA.improveOSM.title')); - let body = selection.selectAll('.body') + var body = selection.selectAll('.body') .data([0]); body = body.enter() @@ -51299,7 +51405,7 @@ .attr('class', 'body') .merge(body); - const editor = body.selectAll('.qa-editor') + var editor = body.selectAll('.qa-editor') .data([0]); editor.enter() @@ -51313,12 +51419,12 @@ } function improveOsmSaveSection(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - const isShown = (_qaItem && (isSelected || _qaItem.newComment || _qaItem.comment)); - let saveSection = selection.selectAll('.qa-save') + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var isShown = (_qaItem && (isSelected || _qaItem.newComment || _qaItem.comment)); + var saveSection = selection.selectAll('.qa-save') .data( (isShown ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); // exit @@ -51326,7 +51432,7 @@ .remove(); // enter - const saveSectionEnter = saveSection.enter() + var saveSectionEnter = saveSection.enter() .append('div') .attr('class', 'qa-save save-section cf'); @@ -51340,7 +51446,7 @@ .attr('class', 'new-comment-input') .attr('placeholder', _t('QA.keepRight.comment_placeholder')) .attr('maxlength', 1000) - .property('value', d => d.newComment) + .property('value', function (d) { return d.newComment; }) .call(utilNoAuto) .on('input', changeInput) .on('blur', changeInput); @@ -51351,8 +51457,8 @@ .call(qaSaveButtons); function changeInput() { - const input = select(this); - let val = input.property('value').trim(); + var input = select(this); + var val = input.property('value').trim(); if (val === '') { val = undefined; @@ -51361,7 +51467,7 @@ // store the unsaved comment with the issue itself _qaItem = _qaItem.update({ newComment: val }); - const qaService = services.improveOSM; + var qaService = services.improveOSM; if (qaService) { qaService.replaceItem(_qaItem); } @@ -51372,16 +51478,16 @@ } function qaSaveButtons(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - let buttonSection = selection.selectAll('.buttons') - .data((isSelected ? [_qaItem] : []), d => d.status + d.id); + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var buttonSection = selection.selectAll('.buttons') + .data((isSelected ? [_qaItem] : []), function (d) { return d.status + d.id; }); // exit buttonSection.exit() .remove(); // enter - const buttonEnter = buttonSection.enter() + var buttonEnter = buttonSection.enter() .append('div') .attr('class', 'buttons'); @@ -51403,47 +51509,47 @@ .merge(buttonEnter); buttonSection.select('.comment-button') - .attr('disabled', d => d.newComment ? null : true) + .attr('disabled', function (d) { return d.newComment ? null : true; }) .on('click.comment', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.improveOSM; + var qaService = services.improveOSM; if (qaService) { - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); buttonSection.select('.close-button') - .text(d => { - const andComment = (d.newComment ? '_comment' : ''); - return _t(`QA.keepRight.close${andComment}`); + .text(function (d) { + var andComment = (d.newComment ? '_comment' : ''); + return _t(("QA.keepRight.close" + andComment)); }) .on('click.close', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.improveOSM; + var qaService = services.improveOSM; if (qaService) { d.newStatus = 'SOLVED'; - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); buttonSection.select('.ignore-button') - .text(d => { - const andComment = (d.newComment ? '_comment' : ''); - return _t(`QA.keepRight.ignore${andComment}`); + .text(function (d) { + var andComment = (d.newComment ? '_comment' : ''); + return _t(("QA.keepRight.ignore" + andComment)); }) .on('click.ignore', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.improveOSM; + var qaService = services.improveOSM; if (qaService) { d.newStatus = 'INVALID'; - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); } // NOTE: Don't change method name until UI v3 is merged improveOsmEditor.error = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return improveOsmEditor; }; @@ -51452,45 +51558,46 @@ } function uiKeepRightDetails(context) { - let _qaItem; + var _qaItem; function issueDetail(d) { - const { itemType, parentIssueType } = d; - const unknown = _t('inspector.unknown'); - let replacements = d.replacements || {}; + var itemType = d.itemType; + var parentIssueType = d.parentIssueType; + var unknown = _t('inspector.unknown'); + var replacements = d.replacements || {}; replacements.default = unknown; // special key `default` works as a fallback string - let detail = _t(`QA.keepRight.errorTypes.${itemType}.description`, replacements); + var detail = _t(("QA.keepRight.errorTypes." + itemType + ".description"), replacements); if (detail === unknown) { - detail = _t(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements); + detail = _t(("QA.keepRight.errorTypes." + parentIssueType + ".description"), replacements); } return detail; } function keepRightDetails(selection) { - const details = selection.selectAll('.error-details') + var details = selection.selectAll('.error-details') .data( (_qaItem ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); details.exit() .remove(); - const detailsEnter = details.enter() + var detailsEnter = details.enter() .append('div') .attr('class', 'error-details qa-details-container'); // description - const descriptionEnter = detailsEnter + var descriptionEnter = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); descriptionEnter .append('h4') - .text(() => _t('QA.keepRight.detail_description')); + .text(function () { return _t('QA.keepRight.detail_description'); }); descriptionEnter .append('div') @@ -51498,32 +51605,32 @@ .html(issueDetail); // If there are entity links in the error message.. - let relatedEntities = []; + var relatedEntities = []; descriptionEnter.selectAll('.error_entity_link, .error_object_link') .each(function() { - const link = select(this); - const isObjectLink = link.classed('error_object_link'); - const entityID = isObjectLink ? + var link = select(this); + var isObjectLink = link.classed('error_object_link'); + var entityID = isObjectLink ? (utilEntityRoot(_qaItem.objectType) + _qaItem.objectId) : this.textContent; - const entity = context.hasEntity(entityID); + var entity = context.hasEntity(entityID); relatedEntities.push(entityID); // Add click handler link - .on('mouseenter', () => { + .on('mouseenter', function () { utilHighlightEntities([entityID], true, context); }) - .on('mouseleave', () => { + .on('mouseleave', function () { utilHighlightEntities([entityID], false, context); }) - .on('click', () => { + .on('click', function () { event.preventDefault(); utilHighlightEntities([entityID], false, context); - const osmlayer = context.layers().layer('osm'); + var osmlayer = context.layers().layer('osm'); if (!osmlayer.enabled()) { osmlayer.enabled(true); } @@ -51533,7 +51640,7 @@ if (entity) { context.enter(modeSelect(context, [entityID])); } else { - context.loadEntity(entityID, () => { + context.loadEntity(entityID, function () { context.enter(modeSelect(context, [entityID])); }); } @@ -51542,10 +51649,10 @@ // Replace with friendly name if possible // (The entity may not yet be loaded into the graph) if (entity) { - let name = utilDisplayName(entity); // try to use common name + var name = utilDisplayName(entity); // try to use common name if (!name && !isObjectLink) { - const preset = _mainPresetIndex.match(entity, context.graph()); + var preset = _mainPresetIndex.match(entity, context.graph()); name = preset && !preset.isFallback() && preset.name(); // fallback to preset name } @@ -51561,7 +51668,7 @@ } keepRightDetails.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return keepRightDetails; }; @@ -51570,45 +51677,46 @@ } function uiKeepRightHeader() { - let _qaItem; + var _qaItem; function issueTitle(d) { - const { itemType, parentIssueType } = d; - const unknown = _t('inspector.unknown'); - let replacements = d.replacements || {}; + var itemType = d.itemType; + var parentIssueType = d.parentIssueType; + var unknown = _t('inspector.unknown'); + var replacements = d.replacements || {}; replacements.default = unknown; // special key `default` works as a fallback string - let title = _t(`QA.keepRight.errorTypes.${itemType}.title`, replacements); + var title = _t(("QA.keepRight.errorTypes." + itemType + ".title"), replacements); if (title === unknown) { - title = _t(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements); + title = _t(("QA.keepRight.errorTypes." + parentIssueType + ".title"), replacements); } return title; } function keepRightHeader(selection) { - const header = selection.selectAll('.qa-header') + var header = selection.selectAll('.qa-header') .data( (_qaItem ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); header.exit() .remove(); - const headerEnter = header.enter() + var headerEnter = header.enter() .append('div') .attr('class', 'qa-header'); - const iconEnter = headerEnter + var iconEnter = headerEnter .append('div') .attr('class', 'qa-header-icon') - .classed('new', d => d.id < 0); + .classed('new', function (d) { return d.id < 0; }); iconEnter .append('div') - .attr('class', d => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`) + .attr('class', function (d) { return ("preset-icon-28 qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.parentIssueType)); }) .call(svgIcon('#iD-icon-bolt', 'qaItem-fill')); headerEnter @@ -51619,7 +51727,7 @@ keepRightHeader.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return keepRightHeader; }; @@ -51628,15 +51736,15 @@ } function uiViewOnKeepRight() { - let _qaItem; + var _qaItem; function viewOnKeepRight(selection) { - let url; + var url; if (services.keepRight && (_qaItem instanceof QAItem)) { url = services.keepRight.issueURL(_qaItem); } - const link = selection.selectAll('.view-on-keepRight') + var link = selection.selectAll('.view-on-keepRight') .data(url ? [url] : []); // exit @@ -51644,12 +51752,12 @@ .remove(); // enter - const linkEnter = link.enter() + var linkEnter = link.enter() .append('a') .attr('class', 'view-on-keepRight') .attr('target', '_blank') .attr('rel', 'noopener') // security measure - .attr('href', d => d) + .attr('href', function (d) { return d; }) .call(svgIcon('#iD-icon-out-link', 'inline')); linkEnter @@ -51658,7 +51766,7 @@ } viewOnKeepRight.what = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return viewOnKeepRight; }; @@ -51667,15 +51775,15 @@ } function uiKeepRightEditor(context) { - const dispatch$1 = dispatch('change'); - const qaDetails = uiKeepRightDetails(context); - const qaHeader = uiKeepRightHeader(); + var dispatch$1 = dispatch('change'); + var qaDetails = uiKeepRightDetails(context); + var qaHeader = uiKeepRightHeader(); - let _qaItem; + var _qaItem; function keepRightEditor(selection) { - const headerEnter = selection.selectAll('.header') + var headerEnter = selection.selectAll('.header') .data([0]) .enter() .append('div') @@ -51684,7 +51792,7 @@ headerEnter .append('button') .attr('class', 'close') - .on('click', () => context.enter(modeBrowse(context))) + .on('click', function () { return context.enter(modeBrowse(context)); }) .call(svgIcon('#iD-icon-close')); headerEnter @@ -51692,7 +51800,7 @@ .text(_t('QA.keepRight.title')); - let body = selection.selectAll('.body') + var body = selection.selectAll('.body') .data([0]); body = body.enter() @@ -51700,7 +51808,7 @@ .attr('class', 'body') .merge(body); - const editor = body.selectAll('.qa-editor') + var editor = body.selectAll('.qa-editor') .data([0]); editor.enter() @@ -51712,7 +51820,7 @@ .call(keepRightSaveSection); - const footer = selection.selectAll('.footer') + var footer = selection.selectAll('.footer') .data([0]); footer.enter() @@ -51724,12 +51832,12 @@ function keepRightSaveSection(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - const isShown = (_qaItem && (isSelected || _qaItem.newComment || _qaItem.comment)); - let saveSection = selection.selectAll('.qa-save') + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var isShown = (_qaItem && (isSelected || _qaItem.newComment || _qaItem.comment)); + var saveSection = selection.selectAll('.qa-save') .data( (isShown ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); // exit @@ -51737,7 +51845,7 @@ .remove(); // enter - const saveSectionEnter = saveSection.enter() + var saveSectionEnter = saveSection.enter() .append('div') .attr('class', 'qa-save save-section cf'); @@ -51751,7 +51859,7 @@ .attr('class', 'new-comment-input') .attr('placeholder', _t('QA.keepRight.comment_placeholder')) .attr('maxlength', 1000) - .property('value', d => d.newComment || d.comment) + .property('value', function (d) { return d.newComment || d.comment; }) .call(utilNoAuto) .on('input', changeInput) .on('blur', changeInput); @@ -51762,8 +51870,8 @@ .call(qaSaveButtons); function changeInput() { - const input = select(this); - let val = input.property('value').trim(); + var input = select(this); + var val = input.property('value').trim(); if (val === _qaItem.comment) { val = undefined; @@ -51772,7 +51880,7 @@ // store the unsaved comment with the issue itself _qaItem = _qaItem.update({ newComment: val }); - const qaService = services.keepRight; + var qaService = services.keepRight; if (qaService) { qaService.replaceItem(_qaItem); // update keepright cache } @@ -51784,16 +51892,16 @@ function qaSaveButtons(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - let buttonSection = selection.selectAll('.buttons') - .data((isSelected ? [_qaItem] : []), d => d.status + d.id); + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var buttonSection = selection.selectAll('.buttons') + .data((isSelected ? [_qaItem] : []), function (d) { return d.status + d.id; }); // exit buttonSection.exit() .remove(); // enter - const buttonEnter = buttonSection.enter() + var buttonEnter = buttonSection.enter() .append('div') .attr('class', 'buttons'); @@ -51815,47 +51923,47 @@ .merge(buttonEnter); buttonSection.select('.comment-button') // select and propagate data - .attr('disabled', d => d.newComment ? null : true) + .attr('disabled', function (d) { return d.newComment ? null : true; }) .on('click.comment', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.keepRight; + var qaService = services.keepRight; if (qaService) { - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); buttonSection.select('.close-button') // select and propagate data - .text(d => { - const andComment = (d.newComment ? '_comment' : ''); - return _t(`QA.keepRight.close${andComment}`); + .text(function (d) { + var andComment = (d.newComment ? '_comment' : ''); + return _t(("QA.keepRight.close" + andComment)); }) .on('click.close', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.keepRight; + var qaService = services.keepRight; if (qaService) { d.newStatus = 'ignore_t'; // ignore temporarily (item fixed) - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); buttonSection.select('.ignore-button') // select and propagate data - .text(d => { - const andComment = (d.newComment ? '_comment' : ''); - return _t(`QA.keepRight.ignore${andComment}`); + .text(function (d) { + var andComment = (d.newComment ? '_comment' : ''); + return _t(("QA.keepRight.ignore" + andComment)); }) .on('click.ignore', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.keepRight; + var qaService = services.keepRight; if (qaService) { d.newStatus = 'ignore'; // ignore permanently (false positive) - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); } // NOTE: Don't change method name until UI v3 is merged keepRightEditor.error = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return keepRightEditor; }; @@ -51864,73 +51972,73 @@ } function uiOsmoseDetails(context) { - let _qaItem; + var _qaItem; function issueString(d, type) { - if (!d) return ''; + if (!d) { return ''; } // Issue strings are cached from Osmose API - const s = services.osmose.getStrings(d.itemType); + var s = services.osmose.getStrings(d.itemType); return (type in s) ? s[type] : ''; } function osmoseDetails(selection) { - const details = selection.selectAll('.error-details') + var details = selection.selectAll('.error-details') .data( _qaItem ? [_qaItem] : [], - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); details.exit() .remove(); - const detailsEnter = details.enter() + var detailsEnter = details.enter() .append('div') .attr('class', 'error-details qa-details-container'); // Description if (issueString(_qaItem, 'detail')) { - const div = detailsEnter + var div = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); div .append('h4') - .text(() => _t('QA.keepRight.detail_description')); + .text(function () { return _t('QA.keepRight.detail_description'); }); div .append('p') .attr('class', 'qa-details-description-text') - .html(d => issueString(d, 'detail')) + .html(function (d) { return issueString(d, 'detail'); }) .selectAll('a') .attr('rel', 'noopener') .attr('target', '_blank'); } // Elements (populated later as data is requested) - const detailsDiv = detailsEnter + var detailsDiv = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); - const elemsDiv = detailsEnter + var elemsDiv = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); // Suggested Fix (musn't exist for every issue type) if (issueString(_qaItem, 'fix')) { - const div = detailsEnter + var div$1 = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); - div + div$1 .append('h4') - .text(() => _t('QA.osmose.fix_title')); + .text(function () { return _t('QA.osmose.fix_title'); }); - div + div$1 .append('p') - .html(d => issueString(d, 'fix')) + .html(function (d) { return issueString(d, 'fix'); }) .selectAll('a') .attr('rel', 'noopener') .attr('target', '_blank'); @@ -51938,44 +52046,44 @@ // Common Pitfalls (musn't exist for every issue type) if (issueString(_qaItem, 'trap')) { - const div = detailsEnter + var div$2 = detailsEnter .append('div') .attr('class', 'qa-details-subsection'); - div + div$2 .append('h4') - .text(() => _t('QA.osmose.trap_title')); + .text(function () { return _t('QA.osmose.trap_title'); }); - div + div$2 .append('p') - .html(d => issueString(d, 'trap')) + .html(function (d) { return issueString(d, 'trap'); }) .selectAll('a') .attr('rel', 'noopener') .attr('target', '_blank'); } // Save current item to check if UI changed by time request resolves - const thisItem = _qaItem; + var thisItem = _qaItem; services.osmose.loadIssueDetail(_qaItem) - .then(d => { + .then(function (d) { // No details to add if there are no associated issue elements - if (!d.elems || d.elems.length === 0) return; + if (!d.elems || d.elems.length === 0) { return; } // Do nothing if UI has moved on by the time this resolves if ( context.selectedErrorID() !== thisItem.id - && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty() - ) return; + && context.container().selectAll((".qaItem.osmose.hover.itemId-" + (thisItem.id))).empty() + ) { return; } // Things like keys and values are dynamically added to a subtitle string if (d.detail) { detailsDiv .append('h4') - .text(() => _t('QA.osmose.detail_title')); + .text(function () { return _t('QA.osmose.detail_title'); }); detailsDiv .append('p') - .html(d => d.detail) + .html(function (d) { return d.detail; }) .selectAll('a') .attr('rel', 'noopener') .attr('target', '_blank'); @@ -51984,7 +52092,7 @@ // Create list of linked issue elements elemsDiv .append('h4') - .text(() => _t('QA.osmose.elems_title')); + .text(function () { return _t('QA.osmose.elems_title'); }); elemsDiv .append('ul').selectAll('li') @@ -51993,26 +52101,26 @@ .append('li') .append('a') .attr('class', 'error_entity_link') - .text(d => d) + .text(function (d) { return d; }) .each(function() { - const link = select(this); - const entityID = this.textContent; - const entity = context.hasEntity(entityID); + var link = select(this); + var entityID = this.textContent; + var entity = context.hasEntity(entityID); // Add click handler link - .on('mouseenter', () => { + .on('mouseenter', function () { utilHighlightEntities([entityID], true, context); }) - .on('mouseleave', () => { + .on('mouseleave', function () { utilHighlightEntities([entityID], false, context); }) - .on('click', () => { + .on('click', function () { event.preventDefault(); utilHighlightEntities([entityID], false, context); - const osmlayer = context.layers().layer('osm'); + var osmlayer = context.layers().layer('osm'); if (!osmlayer.enabled()) { osmlayer.enabled(true); } @@ -52022,7 +52130,7 @@ if (entity) { context.enter(modeSelect(context, [entityID])); } else { - context.loadEntity(entityID, () => { + context.loadEntity(entityID, function () { context.enter(modeSelect(context, [entityID])); }); } @@ -52031,10 +52139,10 @@ // Replace with friendly name if possible // (The entity may not yet be loaded into the graph) if (entity) { - let name = utilDisplayName(entity); // try to use common name + var name = utilDisplayName(entity); // try to use common name if (!name) { - const preset = _mainPresetIndex.match(entity, context.graph()); + var preset = _mainPresetIndex.match(entity, context.graph()); name = preset && !preset.isFallback() && preset.name(); // fallback to preset name } @@ -52048,14 +52156,14 @@ context.features().forceVisible(d.elems); context.map().pan([0,0]); // trigger a redraw }) - .catch(err => { + .catch(function (err) { console.log(err); // eslint-disable-line no-console }); } osmoseDetails.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return osmoseDetails; }; @@ -52065,45 +52173,45 @@ } function uiOsmoseHeader() { - let _qaItem; + var _qaItem; function issueTitle(d) { - const unknown = _t('inspector.unknown'); + var unknown = _t('inspector.unknown'); - if (!d) return unknown; + if (!d) { return unknown; } // Issue titles supplied by Osmose - const s = services.osmose.getStrings(d.itemType); + var s = services.osmose.getStrings(d.itemType); return ('title' in s) ? s.title : unknown; } function osmoseHeader(selection) { - const header = selection.selectAll('.qa-header') + var header = selection.selectAll('.qa-header') .data( (_qaItem ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); header.exit() .remove(); - const headerEnter = header.enter() + var headerEnter = header.enter() .append('div') .attr('class', 'qa-header'); - const svgEnter = headerEnter + var svgEnter = headerEnter .append('div') .attr('class', 'qa-header-icon') - .classed('new', d => d.id < 0) + .classed('new', function (d) { return d.id < 0; }) .append('svg') .attr('width', '20px') .attr('height', '30px') .attr('viewbox', '0 0 20 30') - .attr('class', d => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`); + .attr('class', function (d) { return ("preset-icon-28 qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.itemType)); }); svgEnter .append('polygon') - .attr('fill', d => services.osmose.getColor(d.item)) + .attr('fill', function (d) { return services.osmose.getColor(d.item); }) .attr('class', 'qaItem-fill') .attr('points', '16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6'); @@ -52113,14 +52221,14 @@ .attr('width', '13px') .attr('height', '13px') .attr('transform', 'translate(3.5, 5)') - .attr('xlink:href', d => { - const picon = d.icon; + .attr('xlink:href', function (d) { + var picon = d.icon; if (!picon) { return ''; } else { - const isMaki = /^maki-/.test(picon); - return `#${picon}${isMaki ? '-11' : ''}`; + var isMaki = /^maki-/.test(picon); + return ("#" + picon + (isMaki ? '-11' : '')); } }); @@ -52131,7 +52239,7 @@ } osmoseHeader.issue = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return osmoseHeader; }; @@ -52140,15 +52248,15 @@ } function uiViewOnOsmose() { - let _qaItem; + var _qaItem; function viewOnOsmose(selection) { - let url; + var url; if (services.osmose && (_qaItem instanceof QAItem)) { url = services.osmose.itemURL(_qaItem); } - const link = selection.selectAll('.view-on-osmose') + var link = selection.selectAll('.view-on-osmose') .data(url ? [url] : []); // exit @@ -52156,12 +52264,12 @@ .remove(); // enter - const linkEnter = link.enter() + var linkEnter = link.enter() .append('a') .attr('class', 'view-on-osmose') .attr('target', '_blank') .attr('rel', 'noopener') // security measure - .attr('href', d => d) + .attr('href', function (d) { return d; }) .call(svgIcon('#iD-icon-out-link', 'inline')); linkEnter @@ -52170,7 +52278,7 @@ } viewOnOsmose.what = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return viewOnOsmose; }; @@ -52179,32 +52287,32 @@ } function uiOsmoseEditor(context) { - const dispatch$1 = dispatch('change'); - const qaDetails = uiOsmoseDetails(context); - const qaHeader = uiOsmoseHeader(); + var dispatch$1 = dispatch('change'); + var qaDetails = uiOsmoseDetails(context); + var qaHeader = uiOsmoseHeader(); - let _qaItem; + var _qaItem; function osmoseEditor(selection) { - const header = selection.selectAll('.header') + var header = selection.selectAll('.header') .data([0]); - const headerEnter = header.enter() + var headerEnter = header.enter() .append('div') .attr('class', 'header fillL'); headerEnter .append('button') .attr('class', 'close') - .on('click', () => context.enter(modeBrowse(context))) + .on('click', function () { return context.enter(modeBrowse(context)); }) .call(svgIcon('#iD-icon-close')); headerEnter .append('h3') .text(_t('QA.osmose.title')); - let body = selection.selectAll('.body') + var body = selection.selectAll('.body') .data([0]); body = body.enter() @@ -52212,7 +52320,7 @@ .attr('class', 'body') .merge(body); - let editor = body.selectAll('.qa-editor') + var editor = body.selectAll('.qa-editor') .data([0]); editor.enter() @@ -52223,7 +52331,7 @@ .call(qaDetails.issue(_qaItem)) .call(osmoseSaveSection); - const footer = selection.selectAll('.footer') + var footer = selection.selectAll('.footer') .data([0]); footer.enter() @@ -52234,12 +52342,12 @@ } function osmoseSaveSection(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - const isShown = (_qaItem && isSelected); - let saveSection = selection.selectAll('.qa-save') + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var isShown = (_qaItem && isSelected); + var saveSection = selection.selectAll('.qa-save') .data( (isShown ? [_qaItem] : []), - d => `${d.id}-${d.status || 0}` + function (d) { return ((d.id) + "-" + (d.status || 0)); } ); // exit @@ -52247,7 +52355,7 @@ .remove(); // enter - const saveSectionEnter = saveSection.enter() + var saveSectionEnter = saveSection.enter() .append('div') .attr('class', 'qa-save save-section cf'); @@ -52258,16 +52366,16 @@ } function qaSaveButtons(selection) { - const isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); - let buttonSection = selection.selectAll('.buttons') - .data((isSelected ? [_qaItem] : []), d => d.status + d.id); + var isSelected = (_qaItem && _qaItem.id === context.selectedErrorID()); + var buttonSection = selection.selectAll('.buttons') + .data((isSelected ? [_qaItem] : []), function (d) { return d.status + d.id; }); // exit buttonSection.exit() .remove(); // enter - const buttonEnter = buttonSection.enter() + var buttonEnter = buttonSection.enter() .append('div') .attr('class', 'buttons'); @@ -52284,31 +52392,31 @@ .merge(buttonEnter); buttonSection.select('.close-button') - .text(() => _t('QA.keepRight.close')) + .text(function () { return _t('QA.keepRight.close'); }) .on('click.close', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.osmose; + var qaService = services.osmose; if (qaService) { d.newStatus = 'done'; - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); buttonSection.select('.ignore-button') - .text(() => _t('QA.keepRight.ignore')) + .text(function () { return _t('QA.keepRight.ignore'); }) .on('click.ignore', function(d) { this.blur(); // avoid keeping focus on the button - #4641 - const qaService = services.osmose; + var qaService = services.osmose; if (qaService) { d.newStatus = 'false'; - qaService.postUpdate(d, (err, item) => dispatch$1.call('change', item)); + qaService.postUpdate(d, function (err, item) { return dispatch$1.call('change', item); }); } }); } // NOTE: Don't change method name until UI v3 is merged osmoseEditor.error = function(val) { - if (!arguments.length) return _qaItem; + if (!arguments.length) { return _qaItem; } _qaItem = val; return osmoseEditor; }; @@ -52333,7 +52441,7 @@ .on('change', function() { context.map().pan([0,0]); // trigger a redraw var error = checkSelectedID(); - if (!error) return; + if (!error) { return; } context.ui().sidebar .show(errorEditor.error(error)); }); @@ -52343,7 +52451,7 @@ .on('change', function() { context.map().pan([0,0]); // trigger a redraw var error = checkSelectedID(); - if (!error) return; + if (!error) { return; } context.ui().sidebar .show(errorEditor.error(error)); }); @@ -52353,7 +52461,7 @@ .on('change', function() { context.map().pan([0,0]); // trigger a redraw var error = checkSelectedID(); - if (!error) return; + if (!error) { return; } context.ui().sidebar .show(errorEditor.error(error)); }); @@ -52372,7 +52480,7 @@ function checkSelectedID() { - if (!errorService) return; + if (!errorService) { return; } var error = errorService.getError(selectedErrorID); if (!error) { context.enter(modeBrowse(context)); @@ -52382,7 +52490,7 @@ mode.zoomToSelected = function() { - if (!errorService) return; + if (!errorService) { return; } var error = errorService.getError(selectedErrorID); if (error) { context.map().centerZoomEase(error.loc, 20); @@ -52392,7 +52500,7 @@ mode.enter = function() { var error = checkSelectedID(); - if (!error) return; + if (!error) { return; } behaviors.forEach(context.install); keybinding @@ -52413,7 +52521,7 @@ // class the error as selected, or return to browse mode if the error is gone function selectError(drawn) { - if (!checkSelectedID()) return; + if (!checkSelectedID()) { return; } var selection = context.surface() .selectAll('.itemId-' + selectedErrorID + '.' + selectedErrorService); @@ -52435,7 +52543,7 @@ } function esc() { - if (context.container().select('.combobox').size()) return; + if (context.container().select('.combobox').size()) { return; } context.enter(modeBrowse(context)); } }; @@ -52484,7 +52592,7 @@ if (event.keyCode === 32) { // don't react to spacebar events during text input var activeNode = document.activeElement; - if (activeNode && new Set(['INPUT', 'TEXTAREA']).has(activeNode.nodeName)) return; + if (activeNode && new Set(['INPUT', 'TEXTAREA']).has(activeNode.nodeName)) { return; } } if (event.keyCode === 93 || // context menu key @@ -52492,7 +52600,7 @@ event.preventDefault(); } - if (event.repeat) return; // ignore repeated events for held keys + if (event.repeat) { return; } // ignore repeated events for held keys // if any key is pressed the user is probably doing something other than long-pressing cancelLongPress(); @@ -52533,7 +52641,7 @@ if (pointer) { delete _downPointers.spacebar; - if (pointer.done) return; + if (pointer.done) { return; } event.preventDefault(); _lastInteractionType = 'spacebar'; @@ -52548,7 +52656,7 @@ cancelLongPress(); - if (event.buttons && event.buttons !== 1) return; + if (event.buttons && event.buttons !== 1) { return; } context.ui().closeEditMenu(); @@ -52563,7 +52671,7 @@ function didLongPress(id, interactionType) { var pointer = _downPointers[id]; - if (!pointer) return; + if (!pointer) { return; } for (var i in _downPointers) { // don't allow this or any currently down pointer to trigger another click @@ -52596,7 +52704,7 @@ function pointerup() { var id = (event.pointerId || 'mouse').toString(); var pointer = _downPointers[id]; - if (!pointer) return; + if (!pointer) { return; } delete _downPointers[id]; @@ -52604,7 +52712,7 @@ _multiselectionPointerId = null; } - if (pointer.done) return; + if (pointer.done) { return; } click(pointer.firstEvent, event, id); } @@ -52612,7 +52720,7 @@ function pointercancel() { var id = (event.pointerId || 'mouse').toString(); - if (!_downPointers[id]) return; + if (!_downPointers[id]) { return; } delete _downPointers[id]; @@ -52702,21 +52810,21 @@ var mode = context.mode(); var selectedIDs = mode.id === 'select' ? mode.selectedIDs() : []; for (var pointerId in _downPointers) { - if (pointerId === 'spacebar' || pointerId === skipPointerId) continue; + if (pointerId === 'spacebar' || pointerId === skipPointerId) { continue; } var pointerInfo = _downPointers[pointerId]; var p1 = pointGetter(pointerInfo.firstEvent); var p2 = pointGetter(pointerInfo.lastEvent); - if (geoVecLength(p1, p2) > _tolerancePx) continue; + if (geoVecLength(p1, p2) > _tolerancePx) { continue; } var datum = pointerInfo.firstEvent.target.__data__; var entity = (datum && datum.properties && datum.properties.entity) || datum; - if (context.graph().hasEntity(entity.id)) return { + if (context.graph().hasEntity(entity.id)) { return { pointerId: pointerId, entityId: entity.id, selected: selectedIDs.indexOf(entity.id) !== -1 - }; + }; } } return null; } @@ -52729,7 +52837,7 @@ var interactionType = _lastInteractionType; var entity = datum && datum.properties && datum.properties.entity; - if (entity) datum = entity; + if (entity) { datum = entity; } if (datum && datum.type === 'midpoint') { // treat targeting midpoints as if targeting the parent way @@ -52750,7 +52858,7 @@ selectedIDs.length <= 1 || selectedIDs.indexOf(datum.id) === -1) { - if (alsoSelectId === datum.id) alsoSelectId = null; + if (alsoSelectId === datum.id) { alsoSelectId = null; } selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum.id]); // always enter modeSelect even if the entity is already @@ -52807,14 +52915,14 @@ context.ui().closeEditMenu(); // always request to show the edit menu in case the mode needs it - if (showMenu) context.ui().showEditMenu(point, interactionType); + if (showMenu) { context.ui().showEditMenu(point, interactionType); } resetProperties(); } function cancelLongPress() { - if (_longPressTimeout) window.clearTimeout(_longPressTimeout); + if (_longPressTimeout) { window.clearTimeout(_longPressTimeout); } _longPressTimeout = null; } @@ -52976,7 +53084,7 @@ var loc = context.map().mouseCoordinates(); - if (!_drawNode) createDrawNode(loc); + if (!_drawNode) { createDrawNode(loc); } context.surface().classed('nope-disabled', event.altKey); @@ -53036,8 +53144,8 @@ } else { // discount the draw node if (parentWay.isClosed()) { - if (nodes.length < 3) return false; - if (_drawNode) nodes.splice(-2, 1); + if (nodes.length < 3) { return false; } + if (_drawNode) { nodes.splice(-2, 1); } testNode = nodes[nodes.length - 2]; } else { // there's nothing we need to test if we ignore the draw node on open ways @@ -53084,7 +53192,7 @@ function setActiveElements() { - if (!_drawNode) return; + if (!_drawNode) { return; } context.surface().selectAll('.' + _drawNode.id) .classed('active', true); @@ -53129,7 +53237,7 @@ move.apply(this, arguments); }) .on('downcancel', function() { - if (_drawNode) removeDrawNode(); + if (_drawNode) { removeDrawNode(); } }) .on('click', drawWay.add) .on('clickWay', drawWay.addWay) @@ -53321,14 +53429,14 @@ drawWay.nodeIndex = function(val) { - if (!arguments.length) return _nodeIndex; + if (!arguments.length) { return _nodeIndex; } _nodeIndex = val; return drawWay; }; drawWay.activeID = function() { - if (!arguments.length) return _drawNode && _drawNode.id; + if (!arguments.length) { return _drawNode && _drawNode.id; } // no assign return drawWay; }; @@ -53655,7 +53763,7 @@ if (way.nodes.indexOf(node.id) !== -1) { count += 1; } - if (count > 1) break; + if (count > 1) { break; } } if (count > 1) { @@ -53696,15 +53804,15 @@ operation.available = function() { - if (_actions.length === 0) return false; - if (_otherIDs.length !== 0) return false; + if (_actions.length === 0) { return false; } + if (_otherIDs.length !== 0) { return false; } if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) { return _vertexIDs.some(function(vertexID) { var way = context.entity(wayID); return way.nodes.indexOf(vertexID) !== -1; }); - })) return false; + })) { return false; } return true; }; @@ -53714,7 +53822,7 @@ var reason; for (var actionIndex in _actions) { reason = _actions[actionIndex].disabled(context.graph()); - if (reason) return reason; + if (reason) { return reason; } } if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) { @@ -53729,7 +53837,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = _coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -53793,7 +53901,7 @@ var entity = graph.entity(entityID); var preset = _mainPresetIndex.match(entity, graph); - if (!preset || preset.isFallback()) return null; + if (!preset || preset.isFallback()) { return null; } if (entity.type === 'node' && preset.id !== 'address' && @@ -53822,18 +53930,18 @@ for (var i in selectedIDs) { var entityID = selectedIDs[i]; var type = downgradeTypeForEntityID(entityID); - if (!type) continue; + if (!type) { continue; } var tags = Object.assign({}, graph.entity(entityID).tags); // shallow copy for (var key in tags) { - if (type === 'address' && addressKeysToKeep.indexOf(key) !== -1) continue; + if (type === 'address' && addressKeysToKeep.indexOf(key) !== -1) { continue; } if (type === 'building') { if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || - key.match(/^roof:.{1,}/)) continue; + key.match(/^roof:.{1,}/)) { continue; } } // keep address tags for buildings too - if (key.match(/^addr:.{1,}/)) continue; + if (key.match(/^addr:.{1,}/)) { continue; } delete tags[key]; } @@ -53907,14 +54015,14 @@ var _actions = selectedIDs.map(function(entityID) { var graph = context.graph(); var entity = graph.hasEntity(entityID); - if (!entity || !entity.hasInterestingTags()) return; + if (!entity || !entity.hasInterestingTags()) { return; } - if (entity.type === 'node' && graph.parentWays(entity).length === 0) return; + if (entity.type === 'node' && graph.parentWays(entity).length === 0) { return; } if (entity.type !== 'node') { var preset = _mainPresetIndex.match(entity, graph); // only allow extraction from ways/relations if the preset supports points - if (preset.geometry.indexOf('point') === -1) return; + if (preset.geometry.indexOf('point') === -1) { return; } } _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph); @@ -53989,28 +54097,28 @@ function getAction() { // prefer a non-disabled action first var join = actionJoin(selectedIDs); - if (!join.disabled(context.graph())) return join; + if (!join.disabled(context.graph())) { return join; } var merge = actionMerge(selectedIDs); - if (!merge.disabled(context.graph())) return merge; + if (!merge.disabled(context.graph())) { return merge; } var mergePolygon = actionMergePolygon(selectedIDs); - if (!mergePolygon.disabled(context.graph())) return mergePolygon; + if (!mergePolygon.disabled(context.graph())) { return mergePolygon; } var mergeNodes = actionMergeNodes(selectedIDs); - if (!mergeNodes.disabled(context.graph())) return mergeNodes; + if (!mergeNodes.disabled(context.graph())) { return mergeNodes; } // otherwise prefer an action with an interesting disabled reason - if (join.disabled(context.graph()) !== 'not_eligible') return join; - if (merge.disabled(context.graph()) !== 'not_eligible') return merge; - if (mergePolygon.disabled(context.graph()) !== 'not_eligible') return mergePolygon; + if (join.disabled(context.graph()) !== 'not_eligible') { return join; } + if (merge.disabled(context.graph()) !== 'not_eligible') { return merge; } + if (mergePolygon.disabled(context.graph()) !== 'not_eligible') { return mergePolygon; } return mergeNodes; } var operation = function() { - if (operation.disabled()) return; + if (operation.disabled()) { return; } context.perform(_action, operation.annotation()); @@ -54021,7 +54129,7 @@ var interestingIDs = resultIDs.filter(function(id) { return context.entity(id).hasInterestingTags(); }); - if (interestingIDs.length) resultIDs = interestingIDs; + if (interestingIDs.length) { resultIDs = interestingIDs; } } context.enter(modeSelect(context, resultIDs)); }; @@ -54032,7 +54140,7 @@ operation.disabled = function() { var actionDisabled = _action.disabled(context.graph()); - if (actionDisabled) return actionDisabled; + if (actionDisabled) { return actionDisabled; } var osm = context.connection(); if (osm && @@ -54075,10 +54183,10 @@ var operation = function() { - if (!_pastePoint) return; + if (!_pastePoint) { return; } var oldIDs = context.copyIDs(); - if (!oldIDs.length) return; + if (!oldIDs.length) { return; } var projection = context.projection; var extent = geoExtent(); @@ -54173,18 +54281,18 @@ function actions(situation) { return selectedIDs.map(function(entityID) { var entity = context.hasEntity(entityID); - if (!entity) return; + if (!entity) { return; } if (situation === 'toolbar') { if (entity.type === 'way' && - (!entity.isOneWay() && !entity.isSided())) return; + (!entity.isOneWay() && !entity.isSided())) { return; } } var geometry = entity.geometry(context.graph()); - if (entity.type !== 'node' && geometry !== 'line') return; + if (entity.type !== 'node' && geometry !== 'line') { return; } var action = actionReverse(entityID); - if (action.disabled(context.graph())) return; + if (action.disabled(context.graph())) { return; } return action; }).filter(Boolean); @@ -54197,7 +54305,7 @@ return entity && entity.type === 'node'; }).length; var typeID = nodeActionCount === 0 ? 'line' : (nodeActionCount === acts.length ? 'point' : 'features'); - if (typeID !== 'features' && acts.length > 1) typeID += 's'; + if (typeID !== 'features' && acts.length > 1) { typeID += 's'; } return typeID; } @@ -54341,17 +54449,17 @@ // Ensure all ways are connected (i.e. only 2 unique endpoints/startpoints) if (utilArrayDifference(startNodeIDs, endNodeIDs).length + - utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null; + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) { return null; } // Ensure path contains at least 3 unique nodes var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()) .map(function(node) { return node.id; }); - if (wayNodeIDs.length <= 2) return null; + if (wayNodeIDs.length <= 2) { return null; } // If range of 2 selected nodes is supplied, ensure nodes lie on the selected path if (_nodeIDs.length === 2 && ( wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1 - )) return null; + )) { return null; } if (_nodeIDs.length) { // If we're only straightenting between two points, we only need that extent visible @@ -54367,7 +54475,7 @@ function operation() { - if (!_action) return; + if (!_action) { return; } context.perform(_action, operation.annotation()); @@ -54398,7 +54506,7 @@ function someMissing() { - if (context.inIntro()) return false; + if (context.inIntro()) { return false; } var osm = context.connection(); if (osm) { var missing = _coords.filter(function(loc) { return !osm.isDataLoaded(loc); }); @@ -54562,7 +54670,7 @@ mode.selectedIDs = function(val) { - if (!arguments.length) return selectedIDs; + if (!arguments.length) { return selectedIDs; } selectedIDs = val; return mode; }; @@ -54574,21 +54682,21 @@ mode.newFeature = function(val) { - if (!arguments.length) return _newFeature; + if (!arguments.length) { return _newFeature; } _newFeature = val; return mode; }; mode.selectBehavior = function(val) { - if (!arguments.length) return _selectBehavior; + if (!arguments.length) { return _selectBehavior; } _selectBehavior = val; return mode; }; mode.follow = function(val) { - if (!arguments.length) return _follow; + if (!arguments.length) { return _follow; } _follow = val; return mode; }; @@ -54633,7 +54741,7 @@ mode.enter = function() { - if (!checkSelectedIDs()) return; + if (!checkSelectedIDs()) { return; } context.features().forceVisible(selectedIDs); @@ -54642,7 +54750,7 @@ loadOperations(); if (!_behaviors.length) { - if (!_selectBehavior) _selectBehavior = behaviorSelect(context); + if (!_selectBehavior) { _selectBehavior = behaviorSelect(context); } _behaviors = [ behaviorPaste(context), @@ -54717,7 +54825,7 @@ function nudgeSelection(delta) { return function() { // prevent nudging during low zoom selection - if (!context.map().withinEditableZoom()) return; + if (!context.map().withinEditableZoom()) { return; } var moveOp = operationMove(context, selectedIDs); if (moveOp.disabled()) { @@ -54734,13 +54842,13 @@ function didDoubleUp(loc) { - if (!context.map().withinEditableZoom()) return; + if (!context.map().withinEditableZoom()) { return; } var target = select(event.target); var datum = target.datum(); var entity = datum && datum.properties && datum.properties.entity; - if (!entity) return; + if (!entity) { return; } if (entity instanceof osmWay && target.classed('target')) { var choice = geoChooseEdge(context.graph().childNodes(entity), loc, context.projection); @@ -54761,7 +54869,7 @@ function selectElements() { - if (!checkSelectedIDs()) return; + if (!checkSelectedIDs()) { return; } var surface = context.surface(); @@ -54795,7 +54903,7 @@ function esc() { - if (context.container().select('.combobox').size()) return; + if (context.container().select('.combobox').size()) { return; } context.enter(modeBrowse(context)); } @@ -54843,7 +54951,7 @@ function previousVertex() { event.preventDefault(); var parent = singularParent(); - if (!parent) return; + if (!parent) { return; } var way = context.entity(parent); var length = way.nodes.length; @@ -54867,7 +54975,7 @@ function nextVertex() { event.preventDefault(); var parent = singularParent(); - if (!parent) return; + if (!parent) { return; } var way = context.entity(parent); var length = way.nodes.length; @@ -54891,7 +54999,7 @@ function nextParent() { event.preventDefault(); var parents = commonParents(); - if (!parents || parents.length < 2) return; + if (!parents || parents.length < 2) { return; } var index = parents.indexOf(_relatedParent); if (index < 0 || index > parents.length - 2) { @@ -55014,7 +55122,7 @@ lasso.p = function(_) { - if (!arguments.length) return lasso; + if (!arguments.length) { return lasso; } lasso.coordinates.push(_); draw(); return lasso; @@ -55076,7 +55184,7 @@ function lassoed() { - if (!lasso) return []; + if (!lasso) { return []; } var graph = context.graph(); var limitToNodes; @@ -55134,7 +55242,7 @@ .on(_pointerPrefix + 'move.lasso', null) .on(_pointerPrefix + 'up.lasso', null); - if (!lasso) return; + if (!lasso) { return; } var ids = lassoed(); lasso.close(); @@ -55171,7 +55279,7 @@ mode.selectBehavior = function(val) { - if (!arguments.length) return _selectBehavior; + if (!arguments.length) { return _selectBehavior; } _selectBehavior = val; return mode; }; @@ -55179,7 +55287,7 @@ mode.enter = function() { if (!_behaviors.length) { - if (!_selectBehavior) _selectBehavior = behaviorSelect(context); + if (!_selectBehavior) { _selectBehavior = behaviorSelect(context); } _behaviors = [ behaviorPaste(context), behaviorHover(context).on('hover', context.ui().sidebar.hover), @@ -55215,7 +55323,7 @@ mode.sidebar = function(_) { - if (!arguments.length) return sidebar; + if (!arguments.length) { return sidebar; } sidebar = _; return mode; }; @@ -55342,7 +55450,7 @@ } function updateTitle(includeChangeCount) { - if (!context.setsDocumentTitle()) return; + if (!context.setsDocumentTitle()) { return; } var newTitle = computedTitle(includeChangeCount); if (document.title !== newTitle) { @@ -55351,7 +55459,7 @@ } function updateHashIfNeeded() { - if (context.inIntro()) return; + if (context.inIntro()) { return; } var latestHash = computedHash(); if (_cachedHash !== latestHash) { @@ -55374,7 +55482,7 @@ function hashchange() { // ignore spurious hashchange events - if (window.location.hash === _cachedHash) return; + if (window.location.hash === _cachedHash) { return; } _cachedHash = window.location.hash; @@ -55387,7 +55495,7 @@ } else { // don't update if the new hash already reflects the state of iD - if (_cachedHash === computedHash()) return; + if (_cachedHash === computedHash()) { return; } var mode = context.mode(); @@ -55490,8 +55598,8 @@ var h = head.entities[id]; var b = base.entities[id]; - if (h === b) return; - if (_changes[id]) return; + if (h === b) { return; } + if (_changes[id]) { return; } if (!h && b) { _changes[id] = { base: b, head: h }; @@ -55683,7 +55791,7 @@ if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) - continue; + { continue; } result[id] = h; @@ -55709,8 +55817,8 @@ var ids = utilArrayUnion(mh, mb); for (i = 0; i < ids.length; i++) { var member = head.hasEntity(ids[i]); - if (!member) continue; // not downloaded - if (extent && !member.intersects(extent, head)) continue; // not visible + if (!member) { continue; } // not downloaded + if (extent && !member.intersects(extent, head)) { continue; } // not visible result[ids[i]] = member; } } @@ -55725,7 +55833,7 @@ function addParents(parents, result) { for (var i = 0; i < parents.length; i++) { var parent = parents[i]; - if (parent.id in result) continue; + if (parent.id in result) { continue; } result[parent.id] = parent; addParents(head.parentRelations(parent), result); @@ -55761,7 +55869,7 @@ function segmentBBox(segment) { var extent = segment.extent(head); // extent can be null if the node entites aren't in the graph for some reason - if (!extent) return null; + if (!extent) { return null; } var bbox = extent.bbox(); bbox.segment = segment; @@ -55796,7 +55904,7 @@ segments = segments.concat(entitySegments); } }); - if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean)); + if (segments.length) { _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean)); } } @@ -55810,7 +55918,7 @@ }); head.parentRelations(entity).forEach(function(relation) { - if (memo[entity.id]) return; + if (memo[entity.id]) { return; } memo[entity.id] = true; if (_bboxes[relation.id]) { removeEntity(relation); @@ -55826,7 +55934,7 @@ for (var i = 0; i < entities.length; i++) { var entity = entities[i]; - if (!entity.visible) continue; + if (!entity.visible) { continue; } if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) { if (!force) { @@ -55847,14 +55955,14 @@ function updateToGraph(graph) { - if (graph === head) return; + if (graph === head) { return; } var diff = coreDifference(head, graph); head = graph; var changed = diff.didChange; - if (!changed.addition && !changed.deletion && !changed.geometry) return; + if (!changed.addition && !changed.deletion && !changed.geometry) { return; } var insertions = {}; @@ -55900,21 +56008,23 @@ } function uiModal(selection, blocking) { - let keybinding = utilKeybinding('modal'); - let previous = selection.select('div.modal'); - let animate = previous.empty(); + var this$1 = this; + + var keybinding = utilKeybinding('modal'); + var previous = selection.select('div.modal'); + var animate = previous.empty(); previous.transition() .duration(200) .style('opacity', 0) .remove(); - let shaded = selection + var shaded = selection .append('div') .attr('class', 'shaded') .style('opacity', 0); - shaded.close = () => { + shaded.close = function () { shaded .transition() .duration(200) @@ -55931,13 +56041,13 @@ }; - let modal = shaded + var modal = shaded .append('div') .attr('class', 'modal fillL'); if (!blocking) { - shaded.on('click.remove-modal', () => { - if (event.target === this) { + shaded.on('click.remove-modal', function () { + if (event.target === this$1) { shaded.close(); } }); @@ -55970,15 +56080,15 @@ } function uiLoading(context) { - let _modalSelection = select(null); - let _message = ''; - let _blocking = false; + var _modalSelection = select(null); + var _message = ''; + var _blocking = false; - let loading = (selection) => { + var loading = function (selection) { _modalSelection = uiModal(selection, _blocking); - let loadertext = _modalSelection.select('.content') + var loadertext = _modalSelection.select('.content') .classed('loading-modal', true) .append('div') .attr('class', 'modal-section fillL'); @@ -56000,25 +56110,25 @@ loading.message = function(val) { - if (!arguments.length) return _message; + if (!arguments.length) { return _message; } _message = val; return loading; }; loading.blocking = function(val) { - if (!arguments.length) return _blocking; + if (!arguments.length) { return _blocking; } _blocking = val; return loading; }; - loading.close = () => { + loading.close = function () { _modalSelection.remove(); }; - loading.isShown = () => { + loading.isShown = function () { return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode; }; @@ -56166,7 +56276,7 @@ .ease(linear$1) .tween('history.tween', function() { return function(t) { - if (t < 1) _overwrite([action0], t); + if (t < 1) { _overwrite([action0], t); } }; }) .on('start', function() { @@ -56218,7 +56328,7 @@ var previous = previousStack.graph; while (_index > 0) { _index--; - if (_stack[_index].annotation) break; + if (_stack[_index].annotation) { break; } } dispatch$1.call('undone', this, _stack[_index], previousStack); @@ -56265,7 +56375,7 @@ undoAnnotation: function() { var i = _index; while (i >= 0) { - if (_stack[i].annotation) return _stack[i].annotation; + if (_stack[i].annotation) { return _stack[i].annotation; } i--; } }, @@ -56274,7 +56384,7 @@ redoAnnotation: function() { var i = _index + 1; while (i <= _stack.length - 1) { - if (_stack[i].annotation) return _stack[i].annotation; + if (_stack[i].annotation) { return _stack[i].annotation; } i++; } }, @@ -56458,7 +56568,7 @@ toJSON: function() { - if (!this.hasChanges()) return; + if (!this.hasChanges()) { return; } var allEntities = {}; var baseEntities = {}; @@ -56504,13 +56614,13 @@ var x = {}; - if (modified.length) x.modified = modified; - if (deleted.length) x.deleted = deleted; - if (i.imageryUsed) x.imageryUsed = i.imageryUsed; - if (i.photoOverlaysUsed) x.photoOverlaysUsed = i.photoOverlaysUsed; - if (i.annotation) x.annotation = i.annotation; - if (i.transform) x.transform = i.transform; - if (i.selectedIDs) x.selectedIDs = i.selectedIDs; + if (modified.length) { x.modified = modified; } + if (deleted.length) { x.deleted = deleted; } + if (i.imageryUsed) { x.imageryUsed = i.imageryUsed; } + if (i.photoOverlaysUsed) { x.photoOverlaysUsed = i.photoOverlaysUsed; } + if (i.annotation) { x.annotation = i.annotation; } + if (i.transform) { x.transform = i.transform; } + if (i.selectedIDs) { x.selectedIDs = i.selectedIDs; } return x; }); @@ -56708,7 +56818,7 @@ if (lock.locked()) { _hasUnresolvedRestorableChanges = false; var json = this.savedHistoryJSON(); - if (json) history.fromJSON(json, true); + if (json) { history.fromJSON(json, true); } } }, @@ -56727,13 +56837,13 @@ * Look for roads that can be connected to other roads with a short extension */ function validationAlmostJunction(context) { - const type = 'almost_junction'; - const EXTEND_TH_METERS = 5; - const WELD_TH_METERS = 0.75; + var type = 'almost_junction'; + var EXTEND_TH_METERS = 5; + var WELD_TH_METERS = 0.75; // Comes from considering bounding case of parallel ways - const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS; + var CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS; // Comes from considering bounding case of perpendicular ways - const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS); + var SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS); function isHighway(entity) { return entity.type === 'way' @@ -56747,28 +56857,28 @@ } - const validation = function checkAlmostJunction(entity, graph) { - if (!isHighway(entity)) return []; - if (entity.isDegenerate()) return []; + var validation = function checkAlmostJunction(entity, graph) { + if (!isHighway(entity)) { return []; } + if (entity.isDegenerate()) { return []; } - const tree = context.history().tree(); - const extendableNodeInfos = findConnectableEndNodesByExtension(entity); + var tree = context.history().tree(); + var extendableNodeInfos = findConnectableEndNodesByExtension(entity); - let issues = []; + var issues = []; - extendableNodeInfos.forEach(extendableNodeInfo => { + extendableNodeInfos.forEach(function (extendableNodeInfo) { issues.push(new validationIssue({ - type, + type: type, subtype: 'highway-highway', severity: 'warning', - message(context) { - const entity1 = context.hasEntity(this.entityIds[0]); + message: function message(context) { + var entity1 = context.hasEntity(this.entityIds[0]); if (this.entityIds[0] === this.entityIds[2]) { return entity1 ? _t('issues.almost_junction.self.message', { feature: utilDisplayLabel(entity1, context.graph()) }) : ''; } else { - const entity2 = context.hasEntity(this.entityIds[2]); + var entity2 = context.hasEntity(this.entityIds[2]); return (entity1 && entity2) ? _t('issues.almost_junction.message', { feature: utilDisplayLabel(entity1, context.graph()), feature2: utilDisplayLabel(entity2, context.graph()) @@ -56779,8 +56889,7 @@ entityIds: [ entity.id, extendableNodeInfo.node.id, - extendableNodeInfo.wid, - ], + extendableNodeInfo.wid ], loc: extendableNodeInfo.node.loc, hash: JSON.stringify(extendableNodeInfo.node.loc), data: { @@ -56795,20 +56904,22 @@ return issues; function makeFixes(context) { - let fixes = [new validationIssueFix({ + var fixes = [new validationIssueFix({ icon: 'iD-icon-abutment', title: _t('issues.fix.connect_features.title'), - onClick(context) { - const annotation = _t('issues.fix.connect_almost_junction.annotation'); - const [, endNodeId, crossWayId] = this.issue.entityIds; - const midNode = context.entity(this.issue.data.midId); - const endNode = context.entity(endNodeId); - const crossWay = context.entity(crossWayId); + onClick: function onClick(context) { + var annotation = _t('issues.fix.connect_almost_junction.annotation'); + var ref = this.issue.entityIds; + var endNodeId = ref[1]; + var crossWayId = ref[2]; + var midNode = context.entity(this.issue.data.midId); + var endNode = context.entity(endNodeId); + var crossWay = context.entity(crossWayId); // When endpoints are close, just join if resulting small change in angle (#7201) - const nearEndNodes = findNearbyEndNodes(endNode, crossWay); + var nearEndNodes = findNearbyEndNodes(endNode, crossWay); if (nearEndNodes.length > 0) { - const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes); + var collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes); if (collinear) { context.perform( actionMergeNodes([collinear.id, endNode.id], collinear.loc), @@ -56818,10 +56929,10 @@ } } - const targetEdge = this.issue.data.edge; - const crossLoc = this.issue.data.cross_loc; - const edgeNodes = [context.entity(targetEdge[0]), context.entity(targetEdge[1])]; - const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc); + var targetEdge = this.issue.data.edge; + var crossLoc = this.issue.data.cross_loc; + var edgeNodes = [context.entity(targetEdge[0]), context.entity(targetEdge[1])]; + var closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc); // already a point nearby, just connect to that if (closestNodeInfo.distance < WELD_TH_METERS) { @@ -56839,15 +56950,15 @@ } })]; - const node = context.hasEntity(this.entityIds[1]); + var node = context.hasEntity(this.entityIds[1]); if (node && !node.hasInterestingTags()) { // node has no descriptive tags, suggest noexit fix fixes.push(new validationIssueFix({ icon: 'maki-barrier', title: _t('issues.fix.tag_as_disconnected.title'), - onClick(context) { - const nodeID = this.issue.entityIds[1]; - const tags = Object.assign({}, context.entity(nodeID).tags); + onClick: function onClick(context) { + var nodeID = this.issue.entityIds[1]; + var tags = Object.assign({}, context.entity(nodeID).tags); tags.noexit = 'yes'; context.perform( actionChangeTags(nodeID, tags), @@ -56871,7 +56982,7 @@ function isExtendableCandidate(node, way) { // can not accurately test vertices on tiles not downloaded from osm - #5938 - const osm = services.osm; + var osm = services.osm; if (osm && !osm.isDataLoaded(node.loc)) { return false; } @@ -56879,8 +56990,8 @@ return false; } - let occurences = 0; - for (const index in way.nodes) { + var occurences = 0; + for (var index in way.nodes) { if (way.nodes[index] === node.id) { occurences += 1; if (occurences > 1) { @@ -56892,25 +57003,25 @@ } function findConnectableEndNodesByExtension(way) { - let results = []; - if (way.isClosed()) return results; + var results = []; + if (way.isClosed()) { return results; } - let testNodes; - const indices = [0, way.nodes.length - 1]; - indices.forEach(nodeIndex => { - const nodeID = way.nodes[nodeIndex]; - const node = graph.entity(nodeID); + var testNodes; + var indices = [0, way.nodes.length - 1]; + indices.forEach(function (nodeIndex) { + var nodeID = way.nodes[nodeIndex]; + var node = graph.entity(nodeID); - if (!isExtendableCandidate(node, way)) return; + if (!isExtendableCandidate(node, way)) { return; } - const connectionInfo = canConnectByExtend(way, nodeIndex); - if (!connectionInfo) return; + var connectionInfo = canConnectByExtend(way, nodeIndex); + if (!connectionInfo) { return; } testNodes = graph.childNodes(way).slice(); // shallow copy testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc); // don't flag issue if connecting the ways would cause self-intersection - if (geoHasSelfIntersections(testNodes, nodeID)) return; + if (geoHasSelfIntersections(testNodes, nodeID)) { return; } results.push(connectionInfo); }); @@ -56922,8 +57033,8 @@ return [ way.nodes[0], way.nodes[way.nodes.length - 1] - ].map(d => graph.entity(d)) - .filter(d => { + ].map(function (d) { return graph.entity(d); }) + .filter(function (d) { // Node cannot be near to itself, but other endnode of same way could be return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH; @@ -56932,14 +57043,14 @@ function findSmallJoinAngle(midNode, tipNode, endNodes) { // Both nodes could be close, so want to join whichever is closest to collinear - let joinTo; - let minAngle = Infinity; + var joinTo; + var minAngle = Infinity; // Checks midNode -> tipNode -> endNode for collinearity - endNodes.forEach(endNode => { - const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI; - const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI; - const diff = Math.max(a1, a2) - Math.min(a1, a2); + endNodes.forEach(function (endNode) { + var a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI; + var a2 = geoAngle(midNode, endNode, context.projection) + Math.PI; + var diff = Math.max(a1, a2) - Math.min(a1, a2); if (diff < minAngle) { joinTo = endNode; @@ -56949,7 +57060,7 @@ /* Threshold set by considering right angle triangle based on node joining threshold and extension distance */ - if (minAngle <= SIG_ANGLE_TH) return joinTo; + if (minAngle <= SIG_ANGLE_TH) { return joinTo; } return null; } @@ -56961,64 +57072,64 @@ function canConnectWays(way, way2) { // allow self-connections - if (way.id === way2.id) return true; + if (way.id === way2.id) { return true; } // if one is bridge or tunnel, both must be bridge or tunnel if ((hasTag(way.tags, 'bridge') || hasTag(way2.tags, 'bridge')) && - !(hasTag(way.tags, 'bridge') && hasTag(way2.tags, 'bridge'))) return false; + !(hasTag(way.tags, 'bridge') && hasTag(way2.tags, 'bridge'))) { return false; } if ((hasTag(way.tags, 'tunnel') || hasTag(way2.tags, 'tunnel')) && - !(hasTag(way.tags, 'tunnel') && hasTag(way2.tags, 'tunnel'))) return false; + !(hasTag(way.tags, 'tunnel') && hasTag(way2.tags, 'tunnel'))) { return false; } // must have equivalent layers and levels - const layer1 = way.tags.layer || '0', + var layer1 = way.tags.layer || '0', layer2 = way2.tags.layer || '0'; - if (layer1 !== layer2) return false; + if (layer1 !== layer2) { return false; } - const level1 = way.tags.level || '0', + var level1 = way.tags.level || '0', level2 = way2.tags.level || '0'; - if (level1 !== level2) return false; + if (level1 !== level2) { return false; } return true; } function canConnectByExtend(way, endNodeIdx) { - const tipNid = way.nodes[endNodeIdx]; // the 'tip' node for extension point - const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2]; // the other node of the edge - const tipNode = graph.entity(tipNid); - const midNode = graph.entity(midNid); - const lon = tipNode.loc[0]; - const lat = tipNode.loc[1]; - const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2; - const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2; - const queryExtent = geoExtent([ + var tipNid = way.nodes[endNodeIdx]; // the 'tip' node for extension point + var midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2]; // the other node of the edge + var tipNode = graph.entity(tipNid); + var midNode = graph.entity(midNid); + var lon = tipNode.loc[0]; + var lat = tipNode.loc[1]; + var lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2; + var lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2; + var queryExtent = geoExtent([ [lon - lon_range, lat - lat_range], [lon + lon_range, lat + lat_range] ]); // first, extend the edge of [midNode -> tipNode] by EXTEND_TH_METERS and find the "extended tip" location - const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc); - const t = EXTEND_TH_METERS / edgeLen + 1.0; - const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t); + var edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc); + var t = EXTEND_TH_METERS / edgeLen + 1.0; + var extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t); // then, check if the extension part [tipNode.loc -> extTipLoc] intersects any other ways - const segmentInfos = tree.waySegments(queryExtent, graph); - for (let i = 0; i < segmentInfos.length; i++) { - let segmentInfo = segmentInfos[i]; + var segmentInfos = tree.waySegments(queryExtent, graph); + for (var i = 0; i < segmentInfos.length; i++) { + var segmentInfo = segmentInfos[i]; - let way2 = graph.entity(segmentInfo.wayId); + var way2 = graph.entity(segmentInfo.wayId); - if (!isHighway(way2)) continue; + if (!isHighway(way2)) { continue; } - if (!canConnectWays(way, way2)) continue; + if (!canConnectWays(way, way2)) { continue; } - let nAid = segmentInfo.nodes[0], + var nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1]; - if (nAid === tipNid || nBid === tipNid) continue; + if (nAid === tipNid || nBid === tipNid) { continue; } - let nA = graph.entity(nAid), + var nA = graph.entity(nAid), nB = graph.entity(nBid); - let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]); + var crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]); if (crossLoc) { return { mid: midNode, @@ -57062,22 +57173,22 @@ function wayTypeFor(way) { - if (way.tags.boundary && way.tags.boundary !== 'no') return 'boundary'; - if (way.tags.indoor && way.tags.indoor !== 'no') return 'indoor'; + if (way.tags.boundary && way.tags.boundary !== 'no') { return 'boundary'; } + if (way.tags.indoor && way.tags.indoor !== 'no') { return 'indoor'; } if ((way.tags.building && way.tags.building !== 'no') || - (way.tags['building:part'] && way.tags['building:part'] !== 'no')) return 'building'; - if (osmPathHighwayTagValues[way.tags.highway]) return 'path'; + (way.tags['building:part'] && way.tags['building:part'] !== 'no')) { return 'building'; } + if (osmPathHighwayTagValues[way.tags.highway]) { return 'path'; } var parentRelations = graph.parentRelations(way); for (var i in parentRelations) { var relation = parentRelations[i]; - if (relation.tags.type === 'boundary') return 'boundary'; + if (relation.tags.type === 'boundary') { return 'boundary'; } if (relation.isMultipolygon()) { - if (relation.tags.indoor && relation.tags.indoor !== 'no') return 'indoor'; + if (relation.tags.indoor && relation.tags.indoor !== 'no') { return 'indoor'; } if ((relation.tags.building && relation.tags.building !== 'no') || - (relation.tags['building:part'] && relation.tags['building:part'] !== 'no')) return 'building'; + (relation.tags['building:part'] && relation.tags['building:part'] !== 'no')) { return 'building'; } } } @@ -57088,18 +57199,18 @@ // don't flag issues where merging would create degenerate ways if (way.nodes.length <= 2 || - (way.isClosed() && way.nodes.length <= 4)) return false; + (way.isClosed() && way.nodes.length <= 4)) { return false; } var bbox = way.extent(graph).bbox(); var hypotenuseMeters = geoSphericalDistance([bbox.minX, bbox.minY], [bbox.maxX, bbox.maxY]); // don't flag close nodes in very small ways - if (hypotenuseMeters < 1.5) return false; + if (hypotenuseMeters < 1.5) { return false; } return true; } function getIssuesForWay(way) { - if (!shouldCheckWay(way)) return []; + if (!shouldCheckWay(way)) { return []; } var issues = [], nodes = graph.childNodes(way); @@ -57108,7 +57219,7 @@ var node2 = nodes[i+1]; var issue = getWayIssueIfAny(node1, node2, way); - if (issue) issues.push(issue); + if (issue) { issues.push(issue); } } return issues; } @@ -57118,13 +57229,13 @@ function checkForCloseness(node1, node2, way) { var issue = getWayIssueIfAny(node1, node2, way); - if (issue) issues.push(issue); + if (issue) { issues.push(issue); } } for (var i = 0; i < parentWays.length; i++) { var parentWay = parentWays[i]; - if (!shouldCheckWay(parentWay)) continue; + if (!shouldCheckWay(parentWay)) { continue; } var lastIndex = parentWay.nodes.length - 1; for (var j = 0; j < parentWay.nodes.length; j++) { @@ -57144,16 +57255,16 @@ } function thresholdMetersForWay(way) { - if (!shouldCheckWay(way)) return 0; + if (!shouldCheckWay(way)) { return 0; } var wayType = wayTypeFor(way); // don't flag boundaries since they might be highly detailed and can't be easily verified - if (wayType === 'boundary') return 0; + if (wayType === 'boundary') { return 0; } // expect some features to be mapped with higher levels of detail - if (wayType === 'indoor') return 0.01; - if (wayType === 'building') return 0.05; - if (wayType === 'path') return 0.1; + if (wayType === 'indoor') { return 0.01; } + if (wayType === 'building') { return 0.05; } + if (wayType === 'path') { return 0.1; } return 0.2; } @@ -57174,8 +57285,8 @@ for (var j = 0; j < intersected.length; j++) { var nearby = intersected[j]; - if (nearby.id === node.id) continue; - if (nearby.type !== 'node' || nearby.geometry(graph) !== 'point') continue; + if (nearby.id === node.id) { continue; } + if (nearby.type !== 'node' || nearby.geometry(graph) !== 'point') { continue; } if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) { @@ -57191,7 +57302,7 @@ break; } } - if (zAxisDifferentiates) continue; + if (zAxisDifferentiates) { continue; } issues.push(new validationIssue({ type: type, @@ -57254,9 +57365,9 @@ return thresholdMetersForWay(parentWay); }); - var threshold = Math.min(...thresholds); + var threshold = Math.min.apply(Math, thresholds); var distance = geoSphericalDistance(node1.loc, node2.loc); - if (distance > threshold) return null; + if (distance > threshold) { return null; } } return new validationIssue({ @@ -57359,18 +57470,18 @@ function getFeatureType(entity, graph) { var geometry = entity.geometry(graph); - if (geometry !== 'line' && geometry !== 'area') return null; + if (geometry !== 'line' && geometry !== 'area') { return null; } var tags = entity.tags; - if (hasTag(tags, 'building') && !ignoredBuildings[tags.building]) return 'building'; - if (hasTag(tags, 'highway') && osmRoutableHighwayTagValues[tags.highway]) return 'highway'; + if (hasTag(tags, 'building') && !ignoredBuildings[tags.building]) { return 'building'; } + if (hasTag(tags, 'highway') && osmRoutableHighwayTagValues[tags.highway]) { return 'highway'; } // don't check railway or waterway areas - if (geometry !== 'line') return null; + if (geometry !== 'line') { return null; } - if (hasTag(tags, 'railway') && osmRailwayTrackTagValues[tags.railway]) return 'railway'; - if (hasTag(tags, 'waterway') && osmFlowingWaterwayTagValues[tags.waterway]) return 'waterway'; + if (hasTag(tags, 'railway') && osmRailwayTrackTagValues[tags.railway]) { return 'railway'; } + if (hasTag(tags, 'waterway') && osmFlowingWaterwayTagValues[tags.waterway]) { return 'waterway'; } return null; } @@ -57394,28 +57505,28 @@ var layer2 = tags2.layer || '0'; if (allowsBridge(featureType1) && allowsBridge(featureType2)) { - if (hasTag(tags1, 'bridge') && !hasTag(tags2, 'bridge')) return true; - if (!hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge')) return true; + if (hasTag(tags1, 'bridge') && !hasTag(tags2, 'bridge')) { return true; } + if (!hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge')) { return true; } // crossing bridges must use different layers - if (hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge') && layer1 !== layer2) return true; - } else if (allowsBridge(featureType1) && hasTag(tags1, 'bridge')) return true; - else if (allowsBridge(featureType2) && hasTag(tags2, 'bridge')) return true; + if (hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge') && layer1 !== layer2) { return true; } + } else if (allowsBridge(featureType1) && hasTag(tags1, 'bridge')) { return true; } + else if (allowsBridge(featureType2) && hasTag(tags2, 'bridge')) { return true; } if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) { - if (hasTag(tags1, 'tunnel') && !hasTag(tags2, 'tunnel')) return true; - if (!hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel')) return true; + if (hasTag(tags1, 'tunnel') && !hasTag(tags2, 'tunnel')) { return true; } + if (!hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel')) { return true; } // crossing tunnels must use different layers - if (hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel') && layer1 !== layer2) return true; - } else if (allowsTunnel(featureType1) && hasTag(tags1, 'tunnel')) return true; - else if (allowsTunnel(featureType2) && hasTag(tags2, 'tunnel')) return true; + if (hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel') && layer1 !== layer2) { return true; } + } else if (allowsTunnel(featureType1) && hasTag(tags1, 'tunnel')) { return true; } + else if (allowsTunnel(featureType2) && hasTag(tags2, 'tunnel')) { return true; } // don't flag crossing waterways and pier/highways - if (featureType1 === 'waterway' && featureType2 === 'highway' && tags2.man_made === 'pier') return true; - if (featureType2 === 'waterway' && featureType1 === 'highway' && tags1.man_made === 'pier') return true; + if (featureType1 === 'waterway' && featureType2 === 'highway' && tags2.man_made === 'pier') { return true; } + if (featureType2 === 'waterway' && featureType1 === 'highway' && tags1.man_made === 'pier') { return true; } if (featureType1 === 'building' || featureType2 === 'building') { // for building crossings, different layers are enough - if (layer1 !== layer2) return true; + if (layer1 !== layer2) { return true; } } return false; } @@ -57458,8 +57569,8 @@ } return {}; } - if (featureType1 === 'waterway') return {}; - if (featureType1 === 'railway') return {}; + if (featureType1 === 'waterway') { return {}; } + if (featureType1 === 'railway') { return {}; } } else { var featureTypes = [featureType1, featureType2]; @@ -57477,8 +57588,8 @@ if (featureTypes.indexOf('waterway') !== -1) { // do not allow fords on structures - if (hasTag(entity1.tags, 'tunnel') && hasTag(entity2.tags, 'tunnel')) return null; - if (hasTag(entity1.tags, 'bridge') && hasTag(entity2.tags, 'bridge')) return null; + if (hasTag(entity1.tags, 'tunnel') && hasTag(entity2.tags, 'tunnel')) { return null; } + if (hasTag(entity1.tags, 'bridge') && hasTag(entity2.tags, 'bridge')) { return null; } if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) { @@ -57495,10 +57606,10 @@ function findCrossingsByWay(way1, graph, tree) { var edgeCrossInfos = []; - if (way1.type !== 'way') return edgeCrossInfos; + if (way1.type !== 'way') { return edgeCrossInfos; } var way1FeatureType = getFeatureTypeForCrossingCheck(way1, graph); - if (way1FeatureType === null) return edgeCrossInfos; + if (way1FeatureType === null) { return edgeCrossInfos; } var checkedSingleCrossingWays = {}; @@ -57533,16 +57644,16 @@ segment2Info = segmentInfos[j]; // don't check for self-intersection in this validation - if (segment2Info.wayId === way1.id) continue; + if (segment2Info.wayId === way1.id) { continue; } // skip if this way was already checked and only one issue is needed - if (checkedSingleCrossingWays[segment2Info.wayId]) continue; + if (checkedSingleCrossingWays[segment2Info.wayId]) { continue; } // mark this way as checked even if there are no crossings comparedWays[segment2Info.wayId] = true; way2 = graph.hasEntity(segment2Info.wayId); - if (!way2) continue; + if (!way2) { continue; } // only check crossing highway, waterway, building, and railway way2FeatureType = getFeatureTypeForCrossingCheck(way2, graph); @@ -57562,9 +57673,9 @@ continue; } nA = graph.hasEntity(nAId); - if (!nA) continue; + if (!nA) { continue; } nB = graph.hasEntity(nBId); - if (!nB) continue; + if (!nB) { continue; } segment1 = [n1.loc, n2.loc]; segment2 = [nA.loc, nB.loc]; @@ -57598,7 +57709,7 @@ function waysToCheck(entity, graph) { var featureType = getFeatureType(entity, graph); - if (!featureType) return []; + if (!featureType) { return []; } if (entity.type === 'way') { return [entity]; @@ -57720,7 +57831,7 @@ loc: crossing.crossPoint, dynamicFixes: function(context) { var mode = context.mode(); - if (!mode || mode.id !== 'select' || mode.selectedIDs().length !== 1) return []; + if (!mode || mode.id !== 'select' || mode.selectedIDs().length !== 1) { return []; } var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1; var selectedFeatureType = this.data.featureTypes[selectedIndex]; @@ -57787,13 +57898,13 @@ title: _t('issues.fix.' + fixTitleID + '.title'), onClick: function(context) { var mode = context.mode(); - if (!mode || mode.id !== 'select') return; + if (!mode || mode.id !== 'select') { return; } var selectedIDs = mode.selectedIDs(); - if (selectedIDs.length !== 1) return; + if (selectedIDs.length !== 1) { return; } var selectedWayID = selectedIDs[0]; - if (!context.hasEntity(selectedWayID)) return; + if (!context.hasEntity(selectedWayID)) { return; } var resultWayIDs = [selectedWayID]; @@ -57836,7 +57947,7 @@ var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection) + Math.PI; var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection) + Math.PI; var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2); - if (crossingAngle > Math.PI) crossingAngle -= Math.PI; + if (crossingAngle > Math.PI) { crossingAngle -= Math.PI; } // lengthen the structure to account for the angle of the crossing structLengthMeters = ((structLengthMeters / 2) / Math.sin(crossingAngle)) * 2; @@ -57936,7 +58047,7 @@ // if the edge is too short to subdivide as desired, then // just bound the structure at the existing end node - if (!newNode) newNode = endNode; + if (!newNode) { newNode = endNode; } var splitAction = actionSplit(newNode.id) .limitWays(resultWayIDs); // only split selected or created ways @@ -58040,18 +58151,18 @@ onClick: function(context) { var mode = context.mode(); - if (!mode || mode.id !== 'select') return; + if (!mode || mode.id !== 'select') { return; } var selectedIDs = mode.selectedIDs(); - if (selectedIDs.length !== 1) return; + if (selectedIDs.length !== 1) { return; } var selectedID = selectedIDs[0]; if (!this.issue.entityIds.some(function(entityId) { return entityId === selectedID; - })) return; + })) { return; } var entity = context.hasEntity(selectedID); - if (!entity) return; + if (!entity) { return; } var tags = Object.assign({}, entity.tags); // shallow copy var layer = tags.layer && Number(tags.layer); @@ -58092,7 +58203,7 @@ var validation = function checkDisconnectedWay(entity, graph) { var routingIslandWays = routingIslandForEntity(entity); - if (!routingIslandWays) return []; + if (!routingIslandWays) { return []; } return [new validationIssue({ type: type, @@ -58124,10 +58235,10 @@ var textDirection = _mainLocalizer.textDirection(); var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), 'start'); - if (startFix) fixes.push(startFix); + if (startFix) { fixes.push(startFix); } var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), 'end'); - if (endFix) fixes.push(endFix); + if (endFix) { fixes.push(endFix); } } if (!fixes.length) { fixes.push(new validationIssueFix({ @@ -58222,38 +58333,38 @@ function isConnectedVertex(vertex) { // assume ways overlapping unloaded tiles are connected to the wider road network - #5938 var osm = services.osm; - if (osm && !osm.isDataLoaded(vertex.loc)) return true; + if (osm && !osm.isDataLoaded(vertex.loc)) { return true; } // entrances are considered connected if (vertex.tags.entrance && - vertex.tags.entrance !== 'no') return true; - if (vertex.tags.amenity === 'parking_entrance') return true; + vertex.tags.entrance !== 'no') { return true; } + if (vertex.tags.amenity === 'parking_entrance') { return true; } return false; } function isRoutableNode(node) { // treat elevators as distinct features in the highway network - if (node.tags.highway === 'elevator') return true; + if (node.tags.highway === 'elevator') { return true; } return false; } function isRoutableWay(way, ignoreInnerWays) { - if (isTaggedAsHighway(way) || way.tags.route === 'ferry') return true; + if (isTaggedAsHighway(way) || way.tags.route === 'ferry') { return true; } return graph.parentRelations(way).some(function(parentRelation) { if (parentRelation.tags.type === 'route' && - parentRelation.tags.route === 'ferry') return true; + parentRelation.tags.route === 'ferry') { return true; } if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && - (!ignoreInnerWays || parentRelation.memberById(way.id).role !== 'inner')) return true; + (!ignoreInnerWays || parentRelation.memberById(way.id).role !== 'inner')) { return true; } }); } function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) { var vertex = graph.hasEntity(vertexID); - if (!vertex || vertex.tags.noexit === 'yes') return null; + if (!vertex || vertex.tags.noexit === 'yes') { return null; } var useLeftContinue = (whichEnd === 'start' && textDirection === 'ltr') || (whichEnd === 'end' && textDirection === 'rtl'); @@ -58268,7 +58379,7 @@ var vertexId = this.entityIds[0]; var vertex = context.hasEntity(vertexId); - if (!way || !vertex) return; + if (!way || !vertex) { return; } // make sure the vertex is actually visible and editable var map = context.map(); @@ -58392,15 +58503,15 @@ var validation = function checkFixmeTag(entity) { - if (!entity.tags.fixme) return []; + if (!entity.tags.fixme) { return []; } // don't flag fixmes on features added by the user - if (entity.version === undefined) return []; + if (entity.version === undefined) { return []; } if (entity.v !== undefined) { var baseEntity = context.history().base().hasEntity(entity.id); // don't flag fixmes added by the user on existing features - if (!baseEntity || !baseEntity.tags.fixme) return []; + if (!baseEntity || !baseEntity.tags.fixme) { return []; } } return [new validationIssue({ @@ -58442,13 +58553,13 @@ var validation = function checkImpossibleOneway(entity, graph) { - if (entity.type !== 'way' || entity.geometry(graph) !== 'line') return []; + if (entity.type !== 'way' || entity.geometry(graph) !== 'line') { return []; } - if (entity.isClosed()) return []; + if (entity.isClosed()) { return []; } - if (!typeForWay(entity)) return []; + if (!typeForWay(entity)) { return []; } - if (!isOneway(entity)) return []; + if (!isOneway(entity)) { return []; } var firstIssues = issuesForNode(entity, entity.first()); var lastIssues = issuesForNode(entity, entity.last()); @@ -58456,16 +58567,16 @@ return firstIssues.concat(lastIssues); function typeForWay(way) { - if (way.geometry(graph) !== 'line') return null; + if (way.geometry(graph) !== 'line') { return null; } - if (osmRoutableHighwayTagValues[way.tags.highway]) return 'highway'; - if (osmFlowingWaterwayTagValues[way.tags.waterway]) return 'waterway'; + if (osmRoutableHighwayTagValues[way.tags.highway]) { return 'highway'; } + if (osmFlowingWaterwayTagValues[way.tags.waterway]) { return 'waterway'; } return null; } function isOneway(way) { - if (way.tags.oneway === 'yes') return true; - if (way.tags.oneway) return false; + if (way.tags.oneway === 'yes') { return true; } + if (way.tags.oneway) { return false; } for (var key in way.tags) { if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) { @@ -58480,7 +58591,7 @@ for (var index in way.nodes) { if (way.nodes[index] === nodeID) { occurences += 1; - if (occurences > 1) return true; + if (occurences > 1) { return true; } } } return false; @@ -58492,33 +58603,33 @@ if (wayType === 'highway') { // entrances are considered connected - if (node.tags.entrance && node.tags.entrance !== 'no') return true; - if (node.tags.amenity === 'parking_entrance') return true; + if (node.tags.entrance && node.tags.entrance !== 'no') { return true; } + if (node.tags.amenity === 'parking_entrance') { return true; } } else if (wayType === 'waterway') { if (node.id === way.first()) { // multiple waterways may start at the same spring - if (node.tags.natural === 'spring') return true; + if (node.tags.natural === 'spring') { return true; } } else { // multiple waterways may end at the same drain - if (node.tags.manhole === 'drain') return true; + if (node.tags.manhole === 'drain') { return true; } } } return graph.parentWays(node).some(function(parentWay) { - if (parentWay.id === way.id) return false; + if (parentWay.id === way.id) { return false; } if (wayType === 'highway') { // allow connections to highway areas if (parentWay.geometry(graph) === 'area' && - osmRoutableHighwayTagValues[parentWay.tags.highway]) return true; + osmRoutableHighwayTagValues[parentWay.tags.highway]) { return true; } // count connections to ferry routes as connected - if (parentWay.tags.route === 'ferry') return true; + if (parentWay.tags.route === 'ferry') { return true; } return graph.parentRelations(parentWay).some(function(parentRelation) { if (parentRelation.tags.type === 'route' && - parentRelation.tags.route === 'ferry') return true; + parentRelation.tags.route === 'ferry') { return true; } // allow connections to highway multipolygons return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway]; @@ -58526,7 +58637,7 @@ } else if (wayType === 'waterway') { // multiple waterways may start or end at a water body at the same node if (parentWay.tags.natural === 'water' || - parentWay.tags.natural === 'coastline') return true; + parentWay.tags.natural === 'coastline') { return true; } } return false; }); @@ -58539,40 +58650,40 @@ var wayType = typeForWay(way); // ignore if this way is self-connected at this node - if (nodeOccursMoreThanOnce(way, nodeID)) return []; + if (nodeOccursMoreThanOnce(way, nodeID)) { return []; } var osm = services.osm; - if (!osm) return []; + if (!osm) { return []; } var node = graph.hasEntity(nodeID); // ignore if this node or its tile are unloaded - if (!node || !osm.isDataLoaded(node.loc)) return []; + if (!node || !osm.isDataLoaded(node.loc)) { return []; } - if (isConnectedViaOtherTypes(way, node)) return []; + if (isConnectedViaOtherTypes(way, node)) { return []; } var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) { - if (parentWay.id === way.id) return false; + if (parentWay.id === way.id) { return false; } return typeForWay(parentWay) === wayType; }); // assume it's okay for waterways to start or end disconnected for now - if (wayType === 'waterway' && attachedWaysOfSameType.length === 0) return []; + if (wayType === 'waterway' && attachedWaysOfSameType.length === 0) { return []; } var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) { return isOneway(attachedWay); }); // ignore if the way is connected to some non-oneway features - if (attachedOneways.length < attachedWaysOfSameType.length) return []; + if (attachedOneways.length < attachedWaysOfSameType.length) { return []; } if (attachedOneways.length) { var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) { - if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) return true; - if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true; + if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) { return true; } + if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) { return true; } return false; }); - if (connectedEndpointsOkay) return []; + if (connectedEndpointsOkay) { return []; } } var placement = isFirst ? 'start' : 'end', @@ -58678,19 +58789,19 @@ var entitySources = entity.tags && entity.tags.source && entity.tags.source.split(';'); - if (!entitySources) return []; + if (!entitySources) { return []; } var issues = []; invalidSources.forEach(function(invalidSource) { var hasInvalidSource = entitySources.some(function(source) { - if (!source.match(new RegExp(invalidSource.regex, 'i'))) return false; - if (invalidSource.exceptRegex && source.match(new RegExp(invalidSource.exceptRegex, 'i'))) return false; + if (!source.match(new RegExp(invalidSource.regex, 'i'))) { return false; } + if (invalidSource.exceptRegex && source.match(new RegExp(invalidSource.exceptRegex, 'i'))) { return false; } return true; }); - if (!hasInvalidSource) return; + if (!hasInvalidSource) { return; } issues.push(new validationIssue({ type: type, @@ -58737,7 +58848,7 @@ var type = 'maprules'; var validation = function checkMaprules(entity, graph) { - if (!services.maprules) return []; + if (!services.maprules) { return []; } var rules = services.maprules.validationRules(); var issues = []; @@ -58760,7 +58871,7 @@ var type = 'mismatched_geometry'; function tagSuggestingLineIsArea(entity) { - if (entity.type !== 'way' || entity.isClosed()) return null; + if (entity.type !== 'way' || entity.isClosed()) { return null; } var tagSuggestingArea = entity.tagSuggestingArea(); if (!tagSuggestingArea) { @@ -58780,7 +58891,7 @@ function makeConnectEndpointsFixOnClick(way, graph) { // must have at least three nodes to close this automatically - if (way.nodes.length < 3) return null; + if (way.nodes.length < 3) { return null; } var nodes = graph.childNodes(way), testNodes; var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length-1].loc); @@ -58823,7 +58934,7 @@ function lineTaggedAsAreaIssue(entity) { var tagSuggestingArea = tagSuggestingLineIsArea(entity); - if (!tagSuggestingArea) return null; + if (!tagSuggestingArea) { return null; } return new validationIssue({ type: type, @@ -58885,13 +58996,13 @@ function vertexTaggedAsPointIssue(entity, graph) { // we only care about nodes - if (entity.type !== 'node') return null; + if (entity.type !== 'node') { return null; } // ignore tagless points - if (Object.keys(entity.tags).length === 0) return null; + if (Object.keys(entity.tags).length === 0) { return null; } // address lines are special so just ignore them - if (entity.isOnAddressLine(graph)) return null; + if (entity.isOnAddressLine(graph)) { return null; } var geometry = entity.geometry(graph); var allowedGeometries = osmNodeGeometriesForTags(entity.tags); @@ -58979,7 +59090,7 @@ !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations - !entity.isComplete(graph)) return null; + !entity.isComplete(graph)) { return null; } var sequences = osmJoinWays(entity.members, graph); @@ -58988,13 +59099,13 @@ for (var i in sequences) { var sequence = sequences[i]; - if (!sequence.nodes) continue; + if (!sequence.nodes) { continue; } var firstNode = sequence.nodes[0]; var lastNode = sequence.nodes[sequence.nodes.length - 1]; // part is closed if the first and last nodes are the same - if (firstNode === lastNode) continue; + if (firstNode === lastNode) { continue; } var issue = new validationIssue({ type: type, @@ -59049,7 +59160,7 @@ var issues = []; if (entity.type === 'way') { graph.parentRelations(entity).forEach(function(relation) { - if (!relation.isMultipolygon()) return; + if (!relation.isMultipolygon()) { return; } var member = relation.memberById(entity.id); if (member && isMissingRole(member)) { @@ -59204,7 +59315,7 @@ subtype = 'highway_classification'; } - if (!subtype) return []; + if (!subtype) { return []; } var messageID = subtype === 'highway_classification' ? 'unknown_road' : 'missing_tag.' + subtype; var referenceID = subtype === 'highway_classification' ? 'unknown_road' : 'missing_tag'; @@ -59283,7 +59394,7 @@ } // remove spaces, punctuation, diacritics - var simplify = (str) => { + var simplify = function (str) { return diacritics.remove( str .replace(/&/g, 'and') @@ -59304,19 +59415,19 @@ // nsimple: "thaiexpress", // kvnnsimple: "amenity/fast_food|thaiexpress" // } - var to_parts = (kvnd) => { - const parts = {}; + var to_parts = function (kvnd) { + var parts = {}; parts.kvnd = kvnd; - const kvndparts = kvnd.split('~', 2); - if (kvndparts.length > 1) parts.d = kvndparts[1]; + var kvndparts = kvnd.split('~', 2); + if (kvndparts.length > 1) { parts.d = kvndparts[1]; } parts.kvn = kvndparts[0]; - const kvnparts = parts.kvn.split('|', 2); - if (kvnparts.length > 1) parts.n = kvnparts[1]; + var kvnparts = parts.kvn.split('|', 2); + if (kvnparts.length > 1) { parts.n = kvnparts[1]; } parts.kv = kvnparts[0]; - const kvparts = parts.kv.split('/', 2); + var kvparts = parts.kv.split('/', 2); parts.k = kvparts[0]; parts.v = kvparts[1]; @@ -59338,48 +59449,48 @@ var require$$0 = getCjsExportFromNamespace(match_groups$1); - const matchGroups$1 = require$$0.matchGroups; + var matchGroups$1 = require$$0.matchGroups; - var matcher$1 = () => { - let _warnings = []; // array of match conflict pairs - let _ambiguous = {}; - let _matchIndex = {}; - let matcher = {}; + var matcher$1 = function () { + var _warnings = []; // array of match conflict pairs + var _ambiguous = {}; + var _matchIndex = {}; + var matcher = {}; // Create an index of all the keys/simplenames for fast matching - matcher.buildMatchIndex = (brands) => { + matcher.buildMatchIndex = function (brands) { // two passes - once for primary names, once for secondary/alternate names - Object.keys(brands).forEach(kvnd => insertNames(kvnd, 'primary')); - Object.keys(brands).forEach(kvnd => insertNames(kvnd, 'secondary')); + Object.keys(brands).forEach(function (kvnd) { return insertNames(kvnd, 'primary'); }); + Object.keys(brands).forEach(function (kvnd) { return insertNames(kvnd, 'secondary'); }); function insertNames(kvnd, which) { - const obj = brands[kvnd]; - const parts = to_parts(kvnd); + var obj = brands[kvnd]; + var parts = to_parts(kvnd); // Exit early for ambiguous names in the second pass. // They were collected in the first pass and we don't gather alt names for them. - if (which === 'secondary' && parts.d) return; + if (which === 'secondary' && parts.d) { return; } if (obj.countryCodes) { parts.countryCodes = obj.countryCodes.slice(); // copy } - const nomatches = (obj.nomatch || []); - if (nomatches.some(s => s === kvnd)) { - console.log(`WARNING match/nomatch conflict for ${kvnd}`); + var nomatches = (obj.nomatch || []); + if (nomatches.some(function (s) { return s === kvnd; })) { + console.log(("WARNING match/nomatch conflict for " + kvnd)); return; } - const match_kv = [parts.kv] + var match_kv = [parts.kv] .concat(obj.matchTags || []) - .concat([`${parts.k}/yes`, `building/yes`]) // #3454 - match some generic tags - .map(s => s.toLowerCase()); + .concat([((parts.k) + "/yes"), "building/yes"]) // #3454 - match some generic tags + .map(function (s) { return s.toLowerCase(); }); - let match_nsimple = []; + var match_nsimple = []; if (which === 'primary') { match_nsimple = [parts.n] .concat(obj.matchNames || []) @@ -59393,26 +59504,26 @@ .map(simplify); } - if (!match_nsimple.length) return; // nothing to do + if (!match_nsimple.length) { return; } // nothing to do - match_kv.forEach(kv => { - match_nsimple.forEach(nsimple => { + match_kv.forEach(function (kv) { + match_nsimple.forEach(function (nsimple) { if (parts.d) { // Known ambiguous names with disambiguation string ~(USA) / ~(Canada) // FIXME: Name collisions will overwrite the initial entry (ok for now) - if (!_ambiguous[kv]) _ambiguous[kv] = {}; + if (!_ambiguous[kv]) { _ambiguous[kv] = {}; } _ambiguous[kv][nsimple] = parts; } else { // Names we mostly expect to be unique.. - if (!_matchIndex[kv]) _matchIndex[kv] = {}; + if (!_matchIndex[kv]) { _matchIndex[kv] = {}; } - const m = _matchIndex[kv][nsimple]; + var m = _matchIndex[kv][nsimple]; if (m) { // There already is a match for this name, skip it // Warn if we detect collisions in a primary name. // Skip warning if a secondary name or a generic `*=yes` tag - #2972 / #3454 if (which === 'primary' && !/\/yes$/.test(kv)) { - _warnings.push([m.kvnd, `${kvnd} (${kv}/${nsimple})`]); + _warnings.push([m.kvnd, (kvnd + " (" + kv + "/" + nsimple + ")")]); } } else { _matchIndex[kv][nsimple] = parts; // insert @@ -59427,33 +59538,33 @@ // pass a `key`, `value`, `name` and return the best match, // `countryCode` optional (if supplied, must match that too) - matcher.matchKVN = (key, value, name, countryCode) => { - return matcher.matchParts(to_parts(`${key}/${value}|${name}`), countryCode); + matcher.matchKVN = function (key, value, name, countryCode) { + return matcher.matchParts(to_parts((key + "/" + value + "|" + name)), countryCode); }; // pass a parts object and return the best match, // `countryCode` optional (if supplied, must match that too) - matcher.matchParts = (parts, countryCode) => { - let match = null; - let inGroup = false; + matcher.matchParts = function (parts, countryCode) { + var match = null; + var inGroup = false; // fixme: we currently return a single match for ambiguous match = _ambiguous[parts.kv] && _ambiguous[parts.kv][parts.nsimple]; - if (match && matchesCountryCode(match)) return match; + if (match && matchesCountryCode(match)) { return match; } // try to return an exact match match = _matchIndex[parts.kv] && _matchIndex[parts.kv][parts.nsimple]; - if (match && matchesCountryCode(match)) return match; + if (match && matchesCountryCode(match)) { return match; } // look in match groups - for (let mg in matchGroups$1) { - const matchGroup = matchGroups$1[mg]; + for (var mg in matchGroups$1) { + var matchGroup = matchGroups$1[mg]; match = null; inGroup = false; - for (let i = 0; i < matchGroup.length; i++) { - const otherkv = matchGroup[i].toLowerCase(); + for (var i = 0; i < matchGroup.length; i++) { + var otherkv = matchGroup[i].toLowerCase(); if (!inGroup) { inGroup = otherkv === parts.kv; } @@ -59478,14 +59589,14 @@ return null; function matchesCountryCode(match) { - if (!countryCode) return true; - if (!match.countryCodes) return true; + if (!countryCode) { return true; } + if (!match.countryCodes) { return true; } return match.countryCodes.indexOf(countryCode) !== -1; } }; - matcher.getWarnings = () => _warnings; + matcher.getWarnings = function () { return _warnings; }; return matcher; }; @@ -59517,24 +59628,24 @@ var j = right; swap(arr, left, k); - if (compare(arr[right], t) > 0) swap(arr, left, right); + if (compare(arr[right], t) > 0) { swap(arr, left, right); } while (i < j) { swap(arr, i, j); i++; j--; - while (compare(arr[i], t) < 0) i++; - while (compare(arr[j], t) > 0) j--; + while (compare(arr[i], t) < 0) { i++; } + while (compare(arr[j], t) > 0) { j--; } } - if (compare(arr[left], t) === 0) swap(arr, left, j); + if (compare(arr[left], t) === 0) { swap(arr, left, j); } else { j++; swap(arr, j, right); } - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; + if (j <= k) { left = j + 1; } + if (k <= j) { right = j - 1; } } } @@ -59559,7 +59670,7 @@ function rbush(maxEntries, format) { - if (!(this instanceof rbush)) return new rbush(maxEntries, format); + if (!(this instanceof rbush)) { return new rbush(maxEntries, format); } // max entries in a node is 9 by default; min node fill is 40% for best performance this._maxEntries = Math.max(4, maxEntries || 9); @@ -59584,7 +59695,7 @@ result = [], toBBox = this.toBBox; - if (!intersects$1(bbox, node)) return result; + if (!intersects$1(bbox, node)) { return result; } var nodesToSearch = [], i, len, child, childBBox; @@ -59596,9 +59707,9 @@ childBBox = node.leaf ? toBBox(child) : child; if (intersects$1(bbox, childBBox)) { - if (node.leaf) result.push(child); - else if (contains$2(bbox, childBBox)) this._all(child, result); - else nodesToSearch.push(child); + if (node.leaf) { result.push(child); } + else if (contains$2(bbox, childBBox)) { this._all(child, result); } + else { nodesToSearch.push(child); } } } node = nodesToSearch.pop(); @@ -59612,7 +59723,7 @@ var node = this.data, toBBox = this.toBBox; - if (!intersects$1(bbox, node)) return false; + if (!intersects$1(bbox, node)) { return false; } var nodesToSearch = [], i, len, child, childBBox; @@ -59624,7 +59735,7 @@ childBBox = node.leaf ? toBBox(child) : child; if (intersects$1(bbox, childBBox)) { - if (node.leaf || contains$2(bbox, childBBox)) return true; + if (node.leaf || contains$2(bbox, childBBox)) { return true; } nodesToSearch.push(child); } } @@ -59635,7 +59746,7 @@ }, load: function (data) { - if (!(data && data.length)) return this; + if (!(data && data.length)) { return this; } if (data.length < this._minEntries) { for (var i = 0, len = data.length; i < len; i++) { @@ -59671,7 +59782,7 @@ }, insert: function (item) { - if (item) this._insert(item, this.data.height - 1); + if (item) { this._insert(item, this.data.height - 1); } return this; }, @@ -59681,7 +59792,7 @@ }, remove: function (item, equalsFn) { - if (!item) return this; + if (!item) { return this; } var node = this.data, bbox = this.toBBox(item), @@ -59723,7 +59834,7 @@ node = parent.children[i]; goingUp = false; - } else node = null; // nothing found + } else { node = null; } // nothing found } return this; @@ -59744,8 +59855,8 @@ _all: function (node, result) { var nodesToSearch = []; while (node) { - if (node.leaf) result.push.apply(result, node.children); - else nodesToSearch.push.apply(nodesToSearch, node.children); + if (node.leaf) { result.push.apply(result, node.children); } + else { nodesToSearch.push.apply(nodesToSearch, node.children); } node = nodesToSearch.pop(); } @@ -59812,7 +59923,7 @@ while (true) { path.push(node); - if (node.leaf || path.length - 1 === level) break; + if (node.leaf || path.length - 1 === level) { break; } minArea = minEnlargement = Infinity; @@ -59860,7 +59971,7 @@ if (insertPath[level].children.length > this._maxEntries) { this._split(insertPath, level); level--; - } else break; + } else { break; } } // adjust bboxes along the insertion path @@ -59885,8 +59996,8 @@ calcBBox$1(node, this.toBBox); calcBBox$1(newNode, this.toBBox); - if (level) insertPath[level - 1].children.push(newNode); - else this._splitRoot(node, newNode); + if (level) { insertPath[level - 1].children.push(newNode); } + else { this._splitRoot(node, newNode); } }, _splitRoot: function (node, newNode) { @@ -59939,7 +60050,7 @@ // if total distributions margin value is minimal for x, sort by minX, // otherwise it's already sorted by minY - if (xMargin < yMargin) node.children.sort(compareMinX); + if (xMargin < yMargin) { node.children.sort(compareMinX); } }, // total margin of all possible split distributions where each node is at least m full @@ -59983,9 +60094,9 @@ siblings = path[i - 1].children; siblings.splice(siblings.indexOf(path[i]), 1); - } else this.clear(); + } else { this.clear(); } - } else calcBBox$1(path[i], this.toBBox); + } else { calcBBox$1(path[i], this.toBBox); } } }, @@ -60010,10 +60121,10 @@ }; function findItem$1(item, items, equalsFn) { - if (!equalsFn) return items.indexOf(item); + if (!equalsFn) { return items.indexOf(item); } for (var i = 0; i < items.length; i++) { - if (equalsFn(item, items[i])) return i; + if (equalsFn(item, items[i])) { return i; } } return -1; } @@ -60025,7 +60136,7 @@ // min bounding rectangle of node children from k to p-1 function distBBox$1(node, k, p, toBBox, destNode) { - if (!destNode) destNode = createNode$1(null); + if (!destNode) { destNode = createNode$1(null); } destNode.minX = Infinity; destNode.minY = Infinity; destNode.maxX = -Infinity; @@ -60105,7 +60216,7 @@ right = stack.pop(); left = stack.pop(); - if (right - left <= n) continue; + if (right - left <= n) { continue; } mid = left + Math.ceil((right - left) / n / 2) * n; quickselect$1(arr, mid, left, right, compare); @@ -60131,7 +60242,7 @@ part = [], i, a, b, codeB, lastCode; - if (!result) result = []; + if (!result) { result = []; } for (i = 1; i < len; i++) { a = points[i - 1]; @@ -60171,7 +60282,7 @@ codeA = lastCode; } - if (part.length) result.push(part); + if (part.length) { result.push(part); } return result; } @@ -60193,9 +60304,9 @@ inside = !(bitCode$1(p, bbox) & edge); // if segment goes through the clip window, add an intersection - if (inside !== prevInside) result.push(intersect$1(prev, p, edge, bbox)); + if (inside !== prevInside) { result.push(intersect$1(prev, p, edge, bbox)); } - if (inside) result.push(p); // add a point if it's inside + if (inside) { result.push(p); } // add a point if it's inside prev = p; prevInside = inside; @@ -60203,7 +60314,7 @@ points = result; - if (!points.length) break; + if (!points.length) { break; } } return result; @@ -60229,11 +60340,11 @@ function bitCode$1(p, bbox) { var code = 0; - if (p[0] < bbox[0]) code |= 1; // left - else if (p[0] > bbox[2]) code |= 2; // right + if (p[0] < bbox[0]) { code |= 1; } // left + else if (p[0] > bbox[2]) { code |= 2; } // right - if (p[1] < bbox[1]) code |= 4; // bottom - else if (p[1] > bbox[3]) code |= 8; // top + if (p[1] < bbox[1]) { code |= 4; } // bottom + else if (p[1] > bbox[3]) { code |= 8; } // top return code; } @@ -60269,9 +60380,9 @@ for (var i = 0; i < result.length; i++) { if (insidePolygon(result[i].coords, p)) { if (multi) - output.push(result[i].props); + { output.push(result[i].props); } else - return result[i].props; + { return result[i].props; } } } return multi && output.length ? output : null; @@ -60302,9 +60413,9 @@ (bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2 ]; - if (insidePolygon(polygon, bboxCenter)) return true; + if (insidePolygon(polygon, bboxCenter)) { return true; } for (var i = 0; i < polygon.length; i++) { - if (lineclip_1$1(polygon[i], bbox).length > 0) return true; + if (lineclip_1$1(polygon[i], bbox).length > 0) { return true; } } return false; } @@ -60315,7 +60426,7 @@ for (var i = 0, len = rings.length; i < len; i++) { var ring = rings[i]; for (var j = 0, len2 = ring.length, k = len2 - 1; j < len2; k = j++) { - if (rayIntersect(p, ring[j], ring[k])) inside = !inside; + if (rayIntersect(p, ring[j], ring[k])) { inside = !inside; } } } return inside; @@ -60352,11 +60463,11 @@ features: features }; - let borders = rawBorders; - let whichPolygonGetter = {}; - let featuresByCode = {}; - let idFilterRegex = /\bThe\b|\bthe\b|\band\b|\bof\b|[-_ .,()&[\]/]/g; - let levels = [ + var borders = rawBorders; + var whichPolygonGetter = {}; + var featuresByCode = {}; + var idFilterRegex = /\bThe\b|\bthe\b|\band\b|\bof\b|[-_ .,()&[\]/]/g; + var levels = [ 'subterritory', 'territory', 'country', @@ -60368,10 +60479,10 @@ ]; loadDerivedDataAndCaches(borders); function loadDerivedDataAndCaches(borders) { - let identifierProps = ['iso1A2', 'iso1A3', 'm49', 'wikidata', 'emojiFlag', 'nameEn']; - let geometryFeatures = []; - for (let i in borders.features) { - let feature = borders.features[i]; + var identifierProps = ['iso1A2', 'iso1A3', 'm49', 'wikidata', 'emojiFlag', 'nameEn']; + var geometryFeatures = []; + for (var i in borders.features) { + var feature = borders.features[i]; feature.properties.id = feature.properties.iso1A2 || feature.properties.m49; loadM49(feature); loadIsoStatus(feature); @@ -60381,25 +60492,25 @@ loadDriveSide(feature); loadFlag(feature); cacheFeatureByIDs(feature); - if (feature.geometry) geometryFeatures.push(feature); + if (feature.geometry) { geometryFeatures.push(feature); } } - for (let i in borders.features) { - let feature = borders.features[i]; - feature.properties.groups.sort(function(groupID1, groupID2) { + for (var i$1 in borders.features) { + var feature$1 = borders.features[i$1]; + feature$1.properties.groups.sort(function(groupID1, groupID2) { return ( levels.indexOf(featuresByCode[groupID1].properties.level) - levels.indexOf(featuresByCode[groupID2].properties.level) ); }); - loadMembersForGroupsOf(feature); + loadMembersForGroupsOf(feature$1); } - let geometryOnlyCollection = { + var geometryOnlyCollection = { type: 'RegionFeatureCollection', features: geometryFeatures }; whichPolygonGetter = whichPolygon_1(geometryOnlyCollection); function loadGroups(feature) { - let props = feature.properties; + var props = feature.properties; if (!props.groups) { props.groups = []; } @@ -60411,20 +60522,20 @@ } } function loadM49(feature) { - let props = feature.properties; + var props = feature.properties; if (!props.m49 && props.iso1N3) { props.m49 = props.iso1N3; } } function loadIsoStatus(feature) { - let props = feature.properties; + var props = feature.properties; if (!props.isoStatus && props.iso1A2) { props.isoStatus = 'official'; } } function loadLevel(feature) { - let props = feature.properties; - if (props.level) return; + var props = feature.properties; + if (props.level) { return; } if (!props.country) { props.level = 'country'; } else if (props.isoStatus === 'official') { @@ -60434,30 +60545,30 @@ } } function loadRoadSpeedUnit(feature) { - let props = feature.properties; + var props = feature.properties; if (props.roadSpeedUnit === undefined && props.iso1A2 && props.iso1A2 !== 'EU') { props.roadSpeedUnit = 'km/h'; } } function loadDriveSide(feature) { - let props = feature.properties; + var props = feature.properties; if (props.driveSide === undefined && props.iso1A2 && props.iso1A2 !== 'EU') { props.driveSide = 'right'; } } function loadFlag(feature) { - if (!feature.properties.iso1A2) return; - let flag = feature.properties.iso1A2.replace(/./g, function(char) { + if (!feature.properties.iso1A2) { return; } + var flag = feature.properties.iso1A2.replace(/./g, function(char) { return String.fromCodePoint(char.charCodeAt(0) + 127397); }); feature.properties.emojiFlag = flag; } function loadMembersForGroupsOf(feature) { - let featureID = feature.properties.id; - let standardizedGroupIDs = []; - for (let j in feature.properties.groups) { - let groupID = feature.properties.groups[j]; - let groupFeature = featuresByCode[groupID]; + var featureID = feature.properties.id; + var standardizedGroupIDs = []; + for (var j in feature.properties.groups) { + var groupID = feature.properties.groups[j]; + var groupFeature = featuresByCode[groupID]; standardizedGroupIDs.push(groupFeature.properties.id); if (groupFeature.properties.members) { groupFeature.properties.members.push(featureID); @@ -60468,17 +60579,17 @@ feature.properties.groups = standardizedGroupIDs; } function cacheFeatureByIDs(feature) { - for (let k in identifierProps) { - let prop = identifierProps[k]; - let id = prop && feature.properties[prop]; + for (var k in identifierProps) { + var prop = identifierProps[k]; + var id = prop && feature.properties[prop]; if (id) { id = id.replace(idFilterRegex, '').toUpperCase(); featuresByCode[id] = feature; } } if (feature.properties.aliases) { - for (let j in feature.properties.aliases) { - let alias = feature.properties.aliases[j].replace(idFilterRegex, '').toUpperCase(); + for (var j in feature.properties.aliases) { + var alias = feature.properties.aliases[j].replace(idFilterRegex, '').toUpperCase(); featuresByCode[alias] = feature; } } @@ -60493,25 +60604,25 @@ return loc.geometry.coordinates; } function smallestFeature(loc) { - let query = locArray(loc); - let featureProperties = whichPolygonGetter(query); - if (!featureProperties) return null; + var query = locArray(loc); + var featureProperties = whichPolygonGetter(query); + if (!featureProperties) { return null; } return featuresByCode[featureProperties.id]; } function countryFeature(loc) { - let feature = smallestFeature(loc); - if (!feature) return null; - let countryCode = feature.properties.country || feature.properties.iso1A2; + var feature = smallestFeature(loc); + if (!feature) { return null; } + var countryCode = feature.properties.country || feature.properties.iso1A2; return featuresByCode[countryCode]; } function featureForLoc(loc, opts) { if (opts && opts.level && opts.level !== 'country') { - let features = featuresContaining(loc); - let targetLevel = opts.level; - let targetLevelIndex = levels.indexOf(targetLevel); - if (targetLevelIndex === -1) return null; - for (let i in features) { - let feature = features[i]; + var features = featuresContaining(loc); + var targetLevel = opts.level; + var targetLevelIndex = levels.indexOf(targetLevel); + if (targetLevelIndex === -1) { return null; } + for (var i in features) { + var feature = features[i]; if ( feature.properties.level === targetLevel || levels.indexOf(feature.properties.level) > targetLevelIndex @@ -60524,7 +60635,7 @@ return countryFeature(loc); } function featureForID(id) { - let stringID; + var stringID; if (typeof id === 'number') { stringID = id.toString(); if (stringID.length === 1) { @@ -60550,35 +60661,35 @@ return featureForID(query); } function iso1A2Code(query, opts) { - let match = feature(query, opts); - if (!match) return null; + var match = feature(query, opts); + if (!match) { return null; } return match.properties.iso1A2 || null; } function featuresContaining(query, strict) { - let feature = smallestOrMatchingFeature(query); - if (!feature) return []; - let features = []; + var feature = smallestOrMatchingFeature(query); + if (!feature) { return []; } + var features = []; if (!strict || typeof query === 'object') { features.push(feature); } - let properties = feature.properties; - for (let i in properties.groups) { - let groupID = properties.groups[i]; + var properties = feature.properties; + for (var i in properties.groups) { + var groupID = properties.groups[i]; features.push(featuresByCode[groupID]); } return features; } function roadSpeedUnit(query) { - let feature = smallestOrMatchingFeature(query); + var feature = smallestOrMatchingFeature(query); return (feature && feature.properties.roadSpeedUnit) || null; } - let _dataDeprecated; - let _nsi; + var _dataDeprecated; + var _nsi; function validationOutdatedTags() { - const type = 'outdated_tags'; - const nsiKeys = ['amenity', 'shop', 'tourism', 'leisure', 'office']; + var type = 'outdated_tags'; + var nsiKeys = ['amenity', 'shop', 'tourism', 'leisure', 'office']; // A concern here in switching to async data means that `_dataDeprecated` // and `_nsi` will not be available at first, so the data on early tiles @@ -60586,11 +60697,11 @@ // initialize deprecated tags array _mainFileFetcher.get('deprecated') - .then(d => _dataDeprecated = d) - .catch(() => { /* ignore */ }); + .then(function (d) { return _dataDeprecated = d; }) + .catch(function () { /* ignore */ }); _mainFileFetcher.get('nsi_brands') - .then(d => { + .then(function (d) { _nsi = { brands: d.brands, matcher: matcher$1(), @@ -60602,28 +60713,28 @@ _nsi.matcher.buildMatchIndex(d.brands); // index all known wikipedia and wikidata tags - Object.keys(d.brands).forEach(kvnd => { - const brand = d.brands[kvnd]; - const wd = brand.tags['brand:wikidata']; - const wp = brand.tags['brand:wikipedia']; + Object.keys(d.brands).forEach(function (kvnd) { + var brand = d.brands[kvnd]; + var wd = brand.tags['brand:wikidata']; + var wp = brand.tags['brand:wikipedia']; if (wd) { _nsi.wikidata[wd] = kvnd; } if (wp) { _nsi.wikipedia[wp] = kvnd; } }); return _nsi; }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); function oldTagIssues(entity, graph) { - const oldTags = Object.assign({}, entity.tags); // shallow copy - let preset = _mainPresetIndex.match(entity, graph); - let subtype = 'deprecated_tags'; - if (!preset) return []; + var oldTags = Object.assign({}, entity.tags); // shallow copy + var preset = _mainPresetIndex.match(entity, graph); + var subtype = 'deprecated_tags'; + if (!preset) { return []; } // upgrade preset.. if (preset.replacement) { - const newPreset = _mainPresetIndex.item(preset.replacement); + var newPreset = _mainPresetIndex.item(preset.replacement); graph = actionChangePreset(entity.id, preset, newPreset, true /* skip field defaults */)(graph); entity = graph.entity(entity.id); preset = newPreset; @@ -60631,9 +60742,9 @@ // upgrade tags.. if (_dataDeprecated) { - const deprecatedTags = entity.deprecatedTags(_dataDeprecated); + var deprecatedTags = entity.deprecatedTags(_dataDeprecated); if (deprecatedTags.length) { - deprecatedTags.forEach(tag => { + deprecatedTags.forEach(function (tag) { graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph); }); entity = graph.entity(entity.id); @@ -60641,9 +60752,9 @@ } // add missing addTags.. - let newTags = Object.assign({}, entity.tags); // shallow copy + var newTags = Object.assign({}, entity.tags); // shallow copy if (preset.tags !== preset.addTags) { - Object.keys(preset.addTags).forEach(k => { + Object.keys(preset.addTags).forEach(function (k) { if (!newTags[k]) { if (preset.addTags[k] === '*') { newTags[k] = 'yes'; @@ -60657,7 +60768,7 @@ if (_nsi) { // Do `wikidata` or `wikipedia` identify this entity as a brand? #6416 // If so, these tags can be swapped to `brand:wikidata`/`brand:wikipedia` - let isBrand; + var isBrand; if (newTags.wikidata) { // try matching `wikidata` isBrand = _nsi.wikidata[newTags.wikidata]; } @@ -60680,31 +60791,31 @@ // try key/value|name match against name-suggestion-index if (newTags.name) { - for (let i = 0; i < nsiKeys.length; i++) { - const k = nsiKeys[i]; - if (!newTags[k]) continue; + for (var i = 0; i < nsiKeys.length; i++) { + var k = nsiKeys[i]; + if (!newTags[k]) { continue; } - const center = entity.extent(graph).center(); - const countryCode = iso1A2Code(center); - const match = _nsi.matcher.matchKVN(k, newTags[k], newTags.name, countryCode && countryCode.toLowerCase()); - if (!match) continue; + var center = entity.extent(graph).center(); + var countryCode = iso1A2Code(center); + var match = _nsi.matcher.matchKVN(k, newTags[k], newTags.name, countryCode && countryCode.toLowerCase()); + if (!match) { continue; } // for now skip ambiguous matches (like Target~(USA) vs Target~(Australia)) - if (match.d) continue; + if (match.d) { continue; } - const brand = _nsi.brands[match.kvnd]; + var brand = _nsi.brands[match.kvnd]; if (brand && brand.tags['brand:wikidata'] && brand.tags['brand:wikidata'] !== entity.tags['not:brand:wikidata']) { subtype = 'noncanonical_brand'; - const keepTags = ['takeaway'].reduce((acc, k) => { + var keepTags = ['takeaway'].reduce(function (acc, k) { if (newTags[k]) { acc[k] = newTags[k]; } return acc; }, {}); - nsiKeys.forEach(k => delete newTags[k]); + nsiKeys.forEach(function (k) { return delete newTags[k]; }); Object.assign(newTags, brand.tags, keepTags); break; } @@ -60713,12 +60824,12 @@ } // determine diff - const tagDiff = utilTagDiff(oldTags, newTags); - if (!tagDiff.length) return []; + var tagDiff = utilTagDiff(oldTags, newTags); + if (!tagDiff.length) { return []; } - const isOnlyAddingTags = tagDiff.every(d => d.type === '+'); + var isOnlyAddingTags = tagDiff.every(function (d) { return d.type === '+'; }); - let prefix = ''; + var prefix = ''; if (subtype === 'noncanonical_brand') { prefix = 'noncanonical_brand.'; } else if (subtype === 'deprecated_tags' && isOnlyAddingTags) { @@ -60727,7 +60838,7 @@ } // don't allow autofixing brand tags - let autoArgs = subtype !== 'noncanonical_brand' ? [doUpgrade, _t('issues.fix.upgrade_tags.annotation')] : null; + var autoArgs = subtype !== 'noncanonical_brand' ? [doUpgrade, _t('issues.fix.upgrade_tags.annotation')] : null; return [new validationIssue({ type: type, @@ -60737,12 +60848,12 @@ reference: showReference, entityIds: [entity.id], hash: JSON.stringify(tagDiff), - dynamicFixes: () => { + dynamicFixes: function () { return [ new validationIssueFix({ autoArgs: autoArgs, title: _t('issues.fix.upgrade_tags.title'), - onClick: (context) => { + onClick: function (context) { context.perform(doUpgrade, _t('issues.fix.upgrade_tags.annotation')); } }) @@ -60752,11 +60863,11 @@ function doUpgrade(graph) { - const currEntity = graph.hasEntity(entity.id); - if (!currEntity) return graph; + var currEntity = graph.hasEntity(entity.id); + if (!currEntity) { return graph; } - let newTags = Object.assign({}, currEntity.tags); // shallow copy - tagDiff.forEach(diff => { + var newTags = Object.assign({}, currEntity.tags); // shallow copy + tagDiff.forEach(function (diff) { if (diff.type === '-') { delete newTags[diff.key]; } else if (diff.type === '+') { @@ -60769,10 +60880,10 @@ function showMessage(context) { - const currEntity = context.hasEntity(entity.id); - if (!currEntity) return ''; + var currEntity = context.hasEntity(entity.id); + if (!currEntity) { return ''; } - let messageID = `issues.outdated_tags.${prefix}message`; + var messageID = "issues.outdated_tags." + prefix + "message"; if (subtype === 'noncanonical_brand' && isOnlyAddingTags) { messageID += '_incomplete'; } @@ -60781,14 +60892,14 @@ function showReference(selection) { - let enter = selection.selectAll('.issue-reference') + var enter = selection.selectAll('.issue-reference') .data([0]) .enter(); enter .append('div') .attr('class', 'issue-reference') - .text(_t(`issues.outdated_tags.${prefix}reference`)); + .text(_t(("issues.outdated_tags." + prefix + "reference"))); enter .append('strong') @@ -60803,17 +60914,17 @@ .append('tr') .attr('class', 'tagDiff-row') .append('td') - .attr('class', d => { - let klass = d.type === '+' ? 'add' : 'remove'; - return `tagDiff-cell tagDiff-cell-${klass}`; + .attr('class', function (d) { + var klass = d.type === '+' ? 'add' : 'remove'; + return ("tagDiff-cell tagDiff-cell-" + klass); }) - .text(d => d.display); + .text(function (d) { return d.display; }); } } function oldMultipolygonIssues(entity, graph) { - let multipolygon, outerWay; + var multipolygon, outerWay; if (entity.type === 'relation') { outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph); multipolygon = entity; @@ -60824,7 +60935,7 @@ return []; } - if (!multipolygon || !outerWay) return []; + if (!multipolygon || !outerWay) { return []; } return [new validationIssue({ type: type, @@ -60833,12 +60944,12 @@ message: showMessage, reference: showReference, entityIds: [outerWay.id, multipolygon.id], - dynamicFixes: () => { + dynamicFixes: function () { return [ new validationIssueFix({ autoArgs: [doUpgrade, _t('issues.fix.move_tags.annotation')], title: _t('issues.fix.move_tags.title'), - onClick: (context) => { + onClick: function (context) { context.perform(doUpgrade, _t('issues.fix.move_tags.annotation')); } }) @@ -60848,9 +60959,9 @@ function doUpgrade(graph) { - let currMultipolygon = graph.hasEntity(multipolygon.id); - let currOuterWay = graph.hasEntity(outerWay.id); - if (!currMultipolygon || !currOuterWay) return graph; + var currMultipolygon = graph.hasEntity(multipolygon.id); + var currOuterWay = graph.hasEntity(outerWay.id); + if (!currMultipolygon || !currOuterWay) { return graph; } currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags); graph = graph.replace(currMultipolygon); @@ -60859,8 +60970,8 @@ function showMessage(context) { - let currMultipolygon = context.hasEntity(multipolygon.id); - if (!currMultipolygon) return ''; + var currMultipolygon = context.hasEntity(multipolygon.id); + if (!currMultipolygon) { return ''; } return _t('issues.old_multipolygon.message', { multipolygon: utilDisplayLabel(currMultipolygon, context.graph()) } @@ -60879,9 +60990,9 @@ } - let validation = function checkOutdatedTags(entity, graph) { - let issues = oldMultipolygonIssues(entity, graph); - if (!issues.length) issues = oldTagIssues(entity, graph); + var validation = function checkOutdatedTags(entity, graph) { + var issues = oldMultipolygonIssues(entity, graph); + if (!issues.length) { issues = oldTagIssues(entity, graph); } return issues; }; @@ -60929,18 +61040,18 @@ var validation = function checkPrivateData(entity) { var tags = entity.tags; - if (!tags.building || !privateBuildingValues[tags.building]) return []; + if (!tags.building || !privateBuildingValues[tags.building]) { return []; } var keepTags = {}; for (var k in tags) { - if (publicKeys[k]) return []; // probably a public feature + if (publicKeys[k]) { return []; } // probably a public feature if (!personalTags[k]) { keepTags[k] = tags[k]; } } var tagDiff = utilTagDiff(tags, keepTags); - if (!tagDiff.length) return []; + if (!tagDiff.length) { return []; } var fixID = tagDiff.length === 1 ? 'remove_tag' : 'remove_tags'; @@ -60966,7 +61077,7 @@ function doUpgrade(graph) { var currEntity = graph.hasEntity(entity.id); - if (!currEntity) return graph; + if (!currEntity) { return graph; } var newTags = Object.assign({}, currEntity.tags); // shallow copy tagDiff.forEach(function(diff) { @@ -60983,7 +61094,7 @@ function showMessage(context) { var currEntity = context.hasEntity(this.entityIds[0]); - if (!currEntity) return ''; + if (!currEntity) { return ''; } return _t('issues.private_data.contact.message', { feature: utilDisplayLabel(currEntity, context.graph()) } @@ -61028,11 +61139,11 @@ return validation; } - let _discardNameRegexes = []; + var _discardNameRegexes = []; function validationSuspiciousName() { - const type = 'suspicious_name'; - const keysToTestForGenericValues = [ + var type = 'suspicious_name'; + var keysToTestForGenericValues = [ 'aerialway', 'aeroway', 'amenity', 'building', 'craft', 'highway', 'leisure', 'railway', 'man_made', 'office', 'shop', 'tourism', 'waterway' ]; @@ -61041,23 +61152,23 @@ // be available at first, so the data on early tiles may not have tags validated fully. _mainFileFetcher.get('nsi_filters') - .then(filters => { + .then(function (filters) { // known list of generic names (e.g. "bar") _discardNameRegexes = filters.discardNames - .map(discardName => new RegExp(discardName, 'i')); + .map(function (discardName) { return new RegExp(discardName, 'i'); }); }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); function isDiscardedSuggestionName(lowercaseName) { - return _discardNameRegexes.some(regex => regex.test(lowercaseName)); + return _discardNameRegexes.some(function (regex) { return regex.test(lowercaseName); }); } // test if the name is just the key or tag value (e.g. "park") function nameMatchesRawTag(lowercaseName, tags) { - for (let i = 0; i < keysToTestForGenericValues.length; i++) { - let key = keysToTestForGenericValues[i]; - let val = tags[key]; + for (var i = 0; i < keysToTestForGenericValues.length; i++) { + var key = keysToTestForGenericValues[i]; + var val = tags[key]; if (val) { val = val.toLowerCase(); if (key === lowercaseName || @@ -61082,10 +61193,10 @@ subtype: 'generic_name', severity: 'warning', message: function(context) { - let entity = context.hasEntity(this.entityIds[0]); - if (!entity) return ''; - let preset = _mainPresetIndex.match(entity, context.graph()); - let langName = langCode && _mainLocalizer.languageName(langCode); + var entity = context.hasEntity(this.entityIds[0]); + if (!entity) { return ''; } + var preset = _mainPresetIndex.match(entity, context.graph()); + var langName = langCode && _mainLocalizer.languageName(langCode); return _t('issues.generic_name.message' + (langName ? '_language' : ''), { feature: preset.name(), name: genericName, language: langName } ); @@ -61099,9 +61210,9 @@ icon: 'iD-operation-delete', title: _t('issues.fix.remove_the_name.title'), onClick: function(context) { - let entityId = this.issue.entityIds[0]; - let entity = context.entity(entityId); - let tags = Object.assign({}, entity.tags); // shallow copy + var entityId = this.issue.entityIds[0]; + var entity = context.entity(entityId); + var tags = Object.assign({}, entity.tags); // shallow copy delete tags[nameKey]; context.perform( actionChangeTags(entityId, tags), _t('issues.fix.remove_generic_name.annotation') @@ -61128,10 +61239,10 @@ subtype: 'not_name', severity: 'warning', message: function(context) { - const entity = context.hasEntity(this.entityIds[0]); - if (!entity) return ''; - const preset = _mainPresetIndex.match(entity, context.graph()); - const langName = langCode && _mainLocalizer.languageName(langCode); + var entity = context.hasEntity(this.entityIds[0]); + if (!entity) { return ''; } + var preset = _mainPresetIndex.match(entity, context.graph()); + var langName = langCode && _mainLocalizer.languageName(langCode); return _t('issues.incorrect_name.message' + (langName ? '_language' : ''), { feature: preset.name(), name: incorrectName, language: langName } ); @@ -61145,9 +61256,9 @@ icon: 'iD-operation-delete', title: _t('issues.fix.remove_the_name.title'), onClick: function(context) { - const entityId = this.issue.entityIds[0]; - const entity = context.entity(entityId); - let tags = Object.assign({}, entity.tags); // shallow copy + var entityId = this.issue.entityIds[0]; + var entity = context.entity(entityId); + var tags = Object.assign({}, entity.tags); // shallow copy delete tags[nameKey]; context.perform( actionChangeTags(entityId, tags), _t('issues.fix.remove_mistaken_name.annotation') @@ -61169,22 +61280,22 @@ } - let validation = function checkGenericName(entity) { + var validation = function checkGenericName(entity) { // a generic name is okay if it's a known brand or entity - if (entity.hasWikidata()) return []; + if (entity.hasWikidata()) { return []; } - let issues = []; - const notNames = (entity.tags['not:name'] || '').split(';'); + var issues = []; + var notNames = (entity.tags['not:name'] || '').split(';'); - for (let key in entity.tags) { - const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/); - if (!m) continue; + for (var key in entity.tags) { + var m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/); + if (!m) { continue; } - const langCode = m.length >= 2 ? m[1] : null; - const value = entity.tags[key]; + var langCode = m.length >= 2 ? m[1] : null; + var value = entity.tags[key]; if (notNames.length) { - for (let i in notNames) { - const notName = notNames[i]; + for (var i in notNames) { + var notName = notNames[i]; if (notName && value === notName) { issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode)); continue; @@ -61214,34 +61325,34 @@ var nodeThreshold = 10; function isBuilding(entity, graph) { - if (entity.type !== 'way' || entity.geometry(graph) !== 'area') return false; + if (entity.type !== 'way' || entity.geometry(graph) !== 'area') { return false; } return entity.tags.building && entity.tags.building !== 'no'; } var validation = function checkUnsquareWay(entity, graph) { - if (!isBuilding(entity, graph)) return []; + if (!isBuilding(entity, graph)) { return []; } // don't flag ways marked as physically unsquare - if (entity.tags.nonsquare === 'yes') return []; + if (entity.tags.nonsquare === 'yes') { return []; } var isClosed = entity.isClosed(); - if (!isClosed) return []; // this building has bigger problems + if (!isClosed) { return []; } // this building has bigger problems // don't flag ways with lots of nodes since they are likely detail-mapped var nodes = graph.childNodes(entity).slice(); // shallow copy - if (nodes.length > nodeThreshold + 1) return []; // +1 because closing node appears twice + if (nodes.length > nodeThreshold + 1) { return []; } // +1 because closing node appears twice // ignore if not all nodes are fully downloaded var osm = services.osm; - if (!osm || nodes.some(function(node) { return !osm.isDataLoaded(node.loc); })) return []; + if (!osm || nodes.some(function(node) { return !osm.isDataLoaded(node.loc); })) { return []; } // don't flag connected ways to avoid unresolvable unsquare loops var hasConnectedSquarableWays = nodes.some(function(node) { return graph.parentWays(node).some(function(way) { - if (way.id === entity.id) return false; - if (isBuilding(way, graph)) return true; + if (way.id === entity.id) { return false; } + if (isBuilding(way, graph)) { return true; } return graph.parentRelations(way).some(function(parentRelation) { return parentRelation.isMultipolygon() && parentRelation.tags.building && @@ -61249,7 +61360,7 @@ }); }); }); - if (hasConnectedSquarableWays) return []; + if (hasConnectedSquarableWays) { return []; } // user-configurable square threshold @@ -61257,7 +61368,7 @@ var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold); var points = nodes.map(function(node) { return context.projection(node.loc); }); - if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon, degreeThreshold, true)) return []; + if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon, degreeThreshold, true)) { return []; } var autoArgs; // don't allow autosquaring features linked to wikidata @@ -61295,23 +61406,7 @@ // run after the squaring transition (currently 150ms) window.setTimeout(function() { completionHandler(); }, 175); } - }), - /* - new validationIssueFix({ - title: t('issues.fix.tag_as_unsquare.title'), - onClick: function(context) { - var entityId = this.issue.entityIds[0]; - var entity = context.entity(entityId); - var tags = Object.assign({}, entity.tags); // shallow copy - tags.nonsquare = 'yes'; - context.perform( - actionChangeTags(entityId, tags), - t('issues.fix.tag_as_unsquare.annotation') - ); - } - }) - */ - ]; + }) ]; } })]; @@ -61368,7 +61463,7 @@ // validator.init = function() { Object.values(Validations).forEach(function(validation) { - if (typeof validation !== 'function') return; + if (typeof validation !== 'function') { return; } var fn = validation(context); var key = fn.type; @@ -61418,7 +61513,7 @@ function reloadUnsquareIssues(cache, graph) { var checkUnsquareWay = _rules.unsquare_way; - if (typeof checkUnsquareWay !== 'function') return; + if (typeof checkUnsquareWay !== 'function') { return; } // uncache existing cache.uncacheIssuesOfType('unsquare_way'); @@ -61431,7 +61526,7 @@ // rerun for all buildings buildings.forEach(function(entity) { var detected = checkUnsquareWay(entity, graph); - if (detected.length !== 1) return; + if (detected.length !== 1) { return; } var issue = detected[0]; if (!cache.issuesByEntityID[entity.id]) { cache.issuesByEntityID[entity.id] = new Set(); @@ -61453,12 +61548,12 @@ var view = context.map().extent(); return issues.filter(function(issue) { - if (!issue) return false; - if (opts.includeDisabledRules === 'only' && !_disabledRules[issue.type]) return false; - if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false; + if (!issue) { return false; } + if (opts.includeDisabledRules === 'only' && !_disabledRules[issue.type]) { return false; } + if (!opts.includeDisabledRules && _disabledRules[issue.type]) { return false; } - if (opts.includeIgnored === 'only' && !_ignoredIssueIDs[issue.id]) return false; - if (!opts.includeIgnored && _ignoredIssueIDs[issue.id]) return false; + if (opts.includeIgnored === 'only' && !_ignoredIssueIDs[issue.id]) { return false; } + if (!opts.includeIgnored && _ignoredIssueIDs[issue.id]) { return false; } // Sanity check: This issue may be for an entity that not longer exists. // If we detect this, uncache and return false so it is not included.. @@ -61472,11 +61567,11 @@ } } - if (opts.what === 'edited' && _baseCache.issuesByIssueID[issue.id]) return false; + if (opts.what === 'edited' && _baseCache.issuesByIssueID[issue.id]) { return false; } if (opts.where === 'visible') { var extent = issue.extent(context.graph()); - if (!view.intersects(extent)) return false; + if (!view.intersects(extent)) { return false; } } return true; @@ -61538,7 +61633,7 @@ if (!acc) { return new Set(entityIssueIDs); } - return new Set([...acc].filter(function(elem) { + return new Set([].concat( acc ).filter(function(elem) { return entityIssueIDs.has(elem); })); }, null) || []; @@ -61548,12 +61643,12 @@ return Array.from(issueIDs) .map(function(id) { return cache.issuesByIssueID[id]; }) .filter(function(issue) { - if (!issue) return false; - if (opts.includeDisabledRules === 'only' && !_disabledRules[issue.type]) return false; - if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false; + if (!issue) { return false; } + if (opts.includeDisabledRules === 'only' && !_disabledRules[issue.type]) { return false; } + if (!opts.includeDisabledRules && _disabledRules[issue.type]) { return false; } - if (opts.includeIgnored === 'only' && !_ignoredIssueIDs[issue.id]) return false; - if (!opts.includeIgnored && _ignoredIssueIDs[issue.id]) return false; + if (opts.includeIgnored === 'only' && !_ignoredIssueIDs[issue.id]) { return false; } + if (!opts.includeIgnored && _ignoredIssueIDs[issue.id]) { return false; } return true; }).sort(function(issue1, issue2) { @@ -61650,11 +61745,11 @@ return entityIDs.reduce(function(acc, entityID) { // keep redundancy check separate from `acc` because an `entityID` // could have been added to `acc` as a related entity through an earlier pass - if (processedIDs.has(entityID)) return acc; + if (processedIDs.has(entityID)) { return acc; } processedIDs.add(entityID); var entity = graph.hasEntity(entityID); - if (!entity) return acc; + if (!entity) { return acc; } acc.add(entityID); @@ -61704,7 +61799,7 @@ entityIDs.forEach(function(entityID) { var entity = graph.hasEntity(entityID); // don't validate deleted entities - if (!entity) return; + if (!entity) { return; } var issues = validateEntity(entity, graph); cache.cacheIssues(issues); @@ -61762,7 +61857,7 @@ // When merging fetched data: context.history() .on('merge.validator', function(entities) { - if (!entities) return; + if (!entities) { return; } var handle = window.requestIdleCallback(function() { var entityIDs = entities.map(function(entity) { return entity.id; }); var headGraph = context.graph(); @@ -61828,7 +61923,7 @@ // cache.uncacheEntityID = function(entityID) { var issueIDs = cache.issuesByEntityID[entityID]; - if (!issueIDs) return; + if (!issueIDs) { return; } issueIDs.forEach(function(issueID) { var issue = cache.issuesByIssueID[issueID]; @@ -61886,7 +61981,7 @@ } var osm = context.connection(); - if (!osm) return; + if (!osm) { return; } // If user somehow got logged out mid-save, try to reauthenticate.. // This can happen if they were logged in from before, but the tokens are no longer valid. @@ -61934,7 +62029,7 @@ function performFullConflictCheck(changeset) { var osm = context.connection(); - if (!osm) return; + if (!osm) { return; } var history = context.history(); @@ -61969,7 +62064,7 @@ var s = new Set(ids); ids.forEach(function(id) { var entity = graph.entity(id); - if (entity.type !== 'way') return; + if (entity.type !== 'way') { return; } graph.childNodes(entity).forEach(function(child) { if (child.version !== undefined) { @@ -61984,7 +62079,7 @@ // Reload modified entities into an alternate graph and check for conflicts.. function loaded(err, result) { - if (_errors.length) return; + if (_errors.length) { return; } if (err) { _errors.push({ @@ -62001,7 +62096,7 @@ _loaded[entity.id] = true; _toLoad = _toLoad.filter(function(val) { return val !== entity.id; }); - if (!entity.visible) return; + if (!entity.visible) { return; } // Because loadMultiple doesn't download /full like loadEntity, // need to also load children that aren't already being checked.. @@ -62060,14 +62155,14 @@ } function sameVersions(local, remote) { - if (local.version !== remote.version) return false; + if (local.version !== remote.version) { return false; } if (local.type === 'way') { var children = utilArrayUnion(local.nodes, remote.nodes); for (var i = 0; i < children.length; i++) { var a = localGraph.hasEntity(children[i]); var b = remoteGraph.hasEntity(children[i]); - if (a && b && a.version !== b.version) return false; + if (a && b && a.version !== b.version) { return false; } } } @@ -62078,14 +62173,14 @@ var local = localGraph.entity(id); var remote = remoteGraph.entity(id); - if (sameVersions(local, remote)) return; + if (sameVersions(local, remote)) { return; } var merge = actionMergeRemoteChanges(id, localGraph, remoteGraph, _discardTags, formatUser); history.replace(merge); var mergeConflicts = merge.conflicts(); - if (!mergeConflicts.length) return; // merged safely + if (!mergeConflicts.length) { return; } // merged safely var forceLocal = actionMergeRemoteChanges(id, localGraph, remoteGraph, _discardTags).withOption('force_local'); var forceRemote = actionMergeRemoteChanges(id, localGraph, remoteGraph, _discardTags).withOption('force_remote'); @@ -62242,21 +62337,17 @@ var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2; // listen for DPI change, e.g. when dragging a browser window from a retina to non-retina screen - window.matchMedia(` - (-webkit-min-device-pixel-ratio: 2), /* Safari */ - (min-resolution: 2dppx), /* standard */ - (min-resolution: 192dpi) /* fallback */ - `).addListener(function() { + window.matchMedia("\n (-webkit-min-device-pixel-ratio: 2), /* Safari */\n (min-resolution: 2dppx), /* standard */\n (min-resolution: 192dpi) /* fallback */\n ").addListener(function() { isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2; }); function localeDateString(s) { - if (!s) return null; + if (!s) { return null; } var options = { day: 'numeric', month: 'short', year: 'numeric' }; var d = new Date(s); - if (isNaN(d.getTime())) return null; + if (isNaN(d.getTime())) { return null; } return d.toLocaleDateString(_mainLocalizer.localeCode(), options); } @@ -62285,7 +62376,7 @@ source.overzoom = data.overzoom !== false; source.offset = function(val) { - if (!arguments.length) return _offset; + if (!arguments.length) { return _offset; } _offset = val; return source; }; @@ -62316,7 +62407,7 @@ source.area = function() { - if (!data.polygon) return Number.MAX_VALUE; // worldwide + if (!data.polygon) { return Number.MAX_VALUE; } // worldwide var area = d3_geoArea({ type: 'MultiPolygon', coordinates: [ data.polygon ] }); return isNaN(area) ? 0 : area; }; @@ -62328,7 +62419,7 @@ source.template = function(val) { - if (!arguments.length) return _template; + if (!arguments.length) { return _template; } if (source.id === 'custom') { _template = val; } @@ -62338,7 +62429,7 @@ source.url = function(coord) { var result = _template; - if (result === '') return result; // source 'none' + if (result === '') { return result; } // source 'none' // Guess a type based on the tokens present in the template @@ -62428,8 +62519,8 @@ for (var zoom = coord[2]; zoom > 0; zoom--) { var b = 0; var mask = 1 << (zoom - 1); - if ((coord[0] & mask) !== 0) b++; - if ((coord[1] & mask) !== 0) b += 2; + if ((coord[0] & mask) !== 0) { b++; } + if ((coord[1] & mask) !== 0) { b += 2; } u += b.toString(); } return u; @@ -62541,7 +62632,7 @@ var url = 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial/' + centerPoint + '?zl=' + zoom + '&key=' + key; - if (inflight[tileID]) return; + if (inflight[tileID]) { return; } if (!cache[tileID]) { cache[tileID] = {}; @@ -62565,11 +62656,11 @@ var metadata = { vintage: vintage }; cache[tileID].metadata = metadata; - if (callback) callback(null, metadata); + if (callback) { callback(null, metadata); } }) .catch(function(err) { delete inflight[tileID]; - if (callback) callback(err.message); + if (callback) { callback(err.message); } }); }; @@ -62597,7 +62688,7 @@ // https://developers.arcgis.com/documentation/tiled-elevation-service/ esri.fetchTilemap = function(center) { // skip if we have already fetched a tilemap within 5km - if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5000) return; + if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5000) { return; } _prevCenter = center; // tiles are available globally to zoom level 19, afterward they may or may not be present @@ -62646,7 +62737,7 @@ var vintage = {}; var metadata = {}; - if (inflight[tileID]) return; + if (inflight[tileID]) { return; } switch (true) { case (zoom >= 20 && esri.id === 'EsriWorldImageryClarity'): @@ -62736,11 +62827,11 @@ } cache[tileID].metadata = metadata; - if (callback) callback(null, metadata); + if (callback) { callback(null, metadata); } }) .catch(function(err) { delete inflight[tileID]; - if (callback) callback(err.message); + if (callback) { callback(err.message); } }); } @@ -62911,7 +63002,7 @@ // Important that this part not depend on `_projection` because it's // rentered when tiles load/error (see #644). function render(selection) { - if (!_source) return; + if (!_source) { return; } var requests = []; var showDebug = context.getDebug('tile') && !_source.overlay; @@ -62920,8 +63011,8 @@ tiler().forEach(function(d) { addSource(d); - if (d[3] === '') return; - if (typeof d[3] !== 'string') return; // Workaround for #2295 + if (d[3] === '') { return; } + if (typeof d[3] !== 'string') { return; } // Workaround for #2295 requests.push(d); if (_cache[d[3]] === false && lookUp(d)) { requests.push(addSource(lookUp(d))); @@ -63070,21 +63161,21 @@ background.projection = function(val) { - if (!arguments.length) return _projection; + if (!arguments.length) { return _projection; } _projection = val; return background; }; background.dimensions = function(val) { - if (!arguments.length) return tiler.size(); + if (!arguments.length) { return tiler.size(); } tiler.size(val); return background; }; background.source = function(val) { - if (!arguments.length) return _source; + if (!arguments.length) { return _source; } _source = val; _tileSize = _source.tileSize; _cache = {}; @@ -63096,24 +63187,24 @@ return background; } - let _imageryIndex = null; + var _imageryIndex = null; function rendererBackground(context) { - const dispatch$1 = dispatch('change'); - const detected = utilDetect(); - const baseLayer = rendererTileLayer(context).projection(context.projection); - let _isValid = true; - let _overlayLayers = []; - let _brightness = 1; - let _contrast = 1; - let _saturation = 1; - let _sharpness = 1; + var dispatch$1 = dispatch('change'); + var detected = utilDetect(); + var baseLayer = rendererTileLayer(context).projection(context.projection); + var _isValid = true; + var _overlayLayers = []; + var _brightness = 1; + var _contrast = 1; + var _saturation = 1; + var _sharpness = 1; function ensureImageryIndex() { return _mainFileFetcher.get('imagery') - .then(sources => { - if (_imageryIndex) return _imageryIndex; + .then(function (sources) { + if (_imageryIndex) { return _imageryIndex; } _imageryIndex = { imagery: sources, @@ -63121,16 +63212,16 @@ }; // use which-polygon to support efficient index and querying for imagery - const features = sources.map(source => { - if (!source.polygon) return null; + var features = sources.map(function (source) { + if (!source.polygon) { return null; } // workaround for editor-layer-index weirdness.. // Add an extra array nest to each element in `source.polygon` // so the rings are not treated as a bunch of holes: // what we have: [ [[outer],[hole],[hole]] ] // what we want: [ [[outer]],[[outer]],[[outer]] ] - const rings = source.polygon.map(ring => [ring]); + var rings = source.polygon.map(function (ring) { return [ring]; }); - const feature = { + var feature = { type: 'Feature', properties: { id: source.id }, geometry: { type: 'MultiPolygon', coordinates: rings } @@ -63145,7 +63236,7 @@ // Instantiate `rendererBackgroundSource` objects for each source - _imageryIndex.backgrounds = sources.map(source => { + _imageryIndex.backgrounds = sources.map(function (source) { if (source.type === 'bing') { return rendererBackgroundSource.Bing(source, dispatch$1); } else if (/^EsriWorldImagery/.test(source.id)) { @@ -63159,8 +63250,8 @@ _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None()); // Add 'Custom' - let template = corePreferences('background-custom-template') || ''; - const custom = rendererBackgroundSource.Custom(template); + var template = corePreferences('background-custom-template') || ''; + var custom = rendererBackgroundSource.Custom(template); _imageryIndex.backgrounds.unshift(custom); return _imageryIndex; @@ -63169,45 +63260,45 @@ function background(selection) { - const currSource = baseLayer.source(); + var currSource = baseLayer.source(); // If we are displaying an Esri basemap at high zoom, // check its tilemap to see how high the zoom can go if (context.map().zoom() > 18) { if (currSource && /^EsriWorldImagery/.test(currSource.id)) { - const center = context.map().center(); + var center = context.map().center(); currSource.fetchTilemap(center); } } // Is the imagery valid here? - #4827 - const sources = background.sources(context.map().extent()); - const wasValid = _isValid; - _isValid = !!sources.filter(d => d === currSource).length; + var sources = background.sources(context.map().extent()); + var wasValid = _isValid; + _isValid = !!sources.filter(function (d) { return d === currSource; }).length; if (wasValid !== _isValid) { // change in valid status background.updateImagery(); } - let baseFilter = ''; + var baseFilter = ''; if (detected.cssfilters) { if (_brightness !== 1) { - baseFilter += ` brightness(${_brightness})`; + baseFilter += " brightness(" + _brightness + ")"; } if (_contrast !== 1) { - baseFilter += ` contrast(${_contrast})`; + baseFilter += " contrast(" + _contrast + ")"; } if (_saturation !== 1) { - baseFilter += ` saturate(${_saturation})`; + baseFilter += " saturate(" + _saturation + ")"; } if (_sharpness < 1) { // gaussian blur - const blur = d3_interpolateNumber(0.5, 5)(1 - _sharpness); - baseFilter += ` blur(${blur}px)`; + var blur = d3_interpolateNumber(0.5, 5)(1 - _sharpness); + baseFilter += " blur(" + blur + "px)"; } } - let base = selection.selectAll('.layer-background') + var base = selection.selectAll('.layer-background') .data([0]); base = base.enter() @@ -63222,7 +63313,7 @@ } - let imagery = base.selectAll('.layer-imagery') + var imagery = base.selectAll('.layer-imagery') .data([0]); imagery.enter() @@ -63232,20 +63323,20 @@ .call(baseLayer); - let maskFilter = ''; - let mixBlendMode = ''; + var maskFilter = ''; + var mixBlendMode = ''; if (detected.cssfilters && _sharpness > 1) { // apply unsharp mask mixBlendMode = 'overlay'; maskFilter = 'saturate(0) blur(3px) invert(1)'; - let contrast = _sharpness - 1; - maskFilter += ` contrast(${contrast})`; + var contrast = _sharpness - 1; + maskFilter += " contrast(" + contrast + ")"; - let brightness = d3_interpolateNumber(1, 0.85)(_sharpness - 1); - maskFilter += ` brightness(${brightness})`; + var brightness = d3_interpolateNumber(1, 0.85)(_sharpness - 1); + maskFilter += " brightness(" + brightness + ")"; } - let mask = base.selectAll('.layer-unsharp-mask') + var mask = base.selectAll('.layer-unsharp-mask') .data(detected.cssfilters && _sharpness > 1 ? [0] : []); mask.exit() @@ -63260,8 +63351,8 @@ .style('mix-blend-mode', mixBlendMode || null); - let overlays = selection.selectAll('.layer-overlay') - .data(_overlayLayers, d => d.source().name()); + var overlays = selection.selectAll('.layer-overlay') + .data(_overlayLayers, function (d) { return d.source().name(); }); overlays.exit() .remove(); @@ -63270,28 +63361,28 @@ .insert('div', '.layer-data') .attr('class', 'layer layer-overlay') .merge(overlays) - .each((layer, i, nodes) => select(nodes[i]).call(layer)); + .each(function (layer, i, nodes) { return select(nodes[i]).call(layer); }); } background.updateImagery = function() { - let currSource = baseLayer.source(); - if (context.inIntro() || !currSource) return; + var currSource = baseLayer.source(); + if (context.inIntro() || !currSource) { return; } - let o = _overlayLayers - .filter(d => !d.source().isLocatorOverlay() && !d.source().isHidden()) - .map(d => d.source().id) + var o = _overlayLayers + .filter(function (d) { return !d.source().isLocatorOverlay() && !d.source().isHidden(); }) + .map(function (d) { return d.source().id; }) .join(','); - const meters = geoOffsetToMeters(currSource.offset()); - const EPSILON = 0.01; - const x = +meters[0].toFixed(2); - const y = +meters[1].toFixed(2); - let hash = utilStringQs(window.location.hash); + var meters = geoOffsetToMeters(currSource.offset()); + var EPSILON = 0.01; + var x = +meters[0].toFixed(2); + var y = +meters[1].toFixed(2); + var hash = utilStringQs(window.location.hash); - let id = currSource.id; + var id = currSource.id; if (id === 'custom') { - id = `custom:${currSource.template()}`; + id = "custom:" + (currSource.template()); } if (id) { @@ -63307,7 +63398,7 @@ } if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) { - hash.offset = `${x},${y}`; + hash.offset = x + "," + y; } else { delete hash.offset; } @@ -63316,24 +63407,24 @@ window.location.replace('#' + utilQsString(hash, true)); } - let imageryUsed = []; - let photoOverlaysUsed = []; + var imageryUsed = []; + var photoOverlaysUsed = []; - const currUsed = currSource.imageryUsed(); + var currUsed = currSource.imageryUsed(); if (currUsed && _isValid) { imageryUsed.push(currUsed); } _overlayLayers - .filter(d => !d.source().isLocatorOverlay() && !d.source().isHidden()) - .forEach(d => imageryUsed.push(d.source().imageryUsed())); + .filter(function (d) { return !d.source().isLocatorOverlay() && !d.source().isHidden(); }) + .forEach(function (d) { return imageryUsed.push(d.source().imageryUsed()); }); - const dataLayer = context.layers().layer('data'); + var dataLayer = context.layers().layer('data'); if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) { imageryUsed.push(dataLayer.getSrc()); } - const photoOverlayLayers = { + var photoOverlayLayers = { streetside: 'Bing Streetside', mapillary: 'Mapillary Images', 'mapillary-map-features': 'Mapillary Map Features', @@ -63341,8 +63432,8 @@ openstreetcam: 'OpenStreetCam Images' }; - for (let layerID in photoOverlayLayers) { - const layer = context.layers().layer(layerID); + for (var layerID in photoOverlayLayers) { + var layer = context.layers().layer(layerID); if (layer && layer.enabled()) { photoOverlaysUsed.push(layerID); imageryUsed.push(photoOverlayLayers[layerID]); @@ -63354,50 +63445,50 @@ }; - background.sources = (extent, zoom, includeCurrent) => { - if (!_imageryIndex) return []; // called before init()? + background.sources = function (extent, zoom, includeCurrent) { + if (!_imageryIndex) { return []; } // called before init()? - let visible = {}; + var visible = {}; (_imageryIndex.query.bbox(extent.rectangle(), true) || []) - .forEach(d => visible[d.id] = true); + .forEach(function (d) { return visible[d.id] = true; }); - const currSource = baseLayer.source(); + var currSource = baseLayer.source(); - return _imageryIndex.backgrounds.filter(source => { - if (!source.polygon) return true; // always include imagery with worldwide coverage - if (includeCurrent && currSource === source) return true; // optionally include the current imagery - if (zoom && zoom < 6) return false; // optionally exclude local imagery at low zooms + return _imageryIndex.backgrounds.filter(function (source) { + if (!source.polygon) { return true; } // always include imagery with worldwide coverage + if (includeCurrent && currSource === source) { return true; } // optionally include the current imagery + if (zoom && zoom < 6) { return false; } // optionally exclude local imagery at low zooms return visible[source.id]; // include imagery visible in given extent }); }; - background.dimensions = (val) => { - if (!val) return; + background.dimensions = function (val) { + if (!val) { return; } baseLayer.dimensions(val); - _overlayLayers.forEach(layer => layer.dimensions(val)); + _overlayLayers.forEach(function (layer) { return layer.dimensions(val); }); }; background.baseLayerSource = function(d) { - if (!arguments.length) return baseLayer.source(); + if (!arguments.length) { return baseLayer.source(); } // test source against OSM imagery blacklists.. - const osm = context.connection(); - if (!osm) return background; + var osm = context.connection(); + if (!osm) { return background; } - const blacklists = osm.imageryBlacklists(); - const template = d.template(); - let fail = false; - let tested = 0; - let regex; + var blacklists = osm.imageryBlacklists(); + var template = d.template(); + var fail = false; + var tested = 0; + var regex; - for (let i = 0; i < blacklists.length; i++) { + for (var i = 0; i < blacklists.length; i++) { try { regex = new RegExp(blacklists[i]); fail = regex.test(template); tested++; - if (fail) break; + if (fail) { break; } } catch (e) { /* noop */ } @@ -63416,32 +63507,32 @@ }; - background.findSource = (id) => { - if (!id || !_imageryIndex) return null; // called before init()? - return _imageryIndex.backgrounds.find(d => d.id && d.id === id); + background.findSource = function (id) { + if (!id || !_imageryIndex) { return null; } // called before init()? + return _imageryIndex.backgrounds.find(function (d) { return d.id && d.id === id; }); }; - background.bing = () => { + background.bing = function () { background.baseLayerSource(background.findSource('Bing')); }; - background.showsLayer = (d) => { - const currSource = baseLayer.source(); - if (!d || !currSource) return false; - return d.id === currSource.id || _overlayLayers.some(layer => d.id === layer.source().id); + background.showsLayer = function (d) { + var currSource = baseLayer.source(); + if (!d || !currSource) { return false; } + return d.id === currSource.id || _overlayLayers.some(function (layer) { return d.id === layer.source().id; }); }; - background.overlayLayerSources = () => { - return _overlayLayers.map(layer => layer.source()); + background.overlayLayerSources = function () { + return _overlayLayers.map(function (layer) { return layer.source(); }); }; - background.toggleOverlayLayer = (d) => { - let layer; - for (let i = 0; i < _overlayLayers.length; i++) { + background.toggleOverlayLayer = function (d) { + var layer; + for (var i = 0; i < _overlayLayers.length; i++) { layer = _overlayLayers[i]; if (layer.source() === d) { _overlayLayers.splice(i, 1); @@ -63463,8 +63554,8 @@ }; - background.nudge = (d, zoom) => { - const currSource = baseLayer.source(); + background.nudge = function (d, zoom) { + var currSource = baseLayer.source(); if (currSource) { currSource.nudge(d, zoom); dispatch$1.call('change'); @@ -63475,7 +63566,7 @@ background.offset = function(d) { - const currSource = baseLayer.source(); + var currSource = baseLayer.source(); if (!arguments.length) { return (currSource && currSource.offset()) || [0, 0]; } @@ -63489,66 +63580,66 @@ background.brightness = function(d) { - if (!arguments.length) return _brightness; + if (!arguments.length) { return _brightness; } _brightness = d; - if (context.mode()) dispatch$1.call('change'); + if (context.mode()) { dispatch$1.call('change'); } return background; }; background.contrast = function(d) { - if (!arguments.length) return _contrast; + if (!arguments.length) { return _contrast; } _contrast = d; - if (context.mode()) dispatch$1.call('change'); + if (context.mode()) { dispatch$1.call('change'); } return background; }; background.saturation = function(d) { - if (!arguments.length) return _saturation; + if (!arguments.length) { return _saturation; } _saturation = d; - if (context.mode()) dispatch$1.call('change'); + if (context.mode()) { dispatch$1.call('change'); } return background; }; background.sharpness = function(d) { - if (!arguments.length) return _sharpness; + if (!arguments.length) { return _sharpness; } _sharpness = d; - if (context.mode()) dispatch$1.call('change'); + if (context.mode()) { dispatch$1.call('change'); } return background; }; - let _loadPromise; + var _loadPromise; - background.ensureLoaded = () => { + background.ensureLoaded = function () { - if (_loadPromise) return _loadPromise; + if (_loadPromise) { return _loadPromise; } function parseMapParams(qmap) { - if (!qmap) return false; - const params = qmap.split('/').map(Number); - if (params.length < 3 || params.some(isNaN)) return false; + if (!qmap) { return false; } + var params = qmap.split('/').map(Number); + if (params.length < 3 || params.some(isNaN)) { return false; } return geoExtent([params[2], params[1]]); // lon,lat } - const hash = utilStringQs(window.location.hash); - const requested = hash.background || hash.layer; - let extent = parseMapParams(hash.map); + var hash = utilStringQs(window.location.hash); + var requested = hash.background || hash.layer; + var extent = parseMapParams(hash.map); return _loadPromise = ensureImageryIndex() - .then(imageryIndex => { - const first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0]; + .then(function (imageryIndex) { + var first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0]; - let best; + var best; if (!requested && extent) { - best = background.sources(extent).find(s => s.best()); + best = background.sources(extent).find(function (s) { return s.best(); }); } // Decide which background layer to display if (requested && requested.indexOf('custom:') === 0) { - const template = requested.replace(/^custom:/, ''); - const custom = background.findSource('custom'); + var template = requested.replace(/^custom:/, ''); + var custom = background.findSource('custom'); background.baseLayerSource(custom.template(template)); corePreferences('background-custom-template', template); } else { @@ -63562,13 +63653,13 @@ ); } - const locator = imageryIndex.backgrounds.find(d => d.overlay && d.default); + var locator = imageryIndex.backgrounds.find(function (d) { return d.overlay && d.default; }); if (locator) { background.toggleOverlayLayer(locator); } - const overlays = (hash.overlays || '').split(','); - overlays.forEach(overlay => { + var overlays = (hash.overlays || '').split(','); + overlays.forEach(function (overlay) { overlay = background.findSource(overlay); if (overlay) { background.toggleOverlayLayer(overlay); @@ -63576,24 +63667,24 @@ }); if (hash.gpx) { - const gpx = context.layers().layer('data'); + var gpx = context.layers().layer('data'); if (gpx) { gpx.url(hash.gpx, '.gpx'); } } if (hash.offset) { - const offset = hash.offset + var offset = hash.offset .replace(/;/g, ',') .split(',') - .map(n => !isNaN(n) && n); + .map(function (n) { return !isNaN(n) && n; }); if (offset.length === 2) { background.offset(geoMetersToOffset(offset)); } } }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); }; @@ -63875,7 +63966,7 @@ _rules[k].enable(); } } - if (didEnable) update(); + if (didEnable) { update(); } }; @@ -63894,7 +63985,7 @@ _rules[k].disable(); } } - if (didDisable) update(); + if (didDisable) { update(); } }; @@ -63985,7 +64076,7 @@ features.getMatches = function(entity, resolver, geometry) { if (geometry === 'vertex' || - (geometry === 'relation' && !relationShouldBeChecked(entity))) return {}; + (geometry === 'relation' && !relationShouldBeChecked(entity))) { return {}; } var ent = osmEntity.key(entity); if (!_cache[ent]) { @@ -63998,7 +64089,7 @@ for (var i = 0; i < _keys.length; i++) { if (_keys[i] === 'others') { - if (hasMatch) continue; + if (hasMatch) { continue; } // If an entity... // 1. is a way that hasn't matched other 'interesting' feature rules, @@ -64037,7 +64128,7 @@ features.getParents = function(entity, resolver, geometry) { - if (geometry === 'point') return []; + if (geometry === 'point') { return []; } var ent = osmEntity.key(entity); if (!_cache[ent]) { @@ -64058,8 +64149,8 @@ features.isHiddenPreset = function(preset, geometry) { - if (!_hidden.length) return false; - if (!preset.tags) return false; + if (!_hidden.length) { return false; } + if (!preset.tags) { return false; } var test = preset.setTags({}, geometry); for (var key in _rules) { @@ -64075,9 +64166,9 @@ features.isHiddenFeature = function(entity, resolver, geometry) { - if (!_hidden.length) return false; - if (!entity.version) return false; - if (_forceVisible[entity.id]) return false; + if (!_hidden.length) { return false; } + if (!entity.version) { return false; } + if (_forceVisible[entity.id]) { return false; } var matches = Object.keys(features.getMatches(entity, resolver, geometry)); return matches.length && matches.every(function(k) { return features.hidden(k); }); @@ -64085,12 +64176,12 @@ features.isHiddenChild = function(entity, resolver, geometry) { - if (!_hidden.length) return false; - if (!entity.version || geometry === 'point') return false; - if (_forceVisible[entity.id]) return false; + if (!_hidden.length) { return false; } + if (!entity.version || geometry === 'point') { return false; } + if (_forceVisible[entity.id]) { return false; } var parents = features.getParents(entity, resolver, geometry); - if (!parents.length) return false; + if (!parents.length) { return false; } for (var i = 0; i < parents.length; i++) { if (!features.isHidden(parents[i], resolver, parents[i].geometry(resolver))) { @@ -64102,7 +64193,7 @@ features.hasHiddenConnections = function(entity, resolver) { - if (!_hidden.length) return false; + if (!_hidden.length) { return false; } var childNodes, connections; if (entity.type === 'midpoint') { @@ -64125,8 +64216,8 @@ features.isHidden = function(entity, resolver, geometry) { - if (!_hidden.length) return false; - if (!entity.version) return false; + if (!_hidden.length) { return false; } + if (!entity.version) { return false; } var fn = (geometry === 'vertex' ? features.isHiddenChild : features.isHiddenFeature); return fn(entity, resolver, geometry); @@ -64134,7 +64225,7 @@ features.filter = function(d, resolver) { - if (!_hidden.length) return d; + if (!_hidden.length) { return d; } var result = []; for (var i = 0; i < d.length; i++) { @@ -64148,7 +64239,7 @@ features.forceVisible = function(entityIDs) { - if (!arguments.length) return Object.keys(_forceVisible); + if (!arguments.length) { return Object.keys(_forceVisible); } _forceVisible = {}; for (var i = 0; i < entityIDs.length; i++) { @@ -64182,7 +64273,7 @@ // warm up the feature matching cache upon merging fetched data context.history().on('merge.features', function(newEntities) { - if (!newEntities) return; + if (!newEntities) { return; } var handle = window.requestIdleCallback(function() { var graph = context.graph(); var types = utilArrayGroupBy(newEntities, 'type'); @@ -64214,8 +64305,8 @@ // 2 = adjacent vertex - yes but pay attention segmenting a line here // function svgPassiveVertex(node, graph, activeID) { - if (!activeID) return 1; - if (activeID === node.id) return 0; + if (!activeID) { return 1; } + if (activeID === node.id) { return 0; } var parents = graph.parentWays(node); @@ -64233,17 +64324,17 @@ if (isClosed) { // wraparound if needed max = nodes.length - 1; - if (ix1 < 0) ix1 = max + ix1; - if (ix2 < 0) ix2 = max + ix2; - if (ix3 > max) ix3 = ix3 - max; - if (ix4 > max) ix4 = ix4 - max; + if (ix1 < 0) { ix1 = max + ix1; } + if (ix2 < 0) { ix2 = max + ix2; } + if (ix3 > max) { ix3 = ix3 - max; } + if (ix4 > max) { ix4 = ix4 - max; } } - if (nodes[ix1] === activeID) return 0; // no - prevent self intersect - else if (nodes[ix2] === activeID) return 2; // ok - adjacent - else if (nodes[ix3] === activeID) return 2; // ok - adjacent - else if (nodes[ix4] === activeID) return 0; // no - prevent self intersect - else if (isClosed && nodes.indexOf(activeID) !== -1) return 0; // no - prevent self intersect + if (nodes[ix1] === activeID) { return 0; } // no - prevent self intersect + else if (nodes[ix2] === activeID) { return 2; } // ok - adjacent + else if (nodes[ix3] === activeID) { return 2; } // ok - adjacent + else if (nodes[ix4] === activeID) { return 0; } // no - prevent self intersect + else if (isClosed && nodes.indexOf(activeID) !== -1) { return 0; } // no - prevent self intersect } } } @@ -64549,7 +64640,7 @@ for (i = 0; i < primaries.length; i++) { k = primaries[i]; v = t[k]; - if (!v || v === 'no') continue; + if (!v || v === 'no') { continue; } if (k === 'piste:type') { // avoid a ':' in the class name k = 'piste'; @@ -64574,7 +64665,7 @@ for (j = 0; j < primaries.length; j++) { k = statuses[i] + ':' + primaries[j]; // e.g. `demolished:building=yes` v = t[k]; - if (!v || v === 'no') continue; + if (!v || v === 'no') { continue; } status = statuses[i]; break; @@ -64587,7 +64678,7 @@ for (i = 0; i < statuses.length; i++) { k = statuses[i]; v = t[k]; - if (!v || v === 'no') continue; + if (!v || v === 'no') { continue; } if (v === 'yes') { // e.g. `railway=rail + abandoned=yes` status = k; @@ -64600,7 +64691,7 @@ classes.push('tag-' + v); } // else ignore e.g. `highway=path + abandoned=railway` - if (status) break; + if (status) { break; } } } @@ -64613,7 +64704,7 @@ for (i = 0; i < secondaries.length; i++) { k = secondaries[i]; v = t[k]; - if (!v || v === 'no' || k === primary) continue; + if (!v || v === 'no' || k === primary) { continue; } classes.push('tag-' + k); classes.push('tag-' + k + '-' + v); } @@ -64643,7 +64734,7 @@ tagClasses.tags = function(val) { - if (!arguments.length) return _tags; + if (!arguments.length) { return _tags; } _tags = val; return tagClasses; }; @@ -64684,8 +64775,7 @@ grave_yard: 'cemetery', grass: [ { golf: 'green', pattern: 'golf_green' }, - { pattern: 'grass' }, - ], + { pattern: 'grass' } ], landfill: 'landfill', meadow: 'meadow', military: 'construction', @@ -64719,14 +64809,11 @@ }, traffic_calming: { island: [ - { surface: 'grass', pattern: 'grass' }, - ], + { surface: 'grass', pattern: 'grass' } ], chicane: [ - { surface: 'grass', pattern: 'grass' }, - ], + { surface: 'grass', pattern: 'grass' } ], choker: [ - { surface: 'grass', pattern: 'grass' }, - ] + { surface: 'grass', pattern: 'grass' } ] } }; @@ -64738,14 +64825,14 @@ for (var tag in patterns) { var entityValue = tags[tag]; - if (!entityValue) continue; + if (!entityValue) { continue; } if (typeof patterns[tag] === 'string') { // extra short syntax (just tag) - pattern name return 'pattern-' + patterns[tag]; } else { var values = patterns[tag]; for (var value in values) { - if (entityValue !== value) continue; + if (entityValue !== value) { continue; } var rules = values[value]; if (typeof rules === 'string') { // short syntax - pattern name @@ -64868,7 +64955,7 @@ for (var i = 0; i < entities.length; i++) { var entity = entities[i]; - if (entity.geometry(graph) !== 'area') continue; + if (entity.geometry(graph) !== 'area') { continue; } multipolygon = osmIsOldMultipolygonOuterMember(entity, graph); if (multipolygon) { @@ -65611,7 +65698,7 @@ reg.exec(source);//skip < while(match = reg.exec(source)){ buf.push(match); - if(match[1])return buf; + if(match[1]){ return buf; } } } @@ -65700,10 +65787,10 @@ error = this; Error.call(this, ExceptionMessage[code]); this.message = ExceptionMessage[code]; - if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException$2); + if(Error.captureStackTrace) { Error.captureStackTrace(this, DOMException$2); } } error.code = code; - if(message) this.message = this.message + ": " + message; + if(message) { this.message = this.message + ": " + message; } return error; }DOMException$2.prototype = Error.prototype; copy$2(ExceptionCode,DOMException$2); @@ -66532,9 +66619,7 @@ if(prefix == null){ //isHTML = true; var visibleNamespaces=[ - {namespace:uri,prefix:null} - //{namespace:uri,prefix:''} - ]; + {namespace:uri,prefix:null} ]; } } serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces); @@ -66585,7 +66670,7 @@ } switch(node.nodeType){ case ELEMENT_NODE: - if (!visibleNamespaces) visibleNamespaces = []; + if (!visibleNamespaces) { visibleNamespaces = []; } var startVisibleNamespaces = visibleNamespaces.length; var attrs = node.attributes; var len = attrs.length; @@ -67115,7 +67200,7 @@ splitSpace = /\s+/; // generate a short, numeric hash of a string function okhash(x) { - if (!x || !x.length) return 0; + if (!x || !x.length) { return 0; } for (var i = 0, h = 0; i < x.length; i++) { h = ((h << 5) - h) + x.charCodeAt(i) | 0; } return h; @@ -67143,12 +67228,12 @@ var o = {}, n, k; for (k = 0; k < ys.length; k++) { n = get1(x, ys[k]); - if (n) o[ys[k]] = nodeVal(n); + if (n) { o[ys[k]] = nodeVal(n); } } return o; } // add properties of Y to X, overwriting if present in both - function extend(x, y) { for (var k in y) x[k] = y[k]; } + function extend(x, y) { for (var k in y) { x[k] = y[k]; } } // get one coordinate from a coordinate array, if any function coord1(v) { return numarray(v.replace(removeSpace, '').split(',')); } // get all coordinates from a coordinate array as [[],[]] @@ -67200,7 +67285,7 @@ // IE9 will create a new XMLSerializer but it'll crash immediately. // This line is ignored because we don't run coverage tests in IE9 /* istanbul ignore next */ - if (str.xml !== undefined) return str.xml; + if (str.xml !== undefined) { return str.xml; } return serializer.serializeToString(str); } @@ -67254,10 +67339,10 @@ function gxCoord(v) { return numarray(v.split(' ')); } function gxCoords(root) { var elems = get(root, 'coord'), coords = [], times = []; - if (elems.length === 0) elems = get(root, 'gx:coord'); - for (var i = 0; i < elems.length; i++) coords.push(gxCoord(nodeVal(elems[i]))); + if (elems.length === 0) { elems = get(root, 'gx:coord'); } + for (var i = 0; i < elems.length; i++) { coords.push(gxCoord(nodeVal(elems[i]))); } var timeElems = get(root, 'when'); - for (var j = 0; j < timeElems.length; j++) times.push(nodeVal(timeElems[j])); + for (var j = 0; j < timeElems.length; j++) { times.push(nodeVal(timeElems[j])); } return { coords: coords, times: times @@ -67300,7 +67385,7 @@ type: 'LineString', coordinates: track.coords }); - if (track.times.length) coordTimes.push(track.times); + if (track.times.length) { coordTimes.push(track.times); } } } } @@ -67323,9 +67408,9 @@ polyStyle = get1(root, 'PolyStyle'), visibility = get1(root, 'visibility'); - if (!geomsAndTimes.geoms.length) return []; - if (name) properties.name = name; - if (address) properties.address = address; + if (!geomsAndTimes.geoms.length) { return []; } + if (name) { properties.name = name; } + if (address) { properties.address = address; } if (styleUrl) { if (styleUrl[0] !== '#') { styleUrl = '#' + styleUrl; @@ -67342,11 +67427,11 @@ // Try to populate the lineStyle or polyStyle since we got the style hash var style = styleByHash[properties.styleHash]; if (style) { - if (!lineStyle) lineStyle = get1(style, 'LineStyle'); - if (!polyStyle) polyStyle = get1(style, 'PolyStyle'); + if (!lineStyle) { lineStyle = get1(style, 'LineStyle'); } + if (!polyStyle) { polyStyle = get1(style, 'PolyStyle'); } } } - if (description) properties.description = description; + if (description) { properties.description = description; } if (timeSpan) { var begin = nodeVal(get1(timeSpan, 'begin')); var end = nodeVal(get1(timeSpan, 'end')); @@ -67360,9 +67445,9 @@ color = linestyles[0], opacity = linestyles[1], width = parseFloat(nodeVal(get1(lineStyle, 'width'))); - if (color) properties.stroke = color; - if (!isNaN(opacity)) properties['stroke-opacity'] = opacity; - if (!isNaN(width)) properties['stroke-width'] = width; + if (color) { properties.stroke = color; } + if (!isNaN(opacity)) { properties['stroke-opacity'] = opacity; } + if (!isNaN(width)) { properties['stroke-width'] = width; } } if (polyStyle) { var polystyles = kmlColor(nodeVal(get1(polyStyle, 'color'))), @@ -67370,10 +67455,10 @@ popacity = polystyles[1], fill = nodeVal(get1(polyStyle, 'fill')), outline = nodeVal(get1(polyStyle, 'outline')); - if (pcolor) properties.fill = pcolor; - if (!isNaN(popacity)) properties['fill-opacity'] = popacity; - if (fill) properties['fill-opacity'] = fill === '1' ? properties['fill-opacity'] || 1 : 0; - if (outline) properties['stroke-opacity'] = outline === '1' ? properties['stroke-opacity'] || 1 : 0; + if (pcolor) { properties.fill = pcolor; } + if (!isNaN(popacity)) { properties['fill-opacity'] = popacity; } + if (fill) { properties['fill-opacity'] = fill === '1' ? properties['fill-opacity'] || 1 : 0; } + if (outline) { properties['stroke-opacity'] = outline === '1' ? properties['stroke-opacity'] || 1 : 0; } } if (extendedData) { var datas = get(extendedData, 'Data'), @@ -67401,7 +67486,7 @@ }, properties: properties }; - if (attr(root, 'id')) feature.id = attr(root, 'id'); + if (attr(root, 'id')) { feature.id = attr(root, 'id'); } return [feature]; } return gj; @@ -67416,11 +67501,11 @@ feature; for (i = 0; i < tracks.length; i++) { feature = getTrack(tracks[i]); - if (feature) gj.features.push(feature); + if (feature) { gj.features.push(feature); } } for (i = 0; i < routes.length; i++) { feature = getRoute(routes[i]); - if (feature) gj.features.push(feature); + if (feature) { gj.features.push(feature); } } for (i = 0; i < waypoints.length; i++) { gj.features.push(getPoint(waypoints[i])); @@ -67431,12 +67516,12 @@ times = [], heartRates = [], l = pts.length; - if (l < 2) return {}; // Invalid line in GeoJSON + if (l < 2) { return {}; } // Invalid line in GeoJSON for (var i = 0; i < l; i++) { var c = coordPair(pts[i]); line.push(c.coordinates); - if (c.time) times.push(c.time); - if (c.heartRate) heartRates.push(c.heartRate); + if (c.time) { times.push(c.time); } + if (c.heartRate) { heartRates.push(c.heartRate); } } return { line: line, @@ -67453,16 +67538,16 @@ for (var i = 0; i < segments.length; i++) { line = getPoints(segments[i], 'trkpt'); if (line) { - if (line.line) track.push(line.line); - if (line.times && line.times.length) times.push(line.times); - if (line.heartRates && line.heartRates.length) heartRates.push(line.heartRates); + if (line.line) { track.push(line.line); } + if (line.times && line.times.length) { times.push(line.times); } + if (line.heartRates && line.heartRates.length) { heartRates.push(line.heartRates); } } } - if (track.length === 0) return; + if (track.length === 0) { return; } var properties = getProperties(node); extend(properties, getLineStyle(get1(node, 'extensions'))); - if (times.length) properties.coordTimes = track.length === 1 ? times[0] : times; - if (heartRates.length) properties.heartRates = track.length === 1 ? heartRates[0] : heartRates; + if (times.length) { properties.coordTimes = track.length === 1 ? times[0] : times; } + if (heartRates.length) { properties.heartRates = track.length === 1 ? heartRates[0] : heartRates; } return { type: 'Feature', properties: properties, @@ -67474,7 +67559,7 @@ } function getRoute(node) { var line = getPoints(node, 'rtept'); - if (!line.line) return; + if (!line.line) { return; } var prop = getProperties(node); extend(prop, getLineStyle(get1(node, 'extensions'))); var routeObj = { @@ -67507,10 +67592,10 @@ var color = nodeVal(get1(lineStyle, 'color')), opacity = parseFloat(nodeVal(get1(lineStyle, 'opacity'))), width = parseFloat(nodeVal(get1(lineStyle, 'width'))); - if (color) style.stroke = color; - if (!isNaN(opacity)) style['stroke-opacity'] = opacity; + if (color) { style.stroke = color; } + if (!isNaN(opacity)) { style['stroke-opacity'] = opacity; } // GPX width is in mm, convert to px with 96 px per inch - if (!isNaN(width)) style['stroke-width'] = width * 96 / 25.4; + if (!isNaN(width)) { style['stroke-width'] = width * 96 / 25.4; } } } return style; @@ -67518,7 +67603,7 @@ function getProperties(node) { var prop = getMulti(node, ['name', 'cmt', 'desc', 'type', 'time', 'keywords']), links = get(node, 'link'); - if (links.length) prop.links = []; + if (links.length) { prop.links = []; } for (var i = 0, link; i < links.length; i++) { link = { href: attr(links[i], 'href') }; extend(link, getMulti(links[i], ['text', 'type'])); @@ -67532,7 +67617,7 @@ return t; })(); - module.exports = toGeoJSON; + { module.exports = toGeoJSON; } }); var _initialized = false; @@ -67552,7 +67637,7 @@ function init() { - if (_initialized) return; // run once + if (_initialized) { return; } // run once _geojson = {}; _enabled = true; @@ -67568,7 +67653,7 @@ .on('drop.svgData', function() { event.stopPropagation(); event.preventDefault(); - if (!detected.filedrop) return; + if (!detected.filedrop) { return; } drawData.fileList(event.dataTransfer.files); }) .on('dragenter.svgData', over) @@ -67627,7 +67712,7 @@ // ensure that all geojson features in a collection have IDs function ensureIDs(gj) { - if (!gj) return null; + if (!gj) { return null; } if (gj.type === 'FeatureCollection') { for (var i = 0; i < gj.features.length; i++) { @@ -67642,7 +67727,7 @@ // ensure that each single Feature object has a unique ID function ensureFeatureID(feature) { - if (!feature) return; + if (!feature) { return; } feature.__featurehash__ = utilHashcode(fastJsonStableStringify(feature)); return feature; } @@ -67650,7 +67735,7 @@ // Prefer an array of Features instead of a FeatureCollection function getFeatures(gj) { - if (!gj) return []; + if (!gj) { return []; } if (gj.type === 'FeatureCollection') { return gj.features; @@ -67703,7 +67788,7 @@ .merge(layer); var surface = context.surface(); - if (!surface || surface.empty()) return; // not ready to draw yet, starting up + if (!surface || surface.empty()) { return; } // not ready to draw yet, starting up // Gather data @@ -67823,7 +67908,7 @@ function getExtension(fileName) { - if (!fileName) return; + if (!fileName) { return; } var re = /\.(gpx|kml|(geo)?json)$/i; var match = fileName.toLowerCase().match(re); @@ -67869,7 +67954,7 @@ drawData.showLabels = function(val) { - if (!arguments.length) return _showLabels; + if (!arguments.length) { return _showLabels; } _showLabels = val; return this; @@ -67877,7 +67962,7 @@ drawData.enabled = function(val) { - if (!arguments.length) return _enabled; + if (!arguments.length) { return _enabled; } _enabled = val; if (_enabled) { @@ -67898,7 +67983,7 @@ drawData.template = function(val, src) { - if (!arguments.length) return _template; + if (!arguments.length) { return _template; } // test source against OSM imagery blacklists.. var osm = context.connection(); @@ -67913,7 +67998,7 @@ regex = new RegExp(blacklists[i]); fail = regex.test(val); tested++; - if (fail) break; + if (fail) { break; } } catch (e) { /* noop */ } @@ -67940,7 +68025,7 @@ drawData.geojson = function(gj, src) { - if (!arguments.length) return _geojson; + if (!arguments.length) { return _geojson; } _template = null; _fileList = null; @@ -67959,14 +68044,14 @@ drawData.fileList = function(fileList) { - if (!arguments.length) return _fileList; + if (!arguments.length) { return _fileList; } _template = null; _fileList = fileList; _geojson = null; _src = null; - if (!fileList || !fileList.length) return this; + if (!fileList || !fileList.length) { return this; } var f = fileList[0]; var extension = getExtension(f.name); var reader = new FileReader(); @@ -68016,13 +68101,13 @@ drawData.fitZoom = function() { var features = getFeatures(_geojson); - if (!features.length) return; + if (!features.length) { return; } var map = context.map(); var viewport = map.trimmedExtent().polygon(); var coords = features.reduce(function(coords, feature) { var geom = feature.geometry; - if (!geom) return coords; + if (!geom) { return coords; } var c = geom.coordinates; @@ -68062,13 +68147,13 @@ function svgDebug(projection, context) { function drawDebug(selection) { - const showTile = context.getDebug('tile'); - const showCollision = context.getDebug('collision'); - const showImagery = context.getDebug('imagery'); - const showTouchTargets = context.getDebug('target'); - const showDownloaded = context.getDebug('downloaded'); + var showTile = context.getDebug('tile'); + var showCollision = context.getDebug('collision'); + var showImagery = context.getDebug('imagery'); + var showTouchTargets = context.getDebug('target'); + var showDownloaded = context.getDebug('downloaded'); - let debugData = []; + var debugData = []; if (showTile) { debugData.push({ class: 'red', label: 'tile' }); } @@ -68086,7 +68171,7 @@ } - let legend = context.container().select('.main-content') + var legend = context.container().select('.main-content') .selectAll('.debug-legend') .data(debugData.length ? [0] : []); @@ -68099,19 +68184,19 @@ .merge(legend); - let legendItems = legend.selectAll('.debug-legend-item') - .data(debugData, d => d.label); + var legendItems = legend.selectAll('.debug-legend-item') + .data(debugData, function (d) { return d.label; }); legendItems.exit() .remove(); legendItems.enter() .append('span') - .attr('class', d => `debug-legend-item ${d.class}`) - .text(d => d.label); + .attr('class', function (d) { return ("debug-legend-item " + (d.class)); }) + .text(function (d) { return d.label; }); - let layer = selection.selectAll('.layer-debug') + var layer = selection.selectAll('.layer-debug') .data(showImagery || showDownloaded ? [0] : []); layer.exit() @@ -68124,13 +68209,13 @@ // imagery - const extent = context.map().extent(); + var extent = context.map().extent(); _mainFileFetcher.get('imagery') - .then(d => { - const hits = (showImagery && d.query.bbox(extent.rectangle(), true)) || []; - const features = hits.map(d => d.features[d.id]); + .then(function (d) { + var hits = (showImagery && d.query.bbox(extent.rectangle(), true)) || []; + var features = hits.map(function (d) { return d.features[d.id]; }); - let imagery = layer.selectAll('path.debug-imagery') + var imagery = layer.selectAll('path.debug-imagery') .data(features); imagery.exit() @@ -68140,14 +68225,14 @@ .append('path') .attr('class', 'debug-imagery debug orange'); }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); // downloaded - const osm = context.connection(); - let dataDownloaded = []; + var osm = context.connection(); + var dataDownloaded = []; if (osm && showDownloaded) { - const rtree = osm.caches('get').tile.rtree; - dataDownloaded = rtree.all().map(bbox => { + var rtree = osm.caches('get').tile.rtree; + dataDownloaded = rtree.all().map(function (bbox) { return { type: 'Feature', properties: { id: bbox.id }, @@ -68165,7 +68250,7 @@ }); } - let downloaded = layer + var downloaded = layer .selectAll('path.debug-downloaded') .data(showDownloaded ? dataDownloaded : []); @@ -68200,16 +68285,16 @@ return drawDebug; } - let _layerEnabled = false; - let _qaService; + var _layerEnabled = false; + var _qaService; function svgKeepRight(projection, context, dispatch) { - const throttledRedraw = throttle(() => dispatch.call('change'), 1000); - const minZoom = 12; + var throttledRedraw = throttle(function () { return dispatch.call('change'); }, 1000); + var minZoom = 12; - let touchLayer = select(null); - let drawLayer = select(null); - let layerVisible = false; + var touchLayer = select(null); + var drawLayer = select(null); + var layerVisible = false; function markerPath(selection, klass) { selection @@ -68261,7 +68346,7 @@ .transition() .duration(250) .style('opacity', 1) - .on('end interrupt', () => dispatch.call('change')); + .on('end interrupt', function () { return dispatch.call('change'); }); } // Disable the layer. This transitions the layer invisible and then hides the markers. @@ -68275,7 +68360,7 @@ .transition() .duration(250) .style('opacity', 0) - .on('end interrupt', () => { + .on('end interrupt', function () { editOff(); dispatch.call('change'); }); @@ -68283,25 +68368,25 @@ // Update the issue markers function updateMarkers() { - if (!layerVisible || !_layerEnabled) return; + if (!layerVisible || !_layerEnabled) { return; } - const service = getService(); - const selectedID = context.selectedErrorID(); - const data = (service ? service.getItems(projection) : []); - const getTransform = svgPointTransform(projection); + var service = getService(); + var selectedID = context.selectedErrorID(); + var data = (service ? service.getItems(projection) : []); + var getTransform = svgPointTransform(projection); // Draw markers.. - const markers = drawLayer.selectAll('.qaItem.keepRight') - .data(data, d => d.id); + var markers = drawLayer.selectAll('.qaItem.keepRight') + .data(data, function (d) { return d.id; }); // exit markers.exit() .remove(); // enter - const markersEnter = markers.enter() + var markersEnter = markers.enter() .append('g') - .attr('class', d => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`); + .attr('class', function (d) { return ("qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.parentIssueType)); }); markersEnter .append('ellipse') @@ -68328,16 +68413,16 @@ markers .merge(markersEnter) .sort(sortY) - .classed('selected', d => d.id === selectedID) + .classed('selected', function (d) { return d.id === selectedID; }) .attr('transform', getTransform); // Draw targets.. - if (touchLayer.empty()) return; - const fillClass = context.getDebug('target') ? 'pink ' : 'nocolor '; + if (touchLayer.empty()) { return; } + var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor '; - const targets = touchLayer.selectAll('.qaItem.keepRight') - .data(data, d => d.id); + var targets = touchLayer.selectAll('.qaItem.keepRight') + .data(data, function (d) { return d.id; }); // exit targets.exit() @@ -68352,7 +68437,7 @@ .attr('y', '-22px') .merge(targets) .sort(sortY) - .attr('class', d => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`) + .attr('class', function (d) { return ("qaItem " + (d.service) + " target " + fillClass + " itemId-" + (d.id)); }) .attr('transform', getTransform); @@ -68367,9 +68452,9 @@ // Draw the keepRight layer and schedule loading issues and updating markers. function drawKeepRight(selection) { - const service = getService(); + var service = getService(); - const surface = context.surface(); + var surface = context.surface(); if (surface && !surface.empty()) { touchLayer = surface.selectAll('.data-layer.touch .layer-touch.markers'); } @@ -68399,7 +68484,7 @@ // Toggles the layer on and off drawKeepRight.enabled = function(val) { - if (!arguments.length) return _layerEnabled; + if (!arguments.length) { return _layerEnabled; } _layerEnabled = val; if (_layerEnabled) { @@ -68415,7 +68500,7 @@ return this; }; - drawKeepRight.supported = () => !!getService(); + drawKeepRight.supported = function () { return !!getService(); }; return drawKeepRight; } @@ -68426,7 +68511,7 @@ function init() { - if (svgGeolocate.initialized) return; // run once + if (svgGeolocate.initialized) { return; } // run once svgGeolocate.enabled = false; svgGeolocate.initialized = true; } @@ -68536,7 +68621,7 @@ } drawLocation.enabled = function (position, enabled) { - if (!arguments.length) return svgGeolocate.enabled; + if (!arguments.length) { return svgGeolocate.enabled; } _position = position; svgGeolocate.enabled = enabled; if (svgGeolocate.enabled) { @@ -68615,7 +68700,7 @@ function textWidth(text, size, elem) { var c = _textWidthCache[size]; - if (!c) c = _textWidthCache[size] = {}; + if (!c) { c = _textWidthCache[size] = {}; } if (c[text]) { return c[text]; @@ -68853,7 +68938,7 @@ var icon = preset && !shouldSkipIcon(preset) && preset.icon; if (!icon && !utilDisplayName(entity)) - continue; + { continue; } for (k = 0; k < labelStack.length; k++) { var matchGeom = labelStack[k][0]; @@ -68896,9 +68981,9 @@ if (geometry === 'point' || geometry === 'vertex') { // no point or vertex labels in wireframe mode // no vertex labels at low zooms (vertices have no icons) - if (wireframe) continue; + if (wireframe) { continue; } var renderAs = renderNodeAs[entity.id]; - if (renderAs === 'vertex' && zoom < 17) continue; + if (renderAs === 'vertex' && zoom < 17) { continue; } p = getPointLabel(entity, width, fontSize, renderAs); @@ -68982,7 +69067,7 @@ .map(function(node) { return projection(node.loc); }); var length = geoPathLength(points); - if (length < width + 20) return; + if (length < width + 20) { return; } // % along the line to attempt to place the label var lineOffsets = [50, 45, 55, 40, 60, 35, 65, 30, 70, @@ -68994,7 +69079,7 @@ var middle = offset / 100 * length; var start = middle - width / 2; - if (start < 0 || start + width > length) continue; + if (start < 0 || start + width > length) { continue; } // generate subpath and ignore paths that are invalid or don't cross viewport. var sub = subpath(points, start, start + width); @@ -69092,7 +69177,7 @@ var extent = entity.extent(graph); var areaWidth = projection(extent[1])[0] - projection(extent[0])[0]; - if (isNaN(centroid[0]) || areaWidth < 20) return; + if (isNaN(centroid[0]) || areaWidth < 20) { return; } var preset = _mainPresetIndex.match(entity, context.graph()); var picon = preset && preset.icon; @@ -69318,16 +69403,16 @@ return drawLabels; } - let _layerEnabled$1 = false; - let _qaService$1; + var _layerEnabled$1 = false; + var _qaService$1; function svgImproveOSM(projection, context, dispatch) { - const throttledRedraw = throttle(() => dispatch.call('change'), 1000); - const minZoom = 12; + var throttledRedraw = throttle(function () { return dispatch.call('change'); }, 1000); + var minZoom = 12; - let touchLayer = select(null); - let drawLayer = select(null); - let layerVisible = false; + var touchLayer = select(null); + var drawLayer = select(null); + var layerVisible = false; function markerPath(selection, klass) { selection @@ -69379,7 +69464,7 @@ .transition() .duration(250) .style('opacity', 1) - .on('end interrupt', () => dispatch.call('change')); + .on('end interrupt', function () { return dispatch.call('change'); }); } // Disable the layer. This transitions the layer invisible and then hides the markers. @@ -69393,7 +69478,7 @@ .transition() .duration(250) .style('opacity', 0) - .on('end interrupt', () => { + .on('end interrupt', function () { editOff(); dispatch.call('change'); }); @@ -69401,25 +69486,25 @@ // Update the issue markers function updateMarkers() { - if (!layerVisible || !_layerEnabled$1) return; + if (!layerVisible || !_layerEnabled$1) { return; } - const service = getService(); - const selectedID = context.selectedErrorID(); - const data = (service ? service.getItems(projection) : []); - const getTransform = svgPointTransform(projection); + var service = getService(); + var selectedID = context.selectedErrorID(); + var data = (service ? service.getItems(projection) : []); + var getTransform = svgPointTransform(projection); // Draw markers.. - const markers = drawLayer.selectAll('.qaItem.improveOSM') - .data(data, d => d.id); + var markers = drawLayer.selectAll('.qaItem.improveOSM') + .data(data, function (d) { return d.id; }); // exit markers.exit() .remove(); // enter - const markersEnter = markers.enter() + var markersEnter = markers.enter() .append('g') - .attr('class', d => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`); + .attr('class', function (d) { return ("qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.itemType)); }); markersEnter .append('polygon') @@ -69444,14 +69529,14 @@ .attr('class', 'icon-annotation') .attr('width', '13px') .attr('height', '13px') - .attr('xlink:href', d => { - const picon = d.icon; + .attr('xlink:href', function (d) { + var picon = d.icon; if (!picon) { return ''; } else { - const isMaki = /^maki-/.test(picon); - return `#${picon}${isMaki ? '-11' : ''}`; + var isMaki = /^maki-/.test(picon); + return ("#" + picon + (isMaki ? '-11' : '')); } }); @@ -69459,16 +69544,16 @@ markers .merge(markersEnter) .sort(sortY) - .classed('selected', d => d.id === selectedID) + .classed('selected', function (d) { return d.id === selectedID; }) .attr('transform', getTransform); // Draw targets.. - if (touchLayer.empty()) return; - const fillClass = context.getDebug('target') ? 'pink ' : 'nocolor '; + if (touchLayer.empty()) { return; } + var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor '; - const targets = touchLayer.selectAll('.qaItem.improveOSM') - .data(data, d => d.id); + var targets = touchLayer.selectAll('.qaItem.improveOSM') + .data(data, function (d) { return d.id; }); // exit targets.exit() @@ -69483,7 +69568,7 @@ .attr('y', '-28px') .merge(targets) .sort(sortY) - .attr('class', d => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`) + .attr('class', function (d) { return ("qaItem " + (d.service) + " target " + fillClass + " itemId-" + (d.id)); }) .attr('transform', getTransform); function sortY(a, b) { @@ -69495,9 +69580,9 @@ // Draw the ImproveOSM layer and schedule loading issues and updating markers. function drawImproveOSM(selection) { - const service = getService(); + var service = getService(); - const surface = context.surface(); + var surface = context.surface(); if (surface && !surface.empty()) { touchLayer = surface.selectAll('.data-layer.touch .layer-touch.markers'); } @@ -69527,7 +69612,7 @@ // Toggles the layer on and off drawImproveOSM.enabled = function(val) { - if (!arguments.length) return _layerEnabled$1; + if (!arguments.length) { return _layerEnabled$1; } _layerEnabled$1 = val; if (_layerEnabled$1) { @@ -69543,21 +69628,21 @@ return this; }; - drawImproveOSM.supported = () => !!getService(); + drawImproveOSM.supported = function () { return !!getService(); }; return drawImproveOSM; } - let _layerEnabled$2 = false; - let _qaService$2; + var _layerEnabled$2 = false; + var _qaService$2; function svgOsmose(projection, context, dispatch) { - const throttledRedraw = throttle(() => dispatch.call('change'), 1000); - const minZoom = 12; + var throttledRedraw = throttle(function () { return dispatch.call('change'); }, 1000); + var minZoom = 12; - let touchLayer = select(null); - let drawLayer = select(null); - let layerVisible = false; + var touchLayer = select(null); + var drawLayer = select(null); + var layerVisible = false; function markerPath(selection, klass) { selection @@ -69609,7 +69694,7 @@ .transition() .duration(250) .style('opacity', 1) - .on('end interrupt', () => dispatch.call('change')); + .on('end interrupt', function () { return dispatch.call('change'); }); } // Disable the layer. This transitions the layer invisible and then hides the markers. @@ -69623,7 +69708,7 @@ .transition() .duration(250) .style('opacity', 0) - .on('end interrupt', () => { + .on('end interrupt', function () { editOff(); dispatch.call('change'); }); @@ -69631,25 +69716,25 @@ // Update the issue markers function updateMarkers() { - if (!layerVisible || !_layerEnabled$2) return; + if (!layerVisible || !_layerEnabled$2) { return; } - const service = getService(); - const selectedID = context.selectedErrorID(); - const data = (service ? service.getItems(projection) : []); - const getTransform = svgPointTransform(projection); + var service = getService(); + var selectedID = context.selectedErrorID(); + var data = (service ? service.getItems(projection) : []); + var getTransform = svgPointTransform(projection); // Draw markers.. - const markers = drawLayer.selectAll('.qaItem.osmose') - .data(data, d => d.id); + var markers = drawLayer.selectAll('.qaItem.osmose') + .data(data, function (d) { return d.id; }); // exit markers.exit() .remove(); // enter - const markersEnter = markers.enter() + var markersEnter = markers.enter() .append('g') - .attr('class', d => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`); + .attr('class', function (d) { return ("qaItem " + (d.service) + " itemId-" + (d.id) + " itemType-" + (d.itemType)); }); markersEnter .append('polygon') @@ -69665,7 +69750,7 @@ markersEnter .append('polygon') - .attr('fill', d => service.getColor(d.item)) + .attr('fill', function (d) { return service.getColor(d.item); }) .call(markerPath, 'qaItem-fill'); markersEnter @@ -69674,14 +69759,14 @@ .attr('class', 'icon-annotation') .attr('width', '13px') .attr('height', '13px') - .attr('xlink:href', d => { - const picon = d.icon; + .attr('xlink:href', function (d) { + var picon = d.icon; if (!picon) { return ''; } else { - const isMaki = /^maki-/.test(picon); - return `#${picon}${isMaki ? '-11' : ''}`; + var isMaki = /^maki-/.test(picon); + return ("#" + picon + (isMaki ? '-11' : '')); } }); @@ -69689,15 +69774,15 @@ markers .merge(markersEnter) .sort(sortY) - .classed('selected', d => d.id === selectedID) + .classed('selected', function (d) { return d.id === selectedID; }) .attr('transform', getTransform); // Draw targets.. - if (touchLayer.empty()) return; - const fillClass = context.getDebug('target') ? 'pink' : 'nocolor'; + if (touchLayer.empty()) { return; } + var fillClass = context.getDebug('target') ? 'pink' : 'nocolor'; - const targets = touchLayer.selectAll('.qaItem.osmose') - .data(data, d => d.id); + var targets = touchLayer.selectAll('.qaItem.osmose') + .data(data, function (d) { return d.id; }); // exit targets.exit() @@ -69712,7 +69797,7 @@ .attr('y', '-28px') .merge(targets) .sort(sortY) - .attr('class', d => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`) + .attr('class', function (d) { return ("qaItem " + (d.service) + " target " + fillClass + " itemId-" + (d.id)); }) .attr('transform', getTransform); function sortY(a, b) { @@ -69724,9 +69809,9 @@ // Draw the Osmose layer and schedule loading issues and updating markers. function drawOsmose(selection) { - const service = getService(); + var service = getService(); - const surface = context.surface(); + var surface = context.surface(); if (surface && !surface.empty()) { touchLayer = surface.selectAll('.data-layer.touch .layer-touch.markers'); } @@ -69756,7 +69841,7 @@ // Toggles the layer on and off drawOsmose.enabled = function(val) { - if (!arguments.length) return _layerEnabled$2; + if (!arguments.length) { return _layerEnabled$2; } _layerEnabled$2 = val; if (_layerEnabled$2) { @@ -69765,7 +69850,7 @@ // Also, If layer is toggled quickly multiple requests are sent getService().loadStrings() .then(layerOn) - .catch(err => { + .catch(function (err) { console.log(err); // eslint-disable-line no-console }); } else { @@ -69779,7 +69864,7 @@ return this; }; - drawOsmose.supported = () => !!getService(); + drawOsmose.supported = function () { return !!getService(); }; return drawOsmose; } @@ -69798,7 +69883,7 @@ * init(). */ function init() { - if (svgStreetside.initialized) return; // run once + if (svgStreetside.initialized) { return; } // run once svgStreetside.enabled = false; svgStreetside.initialized = true; } @@ -69824,7 +69909,7 @@ */ function showLayer() { var service = getService(); - if (!service) return; + if (!service) { return; } editOn(); @@ -69869,7 +69954,7 @@ */ function click(d) { var service = getService(); - if (!service) return; + if (!service) { return; } // try to preserve the viewer rotation when staying on the same sequence if (d.sequenceKey !== _selectedSequence) { @@ -69879,7 +69964,7 @@ service .selectImage(context, d) - .then(response => { + .then(function (response) { if (response.status === 'ok'){ service.showViewer(context, _viewerYaw); } @@ -69894,7 +69979,7 @@ */ function mouseover(d) { var service = getService(); - if (service) service.setStyles(context, d); + if (service) { service.setStyles(context, d); } } /** @@ -69902,7 +69987,7 @@ */ function mouseout() { var service = getService(); - if (service) service.setStyles(context, null); + if (service) { service.setStyles(context, null); } } /** @@ -69920,17 +70005,17 @@ function viewerChanged() { var service = getService(); - if (!service) return; + if (!service) { return; } var viewer = service.viewer(); - if (!viewer) return; + if (!viewer) { return; } // update viewfield rotation _viewerYaw = viewer.getYaw(); // avoid updating if the map is currently transformed // e.g. during drags or easing. - if (context.map().isTransformed()) return; + if (context.map().isTransformed()) { return; } layer.selectAll('.viewfield-group.currentView') .attr('transform', transform); @@ -70087,7 +70172,7 @@ * drawImages.enabled(). */ drawImages.enabled = function(_) { - if (!arguments.length) return svgStreetside.enabled; + if (!arguments.length) { return svgStreetside.enabled; } svgStreetside.enabled = _; if (svgStreetside.enabled) { showLayer(); @@ -70121,7 +70206,7 @@ function init() { - if (svgMapillaryImages.initialized) return; // run once + if (svgMapillaryImages.initialized) { return; } // run once svgMapillaryImages.enabled = false; svgMapillaryImages.initialized = true; } @@ -70136,7 +70221,7 @@ // avoid updating if the map is currently transformed // e.g. during drags or easing. - if (context.map().isTransformed()) return; + if (context.map().isTransformed()) { return; } layer.selectAll('.viewfield-group.currentView') .filter(function(d) { @@ -70154,7 +70239,7 @@ function showLayer() { var service = getService(); - if (!service) return; + if (!service) { return; } editOn(); @@ -70191,7 +70276,7 @@ function click(d) { var service = getService(); - if (!service) return; + if (!service) { return; } service .selectImage(context, d.key) @@ -70204,13 +70289,13 @@ function mouseover(d) { var service = getService(); - if (service) service.setStyles(context, d); + if (service) { service.setStyles(context, d); } } function mouseout() { var service = getService(); - if (service) service.setStyles(context, null); + if (service) { service.setStyles(context, null); } } @@ -70231,7 +70316,7 @@ var showsFlat = context.photos().showsFlat(); if (!showsPano || !showsFlat) { images = images.filter(function(image) { - if (image.pano) return showsPano; + if (image.pano) { return showsPano; } return showsFlat; }); } @@ -70244,7 +70329,7 @@ if (!showsPano || !showsFlat) { sequences = sequences.filter(function(sequence) { if (sequence.properties.hasOwnProperty('pano')) { - if (sequence.properties.pano) return showsPano; + if (sequence.properties.pano) { return showsPano; } return showsFlat; } else { // if the sequence doesn't specify pano or not, search its images @@ -70254,7 +70339,7 @@ var imageKey = cProps.image_keys[index]; var image = service.cachedImage(imageKey); if (image && image.hasOwnProperty('pano')) { - if (image.pano) return showsPano; + if (image.pano) { return showsPano; } return showsFlat; } } @@ -70396,7 +70481,7 @@ drawImages.enabled = function(_) { - if (!arguments.length) return svgMapillaryImages.enabled; + if (!arguments.length) { return svgMapillaryImages.enabled; } svgMapillaryImages.enabled = _; if (svgMapillaryImages.enabled) { showLayer(); @@ -70425,7 +70510,7 @@ function init() { - if (svgMapillarySigns.initialized) return; // run once + if (svgMapillarySigns.initialized) { return; } // run once svgMapillarySigns.enabled = false; svgMapillarySigns.initialized = true; } @@ -70444,7 +70529,7 @@ function showLayer() { var service = getService(); - if (!service) return; + if (!service) { return; } editOn(); } @@ -70469,7 +70554,7 @@ function click(d) { var service = getService(); - if (!service) return; + if (!service) { return; } context.map().centerEase(d.loc); @@ -70580,7 +70665,7 @@ drawSigns.enabled = function(_) { - if (!arguments.length) return svgMapillarySigns.enabled; + if (!arguments.length) { return svgMapillarySigns.enabled; } svgMapillarySigns.enabled = _; if (svgMapillarySigns.enabled) { showLayer(); @@ -70609,7 +70694,7 @@ function init() { - if (svgMapillaryMapFeatures.initialized) return; // run once + if (svgMapillaryMapFeatures.initialized) { return; } // run once svgMapillaryMapFeatures.enabled = false; svgMapillaryMapFeatures.initialized = true; } @@ -70628,7 +70713,7 @@ function showLayer() { var service = getService(); - if (!service) return; + if (!service) { return; } editOn(); } @@ -70653,7 +70738,7 @@ function click(d) { var service = getService(); - if (!service) return; + if (!service) { return; } context.map().centerEase(d.loc); @@ -70777,7 +70862,7 @@ drawMapFeatures.enabled = function(_) { - if (!arguments.length) return svgMapillaryMapFeatures.enabled; + if (!arguments.length) { return svgMapillaryMapFeatures.enabled; } svgMapillaryMapFeatures.enabled = _; if (svgMapillaryMapFeatures.enabled) { showLayer(); @@ -70808,7 +70893,7 @@ function init() { - if (svgOpenstreetcamImages.initialized) return; // run once + if (svgOpenstreetcamImages.initialized) { return; } // run once svgOpenstreetcamImages.enabled = false; svgOpenstreetcamImages.initialized = true; } @@ -70828,7 +70913,7 @@ function showLayer() { var service = getService(); - if (!service) return; + if (!service) { return; } editOn(); @@ -70865,7 +70950,7 @@ function click(d) { var service = getService(); - if (!service) return; + if (!service) { return; } service .selectImage(context, d) @@ -70878,13 +70963,13 @@ function mouseover(d) { var service = getService(); - if (service) service.setStyles(context, d); + if (service) { service.setStyles(context, d); } } function mouseout() { var service = getService(); - if (service) service.setStyles(context, null); + if (service) { service.setStyles(context, null); } } @@ -71023,7 +71108,7 @@ drawImages.enabled = function(_) { - if (!arguments.length) return svgOpenstreetcamImages.enabled; + if (!arguments.length) { return svgOpenstreetcamImages.enabled; } svgOpenstreetcamImages.enabled = _; if (svgOpenstreetcamImages.enabled) { showLayer(); @@ -71095,7 +71180,7 @@ drawOsm.enabled = function(val) { - if (!arguments.length) return enabled; + if (!arguments.length) { return enabled; } enabled = val; if (enabled) { @@ -71205,7 +71290,7 @@ // Update the note markers function updateMarkers() { - if (!_notesVisible || !_notesEnabled) return; + if (!_notesVisible || !_notesEnabled) { return; } var service = getService(); var selectedID = context.selectedNoteID(); @@ -71273,7 +71358,7 @@ // Draw targets.. - if (touchLayer.empty()) return; + if (touchLayer.empty()) { return; } var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor '; var targets = touchLayer.selectAll('.note') @@ -71340,7 +71425,7 @@ // Toggles the layer on and off drawNotes.enabled = function(val) { - if (!arguments.length) return _notesEnabled; + if (!arguments.length) { return _notesEnabled; } _notesEnabled = val; if (_notesEnabled) { @@ -71497,7 +71582,7 @@ drawLayers.dimensions = function(val) { - if (!arguments.length) return utilGetDimensions(svg); + if (!arguments.length) { return utilGetDimensions(svg); } utilSetDimensions(svg, val); return this; }; @@ -71682,9 +71767,9 @@ var data = pathdata[layer] || []; return data.filter(function(d) { if (isSelected) - return context.selectedIDs().indexOf(d.id) !== -1; + { return context.selectedIDs().indexOf(d.id) !== -1; } else - return context.selectedIDs().indexOf(d.id) === -1; + { return context.selectedIDs().indexOf(d.id) === -1; } }); }; } @@ -71877,9 +71962,9 @@ for (var i = 0; i < entities.length; i++) { var entity = entities[i]; - if (entity.type !== 'way') continue; - if (!filter(entity)) continue; - if (context.selectedIDs().indexOf(entity.id) < 0) continue; + if (entity.type !== 'way') { continue; } + if (!filter(entity)) { continue; } + if (context.selectedIDs().indexOf(entity.id) < 0) { continue; } var nodes = graph.childNodes(entity); for (var j = 0; j < nodes.length - 1; j++) { @@ -71924,7 +72009,7 @@ function midpointFilter(d) { if (midpoints[d.id]) - return true; + { return true; } for (var i = 0; i < d.parents.length; i++) { if (filter(d.parents[i])) { @@ -72013,7 +72098,7 @@ var data = []; entities.forEach(function(node) { - if (activeID === node.id) return; // draw no target on the activeID + if (activeID === node.id) { return; } // draw no target on the activeID data.push({ type: 'Feature', @@ -72145,8 +72230,8 @@ function icon(turn) { var u = turn.u ? '-u' : ''; - if (turn.no) return '#iD-turn-no' + u; - if (turn.only) return '#iD-turn-only' + u; + if (turn.no) { return '#iD-turn-no' + u; } + if (turn.only) { return '#iD-turn-only' + u; } return '#iD-turn-yes' + u; } @@ -72317,7 +72402,7 @@ function getIcon(d) { // always check latest entity, as fastEntityKey avoids enter/exit now var entity = graph.entity(d.id); - if (entity.id in icons) return icons[entity.id]; + if (entity.id in icons) { return icons[entity.id]; } icons[entity.id] = entity.hasInterestingTags() && @@ -72329,7 +72414,7 @@ // memoize directions results, return false for empty arrays (for use in filter) function getDirections(entity) { - if (entity.id in directions) return directions[entity.id]; + if (entity.id in directions) { return directions[entity.id]; } var angles = entity.directions(graph, projection); directions[entity.id] = angles.length ? angles : false; @@ -72472,7 +72557,7 @@ var data = { targets: [], nopes: [] }; entities.forEach(function(node) { - if (activeID === node.id) return; // draw no target on the activeID + if (activeID === node.id) { return; } // draw no target on the activeID var vertexType = svgPassiveVertex(node, graph, activeID); if (vertexType !== 0) { // passive or adjacent - allow to connect @@ -72571,7 +72656,7 @@ function addChildVertices(entity) { // avoid redunant work and infinite recursion of circular relations - if (seenIds[entity.id]) return; + if (seenIds[entity.id]) { return; } seenIds[entity.id] = true; var geometry = entity.geometry(graph); @@ -72599,7 +72684,7 @@ ids.forEach(function(id) { var entity = graph.hasEntity(id); - if (!entity) return; + if (!entity) { return; } if (entity.type === 'node') { if (renderAsVertex(entity, graph, wireframe, zoom)) { @@ -72704,7 +72789,7 @@ _currSelected = {}; context.selectedIDs().forEach(function(id) { var entity = graph.hasEntity(id); - if (!entity) return; + if (!entity) { return; } if (entity.type === 'node') { if (renderAsVertex(entity, graph, wireframe, zoom)) { @@ -72725,7 +72810,7 @@ // partial redraw - only update the hovered items.. drawVertices.drawHover = function(selection, graph, target, extent) { - if (target === _currHoverTarget) return; // continue only if something changed + if (target === _currHoverTarget) { return; } // continue only if something changed var wireframe = context.surface().classed('fill-wireframe'); var zoom = geoScaleToZoom(projection.scale()); @@ -72901,7 +72986,7 @@ b = typeof transform === 'function' ? transform.apply(that, args) : transform, i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k)); return function(t) { - if (t === 1) t = b; // Avoid rounding error on end. + if (t === 1) { t = b; } // Avoid rounding error on end. else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); } g.zoom(null, t); }; @@ -72928,9 +73013,9 @@ return this; }, zoom: function(key, transform) { - if (this.mouse && key !== 'mouse') this.mouse[1] = transform.invert(this.mouse[0]); - if (this.pointer0 && key !== 'touch') this.pointer0[1] = transform.invert(this.pointer0[0]); - if (this.pointer1 && key !== 'touch') this.pointer1[1] = transform.invert(this.pointer1[0]); + if (this.mouse && key !== 'mouse') { this.mouse[1] = transform.invert(this.mouse[0]); } + if (this.pointer0 && key !== 'touch') { this.pointer0[1] = transform.invert(this.pointer0[0]); } + if (this.pointer1 && key !== 'touch') { this.pointer1[1] = transform.invert(this.pointer1[0]); } _transform = transform; this.emit('zoom'); return this; @@ -72948,7 +73033,7 @@ }; function wheeled() { - if (!filter.apply(this, arguments)) return; + if (!filter.apply(this, arguments)) { return; } var g = gesture(this, arguments), t = _transform, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), @@ -72986,7 +73071,7 @@ function pointerdown() { _downPointerIDs.add(event.pointerId); - if (!filter.apply(this, arguments)) return; + if (!filter.apply(this, arguments)) { return; } var g = gesture(this, arguments, _downPointerIDs.size === 1); var started; @@ -73010,9 +73095,9 @@ } function pointermove() { - if (!_downPointerIDs.has(event.pointerId)) return; + if (!_downPointerIDs.has(event.pointerId)) { return; } - if (!_activeGesture || !_pointerLocGetter) return; + if (!_activeGesture || !_pointerLocGetter) { return; } var g = gesture(this, arguments); @@ -73022,8 +73107,8 @@ if ((isPointer0 || isPointer1) && 'buttons' in event && !event.buttons) { // The pointer went up without ending the gesture somehow, e.g. // a down mouse was moved off the map and released. End it here. - if (g.pointer0) _downPointerIDs.delete(g.pointer0[2]); - if (g.pointer1) _downPointerIDs.delete(g.pointer1[2]); + if (g.pointer0) { _downPointerIDs.delete(g.pointer0[2]); } + if (g.pointer1) { _downPointerIDs.delete(g.pointer1[2]); } g.end(); return; } @@ -73034,8 +73119,8 @@ var loc = _pointerLocGetter(event); var t, p, l; - if (isPointer0) g.pointer0[0] = loc; - else if (isPointer1) g.pointer1[0] = loc; + if (isPointer0) { g.pointer0[0] = loc; } + else if (isPointer1) { g.pointer1[0] = loc; } t = _transform; if (g.pointer1) { @@ -73050,29 +73135,29 @@ p = g.pointer0[0]; l = g.pointer0[1]; } - else return; + else { return; } g.zoom('touch', constrain(translate(t, p, l), g.extent, translateExtent)); } function pointerup() { - if (!_downPointerIDs.has(event.pointerId)) return; + if (!_downPointerIDs.has(event.pointerId)) { return; } _downPointerIDs.delete(event.pointerId); - if (!_activeGesture) return; + if (!_activeGesture) { return; } var g = gesture(this, arguments); event.stopImmediatePropagation(); - if (g.pointer0 && g.pointer0[2] === event.pointerId) delete g.pointer0; - else if (g.pointer1 && g.pointer1[2] === event.pointerId) delete g.pointer1; + if (g.pointer0 && g.pointer0[2] === event.pointerId) { delete g.pointer0; } + else if (g.pointer1 && g.pointer1[2] === event.pointerId) { delete g.pointer1; } if (g.pointer1 && !g.pointer0) { g.pointer0 = g.pointer1; delete g.pointer1; } - if (g.pointer0) g.pointer0[1] = _transform.invert(g.pointer0[0]); + if (g.pointer0) { g.pointer0[1] = _transform.invert(g.pointer0[0]); } else { g.end(); } @@ -73138,7 +73223,7 @@ function pointerdown() { // ignore right-click - if (event.ctrlKey || event.button === 2) return; + if (event.ctrlKey || event.button === 2) { return; } var loc = [event.clientX, event.clientY]; @@ -73164,9 +73249,9 @@ function pointerup() { // ignore right-click - if (event.ctrlKey || event.button === 2) return; + if (event.ctrlKey || event.button === 2) { return; } - if (!_pointer || _pointer.pointerId !== event.pointerId) return; + if (!_pointer || _pointer.pointerId !== event.pointerId) { return; } _pointer.upCount += 1; @@ -73310,7 +73395,7 @@ function didUndoOrRedo(targetTransform) { var mode = context.mode().id; - if (mode !== 'browse' && mode !== 'select') return; + if (mode !== 'browse' && mode !== 'select') { return; } if (targetTransform) { map.transformEase(targetTransform); } @@ -73416,12 +73501,12 @@ updateAreaFill(); _doubleUpHandler.on('doubleUp.map', function(p0) { - if (!_dblClickZoomEnabled) return; + if (!_dblClickZoomEnabled) { return; } // don't zoom if targeting something other than the map itself if (typeof event.target.__data__ === 'object' && // or area fills - !select(event.target).classed('fill')) return; + !select(event.target).classed('fill')) { return; } var zoomOut = event.shiftKey; @@ -73438,7 +73523,7 @@ }); context.on('enter.map', function() { - if (!map.editableDataEnabled(true /* skip zoom check */)) return; + if (!map.editableDataEnabled(true /* skip zoom check */)) { return; } // redraw immediately any objects affected by a change in selectedIDs. var graph = context.graph(); @@ -73529,7 +73614,7 @@ data = []; utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id) { var entity = context.hasEntity(id); - if (entity) data.push(entity); + if (entity) { data.push(entity); } }); fullRedraw = true; filter = utilFunctor(true); @@ -73660,7 +73745,7 @@ if (source && source.type === 'wheel') { // assume that the gesture is already handled by pointer events - if (_pointerDown) return; + if (_pointerDown) { return; } var detected = utilDetect(); var dX = source.deltaX; @@ -73828,7 +73913,7 @@ function resetTransform() { - if (!_isTransformed) return false; + if (!_isTransformed) { return false; } utilSetTransform(supersurface, 0, 0); _isTransformed = false; @@ -73840,7 +73925,7 @@ function redraw(difference, extent) { - if (surface.empty() || !_redrawEnabled) return; + if (surface.empty() || !_redrawEnabled) { return; } // If we are in the middle of a zoom/pan, we can't do differenced redraws. // It would result in artifacts where differenced entities are redrawn with @@ -73888,7 +73973,7 @@ var immediateRedraw = function(difference, extent) { - if (!difference && !extent) cancelPendingRedraw(); + if (!difference && !extent) { cancelPendingRedraw(); } redraw(difference, extent); }; @@ -73917,14 +74002,14 @@ map.dblclickZoomEnable = function(val) { - if (!arguments.length) return _dblClickZoomEnabled; + if (!arguments.length) { return _dblClickZoomEnabled; } _dblClickZoomEnabled = val; return map; }; map.redrawEnable = function(val) { - if (!arguments.length) return _redrawEnabled; + if (!arguments.length) { return _redrawEnabled; } _redrawEnabled = val; return map; }; @@ -73937,7 +74022,7 @@ function setTransform(t2, duration, force) { var t = projection.transform(); - if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y) return false; + if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y) { return false; } if (duration) { _selection @@ -73958,7 +74043,7 @@ function setCenterZoom(loc2, z2, duration, force) { var c = map.center(); var z = map.zoom(); - if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force) return false; + if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force) { return false; } var proj = geoRawMercator().transform(projection.transform()); // copy projection @@ -74002,7 +74087,7 @@ map.dimensions = function(val) { - if (!arguments.length) return _dimensions; + if (!arguments.length) { return _dimensions; } _dimensions = val; drawLayers.dimensions(_dimensions); @@ -74098,7 +74183,7 @@ map.zoomTo = function(entity) { var extent = entity.extent(context.graph()); - if (!isFinite(extent.area())) return map; + if (!isFinite(extent.area())) { return map; } var z2 = clamp(map.trimmedExtentZoom(extent), 0, 20); return map.centerZoom(extent.center(), z2); @@ -74147,7 +74232,7 @@ } else { extent = obj.extent(context.graph()); } - if (!isFinite(extent.area())) return map; + if (!isFinite(extent.area())) { return map; } var z2 = clamp(map.trimmedExtentZoom(extent), 0, 20); return map.centerZoomEase(extent.center(), z2, duration); @@ -74238,7 +74323,7 @@ map.editableDataEnabled = function(skipZoomCheck) { var layer = context.layers().layer('osm'); - if (!layer || !layer.enabled()) return false; + if (!layer || !layer.enabled()) { return false; } return skipZoomCheck || map.withinEditableZoom(); }; @@ -74246,14 +74331,14 @@ map.notesEditable = function() { var layer = context.layers().layer('notes'); - if (!layer || !layer.enabled()) return false; + if (!layer || !layer.enabled()) { return false; } return map.withinEditableZoom(); }; map.minzoom = function(val) { - if (!arguments.length) return _minzoom; + if (!arguments.length) { return _minzoom; } _minzoom = val; return map; }; @@ -74269,7 +74354,7 @@ map.areaFillOptions = ['wireframe', 'partial', 'full']; map.activeAreaFill = function(val) { - if (!arguments.length) return corePreferences('area-fill') || 'partial'; + if (!arguments.length) { return corePreferences('area-fill') || 'partial'; } corePreferences('area-fill', val); if (val !== 'wireframe') { @@ -74302,7 +74387,7 @@ } - map.layers = () => drawLayers; + map.layers = function () { return drawLayers; }; map.doubleUpHandler = function() { @@ -74322,7 +74407,7 @@ function photos() {} function updateStorage() { - if (window.mocha) return; + if (window.mocha) { return; } var hash = utilStringQs(window.location.hash); var enabled = context.layers().all().filter(function(d) { @@ -74357,7 +74442,7 @@ }; photos.showsPhotoType = function(val) { - if (!photos.shouldFilterByPhotoType()) return true; + if (!photos.shouldFilterByPhotoType()) { return true; } return _shownPhotoTypes.indexOf(val) !== -1; }; @@ -74387,7 +74472,7 @@ var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ',').split(','); hashOverlayIDs.forEach(function(id) { var layer = context.layers().layer(id); - if (layer) layer.enabled(true); + if (layer) { layer.enabled(true); } }); } @@ -74402,7 +74487,7 @@ function update(selection) { - if (!osm) return; + if (!osm) { return; } if (!osm.authenticated()) { selection.selectAll('.userLink, .logoutLink') @@ -74417,7 +74502,7 @@ userLink.html(''); logoutLink.html(''); - if (err || !details) return; + if (err || !details) { return; } selection.selectAll('.userLink, .logoutLink') .classed('hide', false); @@ -74471,11 +74556,11 @@ } function uiAttribution(context) { - let _selection = select(null); + var _selection = select(null); function render(selection, data, klass) { - let div = selection.selectAll(`.${klass}`) + var div = selection.selectAll(("." + klass)) .data([0]); div = div.enter() @@ -74484,8 +74569,8 @@ .merge(div); - let attributions = div.selectAll('.attribution') - .data(data, d => d.id); + var attributions = div.selectAll('.attribution') + .data(data, function (d) { return d.id; }); attributions.exit() .remove(); @@ -74493,8 +74578,8 @@ attributions = attributions.enter() .append('span') .attr('class', 'attribution') - .each((d, i, nodes) => { - let attribution = select(nodes[i]); + .each(function (d, i, nodes) { + var attribution = select(nodes[i]); if (d.terms_html) { attribution.html(d.terms_html); @@ -74508,8 +74593,8 @@ .attr('target', '_blank'); } - const sourceID = d.id.replace(/\./g, ''); - const terms_text = _t(`imagery.${sourceID}.attribution.text`, + var sourceID = d.id.replace(/\./g, ''); + var terms_text = _t(("imagery." + sourceID + ".attribution.text"), { default: d.terms_text || d.id || d.name() } ); @@ -74528,9 +74613,9 @@ .merge(attributions); - let copyright = attributions.selectAll('.copyright-notice') - .data(d => { - let notice = d.copyrightNotices(context.map().zoom(), context.map().extent()); + var copyright = attributions.selectAll('.copyright-notice') + .data(function (d) { + var notice = d.copyrightNotices(context.map().zoom(), context.map().extent()); return notice ? [notice] : []; }); @@ -74548,14 +74633,14 @@ function update() { - let baselayer = context.background().baseLayerSource(); + var baselayer = context.background().baseLayerSource(); _selection .call(render, (baselayer ? [baselayer] : []), 'base-layer-attribution'); - const z = context.map().zoom(); - let overlays = context.background().overlayLayerSources() || []; + var z = context.map().zoom(); + var overlays = context.background().overlayLayerSources() || []; _selection - .call(render, overlays.filter(s => s.validZoom(z)), 'overlay-layer-attribution'); + .call(render, overlays.filter(function (s) { return s.validZoom(z); }), 'overlay-layer-attribution'); } @@ -74581,13 +74666,13 @@ function update() { - if (!osm) return; + if (!osm) { return; } var users = {}, entities = context.history().intersects(context.map().extent()); entities.forEach(function(entity) { - if (entity && entity.user) users[entity.user] = true; + if (entity && entity.user) { users[entity.user] = true; } }); var u = Object.keys(users), @@ -74640,7 +74725,7 @@ return function(selection) { - if (!osm) return; + if (!osm) { return; } wrap = selection; update(); @@ -74816,7 +74901,7 @@ } // don't show if buttons are pressed, e.g. during click and drag of map - if (event.buttons !== 0) return; + if (event.buttons !== 0) { return; } show.apply(this, arguments); }); @@ -75027,19 +75112,19 @@ var _keys = utilFunctor(null); tooltip.title = function(val) { - if (!arguments.length) return _title; + if (!arguments.length) { return _title; } _title = utilFunctor(val); return tooltip; }; tooltip.heading = function(val) { - if (!arguments.length) return _heading; + if (!arguments.length) { return _heading; } _heading = utilFunctor(val); return tooltip; }; tooltip.keys = function(val) { - if (!arguments.length) return _keys; + if (!arguments.length) { return _keys; } _keys = utilFunctor(val); return tooltip; }; @@ -75146,7 +75231,7 @@ return !isTouchMenu || !op.mouseOnly; }); - if (!ops.length) return; + if (!ops.length) { return; } _tooltips = []; @@ -75229,7 +75314,7 @@ } }) .on('drawn.edit-menu', function(info) { - if (info.full) updatePosition(); + if (info.full) { updatePosition(); } }); var lastPointerUpType; @@ -75271,7 +75356,7 @@ function updatePosition() { - if (!_menu || _menu.empty()) return; + if (!_menu || _menu.empty()) { return; } var anchorLoc = context.projection(_anchorLocLonLat); @@ -75380,20 +75465,20 @@ }; editMenu.anchorLoc = function(val) { - if (!arguments.length) return _anchorLoc; + if (!arguments.length) { return _anchorLoc; } _anchorLoc = val; _anchorLocLonLat = context.projection.invert(_anchorLoc); return editMenu; }; editMenu.triggerType = function(val) { - if (!arguments.length) return _triggerType; + if (!arguments.length) { return _triggerType; } _triggerType = val; return editMenu; }; editMenu.operations = function(val) { - if (!arguments.length) return _operations; + if (!arguments.length) { return _operations; } _operations = val; return editMenu; }; @@ -75533,31 +75618,31 @@ flash.duration = function(_) { - if (!arguments.length) return _duration; + if (!arguments.length) { return _duration; } _duration = _; return flash; }; flash.text = function(_) { - if (!arguments.length) return _text; + if (!arguments.length) { return _text; } _text = _; return flash; }; flash.textClass = function(_) { - if (!arguments.length) return _textClass; + if (!arguments.length) { return _textClass; } _textClass = _; return flash; }; flash.iconName = function(_) { - if (!arguments.length) return _iconName; + if (!arguments.length) { return _iconName; } _iconName = _; return flash; }; flash.iconClass = function(_) { - if (!arguments.length) return _iconClass; + if (!arguments.length) { return _iconClass; } _iconClass = _; return flash; }; @@ -75622,7 +75707,7 @@ return function() { // selection) { - if (!isSupported()) return; + if (!isSupported()) { return; } // button = selection.append('button') // .attr('title', t('full_screen')) @@ -75654,7 +75739,7 @@ var _button = select(null); function click() { - if (context.inIntro()) return; + if (context.inIntro()) { return; } if (!_layer.enabled() && !_locating.isShown()) { // This timeout ensures that we still call finish() even if @@ -75712,7 +75797,7 @@ } return function(selection) { - if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return; + if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) { return; } _button = selection .append('button') @@ -75740,7 +75825,7 @@ function redraw(selection) { var source = background.baseLayerSource(); - if (!source) return; + if (!source) { return; } var isDG = (source.id.match(/^DigitalGlobe/i) !== null); @@ -75761,7 +75846,7 @@ metadataKeys.forEach(function(k) { // DigitalGlobe vintage is available in raster layers for now. - if (isDG && k === 'vintage') return; + if (isDG && k === 'vintage') { return; } list .append('li') @@ -75822,7 +75907,7 @@ function getMetadata(selection) { var tile = context.container().select('.layer-background img.tile-center'); // tile near viewport center - if (tile.empty()) return; + if (tile.empty()) { return; } var sourceName = currSourceName; var d = tile.datum(); @@ -75836,10 +75921,10 @@ .selectAll('.background-info-span-zoom') .text(metadata.zoom); - if (!d || !d.length >= 3) return; + if (!d || !d.length >= 3) { return; } background.baseLayerSource().getMetadata(center, d, function(err, result) { - if (err || currSourceName !== sourceName) return; + if (err || currSourceName !== sourceName) { return; } // update vintage var vintage = result.vintage; @@ -75851,7 +75936,7 @@ // update other metdata metadataKeys.forEach(function(k) { - if (k === 'zoom' || k === 'vintage') return; // done already + if (k === 'zoom' || k === 'vintage') { return; } // done already var val = result[k]; metadata[k] = val; selection.selectAll('.background-info-list-' + k) @@ -75894,13 +75979,13 @@ var osm; function displayTimestamp(timestamp) { - if (!timestamp) return _t('info_panels.history.unknown'); + if (!timestamp) { return _t('info_panels.history.unknown'); } var options = { day: 'numeric', month: 'short', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; var d = new Date(timestamp); - if (isNaN(d.getTime())) return _t('info_panels.history.unknown'); + if (isNaN(d.getTime())) { return _t('info_panels.history.unknown'); } return d.toLocaleString(_mainLocalizer.localeCode(), options); } @@ -76012,7 +76097,7 @@ .attr('class', 'history-heading') .text(singular || _t('info_panels.history.selected', { n: selected.length })); - if (!singular) return; + if (!singular) { return; } if (entity) { selection.call(redrawEntity, entity); @@ -76406,7 +76491,7 @@ function toLineString(feature) { - if (feature.type === 'LineString') return feature; + if (feature.type === 'LineString') { return feature; } var result = { type: 'LineString', coordinates: [] }; if (feature.type === 'Polygon') { @@ -76729,7 +76814,7 @@ ids.forEach(function(k) { var key = _t('info_panels.' + k + '.key', { default: null }); - if (!key) return; + if (!key) { return; } context.keybinding() .on(uiCmd('⌘⇧' + key), function() { info.toggle(k); }); }); @@ -76785,7 +76870,7 @@ // with custom `replacements` function helpString(id, replacements) { // only load these the first time - if (!helpStringReplacements) helpStringReplacements = { + if (!helpStringReplacements) { helpStringReplacements = { // insert icons corresponding to various UI elements point_icon: icon('#iD-icon-point', 'pre-text'), line_icon: icon('#iD-icon-line', 'pre-text'), @@ -76854,7 +76939,7 @@ start_the_walkthrough: _t('splash.walkthrough'), help: _t('help.title'), ok: _t('intro.ok') - }; + }; } var reps; if (replacements) { @@ -76883,10 +76968,10 @@ var missingStrings = {}; function checkKey(key, text) { if (_t(key, { default: undefined}) === undefined) { - if (missingStrings.hasOwnProperty(key)) return; // warn once + if (missingStrings.hasOwnProperty(key)) { return; } // warn once missingStrings[key] = text; var missing = key + ': ' + text; - if (typeof console !== 'undefined') console.log(missing); // eslint-disable-line + if (typeof console !== 'undefined') { console.log(missing); } // eslint-disable-line } } @@ -76966,11 +77051,11 @@ function transitionTime(point1, point2) { var distance = geoSphericalDistance(point1, point2); if (distance === 0) - return 0; + { return 0; } else if (distance < 80) - return 500; + { return 500; } else - return 1000; + { return 1000; } } // Tooltips and svg mask used to highlight certain features @@ -77220,7 +77305,7 @@ containerWidth + ',' + containerHeight + 'L' + containerWidth + ',0 Z'; - if (!d) return string; + if (!d) { return string; } return string + 'M' + d.left + ',' + d.top + 'L' + d.left + ',' + (d.top + d.height) + 'L' + @@ -77472,26 +77557,26 @@ context.history().reset('initial'); var entity = context.hasEntity(hallId); - if (!entity) return; + if (!entity) { return; } reveal(null, null, { duration: 0 }); context.map().centerZoomEase(entity.loc, 19, 500); timeout(function() { var entity = context.hasEntity(hallId); - if (!entity) return; + if (!entity) { return; } var box = pointBox(entity.loc, context); var textId = context.lastPointerType() === 'mouse' ? 'click_townhall' : 'tap_townhall'; reveal(box, helpString('intro.navigation.' + textId)); context.map().on('move.intro drawn.intro', function() { var entity = context.hasEntity(hallId); - if (!entity) return; + if (!entity) { return; } var box = pointBox(entity.loc, context); reveal(box, helpString('intro.navigation.' + textId), { duration: 0 }); }); context.on('enter.intro', function() { - if (isTownHallSelected()) continueTo(selectedTownHall); + if (isTownHallSelected()) { continueTo(selectedTownHall); } }); }, 550); // after centerZoomEase @@ -77512,10 +77597,10 @@ function selectedTownHall() { - if (!isTownHallSelected()) return clickTownHall(); + if (!isTownHallSelected()) { return clickTownHall(); } var entity = context.hasEntity(hallId); - if (!entity) return clickTownHall(); + if (!entity) { return clickTownHall(); } var box = pointBox(entity.loc, context); var onClick = function() { continueTo(editorTownHall); }; @@ -77526,7 +77611,7 @@ context.map().on('move.intro drawn.intro', function() { var entity = context.hasEntity(hallId); - if (!entity) return; + if (!entity) { return; } var box = pointBox(entity.loc, context); reveal(box, helpString('intro.navigation.selected_townhall'), { duration: 0, buttonText: _t('intro.ok'), buttonCallback: onClick } @@ -77548,7 +77633,7 @@ function editorTownHall() { - if (!isTownHallSelected()) return clickTownHall(); + if (!isTownHallSelected()) { return clickTownHall(); } // disallow scrolling context.container().select('.inspector-wrap').on('wheel.intro', eventCancel); @@ -77580,7 +77665,7 @@ function presetTownHall() { - if (!isTownHallSelected()) return clickTownHall(); + if (!isTownHallSelected()) { return clickTownHall(); } // reset pane, in case user happened to change it.. context.container().select('.inspector-wrap .panewrap').style('right', '0%'); @@ -77618,7 +77703,7 @@ function fieldsTownHall() { - if (!isTownHallSelected()) return clickTownHall(); + if (!isTownHallSelected()) { return clickTownHall(); } // reset pane, in case user happened to change it.. context.container().select('.inspector-wrap .panewrap').style('right', '0%'); @@ -77652,7 +77737,7 @@ function closeTownHall() { - if (!isTownHallSelected()) return clickTownHall(); + if (!isTownHallSelected()) { return clickTownHall(); } var selector = '.entity-editor-pane button.close svg use'; var href = select(selector).attr('href') || '#iD-icon-close'; @@ -77751,7 +77836,7 @@ timeout(function() { context.map().on('move.intro drawn.intro', function() { var entity = context.hasEntity(springStreetEndId); - if (!entity) return; + if (!entity) { return; } var box = pointBox(entity.loc, context); box.height = 500; reveal(box, @@ -77908,7 +77993,7 @@ .attr('xlink:href', '#iD-graphic-points'); context.on('enter.intro', function(mode) { - if (mode.id !== 'add-point') return; + if (mode.id !== 'add-point') { return; } continueTo(placePoint); }); }, msec + 100); @@ -77935,7 +78020,7 @@ }); context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return chapter.restart(); + if (mode.id !== 'select') { return chapter.restart(); } _pointID = context.mode().selectedIDs()[0]; continueTo(searchPreset); }); @@ -78114,9 +78199,9 @@ function reselectPoint() { - if (!_pointID) return chapter.restart(); + if (!_pointID) { return chapter.restart(); } var entity = context.hasEntity(_pointID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } // make sure it's still a cafe, in case user somehow changed it.. var oldPreset = _mainPresetIndex.match(entity, context.graph()); @@ -78135,14 +78220,14 @@ timeout(function() { context.map().on('move.intro drawn.intro', function() { var entity = context.hasEntity(_pointID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } var box = pointBox(entity.loc, context); reveal(box, helpString('intro.points.reselect'), { duration: 0 }); }); }, 600); // after reveal.. context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return; + if (mode.id !== 'select') { return; } continueTo(updatePoint); }); @@ -78212,9 +78297,9 @@ function rightClickPoint() { - if (!_pointID) return chapter.restart(); + if (!_pointID) { return chapter.restart(); } var entity = context.hasEntity(_pointID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } context.enter(modeBrowse(context)); @@ -78225,20 +78310,20 @@ timeout(function() { context.map().on('move.intro', function() { var entity = context.hasEntity(_pointID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } var box = pointBox(entity.loc, context); reveal(box, helpString('intro.points.' + textId), { duration: 0 }); }); }, 600); // after reveal context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return; + if (mode.id !== 'select') { return; } var ids = context.selectedIDs(); - if (ids.length !== 1 || ids[0] !== _pointID) return; + if (ids.length !== 1 || ids[0] !== _pointID) { return; } timeout(function() { var node = selectMenuItem(context, 'delete').node(); - if (!node) return; + if (!node) { return; } continueTo(enterDelete); }, 50); // after menu visible }); @@ -78252,9 +78337,9 @@ function enterDelete() { - if (!_pointID) return chapter.restart(); + if (!_pointID) { return chapter.restart(); } var entity = context.hasEntity(_pointID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } var node = selectMenuItem(context, 'delete').node(); if (!node) { return continueTo(rightClickPoint); } @@ -78274,9 +78359,9 @@ }, 300); // after menu visible context.on('exit.intro', function() { - if (!_pointID) return chapter.restart(); + if (!_pointID) { return chapter.restart(); } var entity = context.hasEntity(_pointID); - if (entity) return continueTo(rightClickPoint); // point still exists + if (entity) { return continueTo(rightClickPoint); } // point still exists }); context.history().on('change.intro', function(changed) { @@ -78399,7 +78484,7 @@ .attr('xlink:href', '#iD-graphic-areas'); context.on('enter.intro', function(mode) { - if (mode.id !== 'add-area') return; + if (mode.id !== 'add-area') { return; } continueTo(startPlayground); }); }, msec + 100); @@ -78433,7 +78518,7 @@ ); }); context.on('enter.intro', function(mode) { - if (mode.id !== 'draw-area') return chapter.restart(); + if (mode.id !== 'draw-area') { return chapter.restart(); } continueTo(continuePlayground); }); }, 250); // after reveal @@ -78738,7 +78823,7 @@ }); function continueTo(nextStep) { - if (watcher) window.clearInterval(watcher); + if (watcher) { window.clearInterval(watcher); } context.on('exit.intro', null); nextStep(); } @@ -78904,7 +78989,7 @@ .attr('xlink:href', '#iD-graphic-lines'); context.on('enter.intro', function(mode) { - if (mode.id !== 'add-line') return; + if (mode.id !== 'add-line') { return; } continueTo(startLine); }); }, msec + 100); @@ -78917,7 +79002,7 @@ function startLine() { - if (context.mode().id !== 'add-line') return chapter.restart(); + if (context.mode().id !== 'add-line') { return chapter.restart(); } _tulipRoadID = null; @@ -78939,7 +79024,7 @@ }); context.on('enter.intro', function(mode) { - if (mode.id !== 'draw-line') return chapter.restart(); + if (mode.id !== 'draw-line') { return chapter.restart(); } continueTo(drawLine); }); @@ -78952,7 +79037,7 @@ function drawLine() { - if (context.mode().id !== 'draw-line') return chapter.restart(); + if (context.mode().id !== 'draw-line') { return chapter.restart(); } _tulipRoadID = context.mode().selectedIDs()[0]; context.map().centerEase(tulipRoadMidpoint, 500); @@ -79004,7 +79089,7 @@ function isLineConnected() { var entity = _tulipRoadID && context.hasEntity(_tulipRoadID); - if (!entity) return false; + if (!entity) { return false; } var drawNodes = context.graph().childNodes(entity); return drawNodes.some(function(node) { @@ -79028,9 +79113,9 @@ function continueLine() { - if (context.mode().id !== 'draw-line') return chapter.restart(); + if (context.mode().id !== 'draw-line') { return chapter.restart(); } var entity = _tulipRoadID && context.hasEntity(_tulipRoadID); - if (!entity) return chapter.restart(); + if (!entity) { return chapter.restart(); } context.map().centerEase(tulipRoadIntersection, 500); @@ -79042,11 +79127,11 @@ context.on('enter.intro', function(mode) { if (mode.id === 'draw-line') - return; + { return; } else if (mode.id === 'select') - return continueTo(chooseCategoryRoad); + { return continueTo(chooseCategoryRoad); } else - return chapter.restart(); + { return chapter.restart(); } }); function continueTo(nextStep) { @@ -79057,14 +79142,14 @@ function chooseCategoryRoad() { - if (context.mode().id !== 'select') return chapter.restart(); + if (context.mode().id !== 'select') { return chapter.restart(); } context.on('exit.intro', function() { return chapter.restart(); }); var button = context.container().select('.preset-category-road_minor .preset-list-button'); - if (button.empty()) return chapter.restart(); + if (button.empty()) { return chapter.restart(); } // disallow scrolling context.container().select('.inspector-wrap').on('wheel.intro', eventCancel); @@ -79093,14 +79178,14 @@ function choosePresetResidential() { - if (context.mode().id !== 'select') return chapter.restart(); + if (context.mode().id !== 'select') { return chapter.restart(); } context.on('exit.intro', function() { return chapter.restart(); }); var subgrid = context.container().select('.preset-category-road_minor .subgrid'); - if (subgrid.empty()) return chapter.restart(); + if (subgrid.empty()) { return chapter.restart(); } subgrid.selectAll(':not(.preset-highway-residential) .preset-list-button') .on('click.intro', function() { @@ -79129,7 +79214,7 @@ // selected wrong road type function retryPresetResidential() { - if (context.mode().id !== 'select') return chapter.restart(); + if (context.mode().id !== 'select') { return chapter.restart(); } context.on('exit.intro', function() { return chapter.restart(); @@ -79496,13 +79581,13 @@ }); context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return; + if (mode.id !== 'select') { return; } var ids = context.selectedIDs(); - if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return; + if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) { return; } timeout(function() { var node = selectMenuItem(context, 'split').node(); - if (!node) return; + if (!node) { return; } continueTo(splitIntersection); }, 50); // after menu visible }); @@ -79773,7 +79858,7 @@ }); context.ui().editMenu().on('toggled.intro', function(open) { - if (!open) return; + if (!open) { return; } timeout(function() { var ids = context.selectedIDs(); @@ -79781,7 +79866,7 @@ ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) { var node = selectMenuItem(context, 'delete').node(); - if (!node) return; + if (!node) { return; } continueTo(multiDelete); } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) { @@ -79821,7 +79906,7 @@ } var node = selectMenuItem(context, 'delete').node(); - if (!node) return continueTo(multiRightClick); + if (!node) { return continueTo(multiRightClick); } reveal('.edit-menu', helpString('intro.lines.multi_delete'), @@ -79973,7 +80058,7 @@ .attr('xlink:href', '#iD-graphic-buildings'); context.on('enter.intro', function(mode) { - if (mode.id !== 'add-area') return; + if (mode.id !== 'add-area') { return; } continueTo(startHouse); }); }, msec + 100); @@ -80003,7 +80088,7 @@ }); context.on('enter.intro', function(mode) { - if (mode.id !== 'draw-area') return chapter.restart(); + if (mode.id !== 'draw-area') { return chapter.restart(); } continueTo(continueHouse); }); @@ -80211,7 +80296,7 @@ function rightClickHouse() { - if (!_houseID) return chapter.restart(); + if (!_houseID) { return chapter.restart(); } context.enter(modeBrowse(context)); context.history().reset('hasHouse'); @@ -80222,13 +80307,13 @@ context.map().centerZoomEase(house, zoom, 500); context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return; + if (mode.id !== 'select') { return; } var ids = context.selectedIDs(); - if (ids.length !== 1 || ids[0] !== _houseID) return; + if (ids.length !== 1 || ids[0] !== _houseID) { return; } timeout(function() { var node = selectMenuItem(context, 'orthogonalize').node(); - if (!node) return; + if (!node) { return; } continueTo(clickSquare); }, 50); // after menu visible }); @@ -80252,9 +80337,9 @@ function clickSquare() { - if (!_houseID) return chapter.restart(); + if (!_houseID) { return chapter.restart(); } var entity = context.hasEntity(_houseID); - if (!entity) return continueTo(rightClickHouse); + if (!entity) { return continueTo(rightClickHouse); } var node = selectMenuItem(context, 'orthogonalize').node(); if (!node) { return continueTo(rightClickHouse); } @@ -80350,7 +80435,7 @@ ); context.on('enter.intro', function(mode) { - if (mode.id !== 'add-area') return; + if (mode.id !== 'add-area') { return; } continueTo(startTank); }); }, msec + 100); @@ -80379,7 +80464,7 @@ }); context.on('enter.intro', function(mode) { - if (mode.id !== 'draw-area') return chapter.restart(); + if (mode.id !== 'draw-area') { return chapter.restart(); } continueTo(continueTank); }); @@ -80539,7 +80624,7 @@ function rightClickTank() { - if (!_tankID) return continueTo(addTank); + if (!_tankID) { return continueTo(addTank); } context.enter(modeBrowse(context)); context.history().reset('hasTank'); @@ -80547,13 +80632,13 @@ timeout(function() { context.on('enter.intro', function(mode) { - if (mode.id !== 'select') return; + if (mode.id !== 'select') { return; } var ids = context.selectedIDs(); - if (ids.length !== 1 || ids[0] !== _tankID) return; + if (ids.length !== 1 || ids[0] !== _tankID) { return; } timeout(function() { var node = selectMenuItem(context, 'circularize').node(); - if (!node) return; + if (!node) { return; } continueTo(clickCircle); }, 50); // after menu visible }); @@ -80582,9 +80667,9 @@ function clickCircle() { - if (!_tankID) return chapter.restart(); + if (!_tankID) { return chapter.restart(); } var entity = context.hasEntity(_tankID); - if (!entity) return continueTo(rightClickTank); + if (!entity) { return continueTo(rightClickTank); } var node = selectMenuItem(context, 'circularize').node(); if (!node) { return continueTo(rightClickTank); } @@ -80771,7 +80856,7 @@ return utilRebind(chapter, dispatch$1, 'on'); } - const chapterUi = { + var chapterUi = { welcome: uiIntroWelcome, navigation: uiIntroNavigation, point: uiIntroPoint, @@ -80781,7 +80866,7 @@ startEditing: uiIntroStartEditing }; - const chapterFlow = [ + var chapterFlow = [ 'welcome', 'navigation', 'point', @@ -80793,16 +80878,16 @@ function uiIntro(context) { - const INTRO_IMAGERY = 'EsriWorldImageryClarity'; - let _introGraph = {}; - let _currChapter; + var INTRO_IMAGERY = 'EsriWorldImageryClarity'; + var _introGraph = {}; + var _currChapter; function intro(selection) { _mainFileFetcher.get('intro_graph') - .then(dataIntroGraph => { + .then(function (dataIntroGraph) { // create entities for intro graph and localize names - for (let id in dataIntroGraph) { + for (var id in dataIntroGraph) { if (!_introGraph[id]) { _introGraph[id] = osmEntity(localize(dataIntroGraph[id])); } @@ -80817,16 +80902,16 @@ context.enter(modeBrowse(context)); // Save current map state - let osm = context.connection(); - let history = context.history().toJSON(); - let hash = window.location.hash; - let center = context.map().center(); - let zoom = context.map().zoom(); - let background = context.background().baseLayerSource(); - let overlays = context.background().overlayLayerSources(); - let opacity = context.container().selectAll('.main-map .layer-background').style('opacity'); - let caches = osm && osm.caches(); - let baseEntities = context.history().graph().base().entities; + var osm = context.connection(); + var history = context.history().toJSON(); + var hash = window.location.hash; + var center = context.map().center(); + var zoom = context.map().zoom(); + var background = context.background().baseLayerSource(); + var overlays = context.background().overlayLayerSources(); + var opacity = context.container().selectAll('.main-map .layer-background').style('opacity'); + var caches = osm && osm.caches(); + var baseEntities = context.history().graph().base().entities; // Show sidebar and disable the sidebar resizing button // (this needs to be before `context.inIntro(true)`) @@ -80843,17 +80928,17 @@ context.history().checkpoint('initial'); // Setup imagery - let imagery = context.background().findSource(INTRO_IMAGERY); + var imagery = context.background().findSource(INTRO_IMAGERY); if (imagery) { context.background().baseLayerSource(imagery); } else { context.background().bing(); } - overlays.forEach(d => context.background().toggleOverlayLayer(d)); + overlays.forEach(function (d) { return context.background().toggleOverlayLayer(d); }); // Setup data layers (only OSM) - let layers = context.layers(); - layers.all().forEach(item => { + var layers = context.layers(); + layers.all().forEach(function (item) { // if the layer has the function `enabled` if (typeof item.layer.enabled === 'function') { item.layer.enabled(item.id === 'osm'); @@ -80863,27 +80948,27 @@ context.container().selectAll('.main-map .layer-background').style('opacity', 1); - let curtain = uiCurtain(context.container().node()); + var curtain = uiCurtain(context.container().node()); selection.call(curtain); // Store that the user started the walkthrough.. corePreferences('walkthrough_started', 'yes'); // Restore previous walkthrough progress.. - let storedProgress = corePreferences('walkthrough_progress') || ''; - let progress = storedProgress.split(';').filter(Boolean); + var storedProgress = corePreferences('walkthrough_progress') || ''; + var progress = storedProgress.split(';').filter(Boolean); - let chapters = chapterFlow.map((chapter, i) => { - let s = chapterUi[chapter](context, curtain.reveal) - .on('done', () => { + var chapters = chapterFlow.map(function (chapter, i) { + var s = chapterUi[chapter](context, curtain.reveal) + .on('done', function () { buttons - .filter(d => d.title === s.title) + .filter(function (d) { return d.title === s.title; }) .classed('finished', true); if (i < chapterFlow.length - 1) { - const next = chapterFlow[i + 1]; - context.container().select(`button.chapter-${next}`) + var next = chapterFlow[i + 1]; + context.container().select(("button.chapter-" + next)) .classed('next', true); } @@ -80894,13 +80979,13 @@ return s; }); - chapters[chapters.length - 1].on('startEditing', () => { + chapters[chapters.length - 1].on('startEditing', function () { // Store walkthrough progress.. progress.push('startEditing'); corePreferences('walkthrough_progress', utilArrayUniq(progress).join(';')); // Store if walkthrough is completed.. - let incomplete = utilArrayDifference(chapterFlow, progress); + var incomplete = utilArrayDifference(chapterFlow, progress); if (!incomplete.length) { corePreferences('walkthrough_completed', 'yes'); } @@ -80912,14 +80997,14 @@ if (osm) { osm.toggle(true).reset().caches(caches); } context.history().reset().merge(Object.values(baseEntities)); context.background().baseLayerSource(background); - overlays.forEach(d => context.background().toggleOverlayLayer(d)); + overlays.forEach(function (d) { return context.background().toggleOverlayLayer(d); }); if (history) { context.history().fromJSON(history, false); } context.map().centerZoom(center, zoom); window.location.replace(hash); context.inIntro(false); }); - let navwrap = selection + var navwrap = selection .append('div') .attr('class', 'intro-nav-wrap fillD'); @@ -80929,21 +81014,21 @@ .append('use') .attr('xlink:href', '#iD-logo-walkthrough'); - let buttonwrap = navwrap + var buttonwrap = navwrap .append('div') .attr('class', 'joined') .selectAll('button.chapter'); - let buttons = buttonwrap + var buttons = buttonwrap .data(chapters) .enter() .append('button') - .attr('class', (d, i) => `chapter chapter-${chapterFlow[i]}`) + .attr('class', function (d, i) { return ("chapter chapter-" + (chapterFlow[i])); }) .on('click', enterChapter); buttons .append('span') - .text(d => _t(d.title)); + .text(function (d) { return _t(d.title); }); buttons .append('span') @@ -80962,7 +81047,7 @@ buttons .classed('next', false) - .classed('active', d => d.title === _currChapter.title); + .classed('active', function (d) { return d.title === _currChapter.title; }); } } @@ -81097,14 +81182,14 @@ function zoomStarted() { - if (_skipEvents) return; + if (_skipEvents) { return; } _tStart = _tCurr = projection.transform(); _gesture = null; } function zoomed() { - if (_skipEvents) return; + if (_skipEvents) { return; } var x = event.transform.x; var y = event.transform.y; @@ -81150,8 +81235,8 @@ function zoomEnded() { - if (_skipEvents) return; - if (_gesture !== 'pan') return; + if (_skipEvents) { return; } + if (_gesture !== 'pan') { return; } updateProjection(); _gesture = null; @@ -81198,7 +81283,7 @@ function redraw() { clearTimeout(_timeoutID); - if (_isHidden) return; + if (_isHidden) { return; } updateProjection(); var zMini = geoScaleToZoom(projection.scale()); @@ -81235,7 +81320,7 @@ var activeOverlayLayers = []; for (var i = 0; i < overlaySources.length; i++) { if (overlaySources[i].validZoom(zMini)) { - if (!overlayLayers[i]) overlayLayers[i] = rendererTileLayer(context); + if (!overlayLayers[i]) { overlayLayers[i] = rendererTileLayer(context); } activeOverlayLayers.push(overlayLayers[i] .source(overlaySources[i]) .projection(projection) @@ -81315,7 +81400,7 @@ function toggle() { - if (event) event.preventDefault(); + if (event) { event.preventDefault(); } _isHidden = !_isHidden; @@ -81485,7 +81570,7 @@ var startHeight; function startResize() { - if (pointerId !== (event.pointerId || 'mouse')) return; + if (pointerId !== (event.pointerId || 'mouse')) { return; } event.preventDefault(); event.stopPropagation(); @@ -81512,7 +81597,7 @@ } function stopResize() { - if (pointerId !== (event.pointerId || 'mouse')) return; + if (pointerId !== (event.pointerId || 'mouse')) { return; } event.preventDefault(); event.stopPropagation(); @@ -81556,8 +81641,7 @@ if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > (mapDimensions[1] - 90)) { var setPhotoDimensions = [ Math.min(photoDimensions[0], mapDimensions[0]), - Math.min(photoDimensions[1], mapDimensions[1] - 90), - ]; + Math.min(photoDimensions[1], mapDimensions[1] - 90) ]; photoviewer .style('width', setPhotoDimensions[0] + 'px') @@ -81572,14 +81656,14 @@ function uiRestore(context) { return function(selection) { - if (!context.history().hasRestorableChanges()) return; + if (!context.history().hasRestorableChanges()) { return; } - let modalSelection = uiModal(selection, true); + var modalSelection = uiModal(selection, true); modalSelection.select('.modal') .attr('class', 'modal fillL'); - let introModal = modalSelection.select('.content'); + var introModal = modalSelection.select('.content'); introModal .append('div') @@ -81593,14 +81677,14 @@ .append('p') .text(_t('restore.description')); - let buttonWrap = introModal + var buttonWrap = introModal .append('div') .attr('class', 'modal-actions'); - let restore = buttonWrap + var restore = buttonWrap .append('button') .attr('class', 'restore') - .on('click', () => { + .on('click', function () { context.history().restore(); modalSelection.remove(); }); @@ -81615,10 +81699,10 @@ .append('div') .text(_t('restore.restore')); - let reset = buttonWrap + var reset = buttonWrap .append('button') .attr('class', 'reset') - .on('click', () => { + .on('click', function () { context.history().clearSaved(); modalSelection.remove(); }); @@ -81986,14 +82070,14 @@ function search(input, dims) { - if (!dims) dims = 'NSEW'; - if (typeof input !== 'string') return null; + if (!dims) { dims = 'NSEW'; } + if (typeof input !== 'string') { return null; } input = input.toUpperCase(); var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/; var m = input.match(regex); - if (!m) return null; // no match + if (!m) { return null; } // no match var matched = m[0]; @@ -82007,14 +82091,14 @@ } // if unrecognized dimension - if (dim && dims.indexOf(dim) === -1) return null; + if (dim && dims.indexOf(dim) === -1) { return null; } // extract DMS var deg = m[2] ? parseFloat(m[2]) : 0; var min = m[3] ? parseFloat(m[3]) / 60 : 0; var sec = m[4] ? parseFloat(m[4]) / 3600 : 0; var sign = (deg < 0) ? -1 : 1; - if (dim === 'S' || dim === 'W') sign *= -1; + if (dim === 'S' || dim === 'W') { sign *= -1; } return { val: (Math.abs(deg) + min + sec) * sign, @@ -82028,11 +82112,11 @@ function pair(input, dims) { input = input.trim(); var one = search(input, dims); - if (!one) return null; + if (!one) { return null; } input = one.remain.trim(); var two = search(input, dims); - if (!two || two.remain) return null; + if (!two || two.remain) { return null; } if (one.dim) { return swapdim(one.val, two.val, one.dim); @@ -82043,8 +82127,8 @@ function swapdim(a, b, dim) { - if (dim === 'N' || dim === 'S') return [a, b]; - if (dim === 'W' || dim === 'E') return [b, a]; + if (dim === 'N' || dim === 'S') { return [a, b]; } + if (dim === 'W' || dim === 'E') { return [b, a]; } } function uiFeatureList(context) { @@ -82095,7 +82179,7 @@ function focusSearch() { var mode = context.mode() && context.mode().id; - if (mode !== 'browse') return; + if (mode !== 'browse') { return; } event.preventDefault(); search.node().focus(); @@ -82143,7 +82227,7 @@ var visibleCenter = context.map().extent().center(); var q = search.property('value').toLowerCase(); - if (!q) return result; + if (!q) { return result; } var idMatch = q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i); @@ -82175,10 +82259,10 @@ var localResults = []; for (var id in allEntities) { var entity = allEntities[id]; - if (!entity) continue; + if (!entity) { continue; } var name = utilDisplayName(entity) || ''; - if (name.toLowerCase().indexOf(q) < 0) continue; + if (name.toLowerCase().indexOf(q) < 0) { continue; } var matched = _mainPresetIndex.match(entity, graph); var type = (matched && matched.name()) || utilDisplayType(entity.id); @@ -82194,7 +82278,7 @@ distance: distance }); - if (localResults.length > 100) break; + if (localResults.length > 100) { break; } } localResults = localResults.sort(function byDistance(a, b) { return a.distance - b.distance; @@ -82345,14 +82429,14 @@ function mouseover(d) { - if (d.id === -1) return; + if (d.id === -1) { return; } utilHighlightEntities([d.id], true, context); } function mouseout(d) { - if (d.id === -1) return; + if (d.id === -1) { return; } utilHighlightEntities([d.id], false, context); } @@ -82575,11 +82659,11 @@ .attr('class', 'issue-fix-item') .on('click', function(d) { // not all fixes are actionable - if (!select(this).classed('actionable') || !d.onClick) return; + if (!select(this).classed('actionable') || !d.onClick) { return; } // Don't run another fix for this issue within a second of running one // (Necessary for "Select a feature type" fix. Most fixes should only ever run once) - if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1000) return; + if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1000) { return; } d.issue.dateLastRanFix = new Date(); // remove hover-highlighting @@ -82633,7 +82717,7 @@ } section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) { _entityIDs = val; _activeIssueID = null; @@ -82646,9 +82730,9 @@ } function uiPresetIcon() { - let _preset; - let _geometry; - let _sizeClass = 'medium'; + var _preset; + var _geometry; + var _sizeClass = 'medium'; function isSmall() { @@ -82663,30 +82747,30 @@ function getIcon(p, geom) { if (isSmall() && p.isFallback && p.isFallback()) - return 'iD-icon-' + p.id; + { return 'iD-icon-' + p.id; } else if (p.icon) - return p.icon; + { return p.icon; } else if (geom === 'line') - return 'iD-other-line'; + { return 'iD-other-line'; } else if (geom === 'vertex') - return p.isFallback() ? '' : 'temaki-vertex'; + { return p.isFallback() ? '' : 'temaki-vertex'; } else if (isSmall() && geom === 'point') - return ''; + { return ''; } else - return 'maki-marker-stroked'; + { return 'maki-marker-stroked'; } } function renderPointBorder(enter) { - const w = 40; - const h = 40; + var w = 40; + var h = 40; enter .append('svg') .attr('class', 'preset-icon-fill preset-icon-point-border') .attr('width', w) .attr('height', h) - .attr('viewBox', `0 0 ${w} ${h}`) + .attr('viewBox', ("0 0 " + w + " " + h)) .append('path') .attr('transform', 'translate(11.5, 8)') .attr('d', 'M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z'); @@ -82694,16 +82778,16 @@ function renderCircleFill(fillEnter) { - const w = 60; - const h = 60; - const d = 40; + var w = 60; + var h = 60; + var d = 40; fillEnter .append('svg') .attr('class', 'preset-icon-fill preset-icon-fill-vertex') .attr('width', w) .attr('height', h) - .attr('viewBox', `0 0 ${w} ${h}`) + .attr('viewBox', ("0 0 " + w + " " + h)) .append('circle') .attr('cx', w / 2) .attr('cy', h / 2) @@ -82712,29 +82796,29 @@ function renderSquareFill(fillEnter) { - const d = isSmall() ? 40 : 60; - const w = d; - const h = d; - const l = d * 2/3; - const c1 = (w-l) / 2; - const c2 = c1 + l; + var d = isSmall() ? 40 : 60; + var w = d; + var h = d; + var l = d * 2/3; + var c1 = (w-l) / 2; + var c2 = c1 + l; fillEnter = fillEnter .append('svg') .attr('class', 'preset-icon-fill preset-icon-fill-area') .attr('width', w) .attr('height', h) - .attr('viewBox', `0 0 ${w} ${h}`); + .attr('viewBox', ("0 0 " + w + " " + h)); - ['fill', 'stroke'].forEach(klass => { + ['fill', 'stroke'].forEach(function (klass) { fillEnter .append('path') - .attr('d', `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`) - .attr('class', `line area ${klass}`); + .attr('d', ("M" + c1 + " " + c1 + " L" + c1 + " " + c2 + " L" + c2 + " " + c2 + " L" + c2 + " " + c1 + " Z")) + .attr('class', ("line area " + klass)); }); - const rVertex = 2.5; - [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach(point => { + var rVertex = 2.5; + [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach(function (point) { fillEnter .append('circle') .attr('class', 'vertex') @@ -82744,8 +82828,8 @@ }); if (!isSmall()) { - const rMidpoint = 1.25; - [[c1, w/2], [c2, w/2], [h/2, c1], [h/2, c2]].forEach(point => { + var rMidpoint = 1.25; + [[c1, w/2], [c2, w/2], [h/2, c1], [h/2, c2]].forEach(function (point) { fillEnter .append('circle') .attr('class', 'midpoint') @@ -82758,31 +82842,31 @@ function renderLine(lineEnter) { - const d = isSmall() ? 40 : 60; + var d = isSmall() ? 40 : 60; // draw the line parametrically - const w = d; - const h = d; - const y = Math.round(d * 0.72); - const l = Math.round(d * 0.6); - const r = 2.5; - const x1 = (w - l) / 2; - const x2 = x1 + l; + var w = d; + var h = d; + var y = Math.round(d * 0.72); + var l = Math.round(d * 0.6); + var r = 2.5; + var x1 = (w - l) / 2; + var x2 = x1 + l; lineEnter = lineEnter .append('svg') .attr('class', 'preset-icon-line') .attr('width', w) .attr('height', h) - .attr('viewBox', `0 0 ${w} ${h}`); + .attr('viewBox', ("0 0 " + w + " " + h)); - ['casing', 'stroke'].forEach(klass => { + ['casing', 'stroke'].forEach(function (klass) { lineEnter .append('path') - .attr('d', `M${x1} ${y} L${x2} ${y}`) - .attr('class', `line ${klass}`); + .attr('d', ("M" + x1 + " " + y + " L" + x2 + " " + y)) + .attr('class', ("line " + klass)); }); - [[x1-1, y], [x2+1, y]].forEach(point => { + [[x1-1, y], [x2+1, y]].forEach(function (point) { lineEnter .append('circle') .attr('class', 'vertex') @@ -82794,42 +82878,42 @@ function renderRoute(routeEnter) { - const d = isSmall() ? 40 : 60; + var d = isSmall() ? 40 : 60; // draw the route parametrically - const w = d; - const h = d; - const y1 = Math.round(d * 0.80); - const y2 = Math.round(d * 0.68); - const l = Math.round(d * 0.6); - const r = 2; - const x1 = (w - l) / 2; - const x2 = x1 + l / 3; - const x3 = x2 + l / 3; - const x4 = x3 + l / 3; + var w = d; + var h = d; + var y1 = Math.round(d * 0.80); + var y2 = Math.round(d * 0.68); + var l = Math.round(d * 0.6); + var r = 2; + var x1 = (w - l) / 2; + var x2 = x1 + l / 3; + var x3 = x2 + l / 3; + var x4 = x3 + l / 3; routeEnter = routeEnter .append('svg') .attr('class', 'preset-icon-route') .attr('width', w) .attr('height', h) - .attr('viewBox', `0 0 ${w} ${h}`); + .attr('viewBox', ("0 0 " + w + " " + h)); - ['casing', 'stroke'].forEach(klass => { + ['casing', 'stroke'].forEach(function (klass) { routeEnter .append('path') - .attr('d', `M${x1} ${y1} L${x2} ${y2}`) - .attr('class', `segment0 line ${klass}`); + .attr('d', ("M" + x1 + " " + y1 + " L" + x2 + " " + y2)) + .attr('class', ("segment0 line " + klass)); routeEnter .append('path') - .attr('d', `M${x2} ${y2} L${x3} ${y1}`) - .attr('class', `segment1 line ${klass}`); + .attr('d', ("M" + x2 + " " + y2 + " L" + x3 + " " + y1)) + .attr('class', ("segment1 line " + klass)); routeEnter .append('path') - .attr('d', `M${x3} ${y1} L${x4} ${y2}`) - .attr('class', `segment2 line ${klass}`); + .attr('d', ("M" + x3 + " " + y1 + " L" + x4 + " " + y2)) + .attr('class', ("segment2 line " + klass)); }); - [[x1, y1], [x2, y2], [x3, y1], [x4, y2]].forEach(point => { + [[x1, y1], [x2, y2], [x3, y1], [x4, y2]].forEach(function (point) { routeEnter .append('circle') .attr('class', 'vertex') @@ -82845,7 +82929,7 @@ // / \ / // o o // This dataset defines the styles that are used to draw the zigzag segments. - const routeSegments = { + var routeSegments = { bicycle: ['highway/cycleway', 'highway/cycleway', 'highway/cycleway'], bus: ['highway/unclassified', 'highway/secondary', 'highway/primary'], trolleybus: ['highway/unclassified', 'highway/secondary', 'highway/primary'], @@ -82868,45 +82952,45 @@ function render() { - let p = _preset.apply(this, arguments); - let geom = _geometry ? _geometry.apply(this, arguments) : null; + var p = _preset.apply(this, arguments); + var geom = _geometry ? _geometry.apply(this, arguments) : null; if (geom === 'relation' && p.tags && ((p.tags.type === 'route' && p.tags.route && routeSegments[p.tags.route]) || p.tags.type === 'waterway')) { geom = 'route'; } - const showThirdPartyIcons = corePreferences('preferences.privacy.thirdpartyicons') || 'true'; - const isFallback = isSmall() && p.isFallback && p.isFallback(); - const imageURL = (showThirdPartyIcons === 'true') && p.imageURL; - const picon = getIcon(p, geom); - const isMaki = picon && /^maki-/.test(picon); - const isTemaki = picon && /^temaki-/.test(picon); - const isFa = picon && /^fa[srb]-/.test(picon); - const isTnp = picon && /^tnp-/.test(picon); - const isiDIcon = picon && !(isMaki || isTemaki || isFa || isTnp); - const isCategory = !p.setTags; - const drawPoint = picon && geom === 'point' && isSmall() && !isFallback; - const drawVertex = picon !== null && geom === 'vertex' && (!isSmall() || !isFallback); - const drawLine = picon && geom === 'line' && !isFallback && !isCategory; - const drawArea = picon && geom === 'area' && !isFallback; - const drawRoute = picon && geom === 'route'; - const isFramed = (drawVertex || drawArea || drawLine || drawRoute); - - let tags = !isCategory ? p.setTags({}, geom) : {}; - for (let k in tags) { + var showThirdPartyIcons = corePreferences('preferences.privacy.thirdpartyicons') || 'true'; + var isFallback = isSmall() && p.isFallback && p.isFallback(); + var imageURL = (showThirdPartyIcons === 'true') && p.imageURL; + var picon = getIcon(p, geom); + var isMaki = picon && /^maki-/.test(picon); + var isTemaki = picon && /^temaki-/.test(picon); + var isFa = picon && /^fa[srb]-/.test(picon); + var isTnp = picon && /^tnp-/.test(picon); + var isiDIcon = picon && !(isMaki || isTemaki || isFa || isTnp); + var isCategory = !p.setTags; + var drawPoint = picon && geom === 'point' && isSmall() && !isFallback; + var drawVertex = picon !== null && geom === 'vertex' && (!isSmall() || !isFallback); + var drawLine = picon && geom === 'line' && !isFallback && !isCategory; + var drawArea = picon && geom === 'area' && !isFallback; + var drawRoute = picon && geom === 'route'; + var isFramed = (drawVertex || drawArea || drawLine || drawRoute); + + var tags = !isCategory ? p.setTags({}, geom) : {}; + for (var k in tags) { if (tags[k] === '*') { tags[k] = 'yes'; } } - let tagClasses = svgTagClasses().getClassesString(tags, ''); - let selection = select(this); + var tagClasses = svgTagClasses().getClassesString(tags, ''); + var selection = select(this); - let container = selection.selectAll('.preset-icon-container') + var container = selection.selectAll('.preset-icon-container') .data([0]); container = container.enter() .append('div') - .attr('class', `preset-icon-container ${_sizeClass}`) + .attr('class', ("preset-icon-container " + _sizeClass)) .merge(container); container @@ -82914,85 +82998,85 @@ .classed('fallback', isFallback); - let pointBorder = container.selectAll('.preset-icon-point-border') + var pointBorder = container.selectAll('.preset-icon-point-border') .data(drawPoint ? [0] : []); pointBorder.exit() .remove(); - let pointBorderEnter = pointBorder.enter(); + var pointBorderEnter = pointBorder.enter(); renderPointBorder(pointBorderEnter); pointBorder = pointBorderEnter.merge(pointBorder); - let vertexFill = container.selectAll('.preset-icon-fill-vertex') + var vertexFill = container.selectAll('.preset-icon-fill-vertex') .data(drawVertex ? [0] : []); vertexFill.exit() .remove(); - let vertexFillEnter = vertexFill.enter(); + var vertexFillEnter = vertexFill.enter(); renderCircleFill(vertexFillEnter); vertexFill = vertexFillEnter.merge(vertexFill); - let fill = container.selectAll('.preset-icon-fill-area') + var fill = container.selectAll('.preset-icon-fill-area') .data(drawArea ? [0] : []); fill.exit() .remove(); - let fillEnter = fill.enter(); + var fillEnter = fill.enter(); renderSquareFill(fillEnter); fill = fillEnter.merge(fill); fill.selectAll('path.stroke') - .attr('class', `area stroke ${tagClasses}`); + .attr('class', ("area stroke " + tagClasses)); fill.selectAll('path.fill') - .attr('class', `area fill ${tagClasses}`); + .attr('class', ("area fill " + tagClasses)); - let line = container.selectAll('.preset-icon-line') + var line = container.selectAll('.preset-icon-line') .data(drawLine ? [0] : []); line.exit() .remove(); - let lineEnter = line.enter(); + var lineEnter = line.enter(); renderLine(lineEnter); line = lineEnter.merge(line); line.selectAll('path.stroke') - .attr('class', `line stroke ${tagClasses}`); + .attr('class', ("line stroke " + tagClasses)); line.selectAll('path.casing') - .attr('class', `line casing ${tagClasses}`); + .attr('class', ("line casing " + tagClasses)); - let route = container.selectAll('.preset-icon-route') + var route = container.selectAll('.preset-icon-route') .data(drawRoute ? [0] : []); route.exit() .remove(); - let routeEnter = route.enter(); + var routeEnter = route.enter(); renderRoute(routeEnter); route = routeEnter.merge(route); if (drawRoute) { - let routeType = p.tags.type === 'waterway' ? 'waterway' : p.tags.route; - const segmentPresetIDs = routeSegments[routeType]; - for (let i in segmentPresetIDs) { - const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i]); - const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, ''); - route.selectAll(`path.stroke.segment${i}`) - .attr('class', `segment${i} line stroke ${segmentTagClasses}`); - route.selectAll(`path.casing.segment${i}`) - .attr('class', `segment${i} line casing ${segmentTagClasses}`); + var routeType = p.tags.type === 'waterway' ? 'waterway' : p.tags.route; + var segmentPresetIDs = routeSegments[routeType]; + for (var i in segmentPresetIDs) { + var segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i]); + var segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, ''); + route.selectAll(("path.stroke.segment" + i)) + .attr('class', ("segment" + i + " line stroke " + segmentTagClasses)); + route.selectAll(("path.casing.segment" + i)) + .attr('class', ("segment" + i + " line casing " + segmentTagClasses)); } } - let icon = container.selectAll('.preset-icon') + var icon = container.selectAll('.preset-icon') .data(picon ? [0] : []); icon.exit() @@ -83015,7 +83099,7 @@ icon.selectAll('use') .attr('href', '#' + picon + (isMaki ? (isSmall() && geom === 'point' ? '-11' : '-15') : '')); - let imageIcon = container.selectAll('img.image-icon') + var imageIcon = container.selectAll('img.image-icon') .data(imageURL ? [0] : []); imageIcon.exit() @@ -83024,8 +83108,8 @@ imageIcon = imageIcon.enter() .append('img') .attr('class', 'image-icon') - .on('load', () => container.classed('showing-img', true) ) - .on('error', () => container.classed('showing-img', false) ) + .on('load', function () { return container.classed('showing-img', true); } ) + .on('error', function () { return container.classed('showing-img', false); } ) .merge(imageIcon); imageIcon @@ -83034,21 +83118,21 @@ presetIcon.preset = function(val) { - if (!arguments.length) return _preset; + if (!arguments.length) { return _preset; } _preset = utilFunctor(val); return presetIcon; }; presetIcon.geometry = function(val) { - if (!arguments.length) return _geometry; + if (!arguments.length) { return _geometry; } _geometry = utilFunctor(val); return presetIcon; }; presetIcon.sizeClass = function(val) { - if (!arguments.length) return _sizeClass; + if (!arguments.length) { return _sizeClass; } _sizeClass = val; return presetIcon; }; @@ -83156,13 +83240,13 @@ } section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return section; }; section.presets = function(val) { - if (!arguments.length) return _presets; + if (!arguments.length) { return _presets; } // don't reload the same preset if (!utilArrayIdentical(val, _presets)) { @@ -83184,7 +83268,7 @@ for (var i in _entityIDs) { var geometry = context.graph().geometry(_entityIDs[i]); - if (!counts[geometry]) counts[geometry] = 0; + if (!counts[geometry]) { counts[geometry] = 0; } counts[geometry] += 1; } @@ -83327,7 +83411,7 @@ fieldHelp.button = function(selection) { - if (_body.empty()) return; + if (_body.empty()) { return; } var button = selection.selectAll('.field-help-button') .data([0]); @@ -83365,11 +83449,11 @@ fieldHelp.body = function(selection) { // This control expects the field to have a form-field-input-wrap div _wrap = selection.selectAll('.form-field-input-wrap'); - if (_wrap.empty()) return; + if (_wrap.empty()) { return; } // absolute position relative to the inspector, so it "floats" above the fields _inspector = context.container().select('.sidebar .entity-editor-pane .inspector-body'); - if (_inspector.empty()) return; + if (_inspector.empty()) { return; } _body = _inspector.selectAll('.field-help-body') .data([0]); @@ -83481,14 +83565,14 @@ function reverserHidden() { - if (!context.container().select('div.inspector-hover').empty()) return true; + if (!context.container().select('div.inspector-hover').empty()) { return true; } return !(_value === 'yes' || (_impliedYes && !_value)); } function reverserSetText(selection) { var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]); - if (reverserHidden() || !entity) return selection; + if (reverserHidden() || !entity) { return selection; } var first = entity.first(); var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last(); @@ -83590,7 +83674,7 @@ check.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return check; }; @@ -83605,7 +83689,7 @@ } function textFor(val) { - if (val === '') val = undefined; + if (val === '') { val = undefined; } var index = values.indexOf(val); return (index !== -1 ? texts[index] : ('"' + val + '"')); } @@ -83773,7 +83857,7 @@ function setStaticValues(callback) { - if (!(optstrings || optarray)) return; + if (!(optstrings || optarray)) { return; } if (optstrings) { _comboData = Object.keys(optstrings).map(function(k) { @@ -83797,7 +83881,7 @@ } combobox.data(objectDifference(_comboData, _multiData)); - if (callback) callback(_comboData); + if (callback) { callback(_comboData); } } @@ -83820,7 +83904,7 @@ } taginfo[fn](params, function(err, data) { - if (err) return; + if (err) { return; } data = data.filter(function(d) { @@ -83852,7 +83936,7 @@ _comboData = data.map(function(d) { var k = d.value; - if (isMulti) k = k.replace(field.key, ''); + if (isMulti) { k = k.replace(field.key, ''); } var v = snake_case ? unsnake(k) : k; return { key: k, @@ -83862,7 +83946,7 @@ }); _comboData = objectDifference(_comboData, _multiData); - if (callback) callback(_comboData); + if (callback) { callback(_comboData); } }); } @@ -83906,7 +83990,7 @@ utilGetSetValue(input, ''); var vals = val.split(';').filter(Boolean); - if (!vals.length) return; + if (!vals.length) { return; } if (isMulti) { utilArrayUniq(vals).forEach(function(v) { @@ -83915,7 +83999,7 @@ // don't set a multicombo value to 'yes' if it already has a non-'no' value // e.g. `language:de=main` var old = _tags[key]; - if (typeof old === 'string' && old.toLowerCase() !== 'no') return; + if (typeof old === 'string' && old.toLowerCase() !== 'no') { return; } } key = context.cleanTagKey(key); field.keys.push(key); @@ -83934,7 +84018,7 @@ var rawValue = utilGetSetValue(input); // don't override multiple values with blank string - if (!rawValue && Array.isArray(_tags[field.key])) return; + if (!rawValue && Array.isArray(_tags[field.key])) { return; } val = context.cleanTagValue(tagValue(rawValue)); t[field.key] = val || undefined; @@ -84059,9 +84143,9 @@ if (isMulti) { // Build _multiData array containing keys already set.. for (var k in tags) { - if (k.indexOf(field.key) !== 0) continue; + if (k.indexOf(field.key) !== 0) { continue; } var v = tags[k]; - if (!v || (typeof v === 'string' && v.toLowerCase() === 'no')) continue; + if (!v || (typeof v === 'string' && v.toLowerCase() === 'no')) { continue; } var suffix = k.substring(field.key.length); _multiData.push({ @@ -84089,7 +84173,7 @@ if (!commonValues) { commonValues = thisVals; } else { - commonValues = commonValues.filter(value => thisVals.includes(value)); + commonValues = commonValues.filter(function (value) { return thisVals.includes(value); }); } }); allValues = utilArrayUniq(allValues).filter(Boolean); @@ -84203,7 +84287,7 @@ if (!select(this).classed('dragging') && // don't display drag until dragging beyond a distance threshold - Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) return; + Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) { return; } select(this) .classed('dragging', true); @@ -84311,7 +84395,7 @@ combo.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return combo; }; @@ -84440,12 +84524,12 @@ function updatePhonePlaceholder() { - if (input.empty() || !Object.keys(_phoneFormats).length) return; + if (input.empty() || !Object.keys(_phoneFormats).length) { return; } var extent = combinedEntityExtent(); var countryCode = extent && iso1A2Code(extent.center()); var format = countryCode && _phoneFormats[countryCode.toLowerCase()]; - if (format) input.attr('placeholder', format); + if (format) { input.attr('placeholder', format); } } @@ -84474,10 +84558,10 @@ return function() { var t = {}; var val = utilGetSetValue(input); - if (!onInput) val = context.cleanTagValue(val); + if (!onInput) { val = context.cleanTagValue(val); } // don't override multiple values with blank string - if (!val && Array.isArray(_tags[field.key])) return; + if (!val && Array.isArray(_tags[field.key])) { return; } if (!onInput) { if (field.type === 'number' && val) { @@ -84497,7 +84581,7 @@ i.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return i; }; @@ -84522,7 +84606,7 @@ i.focus = function() { var node = input.node(); - if (node) node.focus(); + if (node) { node.focus(); } }; function combinedEntityExtent() { @@ -84598,7 +84682,7 @@ var value = context.cleanTagValue(utilGetSetValue(select(this))); // don't override multiple values with blank string - if (!value && typeof _tags[d] !== 'string') return; + if (!value && typeof _tags[d] !== 'string') { return; } tag[d] = value || undefined; dispatch$1.call('change', this, tag); @@ -84867,15 +84951,15 @@ function isAddressable(d) { if (d.tags.name) { if (d.tags.admin_level === '8' && d.tags.boundary === 'administrative') - return true; + { return true; } if (d.tags.border_type === 'city') - return true; + { return true; } if (d.tags.place === 'city' || d.tags.place === 'town' || d.tags.place === 'village') - return true; + { return true; } } if (d.tags['addr:city']) - return true; + { return true; } return false; } @@ -84905,7 +84989,7 @@ function updateForCountryCode() { - if (!_countryCode) return; + if (!_countryCode) { return; } var addressFormat; for (var i = 0; i < _addressFormats.length; i++) { @@ -84968,7 +85052,7 @@ function addDropdown(d) { - if (dropdowns.indexOf(d.id) === -1) return; // not a dropdown + if (dropdowns.indexOf(d.id) === -1) { return; } // not a dropdown var nearValues = (d.id === 'street') ? getNearStreets : (d.id === 'city') ? getNearCities @@ -84991,7 +85075,7 @@ _wrap.selectAll('input:not(.combobox-input)') .on('input', change(true)); - if (_tags) updateTags(_tags); + if (_tags) { updateTags(_tags); } } @@ -85034,10 +85118,10 @@ var key = field.key + ':' + subfield.id; var value = this.value; - if (!onInput) value = context.cleanTagValue(value); + if (!onInput) { value = context.cleanTagValue(value); } // don't override multiple values with blank string - if (Array.isArray(_tags[key]) && !value) return; + if (Array.isArray(_tags[key]) && !value) { return; } tags[key] = value || undefined; }); @@ -85082,7 +85166,7 @@ address.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return address; }; @@ -85096,7 +85180,7 @@ address.focus = function() { var node = _wrap.selectAll('input').node(); - if (node) node.focus(); + if (node) { node.focus(); } }; @@ -85176,7 +85260,7 @@ var newValue = context.cleanTagValue(utilGetSetValue(select(this))); // don't override multiple values with blank string - if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key]))) return; + if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key]))) { return; } if (newValue === 'none' || newValue === '') { newValue = undefined; } @@ -85228,7 +85312,7 @@ var commonValue = typeof tags.cycleway === 'string' && tags.cycleway; utilGetSetValue(items.selectAll('.preset-input-cycleway'), function(d) { - if (commonValue) return commonValue; + if (commonValue) { return commonValue; } return !tags.cycleway && typeof tags[d] === 'string' ? tags[d] : ''; }) .attr('title', function(d) { @@ -85258,7 +85342,7 @@ cycleway.focus = function() { var node = wrap.selectAll('input').node(); - if (node) node.focus(); + if (node) { node.focus(); } }; @@ -85443,7 +85527,7 @@ function loadLanguagesArray(dataLanguages) { - if (_languagesArray.length !== 0) return; + if (_languagesArray.length !== 0) { return; } // some conversion is needed to ensure correct OSM tags are used var replacements = { @@ -85452,9 +85536,9 @@ }; for (var code in dataLanguages) { - if (replacements[code] === false) continue; + if (replacements[code] === false) { continue; } var metaCode = code; - if (replacements[code]) metaCode = replacements[code]; + if (replacements[code]) { metaCode = replacements[code]; } _languagesArray.push({ localName: _mainLocalizer.languageName(metaCode, { localOnly: true }), @@ -85475,18 +85559,18 @@ _entityIDs.some(function(entityID) { var entity = context.graph().hasEntity(entityID); - if (!entity) return false; + if (!entity) { return false; } var original = context.graph().base().entities[_entityIDs[0]]; var hasOriginalName = original && entity.tags.name && entity.tags.name === original.tags.name; // if the name was already edited manually then allow further editing - if (!hasOriginalName) return false; + if (!hasOriginalName) { return false; } // features linked to Wikidata are likely important and should be protected - if (entity.tags.wikidata) return true; + if (entity.tags.wikidata) { return true; } // assume the name has already been confirmed if its source has been researched - if (entity.tags['name:etymology:wikidata']) return true; + if (entity.tags['name:etymology:wikidata']) { return true; } var preset = _mainPresetIndex.match(entity, context.graph()); var isSuggestion = preset && preset.suggestion; @@ -85569,7 +85653,7 @@ // - false = churches, parks, hospitals, etc. (things not in the index) var isFallback = preset.isFallback(); var goodSuggestions = allSuggestions.filter(function(s) { - if (isFallback) return true; + if (isFallback) { return true; } var sTag = s.id.split('/', 2); var sKey = sTag[0]; var sValue = sTag[1]; @@ -85639,10 +85723,10 @@ // So compare the current field value against the suggestions one last time. function checkBrandOnBlur() { var latest = _entityIDs.length === 1 && context.hasEntity(_entityIDs[0]); - if (!latest) return; // deleting the entity blurred the field? + if (!latest) { return; } // deleting the entity blurred the field? var preset = _mainPresetIndex.match(latest, context.graph()); - if (preset && preset.suggestion) return; // already accepted + if (preset && preset.suggestion) { return; } // already accepted // note: here we are testing against "decorated" names, i.e. 'Starbucks – Cafe' var name = utilGetSetValue(input).trim(); @@ -85712,7 +85796,7 @@ // don't suggest brands from incompatible countries if (_countryCode && s.countryCodes && - s.countryCodes.indexOf(_countryCode) === -1) continue; + s.countryCodes.indexOf(_countryCode) === -1) { continue; } var sTag = s.id.split('/', 2); var sKey = sTag[0]; @@ -85741,7 +85825,7 @@ function addNew() { event.preventDefault(); - if (field.locked()) return; + if (field.locked()) { return; } var defaultLang = _mainLocalizer.languageCode().toLowerCase(); var langExists = _multilingual.find(function(datum) { return datum.lang === defaultLang; }); @@ -85769,10 +85853,10 @@ } var val = utilGetSetValue(select(this)); - if (!onInput) val = context.cleanTagValue(val); + if (!onInput) { val = context.cleanTagValue(val); } // don't override multiple values with blank string - if (!val && Array.isArray(_tags[field.key])) return; + if (!val && Array.isArray(_tags[field.key])) { return; } var t = {}; @@ -85799,7 +85883,7 @@ (d.localName && d.localName.toLowerCase() === lang) || (d.nativeName && d.nativeName.toLowerCase() === lang); }); - if (language) lang = language.code; + if (language) { lang = language.code; } if (d.lang && d.lang !== lang) { tags[key(d.lang)] = undefined; @@ -85821,11 +85905,11 @@ function changeValue(d) { - if (!d.lang) return; + if (!d.lang) { return; } var value = context.cleanTagValue(utilGetSetValue(select(this))) || undefined; // don't override multiple values with blank string - if (!value && Array.isArray(d.value)) return; + if (!value && Array.isArray(d.value)) { return; } var t = {}; t[key(d.lang)] = value; @@ -85849,7 +85933,7 @@ var langItem = _languagesArray.find(function(item) { return item.code === code; }); - if (langItem) langItems.push(langItem); + if (langItem) { langItems.push(langItem); } }); langItems = utilArrayUniq(langItems.concat(_languagesArray)); @@ -85907,7 +85991,7 @@ .append('button') .attr('class', 'remove-icon-multilingual') .on('click', function(d, index) { - if (field.locked()) return; + if (field.locked()) { return; } event.preventDefault(); if (!d.lang || !d.value) { @@ -85992,7 +86076,7 @@ var wm = tags.wikipedia.match(/([^:]+):(.+)/); if (wm && wm[0] && wm[1]) { wikipedia.translations(wm[1], wm[2], function(err, d) { - if (err || !d) return; + if (err || !d) { return; } _wikiTitles = d; }); } @@ -86018,7 +86102,7 @@ localized.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; _multilingual = []; loadCountryCode(); @@ -86127,7 +86211,7 @@ var value = utilGetSetValue(input).trim(); // don't override multiple values with blank string - if (!value && Array.isArray(_tags[field.key])) return; + if (!value && Array.isArray(_tags[field.key])) { return; } if (!value) { tag[field.key] = undefined; @@ -86366,7 +86450,7 @@ function changeType(t, onInput) { var key = selectedKey(); - if (!key) return; + if (!key) { return; } var val = t[key]; if (val !== 'no') { @@ -86413,10 +86497,10 @@ radios.each(function(d) { var active = select(this).property('checked'); - if (active) activeKey = d; + if (active) { activeKey = d; } if (field.key) { - if (active) t[field.key] = d; + if (active) { t[field.key] = d; } } else { var val = _oldType[activeKey] || 'yes'; t[d] = active ? val : undefined; @@ -86494,7 +86578,7 @@ radio.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; _oldType = {}; return radio; @@ -86693,7 +86777,7 @@ function renderViewer(selection) { - if (!_intersection) return; + if (!_intersection) { return; } var vgraph = _intersection.graph; var filter = utilFunctor(true); @@ -86836,7 +86920,7 @@ _oldTurns = []; for (i = 0; i < turns.length; i++) { var turn = turns[i]; - if (seen[turn.restrictionID]) continue; // avoid deleting the turn twice (#4968, #4928) + if (seen[turn.restrictionID]) { continue; } // avoid deleting the turn twice (#4968, #4928) if (turn.direct && turn.path[1] === datum.path[1]) { seen[turns[i].restrictionID] = true; @@ -87029,7 +87113,7 @@ var prev = names[names.length - 1]; var curr = displayName(datum.via.ways[i], vgraph); if (!prev || curr !== prev) // collapse identical names - names.push(curr); + { names.push(curr); } } help @@ -87124,7 +87208,7 @@ restrictions.off = function(selection) { - if (!_initialized) return; + if (!_initialized) { return; } selection.selectAll('.surface') .call(breathe.off) @@ -87174,10 +87258,10 @@ return function() { var val = utilGetSetValue(input); - if (!onInput) val = context.cleanTagValue(val); + if (!onInput) { val = context.cleanTagValue(val); } // don't override multiple values with blank string - if (!val && Array.isArray(_tags[field.key])) return; + if (!val && Array.isArray(_tags[field.key])) { return; } var t = {}; t[field.key] = val || undefined; @@ -87284,7 +87368,7 @@ .call(svgIcon('#iD-icon-out-link')) .on('click', function() { event.preventDefault(); - if (_wikiURL) window.open(_wikiURL, '_blank'); + if (_wikiURL) { window.open(_wikiURL, '_blank'); } }); searchRow = searchRow.merge(searchRowEnter); @@ -87344,14 +87428,14 @@ } wikidata.itemsForSearchQuery(q, function(err, data) { - if (err) return; + if (err) { return; } for (var i in data) { data[i].value = data[i].label + ' (' + data[i].id + ')'; data[i].title = data[i].description; } - if (callback) callback(data); + if (callback) { callback(data); } }); } @@ -87366,20 +87450,20 @@ var initEntityIDs = _entityIDs; wikidata.entityByQID(_qid, function(err, entity) { - if (err) return; + if (err) { return; } // If graph has changed, we can't apply this update. - if (context.graph() !== initGraph) return; + if (context.graph() !== initGraph) { return; } - if (!entity.sitelinks) return; + if (!entity.sitelinks) { return; } var langs = wikidata.languagesToQuery(); // use the label and description languages as fallbacks ['labels', 'descriptions'].forEach(function(key) { - if (!entity[key]) return; + if (!entity[key]) { return; } var valueLangs = Object.keys(entity[key]); - if (valueLangs.length === 0) return; + if (valueLangs.length === 0) { return; } var valueLang = valueLangs[0]; if (langs.indexOf(valueLang) === -1) { @@ -87425,15 +87509,15 @@ newWikipediaValue = context.cleanTagValue(newWikipediaValue); } - if (typeof newWikipediaValue === 'undefined') return; + if (typeof newWikipediaValue === 'undefined') { return; } var actions = initEntityIDs.map(function(entityID) { var entity = context.hasEntity(entityID); - if (!entity) return; + if (!entity) { return; } var currTags = Object.assign({}, entity.tags); // shallow copy if (newWikipediaValue === null) { - if (!currTags[_wikipediaKey]) return; + if (!currTags[_wikipediaKey]) { return; } delete currTags[_wikipediaKey]; } else { @@ -87443,7 +87527,7 @@ return actionChangeTags(entityID, currTags); }).filter(Boolean); - if (!actions.length) return; + if (!actions.length) { return; } // Coalesce the update of wikidata tag into the previous tag change context.overwrite( @@ -87542,16 +87626,16 @@ }; function entityPropertyForDisplay(wikidataEntity, propKey) { - if (!wikidataEntity[propKey]) return ''; + if (!wikidataEntity[propKey]) { return ''; } var propObj = wikidataEntity[propKey]; var langKeys = Object.keys(propObj); - if (langKeys.length === 0) return ''; + if (langKeys.length === 0) { return ''; } // sorted by priority, since we want to show the user's language first if possible var langs = wikidata.languagesToQuery(); for (var i in langs) { var lang = langs[i]; var valueObj = propObj[lang]; - if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj.value; + if (valueObj && valueObj.value && valueObj.value.length > 0) { return valueObj.value; } } // default to any available value return propObj[langKeys[0]].value; @@ -87559,7 +87643,7 @@ wiki.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return wiki; }; @@ -87574,67 +87658,69 @@ } function uiFieldWikipedia(field, context) { - const dispatch$1 = dispatch('change'); - const wikipedia = services.wikipedia; - const wikidata = services.wikidata; - let _langInput = select(null); - let _titleInput = select(null); - let _wikiURL = ''; - let _entityIDs; - let _tags; - - let _dataWikipedia = []; + var arguments$1 = arguments; + + var dispatch$1 = dispatch('change'); + var wikipedia = services.wikipedia; + var wikidata = services.wikidata; + var _langInput = select(null); + var _titleInput = select(null); + var _wikiURL = ''; + var _entityIDs; + var _tags; + + var _dataWikipedia = []; _mainFileFetcher.get('wmf_sitematrix') - .then(d => { + .then(function (d) { _dataWikipedia = d; - if (_tags) updateForTags(_tags); + if (_tags) { updateForTags(_tags); } }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); - const langCombo = uiCombobox(context, 'wikipedia-lang') - .fetcher((value, callback) => { - const v = value.toLowerCase(); + var langCombo = uiCombobox(context, 'wikipedia-lang') + .fetcher(function (value, callback) { + var v = value.toLowerCase(); callback(_dataWikipedia - .filter(d => { + .filter(function (d) { return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0; }) - .map(d => ({ value: d[1] })) + .map(function (d) { return ({ value: d[1] }); }) ); }); - const titleCombo = uiCombobox(context, 'wikipedia-title') - .fetcher((value, callback) => { + var titleCombo = uiCombobox(context, 'wikipedia-title') + .fetcher(function (value, callback) { if (!value) { value = ''; - for (let i in _entityIDs) { - let entity = context.hasEntity(_entityIDs[i]); + for (var i in _entityIDs) { + var entity = context.hasEntity(_entityIDs[i]); if (entity.tags.name) { value = entity.tags.name; break; } } } - const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions; - searchfn(language()[2], value, (query, data) => { - callback( data.map(d => ({ value: d })) ); + var searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions; + searchfn(language()[2], value, function (query, data) { + callback( data.map(function (d) { return ({ value: d }); }) ); }); }); function wiki(selection) { - let wrap = selection.selectAll('.form-field-input-wrap') + var wrap = selection.selectAll('.form-field-input-wrap') .data([0]); wrap = wrap.enter() .append('div') - .attr('class', `form-field-input-wrap form-field-input-${field.type}`) + .attr('class', ("form-field-input-wrap form-field-input-" + (field.type))) .merge(wrap); - let langContainer = wrap.selectAll('.wiki-lang-container') + var langContainer = wrap.selectAll('.wiki-lang-container') .data([0]); langContainer = langContainer.enter() @@ -87662,7 +87748,7 @@ .on('change', changeLang); - let titleContainer = wrap.selectAll('.wiki-title-container') + var titleContainer = wrap.selectAll('.wiki-title-container') .data([0]); titleContainer = titleContainer.enter() @@ -87687,7 +87773,7 @@ .on('change', change); - let link = titleContainer.selectAll('.wiki-link') + var link = titleContainer.selectAll('.wiki-link') .data([0]); link = link.enter() @@ -87699,19 +87785,19 @@ .merge(link); link - .on('click', () => { + .on('click', function () { event.preventDefault(); - if (_wikiURL) window.open(_wikiURL, '_blank'); + if (_wikiURL) { window.open(_wikiURL, '_blank'); } }); } function language() { - const value = utilGetSetValue(_langInput).toLowerCase(); - const locale = _mainLocalizer.localeCode().toLowerCase(); - let localeLanguage; - return _dataWikipedia.find(d => { - if (d[2] === locale) localeLanguage = d; + var value = utilGetSetValue(_langInput).toLowerCase(); + var locale = _mainLocalizer.localeCode().toLowerCase(); + var localeLanguage; + return _dataWikipedia.find(function (d) { + if (d[2] === locale) { localeLanguage = d; } return d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value; }) || localeLanguage || ['English', 'English', 'en']; } @@ -87729,16 +87815,16 @@ function change(skipWikidata) { - let value = utilGetSetValue(_titleInput); - const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/); - const l = m && _dataWikipedia.find(d => m[1] === d[2]); - let syncTags = {}; + var value = utilGetSetValue(_titleInput); + var m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/); + var l = m && _dataWikipedia.find(function (d) { return m[1] === d[2]; }); + var syncTags = {}; if (l) { // Normalize title http://www.mediawiki.org/wiki/API:Query#Title_normalization value = decodeURIComponent(m[2]).replace(/_/g, ' '); if (m[3]) { - let anchor; + var anchor; // try { // leave this out for now - #6232 // Best-effort `anchordecode:` implementation @@ -87762,31 +87848,31 @@ dispatch$1.call('change', this, syncTags); - if (skipWikidata || !value || !language()[2]) return; + if (skipWikidata || !value || !language()[2]) { return; } // attempt asynchronous update of wikidata tag.. - const initGraph = context.graph(); - const initEntityIDs = _entityIDs; + var initGraph = context.graph(); + var initEntityIDs = _entityIDs; - wikidata.itemsByTitle(language()[2], value, (err, data) => { - if (err || !data || !Object.keys(data).length) return; + wikidata.itemsByTitle(language()[2], value, function (err, data) { + if (err || !data || !Object.keys(data).length) { return; } // If graph has changed, we can't apply this update. - if (context.graph() !== initGraph) return; + if (context.graph() !== initGraph) { return; } - const qids = Object.keys(data); - const value = qids && qids.find(id => id.match(/^Q\d+$/)); + var qids = Object.keys(data); + var value = qids && qids.find(function (id) { return id.match(/^Q\d+$/); }); - let actions = initEntityIDs.map((entityID) => { - let entity = context.entity(entityID).tags; - let currTags = Object.assign({}, entity); // shallow copy + var actions = initEntityIDs.map(function (entityID) { + var entity = context.entity(entityID).tags; + var currTags = Object.assign({}, entity); // shallow copy if (currTags.wikidata !== value) { currTags.wikidata = value; return actionChangeTags(entityID, currTags); } }).filter(Boolean); - if (!actions.length) return; + if (!actions.length) { return; } // Coalesce the update of wikidata tag into the previous tag change context.overwrite( @@ -87805,17 +87891,17 @@ } - wiki.tags = (tags) => { + wiki.tags = function (tags) { _tags = tags; updateForTags(tags); }; function updateForTags(tags) { - const value = typeof tags[field.key] === 'string' ? tags[field.key] : ''; - const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/); - const l = m && _dataWikipedia.find(d => m[1] === d[2]); - let anchor = m && m[3]; + var value = typeof tags[field.key] === 'string' ? tags[field.key] : ''; + var m = value.match(/([^:]+):([^#]+)(?:#(.+))?/); + var l = m && _dataWikipedia.find(function (d) { return m[1] === d[2]; }); + var anchor = m && m[3]; // value in correct format if (l) { @@ -87837,7 +87923,7 @@ utilGetSetValue(_titleInput, value); if (value && value !== '') { utilGetSetValue(_langInput, ''); - _wikiURL = `https://en.wikipedia.org/wiki/Special:Search?search=${value}`; + _wikiURL = "https://en.wikipedia.org/wiki/Special:Search?search=" + value; } else { _wikiURL = ''; } @@ -87845,14 +87931,14 @@ } - wiki.entityIDs = (val) => { - if (!arguments.length) return _entityIDs; + wiki.entityIDs = function (val) { + if (!arguments$1.length) { return _entityIDs; } _entityIDs = val; return wiki; }; - wiki.focus = () => { + wiki.focus = function () { _titleInput.node().focus(); }; @@ -87939,7 +88025,7 @@ function isModified() { - if (!entityIDs || !entityIDs.length) return false; + if (!entityIDs || !entityIDs.length) { return false; } return entityIDs.some(function(entityID) { var original = context.graph().base().entities[entityID]; var latest = context.graph().entity(entityID); @@ -87968,7 +88054,7 @@ function revert(d) { event.stopPropagation(); event.preventDefault(); - if (!entityIDs || _locked) return; + if (!entityIDs || _locked) { return; } dispatch$1.call('revert', d, d.keys); } @@ -87977,7 +88063,7 @@ function remove(d) { event.stopPropagation(); event.preventDefault(); - if (_locked) return; + if (_locked) { return; } var t = {}; d.keys.forEach(function(key) { @@ -88123,14 +88209,14 @@ field.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } _state = val; return field; }; field.tags = function(val) { - if (!arguments.length) return _tags; + if (!arguments.length) { return _tags; } _tags = val; if (tagsContainFieldKey() && !_show) { @@ -88146,7 +88232,7 @@ field.locked = function(val) { - if (!arguments.length) return _locked; + if (!arguments.length) { return _locked; } _locked = val; return field; }; @@ -88176,20 +88262,20 @@ if (entityIDs && entityIDs.length > 1 && - uiFields[field.type].supportsMultiselection === false) return false; + uiFields[field.type].supportsMultiselection === false) { return false; } if (field.geometry && !entityIDs.every(function(entityID) { return field.matchGeometry(context.graph().geometry(entityID)); - })) return false; + })) { return false; } if (field.countryCodes || field.notCountryCodes) { var extent = combinedEntityExtent(); - if (!extent) return true; + if (!extent) { return true; } var center = extent.center(); var countryCode = iso1A2Code(center); - if (!countryCode) return false; + if (!countryCode) { return false; } countryCode = countryCode.toLowerCase(); @@ -88211,7 +88297,7 @@ var entity = context.graph().entity(entityID); if (prerequisiteTag.key) { var value = entity.tags[prerequisiteTag.key]; - if (!value) return false; + if (!value) { return false; } if (prerequisiteTag.valueNot) { return prerequisiteTag.valueNot !== value; @@ -88220,10 +88306,10 @@ return prerequisiteTag.value === value; } } else if (prerequisiteTag.keyNot) { - if (entity.tags[prerequisiteTag.keyNot]) return false; + if (entity.tags[prerequisiteTag.keyNot]) { return false; } } return true; - })) return false; + })) { return false; } } return true; @@ -88299,8 +88385,8 @@ titles.push(label); var terms = field.terms(); - if (field.key) terms.push(field.key); - if (field.keys) terms = terms.concat(field.keys); + if (field.key) { terms.push(field.key); } + if (field.keys) { terms = terms.concat(field.keys); } return { title: label, @@ -88351,7 +88437,7 @@ .call(moreCombo .data(moreFields) .on('accept', function (d) { - if (!d) return; // user entered something that was not matched + if (!d) { return; } // user entered something that was not matched var field = d.field; field.show(); selection.call(formFields); // rerender @@ -88370,19 +88456,19 @@ formFields.fieldsArr = function(val) { - if (!arguments.length) return _fieldsArr; + if (!arguments.length) { return _fieldsArr; } _fieldsArr = val || []; return formFields; }; formFields.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } _state = val; return formFields; }; formFields.klass = function(val) { - if (!arguments.length) return _klass; + if (!arguments.length) { return _klass; } _klass = val; return formFields; }; @@ -88512,7 +88598,7 @@ } section.presets = function(val) { - if (!arguments.length) return _presets; + if (!arguments.length) { return _presets; } if (!_presets || !val || !utilArrayIdentical(_presets, val)) { _presets = val; _fieldsArr = null; @@ -88521,20 +88607,20 @@ }; section.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } _state = val; return section; }; section.tags = function(val) { - if (!arguments.length) return _tags; + if (!arguments.length) { return _tags; } _tags = val; // Don't reset _fieldsArr here. return section; }; section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) { _entityIDs = val; _fieldsArr = null; @@ -88549,14 +88635,14 @@ var section = uiSection('raw-member-editor', context) .shouldDisplay(function() { - if (!_entityIDs || _entityIDs.length !== 1) return false; + if (!_entityIDs || _entityIDs.length !== 1) { return false; } var entity = context.hasEntity(_entityIDs[0]); return entity && entity.type === 'relation'; }) .title(function() { var entity = context.hasEntity(_entityIDs[0]); - if (!entity) return ''; + if (!entity) { return ''; } var gt = entity.members.length > _maxMembers ? '>' : ''; var count = gt + entity.members.slice(0, _maxMembers).length; @@ -88802,7 +88888,7 @@ if (!select(this).classed('dragging') && // don't display drag until dragging beyond a distance threshold - Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) return; + Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) { return; } select(this) .classed('dragging', true); @@ -88894,7 +88980,7 @@ geometry: geometry, query: role }, function(err, data) { - if (!err) callback(sort(role, data)); + if (!err) { callback(sort(role, data)); } }); }) .on('cancel', function() { @@ -88913,7 +88999,7 @@ } section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return section; }; @@ -88930,7 +89016,7 @@ }) .title(function() { var entity = context.hasEntity(_entityIDs[0]); - if (!entity) return ''; + if (!entity) { return ''; } var parents = context.graph().parentRelations(entity); var gt = parents.length > _maxMemberships ? '>' : ''; @@ -88944,10 +89030,10 @@ .minItems(1) .fetcher(fetchNearbyRelations) .itemsMouseEnter(function(d) { - if (d.relation) utilHighlightEntities([d.relation.id], true, context); + if (d.relation) { utilHighlightEntities([d.relation.id], true, context); } }) .itemsMouseLeave(function(d) { - if (d.relation) utilHighlightEntities([d.relation.id], false, context); + if (d.relation) { utilHighlightEntities([d.relation.id], false, context); } }); var _inChange = false; var _entityIDs = []; @@ -88975,8 +89061,8 @@ function changeRole(d) { - if (d === 0) return; // called on newrow (shoudn't happen) - if (_inChange) return; // avoid accidental recursive call #5731 + if (d === 0) { return; } // called on newrow (shoudn't happen) + if (_inChange) { return; } // avoid accidental recursive call #5731 var oldRole = d.member.role; var newRole = context.cleanRelationRole(select(this).property('value')); @@ -89019,7 +89105,7 @@ function deleteMembership(d) { this.blur(); // avoid keeping focus on the button - if (d === 0) return; // called on newrow (shoudn't happen) + if (d === 0) { return; } // called on newrow (shoudn't happen) // remove the hover-highlight styling utilHighlightEntities([d.relation.id], false, context); @@ -89059,10 +89145,10 @@ } else { context.history().intersects(context.map().extent()).forEach(function(entity) { - if (entity.type !== 'relation' || entity.id === entityID) return; + if (entity.type !== 'relation' || entity.id === entityID) { return; } var value = baseDisplayLabel(entity); - if (q && (value + ' ' + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1) return; + if (q && (value + ' ' + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1) { return; } result.push({ relation: entity, value: value }); }); @@ -89306,7 +89392,7 @@ return; } // remove hover-higlighting - if (d.relation) utilHighlightEntities([d.relation.id], false, context); + if (d.relation) { utilHighlightEntities([d.relation.id], false, context); } var role = context.cleanRelationRole(list.selectAll('.member-row-new .member-role').property('value')); addMembership(d, role); @@ -89350,7 +89436,7 @@ geometry: context.graph().geometry(entityID), query: role }, function(err, data) { - if (!err) callback(sort(role, data)); + if (!err) { callback(sort(role, data)); } }); }) .on('cancel', function() { @@ -89370,7 +89456,7 @@ section.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; _showBlank = false; return section; @@ -89401,7 +89487,7 @@ }); section.entityIDs = function(val) { - if (!arguments.length) return _selectedIDs; + if (!arguments.length) { return _selectedIDs; } _selectedIDs = val; return section; }; @@ -89620,16 +89706,16 @@ .on('change.entity-editor', historyChanged); function historyChanged(difference) { - if (selection.selectAll('.entity-editor').empty()) return; - if (_state === 'hide') return; + if (selection.selectAll('.entity-editor').empty()) { return; } + if (_state === 'hide') { return; } var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion; - if (!significant) return; + if (!significant) { return; } _entityIDs = _entityIDs.filter(context.hasEntity); - if (!_entityIDs.length) return; + if (!_entityIDs.length) { return; } var priorActivePreset = _activePresets.length === 1 && _activePresets[0]; @@ -89664,7 +89750,7 @@ var tags = Object.assign({}, entity.tags); // shallow copy for (var k in changed) { - if (!k) continue; + if (!k) { continue; } var v = changed[k]; if (v !== undefined || tags.hasOwnProperty(k)) { tags[k] = v; @@ -89721,7 +89807,7 @@ var tags = Object.assign({}, entity.tags); // shallow copy for (var k in changed) { - if (!k) continue; + if (!k) { continue; } var v = changed[k]; if (v !== undefined || tags.hasOwnProperty(k)) { tags[k] = v; @@ -89760,22 +89846,22 @@ entityEditor.modified = function(val) { - if (!arguments.length) return _modified; + if (!arguments.length) { return _modified; } _modified = val; return entityEditor; }; entityEditor.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } _state = val; return entityEditor; }; entityEditor.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; - if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor; // exit early if no change + if (!arguments.length) { return _entityIDs; } + if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) { return entityEditor; } // exit early if no change _entityIDs = val; _base = context.graph(); @@ -89789,7 +89875,7 @@ entityEditor.newFeature = function(val) { - if (!arguments.length) return _newFeature; + if (!arguments.length) { return _newFeature; } _newFeature = val; return entityEditor; }; @@ -89803,11 +89889,11 @@ for (var i in _entityIDs) { var entity = graph.hasEntity(_entityIDs[i]); - if (!entity) return; + if (!entity) { return; } var match = _mainPresetIndex.match(entity, graph); - if (!counts[match.id]) counts[match.id] = 0; + if (!counts[match.id]) { counts[match.id] = 0; } counts[match.id] += 1; } @@ -89821,13 +89907,13 @@ var weakPreset = _activePresets.length === 1 && Object.keys(_activePresets[0].addTags || {}).length === 0; // Don't replace a weak preset with a fallback preset (e.g. "Point") - if (weakPreset && matches.length === 1 && matches[0].isFallback()) return; + if (weakPreset && matches.length === 1 && matches[0].isFallback()) { return; } entityEditor.presets(matches); } entityEditor.presets = function(val) { - if (!arguments.length) return _activePresets; + if (!arguments.length) { return _activePresets; } // don't reload the same preset if (!utilArrayIdentical(val, _activePresets)) { @@ -89847,7 +89933,7 @@ function presetList(selection) { - if (!_entityIDs) return; + if (!_entityIDs) { return; } var presets = _mainPresetIndex.matchAllGeometry(entityGeometries()); @@ -89899,7 +89985,7 @@ event.stopPropagation(); // move focus to the first item in the preset list var buttons = list.selectAll('.preset-list-button'); - if (!buttons.empty()) buttons.nodes()[0].focus(); + if (!buttons.empty()) { buttons.nodes()[0].focus(); } } } @@ -89971,7 +90057,7 @@ function drawList(list, presets) { presets = presets.matchAllGeometry(entityGeometries()); var collection = presets.collection.reduce(function(collection, preset) { - if (!preset) return collection; + if (!preset) { return collection; } if (preset.members) { if (preset.members.collection.filter(function(preset) { @@ -90160,7 +90246,7 @@ item.choose = function() { - if (!box || !sublist) return; + if (!box || !sublist) { return; } if (shown) { shown = false; @@ -90220,7 +90306,7 @@ } item.choose = function() { - if (select(this).classed('disabled')) return; + if (select(this).classed('disabled')) { return; } if (!context.inIntro()) { _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]); } @@ -90253,7 +90339,7 @@ function updateForFeatureHiddenState() { - if (!_entityIDs.every(context.hasEntity)) return; + if (!_entityIDs.every(context.hasEntity)) { return; } var geometries = entityGeometries(); var button = context.container().selectAll('.preset-list .preset-list-button'); @@ -90265,7 +90351,7 @@ var hiddenPresetFeaturesId; for (var i in geometries) { hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i]); - if (hiddenPresetFeaturesId) break; + if (hiddenPresetFeaturesId) { break; } } var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && @@ -90287,13 +90373,13 @@ } presetList.autofocus = function(val) { - if (!arguments.length) return _autofocus; + if (!arguments.length) { return _autofocus; } _autofocus = val; return presetList; }; presetList.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; if (_entityIDs && _entityIDs.length) { var presets = _entityIDs.map(function(entityID) { @@ -90305,7 +90391,7 @@ }; presetList.presets = function(val) { - if (!arguments.length) return _currentPresets; + if (!arguments.length) { return _currentPresets; } _currentPresets = val; return presetList; }; @@ -90324,7 +90410,7 @@ geometry = 'point'; } - if (!counts[geometry]) counts[geometry] = 0; + if (!counts[geometry]) { counts[geometry] = 0; } counts[geometry] += 1; } @@ -90391,32 +90477,32 @@ function shouldDefaultToPresetList() { // always show the inspector on hover - if (_state !== 'select') return false; + if (_state !== 'select') { return false; } // can only change preset on single selection - if (_entityIDs.length !== 1) return false; + if (_entityIDs.length !== 1) { return false; } var entityID = _entityIDs[0]; var entity = context.hasEntity(entityID); - if (!entity) return false; + if (!entity) { return false; } // default to inspector if there are already tags - if (entity.hasNonGeometryTags()) return false; + if (entity.hasNonGeometryTags()) { return false; } // prompt to select preset if feature is new and untagged - if (_newFeature) return true; + if (_newFeature) { return true; } // all existing features except vertices should default to inspector - if (entity.geometry(context.graph()) !== 'vertex') return false; + if (entity.geometry(context.graph()) !== 'vertex') { return false; } // show vertex relations if any - if (context.graph().parentRelations(entity).length) return false; + if (context.graph().parentRelations(entity).length) { return false; } // show vertex issues if there are any - if (context.validator().getEntityIssues(entityID).length) return false; + if (context.validator().getEntityIssues(entityID).length) { return false; } // show turn retriction editor for junction vertices - if (entity.isHighwayIntersection(context.graph())) return false; + if (entity.isHighwayIntersection(context.graph())) { return false; } // otherwise show preset list for uninteresting vertices return true; @@ -90475,7 +90561,7 @@ }; inspector.state = function(val) { - if (!arguments.length) return _state; + if (!arguments.length) { return _state; } _state = val; entityEditor.state(_state); @@ -90487,14 +90573,14 @@ inspector.entityIDs = function(val) { - if (!arguments.length) return _entityIDs; + if (!arguments.length) { return _entityIDs; } _entityIDs = val; return inspector; }; inspector.newFeature = function(val) { - if (!arguments.length) return _newFeature; + if (!arguments.length) { return _newFeature; } _newFeature = val; return inspector; }; @@ -90540,9 +90626,9 @@ var downPointerId, lastClientX, containerLocGetter; function pointerdown() { - if (downPointerId) return; + if (downPointerId) { return; } - if ('button' in event && event.button !== 0) return; + if ('button' in event && event.button !== 0) { return; } downPointerId = event.pointerId || 'mouse'; @@ -90573,7 +90659,7 @@ function pointermove() { - if (downPointerId !== (event.pointerId || 'mouse')) return; + if (downPointerId !== (event.pointerId || 'mouse')) { return; } event.preventDefault(); @@ -90617,7 +90703,7 @@ } function pointerup() { - if (downPointerId !== (event.pointerId || 'mouse')) return; + if (downPointerId !== (event.pointerId || 'mouse')) { return; } downPointerId = null; @@ -90668,7 +90754,7 @@ .classed('inspector-hover', true); } else if (datum instanceof osmNote) { - if (context.mode().id === 'drag-note') return; + if (context.mode().id === 'drag-note') { return; } _wasNote = true; var osm = services.osm; @@ -90805,7 +90891,7 @@ inspectorWrap .classed('inspector-hidden', true); - if (_current) _current.remove(); + if (_current) { _current.remove(); } _current = selection .append('div') .attr('class', 'sidebar-component') @@ -90819,7 +90905,7 @@ inspectorWrap .classed('inspector-hidden', true); - if (_current) _current.remove(); + if (_current) { _current.remove(); } _current = null; }; @@ -90847,7 +90933,7 @@ } // Don't allow sidebar to toggle when the user is in the walkthrough. - if (context.inIntro()) return; + if (context.inIntro()) { return; } var isCollapsed = selection.classed('collapsed'); var isCollapsing = !isCollapsed; @@ -90926,12 +91012,12 @@ event.preventDefault(); var osm = context.connection(); - if (!osm) return; + if (!osm) { return; } - if (context.inIntro()) return; + if (context.inIntro()) { return; } if (context.history().hasChanges() && - !window.confirm(_t('source_switch.lose_changes'))) return; + !window.confirm(_t('source_switch.lose_changes'))) { return; } var isLive = select(this) .classed('live'); @@ -90960,7 +91046,7 @@ sourceSwitch.keys = function(_) { - if (!arguments.length) return keys; + if (!arguments.length) { return keys; } keys = _; return sourceSwitch; }; @@ -90994,22 +91080,22 @@ } function uiSplash(context) { - return (selection) => { + return function (selection) { // Exception - if there are restorable changes, skip this splash screen. // This is because we currently only support one `uiModal` at a time // and we need to show them `uiRestore`` instead of this one. - if (context.history().hasRestorableChanges()) return; + if (context.history().hasRestorableChanges()) { return; } // If user has not seen this version of the privacy policy, show the splash again. - let updateMessage = ''; - const sawPrivacyVersion = corePreferences('sawPrivacyVersion'); - let showSplash = !corePreferences('sawSplash'); + var updateMessage = ''; + var sawPrivacyVersion = corePreferences('sawPrivacyVersion'); + var showSplash = !corePreferences('sawSplash'); if (sawPrivacyVersion !== context.privacyVersion) { updateMessage = _t('splash.privacy_update'); showSplash = true; } - if (!showSplash) return; + if (!showSplash) { return; } corePreferences('sawSplash', true); corePreferences('sawPrivacyVersion', context.privacyVersion); @@ -91017,12 +91103,12 @@ // fetch intro graph data now, while user is looking at the splash screen _mainFileFetcher.get('intro_graph'); - let modalSelection = uiModal(selection); + var modalSelection = uiModal(selection); modalSelection.select('.modal') .attr('class', 'modal-splash modal'); - let introModal = modalSelection.select('.content') + var introModal = modalSelection.select('.content') .append('div') .attr('class', 'fillL'); @@ -91032,7 +91118,7 @@ .append('h3') .text(_t('splash.welcome')); - let modalSection = introModal + var modalSection = introModal .append('div') .attr('class','modal-section'); @@ -91052,14 +91138,14 @@ _t('splash.privacy_policy') + '
    ' })); - let buttonWrap = introModal + var buttonWrap = introModal .append('div') .attr('class', 'modal-actions'); - let walkthrough = buttonWrap + var walkthrough = buttonWrap .append('button') .attr('class', 'walkthrough') - .on('click', () => { + .on('click', function () { context.container().call(uiIntro(context)); modalSelection.close(); }); @@ -91074,7 +91160,7 @@ .append('div') .text(_t('splash.walkthrough')); - let startEditing = buttonWrap + var startEditing = buttonWrap .append('button') .attr('class', 'start-editing') .on('click', modalSelection.close); @@ -91099,7 +91185,7 @@ return function(selection) { - if (!osm) return; + if (!osm) { return; } function update(err, apiStatus) { selection.html(''); @@ -91209,7 +91295,7 @@ .on('startFromNode', startFromNode); var defaultTags = { area: 'yes' }; - if (mode.preset) defaultTags = mode.preset.setTags(defaultTags, 'area'); + if (mode.preset) { defaultTags = mode.preset.setTags(defaultTags, 'area'); } function actionClose(wayId) { @@ -91288,7 +91374,7 @@ .on('startFromNode', startFromNode); var defaultTags = {}; - if (mode.preset) defaultTags = mode.preset.setTags(defaultTags, 'line'); + if (mode.preset) { defaultTags = mode.preset.setTags(defaultTags, 'line'); } function start(loc) { @@ -91359,7 +91445,7 @@ .on('finish', cancel); var defaultTags = {}; - if (mode.preset) defaultTags = mode.preset.setTags(defaultTags, 'point'); + if (mode.preset) { defaultTags = mode.preset.setTags(defaultTags, 'point'); } function add(loc) { @@ -91447,7 +91533,7 @@ function add(loc) { var osm = services.osm; - if (!osm) return; + if (!osm) { return; } var note = osmNote({ loc: loc, status: 'open', comments: [] }); osm.replaceNote(note); @@ -91739,7 +91825,7 @@ function choose(ul, datum) { - if (event) event.preventDefault(); + if (event) { event.preventDefault(); } select(ul) .selectAll('li') @@ -91751,12 +91837,12 @@ var entity; entity = context.graph().hasEntity(datum.id); - if (entity) extent._extend(entity.extent(context.graph())); + if (entity) { extent._extend(entity.extent(context.graph())); } datum.action(); entity = context.graph().hasEntity(datum.id); - if (entity) extent._extend(entity.extent(context.graph())); + if (entity) { extent._extend(entity.extent(context.graph())); } zoomToEntity(datum.id, extent); } @@ -91791,14 +91877,14 @@ // ] // } conflicts.conflictList = function(_) { - if (!arguments.length) return _conflictList; + if (!arguments.length) { return _conflictList; } _conflictList = _; return conflicts; }; conflicts.origChanges = function(_) { - if (!arguments.length) return _origChanges; + if (!arguments.length) { return _origChanges; } _origChanges = _; return conflicts; }; @@ -91875,8 +91961,7 @@ _fieldsArr = [ uiField(context, presets.field('comment'), null, { show: true, revert: false }), uiField(context, presets.field('source'), null, { show: false, revert: false }), - uiField(context, presets.field('hashtags'), null, { show: false, revert: false }), - ]; + uiField(context, presets.field('hashtags'), null, { show: false, revert: false }) ]; _fieldsArr.forEach(function(field) { field @@ -91912,7 +91997,7 @@ var osm = context.connection(); if (osm) { osm.userChangesets(function (err, changesets) { - if (err) return; + if (err) { return; } var comments = changesets.map(function(changeset) { var comment = changeset.tags.comment; @@ -91960,7 +92045,7 @@ changesetEditor.tags = function(_) { - if (!arguments.length) return _tags; + if (!arguments.length) { return _tags; } _tags = _; // Don't reset _fieldsArr here. return changesetEditor; @@ -91968,8 +92053,8 @@ changesetEditor.changesetID = function(_) { - if (!arguments.length) return _changesetID; - if (_changesetID === _) return changesetEditor; + if (!arguments.length) { return _changesetID; } + if (_changesetID === _) { return changesetEditor; } _changesetID = _; _fieldsArr = null; return changesetEditor; @@ -92256,7 +92341,7 @@ _selection = selection; // Initialize changeset if one does not exist yet. - if (!context.changeset) initChangeset(); + if (!context.changeset) { initChangeset(); } loadDerivedChangesetTags(); @@ -92337,7 +92422,7 @@ function loadDerivedChangesetTags() { var osm = context.connection(); - if (!osm) return; + if (!osm) { return; } var tags = Object.assign({}, context.changeset.tags); // shallow copy @@ -92408,7 +92493,7 @@ function render(selection) { var osm = context.connection(); - if (!osm) return; + if (!osm) { return; } var header = selection.selectAll('.header') .data([0]); @@ -92491,9 +92576,9 @@ // always check if this has changed, but only update prose.html() // if needed, because it can trigger a style recalculation osm.userDetails(function(err, user) { - if (err) return; + if (err) { return; } - if (_userDetails === user) return; // no change + if (_userDetails === user) { return; } // no change _userDetails = user; var userLink = select(document.createElement('div')); @@ -92735,7 +92820,7 @@ function isReviewRequested(tags) { var rr = tags.review_requested; - if (rr === undefined) return false; + if (rr === undefined) { return false; } rr = rr.trim().toLowerCase(); return !(rr === '' || rr === 'no'); } @@ -92747,7 +92832,7 @@ Object.keys(changed).forEach(function(k) { var v = changed[k]; k = context.cleanTagKey(k); - if (readOnlyTags.indexOf(k) !== -1) return; + if (readOnlyTags.indexOf(k) !== -1) { return; } if (k !== '' && v !== undefined) { if (onInput) { @@ -92943,25 +93028,26 @@ } function validateCenter(center) { - const validCenterLengths = [2, 3]; + var validCenterLengths = [2, 3]; if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) { throw new Error("ERROR! Center has to be an array of length two or three"); } - const [lng, lat] = center; + var lng = center[0]; + var lat = center[1]; if (typeof lng !== "number" || typeof lat !== "number") { throw new Error( - `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}` + ("ERROR! Longitude and Latitude has to be numbers but where " + (typeof lng) + " and " + (typeof lat)) ); } if (lng > 180 || lng < -180) { throw new Error( - `ERROR! Longitude has to be between -180 and 180 but was ${lng}` + ("ERROR! Longitude has to be between -180 and 180 but was " + lng) ); } if (lat > 90 || lat < -90) { throw new Error( - `ERROR! Latitude has to be between -90 and 90 but was ${lat}` + ("ERROR! Latitude has to be between -90 and 90 but was " + lat) ); } } @@ -92969,13 +93055,13 @@ function validateRadius(radius) { if (typeof radius !== "number") { throw new Error( - `ERROR! Radius has to be a positive number but was: ${typeof radius}` + ("ERROR! Radius has to be a positive number but was: " + (typeof radius)) ); } if (radius <= 0) { throw new Error( - `ERROR! Radius has to be a positive number but was: ${radius}` + ("ERROR! Radius has to be a positive number but was: " + radius) ); } } @@ -92983,18 +93069,22 @@ function validateNumberOfSegments(numberOfSegments) { if (typeof numberOfSegments !== "number" && numberOfSegments !== undefined) { throw new Error( - `ERROR! Number of segments has to be a number but was: ${typeof numberOfSegments}` + ("ERROR! Number of segments has to be a number but was: " + (typeof numberOfSegments)) ); } if (numberOfSegments < 3) { throw new Error( - `ERROR! Number of segments has to be at least 3 but was: ${numberOfSegments}` + ("ERROR! Number of segments has to be at least 3 but was: " + numberOfSegments) ); } } - function validateInput({ center, radius, numberOfSegments }) { + function validateInput(ref) { + var center = ref.center; + var radius = ref.radius; + var numberOfSegments = ref.numberOfSegments; + validateCenter(center); validateRadius(radius); validateNumberOfSegments(numberOfSegments); @@ -93004,7 +93094,7 @@ var n = numberOfSegments ? numberOfSegments : 32; // validateInput() throws error on invalid input and do nothing on valid input - validateInput({ center, radius, numberOfSegments }); + validateInput({ center: center, radius: radius, numberOfSegments: numberOfSegments }); var coordinates = []; for (var i = 0; i < n; ++i) { @@ -93201,7 +93291,7 @@ this.stack = (new Error()).stack; } - if ( Error ) IllegalArgumentException.__proto__ = Error; + if ( Error ) { IllegalArgumentException.__proto__ = Error; } IllegalArgumentException.prototype = Object.create( Error && Error.prototype ); IllegalArgumentException.prototype.constructor = IllegalArgumentException; @@ -94331,7 +94421,7 @@ Exception$$1.call(this, 'Projective point not representable on the Cartesian plane.'); } - if ( Exception$$1 ) NotRepresentableException.__proto__ = Exception$$1; + if ( Exception$$1 ) { NotRepresentableException.__proto__ = Exception$$1; } NotRepresentableException.prototype = Object.create( Exception$$1 && Exception$$1.prototype ); NotRepresentableException.prototype.constructor = NotRepresentableException; NotRepresentableException.prototype.interfaces_ = function interfaces_ () { @@ -95282,7 +95372,7 @@ this.stack = (new Error()).stack; } - if ( Error ) RuntimeException.__proto__ = Error; + if ( Error ) { RuntimeException.__proto__ = Error; } RuntimeException.prototype = Object.create( Error && Error.prototype ); RuntimeException.prototype.constructor = RuntimeException; @@ -95300,7 +95390,7 @@ } } - if ( RuntimeException$$1 ) AssertionFailedException.__proto__ = RuntimeException$$1; + if ( RuntimeException$$1 ) { AssertionFailedException.__proto__ = RuntimeException$$1; } AssertionFailedException.prototype = Object.create( RuntimeException$$1 && RuntimeException$$1.prototype ); AssertionFailedException.prototype.constructor = AssertionFailedException; AssertionFailedException.prototype.interfaces_ = function interfaces_ () { @@ -95528,7 +95618,7 @@ LineIntersector$$1.apply(this, arguments); } - if ( LineIntersector$$1 ) RobustLineIntersector.__proto__ = LineIntersector$$1; + if ( LineIntersector$$1 ) { RobustLineIntersector.__proto__ = LineIntersector$$1; } RobustLineIntersector.prototype = Object.create( LineIntersector$$1 && LineIntersector$$1.prototype ); RobustLineIntersector.prototype.constructor = RobustLineIntersector; @@ -96627,7 +96717,7 @@ Collection$$1.apply(this, arguments); } - if ( Collection$$1 ) List.__proto__ = Collection$$1; + if ( Collection$$1 ) { List.__proto__ = Collection$$1; } List.prototype = Object.create( Collection$$1 && Collection$$1.prototype ); List.prototype.constructor = List; @@ -96685,7 +96775,7 @@ } } - if ( List$$1 ) ArrayList.__proto__ = List$$1; + if ( List$$1 ) { ArrayList.__proto__ = List$$1; } ArrayList.prototype = Object.create( List$$1 && List$$1.prototype ); ArrayList.prototype.constructor = ArrayList; @@ -96819,7 +96909,7 @@ this.position_ = 0; } - if ( Iterator$$1 ) Iterator_.__proto__ = Iterator$$1; + if ( Iterator$$1 ) { Iterator_.__proto__ = Iterator$$1; } Iterator_.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype ); Iterator_.prototype.constructor = Iterator_; @@ -96877,7 +96967,7 @@ } } - if ( ArrayList$$1 ) CoordinateList.__proto__ = ArrayList$$1; + if ( ArrayList$$1 ) { CoordinateList.__proto__ = ArrayList$$1; } CoordinateList.prototype = Object.create( ArrayList$$1 && ArrayList$$1.prototype ); CoordinateList.prototype.constructor = CoordinateList; @@ -97306,7 +97396,7 @@ var SortedMap = (function (Map) { function SortedMap () { Map.apply(this, arguments); - }if ( Map ) SortedMap.__proto__ = Map; + }if ( Map ) { SortedMap.__proto__ = Map; } SortedMap.prototype = Object.create( Map && Map.prototype ); SortedMap.prototype.constructor = SortedMap; @@ -97368,7 +97458,7 @@ } } - if ( Set$$1 ) HashSet.__proto__ = Set$$1; + if ( Set$$1 ) { HashSet.__proto__ = Set$$1; } HashSet.prototype = Object.create( Set$$1 && Set$$1.prototype ); HashSet.prototype.constructor = HashSet; @@ -97480,7 +97570,7 @@ this.position_ = 0; } - if ( Iterator$$1 ) Iterator_.__proto__ = Iterator$$1; + if ( Iterator$$1 ) { Iterator_.__proto__ = Iterator$$1; } Iterator_.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype ); Iterator_.prototype.constructor = Iterator_; @@ -98091,7 +98181,7 @@ } } - if ( Geometry$$1 ) GeometryCollection.__proto__ = Geometry$$1; + if ( Geometry$$1 ) { GeometryCollection.__proto__ = Geometry$$1; } GeometryCollection.prototype = Object.create( Geometry$$1 && Geometry$$1.prototype ); GeometryCollection.prototype.constructor = GeometryCollection; @@ -98330,7 +98420,7 @@ GeometryCollection$$1.apply(this, arguments); } - if ( GeometryCollection$$1 ) MultiLineString.__proto__ = GeometryCollection$$1; + if ( GeometryCollection$$1 ) { MultiLineString.__proto__ = GeometryCollection$$1; } MultiLineString.prototype = Object.create( GeometryCollection$$1 && GeometryCollection$$1.prototype ); MultiLineString.prototype.constructor = MultiLineString; @@ -98713,7 +98803,7 @@ this.init(points); } - if ( Geometry$$1 ) LineString.__proto__ = Geometry$$1; + if ( Geometry$$1 ) { LineString.__proto__ = Geometry$$1; } LineString.prototype = Object.create( Geometry$$1 && Geometry$$1.prototype ); LineString.prototype.constructor = LineString; @@ -98941,7 +99031,7 @@ this.init(this._coordinates); } - if ( Geometry$$1 ) Point.__proto__ = Geometry$$1; + if ( Geometry$$1 ) { Point.__proto__ = Geometry$$1; } Point.prototype = Object.create( Geometry$$1 && Geometry$$1.prototype ); Point.prototype.constructor = Point; @@ -99109,7 +99199,7 @@ this._holes = holes; } - if ( Geometry$$1 ) Polygon.__proto__ = Geometry$$1; + if ( Geometry$$1 ) { Polygon.__proto__ = Geometry$$1; } Polygon.prototype = Object.create( Geometry$$1 && Geometry$$1.prototype ); Polygon.prototype.constructor = Polygon; @@ -99397,7 +99487,7 @@ GeometryCollection$$1.apply(this, arguments); } - if ( GeometryCollection$$1 ) MultiPoint.__proto__ = GeometryCollection$$1; + if ( GeometryCollection$$1 ) { MultiPoint.__proto__ = GeometryCollection$$1; } MultiPoint.prototype = Object.create( GeometryCollection$$1 && GeometryCollection$$1.prototype ); MultiPoint.prototype.constructor = MultiPoint; @@ -99468,7 +99558,7 @@ this.validateConstruction(); } - if ( LineString$$1 ) LinearRing.__proto__ = LineString$$1; + if ( LineString$$1 ) { LinearRing.__proto__ = LineString$$1; } LinearRing.prototype = Object.create( LineString$$1 && LineString$$1.prototype ); LinearRing.prototype.constructor = LinearRing; @@ -99524,7 +99614,7 @@ GeometryCollection$$1.apply(this, arguments); } - if ( GeometryCollection$$1 ) MultiPolygon.__proto__ = GeometryCollection$$1; + if ( GeometryCollection$$1 ) { MultiPolygon.__proto__ = GeometryCollection$$1; } MultiPolygon.prototype = Object.create( GeometryCollection$$1 && GeometryCollection$$1.prototype ); MultiPolygon.prototype.constructor = MultiPolygon; @@ -99961,7 +100051,7 @@ this.map_ = new Map(); } - if ( MapInterface ) HashMap.__proto__ = MapInterface; + if ( MapInterface ) { HashMap.__proto__ = MapInterface; } HashMap.prototype = Object.create( MapInterface && MapInterface.prototype ); HashMap.prototype.constructor = HashMap; /** @@ -101213,7 +101303,7 @@ this.name = 'TopologyException'; } - if ( RuntimeException$$1 ) TopologyException.__proto__ = RuntimeException$$1; + if ( RuntimeException$$1 ) { TopologyException.__proto__ = RuntimeException$$1; } TopologyException.prototype = Object.create( RuntimeException$$1 && RuntimeException$$1.prototype ); TopologyException.prototype.constructor = TopologyException; TopologyException.prototype.getCoordinate = function getCoordinate () { @@ -101846,7 +101936,7 @@ EdgeRing$$1.call(this, start, geometryFactory); } - if ( EdgeRing$$1 ) MinimalEdgeRing.__proto__ = EdgeRing$$1; + if ( EdgeRing$$1 ) { MinimalEdgeRing.__proto__ = EdgeRing$$1; } MinimalEdgeRing.prototype = Object.create( EdgeRing$$1 && EdgeRing$$1.prototype ); MinimalEdgeRing.prototype.constructor = MinimalEdgeRing; MinimalEdgeRing.prototype.setEdgeRing = function setEdgeRing (de, er) { @@ -101872,7 +101962,7 @@ EdgeRing$$1.call(this, start, geometryFactory); } - if ( EdgeRing$$1 ) MaximalEdgeRing.__proto__ = EdgeRing$$1; + if ( EdgeRing$$1 ) { MaximalEdgeRing.__proto__ = EdgeRing$$1; } MaximalEdgeRing.prototype = Object.create( EdgeRing$$1 && EdgeRing$$1.prototype ); MaximalEdgeRing.prototype.constructor = MaximalEdgeRing; MaximalEdgeRing.prototype.buildMinimalRings = function buildMinimalRings () { @@ -101977,7 +102067,7 @@ this._label = new Label(0, Location.NONE); } - if ( GraphComponent$$1 ) Node.__proto__ = GraphComponent$$1; + if ( GraphComponent$$1 ) { Node.__proto__ = GraphComponent$$1; } Node.prototype = Object.create( GraphComponent$$1 && GraphComponent$$1.prototype ); Node.prototype.constructor = Node; Node.prototype.isIncidentEdgeInResult = function isIncidentEdgeInResult () { @@ -102309,7 +102399,7 @@ this.computeDirectedLabel(); } - if ( EdgeEnd$$1 ) DirectedEdge.__proto__ = EdgeEnd$$1; + if ( EdgeEnd$$1 ) { DirectedEdge.__proto__ = EdgeEnd$$1; } DirectedEdge.prototype = Object.create( EdgeEnd$$1 && EdgeEnd$$1.prototype ); DirectedEdge.prototype.constructor = DirectedEdge; DirectedEdge.prototype.getNextMin = function getNextMin () { @@ -103325,7 +103415,7 @@ AbstractSTRtree$$1.call(this, nodeCapacity); } - if ( AbstractSTRtree$$1 ) STRtree.__proto__ = AbstractSTRtree$$1; + if ( AbstractSTRtree$$1 ) { STRtree.__proto__ = AbstractSTRtree$$1; } STRtree.prototype = Object.create( AbstractSTRtree$$1 && AbstractSTRtree$$1.prototype ); STRtree.prototype.constructor = STRtree; @@ -103529,7 +103619,7 @@ AbstractNode$$1.call(this, level); } - if ( AbstractNode$$1 ) STRtreeNode.__proto__ = AbstractNode$$1; + if ( AbstractNode$$1 ) { STRtreeNode.__proto__ = AbstractNode$$1; } STRtreeNode.prototype = Object.create( AbstractNode$$1 && AbstractNode$$1.prototype ); STRtreeNode.prototype.constructor = STRtreeNode; STRtreeNode.prototype.computeBounds = function computeBounds () { @@ -104521,7 +104611,7 @@ this._nOverlaps = 0; } - if ( SinglePassNoder$$1 ) MCIndexNoder.__proto__ = SinglePassNoder$$1; + if ( SinglePassNoder$$1 ) { MCIndexNoder.__proto__ = SinglePassNoder$$1; } MCIndexNoder.prototype = Object.create( SinglePassNoder$$1 && SinglePassNoder$$1.prototype ); MCIndexNoder.prototype.constructor = MCIndexNoder; @@ -104593,7 +104683,7 @@ this._si = si; } - if ( MonotoneChainOverlapAction$$1 ) SegmentOverlapAction.__proto__ = MonotoneChainOverlapAction$$1; + if ( MonotoneChainOverlapAction$$1 ) { SegmentOverlapAction.__proto__ = MonotoneChainOverlapAction$$1; } SegmentOverlapAction.prototype = Object.create( MonotoneChainOverlapAction$$1 && MonotoneChainOverlapAction$$1.prototype ); SegmentOverlapAction.prototype.constructor = SegmentOverlapAction; SegmentOverlapAction.prototype.overlap = function overlap () { @@ -106087,7 +106177,7 @@ this._LINKING_TO_OUTGOING = 2; } - if ( EdgeEndStar$$1 ) DirectedEdgeStar.__proto__ = EdgeEndStar$$1; + if ( EdgeEndStar$$1 ) { DirectedEdgeStar.__proto__ = EdgeEndStar$$1; } DirectedEdgeStar.prototype = Object.create( EdgeEndStar$$1 && EdgeEndStar$$1.prototype ); DirectedEdgeStar.prototype.constructor = DirectedEdgeStar; DirectedEdgeStar.prototype.linkResultDirectedEdges = function linkResultDirectedEdges () { @@ -106329,7 +106419,7 @@ NodeFactory$$1.apply(this, arguments); } - if ( NodeFactory$$1 ) OverlayNodeFactory.__proto__ = NodeFactory$$1; + if ( NodeFactory$$1 ) { OverlayNodeFactory.__proto__ = NodeFactory$$1; } OverlayNodeFactory.prototype = Object.create( NodeFactory$$1 && NodeFactory$$1.prototype ); OverlayNodeFactory.prototype.constructor = OverlayNodeFactory; @@ -106917,7 +107007,7 @@ } } - if ( GraphComponent$$1 ) Edge.__proto__ = GraphComponent$$1; + if ( GraphComponent$$1 ) { Edge.__proto__ = GraphComponent$$1; } Edge.prototype = Object.create( GraphComponent$$1 && GraphComponent$$1.prototype ); Edge.prototype.constructor = Edge; Edge.prototype.getDepth = function getDepth () { @@ -107631,7 +107721,7 @@ this._hotPixelVertexIndex = hotPixelVertexIndex; } - if ( MonotoneChainSelectAction$$1 ) HotPixelSnapAction.__proto__ = MonotoneChainSelectAction$$1; + if ( MonotoneChainSelectAction$$1 ) { HotPixelSnapAction.__proto__ = MonotoneChainSelectAction$$1; } HotPixelSnapAction.prototype = Object.create( MonotoneChainSelectAction$$1 && MonotoneChainSelectAction$$1.prototype ); HotPixelSnapAction.prototype.constructor = HotPixelSnapAction; HotPixelSnapAction.prototype.isNodeAdded = function isNodeAdded () { @@ -109840,7 +109930,7 @@ this._isSelfSnap = (isSelfSnap !== undefined) ? isSelfSnap : false; } - if ( GeometryTransformer$$1 ) SnapTransformer.__proto__ = GeometryTransformer$$1; + if ( GeometryTransformer$$1 ) { SnapTransformer.__proto__ = GeometryTransformer$$1; } SnapTransformer.prototype = Object.create( GeometryTransformer$$1 && GeometryTransformer$$1.prototype ); SnapTransformer.prototype.constructor = SnapTransformer; SnapTransformer.prototype.snapLine = function snapLine (srcPts, snapPts) { @@ -110096,10 +110186,10 @@ if (!isSuccess) { try { result = SnapOverlayOp.overlayOp(this._geom[0], this._geom[1], opCode); - } catch (ex) { - if (ex instanceof RuntimeException) { + } catch (ex$1) { + if (ex$1 instanceof RuntimeException) { throw savedException - } else { throw ex } + } else { throw ex$1 } } finally {} } return result @@ -110341,7 +110431,7 @@ this.nOverlaps = null; } - if ( EdgeSetIntersector$$1 ) SimpleMCSweepLineIntersector.__proto__ = EdgeSetIntersector$$1; + if ( EdgeSetIntersector$$1 ) { SimpleMCSweepLineIntersector.__proto__ = EdgeSetIntersector$$1; } SimpleMCSweepLineIntersector.prototype = Object.create( EdgeSetIntersector$$1 && EdgeSetIntersector$$1.prototype ); SimpleMCSweepLineIntersector.prototype.constructor = SimpleMCSweepLineIntersector; SimpleMCSweepLineIntersector.prototype.prepareEvents = function prepareEvents () { @@ -110502,7 +110592,7 @@ this._item = item; } - if ( IntervalRTreeNode$$1 ) IntervalRTreeLeafNode.__proto__ = IntervalRTreeNode$$1; + if ( IntervalRTreeNode$$1 ) { IntervalRTreeLeafNode.__proto__ = IntervalRTreeNode$$1; } IntervalRTreeLeafNode.prototype = Object.create( IntervalRTreeNode$$1 && IntervalRTreeNode$$1.prototype ); IntervalRTreeLeafNode.prototype.constructor = IntervalRTreeLeafNode; IntervalRTreeLeafNode.prototype.query = function query (queryMin, queryMax, visitor) { @@ -110531,7 +110621,7 @@ this.buildExtent(this._node1, this._node2); } - if ( IntervalRTreeNode$$1 ) IntervalRTreeBranchNode.__proto__ = IntervalRTreeNode$$1; + if ( IntervalRTreeNode$$1 ) { IntervalRTreeBranchNode.__proto__ = IntervalRTreeNode$$1; } IntervalRTreeBranchNode.prototype = Object.create( IntervalRTreeNode$$1 && IntervalRTreeNode$$1.prototype ); IntervalRTreeBranchNode.prototype.constructor = IntervalRTreeBranchNode; IntervalRTreeBranchNode.prototype.buildExtent = function buildExtent (n1, n2) { @@ -110754,7 +110844,7 @@ } } - if ( PlanarGraph$$1 ) GeometryGraph.__proto__ = PlanarGraph$$1; + if ( PlanarGraph$$1 ) { GeometryGraph.__proto__ = PlanarGraph$$1; } GeometryGraph.prototype = Object.create( PlanarGraph$$1 && PlanarGraph$$1.prototype ); GeometryGraph.prototype.constructor = GeometryGraph; GeometryGraph.prototype.insertBoundaryPoint = function insertBoundaryPoint (argIndex, coord) { @@ -111052,7 +111142,7 @@ this._geomFact = g0.getFactory(); } - if ( GeometryGraphOp ) OverlayOp.__proto__ = GeometryGraphOp; + if ( GeometryGraphOp ) { OverlayOp.__proto__ = GeometryGraphOp; } OverlayOp.prototype = Object.create( GeometryGraphOp && GeometryGraphOp.prototype ); OverlayOp.prototype.constructor = OverlayOp; OverlayOp.prototype.insertUniqueEdge = function insertUniqueEdge (e) { @@ -111854,20 +111944,20 @@ function feature$1(geometry, properties, options) { // Optional Parameters options = options || {}; - if (!isObject$4(options)) throw new Error('options is invalid'); + if (!isObject$4(options)) { throw new Error('options is invalid'); } var bbox = options.bbox; var id = options.id; // Validation - if (geometry === undefined) throw new Error('geometry is required'); - if (properties && properties.constructor !== Object) throw new Error('properties must be an Object'); - if (bbox) validateBBox(bbox); - if (id) validateId(id); + if (geometry === undefined) { throw new Error('geometry is required'); } + if (properties && properties.constructor !== Object) { throw new Error('properties must be an Object'); } + if (bbox) { validateBBox(bbox); } + if (id) { validateId(id); } // Main var feat = {type: 'Feature'}; - if (id) feat.id = id; - if (bbox) feat.bbox = bbox; + if (id) { feat.id = id; } + if (bbox) { feat.bbox = bbox; } feat.properties = properties || {}; feat.geometry = geometry; return feat; @@ -111925,11 +112015,11 @@ * //=Error */ function validateBBox(bbox) { - if (!bbox) throw new Error('bbox is required'); - if (!Array.isArray(bbox)) throw new Error('bbox must be an Array'); - if (bbox.length !== 4 && bbox.length !== 6) throw new Error('bbox must be an Array of 4 or 6 numbers'); + if (!bbox) { throw new Error('bbox is required'); } + if (!Array.isArray(bbox)) { throw new Error('bbox must be an Array'); } + if (bbox.length !== 4 && bbox.length !== 6) { throw new Error('bbox must be an Array of 4 or 6 numbers'); } bbox.forEach(function (num) { - if (!isNumber$1(num)) throw new Error('bbox must only contain numbers'); + if (!isNumber$1(num)) { throw new Error('bbox must only contain numbers'); } }); } @@ -111955,8 +112045,8 @@ * //=Error */ function validateId(id) { - if (!id) throw new Error('id is required'); - if (['string', 'number'].indexOf(typeof id) === -1) throw new Error('id must be a number or a string'); + if (!id) { throw new Error('id is required'); } + if (['string', 'number'].indexOf(typeof id) === -1) { throw new Error('id must be a number or a string'); } } /** @@ -112034,7 +112124,7 @@ // Handle null Geometry if (geometry === null) { - if (callback(null, featureIndex, featureProperties, featureBBox, featureId) === false) return false; + if (callback(null, featureIndex, featureProperties, featureBBox, featureId) === false) { return false; } continue; } switch (geometry.type) { @@ -112044,12 +112134,12 @@ case 'Polygon': case 'MultiLineString': case 'MultiPolygon': { - if (callback(geometry, featureIndex, featureProperties, featureBBox, featureId) === false) return false; + if (callback(geometry, featureIndex, featureProperties, featureBBox, featureId) === false) { return false; } break; } case 'GeometryCollection': { for (j = 0; j < geometry.geometries.length; j++) { - if (callback(geometry.geometries[j], featureIndex, featureProperties, featureBBox, featureId) === false) return false; + if (callback(geometry.geometries[j], featureIndex, featureProperties, featureBBox, featureId) === false) { return false; } } break; } @@ -112113,8 +112203,8 @@ function geomReduce(geojson, callback, initialValue) { var previousValue = initialValue; geomEach(geojson, function (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) { - if (featureIndex === 0 && initialValue === undefined) previousValue = currentGeometry; - else previousValue = callback(previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId); + if (featureIndex === 0 && initialValue === undefined) { previousValue = currentGeometry; } + else { previousValue = callback(previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId); } }); return previousValue; } @@ -112156,7 +112246,7 @@ case 'Point': case 'LineString': case 'Polygon': - if (callback(feature$1(geometry, properties, {bbox: bbox, id: id}), featureIndex, 0) === false) return false; + if (callback(feature$1(geometry, properties, {bbox: bbox, id: id}), featureIndex, 0) === false) { return false; } return; } @@ -112181,7 +112271,7 @@ type: geomType, coordinates: coordinate }; - if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false) return false; + if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false) { return false; } } }); } @@ -112326,9 +112416,9 @@ * //={"type": "Point", "coordinates": [110, 40]} */ function getGeom(geojson) { - if (!geojson) throw new Error('geojson is required'); - if (geojson.geometry !== undefined) return geojson.geometry; - if (geojson.coordinates || geojson.geometries) return geojson; + if (!geojson) { throw new Error('geojson is required'); } + if (geojson.geometry !== undefined) { return geojson.geometry; } + if (geojson.coordinates || geojson.geometries) { return geojson; } throw new Error('geojson must be a valid Feature or Geometry Object'); } @@ -112374,15 +112464,15 @@ // Issue #721 - JSTS can't handle empty polygons geom1 = removeEmptyPolygon(geom1); geom2 = removeEmptyPolygon(geom2); - if (!geom1) return null; - if (!geom2) return feature$1(geom1, properties); + if (!geom1) { return null; } + if (!geom2) { return feature$1(geom1, properties); } // JSTS difference operation var reader = new GeoJSONReader(); var a = reader.read(geom1); var b = reader.read(geom2); var differenced = OverlayOp.difference(a, b); - if (differenced.isEmpty()) return null; + if (differenced.isEmpty()) { return null; } var writer = new GeoJSONWriter(); var geom = writer.write(differenced); @@ -112399,14 +112489,14 @@ function removeEmptyPolygon(geom) { switch (geom.type) { case 'Polygon': - if (area(geom) > 1) return geom; + if (area(geom) > 1) { return geom; } return null; case 'MultiPolygon': var coordinates = []; flattenEach(geom, function (feature$$1) { - if (area(feature$$1) > 1) coordinates.push(feature$$1.geometry.coordinates); + if (area(feature$$1) > 1) { coordinates.push(feature$$1.geometry.coordinates); } }); - if (coordinates.length) return {type: 'MultiPolygon', coordinates: coordinates}; + if (coordinates.length) { return {type: 'MultiPolygon', coordinates: coordinates}; } } } @@ -112438,11 +112528,13 @@ * var addToMap = [poly1, poly2, union]; */ function union$1() { + var arguments$1 = arguments; + var reader = new GeoJSONReader(); var result = reader.read(JSON.stringify(arguments[0].geometry)); for (var i = 1; i < arguments.length; i++) { - result = UnionOp.union(result, reader.read(JSON.stringify(arguments[i].geometry))); + result = UnionOp.union(result, reader.read(JSON.stringify(arguments$1[i].geometry))); } var writer = new GeoJSONWriter(); @@ -112458,16 +112550,16 @@ // Reduce an array of locations into a single GeoJSON feature function _locationReducer(accumulator, location) { /* eslint-disable no-console, no-invalid-this */ - let result; + var result; try { - let resolved = this.resolveLocation(location); + var resolved = this.resolveLocation(location); if (!resolved || !resolved.feature) { - console.warn(`Warning: Couldn't resolve location "${location}"`); + console.warn(("Warning: Couldn't resolve location \"" + location + "\"")); return accumulator; } result = !accumulator ? resolved.feature : union$1(accumulator, resolved.feature); } catch (e) { - console.warn(`Warning: Error resolving location "${location}"`); + console.warn(("Warning: Error resolving location \"" + location + "\"")); console.warn(e); result = accumulator; } @@ -112483,268 +112575,251 @@ } - class LocationConflation { - - // constructor - // - // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later. - // Each feature must have a filename-like `id`, for example: `something.geojson` - // - // { - // "type": "FeatureCollection" - // "features": [ - // { - // "type": "Feature", - // "id": "philly_metro.geojson", - // "properties": { … }, - // "geometry": { … } - // } - // ] - // } - constructor(fc) { - this._cache = {}; + var defaultExport = function defaultExport(fc) { + var this$1 = this; - // process input FeatureCollection - if (fc && fc.type === 'FeatureCollection' && Array.isArray(fc.features)) { - fc.features.forEach(feature => { - feature.properties = feature.properties || {}; - let props = feature.properties; + this._cache = {}; - // get `id` from either `id` or `properties` - let id = feature.id || props.id; - if (!id || !/^\S+\.geojson$/i.test(id)) return; + // process input FeatureCollection + if (fc && fc.type === 'FeatureCollection' && Array.isArray(fc.features)) { + fc.features.forEach(function (feature) { + feature.properties = feature.properties || {}; + var props = feature.properties; - // ensure id exists and is lowercase - id = id.toLowerCase(); - feature.id = id; - props.id = id; + // get `id` from either `id` or `properties` + var id = feature.id || props.id; + if (!id || !/^\S+\.geojson$/i.test(id)) { return; } - // ensure area property exists - if (!props.area) { - const area = geojsonArea.geometry(feature.geometry) / 1e6; // m² to km² - props.area = Number(area.toFixed(2)); - } + // ensure id exists and is lowercase + id = id.toLowerCase(); + feature.id = id; + props.id = id; - this._cache[id] = feature; - }); - } + // ensure area property exists + if (!props.area) { + var area = geojsonArea.geometry(feature.geometry) / 1e6;// m² to km² + props.area = Number(area.toFixed(2)); + } - // Replace CountryCoder world geometry to have a polygon covering the world. - let world = _cloneDeep(feature('Q2')); - world.geometry = { - type: 'Polygon', - coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]] - }; - world.id = 'Q2'; - world.properties.id = 'Q2'; - world.properties.area = geojsonArea.geometry(world.geometry) / 1e6; // m² to km² - this._cache.Q2 = world; + this$1._cache[id] = feature; + }); } + // Replace CountryCoder world geometry to have a polygon covering the world. + var world = _cloneDeep(feature('Q2')); + world.geometry = { + type: 'Polygon', + coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]] + }; + world.id = 'Q2'; + world.properties.id = 'Q2'; + world.properties.area = geojsonArea.geometry(world.geometry) / 1e6;// m² to km² + this._cache.Q2 = world; + }; - // validateLocation - // - // Pass a `location` identifier - // Returns a result like - // { - // type: 'point', 'geojson', or 'countrycoder' - // location: the queried location - // id: a unique identifier - // } - // or `null` if the location is invalid - // - validateLocation(location) { - if (Array.isArray(location)) { // a [lon,lat] coordinate pair? - if (location.length === 2 && Number.isFinite(location[0]) && Number.isFinite(location[1]) && - location[0] >= -180 && location[0] <= 180 && location[1] >= -90 && location[1] <= 90 - ) { - const id = '[' + location.toString() + ']'; - return { type: 'point', location: location, id: id }; - } - } else if (typeof location === 'string' && /^\S+\.geojson$/i.test(location)) { // a .geojson filename? - const id = location.toLowerCase(); - if (this._cache[id]) { - return { type: 'geojson', location: location, id: id }; - } + // validateLocation + // + // Pass a `location` identifier + // Returns a result like + // { + // type: 'point', 'geojson', or 'countrycoder' + // location:the queried location + // id: a unique identifier + // } + //or `null` if the location is invalid + // + defaultExport.prototype.validateLocation = function validateLocation (location) { + if (Array.isArray(location)) { // a [lon,lat] coordinate pair? + if (location.length === 2 && Number.isFinite(location[0]) && Number.isFinite(location[1]) && + location[0] >= -180 && location[0] <= 180 && location[1] >= -90 && location[1] <= 90 + ) { + var id = '[' + location.toString() + ']'; + return { type: 'point', location: location, id: id }; + } - } else if (typeof location === 'string' || typeof location === 'number') { // a country-coder value? - const feature$1 = feature(location); - if (feature$1) { - // Use wikidata QID as the identifier, since that seems to be the only - // property that everything in CountryCoder is guaranteed to have. - const id = feature$1.properties.wikidata; - return { type: 'countrycoder', location: location, id: id }; - } + } else if (typeof location === 'string' && /^\S+\.geojson$/i.test(location)) { // a .geojson filename? + var id$1 = location.toLowerCase(); + if (this._cache[id$1]) { + return { type: 'geojson', location: location, id: id$1 }; } - return null; + } else if (typeof location === 'string' || typeof location === 'number') { // a country-coder value? + var feature$1 = feature(location); + if (feature$1) { + // Use wikidata QID as the identifier, since that seems to be the only + // property that everything in CountryCoder is guaranteed to have. + var id$2 = feature$1.properties.wikidata; + return { type: 'countrycoder', location: location, id: id$2 }; + } } + return null; + }; - // resolveLocation - // - // Pass a `location` identifier - // Returns a result like - // { - // type: 'point', 'geojson', or 'countrycoder' - // location: the queried location - // id: a unique identifier - // feature: the geojson feature - // } - // or `null` if the location is invalid - // - resolveLocation(location) { - const valid = this.validateLocation(location); - if (!valid) return null; - - // return a result from cache if we can - if (this._cache[valid.id]) { - return Object.assign(valid, { feature: this._cache[valid.id] }); - } - - // a [lon,lat] coordinate pair? - if (valid.type === 'point') { - const RADIUS = 25000; // meters - const EDGES = 10; - const PRECISION = 3; - const area = Math.PI * RADIUS * RADIUS / 1e6; // m² to km² - const feature = this._cache[valid.id] = geojsonPrecision({ - type: 'Feature', - id: valid.id, - properties: { id: valid.id, area: Number(area.toFixed(2)) }, - geometry: circleToPolygon(location, RADIUS, EDGES) - }, PRECISION); - return Object.assign(valid, { feature: feature }); - - // a .geojson filename? - } else if (valid.type === 'geojson') ; else if (valid.type === 'countrycoder') { - let feature$1 = _cloneDeep(feature(valid.id)); - let props = feature$1.properties; - - // -> This block of code is weird and requires some explanation. <- - // CountryCoder includes higher level features which are made up of members. - // These features don't have their own geometry, but CountryCoder provides an - // `aggregateFeature` method to combine these members into a MultiPolygon. - // BUT, when we try to actually work with these aggregated MultiPolygons, - // Turf/JSTS gets crashy because of topography bugs. - // SO, we'll aggregate the features ourselves by unioning them together. - // This approach also has the benefit of removing all the internal boaders and - // simplifying the regional polygons a lot. - if (Array.isArray(props.members)) { - let seed = feature$1.geometry ? feature$1 : null; - let aggregate = props.members.reduce(_locationReducer.bind(this), seed); - feature$1.geometry = aggregate.geometry; - } - - // ensure area property exists - if (!props.area) { - const area = geojsonArea.geometry(feature$1.geometry) / 1e6; // m² to km² - props.area = Number(area.toFixed(2)); - } - - // ensure id property exists - feature$1.id = valid.id; - props.id = valid.id; - - this._cache[valid.id] = feature$1; - return Object.assign(valid, { feature: feature$1 }); - } - return null; + // resolveLocation + // + // Pass a `location` identifier + // Returns a result like + // { + // type: 'point', 'geojson', or 'countrycoder' + // location:the queried location + // id: a unique identifier + // feature: the geojson feature + // } + //or `null` if the location is invalid + // + defaultExport.prototype.resolveLocation = function resolveLocation (location) { + var valid = this.validateLocation(location); + if (!valid) { return null; } + + // return a result from cache if we can + if (this._cache[valid.id]) { + return Object.assign(valid, { feature: this._cache[valid.id] }); + } + + // a [lon,lat] coordinate pair? + if (valid.type === 'point') { + var RADIUS = 25000;// meters + var EDGES = 10; + var PRECISION = 3; + var area = Math.PI * RADIUS * RADIUS / 1e6; // m² to km² + var feature$1 = this._cache[valid.id] = geojsonPrecision({ + type: 'Feature', + id: valid.id, + properties: { id: valid.id, area: Number(area.toFixed(2)) }, + geometry: circleToPolygon(location, RADIUS, EDGES) + }, PRECISION); + return Object.assign(valid, { feature: feature$1 }); + + // a .geojson filename? + } else if (valid.type === 'geojson') ; else if (valid.type === 'countrycoder') { + var feature$1$1 = _cloneDeep(feature(valid.id)); + var props = feature$1$1.properties; + + // -> This block of code is weird and requires some explanation. <- + // CountryCoder includes higher level features which are made up of members. + // These features don't have their own geometry, but CountryCoder provides an + // `aggregateFeature` method to combine these members into a MultiPolygon. + // BUT, when we try to actually work with these aggregated MultiPolygons, + // Turf/JSTS gets crashy because of topography bugs. + // SO, we'll aggregate the features ourselves by unioning them together. + // This approach also has the benefit of removing all the internal boaders and + // simplifying the regional polygons a lot. + if (Array.isArray(props.members)) { + var seed = feature$1$1.geometry ? feature$1$1 : null; + var aggregate = props.members.reduce(_locationReducer.bind(this), seed); + feature$1$1.geometry = aggregate.geometry; + } + + // ensure area property exists + if (!props.area) { + var area$1 = geojsonArea.geometry(feature$1$1.geometry) / 1e6;// m² to km² + props.area = Number(area$1.toFixed(2)); + } + + // ensure id property exists + feature$1$1.id = valid.id; + props.id = valid.id; + + this._cache[valid.id] = feature$1$1; + return Object.assign(valid, { feature: feature$1$1 }); } + return null; + }; - // resolveLocationSet - // - // Pass a `locationSet` Object like: - // `{ include: [ Array ], exclude: [ Array ] }` - // Returns a stable identifier string of the form: - // "+[included]-[excluded]" - // - resolveLocationSet(locationSet) { - locationSet = locationSet || {}; - const resolve = this.resolveLocation.bind(this); - let include = (locationSet.include || []).map(resolve).filter(Boolean); - let exclude = (locationSet.exclude || []).map(resolve).filter(Boolean); - if (!include.length) { - include = [resolve('Q2')]; // default to 'the world' - } + // resolveLocationSet + // + // Pass a `locationSet` Object like: + // `{ include: [ Array ], exclude: [ Array ] }` + // Returns a stable identifier string of the form: + // "+[included]-[excluded]" + // + defaultExport.prototype.resolveLocationSet = function resolveLocationSet (locationSet) { + locationSet = locationSet || {}; + var resolve = this.resolveLocation.bind(this); + var include = (locationSet.include || []).map(resolve).filter(Boolean); + var exclude = (locationSet.exclude || []).map(resolve).filter(Boolean); - // return quickly if it's a single included location.. - if (include.length === 1 && exclude.length === 0) { - return include[0].feature; - } + if (!include.length) { + include = [resolve('Q2')]; // default to 'the world' + } - // generate stable identifier - include.sort(sortFeatures); - let id = '+[' + include.map(d => d.id).join(',') + ']'; - if (exclude.length) { - exclude.sort(sortFeatures); - id += '-[' + exclude.map(d => d.id).join(',') + ']'; - } + // return quickly if it's a single included location.. + if (include.length === 1 && exclude.length === 0) { + return include[0].feature; + } - // return cached? - if (this._cache[id]) { - return this._cache[id]; - } + // generate stable identifier + include.sort(sortFeatures); + var id = '+[' + include.map(function (d) { return d.id; }).join(',') + ']'; + if (exclude.length) { + exclude.sort(sortFeatures); + id += '-[' + exclude.map(function (d) { return d.id; }).join(',') + ']'; + } - // calculate unions - let includeGeoJSON = include.map(d => d.location).reduce(_locationReducer.bind(this), null); - let excludeGeoJSON = exclude.map(d => d.location).reduce(_locationReducer.bind(this), null); + // return cached? + if (this._cache[id]) { + return this._cache[id]; + } - // calculate difference, update area and return result - let resultGeoJSON = excludeGeoJSON ? difference(includeGeoJSON, excludeGeoJSON) : includeGeoJSON; - const area = geojsonArea.geometry(resultGeoJSON.geometry) / 1e6; // m² to km² - resultGeoJSON.id = id; - resultGeoJSON.properties = { id: id, area: Number(area.toFixed(2)) }; + // calculate unions + var includeGeoJSON = include.map(function (d) { return d.location; }).reduce(_locationReducer.bind(this), null); + var excludeGeoJSON = exclude.map(function (d) { return d.location; }).reduce(_locationReducer.bind(this), null); - return this._cache[id] = resultGeoJSON; + // calculate difference, update area and return result + var resultGeoJSON = excludeGeoJSON ? difference(includeGeoJSON, excludeGeoJSON) : includeGeoJSON; + var area = geojsonArea.geometry(resultGeoJSON.geometry) / 1e6;// m² to km² + resultGeoJSON.id = id; + resultGeoJSON.properties = { id: id, area: Number(area.toFixed(2)) }; + return this._cache[id] = resultGeoJSON; - // Sorting the location lists is ok because they end up unioned together. - // This sorting makes it possible to generate a deterministic id. - function sortFeatures(a, b) { - const rank = { countrycoder: 1, geojson: 2, point: 3 }; - const aRank = rank[a.type]; - const bRank = rank[b.type]; - return (aRank > bRank) ? 1 - : (aRank < bRank) ? -1 - : a.id.localeCompare(b.id); - } + // Sorting the location lists is ok because they end up unioned together. + // This sorting makes it possible to generate a deterministic id. + function sortFeatures(a, b) { + var rank = { countrycoder: 1, geojson: 2, point: 3 }; + var aRank = rank[a.type]; + var bRank = rank[b.type]; + + return (aRank > bRank) ? 1 + : (aRank < bRank) ? -1 + : a.id.localeCompare(b.id); } + }; - cache() { - return this._cache; - } - } + defaultExport.prototype.cache = function cache () { + return this._cache; + }; - let _oci = null; + var _oci = null; function uiSuccess(context) { - const MAXEVENTS = 2; - const dispatch$1 = dispatch('cancel'); - let _changeset; - let _location; + var MAXEVENTS = 2; + var dispatch$1 = dispatch('cancel'); + var _changeset; + var _location; ensureOSMCommunityIndex(); // start fetching the data function ensureOSMCommunityIndex() { - const data = _mainFileFetcher; + var data = _mainFileFetcher; return Promise.all([ data.get('oci_resources'), data.get('oci_features') ]) - .then(vals => { - if (_oci) return _oci; + .then(function (vals) { + if (_oci) { return _oci; } - const ociResources = vals[0].resources; - const loco = new LocationConflation(vals[1]); - let ociFeatures = {}; + var ociResources = vals[0].resources; + var loco = new defaultExport(vals[1]); + var ociFeatures = {}; - Object.values(ociResources).forEach(resource => { - const feature = loco.resolveLocationSet(resource.locationSet); - let ociFeature = ociFeatures[feature.id]; + Object.values(ociResources).forEach(function (resource) { + var feature = loco.resolveLocationSet(resource.locationSet); + var ociFeature = ociFeatures[feature.id]; if (!ociFeature) { ociFeature = JSON.parse(JSON.stringify(feature)); // deep clone ociFeature.properties.resourceIDs = new Set(); @@ -112764,22 +112839,22 @@ // string-to-date parsing in JavaScript is weird function parseEventDate(when) { - if (!when) return; + if (!when) { return; } - let raw = when.trim(); - if (!raw) return; + var raw = when.trim(); + if (!raw) { return; } if (!/Z$/.test(raw)) { // if no trailing 'Z', add one raw += 'Z'; // this forces date to be parsed as a UTC date } - const parsed = new Date(raw); + var parsed = new Date(raw); return new Date(parsed.toUTCString().substr(0, 25)); // convert to local timezone } function success(selection) { - let header = selection + var header = selection .append('div') .attr('class', 'header fillL'); @@ -112790,14 +112865,14 @@ header .append('button') .attr('class', 'close') - .on('click', () => dispatch$1.call('cancel')) + .on('click', function () { return dispatch$1.call('cancel'); }) .call(svgIcon('#iD-icon-close')); - let body = selection + var body = selection .append('div') .attr('class', 'body save-success fillL'); - let summary = body + var summary = body .append('div') .attr('class', 'save-summary'); @@ -112817,16 +112892,16 @@ .append('span') .text(_t('success.help_link_text')); - let osm = context.connection(); - if (!osm) return; + var osm = context.connection(); + if (!osm) { return; } - let changesetURL = osm.changesetURL(_changeset.id); + var changesetURL = osm.changesetURL(_changeset.id); - let table = summary + var table = summary .append('table') .attr('class', 'summary-table'); - let row = table + var row = table .append('tr') .attr('class', 'summary-row'); @@ -112841,7 +112916,7 @@ .append('use') .attr('xlink:href', '#iD-logo-osm'); - let summaryDetail = row + var summaryDetail = row .append('td') .attr('class', 'cell-detail summary-detail'); @@ -112855,21 +112930,21 @@ summaryDetail .append('div') .html(_t('success.changeset_id', { - changeset_id: `${_changeset.id}` + changeset_id: ("" + (_changeset.id) + "") })); // Get OSM community index features intersecting the map.. ensureOSMCommunityIndex() - .then(oci => { - let communities = []; - const properties = oci.query(context.map().center(), true) || []; + .then(function (oci) { + var communities = []; + var properties = oci.query(context.map().center(), true) || []; // Gather the communities from the result - properties.forEach(props => { - const resourceIDs = Array.from(props.resourceIDs); - resourceIDs.forEach(resourceID => { - const resource = oci.resources[resourceID]; + properties.forEach(function (props) { + var resourceIDs = Array.from(props.resourceIDs); + resourceIDs.forEach(function (resourceID) { + var resource = oci.resources[resourceID]; communities.push({ area: props.area || Infinity, order: resource.order || 0, @@ -112879,16 +112954,16 @@ }); // sort communities by feature area ascending, community order descending - communities.sort((a, b) => a.area - b.area || b.order - a.order); + communities.sort(function (a, b) { return a.area - b.area || b.order - a.order; }); body - .call(showCommunityLinks, communities.map(c => c.resource)); + .call(showCommunityLinks, communities.map(function (c) { return c.resource; })); }); } function showCommunityLinks(selection, resources) { - let communityLinks = selection + var communityLinks = selection .append('div') .attr('class', 'save-communityLinks'); @@ -112896,14 +112971,14 @@ .append('h3') .text(_t('success.like_osm')); - let table = communityLinks + var table = communityLinks .append('table') .attr('class', 'community-table'); - let row = table.selectAll('.community-row') + var row = table.selectAll('.community-row') .data(resources); - let rowEnter = row.enter() + var rowEnter = row.enter() .append('tr') .attr('class', 'community-row'); @@ -112912,13 +112987,13 @@ .attr('class', 'cell-icon community-icon') .append('a') .attr('target', '_blank') - .attr('href', d => d.url) + .attr('href', function (d) { return d.url; }) .append('svg') .attr('class', 'logo-small') .append('use') - .attr('xlink:href', d => `#community-${d.type}`); + .attr('xlink:href', function (d) { return ("#community-" + (d.type)); }); - let communityDetail = rowEnter + var communityDetail = rowEnter .append('td') .attr('class', 'cell-detail community-detail'); @@ -112941,9 +113016,9 @@ function showCommunityDetails(d) { - let selection = select(this); - let communityID = d.id; - let replacements = { + var selection = select(this); + var communityID = d.id; + var replacements = { url: linkify(d.url), signupUrl: linkify(d.signupUrl || d.url) }; @@ -112954,13 +113029,13 @@ .append('a') .attr('target', '_blank') .attr('href', d.url) - .text(_t(`community.${d.id}.name`)); + .text(_t(("community." + (d.id) + ".name"))); - let descriptionHTML = _t(`community.${d.id}.description`, replacements); + var descriptionHTML = _t(("community." + (d.id) + ".description"), replacements); if (d.type === 'reddit') { // linkify subreddits #4997 descriptionHTML = descriptionHTML - .replace(/(\/r\/\w*\/*)/i, match => linkify(d.url, match)); + .replace(/(\/r\/\w*\/*)/i, function (match) { return linkify(d.url, match); }); } selection @@ -112971,7 +113046,7 @@ if (d.extendedDescription || (d.languageCodes && d.languageCodes.length)) { selection .append('div') - .call(uiDisclosure(context, `community-more-${d.id}`, false) + .call(uiDisclosure(context, ("community-more-" + (d.id)), false) .expanded(false) .updatePreference(false) .title(_t('success.more')) @@ -112979,17 +113054,17 @@ ); } - let nextEvents = (d.events || []) - .map(event => { + var nextEvents = (d.events || []) + .map(function (event) { event.date = parseEventDate(event.when); return event; }) - .filter(event => { // date is valid and future (or today) - const t = event.date.getTime(); - const now = (new Date()).setHours(0,0,0,0); + .filter(function (event) { // date is valid and future (or today) + var t = event.date.getTime(); + var now = (new Date()).setHours(0,0,0,0); return !isNaN(t) && t >= now; }) - .sort((a, b) => { // sort by date ascending + .sort(function (a, b) { // sort by date ascending return a.date < b.date ? -1 : a.date > b.date ? 1 : 0; }) .slice(0, MAXEVENTS); // limit number of events shown @@ -112997,7 +113072,7 @@ if (nextEvents.length) { selection .append('div') - .call(uiDisclosure(context, `community-events-${d.id}`, false) + .call(uiDisclosure(context, ("community-events-" + (d.id)), false) .expanded(false) .updatePreference(false) .title(_t('success.events')) @@ -113011,10 +113086,10 @@ function showMore(selection) { - let more = selection.selectAll('.community-more') + var more = selection.selectAll('.community-more') .data([0]); - let moreEnter = more.enter() + var moreEnter = more.enter() .append('div') .attr('class', 'community-more'); @@ -113022,12 +113097,12 @@ moreEnter .append('div') .attr('class', 'community-extended-description') - .html(_t(`community.${d.id}.extendedDescription`, replacements)); + .html(_t(("community." + (d.id) + ".extendedDescription"), replacements)); } if (d.languageCodes && d.languageCodes.length) { - const languageList = d.languageCodes - .map(code => _mainLocalizer.languageName(code)) + var languageList = d.languageCodes + .map(function (code) { return _mainLocalizer.languageName(code); }) .join(', '); moreEnter @@ -113039,14 +113114,14 @@ function showNextEvents(selection) { - let events = selection + var events = selection .append('div') .attr('class', 'community-events'); - let item = events.selectAll('.community-event') + var item = events.selectAll('.community-event') .data(nextEvents); - let itemEnter = item.enter() + var itemEnter = item.enter() .append('div') .attr('class', 'community-event'); @@ -113055,11 +113130,11 @@ .attr('class', 'community-event-name') .append('a') .attr('target', '_blank') - .attr('href', d => d.url) - .text(d => { - let name = d.name; + .attr('href', function (d) { return d.url; }) + .text(function (d) { + var name = d.name; if (d.i18n && d.id) { - name = _t(`community.${communityID}.events.${d.id}.name`, { default: name }); + name = _t(("community." + communityID + ".events." + (d.id) + ".name"), { default: name }); } return name; }); @@ -113067,8 +113142,8 @@ itemEnter .append('div') .attr('class', 'community-event-when') - .text(d => { - let options = { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' }; + .text(function (d) { + var options = { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' }; if (d.date.getHours() || d.date.getMinutes()) { // include time if it has one options.hour = 'numeric'; options.minute = 'numeric'; @@ -113079,10 +113154,10 @@ itemEnter .append('div') .attr('class', 'community-event-where') - .text(d => { - let where = d.where; + .text(function (d) { + var where = d.where; if (d.i18n && d.id) { - where = _t(`community.${communityID}.events.${d.id}.where`, { default: where }); + where = _t(("community." + communityID + ".events." + (d.id) + ".where"), { default: where }); } return where; }); @@ -113090,10 +113165,10 @@ itemEnter .append('div') .attr('class', 'community-event-description') - .text(d => { - let description = d.description; + .text(function (d) { + var description = d.description; if (d.i18n && d.id) { - description = _t(`community.${communityID}.events.${d.id}.description`, { default: description }); + description = _t(("community." + communityID + ".events." + (d.id) + ".description"), { default: description }); } return description; }); @@ -113102,20 +113177,20 @@ function linkify(url, text) { text = text || url; - return `${text}`; + return ("" + text + ""); } } success.changeset = function(val) { - if (!arguments.length) return _changeset; + if (!arguments.length) { return _changeset; } _changeset = val; return success; }; success.location = function(val) { - if (!arguments.length) return _location; + if (!arguments.length) { return _location; } _location = val; return success; }; @@ -113297,10 +113372,10 @@ function prepareForSuccess() { _success = uiSuccess(context); _location = null; - if (!services.geocoder) return; + if (!services.geocoder) { return; } services.geocoder.reverse(context.map().center(), function(err, result) { - if (err || !result || !result.address) return; + if (err || !result || !result.address) { return; } var addr = result.address; var place = (addr && (addr.town || addr.city || addr.county)) || ''; @@ -113409,7 +113484,7 @@ modes.forEach(function(mode) { context.keybinding().on(mode.key, function() { - if (!enabled()) return; + if (!enabled()) { return; } if (mode.id === context.mode().id) { context.enter(modeBrowse(context)); @@ -113452,11 +113527,11 @@ .append('button') .attr('class', function(d) { return d.id + ' add-button bar-button'; }) .on('click.mode-buttons', function(d) { - if (!enabled()) return; + if (!enabled()) { return; } // When drawing, ignore accidental clicks on mode buttons - #4042 var currMode = context.mode().id; - if (/^draw/.test(currMode)) return; + if (/^draw/.test(currMode)) { return; } if (d.id === currMode) { context.enter(modeBrowse(context)); @@ -113522,7 +113597,7 @@ } context.keybinding().on(mode.key, function() { - if (!enabled()) return; + if (!enabled()) { return; } if (mode.id === context.mode().id) { context.enter(modeBrowse(context)); @@ -113563,11 +113638,11 @@ .attr('tabindex', -1) .attr('class', function(d) { return d.id + ' add-button bar-button'; }) .on('click.notes', function(d) { - if (!enabled()) return; + if (!enabled()) { return; } // When drawing, ignore accidental clicks on mode buttons - #4042 var currMode = context.mode().id; - if (/^draw/.test(currMode)) return; + if (/^draw/.test(currMode)) { return; } if (d.id === currMode) { context.enter(modeBrowse(context)); @@ -113659,7 +113734,7 @@ function updateCount() { var val = history.difference().summary().length; - if (val === _numChanges) return; + if (val === _numChanges) { return; } _numChanges = val; @@ -113886,11 +113961,11 @@ context.keybinding() .on(commands[0].cmd, function() { event.preventDefault(); - if (editable()) commands[0].action(); + if (editable()) { commands[0].action(); } }) .on(commands[1].cmd, function() { event.preventDefault(); - if (editable()) commands[1].action(); + if (editable()) { commands[1].action(); } }); @@ -113902,7 +113977,7 @@ context.history() .on('change.undo_redo', function(difference) { - if (difference) update(); + if (difference) { update(); } }); context @@ -114005,7 +114080,7 @@ .append('div') .attr('class', function(d) { var classes = 'toolbar-item ' + (d.id || d).replace('_', '-'); - if (d.klass) classes += ' ' + d.klass; + if (d.klass) { classes += ' ' + d.klass; } return classes; }); @@ -114276,31 +114351,31 @@ }; pane.title = function(val) { - if (!arguments.length) return _title; + if (!arguments.length) { return _title; } _title = val; return pane; }; pane.key = function(val) { - if (!arguments.length) return _key; + if (!arguments.length) { return _key; } _key = val; return pane; }; pane.description = function(val) { - if (!arguments.length) return _description; + if (!arguments.length) { return _description; } _description = val; return pane; }; pane.iconName = function(val) { - if (!arguments.length) return _iconName; + if (!arguments.length) { return _iconName; } _iconName = val; return pane; }; pane.sections = function(val) { - if (!arguments.length) return _sections; + if (!arguments.length) { return _sections; } _sections = val; return pane; }; @@ -114314,7 +114389,7 @@ } pane.togglePane = function() { - if (event) event.preventDefault(); + if (event) { event.preventDefault(); } _paneTooltip.hide(); context.ui().togglePanes(!_paneSelection.classed('shown') ? _paneSelection : undefined); }; @@ -114461,7 +114536,7 @@ .attr('title', _t('background.reset')) .attr('class', function(d) { return 'display-option-reset display-option-reset-' + d; }) .on('click', function(d) { - if (event.button !== 0) return; + if (event.button !== 0) { return; } updateValue(d, 1); }) .call(svgIcon('#iD-icon-' + (_mainLocalizer.textDirection() === 'rtl' ? 'redo' : 'undo'))); @@ -114526,23 +114601,23 @@ var textSection = modal.select('.modal-section.message-text'); var instructions = - `${_t('settings.custom_background.instructions.info')}\n` + + (_t('settings.custom_background.instructions.info')) + "\n" + '\n' + - `#### ${_t('settings.custom_background.instructions.wms.tokens_label')}\n` + - `* ${_t('settings.custom_background.instructions.wms.tokens.proj')}\n` + - `* ${_t('settings.custom_background.instructions.wms.tokens.wkid')}\n` + - `* ${_t('settings.custom_background.instructions.wms.tokens.dimensions')}\n` + - `* ${_t('settings.custom_background.instructions.wms.tokens.bbox')}\n` + + "#### " + (_t('settings.custom_background.instructions.wms.tokens_label')) + "\n" + + "* " + (_t('settings.custom_background.instructions.wms.tokens.proj')) + "\n" + + "* " + (_t('settings.custom_background.instructions.wms.tokens.wkid')) + "\n" + + "* " + (_t('settings.custom_background.instructions.wms.tokens.dimensions')) + "\n" + + "* " + (_t('settings.custom_background.instructions.wms.tokens.bbox')) + "\n" + '\n' + - `#### ${_t('settings.custom_background.instructions.tms.tokens_label')}\n` + - `* ${_t('settings.custom_background.instructions.tms.tokens.xyz')}\n` + - `* ${_t('settings.custom_background.instructions.tms.tokens.flipped_y')}\n` + - `* ${_t('settings.custom_background.instructions.tms.tokens.switch')}\n` + - `* ${_t('settings.custom_background.instructions.tms.tokens.quadtile')}\n` + - `* ${_t('settings.custom_background.instructions.tms.tokens.scale_factor')}\n` + + "#### " + (_t('settings.custom_background.instructions.tms.tokens_label')) + "\n" + + "* " + (_t('settings.custom_background.instructions.tms.tokens.xyz')) + "\n" + + "* " + (_t('settings.custom_background.instructions.tms.tokens.flipped_y')) + "\n" + + "* " + (_t('settings.custom_background.instructions.tms.tokens.switch')) + "\n" + + "* " + (_t('settings.custom_background.instructions.tms.tokens.quadtile')) + "\n" + + "* " + (_t('settings.custom_background.instructions.tms.tokens.scale_factor')) + "\n" + '\n' + - `#### ${_t('settings.custom_background.instructions.example')}\n` + - `\`${example}\``; + "#### " + (_t('settings.custom_background.instructions.example')) + "\n" + + "`" + example + "`"; textSection .append('div') @@ -114951,7 +115026,7 @@ var input = select(this); var d = input.node().value; - if (d === '') return resetOffset(); + if (d === '') { return resetOffset(); } d = d.replace(/;/g, ',').split(',').map(function(n) { // if n is NaN, it will always get mapped to false. @@ -114969,7 +115044,7 @@ function dragOffset() { - if (event.button !== 0) return; + if (event.button !== 0) { return; } var origin = [event.clientX, event.clientY]; @@ -114989,7 +115064,7 @@ } function pointermove() { - if (pointerId !== (event.pointerId || 'mouse')) return; + if (pointerId !== (event.pointerId || 'mouse')) { return; } var latest = [event.clientX, event.clientY]; var d = [ @@ -115002,8 +115077,8 @@ } function pointerup() { - if (pointerId !== (event.pointerId || 'mouse')) return; - if (event.button !== 0) return; + if (pointerId !== (event.pointerId || 'mouse')) { return; } + if (event.button !== 0) { return; } context.container().selectAll('.nudge-surface') .remove(); @@ -115046,7 +115121,7 @@ .attr('class', function(d) { return d[0] + ' nudge'; }) .on('contextmenu', cancelEvent) .on(_pointerPrefix + 'down', function(d) { - if (event.button !== 0) return; + if (event.button !== 0) { return; } pointerdownNudgeButton(d[1]); }); @@ -115057,7 +115132,7 @@ .on('contextmenu', cancelEvent) .on('click', function() { event.preventDefault(); - if (event.button !== 0) return; + if (event.button !== 0) { return; } resetOffset(); }) .call(svgIcon('#iD-icon-' + (_mainLocalizer.textDirection() === 'rtl' ? 'redo' : 'undo'))); @@ -115512,7 +115587,7 @@ function clickWalkthrough() { - if (context.inIntro()) return; + if (context.inIntro()) { return; } context.container().call(uiIntro(context)); context.ui().togglePanes(); } @@ -115591,7 +115666,7 @@ var section = uiSection(id, context) .title(function() { - if (!_issues) return ''; + if (!_issues) { return ''; } var issueCountText = _issues.length > 1000 ? '1000+' : String(_issues.length); return _t('issues.' + severity + 's.list_title', { count: issueCountText }); }) @@ -116399,7 +116474,7 @@ function setLayer(which, enabled) { // Don't allow layer changes while drawing - #6584 var mode = context.mode(); - if (mode && /^draw/.test(mode.id)) return; + if (mode && /^draw/.test(mode.id)) { return; } var layer = layers.layer(which); if (layer) { @@ -116963,7 +117038,7 @@ }) .keys(function(d) { var key = (d === 'wireframe' ? _t('area_fill.wireframe.key') : null); - if (d === 'highlight_edits') key = _t('map_data.highlight_edits.key'); + if (d === 'highlight_edits') { key = _t('map_data.highlight_edits.key'); } return key ? [key] : null; }) .placement('top') @@ -117074,10 +117149,10 @@ .append('label') .each(function(d) { var titleID; - if (d.id === 'mapillary-signs') titleID = 'mapillary.signs.tooltip'; - else if (d.id === 'mapillary') titleID = 'mapillary_images.tooltip'; - else if (d.id === 'openstreetcam') titleID = 'openstreetcam_images.tooltip'; - else titleID = d.id.replace(/-/g, '_') + '.tooltip'; + if (d.id === 'mapillary-signs') { titleID = 'mapillary.signs.tooltip'; } + else if (d.id === 'mapillary') { titleID = 'mapillary_images.tooltip'; } + else if (d.id === 'openstreetcam') { titleID = 'openstreetcam_images.tooltip'; } + else { titleID = d.id.replace(/-/g, '_') + '.tooltip'; } select(this) .call(uiTooltip() .title(_t(titleID)) @@ -117094,7 +117169,7 @@ .append('span') .text(function(d) { var id = d.id; - if (id === 'mapillary-signs') id = 'photo_overlays.traffic_signs'; + if (id === 'mapillary-signs') { id = 'photo_overlays.traffic_signs'; } return _t(id.replace(/-/g, '_') + '.title'); }); @@ -117214,21 +117289,21 @@ function uiSectionPrivacy(context) { - let section = uiSection('preferences-third-party', context) + var section = uiSection('preferences-third-party', context) .title(_t('preferences.privacy.title')) .disclosureContent(renderDisclosureContent); - let _showThirdPartyIcons = corePreferences('preferences.privacy.thirdpartyicons') || 'true'; + var _showThirdPartyIcons = corePreferences('preferences.privacy.thirdpartyicons') || 'true'; function renderDisclosureContent(selection) { // enter - let privacyOptionsListEnter = selection.selectAll('.privacy-options-list') + var privacyOptionsListEnter = selection.selectAll('.privacy-options-list') .data([0]) .enter() .append('ul') .attr('class', 'layer-list privacy-options-list'); - let thirdPartyIconsEnter = privacyOptionsListEnter + var thirdPartyIconsEnter = privacyOptionsListEnter .append('li') .attr('class', 'privacy-third-party-icons-item') .append('label') @@ -117240,7 +117315,7 @@ thirdPartyIconsEnter .append('input') .attr('type', 'checkbox') - .on('change', () => { + .on('change', function () { event.preventDefault(); _showThirdPartyIcons = (_showThirdPartyIcons === 'true') ? 'false' : 'true'; corePreferences('preferences.privacy.thirdpartyicons', _showThirdPartyIcons); @@ -117281,7 +117356,7 @@ function uiPanePreferences(context) { - let preferencesPane = uiPane('preferences', context) + var preferencesPane = uiPane('preferences', context) .key(_t('preferences.key')) .title(_t('preferences.title')) .description(_t('preferences.description')) @@ -117305,9 +117380,9 @@ container .on('click.ui', function() { // we're only concerned with the primary mouse button - if (event.button !== 0) return; + if (event.button !== 0) { return; } - if (!event.composedPath) return; + if (!event.composedPath) { return; } // some targets have default click events we don't want to override var isOkayTarget = event.composedPath().some(function(node) { @@ -117316,7 +117391,7 @@ // clicking opens a hyperlink by default node.nodeName === 'A'; }); - if (isOkayTarget) return; + if (isOkayTarget) { return; } // disable double-tap-to-zoom on touchscreens event.preventDefault(); @@ -117626,7 +117701,7 @@ // Don't allow layer changes while drawing - #6584 var mode = context.mode(); - if (mode && /^draw/.test(mode.id)) return; + if (mode && /^draw/.test(mode.id)) { return; } var layer = context.layers().layer('osm'); if (layer) { @@ -117688,8 +117763,8 @@ function pan(d) { return function() { - if (event.shiftKey) return; - if (context.container().select('.combobox').size()) return; + if (event.shiftKey) { return; } + if (context.container().select('.combobox').size()) { return; } event.preventDefault(); context.map().pan(d, 100); }; @@ -117698,23 +117773,23 @@ } - let ui = {}; + var ui = {}; - let _loadPromise; + var _loadPromise; // renders the iD interface into the container node - ui.ensureLoaded = () => { + ui.ensureLoaded = function () { - if (_loadPromise) return _loadPromise; + if (_loadPromise) { return _loadPromise; } return _loadPromise = Promise.all([ // must have strings and presets before loading the UI _mainLocalizer.ensureLoaded(), _mainPresetIndex.ensureLoaded() ]) - .then(() => { - if (!context.container().empty()) render(context.container()); + .then(function () { + if (!context.container().empty()) { render(context.container()); } }) - .catch(err => console.error(err)); // eslint-disable-line + .catch(function (err) { return console.error(err); }); // eslint-disable-line }; @@ -117851,11 +117926,11 @@ // remove any displayed menu ui.closeEditMenu(); - if (!operations && context.mode().operations) operations = context.mode().operations(); - if (!operations || !operations.length) return; + if (!operations && context.mode().operations) { operations = context.mode().operations(); } + if (!operations || !operations.length) { return; } // disable menu if in wide selection, for example - if (!context.map().editableDataEnabled()) return; + if (!context.map().editableDataEnabled()) { return; } var surfaceNode = context.surface().node(); if (surfaceNode.focus) { // FF doesn't support it @@ -117864,7 +117939,7 @@ } operations.forEach(function(operation) { - if (operation.point) operation.point(anchorPoint); + if (operation.point) { operation.point(anchorPoint); } }); _editMenu @@ -117901,9 +117976,11 @@ } function coreContext() { - const dispatch$1 = dispatch('enter', 'exit', 'change'); - let context = utilRebind({}, dispatch$1, 'on'); - let _deferred = new Set(); + var this$1 = this; + + var dispatch$1 = dispatch('enter', 'exit', 'change'); + var context = utilRebind({}, dispatch$1, 'on'); + var _deferred = new Set(); context.version = '2.18.1'; context.privacyVersion = '20200407'; @@ -117918,21 +117995,21 @@ // An osmChangeset object. Not loaded until needed. context.changeset = null; - let _defaultChangesetComment = context.initialHashParams.comment; - let _defaultChangesetSource = context.initialHashParams.source; - let _defaultChangesetHashtags = context.initialHashParams.hashtags; + var _defaultChangesetComment = context.initialHashParams.comment; + var _defaultChangesetSource = context.initialHashParams.source; + var _defaultChangesetHashtags = context.initialHashParams.hashtags; context.defaultChangesetComment = function(val) { - if (!arguments.length) return _defaultChangesetComment; + if (!arguments.length) { return _defaultChangesetComment; } _defaultChangesetComment = val; return context; }; context.defaultChangesetSource = function(val) { - if (!arguments.length) return _defaultChangesetSource; + if (!arguments.length) { return _defaultChangesetSource; } _defaultChangesetSource = val; return context; }; context.defaultChangesetHashtags = function(val) { - if (!arguments.length) return _defaultChangesetHashtags; + if (!arguments.length) { return _defaultChangesetHashtags; } _defaultChangesetHashtags = val; return context; }; @@ -117941,43 +118018,43 @@ /* (typically shown as the label for the browser window/tab) */ // If true, iD will update the title based on what the user is doing - let _setsDocumentTitle = true; + var _setsDocumentTitle = true; context.setsDocumentTitle = function(val) { - if (!arguments.length) return _setsDocumentTitle; + if (!arguments.length) { return _setsDocumentTitle; } _setsDocumentTitle = val; return context; }; // The part of the title that is always the same - let _documentTitleBase = document.title; + var _documentTitleBase = document.title; context.documentTitleBase = function(val) { - if (!arguments.length) return _documentTitleBase; + if (!arguments.length) { return _documentTitleBase; } _documentTitleBase = val; return context; }; /* User interface and keybinding */ - let _ui; - context.ui = () => _ui; - context.lastPointerType = () => _ui.lastPointerType(); + var _ui; + context.ui = function () { return _ui; }; + context.lastPointerType = function () { return _ui.lastPointerType(); }; - let _keybinding = utilKeybinding('context'); - context.keybinding = () => _keybinding; + var _keybinding = utilKeybinding('context'); + context.keybinding = function () { return _keybinding; }; select(document).call(_keybinding); /* Straight accessors. Avoid using these if you can. */ - let _connection; - let _history; - let _validator; - let _uploader; - context.connection = () => _connection; - context.history = () => _history; - context.validator = () => _validator; - context.uploader = () => _uploader; + var _connection; + var _history; + var _validator; + var _uploader; + context.connection = function () { return _connection; }; + context.history = function () { return _history; }; + context.validator = function () { return _validator; }; + context.uploader = function () { return _uploader; }; /* Connection */ - context.preauth = (options) => { + context.preauth = function (options) { if (_connection) { _connection.switch(options); } @@ -117985,9 +118062,9 @@ }; /* connection options for source switcher (optional) */ - let _apiConnections; + var _apiConnections; context.apiConnections = function(val) { - if (!arguments.length) return _apiConnections; + if (!arguments.length) { return _apiConnections; } _apiConnections = val; return context; }; @@ -117995,14 +118072,14 @@ // A string or array or locale codes to prefer over the browser's settings context.locale = function(locale) { - if (!arguments.length) return _mainLocalizer.localeCode(); + if (!arguments.length) { return _mainLocalizer.localeCode(); } _mainLocalizer.preferredLocaleCodes(locale); return context; }; function afterLoad(cid, callback) { - return (err, result) => { + return function (err, result) { if (err) { // 400 Bad Request, 401 Unauthorized, 403 Forbidden.. if (err.status === 400 || err.status === 401 || err.status === 403) { @@ -118032,54 +118109,54 @@ } - context.loadTiles = (projection, callback) => { - const handle = window.requestIdleCallback(() => { + context.loadTiles = function (projection, callback) { + var handle = window.requestIdleCallback(function () { _deferred.delete(handle); if (_connection && context.editableDataEnabled()) { - const cid = _connection.getConnectionId(); + var cid = _connection.getConnectionId(); _connection.loadTiles(projection, afterLoad(cid, callback)); } }); _deferred.add(handle); }; - context.loadTileAtLoc = (loc, callback) => { - const handle = window.requestIdleCallback(() => { + context.loadTileAtLoc = function (loc, callback) { + var handle = window.requestIdleCallback(function () { _deferred.delete(handle); if (_connection && context.editableDataEnabled()) { - const cid = _connection.getConnectionId(); + var cid = _connection.getConnectionId(); _connection.loadTileAtLoc(loc, afterLoad(cid, callback)); } }); _deferred.add(handle); }; - context.loadEntity = (entityID, callback) => { + context.loadEntity = function (entityID, callback) { if (_connection) { - const cid = _connection.getConnectionId(); + var cid = _connection.getConnectionId(); _connection.loadEntity(entityID, afterLoad(cid, callback)); } }; - context.zoomToEntity = (entityID, zoomTo) => { + context.zoomToEntity = function (entityID, zoomTo) { if (zoomTo !== false) { - context.loadEntity(entityID, (err, result) => { - if (err) return; - const entity = result.data.find(e => e.id === entityID); + context.loadEntity(entityID, function (err, result) { + if (err) { return; } + var entity = result.data.find(function (e) { return e.id === entityID; }); if (entity) { _map.zoomTo(entity); } }); } - _map.on('drawn.zoomToEntity', () => { - if (!context.hasEntity(entityID)) return; + _map.on('drawn.zoomToEntity', function () { + if (!context.hasEntity(entityID)) { return; } _map.on('drawn.zoomToEntity', null); context.on('enter.zoomToEntity', null); context.enter(modeSelect(context, [entityID])); }); - context.on('enter.zoomToEntity', () => { + context.on('enter.zoomToEntity', function () { if (_mode.id !== 'browse') { _map.on('drawn.zoomToEntity', null); context.on('enter.zoomToEntity', null); @@ -118087,9 +118164,9 @@ }); }; - let _minEditableZoom = 16; + var _minEditableZoom = 16; context.minEditableZoom = function(val) { - if (!arguments.length) return _minEditableZoom; + if (!arguments.length) { return _minEditableZoom; } _minEditableZoom = val; if (_connection) { _connection.tileZoom(val); @@ -118098,9 +118175,9 @@ }; // String length limits in Unicode characters, not JavaScript UTF-16 code units - context.maxCharsForTagKey = () => 255; - context.maxCharsForTagValue = () => 255; - context.maxCharsForRelationRole = () => 255; + context.maxCharsForTagKey = function () { return 255; }; + context.maxCharsForTagValue = function () { return 255; }; + context.maxCharsForRelationRole = function () { return 255; }; function cleanOsmString(val, maxChars) { // be lenient with input @@ -118114,31 +118191,31 @@ val = val.trim(); // use the canonical form of the string - if (val.normalize) val = val.normalize('NFC'); + if (val.normalize) { val = val.normalize('NFC'); } // trim to the number of allowed characters return utilUnicodeCharsTruncated(val, maxChars); } - context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey()); - context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue()); - context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole()); + context.cleanTagKey = function (val) { return cleanOsmString(val, context.maxCharsForTagKey()); }; + context.cleanTagValue = function (val) { return cleanOsmString(val, context.maxCharsForTagValue()); }; + context.cleanRelationRole = function (val) { return cleanOsmString(val, context.maxCharsForRelationRole()); }; /* History */ - let _inIntro = false; + var _inIntro = false; context.inIntro = function(val) { - if (!arguments.length) return _inIntro; + if (!arguments.length) { return _inIntro; } _inIntro = val; return context; }; // Immediately save the user's history to localstorage, if possible // This is called someteimes, but also on the `window.onbeforeunload` handler - context.save = () => { + context.save = function () { // no history save, no message onbeforeunload - if (_inIntro || context.container().select('.modal').size()) return; + if (_inIntro || context.container().select('.modal').size()) { return; } - let canSave; + var canSave; if (_mode && _mode.id === 'save') { canSave = false; @@ -118149,8 +118226,8 @@ } } else { - canSave = context.selectedIDs().every(id => { - const entity = context.hasEntity(id); + canSave = context.selectedIDs().every(function (id) { + var entity = context.hasEntity(id); return entity && !entity.isDegenerate(); }); } @@ -118169,7 +118246,7 @@ function withDebouncedSave(fn) { return function() { - const result = fn.apply(_history, arguments); + var result = fn.apply(_history, arguments); context.debouncedSave(); return result; }; @@ -118177,115 +118254,115 @@ /* Graph */ - context.hasEntity = (id) => _history.graph().hasEntity(id); - context.entity = (id) => _history.graph().entity(id); + context.hasEntity = function (id) { return _history.graph().hasEntity(id); }; + context.entity = function (id) { return _history.graph().entity(id); }; /* Modes */ - let _mode; - context.mode = () => _mode; - context.enter = (newMode) => { + var _mode; + context.mode = function () { return _mode; }; + context.enter = function (newMode) { if (_mode) { _mode.exit(); - dispatch$1.call('exit', this, _mode); + dispatch$1.call('exit', this$1, _mode); } _mode = newMode; _mode.enter(); - dispatch$1.call('enter', this, _mode); + dispatch$1.call('enter', this$1, _mode); }; - context.selectedIDs = () => (_mode && _mode.selectedIDs && _mode.selectedIDs()) || []; - context.activeID = () => _mode && _mode.activeID && _mode.activeID(); + context.selectedIDs = function () { return (_mode && _mode.selectedIDs && _mode.selectedIDs()) || []; }; + context.activeID = function () { return _mode && _mode.activeID && _mode.activeID(); }; - let _selectedNoteID; + var _selectedNoteID; context.selectedNoteID = function(noteID) { - if (!arguments.length) return _selectedNoteID; + if (!arguments.length) { return _selectedNoteID; } _selectedNoteID = noteID; return context; }; // NOTE: Don't change the name of this until UI v3 is merged - let _selectedErrorID; + var _selectedErrorID; context.selectedErrorID = function(errorID) { - if (!arguments.length) return _selectedErrorID; + if (!arguments.length) { return _selectedErrorID; } _selectedErrorID = errorID; return context; }; /* Behaviors */ - context.install = (behavior) => context.surface().call(behavior); - context.uninstall = (behavior) => context.surface().call(behavior.off); + context.install = function (behavior) { return context.surface().call(behavior); }; + context.uninstall = function (behavior) { return context.surface().call(behavior.off); }; /* Copy/Paste */ - let _copyGraph; - context.copyGraph = () => _copyGraph; + var _copyGraph; + context.copyGraph = function () { return _copyGraph; }; - let _copyIDs = []; + var _copyIDs = []; context.copyIDs = function(val) { - if (!arguments.length) return _copyIDs; + if (!arguments.length) { return _copyIDs; } _copyIDs = val; _copyGraph = _history.graph(); return context; }; - let _copyLonLat; + var _copyLonLat; context.copyLonLat = function(val) { - if (!arguments.length) return _copyLonLat; + if (!arguments.length) { return _copyLonLat; } _copyLonLat = val; return context; }; /* Background */ - let _background; - context.background = () => _background; + var _background; + context.background = function () { return _background; }; /* Features */ - let _features; - context.features = () => _features; - context.hasHiddenConnections = (id) => { - const graph = _history.graph(); - const entity = graph.entity(id); + var _features; + context.features = function () { return _features; }; + context.hasHiddenConnections = function (id) { + var graph = _history.graph(); + var entity = graph.entity(id); return _features.hasHiddenConnections(entity, graph); }; /* Photos */ - let _photos; - context.photos = () => _photos; + var _photos; + context.photos = function () { return _photos; }; /* Map */ - let _map; - context.map = () => _map; - context.layers = () => _map.layers(); - context.surface = () => _map.surface; - context.editableDataEnabled = () => _map.editableDataEnabled(); - context.surfaceRect = () => _map.surface.node().getBoundingClientRect(); - context.editable = () => { + var _map; + context.map = function () { return _map; }; + context.layers = function () { return _map.layers(); }; + context.surface = function () { return _map.surface; }; + context.editableDataEnabled = function () { return _map.editableDataEnabled(); }; + context.surfaceRect = function () { return _map.surface.node().getBoundingClientRect(); }; + context.editable = function () { // don't allow editing during save - const mode = context.mode(); - if (!mode || mode.id === 'save') return false; + var mode = context.mode(); + if (!mode || mode.id === 'save') { return false; } return _map.editableDataEnabled(); }; /* Debug */ - let _debugFlags = { + var _debugFlags = { tile: false, // tile boundaries collision: false, // label collision bounding boxes imagery: false, // imagery bounding polygons target: false, // touch targets downloaded: false // downloaded data from osm }; - context.debugFlags = () => _debugFlags; - context.getDebug = (flag) => flag && _debugFlags[flag]; + context.debugFlags = function () { return _debugFlags; }; + context.getDebug = function (flag) { return flag && _debugFlags[flag]; }; context.setDebug = function(flag, val) { - if (arguments.length === 1) val = true; + if (arguments.length === 1) { val = true; } _debugFlags[flag] = val; dispatch$1.call('change'); return context; @@ -118293,63 +118370,63 @@ /* Container */ - let _container = select(null); + var _container = select(null); context.container = function(val) { - if (!arguments.length) return _container; + if (!arguments.length) { return _container; } _container = val; _container.classed('ideditor', true); return context; }; context.containerNode = function(val) { - if (!arguments.length) return context.container().node(); + if (!arguments.length) { return context.container().node(); } context.container(select(val)); return context; }; - let _embed; + var _embed; context.embed = function(val) { - if (!arguments.length) return _embed; + if (!arguments.length) { return _embed; } _embed = val; return context; }; /* Assets */ - let _assetPath = ''; + var _assetPath = ''; context.assetPath = function(val) { - if (!arguments.length) return _assetPath; + if (!arguments.length) { return _assetPath; } _assetPath = val; _mainFileFetcher.assetPath(val); return context; }; - let _assetMap = {}; + var _assetMap = {}; context.assetMap = function(val) { - if (!arguments.length) return _assetMap; + if (!arguments.length) { return _assetMap; } _assetMap = val; _mainFileFetcher.assetMap(val); return context; }; - context.asset = (val) => { - if (/^http(s)?:\/\//i.test(val)) return val; - const filename = _assetPath + val; + context.asset = function (val) { + if (/^http(s)?:\/\//i.test(val)) { return val; } + var filename = _assetPath + val; return _assetMap[filename] || filename; }; - context.imagePath = (val) => context.asset(`img/${val}`); + context.imagePath = function (val) { return context.asset(("img/" + val)); }; /* reset (aka flush) */ - context.reset = context.flush = () => { + context.reset = context.flush = function () { context.debouncedSave.cancel(); - Array.from(_deferred).forEach(handle => { + Array.from(_deferred).forEach(function (handle) { window.cancelIdleCallback(handle); _deferred.delete(handle); }); - Object.values(services).forEach(service => { + Object.values(services).forEach(function (service) { if (service && typeof service.reset === 'function') { service.reset(context); } @@ -118375,7 +118452,7 @@ /* Init */ - context.init = () => { + context.init = function () { instantiateInternal(); @@ -118429,7 +118506,7 @@ _background.ensureLoaded(); _mainPresetIndex.ensureLoaded(); - Object.values(services).forEach(service => { + Object.values(services).forEach(function (service) { if (service && typeof service.init === 'function') { service.init(); } @@ -118442,15 +118519,15 @@ if (services.maprules && context.initialHashParams.maprules) { d3_json(context.initialHashParams.maprules) - .then(mapcss => { + .then(function (mapcss) { services.maprules.init(); - mapcss.forEach(mapcssSelector => services.maprules.addRule(mapcssSelector)); + mapcss.forEach(function (mapcssSelector) { return services.maprules.addRule(mapcssSelector); }); }) - .catch(() => { /* ignore */ }); + .catch(function () { /* ignore */ }); } // if the container isn't available, e.g. when testing, don't load the UI - if (!context.container().empty()) _ui.ensureLoaded(); + if (!context.container().empty()) { _ui.ensureLoaded(); } } }; @@ -118460,8 +118537,8 @@ // When `debug = true`, we use `Object.freeze` on immutables in iD. // This is only done in testing because of the performance penalty. - let debug = false; - let d3 = { + var debug = false; + var d3 = { customEvent: customEvent, dispatch: dispatch, event: event, @@ -118917,4 +118994,3 @@ window.iD = iD; }()); -//# sourceMappingURL=iD.js.map