(function(){"use strict";window.StylesChecksApp={pageData:{},viewModels:{},utils:{updateViewModel:function(n,t,i){if($.isPlainObject(t)){$.isPlainObject(i)||(i={});var r=function(n){return ko.utils.arrayMap(StylesChecksApp.utils.objectKeys(n),function(n){return{key:n,cc:StylesChecksApp.utils.toCamelCase(n),lc:n.toLowerCase()}})},u=function(n,t){var i=StylesChecksApp.utils.toCamelCase(n),r=n.toLowerCase();return(ko.utils.arrayFirst(t,function(t){return t.key==n})||ko.utils.arrayFirst(t,function(n){return n.cc==i})||ko.utils.arrayFirst(t,function(n){return n.lc==r})||{}).key},f=r(n),e=r(i);return ko.utils.arrayForEach(StylesChecksApp.utils.objectKeys(t),function(r){var s=u(r,f),c=u(r,e),o=s?n[s]:null,h=t[r];(typeof o!="function"||ko.isWritableObservable(o))&&(c?i[c].call(n,o,s,h):s&&(ko.isWritableObservable(o)?o(h):o!=null&&typeof o=="object"&&typeof o.update=="function"?o.update(h):ko.isObservable(o)||(n[s]=h)))}),n}},objectKeys:function(n){var t=[];for(var i in n)n.hasOwnProperty(i)&&t.push(i);return t},toCamelCase:function(n){return(n||"").replace(/([A-Z]|^)([A-Z]+)/g,function(n,t,i){return t+i.toLowerCase()})},sortBy:function(n,t){if(n=ko.unwrap(n),$.isArray(n)){var i=1;return t[0]==="-"&&(i=-1,t=t.substr(1)),n.sort(function(n,r){var u=ko.unwrap(n[t]),f=ko.unwrap(r[t]),e=u<f?-1:u>f?1:0;return e*i})}},makeImageRenderUrl:function(n,t,i,r,u,f,e){return"/imagerender/?text={text}&font={font}&size={size}&textcase={textCase}&bold={bold}&maxwidth={maxWidth}&maxheight={maxHeight}".replace("{text}",encodeURIComponent(ko.unwrap(n)||"")).replace("{font}",ko.unwrap(t)).replace("{size}",ko.unwrap(i)).replace("{textCase}",ko.unwrap(r)).replace("{bold}",ko.unwrap(u)?"y":"n").replace("{maxWidth}",ko.unwrap(f)||"").replace("{maxHeight}",ko.unwrap(e)||"")},getMonogramLetterImageUrl:function(n,t){var i,u=$('input[name="__RequestVerificationToken"]').val(),r={};return r.__RequestVerificationToken=u,$.ajax({method:"POST",url:"/pz/get-monogram-image",data:{productCode:n,letter:t},headers:r,context:this,async:!1}).done(function(n){i=n}),i},resetValidation:function(n){var t=$(n);t.removeData("unobtrusiveValidation");t.validate().destroy();$.validator.unobtrusive.parse(n);t.find("[data-valmsg-summary=true]").removeClass("validation-summary-errors").addClass("validation-summary-valid").find("ul").empty();t.find("[data-valmsg-replace]").removeClass("field-validation-error").addClass("field-validation-valid").empty()},replaceAll:function(n,t,i){return(n||"").replace(new RegExp(t,"g"),i)},resetDataLayerObject:function(){dataLayer.push({ecommerce:null})},getMappedGA4Items:function(n,t){const i=[];return n.forEach(function(n,r){let f=0,u=0,e=null,o=null,s=n.quantity?n.quantity:1;n.selectedTier?(f=n.selectedTier.price,u=n.selectedTier.regularPrice):(f=n.price,u=n.regularPrice);!u&&f&&(u=f);n.type?e=n.type:n.productType&&(e=n.productType);n.subType?o=n.subType:n.productSubType&&(o=n.productSubType);i.push({item_id:n.productCode?n.productCode:null,item_name:n.name?n.name:n.description?n.description:null,affiliation:window.configurationData.affiliationGA4?window.configurationData.affiliationGA4:null,coupon:ko.unwrap(t.offer.offerApplied)?ko.unwrap(t.offer.keycode):null,currency:window.configurationData.defaultCurrency?window.configurationData.defaultCurrency:null,discount:!u||!f?0:u-f,index:r,item_brand:window.configurationData.brandGA4?window.configurationData.brandGA4:null,item_category:e,item_category2:o,item_category3:null,item_category4:null,item_category5:null,item_list_id:null,item_list_name:null,item_variant:null,location_id:window.configurationData.locationIdGA4?window.configurationData.locationIdGA4:null,price:!u||!s?0:u/s,quantity:n.quantity?n.quantity:1})}),i},fireGA4Event:function(n,t,i){try{const r=ko.toJS(t);if(!n||!r||r.length==0||!window.configurationData||!i)return;const f=StylesChecksApp.utils.getMappedGA4Items(r,i);StylesChecksApp.utils.resetDataLayerObject();let u={items:f};n==="view_cart"&&(u.currency=window.configurationData.defaultCurrency?window.configurationData.defaultCurrency:null,u.value=i.orderTotal.total());dataLayer.push({event:n,ecommerce:u})}catch(r){console.error("The tracking data for GA4 has been fallen. "+r)}},fireGA4PurchaseEvent:function(n,t,i,r){try{const u=ko.toJS(i);if(!u||!t||u.length==0||!window.configurationData||!r)return;const e=ko.unwrap(t.total),f=ko.unwrap(t.shippingAmount),o=ko.unwrap(t.taxAmount),s=ko.unwrap(n),h=StylesChecksApp.utils.getMappedGA4Items(u,r);StylesChecksApp.utils.resetDataLayerObject();dataLayer.push({event:"purchase",ecommerce:{transaction_id:s?s:null,value:e?e:0,tax:o?o:0,shipping:f&&typeof f!="string"?f:0,affiliation:window.configurationData.affiliationGA4?window.configurationData.affiliationGA4:null,coupon:ko.unwrap(r.offer.offerApplied)?ko.unwrap(r.offer.keycode):null,currency:window.configurationData.defaultCurrency?window.configurationData.defaultCurrency:null,items:h}})}catch(u){console.error("The tracking data for GA4 has been fallen. "+u)}},fireAdobeConfirmationEvent:function(n){const v=ko.unwrap(n.isCCPaymentMethod),y=ko.unwrap(n.isXSellItemsAdded),i=[{eventName:"purchase"}],r=ko.unwrap(n.orderTotal.shippingAmount),u=ko.unwrap(n.orderTotal.handlingAmount),s=ko.unwrap(n.orderTotal.taxAmount),h=ko.unwrap(n.orderTotal.subTotal),c=ko.unwrap(n.orderTotal.total),l=ko.unwrap(n.webOrderId);y&&i.push({eventName:"event60"});const f={profile:{shippingAddress:{stateProvince:ko.unwrap(n.shippingAddress.state),postalCode:ko.unwrap(n.shippingAddress.zip)}},details:{shippingMethod:ko.unwrap(n.selectedShippingMethodName),shippingAmt:r?r.toFixed(2).toString():"",handlingAmt:u?u.toFixed(2).toString():"",tax:s?s.toString():"",subTotal:h?h.toString():"",orderTotal:c?c.toString():"",paymentMethod:v===!1?"Secure Online Payment":"Credit Card"},purchase:{purchaseID:l?l.toString():null}},t=[],a=r+u;t.push({productInfo:{productID:"STYLESSHP"},price:{basePrice:a?a.toFixed(2).toString():"",quantity:"1"}});const e=ko.unwrap(n.lineItems);e&&e.length>0&&e.forEach(n=>{let i=0,r=0,o=ko.unwrap(n.quantity);o||(o=1);ko.unwrap(n.selectedTier)?(i=ko.unwrap(n.selectedTier).price,r=ko.unwrap(n.selectedTier).regularPrice):(i=ko.unwrap(n.total),r=ko.unwrap(n.regularTotal));!r&&i&&(r=i);let s=ko.unwrap(n.quantity);const u=!r||!i?0:r-i;t.push({productInfo:{productID:ko.unwrap(n.productCode)},price:{basePrice:r?r.toFixed(2).toString():"",quantity:s?s.toString():"1",discount:u&&u!=0?u.toFixed(2).toString():"",discountBasePrice:u&&u!=0&&i?i.toFixed(2).toString():""}});const f=ko.unwrap(n.services);f&&f.length>0&&f.forEach(n=>{const r=ko.unwrap(n.price),u=ko.unwrap(n.regularPrice),i=!u||!r?0:u-r;t.push({productInfo:{productID:ko.unwrap(n.productCode)},price:{basePrice:u?u.toFixed(2).toString():"",quantity:"1",discount:i&&i!=0?i.toFixed(2).toString():"",discountBasePrice:i&&i!=0&&r?r.toFixed(2).toString():""}})});const e=ko.unwrap(n.enhancements);e&&e.length>0&&e.forEach(n=>{const r=ko.unwrap(n.type);if(!r||r!="IL"&&r!="PL"&&r!="PR"){const u=ko.unwrap(n.price),f=ko.unwrap(n.regularPrice),i=!f||!u?0:f-u;t.push({productInfo:{productID:ko.unwrap(n.productCode)},price:{basePrice:f?f.toFixed(2).toString():"",quantity:"1",discount:i&&i!=0?i.toFixed(2).toString():"",discountBasePrice:i&&i!=0&&u?u.toFixed(2).toString():""}})}})});const o=ko.unwrap(n.services);if(o&&o.length>0&&o.forEach(n=>{const r=ko.unwrap(n.price),u=ko.unwrap(n.regularPrice),i=!u||!r?0:u-r;t.push({productInfo:{productID:ko.unwrap(n.productCode)},price:{basePrice:u?u.toFixed(2).toString():"",quantity:"1",discount:i&&i!=0?i.toFixed(2).toString():"",discountBasePrice:i&&i!=0&&r?r.toFixed(2).toString():""}})}),ko.unwrap(n.offer.offerApplied)){const r=ko.unwrap(n.offer.keycode),t=ko.unwrap(n.orderTotal.saved),u=t?"event82="+t.toFixed(2).toString():"event82=0";i.push({eventName:u});f.details.promotionalCode=r?r.toString():null;f.details.promotionalDiscount=t?t.toFixed(2).toString():""}digitalData.events=i;digitalData.transaction=f;digitalData.lineItems=t}},monogramLetters:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]}})()