/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ (function($,Drupal,debounce){$.fn.drupalGetSummary=function(){const callback=this.data('summaryCallback');if(!this[0]||!callback)return '';const result=callback(this[0]);return result?result.trim():'';};$.fn.drupalSetSummary=function(callback){const self=this;if(typeof callback!=='function'){const val=callback;callback=function(){return val;};}return (this.data('summaryCallback',callback).off('formUpdated.summary').on('formUpdated.summary',()=>{self.trigger('summaryUpdated');}).trigger('summaryUpdated'));};Drupal.behaviors.formSingleSubmit={attach(){function onFormSubmit(e){const $form=$(e.currentTarget);const formValues=new URLSearchParams(new FormData(e.target)).toString();const previousValues=$form.attr('data-drupal-form-submit-last');if(previousValues===formValues)e.preventDefault();else $form.attr('data-drupal-form-submit-last',formValues);}$(once('form-single-submit','body')).on('submit.singleSubmit','form:not([method~="GET"])',onFormSubmit);}};function triggerFormUpdated(element){$(element).trigger('formUpdated');}function fieldsList(form){return [].map.call(form.querySelectorAll('[name][id]'),(el)=>el.id);}Drupal.behaviors.formUpdated={attach(context){const $context=$(context);const contextIsForm=context.tagName==='FORM';const $forms=$(once('form-updated',contextIsForm?$context:$context.find('form')));let formFields;if($forms.length)$.makeArray($forms).forEach((form)=>{const events='change.formUpdated input.formUpdated ';const eventHandler=debounce((event)=>{triggerFormUpdated(event.target);},300);formFields=fieldsList(form).join(',');form.setAttribute('data-drupal-form-fields',formFields);$(form).on(events,eventHandler);});if(contextIsForm){formFields=fieldsList(context).join(',');const currentFields=$(context).attr('data-drupal-form-fields');if(formFields!==currentFields)triggerFormUpdated(context);}},detach(context,settings,trigger){const $context=$(context);const contextIsForm=context.tagName==='FORM';if(trigger==='unload')once.remove('form-updated',contextIsForm?$context:$context.find('form')).forEach((form)=>{form.removeAttribute('data-drupal-form-fields');$(form).off('.formUpdated');});}};Drupal.behaviors.fillUserInfoFromBrowser={attach(context,settings){const userInfo=['name','mail','homepage'];const $forms=$(once('user-info-from-browser','[data-user-info-from-browser]'));if($forms.length)userInfo.forEach((info)=>{const $element=$forms.find(`[name=${info}]`);const browserData=localStorage.getItem(`Drupal.visitor.${info}`);if(!$element.length)return;const emptyValue=$element[0].value==='';const defaultValue=$element.attr('data-drupal-default-value')===$element[0].value;if(browserData&&(emptyValue||defaultValue))$element.each(function(index,item){item.value=browserData;});});$forms.on('submit',()=>{userInfo.forEach((info)=>{const $element=$forms.find(`[name=${info}]`);if($element.length)localStorage.setItem(`Drupal.visitor.${info}`,$element[0].value);});});}};const handleFragmentLinkClickOrHashChange=(e)=>{let url;if(e.type==='click')url=e.currentTarget.location?e.currentTarget.location:e.currentTarget;else url=window.location;const hash=url.hash.substring(1);if(hash){const $target=$(`#${hash}`);$('body').trigger('formFragmentLinkClickOrHashChange',[$target]);setTimeout(()=>$target.trigger('focus'),300);}};const debouncedHandleFragmentLinkClickOrHashChange=debounce(handleFragmentLinkClickOrHashChange,300,true);$(window).on('hashchange.form-fragment',debouncedHandleFragmentLinkClickOrHashChange);$(document).on('click.form-fragment','a[href*="#"]',debouncedHandleFragmentLinkClickOrHashChange);})(jQuery,Drupal,Drupal.debounce);; (function($,Drupal,drupalSettings){'use strict';Drupal.extlink=Drupal.extlink||{};Drupal.extlink.attach=function(context,drupalSettings){if(typeof drupalSettings.data==='undefined'||!drupalSettings.data.hasOwnProperty('extlink'))return;var extIconPlacement='append';if(drupalSettings.data.extlink.extIconPlacement&&drupalSettings.data.extlink.extIconPlacement!='0')extIconPlacement=drupalSettings.data.extlink.extIconPlacement;var pattern=/^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/;var host=window.location.host.replace(pattern,'$2$3$6');var subdomain=window.location.host.replace(host,'');var subdomains;if(drupalSettings.data.extlink.extSubdomains)subdomains='([^/]*\\.)?';else if(subdomain==='www.'||subdomain==='')subdomains='(www\\.)?';else subdomains=subdomain.replace('.','\\.');var whitelistedDomains=false;if(drupalSettings.data.extlink.whitelistedDomains){whitelistedDomains=[];for(var i=0;i0)&&!(extCssExplicit&&$(this).parents(extCssExplicit).length<1)){var match=false;if(whitelistedDomains)for(var i=0;i0)&&!(extCssExplicit&&$(this).parents(extCssExplicit).length<1))mailto_links.push(this);}}catch(error){return false;}});if(drupalSettings.data.extlink.extClass!=='0'&&drupalSettings.data.extlink.extClass!=='')Drupal.extlink.applyClassAndSpan(external_links,drupalSettings.data.extlink.extClass,extIconPlacement);if(drupalSettings.data.extlink.mailtoClass!=='0'&&drupalSettings.data.extlink.mailtoClass!=='')Drupal.extlink.applyClassAndSpan(mailto_links,drupalSettings.data.extlink.mailtoClass,extIconPlacement);if(drupalSettings.data.extlink.extTarget){$(external_links).filter(function(){return !(drupalSettings.data.extlink.extTargetNoOverride&&$(this).is('a[target]'));}).attr({target:'_blank'});$(external_links).attr('rel',function(i,val){if(val===null||typeof val==='undefined')return 'noopener';if(val.indexOf('noopener')>-1)if(val.indexOf('noopener')===-1)return val+' noopener';else return val;else return val+' noopener';});}if(drupalSettings.data.extlink.extNofollow)$(external_links).attr('rel',function(i,val){if(val===null||typeof val==='undefined')return 'nofollow';var target='nofollow';if(drupalSettings.data.extlink.extFollowNoOverride)target='follow';if(val.indexOf(target)===-1)return val+' nofollow';return val;});if(drupalSettings.data.extlink.extNoreferrer)$(external_links).attr('rel',function(i,val){if(val===null||typeof val==='undefined')return 'noreferrer';if(val.indexOf('noreferrer')===-1)return val+' noreferrer';return val;});Drupal.extlink=Drupal.extlink||{};Drupal.extlink.popupClickHandler=Drupal.extlink.popupClickHandler||function(){if(drupalSettings.data.extlink.extAlert)return confirm(drupalSettings.data.extlink.extAlertText);};$(external_links).off("click.extlink");$(external_links).on("click.extlink",function(e){return Drupal.extlink.popupClickHandler(e,this);});};Drupal.extlink.applyClassAndSpan=function(links,class_name,icon_placement){var $links_to_process;if(drupalSettings.data.extlink.extImgClass)$links_to_process=$(links);else{var links_with_images=$(links).find('img, svg').parents('a');$links_to_process=$(links).not(links_with_images);}if(class_name!=='0')$links_to_process.addClass(class_name);$links_to_process.attr('data-extlink','');var i;var length=$links_to_process.length;for(i=0;i');else $link[icon_placement]('');else if(class_name===drupalSettings.data.extlink.mailtoClass)$link[icon_placement](''+drupalSettings.data.extlink.mailtoLabel+'');else $link[icon_placement](''+drupalSettings.data.extlink.extLabel+'');}};Drupal.behaviors.extlink=Drupal.behaviors.extlink||{};Drupal.behaviors.extlink.attach=function(context,drupalSettings){if(typeof extlinkAttach==='function')extlinkAttach(context);else Drupal.extlink.attach(context,drupalSettings);};})(jQuery,Drupal,drupalSettings);; (function(Drupal,drupalSettings,once){const sitewideAlertsSelector='[data-sitewide-alert]';const shouldShowOnThisPage=(pages=[],negate=true)=>{if(pages.length===0)return true;let pagePathMatches=false;const currentPath=window.location.pathname;for(let i=0;i{if(!(`alert-dismissed-${alert.uuid}` in window.localStorage))return false;const dismissedAtTimestamp=Number(window.localStorage.getItem(`alert-dismissed-${alert.uuid}`));return dismissedAtTimestamp>=alert.dismissalIgnoreBefore;};const dismissAlert=(alert)=>{window.localStorage.setItem(`alert-dismissed-${alert.uuid}`,String(Math.round(new Date().getTime()/1000)));document.querySelectorAll(`[data-uuid="${alert.uuid}"]`).forEach((alert)=>{alert.dispatchEvent(new CustomEvent('sitewide-alert-dismissed',{bubbles:true,composed:true}));removeAlert(alert);});};const buildAlertElement=(alert)=>{const alertElement=document.createElement('div');alertElement.innerHTML=alert.renderedAlert;if(alert.dismissible){const dismissButtons=alertElement.getElementsByClassName('js-dismiss-button');for(let i=0;idismissAlert(alert));}return alertElement.firstElementChild;};const removeAlert=(alert)=>{alert.dispatchEvent(new CustomEvent('sitewide-alert-removed',{bubbles:true,composed:true}));alert.remove();};const fetchAlerts=()=>{return fetch(`${window.location.origin+drupalSettings.path.baseUrl+drupalSettings.path.pathPrefix}sitewide_alert/load`).then((res)=>res.json()).then((result)=>result.sitewideAlerts,(error)=>{console.error(error);});};const removeStaleAlerts=(alerts)=>{const roots=document.querySelectorAll(sitewideAlertsSelector);roots.forEach((root)=>{const existingAlerts=root.querySelectorAll('[data-uuid]');const alertsToBeRemoved=Array.from(existingAlerts).filter((alert)=>!alerts.includes(alert.getAttribute('data-uuid')));alertsToBeRemoved.forEach((alert)=>removeAlert(alert));});};const initAlerts=()=>{const roots=document.querySelectorAll(sitewideAlertsSelector);fetchAlerts().then((alerts)=>{removeStaleAlerts(alerts);alerts.forEach((alert)=>{const dismissed=alertWasDismissed(alert);const showOnThisPage=shouldShowOnThisPage(alert.showOnPages,alert.negateShowOnPages);roots.forEach((root)=>{const existingAlertElement=root.querySelector(`[data-uuid="${alert.uuid}"]`);if(showOnThisPage&&!dismissed){const renderableAlertElement=buildAlertElement(alert);existingAlertElement?root.replaceChild(renderableAlertElement,existingAlertElement):root.appendChild(renderableAlertElement);renderableAlertElement.dispatchEvent(new CustomEvent('sitewide-alert-rendered',{bubbles:true,composed:true}));return;}if((dismissed||!showOnThisPage)&&existingAlertElement)removeAlert(existingAlertElement);});});});};const supportsHistoryPushState=()=>{return ('pushState' in window.history&&window.history['pushState']!==null);};const supportsHistoryReplaceState=()=>{return ('replaceState' in window.history&&window.history['replaceState']!==null);};const proxyPushState=()=>{if(supportsHistoryPushState())window.history.pushState=new Proxy(window.history.pushState,{apply(target,thisArg,argArray){triggerHistoryEvent(thisArg,argArray);return target.apply(thisArg,argArray);}});if(supportsHistoryReplaceState())window.history.replaceState=new Proxy(window.history.replaceState,{apply(target,thisArg,argArray){triggerHistoryEvent(thisArg,argArray);return target.apply(thisArg,argArray);}});};const triggerHistoryEvent=(thisArg,argArray)=>{const event=new CustomEvent('sitewidealerts.popstate',{detail:{state:thisArg,options:argArray}});window.dispatchEvent(event);};const historyListener=()=>{window.addEventListener('sitewidealerts.popstate',()=>initAlerts());window.addEventListener('popstate',()=>initAlerts());};Drupal.behaviors.sitewide_alert_init={attach:(context)=>{once('sitewide_alerts_init','html',context).forEach(()=>{initAlerts();proxyPushState();historyListener();if(drupalSettings.sitewideAlert.automaticRefresh===true){const interval=setInterval(()=>initAlerts(),drupalSettings.sitewideAlert.refreshInterval<1000?1000:drupalSettings.sitewideAlert.refreshInterval);if(!drupalSettings.sitewideAlert.automaticRefresh)clearInterval(interval);}});}};})(Drupal,drupalSettings,once);;