{"version":3,"file":"jobs-_rZD99-u.js","sources":["../../../app/frontend/entrypoints/pages/jobs/jobs.js"],"sourcesContent":["import Loader from \"@/javascript/components/loader\"\nimport selectize from \"@/javascript/components/selects\"\n\nconst applicationsReadMoreOnNotesOverflow = (content) => {\n content.querySelectorAll('.job-applications .js-application-note').forEach((elem) => {\n if(elem.classList.contains('open')) {\n return\n }\n\n const contentElem = elem.querySelector('.js-content')\n const readMoreElem = elem.querySelector('.js-read-more')\n\n if(!contentElem || !readMoreElem) {\n return\n }\n\n if(contentElem.offsetWidth < contentElem.scrollWidth) {\n readMoreElem.classList.remove('hidden')\n } else {\n readMoreElem.classList.add('hidden')\n }\n })\n}\n\nwindow.addEventListener('optimizedResize', () => {\n applicationsReadMoreOnNotesOverflow(document)\n readMoreTogglers(document);\n})\n\nLoader.visual((content, resolve) => {\n readMoreTogglers(content);\n resolve();\n})\n\nLoader.functional((content, resolve) => {\n bindMyJobFilters(content)\n bindOpenJobsFilters(content)\n bindPositionType(content)\n bindTopMatchesBtnCount(content)\n applicationsReadMoreOnNotesOverflow(content)\n\n content.querySelectorAll('.actions-dropdown .state-actions a.active').forEach((activeState) => {\n activeState.addEventListener('click', (e) => e.preventDefault())\n })\n\n resolve()\n})\n\nconst bindMyJobFilters = (content) => {\n const jobFilterForm = content.querySelector('#job-filter-form')\n if(!jobFilterForm || jobFilterForm.filtersBound) {\n return\n }\n\n jobFilterForm.filtersBound = true\n jobFilterForm.addEventListener('submit', (e) => {\n e.target.setAttribute('action', window.location.pathname)\n })\n}\n\nconst bindTopMatchesBtnCount = (content) => {\n const topMatchesTotal = content.querySelector('.top-matches-results-container .top-matches-total')\n if(!topMatchesTotal || !topMatchesTotal.dataset.count) {\n return\n }\n\n const toggleShowMatches = document.querySelectorAll('a.top-matches-show-hide')\n toggleShowMatches.forEach((btn) => {\n btn.dataset.count = topMatchesTotal.dataset.count\n })\n\n const MatchesSummary = document.querySelector('.js-member-matches-summary')\n const MatchesSummaryHeading = document.querySelector('.js-member-matches-summary-heading')\n if(!MatchesSummaryHeading && !MatchesSummary) {\n return\n }\n\n MatchesSummary.dataset.count = topMatchesTotal.dataset.count\n MatchesSummaryHeading.innerHTML = MatchesSummaryHeading.innerHTML.replace('0', topMatchesTotal.dataset.count)\n\n // TODO: Replace this close button binding by also making the close button a toggle\n const closeMatches = document.querySelector('.top-matches-results-container .close-button'\n )\n if(!closeMatches && !closeMatches.clickBound) {\n return\n }\n\n closeMatches.clickBound = true\n closeMatches.addEventListener('click', () => {\n document.querySelector('a.top-matches-show-hide').click()\n })\n}\n\nconst bindOpenJobsFilters = (content) => {\n const jobFilterSelect = content.querySelector('select#job_category_ids')\n if(!jobFilterSelect || jobFilterSelect.selectize) {\n return\n }\n\n selectize(jobFilterSelect,{\n render: {\n option: function(data, escape) {\n let result = '