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AC,GAOX,OAHAI,EAAoBF,GAAUH,EAAQA,EAAOC,QAAST,GAG/CQ,EAAOC,OACf,CCrBAT,EAAoBc,EAAI,SAASN,GAChC,IAAIO,EAASP,GAAUA,EAAOQ,WAC7B,WAAa,OAAOR,EAAgB,OAAG,EACvC,WAAa,OAAOA,CAAQ,EAE7B,OADAR,EAAoBiB,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CACR,ECNAf,EAAoBiB,EAAI,SAASR,EAASU,GACzC,IAAI,IAAIC,KAAOD,EACXnB,EAAoBC,EAAEkB,EAAYC,KAASpB,EAAoBC,EAAEQ,EAASW,IAC5Ed,OAAOe,eAAeZ,EAASW,EAAK,CAAEE,YAAY,EAAMzE,IAAKsE,EAAWC,IAG3E,ECPApB,EAAoBC,EAAI,SAASsB,EAAKC,GAAQ,OAAOlB,OAAOmB,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,ECAtGxB,EAAoB4B,EAAI,kB,mDCKxBC,EAAAA,M","sources":["webpack://decidim-application/../usr/local/bundle/gems/decidim-budgets-0.28.0/app/packs/src/decidim/budgets/exit_handler.js","webpack://decidim-application/../usr/local/bundle/gems/decidim-budgets-0.28.0/app/packs/src/decidim/budgets/progressFixed.js","webpack://decidim-application/../usr/local/bundle/gems/decidim-budgets-0.28.0/app/packs/src/decidim/budgets/projects.js","webpack://decidim-application/../usr/local/bundle/gems/decidim-budgets-0.28.0/app/packs/images/ sync ^\\.\\/.*$","webpack://decidim-application/webpack/bootstrap","webpack://decidim-application/webpack/runtime/compat get default export","webpack://decidim-application/webpack/runtime/define property getters","webpack://decidim-application/webpack/runtime/hasOwnProperty shorthand","webpack://decidim-application/webpack/runtime/publicPath","webpack://decidim-application/../usr/local/bundle/gems/decidim-budgets-0.28.0/app/packs/entrypoints/decidim_budgets.js"],"sourcesContent":["const currentAllocationZero = () => {\n const $budgetSummary = $(\".budget-summary__progressbox\");\n return parseInt($budgetSummary.attr(\"data-current-allocation\"), 10) === 0;\n}\n\nconst isSafeUrl = (exitUrl) => {\n if (!exitUrl) {\n return false\n }\n\n const safeUrls = [\n $(\".budget-summary\").attr(\"data-safe-url\").replace(location.origin, \"\"),\n `${location.pathname}#`,\n `${location.href}#`,\n \"#\"\n ];\n\n let safe = false;\n safeUrls.forEach((url) => {\n if (exitUrl.startsWith(url)) {\n safe = true\n }\n });\n\n return safe;\n}\n\nconst allowExitFrom = ($el) => {\n if (currentAllocationZero()) {\n return true\n } else if ($el.attr(\"target\") === \"_blank\") {\n return true;\n } else if ($el.parents(\"#loginModal\").length > 0) {\n return true;\n } else if ($el.parents(\"#authorizationModal\").length > 0) {\n return true;\n } else if ($el.attr(\"id\") === \"exit-notification-link\") {\n return true;\n } else if ($el.parents(\"main\").length > 0) {\n return true;\n } else if (isSafeUrl($el.attr(\"href\"))) {\n return true\n } else if (document.querySelector(\".panel-container\") && document.querySelector(\".panel-container\").contains($el[0])) {\n return true\n }\n\n return false;\n}\n\n$(() => {\n const $exitNotification = $(\"#exit-notification\");\n const $exitLink = $(\"#exit-notification-link\");\n const defaultExitUrl = $exitLink.attr(\"href\");\n const defaultExitLinkText = $exitLink.text();\n const signOutPath = window.Decidim.config.get(\"sign_out_path\");\n let exitLinkText = defaultExitLinkText;\n\n if ($exitNotification.length < 1) {\n // Do not apply when not inside the voting pipeline\n return;\n }\n\n const openExitNotification = (url, method = null) => {\n if (method && method !== \"get\") {\n $exitLink.attr(\"data-method\", method);\n } else {\n $exitLink.removeAttr(\"data-method\");\n }\n\n $exitLink.attr(\"href\", url);\n $exitLink.html(exitLinkText);\n window.Decidim.currentDialogs[\"exit-notification\"].open();\n };\n\n $(document).on(\"click\", \"a\", (event) => {\n exitLinkText = defaultExitLinkText;\n\n const $link = $(event.currentTarget);\n if (!allowExitFrom($link)) {\n event.preventDefault();\n openExitNotification($link.attr(\"href\"), $link.data(\"method\"));\n }\n });\n // Custom handling for the header sign out so that it will not trigger the\n // logout form submit and so that it changes the exit link text. This does\n // not trigger the document link click listener because it has the\n // data-method attribute to trigger a form submit event.\n $(`[href='${signOutPath}']`).on(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n const $link = $(event.currentTarget);\n exitLinkText = $link.text();\n openExitNotification($link.attr(\"href\"), $link.data(\"method\"));\n });\n // Custom handling for the exit link which needs to change the exit link\n // text to the default text as this is not handled by the document click\n // listener.\n $(\"a[data-dialog-open='exit-notification']\").on(\"click\", () => {\n exitLinkText = defaultExitLinkText;\n openExitNotification(defaultExitUrl);\n });\n});\n","$(() => {\n const checkProgressPosition = () => {\n\n const progressRef = document.querySelectorAll(\"[data-progress-reference]\");\n if (progressRef.length) {\n const progressFix = document.querySelectorAll(\"[data-progressbox-fixed]\");\n\n let selectedProgressRef = \"\";\n let selectedProgressFix = \"\";\n const progressVisibleClass = \"is-progressbox-visible\";\n\n if (window.matchMedia(\"(min-width: 768px)\").matches) {\n selectedProgressRef = progressRef[1];\n selectedProgressFix = progressFix[1];\n } else {\n selectedProgressRef = progressRef[0];\n selectedProgressFix = progressFix[0];\n }\n\n if (!progressRef) {\n return;\n }\n\n let progressPosition = selectedProgressRef.getBoundingClientRect().bottom;\n if (progressPosition > 0) {\n selectedProgressFix.classList.remove(progressVisibleClass);\n } else {\n selectedProgressFix.classList.add(progressVisibleClass);\n }\n }\n }\n\n window.addEventListener(\"scroll\", checkProgressPosition);\n\n window.DecidimBudgets = window.DecidimBudgets || {};\n window.DecidimBudgets.checkProgressPosition = checkProgressPosition;\n});\n","$(() => {\n const $projects = $(\"#projects, #project-item\");\n const $budgetSummaryTotal = $(\".budget-summary__progressbar-marks_right\");\n const selectBudgetSummaryTotal = $budgetSummaryTotal.data(\"totalAllocation\");\n const $budgetSummary = $(\".budget-summary__progressbox\");\n const $voteButton = $(\".budget-vote-button\");\n const totalAllocation = parseInt(selectBudgetSummaryTotal, 10);\n const additionSelectorButtons = document.querySelectorAll(\".budget__list--header .button__pill\")\n\n const cancelEvent = (event) => {\n event.stopPropagation();\n event.preventDefault();\n };\n\n $voteButton.on(\"click\", \"span\", () => {\n $(\".budget-list__action\").click();\n });\n\n $projects.on(\"click\", \".budget-list__action\", (event) => {\n const currentAllocation = parseInt($budgetSummary.attr(\"data-current-allocation\"), 10);\n const $currentTarget = $(event.currentTarget);\n const projectAllocation = parseInt($currentTarget.attr(\"data-allocation\"), 10);\n\n if ($currentTarget.attr(\"disabled\")) {\n cancelEvent(event);\n } else if (($currentTarget.attr(\"data-add\") === \"true\") && ((currentAllocation + projectAllocation) > totalAllocation)) {\n window.Decidim.currentDialogs[\"budget-excess\"].toggle()\n cancelEvent(event);\n }\n });\n\n additionSelectorButtons.forEach(function(button) {\n button.addEventListener(\"click\", function(event) {\n additionSelectorButtons.forEach(function(element) {\n element.classList.remove(\"button__pill--active\")\n })\n event.currentTarget.classList.add(\"button__pill--active\")\n })\n });\n});\n","var map = {\n\t\"./decidim/budgets/decidim_budgets.svg\": 20393\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 = 14960;","// 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","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","__webpack_require__.p = \"/decidim-packs/\";","import \"src/decidim/budgets/projects\"\nimport \"src/decidim/budgets/progressFixed\"\nimport \"src/decidim/budgets/exit_handler\"\n\n// Images\nrequire.context(\"../images\", true)\n\nimport \"stylesheets/budgets.scss\"\n"],"names":["allowExitFrom","$el","$budgetSummary","$","parseInt","attr","parents","length","exitUrl","safeUrls","replace","location","origin","concat","pathname","href","safe","forEach","url","startsWith","isSafeUrl","document","querySelector","contains","$exitNotification","$exitLink","defaultExitUrl","defaultExitLinkText","text","signOutPath","window","Decidim","config","get","exitLinkText","openExitNotification","method","arguments","undefined","removeAttr","html","currentDialogs","open","on","event","$link","currentTarget","preventDefault","data","stopPropagation","checkProgressPosition","progressRef","querySelectorAll","progressFix","selectedProgressRef","selectedProgressFix","progressVisibleClass","matchMedia","matches","getBoundingClientRect","bottom","classList","remove","add","addEventListener","DecidimBudgets","$projects","selectBudgetSummaryTotal","$voteButton","totalAllocation","additionSelectorButtons","cancelEvent","click","currentAllocation","$currentTarget","projectAllocation","toggle","button","element","map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","key","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","call","p","require"],"sourceRoot":""}