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C,EAAoB,CAAC,GACvEG,EAAgB3C,EAAuB,YAAawC,EAAoB,CAAC,GAG/E,GAFAC,EAAKG,OAEDN,EAAUjB,OAAS,EAAG,CACxB,IAAMwB,EAAc,WACdP,EAAU,GAAGQ,SACfP,EAAcQ,OACdP,EAAmB7C,KAAK,YAAY,KAEpC4C,EAAcK,OACdJ,EAAmB7C,KAAK,YAAY,GAExC,EACAkD,IACAP,EAAU3D,GAAG,SAAUkE,EACzB,CAEA,GAAIN,EAAclB,OAAS,EAAG,CACxBiB,EAAU,GAAGQ,SACfL,EAAKM,OAGP,IAAMC,EAAOzE,EAAE,sBAAsBY,KAAK,kBAC1C6D,EAAKC,gBAAgB,eAAe,SAACC,GACnC3E,EAAE,eAAD,OAAgBmE,EAAY,OAAMV,IAAIkB,EAAGC,KAC1C5E,EAAE,eAAD,OAAgBoE,EAAa,OAAMX,IAAIkB,EAAGE,IAC7C,IAEA1C,EAAgB8B,EAAoB,MAAM,SAACb,GACzCc,EAAKM,OAELC,EAAKK,eACLL,EAAKM,UAAU,CACbC,SAAU5B,EAAY,GACtB6B,UAAW7B,EAAY,GACvB8B,QAASlB,EAAcP,OAE3B,GACF,CACF,I,giCC3CA0B,EAAAA,MAGAA,EAAAA,MAGAnF,GAAE,WACA,IAC4B,EADyC,IAAtDoF,SAASC,uBAAuB,uBACnB,IAA5B,2BAA8B,CAAd,QACNC,UAAUC,IAAI,sBACxB,CAAC,+BACH,G","sources":["webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/documents/ sync ^\\.\\/.*$","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/images/ sync ^\\.\\/.*$","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/src/decidim/enhanced_textwork/toggle_element.js","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/src/decidim/enhanced_textwork/utils.js","webpack://decidim-application/webpack/bootstrap","webpack://decidim-application/webpack/runtime/hasOwnProperty shorthand","webpack://decidim-application/webpack/runtime/publicPath","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-2f3c73fe30cf/decidim-core/app/packs/src/decidim/geocoding/coordinate_input.js","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-2f3c73fe30cf/decidim-core/app/packs/src/decidim/geocoding/attach_input.js","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/src/decidim/enhanced_textwork/add_paragraph.js","webpack://decidim-application/../layers/heroku_ruby/gems/ruby/3.0.0/bundler/gems/decidim-enhanced_textwork-315989c95e6b/app/packs/entrypoints/decidim_enhanced_textwork.js"],"sourcesContent":["var map = {\n\t\"./decidim/enhanced_textwork/participatory_texts/participatory_text.md\": 43029,\n\t\"./decidim/enhanced_textwork/participatory_texts/participatory_text.odt\": 29178\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 = 4665;","var map = {\n\t\"./decidim/enhanced_textwork/decidim_paragraphs.svg\": 10319,\n\t\"./decidim/gamification/badges/decidim_gamification_badges_accepted_paragraphs.svg\": 22293,\n\t\"./decidim/gamification/badges/decidim_gamification_badges_paragraph_votes.svg\": 7694,\n\t\"./decidim/gamification/badges/decidim_gamification_badges_paragraphs.svg\": 11882\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 = 2771;","$(() => {\n const $showButton = $(\"[data-toggle='show']\")\n const $hideButton = $(\"[data-toggle='hide']\")\n const $toggleElements = $(\".toggle--hidden:not(button)\")\n\n $showButton.on(\"click\", (e) => {\n e.preventDefault()\n $toggleElements.removeClass(\"toggle--hidden\")\n\n $hideButton.removeClass(\"toggle--hidden\")\n $(e.target).addClass(\"toggle--hidden\")\n })\n\n $hideButton.on(\"click\", (e) => {\n e.preventDefault()\n $toggleElements.addClass(\"toggle--hidden\")\n\n $showButton.removeClass(\"toggle--hidden\")\n $(e.target).addClass(\"toggle--hidden\")\n })\n});\n","/* 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","// 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 if (typeof callback === \"function\") {\n callback(coordinates);\n return;\n }\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 const latFieldName = getCoordinateInputName(\"latitude\", $addressInputField, {})\n const longFieldName = getCoordinateInputName(\"longitude\", $addressInputField, {})\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/enhanced_textwork/utils\"\nimport \"src/decidim/enhanced_textwork/add_paragraph\"\nimport \"src/decidim/enhanced_textwork/toggle_element.js\"\n\n// Images\nrequire.context(\"../images\", true)\n\n// Documents\nrequire.context(\"../documents\", true)\n\n// Add proposals-overview class to elements with the class \"off-canvas-wrapper\"\n$(() => {\n var elements = document.getElementsByClassName(\"off-canvas-wrapper\");\n for (let element of elements) {\n element.classList.add(\"paragraphs-overview\");\n }\n});\n"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","$","$showButton","$hideButton","$toggleElements","on","preventDefault","removeClass","target","addClass","mouseover","this","text","data","mouseout","__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","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","document","getElementsByClassName","classList","add"],"sourceRoot":""}