PageSourceSearch

https://www.sleepnumber.com/build/assets/Html-BylF1A06.js

js sleepnumber.com collected 2026-10-01 10:28:16 UTC 54,101 bytes, 3 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-BJjY38Vf.js","assets/jsx-runtime-CfwYrey9.js","assets/string-C5fLiEhb.js","assets/function-B1_dLWJl.js","assets/assets-DSt_IM9G.js","assets/element-7c8P4ipT.js","assets/url-oFviDeGj.js","assets/format-CRg5KHEI.js","assets/suppy-BmBz1o_s.js"])))=>i.map(i=>d[i]);
2import{$ as e,it as t,t as n}from"./jsx-runtime-CfwYrey9.js";import{t as r}from"./preload-helper-B6JZccWF.js";import{d as i}from"./TextType-D3CUH6cX.js";import{G as a,K as o,S as s,V as c,X as l,Y as u,k as d,l as f,m as p,q as m,x as h,y as g}from"./string-C5fLiEhb.js";import{_,p as v,s as ee,v as te}from"./function-B1_dLWJl.js";import{M as y,O as b}from"./assets-DSt_IM9G.js";import{H as ne,_ as re,z as x}from"./element-7c8P4ipT.js";import{D as ie,Et as ae,G as oe,Tt as se,c as ce,dt as S,it as le,q as ue,rt as C}from"./product-BJjY38Vf.js";import{n as de,t as fe}from"./url-oFviDeGj.js";import{n as pe,t as me}from"./format-CRg5KHEI.js";import{r as he,t as w}from"./hub-CQbyO_3k.js";import{C as ge,_ as _e,b as ve,k as ye,x as be}from"./useRootData-BxteO5w6.js";import{n as T}from"./ui-DkKsDIhI.js";import{a as xe,i as Se,o as Ce,r as we}from"./immer-yqcvJ_cx.js";var Te=t(e(),1),Ee=class extends Error{data;response;constructor(e,t,n){super(e),this.data=t,this.response=n}},De=/(system_content|content_blocks|content_presets|releases)/i,Oe=[`staging`,`production`],ke={development:`https://sleepnumber.test`,qa:`https://sn-rails-qa.fly.dev`};function Ae(e){let t=``;if(typeof e==`string`)t=e.match(/^([^\n]+)\n/g)?.[0]?.replace(/\n/g,``)||``,t&&=`"${t}"`;else if(typeof e==`object`)try{t=JSON.stringify(e,null,2)}catch{}else t=String(e);return t}function je(){return typeof window>`u`?null:window.sn_globals}function Me(e){let t=je();if(!t)return``;let n=e.startsWith(`/`),{cms_proxy_target:r,is_cms_proxied:i}=t,{wa_env:a,switch_to_sleep_cms_blog:o}=t?.config||{},s=Oe.includes(a),c=e.match(/^\/api\//i),l=c&&e.match(/(\/blog|\/post\/)/),u=c&&!!e.match(De);if(l&&o&&(u=!0),n&&u&&i){let e=u?r:window.location.origin;return new URL(e).origin}else if(n&&c&&!s)return ke[a]||``;return``}async function E({endpoint:e,body:t,params:n={},customConfig:r={},auth:i=!0,asXhr:a=!0,asJson:s=!0,withResp:c=!1,traditional:l=!1}){let d=je(),f={Accept:`application/json`},p=u.get(o.auth_token.name);i&&p&&(f.Authorization=`Token token=${p}`),a&&(f[`X-Requested-With`]=`XMLHttpRequest`),s&&(f[`Content-Type`]=`application/json`);let m=u.get(o.access_token.name);m&&(f[`Access-Token`]=`${m}`);let h=u.get(o.id_token.name);h&&(f[`Id-Token`]=`${h}`);let g=u.get(o.refresh_token.name);g&&(f[`Refresh-Token`]=`${g}`);let _={method:t?`POST`:`GET`,...r,headers:{...f,...r.headers}},v=_.method.match(/get/i),ee=e.match(/api\/storefront/i),te=e.match(/cart|checkout/),y=d?.token,b=d?.config?.preview_release_id,re=(u.get(o.price_lists.name)||``).trim();b&&ee&&(n.prid=b),re&&ee&&!te&&(n={...n,plid:re}),!v&&y&&(_.headers[y.header]=y.value),t&&(_.body=s?JSON.stringify(t):t),_.method=_.method.toUpperCase();let x=fe(`${Me(e)}${e}`,n,l);return fetch(x,_).then(async t=>{let n=await t.text(),r=ne(t),i=n&&r?JSON.parse(n):n;if(t.ok)return r&&n.length===0?{}:c?[i,t]:i;let a=new Ee(Ae(i)||`${t.status} ${t.statusText||``}: ${_.method} ${e}`.trim(),i,t);return Promise.reject(a)})}var{promise:Ne,resolve:Pe,reject:Fe}=Promise.withResolvers();Ne.catch(ee);var Ie=!1;function Le(e){Ie||(Ie=!0,e.then(()=>Pe()).catch(Fe))}function Re(e){Ie||(Ie=!0,Fe(Error(`Dynamic Yield unavailable: ${e}`)))}function D(e=`DY.API`,t){return l?Ne.then(()=>T(e,t)):Promise.reject(`dyReady called on server`)}var O=class e extends m{static welcome_email=new e(`Welcome Email Complete`);static store_locator=new e(`Store Locator Engagement`);static add_to_cart=new e(`Add to Cart`);static purchase=new e(`Purchase`);static financing=new e(`Financing`);static financing_click=new e(`Financing App Clicks`);static insider=new e(`Likely Insider`);static bed_pdp_visit=new e(`Bed PDP Visit`);static cart_view_with_bed=new e(`Cart View with Bed`);static bed_conversion=new e(`Bed Conversion`);static gps_located=new e(`Located via GPS`);static bed_quiz_answers=new e(`Bed Quiz Answers`);static chat_engagement=new e(`Chat Engagement`);static sticky_lead_promo=new e(`Sticky Lead Promo`);static bq_question_1=new e(`BQ Question 1`);static bq_question_2=new e(`BQ Question 2`);static bq_question_3=new e(`BQ Question 3`);static bq_question_4=new e(`BQ Question 4`);static bq_question_5=new e(`BQ Question 5`);static bq_question_6=new e(`BQ Question 6`);static bq_question_7=new e(`BQ Question 7`);static bq_question_8=new e(`BQ Question 8`);static bq_question_9=new e(`BQ Question 9`);static _=this.closeEnum();constructor(e){super(),this.name=e}name};function ze(e){return e.reduce((e,t)=>
2(t.bundle?(t.bundle_items[0]&&e.push(t.bundle_items[0]),t.bundle_items[1]&&e.push(t.bundle_items[1])):e.push(t),e),[])}function Be(e=[]){return ze(e).map(e=>{let{quantity:t,sku:n,pricing:r,options:i}=e;return{productId:n,quantity:t,itemPrice:Number(r.total_price.cents/100).toFixed(2),size:i.size}})}function Ve(e,t={}){let n=e instanceof O?e.name:e;D().then(()=>{window.DY.API(`event`,{name:n,properties:t})}).catch(C)}function He(e,t,n){let{productInfo:{options:r,sku:i,pricing:a}}=e,o=(a?.unitPrice||``).replace(`$`,``).replace(`,`,``),s={name:O.add_to_cart.name,properties:{dyType:`add-to-cart-v1`,value:Number(o).toFixed(2),productId:i,quantity:n||e.quantity,size:r.Size,cart:Be(t.items)}};D().then(()=>{window.DY.API(`event`,s)}).catch(C)}function Ue(e){let{id:t,pricing:{total_price:n}}=e,r={name:O.purchase.name,properties:{uniqueTransactionId:t,dyType:`purchase-v1`,value:Number(n.cents/100).toFixed(2),cart:Be(e.items)}};D().then(()=>{window.DY.API(`event`,r)}).catch(C)}function We({value:e=null,status:t}){let n=e?{status:t,value:+e}:{status:t},r={name:O.financing.name,properties:n};D().then(()=>{window.DY.API(`event`,r)}).catch(C)}function Ge(e){D().then(()=>{window.DY.API(`event`,{name:O.financing_click.name,type:e})}).catch(C)}function Ke(){D().then(()=>{window.DY.API(`event`,{name:O.insider.name})}).catch(C)}function qe(e,t=[]){return E({endpoint:`/sn-api/abtesting/engagement`,body:{engagements:[{type:`SLOT_CLICK`,slotId:e,variations:[t?.[0]?.id]}]}})}function Je(e){return E({endpoint:`/sn-api/abtesting/engagement`,body:{engagements:[{type:`CLICK`,decisionId:e}]}})}function Ye(e,t,n,r){return E({endpoint:`/sn-api/storefront/dynamic-yield-recommendations`,body:{selector_name:e,data:t,pageType:n,pageAttributes:r,url:new URL(window.location.href),preview:de(`dyApiPreview`)}})}var Xe={add_to_cart:`Bed Cart `,purchase:`Bed Purchase `};async function Ze(e,t){let n=Xe[t],r=Array.isArray(e)?e:[e];return D().then(()=>r.map(e=>ie(e)||e).map(e=>e.tags.find(e=>e.match(/^dy_atc_(.*)/i)?.[1])).filter(Boolean).forEach(e=>window.DY.API(`event`,{name:`${n}${e}`}))).catch(C)}var k=class e extends m{static PageView=new e;static _=this.closeEnum()},Qe=k,A=class e extends m{static __ALL=new e(`__ALL`);static AccordionToggle=new e(`accordion_toggle`);static ApplePayExpValidateMerchant=new e(`applepay_express_validate_merchant`);static ApplePayExpPaymentMethodSelected=new e(`applepay_express_payment_method_selected`);static ApplePayExpShippingMethodSelected=new e(`applepay_express_shipping_method_selected`);static ApplePayExpShippingContactSelected=new e(`applepay_express_shipping_contact_selected`);static ApplePayExpPaymentAuthorized=new e(`applepay_express_payment_authorized`);static ApplePayExpCanceled=new e(`applepay_express_cancelled`);static ApplePayCancelled=new e(`applepay_cancelled`);static ApplePayBeginPaymentSheet=new e(`applepay_begin_payment_sheet`);static ApplePayValidateMerchant=new e(`applepay_payment_validate_merchant`);static ApplePayAuthorized=new e(`applepay_payment_authorized`);static GooglePayPayment=new e(`googlepay_payment`);static GooglePayPaymentSheetClosed=new e(`googlepay_payment_sheet_closed`);static ElementClick=new e(`element_click`);static ElementImpression=new e(`element_impression`);static FormSubmit=new e(`form_submit`);static AbTestDetected=new e(`ab_test_detected`);static VariationSelected=new e(`variation_selected`);static FinAttempted=new e(`fin_attempted`);static FinTerminated=new e(`financing_customer_terminated`);static FinDeclined=new e(`financing_declined`);static FinApproved=new e(`financing_approved`);static FinFailed=new e(`financing_failed`);static FinSuccess=new e(`financing_success`);static UpdatePage=new e(`update_page`,k.PageView);static UpdateProduct=new e(`update_product`,k.PageView);static UpdateCategory=new e(`update_category`,k.PageView);static UpdateUser=new e(`update_user`,k.PageView);static UpdateAuth=new e(`update_auth`,k.PageView);static UpdateCart=new e(`update_cart`,k.PageView);static UpdateCheckout=new e(`update_checkout`,k.PageView);static PageView=new e(`page_view`);static BedQuizResultsView=new e(`bed_quiz_results_view`);static CategoryView=new e(`category_view`);static ProductView=new e(`product_view`);static CartView=new e(`cart_view`);static CheckoutView=new e(`checkout_view`);static OrderConfirmationView=new e(`order_confirmation_view`);static SelectProductFilter=new e(`select_product_variant`);static Geolocation=new e(`geolocation`);static SearchForStore=new e(`search_for_store`);static TryNearStore=new e(`try_near_store`);static ViewStore=new e(`view_store`);static SubmitFinancingApp=new e(`submit_financing_application`);static SubmitApplyInSite=new e(`submit_apply_in_site`);static ApplyInSiteAbandon=new e(`apply_in_site_abandon`);static SubmitPreQual=new e(`submit_pre_qual`);static PreQualAbandon=new e(`pre_qual_abandon`);static SubmitSoftApply=new e(`submit_soft_apply`);static SoftApplyAbandon=new e(`soft_apply_abandon`);static ShowModal=new e(`show_modal`);static CloseModal=new e(`close_modal`);static CartAdd=new e(`cart_add`);static UpdateCartQty=new e(`update_cart_qty`);static CheckoutEntryMode=new e(`checkout_entry_mode`);static CheckoutLogin=new e(`checkout_login `);static CheckoutStepActive=new e(`checkout_step_active`);static CheckoutStepComplete=new e(`checkout_step_complete`);static CheckoutStepViewed=new e(`checkout_step_viewed`);static CheckoutBillingAddress=new e(`checkout_billing_address`);static CheckoutPlaceOrder=new e(`checkout_place_order`);static CheckoutOrderFail=new e(`checkout_order_fail`);static CheckoutPayLaterStart=new e(`checkout_pay_later_start`);static CheckoutPayLaterSuccess=new e(`checkout_pay_later_success`);static CheckoutPayLaterPending=new e(`checkout_pay_later_pending`);static CheckoutPayLaterFail=new e(`checkout_pay_later_fail`);static OrderConfirmation=new e(`order_confirmation`);static HdDatesUnavailable=new e(`hd_dates_unavailable`);static HdGetDatesFailed=new e(`hd_get_dates_failed`);static HdOrderNotSchedulable=new e(`hd_order_not_schedulable`);
2static HdDateSubmissionError=new e(`hd_date_submission_error`);static HdSchedulingTimeout=new e(`hd_scheduling_timeout`);static OrderTrackingError=new e(`order_tracking_error`);static OrderTrackingDetails=new e(`order_tracking_details`);static OrderSchedulingDetails=new e(`order_scheduling_details`);static ConfirmServiceCancel=new e(`confirm_service_cancel`);static UserNewSession=new e(`user_new_session`);static UserSignIn=new e(`user_sign_in`);static UserSignUp=new e(`user_sign_up`);static UserForgotPassword=new e(`user_forgot_password`);static UserResetPassword=new e(`user_reset_password`);static EmailSubmit=new e(`lead_submit`);static CallbackLeadSubmit=new e(`callback_lead_submit`);static DriveToStoreLeadSubmit=new e(`drive_to_store_lead_submit`);static ReferFriend=new e(`refer_friend`);static VideoPlayPause=new e(`video_play_pause`);static VideoPercentUpdate=new e(`video_percent_update`);static SlideshowSlideImpression=new e(`slideshow_slide_impression`);static SlideshowPlayPause=new e(`slideshow_play_pause`);static SlideshowSlideSelect=new e(`slideshow_slide_select`);static SlideshowNext=new e(`slideshow_next`);static SlideshowPrev=new e(`slideshow_prev`);static SlideshowScrollClick=new e(`slideshow_scroll_click`);static CcpaDeleteRequest=new e(`ccpa_delete_request`);static CcpaOptOutRequest=new e(`ccpa_opt_out_request`);static CcpaInfoRequest=new e(`ccpa_info_request`);static BedQuizAnswer=new e(`bed_quiz_answer`);static BedQuizEmailStepViewed=new e(`bed_quiz_email_step_viewed`);static GatedBedQuizEmailSubmitted=new e(`gated_bed_quiz_email_submitted`);static BedQuizEmailSkipped=new e(`bed_quiz_email_skipped`);static SleepQuizAnswer=new e(`sleep_quiz_answer`);static QuizComplete=new e(`quiz_complete`);static AnimatedTabPanelTopicClick=new e(`animated_tab_panel_topic_click`);static AnimatedTabPanelImpression=new e(`animated_tab_panel_impression`);static FurnitureSwatchRequestSubmit=new e(`furniture_swatch_request_submit`);static AdjustableBaseSlideImpression=new e(`adjustable_base_slide_impression`);static AdjustableBaseSlideClick=new e(`adjustable_base_slide_click`);static SleepIQStorytellingClick=new e(`sleepIQ_storytelling_click`);static RecommendedProductImpression=new e(`recommended_product_impression`);static PdpGalleryClick=new e(`pdp_gallery_click`);static ChatEngagement=new e(`chat_engagement`);static LpEngagementClick=new e(`lp_engagement_click`);static LpConversation=new e(`lp_conversation`);static LpImpression=new e(`lp_impression`);static Error=new e(`error`);static _=this.closeEnum();_name;timing;constructor(e,t){super(),this._name=e,this.timing=t}get name(){return this._name?this._name:this.enumKey}};_(`sn.analytics.AnalyticsAction`,A),_(`sn.analytics.hashEmail`,f);var $e={COMPONENT_ELEMENTS:`[data-component]`,ELEMENT_ELEMENTS:`[data-element]`,CLICK_ELEMENTS:[`[data-element]`,`[data-track]`,`a`,`button`,`.btn`].join(`,`),SUBMIT_ELEMENTS:`form`},et=`tracking`,tt=[`[name="password"]`,`[name="cardNumber"]`],j=class e extends m{static MattressDetail=new e({name:`mattress_detail`,isProduct:!0,bundleUrl:[`MattressPdpController`,`MattressBundlePdpController`]});static BeddingDetail=new e({name:`bedding_detail`,isProduct:!0,bundleUrl:[`BeddingPdpController`]});static MattressListing=new e({name:`mattress_listing`,isCategory:!0,bundleUrl:[`MlpController`]});static BeddingListing=new e({name:`bedding_listing`,isCategory:!0,bundleUrl:[`CategoriesController`,`CategoryController`,`SalePageController`]});static OrderConfirmation=new e({name:`order_confirmation`});static Cart=new e({name:`cart`,bundleUrl:[`CartController`]});static Checkout=new e({name:`checkout`});static Generic=new e({name:`generic`,bundleUrl:[`GenericPageController`]});static _=this.closeEnum();isProduct;isCategory;bundleUrl;constructor({name:e,isProduct:t,isCategory:n,bundleUrl:r}){super(),this.name=e,this.isProduct=t,this.isCategory=n,this.bundleUrl=r}},nt=class e extends m{static userEntry=new e;static currentLocation=new e;static geoIpLocation=new e;static _=this.closeEnum()};function rt(e,t){let n=p(t),r=n,i=e.filter(e=>e!==`Home`&&e!==`More`);return i.length>1&&(r=`${i.slice(0,-1).join(`:`)}:${n}`),r}function it(e){return e.match(/\/cart(\/)?$/i)?j.Cart:e.match(/\/checkout(\/)?$/i)?j.Checkout:e.match(/\/checkout\/confirmation(\/)?$/i)?j.OrderConfirmation:e.match(/\/categories\/mattresses-([A-z])*-series(\/)?$/i)||e.match(/\/collections\/mattresses-/i)||e.match(/^\/bundles\//)?j.MattressDetail:e.match(/\/categories\/mattresses(\/)?$/i)?j.MattressListing:e.match(/\/categories\//i)?j.BeddingListing:j.Generic}function at(){let{href:e,referrer:t}=be()||{},{pageId:n,pageTitle:r,breadcrumbs:o=[],bundle_url:s}=ve(),c=_e(),l=new URL(i(e));if(l.protocol=`https:`,c)return{};let u=typeof document>`u`?``:document.title,d=p(r||u),f=o?.map(({name:e})=>
2p(e)).filter(Boolean),[m,h]=f.slice(1)||[],g=j.enumValues.find(e=>e.bundleUrl?.includes(s));g||=it(l.pathname),g===j.MattressDetail&&Ve(O.bed_pdp_visit);let _=g?.isProduct||g?.isCategory?rt(f,d):d;return{pageType:g,pageInfo:{bundle_url:s,pageId:n||a.location?.pathname,pageTitle:d,pageName:_,breadcrumbs:f,destinationURL:l.href,referringURL:t},url:{full:l.href,simple:l.host+l.pathname,host:l.host,hash:l.hash,domain:l.host.replace(`www.`,``),path:l.pathname,params:l.searchParams.entries()},category:{primaryCategory:m,subCategory:h}}}var{CLICK_ELEMENTS:ot,SUBMIT_ELEMENTS:st,ELEMENT_ELEMENTS:ct,COMPONENT_ELEMENTS:lt}=$e;function ut(e){return!!e.name&&tt.every(t=>!re(e,t))}function dt(e,{trigger:t,type:n,payload:r={}}){let i=new CustomEvent(et,{bubbles:!0,cancelable:!0,detail:{payload:r,type:n,trigger:t,time:Math.floor(new Date().getTime()/1e3)}});document.body.contains(e)?e.dispatchEvent(i):(i.detail.customTarget=e,document.dispatchEvent(i))}function ft(e){let t=A.ElementClick;for(let n=e.target;n&&n!==document.documentElement;n=n.parentNode)if(n.matches(ot)){dt(n,{trigger:pt(n),type:t});break}}function pt(e){let{innerText:t,title:n}=e,r=e.href;return v({},{href:r||void 0,text:t||void 0,title:n||void 0})}function mt(e){let t=A.FormSubmit,{submitter:n}=e;for(let r=e.target;r&&r!==document.documentElement;r=r.parentNode)if(r.matches(st)){let e=r?.id||r?.name,i=n?pt(n):void 0,a=Object.values(r.elements).reduce((e,t)=>{let n=t;return ut(n)&&(e[n.name]=n.type===`checkbox`?n.checked:n.value),e},{});dt(n||r,v({},{type:t,trigger:i,payload:{form:e,fields:a}}));break}}function ht(e){return function(t){let{type:n,trigger:r,time:i,payload:a,customTarget:o}=t.detail;Array.isArray(a.component)||(a.components=[]),a.elements||=[];for(let e=o||t.target;e&&e!==document.documentElement;e=e.parentNode)e.matches(ct)?a.elements=[...a.elements,e.dataset.element]:e.matches(lt)&&(a.components=[e.dataset.component,...a.components]);e({type:n,trigger:r,meta:{time:i},payload:a})}}var gt=`/build/assets/affirm-CTJhzJvI.svg`,_t=`/build/assets/icon-card-amex-QnYscA4y.svg`,vt=`/build/assets/icon-card-apple-pay-BbnM0Wzj.svg`,yt=`/build/assets/icon-card-discover-CGHMvBoX.svg`,bt=`/build/assets/icon-card-google-pay--lw9OVKP.svg`,xt=`/build/assets/icon-card-master-BqrdQbQ6.svg`,St=`/build/assets/icon-card-sn-Bx8PunkT.svg`,Ct=`/build/assets/icon-card-visa-DARaAwX5.svg`,wt=`/build/assets/reward-check-D_pqwJjc.svg`,Tt=`/build/assets/synchrony-icon-LkmRLr07.svg`,M={cart_page:`cart_page`,checkout_page:`checkout_page`,order_confirm_page:`order_confirm_page`,order_details:`order_details`,shared_cart:`shared_cart`},Et={cc:{label:`Credit card`,value:`new_card`},sn_cc:{label:`Sleep Number credit card`,value:`synchrony`,subtitle:`Apply for or use your Synchrony card`},pay_later:{label:`Pay Later with Synchrony`,value:`pay_later`,subtitle:`Pay in monthly installments`},affirm:{label:`Pay Later with Affirm`,value:`affirm`,subtitle:`Pay in monthly installments`},apple_pay:{label:`Apple Pay`,value:`apple_pay`,subtitle:`Pay with Apple Pay`},google_pay:{label:`Google Pay`,value:`google_pay`,subtitle:`Pay with Google Pay`}},Dt={TEST:{label:`Test Card`,value:`Test Card`,icon:Ct},VS:{label:`Visa`,value:`visa`,adyenId:`visa`,icon:Ct},MC:{label:`Mastercard`,value:`master_card`,adyenId:`mc`,icon:xt},AX:{label:`American Express`,value:`american_express`,adyenId:`amex`,icon:_t},NS:{label:`Discover`,value:`discover`,adyenId:`discover`,icon:yt},SN:{label:`Sleep Number Card`,value:`synchrony`,icon:St},GC:{label:`Reward Voucher`,value:`gift_card`,icon:wt},PL:{label:`Pay Later`,value:`pay_later`,icon:Tt},AFFIRM:{label:`Affirm`,value:`affirm`,icon:gt},APPLE_PAY:{label:`Apple Pay`,value:`apple_pay`,icon:vt},GOOGLE_PAY:{label:`Google Pay`,value:`google_pay`,icon:bt}},Ot={estimated:`ESTIMATED`,actual:`ACTUAL`,error:`ERROR`,not_calculated:`NOT_CALCULATED`},N=class e extends m{static disposal=new e;static recycling=new e;static relocate=new e;static _=this.closeEnum()};function kt(e){return e.match(/disposal/i)?N.disposal:e.match(/recycling/i)?N.recycling:e.match(/relocation/i)?N.relocate:null}function At(e){let t={product:{total:0,list:[]},order:{total:0,list:[]},total:0};
2return(e?.items||[]).forEach(e=>{if(e.free_gift){let n=e.pricing.total_regular_price.cents/100;t.total+=n}else(e?.pricing?.price_adjustments||[]).filter(e=>e.discount&&!e.promo_code).forEach(e=>{let n=Math.abs(e.amount.cents)/100;t.product.list.push(e),t.product.total+=n,t.total+=n})}),(e?.pricing?.price_adjustments||[]).filter(e=>e.discount&&!e.promo_code).forEach(e=>{let n=Math.abs(e.amount.cents)/100;t.order.list.push(e),t.order.total+=n,t.total+=n}),t}function jt(e){let t=[];(e?.items||[]).forEach(e=>{let n=e?.pricing?.price_adjustments||[],r=e?.warranty_fees||[],i=n.filter(e=>e.fee&&!r.find(t=>t.sku===e.sku));t=[...t,...i]}),(e?.pricing?.price_adjustments||[]).filter(e=>e.fee).forEach(e=>t=[...t,e]);let n=t.reduce((e,t)=>{let n=kt(t.description),r=n?e[String(n)]:null;return r?(r.count+=t.quantity||1,r.amount.cents+=t.amount.cents):(r=v(!0,{},t),r.count=t.quantity||1,r.type=n,e[String(n)]=r),e},{}),r=Object.values(n);return{list:r,total:Math.abs(r.reduce((e,t)=>e+t.amount.cents,0))/100}}function Mt(e){let t=[];return(e?.items||[]).forEach(e=>{(e?.warranty_fees||[]).forEach(e=>{let n={...e};e.fee_total&&(n.price_adjustment=e.fee_total),t.push(n)})}),t}function Nt(e){return(e?.reward_codes||[]).reduce((e,t)=>(e.list.push(t),e.total+=Math.abs(t.amount.cents)/100,e),{total:0,list:[]})}function Pt(e){return(e?.promo_code_data||[]).reduce((e,t)=>(e.list.push(t),e.total+=Math.abs(t.amount.cents)/100,e),{total:0,list:[]})}function Ft(e){return!e.match(/(p\.?o\.?\s+box)/gi)}function It(e){let{shipping_groups:t=[]}=e;return t.length&&t.reduce((e,t)=>e&&t?.shipping_services?.length>0,!0)}function Lt(e){return!!e?.shipping_address?.street}var Rt=`Please check your entry and try again`;function zt(e){let t=(e,t)=>Array(e).fill(t).join(`_`);return(e?.items||[]).reduce((e,n)=>{let{quantity:r,sku:i,sku_list:a}=n;return n.bundle?`${e}_${a.map(e=>t(r,e)).join(`_`)}`:`${e}_${t(r,i)}`},``)}function Bt(e){let{pricing:{total_price:t,total_regular_price:n}}=e;return t?.cents>0&&n?.cents>0?{total_regular_price:t?.cents/100,total_price:n?.cents/100}:null}function Vt(e){let{product:t,sku:n,options:r,product_url:i,pricing:{price_adjustments:a,total_price:o,total_regular_price:s}}=e,{meta_description:c,name:l,id:u,slug:d,type:f}=t,m=ce(t),h=a.filter(({discount:e,promo_code:t})=>e&&!t).reduce((e,t)=>e+Math.abs(t.amount.cents)/100,0);return{description:c,productId:u,productImage:m?.url,productName:p(l),productURL:i,categorySlugs:t.category_slugs,type:f,slug:d,sku:n,options:r,pricing:{unitPrice:S(o?.cents),regularPrice:S(s?.cents)},floatPricing:Bt(e),normalPricing:{totalPrice:o.cents/100,totalRegularPrice:s.cents/100},discount:h}}function Ht(e){return e.reduce((e,t)=>{if(t.bundle&&t?.bundle_items?.length){let n=t.bundle_items[0],r=t.bundle_items[1];n&&e.push(n),r&&e.push(r)}else e.push(t);return e},[])}function P(e){return Ht(e).map(e=>{let{quantity:t}=e;return{productInfo:Vt(e),quantity:t}})}function Ut(e){return[...b(e.hd_items),...b(e.ups_items),...b(e.other_items)].reduce((e,{product:t})=>e||!!t&&oe(t),!1)}function Wt(e){return e?(e.items||[]).map(e=>e.product).some(e=>ue(e)||oe(e)):!1}function Gt(e){if(!e)return!1;let t=Wt(e),n=e.shipping_group_selections?.length>1;return!t&&!n}function Kt(e,t,n=!1){let{pricing:r}=e,i=r.total_price;switch(t){case M.cart_page:i=n?r.total_price_minus_extra_charges_and_rewards:r.total_price_minus_shipping_and_rewards;break;case M.order_details:i=r.total_price;break;case M.order_confirm_page:i=r.total_price_minus_rewards;break;case M.checkout_page:i=Lt(e)&&e?.shipping_groups?.length&&It(e)?r.total_price_minus_rewards:n?r.total_price_minus_extra_charges_and_rewards:r.total_price_minus_shipping_and_rewards;break;default:i=r.total_price;break}return i}var F=n(),qt=class e extends m{static approved=new e(`APPROVED`);static declined=new e(`DECLINE`);static pending=new e(`PENDING`);static counter_offer=new e(`COUNTER_OFFER`);static split_pay=new e(`SPLIT_PAY`);static payment_declined=new e(`PAYMENT_DECLINE`);static closed=new e(`CLOSED`);static error=new e(`ERROR`);static timeout=new e(`TIMEOUT`);static _=this.closeEnum();static of(t){return e.enumValues.find(e=>e.value===t)||null}value;constructor(e){super(),this.value=e}},I=class e extends m{static missing_input=new e([`400`]);static token_expired=new e([`401`]);static customer_terminated=new e([`100`]);static transaction_pending=new e([`04`,`06`,`99`]);static transaction_declined=new e([`07`,`08`,`12`,`13`,`14`,`15`,`16`,`17`,`18`,`81`,`82`,`90`]);static call_now=new e([`09`]);static process_error=new e([`03`,`10`,`11`]);static system_exception=new e([`500`]);static success=new e([`000`,`033`]);static declined=new e([`001`]);
2static invalid_promo_code=new e([`402`]);static invalid_address=new e([`403`]);static _=this.closeEnum();static valueOf;codes;constructor(e){super(),this.codes=e}};function Jt(e){return I.enumValues.find(t=>t.codes.includes(e))||null}I.valueOf=Jt;var Yt={general:`Financing is temporarily unavailable. Please try again later or select a different payment method`,session_timeout:(0,F.jsxs)(F.Fragment,{children:[`The session has timed out. Please `,(0,F.jsx)(`a`,{href:`/checkout`,children:`refresh the page`}),` `,`and try again.`]}),address_verification:`The billing address does not match our records. Please update and try again.`};function Xt(e,t){return(e?.financing_options||[]).find(e=>{let n=!e.non_stackable,r=!e.default,i=!e.show_in_shopping_path,a=i&&t&&e.promo_code===t;return n&&r&&(!i||a)})}function Zt(e){return I.valueOf(e?.StatusCode??``)===I.success}function Qt(e){let t=I.valueOf(e?.StatusCode??``);if(Zt(e)||t===I.customer_terminated)return null;let{general:n,session_timeout:r,address_verification:i}=Yt,a=n;return t===I.token_expired&&(a=r),t===I.invalid_address&&(a=i),{msg:a,recoverable:t===I.token_expired||t===I.invalid_address}}function $t({merchant_id:e,cart:t,billing:n,token:r,promo:i}){let a=t.pricing.total_price_minus_rewards.cents/100;return{tokenId:r,merchantID:e,processInd:`3`,clientTransId:t.id,custFirstName:n.first_name.value,custLastName:n.last_name.value,custZipCode:n.postal_code.value.substring(0,5),custAddress1:n.street.value,custAddress2:n.street_2.value,phoneNumber:n.phone_number.value,emailAddress:n.email.value,custCity:n.city.value,custState:n.region.value,transPromo1:i,transAmount1:a.toFixed(2)}}function en(e,t,n){return e?!!e?.value&&(n||!e.non_stackable)&&(t||!e.default):!1}var L=class e extends m{id;static FUNCTIONAL_NECESSARY=new e(`C0001`);static ADVERTISING=new e(`C0002`);static ANALYTICS=new e(`C0007`);static _=this.closeEnum();constructor(e){super(),this.id=e}};function R(e){let t=a.OnetrustActiveGroups;if(t)return t.includes(e.id);let n=u.get(o.consent.name);if(!n)return!1;let r=new URLSearchParams(n).get(`groups`);if(!r||!r.includes(`:`))return!1;for(let t of r.split(`,`)){let[n,r]=t.split(`:`);if(n===e.id)return r===`1`}return!1}var z=[],tn=!1,nn=!1;function rn(e){let t=window;t._satellite?.logger?.log&&t._satellite.logger.log(`Launch: ${e}`)}function an(e,t,n){let r=window;r._satellite?.track&&r.sn?.launch?.initialized&&(r._satellite.track(e,t),n&&rn(n))}function B(e,t,n){let r=window;!r._satellite?.track||!r.sn?.launch?.initialized||!nn?z.push([e,t,n]):an(e,t,n)}function on(e){B(`SendEvent`,e,`Event Sent - ${e?.type?.name}`)}var sn;function cn(e){let t=` View Sent - ${e?.event.type}`,n=e?.state?.product?.productInfo?.productId;n!==sn&&(sn=n,B(`ProductView`,e,`Product ${t}`))}function ln(e){let t=e?.event?.payload?.pageType||{},n=` View Sent - ${e?.event.type}`;switch(!0){case t.isProduct:break;case t.name===`cart`:B(`CartView`,e,`Cart ${n}`);break;case t.name===`checkout`:B(`CheckoutView`,e,`Checkout ${n}`);break;case t.name===`order_confirmation`:B(`OrderConfirmationView`,e,`Order Confirmation ${n}`);break;default:B(`GlobalPageLoad`,e,`Page View Sent - ${e?.event?.payload?.pageInfo?.pageTitle}`);break}}var un=[A.UpdateCheckout,A.UpdateCategory,A.UpdateCart,A.UpdatePage,A.UpdateAuth,A.UpdateUser,A.CategoryView,A.ProductView,A.OrderConfirmationView,A.CheckoutView,A.CartView,A.CheckoutStepActive,A.CheckoutStepViewed,A.CheckoutEntryMode,A.Geolocation,A.SelectProductFilter,A.OrderConfirmation,A.UserNewSession,A.CcpaDeleteRequest,A.CcpaOptOutRequest,A.CcpaInfoRequest,A.VideoPercentUpdate,A.VideoPlayPause,A.UserForgotPassword,A.UserResetPassword,A.AbTestDetected,A.Error];function dn(e){let t=e?.event?.type;un.includes(t)||(t===A.PageView?(ln(e),tn=!0):t===A.UpdateProduct?cn(e):on(e))}var fn=new Map;fn.set(A.__ALL,dn);function pn(){l&&(T(`adobe.optIn.approve`,1e4).then(()=>{R(L.ANALYTICS)?a.adobe.optIn.approve([a.adobe.OptInCategories?.ECID,a.adobe.OptInCategories?.ANALYTICS,a.adobe.OptInCategories?.MEDIA_ANALYTICS]):a.adobe.optIn.deny([a.adobe.OptInCategories?.ANALYTICS,a.adobe.OptInCategories?.ECID,a.adobe.OptInCategories?.MEDIA_ANALYTICS]),R(L.ADVERTISING)?a.adobe.optIn.approve([a.adobe.OptInCategories?.AAM,a.adobe.OptInCategories?.ADCLOUD,a.adobe.OptInCategories?.CAMPAIGN,a.adobe.OptInCategories?.LIVEFYRE,a.adobe.OptInCategories?.TARGET]):a.adobe.optIn.deny([a.adobe.OptInCategories?.AAM,a.adobe.OptInCategories?.ADCLOUD,a.adobe.OptInCategories?.CAMPAIGN,a.adobe.OptInCategories?.LIVEFYRE,a.adobe.OptInCategories?.TARGET])}),T(`sn.launch.initialized`,1e4).then(()=>
2{if(!R(L.ANALYTICS))return;let e=(t=60)=>{if(tn){let e=z.findIndex(e=>e[1]?.type?.name===A.PageView.name),t=z.splice(e,1)[0];for(t&&z.unshift(t);z.length>0;){let[e,t,n]=z.shift();an(e,t,n),nn=!0}}else t>0&&setTimeout(()=>e(t-1),500)};e()}).catch(e=>{l&&(d()?x.error:x.warn)(e)}))}l&&w.sub(w.topics.CONSENT_UPDATED,pn);var mn=`AW-1061547848/eV5fCL2WpHkQyN6X-gM`,hn=`AW-1061547848/Eb_ACO34kHkQyN6X-gM`,gn=`AW-1061547848/Tj5dCPru95YBEMjel_oD`,_n=`AW-1061547848/B-ZUCN6fpHkQyN6X-gM`,vn=`AW-1061547848/MN9wCO_31KgcEMjel_oD`,yn=`AW-1061547848/MBMuCMOl1agcEMjel_oD`;function V(e,t={}){let n={value:0,currency:`USD`,send_to:e,event_callback:t.redirectTo?()=>window.location.assign(t.redirectTo):void 0,...t},r=window.gtag;if(typeof r!=`function`){x.warn(`gtag is not present, not tagging event`,n),typeof n.event_callback==`function`&&n.event_callback();return}x.log(`gtag is present, tagging event`,n),r(`event`,`conversion`,n)}function bn(e){V(mn,{redirectTo:e})}function xn(){V(hn)}function Sn(){V(gn,{value:1})}function Cn(){V(_n)}function wn(){V(vn)}function Tn(){V(yn)}var H=new Map;H.set(A.ElementClick,({event:e})=>{let{payload:{elements:t,components:n}}=e;(n.includes(`Store List`)&&t.includes(`Search`)||n.includes(`Store List`)&&t.includes(`Use Current Location`))&&Sn(),n.includes(`Mattress Postcard`)&&(t.includes(`Select Options`)||t.includes(`Select Base Options`))&&xn(),n.includes(`Mattress Price Block`)&&t.includes(`Buy`)&&bn()}),H.set(A.EmailSubmit,()=>{Cn()}),H.set(A.SubmitApplyInSite,()=>{wn()}),H.set(A.FinApproved,()=>{wn()}),H.set(A.FinDeclined,()=>{wn()}),H.set(A.FinTerminated,()=>{wn()}),H.set(A.SubmitPreQual,()=>{Tn()});var En=[`WT.tx_e`,`WT.category`,`WT.pn_sku`,`WT.si_x`,`WT.tx_u`,`WT.si_n`,`WT.si_p`,`WT.si_cs`,`WT.zipcode`,`WT.storeid`,`WT.tx_s`,`WT.tx_i`,`WT.tx_id`,`WT.tx_it`,`emid`];function Dn(){return!!y.get(y.Entry.retargeter_log_enabled)}function U(e,t=c.normal,...n){Dn()&&x.info(`%cRetargeter: %c${e}`,c.strong,t,...n)}function On(){let e=Dn();return y.set(y.Entry.retargeter_log_enabled,!e),Dn()}var kn=[];function W(e){let t=te(window,`ORA.view`);if(!t){kn.push(e);return}if(!e){t(),U(`Success`,c.value,`Empty payload`);return}let n={};Object.keys(e).forEach(t=>{if(En.indexOf(t)>-1){let r={[t]:e[t]};Object.assign(n,r)}else x.warn(`Retargeter: ${t} is not a valid attribute`)}),t({data:n}),U(`Success`,c.value,JSON.stringify(n))}function An(e){let t=e[0];return e.forEach((e,n)=>{n>0&&(t+=`;${e}`)}),t}var G={browsePdp:function(e,t,n=1){return{"WT.pn_sku":e,"WT.category":t,"WT.tx_u":n,"WT.tx_e":`v`,"WT.si_n":`Commerce Flow`,"WT.si_x":`1`,"WT.si_p":`Product View`}},browseCategory:function(e){return{"WT.category":e,"WT.tx_e":`c`}},storeFinder:function(e,t,n){let r=e.match(/\d{5}/g);return{"WT.tx_e":`s`,"WT.zipcode":r?r[r.length-1]:n,"WT.storeid":An(t)}},addToCart:function(e,t=1,n){return{"WT.pn_sku":e,"WT.tx_u":t,"WT.category":n,"WT.tx_e":`a`,"WT.si_n":`Commerce Flow`,"WT.si_x":`2`,"WT.si_p":`Product Cart Add`}},removeFromCart:function(e,t=1,n){return{"WT.pn_sku":e,"WT.tx_u":t,"WT.category":n,"WT.tx_e":`r`}},identifyUser:async function(e){return{emid:await f(e)}},completeOrder:function({items:e,placedAt:t,code:n}){let r=e.map(e=>e.product.slug),i=e.map(e=>e.quantity),a=e.map(e=>e.pricing.unitPrice),o=me.date(t,pe.date.SIMPLE_2_DIGIT),s=me.date(t,pe.time.PRECISE_NO_MILLISECONDS);return{"WT.pn_sku":An(r),"WT.tx_u":An(i),"WT.tx_s":An(a),"WT.tx_e":`p`,"WT.si_n":`Commerce Flow`,"WT.si_x":`3`,"WT.si_p":`Purchase Complete`,"WT.si_cs":`1`,"WT.tx_i":n,"WT.tx_id":o,"WT.tx_it":s}}},K=new Map;K.set(A.PageView,({state:e})=>{let{page:{pageType:t,url:{params:n}}}=e;n.emid&&G.identifyUser(n.emid).then(e=>{W(e),U(`Identify User`,c.value,`Email: ${n.emid}`)}),!t?.isCategory&&!t?.isProduct&&W()}),K.set(A.UpdateProduct,({event:e})=>{let{product:{productInfo:{slug:t,type:n}}}=e.payload;window.digitalData.events.filter(t=>t.type===e.type).length<=1&&(W(G.browsePdp(t,n)),U(`Browse product`,c.value,`Product: ${t}`))}),K.set(A.UpdateCategory,({event:e})=>{let{payload:{category:{primaryCategory:t}}}=e;W(G.browseCategory(t)),U(`Browse category`,c.value,`Category: ${t}`)}),K.set(A.CheckoutLogin,({event:e})=>{let{payload:{email:t}}=e;G.identifyUser(t).then(e=>{W(e),U(`Identify User`,c.value,`Email: ${t}`)})}),K.set(A.UserSignUp,({event:e})=>{let{payload:{email:t}}=e;G.identifyUser(t.value).then(e=>{W(e),U(`Identify User`,c.value,`Email: ${t}`)})}),K.set(A.FormSubmit,({event:e})=>{let{payload:{fields:t}}=e;if(t.email||t.guest_email){let e=t.email||t.guest_email;G.identifyUser(e).then(t=>{W(t),U(`Identify User`,c.value,`Email: ${e}`)})}}),K.set(A.OrderConfirmation,({event:e})=>{let{payload:{order:t}}=e;W(G.completeOrder(t)),U(`Order completed`,c.value,`Order number: ${t.id}`)}),K.set(A.UpdateCartQty,({event:e})=>{let{payload:{updateType:t,quantity:n,item:{productInfo:{productId:r,type:i}}}}=e;t===`dec`||t===`remove`?(W(G.removeFromCart(r,n,i)),U(`Remove from Cart`,c.value,`Pid: ${r}`)):t===`inc`&&(W(G.addToCart(r,n,i)),U(`Add to Cart`,c.value,`Product sku: ${r}`))}),K.set(A.CartAdd,({event:e})=>{let{payload:{items:t}}=e;
2t.forEach(e=>{let{productInfo:{slug:t,type:n}}=e;W(G.addToCart(t,1,n)),U(`Add to Cart`,c.value,`Product sku: ${t}`)})}),K.set(A.SearchForStore,({event:e})=>{let{payload:{stores:t,searchTerm:n}}=e;if(!t?.length)return;let r=t.map(e=>e.c_siebelNumber).filter((e,t)=>t<3);W(G.storeFinder(n,r,t[0].address?.postalCode)),U(`Store finder`,c.value,`Search term: ${n}`)}),l&&(T(`ORA.view`,1e4).then(()=>{for(;kn.length;)W(kn.shift())}).catch(C),_(`sn.retargeter`,{...K,toggleLogging:On}));function jn(e){return e.reduce((e,t)=>e+ +t.productInfo.pricing.unitPrice.replace(/[$,]/g,``),0)}function Mn(e){return e.reduce((e,t)=>e+t.quantity,0)}function Nn(e){return e.map(e=>{let t=+e.productInfo.pricing.unitPrice.replace(/[$,]/g,``);return{product:{name:e.productInfo.productName,category:e.productInfo.type,sku:e.productInfo.sku,price:t},quantity:e.quantity}})}function Pn(e){T(`lpTag`).then(()=>{let t=window;t.lpTag.sdes=t.lpTag.sdes||[],t.lpTag.sdes.push(e)}).catch(()=>{d()&&x.warn(`Failed to detect window.lpTag after 5000ms`)})}function Fn(e){let{items:t}=e;return{type:`cart`,currency:`USD`,total:jn(t),numItems:Mn(t),products:Nn(t)}}function In(e,t){let{items:n}=e;return{type:`purchase`,currency:`USD`,orderId:t,total:jn(n),cart:{numItems:Mn(n),items:Nn(n)}}}function Ln(e){Pn(Fn(e))}function Rn(e,t){Pn(In(e,t))}var q=new Map;q.set(A.CartAdd,({event:e})=>{let{payload:{cart:t}}=e;t&&Ln(t)}),q.set(A.UpdateCart,({event:e})=>{let{payload:{cart:t}}=e;t&&Ln(t)}),q.set(A.UpdateCartQty,({event:e})=>{let{payload:{cart:t}}=e;t&&Ln(t)}),q.set(A.OrderConfirmation,({event:e})=>{let{payload:{transaction:t}}=e;t&&Rn(t,t.transactionId)});var J=new Map;J.set(A.EmailSubmit,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging email submission event`);return}e.push(`event`,`Click`,{event_category:`Email Submission`})}),J.set(A.SubmitApplyInSite,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging financing application event`);return}e.push(`event`,`submit_lead_form`,{event_category:`Financing Application Submit`})}),J.set(A.FinApproved,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging financing application event`);return}e.push(`event`,`submit_lead_form`,{event_category:`Financing Application Submit`})}),J.set(A.FinDeclined,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging financing application event`);return}e.push(`event`,`submit_lead_form`,{event_category:`Financing Application Submit`})}),J.set(A.FinTerminated,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging financing application event`);return}e.push(`event`,`submit_lead_form`,{event_category:`Financing Application Submit`})}),J.set(A.SubmitPreQual,()=>{let e=window.uetq;if(typeof e?.push!=`function`){x.warn(`uetq is not present, not tagging pre-qualification event`);return}e.push(`event`,`submit_lead_form`,{event_category:`Pre-Qualification Submit`})});var zn=new Map;function Bn(e){let{isGuest:t,isLoggedIn:n,isInsider:r,isInnerCircle:i}=e;return n?i?`InnerCircle`:r?`Insider`:`Authenticated`:t?`Guest`:`Unknown`}zn.set(A.PageView,({state:e})=>{le.addMetadata(`userId`,e.user.profile.profileID),le.addMetadata(`customerType`,Bn(e.user.access))});function Vn(e,t=0){return E({endpoint:`/api/storefront/analytics/search`,body:{q:e,total_results:t}})}async function Y(e){let t=!R(L.ADVERTISING)||!R(L.ANALYTICS);return navigator.doNotTrack!==`1`&&!t?E({endpoint:`/sn-api/storefront/vendor-analytics`,body:e,auth:!0}).catch(C):Promise.resolve()}function Hn(e){let t=e.replace(/\D/g,``);return t.length===10?`1${t}`:t}var X=new Map;function Z(e){return{user_id:e.user?.user_id,anonymous_id:e.user?.anonymous_id,firstName:e.user?.profile?.firstName,lastName:e.user?.profile?.lastName,email:e.user?.profile?.email}}X.set(A.CartAdd,({event:e,state:t})=>{let n=Z(t),{type:r,payload:i,eventId:o}=e,{items:s,cart:c}=i,l=s.map(e=>{let t=(e.productInfo.floatPricing.total_price||0)/e.quantity;return{mattress:e.productInfo.type===`mattress`,category_slugs:e.productInfo.categorySlugs,sku:e.productInfo.sku,quantity:e.quantity,name:e.productInfo.productName,original_price:t.toFixed(2),image_url:e.productInfo.productImage}}),u=s.reduce((e,t)=>
2e+(t.productInfo?.floatPricing?.total_regular_price||0),0);Y({event_name:r.name,data:{event_id:o,items:l,value:u,cart_id:c.id,full_url:t.page.url?.full||a.location?.href,metadata:n}})}),X.set(A.OrderConfirmation,({event:e,state:t})=>{let n=Z(t),{type:r,payload:i,eventId:o}=e,s=i.items.map(e=>({sku:e.productInfo.sku,quantity:e.quantity,name:e.productInfo.productName,price:{total_price:e.productInfo.normalPricing.totalPrice,total_regular_price:e.productInfo.normalPricing.totalRegularPrice},image_url:e.productInfo.productImage})),{shipping_address:c}=i.order,l=c.phone_number,u={city:c.city.split(` `).join().toLowerCase(),state:c.region.toLowerCase(),zip:c.postal_code.slice(0,5),country:c.country.toLowerCase(),phone:l?Hn(l):``};Y({event_name:r.name,data:{event_id:o,items:s,order_number:i?.transaction?.transactionId,metadata:n,addressData:u,full_url:t.page.url?.full||a.location?.href}})}),X.set(A.CartView,({event:e,state:t})=>{let n=Z(t),{type:r,payload:i,eventId:a}=e,o=i.items.map(e=>({sku:e.sku,quantity:e.quantity,name:e.product.name,original_price:(e.pricing.total_regular_price.cents/100).toFixed(2),price:Bt(e)})),s=i.items.reduce((e,t)=>e+t.pricing.total_price.cents/100,0);Y({event_name:r.name,data:{event_id:a,items:o,value:s.toFixed(2),cart_id:i.id,metadata:n}})}),X.set(A.UpdateProduct,({event:e,state:t})=>{let{productInfo:n}=e.payload.product;Y({event_name:e.type.name,data:{event_id:e.eventId,product:{sku:n.sku,productName:n.productName,itemGroupId:n.productId,url:n.productURL,image_url:n.productImage,full_url:t.page.url?.full||a.location?.href},metadata:Z(t)}})}),X.set(A.PageView,({event:e,state:t})=>{let n=Z(t),{type:r,payload:{pageType:i,pageInfo:{pageId:a},url:{full:o}},eventId:s}=e,c=t.product?.productInfo;Y({event_name:`url_visited`,data:{event_id:s,url:o,full_url:o,metadata:n,product:i?.isProduct&&c?.sku?{sku:c.sku}:void 0}}),a===`compare`&&Y({event_name:`compare_mattress`,data:{event_id:s,metadata:n}}),i?.isCategory&&Y({event_name:`category_view`,data:{slug:a,full_url:o,event_id:s,metadata:n}}),!i?.isProduct&&!i?.isCategory&&Y({event_name:r.name,data:{page_id:a,full_url:o,event_id:s,metadata:n}})}),X.set(A.BedQuizResultsView,({event:e,state:t})=>{let n=Z(t),{type:r,payload:i,eventId:a}=e,{emailResults:o}=i;Y({event_name:r.name,data:{...o,event_id:a,metadata:n}})}),X.set(A.UserSignUp,({event:e,state:t})=>{let n=Z(t),{eventId:r,payload:i}=e;Y({event_name:`sign_up`,data:{event_id:r,full_url:a.location?.href,metadata:{...n,firstName:i.first_name,lastName:i.last_name,email:i.email}}})});function Q({event:e,state:t}){let n=Z(t),{type:r,eventId:i}=e,o=a.location?.href;Y({event_name:r.name,data:{full_url:o,event_id:i,metadata:n}})}function Un({event:e,state:t}){let n=Z(t),{eventId:r}=e;Y({event_name:`financing_decision`,data:{full_url:a.location?.href,event_id:r,metadata:n}})}X.set(A.FinApproved,Un),X.set(A.FinDeclined,Un),X.set(A.FinTerminated,Un),X.set(A.SubmitApplyInSite,Q),X.set(A.SubmitFinancingApp,Q),X.set(A.SubmitPreQual,Q),X.set(A.SearchForStore,Q),X.set(A.ViewStore,Q),X.set(A.TryNearStore,Q);function Wn(e){e&&E({endpoint:`/api/storefront/analytics/category_view/${e}`,customConfig:{method:`post`}}).catch(e=>{if(d())throw e})}function Gn(e){e&&E({endpoint:`/api/storefront/analytics/product_view/${e}`,customConfig:{method:`post`}}).catch(e=>{if(d())throw e})}var Kn=new Map;Kn.set(A.UpdateCategory,({state:e})=>{let t=e.page?.category?.categoryId;Wn(t)}),Kn.set(A.UpdateProduct,({event:e})=>{let t=e.payload?.product?.productInfo?.productId;Gn(t)});var $={findUptImage:null,getOptionsMap:null,getSafeMattressProduct:null,isSuperPkg:null};r(()=>import(`./product-BJjY38Vf.js`).then(e=>e.nt).then(e=>{$.findUptImage=e.findUptImage,$.getOptionsMap=e.getOptionsMap,$.getSafeMattressProduct=e.getSafeMattressProduct,$.isSuperPkg=e.isSuperPkg}),__vite__mapDeps([0,1,2,3,4,5,6,7,8]));var{currency:qn}=me,Jn=new Map([[A.UpdateCart,s.idle],[A.UpdateUser,s.idle]]);function Yn([e,t]){let n=A[e];if(!n)return C(`No AnalyticsAction[${e}] found`),null;let r=new Map;return r.set(n,t),r}var Xn=[fn,K,H,J,zn,q,Kn,X,...(a?.sn?.analytics?.preregistered||[]).map(Yn).filter(
2Boolean)],Zn=u.get(`prerender-split`),Qn={consumers:Xn,page:{pageInfo:{},category:{},attributes:{}},product:{productInfo:{},attributes:{},category:{}},user:{segments:null,access:{},profile:{},attributes:{}},events:[],abTests:Zn?[{name:`AB_Prerender_Sale_Page`,split:Zn}]:[],cart:{cartId:null,price:{},items:[],attributes:{}},transaction:{transactionId:null,step:h.NotStarted,progress:h.NotStarted,profile:{profileInfo:{}},pricing:{},payment:{},items:[]}};function $n(e,t){let n=e;(ae(e,se.bundled_line_items)||$.isSuperPkg?.(e))&&(n=$.getSafeMattressProduct?.(e)||e);let r=$.getOptionsMap?.(t)??{},i=$.findUptImage?.(e);return{description:n.meta_description,productId:n.id,productImage:i?.url,productName:n.name,productURL:`/products/${n.slug}`,type:n.type,slug:n.slug,sku:t?.sku,options:r}}function er(e,t){let{pricing:n}=t;e.cart={...e.cart,items:P(t.items),cartId:t.id,price:{...e.cart.price,basePrice:S(n.subtotal_price.cents),priceWithTax:S(n.subtotal_price.cents+n.tax_total.cents),cartTotal:S(n.total_price.cents),shipping:S(n.shipping_total.cents),shippingMethod:t.shipping_service},attributes:{...e.cart.attributes,financingAvailable:t.financing_options,calculationStatus:t.calculation_status,promoCodes:t.promo_codes}}}function tr(e){let{id:t,user_id:n,placed_at:r,email:i,estimated_location:a,tax_rate:o,items:s,financing_options:c,pricing:{subtotal_price:l,shipping_total:u,total_price:d,tax_total:f},shipping_groups:p=[],shipping_address:m,billing_address:h,tenders:g}=e,_=At(e),v=Pt(e),ee=Nt(e),te=qn(jt(e).total*100),y=Xt(e),b=p.map(e=>e.shipping_services).flat().map(e=>e.type),ne={basePrice:S(l.cents),savings:qn(Math.abs(_.total)),withTax:S(l.cents+f.cents),taxRate:o,total:S(d.cents),shipping:S(u.cents),recyclingFee:te},re={profileInfo:{profileId:n,userName:i,email:i,userLocation:a},shippingAddress:m,billingAddress:h};return{items:P(s),pricing:ne,profile:re,transactionId:t,placedAt:r,shippingMethod:b,discounts:_,tenders:g,financing:y,financingAvailable:c,coupons:v,rewards:ee}}function nr(e,t){let{category:n,pageInfo:r,url:i,pageType:a}=t;e.page.category={...e.page.category,...n},e.page.pageInfo={...e.page.pageInfo,...r},e.page.url=i,e.page.pageType=a,e.page.pageType?.isProduct&&(e.product.category={...e.product.category,...n})}function rr(e,t){let{type:n}=t,r=g(),i=g(),o=we(e,a=>{switch(n){case`initialize`:{let e=t.sessionData,n=t.user,r=t.cart;nr(a,t.page),a.user={...a.user,anonymous_id:e.anonymous_id,segments:e.segments,primary:e.primary,user_id:e.user_id,access:{...a.user.access,isLoggedIn:e.logged_in,isInnerCircle:e.innercircle,isInsider:e.insider}},n&&(a.user.profile={...a.user.profile,firstName:n.first_name,lastName:n.last_name,customerNumber:n.customer_number,profileId:n.id,email:n.email}),r&&er(a,r);return}case`register.consumer`:{let{consumer:e}=t;e&&a.consumers.push(e);return}case A.FurnitureSwatchRequestSubmit:{let{payload:e}=t;a.events.push({type:n,eventId:i,actionId:r,payload:e});return}case A.SearchForStore:{let{payload:{method:e,searchData:o}}=t,s={method:e?.enumKey,...o};a.events.push({type:n,eventId:i,actionId:r,payload:s});return}case A.OrderConfirmation:{let e=t.payload,o=tr(e),s=P(e.items);a.transaction={...a.transaction,...o,step:h.Confirmation,progress:h.Confirmation};let c={transaction:a.transaction,order:e,items:s};a.events.push({type:n,actionId:r,eventId:i,payload:c});return}case A.UpdateCheckout:{let{order:e}=t.payload,o=tr(e);a.transaction={...a.transaction,...o};let s={transaction:a.transaction};a.events.push({eventId:i,actionId:r,type:n,payload:s});return}case A.UpdateCart:{let e=t.payload;if(!e)return;er(a,e);let o={cart:a.cart};a.events.push({type:n,eventId:i,actionId:r,payload:o});return}case A.CartAdd:{let e=P(t.payload.items),o=P(t.payload.cart.items),s={items:e,cart:{...t.payload.cart,items:o}};e.forEach(e=>He(e,t.payload.cart,e.quantity)),a.events.push({type:n,eventId:i,actionId:r,payload:s});return}case A.UpdateCartQty:{let{item:e,quantity:o,cart:s}=t.payload,c=`inc`;o<e.quantity&&(c=`dec`),o===0&&(c=`remove`);let l=P([e]);o>e.quantity&&l.forEach(e=>He(e,s,o));let u={item:{productInfo:Vt(e),quantity:o},quantity:Math.abs(e.quantity-o),updateType:c,cart:{...s,items:P(s.items)}};a.events.push({eventId:i,actionId:r,type:n,payload:u});return}case A.UpdatePage:{nr(a,t.payload);let e={page:a.page};a.events.push({eventId:i,actionId:r,type:n,payload:e});return}case A.AbTestDetected:{let e=t.data,o=a.abTests;if(!o.some(t=>JSON.stringify(t)===JSON.stringify(e))){o.push({...e});let t={test:e};a.events.push({eventId:i,actionId:r,type:n,payload:t})}return}case A.ElementImpression:{let{name:e,duplicate:o}=t.payload,s=a.events.some(t=>JSON.stringify(t.payload?.name)===JSON.stringify(e));if(o||!s){let t={name:e};a.events.push({eventId:i,actionId:r,type:n,payload:t})}return}case A.UpdateProduct:{let{product:o,variant:s}=t.payload,{type:c}=o;if(Object.keys(o).length===0)return;let l=$.getOptionsMap?.(s)??{};a.product.productInfo={...a.product.productInfo,...$n(o,s),options:l},a.product.attributes={...a.product.attributes,productType:c,details:l};let u={product:a.product};a.events.push({type:n,eventId:i,actionId:r,payload:u});let d=e.product?.attributes?.details||{},f=Object.entries(d).reduce((e,t)=>
2{let[n,r]=t;return r!==l[n]&&(e[n]=l[n]),e},{});if(f&&Object.keys(f).length){let e=A.SelectProductFilter,t={selections:f,selected:a.product},n={type:e,eventId:i,actionId:r,secondary:!0,payload:t};a.events.push(n)}return}case A.UpdateCategory:{let{category:e,categories:o}=t.payload,s;if(window.location.hash){let e=window.location.hash.slice(1);s=o?.find(t=>t.slug===e)}a.page.category.categoryId=e?.id,a.product.category.categoryId=e?.id,a.product.category.primaryCategory=e?.name,s&&(a.product.category.subCategory=s?.name);let c={category:a.product.category};a.events.push({type:n,eventId:i,actionId:r,payload:c});return}case A.UpdateUser:{let{user:e}=t.payload;a.user={...a.user,anonymous_id:e.anonymous_id,segments:e.segments,device:e.device,dnt:e.dnt,primary:e.primary,user_id:e.user_id,access:{...a.user.access,isLoggedIn:e.logged_in,isInnerCircle:e.innercircle,isInsider:e.insider}};return}case A.UpdateAuth:{let{user:{id:e,email:n,first_name:r,last_name:i,customer_number:o}}=t.payload;a.user.profile={...a.user.profile,firstName:r,lastName:i,customerNumber:o,profileId:e,email:n};return}case A.PageView:{let{meta:o,payload:s}=t,{pageType:c}=e.page;a.events.push({type:n,eventId:i,actionId:r,meta:o,payload:s});let l=a.product?.category,u=a.transaction,d=a.cart,f=a.product,p,m;c?.isProduct?(p=A.ProductView,m={product:f}):c?.isCategory?(p=A.CategoryView,m={pageType:c,category:l}):c===j.OrderConfirmation?(p=A.OrderConfirmationView,m={pageType:c,transaction:u,cart:d}):c===j.Checkout&&(p=A.CheckoutView,m={pageType:c,transaction:u}),p&&a.events.push({type:p,payload:m,eventId:i,actionId:r});return}case A.CheckoutLogin:{let{email:e,loginType:o}=t.payload;a.transaction.profile.profileInfo.email=e,a.transaction.step=h.Login;let s={loginType:o,email:e};a.events.push({type:n,eventId:i,actionId:r,payload:s});return}case A.CheckoutStepActive:a.transaction.step=t.payload.step,a.events.push({type:n,eventId:i,actionId:r,payload:t.payload});return;case A.CheckoutStepComplete:{let e=t.payload.step,o=t.payload.completions||-1,s=t.payload.order,c=tr(s),l=a.transaction.progress?.enumOrdinal,u=e.enumOrdinal>l?e:a.transaction.step;a.transaction={...a.transaction,...c,profile:{...a.transaction.profile,...c.profile},progress:u,step:e};let d={user:a.user,order:a.transaction};if(o>-1){let e=`first_completion`;o>1&&(e=`repeat_completion`),d.step_completion_type=e}a.events.push({type:n,eventId:i,actionId:r,payload:d});return}case A.CheckoutStepViewed:a.transaction.step=t.payload.step,a.events.push({type:n,eventId:i,actionId:r,payload:t.payload});return;case A.CheckoutPlaceOrder:{let e=t.payload.payment.type;a.transaction.payment={...a.transaction.payment,type:e};let o={order:a.transaction,paymentType:e};a.events.push({type:n,eventId:i,actionId:r,payload:o});return}case A.CloseModal:case A.ShowModal:a.events.push({type:n,eventId:i,actionId:r,payload:t.payload});return;case A.BedQuizAnswer:{let{payload:{answer:e,question:o}}=t,s=a.user.attributes?.bedQuiz||{},c=a.user.attributes?.bedQuiz?.answers||[];a.user.attributes.bedQuiz={...s,answers:{...c,[`${o.name}`]:e}};let l={question:o,answer:e};a.events.push({type:n,payload:l,actionId:r,eventId:i});return}case A.BedQuizResultsView:{let{payload:{results:e,size:o,emailResults:s}}=t,c=a.user.attributes?.bedQuiz||{},l=a.user.attributes?.bedQuiz?.results||{};a.user.attributes.bedQuiz={...c,results:{...l,results:{...e,size:o}}};let u={results:e,size:o,emailResults:s};a.events.push({type:n,payload:u,actionId:r,eventId:i});return}case A.RecommendedProductImpression:{let{payload:{product:e,selected:o}}=t,s={item:{productInfo:$n(e,o)}};a.events.push({type:n,payload:s,actionId:r,eventId:i});return}default:{if(!n)return;let{meta:e,trigger:o,payload:s={}}=t;a.events.push({type:n,eventId:i,actionId:r,meta:e,trigger:o,payload:s})}}});n?.timing===Qe.PageView&&Jn.set(n,s.complete);let{consumers:c,...l}=o;return a.digitalData=l,o.events.filter(e=>e.actionId===r).forEach(e=>{o.consumers.forEach(t=>{let i=t.has(A.__ALL)?t.get(A.__ALL):t.get(e.type);typeof i==`function`&&i({type:n,event:e,state:o,actionId:r})})}),o}var ir={name:`analytics`,context:(0,Te.createContext)(null),handle:function(e,t){if(!t)return e;try{return rr(e,t)}catch(t){return C(t),e}},getDefaultState(){return Qn}};function ar(){let e=(0,Te.use)(ir.context);if(!e)throw Ce(ir.name);return e}function or(e,t,n,r){let[i,a]=xe(ir);return a.dispatch({type:`initialize`,sessionData:e,user:t,cart:n,page:r}),[i,a]}function sr({cart:e,children:t}){let n=at(),r=ge(),i=ye(),[a,o]=Se(()=>or(r,i,e,n));return(0,Te.useEffect)(()=>
2{let e=ht(o.dispatch);return document.addEventListener(`submit`,mt),document.addEventListener(`click`,ft,!0),document.addEventListener(et,e),()=>{document.removeEventListener(`submit`,mt),document.removeEventListener(`click`,ft,!0),document.removeEventListener(et,e)}},[o.dispatch]),he(w.topics.ANALYTICS_CREATE_CONSUMER,({callback:e,callPrev:t})=>{let n=new Map,r=te(window,`digitalData.events`)||[];t&&r.forEach(t=>{e({type:t.type,event:t,digitalData:window.digitalData,actionId:t.actionId})}),n.set(A.__ALL,e),o.dispatch({type:`register.consumer`,consumer:n})}),he(w.topics.ANALYTICS_REGISTER_CONSUMER,({consumer:e})=>{o.dispatch({type:`register.consumer`,consumer:e})}),he(w.topics.ANALYTICS_EVENT,e=>{o.dispatch(e)}),(0,F.jsx)(a,{children:t})}function cr(){let{dispatch:e}=ar();return(0,Te.useCallback)((t,n)=>{let r={type:t};n&&(r.payload=n),e(r)},[e])}function lr(e){let t=[...ve()?.breadcrumbs||[]],n=``;return t.splice(0,1),t.forEach(e=>n+=`${e.name}:`),e&&(n+=e),n}function ur({as:e=`div`,markup:t,children:n,...r}){let i=e,a=t||n;return(0,F.jsx)(i,{...r,dangerouslySetInnerHTML:{__html:a}})}function dr({children:e,...t}){return(0,F.jsx)(`script`,{...t,dangerouslySetInnerHTML:{__html:e}})}export{Ge as $,Nt as A,xt as B,zt as C,Pt as D,Rt as E,Ft as F,gt as G,yt as H,Tt as I,j as J,rt as K,wt as L,Lt as M,It as N,At as O,Ut as P,Je as Q,Ct as R,Wt as S,Kt as T,vt as U,bt as V,_t as W,A as X,nt as Y,O as Z,Ot as _,cr as a,Ye as at,N as b,R as c,D as ct,I as d,E as dt,We as et,Qt as f,en as g,Zt as h,lr as i,qe as it,Mt as j,jt as k,Yt as l,Re as lt,$t as m,dr as n,Ke as nt,Vn as o,Ze as ot,Xt as p,it as q,sr as r,Ue as rt,L as s,Le as st,ur as t,Ve as tt,qt as u,Ee as ut,Dt as v,Gt as w,Et as x,M as y,St as z};
3//# sourceMappingURL=Html-BylF1A06.js.map

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.