"use strict";function getWidth(){return Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth)}function getHeight(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight)}site.colors={blueline:"#003da5",greenline:"#00843d",redline:"#da291c",orangeline:"#ed8b00",bus:"#ffc72c",lightgray:"#888b8c",palette:{purple:"#4d4f96",blue:"#249fda",red:"#ee2e24",green:"#2bb673",teal:"#88d1d1",orange:"#f15a31",gold:"#ffd620",pink:"#f17db1"}},window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;--t>=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o});var childrenMatches=function(e,t){return Array.prototype.filter.call(e.children,(function(e){return e.matches(t)}))};function checkMobile(){site.screenWidth=getWidth(),site.screenWidth<site.breakSm?(site.isMobile=!0,site.isTablet=!1,site.isDesktop=!1,site.isMassive=!1):site.screenWidth>site.breakSm&&site.screenWidth<=site.breakMd?(site.isMobile=!1,site.isTablet=!0,site.isDesktop=!1,site.isMassive=!1):site.screenWidth>site.breakMd&&site.screenWidth<=site.breakLg?(site.isMobile=!1,site.isTablet=!1,site.isDesktop=!0,site.isMassive=!1):site.screenWidth>site.breakLg&&(site.isMobile=!1,site.isTablet=!1,site.isDesktop=!1,site.isMassive=!0)}site.breakSm=768,site.breakMd=1280,site.breakLg=1925,site.isMobile,site.isDesktop,site.isMassive,site.isTransitioningToMobile=!1,site.isTransitioningToDesktop=!1,site.isTransitioningToMassive=!1,site.isShowingEverything=!1,site.isShowingTransportation=!1,site.isShowingMarkers=!1,site.isHidingLabels=!1,site.screenWidth=getWidth(),site.screenHeight=getHeight(),site.navbar=document.getElementById("#navbar"),site.$projectSliderWrapper=document.querySelector(".project-slider-wrapper"),site.lockBody,site.unlockBody,site.googleMap,site.markers=[],site.mapStyleControl=document.getElementById("style-selector-control"),site.isLayoutStamped=!0,site.firstClickActivated=!1,page.glide,checkMobile(),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return(void 0===t||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e});var forEach=function(e,t){Array.prototype.forEach.call(e,t)};function getParameterByName(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}document.addEventListener("DOMContentLoaded",(function(){function e(e,t,n){let o=new IntersectionObserver(t,n||{});return o.observe(e),o}let t;t=document.getElementById("product-page")&&!site.isMobile?.4:.2;let n={rootMargin:"0px",threshold:t},o={rootMargin:"0px",threshold:.4},i={rootMargin:"0px",threshold:.2},r=document.getElementById("navbar-js");if(r&&(e(r,(function(e,t){let[n]=e;n.isIntersecting?document.body.classList.remove("show-smaller-header"):document.body.classList.add("show-smaller-header")}),i),e(r,(function(e,t){let[n]=e;n.isIntersecting?document.body.classList.remove("prep-smaller-header"):document.body.classList.add("prep-smaller-header")}),n),e(r,(function(e,t){let[n]=e;n.isIntersecting?document.body.classList.remove("add-transition-header"):document.body.classList.add("add-transition-header")}),o)),document.getElementById("artwork-list")){mixitup("#artwork-list",{multifilter:{enable:!0},selectors:{target:".artwork-item"},animation:{enable:!1},callbacks:{onMixStart:function(e,t){console.log(t.activeFilter.selector)}}});let e=document.getElementById("exhibition-filter-list");if(e){if(e.hasAttribute("data-gallery")){console.log("I see multi galleries, and a permalink");let t=e.dataset.gallery;console.log("galleryId",t);let n=document.getElementById(t);n&&(n.click(),location.replace("#artwork-section"))}e.querySelectorAll("input").forEach((function(e){e.addEventListener("click",(function(){let t=history.state,n=document.title,o=window.location.origin+"/art/exhibit:"+e.id;console.log("url",o),history.pushState(t,n,o)}))}))}}if(document.getElementById("artists-page")){let e=mixitup("#artist-list",{multifilter:{enable:!0},selectors:{target:".artist-item"},animation:{enable:!1}}),t=[],n=document.querySelectorAll(".artist-item"),o=0;n.forEach((function(e){let n=e.querySelector(".artwork-artist-name").innerHTML;t.push({name:n,index:o}),o++}));const i=new Fuse(t,{includeScore:!0,threshold:.2,keys:["name"]});let r=document.getElementById("search-form"),l=document.getElementById("search-field");r.addEventListener("keyup",(function(t){var n=l.value;const r=i.search(n);let s="";for(o=0;o<r.length;o++){let e=r[o].item.name.replace(/\s+/g,"-").toLowerCase();e=e.replace(/\’/g,"-"),e=e.replace(/\'/g,"-"),e=e.replace(/\./g,""),s+=0==o?"."+e:", ."+e}""!=n?e.filter(s):e.show()})),document.querySelectorAll(".filter-select").forEach((function(e,t){e.addEventListener("change",(function(){console.log("reset now"),r.reset()}))})),document.querySelector(".filter-clear").addEventListener("click",(function(){r.reset()}))}if(document.getElementById("classes-list")){console.log("have a classes list");mixitup("#classes-list",{multifilter:{enable:!0},selectors:{target:".class-item"},animation:{enable:!1},callbacks:{onMixStart:function(e,t){console.log(t.activeFilter.selector)}}})}if(document.getElementById("permanent-collection-page")){let e=document.querySelector(".popdown-list");document.querySelectorAll(".filter-select").forEach((function(t,n){t.addEventListener("change",(function(){e.classList.remove("show-team-member")}))}))}if(document.querySelector(".homepage-glide")&&new Glide(".glide").mount(),document.getElementById("materials-button")){var l=document.getElementById("partial-course-materials");l.style.display="block";var s=document.getElementById("full-course-materials");s.style.display="none"}let c=document.getElementById("artist-section");if(c&&window.location.host.includes("shop.nantucketarts.org")){let e="https://www.nantucketarts.org/artists/"+c.dataset.artist+".json";console.log("url",e),fetch(e).then((function(e){return e.ok?e.json():Promise.reject(e)})).then((function(e){let t;console.log(e),t=""!=e.image?e.image:e.representative,document.getElementById("artist-picture-img").src=t,document.getElementById("artist-bio").innerHTML=e.bio,""==e.image&&""==e.bio&&(c.style.display="none")})).catch((function(e){c.style.display="none",console.warn("Something went wrong.",e)}))}let a=function(){console.log("productGlider.init()");let e=document.getElementById("product-image");if(e){let t=document.querySelectorAll(".product-image-thumbnail");if(t&&t.length){console.log("thumbnails",t);let n=new Glide(e,{gap:0}).mount();t.forEach((function(e,o){e.addEventListener("click",(function(){n.go("="+o),t.forEach((function(e,t){e.classList.remove("is-active")})),e.classList.add("is-active")}))}))}}};if((document.getElementById("product-page")||document.getElementById("event-page")||document.getElementById("permanent-art-page"))&&a(),document.getElementById("art-page")){if(document.getElementById("featured-artist-glider")){new Glide(".featured-artist-glider",{gap:0,perView:3,bound:!0,breakpoints:{768:{perView:2}}}).mount()}}if(document.querySelector(".shopify-art-page")){if(document.getElementById("product-image")){let e=document.querySelector(".shopify-picture");document.querySelectorAll(".shopify-picture img").forEach((function(t,n){new Drift(t,{paneContainer:e,zoomFactor:2})}))}}if(document.querySelector("#permanent-art-page")&&!site.isMobile){let e=document.querySelectorAll(".pc-picture");e&&e.forEach((function(e,t){let n=e.querySelector("img");new Drift(n,{paneContainer:e,zoomFactor:2})}))}if(document.querySelector(".timeline-glide")){let e=new Glide(".glide",{type:"carousel",animationTimingFunc:"ease",animationDuration:600,gap:0,hoverpause:!1}),t=document.querySelectorAll(".timeline-control"),n=document.getElementById("timeline-entry-year"),o=document.getElementById("timeline-entry-text");t.forEach((function(i,r){i.addEventListener("click",(function(){console.log("elem",r);let l=i.dataset.year,s=i.dataset.text;n.innerHTML=l,o.innerHTML=s,t.forEach((function(e,t){e.classList.remove("active-control")})),i.classList.add("active-control"),e.go("="+r)}))}));let i=document.getElementById("timeline-arrow-prev"),r=document.getElementById("timeline-arrow-next"),l=0;i.addEventListener("click",(function(){t.forEach((function(e,t){e.classList.contains("active-control")&&(l=t)})),console.log("currentSlideIndex",l),0==l?t[t.length-1].click():t[l-1].click()})),r.addEventListener("click",(function(){t.forEach((function(e,t){e.classList.contains("active-control")&&(l=t)})),l==t.length-1?t[0].click():t[l+1].click()})),e.on("run",(function(){})),e.mount()}if(document.addEventListener("click",(function(e){(e.target.matches("#menu-button-wrapper")||e.target.parentElement.matches("#menu-button-wrapper")||e.target.matches(".menu-link"))&&document.body.classList.toggle("menu-is-open"),e.target.closest("header")||document.body.classList.remove("menu-is-open"),e.target.matches(".close"),e.target.matches("#materials-button")&&(console.log("materials clicked"),console.log(e.target.innerHTML),e.target.innerHTML="read more"===e.target.innerHTML?"read less":"read more",l.style.display="none"===l.style.display?"block":"none",console.log(l.style.display),s.style.display="none"===s.style.display?"block":"none")}),!1),document.getElementById("about-page")){let e,t=document.querySelectorAll(".popdown"),n=(t.length,[].slice.call(t));e=site.isMobile?2:document.getElementById("about-page")?6:4;let o=null,i=!1,r=document.getElementById("glide__arrows"),l=document.getElementById("glide__slides");t.forEach((function(t){t.addEventListener("click",(function(){let s=JSON.parse(t.dataset.details);if(s.allowClick){let g=t.closest(".popdown-list"),p=g.querySelectorAll(".popdown"),h=[].slice.call(p),f=g.querySelector(".member-popup-box"),y=(f.querySelector(".member-popup-picture-wrapper"),f.querySelector(".member-popup-left")),E=f.querySelector(".member-popup-right"),b=h.indexOf(t),v=b+1;if(v%e==0)f.style.order=v;else{let t=n[b+(e-v%e)];f.style.order=t?[].indexOf.call(n,t)+1:520}if(g.classList.add("show-team-member"),void 0!==s.images&&null!==l){for(i&&(o.destroy(),i=!1);l.firstChild;)l.removeChild(l.firstChild);s.glide__slides="";for(var c=0;c<s.images.length;c++){let e=s.images[c];var a=document.createElement("li"),d=document.createElement("figure"),u=document.createElement("figcaption"),m=document.createElement("img");a.className="glide__slide",m.src=e.url,m.alt=e.caption,u.innerHTML=e.caption,d.appendChild(m),d.appendChild(u),a.appendChild(d),l.appendChild(a),r.style.display=c>0?"block":"none"}}y.childNodes.forEach((function(e){let t=e.id;s.hasOwnProperty(t)&&(e.innerHTML=s[t])})),E.childNodes.forEach((function(e){let t=e.id;s.hasOwnProperty(t)&&(e.innerHTML=s[t])})),null!==l&&l.childElementCount>1&&(console.log("mount glide"),o=new Glide("#glide",{gap:0,type:"carousel"}),imagesLoaded(l,(function(e){o.mount(),i=!0}))),t.querySelector("#"+t.dataset.anchor).scrollIntoView({behavior:"instant"})}}))})),document.querySelectorAll(".member-popup-close-wrapper").forEach((function(e){e.addEventListener("click",(function(){e.closest(".popdown-list").classList.remove("show-team-member")}))}))}if(document.getElementById("home-page"),document.getElementById("home-page")){!function(e,t,n){let o=new ResizeObserver(t,n||{});o.observe(e)}(document.body,(function(e,t){let[n]=e}))}let d=document.getElementsByTagName("a"),u=d.length;for(var m=0;m<u;m++){let e=d[m].host;e!==window.location.host&&""!=e&&"www.nantucketarts.org"!=e&&"shop.nantucketarts.org"!=e&&"nantucket-arts.myshopify.com"!=e&&"nantucketarts.loc"!=e&&"114321.blackbaudhosting.com"!=e&&(d[m].target="_blank")}if(document.getElementById("customers-login-page")){var g={RecoverHeading:"#RecoverHeading",RecoverEmail:"#RecoverEmail",LoginHeading:"#LoginHeading"};let e=document.querySelector(g.RecoverHeading),t=document.querySelector(g.RecoverEmail),n=document.querySelector(g.LoginHeading);var p=document.getElementById("RecoverPassword"),h=document.getElementById("HideRecoverPasswordLink");function o(){document.getElementById("RecoverPasswordForm").classList.remove("is-hidden"),document.getElementById("CustomerLoginForm").classList.add("is-hidden"),"true"===t.getAttribute("aria-invalid")&&t.focus()}function i(){document.getElementById("RecoverPasswordForm").classList.add("is-hidden"),document.getElementById("CustomerLoginForm").classList.remove("is-hidden")}p&&p.addEventListener("click",function(t){console.log("clicked recoverPassword"),t.preventDefault(),o(),e.setAttribute("tabindex","-1"),e.focus()}.bind(this)),h&&h.addEventListener("click",function(e){e.preventDefault(),i(),n.setAttribute("tabindex","-1"),n.focus()}.bind(this)),e&&e.addEventListener("blur",(function(e){e.target.removeAttribute("tabindex")})),n&&n.addEventListener("blur",(function(e){e.target.removeAttribute("tabindex")}));var f=document.getElementById("AddressNewForm"),y=document.getElementById("AddressNewButton");if(!f)return;Shopify&&new Shopify.CountryProvinceSelector("AddressCountryNew","AddressProvinceNew",{hideElement:"AddressProvinceContainerNew"}),document.querySelectorAll(".address-country-option").forEach((function(e){var t=e.dataset.formId,n="AddressCountry_"+t,o="AddressProvince_"+t,i="AddressProvinceContainer_"+t;new Shopify.CountryProvinceSelector(n,o,{hideElement:i})})),document.querySelectorAll(".address-new-toggle").forEach((function(e){e.addEventListener("click",(function(){var e="true"===y.getAttribute("aria-expanded");f.classList.toggle("is-hidden"),y.setAttribute("aria-expanded",!e),y.focus()}))})),document.querySelectorAll(".address-edit-toggle").forEach((function(e){e.addEventListener("click",(function(e){var t=e.target.dataset.formId,n=document.getElementById("EditFormButton_"+t),o=document.getElementById("EditAddress_"+t),i="true"===n.getAttribute("aria-expanded");o.classList.toggle("is-hidden"),n.setAttribute("aria-expanded",!i),n.focus()}))})),document.querySelectorAll(".address-delete").forEach((function(e){e.addEventListener("click",(function(e){var t=e.target.dataset.target,n=e.target.dataset.confirmMessage;confirm(n||"Are you sure you wish to delete this address?")&&Shopify.postLink(t,{parameters:{_method:"delete"}})}))})),"#recover"===window.location.hash&&o.bind(this)()}}));
