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C,eCPAV,EAAoB,EAAI,SAASW,EAAKC,EAAM,CAAE,OAAO,OAAO,UAAU,eAAe,KAAKD,EAAKC,CAAI,CAAG,C,eCAtGZ,EAAoB,EAAI,iB,4FCKxBa,EAAAA,KAAAA,C","sources":["webpack://metadecidim/./vendor/bundle/ruby/3.2.0/gems/decidim-budgets-0.29.2/app/packs/src/decidim/budgets/exit_handler.js","webpack://metadecidim/./vendor/bundle/ruby/3.2.0/gems/decidim-budgets-0.29.2/app/packs/src/decidim/budgets/progressFixed.js","webpack://metadecidim/./vendor/bundle/ruby/3.2.0/gems/decidim-budgets-0.29.2/app/packs/src/decidim/budgets/projects.js","webpack://metadecidim/./vendor/bundle/ruby/3.2.0/gems/decidim-budgets-0.29.2/app/packs/images/ sync ^\\.\\/.*$","webpack://metadecidim/webpack/bootstrap","webpack://metadecidim/webpack/runtime/compat get default export","webpack://metadecidim/webpack/runtime/define property getters","webpack://metadecidim/webpack/runtime/hasOwnProperty shorthand","webpack://metadecidim/webpack/runtime/publicPath","webpack://metadecidim/./vendor/bundle/ruby/3.2.0/gems/decidim-budgets-0.29.2/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.text(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\": 63277\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 = 26870;","// 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":["currentAllocationZero","$budgetSummary","$","parseInt","attr","isSafeUrl","exitUrl","safeUrls","replace","location","origin","pathname","href","safe","forEach","url","startsWith","allowExitFrom","$el","parents","length","document","querySelector","contains","$exitNotification","$exitLink","defaultExitUrl","defaultExitLinkText","text","signOutPath","window","Decidim","config","get","exitLinkText","openExitNotification","method","removeAttr","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__","e","module","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","getter","exports","definition","key","obj","prop","require"],"sourceRoot":""}