(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]||(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]=[])).push(["object"==typeof document?document.currentScript:void 0,238430,e=>{"use strict";var t=e.i(902875),r=e.i(247865);e.s(["default",0,function({candidate:e,failedMessage:i="Authentication failed. Please try again.",protectMessage:n="Remove your adblocker.",fetch:a,refresh:o,getCustomAccountInfo:l}){let[s,u]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[m,f]=(0,r.useState)(!1),[p,g]=(0,r.useState)(!1),h=(0,r.useRef)([]);(0,r.useEffect)(()=>{e.id!==h.current[0]&&(h.current=[e.id],e.transactIDs&&h.current.push(...e.transactIDs))},[e.id,e.transactIDs]);let v=(0,r.useCallback)(()=>{try{a("/?adm_get_token=1").then(e=>{e.ok&&o()}).catch(()=>{u(i)})}catch{u(i)}},[a,i,o]),b=(0,r.useMemo)(()=>"u">typeof window?window:{admiral:{}},[]);return(0,r.useEffect)(()=>{typeof window>"u"||(b.admiral=b.admiral||function(...e){(b.admiral.q=b.admiral.q||[]).push(e)},b.admiral("after","measure.detected",function(t){if("abr"==e.requirement)t.adblocking?(u(n),d(!0)):g(!0);else if("account"==e.requirement||"benefits"==e.requirement){let t=!!l;b.admiral("after","visitor.latest",function(r){var i;if("account"===e.requirement)(t?l().registered:r.status.registered)||m||(u(n),d(!0));else if("benefits"===e.requirement){let r=[];if(t)r=l().benefits;else{let e=document.cookie.split(";");e&&(r=(null==(i=e.find(e=>e.startsWith("admbenefits=")))?void 0:i.split(","))??[])}if(r){let t=e.benefits??[];if(0==t.length)return void g(!0);let i=!1;for(let e of t)r.includes(e)&&(i=!0);i?g(!0):(u(n),d(!0))}else u(n),d(!0)}})}}))},[]),(0,r.useEffect)(()=>{p&&(g(!1),v())},[p,v]),(0,r.useEffect)(()=>{m||!c||(f(!0),b.admiral("targeting","force",{candidateIDs:h.current}))},[m,c,h,b]),(0,t.jsxs)("div",{children:[s||null," "]})}])},899507,e=>{"use strict";e.s(["isNil",0,function(e){return null==e}])},449928,760430,355200,e=>{"use strict";e.s(["isPrimitive",0,function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}],449928),e.s(["isTypedArray",0,function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}],760430),e.s(["isUnsafeProperty",0,function(e){return"__proto__"===e}],355200)},590238,e=>{"use strict";var t=e.i(725287),r=e.i(537989);e.i(609717);var i=e.i(950771),n=e.i(695203),a=e.i(604323),o=e.i(797770),l=e.i(236433),s=e.i(513539),u=e.i(991511);e.s(["AnalyticsBoundary",0,e=>{let c=(0,t.usePathname)();return(0,u.useRehydrateAtoms)([[r.pageIdAtom,e.pageId],[i.pageLocaleAtom,e.pageLocale],[n.deviceClassAtom,e.deviceClass],[a.metricsArticleDataAtom,e.metricsArticleData],[o.adsMetricsUnitAndZoneAtom,e.adsMetricsUnitAndZone??"non_monetized"],[s.layoutStateAtom,e.layoutState??null],[s.activeEventAtom,e.activeEvent??null],[l.pageAtomsPathnameAtom,c]]),null}])},539353,e=>{"use strict";e.i(288906);var t=e.i(247865),r=e.i(546446),i=e.i(540768),n=e.i(682142),a=e.i(782937),o=e.i(695881),l=e.i(333350),s=e.i(64412),u=e.i(950771),c=e.i(537989),d=e.i(695203),m=e.i(158662),f=e.i(358273),p=e.i(777638),g=e.i(727365),h=e.i(896363),v=e.i(924776),b=e.i(605781);let y=(0,o.createLogger)("useSignupComplete"),w=["SUN","MON","TUE","WED","THU","FRI","SAT"],C=new Set(["city","locality","neighborhood","airport","postal","poi","ski","geocode","locid"]),S=new Set(["mapbox","twc-poi","twc-v3-loc-search","twc-v3-loc-point"]),A=["appVersion","cookiesEnabled","dayOfWeek","deviceClass","formVariant","functionalTechnologies","genderFilled","geographicallyRelevantAds","gpcSignalOptOut","hourOfDay","locale","loginMethod","marketingOptedIn","newsletterOptedIn","pageId","partner","physicalCountry","physicalState","priv","regime","sessionId","sessionStartTime","url","wlocCity","wlocCountry","wlocDMA","wlocState"];e.s(["useSignupComplete",0,(e={})=>{let o=(0,r.useAtomValue)(c.pageIdAtom),I=(0,r.useAtomValue)(u.pageLocaleAtom),k=(0,r.useAtomValue)(d.deviceClassAtom),{location:E}=(0,s.useLocation)(),x=(0,r.useAtomValue)(m.experimentJoinListAtom),P=(0,v.useIsHightouchReady)(),R=(0,t.useRef)(!1),{formVariant:D,url:O,loginMethod:_,newsletterOptedIn:j,marketingOptedIn:M,sourcePage:N,sourceModule:L,sourceElement:T,sourcePosition:U}=e,V=(0,t.useMemo)(()=>{if(!l.default)return null;let e=(0,n.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,i.getCookie)("twc-location-country"),r=e?.["TWC-GeoIP-Region"]??(0,i.getCookie)("twc-location-region"),s=e?.["TWC-Privacy"]??(0,i.getCookie)("twc-privacy"),u=window.DprSdk?.getGdprConsentOptInsString()??"",c=window.DprSdk?.getCcpaSaleOptInString()??"",d=window.navigator?.globalPrivacyControl??!1,m=u?.includes("functional-technology")??!1,v=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,b=navigator?.cookieEnabled??!1,y=(0,i.getCookie)("partner")||"",A=(0,a.getPartnerByPattern)(y)??y,P=(0,f.getMetricsSession)(),R=P?.sessionId||"",V=P?.sessionStartTime||0,G=new Date,F=G.getHours(),B=w[G.getDay()]??"",z=-G.getTimezoneOffset()/60,W=document.referrer,H=(0,g.normalizeWlocType)(E?.type),K=E?.featureSource??null;return{formVariant:D??"",url:O??"",loginMethod:_??"Regular",newsletterOptedIn:j??!1,marketingOptedIn:M??!1,genderFilled:!1,sourcePage:N??null,sourceModule:L??null,sourceElement:T??null,sourcePosition:U??null,pageId:o??"",locale:I,deviceClass:k,sessionId:R,sessionStartTime:V,partner:A,wlocCity:E?.city??null,wlocCountry:E?.countryCode??null,wlocState:E?.adminDistrictCode??null,wlocDMA:E?.dmaCd??null,wlocId:E?.placeId??null,wlocFeatureSource:null!=K&&S.has(K)?K:void 0,wlocTags:E?.tags?.length?(0,h.parseArrayToString)(E.tags):null,wlocType:null!==H&&C.has(H)?H:void 0,wlocFeatureId:E?.featureId??null,dayOfWeek:B,regime:s??"",cookiesEnabled:b,gpcSignalOptOut:d,functionalTechnologies:m,geographicallyRelevantAds:v,priv:u,privProducts:c,referrer:W,deviceTimeZone:z,hourOfDay:F,physicalCountry:t??"",physicalState:r??"",interestBasedAds:window.DprSdk?.getUserConsent("interest-based-ads")!==!1,campaign:(0,p.getCampaign)()??void 0,tpcc:(0,p.getTpcc)(),linkReferral:(0,p.getLinkReferral)(),experimentJoinList:x,weatherMode:"normal",samsungVersion:(0,p.getSamsungVersion)(),appVersion:"389773fb268e11f29ae005c6d1e2df0edccc3d48".slice(0,10)}},[D,O,_,j,M,N,L,T,U,o,I,k,E,x]),G=P&&null!==V&&A.every(e=>void 0!==V[e]);return(0,t.useCallback)(()=>{if(V&&G&&!R.current)try{(0,b.trackSignupComplete)(V),R.current=!0,y.info('Hightouch: Event "signup-complete" tracked')}catch(e){y.error('Hightouch: Event "signup-complete" failed',{error:e})}},[V,G])}])},965257,e=>{"use strict";e.i(288906);var t=e.i(247865),r=e.i(725287),i=e.i(546446),n=e.i(540768),a=e.i(682142),o=e.i(782937),l=e.i(695881),s=e.i(333350),u=e.i(64412),c=e.i(950771),d=e.i(537989),m=e.i(695203),f=e.i(158662),p=e.i(358273),g=e.i(777638),h=e.i(122124),v=e.i(924776),b=e.i(409628),y=e.i(605781),w=e.i(289681);let C=(0,l.createLogger)("useTrackAlertSubscriptionChanged");e.s(["useTrackAlertSubscriptionChanged",0,()=>{let e=(0,i.useAtomValue)(d.pageIdAtom),l=(0,i.useAtomValue)(c.pageLocaleAtom),S=(0,i.useAtomValue)(m.deviceClassAtom),A=(0,i.useAtomValue)(f.experimentJoinListAtom),I=(0,r.usePathname)(),{location:k}=(0,u.useLocation)(),E=(0,v.useIsHightouchReady)(),x=(0,t.useCallback)(({name:t,status:r,alertId:i})=>{let s=(0,a.getCICookie)(),u=s?.["TWC-GeoIP-Country"]??(0,n.getCookie)("twc-location-country"),c=s?.["TWC-GeoIP-Region"]??(0,n.getCookie)("twc-location-region"),d=s?.["TWC-Privacy"]??(0,n.getCookie)("twc-privacy"),m=window.DprSdk?.getGdprConsentOptInsString()??"",f=window.DprSdk?.getCcpaSaleOptInString()??"",v=window.navigator?.globalPrivacyControl??!1,y=m?.includes("functional-technology")??!1,C=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,E=window.DprSdk?.getUserConsent("interest-based-ads")!==!1,x=(0,w.getConsentAuthorization)("sale-of-data"),P=(0,w.getConsentAuthorization)("sensitive-data"),R=navigator?.cookieEnabled??!1,D=(0,n.getCookie)("partner")||"",O=(0,o.getPartnerByPattern)(D)??D,_=(0,p.getMetricsSession)(),j=_?.sessionId||"",M=new Date(_?.sessionStartTime||0).toISOString(),N=new Date,L=N.getHours(),T=b.WEEK_DAYS[N.getDay()]??"";return{name:t,status:r?"enabled":"disabled",alertId:i??null,pageId:e??"",url:(0,h.getAnonymizedPath)(I??""),referrer:document.referrer,locale:l,deviceClass:S,partner:O,sessionId:j,sessionStartTime:M,siteMode:"normal",dayOfWeek:T,hourOfDay:L,regime:d??"",cookiesEnabled:R,gpcSignalOptOut:v,functionalTechnologies:y,geographicallyRelevantAds:C,interestBasedAds:E,priv:m,privProducts:f,saleOfDataAuthorization:x,sensitiveDataAuthorization:P,campaign:(0,g.getCampaign)(),experimentJoinList:A,weatherMode:"normal",physicalCountry:u??"",physicalState:c??"",wlocCity:k?.city??null,wlocCountry:k?.countryCode??null,wlocState:k?.adminDistrictCode??null,wlocDMA:k?.dmaCd??null,samsungVersion:(0,g.getSamsungVersion)(),appVersion:"389773fb268e11f29ae005c6d1e2df0edccc3d48".slice(0,10)}},[e,l,S,A,I,k]);return(0,t.useCallback)(e=>{if(s.default){if(!E)return void C.warn('Hightouch: Event "alert-subscription-changed" skipped - SDK not ready');try{(0,y.trackAlertSubscriptionChanged)(x(e)),C.info('Hightouch: Event "alert-subscription-changed" tracked')}catch(e){C.error('Hightouch: Event "alert-subscription-changed" failed',{error:e})}}},[E,x])}])},279887,e=>{"use strict";var t=e.i(487709),r=e.i(737801),i=e.i(247865);e.s(["useTrackEmailSubscription",0,()=>{let e="alert-subscription-changed",n=(0,r.useEventAttributes)();return(0,i.useCallback)(({name:r,status:i})=>{let a={...n,name:r,status:i?"enabled":"disabled"};if(!(0,t.canLogEvent)())return void console.warn("MParticle is not loaded");try{window.mParticle?.logEvent?.(e,window.mParticle?.EventType?.Other,a),console.debug(`MParticle: Event "${e}" tracked`,a)}catch(t){console.error(`MParticle: Event "${e}" failed`,t)}},[n])}])},658547,592188,e=>{"use strict";var t=e.i(247865),r=e.i(491240);let i=(e,t)=>{let r;return(r=!1,Promise.race([new Promise(e=>{let t=()=>{if(!r){if(window.mParticle?.ready)return void window.mParticle.ready(()=>e());setTimeout(t,50)}};t()}),new Promise((e,t)=>{setTimeout(()=>{t(Error("MParticle did not become ready in time"))},2e3)})]).finally(()=>{r=!0})).then(()=>window.mParticle?.Identity?.[e]?.(t))};e.s(["useUserIdentity",0,()=>{let e=(0,t.useCallback)(e=>i("identify",{userIdentities:{customerid:e.customerid,email:e.email,other:(0,r.truncateIdentityValue)(e.other)}}),[]);return{identify:e,login:(0,t.useCallback)(e=>i("login",{userIdentities:{customerid:e.customerid,email:e.email,facebook:e.facebook,facebookcustomaudienceid:e.facebookcustomaudienceid,google:e.google,microsoft:e.microsoft,other:(0,r.truncateIdentityValue)(e.other),other2:(0,r.truncateIdentityValue)(e.other2),other3:(0,r.truncateIdentityValue)(e.other3),other4:(0,r.truncateIdentityValue)(e.other4),twitter:e.twitter,yahoo:e.yahoo}}),[]),logout:(0,t.useCallback)(()=>i("logout",{userIdentities:{}}),[])}}],658547);var n=e.i(546446),a=e.i(540768),o=e.i(682142),l=e.i(782937),s=e.i(695881),u=e.i(333350),c=e.i(64412),d=e.i(950771),m=e.i(537989),f=e.i(695203),p=e.i(358273),g=e.i(158662),h=e.i(777638),v=e.i(924776),b=e.i(409628),y=e.i(605781);let w=(0,s.createLogger)("useUserLoggedIn");e.s(["useUserLoggedIn",0,(e={})=>{let r=(0,n.useAtomValue)(m.pageIdAtom),i=(0,n.useAtomValue)(d.pageLocaleAtom),s=(0,n.useAtomValue)(f.deviceClassAtom),C=(0,n.useAtomValue)(g.experimentJoinListAtom),{location:S}=(0,c.useLocation)(),A=(0,v.useIsHightouchReady)(),{url:I}=e;return(0,t.useCallback)(()=>{if(!u.default||!A)return;let e=(0,o.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,a.getCookie)("twc-location-country"),n=e?.["TWC-GeoIP-Region"]??(0,a.getCookie)("twc-location-region"),c=e?.["TWC-Privacy"]??(0,a.getCookie)("twc-privacy"),d=window.DprSdk?.getGdprConsentOptInsString()??"",m=window.DprSdk?.getCcpaSaleOptInString()??"",f=window.navigator?.globalPrivacyControl??!1,g=d?.includes("functional-technology")??!1,v=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,k=navigator?.cookieEnabled??!1,E=(0,a.getCookie)("partner")||"",x=(0,l.getPartnerByPattern)(E)??E,P=(0,p.getMetricsSession)(),R=P?.sessionId||"",D=P?.sessionStartTime||0,O=new Date,_=O.getHours(),j=b.WEEK_DAYS[O.getDay()]??"",M=-O.getTimezoneOffset()/60,N=document.referrer,L={url:I??window.location.pathname,referrer:N,privProducts:m,deviceTimeZone:M,pageId:r??"",locale:i,deviceClass:s,sessionId:R,sessionStartTime:D,partner:x,wlocCity:S?.city??null,wlocCountry:S?.countryCode??null,wlocState:S?.adminDistrictCode??null,wlocDMA:S?.dmaCd??null,dayOfWeek:j,regime:c??"",cookiesEnabled:k,gpcSignalOptOut:f,functionalTechnologies:g,geographicallyRelevantAds:v,priv:d,hourOfDay:_,physicalCountry:t??"",physicalState:n??"",campaign:(0,h.getCampaign)()??void 0,tpcc:(0,h.getTpcc)(),linkReferral:(0,h.getLinkReferral)(),experimentJoinList:C,weatherMode:"normal",samsungVersion:(0,h.getSamsungVersion)(),appVersion:"389773fb268e11f29ae005c6d1e2df0edccc3d48".slice(0,10)};try{(0,y.trackUserLoggedin)(L),w.info('Hightouch: Event "user-loggedin" tracked')}catch(e){w.error('Hightouch: Event "user-loggedin" failed',{error:e})}},[I,r,i,s,C,S,A])}],592188)},952582,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_SUBSCRIPTIONS=r.ON_YOUR_RADAR_GROUP=r.MARKETING_EMAILS_GROUP=r.WEEKLY_BRIEF_GROUP=r.DAILY_NEWSLETTERS_GROUP=void 0,r.DAILY_NEWSLETTERS_GROUP="daily-newsletters-1",r.WEEKLY_BRIEF_GROUP="weekly-brief",r.MARKETING_EMAILS_GROUP="marketing-emails-1",r.ON_YOUR_RADAR_GROUP="on-your-radar",r.DEFAULT_SUBSCRIPTIONS=[{subscriptionGroupName:r.DAILY_NEWSLETTERS_GROUP,subscriptionGroupId:"",isSubscribed:!1,attributes:{location:""}},{subscriptionGroupName:r.WEEKLY_BRIEF_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:r.MARKETING_EMAILS_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:r.ON_YOUR_RADAR_GROUP,subscriptionGroupId:"",isSubscribed:!1}]},370220,(e,t,r)=>{"use strict";e.i(288906),Object.defineProperty(r,"__esModule",{value:!0}),r.getEmailPreferencesStatusUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/status"}},r.getEmailPreferencesSetUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/set"}},r.getEmailPreferencesChangeEmailUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/change-email"}};let i="weather.com"},454307,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.setEmailPreferences=o,r.updateSubscription=l;let i=e.r(678651),n=e.r(414655),a=e.r(370220);async function o(e){let t=(0,a.getEmailPreferencesSetUrlConfig)(),r=(0,i.urlFrom)(t),o=JSON.stringify(function(e){let{subscriptions:t,email:r,mParticleId:i}=e,n={};return t&&(n.subscriptions=t),r&&(n.email=r),i&&(n.mParticleId=i),n}(e)),l=await fetch(r,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:o});return 200===l.status||400===l.status?await l.json():(0,n.handleFetchResponse)(l)}async function l(e,t,r){return o({subscriptions:[{subscriptionGroupName:e,isSubscribed:t,...r&&{attributes:r}}]})}},451086,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getEmailPreferencesStatus=o;let i=e.r(678651),n=e.r(414655),a=e.r(370220);async function o(){let e=(0,a.getEmailPreferencesStatusUrlConfig)(),t=(0,i.urlFrom)(e),r=await fetch(t,{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"},next:{revalidate:60}});return(0,n.handleFetchResponse)(r)}},695478,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.findSubscriptionGroup=void 0,r.getMorningBriefAttrs=function(e){return{location:e.placeId,latitude:e.latitude,longitude:e.longitude,dmaCode:e.dmaCd||null,adminDistrict:e.adminDistrict,adminDistrictCode:e.adminDistrictCode||null,postalCode:e.postalCode}},r.findSubscriptionGroup=(e,t,r)=>e&&Array.isArray(e)?e.find(e=>e.subscriptionGroupName===t)||r||null:r||null},558802,e=>{"use strict";var t=e.i(902875),r=e.i(247865),i=e.i(747961);let n=(0,r.forwardRef)(({title:e,titleId:r,desc:i,descId:n,...a},o)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:o,"aria-labelledby":r,"aria-describedby":n,...a,children:[i?(0,t.jsx)("desc",{id:n,children:i}):null,void 0===e?(0,t.jsx)("title",{id:r,children:"Locked"}):e?(0,t.jsx)("title",{id:r,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M12 7h-1V4a3 3 0 0 0-6 0v3H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1M6 4a2 2 0 1 1 4 0v3H6zm6 10H4V8h8z"})]})),a=r.default.forwardRef((e,r)=>(0,t.jsx)(i.BaseIcon,{ref:r,icon:n,...e}));a.displayName="Locked",e.s(["Locked",0,a])},245308,e=>{"use strict";var t=e.i(902875),r=e.i(247865),i=e.i(747961);let n=(0,r.forwardRef)(({title:e,titleId:r,desc:i,descId:n,...a},o)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:o,"aria-labelledby":r,"aria-describedby":n,...a,children:[i?(0,t.jsx)("desc",{id:n,children:i}):null,void 0===e?(0,t.jsx)("title",{id:r,children:"View"}):e?(0,t.jsx)("title",{id:r,children:e}):null,(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("path",{d:"M15.47 7.83A8.35 8.35 0 0 0 8 2.5 8.35 8.35 0 0 0 .53 7.83a.5.5 0 0 0 0 .34A8.35 8.35 0 0 0 8 13.5a8.35 8.35 0 0 0 7.47-5.33.5.5 0 0 0 0-.34M8 12.5c-2.65 0-5.45-1.965-6.465-4.5C2.55 5.465 5.35 3.5 8 3.5s5.45 1.965 6.465 4.5C13.45 10.535 10.65 12.5 8 12.5"}),(0,t.jsx)("path",{d:"M8 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6m0 5a2 2 0 1 1 0-4 2 2 0 0 1 0 4"})]})]})),a=r.default.forwardRef((e,r)=>(0,t.jsx)(i.BaseIcon,{ref:r,icon:n,...e}));a.displayName="View",e.s(["View",0,a])},846871,e=>{"use strict";var t=e.i(902875),r=e.i(294237),i=e.i(632137);let n=(0,r.cva)("inline-block rounded-full border-solid animate-spin box-border",{variants:{size:{sm:"w-4 h-4 border-[2px]",md:"w-6 h-6 border-[2px]",lg:"w-8 h-8 border-[3px]"},variant:{white:"border-white border-b-transparent",primary:"border-brand-400 border-b-transparent",black:"border-[#252422] border-b-transparent"}},defaultVariants:{size:"sm",variant:"black"}});e.s(["Loader",0,({className:e,size:r,variant:a,label:o})=>(0,t.jsx)("div",{className:(0,i.cn)(n({size:r,variant:a}),e),"aria-label":o})])},546334,e=>{"use strict";var t=e.i(902875),r=e.i(247865),i=e.i(725287),n=e.i(381477),a=e.i(925209),o=e.i(564993),l=e.i(985542),s=e.i(612977),u=e.i(368847),c=e.i(877957),d=/[\\\/_+.#"@\[\(\{&]/,m=/[\\\/_+.#"@\[\(\{&]/g,f=/[\s-]/,p=/[\s-]/g;function g(e){return e.toLowerCase().replace(p," ")}var h=e.i(396817),v=e.i(942928),b=e.i(296994),y=e.i(271359),w='[cmdk-group=""]',C='[cmdk-group-items=""]',S='[cmdk-item=""]',A=`${S}:not([aria-disabled="true"])`,I="cmdk-item-select",k="data-value",E=(e,t,r)=>{var i;return i=e,function e(t,r,i,n,a,o,l){if(o===r.length)return a===t.length?1:.99;var s=`${a},${o}`;if(void 0!==l[s])return l[s];for(var u,c,g,h,v=n.charAt(o),b=i.indexOf(v,a),y=0;b>=0;)(u=e(t,r,i,n,b+1,o+1,l))>y&&(b===a?u*=1:d.test(t.charAt(b-1))?(u*=.8,(g=t.slice(a,b-1).match(m))&&a>0&&(u*=Math.pow(.999,g.length))):f.test(t.charAt(b-1))?(u*=.9,(h=t.slice(a,b-1).match(p))&&a>0&&(u*=Math.pow(.999,h.length))):(u*=.17,a>0&&(u*=Math.pow(.999,b-a))),t.charAt(b)!==r.charAt(o)&&(u*=.9999)),(u<.1>u&&(u=.1*c),u>y&&(y=u),b=i.indexOf(v,b+1);return l[s]=y,y}(i=r&&r.length>0?`${i+" "+r.join(" ")}`:i,t,g(i),g(t),0,0,{})},x=r.createContext(void 0),P=r.createContext(void 0),R=r.createContext(void 0),D=r.forwardRef((e,t)=>{let i=G(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=G(()=>new Set),a=G(()=>new Map),o=G(()=>new Map),l=G(()=>new Set),s=U(e),{label:u,children:c,value:d,onValueChange:m,filter:f,shouldFilter:p,loop:g,disablePointerSelection:h=!1,vimBindings:y=!0,...R}=e,D=(0,b.useId)(),O=(0,b.useId)(),_=(0,b.useId)(),j=r.useRef(null),M=z();V(()=>{if(void 0!==d){let e=d.trim();i.current.value=e,N.emit()}},[d]),V(()=>{M(6,$)},[]);let N=r.useMemo(()=>({subscribe:e=>(l.current.add(e),()=>l.current.delete(e)),snapshot:()=>i.current,setState:(e,t,r)=>{var n,a,o,l;if(!Object.is(i.current[e],t)){if(i.current[e]=t,"search"===e)K(),F(),M(1,B);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(_);e?e.focus():null==(n=document.getElementById(D))||n.focus()}if(M(7,()=>{var e;i.current.selectedItemId=null==(e=q())?void 0:e.id,N.emit()}),r||M(5,$),(null==(a=s.current)?void 0:a.value)!==void 0){null==(l=(o=s.current).onValueChange)||l.call(o,null!=t?t:"");return}}N.emit()}},emit:()=>{l.current.forEach(e=>e())}}),[]),L=r.useMemo(()=>({value:(e,t,r)=>{var n;t!==(null==(n=o.current.get(e))?void 0:n.value)&&(o.current.set(e,{value:t,keywords:r}),i.current.filtered.items.set(e,T(t,r)),M(2,()=>{F(),N.emit()}))},item:(e,t)=>(n.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),M(3,()=>{K(),F(),i.current.value||B(),N.emit()}),()=>{o.current.delete(e),n.current.delete(e),i.current.filtered.items.delete(e);let t=q();M(4,()=>{K(),(null==t?void 0:t.getAttribute("id"))===e&&B(),N.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{o.current.delete(e),a.current.delete(e)}),filter:()=>s.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:D,inputId:_,labelId:O,listInnerRef:j}),[]);function T(e,t){var r,n;let a=null!=(n=null==(r=s.current)?void 0:r.filter)?n:E;return e?a(e,i.current.search,t):0}function F(){if(!i.current.search||!1===s.current.shouldFilter)return;let e=i.current.filtered.items,t=[];i.current.filtered.groups.forEach(r=>{let i=a.current.get(r),n=0;i.forEach(t=>{n=Math.max(e.get(t),n)}),t.push([r,n])});let r=j.current;Y().sort((t,r)=>{var i,n;let a=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(i=e.get(o))?i:0)-(null!=(n=e.get(a))?n:0)}).forEach(e=>{let t=e.closest(C);t?t.appendChild(e.parentElement===t?e:e.closest(`${C} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${C} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=j.current)?void 0:t.querySelector(`${w}[${k}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function B(){let e=Y().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(k);N.setState("value",t||void 0)}function K(){var e,t,r,l;if(!i.current.search||!1===s.current.shouldFilter){i.current.filtered.count=n.current.size;return}i.current.filtered.groups=new Set;let u=0;for(let a of n.current){let n=T(null!=(t=null==(e=o.current.get(a))?void 0:e.value)?t:"",null!=(l=null==(r=o.current.get(a))?void 0:r.keywords)?l:[]);i.current.filtered.items.set(a,n),n>0&&u++}for(let[e,t]of a.current)for(let r of t)if(i.current.filtered.items.get(r)>0){i.current.filtered.groups.add(e);break}i.current.filtered.count=u}function $(){var e,t,r;let i=q();i&&((null==(e=i.parentElement)?void 0:e.firstChild)===i&&(null==(r=null==(t=i.closest(w))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function q(){var e;return null==(e=j.current)?void 0:e.querySelector(`${S}[aria-selected="true"]`)}function Y(){var e;return Array.from((null==(e=j.current)?void 0:e.querySelectorAll(A))||[])}function J(e){let t=Y()[e];t&&N.setState("value",t.getAttribute(k))}function Z(e){var t;let r=q(),i=Y(),n=i.findIndex(e=>e===r),a=i[n+e];null!=(t=s.current)&&t.loop&&(a=n+e0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,w):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,w))?void 0:r.querySelector(A);i?N.setState("value",i.getAttribute(k)):Z(e)}let X=()=>J(Y().length-1),ee=e=>{e.preventDefault(),e.metaKey?X():e.altKey?Q(1):Z(1)},et=e=>{e.preventDefault(),e.metaKey?J(0):e.altKey?Q(-1):Z(-1)};return r.createElement(v.Primitive.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=R.onKeyDown)||t.call(R,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":y&&e.ctrlKey&&ee(e);break;case"ArrowDown":ee(e);break;case"p":case"k":y&&e.ctrlKey&&et(e);break;case"ArrowUp":et(e);break;case"Home":e.preventDefault(),J(0);break;case"End":e.preventDefault(),X();break;case"Enter":{e.preventDefault();let t=q();if(t){let e=new Event(I);t.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:H},u),W(e,e=>r.createElement(P.Provider,{value:N},r.createElement(x.Provider,{value:L},e))))}),O=r.forwardRef((e,t)=>{var i,n;let a=(0,b.useId)(),o=r.useRef(null),l=r.useContext(R),s=r.useContext(x),u=U(e),c=null!=(n=null==(i=u.current)?void 0:i.forceMount)?n:null==l?void 0:l.forceMount;V(()=>{if(!c)return s.item(a,null==l?void 0:l.id)},[c]);let d=B(a,o,[e.value,e.children,o],e.keywords),m=r.useContext(P),f=F(e=>e.value&&e.value===d.current),p=F(e=>!!c||!1===s.filter()||!e.search||e.filtered.items.get(a)>0);function g(){var e,t;h(),null==(t=(e=u.current).onSelect)||t.call(e,d.current)}function h(){m.setState("value",d.current,!0)}if(r.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(I,g),()=>t.removeEventListener(I,g)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:w,value:C,onSelect:S,forceMount:A,keywords:k,...E}=e;return r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(o,t),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!f,"data-disabled":!!w,"data-selected":!!f,onPointerMove:w||s.getDisablePointerSelection()?void 0:h,onClick:w?void 0:g},e.children)}),_=r.forwardRef((e,t)=>{let{heading:i,children:n,forceMount:a,...o}=e,l=(0,b.useId)(),s=r.useRef(null),u=r.useRef(null),c=(0,b.useId)(),d=r.useContext(x),m=F(e=>!!a||!1===d.filter()||!e.search||e.filtered.groups.has(l));V(()=>d.group(l),[]),B(l,s,[e.value,e.heading,u]);let f=r.useMemo(()=>({id:l,forceMount:a}),[a]);return r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(s,t),...o,"cmdk-group":"",role:"presentation",hidden:!m||void 0},i&&r.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:c},i),W(e,e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?c:void 0},r.createElement(R.Provider,{value:f},e))))}),j=r.forwardRef((e,t)=>{let{alwaysRender:i,...n}=e,a=r.useRef(null),o=F(e=>!e.search);return i||o?r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(a,t),...n,"cmdk-separator":"",role:"separator"}):null}),M=r.forwardRef((e,t)=>{let{onValueChange:i,...n}=e,a=null!=e.value,o=r.useContext(P),l=F(e=>e.search),s=F(e=>e.selectedItemId),u=r.useContext(x);return r.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),r.createElement(v.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":s,id:u.inputId,type:"text",value:a?e.value:l,onChange:e=>{a||o.setState("search",e.target.value),null==i||i(e.target.value)}})}),N=r.forwardRef((e,t)=>{let{children:i,label:n="Suggestions",...a}=e,o=r.useRef(null),l=r.useRef(null),s=F(e=>e.selectedItemId),u=r.useContext(x);return r.useEffect(()=>{if(l.current&&o.current){let e=l.current,t=o.current,r,i=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return i.observe(e),()=>{cancelAnimationFrame(r),i.unobserve(e)}}},[]),r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":n,id:u.listId},W(e,e=>r.createElement("div",{ref:(0,y.composeRefs)(l,u.listInnerRef),"cmdk-list-sizer":""},e)))}),L=r.forwardRef((e,t)=>{let{open:i,onOpenChange:n,overlayClassName:a,contentClassName:o,container:l,...s}=e;return r.createElement(h.Root,{open:i,onOpenChange:n},r.createElement(h.Portal,{container:l},r.createElement(h.Overlay,{"cmdk-overlay":"",className:a}),r.createElement(h.Content,{"aria-label":e.label,"cmdk-dialog":"",className:o},r.createElement(D,{ref:t,...s}))))}),T=Object.assign(D,{List:N,Item:O,Input:M,Group:_,Separator:j,Dialog:L,Empty:r.forwardRef((e,t)=>F(e=>0===e.filtered.count)?r.createElement(v.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:r.forwardRef((e,t)=>{let{progress:i,children:n,label:a="Loading...",...o}=e;return r.createElement(v.Primitive.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},W(e,e=>r.createElement("div",{"aria-hidden":!0},e)))})});function U(e){let t=r.useRef(e);return V(()=>{t.current=e}),t}var V="u"e(t.snapshot());return r.useSyncExternalStore(t.subscribe,i,i)}function B(e,t,i,n=[]){let a=r.useRef(),o=r.useContext(x);return V(()=>{var r;let l=(()=>{var e;for(let t of i){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),s=n.map(e=>e.trim());o.value(e,l,s),null==(r=t.current)||r.setAttribute(k,l),a.current=l}),a}var z=()=>{let[e,t]=r.useState(),i=G(()=>new Map);return V(()=>{i.current.forEach(e=>e()),i.current=new Map},[e]),(e,r)=>{i.current.set(e,r),t({})}};function W({asChild:e,children:t},i){let n;return e&&r.isValidElement(t)?r.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},i(t.props.children)):i(t)}var H={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let K=(0,e.i(514514).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);var $=e.i(632137);function q({className:e,...r}){return(0,t.jsx)(T,{"data-slot":"command",className:(0,$.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r})}function Y({className:e,...r}){return(0,t.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,t.jsx)(K,{className:"size-4 shrink-0 opacity-50"}),(0,t.jsx)(T.Input,{"data-slot":"command-input",className:(0,$.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function J({className:e,...r}){return(0,t.jsx)(T.List,{"data-slot":"command-list",className:(0,$.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...r})}function Z({className:e,...r}){return(0,t.jsx)(T.Group,{"data-slot":"command-group",className:(0,$.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...r})}function Q({className:e,...r}){return(0,t.jsx)(T.Item,{"data-slot":"command-item",className:(0,$.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}e.i(62544);var X=e.i(809058);e.s(["LocationInput",0,function({location:e,onChangeLocation:d,label:m="Search for a location",placeholder:f="Search city or zip code",className:p,error:g,disabled:h=!1}){let v=(0,i.useParams)(),b=v?.locale,[y,w]=(0,r.useState)(!1),[C,S]=(0,r.useState)(""),A=(0,s.default)(C.trim(),300),I=e?`${e.city}, ${e.adminDistrictCode||e.adminDistrict||e.displayContext}`:null,{isLoading:k,data:E}=(0,n.default)(A?["location-search",A,b]:null,([,e,t])=>(0,l.getLocationsByQuery)(e,t));return(0,t.jsxs)("div",{className:"w-full min-w-0",children:[(0,t.jsxs)(X.Popover,{open:y,onOpenChange:w,children:[(0,t.jsx)(X.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(c.Button,{variant:"outline",role:"combobox",disabled:h,"aria-expanded":y,"aria-invalid":!!g,className:(0,$.cn)("flex w-full justify-start gap-2 bg-white px-3 text-left font-normal text-gray-900",p,!!e&&"border-black",g&&"border-alert-severe"),children:[k?(0,t.jsx)(o.LoaderCircle,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true",title:""}):(0,t.jsx)(a.Location,{className:"size-4 shrink-0","aria-hidden":"true",title:""}),(0,t.jsx)("span",{className:"flex-1 truncate",children:I??m})]})}),(0,t.jsx)(X.PopoverContent,{side:"bottom",align:"start",collisionPadding:8,className:"w-(--radix-popover-trigger-width) p-0",showArrow:!1,children:(0,t.jsxs)(q,{shouldFilter:!1,children:[(0,t.jsx)(Y,{placeholder:f,value:C,onValueChange:S}),(0,t.jsx)(J,{className:"max-h-[min(200px,46vh)] min-h-10",children:(0,t.jsx)(Z,{children:E?.map(e=>(0,t.jsx)(Q,{value:e.locId,onSelect:()=>{d(e),w(!1)},children:e.address},e.locId))})})]})})]}),g&&(0,t.jsx)(u.Text,{variant:"Caption.S",color:"error",className:"mt-1",children:g})]})}],546334)},143851,e=>{"use strict";var t=e.i(546446),r=e.i(245943),i=e.i(45846),n=e.i(310847),a=e.i(776169),o=e.i(671525),l=e.i(658547),s=e.i(18358),u=e.i(592188),c=e.i(539353),d=e.i(521350),m=e.i(756227),f=e.i(553329),p=e.i(358273),g=e.i(459598),h=e.i(695881),v=e.i(735526);let b=(0,h.createLogger)("useUserLogin"),y=/^(?:\/[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,4})?)?\/subscribe\/checkout\/?$/;e.s(["useUserLogin",0,function(){let e=(0,t.useSetAtom)(n.userHasLoggedInBeforeAtom),h=(0,m.useResetAuthState)(),w=(0,t.useAtomValue)(n.wxuLoginRedirectPageAtom),C=(0,t.useAtomValue)(n.wxuUserAnonymousIdAtom),{syncPreferencesFromUpsx:S,updatePreferences:A}=(0,a.usePreferences)(),{navigate:I}=(0,o.default)(),{login:k}=(0,l.useUserIdentity)(),E=(0,s.useTrackEvent)(),x=(0,u.useUserLoggedIn)(),P=(0,c.useSignupComplete)({url:window.location.pathname}),R=e=>{(0,p.regenerateMetricsSession)(),(0,g.suppressNextPurchaseAbandon)(),(0,g.suppressNextHightouchPurchaseAbandon)();let t=new URLSearchParams(window.location.search).get("ref"),r=y.test(window.location.pathname)?`${window.location.pathname}${window.location.search}`:null;I(e??r??(t&&`https://${t}`)??w)},D=async(t,r=!0,n={})=>{h(),t?.type==="signup"&&(0,v.markAccountCreated)(),(0,d.isLocalStorageAvailable)()&&localStorage.setItem("PARTNERS_SYNC","true"),e(!0),await S()||await A({});try{await i.upsxClient.purchase.getPurchaseToken()}catch(e){console.error("Failed to get UPSX token:",e)}if(t?.userID){let{error:e}=await (0,f.tryCatch)(k({email:t.email,customerid:t.userID,other:C}));e&&b.error("Failed to establish mParticle identity:",e);let r="signup"===t.type,i=r&&n.skipSignupCompleteEvent;i||E(r?"signup-complete":"user-loggedin",{url:window.location.pathname}),r&&!i&&P(),r||x()}r&&R()};return{login:async(e,t)=>{try{let r=await i.upsxClient.auth.login({email:e,password:t});if(!r)return{success:!1,error:{}};return await D({email:r.email,userID:r.userID,type:"login"}),{success:!0}}catch(e){if(console.error("Failed to login",e),e instanceof r.APIError){let t=e.data;return{success:!1,error:{code:e.code,...t}}}return{success:!1,error:{}}}},authSuccess:D,authRedirect:R}}])},790010,e=>{"use strict";var t=e.i(245943),r=e.i(45846),i=e.i(143851);e.s(["useUserSignup",0,function(){let{authSuccess:e,authRedirect:n}=(0,i.useUserLogin)();return{signup:async(i,n=!0,a={})=>{try{let t=await (i.password?r.upsxClient.auth.register({email:i.email,password:i.password,firstName:i.firstName}):r.upsxClient.auth.registerPasswordless({email:i.email,firstName:i.firstName}));return await e({email:t.email,userID:t.userID,type:"signup"},n,a),{success:!0,data:{email:t.email,userID:t.userID}}}catch(e){if(console.error("Failed to signup",e),e instanceof t.APIError){let t=e.data;return{success:!1,error:{code:e.code,...t}}}return{success:!1,error:{}}}},authRedirect:n}}])},422825,e=>{"use strict";var t=e.i(546446),r=e.i(381477),i=e.i(899507),n=e.i(449928),a=e.i(760430);function o(e){if((0,n.isPrimitive)(e))return e;if(Array.isArray(e)||(0,a.isTypedArray)(e)||e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e),r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let t=new r(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let t=new r(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}var l=e.i(355200);function s(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function u(e,t,r){let i=Object.keys(t);for(let n=0;n"boolean"==typeof e?{isSubscribed:e}:e;e.s(["useEmailPreferences",0,({forceSubs:e,skipStatus:n}={})=>{let[a,l]=(0,t.useAtom)(m.emailPreferencesAtom),{user:b}=(0,f.useUser)(),y=(0,h.useSubscriptionsEnabled)()||e,w=b?.userID||null,C=(0,g.useCallback)(e=>{if(w){var t;let r,i;l({userId:w,expiry:Date.now()+9e5,subscriptions:(t=a?.subscriptions,r=t?.length?t:p.DEFAULT_SUBSCRIPTIONS,i={},e?(r?.forEach(e=>{i[e.subscriptionGroupName]=e}),e.forEach(e=>{let t=i[e.subscriptionGroupName]||{};i[e.subscriptionGroupName]=u(o(t),e,function e(t,r){if(Array.isArray(r))if(Array.isArray(t))return u(o(t),r,e);else return u([],r,e);if(s(r))if(s(t))return u(o(t),r,e);else return u({},r,e)})}),Object.values(i)):r)})}},[w,l,a?.subscriptions]),S=a&&a.userId===w&&a.expiry&&a.expiry>Date.now(),A=y&&w&&!S,{isLoading:I}=(0,r.default)(!n&&A?`getEmailPreferencesStatus/${w}`:void 0,d.getEmailPreferencesStatus,{shouldRetryOnError:e=>!(e instanceof Error&&/\(status 40[14]\)/.test(e.message)),revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,errorRetryCount:2,onSuccess:e=>{w&&e&&C(e.subscriptions)}}),k=(0,g.useCallback)(async e=>{if(!y)return{status:"error",error:"Subscription is not enabled!"};let t=await (0,c.setEmailPreferences)({subscriptions:e});return"success"===t.status&&C(e),t},[C,y,a?.subscriptions]),E=(0,g.useCallback)(async({newsletter:e,weekly:t,onYourRadar:r,marketing:n})=>{let a=[!(0,i.isNil)(e)&&{subscriptionGroupName:"daily-newsletters-1",...v(e)},!(0,i.isNil)(t)&&{subscriptionGroupName:"weekly-brief",...v(t)},!(0,i.isNil)(r)&&{subscriptionGroupName:"on-your-radar",...v(r)},!(0,i.isNil)(n)&&{subscriptionGroupName:"marketing-emails-1",...v(n)}].filter(Boolean);return await k(a)},[k]);return{emailSubscriptions:S?a.subscriptions:null,updateEmailSubscriptions:E,updateEmailPreference:k,isLoadingPreferences:I}}],422825)}]);