PageSourceSearch

https://www.salon.com/app/themes/salon/dist/assets/global.js?ver=1.0.31

js salon.com collected 2026-09-24 06:03:33 UTC 37,422 bytes, 1 lines download raw bytes

1import{g as He}from"./security-tokens.js";document.addEventListener("DOMContentLoaded",function(){window.globalItems=[],window.lazyLoadRequestId=0,window.deviceType=Je(),"IntersectionObserver"in window?typeof intersectionObservers>"u"&&(window.intersectionObservers=[]):(window.addEventListener("scroll",oe(H,16)),window.addEventListener("resize",oe(H,16))),se("iframe.lazy","forever",500,0,"on",""),window.lazyLoadItems=se});function Je(){const e=navigator.userAgent.toLowerCase(),t=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/,n=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;return t.test(e)||n.test(e)?"mobile":"desktop"}function Ye(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function oe(e,t,n={}){let r,o,s,i,a=0;const l=()=>{a=n.leading===!1?0:Date.now(),s=null,i=e.apply(r,o),s||(r=o=null)};return function(...d){const m=Date.now();!a&&n.leading===!1&&(a=m);const _=t-(m-a);return r=this,_<=0||_>t?(s&&(clearTimeout(s),s=null),a=m,i=e.apply(r,d),s||(r=d=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,_)),i}}function H(){globalItems.forEach(e=>{e.style==="once"&&e.used>0||e.items.forEach(t=>{t.offsetTop<window.innerHeight+window.scrollY+e.in_advance&&(t.tagName==="IMG"||t.tagName==="IFRAME"?(t.dataset.src&&(t.src=t.dataset.src),t.dataset.srcset&&(t.srcset=t.dataset.srcset),t.onload=function(){t.classList.add("loaded")}):t.dataset.callback&&typeof window[t.dataset.callback]=="function"&&window[t.dataset.callback](),e.used++)})})}function ze(e,t){e.forEach(function(n){n.isIntersecting&&(t.unobserve(n.target),n.target.tagName==="IMG"||n.target.tagName==="IFRAME"?(n.target.dataset.src&&(n.target.src=n.target.dataset.src),n.target.dataset.srcset&&(n.target.srcset=n.target.dataset.srcset),n.target.onload=function(){n.target.classList.add("loaded")}):n.target.classList.contains("video-background-image")?(n.target.style.backgroundImage="url('"+n.target.dataset.src+"')",n.target.classList.add("loaded")):n.target.dataset.callback&&window[n.target.dataset.callback]())})}function se(e,t,n,r,o,s){if(window.lazyLoadRequestId++,o==="off"||o!=="on"&&deviceType!==o){const d=o==="off"?"status is set to off":"device type is: "+deviceType+" and your status is set to: "+o;console.log("Not lazy loading because "+d),s&&s();return}let i=!1,a=null;if("IntersectionObserver"in window){i=!0;const d={rootMargin:n+"px 0px "+n+"px 0px"};a=new IntersectionObserver(ze,d),intersectionObservers.push(a)}const l=document.querySelectorAll(e);l.forEach(d=>{if(!d.dataset.callback){if(s){const m=`lazy-load-${Ye()}-${lazyLoadRequestId}`;window[m]=s,d.dataset.callback=m}r>0&&setTimeout(()=>{window[d.dataset.callback]()},r),i&&a.observe(d)}}),i||(globalItems.push({style:t,items:l,in_advance:n,used:0}),H())}document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".button__burger").forEach(e=>{const t=document.getElementById(e.getAttribute("aria-controls"));e.addEventListener("click",function(){const r=!(e.getAttribute("aria-pressed")==="true");e.setAttribute("aria-pressed",r);const o=new CustomEvent("toggle",{detail:{pressed:r}});e.dispatchEvent(o)}),e.addEventListener("toggle",function(n){t.setAttribute("aria-expanded",n.detail.pressed?"true":"false")}),document.body.addEventListener("click",function(n){t.getAttribute("aria-expanded")==="true"&&!t.contains(n.target)&&!e.contains(n.target)&&(e.setAttribute("aria-pressed",!1),t.setAttribute("aria-expanded","false"))})})});function We(e){e?document.body.setAttribute("data-processing","true"):document.body.removeAttribute("data-processing")}window.togglePageLoader=We;document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".menu-item-has-children > a").forEach(e=>{e.addEventListener("click",function(t){t.preventDefault();const n=this.parentElement,o=!(n.getAttribute("aria-pressed")==="true");n.setAttribute("aria-pressed",o?"true":"false");const s=new CustomEvent("toggle",{detail:{pressed:o}});n.dispatchEvent(s)})}
1),document.querySelectorAll(".current-menu-ancestor").forEach(e=>{e.setAttribute("aria-pressed","true")})});function Ke(e){const t=document.getElementById(e);if(!t){console.error(`openModal: Modal with id '${e}' not found.`);return}t.setAttribute("aria-hidden","false");const n=new CustomEvent("toggle",{detail:{modalId:e,state:"open"}});t.dispatchEvent(n)}function Ve(e){const t=document.getElementById(e);if(!t){console.error(`closeModal: Modal with id '${e}' not found.`);return}t.setAttribute("aria-hidden","true");const n=new CustomEvent("toggle",{detail:{modalId:e,state:"close"}});t.dispatchEvent(n)}window.openModal=Ke;window.closeModal=Ve;function Xe(e,t="alert-modal",n=!1){const r=document.getElementById(t);if(!r){console.error(`Modal with id '${t}' not found.`);return}const o=r.querySelector(".modal__content > .message");o&&(n?o.innerHTML=e:o.textContent=e),openModal(t)}function Qe(e="alert-modal"){closeModal(e)}window.openAlertModal=Xe;window.closeAlertModal=Qe;const p={utm:"salon_subscription_tracking_utm_first_touch",cta:"salon_subscription_tracking_cta_context",plan:"salon_subscription_tracking_plan_context",sessions:"salon_subscription_tracking_sessions",emitted:"salon_subscription_tracking_emitted",gaClientId:"salon_subscription_tracking_ga_client_id"},V={memberpressBeginCheckout:"salon_subscription_tracking_mp_begin_checkout",gaSessionId:"salon_subscription_tracking_ga_session_id"},B={header:{cta_id:"site_header",cta_position:"header_left",cta_variant:"subscribe"},article:{cta_id:"in_article",cta_position:"article",cta_variant:"progressive_journalism"},footer:{cta_id:"site_footer",cta_position:"footer_right",cta_variant:"go_ad_free"}},J={"/join/premium-monthly":{plan_key:"premium_monthly",plan_name:"Salon Premium Monthly Membership",plan_tier:"premium",interval:"monthly",value:9.95,currency:"USD"},"/join/premium-annual":{plan_key:"premium_annual",plan_name:"Salon Premium Annual Membership",plan_tier:"premium",interval:"annual",value:49,currency:"USD"}},Ze={utm_source:"",utm_medium:"",utm_campaign:"",utm_content:"",utm_term:""},et={cta_id:"",cta_position:"",cta_variant:"",content_category:""},F={cta_id:"other_premium_link",cta_position:"other",cta_variant:"premium"},ie=120,tt=500,nt=500;let Y=!1,D=null,y=null;function h(){return window.salonSubscriptionTracking||{}}function q(){return h().pageContext||{}}function me(e,t){try{return e?JSON.parse(e):t}catch{return t}}function b(e,t){try{return me(window.localStorage.getItem(e),t)}catch{return t}}function L(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function rt(e,t){try{return me(window.sessionStorage.getItem(e),t)}catch{return t}}function ot(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function ge(e){const t=document.cookie.match(`(?:^|; )${e}=([^;]*)`);return t?decodeURIComponent(t[1]):""}function pe(){const e=st(p.gaClientId);if(e)return e;const t=ge("_ga"),n=t.split(".");return t.startsWith("GA")&&n.length>=4?n.slice(-2).join("."):""}function M(){return at()||it(V.gaSessionId)}function st(e){const t=b(e,"");return typeof t=="string"?t:""}function it(e){const t=rt(e,"");return typeof t=="string"?t:""}function at(){const e=h().measurementId;if(!e)return"";const t=ge(`_ga_${e.replace(/^G-/,"")}`),n=t.match(/(?:^|[.$])s(\d+)(?:[.$]|$)/);if(n)return n[1];const r=t.split(".");return/^GS\d+$/.test(r[0])&&/^\d+$/.test(r[2])?r[2]:""}function ae(){Y=!1,D&&(window.clearTimeout(D),D=null)}function ct(){const e=h().measurementId;return!e||typeof window.gtag!="function"||Y?!1:(Y=!0,D=window.setTimeout(ae,nt),window.gtag("get",e,"client_id",t=>{t&&(L(p.gaClientId,t),P())}),window.gtag("get",e,"session_id",t=>{ae(),t&&(ot(V.gaSessionId,String(t)),P())}),!!M())}function he(){if(M()){P();return}if(y)return;let e=0;const t=()=>{e+=1,(M()||ct()||e>=ie)&&(y&&(window.clearInterval(y),y=null),P())};t(),!M()&&e<ie&&(y=window.setInterval(t,tt))}function ut(e){try{window.sessionStorage.removeItem(e)}catch{}}function k(e){window.dataLayer=window.dataLayer||[],window.dataLayer.push(e)}function lt(e){return e.replace(/\/+$/,"")||"/"}function S(){return q().contentCategory||"site"}function dt(){const e=b(p.utm,null);if(e)return e;const t=Ft();return Gt(e,t)}function I(){return b(p.utm,Ze)}function X(){return b(p.cta,et)}function _e(e){L(p.cta,{...e,content_category:e.content_category||S()})}function ye(){return b(p.plan,null)}function ft(e){L(p.plan,e)}function U(){return b(p.sessions,[])}function we(e){L(p.sessions,Array.from(new Set(e.filter(Boolean))))}function be(e){const t=U();t.push(e),we(t)}function mt(e){we(U().filter(t=>t!==e))}function ke(){return b(p.emitted,{})}function x(e,t){return!!ke()[`${e}:${t}`]}function O(e,t){const n=ke();n[`${e}:${t}`]=!0,L(p.emitted,n)}function Se(e){return e.closest('[data-subscription-cta-region="header"], .header__desktop, .header__mobile')?B.header:e.closest('[data-subscription-cta-region="footer"], footer, .navigation__mobile-go-ad-free')?B.footer:e.closest("article, .article__main, .article__content")?B.article:null}function Q(e){try{return lt(new URL(e.href,window.location.origin).pathname)}catch{return""}}function ve(e){const t=e.dataset.planKey;return t?Object.values(J).find(n=>n.plan_key===t)||null:J[Q(e)]||null}function gt(e){const t=Se(e);if(!t)return;const n={event:"select_homepage_cta",...t,content_category:S(),...I()};_e(n),k(n)}function ce(e){const t=ve(e),n={event:"select_premium_cta",...Bt(e),destination_path:Q(e),plan_key:t?.plan_key||"",plan_name:t?.plan_name||"",content_category:S(),...I()};_e(n),k(n)}function pt(e){const t=ve(e);
1if(!t)return;const n=Ht(t);ft(t),ut(V.memberpressBeginCheckout),k(n)}function P(){const e=document.getElementById("mepr_signup_form");e&&Object.entries(Et()).forEach(([t,n])=>{Pt(e,t,n)})}function ht(e){return!e||typeof e!="object"?e:{...e,value:Number(e.value||0),currency:e.currency||"USD"}}function Ee(e){const t=ht(e),n=t.stripe_session_id||"no-session",r=`${t.event}:${n}`;x(t.event,r)||(t.event!=="purchase"&&k(t),O(t.event,r),At(t,r),It(t.event,n))}function _t(){const e=Array.isArray(h().bootstrapEvents)?h().bootstrapEvents:[];(Array.isArray(h().pendingSessionIds)?h().pendingSessionIds:[]).forEach(n=>be(n)),e.forEach(n=>Ee(n))}function Me(){const e=U();return e.length?window.fetch(Tt(e),Ct()).then(t=>t.json()).then(t=>Dt(t).forEach(n=>Ee(n))).catch(qt):Promise.resolve()}function yt(){if(!Z()||!Ut())return;const e=xt();x("checkout_error",e)||(k($t()),O("checkout_error",e))}function wt(){Z()&&(window.addEventListener("error",le,{once:!0}),window.addEventListener("unhandledrejection",le,{once:!0}))}function bt(){document.addEventListener("click",Nt)}function kt(){if(!document.getElementById("mepr_signup_form"))return;P();const t=n=>{const r=n.target;!(r instanceof Element)||!r.closest("#mepr_signup_form")||(he(),P())};document.addEventListener("pointerdown",t),document.addEventListener("focusin",t),document.addEventListener("submit",t,!0)}function St(){y&&(window.clearInterval(y),y=null)}dt();_t();bt();Z()&&he();kt();yt();wt();window.addEventListener("pagehide",St);Me();let ue=0;const vt=window.setInterval(()=>{if(ue+=1,!U().length||ue>=24){window.clearInterval(vt);return}Me()},5e3);function Et(){const e=q().currentPlan,t=X(),n=I();return{salon_tracking_plan_key:Yt(e),salon_tracking_client_id:pe(),salon_tracking_ga_session_id:M(),salon_tracking_ga_identity_status:Mt(),salon_tracking_content_category:t.content_category||S(),salon_tracking_cta_id:t.cta_id||"",salon_tracking_cta_position:t.cta_position||"",salon_tracking_cta_variant:t.cta_variant||"",...zt(n)}}function Mt(){const e=!!pe(),t=!!M();return e&&t?"complete":e?"session_missing":t?"client_missing":"missing"}function Pt(e,t,n){const r=e.querySelector(`[data-salon-tracking-field="${t}"]`);r&&(r.value=n)}function At(e,t){Lt(e,t)&&(k({...e,event:"begin_checkout",begin_checkout_source:"memberpress_hosted_checkout_redirect"}),O("begin_checkout",t))}function Lt(e,t){return e.event==="checkout_session_created"&&h().approximateBeginCheckout&&!x("begin_checkout",t)}function It(e,t){t!=="no-session"&&(e==="checkout_session_created"&&be(t),e==="purchase"&&mt(t))}function Tt(e){const t=new URL(h().eventsEndpoint||"",window.location.origin);return t.searchParams.set("session_ids",e.join(",")),t.toString()}function Ct(){return{credentials:"same-origin"}}function Dt(e){return Array.isArray(e?.events)?e.events:[]}function qt(){}function Z(){return!!document.getElementById("mepr_signup_form")}function Ut(){return!!(document.querySelector(".mepr_error")||document.querySelector("#mepr_error_msg li")||document.querySelector(".mepr_pro_error li"))}function xt(){return`${window.location.pathname}:${q().currentPlan?.plan_key||"unknown"}`}function Ot(){return q().currentPlan||ye()||{}}function $t(){const e=X(),t=Ot();return{...Wt(t),...Kt(e),error_code:"memberpress_page_error",...I()}}function le(){const e=`${window.location.pathname}:runtime`;x("checkout_error",e)||(O("checkout_error",e),k(jt()))}function jt(){return{event:"checkout_error",error_code:"client_runtime_error",content_category:S(),...I()}}function Nt(e){const t=e.target.closest("a[href]");if(!t)return;const n=Q(t);Rt(n,t)}function Rt(e,t){if(e==="/premium"){ce(t),gt(t);return}J[e]&&(ce(t),pt(t))}function Bt(e){const t=Se(e);return{cta_id:e.dataset.ctaId||t?.cta_id||F.cta_id,cta_position:e.dataset.ctaPosition||t?.cta_position||F.cta_position,cta_variant:e.dataset.ctaVariant||t?.cta_variant||F.cta_variant}}function Ft(){const e=new URL(window.location.href);return{utm_source:e.searchParams.get("utm_source")||"",utm_medium:e.searchParams.get("utm_medium")||"",utm_campaign:e.searchParams.get("utm_campaign")||"",utm_content:e.searchParams.get("utm_content")||"",utm_term:e.searchParams.get("utm_term")||""}}function Gt(e,t){return Object.values(t).some(Boolean)?(L(p.utm,t),t):e||t}function Ht(e){return{event:"select_subscription_plan",...e,raw_price_id:"",stripe_session_id:"",...Jt(),...I()}}function Jt(){const e=X();return{cta_id:e.cta_id||"",cta_position:e.cta_position||"",cta_variant:e.cta_variant||"",content_category:e.content_category||S()}}function Yt(e){return e?.plan_key||ye()?.plan_key||""}function zt(e){return{salon_tracking_utm_source:e.utm_source||"",salon_tracking_utm_medium:e.utm_medium||"",salon_tracking_utm_campaign:e.utm_campaign||"",salon_tracking_utm_c
1ontent:e.utm_content||"",salon_tracking_utm_term:e.utm_term||""}}function Wt(e){return{event:"checkout_error",plan_key:e.plan_key||"",plan_name:e.plan_name||"",plan_tier:e.plan_tier||"premium",interval:e.interval||"",value:Number(e.base_price||e.value||0),currency:e.currency||"USD",raw_price_id:"",stripe_session_id:""}}function Kt(e){return{cta_id:e.cta_id||"",cta_position:e.cta_position||"",cta_variant:e.cta_variant||"",content_category:e.content_category||S()}}function Vt(){const e=document.getElementById("mepr_signup_form");if(e){const t=e.getAttribute("action");if(t){if(t.includes("premium-annual")||t.includes("yearly"))return"yearly";if(t.includes("premium-monthly")||t.includes("monthly"))return"monthly"}}return"free"}function Xt(){resetAuthModalMessage(),togglePageLoader(!0),FB.login(function(e){if(e.authResponse){let t=Vt();const n=e.authResponse.accessToken;fetch(siteUrl+"/wp-json/users/login/facebook",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({accessToken:n,plan:t})}).then(async r=>{if(!r.ok)throw new Error("This request cannot be processed");return r.json()}).then(r=>{localStorage.setItem("userDetails",JSON.stringify(r)),window.location.assign(siteUrl)}).catch(()=>{showAuthModalMessage("This request cannot be processed",!0)}).finally(()=>{togglePageLoader(!1)})}else togglePageLoader(!1),showAuthModalMessage("You have cancelled your Facebook authorization",!0)},{scope:"email,public_profile"})}window.fbLogin=Xt;let z;function Pe(e){typeof google<"u"&&google.accounts?e():setTimeout(()=>Pe(e),100)}document.addEventListener("DOMContentLoaded",function(){Pe(()=>{z=google.accounts.oauth2.initTokenClient({client_id:"294188118648-5j46iihhntv104djef1md9lukkl5eh3c.apps.googleusercontent.com",scope:"openid email profile",callback:en})})});function Qt(){if(!z){console.error("Google Auth is not initialized.");return}z.requestAccessToken()}function Zt(){const e=document.getElementById("mepr_signup_form");if(e){const t=e.getAttribute("action");if(t){if(t.includes("premium-annual")||t.includes("yearly"))return"yearly";if(t.includes("premium-monthly")||t.includes("monthly"))return"monthly"}}return"free"}function en(e){let t=e.access_token;resetAuthModalMessage(),togglePageLoader(!0);let n=Zt();fetch(`${siteUrl}/wp-json/users/login/google`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({accessToken:t,plan:n})}).then(r=>r.ok?r.json():r.json().then(o=>{throw new Error(o.message??"This request cannot be processed")})).then(r=>{localStorage.setItem("userDetails",JSON.stringify(r)),window.location.assign(siteUrl)}).catch(r=>{showAuthModalMessage(r.message,!0)}).finally(()=>{togglePageLoader(!1)})}window.googleLogin=Qt;function tn(e){e&&typeof e.preventDefault=="function"&&e.preventDefault(),document.cookie="wordpress_subscriber_user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;",fetch("/wp-json/users/logout",{method:"POST",credentials:"include"}).then(t=>{if(!t.ok)throw new Error("Logout failed")}).catch(()=>{}).finally(()=>{localStorage.removeItem("userDetails"),window.location.reload()})}window.userLogout=tn;let G=null;function nn(){const e=document.cookie.split("; ");e.find(n=>n.startsWith("wordpress_dashboard_user="))&&(e.find(r=>r.startsWith("wordpress_dashboard_user_"))||window.userLogout())}nn();function rn(){return G||(G=new Promise(async(e,t)=>{if(!isSubscriberLoggedIn()){e({});return}let r=getUserDetails();if(!r||!r.loggedIn)try{await window.updateUserDetails(!0,!0),r=getUserDetails()}catch{}e(r)})),G}window.isSubscriberLoggedIn=()=>{const e=document.cookie.split("; "),t=e.find(r=>r.startsWith("wordpress_subscriber_user=")),n=e.find(r=>r.startsWith("wordpress_logged_in_"));return!!t||!!n};window.getUserDetails=()=>{const e=localStorage.getItem("userDetails"),t={userPreferences:{stickyHeader:!1,darkMode:!1}};if(!e)return t;try{return JSON.parse(e)}catch{return t}};window.updateUserDetails=(e=!1,t=!1)=>{const n=fetch("/wp-json/users/user-details",{method:"GET",cache:t?"reload":"default",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then(async r=>{if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.message||"Request failed")}return r.json()}).then(r=>{r.timestamp=Date.now(),localStorage.setItem("userDetails",JSON.stringify(r));try{const s=r.userRoles.includes("premium_member"),i="wordpress_premium_member",a=document.cookie.split(";").some(l=>l.trim().startsWith(i+"="));!s&&a&&(document.cookie=i+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;")}catch{}return r});if(e)return n};function on(){try{const e=getUserDetails();if(e&&e.loggedIn&&e.timestamp){const t=Date.now(),n=e.timestamp,r=5*60*1e3;t-n>r&&updateUserDetails()}}catch(e){console.error("Error checking user details timestamp:",e)}}on();window.fetchUserSessionData=rn;document.addEventListener("DOMContentLoaded",()=>{const e=n=>{const o=`; ${document.cookie}`.split(`; ${n}=`);if(o.length===2)return o.pop().split(";").shift()},t=n=>{document.cookie=n+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"};e("salon_refresh_user")==="1"&&(t("salon_refresh_user"),typeof window.updateUserDetails=="function"&&window.updateUserDetails(!1,!0)),e("salon_needs_logout_cleanup")==="1"&&(localStorage.removeItem("userDetails"),t("salon_needs_logout_cleanup"))});function sn(){fetchUserSessionData().then(e=>{isPremium?(an()?(de("false"),W(!1)):(de("true"),W(!0)),fetch("/wp-json/users/preferences/stickyHeader",{method:"POST"}).then(n=>{if(!n.ok)throw new Error("Request failed")}
1).catch(n=>{console.log(n)})):openAlertModal("Sticky Header is a Premium feature. Please subscribe to continue")}).catch(e=>{console.log("Error fetching data",e)})}function an(){try{return getUserDetails()?.userPreferences?.stickyHeader===!0}catch{return!1}}function de(e){document.querySelectorAll(".stickyHeaderToggle").forEach(t=>{t.setAttribute("aria-checked",e)})}function W(e){e?document.body.setAttribute("data-fixed","true"):document.body.removeAttribute("data-fixed");let t=getUserDetails()||{};t.userPreferences||(t.userPreferences={}),t.userPreferences.stickyHeader=e,window.localStorage.setItem("userDetails",JSON.stringify(t))}window.toggleStickyHeader=sn;window.setStickyHeaderState=W;function cn(){fetchUserSessionData().then(e=>{isPremium?(un()?(fe("false"),K(!1)):(fe("true"),K(!0)),fetch("/wp-json/users/preferences/darkMode",{method:"POST"}).then(n=>{if(!n.ok)throw new Error("Request failed")}).catch(n=>{console.log(n)})):openAlertModal("Night Mode is a Premium feature. Please subscribe to continue.")}).catch(e=>{console.log("Error fetching data",e)})}function Ae(e){document.querySelectorAll(".google-preferred-source__picture, a.google-preferred-source picture").forEach(n=>{const r=n.querySelector("source"),o=n.querySelector("img");if(!o)return;if(!n.dataset.lightSrc){const l=o.getAttribute("src");l&&(n.dataset.lightSrc=l)}if(!n.dataset.darkSrc&&r){const l=r.getAttribute("srcset");l&&(n.dataset.darkSrc=l)}const s=n.dataset.lightSrc,i=n.dataset.darkSrc;if(!s||!i)return;const a=e?i:s;r&&r.setAttribute("srcset",a),o.setAttribute("src",a)})}function un(){try{return getUserDetails()?.userPreferences?.darkMode===!0}catch{return!1}}function fe(e){document.querySelectorAll(".darkModeToggle").forEach(t=>{t.setAttribute("aria-checked",e)})}function K(e){document.documentElement.classList.toggle("dark",e),Ae(e);let t=getUserDetails()||{};t.userPreferences||(t.userPreferences={}),t.userPreferences.darkMode=e,window.localStorage.setItem("userDetails",JSON.stringify(t))}window.toggleDarkMode=cn;window.setDarkModeState=K;document.addEventListener("DOMContentLoaded",()=>{const e=document.documentElement.classList.contains("dark");Ae(e)});document.addEventListener("DOMContentLoaded",function(){fetchUserSessionData().then(e=>{let t="";e.hasOwnProperty("loggedIn")&&e.hasOwnProperty("userPreferences")&&e.loggedIn&&e.userPreferences?t=ln(e.userPreferences.stickyHeader,e.userPreferences.darkMode):t=dn();const n=`<div><ul>${t}</ul></div>`;document.getElementById("userMenuContainer")?.insertAdjacentHTML("beforeend",n),document.getElementById("userMenuContainerMobile")?.insertAdjacentHTML("beforeend",n),fn(e)}).catch(e=>{console.log("Error fetching data",e)})});function Le(e,t="",n=!1,r=""){return`<div class="userMenuItemToggle ${t}" aria-checked="${n?"true":"false"}" onclick="${r}"><button type="button" role="switch"><span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span></button><span>${e}</span></div>`}function C(e,t="",n="#",r=""){let o="";return t==="login"&&(o+='<i class="icon icon-login text-2xl" ></i>'),'<li class="userMenuItem"><a href="'+n+'" onclick="'+r+'">'+o+"<span>"+e+"</span></a></li>"}function ln(e=!1,t=!1){return[C("Profile","","/account"),Ie(e),Te(t),C("Saved Articles","","/saved-articles"),C("Logout","","javascript:void(0)","userLogout();")].join("")}function dn(){return[C("Log In","login","/login",""),C("Sign Up","login","/premium?utm_source=onsite&utm_medium=organic&utm_campaign=become-a-member-right-header-menu-sign-up",""),Ie(),Te()].join("")}function Ie(e=!1){return setStickyHeaderState(e),Le("Sticky Header","stickyHeaderToggle",e,"toggleStickyHeader();")}function Te(e=!1){return setDarkModeState(e),Le("Night Mode","darkModeToggle",e,"toggleDarkMode();")}function fn(e={}){const t=document.getElementById("userMenuContainerMobile"),n=t?.querySelector("ul"),r=t?.querySelector("#mobileMenuGoAdFreeTemplate");if(!t||!n||(n.querySelector(".navigation__mobile-go-ad-free")?.remove(),!r)||!e.loggedIn||e.hasActiveSubscription||(e.accountPlan||"free")!=="free")return;const s=r.content?.firstElementChild?.cloneNode(!0);s&&n.appendChild(s)}document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".modal__close >
1 button").forEach(e=>{e.addEventListener("click",function(){closeModal(this.getAttribute("aria-controls"))})})});function mn(){typeof openModal=="function"?openModal("auth-modal"):window.location.assign("/login/")}function gn(){closeModal("auth-modal"),Ce()}function pn(e="",t=!1){ee();const n=document.querySelector(".modal__auth .modal__message");n&&(n.textContent=e,t&&n.setAttribute("aria-type","error"))}function ee(){const e=document.querySelector(".modal__auth .modal__message");e&&(e.textContent="",e.setAttribute("aria-type",""))}function Ce(){ee(),hn()}function hn(){document.querySelectorAll(".modal__auth input").forEach(e=>{e.value=""})}window.showAuthModal=mn;window.hideAuthModal=gn;window.resetAuthModal=Ce;window.showAuthModalMessage=pn;window.resetAuthModalMessage=ee;function De(){return typeof salonMpParams<"u"?salonMpParams.gtmContainerId:""}const A={utm:"salon_subscription_tracking_utm_first_touch",cta:"salon_subscription_tracking_cta_context",plan:"salon_subscription_tracking_plan_context",emitted:"salon_subscription_tracking_emitted",beginCheckout:"salon_subscription_tracking_mp_begin_checkout"},_n={"/join/premium-monthly":{plan_key:"premium_monthly",plan_name:"Salon Premium Monthly Membership",plan_tier:"premium",interval:"monthly",value:9.95,currency:"USD"},"/join/premium-annual":{plan_key:"premium_annual",plan_name:"Salon Premium Annual Membership",plan_tier:"premium",interval:"annual",value:49,currency:"USD"}};function yn(e){return!!document.querySelector(`script[src*="googletagmanager.com/gtm.js?id=${e}"]`)}function wn(e){return!!document.querySelector(`iframe[src*="googletagmanager.com/ns.html?id=${e}"]`)}function bn(){window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":new Date().getTime(),event:"gtm.js"})}function kn(){const e=De();if(!e||yn(e))return;bn();const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtm.js?id=${e}`,document.head.appendChild(t)}function Sn(){const e=De();if(!e||wn(e))return;const t=document.createElement("iframe");t.src=`https://www.googletagmanager.com/ns.html?id=${e}`,t.height="0",t.width="0",t.style.display="none",t.style.visibility="hidden";const n=document.createElement("noscript");n.appendChild(t),document.body.insertAdjacentElement("afterbegin",n)}function vn(){kn(),Sn()}function te(e,t){try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}}function ne(){return te(A.plan,null)||_n[Ue()]||null}function En(){return te(A.cta,{})}function Mn(){return te(A.utm,{})}function qe(e,t){try{const n=window.sessionStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}}function Pn(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function An(e,t){return!!qe(A.beginCheckout,{})[t]}function Ln(e,t){const n=qe(A.beginCheckout,{});n[t]=!0,Pn(A.beginCheckout,n)}function Ue(){return window.location.pathname.replace(/\/+$/,"")||"/"}function In(){return!!document.getElementById("mepr_signup_form")}function Tn(){return In()&&!!ne()}function Cn(e){return[{item_id:e.plan_key,item_name:e.plan_name,item_category:e.plan_tier,item_variant:e.interval,price:Number(e.value||0),quantity:1}]}function Dn(){const e=ne(),t=En();return{event:"begin_checkout",...e,raw_price_id:"",stripe_session_id:"",cta_id:t.cta_id||"",cta_position:t.cta_position||"",cta_variant:t.cta_variant||"",content_category:t.content_category||"pricing",...Mn(),items:Cn(e)}}function qn(){return typeof window.google_tag_manager<"u"}function Un(e){window.dataLayer=window.dataLayer||[],window.dataLayer.push(e)}function xe(e,t,n=0){if(!An("begin_checkout",t)){if(qn()||n>=40){Un(e),Ln("begin_checkout",t);return}window.setTimeout(()=>xe(e,t,n+1),250)}}function xn(){if(!Tn())return;const e=ne(),t=`${Ue()}:${e.plan_key}`,n=Dn();xe(n,t)}document.addEventListener("DOMContentLoaded",function(){vn(),xn()});document.addEventListener("DOMContentLoaded",function(){typeof window.siteUrl>"u"&&typeof salonMpParams<"u"&&(window.siteUrl=salonMpParams.siteUrl);let e=document.querySelector(".salon-sso-container"),t=document.querySelector(".mp-form-submit"),n=document.querySelector(".mp_login_form .submit, .mepr-login-form .submit"),r=t||n;e&&r&&r.parentNode.insertBefore(e,r.nextSibling),typeof salonMpParams<"u"&&salonMpParams.fbAppId&&(window.fbAsyncInit=function(){FB.init({appId:salonMpParams.fbAppId,cookie:!0,xfbml:!0,version:"v21.0"}),FB.AppEvents.logPageView()},function(o,s,i){var a,l=o.getElementsByTagName(s)[0];o.getElementById(i)||(a=o.createElement(s),a.id=i,a.src="https://connect.facebook.net/en_US/sdk.js",l.parentNode.insertBefore(a,l))}(document,"script","facebook-jssdk"))});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".mp-form-row").forEach(t=>{const n=t.querySelector("input"),r=t.querySelector("label.placeholder-text");if(n&&r){const o=()=>{(n.value.trim()!==""||n.matches(":-webkit-autofill"))&&r.classList.add("active")};o(),setTimeout(o,500)}})});document.addEventListener("DOMContentLoaded",function(){if(typeof salonMpParams<"u"&&salonMpParams.freePlanId){const e=salonMpParams.freePlanId;new MutationObserver(function(n){document.querySelectorAll('tr, .mp-table-row, div[role="row"]').forEach(function(s){const i=s.innerText||"";if((s.innerHTML||"").includes(e)||i.includes("Free")){const l=s.querySelector('button[aria-haspopup="true"], .mepr-account-actions, .mp-actions-menu');l&&(l.style.display="none")}}
1),document.querySelectorAll('select.mepr-upgrade-dropdown option[value*="/free"]').forEach(function(s){const i=s.parentElement;if(i&&i.value===s.value){const a=i.querySelector('option:not([value*="/free"])');a&&(i.value=a.value)}s.remove()})}).observe(document.body,{childList:!0,subtree:!0})}});document.addEventListener("DOMContentLoaded",function(){if(document.head.insertAdjacentHTML("beforeend","<style>.mepr_modal input.mepr-form-checkboxes-input{-webkit-appearance:checkbox !important;}</style>"),typeof salonMpParams<"u"&&!salonMpParams.isPremium){const e="/premium?utm_source=onsite&utm_medium=account&utm_campaign=become-a-member-account-newsletter-upgrade-9a&utm_content=newsletter-link-in-account",t=new MutationObserver(n=>{n.forEach(r=>{if(r.target.style.display==="block"){const o=r.target.querySelectorAll('input[name^="mepr_premium_newsletters"]');o.forEach(s=>{s.disabled=!0,s.checked=!1;const i=s.closest(".mepr-checkboxes-field-row");i&&(i.style.opacity="0.5")}),o.length&&!r.target.querySelector(".premium-cta-notice")&&o[0].closest(".mepr_custom_field").insertAdjacentHTML("beforeend",`<div class="premium-cta-notice mt-4"><a href="${e}">Upgrade to Premium</a> to manage these newsletters.</div>`)}})});document.querySelectorAll(".mepr_modal").forEach(n=>t.observe(n,{attributes:!0}))}});document.addEventListener("DOMContentLoaded",function(){new MutationObserver(function(){document.querySelectorAll("#mepr-account-payments-table tbody tr.mepr-payment-row").forEach(function(n){const r=n.querySelector('td[data-label="Total"]');r&&(r.innerText||"").includes("Free")&&(n.style.display="none")})}).observe(document.body,{childList:!0,subtree:!0})});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('.mepr_username label[for="user_login"]').forEach(function(r){r.innerText.includes("Username")&&(r.innerText="Email or Username")}),document.querySelectorAll(".mepr_username input#user_login").forEach(function(r){r.hasAttribute("placeholder")&&r.getAttribute("placeholder").includes("Username")&&r.setAttribute("placeholder","Email or Username")}),document.querySelectorAll("#mepr_error_msg, .mepr_pro_error ul li").forEach(function(r){r.innerText.toLowerCase().includes("username")&&(r.innerText=r.innerText.replace(/username/i,"email"))})});document.addEventListener("DOMContentLoaded",function(){const e=document.querySelector('label[for="mepr_user_or_email"]');e&&(e.textContent="Enter Your Email Address")});document.addEventListener("DOMContentLoaded",function(){const e=document.querySelector("#subscribe_newsletter");if(!e)return;const t=e.querySelector(".smart-newsletter-message"),n=e.querySelector(".smart-newsletter-success"),r=e.querySelector(".smart-newsletter-submit"),o=e.querySelector(".smart-newsletter-name-field"),s=e.querySelector(".smart-newsletter-email-field"),i=e.querySelector('input[name="name"]'),a=e.querySelector('input[name="email"]'),l=e.querySelector(".smart-newsletter-required"),d=e.querySelector(".smart-newsletter-premium"),m=e.querySelector(".smart-newsletter-premium-input"),_=e.querySelector(".smart-newsletter-upgrade-note"),v=document.querySelector(".smart-newsletter-guest-only");let $=!1;const Oe=function(u){const f=`; ${document.cookie}`.split(`; ${u}=`);return f.length===2?f.pop().split(";").shift():null},re=function(u){t&&(t.textContent=u,t.classList.remove("hidden"))},$e=function(){t&&(t.textContent="",t.classList.add("hidden"))},j=function(u){n&&(n.textContent=u,n.classList.remove("hidden"))},je=function(){n&&(n.textContent="",n.classList.add("hidden"))},Ne=function(){o&&o.classList.add("hidden"),s&&s.classList.add("hidden"),l&&l.classList.add("hidden"),i&&i.removeAttribute("required"),a&&a.removeAttribute("required"),v&&v.classList.add("hidden")},E=function(){!d||!m||(m.checked=!1,m.disabled=!0,m.classList.add("cursor-not-allowed","opacity-30"),d.classList.add("opacity-60"),_&&_.classList.remove("hidden"))},Re=function(){!d||!m||(m.disabled=!1,m.classList.remove("cursor-not-allowed","opacity-30"),d.classList.remove("opacity-60"),_&&_.classList.add("hidden"))},Be=function(u){const g=Oe("wordpress_premium_member")==="1",f=Array.isArray(u.userRoles)?u.userRoles:[];return g||f.includes("premium_member")},Fe=function(u){Array.isArray(u.activeNewsletters)&&u.activeNewsletters.forEac
1h(function(g){const f=e.querySelector(`.nl-${g} input[type="checkbox"]`);f&&(f.checked=!0)})},Ge=function(){const u=[];return e.querySelectorAll('.newsletter-option input[type="checkbox"]:checked').forEach(function(f){u.push(f.value)}),u};E(),fetch("/wp-json/users/user-details").then(function(u){return u.json()}).then(function(u){if($=u.loggedIn,!u.loggedIn){E();return}if(Ne(),Fe(u),Be(u)){Re();return}E()}).catch(function(){E()}),e.addEventListener("submit",function(u){const g=Ge(),f=r?r.textContent:"";u.preventDefault(),$e(),je(),r&&(r.disabled=!0,r.textContent="Processing..."),He(e).then(function(c){const w=c.nonce,T=c.captchaToken,N=$?"/wp-json/users/free-newsletter-signup":"/wp-json/newsletters/subscribe",R=$?{email:a?a.value:"",name:i?i.value:"",newsletters:g,nonce:w,captchaToken:T}:{email:a?a.value:"",first_name:i?i.value:"",newsletter_options:g,nonce:w,captchaToken:T};return fetch(N,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)})}).then(function(c){return c.json().then(function(w){return{status:c.status,body:w}})}).then(function(c){if(r&&(r.disabled=!1,r.textContent=f),c.status===200){if(c.body.message==="Preferences updated successfully!"){j("Your newsletter preferences have been successfully updated!");return}if(c.body.message==="Success"){j("Thank You! You're all set, you'll get a welcome email for each newsletter that you've signed up to receive."),e.reset(),E();return}j("Thank You! You're all set, you'll get a welcome email for each newsletter that you've signed up to receive."),e.reset(),E();return}re(c.body&&(c.body.message||c.body.data)||"An error occurred. Please try again.")}).catch(function(){r&&(r.disabled=!1,r.textContent=f),re("Connection error. Please try again later.")})}),v&&v.addEventListener("submit",function(u){u.preventDefault();const g={},f=[];if(Array.from(v.elements).forEach(({name:c,value:w,type:T,checked:N,disabled:R})=>{!c||R||c==="action"||(T==="checkbox"||T==="radio")&&!N||(c==="newsletter_options[]"?f.push(w):g[c]=w)}),g.newsletter_options=f,g.newsletter_options.length<1){typeof openAlertModal=="function"?openAlertModal("Please select at least one newsletter to unsubscribe."):alert("Please select at least one newsletter to unsubscribe.");return}typeof togglePageLoader=="function"&&togglePageLoader(!0),fetch("/wp-json/newsletters/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":g.nonce||""},body:JSON.stringify(g)}).then(c=>c.json()).then(c=>{if(!c.success){typeof openAlertModal=="function"?openAlertModal(c.data):alert(c.data);return}typeof openAlertModal=="function"?openAlertModal(c.data):alert(c.data),v.reset()}).catch(c=>{typeof openAlertModal=="function"?openAlertModal("An error occurred while processing your request. Please try again later."):alert("An error occurred while processing your request. Please try again later.")}).finally(()=>{typeof togglePageLoader=="function"&&togglePageLoader(!1)})})});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".search__form form").forEach(e=>{e.addEventListener("submit",function(t){t.preventDefault();const n=e.querySelector('input[name="s"]').value.trim();if(n.length>0){const r=e.getAttribute("action").replace(/\/?$/,"/");window.location.href=encodeURI(r)+encodeURIComponent(n)}})})});

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.