!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="28ee4310-b12e-46ee-a3d2-1dcaa3e4e56f",e._sentryDebugIdIdentifier="sentry-dbid-28ee4310-b12e-46ee-a3d2-1dcaa3e4e56f")}catch(e){}}();var _global="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};_global.SENTRY_RELEASE={id:"cnet-neutron@cnet.prod.254f83"},(window.webpackJsonp=window.webpackJsonp||[]).push([[277],{3041:function(e,t,r){"use strict";r.r(t);var n=r(7),o=(r(22),r(4),r(26),r(5),r(0)),l=r(798),c=(r(18),r(33),r(39)),d=r(42),v=r(29),h=r(55),f=class extends h.a{constructor(e){super(e),this.services=["tagular"]}get defaults(){return{"@type":"core.InfinitePageScrolled.v1",isInfiniteScroll:!0}}};f=Object(o.a)([Object(c.a)(v.a.Transient),Object(o.c)(0,d.a),Object(o.b)("design:paramtypes",[Object])],f);var m=r(38),y=r(6),x=r(804),P=r(975);function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t{this.currentParentPage=e,this.initializeSeamless()}))}initializeSeamless(){var e=this;return Object(n.a)((function*(){var t,r;e.$services.isFeatureEnabled("seamless")?(e.$seamless.createSeamlessMeta(e.$meta()),e.listing=null===(t=yield e.$seamless.requestSeamlessListing(null===(r=e.currentParentPage)||void 0===r?void 0:r.content))||void 0===t?void 0:t.items):I.a.warn("Seamless is disabled")}))()}enterPage(e){var t=this;return Object(n.a)((function*(){var{data:data,direction:r}=e;I.a.log("waiting for page to be requested and inserted");try{yield t.pageRequestPromises[data.index]}catch(e){return void I.a.error(e)}I.a.log("enterPage",data,r);var n="down"===r?data.index+1:data.index,o=t.getPageByIndex(n),l="down"===r?data.index-1:data.index+1,c=t.getPageByIndex(l);I.a.log("previousPage",c),c&&c.removeAds(),t.$seamless.enterPage(o,c,{data:data,direction:r}),t.$nuxt.$emit("seamless-enter",o)}))()}preInsertPage(e,t){this.loading=!0;try{this.pageRequestPromises[e]=new Promise(((r,n)=>{t.then((t=>{var n,o;if(null!=t&&null!==(n=t.content)&&void 0!==n&&n.content)this.insertPage(t.content,e,t.pageTypeConfig).then(r),this.loading=!1;else if((null==t||null===(o=t.content)||void 0===o?void 0:o.getComponentByName("article"))instanceof m.b){var l=t.content.getComponentByName("article"),c=l.errors.map((e=>e.message)).join(", ");this.$sentry.captureException(new Error("Seamless Fetch Error: Index: ".concat(e," Status: ").concat(l.status.toString()," - ").concat(c))),I.a.error("Seamless Fetch Error: Index: ".concat(e," Status: ").concat(l.status.toString()," - ").concat(c))}else this.$sentry.captureException("Seamless Fetch Error: Page content is not found for index: ".concat(e,".")),I.a.error("Seamless Fetch Error: Page content is not found for index: ".concat(e,"."))}))}))}catch(e){I.a.error(e),this.loading=!1}}insertPage(content,e,t){var r=this;return Object(n.a)((function*(){var component=yield t.component();component=component.extend({data:()=>({content:content}),beforeCreate(){try{this.$options.asyncData(this.$nuxt.context,content)}catch(e){I.a.error("error calling 'asyncData' for page with slug: '".concat(content.id,"'"),e)}}}),r.$config.ads.adDisplay.delayLoad=!0,r.$nuxt.$meta().pause(),r.pages.push(component),yield r.$nextTick();try{r.$refs.pages[e]?I.a.log("inserted page: '".concat(content.pageType,"' with identifier: '").concat(content.id,"'")):(r.pages.pop(),I.a.warn("could not find a reference to a page at index ".concat(e)))}catch(e){I.a.error("error getting page reference for identifier: '".concat(content.id,"'"),e)}}))()}trackScroll(e,t){var r,n,o,l;if(this.$services.isFeatureEnabled("seamless")){I.a.log("Firing Cohesion scroll event",e,null==t||null===(r=t.data)||void 0===r?void 0:r.index),this.$track(f).with({scrollDistance:e,pageIndex:null==t||null===(n=t.data)||void 0===n?void 0:n.index}).fire();var content=null===(o=this.getPageByIndex(null==t||null===(l=t.data)||void 0===l?void 0:l.index))||void 0===o||null===(o=o.content)||void 0===o?void 0:o.content;this.$nuxt.$emit("track-scroll",e,content)}else I.a.log("Not firing scroll events, seamless is disabled")}cleanup(){this.$config.ads.adDisplay.delayLoad=!1,this.pages=[],this.pageRequestPromises=[],this.listing=null,this.$store.commit("page/clearSeamless"),this.$nuxt.$meta().resume()}};Object(o.a)([Object(l.Watch)("$route"),Object(o.b)("design:type",Function),Object(o.b)("design:paramtypes",[]),Object(o.b)("design:returntype",void 0)],C.prototype,"routeChange",null);var D=C=Object(o.a)([Object(l.Component)({components:{SeamlessTriggers:k,TrackScroll:T.a}})],C),E=Object(_.a)(D,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"c-seamlessListing"},[t("TrackScroll",{attrs:{"tracking-data":{index:0}},on:{"scroll-change":e.trackScroll}},[e._t("default")],2),e._v(" "),e.listing?[t("SeamlessTriggers",{attrs:{index:0},on:{"seamless-insert-page":e.preInsertPage,"seamless-enter-page":e.enterPage}}),e._v(" "),e._l(e.pages,(function(r,n){return[t("TrackScroll",{key:r.slug,attrs:{"tracking-data":{index:n+1}},on:{"scroll-change":e.trackScroll}},[t(r,{ref:"pages",refInFor:!0,tag:"component",attrs:{"is-seamless":!0}})],1),e._v(" "),n({content:content}),beforeCreate(){try{this.$options.asyncData(this.$nuxt.context,content)}catch(e){I.a.error("error calling 'asyncData' for page with slug: '".concat(content.id,"'"),e)}}}),r.$config.ads.adDisplay.delayLoad=!0,r.$nuxt.$meta().pause();var o=content.content,l=null===(n=article.f.mattressesBestListRedesign)||void 0===n?void 0:n.includes(o.id);r.pageRecords.push({component:component,isBestList:l,id:o.id}),yield r.$nextTick();try{r.$refs.pages[e]?I.a.log("inserted page: '".concat(content.pageType,"' with identifier: '").concat(content.id,"'")):(r.pageRecords.pop(),I.a.warn("could not find a reference to a page at index ".concat(e)))}catch(e){I.a.error("error getting page reference for identifier: '".concat(content.id,"'"),e)}}))()}enterPage(e){var t=this;return Object(n.a)((function*(){var{data:data,direction:r}=e;I.a.log("waiting for page to be requested and inserted");try{yield t.pageRequestPromises[data.index]}catch(e){return void I.a.error(e)}I.a.log("enterPage",data,r);var n="down"===r?data.index+1:data.index,o=t.getPageByIndex(n),l="down"===r?data.index-1:data.index+1,c=t.getPageByIndex(l);I.a.log("previousPage",c),c&&c.removeAds(),t.$seamless.enterPage(o,c,{data:data,direction:r}),t.$nuxt.$emit("seamless-enter",o),t.clearBestListCompareStore()}))()}clearBestListCompareStore(){this.$store.dispatch("bestList/updateFirstProduct",null),this.$store.dispatch("bestList/updateFirstProductCta",null),this.$store.dispatch("bestList/updateSecondProduct",null),this.$store.dispatch("bestList/updateSecondProductCta",null)}},B=L=Object(o.a)([Object(l.Component)({components:{SeamlessTriggers:k,TrackScroll:T.a}})],L),F=Object(_.a)(B,(function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"c-seamlessListing"},[t("TrackScroll",{attrs:{"tracking-data":{index:0}},on:{"scroll-change":e.trackScroll}},[e._t("default")],2),e._v(" "),e.listing?[t("SeamlessTriggers",{attrs:{index:0},on:{"seamless-insert-page":e.preInsertPage,"seamless-enter-page":e.enterPage}}),e._v(" "),e._l(e.pageRecords,(function(r,n){return[t("TrackScroll",{key:r.id+"-scroll",attrs:{"tracking-data":{index:n+1}},on:{"scroll-change":e.trackScroll}},[t(r.component,{ref:"pages",refInFor:!0,tag:"component",attrs:{"is-seamless":!0,"is-seamless-best-list":r.isBestList}})],1),e._v(" "),n{var e;d.log(data);var r=null==t||null===(e=t.value)||void 0===e?void 0:e.handler;r?r(data):d.warn("No handler specified on Intersection Observer directive")}))}))()}update(){this.observer&&this.refreshOnUpdate&&this.observer.refresh()}componentUpdated(){this.observer&&this.refreshOnUpdate&&this.observer.refresh()}unbind(){this.observer&&this.observer.destroy()}}}}]);