PageSourceSearch

https://www.newidea.com.au/wp-content/themes/express/build/js/piano.js?ver=ddb8cbf0d2b44cb4090b

js newidea.com.au collected 2026-10-02 02:33:03 UTC 46,738 bytes, 1 lines download raw bytes

1(()=>{"use strict";var e={306(e,t,a){a.d(t,{A:()=>r});var i=a(5374),n=a(2018),o=a(2192),s=a(8948);class r{static isAvailable(){return window.analytics&&"function"==typeof window.analytics.track&&"function"==typeof window.analytics.identify}static waitForAnalytics(e=5e3){return new Promise(t=>{if(this.isAvailable())return void t(!0);const a=Date.now(),i=setInterval(()=>{this.isAvailable()?(clearInterval(i),t(!0)):Date.now()-a>=e&&(clearInterval(i),t(!1))},200)})}static async updateLiveRampEnvelope(e){return"function"==typeof window.atsenvelopemodule?.setAdditionalData&&(o.v.log("Piano Debug: LiveRamp envelope updated with email hash."),window.atsenvelopemodule.setAdditionalData({type:"emailHashes",id:[e]})),Promise.resolve()}static async identifyUser(e,t={}){if(!e.email)return"";if(!await this.waitForAnalytics())return o.v.warn("Piano Debug: Segment not available after waiting. Identify call dropped."),"";const a=await i.KI.computeSHA256(e.email),n={email:e.email,...t};return o.v.log("Piano Debug: Segment identify."),window.analytics.identify(a,n),a}static async trackEvent(e,t={},a={}){if(await this.waitForAnalytics())return new Promise(i=>{o.v.log("Piano Debug: Segment track: ",e),window.analytics.track(e,t,a,()=>{i()})});o.v.warn("Piano Debug: Segment not available after waiting. Track call dropped:",e)}static resolveIdName(e,t){return(0,i.lA)(e,t)}static async trackUserEvent(e,t){const a=i.UM.get(n.P.COOKIES.TEMPLATE_ID)||"",r=i.UM.get(n.P.COOKIES.OFFER_ID)||"",c=a?this.resolveIdName(a,AREMEDIA_PIANO_DATA.templateIdMap):"",d=r?this.resolveIdName(r,AREMEDIA_PIANO_DATA.offerIdMap):"",l={firstName:e.firstName,lastName:e.lastName,postalCode:e.postCode,birthday:e.dob_my,gender:e.gender,optInMarketing:1};r&&(l.offerId=r,l.offerName=d,l.checkoutStartedAt=(new Date).toISOString()),a&&(l.templateId=a,l.templateName=c);const u={register:{traits:l,eventName:n.P.EVENTS.USER_REGISTERED,context:{traits:{email:e.email,opt_in_marketing:1}}},login:{traits:{},eventName:n.P.EVENTS.USER_LOGGED_IN,context:{traits:{email:e.email}}},update:{traits:{firstName:e.firstName,lastName:e.lastName,postalCode:e.postCode,birthday:e.dob_my,gender:e.gender},eventName:n.P.EVENTS.USER_UPDATED,context:{traits:{email:e.email}}}}[t];if(!u)return"";const p=await this.identifyUser(e,u.traits);if(await this.trackEvent(u.eventName,{},{context:u.context}),"register"===t)try{o.v.log("Piano Debug: Tracking Sailthru signup."),await s.S.trackUserSignup(e)}catch(e){o.v.warn("Piano Debug: Sailthru signup tracking failed, continuing with registration.")}else if("update"===t)try{o.v.log("Piano Debug: Tracking Sailthru update."),await s.S.trackUserUpdate(e)}catch(e){o.v.warn("Piano Debug: Sailthru update tracking failed, continuing with update.")}return p}static async trackUserRegistration(e){return await this.trackUserEvent(e,"register")}static async trackUserLogin(e){return await this.trackUserEvent(e,"login")}static async processFieldUpdate(e){return await this.trackUserEvent(e,"update")}}},2018(e,t,a){a.d(t,["P",0,{COOKIE_MAX_AGE:86400,CUSTOM_FIELDS:{POST_CODE:"PostCode",NEWSLETTER:"Newsletter",DOB:"dob_my",GENDER:"gender"},SELECTORS:{LOGGED_IN:".is-logged-in",LOGGED_OUT:".not-logged-in",GREETING:".account-greeting",LOADING:".xwp-spinner",NOT_LOADING:".not-loading",SIGNUP_BUTTON:".piano-signup-button",LOGIN_BUTTON:".piano-login-button",LOGOUT_BUTTON:".piano-logout-button",MY_ACCOUNT_CONTAINER:"#piano-my-account",LOADING_PLACEHOLDER:".piano-loading-placeholder",PASSWORD_RESET_CONTAINER:"#piano-password-reset",SAVED_POSTS_CONTAINER:"#saved-posts-container",SAVE_POST_BUTTON:".save-post-btn",MAIN_CONTENT:".entry-content__main",PAYWALL_WRAPPER:"#inline-article-paywall",PAYWALL_GRADIENT:"#piano-paywall-gradient",PAYWALL_CONTAINER:"#piano-paywall-container",ARTICLE_RIBBON:"#inline-article-ribbon",MEMBERSHIP_DENIED:"#piano-membership-access-denied"},COOKIES:{LOGGED_IN:"piano_logged_in",FIRST_NAME:"piano_first_name",PREMIUM_ACCESS:"piano_premium_access",OFFER_ID:"_pc_offer_id",TEMPLATE_ID:"_pc_template_id"},EVENTS:{USER_REGISTERED:"User Registered",USER_LOGGED_IN:"User Loggedin",USER_LOGGED_OUT:"User logged out",USER_UPDATED:"User Updated",ARTICLE_SAVED:"Article Saved",ORDER_COMPLETED:"Order Completed",ONBOARDING_PREFERENCE:"Onboarding Preference",SUBSCRIPTION_CANCELLED:"Subscription Cancelled"},PAGES:{MY_ACCOUNT:"/my-account/",SAVED_ARTICLES:"/saved-articles/",MY_WOMENS_WEEKLY:"/mywomensweekly/",MEMBERSHIP:"/mymembership/",HOME:"/"},BODY_CLASSES:{LOADING:"piano-loading",LOADED:"piano-loaded",USER_LOGGED_IN:"piano-user-logged-in",USER_LOGGED_OUT:"piano-user-logged-out",PREMIUM_ACCESS:"piano-has-premium-access",NO_PREMIUM_ACCESS:"piano-no-premium-access"}}])},2192(e,t,a){const i="undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.isSandbox||!1,n={log(...e){i&&console.log(...e)},warn(...e){i&&console.warn(...e)},error(...e){console.error(...e)}};a.d(t,["v",0,n])},7109(e,t,a){a.d(t,{O9:()=>m,rP:()=>A,SN:()=>h});var i=a(2018),n=a(2192),o=a(5374);class s{constructor(){this.state={isLoggedIn:!1,user:null},this.listeners=new Set;const e="undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.applicationId||"";this.storageKey=e?`piano_auth_state_${e}`:"piano_auth_state"}async initialize(){const e=this.getPianoUser();if(e?.valid&&o.UM.isLoggedIn())await this.setLoggedIn(e);else if(e?.valid&&!o.UM.isLoggedIn())this.state={isLoggedIn:!1,user:null},this.notifyListeners();else{const e=this.getStoredState();e?.isLoggedIn&&!o.UM.isLoggedIn()?await this.setLoggedOut():e&&(this.state=e,this.notifyListeners())}}getPianoUser(){try{return window.tp?.pianoId?.getUser?.()}catch(e){return null}}async setLoggedIn(e){this.state={isLoggedIn:!0,user:{email:e.email?.toLowerCase()||"",firstName:e.given_name||e.firstName||"",lastName:e.family_name||e.lastName||"",uid:e.uid||e.id||""}},this.persistState(),this.notifyListeners(),o.UM.setLoginCookies(this.state.user.firstName)}async setLoggedOut(){this.state={isLoggedIn:!1,user:null},this.clearStoredState(),this.notifyListeners(),o.UM.clearLoginCookies(),o.UM.clearPremiumAccess()}persistState(){try{localStorage.setItem(this.storageKey,JSON.stringify(this.state))}
1catch(e){n.v.warn("Piano Debug: Failed to persist auth state:",e)}}getStoredState(){try{const e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch(e){return null}}clearStoredState(){try{localStorage.removeItem(this.storageKey)}catch(e){n.v.warn("Piano Debug: Failed to clear stored state:",e)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>{try{e(this.state)}catch(e){n.v.error("Piano Debug: Error in auth state listener:",e)}})}getState(){return{...this.state}}isLoggedIn(){return this.state.isLoggedIn}getUser(){return this.state.user}destroy(){this.listeners.clear()}}class r{extractCustomFieldValues(e){const t={postCode:"",newsletter:"",dob_my:"",gender:""};if(!e?.custom_field_values?.length)return t;const a={[i.P.CUSTOM_FIELDS.POST_CODE]:"postCode",[i.P.CUSTOM_FIELDS.NEWSLETTER]:"newsletter",[i.P.CUSTOM_FIELDS.DOB]:"dob_my",[i.P.CUSTOM_FIELDS.GENDER]:"gender"};return e.custom_field_values.forEach(e=>{const i=a[e.field_name];i&&(t[i]=e.value||"")}),t}normalizeUserData(e,t={}){let a="";const i=t.gender||t.Gender||"";if("string"==typeof i&&i.startsWith("[")&&i.endsWith("]"))try{const e=JSON.parse(i);a=Array.isArray(e)?e[0]||"":i}catch(e){a=i}else a=i;const n=t.dob_my?t.dob_my.split("/"):[];let o="";return 2===n.length?o=`${n[1]}-${n[0].padStart(2,"0")}-01`:3===n.length&&(o=`${n[2]}-${n[1].padStart(2,"0")}-${n[0].padStart(2,"0")}`),{email:e.email?.toLowerCase()||"",firstName:e.given_name||e.firstName||"",lastName:e.family_name||e.lastName||"",postCode:t.postCode||t.PostCode||"",newsletter:t.newsletter||t.Newsletter||"",dob_my:o,gender:a}}}class c{constructor(e){this.authState=e,this.unsubscribe=null,this.bodyElement=document.body}initialize(){this.setBodyClasses("loading"),this.unsubscribe=this.authState.subscribe(e=>{this.syncLoginUI(e)}),this.authState.initialize().then(()=>{this.setBodyClasses("loaded"),this.syncLoginUI(this.authState.getState())})}setBodyClasses(e,t=null){const a=i.P.BODY_CLASSES;switch(this.bodyElement.classList.remove(a.LOADING,a.LOADED,a.USER_LOGGED_IN,a.USER_LOGGED_OUT),e){case"loading":this.bodyElement.classList.add(a.LOADING);break;case"loaded":this.bodyElement.classList.add(a.LOADED),null!==t&&this.bodyElement.classList.add(t?a.USER_LOGGED_IN:a.USER_LOGGED_OUT)}}syncLoginUI(e,t={}){const{loggedInSelector:a=i.P.SELECTORS.LOGGED_IN,loggedOutSelector:n=i.P.SELECTORS.LOGGED_OUT,greetingsSelector:s=i.P.SELECTORS.GREETING,loadingSelector:r=i.P.SELECTORS.LOADING,notLoadingSelector:c=i.P.SELECTORS.NOT_LOADING,loggedInDisplay:d="block",loggedOutDisplay:l="block"}=t,u=e.isLoggedIn,p=(e.user?.firstName||"").length>15?e.user.firstName.slice(0,15)+"...":e.user?.firstName||"";this.setBodyClasses("loaded",u),o.f8.setDisplay([{selector:i.P.SELECTORS.LOADING_PLACEHOLDER,show:!1},{selector:a,show:u,displayValue:d},{selector:n,show:!u,displayValue:l},{selector:r,show:!1},{selector:c,show:!0}]),u||this.setPremiumAccessClasses(null);const m=u?`Hi, ${p}`:"";return o.f8.updateText(s,m),u}setPremiumAccessClasses(e){const{PREMIUM_ACCESS:t,NO_PREMIUM_ACCESS:a}=i.P.BODY_CLASSES;document.body.classList.remove(t,a),!0===e?(document.body.classList.add(t),o.UM.setPremiumAccess(),document.querySelector(i.P.SELECTORS.PAYWALL_WRAPPER)?.remove()):!1===e&&(document.body.classList.add(a),o.UM.clearPremiumAccess())}setLoadingState(e){o.f8.setDisplay([{selector:i.P.SELECTORS.LOADING,show:e},{selector:i.P.SELECTORS.NOT_LOADING,show:!e}])}showLoadingOnElement(e){const t=e.querySelector(i.P.SELECTORS.LOADING),a=e.querySelector(i.P.SELECTORS.NOT_LOADING);t&&(t.style.display="inline-block"),a&&(a.style.display="none")}hideLoadingOnElement(e){const t=e.querySelector(i.P.SELECTORS.LOADING),a=e.querySelector(i.P.SELECTORS.NOT_LOADING);t&&(t.style.display="none"),a&&(a.style.display="inline-block")}showLoading(){this.setLoadingState(!0)}hideLoading(){this.setLoadingState(!1)}destroy(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)}}var d=a(306),l=a(8948),u=a(9887),p=a(3742);class m{constructor(){this.userDataManager=new r,this.authState=new s,this.uiManager=new c(this.authState),this.initialized=!1,this.isPremiumContentLoading=!1,this.isCheckoutCompleteProcessing=!1,this.checkoutCompleteHandled=!1,this.setupSDKConfig(),this.setupEventHandlers(),this.setupMessageListeners()}setupSDKConfig(){const e=window.tp||[];e.push(["setAid",AREMEDIA_PIANO_DATA.applicationId]),e.push(["setCxenseSiteId",AREMEDIA_PIANO_DATA.siteId]);const t=AREMEDIA_PIANO_DATA.whitelabel||{};t.endpoint?e.push(["setEndpoint",t.endpoint]):AREMEDIA_PIANO_DATA.isSandbox?e.push(["setEndpoint","https://sandbox.tinypass.com/api/v3"]):e.push(["setEndpoint","https://buy-au.piano.io/api/v3"]),t.idUrl?e.push(["setPianoIdUrl",t.idUrl]):AREMEDIA_PIANO_DATA.isSandbox?e.push(["setPianoIdUrl","https://sandbox.piano.io"]):e.push(["setPianoIdUrl","https://id-au.piano.io"]),t.composerHost&&e.push(["setComposerHost",t.composerHost]),t.staticDomain&&e.push(["setStaticDomain",t.staticDomain]),e.push(["setUseTinypassAccounts",!1]),e.push(["setUsePianoIdUserProvider",!0]),e.push(["init",function(){window.tp&&window.tp.experience&&"function"==typeof window.tp.experience.init?window.tp.experience.init():n.v.error("Piano Debug: SDK ready but experience API unavailable — Composer will not run")}]),window.tp=e,this.premiumResourceId=AREMEDIA_PIANO_DATA.premiumResourceId||""}setupEventHandlers(){const e=e=>
1{if(!this.premiumResourceId||!(()=>{const e=AREMEDIA_PIANO_DATA.pianoTags||[];return(Array.isArray(e)?e:e.split(",").map(e=>e.trim())).includes("premium_content")})())return void t(e,null);let a=!1;const i=setTimeout(()=>{a||(a=!0,n.v.warn("Piano Debug: /access/list timed out — proceeding without premium access."),t(e,null))},1e4);window.tp.api.callApi("/access/list",{},n=>{if(a)return;a=!0,clearTimeout(i);let o=!1;if(n&&n.data)for(const e in n.data){const t=n.data[e];if(t.granted&&t.resource&&t.resource.rid===this.premiumResourceId){o=!0;break}}o&&window.tp.offer&&"function"==typeof window.tp.offer.close&&window.tp.offer.close(),t(e,o)})},t=async(e,t=null)=>{await this.handleUserEvent(e,"login"),t&&(await this.refreshServerPremiumAccess(),o.UM.setPremiumAccess()),t&&window.location.pathname.includes(i.P.PAGES.MY_WOMENS_WEEKLY)?window.location.replace(i.P.PAGES.MEMBERSHIP):(this.uiManager.syncLoginUI(this.authState.getState()),null!==t&&this.uiManager.setPremiumAccessClasses(t),t&&await this.loadPremiumContent(),(0,p.Lw)())};window.tp.push(["addHandler","loginSuccess",async t=>{if("PIANOID"===t.source){const a=t.params||{};e(a)}}]),window.tp.push(["addHandler","loginFailed",e=>{this.uiManager.syncLoginUI(this.authState.getState()),n.v.error("Piano Debug: Login failed:",e)}]),window.tp.push(["addHandler","checkoutComplete",e=>{this.premiumResourceId&&e.rid===this.premiumResourceId&&(this.handleCheckoutComplete(e),this.showPreferencesForm())}]),window.tp.push(["addHandler","checkoutClose",e=>{if(e&&"checkoutCompleted"===e.state)if(this.isCheckoutCompleteProcessing){const e=setInterval(()=>{this.isCheckoutCompleteProcessing||(clearInterval(e),location.reload())},100);setTimeout(()=>{clearInterval(e),location.reload()},1e4)}else location.reload()}]),window.tp.push(["addHandler","checkoutCustomEvent",function(e){"acp-retain-subscription"===e.eventName&&location.reload()}]),window.tp.push(["addHandler","customEvent",e=>{if("become-member"===e.eventName){const t=parseFloat(e.params.price)||0,a=e.params.termid||"",i=e.params.termname||"",n=e.params.templateid||"",o=e.params.templatename||"";window._pianoSelectedTerm={price:t,termId:a,termName:i,templateId:n,templateName:o};const s={content_title:document.title,content_url:window.location.href,item_id:a,item_name:i,template_id:n,template_name:o};"function"==typeof window.fbq&&window.fbq("track","InitiateCheckout",s),window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"begin_checkout",ecommerce:{currency:"AUD",value:t,items:[{item_id:a,item_name:i,template_id:n,template_name:o,price:t,quantity:1,content_title:document.title,content_url:window.location.href}]}})}else"acp-cancel-subscription"===e.eventName&&this.handleSubscriptionCancelled()}]),window.tp.push(["addHandler","startCheckout",e=>{o.UM.set(i.P.COOKIES.OFFER_ID,e.offerId||""),o.UM.set(i.P.COOKIES.TEMPLATE_ID,e.templateId||"")}]),window.tp.push(["addHandler","registrationSuccess",e=>{const t=e.user||{};this.loadExtendedUserData(t,async(e,t)=>{await this.handleUserEvent(e,"register",t),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"sign_up"})})}]),window.tp.push(["addHandler","registrationFailed",e=>{this.uiManager.syncLoginUI(this.authState.getState()),n.v.error("Piano Debug: Registration failed:",e)}])}setupMessageListeners(){window.addEventListener("message",function(e){if((!e.origin||e.origin===window.location.origin||e.origin.includes("piano.io"))&&e&&e.data&&"paywal-template-rendered"===e.data.eventId){const t=e.data.templateId||"",a=e.data.templateName||"",i=[];e.data.term1Id&&i.push({item_id:e.data.term1Id,item_name:e.data.term1Name||"",price:parseFloat(e.data.term1Price)||0,quantity:1,content_title:document.title,content_url:window.location.href}),e.data.term2Id&&i.push({item_id:e.data.term2Id,item_name:e.data.term2Name||"",price:parseFloat(e.data.term2Price)||0,quantity:1,content_title:document.title,content_url:window.location.href}),"function"==typeof window.fbq&&window.fbq("track","ViewContent",{content_name:document.title,content_url:window.location.href,content_type:"member_content",contents:i.map(e=>({id:e.item_id,item_name:e.item_name,price:e.price,quantity:1})),template_id:t,template_name:a,currency:"AUD"}),window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"view_item_list",ecommerce:{currency:"AUD",item_list_id:t,item_list_name:a,items:i}})}}),window.addEventListener("message",e=>{try{const t=JSON.parse(e.data);"formSend"===t.event&&t.sender?.startsWith("piano-id-form")&&this.trackOnboardingPreference()}catch(e){}})}showPreferencesForm(){const e=AREMEDIA_PIANO_DATA.premiumFormName||"Preferences",t=AREMEDIA_PIANO_DATA.premiumTemplateId||"OTUKRO511CIH";window.tp.pianoId.showForm({formName:e,templateId:t,hideIfComplete:!0})}trackOnboardingPreference(){const e=AREMEDIA_PIANO_DATA.premiumFormName||"Preferences";window.tp.pianoId.loadExtendedUser({formName:e,extendedUserLoaded:async e=>{const t=this.authState.getUser()?.email||"";
1if(!t)return void n.v.warn("Piano Debug: No email found for onboarding preference tracking.");const a=(e?.custom_field_values||[]).filter(e=>"true"===e.value).map(e=>e.field_name);if(await o.KI.computeSHA256(t)&&await d.A.identifyUser({email:t},{}),await d.A.trackEvent(i.P.EVENTS.ONBOARDING_PREFERENCE,{preferences:a.join(",")}),a.length)try{const e={email:t,vars:{}};a.forEach(t=>{e.vars[`preference_membership_${t.toLowerCase()}`]=1}),await l.S.executeIntegration("userSignUp",e,()=>{n.v.log("Piano Debug: Sailthru onboarding preference vars updated.")},e=>{n.v.warn("Piano Debug: Sailthru onboarding preference tracking failed:",e)})}catch(e){n.v.warn("Piano Debug: Sailthru onboarding preference tracking failed:",e)}n.v.log("Piano Debug: Onboarding Preference tracked.")}})}async loadPremiumContent(){const e=document.querySelector(i.P.SELECTORS.MAIN_CONTENT),t=document.querySelector('article[id^="post-"]')?.id?.replace("post-","")||"";if(!e||!t||this.isPremiumContentLoading)return!1;if("true"===e.dataset.premiumContentLoaded)return!0;if(!AREMEDIA_PIANO_DATA.ajaxUrl||!AREMEDIA_PIANO_DATA.premiumContentNonce)return!1;this.isPremiumContentLoading=!0;try{const a=await fetch(AREMEDIA_PIANO_DATA.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"express_get_premium_content",postId:t,nonce:AREMEDIA_PIANO_DATA.premiumContentNonce}),credentials:"same-origin"}),n=await a.json();if(!a.ok||!n?.success||!n.data?.html)throw new Error(n?.data?.message||"Premium content fragment request failed.");return e.innerHTML=n.data.html,await this.executeInjectedScripts(e),e.dataset.premiumContentLoaded="true",document.querySelector(i.P.SELECTORS.SAVE_POST_BUTTON)&&window.tp?.pianoId?.isUserValid?.()&&(0,p.Lw)(),!0}catch(e){return n.v.warn("Piano Debug: Failed to load premium content fragment:",e),!1}finally{this.isPremiumContentLoading=!1}}async refreshServerPremiumAccess(){const e=document.querySelector('article[id^="post-"]')?.id?.replace("post-","")||"",t=AREMEDIA_PIANO_DATA.premiumResourceId||"",a=(0,p.WR)()||"";if(!e||!AREMEDIA_PIANO_DATA.ajaxUrl||!AREMEDIA_PIANO_DATA.premiumContentNonce)return!1;try{const i=await fetch(AREMEDIA_PIANO_DATA.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"express_refresh_premium_access",postId:e,granted:"1",resourceId:t,pianoUserId:a,nonce:AREMEDIA_PIANO_DATA.premiumContentNonce}),credentials:"same-origin"}),n=await i.json();return!(!i.ok||!n?.success)}catch(e){return n.v.warn("Piano Debug: Failed to refresh server premium access:",e),!1}}async clearServerPremiumAccess(){if(AREMEDIA_PIANO_DATA.ajaxUrl&&AREMEDIA_PIANO_DATA.premiumContentNonce)try{await fetch(AREMEDIA_PIANO_DATA.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"express_clear_premium_access",nonce:AREMEDIA_PIANO_DATA.premiumContentNonce}),credentials:"same-origin"})}catch(e){n.v.warn("Piano Debug: Failed to clear server premium access:",e)}}async executeInjectedScripts(e){if(!e)return;const t=Array.from(e.querySelectorAll("script"));for(const e of t)await this.executeInjectedScript(e)}executeInjectedScript(e){return new Promise(t=>{const a=e?.parentNode;if(!a)return n.v.warn("Piano Debug: Skipping detached script node during premium content injection."),void t();const i=document.createElement("script");if(Array.from(e.attributes).forEach(e=>{i.setAttribute(e.name,e.value)}),e.src)return i.onload=()=>t(),i.onerror=()=>t(),void a.replaceChild(i,e);e.textContent&&(i.textContent=e.textContent),a.replaceChild(i,e),t()})}recheckPremiumAccess(){const e=AREMEDIA_PIANO_DATA.premiumResourceId||"",t=AREMEDIA_PIANO_DATA.pianoTags||[],a=Array.isArray(t)?t:t.split(",").map(e=>e.trim());e&&a.includes("premium_content")&&window.tp.api.callApi("/access/list",{},async t=>{let a=!1;if(t&&t.data)for(const i in t.data){const n=t.data[i];if(n.granted&&n.resource&&n.resource.rid===e){a=!0;break}}if(n.v.log("Piano Debug: Premium re-check — "+(a?"GRANTED":"DENIED")),this.uiManager.setPremiumAccessClasses(a),a){if(!await this.refreshServerPremiumAccess())return void this.uiManager.setPremiumAccessClasses(!1);await this.loadPremiumContent()}})}async loadExtendedUserData(e,t){const a=this.userDataManager;window.tp.pianoId&&"function"==typeof window.tp.pianoId.loadExtendedUser?await window.tp.pianoId.loadExtendedUser({extendedUserLoaded(i){const n=a.extractCustomFieldValues(i);t(e,n)}}):n.v.error("Piano Debug: loadExtendedUser not available after wait.")}async handleUserEvent(e,t,a={}){try{const i=this.userDataManager.normalizeUserData(e,a);
1if(!i.email)return void n.v.warn("Piano Debug: No email found in user data.");await this.authState.setLoggedIn(e);const s=await o.KI.computeSHA256(i.email);switch(await d.A.updateLiveRampEnvelope(s),t){case"register":await d.A.trackUserRegistration(i);break;case"login":await d.A.trackUserLogin(i);break;case"update":await d.A.processFieldUpdate(i)}}catch(e){n.v.error("Piano Debug: Error handling user event:",e)}}async handleCheckoutComplete(e){if(!this.checkoutCompleteHandled){this.checkoutCompleteHandled=!0,this.isCheckoutCompleteProcessing=!0;try{await this._processCheckoutComplete(e)}finally{this.isCheckoutCompleteProcessing=!1}}}async _processCheckoutComplete(e){document.querySelector(i.P.SELECTORS.PAYWALL_WRAPPER)?.remove(),document.querySelector(i.P.SELECTORS.ARTICLE_RIBBON)?.remove(),this.uiManager.setPremiumAccessClasses(!0);const t=(e.email||"").toLowerCase(),a=t?await o.KI.computeSHA256(t):"",s=e.expires?new Date(1e3*e.expires).toISOString().split("T")[0]:"";a&&await d.A.identifyUser({email:t},{}),await d.A.trackEvent(i.P.EVENTS.ORDER_COMPLETED,{order_id:e.paymentId||"",order_total_amount:e.chargeAmount||"",membership_expiry:s,membership_offer_id:e.offerId||"",membership_promotion_id:e.promotionId||"",membership_resource_id:e.rid||"",membership_subs_id:e.subscriptionId||"",membership_conversion_id:e.termConversionId||"",membership_term_id:e.termId||""});const r=e.paymentId||"",c="purchase_fired_"+r;if(r&&!sessionStorage.getItem(c)){const t=window._pianoSelectedTerm||{},a=parseFloat(e.chargeAmount)||0,i=t.termId||e.termId||"",n=t.termName||"",o=t.templateId||"",s=t.templateName||"",d={value:a,currency:"AUD",content_title:document.title,content_url:window.location.href,transaction_id:r,item_id:i,item_name:n,template_id:o,template_name:s};"function"==typeof window.fbq&&window.fbq("track","Purchase",d),window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"purchase",ecommerce:{transaction_id:r,value:a,currency:"AUD",items:[{item_id:i,item_name:n,template_id:o,template_name:s,price:a,quantity:1,content_title:document.title,content_url:window.location.href}]}}),sessionStorage.setItem(c,"1")}await this.refreshServerPremiumAccess()?await this.loadPremiumContent():this.uiManager.setPremiumAccessClasses(!1);const u=l.S.getPremiumSailthruLists(),p=AREMEDIA_PIANO_DATA.sailthruVarPrefix||"";if(t){const e={email:t,vars:{}};u.forEach(t=>{e.vars[t]=1}),s&&(e.vars.membership_expiry=s),p&&(e.vars[`checkout_started_at_${p}`]=""),await l.S.executeIntegration("userSignUp",e,()=>{n.v.log("Piano Debug: Sailthru checkout complete tracked.")},e=>{n.v.warn("Piano Debug: Sailthru checkout complete failed:",e)})}n.v.log("Piano Debug: Order Completed tracked."),o.UM.delete(i.P.COOKIES.OFFER_ID),o.UM.delete(i.P.COOKIES.TEMPLATE_ID)}async handleSubscriptionCancelled(){const e=(this.authState.getUser()?.email||"").toLowerCase();if(!e)return void n.v.warn("Piano Debug: No email found for subscription cancellation tracking.");const t=this.premiumResourceId;if(t&&window.tp?.api&&"function"==typeof window.tp.api.callApi&&await new Promise(e=>{window.tp.api.callApi("/access/list",{},a=>{if(a?.data){for(const i in a.data){const n=a.data[i];if(n.granted&&n.resource?.rid===t)return void e(!0)}e(!1)}else e(!1)}),setTimeout(()=>e(!1),5e3)}))return void n.v.log("Piano Debug: Subscription cancellation event received but user still has active access. Skipping tracking.");await o.KI.computeSHA256(e)&&await d.A.identifyUser({email:e},{});const a=(new Date).toISOString().split("T")[0];await d.A.trackEvent(i.P.EVENTS.SUBSCRIPTION_CANCELLED,{cancellation_date:a}),await l.S.executeIntegration("userSignUp",{email:e,vars:{membership_cancellation_date:a}},()=>{n.v.log("Piano Debug: Sailthru subscription cancellation tracked.")},e=>{n.v.warn("Piano Debug: Sailthru subscription cancellation tracking failed:",e)}),n.v.log("Piano Debug: Subscription Cancelled tracked.")}createModalHandler(e){return async t=>{t.preventDefault();const a=t.currentTarget;if(window.tp?.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&window.tp.pianoId.isUserValid())return this.uiManager.syncLoginUI(this.authState.getState()),!0;this.uiManager.showLoadingOnElement(a);try{let t=!1;if(window.tp.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&(t=window.tp.pianoId.isUserValid()),t)this.uiManager.syncLoginUI(this.authState.getState());else{const t={displayMode:"modal",screen:e};if(!await u.K.show(t))throw new Error("Failed to show modal")}}catch(t){n.v.error(`Piano Debug: Error in ${e}
1 handler:`,t),this.uiManager.hideLoadingOnElement(a),this.uiManager.syncLoginUI(this.authState.getState())}}}setupSignupButtons(){o.f8.addEventListeners(i.P.SELECTORS.SIGNUP_BUTTON,"click",this.createModalHandler("register"))}setupLoginButtons(){o.f8.addEventListeners(i.P.SELECTORS.LOGIN_BUTTON,"click",this.createModalHandler("login"))}setupLogoutButtons(){o.f8.addEventListeners(i.P.SELECTORS.LOGOUT_BUTTON,"click",e=>{e.preventDefault(),window.tp.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&window.tp.pianoId.logout(async()=>{await this.clearServerPremiumAccess(),await this.authState.setLoggedOut(),this.uiManager.syncLoginUI(this.authState.getState()),n.v.log("Piano Debug: Logout success triggered."),await d.A.trackEvent(i.P.EVENTS.USER_LOGGED_OUT,{}),setTimeout(()=>{window.location.reload()},200)})})}setupModalCloseListener(){window.addEventListener("message",e=>{try{const t=JSON.parse(e.data);t.sender?.startsWith("piano-id")&&"closed"===t.event&&this.authState.initialize().then(()=>{this.uiManager.syncLoginUI(this.authState.getState()),window.tp?.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&window.tp.pianoId.isUserValid()?window.location.pathname.includes(i.P.PAGES.MY_ACCOUNT)?h():window.location.pathname.includes(i.P.PAGES.SAVED_ARTICLES)&&(0,p.lD)():(window.location.pathname.includes(i.P.PAGES.MY_ACCOUNT)||window.location.pathname.includes(i.P.PAGES.SAVED_ARTICLES))&&(window.location.href=i.P.PAGES.HOME)})}catch(e){}})}async initialize(){if(this.initialized)n.v.warn("Piano Debug: PianoIdManager already initialized.");else try{if(this.uiManager.initialize(),"undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.pianoTags){let e=[];Array.isArray(AREMEDIA_PIANO_DATA.pianoTags)?e=AREMEDIA_PIANO_DATA.pianoTags:"string"==typeof AREMEDIA_PIANO_DATA.pianoTags&&(e=AREMEDIA_PIANO_DATA.pianoTags.split(",").map(e=>e.trim()).filter(Boolean)),window.tp.push(["setTags",e])}this.setupModalCloseListener(),this.setupSignupButtons(),this.setupLoginButtons(),this.setupLogoutButtons(),this.initialized=!0,n.v.log("Piano Debug: PianoIdManager initialized successfully.")}catch(e){n.v.error("Piano Debug: Failed to initialize PianoIdManager:",e);const t=i.P.BODY_CLASSES;document.body.classList.remove(t.LOADING),document.body.classList.add(t.LOADED,t.USER_LOGGED_OUT)}}destroy(){this.authState&&this.authState.destroy(),this.uiManager&&this.uiManager.destroy(),this.initialized=!1}}async function A(e){const t=e.user||{},a=window.pianoIdManager.userDataManager;window.tp.pianoId&&"function"==typeof window.tp.pianoId.loadExtendedUser?await window.tp.pianoId.loadExtendedUser({extendedUserLoaded:async e=>{const s=a.extractCustomFieldValues(e),r=a.normalizeUserData(t,s);if(!r.email)return void n.v.warn("Piano Debug: No email found in profile update data.");await window.pianoIdManager.authState.setLoggedIn(t);const c=await o.KI.computeSHA256(r.email);await d.A.updateLiveRampEnvelope(c);const u=["PostCode","Newsletter","dob_my","gender"],p={};(e?.custom_field_values||[]).forEach(e=>{if(!u.includes(e.field_name)&&e.value){const t=`preference_membership_${e.field_name.toLowerCase()}`;p[t]="true"===e.value?1:0}});const m=Object.entries(p).filter(([,e])=>1===e).map(([e])=>e.replace("preference_membership_","")).join(",");await d.A.identifyUser(r,{firstName:r.firstName,lastName:r.lastName,postalCode:r.postCode,birthday:r.dob_my,gender:r.gender}),await d.A.trackEvent(i.P.EVENTS.USER_UPDATED,{firstName:r.firstName,lastName:r.lastName,postalCode:r.postCode,birthday:r.dob_my,gender:r.gender,preferences:m});const A={first_name:r.firstName,last_name:r.lastName,postal_code:r.postCode,birth_date:r.dob_my,gender:r.gender,...p};Object.keys(A).forEach(e=>{""!==A[e]&&void 0!==A[e]||delete A[e]}),await l.S.executeIntegration("userSignUp",{email:r.email,source:"LOGIN",vars:A},()=>{n.v.log("Piano Debug: Sailthru profile + preferences updated.")},e=>{n.v.warn("Piano Debug: Sailthru profile update failed:",e)})}}):n.v.error("Piano Debug: loadExtendedUser not available for profile update.")}function h(){const e=window.tp;e&&e.pianoId&&"function"==typeof e.pianoId.isUserValid&&(e.pianoId.isUserValid()?e.myaccount&&"function"==typeof e.myaccount.show&&e.myaccount.show({displayMode:"inline",containerSelector:i.P.SELECTORS.MY_ACCOUNT_CONTAINER,activateTemplateInteraction:!0}):e.pianoId.show({displayMode:"modal",screen:"login"}))}},9887(e,t,a){a.d(t,{K:()=>n});var i=a(2192);class n{static async show(e){try{return window.tp&&"function"==typeof window.tp.push?(window.tp.push(["init",()=>{window.tp?.pianoId&&"function"==typeof window.tp.pianoId.show?(i.v.log("Piano Debug: Showing modal with options."),window.tp.pianoId.show(e)):i.v.error("Piano Debug: tp.pianoId.show still not available after init")}]),!0):(i.v.error("Piano Debug: tp object not available."),!1)}catch(e){return i.v.error("Piano Debug: Error in PianoModalManager.show:",e),!1}}}},3742(e,t,a){a.d(t,{E0:()=>d,Lw:()=>m,WR:()=>s,kq:()=>c,lD:()=>p});var i=a(2018),n=a(2192),o=a(9887);function s(){return window.tp&&window.tp.pianoId&&"function"==typeof window.tp.pianoId.getUser&&(window.tp?.pianoId?.getUser?.()?.uid||window.tp?.pianoId?.getUser?.()?.id)||null}function r(e,t="success"){const a=document.getElementById("post-save-notification");a&&(a.textContent=e,a.style.display="block",a.style.color="success"===t?"green":"red",setTimeout(()=>{a.style.display="none"},3e3))}function c(e=0){const t=sessionStorage.getItem("pendingSavePostId");t&&(s()?(sessionStorage.removeItem("pendingSavePostId"),d(t)):e<5&&setTimeout(()=>c(e+1),500))}function d(e,t=null){if("undefined"==typeof AREMEDIA_PIANO_DATA||!AREMEDIA_PIANO_DATA.restUrl)return void n.v.
1warn("Piano Debug: AREMEDIA_PIANO_DATA not available for save operation.");const a=s();if(a)fetch(AREMEDIA_PIANO_DATA.restUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({piano_user_id:a,post_id:e}),credentials:"same-origin"}).then(e=>e.json()).then(t=>{t.success?(u(e,!0),r("This article has been saved successfully to your list.","success"),window.analytics&&"function"==typeof window.analytics.track&&(n.v.log("Piano Debug: Tracking Article Saved event."),window.analytics.track(i.P.EVENTS.ARTICLE_SAVED,{article_brand:t.data?.brand_name||"",article_category:t.data?.post_categories||"",article_name:t.data?.post_name||"",article_url:t.data?.post_url||""}))):r("Failed to save article.","error")}).catch(e=>{n.v.warn("Piano Debug: Save post request failed:",e),r("Failed to save article. Please try again.","error")});else if(sessionStorage.setItem("pendingSavePostId",e),t){const e=t.querySelector(".xwp-spinner"),a=t.querySelector("svg");t.disabled=!0,e&&(e.style.display="inline-block"),a&&(a.style.display="none"),setTimeout(()=>{e&&(e.style.display="none"),a&&(a.style.display="inline-block"),t.disabled=!1},3e3)}}function l(e){if("undefined"==typeof AREMEDIA_PIANO_DATA||!AREMEDIA_PIANO_DATA.restUrl)return void n.v.warn("Piano Debug: AREMEDIA_PIANO_DATA not available for remove operation.");const t=s();fetch(AREMEDIA_PIANO_DATA.restUrl,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({piano_user_id:t,post_id:e}),credentials:"same-origin"}).then(e=>e.json()).then(t=>{t.success?(r("This article has been removed from your list.","success"),u(e,!1),window.location.pathname.includes(i.P.PAGES.SAVED_ARTICLES)&&p()):r("Failed to remove article.","error")}).catch(e=>{n.v.warn("Piano Debug: Remove post request failed:",e),r("Failed to remove article. Please try again.","error")})}function u(e,t,a=!1){document.querySelectorAll(`[data-post-id="${e}"]`).forEach(i=>{i.classList.toggle("article-header__saved",t),a&&i.classList.toggle("save-post-btn-logout",a);const n=i.getAttribute("data-text-save"),o=i.getAttribute("data-text-saved"),s=i.querySelectorAll("span"),r=s[s.length-1];r&&(r.textContent=t?o||"Saved":n||"Save"),i.onclick=t?()=>l(e):()=>d(e,i)})}function p(e=1){if(window.tp&&window.tp.pianoId&&"function"==typeof window.tp.pianoId.isUserValid)if(window.tp.pianoId.isUserValid()){const t=s();if(!t)return void o.K.show({displayMode:"modal",screen:"login"});const a=new URLSearchParams({piano_user_id:t,page:e});fetch(`${AREMEDIA_PIANO_DATA.restUrl}?${a.toString()}`,{method:"GET",credentials:"same-origin"}).then(e=>e.json()).then(e=>{const t=document.querySelector(i.P.SELECTORS.SAVED_POSTS_CONTAINER);e.success&&e.data&&e.data.html?t.innerHTML=e.data.html:t.innerHTML="<p>No saved articles found.</p>",t.querySelectorAll(i.P.SELECTORS.SAVE_POST_BUTTON).forEach(e=>{const t=e.dataset.postId;e.onclick=()=>l(t)}),t.querySelectorAll(".saved-article-card__pagination a").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),p(e.dataset.page||1)})}),window.scrollTo({behavior:"instant",top:0})}).catch(e=>{n.v.warn("Piano Debug: Load saved posts request failed:",e);const t=document.querySelector(i.P.SELECTORS.SAVED_POSTS_CONTAINER);t&&(t.innerHTML="<p>Failed to load saved articles. Please try again.</p>")})}else window.tp.pianoId.show({displayMode:"modal",screen:"login"})}async function m(){const e=s();if(e)try{const t=new URLSearchParams({piano_user_id:e}),a=await fetch(`${AREMEDIA_PIANO_DATA.restUrl}/ids?${t.toString()}`,{method:"GET",credentials:"same-origin"}).then(e=>e.json()),n=a.success&&a.data&&Array.isArray(a.data.savedPostIds)?a.data.savedPostIds.map(String):[];document.querySelectorAll(i.P.SELECTORS.SAVE_POST_BUTTON).forEach(t=>{const a=t.dataset.postId,i=n.includes(a);t.classList.toggle("article-header__saved",i),t.classList.toggle("save-post-btn-logout",!e);const o=t.getAttribute("data-text-save"),s=t.getAttribute("data-text-saved"),r=t.querySelectorAll("span"),c=r[r.length-1];c&&(c.textContent=i?s||"Saved":o||"Save"),t.onclick=i?()=>l(a):()=>d(a,t)})}catch(e){n.v.warn("Piano Debug: Failed to update save buttons:",e)}}},8948(e,t,a){a.d(t,{S:()=>s});var i=a(2018),n=a(2192),o=a(5374);class s{static isAvailable(){return window.Sailthru&&"function"==typeof window.Sailthru.integration}static waitForSailthru(e=5e3){return new Promise(t=>{if(this.isAvailable())return void t(!0);const a=Date.now(),i=setInterval(()=>{this.isAvailable()?(clearInterval(i),t(!0)):Date.now()-a>=e&&(clearInterval(i),t(!1))},200)})}static async executeIntegration(e,t,a=null,i=null){try{return await this.waitForSailthru()?await new Promise(n=>{t.onSuccess=(...e)=>{a&&a(...e),n(!0)},t.onError=e=>{i&&i(e),n(!1)},window.Sailthru.integration(e,t),setTimeout(()=>{n(!1)},8e3)}):(n.v.warn("Piano Debug: Sailthru not available after waiting. Call dropped."),i&&i({error:"Sailthru not available"}),!1)}catch(e){return n.v.error("Piano Debug: Sailthru executeIntegration failed:",e),i&&i(e),!1}}static getSailthruLists(){return"undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.sailthruLists?AREMEDIA_PIANO_DATA.sailthruLists:[]}static getPremiumSailthruLists(){return"undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.sailthruPremiumLists?AREMEDIA_PIANO_DATA.sailthruPremiumLists:[]}static async trackUser(e,t=!0){try{if(!e.email)return n.v.warn("Piano Debug: Sailthru: No email provided for user tracking"),!1;const a={email:e.email,lists:{},vars:{}};if(t){const e=this.getSailthruLists();e.length>
10&&e.forEach(e=>{e.toLowerCase().includes("master")?a.lists[e]=1:a.vars[e]=1})}else delete a.lists;a.source=t?"web":"LOGIN";const s={first_name:e.firstName,last_name:e.lastName,postal_code:e.postCode,birth_date:e.dob_my,gender:e.gender};if(t){const e=o.UM.get(i.P.COOKIES.TEMPLATE_ID)||"",t=o.UM.get(i.P.COOKIES.OFFER_ID)||"",a=AREMEDIA_PIANO_DATA.sailthruVarPrefix||"";t&&a&&(s[`offer_${a}`]=(0,o.lA)(t,AREMEDIA_PIANO_DATA.offerIdMap),s[`offerid_${a}`]=t,s[`checkout_started_at_${a}`]=(new Date).toISOString()),e&&a&&(s[`template_${a}`]=(0,o.lA)(e,AREMEDIA_PIANO_DATA.templateIdMap),s[`templateid_${a}`]=e)}return Object.entries(s).forEach(([e,t])=>{t&&(a.vars[e]=t)}),await this.executeIntegration("userSignUp",a,()=>{n.v.log(`Piano Debug: Sailthru user ${t?"signup":"update"} tracked successfully.`)},e=>{n.v.warn(`Piano Debug: Sailthru user ${t?"signup":"update"} onError:`,e)}),!0}catch(e){return n.v.log("Piano Debug: Sailthru debug info:",{sailthruExists:!!window.Sailthru,sailthruType:typeof window.Sailthru,isArray:Array.isArray(window.Sailthru),hasIntegration:window.Sailthru&&"function"==typeof window.Sailthru.integration,sailthruString:window.Sailthru?window.Sailthru.toString():"undefined"}),!1}}static async trackUserSignup(e){return this.trackUser(e,!0)}static async trackUserUpdate(e){return this.trackUser(e,!1)}}},5374(e,t,a){a.d(t,{KI:()=>r,UM:()=>o,f8:()=>s,lA:()=>c});var i=a(2018),n=a(2192);class o{static get(e){const t=document.cookie.split("; ").map(e=>e.split("=")).find(([t])=>t===e);return t?decodeURIComponent(t[1]):null}static set(e,t,a={}){const n=a.maxAge||i.P.COOKIE_MAX_AGE,o=a.path||"/",s="https:"===window.location.protocol?"; Secure":"",r=`${e}=${encodeURIComponent(t)}; path=${o}; max-age=${n}; SameSite=Lax${s}`;document.cookie=r}static delete(e,t="/"){document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${t};`}static setLoginCookies(e){this.set(i.P.COOKIES.LOGGED_IN,"true"),this.set(i.P.COOKIES.FIRST_NAME,e)}static clearLoginCookies(){this.delete(i.P.COOKIES.LOGGED_IN),this.delete(i.P.COOKIES.FIRST_NAME)}static isLoggedIn(){return"true"===this.get(i.P.COOKIES.LOGGED_IN)}static getFirstName(){return this.get(i.P.COOKIES.FIRST_NAME)||""}static setPremiumAccess(){this.set(i.P.COOKIES.PREMIUM_ACCESS,"1",{maxAge:3600})}static clearPremiumAccess(){this.delete(i.P.COOKIES.PREMIUM_ACCESS)}static hasPremiumAccess(){return"1"===this.get(i.P.COOKIES.PREMIUM_ACCESS)}}class s{static executeBatchedOperation(e,t){requestAnimationFrame(()=>{e.forEach(e=>{document.querySelectorAll(e.selector).forEach(a=>{this.applyOperation(a,e,t)})})})}static applyOperation(e,t,a){switch(a){case"display":{const{show:a=!0,displayValue:i="block"}=t,n="boolean"==typeof a?a?i:"none":a;e.style.display=n;break}case"class":{const{show:a=!0,hideClass:i="piano-hidden"}=t;a?e.classList.remove(i):e.classList.add(i);break}case"text":e.textContent=t.text}}static setDisplay(e,t=!0,a="block"){const i=Array.isArray(e)?e:[{selector:e,show:t,displayValue:a}];this.executeBatchedOperation(i,"display")}static updateText(e,t){this.executeBatchedOperation([{selector:e,text:t}],"text")}static addEventListeners(e,t,a){document.querySelectorAll(e).forEach(e=>{e.addEventListener(t,a)})}}class r{static async computeSHA256(e){try{const t=(new TextEncoder).encode(e),a=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return n.v.warn("Piano Debug: Failed to compute SHA256 hash:",e),""}}}function c(e,t){return e&&t&&"object"==typeof t?t[e]||e:e||""}}};const t={};function a(i){const n=t[i];if(void 0!==n)return n.exports;const o=t[i]={exports:{}};return e[i](o,o.exports,a),o.exports}a.m=e,a.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var n=t[i++],o=t[i++];a.o(e,n)?0===o&&i++:0===o?Object.defineProperty(e,n,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,n,{enumerable:!0,get:o})}else for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,i)=>(a.f[i](e,t),t),[])),a.u=e=>"js/chunk."+{451:"cedcd6b92f9110438f4e",494:"98bb053a4b2fbb90a855",683:"3a3e8d3130ad
1d97d2642",980:"b3fa4238f559c2466627"}[e]+"."+{451:"piano-my-account",494:"piano-password-reset",683:"piano-sales-page",980:"piano-saved-articles"}[e]+".js",a.miniCssF=e=>{},a.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={},t="@xwp/express:";a.l=(i,n,o,s)=>{if(e[i])return void e[i].push(n);let r,c;if(void 0!==o){const e=document.getElementsByTagName("script");for(var d=0;d<e.length;d++){const a=e[d];if(a.getAttribute("src")==i||a.getAttribute("data-webpack")==t+o){r=a;break}}}r||(c=!0,r=document.createElement("script"),r.charset="utf-8",a.nc&&r.setAttribute("nonce",a.nc),r.setAttribute("data-webpack",t+o),r.src=i),e[i]=[n];const l=(t,a)=>{r.onerror=r.onload=null,clearTimeout(u);const n=e[i];if(delete e[i],r.parentNode?.removeChild(r),n?.forEach(e=>e(a)),t)return t(a)},u=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),c&&document.head.appendChild(r)}})(),(()=>{let e;globalThis.importScripts&&(e=globalThis.location+"");const t=globalThis.document;if(!e&&t&&("SCRIPT"===t.currentScript?.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){const a=t.getElementsByTagName("script");if(a.length){let t=a.length-1;for(;t>-1&&(!e||!/^http(s?):/.test(e));)e=a[t--].src}}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e+"../"})(),(()=>{const e={604:0};a.f.j=(t,i)=>{let n=a.o(e,t)?e[t]:void 0;if(0!==n)if(n)i.push(n[2]);else{const o=new Promise((a,i)=>n=e[t]=[a,i]);i.push(n[2]=o);const s=a.p+a.u(t),r=new Error,c=i=>{if(a.o(e,t)&&(n=e[t],0!==n&&(e[t]=void 0),n)){const e=i&&("load"===i.type?"missing":i.type),a=i&&i.target&&i.target.src;r.message="Loading chunk "+t+" failed.\n("+e+": "+a+")",r.name="ChunkLoadError",r.type=e,r.request=a,r.event=i,n[1](r)}};a.l(s,c,"chunk-"+t,t)}};const t=(t,i)=>{let[n,o,s]=i;var r,c,d=0;if(n.some(t=>0!==e[t])){for(r in o)a.o(o,r)&&(a.m[r]=o[r]);s&&s(a)}for(t&&t(i);d<n.length;d++)c=n[d],a.o(e,c)&&e[c]&&e[c][0](),e[c]=0},i=globalThis.webpackChunk_xwp_express||=[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var i=a(2018),n=a(2192),o=a(5374),s=a(7109),r=a(306),c=a(3742);a.p=(()=>{const e=document.currentScript;return e?.src?e.src.substring(0,e.src.lastIndexOf("/js/")+1):"/wp-content/themes/express/build/"})(),document.addEventListener("DOMContentLoaded",async function(){if(o.UM.hasPremiumAccess()){const e="undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.pianoTags||[];if((Array.isArray(e)?e:e.split(",").map(e=>e.trim())).includes("premium_content")&&(document.body.classList.add(i.P.BODY_CLASSES.PREMIUM_ACCESS),document.querySelector(i.P.SELECTORS.PAYWALL_WRAPPER)?.remove()),window.location.pathname.includes(i.P.PAGES.MY_WOMENS_WEEKLY))return void window.location.replace(i.P.PAGES.MEMBERSHIP)}const e=new s.O9;if(window.pianoIdManager=e,await e.initialize(),o.UM.isLoggedIn()&&e.authState.getUser()?.email){const t=await o.KI.computeSHA256(e.authState.getUser().email);t&&await r.A.updateLiveRampEnvelope(t)}window.location.pathname.includes(i.P.PAGES.MY_WOMENS_WEEKLY)&&a.e(683).then(a.bind(a,5605)).then(({initSalesPageFallback:e})=>e()).catch(e=>{n.v.warn("Piano Debug: Failed to load sales-page chunk:",e)}),window.tp.push(["init",function(){if(o.UM.isLoggedIn()&&!o.UM.hasPremiumAccess()){const t="undefined"!=typeof AREMEDIA_PIANO_DATA&&AREMEDIA_PIANO_DATA.pianoTags||[];(Array.isArray(t)?t:t.split(",").map(e=>e.trim())).includes("premium_content")&&e.recheckPremiumAccess()}if(!o.UM.hasPremiumAccess()&&window.location.pathname.includes(i.P.PAGES.MY_WOMENS_WEEKLY)){const e=AREMEDIA_PIANO_DATA.premiumResourceId||"",t=window.tp.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&window.tp.pianoId.isUserValid();e&&t&&window.tp.api&&"function"==typeof window.tp.api.callApi&&window.tp.api.callApi("/access/list",{},t=>{if(t?.data)for(const a in t.data){const n=t.data[a];if(n.granted&&n.resource?.rid===e)return o.UM.setPremiumAccess(),void window.location.replace(i.P.PAGES.MEMBERSHIP)}})}}]),window.location.pathname.includes(i.P.PAGES.MEMBERSHIP)&&document.querySelector(i.P.SELECTORS.MEMBERSHIP_DENIED)&&window.tp.push(["init",function(){const t=AREMEDIA_PIANO_DATA.premiumResourceId||"";t&&o.UM.isLoggedIn()&&window.tp.api.callApi("/access/list",{},async a=>{if(a?.data)for(const i in a.data){const n=a.data[i];if(n.granted&&n.resource?.rid===t){if(!await e.refreshServerPremiumAccess())return;return o.UM.setPremiumAccess(),void window.location.reload()}}})}]),document.querySelector(i.P.SELECTORS.MY_ACCOUNT_CONTAINER)&&a.e(451).then(a.bind(a,1177)).then(({initMyAccountPage:e})=>e()).catch(e=>{n.v.warn("Piano Debug: Failed to load my-account chunk:",e)}),document.querySelector(i.P.SELECTORS.PASSWORD_RESET_CONTAINER)&&a.e(494).then(a.bind(a,2034)).then(({initPasswordResetPage:e})=>e()).catch(e=>{n.v.warn("Piano Debug: Failed to load password-reset chunk:",e)}),document.querySelector(i.P.SELECTORS.SAVED_POSTS_CONTAINER)&&a.e(980).then(a.bind(a,8628)).then(({initSavedArticlesPage:e})=>e()).catch(e=>{n.v.warn("Piano Debug: Failed to load saved-articles chunk:",e)}),document.querySelectorAll(i.P.SELECTORS.SAVE_POST_BUTTON).forEac
1h(e=>{const t=e.dataset.postId;e.onclick=()=>(0,c.E0)(t,e)}),document.querySelector(i.P.SELECTORS.SAVE_POST_BUTTON)&&window.tp?.pianoId&&"function"==typeof window.tp.pianoId.isUserValid&&window.tp.pianoId.isUserValid()&&(0,c.Lw)(),(0,c.kq)()})})();

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.