"use strict";define(["jquery","handlebars","fndCommon","hqvAccounting","fndLoadLazyImages"],function($,i,t,e,r){$(document).ready(function(){var n=n||{};!function(n){function s(t){$("#wishlistPrintItem").html()&&(P=i.compile($("#wishlistPrintItem").html())),p&&p.length>0&&f.html(p(t))}function a(i){var r=i.replace(/[^0-9.,]/g,"");return e.unformat(r,t.decimalSeparator)}function o(i){var r;switch(t.currencyPlace){case"0":r="%s%v";break;case"1":r="%v%s";break;case"2":r="%s %v";break;case"3":r="%v %s";break;default:r=""}return e.formatMoney(i,{symbol:t.currency,format:r,decimal:t.decimalSeparator,thousand:t.thousandSeparator,precision:t.decimalNumber})}function c(){var e,r=0;if(v.length>0){S=!1;for(var n=0;n<v.length;n+=1)""!==v[n].Price&&!1!==v[n].Price&&null!==v[n].Price&&void 0!==v[n].Price||(v[n].Price="$0.00"),e=a(v[n].Price),r+=e*v[n].Quantity,b+=Number(v[n].Quantity),"False"===v[n].ShowPrice&&(S=!0);I={NumberOfItems:b,Price:!1===S?o(r,v[0].Price):"",ShowPrice:!1===S?"True":"False"},t.IsEComProfile&&(I={NumberOfItems:b,Price:y[0].TotalNetPrice,ShowPrice:!1===S?"True":"False"})}$("#wishListPagePrintSummary").html()&&(w=i.compile($("#wishListPagePrintSummary").html())),u&&u.length>0&&h.html(u(I)),window.dataLayer.push({event:"wishlist",wishlist:{action:"print-wishlist",numberOfProducts:b}}),b=0}function l(){var i={UserId:window.userId,currentMarketId:t.CurrentMarketId,currentMarketLanguage:t.LanguageName};t.IsEComProfile?$.getJSON("/ws/fnd/ecomproductws/GetCart",i).done(function(i){y=t.getJsonFromService(i),v=y[0].ProductInformations;for(var e=v,r=0;r<e.length;r+=1){var n='<div class="product-price"><span class="price">'+v[r].TotalNetPrice+"</span> </div>";e[r].PriceHtml=n;var a=v[r].Image;e[r].Image=a;var o=v[r].TotalNetPrice;e[r].SubTotal=o,v[r]=e[r]}s(v),c(),m(),$("body").hasClass("device-xs")||$("#wishlist-print-modal").find(".list-of-items li .image").height($("#wishlist-print-modal").find(".list-of-items li").outerHeight())}).fail(function(){}):$.getJSON("/ws/fnd/ecomproductws/GetProductsFromWishlist",i).done(function(i){v=i,s(v),c(),m(),$("body").hasClass("device-xs")||$("#wishlist-print-modal").find(".list-of-items li .image").height($("#wishlist-print-modal").find(".list-of-items li").outerHeight())}).fail(function(){})}function m(){r($(".modal-wishlist"));var i=new $('link[rel="stylesheet"]').clone(),t=d.find("#wishlist-page").clone();$(t).find("img").each(function(){$(this).attr("src",$(this).attr("srcset")),$(this).removeAttr("srcset")}),t.find("script").length>0&&$(t).find("script").each(function(){$(this).remove()});var e=window.open("","printFrame");$(e).ready(function(){var r=e.document;r.open(),r.write("<!DOCTYPE HTML"),r.write("<html>"),r.write("<head>"),r.write('<meta name="viewport" content="width=900, initial-scale=1">'),i.each(function(){r.write($(this).get(0).outerHTML)}),r.write("</head>"),r.write("<body>"),r.write('<div class="col-xs-12">'),r.write('<section id="wishlist-print-modal">'),r.write('<section id="wishlist-page" class="row">'),r.write($(t).html()),r.write("</section>"),r.write("</section>"),r.write("</div>"),r.write("<script>"),r.write("window.onload = function(event) {"),r.write('if (navigator.userAgent.indexOf("Firefox") != -1) {'),r.write("window.print();"),r.write("}  else {"),r.write('window.document.execCommand("print", false, null);'),r.write("}};"),r.write("<\/script>"),r.write("</body>"),r.write("</html>"),r.close(),e.focus()})}var d=$(".c-hqv-wishlist-page-print"),h=d.find("#wishListPagePrintSummaryContainer"),u=d.find("#wishListPagePrintSummary"),w=u.html(),f=d.find("#wishlistPrintItemContainer"),p=d.find("#wishlistPrintItem"),P=p.html(),g=$(".wishlist-utility"),v,y,b=0,I={NumberOfItems:"0",Price:"",ShowPrice:"False"},S=!1;P&&(p=i.compile(P)),w&&(u=i.compile(w)),n.init=function(){$(d).ready(function(){var i=g.find(".openPrint");i&&i.length>0&&i.on("click",function(){l()})})}}(n),$(n.init)})});