function filteringRetailer(n,t){var r=n.split("_"),i=t.Retailers.filter(function(n){return r.indexOf(n.RetailerID)>=0});return i.length>0&&(t.Retailers=i),t}function SetEqualHeight(n,t){try{if(n.length>0)if(t==undefined&&(t=window.innerWidth||document.body.clientWidth),t>767){var i=0;n.css({height:"auto"});n.each(function(){var t=jQuery(this);t.outerHeight()>i&&(i=n.hasClass("m-product-placement-item")&&!n.hasClass("compare-devices-height")&&$("html").attr("lang").toLowerCase()!="de-de"&&$("html").attr("lang").toLowerCase()!="en-us"?t.outerHeight()+40:n.hasClass("m-product-placement-item")&&!n.hasClass("compare-devices-height")&&($("html").attr("lang").toLowerCase()=="de-de"||$("html").attr("lang").toLowerCase()=="en-us")?t.outerHeight()+53:t.outerHeight())});setTimeout(function(){n.css("height",i)},500)}else n.css({height:"auto"})}catch(r){console.log(r)}}function getQueryString(n,t){var i=new RegExp("[?&]"+t+"=([^&#]*)").exec(window.location.href);return i==null?undefined:decodeURI(i[0])||""}function getQueryParams(n){var t=new RegExp("[?&]"+n+"=([^&#]*)").exec(window.location.href);return t==null?undefined:decodeURI(t[1])||""}function returnDeviceObjectBySku(n){try{var t;window.data!=undefined&&window.data.forEach(function(i,r){i.ProductID==n&&(t=window.data[r])});window.vad.catalog!=undefined&&window.vad.catalog.allIndividualItems.forEach(function(i,r){i.ProductID==n&&(t=window.vad.catalog.allIndividualItems[r])})}catch(i){console.log(i)}return t}function whichCategory(n){try{return n=="Desktops and All-in-Ones"?"AllInOnes":n=="Gaming PCs"?"Gaming":n=="2-in-1s"?"2In1s":n=="LTE PC"?"LTEDevices":"Laptops"}catch(t){console.log(t)}}function sortByOrder(n){n.sort(function(n,t){return+$(n).attr("data-featured-order")-+$(t).attr("data-featured-order")})}function sortByFFOrder(n){n.sort(function(n,t){return+$(n).attr("data-featured-formfactor-order")-+$(t).attr("data-featured-formfactor-order")})}function shuffleArray(n){let t=n.length;while(0!==t){let i=Math.floor(Math.random()*t);t-=1;let r=n[t];n[t]=n[i];n[i]=r}return n}function shuffle(n){let t=n.length,i;while(t!=0)i=Math.floor(Math.random()*t),t--,[n[t],n[i]]=[n[i],n[t]];return n}function endOfSupport(n){var t=function(n){$("#"+n+" .m-feature").find(".featurecontent").each(function(){changingIDsForTooltip($(this))})},i=function(n){$("#"+n+" .m-panes").find(".m-panes-product-placement-item").each(function(){changingIDsForTooltip($(this))})},r=function(t){$("#"+t+" .m-panes").find(".m-panes-product-placement-item").each(function(){var c=$(this).attr("data-devices"),l=c.split("|"),a=n.filter(function(n){return l.indexOf(n.DeviceName)>=0}),i=shuffleArray(a),u=$(this).find(".c-paragraph").html(),f="",e="",o=0,s,h,r;i[0].OEMPromotions==""||i[0].OEMPromotions==null?(i[0].OEMPromotions="",f=" hidesale"):(e=i[0].OEMPromotions.split(":")[1],o=parseInt(i[0].OEMPromotions.split(":")[0])-1);s=$(".end-of-support #"+t+" .tooltipInfoCopy.hide").eq(o).html();h='
'+e+'<\/span>
'+s+"<\/div><\/div>";$(this).find("div:first").prepend(h);changingIDsForTooltip($(this));$(this).find(".c-call-to-action.hatch-button").removeClass("c-glyph");u=u.replace("@@Device Name@@",i[0].DeviceName);$(this).find(".c-paragraph").html(u);$(this).find(".hatch-button").attr("data-product",i[0].ProductID);r=i[0].DeviceImage.ViewPort1.replace("http://","https://");$(this).find(".c-image source").attr("srcset",r);$(this).find(".c-image img").attr("srcset",r);$(this).find(".c-image img").attr("src",r)})};r("panes-panel-Win8");r("panes-panel-Win8-t3-with-ocid");i("panes-panel-Win8-t1-with-ocid");i("panes-panel-Win8-t2-with-ocid");t("win8_app_omc_win_t1_feature_id");t("win8_app_omc_win_t2_feature_id")}function arrayData(n){$("#loader").addClass("hide");$("#view-all").removeClass("hide");vad.categorized={};["2-in-1s","Laptops","Desktops and All-in-Ones","Gaming PCs","LTE PC"].forEach(function(t){vad.categorized[t]={};vad.categorized[t].type=t;vad.categorized[t].devices=n.filter(function(n){return n.Category==t});vad.categorized[t].devices=vad.categorized[t].devices.sort(vad.catalog.sorts.featured);shuffle(vad.categorized[t].devices);$.each(vad.categorized[t].devices,function(n,i){var f=returnDeviceObjectBySku(i.ProductID),u,r,e,o,s,h,n,c,l;if(f!=undefined){u=buildingHTMLDevice(f,t+n);function a(n){$("#view-all").removeClass("hide");$(n).append(u);var t=$(n).children();shuffle(t);t.appendTo(n);changingIDsForTooltip($(n).find("section[data-product="+i.ProductID+"]"))}if(pageUrl.indexOf("/windows/view-all-devices")!=-1){for(r="#two-in-ones-devices",pageUrl.indexOf("en-ca/windows/view-all-devices")!=-1||pageUrl.indexOf("fr-ca/windows/view-all-devices")!=-1?(t=="2-in-1s"&&$("#two-in-ones-devices li[data-product]").length<5&&a(r),t=="Laptops"&&$("#two-in-ones-devices li[data-product]").length<10&&a(r)):pageUrl.indexOf("ja-jp/windows/view-all-devices")!=-1||pageUrl.indexOf("ja-jp/windows/view-all-devices")!=-1?(t=="2-in-1s"&&$("#two-in-ones-devices li[data-product]").length<2&&a(r),t=="Laptops"&&$("#two-in-ones-devices li[data-product]").length<10&&a(r)):(t=="2-in-1s"&&$("#two-in-ones-devices li[data-product]").length<3&&a(r),t=="Laptops"&&$("#two-in-ones-devices li[data-product]").length<6&&a(r)),pageUrl.indexOf("en-gb/windows/view-all-devices")!=-1?(t=="Desktops and All-in-Ones"&&$("#two-in-ones-devices li[data-product]").length<11&&a(r),t=="Gaming PCs"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r)):pageUrl.indexOf("en-ca/windows/view-all-devices")!=-1||pageUrl.indexOf("fr-ca/windows/view-all-devices")!=-1?(t=="Desktops and All-in-Ones"&&$("#two-in-ones-devices li[data-product]").length<11&&a(r),t=="Gaming PCs"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r)):pageUrl.indexOf("fr-fr/windows/view-all-devices")!=-1?(t=="Desktops and All-in-Ones"&&$("#two-in-ones-devices li[data-product]").length<9&&a(r),t=="Gaming PCs"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r)):pageUrl.indexOf("ja-jp/windows/view-all-devices")!=-1?(t=="Desktops and All-in-Ones"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r),t=="Gaming PCs"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r)):(t=="Desktops and All-in-Ones"&&$("#two-in-ones-devices li[data-product]").length<9&&a(r),t=="Gaming PCs"&&$("#two-in-ones-devices li[data-product]").length<12&&a(r)),n=12;n<$("#two-in-ones-devices li[data-product]").length;n++)$("#two-in-ones-devices li[data-product]")[n].remove();$("#two-in-ones-devices li[data-product]").length<12?$(".load-more-btn").addClass("hide"):$(".load-more-btn").removeClass("hide")}else{if(pageUrl.indexOf("/windows/2-in-1s")!=-1&&t=="2-in-1s"){for(e="#two-in-ones-devices",a(e),n=12;n<$("#two-in-ones-devices li[data-product]").length;n++)$("#two-in-ones-devices li[data-product]")[n].remove();$("#two-in-ones-devices li[data-product]").length<12?$(".load-more-btn").addClass("hide"):$(".load-more-btn").removeClass("hide")}if(pageUrl.indexOf("/windows/windows-laptops")!=-1&&t=="Laptops"){for(o="#laptops-devices",a(o),n=12;n<$("#laptops-devices li[data-product]").length;n++)$("#laptops-devices li[data-product]")[n].remove();$("#laptops-devices li[data-product]").length<12?$(".load-more-btn").addClass("hide"):$(".load-more-btn").removeClass("hide")}if(pageUrl.indexOf("/windows/desktops-and-all-in-ones")!=-1&&t=="Desktops and All-in-Ones"){for(s="#all-in-ones-devices",a(s),n=12;n<$("#all-in-ones-devices li[data-product]").length;n++)$("#all-in-ones-devices li[data-product]")[n].remove();$("#all-in-ones-devices li[data-product]").length<12?$(".load-more-btn").addClass("hide"):$(".load-more-btn").removeClass("hide")}if(pageUrl.indexOf("/windows/gaming-pcs")!=-1&&t=="Gaming PCs"){for(h="#gaming-devices",a(h),n=12;n<$("#gaming-devices li[data-product]").length;n++)$("#gaming-devices li[data-product]")[n].remove();$("#gaming-devices li[data-product]").length<12?$(".load-more-btn").addClass("hide"):$(".load-more-btn").removeClass("hide")}pageUrl.indexOf("/windows/lte-tablets-laptops-and-pcs")!=-1&&t=="LTE PC"&&(c="#lte-devices",a(c));pageUrl.indexOf("/windows/4k")!=-1&&(l="#4k-devices",a(l));$('.filterBy [data-category="Category"]').hide()}$("#allItemsHidden").append(u)}});setTimeout(function(){var r,u,f,t,o,s,n;r=$("#allItemsHidden>li[data-category='2-in-1s']").length;u=$("#allItemsHidden>li[data-category='Laptops']").length;f=$("#allItemsHidden>li[data-category='Desktops and All-in-Ones']").length;t=$("#allItemsHidden>li[data-category='Gaming PCs']").length;o=$("#allItemsHidden>li[data-category='LTE PC']").length;s=$("#allItemsHidden>li[data-features*='4k']").length;let i=[r,u,f,t],e=["2-in-1s","windows-laptops","desktops-and-all-in-ones","gaming-pcs","lte-tablets-laptops-and-pcs","4k"];if(pageUrl.indexOf("ja-jp/windows/view-all-devices")!=-1)$("#resultsCountOnLoad").text(vad.catalog.allUniqueItems.length),$("#resultsCountOnLoad").removeClass("hide");else if(pageUrl.indexOf("/windows/view-all-devices")!=-1)for($("#resultsCountOnLoad").text(vad.catalog.allUniqueItems.length),n=0;n4?$(".totalCount.count"+(n+1)).removeClass("hide"):i[n]==0?$("#category"+(n+1)).addClass("hide"):($(".totalCount.count"+(n+1)).addClass("hide"),$("#resultsCountOnLoad").text(vad.catalog.allUniqueItems.length));else{for(n=0;n span").each(function(){$(this).text().length<=2&&$(this).remove();$(this).parent().find("span:last-child:not(a span)").find("span:not(a span)").remove()})}function viewAll(){(function(){function o(){var n=[];return vad.catalog.displayItems.forEach(function(t){n.push(t.ProductID)}),n}function y(n){let t=document.createDocumentFragment();return n.forEach(function(n){const i=document.querySelector("#allItemsHidden li[data-product='"+n+"']"),r=$(i).clone(!0);$(r).find(".ps-widget").click(function(){$(i).find(".ps-widget").click()});$(t).append(r)}),t}function g(){$(".showAllButton").click(function(){const i=$(this).parent().parent().siblings(".awbCatalogCategory"),t=$(i).find("ul.c-menu li span[aria-selected=true]").closest("li"),r=$(t).attr("id")!=undefined?$(t).attr("id").split("-")[1]:"featured";vad.catalog.displayItems=n.find("input:checked").length==0?vad.catalog.allUniqueItems:vad.catalog.displayItems;switch(r){case"lowToHigh":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.lowToHigh);break;case"highToLow":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.highToLow);break;case"featured":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.featured);break;case"rating":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.rating)}p(this);var u=$(this).closest(".device-category"),e=u.attr("id");const f=$(this).attr("aria-expanded");f==="false"&&(vad.catalog.displayItems=vad.catalog.displayItems.slice(0,12));t.length==0&&shuffle(vad.catalog.displayItems);vad.catalog.skuArr=o();w(vad.catalog.skuArr,i);$(this).parent().closest(".load-more-btn").hide();setTimeout(function(){SetEqualHeight($("fieldset legend.c-subheading-2"));SetEqualHeight($(".m-product-placement-item h3"));SetEqualHeight($(".m-product-placement-item .c-list"));SetEqualHeight($(".m-product-placement-item .iconimagesheading"));SetEqualHeight($(".m-product-placement-item .deviceBadge"));$(".device-category ul.m-content-placement > li:nth-child(1)").find("sup:visible a:first()").focus()},1200);setTimeout(function(){noSuperScript()},3e3)})}function nt(){$("#showAllFilter").click(function(){p(this);const n=$(".filterBy fieldset[data-category='brand'] .c-checkbox"),t=$(".filterBy fieldset[data-category='feature'] .c-checkbox"),i=$(".filterBy fieldset[data-category='price'] .c-checkbox"),r=n.splice(6),u=i.splice(6),f=t.splice(6);$(r).toggleClass("hideindesktop",2e3);$(f).toggleClass("hideindesktop",2e3);$(u).toggleClass("hideindesktop",2e3)})}function tt(){$(document.body).on("click",".awbCatalogCategory ul.c-menu li",function(){const s=window.location.href.toLowerCase(),t=$(this).parents(".awbCatalogCategory"),r=$(t).siblings(".load-more-btn").find(".showAllButton").attr("aria-expanded"),h=t.attr("data-header"),i=$(this).attr("id"),u=i!=undefined?i.split("-")[1]:"featured";vad.catalog.displayItems=n.find("input:checked").length==0?vad.catalog.allUniqueItems:vad.catalog.displayItems;switch(u){case"lowToHigh":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.lowToHigh);break;case"highToLow":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.highToLow);break;case"featured":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.featured);break;case"rating":vad.catalog.displayItems=vad.catalog.displayItems.sort(vad.catalog.sorts.rating)}r==="false"&&(vad.catalog.displayItems=vad.catalog.displayItems.slice(0,12));vad.catalog.skuArr=o();w(vad.catalog.skuArr,t);$("[data-category=primaryactivities]").find("input:checked").length==1&&(graybadgeValue.length=0,$(".gray-badge").removeClass("yellow-badge"),setTimeout(function(){var t;if($("[data-category=primaryactivities]").find("input:checked").length!=2)for(let u=0;u"+$(".compare-button-tile").attr("data-cmrslcnlinktext")+"<\/a>");n.length>=2?t.find("a.cmprselcnlink").removeClass("hide"):t.find("a.cmprselcnlink").addClass("hide")});$(".compare-checkbox:visible input").not(":checked").each(function(){var n=$(this).closest(".compare-checkbox");n.find("a.cmprselcnlink").remove()});typeof mwf!="undefined"&&mwf.ComponentFactory.create([{c:mwf.Tooltip,selector:"body .c-tooltip"}])}function rt(){n.find("input:checkbox").on("click",function(){var y,l,i,a,u;const c=$(this).prop("checked");if(c?vad.catalog.numFilters++:vad.catalog.numFilters--,c?$(this).attr("aria-checked","true"):$(this).attr("aria-checked","false"),$(this).attr("data-group")=="Brand"||$("[data-category=brand]").find("input:checked").length!=0||$(this).attr("data-group")=="Category"||$("[data-category=Category]").find("input:checked").length!=0||$(this).attr("data-group")=="price"||$("[data-category=price]").find("input:checked").length!=0?(st($(this).parents("fieldset").attr("data-category")),(n.find("input:checked").length==$("[data-category=brand]").find("input:checked").length||n.find("input:checked").length==$("[data-category=Category]").find("input:checked").length||n.find("input:checked").length==$("[data-category=price]").find("input:checked").length)&&(disabledList.length=0)):(n.find("input:checked").length==$("[data-category=brand]").find("input:checked").length||n.find("input:checked").length==$("[data-category=Category]").find("input:checked").length||n.find("input:checked").length==$("[data-category=price]").find("input:checked").length)&&(disabledList.length=0),$(this).attr("data-group")=="primaryactivities")if(y=$(this),l=$(this).parents("[data-category=primaryactivities]").find("input:checked"),l.length==1){for($(".deviceBadgeDual").show(),c?i=y.val():(i=l.val(),u=i,u=="family"||u=="work"||u=="school"?jQuery('.c-checkbox input[value="Hello"]').is(":checked")||(jQuery('.c-checkbox input[value="Hello"]').click(),$('.c-checkbox input[value="'+u+'"]').focus(),$("[data-category=primaryactivities]").find("input:not(:checked)").prop("disabled",!0),$("[data-category=primaryactivities]").find("input:checked").prop("disabled",!1)):(jQuery('.c-checkbox input[value="Hello"]').is(":checked")&&(jQuery('.c-checkbox input[value="Hello"]').prop("checked",!1),$("[data-criteria-value=Hello]").click()),$("[data-category=primaryactivities]").find("input:not(:checked)").prop("disabled",!0),$("[data-category=primaryactivities]").find("input:checked").prop("disabled",!1)),u=="family"||u=="work"||u=="school"?jQuery('.c-checkbox input[value="Touch"]').is(":checked")||(jQuery('.c-checkbox input[value="Touch"]').click(),$('.c-checkbox input[value="'+u+'"]').focus(),$("[data-category=primaryactivities]").find("input:not(:checked)").prop("disabled",!0),$("[data-category=primaryactivities]").find("input:checked").prop("disabled",!1)):(jQuery('.c-checkbox input[value="Touch"]').is(":checked")&&(jQuery('.c-checkbox input[value="Touch"]').prop("checked",!1),$("[data-criteria-value=Touch]").click()),$("[data-category=primaryactivities]").find("input:not(:checked)").prop("disabled",!0),$("[data-category=primaryactivities]").find("input:checked").prop("disabled",!1))),priorityActivity=i,a=0;a0?h():s();($(this).attr("data-group")=="Brand"||n.find("input:checked").length==$("[data-category=brand]").find("input:checked").length||$(this).attr("data-group")=="Category"||n.find("input:checked").length==$("[data-category=Category]").find("input:checked").length||$(this).attr("data-group")=="price"||n.find("input:checked").length==$("[data-category=price]").find("input:checked").length)&&at($(this).parents("fieldset").attr("data-category"));$("#filterSelections").attr("role","status").attr("aria-live","assertive");f();noSuperScript();c||n.find("input:checked").length==0&&(vad.catalog.displayItems=vad.catalog.allUniqueItems);ct();setTimeout(function(){if(n.find("input:checked:disabled").length>0)for(var t=0;tRemove "'+u+'"<\/span><\/a>