1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ 2(function(Drupal,$,once){'use strict';Drupal.behaviors.iaapaExposedFilters={attach:function(context,settings){const $exposedFilters=$(once('iaapa-exposed-filters','.iaapa-exposed-filters',context));$exposedFilters.each((_,el)=>{initFilters($(el));});function initFilters($exposed){const $toggleFilters=$exposed.find('.iaapa-exposed-filters__toggle');const $removeAll=$exposed.find('.iaapa-exposed-filters__results__clear, .iaapa-exposed-filters__reset > a');const $details=$exposed.find('details');const urlParams=new URLSearchParams(window.location.search);const $checkboxes=$exposed.find('input[type="checkbox"]');for(const [key,value] of urlParams.entries()){if(!key.endsWith('[]'))continue;const name=`${key.slice(0,-2)}[${value}]`;$checkboxes.each((_,box)=>{if(box.name===name&&box.value===value)box.checked=true;});}if(urlParams.has('update')&&!window.__iaapaUrlHadUpdate){const initialHash=window.location.hash;window.__iaapaUrlHadUpdate=true;window.history.replaceState({},document.title,window.location.pathname+(initialHash||''));$exposed.find('.form-submit').trigger('click');}initSimpleSelectDropdown($exposed);initMultiSelectDropdown($exposed);initDetailsDateFilter($exposed);showInitialResults($exposed);updateToggleFiltersBadge($exposed);$toggleFilters.off().on('click',function(e){e.preventDefault();const $filters=$(this).parents('.iaapa-exposed-filters');$filters.toggleClass('is-open');});$removeAll.off().on('click',function(e){e.preventDefault();$exposed.find('.form-checkbox').prop('checked',false);$exposed.find('input[type="date"]').val('');$exposed.find('input[type="text"]').val('');$exposed.find('.reset-triggered').val(1);stripStaleUrlFilters();$exposed.find('.form-submit').not('[name="reset"]').trigger('click');});$exposed.find('input, select').on('change',stripStaleUrlFilters);$details.attr('open',false);$(document).on('click',(ev)=>{if(!$details.is(ev.target)&&$details.has(ev.target).length===0)$details.attr('open',false);});}function initDetailsDateFilter($exposed){const $dateWrapper=$exposed.find('[id^="edit-created-collapsible');const $dateBadge=$dateWrapper.find('.summary');const $filtersResultsList=$exposed.find('.iaapa-exposed-filters__results__selected-list');const $dateRangeMax=$dateWrapper.find('.form-item-created-max input');const $dateRangeMin=$dateWrapper.find('.form-item-created-min input');const minVal=$dateRangeMin.val();const maxVal=$dateRangeMax.val();const label=$dateWrapper.find('.fieldset-legend').text();let filterNameAux='';let dateLabel=Drupal.t('Date');if(label.length)dateLabel=label.split(' ')[0];if(minVal)filterNameAux=`<span>${minVal}</span>`;if(maxVal)filterNameAux=`${filterNameAux}<span>${maxVal}</span>`;if(minVal||maxVal){createFilterPill({filterLabel:dateLabel,filterName:filterNameAux,$fields:[$dateRangeMin,$dateRangeMax],$filtersResultsList});updateLabelDates({elems:[$dateRangeMin,$dateRangeMax],$dateBadge});}}function initMultiSelectDropdown($exposed){const $multiSelectDropdown=$exposed.find('.multiselect-dropdown');const $filtersResultsList=$exposed.find('.iaapa-exposed-filters__results__selected-list');$multiSelectDropdown.each((_,el)=>{const $el=$(el);const $multiSelectCheckboxes=$el.find('.form-checkbox');createFilterPillMultiSelect({$multiSelectDropdown:$el,$filtersResultsList});$multiSelectCheckboxes.on('change',()=>{updateLabelsCheckboxes($el);});updateLabelsCheckboxes($el);});}function createFilterPill({filterLabel,filterName,$fields,$filtersResultsList}){const $filterPill=$(`<div class="iaapa-exposed-filters__filter-pill-clear${filterLabel?` iaapa-exposed-filters__filter-pill-clear--${filterLabel.toLowerCase().trim()}`:''}"> 3 ${filterLabel?`<b>${filterLabel}</b>`:''} ${filterName} <a class="remove-filter" aria-label="${Drupal.t('Clear filter')}"></a> 4 </div>`);$filterPill.children('.remove-filter').off().on('click',function(){if($fields.length===1){const $field=$($fields[0]);if($field.attr('type')==='checkbox'){$field.prop('checked',false).trigger('change');$(this).closest('.filter-pill').remove();}}if($fields.length===2){const $field1=$($fields[0]);const $field2=$($fields[1]);if($field1.attr('type')==='date'){$field1.val('').trigger('change');$field2.val('').trigger('change');$(this).closest('.filter-pill').remove();}}removeAjaxThrobber();});$filtersResultsList.append($filterPill);removeAjaxThrobber();}function createFilterPillSelect({filterLabel,filterName,$fields,$filtersResultsList}){const $filterPill=$(`<div class="iaapa-exposed-filters__filter-pill-clear${filterLabel?` iaapa-exposed-filters__filter-pill-clear--${filterLabel.toLowerCase().trim()}`:''}"> 5 ${filterLabel?`<b>${filterLabel}</b>`:''} ${filterName} </div>`);$filterPill.children('.remove-filter').off().on('click',function(){if($fields.length===1){const $field=$($fields[0]);
5if($field.attr('type')==='checkbox'){$field.prop('checked',false).trigger('change');$(this).closest('.filter-pill').remove();}}if($fields.length===2){const $field1=$($fields[0]);const $field2=$($fields[1]);if($field1.attr('type')==='date'){$field1.val('').trigger('change');$field2.val('').trigger('change');$(this).closest('.filter-pill').remove();}}removeAjaxThrobber();});$filtersResultsList.append($filterPill);}function stripStaleUrlFilters(){if(window.location.search)window.history.replaceState({},document.title,window.location.pathname+window.location.hash);const cleanUrl=(url)=>url.split('?')[0]+(url.indexOf('_wrapper_format=drupal_ajax')!==-1?'?_wrapper_format=drupal_ajax':'');const instances=(Drupal.views&&Drupal.views.instances)||{};Object.keys(instances).forEach((key)=>{const instance=instances[key];if(instance.element_settings&&instance.element_settings.url)instance.element_settings.url=cleanUrl(instance.element_settings.url);});(Drupal.ajax.instances||[]).forEach((ajaxInstance)=>{if(ajaxInstance&&typeof ajaxInstance.url==='string'&&ajaxInstance.url.indexOf('/views/ajax')!==-1){ajaxInstance.url=cleanUrl(ajaxInstance.url);ajaxInstance.options.url=cleanUrl(ajaxInstance.options.url);}});}function createFilterPillMultiSelect({$multiSelectDropdown,$filtersResultsList}){const $multiSelectCheckboxes=$multiSelectDropdown.find('.form-checkbox');$multiSelectCheckboxes.each((_,el)=>{const $el=$(el);if($el.is(':checked')){const $label=$el.next('label');let filterLabel=$multiSelectDropdown.attr('data-multiselect-dropdown-label-none');let filterName=$label.text().trim();let isRegion=false;if($multiSelectDropdown.attr('data-drupal-selector')==='region')isRegion=true;createFilterPill({filterLabel:isRegion?filterLabel:null,filterName,$fields:[$el],$filtersResultsList});}});}function updateLabelsCheckboxes($multiSelect){const $toggle=$multiSelect.find('.multiselect-dropdown__toggle');const $multiSelectCheckboxes=$multiSelect.find('.form-checkbox');const filtersActive=$multiSelectCheckboxes.filter(':checked').length;if(filtersActive>0)$toggle.attr('data-filters-active',filtersActive);}function updateLabelDates({elems,$dateBadge}){let qty=0;elems.forEach((el)=>{if(el.val())qty++;});if(qty>0)$dateBadge.attr('data-filters-active',qty);else $dateBadge.removeAttr('data-filters-active');}function showInitialResults($exposed){const $viewResultsQty=$exposed.find('.iaapa-exposed-filters__quantity');if($viewResultsQty.length){const viewResultsQty=$viewResultsQty.text();const $exposedFiltersQty=$exposed.find('.iaapa-exposed-filters__results__qty');if(viewResultsQty)$exposedFiltersQty.text(viewResultsQty);}}function updateToggleFiltersBadge($exposed){const $toggleFilters=$exposed.find('.iaapa-exposed-filters__toggle');let filtersActive=$exposed.find('input[type="checkbox"]:checked, input[type="date"]:not([value=""])').length;const $toggleFiltersBadge=$toggleFilters.find('.iaapa-exposed-filters__toggle-badge');const $removeAll=$exposed.find('.iaapa-exposed-filters__results__clear');const $exposedResults=$exposed.find('.iaapa-exposed-filters__results');const $view_rows=$exposed.siblings('.view-content').find('.views-row').length;if(filtersActive>0){$toggleFiltersBadge.html(`<span>${filtersActive}</span>`);$removeAll.show();$exposedResults.addClass('is-shown');$exposed.addClass('is-open');}else{const hasQty=$exposed.find('.iaapa-exposed-filters__results__qty').text().trim()!=='';$exposedResults.toggleClass('is-shown',hasQty&&$view_rows>0);}}function initSimpleSelectDropdown($exposed){const $simpleSelectDropdown=$exposed.find('.iaapa-exposed-filters__content__items select');const $filtersResultsList=$exposed.find('.iaapa-exposed-filters__results__selected-list');$simpleSelectDropdown.each((_,el)=>{const $el=$(el);const $label=$el.prev('label');const filterName=$el.find('option:selected').text().trim();const filterLabel=$label.text().trim();const padding=filterLabel.length*6;createFilterPillSelect({filterLabel,filterName,$fields:[$el],$filtersResultsList});el.style.setProperty('padding-left',`${padding}px`,'important');});}function removeAjaxThrobber(){$('.ajax-progress').each(function(){$(this).remove();});}}};})(Drupal,jQuery,once);;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.