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,SACfL,EAAKM,OAGP,IAAMC,EAAOjF,EAAE,sBAAsBI,KAAK,kBAC1C6E,EAAKC,gBAAgB,eAAe,SAACC,GACnCnF,EAAE,eAAD,OAAgB2E,EAAhB,OAAkCX,IAAImB,EAAGC,KAC1CpF,EAAE,eAAD,OAAgB4E,EAAhB,OAAmCZ,IAAImB,EAAGE,IAF7C,IAKA3C,EAAgB+B,EAAoB,MAAM,SAACd,GACzCe,EAAKM,OAELC,EAAKK,eACLL,EAAKM,UAAU,CACbC,SAAU7B,EAAY,GACtB8B,UAAW9B,EAAY,GACvB+B,QAASlB,EAAcR,OAPZ,GAUhB,CAlDF,ICCD2B,EAAAA,OAGAA,EAAAA,M","sources":["webpack://app/../usr/local/bundle/gems/decidim-proposals-0.27.4/app/packs/src/decidim/proposals/utils.js","webpack://app/../usr/local/bundle/gems/decidim-proposals-0.27.4/app/packs/documents/ sync ^\\.\\/.*$","webpack://app/../usr/local/bundle/gems/decidim-proposals-0.27.4/app/packs/images/ sync ^\\.\\/.*$","webpack://app/webpack/bootstrap","webpack://app/webpack/runtime/hasOwnProperty shorthand","webpack://app/webpack/runtime/publicPath","webpack://app/../usr/local/bundle/gems/decidim-core-0.27.4/app/packs/src/decidim/geocoding/coordinate_input.js","webpack://app/../usr/local/bundle/gems/decidim-core-0.27.4/app/packs/src/decidim/geocoding/attach_input.js","webpack://app/../usr/local/bundle/gems/decidim-proposals-0.27.4/app/packs/src/decidim/proposals/add_proposal.js","webpack://app/../usr/local/bundle/gems/decidim-proposals-0.27.4/app/packs/entrypoints/decidim_proposals.js"],"sourcesContent":["/* eslint-disable no-invalid-this */\n\n$(() => {\n $(\"#vote_button\").mouseover(function () {\n $(this).text($(this).data(\"replace\"));\n });\n\n $(\"#vote_button\").mouseout(function () {\n $(this).text($(this).data(\"original\"));\n });\n});\n","var map = {\n\t\"./decidim/proposals/participatory_texts/participatory_text.md\": 48412,\n\t\"./decidim/proposals/participatory_texts/participatory_text.odt\": 91553\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 13198;","var map = {\n\t\"./decidim/gamification/badges/decidim_gamification_badges_accepted_proposals.svg\": 47449,\n\t\"./decidim/gamification/badges/decidim_gamification_badges_proposal_votes.svg\": 54611,\n\t\"./decidim/gamification/badges/decidim_gamification_badges_proposals.svg\": 51405,\n\t\"./decidim/proposals/decidim_proposals.svg\": 33406\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 13548;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","__webpack_require__.p = \"/decidim-packs/\";","/**\n * Get coordinate input name from a given $input\n * @param {string} coordinate - Allows to find 'latitude' or 'longitude' field.\n * @param {jQuery} $input - Address input field\n * @param {Object} options (optional) - Extra options\n * @returns {string} - Returns input name\n */\nexport default function getCoordinateInputName(coordinate, $input, options) {\n const key = `${coordinate}Name`;\n if (options[key]) {\n return options[key];\n }\n\n const inputName = $input.attr(\"name\");\n const subNameMatch = /\\[[^\\]]+\\]$/;\n if (inputName.match(subNameMatch)) {\n return inputName.replace(subNameMatch, `[${coordinate}]`);\n }\n\n return coordinate;\n}\n","/* eslint-disable require-jsdoc */\nimport getCoordinateInputName from \"./coordinate_input\"\n\n/**\n * You can use this method to \"attach\" front-end geocoding to any forms in the\n * front-end which have address fields with geocoding autocompletion\n * functionality already applied to them.\n *\n * To learn more about the front-end geocoding autocompletion, please refer to\n * the maps documentation at: /docs/customization/maps.md.\n *\n * When the geocoding autocompletion finishes, most of the times, its results\n * will also contain the geocoordinate information for the selected address.\n * This method allows you to pass these coordinates (latitude and longitude)\n * to the same front-end form where the geocoding autocompletion address field\n * is located at (which is the $input you pass to this method). The latitude\n * and longitude coordinates will be added or \"attached\" to the form once the\n * user selects one of the suggested addresses.\n *\n * Therefore, if there was the following geocoding autocompletion field at\n * your form:\n * \n *\n * You would then \"attach\" the geocoding result coordinates to the same form\n * where this input is at as follows:\n * $(document).ready(function() {\n * window.Decidim.attachGeocoding($(\"#record_address\"));\n * });\n *\n * Now, after the user selects one of the suggested geocoding autocompletion\n * addresses and the geocoding autocompletion API provides the coordinates in\n * the results, you would have the following fields automatically generated\n * to your form:\n * \n * \n * \n *\n * If you would not do the attachment, these hidden longitude and latitude\n * fields would not be generated and the geocoding would have to happen at the\n * server-side when the form is submitted. The problem with that approach\n * would be that the server-side address geocoding could potentially result in\n * different coordinates than what the user actually selected in the front-end\n * because the autocompletion API can return different coordinates than the\n * geocoding API. Another reason is to avoid unnecessary calls to the\n * geocoding API as the front-end geocoding suggestion already returned the\n * coordinate values we need.\n *\n * @param {jQuery} $input The input jQuery element for the geocoded address\n * field.\n * @param {Object} options (optional) Extra options if you want to customize\n * the latitude and longitude element IDs or names from the default.\n * @param {function} callback (optional) Callback to run when updating the coordinates values\n * @returns {void}\n */\n\nexport default function attachGeocoding($input, options, callback) {\n const attachOptions = $.extend({}, options);\n const inputIdParts = $input.attr(\"id\").split(\"_\");\n inputIdParts.pop();\n\n const idPrefix = `${inputIdParts.join(\"_\")}`;\n\n let latitudeName = \"latitude\";\n let longitudeName = \"longitude\";\n\n if ($input.length > 0) {\n latitudeName = getCoordinateInputName(\"latitude\", $input, attachOptions);\n longitudeName = getCoordinateInputName(\"longitude\", $input, attachOptions);\n }\n\n const config = $.extend({\n latitudeId: `${idPrefix}_latitude`,\n longitudeId: `${idPrefix}_longitude`,\n latitudeName: latitudeName,\n longitudeName: longitudeName\n }, options);\n let geocoded = false;\n\n const createCoordinateFields = () => {\n let $latitude = $(`#${config.latitudeId}`);\n if ($latitude.length < 1) {\n $latitude = $(``);\n $input.after($latitude);\n }\n\n let $longitude = $(`#${config.longitudeId}`);\n if ($longitude.length < 1) {\n $longitude = $(``);\n $input.after($longitude);\n }\n }\n const clearCoordinateFields = () => {\n if (geocoded) {\n return;\n }\n\n $(`#${config.latitudeId}`).val(\"\").removeAttr(\"value\");\n $(`#${config.longitudeId}`).val(\"\").removeAttr(\"value\");\n };\n const setCoordinates = (coordinates) => {\n createCoordinateFields();\n\n $(`#${config.latitudeId}`).val(coordinates[0]).attr(\"value\", coordinates[0]);\n $(`#${config.longitudeId}`).val(coordinates[1]).attr(\"value\", coordinates[1]);\n }\n\n // When the user changes the value of the coordinate field without selecting\n // any of the geocoding autocomplete results, clear the current latitude and\n // longitude values to let the backend do the geocoding. Once a geocoding\n // autocomplete value has been selected, assume the user just wants to\n // refine the address formatting without changing the location point value.\n // If they want, they can still modify the point in the next step of the\n // proposal creation/editing.\n $input.on(\"change.decidim\", () => {\n clearCoordinateFields();\n });\n\n // When we receive the geocoding event on the field, update the coordinate\n // values.\n $input.on(\"geocoder-suggest-coordinates.decidim\", (_ev, coordinates) => {\n setCoordinates(coordinates);\n geocoded = true;\n callback(coordinates)\n });\n\n // Set the initial values if the field defines the coordinates\n const coordinates = `${$input.data(\"coordinates\")}`.split(\",\").map(parseFloat);\n if (Array.isArray(coordinates) && coordinates.length === 2) {\n setCoordinates(coordinates);\n }\n}\n","import attachGeocoding from \"src/decidim/geocoding/attach_input\"\nimport getCoordinateInputName from \"src/decidim/geocoding/coordinate_input\";\n\n$(() => {\n const $checkbox = $(\"input:checkbox[name$='[has_address]']\");\n const $addressInput = $(\"#address_input\");\n const $addressInputField = $(\"input\", $addressInput);\n const $map = $(\"#address_map\");\n let latFieldName = \"latitude\";\n let longFieldName = \"longitude\";\n\n if ($addressInputField.length > 0) {\n latFieldName = getCoordinateInputName(\"latitude\", $addressInputField, {})\n longFieldName = getCoordinateInputName(\"longitude\", $addressInputField, {})\n }\n\n $map.hide();\n\n if ($checkbox.length > 0) {\n const toggleInput = () => {\n if ($checkbox[0].checked) {\n $addressInput.show();\n $addressInputField.prop(\"disabled\", false);\n } else {\n $addressInput.hide();\n $addressInputField.prop(\"disabled\", true);\n }\n }\n toggleInput();\n $checkbox.on(\"change\", toggleInput);\n }\n\n if ($addressInput.length > 0) {\n if ($checkbox[0].checked) {\n $map.show();\n }\n\n const ctrl = $(\"[data-decidim-map]\").data(\"map-controller\");\n ctrl.setEventHandler(\"coordinates\", (ev) => {\n $(`input[name='${latFieldName}']`).val(ev.lat);\n $(`input[name='${longFieldName}']`).val(ev.lng);\n });\n\n attachGeocoding($addressInputField, null, (coordinates) => {\n $map.show();\n // Remove previous marker when user updates address in address field\n ctrl.removeMarker();\n ctrl.addMarker({\n latitude: coordinates[0],\n longitude: coordinates[1],\n address: $addressInput.val()\n });\n });\n }\n});\n","import \"src/decidim/proposals/utils\"\nimport \"src/decidim/proposals/add_proposal\"\n\n// Images\nrequire.context(\"../images\", true)\n\n// Documents\nrequire.context(\"../documents\", true)\n"],"names":["$","mouseover","this","text","data","mouseout","map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","__webpack_module_cache__","moduleId","cachedModule","undefined","__webpack_modules__","obj","prop","prototype","hasOwnProperty","call","p","getCoordinateInputName","coordinate","$input","options","key","inputName","attr","subNameMatch","match","replace","attachGeocoding","callback","attachOptions","extend","inputIdParts","split","pop","idPrefix","join","latitudeName","longitudeName","length","config","latitudeId","longitudeId","geocoded","setCoordinates","coordinates","$latitude","after","$longitude","createCoordinateFields","val","on","removeAttr","_ev","parseFloat","Array","isArray","$checkbox","$addressInput","$addressInputField","$map","latFieldName","longFieldName","hide","toggleInput","checked","show","ctrl","setEventHandler","ev","lat","lng","removeMarker","addMarker","latitude","longitude","address","require"],"sourceRoot":""}