diff --git a/magrit_app/static/dist/app.630f0f.js b/client/dist/app.9b2b11.js similarity index 91% rename from magrit_app/static/dist/app.630f0f.js rename to client/dist/app.9b2b11.js index 982dcb6a0..0c8b50b53 100644 --- a/magrit_app/static/dist/app.630f0f.js +++ b/client/dist/app.9b2b11.js @@ -286,7 +286,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global, Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isValidJSON = exports.cloneObj = exports.clickLinkFromDataUrl = exports.getFieldsType = exports.type_col2 = exports.type_col = exports.drag_waffle = exports.drag_elem_geo2 = exports.drag_elem_geo = exports.createWaitingOverlay = exports.isNumber = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.setSelected = setSelected;\nexports.path_to_geojson2 = path_to_geojson2;\nexports.display_error_during_computation = display_error_during_computation;\nexports.request_data = request_data;\nexports.xhrequest = xhrequest;\nexports.getImgDataUrl = getImgDataUrl;\nexports.make_content_summary = make_content_summary;\nexports.copy_layer = copy_layer;\nexports.send_layer_server = send_layer_server;\nexports.get_other_layer_names = get_other_layer_names;\nexports.get_display_name_on_layer_list = get_display_name_on_layer_list;\nexports.create_li_layer_elem = create_li_layer_elem;\nexports.make_box_type_fields = make_box_type_fields;\nexports.getAvailablesFunctionnalities = getAvailablesFunctionnalities;\nexports.prepareFileExt = prepareFileExt;\nexports.accordionize2 = accordionize2;\nexports.getTargetLayerProps = getTargetLayerProps;\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _buttons = __webpack_require__(/*! ./ui/buttons */ \"./js/ui/buttons.js\");\n\nvar isNumber = exports.isNumber = function isNumber(value) {\n return value != null && value !== '' && isFinite(value) && !Number.isNaN(+value);\n};\n\nvar createWaitingOverlay = exports.createWaitingOverlay = function createWaitingOverlay() {\n var bg = document.createElement('div');\n bg.id = 'overlay';\n bg.style.display = 'none';\n bg.innerHTML = '\\n\"Magrit\"\\n\\n...
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n';\n\n document.body.appendChild(bg);\n var btn = bg.querySelector('button.button_st3');\n btn.onclick = function () {\n if (global._app.xhr_to_cancel) {\n global._app.xhr_to_cancel.abort();\n global._app.xhr_to_cancel = undefined;\n }\n if (global._app.webworker_to_cancel) {\n global._app.webworker_to_cancel.onmessage = null;\n global._app.webworker_to_cancel.terminate();\n global._app.webworker_to_cancel = undefined;\n }\n bg.style.display = 'none';\n };\n return {\n display: function display() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n bg.style.display = '';\n if (opts.cancel_button && opts.cancel_button === false) {\n btn.style.display = 'none';\n }\n if (opts.zIndex) {\n bg.style.zIndex = opts.zIndex;\n }\n },\n hide: function hide() {\n bg.style.display = 'none';\n bg.style.zIndex = '';\n btn.style.display = '';\n }\n };\n};\n\nvar drag_elem_geo = exports.drag_elem_geo = d3.drag().subject(function () {\n var t = d3.select(this);\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n}).on('drag', function () {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n});\n\nvar drag_elem_geo2 = exports.drag_elem_geo2 = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n // const layer_name = global._app.id_to_layer.get(this.parentElement.id);\n var symbol = data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].symbol;\n var t = d3.select(this);\n if (symbol === 'rect') {\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n } else if (symbol === 'circle') {\n return {\n x: t.attr('cx'),\n y: t.attr('cy'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n }\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n var zoom = svg_map.__zoom;\n var centroid = path.centroid(this.__data__.geometry);\n centroid[0] = centroid[0] * zoom.k + zoom.x;\n centroid[1] = centroid[1] * zoom.k + zoom.y;\n map.append('rect').attrs({ x: centroid[0] - 2, y: centroid[1] - 2, height: 4, width: 4, id: 'ref_symbol_location' }).style('fill', 'red');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n map.selectAll('#ref_symbol_location').remove();\n}).on('drag', function () {\n if (d3.event.subject.symbol === 'rect') {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n } else if (d3.event.subject.symbol === 'circle') {\n d3.select(this).attr('cx', d3.event.x).attr('cy', d3.event.y);\n }\n});\n\nvar drag_waffle = exports.drag_waffle = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n var t = d3.select(this);\n var prev_translate = t.attr('transform');\n prev_translate = prev_translate ? prev_translate.slice(10, -1).split(/[ ,]+/).map(function (f) {\n return +f;\n }) : [0, 0];\n return {\n x: t.attr('x') + prev_translate[0],\n y: t.attr('y') + prev_translate[1],\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n d3.select(this).style('cursor', 'grab');\n}).on('drag', function () {\n d3.select(this).attr('transform', 'translate(' + [d3.event.x, d3.event.y] + ')').style('cursor', 'grabbing');\n});\n\nfunction setSelected(selectNode, value) {\n selectNode.value = value; // eslint-disable-line no-param-reassign\n selectNode.dispatchEvent(new Event('change'));\n}\n\nfunction path_to_geojson(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: { type: d.type, coordinates: d.coordinates }\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction path_to_geojson2(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: d.geometry\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction display_error_during_computation(msg) {\n var message = message ? '
' + _tr('app_page.common.details') + ': ' + msg : '';\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_message') + msg,\n customClass: 'swal2_custom',\n type: 'error',\n allowOutsideClick: false\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @return {Promise} response\n*/\nfunction request_data(method, url, data) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(method, url, true);\n request.onload = resolve;\n request.onerror = reject;\n request.send(data);\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @param {Boolean} waitingMessage - Optionnal, whether to display or not\n* a waiting message while the request is proceeded\n* @return {Promise} response\n*/\nfunction xhrequest(method, url, data, waitingMessage) {\n if (waitingMessage) {\n global._app.waitingOverlay.display();\n }\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n global._app.xhr_to_cancel = request;\n request.open(method, url, true);\n request.onload = function (resp) {\n resolve(resp.target.responseText);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.onerror = function (err) {\n reject(err);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.send(data);\n });\n}\n\nfunction getImgDataUrl(url) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.onload = function () {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(request.response);\n };\n request.onerror = function (err) {\n reject(err);\n };\n request.open('GET', url, true);\n request.responseType = 'blob';\n request.send();\n });\n}\n\nfunction make_content_summary(serie) {\n var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;\n\n return [_tr('app_page.stat_summary.population'), ' : ', (0, _helpers_calc.round_value)(serie.pop(), precision), '
', _tr('app_page.stat_summary.min'), ' : ', (0, _helpers_calc.round_value)(serie.min(), precision), ' | ', _tr('app_page.stat_summary.max'), ' : ', (0, _helpers_calc.round_value)(serie.max(), precision), '
', _tr('app_page.stat_summary.mean'), ' : ', (0, _helpers_calc.round_value)(serie.mean(), precision), '
', _tr('app_page.stat_summary.median'), ' : ', (0, _helpers_calc.round_value)(serie.median(), precision), '
', _tr('app_page.stat_summary.variance'), ' : ', (0, _helpers_calc.round_value)(serie.variance(), precision), '
', _tr('app_page.stat_summary.stddev'), ' : ', (0, _helpers_calc.round_value)(serie.stddev(), precision), '
', _tr('app_page.stat_summary.cov'), ' : ', (0, _helpers_calc.round_value)(serie.cov(), precision)].join('');\n}\n\nfunction copy_layer(ref_layer, new_name, type_result, fields_to_copy) {\n var id_new_layer = encodeId(new_name);\n var id_ref_layer = global._app.layer_to_id.get(ref_layer);\n var node_ref_layer = svg_map.querySelector('#' + id_ref_layer);\n global._app.layer_to_id.set(new_name, id_new_layer);\n global._app.id_to_layer.set(id_new_layer, new_name);\n svg_map.appendChild(node_ref_layer.cloneNode(true));\n svg_map.lastChild.setAttribute('id', id_new_layer);\n var node_new_layer = document.getElementById(id_new_layer);\n svg_map.insertBefore(node_new_layer, svg_map.querySelector('.legend'));\n data_manager.result_data[new_name] = [];\n data_manager.current_layers[new_name] = {\n n_features: data_manager.current_layers[ref_layer].n_features,\n type: data_manager.current_layers[ref_layer].type,\n ref_layer_name: ref_layer\n };\n if (data_manager.current_layers[ref_layer].pointRadius) {\n data_manager.current_layers[new_name].pointRadius = data_manager.current_layers[ref_layer].pointRadius;\n }\n var selec_src = node_ref_layer.getElementsByTagName('path'),\n selec_dest = node_new_layer.getElementsByTagName('path');\n if (!fields_to_copy) {\n for (var i = 0; i < selec_src.length; i++) {\n selec_dest[i].__data__ = selec_src[i].__data__;\n data_manager.result_data[new_name].push(selec_dest[i].__data__.properties);\n }\n } else {\n for (var _i = 0; _i < selec_src.length; _i++) {\n selec_dest[_i].__data__ = { type: 'Feature', properties: {}, geometry: cloneObj(selec_src[_i].__data__.geometry) };\n var nb_field_to_copy = fields_to_copy.length;\n for (var j = 0; j < nb_field_to_copy; j++) {\n var f = fields_to_copy[j];\n selec_dest[_i].__data__.properties[f] = selec_src[_i].__data__.properties[f];\n }\n data_manager.result_data[new_name].push(selec_dest[_i].__data__.properties);\n }\n }\n // Set the desired class name :\n node_new_layer.className.baseVal = 'layer';\n // Reset visibility and filter attributes to default values:\n node_new_layer.style.visibility = '';\n node_new_layer.removeAttribute('filter');\n // Create an entry in the layer manager:\n create_li_layer_elem(new_name, data_manager.current_layers[new_name].n_features, [data_manager.current_layers[new_name].type, type_result], 'result');\n}\n\n/**\n* Send a geo result layer computed client-side (currently only discontinuities)\n* to the server in order to use it as other result layers computed server side\n* @param {string} layerName - The name of the layer to send\n* @param {string} url - The url to use\n* @return {undefined}\n*/\nfunction send_layer_server(layerName, url) {\n var JSON_layer = path_to_geojson(layerName);\n var formToSend = new FormData();\n formToSend.append('geojson', JSON_layer);\n formToSend.append('layer_name', layerName);\n xhrequest('POST', url, formToSend, false).then(function (e) {\n data_manager.current_layers[layerName].key_name = JSON.parse(e).key;\n }).catch(function (err) {\n display_error_during_computation();\n console.log(err);\n });\n}\n\n/**\n* Function returning the name of all current layers (excepted the sample layers used as layout)\n*\n* @return {Array} - The name of the other layers in an Array\n*/\nfunction get_other_layer_names() {\n var otherLayers = Object.getOwnPropertyNames(data_manager.current_layers);\n var tmpIdx = null;\n\n tmpIdx = otherLayers.indexOf('Graticule');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('World');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('Sphere');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n return otherLayers;\n}\n\nfunction get_display_name_on_layer_list(layer_name_to_add) {\n return +layer_name_to_add.length > 40 ? [layer_name_to_add.substring(0, 37), '(...)'].join('') : layer_name_to_add;\n}\n\n/**\n* Function triggered in order to add a new layer\n* in the \"layer manager\" (with appropriates icons regarding to its type, etc.)\n* @param {string} layerName - The name of the new layer\n* @param {integer} nbFt - The number of feature in this layer\n* @param {string} typeGeom - The geometry type\n* @param {string} typeLayer - Whether it is a result layer or not\n* @return {undefined}\n*/\nfunction create_li_layer_elem(layerName, nbFt, typeGeom, typeLayer) {\n var listDisplayName = get_display_name_on_layer_list(layerName);\n var layerId = encodeId(layerName);\n var layersListed = document.querySelector('#sortable.layer_list');\n var li = document.createElement('li');\n li.setAttribute('layer_name', layerName);\n if (typeLayer === 'result') {\n li.setAttribute('class', ['sortable_result ', layerId].join(''));\n var promotable = ['flow', 'grid', 'discont', 'cartogram', 'smooth'];\n var replace_but = promotable.indexOf(typeGeom[1]) > -1 ? _buttons.button_replace : undefined;\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_legend, _buttons.button_result_type.get(typeGeom[1]), replace_but, '
'].join('');\n } else if (typeLayer === 'target') {\n li.setAttribute('class', ['sortable_target ', layerId].join(''));\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _buttons.button_replace, '
'].join('');\n } else {\n var _replace_but = !data_manager.current_layers[layerName].graticule && !data_manager.current_layers[layerName].sphere ? _buttons.button_replace : undefined;\n li.setAttribute('class', ['sortable ', layerId].join(''));\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _replace_but, '
'].join('');\n }\n layersListed.insertBefore(li, layersListed.childNodes[0]);\n (0, _interface.binds_layers_buttons)(layerName);\n}\n\n/**\n* Function returning an object describing the type of field\n* @param {string} layerName - The name of the new layer\n* @param {string} target - The geometry type\n* @return {object|array} - An object containing the type of each field if\n* target was nos specified, otherwise an array of field name corresponding\n* to the type defined in 'target'.\n*/\nvar type_col = exports.type_col = function type_col(layerName, target) {\n // Function returning an object like {\"field1\": \"field_type\", \"field2\": \"field_type\"},\n // for the fields of the selected layer.\n // If target is set to \"number\" it should return an array containing only the name of the numerical fields\n // ------------------- \"string\" ---------------------------------------------------------non-numerial ----\n var table = data_manager.user_data.hasOwnProperty(layerName) ? data_manager.user_data[layerName] : data_manager.result_data.hasOwnProperty(layerName) ? data_manager.result_data[layerName] : data_manager.joined_dataset[0];\n var fields = Object.getOwnPropertyNames(table[0]);\n var nbFeatures = table.length;\n var deepthTest = nbFeatures > 100 ? 100 : nbFeatures - 1;\n var result = {};\n var field = void 0;\n var tmpType = void 0;\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n result[field] = [];\n for (var i = 0; i < deepthTest; ++i) {\n tmpType = _typeof(table[i][field]);\n if (tmpType === 'string' && table[i][field].length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(table[i][field])) || tmpType === 'number') {\n tmpType = 'number';\n } else if (tmpType === 'object' && isFinite(table[i][field])) {\n tmpType = 'empty';\n }\n result[fields[j]].push(tmpType);\n }\n }\n\n for (var _j = 0, _len = fields.length; _j < _len; ++_j) {\n field = fields[_j];\n if (result[field].every(function (ft) {\n return ft === 'number' || ft === 'empty';\n }) && result[field].indexOf('number') > -1) {\n result[field] = 'number';\n } else {\n result[field] = 'string';\n }\n }\n if (target) {\n var res = [];\n Object.keys(result).forEach(function (k) {\n if (result[k] === target && k !== '_uid') {\n res.push(k);\n }\n });\n return res;\n }\n return result;\n};\n\nvar type_col2 = exports.type_col2 = function type_col2(table, _field) {\n var skip_if_empty_values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n // Function returning an array of objects like\n // {name: \"field1\", type: \"field_type\"}, {name: \"field2\", type: \"field_type\"}, (...)]\n // for the fields of the selected layer.\n var result = [];\n var nbFeatures = table.length;\n var tmp = {};\n var dups = {};\n var field = _field;\n var tmpType = void 0;\n var fields = void 0;\n\n if (!field) {\n fields = Object.getOwnPropertyNames(table[0]).filter(function (v) {\n return v !== '_uid';\n });\n field = undefined;\n } else {\n fields = [field];\n field = undefined;\n }\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n tmp[field] = [];\n dups[field] = false;\n var h = {};\n for (var i = 0; i < nbFeatures; ++i) {\n var val = table[i][field];\n if (h[val]) dups[field] = true;else h[val] = true;\n tmpType = typeof val === 'undefined' ? 'undefined' : _typeof(val);\n if (tmpType === 'object' && isFinite(val)) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && val.length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(val)) || tmpType === 'number') {\n var _val = Number(val);\n tmpType = (_val | 0) === val ? 'stock' : (_val | 0) === +val ? 'stock' : 'ratio';\n }\n tmp[fields[j]].push(tmpType);\n }\n }\n var nb_id_field = 0;\n for (var _j2 = 0, _len2 = fields.length; _j2 < _len2; ++_j2) {\n field = fields[_j2];\n var hasDup = dups[field];\n if ((field.toLowerCase() === 'id' || field.toLowerCase().indexOf('name') > -1 || field.toLowerCase().indexOf('nom') > -1) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (field.toLowerCase().indexOf('id') > -1 && nb_id_field < 1 && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (!hasDup && nb_id_field < 1 && tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'stock';\n })) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'string';\n }) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('stock') > -1) {\n result.push({ name: field, type: 'stock', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'empty';\n }) && tmp[field].indexOf('string') > -1) {\n result.push({ name: field, type: 'category', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'ratio' || ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('ratio') > -1) {\n result.push({ name: field, type: 'ratio' });\n } else {\n result.push({ name: field, type: 'unknown', has_duplicate: hasDup });\n }\n }\n return result;\n};\n\nvar getFieldsType = exports.getFieldsType = function getFieldsType(type, layerName, ref) {\n if (!layerName && !ref) return null;\n var refField = ref || data_manager.current_layers[layerName].fields_type;\n if (!refField) return [];\n return refField.filter(function (d) {\n return d.type === type;\n }).map(function (d) {\n return d.name;\n });\n};\n\nfunction make_box_type_fields(layerName) {\n (0, _dialogs.make_dialog_container)('box_type_fields', _tr('app_page.box_type_fields.title'), 'dialog');\n d3.select('#box_type_fields').select('.modal-dialog').style('width', '500px');\n var newbox = d3.select('#box_type_fields').select('.modal-body');\n var tmp = type_col2(data_manager.user_data[layerName]);\n var fields_type = data_manager.current_layers[layerName].fields_type;\n var f = fields_type.map(function (v) {\n return v.name;\n });\n var refType = ['id', 'stock', 'ratio', 'category', 'unknown'];\n\n // const deferred = Promise.pending();\n var container = document.getElementById('box_type_fields');\n return new Promise(function (resolve, reject) {\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', helper_esc_key_twbs);\n if (window.fields_handler) {\n fields_handler.unfill();\n fields_handler.fill(layerName);\n }\n };\n\n if (f.length === 0) {\n // If the user dont have already selected the type :\n fields_type = tmp.slice();\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose = function _onclose() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose;\n } else if (tmp.length > fields_type.length) {\n // There is already types selected but new fields where added\n tmp.forEach(function (d) {\n if (f.indexOf(d.name) === -1) {\n fields_type.push(d);\n }\n });\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose2 = function _onclose2() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose2;\n } else {\n // There is already types selected and no new fields (so this is a modification) :\n // Use the previous values if the user close\n // the window without confirmation (cancel or X button)\n var _onclose3 = function _onclose3() {\n data_manager.current_layers[layerName].fields_type = fields_type;\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose3;\n container.querySelector('#xclose').onclick = _onclose3;\n }\n\n // Fetch and store the selected values when 'Ok' button is clicked :\n container.querySelector('.btn_ok').onclick = function () {\n var r = [];\n Array.prototype.forEach.call(document.querySelectorAll('#fields_select > li'), function (elem) {\n r.push({ name: elem.childNodes[0].innerHTML.trim(), type: elem.childNodes[1].value });\n });\n resolve(true);\n data_manager.current_layers[layerName].fields_type = r.slice();\n getAvailablesFunctionnalities(layerName);\n clean_up_box();\n };\n function helper_esc_key_twbs(_evt) {\n var evt = _evt || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n }\n }\n document.addEventListener('keydown', helper_esc_key_twbs);\n document.getElementById('btn_type_fields').removeAttribute('disabled');\n\n newbox.append('h3').html(_tr('app_page.box_type_fields.message_invite'));\n\n var box_select = newbox.append('ul').attr('id', 'fields_select').styles({\n padding: '0',\n 'list-style': 'none'\n });\n\n box_select.selectAll('li').data(fields_type).enter().append('li');\n\n box_select.selectAll('li').insert('span').html(function (d) {\n return d.name;\n });\n\n box_select.selectAll('li').insert('select').style('float', 'right').selectAll('option').data(refType).enter().insert('option').attr('value', function (d) {\n return d;\n }).text(function (d) {\n return _tr('app_page.box_type_fields.' + d);\n }).exit();\n\n box_select.selectAll('select').each(function (d) {\n this.value = d.type;\n });\n\n for (var i = 0; i < fields_type.length; i++) {\n if (fields_type[i].type === 'category' || fields_type[i].not_number) {\n box_select.node().childNodes[i].childNodes[1].options.remove(2);\n box_select.node().childNodes[i].childNodes[1].options.remove(1);\n }\n if (fields_type[i].has_duplicate) {\n box_select.node().childNodes[i].childNodes[1].options.remove(0);\n }\n }\n _dialogs.overlay_under_modal.display();\n setTimeout(function () {\n container.querySelector('button.btn_ok').focus();\n }, 400);\n });\n}\n\nfunction getAvailablesFunctionnalities(layerName) {\n var section = document.getElementById('section2_pre');\n if (!layerName) {\n var elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow, #button_prop, #button_choro, #button_choroprop, #button_typo, #button_proptypo, #button_two_stocks');\n for (var i = 0, len_i = elems.length; i < len_i; i++) {\n elems[i].style.filter = 'grayscale(100%)';\n }\n return;\n }\n\n var fields_stock = getFieldsType('stock', layerName),\n fields_ratio = getFieldsType('ratio', layerName),\n fields_categ = getFieldsType('category', layerName),\n fields_id = getFieldsType('id', layerName);\n var func_stock = void 0,\n func_ratio = void 0,\n func_categ = void 0,\n func_id = void 0;\n if (data_manager.current_layers[layerName].type === 'Line') {\n // Layer type is Line\n var _elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow');\n for (var _i2 = 0, _len_i = _elems.length; _i2 < _len_i; _i2++) {\n _elems[_i2].style.filter = 'grayscale(100%)';\n }\n func_id = [];\n func_stock = section.querySelectorAll('#button_prop');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo');\n } else if (data_manager.current_layers[layerName].type === 'Point') {\n // layer type is Point\n var _elems2 = section.querySelectorAll('#button_discont, #button_cartogram');\n for (var _i3 = 0, _len_i2 = _elems2.length; _i3 < _len_i2; _i3++) {\n _elems2[_i3].style.filter = 'grayscale(100%)';\n }\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n } else {\n // Layer type is Polygon\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid, #button_cartogram, #button_discont');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop, #button_discont');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n }\n if (fields_stock.length === 0) {\n Array.prototype.forEach.call(func_stock, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_stock, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_ratio.length === 0) {\n Array.prototype.forEach.call(func_ratio, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_ratio, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_categ.length === 0) {\n Array.prototype.forEach.call(func_categ, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_categ, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_id.length === 0) {\n Array.prototype.forEach.call(func_id, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_id, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n\n // That representation needs both Stock and Ratio variables:\n if (fields_stock.length === 0 || fields_ratio.length === 0) {\n document.getElementById('button_choroprop').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_choroprop').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs both Stock and Categorical variables:\n if (fields_stock.length === 0 || fields_categ.length === 0) {\n document.getElementById('button_proptypo').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_proptypo').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs either a Stock or a Ratio variable:\n if (data_manager.current_layers[layerName].type === 'Polygon' && (fields_stock.length > 0 || fields_ratio.length > 0)) {\n document.getElementById('button_discont').style.filter = 'invert(0%) saturate(100%)';\n } else {\n document.getElementById('button_discont').style.filter = 'grayscale(100%)';\n }\n // Special case for the \"waffle\" kind of map as it needs 2 or more stock variables:\n if (fields_stock.length < 2) {\n document.getElementById('button_two_stocks').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_two_stocks').style.filter = 'invert(0%) saturate(100%)';\n }\n}\n\nvar clickLinkFromDataUrl = exports.clickLinkFromDataUrl = function clickLinkFromDataUrl(url, filename) {\n return fetch(url).then(function (res) {\n return res.blob();\n }).then(function (blob) {\n var blobUrl = URL.createObjectURL(blob);\n var dlAnchorElem = document.createElement('a');\n dlAnchorElem.setAttribute('href', blobUrl);\n dlAnchorElem.setAttribute('download', filename);\n // if (window.isIE || window.isOldMS_Firefox) {\n if (window.isIE) {\n swal({\n title: '',\n html: '',\n showCancelButton: true,\n showConfirmButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n dlAnchorElem.innerHTML = filename;\n var content = document.getElementsByClassName('link_download')[0];\n content.appendChild(dlAnchorElem);\n },\n onClose: function onClose() {\n URL.revokeObjectURL(blobUrl);\n }\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n } else {\n dlAnchorElem.style.display = 'none';\n document.body.appendChild(dlAnchorElem);\n dlAnchorElem.click();\n dlAnchorElem.remove();\n URL.revokeObjectURL(blobUrl);\n }\n });\n};\n\n/**\n* Clone a JS Object, taking care of also copying JS Map objects.\n*\n* @param {Array} obj - The object to be cloned.\n* @return {Array} The resulting Object (or Map).\n*/\nvar cloneObj = exports.cloneObj = function cloneObj(obj) {\n if (obj === null || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') return obj;else if (obj.toString() === '[object Map]') return new Map(obj.entries());\n return Object.assign({}, obj);\n};\n\nfunction prepareFileExt(files_to_send) {\n Array.prototype.forEach.call(files_to_send, function (f) {\n f._ext = '';\n if (f.name.indexOf('.') > -1) {\n var name = f.name.substring(0, f.name.lastIndexOf('.'));\n var ext = f.name.substring(f.name.lastIndexOf('.') + 1, f.name.length);\n f._name = [name, ext.toLowerCase()].join('.');\n f._ext = ext.toLowerCase();\n }\n });\n return files_to_send;\n}\n\n// /**\n// * Take an array to reverse it (acting on a copy of the input).\n// *\n// * @param {Array} arr - The array to be copied and reversed.\n// * @return {Array} The resulting Array, letting the input Array untouched.\n// */\n// function getCopyReversed(arr) {\n// return arr.slice().reverse();\n// }\n\n/**\n* Try to parse a JSON string into. Returns an Array of two elements :\n* like [true, data] if parsing suceeded or like [false, error] if it failed.\n*\n* @param {String} txt - The JSON string to be parsed.\n* @return {Array} An Array of two element, this first one is a Boolean (wheter\n* parsing the string sucedded or not) and the second is the resulting object or\n* the error thrown.\n*/\nvar isValidJSON = exports.isValidJSON = function isValidJSON(txt) {\n try {\n var a = JSON.parse(txt);\n return [true, a];\n } catch (e) {\n return [false, e];\n }\n};\n\nfunction accordionize2() {\n var css_selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.accordion';\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;\n\n var acc = parent.querySelectorAll(css_selector);\n for (var i = 0; i < acc.length; i++) {\n acc[i].onclick = function () {\n this.classList.toggle('active');\n this.nextElementSibling.classList.toggle('show');\n };\n }\n}\n\nfunction getTargetLayerProps() {\n var names = Object.keys(data_manager.current_layers);\n for (var i = 0, n_layer = names.length; i < n_layer; i++) {\n if (data_manager.current_layers[names[i]].targeted) {\n return data_manager.current_layers[names[i]];\n }\n }\n return null;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/helpers.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global, Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isValidJSON = exports.cloneObj = exports.clickLinkFromDataUrl = exports.getFieldsType = exports.type_col2 = exports.type_col = exports.drag_waffle = exports.drag_elem_geo2 = exports.drag_elem_geo = exports.createWaitingOverlay = exports.isNumber = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.setSelected = setSelected;\nexports.path_to_geojson2 = path_to_geojson2;\nexports.display_error_during_computation = display_error_during_computation;\nexports.request_data = request_data;\nexports.xhrequest = xhrequest;\nexports.getImgDataUrl = getImgDataUrl;\nexports.make_content_summary = make_content_summary;\nexports.copy_layer = copy_layer;\nexports.send_layer_server = send_layer_server;\nexports.get_other_layer_names = get_other_layer_names;\nexports.get_display_name_on_layer_list = get_display_name_on_layer_list;\nexports.create_li_layer_elem = create_li_layer_elem;\nexports.make_box_type_fields = make_box_type_fields;\nexports.getAvailablesFunctionnalities = getAvailablesFunctionnalities;\nexports.prepareFileExt = prepareFileExt;\nexports.accordionize2 = accordionize2;\nexports.getTargetLayerProps = getTargetLayerProps;\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _buttons = __webpack_require__(/*! ./ui/buttons */ \"./js/ui/buttons.js\");\n\nvar isNumber = exports.isNumber = function isNumber(value) {\n return value != null && value !== '' && isFinite(value) && !Number.isNaN(+value);\n};\n\nvar createWaitingOverlay = exports.createWaitingOverlay = function createWaitingOverlay() {\n var bg = document.createElement('div');\n bg.id = 'overlay';\n bg.style.display = 'none';\n bg.innerHTML = '\\n\"Magrit\"\\n\\n...
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n';\n\n document.body.appendChild(bg);\n var btn = bg.querySelector('button.button_st3');\n btn.onclick = function () {\n if (global._app.xhr_to_cancel) {\n global._app.xhr_to_cancel.abort();\n global._app.xhr_to_cancel = undefined;\n }\n if (global._app.webworker_to_cancel) {\n global._app.webworker_to_cancel.onmessage = null;\n global._app.webworker_to_cancel.terminate();\n global._app.webworker_to_cancel = undefined;\n }\n bg.style.display = 'none';\n };\n return {\n display: function display() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n bg.style.display = '';\n if (opts.cancel_button && opts.cancel_button === false) {\n btn.style.display = 'none';\n }\n if (opts.zIndex) {\n bg.style.zIndex = opts.zIndex;\n }\n },\n hide: function hide() {\n bg.style.display = 'none';\n bg.style.zIndex = '';\n btn.style.display = '';\n }\n };\n};\n\nvar drag_elem_geo = exports.drag_elem_geo = d3.drag().subject(function () {\n var t = d3.select(this);\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n}).on('drag', function () {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n});\n\nvar drag_elem_geo2 = exports.drag_elem_geo2 = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n // const layer_name = global._app.id_to_layer.get(this.parentElement.id);\n var symbol = data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].symbol;\n var t = d3.select(this);\n if (symbol === 'rect') {\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n } else if (symbol === 'circle') {\n return {\n x: t.attr('cx'),\n y: t.attr('cy'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n }\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n var zoom = svg_map.__zoom;\n var centroid = path.centroid(this.__data__.geometry);\n centroid[0] = centroid[0] * zoom.k + zoom.x;\n centroid[1] = centroid[1] * zoom.k + zoom.y;\n map.append('rect').attrs({ x: centroid[0] - 2, y: centroid[1] - 2, height: 4, width: 4, id: 'ref_symbol_location' }).style('fill', 'red');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n map.selectAll('#ref_symbol_location').remove();\n}).on('drag', function () {\n if (d3.event.subject.symbol === 'rect') {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n } else if (d3.event.subject.symbol === 'circle') {\n d3.select(this).attr('cx', d3.event.x).attr('cy', d3.event.y);\n }\n});\n\nvar drag_waffle = exports.drag_waffle = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n var t = d3.select(this);\n var prev_translate = t.attr('transform');\n prev_translate = prev_translate ? prev_translate.slice(10, -1).split(/[ ,]+/).map(function (f) {\n return +f;\n }) : [0, 0];\n return {\n x: t.attr('x') + prev_translate[0],\n y: t.attr('y') + prev_translate[1],\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n d3.select(this).style('cursor', 'grab');\n}).on('drag', function () {\n d3.select(this).attr('transform', 'translate(' + [d3.event.x, d3.event.y] + ')').style('cursor', 'grabbing');\n});\n\nfunction setSelected(selectNode, value) {\n selectNode.value = value; // eslint-disable-line no-param-reassign\n selectNode.dispatchEvent(new Event('change'));\n}\n\nfunction path_to_geojson(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: { type: d.type, coordinates: d.coordinates }\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction path_to_geojson2(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: d.geometry\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction display_error_during_computation(msg) {\n var message = message ? '
' + _tr('app_page.common.details') + ': ' + msg : '';\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_message') + msg,\n customClass: 'swal2_custom',\n type: 'error',\n allowOutsideClick: false\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @return {Promise} response\n*/\nfunction request_data(method, url, data) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(method, url, true);\n request.onload = resolve;\n request.onerror = reject;\n request.send(data);\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @param {Boolean} waitingMessage - Optionnal, whether to display or not\n* a waiting message while the request is proceeded\n* @return {Promise} response\n*/\nfunction xhrequest(method, url, data, waitingMessage) {\n if (waitingMessage) {\n global._app.waitingOverlay.display();\n }\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n global._app.xhr_to_cancel = request;\n request.open(method, url, true);\n request.onload = function (resp) {\n resolve(resp.target.responseText);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.onerror = function (err) {\n reject(err);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.send(data);\n });\n}\n\nfunction getImgDataUrl(url) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.onload = function () {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(request.response);\n };\n request.onerror = function (err) {\n reject(err);\n };\n request.open('GET', url, true);\n request.responseType = 'blob';\n request.send();\n });\n}\n\nfunction make_content_summary(serie) {\n var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;\n\n return [_tr('app_page.stat_summary.population'), ' : ', (0, _helpers_calc.round_value)(serie.pop(), precision), '
', _tr('app_page.stat_summary.min'), ' : ', (0, _helpers_calc.round_value)(serie.min(), precision), ' | ', _tr('app_page.stat_summary.max'), ' : ', (0, _helpers_calc.round_value)(serie.max(), precision), '
', _tr('app_page.stat_summary.mean'), ' : ', (0, _helpers_calc.round_value)(serie.mean(), precision), '
', _tr('app_page.stat_summary.median'), ' : ', (0, _helpers_calc.round_value)(serie.median(), precision), '
', _tr('app_page.stat_summary.variance'), ' : ', (0, _helpers_calc.round_value)(serie.variance(), precision), '
', _tr('app_page.stat_summary.stddev'), ' : ', (0, _helpers_calc.round_value)(serie.stddev(), precision), '
', _tr('app_page.stat_summary.cov'), ' : ', (0, _helpers_calc.round_value)(serie.cov(), precision)].join('');\n}\n\nfunction copy_layer(ref_layer, new_name, type_result, fields_to_copy) {\n var id_new_layer = encodeId(new_name);\n var id_ref_layer = global._app.layer_to_id.get(ref_layer);\n var node_ref_layer = svg_map.querySelector('#' + id_ref_layer);\n global._app.layer_to_id.set(new_name, id_new_layer);\n global._app.id_to_layer.set(id_new_layer, new_name);\n svg_map.appendChild(node_ref_layer.cloneNode(true));\n svg_map.lastChild.setAttribute('id', id_new_layer);\n var node_new_layer = document.getElementById(id_new_layer);\n svg_map.insertBefore(node_new_layer, svg_map.querySelector('.legend'));\n data_manager.result_data[new_name] = [];\n data_manager.current_layers[new_name] = {\n n_features: data_manager.current_layers[ref_layer].n_features,\n type: data_manager.current_layers[ref_layer].type,\n ref_layer_name: ref_layer\n };\n if (data_manager.current_layers[ref_layer].pointRadius) {\n data_manager.current_layers[new_name].pointRadius = data_manager.current_layers[ref_layer].pointRadius;\n }\n var selec_src = node_ref_layer.getElementsByTagName('path'),\n selec_dest = node_new_layer.getElementsByTagName('path');\n if (!fields_to_copy) {\n for (var i = 0; i < selec_src.length; i++) {\n selec_dest[i].__data__ = selec_src[i].__data__;\n data_manager.result_data[new_name].push(selec_dest[i].__data__.properties);\n }\n } else {\n for (var _i = 0; _i < selec_src.length; _i++) {\n selec_dest[_i].__data__ = { type: 'Feature', properties: {}, geometry: cloneObj(selec_src[_i].__data__.geometry) };\n var nb_field_to_copy = fields_to_copy.length;\n for (var j = 0; j < nb_field_to_copy; j++) {\n var f = fields_to_copy[j];\n selec_dest[_i].__data__.properties[f] = selec_src[_i].__data__.properties[f];\n }\n data_manager.result_data[new_name].push(selec_dest[_i].__data__.properties);\n }\n }\n // Set the desired class name :\n node_new_layer.className.baseVal = 'layer';\n // Reset visibility and filter attributes to default values:\n node_new_layer.style.visibility = '';\n node_new_layer.removeAttribute('filter');\n // Create an entry in the layer manager:\n create_li_layer_elem(new_name, data_manager.current_layers[new_name].n_features, [data_manager.current_layers[new_name].type, type_result], 'result');\n}\n\n/**\n* Send a geo result layer computed client-side (currently only discontinuities)\n* to the server in order to use it as other result layers computed server side\n* @param {string} layerName - The name of the layer to send\n* @param {string} url - The url to use\n* @return {undefined}\n*/\nfunction send_layer_server(layerName, url) {\n var JSON_layer = path_to_geojson(layerName);\n var formToSend = new FormData();\n formToSend.append('geojson', JSON_layer);\n formToSend.append('layer_name', layerName);\n xhrequest('POST', url, formToSend, false).then(function (e) {\n data_manager.current_layers[layerName].key_name = JSON.parse(e).key;\n }).catch(function (err) {\n display_error_during_computation();\n console.log(err);\n });\n}\n\n/**\n* Function returning the name of all current layers (excepted the sample layers used as layout)\n*\n* @return {Array} - The name of the other layers in an Array\n*/\nfunction get_other_layer_names() {\n var otherLayers = Object.getOwnPropertyNames(data_manager.current_layers);\n var tmpIdx = null;\n\n tmpIdx = otherLayers.indexOf('Graticule');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('World');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('Sphere');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n return otherLayers;\n}\n\nfunction get_display_name_on_layer_list(layer_name_to_add) {\n return +layer_name_to_add.length > 40 ? [layer_name_to_add.substring(0, 37), '(...)'].join('') : layer_name_to_add;\n}\n\n/**\n* Function triggered in order to add a new layer\n* in the \"layer manager\" (with appropriates icons regarding to its type, etc.)\n* @param {string} layerName - The name of the new layer\n* @param {integer} nbFt - The number of feature in this layer\n* @param {string} typeGeom - The geometry type\n* @param {string} typeLayer - Whether it is a result layer or not\n* @return {undefined}\n*/\nfunction create_li_layer_elem(layerName, nbFt, typeGeom, typeLayer) {\n var listDisplayName = get_display_name_on_layer_list(layerName);\n var layerId = encodeId(layerName);\n var layersListed = document.querySelector('#sortable.layer_list');\n var li = document.createElement('li');\n li.setAttribute('layer_name', layerName);\n if (typeLayer === 'result') {\n li.setAttribute('class', ['sortable_result ', layerId].join(''));\n var promotable = ['flow', 'grid', 'discont', 'cartogram', 'smooth'];\n var legend_but = typeGeom[1] !== 'cartogram' ? _buttons.button_legend : undefined;\n var replace_but = promotable.indexOf(typeGeom[1]) > -1 ? _buttons.button_replace : undefined;\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, legend_but, _buttons.button_result_type.get(typeGeom[1]), replace_but, '
'].join('');\n } else if (typeLayer === 'target') {\n li.setAttribute('class', ['sortable_target ', layerId].join(''));\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _buttons.button_replace, '
'].join('');\n } else {\n var _replace_but = !data_manager.current_layers[layerName].graticule && !data_manager.current_layers[layerName].sphere ? _buttons.button_replace : undefined;\n li.setAttribute('class', ['sortable ', layerId].join(''));\n li.innerHTML = [listDisplayName, '
', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _replace_but, '
'].join('');\n }\n layersListed.insertBefore(li, layersListed.childNodes[0]);\n (0, _interface.binds_layers_buttons)(layerName);\n}\n\n/**\n* Function returning an object describing the type of field\n* @param {string} layerName - The name of the new layer\n* @param {string} target - The geometry type\n* @return {object|array} - An object containing the type of each field if\n* target was nos specified, otherwise an array of field name corresponding\n* to the type defined in 'target'.\n*/\nvar type_col = exports.type_col = function type_col(layerName, target) {\n // Function returning an object like {\"field1\": \"field_type\", \"field2\": \"field_type\"},\n // for the fields of the selected layer.\n // If target is set to \"number\" it should return an array containing only the name of the numerical fields\n // ------------------- \"string\" ---------------------------------------------------------non-numerial ----\n var table = data_manager.user_data.hasOwnProperty(layerName) ? data_manager.user_data[layerName] : data_manager.result_data.hasOwnProperty(layerName) ? data_manager.result_data[layerName] : data_manager.joined_dataset[0];\n var fields = Object.getOwnPropertyNames(table[0]);\n var nbFeatures = table.length;\n var deepthTest = nbFeatures > 100 ? 100 : nbFeatures - 1;\n var result = {};\n var field = void 0;\n var tmpType = void 0;\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n result[field] = [];\n for (var i = 0; i < deepthTest; ++i) {\n tmpType = _typeof(table[i][field]);\n if (tmpType === 'string' && table[i][field].length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(table[i][field])) || tmpType === 'number') {\n tmpType = 'number';\n } else if (tmpType === 'object' && isFinite(table[i][field])) {\n tmpType = 'empty';\n }\n result[fields[j]].push(tmpType);\n }\n }\n\n for (var _j = 0, _len = fields.length; _j < _len; ++_j) {\n field = fields[_j];\n if (result[field].every(function (ft) {\n return ft === 'number' || ft === 'empty';\n }) && result[field].indexOf('number') > -1) {\n result[field] = 'number';\n } else {\n result[field] = 'string';\n }\n }\n if (target) {\n var res = [];\n Object.keys(result).forEach(function (k) {\n if (result[k] === target && k !== '_uid') {\n res.push(k);\n }\n });\n return res;\n }\n return result;\n};\n\nvar type_col2 = exports.type_col2 = function type_col2(table, _field) {\n var skip_if_empty_values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n // Function returning an array of objects like\n // {name: \"field1\", type: \"field_type\"}, {name: \"field2\", type: \"field_type\"}, (...)]\n // for the fields of the selected layer.\n var result = [];\n var nbFeatures = table.length;\n var tmp = {};\n var dups = {};\n var field = _field;\n var tmpType = void 0;\n var fields = void 0;\n\n if (!field) {\n fields = Object.getOwnPropertyNames(table[0]).filter(function (v) {\n return v !== '_uid';\n });\n field = undefined;\n } else {\n fields = [field];\n field = undefined;\n }\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n tmp[field] = [];\n dups[field] = false;\n var h = {};\n for (var i = 0; i < nbFeatures; ++i) {\n var val = table[i][field];\n if (h[val]) dups[field] = true;else h[val] = true;\n tmpType = typeof val === 'undefined' ? 'undefined' : _typeof(val);\n if (tmpType === 'object' && isFinite(val)) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && val.length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(val)) || tmpType === 'number') {\n var _val = Number(val);\n tmpType = (_val | 0) === val ? 'stock' : (_val | 0) === +val ? 'stock' : 'ratio';\n }\n tmp[fields[j]].push(tmpType);\n }\n }\n var nb_id_field = 0;\n for (var _j2 = 0, _len2 = fields.length; _j2 < _len2; ++_j2) {\n field = fields[_j2];\n var hasDup = dups[field];\n if ((field.toLowerCase() === 'id' || field.toLowerCase().indexOf('name') > -1 || field.toLowerCase().indexOf('nom') > -1) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (field.toLowerCase().indexOf('id') > -1 && nb_id_field < 1 && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (!hasDup && nb_id_field < 1 && tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'stock';\n })) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'string';\n }) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('stock') > -1) {\n result.push({ name: field, type: 'stock', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'empty';\n }) && tmp[field].indexOf('string') > -1) {\n result.push({ name: field, type: 'category', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'ratio' || ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('ratio') > -1) {\n result.push({ name: field, type: 'ratio' });\n } else {\n result.push({ name: field, type: 'unknown', has_duplicate: hasDup });\n }\n }\n return result;\n};\n\nvar getFieldsType = exports.getFieldsType = function getFieldsType(type, layerName, ref) {\n if (!layerName && !ref) return null;\n var refField = ref || data_manager.current_layers[layerName].fields_type;\n if (!refField) return [];\n return refField.filter(function (d) {\n return d.type === type;\n }).map(function (d) {\n return d.name;\n });\n};\n\nfunction make_box_type_fields(layerName) {\n (0, _dialogs.make_dialog_container)('box_type_fields', _tr('app_page.box_type_fields.title'), 'dialog');\n d3.select('#box_type_fields').select('.modal-dialog').style('width', '500px');\n var newbox = d3.select('#box_type_fields').select('.modal-body');\n var tmp = type_col2(data_manager.user_data[layerName]);\n var fields_type = data_manager.current_layers[layerName].fields_type;\n var f = fields_type.map(function (v) {\n return v.name;\n });\n var refType = ['id', 'stock', 'ratio', 'category', 'unknown'];\n\n // const deferred = Promise.pending();\n var container = document.getElementById('box_type_fields');\n return new Promise(function (resolve, reject) {\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', helper_esc_key_twbs);\n if (window.fields_handler) {\n fields_handler.unfill();\n fields_handler.fill(layerName);\n }\n };\n\n if (f.length === 0) {\n // If the user dont have already selected the type :\n fields_type = tmp.slice();\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose = function _onclose() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose;\n } else if (tmp.length > fields_type.length) {\n // There is already types selected but new fields where added\n tmp.forEach(function (d) {\n if (f.indexOf(d.name) === -1) {\n fields_type.push(d);\n }\n });\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose2 = function _onclose2() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose2;\n } else {\n // There is already types selected and no new fields (so this is a modification) :\n // Use the previous values if the user close\n // the window without confirmation (cancel or X button)\n var _onclose3 = function _onclose3() {\n data_manager.current_layers[layerName].fields_type = fields_type;\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose3;\n container.querySelector('#xclose').onclick = _onclose3;\n }\n\n // Fetch and store the selected values when 'Ok' button is clicked :\n container.querySelector('.btn_ok').onclick = function () {\n var r = [];\n Array.prototype.forEach.call(document.querySelectorAll('#fields_select > li'), function (elem) {\n r.push({ name: elem.childNodes[0].innerHTML.trim(), type: elem.childNodes[1].value });\n });\n resolve(true);\n data_manager.current_layers[layerName].fields_type = r.slice();\n getAvailablesFunctionnalities(layerName);\n clean_up_box();\n };\n function helper_esc_key_twbs(_evt) {\n var evt = _evt || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n }\n }\n document.addEventListener('keydown', helper_esc_key_twbs);\n document.getElementById('btn_type_fields').removeAttribute('disabled');\n\n newbox.append('h3').html(_tr('app_page.box_type_fields.message_invite'));\n\n var box_select = newbox.append('ul').attr('id', 'fields_select').styles({\n padding: '0',\n 'list-style': 'none'\n });\n\n box_select.selectAll('li').data(fields_type).enter().append('li');\n\n box_select.selectAll('li').insert('span').html(function (d) {\n return d.name;\n });\n\n box_select.selectAll('li').insert('select').style('float', 'right').selectAll('option').data(refType).enter().insert('option').attr('value', function (d) {\n return d;\n }).text(function (d) {\n return _tr('app_page.box_type_fields.' + d);\n }).exit();\n\n box_select.selectAll('select').each(function (d) {\n this.value = d.type;\n });\n\n for (var i = 0; i < fields_type.length; i++) {\n if (fields_type[i].type === 'category' || fields_type[i].not_number) {\n box_select.node().childNodes[i].childNodes[1].options.remove(2);\n box_select.node().childNodes[i].childNodes[1].options.remove(1);\n }\n if (fields_type[i].has_duplicate) {\n box_select.node().childNodes[i].childNodes[1].options.remove(0);\n }\n }\n _dialogs.overlay_under_modal.display();\n setTimeout(function () {\n container.querySelector('button.btn_ok').focus();\n }, 400);\n });\n}\n\nfunction getAvailablesFunctionnalities(layerName) {\n var section = document.getElementById('section2_pre');\n if (!layerName) {\n var elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow, #button_prop, #button_choro, #button_choroprop, #button_typo, #button_proptypo, #button_two_stocks');\n for (var i = 0, len_i = elems.length; i < len_i; i++) {\n elems[i].style.filter = 'grayscale(100%)';\n }\n return;\n }\n\n var fields_stock = getFieldsType('stock', layerName),\n fields_ratio = getFieldsType('ratio', layerName),\n fields_categ = getFieldsType('category', layerName),\n fields_id = getFieldsType('id', layerName);\n var func_stock = void 0,\n func_ratio = void 0,\n func_categ = void 0,\n func_id = void 0;\n if (data_manager.current_layers[layerName].type === 'Line') {\n // Layer type is Line\n var _elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow');\n for (var _i2 = 0, _len_i = _elems.length; _i2 < _len_i; _i2++) {\n _elems[_i2].style.filter = 'grayscale(100%)';\n }\n func_id = [];\n func_stock = section.querySelectorAll('#button_prop');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo');\n } else if (data_manager.current_layers[layerName].type === 'Point') {\n // layer type is Point\n var _elems2 = section.querySelectorAll('#button_discont, #button_cartogram');\n for (var _i3 = 0, _len_i2 = _elems2.length; _i3 < _len_i2; _i3++) {\n _elems2[_i3].style.filter = 'grayscale(100%)';\n }\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n } else {\n // Layer type is Polygon\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid, #button_cartogram, #button_discont');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop, #button_discont');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n }\n if (fields_stock.length === 0) {\n Array.prototype.forEach.call(func_stock, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_stock, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_ratio.length === 0) {\n Array.prototype.forEach.call(func_ratio, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_ratio, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_categ.length === 0) {\n Array.prototype.forEach.call(func_categ, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_categ, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n if (fields_id.length === 0) {\n Array.prototype.forEach.call(func_id, function (d) {\n return d.style.filter = 'grayscale(100%)';\n });\n } else {\n Array.prototype.forEach.call(func_id, function (d) {\n return d.style.filter = 'invert(0%) saturate(100%)';\n });\n }\n\n // That representation needs both Stock and Ratio variables:\n if (fields_stock.length === 0 || fields_ratio.length === 0) {\n document.getElementById('button_choroprop').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_choroprop').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs both Stock and Categorical variables:\n if (fields_stock.length === 0 || fields_categ.length === 0) {\n document.getElementById('button_proptypo').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_proptypo').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs either a Stock or a Ratio variable:\n if (data_manager.current_layers[layerName].type === 'Polygon' && (fields_stock.length > 0 || fields_ratio.length > 0)) {\n document.getElementById('button_discont').style.filter = 'invert(0%) saturate(100%)';\n } else {\n document.getElementById('button_discont').style.filter = 'grayscale(100%)';\n }\n // Special case for the \"waffle\" kind of map as it needs 2 or more stock variables:\n if (fields_stock.length < 2) {\n document.getElementById('button_two_stocks').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_two_stocks').style.filter = 'invert(0%) saturate(100%)';\n }\n}\n\nvar clickLinkFromDataUrl = exports.clickLinkFromDataUrl = function clickLinkFromDataUrl(url, filename) {\n return fetch(url).then(function (res) {\n return res.blob();\n }).then(function (blob) {\n var blobUrl = URL.createObjectURL(blob);\n var dlAnchorElem = document.createElement('a');\n dlAnchorElem.setAttribute('href', blobUrl);\n dlAnchorElem.setAttribute('download', filename);\n // if (window.isIE || window.isOldMS_Firefox) {\n if (window.isIE) {\n swal({\n title: '',\n html: '',\n showCancelButton: true,\n showConfirmButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n dlAnchorElem.innerHTML = filename;\n var content = document.getElementsByClassName('link_download')[0];\n content.appendChild(dlAnchorElem);\n },\n onClose: function onClose() {\n URL.revokeObjectURL(blobUrl);\n }\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n } else {\n dlAnchorElem.style.display = 'none';\n document.body.appendChild(dlAnchorElem);\n dlAnchorElem.click();\n dlAnchorElem.remove();\n URL.revokeObjectURL(blobUrl);\n }\n });\n};\n\n/**\n* Clone a JS Object, taking care of also copying JS Map objects.\n*\n* @param {Array} obj - The object to be cloned.\n* @return {Array} The resulting Object (or Map).\n*/\nvar cloneObj = exports.cloneObj = function cloneObj(obj) {\n if (obj === null || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') return obj;else if (obj.toString() === '[object Map]') return new Map(obj.entries());\n return Object.assign({}, obj);\n};\n\nfunction prepareFileExt(files_to_send) {\n Array.prototype.forEach.call(files_to_send, function (f) {\n f._ext = '';\n if (f.name.indexOf('.') > -1) {\n var name = f.name.substring(0, f.name.lastIndexOf('.'));\n var ext = f.name.substring(f.name.lastIndexOf('.') + 1, f.name.length);\n f._name = [name, ext.toLowerCase()].join('.');\n f._ext = ext.toLowerCase();\n }\n });\n return files_to_send;\n}\n\n// /**\n// * Take an array to reverse it (acting on a copy of the input).\n// *\n// * @param {Array} arr - The array to be copied and reversed.\n// * @return {Array} The resulting Array, letting the input Array untouched.\n// */\n// function getCopyReversed(arr) {\n// return arr.slice().reverse();\n// }\n\n/**\n* Try to parse a JSON string into. Returns an Array of two elements :\n* like [true, data] if parsing suceeded or like [false, error] if it failed.\n*\n* @param {String} txt - The JSON string to be parsed.\n* @return {Array} An Array of two element, this first one is a Boolean (wheter\n* parsing the string sucedded or not) and the second is the resulting object or\n* the error thrown.\n*/\nvar isValidJSON = exports.isValidJSON = function isValidJSON(txt) {\n try {\n var a = JSON.parse(txt);\n return [true, a];\n } catch (e) {\n return [false, e];\n }\n};\n\nfunction accordionize2() {\n var css_selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.accordion';\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;\n\n var acc = parent.querySelectorAll(css_selector);\n for (var i = 0; i < acc.length; i++) {\n acc[i].onclick = function () {\n this.classList.toggle('active');\n this.nextElementSibling.classList.toggle('show');\n };\n }\n}\n\nfunction getTargetLayerProps() {\n var names = Object.keys(data_manager.current_layers);\n for (var i = 0, n_layer = names.length; i < n_layer; i++) {\n if (data_manager.current_layers[names[i]].targeted) {\n return data_manager.current_layers[names[i]];\n }\n }\n return null;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/helpers.js?"); /***/ }), @@ -358,7 +358,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createDropShadow = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.handle_click_layer = handle_click_layer;\nexports.make_style_box_indiv_label = make_style_box_indiv_label;\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _discretization_panel = __webpack_require__(/*! ./classification/discretization_panel */ \"./js/classification/discretization_panel.js\");\n\nvar _categorical_panel = __webpack_require__(/*! ./classification/categorical_panel */ \"./js/classification/categorical_panel.js\");\n\nvar _discrtiz_links_discont = __webpack_require__(/*! ./classification/discrtiz_links_discont */ \"./js/classification/discrtiz_links_discont.js\");\n\nvar _fonts = __webpack_require__(/*! ./fonts */ \"./js/fonts.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tables = __webpack_require__(/*! ./tables */ \"./js/tables.js\");\n\n/**\n* Function to dispatch the click on the \"open style box\" icon\n* to the actual appropriate function according to the type of the layer.\n*\n* @param {String} layer_name - The name of the layer.\n* @return {void} - Nothing is returned but the \"style box\" should open.\n*\n*/\nfunction handle_click_layer(layer_name) {\n if (data_manager.current_layers[layer_name].graticule) {\n createStyleBoxGraticule();\n } else if (data_manager.current_layers[layer_name].type === 'Line') {\n createStyleBox_Line(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer.indexOf('PropSymbol') > -1) {\n createStyleBox_ProbSymbol(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'Label') {\n createStyleBoxLabel(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TypoSymbols') {\n createStyleBoxTypoSymbols(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TwoStocksWaffle') {\n createStyleBoxWaffle(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer === 'Stewart') {\n createStyleBoxStewart(layer_name);\n } else {\n createStyleBox(layer_name);\n }\n}\n\nfunction make_single_color_menu(layer, fill_prev) {\n var symbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section'),\n g_lyr_name = '#' + _app.layer_to_id.get(layer),\n last_color = fill_prev && fill_prev.single ? fill_prev.single : '#FFF';\n var block = fill_color_section.insert('p');\n block.insert('span').html(_tr('app_page.layer_style_popup.fill_color'));\n block.insert('input').attr('type', 'color').style('float', 'right').property('value', last_color).on('change', function () {\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', this.value);\n data_manager.current_layers[layer].fill_color = { single: this.value };\n });\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', last_color);\n data_manager.current_layers[layer].fill_color = { single: last_color };\n}\n\nfunction make_random_color(layer) {\n var symbol = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'path';\n\n var block = d3.select('#fill_color_section');\n block.insert('span').attr('id', 'random_color_btn').styles({ cursor: 'pointer', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.toggle_colors')).on('click', function () {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function () {\n return (0, _colors_helpers.randomColor)();\n }); // Colors.names[Colors.random()]);\n data_manager.current_layers[layer].fill_color = { random: true };\n });\n}\n\nfunction fill_categorical(layer, field_name, symbol, color_cat_map) {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function (d) {\n return color_cat_map.get(d.properties[field_name]);\n });\n}\n\nfunction make_categorical_color_menu(fields, layer, fill_prev) {\n var symbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section').append('p');\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.categorical_field'));\n var field_selec = fill_color_section.insert('select');\n fields.forEach(function (field) {\n if (field !== 'id') field_selec.append('option').text(field).attr('value', field);\n });\n if (fill_prev.categorical && fill_prev.categorical instanceof Array) {\n (0, _helpers.setSelected)(field_selec.node(), fill_prev.categorical[0]);\n }\n field_selec.on('change', function () {\n var field_name = this.value,\n data_layer = data_manager.current_layers[layer].is_result ? data_manager.result_data[layer] : data_manager.user_data[layer],\n values = data_layer.map(function (i) {\n return i[field_name];\n }),\n cats = new Set(values),\n txt = [cats.size, ' cat.'].join('');\n d3.select('#nb_cat_txt').html(txt);\n var color_cat_map = new Map();\n Array.from(cats.keys()).forEach(function (val) {\n color_cat_map.set(val, _colors_helpers.Colors.names[_colors_helpers.Colors.random()]);\n });\n data_manager.current_layers[layer].fill_color = { categorical: [field_name, color_cat_map] };\n fill_categorical(layer, field_name, symbol, color_cat_map);\n });\n\n if ((!fill_prev || !fill_prev.categorical) && field_selec.node().options.length > 0) {\n (0, _helpers.setSelected)(field_selec.node(), field_selec.node().options[0].value);\n }\n fill_color_section.append('span').attr('id', 'nb_cat_txt').html('');\n}\n\n/**\n* Function to create the input section allowing to change the name of a layer.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent - A d3 selection corresponding to the parent box.\n* @param {String} layer_name - The current name of layer edited in the style box.\n* @return {Object} - The d3 selection corresponding to the input element created.\n*/\nfunction make_change_layer_name_section(parent, layer_name) {\n var section = parent.insert('p').attr('class', 'inp_bottom');\n section.append('span').html(_tr('app_page.layer_style_popup.layer_name'));\n var inpt = section.append('input').attrs({ id: 'lyr_change_name', type: 'text' }).styles({ width: '200px', float: 'left' });\n inpt.node().value = layer_name;\n return inpt;\n}\n\nfunction createStyleBoxTypoSymbols(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n display: features[i].style.display ? features[i].style.display : null,\n size: features[i].getAttribute('width'),\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')]\n });\n }\n prev_settings_defaults.size = data_manager.current_layers[layer_name].default_size;\n }\n\n var restore_prev_settings = function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].setAttribute('width', prev_settings[i].size);\n features[i].setAttribute('height', prev_settings[i].size);\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.display = prev_settings[i].display;\n }\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n };\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('image'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbols_map = data_manager.current_layers[layer_name].symbols_map,\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n var prev_settings = [],\n prev_settings_defaults = {};\n // const zs = d3.zoomTransform(svg_map).k;\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry),\n size_symbol = symbols_map.get(d.properties.symbol_field)[1] / 2;\n return { x: centroid[0] - size_symbol, y: centroid[1] - size_symbol };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_symbols')).on('click', function () {\n selection.style('display', undefined);\n });\n\n var size_section = popup.append('p');\n size_section.append('span').html(_tr('app_page.layer_style_popup.symbols_size'));\n size_section.append('input').attrs({ min: 0, max: 200, step: 'any', type: 'number' }).styles({ width: '60px', margin: 'auto' }).property('value', 32).on('change', function () {\n var value = this.value;\n selection.transition().attrs(function () {\n var current_size = this.height.baseVal.value;\n return {\n width: value + 'px',\n height: value + 'px',\n x: this.x.baseVal.value + current_size / 2 - value / 2,\n y: this.y.baseVal.value + current_size / 2 - value / 2\n };\n });\n });\n}\n// popup.append(\"p\").style(\"text-align\", \"center\")\n// .insert(\"button\")\n// .attr(\"id\",\"modif_symb\")\n// .attr(\"class\", \"button_st4\")\n// .text(_tr(\"app_page.layer_style_popup.modify_symbols\"))\n// .on(\"click\", function(){\n// display_box_symbol_typo(ref_layer_name, rendered_field)().then(function(confirmed){\n// if(confirmed){\n// rendering_params = {\n// nb_cat: confirmed[0],\n// symbols_map: confirmed[1],\n// field: rendered_field\n// };\n// map.select(\"#\" + layer_name)\n// .selectAll(\"image\")\n// .attr(\"x\",\n// d => d.coords[0] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"y\",\n// d => d.coords[1] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"width\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"height\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"xlink:href\",\n// (d, i) => rendering_params.symbols_map.get(d.Symbol_field)[0]);\n// }\n// });\n// });\n\nfunction createStyleBoxLabel(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n prev_settings = [];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n color: features[i].style.fill,\n size: features[i].style.fontSize,\n display: features[i].style.display ? features[i].style.display : null,\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')],\n font: features[i].style.fontFamily\n });\n }\n prev_settings_defaults = {\n color: data_manager.current_layers[layer_name].fill_color,\n size: data_manager.current_layers[layer_name].default_size,\n font: data_manager.current_layers[layer_name].default_font\n };\n }\n\n function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].style.fill = prev_settings[i].color;\n features[i].style.fontSize = prev_settings[i].size;\n features[i].style.display = prev_settings[i].display;\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.fontFamily = prev_settings[i].font;\n }\n\n data_manager.current_layers[layer_name].fill_color = prev_settings_defaults.color;\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n data_manager.current_layers[layer_name].default_font = prev_settings_defaults.font;\n }\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('text'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name;\n // const rendering_params = {};\n var prev_settings_defaults = {};\n var prev_settings = [];\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else {\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_labels_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var coords = path.centroid(d.geometry);\n return { x: coords[0], y: coords[1] };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_labels')).on('click', function () {\n selection.style('display', undefined);\n });\n\n popup.insert('p').styles({ 'text-align': 'center', 'font-size': '9px' }).html(_tr('app_page.layer_style_popup.overrride_warning'));\n var label_sizes = popup.append('p').attr('class', 'line_elem');\n label_sizes.append('span').html(_tr('app_page.layer_style_popup.labels_default_size'));\n label_sizes.insert('span').style('float', 'right').html(' px');\n label_sizes.insert('input').attr('type', 'number').styles({ float: 'right', width: '70px' }).property('value', +data_manager.current_layers[layer_name].default_size.replace('px', '')).on('change', function () {\n var size = this.value + 'px';\n data_manager.current_layers[layer_name].default_size = size;\n selection.style('font-size', size);\n });\n\n var default_color = popup.insert('p').attr('class', 'line_elem');\n default_color.append('span').html(_tr('app_page.layer_style_popup.labels_default_color'));\n default_color.insert('input').attr('type', 'color').style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color).on('change', function () {\n data_manager.current_layers[layer_name].fill_color = this.value;\n selection.transition().style('fill', this.value);\n });\n\n var font_section = popup.insert('p').attr('class', 'line_elem');\n font_section.append('span').html(_tr('app_page.layer_style_popup.labels_default_font'));\n var choice_font = font_section.insert('select').style('float', 'right').on('change', function () {\n data_manager.current_layers[layer_name].default_font = this.value;\n selection.transition().style('font-family', this.value);\n });\n\n _fonts.available_fonts.forEach(function (name) {\n choice_font.append('option').attr('value', name[1]).text(name[0]);\n });\n choice_font.node().value = data_manager.current_layers[layer_name].default_font;\n}\n\nfunction createStyleBoxGraticule(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var current_params = (0, _helpers.cloneObj)(data_manager.current_layers.Graticule);\n var selection = map.select('#L_Graticule > path');\n var selection_strokeW = map.select('#L_Graticule');\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n return null;\n } else {\n return null;\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n // let new_layer_name = layer_name;\n // const new_name_section = make_change_layer_name_section(popup, layer_name);\n // new_name_section.on('change', function() {\n // new_layer_name = this.value;\n // });\n\n var color_choice = popup.append('p').attr('class', 'line_elem');\n color_choice.append('span').html(_tr('app_page.layer_style_popup.color'));\n color_choice.append('input').attr('type', 'color').style('float', 'right').property('value', current_params.fill_color.single).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers.Graticule.fill_color.single = this.value;\n });\n\n var opacity_choice = popup.append('p').attr('class', 'line_elem');\n opacity_choice.append('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_choice.append('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', current_params.opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n data_manager.current_layers.Graticule.opacity = +this.value;\n popup.select('#graticule_opacity_txt').html(+this.value * 100 + '%');\n });\n opacity_choice.append('span').attr('id', 'graticule_opacity_txt').style('float', 'right').html(current_params.opacity * 100 + '%');\n\n var stroke_width_choice = popup.append('p').attr('class', 'line_elem');\n stroke_width_choice.append('span').html(_tr('app_page.layer_style_popup.width'));\n stroke_width_choice.append('input').attr('type', 'number').styles({ width: '60px', float: 'right' }).property('value', current_params['stroke-width-const']).on('change', function () {\n selection_strokeW.style('stroke-width', this.value);\n data_manager.current_layers.Graticule['stroke-width-const'] = +this.value;\n });\n\n var steps_choice = popup.append('p').attr('class', 'line_elem');\n steps_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_steps'));\n steps_choice.append('input').attrs({ id: 'graticule_range_steps', type: 'range', min: 0, max: 100, step: 1 }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.step).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling;\n var step_val = +this.value;\n var dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n data_manager.current_layers.Graticule.step = step_val;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n if (data_manager.current_layers.Graticule.extent) {\n graticule = graticule.extent(data_manager.current_layers.Graticule.extent);\n }\n map.select('#L_Graticule').remove();\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n popup.select('#graticule_step_txt').property('value', step_val);\n });\n steps_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_step_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.step).on('change', function () {\n var grat_range = document.getElementById('graticule_range_steps');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n var dasharray_choice = popup.append('p').attr('class', 'line_elem');\n dasharray_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_dasharray'));\n dasharray_choice.append('input').attrs({ type: 'range', min: 0, max: 50, step: 0.1, id: 'graticule_range_dasharray' }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n selection.style('stroke-dasharray', this.value);\n data_manager.current_layers.Graticule.dasharray = +this.value;\n popup.select('#graticule_dasharray_txt').property('value', this.value);\n });\n dasharray_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_dasharray_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n var grat_range = document.getElementById('graticule_range_dasharray');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n // Only append this section if there is currently a target layer :\n if (Object.keys(data_manager.user_data).length) {\n var clip_extent_section = popup.append('p').attr('class', 'line_elem');\n clip_extent_section.append('input').attrs({ type: 'checkbox', id: 'clip_graticule' }).property('checked', current_params.extent ? true : null).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling,\n step_val = +document.getElementById('graticule_step_txt').value,\n dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n map.select('#L_Graticule').remove();\n if (this.checked) {\n var bbox_layer = _target_layer_file.bbox;\n var extent_grat = [[Math.round((bbox_layer[0] - 12) / 10) * 10, Math.round((bbox_layer[1] - 12) / 10) * 10], [Math.round((bbox_layer[2] + 12) / 10) * 10, Math.round((bbox_layer[3] + 12) / 10) * 10]];\n\n if (extent_grat[0] < -180) extent_grat[0] = -180;\n if (extent_grat[1] < -90) extent_grat[1] = -90;\n if (extent_grat[2] > 180) extent_grat[2] = 180;\n if (extent_grat[3] > 90) extent_grat[3] = 90;\n graticule = graticule.extent(extent_grat);\n data_manager.current_layers.Graticule.extent = extent_grat;\n } else {\n data_manager.current_layers.Graticule.extent = undefined;\n }\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n });\n clip_extent_section.append('label').attrs({ for: 'clip_graticule' }).html(_tr('app_page.layer_style_popup.graticule_clip'));\n }\n\n // Allow to create label for each line of the graticule\n make_generate_labels_graticule_section(popup);\n}\n\n/**\n* Function triggered to redraw the legend after changing some properties on a layer.\n*\n* @param {String} type_legend - The type of the legend to redraw.\n* @param {String} layer_name - The name of the layer concerned.\n* @param {String} field - The name of the rendered field.\n* @return {void}\n*\n*/\nfunction redraw_legend(type_legend, layer_name, field) {\n var _ref = type_legend === 'choro' ? [['#legend_root.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro] : type_legend === 'choro_horiz' ? [['#legend_root_horiz.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro_horizontal] : type_legend === 'line_class' ? [['#legend_root_lines_class.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_discont_links] : type_legend === 'line_symbol' ? [['#legend_root_lines_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_line_symbol] : type_legend === 'waffle' ? [['#legend_root_waffle.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_waffle] : type_legend === 'layout' ? [['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_layout] : undefined,\n _ref2 = _slicedToArray(_ref, 2),\n selector = _ref2[0],\n legend_func = _ref2[1];\n\n var lgd = document.querySelector(selector);\n if (lgd) {\n var transform_param = lgd.getAttribute('transform'),\n lgd_title = lgd.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = lgd.querySelector('#legendsubtitle').innerHTML,\n rounding_precision = lgd.getAttribute('rounding_precision'),\n note = lgd.querySelector('#legend_bottom_note').innerHTML,\n boxgap = lgd.getAttribute('boxgap');\n var rect_fill_value = lgd.getAttribute('visible_rect') === 'true' ? {\n color: lgd.querySelector('#under_rect').style.fill,\n opacity: lgd.querySelector('#under_rect').style.fillOpacity\n } : undefined;\n if (type_legend.indexOf('choro') > -1) {\n var no_data_txt = lgd.querySelector('#no_data_txt');\n no_data_txt = no_data_txt != null ? no_data_txt.textContent : null;\n\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, no_data_txt, note);\n } else if (type_legend === 'waffle') {\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, rect_fill_value, note);\n } else if (type_legend === 'layout') {\n lgd.remove();\n var text_value = lgd.querySelector('g.lg.legend_0 > text').innerHTML;\n legend_func(layer_name, data_manager.current_layers[layer_name].type, lgd_title, lgd_subtitle, rect_fill_value, text_value, note);\n } else {\n lgd.remove();\n legend_func(layer_name, data_manager.current_layers[layer_name].rendered_field, lgd_title, lgd_subtitle, rect_fill_value, rounding_precision, note);\n }\n lgd = document.querySelector(selector);\n if (transform_param) {\n lgd.setAttribute('transform', transform_param);\n }\n }\n}\n\nfunction createStyleBox_Line(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_random_colors = void 0;\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.stroke);\n });\n }\n\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n var prev_min_display = void 0,\n prev_size = void 0,\n prev_breaks = void 0;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n var table = [];\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].style.strokeWidth = prop_values[i];\n }\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical' && renderer !== 'PropSymbolsTypo' && renderer !== 'LinksProportional') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.breaks[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, rendering_params.field);\n } else {\n redraw_legend('choro_horiz', layer_name, rendering_params.field);\n }\n } else if ((renderer === 'Categorical' || renderer === 'PropSymbolsTypo') && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n redraw_legend('choro', layer_name, rendering_params.field);\n } else if (renderer === 'DiscLayer') {\n selection.each(function (d) {\n d.properties.prop_val = this.style.strokeWidth; // eslint-disable-line no-param-reassign\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (renderer === 'LinksGraduated') {\n selection.each(function (d, i) {\n data_manager.current_layers[layer_name].linksbyId[i][2] = this.style.strokeWidth;\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n\n if (renderer && (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional')) {\n selection.each(function (d) {\n d.properties.color = this.style.stroke; // eslint-disable-line no-param-reassign\n });\n redraw_legend('line_symbol', layer_name);\n }\n\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n\n if (data_manager.current_layers[layer_name].renderer === 'LinksGraduated' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('display', function (d) {\n return +d.properties[data_manager.current_layers[layer_name].rendered_field] > prev_min_display ? null : 'none';\n }).style('stroke-opacity', border_opacity).style('stroke-width', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][2];\n });\n } else if (data_manager.current_layers[layer_name].renderer === 'DiscLayer' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].size = prev_size;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n var lim = prev_min_display !== 0 ? prev_min_display * data_manager.current_layers[layer_name].n_features : -1;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('stroke-opacity', border_opacity).style('display', function (d, i) {\n return +i <= lim ? null : 'none';\n }).style('stroke-width', function (d) {\n return d.properties.prop_val;\n });\n } else {\n if (fill_meth === 'single') {\n selection.style('stroke', fill_prev.single).style('stroke-opacity', border_opacity);\n } else if (fill_meth === 'random') {\n selection.style('stroke-opacity', border_opacity).style('stroke', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n });\n } else if (fill_meth === 'class' && renderer === 'LinksGraduated') {\n selection.style('stroke-opacity', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][0];\n }).style('stroke', stroke_prev);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (renderer === 'Categorical' || renderer === 'PropSymbolsTypo') {\n var color_field = renderer === 'Categorical' ? data_manager.current_layers[layer_name].rendered_field : data_manager.current_layers[layer_name].rendered_field2;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a = (0, _function.prepare_categories_array)(layer_name, color_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a2 = _slicedToArray(_prepare_categories_a, 2),\n cats = _prepare_categories_a2[0],\n _ = _prepare_categories_a2[1];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, color_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: color_field,\n field: color_field\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth' || renderer === 'PropSymbolsChoro') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers[layer_name].fill_color = { single: this.value };\n // data_manager.current_layers[layer_name].fill_color.single = this.value;\n });\n }\n\n if (renderer === 'LinksGraduated') {\n prev_min_display = data_manager.current_layers[layer_name].min_display || 0;\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n var fij_field = data_manager.current_layers[layer_name].rendered_field;\n var max_val = 0;\n selection.each(function (d) {\n if (+d.properties[fij_field] > max_val) max_val = +d.properties[fij_field];\n });\n var threshold_section = popup.append('p').attr('class', 'line_elem');\n threshold_section.append('span').html(_tr('app_page.layer_style_popup.display_flow_larger'));\n // The legend will be updated in order to start on the minimum value displayed instead of\n // using the minimum value of the serie (skipping unused class if necessary)\n threshold_section.insert('input').attrs({ type: 'range', min: 0, max: max_val, step: 0.5 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n popup.select('#larger_than').html([' ', val, ' '].join(''));\n selection.style('display', function (d) {\n return +d.properties[fij_field] > val ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n threshold_section.insert('label').attr('id', 'larger_than').style('float', 'right').html(' ' + prev_min_display + ' ');\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.modify_size_class')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, data_manager.current_layers[layer_name].rendered_field, data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n }),\n links_byId = data_manager.current_layers[layer_name].linksbyId;\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n selection.style('fill-opacity', 0).style('stroke-width', function (d, i) {\n return sizes[serie.getClass(+links_byId[i][1])];\n });\n }\n });\n });\n } else if (renderer === 'DiscLayer') {\n prev_min_display = +data_manager.current_layers[layer_name].min_display || 0;\n prev_size = data_manager.current_layers[layer_name].size.slice();\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n // const max_val = Math.max.apply(null, data_manager.result_data[layer_name].map(i => i.disc_value));\n var disc_part = popup.append('p').attr('class', 'line_elem');\n disc_part.append('span').html(_tr('app_page.layer_style_popup.discont_threshold'));\n disc_part.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n var lim = val !== 0 ? val * data_manager.current_layers[layer_name].n_features : -1;\n popup.select('#larger_than').html([' ', val * 100, ' % '].join(''));\n selection.style('display', function (d, i) {\n return i <= lim ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n disc_part.insert('label').attr('id', 'larger_than').style('float', 'right').html([' ', prev_min_display * 100, ' % '].join(''));\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, 'disc_value', data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n });\n\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n data_manager.current_layers[layer_name].size = [sizes[0], sizes[sizes.length - 1]];\n selection.style('fill-opacity', 0).style('stroke-width', function (d) {\n return sizes[serie.getClass(+d.properties.disc_value)];\n });\n }\n });\n });\n }\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n if (!renderer || !renderer.startsWith('PropSymbols') && !renderer.startsWith('Links') && renderer !== 'DiscLayer') {\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n } else if (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional') {\n var field_used = data_manager.current_layers[layer_name].rendered_field;\n var d_values = data_manager.result_data[layer_name].map(function (f) {\n return +f[field_used];\n });\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: data_manager.current_layers[layer_name].rendered_field }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({ type: 'number', id: 'max_size_range', min: 0.1, step: 'any' }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, 'line');\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], 'line');\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n }\n\n if (data_manager.current_layers[layer_name].renderer === undefined) {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBox(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var type = data_manager.current_layers[layer_name].type,\n isSphere = data_manager.current_layers[layer_name].sphere === true,\n renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n var prev_random_colors = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var table = [];\n var stroke_prev = selection.style('stroke');\n var previous_point_radius = data_manager.current_layers[layer_name].pointRadius;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n var fields_layer = !isSphere ? data_manager.current_layers[layer_name].fields_type || (0, _helpers.type_col2)(table) : [];\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // Update the object holding the properties of the layer if Yes is clicked\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (renderer === 'Categorical' && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n }\n\n if (rendering_params !== undefined && rendering_params.field !== undefined) {\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (type === 'Point' && data_manager.current_layers[layer_name].pointRadius) {\n data_manager.current_layers[layer_name].pointRadius = previous_point_radius;\n selection.attr('d', path.pointRadius(+data_manager.current_layers[layer_name].pointRadius));\n } else {\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return fill_prev.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'random') {\n selection.style('fill', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], 'path', fill_prev.categorical[1]);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n if (layer_name !== 'World') {\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n }\n\n if (type === 'Point') {\n var pt_size = popup.append('p').attr('class', 'line_elem');\n pt_size.append('span').html(_tr('app_page.layer_style_popup.point_radius'));\n pt_size.append('input').attrs({ type: 'range', min: 0, max: 80, id: 'point_radius_size' }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', previous_point_radius).on('change', function () {\n var current_pt_size = +this.value;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n document.getElementById('point_radius_size_txt').value = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n });\n pt_size.append('input').attrs({\n type: 'number',\n min: 0,\n max: 80,\n step: 'any',\n class: 'without_spinner',\n id: 'point_radius_size_txt'\n }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', +previous_point_radius).on('change', function () {\n var pt_size_range = document.getElementById('point_radius_size');\n var old_value = pt_size_range.value;\n if (this.value === '' || isNaN(+this.value)) {\n this.value = old_value;\n } else {\n this.value = (0, _helpers_calc.round_value)(+this.value, 2);\n var current_pt_size = this.value;\n pt_size_range.value = current_pt_size;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n }\n });\n }\n\n if (data_manager.current_layers[layer_name].colors_breaks === undefined && renderer !== 'Categorical') {\n if (data_manager.current_layers[layer_name].targeted || data_manager.current_layers[layer_name].is_result) {\n var fields = (0, _helpers.getFieldsType)('category', null, fields_layer);\n var fill_method = popup.append('p').html(_tr('app_page.layer_style_popup.fill_color')).insert('select');\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.categorical_color'), 'categorical'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('div').attrs({ id: 'fill_color_section' });\n fill_method.on('change', function () {\n d3.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev);\n } else if (this.value === 'categorical') {\n make_categorical_color_menu(fields, layer_name, fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n } else {\n popup.append('div').attrs({ id: 'fill_color_section' });\n make_single_color_menu(layer_name, fill_prev);\n }\n } else if (renderer === 'Categorical') {\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n container.modal.hide();\n\n var _prepare_categories_a3 = (0, _function.prepare_categories_array)(layer_name, rendered_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a4 = _slicedToArray(_prepare_categories_a3, 1),\n cats = _prepare_categories_a4[0];\n\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, rendered_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: rendered_field,\n field: rendered_field\n };\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Gridded') {\n var field_to_discretize = data_manager.current_layers[layer_name].rendered_field;\n popup.append('p').style('margin', 'auto').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_to_discretize, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'Choropleth',\n field: field_to_discretize,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n }\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n\n if (data_manager.current_layers[layer_name].renderer === undefined) {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBoxStewart(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var nb_ft = data_manager.current_layers[layer_name].n_features;\n var prev_palette = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].color_palette);\n\n var recolor_stewart = function recolor_stewart(coloramp_name, reversed) {\n var new_coloramp = (0, _colors_helpers.getColorBrewerArray)(nb_ft, coloramp_name);\n if (reversed === false) {\n new_coloramp.reverse();\n }\n for (var i = 0; i < nb_ft; ++i) {\n rendering_params.breaks[i][1] = new_coloramp[i];\n }\n selection.transition().style('fill', function (d, i) {\n return new_coloramp[i];\n });\n data_manager.current_layers[layer_name].color_palette = { name: coloramp_name, reversed: reversed };\n };\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var rendering_params = { breaks: [].concat(data_manager.current_layers[layer_name].colors_breaks) };\n var prev_col_breaks = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n data_manager.current_layers[layer_name].colors_breaks = rendering_params.breaks;\n data_manager.current_layers[layer_name].fill_color.class = rendering_params.breaks.map(function (obj) {\n return obj[1];\n });\n // Redraw the legend if necessary:\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n // const fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n recolor_stewart(prev_palette.name, prev_palette.reversed);\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n var color_palette_section = popup.insert('p').attr('class', 'line_elem');\n color_palette_section.append('span').html(_tr('app_page.layer_style_popup.color_palette'));\n var seq_color_select = color_palette_section.insert('select').attr('id', 'coloramp_params').style('float', 'right').on('change', function () {\n recolor_stewart(this.value, false);\n });\n\n ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'].forEach(function (name) {\n seq_color_select.append('option').text(name).attr('value', name);\n });\n seq_color_select.node().value = prev_palette.name;\n popup.insert('p').attr('class', 'line_elem').styles({ 'text-align': 'center', margin: '0 !important' }).insert('button').attrs({ class: 'button_st3', id: 'reverse_colramp' }).html(_tr('app_page.layer_style_popup.reverse_palette')).on('click', function () {\n var pal_name = document.getElementById('coloramp_params').value;\n recolor_stewart(pal_name, true);\n });\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', 'border_opacity').on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction make_generate_labels_graticule_section(parent_node) {\n var labels_section = parent_node.append('p');\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n (0, _function.render_label_graticule)('Graticule', {\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', 'Graticule'].join('_')\n });\n });\n}\n\n/**\n* Create the section allowing to generate labels on a parent style box.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent_node - The d3 selection corresponding the parent style box.\n* @param {String} layer_name - The name of the layer currently edited in the style box.\n* @return {void}\n*\n*/\nfunction make_generate_labels_section(parent_node, layer_name) {\n var _fields = get_fields_name(layer_name) || [];\n // const table = make_table(layer_name);\n var fields_num = (0, _helpers.type_col2)((0, _tables.make_table)(layer_name)).filter(function (a) {\n return a.type === 'ratio' || a.type === 'stock';\n }).map(function (a) {\n return a.name;\n });\n if (_fields && _fields.length > 0) {\n var labels_section = parent_node.append('p');\n var input_fields = {};\n for (var i = 0; i < _fields.length; i++) {\n input_fields[_fields[i]] = _fields[i];\n }\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n swal({\n title: '',\n html: '
\\n

' + _tr('app_page.layer_style_popup.field_label') + '

\\n\\n
\\n
',\n type: 'question',\n customClass: 'swal2_custom',\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm'),\n inputOptions: input_fields,\n onOpen: function onOpen() {\n var sel = d3.select('#label_box_field');\n _fields.forEach(function (f_name) {\n sel.append('option').property('value', f_name).text(f_name);\n });\n if (fields_num.length > 0) {\n var section_filter = d3.select('#label_box_filter_section');\n section_filter.append('input').attrs({ type: 'checkbox', id: 'label_box_filter_chk' }).on('change', function () {\n if (this.checked) {\n subsection_filter_label.style('display', null);\n } else {\n subsection_filter_label.style('display', 'none');\n }\n });\n section_filter.append('label').attr('for', 'label_box_filter_chk').html(_tr('app_page.layer_style_popup.filter_label'));\n var subsection_filter_label = section_filter.append('div').style('display', 'none');\n var sel2 = subsection_filter_label.append('select').attr('id', 'label_box_filter_field');\n fields_num.forEach(function (f_name) {\n sel2.append('option').property('value', f_name).text(f_name);\n });\n var sel3 = subsection_filter_label.append('select').attr('id', 'label_box_filter_type');\n sel3.append('option').property('value', 'sup').text('>');\n sel3.append('option').property('value', 'inf').text('<');\n subsection_filter_label.append('input').attrs({ type: 'number', id: 'label_box_filter_value' });\n }\n },\n preConfirm: function preConfirm() {\n return new Promise(function (resolve, reject) {\n setTimeout(function () {\n var selected_field = document.getElementById('label_box_field').value;\n var filter_options = undefined;\n if (fields_num.length > 0) {\n var to_filter = document.getElementById('label_box_filter_chk').checked;\n if (to_filter) {\n var filter_value = document.getElementById('label_box_filter_value').value;\n if (!filter_value || isNaN(filter_value)) {\n reject(_tr('app_page.common.incorrect_value'));\n return;\n }\n filter_options = {\n field: document.getElementById('label_box_filter_field').value,\n type_filter: document.getElementById('label_box_filter_type').value,\n filter_value: filter_value\n };\n }\n }\n if (_fields.indexOf(selected_field) < 0) {\n reject(_tr('app_page.common.no_value'));\n } else {\n resolve();\n (0, _function.render_label)(layer_name, {\n label_field: selected_field,\n filter_options: filter_options,\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', selected_field, layer_name].join('_')\n });\n }\n }, 50);\n });\n }\n }).then(function () {\n //console.log(value);\n }, function () {\n //console.log(dismiss);\n });\n });\n }\n}\n\n/**\n* Return the name of the fields/columns\n* (ie. the members of the `properties` Object for each feature on a layer)\n*\n* @param {String} layer_name - The name of the layer.\n* @return {Array} - An array of Strings, one for each field name.\n*\n*/\nfunction get_fields_name(layer_name) {\n var elem = document.getElementById(_app.layer_to_id.get(layer_name)).childNodes[0];\n if (!elem.__data__ || !elem.__data__.properties) {\n return null;\n }\n return Object.getOwnPropertyNames(elem.__data__.properties);\n}\n\nfunction createStyleBoxWaffle(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var round = Math.round;\n var floor = Math.floor;\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbol = data_manager.current_layers[layer_name].symbol,\n fields = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name);\n\n var previous_params = {\n fill_opacity: selection.selectAll(symbol).style('fill-opacity'),\n ref_colors: [].concat(data_manager.current_layers[layer_name].fill_color),\n size: data_manager.current_layers[layer_name].size,\n nCol: data_manager.current_layers[layer_name].nCol\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n redraw_legend('waffle', layer_name, fields);\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n data_manager.current_layers[layer_name].fill_color = previous_params.ref_colors;\n data_manager.current_layers[layer_name].size = previous_params.size;\n selection.selectAll(symbol).style('fill-opacity', previous_params.fill_opacity);\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: fields.join(' ,') }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem').attr('id', 'fill_color_section');\n\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.fill_opacity).on('change', function () {\n selection.selectAll(symbol).style('fill-opacity', +this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opacity_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+previous_params.fill_opacity * 100 + '%');\n\n var ref_colors_section = popup.append('div').attr('id', 'ref_colors_section').style('clear', 'both');\n ref_colors_section.append('p').html(_tr('app_page.layer_style_popup.ref_colors'));\n\n var _loop = function _loop(i) {\n var p = ref_colors_section.append('p').style('margin', '15px 5px');\n p.append('span').html(data_manager.current_layers[layer_name].rendered_field[i]);\n p.insert('input').attrs({ id: i, type: 'color' }).style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color[i]).on('change', function () {\n // eslint-disable-line no-loop-func\n var col = (0, _colors_helpers.rgb2hex)(this.value);\n var to_replace = data_manager.current_layers[layer_name].fill_color[i];\n data_manager.current_layers[layer_name].fill_color[i] = col;\n selection.selectAll(symbol).each(function () {\n if ((0, _colors_helpers.rgb2hex)(this.getAttribute('fill')) === to_replace) {\n this.setAttribute('fill', col);\n }\n });\n });\n };\n\n for (var i = 0; i < data_manager.current_layers[layer_name].fill_color.length; i++) {\n _loop(i);\n }\n\n var size_section = popup.append('p').attr('class', 'line_elem').attr('id', 'size_section').style('clear', 'both');\n\n size_section.append('span').html(_tr('app_page.layer_style_popup.ref_size'));\n size_section.insert('input').attrs({ type: 'range', min: 1, max: 40, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.size).on('change', function () {\n var val = +this.value;\n var nCol = data_manager.current_layers[layer_name].nCol;\n data_manager.current_layers[layer_name].size = val;\n selection.selectAll('g').selectAll(symbol).each(function (_, i) {\n if (symbol === 'circle') {\n var t_x = round(i % nCol * 2 * val);\n var t_y = floor(floor(i / nCol) * 2 * val);\n this.setAttribute('r', val);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = val / 5;\n var _t_x = round(i % nCol * val) + offset * round(i % nCol);\n var _t_y = floor(floor(i / nCol) * val) + offset * floor(i / nCol);\n this.setAttribute('width', val);\n this.setAttribute('height', val);\n this.setAttribute('transform', 'translate(-' + _t_x + ', -' + _t_y + ')');\n }\n });\n size_section.select('#size_section_txt').html(this.value + ' px');\n });\n size_section.append('span').attr('id', 'size_section_txt').style('float', 'right').html(previous_params.size + ' px');\n\n var width_row_section = popup.append('p').attr('class', 'line_elem').attr('id', 'width_row_section');\n\n width_row_section.append('span').html(_tr('app_page.func_options.twostocks.waffle_width_rows'));\n width_row_section.insert('input').attrs({ type: 'range', min: 1, max: 10, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.nCol).on('change', function () {\n var val = +this.value;\n var size = data_manager.current_layers[layer_name].size;\n data_manager.current_layers[layer_name].nCol = val;\n selection.selectAll('g').selectAll(symbol).each(function (d, i) {\n if (symbol === 'circle') {\n var t_x = round(i % val * 2 * size);\n var t_y = floor(floor(i / val) * 2 * size);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = size / 5;\n var _t_x2 = round(i % val * size) + offset * round(i % val);\n var _t_y2 = floor(floor(i / val) * size) + offset * floor(i / val);\n this.setAttribute('transform', 'translate(-' + _t_x2 + ', -' + _t_y2 + ')');\n }\n });\n width_row_section.select('#width_row_text').html(this.value);\n });\n width_row_section.append('span').attr('id', 'width_row_text').style('float', 'right').html(previous_params.nCol);\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol' });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n}\n\nfunction createStyleBox_ProbSymbol(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n type_method = data_manager.current_layers[layer_name].renderer,\n type_symbol = data_manager.current_layers[layer_name].symbol,\n field_used = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name).selectAll(type_symbol),\n old_size = [data_manager.current_layers[layer_name].size[0], data_manager.current_layers[layer_name].size[1]];\n var rendering_params = void 0;\n var stroke_prev = selection.style('stroke');\n var stroke_width = selection.style('stroke-width');\n var prev_random_colors = void 0;\n\n var opacity = selection.style('fill-opacity'),\n border_opacity = selection.style('stroke-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var d_values = data_manager.result_data[layer_name].map(function (v) {\n return +v[field_used];\n });\n var prev_col_breaks = void 0;\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n\n if (type_symbol === 'circle') {\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].setAttribute('r', prop_values[i]);\n }\n } else if (type_symbol === 'rect') {\n for (var _i = 0, _len = prop_values.length; _i < _len; _i++) {\n var old_rect_size = +selec[_i].getAttribute('height');\n var centr = [+selec[_i].getAttribute('x') + old_rect_size / 2 - prop_values[_i] / 2, +selec[_i].getAttribute('y') + old_rect_size / 2 - prop_values[_i] / 2];\n selec[_i].setAttribute('x', centr[0]);\n selec[_i].setAttribute('y', centr[1]);\n selec[_i].setAttribute('height', prop_values[_i]);\n selec[_i].setAttribute('width', prop_values[_i]);\n }\n }\n };\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = [].concat(data_manager.current_layers[layer_name].colors_breaks);\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n prev_col_breaks = data_manager.current_layers[layer_name].break_val;\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n if (stroke_prev.startsWith('rgb')) stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n if (stroke_width.endsWith('px')) stroke_width = stroke_width.substring(0, stroke_width.length - 2);\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // if(data_manager.current_layers[layer_name].size != old_size){\n var lgd_prop_symb = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n if (lgd_prop_symb) {\n (0, _map_ctrl.redraw_legends_symbols)(lgd_prop_symb);\n }\n if (type_symbol === 'circle') {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('r'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n } else {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('height'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n }\n\n if ((type_method === 'PropSymbolsChoro' || type_method === 'PropSymbolsTypo') && rendering_params !== undefined) {\n if (type_method === 'PropSymbolsChoro') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n data_manager.current_layers[layer_name].colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (type_method === 'PropSymbolsTypo') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n }\n data_manager.current_layers[layer_name].rendered_field2 = rendering_params.field;\n // Also change the legend if there is one displayed :\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n }\n // if(selection._groups[0][0].__data__.properties.color && rendering_params !== undefined){\n // selection.each((d,i) => {\n // d.properties.color = rendering_params.colorsByFeature[i];\n // });\n // }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n selection.style('fill-opacity', opacity);\n map.select(g_lyr_name).style('stroke-width', stroke_width);\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'two') {\n data_manager.current_layers[layer_name].break_val = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = { two: [fill_prev.two[0], fill_prev.two[1]] };\n selection.style('fill', function (d, i) {\n return d_values[i] > prev_col_breaks ? fill_prev.two[1] : fill_prev.two[0];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return data_manager.current_layers[layer_name].fill_color.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n } else if (fill_meth === 'random') {\n selection.style('fill', function (_, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], type_symbol, fill_prev.categorical[1]);\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n if (data_manager.current_layers[layer_name].size[1] !== old_size[1]) {\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, old_size[0], old_size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size = [old_size[0], old_size[1]];\n }\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (type_method === 'PropSymbolsChoro') {\n var field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.field_symbol_color', { field: field_color })).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_color, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'PropSymbolsChoro',\n field: field_color,\n extra_options: confirmed[7]\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n var fill_color_section = popup.append('div').attr('id', 'fill_color_section');\n fill_color_section.append('p').style('text-align', 'center').html(_tr('app_page.layer_style_popup.color_break'));\n var p2 = fill_color_section.append('p').style('display', 'inline');\n var col1 = p2.insert('input').attrs({ id: 'col1', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[0]).on('change', function () {\n var _this = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[0] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : _this.value;\n });\n });\n var col2 = p2.insert('input').attrs({ id: 'col2', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[1]).on('change', function () {\n var _this2 = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[1] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? _this2.value : col1.node().value;\n });\n });\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.break_value'));\n var b_val = fill_color_section.insert('input').attr('type', 'number').style('width', '75px').property('value', data_manager.current_layers[layer_name].break_val).on('change', function () {\n var new_break_val = +this.value;\n data_manager.current_layers[layer_name].break_val = new_break_val;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : col1.node().value;\n });\n });\n } else if (type_method === 'PropSymbolsTypo') {\n var _field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').style('margin', 'auto').html(_tr('app_page.layer_style_popup.field_symbol_color', { field: _field_color }));\n popup.append('p').style('text-align', 'center').insert('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a5 = (0, _function.prepare_categories_array)(layer_name, _field_color, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a6 = _slicedToArray(_prepare_categories_a5, 1),\n cats = _prepare_categories_a6[0];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, _field_color, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: _field_color,\n field: _field_color\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n // const fields_all = type_col2(data_manager.result_data[layer_name]),\n // fields = getFieldsType('category', null, fields_all);\n var fill_method = popup.append('p').html(_tr('app_page.layer_style_popup.fill_color')).insert('select');\n\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('div').attr('id', 'fill_color_section');\n fill_method.on('change', function () {\n popup.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev, type_symbol);\n map.select(g_lyr_name).selectAll(type_symbol).transition().style('fill', fill_prev.single);\n data_manager.current_layers[layer_name].fill_color = (0, _helpers.cloneObj)(fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name, type_symbol);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n }\n\n var fill_opct_section = popup.append('p').attr('class', 'line_elem');\n fill_opct_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n\n fill_opct_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opct_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opct_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+opacity * 100 + '%');\n\n var border_color_section = popup.append('p').attr('class', 'line_elem');\n border_color_section.append('span').html(_tr('app_page.layer_style_popup.border_color'));\n border_color_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.transition().style('stroke', this.value);\n });\n\n var border_opacity_section = popup.append('p');\n border_opacity_section.append('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n\n border_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n border_opacity_section.select('#border_opacity_txt').html('' + this.value);\n });\n\n border_opacity_section.append('span').attr('id', 'border_opacity_txt').style('float', 'right').html(' ' + border_opacity);\n\n var border_width_section = popup.append('p').attr('class', 'line_elem');\n border_width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n border_width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n selection.style('stroke-width', this.value + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = +this.value;\n });\n\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: field_used }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({ type: 'number', id: 'max_size_range', min: 0.1, step: 'any' }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, type_symbol);\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol'\n });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry);\n if (type_symbol === 'circle') {\n return {\n cx: centroid[0],\n cy: centroid[1]\n };\n } else {\n return {\n x: centroid[0] - +d.properties.prop_value / 2,\n y: centroid[1] - +d.properties.prop_value / 2\n };\n }\n });\n });\n make_generate_labels_section(popup, layer_name);\n}\n\n/**\n* Function triggered when the user want to edit a single label.\n*\n* @param {Node} label_node - The HTMLElement corresponding to this label.\n* @return {void}\n*\n*/\nfunction make_style_box_indiv_label(label_node) {\n var current_options = {\n size: label_node.style.fontSize,\n content: label_node.textContent,\n font: label_node.style.fontFamily,\n color: label_node.style.fill\n };\n // const new_params = {};\n if (current_options.color.startsWith('rgb')) {\n current_options.color = (0, _colors_helpers.rgb2hex)(current_options.color);\n }\n (0, _dialogs.check_remove_existing_box)('.styleTextAnnotation');\n (0, _dialogs.make_confirm_dialog2)('styleTextAnnotation', _tr('app_page.func_options.label.title_box_indiv'), { widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n label_node.style.fontsize = current_options.size; // eslint-disable-line no-param-reassign\n label_node.textContent = current_options.content; // eslint-disable-line no-param-reassign\n label_node.style.fill = current_options.color; // eslint-disable-line no-param-reassign\n label_node.style.fontFamily = current_options.font; // eslint-disable-line no-param-reassign\n }\n });\n var box_content = d3.select('.styleTextAnnotation').select('.modal-content').style('width', '300px').select('.modal-body').insert('div');\n var a = box_content.append('p').attr('class', 'line_elem');\n a.insert('span').html(_tr('app_page.func_options.label.font_size'));\n a.append('input').attrs({ type: 'number', id: 'font_size', min: 0, max: 34, step: 'any' }).styles({ width: '70px', float: 'right' }).property('value', +label_node.style.fontSize.slice(0, -2)).on('change', function () {\n label_node.style.fontSize = this.value + 'px'; // eslint-disable-line no-param-reassign\n });\n var b = box_content.append('p').attr('class', 'line_elem');\n b.insert('span').html(_tr('app_page.func_options.label.content'));\n b.append('input').attr('id', 'label_content').styles({ width: '70px', float: 'right' }).property('value', label_node.textContent).on('keyup', function () {\n label_node.textContent = this.value; // eslint-disable-line no-param-reassign\n });\n var c = box_content.append('p').attr('class', 'line_elem');\n c.insert('span').html(_tr('app_page.func_options.common.color'));\n c.append('input').attrs({ type: 'color', id: 'label_color' }).styles({ width: '70px', float: 'right' }).property('value', (0, _colors_helpers.rgb2hex)(label_node.style.fill)).on('change', function () {\n label_node.style.fill = this.value; // eslint-disable-line no-param-reassign\n });\n var d = box_content.append('p').attr('class', 'line_elem');\n d.insert('span').html(_tr('app_page.func_options.label.font_type'));\n var selec_fonts = d.append('select').style('float', 'right').on('change', function () {\n label_node.style.fontFamily = this.value; // eslint-disable-line no-param-reassign\n });\n\n _fonts.available_fonts.forEach(function (name) {\n selec_fonts.append('option').attr('value', name[1]).text(name[0]);\n });\n selec_fonts.node().value = label_node.style.fontFamily;\n}\n\n/**\n* Function creating a drop shadow on a layer.\n* Currently the properties (offset, gaussianBlur) of this shadow are hard-coded.\n*\n* @param {String} layerId - The id of the layer (ie. the \"id\" attribute, not the layer name)\n* @return {void}\n*\n*/\nvar createDropShadow = exports.createDropShadow = function createDropShadow(layerId) {\n var filt_to_use = document.createElementNS('http://www.w3.org/2000/svg', 'filter');\n filt_to_use.setAttribute('id', 'filt_' + layerId);\n // filt_to_use.setAttribute(\"x\", 0);\n // filt_to_use.setAttribute(\"y\", 0);\n filt_to_use.setAttribute('width', '200%');\n filt_to_use.setAttribute('height', '200%');\n var offset = document.createElementNS('http://www.w3.org/2000/svg', 'feOffset');\n offset.setAttributeNS(null, 'result', 'offOut');\n offset.setAttributeNS(null, 'in', 'SourceAlpha');\n offset.setAttributeNS(null, 'dx', '5');\n offset.setAttributeNS(null, 'dy', '5');\n var gaussian_blur = document.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur');\n gaussian_blur.setAttributeNS(null, 'result', 'blurOut');\n gaussian_blur.setAttributeNS(null, 'in', 'offOut');\n gaussian_blur.setAttributeNS(null, 'stdDeviation', 10);\n var blend = document.createElementNS('http://www.w3.org/2000/svg', 'feBlend');\n blend.setAttributeNS(null, 'in', 'SourceGraphic');\n blend.setAttributeNS(null, 'in2', 'blurOut');\n blend.setAttributeNS(null, 'mode', 'normal');\n filt_to_use.appendChild(offset);\n filt_to_use.appendChild(gaussian_blur);\n filt_to_use.appendChild(blend);\n defs.node().appendChild(filt_to_use);\n svg_map.querySelector('#' + layerId).setAttribute('filter', 'url(#filt_' + layerId + ')');\n};\n\n/**\n* Return the id of a gaussian blur filter with the desired size (stdDeviation attribute)\n* if one with the same param already exists, its id is returned,\n* otherwise a new one is created, and its id is returned\n*/\n// var getBlurFilter = (function(size){\n// var count = 0;\n// return function(size) {\n// let blur_filts = defs.node().getElementsByClassName(\"blur\");\n// let blur_filt_to_use;\n// for(let i=0; i < blur_filts.length; i++){\n// if(blur_filts[i].querySelector(\"feGaussianBlur\")\n// .getAttributeNS(null, \"stdDeviation\") === size){\n// blur_filt_to_use = blur_filts[i];\n// }\n// }\n// if(!blur_filt_to_use){\n// count = count + 1;\n// blur_filt_to_use = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"filter\");\n// blur_filt_to_use.setAttribute(\"id\",\"blurfilt\" + count);\n// blur_filt_to_use.setAttribute(\"class\", \"blur\");\n// var gaussianFilter = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"feGaussianBlur\");\n// gaussianFilter.setAttributeNS(null, \"in\", \"SourceGraphic\");\n// gaussianFilter.setAttributeNS(null, \"stdDeviation\", size);\n// blur_filt_to_use.appendChild(gaussianFilter);\n// defs.node().appendChild(blur_filt_to_use);\n// }\n// return blur_filt_to_use.id;\n// };\n// })();\n\nfunction change_layer_name(old_name, new_name) {\n // Temporarily deactivate the tooltip displaying information under the cursor:\n var restart_info = false;\n if (document.getElementById('info_features').className === 'active') {\n (0, _interface.displayInfoOnMove)();\n restart_info = true;\n }\n var old_id = global._app.layer_to_id.get(old_name);\n var new_id = encodeId(new_name);\n data_manager.current_layers[new_name] = (0, _helpers.cloneObj)(data_manager.current_layers[old_name]);\n delete data_manager.current_layers[old_name];\n var list_elem = document.querySelector('li.' + old_id);\n list_elem.classList.remove(old_id);\n list_elem.classList.add(new_id);\n list_elem.setAttribute('layer_name', new_name);\n list_elem.innerHTML = list_elem.innerHTML.replace((0, _helpers.get_display_name_on_layer_list)(old_name), (0, _helpers.get_display_name_on_layer_list)(new_name));\n var b = svg_map.querySelector('#' + old_id);\n b.id = new_id;\n var lgd_elems = document.querySelectorAll('g[layer_name=\"' + old_name + '\"]');\n lgd_elems.forEach(function (lgd_elem) {\n lgd_elem.setAttribute('layer_name', new_name);\n lgd_elem.classList.remove('lgdf_' + old_id);\n lgd_elem.classList.add('lgdf_' + new_id);\n });\n if (Object.getOwnPropertyNames(data_manager.result_data).indexOf(old_name) > -1) {\n data_manager.result_data[new_name] = [].concat(data_manager.result_data[old_name]);\n delete data_manager.result_data[old_name];\n }\n if (Object.getOwnPropertyNames(data_manager.user_data).indexOf(old_name) > -1) {\n data_manager.user_data[new_name] = [].concat(data_manager.user_data[old_name]);\n delete data_manager.user_data[old_name];\n }\n if (data_manager.current_layers[new_name].targeted) {\n var name_section1 = document.getElementById('section1').querySelector('#input_geom');\n name_section1.innerHTML = name_section1.innerHTML.replace(old_name, new_name);\n if (window.fields_handler) {\n window.fields_handler.unfill();\n window.fields_handler.fill(new_name);\n }\n }\n if (_app.current_functionnality && _app.current_functionnality.name === 'smooth') {\n var mask_layers = document.querySelectorAll('select#stewart_mask > option');\n for (var i = 0; i < mask_layers.length; i++) {\n if (mask_layers[i].value === old_name) {\n mask_layers[i].value = new_name;\n mask_layers[i].innerHTML = new_name;\n }\n }\n }\n var other_layers = Object.getOwnPropertyNames(data_manager.current_layers);\n for (var _i2 = 0; _i2 < other_layers.length; _i2++) {\n if (data_manager.current_layers[other_layers[_i2]].ref_layer_name === old_name) {\n data_manager.current_layers[other_layers[_i2]].ref_layer_name = new_name;\n }\n }\n var select_export_lyr = document.getElementById('section5').querySelectorAll('#layer_to_export > option');\n for (var _i3 = 0; _i3 < select_export_lyr.length; _i3++) {\n if (select_export_lyr[_i3].value === old_name) {\n select_export_lyr[_i3].value = new_name;\n select_export_lyr[_i3].innerHTML = new_name;\n }\n }\n _app.layer_to_id.set(new_name, new_id);\n _app.id_to_layer.set(new_id, new_name);\n _app.layer_to_id.delete(old_name);\n _app.id_to_layer.delete(old_id);\n (0, _interface.binds_layers_buttons)(new_name);\n\n if (restart_info) {\n (0, _interface.displayInfoOnMove)();\n }\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/layers_style_popup.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createDropShadow = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.handle_click_layer = handle_click_layer;\nexports.make_style_box_indiv_label = make_style_box_indiv_label;\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _discretization_panel = __webpack_require__(/*! ./classification/discretization_panel */ \"./js/classification/discretization_panel.js\");\n\nvar _categorical_panel = __webpack_require__(/*! ./classification/categorical_panel */ \"./js/classification/categorical_panel.js\");\n\nvar _discrtiz_links_discont = __webpack_require__(/*! ./classification/discrtiz_links_discont */ \"./js/classification/discrtiz_links_discont.js\");\n\nvar _fonts = __webpack_require__(/*! ./fonts */ \"./js/fonts.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tables = __webpack_require__(/*! ./tables */ \"./js/tables.js\");\n\n/**\n* Function to dispatch the click on the \"open style box\" icon\n* to the actual appropriate function according to the type of the layer.\n*\n* @param {String} layer_name - The name of the layer.\n* @return {void} - Nothing is returned but the \"style box\" should open.\n*\n*/\nfunction handle_click_layer(layer_name) {\n if (data_manager.current_layers[layer_name].graticule) {\n createStyleBoxGraticule();\n } else if (data_manager.current_layers[layer_name].type === 'Line') {\n createStyleBox_Line(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer.indexOf('PropSymbol') > -1) {\n createStyleBox_ProbSymbol(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'Label') {\n createStyleBoxLabel(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TypoSymbols') {\n createStyleBoxTypoSymbols(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TwoStocksWaffle') {\n createStyleBoxWaffle(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer === 'Stewart') {\n createStyleBoxStewart(layer_name);\n } else {\n createStyleBox(layer_name);\n }\n}\n\nfunction make_single_color_menu(layer, fill_prev) {\n var symbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section'),\n g_lyr_name = '#' + _app.layer_to_id.get(layer),\n last_color = fill_prev && fill_prev.single ? fill_prev.single : '#FFF';\n var block = fill_color_section.insert('p');\n block.insert('span').html(_tr('app_page.layer_style_popup.fill_color'));\n block.insert('input').attr('type', 'color').style('float', 'right').property('value', last_color).on('change', function () {\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', this.value);\n data_manager.current_layers[layer].fill_color = { single: this.value };\n });\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', last_color);\n data_manager.current_layers[layer].fill_color = { single: last_color };\n}\n\nfunction make_random_color(layer) {\n var symbol = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'path';\n\n var block = d3.select('#fill_color_section');\n block.insert('span').attr('id', 'random_color_btn').styles({ cursor: 'pointer', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.toggle_colors')).on('click', function () {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function () {\n return (0, _colors_helpers.randomColor)();\n }); // Colors.names[Colors.random()]);\n data_manager.current_layers[layer].fill_color = { random: true };\n });\n}\n\nfunction fill_categorical(layer, field_name, symbol, color_cat_map) {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function (d) {\n return color_cat_map.get(d.properties[field_name]);\n });\n}\n\nfunction make_categorical_color_menu(fields, layer, fill_prev) {\n var symbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section').append('p');\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.categorical_field'));\n var field_selec = fill_color_section.insert('select');\n fields.forEach(function (field) {\n if (field !== 'id') field_selec.append('option').text(field).attr('value', field);\n });\n if (fill_prev.categorical && fill_prev.categorical instanceof Array) {\n (0, _helpers.setSelected)(field_selec.node(), fill_prev.categorical[0]);\n }\n field_selec.on('change', function () {\n var field_name = this.value,\n data_layer = data_manager.current_layers[layer].is_result ? data_manager.result_data[layer] : data_manager.user_data[layer],\n values = data_layer.map(function (i) {\n return i[field_name];\n }),\n cats = new Set(values),\n txt = [cats.size, ' cat.'].join('');\n d3.select('#nb_cat_txt').html(txt);\n var color_cat_map = new Map();\n Array.from(cats.keys()).forEach(function (val) {\n color_cat_map.set(val, _colors_helpers.Colors.names[_colors_helpers.Colors.random()]);\n });\n data_manager.current_layers[layer].fill_color = { categorical: [field_name, color_cat_map] };\n fill_categorical(layer, field_name, symbol, color_cat_map);\n });\n\n if ((!fill_prev || !fill_prev.categorical) && field_selec.node().options.length > 0) {\n (0, _helpers.setSelected)(field_selec.node(), field_selec.node().options[0].value);\n }\n fill_color_section.append('span').attr('id', 'nb_cat_txt').html('');\n}\n\n/**\n* Function to create the input section allowing to change the name of a layer.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent - A d3 selection corresponding to the parent box.\n* @param {String} layer_name - The current name of layer edited in the style box.\n* @return {Object} - The d3 selection corresponding to the input element created.\n*/\nfunction make_change_layer_name_section(parent, layer_name) {\n var section = parent.insert('p').attr('class', 'inp_bottom');\n section.append('span').html(_tr('app_page.layer_style_popup.layer_name'));\n var inpt = section.append('input').attrs({ id: 'lyr_change_name', type: 'text' }).styles({ width: '200px', float: 'left' });\n inpt.node().value = layer_name;\n return inpt;\n}\n\nfunction createStyleBoxTypoSymbols(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n display: features[i].style.display ? features[i].style.display : null,\n size: features[i].getAttribute('width'),\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')]\n });\n }\n prev_settings_defaults.size = data_manager.current_layers[layer_name].default_size;\n }\n\n var restore_prev_settings = function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].setAttribute('width', prev_settings[i].size);\n features[i].setAttribute('height', prev_settings[i].size);\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.display = prev_settings[i].display;\n }\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n };\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('image'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbols_map = data_manager.current_layers[layer_name].symbols_map,\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n var prev_settings = [],\n prev_settings_defaults = {};\n // const zs = d3.zoomTransform(svg_map).k;\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry),\n size_symbol = symbols_map.get(d.properties.symbol_field)[1] / 2;\n return { x: centroid[0] - size_symbol, y: centroid[1] - size_symbol };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_symbols')).on('click', function () {\n selection.style('display', undefined);\n });\n\n var size_section = popup.append('p');\n size_section.append('span').html(_tr('app_page.layer_style_popup.symbols_size'));\n size_section.append('input').attrs({ min: 0, max: 200, step: 'any', type: 'number' }).styles({ width: '60px', margin: 'auto' }).property('value', 32).on('change', function () {\n var value = this.value;\n selection.transition().attrs(function () {\n var current_size = this.height.baseVal.value;\n return {\n width: value + 'px',\n height: value + 'px',\n x: this.x.baseVal.value + current_size / 2 - value / 2,\n y: this.y.baseVal.value + current_size / 2 - value / 2\n };\n });\n });\n}\n// popup.append(\"p\").style(\"text-align\", \"center\")\n// .insert(\"button\")\n// .attr(\"id\",\"modif_symb\")\n// .attr(\"class\", \"button_st4\")\n// .text(_tr(\"app_page.layer_style_popup.modify_symbols\"))\n// .on(\"click\", function(){\n// display_box_symbol_typo(ref_layer_name, rendered_field)().then(function(confirmed){\n// if(confirmed){\n// rendering_params = {\n// nb_cat: confirmed[0],\n// symbols_map: confirmed[1],\n// field: rendered_field\n// };\n// map.select(\"#\" + layer_name)\n// .selectAll(\"image\")\n// .attr(\"x\",\n// d => d.coords[0] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"y\",\n// d => d.coords[1] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"width\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"height\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"xlink:href\",\n// (d, i) => rendering_params.symbols_map.get(d.Symbol_field)[0]);\n// }\n// });\n// });\n\nfunction createStyleBoxLabel(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n prev_settings = [];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n color: features[i].style.fill,\n size: features[i].style.fontSize,\n display: features[i].style.display ? features[i].style.display : null,\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')],\n font: features[i].style.fontFamily\n });\n }\n prev_settings_defaults = {\n color: data_manager.current_layers[layer_name].fill_color,\n size: data_manager.current_layers[layer_name].default_size,\n font: data_manager.current_layers[layer_name].default_font\n };\n }\n\n function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].style.fill = prev_settings[i].color;\n features[i].style.fontSize = prev_settings[i].size;\n features[i].style.display = prev_settings[i].display;\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.fontFamily = prev_settings[i].font;\n }\n\n data_manager.current_layers[layer_name].fill_color = prev_settings_defaults.color;\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n data_manager.current_layers[layer_name].default_font = prev_settings_defaults.font;\n }\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('text'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name;\n // const rendering_params = {};\n var prev_settings_defaults = {};\n var prev_settings = [];\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else {\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_labels_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var coords = path.centroid(d.geometry);\n return { x: coords[0], y: coords[1] };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_labels')).on('click', function () {\n selection.style('display', undefined);\n });\n\n popup.insert('p').styles({ 'text-align': 'center', 'font-size': '9px' }).html(_tr('app_page.layer_style_popup.overrride_warning'));\n var label_sizes = popup.append('p').attr('class', 'line_elem');\n label_sizes.append('span').html(_tr('app_page.layer_style_popup.labels_default_size'));\n label_sizes.insert('span').style('float', 'right').html(' px');\n label_sizes.insert('input').attr('type', 'number').styles({ float: 'right', width: '70px' }).property('value', +data_manager.current_layers[layer_name].default_size.replace('px', '')).on('change', function () {\n var size = this.value + 'px';\n data_manager.current_layers[layer_name].default_size = size;\n selection.style('font-size', size);\n });\n\n var default_color = popup.insert('p').attr('class', 'line_elem');\n default_color.append('span').html(_tr('app_page.layer_style_popup.labels_default_color'));\n default_color.insert('input').attr('type', 'color').style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color).on('change', function () {\n data_manager.current_layers[layer_name].fill_color = this.value;\n selection.transition().style('fill', this.value);\n });\n\n var font_section = popup.insert('p').attr('class', 'line_elem');\n font_section.append('span').html(_tr('app_page.layer_style_popup.labels_default_font'));\n var choice_font = font_section.insert('select').style('float', 'right').on('change', function () {\n data_manager.current_layers[layer_name].default_font = this.value;\n selection.transition().style('font-family', this.value);\n });\n\n _fonts.available_fonts.forEach(function (name) {\n choice_font.append('option').attr('value', name[1]).text(name[0]);\n });\n choice_font.node().value = data_manager.current_layers[layer_name].default_font;\n}\n\nfunction createStyleBoxGraticule(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var current_params = (0, _helpers.cloneObj)(data_manager.current_layers.Graticule);\n var selection = map.select('#L_Graticule > path');\n var selection_strokeW = map.select('#L_Graticule');\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n return null;\n } else {\n return null;\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n // let new_layer_name = layer_name;\n // const new_name_section = make_change_layer_name_section(popup, layer_name);\n // new_name_section.on('change', function() {\n // new_layer_name = this.value;\n // });\n\n var color_choice = popup.append('p').attr('class', 'line_elem');\n color_choice.append('span').html(_tr('app_page.layer_style_popup.color'));\n color_choice.append('input').attr('type', 'color').style('float', 'right').property('value', current_params.fill_color.single).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers.Graticule.fill_color.single = this.value;\n });\n\n var opacity_choice = popup.append('p').attr('class', 'line_elem');\n opacity_choice.append('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_choice.append('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', current_params.opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n data_manager.current_layers.Graticule.opacity = +this.value;\n popup.select('#graticule_opacity_txt').html(+this.value * 100 + '%');\n });\n opacity_choice.append('span').attr('id', 'graticule_opacity_txt').style('float', 'right').html(current_params.opacity * 100 + '%');\n\n var stroke_width_choice = popup.append('p').attr('class', 'line_elem');\n stroke_width_choice.append('span').html(_tr('app_page.layer_style_popup.width'));\n stroke_width_choice.append('input').attr('type', 'number').styles({ width: '60px', float: 'right' }).property('value', current_params['stroke-width-const']).on('change', function () {\n selection_strokeW.style('stroke-width', this.value);\n data_manager.current_layers.Graticule['stroke-width-const'] = +this.value;\n });\n\n var steps_choice = popup.append('p').attr('class', 'line_elem');\n steps_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_steps'));\n steps_choice.append('input').attrs({ id: 'graticule_range_steps', type: 'range', min: 0, max: 100, step: 1 }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.step).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling;\n var step_val = +this.value;\n var dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n data_manager.current_layers.Graticule.step = step_val;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n if (data_manager.current_layers.Graticule.extent) {\n graticule = graticule.extent(data_manager.current_layers.Graticule.extent);\n }\n map.select('#L_Graticule').remove();\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n popup.select('#graticule_step_txt').property('value', step_val);\n });\n steps_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_step_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.step).on('change', function () {\n var grat_range = document.getElementById('graticule_range_steps');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n var dasharray_choice = popup.append('p').attr('class', 'line_elem');\n dasharray_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_dasharray'));\n dasharray_choice.append('input').attrs({ type: 'range', min: 0, max: 50, step: 0.1, id: 'graticule_range_dasharray' }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n selection.style('stroke-dasharray', this.value);\n data_manager.current_layers.Graticule.dasharray = +this.value;\n popup.select('#graticule_dasharray_txt').property('value', this.value);\n });\n dasharray_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_dasharray_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n var grat_range = document.getElementById('graticule_range_dasharray');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n // Only append this section if there is currently a target layer :\n if (Object.keys(data_manager.user_data).length) {\n var clip_extent_section = popup.append('p').attr('class', 'line_elem');\n clip_extent_section.append('input').attrs({ type: 'checkbox', id: 'clip_graticule' }).property('checked', current_params.extent ? true : null).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling,\n step_val = +document.getElementById('graticule_step_txt').value,\n dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n map.select('#L_Graticule').remove();\n if (this.checked) {\n var bbox_layer = _target_layer_file.bbox;\n var extent_grat = [[Math.round((bbox_layer[0] - 12) / 10) * 10, Math.round((bbox_layer[1] - 12) / 10) * 10], [Math.round((bbox_layer[2] + 12) / 10) * 10, Math.round((bbox_layer[3] + 12) / 10) * 10]];\n\n if (extent_grat[0] < -180) extent_grat[0] = -180;\n if (extent_grat[1] < -90) extent_grat[1] = -90;\n if (extent_grat[2] > 180) extent_grat[2] = 180;\n if (extent_grat[3] > 90) extent_grat[3] = 90;\n graticule = graticule.extent(extent_grat);\n data_manager.current_layers.Graticule.extent = extent_grat;\n } else {\n data_manager.current_layers.Graticule.extent = undefined;\n }\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n });\n clip_extent_section.append('label').attrs({ for: 'clip_graticule' }).html(_tr('app_page.layer_style_popup.graticule_clip'));\n }\n\n // Allow to create label for each line of the graticule\n make_generate_labels_graticule_section(popup);\n}\n\n/**\n* Function triggered to redraw the legend after changing some properties on a layer.\n*\n* @param {String} type_legend - The type of the legend to redraw.\n* @param {String} layer_name - The name of the layer concerned.\n* @param {String} field - The name of the rendered field.\n* @return {void}\n*\n*/\nfunction redraw_legend(type_legend, layer_name, field) {\n var _ref = type_legend === 'choro' ? [['#legend_root.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro] : type_legend === 'choro_horiz' ? [['#legend_root_horiz.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro_horizontal] : type_legend === 'line_class' ? [['#legend_root_lines_class.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_discont_links] : type_legend === 'line_symbol' ? [['#legend_root_lines_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_line_symbol] : type_legend === 'waffle' ? [['#legend_root_waffle.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_waffle] : type_legend === 'layout' ? [['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_layout] : undefined,\n _ref2 = _slicedToArray(_ref, 2),\n selector = _ref2[0],\n legend_func = _ref2[1];\n\n var lgd = document.querySelector(selector);\n if (lgd) {\n var transform_param = lgd.getAttribute('transform'),\n lgd_title = lgd.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = lgd.querySelector('#legendsubtitle').innerHTML,\n rounding_precision = lgd.getAttribute('rounding_precision'),\n note = lgd.querySelector('#legend_bottom_note').innerHTML,\n boxgap = lgd.getAttribute('boxgap');\n var rect_fill_value = lgd.getAttribute('visible_rect') === 'true' ? {\n color: lgd.querySelector('#under_rect').style.fill,\n opacity: lgd.querySelector('#under_rect').style.fillOpacity\n } : undefined;\n if (type_legend.indexOf('choro') > -1) {\n var no_data_txt = lgd.querySelector('#no_data_txt');\n no_data_txt = no_data_txt != null ? no_data_txt.textContent : null;\n\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, no_data_txt, note);\n } else if (type_legend === 'waffle') {\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, rect_fill_value, note);\n } else if (type_legend === 'layout') {\n lgd.remove();\n var text_value = lgd.querySelector('g.lg.legend_0 > text').innerHTML;\n legend_func(layer_name, data_manager.current_layers[layer_name].type, lgd_title, lgd_subtitle, rect_fill_value, text_value, note);\n } else {\n lgd.remove();\n legend_func(layer_name, data_manager.current_layers[layer_name].rendered_field, lgd_title, lgd_subtitle, rect_fill_value, rounding_precision, note);\n }\n lgd = document.querySelector(selector);\n if (transform_param) {\n lgd.setAttribute('transform', transform_param);\n }\n }\n}\n\nfunction createStyleBox_Line(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_random_colors = void 0;\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.stroke);\n });\n }\n\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n var prev_min_display = void 0,\n prev_size = void 0,\n prev_breaks = void 0;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n var table = [];\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].style.strokeWidth = prop_values[i];\n }\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical' && renderer !== 'PropSymbolsTypo' && renderer !== 'LinksProportional') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.breaks[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, rendering_params.field);\n } else {\n redraw_legend('choro_horiz', layer_name, rendering_params.field);\n }\n } else if ((renderer === 'Categorical' || renderer === 'PropSymbolsTypo') && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n redraw_legend('choro', layer_name, rendering_params.field);\n } else if (renderer === 'DiscLayer') {\n selection.each(function (d) {\n d.properties.prop_val = this.style.strokeWidth; // eslint-disable-line no-param-reassign\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (renderer === 'LinksGraduated') {\n selection.each(function (d, i) {\n data_manager.current_layers[layer_name].linksbyId[i][2] = this.style.strokeWidth;\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n\n if (renderer && (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional')) {\n selection.each(function (d) {\n d.properties.color = this.style.stroke; // eslint-disable-line no-param-reassign\n });\n redraw_legend('line_symbol', layer_name);\n }\n\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n\n if (data_manager.current_layers[layer_name].renderer === 'LinksGraduated' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('display', function (d) {\n return +d.properties[data_manager.current_layers[layer_name].rendered_field] > prev_min_display ? null : 'none';\n }).style('stroke-opacity', border_opacity).style('stroke-width', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][2];\n });\n } else if (data_manager.current_layers[layer_name].renderer === 'DiscLayer' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].size = prev_size;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n var lim = prev_min_display !== 0 ? prev_min_display * data_manager.current_layers[layer_name].n_features : -1;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('stroke-opacity', border_opacity).style('display', function (d, i) {\n return +i <= lim ? null : 'none';\n }).style('stroke-width', function (d) {\n return d.properties.prop_val;\n });\n } else {\n if (fill_meth === 'single') {\n selection.style('stroke', fill_prev.single).style('stroke-opacity', border_opacity);\n } else if (fill_meth === 'random') {\n selection.style('stroke-opacity', border_opacity).style('stroke', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n });\n } else if (fill_meth === 'class' && renderer === 'LinksGraduated') {\n selection.style('stroke-opacity', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][0];\n }).style('stroke', stroke_prev);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (renderer === 'Categorical' || renderer === 'PropSymbolsTypo') {\n var color_field = renderer === 'Categorical' ? data_manager.current_layers[layer_name].rendered_field : data_manager.current_layers[layer_name].rendered_field2;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a = (0, _function.prepare_categories_array)(layer_name, color_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a2 = _slicedToArray(_prepare_categories_a, 2),\n cats = _prepare_categories_a2[0],\n _ = _prepare_categories_a2[1];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, color_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: color_field,\n field: color_field\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth' || renderer === 'PropSymbolsChoro') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers[layer_name].fill_color = { single: this.value };\n // data_manager.current_layers[layer_name].fill_color.single = this.value;\n });\n }\n\n if (renderer === 'LinksGraduated') {\n prev_min_display = data_manager.current_layers[layer_name].min_display || 0;\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n var fij_field = data_manager.current_layers[layer_name].rendered_field;\n var max_val = 0;\n selection.each(function (d) {\n if (+d.properties[fij_field] > max_val) max_val = +d.properties[fij_field];\n });\n var threshold_section = popup.append('p').attr('class', 'line_elem');\n threshold_section.append('span').html(_tr('app_page.layer_style_popup.display_flow_larger'));\n // The legend will be updated in order to start on the minimum value displayed instead of\n // using the minimum value of the serie (skipping unused class if necessary)\n threshold_section.insert('input').attrs({ type: 'range', min: 0, max: max_val, step: 0.5 }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n popup.select('#larger_than').html([' ', val, ' '].join(''));\n selection.style('display', function (d) {\n return +d.properties[fij_field] > val ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n threshold_section.insert('label').attr('id', 'larger_than').style('float', 'right').html(' ' + prev_min_display + ' ');\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.modify_size_class')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, data_manager.current_layers[layer_name].rendered_field, data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n }),\n links_byId = data_manager.current_layers[layer_name].linksbyId;\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n selection.style('fill-opacity', 0).style('stroke-width', function (d, i) {\n return sizes[serie.getClass(+links_byId[i][1])];\n });\n }\n });\n });\n } else if (renderer === 'DiscLayer') {\n prev_min_display = +data_manager.current_layers[layer_name].min_display || 0;\n prev_size = data_manager.current_layers[layer_name].size.slice();\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n // const max_val = Math.max.apply(null, data_manager.result_data[layer_name].map(i => i.disc_value));\n var disc_part = popup.append('p').attr('class', 'line_elem');\n disc_part.append('span').html(_tr('app_page.layer_style_popup.discont_threshold'));\n disc_part.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n var lim = val !== 0 ? val * data_manager.current_layers[layer_name].n_features : -1;\n popup.select('#larger_than').html([' ', val * 100, ' % '].join(''));\n selection.style('display', function (d, i) {\n return i <= lim ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n disc_part.insert('label').attr('id', 'larger_than').style('float', 'right').html([' ', prev_min_display * 100, ' % '].join(''));\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, 'disc_value', data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n });\n\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n data_manager.current_layers[layer_name].size = [sizes[0], sizes[sizes.length - 1]];\n selection.style('fill-opacity', 0).style('stroke-width', function (d) {\n return sizes[serie.getClass(+d.properties.disc_value)];\n });\n }\n });\n });\n }\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n if (!renderer || !renderer.startsWith('PropSymbols') && !renderer.startsWith('Links') && renderer !== 'DiscLayer') {\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n } else if (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional') {\n var field_used = data_manager.current_layers[layer_name].rendered_field;\n var d_values = data_manager.result_data[layer_name].map(function (f) {\n return +f[field_used];\n });\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: data_manager.current_layers[layer_name].rendered_field }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({ type: 'number', id: 'max_size_range', min: 0.1, step: 'any' }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, 'line');\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], 'line');\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n }\n\n if (data_manager.current_layers[layer_name].renderer === undefined) {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBox(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var type = data_manager.current_layers[layer_name].type,\n isSphere = data_manager.current_layers[layer_name].sphere === true,\n renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n var prev_random_colors = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var table = [];\n var stroke_prev = selection.style('stroke');\n var previous_point_radius = data_manager.current_layers[layer_name].pointRadius;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n var fields_layer = !isSphere ? data_manager.current_layers[layer_name].fields_type || (0, _helpers.type_col2)(table) : [];\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // Update the object holding the properties of the layer if Yes is clicked\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (renderer === 'Categorical' && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n }\n\n if (rendering_params !== undefined && rendering_params.field !== undefined) {\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (type === 'Point' && data_manager.current_layers[layer_name].pointRadius) {\n data_manager.current_layers[layer_name].pointRadius = previous_point_radius;\n selection.attr('d', path.pointRadius(+data_manager.current_layers[layer_name].pointRadius));\n } else {\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return fill_prev.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'random') {\n selection.style('fill', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], 'path', fill_prev.categorical[1]);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n if (layer_name !== 'World') {\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n }\n\n if (type === 'Point') {\n var pt_size = popup.append('p').attr('class', 'line_elem');\n pt_size.append('span').html(_tr('app_page.layer_style_popup.point_radius'));\n pt_size.append('input').attrs({ type: 'range', min: 0, max: 80, id: 'point_radius_size' }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', previous_point_radius).on('change', function () {\n var current_pt_size = +this.value;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n document.getElementById('point_radius_size_txt').value = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n });\n pt_size.append('input').attrs({\n type: 'number',\n min: 0,\n max: 80,\n step: 'any',\n class: 'without_spinner',\n id: 'point_radius_size_txt'\n }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', +previous_point_radius).on('change', function () {\n var pt_size_range = document.getElementById('point_radius_size');\n var old_value = pt_size_range.value;\n if (this.value === '' || isNaN(+this.value)) {\n this.value = old_value;\n } else {\n this.value = (0, _helpers_calc.round_value)(+this.value, 2);\n var current_pt_size = this.value;\n pt_size_range.value = current_pt_size;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n }\n });\n }\n\n if (data_manager.current_layers[layer_name].colors_breaks === undefined && renderer !== 'Categorical') {\n if (data_manager.current_layers[layer_name].targeted || data_manager.current_layers[layer_name].is_result) {\n var fields = (0, _helpers.getFieldsType)('category', null, fields_layer);\n var fill_method = popup.append('p').html(_tr('app_page.layer_style_popup.fill_color')).insert('select');\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.categorical_color'), 'categorical'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('div').attrs({ id: 'fill_color_section' });\n fill_method.on('change', function () {\n d3.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev);\n } else if (this.value === 'categorical') {\n make_categorical_color_menu(fields, layer_name, fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n } else {\n popup.append('div').attrs({ id: 'fill_color_section' });\n make_single_color_menu(layer_name, fill_prev);\n }\n } else if (renderer === 'Categorical') {\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n container.modal.hide();\n\n var _prepare_categories_a3 = (0, _function.prepare_categories_array)(layer_name, rendered_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a4 = _slicedToArray(_prepare_categories_a3, 1),\n cats = _prepare_categories_a4[0];\n\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, rendered_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: rendered_field,\n field: rendered_field\n };\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Gridded') {\n var field_to_discretize = data_manager.current_layers[layer_name].rendered_field;\n popup.append('p').style('margin', 'auto').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_to_discretize, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'Choropleth',\n field: field_to_discretize,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n }\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n\n if (data_manager.current_layers[layer_name].renderer === undefined || data_manager.current_layers[layer_name].renderer === 'Carto_doug' || data_manager.current_layers[layer_name].renderer === 'OlsonCarto') {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBoxStewart(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var nb_ft = data_manager.current_layers[layer_name].n_features;\n var prev_palette = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].color_palette);\n\n var recolor_stewart = function recolor_stewart(coloramp_name, reversed) {\n var new_coloramp = (0, _colors_helpers.getColorBrewerArray)(nb_ft, coloramp_name);\n if (reversed === false) {\n new_coloramp.reverse();\n }\n for (var i = 0; i < nb_ft; ++i) {\n rendering_params.breaks[i][1] = new_coloramp[i];\n }\n selection.transition().style('fill', function (d, i) {\n return new_coloramp[i];\n });\n data_manager.current_layers[layer_name].color_palette = { name: coloramp_name, reversed: reversed };\n };\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var rendering_params = { breaks: [].concat(data_manager.current_layers[layer_name].colors_breaks) };\n var prev_col_breaks = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n data_manager.current_layers[layer_name].colors_breaks = rendering_params.breaks;\n data_manager.current_layers[layer_name].fill_color.class = rendering_params.breaks.map(function (obj) {\n return obj[1];\n });\n // Redraw the legend if necessary:\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n // const fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n recolor_stewart(prev_palette.name, prev_palette.reversed);\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n var color_palette_section = popup.insert('p').attr('class', 'line_elem');\n color_palette_section.append('span').html(_tr('app_page.layer_style_popup.color_palette'));\n var seq_color_select = color_palette_section.insert('select').attr('id', 'coloramp_params').style('float', 'right').on('change', function () {\n recolor_stewart(this.value, false);\n });\n\n ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'].forEach(function (name) {\n seq_color_select.append('option').text(name).attr('value', name);\n });\n seq_color_select.node().value = prev_palette.name;\n popup.insert('p').attr('class', 'line_elem').styles({ 'text-align': 'center', margin: '0 !important' }).insert('button').attrs({ class: 'button_st3', id: 'reverse_colramp' }).html(_tr('app_page.layer_style_popup.reverse_palette')).on('click', function () {\n var pal_name = document.getElementById('coloramp_params').value;\n recolor_stewart(pal_name, true);\n });\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', 'border_opacity').on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction make_generate_labels_graticule_section(parent_node) {\n var labels_section = parent_node.append('p');\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n (0, _function.render_label_graticule)('Graticule', {\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', 'Graticule'].join('_')\n });\n });\n}\n\n/**\n* Create the section allowing to generate labels on a parent style box.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent_node - The d3 selection corresponding the parent style box.\n* @param {String} layer_name - The name of the layer currently edited in the style box.\n* @return {void}\n*\n*/\nfunction make_generate_labels_section(parent_node, layer_name) {\n var _fields = get_fields_name(layer_name) || [];\n // const table = make_table(layer_name);\n var fields_num = (0, _helpers.type_col2)((0, _tables.make_table)(layer_name)).filter(function (a) {\n return a.type === 'ratio' || a.type === 'stock';\n }).map(function (a) {\n return a.name;\n });\n if (_fields && _fields.length > 0) {\n var labels_section = parent_node.append('p');\n var input_fields = {};\n for (var i = 0; i < _fields.length; i++) {\n input_fields[_fields[i]] = _fields[i];\n }\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n swal({\n title: '',\n html: '
\\n

' + _tr('app_page.layer_style_popup.field_label') + '

\\n\\n
\\n
',\n type: 'question',\n customClass: 'swal2_custom',\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm'),\n inputOptions: input_fields,\n onOpen: function onOpen() {\n var sel = d3.select('#label_box_field');\n _fields.forEach(function (f_name) {\n sel.append('option').property('value', f_name).text(f_name);\n });\n if (fields_num.length > 0) {\n var section_filter = d3.select('#label_box_filter_section');\n section_filter.append('input').attrs({ type: 'checkbox', id: 'label_box_filter_chk' }).on('change', function () {\n if (this.checked) {\n subsection_filter_label.style('display', null);\n } else {\n subsection_filter_label.style('display', 'none');\n }\n });\n section_filter.append('label').attr('for', 'label_box_filter_chk').html(_tr('app_page.layer_style_popup.filter_label'));\n var subsection_filter_label = section_filter.append('div').style('display', 'none');\n var sel2 = subsection_filter_label.append('select').attr('id', 'label_box_filter_field');\n fields_num.forEach(function (f_name) {\n sel2.append('option').property('value', f_name).text(f_name);\n });\n var sel3 = subsection_filter_label.append('select').attr('id', 'label_box_filter_type');\n sel3.append('option').property('value', 'sup').text('>');\n sel3.append('option').property('value', 'inf').text('<');\n subsection_filter_label.append('input').attrs({ type: 'number', id: 'label_box_filter_value' });\n }\n },\n preConfirm: function preConfirm() {\n return new Promise(function (resolve, reject) {\n setTimeout(function () {\n var selected_field = document.getElementById('label_box_field').value;\n var filter_options = undefined;\n if (fields_num.length > 0) {\n var to_filter = document.getElementById('label_box_filter_chk').checked;\n if (to_filter) {\n var filter_value = document.getElementById('label_box_filter_value').value;\n if (!filter_value || isNaN(filter_value)) {\n reject(_tr('app_page.common.incorrect_value'));\n return;\n }\n filter_options = {\n field: document.getElementById('label_box_filter_field').value,\n type_filter: document.getElementById('label_box_filter_type').value,\n filter_value: filter_value\n };\n }\n }\n if (_fields.indexOf(selected_field) < 0) {\n reject(_tr('app_page.common.no_value'));\n } else {\n resolve();\n (0, _function.render_label)(layer_name, {\n label_field: selected_field,\n filter_options: filter_options,\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', selected_field, layer_name].join('_')\n });\n }\n }, 50);\n });\n }\n }).then(function () {\n //console.log(value);\n }, function () {\n //console.log(dismiss);\n });\n });\n }\n}\n\n/**\n* Return the name of the fields/columns\n* (ie. the members of the `properties` Object for each feature on a layer)\n*\n* @param {String} layer_name - The name of the layer.\n* @return {Array} - An array of Strings, one for each field name.\n*\n*/\nfunction get_fields_name(layer_name) {\n var elem = document.getElementById(_app.layer_to_id.get(layer_name)).childNodes[0];\n if (!elem.__data__ || !elem.__data__.properties) {\n return null;\n }\n return Object.getOwnPropertyNames(elem.__data__.properties);\n}\n\nfunction createStyleBoxWaffle(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var round = Math.round;\n var floor = Math.floor;\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbol = data_manager.current_layers[layer_name].symbol,\n fields = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name);\n\n var previous_params = {\n fill_opacity: selection.selectAll(symbol).style('fill-opacity'),\n ref_colors: [].concat(data_manager.current_layers[layer_name].fill_color),\n size: data_manager.current_layers[layer_name].size,\n nCol: data_manager.current_layers[layer_name].nCol\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n redraw_legend('waffle', layer_name, fields);\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n data_manager.current_layers[layer_name].fill_color = previous_params.ref_colors;\n data_manager.current_layers[layer_name].size = previous_params.size;\n selection.selectAll(symbol).style('fill-opacity', previous_params.fill_opacity);\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: fields.join(' ,') }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem').attr('id', 'fill_color_section');\n\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.fill_opacity).on('change', function () {\n selection.selectAll(symbol).style('fill-opacity', +this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opacity_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+previous_params.fill_opacity * 100 + '%');\n\n var ref_colors_section = popup.append('div').attr('id', 'ref_colors_section').style('clear', 'both');\n ref_colors_section.append('p').html(_tr('app_page.layer_style_popup.ref_colors'));\n\n var _loop = function _loop(i) {\n var p = ref_colors_section.append('p').style('margin', '15px 5px');\n p.append('span').html(data_manager.current_layers[layer_name].rendered_field[i]);\n p.insert('input').attrs({ id: i, type: 'color' }).style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color[i]).on('change', function () {\n // eslint-disable-line no-loop-func\n var col = (0, _colors_helpers.rgb2hex)(this.value);\n var to_replace = data_manager.current_layers[layer_name].fill_color[i];\n data_manager.current_layers[layer_name].fill_color[i] = col;\n selection.selectAll(symbol).each(function () {\n if ((0, _colors_helpers.rgb2hex)(this.getAttribute('fill')) === to_replace) {\n this.setAttribute('fill', col);\n }\n });\n });\n };\n\n for (var i = 0; i < data_manager.current_layers[layer_name].fill_color.length; i++) {\n _loop(i);\n }\n\n var size_section = popup.append('p').attr('class', 'line_elem').attr('id', 'size_section').style('clear', 'both');\n\n size_section.append('span').html(_tr('app_page.layer_style_popup.ref_size'));\n size_section.insert('input').attrs({ type: 'range', min: 1, max: 40, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.size).on('change', function () {\n var val = +this.value;\n var nCol = data_manager.current_layers[layer_name].nCol;\n data_manager.current_layers[layer_name].size = val;\n selection.selectAll('g').selectAll(symbol).each(function (_, i) {\n if (symbol === 'circle') {\n var t_x = round(i % nCol * 2 * val);\n var t_y = floor(floor(i / nCol) * 2 * val);\n this.setAttribute('r', val);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = val / 5;\n var _t_x = round(i % nCol * val) + offset * round(i % nCol);\n var _t_y = floor(floor(i / nCol) * val) + offset * floor(i / nCol);\n this.setAttribute('width', val);\n this.setAttribute('height', val);\n this.setAttribute('transform', 'translate(-' + _t_x + ', -' + _t_y + ')');\n }\n });\n size_section.select('#size_section_txt').html(this.value + ' px');\n });\n size_section.append('span').attr('id', 'size_section_txt').style('float', 'right').html(previous_params.size + ' px');\n\n var width_row_section = popup.append('p').attr('class', 'line_elem').attr('id', 'width_row_section');\n\n width_row_section.append('span').html(_tr('app_page.func_options.twostocks.waffle_width_rows'));\n width_row_section.insert('input').attrs({ type: 'range', min: 1, max: 10, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.nCol).on('change', function () {\n var val = +this.value;\n var size = data_manager.current_layers[layer_name].size;\n data_manager.current_layers[layer_name].nCol = val;\n selection.selectAll('g').selectAll(symbol).each(function (d, i) {\n if (symbol === 'circle') {\n var t_x = round(i % val * 2 * size);\n var t_y = floor(floor(i / val) * 2 * size);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = size / 5;\n var _t_x2 = round(i % val * size) + offset * round(i % val);\n var _t_y2 = floor(floor(i / val) * size) + offset * floor(i / val);\n this.setAttribute('transform', 'translate(-' + _t_x2 + ', -' + _t_y2 + ')');\n }\n });\n width_row_section.select('#width_row_text').html(this.value);\n });\n width_row_section.append('span').attr('id', 'width_row_text').style('float', 'right').html(previous_params.nCol);\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol' });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n}\n\nfunction createStyleBox_ProbSymbol(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n type_method = data_manager.current_layers[layer_name].renderer,\n type_symbol = data_manager.current_layers[layer_name].symbol,\n field_used = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name).selectAll(type_symbol),\n old_size = [data_manager.current_layers[layer_name].size[0], data_manager.current_layers[layer_name].size[1]];\n var rendering_params = void 0;\n var stroke_prev = selection.style('stroke');\n var stroke_width = selection.style('stroke-width');\n var prev_random_colors = void 0;\n\n var opacity = selection.style('fill-opacity'),\n border_opacity = selection.style('stroke-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var d_values = data_manager.result_data[layer_name].map(function (v) {\n return +v[field_used];\n });\n var prev_col_breaks = void 0;\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n\n if (type_symbol === 'circle') {\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].setAttribute('r', prop_values[i]);\n }\n } else if (type_symbol === 'rect') {\n for (var _i = 0, _len = prop_values.length; _i < _len; _i++) {\n var old_rect_size = +selec[_i].getAttribute('height');\n var centr = [+selec[_i].getAttribute('x') + old_rect_size / 2 - prop_values[_i] / 2, +selec[_i].getAttribute('y') + old_rect_size / 2 - prop_values[_i] / 2];\n selec[_i].setAttribute('x', centr[0]);\n selec[_i].setAttribute('y', centr[1]);\n selec[_i].setAttribute('height', prop_values[_i]);\n selec[_i].setAttribute('width', prop_values[_i]);\n }\n }\n };\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = [].concat(data_manager.current_layers[layer_name].colors_breaks);\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n prev_col_breaks = data_manager.current_layers[layer_name].break_val;\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n if (stroke_prev.startsWith('rgb')) stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n if (stroke_width.endsWith('px')) stroke_width = stroke_width.substring(0, stroke_width.length - 2);\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // if(data_manager.current_layers[layer_name].size != old_size){\n var lgd_prop_symb = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n if (lgd_prop_symb) {\n (0, _map_ctrl.redraw_legends_symbols)(lgd_prop_symb);\n }\n if (type_symbol === 'circle') {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('r'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n } else {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('height'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n }\n\n if ((type_method === 'PropSymbolsChoro' || type_method === 'PropSymbolsTypo') && rendering_params !== undefined) {\n if (type_method === 'PropSymbolsChoro') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n data_manager.current_layers[layer_name].colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (type_method === 'PropSymbolsTypo') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n }\n data_manager.current_layers[layer_name].rendered_field2 = rendering_params.field;\n // Also change the legend if there is one displayed :\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n }\n // if(selection._groups[0][0].__data__.properties.color && rendering_params !== undefined){\n // selection.each((d,i) => {\n // d.properties.color = rendering_params.colorsByFeature[i];\n // });\n // }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n selection.style('fill-opacity', opacity);\n map.select(g_lyr_name).style('stroke-width', stroke_width);\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'two') {\n data_manager.current_layers[layer_name].break_val = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = { two: [fill_prev.two[0], fill_prev.two[1]] };\n selection.style('fill', function (d, i) {\n return d_values[i] > prev_col_breaks ? fill_prev.two[1] : fill_prev.two[0];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return data_manager.current_layers[layer_name].fill_color.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n } else if (fill_meth === 'random') {\n selection.style('fill', function (_, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], type_symbol, fill_prev.categorical[1]);\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n if (data_manager.current_layers[layer_name].size[1] !== old_size[1]) {\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, old_size[0], old_size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size = [old_size[0], old_size[1]];\n }\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (type_method === 'PropSymbolsChoro') {\n var field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.field_symbol_color', { field: field_color })).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_color, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'PropSymbolsChoro',\n field: field_color,\n extra_options: confirmed[7]\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n var fill_color_section = popup.append('div').attr('id', 'fill_color_section');\n fill_color_section.append('p').style('text-align', 'center').html(_tr('app_page.layer_style_popup.color_break'));\n var p2 = fill_color_section.append('p').style('display', 'inline');\n var col1 = p2.insert('input').attrs({ id: 'col1', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[0]).on('change', function () {\n var _this = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[0] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : _this.value;\n });\n });\n var col2 = p2.insert('input').attrs({ id: 'col2', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[1]).on('change', function () {\n var _this2 = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[1] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? _this2.value : col1.node().value;\n });\n });\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.break_value'));\n var b_val = fill_color_section.insert('input').attr('type', 'number').style('width', '75px').property('value', data_manager.current_layers[layer_name].break_val).on('change', function () {\n var new_break_val = +this.value;\n data_manager.current_layers[layer_name].break_val = new_break_val;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : col1.node().value;\n });\n });\n } else if (type_method === 'PropSymbolsTypo') {\n var _field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').style('margin', 'auto').html(_tr('app_page.layer_style_popup.field_symbol_color', { field: _field_color }));\n popup.append('p').style('text-align', 'center').insert('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a5 = (0, _function.prepare_categories_array)(layer_name, _field_color, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a6 = _slicedToArray(_prepare_categories_a5, 1),\n cats = _prepare_categories_a6[0];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, _field_color, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: _field_color,\n field: _field_color\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n // const fields_all = type_col2(data_manager.result_data[layer_name]),\n // fields = getFieldsType('category', null, fields_all);\n var fill_method = popup.append('p').html(_tr('app_page.layer_style_popup.fill_color')).insert('select');\n\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('div').attr('id', 'fill_color_section');\n fill_method.on('change', function () {\n popup.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev, type_symbol);\n map.select(g_lyr_name).selectAll(type_symbol).transition().style('fill', fill_prev.single);\n data_manager.current_layers[layer_name].fill_color = (0, _helpers.cloneObj)(fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name, type_symbol);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n }\n\n var fill_opct_section = popup.append('p').attr('class', 'line_elem');\n fill_opct_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n\n fill_opct_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opct_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opct_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+opacity * 100 + '%');\n\n var border_color_section = popup.append('p').attr('class', 'line_elem');\n border_color_section.append('span').html(_tr('app_page.layer_style_popup.border_color'));\n border_color_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.transition().style('stroke', this.value);\n });\n\n var border_opacity_section = popup.append('p');\n border_opacity_section.append('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n\n border_opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n border_opacity_section.select('#border_opacity_txt').html('' + this.value);\n });\n\n border_opacity_section.append('span').attr('id', 'border_opacity_txt').style('float', 'right').html(' ' + border_opacity);\n\n var border_width_section = popup.append('p').attr('class', 'line_elem');\n border_width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n border_width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n selection.style('stroke-width', this.value + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = +this.value;\n });\n\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: field_used }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({ type: 'number', id: 'max_size_range', min: 0.1, step: 'any' }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, type_symbol);\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol'\n });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry);\n if (type_symbol === 'circle') {\n return {\n cx: centroid[0],\n cy: centroid[1]\n };\n } else {\n return {\n x: centroid[0] - +d.properties.prop_value / 2,\n y: centroid[1] - +d.properties.prop_value / 2\n };\n }\n });\n });\n make_generate_labels_section(popup, layer_name);\n}\n\n/**\n* Function triggered when the user want to edit a single label.\n*\n* @param {Node} label_node - The HTMLElement corresponding to this label.\n* @return {void}\n*\n*/\nfunction make_style_box_indiv_label(label_node) {\n var current_options = {\n size: label_node.style.fontSize,\n content: label_node.textContent,\n font: label_node.style.fontFamily,\n color: label_node.style.fill\n };\n // const new_params = {};\n if (current_options.color.startsWith('rgb')) {\n current_options.color = (0, _colors_helpers.rgb2hex)(current_options.color);\n }\n (0, _dialogs.check_remove_existing_box)('.styleTextAnnotation');\n (0, _dialogs.make_confirm_dialog2)('styleTextAnnotation', _tr('app_page.func_options.label.title_box_indiv'), { widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n label_node.style.fontsize = current_options.size; // eslint-disable-line no-param-reassign\n label_node.textContent = current_options.content; // eslint-disable-line no-param-reassign\n label_node.style.fill = current_options.color; // eslint-disable-line no-param-reassign\n label_node.style.fontFamily = current_options.font; // eslint-disable-line no-param-reassign\n }\n });\n var box_content = d3.select('.styleTextAnnotation').select('.modal-content').style('width', '300px').select('.modal-body').insert('div');\n var a = box_content.append('p').attr('class', 'line_elem');\n a.insert('span').html(_tr('app_page.func_options.label.font_size'));\n a.append('input').attrs({ type: 'number', id: 'font_size', min: 0, max: 34, step: 'any' }).styles({ width: '70px', float: 'right' }).property('value', +label_node.style.fontSize.slice(0, -2)).on('change', function () {\n label_node.style.fontSize = this.value + 'px'; // eslint-disable-line no-param-reassign\n });\n var b = box_content.append('p').attr('class', 'line_elem');\n b.insert('span').html(_tr('app_page.func_options.label.content'));\n b.append('input').attr('id', 'label_content').styles({ width: '70px', float: 'right' }).property('value', label_node.textContent).on('keyup', function () {\n label_node.textContent = this.value; // eslint-disable-line no-param-reassign\n });\n var c = box_content.append('p').attr('class', 'line_elem');\n c.insert('span').html(_tr('app_page.func_options.common.color'));\n c.append('input').attrs({ type: 'color', id: 'label_color' }).styles({ width: '70px', float: 'right' }).property('value', (0, _colors_helpers.rgb2hex)(label_node.style.fill)).on('change', function () {\n label_node.style.fill = this.value; // eslint-disable-line no-param-reassign\n });\n var d = box_content.append('p').attr('class', 'line_elem');\n d.insert('span').html(_tr('app_page.func_options.label.font_type'));\n var selec_fonts = d.append('select').style('float', 'right').on('change', function () {\n label_node.style.fontFamily = this.value; // eslint-disable-line no-param-reassign\n });\n\n _fonts.available_fonts.forEach(function (name) {\n selec_fonts.append('option').attr('value', name[1]).text(name[0]);\n });\n selec_fonts.node().value = label_node.style.fontFamily;\n}\n\n/**\n* Function creating a drop shadow on a layer.\n* Currently the properties (offset, gaussianBlur) of this shadow are hard-coded.\n*\n* @param {String} layerId - The id of the layer (ie. the \"id\" attribute, not the layer name)\n* @return {void}\n*\n*/\nvar createDropShadow = exports.createDropShadow = function createDropShadow(layerId) {\n var filt_to_use = document.createElementNS('http://www.w3.org/2000/svg', 'filter');\n filt_to_use.setAttribute('id', 'filt_' + layerId);\n // filt_to_use.setAttribute(\"x\", 0);\n // filt_to_use.setAttribute(\"y\", 0);\n filt_to_use.setAttribute('width', '200%');\n filt_to_use.setAttribute('height', '200%');\n var offset = document.createElementNS('http://www.w3.org/2000/svg', 'feOffset');\n offset.setAttributeNS(null, 'result', 'offOut');\n offset.setAttributeNS(null, 'in', 'SourceAlpha');\n offset.setAttributeNS(null, 'dx', '5');\n offset.setAttributeNS(null, 'dy', '5');\n var gaussian_blur = document.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur');\n gaussian_blur.setAttributeNS(null, 'result', 'blurOut');\n gaussian_blur.setAttributeNS(null, 'in', 'offOut');\n gaussian_blur.setAttributeNS(null, 'stdDeviation', 10);\n var blend = document.createElementNS('http://www.w3.org/2000/svg', 'feBlend');\n blend.setAttributeNS(null, 'in', 'SourceGraphic');\n blend.setAttributeNS(null, 'in2', 'blurOut');\n blend.setAttributeNS(null, 'mode', 'normal');\n filt_to_use.appendChild(offset);\n filt_to_use.appendChild(gaussian_blur);\n filt_to_use.appendChild(blend);\n defs.node().appendChild(filt_to_use);\n svg_map.querySelector('#' + layerId).setAttribute('filter', 'url(#filt_' + layerId + ')');\n};\n\n/**\n* Return the id of a gaussian blur filter with the desired size (stdDeviation attribute)\n* if one with the same param already exists, its id is returned,\n* otherwise a new one is created, and its id is returned\n*/\n// var getBlurFilter = (function(size){\n// var count = 0;\n// return function(size) {\n// let blur_filts = defs.node().getElementsByClassName(\"blur\");\n// let blur_filt_to_use;\n// for(let i=0; i < blur_filts.length; i++){\n// if(blur_filts[i].querySelector(\"feGaussianBlur\")\n// .getAttributeNS(null, \"stdDeviation\") === size){\n// blur_filt_to_use = blur_filts[i];\n// }\n// }\n// if(!blur_filt_to_use){\n// count = count + 1;\n// blur_filt_to_use = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"filter\");\n// blur_filt_to_use.setAttribute(\"id\",\"blurfilt\" + count);\n// blur_filt_to_use.setAttribute(\"class\", \"blur\");\n// var gaussianFilter = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"feGaussianBlur\");\n// gaussianFilter.setAttributeNS(null, \"in\", \"SourceGraphic\");\n// gaussianFilter.setAttributeNS(null, \"stdDeviation\", size);\n// blur_filt_to_use.appendChild(gaussianFilter);\n// defs.node().appendChild(blur_filt_to_use);\n// }\n// return blur_filt_to_use.id;\n// };\n// })();\n\nfunction change_layer_name(old_name, new_name) {\n // Temporarily deactivate the tooltip displaying information under the cursor:\n var restart_info = false;\n if (document.getElementById('info_features').className === 'active') {\n (0, _interface.displayInfoOnMove)();\n restart_info = true;\n }\n var old_id = global._app.layer_to_id.get(old_name);\n var new_id = encodeId(new_name);\n data_manager.current_layers[new_name] = (0, _helpers.cloneObj)(data_manager.current_layers[old_name]);\n delete data_manager.current_layers[old_name];\n var list_elem = document.querySelector('li.' + old_id);\n list_elem.classList.remove(old_id);\n list_elem.classList.add(new_id);\n list_elem.setAttribute('layer_name', new_name);\n list_elem.innerHTML = list_elem.innerHTML.replace((0, _helpers.get_display_name_on_layer_list)(old_name), (0, _helpers.get_display_name_on_layer_list)(new_name));\n var b = svg_map.querySelector('#' + old_id);\n b.id = new_id;\n var lgd_elems = document.querySelectorAll('g[layer_name=\"' + old_name + '\"]');\n lgd_elems.forEach(function (lgd_elem) {\n lgd_elem.setAttribute('layer_name', new_name);\n lgd_elem.classList.remove('lgdf_' + old_id);\n lgd_elem.classList.add('lgdf_' + new_id);\n });\n if (Object.getOwnPropertyNames(data_manager.result_data).indexOf(old_name) > -1) {\n data_manager.result_data[new_name] = [].concat(data_manager.result_data[old_name]);\n delete data_manager.result_data[old_name];\n }\n if (Object.getOwnPropertyNames(data_manager.user_data).indexOf(old_name) > -1) {\n data_manager.user_data[new_name] = [].concat(data_manager.user_data[old_name]);\n delete data_manager.user_data[old_name];\n }\n if (data_manager.current_layers[new_name].targeted) {\n var name_section1 = document.getElementById('section1').querySelector('#input_geom');\n name_section1.innerHTML = name_section1.innerHTML.replace(old_name, new_name);\n if (window.fields_handler) {\n window.fields_handler.unfill();\n window.fields_handler.fill(new_name);\n }\n }\n if (_app.current_functionnality && _app.current_functionnality.name === 'smooth') {\n var mask_layers = document.querySelectorAll('select#stewart_mask > option');\n for (var i = 0; i < mask_layers.length; i++) {\n if (mask_layers[i].value === old_name) {\n mask_layers[i].value = new_name;\n mask_layers[i].innerHTML = new_name;\n }\n }\n }\n var other_layers = Object.getOwnPropertyNames(data_manager.current_layers);\n for (var _i2 = 0; _i2 < other_layers.length; _i2++) {\n if (data_manager.current_layers[other_layers[_i2]].ref_layer_name === old_name) {\n data_manager.current_layers[other_layers[_i2]].ref_layer_name = new_name;\n }\n }\n var select_export_lyr = document.getElementById('section5').querySelectorAll('#layer_to_export > option');\n for (var _i3 = 0; _i3 < select_export_lyr.length; _i3++) {\n if (select_export_lyr[_i3].value === old_name) {\n select_export_lyr[_i3].value = new_name;\n select_export_lyr[_i3].innerHTML = new_name;\n }\n }\n _app.layer_to_id.set(new_name, new_id);\n _app.id_to_layer.set(new_id, new_name);\n _app.layer_to_id.delete(old_name);\n _app.id_to_layer.delete(old_id);\n (0, _interface.binds_layers_buttons)(new_name);\n\n if (restart_info) {\n (0, _interface.displayInfoOnMove)();\n }\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/layers_style_popup.js?"); /***/ }), @@ -478,7 +478,7 @@ eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(e /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _i18next = __webpack_require__(/*! i18next */ \"./node_modules/i18next/dist/es/index.js\");\n\nvar _i18next2 = _interopRequireDefault(_i18next);\n\nvar _i18nextXhrBackend = __webpack_require__(/*! i18next-xhr-backend */ \"./node_modules/i18next-xhr-backend/index.js\");\n\nvar _i18nextXhrBackend2 = _interopRequireDefault(_i18nextXhrBackend);\n\nvar _locI18next = __webpack_require__(/*! loc-i18next */ \"./node_modules/loc-i18next/index.js\");\n\nvar _locI18next2 = _interopRequireDefault(_locI18next);\n\n__webpack_require__(/*! ./../css/style.css */ \"./css/style.css\");\n\n__webpack_require__(/*! ./../css/discretization.css */ \"./css/discretization.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/alertify.min.css */ \"./node_modules/alertifyjs/build/css/alertify.min.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/themes/semantic.min.css */ \"./node_modules/alertifyjs/build/css/themes/semantic.min.css\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tooltips = __webpack_require__(/*! ./tooltips */ \"./js/tooltips.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nPromise.config({\n warnings: true,\n longStackTraces: true\n});\n\n// /*\n// * Memoization functions (naive LRU implementation)\n// *\n// */\n// global.Function.prototype.memoized = function (max_size = 25) {\n// this._memo = this._memo || { values: new Map(), stack: [], max_size: max_size };\n// const key = JSON.stringify(Array.prototype.slice.call(arguments));\n// let cache_value = this._memo.values.get(key);\n// if (cache_value !== undefined) {\n// return JSON.parse(cache_value);\n// }\n// cache_value = this.apply(this, arguments);\n// this._memo.values.set(key, JSON.stringify(cache_value));\n// this._memo.stack.push(key);\n// if (this._memo.stack.length >= this._memo.max_size) {\n// const old_key = this._memo.stack.shift();\n// this._memo.values.delete(old_key);\n// }\n// return cache_value;\n// };\n//\n// global.Function.prototype.memoize = function () {\n// const fn = this;\n// return function () {\n// return fn.memoized.apply(fn, arguments);\n// };\n// };\nglobal.i18next = _i18next2.default;\nglobal._tr = function () {\n return _i18next2.default.t.apply(_i18next2.default, arguments);\n};\nglobal.encodeId = function (layer_name) {\n return layer_name !== '' ? 'L_' + layer_name.replace(/[^a-zA-Z0-9_-]/g, function (match) {\n return '_' + match[0].charCodeAt(0).toString(16) + '_';\n }) : 'L_';\n};\n// global.encodeId = function(s) {\n// if (s === '') return 'L_';\n// return `L_${s.replace(/[^a-zA-Z0-9_-]/g, match => `_${match[0].charCodeAt(0).toString(16)}_`)}`;\n// }\n\nglobal._app = {\n current_functionnality: undefined,\n current_proj_name: 'NaturalEarth2',\n custom_palettes: new Map(),\n default_symbols: [],\n existing_lang: ['en', 'es', 'fr'],\n layer_to_id: new Map([['World', encodeId('World')], ['Graticule', encodeId('Graticule')]]),\n legendRedrawTimeout: null,\n id_to_layer: new Map([[encodeId('World'), 'World'], [encodeId('Graticule'), 'Graticule']]),\n targeted_layer_added: false,\n to_cancel: undefined,\n version: \"0.8.4\"\n};\n\nglobal.proj = d3.geoNaturalEarth2().scale(1).translate([0, 0]);\nglobal.path = d3.geoPath().projection(proj).pointRadius(4);\nglobal.t = proj.translate();\nglobal.s = proj.scale();\nglobal.w = (0, _helpers_math.Mround)(window.innerWidth - 361);\nglobal.h = window.innerHeight - 55;\n\n/*\nA bunch of global variable, storing oftently reused informations :\n - data_manager.user_data[layer_name] : will be an Array of Objects containing data for each features of the targeted layer\n (+ the joined features if a join is done)\n - data_manager.result_data[layer_name] : the same but for any eventual result layers (like Stewart, gridded, etc.)\n - data_manager.joined_dataset : the joined dataset (read with d3.csv then pushed in the first slot of this array)\n - data_manager.field_join_map : an array containg mapping between index of geom layer and index of ext. dataset\n - data_manager.current_layers : the main object describing **all** the layers on the map (incunding detailed (ie. by features) styling properties if needed)\n*/\nglobal.data_manager = {\n current_layers: {},\n dataset_name: null,\n joined_dataset: [],\n field_join_map: [],\n result_data: {},\n user_data: {}\n};\n\nfunction parseQuery(search) {\n var args = search.substring(1).split('&');\n var argsParsed = {};\n var arg = void 0,\n kvp = void 0,\n key = void 0,\n value = void 0;\n for (var i = 0; i < args.length; i++) {\n arg = args[i];\n if (arg.indexOf('=') === -1) {\n argsParsed[decodeURIComponent(arg).trim()] = true;\n } else {\n kvp = arg.split('=');\n key = decodeURIComponent(kvp[0]).trim();\n value = decodeURIComponent(kvp[1]).trim();\n argsParsed[key] = decodeURIComponent(kvp[1]).trim();\n }\n }\n return argsParsed;\n}\n\nfunction loadI18next(lang) {\n return new Promise(function (resolve, reject) {\n _i18next2.default.use(_i18nextXhrBackend2.default).init({\n debug: true,\n lng: lang,\n fallbackLng: _app.existing_lang[0],\n backend: {\n loadPath: 'static/locales/{{lng}}/translation.json'\n }\n }, function (err, tr) {\n if (err) reject(err);\n resolve(tr);\n });\n });\n}\n\nfunction getEpsgProjection() {\n return (0, _helpers.xhrequest)('GET', 'static/json/epsg.json', undefined, false);\n}\n\n(function () {\n Object.assign(global, (0, _map_ctrl.makeSvgMap)());\n // const { map_div, map, svg_map, defs } = makeSvgMap();\n // global.map_div = map_div;\n // global.map = map;\n // global.svg_map = svg_map;\n // global.defs = defs;\n var lang = docCookies.getItem('user_lang') || window.navigator.language.split('-')[0];\n var params = {};\n document.querySelector('noscript').remove();\n window.isIE = function () {\n return (/MSIE/i.test(navigator.userAgent) || /Trident\\/\\d./i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)\n );\n }();\n // window.isOldMS_Firefox = (() => (/Firefox/i.test(navigator.userAgent)\n // && (/Windows NT 6.0/i.test(navigator.userAgent)\n // || /Windows NT 6.1/i.test(navigator.userAgent))) ? true : false\n // )();\n if (window.location.search) {\n var parsed_querystring = parseQuery(window.location.search);\n params.reload = parsed_querystring.reload;\n if (typeof history.replaceState !== 'undefined') {\n // replaceState should avoid creating a new entry on the history\n var obj = { Page: window.location.search, Url: window.location.pathname };\n history.replaceState(obj, obj.Page, obj.Url);\n }\n }\n\n lang = _app.existing_lang.indexOf(lang) > -1 ? lang : 'en';\n Promise.all([loadI18next(lang), getEpsgProjection()]).then(function (results) {\n var _results = _slicedToArray(results, 2),\n tr = _results[0],\n epsg_proj = _results[1];\n\n window.localize = _locI18next2.default.init(_i18next2.default);\n _app.epsg_projections = JSON.parse(epsg_proj);\n (0, _interface.setUpInterface)(params.reload);\n localize('.i18n');\n (0, _tooltips.bindTooltips)();\n });\n})();\n\n/**\n* Return the x and y position where the svg element is located\n* in the browser window.\n*\n* @return {Object} - An object with x and y properties.\n*/\nglobal.get_map_xy0 = function () {\n var bbox = svg_map.getBoundingClientRect();\n return { x: bbox.left, y: bbox.top };\n};\n\nglobal.get_bounding_rect = function (elem) {\n var _get_map_xy = get_map_xy0(),\n x = _get_map_xy.x,\n y = _get_map_xy.y;\n\n var bbox = elem.getBoundingClientRect();\n var a = {\n x: bbox.left - x,\n y: bbox.top - y,\n width: bbox.width ? bbox.width : bbox.right - bbox.left,\n height: bbox.height ? bbox.height : bbox.bottom - bbox.top\n };\n a.left = a.x;\n a.top = a.y;\n return a;\n};\n\nglobal.helper_esc_key_twbs_cb = function helper_esc_key_twbs_cb(_event, callback) {\n var evt = _event || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n if (callback) {\n callback();\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/main.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _i18next = __webpack_require__(/*! i18next */ \"./node_modules/i18next/dist/es/index.js\");\n\nvar _i18next2 = _interopRequireDefault(_i18next);\n\nvar _i18nextXhrBackend = __webpack_require__(/*! i18next-xhr-backend */ \"./node_modules/i18next-xhr-backend/index.js\");\n\nvar _i18nextXhrBackend2 = _interopRequireDefault(_i18nextXhrBackend);\n\nvar _locI18next = __webpack_require__(/*! loc-i18next */ \"./node_modules/loc-i18next/index.js\");\n\nvar _locI18next2 = _interopRequireDefault(_locI18next);\n\n__webpack_require__(/*! ./../css/style.css */ \"./css/style.css\");\n\n__webpack_require__(/*! ./../css/discretization.css */ \"./css/discretization.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/alertify.min.css */ \"./node_modules/alertifyjs/build/css/alertify.min.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/themes/semantic.min.css */ \"./node_modules/alertifyjs/build/css/themes/semantic.min.css\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tooltips = __webpack_require__(/*! ./tooltips */ \"./js/tooltips.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nPromise.config({\n warnings: true,\n longStackTraces: true\n});\n\n// /*\n// * Memoization functions (naive LRU implementation)\n// *\n// */\n// global.Function.prototype.memoized = function (max_size = 25) {\n// this._memo = this._memo || { values: new Map(), stack: [], max_size: max_size };\n// const key = JSON.stringify(Array.prototype.slice.call(arguments));\n// let cache_value = this._memo.values.get(key);\n// if (cache_value !== undefined) {\n// return JSON.parse(cache_value);\n// }\n// cache_value = this.apply(this, arguments);\n// this._memo.values.set(key, JSON.stringify(cache_value));\n// this._memo.stack.push(key);\n// if (this._memo.stack.length >= this._memo.max_size) {\n// const old_key = this._memo.stack.shift();\n// this._memo.values.delete(old_key);\n// }\n// return cache_value;\n// };\n//\n// global.Function.prototype.memoize = function () {\n// const fn = this;\n// return function () {\n// return fn.memoized.apply(fn, arguments);\n// };\n// };\nglobal.i18next = _i18next2.default;\nglobal._tr = function () {\n return _i18next2.default.t.apply(_i18next2.default, arguments);\n};\nglobal.encodeId = function (layer_name) {\n return layer_name !== '' ? 'L_' + layer_name.replace(/[^a-zA-Z0-9_-]/g, function (match) {\n return '_' + match[0].charCodeAt(0).toString(16) + '_';\n }) : 'L_';\n};\n// global.encodeId = function(s) {\n// if (s === '') return 'L_';\n// return `L_${s.replace(/[^a-zA-Z0-9_-]/g, match => `_${match[0].charCodeAt(0).toString(16)}_`)}`;\n// }\n\nglobal._app = {\n current_functionnality: undefined,\n current_proj_name: 'NaturalEarth2',\n custom_palettes: new Map(),\n default_symbols: [],\n existing_lang: ['en', 'es', 'fr'],\n layer_to_id: new Map([['World', encodeId('World')], ['Graticule', encodeId('Graticule')]]),\n legendRedrawTimeout: null,\n id_to_layer: new Map([[encodeId('World'), 'World'], [encodeId('Graticule'), 'Graticule']]),\n targeted_layer_added: false,\n to_cancel: undefined,\n version: \"0.8.5\"\n};\n\nglobal.proj = d3.geoNaturalEarth2().scale(1).translate([0, 0]);\nglobal.path = d3.geoPath().projection(proj).pointRadius(4);\nglobal.t = proj.translate();\nglobal.s = proj.scale();\nglobal.w = (0, _helpers_math.Mround)(window.innerWidth - 361);\nglobal.h = window.innerHeight - 55;\n\n/*\nA bunch of global variable, storing oftently reused informations :\n - data_manager.user_data[layer_name] : will be an Array of Objects containing data for each features of the targeted layer\n (+ the joined features if a join is done)\n - data_manager.result_data[layer_name] : the same but for any eventual result layers (like Stewart, gridded, etc.)\n - data_manager.joined_dataset : the joined dataset (read with d3.csv then pushed in the first slot of this array)\n - data_manager.field_join_map : an array containg mapping between index of geom layer and index of ext. dataset\n - data_manager.current_layers : the main object describing **all** the layers on the map (incunding detailed (ie. by features) styling properties if needed)\n*/\nglobal.data_manager = {\n current_layers: {},\n dataset_name: null,\n joined_dataset: [],\n field_join_map: [],\n result_data: {},\n user_data: {}\n};\n\nfunction parseQuery(search) {\n var args = search.substring(1).split('&');\n var argsParsed = {};\n var arg = void 0,\n kvp = void 0,\n key = void 0,\n value = void 0;\n for (var i = 0; i < args.length; i++) {\n arg = args[i];\n if (arg.indexOf('=') === -1) {\n argsParsed[decodeURIComponent(arg).trim()] = true;\n } else {\n kvp = arg.split('=');\n key = decodeURIComponent(kvp[0]).trim();\n value = decodeURIComponent(kvp[1]).trim();\n argsParsed[key] = decodeURIComponent(kvp[1]).trim();\n }\n }\n return argsParsed;\n}\n\nfunction loadI18next(lang) {\n return new Promise(function (resolve, reject) {\n _i18next2.default.use(_i18nextXhrBackend2.default).init({\n debug: true,\n lng: lang,\n fallbackLng: _app.existing_lang[0],\n backend: {\n loadPath: 'static/locales/{{lng}}/translation.json'\n }\n }, function (err, tr) {\n if (err) reject(err);\n resolve(tr);\n });\n });\n}\n\nfunction getEpsgProjection() {\n return (0, _helpers.xhrequest)('GET', 'static/json/epsg.json', undefined, false);\n}\n\n(function () {\n Object.assign(global, (0, _map_ctrl.makeSvgMap)());\n // const { map_div, map, svg_map, defs } = makeSvgMap();\n // global.map_div = map_div;\n // global.map = map;\n // global.svg_map = svg_map;\n // global.defs = defs;\n var lang = docCookies.getItem('user_lang') || window.navigator.language.split('-')[0];\n var params = {};\n document.querySelector('noscript').remove();\n window.isIE = function () {\n return (/MSIE/i.test(navigator.userAgent) || /Trident\\/\\d./i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)\n );\n }();\n // window.isOldMS_Firefox = (() => (/Firefox/i.test(navigator.userAgent)\n // && (/Windows NT 6.0/i.test(navigator.userAgent)\n // || /Windows NT 6.1/i.test(navigator.userAgent))) ? true : false\n // )();\n if (window.location.search) {\n var parsed_querystring = parseQuery(window.location.search);\n params.reload = parsed_querystring.reload;\n if (typeof history.replaceState !== 'undefined') {\n // replaceState should avoid creating a new entry on the history\n var obj = { Page: window.location.search, Url: window.location.pathname };\n history.replaceState(obj, obj.Page, obj.Url);\n }\n }\n\n lang = _app.existing_lang.indexOf(lang) > -1 ? lang : 'en';\n Promise.all([loadI18next(lang), getEpsgProjection()]).then(function (results) {\n var _results = _slicedToArray(results, 2),\n tr = _results[0],\n epsg_proj = _results[1];\n\n window.localize = _locI18next2.default.init(_i18next2.default);\n _app.epsg_projections = JSON.parse(epsg_proj);\n (0, _interface.setUpInterface)(params.reload);\n localize('.i18n');\n (0, _tooltips.bindTooltips)();\n });\n})();\n\n/**\n* Return the x and y position where the svg element is located\n* in the browser window.\n*\n* @return {Object} - An object with x and y properties.\n*/\nglobal.get_map_xy0 = function () {\n var bbox = svg_map.getBoundingClientRect();\n return { x: bbox.left, y: bbox.top };\n};\n\nglobal.get_bounding_rect = function (elem) {\n var _get_map_xy = get_map_xy0(),\n x = _get_map_xy.x,\n y = _get_map_xy.y;\n\n var bbox = elem.getBoundingClientRect();\n var a = {\n x: bbox.left - x,\n y: bbox.top - y,\n width: bbox.width ? bbox.width : bbox.right - bbox.left,\n height: bbox.height ? bbox.height : bbox.bottom - bbox.top\n };\n a.left = a.x;\n a.top = a.y;\n return a;\n};\n\nglobal.helper_esc_key_twbs_cb = function helper_esc_key_twbs_cb(_event, callback) {\n var evt = _event || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n if (callback) {\n callback();\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/main.js?"); /***/ }), @@ -490,7 +490,7 @@ eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nvar _slicedToAr /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.canvas_rotation_value = exports.zoom = undefined;\nexports.makeSvgMap = makeSvgMap;\nexports.zoom_without_redraw = zoom_without_redraw;\nexports.reproj_symbol_layer = reproj_symbol_layer;\nexports.rotate_global = rotate_global;\nexports.redraw_legends_symbols = redraw_legends_symbols;\nexports.zoomClick = zoomClick;\nexports.handle_bg_color = handle_bg_color;\nexports.canvas_mod_size = canvas_mod_size;\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _scalebar = __webpack_require__(/*! ./layout_features/scalebar */ \"./js/layout_features/scalebar.js\");\n\nvar _north_arrow = __webpack_require__(/*! ./layout_features/north_arrow */ \"./js/layout_features/north_arrow.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar zoom = exports.zoom = d3.zoom().on('zoom', zoom_without_redraw);\nvar canvas_rotation_value = exports.canvas_rotation_value = null;\n\nfunction makeSvgMap() {\n // The div containing the svg map:\n var map_div = d3.select('#map');\n map_div.selectAll('*').remove();\n\n // The 'map':\n // (so actually the `map` variable is a reference to the d3 selection\n // of the main `svg` element on which we are drawing)\n var map = map_div.styles({ width: w + 'px', height: h + 'px' }).append('svg').attrs({ id: 'svg_map', width: w, height: h }).styles({ position: 'absolute', 'background-color': 'rgba(255, 255, 255, 0)' }).on('contextmenu', function () {\n d3.event.preventDefault();\n }).call(zoom);\n\n var svg_map = map.node();\n var defs = map.append('defs');\n return {\n map_div: map_div, map: map, svg_map: svg_map, defs: defs\n };\n}\n\nfunction zoom_without_redraw() {\n var rot_val = canvas_rotation_value || '';\n var transform = void 0;\n var t_val = void 0;\n if (!d3.event || !d3.event.transform || !d3.event.sourceEvent) {\n transform = d3.zoomTransform(svg_map);\n t_val = transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n } else {\n t_val = d3.event.transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / d3.event.transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n }\n\n if (_scalebar.scaleBar.displayed) {\n _scalebar.scaleBar.update();\n }\n\n if (_app.legendRedrawTimeout) {\n clearTimeout(_app.legendRedrawTimeout);\n }\n _app.legendRedrawTimeout = setTimeout(redraw_legends_symbols, 650);\n var zoom_params = svg_map.__zoom;\n var _k = proj.scale() * zoom_params.k;\n // let zoom_k_scale = proj.scale() * zoom_params.k;\n document.getElementById('input-center-x').value = (0, _helpers_calc.round_value)(zoom_params.x, 2);\n document.getElementById('input-center-y').value = (0, _helpers_calc.round_value)(zoom_params.y, 2);\n document.getElementById('input-scale-k').value = _k > 2 || _k < -2 ? (0, _helpers_calc.round_value)(_k, 2) : (0, _helpers_calc.round_value)(_k, Math.round((0, _helpers_calc.get_nb_decimals)(_k) / 2));\n // let a = document.getElementById('form_projection'),\n // disabled_val = (zoom_k_scale > 200) && (window._target_layer_file != undefined || data_manager.result_data.length > 1)? '' : 'disabled';\n // a.querySelector('option[value=\"ConicConformalSec\"]').disabled = disabled_val;\n // a.querySelector('option[value=\"ConicConformalTangent\"]').disabled = disabled_val;\n}\n\n/**\n* Function redrawing the prop symbol / img / labels / waffles when the projection\n* changes (also taking care of redrawing point layer with appropriate 'pointRadius')\n*\n* @return {void}\n*\n*/\nfunction reproj_symbol_layer() {\n /* eslint-disable no-loop-func */\n var layers = Object.keys(data_manager.current_layers);\n var n_layers = layers.length;\n var lyr_name = void 0;\n for (var ix = 0; ix < n_layers; ix++) {\n lyr_name = layers[ix];\n if (data_manager.current_layers[lyr_name].renderer && (data_manager.current_layers[lyr_name].renderer.indexOf('PropSymbol') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('TypoSymbols') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('Label') > -1)) {\n var symbol = data_manager.current_layers[lyr_name].symbol;\n\n if (symbol === 'text') {\n // Reproject the labels :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var pt = path.centroid(d.geometry);\n return { x: pt[0], y: pt[1] };\n });\n } else if (symbol === 'image') {\n // Reproject pictograms :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var coords = path.centroid(d.geometry),\n size = +this.getAttribute('width').replace('px', '') / 2;\n return { x: coords[0] - size, y: coords[1] - size };\n });\n } else if (symbol === 'circle') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d);\n return {\n r: d.properties.prop_value,\n cx: centroid[0],\n cy: centroid[1]\n };\n });\n } else if (symbol === 'rect') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d),\n size = d.properties.prop_value;\n return {\n height: size,\n width: size,\n x: centroid[0] - size / 2,\n y: centroid[1] - size / 2\n };\n });\n }\n } else if (data_manager.current_layers[lyr_name].pointRadius !== undefined) {\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll('path').attr('d', path.pointRadius(data_manager.current_layers[lyr_name].pointRadius));\n } else if (data_manager.current_layers[lyr_name].renderer === 'TwoStocksWaffle') {\n var selection = svg_map.querySelector('#' + global._app.layer_to_id.get(lyr_name)).querySelectorAll('g');\n var nbFt = selection.length;\n if (data_manager.current_layers[lyr_name].symbol === 'circle') {\n for (var i = 0; i < nbFt; i++) {\n var centroid = path.centroid({\n type: 'Point',\n coordinates: selection[i].__data__.properties.centroid\n });\n var symbols = selection[i].querySelectorAll('circle');\n for (var j = 0, nb_symbol = symbols.length; j < nb_symbol; j++) {\n symbols[j].setAttribute('cx', centroid[0]);\n symbols[j].setAttribute('cy', centroid[1]);\n }\n }\n } else {\n for (var _i = 0; _i < nbFt; _i++) {\n var _centroid = path.centroid({\n type: 'Point',\n coordinates: selection[_i].__data__.properties.centroid\n });\n var _symbols = selection[_i].querySelectorAll('rect');\n for (var _j = 0, _nb_symbol = _symbols.length; _j < _nb_symbol; _j++) {\n _symbols[_j].setAttribute('x', _centroid[0]);\n _symbols[_j].setAttribute('y', _centroid[1]);\n }\n }\n }\n }\n }\n /* eslint-enable no-loop-func */\n}\n\nfunction rotate_global(angle) {\n exports.canvas_rotation_value = canvas_rotation_value = ['rotate(', angle, ')'].join('');\n var zoom_transform = d3.zoomTransform(svg_map);\n\n map.selectAll('g.layer').transition().duration(10).attr('transform', canvas_rotation_value + ',translate(' + [zoom_transform.x, zoom_transform.y] + '),scale(' + zoom_transform.k + ')');\n\n if (_north_arrow.northArrow.displayed) {\n var current_rotate = !isNaN(+_north_arrow.northArrow.svg_node.attr('rotate')) ? +_north_arrow.northArrow.svg_node.attr('rotate') : 0;\n _north_arrow.northArrow.svg_node.attr('transform', 'rotate(' + (+angle + current_rotate) + ',' + _north_arrow.northArrow.x_center + ', ' + _north_arrow.northArrow.y_center + ')');\n }\n zoom_without_redraw();\n}\n\nfunction redraw_legends_symbols(targeted_node) {\n var legend_nodes = targeted_node ? [targeted_node] : document.querySelectorAll('#legend_root_symbol,#legend_root_layout');\n var hide = svg_map.__zoom.k > 5 || svg_map.__zoom.k < 0.15;\n var hidden_message = false;\n\n for (var i = 0; i < legend_nodes.length; ++i) {\n var layer_id = legend_nodes[i].classList[2].split('lgdf_')[1],\n layer_name = global._app.id_to_layer.get(layer_id),\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var transform_param = legend_nodes[i].getAttribute('transform'),\n rounding_precision = legend_nodes[i].getAttribute('rounding_precision'),\n lgd_title = legend_nodes[i].querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_nodes[i].querySelector('#legendsubtitle').innerHTML,\n notes = legend_nodes[i].querySelector('#legend_bottom_note').innerHTML;\n\n var rect_fill_value = legend_nodes[i].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes[i].querySelector('#under_rect').style.fill,\n opacity: legend_nodes[i].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n var display_value = legend_nodes[i].getAttribute('display'),\n visible = legend_nodes[i].style.visibility;\n var type_lgd_layout = data_manager.current_layers[layer_name].type;\n var new_lgd = void 0;\n\n if (!rendered_field && type_lgd_layout === 'Point') {\n var text_value = legend_nodes[i].querySelector('g.lg.legend_0 > text').innerHTML;\n legend_nodes[i].remove();\n (0, _legend.createLegend_layout)(layer_name, type_lgd_layout, lgd_title, lgd_subtitle, rect_fill_value, text_value, notes);\n\n new_lgd = document.querySelector(['#legend_root_layout.lgdf_', layer_id].join(''));\n } else if (rendered_field) {\n var nested = legend_nodes[i].getAttribute('nested'),\n join_line = legend_nodes[i].getAttribute('join_line');\n\n legend_nodes[i].remove();\n (0, _legend.createLegend_symbol)(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, notes);\n new_lgd = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n } else {\n continue;\n }\n new_lgd.style.visibility = visible;\n if (transform_param) {\n new_lgd.setAttribute('transform', transform_param);\n }\n if (display_value) {\n new_lgd.setAttribute('display', display_value);\n } else if (hide && rendered_field) {\n new_lgd.setAttribute('display', 'none');\n hidden_message = true;\n }\n }\n if (hidden_message) {\n _alertifyjs2.default.notify(_tr('app_page.notification.warning_deactivation_prop_symbol_legend'), 'warning', 5);\n }\n\n // if (!targeted_node) {\n var legend_nodes_links_discont = document.querySelectorAll('#legend_root_lines_class');\n for (var _i2 = 0; _i2 < legend_nodes_links_discont.length; ++_i2) {\n var _layer_id = legend_nodes_links_discont[_i2].classList[2].split('lgdf_')[1],\n _layer_name = global._app.id_to_layer.get(_layer_id),\n _rendered_field = data_manager.current_layers[_layer_name].rendered_field,\n _display_value = legend_nodes_links_discont[_i2].getAttribute('display'),\n _visible = legend_nodes_links_discont[_i2].style.visibility;\n\n var _transform_param = legend_nodes_links_discont[_i2].getAttribute('transform'),\n _rounding_precision = legend_nodes_links_discont[_i2].getAttribute('rounding_precision'),\n _lgd_title = legend_nodes_links_discont[_i2].querySelector('#legendtitle').innerHTML,\n _lgd_subtitle = legend_nodes_links_discont[_i2].querySelector('#legendsubtitle').innerHTML,\n _notes = legend_nodes_links_discont[_i2].querySelector('#legend_bottom_note').innerHTML;\n\n var _rect_fill_value = legend_nodes_links_discont[_i2].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fill,\n opacity: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n legend_nodes_links_discont[_i2].remove();\n (0, _legend.createLegend_discont_links)(_layer_name, _rendered_field, _lgd_title, _lgd_subtitle, _rect_fill_value, _rounding_precision, _notes);\n var _new_lgd = document.querySelector(['#legend_root_lines_class.lgdf_', _layer_id].join(''));\n _new_lgd.style.visibility = _visible;\n if (_transform_param) {\n _new_lgd.setAttribute('transform', _transform_param);\n }\n if (_display_value) {\n _new_lgd.setAttribute('display', _display_value);\n }\n }\n}\n\nfunction interpolateZoom(translate, scale) {\n var transform = d3.zoomTransform(svg_map);\n return d3.transition().duration(225).tween('zoom', function () {\n var iTranslate = d3.interpolate([transform.x, transform.y], translate);\n var iScale = d3.interpolate(transform.k, scale);\n return function (t_value) {\n svg_map.__zoom.k = iScale(t_value);\n var _t = iTranslate(t_value);\n svg_map.__zoom.x = _t[0];\n svg_map.__zoom.y = _t[1];\n zoom_without_redraw();\n };\n });\n}\n\nfunction zoomClick() {\n if (map_div.select('#hand_button').classed('locked')) return;\n var direction = this.id === 'zoom_in' ? 1 : -1,\n factor = 0.1,\n center = [w / 2, h / 2],\n transform = d3.zoomTransform(svg_map),\n translate = [transform.x, transform.y],\n view = { x: translate[0], y: translate[1], k: transform.k };\n var target_zoom = 1,\n translate0 = [],\n l = [];\n d3.event.preventDefault();\n target_zoom = transform.k * (1 + factor * direction);\n translate0 = [(center[0] - view.x) / view.k, (center[1] - view.y) / view.k];\n view.k = target_zoom;\n l = [translate0[0] * view.k + view.x, translate0[1] * view.k + view.y];\n view.x += center[0] - l[0];\n view.y += center[1] - l[1];\n interpolateZoom([view.x, view.y], view.k);\n}\n\n// Change color of the background\n// (ie the parent \"svg\" element on the top of which group of elements have been added)\nfunction handle_bg_color(color) {\n map.style('background-color', color);\n}\n\n/** Function triggered by the change of map/canvas size\n* @param {Array} shape - An Array of two elements : [width, height] to use;\n* generally only used once at the time so `shape` values\n* are like [null, 750] or [800, null]\n* but also works with the 2 params together like [800, 750])\n*/\nfunction canvas_mod_size(shape) {\n if (shape[0]) {\n w = +shape[0];\n map.attr('width', w).call(zoom_without_redraw);\n map_div.style('width', w + 'px');\n if (w + 360 + 33 < window.innerWidth) {\n document.querySelector('.light-menu').style.right = '-33px';\n } else {\n document.querySelector('.light-menu').style.right = '0px';\n }\n }\n if (shape[1]) {\n h = +shape[1];\n map.attr('height', h).call(zoom_without_redraw);\n map_div.style('height', h + 'px');\n }\n (0, _legend.move_legends)();\n\n // Lets update the corresponding fields in the export section :\n var ratio = void 0;\n var format = document.getElementById('select_png_format').value;\n if (format === 'web') {\n ratio = 1;\n } else if (format === 'user_defined') {\n ratio = 118.11;\n } else {\n return;\n }\n // const zoom_params = svg_map.__zoom;\n document.getElementById('export_png_width').value = (0, _helpers_math.Mround)(w * ratio * 10) / 10;\n document.getElementById('export_png_height').value = (0, _helpers_math.Mround)(h * ratio * 10) / 10;\n document.getElementById('input-width').value = w;\n document.getElementById('input-height').value = h;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/map_ctrl.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.canvas_rotation_value = exports.zoom = undefined;\nexports.makeSvgMap = makeSvgMap;\nexports.zoom_without_redraw = zoom_without_redraw;\nexports.reproj_symbol_layer = reproj_symbol_layer;\nexports.rotate_global = rotate_global;\nexports.redraw_legends_symbols = redraw_legends_symbols;\nexports.zoomClick = zoomClick;\nexports.handle_bg_color = handle_bg_color;\nexports.canvas_mod_size = canvas_mod_size;\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _scalebar = __webpack_require__(/*! ./layout_features/scalebar */ \"./js/layout_features/scalebar.js\");\n\nvar _north_arrow = __webpack_require__(/*! ./layout_features/north_arrow */ \"./js/layout_features/north_arrow.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar zoom = exports.zoom = d3.zoom().on('zoom', zoom_without_redraw);\nvar canvas_rotation_value = exports.canvas_rotation_value = null;\n\nfunction makeSvgMap() {\n // The div containing the svg map:\n var map_div = d3.select('#map');\n map_div.selectAll('*').remove();\n\n // The 'map':\n // (so actually the `map` variable is a reference to the d3 selection\n // of the main `svg` element on which we are drawing)\n var map = map_div.styles({ width: w + 'px', height: h + 'px' }).append('svg').attrs({ id: 'svg_map', width: w, height: h }).styles({ position: 'absolute', 'background-color': 'rgba(255, 255, 255, 0)' }).on('contextmenu', function () {\n d3.event.preventDefault();\n }).call(zoom);\n\n var svg_map = map.node();\n var defs = map.append('defs');\n return {\n map_div: map_div, map: map, svg_map: svg_map, defs: defs\n };\n}\n\nfunction zoom_without_redraw() {\n var rot_val = canvas_rotation_value || '';\n var transform = void 0;\n var t_val = void 0;\n if (!d3.event || !d3.event.transform || !d3.event.sourceEvent) {\n transform = d3.zoomTransform(svg_map);\n t_val = transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n } else {\n t_val = d3.event.transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / d3.event.transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n }\n\n if (_scalebar.scaleBar.displayed) {\n _scalebar.scaleBar.update();\n }\n\n if (_app.legendRedrawTimeout) {\n clearTimeout(_app.legendRedrawTimeout);\n }\n _app.legendRedrawTimeout = setTimeout(redraw_legends_symbols, 650);\n var zoom_params = svg_map.__zoom;\n var _k = proj.scale() * zoom_params.k;\n // let zoom_k_scale = proj.scale() * zoom_params.k;\n document.getElementById('input-center-x').value = (0, _helpers_calc.round_value)(zoom_params.x, 2);\n document.getElementById('input-center-y').value = (0, _helpers_calc.round_value)(zoom_params.y, 2);\n document.getElementById('input-scale-k').value = _k > 2 || _k < -2 ? (0, _helpers_calc.round_value)(_k, 2) : (0, _helpers_calc.round_value)(_k, Math.round((0, _helpers_calc.get_nb_decimals)(_k) / 2));\n // let a = document.getElementById('form_projection'),\n // disabled_val = (zoom_k_scale > 200) && (window._target_layer_file != undefined || data_manager.result_data.length > 1)? '' : 'disabled';\n // a.querySelector('option[value=\"ConicConformalSec\"]').disabled = disabled_val;\n // a.querySelector('option[value=\"ConicConformalTangent\"]').disabled = disabled_val;\n}\n\n/**\n* Function redrawing the prop symbol / img / labels / waffles when the projection\n* changes (also taking care of redrawing point layer with appropriate 'pointRadius')\n*\n* @return {void}\n*\n*/\nfunction reproj_symbol_layer() {\n /* eslint-disable no-loop-func */\n var layers = Object.keys(data_manager.current_layers);\n var n_layers = layers.length;\n var lyr_name = void 0;\n for (var ix = 0; ix < n_layers; ix++) {\n lyr_name = layers[ix];\n if (data_manager.current_layers[lyr_name].renderer && (data_manager.current_layers[lyr_name].renderer.indexOf('PropSymbol') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('TypoSymbols') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('Label') > -1)) {\n var symbol = data_manager.current_layers[lyr_name].symbol;\n\n if (symbol === 'text') {\n // Reproject the labels :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var pt = path.centroid(d.geometry);\n return { x: pt[0], y: pt[1] };\n });\n } else if (symbol === 'image') {\n // Reproject pictograms :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var coords = path.centroid(d.geometry),\n size = +this.getAttribute('width').replace('px', '') / 2;\n return { x: coords[0] - size, y: coords[1] - size };\n });\n } else if (symbol === 'circle') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d);\n return {\n r: d.properties.prop_value,\n cx: centroid[0],\n cy: centroid[1]\n };\n });\n } else if (symbol === 'rect') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d),\n size = d.properties.prop_value;\n return {\n height: size,\n width: size,\n x: centroid[0] - size / 2,\n y: centroid[1] - size / 2\n };\n });\n }\n } else if (data_manager.current_layers[lyr_name].pointRadius !== undefined) {\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll('path').attr('d', path.pointRadius(data_manager.current_layers[lyr_name].pointRadius));\n } else if (data_manager.current_layers[lyr_name].renderer === 'TwoStocksWaffle') {\n var selection = svg_map.querySelector('#' + global._app.layer_to_id.get(lyr_name)).querySelectorAll('g');\n var nbFt = selection.length;\n if (data_manager.current_layers[lyr_name].symbol === 'circle') {\n for (var i = 0; i < nbFt; i++) {\n var centroid = path.centroid({\n type: 'Point',\n coordinates: selection[i].__data__.properties.centroid\n });\n var symbols = selection[i].querySelectorAll('circle');\n for (var j = 0, nb_symbol = symbols.length; j < nb_symbol; j++) {\n symbols[j].setAttribute('cx', centroid[0]);\n symbols[j].setAttribute('cy', centroid[1]);\n }\n }\n } else {\n for (var _i = 0; _i < nbFt; _i++) {\n var _centroid = path.centroid({\n type: 'Point',\n coordinates: selection[_i].__data__.properties.centroid\n });\n var _symbols = selection[_i].querySelectorAll('rect');\n for (var _j = 0, _nb_symbol = _symbols.length; _j < _nb_symbol; _j++) {\n _symbols[_j].setAttribute('x', _centroid[0]);\n _symbols[_j].setAttribute('y', _centroid[1]);\n }\n }\n }\n }\n }\n /* eslint-enable no-loop-func */\n}\n\nfunction rotate_global(angle) {\n exports.canvas_rotation_value = canvas_rotation_value = ['rotate(', angle, ')'].join('');\n var zoom_transform = d3.zoomTransform(svg_map);\n\n map.selectAll('g.layer').transition().duration(10).attr('transform', canvas_rotation_value + ',translate(' + [zoom_transform.x, zoom_transform.y] + '),scale(' + zoom_transform.k + ')');\n\n if (_north_arrow.northArrow.displayed) {\n var current_rotate = !isNaN(+_north_arrow.northArrow.svg_node.attr('rotate')) ? +_north_arrow.northArrow.svg_node.attr('rotate') : 0;\n _north_arrow.northArrow.svg_node.attr('transform', 'rotate(' + (+angle + current_rotate) + ',' + _north_arrow.northArrow.x_center + ', ' + _north_arrow.northArrow.y_center + ')');\n }\n zoom_without_redraw();\n}\n\nfunction redraw_legends_symbols(targeted_node) {\n var legend_nodes = targeted_node ? [targeted_node] : document.querySelectorAll('#legend_root_symbol,#legend_root_layout');\n var hide = svg_map.__zoom.k > 5 || svg_map.__zoom.k < 0.15;\n var hidden_message = false;\n\n for (var i = 0; i < legend_nodes.length; ++i) {\n var layer_id = legend_nodes[i].classList[2].split('lgdf_')[1],\n layer_name = global._app.id_to_layer.get(layer_id),\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var transform_param = legend_nodes[i].getAttribute('transform'),\n rounding_precision = legend_nodes[i].getAttribute('rounding_precision'),\n lgd_title = legend_nodes[i].querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_nodes[i].querySelector('#legendsubtitle').innerHTML,\n notes = legend_nodes[i].querySelector('#legend_bottom_note').innerHTML;\n\n var rect_fill_value = legend_nodes[i].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes[i].querySelector('#under_rect').style.fill,\n opacity: legend_nodes[i].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n var display_value = legend_nodes[i].getAttribute('display'),\n visible = legend_nodes[i].style.visibility;\n var type_lgd_layout = data_manager.current_layers[layer_name].type;\n var new_lgd = void 0;\n\n if (!rendered_field && type_lgd_layout === 'Point') {\n var text_value = legend_nodes[i].querySelector('g.lg.legend_0 > text').innerHTML;\n legend_nodes[i].remove();\n (0, _legend.createLegend_layout)(layer_name, type_lgd_layout, lgd_title, lgd_subtitle, rect_fill_value, text_value, notes);\n\n new_lgd = document.querySelector(['#legend_root_layout.lgdf_', layer_id].join(''));\n } else if (rendered_field && ['Carto_doug', 'OlsonCarto'].indexOf(data_manager.current_layers[layer_name].renderer) < 0) {\n var nested = legend_nodes[i].getAttribute('nested'),\n join_line = legend_nodes[i].getAttribute('join_line');\n\n legend_nodes[i].remove();\n (0, _legend.createLegend_symbol)(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, notes);\n new_lgd = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n } else {\n continue;\n }\n new_lgd.style.visibility = visible;\n if (transform_param) {\n new_lgd.setAttribute('transform', transform_param);\n }\n if (display_value) {\n new_lgd.setAttribute('display', display_value);\n } else if (hide && rendered_field) {\n new_lgd.setAttribute('display', 'none');\n hidden_message = true;\n }\n }\n if (hidden_message) {\n _alertifyjs2.default.notify(_tr('app_page.notification.warning_deactivation_prop_symbol_legend'), 'warning', 5);\n }\n\n // if (!targeted_node) {\n var legend_nodes_links_discont = document.querySelectorAll('#legend_root_lines_class');\n for (var _i2 = 0; _i2 < legend_nodes_links_discont.length; ++_i2) {\n var _layer_id = legend_nodes_links_discont[_i2].classList[2].split('lgdf_')[1],\n _layer_name = global._app.id_to_layer.get(_layer_id),\n _rendered_field = data_manager.current_layers[_layer_name].rendered_field,\n _display_value = legend_nodes_links_discont[_i2].getAttribute('display'),\n _visible = legend_nodes_links_discont[_i2].style.visibility;\n\n var _transform_param = legend_nodes_links_discont[_i2].getAttribute('transform'),\n _rounding_precision = legend_nodes_links_discont[_i2].getAttribute('rounding_precision'),\n _lgd_title = legend_nodes_links_discont[_i2].querySelector('#legendtitle').innerHTML,\n _lgd_subtitle = legend_nodes_links_discont[_i2].querySelector('#legendsubtitle').innerHTML,\n _notes = legend_nodes_links_discont[_i2].querySelector('#legend_bottom_note').innerHTML;\n\n var _rect_fill_value = legend_nodes_links_discont[_i2].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fill,\n opacity: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n legend_nodes_links_discont[_i2].remove();\n (0, _legend.createLegend_discont_links)(_layer_name, _rendered_field, _lgd_title, _lgd_subtitle, _rect_fill_value, _rounding_precision, _notes);\n var _new_lgd = document.querySelector(['#legend_root_lines_class.lgdf_', _layer_id].join(''));\n _new_lgd.style.visibility = _visible;\n if (_transform_param) {\n _new_lgd.setAttribute('transform', _transform_param);\n }\n if (_display_value) {\n _new_lgd.setAttribute('display', _display_value);\n }\n }\n}\n\nfunction interpolateZoom(translate, scale) {\n var transform = d3.zoomTransform(svg_map);\n return d3.transition().duration(225).tween('zoom', function () {\n var iTranslate = d3.interpolate([transform.x, transform.y], translate);\n var iScale = d3.interpolate(transform.k, scale);\n return function (t_value) {\n svg_map.__zoom.k = iScale(t_value);\n var _t = iTranslate(t_value);\n svg_map.__zoom.x = _t[0];\n svg_map.__zoom.y = _t[1];\n zoom_without_redraw();\n };\n });\n}\n\nfunction zoomClick() {\n if (map_div.select('#hand_button').classed('locked')) return;\n var direction = this.id === 'zoom_in' ? 1 : -1,\n factor = 0.1,\n center = [w / 2, h / 2],\n transform = d3.zoomTransform(svg_map),\n translate = [transform.x, transform.y],\n view = { x: translate[0], y: translate[1], k: transform.k };\n var target_zoom = 1,\n translate0 = [],\n l = [];\n d3.event.preventDefault();\n target_zoom = transform.k * (1 + factor * direction);\n translate0 = [(center[0] - view.x) / view.k, (center[1] - view.y) / view.k];\n view.k = target_zoom;\n l = [translate0[0] * view.k + view.x, translate0[1] * view.k + view.y];\n view.x += center[0] - l[0];\n view.y += center[1] - l[1];\n interpolateZoom([view.x, view.y], view.k);\n}\n\n// Change color of the background\n// (ie the parent \"svg\" element on the top of which group of elements have been added)\nfunction handle_bg_color(color) {\n map.style('background-color', color);\n}\n\n/** Function triggered by the change of map/canvas size\n* @param {Array} shape - An Array of two elements : [width, height] to use;\n* generally only used once at the time so `shape` values\n* are like [null, 750] or [800, null]\n* but also works with the 2 params together like [800, 750])\n*/\nfunction canvas_mod_size(shape) {\n if (shape[0]) {\n w = +shape[0];\n map.attr('width', w).call(zoom_without_redraw);\n map_div.style('width', w + 'px');\n if (w + 360 + 33 < window.innerWidth) {\n document.querySelector('.light-menu').style.right = '-33px';\n } else {\n document.querySelector('.light-menu').style.right = '0px';\n }\n }\n if (shape[1]) {\n h = +shape[1];\n map.attr('height', h).call(zoom_without_redraw);\n map_div.style('height', h + 'px');\n }\n (0, _legend.move_legends)();\n\n // Lets update the corresponding fields in the export section :\n var ratio = void 0;\n var format = document.getElementById('select_png_format').value;\n if (format === 'web') {\n ratio = 1;\n } else if (format === 'user_defined') {\n ratio = 118.11;\n } else {\n return;\n }\n // const zoom_params = svg_map.__zoom;\n document.getElementById('export_png_width').value = (0, _helpers_math.Mround)(w * ratio * 10) / 10;\n document.getElementById('export_png_height').value = (0, _helpers_math.Mround)(h * ratio * 10) / 10;\n document.getElementById('input-width').value = w;\n document.getElementById('input-height').value = h;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/map_ctrl.js?"); /***/ }), diff --git a/client/dist/d3-custom.min.js b/client/dist/d3-custom.min.js new file mode 100644 index 000000000..7d674b5b2 --- /dev/null +++ b/client/dist/d3-custom.min.js @@ -0,0 +1 @@ +var d3=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:true})};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=25)}([function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var adder=function(){return new Adder};function Adder(){this.reset()}Adder.prototype={constructor:Adder,reset:function(){this.s=this.t=0},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},valueOf:function(){return this.s}};var temp=new Adder;function add(adder,a,b){var x=adder.s=a+b,bv=x-a,av=x-bv;adder.t=a-av+(b-bv)}var epsilon=1e-6;var epsilon2=1e-12;var pi=Math.PI;var halfPi=pi/2;var quarterPi=pi/4;var tau=pi*2;var degrees=180/pi;var radians=pi/180;var abs=Math.abs;var atan=Math.atan;var atan2=Math.atan2;var cos=Math.cos;var ceil=Math.ceil;var exp=Math.exp;var floor=Math.floor;var log=Math.log;var pow=Math.pow;var sin=Math.sin;var math_sign=Math.sign||function(x){return x>0?1:x<0?-1:0};var sqrt=Math.sqrt;var tan=Math.tan;function acos(x){return x>1?0:x<-1?pi:Math.acos(x)}function asin(x){return x>1?halfPi:x<-1?-halfPi:Math.asin(x)}function haversin(x){return(x=sin(x/2))*x}function noop(){}function streamGeometry(geometry,stream){if(geometry&&streamGeometryType.hasOwnProperty(geometry.type)){streamGeometryType[geometry.type](geometry,stream)}}var streamObjectType={Feature:function(object,stream){streamGeometry(object.geometry,stream)},FeatureCollection:function(object,stream){var features=object.features,i=-1,n=features.length;while(++i=0?1:-1,adLambda=sdLambda*dLambda,cosPhi=cos(phi),sinPhi=sin(phi),k=area_sinPhi0*sinPhi,u=area_cosPhi0*cosPhi+k*cos(adLambda),v=k*sdLambda*sin(adLambda);areaRingSum.add(atan2(v,u));area_lambda0=lambda,area_cosPhi0=cosPhi,area_sinPhi0=sinPhi}var src_area=function(object){areaSum.reset();src_stream(object,areaStream);return areaSum*2};function cartesian_spherical(cartesian){return[atan2(cartesian[1],cartesian[0]),asin(cartesian[2])]}function cartesian_cartesian(spherical){var lambda=spherical[0],phi=spherical[1],cosPhi=cos(phi);return[cosPhi*cos(lambda),cosPhi*sin(lambda),sin(phi)]}function cartesianDot(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function cartesianCross(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function cartesianAddInPlace(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2]}function cartesianScale(vector,k){return[vector[0]*k,vector[1]*k,vector[2]*k]}function cartesianNormalizeInPlace(d){var l=sqrt(d[0]*d[0]+d[1]*d[1]+d[2]*d[2]);d[0]/=l,d[1]/=l,d[2]/=l}var bounds_lambda0,bounds_phi0,bounds_lambda1,bounds_phi1,bounds_lambda2,bounds_lambda00,bounds_phi00,bounds_p0,deltaSum=adder(),ranges,range;var boundsStream={point:boundsPoint,lineStart:boundsLineStart,lineEnd:boundsLineEnd,polygonStart:function(){boundsStream.point=boundsRingPoint;boundsStream.lineStart=boundsRingStart;boundsStream.lineEnd=boundsRingEnd;deltaSum.reset();areaStream.polygonStart()},polygonEnd:function(){areaStream.polygonEnd();boundsStream.point=boundsPoint;boundsStream.lineStart=boundsLineStart;boundsStream.lineEnd=boundsLineEnd;if(areaRingSum<0)bounds_lambda0=-(bounds_lambda1=180),bounds_phi0=-(bounds_phi1=90);else if(deltaSum>epsilon)bounds_phi1=90;else if(deltaSum<-epsilon)bounds_phi0=-90;range[0]=bounds_lambda0,range[1]=bounds_lambda1}};function boundsPoint(lambda,phi){ranges.push(range=[bounds_lambda0=lambda,bounds_lambda1=lambda]);if(phibounds_phi1)bounds_phi1=phi}function bounds_linePoint(lambda,phi){var p=cartesian_cartesian([lambda*radians,phi*radians]);if(bounds_p0){var normal=cartesianCross(bounds_p0,p),equatorial=[normal[1],-normal[0],0],inflection=cartesianCross(equatorial,normal);cartesianNormalizeInPlace(inflection);inflection=cartesian_spherical(inflection);var delta=lambda-bounds_lambda2,sign=delta>0?1:-1,lambdai=inflection[0]*degrees*sign,phii,antimeridian=abs(delta)>180;if(antimeridian^(sign*bounds_lambda2bounds_phi1)bounds_phi1=phii}else if(lambdai=(lambdai+360)%360-180,antimeridian^(sign*bounds_lambda2bounds_phi1)bounds_phi1=phi}if(antimeridian){if(lambdabounds_angle(bounds_lambda0,bounds_lambda1))bounds_lambda1=lambda}else{if(bounds_angle(lambda,bounds_lambda1)>bounds_angle(bounds_lambda0,bounds_lambda1))bounds_lambda0=lambda}}else{if(bounds_lambda1>=bounds_lambda0){if(lambdabounds_lambda1)bounds_lambda1=lambda}else{if(lambda>bounds_lambda2){if(bounds_angle(bounds_lambda0,lambda)>bounds_angle(bounds_lambda0,bounds_lambda1))bounds_lambda1=lambda}else{if(bounds_angle(lambda,bounds_lambda1)>bounds_angle(bounds_lambda0,bounds_lambda1))bounds_lambda0=lambda}}}}else{ranges.push(range=[bounds_lambda0=lambda,bounds_lambda1=lambda])}if(phibounds_phi1)bounds_phi1=phi;bounds_p0=p,bounds_lambda2=lambda}function boundsLineStart(){boundsStream.point=bounds_linePoint}function boundsLineEnd(){range[0]=bounds_lambda0,range[1]=bounds_lambda1;boundsStream.point=boundsPoint;bounds_p0=null}function boundsRingPoint(lambda,phi){if(bounds_p0){var delta=lambda-bounds_lambda2;deltaSum.add(abs(delta)>180?delta+(delta>0?360:-360):delta)}else{bounds_lambda00=lambda,bounds_phi00=phi}areaStream.point(lambda,phi);bounds_linePoint(lambda,phi)}function boundsRingStart(){areaStream.lineStart()}function boundsRingEnd(){boundsRingPoint(bounds_lambda00,bounds_phi00);areaStream.lineEnd();if(abs(deltaSum)>epsilon)bounds_lambda0=-(bounds_lambda1=180);range[0]=bounds_lambda0,range[1]=bounds_lambda1;bounds_p0=null}function bounds_angle(lambda0,lambda1){return(lambda1-=lambda0)<0?lambda1+360:lambda1}function rangeCompare(a,b){return a[0]-b[0]}function rangeContains(range,x){return range[0]<=range[1]?range[0]<=x&&x<=range[1]:xbounds_angle(a[0],a[1]))a[1]=b[1];if(bounds_angle(b[0],a[1])>bounds_angle(a[0],a[1]))a[0]=b[0]}else{merged.push(a=b)}}for(deltaMax=-Infinity,n=merged.length-1,i=0,a=merged[n];i<=n;a=b,++i){b=merged[i];if((delta=bounds_angle(a[1],b[0]))>deltaMax)deltaMax=delta,bounds_lambda0=b[0],bounds_lambda1=a[1]}}ranges=range=null;return bounds_lambda0===Infinity||bounds_phi0===Infinity?[[NaN,NaN],[NaN,NaN]]:[[bounds_lambda0,bounds_phi0],[bounds_lambda1,bounds_phi1]]};var W0,W1,centroid_X0,centroid_Y0,Z0,centroid_X1,centroid_Y1,Z1,X2,Y2,Z2,centroid_lambda00,centroid_phi00,centroid_x0,centroid_y0,z0;var centroidStream={sphere:noop,point:centroidPoint,lineStart:centroidLineStart,lineEnd:centroidLineEnd,polygonStart:function(){centroidStream.lineStart=centroidRingStart;centroidStream.lineEnd=centroidRingEnd},polygonEnd:function(){centroidStream.lineStart=centroidLineStart;centroidStream.lineEnd=centroidLineEnd}};function centroidPoint(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos(phi);centroidPointCartesian(cosPhi*cos(lambda),cosPhi*sin(lambda),sin(phi))}function centroidPointCartesian(x,y,z){++W0;centroid_X0+=(x-centroid_X0)/W0;centroid_Y0+=(y-centroid_Y0)/W0;Z0+=(z-Z0)/W0}function centroidLineStart(){centroidStream.point=centroidLinePointFirst}function centroidLinePointFirst(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos(phi);centroid_x0=cosPhi*cos(lambda);centroid_y0=cosPhi*sin(lambda);z0=sin(phi);centroidStream.point=centroidLinePoint;centroidPointCartesian(centroid_x0,centroid_y0,z0)}function centroidLinePoint(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos(phi),x=cosPhi*cos(lambda),y=cosPhi*sin(lambda),z=sin(phi),w=atan2(sqrt((w=centroid_y0*z-z0*y)*w+(w=z0*x-centroid_x0*z)*w+(w=centroid_x0*y-centroid_y0*x)*w),centroid_x0*x+centroid_y0*y+z0*z);W1+=w;centroid_X1+=w*(centroid_x0+(centroid_x0=x));centroid_Y1+=w*(centroid_y0+(centroid_y0=y));Z1+=w*(z0+(z0=z));centroidPointCartesian(centroid_x0,centroid_y0,z0)}function centroidLineEnd(){centroidStream.point=centroidPoint}function centroidRingStart(){centroidStream.point=centroidRingPointFirst}function centroidRingEnd(){centroidRingPoint(centroid_lambda00,centroid_phi00);centroidStream.point=centroidPoint}function centroidRingPointFirst(lambda,phi){centroid_lambda00=lambda,centroid_phi00=phi;lambda*=radians,phi*=radians;centroidStream.point=centroidRingPoint;var cosPhi=cos(phi);centroid_x0=cosPhi*cos(lambda);centroid_y0=cosPhi*sin(lambda);z0=sin(phi);centroidPointCartesian(centroid_x0,centroid_y0,z0)}function centroidRingPoint(lambda,phi){lambda*=radians,phi*=radians;var cosPhi=cos(phi),x=cosPhi*cos(lambda),y=cosPhi*sin(lambda),z=sin(phi),cx=centroid_y0*z-z0*y,cy=z0*x-centroid_x0*z,cz=centroid_x0*y-centroid_y0*x,m=sqrt(cx*cx+cy*cy+cz*cz),w=asin(m),v=m&&-w/m;X2+=v*cx;Y2+=v*cy;Z2+=v*cz;W1+=w;centroid_X1+=w*(centroid_x0+(centroid_x0=x));centroid_Y1+=w*(centroid_y0+(centroid_y0=y));Z1+=w*(z0+(z0=z));centroidPointCartesian(centroid_x0,centroid_y0,z0)}var centroid=function(object){W0=W1=centroid_X0=centroid_Y0=Z0=centroid_X1=centroid_Y1=Z1=X2=Y2=Z2=0;src_stream(object,centroidStream);var x=X2,y=Y2,z=Z2,m=x*x+y*y+z*z;if(mpi?lambda-tau:lambda<-pi?lambda+tau:lambda,phi]}rotationIdentity.invert=rotationIdentity;function rotateRadians(deltaLambda,deltaPhi,deltaGamma){return(deltaLambda%=tau)?deltaPhi||deltaGamma?compose(rotationLambda(deltaLambda),rotationPhiGamma(deltaPhi,deltaGamma)):rotationLambda(deltaLambda):deltaPhi||deltaGamma?rotationPhiGamma(deltaPhi,deltaGamma):rotationIdentity}function forwardRotationLambda(deltaLambda){return function(lambda,phi){return lambda+=deltaLambda,[lambda>pi?lambda-tau:lambda<-pi?lambda+tau:lambda,phi]}}function rotationLambda(deltaLambda){var rotation=forwardRotationLambda(deltaLambda);rotation.invert=forwardRotationLambda(-deltaLambda);return rotation}function rotationPhiGamma(deltaPhi,deltaGamma){var cosDeltaPhi=cos(deltaPhi),sinDeltaPhi=sin(deltaPhi),cosDeltaGamma=cos(deltaGamma),sinDeltaGamma=sin(deltaGamma);function rotation(lambda,phi){var cosPhi=cos(phi),x=cos(lambda)*cosPhi,y=sin(lambda)*cosPhi,z=sin(phi),k=z*cosDeltaPhi+x*sinDeltaPhi;return[atan2(y*cosDeltaGamma-k*sinDeltaGamma,x*cosDeltaPhi-z*sinDeltaPhi),asin(k*cosDeltaGamma+y*sinDeltaGamma)]}rotation.invert=function(lambda,phi){var cosPhi=cos(phi),x=cos(lambda)*cosPhi,y=sin(lambda)*cosPhi,z=sin(phi),k=z*cosDeltaGamma-y*sinDeltaGamma;return[atan2(y*cosDeltaGamma+z*sinDeltaGamma,x*cosDeltaPhi+k*sinDeltaPhi),asin(k*cosDeltaPhi-x*sinDeltaPhi)]};return rotation}var src_rotation=function(rotate){rotate=rotateRadians(rotate[0]*radians,rotate[1]*radians,rotate.length>2?rotate[2]*radians:0);function forward(coordinates){coordinates=rotate(coordinates[0]*radians,coordinates[1]*radians);return coordinates[0]*=degrees,coordinates[1]*=degrees,coordinates}forward.invert=function(coordinates){coordinates=rotate.invert(coordinates[0]*radians,coordinates[1]*radians);return coordinates[0]*=degrees,coordinates[1]*=degrees,coordinates};return forward};function circleStream(stream,radius,delta,direction,t0,t1){if(!delta)return;var cosRadius=cos(radius),sinRadius=sin(radius),step=direction*delta;if(t0==null){t0=radius+direction*tau;t1=radius-step/2}else{t0=circleRadius(cosRadius,t0);t1=circleRadius(cosRadius,t1);if(direction>0?t0t1)t0+=direction*tau}for(var point,t=t0;direction>0?t>t1:t1)lines.push(lines.pop().concat(lines.shift()))},result:function(){var result=lines;lines=[];line=null;return result}}};var pointEqual=function(a,b){return abs(a[0]-b[0])=0;--i)stream.point((point=points[i])[0],point[1])}else{interpolate(current.x,current.p.x,-1,stream)}current=current.p}current=current.o;points=current.z;isSubject=!isSubject}while(!current.v);stream.lineEnd()}};function rejoin_link(array){if(!(n=array.length))return;var n,i=0,a=array[0],b;while(++i=0?1:-1,absDelta=sign*delta,antimeridian=absDelta>pi,k=sinPhi0*sinPhi1;sum.add(atan2(k*sign*sin(absDelta),cosPhi0*cosPhi1+k*cos(absDelta)));angle+=antimeridian?delta+sign*tau:delta;if(antimeridian^lambda0>=lambda^lambda1>=lambda){var arc=cartesianCross(cartesian_cartesian(point0),cartesian_cartesian(point1));cartesianNormalizeInPlace(arc);var intersection=cartesianCross(normal,arc);cartesianNormalizeInPlace(intersection);var phiArc=(antimeridian^delta>=0?-1:1)*asin(intersection[2]);if(phi>phiArc||phi===phiArc&&(arc[0]||arc[1])){winding+=antimeridian^delta>=0?1:-1}}}}return(angle<-epsilon||angle0){if(!polygonStarted)sink.polygonStart(),polygonStarted=true;sink.lineStart();for(i=0;i1&&clean&2)ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));segments.push(ringSegments.filter(validSegment))}return clip}};function validSegment(segment){return segment.length>1}function clip_compareIntersection(a,b){return((a=a.x)[0]<0?a[1]-halfPi-epsilon:halfPi-a[1])-((b=b.x)[0]<0?b[1]-halfPi-epsilon:halfPi-b[1])}var clip_antimeridian=src_clip(function(){return true},clipAntimeridianLine,clipAntimeridianInterpolate,[-pi,-halfPi]);function clipAntimeridianLine(stream){var lambda0=NaN,phi0=NaN,sign0=NaN,clean;return{lineStart:function(){stream.lineStart();clean=1},point:function(lambda1,phi1){var sign1=lambda1>0?pi:-pi,delta=abs(lambda1-lambda0);if(abs(delta-pi)0?halfPi:-halfPi);stream.point(sign0,phi0);stream.lineEnd();stream.lineStart();stream.point(sign1,phi0);stream.point(lambda1,phi0);clean=0}else if(sign0!==sign1&&delta>=pi){if(abs(lambda0-sign0)epsilon?atan((sin(phi0)*(cosPhi1=cos(phi1))*sin(lambda1)-sin(phi1)*(cosPhi0=cos(phi0))*sin(lambda0))/(cosPhi0*cosPhi1*sinLambda0Lambda1)):(phi0+phi1)/2}function clipAntimeridianInterpolate(from,to,direction,stream){var phi;if(from==null){phi=direction*halfPi;stream.point(-pi,phi);stream.point(0,phi);stream.point(pi,phi);stream.point(pi,0);stream.point(pi,-phi);stream.point(0,-phi);stream.point(-pi,-phi);stream.point(-pi,0);stream.point(-pi,phi)}else if(abs(from[0]-to[0])>epsilon){var lambda=from[0]0,notHemisphere=abs(cr)>epsilon;function interpolate(from,to,direction,stream){circleStream(stream,radius,delta,direction,from,to)}function visible(lambda,phi){return cos(lambda)*cos(phi)>cr}function clipLine(stream){var point0,c0,v0,v00,clean;return{lineStart:function(){v00=v0=false;clean=1},point:function(lambda,phi){var point1=[lambda,phi],point2,v=visible(lambda,phi),c=smallRadius?v?0:code(lambda,phi):v?code(lambda+(lambda<0?pi:-pi),phi):0;if(!point0&&(v00=v0=v))stream.lineStart();if(v!==v0){point2=intersect(point0,point1);if(!point2||pointEqual(point0,point2)||pointEqual(point1,point2)){point1[0]+=epsilon;point1[1]+=epsilon;v=visible(point1[0],point1[1])}}if(v!==v0){clean=0;if(v){stream.lineStart();point2=intersect(point1,point0);stream.point(point2[0],point2[1])}else{point2=intersect(point0,point1);stream.point(point2[0],point2[1]);stream.lineEnd()}point0=point2}else if(notHemisphere&&point0&&smallRadius^v){var t;if(!(c&c0)&&(t=intersect(point1,point0,true))){clean=0;if(smallRadius){stream.lineStart();stream.point(t[0][0],t[0][1]);stream.point(t[1][0],t[1][1]);stream.lineEnd()}else{stream.point(t[1][0],t[1][1]);stream.lineEnd();stream.lineStart();stream.point(t[0][0],t[0][1])}}}if(v&&(!point0||!pointEqual(point0,point1))){stream.point(point1[0],point1[1])}point0=point1,v0=v,c0=c},lineEnd:function(){if(v0)stream.lineEnd();point0=null},clean:function(){return clean|(v00&&v0)<<1}}}function intersect(a,b,two){var pa=cartesian_cartesian(a),pb=cartesian_cartesian(b);var n1=[1,0,0],n2=cartesianCross(pa,pb),n2n2=cartesianDot(n2,n2),n1n2=n2[0],determinant=n2n2-n1n2*n1n2;if(!determinant)return!two&&a;var c1=cr*n2n2/determinant,c2=-cr*n1n2/determinant,n1xn2=cartesianCross(n1,n2),A=cartesianScale(n1,c1),B=cartesianScale(n2,c2);cartesianAddInPlace(A,B);var u=n1xn2,w=cartesianDot(A,u),uu=cartesianDot(u,u),t2=w*w-uu*(cartesianDot(A,A)-1);if(t2<0)return;var t=sqrt(t2),q=cartesianScale(u,(-w-t)/uu);cartesianAddInPlace(q,A);q=cartesian_spherical(q);if(!two)return q;var lambda0=a[0],lambda1=b[0],phi0=a[1],phi1=b[1],z;if(lambda10^q[1]<(abs(q[0]-lambda0)pi^(lambda0<=q[0]&&q[0]<=lambda1)){var q1=cartesianScale(u,(-w+t)/uu);cartesianAddInPlace(q1,A);return[q,cartesian_spherical(q1)]}}function code(lambda,phi){var r=smallRadius?radius:pi-radius,code=0;if(lambda<-r)code|=1;else if(lambda>r)code|=2;if(phi<-r)code|=4;else if(phi>r)code|=8;return code}return src_clip(visible,clipLine,interpolate,smallRadius?[0,-radius]:[-pi,radius-pi])};var clip_line=function(a,b,x0,y0,x1,y1){var ax=a[0],ay=a[1],bx=b[0],by=b[1],t0=0,t1=1,dx=bx-ax,dy=by-ay,r;r=x0-ax;if(!dx&&r>0)return;r/=dx;if(dx<0){if(r0){if(r>t1)return;if(r>t0)t0=r}r=x1-ax;if(!dx&&r<0)return;r/=dx;if(dx<0){if(r>t1)return;if(r>t0)t0=r}else if(dx>0){if(r0)return;r/=dy;if(dy<0){if(r0){if(r>t1)return;if(r>t0)t0=r}r=y1-ay;if(!dy&&r<0)return;r/=dy;if(dy<0){if(r>t1)return;if(r>t0)t0=r}else if(dy>0){if(r0)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};var clipMax=1e9,clipMin=-clipMax;function clipRectangle(x0,y0,x1,y1){function visible(x,y){return x0<=x&&x<=x1&&y0<=y&&y<=y1}function interpolate(from,to,direction,stream){var a=0,a1=0;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)}while((a=(a+direction+4)%4)!==a1)}else{stream.point(to[0],to[1])}}function corner(p,direction){return abs(p[0]-x0)0?0:3:abs(p[0]-x1)0?2:1:abs(p[1]-y0)0?1:0:direction>0?3:2}function compareIntersection(a,b){return comparePoint(a.x,b.x)}function comparePoint(a,b){var ca=corner(a,1),cb=corner(b,1);return ca!==cb?ca-cb:ca===0?b[1]-a[1]:ca===1?a[0]-b[0]:ca===2?a[1]-b[1]:b[0]-a[0]}return function(stream){var activeStream=stream,bufferStream=buffer(),segments,polygon,ring,x__,y__,v__,x_,y_,v_,first,clean;var clipStream={point,lineStart,lineEnd,polygonStart,polygonEnd};function point(x,y){if(visible(x,y))activeStream.point(x,y)}function polygonInside(){var winding=0;for(var i=0,n=polygon.length;iy1&&(b0-a0)*(y1-a1)>(b1-a1)*(x0-a0))++winding}else{if(b1<=y1&&(b0-a0)*(y1-a1)<(b1-a1)*(x0-a0))--winding}}}return winding}function polygonStart(){activeStream=bufferStream,segments=[],polygon=[],clean=true}function polygonEnd(){var startInside=polygonInside(),cleanInside=clean&&startInside,visible=(segments=Object(d3_array["merge"])(segments)).length;if(cleanInside||visible){stream.polygonStart();if(cleanInside){stream.lineStart();interpolate(null,null,1,stream);stream.lineEnd()}if(visible){rejoin(segments,compareIntersection,startInside,interpolate,stream)}stream.polygonEnd()}activeStream=stream,segments=polygon=ring=null}function lineStart(){clipStream.point=linePoint;if(polygon)polygon.push(ring=[]);first=true;v_=false;x_=y_=NaN}function lineEnd(){if(segments){linePoint(x__,y__);if(v__&&v_)bufferStream.rejoin();segments.push(bufferStream.result())}clipStream.point=point;if(v_)activeStream.lineEnd()}function linePoint(x,y){var v=visible(x,y);if(polygon)ring.push([x,y]);if(first){x__=x,y__=y,v__=v;first=false;if(v){activeStream.lineStart();activeStream.point(x,y)}}else{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))];if(clip_line(a,b,x0,y0,x1,y1)){if(!v_){activeStream.lineStart();activeStream.point(a[0],a[1])}activeStream.point(b[0],b[1]);if(!v)activeStream.lineEnd();clean=false}else if(v){activeStream.lineStart();activeStream.point(x,y);clean=false}}}x_=x,y_=y,v_=v}return clipStream}}var clip_extent=function(){var x0=0,y0=0,x1=960,y1=500,cache,cacheStream,clip;return clip={stream:function(stream){return cache&&cacheStream===stream?cache:cache=clipRectangle(x0,y0,x1,y1)(cacheStream=stream)},extent:function(_){return arguments.length?(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1],cache=cacheStream=null,clip):[[x0,y0],[x1,y1]]}}};var lengthSum=adder(),length_lambda0,length_sinPhi0,length_cosPhi0;var lengthStream={sphere:noop,point:noop,lineStart:lengthLineStart,lineEnd:noop,polygonStart:noop,polygonEnd:noop};function lengthLineStart(){lengthStream.point=lengthPointFirst;lengthStream.lineEnd=lengthLineEnd}function lengthLineEnd(){lengthStream.point=lengthStream.lineEnd=noop}function lengthPointFirst(lambda,phi){lambda*=radians,phi*=radians;length_lambda0=lambda,length_sinPhi0=sin(phi),length_cosPhi0=cos(phi);lengthStream.point=lengthPoint}function lengthPoint(lambda,phi){lambda*=radians,phi*=radians;var sinPhi=sin(phi),cosPhi=cos(phi),delta=abs(lambda-length_lambda0),cosDelta=cos(delta),sinDelta=sin(delta),x=cosPhi*sinDelta,y=length_cosPhi0*sinPhi-length_sinPhi0*cosPhi*cosDelta,z=length_sinPhi0*sinPhi+length_cosPhi0*cosPhi*cosDelta;lengthSum.add(atan2(sqrt(x*x+y*y),z));length_lambda0=lambda,length_sinPhi0=sinPhi,length_cosPhi0=cosPhi}var src_length=function(object){lengthSum.reset();src_stream(object,lengthStream);return+lengthSum};var distance_coordinates=[null,null],distance_object={type:"LineString",coordinates:distance_coordinates};var distance=function(a,b){distance_coordinates[0]=a;distance_coordinates[1]=b;return src_length(distance_object)};var containsObjectType={Feature:function(object,point){return containsGeometry(object.geometry,point)},FeatureCollection:function(object,point){var features=object.features,i=-1,n=features.length;while(++iepsilon}).map(x)).concat(Object(d3_array["range"])(ceil(y0/dy)*dy,y1,dy).filter(function(y){return abs(y%DY)>epsilon}).map(y))}graticule.lines=function(){return lines().map(function(coordinates){return{type:"LineString",coordinates}})};graticule.outline=function(){return{type:"Polygon",coordinates:[X(X0).concat(Y(Y1).slice(1),X(X1).reverse().slice(1),Y(Y0).reverse().slice(1))]}};graticule.extent=function(_){if(!arguments.length)return graticule.extentMinor();return graticule.extentMajor(_).extentMinor(_)};graticule.extentMajor=function(_){if(!arguments.length)return[[X0,Y0],[X1,Y1]];X0=+_[0][0],X1=+_[1][0];Y0=+_[0][1],Y1=+_[1][1];if(X0>X1)_=X0,X0=X1,X1=_;if(Y0>Y1)_=Y0,Y0=Y1,Y1=_;return graticule.precision(precision)};graticule.extentMinor=function(_){if(!arguments.length)return[[x0,y0],[x1,y1]];x0=+_[0][0],x1=+_[1][0];y0=+_[0][1],y1=+_[1][1];if(x0>x1)_=x0,x0=x1,x1=_;if(y0>y1)_=y0,y0=y1,y1=_;return graticule.precision(precision)};graticule.step=function(_){if(!arguments.length)return graticule.stepMinor();return graticule.stepMajor(_).stepMinor(_)};graticule.stepMajor=function(_){if(!arguments.length)return[DX,DY];DX=+_[0],DY=+_[1];return graticule};graticule.stepMinor=function(_){if(!arguments.length)return[dx,dy];dx=+_[0],dy=+_[1];return graticule};graticule.precision=function(_){if(!arguments.length)return precision;precision=+_;x=graticuleX(y0,y1,90);y=graticuleY(x0,x1,precision);X=graticuleX(Y0,Y1,90);Y=graticuleY(X0,X1,precision);return graticule};return graticule.extentMajor([[-180,-90+epsilon],[180,90-epsilon]]).extentMinor([[-180,-80-epsilon],[180,80+epsilon]])}function graticule10(){return graticule_graticule()()}var src_interpolate=function(a,b){var x0=a[0]*radians,y0=a[1]*radians,x1=b[0]*radians,y1=b[1]*radians,cy0=cos(y0),sy0=sin(y0),cy1=cos(y1),sy1=sin(y1),kx0=cy0*cos(x0),ky0=cy0*sin(x0),kx1=cy1*cos(x1),ky1=cy1*sin(x1),d=2*asin(sqrt(haversin(y1-y0)+cy0*cy1*haversin(x1-x0))),k=sin(d);var interpolate=d?function(t){var B=sin(t*=d)/k,A=sin(d-t)/k,x=A*kx0+B*kx1,y=A*ky0+B*ky1,z=A*sy0+B*sy1;return[atan2(y,x)*degrees,atan2(z,sqrt(x*x+y*y))*degrees]}:function(){return[x0*degrees,y0*degrees]};interpolate.distance=d;return interpolate};var identity=function(x){return x};var area_areaSum=adder(),area_areaRingSum=adder(),area_x00,area_y00,area_x0,area_y0;var area_areaStream={point:noop,lineStart:noop,lineEnd:noop,polygonStart:function(){area_areaStream.lineStart=area_areaRingStart;area_areaStream.lineEnd=area_areaRingEnd},polygonEnd:function(){area_areaStream.lineStart=area_areaStream.lineEnd=area_areaStream.point=noop;area_areaSum.add(abs(area_areaRingSum));area_areaRingSum.reset()},result:function(){var area=area_areaSum/2;area_areaSum.reset();return area}};function area_areaRingStart(){area_areaStream.point=area_areaPointFirst}function area_areaPointFirst(x,y){area_areaStream.point=area_areaPoint;area_x00=area_x0=x,area_y00=area_y0=y}function area_areaPoint(x,y){area_areaRingSum.add(area_y0*x-area_x0*y);area_x0=x,area_y0=y}function area_areaRingEnd(){area_areaPoint(area_x00,area_y00)}var path_area=area_areaStream;var bounds_x0=Infinity,bounds_y0=bounds_x0,bounds_x1=-bounds_x0,bounds_y1=bounds_x1;var bounds_boundsStream={point:bounds_boundsPoint,lineStart:noop,lineEnd:noop,polygonStart:noop,polygonEnd:noop,result:function(){var bounds=[[bounds_x0,bounds_y0],[bounds_x1,bounds_y1]];bounds_x1=bounds_y1=-(bounds_y0=bounds_x0=Infinity);return bounds}};function bounds_boundsPoint(x,y){if(xbounds_x1)bounds_x1=x;if(ybounds_y1)bounds_y1=y}var path_bounds=bounds_boundsStream;var path_centroid_X0=0,path_centroid_Y0=0,centroid_Z0=0,path_centroid_X1=0,path_centroid_Y1=0,centroid_Z1=0,centroid_X2=0,centroid_Y2=0,centroid_Z2=0,centroid_x00,centroid_y00,path_centroid_x0,path_centroid_y0;var centroid_centroidStream={point:centroid_centroidPoint,lineStart:centroid_centroidLineStart,lineEnd:centroid_centroidLineEnd,polygonStart:function(){centroid_centroidStream.lineStart=centroid_centroidRingStart;centroid_centroidStream.lineEnd=centroid_centroidRingEnd},polygonEnd:function(){centroid_centroidStream.point=centroid_centroidPoint;centroid_centroidStream.lineStart=centroid_centroidLineStart;centroid_centroidStream.lineEnd=centroid_centroidLineEnd},result:function(){var centroid=centroid_Z2?[centroid_X2/centroid_Z2,centroid_Y2/centroid_Z2]:centroid_Z1?[path_centroid_X1/centroid_Z1,path_centroid_Y1/centroid_Z1]:centroid_Z0?[path_centroid_X0/centroid_Z0,path_centroid_Y0/centroid_Z0]:[NaN,NaN];path_centroid_X0=path_centroid_Y0=centroid_Z0=path_centroid_X1=path_centroid_Y1=centroid_Z1=centroid_X2=centroid_Y2=centroid_Z2=0;return centroid}};function centroid_centroidPoint(x,y){path_centroid_X0+=x;path_centroid_Y0+=y;++centroid_Z0}function centroid_centroidLineStart(){centroid_centroidStream.point=centroidPointFirstLine}function centroidPointFirstLine(x,y){centroid_centroidStream.point=centroidPointLine;centroid_centroidPoint(path_centroid_x0=x,path_centroid_y0=y)}function centroidPointLine(x,y){var dx=x-path_centroid_x0,dy=y-path_centroid_y0,z=sqrt(dx*dx+dy*dy);path_centroid_X1+=z*(path_centroid_x0+x)/2;path_centroid_Y1+=z*(path_centroid_y0+y)/2;centroid_Z1+=z;centroid_centroidPoint(path_centroid_x0=x,path_centroid_y0=y)}function centroid_centroidLineEnd(){centroid_centroidStream.point=centroid_centroidPoint}function centroid_centroidRingStart(){centroid_centroidStream.point=centroidPointFirstRing}function centroid_centroidRingEnd(){centroidPointRing(centroid_x00,centroid_y00)}function centroidPointFirstRing(x,y){centroid_centroidStream.point=centroidPointRing;centroid_centroidPoint(centroid_x00=path_centroid_x0=x,centroid_y00=path_centroid_y0=y)}function centroidPointRing(x,y){var dx=x-path_centroid_x0,dy=y-path_centroid_y0,z=sqrt(dx*dx+dy*dy);path_centroid_X1+=z*(path_centroid_x0+x)/2;path_centroid_Y1+=z*(path_centroid_y0+y)/2;centroid_Z1+=z;z=path_centroid_y0*x-path_centroid_x0*y;centroid_X2+=z*(path_centroid_x0+x);centroid_Y2+=z*(path_centroid_y0+y);centroid_Z2+=z*3;centroid_centroidPoint(path_centroid_x0=x,path_centroid_y0=y)}var path_centroid=centroid_centroidStream;function PathContext(context){this._context=context}PathContext.prototype={_radius:4.5,pointRadius:function(_){return this._radius=_,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line===0)this._context.closePath();this._point=NaN},point:function(x,y){switch(this._point){case 0:{this._context.moveTo(x,y);this._point=1;break}case 1:{this._context.lineTo(x,y);break}default:{this._context.moveTo(x+this._radius,y);this._context.arc(x,y,this._radius,0,tau);break}}},result:noop};var measure_lengthSum=adder(),lengthRing,measure_x00,measure_y00,measure_x0,measure_y0;var measure_lengthStream={point:noop,lineStart:function(){measure_lengthStream.point=measure_lengthPointFirst},lineEnd:function(){if(lengthRing)measure_lengthPoint(measure_x00,measure_y00);measure_lengthStream.point=noop},polygonStart:function(){lengthRing=true},polygonEnd:function(){lengthRing=null},result:function(){var length=+measure_lengthSum;measure_lengthSum.reset();return length}};function measure_lengthPointFirst(x,y){measure_lengthStream.point=measure_lengthPoint;measure_x00=measure_x0=x,measure_y00=measure_y0=y}function measure_lengthPoint(x,y){measure_x0-=x,measure_y0-=y;measure_lengthSum.add(sqrt(measure_x0*measure_x0+measure_y0*measure_y0));measure_x0=x,measure_y0=y}var measure=measure_lengthStream;function PathString(){this._string=[]}PathString.prototype={_radius:4.5,_circle:string_circle(4.5),pointRadius:function(_){if((_=+_)!==this._radius)this._radius=_,this._circle=null;return this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){if(this._line===0)this._string.push("Z");this._point=NaN},point:function(x,y){switch(this._point){case 0:{this._string.push("M",x,",",y);this._point=1;break}case 1:{this._string.push("L",x,",",y);break}default:{if(this._circle==null)this._circle=string_circle(this._radius);this._string.push("M",x,",",y,this._circle);break}}},result:function(){if(this._string.length){var result=this._string.join("");this._string=[];return result}else{return null}}};function string_circle(radius){return"m0,"+radius+"a"+radius+","+radius+" 0 1,1 0,"+-2*radius+"a"+radius+","+radius+" 0 1,1 0,"+2*radius+"z"}var src_path=function(projection,context){var pointRadius=4.5,projectionStream,contextStream;function path(object){if(object){if(typeof pointRadius==="function")contextStream.pointRadius(+pointRadius.apply(this,arguments));src_stream(object,projectionStream(contextStream))}return contextStream.result()}path.area=function(object){src_stream(object,projectionStream(path_area));return path_area.result()};path.measure=function(object){src_stream(object,projectionStream(measure));return measure.result()};path.bounds=function(object){src_stream(object,projectionStream(path_bounds));return path_bounds.result()};path.centroid=function(object){src_stream(object,projectionStream(path_centroid));return path_centroid.result()};path.projection=function(_){return arguments.length?(projectionStream=_==null?(projection=null,identity):(projection=_).stream,path):projection};path.context=function(_){if(!arguments.length)return context;contextStream=_==null?(context=null,new PathString):new PathContext(context=_);if(typeof pointRadius!=="function")contextStream.pointRadius(pointRadius);return path};path.pointRadius=function(_){if(!arguments.length)return pointRadius;pointRadius=typeof _==="function"?_:(contextStream.pointRadius(+_),+_);return path};return path.projection(projection).context(context)};var src_transform=function(methods){return{stream:transformer(methods)}};function transformer(methods){return function(stream){var s=new TransformStream;for(var key in methods)s[key]=methods[key];s.stream=stream;return s}}function TransformStream(){}TransformStream.prototype={constructor:TransformStream,point:function(x,y){this.stream.point(x,y)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function fit(projection,fitBounds,object){var clip=projection.clipExtent&&projection.clipExtent();projection.scale(150).translate([0,0]);if(clip!=null)projection.clipExtent(null);src_stream(object,projection.stream(path_bounds));fitBounds(path_bounds.result());if(clip!=null)projection.clipExtent(clip);return projection}function fitExtent(projection,extent,object){return fit(projection,function(b){var w=extent[1][0]-extent[0][0],h=extent[1][1]-extent[0][1],k=Math.min(w/(b[1][0]-b[0][0]),h/(b[1][1]-b[0][1])),x=+extent[0][0]+(w-k*(b[1][0]+b[0][0]))/2,y=+extent[0][1]+(h-k*(b[1][1]+b[0][1]))/2;projection.scale(150*k).translate([x,y])},object)}function fitSize(projection,size,object){return fitExtent(projection,[[0,0],size],object)}function fitWidth(projection,width,object){return fit(projection,function(b){var w=+width,k=w/(b[1][0]-b[0][0]),x=(w-k*(b[1][0]+b[0][0]))/2,y=-k*b[0][1];projection.scale(150*k).translate([x,y])},object)}function fitHeight(projection,height,object){return fit(projection,function(b){var h=+height,k=h/(b[1][1]-b[0][1]),x=-k*b[0][0],y=(h-k*(b[1][1]+b[0][1]))/2;projection.scale(150*k).translate([x,y])},object)}var maxDepth=16,cosMinDistance=cos(30*radians);var resample=function(project,delta2){return+delta2?resample_resample(project,delta2):resampleNone(project)};function resampleNone(project){return transformer({point:function(x,y){x=project(x,y);this.stream.point(x[0],x[1])}})}function resample_resample(project,delta2){function resampleLineTo(x0,y0,lambda0,a0,b0,c0,x1,y1,lambda1,a1,b1,c1,depth,stream){var dx=x1-x0,dy=y1-y0,d2=dx*dx+dy*dy;if(d2>4*delta2&&depth--){var a=a0+a1,b=b0+b1,c=c0+c1,m=sqrt(a*a+b*b+c*c),phi2=asin(c/=m),lambda2=abs(abs(c)-1)delta2||abs((dx*dx2+dy*dy2)/d2-.5)>.3||a0*a1+b0*b1+c0*c12?_[2]%360*radians:0,recenter()):[deltaLambda*degrees,deltaPhi*degrees,deltaGamma*degrees]};projection.angle=function(_){return arguments.length?(alpha=_%360*radians,recenter()):alpha*degrees};projection.precision=function(_){return arguments.length?(projectResample=resample(projectTransform,delta2=_*_),reset()):sqrt(delta2)};projection.fitExtent=function(extent,object){return fitExtent(projection,extent,object)};projection.fitSize=function(size,object){return fitSize(projection,size,object)};projection.fitWidth=function(width,object){return fitWidth(projection,width,object)};projection.fitHeight=function(height,object){return fitHeight(projection,height,object)};function recenter(){var center=scaleTranslateRotate(k,0,0,alpha).apply(null,project(lambda,phi)),transform=(alpha?scaleTranslateRotate:scaleTranslate)(k,x-center[0],y-center[1],alpha);rotate=rotateRadians(deltaLambda,deltaPhi,deltaGamma);projectTransform=compose(project,transform);projectRotateTransform=compose(rotate,projectTransform);projectResample=resample(projectTransform,delta2);return reset()}function reset(){cache=cacheStream=null;return projection}return function(){project=projectAt.apply(this,arguments);projection.invert=project.invert&&invert;return recenter()}}function conicProjection(projectAt){var phi0=0,phi1=pi/3,m=projectionMutator(projectAt),p=m(phi0,phi1);p.parallels=function(_){return arguments.length?m(phi0=_[0]*radians,phi1=_[1]*radians):[phi0*degrees,phi1*degrees]};return p}function cylindricalEqualAreaRaw(phi0){var cosPhi0=cos(phi0);function forward(lambda,phi){return[lambda*cosPhi0,sin(phi)/cosPhi0]}forward.invert=function(x,y){return[x/cosPhi0,asin(y*cosPhi0)]};return forward}function conicEqualAreaRaw(y0,y1){var sy0=sin(y0),n=(sy0+sin(y1))/2;if(abs(n)=.12&&y<.234&&x>=-.425&&x<-.214?alaska:y>=.166&&y<.234&&x>=-.214&&x<-.115?hawaii:lower48).invert(coordinates)};albersUsa.stream=function(stream){return cache&&cacheStream===stream?cache:cache=multiplex([lower48.stream(cacheStream=stream),alaska.stream(stream),hawaii.stream(stream)])};albersUsa.precision=function(_){if(!arguments.length)return lower48.precision();lower48.precision(_),alaska.precision(_),hawaii.precision(_);return reset()};albersUsa.scale=function(_){if(!arguments.length)return lower48.scale();lower48.scale(_),alaska.scale(_*.35),hawaii.scale(_);return albersUsa.translate(lower48.translate())};albersUsa.translate=function(_){if(!arguments.length)return lower48.translate();var k=lower48.scale(),x=+_[0],y=+_[1];lower48Point=lower48.translate(_).clipExtent([[x-.455*k,y-.238*k],[x+.455*k,y+.238*k]]).stream(pointStream);alaskaPoint=alaska.translate([x-.307*k,y+.201*k]).clipExtent([[x-.425*k+epsilon,y+.12*k+epsilon],[x-.214*k-epsilon,y+.234*k-epsilon]]).stream(pointStream);hawaiiPoint=hawaii.translate([x-.205*k,y+.212*k]).clipExtent([[x-.214*k+epsilon,y+.166*k+epsilon],[x-.115*k-epsilon,y+.234*k-epsilon]]).stream(pointStream);return reset()};albersUsa.fitExtent=function(extent,object){return fitExtent(albersUsa,extent,object)};albersUsa.fitSize=function(size,object){return fitSize(albersUsa,size,object)};albersUsa.fitWidth=function(width,object){return fitWidth(albersUsa,width,object)};albersUsa.fitHeight=function(height,object){return fitHeight(albersUsa,height,object)};function reset(){cache=cacheStream=null;return albersUsa}return albersUsa.scale(1070)};function azimuthalRaw(scale){return function(x,y){var cx=cos(x),cy=cos(y),k=scale(cx*cy);return[k*cy*sin(x),k*sin(y)]}}function azimuthalInvert(angle){return function(x,y){var z=sqrt(x*x+y*y),c=angle(z),sc=sin(c),cc=cos(c);return[atan2(x*sc,z*cc),asin(z&&y*sc/z)]}}var azimuthalEqualAreaRaw=azimuthalRaw(function(cxcy){return sqrt(2/(1+cxcy))});azimuthalEqualAreaRaw.invert=azimuthalInvert(function(z){return 2*asin(z/2)});var azimuthalEqualArea=function(){return projection_projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180-.001)};var azimuthalEquidistantRaw=azimuthalRaw(function(c){return(c=acos(c))&&c/sin(c)});azimuthalEquidistantRaw.invert=azimuthalInvert(function(z){return z});var azimuthalEquidistant=function(){return projection_projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180-.001)};function mercatorRaw(lambda,phi){return[lambda,log(tan((halfPi+phi)/2))]}mercatorRaw.invert=function(x,y){return[x,2*atan(exp(y))-halfPi]};var mercator=function(){return mercatorProjection(mercatorRaw).scale(961/tau)};function mercatorProjection(project){var m=projection_projection(project),center=m.center,scale=m.scale,translate=m.translate,clipExtent=m.clipExtent,x0=null,y0,x1,y1;m.scale=function(_){return arguments.length?(scale(_),reclip()):scale()};m.translate=function(_){return arguments.length?(translate(_),reclip()):translate()};m.center=function(_){return arguments.length?(center(_),reclip()):center()};m.clipExtent=function(_){return arguments.length?(_==null?x0=y0=x1=y1=null:(x0=+_[0][0],y0=+_[0][1],x1=+_[1][0],y1=+_[1][1]),reclip()):x0==null?null:[[x0,y0],[x1,y1]]};function reclip(){var k=pi*scale(),t=m(src_rotation(m.rotate()).invert([0,0]));return clipExtent(x0==null?[[t[0]-k,t[1]-k],[t[0]+k,t[1]+k]]:project===mercatorRaw?[[Math.max(t[0]-k,x0),y0],[Math.min(t[0]+k,x1),y1]]:[[x0,Math.max(t[1]-k,y0)],[x1,Math.min(t[1]+k,y1)]])}return reclip()}function tany(y){return tan((halfPi+y)/2)}function conicConformalRaw(y0,y1){var cy0=cos(y0),n=y0===y1?sin(y0):log(cy0/cos(y1))/log(tany(y1)/tany(y0)),f=cy0*pow(tany(y0),n)/n;if(!n)return mercatorRaw;function project(x,y){if(f>0){if(y<-halfPi+epsilon)y=-halfPi+epsilon}else{if(y>halfPi-epsilon)y=halfPi-epsilon}var r=f/pow(tany(y),n);return[r*sin(n*x),f-r*cos(n*x)]}project.invert=function(x,y){var fy=f-y,r=math_sign(n)*sqrt(x*x+fy*fy);return[atan2(x,abs(fy))/n*math_sign(fy),2*atan(pow(f/r,1/n))-halfPi]};return project}var conicConformal=function(){return conicProjection(conicConformalRaw).scale(109.5).parallels([30,30])};function equirectangularRaw(lambda,phi){return[lambda,phi]}equirectangularRaw.invert=equirectangularRaw;var equirectangular=function(){return projection_projection(equirectangularRaw).scale(152.63)};function conicEquidistantRaw(y0,y1){var cy0=cos(y0),n=y0===y1?sin(y0):(cy0-cos(y1))/(y1-y0),g=cy0/n+y0;if(abs(n)epsilon&&--i>0);return[x/(.8707+(phi2=phi*phi)*(-.131979+phi2*(-.013791+phi2*phi2*phi2*(.003971-.001529*phi2)))),phi]};var naturalEarth1=function(){return projection_projection(naturalEarth1Raw).scale(175.295)};function orthographicRaw(x,y){return[cos(y)*sin(x),sin(y)]}orthographicRaw.invert=azimuthalInvert(asin);var orthographic=function(){return projection_projection(orthographicRaw).scale(249.5).clipAngle(90+epsilon)};function stereographicRaw(x,y){var cy=cos(y),k=1+cos(x)*cy;return[cy*sin(x)/k,sin(y)/k]}stereographicRaw.invert=azimuthalInvert(function(z){return 2*atan(z)});var stereographic=function(){return projection_projection(stereographicRaw).scale(250).clipAngle(142)};function transverseMercatorRaw(lambda,phi){return[log(tan((halfPi+phi)/2)),-lambda]}transverseMercatorRaw.invert=function(x,y){return[-y,2*atan(exp(x))-halfPi]};var transverseMercator=function(){var m=mercatorProjection(transverseMercatorRaw),center=m.center,rotate=m.rotate;m.center=function(_){return arguments.length?center([-_[1],_[0]]):(_=center(),[_[1],-_[0]])};m.rotate=function(_){return arguments.length?rotate([_[0],_[1],_.length>2?_[2]+90:90]):(_=rotate(),[_[0],_[1],_[2]-90])};return rotate([0,0,90]).scale(159.155)};__webpack_require__.d(__webpack_exports__,"geoArea",function(){return src_area});__webpack_require__.d(__webpack_exports__,"geoBounds",function(){return bounds});__webpack_require__.d(__webpack_exports__,"geoCentroid",function(){return centroid});__webpack_require__.d(__webpack_exports__,"geoCircle",function(){return src_circle});__webpack_require__.d(__webpack_exports__,"geoClipAntimeridian",function(){return clip_antimeridian});__webpack_require__.d(__webpack_exports__,"geoClipCircle",function(){return clip_circle});__webpack_require__.d(__webpack_exports__,"geoClipExtent",function(){return clip_extent});__webpack_require__.d(__webpack_exports__,"geoClipRectangle",function(){return clipRectangle});__webpack_require__.d(__webpack_exports__,"geoContains",function(){return contains});__webpack_require__.d(__webpack_exports__,"geoDistance",function(){return distance});__webpack_require__.d(__webpack_exports__,"geoGraticule",function(){return graticule_graticule});__webpack_require__.d(__webpack_exports__,"geoGraticule10",function(){return graticule10});__webpack_require__.d(__webpack_exports__,"geoInterpolate",function(){return src_interpolate});__webpack_require__.d(__webpack_exports__,"geoLength",function(){return src_length});__webpack_require__.d(__webpack_exports__,"geoPath",function(){return src_path});__webpack_require__.d(__webpack_exports__,"geoAlbers",function(){return albers});__webpack_require__.d(__webpack_exports__,"geoAlbersUsa",function(){return projection_albersUsa});__webpack_require__.d(__webpack_exports__,"geoAzimuthalEqualArea",function(){return azimuthalEqualArea});__webpack_require__.d(__webpack_exports__,"geoAzimuthalEqualAreaRaw",function(){return azimuthalEqualAreaRaw});__webpack_require__.d(__webpack_exports__,"geoAzimuthalEquidistant",function(){return azimuthalEquidistant});__webpack_require__.d(__webpack_exports__,"geoAzimuthalEquidistantRaw",function(){return azimuthalEquidistantRaw});__webpack_require__.d(__webpack_exports__,"geoConicConformal",function(){return conicConformal});__webpack_require__.d(__webpack_exports__,"geoConicConformalRaw",function(){return conicConformalRaw});__webpack_require__.d(__webpack_exports__,"geoConicEqualArea",function(){return conicEqualArea});__webpack_require__.d(__webpack_exports__,"geoConicEqualAreaRaw",function(){return conicEqualAreaRaw});__webpack_require__.d(__webpack_exports__,"geoConicEquidistant",function(){return conicEquidistant});__webpack_require__.d(__webpack_exports__,"geoConicEquidistantRaw",function(){return conicEquidistantRaw});__webpack_require__.d(__webpack_exports__,"geoEquirectangular",function(){return equirectangular});__webpack_require__.d(__webpack_exports__,"geoEquirectangularRaw",function(){return equirectangularRaw});__webpack_require__.d(__webpack_exports__,"geoGnomonic",function(){return gnomonic});__webpack_require__.d(__webpack_exports__,"geoGnomonicRaw",function(){return gnomonicRaw});__webpack_require__.d(__webpack_exports__,"geoIdentity",function(){return projection_identity});__webpack_require__.d(__webpack_exports__,"geoProjection",function(){return projection_projection});__webpack_require__.d(__webpack_exports__,"geoProjectionMutator",function(){return projectionMutator});__webpack_require__.d(__webpack_exports__,"geoMercator",function(){return mercator});__webpack_require__.d(__webpack_exports__,"geoMercatorRaw",function(){return mercatorRaw});__webpack_require__.d(__webpack_exports__,"geoNaturalEarth1",function(){return naturalEarth1});__webpack_require__.d(__webpack_exports__,"geoNaturalEarth1Raw",function(){return naturalEarth1Raw});__webpack_require__.d(__webpack_exports__,"geoOrthographic",function(){return orthographic});__webpack_require__.d(__webpack_exports__,"geoOrthographicRaw",function(){return orthographicRaw});__webpack_require__.d(__webpack_exports__,"geoStereographic",function(){return stereographic});__webpack_require__.d(__webpack_exports__,"geoStereographicRaw",function(){return stereographicRaw});__webpack_require__.d(__webpack_exports__,"geoTransverseMercator",function(){return transverseMercator});__webpack_require__.d(__webpack_exports__,"geoTransverseMercatorRaw",function(){return transverseMercatorRaw});__webpack_require__.d(__webpack_exports__,"geoRotation",function(){return src_rotation});__webpack_require__.d(__webpack_exports__,"geoStream",function(){return src_stream});__webpack_require__.d(__webpack_exports__,"geoTransform",function(){return src_transform})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var xhtml="http://www.w3.org/1999/xhtml";var namespaces={svg:"http://www.w3.org/2000/svg",xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};var namespace=function(name){var prefix=name+="",i=prefix.indexOf(":");if(i>=0&&(prefix=name.slice(0,i))!=="xmlns")name=name.slice(i+1);return namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name};function creatorInherit(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}}function creatorFixed(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}var creator=function(name){var fullname=namespace(name);return(fullname.local?creatorFixed:creatorInherit)(fullname)};function none(){}var src_selector=function(selector){return selector==null?none:function(){return this.querySelector(selector)}};var selection_select=function(select){if(typeof select!=="function")select=src_selector(select);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j=i1)i1=i0+1;while(!(next=updateGroup[i1])&&++i1=0;){if(node=group[i]){if(next&&next!==node.nextSibling)next.parentNode.insertBefore(node,next);next=node}}}return this};var sort=function(compare){if(!compare)compare=ascending;function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;jb?1:a>=b?0:NaN}var call=function(){var callback=arguments[0];arguments[0]=this;callback.apply(null,arguments);return this};var nodes=function(){var nodes=new Array(this.size()),i=-1;this.each(function(){nodes[++i]=this});return nodes};var selection_node=function(){for(var groups=this._groups,j=0,m=groups.length;j1?this.each((value==null?styleRemove:typeof value==="function"?styleFunction:styleConstant)(name,value,priority==null?"":priority)):styleValue(this.node(),name)};function styleValue(node,name){return node.style.getPropertyValue(name)||src_window(node).getComputedStyle(node,null).getPropertyValue(name)}function propertyRemove(name){return function(){delete this[name]}}function propertyConstant(name,value){return function(){this[name]=value}}function propertyFunction(name,value){return function(){var v=value.apply(this,arguments);if(v==null)delete this[name];else this[name]=v}}var property=function(name,value){return arguments.length>1?this.each((value==null?propertyRemove:typeof value==="function"?propertyFunction:propertyConstant)(name,value)):this.node()[name]};function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node;this._names=classArray(node.getAttribute("class")||"")}ClassList.prototype={add:function(name){var i=this._names.indexOf(name);if(i<0){this._names.push(name);this._node.setAttribute("class",this._names.join(" "))}},remove:function(name){var i=this._names.indexOf(name);if(i>=0){this._names.splice(i,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(name){return this._names.indexOf(name)>=0}};function classedAdd(node,names){var list=classList(node),i=-1,n=names.length;while(++i=0)name=t.slice(i+1),t=t.slice(0,i);return{type:t,name}})}function onRemove(typename){return function(){var on=this.__on;if(!on)return;for(var j=0,i=-1,m=on.length,o;jb?1:a>=b?0:NaN};var bisector=function(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;while(lo>>1;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;while(lo>>1;if(compare(a[mid],x)>0)hi=mid;else lo=mid+1}return lo}}};function ascendingComparator(f){return function(d,x){return ascending(f(d),x)}}var ascendingBisect=bisector(ascending);var bisectRight=ascendingBisect.right;var bisectLeft=ascendingBisect.left;var bisect=bisectRight;var pairs=function(array,f){if(f==null)f=pair;var i=0,n=array.length-1,p=array[0],pairs=new Array(n<0?0:n);while(ia?1:b>=a?0:NaN};var number=function(x){return x===null?NaN:+x};var variance=function(values,valueof){var n=values.length,m=0,i=-1,mean=0,value,delta,sum=0;if(valueof==null){while(++i1)return sum/(m-1)};var deviation=function(array,f){var v=variance(array,f);return v?Math.sqrt(v):v};var extent=function(values,valueof){var n=values.length,i=-1,value,min,max;if(valueof==null){while(++i=value){min=max=value;while(++ivalue)min=value;if(max=value){min=max=value;while(++ivalue)min=value;if(max0)return[start];if(reverse=stop0){start=Math.ceil(start/step);stop=Math.floor(stop/step);ticks=new Array(n=Math.ceil(stop-start+1));while(++i=0?(error>=e10?10:error>=e5?5:error>=e2?2:1)*Math.pow(10,power):-Math.pow(10,-power)/(error>=e10?10:error>=e5?5:error>=e2?2:1)}function tickStep(start,stop,count){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;return stopx1)tz.pop(),--m;var bins=new Array(m+1),bin;for(i=0;i<=m;++i){bin=bins[i]=[];bin.x0=i>0?tz[i-1]:x0;bin.x1=i=1)return+valueof(values[n-1],n-1,values);var n,i=(n-1)*p,i0=Math.floor(i),value0=+valueof(values[i0],i0,values),value1=+valueof(values[i0+1],i0+1,values);return value0+(value1-value0)*(i-i0)};var freedmanDiaconis=function(values,min,max){values=map.call(values,number).sort(ascending);return Math.ceil((max-min)/(2*(quantile(values,.75)-quantile(values,.25))*Math.pow(values.length,-1/3)))};var scott=function(values,min,max){return Math.ceil((max-min)/(3.5*deviation(values)*Math.pow(values.length,-1/3)))};var src_max=function(values,valueof){var n=values.length,i=-1,value,max;if(valueof==null){while(++i=value){max=value;while(++imax){max=value}}}}}else{while(++i=value){max=value;while(++imax){max=value}}}}}return max};var src_mean=function(values,valueof){var n=values.length,m=n,i=-1,value,sum=0;if(valueof==null){while(++i=0){array=arrays[n];m=array.length;while(--m>=0){merged[--j]=array[m]}}return merged};var src_min=function(values,valueof){var n=values.length,i=-1,value,min;if(valueof==null){while(++i=value){min=value;while(++ivalue){min=value}}}}}else{while(++i=value){min=value;while(++ivalue){min=value}}}}}return min};var permute=function(array,indexes){var i=indexes.length,permutes=new Array(i);while(i--)permutes[i]=array[indexes[i]];return permutes};var scan=function(values,compare){if(!(n=values.length))return;var n,i=0,j=0,xi,xj=values[j];if(compare==null)compare=ascending;while(++i>8&15|m>>4&240,m>>4&15|m&240,(m&15)<<4|m&15,1)):(m=reHex6.exec(format))?rgbn(parseInt(m[1],16)):(m=reRgbInteger.exec(format))?new Rgb(m[1],m[2],m[3],1):(m=reRgbPercent.exec(format))?new Rgb(m[1]*255/100,m[2]*255/100,m[3]*255/100,1):(m=reRgbaInteger.exec(format))?rgba(m[1],m[2],m[3],m[4]):(m=reRgbaPercent.exec(format))?rgba(m[1]*255/100,m[2]*255/100,m[3]*255/100,m[4]):(m=reHslPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,1):(m=reHslaPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,m[4]):named.hasOwnProperty(format)?rgbn(named[format]):format==="transparent"?new Rgb(NaN,NaN,NaN,0):null}function rgbn(n){return new Rgb(n>>16&255,n>>8&255,n&255,1)}function rgba(r,g,b,a){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;o=o.rgb();return new Rgb(o.r,o.g,o.b,o.opacity)}function rgb(r,g,b,opacity){return arguments.length===1?rgbConvert(r):new Rgb(r,g,b,opacity==null?1:opacity)}function Rgb(r,g,b,opacity){this.r=+r;this.g=+g;this.b=+b;this.opacity=+opacity}define(Rgb,rgb,extend(Color,{brighter:function(k){k=k==null?brighter:Math.pow(brighter,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},darker:function(k){k=k==null?darker:Math.pow(darker,k);return new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&(0<=this.g&&this.g<=255)&&(0<=this.b&&this.b<=255)&&(0<=this.opacity&&this.opacity<=1)},hex:function(){return"#"+hex(this.r)+hex(this.g)+hex(this.b)},toString:function(){var a=this.opacity;a=isNaN(a)?1:Math.max(0,Math.min(1,a));return(a===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(a===1?")":", "+a+")")}}));function hex(value){value=Math.max(0,Math.min(255,Math.round(value)||0));return(value<16?"0":"")+value.toString(16)}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;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;o=o.rgb();var r=o.r/255,g=o.g/255,b=o.b/255,min=Math.min(r,g,b),max=Math.max(r,g,b),h=NaN,s=max-min,l=(max+min)/2;if(s){if(r===max)h=(g-b)/s+(g0&&l<1?0:h}return new Hsl(h,s,l,o.opacity)}function hsl(h,s,l,opacity){return arguments.length===1?hslConvert(h):new Hsl(h,s,l,opacity==null?1:opacity)}function Hsl(h,s,l,opacity){this.h=+h;this.s=+s;this.l=+l;this.opacity=+opacity}define(Hsl,hsl,extend(Color,{brighter:function(k){k=k==null?brighter:Math.pow(brighter,k);return new Hsl(this.h,this.s,this.l*k,this.opacity)},darker:function(k){k=k==null?darker:Math.pow(darker,k);return new Hsl(this.h,this.s,this.l*k,this.opacity)},rgb:function(){var h=this.h%360+(this.h<0)*360,s=isNaN(h)||isNaN(this.s)?0:this.s,l=this.l,m2=l+(l<.5?l:1-l)*s,m1=2*l-m2;return new Rgb(hsl2rgb(h>=240?h-240:h+120,m1,m2),hsl2rgb(h,m1,m2),hsl2rgb(h<120?h+240:h-120,m1,m2),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)}}));function hsl2rgb(h,m1,m2){return(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255}var deg2rad=Math.PI/180;var rad2deg=180/Math.PI;var K=18,Xn=.96422,Yn=1,Zn=.82521,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1;function labConvert(o){if(o instanceof Lab)return new Lab(o.l,o.a,o.b,o.opacity);if(o instanceof Hcl){if(isNaN(o.h))return new Lab(o.l,0,0,o.opacity);var h=o.h*deg2rad;return new Lab(o.l,Math.cos(h)*o.c,Math.sin(h)*o.c,o.opacity)}if(!(o instanceof Rgb))o=rgbConvert(o);var r=rgb2lrgb(o.r),g=rgb2lrgb(o.g),b=rgb2lrgb(o.b),y=xyz2lab((.2225045*r+.7168786*g+.0606169*b)/Yn),x,z;if(r===g&&g===b)x=z=y;else{x=xyz2lab((.4360747*r+.3850649*g+.1430804*b)/Xn);z=xyz2lab((.0139322*r+.0971045*g+.7141733*b)/Zn)}return new Lab(116*y-16,500*(x-y),200*(y-z),o.opacity)}function gray(l,opacity){return new Lab(l,0,0,opacity==null?1:opacity)}function lab(l,a,b,opacity){return arguments.length===1?labConvert(l):new Lab(l,a,b,opacity==null?1:opacity)}function Lab(l,a,b,opacity){this.l=+l;this.a=+a;this.b=+b;this.opacity=+opacity}define(Lab,lab,extend(Color,{brighter:function(k){return new Lab(this.l+K*(k==null?1:k),this.a,this.b,this.opacity)},darker:function(k){return new Lab(this.l-K*(k==null?1:k),this.a,this.b,this.opacity)},rgb:function(){var y=(this.l+16)/116,x=isNaN(this.a)?y:y+this.a/500,z=isNaN(this.b)?y:y-this.b/200;x=Xn*lab2xyz(x);y=Yn*lab2xyz(y);z=Zn*lab2xyz(z);return new Rgb(lrgb2rgb(3.1338561*x-1.6168667*y-.4906146*z),lrgb2rgb(-.9787684*x+1.9161415*y+.033454*z),lrgb2rgb(.0719453*x-.2289914*y+1.4052427*z),this.opacity)}}));function xyz2lab(t){return t>t3?Math.pow(t,1/3):t/t2+t0}function lab2xyz(t){return t>t1?t*t*t:t2*(t-t0)}function lrgb2rgb(x){return 255*(x<=.0031308?12.92*x:1.055*Math.pow(x,1/2.4)-.055)}function rgb2lrgb(x){return(x/=255)<=.04045?x/12.92:Math.pow((x+.055)/1.055,2.4)}function hclConvert(o){if(o instanceof Hcl)return new Hcl(o.h,o.c,o.l,o.opacity);if(!(o instanceof Lab))o=labConvert(o);if(o.a===0&&o.b===0)return new Hcl(NaN,0,o.l,o.opacity);var h=Math.atan2(o.b,o.a)*rad2deg;return new Hcl(h<0?h+360:h,Math.sqrt(o.a*o.a+o.b*o.b),o.l,o.opacity)}function lch(l,c,h,opacity){return arguments.length===1?hclConvert(l):new Hcl(h,c,l,opacity==null?1:opacity)}function hcl(h,c,l,opacity){return arguments.length===1?hclConvert(h):new Hcl(h,c,l,opacity==null?1:opacity)}function Hcl(h,c,l,opacity){this.h=+h;this.c=+c;this.l=+l;this.opacity=+opacity}define(Hcl,hcl,extend(Color,{brighter:function(k){return new Hcl(this.h,this.c,this.l+K*(k==null?1:k),this.opacity)},darker:function(k){return new Hcl(this.h,this.c,this.l-K*(k==null?1:k),this.opacity)},rgb:function(){return labConvert(this).rgb()}}));var A=-.14861,B=+1.78277,C=-.29227,D=-.90649,E=+1.97294,ED=E*D,EB=E*B,BC_DA=B*C-D*A;function cubehelixConvert(o){if(o instanceof Cubehelix)return new Cubehelix(o.h,o.s,o.l,o.opacity);if(!(o instanceof Rgb))o=rgbConvert(o);var r=o.r/255,g=o.g/255,b=o.b/255,l=(BC_DA*b+ED*r-EB*g)/(BC_DA+ED-EB),bl=b-l,k=(E*(g-l)-C*bl)/D,s=Math.sqrt(k*k+bl*bl)/(E*l*(1-l)),h=s?Math.atan2(k,bl)*rad2deg-120:NaN;return new Cubehelix(h<0?h+360:h,s,l,o.opacity)}function cubehelix(h,s,l,opacity){return arguments.length===1?cubehelixConvert(h):new Cubehelix(h,s,l,opacity==null?1:opacity)}function Cubehelix(h,s,l,opacity){this.h=+h;this.s=+s;this.l=+l;this.opacity=+opacity}define(Cubehelix,cubehelix,extend(Color,{brighter:function(k){k=k==null?brighter:Math.pow(brighter,k);return new Cubehelix(this.h,this.s,this.l*k,this.opacity)},darker:function(k){k=k==null?darker:Math.pow(darker,k);return new Cubehelix(this.h,this.s,this.l*k,this.opacity)},rgb:function(){var h=isNaN(this.h)?0:(this.h+120)*deg2rad,l=+this.l,a=isNaN(this.s)?0:this.s*l*(1-l),cosh=Math.cos(h),sinh=Math.sin(h);return new Rgb(255*(l+a*(A*cosh+B*sinh)),255*(l+a*(C*cosh+D*sinh)),255*(l+a*(E*cosh)),this.opacity)}}));__webpack_require__.d(__webpack_exports__,"a",function(){return color});__webpack_require__.d(__webpack_exports__,"f",function(){return rgb});__webpack_require__.d(__webpack_exports__,"d",function(){return hsl});__webpack_require__.d(__webpack_exports__,"e",function(){return lab});__webpack_require__.d(__webpack_exports__,"c",function(){return hcl});__webpack_require__.d(__webpack_exports__,false,function(){return lch});__webpack_require__.d(__webpack_exports__,false,function(){return gray});__webpack_require__.d(__webpack_exports__,"b",function(){return cubehelix})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var d3_color=__webpack_require__(3);function basis(t1,v0,v1,v2,v3){var t2=t1*t1,t3=t2*t1;return((1-3*t1+3*t2-t3)*v0+(4-6*t2+3*t3)*v1+(1+3*t1+3*t2-3*t3)*v2+t3*v3)/6}var src_basis=function(values){var n=values.length-1;return function(t){var i=t<=0?t=0:t>=1?(t=1,n-1):Math.floor(t*n),v1=values[i],v2=values[i+1],v0=i>0?values[i-1]:2*v1-v2,v3=i180||d<-180?d-360*Math.round(d/360):d):constant(isNaN(a)?b:a)}function gamma(y){return(y=+y)===1?nogamma:function(a,b){return b-a?exponential(a,b,y):constant(isNaN(a)?b:a)}}function nogamma(a,b){var d=b-a;return d?linear(a,d):constant(isNaN(a)?b:a)}var src_rgb=function rgbGamma(y){var color=gamma(y);function rgb(start,end){var r=color((start=Object(d3_color["f"])(start)).r,(end=Object(d3_color["f"])(end)).r),g=color(start.g,end.g),b=color(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){start.r=r(t);start.g=g(t);start.b=b(t);start.opacity=opacity(t);return start+""}}rgb.gamma=rgbGamma;return rgb}(1);function rgbSpline(spline){return function(colors){var n=colors.length,r=new Array(n),g=new Array(n),b=new Array(n),i,color;for(i=0;ibi){bs=b.slice(bi,bs);if(s[i])s[i]+=bs;else s[++i]=bs}if((am=am[0])===(bm=bm[0])){if(s[i])s[i]+=bm;else s[++i]=bm}else{s[++i]=null;q.push({i,x:number(am,bm)})}bi=reB.lastIndex}if(bi180)b+=360;else if(b-a>180)a+=360;q.push({i:s.push(pop(s)+"rotate(",null,degParen)-2,x:number(a,b)})}else if(b){s.push(pop(s)+"rotate("+b+degParen)}}function skewX(a,b,s,q){if(a!==b){q.push({i:s.push(pop(s)+"skewX(",null,degParen)-2,x:number(a,b)})}else if(b){s.push(pop(s)+"skewX("+b+degParen)}}function scale(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push(pop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:number(xa,xb)},{i:i-2,x:number(ya,yb)})}else if(xb!==1||yb!==1){s.push(pop(s)+"scale("+xb+","+yb+")")}}return function(a,b){var s=[],q=[];a=parse(a),b=parse(b);translate(a.translateX,a.translateY,b.translateX,b.translateY,s,q);rotate(a.rotate,b.rotate,s,q);skewX(a.skewX,b.skewX,s,q);scale(a.scaleX,a.scaleY,b.scaleX,b.scaleY,s,q);a=b=null;return function(t){var i=-1,n=q.length,o;while(++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}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(typename,callback){var _=this._,T=parseTypenames(typename+"",_),t,i=-1,n=T.length;if(arguments.length<2){while(++i0)for(var args=new Array(n),i=0,n,t;iepsilon)){}else if(!(Math.abs(y01*x21-y21*x01)>epsilon)||!r){this._+="L"+(this._x1=x1)+","+(this._y1=y1)}else{var x20=x2-x0,y20=y2-y0,l21_2=x21*x21+y21*y21,l20_2=x20*x20+y20*y20,l21=Math.sqrt(l21_2),l01=Math.sqrt(l01_2),l=r*Math.tan((pi-Math.acos((l21_2+l01_2-l20_2)/(2*l21*l01)))/2),t01=l/l01,t21=l/l21;if(Math.abs(t01-1)>epsilon){this._+="L"+(x1+t01*x01)+","+(y1+t01*y01)}this._+="A"+r+","+r+",0,0,"+ +(y01*x20>x01*y20)+","+(this._x1=x1+t21*x21)+","+(this._y1=y1+t21*y21)}},arc:function(x,y,r,a0,a1,ccw){x=+x,y=+y,r=+r;var dx=r*Math.cos(a0),dy=r*Math.sin(a0),x0=x+dx,y0=y+dy,cw=1^ccw,da=ccw?a0-a1:a1-a0;if(r<0)throw new Error("negative radius: "+r);if(this._x1===null){this._+="M"+x0+","+y0}else if(Math.abs(this._x1-x0)>epsilon||Math.abs(this._y1-y0)>epsilon){this._+="L"+x0+","+y0}if(!r)return;if(da<0)da=da%tau+tau;if(da>tauEpsilon){this._+="A"+r+","+r+",0,1,"+cw+","+(x-dx)+","+(y-dy)+"A"+r+","+r+",0,1,"+cw+","+(this._x1=x0)+","+(this._y1=y0)}else if(da>epsilon){this._+="A"+r+","+r+",0,"+ +(da>=pi)+","+cw+","+(this._x1=x+r*Math.cos(a1))+","+(this._y1=y+r*Math.sin(a1))}},rect:function(x,y,w,h){this._+="M"+(this._x0=this._x1=+x)+","+(this._y0=this._y1=+y)+"h"+ +w+"v"+ +h+"h"+-w+"Z"},toString:function(){return this._}};var src_path=path;__webpack_require__.d(__webpack_exports__,"path",function(){return src_path})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var d3_selection=__webpack_require__(1);var d3_dispatch=__webpack_require__(5);var d3_timer=__webpack_require__(10);var emptyOn=Object(d3_dispatch["a"])("start","end","interrupt");var emptyTween=[];var CREATED=0;var SCHEDULED=1;var STARTING=2;var STARTED=3;var RUNNING=4;var ENDING=5;var ENDED=6;var transition_schedule=function(node,name,id,index,group,timing){var schedules=node.__transition;if(!schedules)node.__transition={};else if(id in schedules)return;create(node,id,{name,index,group,on:emptyOn,tween:emptyTween,time:timing.time,delay:timing.delay,duration:timing.duration,ease:timing.ease,timer:null,state:CREATED})};function init(node,id){var schedule=get(node,id);if(schedule.state>CREATED)throw new Error("too late; already scheduled");return schedule}function set(node,id){var schedule=get(node,id);if(schedule.state>STARTING)throw new Error("too late; already started");return schedule}function get(node,id){var schedule=node.__transition;if(!schedule||!(schedule=schedule[id]))throw new Error("transition not found");return schedule}function create(node,id,self){var schedules=node.__transition,tween;schedules[id]=self;self.timer=Object(d3_timer["c"])(schedule,0,self.time);function schedule(elapsed){self.state=SCHEDULED;self.timer.restart(start,self.delay,self.time);if(self.delay<=elapsed)start(elapsed-self.delay)}function start(elapsed){var i,j,n,o;if(self.state!==SCHEDULED)return stop();for(i in schedules){o=schedules[i];if(o.name!==self.name)continue;if(o.state===STARTED)return Object(d3_timer["b"])(start);if(o.state===RUNNING){o.state=ENDED;o.timer.stop();o.on.call("interrupt",node,node.__data__,o.index,o.group);delete schedules[i]}else if(+iSTARTING&&schedule.state=0)t=t.slice(0,i);return!t||t==="start"})}function onFunction(id,name,listener){var on0,on1,sit=on_start(name)?init:set;return function(){var schedule=sit(this,id),on=schedule.on;if(on!==on0)(on1=(on0=on).copy()).on(name,listener);schedule.on=on1}}var on=function(name,listener){var id=this._id;return arguments.length<2?get(this.node(),id).on.on(name):this.each(onFunction(id,name,listener))};function removeFunction(id){return function(){var parent=this.parentNode;for(var i in this.__transition)if(+i!==id)return;if(parent)parent.removeChild(this)}}var remove=function(){return this.on("end.remove",removeFunction(this._id))};var transition_select=function(select){var name=this._name,id=this._id;if(typeof select!=="function")select=Object(d3_selection["selector"])(select);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;jSCHEDULED&&schedule.name===name){return new Transition([[node]],root,name,+i)}}}return null};__webpack_require__.d(__webpack_exports__,"transition",function(){return src_transition_transition});__webpack_require__.d(__webpack_exports__,"active",function(){return src_active});__webpack_require__.d(__webpack_exports__,"interrupt",function(){return interrupt})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var formatDecimal=function(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;var i,coefficient=x.slice(0,i);return[coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)]};var src_exponent=function(x){return x=formatDecimal(Math.abs(x)),x?x[1]:NaN};var formatGroup=function(grouping,thousands){return function(value,width){var i=value.length,t=[],j=0,g=grouping[0],length=0;while(i>0&&g>0){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;g=grouping[j=(j+1)%grouping.length]}return t.reverse().join(thousands)}};var formatNumerals=function(numerals){return function(value){return value.replace(/[0-9]/g,function(i){return numerals[+i]})}};var re=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(specifier){return new FormatSpecifier(specifier)}formatSpecifier.prototype=FormatSpecifier.prototype;function FormatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match;this.fill=match[1]||" ";this.align=match[2]||">";this.sign=match[3]||"-";this.symbol=match[4]||"";this.zero=!!match[5];this.width=match[6]&&+match[6];this.comma=!!match[7];this.precision=match[8]&&+match[8].slice(1);this.trim=!!match[9];this.type=match[10]||""}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width==null?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision==null?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};var formatTrim=function(s){out:for(var n=s.length,i=1,i0=-1,i1;i0){if(!+s[i])break out;i0=0}break}}return i0>0?s.slice(0,i0)+s.slice(i1+1):s};var prefixExponent;var formatPrefixAuto=function(x,p){var d=formatDecimal(x,p);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,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimal(x,Math.max(0,p+i-1))[0]};var formatRounded=function(x,p){var d=formatDecimal(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0")};var formatTypes={"%":function(x,p){return(x*100).toFixed(p)},b:function(x){return Math.round(x).toString(2)},c:function(x){return x+""},d:function(x){return Math.round(x).toString(10)},e:function(x,p){return x.toExponential(p)},f:function(x,p){return x.toFixed(p)},g:function(x,p){return x.toPrecision(p)},o:function(x){return Math.round(x).toString(8)},p:function(x,p){return formatRounded(x*100,p)},r:formatRounded,s:formatPrefixAuto,X:function(x){return Math.round(x).toString(16).toUpperCase()},x:function(x){return Math.round(x).toString(16)}};var identity=function(x){return x};var prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];var src_locale=function(locale){var group=locale.grouping&&locale.thousands?formatGroup(locale.grouping,locale.thousands):identity,currency=locale.currency,decimal=locale.decimal,numerals=locale.numerals?formatNumerals(locale.numerals):identity,percent=locale.percent||"%";function newFormat(specifier){specifier=formatSpecifier(specifier);var fill=specifier.fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,trim=specifier.trim,type=specifier.type;if(type==="n")comma=true,type="g";else if(!formatTypes[type])precision==null&&(precision=12),trim=true,type="g";if(zero||fill==="0"&&align==="=")zero=true,fill="0",align="=";var prefix=symbol==="$"?currency[0]:symbol==="#"&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix=symbol==="$"?currency[1]:/[%p]/.test(type)?percent:"";var formatType=formatTypes[type],maybeSuffix=/[defgprs%]/.test(type);precision=precision==null?6:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision));function format(value){var valuePrefix=prefix,valueSuffix=suffix,i,n,c;if(type==="c"){valueSuffix=formatType(value)+valueSuffix;value=""}else{value=+value;var valueNegative=value<0;value=formatType(Math.abs(value),precision);if(trim)value=formatTrim(value);if(valueNegative&&+value===0)valueNegative=false;valuePrefix=(valueNegative?sign==="("?sign:"-":sign==="-"||sign==="("?"":sign)+valuePrefix;valueSuffix=(type==="s"?prefixes[8+prefixExponent/3]:"")+valueSuffix+(valueNegative&&sign==="("?")":"");if(maybeSuffix){i=-1,n=value.length;while(++ic||c>57){valueSuffix=(c===46?decimal+value.slice(i+1):value.slice(i))+valueSuffix;value=value.slice(0,i);break}}}}if(comma&&!zero)value=group(value,Infinity);var length=valuePrefix.length+value.length+valueSuffix.length,padding=length>1)+valuePrefix+value+valueSuffix+padding.slice(length);break;default:value=padding+valuePrefix+value+valueSuffix;break}return numerals(value)}format.toString=function(){return specifier+""};return format}function formatPrefix(specifier,value){var f=newFormat((specifier=formatSpecifier(specifier),specifier.type="f",specifier)),e=Math.max(-8,Math.min(8,Math.floor(src_exponent(value)/3)))*3,k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix}}return{format:newFormat,formatPrefix}};var defaultLocale_locale;var defaultLocale_format;var defaultLocale_formatPrefix;defaultLocale({decimal:".",thousands:",",grouping:[3],currency:["$",""]});function defaultLocale(definition){defaultLocale_locale=src_locale(definition);defaultLocale_format=defaultLocale_locale.format;defaultLocale_formatPrefix=defaultLocale_locale.formatPrefix;return defaultLocale_locale}var precisionFixed=function(step){return Math.max(0,-src_exponent(Math.abs(step)))};var precisionPrefix=function(step,value){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(src_exponent(value)/3)))*3-src_exponent(Math.abs(step)))};var precisionRound=function(step,max){step=Math.abs(step),max=Math.abs(max)-step;return Math.max(0,src_exponent(max)-src_exponent(step))+1};__webpack_require__.d(__webpack_exports__,"formatDefaultLocale",function(){return defaultLocale});__webpack_require__.d(__webpack_exports__,"format",function(){return defaultLocale_format});__webpack_require__.d(__webpack_exports__,"formatPrefix",function(){return defaultLocale_formatPrefix});__webpack_require__.d(__webpack_exports__,"formatLocale",function(){return src_locale});__webpack_require__.d(__webpack_exports__,"formatSpecifier",function(){return formatSpecifier});__webpack_require__.d(__webpack_exports__,"precisionFixed",function(){return precisionFixed});__webpack_require__.d(__webpack_exports__,"precisionPrefix",function(){return precisionPrefix});__webpack_require__.d(__webpack_exports__,"precisionRound",function(){return precisionRound})},function(module,__webpack_exports__,__webpack_require__){"use strict";var prefix="$";function Map(){}Map.prototype=map.prototype={constructor:Map,has:function(key){return prefix+key in this},get:function(key){return this[prefix+key]},set:function(key,value){this[prefix+key]=value;return this},remove:function(key){var property=prefix+key;return property in this&&delete this[property]},clear:function(){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));return keys},values:function(){var values=[];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]});return entries},size:function(){var size=0;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;return true},each:function(f){for(var property in this)if(property[0]===prefix)f(this[property],property.slice(1),this)}};function map(object,f){var map=new Map;if(object instanceof Map)object.each(function(value,key){map.set(key,value)});else if(Array.isArray(object)){var i=-1,n=object.length,o;if(f==null)while(++i=keys.length){if(sortValues!=null)array.sort(sortValues);return rollup!=null?rollup(array):array}var i=-1,n=array.length,key=keys[depth++],keyValue,value,valuesByKey=src_map(),values,result=createResult();while(++ikeys.length)return map;var array,sortKey=sortKeys[depth-1];if(rollup!=null&&depth>=keys.length)array=map.entries();else array=[],map.each(function(v,k){array.push({key:k,values:entries(v,depth)})});return sortKey!=null?array.sort(function(a,b){return sortKey(a.key,b.key)}):array}return nest={object:function(array){return apply(array,0,createObject,setObject)},map:function(array){return apply(array,0,createMap,setMap)},entries:function(array){return entries(apply(array,0,createMap,setMap),0)},key:function(d){keys.push(d);return nest},sortKeys:function(order){sortKeys[keys.length-1]=order;return nest},sortValues:function(order){sortValues=order;return nest},rollup:function(f){rollup=f;return nest}}};function createObject(){return{}}function setObject(object,key,value){object[key]=value}function createMap(){return src_map()}function setMap(map,key,value){map.set(key,value)}function Set(){}var proto=src_map.prototype;Set.prototype=set.prototype={constructor:Set,has:proto.has,add:function(value){value+="";this[prefix+value]=value;return this},remove:proto.remove,clear:proto.clear,values:proto.keys,size:proto.size,empty:proto.empty,each:proto.each};function set(object,f){var set=new Set;if(object instanceof Set)object.each(function(value){set.add(value)});else if(object){var i=-1,n=object.length;if(f==null)while(++i=0)t._call.call(null,e);t=t._next}--timer_frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew;timer_frame=timeout=0;try{timerFlush()}finally{timer_frame=0;nap();clockNow=0}}function poke(){var now=clock.now(),delay=now-clockLast;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;t0=t1,t1=t1._next}else{t2=t1._next,t1._next=null;t1=t0?t0._next=t2:taskHead=t2}}taskTail=t0;sleep(time)}function sleep(time){if(timer_frame)return;if(timeout)timeout=clearTimeout(timeout);var delay=time-clockNow;if(delay>24){if(timeclickDistance2}gestures.mouse("drag")}function mouseupped(){Object(d3_selection["select"])(d3_selection["event"].view).on("mousemove.drag mouseup.drag",null);yesdrag(d3_selection["event"].view,mousemoving);noevent();gestures.mouse("end")}function touchstarted(){if(!filter.apply(this,arguments))return;var touches=d3_selection["event"].changedTouches,c=container.apply(this,arguments),n=touches.length,i,gesture;for(i=0;i=N)eof=true;else if((c=text.charCodeAt(I++))===NEWLINE)eol=true;else if(c===RETURN){eol=true;if(text.charCodeAt(I)===NEWLINE)++I}return text.slice(j+1,i-1).replace(/""/g,'"')}while(IMath.abs(point1[1]-point[1]))lockY=true;else lockX=true}point=point1;moving=true;noevent();move()}function move(){var t;dx=point[0]-point0[0];dy=point[1]-point0[1];switch(mode){case MODE_SPACE:case MODE_DRAG:{if(signX)dx=Math.max(W-w0,Math.min(E-e0,dx)),w1=w0+dx,e1=e0+dx;if(signY)dy=Math.max(N-n0,Math.min(S-s0,dy)),n1=n0+dy,s1=s0+dy;break}case MODE_HANDLE:{if(signX<0)dx=Math.max(W-w0,Math.min(E-w0,dx)),w1=w0+dx,e1=e0;else if(signX>0)dx=Math.max(W-e0,Math.min(E-e0,dx)),w1=w0,e1=e0+dx;if(signY<0)dy=Math.max(N-n0,Math.min(S-n0,dy)),n1=n0+dy,s1=s0;else if(signY>0)dy=Math.max(N-s0,Math.min(S-s0,dy)),n1=n0,s1=s0+dy;break}case MODE_CENTER:{if(signX)w1=Math.max(W,Math.min(E,w0-dx*signX)),e1=Math.max(W,Math.min(E,e0+dx*signX));if(signY)n1=Math.max(N,Math.min(S,n0-dy*signY)),s1=Math.max(N,Math.min(S,s0+dy*signY));break}}if(e10)w0=w1-dx;if(signY<0)s0=s1-dy;else if(signY>0)n0=n1-dy;mode=MODE_SPACE;overlay.attr("cursor",cursors.selection);move()}break}default:return}noevent()}function keyupped(){switch(d3_selection["event"].keyCode){case 16:{if(shifting){lockX=lockY=shifting=false;move()}break}case 18:{if(mode===MODE_CENTER){if(signX<0)e0=e1;else if(signX>0)w0=w1;if(signY<0)s0=s1;else if(signY>0)n0=n1;mode=MODE_HANDLE;move()}break}case 32:{if(mode===MODE_SPACE){if(d3_selection["event"].altKey){if(signX)e0=e1-dx*signX,w0=w1+dx*signX;if(signY)s0=s1-dy*signY,n0=n1+dy*signY;mode=MODE_CENTER}else{if(signX<0)e0=e1;else if(signX>0)w0=w1;if(signY<0)s0=s1;else if(signY>0)n0=n1;mode=MODE_HANDLE}overlay.attr("cursor",cursors[type]);move()}break}default:return}noevent()}}function initialize(){var state=this.__brush||{selection:null};state.extent=extent.apply(this,arguments);state.dim=dim;return state}brush.extent=function(_){return arguments.length?(extent=typeof _==="function"?_:constant([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),brush):extent};brush.filter=function(_){return arguments.length?(filter=typeof _==="function"?_:constant(!!_),brush):filter};brush.handleSize=function(_){return arguments.length?(handleSize=+_,brush):handleSize};brush.on=function(){var value=listeners.on.apply(listeners,arguments);return value===listeners?brush:value};return brush}__webpack_require__.d(__webpack_exports__,"brush",function(){return src_brush});__webpack_require__.d(__webpack_exports__,"brushX",function(){return brushX});__webpack_require__.d(__webpack_exports__,"brushY",function(){return brushY});__webpack_require__.d(__webpack_exports__,"brushSelection",function(){return brushSelection})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var d3_selection=__webpack_require__(1);var d3_transition=__webpack_require__(7);function attrsFunction(selection,map){return selection.each(function(){var x=map.apply(this,arguments),s=Object(d3_selection["select"])(this);for(var name in x)s.attr(name,x[name])})}function attrsObject(selection,map){for(var name in map)selection.attr(name,map[name]);return selection}var attrs=function(map){return(typeof map==="function"?attrsFunction:attrsObject)(this,map)};function stylesFunction(selection,map,priority){return selection.each(function(){var x=map.apply(this,arguments),s=Object(d3_selection["select"])(this);for(var name in x)s.style(name,x[name],priority)})}function stylesObject(selection,map,priority){for(var name in map)selection.style(name,map[name],priority);return selection}var styles=function(map,priority){return(typeof map==="function"?stylesFunction:stylesObject)(this,map,priority==null?"":priority)};function propertiesFunction(selection,map){return selection.each(function(){var x=map.apply(this,arguments),s=Object(d3_selection["select"])(this);for(var name in x)s.property(name,x[name])})}function propertiesObject(selection,map){for(var name in map)selection.property(name,map[name]);return selection}var properties=function(map){return(typeof map==="function"?propertiesFunction:propertiesObject)(this,map)};function attrs_attrsFunction(transition,map){return transition.each(function(){var x=map.apply(this,arguments),t=Object(d3_selection["select"])(this).transition(transition);for(var name in x)t.attr(name,x[name])})}function attrs_attrsObject(transition,map){for(var name in map)transition.attr(name,map[name]);return transition}var transition_attrs=function(map){return(typeof map==="function"?attrs_attrsFunction:attrs_attrsObject)(this,map)};function styles_stylesFunction(transition,map,priority){return transition.each(function(){var x=map.apply(this,arguments),t=Object(d3_selection["select"])(this).transition(transition);for(var name in x)t.style(name,x[name],priority)})}function styles_stylesObject(transition,map,priority){for(var name in map)transition.style(name,map[name],priority);return transition}var transition_styles=function(map,priority){return(typeof map==="function"?styles_stylesFunction:styles_stylesObject)(this,map,priority==null?"":priority)};d3_selection["selection"].prototype.attrs=attrs;d3_selection["selection"].prototype.styles=styles;d3_selection["selection"].prototype.properties=properties;d3_transition["transition"].prototype.attrs=transition_attrs;d3_transition["transition"].prototype.styles=transition_styles},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var d3_dispatch=__webpack_require__(5);var d3_drag=__webpack_require__(11);var d3_interpolate=__webpack_require__(4);var d3_selection=__webpack_require__(1);var d3_transition=__webpack_require__(7);var constant=function(x){return function(){return x}};function ZoomEvent(target,type,transform){this.target=target;this.type=type;this.transform=transform}function Transform(k,x,y){this.k=k;this.x=x;this.y=y}Transform.prototype={constructor:Transform,scale:function(k){return k===1?this:new Transform(this.k*k,this.x,this.y)},translate:function(x,y){return x===0&y===0?this:new Transform(this.k,this.x+this.k*x,this.y+this.k*y)},apply:function(point){return[point[0]*this.k+this.x,point[1]*this.k+this.y]},applyX:function(x){return x*this.k+this.x},applyY:function(y){return y*this.k+this.y},invert:function(location){return[(location[0]-this.x)/this.k,(location[1]-this.y)/this.k]},invertX:function(x){return(x-this.x)/this.k},invertY:function(y){return(y-this.y)/this.k},rescaleX:function(x){return x.copy().domain(x.range().map(this.invertX,this).map(x.invert,x))},rescaleY:function(y){return y.copy().domain(y.range().map(this.invertY,this).map(y.invert,y))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity=new Transform(1,0,0);transform_transform.prototype=Transform.prototype;function transform_transform(node){return node.__zoom||identity}function nopropagation(){d3_selection["event"].stopImmediatePropagation()}var noevent=function(){d3_selection["event"].preventDefault();d3_selection["event"].stopImmediatePropagation()};function defaultFilter(){return!d3_selection["event"].button}function defaultExtent(){var e=this,w,h;if(e instanceof SVGElement){e=e.ownerSVGElement||e;w=e.width.baseVal.value;h=e.height.baseVal.value}else{w=e.clientWidth;h=e.clientHeight}return[[0,0],[w,h]]}function defaultTransform(){return this.__zoom||identity}function defaultWheelDelta(){return-d3_selection["event"].deltaY*(d3_selection["event"].deltaMode?120:1)/500}function defaultTouchable(){return"ontouchstart"in this}function defaultConstrain(transform,extent,translateExtent){var dx0=transform.invertX(extent[0][0])-translateExtent[0][0],dx1=transform.invertX(extent[1][0])-translateExtent[1][0],dy0=transform.invertY(extent[0][1])-translateExtent[0][1],dy1=transform.invertY(extent[1][1])-translateExtent[1][1];return transform.translate(dx1>dx0?(dx0+dx1)/2:Math.min(0,dx0)||Math.max(0,dx1),dy1>dy0?(dy0+dy1)/2:Math.min(0,dy0)||Math.max(0,dy1))}var src_zoom=function(){var filter=defaultFilter,extent=defaultExtent,constrain=defaultConstrain,wheelDelta=defaultWheelDelta,touchable=defaultTouchable,scaleExtent=[0,Infinity],translateExtent=[[-Infinity,-Infinity],[Infinity,Infinity]],duration=250,interpolate=d3_interpolate["interpolateZoom"],gestures=[],listeners=Object(d3_dispatch["a"])("start","zoom","end"),touchstarting,touchending,touchDelay=500,wheelDelay=150,clickDistance2=0;function zoom(selection){selection.property("__zoom",defaultTransform).on("wheel.zoom",wheeled).on("mousedown.zoom",mousedowned).on("dblclick.zoom",dblclicked).filter(touchable).on("touchstart.zoom",touchstarted).on("touchmove.zoom",touchmoved).on("touchend.zoom touchcancel.zoom",touchended).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}zoom.transform=function(collection,transform){var selection=collection.selection?collection.selection():collection;selection.property("__zoom",defaultTransform);if(collection!==selection){schedule(collection,transform)}else{selection.interrupt().each(function(){gesture(this,arguments).start().zoom(null,typeof transform==="function"?transform.apply(this,arguments):transform).end()})}};zoom.scaleBy=function(selection,k){zoom.scaleTo(selection,function(){var k0=this.__zoom.k,k1=typeof k==="function"?k.apply(this,arguments):k;return k0*k1})};zoom.scaleTo=function(selection,k){zoom.transform(selection,function(){var e=extent.apply(this,arguments),t0=this.__zoom,p0=centroid(e),p1=t0.invert(p0),k1=typeof k==="function"?k.apply(this,arguments):k;return constrain(translate(scale(t0,k1),p0,p1),e,translateExtent)})};zoom.translateBy=function(selection,x,y){zoom.transform(selection,function(){return constrain(this.__zoom.translate(typeof x==="function"?x.apply(this,arguments):x,typeof y==="function"?y.apply(this,arguments):y),extent.apply(this,arguments),translateExtent)})};zoom.translateTo=function(selection,x,y){zoom.transform(selection,function(){var e=extent.apply(this,arguments),t=this.__zoom,p=centroid(e);return constrain(identity.translate(p[0],p[1]).scale(t.k).translate(typeof x==="function"?-x.apply(this,arguments):-x,typeof y==="function"?-y.apply(this,arguments):-y),e,translateExtent)})};function scale(transform,k){k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],k));return k===transform.k?transform:new Transform(k,transform.x,transform.y)}function translate(transform,p0,p1){var x=p0[0]-p1[0]*transform.k,y=p0[1]-p1[1]*transform.k;return x===transform.x&&y===transform.y?transform:new Transform(transform.k,x,y)}function centroid(extent){return[(+extent[0][0]+ +extent[1][0])/2,(+extent[0][1]+ +extent[1][1])/2]}function schedule(transition,transform,center){transition.on("start.zoom",function(){gesture(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){gesture(this,arguments).end()}).tween("zoom",function(){var that=this,args=arguments,g=gesture(that,args),e=extent.apply(that,args),p=center||centroid(e),w=Math.max(e[1][0]-e[0][0],e[1][1]-e[0][1]),a=that.__zoom,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;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)}})}function gesture(that,args){for(var i=0,n=gestures.length,g;iclickDistance2}g.zoom("mouse",constrain(translate(g.that.__zoom,g.mouse[0]=Object(d3_selection["mouse"])(g.that),g.mouse[1]),g.extent,translateExtent))}function mouseupped(){v.on("mousemove.zoom mouseup.zoom",null);Object(d3_drag["dragEnable"])(d3_selection["event"].view,g.moved);noevent();g.end()}}function dblclicked(){if(!filter.apply(this,arguments))return;var t0=this.__zoom,p0=Object(d3_selection["mouse"])(this),p1=t0.invert(p0),k1=t0.k*(d3_selection["event"].shiftKey?.5:2),t1=constrain(translate(scale(t0,k1),p0,p1),extent.apply(this,arguments),translateExtent);noevent();if(duration>0)Object(d3_selection["select"])(this).transition().duration(duration).call(schedule,t1,p0);else Object(d3_selection["select"])(this).call(zoom.transform,t1)}function touchstarted(){if(!filter.apply(this,arguments))return;var g=gesture(this,arguments),touches=d3_selection["event"].changedTouches,started,n=touches.length,i,t,p;nopropagation();for(i=0;i1&&cross(points[indexes[size-2]],points[indexes[size-1]],points[i])<=0)--size;indexes[size++]=i}return indexes.slice(0,size)}var hull=function(points){if((n=points.length)<3)return null;var i,n,sortedPoints=new Array(n),flippedPoints=new Array(n);for(i=0;i=0;--i)hull.push(points[sortedPoints[upperIndexes[i]][2]]);for(i=+skipLeft;iy!==y0>y&&x<(x0-x1)*(y-y1)/(y0-y1)+x1)inside=!inside;x0=x1,y0=y1}return inside};var src_length=function(polygon){var i=-1,n=polygon.length,b=polygon[n-1],xa,ya,xb=b[0],yb=b[1],perimeter=0;while(++i3&&respond(o)};function respond(o){var status=xhr.status,result;if(!status&&hasResponse(xhr)||status>=200&&status<300||status===304){if(response){try{result=response.call(request,xhr)}catch(e){event.call("error",request,e);return}}else{result=xhr}event.call("load",request,result)}else{event.call("error",request,o)}}xhr.onprogress=function(e){event.call("progress",request,e)};request={header:function(name,value){name=(name+"").toLowerCase();if(arguments.length<2)return headers.get(name);if(value==null)headers.remove(name);else headers.set(name,value+"");return request},mimeType:function(value){if(!arguments.length)return mimeType;mimeType=value==null?null:value+"";return request},responseType:function(value){if(!arguments.length)return responseType;responseType=value;return request},timeout:function(value){if(!arguments.length)return timeout;timeout=+value;return request},user:function(value){return arguments.length<1?user:(user=value==null?null:value+"",request)},password:function(value){return arguments.length<1?password:(password=value==null?null:value+"",request)},response:function(value){response=value;return request},get:function(data,callback){return request.send("GET",data,callback)},post:function(data,callback){return request.send("POST",data,callback)},send:function(method,data,callback){xhr.open(method,url,true,user,password);if(mimeType!=null&&!headers.has("accept"))headers.set("accept",mimeType+",*/*");if(xhr.setRequestHeader)headers.each(function(value,name){xhr.setRequestHeader(name,value)});if(mimeType!=null&&xhr.overrideMimeType)xhr.overrideMimeType(mimeType);if(responseType!=null)xhr.responseType=responseType;if(timeout>0)xhr.timeout=timeout;if(callback==null&&typeof data==="function")callback=data,data=null;if(callback!=null&&callback.length===1)callback=fixCallback(callback);if(callback!=null)request.on("error",callback).on("load",function(xhr){callback(null,xhr)});event.call("beforesend",request,xhr);xhr.send(data==null?null:data);return request},abort:function(){xhr.abort();return request},on:function(){var value=event.on.apply(event,arguments);return value===event?request:value}};if(callback!=null){if(typeof callback!=="function")throw new Error("invalid callback: "+callback);return request.get(callback)}return request};function fixCallback(callback){return function(error,xhr){callback(error==null?xhr:null)}}function hasResponse(xhr){var type=xhr.responseType;return type&&type!=="text"?xhr.response:xhr.responseText}var type=function(defaultMimeType,response){return function(url,callback){var r=src_request(url).mimeType(defaultMimeType).response(response);if(callback!=null){if(typeof callback!=="function")throw new Error("invalid callback: "+callback);return r.get(callback)}return r}};var html=type("text/html",function(xhr){return document.createRange().createContextualFragment(xhr.responseText)});var json=type("application/json",function(xhr){return JSON.parse(xhr.responseText)});var src_text=type("text/plain",function(xhr){return xhr.responseText});var xml=type("application/xml",function(xhr){var xml=xhr.responseXML;if(!xml)throw new Error("parse error");return xml});var d3_dsv=__webpack_require__(12);var dsv=function(defaultMimeType,parse){return function(url,row,callback){if(arguments.length<3)callback=row,row=null;var r=src_request(url).mimeType(defaultMimeType);r.row=function(_){return arguments.length?r.response(responseOf(parse,row=_)):row};r.row(row);return callback?r.get(callback):r}};function responseOf(parse,row){return function(request){return parse(request.responseText,row)}}var csv=dsv("text/csv",d3_dsv["csvParse"]);var tsv=dsv("text/tab-separated-values",d3_dsv["tsvParse"]);__webpack_require__.d(__webpack_exports__,"request",function(){return src_request});__webpack_require__.d(__webpack_exports__,"html",function(){return html});__webpack_require__.d(__webpack_exports__,"json",function(){return json});__webpack_require__.d(__webpack_exports__,"text",function(){return src_text});__webpack_require__.d(__webpack_exports__,"xml",function(){return xml});__webpack_require__.d(__webpack_exports__,"csv",function(){return csv});__webpack_require__.d(__webpack_exports__,"tsv",function(){return tsv})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var constant=function(x){return function(){return x}};function point_x(d){return d[0]}function point_y(d){return d[1]}function RedBlackTree(){this._=null}function RedBlackNode(node){node.U=node.C=node.L=node.R=node.P=node.N=null}RedBlackTree.prototype={constructor:RedBlackTree,insert:function(after,node){var parent,grandpa,uncle;if(after){node.P=after;node.N=after.N;if(after.N)after.N.P=node;after.N=node;if(after.R){after=after.R;while(after.L)after=after.L;after.L=node}else{after.R=node}parent=after}else if(this._){after=RedBlackFirst(this._);node.P=null;node.N=after;after.P=after.L=node;parent=after}else{node.P=node.N=null;this._=node;parent=null}node.L=node.R=null;node.U=parent;node.C=true;after=node;while(parent&&parent.C){grandpa=parent.U;if(parent===grandpa.L){uncle=grandpa.R;if(uncle&&uncle.C){parent.C=uncle.C=false;grandpa.C=true;after=grandpa}else{if(after===parent.R){RedBlackRotateLeft(this,parent);after=parent;parent=after.U}parent.C=false;grandpa.C=true;RedBlackRotateRight(this,grandpa)}}else{uncle=grandpa.L;if(uncle&&uncle.C){parent.C=uncle.C=false;grandpa.C=true;after=grandpa}else{if(after===parent.L){RedBlackRotateRight(this,parent);after=parent;parent=after.U}parent.C=false;grandpa.C=true;RedBlackRotateLeft(this,grandpa)}}parent=after.U}this._.C=false},remove:function(node){if(node.N)node.N.P=node.P;if(node.P)node.P.N=node.N;node.N=node.P=null;var parent=node.U,sibling,left=node.L,right=node.R,next,red;if(!left)next=right;else if(!right)next=left;else next=RedBlackFirst(right);if(parent){if(parent.L===node)parent.L=next;else parent.R=next}else{this._=next}if(left&&right){red=next.C;next.C=node.C;next.L=left;left.U=next;if(next!==right){parent=next.U;next.U=node.U;node=next.R;parent.L=node;next.R=right;right.U=next}else{next.U=parent;parent=next;node=next.R}}else{red=node.C;node=next}if(node)node.U=parent;if(red)return;if(node&&node.C){node.C=false;return}do{if(node===this._)break;if(node===parent.L){sibling=parent.R;if(sibling.C){sibling.C=false;parent.C=true;RedBlackRotateLeft(this,parent);sibling=parent.R}if(sibling.L&&sibling.L.C||sibling.R&&sibling.R.C){if(!sibling.R||!sibling.R.C){sibling.L.C=false;sibling.C=true;RedBlackRotateRight(this,sibling);sibling=parent.R}sibling.C=parent.C;parent.C=sibling.R.C=false;RedBlackRotateLeft(this,parent);node=this._;break}}else{sibling=parent.L;if(sibling.C){sibling.C=false;parent.C=true;RedBlackRotateRight(this,parent);sibling=parent.L}if(sibling.L&&sibling.L.C||sibling.R&&sibling.R.C){if(!sibling.L||!sibling.L.C){sibling.R.C=false;sibling.C=true;RedBlackRotateLeft(this,sibling);sibling=parent.L}sibling.C=parent.C;parent.C=sibling.L.C=false;RedBlackRotateRight(this,parent);node=this._;break}}sibling.C=true;node=parent;parent=parent.U}while(!node.C);if(node)node.C=false}};function RedBlackRotateLeft(tree,node){var p=node,q=node.R,parent=p.U;if(parent){if(parent.L===p)parent.L=q;else parent.R=q}else{tree._=q}q.U=parent;p.U=q;p.R=q.L;if(p.R)p.R.U=p;q.L=p}function RedBlackRotateRight(tree,node){var p=node,q=node.L,parent=p.U;if(parent){if(parent.L===p)parent.L=q;else parent.R=q}else{tree._=q}q.U=parent;p.U=q;p.L=q.R;if(p.L)p.L.U=p;q.R=p}function RedBlackFirst(node){while(node.L)node=node.L;return node}var src_RedBlackTree=RedBlackTree;function createEdge(left,right,v0,v1){var edge=[null,null],index=Diagram_edges.push(edge)-1;edge.left=left;edge.right=right;if(v0)setEdgeEnd(edge,left,right,v0);if(v1)setEdgeEnd(edge,right,left,v1);cells[left.index].halfedges.push(index);cells[right.index].halfedges.push(index);return edge}function createBorderEdge(left,v0,v1){var edge=[v0,v1];edge.left=left;return edge}function setEdgeEnd(edge,left,right,vertex){if(!edge[0]&&!edge[1]){edge[0]=vertex;edge.left=left;edge.right=right}else if(edge.left===right){edge[1]=vertex}else{edge[0]=vertex}}function clipEdge(edge,x0,y0,x1,y1){var a=edge[0],b=edge[1],ax=a[0],ay=a[1],bx=b[0],by=b[1],t0=0,t1=1,dx=bx-ax,dy=by-ay,r;r=x0-ax;if(!dx&&r>0)return;r/=dx;if(dx<0){if(r0){if(r>t1)return;if(r>t0)t0=r}r=x1-ax;if(!dx&&r<0)return;r/=dx;if(dx<0){if(r>t1)return;if(r>t0)t0=r}else if(dx>0){if(r0)return;r/=dy;if(dy<0){if(r0){if(r>t1)return;if(r>t0)t0=r}r=y1-ay;if(!dy&&r<0)return;r/=dy;if(dy<0){if(r>t1)return;if(r>t0)t0=r}else if(dy>0){if(r0)&&!(t1<1))return true;if(t0>0)edge[0]=[ax+t0*dx,ay+t0*dy];if(t1<1)edge[1]=[ax+t1*dx,ay+t1*dy];return true}function connectEdge(edge,x0,y0,x1,y1){var v1=edge[1];if(v1)return true;var v0=edge[0],left=edge.left,right=edge.right,lx=left[0],ly=left[1],rx=right[0],ry=right[1],fx=(lx+rx)/2,fy=(ly+ry)/2,fm,fb;if(ry===ly){if(fx=x1)return;if(lx>rx){if(!v0)v0=[fx,y0];else if(v0[1]>=y1)return;v1=[fx,y1]}else{if(!v0)v0=[fx,y1];else if(v0[1]1){if(lx>rx){if(!v0)v0=[(y0-fb)/fm,y0];else if(v0[1]>=y1)return;v1=[(y1-fb)/fm,y1]}else{if(!v0)v0=[(y1-fb)/fm,y1];else if(v0[1]=x1)return;v1=[x1,fm*x1+fb]}else{if(!v0)v0=[x1,fm*x1+fb];else if(v0[0]epsilon||Math.abs(edge[0][1]-edge[1][1])>epsilon)){delete Diagram_edges[i]}}}function createCell(site){return cells[site.index]={site,halfedges:[]}}function cellHalfedgeAngle(cell,edge){var site=cell.site,va=edge.left,vb=edge.right;if(site===vb)vb=va,va=site;if(vb)return Math.atan2(vb[1]-va[1],vb[0]-va[0]);if(site===va)va=edge[1],vb=edge[0];else va=edge[0],vb=edge[1];return Math.atan2(va[0]-vb[0],vb[1]-va[1])}function cellHalfedgeStart(cell,edge){return edge[+(edge.left!==cell.site)]}function cellHalfedgeEnd(cell,edge){return edge[+(edge.left===cell.site)]}function sortCellHalfedges(){for(var i=0,n=cells.length,cell,halfedges,j,m;iepsilon||Math.abs(endY-startY)>epsilon){halfedges.splice(iHalfedge,0,Diagram_edges.push(createBorderEdge(site,end,Math.abs(endX-x0)epsilon?[x0,Math.abs(startX-x0)epsilon?[Math.abs(startY-y1)epsilon?[x1,Math.abs(startX-x1)epsilon?[Math.abs(startY-y0)=-epsilon2)return;var ha=ax*ax+ay*ay,hc=cx*cx+cy*cy,x=(cy*ha-ay*hc)/d,y=(ax*hc-cx*ha)/d;var circle=circlePool.pop()||new Circle;circle.arc=arc;circle.site=cSite;circle.x=x+bx;circle.y=(circle.cy=y+by)+Math.sqrt(x*x+y*y);arc.circle=circle;var before=null,node=circles._;while(node){if(circle.yepsilon)node=node.L;else{dxr=x-rightBreakPoint(node,directrix);if(dxr>epsilon){if(!node.R){lArc=node;break}node=node.R}else{if(dxl>-epsilon){lArc=node.P;rArc=node}else if(dxr>-epsilon){lArc=node;rArc=node.N}else{lArc=rArc=node}break}}}createCell(site);var newArc=createBeach(site);beaches.insert(lArc,newArc);if(!lArc&&!rArc)return;if(lArc===rArc){detachCircle(lArc);rArc=createBeach(lArc.site);beaches.insert(newArc,rArc);newArc.edge=rArc.edge=createEdge(lArc.site,newArc.site);attachCircle(lArc);attachCircle(rArc);return}if(!rArc){newArc.edge=createEdge(lArc.site,newArc.site);return}detachCircle(lArc);detachCircle(rArc);var lSite=lArc.site,ax=lSite[0],ay=lSite[1],bx=site[0]-ax,by=site[1]-ay,rSite=rArc.site,cx=rSite[0]-ax,cy=rSite[1]-ay,d=2*(bx*cy-by*cx),hb=bx*bx+by*by,hc=cx*cx+cy*cy,vertex=[(cy*hb-by*hc)/d+ax,(bx*hc-cx*hb)/d+ay];setEdgeEnd(rArc.edge,lSite,rSite,vertex);newArc.edge=createEdge(lSite,site,null,vertex);rArc.edge=createEdge(site,rSite,null,vertex);attachCircle(lArc);attachCircle(rArc)}function leftBreakPoint(arc,directrix){var site=arc.site,rfocx=site[0],rfocy=site[1],pby2=rfocy-directrix;if(!pby2)return rfocx;var lArc=arc.P;if(!lArc)return-Infinity;site=lArc.site;var lfocx=site[0],lfocy=site[1],plby2=lfocy-directrix;if(!plby2)return lfocx;var hl=lfocx-rfocx,aby2=1/pby2-1/plby2,b=hl/plby2;if(aby2)return(-b+Math.sqrt(b*b-2*aby2*(hl*hl/(-2*plby2)-lfocy+plby2/2+rfocy-pby2/2)))/aby2+rfocx;return(rfocx+lfocx)/2}function rightBreakPoint(arc,directrix){var rArc=arc.N;if(rArc)return leftBreakPoint(rArc,directrix);var site=arc.site;return site[1]===directrix?site[0]:Infinity}var epsilon=1e-6;var epsilon2=1e-12;var beaches;var cells;var circles;var Diagram_edges;function triangleArea(a,b,c){return(a[0]-c[0])*(b[1]-a[1])-(a[0]-b[0])*(c[1]-a[1])}function lexicographic(a,b){return b[1]-a[1]||b[0]-a[0]}function Diagram(sites,extent){var site=sites.sort(lexicographic).pop(),x,y,circle;Diagram_edges=[];cells=new Array(sites.length);beaches=new src_RedBlackTree;circles=new src_RedBlackTree;while(true){circle=firstCircle;if(site&&(!circle||site[1]=n)return null;var dx=x-cell.site[0],dy=y-cell.site[1],d2=dx*dx+dy*dy;do{cell=that.cells[i0=i1],i1=null;cell.halfedges.forEach(function(e){var edge=that.edges[e],v=edge.left;if((v===cell.site||!v)&&!(v=edge.right))return;var vx=x-v[0],vy=y-v[1],v2=vx*vx+vy*vy;if(v2=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym;if(parent=node,!(node=node[i=bottom<<1|right]))return parent[i]=leaf,tree}xp=+tree._x.call(null,node.data);yp=+tree._y.call(null,node.data);if(x===xp&&y===yp)return leaf.next=node,parent?parent[i]=leaf:tree._root=leaf,tree;do{parent=parent?parent[i]=new Array(4):tree._root=new Array(4);if(right=x>=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym}while((i=bottom<<1|right)===(j=(yp>=ym)<<1|xp>=xm));return parent[j]=node,parent[i]=leaf,tree}function addAll(data){var d,i,n=data.length,x,y,xz=new Array(n),yz=new Array(n),x0=Infinity,y0=Infinity,x1=-Infinity,y1=-Infinity;for(i=0;ix1)x1=x;if(yy1)y1=y}if(x1x||x>x1||y0>y||y>y1){var z=x1-x0,node=this._root,parent,i;switch(i=(y<(y0+y1)/2)<<1|x<(x0+x1)/2){case 0:{do{parent=new Array(4),parent[i]=node,node=parent}while(z*=2,x1=x0+z,y1=y0+z,x>x1||y>y1);break}case 1:{do{parent=new Array(4),parent[i]=node,node=parent}while(z*=2,x0=x1-z,y1=y0+z,x0>x||y>y1);break}case 2:{do{parent=new Array(4),parent[i]=node,node=parent}while(z*=2,x1=x0+z,y0=y1-z,x>x1||y0>y);break}case 3:{do{parent=new Array(4),parent[i]=node,node=parent}while(z*=2,x0=x1-z,y0=y1-z,x0>x||y0>y);break}}if(this._root&&this._root.length)this._root=node}else return this;this._x0=x0;this._y0=y0;this._x1=x1;this._y1=y1;return this};var src_data=function(){var data=[];this.visit(function(node){if(!node.length)do{data.push(node.data)}while(node=node.next)});return data};var extent=function(_){return arguments.length?this.cover(+_[0][0],+_[0][1]).cover(+_[1][0],+_[1][1]):isNaN(this._x0)?undefined:[[this._x0,this._y0],[this._x1,this._y1]]};var src_quad=function(node,x0,y0,x1,y1){this.node=node;this.x0=x0;this.y0=y0;this.x1=x1;this.y1=y1};var find=function(x,y,radius){var data,x0=this._x0,y0=this._y0,x1,y1,x2,y2,x3=this._x1,y3=this._y1,quads=[],node=this._root,q,i;if(node)quads.push(new src_quad(node,x0,y0,x3,y3));if(radius==null)radius=Infinity;else{x0=x-radius,y0=y-radius;x3=x+radius,y3=y+radius;radius*=radius}while(q=quads.pop()){if(!(node=q.node)||(x1=q.x0)>x3||(y1=q.y0)>y3||(x2=q.x1)=ym)<<1|x>=xm){q=quads[quads.length-1];quads[quads.length-1]=quads[quads.length-1-i];quads[quads.length-1-i]=q}}else{var dx=x-+this._x.call(null,node.data),dy=y-+this._y.call(null,node.data),d2=dx*dx+dy*dy;if(d2=(xm=(x0+x1)/2))x0=xm;else x1=xm;if(bottom=y>=(ym=(y0+y1)/2))y0=ym;else y1=ym;if(!(parent=node,node=node[i=bottom<<1|right]))return this;if(!node.length)break;if(parent[i+1&3]||parent[i+2&3]||parent[i+3&3])retainer=parent,j=i}while(node.data!==d)if(!(previous=node,node=node.next))return this;if(next=node.next)delete node.next;if(previous)return next?previous.next=next:delete previous.next,this;if(!parent)return this._root=next,this;next?parent[i]=next:delete parent[i];if((node=parent[0]||parent[1]||parent[2]||parent[3])&&node===(parent[3]||parent[2]||parent[1]||parent[0])&&!node.length){if(retainer)retainer[j]=node;else this._root=node}return this};function removeAll(data){for(var i=0,n=data.length;inode.index){var x=xi-data.x-data.vx,y=yi-data.y-data.vy,l=x*x+y*y;if(lxi+r||x1yi+r||y1quad.r){quad.r=quad[i].r}}}function initialize(){if(!nodes)return;var i,n=nodes.length,node;radii=new Array(n);for(i=0;i1?(_==null?forces.remove(name):forces.set(name,initializeForce(_)),simulation):forces.get(name)},find:function(x,y,radius){var i=0,n=nodes.length,dx,dy,d2,node,closest;if(radius==null)radius=Infinity;else radius*=radius;for(i=0;i1?(event.on(name,_),simulation):event.on(name)}}};var manyBody=function(){var nodes,node,alpha,strength=constant(-30),strengths,distanceMin2=1,distanceMax2=Infinity,theta2=.81;function force(_){var i,n=nodes.length,tree=quadtree(nodes,simulation_x,simulation_y).visitAfter(accumulate);for(alpha=_,i=0;i=distanceMax2)return;if(quad.data!==node||quad.next){if(x===0)x=jiggle(),l+=x*x;if(y===0)y=jiggle(),l+=y*y;if(l=b?1:d(x)}}}function reinterpolateClamp(reinterpolate){return function(a,b){var r=reinterpolate(a=+a,b=+b);return function(t){return t<=0?a:t>=1?b:r(t)}}}function bimap(domain,range,deinterpolate,reinterpolate){var d0=domain[0],d1=domain[1],r0=range[0],r1=range[1];if(d12?polymap:bimap;output=input=null;return scale}function scale(x){return(output||(output=piecewise(domain,range,clamp?deinterpolateClamp(deinterpolate):deinterpolate,interpolate)))(+x)}scale.invert=function(y){return(input||(input=piecewise(range,domain,deinterpolateLinear,clamp?reinterpolateClamp(reinterpolate):reinterpolate)))(+y)};scale.domain=function(_){return arguments.length?(domain=map.call(_,number),rescale()):domain.slice()};scale.range=function(_){return arguments.length?(range=slice.call(_),rescale()):range.slice()};scale.rangeRound=function(_){return range=slice.call(_),interpolate=d3_interpolate["interpolateRound"],rescale()};scale.clamp=function(_){return arguments.length?(clamp=!!_,rescale()):clamp};scale.interpolate=function(_){return arguments.length?(interpolate=_,rescale()):interpolate};return rescale()}var d3_format=__webpack_require__(8);var src_tickFormat=function(domain,count,specifier){var start=domain[0],stop=domain[domain.length-1],step=Object(d3_array["tickStep"])(start,stop,count==null?10:count),precision;specifier=Object(d3_format["formatSpecifier"])(specifier==null?",f":specifier);switch(specifier.type){case"s":{var value=Math.max(Math.abs(start),Math.abs(stop));if(specifier.precision==null&&!isNaN(precision=Object(d3_format["precisionPrefix"])(step,value)))specifier.precision=precision;return Object(d3_format["formatPrefix"])(specifier,value)}case"":case"e":case"g":case"p":case"r":{if(specifier.precision==null&&!isNaN(precision=Object(d3_format["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=Object(d3_format["precisionFixed"])(step)))specifier.precision=precision-(specifier.type==="%")*2;break}}return Object(d3_format["format"])(specifier)};function linearish(scale){var domain=scale.domain;scale.ticks=function(count){var d=domain();return Object(d3_array["ticks"])(d[0],d[d.length-1],count==null?10:count)};scale.tickFormat=function(count,specifier){return src_tickFormat(domain(),count,specifier)};scale.nice=function(count){if(count==null)count=10;var d=domain(),i0=0,i1=d.length-1,start=d[i0],stop=d[i1],step;if(stop0){start=Math.floor(start/step)*step;stop=Math.ceil(stop/step)*step;step=Object(d3_array["tickIncrement"])(start,stop,count)}else if(step<0){start=Math.ceil(start*step)/step;stop=Math.floor(stop*step)/step;step=Object(d3_array["tickIncrement"])(start,stop,count)}if(step>0){d[i0]=Math.floor(start/step)*step;d[i1]=Math.ceil(stop/step)*step;domain(d)}else if(step<0){d[i0]=Math.ceil(start*step)/step;d[i1]=Math.floor(stop*step)/step;domain(d)}return scale};return scale}function linear(){var scale=continuous(deinterpolateLinear,d3_interpolate["interpolateNumber"]);scale.copy=function(){return copy(scale,linear())};return linearish(scale)}function identity(){var domain=[0,1];function scale(x){return+x}scale.invert=scale;scale.domain=scale.range=function(_){return arguments.length?(domain=map.call(_,number),scale):domain.slice()};scale.copy=function(){return identity().domain(domain)};return linearish(scale)}var nice=function(domain,interval){domain=domain.slice();var i0=0,i1=domain.length-1,x0=domain[i0],x1=domain[i1],t;if(x10)for(;iv)break;z.push(t)}}else for(;i=1;--k){t=p*k;if(tv)break;z.push(t)}}}else{z=Object(d3_array["ticks"])(i,j,Math.min(j-i,n)).map(pows)}return r?z.reverse():z};scale.tickFormat=function(count,specifier){if(specifier==null)specifier=base===10?".0e":",";if(typeof specifier!=="function")specifier=Object(d3_format["format"])(specifier);if(count===Infinity)return specifier;if(count==null)count=10;var k=Math.max(1,base*count/scale.ticks().length);return function(d){var i=d/pows(Math.round(logs(d)));if(i*base0?thresholds[i-1]:domain[0],i=n?[domain[n-1],x1]:[domain[i-1],domain[i]]};scale.copy=function(){return quantize().domain([x0,x1]).range(range)};return linearish(scale)}function threshold(){var domain=[.5],range=[0,1],n=1;function scale(x){if(x<=x)return range[Object(d3_array["bisect"])(domain,x,0,n)]}scale.domain=function(_){return arguments.length?(domain=slice.call(_),n=Math.min(domain.length,range.length-1),scale):domain.slice()};scale.range=function(_){return arguments.length?(range=slice.call(_),n=Math.min(domain.length,range.length-1),scale):range.slice()};scale.invertExtent=function(y){var i=range.indexOf(y);return[domain[i-1],domain[i]]};scale.copy=function(){return threshold().domain(domain).range(range)};return scale}var t0=new Date,t1=new Date;function newInterval(floori,offseti,count,field){function interval(date){return floori(date=new Date(+date)),date}interval.floor=interval;interval.ceil=function(date){return floori(date=new Date(date-1)),offseti(date,1),floori(date),date};interval.round=function(date){var d0=interval(date),d1=interval.ceil(date);return date-d00))return range;do{range.push(previous=new Date(+start)),offseti(start,step),floori(start)}while(previous=date)while(floori(date),!test(date))date.setTime(date-1)},function(date,step){if(date>=date){if(step<0)while(++step<=0){while(offseti(date,-1),!test(date)){}}else while(--step>=0){while(offseti(date,+1),!test(date)){}}}})};if(count){interval.count=function(start,end){t0.setTime(+start),t1.setTime(+end);floori(t0),floori(t1);return Math.floor(count(t0,t1))};interval.every=function(step){step=Math.floor(step);return!isFinite(step)||!(step>0)?null:!(step>1)?interval:interval.filter(field?function(d){return field(d)%step===0}:function(d){return interval.count(0,d)%step===0})}}return interval}var millisecond_millisecond=newInterval(function(){},function(date,step){date.setTime(+date+step)},function(start,end){return end-start});millisecond_millisecond.every=function(k){k=Math.floor(k);if(!isFinite(k)||!(k>0))return null;if(!(k>1))return millisecond_millisecond;return newInterval(function(date){date.setTime(Math.floor(date/k)*k)},function(date,step){date.setTime(+date+step*k)},function(start,end){return(end-start)/k})};var src_millisecond=millisecond_millisecond;var milliseconds=millisecond_millisecond.range;var durationSecond=1e3;var durationMinute=6e4;var durationHour=36e5;var durationDay=864e5;var durationWeek=6048e5;var second_second=newInterval(function(date){date.setTime(Math.floor(date/durationSecond)*durationSecond)},function(date,step){date.setTime(+date+step*durationSecond)},function(start,end){return(end-start)/durationSecond},function(date){return date.getUTCSeconds()});var src_second=second_second;var seconds=second_second.range;var minute_minute=newInterval(function(date){date.setTime(Math.floor(date/durationMinute)*durationMinute)},function(date,step){date.setTime(+date+step*durationMinute)},function(start,end){return(end-start)/durationMinute},function(date){return date.getMinutes()});var src_minute=minute_minute;var minutes=minute_minute.range;var hour_hour=newInterval(function(date){var offset=date.getTimezoneOffset()*durationMinute%durationHour;if(offset<0)offset+=durationHour;date.setTime(Math.floor((+date-offset)/durationHour)*durationHour+offset)},function(date,step){date.setTime(+date+step*durationHour)},function(start,end){return(end-start)/durationHour},function(date){return date.getHours()});var src_hour=hour_hour;var hours=hour_hour.range;var day_day=newInterval(function(date){date.setHours(0,0,0,0)},function(date,step){date.setDate(date.getDate()+step)},function(start,end){return(end-start-(end.getTimezoneOffset()-start.getTimezoneOffset())*durationMinute)/durationDay},function(date){return date.getDate()-1});var src_day=day_day;var days=day_day.range;function weekday(i){return newInterval(function(date){date.setDate(date.getDate()-(date.getDay()+7-i)%7);date.setHours(0,0,0,0)},function(date,step){date.setDate(date.getDate()+step*7)},function(start,end){return(end-start-(end.getTimezoneOffset()-start.getTimezoneOffset())*durationMinute)/durationWeek})}var sunday=weekday(0);var monday=weekday(1);var tuesday=weekday(2);var wednesday=weekday(3);var thursday=weekday(4);var friday=weekday(5);var saturday=weekday(6);var sundays=sunday.range;var mondays=monday.range;var tuesdays=tuesday.range;var wednesdays=wednesday.range;var thursdays=thursday.range;var fridays=friday.range;var saturdays=saturday.range;var month_month=newInterval(function(date){date.setDate(1);date.setHours(0,0,0,0)},function(date,step){date.setMonth(date.getMonth()+step)},function(start,end){return end.getMonth()-start.getMonth()+(end.getFullYear()-start.getFullYear())*12},function(date){return date.getMonth()});var src_month=month_month;var months=month_month.range;var year_year=newInterval(function(date){date.setMonth(0,1);date.setHours(0,0,0,0)},function(date,step){date.setFullYear(date.getFullYear()+step)},function(start,end){return end.getFullYear()-start.getFullYear()},function(date){return date.getFullYear()});year_year.every=function(k){return!isFinite(k=Math.floor(k))||!(k>0)?null:newInterval(function(date){date.setFullYear(Math.floor(date.getFullYear()/k)*k);date.setMonth(0,1);date.setHours(0,0,0,0)},function(date,step){date.setFullYear(date.getFullYear()+step*k)})};var src_year=year_year;var years=year_year.range;var utcMinute=newInterval(function(date){date.setUTCSeconds(0,0)},function(date,step){date.setTime(+date+step*durationMinute)},function(start,end){return(end-start)/durationMinute},function(date){return date.getUTCMinutes()});var src_utcMinute=utcMinute;var utcMinutes=utcMinute.range;var utcHour=newInterval(function(date){date.setUTCMinutes(0,0,0)},function(date,step){date.setTime(+date+step*durationHour)},function(start,end){return(end-start)/durationHour},function(date){return date.getUTCHours()});var src_utcHour=utcHour;var utcHours=utcHour.range;var utcDay=newInterval(function(date){date.setUTCHours(0,0,0,0)},function(date,step){date.setUTCDate(date.getUTCDate()+step)},function(start,end){return(end-start)/durationDay},function(date){return date.getUTCDate()-1});var src_utcDay=utcDay;var utcDays=utcDay.range;function utcWeekday(i){return newInterval(function(date){date.setUTCDate(date.getUTCDate()-(date.getUTCDay()+7-i)%7);date.setUTCHours(0,0,0,0)},function(date,step){date.setUTCDate(date.getUTCDate()+step*7)},function(start,end){return(end-start)/durationWeek})}var utcSunday=utcWeekday(0);var utcMonday=utcWeekday(1);var utcTuesday=utcWeekday(2);var utcWednesday=utcWeekday(3);var utcThursday=utcWeekday(4);var utcFriday=utcWeekday(5);var utcSaturday=utcWeekday(6);var utcSundays=utcSunday.range;var utcMondays=utcMonday.range;var utcTuesdays=utcTuesday.range;var utcWednesdays=utcWednesday.range;var utcThursdays=utcThursday.range;var utcFridays=utcFriday.range;var utcSaturdays=utcSaturday.range;var utcMonth=newInterval(function(date){date.setUTCDate(1);date.setUTCHours(0,0,0,0)},function(date,step){date.setUTCMonth(date.getUTCMonth()+step)},function(start,end){return end.getUTCMonth()-start.getUTCMonth()+(end.getUTCFullYear()-start.getUTCFullYear())*12},function(date){return date.getUTCMonth()});var src_utcMonth=utcMonth;var utcMonths=utcMonth.range;var utcYear=newInterval(function(date){date.setUTCMonth(0,1);date.setUTCHours(0,0,0,0)},function(date,step){date.setUTCFullYear(date.getUTCFullYear()+step)},function(start,end){return end.getUTCFullYear()-start.getUTCFullYear()},function(date){return date.getUTCFullYear()});utcYear.every=function(k){return!isFinite(k=Math.floor(k))||!(k>0)?null:newInterval(function(date){date.setUTCFullYear(Math.floor(date.getUTCFullYear()/k)*k);date.setUTCMonth(0,1);date.setUTCHours(0,0,0,0)},function(date,step){date.setUTCFullYear(date.getUTCFullYear()+step*k)})};var src_utcYear=utcYear;var utcYears=utcYear.range;function localDate(d){if(0<=d.y&&d.y<100){var date=new Date(-1,d.m,d.d,d.H,d.M,d.S,d.L);date.setFullYear(d.y);return date}return new Date(d.y,d.m,d.d,d.H,d.M,d.S,d.L)}function utcDate(d){if(0<=d.y&&d.y<100){var date=new Date(Date.UTC(-1,d.m,d.d,d.H,d.M,d.S,d.L));date.setUTCFullYear(d.y);return date}return new Date(Date.UTC(d.y,d.m,d.d,d.H,d.M,d.S,d.L))}function newYear(y){return{y,m:0,d:1,H:0,M:0,S:0,L:0}}function formatLocale(locale){var locale_dateTime=locale.dateTime,locale_date=locale.date,locale_time=locale.time,locale_periods=locale.periods,locale_weekdays=locale.days,locale_shortWeekdays=locale.shortDays,locale_months=locale.months,locale_shortMonths=locale.shortMonths;var periodRe=formatRe(locale_periods),periodLookup=formatLookup(locale_periods),weekdayRe=formatRe(locale_weekdays),weekdayLookup=formatLookup(locale_weekdays),shortWeekdayRe=formatRe(locale_shortWeekdays),shortWeekdayLookup=formatLookup(locale_shortWeekdays),monthRe=formatRe(locale_months),monthLookup=formatLookup(locale_months),shortMonthRe=formatRe(locale_shortMonths),shortMonthLookup=formatLookup(locale_shortMonths);var formats={a:formatShortWeekday,A:formatWeekday,b:formatShortMonth,B:formatMonth,c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:formatPeriod,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:locale_formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent};var utcFormats={a:formatUTCShortWeekday,A:formatUTCWeekday,b:formatUTCShortMonth,B:formatUTCMonth,c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:formatUTCPeriod,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent};var parses={a:parseShortWeekday,A:parseWeekday,b:parseShortMonth,B:parseMonth,c:parseLocaleDateTime,d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:parsePeriod,Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:parseLocaleDate,X:parseLocaleTime,y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};formats.x=newFormat(locale_date,formats);formats.X=newFormat(locale_time,formats);formats.c=newFormat(locale_dateTime,formats);utcFormats.x=newFormat(locale_date,utcFormats);utcFormats.X=newFormat(locale_time,utcFormats);utcFormats.c=newFormat(locale_dateTime,utcFormats);function newFormat(specifier,formats){return function(date){var string=[],i=-1,j=0,n=specifier.length,c,pad,format;if(!(date instanceof Date))date=new Date(+date);while(++i53)return null;if(!("w"in d))d.w=1;if("Z"in d){week=utcDate(newYear(d.y)),day=week.getUTCDay();week=day>4||day===0?utcMonday.ceil(week):utcMonday(week);week=src_utcDay.offset(week,(d.V-1)*7);d.y=week.getUTCFullYear();d.m=week.getUTCMonth();d.d=week.getUTCDate()+(d.w+6)%7}else{week=newDate(newYear(d.y)),day=week.getDay();week=day>4||day===0?monday.ceil(week):monday(week);week=src_day.offset(week,(d.V-1)*7);d.y=week.getFullYear();d.m=week.getMonth();d.d=week.getDate()+(d.w+6)%7}}else if("W"in d||"U"in d){if(!("w"in d))d.w="u"in d?d.u%7:"W"in d?1:0;day="Z"in d?utcDate(newYear(d.y)).getUTCDay():newDate(newYear(d.y)).getDay();d.m=0;d.d="W"in d?(d.w+6)%7+d.W*7-(day+5)%7:d.w+d.U*7-(day+6)%7}if("Z"in d){d.H+=d.Z/100|0;d.M+=d.Z%100;return utcDate(d)}return newDate(d)}}function parseSpecifier(d,specifier,string,j){var i=0,n=specifier.length,m=string.length,c,parse;while(i=m)return-1;c=specifier.charCodeAt(i++);if(c===37){c=specifier.charAt(i++);parse=parses[c in pads?specifier.charAt(i++):c];if(!parse||(j=parse(d,string,j))<0)return-1}else if(c!=string.charCodeAt(j++)){return-1}}return j}function parsePeriod(d,string,i){var n=periodRe.exec(string.slice(i));return n?(d.p=periodLookup[n[0].toLowerCase()],i+n[0].length):-1}function parseShortWeekday(d,string,i){var n=shortWeekdayRe.exec(string.slice(i));return n?(d.w=shortWeekdayLookup[n[0].toLowerCase()],i+n[0].length):-1}function parseWeekday(d,string,i){var n=weekdayRe.exec(string.slice(i));return n?(d.w=weekdayLookup[n[0].toLowerCase()],i+n[0].length):-1}function parseShortMonth(d,string,i){var n=shortMonthRe.exec(string.slice(i));return n?(d.m=shortMonthLookup[n[0].toLowerCase()],i+n[0].length):-1}function parseMonth(d,string,i){var n=monthRe.exec(string.slice(i));return n?(d.m=monthLookup[n[0].toLowerCase()],i+n[0].length):-1}function parseLocaleDateTime(d,string,i){return parseSpecifier(d,locale_dateTime,string,i)}function parseLocaleDate(d,string,i){return parseSpecifier(d,locale_date,string,i)}function parseLocaleTime(d,string,i){return parseSpecifier(d,locale_time,string,i)}function formatShortWeekday(d){return locale_shortWeekdays[d.getDay()]}function formatWeekday(d){return locale_weekdays[d.getDay()]}function formatShortMonth(d){return locale_shortMonths[d.getMonth()]}function formatMonth(d){return locale_months[d.getMonth()]}function formatPeriod(d){return locale_periods[+(d.getHours()>=12)]}function formatUTCShortWeekday(d){return locale_shortWeekdays[d.getUTCDay()]}function formatUTCWeekday(d){return locale_weekdays[d.getUTCDay()]}function formatUTCShortMonth(d){return locale_shortMonths[d.getUTCMonth()]}function formatUTCMonth(d){return locale_months[d.getUTCMonth()]}function formatUTCPeriod(d){return locale_periods[+(d.getUTCHours()>=12)]}return{format:function(specifier){var f=newFormat(specifier+="",formats);f.toString=function(){return specifier};return f},parse:function(specifier){var p=newParse(specifier+="",localDate);p.toString=function(){return specifier};return p},utcFormat:function(specifier){var f=newFormat(specifier+="",utcFormats);f.toString=function(){return specifier};return f},utcParse:function(specifier){var p=newParse(specifier,utcDate);p.toString=function(){return specifier};return p}}}var pads={"-":"",_:" ",0:"0"},numberRe=/^\s*\d+/,percentRe=/^%/,requoteRe=/[\\^$*+?|[\]().{}]/g;function pad(value,fill,width){var sign=value<0?"-":"",string=(sign?-value:value)+"",length=string.length;return sign+(length68?1900:2e3),i+n[0].length):-1}function parseZone(d,string,i){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i,i+6));return n?(d.Z=n[1]?0:-(n[2]+(n[3]||"00")),i+n[0].length):-1}function parseMonthNumber(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.m=n[0]-1,i+n[0].length):-1}function parseDayOfMonth(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.d=+n[0],i+n[0].length):-1}function parseDayOfYear(d,string,i){var n=numberRe.exec(string.slice(i,i+3));return n?(d.m=0,d.d=+n[0],i+n[0].length):-1}function parseHour24(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.H=+n[0],i+n[0].length):-1}function parseMinutes(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.M=+n[0],i+n[0].length):-1}function parseSeconds(d,string,i){var n=numberRe.exec(string.slice(i,i+2));return n?(d.S=+n[0],i+n[0].length):-1}function parseMilliseconds(d,string,i){var n=numberRe.exec(string.slice(i,i+3));return n?(d.L=+n[0],i+n[0].length):-1}function parseMicroseconds(d,string,i){var n=numberRe.exec(string.slice(i,i+6));return n?(d.L=Math.floor(n[0]/1e3),i+n[0].length):-1}function parseLiteralPercent(d,string,i){var n=percentRe.exec(string.slice(i,i+1));return n?i+n[0].length:-1}function parseUnixTimestamp(d,string,i){var n=numberRe.exec(string.slice(i));return n?(d.Q=+n[0],i+n[0].length):-1}function parseUnixTimestampSeconds(d,string,i){var n=numberRe.exec(string.slice(i));return n?(d.Q=+n[0]*1e3,i+n[0].length):-1}function formatDayOfMonth(d,p){return pad(d.getDate(),p,2)}function formatHour24(d,p){return pad(d.getHours(),p,2)}function formatHour12(d,p){return pad(d.getHours()%12||12,p,2)}function formatDayOfYear(d,p){return pad(1+src_day.count(src_year(d),d),p,3)}function formatMilliseconds(d,p){return pad(d.getMilliseconds(),p,3)}function formatMicroseconds(d,p){return formatMilliseconds(d,p)+"000"}function formatMonthNumber(d,p){return pad(d.getMonth()+1,p,2)}function formatMinutes(d,p){return pad(d.getMinutes(),p,2)}function formatSeconds(d,p){return pad(d.getSeconds(),p,2)}function formatWeekdayNumberMonday(d){var day=d.getDay();return day===0?7:day}function formatWeekNumberSunday(d,p){return pad(sunday.count(src_year(d),d),p,2)}function formatWeekNumberISO(d,p){var day=d.getDay();d=day>=4||day===0?thursday(d):thursday.ceil(d);return pad(thursday.count(src_year(d),d)+(src_year(d).getDay()===4),p,2)}function formatWeekdayNumberSunday(d){return d.getDay()}function formatWeekNumberMonday(d,p){return pad(monday.count(src_year(d),d),p,2)}function locale_formatYear(d,p){return pad(d.getFullYear()%100,p,2)}function formatFullYear(d,p){return pad(d.getFullYear()%1e4,p,4)}function formatZone(d){var z=d.getTimezoneOffset();return(z>0?"-":(z*=-1,"+"))+pad(z/60|0,"0",2)+pad(z%60,"0",2)}function formatUTCDayOfMonth(d,p){return pad(d.getUTCDate(),p,2)}function formatUTCHour24(d,p){return pad(d.getUTCHours(),p,2)}function formatUTCHour12(d,p){return pad(d.getUTCHours()%12||12,p,2)}function formatUTCDayOfYear(d,p){return pad(1+src_utcDay.count(src_utcYear(d),d),p,3)}function formatUTCMilliseconds(d,p){return pad(d.getUTCMilliseconds(),p,3)}function formatUTCMicroseconds(d,p){return formatUTCMilliseconds(d,p)+"000"}function formatUTCMonthNumber(d,p){return pad(d.getUTCMonth()+1,p,2)}function formatUTCMinutes(d,p){return pad(d.getUTCMinutes(),p,2)}function formatUTCSeconds(d,p){return pad(d.getUTCSeconds(),p,2)}function formatUTCWeekdayNumberMonday(d){var dow=d.getUTCDay();return dow===0?7:dow}function formatUTCWeekNumberSunday(d,p){return pad(utcSunday.count(src_utcYear(d),d),p,2)}function formatUTCWeekNumberISO(d,p){var day=d.getUTCDay();d=day>=4||day===0?utcThursday(d):utcThursday.ceil(d);return pad(utcThursday.count(src_utcYear(d),d)+(src_utcYear(d).getUTCDay()===4),p,2)}function formatUTCWeekdayNumberSunday(d){return d.getUTCDay()}function formatUTCWeekNumberMonday(d,p){return pad(utcMonday.count(src_utcYear(d),d),p,2)}function formatUTCYear(d,p){return pad(d.getUTCFullYear()%100,p,2)}function formatUTCFullYear(d,p){return pad(d.getUTCFullYear()%1e4,p,4)}function formatUTCZone(){return"+0000"}function formatLiteralPercent(){return"%"}function formatUnixTimestamp(d){return+d}function formatUnixTimestampSeconds(d){return Math.floor(+d/1e3)}var defaultLocale_locale;var timeFormat;var timeParse;var utcFormat;var utcParse;defaultLocale({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function defaultLocale(definition){defaultLocale_locale=formatLocale(definition);timeFormat=defaultLocale_locale.format;timeParse=defaultLocale_locale.parse;utcFormat=defaultLocale_locale.utcFormat;utcParse=defaultLocale_locale.utcParse;return defaultLocale_locale}var isoSpecifier="%Y-%m-%dT%H:%M:%S.%LZ";function formatIsoNative(date){return date.toISOString()}var formatIso=Date.prototype.toISOString?formatIsoNative:utcFormat(isoSpecifier);var isoFormat=formatIso;function parseIsoNative(string){var date=new Date(string);return isNaN(date)?null:date}var parseIso=+new Date("2000-01-01T00:00:00.000Z")?parseIsoNative:utcParse(isoSpecifier);var isoParse=parseIso;var time_durationSecond=1e3,time_durationMinute=time_durationSecond*60,time_durationHour=time_durationMinute*60,time_durationDay=time_durationHour*24,time_durationWeek=time_durationDay*7,durationMonth=time_durationDay*30,durationYear=time_durationDay*365;function time_date(t){return new Date(t)}function time_number(t){return t instanceof Date?+t:+new Date(+t)}function calendar(year,month,week,day,hour,minute,second,millisecond,format){var scale=continuous(deinterpolateLinear,d3_interpolate["interpolateNumber"]),invert=scale.invert,domain=scale.domain;var formatMillisecond=format(".%L"),formatSecond=format(":%S"),formatMinute=format("%I:%M"),formatHour=format("%I %p"),formatDay=format("%a %d"),formatWeek=format("%b %d"),formatMonth=format("%B"),formatYear=format("%Y");var tickIntervals=[[second,1,time_durationSecond],[second,5,5*time_durationSecond],[second,15,15*time_durationSecond],[second,30,30*time_durationSecond],[minute,1,time_durationMinute],[minute,5,5*time_durationMinute],[minute,15,15*time_durationMinute],[minute,30,30*time_durationMinute],[hour,1,time_durationHour],[hour,3,3*time_durationHour],[hour,6,6*time_durationHour],[hour,12,12*time_durationHour],[day,1,time_durationDay],[day,2,2*time_durationDay],[week,1,time_durationWeek],[month,1,durationMonth],[month,3,3*durationMonth],[year,1,durationYear]];function tickFormat(date){return(second(date)1)t-=Math.floor(t);var ts=Math.abs(t-.5);c.h=360*t-100;c.s=1.5-1.5*ts;c.l=.8-.9*ts;return c+""};var sinebow_c=Object(d3_color["f"])(),pi_1_3=Math.PI/3,pi_2_3=Math.PI*2/3;var sinebow=function(t){var x;t=(.5-t)*Math.PI;sinebow_c.r=255*(x=Math.sin(t))*x;sinebow_c.g=255*(x=Math.sin(t+pi_1_3))*x;sinebow_c.b=255*(x=Math.sin(t+pi_2_3))*x;return sinebow_c+""};function viridis_ramp(range){var n=range.length;return function(t){return range[Math.max(0,Math.min(n-1,Math.floor(t*n)))]}}var viridis=viridis_ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var magma=viridis_ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));var inferno=viridis_ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));var plasma=viridis_ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));__webpack_require__.d(__webpack_exports__,"schemeCategory10",function(){return category10});__webpack_require__.d(__webpack_exports__,"schemeAccent",function(){return Accent});__webpack_require__.d(__webpack_exports__,"schemeDark2",function(){return Dark2});__webpack_require__.d(__webpack_exports__,"schemePaired",function(){return Paired});__webpack_require__.d(__webpack_exports__,"schemePastel1",function(){return Pastel1});__webpack_require__.d(__webpack_exports__,"schemePastel2",function(){return Pastel2});__webpack_require__.d(__webpack_exports__,"schemeSet1",function(){return Set1});__webpack_require__.d(__webpack_exports__,"schemeSet2",function(){return Set2});__webpack_require__.d(__webpack_exports__,"schemeSet3",function(){return Set3});__webpack_require__.d(__webpack_exports__,"interpolateBrBG",function(){return BrBG});__webpack_require__.d(__webpack_exports__,"schemeBrBG",function(){return BrBG_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePRGn",function(){return PRGn});__webpack_require__.d(__webpack_exports__,"schemePRGn",function(){return PRGn_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePiYG",function(){return PiYG});__webpack_require__.d(__webpack_exports__,"schemePiYG",function(){return PiYG_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePuOr",function(){return PuOr});__webpack_require__.d(__webpack_exports__,"schemePuOr",function(){return PuOr_scheme});__webpack_require__.d(__webpack_exports__,"interpolateRdBu",function(){return RdBu});__webpack_require__.d(__webpack_exports__,"schemeRdBu",function(){return RdBu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateRdGy",function(){return RdGy});__webpack_require__.d(__webpack_exports__,"schemeRdGy",function(){return RdGy_scheme});__webpack_require__.d(__webpack_exports__,"interpolateRdYlBu",function(){return RdYlBu});__webpack_require__.d(__webpack_exports__,"schemeRdYlBu",function(){return RdYlBu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateRdYlGn",function(){return RdYlGn});__webpack_require__.d(__webpack_exports__,"schemeRdYlGn",function(){return RdYlGn_scheme});__webpack_require__.d(__webpack_exports__,"interpolateSpectral",function(){return Spectral});__webpack_require__.d(__webpack_exports__,"schemeSpectral",function(){return Spectral_scheme});__webpack_require__.d(__webpack_exports__,"interpolateBuGn",function(){return BuGn});__webpack_require__.d(__webpack_exports__,"schemeBuGn",function(){return BuGn_scheme});__webpack_require__.d(__webpack_exports__,"interpolateBuPu",function(){return BuPu});__webpack_require__.d(__webpack_exports__,"schemeBuPu",function(){return BuPu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateGnBu",function(){return GnBu});__webpack_require__.d(__webpack_exports__,"schemeGnBu",function(){return GnBu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateOrRd",function(){return OrRd});__webpack_require__.d(__webpack_exports__,"schemeOrRd",function(){return OrRd_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePuBuGn",function(){return PuBuGn});__webpack_require__.d(__webpack_exports__,"schemePuBuGn",function(){return PuBuGn_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePuBu",function(){return PuBu});__webpack_require__.d(__webpack_exports__,"schemePuBu",function(){return PuBu_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePuRd",function(){return PuRd});__webpack_require__.d(__webpack_exports__,"schemePuRd",function(){return PuRd_scheme});__webpack_require__.d(__webpack_exports__,"interpolateRdPu",function(){return RdPu});__webpack_require__.d(__webpack_exports__,"schemeRdPu",function(){return RdPu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateYlGnBu",function(){return YlGnBu});__webpack_require__.d(__webpack_exports__,"schemeYlGnBu",function(){return YlGnBu_scheme});__webpack_require__.d(__webpack_exports__,"interpolateYlGn",function(){return YlGn});__webpack_require__.d(__webpack_exports__,"schemeYlGn",function(){return YlGn_scheme});__webpack_require__.d(__webpack_exports__,"interpolateYlOrBr",function(){return YlOrBr});__webpack_require__.d(__webpack_exports__,"schemeYlOrBr",function(){return YlOrBr_scheme});__webpack_require__.d(__webpack_exports__,"interpolateYlOrRd",function(){return YlOrRd});__webpack_require__.d(__webpack_exports__,"schemeYlOrRd",function(){return YlOrRd_scheme});__webpack_require__.d(__webpack_exports__,"interpolateBlues",function(){return Blues});__webpack_require__.d(__webpack_exports__,"schemeBlues",function(){return Blues_scheme});__webpack_require__.d(__webpack_exports__,"interpolateGreens",function(){return Greens});__webpack_require__.d(__webpack_exports__,"schemeGreens",function(){return Greens_scheme});__webpack_require__.d(__webpack_exports__,"interpolateGreys",function(){return Greys});__webpack_require__.d(__webpack_exports__,"schemeGreys",function(){return Greys_scheme});__webpack_require__.d(__webpack_exports__,"interpolatePurples",function(){return Purples});__webpack_require__.d(__webpack_exports__,"schemePurples",function(){return Purples_scheme});__webpack_require__.d(__webpack_exports__,"interpolateReds",function(){return Reds});__webpack_require__.d(__webpack_exports__,"schemeReds",function(){return Reds_scheme});__webpack_require__.d(__webpack_exports__,"interpolateOranges",function(){return Oranges});__webpack_require__.d(__webpack_exports__,"schemeOranges",function(){return Oranges_scheme});__webpack_require__.d(__webpack_exports__,"interpolateCubehelixDefault",function(){return cubehelix});__webpack_require__.d(__webpack_exports__,"interpolateRainbow",function(){return rainbow});__webpack_require__.d(__webpack_exports__,"interpolateWarm",function(){return warm});__webpack_require__.d(__webpack_exports__,"interpolateCool",function(){return cool});__webpack_require__.d(__webpack_exports__,"interpolateSinebow",function(){return sinebow});__webpack_require__.d(__webpack_exports__,"interpolateViridis",function(){return viridis});__webpack_require__.d(__webpack_exports__,"interpolateMagma",function(){return magma});__webpack_require__.d(__webpack_exports__,"interpolateInferno",function(){return inferno});__webpack_require__.d(__webpack_exports__,"interpolatePlasma",function(){return plasma})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var d3_path=__webpack_require__(6);var constant=function(x){return function constant(){return x}};var abs=Math.abs;var atan2=Math.atan2;var cos=Math.cos;var max=Math.max;var min=Math.min;var sin=Math.sin;var sqrt=Math.sqrt;var epsilon=1e-12;var pi=Math.PI;var halfPi=pi/2;var tau=2*pi;function acos(x){return x>1?0:x<-1?pi:Math.acos(x)}function asin(x){return x>=1?halfPi:x<=-1?-halfPi:Math.asin(x)}function arcInnerRadius(d){return d.innerRadius}function arcOuterRadius(d){return d.outerRadius}function arcStartAngle(d){return d.startAngle}function arcEndAngle(d){return d.endAngle}function arcPadAngle(d){return d&&d.padAngle}function intersect(x0,y0,x1,y1,x2,y2,x3,y3){var x10=x1-x0,y10=y1-y0,x32=x3-x2,y32=y3-y2,t=(x32*(y0-y2)-y32*(x0-x2))/(y32*x10-x32*y10);return[x0+t*x10,y0+t*y10]}function cornerTangents(x0,y0,x1,y1,r1,rc,cw){var x01=x0-x1,y01=y0-y1,lo=(cw?rc:-rc)/sqrt(x01*x01+y01*y01),ox=lo*y01,oy=-lo*x01,x11=x0+ox,y11=y0+oy,x10=x1+ox,y10=y1+oy,x00=(x11+x10)/2,y00=(y11+y10)/2,dx=x10-x11,dy=y10-y11,d2=dx*dx+dy*dy,r=r1-rc,D=x11*y10-x10*y11,d=(dy<0?-1:1)*sqrt(max(0,r*r*d2-D*D)),cx0=(D*dy-dx*d)/d2,cy0=(-D*dx-dy*d)/d2,cx1=(D*dy+dx*d)/d2,cy1=(-D*dx+dy*d)/d2,dx0=cx0-x00,dy0=cy0-y00,dx1=cx1-x00,dy1=cy1-y00;if(dx0*dx0+dy0*dy0>dx1*dx1+dy1*dy1)cx0=cx1,cy0=cy1;return{cx:cx0,cy:cy0,x01:-ox,y01:-oy,x11:cx0*(r1/r-1),y11:cy0*(r1/r-1)}}var src_arc=function(){var innerRadius=arcInnerRadius,outerRadius=arcOuterRadius,cornerRadius=constant(0),padRadius=null,startAngle=arcStartAngle,endAngle=arcEndAngle,padAngle=arcPadAngle,context=null;function arc(){var buffer,r,r0=+innerRadius.apply(this,arguments),r1=+outerRadius.apply(this,arguments),a0=startAngle.apply(this,arguments)-halfPi,a1=endAngle.apply(this,arguments)-halfPi,da=abs(a1-a0),cw=a1>a0;if(!context)context=buffer=Object(d3_path["path"])();if(r1epsilon))context.moveTo(0,0);else if(da>tau-epsilon){context.moveTo(r1*cos(a0),r1*sin(a0));context.arc(0,0,r1,a0,a1,!cw);if(r0>epsilon){context.moveTo(r0*cos(a1),r0*sin(a1));context.arc(0,0,r0,a1,a0,cw)}}else{var a01=a0,a11=a1,a00=a0,a10=a1,da0=da,da1=da,ap=padAngle.apply(this,arguments)/2,rp=ap>epsilon&&(padRadius?+padRadius.apply(this,arguments):sqrt(r0*r0+r1*r1)),rc=min(abs(r1-r0)/2,+cornerRadius.apply(this,arguments)),rc0=rc,rc1=rc,t0,t1;if(rp>epsilon){var p0=asin(rp/r0*sin(ap)),p1=asin(rp/r1*sin(ap));if((da0-=p0*2)>epsilon)p0*=cw?1:-1,a00+=p0,a10-=p0;else da0=0,a00=a10=(a0+a1)/2;if((da1-=p1*2)>epsilon)p1*=cw?1:-1,a01+=p1,a11-=p1;else da1=0,a01=a11=(a0+a1)/2}var x01=r1*cos(a01),y01=r1*sin(a01),x10=r0*cos(a10),y10=r0*sin(a10);if(rc>epsilon){var x11=r1*cos(a11),y11=r1*sin(a11),x00=r0*cos(a00),y00=r0*sin(a00);if(daepsilon?intersect(x01,y01,x00,y00,x11,y11,x10,y10):[x10,y10],ax=x01-oc[0],ay=y01-oc[1],bx=x11-oc[0],by=y11-oc[1],kc=1/sin(acos((ax*bx+ay*by)/(sqrt(ax*ax+ay*ay)*sqrt(bx*bx+by*by)))/2),lc=sqrt(oc[0]*oc[0]+oc[1]*oc[1]);rc0=min(rc,(r0-lc)/(kc-1));rc1=min(rc,(r1-lc)/(kc+1))}}if(!(da1>epsilon))context.moveTo(x01,y01);else if(rc1>epsilon){t0=cornerTangents(x00,y00,x01,y01,r1,rc1,cw);t1=cornerTangents(x11,y11,x10,y10,r1,rc1,cw);context.moveTo(t0.cx+t0.x01,t0.cy+t0.y01);if(rc1epsilon)||!(da0>epsilon))context.lineTo(x10,y10);else if(rc0>epsilon){t0=cornerTangents(x10,y10,x11,y11,r0,-rc0,cw);t1=cornerTangents(x01,y01,x00,y00,r0,-rc0,cw);context.lineTo(t0.cx+t0.x01,t0.cy+t0.y01);if(rc0=j;--k){output.point(x0z[k],y0z[k])}output.lineEnd();output.areaEnd()}}if(defined0){x0z[i]=+x0(d,i,data),y0z[i]=+y0(d,i,data);output.point(x1?+x1(d,i,data):x0z[i],y1?+y1(d,i,data):y0z[i])}}if(buffer)return output=null,buffer+""||null}function arealine(){return src_line().defined(defined).curve(curve).context(context)}area.x=function(_){return arguments.length?(x0=typeof _==="function"?_:constant(+_),x1=null,area):x0};area.x0=function(_){return arguments.length?(x0=typeof _==="function"?_:constant(+_),area):x0};area.x1=function(_){return arguments.length?(x1=_==null?null:typeof _==="function"?_:constant(+_),area):x1};area.y=function(_){return arguments.length?(y0=typeof _==="function"?_:constant(+_),y1=null,area):y0};area.y0=function(_){return arguments.length?(y0=typeof _==="function"?_:constant(+_),area):y0};area.y1=function(_){return arguments.length?(y1=_==null?null:typeof _==="function"?_:constant(+_),area):y1};area.lineX0=area.lineY0=function(){return arealine().x(x0).y(y0)};area.lineY1=function(){return arealine().x(x0).y(y1)};area.lineX1=function(){return arealine().x(x1).y(y0)};area.defined=function(_){return arguments.length?(defined=typeof _==="function"?_:constant(!!_),area):defined};area.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),area):curve};area.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),area):context};return area};var descending=function(a,b){return ba?1:b>=a?0:NaN};var identity=function(d){return d};var src_pie=function(){var value=identity,sortValues=descending,sort=null,startAngle=constant(0),endAngle=constant(tau),padAngle=constant(0);function pie(data){var i,n=data.length,j,k,sum=0,index=new Array(n),arcs=new Array(n),a0=+startAngle.apply(this,arguments),da=Math.min(tau,Math.max(-tau,endAngle.apply(this,arguments)-a0)),a1,p=Math.min(Math.abs(da)/n,padAngle.apply(this,arguments)),pa=p*(da<0?-1:1),v;for(i=0;i0){sum+=v}}if(sortValues!=null)index.sort(function(i,j){return sortValues(arcs[i],arcs[j])});else if(sort!=null)index.sort(function(i,j){return sort(data[i],data[j])});for(i=0,k=sum?(da-n*pa)/sum:0;i0?v*k:0)+pa,arcs[j]={data:data[j],index:i,value:v,startAngle:a0,endAngle:a1,padAngle:p}}return arcs}pie.value=function(_){return arguments.length?(value=typeof _==="function"?_:constant(+_),pie):value};pie.sortValues=function(_){return arguments.length?(sortValues=_,sort=null,pie):sortValues};pie.sort=function(_){return arguments.length?(sort=_,sortValues=null,pie):sort};pie.startAngle=function(_){return arguments.length?(startAngle=typeof _==="function"?_:constant(+_),pie):startAngle};pie.endAngle=function(_){return arguments.length?(endAngle=typeof _==="function"?_:constant(+_),pie):endAngle};pie.padAngle=function(_){return arguments.length?(padAngle=typeof _==="function"?_:constant(+_),pie):padAngle};return pie};var curveRadialLinear=curveRadial(linear);function Radial(curve){this._curve=curve}Radial.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(a,r){this._curve.point(r*Math.sin(a),r*-Math.cos(a))}};function curveRadial(curve){function radial(context){return new Radial(curve(context))}radial._curve=curve;return radial}function lineRadial(l){var c=l.curve;l.angle=l.x,delete l.x;l.radius=l.y,delete l.y;l.curve=function(_){return arguments.length?c(curveRadial(_)):c()._curve};return l}var src_lineRadial=function(){return lineRadial(src_line().curve(curveRadialLinear))};var areaRadial=function(){var a=src_area().curve(curveRadialLinear),c=a.curve,x0=a.lineX0,x1=a.lineX1,y0=a.lineY0,y1=a.lineY1;a.angle=a.x,delete a.x;a.startAngle=a.x0,delete a.x0;a.endAngle=a.x1,delete a.x1;a.radius=a.y,delete a.y;a.innerRadius=a.y0,delete a.y0;a.outerRadius=a.y1,delete a.y1;a.lineStartAngle=function(){return lineRadial(x0())},delete a.lineX0;a.lineEndAngle=function(){return lineRadial(x1())},delete a.lineX1;a.lineInnerRadius=function(){return lineRadial(y0())},delete a.lineY0;a.lineOuterRadius=function(){return lineRadial(y1())},delete a.lineY1;a.curve=function(_){return arguments.length?c(curveRadial(_)):c()._curve};return a};var pointRadial=function(x,y){return[(y=+y)*Math.cos(x-=Math.PI/2),y*Math.sin(x)]};var slice=Array.prototype.slice;function linkSource(d){return d.source}function linkTarget(d){return d.target}function link_link(curve){var source=linkSource,target=linkTarget,x=point_x,y=point_y,context=null;function link(){var buffer,argv=slice.call(arguments),s=source.apply(this,argv),t=target.apply(this,argv);if(!context)context=buffer=Object(d3_path["path"])();curve(context,+x.apply(this,(argv[0]=s,argv)),+y.apply(this,argv),+x.apply(this,(argv[0]=t,argv)),+y.apply(this,argv));if(buffer)return context=null,buffer+""||null}link.source=function(_){return arguments.length?(source=_,link):source};link.target=function(_){return arguments.length?(target=_,link):target};link.x=function(_){return arguments.length?(x=typeof _==="function"?_:constant(+_),link):x};link.y=function(_){return arguments.length?(y=typeof _==="function"?_:constant(+_),link):y};link.context=function(_){return arguments.length?(context=_==null?null:_,link):context};return link}function curveHorizontal(context,x0,y0,x1,y1){context.moveTo(x0,y0);context.bezierCurveTo(x0=(x0+x1)/2,y0,x0,y1,x1,y1)}function curveVertical(context,x0,y0,x1,y1){context.moveTo(x0,y0);context.bezierCurveTo(x0,y0=(y0+y1)/2,x1,y0,x1,y1)}function link_curveRadial(context,x0,y0,x1,y1){var p0=pointRadial(x0,y0),p1=pointRadial(x0,y0=(y0+y1)/2),p2=pointRadial(x1,y0),p3=pointRadial(x1,y1);context.moveTo(p0[0],p0[1]);context.bezierCurveTo(p1[0],p1[1],p2[0],p2[1],p3[0],p3[1])}function linkHorizontal(){return link_link(curveHorizontal)}function linkVertical(){return link_link(curveVertical)}function linkRadial(){var l=link_link(link_curveRadial);l.angle=l.x,delete l.x;l.radius=l.y,delete l.y;return l}var circle={draw:function(context,size){var r=Math.sqrt(size/pi);context.moveTo(r,0);context.arc(0,0,r,0,tau)}};var cross={draw:function(context,size){var r=Math.sqrt(size/5)/2;context.moveTo(-3*r,-r);context.lineTo(-r,-r);context.lineTo(-r,-3*r);context.lineTo(r,-3*r);context.lineTo(r,-r);context.lineTo(3*r,-r);context.lineTo(3*r,r);context.lineTo(r,r);context.lineTo(r,3*r);context.lineTo(-r,3*r);context.lineTo(-r,r);context.lineTo(-3*r,r);context.closePath()}};var tan30=Math.sqrt(1/3),tan30_2=tan30*2;var diamond={draw:function(context,size){var y=Math.sqrt(size/tan30_2),x=y*tan30;context.moveTo(0,-y);context.lineTo(x,0);context.lineTo(0,y);context.lineTo(-x,0);context.closePath()}};var ka=.8908130915292852,kr=Math.sin(pi/10)/Math.sin(7*pi/10),kx=Math.sin(tau/10)*kr,ky=-Math.cos(tau/10)*kr;var star={draw:function(context,size){var r=Math.sqrt(size*ka),x=kx*r,y=ky*r;context.moveTo(0,-r);context.lineTo(x,y);for(var i=1;i<5;++i){var a=tau*i/5,c=Math.cos(a),s=Math.sin(a);context.lineTo(s*r,-c*r);context.lineTo(c*x-s*y,s*x+c*y)}context.closePath()}};var square={draw:function(context,size){var w=Math.sqrt(size),x=-w/2;context.rect(x,x,w,w)}};var sqrt3=Math.sqrt(3);var triangle={draw:function(context,size){var y=-Math.sqrt(size/(sqrt3*3));context.moveTo(0,y*2);context.lineTo(-sqrt3*y,-y);context.lineTo(sqrt3*y,-y);context.closePath()}};var wye_c=-.5,wye_s=Math.sqrt(3)/2,wye_k=1/Math.sqrt(12),wye_a=(wye_k/2+1)*3;var wye={draw:function(context,size){var r=Math.sqrt(size/wye_a),x0=r/2,y0=r*wye_k,x1=x0,y1=r*wye_k+r,x2=-x1,y2=y1;context.moveTo(x0,y0);context.lineTo(x1,y1);context.lineTo(x2,y2);context.lineTo(wye_c*x0-wye_s*y0,wye_s*x0+wye_c*y0);context.lineTo(wye_c*x1-wye_s*y1,wye_s*x1+wye_c*y1);context.lineTo(wye_c*x2-wye_s*y2,wye_s*x2+wye_c*y2);context.lineTo(wye_c*x0+wye_s*y0,wye_c*y0-wye_s*x0);context.lineTo(wye_c*x1+wye_s*y1,wye_c*y1-wye_s*x1);context.lineTo(wye_c*x2+wye_s*y2,wye_c*y2-wye_s*x2);context.closePath()}};var symbols=[circle,cross,diamond,square,star,triangle,wye];var src_symbol=function(){var type=constant(circle),size=constant(64),context=null;function symbol(){var buffer;if(!context)context=buffer=Object(d3_path["path"])();type.apply(this,arguments).draw(context,+size.apply(this,arguments));if(buffer)return context=null,buffer+""||null}symbol.type=function(_){return arguments.length?(type=typeof _==="function"?_:constant(_),symbol):type};symbol.size=function(_){return arguments.length?(size=typeof _==="function"?_:constant(+_),symbol):size};symbol.context=function(_){return arguments.length?(context=_==null?null:_,symbol):context};return symbol};var noop=function(){};function point(that,x,y){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x)/6,(that._y0+4*that._y1+y)/6)}function Basis(context){this._context=context}Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){switch(this._point){case 3:point(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:point(this,x,y);break}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y}};var basis=function(context){return new Basis(context)};function BasisClosed(context){this._context=context}BasisClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2);this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3);this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3);this._context.closePath();break}case 3:{this.point(this._x2,this._y2);this.point(this._x3,this._y3);this.point(this._x4,this._y4);break}}},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._x2=x,this._y2=y;break;case 1:this._point=2;this._x3=x,this._y3=y;break;case 2:this._point=3;this._x4=x,this._y4=y;this._context.moveTo((this._x0+4*this._x1+x)/6,(this._y0+4*this._y1+y)/6);break;default:point(this,x,y);break}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y}};var basisClosed=function(context){return new BasisClosed(context)};function BasisOpen(context){this._context=context}BasisOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var x0=(this._x0+4*this._x1+x)/6,y0=(this._y0+4*this._y1+y)/6;this._line?this._context.lineTo(x0,y0):this._context.moveTo(x0,y0);break;case 3:this._point=4;default:point(this,x,y);break}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y}};var basisOpen=function(context){return new BasisOpen(context)};function Bundle(context,beta){this._basis=new Basis(context);this._beta=beta}Bundle.prototype={lineStart:function(){this._x=[];this._y=[];this._basis.lineStart()},lineEnd:function(){var x=this._x,y=this._y,j=x.length-1;if(j>0){var x0=x[0],y0=y[0],dx=x[j]-x0,dy=y[j]-y0,i=-1,t;while(++i<=j){t=i/j;this._basis.point(this._beta*x[i]+(1-this._beta)*(x0+t*dx),this._beta*y[i]+(1-this._beta)*(y0+t*dy))}}this._x=this._y=null;this._basis.lineEnd()},point:function(x,y){this._x.push(+x);this._y.push(+y)}};var curve_bundle=function custom(beta){function bundle(context){return beta===1?new Basis(context):new Bundle(context,beta)}bundle.beta=function(beta){return custom(+beta)};return bundle}(.85);function cardinal_point(that,x,y){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x),that._y2+that._k*(that._y1-y),that._x2,that._y2)}function Cardinal(context,tension){this._context=context;this._k=(1-tension)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:cardinal_point(this,this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;this._x1=x,this._y1=y;break;case 2:this._point=3;default:cardinal_point(this,x,y);break}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var cardinal=function custom(tension){function cardinal(context){return new Cardinal(context,tension)}cardinal.tension=function(tension){return custom(+tension)};return cardinal}(0);function CardinalClosed(context,tension){this._context=context;this._k=(1-tension)/6}CardinalClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3);this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3);this._context.closePath();break}case 3:{this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}}},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._x3=x,this._y3=y;break;case 1:this._point=2;this._context.moveTo(this._x4=x,this._y4=y);break;case 2:this._point=3;this._x5=x,this._y5=y;break;default:cardinal_point(this,x,y);break}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var cardinalClosed=function custom(tension){function cardinal(context){return new CardinalClosed(context,tension)}cardinal.tension=function(tension){return custom(+tension)};return cardinal}(0);function CardinalOpen(context,tension){this._context=context;this._k=(1-tension)/6}CardinalOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:cardinal_point(this,x,y);break}this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var cardinalOpen=function custom(tension){function cardinal(context){return new CardinalOpen(context,tension)}cardinal.tension=function(tension){return custom(+tension)};return cardinal}(0);function catmullRom_point(that,x,y){var x1=that._x1,y1=that._y1,x2=that._x2,y2=that._y2;if(that._l01_a>epsilon){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x1=(x1*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n;y1=(y1*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n}if(that._l23_a>epsilon){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x2=(x2*b+that._x1*that._l23_2a-x*that._l12_2a)/m;y2=(y2*b+that._y1*that._l23_2a-y*that._l12_2a)/m}that._context.bezierCurveTo(x1,y1,x2,y2,that._x2,that._y2)}function CatmullRom(context,alpha){this._context=context;this._alpha=alpha}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;default:catmullRom_point(this,x,y);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var curve_catmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom(context,alpha):new Cardinal(context,0)}catmullRom.alpha=function(alpha){return custom(+alpha)};return catmullRom}(.5);function CatmullRomClosed(context,alpha){this._context=context;this._alpha=alpha}CatmullRomClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3);this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3);this._context.closePath();break}case 3:{this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}}},point:function(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1;this._x3=x,this._y3=y;break;case 1:this._point=2;this._context.moveTo(this._x4=x,this._y4=y);break;case 2:this._point=3;this._x5=x,this._y5=y;break;default:catmullRom_point(this,x,y);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var catmullRomClosed=function custom(alpha){function catmullRom(context){return alpha?new CatmullRomClosed(context,alpha):new CardinalClosed(context,0)}catmullRom.alpha=function(alpha){return custom(+alpha)};return catmullRom}(.5);function CatmullRomOpen(context,alpha){this._context=context;this._alpha=alpha}CatmullRomOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point:function(x,y){x=+x,y=+y;if(this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:catmullRom_point(this,x,y);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=x;this._y0=this._y1,this._y1=this._y2,this._y2=y}};var catmullRomOpen=function custom(alpha){function catmullRom(context){return alpha?new CatmullRomOpen(context,alpha):new CardinalOpen(context,0)}catmullRom.alpha=function(alpha){return custom(+alpha)};return catmullRom}(.5);function LinearClosed(context){this._context=context}LinearClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._point=0},lineEnd:function(){if(this._point)this._context.closePath()},point:function(x,y){x=+x,y=+y;if(this._point)this._context.lineTo(x,y);else this._point=1,this._context.moveTo(x,y)}};var linearClosed=function(context){return new LinearClosed(context)};function sign(x){return x<0?-1:1}function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign(s0)+sign(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}function monotone_point(that,t0,t1){var x0=that._x0,y0=that._y0,x1=that._x1,y1=that._y1,dx=(x1-x0)/3;that._context.bezierCurveTo(x0+dx,y0+dx*t0,x1-dx,y1-dx*t1,x1,y1)}function MonotoneX(context){this._context=context}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN;this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:monotone_point(this,this._t0,slope2(this,this._t0));break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point:function(x,y){var t1=NaN;x=+x,y=+y;if(x===this._x1&&y===this._y1)return;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;monotone_point(this,slope2(this,t1=slope3(this,x,y)),t1);break;default:monotone_point(this,this._t0,t1=slope3(this,x,y));break}this._x0=this._x1,this._x1=x;this._y0=this._y1,this._y1=y;this._t0=t1}};function MonotoneY(context){this._context=new ReflectContext(context)}(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(x,y){MonotoneX.prototype.point.call(this,y,x)};function ReflectContext(context){this._context=context}ReflectContext.prototype={moveTo:function(x,y){this._context.moveTo(y,x)},closePath:function(){this._context.closePath()},lineTo:function(x,y){this._context.lineTo(y,x)},bezierCurveTo:function(x1,y1,x2,y2,x,y){this._context.bezierCurveTo(y1,x1,y2,x2,y,x)}};function monotoneX(context){return new MonotoneX(context)}function monotoneY(context){return new MonotoneY(context)}function Natural(context){this._context=context}Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[];this._y=[]},lineEnd:function(){var x=this._x,y=this._y,n=x.length;if(n){this._line?this._context.lineTo(x[0],y[0]):this._context.moveTo(x[0],y[0]);if(n===2){this._context.lineTo(x[1],y[1])}else{var px=controlPoints(x),py=controlPoints(y);for(var i0=0,i1=1;i1=0;--i)a[i]=(r[i]-a[i+1])/b[i];b[n-1]=(x[n]+a[n-1])/2;for(i=0;i=0)this._t=1-this._t,this._line=1-this._line},point:function(x,y){x=+x,y=+y;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;default:{if(this._t<=0){this._context.lineTo(this._x,y);this._context.lineTo(x,y)}else{var x1=this._x*(1-this._t)+x*this._t;this._context.lineTo(x1,this._y);this._context.lineTo(x1,y)}break}}this._x=x,this._y=y}};var step=function(context){return new Step(context,.5)};function stepBefore(context){return new Step(context,0)}function stepAfter(context){return new Step(context,1)}var none=function(series,order){if(!((n=series.length)>1))return;for(var i=1,j,s0,s1=series[order[0]],n,m=s1.length;i=0)o[n]=n;return o};function stackValue(d,key){return d[key]}var src_stack=function(){var keys=constant([]),order=order_none,offset=none,value=stackValue;function stack(data){var kz=keys.apply(this,arguments),i,m=data.length,n=kz.length,sz=new Array(n),oz;for(i=0;i0))return;for(var i,n,j=0,m=series[0].length,y;j1))return;for(var i,j=0,d,dy,yp,yn,n,m=series[order[0]].length;j=0){d[0]=yp,d[1]=yp+=dy}else if(dy<0){d[1]=yn,d[0]=yn+=dy}else{d[0]=yp}}}};var silhouette=function(series,order){if(!((n=series.length)>0))return;for(var j=0,s0=series[order[0]],n,m=s0.length;j0)||!((m=(s0=series[order[0]]).length)>0))return;for(var y=0,j=1,s0,m,n;j0?1:x<0?-1:0};var sin=Math.sin;var tan=Math.tan;var math_epsilon=1e-6;var epsilon2=1e-12;var pi=Math.PI;var halfPi=pi/2;var quarterPi=pi/4;var sqrt1_2=Math.SQRT1_2;var sqrt2=sqrt(2);var sqrtPi=sqrt(pi);var tau=pi*2;var degrees=180/pi;var radians=pi/180;function sinci(x){return x?x/Math.sin(x):1}function asin(x){return x>1?halfPi:x<-1?-halfPi:Math.asin(x)}function acos(x){return x>1?0:x<-1?pi:Math.acos(x)}function sqrt(x){return x>0?Math.sqrt(x):0}function tanh(x){x=exp(2*x);return(x-1)/(x+1)}function sinh(x){return(exp(x)-exp(-x))/2}function cosh(x){return(exp(x)+exp(-x))/2}function arsinh(x){return log(x+sqrt(x*x+1))}function arcosh(x){return log(x+sqrt(x*x-1))}function airyRaw(beta){var tanBeta_2=tan(beta/2),b=2*log(cos(beta/2))/(tanBeta_2*tanBeta_2);function forward(x,y){var cosx=cos(x),cosy=cos(y),siny=sin(y),cosz=cosy*cosx,k=-((1-cosz?log((1+cosz)/2)/(1-cosz):-.5)+b/(1+cosz));return[k*cosy*sin(x),k*siny]}forward.invert=function(x,y){var r=sqrt(x*x+y*y),z=-beta/2,i=50,delta;if(!r)return[0,0];do{var z_2=z/2,cosz_2=cos(z_2),sinz_2=sin(z_2),tanz_2=tan(z_2),lnsecz_2=log(1/cosz_2);z-=delta=(2/tanz_2*lnsecz_2-b*tanz_2-r)/(-lnsecz_2/(sinz_2*sinz_2)+1-b/(2*cosz_2*cosz_2))}while(abs(delta)>math_epsilon&&--i>0);var sinz=sin(z);return[atan2(x*sinz,r*cos(z)),asin(y*sinz/r)]};return forward}var airy=function(){var beta=halfPi,m=Object(d3_geo["geoProjectionMutator"])(airyRaw),p=m(beta);p.radius=function(_){return arguments.length?m(beta=_*radians):beta*degrees};return p.scale(179.976).clipAngle(147)};function aitoffRaw(x,y){var cosy=cos(y),sincia=sinci(acos(cosy*cos(x/=2)));return[2*cosy*sin(x)*sincia,sin(y)*sincia]}aitoffRaw.invert=function(x,y){if(x*x+4*y*y>pi*pi+math_epsilon)return;var x1=x,y1=y,i=25;do{var sinx=sin(x1),sinx_2=sin(x1/2),cosx_2=cos(x1/2),siny=sin(y1),cosy=cos(y1),sin_2y=sin(2*y1),sin2y=siny*siny,cos2y=cosy*cosy,sin2x_2=sinx_2*sinx_2,c=1-cos2y*cosx_2*cosx_2,e=c?acos(cosy*cosx_2)*sqrt(f=1/c):f=0,f,fx=2*e*cosy*sinx_2-x,fy=e*siny-y,dxdx=f*(cos2y*sin2x_2+e*cosy*cosx_2*sin2y),dxdy=f*(.5*sinx*sin_2y-e*2*siny*sinx_2),dydx=f*.25*(sin_2y*sinx_2-e*siny*cos2y*sinx),dydy=f*(sin2y*cosx_2+e*sin2x_2*cosy),z=dxdy*dydx-dydy*dxdx;if(!z)break;var dx=(fy*dxdy-fx*dydy)/z,dy=(fx*dydx-fy*dxdx)/z;x1-=dx,y1-=dy}while((abs(dx)>math_epsilon||abs(dy)>math_epsilon)&&--i>0);return[x1,y1]};var aitoff=function(){return Object(d3_geo["geoProjection"])(aitoffRaw).scale(152.63)};function armadilloRaw(phi0){var sinPhi0=sin(phi0),cosPhi0=cos(phi0),sPhi0=phi0>=0?1:-1,tanPhi0=tan(sPhi0*phi0),k=(1+sinPhi0-cosPhi0)/2;function forward(lambda,phi){var cosPhi=cos(phi),cosLambda=cos(lambda/=2);return[(1+cosPhi)*sin(lambda),(sPhi0*phi>-atan2(cosLambda,tanPhi0)-.001?0:-sPhi0*10)+k+sin(phi)*cosPhi0-(1+cosPhi)*sinPhi0*cosLambda]}forward.invert=function(x,y){var lambda=0,phi=0,i=50;do{var cosLambda=cos(lambda),sinLambda=sin(lambda),cosPhi=cos(phi),sinPhi=sin(phi),A=1+cosPhi,fx=A*sinLambda-x,fy=k+sinPhi*cosPhi0-A*sinPhi0*cosLambda-y,dxdLambda=A*cosLambda/2,dxdPhi=-sinLambda*sinPhi,dydLambda=sinPhi0*A*sinLambda/2,dydPhi=cosPhi0*cosPhi+sinPhi0*cosLambda*sinPhi,denominator=dxdPhi*dydLambda-dydPhi*dxdLambda,dLambda=(fy*dxdPhi-fx*dydPhi)/denominator/2,dPhi=(fx*dydLambda-fy*dxdLambda)/denominator;lambda-=dLambda,phi-=dPhi}while((abs(dLambda)>math_epsilon||abs(dPhi)>math_epsilon)&&--i>0);return sPhi0*phi>-atan2(cos(lambda),tanPhi0)-.001?[lambda*2,phi]:null};return forward}var armadillo=function(){var phi0=20*radians,sPhi0=phi0>=0?1:-1,tanPhi0=tan(sPhi0*phi0),m=Object(d3_geo["geoProjectionMutator"])(armadilloRaw),p=m(phi0),stream_=p.stream;p.parallel=function(_){if(!arguments.length)return phi0*degrees;tanPhi0=tan((sPhi0=(phi0=_*radians)>=0?1:-1)*phi0);return m(phi0)};p.stream=function(stream){var rotate=p.rotate(),rotateStream=stream_(stream),sphereStream=(p.rotate([0,0]),stream_(stream));p.rotate(rotate);rotateStream.sphere=function(){sphereStream.polygonStart(),sphereStream.lineStart();for(var lambda=sPhi0*-180;sPhi0*lambda<180;lambda+=sPhi0*90)sphereStream.point(lambda,sPhi0*90);while(sPhi0*(lambda-=phi0)>=-180){sphereStream.point(lambda,sPhi0*-atan2(cos(lambda*radians/2),tanPhi0)*degrees)}sphereStream.lineEnd(),sphereStream.polygonEnd()};return rotateStream};return p.scale(218.695).center([0,28.0974])};function augustRaw(lambda,phi){var tanPhi=tan(phi/2),k=sqrt(1-tanPhi*tanPhi),c=1+k*cos(lambda/=2),x=sin(lambda)*k/c,y=tanPhi/c,x2=x*x,y2=y*y;return[4/3*x*(3+x2-3*y2),4/3*y*(3+3*x2-y2)]}augustRaw.invert=function(x,y){x*=3/8,y*=3/8;if(!x&&abs(y)>1)return null;var x2=x*x,y2=y*y,s=1+x2+y2,sin3Eta=sqrt((s-sqrt(s*s-4*y*y))/2),eta=asin(sin3Eta)/3,xi=sin3Eta?arcosh(abs(y/sin3Eta))/3:arsinh(abs(x))/3,cosEta=cos(eta),coshXi=cosh(xi),d=coshXi*coshXi-cosEta*cosEta;return[sign(x)*2*atan2(sinh(xi)*cosEta,.25-d),sign(y)*2*atan2(coshXi*sin(eta),.25+d)]};var august=function(){return Object(d3_geo["geoProjection"])(augustRaw).scale(66.1603)};var sqrt8=sqrt(8),baker_phi0=log(1+sqrt2);function bakerRaw(lambda,phi){var phi0=abs(phi);return phi0epsilon2&&--i>0);return[x/(cos(phi)*(sqrt8-1/sin(phi))),sign(y)*phi]};var baker=function(){return Object(d3_geo["geoProjection"])(bakerRaw).scale(112.314)};function berghausRaw(lobes){var k=2*pi/lobes;function forward(lambda,phi){var p=Object(d3_geo["geoAzimuthalEquidistantRaw"])(lambda,phi);if(abs(lambda)>halfPi){var theta=atan2(p[1],p[0]),r=sqrt(p[0]*p[0]+p[1]*p[1]),theta0=k*round((theta-halfPi)/k)+halfPi,alpha=atan2(sin(theta-=theta0),2-cos(theta));theta=theta0+asin(pi/r*sin(alpha))-alpha;p[0]=r*cos(theta);p[1]=r*sin(theta)}return p}forward.invert=function(x,y){var r=sqrt(x*x+y*y);if(r>halfPi){var theta=atan2(y,x),theta0=k*round((theta-halfPi)/k)+halfPi,s=theta>theta0?-1:1,A=r*cos(theta0-theta),cotAlpha=1/tan(s*acos((A-pi)/sqrt(pi*(pi-2*A)+r*r)));theta=theta0+2*atan((cotAlpha+s*sqrt(cotAlpha*cotAlpha-3))/3);x=r*cos(theta),y=r*sin(theta)}return d3_geo["geoAzimuthalEquidistantRaw"].invert(x,y)};return forward}var berghaus=function(){var lobes=5,m=Object(d3_geo["geoProjectionMutator"])(berghausRaw),p=m(lobes),projectionStream=p.stream,epsilon=.01,cr=-cos(epsilon*radians),sr=sin(epsilon*radians);p.lobes=function(_){return arguments.length?m(lobes=+_):lobes};p.stream=function(stream){var rotate=p.rotate(),rotateStream=projectionStream(stream),sphereStream=(p.rotate([0,0]),projectionStream(stream));p.rotate(rotate);rotateStream.sphere=function(){sphereStream.polygonStart(),sphereStream.lineStart();for(var i=0,delta=360/lobes,delta0=2*pi/lobes,phi=90-180/lobes,phi0=halfPi;i0){r[1]*=1+d/1.5*r[0]*r[0]}return r}}var bertin=function(){var p=Object(d3_geo["geoProjection"])(bertin1953Raw());p.rotate([-16.5,-42]);delete p.rotate;return p.scale(176.57).center([7.93,.09])};function mollweideBromleyTheta(cp,phi){var cpsinPhi=cp*sin(phi),i=30,delta;do{phi-=delta=(phi+sin(phi)-cpsinPhi)/(1+cos(phi))}while(abs(delta)>math_epsilon&&--i>0);return phi/2}function mollweideBromleyRaw(cx,cy,cp){function forward(lambda,phi){return[cx*lambda*cos(phi=mollweideBromleyTheta(cp,phi)),cy*sin(phi)]}forward.invert=function(x,y){return y=asin(y/cy),[x/(cx*cos(y)),asin((2*y+sin(2*y))/cp)]};return forward}var mollweideRaw=mollweideBromleyRaw(sqrt2/halfPi,sqrt2,pi);var mollweide=function(){return Object(d3_geo["geoProjection"])(mollweideRaw).scale(169.529)};var boggs_k=2.00276,boggs_w=1.11072;function boggsRaw(lambda,phi){var theta=mollweideBromleyTheta(pi,phi);return[boggs_k*lambda/(1/cos(phi)+boggs_w/cos(theta)),(phi+sqrt2*sin(theta))/boggs_k]}boggsRaw.invert=function(x,y){var ky=boggs_k*y,theta=y<0?-quarterPi:quarterPi,i=25,delta,phi;do{phi=ky-sqrt2*sin(theta);theta-=delta=(sin(2*theta)+2*theta-pi*sin(phi))/(2*cos(2*theta)+2+pi*cos(phi)*sqrt2*cos(theta))}while(abs(delta)>math_epsilon&&--i>0);phi=ky-sqrt2*sin(theta);return[x*(1/cos(phi)+boggs_w/cos(theta))/boggs_k,phi]};var boggs=function(){return Object(d3_geo["geoProjection"])(boggsRaw).scale(160.857)};var parallel1=function(projectAt){var phi0=0,m=Object(d3_geo["geoProjectionMutator"])(projectAt),p=m(phi0);p.parallel=function(_){return arguments.length?m(phi0=_*radians):phi0*degrees};return p};function sinusoidalRaw(lambda,phi){return[lambda*cos(phi),phi]}sinusoidalRaw.invert=function(x,y){return[x/cos(y),y]};var sinusoidal=function(){return Object(d3_geo["geoProjection"])(sinusoidalRaw).scale(152.63)};function bonneRaw(phi0){if(!phi0)return sinusoidalRaw;var cotPhi0=1/tan(phi0);function forward(lambda,phi){var rho=cotPhi0+phi0-phi,e=rho?lambda*cos(phi)/rho:rho;return[rho*sin(e),cotPhi0-rho*cos(e)]}forward.invert=function(x,y){var rho=sqrt(x*x+(y=cotPhi0-y)*y),phi=cotPhi0+phi0-rho;return[rho/cos(phi)*atan2(x,y),phi]};return forward}var bonne=function(){return parallel1(bonneRaw).scale(123.082).center([0,26.1441]).parallel(45)};function bottomleyRaw(sinPsi){function forward(lambda,phi){var rho=halfPi-phi,eta=rho?lambda*sinPsi*sin(rho)/rho:rho;return[rho*sin(eta)/sinPsi,halfPi-rho*cos(eta)]}forward.invert=function(x,y){var x1=x*sinPsi,y1=halfPi-y,rho=sqrt(x1*x1+y1*y1),eta=atan2(x1,y1);return[(rho?rho/sin(rho):1)*eta/sinPsi,halfPi-rho]};return forward}var bottomley=function(){var sinPsi=.5,m=Object(d3_geo["geoProjectionMutator"])(bottomleyRaw),p=m(sinPsi);p.fraction=function(_){return arguments.length?m(sinPsi=+_):sinPsi};return p.scale(158.837)};var bromleyRaw=mollweideBromleyRaw(1,4/pi,pi);var bromley=function(){return Object(d3_geo["geoProjection"])(bromleyRaw).scale(152.63)};function chamberlin_distance(dPhi,c1,s1,c2,s2,dLambda){var cosdLambda=cos(dLambda),r;if(abs(dPhi)>1||abs(dLambda)>1){r=acos(s1*s2+c1*c2*cosdLambda)}else{var sindPhi=sin(dPhi/2),sindLambda=sin(dLambda/2);r=2*asin(sqrt(sindPhi*sindPhi+c1*c2*sindLambda*sindLambda))}return abs(r)>math_epsilon?[r,atan2(c2*sin(dLambda),c1*s2-s1*c2*cosdLambda)]:[0,0]}function angle(b,c,a){return acos((b*b+c*c-a*a)/(2*b*c))}function longitude(lambda){return lambda-2*pi*floor((lambda+pi)/(2*pi))}function chamberlinRaw(p0,p1,p2){var points=[[p0[0],p0[1],sin(p0[1]),cos(p0[1])],[p1[0],p1[1],sin(p1[1]),cos(p1[1])],[p2[0],p2[1],sin(p2[1]),cos(p2[1])]];for(var a=points[2],b,i=0;i<3;++i,a=b){b=points[i];a.v=chamberlin_distance(b[1]-a[1],a[3],a[2],b[3],b[2],b[0]-a[0]);a.point=[0,0]}var beta0=angle(points[0].v[0],points[2].v[0],points[1].v[0]),beta1=angle(points[0].v[0],points[1].v[0],points[2].v[0]),beta2=pi-beta0;points[2].point[1]=0;points[0].point[0]=-(points[1].point[0]=points[0].v[0]/2);var mean=[points[2].point[0]=points[0].point[0]+points[2].v[0]*cos(beta0),2*(points[0].point[1]=points[1].point[1]=points[2].v[0]*sin(beta0))];function forward(lambda,phi){var sinPhi=sin(phi),cosPhi=cos(phi),v=new Array(3),i;for(i=0;i<3;++i){var p=points[i];v[i]=chamberlin_distance(phi-p[1],p[3],p[2],cosPhi,sinPhi,lambda-p[0]);if(!v[i][0])return p.point;v[i][1]=longitude(v[i][1]-p.v[1])}var point=mean.slice();for(i=0;i<3;++i){var j=i==2?0:i+1;var a=angle(points[i].v[0],v[i][0],v[j][0]);if(v[i][1]<0)a=-a;if(!i){point[0]+=v[i][0]*cos(a);point[1]-=v[i][0]*sin(a)}else if(i==1){a=beta1-a;point[0]-=v[i][0]*cos(a);point[1]-=v[i][0]*sin(a)}else{a=beta2-a;point[0]+=v[i][0]*cos(a);point[1]+=v[i][0]*sin(a)}}point[0]/=3,point[1]/=3;return point}return forward}function pointRadians(p){return p[0]*=radians,p[1]*=radians,p}function chamberlinAfrica(){return chamberlin([0,22],[45,22],[22.5,-22]).scale(380).center([22.5,2])}function chamberlin(p0,p1,p2){var c=Object(d3_geo["geoCentroid"])({type:"MultiPoint",coordinates:[p0,p1,p2]}),R=[-c[0],-c[1]],r=Object(d3_geo["geoRotation"])(R),p=Object(d3_geo["geoProjection"])(chamberlinRaw(pointRadians(r(p0)),pointRadians(r(p1)),pointRadians(r(p2)))).rotate(R),center=p.center;delete p.rotate;p.center=function(_){return arguments.length?center(r(_)):r.invert(center())};return p.clipAngle(90)}function collignonRaw(lambda,phi){var alpha=sqrt(1-sin(phi));return[2/sqrtPi*lambda*alpha,sqrtPi*(1-alpha)]}collignonRaw.invert=function(x,y){var lambda=(lambda=y/sqrtPi-1)*lambda;return[lambda>0?x*sqrt(pi/lambda)/2:0,asin(1-lambda)]};var collignon=function(){return Object(d3_geo["geoProjection"])(collignonRaw).scale(95.6464).center([0,30])};function craigRaw(phi0){var tanPhi0=tan(phi0);function forward(lambda,phi){return[lambda,(lambda?lambda/sin(lambda):1)*(sin(phi)*cos(lambda)-tanPhi0*cos(phi))]}forward.invert=tanPhi0?function(x,y){if(x)y*=sin(x)/x;var cosLambda=cos(x);return[x,2*atan2(sqrt(cosLambda*cosLambda+tanPhi0*tanPhi0-y*y)-cosLambda,tanPhi0-y)]}:function(x,y){return[x,asin(x?y*tan(x)/x:y)]};return forward}var craig=function(){return parallel1(craigRaw).scale(249.828).clipAngle(90)};var sqrt3=sqrt(3);function crasterRaw(lambda,phi){return[sqrt3*lambda*(2*cos(2*phi/3)-1)/sqrtPi,sqrt3*sqrtPi*sin(phi/3)]}crasterRaw.invert=function(x,y){var phi=3*asin(y/(sqrt3*sqrtPi));return[sqrtPi*x/(sqrt3*(2*cos(2*phi/3)-1)),phi]};var craster=function(){return Object(d3_geo["geoProjection"])(crasterRaw).scale(156.19)};function cylindricalEqualAreaRaw(phi0){var cosPhi0=cos(phi0);function forward(lambda,phi){return[lambda*cosPhi0,sin(phi)/cosPhi0]}forward.invert=function(x,y){return[x/cosPhi0,asin(y*cosPhi0)]};return forward}var cylindricalEqualArea=function(){return parallel1(cylindricalEqualAreaRaw).parallel(38.58).scale(195.044)};function cylindricalStereographicRaw(phi0){var cosPhi0=cos(phi0);function forward(lambda,phi){return[lambda*cosPhi0,(1+cosPhi0)*tan(phi/2)]}forward.invert=function(x,y){return[x/cosPhi0,atan(y/(1+cosPhi0))*2]};return forward}var cylindricalStereographic=function(){return parallel1(cylindricalStereographicRaw).scale(124.75)};function eckert1Raw(lambda,phi){var alpha=sqrt(8/(3*pi));return[alpha*lambda*(1-abs(phi)/pi),alpha*phi]}eckert1Raw.invert=function(x,y){var alpha=sqrt(8/(3*pi)),phi=y/alpha;return[x/(alpha*(1-abs(phi)/pi)),phi]};var eckert1=function(){return Object(d3_geo["geoProjection"])(eckert1Raw).scale(165.664)};function eckert2Raw(lambda,phi){var alpha=sqrt(4-3*sin(abs(phi)));return[2/sqrt(6*pi)*lambda*alpha,sign(phi)*sqrt(2*pi/3)*(2-alpha)]}eckert2Raw.invert=function(x,y){var alpha=2-abs(y)/sqrt(2*pi/3);return[x*sqrt(6*pi)/(2*alpha),sign(y)*asin((4-alpha*alpha)/3)]};var eckert2=function(){return Object(d3_geo["geoProjection"])(eckert2Raw).scale(165.664)};function eckert3Raw(lambda,phi){var k=sqrt(pi*(4+pi));return[2/k*lambda*(1+sqrt(1-4*phi*phi/(pi*pi))),4/k*phi]}eckert3Raw.invert=function(x,y){var k=sqrt(pi*(4+pi))/2;return[x*k/(1+sqrt(1-y*y*(4+pi)/(4*pi))),y*k/2]};var eckert3=function(){return Object(d3_geo["geoProjection"])(eckert3Raw).scale(180.739)};function eckert4Raw(lambda,phi){var k=(2+halfPi)*sin(phi);phi/=2;for(var i=0,delta=Infinity;i<10&&abs(delta)>math_epsilon;i++){var cosPhi=cos(phi);phi-=delta=(phi+sin(phi)*(cosPhi+2)-k)/(2*cosPhi*(1+cosPhi))}return[2/sqrt(pi*(4+pi))*lambda*(1+cos(phi)),2*sqrt(pi/(4+pi))*sin(phi)]}eckert4Raw.invert=function(x,y){var A=y*sqrt((4+pi)/pi)/2,k=asin(A),c=cos(k);return[x/(2/sqrt(pi*(4+pi))*(1+c)),asin((k+A*(c+2))/(2+halfPi))]};var eckert4=function(){return Object(d3_geo["geoProjection"])(eckert4Raw).scale(180.739)};function eckert5Raw(lambda,phi){return[lambda*(1+cos(phi))/sqrt(2+pi),2*phi/sqrt(2+pi)]}eckert5Raw.invert=function(x,y){var k=sqrt(2+pi),phi=y*k/2;return[k*x/(1+cos(phi)),phi]};var eckert5=function(){return Object(d3_geo["geoProjection"])(eckert5Raw).scale(173.044)};function eckert6Raw(lambda,phi){var k=(1+halfPi)*sin(phi);for(var i=0,delta=Infinity;i<10&&abs(delta)>math_epsilon;i++){phi-=delta=(phi+sin(phi)-k)/(1+cos(phi))}k=sqrt(2+pi);return[lambda*(1+cos(phi))/k,2*phi/k]}eckert6Raw.invert=function(x,y){var j=1+halfPi,k=sqrt(j/2);return[x*2*k/(1+cos(y*=k)),asin((y+sin(y))/j)]};var eckert6=function(){return Object(d3_geo["geoProjection"])(eckert6Raw).scale(173.044)};var eisenlohrK=3+2*sqrt2;function eisenlohrRaw(lambda,phi){var s0=sin(lambda/=2),c0=cos(lambda),k=sqrt(cos(phi)),c1=cos(phi/=2),t=sin(phi)/(c1+sqrt2*c0*k),c=sqrt(2/(1+t*t)),v=sqrt((sqrt2*c1+(c0+s0)*k)/(sqrt2*c1+(c0-s0)*k));return[eisenlohrK*(c*(v-1/v)-2*log(v)),eisenlohrK*(c*t*(v+1/v)-2*atan(t))]}eisenlohrRaw.invert=function(x,y){if(!(p=augustRaw.invert(x/1.2,y*1.065)))return null;var lambda=p[0],phi=p[1],i=20,p;x/=eisenlohrK,y/=eisenlohrK;do{var _0=lambda/2,_1=phi/2,s0=sin(_0),c0=cos(_0),s1=sin(_1),c1=cos(_1),cos1=cos(phi),k=sqrt(cos1),t=s1/(c1+sqrt2*c0*k),t2=t*t,c=sqrt(2/(1+t2)),v0=sqrt2*c1+(c0+s0)*k,v1=sqrt2*c1+(c0-s0)*k,v2=v0/v1,v=sqrt(v2),vm1v=v-1/v,vp1v=v+1/v,fx=c*vm1v-2*log(v)-x,fy=c*t*vp1v-2*atan(t)-y,deltatDeltaLambda=s1&&sqrt1_2*k*s0*t2/s1,deltatDeltaPhi=(sqrt2*c0*c1+k)/(2*(c1+sqrt2*c0*k)*(c1+sqrt2*c0*k)*k),deltacDeltat=-.5*t*c*c*c,deltacDeltaLambda=deltacDeltat*deltatDeltaLambda,deltacDeltaPhi=deltacDeltat*deltatDeltaPhi,A=(A=2*c1+sqrt2*k*(c0-s0))*A*v,deltavDeltaLambda=(sqrt2*c0*c1*k+cos1)/A,deltavDeltaPhi=-(sqrt2*s0*s1)/(k*A),deltaxDeltaLambda=vm1v*deltacDeltaLambda-2*deltavDeltaLambda/v+c*(deltavDeltaLambda+deltavDeltaLambda/v2),deltaxDeltaPhi=vm1v*deltacDeltaPhi-2*deltavDeltaPhi/v+c*(deltavDeltaPhi+deltavDeltaPhi/v2),deltayDeltaLambda=t*vp1v*deltacDeltaLambda-2*deltatDeltaLambda/(1+t2)+c*vp1v*deltatDeltaLambda+c*t*(deltavDeltaLambda-deltavDeltaLambda/v2),deltayDeltaPhi=t*vp1v*deltacDeltaPhi-2*deltatDeltaPhi/(1+t2)+c*vp1v*deltatDeltaPhi+c*t*(deltavDeltaPhi-deltavDeltaPhi/v2),denominator=deltaxDeltaPhi*deltayDeltaLambda-deltayDeltaPhi*deltaxDeltaLambda;if(!denominator)break;var deltaLambda=(fy*deltaxDeltaPhi-fx*deltayDeltaPhi)/denominator,deltaPhi=(fx*deltayDeltaLambda-fy*deltaxDeltaLambda)/denominator;lambda-=deltaLambda;phi=max(-halfPi,min(halfPi,phi-deltaPhi))}while((abs(deltaLambda)>math_epsilon||abs(deltaPhi)>math_epsilon)&&--i>0);return abs(abs(phi)-halfPi)rho2){var r=sqrt(r2),theta=atan2(y,x),theta0=k*round(theta/k),alpha=theta-theta0,rhoCosAlpha=rho*cos(alpha),k_=(rho*sin(alpha)-alpha*sin(rhoCosAlpha))/(halfPi-rhoCosAlpha),s_=gingeryLength(alpha,k_),e=(pi-rho)/gingeryIntegrate(s_,rhoCosAlpha,pi);x=r;var i=50,delta;do{x-=delta=(rho+gingeryIntegrate(s_,rhoCosAlpha,x)*e-r)/(s_(x)*e)}while(abs(delta)>math_epsilon&&--i>0);y=alpha*sin(x);if(xrho2){var r=sqrt(r2),theta=atan2(y,x),theta0=k*round(theta/k),dTheta=theta-theta0;x=r*cos(dTheta);y=r*sin(dTheta);var x_halfPi=x-halfPi,sinx=sin(x),alpha=y/sinx,delta=xmath_epsilon||abs(deltaPhi)>math_epsilon)&&--i>0);return[lambda,phi]};return forward};var ginzburg4Raw=ginzburgPolyconic(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555);var ginzburg4=function(){return Object(d3_geo["geoProjection"])(ginzburg4Raw).scale(149.995)};var ginzburg5Raw=ginzburgPolyconic(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742);var ginzburg5=function(){return Object(d3_geo["geoProjection"])(ginzburg5Raw).scale(153.93)};var ginzburg6Raw=ginzburgPolyconic(5/6*pi,-.62636,-.0344,0,1.3493,-.05524,0,.045);var ginzburg6=function(){return Object(d3_geo["geoProjection"])(ginzburg6Raw).scale(130.945)};function ginzburg8Raw(lambda,phi){var lambda2=lambda*lambda,phi2=phi*phi;return[lambda*(1-.162388*phi2)*(.87-952426e-9*lambda2*lambda2),phi*(1+phi2/12)]}ginzburg8Raw.invert=function(x,y){var lambda=x,phi=y,i=50,delta;do{var phi2=phi*phi;phi-=delta=(phi*(1+phi2/12)-y)/(1+phi2/4)}while(abs(delta)>math_epsilon&&--i>0);i=50;x/=1-.162388*phi2;do{var lambda4=(lambda4=lambda*lambda)*lambda4;lambda-=delta=(lambda*(.87-952426e-9*lambda4)-x)/(.87-.00476213*lambda4)}while(abs(delta)>math_epsilon&&--i>0);return[lambda,phi]};var ginzburg8=function(){return Object(d3_geo["geoProjection"])(ginzburg8Raw).scale(131.747)};var ginzburg9Raw=ginzburgPolyconic(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);var ginzburg9=function(){return Object(d3_geo["geoProjection"])(ginzburg9Raw).scale(131.087)};var square=function(project){var dx=project(halfPi,0)[0]-project(-halfPi,0)[0];function projectSquare(lambda,phi){var s=lambda>0?-.5:.5,point=project(lambda+s*pi,phi);point[0]-=s*dx;return point}if(project.invert)projectSquare.invert=function(x,y){var s=x>0?-.5:.5,location=project.invert(x+s*dx,y),lambda=location[0]-s*pi;if(lambda<-pi)lambda+=2*pi;else if(lambda>pi)lambda-=2*pi;location[0]=lambda;return location};return projectSquare};function gringortenRaw(lambda,phi){var sLambda=sign(lambda),sPhi=sign(phi),cosPhi=cos(phi),x=cos(lambda)*cosPhi,y=sin(lambda)*cosPhi,z=sin(sPhi*phi);lambda=abs(atan2(y,z));phi=asin(x);if(abs(lambda-halfPi)>math_epsilon)lambda%=halfPi;var point=gringortenHexadecant(lambda>pi/4?halfPi-lambda:lambda,phi);if(lambda>pi/4)z=point[0],point[0]=-point[1],point[1]=-z;return point[0]*=sLambda,point[1]*=-sPhi,point}gringortenRaw.invert=function(x,y){if(abs(x)>1)x=sign(x)*2-x;if(abs(y)>1)y=sign(y)*2-y;var sx=sign(x),sy=sign(y),x0=-sx*x,y0=-sy*y,t=y0/x0<1,p=gringortenHexadecantInvert(t?y0:x0,t?x0:y0),lambda=p[0],phi=p[1],cosPhi=cos(phi);if(t)lambda=-halfPi-lambda;return[sx*(atan2(sin(lambda)*cosPhi,-sin(phi))+pi),sy*asin(cos(lambda)*cosPhi)]};function gringortenHexadecant(lambda,phi){if(phi===halfPi)return[0,0];var sinPhi=sin(phi),r=sinPhi*sinPhi,r2=r*r,j=1+r2,k=1+3*r2,q=1-r2,z=asin(1/sqrt(j)),v=q+r*j*z,p2=(1-sinPhi)/v,p=sqrt(p2),a2=p2*j,a=sqrt(a2),h=p*q,x,i;if(lambda===0)return[0,-(h+r*a)];var cosPhi=cos(phi),secPhi=1/cosPhi,drdPhi=2*sinPhi*cosPhi,dvdPhi=(-3*r+z*k)*drdPhi,dp2dPhi=(-v*cosPhi-(1-sinPhi)*dvdPhi)/(v*v),dpdPhi=.5*dp2dPhi/p,dhdPhi=q*dpdPhi-2*r*p*drdPhi,dra2dPhi=r*j*dp2dPhi+p2*k*drdPhi,mu=-secPhi*drdPhi,nu=-secPhi*dra2dPhi,zeta=-2*secPhi*dhdPhi,lambda1=4*lambda/pi,delta;if(lambda>.222*pi||phi.175*pi){x=(h+r*sqrt(a2*(1+r2)-h*h))/(1+r2);if(lambda>pi/4)return[x,x];var x1=x,x0=.5*x;x=.5*(x0+x1),i=50;do{var g=sqrt(a2-x*x),f=x*(zeta+mu*g)+nu*asin(x/a)-lambda1;if(!f)break;if(f<0)x0=x;else x1=x;x=.5*(x0+x1)}while(abs(x1-x0)>math_epsilon&&--i>0)}else{x=math_epsilon,i=25;do{var x2=x*x,g2=sqrt(a2-x2),zetaMug=zeta+mu*g2,f2=x*zetaMug+nu*asin(x/a)-lambda1,df=zetaMug+(nu-mu*x2)/g2;x-=delta=g2?f2/df:0}while(abs(delta)>math_epsilon&&--i>0)}return[x,-h-r*sqrt(a2-x*x)]}function gringortenHexadecantInvert(x,y){var x0=0,x1=1,r=.5,i=50;while(true){var r2=r*r,sinPhi=sqrt(r),z=asin(1/sqrt(1+r2)),v=1-r2+r*(1+r2)*z,p2=(1-sinPhi)/v,p=sqrt(p2),a2=p2*(1+r2),h=p*(1-r2),g2=a2-x*x,g=sqrt(g2),y0=y+h+r*g;if(abs(x1-x0)0)x0=r;else x1=r;r=.5*(x0+x1)}if(!i)return null;var phi=asin(sinPhi),cosPhi=cos(phi),secPhi=1/cosPhi,drdPhi=2*sinPhi*cosPhi,dvdPhi=(-3*r+z*(1+3*r2))*drdPhi,dp2dPhi=(-v*cosPhi-(1-sinPhi)*dvdPhi)/(v*v),dpdPhi=.5*dp2dPhi/p,dhdPhi=(1-r2)*dpdPhi-2*r*p*drdPhi,zeta=-2*secPhi*dhdPhi,mu=-secPhi*drdPhi,nu=-secPhi*(r*(1+r2)*dp2dPhi+p2*(1+3*r2)*drdPhi);return[pi/4*(x*(zeta+mu*g)+nu*asin(x/sqrt(a2))),phi]}var gringorten=function(){return Object(d3_geo["geoProjection"])(square(gringortenRaw)).scale(239.75)};function ellipticJi(u,v,m){var a,b,c;if(!u){b=ellipticJ(v,1-m);return[[0,b[0]/b[1]],[1/b[1],0],[b[2]/b[1],0]]}a=ellipticJ(u,m);if(!v)return[[a[0],0],[a[1],0],[a[2],0]];b=ellipticJ(v,1-m);c=b[1]*b[1]+m*a[0]*a[0]*b[0]*b[0];return[[a[0]*b[2]/c,a[1]*a[2]*b[0]*b[1]/c],[a[1]*b[1]/c,-a[0]*a[2]*b[0]*b[2]/c],[a[2]*b[1]*b[2]/c,-m*a[0]*a[1]*b[0]/c]]}function ellipticJ(u,m){var ai,b,phi,t,twon;if(m=1-math_epsilon){ai=(1-m)/4;b=cosh(u);t=tanh(u);phi=1/b;twon=b*sinh(u);return[t+ai*(twon-u)/(b*b),phi-ai*t*phi*(twon-u),phi+ai*t*phi*(twon+u),2*atan(exp(u))-halfPi+ai*(twon-u)/b]}var a=[1,0,0,0,0,0,0,0,0],c=[sqrt(m),0,0,0,0,0,0,0,0],i=0;b=sqrt(1-m);twon=1;while(abs(c[i]/a[i])>math_epsilon&&i<8){ai=a[i++];c[i]=(ai-b)/2;a[i]=(ai+b)/2;b=sqrt(ai*b);twon*=2}phi=twon*a[i]*u;do{t=c[i]*sin(b=phi)/a[i];phi=(asin(t)+phi)/2}while(--i);return[sin(phi),t=cos(phi),t/cos(phi-b),phi]}function ellipticFi(phi,psi,m){var r=abs(phi),i=abs(psi),sinhPsi=sinh(i);if(r){var cscPhi=1/sin(r),cotPhi2=1/(tan(r)*tan(r)),b=-(cotPhi2+m*(sinhPsi*sinhPsi*cscPhi*cscPhi)-1+m),c=(m-1)*cotPhi2,cotLambda2=(-b+sqrt(b*b-4*c))/2;return[ellipticF(atan(1/sqrt(cotLambda2)),m)*sign(phi),ellipticF(atan(sqrt((cotLambda2/cotPhi2-1)/m)),1-m)*sign(psi)]}return[0,ellipticF(atan(sinhPsi),1-m)*sign(psi)]}function ellipticF(phi,m){if(!m)return phi;if(m===1)return log(tan(phi/2+quarterPi));var a=1,b=sqrt(1-m),c=sqrt(m);for(var i=0;abs(c)>math_epsilon;i++){if(phi%pi){var dPhi=atan(b*tan(phi)/a);if(dPhi<0)dPhi+=pi;phi+=dPhi+~~(phi/pi)*pi}else phi+=phi;c=(a+b)/2;b=sqrt(a*b);c=((a=c)-b)/2}return phi/(pow(2,i)*a)}function guyouRaw(lambda,phi){var k_=(sqrt2-1)/(sqrt2+1),k=sqrt(1-k_*k_),K=ellipticF(halfPi,k*k),f=-1,psi=log(tan(pi/4+abs(phi)/2)),r=exp(f*psi)/sqrt(k_),at=guyouComplexAtan(r*cos(f*lambda),r*sin(f*lambda)),t=ellipticFi(at[0],at[1],k*k);return[-t[1],(phi>=0?1:-1)*(.5*K-t[0])]}function guyouComplexAtan(x,y){var x2=x*x,y_1=y+1,t=1-x2-y*y;return[.5*((x>=0?halfPi:-halfPi)-atan2(t,2*x)),-.25*log(t*t+4*x2)+.5*log(y_1*y_1+x2)]}function guyouComplexDivide(a,b){var denominator=b[0]*b[0]+b[1]*b[1];return[(a[0]*b[0]+a[1]*b[1])/denominator,(a[1]*b[0]-a[0]*b[1])/denominator]}guyouRaw.invert=function(x,y){var k_=(sqrt2-1)/(sqrt2+1),k=sqrt(1-k_*k_),K=ellipticF(halfPi,k*k),f=-1,j=ellipticJi(.5*K-y,-x,k*k),tn=guyouComplexDivide(j[0],j[1]),lambda=atan2(tn[1],tn[0])/f;return[lambda,2*atan(exp(.5/f*log(k_*tn[0]*tn[0]+k_*tn[1]*tn[1])))-halfPi]};var guyou=function(){return Object(d3_geo["geoProjection"])(square(guyouRaw)).scale(151.496)};function hammerRetroazimuthalRaw(phi0){var sinPhi0=sin(phi0),cosPhi0=cos(phi0),rotate=hammerRetroazimuthalRotation(phi0);rotate.invert=hammerRetroazimuthalRotation(-phi0);function forward(lambda,phi){var p=rotate(lambda,phi);lambda=p[0],phi=p[1];var sinPhi=sin(phi),cosPhi=cos(phi),cosLambda=cos(lambda),z=acos(sinPhi0*sinPhi+cosPhi0*cosPhi*cosLambda),sinz=sin(z),K=abs(sinz)>math_epsilon?z/sinz:1;return[K*cosPhi0*sin(lambda),(abs(lambda)>halfPi?K:-K)*(sinPhi0*cosPhi-cosPhi0*sinPhi*cosLambda)]}forward.invert=function(x,y){var rho=sqrt(x*x+y*y),sinz=-sin(rho),cosz=cos(rho),a=rho*cosz,b=-y*sinz,c=rho*sinPhi0,d=sqrt(a*a+b*b-c*c),phi=atan2(a*c+b*d,b*c-a*d),lambda=(rho>halfPi?-1:1)*atan2(x*sinz,rho*cos(phi)*cosz+y*sin(phi)*sinz);return rotate.invert(lambda,phi)};return forward}function hammerRetroazimuthalRotation(phi0){var sinPhi0=sin(phi0),cosPhi0=cos(phi0);return function(lambda,phi){var cosPhi=cos(phi),x=cos(lambda)*cosPhi,y=sin(lambda)*cosPhi,z=sin(phi);return[atan2(y,x*cosPhi0-z*sinPhi0),asin(z*cosPhi0+x*sinPhi0)]}}var hammerRetroazimuthal=function(){var phi0=0,m=Object(d3_geo["geoProjectionMutator"])(hammerRetroazimuthalRaw),p=m(phi0),rotate_=p.rotate,stream_=p.stream,circle=Object(d3_geo["geoCircle"])();p.parallel=function(_){if(!arguments.length)return phi0*degrees;var r=p.rotate();return m(phi0=_*radians).rotate(r)};p.rotate=function(_){if(!arguments.length)return _=rotate_.call(p),_[1]+=phi0*degrees,_;rotate_.call(p,[_[0],_[1]-phi0*degrees]);circle.center([-_[0],-_[1]]);return p};p.stream=function(stream){stream=stream_(stream);stream.sphere=function(){stream.polygonStart();var epsilon=.01,ring=circle.radius(90-epsilon)().coordinates[0],n=ring.length-1,i=-1,p;stream.lineStart();while(++i=0)stream.point((p=ring[i])[0],p[1]);stream.lineEnd();stream.polygonEnd()};return stream};return p.scale(79.4187).parallel(45).clipAngle(180-.001)};var d3_array=__webpack_require__(2);var healpixParallel=41+48/36+37/3600,healpixLambert=cylindricalEqualAreaRaw(0);function healpixRaw(H){var phi0=healpixParallel*radians,dx=collignonRaw(pi,phi0)[0]-collignonRaw(-pi,phi0)[0],y0=healpixLambert(0,phi0)[1],y1=collignonRaw(0,phi0)[1],dy1=sqrtPi-y1,k=tau/H,w=4/tau,h=y0+dy1*dy1*4/tau;function forward(lambda,phi){var point,phi2=abs(phi);if(phi2>phi0){var i=min(H-1,max(0,floor((lambda+pi)/k)));lambda+=pi*(H-1)/H-i*k;point=collignonRaw(lambda,phi2);point[0]=point[0]*tau/dx-tau*(H-1)/(2*H)+i*tau/H;point[1]=y0+(point[1]-y1)*4*dy1/tau;if(phi<0)point[1]=-point[1]}else{point=healpixLambert(lambda,phi)}point[0]*=w,point[1]/=h;return point}forward.invert=function(x,y){x/=w,y*=h;var y2=abs(y);if(y2>y0){var i=min(H-1,max(0,floor((x+pi)/k)));x=(x+pi*(H-1)/H-i*k)*dx/tau;var point=collignonRaw.invert(x,.25*(y2-y0)*tau/dy1+y1);point[0]-=pi*(H-1)/H-i*k;if(y<0)point[1]=-point[1];return point}return healpixLambert.invert(x,y)};return forward}function healpix_sphere(step){return{type:"Polygon",coordinates:[Object(d3_array["range"])(-180,180+step/2,step).map(function(x,i){return[x,i&1?90-1e-6:healpixParallel]}).concat(Object(d3_array["range"])(180,-180-step/2,-step).map(function(x,i){return[x,i&1?-90+1e-6:-healpixParallel]}))]}}var healpix=function(){var H=4,m=Object(d3_geo["geoProjectionMutator"])(healpixRaw),p=m(H),stream_=p.stream;p.lobes=function(_){return arguments.length?m(H=+_):H};p.stream=function(stream){var rotate=p.rotate(),rotateStream=stream_(stream),sphereStream=(p.rotate([0,0]),stream_(stream));p.rotate(rotate);rotateStream.sphere=function(){Object(d3_geo["geoStream"])(healpix_sphere(180/H),sphereStream)};return rotateStream};return p.scale(239.75)};function hillRaw(K){var L=1+K,sinBt=sin(1/L),Bt=asin(sinBt),A=2*sqrt(pi/(B=pi+4*Bt*L)),B,rho0=.5*A*(L+sqrt(K*(2+K))),K2=K*K,L2=L*L;function forward(lambda,phi){var t=1-sin(phi),rho,omega;if(t&&t<2){var theta=halfPi-phi,i=25,delta;do{var sinTheta=sin(theta),cosTheta=cos(theta),Bt_Bt1=Bt+atan2(sinTheta,L-cosTheta),C=1+L2-2*L*cosTheta;theta-=delta=(theta-K2*Bt-L*sinTheta+C*Bt_Bt1-.5*t*B)/(2*L*sinTheta*Bt_Bt1)}while(abs(delta)>epsilon2&&--i>0);rho=A*sqrt(C);omega=lambda*Bt_Bt1/pi}else{rho=A*(K+t);omega=lambda*Bt/pi}return[rho*sin(omega),rho0-rho*cos(omega)]}forward.invert=function(x,y){var rho2=x*x+(y-=rho0)*y,cosTheta=(1+L2-rho2/(A*A))/(2*L),theta=acos(cosTheta),sinTheta=sin(theta),Bt_Bt1=Bt+atan2(sinTheta,L-cosTheta);return[asin(x/sqrt(rho2))*pi/Bt_Bt1,asin(1-2*(theta-K2*Bt-L*sinTheta+(1+L2-2*L*cosTheta)*Bt_Bt1)/B)]};return forward}var hill=function(){var K=1,m=Object(d3_geo["geoProjectionMutator"])(hillRaw),p=m(K);p.ratio=function(_){return arguments.length?m(K=+_):K};return p.scale(167.774).center([0,18.67])};var sinuMollweidePhi=.7109889596207567;var sinuMollweideY=.0528035274542;function sinuMollweideRaw(lambda,phi){return phi>-sinuMollweidePhi?(lambda=mollweideRaw(lambda,phi),lambda[1]+=sinuMollweideY,lambda):sinusoidalRaw(lambda,phi)}sinuMollweideRaw.invert=function(x,y){return y>-sinuMollweidePhi?mollweideRaw.invert(x,y-sinuMollweideY):sinusoidalRaw.invert(x,y)};var sinuMollweide=function(){return Object(d3_geo["geoProjection"])(sinuMollweideRaw).rotate([-20,-55]).scale(164.263).center([0,-5.4036])};function homolosineRaw(lambda,phi){return abs(phi)>sinuMollweidePhi?(lambda=mollweideRaw(lambda,phi),lambda[1]-=phi>0?sinuMollweideY:-sinuMollweideY,lambda):sinusoidalRaw(lambda,phi)}homolosineRaw.invert=function(x,y){return abs(y)>sinuMollweidePhi?mollweideRaw.invert(x,y+(y>0?sinuMollweideY:-sinuMollweideY)):sinusoidalRaw.invert(x,y)};var homolosine=function(){return Object(d3_geo["geoProjection"])(homolosineRaw).scale(152.63)};function adsimp(f,a,b,fa,fm,fb,V0,tol,maxdepth,depth,state){if(state.nanEncountered){return NaN}var h,f1,f2,sl,sr,s2,m,V1,V2,err;h=b-a;f1=f(a+h*.25);f2=f(b-h*.25);if(isNaN(f1)){state.nanEncountered=true;return}if(isNaN(f2)){state.nanEncountered=true;return}sl=h*(fa+4*f1+fm)/12;sr=h*(fm+4*f2+fb)/12;s2=sl+sr;err=(s2-V0)/15;if(depth>maxdepth){state.maxDepthCount++;return s2+err}else if(Math.abs(err)>1;do{if(approx[r]>sinphi)rmax=r;else rmin=r;r=rmin+rmax>>1}while(r>rmin);var u=approx[r+1]-approx[r];if(u)u=(sinphi-approx[r+1])/u;return(r+1+u)/n}var ratio=2*Y(1)/pi*G/gamma;var forward=function(lambda,phi){var y=Y(abs(sin(phi))),x=elliptic(y)*lambda;y/=ratio;return[x,phi>=0?y:-y]};forward.invert=function(x,y){var phi;y*=ratio;if(abs(y)<1)phi=sign(y)*asin(z(abs(y))*G);return[x/elliptic(abs(y)),phi]};return forward}var hyperelliptical=function(){var alpha=0,k=2.5,gamma=1.183136,m=Object(d3_geo["geoProjectionMutator"])(hyperellipticalRaw),p=m(alpha,k,gamma);p.alpha=function(_){return arguments.length?m(alpha=+_,k,gamma):alpha};p.k=function(_){return arguments.length?m(alpha,k=+_,gamma):k};p.gamma=function(_){return arguments.length?m(alpha,k,gamma=+_):gamma};return p.scale(152.63)};function pointEqual(a,b){return abs(a[0]-b[0])=0;--i){lobe=lobes[1][i];lambda0=lobe[0][0],phi0=lobe[0][1],phi1=lobe[1][1];lambda2=lobe[2][0],phi2=lobe[2][1];coordinates.push(interpolateLine([[lambda2-math_epsilon,phi2-math_epsilon],[lambda2-math_epsilon,phi1+math_epsilon],[lambda0+math_epsilon,phi1+math_epsilon],[lambda0+math_epsilon,phi0-math_epsilon]],30))}return{type:"Polygon",coordinates:[Object(d3_array["merge"])(coordinates)]}}var interrupted=function(project,lobes){var sphere,bounds;function forward(lambda,phi){var sign=phi<0?-1:+1,lobe=lobes[+(phi<0)];for(var i=0,n=lobe.length-1;ilobe[i][2][0];++i);var p=project(lambda-lobe[i][1][0],phi);p[0]+=project(lobe[i][1][0],sign*phi>sign*lobe[i][0][1]?lobe[i][0][1]:phi)[0];return p}if(project.invert)forward.invert=function(x,y){var bound=bounds[+(y<0)],lobe=lobes[+(y<0)];for(var i=0,n=bound.length;iy1)t=y0,y0=y1,y1=t;return[[x0,y0],[x1,y1]]})});return p};if(lobes!=null)p.lobes(lobes);return p};var boggs_lobes=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var interrupted_boggs=function(){return interrupted(boggsRaw,boggs_lobes).scale(160.857)};var homolosine_lobes=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var interrupted_homolosine=function(){return interrupted(homolosineRaw,homolosine_lobes).scale(152.63)};var mollweide_lobes=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var interrupted_mollweide=function(){return interrupted(mollweideRaw,mollweide_lobes).scale(169.529)};var mollweideHemispheres_lobes=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];var mollweideHemispheres=function(){return interrupted(mollweideRaw,mollweideHemispheres_lobes).scale(169.529).rotate([20,0])};var sinuMollweide_lobes=[[[[-180,35],[-30,90],[0,35]],[[0,35],[30,90],[180,35]]],[[[-180,-10],[-102,-90],[-65,-10]],[[-65,-10],[5,-90],[77,-10]],[[77,-10],[103,-90],[180,-10]]]];var interrupted_sinuMollweide=function(){return interrupted(sinuMollweideRaw,sinuMollweide_lobes).rotate([-20,-55]).scale(164.263).center([0,-5.4036])};var sinusoidal_lobes=[[[[-180,0],[-110,90],[-40,0]],[[-40,0],[0,90],[40,0]],[[40,0],[110,90],[180,0]]],[[[-180,0],[-110,-90],[-40,0]],[[-40,0],[0,-90],[40,0]],[[40,0],[110,-90],[180,0]]]];var interrupted_sinusoidal=function(){return interrupted(sinusoidalRaw,sinusoidal_lobes).scale(152.63).rotate([-20,0])};function kavrayskiy7Raw(lambda,phi){return[3/tau*lambda*sqrt(pi*pi/3-phi*phi),phi]}kavrayskiy7Raw.invert=function(x,y){return[tau/3*x/sqrt(pi*pi/3-y*y),y]};var kavrayskiy7=function(){return Object(d3_geo["geoProjection"])(kavrayskiy7Raw).scale(158.837)};function lagrangeRaw(n){function forward(lambda,phi){if(abs(abs(phi)-halfPi)2)return null;x/=2,y/=2;var x2=x*x,y2=y*y,t=2*y/(1+x2+y2);t=pow((1+t)/(1-t),1/n);return[atan2(2*x,1-x2-y2)/n,asin((t-1)/(t+1))]};return forward}var lagrange=function(){var n=.5,m=Object(d3_geo["geoProjectionMutator"])(lagrangeRaw),p=m(n);p.spacing=function(_){return arguments.length?m(n=+_):n};return p.scale(124.75)};var pi_sqrt2=pi/sqrt2;function larriveeRaw(lambda,phi){return[lambda*(1+sqrt(cos(phi)))/2,phi/(cos(phi/2)*cos(lambda/6))]}larriveeRaw.invert=function(x,y){var x0=abs(x),y0=abs(y),lambda=math_epsilon,phi=halfPi;if(y0math_epsilon||abs(deltaPhi)>math_epsilon)&&--i>0);return i&&[lambda,phi]};var laskowski=function(){return Object(d3_geo["geoProjection"])(laskowskiRaw).scale(139.98)};function littrowRaw(lambda,phi){return[sin(lambda)/cos(phi),tan(phi)*cos(lambda)]}littrowRaw.invert=function(x,y){var x2=x*x,y2=y*y,y2_1=y2+1,x2_y2_1=x2+y2_1,cosPhi=x?sqrt1_2*sqrt((x2_y2_1-sqrt(x2_y2_1*x2_y2_1-4*x2))/x2):1/sqrt(y2_1);return[asin(x*cosPhi),sign(y)*acos(cosPhi)]};var littrow=function(){return Object(d3_geo["geoProjection"])(littrowRaw).scale(144.049).clipAngle(90-.001)};function loximuthalRaw(phi0){var cosPhi0=cos(phi0),tanPhi0=tan(quarterPi+phi0/2);function forward(lambda,phi){var y=phi-phi0,x=abs(y)=0){w=C[i];ar=w[0]+zr*(t=ar)-zi*ai;ai=w[1]+zr*ai+zi*t}ar=zr*(t=ar)-zi*ai;ai=zr*ai+zi*t;return[ar,ai]}forward.invert=function(x,y){var i=20,zr=x,zi=y;do{var j=m,w=C[j],ar=w[0],ai=w[1],br=0,bi=0,t;while(--j>=0){w=C[j];br=ar+zr*(t=br)-zi*bi;bi=ai+zr*bi+zi*t;ar=w[0]+zr*(t=ar)-zi*ai;ai=w[1]+zr*ai+zi*t}br=ar+zr*(t=br)-zi*bi;bi=ai+zr*bi+zi*t;ar=zr*(t=ar)-zi*ai-x;ai=zr*ai+zi*t-y;var denominator=br*br+bi*bi,deltar,deltai;zr-=deltar=(ar*br+ai*bi)/denominator;zi-=deltai=(ai*br-ar*bi)/denominator}while(abs(deltar)+abs(deltai)>math_epsilon*math_epsilon&&--i>0);if(i){var rho=sqrt(zr*zr+zi*zi),c=2*atan(rho*.5),sinc=sin(c);return[atan2(zr*sinc,rho*cos(c)),rho?asin(zi*sinc/rho):0]}};return forward}var alaska=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],gs48=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],gs50=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],modifiedStereographic_miller=[[.9245,0],[0,0],[.01943,0]],lee=[[.721316,0],[0,0],[-.00881625,-.00617325]];function modifiedStereographicAlaska(){return modifiedStereographic(alaska,[152,-64]).scale(1500).center([-160.908,62.4864]).clipAngle(25)}function modifiedStereographicGs48(){return modifiedStereographic(gs48,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])}function modifiedStereographicGs50(){return modifiedStereographic(gs50,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])}function modifiedStereographicMiller(){return modifiedStereographic(modifiedStereographic_miller,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)}function modifiedStereographicLee(){return modifiedStereographic(lee,[165,10]).scale(250).clipAngle(130).center([-165,-10])}function modifiedStereographic(coefficients,rotate){var p=Object(d3_geo["geoProjection"])(modifiedStereographicRaw(coefficients)).rotate(rotate).clipAngle(90),r=Object(d3_geo["geoRotation"])(rotate),center=p.center;delete p.rotate;p.center=function(_){return arguments.length?center(r(_)):r.invert(center())};return p}var sqrt6=sqrt(6),sqrt7=sqrt(7);function mtFlatPolarParabolicRaw(lambda,phi){var theta=asin(7*sin(phi)/(3*sqrt6));return[sqrt6*lambda*(2*cos(2*theta/3)-1)/sqrt7,9*sin(theta/3)/sqrt7]}mtFlatPolarParabolicRaw.invert=function(x,y){var theta=3*asin(y*sqrt7/9);return[x*sqrt7/(sqrt6*(2*cos(2*theta/3)-1)),asin(sin(theta)*3*sqrt6/7)]};var mtFlatPolarParabolic=function(){return Object(d3_geo["geoProjection"])(mtFlatPolarParabolicRaw).scale(164.859)};function mtFlatPolarQuarticRaw(lambda,phi){var k=(1+sqrt1_2)*sin(phi),theta=phi;for(var i=0,delta;i<25;i++){theta-=delta=(sin(theta/2)+sin(theta)-k)/(.5*cos(theta/2)+cos(theta));if(abs(delta)epsilon2&&--i>0);phi2=phi*phi;phi4=phi2*phi2;phi6=phi2*phi4;return[x/(.84719-.13063*phi2+phi6*phi6*(-.04515+.05494*phi2-.02326*phi4+.00331*phi6)),phi]};var naturalEarth2=function(){return Object(d3_geo["geoProjection"])(naturalEarth2Raw).scale(175.295)};function nellHammerRaw(lambda,phi){return[lambda*(1+cos(phi))/2,2*(phi-tan(phi/2))]}nellHammerRaw.invert=function(x,y){var p=y/2;for(var i=0,delta=Infinity;i<10&&abs(delta)>math_epsilon;++i){var c=cos(y/2);y-=delta=(y-tan(y/2)-p)/(1-.5/(c*c))}return[2*x/(1+cos(y)),y]};var nellHammer=function(){return Object(d3_geo["geoProjection"])(nellHammerRaw).scale(152.63)};var pattersonK1=1.0148,pattersonK2=.23185,pattersonK3=-.14499,pattersonK4=.02406,pattersonC1=pattersonK1,pattersonC2=5*pattersonK2,pattersonC3=7*pattersonK3,pattersonC4=9*pattersonK4,pattersonYmax=1.790857183;function pattersonRaw(lambda,phi){var phi2=phi*phi;return[lambda,phi*(pattersonK1+phi2*phi2*(pattersonK2+phi2*(pattersonK3+pattersonK4*phi2)))]}pattersonRaw.invert=function(x,y){if(y>pattersonYmax)y=pattersonYmax;else if(y<-pattersonYmax)y=-pattersonYmax;var yc=y,delta;do{var y2=yc*yc;yc-=delta=(yc*(pattersonK1+y2*y2*(pattersonK2+y2*(pattersonK3+pattersonK4*y2)))-y)/(pattersonC1+y2*y2*(pattersonC2+y2*(pattersonC3+pattersonC4*y2)))}while(abs(delta)>math_epsilon);return[x,yc]};var patterson=function(){return Object(d3_geo["geoProjection"])(pattersonRaw).scale(139.319)};function polyconicRaw(lambda,phi){if(abs(phi)math_epsilon&&--i>0);tanPhi=tan(phi);return[(abs(y)=0;){y=b[j];if(x[0]===y[0]&&x[1]===y[1]){if(found)return[found,x];found=x}}}}function faceEdges(face){var n=face.length,edges=[];for(var a=face[n-1],i=0;i0?[-c[0],0]:[180-c[0],180])};var faces=polyhedral_octahedron.map(function(face){return{face,project:faceProjection(face)}});[-1,0,0,1,0,1,4,5].forEach(function(d,i){var node=faces[d];node&&(node.children||(node.children=[])).push(faces[i])});return polyhedral(faces[0],function(lambda,phi){return faces[lambda<-pi/2?phi<0?6:4:lambda<0?phi<0?2:0:lambday^yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi)contains=!contains}return contains};var src_project=function(object,projection){var stream=projection.stream,project;if(!stream)throw new Error("invalid projection");switch(object&&object.type){case"Feature":project=projectFeature;break;case"FeatureCollection":project=projectFeatureCollection;break;default:project=projectGeometry;break}return project(object,stream)};function projectFeatureCollection(o,stream){return{type:"FeatureCollection",features:o.features.map(function(f){return projectFeature(f,stream)})}}function projectFeature(o,stream){return{type:"Feature",id:o.id,properties:o.properties,geometry:projectGeometry(o.geometry,stream)}}function projectGeometryCollection(o,stream){return{type:"GeometryCollection",geometries:o.geometries.map(function(o){return projectGeometry(o,stream)})}}function projectGeometry(o,stream){if(!o)return null;if(o.type==="GeometryCollection")return projectGeometryCollection(o,stream);var sink;switch(o.type){case"Point":sink=sinkPoint;break;case"MultiPoint":sink=sinkPoint;break;case"LineString":sink=sinkLine;break;case"MultiLineString":sink=sinkLine;break;case"Polygon":sink=sinkPolygon;break;case"MultiPolygon":sink=sinkPolygon;break;case"Sphere":sink=sinkPolygon;break;default:return null}Object(d3_geo["geoStream"])(o,stream(sink));return sink.result()}var project_points=[],lines=[];var sinkPoint={point:function(x,y){project_points.push([x,y])},result:function(){var result=!project_points.length?null:project_points.length<2?{type:"Point",coordinates:project_points[0]}:{type:"MultiPoint",coordinates:project_points};project_points=[];return result}};var sinkLine={lineStart:noop,point:function(x,y){project_points.push([x,y])},lineEnd:function(){if(project_points.length)lines.push(project_points),project_points=[]},result:function(){var result=!lines.length?null:lines.length<2?{type:"LineString",coordinates:lines[0]}:{type:"MultiLineString",coordinates:lines};lines=[];return result}};var sinkPolygon={polygonStart:noop,lineStart:noop,point:function(x,y){project_points.push([x,y])},lineEnd:function(){var n=project_points.length;if(n){do{project_points.push(project_points[0].slice())}while(++n<4);lines.push(project_points),project_points=[]}},polygonEnd:noop,result:function(){if(!lines.length)return null;var polygons=[],holes=[];lines.forEach(function(ring){if(clockwise(ring))polygons.push([ring]);else holes.push(ring)});holes.forEach(function(hole){var point=hole[0];polygons.some(function(polygon){if(contains(polygon[0],point)){polygon.push(hole);return true}})||polygons.push([hole])});lines=[];return!polygons.length?null:polygons.length>1?{type:"MultiPolygon",coordinates:polygons}:{type:"Polygon",coordinates:polygons[0]}}};var quincuncial=function(project){var dx=project(halfPi,0)[0]-project(-halfPi,0)[0];function projectQuincuncial(lambda,phi){var t=abs(lambda)0?lambda-pi:lambda+pi,phi),x=(p[0]-p[1])*sqrt1_2,y=(p[0]+p[1])*sqrt1_2;if(t)return[x,y];var d=dx*sqrt1_2,s=x>0^y>0?-1:1;return[s*x-sign(y)*d,s*y-sign(x)*d]}if(project.invert)projectQuincuncial.invert=function(x0,y0){var x=(x0+y0)*sqrt1_2,y=(y0-x0)*sqrt1_2,t=abs(x)<.5*dx&&abs(y)<.5*dx;if(!t){var d=dx*sqrt1_2,s=x>0^y>0?-1:1,x1=-s*x0+(y>0?1:-1)*d,y1=-s*y0+(x>0?1:-1)*d;x=(-x1-y1)*sqrt1_2;y=(x1-y1)*sqrt1_2}var p=project.invert(x,y);if(!t)p[0]+=x>0?pi:-pi;return p};return Object(d3_geo["geoProjection"])(projectQuincuncial).rotate([-90,-90,45]).clipAngle(180-.001)};var quincuncial_gringorten=function(){return quincuncial(gringortenRaw).scale(176.423)};var peirce=function(){return quincuncial(guyouRaw).scale(111.48)};var quantize=function(input,digits){if(!(0<=(digits=+digits)&&digits<=20))throw new Error("invalid digits");function quantizePoint(input){var n=input.length,i=2,output=new Array(n);output[0]=+input[0].toFixed(digits);output[1]=+input[1].toFixed(digits);while(imath_epsilon&&--i>0);var E=x*(tanPhi=tan(phi)),A=tan(abs(y)0?halfPi:-halfPi)*(by+di*(cy-ay)/2+di*di*(cy-2*by+ay)/2)]}robinsonRaw.invert=function(x,y){var yy=y/halfPi,phi=yy*90,i=min(18,abs(phi/5)),i0=max(0,floor(i));do{var ay=robinson_K[i0][1],by=robinson_K[i0+1][1],cy=robinson_K[min(19,i0+2)][1],u=cy-ay,v=cy-2*by+ay,t=2*(abs(yy)-by)/u,c=v/u,di=t*(1-c*t*(1-2*c*t));if(di>=0||i0===1){phi=(y>=0?5:-5)*(di+i);var j=50,delta;do{i=min(18,abs(phi)/5);i0=floor(i);di=i-i0;ay=robinson_K[i0][1];by=robinson_K[i0+1][1];cy=robinson_K[min(19,i0+2)][1];phi-=(delta=(y>=0?halfPi:-halfPi)*(by+di*(cy-ay)/2+di*di*(cy-2*by+ay)/2)-y)*degrees}while(abs(delta)>epsilon2&&--j>0);break}}while(--i0>=0);var ax=robinson_K[i0][0],bx=robinson_K[i0+1][0],cx=robinson_K[min(19,i0+2)][0];return[x/(bx+di*(cx-ax)/2+di*di*(cx-2*bx+ax)/2),phi*radians]};var robinson=function(){return Object(d3_geo["geoProjection"])(robinsonRaw).scale(152.63)};function satelliteVerticalRaw(P){function forward(lambda,phi){var cosPhi=cos(phi),k=(P-1)/(P-cosPhi*cos(lambda));return[k*cosPhi*sin(lambda),k*sin(phi)]}forward.invert=function(x,y){var rho2=x*x+y*y,rho=sqrt(rho2),sinc=(P-sqrt(1-rho2*(P+1)/(P-1)))/((P-1)/rho+rho/(P-1));return[atan2(x*sinc,rho*sqrt(1-sinc*sinc)),rho?asin(y*sinc/rho):0]};return forward}function satelliteRaw(P,omega){var vertical=satelliteVerticalRaw(P);if(!omega)return vertical;var cosOmega=cos(omega),sinOmega=sin(omega);function forward(lambda,phi){var coordinates=vertical(lambda,phi),y=coordinates[1],A=y*sinOmega/(P-1)+cosOmega;return[coordinates[0]*cosOmega/A,y/A]}forward.invert=function(x,y){var k=(P-1)/(P-1-y*sinOmega);return vertical.invert(k*x,k*y*cosOmega)};return forward}var satellite=function(){var distance=2,omega=0,m=Object(d3_geo["geoProjectionMutator"])(satelliteRaw),p=m(distance,omega);p.distance=function(_){if(!arguments.length)return distance;return m(distance=+_,omega)};p.tilt=function(_){if(!arguments.length)return omega*degrees;return m(distance,omega=_*radians)};return p.scale(432.147).clipAngle(acos(1/distance)*degrees-1e-6)};var stitch_epsilon=1e-4,epsilonInverse=1e4,stitch_x0=-180,x0e=stitch_x0+stitch_epsilon,stitch_x1=180,x1e=stitch_x1-stitch_epsilon,stitch_y0=-90,y0e=stitch_y0+stitch_epsilon,stitch_y1=90,y1e=stitch_y1-stitch_epsilon;function nonempty(coordinates){return coordinates.length>0}function stitch_quantize(x){return Math.floor(x*epsilonInverse)/epsilonInverse}function normalizePoint(y){return y===stitch_y0||y===stitch_y1?[0,y]:[stitch_x0,stitch_quantize(y)]}function clampPoint(p){var x=p[0],y=p[1],clamped=false;if(x<=x0e)x=stitch_x0,clamped=true;else if(x>=x1e)x=stitch_x1,clamped=true;if(y<=y0e)y=stitch_y0,clamped=true;else if(y>=y1e)y=stitch_y1,clamped=true;return clamped?[x,y]:p}function clampPoints(points){return points.map(clampPoint)}function extractFragments(rings,polygon,fragments){for(var j=0,m=rings.length;j=x1e||y<=y0e||y>=y1e){ring[i]=clampPoint(point);for(var k=i+1;kx0e&&xky0e&&yk=n)break;fragments.push({index:-1,polygon,ring:ring=ring.slice(k-1)});ring[0]=normalizePoint(ring[0][1]);i=-1;n=ring.length}}}}function stitchFragments(fragments){var i,n=fragments.length;var fragmentByStart={},fragmentByEnd={},fragment,start,startFragment,end,endFragment;for(i=0;i0?pi-y:y)*degrees],p=Object(d3_geo["geoProjection"])(raw(b)).rotate(R),r=Object(d3_geo["geoRotation"])(R),center=p.center;delete p.rotate;p.center=function(_){return arguments.length?center(r(_)):r.invert(center())};return p.clipAngle(90)};function twoPointAzimuthalRaw(d){var cosd=cos(d);function forward(lambda,phi){var coordinates=Object(d3_geo["geoGnomonicRaw"])(lambda,phi);coordinates[0]*=cosd;return coordinates}forward.invert=function(x,y){return d3_geo["geoGnomonicRaw"].invert(x/cosd,y)};return forward}function twoPointAzimuthalUsa(){return twoPointAzimuthal([-158,21.5],[-77,39]).clipAngle(60).scale(400)}function twoPointAzimuthal(p0,p1){return twoPoint(twoPointAzimuthalRaw,p0,p1)}function twoPointEquidistantRaw(z0){if(!(z0*=2))return d3_geo["geoAzimuthalEquidistantRaw"];var lambdaa=-z0/2,lambdab=-lambdaa,z02=z0*z0,tanLambda0=tan(lambdab),S=.5/sin(lambdab);function forward(lambda,phi){var za=acos(cos(phi)*cos(lambda-lambdaa)),zb=acos(cos(phi)*cos(lambda-lambdab)),ys=phi<0?-1:1;za*=za,zb*=zb;return[(za-zb)/(2*z0),ys*sqrt(4*z02*zb-(z02-za+zb)*(z02-za+zb))/(2*z0)]}forward.invert=function(x,y){var y2=y*y,cosza=cos(sqrt(y2+(t=x+lambdaa)*t)),coszb=cos(sqrt(y2+(t=x+lambdab)*t)),t,d;return[atan2(d=cosza-coszb,t=(cosza+coszb)*tanLambda0),(y<0?-1:1)*acos(sqrt(t*t+d*d)*S)]};return forward}function twoPointEquidistantUsa(){return twoPointEquidistant([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)}function twoPointEquidistant(p0,p1){return twoPoint(twoPointEquidistantRaw,p0,p1)}function vanDerGrintenRaw(lambda,phi){if(abs(phi)math_epsilon&&--i>0);return[sign(x)*(sqrt(D*D+4)+D)*pi/4,halfPi*B]};var vanDerGrinten4=function(){return Object(d3_geo["geoProjection"])(vanDerGrinten4Raw).scale(127.16)};var wagner4_A=4*pi+3*sqrt(3),wagner4_B=2*sqrt(2*pi*sqrt(3)/wagner4_A);var wagner4Raw=mollweideBromleyRaw(wagner4_B*sqrt(3)/pi,wagner4_B,wagner4_A/6);var wagner4=function(){return Object(d3_geo["geoProjection"])(wagner4Raw).scale(176.84)};function wagner6Raw(lambda,phi){return[lambda*sqrt(1-3*phi*phi/(pi*pi)),phi]}wagner6Raw.invert=function(x,y){return[x/sqrt(1-3*y*y/(pi*pi)),y]};var wagner6=function(){return Object(d3_geo["geoProjection"])(wagner6Raw).scale(152.63)};function wagner7Raw(lambda,phi){var s=.90631*sin(phi),c0=sqrt(1-s*s),c1=sqrt(2/(1+c0*cos(lambda/=3)));return[2.66723*c0*c1*sin(lambda),1.24104*s*c1]}wagner7Raw.invert=function(x,y){var t1=x/2.66723,t2=y/1.24104,p=sqrt(t1*t1+t2*t2),c=2*asin(p/2);return[3*atan2(x*tan(c),2.66723*p),p&&asin(y*sin(c)/(1.24104*.90631*p))]};var wagner7=function(){return Object(d3_geo["geoProjection"])(wagner7Raw).scale(172.632)};function wiechelRaw(lambda,phi){var cosPhi=cos(phi),sinPhi=cos(lambda)*cosPhi,sin1_Phi=1-sinPhi,cosLambda=cos(lambda=atan2(sin(lambda)*cosPhi,-sin(phi))),sinLambda=sin(lambda);cosPhi=sqrt(1-sinPhi*sinPhi);return[sinLambda*cosPhi-cosLambda*sin1_Phi,-cosLambda*cosPhi-sinLambda*sin1_Phi]}wiechelRaw.invert=function(x,y){var w=(x*x+y*y)/-2,k=sqrt(-w*(2+w)),b=y*w+x*k,a=x*w-y*k,D=sqrt(a*a+b*b);return[atan2(k*b,D*(1+w)),D?-asin(k*a/D):0]};var wiechel=function(){return Object(d3_geo["geoProjection"])(wiechelRaw).rotate([0,-90,45]).scale(124.75).clipAngle(180-.001)};function winkel3Raw(lambda,phi){var coordinates=aitoffRaw(lambda,phi);return[(coordinates[0]+lambda/halfPi)/2,(coordinates[1]+phi)/2]}winkel3Raw.invert=function(x,y){var lambda=x,phi=y,i=25;do{var cosphi=cos(phi),sinphi=sin(phi),sin_2phi=sin(2*phi),sin2phi=sinphi*sinphi,cos2phi=cosphi*cosphi,sinlambda=sin(lambda),coslambda_2=cos(lambda/2),sinlambda_2=sin(lambda/2),sin2lambda_2=sinlambda_2*sinlambda_2,C=1-cos2phi*coslambda_2*coslambda_2,E=C?acos(cosphi*coslambda_2)*sqrt(F=1/C):F=0,F,fx=.5*(2*E*cosphi*sinlambda_2+lambda/halfPi)-x,fy=.5*(E*sinphi+phi)-y,dxdlambda=.5*F*(cos2phi*sin2lambda_2+E*cosphi*coslambda_2*sin2phi)+.5/halfPi,dxdphi=F*(sinlambda*sin_2phi/4-E*sinphi*sinlambda_2),dydlambda=.125*F*(sin_2phi*sinlambda_2-E*sinphi*cos2phi*sinlambda),dydphi=.5*F*(sin2phi*coslambda_2+E*sin2lambda_2*cosphi)+.5,denominator=dxdphi*dydlambda-dydphi*dxdlambda,dlambda=(fy*dxdphi-fx*dydphi)/denominator,dphi=(fx*dydlambda-fy*dxdlambda)/denominator;lambda-=dlambda,phi-=dphi}while((abs(dlambda)>math_epsilon||abs(dphi)>math_epsilon)&&--i>0);return[lambda,phi]};var winkel3=function(){return Object(d3_geo["geoProjection"])(winkel3Raw).scale(158.837)};__webpack_require__.d(__webpack_exports__,"geoAiry",function(){return airy});__webpack_require__.d(__webpack_exports__,"geoAiryRaw",function(){return airyRaw});__webpack_require__.d(__webpack_exports__,"geoAitoff",function(){return aitoff});__webpack_require__.d(__webpack_exports__,"geoAitoffRaw",function(){return aitoffRaw});__webpack_require__.d(__webpack_exports__,"geoArmadillo",function(){return armadillo});__webpack_require__.d(__webpack_exports__,"geoArmadilloRaw",function(){return armadilloRaw});__webpack_require__.d(__webpack_exports__,"geoAugust",function(){return august});__webpack_require__.d(__webpack_exports__,"geoAugustRaw",function(){return augustRaw});__webpack_require__.d(__webpack_exports__,"geoBaker",function(){return baker});__webpack_require__.d(__webpack_exports__,"geoBakerRaw",function(){return bakerRaw});__webpack_require__.d(__webpack_exports__,"geoBerghaus",function(){return berghaus});__webpack_require__.d(__webpack_exports__,"geoBerghausRaw",function(){return berghausRaw});__webpack_require__.d(__webpack_exports__,"geoBertin1953",function(){return bertin});__webpack_require__.d(__webpack_exports__,"geoBertin1953Raw",function(){return bertin1953Raw});__webpack_require__.d(__webpack_exports__,"geoBoggs",function(){return boggs});__webpack_require__.d(__webpack_exports__,"geoBoggsRaw",function(){return boggsRaw});__webpack_require__.d(__webpack_exports__,"geoBonne",function(){return bonne});__webpack_require__.d(__webpack_exports__,"geoBonneRaw",function(){return bonneRaw});__webpack_require__.d(__webpack_exports__,"geoBottomley",function(){return bottomley});__webpack_require__.d(__webpack_exports__,"geoBottomleyRaw",function(){return bottomleyRaw});__webpack_require__.d(__webpack_exports__,"geoBromley",function(){return bromley});__webpack_require__.d(__webpack_exports__,"geoBromleyRaw",function(){return bromleyRaw});__webpack_require__.d(__webpack_exports__,"geoChamberlin",function(){return chamberlin});__webpack_require__.d(__webpack_exports__,"geoChamberlinRaw",function(){return chamberlinRaw});__webpack_require__.d(__webpack_exports__,"geoChamberlinAfrica",function(){return chamberlinAfrica});__webpack_require__.d(__webpack_exports__,"geoCollignon",function(){return collignon});__webpack_require__.d(__webpack_exports__,"geoCollignonRaw",function(){return collignonRaw});__webpack_require__.d(__webpack_exports__,"geoCraig",function(){return craig});__webpack_require__.d(__webpack_exports__,"geoCraigRaw",function(){return craigRaw});__webpack_require__.d(__webpack_exports__,"geoCraster",function(){return craster});__webpack_require__.d(__webpack_exports__,"geoCrasterRaw",function(){return crasterRaw});__webpack_require__.d(__webpack_exports__,"geoCylindricalEqualArea",function(){return cylindricalEqualArea});__webpack_require__.d(__webpack_exports__,"geoCylindricalEqualAreaRaw",function(){return cylindricalEqualAreaRaw});__webpack_require__.d(__webpack_exports__,"geoCylindricalStereographic",function(){return cylindricalStereographic});__webpack_require__.d(__webpack_exports__,"geoCylindricalStereographicRaw",function(){return cylindricalStereographicRaw});__webpack_require__.d(__webpack_exports__,"geoEckert1",function(){return eckert1});__webpack_require__.d(__webpack_exports__,"geoEckert1Raw",function(){return eckert1Raw});__webpack_require__.d(__webpack_exports__,"geoEckert2",function(){return eckert2});__webpack_require__.d(__webpack_exports__,"geoEckert2Raw",function(){return eckert2Raw});__webpack_require__.d(__webpack_exports__,"geoEckert3",function(){return eckert3});__webpack_require__.d(__webpack_exports__,"geoEckert3Raw",function(){return eckert3Raw});__webpack_require__.d(__webpack_exports__,"geoEckert4",function(){return eckert4});__webpack_require__.d(__webpack_exports__,"geoEckert4Raw",function(){return eckert4Raw});__webpack_require__.d(__webpack_exports__,"geoEckert5",function(){return eckert5});__webpack_require__.d(__webpack_exports__,"geoEckert5Raw",function(){return eckert5Raw});__webpack_require__.d(__webpack_exports__,"geoEckert6",function(){return eckert6});__webpack_require__.d(__webpack_exports__,"geoEckert6Raw",function(){return eckert6Raw});__webpack_require__.d(__webpack_exports__,"geoEisenlohr",function(){return eisenlohr});__webpack_require__.d(__webpack_exports__,"geoEisenlohrRaw",function(){return eisenlohrRaw});__webpack_require__.d(__webpack_exports__,"geoFahey",function(){return fahey});__webpack_require__.d(__webpack_exports__,"geoFaheyRaw",function(){return faheyRaw});__webpack_require__.d(__webpack_exports__,"geoFoucaut",function(){return foucaut});__webpack_require__.d(__webpack_exports__,"geoFoucautRaw",function(){return foucautRaw});__webpack_require__.d(__webpack_exports__,"geoGilbert",function(){return src_gilbert});__webpack_require__.d(__webpack_exports__,"geoGingery",function(){return gingery});__webpack_require__.d(__webpack_exports__,"geoGingeryRaw",function(){return gingeryRaw});__webpack_require__.d(__webpack_exports__,"geoGinzburg4",function(){return ginzburg4});__webpack_require__.d(__webpack_exports__,"geoGinzburg4Raw",function(){return ginzburg4Raw});__webpack_require__.d(__webpack_exports__,"geoGinzburg5",function(){return ginzburg5});__webpack_require__.d(__webpack_exports__,"geoGinzburg5Raw",function(){return ginzburg5Raw});__webpack_require__.d(__webpack_exports__,"geoGinzburg6",function(){return ginzburg6});__webpack_require__.d(__webpack_exports__,"geoGinzburg6Raw",function(){return ginzburg6Raw});__webpack_require__.d(__webpack_exports__,"geoGinzburg8",function(){return ginzburg8});__webpack_require__.d(__webpack_exports__,"geoGinzburg8Raw",function(){return ginzburg8Raw});__webpack_require__.d(__webpack_exports__,"geoGinzburg9",function(){return ginzburg9});__webpack_require__.d(__webpack_exports__,"geoGinzburg9Raw",function(){return ginzburg9Raw});__webpack_require__.d(__webpack_exports__,"geoGringorten",function(){return gringorten});__webpack_require__.d(__webpack_exports__,"geoGringortenRaw",function(){return gringortenRaw});__webpack_require__.d(__webpack_exports__,"geoGuyou",function(){return guyou});__webpack_require__.d(__webpack_exports__,"geoGuyouRaw",function(){return guyouRaw});__webpack_require__.d(__webpack_exports__,"geoHammer",function(){return src_hammer});__webpack_require__.d(__webpack_exports__,"geoHammerRaw",function(){return hammerRaw});__webpack_require__.d(__webpack_exports__,"geoHammerRetroazimuthal",function(){return hammerRetroazimuthal});__webpack_require__.d(__webpack_exports__,"geoHammerRetroazimuthalRaw",function(){return hammerRetroazimuthalRaw});__webpack_require__.d(__webpack_exports__,"geoHealpix",function(){return healpix});__webpack_require__.d(__webpack_exports__,"geoHealpixRaw",function(){return healpixRaw});__webpack_require__.d(__webpack_exports__,"geoHill",function(){return hill});__webpack_require__.d(__webpack_exports__,"geoHillRaw",function(){return hillRaw});__webpack_require__.d(__webpack_exports__,"geoHomolosine",function(){return homolosine});__webpack_require__.d(__webpack_exports__,"geoHomolosineRaw",function(){return homolosineRaw});__webpack_require__.d(__webpack_exports__,"geoHyperelliptical",function(){return hyperelliptical});__webpack_require__.d(__webpack_exports__,"geoHyperellipticalRaw",function(){return hyperellipticalRaw});__webpack_require__.d(__webpack_exports__,"geoInterrupt",function(){return interrupted});__webpack_require__.d(__webpack_exports__,"geoInterruptedBoggs",function(){return interrupted_boggs});__webpack_require__.d(__webpack_exports__,"geoInterruptedHomolosine",function(){return interrupted_homolosine});__webpack_require__.d(__webpack_exports__,"geoInterruptedMollweide",function(){return interrupted_mollweide});__webpack_require__.d(__webpack_exports__,"geoInterruptedMollweideHemispheres",function(){return mollweideHemispheres});__webpack_require__.d(__webpack_exports__,"geoInterruptedSinuMollweide",function(){return interrupted_sinuMollweide});__webpack_require__.d(__webpack_exports__,"geoInterruptedSinusoidal",function(){return interrupted_sinusoidal});__webpack_require__.d(__webpack_exports__,"geoKavrayskiy7",function(){return kavrayskiy7});__webpack_require__.d(__webpack_exports__,"geoKavrayskiy7Raw",function(){return kavrayskiy7Raw});__webpack_require__.d(__webpack_exports__,"geoLagrange",function(){return lagrange});__webpack_require__.d(__webpack_exports__,"geoLagrangeRaw",function(){return lagrangeRaw});__webpack_require__.d(__webpack_exports__,"geoLarrivee",function(){return larrivee});__webpack_require__.d(__webpack_exports__,"geoLarriveeRaw",function(){return larriveeRaw});__webpack_require__.d(__webpack_exports__,"geoLaskowski",function(){return laskowski});__webpack_require__.d(__webpack_exports__,"geoLaskowskiRaw",function(){return laskowskiRaw});__webpack_require__.d(__webpack_exports__,"geoLittrow",function(){return littrow});__webpack_require__.d(__webpack_exports__,"geoLittrowRaw",function(){return littrowRaw});__webpack_require__.d(__webpack_exports__,"geoLoximuthal",function(){return loximuthal});__webpack_require__.d(__webpack_exports__,"geoLoximuthalRaw",function(){return loximuthalRaw});__webpack_require__.d(__webpack_exports__,"geoMiller",function(){return miller});__webpack_require__.d(__webpack_exports__,"geoMillerRaw",function(){return millerRaw});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographic",function(){return modifiedStereographic});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicRaw",function(){return modifiedStereographicRaw});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicAlaska",function(){return modifiedStereographicAlaska});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicGs48",function(){return modifiedStereographicGs48});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicGs50",function(){return modifiedStereographicGs50});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicMiller",function(){return modifiedStereographicMiller});__webpack_require__.d(__webpack_exports__,"geoModifiedStereographicLee",function(){return modifiedStereographicLee});__webpack_require__.d(__webpack_exports__,"geoMollweide",function(){return mollweide});__webpack_require__.d(__webpack_exports__,"geoMollweideRaw",function(){return mollweideRaw});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarParabolic",function(){return mtFlatPolarParabolic});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarParabolicRaw",function(){return mtFlatPolarParabolicRaw});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarQuartic",function(){return mtFlatPolarQuartic});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarQuarticRaw",function(){return mtFlatPolarQuarticRaw});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarSinusoidal",function(){return mtFlatPolarSinusoidal});__webpack_require__.d(__webpack_exports__,"geoMtFlatPolarSinusoidalRaw",function(){return mtFlatPolarSinusoidalRaw});__webpack_require__.d(__webpack_exports__,"geoNaturalEarth",function(){return d3_geo["geoNaturalEarth1"]});__webpack_require__.d(__webpack_exports__,"geoNaturalEarthRaw",function(){return d3_geo["geoNaturalEarth1Raw"]});__webpack_require__.d(__webpack_exports__,"geoNaturalEarth2",function(){return naturalEarth2});__webpack_require__.d(__webpack_exports__,"geoNaturalEarth2Raw",function(){return naturalEarth2Raw});__webpack_require__.d(__webpack_exports__,"geoNellHammer",function(){return nellHammer});__webpack_require__.d(__webpack_exports__,"geoNellHammerRaw",function(){return nellHammerRaw});__webpack_require__.d(__webpack_exports__,"geoPatterson",function(){return patterson});__webpack_require__.d(__webpack_exports__,"geoPattersonRaw",function(){return pattersonRaw});__webpack_require__.d(__webpack_exports__,"geoPolyconic",function(){return polyconic});__webpack_require__.d(__webpack_exports__,"geoPolyconicRaw",function(){return polyconicRaw});__webpack_require__.d(__webpack_exports__,"geoPolyhedral",function(){return polyhedral});__webpack_require__.d(__webpack_exports__,"geoPolyhedralButterfly",function(){return butterfly});__webpack_require__.d(__webpack_exports__,"geoPolyhedralCollignon",function(){return polyhedral_collignon});__webpack_require__.d(__webpack_exports__,"geoPolyhedralWaterman",function(){return waterman});__webpack_require__.d(__webpack_exports__,"geoProject",function(){return src_project});__webpack_require__.d(__webpack_exports__,"geoGringortenQuincuncial",function(){return quincuncial_gringorten});__webpack_require__.d(__webpack_exports__,"geoPeirceQuincuncial",function(){return peirce});__webpack_require__.d(__webpack_exports__,"geoPierceQuincuncial",function(){return peirce});__webpack_require__.d(__webpack_exports__,"geoQuantize",function(){return quantize});__webpack_require__.d(__webpack_exports__,"geoQuincuncial",function(){return quincuncial});__webpack_require__.d(__webpack_exports__,"geoRectangularPolyconic",function(){return rectangularPolyconic});__webpack_require__.d(__webpack_exports__,"geoRectangularPolyconicRaw",function(){return rectangularPolyconicRaw});__webpack_require__.d(__webpack_exports__,"geoRobinson",function(){return robinson});__webpack_require__.d(__webpack_exports__,"geoRobinsonRaw",function(){return robinsonRaw});__webpack_require__.d(__webpack_exports__,"geoSatellite",function(){return satellite});__webpack_require__.d(__webpack_exports__,"geoSatelliteRaw",function(){return satelliteRaw});__webpack_require__.d(__webpack_exports__,"geoSinuMollweide",function(){return sinuMollweide});__webpack_require__.d(__webpack_exports__,"geoSinuMollweideRaw",function(){return sinuMollweideRaw});__webpack_require__.d(__webpack_exports__,"geoSinusoidal",function(){return sinusoidal});__webpack_require__.d(__webpack_exports__,"geoSinusoidalRaw",function(){return sinusoidalRaw});__webpack_require__.d(__webpack_exports__,"geoStitch",function(){return stitch});__webpack_require__.d(__webpack_exports__,"geoTimes",function(){return times});__webpack_require__.d(__webpack_exports__,"geoTimesRaw",function(){return timesRaw});__webpack_require__.d(__webpack_exports__,"geoTwoPointAzimuthal",function(){return twoPointAzimuthal});__webpack_require__.d(__webpack_exports__,"geoTwoPointAzimuthalRaw",function(){return twoPointAzimuthalRaw});__webpack_require__.d(__webpack_exports__,"geoTwoPointAzimuthalUsa",function(){return twoPointAzimuthalUsa});__webpack_require__.d(__webpack_exports__,"geoTwoPointEquidistant",function(){return twoPointEquidistant});__webpack_require__.d(__webpack_exports__,"geoTwoPointEquidistantRaw",function(){return twoPointEquidistantRaw});__webpack_require__.d(__webpack_exports__,"geoTwoPointEquidistantUsa",function(){return twoPointEquidistantUsa});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten",function(){return vanDerGrinten});__webpack_require__.d(__webpack_exports__,"geoVanDerGrintenRaw",function(){return vanDerGrintenRaw});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten2",function(){return vanDerGrinten2});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten2Raw",function(){return vanDerGrinten2Raw});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten3",function(){return vanDerGrinten3});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten3Raw",function(){return vanDerGrinten3Raw});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten4",function(){return vanDerGrinten4});__webpack_require__.d(__webpack_exports__,"geoVanDerGrinten4Raw",function(){return vanDerGrinten4Raw});__webpack_require__.d(__webpack_exports__,"geoWagner4",function(){return wagner4});__webpack_require__.d(__webpack_exports__,"geoWagner4Raw",function(){return wagner4Raw});__webpack_require__.d(__webpack_exports__,"geoWagner6",function(){return wagner6});__webpack_require__.d(__webpack_exports__,"geoWagner6Raw",function(){return wagner6Raw});__webpack_require__.d(__webpack_exports__,"geoWagner7",function(){return wagner7});__webpack_require__.d(__webpack_exports__,"geoWagner7Raw",function(){return wagner7Raw});__webpack_require__.d(__webpack_exports__,"geoWiechel",function(){return wiechel});__webpack_require__.d(__webpack_exports__,"geoWiechelRaw",function(){return wiechelRaw});__webpack_require__.d(__webpack_exports__,"geoWinkel3",function(){return winkel3});__webpack_require__.d(__webpack_exports__,"geoWinkel3Raw",function(){return winkel3Raw})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.geoWinkel3=exports.geoVanDerGrinten4=exports.geoVanDerGrinten3=exports.geoVanDerGrinten2=exports.geoVanDerGrinten=exports.geoInterruptedSinusoidal=exports.geoSinusoidal=exports.geoSinuMollweide=exports.geoInterruptedSinuMollweide=exports.geoRobinsonRaw=exports.geoRobinson=exports.geoPolyconic=exports.geoPeirceQuincuncial=exports.geoPatterson=exports.geoMollweide=exports.geoModifiedStereographicMiller=exports.geoMiller=exports.geoNaturalEarth2=exports.geoLoximuthal=exports.geoInterruptedHomolosine=exports.geoHomolosine=exports.geoHealpix=exports.geoHammerRaw=exports.geoHammer=exports.geoGringortenQuincuncial=exports.geoGringorten=exports.geoGilbert=exports.geoEisenlohr=exports.geoEckert6=exports.geoEckert5=exports.geoEckert4=exports.geoEckert3=exports.geoEckert2=exports.geoEckert1=exports.geoCylindricalStereographicRaw=exports.geoCylindricalStereographic=exports.geoCylindricalEqualAreaRaw=exports.geoCylindricalEqualArea=exports.geoCraster=exports.geoCollignon=exports.geoBromley=exports.geoBottomley=exports.geoBonne=exports.geoInterruptedBoggs=exports.geoBoggs=exports.geoBertin1953=exports.geoBaker=exports.geoArmadillo=exports.geoTransverseMercatorRaw=exports.geoTransverseMercator=exports.geoTransform=exports.geoStream=exports.geoStereographicRaw=exports.geoStereographic=exports.geoRotation=exports.geoProjectionMutator=exports.geoProjection=exports.geoPath=exports.geoOrthographicRaw=exports.geoOrthographic=exports.geoNaturalEarth1=exports.geoMercatorRaw=exports.geoMercator=exports.geoLength=exports.geoInterpolate=exports.geoIdentity=exports.geoGraticule10=exports.geoGraticule=exports.geoGnomonicRaw=exports.geoGnomonic=exports.geoEquirectangularRaw=exports.geoEquirectangular=exports.geoDistance=exports.geoConicEquidistantRaw=exports.geoConicEquidistant=exports.geoConicEqualAreaRaw=exports.geoConicEqualArea=exports.geoConicConformalRaw=exports.geoConicConformal=exports.geoClipRectangle=exports.geoClipCircle=exports.geoClipAntimeridian=exports.geoCircle=exports.geoCentroid=exports.geoBounds=undefined;exports.geoAzimuthalEquidistantRaw=exports.geoAzimuthalEquidistant=exports.geoAzimuthalEqualAreaRaw=exports.geoAzimuthalEqualArea=exports.geoArea=exports.geoAlbersUsa=exports.geoAlbers=exports.voronoi=exports.brushSelection=exports.brushY=exports.brushX=exports.brush=exports.zoomTransform=exports.zoomIdentity=exports.zoom=exports.drag=exports.forceY=exports.forceX=exports.forceSimulation=exports.forceManyBody=exports.forceLink=exports.forceCollide=exports.forceCenter=exports.axisLeft=exports.axisBottom=exports.axisRight=exports.axisTop=exports.transition=exports.interrupt=exports.active=exports.schemeSet3=exports.scaleThreshold=exports.scaleQuantize=exports.scaleQuantile=exports.scaleSqrt=exports.scalePow=exports.scaleImplicit=exports.scaleOrdinal=exports.scaleLog=exports.scaleLinear=exports.scaleIdentity=exports.scalePoint=exports.scaleBand=exports.precisionRound=exports.precisionPrefix=exports.precisionFixed=exports.formatSpecifier=exports.formatDefaultLocale=exports.formatLocale=exports.formatPrefix=exports.format=exports.tsvFormatRows=exports.tsvFormat=exports.tsvParseRows=exports.tsvParse=exports.csvFormatRows=exports.csvFormat=exports.csvParseRows=exports.csvParse=exports.dsvFormat=exports.quantize=exports.interpolateBasisClosed=exports.interpolateBasis=exports.interpolateCubehelixLong=exports.interpolateCubehelix=exports.interpolateHclLong=exports.interpolateHcl=exports.interpolateLab=exports.interpolateHslLong=exports.interpolateHsl=exports.interpolateRgbBasisClosed=exports.interpolateRgbBasis=exports.interpolateRgb=exports.interpolateZoom=exports.interpolateTransformSvg=exports.interpolateTransformCss=exports.interpolateString=exports.interpolateRound=exports.interpolateObject=exports.interpolateNumber=exports.interpolateArray=exports.interpolate=exports.min=exports.mean=exports.max=exports.histogram=exports.path=exports.polygonLength=exports.polygonContains=exports.polygonHull=exports.polygonCentroid=exports.polygonArea=exports.curveBasis=exports.line=exports.csv=exports.json=exports.selectAll=exports.selection=exports.select=exports.event=undefined;var _d3Selection=__webpack_require__(1);Object.defineProperty(exports,"event",{enumerable:true,get:function get(){return _d3Selection.event}});Object.defineProperty(exports,"select",{enumerable:true,get:function get(){return _d3Selection.select}});Object.defineProperty(exports,"selection",{enumerable:true,get:function get(){return _d3Selection.selection}});Object.defineProperty(exports,"selectAll",{enumerable:true,get:function get(){return _d3Selection.selectAll}});var _d3Request=__webpack_require__(18);Object.defineProperty(exports,"json",{enumerable:true,get:function get(){return _d3Request.json}});Object.defineProperty(exports,"csv",{enumerable:true,get:function get(){return _d3Request.csv}});var _d3Shape=__webpack_require__(23);Object.defineProperty(exports,"line",{enumerable:true,get:function get(){return _d3Shape.line}});Object.defineProperty(exports,"curveBasis",{enumerable:true,get:function get(){return _d3Shape.curveBasis}});var _d3Polygon=__webpack_require__(17);Object.defineProperty(exports,"polygonArea",{enumerable:true,get:function get(){return _d3Polygon.polygonArea}});Object.defineProperty(exports,"polygonCentroid",{enumerable:true,get:function get(){return _d3Polygon.polygonCentroid}});Object.defineProperty(exports,"polygonHull",{enumerable:true,get:function get(){return _d3Polygon.polygonHull}});Object.defineProperty(exports,"polygonContains",{enumerable:true,get:function get(){return _d3Polygon.polygonContains}});Object.defineProperty(exports,"polygonLength",{enumerable:true,get:function get(){return _d3Polygon.polygonLength}});var _d3Path=__webpack_require__(6);Object.defineProperty(exports,"path",{enumerable:true,get:function get(){return _d3Path.path}});var _d3Array=__webpack_require__(2);Object.defineProperty(exports,"histogram",{enumerable:true,get:function get(){return _d3Array.histogram}});Object.defineProperty(exports,"max",{enumerable:true,get:function get(){return _d3Array.max}});Object.defineProperty(exports,"mean",{enumerable:true,get:function get(){return _d3Array.mean}});Object.defineProperty(exports,"min",{enumerable:true,get:function get(){return _d3Array.min}});var _d3Interpolate=__webpack_require__(4);Object.defineProperty(exports,"interpolate",{enumerable:true,get:function get(){return _d3Interpolate.interpolate}});Object.defineProperty(exports,"interpolateArray",{enumerable:true,get:function get(){return _d3Interpolate.interpolateArray}});Object.defineProperty(exports,"interpolateNumber",{enumerable:true,get:function get(){return _d3Interpolate.interpolateNumber}});Object.defineProperty(exports,"interpolateObject",{enumerable:true,get:function get(){return _d3Interpolate.interpolateObject}});Object.defineProperty(exports,"interpolateRound",{enumerable:true,get:function get(){return _d3Interpolate.interpolateRound}});Object.defineProperty(exports,"interpolateString",{enumerable:true,get:function get(){return _d3Interpolate.interpolateString}});Object.defineProperty(exports,"interpolateTransformCss",{enumerable:true,get:function get(){return _d3Interpolate.interpolateTransformCss}});Object.defineProperty(exports,"interpolateTransformSvg",{enumerable:true,get:function get(){return _d3Interpolate.interpolateTransformSvg}});Object.defineProperty(exports,"interpolateZoom",{enumerable:true,get:function get(){return _d3Interpolate.interpolateZoom}});Object.defineProperty(exports,"interpolateRgb",{enumerable:true,get:function get(){return _d3Interpolate.interpolateRgb}});Object.defineProperty(exports,"interpolateRgbBasis",{enumerable:true,get:function get(){return _d3Interpolate.interpolateRgbBasis}});Object.defineProperty(exports,"interpolateRgbBasisClosed",{enumerable:true,get:function get(){return _d3Interpolate.interpolateRgbBasisClosed}});Object.defineProperty(exports,"interpolateHsl",{enumerable:true,get:function get(){return _d3Interpolate.interpolateHsl}});Object.defineProperty(exports,"interpolateHslLong",{enumerable:true,get:function get(){return _d3Interpolate.interpolateHslLong}});Object.defineProperty(exports,"interpolateLab",{enumerable:true,get:function get(){return _d3Interpolate.interpolateLab}});Object.defineProperty(exports,"interpolateHcl",{enumerable:true,get:function get(){return _d3Interpolate.interpolateHcl}});Object.defineProperty(exports,"interpolateHclLong",{enumerable:true,get:function get(){return _d3Interpolate.interpolateHclLong}});Object.defineProperty(exports,"interpolateCubehelix",{enumerable:true,get:function get(){return _d3Interpolate.interpolateCubehelix}});Object.defineProperty(exports,"interpolateCubehelixLong",{enumerable:true,get:function get(){return _d3Interpolate.interpolateCubehelixLong}});Object.defineProperty(exports,"interpolateBasis",{enumerable:true,get:function get(){return _d3Interpolate.interpolateBasis}});Object.defineProperty(exports,"interpolateBasisClosed",{enumerable:true,get:function get(){return _d3Interpolate.interpolateBasisClosed}});Object.defineProperty(exports,"quantize",{enumerable:true,get:function get(){return _d3Interpolate.quantize}});var _d3Dsv=__webpack_require__(12);Object.defineProperty(exports,"dsvFormat",{enumerable:true,get:function get(){return _d3Dsv.dsvFormat}});Object.defineProperty(exports,"csvParse",{enumerable:true,get:function get(){return _d3Dsv.csvParse}});Object.defineProperty(exports,"csvParseRows",{enumerable:true,get:function get(){return _d3Dsv.csvParseRows}});Object.defineProperty(exports,"csvFormat",{enumerable:true,get:function get(){return _d3Dsv.csvFormat}});Object.defineProperty(exports,"csvFormatRows",{enumerable:true,get:function get(){return _d3Dsv.csvFormatRows}});Object.defineProperty(exports,"tsvParse",{enumerable:true,get:function get(){return _d3Dsv.tsvParse}});Object.defineProperty(exports,"tsvParseRows",{enumerable:true,get:function get(){return _d3Dsv.tsvParseRows}});Object.defineProperty(exports,"tsvFormat",{enumerable:true,get:function get(){return _d3Dsv.tsvFormat}});Object.defineProperty(exports,"tsvFormatRows",{enumerable:true,get:function get(){return _d3Dsv.tsvFormatRows}});var _d3Format=__webpack_require__(8);Object.defineProperty(exports,"format",{enumerable:true,get:function get(){return _d3Format.format}});Object.defineProperty(exports,"formatPrefix",{enumerable:true,get:function get(){return _d3Format.formatPrefix}});Object.defineProperty(exports,"formatLocale",{enumerable:true,get:function get(){return _d3Format.formatLocale}});Object.defineProperty(exports,"formatDefaultLocale",{enumerable:true,get:function get(){return _d3Format.formatDefaultLocale}});Object.defineProperty(exports,"formatSpecifier",{enumerable:true,get:function get(){return _d3Format.formatSpecifier}});Object.defineProperty(exports,"precisionFixed",{enumerable:true,get:function get(){return _d3Format.precisionFixed}});Object.defineProperty(exports,"precisionPrefix",{enumerable:true,get:function get(){return _d3Format.precisionPrefix}});Object.defineProperty(exports,"precisionRound",{enumerable:true,get:function get(){return _d3Format.precisionRound}});var _d3Scale=__webpack_require__(21);Object.defineProperty(exports,"scaleBand",{enumerable:true,get:function get(){return _d3Scale.scaleBand}});Object.defineProperty(exports,"scalePoint",{enumerable:true,get:function get(){return _d3Scale.scalePoint}});Object.defineProperty(exports,"scaleIdentity",{enumerable:true,get:function get(){return _d3Scale.scaleIdentity}});Object.defineProperty(exports,"scaleLinear",{enumerable:true,get:function get(){return _d3Scale.scaleLinear}});Object.defineProperty(exports,"scaleLog",{enumerable:true,get:function get(){return _d3Scale.scaleLog}});Object.defineProperty(exports,"scaleOrdinal",{enumerable:true,get:function get(){return _d3Scale.scaleOrdinal}});Object.defineProperty(exports,"scaleImplicit",{enumerable:true,get:function get(){return _d3Scale.scaleImplicit}});Object.defineProperty(exports,"scalePow",{enumerable:true,get:function get(){return _d3Scale.scalePow}});Object.defineProperty(exports,"scaleSqrt",{enumerable:true,get:function get(){return _d3Scale.scaleSqrt}});Object.defineProperty(exports,"scaleQuantile",{enumerable:true,get:function get(){return _d3Scale.scaleQuantile}});Object.defineProperty(exports,"scaleQuantize",{enumerable:true,get:function get(){return _d3Scale.scaleQuantize}});Object.defineProperty(exports,"scaleThreshold",{enumerable:true,get:function get(){return _d3Scale.scaleThreshold}});var _d3ScaleChromatic=__webpack_require__(22);Object.defineProperty(exports,"schemeSet3",{enumerable:true,get:function get(){return _d3ScaleChromatic.schemeSet3}});var _d3Transition=__webpack_require__(7);Object.defineProperty(exports,"active",{enumerable:true,get:function get(){return _d3Transition.active}});Object.defineProperty(exports,"interrupt",{enumerable:true,get:function get(){return _d3Transition.interrupt}});Object.defineProperty(exports,"transition",{enumerable:true,get:function get(){return _d3Transition.transition}});var _d3Axis=__webpack_require__(13);Object.defineProperty(exports,"axisTop",{enumerable:true,get:function get(){return _d3Axis.axisTop}});Object.defineProperty(exports,"axisRight",{enumerable:true,get:function get(){return _d3Axis.axisRight}});Object.defineProperty(exports,"axisBottom",{enumerable:true,get:function get(){return _d3Axis.axisBottom}});Object.defineProperty(exports,"axisLeft",{enumerable:true,get:function get(){return _d3Axis.axisLeft}});var _d3Force=__webpack_require__(20);Object.defineProperty(exports,"forceCenter",{enumerable:true,get:function get(){return _d3Force.forceCenter}});Object.defineProperty(exports,"forceCollide",{enumerable:true,get:function get(){return _d3Force.forceCollide}});Object.defineProperty(exports,"forceLink",{enumerable:true,get:function get(){return _d3Force.forceLink}});Object.defineProperty(exports,"forceManyBody",{enumerable:true,get:function get(){return _d3Force.forceManyBody}});Object.defineProperty(exports,"forceSimulation",{enumerable:true,get:function get(){return _d3Force.forceSimulation}});Object.defineProperty(exports,"forceX",{enumerable:true,get:function get(){return _d3Force.forceX}});Object.defineProperty(exports,"forceY",{enumerable:true,get:function get(){return _d3Force.forceY}});var _d3Drag=__webpack_require__(11);Object.defineProperty(exports,"drag",{enumerable:true,get:function get(){return _d3Drag.drag}});var _d3Zoom=__webpack_require__(16);Object.defineProperty(exports,"zoom",{enumerable:true,get:function get(){return _d3Zoom.zoom}});Object.defineProperty(exports,"zoomIdentity",{enumerable:true,get:function get(){return _d3Zoom.zoomIdentity}});Object.defineProperty(exports,"zoomTransform",{enumerable:true,get:function get(){return _d3Zoom.zoomTransform}});var _d3Brush=__webpack_require__(14);Object.defineProperty(exports,"brush",{enumerable:true,get:function get(){return _d3Brush.brush}});Object.defineProperty(exports,"brushX",{enumerable:true,get:function get(){return _d3Brush.brushX}});Object.defineProperty(exports,"brushY",{enumerable:true,get:function get(){return _d3Brush.brushY}});Object.defineProperty(exports,"brushSelection",{enumerable:true,get:function get(){return _d3Brush.brushSelection}});var _d3Voronoi=__webpack_require__(19);Object.defineProperty(exports,"voronoi",{enumerable:true,get:function get(){return _d3Voronoi.voronoi}});var _d3Geo=__webpack_require__(0);Object.defineProperty(exports,"geoAlbers",{enumerable:true,get:function get(){return _d3Geo.geoAlbers}});Object.defineProperty(exports,"geoAlbersUsa",{enumerable:true,get:function get(){return _d3Geo.geoAlbersUsa}});Object.defineProperty(exports,"geoArea",{enumerable:true,get:function get(){return _d3Geo.geoArea}});Object.defineProperty(exports,"geoAzimuthalEqualArea",{enumerable:true,get:function get(){return _d3Geo.geoAzimuthalEqualArea}});Object.defineProperty(exports,"geoAzimuthalEqualAreaRaw",{enumerable:true,get:function get(){return _d3Geo.geoAzimuthalEqualAreaRaw}});Object.defineProperty(exports,"geoAzimuthalEquidistant",{enumerable:true,get:function get(){return _d3Geo.geoAzimuthalEquidistant}});Object.defineProperty(exports,"geoAzimuthalEquidistantRaw",{enumerable:true,get:function get(){return _d3Geo.geoAzimuthalEquidistantRaw}});Object.defineProperty(exports,"geoBounds",{enumerable:true,get:function get(){return _d3Geo.geoBounds}});Object.defineProperty(exports,"geoCentroid",{enumerable:true,get:function get(){return _d3Geo.geoCentroid}});Object.defineProperty(exports,"geoCircle",{enumerable:true,get:function get(){return _d3Geo.geoCircle}});Object.defineProperty(exports,"geoClipAntimeridian",{enumerable:true,get:function get(){return _d3Geo.geoClipAntimeridian}});Object.defineProperty(exports,"geoClipCircle",{enumerable:true,get:function get(){return _d3Geo.geoClipCircle}});Object.defineProperty(exports,"geoClipRectangle",{enumerable:true,get:function get(){return _d3Geo.geoClipRectangle}});Object.defineProperty(exports,"geoConicConformal",{enumerable:true,get:function get(){return _d3Geo.geoConicConformal}});Object.defineProperty(exports,"geoConicConformalRaw",{enumerable:true,get:function get(){return _d3Geo.geoConicConformalRaw}});Object.defineProperty(exports,"geoConicEqualArea",{enumerable:true,get:function get(){return _d3Geo.geoConicEqualArea}});Object.defineProperty(exports,"geoConicEqualAreaRaw",{enumerable:true,get:function get(){return _d3Geo.geoConicEqualAreaRaw}});Object.defineProperty(exports,"geoConicEquidistant",{enumerable:true,get:function get(){return _d3Geo.geoConicEquidistant}});Object.defineProperty(exports,"geoConicEquidistantRaw",{enumerable:true,get:function get(){return _d3Geo.geoConicEquidistantRaw}});Object.defineProperty(exports,"geoDistance",{enumerable:true,get:function get(){return _d3Geo.geoDistance}});Object.defineProperty(exports,"geoEquirectangular",{enumerable:true,get:function get(){return _d3Geo.geoEquirectangular}});Object.defineProperty(exports,"geoEquirectangularRaw",{enumerable:true,get:function get(){return _d3Geo.geoEquirectangularRaw}});Object.defineProperty(exports,"geoGnomonic",{enumerable:true,get:function get(){return _d3Geo.geoGnomonic}});Object.defineProperty(exports,"geoGnomonicRaw",{enumerable:true,get:function get(){return _d3Geo.geoGnomonicRaw}});Object.defineProperty(exports,"geoGraticule",{enumerable:true,get:function get(){return _d3Geo.geoGraticule}});Object.defineProperty(exports,"geoGraticule10",{enumerable:true,get:function get(){return _d3Geo.geoGraticule10}});Object.defineProperty(exports,"geoIdentity",{enumerable:true,get:function get(){return _d3Geo.geoIdentity}});Object.defineProperty(exports,"geoInterpolate",{enumerable:true,get:function get(){return _d3Geo.geoInterpolate}});Object.defineProperty(exports,"geoLength",{enumerable:true,get:function get(){return _d3Geo.geoLength}});Object.defineProperty(exports,"geoMercator",{enumerable:true,get:function get(){return _d3Geo.geoMercator}});Object.defineProperty(exports,"geoMercatorRaw",{enumerable:true,get:function get(){return _d3Geo.geoMercatorRaw}});Object.defineProperty(exports,"geoNaturalEarth1",{enumerable:true,get:function get(){return _d3Geo.geoNaturalEarth1}});Object.defineProperty(exports,"geoOrthographic",{enumerable:true,get:function get(){return _d3Geo.geoOrthographic}});Object.defineProperty(exports,"geoOrthographicRaw",{enumerable:true,get:function get(){return _d3Geo.geoOrthographicRaw}});Object.defineProperty(exports,"geoPath",{enumerable:true,get:function get(){return _d3Geo.geoPath}});Object.defineProperty(exports,"geoProjection",{enumerable:true,get:function get(){return _d3Geo.geoProjection}});Object.defineProperty(exports,"geoProjectionMutator",{enumerable:true,get:function get(){return _d3Geo.geoProjectionMutator}});Object.defineProperty(exports,"geoRotation",{enumerable:true,get:function get(){return _d3Geo.geoRotation}});Object.defineProperty(exports,"geoStereographic",{enumerable:true,get:function get(){return _d3Geo.geoStereographic}});Object.defineProperty(exports,"geoStereographicRaw",{enumerable:true,get:function get(){return _d3Geo.geoStereographicRaw}});Object.defineProperty(exports,"geoStream",{enumerable:true,get:function get(){return _d3Geo.geoStream}});Object.defineProperty(exports,"geoTransform",{enumerable:true,get:function get(){return _d3Geo.geoTransform}});Object.defineProperty(exports,"geoTransverseMercator",{enumerable:true,get:function get(){return _d3Geo.geoTransverseMercator}});Object.defineProperty(exports,"geoTransverseMercatorRaw",{enumerable:true,get:function get(){return _d3Geo.geoTransverseMercatorRaw}});var _d3GeoProjection=__webpack_require__(24);Object.defineProperty(exports,"geoArmadillo",{enumerable:true,get:function get(){return _d3GeoProjection.geoArmadillo}});Object.defineProperty(exports,"geoBaker",{enumerable:true,get:function get(){return _d3GeoProjection.geoBaker}});Object.defineProperty(exports,"geoBertin1953",{enumerable:true,get:function get(){return _d3GeoProjection.geoBertin1953}});Object.defineProperty(exports,"geoBoggs",{enumerable:true,get:function get(){return _d3GeoProjection.geoBoggs}});Object.defineProperty(exports,"geoInterruptedBoggs",{enumerable:true,get:function get(){return _d3GeoProjection.geoInterruptedBoggs}});Object.defineProperty(exports,"geoBonne",{enumerable:true,get:function get(){return _d3GeoProjection.geoBonne}});Object.defineProperty(exports,"geoBottomley",{enumerable:true,get:function get(){return _d3GeoProjection.geoBottomley}});Object.defineProperty(exports,"geoBromley",{enumerable:true,get:function get(){return _d3GeoProjection.geoBromley}});Object.defineProperty(exports,"geoCollignon",{enumerable:true,get:function get(){return _d3GeoProjection.geoCollignon}});Object.defineProperty(exports,"geoCraster",{enumerable:true,get:function get(){return _d3GeoProjection.geoCraster}});Object.defineProperty(exports,"geoCylindricalEqualArea",{enumerable:true,get:function get(){return _d3GeoProjection.geoCylindricalEqualArea}});Object.defineProperty(exports,"geoCylindricalEqualAreaRaw",{enumerable:true,get:function get(){return _d3GeoProjection.geoCylindricalEqualAreaRaw}});Object.defineProperty(exports,"geoCylindricalStereographic",{enumerable:true,get:function get(){return _d3GeoProjection.geoCylindricalStereographic}});Object.defineProperty(exports,"geoCylindricalStereographicRaw",{enumerable:true,get:function get(){return _d3GeoProjection.geoCylindricalStereographicRaw}});Object.defineProperty(exports,"geoEckert1",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert1}});Object.defineProperty(exports,"geoEckert2",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert2}});Object.defineProperty(exports,"geoEckert3",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert3}});Object.defineProperty(exports,"geoEckert4",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert4}});Object.defineProperty(exports,"geoEckert5",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert5}});Object.defineProperty(exports,"geoEckert6",{enumerable:true,get:function get(){return _d3GeoProjection.geoEckert6}});Object.defineProperty(exports,"geoEisenlohr",{enumerable:true,get:function get(){return _d3GeoProjection.geoEisenlohr}});Object.defineProperty(exports,"geoGilbert",{enumerable:true,get:function get(){return _d3GeoProjection.geoGilbert}});Object.defineProperty(exports,"geoGringorten",{enumerable:true,get:function get(){return _d3GeoProjection.geoGringorten}});Object.defineProperty(exports,"geoGringortenQuincuncial",{enumerable:true,get:function get(){return _d3GeoProjection.geoGringortenQuincuncial}});Object.defineProperty(exports,"geoHammer",{enumerable:true,get:function get(){return _d3GeoProjection.geoHammer}});Object.defineProperty(exports,"geoHammerRaw",{enumerable:true,get:function get(){return _d3GeoProjection.geoHammerRaw}});Object.defineProperty(exports,"geoHealpix",{enumerable:true,get:function get(){return _d3GeoProjection.geoHealpix}});Object.defineProperty(exports,"geoHomolosine",{enumerable:true,get:function get(){return _d3GeoProjection.geoHomolosine}});Object.defineProperty(exports,"geoInterruptedHomolosine",{enumerable:true,get:function get(){return _d3GeoProjection.geoInterruptedHomolosine}});Object.defineProperty(exports,"geoLoximuthal",{enumerable:true,get:function get(){return _d3GeoProjection.geoLoximuthal}});Object.defineProperty(exports,"geoNaturalEarth2",{enumerable:true,get:function get(){return _d3GeoProjection.geoNaturalEarth2}});Object.defineProperty(exports,"geoMiller",{enumerable:true,get:function get(){return _d3GeoProjection.geoMiller}});Object.defineProperty(exports,"geoModifiedStereographicMiller",{enumerable:true,get:function get(){return _d3GeoProjection.geoModifiedStereographicMiller}});Object.defineProperty(exports,"geoMollweide",{enumerable:true,get:function get(){return _d3GeoProjection.geoMollweide}});Object.defineProperty(exports,"geoPatterson",{enumerable:true,get:function get(){return _d3GeoProjection.geoPatterson}});Object.defineProperty(exports,"geoPeirceQuincuncial",{enumerable:true,get:function get(){return _d3GeoProjection.geoPeirceQuincuncial}});Object.defineProperty(exports,"geoPolyconic",{enumerable:true,get:function get(){return _d3GeoProjection.geoPolyconic}});Object.defineProperty(exports,"geoRobinson",{enumerable:true,get:function get(){return _d3GeoProjection.geoRobinson}});Object.defineProperty(exports,"geoRobinsonRaw",{enumerable:true,get:function get(){return _d3GeoProjection.geoRobinsonRaw}});Object.defineProperty(exports,"geoInterruptedSinuMollweide",{enumerable:true,get:function get(){return _d3GeoProjection.geoInterruptedSinuMollweide}});Object.defineProperty(exports,"geoSinuMollweide",{enumerable:true,get:function get(){return _d3GeoProjection.geoSinuMollweide}});Object.defineProperty(exports,"geoSinusoidal",{enumerable:true,get:function get(){return _d3GeoProjection.geoSinusoidal}});Object.defineProperty(exports,"geoInterruptedSinusoidal",{enumerable:true,get:function get(){return _d3GeoProjection.geoInterruptedSinusoidal}});Object.defineProperty(exports,"geoVanDerGrinten",{enumerable:true,get:function get(){return _d3GeoProjection.geoVanDerGrinten}});Object.defineProperty(exports,"geoVanDerGrinten2",{enumerable:true,get:function get(){return _d3GeoProjection.geoVanDerGrinten2}});Object.defineProperty(exports,"geoVanDerGrinten3",{enumerable:true,get:function get(){return _d3GeoProjection.geoVanDerGrinten3}});Object.defineProperty(exports,"geoVanDerGrinten4",{enumerable:true,get:function get(){return _d3GeoProjection.geoVanDerGrinten4}});Object.defineProperty(exports,"geoWinkel3",{enumerable:true,get:function get(){return _d3GeoProjection.geoWinkel3}});__webpack_require__(15)}]); \ No newline at end of file diff --git a/client/dist/html/modules.html b/client/dist/html/modules.html index 51857aad5..0c031be34 100644 --- a/client/dist/html/modules.html +++ b/client/dist/html/modules.html @@ -70,8 +70,8 @@ - + - + diff --git a/magrit_app/static/dist/vendor.630f0f.js b/client/dist/vendor.9b2b11.js similarity index 100% rename from magrit_app/static/dist/vendor.630f0f.js rename to client/dist/vendor.9b2b11.js diff --git a/client/js/helpers.js b/client/js/helpers.js index f2f94854d..7e50ac9a4 100755 --- a/client/js/helpers.js +++ b/client/js/helpers.js @@ -417,6 +417,8 @@ export function create_li_layer_elem(layerName, nbFt, typeGeom, typeLayer) { if (typeLayer === 'result') { li.setAttribute('class', ['sortable_result ', layerId].join('')); const promotable = [ 'flow', 'grid', 'discont', 'cartogram', 'smooth']; + const legend_but = typeGeom[1] !== 'cartogram' + ? button_legend : undefined; const replace_but = promotable.indexOf(typeGeom[1]) > -1 ? button_replace : undefined; li.innerHTML = [ @@ -427,7 +429,7 @@ export function create_li_layer_elem(layerName, nbFt, typeGeom, typeLayer) { button_zoom_fit, button_table, eye_open0, - button_legend, + legend_but, button_result_type.get(typeGeom[1]), replace_but, ' ', diff --git a/client/js/layers_style_popup.js b/client/js/layers_style_popup.js index d28ca80e1..e5c27080b 100755 --- a/client/js/layers_style_popup.js +++ b/client/js/layers_style_popup.js @@ -928,7 +928,13 @@ function createStyleBox_Line(layer_name) { // using the minimum value of the serie (skipping unused class if necessary) threshold_section.insert('input') .attrs({ type: 'range', min: 0, max: max_val, step: 0.5 }) - .styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }) + .styles({ + width: '58px', + 'vertical-align': 'middle', + display: 'inline', + float: 'right', + 'margin-right': '0px', + }) .property('value', prev_min_display) .on('change', function () { const val = +this.value; @@ -1490,7 +1496,9 @@ function createStyleBox(layer_name) { } }); - if (data_manager.current_layers[layer_name].renderer === undefined) { + if (data_manager.current_layers[layer_name].renderer === undefined + || data_manager.current_layers[layer_name].renderer === 'Carto_doug' + || data_manager.current_layers[layer_name].renderer === 'OlsonCarto') { const generate_legend_section = popup.append('p'); const generate_lgd_chkbox = generate_legend_section.insert('input') .style('margin', 0) diff --git a/client/js/map_ctrl.js b/client/js/map_ctrl.js index 54f03a01c..3aa2e841d 100644 --- a/client/js/map_ctrl.js +++ b/client/js/map_ctrl.js @@ -208,7 +208,9 @@ export function rotate_global(angle) { } export function redraw_legends_symbols(targeted_node) { - const legend_nodes = targeted_node ? [targeted_node] : document.querySelectorAll('#legend_root_symbol,#legend_root_layout'); + const legend_nodes = targeted_node + ? [targeted_node] + : document.querySelectorAll('#legend_root_symbol,#legend_root_layout'); const hide = svg_map.__zoom.k > 5 || svg_map.__zoom.k < 0.15; let hidden_message = false; @@ -244,7 +246,7 @@ export function redraw_legends_symbols(targeted_node) { notes); new_lgd = document.querySelector(['#legend_root_layout.lgdf_', layer_id].join('')); - } else if (rendered_field) { + } else if (rendered_field && ['Carto_doug', 'OlsonCarto'].indexOf(data_manager.current_layers[layer_name].renderer) < 0) { const nested = legend_nodes[i].getAttribute('nested'), join_line = legend_nodes[i].getAttribute('join_line'); diff --git a/client/package.json b/client/package.json index f7aa48c73..fa2f2beee 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "magrit-client", - "version": "0.8.4", + "version": "0.8.5", "homepage": "https://github.com/riatelab/magrit", "devDependencies": { "babel-core": "^6.26.0", @@ -59,4 +59,4 @@ "loc-i18next": "^0.1.3", "tippy.js": "2.5.2" } -} +} \ No newline at end of file diff --git a/magrit_app/__init__.py b/magrit_app/__init__.py index 2c4601f4d..8a2a3a1b8 100755 --- a/magrit_app/__init__.py +++ b/magrit_app/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -__version__ = '0.8.4' +__version__ = '0.8.5' diff --git a/magrit_app/static/dist/app.9b2b11.js b/magrit_app/static/dist/app.9b2b11.js new file mode 100644 index 000000000..0c8b50b53 --- /dev/null +++ b/magrit_app/static/dist/app.9b2b11.js @@ -0,0 +1,722 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ function webpackJsonpCallback(data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var executeModules = data[2]; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(data); +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ +/******/ // add entry modules from loaded chunk to deferred list +/******/ deferredModules.push.apply(deferredModules, executeModules || []); +/******/ +/******/ // run deferred modules when all chunks ready +/******/ return checkDeferredModules(); +/******/ }; +/******/ function checkDeferredModules() { +/******/ var result; +/******/ for(var i = 0; i < deferredModules.length; i++) { +/******/ var deferredModule = deferredModules[i]; +/******/ var fulfilled = true; +/******/ for(var j = 1; j < deferredModule.length; j++) { +/******/ var depId = deferredModule[j]; +/******/ if(installedChunks[depId] !== 0) fulfilled = false; +/******/ } +/******/ if(fulfilled) { +/******/ deferredModules.splice(i--, 1); +/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); +/******/ } +/******/ } +/******/ return result; +/******/ } +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "app": 0 +/******/ }; +/******/ +/******/ var deferredModules = []; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "static/dist/"; +/******/ +/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; +/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); +/******/ jsonpArray.push = webpackJsonpCallback; +/******/ jsonpArray = jsonpArray.slice(); +/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); +/******/ var parentJsonpFunction = oldJsonpFunction; +/******/ +/******/ +/******/ // add entry module to deferred list +/******/ deferredModules.push(["./js/main.js","vendor"]); +/******/ // run deferred modules when ready +/******/ return checkDeferredModules(); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./css/context-menu.css": +/*!******************************!*\ + !*** ./css/context-menu.css ***! + \******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("\nvar content = __webpack_require__(/*! !../node_modules/css-loader!./context-menu.css */ \"./node_modules/css-loader/index.js!./css/context-menu.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./css/context-menu.css?"); + +/***/ }), + +/***/ "./css/discretization.css": +/*!********************************!*\ + !*** ./css/discretization.css ***! + \********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("\nvar content = __webpack_require__(/*! !../node_modules/css-loader!./discretization.css */ \"./node_modules/css-loader/index.js!./css/discretization.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./css/discretization.css?"); + +/***/ }), + +/***/ "./css/style.css": +/*!***********************!*\ + !*** ./css/style.css ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("\nvar content = __webpack_require__(/*! !../node_modules/css-loader!./style.css */ \"./node_modules/css-loader/index.js!./css/style.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./css/style.css?"); + +/***/ }), + +/***/ "./js/classification/categorical_panel.js": +/*!************************************************!*\ + !*** ./js/classification/categorical_panel.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.display_categorical_box = display_categorical_box;\n\nvar _colors_helpers = __webpack_require__(/*! ./../colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nfunction fetch_categorical_colors() {\n var categ = document.getElementsByClassName('typo_class'),\n color_map = new Map();\n for (var i = 0; i < categ.length; i++) {\n var color = (0, _colors_helpers.rgb2hex)(categ[i].querySelector('.color_square').style.backgroundColor),\n new_name = categ[i].querySelector('.typo_name').value,\n nb_features = categ[i].querySelector('.typo_count_ft').getAttribute('data-count');\n color_map.set(categ[i].__data__.name, [color, new_name, nb_features]);\n }\n return color_map;\n}\n\nfunction display_categorical_box(data_layer, layer_name, field, cats) {\n var is_hex_color = new RegExp(/^#([0-9a-f]{6}|[0-9a-f]{3})$/i);\n var nb_features = data_manager.current_layers[layer_name].n_features;\n var nb_class = cats.length;\n var existing_typo_layer = Object.keys(data_manager.current_layers).filter(function (lyr) {\n return data_manager.current_layers[lyr].renderer === 'Categorical' || data_manager.current_layers[lyr].renderer === 'PropSymbolsTypo';\n });\n var modal_box = (0, _dialogs.make_dialog_container)('categorical_box', _tr('app_page.categorical_box.title', { layer: layer_name, nb_features: nb_features }), 'dialog');\n\n var newbox = d3.select('#categorical_box').select('.modal-body').styles({ 'overflow-y': 'scroll', 'max-height': window.innerHeight - 145 + 'px' });\n\n newbox.append('h3').html('');\n newbox.append('p').html(_tr('app_page.symbol_typo_box.field_categ', { field: field, nb_class: +nb_class, nb_features: +nb_features }));\n\n newbox.append('ul').style('padding', 'unset').attr('id', 'sortable_typo_name').selectAll('li').data(cats).enter().append('li').styles({ margin: 'auto', 'list-style': 'none' }).attr('class', 'typo_class').attr('id', function (_, i) {\n return ['line', i].join('_');\n });\n\n newbox.selectAll('.typo_class').append('input').styles({\n width: '140px',\n height: 'auto',\n display: 'inline-block',\n 'vertical-align': 'middle',\n 'margin-right': '20px'\n }).attrs(function (d) {\n return { class: 'typo_name', id: d.name };\n }).property('value', function (d) {\n return d.display_name;\n });\n\n newbox.selectAll('.typo_class').insert('p').attr('class', 'color_square').style('background-color', function (d) {\n return d.color;\n }).styles({\n width: '22px',\n height: '22px',\n margin: 'auto',\n display: 'inline-block',\n 'vertical-align': 'middle',\n 'border-radius': '10%'\n }).on('click', function () {\n var self = this;\n var this_color = self.style.backgroundColor;\n var input_col = document.createElement('input');\n input_col.setAttribute('type', 'color');\n input_col.setAttribute('value', (0, _colors_helpers.rgb2hex)(this_color));\n input_col.className = 'color_input';\n input_col.onchange = function (change) {\n self.style.backgroundColor = (0, _colors_helpers.hexToRgb)(change.target.value, 'string');\n self.nextSibling.value = change.target.value;\n };\n input_col.dispatchEvent(new MouseEvent('click'));\n });\n\n newbox.selectAll('.typo_class').append('input').attr('class', 'color_hex').styles({ height: '22px', 'vertical-align': 'middle' }).property('value', function (d) {\n return d.color;\n }).style('width', '60px').on('keyup', function () {\n if (is_hex_color.test(this.value)) {\n this.previousSibling.style.backgroundColor = this.value;\n }\n });\n\n newbox.selectAll('.typo_class').insert('span').attrs(function (d) {\n return { class: 'typo_count_ft', 'data-count': d.nb_elem };\n }).html(function (d) {\n return _tr('app_page.symbol_typo_box.count_feature', { count: +d.nb_elem });\n });\n\n newbox.insert('p').insert('button').attr('class', 'button_st3').html(_tr('app_page.categorical_box.new_random_colors')).on('click', function () {\n var lines = document.getElementsByClassName('typo_class');\n for (var i = 0; i < lines.length; ++i) {\n var random_color = (0, _colors_helpers.randomColor)();\n lines[i].querySelector('.color_square').style.backgroundColor = random_color;\n lines[i].querySelector('.color_hex').value = random_color;\n }\n });\n\n // Allow the user to reuse the colors from an existing 'Categorical'\n // (or 'PropSymbolsTypo') layer if any:\n if (existing_typo_layer.length > 0) {\n newbox.insert('p').attr('class', 'button_copy_style').styles({\n margin: '5px',\n cursor: 'pointer',\n 'font-style': 'italic'\n }).html(_tr('app_page.categorical_box.copy_style')).on('click', function () {\n make_box_copy_style_categorical(existing_typo_layer).then(function (result) {\n if (result) {\n // Apply the selected style:\n var ref_map = data_manager.current_layers[result].color_map;\n var selection = newbox.select('#sortable_typo_name').selectAll('li');\n // Change the displayed name of the elements:\n selection.selectAll('input.typo_name').each(function (d) {\n var r = ref_map.get(d.name);\n if (r) {\n d.display_name = r[1];\n this.value = r[1];\n }\n });\n // Change the selected colors:\n selection.selectAll('p').each(function (d) {\n var r = ref_map.get(d.name);\n if (r) {\n d.color = r[0];\n this.style.backgroundColor = r[0];\n this.nextSibling.value = r[0];\n }\n });\n }\n });\n });\n }\n\n new Sortable(document.getElementById('sortable_typo_name'));\n var container = document.getElementById('categorical_box');\n\n return new Promise(function (resolve, reject) {\n var _onclose = function _onclose() {\n resolve(false);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)();\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n\n container.querySelector('.btn_ok').onclick = function () {\n var color_map = fetch_categorical_colors();\n var colorByFeature = data_layer.map(function (ft) {\n return color_map.get(ft[field])[0];\n });\n resolve([nb_class, color_map, colorByFeature]);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)();\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n function helper_esc_key_twbs(evt) {\n var _event = evt || window.event;\n var isEscape = 'key' in _event ? _event.key === 'Escape' || _event.key === 'Esc' : _event.keyCode === 27;\n if (isEscape) {\n _event.stopPropagation();\n _onclose();\n }\n }\n document.addEventListener('keydown', helper_esc_key_twbs);\n _dialogs.overlay_under_modal.display();\n });\n}\n\n/**\n* Create the box allowing to choose the name of the categorical\n* layer whose palette will be used.\n*\n* @param {Array} existing_typo_layer - An array containing the name of any existing\n* 'Categorial' or 'PropSymbolsTypo' layer.\n* @return {Promise} - A promise containing the state of the swal2 alert created.\n*/\nfunction make_box_copy_style_categorical(existing_typo_layer) {\n var selected_layer = existing_typo_layer[0];\n return swal({\n title: _tr('app_page.categorical_box.title_copy_style_box'),\n html: '
',\n showCancelButton: true,\n showConfirmButton: true,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n document.querySelector('.swal2-modal').style.width = '400px';\n var content = d3.select('#copy_style_box_content');\n var select_layer = content.append('select');\n // select_layer.append('option').attr('value', '').html('');\n existing_typo_layer.forEach(function (layer_name) {\n select_layer.append('option').attr('value', layer_name).html(layer_name);\n });\n select_layer.on('change', function () {\n selected_layer = this.value;\n });\n }\n }).then(function () {\n return selected_layer;\n }, function () {\n return null;\n });\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/classification/categorical_panel.js?"); + +/***/ }), + +/***/ "./js/classification/common.js": +/*!*************************************!*\ + !*** ./js/classification/common.js ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.prepare_ref_histo = exports.discretiz_geostats_switch = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.getOptNbClass = getOptNbClass;\nexports.getBreaksQ6 = getBreaksQ6;\nexports.getBreaksStdDev = getBreaksStdDev;\nexports.discretize_to_size = discretize_to_size;\nexports.discretize_to_colors = discretize_to_colors;\nexports.getBreaks_userDefined = getBreaks_userDefined;\n\nvar _colors_helpers = __webpack_require__(/*! ./../colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar floor = Math.floor;\nvar log10 = Math.log10;\n\n// Shortcut to the name of the methods offered by geostats library:\nvar discretiz_geostats_switch = exports.discretiz_geostats_switch = new Map([['jenks', 'getJenks'], ['equal_interval', 'getEqInterval'],\n// ['std_dev', 'getStdDeviation'],\n['quantiles', 'getQuantile'], ['Q6', 'getBreaksQ6'], ['geometric_progression', 'getGeometricProgression']]);\n\n/**\n* Compute the \"optimal\" (cf. xxx) number of class according to the number\n* of features in serie of values.\n*\n* @param {Integer} len_serie - The length of the serie of values.\n* @return {Integer} - The \"optimal\" number of classes to be used to discretize the serie.\n*/\nfunction getOptNbClass(len_serie) {\n return floor(1 + 3.3 * log10(len_serie));\n}\n\n/**\n* Compute breaks according to \"Q6\" method\n* and compute the number of item in each bin.\n*\n* @param {Array} serie - An array of ordered values.\n* @param {Number} precision - An integer value decribing the precision of the serie.\n* @return {Object} - Object containing the breaks and the stock in each class.\n*/\nfunction getBreaksQ6(serie) {\n var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n var len_serie = serie.length;\n var q6_class = [1, 0.05 * len_serie, 0.275 * len_serie, 0.5 * len_serie, 0.725 * len_serie, 0.95 * len_serie, len_serie];\n var breaks = [];\n var tmp = 0;\n var j = void 0;\n var stock_class = [];\n for (var i = 0; i < 7; ++i) {\n j = (0, _helpers_math.Mround)(q6_class[i]) - 1;\n breaks.push(+serie[j]);\n stock_class.push(j - tmp);\n tmp = j;\n }\n stock_class.shift();\n if (breaks[0] === breaks[1]) {\n // breaks[1] = breaks[0] + (breaks[2] - breaks[1]) / 2;\n breaks[1] = (+serie[1] + breaks[0]) / 2;\n }\n if (breaks[6] === breaks[5]) {\n breaks[5] = serie[len_serie - 2];\n // breaks[5] = breaks[4] + (breaks[5] - breaks[4]) / 2;\n }\n if (precision != null) {\n breaks = breaks.map(function (val) {\n return (0, _helpers_calc.round_value)(val, precision);\n });\n }\n return {\n breaks: breaks,\n stock_class: stock_class\n };\n}\n\n/**\n* Compute breaks according to our \"mean and standard deviation\" method\n* and compute the number of item in each bin.\n*\n* @param {Array} serie - An array of ordered values.\n* @param {Number} share - The ratio of stddev to be used a size for each class.\n* @param {String} mean_position - The position of the mean value.\n* @param {Number} precision - An integer value decribing the precision of the serie.\n* @return {Object} - Object containing the breaks and the stock in each class.\n*/\nfunction getBreaksStdDev(serie, share) {\n var mean_position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'center';\n var precision = arguments[3];\n\n var min = serie.min(),\n max = serie.max(),\n mean = serie.mean(),\n std_dev = serie.stddev(),\n class_size = std_dev * share;\n var breaks = mean_position === 'center' ? [mean - class_size / 2, mean + class_size / 2] : [mean - class_size, mean, mean + class_size];\n\n var _precision = precision || serie.precision;\n\n while (breaks[0] > min) {\n breaks.unshift(breaks[0] - class_size);\n }\n while (breaks[breaks.length - 1] < max) {\n breaks.push(breaks[breaks.length - 1] + class_size);\n }\n var nb_class = breaks.length - 1;\n if (breaks[0] < min) {\n if (breaks[1] < min) {\n console.log('This shouldn\\'t happen (min)');\n }\n breaks[0] = min;\n }\n\n if (breaks[nb_class] > max) {\n if (breaks[nb_class - 1] > max) {\n console.log('This shouldn\\'t happen (max)');\n }\n breaks[nb_class] = max;\n }\n return {\n nb_class: nb_class,\n breaks: breaks.map(function (v) {\n return (0, _helpers_calc.round_value)(v, _precision);\n })\n };\n}\n\nfunction getBreaks(values, type, n_class) {\n // const _values = values.filter(v => v === 0 || (v && !Number.isNaN(+v))),\n var _values = values.filter(function (v) {\n return (0, _helpers.isNumber)(v);\n }),\n no_data = values.length - _values.length,\n nb_class = +n_class || getOptNbClass(_values.length);\n var serie = new geostats(_values); // eslint-disable-line new-cap\n var breaks = void 0;\n if (type === 'Q6') {\n var tmp = getBreaksQ6(serie.sorted(), serie.precision);\n breaks = tmp.breaks;\n breaks[0] = serie.min();\n breaks[nb_class] = serie.max();\n serie.setClassManually(breaks);\n } else {\n var _func = discretiz_geostats_switch.get(type);\n breaks = serie[_func](nb_class);\n if (serie.precision) breaks = breaks.map(function (val) {\n return (0, _helpers_calc.round_value)(val, serie.precision);\n });\n }\n return [serie, breaks, nb_class, no_data];\n}\n\nfunction discretize_to_size(values, type, nb_class, min_size, max_size) {\n var _getBreaks = getBreaks(values, type, nb_class),\n _getBreaks2 = _slicedToArray(_getBreaks, 3),\n serie = _getBreaks2[0],\n breaks = _getBreaks2[1],\n n_class = _getBreaks2[2];\n\n var step = (max_size - min_size) / (n_class - 1),\n class_size = Array(n_class).fill(0).map(function (d, i) {\n return min_size + i * step;\n }),\n breaks_prop = [];\n\n for (var i = 0; i < breaks.length - 1; ++i) {\n breaks_prop.push([[breaks[i], breaks[i + 1]], class_size[i]]);\n }\n return [n_class, type, breaks_prop, serie];\n}\n\nfunction discretize_to_colors(values, type, nb_class, col_ramp_name) {\n var name_col_ramp = col_ramp_name || 'Reds';\n\n var _getBreaks3 = getBreaks(values, type, nb_class),\n _getBreaks4 = _slicedToArray(_getBreaks3, 4),\n serie = _getBreaks4[0],\n breaks = _getBreaks4[1],\n n_class = _getBreaks4[2],\n nb_no_data = _getBreaks4[3],\n color_array = (0, _colors_helpers.getColorBrewerArray)(n_class, name_col_ramp),\n no_data_color = nb_no_data > 0 ? '#e7e7e7' : null,\n colors_map = [];\n\n for (var j = 0; j < values.length; ++j) {\n if ((0, _helpers.isNumber)(values[j])) {\n var idx = serie.getClass(values[j]);\n colors_map.push(color_array[idx]);\n } else {\n colors_map.push(no_data_color);\n }\n }\n return [n_class, type, breaks, color_array, colors_map, no_data_color];\n}\n\n/**\n* Parse a string of comma separated break values\n* to an actual Array of break values.\n* The serie is used to defined if there may be negative values\n* in the defined break values.\n*\n* @param {Array} serie - The serie of values to be discretised with `breaks_list`.\n* @param {String} breaks_list - The user_defined break values as String.\n* @return {Array} - The actual Array of break values.\n*/\nfunction parseUserDefinedBreaks(serie, breaks_list) {\n var separator = (0, _helpers_calc.has_negative)(serie) ? '- ' : '-';\n return breaks_list.split(separator).map(function (el) {\n return +el.trim();\n });\n}\n\n/**\n* Returns the break values and the stock of each class given\n* a list of breaks defined by the user.\n*\n* @param {Array} serie - The serie of values to be discretised\n* @param {Array} breaks - The list of breaks, whether as a String (a typed by the user)\n* or as an Array.\n* @return {Object} - An Object with the stock (number of feature) in each class\n* and the break values (should be unchanged if provided as an Array)\n*/\nfunction getBreaks_userDefined(serie, breaks) {\n var break_values = typeof breaks === 'string' ? parseUserDefinedBreaks(serie, breaks) : breaks;\n var len_break_val = break_values.length,\n stock_class = new Array(len_break_val - 1);\n var j = 0;\n for (var i = 1; i < len_break_val; ++i) {\n var class_max = break_values[i];\n stock_class[i - 1] = 0;\n while (serie[j] <= class_max) {\n stock_class[i - 1] += 1;\n j += 1;\n }\n }\n return {\n breaks: break_values,\n stock_class: stock_class\n };\n}\n\nvar prepare_ref_histo = exports.prepare_ref_histo = function prepare_ref_histo(parent_node, serie, formatCount) {\n var svg_h = h / 7.25 > 80 ? h / 7.25 : 80,\n svg_w = w / 4 > 320 ? 320 : w / 4,\n values = serie.sorted(),\n nb_bins = values.length / 3 > 51 ? 50 : (0, _helpers_math.Mceil)((0, _helpers_math.Msqrt)(values.length)) + 1;\n\n var q5 = serie.getQuantile(4).map(function (v) {\n return +v;\n });\n\n var m_margin = { top: 10, right: 20, bottom: 10, left: 20 },\n m_width = svg_w - m_margin.right - m_margin.left,\n m_height = svg_h - m_margin.top - m_margin.bottom;\n\n var ref_histo = parent_node.select('#ref_histo_box').select('#inner_ref_histo_box');\n\n ref_histo.append('p').attrs({ id: 'ref_histo_title' }).styles({ margin: 'auto', 'text-align': 'center' }).html('' + _tr('disc_box.hist_ref_title') + '');\n\n var c = ref_histo.append('svg').attrs({\n id: 'svg_ref_histo',\n width: svg_w + m_margin.left + m_margin.right,\n height: svg_h + m_margin.top + m_margin.bottom\n });\n\n var x = d3.scaleLinear().domain([serie.min(), serie.max()]).rangeRound([0, m_width]);\n\n var svg_ref_histo = c.append('g').attr('transform', 'translate(' + (m_margin.left + m_margin.right) + ', ' + m_margin.top + ')');\n\n return function (type) {\n svg_ref_histo.remove();\n svg_ref_histo = c.append('g').attr('transform', 'translate(' + (m_margin.left + m_margin.right) + ', ' + m_margin.top + ')');\n if (type === 'histogram') {\n var data = d3.histogram().domain(x.domain()).thresholds(x.ticks(nb_bins))(values);\n\n var y = d3.scaleLinear().domain([0, d3.max(data, function (d) {\n return d.length;\n })]).range([m_height, 0]);\n\n var bar = svg_ref_histo.selectAll('.bar').data(data).enter().append('rect').attrs(function (d) {\n return {\n class: 'bar',\n width: (0, _helpers_math.Mabs)(x(d.x1)) - (0, _helpers_math.Mabs)(x(d.x0)),\n height: m_height - y(d.length),\n x: 0,\n transform: 'translate(' + x(d.x0) + ',' + y(d.length) + ')'\n };\n }).styles({ fill: 'beige', stroke: 'black', 'stroke-width': '0.4px' });\n\n svg_ref_histo.append('g').style('font-size', '10px').attrs({ class: 'x_axis', transform: 'translate(0,' + m_height + ')' }).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll('text').attrs({ x: -4, y: 4, dy: '.45em', transform: 'rotate(-40)' }).style('text-anchor', 'end');\n\n svg_ref_histo.append('g').attr('class', 'y_axis').style('font-size', '10px').call(d3.axisLeft().scale(y).ticks(5).tickFormat(d3.format('.0f')));\n } else if (type === 'box_plot') {\n svg_ref_histo.append('g').style('font-size', '10px').attrs({ class: 'x_axis', transform: 'translate(0,' + m_height + ')' }).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll('text').attrs({ x: -4, y: 4, dy: '.45em', transform: 'rotate(-40)' }).style('text-anchor', 'end');\n\n var y_mid = (m_margin.top + m_height - m_margin.bottom) / 2;\n\n svg_ref_histo.append('g').insert('line').attrs({ x1: x(q5[0]), y1: m_margin.top * 2, x2: x(q5[0]), y2: m_height - m_margin.bottom * 2 }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'none' });\n\n svg_ref_histo.append('g').insert('rect').attrs({ x: x(q5[1]), y: m_margin.top, width: x(q5[2]) - x(q5[1]), height: m_height - m_margin.bottom - m_margin.top }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'lightblue' });\n\n svg_ref_histo.append('g').insert('line').attrs({ x1: x(q5[2]), y1: m_margin.top, x2: x(q5[2]), y2: m_height - m_margin.bottom }).styles({ 'stroke-width': 3, stroke: 'black', fill: 'none' });\n\n svg_ref_histo.append('g').insert('rect').attrs({ x: x(q5[2]), y: m_margin.top, width: x(q5[3]) - x(q5[2]), height: m_height - m_margin.bottom - m_margin.top }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'lightblue' });\n\n svg_ref_histo.append('g').insert('line').attrs({ x1: x(q5[4]), y1: m_margin.top * 2, x2: x(q5[4]), y2: m_height - m_margin.bottom * 2 }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'none' });\n\n svg_ref_histo.append('g').insert('line').attrs({ x1: x(q5[0]), y1: y_mid, x2: x(q5[1]), y2: y_mid }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'none', 'stroke-dasharray': '3,3' });\n\n svg_ref_histo.append('g').insert('line').attrs({ x1: x(q5[3]), y1: y_mid, x2: x(q5[4]), y2: y_mid }).styles({ 'stroke-width': 1, stroke: 'black', fill: 'none', 'stroke-dasharray': '3,3' });\n } else if (type === 'beeswarm') {\n var _data = values.map(function (v) {\n return { value: +v };\n });\n\n var simulation = d3.forceSimulation(_data).force('x', d3.forceX(function (d) {\n return x(d.value);\n }).strength(1)).force('y', d3.forceY(m_height / 2).strength(2)).force('collide', d3.forceCollide(4)).stop();\n\n for (var i = 0; i < 75; ++i) {\n simulation.tick();\n }\n svg_ref_histo.append('g').style('font-size', '10px').attrs({ class: 'x_axis', transform: 'translate(0,' + m_height + ')' }).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll('text').attrs({ x: -4, y: 4, dy: '.45em', transform: 'rotate(-40)' }).style('text-anchor', 'end');\n\n var cell = svg_ref_histo.append('g').attr('class', 'cells').selectAll('g').data(d3.voronoi().extent([[0, 0], [m_width, m_height]]).x(function (d) {\n return d.x;\n }).y(function (d) {\n return d.y;\n }).polygons(_data)).enter().append('g');\n\n cell.append('circle').attrs(function (d) {\n if (d) {\n return {\n r: _data.lenght < 250 ? 2.5 : _data.lenght < 500 ? 1.5 : 1,\n transform: 'translate(' + d.data.x + ',' + d.data.y + ')' };\n }\n return undefined;\n });\n\n cell.append('path').attr('d', function (d) {\n if (d) return 'M' + d.join('L') + 'Z';\n return undefined;\n });\n }\n };\n};\n\n//# sourceURL=webpack:///./js/classification/common.js?"); + +/***/ }), + +/***/ "./js/classification/discretization_panel.js": +/*!***************************************************!*\ + !*** ./js/classification/discretization_panel.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.display_discretization = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _colors_helpers = __webpack_require__(/*! ./../colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _common = __webpack_require__(/*! ./common */ \"./js/classification/common.js\");\n\nfunction make_box_custom_palette(nb_class, existing_colors) {\n var is_hex_color = new RegExp(/^#([0-9a-f]{6}|[0-9a-f]{3})$/i);\n var is_ok_name = new RegExp(/^[a-zA-Z0-9_]*$/);\n var existing_palette = Array.from(_app.custom_palettes.keys());\n var pal_name = void 0;\n var ref_colors = void 0;\n if (existing_colors && existing_colors.length === nb_class) {\n ref_colors = existing_colors.slice();\n } else {\n ref_colors = [];\n for (var i = 0; i < nb_class; i++) {\n ref_colors.push((0, _colors_helpers.randomColor)());\n }\n }\n\n var verif_palette_name = function verif_palette_name(name) {\n if (name !== '' && is_ok_name.test(name)) {\n if (existing_palette.indexOf(name) > -1) {\n d3.select('#palette_box_error_zone').html(_tr('app_page.palette_box.error_name_existing'));\n document.querySelector('.swal2-confirm').disabled = true;\n return null;\n }\n d3.select('#palette_box_error_zone').html('');\n document.querySelector('.swal2-confirm').disabled = false;\n return name;\n } else {\n d3.select('#palette_box_error_zone').html(_tr('app_page.palette_box.error_name_invalid'));\n document.querySelector('.swal2-confirm').disabled = true;\n return null;\n }\n };\n\n return swal({\n title: _tr('app_page.palette_box.title'),\n html: '
',\n showCancelButton: true,\n showConfirmButton: true,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n document.querySelector('.swal2-modal').style.width = nb_class * 85 + 'px';\n var colors = d3.select('#palette_box_content');\n var g = colors.selectAll('p').data(ref_colors).enter().append('p');\n\n g.append('input').attr('id', function (_, i) {\n return i;\n }).attr('type', 'color').style('width', '60px').property('value', function (d) {\n return d;\n }).on('change', function (_, i) {\n ref_colors[i] = this.value;\n this.nextSibling.value = this.value;\n });\n\n g.append('input').attr('id', function (_, i) {\n return i;\n }).style('width', '60px').property('value', function (d) {\n return d;\n }).on('keyup', function (_, i) {\n if (is_hex_color.test(this.value)) {\n ref_colors[i] = this.value;\n this.previousSibling.value = this.value;\n }\n });\n var bottom = d3.select('#palette_box_name');\n bottom.append('p').attr('id', 'palette_box_error_zone').style('background', '#e3e3e3');\n bottom.append('span').html(_tr('app_page.palette_box.new_name'));\n bottom.append('input').style('width', '70px').on('keyup', function () {\n if (verif_palette_name(this.value) !== null) pal_name = this.value;\n });\n document.querySelector('.swal2-confirm').disabled = true;\n }\n }).then(function () {\n return [ref_colors, pal_name];\n }, function () {\n return null;\n });\n}\n\nvar display_discretization = exports.display_discretization = function display_discretization(layer_name, field_name, nb_class, options) {\n var make_no_data_section = function make_no_data_section() {\n var section = d3.select('#color_div').append('div').attr('id', 'no_data_section').append('p').html(_tr('disc_box.withnodata', { count: +no_data }));\n\n section.append('input').attrs({ type: 'color', id: 'no_data_color' }).style('margin', '0px 10px').property('value', '#ebebcd');\n };\n\n var make_sequ_button = function make_sequ_button() {\n var col_div = d3.select('#color_div');\n col_div.selectAll('.color_params').remove();\n col_div.selectAll('.color_txt').remove();\n col_div.selectAll('.color_txt2').remove();\n col_div.selectAll('.central_class').remove();\n col_div.selectAll('.central_color').remove();\n col_div.selectAll('#reverse_pal_btn').remove();\n document.getElementById('button_palette_box').style.display = '';\n var sequential_color_select = col_div.insert('p').attr('class', 'color_txt').style('margin-left', '10px').html(_tr('disc_box.color_palette')).insert('select').attr('class', 'color_params').styles({\n width: '116px',\n 'background-image': 'url(/static/img/palettes/Blues.png)'\n }).on('change', function () {\n this.style.backgroundImage = 'url(/static/img/palettes/' + this.value + '.png)';\n redisplay.draw();\n });\n\n ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'].forEach(function (name) {\n sequential_color_select.append('option').text(name).attrs({ value: name, title: name }).style('background-image', 'url(/static/img/palettes/' + name + '.png)');\n });\n\n if (_app.custom_palettes) {\n var additional_colors = Array.from(_app.custom_palettes.entries());\n\n for (var ixp = 0; ixp < additional_colors.length; ixp++) {\n sequential_color_select.append('option').text(additional_colors[ixp][0]).attrs({ value: 'user_' + additional_colors[ixp][0], title: additional_colors[ixp][0], nb_colors: additional_colors[ixp][1].length }).property('disabled', additional_colors[ixp][1].length !== nb_class);\n }\n }\n\n // Button allowing the reverse a color palette:\n d3.select('.color_txt').insert('p').style('text-align', 'center').insert('button').style('margin-top', '10px').attrs({ class: 'button_st3', id: 'reverse_pal_btn' }).html(_tr('disc_box.reverse_palette')).on('click', function () {\n to_reverse = true;\n redisplay.draw();\n });\n };\n\n var make_diverg_button = function make_diverg_button() {\n var col_div = d3.select('#color_div');\n col_div.selectAll('.color_params').remove();\n col_div.selectAll('.color_txt').remove();\n col_div.selectAll('.color_txt2').remove();\n col_div.selectAll('#reverse_pal_btn').remove();\n document.getElementById('button_palette_box').style.display = 'none';\n col_div.insert('p').attr('class', 'central_class').html(_tr('disc_box.break_on')).insert('input').style('width', '50px').attrs({\n type: 'number',\n class: 'central_class',\n id: 'centr_class',\n min: 1,\n max: nb_class - 1,\n step: 1,\n value: (0, _helpers_math.Mround)(nb_class / 2)\n }).on('change', function () {\n redisplay.draw();\n });\n\n var pal_names = ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'];\n var left_color_select = col_div.insert('p').attr('class', 'color_txt').style('display', 'inline').html(_tr('disc_box.left_colramp')).insert('select').style('width', '116px').attr('class', 'color_params_left').on('change', function () {\n this.style.backgroundImage = 'url(/static/img/palettes/' + this.value + '.png)';\n redisplay.draw();\n });\n var right_color_select = col_div.insert('p').styles({ display: 'inline', 'margin-left': '70px' }).attr('class', 'color_txt2').html(_tr('disc_box.right_colramp')).insert('select').style('width', '116px').attr('class', 'color_params_right').on('change', function () {\n this.style.backgroundImage = 'url(/static/img/palettes/' + this.value + '.png)';\n redisplay.draw();\n });\n pal_names.forEach(function (name) {\n left_color_select.append('option').attrs({ value: name, title: name }).styles({ 'background-image': 'url(/static/img/palettes/' + name + '.png)' }).text(name);\n right_color_select.append('option').attrs({ value: name, title: name }).styles({ 'background-image': 'url(/static/img/palettes/' + name + '.png)' }).text(name);\n });\n\n // if (_app.custom_palettes) {\n // const additional_colors = Array.from(\n // _app.custom_palettes.entries());\n // for (let ixp = 0; ixp < additional_colors.length; ixp++) {\n // left_color_select.append('option')\n // .text(additional_colors[ixp][0])\n // .attrs({ value: `user_${additional_colors[ixp][0]}`, title: additional_colors[ixp][0], nb_colors: additional_colors[ixp][1].length })\n // .property('disabled', additional_colors[ixp][1].length !== nb_class);\n // right_color_select.append('option')\n // .text(additional_colors[ixp][0])\n // .attrs({ value: `user_${additional_colors[ixp][0]}`, title: additional_colors[ixp][0], nb_colors: additional_colors[ixp][1].length })\n // .property('disabled', additional_colors[ixp][1].length !== nb_class);\n // }\n // }\n\n document.getElementsByClassName('color_params_right')[0].selectedIndex = 14;\n\n var central_color = col_div.insert('p').attr('class', 'central_color');\n central_color.insert('input').attrs({ type: 'checkbox', id: 'central_color_chkbx' }).on('change', function () {\n redisplay.draw();\n if (this.checked) {\n col_div.select('#central_color_val').style('display', '');\n } else {\n col_div.select('#central_color_val').style('display', 'none');\n }\n });\n central_color.select('input').node().checked = true;\n central_color.insert('label').attr('for', 'central_color_chkbx').html(_tr('disc_box.colored_central_class'));\n central_color.insert('input').attrs({ type: 'color', id: 'central_color_val', value: '#e5e5e5' }).style('margin', '0px 10px').on('change', redisplay.draw);\n };\n\n var make_box_histo_option = function make_box_histo_option() {\n var histo_options = newBox.append('div').attrs({ id: 'histo_options', class: 'row equal' }).styles({ margin: '5px 5px 10px 15px', width: '100%' });\n var a = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n b = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n c = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n d = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3');\n\n a.insert('button').attrs({ class: 'btn_population' }).html(_tr('disc_box.disp_rug_pop')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n rug_plot.style('display', 'none');\n rug_plot.classed('active', false);\n } else {\n this.classList.add('active');\n rug_plot.style('display', '');\n rug_plot.classed('active', true);\n }\n });\n\n b.insert('button').attrs({ class: 'btn_mean' }).html(_tr('disc_box.disp_mean')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_mean.style('stroke-width', 0);\n txt_mean.style('fill', 'none');\n line_mean.classed('active', false);\n } else {\n this.classList.add('active');\n line_mean.style('stroke-width', 2);\n txt_mean.style('fill', 'blue');\n line_mean.classed('active', true);\n }\n });\n\n c.insert('button').attrs({ class: 'btn_median' }).html(_tr('disc_box.disp_median')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_median.style('stroke-width', 0).classed('active', false);\n txt_median.style('fill', 'none');\n } else {\n this.classList.add('active');\n line_median.style('stroke-width', 2).classed('active', true);\n txt_median.style('fill', 'darkgreen');\n }\n });\n\n d.insert('button').attrs({ class: 'btn_stddev' }).html(_tr('disc_box.disp_sd')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_std_left.style('stroke-width', 0);\n line_std_left.classed('active', false);\n line_std_right.style('stroke-width', 0);\n line_std_right.classed('active', false);\n } else {\n this.classList.add('active');\n line_std_left.style('stroke-width', 2);\n line_std_left.classed('active', true);\n line_std_right.style('stroke-width', 2);\n line_std_right.classed('active', true);\n }\n });\n };\n\n var update_nb_class = function update_nb_class(value) {\n txt_nb_class.node().value = value;\n document.getElementById('nb_class_range').value = value;\n nb_class = value;\n var color_select = document.querySelector('.color_params');\n // Only do stuff related to custom palettes if we are using a \"sequential\" scheme:\n if (!color_select) return;\n var selected_index = color_select.selectedIndex;\n var select_options = color_select.querySelectorAll('option');\n for (var ixc = 0; ixc < select_options.length; ixc++) {\n if (select_options[ixc].value.startsWith('user_')) {\n select_options[ixc].disabled = nb_class !== +select_options[ixc].getAttribute('nb_colors');\n }\n }\n if (select_options[selected_index].value.startsWith('user_') && select_options[selected_index].getAttribute('nb_colors') !== nb_class) {\n (0, _helpers.setSelected)(color_select, 'Blues');\n }\n // const color_select_left = document.querySelectorAll('.color_params_left > option');\n // const color_select_right = document.querySelectorAll('.color_params_right > option');\n // for (let ixc = 0; ixc < color_select_left.length; ixc++) {\n // if (color_select_left[ixc].value.startsWith('user_')) {\n // const is_disabled = (nb_class === +color_select_left[ixc].getAttribute('nb_colors'))\n // ? false : true;\n // color_select_left[ixc].disabled = is_disabled;\n // color_select_right[ixc].disabled = is_disabled;\n // }\n // }\n };\n\n var update_axis = function update_axis(group) {\n group.call(d3.axisBottom().scale(x).tickFormat(formatCount));\n };\n\n var update_overlay_elements = function update_overlay_elements() {\n var x_mean = x(mean_serie),\n x_med = x(serie.median()),\n x_std_left = x(mean_serie - stddev_serie),\n x_std_right = x(mean_serie + stddev_serie);\n line_mean.transition().attrs({ x1: x_mean, x2: x_mean });\n txt_mean.transition().attr('x', x_mean);\n line_median.transition().attrs({ x1: x_med, x2: x_med });\n txt_median.transition().attr('x', x_med);\n line_std_left.transition().attrs({ x1: x_std_left, x2: x_std_left });\n line_std_right.transition().attrs({ x1: x_std_right, x2: x_std_right });\n rug_plot.selectAll('.indiv').attrs(function (d) {\n return { x1: x(d.value), x2: x(d.value) };\n });\n };\n\n var make_overlay_elements = function make_overlay_elements() {\n line_mean = overlay_svg.append('line').attrs({\n class: 'line_mean',\n x1: x(mean_serie),\n y1: 10,\n x2: x(mean_serie),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'blue', fill: 'none' }).classed('active', false);\n\n txt_mean = overlay_svg.append('text').attrs({\n y: 0,\n dy: '0.75em',\n x: x(mean_serie),\n 'text-anchor': 'middle'\n }).style('fill', 'none').text(_tr('disc_box.mean'));\n\n line_median = overlay_svg.append('line').attrs({\n class: 'line_med',\n x1: x(serie.median()),\n y1: 10,\n x2: x(serie.median()),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'darkgreen', fill: 'none' }).classed('active', false);\n\n txt_median = overlay_svg.append('text').attrs({\n y: 0,\n dy: '0.75em',\n x: x(serie.median()),\n 'text-anchor': 'middle'\n }).style('fill', 'none').text(_tr('disc_box.median'));\n\n line_std_left = overlay_svg.append('line').attrs({\n class: 'lines_std',\n x1: x(mean_serie - stddev_serie),\n y1: 10,\n x2: x(mean_serie - stddev_serie),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'grey', fill: 'none' }).classed('active', false);\n\n line_std_right = overlay_svg.append('line').attrs({\n class: 'lines_std',\n x1: x(mean_serie + stddev_serie),\n y1: 10,\n x2: x(mean_serie + stddev_serie),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'grey', fill: 'none' }).classed('active', false);\n\n rug_plot = overlay_svg.append('g').style('display', 'none');\n rug_plot.selectAll('.indiv').data(values.map(function (i) {\n return { value: +i };\n })).enter().insert('line').attrs(function (d) {\n return {\n class: 'indiv',\n x1: x(d.value),\n y1: svg_h - margin.bottom - 10,\n x2: x(d.value),\n y2: svg_h - margin.bottom\n };\n }).styles({ stroke: 'red', fill: 'none', 'stroke-width': 1 });\n };\n\n var make_summary = function make_summary() {\n var content_summary = (0, _helpers.make_content_summary)(serie);\n newBox.append('div').attr('id', 'summary').styles({ 'font-size': '11px', float: 'right', margin: '10px 10px 0px 10px' }).insert('p').html(['', _tr('disc_box.summary'), '
', content_summary].join(''));\n };\n\n var redisplay = {\n compute: function compute() {\n var tmp = void 0;\n serie = new geostats(values);\n breaks = [];\n values = serie.sorted();\n var deferred = Promise.pending();\n return new Promise(function (resolve, reject) {\n if (values.length > 7500 && type === 'jenks') {\n var jenks_worker = new Worker('static/js/webworker_jenks.js');\n _app.webworker_to_cancel = jenks_worker;\n _app.waitingOverlay.display({ zIndex: 5000 });\n jenks_worker.postMessage([values, nb_class]);\n jenks_worker.onmessage = function (e) {\n breaks = e.data;\n serie.setClassManually(breaks);\n serie.doCount();\n stock_class = Array.prototype.slice.call(serie.counter);\n _app.waitingOverlay.hide();\n _app.webworker_to_cancel = undefined;\n bins = [];\n for (var i = 0, len = stock_class.length; i < len; i++) {\n var bin = {};\n bin.val = stock_class[i];\n bin.offset = i === 0 ? 0 : bins[i - 1].width + bins[i - 1].offset;\n bin.width = breaks[i + 1] - breaks[i];\n bin.height = bin.val / bin.width;\n bins[i] = bin;\n }\n resolve(true);\n jenks_worker.terminate();\n };\n }\n\n if (type === 'Q6') {\n tmp = (0, _common.getBreaksQ6)(values, serie.precision);\n // stock_class = tmp.stock_class;\n breaks = tmp.breaks;\n breaks[0] = min_serie;\n breaks[6] = max_serie;\n serie.setClassManually(breaks);\n serie.doCount();\n stock_class = Array.prototype.slice.call(serie.counter);\n } else if (type === 'stddev_f') {\n tmp = (0, _common.getBreaksStdDev)(serie, std_dev_params.share, std_dev_params.role_mean, serie.precision);\n update_nb_class(nb_class = tmp.nb_class);\n breaks = tmp.breaks;\n serie.setClassManually(tmp.breaks);\n serie.doCount();\n stock_class = Array.prototype.slice.call(serie.counter);\n } else if (type === 'user_defined') {\n tmp = (0, _common.getBreaks_userDefined)(serie.sorted(), user_break_list);\n stock_class = tmp.stock_class;\n breaks = tmp.breaks;\n nb_class = tmp.breaks.length - 1;\n update_nb_class(nb_class);\n\n if (breaks[0] > min_serie) breaks[0] = min_serie;\n if (breaks[nb_class] < max_serie) breaks[nb_class] = max_serie;\n\n var breaks_serie = breaks.slice();\n if (breaks_serie[0] < min_serie) {\n breaks_serie[0] = min_serie;\n }\n if (breaks_serie[nb_class] > max_serie) {\n breaks_serie[nb_class] = max_serie;\n }\n serie.setClassManually(breaks_serie);\n } else {\n breaks = serie[_common.discretiz_geostats_switch.get(type)](nb_class);\n // if (serie.precision) breaks = breaks.map(val => round_value(val, serie.precision));\n serie.doCount();\n stock_class = Array.prototype.slice.call(serie.counter);\n }\n // In order to avoid class limit falling out the serie limits with Std class :\n // breaks[0] = breaks[0] < serie.min() ? serie.min() : breaks[0];\n // ^^ well finally not ?\n if (stock_class.length === 0) {\n resolve(false);\n }\n\n bins = [];\n for (var i = 0, len = stock_class.length; i < len; i++) {\n var _stock = stock_class[i];\n var _bin_width = breaks[i + 1] - breaks[i];\n bins.push({\n val: _stock,\n offset: i === 0 ? 0 : bins[i - 1].width + bins[i - 1].offset,\n height: _stock / _bin_width,\n width: _bin_width\n });\n }\n resolve(true);\n });\n },\n draw: function draw(provided_colors) {\n // Clean-up previously made histogram :\n newBox.select('#svg_discretization').selectAll('.bar').remove();\n newBox.select('#svg_discretization').selectAll('.text_bar').remove();\n\n if (!provided_colors) {\n var col_scheme = newBox.select('.color_params_left').node() ? 'diverging' : 'sequential';\n if (col_scheme === 'sequential') {\n if (to_reverse) {\n color_array = color_array.reverse();\n to_reverse = false;\n } else {\n var selected_palette = document.querySelector('.color_params').value;\n if (selected_palette.startsWith('user_')) {\n color_array = _app.custom_palettes.get(selected_palette.slice(5));\n } else {\n color_array = (0, _colors_helpers.getColorBrewerArray)(nb_class, selected_palette);\n color_array = color_array.slice(0, nb_class);\n }\n }\n } else if (col_scheme === 'diverging') {\n var left_palette = document.querySelector('.color_params_left').value,\n right_palette = document.querySelector('.color_params_right').value,\n ctl_class_value = +document.getElementById('centr_class').value,\n ctl_class_color = document.querySelector('.central_color > input').checked ? document.getElementById('central_color_val').value : [];\n\n var class_right = nb_class - ctl_class_value + 1,\n class_left = ctl_class_value - 1,\n max_col_nb = (0, _helpers_math.Mmax)(class_right, class_left);\n\n var right_pal = (0, _colors_helpers.getColorBrewerArray)(max_col_nb, right_palette);\n var left_pal = (0, _colors_helpers.getColorBrewerArray)(max_col_nb, left_palette);\n\n // Below is for the case if we have displayed the custom palette also\n // for a diverging scheme:\n // let right_pal,\n // left_pal;\n // if (right_palette.startsWith('user_')) {\n // right_pal = _app.custom_palettes.get(right_palette.slice(5));\n // } else {\n // right_pal = getColorBrewerArray(max_col_nb, right_palette);\n // }\n // if (left_palette.startsWith('user_')) {\n // left_pal = _app.custom_palettes.get(left_palette.slice(5));\n // } else {\n // left_pal = getColorBrewerArray(max_col_nb, left_palette);\n // }\n right_pal = right_pal.slice(0, class_right);\n left_pal = left_pal.slice(0, class_left).reverse();\n color_array = [].concat(left_pal, ctl_class_color, right_pal);\n }\n } else {\n color_array = provided_colors.slice();\n }\n for (var i = 0, len = bins.length; i < len; ++i) {\n bins[i].color = color_array[i];\n }\n x.domain([breaks[0], breaks[breaks.length - 1]]);\n y.domain([0, d3.max(bins.map(function (d) {\n return d.height + d.height / 3;\n }))]);\n\n svg_histo.select('.x_axis').transition().call(update_axis);\n update_overlay_elements();\n\n var xx = d3.scaleLinear().range([0, svg_w]).domain([0, d3.max(bins.map(function (d) {\n return d.offset + d.width;\n }))]);\n\n svg_histo.selectAll('.bar').data(bins).enter().append('rect').attrs(function (d, i) {\n return {\n class: 'bar',\n id: 'bar_' + i,\n transform: 'translate(0, -7.5)',\n x: xx(d.offset),\n y: y(d.height) - margin.bottom,\n width: xx(d.width),\n height: svg_h - y(d.height)\n };\n }).styles(function (d) {\n return {\n fill: d.color,\n opacity: 0.95,\n 'stroke-opacity': 1\n };\n }).on('mouseover', function () {\n this.parentElement.querySelector('#text_bar_' + this.id.split('_')[1]).style.display = null;\n }).on('mouseout', function () {\n this.parentElement.querySelector('#text_bar_' + this.id.split('_')[1]).style.display = 'none';\n });\n\n svg_histo.selectAll('.txt_bar').data(bins).enter().append('text').attrs(function (d, i) {\n return {\n id: 'text_bar_' + i,\n class: 'text_bar',\n 'text-anchor': 'middle',\n dy: '.75em',\n x: xx(d.offset + d.width / 2),\n y: y(d.height) - margin.top * 2 - margin.bottom - 1.5\n };\n }).styles({ color: 'black', cursor: 'default', display: 'none' }).text(function (d) {\n return formatCount(d.val);\n });\n\n document.getElementById('user_breaks_area').value = breaks.join(' - ');\n return true;\n }\n };\n\n var modal_box = (0, _dialogs.make_dialog_container)('discretiz_charts', [_tr('disc_box.title'), ' - ', layer_name, ' - ', field_name].join(''), 'discretiz_charts_dialog');\n var container = document.getElementById('discretiz_charts');\n var newBox = d3.select(container).select('.modal-body');\n var db_data = void 0;\n if (data_manager.result_data.hasOwnProperty(layer_name)) {\n db_data = data_manager.result_data[layer_name];\n } else if (data_manager.user_data.hasOwnProperty(layer_name)) {\n db_data = data_manager.user_data[layer_name];\n } else {\n var layer = svg_map.querySelector('#' + _app.idLayer.get(layer_name));\n db_data = Array.prototype.map.call(layer.children, function (d) {\n return d.__data__.properties;\n });\n }\n var indexes = [];\n var color_array = [],\n nb_values = db_data.length,\n values = [],\n no_data = void 0;\n\n var type = options.type;\n\n for (var i = 0; i < nb_values; i++) {\n var value = db_data[i][field_name];\n // if (value != null && value !== '' && isFinite(value) && !isNaN(+value)) {\n if ((0, _helpers.isNumber)(value)) {\n values.push(+db_data[i][field_name]);\n indexes.push(i);\n }\n }\n\n if (nb_values === values.length) {\n no_data = 0;\n } else {\n no_data = nb_values - values.length;\n nb_values = values.length;\n }\n\n var max_nb_class = nb_values > 20 ? 20 : nb_values;\n var serie = new geostats(values),\n breaks = [],\n stock_class = [],\n bins = [],\n user_break_list = null,\n std_dev_params = options.extra_options && options.extra_options.role_mean ? options.extra_options : { role_mean: 'center', share: 1 };\n\n if (serie.variance() === 0 && serie.stddev() === 0) {\n serie = new geostats(values);\n }\n\n var min_serie = serie.min();\n var max_serie = serie.max();\n var mean_serie = serie.mean();\n var stddev_serie = serie.stddev();\n\n values = serie.sorted();\n\n var available_functions = [[_tr('app_page.common.equal_interval'), 'equal_interval'], [_tr('app_page.common.quantiles'), 'quantiles'], [_tr('app_page.common.stddev_f'), 'stddev_f'], [_tr('app_page.common.Q6'), 'Q6'], [_tr('app_page.common.jenks'), 'jenks']];\n\n if (!serie._hasZeroValue() && !serie._hasNegativeValue()) {\n available_functions.push([_tr('app_page.common.geometric_progression'), 'geometric_progression']);\n }\n var precision_axis = (0, _helpers_calc.get_precision_axis)(min_serie, max_serie, serie.precision);\n var formatCount = d3.format(precision_axis);\n var discretization_panel = newBox.append('div').attr('id', 'discretization_panel');\n var discretization = discretization_panel.insert('p').insert('select').attr('class', 'params').on('change', function () {\n type = this.value;\n if (type === 'stddev_f') {\n input_section_stddev.style('display', '');\n document.getElementById('nb_class_range').disabled = 'disabled';\n txt_nb_class.style('disabled', 'disabled');\n disc_nb_class.style('display', 'none');\n } else {\n input_section_stddev.style('display', 'none');\n document.getElementById('nb_class_range').disabled = false;\n txt_nb_class.style('disabled', false);\n disc_nb_class.style('display', 'inline');\n }\n if (type === 'Q6') {\n update_nb_class(6);\n }\n redisplay.compute().then(function (v) {\n if (v) redisplay.draw();\n });\n });\n\n available_functions.forEach(function (func) {\n discretization.append('option').text(func[0]).attr('value', func[1]);\n });\n\n var input_section_stddev = discretization_panel.insert('p').styles({ margin: 'auto', display: type === 'stddev_f' ? '' : 'none' });\n input_section_stddev.insert('span').html(_tr('disc_box.stddev_share_txt1'));\n input_section_stddev.insert('input').attrs({\n type: 'number', min: 0.1, max: 10, step: 0.1, class: 'without_spinner', id: 'stddev_share'\n }).styles({\n width: '45px', 'margin-left': '10px', 'margin-right': '10px'\n }).property('value', std_dev_params.share).on('change', function () {\n var val = this.value;\n if (val === 0 || val * stddev_serie > max_serie - min_serie || val * stddev_serie * 21 < max_serie - min_serie) {\n // If the new value is too big or too small:\n this.value = std_dev_params.share;\n return;\n }\n std_dev_params.share = val;\n redisplay.compute().then(function (v) {\n if (v) redisplay.draw();\n });\n });\n input_section_stddev.insert('span').html(_tr('disc_box.stddev_share_txt2'));\n var std_dev_mean_choice = input_section_stddev.insert('p').style('margin', 'auto');\n std_dev_mean_choice.insert('p').style('margin', 'auto').html(_tr('disc_box.stddev_role_mean'));\n\n [[_tr('disc_box.stddev_center_mean'), 'center'], [_tr('disc_box.stddev_break_mean'), 'bound']].forEach(function (el) {\n std_dev_mean_choice.insert('input').attrs({ type: 'radio', name: 'role_mean', id: 'button_stddev_' + el[1] }).property('value', el[1]).on('change', function () {\n std_dev_params.role_mean = this.value;\n redisplay.compute().then(function (v) {\n if (v) redisplay.draw();\n });\n });\n std_dev_mean_choice.insert('label').style('font-weight', '400').attr('for', 'button_stddev_' + el[1]).html(el[0]);\n });\n document.getElementById('button_stddev_' + std_dev_params.role_mean).checked = true;\n var txt_nb_class = discretization_panel.append('input').attrs({ type: 'number', class: 'without_spinner', min: 2, max: max_nb_class, step: 1 }).styles({ width: '30px', margin: '0 10px', 'vertical-align': 'calc(20%)' }).property('value', nb_class).on('change', function () {\n var a = disc_nb_class.node();\n a.value = this.value;\n a.dispatchEvent(new Event('change'));\n });\n\n discretization_panel.append('span').html(_tr('disc_box.class'));\n\n var disc_nb_class = discretization_panel.insert('input').attrs({\n id: 'nb_class_range',\n type: 'range',\n min: 2,\n max: max_nb_class,\n step: 1\n }).styles({ display: 'inline', width: '60px', 'vertical-align': 'middle', margin: '10px' }).property('value', nb_class).on('change', function () {\n var _this = this;\n\n type = discretization.node().value;\n var old_nb_class = nb_class;\n if (type === 'Q6') {\n update_nb_class(6);\n } else if (type === 'stddev_f') {\n update_nb_class(nb_class);\n return;\n }\n // nb_class = +this.value;\n // txt_nb_class.node().value = nb_class;\n update_nb_class(+this.value);\n redisplay.compute().then(function (v) {\n if (!v) {\n _this.value = old_nb_class;\n txt_nb_class.node().value = +old_nb_class;\n } else {\n redisplay.draw();\n var ctl_class = document.getElementById('centr_class');\n if (ctl_class) {\n ctl_class.max = nb_class;\n if (ctl_class > nb_class) ctl_class.value = (0, _helpers_math.Mround)(nb_class / 2);\n }\n }\n });\n });\n\n var ref_histo_box = newBox.append('div').attr('id', 'ref_histo_box');\n ref_histo_box.append('div').attr('id', 'inner_ref_histo_box');\n\n discretization.node().value = type;\n make_summary();\n var refDisplay = (0, _common.prepare_ref_histo)(newBox, serie, formatCount);\n refDisplay('histogram');\n\n var svg_h = h / 5 > 100 ? h / 5 : 100,\n svg_w = window.innerWidth - 40 > 760 ? 760 : window.innerWidth - 40,\n margin = { top: 7.5, right: 30, bottom: 7.5, left: 30 },\n height = svg_h - margin.top - margin.bottom;\n\n d3.select(container).select('.modal-dialog').styles({\n width: svg_w + margin.top + margin.bottom + 90 + 'px',\n height: window.innerHeight - 60 + 'px'\n });\n\n if (values.length < 500) {\n // Only allow for beeswarm plot if there isn't too many values\n // as it seems to be costly due to the \"simulation\" + the voronoi\n var current_histo = 'histogram';\n ref_histo_box.append('p').style('text-align', 'center').insert('button').attrs({\n id: 'button_switch_plot', class: 'i18n button_st4', 'data-i18n': '[text]disc_box.switch_ref_histo'\n }).styles({ padding: '3px', 'font-size': '10px' }).html(_tr('disc_box.switch_ref_histo')).on('click', function () {\n var str_tr = void 0;\n if (current_histo === 'histogram') {\n refDisplay('box_plot');\n current_histo = 'box_plot';\n str_tr = '_boxplot';\n } else if (current_histo === 'box_plot') {\n refDisplay('beeswarm');\n current_histo = 'beeswarm';\n str_tr = '_beeswarm';\n } else if (current_histo === 'beeswarm') {\n refDisplay('histogram');\n current_histo = 'histogram';\n str_tr = '';\n }\n document.getElementById('ref_histo_title').innerHTML = '' + _tr('disc_box.hist_ref_title' + str_tr) + '';\n });\n }\n var div_svg = newBox.append('div').append('svg').attrs({\n id: 'svg_discretization',\n width: svg_w + margin.left + margin.right,\n height: svg_h + margin.top + margin.bottom\n });\n\n make_box_histo_option();\n\n var svg_histo = div_svg.append('g').attr('transform', 'translate(' + margin.left + ', ' + margin.top + ')');\n\n var x = d3.scaleLinear().domain([min_serie, max_serie]).range([0, svg_w]);\n\n var y = d3.scaleLinear().range([svg_h, 0]);\n\n var overlay_svg = div_svg.append('g').attr('transform', 'translate(30, 0)'),\n line_mean = void 0,\n line_std_right = void 0,\n line_std_left = void 0,\n line_median = void 0,\n txt_median = void 0,\n txt_mean = void 0,\n rug_plot = void 0;\n\n make_overlay_elements();\n\n svg_histo.append('g').attrs({ class: 'x_axis', transform: 'translate(0,' + height + ')' }).call(d3.axisBottom().scale(x).tickFormat(formatCount));\n\n newBox.append('button').attrs({ class: 'accordion_disc active', id: 'btn_acc_disc_color' }).style('padding', '0 6px').html(_tr('disc_box.title_color_scheme'));\n var accordion_colors = newBox.append('div').attrs({ class: 'panel show', id: 'accordion_colors' }).style('width', '98%');\n var color_scheme = accordion_colors.append('div').attr('id', 'color_div').style('text-align', 'center');\n\n [[_tr('disc_box.sequential'), 'sequential'], [_tr('disc_box.diverging'), 'diverging']].forEach(function (el) {\n color_scheme.insert('label').style('margin', '20px').html(el[0]).insert('input').attrs({ type: 'radio', name: 'color_scheme', id: 'button_' + el[1] }).property('value', el[1]).on('change', function () {\n if (this.value === 'sequential') {\n make_sequ_button();\n } else {\n make_diverg_button();\n }\n redisplay.draw();\n });\n });\n var to_reverse = false;\n document.getElementById('button_sequential').checked = true;\n accordion_colors.append('span').attr('id', 'button_palette_box').styles({\n margin: '5px',\n float: 'right',\n cursor: 'pointer',\n 'font-style': 'italic'\n }).html(_tr('app_page.palette_box.button')).on('click', function () {\n make_box_custom_palette(nb_class).then(function (result) {\n if (result) {\n var _result = _slicedToArray(result, 2),\n colors = _result[0],\n palette_name = _result[1];\n\n var select_palette = document.querySelector('.color_params');\n (0, _colors_helpers.addNewCustomPalette)(palette_name, colors);\n if (select_palette) {\n d3.select(select_palette).append('option').text(palette_name).attrs({ value: 'user_' + palette_name, title: palette_name, nb_colors: colors.length });\n (0, _helpers.setSelected)(select_palette, 'user_' + palette_name);\n }\n // else {\n // d3.select('.color_params_right')\n // .append('option')\n // .text(palette_name)\n // .attrs({ value: `user_${palette_name}`, title: palette_name, nb_colors: colors.length });\n // d3.select('.color_params_left')\n // .append('option')\n // .text(palette_name)\n // .attrs({ value: `user_${palette_name}`, title: palette_name, nb_colors: colors.length });\n // }\n }\n });\n });\n\n newBox.append('button').attrs({ class: 'accordion_disc', id: 'btn_acc_disc_break' }).style('padding', '0 6px').html(_tr('disc_box.title_break_values'));\n var accordion_breaks = newBox.append('div').attrs({ class: 'panel', id: 'accordion_breaks_vals' }).style('width', '98%');\n var user_defined_breaks = accordion_breaks.append('div').attr('id', 'user_breaks');\n\n user_defined_breaks.insert('textarea').attrs({\n id: 'user_breaks_area',\n placeholder: _tr('app_page.common.expected_class')\n }).style('width', '600px');\n\n user_defined_breaks.insert('button').text(_tr('app_page.common.valid')).on('click', function () {\n // const old_nb_class = nb_class;\n user_break_list = document.getElementById('user_breaks_area').value;\n type = 'user_defined';\n // nb_class = user_break_list.split('-').length - 1;\n // txt_nb_class.node().value = +nb_class;\n // txt_nb_class.html(_tr(\"disc_box.class\", {count: +nb_class}));\n // document.getElementById(\"nb_class_range\").value = nb_class;\n redisplay.compute().then(function (v) {\n if (v) redisplay.draw();\n });\n });\n\n (0, _interface.accordionize)('.accordion_disc', container);\n\n if (no_data > 0) {\n make_no_data_section();\n if (options.no_data) {\n document.getElementById('no_data_color').value = options.no_data;\n }\n }\n\n if (!options.schema) {\n make_sequ_button();\n } else if (options.schema.length === 1) {\n make_sequ_button();\n document.querySelector('.color_params').value = options.schema[0];\n document.querySelector('.color_params').style.backgroundImage = 'url(/static/img/palettes/' + options.schema[0] + '.png)';\n } else if (options.schema.length > 1) {\n make_diverg_button();\n document.getElementById('button_diverging').checked = true;\n var tmp = 0;\n (0, _helpers.setSelected)(document.querySelector('.color_params_left'), options.schema[0]);\n // document.querySelector(\".color_params_left\").value = options.schema[0];\n if (options.schema.length > 2) {\n var elem = document.getElementById('central_color_val');\n elem.style.display = '';\n elem.value = options.schema[1];\n tmp = 1;\n document.querySelector('.central_color').querySelector('input').checked = true;\n } else {\n document.querySelector('.central_color').querySelector('input').checked = false;\n }\n (0, _helpers.setSelected)(document.querySelector('.color_params_right'), options.schema[1 + tmp]);\n // document.querySelector(\".color_params_right\").value = options.schema[1 + tmp];\n }\n\n if (options.type && options.type === 'user_defined') {\n user_break_list = options.breaks;\n }\n\n redisplay.compute().then(function (v) {\n if (v) redisplay.draw(options.colors);\n });\n\n return new Promise(function (resolve, reject) {\n container.querySelector('.btn_ok').onclick = function () {\n breaks = breaks.map(function (i) {\n return +i;\n });\n var colors_map = [];\n var no_data_color = null;\n if (no_data > 0) {\n no_data_color = document.getElementById('no_data_color').value;\n }\n for (var j = 0; j < db_data.length; ++j) {\n var _value = db_data[j][field_name];\n // if (value !== null && value !== '' && !isNaN(+value)) {\n if ((0, _helpers.isNumber)(_value)) {\n var idx = serie.getClass(+_value);\n colors_map.push(color_array[idx]);\n } else {\n colors_map.push(no_data_color);\n }\n }\n var col_schema = [];\n if (!d3.select('.color_params_left').node()) {\n col_schema.push(document.querySelector('.color_params').value);\n } else {\n col_schema.push(document.querySelector('.color_params_left').value);\n if (document.querySelector('.central_color').querySelector('input').checked) {\n col_schema.push(document.getElementById('central_color_val').value);\n }\n col_schema.push(document.querySelector('.color_params_right').value);\n }\n resolve([nb_class, type, breaks, color_array, colors_map, col_schema, no_data_color, type === 'stddev_f' ? std_dev_params : undefined]);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)();\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n\n var _onclose = function _onclose() {\n resolve(false);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)();\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n var helper_esc_key_twbs = function helper_esc_key_twbs(evt) {\n var _event = evt || window.event;\n var isEscape = 'key' in _event ? _event.key === 'Escape' || _event.key === 'Esc' : _event.keyCode === 27;\n if (isEscape) {\n _event.stopPropagation();\n _onclose();\n }\n };\n document.addEventListener('keydown', helper_esc_key_twbs);\n _dialogs.overlay_under_modal.display();\n });\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/classification/discretization_panel.js?"); + +/***/ }), + +/***/ "./js/classification/discrtiz_links_discont.js": +/*!*****************************************************!*\ + !*** ./js/classification/discrtiz_links_discont.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.display_discretization_links_discont = undefined;\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _function = __webpack_require__(/*! ./../function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _common = __webpack_require__(/*! ./common */ \"./js/classification/common.js\");\n\nvar display_discretization_links_discont = exports.display_discretization_links_discont = function display_discretization_links_discont(layer_name, field_name, nb_class, type) {\n var make_box_histo_option = function make_box_histo_option() {\n var histo_options = newBox.append('div').attrs({ id: 'histo_options', class: 'row equal' }).styles({ margin: '5px 5px 10px 15px', width: '100%' });\n var a = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n b = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n c = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3'),\n d = histo_options.append('div').attr('class', 'col-xs-6 col-sm-3');\n\n a.insert('button').attrs({ class: 'btn_population' }).html(_tr('disc_box.disp_rug_pop')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n rug_plot.style('display', 'none');\n rug_plot.classed('active', false);\n } else {\n this.classList.add('active');\n rug_plot.style('display', '');\n rug_plot.classed('active', true);\n }\n });\n\n b.insert('button').attrs({ class: 'btn_mean' }).html(_tr('disc_box.disp_mean')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_mean.style('stroke-width', 0);\n txt_mean.style('fill', 'none');\n line_mean.classed('active', false);\n } else {\n this.classList.add('active');\n line_mean.style('stroke-width', 2);\n txt_mean.style('fill', 'blue');\n line_mean.classed('active', true);\n }\n });\n\n c.insert('button').attrs({ class: 'btn_median' }).html(_tr('disc_box.disp_median')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_median.style('stroke-width', 0).classed('active', false);\n txt_median.style('fill', 'none');\n } else {\n this.classList.add('active');\n line_median.style('stroke-width', 2).classed('active', true);\n txt_median.style('fill', 'darkgreen');\n }\n });\n\n d.insert('button').attrs({ class: 'btn_stddev' }).html(_tr('disc_box.disp_sd')).on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n line_std_left.style('stroke-width', 0);\n line_std_left.classed('active', false);\n line_std_right.style('stroke-width', 0);\n line_std_right.classed('active', false);\n } else {\n this.classList.add('active');\n line_std_left.style('stroke-width', 2);\n line_std_left.classed('active', true);\n line_std_right.style('stroke-width', 2);\n line_std_right.classed('active', true);\n }\n });\n };\n\n var make_overlay_elements = function make_overlay_elements() {\n var mean_val = serie.mean(),\n stddev = serie.stddev();\n\n line_mean = overlay_svg.append('line').attrs({\n class: 'line_mean',\n x1: x(mean_val),\n y1: 10,\n x2: x(mean_val),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'blue', fill: 'none' }).classed('active', false);\n\n txt_mean = overlay_svg.append('text').attrs({\n dy: '0.75em',\n x: x(mean_val),\n y: 0,\n 'text-anchor': 'middle'\n }).style('fill', 'none').text(_tr('disc_box.mean'));\n\n line_median = overlay_svg.append('line').attrs({\n class: 'line_med',\n x1: x(serie.median()),\n y1: 10,\n x2: x(serie.median()),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'darkgreen', fill: 'none' }).classed('active', false);\n\n txt_median = overlay_svg.append('text').attrs({\n dy: '0.75em',\n x: x(serie.median()),\n y: 0,\n 'text-anchor': 'middle'\n }).style('fill', 'none').text(_tr('disc_box.median'));\n\n line_std_left = overlay_svg.append('line').attrs({\n class: 'lines_std',\n x1: x(mean_val - stddev),\n y1: 10,\n x2: x(mean_val - stddev),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'grey', fill: 'none' }).classed('active', false);\n\n line_std_right = overlay_svg.append('line').attrs({\n class: 'lines_std',\n x1: x(mean_val + stddev),\n y1: 10,\n x2: x(mean_val + stddev),\n y2: svg_h - margin.bottom\n }).styles({ 'stroke-width': 0, stroke: 'grey', fill: 'none' }).classed('active', false);\n\n rug_plot = overlay_svg.append('g').style('display', 'none');\n rug_plot.selectAll('.indiv').data(values.map(function (i) {\n return { value: +i };\n })).enter().insert('line').attrs(function (d) {\n return {\n class: 'indiv',\n x1: x(d.value),\n y1: svg_h - margin.bottom - 10,\n x2: x(d.value),\n y2: svg_h - margin.bottom\n };\n }).styles({ stroke: 'red', fill: 'none', 'stroke-width': 1 });\n };\n\n var make_summary = function make_summary() {\n var content_summary = (0, _helpers.make_content_summary)(serie);\n newBox.append('div').attr('id', 'summary').styles({\n 'margin-left': '25px',\n 'margin-right': '50px',\n 'font-size': '10px',\n float: 'right'\n }).insert('p').html(['', _tr('disc_box.summary'), '
', content_summary].join(''));\n };\n\n var update_breaks = function update_breaks(user_defined) {\n if (!user_defined) {\n (0, _function.make_min_max_tableau)(values, nb_class, type, last_min, last_max, 'sizes_div', undefined, callback);\n }\n var tmp_breaks = (0, _function.fetch_min_max_table_value)('sizes_div');\n var len_breaks = tmp_breaks.sizes.length;\n breaks_info = [];\n last_min = tmp_breaks.sizes[0];\n last_max = tmp_breaks.sizes[tmp_breaks.sizes.length - 1];\n if ((0, _helpers_math.Mabs)(+serie.min() - +tmp_breaks.mins[0]) > 0.01) {\n nb_class += 1;\n txt_nb_class.node().value = nb_class;\n // txt_nb_class.html(_tr(\"disc_box.class\", {count: nb_class}));\n breaks_info.push([[serie.min(), +tmp_breaks.mins[0]], 0]);\n }\n\n for (var i = 0; i < len_breaks; i++) {\n breaks_info.push([[tmp_breaks.mins[i], tmp_breaks.maxs[i]], tmp_breaks.sizes[i]]);\n }\n breaks = [breaks_info[0][0][0]].concat(breaks_info.map(function (ft) {\n return ft[0][1];\n }));\n if (user_defined) {\n (0, _function.make_min_max_tableau)(null, nb_class, type, last_min, last_max, 'sizes_div', breaks_info, callback);\n }\n };\n\n var redisplay = {\n compute: function compute() {\n bins = [];\n for (var i = 0, len = breaks_info.length; i < len; i++) {\n // const bin = {};\n // bin.offset = i === 0 ? 0 : (bins[i - 1].width + bins[i - 1].offset);\n // bin.width = breaks[i + 1] - breaks[i];\n // bin.height = breaks_info[i][1];\n // bins[i] = bin;\n bins.push({\n offset: i === 0 ? 0 : bins[i - 1].width + bins[i - 1].offset,\n width: breaks[i + 1] - breaks[i],\n height: breaks_info[i][1]\n });\n }\n return true;\n },\n draw: function draw() {\n // Clean-up previously made histogram :\n d3.select('#svg_discretization').selectAll('.bar').remove();\n\n for (var i = 0, len = bins.length; i < len; ++i) {\n bins[i].color = array_color[i];\n }\n\n var x = d3.scaleLinear().domain([serie.min(), serie.max()]).range([0, svg_w]);\n\n var y = d3.scaleLinear().range([svg_h, 0]);\n\n x.domain([0, d3.max(bins.map(function (d) {\n return d.offset + d.width;\n }))]);\n y.domain([0, d3.max(bins.map(function (d) {\n return d.height + d.height / 5;\n }))]);\n\n svg_histo.selectAll('.bar').data(bins).enter().append('rect').attrs(function (d, i) {\n return {\n class: 'bar',\n id: 'bar_' + i,\n transform: 'translate(0, -17.5)',\n x: x(d.offset),\n y: y(d.height) - margin.bottom,\n width: x(d.width),\n height: svg_h - y(d.height)\n };\n }).styles(function (d) {\n return {\n opacity: 0.95,\n 'stroke-opacity': 1,\n fill: d.color\n };\n });\n\n return true;\n }\n };\n\n var title_box = [_tr('disc_box.title'), ' - ', layer_name, ' - ', field_name].join('');\n var modal_box = (0, _dialogs.make_dialog_container)('discretiz_charts', title_box, 'discretiz_charts_dialog');\n var newBox = d3.select('#discretiz_charts').select('.modal-body');\n var db_data = void 0;\n if (data_manager.result_data.hasOwnProperty(layer_name)) {\n db_data = data_manager.result_data[layer_name];\n } else if (data_manager.user_data.hasOwnProperty(layer_name)) {\n db_data = data_manager.user_data[layer_name];\n }\n\n var color_array = [];\n var indexes = [];\n var nb_values = db_data.length;\n var values = [];\n var no_data = void 0;\n\n for (var i = 0; i < nb_values; i++) {\n if (db_data[i][field_name] != null) {\n values.push(+db_data[i][field_name]);\n indexes.push(i);\n }\n }\n\n if (nb_values === values.length) {\n no_data = 0;\n } else {\n no_data = nb_values - values.length;\n nb_values = values.length;\n }\n var max_nb_class = nb_values > 20 ? 20 : nb_values;\n var sizes = data_manager.current_layers[layer_name].breaks.map(function (el) {\n return el[1];\n });\n\n var serie = new geostats(values),\n breaks_info = [].concat(data_manager.current_layers[layer_name].breaks),\n breaks = [+breaks_info[0][0][0]],\n bins = [],\n last_min = (0, _helpers_calc.min_fast)(sizes),\n last_max = (0, _helpers_calc.max_fast)(sizes),\n array_color = d3.schemeSet3.slice();\n\n breaks_info.forEach(function (elem) {\n breaks.push(elem[0][1]);\n });\n\n if (serie.variance() === 0 && serie.stddev() === 0) {\n serie = new geostats(values);\n }\n\n values = serie.sorted();\n // serie.setPrecision(6);\n var available_functions = [[_tr('app_page.common.equal_interval'), 'equal_interval'], [_tr('app_page.common.quantiles'), 'quantiles'], [_tr('app_page.common.user_defined'), 'user_defined'],\n // [_tr(\"app_page.common.std_dev\"), \"std_dev\"],\n [_tr('app_page.common.Q6'), 'Q6'], [_tr('app_page.common.jenks'), 'jenks']];\n\n if (!serie._hasZeroValue() && !serie._hasZeroValue()) {\n available_functions.push([_tr('app_page.common.geometric_progression'), 'geometric_progression']);\n }\n var precisionAxis = (0, _helpers_calc.get_precision_axis)(serie.min(), serie.max(), serie.precision);\n var formatCount = d3.format(precisionAxis);\n\n var discretization_panel = newBox.append('div').attr('id', 'discretization_panel');\n var discretization_choice = discretization_panel.insert('p').html('Type ').insert('select').attr('class', 'params').on('change', function () {\n var old_type = type;\n if (this.value === 'user_defined') {\n this.value = old_type;\n return;\n }\n type = this.value;\n if (type === 'Q6') {\n nb_class = 6;\n txt_nb_class.node().value = nb_class;\n document.getElementById('nb_class_range').value = 6;\n }\n update_breaks();\n redisplay.compute();\n redisplay.draw();\n });\n\n available_functions.forEach(function (func) {\n discretization_choice.append('option').text(func[0]).attr('value', func[1]);\n });\n\n var ref_histo_box = newBox.append('div').attr('id', 'ref_histo_box');\n ref_histo_box.append('div').attr('id', 'inner_ref_histo_box');\n\n discretization_choice.node().value = type;\n\n make_summary();\n\n var refDisplay = (0, _common.prepare_ref_histo)(newBox, serie, formatCount);\n refDisplay('histogram');\n\n if (values.length < 750) {\n // Only allow for beeswarm plot if there isn't too many values\n // as it seems to be costly due to the \"simulation\" + the voronoi\n var choiceHisto = ref_histo_box.append('p').style('text-align', 'center');\n var currentHisto = 'histogram';\n choiceHisto.insert('button').attrs({\n id: 'button_switch_plot',\n class: 'i18n button_st4',\n 'data-i18n': '[text]disc_box.switch_ref_histo'\n }).styles({ padding: '3px', 'font-size': '10px' }).html(_tr('disc_box.switch_ref_histo')).on('click', function () {\n if (currentHisto === 'histogram') {\n refDisplay('box_plot');\n currentHisto = 'box_plot';\n } else if (currentHisto === 'box_plot') {\n refDisplay('beeswarm');\n currentHisto = 'beeswarm';\n } else if (currentHisto === 'beeswarm') {\n refDisplay('histogram');\n currentHisto = 'histogram';\n }\n });\n }\n\n var txt_nb_class = discretization_panel.append('input').attrs({\n type: 'number', class: 'without_spinner', min: 2, max: max_nb_class, step: 1\n }).styles({ width: '30px', margin: '0 10px', 'vertical-align': 'calc(20%)' }).property('value', nb_class).on('change', function () {\n var a = disc_nb_class.node();\n a.value = this.value;\n a.dispatchEvent(new Event('change'));\n });\n\n discretization_panel.append('span').html(_tr('disc_box.class'));\n\n var disc_nb_class = discretization_panel.insert('input').styles({\n display: 'inline', width: '60px', 'vertical-align': 'middle', margin: '10px'\n }).attrs({\n id: 'nb_class_range',\n type: 'range',\n min: 2,\n max: max_nb_class,\n step: 1\n }).property('value', nb_class).on('change', function () {\n type = discretization_choice.node().value;\n if (type === 'user_defined') {\n type = 'equal_interval';\n discretization_choice.node().value = 'equal_interval';\n }\n if (type === 'Q6') {\n this.value = 6;\n return;\n }\n nb_class = +this.value;\n txt_nb_class.node().value = nb_class;\n update_breaks();\n redisplay.compute();\n redisplay.draw();\n });\n\n var svg_h = h / 5 > 90 ? h / 5 : 90,\n svg_w = w - w / 8,\n margin = { top: 17.5, right: 30, bottom: 7.5, left: 30 },\n height = svg_h - margin.top - margin.bottom;\n\n d3.select('#discretiz_charts').select('.modal-dialog').styles({\n width: svg_w + margin.top + margin.bottom + 90 + 'px',\n height: window.innerHeight - 60 + 'px'\n });\n\n var div_svg = newBox.append('div').append('svg').attrs({\n id: 'svg_discretization',\n width: svg_w + margin.left + margin.right,\n height: svg_h + margin.top + margin.bottom\n });\n\n make_box_histo_option();\n\n var svg_histo = div_svg.append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');\n\n var x = d3.scaleLinear().domain([serie.min(), serie.max()]).range([0, svg_w]);\n\n var overlay_svg = div_svg.append('g').attr('transform', 'translate(30, 0)');\n\n var line_mean = void 0,\n line_std_right = void 0,\n line_std_left = void 0,\n line_median = void 0,\n txt_median = void 0,\n txt_mean = void 0,\n rug_plot = void 0;\n\n make_overlay_elements();\n\n // As the x axis and the mean didn't change, they can be drawn only once :\n svg_histo.append('g').attrs({\n class: 'x axis',\n transform: 'translate(0,' + height + ')'\n }).call(d3.axisBottom().scale(x).tickFormat(formatCount));\n\n var box_content = newBox.append('div').attr('id', 'box_content');\n box_content.append('h3').style('margin', '0').html(_tr('disc_box.line_size'));\n box_content.append('div').attr('id', 'sizes_div');\n var callback = function callback() {\n discretization_choice.node().value = type;\n update_breaks(true);\n redisplay.compute();\n redisplay.draw();\n };\n (0, _function.make_min_max_tableau)(null, nb_class, type, null, null, 'sizes_div', breaks_info, callback);\n\n redisplay.compute();\n redisplay.draw();\n\n var container = document.getElementById('discretiz_charts');\n return new Promise(function (resolve, reject) {\n var _onclose = function _onclose() {\n resolve(false);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)('.styleBox');\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n var helper_esc_key_twbs = function helper_esc_key_twbs(evt) {\n var _event = evt || window.event;\n var isEscape = 'key' in _event ? _event.key === 'Escape' || _event.key === 'Esc' : _event.keyCode === 27;\n if (isEscape) {\n _event.preventDefault();\n _onclose();\n }\n };\n container.querySelector('.btn_ok').onclick = function () {\n breaks[0] = serie.min();\n breaks[nb_class] = serie.max();\n resolve([serie, breaks_info, breaks]);\n document.removeEventListener('keydown', helper_esc_key_twbs);\n container.remove();\n var p = (0, _dialogs.reOpenParent)('.styleBox');\n if (!p) _dialogs.overlay_under_modal.hide();\n };\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n document.addEventListener('keydown', helper_esc_key_twbs);\n });\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/classification/discrtiz_links_discont.js?"); + +/***/ }), + +/***/ "./js/colors_helpers.js": +/*!******************************!*\ + !*** ./js/colors_helpers.js ***! + \******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addNewCustomPalette = exports.randomColor = exports.ColorsSelected = exports.Colors = exports.interpolateColor = exports.interp_n = exports.getColorBrewerArray = undefined;\nexports.rgb2hex = rgb2hex;\nexports.hexToRgb = hexToRgb;\n\nvar _colorbrewer = __webpack_require__(/*! colorbrewer */ \"./node_modules/colorbrewer/index.js\");\n\nvar _colorbrewer2 = _interopRequireDefault(_colorbrewer);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n* Convert rgb color to hexcode.\n*\n* @param {string} rgb - The RGB color.\n* @return {string} - The color as an hexcode.\n*\n*/\nfunction rgb2hex(rgb) {\n // Originally from http://jsfiddle.net/mushigh/myoskaos/\n if (typeof rgb === 'string') {\n if (rgb.indexOf('#') > -1 || rgb.indexOf('rgb') < 0) {\n return rgb;\n }\n var _rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return _rgb && _rgb.length === 4 ? '#' + ('0' + parseInt(_rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(_rgb[2], 10).toString(16)).slice(-2) + ('0' + parseInt(_rgb[3], 10).toString(16)).slice(-2) : '';\n }\n return rgb && rgb.length === 3 ? '#' + ('0' + parseInt(rgb[0], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) : '';\n}\n\n/**\n* Convert color hexcode to RGB code.\n*\n* @param {string} hex - The input hexcode.\n* @param {string} out - The output format between \"string\" and \"array\"\n* @return {string|array} - the rgb color as a string or as an array.\n*\n*/\nfunction hexToRgb(hex, out) {\n // Originally from http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb\n var res = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n if (out === 'string') {\n return res ? 'rgb(' + parseInt(res[1], 16) + ',' + parseInt(res[2], 16) + ',' + parseInt(res[3], 16) + ')' : null;\n }\n return res ? [parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16)] : null;\n}\n\n/**\n* Helper function in order to have a colorbrewer color ramp with\n* non-supported number of value using interpolation between the colorbrewer color\n* to fit the requested number of classes.\n* If the number of class fit the size of a colorbrewer ramp (3 < nb_class < 9)\n* the genuine colorbrewer array is directly returned.\n*\n* @param {interger} nbClass - The number of classes/colors wanted.\n* @param {integer} name - The name of the colorBrewer palette to use\n* @return {array} - An array of color with the desired length\n*/\nvar getColorBrewerArray = exports.getColorBrewerArray = function getColorBrewerArray(nbClass, name) {\n if (nbClass < 10 && nbClass >= 3) {\n var _colors = _colorbrewer2.default[name][nbClass];\n return _colors;\n } else if (nbClass < 3) {\n var _colors2 = _colorbrewer2.default[name][3];\n return [rgb2hex(interpolateColor(hexToRgb(_colors2[0]), hexToRgb(_colors2[1]))), rgb2hex(interpolateColor(hexToRgb(_colors2[1]), hexToRgb(_colors2[2])))];\n } else if (nbClass > 9 && nbClass < 18) {\n var _colors3 = _colorbrewer2.default[name][9];\n var diff = nbClass - 9;\n return interp_n(_colors3, diff, 9);\n } // else if (nbClass >= 18) {\n var colors = _colorbrewer2.default[name][9];\n colors = interp_n(colors, 8, 9);\n return interp_n(colors, nbClass - colors.length, nbClass);\n};\n\n/**\n* Function to make color interpolation from \"colors\" (an array of n colors)\n* to a larger array of \"k\" colors (using same start and stop than the original)\n*\n* @param {array} colors - An array of colors\n* @param {integer} diff -\n* @param {number} k - The length of the targeted color palette\n* @return {array} - An array of k colors.\n*/\nvar interp_n = exports.interp_n = function interp_n(colors, diff, k) {\n var tmp = [];\n var new_colors = [];\n for (var i = 0; i < diff; ++i) {\n tmp.push(rgb2hex(interpolateColor(hexToRgb(colors[i]), hexToRgb(colors[i + 1]))));\n }\n for (var _i = 0; _i < k; ++_i) {\n new_colors.push(colors[_i]);\n if (tmp[_i]) new_colors.push(tmp[_i]);\n }\n return new_colors;\n};\n\n// Return the interpolated value at \"factor\" (0 2 && arguments[2] !== undefined ? arguments[2] : 0.5;\n\n var result = color1.slice();\n for (var i = 0; i < 3; i++) {\n result[i] = Math.round(result[i] + factor * (color2[i] - color1[i]));\n }\n return result;\n};\n\n// Just a \"Colors\" object with a convenience \"random\" method\n// ... when a random color is needed (they aren't specialy pretty colors though!)\nvar Colors = exports.Colors = {\n names: {\n aqua: '#00ffff',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n black: '#000000',\n blue: '#0000ff',\n brown: '#a52a2a',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgrey: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkviolet: '#9400d3',\n fuchsia: '#ff00ff',\n gold: '#ffd700',\n green: '#008000',\n indigo: '#4b0082',\n khaki: '#f0e68c',\n lightblue: '#add8e6',\n lightcyan: '#e0ffff',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n magenta: '#ff00ff',\n maroon: '#800000',\n navy: '#000080',\n olive: '#808000',\n orange: '#ffa500',\n pink: '#ffc0cb',\n purple: '#800080',\n violet: '#800080',\n red: '#ff0000',\n silver: '#c0c0c0',\n white: '#ffffff',\n yellow: '#ffff00'\n },\n random: function random() {\n var keys = Object.keys(this.names);\n var n = keys.length;\n var result = 0;\n var count = 0;\n for (var i = 0; i < n; i++) {\n var prop = keys[i];\n count += 1;\n if (Math.random() < 1 / count) {\n result = prop;\n }\n }\n return result;\n }\n};\n\nvar ColorsSelected = exports.ColorsSelected = {\n // These colors came from \"Pastel1\" and \"Pastel2\" coloramps from ColorBrewer\n colorCodes: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc', '#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],\n // In order to avoid randomly returning the same color\n // as the last one, at least for the first layers\n seen: new Set(),\n random: function random() {\n var to_rgb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var nb_color = this.colorCodes.length;\n var seen = this.seen;\n var result_color = this.colorCodes[0],\n attempts = 40; // To avoid a while(true) if it went wrong for any reason\n if (seen.size === nb_color) {\n seen = new Set();\n }\n while (attempts > 0) {\n var ix = Math.round(Math.random() * (nb_color - 1));\n result_color = this.colorCodes[ix];\n if (!seen.has(result_color)) {\n seen.add(result_color);\n break;\n } else {\n attempts -= 1;\n }\n }\n return to_rgb ? hexToRgb(result_color) : result_color;\n }\n};\n\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\n// Copy-paste from https://gist.github.com/jdarling/06019d16cb5fd6795edf\n// itself adapted from http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/\nvar randomColor = exports.randomColor = function () {\n var golden_ratio_conjugate = 0.618033988749895;\n var _h = Math.random();\n\n var hslToRgb = function hslToRgb(h, s, l) {\n var r = void 0,\n g = void 0,\n b = void 0;\n\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return '#' + Math.round(r * 255).toString(16) + Math.round(g * 255).toString(16) + Math.round(b * 255).toString(16);\n };\n\n return function () {\n _h += golden_ratio_conjugate;\n _h %= 1;\n return hslToRgb(_h, 0.5, 0.60);\n };\n}();\n\nvar addNewCustomPalette = exports.addNewCustomPalette = function addNewCustomPalette(palette_name, colors) {\n _app.custom_palettes.set(palette_name, colors);\n};\n\n//# sourceURL=webpack:///./js/colors_helpers.js?"); + +/***/ }), + +/***/ "./js/context-menu.js": +/*!****************************!*\ + !*** ./js/context-menu.js ***! + \****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = ContextMenu;\n\n__webpack_require__(/*! ./../css/context-menu.css */ \"./css/context-menu.css\");\n\nfunction ContextMenu() {\n this.items = [];\n\n this.addItem = function addItem(item) {\n this.items.push({\n isSimpleItem: true,\n name: item.name,\n action: item.action\n });\n };\n\n this.addSubMenu = function addSubMenu(item) {\n this.items.push({\n isSimpleItem: false,\n name: item.name,\n menu: new ContextMenu()\n });\n this.items[this.items.length - 1].menu.setItems(item.items);\n };\n\n this.removeItemByName = function removeItemByName(name) {\n for (var i = this.items.length - 1; i > 0; i--) {\n if (this.items[i].name.valueOf() === name.valueOf()) {\n this.items.splice(i, 1);\n break;\n }\n }\n };\n\n this.setItems = function setItems(items) {\n this.items = [];\n for (var i = 0; i < items.length; i++) {\n if (items[i].name) {\n if (items[i].action) {\n this.addItem(items[i]);\n } else if (items[i].items) {\n this.addSubMenu(items[i]);\n }\n }\n }\n };\n\n this.showMenu = function showMenu(event, parent, items) {\n var _this = this;\n\n if (items) {\n this.setItems(items);\n }\n\n if (event.preventDefault) {\n event.preventDefault();\n } else {\n event.returnValue = false; // eslint-disable-line no-param-reassign\n }\n\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n\n this.initMenu(parent);\n var bbox = this.DOMObj.getBoundingClientRect();\n if (event.clientY + window.scrollY + bbox.height < window.innerHeight || event.clientX + bbox.width < window.innerWidth) {\n this.DOMObj.style.top = event.clientY + window.scrollY + 'px';\n this.DOMObj.style.left = event.clientX + 'px';\n } else {\n this.DOMObj.style.top = event.clientY + window.scrollY - bbox.height + 'px';\n this.DOMObj.style.left = event.clientX - bbox.width + 'px';\n }\n\n var hideMenu = function hideMenu() {\n if (_this.DOMObj && _this.DOMObj.parentNode && _this.DOMObj.parentNode.removeChild) {\n _this.DOMObj.parentNode.removeChild(_this.DOMObj);\n }\n _this.onclick = undefined;\n document.removeEventListener('click', hideMenu);\n document.removeEventListener('drag', hideMenu);\n };\n setTimeout(function () {\n document.addEventListener('click', hideMenu);\n document.removeEventListener('drag', hideMenu);\n }, 225);\n };\n\n this.initMenu = function initMenu(parent) {\n if (this.DOMObj && this.DOMObj.parentNode && this.DOMObj.parentNode.removeChild) {\n this.DOMObj.parentNode.removeChild(this.DOMObj);\n }\n var self = this;\n var menu = document.createElement('div');\n menu.className = 'context-menu';\n var list = document.createElement('ul');\n menu.appendChild(list);\n for (var i = 0; i < this.items.length; i++) {\n var item = document.createElement('li');\n list.appendChild(item);\n item.setAttribute('data-index', i);\n var name = document.createElement('span');\n name.className = 'context-menu-item-name';\n name.textContent = this.items[i].name;\n item.appendChild(name);\n if (this.items[i].isSimpleItem) {\n item.onclick = function () {\n var ix = this.getAttribute('data-index');\n self.items[ix].action();\n };\n } else {\n var arrow = document.createElement('span');\n arrow.className = 'arrow';\n arrow.innerHTML = '►';\n name.appendChild(arrow);\n this.items[i].menu.initMenu(item);\n this.items[i].menu.DOMObj.style.display = 'none';\n item.onmouseover = function () {\n var _this2 = this;\n\n setTimeout(function () {\n _this2.querySelectorAll('.context-menu')[0].style.display = '';\n }, 500);\n };\n item.onmouseout = function () {\n var _this3 = this;\n\n setTimeout(function () {\n _this3.querySelectorAll('.context-menu')[0].style.display = 'none';\n }, 500);\n };\n }\n }\n this.DOMObj = menu;\n parent.appendChild(menu);\n };\n}\n\n//# sourceURL=webpack:///./js/context-menu.js?"); + +/***/ }), + +/***/ "./js/dialogs.js": +/*!***********************!*\ + !*** ./js/dialogs.js ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.check_remove_existing_box = check_remove_existing_box;\nexports.make_dialog_container = make_dialog_container;\nexports.reOpenParent = reOpenParent;\nfunction check_remove_existing_box(box_selector) {\n var existing_box = document.querySelector(box_selector);\n if (existing_box) existing_box.remove();\n}\n\nfunction make_dialog_container(id_box, title, class_box) {\n var _id_box = id_box || 'dialog';\n var _title = title || '';\n var _class_box = class_box || 'dialog';\n var container = document.createElement('div');\n container.setAttribute('id', id_box);\n container.setAttribute('class', 'twbs modal fade ' + _class_box);\n container.setAttribute('tabindex', '-1');\n container.setAttribute('role', 'dialog');\n container.setAttribute('aria-labelledby', 'myModalLabel');\n container.setAttribute('aria-hidden', 'true');\n container.innerHTML = '
';\n document.getElementById('twbs').appendChild(container);\n var html_content = '
\\n \\n

' + _title + '

\\n
\\n
\\n
\\n \\n \\n
';\n var modal_box = new Modal(document.getElementById(_id_box), { content: html_content });\n modal_box.show();\n return modal_box;\n}\n\nvar overlay_under_modal = exports.overlay_under_modal = function () {\n var twbs_div = document.querySelector('.twbs');\n var bg = document.createElement('div');\n bg.id = 'overlay_twbs';\n bg.style.width = '100%';\n bg.style.height = '100%';\n bg.style.position = 'fixed';\n bg.style.zIndex = 99;\n bg.style.top = 0;\n bg.style.left = 0;\n bg.style.background = 'rgba(0,0,0,0.4)';\n bg.style.display = 'none';\n twbs_div.insertBefore(bg, twbs_div.childNodes[0]);\n return {\n display: function display() {\n bg.style.display = '';\n },\n hide: function hide() {\n bg.style.display = 'none';\n }\n };\n}();\n\nvar make_confirm_dialog2 = exports.make_confirm_dialog2 = function (class_box, title, options) {\n var get_available_id = function get_available_id() {\n for (var i = 0; i < 50; i++) {\n if (!existing.has(i)) {\n existing.add(i);\n return i;\n }\n }\n };\n var existing = new Set();\n return function (class_box, title, options) {\n class_box = class_box || 'dialog';\n title = title || _tr('app_page.common.ask_confirm');\n options = options || {};\n\n var container = document.createElement('div');\n var new_id = get_available_id();\n\n container.setAttribute('id', 'myModal_' + new_id);\n container.setAttribute('class', 'twbs modal fade ' + class_box);\n container.setAttribute('tabindex', '-1');\n container.setAttribute('role', 'dialog');\n container.setAttribute('aria-labelledby', 'myModalLabel');\n container.setAttribute('aria-hidden', 'true');\n container.innerHTML = options.widthFitContent ? '
' : '
';\n document.getElementById('twbs').appendChild(container);\n\n container = document.getElementById('myModal_' + new_id);\n // const deferred = Promise.pending();\n var text_ok = options.text_ok || _tr('app_page.common.confirm');\n var text_cancel = options.text_cancel || _tr('app_page.common.cancel');\n var html_content = '
\\n \\n

' + title + '

\\n
\\n

' + (options.html_content || '') + '

\\n
\\n \\n \\n
';\n return new Promise(function (resolve, reject) {\n var modal_box = new Modal(container, {\n backdrop: true,\n keyboard: false,\n content: html_content\n });\n modal_box.show();\n container.modal = modal_box;\n overlay_under_modal.display();\n var func_cb = function func_cb(evt) {\n helper_esc_key_twbs_cb(evt, _onclose_false);\n };\n var clean_up_box = function clean_up_box() {\n document.removeEventListener('keydown', func_cb);\n existing.delete(new_id);\n overlay_under_modal.hide();\n container.remove();\n };\n var _onclose_false = function _onclose_false() {\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose_false;\n container.querySelector('#xclose').onclick = _onclose_false;\n container.querySelector('.btn_ok').onclick = function () {\n resolve(true);\n clean_up_box();\n };\n document.addEventListener('keydown', func_cb);\n });\n };\n}();\n\nfunction reOpenParent(css_selector) {\n var parent_style_box = css_selector !== undefined ? document.querySelector(css_selector) : document.querySelector('.styleBox');\n if (parent_style_box && parent_style_box.modal && parent_style_box.modal.show) {\n parent_style_box.modal.show();\n return true;\n }\n return false;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/dialogs.js?"); + +/***/ }), + +/***/ "./js/fonts.js": +/*!*********************!*\ + !*** ./js/fonts.js ***! + \*********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n// Reference to the available fonts that the user could select :\nvar available_fonts = exports.available_fonts = [['Arial', 'Arial,sans-serif'], ['Arial Black', 'Arial Black,sans-serif'], ['Arimo', 'Arimo,sans-serif'], ['Baloo Bhaina', 'Baloo Bhaina,sans-serif'], ['Bitter', 'Bitter,sans-serif'], ['Dosis', 'Dosis,sans-serif'], ['Impact', 'Impact,Charcoal,sans-serif'], ['Inconsolata', 'Inconsolata,sans-serif'], ['Georgia', 'Georgia,serif'], ['Lobster', 'Lobster,serif'], ['Lucida', 'Lucida Sans Unicode,Lucida Grande,sans-serif'], ['Palatino', 'Palatino Linotype,Book Antiqua,Palatino,serif'], ['Roboto', 'Roboto'], ['Scope One', 'Scope One'], ['Tahoma', 'Tahoma,Geneva,sans-serif'], ['Trebuchet MS', 'Trebuchet MS,elvetica,sans-serif'], ['Verdana', 'verdana']];\n\n// This variable have to be (well, we could easily do this in an other way!) up to date\n// with the style-fonts.css file as we are using their order to lookup for their definition\n// the .css file.\nvar custom_fonts = exports.custom_fonts = ['Arimo', 'Baloo Bhaina', 'Bitter', 'Dosis', 'Inconsolata', 'Lobster', 'Roboto', 'Scope One'];\n\n//# sourceURL=webpack:///./js/fonts.js?"); + +/***/ }), + +/***/ "./js/function.js": +/*!************************!*\ + !*** ./js/function.js ***! + \************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.render_label_graticule = exports.render_label = exports.get_menu_option = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.clean_menu_function = clean_menu_function;\nexports.reset_user_values = reset_user_values;\nexports.check_layer_name = check_layer_name;\nexports.make_min_max_tableau = make_min_max_tableau;\nexports.fetch_min_max_table_value = fetch_min_max_table_value;\nexports.render_twostocks_waffle = render_twostocks_waffle;\nexports.make_prop_line = make_prop_line;\nexports.make_prop_symbols = make_prop_symbols;\nexports.render_categorical = render_categorical;\nexports.prepare_categories_array = prepare_categories_array;\n\nvar _contextMenu = __webpack_require__(/*! ./context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _discretization_panel = __webpack_require__(/*! ./classification/discretization_panel */ \"./js/classification/discretization_panel.js\");\n\nvar _categorical_panel = __webpack_require__(/*! ./classification/categorical_panel */ \"./js/classification/categorical_panel.js\");\n\nvar _common = __webpack_require__(/*! ./classification/common */ \"./js/classification/common.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _layers = __webpack_require__(/*! ./layers */ \"./js/layers.js\");\n\nvar _layers_style_popup = __webpack_require__(/*! ./layers_style_popup */ \"./js/layers_style_popup.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _projections = __webpack_require__(/*! ./projections */ \"./js/projections.js\");\n\nvar _symbols_picto = __webpack_require__(/*! ./symbols_picto */ \"./js/symbols_picto.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar section2 = d3.select('#menu').select('#section2');\n\nvar get_menu_option = exports.get_menu_option = function () {\n var menu_option = {\n smooth: {\n name: 'smooth',\n menu_factory: function menu_factory() {\n return fillMenu_Stewart;\n },\n fields_handler: function fields_handler() {\n return fields_Stewart;\n }\n },\n prop: {\n name: 'prop',\n menu_factory: function menu_factory() {\n return fillMenu_PropSymbol;\n },\n fields_handler: function fields_handler() {\n return fields_PropSymbol;\n }\n },\n choroprop: {\n name: 'choroprop',\n menu_factory: function menu_factory() {\n return fillMenu_PropSymbolChoro;\n },\n fields_handler: function fields_handler() {\n return fields_PropSymbolChoro;\n }\n },\n proptypo: {\n name: 'proptypo',\n menu_factory: function menu_factory() {\n return fillMenu_PropSymbolTypo;\n },\n fields_handler: function fields_handler() {\n return fields_PropSymbolTypo;\n }\n },\n choro: {\n name: 'choro',\n menu_factory: function menu_factory() {\n return fillMenu_Choropleth;\n },\n fields_handler: function fields_handler() {\n return fields_Choropleth;\n }\n },\n cartogram: {\n name: 'cartogram',\n menu_factory: function menu_factory() {\n return fillMenu_Anamorphose;\n },\n fields_handler: function fields_handler() {\n return fields_Anamorphose;\n }\n },\n grid: {\n name: 'grid',\n menu_factory: function menu_factory() {\n return fillMenu_griddedMap;\n },\n fields_handler: function fields_handler() {\n return fields_griddedMap;\n }\n },\n flow: {\n name: 'flow',\n menu_factory: function menu_factory() {\n return fillMenu_FlowMap;\n },\n fields_handler: function fields_handler() {\n return fields_FlowMap;\n }\n },\n discont: {\n name: 'discont',\n menu_factory: function menu_factory() {\n return fillMenu_Discont;\n },\n fields_handler: function fields_handler() {\n return fields_Discont;\n }\n },\n typo: {\n name: 'typo',\n menu_factory: function menu_factory() {\n return fillMenu_Typo;\n },\n fields_handler: function fields_handler() {\n return fields_Typo;\n }\n },\n typosymbol: {\n name: 'typosymbol',\n menu_factory: function menu_factory() {\n return fillMenu_TypoSymbol;\n },\n fields_handler: function fields_handler() {\n return fields_TypoSymbol;\n }\n },\n two_stocks: {\n name: 'two_stocks',\n menu_factory: function menu_factory() {\n return fillMenu_TwoStocks;\n },\n fields_handler: function fields_handler() {\n return fields_TwoStocks;\n }\n }\n };\n return function (func) {\n return menu_option[func.toLowerCase()] || {};\n };\n}();\n\n/**\n* Remove the div on which we are displaying the options related to each\n* kind of rendering.\n* @return {void}\n*\n*/\nfunction clean_menu_function() {\n if (fields_handler && fields_handler.unfill) {\n fields_handler.unfill();\n fields_handler = undefined;\n }\n if (_app.current_functionnality && _app.current_functionnality.name) {\n var previous_button = document.getElementById('button_' + _app.current_functionnality.name);\n if (previous_button.style.filter !== 'grayscale(100%)') {\n previous_button.style.filter = 'invert(0%) saturate(100%)';\n }\n previous_button.classList.remove('active');\n _app.current_functionnality = undefined;\n }\n section2.select('.func-options').remove();\n document.getElementById('accordion2b').style.display = 'none';\n var btn_s2b = document.getElementById('btn_s2b');\n btn_s2b.innerHTML = _tr('app_page.section2_.title_no_choice');\n btn_s2b.setAttribute('data-i18n', 'app_page.section2_.title_no_choice');\n btn_s2b.style.display = 'none';\n}\n\n/**\n* Reset the user choosen values remembered for its ease\n* (like discretization choice, symbols, etc. which are redisplayed as they\n* were selected by the user)\n*\n*/\nfunction reset_user_values() {\n fields_TypoSymbol.box_typo = undefined;\n fields_TypoSymbol.rendering_params = {};\n fields_TypoSymbol.cats = {};\n fields_PropSymbolChoro.rendering_params = {};\n fields_Typo.rendering_params = {};\n fields_Choropleth.rendering_params = {};\n fields_PropSymbolTypo.rendering_params = {};\n}\n/**\n* Function to remove each node (each