1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ 2(function($,Drupal,drupalSettings,dataLayer){Drupal.behaviors.padiAnalyticsGtm={attach(context,settings){}};Drupal.behaviors.padiAnalyticsGtm.dataLayer=function(data){const {event,eventCategory,eventAction,eventLabel,eventValue,eventNonInteraction}=data;dataLayer.push({event,eventCategory,eventAction,eventLabel,eventValue,eventNonInteraction});};function pushPageGtmData(){const gtmData={};for(const key in drupalSettings.padiAnalytics.GTM)if(drupalSettings.padiAnalytics.GTM.hasOwnProperty(key))if(drupalSettings.padiAnalytics.GTM[key]!=="undefined")gtmData[key]=drupalSettings.padiAnalytics.GTM[key];dataLayer.push(gtmData);}pushPageGtmData();})(jQuery,Drupal,drupalSettings,dataLayer);; 3(function($,Drupal,once){function padiAnalyticsGtmDataLayer(data){return Drupal.behaviors.padiAnalyticsGtm.dataLayer(data);}Drupal.behaviors.padiAnalyticsGtmUiEvents={attach:function(context,settings){once('padiAnalyticsGtmUiEvents','[data-click-event-tracking]',context).forEach(function(element){const pageSlug=settings.padiAnalytics.GTM.page_slug;let eventId=$(element).attr("data-click-event-id");if($(element).attr("data-click-name-id"))eventId+='-'+$(element).attr('data-click-name-id');$(element).find("a, button").each(function(){once('padiAnalyticsGtmUiEventsInner',this).forEach(()=>{$(this).on("click",function(){let linkId;const keepParams=typeof $(this).data("event-click-with-params")!=="undefined";if($(this).attr("id"))linkId=$(this).attr("id");else{linkId=$(this).attr("href")||$(this).attr("data-click-event-url");if(linkId){linkId=linkId.replace(/(^\w+:|^)\/\//,"");if(!keepParams&&linkId.indexOf("?")>0)linkId=linkId.substring(0,linkId.indexOf("?"));if(linkId.charAt(0)==="/")linkId=location.hostname+linkId;}}const dataEventProp=`${pageSlug}_${eventId}_${linkId}`;let eventInteraction;if($(this).data("event-interaction"))eventInteraction=$(this).data("event-interaction");let eventCategory;if($(this).data("event-category"))eventCategory=$(this).data("event-category");let eventAction;if($(this).data("event-action"))eventAction=$(this).data("event-action");let eventLabel;if($(this).data("event-label"))eventLabel=$(this).data("event-label");let eventValue;if($(this).data("event-value"))eventValue=$(this).data("event-value");let eventNonInteraction;if($(this).data("event-non-interaction"))eventNonInteraction="true";const gtmData={event:eventInteraction??"interaction",eventCategory:eventCategory??"Navigation",eventAction:eventAction??"Click",eventLabel:eventLabel??dataEventProp,eventValue:eventValue??"0",eventNonInteraction:eventNonInteraction??"false"};padiAnalyticsGtmDataLayer(gtmData);});});});});}};})(jQuery,Drupal,once);; 4(function($,Drupal,settings){'use strict';function getGeolocation(){return Drupal.behaviors.padiGeolocation.getGeolocation();}Drupal.behaviors.chinaDomainRedirect={attach:function(context,settings){once('loadPageChinaGeoRedirects','article.basic-page',context).forEach(function(element){$.when(getGeolocation()).then(function(data,status,jqXHR){const result=JSON.parse(data);const nid=settings.nid;if(status==="success"){const {countryIsoCode}=result;const chinaDomain=settings.padiChinaDomainRedirect.chinaDomainHostname;if(countryIsoCode=='CN')if(nid==596)window.location.replace('https://'+chinaDomain+'/zh-hans/privacy');else window.location.replace('https://'+chinaDomain);}});});}};})(jQuery,Drupal,once);; 5(function($,Drupal,drupalSettings){Drupal.behaviors.padiDsl={attach(context,settings){}};Drupal.behaviors.padiDsl.getDiveShop=function($storeNumber){if(drupalSettings.dsl){const {dslEndpoint,dslBasicAuthToken}=drupalSettings.dsl;let result;return $.ajax({url:dslEndpoint+"/"+$storeNumber+"/",type:'get',headers:{"Authorization":`Bearer ${dslBasicAuthToken}`,"Content-Type":"application/json"},dataType:'html',async:true,success:function(data){result=data;}});}};})(jQuery,Drupal,drupalSettings);; 6(function($,Drupal,once){'use strict';function padiDslRequestDiveShop(storeNumber){return Drupal.behaviors.padiDsl.getDiveShop(storeNumber);}
6function getCookie(name){const value=document.cookie.match('(^|[^;]+)\\s*'+name+'\\s*=\\s*([^;]+)');return value?value.pop():null;}function setCookie(name,value,days){const now=new Date();now.setTime(now.getTime()+(days*24*60*60*1000));const expires="expires="+now.toUTCString();const domain="domain="+(document.domain.match(/[^.]*\.[^.]*$/)[0])+";";document.cookie=name+"="+value+";"+expires+";"+domain+"path=/";}function getUrlParam(name){const queryString=window.location.search;const urlParams=new URLSearchParams(queryString);return urlParams.get(name);}Drupal.behaviors.padiCustomDiveShop={attach(context,settings){}};Drupal.behaviors.padiCustomDiveShop.getAffiliateDiveShopId=function(){const cookie=getCookie('affiliateDiveShop');return cookie??null;};Drupal.behaviors.padiCustomDiveShop.getAffiliateDiveShoClubId=function(){const cookie=getCookie('affiliateDiveShopClub');return cookie??null;};Drupal.behaviors.padiProductsAffiliateDiveShop={attach:function(context,settings){once('padiProductsAffiliateDiveShop','body .region-content',context).forEach(function(element){const cookieName='affiliateDiveShop';const cookieNameClub='affiliateDiveShopClub';const diveShopCookie=getCookie(cookieName);const diveShopCookieClub=getCookie(cookieNameClub);const cookieExist=!!diveShopCookie;const cookieExistClub=!!diveShopCookieClub;const irra=getUrlParam("irra");const irrap=getUrlParam("irrap");let diveShopId=null;let diveShopIdClub=null;if(irra||cookieExist||cookieExistClub){if(!irra&&cookieExist)diveShopId=diveShopCookie;else diveShopId=irra;if(!irra&&cookieExistClub)diveShopIdClub=diveShopCookieClub;else diveShopIdClub=irra;if(diveShopId||diveShopIdClub)$.when(padiDslRequestDiveShop(diveShopId)).then(function(data,status,jqXHR){const result=JSON.parse(data);if(status==="success"){const {results}=result;const {diveShopName,address,email,phone}=results[0];const {addressLine1,addressLine2,city,state,zipCode,country}=address;if(!irrap)setCookie(cookieName,diveShopId,30);else{if(irrap=="club")setCookie(cookieNameClub,diveShopIdClub,30);}const diveShopAddress=[addressLine1?addressLine1+"<br>":null,addressLine2?addressLine2+"<br>":null,city?city+", ":null,state?state+", ":null,zipCode?zipCode+"<br>":null,country.code?country.code:null];$(".dive-shop, .dive-shop-pdp").removeClass("hidden");if(diveShopName){$(".dive-shop__name").html(diveShopName);$(".dive-shop-pdp .accordion-item__title").append(` - ${diveShopName}`);}if(diveShopAddress)$(".dive-shop__address, .dive-shop-pdp__address .value").html(diveShopAddress.join(""));else $(".dive-shop-pdp__address").remove();if(email)$(".dive-shop__email, .dive-shop-pdp__email .value").html(email);else $(".dive-shop-pdp__email").remove();if(phone)$(".dive-shop__phone, .dive-shop-pdp__phone .value").html("<a href=\"tel:"+phone.replace(/[^A-Z0-9]+/ig,"")+"\">"+phone+"</a></div>");else $(".dive-shop-pdp__phone").remove();}});$(".footer-ads").addClass("hidden");}});}};})(jQuery,Drupal,once);; 7(function($,Drupal,once){Drupal.behaviors.dslAutoSuggest={attach:function(context,settings){console.log('DSL Auto Suggest behavior attached');const baseUrl='https://travel.padi.com';once('dslAutoSuggest','.dsl-auto-suggest',context).forEach((suggestContainer)=>{const inputField=suggestContainer.querySelector('.dsl-auto-suggest-input');if(!inputField){console.warn('Input field not found');return;}let selectedPath=null;const nearbyText=suggestContainer.dataset.nearbyText||'Nearby';const resultsDropdown=document.createElement('ul');resultsDropdown.className='dsl-auto-suggest-dropdown';resultsDropdown.style.position='absolute';resultsDropdown.style.zIndex='9999';resultsDropdown.style.display='none';document.body.appendChild(resultsDropdown);let timeout;const positionDropdown=()=>{const wrapper=suggestContainer.querySelector('.dsl-auto-suggest-wrapper');if(!wrapper)return;const rect=wrapper.getBoundingClientRect();resultsDropdown.style.left=`${rect.left+rect.width/2+window.scrollX}px`;resultsDropdown.style.top=`${rect.bottom+window.scrollY}px`;resultsDropdown.style.transform='translateX(-50%)';if(window.innerWidth>=992){resultsDropdown.style.width='100%';resultsDropdown.style.maxWidth='600px';}else resultsDropdown.style.width=`calc(100% - 40px)`;};const fetchResults=async(query)=>{try{const response=await fetch(`${baseUrl}/api/v2/travel/dsl/courses/autosuggest/?q=${encodeURIComponent(query)}`);if(!response.ok)throw new Error('API error');const data=await response.json();populateResults(data);}catch(error){const fetchErrorMsg=inputField.dataset.fetchErrorMsg||'Error fetching results';resultsDropdown.innerHTML=`<li class="error-item">${fetchErrorMsg}</li>`;resultsDropdown.style.display='block';positionDropdown();}};const populateResults=(data)=>{resultsDropdown.innerHTML='';
7const results=[...(data?.places||[]),...(data?.gplaces||[])];if(results.length>0){const nearbyHeader=document.createElement('li');nearbyHeader.className='header-item';nearbyHeader.innerHTML=`<a href="${baseUrl}/padi-courses-locator/nearby/">${nearbyText}</a>`;resultsDropdown.appendChild(nearbyHeader);results.forEach((item)=>{const listItem=document.createElement('li');listItem.className='result-item';let formattedAddress=item.formattedAddress?.toLowerCase()!=='null'?item.formattedAddress:'';listItem.innerHTML=` 8 <span class="result-title">${item.title}</span> 9 ${formattedAddress?`<span class="result-subtitle">${formattedAddress}</span>`:''} 10 `;listItem.addEventListener('click',()=>{window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"dslAutoSuggestLocationSelection",dslAutoSuggestLocation:{name:item.title,location:formattedAddress??"",destinationUrl:`${baseUrl}${item.padiCoursesSearchUrl}`}});window.location.href=`${baseUrl}${item.padiCoursesSearchUrl}`;});resultsDropdown.appendChild(listItem);});resultsDropdown.style.display='block';positionDropdown();}else{const noResultsMsg=inputField.dataset.noResultsMsg||'No results found';resultsDropdown.innerHTML=`<li class="no-results-item">${noResultsMsg}</li>`;resultsDropdown.style.display='block';positionDropdown();}};inputField.addEventListener('input',()=>{let query=inputField.value.trim();selectedPath=null;if(query.length>100)inputField.value=query.substring(0,100);if(query.length<2){resultsDropdown.style.display='none';resultsDropdown.innerHTML='';return;}clearTimeout(timeout);timeout=setTimeout(()=>fetchResults(query),300);});inputField.addEventListener('focus',()=>{let query=inputField.value.trim();if(query.length>=2){resultsDropdown.style.display='block';positionDropdown();}});document.addEventListener('click',(event)=>{if(!suggestContainer.contains(event.target)&&!resultsDropdown.contains(event.target))resultsDropdown.style.display='none';});window.addEventListener('resize',()=>{if(resultsDropdown.style.display==='block')positionDropdown();});window.addEventListener('scroll',()=>{if(resultsDropdown.style.display==='block')positionDropdown();},true);});}};})(jQuery,Drupal,once);; 11(function($,Drupal,drupalSettings){if(drupalSettings.padi_sso){const{refreshTokenEndpoint,jumpApiEndpoint,ssoClientId,domain}=drupalSettings.padi_sso;function getCognitoCookies(){let cookies={};if(document.cookie&&document.cookie!==""){let split=document.cookie.split(";");for(let i=0;i<split.length;i++){let name=split[i].split("=");name[0]=name[0].replace(/^ /,"");if(name[0].startsWith("CognitoIdentityServiceProvider")){cookies[decodeURIComponent(name[0])]=decodeURIComponent(name[1])}}}return cookies}function deleteCognitoCookies(){let cognitoCookies=getCognitoCookies();if(cognitoCookies){for(const[key,value]of Object.entries(cognitoCookies)){document.cookie=`${key}=${value}; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=.${domain}; path=/;`}}}function parseCognitoCookies(){let data={};let cognitoCookies=getCognitoCookies();if(cognitoCookies){for(const[key,value]of Object.entries(cognitoCookies)){if(key.endsWith("idToken")){data.idToken=value}if(key.endsWith("accessToken")){data.accessToken=value}if(key.endsWith("refreshToken")){data.refreshToken=value}if(key.endsWith("userData")){data.userData=value}if(key.endsWith("LastAuthUser")){data.LastAuthUser=value;const keySplit=key.split(".");data.clientId=keySplit[1]}}return data}}function getCognitoLocalStorage(){let storage=[];Object.keys(localStorage).forEach(element=>{if(element.startsWith("CognitoIdentityServiceProvider")){storage.push(element)}});return storage}function deleteCognitoLocalStorage(){const storage=getCognitoLocalStorage();storage.forEach(element=>{if(element.startsWith("CognitoIdentityServiceProvider")){localStorage.removeItem(element)}})}function clearCognitoCookiesAndStorage(){deleteCognitoLocalStorage();deleteCognitoCookies()}function getUserData(){const cognitoCookie=parseCognitoCookies();if(cognitoCookie.userData){const attributes=JSON.parse(cognitoCookie.userData);let userData={};attributes["UserAttributes"].forEach(function(arrayItem){userData[arrayItem.Name]=arrayItem.Value});return userData}return null}function requestRefreshToken(){if(refreshTokenEndpoint){const cognitoCookie=parseCognitoCookies();const body={idToken:cognitoCookie.idToken,refreshToken:cognitoCookie.refreshToken,clientId:ssoClientId};let result;return $.ajax({url:refreshTokenEndpoint,type:"post",contentType:"application/json, text/plain",data:JSON.stringify(body),dataType:"json",async:true,success:function(data){result=data}})}}function refreshCognitoCookies(){const refreshResponse=requestRefreshToken();$.when(refreshResponse).then(function(data,status,jqXHR){if(data.idToken){const idTokenSplit=data.idToken.split(".");const[,getPayload]=idTokenSplit;const decodedPayload=atob(getPayload);const payload=JSON.parse(decodedPayload);const cookiePrefix="CognitoIdentityServiceProvider";const cognitoCookie=parseCognitoCookies();const newCookies={idToken:data.idToken,refreshToken:data.refreshToken,accessToken:data.accessToken,userData:cognitoCookie.userData,LastAuthUser:payload.sub};const date=new Date;let expires=date.setTime(date.getTime()+ +(8*60*60*1e3));expires+=date.toGMTString();clearCognitoCookiesAndStorage();for(let[key,value]of Object.entries(newCookies)){let cookieName;if(key==="LastAuthUser"){cookieName=`${cookiePrefix}.${ssoClientId}.${key}`}else{cookieName=`${cookiePrefix}.${ssoClientId}.${payload.sub}.${key}`}document.cookie=`${cookieName}=${value}; expires=${expires}; domain=.${domain}; path=/; samesite=lax; secure`}}})}function loopRefreshToken(){const cognitoCookie=parseCognitoCookies();if(cognitoCookie.idToken){refreshCognitoCookies();setInterval(function(){refreshCognitoCookies()},33e5)}}loopRefreshToken();Drupal.behaviors.padiSso={};Drupal.behaviors.padiSso.getCognitoCookies=function(){return getCognitoCookies()};Drupal.behaviors.padiSso.deleteCognitoCookies=function(){return deleteCognitoCookies()};Drupal.behaviors.padiSso.userData=function(){return getUserData()};Drupal.behaviors.padiSso.getIdToken=function(){const cognitoCookie=parseCognitoCookies();if(cognitoCookie.idToken){return cognitoCookie.idToken}return null};Drupal.behaviors.padiSso.getRefreshToken=function(){const cognitoCookie=parseCognitoCookies();if(cognitoCookie.refreshToken){return cognitoCookie.refreshToken}return null};Drupal.behaviors.padiSso.getJumpRedirectUri=function(idToken,jumpClientId,jumpEndpoint,extraData){const body={clientId:jumpClientId,redirectUri:jumpEndpoint};if(extraData){body.extraData=extraData}let result;return $.ajax({url:jumpApiEndpoint,type:"post",beforeSend:function(xhr){xhr.setRequestHeader("Authorization","Bearer "+idToken)},contentType:"application/json, text/plain",data:JSON.stringify(body),dataType:"json",async:true,success:function(data){result=data}})}}})(jQuery,Drupal,drupalSettings);; 12(function($,Drupal,once){function padiSsoSloUpdateSession(endpoint,userSub,apiKey,logout){return Drupal.behaviors.padiSsoSloUpdateSession(endpoint,userSub,apiKey,logout)}function padiSsoSloDeleteSession(endpoint,userSub,apiKey,logout){return Drupal.behaviors.padiSsoSloDeleteSession(endpoint,userSub,apiKey,logout)}
12Drupal.behaviors.padiSsoSloGetSession=function(endpoint,userSub,apiKey){const query={query:` 13 query GetSession( $sub: String!){ 14 getSession(sub: $sub) { 15 email 16 logout 17 sub 18 } 19 } 20 `,variables:{sub:userSub}};return $.ajax({url:endpoint,type:"post",contentType:"application/json",headers:{"x-api-key":apiKey},dataType:"json",data:JSON.stringify(query),async:true,timeout:1e4}).done(function(data){}).fail(function(jqXHR,textStatus,errorThrown){const{status}=jqXHR;console.error(textStatus);console.error(jqXHR)})};Drupal.behaviors.padiSsoSloUpdateSession=function(endpoint,userSub,apiKey,logout){const query={query:` 21 mutation UpdateSession($logout: Boolean!, $sub: String!) { 22 updateSession(input: {logout: $logout, sub: $sub, }) { 23 sub 24 email 25 logout 26 } 27 } 28 `,variables:{sub:userSub,logout:logout}};return $.ajax({url:endpoint,type:"post",contentType:"application/json",headers:{"x-api-key":apiKey},dataType:"json",data:JSON.stringify(query),async:true,timeout:1e4}).done(function(data){console.log(`slo session updated logout: ${logout}`)}).fail(function(jqXHR,textStatus,errorThrown){const{status}=jqXHR;console.error(textStatus);console.error(jqXHR)})};Drupal.behaviors.padiSsoSloDeleteSession=function(endpoint,userSub,apiKey){const query={query:` 29 mutation DeleteSession($sub: String!) { 30 deleteSession(input: {sub: $sub}) { 31 email 32 logout 33 sub 34 } 35 } 36 `,variables:{sub:userSub}};return $.ajax({url:endpoint,type:"post",contentType:"application/json",headers:{"x-api-key":apiKey},dataType:"json",data:JSON.stringify(query),async:true,timeout:1e4}).done(function(data){console.log("slo session deleted")}).fail(function(jqXHR,textStatus,errorThrown){const{status}=jqXHR;console.error(textStatus);console.error(jqXHR)})};Drupal.behaviors.padiSsoSloLogoutUser=function(endpoint,userSub,apiKey){$.when(padiSsoSloUpdateSession(endpoint,userSub,apiKey,true)).done(function(data,status,jqXHR){$.when(padiSsoSloDeleteSession(endpoint,userSub,apiKey).done(function(data,status,jqXHR){}))})}})(jQuery,Drupal,once);; 37(function($,Drupal,drupalSettings){Drupal.behaviors.padiProApi={};Drupal.behaviors.padiProApi.requestCertifications=function(idToken){if(drupalSettings.padi_pro_api){const {endpoint}=drupalSettings.padi_pro_api;let result;return $.ajax({url:endpoint+"/certifications/me",type:"get",beforeSend(xhr){xhr.setRequestHeader("Authorization","Bearer "+idToken);},contentType:"application/json, text/plain",dataType:"json",async:true,success(data){result=data;}});}};Drupal.behaviors.padiProApi.getAvatar=function(idToken,affiliateId){if(!idToken||!affiliateId)return;else{const {endpoint}=drupalSettings.padi_pro_api;let result;return $.ajax({url:`${endpoint}/certifications/photos/getphoto`,method:'POST',headers:{'Authorization':`Bearer ${idToken}`},data:JSON.stringify({"affiliateId":affiliateId}),contentType:"application/json",xhrFields:{responseType:'blob'},error:function(data,status,xhr){console.error([status,data,xhr]);}});}};Drupal.behaviors.padiProApi.getCertifications=function(idToken){return $.when(Drupal.behaviors.padiProApi.requestCertifications(idToken)).then(function(data,status,jqXHR){if(data.items)return data.items;return null;});};})(jQuery,Drupal,drupalSettings);; 38(function($,Drupal,once){function getIdToken(){return Drupal.behaviors.padiSso.getIdToken();}function getUserData(){return Drupal.behaviors.padiSso.userData();}function getJumpRedirectUri(idToken,jumpClientId,jumpEndpoint,extraData){return Drupal.behaviors.padiSso.getJumpRedirectUri(idToken,jumpClientId,jumpEndpoint,extraData);}function getAvatar(idToken,affiliateId){return Drupal.behaviors.padiProApi.getAvatar(idToken,affiliateId);}function padiSsoSloGetSession(endpoint,userSub,apiKey){return Drupal.behaviors.padiSsoSloGetSession(endpoint,userSub,apiKey);}function padiSsoSloLogoutUser(endpoint,userSub,apiKey){return Drupal.behaviors.padiSsoSloLogoutUser(endpoint,userSub,apiKey);}function utilitiesSetCookie(name,value,days){return Drupal.behaviors.padiUtilities.setCo
38okie(name,value,days);}Drupal.behaviors.padiCustomSso={attach:function(context,settings){once('padiCustomSso','body',context).forEach(function(element){if(settings.customSso){const idToken=getIdToken();const userData=getUserData();if(idToken)if(userData){const {slo}=settings.padi_sso;const {endpoint:sloEndpoint,key:sloApiKey}=slo;$.when(padiSsoSloGetSession(sloEndpoint,userData.sub,sloApiKey)).done(function(data,status,jqXHR){if(data.data){const {getSession}=data.data;if(getSession?.logout==true||getSession==null)window.location.href="/padi-sso/logout";}});$("#toggle-account-menu a",element).each(function(index){const link=$(this);const href=link.attr("href");if(href.includes("/padi-sso/logout"))$(link).on("click",function(e){e.preventDefault();$.when(padiSsoSloLogoutUser(sloEndpoint,userData.sub,sloApiKey)).done(function(data,status,jqXHR){utilitiesSetCookie('cartId','{}',0);window.location.href="/padi-sso/logout";});});});settings.customSso.idToken=idToken;$.when(getAvatar(idToken,userData["custom:affiliate_id"])).done(function(data,status,jqXHR){if(data){const avatarUrl=window.URL.createObjectURL(data);const headerAvatar=$(".padi-nav-header__title .padi-nav-header__profile-picture");headerAvatar.attr("src",avatarUrl);headerAvatar.removeClass("hide");$(".padi-nav-header__title .padi-icons--single-user").addClass("hide");const submenuAvatar=$(".padi-nav-header__user-section-avatar");submenuAvatar.attr("src",avatarUrl);submenuAvatar.removeClass("hide");$(".padi-nav-header__user-section .padi-icons--single-user").addClass("hide");}});if(userData.given_name){$(".padi-nav-header__title-with-icon").text(userData.given_name);$(".padi-nav-header__user-name").text(`${userData.given_name}\u00A0${userData.family_name}`);}const menusAnon=$("#user-menus--anon");const menusAnonMobile=$("#user-menus-mobile--anon");const menusStudent=$("#user-menus--student");const menusPro=$("#user-menus--pro");menusAnon.addClass("hidden");menusAnonMobile.addClass("hidden");switch(userData["custom:affiliate_type_id"]){case "1":menusStudent.removeClass("hidden");menusPro.addClass("hidden");break;case "2":menusPro.removeClass("hidden");menusStudent.addClass("hidden");break;case "3":menusPro.removeClass("hidden");menusStudent.addClass("hidden");break;case "9":menusStudent.removeClass("hidden");menusPro.addClass("hidden");break;default:menusStudent.removeClass("hidden");menusPro.addClass("hidden");}}}});}};Drupal.behaviors.padiCustomSsoLinks={attach:function(context,settings){once('padiCustomSsoLinks','a',context).forEach(function(element){if(settings.customSso){const {jumpApps,idToken}=settings.customSso;if(idToken)if(Object.keys(jumpApps).length){const link=$(element);const href=link.attr("href");$.each(jumpApps,function(index,value){if(href&&href.includes(value.redirectUri))$(link).on("click",function(e){e.preventDefault();let redirectUri=value.redirectUri;let extraData;if(value.redirectUri.includes("scubadiving.com"))extraData=`login=topright&href=${href}`;if(value.redirectUri.includes("padi.com.cn")||value.redirectUri.includes("padi.co.kr")){const url=new URL(href);extraData=url.pathname;}if(value.redirectUri.includes("learning.padi.com")||value.redirectUri.includes("learning.global-np.padi.com")){const url=new URL(href);redirectUri=`${url.origin}${url.pathname}`;}if(value.redirectUri.includes("store.padi.com")||value.redirectUri.includes("store.global-np.padi.com")){const url=new URL(href);redirectUri=`${value.redirectUri}/padi-sso/callback`;extraData=`${url.origin}${url.pathname}`;}if(value.redirectUri.includes("action.padiaware.org")||value.redirectUri.includes("action-stg.padiaware.org")){const url=new URL(href);redirectUri=`${value.redirectUri}/callback`;extraData=`${url.origin}${url.pathname}`;}const jumpRequest=getJumpRedirectUri(idToken,value.clientId,redirectUri,extraData);$.when(jumpRequest).then(function(data,status,jqXHR){window.location.href=data.redirectUri;}).fail(function(e){console.error('----- exchange error',e);});});});}}});}};})(jQuery,Drupal,once);; 39(function($,Drupal,drupalSettings){if(drupalSettings.padi_sso){const{rewriteUrl,ssoAccountUrl}=drupalSettings.padi_sso;if(rewriteUrl){switch(rewriteUrl){case"return_to_original_page":$("a").on("click",function(e){if($(this).attr("href")!==undefined){const url=$(this).attr("href");const loginUrl=ssoAccountUrl+"/login";if(url.includes(loginUrl)&&!url.includes("&extraData=")){$(this).attr("href",function(){return this.href+"&extraData="+window.location.href})}}});break;case"redirect_to_dashboard":$("a").on("click",function(e){if($(this).attr("href")!==undefined){const url=$(this).attr("href");const loginUrl=ssoAccountUrl+"/login";if(url.includes(loginUrl)&&!url.includes("&extraData=")){$(this).attr("href",function(){return this.href+"&extraData=redirect-dashboard"})}}});break;default:}}}})(jQuery,Drupal,drupalSettings);; 40(($,Drupal,{isTabbable})=>{$.extend($.expr[':'],{tabbable(element){Drupal.deprecationError({message:'The :tabbable selector is deprecated
40in Drupal 9.2.0 and will be removed in Drupal 11.0.0. Use the core/tabbable library instead. See https://www.drupal.org/node/3183730'});return isTabbable(element);}});})(jQuery,Drupal,window.tabbable);; 41(($)=>{let cachedScrollbarWidth=null;const {max,abs}=Math;const regexHorizontal=/left|center|right/;const regexVertical=/top|center|bottom/;const regexOffset=/[+-]\d+(\.[\d]+)?%?/;const regexPosition=/^\w+/;const _position=$.fn.position;function getOffsets(offsets,width,height){return [parseFloat(offsets[0])*(typeof offsets[0]==='string'&&offsets[0].endsWith('%')?width/100:1),parseFloat(offsets[1])*(typeof offsets[1]==='string'&&offsets[1].endsWith('%')?height/100:1)];}function parseCss(element,property){return parseInt(window.getComputedStyle(element)[property],10)||0;}function getDimensions(elem){const raw=elem[0];if(raw.nodeType===9)return {width:elem.width(),height:elem.height(),offset:{top:0,left:0}};if(!!raw&&raw===raw.window)return {width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}};if(raw.preventDefault)return {width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}};return {width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()};}const collisions={fit:{left(position,data){const {within}=data;const withinOffset=within.isWindow?within.scrollLeft:within.offset.left;const outerWidth=within.width;const collisionPosLeft=position.left-data.collisionPosition.marginLeft;const overLeft=withinOffset-collisionPosLeft;const overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset;let newOverRight;if(data.collisionWidth>outerWidth)if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight;}else if(overRight>0&&overLeft<=0)position.left=withinOffset;else if(overLeft>overRight)position.left=withinOffset+outerWidth-data.collisionWidth;else position.left=withinOffset;else if(overLeft>0)position.left+=overLeft;else if(overRight>0)position.left-=overRight;else position.left=max(position.left-collisionPosLeft,position.left);},top(position,data){const {within}=data;const withinOffset=within.isWindow?within.scrollTop:within.offset.top;const outerHeight=data.within.height;const collisionPosTop=position.top-data.collisionPosition.marginTop;const overTop=withinOffset-collisionPosTop;const overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset;let newOverBottom;if(data.collisionHeight>outerHeight)if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom;}else if(overBottom>0&&overTop<=0)position.top=withinOffset;else if(overTop>overBottom)position.top=withinOffset+outerHeight-data.collisionHeight;else position.top=withinOffset;else if(overTop>0)position.top+=overTop;else if(overBottom>0)position.top-=overBottom;else position.top=max(position.top-collisionPosTop,position.top);}},flip:{left(position,data){const {within}=data;const withinOffset=within.offset.left+within.scrollLeft;const outerWidth=within.width;const offsetLeft=within.isWindow?within.scrollLeft:within.offset.left;const collisionPosLeft=position.left-data.collisionPosition.marginLeft;const overLeft=collisionPosLeft-offsetLeft;const overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft;const myOffset=data.my[0]==='left'?-data.elemWidth:data.my[0]==='right'?data.elemWidth:0;const atOffset=data.at[0]==='left'?data.targetWidth:data.at[0]==='right'?-data.targetWidth:0;const offset=-2*data.offset[0];let newOverRight;let newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft))position.left+=myOffset+atOffset+offset;}else{if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight)position.left+=myOffset+atOffset+offset;}}},top(position,data){const {within}=data;const withinOffset=within.offset.top+within.scrollTop;const outerHeight=within.height;const offsetTop=within.isWindow?within.scrollTop:within.offset.top;const collisionPosTop=position.top-data.collisionPosition.marginTop;const overTop=collisionPosTop-offsetTop;const overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop;const top=data.my[1]==='top';const myOffset=top?-data.elemHeight:data.my[1]==='bottom'?data.elemHeight:0;const atOffset=data.at[1]==='top'?data.targetHeight:data.at[1]==='bottom'?-data.targetHeight:0;const offset=-2*data.offset[1];let newOverTop;let newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop))position.top+=myOffset+atOffset+offset;}else{if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom)position.top+=myOffset+atOffset+offset;}}}},flipfit:{left(...args){collisions.flip.left.apply(this,args);collisions.fit.left.apply(this,args);},top(...args){collisions.flip.top.apply(this,args);collisions.fit.top.apply(this,args);}}};$.position={scrollbarWidth(){if(cachedScrollbarWidth!==undefined)return cachedScrollbarWidth;const div=$('<div '+"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>"+"<div style='height:100px;width:auto;'></div></div>");const innerDiv=div.children()[0];$('body').append(div);const w1=innerDiv.offsetWidth;div[0].style.overflow='scroll';let w2=innerDiv.offsetWidth;if(w1===w2)w2=div[0].clientWidth;div.remove();cachedScrollbarWidth=w1-w2;return cachedScrollbarWidth;},getScrollInfo(within){const overflowX=within.isWindow||within.isDocument?'':window.getComputedStyle(within.element[0])['overflow-x'];const overflowY=within.isWindow||within.isDocument?'':window.getComputedStyle(within.element[0])['overflow-y'];const hasOverflowX=overflowX==='scroll'||(overflowX==='auto'&&within.width<within.element[0].scrollWidth);const hasOverflowY=overflowY==='scroll'||(overflowY==='auto'&&within.height<within.element[0].scrollHeight);return {width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0};},getWithinInfo(element){const withinElement=$(element||window);const isWindow=!!withinElement[0]&&withinElement[0]===withinElement[0].window;const isDocument=!!withinElement[0]&&withinElement[0].nodeType===9;const hasOffset=!isWindow&&!isDocument;return {element:withinElement,isWindow,isDocument,offset:hasOffset?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()};}};$.fn.position=function(options){if(!options||!options.of)return _position.apply(this,arguments);options=$.extend({},options);const within=$.position.getWithinInfo(options.within);const scrollInfo=$.position.getScrollInfo(within);const collision=(options.collision||'flip').split(' ');const offsets={};const target=typeof options.of==='string'?$(document).find(options.of):$(options.of);const dimensions=getDimensions(target);const targetWidth=dimensions.width;const targetHeight=dimensions.height;const targetOffset=dimensions.offset;if(target[0].preventDefault)options.at='left top';const basePosition=$.extend({},targetOffset);$.each(['my','at'],function(){let pos=(options[this]||'').split(' ');
41if(pos.length===1)pos=regexHorizontal.test(pos[0])?pos.concat(['center']):regexVertical.test(pos[0])?['center'].concat(pos):['center','center'];pos[0]=regexHorizontal.test(pos[0])?pos[0]:'center';pos[1]=regexVertical.test(pos[1])?pos[1]:'center';const horizontalOffset=regexOffset.exec(pos[0]);const verticalOffset=regexOffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[regexPosition.exec(pos[0])[0],regexPosition.exec(pos[1])[0]];});if(collision.length===1)collision[1]=collision[0];if(options.at[0]==='right')basePosition.left+=targetWidth;else{if(options.at[0]==='center')basePosition.left+=targetWidth/2;}if(options.at[1]==='bottom')basePosition.top+=targetHeight;else{if(options.at[1]==='center')basePosition.top+=targetHeight/2;}const atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){let using;const elem=$(this);const elemWidth=elem.outerWidth();const elemHeight=elem.outerHeight();const marginLeft=parseCss(this,'marginLeft');const marginTop=parseCss(this,'marginTop');const collisionWidth=elemWidth+marginLeft+parseCss(this,'marginRight')+scrollInfo.width;const collisionHeight=elemHeight+marginTop+parseCss(this,'marginBottom')+scrollInfo.height;const position=$.extend({},basePosition);const myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==='right')position.left-=elemWidth;else{if(options.my[0]==='center')position.left-=elemWidth/2;}if(options.my[1]==='bottom')position.top-=elemHeight;else{if(options.my[1]==='center')position.top-=elemHeight/2;}position.left+=myOffset[0];position.top+=myOffset[1];const collisionPosition={marginLeft,marginTop};$.each(['left','top'],function(i,dir){if(collisions[collision[i]])collisions[collision[i]][dir](position,{targetWidth,targetHeight,elemWidth,elemHeight,collisionPosition,collisionWidth,collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within,elem});});if(options.using)using=function(props){const left=targetOffset.left-position.left;const right=left+targetWidth-elemWidth;const top=targetOffset.top-position.top;const bottom=top+targetHeight-elemHeight;const feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?'left':left>0?'right':'center',vertical:bottom<0?'top':top>0?'bottom':'middle'};if(targetWidth<elemWidth&&abs(left+right)<targetWidth)feedback.horizontal='center';if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight)feedback.vertical='middle';if(max(abs(left),abs(right))>max(abs(top),abs(bottom)))feedback.important='horizontal';else feedback.important='vertical';options.using.call(this,props,feedback);};elem.offset($.extend(position,{using}));});};if(!$.hasOwnProperty('ui'))$.ui={};$.ui.position=collisions;})(jQuery);; 42(function($,Drupal){'use strict';$(document).on('autocompleteselect','.form-autocomplete',function(e){$(e.target).trigger('change.formUpdated');});$.widget('ui.autocomplete',$.ui.autocomplete,{_search:function(value){this.pending++;Drupal.Ajax.prototype.glyphiconStart(this.element);this.cancelSearch=false;this.source({term:value},this._response());},_response:function(){var index=++this.requestIndex;return $.proxy(function(content){if(index===this.requestIndex)this.__response(content);this.pending--;if(!this.pending)Drupal.Ajax.prototype.glyphiconStop(this.element);},this);}});})(jQuery,Drupal);; 43(($,Drupal,drupalSettings,once)=>{if(!Drupal.autocomplete)return;const autocomplete={};autocomplete.getSettings=(input,globalSettings)=>{globalSettings=globalSettings||drupalSettings||{};const settings={auto_submit:false,delay:0,min_length:1,selector:':submit'};const search=$(input).data('search-api-autocomplete-search');if(search&&globalSettings.search_api_autocomplete&&globalSettings.search_api_autocomplete[search])$.extend(settings,globalSettings.search_api_autocomplete[search]);return settings;};Drupal.behaviors.searchApiAutocomplete={attach(context,settings){const s='.ui-autocomplete-input[data-search-api-autocomplete-search]';$(once('search-api-autocomplete',s,context)).each(function foreach(){const uiAutocomplete=$(this).data('ui-autocomplete');if(!uiAutocomplete)return;const $element=uiAutocomplete.menu.element;$element.data('search-api-autocomplete-input-id',this.id);$element.addClass('search-api-autocomplete-search');$element.attr('tabindex','-1');const elementSettings=autocomplete.getSettings(this,settings);if(elementSettings.delay)uiAutocomplete.options.delay=elementSettings.delay;if(elementSettings.min_length)uiAutocomplete.options.minLength=elementSettings.min_length;const oldSelect=uiAutocomplete.options.select;uiAutocomplete.options.select=function select(event,ui,...args){if(ui.item.url){if(event.keyCode===9)return false;window.location.href=ui.item.url;return false;}const ret=oldSelect.apply(this,[event,ui,...args]);if(elementSettings.auto_submit&&elementSettings.selector)$(elementSettings.selector,this.form).trigger('click');return ret;};});}};Drupal.SearchApiAutocomplete=autocomplete;})(jQuery,Drupal,drupalSettings,once);; 44(function($,Drupal){'use strict';var isChrome=(/chrom(e|ium)/.test(window.navigator.userAgent.toLowerCase()));if(isChrome){var backButton=false;if(window.performance){var navEntries=window.performance.getEntriesByType('navigation');if(navEntries.length>0&&navEntries[0].type==='back_forward')backButton=true;else{if(window.performance.navigation&&window.performance.navigation.type===window.performance.navigation.TYPE_BACK_FORWARD)backButton=true;}}if(backButton){var attachBehaviors=Drupal.attachBehaviors;Drupal.attachBehaviors=function(context,settings){setTimeout(function(){attachBehaviors(context,settings);},300);};}}})(jQuery,Drupal);; 45(function($,Drupal){const states={postponed:[]};Drupal.states=states;function invert(a,invertState){return invertState&&typeof a!=='undefined'?!a:a;}function compare(a,b){if(a===b)return typeof a==='undefined'?a:true;return typeof a==='undefined'||typeof b==='undefined';}function ternary(a,b){if(typeof a==='undefined')return b;if(typeof b==='undefined')return a;return a&&b;}Drupal.behaviors.states={attach(context,settings){const elements=once('states','[data-drupal-states]',context);const il=elements.length;for(let i=0;i<il;i++){const config=JSON.parse(elements[i].getAttribute('data-drupal-states'));Object.keys(config||{}
45).forEach((state)=>{new states.Dependent({element:$(elements[i]),state:states.State.sanitize(state),constraints:config[state]});});}while(states.postponed.length)states.postponed.shift()();}};states.Dependent=function(args){$.extend(this,{values:{},oldValue:null},args);this.dependees=this.getDependees();Object.keys(this.dependees||{}).forEach((selector)=>{this.initializeDependee(selector,this.dependees[selector]);});};states.Dependent.comparisons={RegExp(reference,value){return reference.test(value);},Function(reference,value){return reference(value);},Array(reference,value){if(!Array.isArray(value))return false;return JSON.stringify(reference.sort())===JSON.stringify(value.sort());},Number(reference,value){return typeof value==='string'?compare(reference.toString(),value):compare(reference,value);}};states.Dependent.prototype={initializeDependee(selector,dependeeStates){this.values[selector]={};Object.keys(dependeeStates).forEach((i)=>{let state=dependeeStates[i];if($.inArray(state,dependeeStates)===-1)return;state=states.State.sanitize(state);this.values[selector][state.name]=null;$(selector).on(`state:${state}`,{selector,state},(e)=>{this.update(e.data.selector,e.data.state,e.value);});new states.Trigger({selector,state});});},compare(reference,selector,state){const value=this.values[selector][state.name];if(reference.constructor.name in states.Dependent.comparisons)return states.Dependent.comparisons[reference.constructor.name](reference,value);return compare(reference,value);},update(selector,state,value){if(value!==this.values[selector][state.name]){this.values[selector][state.name]=value;this.reevaluate();}},reevaluate(){let value=this.verifyConstraints(this.constraints);if(value!==this.oldValue){this.oldValue=value;value=invert(value,this.state.invert);this.element.trigger({type:`state:${this.state}`,value,trigger:true});}},verifyConstraints(constraints,selector){let result;if(Array.isArray(constraints)){const hasXor=$.inArray('xor',constraints)===-1;const len=constraints.length;for(let i=0;i<len;i++)if(constraints[i]!=='xor'){const constraint=this.checkConstraints(constraints[i],selector,i);if(constraint&&(hasXor||result))return hasXor;result=result||constraint;}}else{if($.isPlainObject(constraints)){for(const n in constraints)if(constraints.hasOwnProperty(n)){result=ternary(result,this.checkConstraints(constraints[n],selector,n));if(result===false)return false;}}}return result;},checkConstraints(value,selector,state){if(typeof state!=='string'||/[0-9]/.test(state[0]))state=null;else{if(typeof selector==='undefined'){selector=state;state=null;}}if(state!==null){state=states.State.sanitize(state);return invert(this.compare(value,selector,state),state.invert);}return this.verifyConstraints(value,selector);},getDependees(){const cache={};const _compare=this.compare;this.compare=function(reference,selector,state){(cache[selector]||(cache[selector]=[])).push(state.name);};this.verifyConstraints(this.constraints);this.compare=_compare;return cache;}};states.Trigger=function(args){$.extend(this,args);if(this.state in states.Trigger.states){this.element=$(this.selector);if(!this.element.data(`trigger:${this.state}`))this.initialize();}};states.Trigger.prototype={initialize(){const trigger=states.Trigger.states[this.state];if(typeof trigger==='function')trigger.call(window,this.element);else Object.keys(trigger||{}).forEach((event)=>{this.defaultTrigger(event,trigger[event]);});this.element.data(`trigger:${this.state}`,true);},defaultTrigger(event,valueFn){let oldValue=valueFn.call(this.element);this.element.on(event,function(e){const value=valueFn.call(this.element,e);if(oldValue!==value){this.element.trigger({type:`state:${this.state}`,value,oldValue});oldValue=value;}}.bind(this));states.postponed.push(function(){this.element.trigger({type:`state:${this.state}`,value:oldValue,oldValue:null});}.bind(this));}};states.Trigger.states={empty:{keyup(){return this.val()==='';},change(){return this.val()==='';}},checked:{change(){let checked=false;this.each(function(){checked=$(this).prop('checked');return !checked;});return checked;}},value:{keyup(){if(this.length>1)return this.filter(':checked').val()||false;return this.val();},change(){if(this.length>1)return this.filter(':checked').val()||false;return this.val();}},collapsed:{collapsed(e){return typeof e!=='undefined'&&'value' in e?e.value:!this[0].hasAttribute('open');}}};states.State=function(state){this.pristine=state;this.name=state;let process=true;do{while(this.name.charAt(0)==='!'){this.name=this.name.substring(1);this.invert=!this.invert;}if(this.name in states.State.aliases)this.name=states.State.aliases[this.name];else process=false;}while(process);};states.State.sanitize=function(state){if(state instanceof states.State)return state;return new states.State(state);};
45states.State.aliases={enabled:'!disabled',invisible:'!visible',invalid:'!valid',untouched:'!touched',optional:'!required',filled:'!empty',unchecked:'!checked',irrelevant:'!relevant',expanded:'!collapsed',open:'!collapsed',closed:'collapsed',readwrite:'!readonly'};states.State.prototype={invert:false,toString(){return this.name;}};const $document=$(document);$document.on('state:disabled',(e)=>{const tagsSupportDisable='button, fieldset, optgroup, option, select, textarea, input';if(e.trigger)$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled',e.value).find(tagsSupportDisable).addBack(tagsSupportDisable).prop('disabled',e.value);});$document.on('state:readonly',(e)=>{if(e.trigger)$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-readonly',e.value).find('input, textarea').prop('readonly',e.value);});$document.on('state:required',(e)=>{if(e.trigger)if(e.value){const label=`label${e.target.id?`[for=${e.target.id}]`:''}`;const $label=$(e.target).attr({required:'required','aria-required':'true'}).closest('.js-form-item, .js-form-wrapper').find(label);if(!$label.hasClass('js-form-required').length)$label.addClass('js-form-required form-required');}else $(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required');});$document.on('state:visible',(e)=>{if(e.trigger){let $element=$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper');if(e.target.tagName==='A')$element=$(e.target);$element.toggle(e.value);}});$document.on('state:checked',(e)=>{if(e.trigger)$(e.target).closest('.js-form-item, .js-form-wrapper').find('input').prop('checked',e.value).trigger('change');});$document.on('state:collapsed',(e)=>{if(e.trigger)if(e.target.hasAttribute('open')===e.value)$(e.target).find('> summary').trigger('click');});})(jQuery,Drupal);; 46(function($){$(document).unbind('state:disabled');$(document).bind('state:disabled',function(e){if(e.trigger)$(e.target).attr('disabled',e.value).closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled',e.value).find(':input').attr('disabled',e.value);});})(jQuery);; 47(function($,Drupal,once){'use strict';Drupal.webform=Drupal.webform||{};Drupal.webform.states=Drupal.webform.states||{};Drupal.webform.states.slideDown=Drupal.webform.states.slideDown||{};Drupal.webform.states.slideDown.duration='slow';Drupal.webform.states.slideUp=Drupal.webform.states.slideUp||{};Drupal.webform.states.slideUp.duration='fast';$.fn.hasData=function(data){return (typeof this.data(data)!=='undefined');};$.fn.isWebform=function(){return $(this).closest('form.webform-submission-form, form[id^="webform"], form[data-is-webform]').length?true:false;};$.fn.isWebformElement=function(){return ($(this).isWebform()||$(this).closest('[data-is-webform-element]').length)?true:false;};Drupal.states.Trigger.states.empty.change=function change(){return this.val()==='';};var states=Drupal.states;Drupal.states.Dependent.prototype.compare=function compare(reference,selector,state){var value=this.values[selector][state.name];var name=reference.constructor.name;if(!name){name=$.type(reference);name=name.charAt(0).toUpperCase()+name.slice(1);}if(name in states.Dependent.comparisons)return states.Dependent.comparisons[name](reference,value);if(reference.constructor.name in states.Dependent.comparisons)return states.Dependent.comparisons[reference.constructor.name](reference,value);return _compare2(reference,value);};function _compare2(a,b){if(a===b)return typeof a==='undefined'?a:true;return typeof a==='undefined'||typeof b==='undefined';}Drupal.states.Dependent.comparisons.Object=function(reference,value){if('pattern' in reference)return (new RegExp(reference['pattern'])).test(value);else if('!pattern' in reference)return !((new RegExp(reference['!pattern'])).test(value));else if('less' in reference)return (value!==''&&parseFloat(reference['less'])>parseFloat(value));else if('less_equal' in reference)return (value!==''&&parseFloat(reference['less_equal'])>=parseFloat(value));else if('greater' in reference)return (value!==''&&parseFloat(reference['greater'])<parseFloat(value));else if('greater_equal' in reference)return (value!==''&&parseFloat(reference['greater_equal'])<=parseFloat(value));else if('between' in reference||'!between' in reference){if(value==='')return false;var between=reference['between']||reference['!between'];var betweenParts=between.split(':');var greater=betweenParts[0];var less=(typeof betweenParts[1]!=='undefined')?betweenParts[1]:null;var isGreaterThan=(greater===null||greater===''||parseFloat(value)>=parseFloat(greater));var isLessThan=(less===null||less===''||parseFloat(value)<=parseFloat(less));var result=(isGreaterThan&&isLessThan);return (reference['!between'])?!result:result;}else return reference.indexOf(value)!==false;};var $document=$(document);$document.on('state:required',function(e){if(e.trigger&&$(e.target).isWebformElement()){var $target=$(e.target);toggleRequired($target.find('input[type="file"]'),e.value);if($target.is('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other, .js-webform-type-webform-entity-radios, .webform-likert-table')){$target.toggleClass('required',e.value);toggleRequired($target.find('input[type="radio"]'),e.value);}if($target.is('.js-form-type-checkboxes, .js-form-type-webform-checkboxes-other, .js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other')){$target.toggleClass('required',e.value);var $checkboxes=$target.find('input[type="checkbox"]');if(e.value){$checkboxes.on('click',statesCheckboxesRequiredEventHandler);checkboxesRequired($target);}else{$checkboxes.off('click',statesCheckboxesRequiredEventHandler);toggleRequired($checkboxes,false);}}if($target.is('.js-webform-tableselect')){$target.toggleClass('required',e.value);var isMultiple=$target.is('[multiple]');if(isMultiple){var $tbody=$target.find('tbody');var $checkboxes=$tbody.find('input[type="checkbox"]');copyRequireMessage($target,$checkboxes);if(e.value){$checkboxes.on('click change',statesCheckboxesRequiredEventHandler);checkboxesRequired($tbody);}else{$checkboxes.off('click change ',statesCheckboxesRequiredEventHandler);toggleRequired($tbody,false);}}else{var $radios=$target.find('input[type="radio"]');copyRequireMessage($target,$radios);toggleRequired($radios,e.value);}}if($target.is('.js-form-type-webform-select-other, .js-webform-type-webform-select-other')){var $select=$target.find('select');toggleRequired($select,e.value);copyRequireMessage($target,$select);}if($target.find('> label:not([for])').length)$target.find('> label').toggleClass('js-form-required form-required',e.value);if($target.is('.js-webform-type-radios, .js-webform-type-checkboxes, fieldset'))$target.find('legend span.fieldset-legend:not(.visually-hidden),legend span.fieldset__label:not(.visually-hidden)').toggleClass('js-form-required form-required',e.value);if($target.is('fieldset'))$target.removeAttr('required aria-required');}});$document.on('state:checked',function(e){if(e.trigger)$(e.target).trigger('change');});$document.on('state:readonly',function(e){if(e.trigger&&$(e.target).isWebformElement()){$(e.target).prop('readonly',e.value).closest('.js-form-item, .js-form-wrapper').toggleClass('webform-readonly',e.value).find('input, textarea').prop('readonly',e.value);$(e.target).trigger('webform:readonly').find('select, input, textarea, button').trigger('webform:readonly');}});$document.on('state:visible state:visible-slide',function(e){if(e.trigger&&$(e.target).isWebformElement())if(e.value)$(':input',e.target).addBack().each(function(){restoreValueAndRequired(this);triggerEventHandlers(this);});else $(':input',e.target).addBack().each(function(){backupValueAndRequired(this);clearValueAndRequired(this);triggerEventHandlers(this);});});$document.on('state:visible-slide',function(e){if(e.trigger&&$(e.target).isWebformElement()){var effect=e.value?'slideDown':'slide
47Up';var duration=Drupal.webform.states[effect].duration;$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper')[effect](duration);}});Drupal.states.State.aliases['invisible-slide']='!visible-slide';$document.on('state:disabled',function(e){if(e.trigger&&$(e.target).isWebformElement()){$(e.target).prop('disabled',e.value).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled',e.value).find('select, input, textarea, button').prop('disabled',e.value);var fileElements=$(e.target).find(':input[type="hidden"][name$="[fids]"]');if(fileElements.length){if($(e.target).is('fieldset'))$(e.target).prop('disabled',false);fileElements.removeAttr('disabled');}$(e.target).trigger('webform:disabled').find('select, input, textarea, button').trigger('webform:disabled');}});Drupal.behaviors.webformCheckboxesRequired={attach:function(context){$(once('webform-checkboxes-required','.js-form-type-checkboxes.required, .webform-term-checkboxes.required, .js-form-type-webform-checkboxes-other.required, .js-webform-type-checkboxes.required, .js-webform-type-webform-checkboxes-other.required, .js-webform-type-webform-radios-other.checkboxes',context)).each(function(){var $element=$(this);$element.find('input[type="checkbox"]').on('click',statesCheckboxesRequiredEventHandler);setTimeout(function(){checkboxesRequired($element);});});}};Drupal.behaviors.webformRadiosRequired={attach:function(context){$(once('webform-radios-required','.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other, .js-webform-type-webform-entity-radios, .js-webform-type-webform-scale',context)).each(function(){var $element=$(this);setTimeout(function(){radiosRequired($element);});});}};Drupal.behaviors.webformTableSelectRequired={attach:function(context){$(once('webform-tableselect-required','.js-webform-tableselect.required',context)).each(function(){var $element=$(this);var $tbody=$element.find('tbody');var isMultiple=$element.is('[multiple]');if(isMultiple)$tbody.find('input[type="checkbox"]').on('click change',function(){checkboxesRequired($tbody);});setTimeout(function(){isMultiple?checkboxesRequired($tbody):radiosRequired($element);});});}};function checkboxesRequired($element){var $firstCheckbox=$element.find('input[type="checkbox"]').first();var isChecked=$element.find('input[type="checkbox"]').is(':checked');toggleRequired($firstCheckbox,!isChecked);copyRequireMessage($element,$firstCheckbox);}function radiosRequired($element){var $radios=$element.find('input[type="radio"]');var isRequired=$element.hasClass('required');toggleRequired($radios,isRequired);copyRequireMessage($element,$radios);}function statesCheckboxesRequiredEventHandler(){var $element=$(this).closest('.js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other, .js-webform-type-webform-term-checkboxes, .js-webform-tableselect tbody');checkboxesRequired($element);}function triggerEventHandlers(input){var $input=$(input);var type=input.type;var tag=input.tagName.toLowerCase();var extraParameters=['webform.states'];if(type==='checkbox'||type==='radio')$input.trigger('change',extraParameters).trigger('blur',extraParameters);else if(tag==='select'){if($input.closest('.webform-type-address').length){if(!$input.data('webform-states-address-initialized')&&$input.attr('autocomplete')==='country'&&$input.val()===$input.find("option[selected]").attr('value'))return;$input.data('webform-states-address-initialized',true);}$input.trigger('change',extraParameters).trigger('blur',extraParameters);}else{if(type!=='submit'&&type!=='button'&&type!=='file'){var hasInputMask=($.fn.inputmask&&$input.hasClass('js-webform-input-mask'));hasInputMask&&$input.inputmask('remove');$input.trigger('input',extraParameters).trigger('change',extraParameters).trigger('keydown',extraParameters).trigger('keyup',extraParameters).trigger('blur',extraParameters);hasInputMask&&$input.inputmask();}}}function backupValueAndRequired(input){var $input=$(input);var type=input.type;var tag=input.tagName.toLowerCase();if($input.prop('required')&&!$input.hasData('webform-required'))$input.data('webform-required',true);if(!$input.hasData('webform-value'))if(type==='checkbox'||type==='radio')$input.data('webform-value',$input.prop('checked'));else if(tag==='select'){var values=[];$input.find('option:selected').each(function(i,option){values[i]=option.value;});$input.data('webform-value',values);}else{if(type!=='submit'&&type!=='button')$input.data('webform-value',input.value);}}function restoreValueAndRequired(input){var $input=$(input);var value=$input.data('webform-value');
47if(typeof value!=='undefined'){var type=input.type;var tag=input.tagName.toLowerCase();if(type==='checkbox'||type==='radio')$input.prop('checked',value);else if(tag==='select')$.each(value,function(i,option_value){option_value=option_value.replace(/'/g,"\\\'");$input.find("option[value='"+option_value+"']").prop('selected',true);});else{if(type!=='submit'&&type!=='button')input.value=value;}$input.removeData('webform-value');}var required=$input.data('webform-required');if(typeof required!=='undefined'){if(required)$input.prop('required',true);$input.removeData('webform-required');}}function clearValueAndRequired(input){var $input=$(input);if($input.closest('[data-webform-states-no-clear]').length)return;var type=input.type;var tag=input.tagName.toLowerCase();if(type==='checkbox'||type==='radio')$input.prop('checked',false);else if(tag==='select')if($input.find('option[value=""]').length)$input.val('');else input.selectedIndex=-1;else{if(type!=='submit'&&type!=='button')input.value=(type==='color')?'#000000':'';}$input.prop('required',false);}function toggleRequired($input,required){var isCheckboxOrRadio=($input.attr('type')==='radio'||$input.attr('type')==='checkbox');if(required)if(isCheckboxOrRadio)$input.attr({'required':'required'});else $input.attr({'required':'required','aria-required':'true'});else{if(isCheckboxOrRadio)$input.removeAttr('required');else $input.removeAttr('required aria-required');$input.each(function(){this.setCustomValidity&&this.setCustomValidity('');});}}function copyRequireMessage($source,$destination){if($source.attr('data-msg-required'))$destination.attr('data-msg-required',$source.attr('data-msg-required'));}})(jQuery,Drupal,once);; 48(function($,Drupal){'use strict';$(document).on('state:required',function(e){if(e.trigger&&$(e.target).isWebform()){var $target=$(e.target);if($target.is('.js-form-wrapper.panel'))if(e.value)$target.find('.panel-heading .panel-title').addClass('js-form-required form-required');else $target.find('.panel-heading .panel-title').removeClass('js-form-required form-required');}});})(jQuery,Drupal);;
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.