1fa4a8fccfca606292580d3fa6ce1b60b6778b16f7adaba22a5f44b4121bc907

Source Code:

(function(k){var n=window.AmazonUIPageJS||window.P,q=n._namespace||n.attributeErrors,d=q?q("AmazonDevicesDetailPageUtilityAssets",""):n;d.guardFatal?d.guardFatal(k)(d,window):d.execute(function(){k(d,window)})})(function(k,n,q){k.when("A").execute(function(d){d.declarative("popup-window","click",function(c){var a=c.data.windowName||"popupWindow",b=c.data.windowOptions||"width\x3d600,height\x3d400,scrollbars\x3dyes";c.$event.preventDefault();n.open(c.$target.prop("href"),a,b)})});"use strict";k.when("A").register("ods-element-factory",
function(d){var c=d.$;return{getHiddenInput:function(a,b){return c("\x3cinput\x3e").prop("name",a).prop("type","hidden").prop("value",b)}}});"use strict";k.register("ods-url-utils",function(){return{getUrlParam:function(d){for(var c=null,a=n.location.search.substr(1).split("\x26"),b=0;b<a.length;b++){var g=a[b].split("\x3d");g[0]===d&&(c=g[1])}return c}}});"use strict";k.when("A").register("csmCounter",function(d){var c=d.$;return{register:function(a,b,g){a&&b&&g&&c(a).bind(b,c.proxy(this.increment,
this,g))},increment:function(a){a&&n.ue.count(a,(n.ue.count(a)||0)+1)},update:function(a,b){a&&"number"===typeof b&&n.ue.count(a,b)}}});"use strict";k.register("function-utils",function(){return{throttle:function(d,c,a){var b,g,f,h=null,e=0;a||(a={});var m=function(){e=!1===a.leading?0:(new Date).getTime();h=null;f=d.apply(b,g);h||(b=g=null)};return function(){var l=(new Date).getTime();e||!1!==a.leading||(e=l);var p=c-(l-e);b=this;g=arguments;0>=p||p>c?(h&&(clearTimeout(h),h=null),e=l,f=d.apply(b,
g),h||(b=g=null)):h||!1===a.trailing||(h=setTimeout(m,p));return f}},debounce:function(d,c,a){var b;return function(){var g=this,f=arguments;clearTimeout(b);b=setTimeout(function(){b=null;a||d.apply(g,f)},c);a&&!b&&d.apply(g,f)}},memoize:function(d,c){var a={};return function(){for(var b=0<arguments.length?"":"%NO_ARGUMENTS%",g=0;g<arguments.length;g++)b&&(b+="-"),b+="object"===typeof arguments[g]?JSON.stringify(arguments[g]):arguments[g];a.hasOwnProperty(b)||(a[b]=c.apply(d,arguments));return a[b]}}}});
"use strict";k.when("A").register("odsRefTagUtils",function(d){var c=d.$;return{send:function(a,b){if(!a)throw Error("refTag is not defined");c.get((b||"/gp/product/ajax-handlers/reftag.html")+"/ref\x3d"+a)}}});"use strict";k.when("A").register("ods-image-utilities",function(d){function c(b,a){var f=new Image;f.onload=function(){a.resolve(b)};f.onerror=function(){a.reject(b)};f.src=b}var a=d.$;return{preloadImage:function(b,g){var f=a.Deferred(),h;c(b,f);g&&d.capabilities.hires&&(h=a.Deferred(),c(g,
h));return{image:f.promise(),hiResImage:h?h.promise():q}},preloadImages:function(b){for(var g=[],f=0;f<b.length;f++){var h=a.Deferred();c(b[f],h);g.push(h.promise())}return g}}});"use strict";k.when("A").register("ODSEventDispatcher",function(d){return d.createClass({init:function(){this._callbacks={}},registerCallback:function(c,a){var b=this._callbacks[c]||[];-1===b.indexOf(a)&&b.push(a);this._callbacks[c]=b},unregisterCallback:function(c,a){if(c=this._callbacks[c])a=c.indexOf(a),-1<a&&c.splice(a,
1)},dispatch:function(c){var a=this._callbacks[c];if(a)for(var b=0;b<a.length;b++)a[b].apply(this,Array.prototype.slice.call(arguments,1))}})});"use strict";k.when("A","jQuery").register("BuyboxManagerFactory",function(d,c){function a(b,a,h,e){var m=d.copy(h);c.each(m,function(d){-1===["initialize","reset"].indexOf(d)&&(b[d]=e?c.proxy(a,null,d):c.proxy(h,d))})}function b(b,f,h,e){var d=function(r){if(!p&&(e?(e.initialize(),a(l,d,e,!1)):k=new h,p=new f(k),c.each(b,function(b,a){l[a]=c.proxy(p,a)}),
"string"===typeof r))return l[r].apply(p,Array.prototype.slice.call(arguments,1))},l={reset:function(){p?(e&&e.reset(),k&&k.reset(),p.reset()):d()},initialize:d},p,k;e&&a(l,d,e,!0);c.each(b,function(b,a){l[a]=c.proxy(d,null,a)});return l}return{create:function(a,f,h){return b(a,f,h)},extend:function(a,f,h){return b(a,f,null,h)}}});"use strict";k.when("jQuery","BuyboxManagerViewHelper").register("BuyboxManagerFormHelper",function(d,c){function a(b,a){return'\x3cinput type\x3d"hidden" name\x3d"'+b+
'" value\x3d"'+a+'" /\x3e'}function b(b){return 0<=b.attr("id").search("buyNow")}function g(b){return 0<=b.attr("id").search("addToCart")||0<=b.attr("id").search("mobile-installments")}function f(b,a){return d.map(b,function(b){return d(b).attr(a)})}'input[name\x3d"%NAME%"]'.replace("%NAME%","verificationSessionID");var h='input[name\x3d"%NAME%"]'.replace("%NAME%","a"),e='input[name\x3d"%NAME%"]'.replace("%NAME%","oid"),m='input[name\x3d"%NAME%"]'.replace("%NAME%","quantity"),l='input[name\x3d"%NAME%"]'.replace("%NAME%",
"asin"),k='input[name\x3d"%NAME%"]'.replace("%NAME%","offeringID"),u='input[name\x3d"%NAME%"]'.replace("%NAME%","quantity"),r=[h,e,m].concat([l,k,u]).join(", ");return{removeAllFormFields:function(b){b.find(r).remove()},getHiddenInputHTML:a,isFormBuyNow:b,isFormAddToCart:g,createMobileAppFormInputs:function(b){var f=b[0],h,g,e;f&&(h=f.asin,g=f.offerId,e=f.quantity);for(f=1;f<b.length;f++)h+="|"+b[f].asin,g+="|"+b[f].offerId,e+="|"+b[f].quantity;return""+(a("asin",h)+a("offeringID",g)+a("quantity",
e))},getViewData:function(a){if(b(a)){var d=f(a.find(l),"value")[0].split("|"),t=f(a.find(k),"value")[0].split("|");a=f(a.find(u),"value")[0].split("|");return c.buildRawData(d,t,a)}if(g(a))return d=f(a.find(h),"value"),t=f(a.find(e),"value"),a=f(a.find(m),"value"),c.buildRawData(d,t,a);throw Error("Add to order button not handled in buyBoxManagerFormHelper");},updateMobileAppFormInputsWithSubscriptionData:function(b,f,h){if(!d.isEmptyObject(b._digitalSubscriptionAsinMap)){var g=[],e=b._digitalSubscriptionAsinMap,
c;for(c in e)if(e.hasOwnProperty(c)){var m=e[c],l=m.name,m=m.value;g.push('input[name\x3d"%NAME%"]'.replace("%NAME%",l));g.push('input[name\x3d"%NAME%"]'.replace("%NAME%",m));delete e[c]}l=g.join(",");h.find(l).remove();b._digitalSubscriptionAsinMap=e}h="";for(e=1;e<f.length;e++)f[e].customAttribute&&(l="custom-name.%INDEX.1".replace("%INDEX",e),m="custom-value.%INDEX.1".replace("%INDEX",e),g=f[e],h+=a(l,g.customAttribute.name)+a(m,g.customAttribute.value),b._digitalSubscriptionAsinMap||(b._digitalSubscriptionAsinMap=
{}),b._digitalSubscriptionAsinMap[g.asin]={index:e,name:l,value:m});return h}}});"use strict";k.when("A","jQuery","BuyboxManagerViewBase").register("BuyboxManagerView",function(d,c,a){return a.extend({init:function(){this._super()},moveFieldsToContainer:function(b,a){for(var f=1,h=[],e;e===q||0<e.length;)e=b.find(this.getHiddenSelector("ASIN."+f)),0<e.length&&h.push(e.get(0),b.find(this.getHiddenSelector("offerListingID."+f)).get(0),b.find(this.getHiddenSelector("quantity."+f)).get(0)),f++;a.append(h)},
render:function(b){this._super(b);var a=this;this.$forms.each(function(f){var h=c(this),e=h.find('input[type\x3d"hidden"][name^\x3d"ASIN."]'),d=c.isArray(b)?b.length:0,l=a.$fieldsContainers.get(f);e.each(function(){var b=c(this);if(!b.parent().is(l)){var f=a._getAsinIndex(b);d++;b.prop("name","ASIN."+d);h.find('input[type\x3d"hidden"][name\x3d"offerListingID.'+f+'"]').prop("name","offerListingID."+d);h.find('input[type\x3d"hidden"][name\x3d"quantity.'+f+'"]').prop("name","quantity."+d)}})})},buildHTML:function(b,
a){return this.getHiddenInputHTML("ASIN."+a,b.asin)+this.getHiddenInputHTML("offerListingID."+a,b.offerId)+this.getHiddenInputHTML("quantity."+a,b.quantity)},getDataFromDOM:function(){var b=[],a=this.$fieldsContainers.first(),f=this;a.find('input[type\x3d"hidden"][name^\x3d"ASIN."]').each(function(){var h=c(this),e=f._getAsinIndex(h);b.push({asin:h.val(),offerId:a.find(f.getHiddenSelector("offerListingID."+e)).val(),quantity:parseInt(a.find(f.getHiddenSelector("quantity."+e)).val(),10)})});return b},
_getAsinIndex:function(b){return parseInt(b.prop("name").substring(5),10)}})});"use strict";k.when("A","jQuery").register("BuyboxManagerViewBase",function(d,c){return d.createClass({init:function(){this.reset()},registerAtcBtn:function(a){this.$atcBtns=this.$atcBtns.add(a)},registerForm:function(a){a="string"===typeof a?c(a):a;if(a instanceof c&&0<a.length&&0===this.$forms.has(a).length){this.$forms=this.$forms.add(a);var b=this.createFieldsContainer(a);this.moveFieldsToContainer(a,b)}},createFieldsContainer:function(a){var b=
a.find(".buyboxManagerHiddenFieldsContainer");0===b.length&&(b=c('\x3cdiv class\x3d"buyboxManagerHiddenFieldsContainer"\x3e'),a.append(b));0===this.$fieldsContainers.has(b).length&&(this.$fieldsContainers=this.$fieldsContainers.add(b));return b.first()},moveFieldsToContainer:function(a,b){throw Error("The view must override the moveFieldsToContainer function");},getHiddenSelector:function(a,b){var g='input[type\x3d"hidden"]';"string"===typeof a&&(g+='[name\x3d"'+a+'"]');"string"===typeof b&&(g+='[value\x3d"'+
b+'"]');return g},getHiddenInputHTML:function(a,b){return'\x3cinput type\x3d"hidden" name\x3d"'+a+'" value\x3d"'+b+'" /\x3e'},render:function(a){this.appendFormData(a)},appendFormData:function(a,b){b=b||1;var g="";if(c.isArray(a))for(var f=0;f<a.length;f++)g+=this.buildHTML(a[f],b+f);this.$fieldsContainers.html(g)},reset:function(){this.$forms=c();this.$fieldsContainers=c();this.registerForm(c("#addToCart"));c("#mobile-installments")&&this.registerForm(c("#mobile-installments"));this.$atcBtns=c();
this.registerAtcBtn(c("#add-to-cart-button"));this.registerAtcBtn(c("#bb_to_cfg_button"));this.registerAtcBtn(c("#buy-now-button"));c("#installments-button").length&&this.registerAtcBtn(c("#installments-button"))}})});"use strict";k.when("jQuery").register("BuyboxManagerViewHelper",function(d){var c={FORM:"form",AW_MASH:"aw_mash",SHOW_HCTP_ATTACH:"show-hctp-attach",UNKNOWN:q};return{ViewType:c,getAtcBtnViewType:function(a){var b=c.UNKNOWN;a instanceof d||(a=d(a));var g=a.closest('.a-declarative[data-action\x3d"aw-mash"]'),
f=a.closest('.a-declarative[data-action\x3d"show-hctp-attach"]');return 0<g.length?c.AW_MASH:0<a.closest("form").length?c.FORM:0<f.length?c.SHOW_HCTP_ATTACH:b},buildRawData:function(a,b,g){var f={},h=[];d.each(a,function(a,c){var d=b.length>a?b[a]:"";a=g.length>a?parseInt(g[a],10):1;var k=c+":"+d;f.hasOwnProperty(k)?h[f[k]].quantity+=a:f[k]=h.push({asin:c,offerId:d,quantity:a})-1});return h}}});"use strict";k.when("A","jQuery","ODSEventDispatcher","ods-url-utils","BuyboxManagerViewBase").register("BuyboxManagerController",
function(d,c,a,b,g){return d.createClass({init:function(b){if(!(b instanceof g))throw new TypeError("The view must inherits from BuyboxManagerViewBase");this._view=b;this._eventDispatcher=new a;this._enableEvents(!0);this.reset();var h=this;d.on("a:dropdown:mobileQuantityDropDown:select",function(b){h.setPageAsinQuantity(parseInt(b.value,10))});this._isFreeFormQuantityPickerPresent()&&this._makeAwareOfFreeFormQuantity()},_enableEvents:function(b){c.each("UpsellAsinAdded UpsellAsinRemoved UpsellAsinChanged PageAsinAdded PageAsinReplaced PageAsinChanged".split(" "),
c.proxy(function(a,e){b?(this["register"+e]=c.proxy(this._eventDispatcher,"registerCallback",e),this["unregister"+e]=c.proxy(this._eventDispatcher,"unregisterCallback",e)):(delete this["register"+e],delete this["unregister"+e])},this))},_parseInitialAsins:function(){var b=this._view.getDataFromDOM();if(b)for(var a=0;a<b.length;a++)this[0===a?"setPageAsin":"setUpsellAsin"](b[a].asin,b[a].offerId,b[a].quantity)},_dispatchSetUpsellAsinEvents:function(b,a,e,c){c!==e&&(0===c&&0<e?this._eventDispatcher.dispatch("UpsellAsinAdded",
b,a,e,c):0===e&&0<c&&this._eventDispatcher.dispatch("UpsellAsinRemoved",b,a,e,c),this._eventDispatcher.dispatch("UpsellAsinChanged",b,a,e,c))},_indexOfAsin:function(b,a){a=a||"";for(var e=0;e<this._asinsData.length;e++)if(this._asinsData[e].asin===b&&this._asinsData[e].offerId===a)return e;return-1},_isFreeFormQuantityPickerPresent:function(){return 0<c('select[id$\x3d"-predefinedQuantitiesDropdown"]').length},_makeAwareOfFreeFormQuantity:function(){var a=this;d.on("buyBoxQuantityChanged",function(b,
c){a.setPageAsinQuantity(c)});var c=parseInt(b.getUrlParam("qty"),10);c&&a.setPageAsinQuantity(c)},setUpsellAsin:function(b,a,c,g){if("string"!==typeof b||0>=b.length)throw new TypeError("The asin argument is required");var d=this._indexOfAsin(b,a),k=0;a=a||"";c="number"===typeof c?Math.max(0,c):1;if(0===d)throw Error("To modify the pageAsin, use setPageAsin() instead.");if(0<d)g=this._asinsData[d],k=g.quantity,0>=c?this._asinsData.splice(d,1):g.quantity=c;else if(0<c)this._asinsData.push({asin:b,
offerId:a,quantity:c,customAttribute:g});else return!1;this.render();this._dispatchSetUpsellAsinEvents(b,a,c,k,d);return!0},registerForm:function(b){this._view.registerForm(b);this.render()},registerAtcBtn:function(b){this._view.registerAtcBtn(b);this.render()},setPageAsin:function(b,a,c){if("string"!==typeof b||0>=b.length)throw new TypeError("The asin argument is required");var g=this._indexOfAsin(b,a),d=0<this._asinsData.length?this._asinsData[0].quantity:0;a=a||"";if(0>=c)throw new TypeError("The quantity of the page asin must be \x3e 0.");
c="number"===typeof c?Math.max(1,c):1;if(0===g&&c===d)return!1;0<g&&this.setUpsellAsin(b,a,0);this._asinsData[0]={asin:b,offerId:a,quantity:c};this.render();-1<g?this._eventDispatcher.dispatch("PageAsinReplaced",b,a,c,d):this._eventDispatcher.dispatch("PageAsinAdded",b,a,c);this._eventDispatcher.dispatch("PageAsinChanged",b,a,c);return!0},setPageAsinQuantity:function(b){var a=this._asinsData&&this._asinsData.length&&this._asinsData[0];a&&this.setPageAsin(a.asin,a.offerId,b)},addUpsellAsin:function(b,
a,c){c=c||1;for(var g=0;g<this._asinsData.length;g++){var d=this._asinsData[g];if(d.asin===b){this.setUpsellAsin(b,a,d.quantity+c);return}}this.setUpsellAsin(b,a,c)},render:function(){this._view.render(this._asinsData)},getAsins:function(){return d.copy(this._asinsData)},getUpsellAsins:function(){var b=this.getAsins();b.splice(0,1);return b},resetUpsellAsins:function(){this._asinsData=[this._asinsData[0]];return d.copy(this._asinsData)},getPageAsin:function(){return d.copy(this._asinsData[0])},reset:function(){this._asinsData=
[];this._parseInitialAsins()}})});"use strict";k.when("BuyboxManagerController","BuyboxManagerView","BuyboxManagerFactory","jQuery").register("BuyboxManager",function(d,c,a,b){return a.create("getAsins getUpsellAsins setUpsellAsin resetUpsellAsins getPageAsin setPageAsin registerUpsellAsinChanged registerUpsellAsinAdded registerUpsellAsinRemoved registerPageAsinChanged registerPageAsinAdded registerPageAsinReplaced unregisterUpsellAsinChanged unregisterUpsellAsinRemoved unregisterUpsellAsinAdded unregisterPageAsinChanged unregisterPageAsinAdded unregisterPageAsinReplaced addUpsellAsin registerForm registerAtcBtn".split(" "),
d,c)});"use strict";k.when("jQuery","BuyboxManagerViewHelper").register("BuyboxManagerMashHelper",function(d,c){return{createInputs:function(a){var b={a:[],oid:[],quantity:[]};d.each(a,function(a,c){b.a.push(c.asin);b.oid.push(c.offerId);b.quantity.push(c.quantity)});b.a=b.a.join("|");b.oid=b.oid.join("|");b.quantity=b.quantity.join("|");return b},getViewData:function(a){var b=a.inputs.a.split("|"),g=a.inputs.oid.split("|");a=a.inputs.quantity.split("|");return c.buildRawData(b,g,a)},setDeclarativeMultiple:function(a){a.buttonID=
"add-multiple-to-cart"},getDeclarativeDataFromBtn:function(a){return a.closest('.a-declarative[data-action\x3d"aw-mash"]').data("awMash")},isAddToCart:function(a){return"add-to-cart"===a.buttonID},updateInputWithSubscriptionData:function(a,b,c){if(!d.isEmptyObject(a._digitalSubscriptionAsinMap)){var f=a._digitalSubscriptionAsinMap,h;for(h in f)if(f.hasOwnProperty(h)){var e=f[h],k=e.index;if(c.length<=k||c[k].asin!==h)b[e.name]&&delete b[e.name],b[e.value]&&delete b[e.value],delete f[h]}a._digitalSubscriptionAsinMap=
f}d.each(c,function(c,g){if(g.customAttribute){var d="custom-name."+(c+1)+".1",f="custom-value."+(c+1)+".1";b[d]=g.customAttribute.name;b[f]=g.customAttribute.value;a._digitalSubscriptionAsinMap||(a._digitalSubscriptionAsinMap={});a._digitalSubscriptionAsinMap[g.asin]={index:c,name:d,value:f}}})}}});"use strict";k.when("ODSBuyboxManagerController","BuyboxManager","BuyboxManagerFactory","A","jQuery").register("ODSBuyboxManager",function(d,c,a,b,g){return a.extend(["addMetadata","getMetadata","getAsins",
"getPageAsin","getUpsellAsins"],d,c)});"use strict";k.when("BuyboxManager","ODSBuyboxAsinMetadata","A","jQuery").register("ODSBuyboxManagerController",function(d,c,a,b){return a.createClass({init:function(){this.reset()},addMetadata:function(b){if(!(b instanceof c))throw Error("The argument metadata must be an instance of ODSBuyboxAsinMetadata");if(!b.isValid())throw Error("The metadata is NOT valid");this._metadatas[b.asin+":"+b.offerId]=b.clone()},getMetadata:function(b,a){return this._metadatas[b+
":"+a]},getMetadatas:function(){return a.copy(this._metadatas)},enhanceAsinsData:function(a){if("undefined"!==typeof a&&null!==a&&0!==a.length){var c=this;b.isArray(a)?a=b.map(a,function(a){return b.extend({},a,{metadata:c.getMetadata(a.asin,a.offerId)})}):a.metadata=c.getMetadata(a.asin,a.offerId)}return a},getPageAsin:function(){return this.enhanceAsinsData(d.getPageAsin())},getUpsellAsins:function(){return this.enhanceAsinsData(d.getUpsellAsins())},getAsins:function(){return this.enhanceAsinsData(d.getAsins())},
reset:function(){this._metadatas={}}})});"use strict";k.when("A","jQuery").register("ODSBuyboxAsinMetadata",function(d,c){var a=d.createClass({init:function(b,a,c,d,e,k,l){this.asin=b;this.offerId=a;this.buyingPrice=c;this.listingPrice=d;this.title=e;this.imageUrl=k;this.availabilityMessage=l},isValid:function(){var b="string"===typeof this.asin&&0<this.asin.length;return"number"===typeof this.buyingPrice&&b},clone:function(){return new a(this.asin,this.offerId,this.buyingPrice,this.listingPrice,
this.title)}});return a});"use strict";k.when("A","jQuery","a-modal").register("singleton-popup-modal",function(d,c,a){function b(b){null===e?(h=f.appendTo(c("body")),e=a.create(h,b)):e.update(b);e.show()}function g(){e&&e.hide()}var f=c('\x3cdiv style\x3d"display:none"\x3e'),h=null,e=null;d.declarative("cfg-singleton-modal-close","click",g);d.declarative("cfg-singleton-modal-open","click",function(a){b({inlineContent:a.data.inlineContent,header:a.data.header,width:a.data.width||"502",position:"triggerRight"},
!0)});return{show:b,hide:g,destroy:function(){e&&(a.remove(e),e=null)}}});"use strict";k.when("A").register("MakoCommonCartHelper",function(d){var c=d.$,a=d.createClass({init:function(b,a,c,d){this.sessionId=b||"";this.clientName=a||"";this.asinsData=c||[];this.additionalData=d||{};this.reftag;this.hasBeenPosted=!1},setSessionId:function(b){this.sessionId=b;return this},setClientName:function(b){this.clientName=b;return this},setAsinsData:function(b){if(Array.isArray(b))return this.asinsData=b,this},
addAsinData:function(b,a,c){this.asinsData.push({asin:b,offerId:a,quantity:c});return this},setAdditionalData:function(a){this.additionalData=a;return this},setReftag:function(a){this.reftag=a;return this},sendRequest:function(){if(this.hasBeenPosted)k.log("Request has already been sent.","WARN");else if(this._verifyRequest()){var a=this._buildRequestData();this.hasBeenPosted=!0;a=c.ajax({url:"/gp/add-to-cart/json/"+(this.reftag?"ref\x3d"+this.reftag:""),type:"POST",data:a});a.done(function(a){d.trigger("mako:common-cart-request:complete",
a)});return a}},_verifyRequest:function(){var a=!0;this.sessionId&&""!==this.sessionId||(a=!1,k.log("SessionId is undefined or blank","WARN"));this.asinsData&&this.asinsData.length||(a=!1,k.log("No asins data exist for cart handler request","WARN"));return a},_buildRequestData:function(){var a={};a.verificationSessionID=this.sessionId;a.clientName=this.clientName;for(var c=0;c<this.asinsData.length;c++){var d=this.asinsData[c];a["asin."+c]=d.asin;a["offeringID."+c]=d.offerId||d.offerListingID;a["quantity."+
c]=d.quantity}if(this.additionalData)for(var h in this.additionalData)this.additionalData.hasOwnProperty(h)&&(a[h]=this.additionalData[h]);return a}});return{createRequest:function(b,c){return new a(b,c)}}});"use strict";k.when().register("ExtraDataHelper",function(){function d(a,b){return a&&a.name&&0===a.name.indexOf(b)}function c(a,b){var c=Array.prototype.slice.call(a.elements);a=c.filter(function(a){return a&&a.tagName&&"input"===a.tagName.toLowerCase()&&d(a,["custom-name",b,""].join("."))});
c=c.filter(function(a){return a&&a.tagName&&"input"===a.tagName.toLowerCase()&&d(a,["custom-value",b,""].join("."))});return{names:a,values:c}}function a(a,b){return a!==q&&null!==a?a:b}function b(b,c,d){c=a(c,"([0-9]+)");d=a(d,"([0-9]+)");return new RegExp([b,c,d].join("."))}function g(a,b){var c=document.createElement("input");c.type="hidden";c.name=a;c.value=b;return c}function f(a,c,d,e){var f=b("custom-name",a);return c.reduce(function(b,c){var g=f.exec(c);if(g){var g=g[1],h=["custom-value",
a,g].join(".");b[g]={name:d(c),value:e(h)}}return b},{})}function h(a,b,c,d){Object.keys(b).forEach(function(e){var g=b[e],f=["custom-name",a,e].join(".");e=["custom-value",a,e].join(".");"object"===typeof g&&(c(f,g.name),d(e,g.value))})}function e(a,b){var c=Object.keys(a),d=function(b){return a[b]};return f(b,c,d,d)}function k(a,b,c){var d=function(b,c){a[b]=c};h(c,b,d,d)}function l(a,b){a=c(a,b);var d=a.names.map(function(a){return a.name}),e=function(a){return function(b){var c=a.filter(function(a){return a.name===
b});return c.length?c[0].value:q}};return f(b,d,e(a.names),e(a.values))}function p(a,b,d){var e=c(a,d),f=function(b){return function(c,d){var e=b.filter(function(a){return a.name===c});e.length?e.forEach(function(a){a.value=d}):a.appendChild(g(c,d))}};h(d,b,f(e.names),f(e.values))}function n(a){return Object.keys(a).reduce(function(b,c){c=a[c];b[c.name]=c.value;return b},{})}function r(a,b){var c=Object.keys(a).reduce(function(b,c){c=a[c];b[c.name]=c;return b},{});Object.keys(b).forEach(function(d){if(c[d])c[d].value=
b[d];else{var e=w(a),f={name:d,value:b[d]};a[e]=f;c[d]=f}});return a}function v(a,b){return a-b}function w(a){a=Object.keys(a).map(function(a){return parseInt(a)}).sort(v);if(a.length){if(1!==a[0])return 1;for(var b=1;b<a.length;b++)if(1!==a[b]-a[b-1])return a[b-1]+1;return a.length+1}return 1}return{getObjectExtraData:function(b,c){c=a(c,1);return n(e(b,c))},setObjectExtraData:function(b,c,d){d=a(d,1);c=r(e(b,d),c);k(b,c,d)},getFormExtraData:function(b,c){if(!b)return{};c=a(c,1);return n(l(b,c))},
setFormExtraData:function(b,c,d){b&&(d=a(d,1),c=r(l(b,d),c),p(b,c,d))}}})});
/* ******** */
(function(e){var h=window.AmazonUIPageJS||window.P,m=h._namespace||h.attributeErrors,a=m?m("AmazonDevicesDetailPageCommonAssets",""):h;a.guardFatal?a.guardFatal(e)(a,window):a.execute(function(){e(a,window)})})(function(e,h,m){e.when("A","csmCounter","jQuery","ready").register("dash-retail-selection",function(a,g){function d(c){var a=t.val().trim();if(0===a.length)return e(c),!1;y.show();b();a=D(a,u);0<a?(z.hide(),a<=A&&(q.hide(),r.hide())):(z.show(),q.hide(),r.hide());if(13===c.which)return t.blur(),
!1}function c(){E("atf");a.objectIsEmpty(w)||n("html, body").stop().animate({scrollTop:w.offset().top-F},G)}function f(){E("btf-searchbar")}function b(){u.removeClass(H);q.hide();r.show()}function k(){a.objectIsEmpty(w)||n("html, body").stop().animate({scrollTop:w.offset().top-F},G,l)}function l(){e();u.addClass(H);q.show();r.hide()}function e(b){b&&b.preventDefault&&b.preventDefault();m(u);r.show();t.val("");y.hide();z.hide();v<=A&&(q.hide(),r.hide())}function E(b){g.increment("dash-retail-selection-tap-count-"+
b)}function m(b){a.objectIsEmpty(b)||b.children().each(function(b){n(this).show()})}function B(b){C={};v=0;b.children().each(function(b){b=n(this).data(J);v++;C[b]=n(this)});I=!0}function D(b,c){if(a.objectIsEmpty(c))return 0;I||B(c);var f=v,g=b.split(" ");a.each(C,function(b,c){b.show();for(var a=0;a<g.length;a++)if(0>c.toLowerCase().indexOf(g[a].toLowerCase())){b.hide();f--;break}});return f}var n=a.$,x=n("#drs-atf-section"),p=n("#drs-btf-section"),J="product-name",C={},I=!1,v=0,G=500;if(!a.objectIsEmpty(x)&&
!a.objectIsEmpty(p)){var x=x.find("#drs-row"),w=p.find("#drs-btf-header"),t=p.find("#drs-search-bar"),y=p.find("#drs-search-clear"),u=p.find("#drs-btf-products"),q=p.find("#drs-product-box-expander-show"),r=p.find("#drs-product-box-expander-hide"),z=p.find("#drs-no-matching-result");n(".drs-btf-product-box");var H="drs-btf-products-collapsed",F=50,A=5;x.unbind("click",c).bind("click",c);y.unbind("click",e).bind("click",e);q.unbind("click",b).bind("click",b);r.unbind("click",k).bind("click",k);t.unbind("keyup",
a.debounce(d,500)).bind("keyup",a.debounce(d,500));t.unbind("focus",f).bind("focus",f);B(u);v<=A&&q.hide()}a.on("a:popover:show:dash-retail-selection-secondary-view",function(b){function c(b){b.preventDefault();m(d);k.val("");l.hide();e.css("visibility","hidden")}function f(b){b=n(this).val().trim();if(a.objectIsEmpty(d))return!1;if(0===b.length)return c(),!1;e.css("visibility","visible");0===D(b,d)?l.show():l.hide()}var g=b.popover.$popover,k=g.find("#drs-search-bar-mobile"),d=g.find("#drs-btf-products-mobile"),
e=g.find("#drs-search-clear-mobile"),l=g.find("#drs-no-matching-result-mobile");l.hide();e.unbind("click",c).bind("click",c);k.unbind("keyup",a.debounce(f,500)).bind("keyup",a.debounce(f,500));B(d);a.on.orientationchange(function(){g.css("width",(screen&&screen.width?screen.width:h.innerWidth)+"px")})})});"use strict";e.when("A","videojs","ContentGridAccessibilityProcessor").register("ContentGridController",function(a,g,d){return a.createClass({init:function(c,a){this._model=c;this._view=a;this._model.setVideoInstance(this._initVideoPlayer());
this._model.getHidePlayButton()&&this._hidePlayButton();this._model.isAutoplay()&&this._bindEvents();var b=this;this._model.getVideoInstance().on("ready",function(){d.getInstance().requestProcessVideoJsMarkup(b._view.getParentContainer())})},_bindEvents:function(){this._bindAutoplayPause();this._bindAutoplayFullscreen();this._bindOnClick();this._bindAutoplayStart()},_initVideoPlayer:function(){var c=this._model.getParentID(),a=this._model.getVideoURL()+".mp4",b=this._model.getVideoID(),k=document.createElement("video");
k.type="video/mp4";k.id=b;k.setAttribute("webkit-playsinline","webkit-playsinline");k.setAttribute("playsinline","playsinline");document.getElementById(c).appendChild(k);c=g(k);c.src(a);c.controls(!0);c.addClass("video-js");c.addClass("content-grid-video");c.addClass("vjs-big-play-button");c.addClass("vjs-big-play-centered");c.addClass("mako-cg-poster");c.poster(this._model.getPosterURL());return c},_bindAutoplayPause:function(){var c=this;this._model.getVideoInstance().onpause=function(){c._view.isVideoInViewport()&&
c._model.setCustomerClickedVideo(!0)}},_bindAutoplayStart:function(){var c=this._model.getVideoInstance(),f=a.$;c.muted(!0);this._playPauseVideoInViewport();a.on.scroll(f.proxy(this._playPauseVideoInViewport,this))},_bindAutoplayFullscreen:function(){var c=this;this._model.getVideoInstance().onfullscreenchange=function(){c._model.setCustomerClickedVideo(!0)}},_playPauseVideoInViewport:function(){var c=this._model.getVideoInstance();this._model.getCustomerClickedVideo()||(this._view.isVideoInViewport()?
c.paused()&&c.play():c.paused()||c.pause())},_bindOnClick:function(){var c=this;this._model.getVideoInstance().on("click",function(){c._model.setCustomerClickedVideo(!0)})},_hidePlayButton:function(){var c=this._model.getVideoInstance();c.addClass("hide-big-play-button");c.addClass("mako-cg-play-button")},destroy:function(){this._view=this._model=null}})});"use strict";e.when("A","ContentGridController","ContentGridModel","ContentGridView","ready").register("ContentGridFactory",function(a,g,d,c){var f=
[];return{get:function(b){b=new g(new d(b),new c(b));f.push(b);return b},destroyAll:function(){f.forEach(function(b){b.destroy()});f=[]}}});"use strict";e.when("A").register("ContentGridModel",function(a){return a.createClass({init:function(a){this._videoURL=a.URL;this._videoID=a.ID;this._autoplay="string"===typeof a.autoplay?"true"===a.autoplay:a.autoplay;this._hidePlayButton="string"===typeof a.hidePlayButton?"true"===a.hidePlayButton:a.hidePlayButton;this._customerClickedVideo=!1;this._posterURL=
a.posterURL;this._parentID=a.parentID},getVideoInstance:function(){return this._videoInstance},getSWFURL:function(){return SWF_URL},getVideoURL:function(){return this._videoURL},getVideoID:function(){return this._videoID},getHidePlayButton:function(){return this._hidePlayButton},getCustomerClickedVideo:function(){return this._customerClickedVideo},getPosterURL:function(){return this._posterURL},getParentID:function(){return this._parentID},isAutoplay:function(){return this._autoplay},setVideoInstance:function(a){this._videoInstance=
a},setCustomerClickedVideo:function(a){this._customerClickedVideo=a}})});"use strict";e.when("A").register("ContentGridView",function(a,e){var d=a.$;return a.createClass({init:function(a){this._parentContainer=document.getElementById(a.parentID)},getParentContainer:function(){return this._parentContainer},isVideoInViewport:function(){try{var a=this.getParentContainer();if(a&&a.getBoundingClientRect){var f=d(h),b=this.getParentContainer().getBoundingClientRect();return 0<b.bottom&&0<b.right&&b.top<
f.height()&&b.left<f.width()}}catch(k){}return!1}})});"use strict";e.when("A").register("ContentGridAccessibilityProcessor",function(a,g){var d=a.$,c,f=a.createClass({init:function(){this.hasPageLoaded="complete"===document.readyState||!1;this.doProcessMarkup=!1;this.videoJsContainers=[];this.hasPageLoaded||this._bindPageReadyEvents()},requestProcessMarkup:function(){this.hasPageLoaded?this._processLinksForAriaLabel():this.doProcessMarkup=!0},requestProcessVideoJsMarkup:function(b){!b||!b instanceof
d||!b instanceof HTMLElement||(b instanceof HTMLElement&&(b=d(b)),this.hasPageLoaded?this._processVideoJsMarkup(b):this.videoJsContainers.push(b))},_bindPageReadyEvents:function(){var b=this;e.when("ready").execute(function(){b.hasPageLoaded=!0;b.doProcessMarkup&&b._processLinksForAriaLabel();if(b.videoJsContainers.length){for(var a=0;a<b.videoJsContainers.length;a++)b._processVideoJsMarkup(b.videoJsContainers[a]);b.videoJsContainers=[]}})},_processLinksForAriaLabel:function(){d(".content-grid-row-wrapper").find("a[title]").each(function(b,
a){b=d(a);b.attr("aria-label")||b.attr("aria-label",b.attr("title"))})},_processVideoJsMarkup:function(b){d(b).find("button.vjs-menu-button[title]").each(function(b,a){a=d(a);b=a.attr("title");a.attr("aria-label")||a.attr("aria-label",b);a=a.parent().find(".vjs-menu-content");a.attr("aria-label")||a.attr("aria-label",b)})}});return{getInstance:function(){c||(c=new f);return c}}});"use strict";e.when("A","ready").execute("tech-specs",function(a){function e(a,b){b=b.find("tr:first");b.detach();a.find("tbody").append(b)}
function d(a,b){a=c(a);b=c(b);if(b.height()!=a.height()){a.css("height","");for(b.css("height","");b.height()>=a.height();)e(a,b);for(var d=Number.MAX_VALUE;;){var l=a.height(),h=b.height(),m=Math.abs(l-h),d=Math.min(m,d);if(h<l)l=b,h=a.find("tr:last"),h.detach(),l.find("tbody").prepend(h);else{m>d&&e(a,b);break}}a.height()<b.height()?a.height(b.height()):b.height(a.height())}}var c=a.$;c("#tech-specs-desktop .tech-specs-section").each(function(a,b){d("#tech-specs-table-left","#tech-specs-table-right");
c(h).resize(function(){d("#tech-specs-table-left","#tech-specs-table-right")})})})});
/* ******** */
(function(k){var n=window.AmazonUIPageJS||window.P,v=n._namespace||n.attributeErrors,g=v?v("DetailPageAccessoryUpsellAssets",""):n;g.guardFatal?g.guardFatal(k)(g,window):g.execute(function(){k(g,window)})})(function(k,n,v){k.when("desktop-accessory-upsell-model","desktop-accessory-upsell-view","desktop-accessory-upsell-controller").register("desktop-accessory-upsell-factory",function(g,c,a){return{get:function(b,e){var m=new c(b);e=new g(e);return new a(b,m,e)}}});"use strict";k.when("A").register("desktop-accessory-upsell-model",
function(g){var c=g.$;return g.createClass({init:function(a){this._accessoryCampaignData=a.accessoriesCampaignSource;this._asinsData=a.asinsData;this._primaryAsin=a.primaryAsin;this._buildScheduledAsinCache(this._asinsData)},getAsinsData:function(){return this._asinsData},getAccessoryCampaignData:function(){return this._accessoryCampaignData},getPrimaryAsin:function(){return this._primaryAsin},getInterstitialAsinsData:function(){var a=c.extend({},this._asinsData);Object.keys(a).forEach(function(b){a[b][b].isInterstitial=
!0});return a},getScheduledAsinFromVariationAsin:function(a){return this._scheduledAsins[a]},getVariationAsinsFromScheduledAsin:function(a){return this._scheduledVariationsAsins[a]},_buildScheduledAsinCache:function(a){this._scheduledAsins={};this._scheduledVariationsAsins={};this._interstitialAsinsData={};for(var b in a)if(a.hasOwnProperty(b)){this._scheduledVariationsAsins[b]=[];for(var e in a[b])a[b].hasOwnProperty(e)&&(this._scheduledVariationsAsins[b].push(e),this._scheduledAsins[e]=b,a[b][e].isInterstitial&&
(this._interstitialAsinsData[b]=a[b]))}}})});"use strict";k.when("a-modal","A").register("desktop-accessory-upsell-view",function(g,c){return c.createClass({init:function(a){this.$el=a},_getOptionElement:function(a){return this.$el.find("#abb-option-"+a)},_updateOptionRow:function(a){var b=this._getOptionElement(a.optionAsin);b.find(".abb-selected-variation").html(a.variationText);b.find(".abb-option-list-price").html(a.listPriceString);b.find(".abb-option-buying-price").html(a.buyingPriceString)},
_toggleProduct:function(a){var b=this._getOptionElement(a.optionAsin).find(".abb-option-checkbox input[type\x3d'checkbox']");a.isProductSelected?b.attr("checked",!0):b.removeAttr("checked")},_hidePopover:function(a){a=this.$el.find("#abb-popover-trigger-"+a.optionAsin);(a=g.get(a))&&a.hide()},render:function(a){this._toggleProduct(a);a.isProductSelected&&(this._updateOptionRow(a),this._hidePopover(a))},deselectAllProducts:function(){this.$el.find(".abb-option-checkbox input[type\x3d'checkbox']").removeProp("checked")}})});
"use strict";k.when("desktop-accessory-upsell-product-factory","desktop-accessory-upsell-interstitial-factory","desktop-accessory-upsell-ref-helper","accessory-upsell-dom-helper","accessory-upsell-ajax-helper","accessory-upsell-buybox-helper","A").register("desktop-accessory-upsell-controller",function(g,c,a,b,e,m,h){var d=h.$;return h.createClass({init:function(p,f,q){this.$el=p;this._view=f;this._model=q;this._subControllers={};this._interstitialController;"undefined"!=typeof q.getPrimaryAsin()&&
(this._ajaxHelper=new e(q.getAccessoryCampaignData(),q.getPrimaryAsin()));m.reset();b.processMarkupForDabb();m.parsePageAsin();p=0;f=this._model.getAsinsData();m.registerAccessoryUpsellData(f);for(var l in f)f.hasOwnProperty(l)&&(a.sendAsinScheduled(p,l),q=g.get(l,f[l],p),q.setOnOrderUpdate(d.proxy(this._handleOrderUpdate,this)),this._subControllers[l]=q,p++);l=this._model.getInterstitialAsinsData();this._interstitialController=c.get(l);this._bindEvents();this._updateDefaultCheckedAccessories()},
_bindEvents:function(){var a=this;k.when("ready").execute("accessory-upsell-controller-bindEvents",function(){a._loadSubControllerInitialImages.apply(a);a._interstitialController&&a._interstitialController.loadInitialImages();b.getPageQuantityDropdown().change(function(){var f=a._parseQuantity(d(this).val());m.updateSelectedAsinsQuantity(f)})});this._bindedFn={handleCheckboxChange:d.proxy(this._handleCheckboxChange,this),onBuyboxUpsellAsinsChanged:d.proxy(this._onBuyboxUpsellAsinsChanged,this)};this._enableEvents(!0)},
_enableEvents:function(a){a=a?"":"un";m[a+"registerUpsellAsinRemoved"](this._bindedFn.onBuyboxUpsellAsinsChanged);m[a+"registerUpsellAsinAdded"](this._bindedFn.onBuyboxUpsellAsinsChanged);this.$el[a+"delegate"](".abb-option-checkbox input[type\x3d'checkbox']","change",this._bindedFn.handleCheckboxChange)},_addAsin:function(a,f,e){var b=this._model.getScheduledAsinFromVariationAsin(a);this._model.getVariationAsinsFromScheduledAsin(b);m.addUpsellAsin(a,f,e)},_onBuyboxUpsellAsinsChanged:function(a,f,
e){f=this._model.getScheduledAsinFromVariationAsin(a);var b=this._subControllers[f];e=0<e;b&&(b.setAddedToOrderState(e),e&&b.selectAsin(a),this._internalRender(f,b.getCurrentProduct(),e))},_handleCheckboxChange:function(e,f,c){f=f||d(e.currentTarget);e=f.parents(".abb-option").data("asin");var l=f.is(":checked");f=this._subControllers[e];var g=f.getIndex(),h=f.getCurrentProduct();f.setAddedToOrderState(l);l?(l=this._parseQuantity(b.getPageQuantityDropdown().val()),this._addAsin(h.asin,h.offerListingID,
l),a.sendCheckboxSelected(g,h.asin)):(m.removeUpsellAsin(h.asin,h.offerListingID),a.sendCheckboxDeselected(g,h.asin));c||!h.checkForInteraction||h.hasBeenInteractedWith||f.setHasBeenInteractedWith(e)},_handleOrderUpdate:function(a,e){a=this._parseQuantity(d('#addToCart select[name\x3d"quantity"]').val());this._addAsin(e.asin,e.offerListingID,a)},_internalRender:function(a,e,b){a=this._generateOptionViewModel(a,e,b);this._view.render(a)},_generateOptionViewModel:function(a,e,b){var d=!1,c="",g="",
h="";e&&(c=(d=e.showPriceStrikethrough)?e.listPrice:"",g=e.buyingPrice,h=e.swatchValue);return{optionAsin:a,isProductSelected:b,isOnSale:d,listPriceString:c,buyingPriceString:g,variationText:h}},_loadSubControllerInitialImages:function(){for(var a in this._subControllers)this._subControllers.hasOwnProperty(a)&&this._subControllers[a].loadInitialImages()},_updateDefaultCheckedAccessories:function(){var a=this;a.$el.find(".abb-option-checkbox input[type\x3d'checkbox']:checked").each(function(){a._handleCheckboxChange(null,
d(this),!0)})},_parseQuantity:function(a){a=parseInt(a,10);return isNaN(a)?1:a}})});"use strict";k.when("desktop-accessory-upsell-product-model","desktop-accessory-upsell-product-controller","desktop-accessory-upsell-product-view","A").register("desktop-accessory-upsell-product-factory",function(g,c,a,b){return{get:function(e,m,h){var d=b.$("#abb-product-view-"+e),p=new a(d);m=new g(m,e,h);return new c(d,e,p,m)}}});"use strict";k.when("A").register("desktop-accessory-upsell-product-model",function(g){return g.createClass({init:function(c,
a,b){this._products=c;this._index=b;this._isViewClosedByOrderUpdate=this._isAddedToOrder=this._preloadingComplete=!1;this._cachedAsin=null;this._isVisual=this._calculateIsVisual(a);this.setSelectedProduct(a)},_calculateIsVisual:function(c){return(c=this._products[c])?c.visualDimension:!1},cacheSelectedProduct:function(){var c=this.getSelectedProduct();"undefined"!==typeof c&&(this._cachedAsin=c.asin)},setSelectedProductFromCache:function(){this.setSelectedProduct(this._cachedAsin)},clearSelectedProductCache:function(){this._cachedAsin=
null},setSelectedProduct:function(c){if(c)for(var a in this._products)this._products.hasOwnProperty(a)&&(this._products[a].isSelected=a===c)},getSelectedProduct:function(){for(var c in this._products)if(this._products.hasOwnProperty(c)){var a=this._products[c];if(a.isSelected)return g.copy(a)}},getProduct:function(c){var a=null,b;for(b in this._products)if(this._products.hasOwnProperty(b)&&b===c){a=this._products[b];break}return a},isSelectedProduct:function(c){return(c=this._products[c])&&c.isSelected},
isVisual:function(){return this._isVisual},setAddedToOrderState:function(c){this._isAddedToOrder=c},isAddedToOrderState:function(){return this._isAddedToOrder},getAllLowResImages:function(){var c=[],a;for(a in this._products)this._products.hasOwnProperty(a)&&c.push(this._products[a].lowResImage.URL_);return c},isPreloadingComplete:function(){return this._preloadingComplete},completePreloading:function(){this._preloadingComplete=!0},getIndex:function(){return this._index},isViewClosedByOrderUpdate:function(){return this._isViewClosedByOrderUpdate},
setViewClosedByOrderUpdate:function(c){this._isViewClosedByOrderUpdate=c},setHasBeenInteractedWith:function(c){this._products.hasOwnProperty(c)&&(this._products[c].hasBeenInteractedWith=!0)}})});"use strict";k.when("A").register("desktop-accessory-upsell-product-view",function(g){var c=g.$;return g.createClass({init:function(a){this.$baseElement=a;this.$variations=this.$baseElement.find(".abb-variation")},updateTargetElement:function(a,b){this.$el=a;this.$el.find(".abb-product-view").toggleClass("abb-product-is-selected",
b)},_updateSelectedVariation:function(a){this.$variations.removeClass("a-button-selected");this.$variations.filter(".abb-variation-"+a).addClass("a-button-selected")},render:function(a){var b=this._buildFeatureBullets(a.featureBullets);this._updateElements(this.$el,a,b.clone());this._updateSelectedVariation(a.asin)},updateBase:function(a){var b=this._buildFeatureBullets(a.featureBullets);this._updateElements(this.$baseElement,a,b.clone());this.$baseElement.find(".abb-variation-"+a.asin).trigger("click")},
_updateElements:function(a,b,e){b.isDigitalSubscription||(a.find(".abb-product-title").html(b.title),a.find(".abb-product-buying-price").html(b.buyingPriceString),a.find(".abb-product-list-price").html(b.isOnSale?b.listPriceString:""),a.find(".abb-product-merchant").text(b.merchant),a.find(".abb-variation-selected-dimension").text(b.swatchValue),a.find(".abb-product-feature-bullets").html(e),a.find(".abb-product-title").attr("href",b.productURL))},_buildFeatureBullets:function(a){for(var b=c("\x3cul\x3e"),
e=0;e<a.length;e++)c("\x3cli\x3e").html(a[e]).appendTo(b);return b},updateProductImage:function(a){setTimeout(function(){this.$el.find(".abb-product-image").attr("src",a);this.$baseElement.find(".abb-product-image").attr("src",a)}.bind(this),100)}})});"use strict";k.when("desktop-accessory-upsell-ref-helper","ods-image-utilities","A").register("desktop-accessory-upsell-product-controller",function(g,c,a){var b=a.$;return a.createClass({init:function(e,c,g,d){this.$baseElement=e;this._scheduledAsin=
c;this._view=g;this._model=d;this.$el;this.popoverInstance;a.on("a:button-group:abb-product-variations-"+this._scheduledAsin+":toggle",b.proxy(this._handleVariationSelection,this));a.on("a:popover:beforeShow:abb-product-view-"+this._scheduledAsin,b.proxy(this._preparePopover,this));a.on("a:popover:show:abb-product-view-"+this._scheduledAsin,b.proxy(this._bindEvents,this));a.on("a:popover:afterHide:abb-product-view-"+this._scheduledAsin,b.proxy(this._detachPopover,this))},_preparePopover:function(a){this.$el=
a.popover.$popover;this.popoverInstance=a.popover;this._model.cacheSelectedProduct();this._model.setViewClosedByOrderUpdate(!1);this._model.setHasBeenInteractedWith(this._scheduledAsin);this._view.updateTargetElement(this.$el,this._model.isAddedToOrderState());if(!this._model.isPreloadingComplete()){var m=this;a=c.preloadImages(this._model.getAllLowResImages());b.when.apply(b,a).done(function(){m._model.completePreloading()})}this.renderView();g.sendPopoverDisplayed(this._model.getIndex(),this._model.getSelectedProduct().asin)},
_bindEvents:function(){this.$el.delegate(".abb-product-ato","click",b.proxy(this._handleAddToOrderClick,this))},_detachPopover:function(){this.$el&&this.$el.undelegate(".abb-product-ato","click",b.proxy(this._handleAddToOrderClick,this));this.popoverInstance=this.$el=v;this._model.isViewClosedByOrderUpdate()||(this._model.setSelectedProductFromCache(),g.sendPopoverCancelled(this._model.getIndex(),this._model.getSelectedProduct().asin));this._model.clearSelectedProductCache()},_handleVariationSelection:function(a){var b;
a.selectedButton&&(b=a.selectedButton.buttonName);b&&(this.selectAsin(b),this.renderView(),g.sendPopoverTwisted(this._model.getIndex(),b))},_handleAddToOrderClick:function(){var a=this._model.getSelectedProduct(),b=this._model.isAddedToOrderState();this._orderUpdateCallback&&this._orderUpdateCallback(this._scheduledAsin,a);this._model.setAddedToOrderState(!0);this._model.setViewClosedByOrderUpdate(!0);this._view.updateBase(this._generateViewModel(a));b?g.sendUpdateClicked(this._model.getIndex(),a.asin):
g.sendAddToOrderClicked(this._model.getIndex(),a.asin);this.$el.addClass("abb-product-is-selected");this.popoverInstance.hide()},_handleLowResImageLoaded:function(a,b){var c=this._model.getSelectedProduct();a&&a.isResolved()||c.lowResImage.URL_!==b||this._view.updateProductImage(b)},_handleHiResImageLoaded:function(a){this._model.getSelectedProduct().hiResImage.URL_===a&&this._view.updateProductImage(a)},_handleImageLoadFailure:function(a){throw Error("The image "+a+" failed to load for accessory ASIN "+
this._scheduledAsin);},_generateViewModel:function(a){return{asin:a.asin,title:a.title,merchant:a.merchantName,swatchValue:a.swatchValue,featureBullets:a.featureBullets,listPriceString:a.listPrice,buyingPriceString:a.buyingPrice,isOnSale:a.showPriceStrikethrough,isDigitalSubscription:a.isDigitalSubscription,productURL:"/dp/{0}/ref\x3dods_dabb_{0}_productInfo".replace("{0}",a.asin).replace("{0}",a.asin)}},_loadProductImage:function(a){a=c.preloadImage(a.lowResImage.URL_,a.hiResImage.URL_);a.image.done(b.proxy(this._handleLowResImageLoaded,
this,a.hiResImage)).fail(b.proxy(this._handleImageLoadFailure,this,a.hiResImage));a.hiResImage&&a.hiResImage.done(b.proxy(this._handleHiResImageLoaded,this)).fail(b.proxy(this._handleImageLoadFailure,this))},loadInitialImages:function(){a.loadDescendantImagesManually(this.$baseElement)},setOnOrderUpdate:function(a){this._orderUpdateCallback=a},getCurrentProduct:function(){return this._model.getSelectedProduct()},setAddedToOrderState:function(a){this._model.setAddedToOrderState(a)},selectAsin:function(a){var b=
this._model.getSelectedProduct();b&&b.asin!==a&&this._model.setSelectedProduct(a)},renderView:function(){var a=this._model.getSelectedProduct();this._model.isVisual()&&this._loadProductImage(a);this._view.render(this._generateViewModel(a))},getIndex:function(){return this._model.getIndex()},setHasBeenInteractedWith:function(a){this._model.setHasBeenInteractedWith(a)}})});"use strict";k.when("desktop-accessory-upsell-interstitial-model","desktop-accessory-upsell-interstitial-view","desktop-accessory-upsell-interstitial-controller",
"A").register("desktop-accessory-upsell-interstitial-factory",function(g,c,a,b){return{get:function(e){var m=b.$("#abb-interstitial"),h=new c(m);e=new g(e);return new a(m,h,e)}}});"use strict";k.when("A").register("desktop-accessory-upsell-interstitial-model",function(g){return g.createClass({init:function(c){this._interstitialAsinsData=c;this._scheduledAsins={};this._scheduledVariationsAsins={};this._interstitialProducts={};this._buildScheduledAsinCache(c)},getInterstitialAsinsData:function(){return this._interstitialAsinsData},
getInterstitialProducts:function(){return this._interstitialProducts},getScheduledAsinFromVariationAsin:function(c){return this._scheduledAsins[c]},getVariationAsinsFromScheduledAsin:function(c){return this._scheduledVariationsAsins[c]},_buildScheduledAsinCache:function(c){this._scheduledAsins={};this._scheduledVariationsAsins={};this._interstitialProducts={};for(var a in c)if(c.hasOwnProperty(a)){this._scheduledVariationsAsins[a]=[];this._interstitialProducts[a]=c[a][a];for(var b in c[a])c[a].hasOwnProperty(b)&&
(this._scheduledVariationsAsins[a].push(b),this._scheduledAsins[b]=a)}}})});"use strict";k.when("a-modal","A").register("desktop-accessory-upsell-interstitial-view",function(g,c){return c.createClass({init:function(a){this.$baseElement=a;this.$productSections=this.$baseElement.find(".abb-intl-product-view,.abb-intl-product-terms")},render:function(a){this.$productSections.hide();a=a.asinsToShow;for(var b=0;b<a.length;b++)this._getProductSection(a[b]).show()},getCheckedProductCheckboxes:function(){return this.$baseElement.find(".abb-intl-product-ato input[type\x3d'checkbox']:checked")},
getAllVisibleProductCheckboxes:function(){return this.$baseElement.find(".abb-intl-product-ato input[type\x3d'checkbox']:visible")},_getProductSection:function(a){return this.$baseElement.find("#abb-intl-product-view-"+a+","+("#abb-intl-product-terms-"+a))}})});"use strict";k.when("desktop-accessory-upsell-ref-helper","ods-image-utilities","accessory-upsell-dom-helper","accessory-upsell-buybox-helper","MakoCommonCartHelper","a-modal","A").register("desktop-accessory-upsell-interstitial-controller",
function(g,c,a,b,e,m,h){var d="aok-hidden",p=!1,d="aok-hidden",f=h.$;return h.createClass({init:function(a,b,f){this.$baseElement=a;this._view=b;this._model=f;this.popoverInstance=m.get("abb-interstitial");this.$el;this.$clickedSubmitButton;var c=this.wasInterstitialOfferAccepted=!1;this.asinsToShow=h.map(this._model.getInterstitialProducts(),function(a,b){a.checkForInteraction&&(c=!0);return b});this.hasCheckForInteractionAsin=c;this._bindEvents()},_bindEvents:function(){var b=this;k.when("ready").execute("accessory-upsell-interstitial-controller-bindEvents",
function(){a.getSubmitButtons().forEach(function(a){0<=a.selector.indexOf("input#add-to-cart-button")||0<=a.selector.indexOf("input#one-click-button")&&b.hasCheckForInteractionAsin||0<=a.selector.indexOf("input#buy-now-button")&&b.hasCheckForInteractionAsin?a.bind("click",f.proxy(b._handleAtcSubmit,b)):0<=a.selector.indexOf("#LDBuybox *[id^\x3dgb_atc_]")&&(h.off("deals_claimDealSuccess"),h.on("deals_claimDealSuccess",function(a){b._handleLDAtcSubmit(a)}))})})},_handleAtcSubmit:function(a){this._registerInterstitialCXImprovementsWeblabTreatment();
this.$clickedSubmitButton=f(a.target);var b=this._getInterstitialAsinsToShow();if(0<b.length){a.preventDefault();this.$clickedSubmitButton.unbind("click",f.proxy(this._handleAtcSubmit,this));for(a=0;a<b.length;a++)g.sendInterstitialDisplayed(-1,b[a]);this._showIntlPopover.apply(this)}},_handleLDAtcSubmit:function(f){var c=b.getUpsellAsins();c.length&&(f=a.getBuyboxFormSessionID().val(),f=e.createRequest(f,"AmazonDevices"),f.setAsinsData(c).setReftag("ods_dabb_ld"),f.sendRequest().done(function(b){g.sendLightningDealsAddToCartSuccessful(b.cartQuantity);
a.updateCartQuantity(b.cartQuantity);b=a.getLightningDealElements();a.getDomElements().abbContainer.find(".abb-option-checkbox input").prop("checked",!1);b.successMessageCount.text(c.length);1<c.length?b.successMessageMultiple.removeClass(d):b.successMessageSingle.removeClass(d);b.successMessageContainer.removeClass(d)}).fail(function(){k.log("An error has occurred with common cart handler","WARN")}),b.resetUpsellData())},_getInterstitialAsinsToShow:function(){for(var a=[],f=b.getUpsellAsins(),f=
this.getParentAsins(f),c=0;c<this.asinsToShow.length;c++){var d=this.asinsToShow[c],e=this._model.getScheduledAsinFromVariationAsin(d),p=this._model.getInterstitialAsinsData()[e][d];p.checkForInteraction?p.hasBeenInteractedWith||(a.push(d),this.autoCheckInterstitial=!0):-1===f.indexOf(e)&&a.push(d)}return this.asinsToShow=a},_lazyLoadImages:function(){f(".abb-sources").length&&!p&&(f(".abb-product-view-image-container").each(function(){var a=f(this).find(".abb-product-image"),b=f(this).find(".abb-sources"),
c=f(b).attr("data-normalres")||f(b).attr("data-normalRes"),b=f(b).attr("data-highres")||f(b).attr("data-highRes");a.attr("src",c);a.attr("data-a-hires",b);p=!0}),h.loadHiResImage(f(".abb-product-image")))},_showIntlPopover:function(){h.off("a:popover:beforeShow:abb-interstitial");h.off("a:popover:show:abb-interstitial");h.off("a:popover:hide:abb-interstitial");h.on("a:popover:beforeShow:abb-interstitial",f.proxy(this._popoverBeforeShow,this));h.on("a:popover:show:abb-interstitial",f.proxy(this._popoverOnShow,
this));h.on("a:popover:hide:abb-interstitial",f.proxy(this._popoverOnHide,this));this.popoverInstance.show();this._updateItemCounters()},_popoverBeforeShow:function(a){this._lazyLoadImages();this.renderView()},_popoverOnShow:function(a){this.$el=a.popover.$popover;this.$el.delegate(".abb-intl-ato","click",f.proxy(this._handleIntlAddToOrderClick,this));this.$el.delegate(".abb-intl-decline","click",f.proxy(this._handleIntlDeclineClick,this));this.$el.delegate(".a-button-close","click",f.proxy(this._handleIntCloseButtonClick,
this));this.$el.delegate(".abb-intl-product-ato input[type\x3d'checkbox']","change",f.proxy(this._handleSelectedItemsChange,this));1==this._getInterstitialAsinsToShow().length&&this.autoCheckInterstitial&&this.$el.find(".abb-intl-product-ato input[type\x3d'checkbox']").prop("checked",!0)},_popoverOnHide:function(a){this.wasInterstitialOfferAccepted||g.sendInterstitialOfferDeclined(-1,"");this.$clickedSubmitButton.click()},_handleIntCloseButtonClick:function(a){g.sendInterstitialCloseButtonClicked(-1,
"")},_handleSelectedItemsChange:function(b){this.wasInterstitialOfferAccepted=0<this._view.getCheckedProductCheckboxes().length;b=a.getInterstitialCTAButtons();this.wasInterstitialOfferAccepted?(b.atoButton.css("display","inline-block"),b.declineButton.hide()):(b.atoButton.hide(),b.declineButton.css("display","inline-block"))},_handleIntlAddToOrderClick:function(c){c=this._view.getAllVisibleProductCheckboxes();var d=parseInt(a.getPageQuantityDropdown().val()||1,10);c.each(function(a,c){a=f(this).closest(".abb-intl-product-ato").data("asin");
c=b.getProductData(a);if(!c)return!0;f(this).is(":checked")?(b.addUpsellAsin(a,c.offerListingID,d),g.sendInterstitialItemAdded(-1,a)):(b.removeUpsellAsin(a,c.offerListingID),g.sendInterstitialItemUnchecked(-1,a))});this.popoverInstance.hide()},_handleIntlDeclineClick:function(a){this.wasInterstitialOfferAccepted=!1;this.popoverInstance.hide()},_generateViewModel:function(){return{asinsToShow:this.asinsToShow}},_updateItemCounters:function(){var a=f(".abb-intl-product-view:visible").length,b=f(".abb-interstitial").closest(".a-popover-wrapper").find(".a-popover-header-content").last();
b.text(b.text().replace("$totalItems",a));f(".abb-product-total").text(a);f(".abb-intl-product-view:visible .abb-product-index").each(function(a){f(this).text(a+1)});f(".abb-intl-product-view:visible").eq(0).addClass("abb-intl-first-accessory")},loadInitialImages:function(){h.loadDescendantImagesManually(this.$baseElement)},renderView:function(){this._view.render(this._generateViewModel())},getParentAsins:function(a){for(var b=[],c=0;c<a.length;c++){var f=this._model.getScheduledAsinFromVariationAsin(a[c].asin);
b.push(f)}return b},_csmRegisterWeblab:function(a,b){var c=n.ue;c&&c.trigger(a,b)},_registerInterstitialCXImprovementsWeblabTreatment:function(){var a=this;k.when("ABB.WeblabData").execute(function(b){b.isInterstitialCXImprovementsWeblabTreatmentT1&&b.isInterstitialCXImprovementsWeblabTreatmentT1()&&(b=b.isInterstitialCXImprovementsWeblabTreatmentT1()?"T1":"C",a._csmRegisterWeblab("MAKO_BU_INT_291146",b))})}})});"use strict";k.when("odsRefTagUtils","accessory-upsell-buybox-helper","csmCounter","A").register("desktop-accessory-upsell-ref-helper",
function(g,c,a,b){function e(a,b,e){var l=c.getPageAsin().asin;l&&l.length&&(a=("ods_dabb_"+l+"_slot{{index}}_{{asin}}_{{action}}").replace(m,a).replace(h,b).replace(d,e),g.send(a))}var m=/{{\s?index\s?}}/ig,h=/{{\s?asin\s?}}/ig,d=/{{\s?action\s?}}/ig;return{sendAsinScheduled:function(a,b){e(a,b,"asinScheduled")},sendCheckboxSelected:function(a,b){e(a,b,"checkoxSelected")},sendCheckboxDeselected:function(a,b){e(a,b,"checkoxDeselected")},sendSecondaryViewDisplayed:function(a,b){e(a,b,"secondaryViewDisplayed")},
sendSecondaryViewTwisted:function(a,b){e(a,b,"secondaryViewTwisted")},sendSecondaryViewCancelled:function(a,b){e(a,b,"secondaryViewCancelled")},sendPopoverDisplayed:function(a,b){e(a,b,"popoverDisplayed")},sendPopoverTwisted:function(a,b){e(a,b,"popoverTwisted")},sendPopoverCancelled:function(a,b){e(a,b,"popoverCancelled")},sendAddToOrderClicked:function(a,b){e(a,b,"addToOrderClicked")},sendInterstitialDisplayed:function(a,b){e(a,b,"interstitialDisplayed")},sendInterstitialItemAdded:function(a,b){e(a,
b,"interstitialItemAdded")},sendInterstitialItemUnchecked:function(a,b){e(a,b,"interstitialItemUnselected")},sendInterstitialOfferDeclined:function(a,b){e(a,b,"interstitialOfferDeclined")},sendInterstitialCloseButtonClicked:function(a,b){e(a,b,"interstitialCloseButtonClicked")},sendUpdateClicked:function(a,b){e(a,b,"updateClicked")},sendLightningDealsAddToCartSuccessful:function(b){a.update("abbLdAddToCartSuccess",b?1:0)},sendLightningDealsAddToCartFailure:function(a,b){e(a,b,"lDAccessoryAddToCartFailure")}}});
"use strict";k.when("A").register("accessory-upsell-dom-helper",function(g){var c=g.$;return new function(){function a(a){a.each(function(){var a=c(this);a.find(".buyboxHelperHiddenFieldsContainer").length||a.append(c("\x3cdiv\x3e").addClass("buyboxHelperHiddenFieldsContainer"))});return a.find(".buyboxHelperHiddenFieldsContainer")}function b(a,b){return c("\x3cinput\x3e").attr({type:"hidden",name:a,value:b})}function e(a){a.each(function(){var a=c(this),b=a.parent("form").find('input[name\x3d"itemCount"]');
d.itemCount.length&&!b.length&&a.append(d.itemCount.clone())});return a}function g(a,c,d){if(c){var e=1,h;for(h in c)a.appendChild(b("custom-name."+d+"."+e,h)[0]),a.appendChild(b("custom-value."+d+"."+e,c[h])[0]),e+=1}}function h(){d.hiddenFieldsContainers.empty()}var d={};return{processMarkupForDabb:function(){var a=c("#accessory-upsell");a.find(".abb-option-checkbox input[type\x3d'checkbox']").removeAttr("name").removeAttr("value");a.find('input[name^\x3d"asin."]').remove();a.find('input[name^\x3d"offeringID."]').remove();
a.find('input[name^\x3d"quantity."]').remove()},parsePageAsinData:function(){d.abbContainer=c("#accessory-upsell");d.itemCount=d.abbContainer.find('input[name\x3d"itemCount"]');d.buyboxForm=c("form#addToCart");d.atcForms=c('#buybox form:has(input[name\x3d"ASIN"])');d.formSessionIdInput=d.buyboxForm.find("input#session-id");d.formSessionIdInput.length||(d.formSessionIdInput=c("#verificationSessionID"));d.submitButton=d.buyboxForm.find('input#add-to-cart-button[name\x3d"submit.add-to-cart"]');d.installmentsSubmitButton=
d.buyboxForm.find('input#installments-button[name\x3d"submit.installments"]');d.oneClickSubmitButton=d.buyboxForm.find('input#one-click-button[name\x3d"submit.one-click-order.x"]');d.buyNowSubmitButton=d.buyboxForm.find('input#buy-now-button[name\x3d"submit.buy-now"]');d.lightningDealSubmitButton=d.buyboxForm.find("#LDBuybox *[id^\x3dgb_atc_]");d.pageAsinInput=d.buyboxForm.find('input[type\x3d"hidden"][name\x3d"ASIN"]');d.pageOfferIdInput=d.buyboxForm.find('input[type\x3d"hidden"][name\x3d"offerListingID"]');
d.pageQuantityDropdown=d.buyboxForm.find('select[name\x3d"quantity"]');d.ldAddSuccessMessageContainer=d.buyboxForm.find("#abb-add-success-message");d.ldAddSuccessCount=d.buyboxForm.find("#abb-add-success-message-count");d.ldAddSuccessSingleMessage=d.buyboxForm.find("#abb-add-single-message");d.ldAddSuccessMultipleMessage=d.buyboxForm.find("#abb-add-multiple-message");d.ldWaitlistMessage=d.buyboxForm.find("#abb-waitlist-message");d.hiddenFieldsContainers=a(d.atcForms);d.intlAtoSubmitButon=c(".abb-intl-ato");
d.intlDeclineButton=c(".abb-intl-decline");d.cartQuantity=c(".nav-cart-count");var b=d.pageAsinInput.val(),e=d.pageOfferIdInput.val(),g=d.pageQuantityDropdown.val()&&d.pageQuantityDropdown.val().trim()?parseInt(d.pageQuantityDropdown.val().trim(),10):1;return{asin:b,offerId:e,quantity:g}},getSubmitButtons:function(){return[d.submitButton,d.oneClickSubmitButton,d.buyNowSubmitButton,d.lightningDealSubmitButton]},getPageQuantityDropdown:function(){return d.pageQuantityDropdown},renderUpsellAsinsHiddenInputs:function(a){if(d.hiddenFieldsContainers.length){h();
for(var f=document.createDocumentFragment(),k=0;k<a.length;k++){var l=a[k],u=k+1;f.appendChild(b("asin."+u,l.asin)[0]);f.appendChild(b("offeringID."+u,l.offerId)[0]);f.appendChild(b("quantity."+u,l.quantity)[0]);if(l.isDigitalSubscription){var r=l.fixedCustomCartAttribute?u:u+1;f.appendChild(b("custom-name."+r+".1",l.customAttributeName)[0]);f.appendChild(b("custom-value."+r+".1",l.customAttributeValue)[0])}g(f,l.productLineItemCustomKeyValuePair,"1");g(f,l.upsellLineItemCustomKeyValuePair,u+1)}d.hiddenFieldsContainers.each(function(){c(this).append(f.cloneNode(!0))});
e(d.hiddenFieldsContainers)}},removeUpsellAsinsHiddenInputs:h,updateUpsellAsinsQuantityInputs:function(a){d.hiddenFieldsContainers.find('input[type\x3d"hidden"][name^\x3d"quantity."]').each(function(b,d){c(d).val(a)})},getDomElements:function(){return d},getHiddenFieldsContainer:function(){return d.hiddenFieldsContainers},getBuyboxFormSessionID:function(){return d.formSessionIdInput},getLightningDealElements:function(){return{waitlistMessage:d.ldWaitlistMessage,successMessageContainer:d.ldAddSuccessMessageContainer,
successMessageContainerSelector:"#abb-add-success-message",successMessageSingle:d.ldAddSuccessSingleMessage,successMessageMultiple:d.ldAddSuccessMultipleMessage,successMessageCount:d.ldAddSuccessCount}},reset:function(){d={}},getInterstitialCTAButtons:function(){return{atoButton:d.intlAtoSubmitButon,declineButton:d.intlDeclineButton}},updateCartQuantity:function(a){d.cartQuantity.text(a)}}}});"use strict";k.when("A","ODSEventDispatcher","accessory-upsell-dom-helper").register("accessory-upsell-buybox-helper",
function(g,c,a){var b=g.$;return new function(){function e(a){return l[u[a]]}function m(a){var b=u[a];return b?q[b][a]:v}function h(a,b,c){if("string"!==typeof a||0===a.length)throw new TypeError('The "asin" argument must be defined.');c="number"===typeof c?Math.max(1,c):1;var d=!r||g.objectIsEmpty(r);r={asin:a,offerId:b,quantity:c||1};n.dispatch(d?"PageAsinAdded":"PageAsinChanged",a,b,c)}function d(a,b,c){var d;a:{if(!r||r.asin!==a)for(d=0;d<t.length;d++)if(t[d].asin===a&&(!b||t[d].offerId===b))break a;
d=-1}if(0<=d){var e=t[d],f=e.quantity;if(f===c)return!1;0===c?(t.splice(d,1),n.dispatch("UpsellAsinRemoved",a,b,c,f)):(e.quantity=c,n.dispatch("UpsellAsinChanged",a,b,c,f))}else-1===d&&0<c&&(d=m(a),t.push({asin:a,offerId:b,quantity:c,fixedCustomCartAttribute:d.isDigitalSubscription?d.fixedCustomCartAttribute:null,customAttributeValue:d.isDigitalSubscription?d.customAttributeValue:null,customAttributeName:d.isDigitalSubscription?d.customAttributeName:null,isDigitalSubscription:d.isDigitalSubscription,
productLineItemCustomKeyValuePair:d.productLineItemCustomKeyValuePair,upsellLineItemCustomKeyValuePair:d.upsellLineItemCustomKeyValuePair}),n.dispatch("UpsellAsinAdded",a,b,c))}function k(){return g.copy(r)}function f(){return g.copy(t)}var q,l={},u={},r={},t=[],n=new c;(function(){b.each(["PageAsinAdded","PageAsinChanged","UpsellAsinAdded","UpsellAsinChanged","UpsellAsinRemoved"],b.proxy(function(a,c){this["register"+c]=b.proxy(n,"registerCallback",c);this["unregister"+c]=b.proxy(n,"unregisterCallback",
c)},this))}).apply(this);this.registerAccessoryUpsellData=function(a){q=a;for(var b in q)if(q.hasOwnProperty(b)){a=q[b];l[b]=[];for(var c in a)a.hasOwnProperty(c)&&(l[b].push(c),u[c]=b)}};this.getParentAsin=function(a){return u[a]};this.getChildAsins=e;this.getProductData=m;this.parsePageAsin=function(){var b=a.parsePageAsinData();h(b.asin,b.offerId,b.quantity)};this.setPageAsin=h;this.addUpsellAsin=function(b,c,f){if("string"!==typeof b||0===b.length)throw new TypeError('The "asin" argument must be defined.');
if(r&&r.asin===b)throw Error("Can not modify page asin.");f="number"===typeof f?Math.max(1,f):1;for(var g=e(b),h=0;h<g.length;h++){var k=g[h];k!==b&&d(k,"",0)}d(b,c||"",f);a.renderUpsellAsinsHiddenInputs(t)};this.removeUpsellAsin=function(b,c){d(b,c||"",0);a.renderUpsellAsinsHiddenInputs(t)};this.getPageAsin=k;this.getUpsellAsins=f;this.getAsins=function(){var a=k(),b=f();return[a].concat(b)};this.updateSelectedAsinsQuantity=function(b){if(isNaN(b)||1>b)throw Error("New quantity for upsell asins must be greater than 0.");
r.quantity=b;for(var c=0;c<t.length;c++)t[c].quantity=b;a.updateUpsellAsinsQuantityInputs(b)};this.reset=function(){l={};u={};r={};t=[];a.reset()};this.resetUpsellData=function(){t=[]}}});"use strict";k.when("A").register("accessory-upsell-ajax-helper",function(g){return g.createClass({init:function(c,a){c=this.createAjaxURL(c,a);this.getPopoverMarkupAfterAtf(c)},createAjaxURL:function(c,a){var b=n.location.href.match(/^https?\:\/\/([^\/?#]+).*/i);return"https://"+(b&&b[1])+"/gp/product/features/dpx-ajax-feature-loader.html?showFeatures\x3daccessoryUpsell\x26deviceType\x3dweb\x26asin\x3d"+
a+"\x26additionalParameters\x3daccessoriesCampaignSource\x26accessoriesCampaignSource\x3d"+encodeURIComponent(JSON.stringify(c))},getPopoverMarkupAfterAtf:function(c){k.when("A","a-modal","atf").execute(function(a,b){a.$("#accessory-upsell-ajax-home").load(c,function(c,g,h){c=n.ue&&n.ue.count||function(){};c("AccessoryUpsellAjaxErrorRate",0);"success"!=g&&c("AccessoryUpsellAjaxErrorRate",1);accessoryUpsellPopoverFactoryDataList.forEach(function(c){b.create(a.$("#"+c.popoverTriggerId),c.popoverOptions)})})})}})});
"use strict";k.when("A","odsRefTagUtils").register("upsell-ref",function(g,c){var a=g.$;return g.createClass({init:function(b){b.delegate("input[type\x3dcheckbox]","change",function(){var b=a(this),g=b.is(":checked")?"checkboxSelected":"checkboxDeselected",b=b.parents(".a-checkbox").data("ref");c.send(b+"_"+g)})}})});"use strict";k.when("A").register("ld-upsell",function(g){var c=g.$;return g.createClass({init:function(a){a.find("input[type\x3dcheckbox]").is(":checked")&&this.addToCart(a)},addToCart:function(a){var b=
{clientName:"AmazonDevices",verificationSessionID:c("#session-id").val()},e=0;a.find("input[type\x3dcheckbox]:checked").each(function(a){var d=c(this).closest(".abbListItem");if(d){var g=d.find('input[name^\x3d"asin."]').val(),f=d.find('input[name^\x3d"offeringID."]').val(),d=d.find('input[name^\x3d"quantity."]').val();b["ASIN."+a]=g;b["offerListingID."+a]=f;b["quantity."+a]=d;e+=1;c("#selected-itemCount").val(e)}});var g=c.ajax({url:"/gp/add-to-cart/json/ref\x3dldabb",type:"POST",data:b});g.done(function(b){b=
c("#ld-success-msg");b.find("#ld-count").html(e);1<e?b.find("#ld-accessories").removeClass("aok-hidden"):b.find("#ld-accessory").removeClass("aok-hidden");b.removeClass("aok-hidden");c(a).find("fieldset").hide()});g.fail(function(a,b){c("#ld-error-msg").show()})}})})});
/* ******** */
(function(b){var d=window.AmazonUIPageJS||window.P,e=d._namespace||d.attributeErrors,a=e?e("DetailPageJumpLinksAssets",""):d;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,d,e){b.when("A","ready").execute("jump-links",function(a){var f=a.$,b=!1;f("#jump-links a").each(function(){if(!f(this.hash).length)return b=!0,!1});if(!b){f("body").addClass("jump-links-targets-exist");var e=d.ue;a.declarative("jump-links-click","click",function(c){var a=c.$target[0].hash,
b=f(a).offset().top;c="jump-links-count_"+c.$target[0].id;var g=e.count(c)||0;e.count(c,g+1);d.history.pushState?d.history.pushState(null,null,a):(c=f(a),g=c.attr("id"),c.removeAttr("id"),d.location.hash=a,c.attr("id",g));f("html, body").stop().animate({scrollTop:b},500)})}})});
/* ******** */
(function(c){var d=window.AmazonUIPageJS||window.P,e=d._namespace||d.attributeErrors,a=e?e("DetailPageGiftingOptionAssets",""):d;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,d,e){c.when("csmCounter","A").execute(function(a,b){function c(){var b=d("#gift-wrap");b.length&&(b=b.is(":checked"),a.update("dpGiftingSelected",b?1:0))}var d=b.$;d("#add-to-cart-button, #buy-now-button, #one-click-button").each(function(b,a){d(a).bind("click.makoGiftingMetrics",c)})});
"use strict";c.when("A").execute(function(a){a.declarative("gifting-popup-window","click",function(b){var a=b.data.windowName||"popupWindow",c=b.data.windowOptions||"width\x3d600,height\x3d400,scrollbars\x3dyes";b.$event.preventDefault();d.open(b.$target.prop("href"),a,c)})})});
/* ******** */
(function(k){var m=window.AmazonUIPageJS||window.P,n=m._namespace||m.attributeErrors,d=n?n("DetailPagePreRegistrationAssets",""):m;d.guardFatal?d.guardFatal(k)(d,window):d.execute(function(){k(d,window)})})(function(k,m,n){k.when("A","a-checkbox","a-dropdown","ExtraDataHelper").register("PreRegistration.View",function(d,e,c,l){var f=d.$,h={},g=d.createClass({init:function(b,a){this.selectors={};this._setupSelectors(b,a);this.reset()},reset:function(){this._giftingCheckbox=e(this.selectors.GIFTING_CHECKBOX_SELECTOR);
this._giftingCheckboxElement=f(this.selectors.GIFTING_CHECKBOX_SELECTOR);this._accountLinkingCheckbox=e(this.selectors.ACCOUNT_LINKING_CHECKBOX_SELECTOR);this._accountLinkingCheckboxes=e(this.selectors.ALL_ACCOUNT_LINKING_CHECKBOX_SELECTOR);this._desktopQuantityDropdown=c.getSelect(this.selectors.DESKTOP_QUANTITY_DROPDOWN_SELECTOR);this._mobileQuantityDropdown=c.getSelect(this.selectors.MOBILE_QUANTITY_DROPDOWN_SELECTOR);this._quantityAlert=f(this.selectors.QUANTITY_ALERT_SELECTOR);this._giftingAlert=
f(this.selectors.GIFTING_ALERT_SELECTOR);this._mainGiftingAlert=f(this.selectors.MAIN_GIFTING_ALERT_SELECTOR);this._declaratives=f(this.selectors.DECLARATIVES_SELECTOR);this._forms=f(this.selectors.FORMS_SELECTOR);this._quantityAlert.length&&(this._quantityAlertFormatString=this._quantityAlert.html())},_setupSelectors:function(b,a){this.selectors.ACCOUNT_LINKING_ATTRIBUTE_NAME="isDevicePreRegistered";this.selectors.MAX_QUANTITY_LIMIT_FORMAT_SPECIFIER="$PREREG_MAX_QUANTITY";this.selectors.AUI_HIDDEN_CLASS=
"aok-hidden";this.selectors.AUI_COLOR_TERTIARY="a-color-tertiary";this.selectors.GIFTING_CHECKBOX_SELECTOR="#gift-wrap"+b;this.selectors.ACCOUNT_LINKING_CHECKBOX_SELECTOR="#account-linking"+b;this.selectors.ALL_ACCOUNT_LINKING_CHECKBOX_SELECTOR=".pre-reg-checkbox-option";this.selectors.DESKTOP_QUANTITY_DROPDOWN_SELECTOR=a[b].desktopQuantityDropdown;this.selectors.MOBILE_QUANTITY_DROPDOWN_SELECTOR=a[b].mobileQuantityDropdown;this.selectors.QUANTITY_ALERT_SELECTOR="#preregistrationQuantityAlert"+b;
this.selectors.GIFTING_ALERT_SELECTOR="#preregistrationGiftingAlert"+b;this.selectors.MAIN_GIFTING_ALERT_SELECTOR="#preregistrationGiftingAlert";this.selectors.ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR="#preRegCheckboxText"+b;this.selectors.ALL_ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR=".mako-pre-reg-checkbox-text";this.selectors.DECLARATIVES_SELECTOR="#atc-declarative, #buyNow .a-declarative";this.selectors.FORMS_SELECTOR="form#addToCart, form#mobile-installments, form#buyNow, form#buyNowCheckout, form#oneClickBuy, form#buyNowOneClickCheckout"},
updateQuantityLimit:function(b){this._quantityAlert.length&&this._quantityAlertFormatString&&(b=this._quantityAlertFormatString.replace(this.selectors.MAX_QUANTITY_LIMIT_FORMAT_SPECIFIER,b),this._quantityAlert.html(b))},_setDeclarativeExtraData:function(b){this._declaratives.each(function(){var a=f(this),c=a.data("action");c&&(a=a.data(c))&&a.inputs&&l.setObjectExtraData(a.inputs,b)})},_setFormExtraData:function(b){this._forms.each(function(){l.setFormExtraData(this,b)})},setAccountLinkingAttributeValue:function(b){var a=
{};a[this.selectors.ACCOUNT_LINKING_ATTRIBUTE_NAME]=b;this._setDeclarativeExtraData(a);this._setFormExtraData(a)},_isCheckboxChecked:function(b){return!b.isEmpty()&&b.isChecked()},isGiftingChecked:function(){return this._isCheckboxChecked(this._giftingCheckbox)},uncheckGiftingbox:function(){e(this.selectors.GIFTING_CHECKBOX_SELECTOR).uncheck();this._hide(this._mainGiftingAlert)},isAccountLinkingChecked:function(){return this._isCheckboxChecked(this._accountLinkingCheckbox)},getQuantity:function(){return this._desktopQuantityDropdown?
this._desktopQuantityDropdown.val():this._mobileQuantityDropdown?this._mobileQuantityDropdown.val():1},scrollGiftingIntoView:function(){this._giftingCheckboxElement.length&&!d.onScreen(this._giftingCheckboxElement,5)&&this._giftingCheckboxElement[0].scrollIntoView()},_hide:function(b){b.addClass(this.selectors.AUI_HIDDEN_CLASS)},_show:function(b){b.removeClass(this.selectors.AUI_HIDDEN_CLASS)},_isHidden:function(b){return b.hasClass(this.selectors.AUI_HIDDEN_CLASS)},showGiftingAlert:function(){this._show(this._giftingAlert)},
hideGiftingAlert:function(){this._hide(this._giftingAlert)},showQuantityAlert:function(){this._show(this._quantityAlert)},hideQuantityAlert:function(){this._hide(this._quantityAlert)},isGiftingAlertHidden:function(){return this._isHidden(this._giftingAlert)},enableAccountLinkingCheckboxes:function(b){this._accountLinkingCheckboxes.enable();f(this.selectors.ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).removeClass(this.selectors.AUI_COLOR_TERTIARY);f(this.selectors.ALL_ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).removeClass(this.selectors.AUI_COLOR_TERTIARY);
b?this._accountLinkingCheckboxes.check():this._accountLinkingCheckboxes.uncheck()},enableInstanceAccountLinkingCheckbox:function(b){this._accountLinkingCheckbox.enable();f(this.selectors.ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).removeClass(this.selectors.AUI_COLOR_TERTIARY);f(this.selectors.ALL_ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).removeClass(this.selectors.AUI_COLOR_TERTIARY);b?this._accountLinkingCheckbox.check():this._accountLinkingCheckbox.uncheck()},disableAccountLinkingCheckbox:function(){this._accountLinkingCheckboxes.uncheck();
this._accountLinkingCheckbox.disable();f(this.selectors.ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).addClass(this.selectors.AUI_COLOR_TERTIARY)},disableAccountLinkingCheckboxForQuantityCheck:function(){this._accountLinkingCheckbox.uncheck();this._accountLinkingCheckbox.disable();f(this.selectors.ACCOUNT_LINKING_CHECKBOX_TEXT_SELECTOR).addClass(this.selectors.AUI_COLOR_TERTIARY)},isAccountLinkingCheckboxEnabled:function(){return this._accountLinkingCheckbox.isEnabled()},allAccountLinkingCheckboxEnabled:function(){return this._accountLinkingCheckboxes.isEnabled()},
updateAccountLinkingCheckboxes:function(b){b?this._accountLinkingCheckboxes.check():this._accountLinkingCheckboxes.uncheck()},openPopup:function(b){m.open(b,"popupWindow","width\x3d600,height\x3d400,scrollbars\x3dyes")}});return{getInstance:function(b,a){var c=""===b?"default":b;h[c]||(h[c]=new g(b,a));return h[c]}}});k.when("A","PreRegistration.View","PreRegistration.Metrics").register("PreRegistration.Controller",function(d,e,c){var l=d.$,f={},h={"":{quantityChangeEvent:"a:dropdown:selected:quantity",
mobileQuantityDropdown:"#quantity",desktopQuantityDropdown:"#mobileQuantityDropDown"},"-installment":{quantityChangeEvent:"a:dropdown:selected:installmentsQuantityDropdown",mobileQuantityDropdown:"#installmentsQuantityDropdown",desktopQuantityDropdown:"#installmentsQuantityDropdown"},"-deals":{quantityChangeEvent:"a:dropdown:dealOrderQuantityDropdown:select",mobileQuantityDropdown:"#dealOrderQuantityDropdown",desktopQuantityDropdown:"#dealOrderQuantityDropdown"}},g,b=d.createClass({init:function(a,
b){this.selectors={};this._data=a;this._view=e.getInstance(b,h);this._metrics=new c;this._suffix=b;this.reset(a);this._bindEventsOnce()},reset:function(a){this._setupSelectors(this._suffix);this._view.reset();this._view.uncheckGiftingbox();this._bindEventsDOM();"object"===typeof a?(this._showStatus=a.showStatus,this._maxQuantityLimit=a.maxQuantity,this._defaultValue=a.defaultValue,this._status=a.status,this._asin=a.asin,g=g==n?this._defaultValue:g,this._view.updateQuantityLimit(this._maxQuantityLimit),
this._view.setAccountLinkingAttributeValue(this._defaultValue),this._checkQuantity(this._view.getQuantity()),this._showStatus?this._metrics.emitGiftingAndAccountLinkingLoadedMetric(this._asin):this._metrics.emitGiftingLoadedMetric(this._asin)):this._view.setAccountLinkingAttributeValue("false")},_setupSelectors:function(a){this.selectors.QUANTITY_CHANGE_EVENT=h[a].quantityChangeEvent;this.selectors.DETAIL_PAGE_GIFTING_DECLARATIVE_NAME="detail-page-gifting-declarative"+a;this.selectors.DESKTOP_GIFTING_DECLARATIVE_NAME=
"mako-gifting-declarative"+a;this.selectors.MOBILE_POPOVER_TRIGGER_EVENT="a:popover:beforeSlide:preRegistration-secview"+a;this.selectors.MOBILE_GIFTING_DECLARATIVE_NAME="mako-gifting-declarative-mobile";this.selectors.ACCOUNT_LINKING_DECLARATIVE_NAME="mako-preReg-declarative"+a;this.selectors.POPUP_DECLARATIVE_NAME="preReg-popup-window"+a;this.selectors.PAGE_UPDATE_EVENT="a:pageUpdate";this.selectors.INSTALLMENT_ATC_SELECTOR="#installments-button";this.selectors.ADD_TO_CART_SELECTOR="#add-to-cart-button";
this.selectors.BUY_NOW_BUTTON_SELECTOR="#buy-now-button";this.selectors.BUY_NOW_CLICK_EVENT="click.makoPreRegistration";this.selectors.ONE_CLICK_BUTTON_SELECTOR="#one-click-button"},_checkQuantity:function(a){a>this._maxQuantityLimit&&this._isStatusAllowedConditional()?(this._view.scrollGiftingIntoView(),this._disableAccountLinkingCheckbox(),this._metrics.emitALForceUncheckedQuantityHigh(this._asin),this._view.isGiftingAlertHidden()&&this._view.showQuantityAlert()):(this._view.isGiftingChecked()||
(this._enableAccountLinkingCheckbox(g),this._view.hideGiftingAlert()),this._view.hideQuantityAlert())},_giftingCheckboxChecked:function(){this._view.hideQuantityAlert();this._view.showGiftingAlert();this._view.isAccountLinkingChecked()&&this._metrics.emitALForceUncheckedGiftingSelected(this._asin);this._disableAccountLinkingCheckbox()},_giftingCheckboxUnchecked:function(){this._view.hideGiftingAlert();this._enableAccountLinkingCheckbox();this._checkQuantity(this._view.getQuantity())},_enableAccountLinkingCheckbox:function(){this._view.enableInstanceAccountLinkingCheckbox(g);
this._view.setAccountLinkingAttributeValue(g?"true":"false")},_disableAccountLinkingCheckbox:function(){this._view.disableAccountLinkingCheckbox();g=this._view.isAccountLinkingChecked();this._view.setAccountLinkingAttributeValue("false")},_bindEventsOnce:function(){d.on(this.selectors.PAGE_UPDATE_EVENT,this._handlePageUpdate.bind(this));d.on(this.selectors.QUANTITY_CHANGE_EVENT,this._handleQuantityChange.bind(this));d.on(this.selectors.MOBILE_POPOVER_TRIGGER_EVENT,this._handlePopupClickMobile.bind(this));
d.declarative(this.selectors.DETAIL_PAGE_GIFTING_DECLARATIVE_NAME,"click",this._handleGiftingClick.bind(this));d.declarative(this.selectors.DESKTOP_GIFTING_DECLARATIVE_NAME,"click",this._handleGiftingClick.bind(this));d.declarative(this.selectors.MOBILE_GIFTING_DECLARATIVE_NAME,"click",this._handleGiftingClick.bind(this));d.declarative(this.selectors.ACCOUNT_LINKING_DECLARATIVE_NAME,"click",this._handleAccountLinkingClick.bind(this));d.declarative(this.selectors.POPUP_DECLARATIVE_NAME,"click",this._handlePopupClick.bind(this));
d.declarative(this.selectors.POPUP_DECLARATIVE_NAME,"mouseenter",this._handlePopupHover.bind(this))},_bindEventsDOM:function(){l(this.selectors.INSTALLMENT_ATC_SELECTOR).click(this._handleATC.bind(this,"ATC"));l(this.selectors.ADD_TO_CART_SELECTOR).click(this._handleATC.bind(this,"ATC"));l(this.selectors.BUY_NOW_BUTTON_SELECTOR).bind(this.selectors.BUY_NOW_CLICK_EVENT,this._handleATC.bind(this,"BUYNOW"));l(this.selectors.ONE_CLICK_BUTTON_SELECTOR).click(this._handleATC.bind(this,"ONECLICK"))},_handlePageUpdate:function(){this._view.reset();
var a=this._defaultValue;this._showStatus&&(a=this._view.isAccountLinkingChecked());this._view.setAccountLinkingAttributeValue(a?"true":"false")},_handleQuantityChange:function(a){this._checkQuantity(a.value)},_handleGiftingClick:function(a){if(this._isInputEvent(a)||this._isDefaultInstance())this._view.isGiftingChecked()?(this._giftingCheckboxChecked(),this._metrics.emitGiftingCheckedMetric(this._asin)):(this._giftingCheckboxUnchecked(),this._metrics.emitGiftingUncheckedMetric(this._asin))},_handleAccountLinkingClick:function(a){if(this._isInputEvent(a)){var b=
this._view.isAccountLinkingChecked();b?(this._view.uncheckGiftingbox(),this._handleGiftingClick(a),this._metrics.emitALCheckedMetric(this._asin)):this._metrics.emitALUncheckedMetric(this._asin);g=b;this._view.updateAccountLinkingCheckboxes(b);this._view.setAccountLinkingAttributeValue(b?"true":"false")}},_handlePopupClick:function(a){a.$event.preventDefault();a=a.$target.prop("href");this._view.openPopup(a);this._metrics.emitWhyIsThisImportantClickedMetric(this._asin)},_handlePopupClickMobile:function(a){this._metrics.emitWhyIsThisImportantClickedMetric(this._asin)},
_handlePopupHover:function(a){this._metrics.emitPopupHoverMetric(this._asin)},_handleATC:function(a){this._metrics.emitATCGiftingALSelectionMetric(this._asin,a,this._view.isGiftingChecked(),this._view.isAccountLinkingChecked())},_isInputEvent:function(a){return"input"===a.targetTag.toLowerCase()},_isStatusAllowedConditional:function(){return"ALLOWED_CONDITIONAL"===this._status},_isDefaultInstance:function(){return""===this._suffix},getInstanceData:function(){return this._data}});return{getInstance:function(a,
c){c="undefined"===typeof c?"":c;var d=""===c?"default":c;f[d]?a&&f[d].reset(a):f[d]=new b(a,c);return f[d]},reset:function(){Object.keys(f).forEach(function(a){var b=f[a].getInstanceData();f[a].reset(b)})}}});k.when("A","odsRefTagUtils").register("PreRegistration.Metrics",function(d,e){return d.createClass({emitGiftingAndAccountLinkingLoadedMetric:function(c){e.send("PREREGISTRATION_"+c+"_GIFTING_AL_LOADED")},emitGiftingLoadedMetric:function(c){e.send("PREREGISTRATION_"+c+"_ONLY_GIFTING_LOADED")},
emitALForceUncheckedQuantityHigh:function(c){e.send("PREREGISTRATION_"+c+"_AL_FORCE_UNCHECKED_QUANTITYHIGH")},emitALForceUncheckedGiftingSelected:function(c){e.send("PREREGISTRATION_"+c+"_AL_FORCE_UNCHECKED_GIFTINGSELECTED")},emitGiftingCheckedMetric:function(c){e.send("PREREGISTRATION_"+c+"_GIFTING_CHECKED")},emitGiftingUncheckedMetric:function(c){e.send("PREREGISTRATION_"+c+"_GIFTING_UNCHECKED")},emitALCheckedMetric:function(c){e.send("PREREGISTRATION_"+c+"_AL_CHECKED")},emitALUncheckedMetric:function(c){e.send("PREREGISTRATION_"+
c+"_AL_UNCHECKED")},emitWhyIsThisImportantClickedMetric:function(c){e.send("PREREGISTRATION_"+c+"_WHY_IS_THIS_IMPORTANT_CLICKED")},emitPopupHoverMetric:function(c){e.send("PREREGISTRATION_"+c+"_WHY_IS_THIS_IMPORTANT_HOVER")},emitATCGiftingALSelectionMetric:function(c,d,f,h){f?e.send("PREREGISTRATION_"+c+"_"+d+"_GIFTING_CHECKED"):e.send("PREREGISTRATION_"+c+"_"+d+"_GIFTING_UNCHECKED");h?e.send("PREREGISTRATION_"+c+"_"+d+"_AL_CHECKED"):e.send("PREREGISTRATION_"+c+"_"+d+"_AL_UNCHECKED")}})});k.when("A",
"PreRegistration.Controller").execute(function(d,e){d.on("a:accordion:buybox_accordion:select",function(c){e.reset()});d.on("a:accordion:buybox-accordion:select",function(c){e.reset()})})});
/* ******** */
(function(g){var n=window.AmazonUIPageJS||window.P,u=n._namespace||n.attributeErrors,w=u?u("DetailPageAllOffersDisplayAssets",""):n;w.guardFatal?w.guardFatal(g)(w,window):w.execute(function(){g(w,window)})})(function(g,n,u){g.when("A","jQuery").execute("all-offers-display-init",function(w,H){g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-builder","all-offers-display-elements","all-offers-display-delivery-promise-handler","all-offers-display-content-loader","all-offers-display-delivery-promise-expander",
"all-offers-display-state-manager").execute("all-offers-display-pinned-offers",function(f,d,a,b,c,e,m,k,h){function l(){return 0<c.getElement(c.elements.AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT).length}var p=n.ueLogError;f.declarative(a.AOD_PINNED_OFFER_SHOW_MORE_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){try{b.$event.preventDefault(),b.$event.stopPropagation(),c.getElement(c.elements.ADDITIONAL_CONTENT_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),c.getElement(c.elements.SHOW_LESS_LINK_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),
c.getElement(c.elements.SHOW_MORE_LINK_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),l()&&(c.getElement(c.elements.AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT)[1].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS),c.getElement(c.elements.AOD_ATC_STICKY_PRIME_FULL_TEXT)[1].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS)),k.expandPinnedOfferDeliveryMessage(),h.setAodModifiedState(!0)}catch(e){n.ueLogError&&p(e,{logLevel:"ERROR",attribution:"aod",message:"[Error in registering declarative action for pinned offer]"})}});
f.declarative(a.AOD_PINNED_OFFER_SHOW_LESS_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){b.$event.preventDefault();b.$event.stopPropagation();c.getElement(c.elements.ADDITIONAL_CONTENT_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);c.getElement(c.elements.SHOW_LESS_LINK_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);c.getElement(c.elements.SHOW_MORE_LINK_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);l()&&(c.getElement(c.elements.AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT)[1].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS),
c.getElement(c.elements.AOD_ATC_STICKY_PRIME_FULL_TEXT)[1].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS));e.truncatePinnedOfferDeliveryMessage();h.setAodModifiedState(!1)});f.declarative(a.AOD_STICKY_PINNED_OFFER_SHOW_MORE_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){try{b.$event.preventDefault(),b.$event.stopPropagation(),c.getElement(c.elements.STICKY_ADDITIONAL_CONTENT_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),c.getElement(c.elements.STICKY_SHOW_LESS_LINK_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),
c.getElement(c.elements.STICKY_SHOW_MORE_LINK_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS),l()&&(c.getElement(c.elements.AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT)[0].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS),c.getElement(c.elements.AOD_ATC_STICKY_PRIME_FULL_TEXT)[0].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS)),k.expandStickyPinnedOfferDeliveryMessage(),h.setAodModifiedState(!0)}catch(e){n.ueLogError&&p(e,{logLevel:"ERROR",attribution:"aod",message:"[Error in registering declarative action for pinned offer]"})}});
f.declarative(a.AOD_STICKY_PINNED_OFFER_SHOW_LESS_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){b.$event.preventDefault();b.$event.stopPropagation();c.getElement(c.elements.STICKY_ADDITIONAL_CONTENT_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);c.getElement(c.elements.STICKY_SHOW_LESS_LINK_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);c.getElement(c.elements.STICKY_SHOW_MORE_LINK_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);l()&&(c.getElement(c.elements.AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT)[0].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS),
c.getElement(c.elements.AOD_ATC_STICKY_PRIME_FULL_TEXT)[0].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS));e.truncateStickyPinnedOfferDeliveryMessage();h.setAodModifiedState(!1)});f.declarative(a.AOD_PINNED_OFFER_SCROLL_TOP_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){b=b.$event.target.constructor.name;b!==a.HTML_ANCHOR_ELEMENT_KEY&&b!==a.HTML_INPUT_ELEMENT_KEY&&(c.getElement(c.elements.AOD_SCROLL_DIV_KEY)[0].scrollTop=0)})});g.when("A","jQuery","all-offers-display-mash").execute("aod-mash",function(f,
d,a){var b={"add-to-cart":function(b){a.addToCart(b)}};f.declarative("aw-mash-aod",["click"],function(a){"object"===typeof a&&"object"===typeof a.data&&"string"===typeof a.data.buttonID&&"function"===typeof b[a.data.buttonID]&&b[a.data.buttonID](a.data)})});"use strict";g.register("all-offers-display-action-util",function(){return{isExpectedKeyCode:function(f,d){return f.$event.keyCode===d||f.$event.key===d}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-content-loader",
"aod-load-event-handler").execute("all-offers-display",function(f,d,a,b,c){f.state("aod:assetsLoaded",{isAodAssetsLoaded:!0});f.state("aod:assets2Loaded",{isAodAssetsLoaded:!0});f.declarative(a.AOD_SHOW_WIDGET_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(a){c.renderAodAction(a)});f.declarative(a.AOD_CLOSE_WIDGET_ACTION,a.AOD_WIDGET_KEY_HANDLER,function(c){c.type!==a.AOD_WIDGET_TRIGGER_EVENTS&&(c.type!==a.AOD_KEY_DOWN_EVENT||c.$event.keyCode!==a.ENTER_KEY_CODE&&c.$event.key!==a.ENTER_KEY_CODE)||b.closeAod();
c.type!==a.AOD_KEY_DOWN_EVENT||c.$event.keyCode!==a.TAB_KEY_CODE&&c.$event.key!==a.TAB_KEY_CODE||!c.$event.shiftKey||(c.$event.preventDefault(),c.$event.stopPropagation())});f.declarative(a.AOD_CLOSE_BY_ESC_KEY,a.AOD_KEY_DOWN_EVENT,function(c){c.type!==a.AOD_KEY_DOWN_EVENT||c.$event.keyCode!==a.ESC_KEY_CODE&&c.$event.key!==a.ESC_KEY_CODE||b.closeAod()});f.on(a.AOD_CLOSE_FROM_CUSTOM_CONFIGURATOR,function(){b.closeAod()})});g.when("A","jQuery","all-offers-display-constants","search-all-offers-display-util").execute("search-all-offers-display",
function(f,d,a,b){f.state("aod:assetsLoaded",{isAodAssetsLoaded:!0});f.state("aod:assets2Loaded",{isAodAssetsLoaded:!0});f.declarative(a.SEARCH_AOD_SHOW_WIDGET_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(a){b.searchOnClickHandler(a)})});g.when("A","jQuery","all-offers-display-constants").execute(function(f,d,a){f.declarative("ags-expand-text",a.AOD_WIDGET_TRIGGER_EVENTS,a.AOD_KEY_UP_EVENT,function(b){b.$event.preventDefault();b.$event.stopPropagation();var c=b.$target.parents("."+a.AOD_AGS_NOTE_TEXT_SECTION_CLASS);
b=c.find("."+a.AOD_AGS_NOTE__EXPEND_TEXT_SECTION_CLASS);var e=c.find("."+a.AOD_AGS_NOTE_TRUNCATED_TEXT_CLASS),c=c.find("."+a.AOD_AGS_NOTE_TRUNCATED_TEXT_CLASS);e.css(a.AOD_DISPLAY_NONE_STYLE);c.css(a.AOD_DISPLAY_NONE_STYLE);b.css(a.AOD_DISPLAY_BLOCK_STYLE)})});g.when("A","jQuery","all-offers-display-constants").execute("all-offers-atc-prime-offer-block",function(f,d,a){f.declarative(a.AOD_ATC_PRIME_OFFER_MORE_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(b){b.$event.preventDefault();b.$event.stopPropagation();
var c=b.$target.parents("."+a.AOD_ATC_PRIME_OFFER_CLASS);b=c.find("."+a.AOD_ATC_PRIME_TRUNCATED_TEXT_CLASS);c=c.find("."+a.AOD_ATC_PRIME_FULL_TEXT_CLASS);b[0].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS);c[0].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS)})});g.when("A","jQuery","all-offers-display-constants","all-offers-display-delivery-promise-expander").execute("all-offers-display-delivery-promise-actions",function(f,d,a,b){f.declarative(a.AOD_DELIVERY_PROMISE_MORE_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,
function(a){a.$event.preventDefault();a.$event.stopPropagation();b.expandOfferListDeliveryMessage(a)})});g.when("A","jQuery","all-offers-display-constants","all-offers-display-filter-state-manager","all-offers-display-url-builder","all-offers-display-filter-actions","all-offers-display-filter-util","all_offers_display_filter_swatch_manager").execute("all-offers-display-filters",function(f,d,a,b,c,e,m,k){var h=n.uet;f.declarative(a.AOD_SHOW_FILTER_ACTION,a.AOD_WIDGET_KEY_HANDLER,function(b){if(b.type===
a.AOD_WIDGET_TRIGGER_EVENTS||b.type===a.AOD_KEY_DOWN_EVENT&&(13===b.$event.keyCode||13===b.$event.key))e.isFilterOpen()?e.closeFilter():e.openFilter()});f.declarative(a.AOD_CLEAR_ALL_FILTER_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(l){"function"===typeof h&&h("bb",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});l.$event.preventDefault();l.$event.stopPropagation();b.clearAllCheckboxes();m.updateFilterCount(b.getCheckboxState());c.setRefMarker(a.AOD_FILTER_CLEAR_REF_MARKER);m.fetchAodContent(JSON.parse(a.AOD_DEFAULT_CHECKBOX_STATE));
k.updateFilterSwatches();e.closeFilter()});f.declarative(a.AOD_TOGGLE_FILTER_CHECKBOX_ACTION,a.AOD_WIDGET_KEY_HANDLER,function(e){var p=e.data.checkboxID,q=e.data.parentID,d=e.data.refMarker;if(e.type===a.AOD_WIDGET_TRIGGER_EVENTS||e.type===a.AOD_KEY_DOWN_EVENT&&(e.$event.keyCode===a.ENTER_KEY_CODE||e.$event.key===a.ENTER_KEY_CODE))"function"===typeof h&&h("bb",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1}),e.$event.preventDefault(),e.$event.stopPropagation(),b.recordClick(p,q),m.updateFilterCount(b.getCheckboxState()),
d&&c.setRefMarker(d),m.fetchAodContent(b.getCheckboxState()),k.updateFilterSwatches()});f.declarative(a.AOD_FILTER_MOUSE_LEAVE_EVENT,a.AOD_MOUSE_MOVE_EVENT_NAME,function(a){a.$event.preventDefault();a.$event.stopPropagation();e.closeFilter()});f.declarative(a.AOD_SWATCH_EXPAND_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(a){a.$event.preventDefault();a.$event.stopPropagation();k.setExpandedModeTrue();k.updateFilterSwatches()})});g.when("A","jQuery","all-offers-display-constants","all-offers-display-filter-state-manager",
"all-offers-display-url-builder","all-offers-display-filter-actions","all-offers-display-filter-util","all-offers-display-b2b-filter-util","all_offers_display_filter_swatch_manager","all-offers-display-action-util").execute("all-offers-display-b2b-filters",function(f,d,a,b,c,e,m,k,h,l){var p=n.uet;f.declarative(a.AOD_B2B_CLEAR_ALL_FILTER_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,function(l){"function"===typeof p&&p("bb",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});l.$event.preventDefault();l.$event.stopPropagation();
b.clearAllCheckboxes();m.updateFilterCount(b.getCheckboxState());c.setRefMarker(a.AOD_FILTER_CLEAR_REF_MARKER);k.fetchAodContent(JSON.parse(a.AOD_DEFAULT_CHECKBOX_STATE));h.updateFilterSwatches();e.closeFilter()});f.declarative(a.AOD_B2B_TOGGLE_FILTER_CHECKBOX_ACTION,a.AOD_WIDGET_KEY_HANDLER,function(e){var d=e.data.checkboxID,f=e.data.parentID,x=e.data.refMarker;if(e.type===a.AOD_WIDGET_TRIGGER_EVENTS||e.type===a.AOD_KEY_DOWN_EVENT&&l.isExpectedKeyCode(e,a.ENTER_KEY_CODE))"function"===typeof p&&
p("bb",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1}),e.$event.preventDefault(),e.$event.stopPropagation(),b.recordClick(d,f),m.updateFilterCount(b.getCheckboxState()),x&&c.setRefMarker(x),k.fetchAodContent(b.getCheckboxState()),h.updateFilterSwatches()})});g.when("A","jQuery","all-offers-display-pagination").execute("all-offers-display-pagination-action-handler",function(f,d,a){f.declarative("aod-load-offers","click","keyup",a.loadNextPage)});g.when("A","jQuery","all-offers-display-constants").execute("all-offers-display-condition",
function(f,d,a){f.on(a.AOD_POP_OVER_BEFORE_SHOW_EVENT,function(b){d(".a-popover").addClass(a.AOD_POP_OVER_CLASS)});f.on(a.AOD_POP_OVER_BEFORE_HIDE_EVENT,function(b){d(".a-popover").removeClass(a.AOD_POP_OVER_CLASS)});f.declarative(a.AOD_CONDITION_EXPAND_TEXT_ACTION,a.AOD_WIDGET_TRIGGER_EVENTS,a.AOD_KEY_UP_EVENT,function(b){b.$event.preventDefault();b.$event.stopPropagation();var c=b.$target.parents("."+a.AOD_CONDITION_TEXT_SECTION_CLASS);b=c.find("."+a.AOD_CONDITION_TRUNCATED_TEXT_CLASS);var e=c.find("."+
a.AOD_CONDITION_EXPAND_TEXT_CLASS),c=c.find("."+a.AOD_CONDITION_EXPAND_LINK_CLASS);b.css(a.AOD_DISPLAY_NONE_STYLE);e.css(a.AOD_DISPLAY_INLINE_STYLE);c.css(a.AOD_DISPLAY_NONE_STYLE)})});g.when("A","jQuery","all-offers-display-constants","all-offers-display-qty-util","all-offers-display-qty-state-manager","all-offers-display-action-util").execute("all-offers-display-quantity",function(f,d,a,b,c,e){f.declarative(a.AOD_QTY_SELECTOR_ACTIONS,a.AOD_QTY_SELECTOR_SUBMIT_EVENTS,function(d){if(d.type===a.AOD_FOCUS_OUT_EVENT||
d.type===a.AOD_KEY_DOWN_EVENT&&e.isExpectedKeyCode(d,a.ENTER_KEY_CODE))d.$event.preventDefault(),d.$event.stopPropagation(),b.processInputQuantity()&&b.fetchAodContent(c.getSelectedQuantity())});f.declarative(a.AOD_QTY_SELECTOR_ACTIONS,a.AOD_QTY_SELECTOR_VALIDATION_EVENTS,function(){var b=d("#"+a.AOD_QTY_SELECTOR_INPUT_ID).val();"undefined"!==typeof b&&d("#"+a.AOD_QTY_SELECTOR_INPUT_ID).val(b.substr(0,3))})});"use strict";g.when("A","jQuery","mash","all-offers-display-ajax-controller").register("all-offers-display-mash",
function(f,d,a,b){function c(a){a.preventDefault();a.stopPropagation()}function e(a){d("#all-offers-display #atc-spinner").addClass("aod-atc-display-none");a?(d("#all-offers-display #atc-success").removeClass("aod-atc-display-none"),d("#all-offers-display #atc-toast").removeClass("aod-atc-toast-progress-styles"),d("#all-offers-display #atc-toast").addClass("aod-atc-toast-success-styles")):(d("#all-offers-display #atc-failed").removeClass("aod-atc-display-none"),d("#all-offers-display #atc-toast").removeClass("aod-atc-toast-progress-styles"),
d("#all-offers-display #atc-toast").addClass("aod-atc-toast-failure-styles"))}function m(){d("#all-offers-display #atc-toast").removeClass("aod-atc-toast-failure-styles");d("#all-offers-display #atc-toast").removeClass("aod-atc-toast-success-styles");d("#all-offers-display #atc-failed").addClass("aod-atc-display-none");d("#all-offers-display #atc-success").addClass("aod-atc-display-none");d("#all-offers-display #atc-toast").addClass("aod-atc-display-none");d("#all-offers-display #atc-spinner").addClass("aod-atc-display-none");
k.removeClass("stop-scrolling");k.unbind("touchmove touchstart touchend touchcancel",c);d("#all-offers-display #atc-toast-overlay").addClass("aod-atc-display-none")}d=f.$;var k=d("body");return{addToCart:function(h){function l(a){e(0);setTimeout(function(){m()},2E3)}function p(b,c){c&&(e(1),setTimeout(function(){m()},2E3));b=parseInt(b.numActiveItemsInCart,10);a.cart.didUpdate({newCartQuantity:b})}function q(a){a&&a.ok?p(a,!0):a&&"perOfferingRestrictionViolated"===a.error?(m(0),p(a,!1)):l(f.aa_mash_failed_add_to_cart)}
function r(){l(f.aa_mash_failed_add_to_cart)}var f=h.strings;(function(a){d("#all-offers-display #atc-toast-overlay").removeClass("aod-atc-display-none");k.addClass("aod-stop-scrolling");k.bind("touchmove touchstart touchend touchcancel",c);d("#all-offers-display #atc-toast").addClass("aod-atc-toast-progress-styles");d("#all-offers-display #atc-toast").removeClass("aod-atc-display-none");d("#all-offers-display #atc-spinner").removeClass("aod-atc-display-none");b.call("/gp/aw/detail/ajax/add-to-cart/ref\x3d"+
a.refTag,{cache:!1,method:"post",params:a.inputs,timeout:a.timeout,success:q,failure:r})})(h)}}});"use strict";g.when("A").execute(function(f){f.declarative("aod-click-log",["click"],function(d){d=d.data;if("object"===typeof d&&d.type&&"function"===typeof n.uet&&"function"===typeof n.uex){var a="aodc:"+d.type;d.subtype&&(a+=":"+d.subtype);n.uet("bb",a,{wb:1});n.uex("ld",a,{wb:1})}})});g.when("A").register("all-offers-display-ajax-controller",function(f){var d=u,a,b;return{call:function(c,e){d&&d.abort();
a=e.success;b=e.error;e.success=function(b){a(b);d=u};e.error=function(a){b(a);d=u};d=f.ajax(c,e)}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-builder","all-offers-display-elements","all-offers-display-ajax-response-handler","all-offers-display-filter-state-manager","all-offers-display-filter-util","all-offers-display-utils","all-offers-display-state-manager","all-offers-display-ajax-controller","all-offers-display-olplink-handler","all_offers_display_filter_swatch_manager",
"aod-gestalt","aod-gestalt-assets-loader","all-offers-display-search-helper","all-offers-display-qty-util","all-offers-display-html-builder").register("all-offers-display-content-loader",function(f,d,a,b,c,e,m,k,h,l,p,q,r,t,x,v,y,C){function D(b,p){b&&"string"===typeof b&&b.trim()?c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY)&&(c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY)[0].insertAdjacentHTML("beforeend",b),"function"===typeof A&&A("cf",a.AOD_FULL_LOAD_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1}),
f.hide(c.getElement(c.elements.ALL_OFFERS_DISPLAY_SPINNER_KEY)),"0"===d("#"+a.AOD_OFFER_COUNT_HIDDEN_INPUT_HTML_ID).val()?e.noOfferAjaxResponseHandler():e.loadOfferAjaxResponseHandler(),C.createFooterLoadingComponent(),t.isGestalt()&&t.isCustomBuyboxQualified()&&(x.loadAssets(),t.initializeGestaltAod()),k.updateFilterCount(m.getCheckboxState()),r.updateFilterSwatches(),0<k.getSelectedFilterCount(m.getCheckboxState())&&r.triggerFilterSwatchWeblab(),y.initializeQuantity(),l.setAODLoadingState(!1),"function"===
typeof z&&z("ld",a.AOD_FULL_LOAD_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1})):q.redirectToOlp(p)}function E(b,e){b&&b.http&&b.http.status===a.AOD_NO_CONTENT_HTTP_STATUS?q.redirectToOlp(e):(f.hide(c.getElement(c.elements.ALL_OFFERS_DISPLAY_SPINNER_KEY)),B(),e="AllOffersDisplay ajax call error",b&&(b.responseURL?e="AllOffersDisplay ajax call error, URL:"+b.responseURL:b.http&&b.http.responseURL&&(e="AllOffersDisplay ajax call error, URL:"+b.http.responseURL)),g.log("ERROR",e),l.setAODLoadingState(!1),"function"===
typeof z&&z("ld",a.AOD_FULL_LOAD_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1}))}function F(e,d,l){f.show(c.getElement(c.elements.ALL_OFFERS_DISPLAY_SPINNER_KEY));var q=b.getDefaultParameterMap(e);b.addParams(q);b.updateDebugParameter();p.call(b.getAodUrl(),{method:"get",success:function(a){d(a,e)},error:function(a){l(a,e)},timeout:a.AOD_AJAX_TIMEOUT})}function G(){l.setAODOpenState(!0);c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY).show(function(){u({right:"0px"})})}function B(){l.setAODOpenState(!1);var b=
c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY).width()+50;u({right:"-"+b+"px"},function(){c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY).css(a.AOD_DISPLAY_NONE_STYLE)})}function u(b,e){f.animate(c.getElement(c.elements.ALL_OFFERS_DISPLAY_KEY),b,a.AOD_ANIMATION_TIMEOUT,a.AOD_ANIMATION_EASING_TYPE,e)}function w(b){var c=document.getElementById(a.AOD_DISPLAY_RELOAD_ELEMENT_ID);return c&&c.value===a.AOD_TRUE_STATE||l.isAodModified()||v.isSearchPageCall(b.data)?!0:!1}var A=n.uet,z=n.uex;return{loadAllAodBlocks:function(b){w(b)&&
(l.setAODLoadingState(!0),F(b,D,E),c.getElement(c.elements.AOD_DISPLAY_RELOAD).val(a.AOD_FALSE_STATE),l.setAodModifiedState(!1))},showAod:function(e){"function"===typeof A&&A("bb",a.AOD_FULL_LOAD_INCOMPLETE_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});var p=c.getElement(c.elements.AOD_SUPERLEAF_AVAILABILITY_SELECTOR);p&&0<p.size()&&p.css(a.AOD_DISPLAY_ATTRIBUTE_NAME)===a.AOD_DISPLAY_NONE_VALUE&&(p.find("#"+a.AOD_SIDESHEET_HTML_ID)&&p.find("#"+a.AOD_SIDESHEET_HTML_ID).remove(),p.find("#"+a.AOD_BACKGROUND_HTML_ID)&&
p.find("#"+a.AOD_BACKGROUND_HTML_ID).remove());var p=h.getCurrentAsin(e.data),d=k.getConditionFromDeclarativeParams(e.data,a.AOD_CONDITION_ALL_TEXT),q=k.getConditionsApplicableForInputCondition(d),v=l.hasOpeningToClosingStateChanged(q,p);v&&(l.setAodModifiedState(!0),l.setPreviousAsinRetrieved(p));w(e)&&(b.resetParameterMap(),c.resetQueriedElements(),h.resetAODElements(),m.clearAllCheckboxes(),r.setExpandedModeFalse());k.setInitialFiltersIfStateChange(v,d,q);f.show(c.getElement(c.elements.AOD_BACKGROUND_KEY));
c.getElement(c.elements.AOD_BACKGROUND_KEY)&&f.show(c.getElement(c.elements.AOD_BACKGROUND_KEY));h.increaseZIndexSuperleaf();h.decreaseZIndexCNAD();h.disableScroll();G();n.history.state&&n.history.state.page===a.AOD_STATE||n.history.pushState({page:a.AOD_STATE},null);h.disableAppOverlay&&h.disableAppOverlay()},closeAod:function(){l.isAODLoading()&&"function"===typeof z&&z("ld",a.AOD_FULL_LOAD_INCOMPLETE_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});h.decreaseZIndexSuperleaf();h.increaseZIndexCNAD();B();h.enableScroll();
l.setClosingState();b.setRefMarker(a.AOD_AOD_CLOSE_FILTER_CLEAR_REF_MARKER);f.hide(c.getElement(c.elements.AOD_BACKGROUND_KEY));c.getElement(c.elements.AOD_BACKGROUND_KEY)&&f.hide(c.getElement(c.elements.AOD_BACKGROUND_KEY));h.enableAppOverlay&&h.enableAppOverlay();l.resetAODStates()}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-elements","all-offers-display-ajax-response-handler","all-offers-display-filter-state-manager","all-offers-display-filter-util","all_offers_display_filter_swatch_manager",
"all-offers-display-html-builder").register("all-offers-display-b2b-content-loader",function(f,d,a,b,c,e,m,k,h){var l=n.uet,p=n.uex;return{handleAodSuccessResponsePostLoad:function(q,r){b.getElement(b.elements.ALL_OFFERS_DISPLAY_KEY).html(q);m.updateFilterCount(e.getCheckboxState());k.updateFilterSwatches();0<m.getSelectedFilterCount(e.getCheckboxState())&&k.triggerFilterSwatchWeblab();"function"===typeof l&&l("cf",r,{wb:1});b.resetQueriedElements();"0"===d("#"+a.AOD_OFFER_COUNT_HIDDEN_INPUT_HTML_ID).val()?
c.noOfferAjaxResponseHandler():c.loadOfferAjaxResponseHandler();h.createFooterLoadingComponent();"function"===typeof p&&p("ld",r,{wb:1})},handleAodErrorResponsePostLoad:function(a,b){g.log("ERROR",a&&a.responseURL?"AllOffersDisplay ajax call error, URL:"+a.responseURL:"AllOffersDisplay ajax call error");"function"===typeof p&&p("ld",b,{wb:1})}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-pagination","all-offers-display-pagination-display-components","all-offers-display-delivery-promise-handler").register("all-offers-display-ajax-response-handler",
function(f,d,a,b,c,e){return{noOfferAjaxResponseHandler:function(){d("#"+a.AOD_FILTER_OFFER_COUNT_STRING_DIV_ID).addClass(a.AOD_NO_OFFERS_NORMAL_FONT_CLASS);d("#"+a.AOD_SORT_DETAILS_STRING_DIV_ID).css(a.AOD_DISPLAY_NONE_STYLE);d("#"+a.AOD_SCROLL_DIV_HTML_ID).css(a.AOD_OVERFLOW_X_HIDDEN_STYLE);d("#"+a.AOD_OFFER_LIST_HTML_ID).addClass(a.AOD_ZERO_OFFER_CLASS);d("#"+a.AOD_FILTER_NO_OFFER_COLUMN_ID).addClass(a.AOD_FILTER_NO_OFFER_STRING_STYLE_CLASS);d("#"+a.AOD_B2B_SORT_DETAILS_MESSAGE_DIV_ID).css(a.AOD_DISPLAY_NONE_STYLE);
d("#"+a.AOD_FILTER_NO_OFFER_COUNT_HEADING_DIV_ID).removeClass(a.AUI_HIDE_ELEMENT_CSS_NAME);e.executeHandlers();c.hideFooter()},loadOfferAjaxResponseHandler:function(){d("#"+a.AOD_FILTER_OFFER_COUNT_STRING_DIV_ID).removeClass(a.AOD_NO_OFFERS_NORMAL_FONT_CLASS);d("#"+a.AOD_SORT_DETAILS_STRING_DIV_ID).css(a.AOD_DISPLAY_BLOCK_STYLE);d("#"+a.AOD_SCROLL_DIV_HTML_ID).css(a.AOD_OVERFLOW_SCROLL_STYLE);d("#"+a.AOD_OFFER_LIST_HTML_ID).removeClass(a.AOD_ZERO_OFFER_CLASS);d("#"+a.AOD_FILTER_NO_OFFER_COLUMN_ID).removeClass(a.AOD_FILTER_NO_OFFER_STRING_STYLE_CLASS);
d("#"+a.AOD_B2B_SORT_DETAILS_MESSAGE_DIV_ID).css(a.AOD_DISPLAY_INLINE_STYLE);d("#"+a.AOD_FILTER_NO_OFFER_COUNT_HEADING_DIV_ID).addClass(a.AUI_HIDE_ELEMENT_CSS_NAME);b.initialisePagination();e.executeHandlers()}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-html-builder","all-offers-display-content-loader","all-offers-display-url-builder","all-offers-display-url-helper").execute("all-offers-display-enable-compare",function(f,d,a,b,c,e,m){function k(b){var c;var e=0;for(c in a.DP_URL_FORMAT){var d=
a.DP_URL_FORMAT[c];if(-1!==b.indexOf(d)){e=b.indexOf(d)+d.length;break}}0==e?c=null:(e=b.slice(e,e+10),c=/^[0-9][0-9]{8}[0-9X]|[A-Za-z][A-Za-z0-9]{9}$/.test(e)?e:null);if(null==c)return{};e={};e[a.ASIN]=c;b=m.getQueryParamStructFromUrl(b);for(var l in a.AOD_DEFAULT_PARAMS)c=a.AOD_DEFAULT_PARAMS[l],b[c]&&(e[c]=b[c]);return e}function h(d,l){d={data:d};b.createAODContainer();c.showAod(d);(l=m.getRefMarkerFromUrl(l))&&l===a.OLP_AOD_REDIR?e.setRefMarker(a.OLP_AOD_REDIR):e.setRefMarker(a.AUTO_LOAD_AOD);
c.loadAllAodBlocks(d)}-1!==n.location.href.indexOf(a.AOD_ENABLE_AOD_AUTO_LOAD)&&d(n).load(function(){var a=d("[data-action\x3dshow-all-offers-display]");0<a.length&&a.find("a").click()});if(-1!==n.location.href.indexOf(a.HASH_AOD_SMALL)||-1!==n.location.href.indexOf(a.HASH_AOD_CAPS)){f=n.location.href;var l=k(f);l&&l.asin&&h(l,f)}});"use strict";g.when("A","jQuery","all-offers-display-constants").register("all-offers-display-filter-state-manager",function(f,d,a){function b(a,b,c){a?(a=c.indexOf(b),
c=c.slice(0,a).concat(c.slice(a+1))):c.push(b);return c}function c(){for(var b=document.getElementsByClassName(a.AOD_FILTER_CHECKBOX_ID),c=0;c<b.length;c++)if(b[c].classList.contains(a.AOD_FILTER_CHECKBOX_ID))for(var e=b[c].getElementsByTagName(a.AOD_INPUT),d=0;d<e.length;d++)e[d].checked=!1}function e(){c();for(var b=Object.keys(h),e=0;e<b.length;e++)for(var d=h[b[e]],k=0;k<d.length;k++)for(var f=document.querySelectorAll("#"+d[k]),m=0;m<f.length;m++)f[m].classList.contains(a.AOD_FILTER_CHECKBOX_ID)&&
(f[m].getElementsByTagName(a.AOD_INPUT)[0].checked=!0)}function m(a){for(var b=Object.keys(a),c=0;c<b.length;c++)a[b[c]]||delete a[b[c]];return a}var k=JSON.parse(a.AOD_DEFAULT_CHECKBOX_STATE),h={};return{getSelectedFiltersMap:function(){return h},getCheckboxState:function(){return m(k)},setSelectedFiltersMap:function(a){h=a},setCheckboxState:function(a){k=m(a)},clearAllCheckboxes:function(){h={};k=JSON.parse(a.AOD_DEFAULT_CHECKBOX_STATE);c()},recordClick:function(c,d){(c===a.CONDITION_OPEN_BOX||
d===a.CONDITION_OPEN_BOX)&&h[a.CONDITION_USED]&&0<h[a.CONDITION_USED].length&&(h[a.CONDITION_OPEN_BOX]=a.OPENBOX_SELECTED_FILTER,delete h[a.CONDITION_USED]);if(0===d.length){d=h&&h[c]&&0<h[c].length;var f=document.getElementById(a.AOD_SIDESHEET_HTML_ID).getElementsByClassName(c),m=[];d&&(m=h[c]);m=b(d,c,m);if(f&&0<f.length)for(var t=0;t<f.length;t++){var g=f[t];d?delete k[g.id]:k[g.id]=!0;m=b(d,g.id,m)}else k[c]=!d;h[c]=m}else f=[],f.push(d),h[d]&&0<h[d].length&&(f=h[d]),k[c]?(f=b(k[c],c,f),delete k[c]):
(k[c]=!0,f=b(!1,c,f)),1===Object.keys(f).length&&(f=[]),h[d]=f;e();return k},updateCheckboxState:e}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-builder","all-offers-display-pagination","all-offers-display-elements","all-offers-display-ajax-response-handler","all-offers-display-ajax-controller","all-offers-display-filter-state-manager","all_offers_display_filter_swatch_manager").register("all-offers-display-filter-util",function(f,d,a,b,c,e,m,k,h,l){function p(b){e.getElement(e.elements.AOD_OFFER_LIST_KEY).html(b);
"function"==typeof uet&&uet("cf",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});e.getElement(e.elements.AOD_FILTER_OFFER_COUNT_STRING_DIV_KEY).html(d("#"+a.AOD_OFFER_COUNT_STRING_DIV_ID).val());"0"===d("#"+a.AOD_OFFER_COUNT_HIDDEN_INPUT_HTML_ID).val()?m.noOfferAjaxResponseHandler():m.loadOfferAjaxResponseHandler();"function"==typeof uex&&uex("ld",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1})}function q(b,c,e){g.log("ERROR","AllOffersDisplay");"function"==typeof uex&&uex("ld",a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME,
{wb:1})}return{updateFilterCount:function(b){b=Object.keys(b).length-1;0<b?d("#"+a.AOD_FILTER_STRING_ID).text(d("#"+a.AOD_FILTER_SELECTED_COUNT_ID).val()+" ("+b+")"):d("#"+a.AOD_FILTER_STRING_ID).text(d("#"+a.AOD_FILTER_SELECTED_COUNT_ID).val())},getSelectedFilterCount:function(a){return Object.keys(a).length-1},fetchAodContent:function(e){c.resetPagination();b.addParam(a.AOD_FILTER_REQUEST_KEY,JSON.stringify(e));b.addParam(a.AOD_ONLY_RENDER_OFFER_LIST_PARAM,"true");k.call(b.getAodUrl(),{method:"get",
success:p,error:q,timeout:a.AOD_AJAX_TIMEOUT})},getConditionsApplicableForInputCondition:function(b){return b&&(b=b.toLowerCase().trim(),a.CONDITIONS_MAP[b])?(b=a.CONDITIONS_MAP[b],b[a.AOD_CONDITION_ALL_TEXT]=!0,b):JSON.parse(a.AOD_DEFAULT_CHECKBOX_STATE)},getConditionFromDeclarativeParams:function(a,b){return a&&"object"===typeof a&&a.condition?a.condition.toLowerCase().trim():b},setInitialFiltersIfStateChange:function(c,e,d){if(c&&e!==a.AOD_CONDITION_ALL_TEXT){c=Object.keys(d);for(d=0;d<c.length;d++){var k=
c[d];k!==a.AOD_CONDITION_ALL_TEXT&&(k===e?h.recordClick(k,""):h.recordClick(k,e))}b.addParam(a.AOD_FILTER_REQUEST_KEY,JSON.stringify(h.getCheckboxState()))}}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-builder","all-offers-display-pagination","all-offers-display-ajax-controller","all-offers-display-b2b-content-loader").register("all-offers-display-b2b-filter-util",function(f,d,a,b,c,e,m){function k(b){m.handleAodSuccessResponsePostLoad(b,a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME)}
function h(b){m.handleAodErrorResponsePostLoad(b,a.AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME)}return{fetchAodContent:function(d){c.resetPagination();b.addParam(a.AOD_FILTER_REQUEST_KEY,JSON.stringify(d));e.call(b.getAodUrl(),{method:"get",success:k,error:h,timeout:a.AOD_AJAX_TIMEOUT})}}});g.when("A","jQuery","all-offers-display-constants").register("all-offers-display-filter-actions",function(f,d,a){function b(){return!(0<d(c+":visible").length)}var c="#"+a.AOD_FILTER_SHOW_ARROW_ID,e="#"+a.AOD_FILTER_HIDE_ARROW_ID,
m="#"+a.AOD_FILTER_CONTAINER_ID;return{isFilterOpen:b,openFilter:function(){b()||(d(c).css(a.AOD_DISPLAY_NONE_STYLE),d(e).css(a.AOD_DISPLAY_BLOCK_STYLE),d(m).css(a.AOD_DISPLAY_BLOCK_STYLE))},closeFilter:function(){b()&&(d(c).css(a.AOD_DISPLAY_BLOCK_STYLE),d(e).css(a.AOD_DISPLAY_NONE_STYLE),d(m).css(a.AOD_DISPLAY_NONE_STYLE))}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-elements","all-offers-display-delivery-promise-counter").register("all-offers-display-delivery-promise-handler",
function(f,d,a,b,c){function e(b,e,h,k){e=document.querySelectorAll("#"+a.AOD_SIDESHEET_HTML_ID+" "+e);for(var p=0;p<e.length;p++){var f=e[p],l=f.dataset.messageid;if(l&&(b[l]&&!k&&b[l].stopTimer(),!b[l]||!k)){var m;a:{m=h;var q=f.dataset.secondsleft,f=d(f).closest(a.AOD_FASTTRACK_CSS_SELECTOR),f=f[0];if(q&&f&&(q=parseInt(q),0<q)){m=new c.fastTrackCountDown(q,f.id+" "+m);break a}m=void 0}b[l]=m}}return b}function m(a){l(b.getElementIdentifier(b.elements.AOD_OFFER_LIST_KEY),a)}function k(a){l(b.getElementIdentifier(b.elements.AOD_PINNED_OFFER),
a)}function h(a){l(b.getElementIdentifier(b.elements.AOD_STICKY_PINNED_OFFER),a)}function l(c,e){var k=document.querySelectorAll(c+" "+a.AOD_FASTTRACK_CSS_SELECTOR);g(k,r,e,c);k=document.querySelectorAll(c+" "+a.AOD_SCHEDULED_DELIVERY_CSS_SELECTOR);g(k,q,e,c);for(var k=document.querySelectorAll(c+" "+a.AOD_DYNAMIC_DELIVERY_DIV_SELECTOR),h=0;h<k.length;h++){var f=k[h];if(!e||!f.classList.contains(a.AOD_DDM_PROMISE_EXPANDED_CSS_NAME)){var l=f.querySelector(a.AOD_DDM_MESSAGE_DIV_SELECTOR),m=l.firstElementChild;
null!==m&&"BR"===m.tagName&&l.removeChild(m);var t=parseInt(d(f).css("line-height"),10);if(l=l.querySelector(a.AOD_UPSELL_MESSAGE_DIV_SELECTOR))l=l.parentElement;l&&null!==m&&"BR"!==m.tagName&&l.scrollHeight>t&&(m=d(f).closest(a.AOD_DELIVERY_PROMISE_COLUMN_CSS_SELECTOR),p(m[0]),m=m.closest(a.AOD_DELIVERY_PROMISE_CSS_SELECTOR).find(a.AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR),m=m[0],f.classList.add(a.AOD_DDM_PROMISE_EXPANDED_CSS_NAME),l.classList.add(a.AUI_HIDE_ELEMENT_CSS_NAME),c!==b.getElementIdentifier(b.elements.AOD_PINNED_OFFER)&&
c!==b.getElementIdentifier(b.elements.AOD_STICKY_PINNED_OFFER)&&m.classList.remove(a.AUI_HIDE_ELEMENT_CSS_NAME),m.classList.add(a.AOD_DDM_MORE_IDENTIFIER))}}}function p(b){var c=b.parentElement.querySelector(a.AOD_DELIVERY_BOTTOMSHEET_CSS_SELECTOR);if(c){var e=b.cloneNode(!0);e.classList.add(a.AOD_BOTTOM_SHEET_PADDING_CLASS);e.classList.add(a.AOD_DELIVERY_MEASURE_HEIGHT_CSS_NAME);d(b).append(d(e));b.dataset.bottomsheetheight=e.offsetHeight;d(c).append(d(e));e.classList.remove(a.AOD_DELIVERY_MEASURE_HEIGHT_CSS_NAME)}}
function q(b,c,e){b=b.querySelector(a.AOD_SCHEDULED_DELIVERY_ROOT_DIV_SELECTOR);b.insertBefore(c,b.firstElementChild.nextSibling)}function r(b,c,e){var k=b.querySelector(a.AOD_DELIVERY_MESSAGE_DIV_SELECTOR+", "+a.AOD_UPSELL_MESSAGE_DIV_SELECTOR+", "+a.AOD_AMAZON_DAY_MESSAGE_DIV_SELECTOR);e.classList.add(a.AUI_GRID_8_CSS);e.classList.remove(a.AUI_GRID_12_CSS);k.offsetWidth<b.offsetWidth&&((b=k.querySelector("br"))?b.parentNode.insertBefore(c,b):d(k).append(d(c)),e.classList.add(a.AUI_GRID_12_CSS))}
function t(a){return a===u||null==a||0>=a.length?!0:!1}function g(c,e,k,h){for(e=0;e<c.length;e++){var f=c[e],l=f.querySelector(a.AOD_FASTTRACK_UPSELL_DIV_SELECTOR),m=f.querySelector(a.AOD_FASTTRACK_DELIVERY_PROMISE_DIV_SELECTOR);if(t(l)||!(l.classList.contains(a.AOD_FASTTRACK_UPSELL_HIDE_CLASS)||k&&l.classList.contains(a.AOD_FASTTRACK_UPSELL_SHOW_CLASS))){if(!t(l))var q=parseInt(d(l).css("line-height"),10),r=l.scrollHeight;!t(m)&&!t(l)&&r>q&&(f=d(f).closest(a.AOD_DELIVERY_PROMISE_COLUMN_CSS_SELECTOR),
p(f[0]),f=f.closest(a.AOD_DELIVERY_PROMISE_CSS_SELECTOR).find(a.AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR),f=f[0],h!==b.getElementIdentifier(b.elements.AOD_PINNED_OFFER)&&h!==b.getElementIdentifier(b.elements.AOD_STICKY_PINNED_OFFER)&&f.classList.remove(a.AUI_HIDE_ELEMENT_CSS_NAME),l.classList.add(a.AUI_HIDE_ELEMENT_CSS_NAME),l.classList.add(a.AOD_FASTTRACK_UPSELL_HIDE_CLASS))}}}return{executeHandlers:function(b){var c=f.state(a.AOD_PAGE_STATE);"undefined"===typeof c&&(c={});c=e(c,a.AOD_DELIVERY_MESSAGE_DATA_SELECTOR,
a.AOD_DELIVERY_MESSAGE_DIV_SELECTOR,b);c=e(c,a.AOD_UPSELL_MESSAGE_DATA_SELECTOR,a.AOD_UPSELL_MESSAGE_DIV_SELECTOR,b);c=e(c,a.AOD_AMAZON_DAY_MESSAGE_DATA_SELECTOR,a.AOD_AMAZON_DAY_MESSAGE_DIV_SELECTOR,b);f.state(a.AOD_PAGE_STATE,c);k(!0);h(!0);m(b)},truncatePinnedOfferDeliveryMessage:k,truncateStickyPinnedOfferDeliveryMessage:h,truncateOfferListDeliveryMessage:m}});g.when("A","jQuery","all-offers-display-constants").register("all-offers-display-delivery-promise-counter",function(f,d,a){return{fastTrackCountDown:function(b,
c){function e(){var b=new Date,c=b.getHours();k>c&&(c+=24);var g=b.getMinutes(),b=b.getSeconds();l=3600*c+60*g+b;c=f-l;if(1>c&&document.querySelectorAll){var b=document.querySelectorAll(a.AOD_DELIVERY_FASTTRACK),n=!1;if(b){for(g=0;g<b.length;++g)b[g].querySelector("#"+d)?b[g].style.display="none":n=!0;if(n&&(b=document.querySelectorAll("#"+d)))for(g=0;g<b.length;++g)b[g].style.display="none"}}c/=86400;g=Math.floor(c);c=24*(c-g);b=Math.floor(c);c=Math.floor(60*(c-b));p=setTimeout(e,1E3);g=24*g+b;b=
1==g?"hr":"hrs";n=1==c?"min":"mins";g=0==g?c+" "+n:0==c?g+" "+b:g+" "+b+" "+c+" "+n;if(t.length&&(q!=c||r)){for(b=0;n=t[b++];)n.innerHTML=g;q=c;r=!1}}var d=c,k=(new Date).getHours(),f,l,p,q,r=!0,t=function(a){var b=[];if(document.querySelectorAll)for(var c=document.querySelectorAll("#"+d),e=0;e<c.length;++e)for(var f=c[e].querySelectorAll("."+a),k=0;f&&k<f.length;k++)b.push(f[k]);return b}(a.AOD_FASTTRACK_COUNTDOWN_CLASS);1>t.length&&document.getElementById(d)&&document.getElementById(a.AOD_FASTTRACK_COUNTDOWN)&&
t.push(document.getElementById(a.AOD_FASTTRACK_COUNTDOWN));(function(a){var b=new Date,c=b.getHours(),d=b.getMinutes(),b=b.getSeconds();f=3600*c+60*d+b;f+=a;e()})(b);return{stopTimer:function(){clearTimeout(p)}}}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-elements").register("all-offers-display-delivery-promise-expander",function(f,d,a,b){function c(b){if(b.hasClass(a.AOD_DDM_MORE_IDENTIFIER)){var c=b.closest(a.AOD_DELIVERY_PROMISE_CSS_SELECTOR).find(a.AOD_DELIVERY_PROMISE_COLUMN_CSS_SELECTOR).find(a.AOD_DDM_UPSELL_MESSAGE_SELECTOR);
b.addClass(a.AUI_HIDE_ELEMENT_CSS_NAME);c&&(c=c.parent(),c.removeClass(a.AUI_HIDE_ELEMENT_CSS_NAME))}else{var d=b.closest(a.AOD_DELIVERY_PROMISE_CSS_SELECTOR).find(a.AOD_DELIVERY_PROMISE_COLUMN_CSS_SELECTOR),c=d.find(a.AOD_FASTTRACK_UPSELL_DIV_SELECTOR),d=d.find(a.AOD_FASTTRACK_DELIVERY_PROMISE_DIV_SELECTOR);c.removeClass(a.AUI_HIDE_ELEMENT_CSS_NAME);c.addClass(a.AOD_FASTTRACK_UPSELL_SHOW_CLASS);c.removeClass(a.AOD_FASTTRACK_UPSELL_HIDE_CLASS);d.removeClass(a.AUI_HIDE_ELEMENT_CSS_NAME);b.addClass(a.AUI_HIDE_ELEMENT_CSS_NAME)}}
return{expandOfferListDeliveryMessage:function(b){b=d(b.$event.target).closest(a.AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR);c(b)},expandPinnedOfferDeliveryMessage:function(){var e=b.getElementIdentifier(b.elements.AOD_PINNED_OFFER)+" "+a.AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR,e=d(e);c(e)},expandStickyPinnedOfferDeliveryMessage:function(){var e=b.getElementIdentifier(b.elements.AOD_STICKY_PINNED_OFFER)+" "+a.AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR,e=d(e);c(e)}}});g.when("A","jQuery","all-offers-display-elements",
"all-offers-display-polyfill","all-offers-display-constants").register("all-offers-display-pinned-offer-image-animation",function(f,d,a,b,c){function e(){var b=a.getElement(a.elements.AOD_STICKY_PINNED_OFFER),c="-"+b.outerHeight()+"px";b.css({top:c})}var m=0,k=!1,h=null,l=!1,p=!1,q=b.requestAnimationFrame();return{addPinnedOfferImageAnimation:function(){(h=a.getElement(a.elements.AOD_SCROLL_DIV_KEY))?h.scroll(function(){k||(q(function(){var b=h[0].scrollTop;l=m<b?!0:!1;m=h[0].scrollTop;l&&!p&&30<
b?(a.getElement(a.elements.AOD_STICKY_PINNED_OFFER).addClass(c.AOD_STICKY_OFFER_SHOW_POSITION_CLASS),p=!0):!l&&p&&30>b&&(b=a.getElement(a.elements.AOD_STICKY_PINNED_OFFER),e(),b.removeClass(c.AOD_STICKY_OFFER_SHOW_POSITION_CLASS),p=!1);k=!1}),k=!0)}):n.ueLogError&&n.ueLogError({logLevel:"ERROR",attribution:"aod_scroll_element_not_found",message:"[Attempt to add scroll event to AOD scroll element. access undefined element]"})},setStickyOfferTopOffset:e}});"use strict";g.when("A","jQuery","all-offers-display-constants",
"all-offers-display-elements").register("all-offers-display-pagination-display-components",function(f,d,a,b){function c(){b.getElement(b.elements.AOD_FOOTER_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_SPINNER_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_EOR_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_SHOW_MORE_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS)}return{displayEndOfResults:function(){c();
b.getElement(b.elements.AOD_FOOTER_EOR_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS)},displayShowMore:function(){c();b.getElement(b.elements.AOD_FOOTER_SHOW_MORE_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS)},displaySpinner:function(){c();b.getElement(b.elements.AOD_FOOTER_SPINNER_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS);b.getElement(b.elements.AOD_FOOTER_KEY).removeClass(a.AOD_HIDE_ELEMENT_CSS_CLASS)},
hideFooter:function(){b.getElement(b.elements.AOD_FOOTER_KEY).addClass(a.AOD_HIDE_ELEMENT_CSS_CLASS)},hideAllComponents:c}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-pagination-display-components","all-offers-display-url-builder","all-offers-display-elements","all-offers-display-delivery-promise-handler","all-offers-display-ajax-controller","all-offers-display-state-manager").register("all-offers-display-pagination",function(f,d,a,b,c,e,m,k,h){function l(){v*a.AOD_PAGE_SIZE>=
y?0<y&&b.displayEndOfResults():3>v?e.getElement(e.elements.AOD_SCROLL_DIV_KEY).bind("scroll",q):b.displayShowMore()}function p(){e.getElement(e.elements.AOD_SCROLL_DIV_KEY).unbind("scroll",q)}function q(){e.getElement(e.elements.AOD_SCROLL_DIV_KEY)[0].offsetHeight+e.getElement(e.elements.AOD_SCROLL_DIV_KEY)[0].scrollTop+1>=e.getElement(e.elements.AOD_SCROLL_DIV_KEY)[0].scrollHeight&&g()}function g(){var e;e=y>v*a.AOD_PAGE_SIZE?!0:!1;e&&!h.isLoadingOffers()&&("function"==typeof uet&&uet("bb",a.AOD_PAGINATION_CSM_LATENCY_METRIC_SCOPE_NAME,
{wb:1}),v++,h.setLoadingOffersState(!0),c.setRefMarker(a.AOD_PAGINATION_REF_MARKER_PREFIX+v),c.addParam(a.AOD_ONLY_RENDER_OFFER_LIST_PARAM,"true"),c.addParam(a.AOD_PAGE_NO_PARAM,v),b.displaySpinner(),p(),k.call(c.getAodUrl(),{method:"get",success:t,error:x,timeout:a.AOD_AJAX_TIMEOUT}))}function t(c){h.setLoadingOffersState(!1);b.hideFooter();e.getElement(e.elements.AOD_OFFER_LIST_KEY)[0].insertAdjacentHTML("beforeend",c);"function"==typeof uet&&uet("cf",a.AOD_PAGINATION_CSM_LATENCY_METRIC_SCOPE_NAME,
{wb:1});l();m.executeHandlers(!0);"function"==typeof uex&&uex("ld",a.AOD_PAGINATION_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1})}function x(c){h.setLoadingOffersState(!1);b.displayEndOfResults();"function"==typeof uex&&uex("ld",a.AOD_PAGINATION_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});n.ueLogError&&n.ueLogError({logLevel:"ERROR",attribution:"aod_ajax_error",message:"[Ajax call failed]"})}var v,y,u;return{loadNextPage:g,resetPagination:function(){v=1;h.setLoadingOffersState(!1);c.removeParam(a.AOD_ONLY_RENDER_OFFER_LIST_PARAM);
c.addParam(a.AOD_PAGE_NO_PARAM,v);b.hideAllComponents();p()},initialisePagination:function(){u=d("#"+a.AOD_OFFER_COUNT_HIDDEN_INPUT_HTML_ID);y=parseInt(u.val(),10);v=1;h.setLoadingOffersState(!1);l()}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-content-loader","all-offers-display-state-manager").execute("all-offers-display-history-manager",function(f,d,a,b,c){n.onpopstate=function(a){c.isAODOpen()&&b.closeAod()}});g.when("A","jQuery","all-offers-display-filter-state-manager",
"all-offers-display-constants").register("all-offers-display-state-manager",function(f,d,a,b){var c=!1,e=!1,m=!1,k=!1,h=!0,l=JSON.parse(b.AOD_DEFAULT_CHECKBOX_STATE),p=null;return{setAODOpenState:function(a){c=a},setAODLoadingState:function(a){e=a},setBottomSheetOpenState:function(a){m=a},setLoadingOffersState:function(a){k=a},setAodModifiedState:function(a){h=a},setPreviousAsinRetrieved:function(a){p=a},isAODOpen:function(){return c},isAODLoading:function(){return e},isLoadingOffers:function(){return k},
isBottomSheetOpen:function(){return m},isAodModified:function(){return h},getPreviousAsinRetrieved:function(){return p},resetAODStates:function(){k=m=e=c=!1},setClosingState:function(){l=a.getCheckboxState()},hasOpeningToClosingStateChanged:function(a,b){var c=!1;if(a)a:if(c=l,Object.keys(a).length!==Object.keys(c).length)c=!0;else{for(var e=Object.keys(a),d=0;d<e.length;d++){var f=e[d];if(a[f]!==c[f]){c=!0;break a}}c=!1}return b?c||b!==p:c}}});g.register("all-offers-display-constants",function(){return{AOD_RELATIVE_URL:"/gp/aod/ajax",
AOD_WEBLAB_TRIGGER_URL:"/gp/aod/ajax/weblab-trigger.html?",AOD_AJAX_TIMEOUT:1E4,AOD_AJAX_METHOD:"post",AOD_ANIMATION_TIMEOUT:300,AOD_PAGE_SIZE:10,AOD_ANIMATION_EASING_TYPE:"ease-out",AOD_PAGE_STATE:"aodPageState",AOD_REF_MARKER_PREFIX:"/ref\x3d",AOD_WEBLAB_TREATMENT_KEY:"treatment",AOD_WEBLAB_NAME_KEY:"name",WEBLAB_TREATMENT_T1:"T1",WEBLAB_TREATMENT_T2:"T2",WEBLAB_TREATMENT_T3:"T3",WEBLAB_TREATMENT_C:"C",AOD_FUN_LOAD_WEBLAB_DESKTOP:"DP_ALL_OFFERS_DISPLAY_FUN_LOAD_DESKTOP_323159",AOD_FUN_LOAD_WEBLAB_MOBILE:"DP_ALL_OFFERS_DISPLAY_FUN_LOAD_MOBILE_323160",
ENABLE_AOD_ON_IE_WEBLAB:"ALL_OFFERS_DISPLAY_IE_DESKTOP_312902",AOD_REF_MARKER_URL_MATCHER:"/ref\x3d",AOD_SIDESHEET_HTML_ID:"all-offers-display",AOD_SPINNER_HTML_ID:"all-offers-display-spinner",AOD_BACKGROUND_HTML_ID:"aod-background",AOD_SCROLL_DIV_HTML_ID:"all-offers-display-scroller",AOD_OFFER_LIST_HTML_ID:"aod-offer-list",AOD_DEFAULT_PARAMS_ID:"all-offers-display-params",AOD_WEBLAB_TREATMENT_ID:"all-offers-display-weblab-treatment",AOD_WEBLAB_NAME_ID:"all-offers-display-weblab-name",AOD_DISPLAY_RELOAD_ELEMENT_ID:"all-offers-display-reload-param",
AOD_PPD_RIGHT_ELEMENT_ID:"ppd-right",AOD_SUPERLEAF_CSS_CLASS:"superleaf",AOD_TRUE_STATE:"true",AOD_FALSE_STATE:"false",AOD_IS_CUSTOMIZABLE_ASIN_ID:"all-offers-display-is-customizable-asin",AOD_IS_CUSTOM_BUYBOX_QUALIFIED:"aod-is-custom-buybox-qualified",HTML_ANCHOR_ELEMENT_KEY:"HTMLAnchorElement",HTML_INPUT_ELEMENT_KEY:"HTMLInputElement",AOD_CLOSE_FROM_CUSTOM_CONFIGURATOR:"aod-close-from-custom-configuration",AOD_CLOSE_BY_ESC_KEY:"aod-close-on-esc-action",AOD_DIV_FOR_FOCUS:"aod-div-for-focus",AOD_SHOW_WIDGET_ACTION:"show-all-offers-display",
SEARCH_AOD_SHOW_WIDGET_ACTION:"s-show-all-offers-display",AOD_CLOSE_WIDGET_ACTION:"close-all-offers-display",AOD_WIDGET_TRIGGER_EVENTS:"click",AOD_WIDGET_KEY_HANDLER:"click keydown",AOD_HIDE_ELEMENT_CSS_CLASS:"aod-hide",AOD_VISIBILITY_HIDDEN_CSS_CLASS:"aod-visibility-hidden",AOD_FOOTER_HTML_ID:"aod-footer",AOD_FOOTER_EOR_HTML_ID:"aod-end-of-results",AOD_FOOTER_SHOW_MORE_ID:"aod-show-more-offers",AOD_FOOTER_SPINNER_HTML_ID:"aod-offer-load-spinner",AOD_FOOTER_SPINNER_CONTAINER_HTML_ID:"aod-footer-spinner-container",
AOD_OFFER_COUNT_HIDDEN_INPUT_HTML_ID:"aod-total-offer-count",AOD_ONLY_RENDER_OFFER_LIST_PARAM:"isonlyrenderofferlist",AOD_PAGE_NO_PARAM:"pageno",AOD_PAGINATION_REF_MARKER_PREFIX:"aod_page_",AOD_DISPLAY_MAX_HEIGHT_NONE_STYLE:{"max-height":"none"},AOD_DISPLAY_BLOCK_STYLE:{display:"block"},AOD_DISPLAY_NONE_STYLE:{display:"none"},AOD_DISPLAY_ATTRIBUTE_NAME:"display",AOD_DISPLAY_NONE_VALUE:"none",AOD_DISPLAY_INLINE_STYLE:{display:"inline"},AOD_SHOW_FILTER_ACTION:"aod-show-filter-action",AOD_B2B_SHOW_FILTER_ACTION:"aod-b2b-show-filter-action",
AOD_FILTER_CHECKBOX_ID:"aod-filter-checkbox",AOD_NO_OFFERS_NORMAL_FONT_CLASS:"aod-no-offer-normal-font",AOD_INPUT:"input",AOD_TOGGLE_FILTER_CHECKBOX_ACTION:"aod-toggle-filter-checkbox",AOD_CLEAR_ALL_FILTER_ACTION:"aod-filter-clear-all",AOD_B2B_TOGGLE_FILTER_CHECKBOX_ACTION:"aod-toggle-b2b-filter-checkbox",AOD_B2B_CLEAR_ALL_FILTER_ACTION:"aod-b2b-filter-clear-all",AOD_FILTER_SHOW_ARROW_ID:"aod-filter-show",AOD_FILTER_HIDE_ARROW_ID:"aod-filter-hide",AOD_FILTER_CONTAINER_ID:"aod-filter-list",AOD_FILTER_CLEAR_REF_MARKER:"aod_f_clearAll",
AOD_MOBILE_FILTER_APPLY_REF_MARKER:"aod_mf_apply",AOD_AOD_CLOSE_FILTER_CLEAR_REF_MARKER:"aod_f_close",AOD_FILTER_MOUSE_LEAVE_EVENT:"aod-filter-container-hover",AOD_FILTER_NO_OFFER_STRING_STYLE_CLASS:"aod-no-offer-filter-col",AOD_FILTER_NO_OFFER_COLUMN_ID:"aod-no-offer-filter-col-id",AOD_PINNED_OFFER:"aod-pinned-offer",AOD_CONTAINER:"aod-container",AOD_DEFAULT_CHECKBOX_STATE:JSON.stringify({all:!0}),AOD_PINNED_OFFER_SHOW_MORE_ACTION:"aod-pinned-offer-show-more",AOD_PINNED_OFFER_SHOW_LESS_ACTION:"aod-pinned-offer-show-less",
AOD_PINNED_OFFER_SHOW_MORE_DIV_ID:"aod-pinned-offer-show-more-link",AOD_PINNED_OFFER_ADDITIONAL_CONTENT_DIV_ID:"aod-pinned-offer-additional-content",AOD_PINNED_OFFER_SHOW_LESS_DIV_ID:"aod-pinned-offer-show-less-link",AOD_PINNED_OFFER_SCROLL_TOP_ACTION:"aod-pinned-offer-scroll-top",AOD_CONDITION_TEXT_SECTION_CLASS:"expandable-text-section",AOD_CONDITION_TRUNCATED_TEXT_CLASS:"expandable-truncated-text",AOD_CONDITION_EXPAND_TEXT_CLASS:"expandable-expanded-text",AOD_MOQ_BOTTOM_SHEET_CLOSE_ACTION:"aod-moq-sheet-close-action",
AOD_MOQ_BOTTOM_SHEET_SHOW_ACTION:"aod-show-moq-sheet",AOD_BLOCK:"block",AOD_CONDITION_EXPAND_LINK_CLASS:"expandable-expand-action",AOD_CONDITION_REDUCE_LINK_CLASS:"expandable-reduce-action",AOD_CONDITION_EXPAND_TEXT_ACTION:"expand-text",AOD_CONDITION_REDUCE_TEXT_ACTION:"reduce-text",AOD_KEY_UP_EVENT:"keyup",AOD_KEY_DOWN_EVENT:"keydown",AOD_FOCUS_OUT_EVENT:"focusout",AOD_SCROLL_EVENT:"scroll",AOD_LOAD_OFFERS_ACTION_NAME:"aod-load-offers",AOD_OVERFLOW_HIDDEN_STYLE:{overflow:"hidden"},AOD_Z_INDEX_CSS_STYLE:"z-index",
AOD_SUPERLEAF_Z_INDEX_OPEN_VALUE:200,AOD_OVERFLOW_SCROLL_STYLE:{overflow:"scroll"},AOD_MOBILE_OVERFLOW_HIDDEN_STYLE:{overflow:"hidden",position:"fixed"},AOD_MOBILE_OVERFLOW_SCROLL_STYLE:{overflow:"scroll",position:""},AOD_OVERFLOW_X_HIDDEN_STYLE:{"overflow-x":"hidden"},AOD_OFFER_COUNT_STRING_DIV_ID:"aod-total-offer-count-string",AOD_SORT_DETAILS_STRING_DIV_ID:"aod-sort-details-string",AOD_B2B_SORT_DETAILS_MESSAGE_DIV_ID:"aod-b2b-sort-details-message",AOD_FILTER_OFFER_COUNT_STRING_DIV_ID:"aod-filter-offer-count-string",
AOD_FILTER_NO_OFFER_COUNT_HEADING_DIV_ID:"aod-filter-no-offer-count-heading",AOD_FILTER_REQUEST_KEY:"filters",AOD_FILTER_BOTTOM_SHEET_ID:"aod-filter-bottom-sheet-id",AOD_FUNCTION_STRING:"function",AOD_SCRIPT_STRING:"script",AOD_DELIVERY_MESSAGE_DATA_SELECTOR:".aod-delivery-message-data",AOD_UPSELL_MESSAGE_DATA_SELECTOR:".aod-upsell-message-data",AOD_AMAZON_DAY_MESSAGE_DATA_SELECTOR:".aod-amazon-day-message-data",AOD_DELIVERY_MESSAGE_DIV_SELECTOR:"#delivery-message",AOD_UPSELL_MESSAGE_DIV_SELECTOR:"#upsell-message",
AOD_AMAZON_DAY_MESSAGE_DIV_SELECTOR:"#amazon-day-message",AOD_FASTTRACK_CSS_SELECTOR:".aod-fasttrack",AOD_SCHEDULED_DELIVERY_CSS_SELECTOR:".aod-scheduled-delivery",AOD_SCHEDULED_DELIVERY_ROOT_DIV_SELECTOR:"#sd_buybox_root",AOD_DELIVERY_PROMISE_TRUNCATE_CSS_NAME:"aod-delivery-promise-truncate",AOD_DELIVERY_PROMISE_EXPANDED_CSS_NAME:"aod-delivery-promise-expanded",AOD_DELIVERY_PROMISE_COLUMN_CSS_SELECTOR:".aod-delivery-promise-column",AOD_DELIVERY_PROMISE_CSS_SELECTOR:".aod-delivery-promise",AOD_DELIVERY_MORE_ELEMENT_CSS_SELECTOR:".aod-delivery-more",
AOD_DELIVERY_BOTTOMSHEET_CSS_SELECTOR:".delivery_promise_bottomsheet",AOD_DELIVERY_MEASURE_HEIGHT_CSS_NAME:"aod-delivery-measure-height",AOD_DELIVERY_PROMISE_MORE_ACTION:"aod-delivery-more-action",AOD_FASTTRACK_UPSELL_DIV_SELECTOR:".aod-upsell-message",AOD_FASTTRACK_DELIVERY_PROMISE_DIV_SELECTOR:".aod-delivery-promise-message",AOD_FASTTRACK_UPSELL_SHOW_CLASS:"ft-upsell-message-show-show",AOD_FASTTRACK_UPSELL_HIDE_CLASS:"ft-upsell-message-show-hide",AOD_MOBILE_DELIVERY_CLOSE_ACTION:"aod-mobile-delivery-close-action",
AOD_DELIVERY_FASTTRACK:"#fast-track",AOD_FASTTRACK_COUNTDOWN_CLASS:"ftCountdownClass",AOD_FASTTRACK_COUNTDOWN:"ftCountdown",AOD_DYNAMIC_DELIVERY_DIV_SELECTOR:"#dynamicDeliveryMessage",AOD_DDM_MESSAGE_DIV_SELECTOR:"#ddmDeliveryMessage",AOD_DDM_UPSELL_MESSAGE_SELECTOR:"#upsell-message",AOD_DDM_PROMISE_EXPANDED_CSS_NAME:"aod-ddm-promise-expanded",AOD_DDM_MORE_IDENTIFIER:"aod-ddm-identifier",AOD_QTY_SELECTOR_LABEL_ID:"aod-qty-label",AOD_QTY_SELECTOR_INPUT_ID:"aod-qty-selector",AOD_QTY_SELECTOR_ACTIONS:"aod-qty-selector-actions",
AOD_QTY_SELECTOR_SUBMIT_EVENTS:"focusout keydown",AOD_QTY_SELECTOR_VALIDATION_EVENTS:"keyup",AOD_QTY_REQUEST_KEY:"qty",AOD_QTY_REF_MARKER_PREFIX:"aod_qty_",AOD_QTY_SELECTOR_CSM_LATENCY_METRIC_SCOPE_NAME:"aod-qty-load",AUI_HIDE_ELEMENT_CSS_NAME:"aok-hidden",AUI_GRID_8_CSS:"a-span8",AUI_GRID_12_CSS:"a-span12",AOD_BOTTOM_SHEET_PADDING_CLASS:"aod-bottom-sheet-padding",AOD_BOTTOM_SHEET_AGS_NOTE_STATE:"AOD_AGS_NOTE_BOTTOM_SHEET",AOD_STATE:"AOD",AOD_FILTER_SELECTED_COUNT_ID:"aod-filter-count-string",AOD_FILTER_STRING_ID:"aod-filter-string",
AOD_MOBILE_FILTER_DONE_ACTION:"aod-mobile-filter-done-action",AOD_B2B_MOBILE_FILTER_DONE_ACTION:"aod-b2b-mobile-filter-done-action",AOD_AGS_NOTE_TEXT_SECTION_CLASS:"ags-expandable-text-section",AOD_AGS_NOTE__EXPEND_TEXT_SECTION_CLASS:"ags-expandable-expanded-text-li",AOD_AGS_NOTE_EXPAND_LINK_CLASS:"expandable-expand-action",AOD_AGS_NOTE_TRUNCATED_TEXT_CLASS:"ags-expandable-truncated-text",AOD_QTY_PRICING_TABLE_EXPAND_ACTION:"a-qpt-expand-action",AOD_QTY_PRICING_TABLE_SHEET_CLOSE_ACTION:"a-qpt-sheet-close-action",
AOD_ZERO_OFFER_CLASS:"aod-zero-offer-class",AOD_POP_OVER_BEFORE_SHOW_EVENT:"a:popover:beforeShow:aod-image-popover",AOD_POP_OVER_BEFORE_HIDE_EVENT:"a:popover:beforeHide:aod-image-popover",AOD_POP_OVER_CLASS:"aod-popover",AOD_CONDITION_IMAGE_CLICK:"conditionImage-click",AOD_OFFER_INFORMATION_BLOCK:"aod-information-block",AOD_CONDITION_EXPAND_TEXT_MOBILE_ACTION:"expand-text-mobile",AOD_AGS_NOTE_BOTTOM_SHEET_ID:"aod-ags-note-bottom-sheet-",AOD_CONDITION_NOTE_BOTTOM_SHEET_ACTION:"a-condition-note-sheet-close-action",
AOD_PHYSICAL_RENTAL_EXPAND_TEXT_MOBILE_ACTION:"expand-physical-rental-mobile",AOD_PHYSICAL_RENTAL_BOTTOM_SHEET_CLOSE_ACTION:"a-physical-rental-sheet-close-action",AOD_AGS_EXPAND_TEXT_BOTTOM_SHEET:"ags-expand-text-bottom-sheet",AOD_AGS_NOTE_SHEET_CLOSE_ACTION:"aod-ags-note-sheet-close-action",AOD_HIDE_WIDGET_ACTION:"hide-all-offers-display",AOD_BOTTOM_SHEET_TRIGGER:"a:declarative:a-sheet:click",ESC_KEY_CODE:27,SHIFT_KEY_CODE:16,TAB_KEY_CODE:9,ENTER_KEY_CODE:13,AOD_TOUCH_EVENT_NAME:"touchmove",AOD_MOUSE_MOVE_EVENT_NAME:"mouseleave",
AOD_RAFN_SHIPPING_EXPAND_TEXT_BOTTOM_SHEET:"rafn-shipping-expand-text-bottom-sheet",AOD_RAFN_SHIPPING_SHEET_CLOSE_ACTION:"aod-rafn-shipping-sheet-close-action",AOD_DIVERSITY_CERTIFICATIONS_EXPAND_TEXT_BOTTOM_SHEET:"diversity-certifications-bottom-sheet-expand-action",AOD_DIVERSITY_CERTIFICATIONS_SHEET_CLOSE_ACTION:"diversity-certifications-bottom-sheet-close-action",AOD_ATC_PRIME_TRUNCATED_TEXT_ID:"aod-atc-prime-truncated-text-id",AOD_ATC_PRIME_FULL_TEXT_ID:"aod-atc-prime-full-text-id",AOD_PINNED_ATC_PRIME_TRUNCATED_TEXT_CLASS:"aod-pinned-offer-atc-t",
AOD_PINNED_ATC_PRIME_FULL_TEXT_CLASS:"aod-pinned-offer-atc-f",AOD_ATC_PRIME_OFFER_MORE_ACTION:"aod-atc-prime-offer-more-action",AOD_ATC_PRIME_TRUNCATED_TEXT_CLASS:"aod-atc-prime-truncated-text-class",AOD_ATC_PRIME_OFFER_CLASS:"aod-atc-prime-offer-class",AOD_ATC_PRIME_FULL_TEXT_CLASS:"aod-atc-prime-full-text-class",AOD_DECLARATIVE_CLASS:"a-declarative",AOD_CN_AD_ID:"adv-float-div",AOD_CNAD_Z_INDEX_OPEN_VALUE:280,AOD_FILTERS_CSM_LATENCY_METRIC_SCOPE_NAME:"aod-filter-load",AOD_WEBLAB_TRIGGER_CSM_FAILURE_METRIC_SCOPE_NAME:"aod-weblab-trigger-failed",
AOD_PAGINATION_CSM_LATENCY_METRIC_SCOPE_NAME:"aod-pagination-load",AOD_FULL_LOAD_CSM_LATENCY_METRIC_SCOPE_NAME:"aod-full-load",AOD_FULL_LOAD_INCOMPLETE_CSM_LATENCY_METRIC_SCOPE_NAME:"aod-full-load-incomplete",AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME:"aod-search-weblab-check",AOD_BOTTOM_SHEET_MAX_HEIGHT:"-400px",AOD_ATC_PRIME_NOTE_SHEET_CLOSE_ACTION:"aod-atc-prime-note-sheet-close-action",AOD_SCROLL_NONE_ON_SIDE_SHEET_CLASS:"aod-all-offers-display-block-scroll",AOD_GLOW_WIDGET_PLUGIN_NAME:"BottomSheetPlugin",
AOD_PROPERTY_TYPE_FUNCTION:"function",AOD_ATTRIBUTE_CLASS:"class",AOD_ATTRIBUTE_ID:"id",AOD_ATTRIBUTE_HREF:"href",AOD_CLOSEST_FUNCTION:"closest",AOD_NO_CONTENT_HTTP_STATUS:204,AOD_ENABLE_AOD_AUTO_LOAD:"enableAod\x3d1",AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE:"aodWeblabTriggerCallError",AOD_PROPERTY_NOT_SUPPORTED_MESSAGE:"aodPropertyUnsupportedMessage",AOD_SEARCH_WEBLAB_AJAX_FAILURE_CTR:"aodSearchAjaxWeblabCheckFailCtr",AOD_LOG_LEVEL_WARN:"WARN",AOD_LOG_LEVEL_ERROR:"ERROR",AOD_LOG_LEVEL_FATAL:"FATAL",AOD_SWATCH_CONTAINER_ID:"aod-filter-swatch-box",
AOD_SWATCH_CONTAINER_TOP_ID:"aod-filter-swatch-container-top",AOD_SWATCH_EXPAND_STRING_CONTAINER_ID:"aod-filter-swatch-box-expand-div",AOD_SWATCH_CONTAINER_BOTTOM_ID:"aod-filter-swatch-container-bottom",AOD_SWATCH_PREFIX:"aod-swatch-id-",AOD_SWATCH_CLASS_NAME:"aod-filter-swatch",AOD_SWATCH_CLEAL_ALL_LINK_CONTAINER_ID:"aod-filter-swatch-box-clear-all-div",AOD_SWATCH_SEE_ALL_LINK_CONTAINER_ID:"aod-filter-swatch-box-expand-div",AOD_SWATCH_SEE_ALL_LINK_ELEMENT_ID:"aod-filter-swatch-expand-link",AOD_SWATCH_SEE_ALL_CONTAINER_ID:"aod-filter-swatch-box-expand-div",
AOD_SWATCH_WEBLAB_NAME_FORM_ID:"aod-swatch-weblab-name",AOD_SWATCH_WEBLAB_TREATMENT_FORM_ID:"aod-swatch-weblab-treatment",AOD_SWATCH_EXPAND_ACTION:"aod-filter-swatch-expand",AOD_UPDATE_FILTER_SWATCH_ACTION:"aod-filter-swatch-update-action",AOD_FILTER_SWATCH_CLEAR_ALL_ACTION:"aod-filter-swatch-clear-all-action",AOD_SUPERLEAF_AVAILABILITY_SELECTOR:"#superleafActionPanel #new-toggle-buybox, #used-toggle-buybox, #digital-toggle-buybox",AOD_CONDITION_ALL_TEXT:"all",CONDITION_OPEN_BOX:"openBox",CONDITION_USED:"used",
CONDITIONS_MAP:{used:{usedAcceptable:!0,usedGood:!0,usedLikeNew:!0,usedVeryGood:!0},new:{"new":!0},collectible:{collectible:!0},refurbished:{refurbished:!0},sponsored:{sponsored:!0},rental:{rental:!0},all:{all:!0},openbox:{usedAcceptable:!0,usedGood:!0,usedLikeNew:!0,usedVeryGood:!0}},AOD_SELLER_CERTIFICATIONS_ALL_TEXT:"all",SELLER_CERTIFICATIONS_MAP:{all:!0},AOD_FILTERS_ALL_TEXT:"all",OPENBOX_SELECTED_FILTER:["openBox","usedAcceptable","usedGood","usedLikeNew","usedVeryGood"],AOD_PINNED_OFFER_ENABLED_INPUT_ID:"aod-pinned-offer-present",
AOD_STICKY_PINNED_OFFER_CONTAINER:"aod-sticky-pinned-container",AOD_STICKY_PINNED_OFFER:"aod-sticky-pinned-offer",AOD_STICKY_PINNED_OFFER_SHOW_MORE_ACTION:"aod-sticky-pinned-offer-show-more",AOD_STICKY_PINNED_OFFER_SHOW_LESS_ACTION:"aod-sticky-pinned-offer-show-less",AOD_STICKY_PINNED_OFFER_SHOW_MORE_DIV_ID:"aod-sticky-pinned-offer-show-more-link",AOD_STICKY_PINNED_OFFER_ADDITIONAL_CONTENT_DIV_ID:"aod-sticky-pinned-offer-additional-content",AOD_STICKY_PINNED_OFFER_SHOW_LESS_DIV_ID:"aod-sticky-pinned-offer-show-less-link",
AOD_DISPLAY_BLOCK_CLASS:"aod-display-block",AOD_STICKY_OFFER_SHOW_POSITION_CLASS:"aod-sticky-pinned-offer-show-position",B2B_AOD_STICKY_PINNED_OFFER:"b2b-aod-sticky-pinned-offer",ASIN:"asin",PAGE_CONTEXT_SEARCH:"sp",PAGE_CONTEXT_KEY:"pc",HTML_BODY_TAG:"body",AOD_BACKGROUND_CONTENT:"\x3cdiv id\x3d'aod-background' class\x3d'a-section aok-hidden aod-darken-background'\x3e\x3c/div\x3e",AOD_BACKGROUND_DECLARATIVE_CONTENT:"\x3cspan class\x3d'a-declarative' data-action\x3d'close-all-offers-display' data-close-all-offers-display\x3d'{}'\x3e\x3c/span\x3e",
AOD_PAGE_LOAD_ANIMATION_C:"\x3cspan class\x3d'a-spinner a-spinner-medium'\x3e\x3c/span\x3e",AOD_PAGE_LOAD_ANIMATION_T1:"\x3cspan class\x3d'aod-animation-1 aod-page-load-1'\x3e\x3c/span\x3e",AOD_PAGE_LOAD_ANIMATION_T2:"\x3cspan class\x3d'aod-animation-2 aod-page-load-2'\x3e\x3c/span\x3e",HTML_BREAK_TAG:"\x3cbr\x3e",AOD_FOOTER_ANIMATION_C:"\x3cspan id\x3d'aod-offer-load-spinner' class\x3d'aod-hide a-spinner a-spinner-small'\x3e\x3c/span\x3e",AOD_FOOTER_ANIMATION_T1:"\x3cspan id\x3d'aod-offer-load-spinner' class\x3d'aod-hide aod-animation-1 aod-footer-load-1'\x3e\x3c/span\x3e",
AOD_FOOTER_ANIMATION_T2:"\x3cspan id\x3d'aod-offer-load-spinner' class\x3d'aod-hide aod-animation-2 aod-footer-load-2'\x3e\x3c/span\x3e",AOD_SPINNER_CONTAINER_CONTENT:"\x3cdiv id\x3d'all-offers-display-spinner' class\x3d'a-spinner-wrapper aok-hidden'\x3e\x3c/div\x3e",AOD_CONTAINER_CONTENT:"\x3cdiv id\x3d'all-offers-display' class\x3d'a-section'\x3e\x3c/div\x3e",HTML_SPAN_CLOSE_TAG:"\x3c/span\x3e",HTML_TEXT_SIZE_COLOR_BASE:"\x3cspan class\x3d'a-size-base a-color-base'\x3e",AOD_ANIMATION_CONTAINER:"\x3cspan class\x3d'aod-spinner-container'\x3e",
AOD_FUN_STRING_T1:"AOD_FUN_STRING_T1",AOD_FUN_STRING_T2:"AOD_FUN_STRING_T2",AOD_FUN_STRING_T3:"AOD_FUN_STRING_T3",CSS_ANIMATION:"animation",CSS_WEBKIT_ANIMATION:"-webkit-animation",CSS_ANIMATION_VALUE:"1s infinite ease-in-out",HTML_HEAD_TAG:"head",HTML_STYLE_ELEMENT:"\x3cstyle\x3e",AUI_MODAL_STYLES:".a-modal-scroller.a-declarative, .a-popover { z-index: 90003 !important; } #a-popover-lgtbox { z-index: 90002 !important; }",B2B_GB_MODAL_BEFORE_SHOW_POPOVER_EVENT:"a:popover:beforeShow:blocked-atc-button-modal",
B2B_GB_MODAL_INVISIBLE_POPOVER_EVENT:"a:popover:invisible:blocked-atc-button-modal",HASH_AOD_SMALL:"#aod",HASH_AOD_CAPS:"#AOD",OLP_AOD_REDIR:"olp_aod_redir",AUTO_LOAD_AOD:"auto_load_aod",DP_URL_FORMAT:["/dp/","/gp/aw/d/","/product/","/gp/mobile/udp/"],AOD_DEFAULT_PARAMS:["qid","sr","m","me","smid"],EXCLUDED_AOD_AJAX_PARAMS:"url ds_user ds_workspace aodWeblabTreatment assetMismatch fallbackUrl".split(" ")}});"use string";g.when("A","jQuery","all-offers-display-constants").register("all-offers-display-elements",
function(f,d,a){var b={},c={aodFooter:"#"+a.AOD_FOOTER_HTML_ID,aodFooterEOR:"#"+a.AOD_FOOTER_EOR_HTML_ID,aodFooterShowMore:"#"+a.AOD_FOOTER_SHOW_MORE_ID,aodFooterSpinner:"#"+a.AOD_FOOTER_SPINNER_HTML_ID,additionalContent:"#"+a.AOD_PINNED_OFFER_ADDITIONAL_CONTENT_DIV_ID,showMoreLink:"#"+a.AOD_PINNED_OFFER_SHOW_MORE_DIV_ID,showLessLink:"#"+a.AOD_PINNED_OFFER_SHOW_LESS_DIV_ID,stickyAdditionalContent:"#"+a.AOD_STICKY_PINNED_OFFER_ADDITIONAL_CONTENT_DIV_ID,stickyShowMoreLink:"#"+a.AOD_STICKY_PINNED_OFFER_SHOW_MORE_DIV_ID,
stickyShowLessLink:"#"+a.AOD_STICKY_PINNED_OFFER_SHOW_LESS_DIV_ID,hideElement:"."+a.AOD_HIDE_ELEMENT_CSS_CLASS,aodHiddenOfferCountInputDiv:"#"+a.AOD_OFFER_COUNT_STRING_DIV_ID,aodFilterOfferCountStringDiv:"#"+a.AOD_FILTER_OFFER_COUNT_STRING_DIV_ID,allOffersDisplay:"#"+a.AOD_SIDESHEET_HTML_ID,allOffersDisplaySpinner:"#"+a.AOD_SPINNER_HTML_ID,aodBackground:"#"+a.AOD_BACKGROUND_HTML_ID,offerList:"#"+a.AOD_OFFER_LIST_HTML_ID,scrollDiv:"#"+a.AOD_SCROLL_DIV_HTML_ID,filterBottomSheet:"#"+a.AOD_FILTER_BOTTOM_SHEET_ID,
aodPinnedOffer:"#"+a.AOD_PINNED_OFFER,aodStickyPinnedOffer:"#"+a.AOD_STICKY_PINNED_OFFER,aodContainer:"#"+a.AOD_CONTAINER,aodDefaultParams:"#"+a.AOD_DEFAULT_PARAMS_ID,aodWeblabTreatment:"#"+a.AOD_WEBLAB_TREATMENT_ID,aodWeblabName:"#"+a.AOD_WEBLAB_NAME_ID,aodAtcPrimeTruncatedText:"#"+a.AOD_ATC_PRIME_TRUNCATED_TEXT_ID,aodAtcPrimeStickyTruncatedText:"."+a.AOD_PINNED_ATC_PRIME_TRUNCATED_TEXT_CLASS,aodAtcPrimeStickyFullText:"."+a.AOD_PINNED_ATC_PRIME_FULL_TEXT_CLASS,aodAtcPrimeFullText:"#"+a.AOD_ATC_PRIME_FULL_TEXT_ID,
aodDisplayReloadElement:"#"+a.AOD_DISPLAY_RELOAD_ELEMENT_ID,aodSuperleaf:"#"+a.AOD_PPD_RIGHT_ELEMENT_ID+"."+a.AOD_SUPERLEAF_CSS_CLASS,aodSuperleafAvailabilitySelector:a.AOD_SUPERLEAF_AVAILABILITY_SELECTOR,aodIsCustomizableAsin:"#"+a.AOD_IS_CUSTOMIZABLE_ASIN_ID,aodIsCustomBuyboxQualified:"#"+a.AOD_IS_CUSTOM_BUYBOX_QUALIFIED,aodPinnedOfferEnabledId:"#"+a.AOD_PINNED_OFFER_ENABLED_INPUT_ID,aodStickyPinnedOfferContainer:"#"+a.AOD_STICKY_PINNED_OFFER_CONTAINER,aodCNADId:"#"+a.AOD_CN_AD_ID};return{elements:{AOD_FOOTER_KEY:"aodFooter",
AOD_FOOTER_EOR_KEY:"aodFooterEOR",AOD_FOOTER_SHOW_MORE_KEY:"aodFooterShowMore",AOD_FOOTER_SPINNER_KEY:"aodFooterSpinner",ADDITIONAL_CONTENT_KEY:"additionalContent",SHOW_MORE_LINK_KEY:"showMoreLink",SHOW_LESS_LINK_KEY:"showLessLink",STICKY_ADDITIONAL_CONTENT_KEY:"stickyAdditionalContent",STICKY_SHOW_MORE_LINK_KEY:"stickyShowMoreLink",STICKY_SHOW_LESS_LINK_KEY:"stickyShowLessLink",HIDE_ELEMENT_KEY:"hideElement",AOD_HIDDEN_OFFER_COUNT_INPUT_DIV_KEY:"aodHiddenOfferCountInputDiv",AOD_FILTER_OFFER_COUNT_STRING_DIV_KEY:"aodFilterOfferCountStringDiv",
ALL_OFFERS_DISPLAY_KEY:"allOffersDisplay",ALL_OFFERS_DISPLAY_SPINNER_KEY:"allOffersDisplaySpinner",AOD_BACKGROUND_KEY:"aodBackground",AOD_SCROLL_DIV_KEY:"scrollDiv",AOD_OFFER_LIST_KEY:"offerList",AOD_FILTER_BOTTOM_SHEET_KEY:"filterBottomSheet",AOD_PINNED_OFFER:"aodPinnedOffer",AOD_STICKY_PINNED_OFFER:"aodStickyPinnedOffer",AOD_CONTAINER:"aodContainer",AOD_SUPERLEAF_KEY:"aodSuperleaf",AOD_SUPERLEAF_AVAILABILITY_SELECTOR:"aodSuperleafAvailabilitySelector",AOD_DEFAULT_PARAMS:"aodDefaultParams",AOD_WEBLAB_TREATMENT:"aodWeblabTreatment",
AOD_WEBLAB_NAME:"aodWeblabName",AOD_ATC_PRIME_TRUNCATED_TEXT:"aodAtcPrimeTruncatedText",AOD_ATC_STICKY_PRIME_TRUNCATED_TEXT:"aodAtcPrimeStickyTruncatedText",AOD_ATC_PRIME_FULL_TEXT:"aodAtcPrimeFullText",AOD_ATC_STICKY_PRIME_FULL_TEXT:"aodAtcPrimeStickyFullText",AOD_DISPLAY_RELOAD:"aodDisplayReloadElement",AOD_IS_CUSTOMIZABLE_ASIN:"aodIsCustomizableAsin",AOD_IS_CUSTOM_BUYBOX_QUALIFIED:"aodIsCustomBuyboxQualified",AOD_IS_PINNED_OFFER_ENABLED:"aodPinnedOfferEnabledId",AOD_STICKY_PINNED_OFFER_CONTAINER:"aodStickyPinnedOfferContainer",
AOD_CN_AD_ID_KEY:"aodCNADId"},getElement:function(a){if(!b[a]){var f=d(c[a]);f&&(b[a]=f)}if(b[a])return b[a];n.ueLogError&&n.ueLogError({logLevel:"ERROR",attribution:"aod_element_not_found",message:"[Attempt to access undefined element]"})},getElementIdentifier:function(a){return c[a]},resetQueriedElements:function(){for(var a=Object.keys(b),c=0;c<a.length;c++)b[a[c]]=null}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-weblab-helper","all-offers-display-polyfill","all-offers-display-url-helper").register("all-offers-display-olplink-handler",
function(f,d,a,b,c,e){function m(a){if(a&&a.$event&&a.$event.target){a=a.$event.target;if("A"===a.nodeName&&a.href)return a.href;if((a=d(a).closest("a"))&&0<a.length)return a.attr("href")}return null}return{isHyperLink:function(a){return m(a)?!0:!1},redirectToOlp:function(a){(a=m(a))?n.location.href=a:n.ueLogError&&n.ueLogError({logLevel:"ERROR",attribution:"aod_no_href",message:"[Redirection failed since href is null]"})},getRefMarker:function(a){a=a&&a.data&&a.data.url?a.data.url:m(a);return e.getRefMarkerFromUrl(a)},
shouldOpenAOD:function(a){return b.isAodEnabled(a.data)}}});g.when("A","jQuery","all-offers-display-constants","aod-csm-counter","aod-element-details").register("all-offers-display-polyfill",function(f,d,a,b,c){function e(e,d,f){var h=typeof e[d]===f;if(!h){e=c.elementDetailsObject(e);var k=a.AOD_PROPERTY_NOT_SUPPORTED_MESSAGE,k=k+(", element: "+JSON.stringify(e));g.log(k+(", propertyName: "+d+", propertyType: "+f),a.AOD_LOG_LEVEL_WARN,a.AOD_PROPERTY_NOT_SUPPORTED_MESSAGE);b.triggerUnitCounter(a.AOD_PROPERTY_NOT_SUPPORTED_MESSAGE)}return h}
function m(a,b){b=2===arguments.length?b:"inherit";if("CSS"in n&&"supports"in n.CSS)return n.CSS.supports(a,b);if("supportsCSS"in n)return n.supportsCSS(a,b);var c=a.replace(/-([a-z]|[0-9])/ig,function(a,b){return(b+"").toUpperCase()}),e=document.createElement("div");e.style.cssText=a+":"+b;return c in e.style&&""!==e.style[c]}function k(){h===u&&(h=m(a.CSS_ANIMATION,a.CSS_ANIMATION_VALUE)||m(a.CSS_WEBKIT_ANIMATION,a.CSS_ANIMATION_VALUE));return h}var h=u;return{isPropertySupported:e,requestAnimationFrame:function(){return n.requestAnimationFrame||
n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.msRequestAnimationFrame||n.oRequestAnimationFrame||function(a){setTimeout(a,0)}},checkAnimationSupport:k,enableAnimation:function(){var b=document.createElement("a"),b=!e(b,a.AOD_CLOSEST_FUNCTION,a.AOD_PROPERTY_TYPE_FUNCTION),c=k();return!b&&c?!0:!1}}});"use strict";g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-helper").register("all-offers-display-url-builder",function(f,d,a,b){function c(a,b){a&&null!==b&&
(e[a]=b)}var e={},m="",k=null;return{getAodUrl:function(){var b=a.AOD_RELATIVE_URL;m&&(b=b.concat(a.AOD_REF_MARKER_PREFIX+m));k&&c(a.ASIN,k);var d="",f;for(f in e)if(e.hasOwnProperty(f)){var g=encodeURI(f+"\x3d"+encodeURIComponent(e[f]));""!==d&&(d=d.concat("\x26"));d=d.concat(g)}return b=b.concat("?"+d)},addParam:c,addParams:function(b){for(var e in b)k&&e===a.ASIN?c(a.ASIN,k):b.hasOwnProperty(e)&&c(e,b[e])},removeParam:function(a){if(a)return delete e[a]},setRefMarker:function(a){m=a},resetParameterMap:function(){e=
{}},getDefaultParameterMap:function(a){return b.getAodDefaultParams(a.data)},updateDebugParameter:function(){var a=n.location.href;-1!==a.indexOf("isDebug\x3d1")&&c("isDebug","1");-1!==a.indexOf("portalDebug\x3d1")&&c("portalDebug","1")},setOverrideAsin:function(a){k=a},clearOverrideAsin:function(){k=null}}});g.when("A","jQuery","all-offers-display-elements","all-offers-display-constants").register("all-offers-display-url-helper",function(f,d,a,b){function c(a){for(var c={},d=Object.keys(a),f=0;f<
d.length;f++)-1<b.EXCLUDED_AOD_AJAX_PARAMS.indexOf(d[f])||(c[d[f]]=a[d[f]]);return c}return{getAodDefaultParams:function(b){if(b&&b.asin)return c(b);b=a.getElement(a.elements.AOD_DEFAULT_PARAMS);if(null!==b&&0<b.length)return c(b[0].dataset);n.ueLogError&&n.ueLogError({logLevel:"ERROR",attribution:"aod_param_map_not_found",message:"[Attempt to return aodDataSet to load AOD side sheet. empty aodDataSet returned.]"});return{}},getQueryParamStructFromUrl:function(a){var b={};if((a=a.split("?"))&&2!==
a.length)return b;a=a[1];a=a.split("#")[0];if(a=a.split("\x26"))for(var c=0;c<a.length;c++){var d=a[c].split("\x3d");d&&2!==d.length||(b[d[0]]=d[1])}return b},getRefMarkerFromUrl:function(a){if(-1===a.indexOf(b.AOD_REF_MARKER_URL_MATCHER))return null;a=a.split(b.AOD_REF_MARKER_URL_MATCHER)[1];-1!==a.indexOf("?")?a=a.split("?")[0]:-1!==a.indexOf("#")&&(a=a.split("#")[0]);return a&&-1===a.indexOf("aod")?a.replace("olp","aod"):a}}});g.when("A","jQuery","all-offers-display-elements","all-offers-display-constants",
"aod-csm-counter").register("all-offers-display-weblab-helper",function(f,d,a,b,c){function e(a){return a&&"object"===typeof a&&a.aodWeblabName&&a.aodWeblabTreatment?!0:!1}function m(b){if(e(b))return b.aodWeblabTreatment;var c=null,d=a.getElement(a.elements.AOD_WEBLAB_TREATMENT);d&&(c=d.val());return b.aodWeblabTreatment=c}function k(a,d,e){var f=b.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE;a&&a.responseURL&&(f=f+", URL: "+a.responseURL);d&&(f=f+", statusText: "+d);e&&(f=f+", errorThrown: "+e);g.log(f,b.AOD_LOG_LEVEL_ERROR,
b.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE);c.triggerUnitCounter(b.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE)}var h={};return{isAodEnabled:function(a){return(a=m(a))?b.WEBLAB_TREATMENT_T1===a:!0},triggerAodWeblab:function(c){var d=m(c),g;if(e(c))g=c.aodWeblabName;else{var r=null;(g=a.getElement(a.elements.AOD_WEBLAB_NAME))&&(r=g.val());g=c.aodWeblabName=r}var r=b.AOD_WEBLAB_TRIGGER_URL,t;t=/^[CT][0-9]*$/.test(d)?!0:!1;t&&(t=h[c.aodWeblabName.toLowerCase()]?!0:!1,t=!t);t&&(r=r+b.AOD_WEBLAB_TREATMENT_KEY+"\x3d"+
d,d=g&&("string"===typeof g||g instanceof String)?!0:!1,d&&(r=r+"\x26"+b.AOD_WEBLAB_NAME_KEY+"\x3d"+g),d={method:b.AOD_AJAX_METHOD,error:k,timeout:b.AOD_AJAX_TIMEOUT},n.navigator&&navigator.sendBeacon?navigator.sendBeacon(r)||f.ajax(r,d):f.ajax(r,d),h[c.aodWeblabName.toLowerCase()]=!0)}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-elements","all-offers-display-url-helper","all-offers-display-url-builder").register("all-offers-display-utils",function(f,d,a,b,c,e){function m(a){a.preventDefault()}
var k=document.getElementById(a.AOD_BACKGROUND_HTML_ID),h,l;return{resetAODElements:function(){for(var b=document.querySelector("#"+a.AOD_SIDESHEET_HTML_ID).children,c=0;c<b.length;c++)-1!==b[c].className.split(" ").indexOf(a.AOD_DECLARATIVE_CLASS)&&b[c].parentElement.removeChild(b[c])},enableScroll:function(){d("body").css(a.AOD_OVERFLOW_SCROLL_STYLE);k&&document.getElementById(a.AOD_BACKGROUND_HTML_ID).removeEventListener(a.AOD_TOUCH_EVENT_NAME,m)},disableScroll:function(){d("body").css(a.AOD_OVERFLOW_HIDDEN_STYLE);
k&&k.addEventListener(a.AOD_TOUCH_EVENT_NAME,m,{passive:!1})},increaseZIndexSuperleaf:function(){var c=b.getElement(b.elements.AOD_SUPERLEAF_KEY);c&&0<c.size()&&(h=c.css(a.AOD_Z_INDEX_CSS_STYLE),c.css(a.AOD_Z_INDEX_CSS_STYLE,a.AOD_SUPERLEAF_Z_INDEX_OPEN_VALUE))},decreaseZIndexSuperleaf:function(){var c=b.getElement(b.elements.AOD_SUPERLEAF_KEY);c&&0<c.size()&&c.css(a.AOD_Z_INDEX_CSS_STYLE,h)},getCurrentAsin:function(a){if(a&&a.asin)return e.setOverrideAsin(a.asin),a.asin;a=c.getAodDefaultParams(a);
e.clearOverrideAsin();return a.asin},decreaseZIndexCNAD:function(){var c=b.getElement(b.elements.AOD_CN_AD_ID_KEY);c&&0<c.size()&&(l=c.css(a.AOD_Z_INDEX_CSS_STYLE),c.css(a.AOD_Z_INDEX_CSS_STYLE,a.AOD_CNAD_Z_INDEX_OPEN_VALUE))},increaseZIndexCNAD:function(){var c=b.getElement(b.elements.AOD_CN_AD_ID_KEY);c&&0<c.size()&&c.css(a.AOD_Z_INDEX_CSS_STYLE,l)}}});g.when("A").register("aod-csm-counter",function(f){var d=n.ue;return{incrementAndTriggerCounter:function(a){d&&d.count&&d.count(a,(d.count(a)||0)+
1)},triggerUnitCounter:function(a){d&&d.count&&d.count(a,1)}}});g.when("A","jQuery","all-offers-display-constants").register("aod-element-details",function(f,d,a){return{elementDetailsObject:function(b){var c={};b.tagName&&(c.tagName=b.tagName);b.getAttribute&&typeof b.getAttribute===a.AOD_PROPERTY_TYPE_FUNCTION&&(b.getAttribute("id")&&(c.id=b.getAttribute(a.AOD_ATTRIBUTE_ID)),b.getAttribute("class")&&(c.class=b.getAttribute(a.AOD_ATTRIBUTE_CLASS)),b.getAttribute("href")&&(c.href=b.getAttribute(a.AOD_ATTRIBUTE_HREF)));
return c}}});"use strict";g.when("A","jQuery","all-offers-display-constants","all-offers-display-filter-state-manager","all-offers-display-weblab-trigger").register("all_offers_display_filter_swatch_manager",function(f,d,a,b,c){function e(){document.getElementById(a.AOD_SWATCH_SEE_ALL_CONTAINER_ID).classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS)}function m(){document.getElementById(a.AOD_SWATCH_SEE_ALL_CONTAINER_ID).classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS)}function k(b,c){if(Array.isArray(b)){c=
document.getElementById(c).getElementsByClassName(a.AOD_SWATCH_CLASS_NAME);for(var d=0;d<c.length;d++){var e=c[d].getAttribute("id").split(a.AOD_SWATCH_PREFIX)[1];-1<b.indexOf(e)?c[d].classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS):c[d].classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS)}}}var h=[],l=!1;return{updateFilterSwatches:function(){var c;c=document.getElementById(a.AOD_SWATCH_CONTAINER_ID)?!0:!1;if(c){if(!Array.isArray(h)||!h.length){c=document.getElementById(a.AOD_SWATCH_CONTAINER_TOP_ID).getElementsByClassName(a.AOD_SWATCH_CLASS_NAME);
for(var d=0;d<c.length;d++)h.push(c[d].getAttribute("id").split(a.AOD_SWATCH_PREFIX)[1])}d=b.getSelectedFiltersMap();c=[];for(var f=Object.keys(d),g=0;g<h.length;g++)for(var n=0;n<f.length;n++)for(var v=d[f[n]],u=0;u<v.length;u++){var w=v[u];h[g]===w&&c.push(w)}Array.isArray(c)&&c.length?document.getElementById(a.AOD_SWATCH_CONTAINER_ID).classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS):(l=!1,document.getElementById(a.AOD_SWATCH_CONTAINER_ID).classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS));d=[];f=document.getElementById(a.AOD_SWATCH_CONTAINER_TOP_ID).clientWidth;
g=document.getElementById(a.AOD_SWATCH_CLEAL_ALL_LINK_CONTAINER_ID).clientWidth;document.getElementById(a.AOD_SWATCH_SEE_ALL_LINK_ELEMENT_ID).innerText="+99";e();g+=document.getElementById(a.AOD_SWATCH_SEE_ALL_LINK_CONTAINER_ID).clientWidth;m();for(n=0;n<c.length;n++)if(v=document.getElementById(a.AOD_SWATCH_PREFIX+c[n]),v.classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS),u=v.clientWidth,v.classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS),g+=u,g<=f)d.push(c[n]);else break;f=[];for(g=0;g<c.length;g++)-1===
d.indexOf(c[g])&&f.push(c[g]);k(d,a.AOD_SWATCH_CONTAINER_TOP_ID);k(f,a.AOD_SWATCH_CONTAINER_BOTTOM_ID);l?document.getElementById(a.AOD_SWATCH_CONTAINER_BOTTOM_ID).classList.remove(a.AOD_HIDE_ELEMENT_CSS_CLASS):document.getElementById(a.AOD_SWATCH_CONTAINER_BOTTOM_ID).classList.add(a.AOD_HIDE_ELEMENT_CSS_CLASS);!l&&Array.isArray(f)&&f.length?(c=f.length,document.getElementById(a.AOD_SWATCH_SEE_ALL_LINK_ELEMENT_ID).innerText="+"+c,e()):m()}},setExpandedModeTrue:function(){l=!0},setExpandedModeFalse:function(){l=
!1},triggerFilterSwatchWeblab:function(){var b=document.getElementById(a.AOD_SWATCH_WEBLAB_NAME_FORM_ID),d=document.getElementById(a.AOD_SWATCH_WEBLAB_TREATMENT_FORM_ID);b&&d&&c.triggerWeblab(b.value,d.value)}}});g.when("A","jQuery","all-offers-display-constants","aod-csm-counter").register("all-offers-display-weblab-trigger",function(f,d,a,b){function c(c,d,e){var f=a.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE;c&&c.responseURL&&(f=f+", URL: "+c.responseURL);d&&(f=f+", statusText: "+d);e&&(f=f+", errorThrown: "+
e);g.log(f,a.AOD_LOG_LEVEL_ERROR,a.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE);b.triggerUnitCounter(a.AOD_WEBLAB_TRIGGER_FAILURE_MESSAGE)}var e=[];return{triggerWeblab:function(b,d){var h;h=/^[CT][0-9]*$/.test(d)?!0:!1;h&&(h=b&&("string"===typeof b||b instanceof String)?!0:!1);h&&(h=0<=e.indexOf(b)?!0:!1,h=!h);h&&(d=a.AOD_WEBLAB_TRIGGER_URL+a.AOD_WEBLAB_TREATMENT_KEY+"\x3d"+d+"\x26"+a.AOD_WEBLAB_NAME_KEY+"\x3d"+b,h={method:a.AOD_AJAX_METHOD,error:c,timeout:a.AOD_AJAX_TIMEOUT},n.navigator&&navigator.sendBeacon?
navigator.sendBeacon(d)||f.ajax(d,h):f.ajax(d,h),e.push(b))}}});g.when("all-offers-display-elements").register("aod-gestalt",function(f){return{registerAssets:function(d){g.now("gestaltCustomizableProductDetailPage",d).execute(function(a,b){a===u&&g.register("gestaltCustomizableProductDetailPage");b===u&&g.register(d)})},isGestalt:function(){var d=f.getElement(f.elements.AOD_IS_CUSTOMIZABLE_ASIN);return d&&"true"===d.val()},initializeGestaltAod:function(){g.when("A","gestalt-aod-initializer").execute("gestalt-init",
function(d,a){d.trigger("initialize-gestalt-aod")})},isCustomBuyboxQualified:function(){var d=f.getElement(f.elements.AOD_IS_CUSTOM_BUYBOX_QUALIFIED);return d&&"true"===d.val()}}});g.when("aod-gestalt-assets-loader","aod-gestalt").execute("aod-gestalt-assets-initialize",function(f,d){d.isGestalt()&&f.loadAssets()});g.when("aod-gestalt").register("aod-gestalt-assets-loader",function(f){return{loadAssets:function(){f.registerAssets("gestaltDesktopDevice")}}});g.when("A","jQuery","all-offers-display-constants",
"all-offers-display-content-loader","all-offers-display-weblab-helper","all-offers-display-olplink-handler","all-offers-display-url-builder","all-offers-display-polyfill","all-offers-display-pinned-offer-image-animation","all-offers-display-search-helper","all-offers-display-html-builder","all-offers-display-weblab-trigger").register("aod-load-event-handler",function(f,d,a,b,c,e,g,k,h,l,p,q){var r=n.uet;return{renderAodAction:function(d){try{if(d.$event.preventDefault(),d.$event.stopPropagation(),
p.createAODContainer(),e.isHyperLink(d))if(k.isPropertySupported(d.$event.target,a.AOD_CLOSEST_FUNCTION,a.AOD_PROPERTY_TYPE_FUNCTION)||q.triggerWeblab(a.ENABLE_AOD_ON_IE_WEBLAB,a.WEBLAB_TREATMENT_T1),e.shouldOpenAOD(d)||l.isSearchPageCall(d.data)){"function"===typeof r&&r("bb",a.AOD_FULL_LOAD_CSM_LATENCY_METRIC_SCOPE_NAME,{wb:1});b.showAod(d);var f=e.getRefMarker(d);f&&g.setRefMarker(f);b.loadAllAodBlocks(d);l.isSearchPageCall(d.data)||c.triggerAodWeblab(d.data);var n=setInterval(function(){0<document.getElementsByClassName(a.AOD_DIV_FOR_FOCUS).length&&
(clearInterval(n),document.getElementsByClassName(a.AOD_DIV_FOR_FOCUS)[0].focus(),h.setStickyOfferTopOffset(),h.addPinnedOfferImageAnimation())},1E3)}else l.isSearchPageCall(d.data)||c.triggerAodWeblab(d.data),e.redirectToOlp(d)}catch(u){e.redirectToOlp(d)}}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-spinner-builder","all-offers-display-polyfill").register("all-offers-display-html-builder",function(f,d,a,b,c){var e=!1;return{createAODContainer:function(){if(!e){e=!0;
var f=d(a.AOD_BACKGROUND_CONTENT),g=d(a.AOD_BACKGROUND_DECLARATIVE_CONTENT);f.appendTo(g);g.prependTo(a.HTML_BODY_TAG);f=c.enableAnimation()?b.getSpinnerComponent():d(a.AOD_PAGE_LOAD_ANIMATION_C);var g=d(a.AOD_SPINNER_CONTAINER_CONTENT),h=d(a.AOD_CONTAINER_CONTENT);f.appendTo(g);g.appendTo(h);h.prependTo(a.HTML_BODY_TAG)}},createFooterLoadingComponent:function(){var d=document.getElementById(a.AOD_FOOTER_SPINNER_CONTAINER_HTML_ID);c.enableAnimation()?d.innerHTML=b.createFooterElement():d.innerHTML=
a.AOD_FOOTER_ANIMATION_C}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-helper").register("all-offers-display-search-helper",function(f,d,a,b){return{addSearchPageContextDetails:function(c){c&&(c.pc=a.PAGE_CONTEXT_SEARCH);var d={};c.url&&(d=b.getQueryParamStructFromUrl(c.url));for(var f=Object.keys(d),g=0;g<f.length;g++)c[f[g]]=d[f[g]];return c},isSearchPageCall:function(b){return b&&b.pc&&b.pc===a.PAGE_CONTEXT_SEARCH?!0:!1}}});n.amz_js_PopWin=function(f,d,a){n.open(f,
d,a).focus();return!1};"use strict";g.register("all-offers-display-qty-state-manager",function(){var f=1;return{getSelectedQuantity:function(){return f},setSelectedQuantity:function(d){f=d}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-url-builder","all-offers-display-pagination","all-offers-display-ajax-controller","all-offers-display-qty-state-manager","all-offers-display-b2b-content-loader").register("all-offers-display-qty-util",function(f,d,a,b,c,e,g,k){function h(b){k.handleAodSuccessResponsePostLoad(b,
a.AOD_QTY_SELECTOR_CSM_LATENCY_METRIC_SCOPE_NAME)}function l(b){k.handleAodErrorResponsePostLoad(b,a.AOD_QTY_SELECTOR_CSM_LATENCY_METRIC_SCOPE_NAME)}function n(){var b=d("#"+a.AOD_QTY_SELECTOR_INPUT_ID).val();return b?b:1}return{fetchAodContent:function(d){c.resetPagination();b.addParam(a.AOD_QTY_REQUEST_KEY,d);b.setRefMarker(a.AOD_QTY_REF_MARKER_PREFIX+d);e.call(b.getAodUrl(),{method:"get",success:h,error:l,timeout:a.AOD_AJAX_TIMEOUT})},processInputQuantity:function(){var a=n(),b=g.getSelectedQuantity(),
b=a!==b;g.setSelectedQuantity(a);return b},initializeQuantity:function(){var a=n();g.setSelectedQuantity(a)}}});g.when("A","jQuery","all-offers-display-constants","all-offers-display-fun-strings","all-offers-display-weblab-trigger").register("all-offers-display-spinner-builder",function(f,d,a,b,c){return{getSpinnerComponent:function(){var e=a.AOD_ANIMATION_CONTAINER+a.AOD_PAGE_LOAD_ANIMATION_T2,e=e+b.getFunString(a.AOD_FUN_STRING_T2),e=e+a.HTML_SPAN_CLOSE_TAG;c.triggerWeblab(a.AOD_FUN_LOAD_WEBLAB_DESKTOP,
a.WEBLAB_TREATMENT_T2);return d(e)},createFooterElement:function(){return a.AOD_FOOTER_ANIMATION_T2}}});g.when("all-offers-display-constants").register("all-offers-display-fun-strings",function(f){var d={AOD_FUN_STRING_T1:"[Suspenseful music plays]",AOD_FUN_STRING_T2:"Let's have a look...",AOD_FUN_STRING_T3:"♪ Elevator music ♪"};return{getFunString:function(a){return f.HTML_BREAK_TAG+f.HTML_BREAK_TAG+f.HTML_TEXT_SIZE_COLOR_BASE+d[a]+f.HTML_SPAN_CLOSE_TAG}}});g.when("A","jQuery","all-offers-display-constants",
"all-offers-display-search-helper","aod-load-event-handler","all-offers-display-ajax-controller","all-offers-display-olplink-handler","aod-csm-counter").register("search-all-offers-display-util",function(f,d,a,b,c,e,m,k){f.state("aod:assetsLoaded",{isAodAssetsLoaded:!0});var h=n.uex,l=n.uet;return{searchOnClickHandler:function(d){d&&d.data&&b.addSearchPageContextDetails(d.data);var f=a.AOD_WEBLAB_TRIGGER_URL+a.PAGE_CONTEXT_KEY+"\x3d"+a.PAGE_CONTEXT_SEARCH;l("bb",a.AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME,
{wb:1});e.call(f,{method:"post",success:function(b){l("cf",a.AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME,{wb:1});!0===b?(h("ld",a.AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME,{wb:1}),c.renderAodAction(d)):(h("ld",a.AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME,{wb:1}),m.redirectToOlp(d))},error:function(b){var c="AOD Search weblab check ajax call error";b&&(b.responseURL?c=c+", URL:"+b.responseURL:b.http&&b.http.responseURL&&(c=c+", URL:"+b.http.responseURL));g.log("ERROR",c);k.triggerUnitCounter(a.AOD_SEARCH_WEBLAB_AJAX_FAILURE_CTR);
h("ld",a.AOD_SEARCH_WEBLAB_CHECK_LATENCY_METRIC_SCOPE_NAME,{wb:1});m.redirectToOlp(d)},timeout:a.AOD_AJAX_TIMEOUT})}}})})});
/* ******** */
(function(c){var l=window.AmazonUIPageJS||window.P,p=l._namespace||l.attributeErrors,d=p?p("MakoShadowCartAssets",""):l;d.guardFatal?d.guardFatal(c)(d,window):d.execute(function(){c(d,window)})})(function(c,l,p){c.declare("Mako.ShadowCart.Experiments",{EventCycleOrderEnforcement:!0});c.when("A").register("Mako.ShadowCart.Helpers",function(d){function e(b){return[].slice.call(b)}function h(b,d){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);
return b.matches(d)}return{arrayFrom:e,elementMatches:h,keysAsEnum:function(){function b(a,b){a[b]=b;return a}for(var g=e(arguments),a=0,f={};a<g.length;a++)f=d.reduce(Object.keys(g[a]),b,f);return f},selectorMapReducer:function(b,d){return function(a,f){b.hasOwnProperty(f)&&h(d,b[f])&&(a=f);return a}}}});c.declare("Mako.ShadowCart.Selectors",{AddToCartButton:"#add-to-cart-button",BuyBox:"#buybox",BuyNowButton:"#buy-now-button",DesktopRightColumn:"#rightCol",DesktopBuybox:"#desktop_buybox",InstallmentButton:"#installments-button",
LightningDealButton:"#goldboxBuyBox button",MobileAppBuybox:"#mobileapp_buybox_feature_div",MobileWebBuybox:"#mobile_buybox_feature_div",PreOwnedCrossSellButton:"span#preOwnedCrossSellCertRefurb-addToCart input",UsedDesktopButton:"#add-to-cart-button-ubb",UsedMobileButton:"#add-to-cart-button-ubb-mobile"});c.declare("Mako.ShadowCart.EventNames",{AtcIntention:"shadowcart:atc:intention",AtcSubmitted:"shadowcart:atc:submitted",AuiMashAtc:"dpx:add-to-cart:success",MakoCommonCartRequestComplete:"mako:common-cart-request:complete"});
c.when("A","Mako.ShadowCart.Selectors","Mako.ShadowCart.Helpers").register("Mako.ShadowCart.Checkout",function(d,e,h){var b={BuyNow:e.BuyNowButton,AddToCart:e.AddToCartButton,Installment:e.InstallmentButton,UsedDesktop:e.UsedDesktopButton,UsedMobile:e.UsedMobileButton,PreOwnedCrossSell:e.PreOwnedCrossSellButton,LightningDeal:e.LightningDealButton};return{Types:h.keysAsEnum(b,{Unknown:"Unknown"}),getTypeByClickTarget:function(e){return e?d.reduce(Object.keys(b),h.selectorMapReducer(b,e),"Unknown"):
"Unknown"}}});c.when("A","Mako.ShadowCart.Selectors","Mako.ShadowCart.Helpers").register("Mako.ShadowCart.Cbb",function(d,e,h){var b,g={MobileWebBuybox:e.MobileWebBuybox,MobileAppBuybox:e.MobileAppBuybox,DesktopBuybox:e.DesktopBuybox};return{Types:h.keysAsEnum(g,{Unknown:"Unknown"}),getType:function(){var a;(a=b)||(a=(a=document.querySelector(e.BuyBox))&&a.parentElement?d.reduce(Object.keys(g),h.selectorMapReducer(g,a.parentElement),"Unknown"):"Unknown");return b=a}}});c.register("Mako.ShadowCart.MetricsVars",
function(){return{UeCountIncrement:1,Suffixes:{ForBeginKey:":bb",ForEndKey:":be",ForPerformanceMeasureKey:":performance"},Keys:{AtcIntention:"shadowcart:atc-intention",AtcSubmitted:"shadowcart:atc-submitted",PreAtcEventQueue:"shadowcart:pre-atc-events",PostAtcEventQueue:"shadowcart:post-atc-events",IntentionToSubmission:"shadowcart:atc-intention-submitted"}}});c.when("Mako.ShadowCart.MetricsVars").register("Mako.ShadowCart.Metrics",function(d){function e(a,b){return"string"===typeof a?a.replace(b,
"")+b:null}function h(a,b){b=b||d.UeCountIncrement;l.ue&&l.ue.count&&l.ue.count(a,b)}var b=l.performance,g=!!(b&&b.mark&&b.measure&&b.getEntriesByName);return{markCount:h,markPerformanceBegin:function(a){(a=e(a,d.Suffixes.ForBeginKey))&&g&&b.mark(a)},markPerformanceEnd:function(a){var f=e(a,d.Suffixes.ForEndKey);if(f&&g){b.mark(f);var c=e(a,d.Suffixes.ForBeginKey);a=e(a,d.Suffixes.ForPerformanceMeasureKey);c&&f&&a&&(b.measure(a,c,f),f=b.getEntriesByName(a),0<f.length&&(f=f.pop())&&h(a,f.duration))}}}});
c.when("A","Mako.ShadowCart.Cbb","Mako.ShadowCart.Checkout","Mako.ShadowCart.EventNames","Mako.ShadowCart.Experiments","Mako.ShadowCart.Metrics","Mako.ShadowCart.MetricsVars").register("Mako.ShadowCart.CaptureAtcIntention",function(d,e,h,b,g,a,f){function c(r){return function(c){if(g.EventCycleOrderEnforcement){r.stopListening();var n=c.target,k=c.currentTarget}else n=c.target||null,k=c.currentTarget||null;if(n&&k){var q=h.getTypeByClickTarget(n);if(q!==h.Types.Unknown){a.markPerformanceBegin(f.Keys.IntentionToSubmission);
a.markCount(f.Keys.AtcIntention);a.markCount(f.Keys.AtcIntention+":"+q.toLowerCase());if(g.EventCycleOrderEnforcement)k=d.$(n).closest("form"),k=k.length?k[0]:null;else a:{for(var m=n.parentElement;m&&m!==k;m=m.parentElement)if("form"===m.nodeName.toLowerCase()){k=m;break a}k=null}m=e.getType();c={captureInstance:r,cbbType:m,checkoutButton:n,checkoutType:q,event:c,form:k};l(c,k,[b.AuiMashAtc,b.MakoCommonCartRequestComplete]);d.trigger(b.AtcIntention,c)}}}}function l(c,e,h){var k=function(){a.markPerformanceEnd(f.Keys.IntentionToSubmission);
a.markCount(f.Keys.AtcSubmitted);a.markCount(f.Keys.AtcSubmitted+":"+c.checkoutType.toLowerCase());d.trigger(b.AtcSubmitted,c);e&&e.removeEventListener("submit",k);d.each(h,function(a){d.off(a,k)});g.EventCycleOrderEnforcement&&c.captureInstance.startListening()};e&&e.addEventListener("submit",k);d.each(h,function(a){d.on(a,k)})}return function(a){var b=c(this);this.startListening=function(){a&&a.addEventListener("click",b,!0)};this.stopListening=function(){a&&b&&a.removeEventListener("click",b,!0)}}});
c.when("A","Mako.ShadowCart.CaptureAtcIntention","Mako.ShadowCart.EventNames","Mako.ShadowCart.Metrics","Mako.ShadowCart.MetricsVars","Mako.ShadowCart.Selectors").register("Mako.ShadowCart",function(d,e,c,b,g,a){function f(a){b.markPerformanceBegin(g.Keys.PreAtcEventQueue);b.markPerformanceEnd(g.Keys.PreAtcEventQueue)}function l(){b.markPerformanceBegin(g.Keys.PostAtcEventQueue);b.markPerformanceEnd(g.Keys.PostAtcEventQueue)}if(a=document.querySelector(a.DesktopRightColumn)||document.querySelector(a.BuyBox)||
null)d.on(c.AtcIntention,f),d.on(c.AtcSubmitted,l),(new e(a)).startListening()})});
/* ******** */
(function(c){var a=window.AmazonUIPageJS||window.P,e=a._namespace||a.attributeErrors,d=e?e("MakoCommonMetricAssets",""):a;d.guardFatal?d.guardFatal(c)(d,window):d.execute(function(){c(d,window)})})(function(c,a,e){c.now("mako-metric-logger").execute("MakoMetricLoggerEmpty",function(a){a||c.when("A").register("mako-metric-logger",function(a){function b(){}return{increment:b,update:b,counter:b,timer:b,suffixed:b}})});"use strict";c.now("mako-reftag-logger").execute("ReftagLoggerExecute",function(a){a||
c.when("A").register("mako-reftag-logger",function(a){function b(){}function c(a){if(!a)throw Error("refTag is not defined");d.post("/gp/digital/fiona/ajax/log.html/ref\x3d"+a)}var d=a.$;return{increment:c,update:b,counter:function(a){return function(){c(a)}},timer:b,suffixed:function(a,b){return function(c){return a(b+":"+c)}}}})});"use strict";c.now("mako-csm-logger").execute("MakoCsmLoggerExecute",function(d){d||c.when("A").register("mako-csm-logger",function(c){function b(){}function d(){return a.ue&&
"function"===typeof a.ue.count?a.ue.count:b}function e(a){if(a){var b=d();b(a,(b(a)||0)+1)}}function g(a,b){a&&"number"===typeof b&&d()(a,b)}function h(a){var b=d();return function(c){b(a,c)}}function k(b){var c=function(){return{stop:function(){}}};if(a.performance&&"function"===typeof a.performance.now)var l=d(),c=function(){var c=a.performance.now();return{stop:function(){var d=a.performance.now()-c;l(b,d)}}};return{start:c}}function f(a,b){return function(c){return a(b+":"+c)}}return a.ue&&"function"===
typeof a.ue.count?{increment:e,update:g,counter:h,timer:k,suffixed:f}:{increment:b,update:b,counter:b,timer:b,suffixed:b}})});"use strict";c.now("mako-csa-logger").execute("MakoCsaLoggerExecute",function(d){d||c.when("A").register("mako-csa-logger",function(c){function b(){}function d(a,b){f("recordMetric",a,b)}function e(a){f("recordMetric",a,1)}function g(a){return function(b){d(a,b)}}function h(a,b){return function(c){return a(b+":"+c)}}function k(b){var c=function(){return{stop:function(){}}};
a.performance&&"function"===typeof a.performance.now&&(c=function(){var c=a.performance.now();return{stop:function(){var e=a.performance.now()-c;d(b,e)}}});return{start:c}}var f;if(a.csa&&"function"===typeof a.csa&&(f=a.csa("Metrics",{producerId:"mako-ml"}),"function"===typeof a.csa))return{increment:e,update:d,counter:g,timer:k,suffixed:h};f=b;return{increment:b,update:b,counter:b,timer:b,suffixed:b}})})});
/* ******** */
(function(h){var k=window.AmazonUIPageJS||window.P,l=k._namespace||k.attributeErrors,c=l?l("AmazonDevicesDetailPageAssets",""):k;c.guardFatal?c.guardFatal(h)(c,window):c.execute(function(){h(c,window)})})(function(h,k,l){h.when("A","ods-country-picker-view","ods-country-picker-model","ods-url-utils").register("ods-country-picker-controller",function(c,d,a,g){function f(b,c){this.$el="string"===typeof b?e("#"+b):b;this.view=new d(this.$el);this.model=new a(c);this._handleInitialPageLoad()}var e=c.$;
f.prototype={_handleInitialPageLoad:function(){var b=g.getUrlParam("country");null!==b&&this.view.selectCountry(b);this.onCountrySelectChange()},_handleMarketplaceRedirect:function(b,a){b=this.model.getMarketplaceStrings(b,a);this.view.showMarketplaceMessage(b);this.view.disableBuyBox(this.model.getDisabledBuyBoxString(!0))},_handleNoCountrySelected:function(){this.view.hideMessage();this.view.disableBuyBox(this.model.getDisabledBuyBoxString(!1))},_handleNoShip:function(b){b=this.model.getNoShipString(b);
this.view.showNoShipMessage(b);this.view.disableBuyBox(this.model.getDisabledBuyBoxString(!0))},_handleYesShip:function(b,a,c){a=this.model.getCountryOverrideString(a);c=this.model.getYesShipString(c);this.view.showYesShipMessage(c,a);this.view.updateBuyBox(b,this.model.getOfferListingForAsin(b));this.view.enableBuyBox()},onCountrySelectChange:function(){var b=this.view.getSelectedCountry(),a=this.model.getValidShippingAsin(b.code);c.objectIsEmpty(b.code)?this._handleNoCountrySelected():this.model.isEmbargo(b.code)?
this._handleNoShip(b.name):this.model.hasDedicatedMarketplace(b.code)?this._handleMarketplaceRedirect(b.code,b.name):c.objectIsEmpty(a)?this._handleNoShip(b.name):this._handleYesShip(a,b.code,b.name)}};return f});"use strict";h.when("ods-country-picker-controller").register("ods-country-picker-controller-factory",function(c){return{get:function(d,a){return new c(d,a)}}});h.when("ods-country-picker-controller-factory").register("ods-country-picker",function(c){return c});"use strict";h.when("A").register("ods-country-picker-model",
function(c){function d(a){this._asinToOfferListing=c.parseJSON(a.asinToOfferListingJson);this._countryData=c.parseJSON(a.countryDataJson);this._globalStrings=c.parseJSON(a.globalStringsJson).strings?c.parseJSON(a.globalStringsJson).strings:c.parseJSON(a.globalStringsJson);this._providerToAsin=c.parseJSON(a.providerToAsinJson)}d.prototype={getCountryOverrideString:function(a){return this._countryData[a].legalInformation},getDisabledBuyBoxString:function(a){return!0===a?this._globalStrings["ods-country-picker-disable-buy-box-invalid-selection"]:
this._globalStrings["ods-country-picker-disable-buy-box-no-selection"]},getMarketplaceStrings:function(a,c){var d=this._countryData[a].gatewayName;return{gatewayLink:this._countryData[a].gatewayUrl,gatewayName:d,headerString:this._globalStrings["ods-country-picker-yes-ship-from-other-marketplace-1"]+" "+c+" "+this._globalStrings["ods-country-picker-yes-ship-from-other-marketplace-2"]+" "+d+".",bodyString:this._globalStrings["ods-country-picker-yes-ship-from-other-marketplace-3"]+" "+c+this._globalStrings["ods-country-picker-yes-ship-from-other-marketplace-4"]+
" "}},getNoShipString:function(a){return this._globalStrings["ods-country-picker-no-ship-text"]+" "+a+"."},getOfferListingForAsin:function(a){return this._asinToOfferListing[a]},getValidShippingAsin:function(a){if(c.objectIsEmpty(a))return null;a=this._countryData[a].provider;a=c.objectIsEmpty(a)?null:this._providerToAsin[a];var d=this._providerToAsin.wifi;return c.objectIsEmpty(a)?c.objectIsEmpty(d)?null:d:a},getYesShipString:function(a){return this._globalStrings["ods-country-picker-yes-ship-text"]+
" "+a+"."},hasDedicatedMarketplace:function(a){return!c.objectIsEmpty(this._countryData[a].gatewayUrl)},isEmbargo:function(a){return this._countryData[a].isEmbargo}};return d});"use strict";h.when("A","legacy-popover").register("ods-country-picker-view",function(c){function d(b){b.removeAmazonPopoverTrigger&&b.removeAmazonPopoverTrigger()}function a(b,a){b.amazonPopoverTrigger({attached:!0,hoverHideDelay:0,hoverShowDelay:250,literalContent:g("ods-cp-disabled-buy-box-popover",a),location:"left",locationAlign:"middle",
locationMargin:5,showCloseButton:!1,showOnHover:!0,skin:null,width:"auto"})}function g(b,a){return'\x3cdiv class\x3d"'+b+'"\x3e'+a+"\x3c/div\x3e"}function f(b){this.$el=b;this.$addToCartButton=e("#submit\\.add-to-cart");this.$buyNowButton=e("#submit\\.buy-now");this.$buyBoxAsin=e("#ASIN");this.$buyBoxOfferListing=e("#offerListingID");this.$countryDropdown=this.$el.find(".ods-cp-select");this.$message=this.$el.find(".ods-cp-msg");this.$oneClickButton=e("#oneClickAvailable .a-button");this.addToCartTitle=
e("#add-to-cart-button").attr("title")}var e=c.$;f.prototype={disableBuyBox:function(b){this.$addToCartButton.addClass("a-button-disabled");0<this.$oneClickButton.length&&this.$oneClickButton.addClass("a-button-disabled");this.$buyNowButton.addClass("a-button-disabled");var c="To "+this.addToCartTitle+",\x3cbr/\x3e"+b;b="To Buy Now,\x3cbr/\x3e"+b;d(this.$addToCartButton);d(this.$buyNowButton);a(this.$addToCartButton,c);a(this.$buyNowButton,b)},enableBuyBox:function(){this.$addToCartButton.removeClass("a-button-disabled");
0<this.$oneClickButton.length&&this.$oneClickButton.removeClass("a-button-disabled");this.$buyNowButton.removeClass("a-button-disabled");d(this.$addToCartButton);d(this.$buyNowButton)},getSelectedCountry:function(){var b=this.$countryDropdown.find(":selected");return{code:b.val(),name:b.text()}},hideMessage:function(){this.$message.hide()},selectCountry:function(b){this.$countryDropdown.val(b)},showMarketplaceMessage:function(b){var a=b.bodyString+('\x3ca href\x3d"'+b.gatewayLink+'" target\x3d"_blank"\x3e'+
b.gatewayName+"\x3c/a\x3e.");b=g("ods-cp-yes-ship-text",b.headerString);a=g("ods-cp-msg-text",a);this.showMessage(b+a)},showMessage:function(b){this.$message.html(b).show()},showNoShipMessage:function(b){b=g("ods-cp-no-ship-text",b);this.showMessage(b)},showYesShipMessage:function(b,a){b=g("ods-cp-yes-ship-text",b);"undefined"!==typeof a&&(b+=g("ods-cp-msg-text",a));this.showMessage(b)},updateBuyBox:function(b,a){this.$buyBoxAsin.val(b);this.$buyBoxOfferListing.val(a)}};return f});"use strict";h.when("singleton-popup-modal",
"a-dropdown","jQuery","csmCounter").register("quantity-restriction-messaging",function(c,d,a,g){return{quantityModal:function(f){var e=a("#quantity"),b=a("#cspQuantity"),n=function(){var a={};return"lastQuantityOption"===e.find("option:selected").attr("data-a-id")?(a.id=e,a.dropdown="quantity",a.popoverTitle=f.popoverTitle,a.message=f.message,a.plusOne=f.moq,a):"lastQuantityOption"===b.find("option:selected").attr("data-a-id")?(a.id=b,a.dropdown="cspQuantity",a.popoverTitle=f.popoverTitle,a.message=
f.cspMessage,a.plusOne=f.cspMOQ,a):null},m=function(){var a=n();null!==a&&a.message&&(c.show({width:502,position:"triggerRight",header:a.popoverTitle,inlineContent:a.message.replace(/MAX_QUANTITY_PLUS_ONE/g,a.plusOne)},!0),a.id.selectedIndex=0,(a=d.getSelect(a.dropdown))&&a.getOption(0).update({selected:!0}),g.increment("last-quantity-option-click-count"))};e.change(m);b.change(m);m()}}});"use strict";h.when("A").register("installments-checkbox-module",function(c){var d=c.$,a,g,f;return c.createClass({init:function(c){c.undelegate("#installments-payment-checkbox",
"change",d.proxy(this._handleChange,this));c.delegate("#installments-payment-checkbox","change",d.proxy(this._handleChange,this));a=d("#addToCart");g=d("\x3cinput\x3e").attr({type:"hidden",name:"installments-check",id:"installments-check"});f=d("#OneClickBox");d("#installments-payment-checkbox").removeAttr("disabled");d("#installments-payment-checkbox").prop("checked")&&this._checkedHandler()},_handleChange:function(a){d("#installments-payment-checkbox").prop("checked")?this._checkedHandler():this._uncheckedHandler()},
_checkedHandler:function(){a.prepend(g);f&&(f.find(".a-button-stack").addClass("aok-hidden"),f.find("#installmentsQuantity").removeClass("aok-hidden"),f.find("#diodeQuantityDropdown").addClass("aok-hidden"))},_uncheckedHandler:function(){g.remove();f&&(f.find(".a-button-stack").removeClass("aok-hidden"),f.find("#installmentsQuantity").addClass("aok-hidden"),f.find("#diodeQuantityDropdown").removeClass("aok-hidden"))}})});"use strict";h.when("A","ready").execute(function(c){function d(){g("html, body").animate({scrollTop:0},
300)}function a(){g("#ods-back-to-top-btn").unbind("click",d).click(d)}var g=c.$;a();c.on("a:pageUpdate",a)});"use strict";h.when("A","a-carousel-framework","ready").register("family-stripe",function(c,d){function a(a,c){b.each(function(){this.id!==a+"_carousel"&&g(this).toggleClass("invisible-family-stripe",c)})}var g=c.$,f=g("#dpx-subnav_div"),e=g("#familyStripe_feature_div"),b=e.find(".family");e.insertAfter(f);(function(){g("#mako-subnav-helper .fs-content-links").each(function(){var a=this.id;
g("#"+a+"_carousel").length&&g("#"+a+"_caret_wrapper").addClass("active")})})();c.declarative("family-stripe-hover","mouseenter mouseleave",function(b){var c=b.data.code;b="mouseenter"===b.type;var f=g("#"+c+"_carousel"),h=g("#"+c+" span");h.toggleClass("a-color-state",b);h.toggleClass("a-color-base",!b);f.length&&(e.toggleClass("active-family-stripe",b),g("#"+c).toggleClass("active-family-stripe",b),f.toggleClass("active-family-stripe",b),a(c,b));d.createAll();d.initializeAll()})});"use strict";
h.when("A","odsRefTagUtils","ready").execute(function(c,d){c=c.$;0<c("[name\x3d'submit.bundlebuilder']").length&&(c="mako_bb_button_is_present_"+c("#ASIN")[0].value,d.send(c,""))});"use strict";h.when("A","csmCounter","ready").register("alexa-interaction-canned",function(c,d){function a(){f=e("#alexa-interaction-canned-popover").data("a-modal").asin;d.increment("al-canned-btn-click-"+f)}function g(){var a=e("#iwad-left-wrapper").find("audio");e.each(a,function(){var a=e(this)[0];a.pause();a.currentTime=
0})}var f=null,e=c.$;c.on("a:popover:beforeShow:alexa-interaction-secview",function(a){a.popover.refresh();e("#iwad-right-wrapper .iwad-right-default").show();e(".iwad-response-section").addClass("aok-hidden");e("#iwad-left-wrapper").find(".iwad-prompts-question.playing").removeClass("playing");e("#iwad-scroll-hint").show()});c.on("a:popover:afterShow:alexa-interaction-secview",function(a){var c;e(".iwad-prompts-question").click(function(){var a=e(this),b=a.find("audio");c&&clearTimeout(c);c=setTimeout(function(){b.play()},
350);b.length&&b[0].playing?a.removeClass("playing"):(e("#iwad-left-wrapper").find(".iwad-prompts-question.playing").removeClass("playing"),a.addClass("playing"));var f=a.data("sectionresponseid"),h=e("#"+f);h.length&&(e("#iwad-right-wrapper .iwad-right-default").hide(),e(".iwad-response-section").addClass("aok-hidden"),h.removeClass("aok-hidden"));d.increment("al-canned-prompt-click-"+f);b.length&&(b=b[0],b.paused?(g(),b.onended=function(){a.removeClass("playing")}):(b.pause(),b.currentTime=0,a.removeClass("playing"),
clearTimeout(c)))});e("#iwad-scroll-hint").click(function(){e("#iwad-left-wrapper").animate({scrollTop:"400px"});e(this).hide()});e("#iwad-left-wrapper").scroll(function(){e("#iwad-scroll-hint").hide();e(this).unbind("scroll")})});c.on("a:popover:hide:alexa-interaction-secview",function(a){g()});e("#alexa-interaction-canned-popover").unbind("click",a).bind("click",a)})});
/* ******** */
(function(t){var p=window.AmazonUIPageJS||window.P,x=p._namespace||p.attributeErrors,v=x?x("AmazonDevicesDetailPageInstantSavingsAssets",""):p;v.guardFatal?v.guardFatal(t)(v,window):v.execute(function(){t(v,window)})})(function(t,p,x){t.when("A").register("trade-in-constants",function(k){return{unauthorizedCode:401,maxTradeInItemQuantityStatusCode:204,autoCompleteUrl:"https://completion.amazon.com/api/2017/suggestions?",autoCompleteUrlSuffix:"/api/2017/suggestions?",tradeInRouteBase:"/tradein/hzw/",
appraisalInputName:"appraisal",appraisalReturn:"RETURN_WORSE",appraisalAccept:"ACCEPT_WORSE",itemSelectEligibleContext:"eligible",itemSelectSearchContext:"search",maximumTradeInItemsCount:5,tradeInSearchAlias:"ereaders",tradeInSearchPageSize:20,tanookiV2DesktopRowSize:3,tanookiV2MobileRowSize:2,tanookiV2DesktopSearchPageSize:15,tanookiV2MobileSearchPageSize:10,tradeInSearchResultsLoadContext:"onLoad",tradeInSearchResultsScrollContext:"onScroll",sessionStorageAccessErrorMsg:"Session storage access blocked",
authPortalAssocHandle:"amzn_tradein_desktop_us",authPortalAssocHandleMobile:"amzn_tradein_ios_us",AUTH_PORTAL_ASSOC_HANDLE:{com:"amzn_tradein_horizonte_us",uk:"amzn_tradein_horizonte_uk",de:"amzn_tradein_horizonte_de"},tradeInSecondaryViewName:"tradeInSecondaryView",tradeInModalName:"tradeInModal",tradeInSideSheetName:"tradeInSideSheet",csrfKeyMap:"csrfKeyMap",csrfQueryParam:"requestToken",csrfSearchRequestKey:"searchRequestKey",csrfReviewRequestKey:"reviewRequestKey",csrfRemoveRequestKey:"removeItemRequestKey",
csrfSubmitRequestKey:"submitRequestKey",csrfSaveGradedItemKey:"saveGradedItemRequestKey",csrfSearchAsinCategoryItemKey:"searchAsinCategoryRequestKey",validConditions:"N/A;Neutral;New;LikeNew;VeryGood;Good;Working;Acceptable;Damaged;NonFunctional;Unacceptable;Ruined;Wrong Item".split(";"),resetAllElementsEvent:"resetAllElementsEvent",refTagPrefix:"dp_trdv2_is_",refTagPrefixMobile:"dp_trdv2_is_m_",refTagListItemsView:"list_items_view",refTagSearchItemsView:"search_items_view",refTagConditionView:"condition_view",
refTagConfirmationView:"confirmation_view",refTagSuccessfulView:"success_view",refTagItemSelect:"item_selected",refTagItemDeSelect:"item_deselected",refTagSearchTermRequest:"search_term_request_",refTagSearchItemSelect:"search_item_select",refTagSearchItemRemoveClick:"search_remove_click",refTagBackClick:"back_click",refTagListItemsContinueClick:"list_items_continue_click",refTagGradedConditionClick:"graded_condition_",refTagAppraisalAccept:"appraisal_accept",refTagAppraisalReturn:"appraisal_return",
refTagConditionContinueClick:"condition_continue_click",refTagReviewInstantPaymentView:"review_ip_view",refTagReviewNonInstantPaymentView:"review_nip_view",refTagReviewMixedBagPaymentView:"review_mb_view",refTagChangeConditionClick:"change_condition_click",refTagDeleteClick:"delete_click",refTagReturnAddressUpdateRequest:"return_address_update_request",refTagReturnAddressUpdateView:"return_address_update_view",refTagTradeInMoreItems:"trade_more_items",refTagReturnToShopping:"return_to_shopping_click",
refTagLogInPrompt:"log_in_prompt",refTagWeWantYouToKnow:"we_want_you_to_know_expanded",refTagPromotionInformationPopoverView:"promotion_information_panel_view",refTagAppraisalLearnMorePopoverView:"appraisal_learn_more_panel_view",refTagRegisteredDevicesLearnMorePopoverView:"registered_devices_learn_more_panel_view",refTagTermsAndConditions:"select_terms_and_conditions",retTagHowToLink:"select_how_to_link",refTagTv2:"tv2_",refTagAuthRequired:"AuthReq",refTagAuthCompleted:"AuthComp",refTagBackButton:"Back_",
refTagExit:"Exit_",refTagEnd:"End",refTagChangeCondition:"ChgCond",refTagRemoveCartItem:"RmvItm",refTagHazmatError:"HazmatError",BIFURCATION_REF_TAG:["tradein-manufacturer","tradein-vg-type"],VIEW_REF_TAG:{manufacturer:"Man",model:"Mod","model-family":"ModFam","storage-size":"Stor",carrier:"Carr","Console-Generation":"ConGen",platform:"Plat","trade-in-item-type":"IT",".refinement-search-view":"Search","#conditionViewTemplate":"Cond",".submit-trade-in-content":"Review",".tradein-cart-view":"Cart",
"#tradeinReviewYourOrderNextStepTemplate":"NxtStp"},PRODUCT_GROUP_REF_TAG:{gl_wireless:"Wir",gl_electronics:"Elec",gl_video_games:"VG",gl_digital_video_games:"VG"},PRODUCT_GROUP_FLOW_REF_TAG:{gl_wireless:"WL",gl_electronics:"WL",gl_video_games:"VG",gl_digital_video_games:"VG"},APPRAISAL_REF_TAG:{ACCEPT_WORSE:"Accpt",RETURN_WORSE:"Dcln"},eligibleListViewClass:".tradein-eligible-list-view",searchResultsListViewClass:".tradein-search-results-list-view",selectedItemConditionViewClass:".tradein-selected-item-condition-view",
selectedItemsConfirmationViewClass:".tradein-selected-items-confirmation-view",successfulViewClass:".tradein-successful-view",tradeInWrapperClass:".tradein-wrapper",checkboxItemThumbTemplateId:"#checkboxItemThumbTemplate",eligibleItemTemplateId:"#eligibleItemTemplate",questionRadioButtonTemplateId:"#questionRadioButtonTemplate",questionRadioTemplateId:"#questionRadioTemplate",radioButtonTemplateId:"#radioButtonTemplate",itemConfirmationTemplateId:"#itemConfirmationTemplate",asinDetailsViewTemplateId:"#asinDetailsViewTemplate",
eligibleListViewTemplateId:"#eligibleListViewTemplate",pastPurchasedListViewTemplateId:"#pastPurchasedListViewTemplate",searchResultsListViewTemplateId:"#searchResultsListViewTemplate",searchResultItemTemplateId:"#searchResultItemTemplate",selectedItemConditionViewTemplateId:"#selectedItemConditionViewTemplate",selectedItemsConfirmationViewTemplateId:"#selectedItemsConfirmationViewTemplate",successfulTradeInViewTemplateId:"#successfulTradeInViewTemplate",radioButtonRestrictionSelectionTemplateId:"#radioButtonRefinementSelectorViewTemplate",
cardItemRestrictionSelectionViewTemplateId:"#searchRestrictionCardItemSelectionTemplate",conditionViewTemplateId:"#conditionViewTemplate",tradeinHeaderViewTemplateId:"#tradeinHeaderViewTemplate",tradeinCartHeaderTemplateId:"#tradeInCartHeaderTemplate",tradeinCartSubmitViewHeaderTemplateId:"#tradeInCartHeaderTemplateSubmitView",tradeInCartPromosTemplateId:"#tradeInCartPromosTemplate",tradeInPromoPreviewViewTemplate:"#tradeInPromoPreviewViewTemplate",verticalComplexCardViewTemplateId:"#verticalComplexCardViewTemplate",
appraisalSelectionComponentViewId:"#appraisalSelectionComponentView",promotionInformationComponentId:"#promotionInformationComponent",appraisalWrapperClass:".appraisal-wrapper",conditionAppraisalMaxTivClass:".appraisal-max-tiv",appraisalTivHeaderClass:".appraisal-tiv-header",appraisalTivPriceClass:".appraisal-tiv",termsAndAgreementViewTemplateId:"#termsAndAgreementViewTemplate",multiItemTermsAndAgreementViewTemplateId:"#additionalItemTermsAndAgreementViewTemplate",multiItemTermsAndAgreementViewTemplateDevicesId:"#additionalItemTermsAndAgreementViewTemplateDevices",
tradeinReviewYourOrderNextStepTemplateId:"#tradeinReviewYourOrderNextStepTemplate",mixedOfferNextStepsTemplateId:"#mixedOfferNextStepsTemplate",multiItemConfirmationOrderDetailsViewComponentClass:".multiItemConfirmationOrderDetailsViewComponent",wirelessHowToViewTemplateId:"#wirelessHowToViewTemplate",howToLinkHelperTitleId:"#categoryHelperTitle",tradeinFooterComponentId:"#tradeinFooterComponent",successfulTradeInBannerComponentViewId:"#successfulTradeInBannerComponentView",restrictionSelectionViewTemplateId:"#restrictionSelectionViewTemplate",
tradeInSubmitConditionButtonTemplateId:"#tradeInSubmitConditionButtonTemplate",conditionQuestionnaireListClass:".questionnaires-list",conditionQuestionContainerClass:".condition-question-container",conditionQuestionButtonSelectorClass:".question-selector-button",conditionPageEstimatedTivComponentsSelector:"#tradeinEstimateOfferComponent .estimate-component",conditionPageFinalTivComponentsSelector:"#tradeinEstimateOfferComponent .final-component",conditionPageHeaderTivSelector:"#tradeinEstimateOfferComponent #tradeInValue",
binaryQuestionnaireListViewTemplateId:"#binaryQuestionnaireListViewTemplate",searchRefinementItemSelectionTemplateId:"#searchRefinementItemSelectionTemplate",refinementSearchViewTemplateId:"#refinementSearchViewTemplate",refinementSearchInputSelector:".refinement-search-input",refinementSearchInputMobileSelector:".refinement-search-input input",refinementSearchAllOffersCountId:"#searchAllOffersCount",refinementSearchOnlyOffersCountId:"#searchOnlyOffersCount",refinementSearchResultSelector:".refinement-selection-content .refinement-column",
shipmentDetailViewComponentId:"#shipmentDetailViewComponent",tradeInOfferOverviewTemplateId:"#tradeInOfferOverviewTemplate",categoryRefinementSelectionItemComponentId:"#categoryRefinementSelectionItemComponent",tradeinCartItemComponentId:"#tradeInCartItemComponent",shipmentDetailsHeaderComponentClass:".shipment-details-header-component",tradeinSubmitButtonComponentClass:".tradein-submit-button-container",tradeinSubmitWrapperComponentId:"#tradeinSubmitWrapper",refinementSelectionViewWrapperClass:".refinement-selection-view",
refinementContentWrapperClass:".refinement-content-wrapper",refinementSearchViewClass:".refinement-search-view",submitTradeInWrapperClass:".submit-trade-in-content",searchRestrictionWrapperClass:".search-restriction-wrapper",searchLoadMoreResultsWrapperClass:".load-more-results-wrapper",cardItemRestrictionSelectionViewClass:".restriction-selection-view",wirelessTradeInReviewYourOrderViewClass:".wireless-tradein-review-your-order-view",tradeInCartViewClass:".tradein-cart-view",tradeInCartTemplateId:"#tradeInCartViewTemplate",
tradeinCartTotalTivElement:".cart-total-tiv",tradeinCartGCValueIpElement:"#gcValueIp",tradeinCartGCValueNonIpElement:"#gcValueNonIp",tradeinCartIpItemsSection:".tradein-cart-view-ip-items",tradeinCartNonIpItemsSection:".tradein-cart-view-nip-items",tradeinCartIpItemsList:".tradein-cart-item-list-ip",tradeinCartNonIpItemsList:".tradein-cart-item-list-nip",continueConditionButtonViewClass:".continue-trigger",submitButtonViewClass:".handle-submit-your-tradein",reviewButtonViewClass:".handle-review-your-tradein",
tradeInMoreItemsButtonViewClass:".handle-trade-in-more-items",agreementCheckboxTarget:".agreement-checkbox-target",tradeInMoreItemsButtonContainerClass:".tradein-more-items-button-container",searchInputClass:".search-input",searchInputClassMobile:".search-input input",searchFormClass:".search-form",searchSuggestionsClass:".tradein-autocomplete-dropdown-menu",eligibleItemsCountId:"#eligibleItemsCount",dateRegisteredClass:".registered-date",eligibleItemListClass:".tradein-eligible-item-list",eligibleItemListWrapper:".tradein-eligible-item-list-wrapper",
searchResultListClass:".tradein-search-result-list",reviewTradeInItemsSubmitId:"#reviewTradeInItemsSubmit",customerPastDevicesPurchasesCarouselContainerId:"#customerPastDevicesPurchasesCarouselContainer",currentSelectedItemIndexId:"#currentSelectedItemIndex",selectedItemTotalCountId:"#selectedItemTotalCount",backButtonClass:".back-button",continueButtonClass:".continue-button",alertMaxItemQuantityClass:".tradein-error-quantity-limit",alertMaxItemsWarningClass:".tradein-warning-max-items",alertMaxItemsWarningClassMobile:".tradein-mobile-warning-max-items",
alertMaxGCValueWarningClass:".tradein-warning-max-gc-value",alertMaxGCValueWarningClassMobile:".tradein-mobile-warning-max-gc-value",alertPromptLoginClass:".tradein-prompt-log-in",alertItemAcceptableClass:".tradein-info-unacceptable-error",alertItemAcceptableClassMobile:".tradein-mobile-info-unacceptable-error",alertMaxItemQuantityBannerClass:".tradein-max-quantity-error",loadingSpinnerClass:".tradein-loading-spinner",loadingSideSheetSpinnerClass:".asin-selection-tradein-loading-spinner",searchLoadingSpinnerClass:".tradein-search-loading-spinner",
tradeinCartHeaderItemsSingularClass:".tradein-cart-header-items-singular",tradeinCartHeaderItemsPluralClass:".tradein-cart-header-items-plural",tradeInQuantityExceededErrorSelector:".tradein-templates .tradein-info-quantity-exceeded-error",tradeInErrorExitButtonSelector:".tradein-templates .tradein-error-exit-button",tradeInMixHazmatErrorSelector:".tradein-templates .tradein-info-mix-hazmat-error",tradeInMixHazmatCartItemErrorSelector:".tradein-templates .tradein-info-mix-hazmat-error-cart-item",
tradeInHazmatItemList:".hazmat-item-list",tradeInHazmatListItemTemplate:".hazmat-asin-list-item-template",tradeInNonTradeableErrorSelector:".tradein-templates .tradein-info-non-tradeable-error",complexCardRefinementSelectionViewType:"COMPLEX_CARD_VIEW",simpleCardRefinementSelectionViewType:"SIMPLE_CARD_VIEW",containedButtonRefinementSelectionViewType:"CONTAINED_BUTTON_VIEW",searchRefinementViewType:"SEARCH_CARD_VIEW",tradeInItemTypeEcho:"US_Echo",tradeInEchoGl:"gl_digital_products_3"}});"use strict";
t.when("A","trade-in-constants").register("trade-in-common-utils",function(k,n){var h=k.$,a={locale:null,currencyCode:null,productGroup:null,deviceType:null,asin:null,modalTitle:null,captureTradeInContext:function(){var a=h("#tanookiWidgetState").data("tanookiWidgetState");a?(a.hasOwnProperty("productGroup")?this.productGroup=a.productGroup:this.recordMetric("productGroupMissing"),a.hasOwnProperty("deviceType")?this.deviceType=a.deviceType:this.recordMetric("deviceTypeMissing"),a.hasOwnProperty("tanookiTitle")?
this.modalTitle=a.tanookiTitle:this.recordMetric("deviceModalHeaderMissing"),a.hasOwnProperty("asin")&&(this.asin=a.asin)):this.recordMetric("widgetContextMissing")},updateTradeInContext:function(a){var f=h("#tanookiWidgetState").data("tanookiWidgetState");f.hasOwnProperty("productGroup")&&a.hasOwnProperty("productGroup")&&(f.productGroup=a.productGroup);f.hasOwnProperty("deviceType")&&a.hasOwnProperty("deviceType")&&(f.deviceType=a.deviceType);f.hasOwnProperty("tanookiTitle")&&a.hasOwnProperty("tanookiTitle")&&
(f.tanookiTitle=a.tanookiTitle);f.hasOwnProperty("asin")&&a.hasOwnProperty("asin")&&(f.asin=a.asin);document.getElementById("tanookiWidgetState").dataset.tanookiWidgetState=JSON.stringify(f);this.captureTradeInContext()},getProductGroup:function(){return this.productGroup},getCurrentAsin:function(){return this.asin},getDeviceType:function(){return this.deviceType},getModalTitle:function(){return this.modalTitle||""},setLocale:function(a){this.locale=a},setCurrencyCode:function(a){this.currencyCode=
a},formatCurrency:function(a){this.currencyCode||this.recordError("Missing currency code","trade-in-common-utils");a=parseFloat(a);return a.toLocaleString(this.locale.replace("_","-"),{style:"currency",currency:this.currencyCode})},formatDate:function(a){if(!a)return"";a=a.split(" ");return a[0]+" "+a[1]+" "+a[2]},redirectToAuth:function(a,f){var l=p.location,h="https://"+l.host,d=l.search.replace(/\&$/,""),l=l.pathname+d+l.hash,d=h;-1<h.indexOf("aka.corp.amazon.com")&&(d="https://development.amazon.com");
a=d+"/ap/signin?_encoding\x3dUTF8\x26openid.assoc_handle\x3d"+a+"\x26openid.claimed_id\x3dhttp://specs.openid.net/auth/2.0/identifier_select\x26openid.identity\x3dhttp://specs.openid.net/auth/2.0/identifier_select\x26openid.mode\x3dcheckid_setup\x26openid.ns\x3dhttp://specs.openid.net/auth/2.0\x26openid.return_to\x3d"+h+l;try{p.sessionStorage&&sessionStorage.setItem(f,!0)}catch(e){this.recordError(e,"Session storage access blocked")}p.location.href=encodeURI(a)},redirectToMFA:function(a){var f="https://"+
p.location.host;-1<f.indexOf("aka.corp.amazon.com")&&(f="https://development.amazon.com");p.location.href=encodeURI(f+a)},getAuthPortalHandleFromHostname:function(){var a=p.location.hostname.match(/^(?:(?:(?:(\w\w)-)?pre-prod)|(?:(?:(\w\w)-)?development)|(?:.+))\.amazon.(?:(\w\w)|(com)|(?:co\.(?:(\w\w))))?$/);if(a)for(var f=1;f<a.length;f++)if(a[f])return n.AUTH_PORTAL_ASSOC_HANDLE[a[f]];return n.AUTH_PORTAL_ASSOC_HANDLE.com},recordError:function(a,f){p.ueLogError&&p.ueLogError({message:a,logLevel:"ERROR",
attribution:"tradein: "+f})},recordMetric:function(a){p.ue&&p.ue.count&&(a="tradeIn_"+a,p.ue.count(a,(p.ue.count(a)||0)+1))},findMinMaxTivInContainer:function(a){var f,l;Object.keys(a).forEach(function(h,d){h=a[h];0===d?l=f=h.tiv:(d=h.tiv,f=d<f?d:f,l=d>l?d:l)});return[f,l]},getMashModalUrl:function(a){var f="https://"+p.location.host,h="\x26cb\x3d"+Math.round((new Date).getTime()/1E3);return f+a+h},getCsrfTokenByKey:function(a,f){return f.hasOwnProperty(n.csrfKeyMap)&&f[n.csrfKeyMap][a]?f[n.csrfKeyMap][a]:
""},updateCsrfTokenByKey:function(a,f,h){f.hasOwnProperty(a)&&h.hasOwnProperty(n.csrfKeyMap)&&(h[n.csrfKeyMap][a]=f[a])},recordRefTag:function(a,f,h,k){a=f+h+a;k=a+"_"+this.deviceType+"_"+k;this.doRecordRefTag(a);this.doRecordRefTag(k)},recordTv2RefTag:function(a,f,h){var k="";Array.isArray(h)&&0<h.length&&(k=h.join("_")+"_");a=f+this.getTv2RefTagPrefix()+"_"+k+a+"_"+this.getTv2RefTagPostfix();this.doRecordRefTag(a)},doRecordRefTag:function(a){k.get(a,{error:h.proxy(function(a,h,m){this.recordError(h+
"::"+m,"Error encountered during refTag record request")},this)})},isMobileVariant:function(a){return 0<=["mobile","mobileApp","mobileWeb"].indexOf(a)},getTanookiV2RowSize:function(a){return this.isMobileVariant(a)?n.tanookiV2MobileRowSize:n.tanookiV2DesktopRowSize},getTanookiV2SearchPageSize:function(a){return this.isMobileVariant(a)?n.tanookiV2MobileSearchPageSize:n.tanookiV2DesktopSearchPageSize},shouldLaunchTanookiV2OnPageLoad:function(){try{if(p.sessionStorage){var h=sessionStorage.getItem("launchAsinCategoryTradeIn"),
f={productGroup:sessionStorage.getItem("storefront-product-group"),deviceType:sessionStorage.getItem("storefront-device-type"),modalTitle:sessionStorage.getItem("storefront-modal-title")};f.productGroup&&this.updateTradeInContext(f);return h?(sessionStorage.removeItem("launchAsinCategoryTradeIn"),sessionStorage.removeItem("storefront-product-group"),sessionStorage.removeItem("storefront-device-type"),sessionStorage.removeItem("storefront-modal-title"),sessionStorage.removeItem("is-storefront"),!0):
!1}}catch(l){a.recordError(l,"Session storage access blocked")}},getStorefrontSessionStorage:function(){try{if(p.sessionStorage&&sessionStorage.getItem("is-storefront"))return!0}catch(h){a.recordError(h,"Session storage access blocked")}},setStorefrontSessionStorage:function(h){try{p.sessionStorage&&(h&&sessionStorage.setItem("is-storefront",!0),sessionStorage.setItem("storefront-product-group",a.getProductGroup()),sessionStorage.setItem("storefront-device-type",a.getDeviceType()),sessionStorage.setItem("storefront-modal-title",
a.getModalTitle()))}catch(f){a.recordError(f,"Session storage access blocked")}},getTv2RefTagPrefix:function(){return n.refTagTv2+n.PRODUCT_GROUP_FLOW_REF_TAG[this.productGroup]},getTv2RefTagPostfix:function(){return("web"===this.deviceType?"D_":"M_")+n.PRODUCT_GROUP_REF_TAG[this.productGroup]},generatePrettyTitle:function(a){return a.split("(Trade")[0]},isGlEligibleForPastPurchases:function(a){return a===n.tradeInEchoGl},isGlEligibleForPromotions:function(a){return a===n.tradeInEchoGl}};k.on("a:pageUpdate",
function(){k.state.parse();a.captureTradeInContext()});return a});"use strict";t.when("A").register("trade-in-data-binder",function(k){function n(h,f,l,k,d){var e=h.find(".refinement-content-wrapper"),c=0;0<k.length&&(c=d.getTanookiV2RowSize(l));if(e&&0<c){l=Math.ceil(f.length/c);var b="a-span"+Math.floor(12/c);d=a(e).find(".dynamic-row");for(var b=d.find(".refinement-column").removeClass("a-span12").addClass(b),g=0;g<c-1;g++){var u=a(b).clone();d.append(u)}for(c=0;c<l-1;c++)b=d.clone(),e.append(a(b));
h.find(".refinement-column").each(function(b,c){c=a(c);c.data("dynamicColumn")&&(c.find(".refinement-selection-component-view").each(function(b,c){b=a(c);b.data("viewType")!==k&&b.remove()}),b>=f.length&&c.addClass("aok-hidden"))})}}function h(a,f){var h=!1;a.hasOwnProperty("showBooleanField")&&(a=a.showBooleanField,"!"===a.charAt(0)?(a=a.substr(1),h=!1===f.hasOwnProperty(a)?!0:!1!==f[a]):h=!1===f.hasOwnProperty(a)?!0:!0!==f[a]);return h}var a=k.$;return{bindDataToTemplate:function(k){if(!(0<k.length&&
""===a.trim(k.html()))){var f=a(k.clone().html());f.find("*").each(function(e,c){e=a(c);if(c=e.data("transcludeTemplate"))c=a(".tradein-templates #"+c),0<c.length&&e.html(c.clone().html())});try{if(1<arguments.length)for(var l=f.find("*"),q=1;q<arguments.length;q++){var d=arguments[q];l.each(a.proxy(function(e,c){e=a(c);c=e.data();if(c.hasOwnProperty("hideEmptyField")?!d.hasOwnProperty(c.hideEmptyField)||!d[c.hideEmptyField]:h(c,d))return e.remove(),!0;e.show();for(var b in d)if(d.hasOwnProperty(b)&&
(c=e.data(b))&&"string"===typeof c)switch(c){case "id":c=d[b];"date"===e.data("decorator")&&(c=this.tradeInCommonUtils.formatDate(c));e.find("#"+b).html(c);break;case "text":c=d[b];"price"===e.data("decorator")&&(c=this.tradeInCommonUtils.formatCurrency(c.toFixed(2)));e.html(c);break;case "textAppend":c=d[b];e.append(c);break;case "data":e.attr("data-"+b,d[b]);break;case "bind":break;default:var g=d[b];if("squareImage"===e.data("decorator")){var f=g.lastIndexOf(".");-1!==f&&(g=[g.slice(0,f+1),"_SL300_SR300,300_.",
g.slice(f+1)].join(""))}e.attr(c,g)}},this))}}catch(e){this.tradeInCommonUtils.recordError(e,"Error encountered during data bind to template")}return f}},setCommonUtils:function(a){this.tradeInCommonUtils=a},bindCategoryRefinementDataToTemplate:function(k,f,l,q){q=q||{};var d=f.selectionItemsAttributeList,e=f.refinementTitle,c=f.refinementKey;f=f.viewType;if(!(0<k.length&&""===a.trim(k.html()))){k=a(k.clone().html());n(k,d,l,f,this.tradeInCommonUtils);var b=0;try{var g=k.find("*"),u=q;g.each(a.proxy(function(g,
f){g=a(f);f=g.data();if(h(f,u))return g.remove(),!0;g.show();f.hasOwnProperty("refinementTitle")&&g.html(e);f.hasOwnProperty("endColumn")&&b++;f.hasOwnProperty("maxTiv")&&b<d.length&&g.html(this.tradeInCommonUtils.formatCurrency(d[b].maxTiv));f.hasOwnProperty("displayTitle")&&b<d.length&&g.html(d[b].displayTitle);f.hasOwnProperty("imageUrl")&&b<d.length&&g.attr(g.data("imageUrl"),d[b].imageUrl);if(f.hasOwnProperty("asinDetailsData")&&b<d.length){var w={maxTiv:d[b].maxTiv,refinementKey:c,refinementValue:d[b].emittedData};
d[b].asinDisplayProperties&&(w.platform=d[b].asinDisplayProperties.hardwarePlatform,w.ean=d[b].asinDisplayProperties.eanNumber,w.upc=d[b].asinDisplayProperties.upc);d[b].imageUrl&&(w.imageUrl=d[b].imageUrl);d[b].displayTitle&&(w.displayTitle=d[b].displayTitle);d[b].hasOwnProperty("isEnabled")&&(w.isEnabled=d[b].isEnabled);g.data("asinDetailsData",w)}f.hasOwnProperty("tradeinSupplementaryData")&&b<d.length&&(w={maxTiv:d[b].maxTiv},d[b].imageUrl&&(w.imageUrl=d[b].imageUrl),w.maxTiv&&g.data("tradeinSupplementaryData",
w));f.hasOwnProperty("refinementKey")&&b<d.length&&g.data("refinementKey",c);f.hasOwnProperty("refinementValue")&&b<d.length&&g.data("refinementValue",d[b].emittedData);f.hasOwnProperty("disabledAttribute")&&b<d.length&&(d[b].hasOwnProperty("isEnabled")&&!d[b].isEnabled&&(f=g.closest(".submit-refinement"),f.addClass("a-button-toggle"),f.addClass("a-button-unavailable"),g.addClass("a-button-disabled"),a(g).attr("disabled",!0),g.closest(".card-content-box").addClass("unavailable-item")),g.attr(g.data("disabledAttribute"),
d[b].isEnabled))},this))}catch(r){throw this.tradeInCommonUtils.recordError(r,"Error binding data to REFINEMENT SELECTION template"),"[Error at bindCategoryRefinementDataToTemplate]"+r;}return k}},bindDataToAsinSelectionTemplate:function(k){if(!(0<k.length&&""===a.trim(k.html()))){var f=a(k.clone().html());try{if(1<arguments.length)for(var l=f.find("*"),q=1;q<arguments.length;q++){var d=arguments[q];l.each(a.proxy(function(e,c){e=a(c);c=e.data();var b=!1;if(c.hasOwnProperty("instantPaymentEligible")){var g=
c.instantPaymentEligible;d.hasOwnProperty("instantPaymentEligible")&&g!==d.instantPaymentEligible&&(b=!0)}else b=h(c,d);if(b)return e.remove(),!0;e.show();c.hasOwnProperty("progressPercentage")&&d.hasOwnProperty("progressPercentage")&&e.css("width",d.progressPercentage);c.hasOwnProperty("tradeinSupplementaryData")&&e.data("tradeinSupplementaryData",{maxTiv:d.maxTiv,imageUrl:d.imageUrl});c.hasOwnProperty("refinementKey")&&e.data("refinementKey",d.restrictionKey);c.hasOwnProperty("refinementValue")&&
e.data("refinementValue",d.restrictionValue);for(var f in d)if(d.hasOwnProperty(f)&&(c=e.data(f))&&"string"===typeof c)switch(c){case "displayTitle":e.html(d[f]);break;case "subtitle":e.html(d[f]);break;case "src":e.attr(c,d[f]);break;case "classType":e.removeClass("aok-hidden");break;case "tiv":e.html(this.tradeInCommonUtils.formatCurrency(d[f]));break;case "data":e.attr("data-"+f,d[f])}},this))}}catch(e){throw this.tradeInCommonUtils.recordError(e,"Error encountered during binding data to the refinementTemplate"),
"[Error at bindDataToAsinSelectionTemplate]"+e;}return f}},normalizeGridRowHeights:function(h){a(h).find(".dynamic-row").each(function(f,h){f=a(h).find(".refinement-search-item-title");var k=0;f.each(function(d,e){d=a(e);d.outerHeight()>k&&(k=d.outerHeight())});f.each(function(d,e){a(e).css("height",k)})})}}});"use strict";t.when("A","a-popover","a-button","trade-in-constants","trade-in-common-utils","trade-in-data-binder","tradein-marketplace-authportal-config","tradein-use-formatted-dates","ready").register("trade-in-base-controller",
function(k,n,h,a,m,f,l,q){var d=k.$;return k.createClass({config:null,deviceType:null,authPortalAssocHandle:null,selectedEligibleItems:null,navViews:null,navCurrentView:null,navHistory:null,boundedViews:[],searchIsInProgress:!1,searchResultsCache:[],selectedSearchResultItems:null,tradeInReviewData:null,tradeInSubmitData:null,instantPaymentEligible:!1,instantPaymentMixed:!1,promotionEligible:!1,hasInitiallyLoaded:!1,hasMaxItemsSelected:!1,hasPendingRequest:!1,promosApplied:[],tradeInViewInstanceName:null,
tradeInSaveGradedItemConditionUrl:null,tradeInReviewUrl:null,tradeInRemoveItemUrl:null,tradeInSearchUrl:null,tradeInSubmitUrl:null,tradeInRefTagUrl:null,tradeInRefTagPrefix:null,tradeInProductGroup:null,tradeInSearchCurrentCacheEntry:null,tradeInWrapper:null,loadingSpinner:null,searchInput:null,checkboxItemThumbTemplate:null,eligibleItemTemplate:null,questionRadioButtonTemplate:null,questionRadioTemplate:null,radioButtonTemplate:null,itemConfirmationTemplate:null,searchResultsListViewTemplate:null,
searchResultItemTemplate:null,eligibleListViewTemplate:null,selectedItemConditionViewTemplate:null,selectedItemsConfirmationViewTemplate:null,successfulTradeInViewTemplate:null,load:function(){this.config=k.state("tradeInConfig");m.setLocale(this.config.locale);m.setCurrencyCode(this.config.currencyCode);f.setCommonUtils(m);this.navViews={eligibleListView:a.eligibleListViewClass,selectedItemConditionView:a.selectedItemConditionViewClass,selectedItemsConfirmationView:a.selectedItemsConfirmationViewClass,
successfulView:a.successfulViewClass};this.getElements();this.bindEvents();this.cleanState();this.restoreFromState();this.navCurrentView=this.navViews.eligibleListView;this.createView()},setConstants:function(e,c,b){this.tradeInViewInstanceName=e;this.tradeInRefTagPrefix=b;this.tradeInProductGroup=c;this.tradeInSaveGradedItemConditionUrl=a.tradeInRouteBase+"addToTradeIn";this.tradeInReviewUrl=a.tradeInRouteBase+"reviewTradeInOrder?deviceType\x3d"+this.deviceType+"\x26productGroup\x3d"+c+"\x26ref_\x3d"+
b+"review_request_"+c;this.tradeInRemoveItemUrl=a.tradeInRouteBase+"removeItem?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+b+"remove_item_request_"+c;this.tradeInSearchUrl=a.tradeInRouteBase+"searchItems?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+b+"search_request_"+c;this.tradeInSubmitUrl=a.tradeInRouteBase+"confirmTradeInOrder?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+b+"submit_request_"+c;this.tradeInRefTagUrl=a.tradeInRouteBase+"recordRefTag?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"},
getElements:function(){this.tradeInWrapper=this.base.find(a.tradeInWrapperClass);this.checkboxItemThumbTemplate=this.base.find(a.checkboxItemThumbTemplateId);this.eligibleItemTemplate=this.base.find(a.eligibleItemTemplateId);this.questionRadioButtonTemplate=this.base.find(a.questionRadioButtonTemplateId);this.questionRadioTemplate=this.base.find(a.questionRadioTemplateId);this.radioButtonTemplate=this.base.find(a.radioButtonTemplateId);this.itemConfirmationTemplate=this.base.find(a.itemConfirmationTemplateId);
this.searchResultItemTemplate=this.base.find(a.searchResultItemTemplateId);this.eligibleListViewTemplate=this.base.find(a.eligibleListViewTemplateId);this.searchResultsListViewTemplate=this.base.find(a.searchResultsListViewTemplateId);this.selectedItemConditionViewTemplate=this.base.find(a.selectedItemConditionViewTemplateId);this.selectedItemsConfirmationViewTemplate=this.base.find(a.selectedItemsConfirmationViewTemplateId);this.successfulTradeInViewTemplate=this.base.find(a.successfulTradeInViewTemplateId);
this.searchInput=this.base.find(this.searchInputClass);this.loadingSpinner=this.base.find(a.loadingSpinnerClass)},bindEvents:function(){this.tradeInWrapper.delegate("a.tradein-login","click",d.proxy(function(){var a=l.isEnabled?m.getAuthPortalHandleFromHostname():this.authPortalAssocHandle;m.redirectToAuth(a,"launchTradeIn")},this));this.tradeInWrapper.delegate(a.eligibleListViewClass+' .selectable-wrapper input[type\x3d"checkbox"]',"change",d.proxy(function(e){this.handleSelectableItemClick(e,a.itemSelectEligibleContext)},
this));this.tradeInWrapper.delegate(a.eligibleListViewClass+" .selectable-wrapper .selectable-item.disabled.maxasin","click",d.proxy(function(e){e=d(e.currentTarget);0===e.find(a.alertMaxItemQuantityClass).length&&e.find(".tradein-item-info").prepend(d("#alertTemplates "+a.alertMaxItemQuantityClass).clone())},this));this.tradeInWrapper.delegate(".selectable-item.disabled","click",d.proxy(function(a){this.hasMaxItemsSelected&&this.showAlert(this.alertMaxItemsWarningClass,d(a.currentTarget))},this));
this.tradeInWrapper.delegate(a.reviewTradeInItemsSubmitId,"click",d.proxy(function(){this.recordRefTag(a.refTagListItemsContinueClick);this.navCurrentView=this.navViews.selectedItemConditionView;this.goToView()},this));this.tradeInWrapper.delegate(a.selectedItemConditionViewClass+" "+a.continueButtonClass,"click",d.proxy(this.handleContinueButtonClick,this));this.tradeInWrapper.delegate(a.selectedItemConditionViewClass+" "+a.backButtonClass,"click",d.proxy(this.handleBackButtonClick,this));this.tradeInWrapper.delegate(".button-question",
"click",d.proxy(this.handleQuestionButtonClick,this));this.tradeInWrapper.delegate('input[name\x3d"'+a.appraisalInputName+'"]',"click",d.proxy(this.handleAppraisalRadioChange,this));this.tradeInWrapper.delegate(".delete-link","click",d.proxy(this.handleConfirmDeleteClick,this));this.tradeInWrapper.delegate(".change-link","click",d.proxy(this.handleConfirmChangeClick,this));this.tradeInWrapper.delegate("#tradeInMoreItems","click",d.proxy(function(){this.recordRefTag(a.refTagTradeInMoreItems);this.resetEligibleListView();
this.navCurrentView=this.navViews.eligibleListView;this.createView()},this));this.tradeInWrapper.delegate("#confirmTradeInSubmit","click",d.proxy(this.doTradeInSubmit,this));this.tradeInWrapper.delegate(".search-input","focusin",d.proxy(function(){this.tradeInWrapper.find(".search-button").addClass("active")},this));this.tradeInWrapper.delegate(".search-input","focusout",d.proxy(function(){this.tradeInWrapper.find(".search-button").removeClass("active")},this));this.tradeInWrapper.delegate(a.searchFormClass,
"submit",d.proxy(this.handleSearchFormSubmit,this));this.tradeInWrapper.delegate(a.searchResultsListViewClass+" "+a.searchResultListClass+' input[type\x3d"checkbox"]',"change",d.proxy(function(e){this.handleSelectableItemClick(e,a.itemSelectSearchContext)},this));this.tradeInWrapper.delegate(a.searchResultsListViewClass+" "+a.continueButtonClass,"click",d.proxy(this.handleSearchContinueButtonClick,this));this.tradeInWrapper.delegate(a.searchResultsListViewClass+" "+a.backButtonClass,"click",d.proxy(this.handleSearchContinueButtonClick,
this));this.tradeInWrapper.delegate(a.eligibleListViewClass+" .search-remove","click",d.proxy(this.handleSearchItemRemoveClick,this));k.on("a:popover:beforeHide:"+this.tradeInViewInstanceName,d.proxy(function(){for(var a=0;a<this.selectedEligibleItems.length;a++){var c=this.selectedEligibleItems[a];c.hasBeenGraded&&this.isItemInListByAsin(c,this.selectedSearchResultItems)&&(this.spliceItemFromList(c,this.selectedSearchResultItems),this.saveState())}},this))},bindAutoComplete:function(){d(".tradein-autocomplete-dropdown-menu").remove();
var e=this,c=a.autoCompleteUrl;e.config.hasOwnProperty("autoCompleteUrlDomain")&&e.config.autoCompleteUrlDomain&&(c=e.config.autoCompleteUrlDomain+a.autoCompleteUrlSuffix);new v({selector:a.tradeInWrapperClass+" "+this.navCurrentView+" "+this.searchInputClass,minChars:1,cache:!1,menuClass:"tradein-autocomplete-dropdown-menu",source:function(b,a){b&&b.trim().length&&d.ajax({type:"GET",url:c,data:{prefix:b,alias:"amazon-devices",mid:e.config.marketplace,"client-id":"tradein-search-suggestion"},dataType:"json",
success:function(b){var c=[];b&&b.hasOwnProperty("suggestions")&&d.each(b.suggestions,function(b,a){c.push(a.value)});e.searchIsInProgress||a(c)},error:function(){m.recordError("Autocomplete error","Error encountered during autocomplete request")}})},onSelect:function(b,c){e.tradeInSearchCurrentCacheEntry=e.getSearchResultsCacheEntry(c);0===e.tradeInSearchCurrentCacheEntry.eligibleItems.length?e.doTradeInSearch(a.tradeInSearchResultsLoadContext):(e.navCurrentView=a.searchResultsListViewClass,e.createView())}})},
doTradeInSearch:function(e){if(!this.searchIsInProgress){this.searchIsInProgress=!0;d(a.searchSuggestionsClass).hide();this.recordRefTag(a.refTagSearchTermRequest+this.tradeInSearchCurrentCacheEntry.term);if(e===a.tradeInSearchResultsScrollContext){var c=this.tradeInWrapper.find(a.searchResultsListViewClass+" "+a.searchLoadingSpinnerClass);c.addClass("active")}else this.loadingSpinnerShow();var b={"search-alias":a.tradeInSearchAlias,keyword:this.tradeInSearchCurrentCacheEntry.term,pageIndex:this.tradeInSearchCurrentCacheEntry.currentPageIndex,
pageSize:a.tradeInSearchPageSize,pageRefinements:!0,requestToken:this.getCsrfTokenByKey(a.csrfSearchRequestKey)};if(this.config.hasOwnProperty("searchConfigurations")){var g=this.config.searchConfigurations;g.hasOwnProperty("searchAlias")&&(b["search-alias"]=g.searchAlias);g.hasOwnProperty("searchNode")&&(b.node=g.searchNode)}k.post(this.tradeInSearchUrl,{params:b,success:d.proxy(function(b){this.updateCsrfTokenByKey(a.csrfSearchRequestKey,b);this.searchIsInProgress=!1;this.tradeInSearchCurrentCacheEntry.currentPageSize+=
b.pageSize;this.tradeInSearchCurrentCacheEntry.totalAvailableResults=b.totalAvailableResults;b.hasOwnProperty("questionnaires")&&(this.config.questionnaires=d.extend(this.config.questionnaires,b.questionnaires));var g=null;b.hasOwnProperty("eligibleItems")&&(g=Object.keys(b.eligibleItems).map(function(a){return b.eligibleItems[a]}));g&&(this.tradeInSearchCurrentCacheEntry.eligibleItems=d.merge(this.tradeInSearchCurrentCacheEntry.eligibleItems,g));e===a.tradeInSearchResultsScrollContext?(this.tradeInSearchCurrentCacheEntry.currentPageIndex!==
b.pageIndex&&(this.tradeInSearchCurrentCacheEntry.currentPageIndex=b.pageIndex),c.removeClass("active"),g&&(this.createTemplatesByIterable(g,this.searchResultItemTemplate,this.tradeInWrapper.find(".tradein-search-result-list")),this.validateMaxSelectedItems())):(this.loadingSpinnerHide(),this.navCurrentView=a.searchResultsListViewClass,this.createView())},this),error:d.proxy(function(b){this.searchIsInProgress=!1;this.handleRequestError(b,"TradeIn search error","Error encountered during TradeIn search request")},
this)})}},doTradeInReviewValidation:function(e){this.hasPendingRequest||(this.loadingSpinnerShow(),this.hasPendingRequest=!0,k.post(this.tradeInReviewUrl,{params:{currentAsin:m.getCurrentAsin(),requestToken:this.getCsrfTokenByKey(a.csrfReviewRequestKey)},success:d.proxy(function(c){this.updateCsrfTokenByKey(a.csrfReviewRequestKey,c);this.tradeInReviewData=c;this.loadingSpinnerHide();this.hasPendingRequest=!1;e()},this),error:d.proxy(function(c){this.hasPendingRequest=!1;c.hasOwnProperty("http")&&
c.http.status===a.maxTradeInItemQuantityStatusCode?this.handleMaxQuantityError():this.handleRequestError(c,"TradeIn review error","Error encountered during TradeIn review request")},this)}))},doTradeInItemRemove:function(e){this.loadingSpinnerShow();k.post(this.tradeInRemoveItemUrl,{params:{asin:e.asin,decline:!0,requestToken:this.getCsrfTokenByKey(a.csrfRemoveRequestKey)},success:d.proxy(function(c){this.updateCsrfTokenByKey(a.csrfRemoveRequestKey,c);this.loadingSpinnerHide()},this),error:d.proxy(function(a){this.handleRequestError(a,
"TradeIn deselect remove error","Error encountered during TradeIn deselect remove request")},this)})},doTradeInSubmit:function(e){this.hasPendingRequest||d(e.currentTarget).hasClass("a-button-disabled")||(this.loadingSpinnerShow(),this.hasPendingRequest=!0,e=this.instantPaymentEligible?"ip":"nip",this.instantPaymentMixed&&(e="mb"),k.post(this.tradeInSubmitUrl+e,{params:{requestToken:this.getCsrfTokenByKey(a.csrfSubmitRequestKey),currentAsin:m.getCurrentAsin()},success:d.proxy(function(c){this.tradeInSubmitData=
c;try{if(this.tradeInSubmitData.hasOwnProperty("mfaUrl")&&this.tradeInSubmitData.mfaUrl){m.redirectToMFA(this.tradeInSubmitData.mfaUrl);return}p.sessionStorage&&(p.sessionStorage.removeItem("tradein-state"),this.promotionEligible&&(this.promosApplied.push({productGroup:this.tradeInProductGroup,applied:!0}),p.sessionStorage.setItem("tradein-promos-applied",JSON.stringify(this.promosApplied))))}catch(b){m.recordError(b,a.sessionStorageAccessErrorMsg)}k.trigger("tanookiSuccess");this.loadingSpinnerHide();
this.hasPendingRequest=!1;this.updateLaunchButtonText();this.navCurrentView=a.successfulViewClass;this.createView()},this),error:d.proxy(function(c){this.hasPendingRequest=!1;c.hasOwnProperty("http")&&c.http.status===a.maxTradeInItemQuantityStatusCode?this.handleMaxQuantityError():this.handleRequestError(c,"TradeIn submit error","Error encountered during TradeIn submit request")},this)}))},addNavHistory:function(a){this.navHistory.push(a)},popNavHistory:function(){if(1<this.navHistory.length)return this.navHistory.pop(),
this.navHistory.pop()},createView:function(){this.hideAllViews();switch(this.navCurrentView){case a.searchResultsListViewClass:this.recordRefTag(a.refTagSearchItemsView);this.createSearchResultsView();break;case a.selectedItemConditionViewClass:this.recordRefTag(a.refTagConditionView);this.createConditionView();break;case a.selectedItemsConfirmationViewClass:this.recordRefTag(a.refTagConfirmationView);this.createConfirmationView();break;case a.successfulViewClass:this.recordRefTag(a.refTagSuccessfulView);
this.createSuccessfulView();break;default:this.recordRefTag(a.refTagListItemsView),this.createEligibleListView()}},createEligibleListView:function(){var e=this.config;if(-1===d.inArray(this.navCurrentView,this.boundedViews)){var c=f.bindDataToTemplate(this.eligibleListViewTemplate,{instantPayable:this.config.hasOwnProperty("instantPayable")?this.config.instantPayable:!1});c.find(a.eligibleItemsCountId).html(e.eligibleItems.length);var b=c.find(a.eligibleItemListClass);this.createTemplatesByIterable(e.eligibleItems,
this.eligibleItemTemplate,b);if(0<this.selectedSearchResultItems.length){var g=0,u=c.find(".tradein-search-item-list");d.each(this.selectedSearchResultItems,d.proxy(function(b,a){if(this.config.hasOwnProperty("validTradeInItemTypes")&&-1===d.inArray(a.tradeInItemType,this.config.validTradeInItemTypes))return!0;a.fromSearch=!0;b=f.bindDataToTemplate(this.eligibleItemTemplate,a);b.data("templateModel",a);u.append(b);g++},this));0<g&&(c.find(".search-result-wrapper").addClass("active"),c.find("#searchedSelectedItems").html(g))}this.tradeInWrapper.append(c);
this.hasInitiallyLoaded||d.each(e.eligibleItems,d.proxy(function(b,a){a.selected&&this.createSelectedItem(a)},this));var r=this;d.each(this.tradeInWrapper.find(".selectable-wrapper .selectable-item"),function(){var b=d(this),g=r.getDataModel(b);d.each(r.selectedEligibleItems,function(e,d){b.hasClass("disabled")||d.asin!==g.asin||d.deviceId!==g.deviceId||(b.addClass("selected").removeClass("disabled"),b.find('input[type\x3d"checkbox"]').prop("checked",!0).prop("disabled",!1),r.toggleEligibleItemsSelectableStateByAsin(d.asin,
!1),c.find(".a-button-disabled").removeClass("a-button-disabled").find("button").prop("disabled",!1),r.toggleReviewTradeInItemsSubmitState(a.itemSelectEligibleContext))})});this.bindAutoComplete();this.boundedViews.push(this.navCurrentView);this.hasInitiallyLoaded=!0}b=this.tradeInWrapper.find(".no-eligible-items");0===e.eligibleItems.length&&0===this.selectedEligibleItems.length?b.show():b.hide();this.updateSelectedCountValueHeader();this.validateMaxSelectedItems();this.tradeInWrapper.find(a.eligibleListViewClass).show();
this.navHistory.push(this.navCurrentView)},createConditionView:function(){-1===d.inArray(this.navCurrentView,this.boundedViews)&&(d.each(this.selectedEligibleItems,d.proxy(function(e,c){var b=f.bindDataToTemplate(this.selectedItemConditionViewTemplate,c);this.updateConditionViewHeaderCount(b,e+1);e="";for(var g=c.tradeInQuestions,u=0;u<g.length;u++){for(var r=g[u],h="",w=f.bindDataToTemplate(this.questionRadioButtonTemplate,r),k=0;k<r.choices.length;k++)h+=f.bindDataToTemplate(this.radioButtonTemplate,
{questionId:r.id},r.choices[k])[0].outerHTML;w.find(".tradein-question-choice-list").append(h);e+=w[0].outerHTML}this.config.hasOwnProperty("deviceTradeInFlavor")&&"promo_only"===this.config.deviceTradeInFlavor||(e+=f.bindDataToTemplate(this.questionRadioTemplate)[0].outerHTML);b.find(".conditions-question-list").append(e);for(var l in c.tradeInQuestionResponses)if(c.tradeInQuestionResponses.hasOwnProperty(l)){var q=c.tradeInQuestionResponses[l];l===a.appraisalInputName?b.find('input[name\x3d"'+l+
'"][value\x3d"'+q+'"]').prop("checked",!0):b.find('button[name\x3d"'+l+'"]').each(function(){d(this).val()===q&&d(this).closest(".a-button-toggle").addClass("a-button-selected").attr("aria-checked",!0)})}b.attr("id","conditionGrade_"+c.asin);l=this.getSortedConditionTradeInValues(c);e=b.find(".conditions-question-list .adjusted-pricing-range");e.find("#adjustedPriceLow").html(m.formatCurrency(l[0]));e.find("#adjustedPriceHigh").html(m.formatCurrency(l[l.length-1]));e.removeClass("aok-hidden");this.tradeInWrapper.append(b);
b.data("templateModel",c)},this)),this.boundedViews.push(this.navCurrentView));this.getIsAllGraded()?(this.tradeInWrapper.find(a.eligibleListViewClass).show(),this.doTradeInReviewValidation(d.proxy(function(){this.navCurrentView=this.navViews.selectedItemsConfirmationView;this.goToView()},this))):d.each(this.selectedEligibleItems,d.proxy(function(e,c){e="#conditionGrade_"+c.asin;var b=this.tradeInWrapper.find(e);if(0!==b.length)if(c.hasBeenGraded)b.removeClass("active");else return b.addClass("active").show(),
b.find('input[name\x3d"'+a.appraisalInputName+'"][value\x3d"'+a.appraisalAccept+'"]').prop("checked",!0),this.toggleNextConditionSubmitState(c),this.navHistory.push(e),!1},this))},createConfirmationView:function(){this.tradeInWrapper.find(a.selectedItemsConfirmationViewClass).remove();this.instantPaymentEligible=this.tradeInReviewData.hasOwnProperty("instantPaymentEligible")?this.tradeInReviewData.instantPaymentEligible:!1;this.instantPaymentMixed=this.tradeInReviewData.hasOwnProperty("orderTotalPaidInstantly")&&
0<this.tradeInReviewData.orderTotalPaidInstantly&&0<(this.tradeInReviewData.hasOwnProperty("orderTotalPaidOnGrading")&&this.tradeInReviewData.orderTotalPaidOnGrading);this.promotionEligible=this.tradeInReviewData.hasOwnProperty("promotionEligible")?this.tradeInReviewData.promotionEligible:!1;var e=this.instantPaymentEligible?a.refTagReviewInstantPaymentView:a.refTagReviewNonInstantPaymentView;this.instantPaymentMixed&&(e=a.refTagReviewMixedBagPaymentView);this.recordRefTag(e);var c=this.tradeInReviewData.hasOwnProperty("sanitizedItemsList")&&
d.isArray(this.tradeInReviewData.sanitizedItemsList)?this.tradeInReviewData.sanitizedItemsList:[],e=f.bindDataToTemplate(this.selectedItemsConfirmationViewTemplate,{instantPayable:this.instantPaymentEligible,promotionEligible:this.promotionEligible});if(this.tradeInReviewData.hasOwnProperty("promotionEligibilityText")){var b="";d.each(this.tradeInReviewData.promotionEligibilityText,function(a,c){b+=c});e.find(".tradeInPromotion #promotionText").html(b)}var g="",u=!1;d.each(this.selectedEligibleItems,
d.proxy(function(b,a){var e=!1;d.each(c,function(b,c){if(c.asin===a.asin)return e=!0,a.instantPayable=c.instantPayable,a.tradeInValue=c.tradeInValue,!1});e||(u=!0,this.tradeInReviewData.hasOwnProperty("nonTradeableItems")&&this.isItemInListByAsin(a,this.tradeInReviewData.nonTradeableItems)?a.nonTradeableItems=!0:this.tradeInReviewData.hasOwnProperty("qtyLimitExceedItems")&&this.isItemInListByAsin(a,this.tradeInReviewData.qtyLimitExceedItems)?a.qtyLimitExceedItems=!0:a.unknownErrorState=!0);g+=f.bindDataToTemplate(this.itemConfirmationTemplate,
a)[0].outerHTML},this));e.find(".tradein-confirmation-item-list").append(g);var r=!1;this.tradeInReviewData.hasOwnProperty("defaultReturnAddressId")&&this.tradeInReviewData.defaultReturnAddressId?this.tradeInReviewData.hasOwnProperty("freeShipping")&&this.tradeInReviewData.freeShipping?u&&e.find(".alert-wrapper").append(d(".tradein-templates .tradein-info-submit-updates").clone()).addClass("active"):(r=!0,e.find(".alert-wrapper").append(d(".tradein-templates .tradein-info-submit-invalid-address-error").clone()).addClass("active")):
(r=!0,e.find(".alert-wrapper").append(d(".tradein-templates .tradein-info-submit-address-error").clone()).addClass("active"),e.find(".tradein-appraisal-info").hide());var y=q.isEnabled?this.tradeInReviewData.shipByDateString:m.formatDate(this.tradeInReviewData.shipByDate);e.find(".tradeInShipDate").html(y);e.find(".labelEmail").html(this.tradeInReviewData.emailAddress);e.find("#tradeInTotalValue").html(m.formatCurrency(this.tradeInReviewData.orderTotalGC));e.find(".selectedItemTotalCount").html(c.length);
e.find("#returnAddress").html(f.bindDataToTemplate(d("#addressLineTemplate"),this.tradeInReviewData.defaultReturnAddress));this.tradeInWrapper.append(e);this.toggleMixedBasketElements(e);if(r||0===c.length)e.find(".payment-breakdown").hide(),h(a.tradeInWrapperClass+" #confirmTradeInSubmit").disable();this.navHistory.push(this.navCurrentView)},createSuccessfulView:function(){var a=f.bindDataToTemplate(this.successfulTradeInViewTemplate,{instantPayable:this.instantPaymentEligible,promotionEligible:this.promotionEligible});
if(!k.objectIsEmpty(this.tradeInSubmitData)){a.find("#tradeInTotalValue").html(m.formatCurrency(this.tradeInSubmitData.totalAmount));var c=q.isEnabled?this.tradeInSubmitData.shipByDate:m.formatDate(this.tradeInSubmitData.shipByDate);a.find(".tradeInShipDate").html(c);a.find(".labelEmail").html(this.tradeInSubmitData.customerEmailAddress);a.find(".customerEmail").html(this.tradeInSubmitData.customerEmailAddress)}this.tradeInWrapper.append(a);this.toggleMixedBasketElements(a)},createSearchResultsView:function(){this.tradeInWrapper.find(a.searchResultsListViewClass).remove();
var e=f.bindDataToTemplate(this.searchResultsListViewTemplate);e.find("#searchTerm").html(this.tradeInSearchCurrentCacheEntry.term);if(this.tradeInSearchCurrentCacheEntry.hasOwnProperty("eligibleItems")){var c=this.tradeInSearchCurrentCacheEntry.eligibleItems,b=e.find(a.searchResultListClass);this.createTemplatesByIterable(c,this.searchResultItemTemplate,b);b.bind("scroll",d.proxy(this.handleSearchScroll,this))}this.tradeInWrapper.append(e);this.tradeInWrapper.find(".search-input").val(this.tradeInSearchCurrentCacheEntry.term);
this.bindAutoComplete();this.validateMaxSelectedItems();this.navHistory.push(this.navCurrentView)},createTemplatesByIterable:function(a,c,b){d.each(a,d.proxy(function(a,e){a=f.bindDataToTemplate(c,e);a.data("templateModel",e);b.append(a)},this))},createSelectedItem:function(e){if(!this.isItemInListByAsin(e,this.selectedEligibleItems)){var c={hasBeenGraded:!1,gradedCondition:null,tradeInQuestions:this.getQuestionsByItem(e),tradeInValue:e.tradeInValue,tradeInQuestionResponses:{appraisal:a.appraisalAccept}},
c=d.extend(!0,{},c,e);this.selectedEligibleItems.push(c)}},createReturnAddressInstance:function(a){if(this.tradeInReviewData&&0<a.length)if(0===a.children().length){for(var c in this.tradeInReviewData.returnAddresses)if(this.tradeInReviewData.returnAddresses.hasOwnProperty(c)){var b=this.tradeInReviewData.returnAddresses[c];b.formalAddress=f.bindDataToTemplate(d("#addressLineFormalTemplate"),b);var g=f.bindDataToTemplate(d("#addressLineItemTemplate"),b),u=this.tradeInReviewData.defaultReturnAddressId===
b.addressId;g.find('input[type\x3d"radio"]').val(b.addressId).prop("checked",u);g.data("templateModel",b);a.append(g)}a.delegate('input[type\x3d"radio"]',"change",d.proxy(this.handleReturnAddressChange,this))}else a=a.find('input[type\x3d"radio"]'),d.each(a,d.proxy(function(a,b){a=d(b);a.prop("checked",a.val()===this.tradeInReviewData.defaultReturnAddressId)},this))},saveState:function(){try{p.sessionStorage&&p.sessionStorage.setItem("tradein-state",JSON.stringify({selectedSearchResultItems:this.selectedSearchResultItems}))}catch(e){m.recordError(e,
a.sessionStorageAccessErrorMsg)}},cleanState:function(){this.selectedEligibleItems=[];this.selectedSearchResultItems=[];this.navHistory=[];this.boundedViews=[];this.navCurrentView=null;this.hasInitiallyLoaded=!1;d(a.searchSuggestionsClass).remove()},restoreFromState:function(){try{if(p.sessionStorage){var e=p.sessionStorage.getItem("tradein-state");e&&(this.selectedSearchResultItems=this.extractStateFromStorage(e).selectedSearchResultItems);var c=p.sessionStorage.getItem("tradein-promos-applied");
c&&(this.promosApplied=this.extractStateFromStorage(c))}}catch(b){m.recordError(b,a.sessionStorageAccessErrorMsg)}},extractStateFromStorage:function(a){try{var c=k.parseJSON(a);if(!k.objectIsEmpty(c))return c}catch(b){m.recordError(b,"SessionStorage state JSON parse error")}},hideAllViews:function(){this.tradeInWrapper.children().each(function(){d(this).hide()})},goToView:function(){this.saveState();this.createView()},handleSearchScroll:function(e){var c=this.tradeInWrapper.find(a.searchResultListClass);
if(0<c.length){e=c.height();e=c.scrollTop()+e;var c=c[0].scrollHeight-120,b=Math.ceil(this.tradeInSearchCurrentCacheEntry.totalAvailableResults/a.tradeInSearchPageSize);!this.searchIsInProgress&&this.tradeInSearchCurrentCacheEntry.currentPageIndex<b&&e>=c&&(this.tradeInSearchCurrentCacheEntry.currentPageIndex+=1,this.doTradeInSearch(a.tradeInSearchResultsScrollContext))}},handleSearchFormSubmit:function(e){e.preventDefault();e=d(e.currentTarget);var c=e.find(".search-input");if(!c.is("input")&&(c=
e.find(".search-input input"),!c.is("input")))return;if(e=k.trim(c.val()))this.tradeInSearchCurrentCacheEntry=this.getSearchResultsCacheEntry(e),0===this.tradeInSearchCurrentCacheEntry.eligibleItems.length?this.doTradeInSearch(a.tradeInSearchResultsLoadContext):(this.navCurrentView=a.searchResultsListViewClass,this.createView())},handleSearchItemRemoveClick:function(e){e=d(e.currentTarget);e.closest(".selectable-item").hasClass("disabled")||(e=this.getDataModel(e),this.recordRefTag(a.refTagSearchItemRemoveClick),
this.isItemInListByAsin(e,this.selectedEligibleItems)&&this.doTradeInItemRemove(e),this.spliceItemFromList(e,this.selectedSearchResultItems),this.spliceItemFromList(e,this.selectedEligibleItems),this.handleSearchContinueButtonClick())},handleSearchContinueButtonClick:function(){this.tradeInSearchCurrentCacheEntry=null;this.tradeInWrapper.find(a.eligibleListViewClass).remove();delete this.boundedViews[this.boundedViews.indexOf(a.eligibleListViewClass)];this.navCurrentView=this.navViews.eligibleListView;
this.addNavHistory(this.navCurrentView);this.goToView()},handleContinueButtonClick:function(e){e=d(e.currentTarget);var c=this.getDataModel(e);this.recordRefTag(a.refTagConditionContinueClick);this.loadingSpinnerShow();e={asin:c.asin,condition:c.gradedCondition,returnOption:c.tradeInQuestionResponses.appraisal,requestToken:this.getCsrfTokenByKey(a.csrfSaveGradedItemKey)};c.hasOwnProperty("deviceId")&&c.deviceId&&(e.deviceId=c.deviceId);k.post(this.tradeInSaveGradedItemConditionUrl,{params:e,success:d.proxy(function(b){this.updateCsrfTokenByKey(a.csrfSaveGradedItemKey,
b);this.loadingSpinnerHide();c.hasBeenGraded=!0;this.recordRefTag(a.refTagGradedConditionClick+c.gradedCondition.toLowerCase());this.getIsAllGraded()?(this.tradeInWrapper.find(a.continueButtonClass).each(function(){d(this).removeClass("a-button-disabled").addClass("active");d(this).find("button").prop("disabled",!1)}),this.doTradeInReviewValidation(d.proxy(function(){this.navCurrentView=this.navViews.selectedItemsConfirmationView;this.goToView()},this))):(this.navCurrentView=this.navViews.selectedItemConditionView,
this.goToView())},this),error:d.proxy(function(a){this.handleRequestError(a,"TradeIn save graded condition error","Error encountered during TradeIn save graded condition request")},this)})},handleBackButtonClick:function(){var e=this.popNavHistory();if(e)if(this.navCurrentView=e,this.addNavHistory(e),this.recordRefTag(a.refTagBackClick),e===a.eligibleListViewClass)this.resetEligibleListView(),this.createView();else{this.hideAllViews();var c=this.tradeInWrapper.find(e);-1!==e.indexOf("conditionGrade_")&&
(this.tradeInWrapper.find(".tradein-selected-item-condition-view").each(function(){d(this).removeClass("active")}),c.addClass("active"),e=e.split("_"),1<e.length&&this.restoreViewButtonState(c,e[1]));c.show();c.find(".selectable-wrapper").scrollTop(0)}},handleSelectableItemClick:function(e,c){var b=d(e.currentTarget);e=b.closest(".selectable-item");if(!e.hasClass("disabled")){var g=this.getDataModel(e);if(g){if(e.hasClass("selected"))c===a.itemSelectSearchContext&&this.spliceItemFromList(g,this.selectedSearchResultItems),
c===a.itemSelectEligibleContext&&this.isItemInListByAsin(g,this.selectedEligibleItems)&&this.doTradeInItemRemove(g),this.spliceItemFromList(g,this.selectedEligibleItems),e.removeClass("selected"),this.toggleEligibleItemsSelectableStateByAsin(g.asin,!0),this.recordRefTag(a.refTagItemDeSelect),this.hideAlert();else{if(this.validateMaxGiftCardAmount(g)){this.showAlert(this.alertMaxGCValueWarningClass,e);b.prop("checked",!1);return}c!==a.itemSelectSearchContext||this.isItemInListByAsin(g,this.selectedSearchResultItems)||
(this.recordRefTag(a.refTagSearchItemSelect),b=d.extend({},g),b.fromSearch=!0,this.selectedSearchResultItems.push(b));this.createSelectedItem(g);e.addClass("selected");this.toggleEligibleItemsSelectableStateByAsin(g.asin,!1);this.recordRefTag(a.refTagItemSelect)}this.updateSelectedCountValueHeader();this.validateMaxSelectedItems();this.toggleReviewTradeInItemsSubmitState(c);this.saveState()}}},handleQuestionButtonClick:function(a){var c=d(a.currentTarget),b=c.find("button"),c=this.getDataModel(c);
c.tradeInQuestionResponses[b.attr("name")]=b.val();this.toggleNextConditionSubmitState(c,d(a.currentTarget).closest(".tradein-question-wrapper"))},handleAppraisalRadioChange:function(e){e=d(e.currentTarget);var c=this.getDataModel(e);c.tradeInQuestionResponses[e.attr("name")]=e.val();this.recordRefTag(e.val()===a.appraisalReturn?a.refTagAppraisalReturn:a.refTagAppraisalAccept);this.toggleNextConditionSubmitState(c)},handleConfirmDeleteClick:function(e){this.recordRefTag(a.refTagDeleteClick);var c=
d(e.currentTarget).data("asin"),b=null;d.each(this.selectedEligibleItems,d.proxy(function(a,d){if(d.asin===c)return b=d,this.tradeInWrapper.find("#conditionGrade_"+c).remove(),this.selectedEligibleItems.splice(a,1),!1},this));b&&(this.loadingSpinnerShow(),k.post(this.tradeInRemoveItemUrl,{params:{asin:b.asin,decline:!0,requestToken:this.getCsrfTokenByKey(a.csrfRemoveRequestKey)},success:d.proxy(function(b){this.updateCsrfTokenByKey(a.csrfRemoveRequestKey,b);this.loadingSpinnerHide();d.each(this.config.eligibleItems,
function(a,b){b.asin===c&&(b.condition=null)});0===this.selectedEligibleItems.length?(h(a.eligibleListViewClass+" "+a.reviewTradeInItemsSubmitId).disable(),this.tradeInWrapper.find(a.eligibleListViewClass+" .selectable-item").each(function(){d(this).removeClass("selected").removeClass("disabled");d(this).find('input[type\x3d"checkbox"]').prop("checked",!1).prop("disabled",!1)}),this.resetEligibleListView(),this.navCurrentView=this.navViews.eligibleListView,this.goToView()):this.doTradeInReviewValidation(d.proxy(function(){this.navCurrentView=
this.navViews.selectedItemsConfirmationView;this.goToView()},this))},this),error:d.proxy(function(a){this.handleRequestError(a,"TradeIn remove item from past purchase list error","Error encountered during TradeIn remove item from past purchases request")},this)}))},handleConfirmChangeClick:function(e){this.hideAllViews();this.navCurrentView=this.navViews.selectedItemConditionView;this.recordRefTag(a.refTagChangeConditionClick);var c=d(e.currentTarget).data("asin");e=this.tradeInWrapper.find("#conditionGrade_"+
c);var b=1;d.each(this.selectedEligibleItems,function(a,d){if(d.asin===c)return b=a+1,!1});this.updateConditionViewHeaderCount(e,b);e.find(a.backButtonClass).hide();e.find(a.continueButtonClass).addClass("active");e.addClass("active").show();e.find(".scrollable-list").scrollTop(0);this.restoreViewButtonState(e,c)},handleLoginPrompt:function(){this.recordRefTag(a.refTagLogInPrompt);var e=this.tradeInWrapper.find(this.navCurrentView+" .content-wrapper"),c=d("#alertTemplates "+a.alertPromptLoginClass).clone();
e.html("").append(c).addClass("logged-out-message")},handleRequestError:function(e,c,b){this.loadingSpinnerHide();e.http.status===a.unauthorizedCode?this.handleLoginPrompt():(m.recordError(c,b),this.tradeInWrapper.find(this.navCurrentView+" .alert-wrapper").html("").prepend(d(".tradein-templates .tradein-general-error").clone()).addClass("active"))},handleReturnAddressChange:function(e){this.recordRefTag(a.refTagReturnAddressUpdateRequest);this.loadingSpinnerShow();k.post(this.tradeInReviewUrl,{params:{addressId:e.val(),
requestToken:this.getCsrfTokenByKey(a.csrfReviewRequestKey)},success:d.proxy(function(c){this.updateCsrfTokenByKey(a.csrfReviewRequestKey,c);this.loadingSpinnerHide();this.tradeInReviewData=c;this.navCurrentView=this.navViews.selectedItemsConfirmationView;this.goToView()},this),error:d.proxy(function(a){this.handleRequestError(a,"TradeIn return address error","Error encountered during TradeIn return address update request")},this)})},handleMaxQuantityError:function(){this.loadingSpinnerHide();this.selectedEligibleItems=
[];this.resetEligibleListView();this.navCurrentView=this.navViews.eligibleListView;this.goToView();this.showAlert(a.alertMaxItemQuantityBannerClass)},toggleEligibleItemsSelectableStateByAsin:function(e,c){d.each(this.tradeInWrapper.find("li.tradein-eligible-item .selectable-item"),d.proxy(function(b,g){g=d(g);b=g.find('input[type\x3d"checkbox"]');var f=this.getDataModel(g);f&&f.asin===e&&(c?(g.find(".tradein-item-info "+a.alertMaxItemQuantityClass).remove(),g.removeClass("disabled").removeClass("maxasin"),
b.prop("disabled",!1)):g.hasClass("selected")||c||(g.addClass("disabled").addClass("maxasin"),b.prop("disabled",!0)))},this))},toggleAllEligibleItemsSelectableState:function(a){d.each(this.tradeInWrapper.find("li .selectable-item"),d.proxy(function(c,b){b=d(b);c=b.find('input[type\x3d"checkbox"]');b.hasClass("selected")||b.hasClass("maxasin")||(a?(b.removeClass("disabled"),c.prop("disabled",!1)):(b.addClass("disabled"),c.prop("disabled",!0)))},this))},toggleReviewTradeInItemsSubmitState:function(d){d=
h(d===a.itemSelectSearchContext?a.tradeInWrapperClass+" "+a.searchResultsListViewClass+" "+a.continueButtonClass:a.tradeInWrapperClass+" "+a.reviewTradeInItemsSubmitId);0<this.selectedEligibleItems.length?d.enable():d.disable()},toggleNextConditionSubmitState:function(e,c){var b=[a.appraisalInputName];d.each(e.tradeInQuestions,function(a,c){c.hasOwnProperty("id")&&b.push(c.id)});var g=!0,f=!1;d.each(b,d.proxy(function(a,b){"Unacceptable"===e.tradeInQuestionResponses[b]&&(f=!0,g=!1);e.tradeInQuestionResponses.hasOwnProperty(b)||
(g=!1)},this));f?this.showAlert(this.alertItemAcceptableClass,c):this.hideAlert();c=h(a.selectedItemConditionViewClass+".active "+a.continueButtonClass);g?(this.setGradedCondition(e),c.enable()):c.disable()},toggleMixedBasketElements:function(a){this.instantPaymentMixed?(a.find("#paidInstantAmount").html(m.formatCurrency(this.tradeInReviewData.orderTotalPaidInstantly)),a.find("#paidNonInstantAmount").html(m.formatCurrency(this.tradeInReviewData.orderTotalPaidOnGrading)),a.find(".mixed-basket #tradeInTotalValue").html(m.formatCurrency(this.tradeInReviewData.orderTotalPaidInstantly)),
a.find(".non-mixed-basket").hide(),a.find(".mixed-basket").show(),a.find(".paid-breakdown-wrapper").show()):(a.find(".non-mixed-basket").show(),a.find(".mixed-basket").hide(),a.find(".paid-breakdown-wrapper").hide())},restoreViewButtonState:function(a,c){d.each(this.selectedEligibleItems,d.proxy(function(b,g){if(g.asin===c){for(var f in g.tradeInQuestionResponses)if(g.tradeInQuestionResponses.hasOwnProperty(f)){var r=g.tradeInQuestionResponses[f];a.find('input[type\x3d"radio"][name\x3d"'+f+'"]').each(function(){d(this).val()===
r&&d(this).prop("checked",!0)})}this.toggleNextConditionSubmitState(g)}},this))},resetEligibleListView:function(){this.tradeInWrapper.find(a.selectedItemConditionViewClass).remove();delete this.boundedViews[this.boundedViews.indexOf(a.selectedItemConditionViewClass)];this.tradeInWrapper.find(a.eligibleListViewClass).remove();delete this.boundedViews[this.boundedViews.indexOf(a.eligibleListViewClass)]},getTradeInTotalValue:function(){var a=0;d.each(this.selectedEligibleItems,function(c,b){a+=b.tradeInValue});
return a},getIsAllGraded:function(){var a=!0;d.each(this.selectedEligibleItems,function(c,b){if(!b.hasBeenGraded)return a=!1});return a},getDataModel:function(a){return a.closest("*[data-template-model]").data("templateModel")},getSortedConditionTradeInValues:function(e){var c=[],b=e.conditionOfferMap,g=a.validConditions,f;for(f in b)if(b.hasOwnProperty(f))if(-1===d.inArray(f,g))m.recordError("Invalid condition",f+" was not found in validConditions array for type: "+e.tradeInItemType);else{var r=
b[f];r.hasOwnProperty("tiv")&&c.push(r.tiv)}c.sort(function(a,b){return a-b});return c},getConditionWeightageMap:function(a){var c=[],b={},g;for(g in a.conditionOfferMap)a.conditionOfferMap.hasOwnProperty(g)&&c.push([g,a.conditionOfferMap[g].tiv]);c.sort(function(a,b){return b[1]-a[1]});d.each(c,function(a,c){b[c[0]]=a});return b},getSearchResultsCacheEntry:function(a){for(var c=0;c<this.searchResultsCache.length;c++){var b=this.searchResultsCache[c];if(b.term===a)return b}b={term:a,eligibleItems:[],
currentPageSize:0,currentPageIndex:1,totalAvailableResults:0};this.searchResultsCache.push(b);return b},getQuestionsByItem:function(a){return this.config.hasOwnProperty("questionnaires")&&this.config.questionnaires[a.tradeInItemType]&&this.config.questionnaires[a.tradeInItemType].hasOwnProperty("questions")?this.config.questionnaires[a.tradeInItemType].questions:[]},getCsrfTokenByKey:function(d){return this.config.hasOwnProperty(a.csrfKeyMap)&&this.config[a.csrfKeyMap][d]?this.config[a.csrfKeyMap][d]:
""},isItemInListByAsin:function(a,c){for(var b=0;b<c.length;b++)if(c[b].asin===a.asin)return!0;return!1},setGradedCondition:function(e){var c=this.getConditionWeightageMap(e),b=[],g=null;d.each(e.tradeInQuestionResponses,function(g,d){g!==a.appraisalInputName&&b.push(c[d])});var f=k.reduce(b,function(a,b){return b&&b>a?b:a},0);d.each(c,function(a,b){if(b===f)return g=a,!1});e.gradedCondition=g;e.tradeInValue=e.conditionOfferMap[g].tiv;var r=this.tradeInWrapper.find("#conditionGrade_"+e.asin);r.find("#estimatedTiv").html(m.formatCurrency(e.tradeInValue));
var h=this.getSortedConditionTradeInValues(e);e=h.indexOf(e.tradeInValue);h.length&&-1!==e&&(r.find(".appraisal-choose-label").css("visibility","visible"),r.find(".appraisal-wrapper").css("visibility","visible"),r.find(".adjusted-pricing").each(function(){d(this).addClass("aok-hidden")}),h=h.slice(0,e),0===h.length?(r.find(".appraisal-choose-label").css("visibility","hidden"),r.find(".appraisal-wrapper").css("visibility","hidden")):(1===h.length?(r=r.find(".adjusted-pricing-single"),r.find("#adjustedPriceLow").html(m.formatCurrency(h[0]))):
(r=3<h.length?r.find(".adjusted-pricing-range"):r.find(".adjusted-pricing-double"),r.find("#adjustedPriceLow").html(m.formatCurrency(h[0])),r.find("#adjustedPriceHigh").html(m.formatCurrency(h[h.length-1]))),r.removeClass("aok-hidden")))},loadingSpinnerShow:function(){this.loadingSpinner.addClass("active")},loadingSpinnerHide:function(){this.loadingSpinner.removeClass("active")},showAlert:function(a,c){this.tradeInWrapper.find(this.navCurrentView+" .alert-wrapper").html("").append(d("#alertTemplates "+
a).clone()).addClass("active")},hideAlert:function(){this.tradeInWrapper.find(this.navCurrentView+" .alert-wrapper").html("").removeClass("active")},recordRefTag:function(a){a=this.tradeInRefTagUrl+this.tradeInRefTagPrefix+a;var c=a+"_"+this.tradeInProductGroup;this.doRecordRefTag(a);this.doRecordRefTag(c)},doRecordRefTag:function(a){k.get(a,{error:function(a,b,g){m.recordError(b+"::"+g,"Error encountered during refTag record request")}})},spliceItemFromList:function(a,c){d.each(c,function(b,g){if(g.asin===
a.asin)return c.splice(b,1),!1})},updateSelectedCountValueHeader:function(){0<this.promosApplied.length&&d.each(this.promosApplied,d.proxy(function(a,c){if(c.productGroup===this.tradeInProductGroup&&c.applied)return this.tradeInWrapper.find(".promo-text").hide(),this.tradeInWrapper.find(".promoText").hide(),this.tradeInWrapper.find(".non-promo-text").show(),!1},this))},validateMaxSelectedItems:function(){this.selectedEligibleItems.length===a.maximumTradeInItemsCount?(this.toggleAllEligibleItemsSelectableState(!1),
this.hasMaxItemsSelected=!0):(this.hideAlert(),this.hasMaxItemsSelected&&(this.toggleAllEligibleItemsSelectableState(!0),this.hasMaxItemsSelected=!1))},validateMaxGiftCardAmount:function(a){(a=this.getTradeInTotalValue()+a.tradeInValue>this.config.maxGiftCardAmount)||this.hideAlert();return a},updateConditionViewHeaderCount:function(d,c){d.find(a.currentSelectedItemIndexId).html(c);d.find(a.selectedItemTotalCountId).html(this.selectedEligibleItems.length)},updateCsrfTokenByKey:function(d,c){c.hasOwnProperty(d)&&
this.config.hasOwnProperty(a.csrfKeyMap)&&(this.config[a.csrfKeyMap][d]=c[d])},updateLaunchButtonText:function(){k.declarative.remove(d("#tradeInLaunchAction"),"launch-tanooki");var a=d(".tradein-instant-savings-launch-button"),c="#successfulNonIpButtonText";this.instantPaymentEligible&&(c=this.promotionEligible?"#successfulIpWithPromotionButtonText":"#successfulIpNoPromotionButtonText");d.each(a,function(){var a=d(".tradein-templates "+c).clone();d(this).replaceWith(a)})}})});"use strict";t.when("A",
"a-modal","a-popover","trade-in-constants","trade-in-common-utils","trade-in-data-binder","trade-in-base-controller","tradein-marketplace-authportal-config","ready").register("trade-in-controller",function(k,n,h,a,m,f,l,q){function d(c){var b;(b=m.getProductGroup())?(c=c+"_"+b,b=a.tradeInRouteBase+"getCustomerItems?deviceType\x3d"+m.getDeviceType()+"\x26productGroup\x3d"+b+"\x26ref_\x3d"+c):b=a.tradeInRouteBase+"generalerror?ref_\x3d"+(c+"_pg_missing");(c=n.get(a.tradeInModalName))||(c=n.create(e("\x3cdiv /\x3e"),
{url:b,name:a.tradeInModalName,header:m.getModalTitle(),width:700,cache:!1,padding:"none"}));c.show()}var e=k.$;m.captureTradeInContext();try{p.sessionStorage&&sessionStorage.getItem("launchTradeIn")&&(d(a.refTagPrefix+"auth_launch"),sessionStorage.removeItem("launchTradeIn"))}catch(c){p.ueLogError&&p.ueLogError({message:c,logLevel:"ERROR",attribution:"tradein: session storage access blocked"})}k.declarative("launch-tanooki","click",function(){d(a.refTagPrefix+"launch")});k.declarative("redirect-to-login",
"click",function(){var c=q.isEnabled?m.getAuthPortalHandleFromHostname():a.authPortalAssocHandle;m.redirectToAuth(c,"launchTradeIn")});return l.extend({deviceType:m.getDeviceType(),authPortalAssocHandle:a.authPortalAssocHandle,searchInputClass:a.searchInputClass,alertMaxGCValueWarningClass:a.alertMaxGCValueWarningClass,alertMaxItemsWarningClass:a.alertMaxItemsWarningClass,alertItemAcceptableClass:a.alertItemAcceptableClass,init:function(){this.setConstants(a.tradeInModalName,m.getProductGroup(),a.refTagPrefix)},
bindEvents:function(){this._super();k.declarative("edit-return-address","click",e.proxy(this.createReturnAddressPopover,this));k.declarative("return-to-shopping","click",e.proxy(function(){this.recordRefTag(a.refTagReturnToShopping);n.get(a.tradeInModalName).hide()},this));k.on("a:expander:weWantYouToKnow:toggle:expand",e.proxy(function(c){c=a.refTagWeWantYouToKnow;this.recordRefTag(c);this.instantPaymentMixed&&(c+="_mb");c+=this.tradeInReviewData.instantPaymentEligible?"_ip":"_nip";c+=this.tradeInReviewData.promotionEligible?
"_p":"_np";this.recordRefTag(c)},this))},getElements:function(){this.base=e(".a-popover-modal").filter(":visible");this._super()},createEligibleListView:function(){this._super();setTimeout(e.proxy(function(){this.tradeInWrapper.css("height","auto")},this),25)},createConfirmationView:function(){if(!this.tradeInReviewData.promotionEligible&&this.config.hasOwnProperty("deviceTradeInFlavor")&&"promo_only"===this.config.deviceTradeInFlavor){var a=f.bindDataToTemplate(e("#promoOnlyValidationErrorView"));
this.tradeInWrapper.append(a)}else this._super(),a=this.tradeInWrapper.find(".tradein-selected-items-confirmation-view"),a.find("#weWantYouToKnow a.a-link-expander").click(),this.instantPaymentMixed||a.find(this.instantPaymentEligible?".ip-eligible":".nip-eligible").show()},createReturnAddressPopover:function(){this.recordRefTag(a.refTagReturnAddressUpdateView);h.create(this.tradeInWrapper.find(".know-list:visible #editReturnAddress"),{name:"returnAddressUpdate",dataStrategy:"inline",inlineContent:e("#returnAddressPopoverTemplate").html(),
width:400,position:"triggerTop",activate:"onclick"}).show();var c=e(".a-popover.a-declarative.a-arrow-top:visible .tradein-popover-address-container");this.createReturnAddressInstance(c)},handleReturnAddressChange:function(a){a=e(a.currentTarget);h.get("returnAddressUpdate").hide();this._super(a)},updateSelectedCountValueHeader:function(){var a=this.selectedEligibleItems.length;if(0===a)this.tradeInWrapper.find(".select-header.promo-text").show(),this.tradeInWrapper.find(".count-value-header").hide();
else{this.tradeInWrapper.find(".select-header.promo-text").hide();var b=this.tradeInWrapper.find(".count-value-header");b.find("#selectedItemTotalCount").html(a);b.find("#tradeInTotalValue").html(m.formatCurrency(this.getTradeInTotalValue()));b.show()}this._super()}})});"use strict";t.when("A","trade-in-controller","ready").register("trade-in-controller-factory",function(k,n){return{ctrlInstance:null,getInstance:function(){this.ctrlInstance||(this.ctrlInstance=new n);return this.ctrlInstance}}});
var v=function(){return function(k){function n(a,b){return a.classList?a.classList.contains(b):(new RegExp("\\b"+b+"\\b")).test(a.className)}function h(a,b,g){a.attachEvent?a.attachEvent("on"+b,g):a.addEventListener(b,g)}function a(a,b,g){a.detachEvent?a.detachEvent("on"+b,g):a.removeEventListener(b,g)}function m(a,b,g,d){h(d||document,b,function(b){for(var d,f=b.target||b.srcElement;f&&!(d=n(f,a));)f=f.parentElement;d&&g.call(f,b)})}if(document.querySelector){var f={selector:0,source:0,minChars:3,
delay:150,offsetLeft:0,offsetTop:1,cache:1,menuClass:"",renderItem:function(a,b){b=b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$\x26");b=new RegExp("("+b.split(" ").join("|")+")","gi");return'\x3cdiv class\x3d"autocomplete-suggestion" data-val\x3d"'+a+'"\x3e'+a.replace(b,"\x3cb\x3e$1\x3c/b\x3e")+"\x3c/div\x3e"},onSelect:function(){}},l;for(l in k)k.hasOwnProperty(l)&&(f[l]=k[l]);var q="object"==typeof f.selector?[f.selector]:document.querySelectorAll(f.selector);for(k=0;k<q.length;k++){var d=q[k];d.sc=
document.createElement("div");d.sc.className="autocomplete-suggestions "+f.menuClass;d.autocompleteAttr=d.getAttribute("autocomplete");d.setAttribute("autocomplete","off");d.cache={};d.last_val="";d.updateSC=function(a,b){var g=d.getBoundingClientRect();if(d.sc.style.left=Math.round(g.left+(p.pageXOffset||document.documentElement.scrollLeft)+f.offsetLeft)+"px",d.sc.style.top=Math.round(g.bottom+(p.pageYOffset||document.documentElement.scrollTop)+f.offsetTop)+"px",d.sc.style.width=Math.round(g.right-
g.left)+"px",!a&&(d.sc.style.display="block",d.sc.maxHeight||(d.sc.maxHeight=parseInt((p.getComputedStyle?getComputedStyle(d.sc,null):d.sc.currentStyle).maxHeight)),d.sc.suggestionHeight||(d.sc.suggestionHeight=d.sc.querySelector(".autocomplete-suggestion").offsetHeight),d.sc.suggestionHeight))b?(a=d.sc.scrollTop,b=b.getBoundingClientRect().top-d.sc.getBoundingClientRect().top,0<b+d.sc.suggestionHeight-d.sc.maxHeight?d.sc.scrollTop=b+d.sc.suggestionHeight+a-d.sc.maxHeight:0>b&&(d.sc.scrollTop=b+a)):
d.sc.scrollTop=0};h(p,"resize",d.updateSC);document.body.appendChild(d.sc);m("autocomplete-suggestion","mouseleave",function(){var a=d.sc.querySelector(".autocomplete-suggestion.selected");a&&setTimeout(function(){a.className=a.className.replace("selected","")},20)},d.sc);m("autocomplete-suggestion","mouseover",function(){var a=d.sc.querySelector(".autocomplete-suggestion.selected");a&&(a.className=a.className.replace("selected",""));this.className+=" selected"},d.sc);m("autocomplete-suggestion",
"mousedown",function(a){if(n(this,"autocomplete-suggestion")){var b=this.getAttribute("data-val");d.value=b;f.onSelect(a,b,this);d.sc.style.display="none"}},d.sc);d.blurHandler=function(){try{var a=document.querySelector(".autocomplete-suggestions:hover")}catch(b){a=0}a?d!==document.activeElement&&setTimeout(function(){d.focus()},20):(d.last_val=d.value,d.sc.style.display="none",setTimeout(function(){d.sc.style.display="none"},350))};h(d,"blur",d.blurHandler);var e=function(a){var b=d.value;if(d.cache[b]=
a,a.length&&b.length>=f.minChars){for(var g="",e=0;e<a.length;e++)g+=f.renderItem(a[e],b);d.sc.innerHTML=g;d.updateSC(0)}else d.sc.style.display="none"};d.keydownHandler=function(a){var b=p.event?a.keyCode:a.which;if((40==b||38==b)&&d.sc.innerHTML){var g,e=d.sc.querySelector(".autocomplete-suggestion.selected");return e?(g=40==b?e.nextSibling:e.previousSibling,g?(e.className=e.className.replace("selected",""),g.className+=" selected",d.value=g.getAttribute("data-val")):(e.className=e.className.replace("selected",
""),d.value=d.last_val,g=0)):(g=40==b?d.sc.querySelector(".autocomplete-suggestion"):d.sc.childNodes[d.sc.childNodes.length-1],g.className+=" selected",d.value=g.getAttribute("data-val")),d.updateSC(0,g),!1}27==b?(d.value=d.last_val,d.sc.style.display="none"):(13==b||9==b)&&(e=d.sc.querySelector(".autocomplete-suggestion.selected"))&&"none"!=d.sc.style.display&&(f.onSelect(a,e.getAttribute("data-val"),e),setTimeout(function(){d.sc.style.display="none"},20))};h(d,"keydown",d.keydownHandler);d.keyupHandler=
function(a){a=p.event?a.keyCode:a.which;if(!a||(35>a||40<a)&&13!=a&&27!=a){var b=d.value;if(b.length>=f.minChars){if(b!=d.last_val){if(d.last_val=b,clearTimeout(d.timer),f.cache){if(b in d.cache)return void e(d.cache[b]);for(a=1;a<b.length-f.minChars;a++){var g=b.slice(0,b.length-a);if(g in d.cache&&!d.cache[g].length)return void e([])}}d.timer=setTimeout(function(){f.source(b,e)},f.delay)}}else d.last_val=b,d.sc.style.display="none"}};h(d,"keyup",d.keyupHandler);d.focusHandler=function(a){d.last_val=
"\n";d.keyupHandler(a)};f.minChars||h(d,"focus",d.focusHandler)}this.destroy=function(){for(var c=0;c<q.length;c++){var b=q[c];a(p,"resize",b.updateSC);a(b,"blur",b.blurHandler);a(b,"focus",b.focusHandler);a(b,"keydown",b.keydownHandler);a(b,"keyup",b.keyupHandler);b.autocompleteAttr?b.setAttribute("autocomplete",b.autocompleteAttr):b.removeAttribute("autocomplete");document.body.removeChild(b.sc)}}}}}();!function(){"function"==typeof define&&define.amd?define("autoComplete",function(){return v}):
"undefined"!=typeof module&&module.exports?module.exports=v:p.autoComplete=v}();"use strict";t.when("A","ready").register("tradein-desktop-side-sheet",function(k){var n,h=k.$,a,m,f,l=!1;return{initialize:function(){a=l?h("\x3cdiv id\x3d'a-popover-lgtbox' class\x3d'a-declarative attach-popover tradein-dss-lgtbox' data-action\x3d'a-popover-floating-close'\x3e\x3c/div\x3e"):h("\x3cdiv id\x3d'a-popover-lgtbox' class\x3d'a-declarative attach-popover tradein-lgtbox' data-action\x3d'a-popover-floating-close'\x3e\x3c/div\x3e");
a.hide();a.appendTo(document.body);a.click(this.close);l?f=h('\x3cdiv id\x3d"tradein-desktop-side-sheet" class\x3d"tradein-dss-pane a-section"\x3e\x3c/div\x3e'):(f=h('\x3cdiv id\x3d"tradein-desktop-side-sheet" class\x3d"a-section"\x3e\x3c/div\x3e'),f.addClass("aok-hidden"));h('\x3cdiv class\x3d"a-spinner-wrapper sidesheet-spinner"\x3e\x3cspan class\x3d"a-spinner a-spinner-medium"\x3e\x3c/span\x3e\x3c/div\x3e').appendTo(f);f.appendTo(document.body);h(document).unbind("keydown",this.onKeyDown);h(document).keydown(this.onKeyDown);
n=this.close},onKeyDown:function(a){27===a.which&&n()},close:function(){k.trigger("tanooki-trade-in-desktop-side-sheet-close");a.hide();l?h(f).fadeOut(500,function(){h(f).remove();h(a).remove();h("body").removeClass("scroll-disabled")}):h(f).animate({right:m},{duration:500,complete:function(){h(f).remove();h(a).remove();h("body").removeClass("scroll-disabled")}})},show:function(k,d){l?(h(f).fadeIn(500),h(f).find(".sidesheet-spinner").addClass("active"),a.show(),h.when(k).done(function(a){h(f).find(".sidesheet-spinner").remove("active");
h("#tradein-desktop-side-sheet.tradein-dss-pane").html(a);d&&"function"===typeof d&&d()})):(h(f).removeClass("aok-hidden"),h(f).animate({right:"0"},500,"linear"),h(f).find(".sidesheet-spinner").addClass("active"),a.show(),h.when(k).done(function(a){h(f).find(".sidesheet-spinner").remove("active");h("#tradein-desktop-side-sheet").html(a);d&&"function"===typeof d&&d()}),m=h(f).css("right"))},setIsDesktopPane:function(a){l=a}}});"use strict";t.when("A","a-popover","trade-in-constants","trade-in-common-utils",
"trade-in-data-binder","trade-in-asin-category-selection-base-controller","tradein-desktop-side-sheet","tradein-marketplace-authportal-config","ready").register("trade-in-wireless-asin-category-selection-controller",function(k,n,h,a,m,f,l,q){function d(g){g=h.refTagTv2+g;var d,f=a.getProductGroup(),e=a.getCurrentAsin();f?(d=g+"_"+f,d={deviceType:a.getDeviceType(),productGroup:f,ref_:d,currentAsin:e},d=c.param(d),d=h.tradeInRouteBase+"wirelessTradeInSearchRefinements?"+d):d=h.tradeInRouteBase+"generalerror?ref_\x3d"+
(g+"_pg_missing");b=c.get(d);l.initialize();c("body").addClass("scroll-disabled");l.show(b,function(){r=!0;0<c("#tradein-desktop-side-sheet").find(".tradein-logged-out-view").length?a.recordTv2RefTag(h.refTagAuthRequired,u):0<=g.indexOf("auth_launch")&&a.recordTv2RefTag(h.refTagAuthCompleted,u)})}function e(){r||a.recordTv2RefTag(h.refTagAuthRequired,u);var b=q.isEnabled?a.getAuthPortalHandleFromHostname():h.authPortalAssocHandle;a.redirectToAuth(b,"launchAsinCategoryTradeIn");a.setStorefrontSessionStorage(g)}
var c=k.$,b,g=!1,u=h.tradeInRouteBase+"recordRefTag?deviceType\x3d"+a.getDeviceType()+"\x26ref_\x3d",r=!1;a.captureTradeInContext();g=a.getStorefrontSessionStorage();a.shouldLaunchTanookiV2OnPageLoad()&&d("auth_launch");k.declarative("launch-tanooki-wireless","click",function(){l.setIsDesktopPane(!1);d("launch")});k.declarative("launch-tanooki-v2","click",function(){l.setIsDesktopPane(!1);d("launch")});k.declarative("launch-tanooki-v2-dss","click",function(){l.setIsDesktopPane(!0);d("ingDSS");a.recordTv2RefTag("ingDSS",
u)});k.declarative("launch-tanooki-v2-storefront","click",function(b){g=!0;a.updateTradeInContext(b.data);d("launch")});k.declarative("redirect-to-login-wireless","click",function(){e()});k.declarative("redirect-to-login-v2","click",function(){e()});return f.extend({deviceType:a.getDeviceType(),authPortalAssocHandle:h.authPortalAssocHandle,init:function(){this.setConstants(h.tradeInSideSheetName,a.getProductGroup(),g)},bindEvents:function(){this._super();this.tradeInWrapper.delegate(".exit-sidesheet-button",
"click",c.proxy(function(){l.close()},this));this.tradeInWrapper.delegate(".return-to-shopping, #returnToShopping","click",c.proxy(function(){l.close()},this));k.off("tanooki-trade-in-desktop-side-sheet-close");k.on("tanooki-trade-in-desktop-side-sheet-close",c.proxy(function(){a.recordTv2RefTag(h.refTagExit+this.getCurrentViewForRefTag(),this.tradeInRefTagUrl,this.bifurcationRefTags)},this))},getElements:function(){this.base=c("#tradein-desktop-side-sheet");this._super()},createReturnAddressPopover:function(){a.recordTv2RefTag(h.refTagReturnAddressUpdateView,
this.tradeInRefTagUrl,this.bifurcationRefTags);n.create(this.tradeInWrapper.find("#editReturnAddress"),{name:"returnAddressUpdate",dataStrategy:"inline",inlineContent:c("#returnAddressPopoverTemplate").html(),width:400,position:"triggerTop",activate:"onclick"}).show();c(".a-popover").addClass("popover-content-overlay");var b=c(".a-popover.a-declarative.a-arrow-top:visible .tradein-popover-address-container");this.createReturnAddressInstance(b)},createPromotionInformationPanel:function(){a.recordTv2RefTag(h.refTagPromotionInformationPopoverView,
this.tradeInRefTagUrl,this.bifurcationRefTags);n.create(this.tradeInWrapper.find("#promotionInformationPopover"),{name:"promotionInformationPopover",dataStrategy:"inline",inlineContent:c("#promotionInformationPopoverTemplate").html(),width:400,position:"triggerBottom",activate:"onclick"}).show();c(".a-popover").addClass("popover-content-overlay")},createAppraisalLearnMorePanel:function(){a.recordTv2RefTag(h.refTagAppraisalLearnMorePopoverView,this.tradeInRefTagUrl,this.bifurcationRefTags);var b=n.create(this.tradeInWrapper.find("#appraisalLearnMore"),
{name:"appraisalLearnMorePopover",dataStrategy:"inline",inlineContent:c("#appraisalLearnMorePopoverTemplate").html(),width:400,position:"triggerTop",activate:"onclick"});this.tradeInProductGroup===h.tradeInEchoGl&&c("#appraisalLearnMorePopoverTemplate").find(".echo-learn-more-link").removeClass("aok-hidden");b.show();c(".a-popover").addClass("popover-content-overlay")},createRegisteredDevicesLearnMorePanel:function(){a.recordTv2RefTag(h.refTagRegisteredDevicesLearnMorePopoverView,this.tradeInRefTagUrl,
this.bifurcationRefTags);n.create(this.tradeInWrapper.find("#registeredDevicesLearnMore"),{name:"registeredDevicesLearnMorePopover",dataStrategy:"inline",inlineContent:c("#registeredDevicesLearnMorePopoverTemplate").html(),width:400,position:"triggerBottom",activate:"onclick"}).show();c(".a-popover").addClass("popover-content-overlay")},createAsinDetailsView:function(a){a=c(a.currentTarget);var b=a.data("asinDetailsData");if(b){var g=m.bindDataToAsinSelectionTemplate(this.asinDetailsViewTemplate,
b);if(b.hasOwnProperty("isEnabled")&&!b.isEnabled){var b=g.find(".tiv-estimate-container"),d=b.find(".unavailable-offer");c(d).removeClass("aok-hidden");c(b).html(d)}var g={name:"asinDetailsView",inlineContent:g,width:500,position:"triggerHorizontal",activate:"onclick"},f=n.create(this.tradeInWrapper.find(a),g);f.show();c(".a-popover").addClass("popover-content-overlay");k.on("a:popover:afterShow",function(){c(".a-scroller").addClass("scroll-disabled")});k.on("a:popover:afterHide",function(){c(".a-scroller").removeClass("scroll-disabled")});
k.on("tanooki-trade-in-desktop-side-sheet-close",function(){f.hide()})}},createVerticalCardViewComponentWithTradeInTotalContent:function(b,g,d){try{var f=this.getSanitizedItemListFromReviewData();if(this.searchTradeInImageIndicator&&0<f.length){var e={imageUrl:this.searchTradeInImageIndicator,maxTiv:g};e[b]="classType";var h=m.bindDataToAsinSelectionTemplate(this.verticalComplexCardViewTemplate,e),u=h.find("#tradeinTotalWithOfferDetailsComponent");f[0].instantPayable?(u.find(".ip").html(a.formatCurrency(g)),
u.find(".instant-payable").removeClass("aok-hidden")):(u.find(".not-instant-payable").html(a.formatCurrency(g)),u.find(".not-instant-payable").removeClass("aok-hidden"))}else a.recordError("Required data for vertical card view unavailable","Error encountered hitting search refinement request");var r=h.find("#tradeinEstimateOfferComponent .selection-history-list"),k=this.categoryRefinementSelectionItemComponent;0<this.config.translatedSelectionHistory.length?(this.translatedSelectionHistory=this.config.translatedSelectionHistory,
this.config.translatedSelectionHistory.forEach(function(a){a=m.bindDataToAsinSelectionTemplate(k,{selectionItem:a});c(r).append(a)})):0<this.config.restrictionHistory.length?(this.restrictionHistory=this.config.restrictionHistory,this.config.restrictionHistory.forEach(function(a){a=m.bindDataToAsinSelectionTemplate(k,{selectionItem:a.emittedData});c(r).append(a)})):h.find(".vertical-card-tradein-details").addClass("aok-hidden");var l=f.some(function(a){if(a.asin===d)return a.instantPayable});this.config.finalSearchResult&&
h.find("#itemTitle").html(a.generatePrettyTitle(this.config.finalSearchResult.asinTitle));a.isGlEligibleForPastPurchases(this.tradeInProductGroup)&&c.each(this.pastPurchasedEligibleItems,function(b,c){d===c.asin&&h.find("#itemTitle").html(a.generatePrettyTitle(c.title))});if(l){var n=h.find("#ipOfferAmount");c(n).removeClass("aok-hidden");var q=this.tradeInReviewData.orderTotalPaidInstantly,p=c(n).find(".price").first();c(p).html(a.formatCurrency(q))}else{n=h.find("#nonIpOfferAmount");c(n).removeClass("aok-hidden");
var t=this.tradeInReviewData.orderTotalPaidOnGrading,v=c(n).find(".price").first();c(v).html(a.formatCurrency(t))}}catch(z){throw"[Error at createVerticalCardViewComponentWithTradeInTotalContent]"+z;}return h}})});"use strict";t.when("A","trade-in-wireless-asin-category-selection-controller","ready").register("trade-in-asin-category-selection-controller-factory",function(k,n){return{ctrlInstance:null,getInstance:function(){this.ctrlInstance||(this.ctrlInstance=new n);return this.ctrlInstance}}});
"use strict";t.when("A","a-popover","a-button","trade-in-constants","trade-in-common-base","trade-in-common-utils","trade-in-data-binder","tradein-marketplace-authportal-config","cetech-refactor-shipment-messaging","tradein-use-formatted-dates","ready").register("trade-in-asin-category-selection-base-controller",function(k,n,h,a,m,f,l,q,d,e){var c=k.$;return m.extend({config:null,deviceType:null,authPortalAssocHandle:null,navViews:null,navCurrentView:null,tradeInWrapper:null,loadingSpinner:null,tradeInViewInstanceName:null,
tradeInSaveGradedItemConditionUrl:null,tradeInReviewUrl:null,tradeInSubmitUrl:null,tradeInRefTagUrl:null,tradeInRemoveItemUrl:null,tradeInRefTagPrefix:null,bifurcationRefTags:[],tradeInProductGroup:null,restrictionSelectionPage:[],priceHistory:[],showVerticalImageCardView:!1,searchTradeInImageIndicator:null,finalSearchResults:null,changeConditionData:null,conditionSelectionMap:null,isChangeConditionContext:!1,estimatedMaxTiv:0,expectedPages:0,hasPendingRequest:!1,tradeInReviewData:null,promotionEligible:!1,
selectionInProgress:!1,isProcessing:!1,invalidReturnAddress:!1,isStorefront:!1,tradeInSearchCurrentState:{term:""},searchPageSize:0,searchOffersOnly:!0,pastPurchasedEligibleItems:[],questionnaires:[],restrictionHistory:[],translatedSelectionHistory:[],previousView:null,currentAsin:[],promoData:null,tradeInCartQuantity:0,tradeInCartTiv:0,conditionViewTemplate:null,tradeinHeaderViewTemplate:null,tradeInPromoPreviewViewTemplate:null,tradeinCartHeaderTemplate:null,tradeinCartSubmitViewHeaderTemplate:null,
verticalComplexCardViewTemplate:null,appraisalSelectionComponentView:null,termsAndAgreementViewTemplate:null,multiItemTermsAndAgreementViewTemplate:null,multiItemTermsAndAgreementViewTemplateDevices:null,tradeinReviewYourOrderNextStepTemplate:null,mixedOfferNextStepsTemplate:null,multiItemConfirmationOrderDetailsViewComponent:null,tradeinFooterComponent:null,successfulTradeInBannerComponentView:null,tradeInSubmitConditionButtonTemplate:null,binaryQuestionnaireListViewTemplate:null,shipmentDetailViewComponent:null,
searchRefinementItemSelectionTemplate:null,refinementSearchViewTemplate:null,categoryRefinementSelectionItemComponent:null,tradeinCartItemComponent:null,shipmentDetailsHeaderComponent:null,tradeinSubmitButtonComponent:null,tradeinSubmitWrapperComponent:null,tradeinCartTemplate:null,customerPastDevicesPurchasesCarouselContainerTemplate:null,pastPurchasedListViewTemplate:null,load:function(){this.config=k.state("tradeInConfig");this.pastPurchasedEligibleItems=this.config.eligibleItems;this.questionnaires=
this.config.questionnaires;f.setLocale(this.config.locale);f.setCurrencyCode(this.config.currencyCode);l.setCommonUtils(f);this.navViews={refinementSelectionView:a.refinementSelectionViewWrapperClass,refinementSearchView:a.refinementSearchViewClass,tradeInConditionView:a.conditionViewTemplateId,submitTradeInView:a.submitTradeInWrapperClass,tradeInCartView:a.tradeInCartViewClass,restrictionSearchTradeInNextStepView:a.tradeinReviewYourOrderNextStepTemplateId};this.init();this.getElements();this.bindEvents();
this.cleanState();this.navCurrentView=this.navViews.refinementSelectionView;this.updateCartHeaderData();this.createView();this.restrictionSelectionPage.push(this.navCurrentView)},setConstants:function(b,c,d){this.tradeInRefTagPrefix=a.refTagTv2;this.tradeInViewInstanceName=b;this.tradeInProductGroup=c;this.tradeInSubmitUrl=a.tradeInRouteBase+"confirmTradeInOrder?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+this.tradeInRefTagPrefix+"submit_request_"+c;this.tradeInSaveGradedItemConditionUrl=a.tradeInRouteBase+
"addToTradeIn";this.tradeInRefTagUrl=a.tradeInRouteBase+"recordRefTag?deviceType\x3d"+this.deviceType+"\x26ref_\x3d";this.tradeInReviewUrl=a.tradeInRouteBase+"reviewTradeInOrder?deviceType\x3d"+this.deviceType+"\x26productGroup\x3d"+c+"\x26ref_\x3d"+this.tradeInRefTagPrefix+"review_request_"+c;this.tradeInSearchCategoryRefinementUrl=a.tradeInRouteBase+"searchRestrictionItems?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+this.tradeInRefTagPrefix+"\x26productGroup\x3d"+c;this.tradeInGetSelfGradingQuestionnaireUrl=
a.tradeInRouteBase+"getSelfGradingQuestionnaire?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+this.tradeInRefTagPrefix+"\x26productGroup\x3d"+c;this.tradeInRemoveItemUrl=a.tradeInRouteBase+"removeItem?deviceType\x3d"+this.deviceType+"\x26ref_\x3d"+this.tradeInRefTagPrefix+"remove_item_request_"+c;this.isStorefront=d;this.searchPageSize=f.getTanookiV2SearchPageSize(this.deviceType)},getElements:function(){this.tradeInWrapper=this.base.find(a.tradeInWrapperClass);this.conditionViewTemplate=this.base.find(a.conditionViewTemplateId);
this.tradeinHeaderViewTemplate=this.base.find(a.tradeinHeaderViewTemplateId);this.tradeinCartHeaderTemplate=this.base.find(a.tradeinCartHeaderTemplateId);this.tradeinCartSubmitViewHeaderTemplate=this.base.find(a.tradeinCartSubmitViewHeaderTemplateId);this.tradeInCartPromosTemplate=this.base.find(a.tradeInCartPromosTemplateId);this.tradeInPromoPreviewViewTemplate=this.base.find(a.tradeInPromoPreviewViewTemplate);this.verticalComplexCardViewTemplate=this.base.find(a.verticalComplexCardViewTemplateId);
this.appraisalSelectionComponentView=this.base.find(a.appraisalSelectionComponentViewId);this.promotionInformationComponent=this.base.find(a.promotionInformationComponentId);this.termsAndAgreementViewTemplate=this.base.find(a.termsAndAgreementViewTemplateId);this.multiItemTermsAndAgreementViewTemplate=this.base.find(a.multiItemTermsAndAgreementViewTemplateId);this.multiItemTermsAndAgreementViewTemplateDevices=this.base.find(a.multiItemTermsAndAgreementViewTemplateDevicesId);this.tradeinReviewYourOrderNextStepTemplate=
this.base.find(a.tradeinReviewYourOrderNextStepTemplateId);this.mixedOfferNextStepsTemplate=this.base.find(a.mixedOfferNextStepsTemplateId);this.multiItemConfirmationOrderDetailsViewComponent=this.base.find(a.multiItemConfirmationOrderDetailsViewComponentClass);this.tradeinFooterComponent=this.base.find(a.tradeinFooterComponentId);this.successfulTradeInBannerComponentView=this.base.find(a.successfulTradeInBannerComponentViewId);this.tradeInSubmitConditionButtonTemplate=this.base.find(a.tradeInSubmitConditionButtonTemplateId);
this.binaryQuestionnaireListViewTemplate=this.base.find(a.binaryQuestionnaireListViewTemplateId);this.shipmentDetailViewComponent=this.base.find(a.shipmentDetailViewComponentId);this.searchRefinementItemSelectionTemplate=this.base.find(a.searchRefinementItemSelectionTemplateId);this.refinementSearchViewTemplate=this.base.find(a.refinementSearchViewTemplateId);this.categoryRefinementSelectionItemComponent=this.base.find(a.categoryRefinementSelectionItemComponentId);this.tradeinCartItemComponent=this.base.find(a.tradeinCartItemComponentId);
this.shipmentDetailsHeaderComponent=this.base.find(a.shipmentDetailsHeaderComponentClass);this.tradeinSubmitButtonComponent=this.base.find(a.tradeinSubmitButtonComponentClass);this.tradeinSubmitWrapperComponent=this.base.find(a.tradeinSubmitWrapperComponentId);this.tradeInCartTemplate=this.base.find(a.tradeInCartTemplateId);this.customerPastDevicesPurchasesCarouselContainerTemplate=this.base.find(a.customerPastDevicesPurchasesCarouselContainerId);this.pastPurchasedListViewTemplate=this.base.find(a.pastPurchasedListViewTemplateId);
this.asinDetailsViewTemplate=this.base.find(a.asinDetailsViewTemplateId);this.loadingSpinner=this.base.find(a.loadingSideSheetSpinnerClass);this.base.find(a.tradeInMoreItemsButtonContainerClass).removeClass("aok-hidden")},bindEvents:function(){this.tradeInWrapper.delegate(".previous-button","click",c.proxy(this.handlePreviousButton,this));this.tradeInWrapper.delegate(".navigate-to-cart-button","click",c.proxy(this.handleNavigateToCart,this));this.tradeInWrapper.delegate(".error-alert-continue-button",
"click",c.proxy(this.handleNavigateToCart,this));this.tradeInWrapper.delegate(".non-tradeable-error-alert-continue-button","click",c.proxy(this.handleTradeInMoreItems,this));this.tradeInWrapper.delegate("#editReturnAddress","click",c.proxy(this.createReturnAddressPopover,this));this.tradeInWrapper.delegate("#promotionInformationPopover","click",c.proxy(this.createPromotionInformationPanel,this));this.tradeInWrapper.delegate("#appraisalLearnMore","click",c.proxy(this.createAppraisalLearnMorePanel,
this));this.tradeInWrapper.delegate("#registeredDevicesLearnMore","click",c.proxy(this.createRegisteredDevicesLearnMorePanel,this));this.tradeInWrapper.delegate(".adjusted-value-agreement-button","click",c.proxy(this.handleAdjustedValueAgreementButton,this));this.tradeInWrapper.delegate(".handle-submit-your-tradein","click",c.proxy(function(a){var g=c(a.currentTarget);h(a).isEnabled()&&!g.hasClass("a-button-disabled")&&this.handleTradeInSubmit()},this));this.tradeInWrapper.delegate(".handle-review-your-tradein",
"click",c.proxy(function(a){var g=c(a.currentTarget);h(a).isEnabled()&&!g.hasClass("a-button-disabled")&&this.handleNavigateToCart()},this));this.tradeInWrapper.delegate(".handle-trade-in-more-items","click",c.proxy(function(a){this.handleTradeInMoreItems()},this));this.tradeInWrapper.delegate(".agreement-checkbox","change",c.proxy(function(a){this.handleTermsAndAgreementCheckboxSelection(a)},this));this.tradeInWrapper.delegate(".continue-trigger","click",c.proxy(function(a){h(a).isEnabled()&&(this.isChangeConditionContext?
this.handleChangeConditionComplete():this.handleContinueConditionButtonClick())},this));this.tradeInWrapper.delegate(a.conditionQuestionButtonSelectorClass,"click",c.proxy(function(a){var g=c(a.currentTarget);h(g).isEnabled()&&!g.hasClass("a-button-unavailable")&&this.handleConditionSelection(a)},this));this.tradeInWrapper.delegate(".submit-refinement button","click",c.proxy(function(a){var g=c(a.currentTarget);h(g).isEnabled()&&!g.hasClass("a-button-unavailable")&&this.handleRefinementSubmit(a)},
this));this.tradeInWrapper.delegate(".past-purchase-refinement","click",c.proxy(function(a){var g=c(a.currentTarget);h(g).isEnabled()&&!g.hasClass("a-button-unavailable")&&this.handlePastPurchaseRefinementSelect(a)},this));this.tradeInWrapper.delegate(".refinement-search-form","submit",c.proxy(function(a){this.handleRefinementSearchFormSubmit(a)},this));this.tradeInWrapper.delegate("#loadMoreSearchResults","click",c.proxy(function(a){c(a.currentTarget).blur();this.handleLoadMoreSearchResults()},this));
this.tradeInWrapper.delegate("#seeAllSearchResults","click",c.proxy(function(){this.searchOffersOnly=!1;this.handleRefinementSearchFormSubmit()},this));this.tradeInWrapper.delegate("#seeOnlyOffersSearchResults","click",c.proxy(function(){this.searchOffersOnly=!0;this.handleRefinementSearchFormSubmit()},this));this.tradeInWrapper.delegate(a.refinementSearchInputSelector,"focusin",c.proxy(function(){this.tradeInWrapper.find(".refinement-search-button").addClass("active")},this));this.tradeInWrapper.delegate(a.refinementSearchInputSelector,
"focusout",c.proxy(function(){this.tradeInWrapper.find(".refinement-search-button").removeClass("active")},this));this.tradeInWrapper.delegate(".refinement-search-item-title","click",c.proxy(function(a){this.createAsinDetailsView(a)},this));this.tradeInWrapper.delegate(".tradein-cart-item a.remove-link","click",c.proxy(function(b){f.recordTv2RefTag(a.refTagRemoveCartItem,this.tradeInRefTagUrl,this.bifurcationRefTags);this.handleRemoveCartItem(b)},this));this.tradeInWrapper.delegate(".tradein-cart-item a.change-condition-link",
"click",c.proxy(function(b){f.recordTv2RefTag(a.refTagChangeCondition,this.tradeInRefTagUrl,this.bifurcationRefTags);this.handleNavigateToChangeCondition(b)},this));this.tradeInWrapper.delegate("a.tradein-login","click",c.proxy(function(){var a=q.isEnabled?f.getAuthPortalHandleFromHostname():this.authPortalAssocHandle;f.redirectToAuth(a,"launchAsinCategoryTradeIn")},this));this.tradeInWrapper.delegate("#submitTradeInButtonAgreementText","click",c.proxy(function(){f.recordTv2RefTag(a.refTagTermsAndConditions,
this.tradeInRefTagUrl,this.bifurcationRefTags)},this));this.tradeInWrapper.delegate("a#howToLink","click",c.proxy(function(){f.recordTv2RefTag(a.retTagHowToLink+"_"+this.getCurrentRefinementTitleForRefTag(),this.tradeInRefTagUrl,this.bifurcationRefTags)},this))},createView:function(){this.clearAllViews();switch(this.navCurrentView){case this.navViews.refinementSelectionView:this.recordViewRefTag();this.createRestrictionItemView();break;case this.navViews.refinementSearchView:this.recordViewRefTag();
this.createRefinementSearchView();break;case this.navViews.tradeInConditionView:this.isChangeConditionContext?this.createTradeInChangeConditionView():(this.recordViewRefTag(),this.createTradeInConditionView());break;case this.navViews.submitTradeInView:this.recordViewRefTag();this.createSubmitTradeInView();break;case this.navViews.tradeInCartView:this.recordViewRefTag();this.createTradeInCartView();break;case this.navViews.restrictionSearchTradeInNextStepView:this.createTradeInNextStepsView();break;
default:this.createRestrictionItemView()}},createTradeInHeaderComponent:function(a){try{var c=l.bindDataToAsinSelectionTemplate(this.tradeinHeaderViewTemplate,{progressPercentage:Math.ceil(this.config.pageIndex/this.expectedPages*100)+"%"});c.find(".back-button-container").removeClass("aok-hidden");a||c.find(".previous-button").addClass("aok-hidden")}catch(d){f.recordError(d,"Error occurred at createTradeInHeaderComponent")}return c},createTradeInCartHeaderComponent:function(b){try{var c=l.bindDataToAsinSelectionTemplate(b,
{cartQuantity:this.tradeInCartQuantity,cartTiv:this.tradeInCartTiv});this.tradeInCartQuantity&&0!==this.tradeInCartQuantity?(c.removeClass("aok-hidden"),1===this.tradeInCartQuantity?(c.find(a.tradeinCartHeaderItemsSingularClass).removeClass("aok-hidden"),c.find(a.tradeinCartHeaderItemsPluralClass).addClass("aok-hidden")):(c.find(a.tradeinCartHeaderItemsSingularClass).addClass("aok-hidden"),c.find(a.tradeinCartHeaderItemsPluralClass).removeClass("aok-hidden"))):c.addClass("aok-hidden")}catch(d){f.recordError(d,
"Error occurred at createTradeInCartHeaderComponent")}return c},shouldShowPromos:function(){return this.tradeInReviewData.hasOwnProperty("promotionEligible")&&this.tradeInReviewData.promotionEligible&&Array.isArray(this.tradeInReviewData.promotionEligibilityText)&&this.tradeInReviewData.promotionEligibilityText.length?!0:!1},shouldShowPromoHeader:function(){return 0===this.tradeInCartQuantity},createVerticalCardViewComponentWithTradeInEstimateContent:function(){try{if(this.searchTradeInImageIndicator&&
this.estimatedMaxTiv)var a=l.bindDataToAsinSelectionTemplate(this.verticalComplexCardViewTemplate,{tradeinEstimateDetails:"classType",imageUrl:this.searchTradeInImageIndicator,maxTiv:this.estimatedMaxTiv});else f.recordError("Required data for vertical card view unavailable","Error encountered hitting search refinement request");var g=a.find(".selection-history-list"),d=this.categoryRefinementSelectionItemComponent;if(this.config.finalSearchResult){var e=f.generatePrettyTitle(this.config.finalSearchResult.asinTitle);
a.find("#itemTitle").html(e)}else if(this.finalSearchResults){var h=this.finalSearchResults.asin;this.pastPurchasedEligibleItems&&c.each(this.pastPurchasedEligibleItems,function(c,g){h===g.asin&&a.find("#itemTitle").html(f.generatePrettyTitle(g.title))})}0<this.currentAsin.length&&a.find("#itemTitle").html(f.generatePrettyTitle(this.currentAsin.title));0<this.config.translatedSelectionHistory.length?(this.translatedSelectionHistory=this.config.translatedSelectionHistory,this.config.translatedSelectionHistory.forEach(function(a){a=
l.bindDataToAsinSelectionTemplate(d,{selectionItem:a});c(g).append(a)})):0<this.config.restrictionHistory.length?(this.restrictionHistory=this.config.restrictionHistory,this.config.restrictionHistory.forEach(function(a){a=l.bindDataToAsinSelectionTemplate(d,{selectionItem:a.emittedData});c(g).append(a)})):a.find(".vertical-card-tradein-details").addClass("aok-hidden")}catch(k){throw"[Error at createVerticalCardViewComponentWithTradeInEstimateContent]"+k;}return a},createPastDevicePurchasesContainerViewComponent:function(){var b=
this.pastPurchasedEligibleItems,c=l.bindDataToTemplate(this.customerPastDevicesPurchasesCarouselContainerTemplate,{instantPayable:this.config.hasOwnProperty("instantPayable")?this.config.instantPayable:!1});c.find(a.eligibleItemsCountId).append(b.length);var d=c.find(a.eligibleItemListWrapper);this.createPastPurchasesForTradeInCardTemplates(b,this.pastPurchasedListViewTemplate,d);this.tradeInWrapper.append(c);return c},createPastPurchasesForTradeInCardTemplates:function(b,g,d){c.each(b,c.proxy(function(b,
c){b=l.bindDataToTemplate(g,c);var e=f.formatCurrency(c.conditionOfferMap.NonFunctional.tiv),h=c.tradeInItemType===a.tradeInItemTypeEcho?f.formatCurrency(c.conditionOfferMap.Working.tiv):f.formatCurrency(c.conditionOfferMap.Good.tiv);if(c.deviceTitle){var k=this.truncateString(c.deviceTitle,18);b.find(".item-device-title").removeClass("aok-hidden");b.find(".item-device-title").html(k);k=this.truncateString(f.generatePrettyTitle(c.title),15)}else k=this.truncateString(f.generatePrettyTitle(c.title),
28);b.find(".item-title").html(k);""!==c.dateRegisteredString&&(b.find(".registered-date-wrapper").removeClass("aok-hidden"),b.find(a.dateRegisteredClass).html(c.dateRegisteredString));e!==h?(b.find(".tiv-estimate-container .min-tiv").html(e+" -"),b.find(".tiv-estimate-container .max-tiv").html(h)):b.find(".tiv-estimate-container .max-tiv").html(e);d.append(b)},this))},truncateString:function(a,c){return a.length>c?a.substr(0,c-1)+"\x26hellip;":a},createShipmentDetailComponent:function(){try{var a=
l.bindDataToAsinSelectionTemplate(this.shipmentDetailViewComponent),c=e.isEnabled?this.tradeInReviewData.shipByDateString:f.formatDate(this.tradeInReviewData.shipByDate);a.find(".shipByDate").html(c);a.find(".customerEmail").html(this.tradeInReviewData.emailAddress);if(this.tradeInReviewData.hasOwnProperty("defaultReturnAddress")){var d=this.tradeInReviewData.defaultReturnAddress.line1+" - "+this.tradeInReviewData.defaultReturnAddress.city+" "+this.tradeInReviewData.defaultReturnAddress.postalCode;
a.find(".customerAddress").html(d)}}catch(h){throw"[Error at createShipmentDetailComponent]"+h;}return a},createSubmitButtonComponent:function(){var b=this.tradeinSubmitWrapperComponent.clone();b.removeClass("aok-hidden");f.isGlEligibleForPastPurchases(this.tradeInProductGroup)?(h(c(b.find(a.submitButtonViewClass))).enable(),h(c(b.find(a.tradeInMoreItemsButtonViewClass))).enable()):(h(c(b.find(a.submitButtonViewClass))).disable(),h(c(b.find(a.reviewButtonViewClass))).disable(),h(c(b.find(a.tradeInMoreItemsButtonViewClass))).disable());
return b},createTermsAndAgreementComponent:function(b){try{var g=l.bindDataToAsinSelectionTemplate(b);h(c(g.find(".a"))).disable();d.isEnabled||c(g).removeClass("terms-shadow");f.isGlEligibleForPastPurchases(this.tradeInProductGroup)?(h(c(g.find(a.submitButtonViewClass))).enable(),h(c(g.find(a.tradeInMoreItemsButtonViewClass))).enable()):(h(c(g.find(a.submitButtonViewClass))).disable(),h(c(g.find(a.reviewButtonViewClass))).disable(),h(c(g.find(a.tradeInMoreItemsButtonViewClass))).disable());var e=
!1;this.config.restrictionHistory.length?this.config.restrictionHistory.forEach(function(a,b){"manufacturer"===a.key&&"Apple"===a.emittedData&&(e=!0)}):f.recordError("Missing Restriction History\n"+JSON.stringify(this.config),"Error occured when access restriction history");e&&g.find(".alert-box").append(c(".tradein-templates .tradein-info-apple-device").clone())}catch(k){throw"[Error at createTermsAndAgreementComponent]"+k;}return g},createSubmitTradeinInformation:function(){try{var a=c(".tradein-templates #submitTradeInInformationTemplate #submitTradeInInstructionText").clone()}catch(g){throw"[Error at createSubmitTradeinInformation]"+
g;}return a},createAdjustedValueQuestionComponent:function(b){try{var c=f.findMinMaxTivInContainer(b),d=l.bindDataToAsinSelectionTemplate(this.appraisalSelectionComponentView,{minTiv:c[0],maxTiv:c[1]});d.find(a.appraisalTivHeaderClass).removeClass("aok-hidden");d.addClass("aok-hidden")}catch(e){throw"[Error at createAdjustedValueQuestionComponent]"+e;}return d},createFooterComponent:function(){try{var a=l.bindDataToAsinSelectionTemplate(this.tradeinFooterComponent)}catch(c){throw"[Error at createFooterComponent]"+
c;}return a},createConditionQuestionComponent:function(b){try{for(var g=l.bindDataToAsinSelectionTemplate(this.conditionViewTemplate),d=0;d<b.length;d++){var f=b[d],e=l.bindDataToAsinSelectionTemplate(this.binaryQuestionnaireListViewTemplate,f);if(f.hasOwnProperty("choices"))for(var h=c(e.find(".radio-button-list")),k=0;k<f.choices.length;k++)if(f.choices[k]){var m=f.choices[k],n;if(0===k)n=c(h).find("#binaryAnswerOne");else if(1===k)n=c(h).find("#binaryAnswerTwo");else continue;n.attr("name",f.id);
n.attr("value",m.condition);c(n).find(".a-button-inner .a-button-text").html(m.descriptionText)}g.find(a.conditionQuestionnaireListClass).append(e)}}catch(q){throw"[Error at createConditionQuestionComponent]"+q;}return g},createSubmitTradeInView:function(){try{var b=1<this.tradeInCartQuantity,g=[],e=this.finalSearchResults.asin,h;if(this.tradeInReviewData.hasOwnProperty("qtyLimitExceedItems"))f.isMobileVariant(this.deviceType)||this.tradeInWrapper.append(c(a.tradeInErrorExitButtonSelector).clone()).addClass("active"),
this.tradeInWrapper.append(c(a.tradeInQuantityExceededErrorSelector).clone()).addClass("active");else if(this.tradeInReviewData.hasOwnProperty("nonTradeableItems"))f.isMobileVariant(this.deviceType)||this.tradeInWrapper.append(c(a.tradeInErrorExitButtonSelector).clone()).addClass("active"),this.tradeInWrapper.append(c(a.tradeInNonTradeableErrorSelector).clone()).addClass("active");else{if(this.tradeInReviewData.hasOwnProperty("hazmatErrors")){var k=this.tradeInReviewData.hazmatErrors,l=!1;k.forEach(function(a){a.asin===
e&&(l=!0)});if(l){f.isMobileVariant(this.deviceType)||this.tradeInWrapper.append(c(a.tradeInErrorExitButtonSelector).clone()).addClass("active");this.tradeInWrapper.append(c(a.tradeInMixHazmatErrorSelector).clone()).addClass("active");return}h=c(a.tradeInMixHazmatCartItemErrorSelector).clone();var m=h.find(a.tradeInHazmatItemList);k.forEach(function(b){var c=h.find(a.tradeInHazmatListItemTemplate).clone();c.html(b.title).removeClass("aok-hidden");m.append(c)});f.recordTv2RefTag(a.refTagHazmatError,
this.tradeInRefTagUrl,this.bifurcationRefTags)}this.promotionEligible=this.tradeInReviewData.hasOwnProperty("promotionEligible")?this.tradeInReviewData.promotionEligible:!1;g.push(this.createTradeInHeaderComponent(!0));if(this.shouldShowPromos()){this.promoData=this.tradeInReviewData.promotionEligibilityText;this.tradeInReviewData.hasOwnProperty("promotionMessages")&&this.tradeInReviewData.promotionMessages&&(this.promoData=this.tradeInReviewData.promotionMessages);var n=this.generatePromoHeader(this.tradeInCartPromosTemplate,
this.promoData);g.push(n)}g.push(this.createTradeInCartHeaderComponent(this.tradeinCartSubmitViewHeaderTemplate));var q=0;this.getSanitizedItemListFromReviewData().forEach(function(a){a.asin===e&&(q=a.tradeInValue)});if(b)g.push(this.createVerticalCardViewComponentWithTradeInTotalContent("tradeinTotalOfferDetails",q,e)),h&&g.push(h.addClass("active")),f.isGlEligibleForPastPurchases(this.tradeInProductGroup)?g.push(this.createTermsAndAgreementComponent(this.multiItemTermsAndAgreementViewTemplateDevices)):
g.push(this.createTermsAndAgreementComponent(this.multiItemTermsAndAgreementViewTemplate));else{var p=this.hasDefaultReturnAddress();p&&g.push(p);g.push(this.createVerticalCardViewComponentWithTradeInTotalContent("tradeinTotalOfferDetails",q,e));h&&g.push(h.addClass("active"));g.push(this.createSubmitTradeinInformation());if(d.isEnabled){var t=this.createTermsAndAgreementComponent(this.termsAndAgreementViewTemplate);t.find(a.tradeinSubmitButtonComponentClass).addClass("aok-hidden");t.find(a.tradeInMoreItemsButtonContainerClass).addClass("aok-hidden");
g.push(t);g.push(this.shipmentDetailsHeaderComponent);g.push(this.createShipmentDetailComponent());g.push(this.createSubmitButtonComponent())}else g.push(this.createShipmentDetailComponent()),g.push(this.createTermsAndAgreementComponent(this.termsAndAgreementViewTemplate))}g.push(this.createFooterComponent());this.renderTemplateView(g)}}catch(v){f.recordError(v,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},
createTradeInConditionView:function(){try{var a=[],g=this.createTradeInHeaderComponent(!0);a.push(g);g=[];this.config.hasOwnProperty("selectionDetails")&&(g=this.config.selectionDetails.translatedPromoStrings||[]);this.finalSearchResults.translatedPromoStrings&&0===g.length&&(g=this.finalSearchResults.translatedPromoStrings);if(this.shouldShowPromoHeader()){var d=this.generatePromoHeader(this.tradeInPromoPreviewViewTemplate,g);a.push(d)}var e=this.createTradeInCartHeaderComponent(this.tradeinCartHeaderTemplate);
a.push(e);var k=this.createVerticalCardViewComponentWithTradeInEstimateContent();a.push(k);var m=this.createConditionQuestionComponent(this.finalSearchResults.gradingQuestion);a.push(m);this.conditionSelectionMap={tradeInQuestions:this.finalSearchResults.gradingQuestion,conditionOfferMap:this.finalSearchResults.conditionOfferMap,gradedCondition:null,tradeInValue:null,tradeInQuestionResponses:{}};var n=this.createAdjustedValueQuestionComponent(this.finalSearchResults.conditionOfferMap);a.push(n);var q=
l.bindDataToAsinSelectionTemplate(this.tradeInSubmitConditionButtonTemplate);h(c(q.find(".continue-trigger"))).disable();a.push(q);var p=this.createFooterComponent();a.push(p);this.renderTemplateView(a)}catch(t){f.recordError(t,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}this.showVerticalImageCardView=!1},createTradeInChangeConditionView:function(){try{var a=this.changeConditionData,g=[];
g.push(this.createTradeInHeaderComponent(!0));g.push(this.createTradeInCartHeaderComponent(this.tradeinCartHeaderTemplate));var d=l.bindDataToAsinSelectionTemplate(this.verticalComplexCardViewTemplate,{tradeinEstimateDetails:"classType",imageUrl:a.verticalImageUrl,maxTiv:a.maxTiv});g.push(d);var e=d.find(".selection-history-list"),k=this.categoryRefinementSelectionItemComponent;0<this.translatedSelectionHistory.length?this.translatedSelectionHistory.forEach(function(a){a=l.bindDataToAsinSelectionTemplate(k,
{selectionItem:a});c(e).append(a)}):this.verticalComplexCardViewTemplate.find(".vertical-card-tradein-details").addClass("aok-hidden");g.push(this.createConditionQuestionComponent(a.gradingQuestion));this.conditionSelectionMap={tradeInQuestions:a.gradingQuestion,conditionOfferMap:a.conditionOfferMap,gradedCondition:null,tradeInValue:null,tradeInQuestionResponses:{}};g.push(this.createAdjustedValueQuestionComponent(a.conditionOfferMap));var m=l.bindDataToAsinSelectionTemplate(this.tradeInSubmitConditionButtonTemplate);
h(c(m.find(".continue-trigger"))).disable();g.push(m);g.push(this.createFooterComponent());this.renderTemplateView(g)}catch(n){f.recordError(n,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},generatePromoHeader:function(a,c){var d="";if(c&&0<c.length){var f=l.bindDataToAsinSelectionTemplate(a);f.removeClass("aok-hidden");d=f.clone();d.empty();c.forEach(function(a){var b={displayTitle:a};a.hasOwnProperty("subtitle")&&
(b={displayTitle:a.title,subtitle:a.subtitle});a=l.bindDataToAsinSelectionTemplate(f,b);d.append(a)})}return d},createTradeInNextStepsView:function(){try{var a=[];a.push(this.createTradeInHeaderComponent(!1));a.push(l.bindDataToAsinSelectionTemplate(this.successfulTradeInBannerComponentView));var d,h=this.tradeInSubmitData.ipItems+this.tradeInSubmitData.nonIpItems,k=this.getIsMixedOfferFromSubmitData(),m=this.getIsIpOnlyOfferFromSubmitData();1<h?a.push(this.createMultiItemConfirmationView()):a.push(this.createSingleItemConfirmationView());
d=k?this.mixedOfferNextStepsTemplate.clone():l.bindDataToAsinSelectionTemplate(this.tradeinReviewYourOrderNextStepTemplate,{instantPaymentEligible:m});if(this.shouldShowPromos()){this.promoData=this.tradeInReviewData.promotionEligibilityText;this.tradeInReviewData.hasOwnProperty("promotionMessages")&&this.tradeInReviewData.promotionMessages&&(this.promoData=this.tradeInReviewData.promotionMessages);var n=this.generatePromoHeader(this.tradeInCartPromosTemplate,this.promoData);a.push(n)}var q=e.isEnabled?
this.tradeInSubmitData.shipByDate:f.formatDate(this.tradeInSubmitData.shipByDate);d.find(".shipByDate").html(q);d.find(".customerEmail").html(this.tradeInSubmitData.customerEmailAddress);a.push(d);this.renderTemplateView(a)}catch(p){f.recordError(p,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},createMultiItemConfirmationView:function(){var a=this.tradeInSubmitData.ipItems,c=this.tradeInSubmitData.nonIpItems,
d=a+c,f=this.getIsMixedOfferFromSubmitData(),e=this.getIsIpOnlyOfferFromSubmitData(),e=l.bindDataToAsinSelectionTemplate(this.multiItemConfirmationOrderDetailsViewComponent,{mixedOffer:f,ipOnlyOffer:e,maxTiv:this.tradeInSubmitData.totalAmount,ipTiv:this.tradeInSubmitData.ipAmount,nipTiv:this.tradeInSubmitData.nonIPAmount});f?(e.find(".confirmedIpItemCount").html(a),e.find(".confirmedNipItemCount").html(c)):e.find(".confirmedItemCount").html(d);return e},createSingleItemConfirmationView:function(){this.searchTradeInImageIndicator||
(this.searchTradeInImageIndicator=this.getSanitizedItemListFromReviewData()[0].imageUrl);var a=this.finalSearchResults?this.finalSearchResults.asin:this.getSanitizedItemListFromReviewData()[0].asin;return this.createVerticalCardViewComponentWithTradeInTotalContent("tradeinConfirmationOrderDetails",this.tradeInSubmitData.totalAmount,a)},createRestrictionItemView:function(){try{var b=this.config,d=b.selectionDetails,e=[];b.hasOwnProperty("expectedPages")?this.expectedPages=b.expectedPages+2:f.recordError("expectedPages property missing from config",
"tradeinConfig.expectedPages");e.push(this.createTradeInHeaderComponent(1!==b.pageIndex));e.push(this.createTradeInCartHeaderComponent(this.tradeinCartHeaderTemplate));1===this.config.pageIndex&&f.isGlEligibleForPromotions(this.tradeInProductGroup)&&e.push(this.promotionInformationComponent);1===b.pageIndex&&f.isGlEligibleForPastPurchases(this.tradeInProductGroup)&&0<this.pastPurchasedEligibleItems.length&&e.push(this.createPastDevicePurchasesContainerViewComponent());this.shouldShowPromoHeader()&&
e.push(this.generatePromoHeader(this.tradeInPromoPreviewViewTemplate,d.translatedPromoStrings||[]));this.showVerticalImageCardView&&(e.push(this.createVerticalCardViewComponentWithTradeInEstimateContent()),this.showVerticalImageCardView=!1);var h=l.bindCategoryRefinementDataToTemplate(this.searchRefinementItemSelectionTemplate,d,this.deviceType);h.find(a.howToLinkHelperTitleId).text(d.refinementTitle);this.populateUnavailableOffers(h);e.push(h);e.push(this.createFooterComponent());this.renderTemplateView(e,
c.proxy(function(){l.normalizeGridRowHeights(h)}))}catch(k){f.recordError(k,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},createRefinementSearchView:function(){var b=this.config,d=b.selectionDetails,e=[],h=this.tradeInSearchCurrentState.term&&0<this.tradeInSearchCurrentState.term.length;b.hasOwnProperty("expectedPages")?this.expectedPages=b.expectedPages+2:f.recordError("expectedPages property missing from config",
"tradeinConfig.expectedPages");e.push(this.createTradeInHeaderComponent(1!==b.pageIndex));e.push(this.createTradeInCartHeaderComponent(this.tradeinCartHeaderTemplate));this.shouldShowPromoHeader()&&e.push(this.generatePromoHeader(this.tradeInPromoPreviewViewTemplate,d.translatedPromoStrings||[]));this.overrideRefinementTitleForSearch(d);var k=l.bindCategoryRefinementDataToTemplate(this.refinementSearchViewTemplate,d,this.deviceType,{searchResultsExist:0<d.selectionItemsAttributeList.length,searchOffersOnly:this.searchOffersOnly,
isFirstSearch:!h});k.find(a.howToLinkHelperTitleId).text(d.refinementTitle);this.updateSearchCounts(k);this.populateUnavailableOffers(k);d.endOfResults?k.find(a.searchLoadMoreResultsWrapperClass).addClass("aok-hidden"):k.find(a.searchLoadMoreResultsWrapperClass).removeClass("aok-hidden");e.push(k);e.push(this.createFooterComponent());this.renderTemplateView(e,c.proxy(function(){l.normalizeGridRowHeights(k);h&&this.getSearchInput(this.tradeInWrapper).val(this.tradeInSearchCurrentState.term)},this))},
handleReturnAddressChange:function(b){var d=c(b.currentTarget);f.isMobileVariant(this.deviceType)&&(d=c(b));f.recordTv2RefTag(a.refTagReturnAddressUpdateRequest,this.tradeInRefTagUrl,this.bifurcationRefTags);this.loadingSpinnerShow();k.post(this.tradeInReviewUrl,{params:{addressId:d.attr("value"),requestToken:f.getCsrfTokenByKey(a.csrfReviewRequestKey,this.config)},success:c.proxy(function(b){f.updateCsrfTokenByKey(a.csrfReviewRequestKey,b,this.config);d.closest(".popover-content-overlay").addClass("aok-hidden");
this.loadingSpinnerHide();this.tradeInReviewData=b;this.createView()},this),error:c.proxy(function(a){this.handleRequestError(a,"TradeIn return address error","Error encountered during TradeIn return address update request")},this)})},cleanState:function(){this.restrictionSelectionPage=[];this.priceHistory=[];this.navCurrentView=null;this.estimatedMaxTiv=0;this.invalidReturnAddress=this.isProcessing=this.showVerticalImageCardView=!1;this.conditionSelectionMap=this.finalSearchResults=this.searchTradeInImageIndicator=
null;this.isChangeConditionContext=!1;this.tradeInReviewData={};this.tradeInSearchCurrentState={term:""};this.bifurcationRefTags=[];c(a.searchSuggestionsClass).remove()},clearAllViews:function(){this.tradeInWrapper.children().each(function(){c(this).data("keep")||c(this).remove()})},handleRefinementSubmit:function(b){if(!this.selectionInProgress){var d=this.config,e=d.restrictionHistory,h=c(b.target);b=h.data("tradeinSupplementaryData");var k=h.data("refinementKey"),h=h.data("refinementValue"),k=
{key:k,emittedData:h};k.key&&k.emittedData&&(e.push(k),-1!==a.BIFURCATION_REF_TAG.indexOf(k.key)&&this.generateBifurcationTag(k.emittedData));b.maxTiv&&(this.estimatedMaxTiv=b.maxTiv,0<b.maxTiv?this.priceHistory.push(this.estimatedMaxTiv):f.recordError("Invalid TIV","TIV is zero"));d={configVersion:d.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,this.config),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(e),currentAsin:f.getCurrentAsin(),pageIndex:d.pageIndex+
1};this.callForwardRefinementSelection(d)}},handlePastPurchaseRefinementSelect:function(b){if(!this.selectionInProgress){var d=c(b.target)[0].dataset.asin,e,h,k,l;c.each(this.pastPurchasedEligibleItems,c.proxy(function(b,c){c.asin===d&&(this.currentAsin.asin=d,this.currentAsin.title=f.generatePrettyTitle(c.title),h=c.imageUrl,k=this.questionnaires[c.tradeInItemType].questions,l=c.conditionOfferMap,e=c.tradeInItemType===a.tradeInItemTypeEcho?c.conditionOfferMap.Working.tiv:c.conditionOfferMap.Good.tiv)},
this));b=this.config;var m=b.restrictionHistory;b={configVersion:b.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,this.config),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(m),currentAsin:f.getCurrentAsin(),maxTiv:e,verticalImageUrl:h,tradeInQuestions:k,conditionOfferMap:l,asin:d,pageIndex:b.pageIndex+1};this.callFastForwardToSelfGrading(b)}},handleRefinementSearchFormSubmit:function(b){if(!this.selectionInProgress){if(b){b.preventDefault();
b=c(b.currentTarget);b=this.getSearchInput(b);b=k.trim(b.val());if(!b)return;this.tradeInSearchCurrentState.term=b}b=this.config;var d=b.restrictionHistory;b={configVersion:b.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(d),currentAsin:f.getCurrentAsin(),keyword:this.tradeInSearchCurrentState.term,pageIndex:b.pageIndex,pageSize:this.searchPageSize,filterEligibleOffers:this.searchOffersOnly,
resultIndex:0};this.callForwardRefinementSelection(b)}},handleLoadMoreSearchResults:function(){this.selectionInProgress=!0;var b=this.config,b={configVersion:b.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(b.restrictionHistory),currentAsin:f.getCurrentAsin(),keyword:this.tradeInSearchCurrentState.term,pageIndex:b.pageIndex,pageSize:this.searchPageSize,filterEligibleOffers:this.searchOffersOnly,
resultIndex:b.selectionDetails.searchOffsetIndex};this.loadingSpinnerShow();k.post(this.tradeInSearchCategoryRefinementUrl,{params:b,success:c.proxy(function(b){this.loadingSpinnerHide();this.selectionInProgress=!1;f.updateCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b,this.config);this.config=b;this.updateCartHeaderData();b=this.tradeInWrapper.find(a.refinementContentWrapperClass);var d=this.config.selectionDetails;this.overrideRefinementTitleForSearch(d);var e=l.bindCategoryRefinementDataToTemplate(this.refinementSearchViewTemplate,
d,this.deviceType);this.populateUnavailableOffers(e);e=e.find(a.refinementContentWrapperClass);b.append(e.children());l.normalizeGridRowHeights(b);this.updateSearchCounts(this.tradeInWrapper.find(a.refinementSelectionViewWrapperClass));d.hasOwnProperty("endOfResults")&&d.endOfResults?c(a.refinementSelectionViewWrapperClass).find(a.searchLoadMoreResultsWrapperClass).addClass("aok-hidden"):c(a.refinementSelectionViewWrapperClass).find(a.searchLoadMoreResultsWrapperClass).removeClass("aok-hidden")},
this),error:c.proxy(function(a){this.selectionInProgress=!1;this.handleRequestError(a,"Search refinement selection error","Error encountered hitting search refinement request")},this)})},handlePreviousButton:function(){if(!this.selectionInProgress){var b=this.getCurrentViewForRefTag(),d=this.restrictionSelectionPage.pop(),e=this.restrictionSelectionPage[this.restrictionSelectionPage.length-1];this.navCurrentView=e;f.recordTv2RefTag(a.refTagBackButton+b,this.tradeInRefTagUrl,this.bifurcationRefTags);
if(f.isGlEligibleForPastPurchases(this.tradeInProductGroup)&&0===this.config.restrictionHistory.length)this.clearAllViews(),this.createRestrictionItemView();else switch(e){case this.navViews.refinementSelectionView:this.handleNavigateBackToSelectionPage(d);break;case this.navViews.refinementSearchView:this.handleNavigateBackToSearchPage(d);break;case this.navViews.tradeInConditionView:this.handleNavigateBackToConditionPage(d);break;case this.navViews.submitTradeInView:this.handleNavigateBackToReviewPage(d);
break;case this.navViews.tradeInCartView:this.handleNavigateBackToCartPage(d);break;default:this.clearAllViews(),f.recordError("Error encountered navigating from "+d+" back to "+e),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}}},handleNavigateBackToSelectionPage:function(b){var c=this.config.restrictionHistory;if(b!==this.navViews.tradeInCartView){this.config.pageIndex--;var d=c.pop();this.priceHistory.pop();-1!==a.BIFURCATION_REF_TAG.indexOf(d.key)&&
this.bifurcationRefTags.pop()}b===this.navViews.refinementSearchView&&(this.tradeInSearchCurrentState.term="");b={configVersion:this.config.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,this.config),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(c),currentAsin:f.getCurrentAsin(),pageIndex:this.config.pageIndex};this.restrictionSelectionPage.pop();this.callForwardRefinementSelection(b)},handleNavigateBackToSearchPage:function(b){var c=this.config.restrictionHistory,
d=this.tradeInSearchCurrentState.term&&0<this.tradeInSearchCurrentState.term.length?this.tradeInSearchCurrentState.term:"";b!==a.tradeInCartViewClass&&(this.config.pageIndex--,c.pop(),this.priceHistory.pop());b={configVersion:this.config.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,this.config),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(c),currentAsin:f.getCurrentAsin(),keyword:d,pageIndex:this.config.pageIndex,pageSize:this.searchPageSize,
filterEligibleOffers:this.searchOffersOnly,resultIndex:0};this.restrictionSelectionPage.pop();this.callForwardRefinementSelection(b)},handleNavigateBackToConditionPage:function(b){this.restrictionSelectionPage.pop();var d={configVersion:this.config.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,this.config),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(this.config.restrictionHistory),currentAsin:f.getCurrentAsin(),pageIndex:this.config.pageIndex};
b===a.submitTradeInWrapperClass?this.finalSearchResults&&this.finalSearchResults.hasOwnProperty("asin")&&this.doTradeInItemRemove(this.finalSearchResults.asin,c.proxy(function(){this.callForwardRefinementSelection(d)},this)):this.callForwardRefinementSelection(d)},handleNavigateBackToReviewPage:function(b){if(b===a.tradeInCartViewClass){var d=this.finalSearchResults.asin;this.getSanitizedItemListFromReviewData().some(function(a){return a.asin===d})?this.doTradeInReviewValidation(c.proxy(function(){this.selectionInProgress=
!1;this.navCurrentView=this.navViews.submitTradeInView;this.createView()},this)):this.handleTradeInMoreItems()}},handleNavigateBackToCartPage:function(a){a===this.navViews.tradeInConditionView&&(this.isChangeConditionContext=!1,this.restrictionSelectionPage.pop(),this.handleNavigateToCart())},updateCartHeaderData:function(){var a=this.config;a.hasOwnProperty("cartItems")&&(this.tradeInCartQuantity=a.cartItems.length,this.tradeInCartTiv=a.cartItems.reduce(function(a,b){return a+b.price},0))},handleNavigateToCart:function(){this.doTradeInReviewValidation(c.proxy(function(){this.navCurrentView=
this.navViews.tradeInCartView;this.createView();this.restrictionSelectionPage.push(this.navCurrentView)},this))},createTradeInCartView:function(){try{var b=[];b.push(this.createTradeInHeaderComponent(!0));var d=this.tradeInCartTemplate.clone(),e=this.getSanitizedItemListFromReviewData();d.find(a.tradeinCartTotalTivElement).html(f.formatCurrency(this.tradeInReviewData.orderTotalGC));d.find(a.tradeinCartGCValueIpElement).html(f.formatCurrency(this.tradeInReviewData.orderTotalPaidInstantly));d.find(a.tradeinCartGCValueNonIpElement).html(f.formatCurrency(this.tradeInReviewData.orderTotalPaidOnGrading));
f.isGlEligibleForPastPurchases(this.tradeInProductGroup)&&d.find(".tradein-cart-view .tradein-cart-view-review-text").addClass("aok-hidden");var k=[],m=[];c.each(e,c.proxy(function(a,b){a=l.bindDataToAsinSelectionTemplate(this.tradeinCartItemComponent,{title:f.generatePrettyTitle(b.title),tradeInValue:b.tradeInValue,imageUrl:b.imageUrl,instantPaymentEligible:b.instantPayable,asin:b.asin})[0].outerHTML;b.instantPayable?k+=a:m+=a},this));0<k.length?d.find(a.tradeinCartIpItemsList).append(k):(d.find(a.tradeinCartIpItemsSection).addClass("aok-hidden"),
d.find(a.tradeinCartNonIpItemsSection+".a-divider-normal").addClass("aok-hidden"));0<m.length?d.find(a.tradeinCartNonIpItemsList).append(m):d.find(a.tradeinCartNonIpItemsSection).addClass("aok-hidden");if(this.shouldShowPromos()){this.promoData=this.tradeInReviewData.promotionEligibilityText;this.tradeInReviewData.hasOwnProperty("promotionMessages")&&this.tradeInReviewData.promotionMessages&&(this.promoData=this.tradeInReviewData.promotionMessages);var n=this.generatePromoHeader(this.tradeInCartPromosTemplate,
this.promoData);b.push(n)}b.push(d);b.push(this.shipmentDetailsHeaderComponent);b.push(this.createShipmentDetailComponent());var q=this.tradeinSubmitButtonComponent.clone();h(q.find(a.submitButtonViewClass)).enable();b.push(q);b.push(this.createFooterComponent());this.renderTemplateView(b)}catch(p){f.recordError(p,"Error encountered rendering "+this.navCurrentView),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},handleRemoveCartItem:function(a){a=
c(a.currentTarget).data("asin");this.doTradeInItemRemove(a,c.proxy(function(){1===this.getSanitizedItemListFromReviewData().length?(this.tradeInReviewData={},this.handlePreviousButton()):(this.restrictionSelectionPage.pop(),this.handleNavigateToCart())},this))},handleNavigateToChangeCondition:function(a){this.selectionInProgress=!0;this.loadingSpinnerShow();a={asin:c(a.target)[0].dataset.asin};k.get(this.tradeInGetSelfGradingQuestionnaireUrl,{params:a,success:c.proxy(function(a){this.loadingSpinnerHide();
this.selectionInProgress=!1;this.navCurrentView=this.navViews.tradeInConditionView;this.restrictionSelectionPage.push(this.navCurrentView);this.isChangeConditionContext=!0;this.changeConditionData=a.finalSearchResult;this.createView()},this),error:c.proxy(function(a){this.selectionInProgress=!1;this.handleRequestError(a,"getSelfGradingQuestionnaire error","Error encountered calling getSelfGradingQuestionnaire")},this)})},handleTermsAndAgreementCheckboxSelection:function(b){b=c(b.currentTarget);var d=
!0;c(b).closest(".termsAndAgreementContent").find(".agreement-checkbox").each(function(a,b){c(b).find("input").get(0).checked||(d=!1)});b=h(a.agreementCheckboxTarget);d&&!this.invalidReturnAddress?b.enable():b.disable()},handleAdjustedValueAgreementButton:function(a){a=c(a.currentTarget);var d=a.closest(".appraisal-container");c(d).find(".adjusted-value-agreement-button").each(function(a,b){h(c(b)).setStatus("normal")});d=c(a.closest(".adjusted-value-agreement-button"));h(d).setStatus("selected");
d=d.find("input");this.conditionSelectionMap.tradeInQuestionResponses[d.attr("name")]=d.attr("value");this.toggleConditionState(this.conditionSelectionMap,a,d.attr("name"))},handleTradeInSubmit:function(){this.hasPendingRequest||(this.loadingSpinnerShow(),this.hasPendingRequest=!0,k.post(this.tradeInSubmitUrl+(this.tradeInReviewData.instantPaymentEligible?"ip":"nip"),{params:{requestToken:f.getCsrfTokenByKey(a.csrfSubmitRequestKey,this.config),currentAsin:f.getCurrentAsin(),isStorefront:this.isStorefront},
success:c.proxy(function(b){this.tradeInSubmitData=b;try{if(this.tradeInSubmitData.hasOwnProperty("mfaUrl")&&this.tradeInSubmitData.mfaUrl){f.redirectToMFA(this.tradeInSubmitData.mfaUrl);return}this.promotionEligible&&(this.promosApplied.push({productGroup:this.tradeInProductGroup,applied:!0}),p.sessionStorage.setItem("tradein-promos-applied",JSON.stringify(this.promosApplied)))}catch(c){f.recordError(c,a.sessionStorageAccessErrorMsg)}this.loadingSpinnerHide();this.hasPendingRequest=!1;this.updateLaunchButtonText();
this.navCurrentView=this.navViews.restrictionSearchTradeInNextStepView;this.config.pageIndex=this.expectedPages;this.createView();this.restrictionSelectionPage.push(this.navCurrentView);f.recordTv2RefTag(a.refTagEnd,this.tradeInRefTagUrl,this.bifurcationRefTags)},this),error:c.proxy(function(a){this.hasPendingRequest=!1;this.clearAllViews();this.handleRequestError(a,"TradeIn submit error","Error encountered during TradeIn submit request")},this)}))},handleTradeInMoreItems:function(){if(!this.selectionInProgress){var b=
this.config;b.pageIndex=1;b.restrictionHistory=[];this.cleanState();b={configVersion:b.configVersion,requestToken:f.getCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b),productGroup:this.tradeInProductGroup,restrictionHistory:JSON.stringify(b.restrictionHistory),pageIndex:b.pageIndex};this.callForwardRefinementSelection(b)}},callFastForwardToSelfGrading:function(b){try{this.selectionInProgress=!0;this.loadingSpinnerShow();var d=b.maxTiv;this.searchTradeInImageIndicator=b.verticalImageUrl;this.finalSearchResults=
{gradingQuestion:b.tradeInQuestions,conditionOfferMap:b.conditionOfferMap,asin:b.asin};k.post(this.tradeInSearchCategoryRefinementUrl,{params:b,success:c.proxy(function(b){this.selectionInProgress=!1;f.updateCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b,this.config);this.config=b;this.estimatedMaxTiv=d;this.navCurrentView=this.navViews.tradeInConditionView;this.updateCartHeaderData();this.loadingSpinnerHide();this.createView();this.restrictionSelectionPage.push(this.navCurrentView)},this),error:c.proxy(function(a){this.selectionInProgress=
!1;this.handleRequestError(a,"Search refinement selection error","Error encountered hitting search refinement request")},this)})}catch(e){this.selectionInProgress=!1,this.clearAllViews(),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},callForwardRefinementSelection:function(b){try{this.selectionInProgress=!0,this.loadingSpinnerShow(),k.post(this.tradeInSearchCategoryRefinementUrl,{params:b,success:c.proxy(function(b){this.selectionInProgress=
!1;f.updateCsrfTokenByKey(a.csrfSearchAsinCategoryItemKey,b,this.config);this.config=b;if(b.hasOwnProperty("selectionDetails")){var c=b.selectionDetails;c.hasOwnProperty("searchRestrictionAttributes")&&c.searchRestrictionAttributes.hasOwnProperty("verticalImageUrl")&&(this.showVerticalImageCardView=!0,this.searchTradeInImageIndicator=c.searchRestrictionAttributes.verticalImageUrl);b=b.selectionDetails.viewType;b===a.complexCardRefinementSelectionViewType||b===a.simpleCardRefinementSelectionViewType||
b===a.containedButtonRefinementSelectionViewType?this.navCurrentView=this.navViews.refinementSelectionView:b===a.searchRefinementViewType&&(this.navCurrentView=this.navViews.refinementSearchView,this.restrictionSelectionPage[this.restrictionSelectionPage.length-1]===this.navCurrentView&&this.restrictionSelectionPage.pop())}else b.hasOwnProperty("finalSearchResult")&&(this.finalSearchResults=b.finalSearchResult,this.estimatedMaxTiv=this.finalSearchResults.maxTiv,this.navCurrentView=this.navViews.tradeInConditionView,
b.finalSearchResult.hasOwnProperty("verticalImageUrl")&&(this.searchTradeInImageIndicator=b.finalSearchResult.verticalImageUrl));this.updateCartHeaderData();this.loadingSpinnerHide();this.createView();this.restrictionSelectionPage.push(this.navCurrentView)},this),error:c.proxy(function(a){this.selectionInProgress=!1;this.handleRequestError(a,"Search refinement selection error","Error encountered hitting search refinement request")},this)})}catch(d){this.selectionInProgress=!1,this.clearAllViews(),
this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active")}},handleContinueConditionButtonClick:function(){if(!this.isProcessing){this.isProcessing=!0;var b=this.conditionSelectionMap.tradeInQuestionResponses.appraisal;f.recordTv2RefTag(a.APPRAISAL_REF_TAG[b],this.tradeInRefTagUrl,this.bifurcationRefTags);this.loadingSpinnerShow();b={asin:this.finalSearchResults.asin,condition:this.conditionSelectionMap.gradedCondition,returnOption:b,requestToken:f.getCsrfTokenByKey(a.csrfSaveGradedItemKey,
this.config)};k.post(this.tradeInSaveGradedItemConditionUrl,{params:b,success:c.proxy(function(b){f.updateCsrfTokenByKey(a.csrfSaveGradedItemKey,b,this.config);this.loadingSpinnerHide();this.config.pageIndex++;this.conditionSelectionMap.hasBeenGraded=!0;this.doTradeInReviewValidation(c.proxy(function(){this.navCurrentView=this.navViews.submitTradeInView;this.createView();this.restrictionSelectionPage.push(this.navCurrentView);this.isProcessing=!1},this))},this),error:c.proxy(function(a){this.isProcessing=
!1;this.handleRequestError(a,"TradeIn save graded condition error","Error encountered during TradeIn save graded condition request")},this)})}},handleChangeConditionComplete:function(){if(!this.isProcessing){this.isProcessing=!0;this.loadingSpinnerShow();var b={asin:this.changeConditionData.asin,condition:this.conditionSelectionMap.gradedCondition,returnOption:this.conditionSelectionMap.tradeInQuestionResponses.appraisal,requestToken:f.getCsrfTokenByKey(a.csrfSaveGradedItemKey,this.config)};k.post(this.tradeInSaveGradedItemConditionUrl,
{params:b,success:c.proxy(function(b){this.loadingSpinnerHide();this.isProcessing=!1;f.updateCsrfTokenByKey(a.csrfSaveGradedItemKey,b,this.config);this.conditionSelectionMap.hasBeenGraded=!0;this.handleNavigateBackToCartPage(this.restrictionSelectionPage.pop())},this),error:c.proxy(function(a){this.isProcessing=!1;this.handleRequestError(a,"TradeIn save graded condition error","Error encountered during TradeIn save graded condition request")},this)})}},handleConditionSelection:function(b){try{var d=
c(b.currentTarget),e=d.closest(a.conditionQuestionButtonSelectorClass);this.conditionSelectionMap.tradeInQuestionResponses[e.attr("name")]=e.val();this.toggleConditionState(this.conditionSelectionMap,d,e.attr("name"))}catch(k){this.showAlert(a.alertItemAcceptableClass,d.closest(a.conditionQuestionContainerClass)),h(c(e)).setStatus("normal"),h(a.continueConditionButtonViewClass).disable(),f.recordError(k,"Error occurred during handleConditionSelection")}},toggleConditionState:function(b,d,e){var f=
[a.appraisalInputName];c.each(b.tradeInQuestions,function(a,b){b.hasOwnProperty("id")&&f.push(b.id)});var k=!1;c.each(f,c.proxy(function(a,c){"Unacceptable"===b.tradeInQuestionResponses[c]&&(k=!0)},this));var l=d.closest(a.conditionQuestionnaireListClass);k?(this.showAlert(a.alertItemAcceptableClass,d.closest(a.conditionQuestionContainerClass)),l.find(a.conditionQuestionButtonSelectorClass).each(function(){c(this).attr("name")!==e&&(h(c(this)).disable(),c(this).addClass("a-button-unavailable"))})):
(c(d).closest(a.conditionQuestionContainerClass).find(".alert-wrapper").html("").removeClass("active"),l.find(a.conditionQuestionButtonSelectorClass).each(function(){h(c(this)).enable();c(this).hasClass("a-button-unavailable")&&c(this).removeClass("a-button-unavailable")}));l=l.find(a.conditionQuestionContainerClass).length;d=Object.keys(b.tradeInQuestionResponses).length;d>=l&&(this.tradeInWrapper.find(a.appraisalWrapperClass).removeClass("aok-hidden"),this.updateTradeInValue(b));l=h(a.continueConditionButtonViewClass);
k||f.length!==d?l.disable():l.enable()},updateTradeInValue:function(b){var d=this.getConditionWeightageMap(b),e=[],h=null;c.each(b.tradeInQuestionResponses,function(b,c){b!==a.appraisalInputName&&e.push(d[c])});var l=k.reduce(e,function(a,b){return b&&b>a?b:a},0);c.each(d,function(a,b){if(b===l)return h=a,!1});b.gradedCondition=h;b.tradeInValue=b.conditionOfferMap[h].tiv;b=f.formatCurrency(b.tradeInValue);this.tradeInWrapper.find(a.conditionPageEstimatedTivComponentsSelector).addClass("aok-hidden");
this.tradeInWrapper.find(a.conditionPageFinalTivComponentsSelector).removeClass("aok-hidden");this.tradeInWrapper.find(a.conditionAppraisalMaxTivClass).html(b);this.tradeInWrapper.find(a.appraisalWrapperClass+" "+a.appraisalTivPriceClass).html(b);this.tradeInWrapper.find(a.conditionPageHeaderTivSelector).html(b)},handleRequestError:function(b,d,e){this.loadingSpinnerHide();b.http.status===a.unauthorizedCode?this.handleLoginPrompt():(f.recordError(d,e),this.clearAllViews(),this.tradeInWrapper.append(c(".tradein-templates .tradein-general-error").clone()).addClass("active"))},
handleLoginPrompt:function(){f.recordTv2RefTag(a.refTagAuthRequired,this.tradeInRefTagUrl,this.bifurcationRefTags);this.clearAllViews();this.tradeInWrapper.append(c("#alertTemplates "+a.alertPromptLoginClass).clone()).addClass("logged-out-message")},getConditionWeightageMap:function(a){var d=[],e={},f;for(f in a.conditionOfferMap)a.conditionOfferMap.hasOwnProperty(f)&&d.push([f,a.conditionOfferMap[f].tiv]);d.sort(function(a,b){return b[1]-a[1]});c.each(d,function(a,b){e[b[0]]=a});return e},setGradedCondition:function(b){var d=
this.getConditionWeightageMap(b),e=[],h=null;c.each(b.tradeInQuestionResponses,function(b,c){b!==a.appraisalInputName&&e.push(d[c])});var l=k.reduce(e,function(a,b){return b&&b>a?b:a},0);c.each(d,function(a,b){if(b===l)return h=a,!1});b.gradedCondition=h;b.tradeInValue=b.conditionOfferMap[h].tiv;this.tradeInWrapper.find("#conditionGrade_"+b.asin+" #estimatedTiv").html(f.formatCurrency(b.tradeInValue))},loadingSpinnerShow:function(){this.loadingSpinner.addClass("active")},loadingSpinnerHide:function(){this.loadingSpinner.removeClass("active")},
showAlert:function(a,d){c(d).find(".alert-wrapper").html("").removeClass("active");c(d.find(".alert-wrapper")).append(c("#alertTemplates "+a).clone()).addClass("active")},updateLaunchButtonText:function(){k.declarative.remove(c("#tradeInLaunchAction"),"launch-tanooki-wireless");k.declarative.remove(c("#tradeInLaunchAction"),"launch-tanooki-v2");var a=c(".tradein-instant-savings-launch-button"),d="#successfulNonIpButtonText";this.tradeInReviewData.instantPaymentEligible&&(d=this.promotionEligible?
"#successfulIpWithPromotionButtonText":"#successfulIpNoPromotionButtonText");d=c(".tradein-templates "+d).clone();c(d).find(".total-tiv").text(f.formatCurrency(this.tradeInReviewData.orderTotalGC));if(this.promotionEligible){var e=d.find(".promotionPercentageDisplayText").get(0);c(e).html(this.tradeInReviewData.promotionEligibilityText[0])}var h=d.get(0);c.each(a,function(){c(this).replaceWith(h)})},doTradeInReviewValidation:function(b){this.hasPendingRequest||(this.loadingSpinnerShow(),this.hasPendingRequest=
!0,k.post(this.tradeInReviewUrl,{params:{currentAsin:f.getCurrentAsin(),requestToken:f.getCsrfTokenByKey(a.csrfReviewRequestKey,this.config)},success:c.proxy(function(c){f.updateCsrfTokenByKey(a.csrfReviewRequestKey,c,this.config);this.tradeInReviewData=c;this.tradeInCartTiv=this.tradeInReviewData.orderTotalGC;this.tradeInCartQuantity=this.getSanitizedItemListFromReviewData().length;this.loadingSpinnerHide();this.hasPendingRequest=!1;b()},this),error:c.proxy(function(a){this.hasPendingRequest=!1;
this.handleRequestError(a,"TradeIn review error","Error encountered during TradeIn review request")},this)}))},getSanitizedItemListFromReviewData:function(){var a=this.tradeInReviewData.hasOwnProperty("sanitizedItemsList"),d=c.isArray(this.tradeInReviewData.sanitizedItemsList);return a&&d?this.tradeInReviewData.sanitizedItemsList:[]},getIsMixedOfferFromSubmitData:function(){return 0<this.tradeInSubmitData.ipItems&&0<this.tradeInSubmitData.nonIpItems},getIsIpOnlyOfferFromSubmitData:function(){return 0<
this.tradeInSubmitData.ipItems&&0===this.tradeInSubmitData.nonIpItems},renderTemplateView:function(a,d){for(var e=0;e<a.length;e++)a[e]&&(f.isMobileVariant(this.deviceType)&&c(a[e]).find(".mobile-small-button").each(function(){c(this).addClass("a-button-small")}),this.tradeInWrapper.append(a[e]));d&&"function"===typeof d&&d()},getSearchInput:function(b){var c=b.find(a.refinementSearchInputSelector);return c.is("input")||(c=b.find(a.refinementSearchInputMobileSelector),c.is("input"))?c:void 0},populateUnavailableOffers:function(a){a.find(".unavailable-item").each(function(){var a=
c(this).find(".tiv-estimate-container"),b=a.find(".unavailable-offer");c(b).removeClass("aok-hidden");c(a).html(b)})},updateSearchCounts:function(b){var c=b.find(a.refinementSearchResultSelector).not(".aok-hidden").length;b.find(this.searchOffersOnly?a.refinementSearchOnlyOffersCountId:a.refinementSearchAllOffersCountId).html(c)},overrideRefinementTitleForSearch:function(a){var d=this.config.restrictionHistory;d&&c.isArray(d)&&d[0].hasOwnProperty("emittedData")&&d[1].hasOwnProperty("emittedData")&&
(a.refinementTitle=d[1].emittedData+" "+d[0].emittedData)},hasDefaultReturnAddress:function(){if(!this.tradeInReviewData.hasOwnProperty("defaultReturnAddressId")||!this.tradeInReviewData.defaultReturnAddressId)return this.invalidReturnAddress=!0,c(".tradein-templates .tradein-info-submit-address-error").clone().addClass("active")},recordViewRefTag:function(){f.recordTv2RefTag(this.getCurrentViewForRefTag(),this.tradeInRefTagUrl,this.bifurcationRefTags)},getCurrentViewForRefTag:function(){var b=this.navCurrentView===
this.navViews.refinementSelectionView?this.getCurrentRefinementTitleForRefTag():this.navCurrentView;return a.VIEW_REF_TAG[b]},getCurrentRefinementTitleForRefTag:function(){var a=this.config;return a.selectionDetails&&a.selectionDetails.refinementTitle?a.selectionDetails.refinementTitle.split(" ").join("-"):""},generateBifurcationTag:function(a){this.bifurcationRefTags.push(this.getCurrentViewForRefTag()+"_"+a.substring(0,3))},load_stub_tester:function(b){this.config=k.state("tradeInConfig");f.setLocale(this.config.locale);
f.setCurrencyCode(this.config.currencyCode);l.setCommonUtils(f);this.navViews={refinementSelectionView:a.refinementSelectionViewWrapperClass,tradeInConditionView:a.conditionViewTemplateId,submitTradeInView:a.submitTradeInWrapperClass,restrictionSearchTradeInNextStepView:a.tradeinReviewYourOrderNextStepTemplateId};this.getElements();this.bindEvents();this.cleanState();this.navCurrentView=b;this.createView()}})});"use strict";t.when("A","trade-in-constants","trade-in-data-binder","trade-in-common-utils",
"ready").register("trade-in-common-base",function(k,n,h,a){var m=k.$;return k.createClass({createReturnAddressInstance:function(a){if(this.tradeInReviewData&&0<a.length)if(0===a.children().length){for(var k in this.tradeInReviewData.returnAddresses)if(this.tradeInReviewData.returnAddresses.hasOwnProperty(k)){var n=this.tradeInReviewData.returnAddresses[k];n.formalAddress=h.bindDataToTemplate(m("#addressLineFormalTemplate"),n);var d=h.bindDataToTemplate(m("#addressLineItemTemplate"),n),e=this.tradeInReviewData.defaultReturnAddressId===
n.addressId;d.find('input[type\x3d"radio"]').val(n.addressId).prop("checked",e);d.data("templateModel",n);a.append(d)}a.delegate('input[type\x3d"radio"]',"change",m.proxy(this.handleReturnAddressChange,this))}else a=a.find('input[type\x3d"radio"]'),m.each(a,m.proxy(function(a,b){a=m(b);a.prop("checked",a.val()===this.tradeInReviewData.defaultReturnAddressId)},this))},doTradeInItemRemove:function(f,h){try{this.loadingSpinnerShow(),k.post(this.tradeInRemoveItemUrl,{params:{asin:f,decline:!0,requestToken:a.getCsrfTokenByKey(n.csrfRemoveRequestKey,
this.config)},success:m.proxy(function(f){a.updateCsrfTokenByKey(n.csrfRemoveRequestKey,f,this.config);this.loadingSpinnerHide();h&&"function"===typeof h&&h()},this),error:m.proxy(function(a){this.handleRequestError(a,"TradeIn deselect remove error","Error encountered during TradeIn deselect remove request")},this)})}catch(p){a.recordError(p,"doTradeInItemRemove error")}}})});"use strict";t.register("cetech-refactor-shipment-messaging",function(){return{isEnabled:!1}});"use strict";t.register("tradein-marketplace-authportal-config",
function(){return{isEnabled:!0}});"use strict";t.register("tradein-use-formatted-dates",function(){return{isEnabled:!0}})});
/* ******** */
(function(f){var k=window.AmazonUIPageJS||window.P,l=k._namespace||k.attributeErrors,d=l?l("ListsCommonUtilityAssets",""):k;d.guardFatal?d.guardFatal(f)(d,window):d.execute(function(){f(d,window)})})(function(f,k,l){f.when("A").register("al-ajax-response-state-parser",function(d){var c=d.$;return{getState:function(e){e=c(e).filter("#listsAjaxResponseStateSection");var a=c("#listsAjaxResponseStateSection");a&&0<=a.length&&a.remove();c(e).appendTo("body");d.state.parse();e=d.state("listsAjaxResponseState")||
{};return{hasError:e.hasError,authRequired:e.authRequired,authUrl:e.authUrl,error:e.error}}}});"use strict";f.when("A","al-bottomsheet-with-fallback","iphone-x-detector").register("bottom-sheet-utils",function(d,c,e){var a=d.$;d.declarative("al-sheet-with-fallback","click",function(g){g.$event.preventDefault();var a=g.data;g=c.create(c.buildComponentParams(a.componentName,a.showCloseButton,e.getAdjustedHeightPx(a.bottomsheetHeight),a.popoverHeight,a.popoverWidth,a.headerForPopover,a.viewLabel,a.viewDescription?
a.viewDescription:a.viewLabel,a.paddingForPopover,a.closeMessage),g.$target);c.show(g)});return{raiseBottomsheet:function(c){c=a(c).parents(".a-sheet-web-container");c.css("z-index",1E4);c.siblings(".a-sheet-lightbox").css("z-index",8E3)}}});"use strict";f.when("A").register("al-bottomsheet-with-fallback",function(d){function c(b){k.ueLogError&&k.ueLogError({logLevel:"ERROR",message:b})}var e,a;f.when("a-sheet").execute(function(b){e=b});f.when("a-modal").execute(function(b){a=b});var g=function(b){if(b)return e?
e.get(b.name):a.get(b.name);c("No ComponentParams specified. Please generate componentParams using .create(component)")},m={IS_POPOVER_LABEL:"IS_POPOVER",IS_BOTTOMSHEET_LABEL:"IS_BOTTOMSHEET"};return{create:function(b,d){if(b)return e?e.create(b):a.create(d,b),b;c("No ComponentParams specified. Please generate componentParams using .create(component)")},show:function(b){(b=g(b))?b.show():c("No View Created. Please create a view first by calling .create(component)")},hide:function(b){(b=g(b))?b.hide():
c("No View Created. Please create a view first by calling .create(component)")},changeHeight:function(b,a,d){var f=g(b);f?e?(f.changeHeight({height:a,duration:d}),b.bottomsheetHeight=a):(f.update({height:a}),b.popoverHeight=a):c("No View Found. Please create a view first by calling .create(component)")},remove:function(b){(b=g(b))?b.$container.remove():c("No View Created. Please create a view first by calling .create(component)")},exists:function(b){return g(b)?!0:!1},onCloseExecute:function(b,a,
g){if("function"!==typeof a)c("Expected onCloseFunction to be of type function");else if(b)d.on((e?"a:sheet":"a:popover")+":"+(g?"beforeHide":"afterHide")+":"+b.name,a);else c("No ComponentParams specified. Please generate componentParams using .create(component)")},onOpenExecute:function(b,a,g){if("function"!==typeof a)c("Expected onOpenFunction to be of type function");else if(b)d.on((e?"a:sheet":"a:popover")+":"+(g?"beforeShow":"afterShow")+":"+b.name,a);else c("No ComponentParams specified. Please generate componentParams using .create(component)")},
buildComponentParams:function(a,c,d,g,f,k,n,t,p,q){var r=e!==l,h={viewTypeLabel:r?m.IS_BOTTOMSHEET_LABEL:m.IS_POPOVER_LABEL,name:a};r?(h.closeType=q?"message":c?"icon":l,h.closeMessage=q,h.height=d,h.sheetLabel=n,h.sheetDescription=t,h.preloadDomId=a):(h.closeButton=c,h.height=g,h.width=f,h.dataStrategy="preload",h.header=k,h.hideHeader=k===l,h.padding=p!==l?p:"none",h.popoverLabel=n);return h},VIEW_TYPE_LABELS:m}});"use strict";f.when("A").register("lists-dpx-common-utils",function(d){return{urlParamValue:function(c){for(var e=
k.location.search.substring(1).split("\x26"),a=0;a<e.length;a++){var d=e[a].split("\x3d");if(d[0]===c)return d[1]}}}});"use strict";f.when("A").register("iphone-x-detector",function(){function d(){try{var a=c();e.forEach(function(c){if(-1<a.indexOf(c))return!0})}catch(d){}return!1}function c(){try{var a;a:{for(var c=document.cookie.split(";"),d=0;d<c.length;d++){for(var b=c[d];" "===b.charAt(0);)b=b.substring(1,b.length);if(0===b.indexOf("amzn-app-ctxt\x3d")){a=b.substring(14,b.length);break a}}a=
null}if(a){var e=a.match(/"v":.*%2C*/);if(e)return e.toString().toLowerCase()}}catch(f){}return""}var e=["iphone10","iphone11"];return{isIphoneX:d,getDeviceType:c,getAdjustedHeightPx:function(a){try{if(a=parseInt(a,10),d())return a+40}catch(c){}return a}}});"use strict";f.when("A").register("amazon-lists-csrf-utils",function(d){return{addCsrfToken:function(c){var e=d.$("[data-amazon-lists-csrf-token]");0!==e.length&&(c["anti-csrftoken-a2z"]=e.attr("data-amazon-lists-csrf-token"))},hasCsrfToken:function(c){c=
c["anti-csrftoken-a2z"];return""!==c&&c!==l}}})});
/* ******** */
(function(g){var e=window.AmazonUIPageJS||window.P,l=e._namespace||e.attributeErrors,c=l?l("ListsCreateAssets",""):e;c.guardFatal?c.guardFatal(g)(c,window):c.execute(function(){g(c,window)})})(function(g,e,l){g.when("A","al-bottomsheet-with-fallback","al-ajax-response-state-parser","create-new-list-hz","bottom-sheet-utils","lists-dpx-common-utils").execute(function(c,f,z,v,m,d){function t(){m.raiseBottomsheet("#create-list-form-wrapper")}function b(a){n.ajax({type:"GET",url:"/hz/wishlist/create",
data:{createIngressName:a.createIngressName},success:A,error:function(a,b,c){r("Failed to fetch CreateList-Form. Status: "+b+"; Error: "+c)},timeout:2E4})}function A(a){var b=n(a).filter("#createlist-form-container");a=z.getState(a);a.authRequired&&a.authUrl?e.location.href=a.authUrl:a.hasError?r("CreateList form has error \x3d "+a.error):(n("#create-list-form-wrapper").html(b),p("#create-list-form-spinner"),u("#create-list-form-wrapper"))}function p(a){n(a).addClass("aok-hidden")}function u(a){n(a).removeClass("aok-hidden")}
function r(a){f.changeHeight(h,110);p("#create-list-form-spinner");p("#create-list-form-wrapper");u("#createlist-form-loading-error-section");e.ueLogError&&e.ueLogError({logLevel:"FATAL",message:a});if(!y())f.onCloseExecute(h,k,!1)}function k(){p("#createlist-form-loading-error-section");p("#create-list-form-wrapper");u("#create-list-form-spinner");e.location.reload()}function q(a,b,c){r("List creation failed. Status: "+b+"; Error: "+c)}function B(a){a.hasError?r("List creation failed with Error: "+
a.error):e.location="/hz/wishlist/ls/"+a.listExternalId}function y(){return"DETAIL_PAGE"===(c.state("createListIngressState")||{}).ingressName&&w}var n=c.$,w,x,h;c.declarative("awl-create-list-bottomsheet","click",function(a){var d=a.data||{};c.state("createListIngressState",{ingressName:d.ingressName});var e=d.componentName;e&&"function"==typeof uet&&uet("bb",e,{wb:1});e=a.data||{};h=f.create(f.buildComponentParams(e.componentName,!0,340,430,400,l,e.viewName,e.viewDescription,l,l),a.$target);f.show(h);
if(y())f.onOpenExecute(h,t);b(d);(a=d.componentName)&&"function"==typeof uet&&uet("cf",a,{wb:1});a&&"function"==typeof uex&&uex("ld",a,{wb:1})});c.declarative("create-list-bottomsheet-submit","click",function(a){a=a.data||{};var b=n("#createlist-list-name-textinput").val();b===l||0===b.length?n("#createlist-list-name-textinput").parent("div").addClass("a-form-error"):(p("#createlist-form-loading-error-section"),p("#create-list-form-wrapper"),u("#create-list-form-spinner"),a.listName=b,(b=d.urlParamValue("createAndAddAsin"))&&
0<b.length&&(a.asin=b),y()?((b=w.getAsin())&&0<b.length&&(a.asin=b),v(a,w.handleSuccess,w.handleError)):"HEARTS_BOTTOMSHEET"===(c.state("createListIngressState")||{}).ingressName&&x?(a.isDefault=!0,f.hide(h),v(a,x.onCreateSuccess,x.onCreateError)):v(a,B,q))});g.when("dp-create-list-handler").execute(function(a){w=a});g.when("hearts-create-list-handler").execute(function(a){x=a});c.on("a:expander:create-list-learn-more-popover:toggle:expand",function(){h.viewTypeLabel===f.VIEW_TYPE_LABELS.IS_BOTTOMSHEET_LABEL?
f.changeHeight(h,425):f.changeHeight(h,580)});c.on("a:expander:create-list-learn-more-popover:toggle:collapse",function(){f.changeHeight(h,340);h.viewTypeLabel===f.VIEW_TYPE_LABELS.IS_BOTTOMSHEET_LABEL?f.changeHeight(h,340):f.changeHeight(h,430)});c.declarative("createlist-list-name-validation",["keyup"],function(a){0!==a.$target.context.value.length&&n("#createlist-list-name-textinput").parent("div").hasClass("a-form-error")&&n("#createlist-list-name-textinput").parent("div").removeClass("a-form-error")})});
"use strict";g.when("A","create-new-list-hz","a-modal","lists-dpx-common-utils").register("create-utils",function(c,f,g,v){function m(b){b&&"function"==typeof uet&&uet("cf",b,{wb:1});b&&"function"==typeof uex&&uex("ld",b,{wb:1})}var d=c.$,t=function(b){b="#"+(b.formId||"addToCart");0===d(b).length&&(b="#atwl-form");return b};c.declarative("show-create-list",["click touchstart"],function(b){b.$event.preventDefault();var d=b.data;if(d.url||d.name)"function"==typeof uet&&uet("bb","create-list-dp-widget",
{wb:1}),g.create(b.$target,d).show({padding:"none"}),m("create-list-dp-widget");c.on("a:popover:afterHide:redesigned-create-list",function(){g.remove("redesigned-create-list")})});c.declarative("list-name-validation",["keyup"],function(b){0!==b.$target.context.value.length&&d("#alert-list-name").is(":visible")&&(d("#alert-list-name").addClass("aok-hidden"),d("#alert-list-name").parent("div").find("input").each(function(){d(this).removeClass("a-form-error")}))});return{submitCreate:function(b,g,p){b.$event.preventDefault();
var u=d("#create-list-form").closest(".a-popover"),r=d("#list-name").val();if(""===r)d("#alert-list-name").removeClass("aok-hidden"),d("#alert-list-name").parent("div").find("input").each(function(){d(this).addClass("a-form-error")});else{var k={},q=c.state("popoverState")||{},q=t(q),m=v.urlParamValue("createAndAddAsin");m&&1<m.length&&(k.asin=m);"1"===d("#is-create-and-add").val()&&(q=d(q).find("#ASIN, [name^\x3d'ASIN'], [name\x3d'a'], [name\x3d'asin']").val(),"undefined"!==q&&(k.asin=d.trim(q)));
d("#create-list-loading").removeClass("aok-hidden");u.find("#popover-spinner .a-popover-loading").show();d("#create-list-form").addClass("aok-hidden");k.listName=r;k.sid=b.data.sessionId;k.vendorId=b.data.sourceVendorId;k.privacyStatus=b.data.privacyStatus;k.listType=b.data.listType;if(b=e.ue?e.ue.rid:l)k.relatedRequestID=b;f(k,g,p)}}}});"use strict";g.when("A","amazon-lists-csrf-utils").register("create-new-list-hz",function(c,f){var g=c.$;return function(c,m,d){var t=[];f.addCsrfToken(t);var b=
e.ue?e.ue.rid:l;b&&(c.relatedRequestID=b);c.isJson=!0;return g.ajax("/hz/wishlist/create/newlist",{type:"POST",headers:t,data:c,success:m,error:d,timeout:1E4})}})});
/* ******** */
(function(f){var n=window.AmazonUIPageJS||window.P,p=n._namespace||n.attributeErrors,d=p?p("ListsDPXCommonAssets",""):n;d.guardFatal?d.guardFatal(f)(d,window):d.execute(function(){f(d,window)})})(function(f,n,p){f.when("A","a-dropdown","a-modal","legacy-create-utils").execute(function(d,u,b,h){var m=d.$;d.declarative("reg-create-change-privacy",["click"],function(b){h.changePrivacySetting(b)});d.declarative("list-privacy-toggle",["click"],function(b){h.togglePrivacy(b)});d.declarative("list-name-toggle",
["click"],function(b){h.toggleListName(b)});d.declarative("idea-list-toggle",["click"],function(b){h.toggleIdeaList(b)});d.on("a:popover:beforeShow:reg-create",function(b){m("#createCal").append(m("#popCal"))});d.on("a:popover:show:reg-create",function(b){h.onShow(b)});d.on("a:popover:ajaxContentLoaded:reg-create",function(b){b=b.popover.$popover;m("#createCal").append(m("#popCal"));b.hasClass("pop-create")||b.addClass("pop-create")});d.on("a:popover:beforeHide:reg-create",function(b){m("#createCalHolder").append(m("#popCal"))});
d.on("a:popover:hide:reg-create",function(b){h.onClose(b)});d.on("a:dropdown:select",function(b){h.onDropdownSelect(b)})});"use strict";f.when("A","create-new-list-hz").register("legacy-create-utils",function(d,u){var b=d.$;d.state.parse();d.state("pageInfo");d.state("createInfo");var h=d.state("popoverState")||{},m=0,f=function(a){a="#"+(a.formId||"addToCart");0===b(a).length&&(a="#atwl-form");return a},r=f(h),v=function(a){var c={};b.each(a.serializeArray(),function(a,b){b.name.match(/create-|next-/)&&
(c[b.name]=b.value)});return c},z=function(a){var c={},q={};c["create-sourceVendorId"]=a["create-sourceVendorId"];"undefined"!==typeof w("vendorId")&&(c["create-sourceVendorId"]=w("vendorId"));var k="wishlist";if(a["create-for"]){var e=a["create-for"];"friend"===e?k="giftlist":"child"===e&&(k="giftlist",c["create-isKidList_Registry"]=1)}h=d.state("popoverState")||{};r=f(h);"1"===b("#create-isCreateAndAdd").val()&&(c.isCreateAndAdd=!0,e=b(r).find("#ASIN, [name^\x3d'ASIN'], [name\x3d'a'], [name\x3d'asin']").val(),
c.asin=b.trim(e),e=d.state("wishlistDPState")||{},e.customizationToken&&(c.customizationToken=e.customizationToken));if("giftlist"!==k&&"1"===b("#create-isIdeaList").val())return e=b.trim(a["create-name-il"]),""!==e?c.name=e:q.list_name_il="empty",c.isIdeaList=!0,c.description=b.trim(a["create-description-il"]),{errors:q,userCreateArgs:c};c["create-registryType"]=k;if("wishlist"===k)e=b.trim(a["create-name"]),""!==e?c["create-name"]=e:q.list_name="empty";else{var g=b.trim(a["create-first-name"]),
l=b.trim(a["create-last-name"]),e=b.trim(a["create-participant_relationship"]);""!==g||""!==l?(c["create-participant2-givenName"]=g,c["create-participant2-surName"]=l,g=g+" "+l,c["create-participant2-name"]=g,c["create-name"]=g,c["create-participant2-relationship_Participant"]=e):q.recipient_name="empty"}e="N";g="wishlist"===k?"Y":"N";if(l=a["create-privacy"])"public"===l?("undefined"!==typeof a["create-recipient-name"]&&(c["create-recipient-name"]=b.trim(a["create-recipient-name"])),g="Y"):("hidden"!==
l&&(e="Y"),g="N");c["create-isPrivate"]=e;c["create-isSearchable"]=g;"wishlist"===k&&(c["create-persistence"]=b.trim(a["create-persistence"]));e=a["create-month"];g=a["create-day"];0<b("#popCal").length&&((l=b('[data-action\x3d"a-cal-input"]').val())?(e=l.split("/")[0],g=l.split("/")[1]):e=l="-1");e&&g&&("-1"!==e||"-1"!==g)&&(e=parseInt(e,10),g=parseInt(g,10),(l=new Date(1904,e-1,g),l.getMonth()+1===e)&&l.getDate()===g?(c["create-occasion1-fromDate_Month"]=e,c["create-occasion1-fromDate_Day"]=g,c["create-occasion1-fromDate_Year"]=
1904,"giftlist"===k&&(c["create-isKidList_Registry"]&&a["create-age"]&&"-1"!==a["create-age"]&&(c["create-occasion1-firstYear_Occasion"]=(new Date).getFullYear()-a["create-age"]),a["create-reminder"]&&(c["create-occasion1-reminderOffset_Occasion"]=a["create-reminder"]))):1<m||(q.occasion_date="invalid"));a["create-next"]&&(k=a["create-next"],c["next-action"]=k,"add"===k&&d.each(["asin","purchasedQty","requestedQty","purchaseDate","redirect"],function(b,e){b="next-"+b;a[b]&&(c[b]=a[b])}));return{errors:q,
userCreateArgs:c}},A=function(a){a.find("#WLNEW_error").addClass("a-hidden");a.find(".a-alert-inline").addClass("a-hidden");a.find(".a-form-error").removeClass("a-form-error");a.find(".reg-create-form").removeClass("a-hidden")},t=function(a){var b=a.find('select[name\x3d"create-month"]').val(),d=a.find('select[name\x3d"create-day"]').val();b&&"-1"!==b&&d&&"-1"!==d?a.find("#WLNEW_section_occAge").removeClass("a-hidden"):a.find("#WLNEW_section_occAge").addClass("a-hidden")},x=function(a,c){c.find("#WLNEW_input_privacy").val(a);
var d="";b("#a-popover-reg-create-privacy").find(".a-list-link li a").each(function(){b(this).removeClass("a-active");var c=b(this).data("reg-create-change-privacy");c&&c.type===a&&(d=c.triggerText,b(this).addClass("a-active"))});c.find('a[id^\x3d"WLNEW_privacy_"]').find("span").html(d)},y=function(a){"private"===a?(b(".reg-create-form").find("#private_blurb").removeClass("a-hidden"),b(".reg-create-form").find("#public_blurb").addClass("a-hidden"),b(".reg-create-form").find("#public_recipient").addClass("a-hidden")):
(b(".reg-create-form").find("#private_blurb").addClass("a-hidden"),b(".reg-create-form").find("#public_blurb").removeClass("a-hidden"),b(".reg-create-form").find("#public_recipient").removeClass("a-hidden"))},w=function(a){for(var b=n.location.search.substring(1).split("\x26"),d=0;d<b.length;d++){var k=b[d].split("\x3d");if(k[0]===a)return k[1]}},B=function(a){a.each(function(){b.data(this,"default",this.value)}).focus(function(){this.select();this.onmouseup=function(){this.onmouseup=null;return!1}}).keyup(function(){b.data(this,
"edited",""!==b.trim(this.value))}).change(function(){b.data(this,"edited",""!==b.trim(this.value))}).blur(function(){b.data(this,"edited")||(this.value=b.data(this,"default"))})},C=function(a){a.delegate("input:text","keypress",function(a){13===a.which&&a.preventDefault()})};return{changePrivacySetting:function(a){a.$event.preventDefault();var c=a.$target.closest(".a-popover");a=a.data;var d=a.type;c.hide();b("#a-popover-reg-create-privacy").find(".a-active").removeClass("a-active");b("#a-popover-reg-create-privacy").find("#WLNEW_link_"+
d).addClass("a-active");b(".reg-create-form").find("#WLNEW_input_privacy").val(d);b(".reg-create-form").find('a[id^\x3d"WLNEW_privacy_"]').find("span").html(a.triggerText);y(a.privacy)},togglePrivacy:function(a){a.$event.preventDefault();a=a.data;var c=a.privacy;b(".reg-create-form").find("#WLNEW_input_privacy").val(c);b(".reg-create-form").find('a[id^\x3d"WLNEW_privacy_"]').find("span").html(a.triggerText);y(c)},toggleListName:function(a){var c=a.data;a=c.name;var d=c.privacy,k=c.persistence,e=c.isReorderList===
p?!1:c.isReorderList,c=c.isReorderListView===p?!1:c.isReorderListView;b(".reg-create-form").find("#WLNEW_section_wlName").show();b(".reg-create-form").find("#create-isIdeaList").val("0");b(".reg-create-form").find("#WLNEW_section_ideaList").hide();b(".reg-create-form").find("#WLNEW_list_name").val(a);b(".reg-create-form").find("#WLNEW_privacy_"+d).click();b(".reg-create-form").find("#WLNEW_input_privacy").val(d);b(".pop-create").find("#WLNEW_list_persistence").prop("checked",c?e:"persistent"===k);
c&&b(".reg-create-form").find("#WLNEW_list_persistence").val(e?"persistent":"non-persistent")},toggleIdeaList:function(a){b(".reg-create-form").find("#WLNEW_section_wlName").hide();b(".reg-create-form").find("#create-isIdeaList").val("1");b(".reg-create-form").find("#WLNEW_section_ideaList").removeClass("a-hidden").show()},onShow:function(a){var c=a.popover;a=a.popover.$popover;c.data.first&&a.find("#WLNEW_section_wlFor").addClass("a-hidden");c.data.forFriend&&(a.find("#WLNEW_section_wlName, #WLNEW_section_occAge, #WLNEW_listfor_listtype_divider, #WLNEW_section_wlType, #WLNEW_section_wlFor, #WLNEW_listtype_listname_divider, #WLNEW_section_ideaList").addClass("a-hidden"),
a.find("#WLNEW_section_glName, #WLNEW_section_occDate, #WLNEW_section_occReminder, #WLNEW_privacy_gl").removeClass("a-hidden"),"child"===c.data.value&&t(a),b(".reg-create-form").find("#WLNEW_privacy_private").click(),b(".reg-create-form").find("#WLNEW_input_privacy").val("private"),a.find('select[name\x3d"create-for"]').val("friend"));c.data.sourceVendorId&&a.find('input[name\x3d"create-sourceVendorId"]').val(c.data.sourceVendorId);if(c.data.next){var h=c.data.next,k=a.find(".reg-create-form");k.find('input[name\x3d"create-next"]').val(h);
d.each(c.data,function(a,c){c.match(/^next-/)&&(a=b("\x3cinput/\x3e",{type:"hidden",name:c,value:a}),k.prepend(a))})}B(a.find("#WLNEW_list_name"));C(a)},onDropdownSelect:function(a){var c=b(a.selectNode).closest(".a-popover");if("create-for"===a.name){var d="public";if("self"===a.value)c.find("#WLNEW_section_glName, #WLNEW_section_occDate, #WLNEW_section_occAge, #WLNEW_section_occReminder, #WLNEW_privacy_gl").addClass("a-hidden"),c.find("#WLNEW_section_wlName, #WLNEW_listfor_listtype_divider, #WLNEW_section_wlType, #WLNEW_section_ideaList").removeClass("a-hidden"),
"1"===b("#create-isIdeaList").val()?c.find("#WLNEW_section_wlName").hide():c.find("#WLNEW_section_ideaList").hide();else if("friend"===a.value||"child"===a.value)c.find("#WLNEW_section_wlName, #WLNEW_section_occAge, #WLNEW_listfor_listtype_divider, #WLNEW_section_wlType, #WLNEW_section_ideaList").addClass("a-hidden"),c.find("#WLNEW_section_glName, #WLNEW_section_occDate, #WLNEW_section_occReminder, #WLNEW_privacy_gl").removeClass("a-hidden"),0===b("#popCal").length&&c.find("#WLNEW_occ_date").removeClass("a-hidden"),
"child"===a.value&&t(c),d="hidden",b(".reg-create-form").find("#WLNEW_privacy_private").click(),b(".reg-create-form").find("#WLNEW_input_privacy").val("private");x(d,c)}else"create-month"===a.name||"create-day"===a.name?(a=c.find('select[name\x3d"create-for"]').val())&&"child"===a&&t(c):"choose-relationship"===a.name&&(a=a.value,c.find("#create-participant_relationship").val(a))},onClose:function(a){x("public",a.popover.$popover);m=0},submitCreate:function(a,c,h,k,e){a.$event.preventDefault();var g=
a.$target.closest(".reg-create-form"),l=g.closest(".a-popover");A(g);m++;var f=v(g),f=z(f),p=!1;d.each(f.errors,function(a,c){a=l.find("#WLNEW_alert_"+c);a.removeClass("a-hidden");a.parent("div").find("input").each(function(){b(this).addClass("a-form-error")});p=!0});p||(a={sid:a.data.sid,createListToken:a.data.createListToken},b.extend(a,f.userCreateArgs),l.find("#WLNEW_loading").removeClass("a-hidden"),l.find("#popover-spinner .a-popover-loading").show(),g.addClass("a-hidden"),f.userCreateArgs.isIdeaList?
(c="/hz/wishlist/ajax/createlist?ref\x3ddl_create_list_lv",f.userCreateArgs.isCreateAndAdd&&(c="/hz/wishlist/ajax/createlistandadditem?ref\x3ddl_create_list_dp"),b.ajax(c,{type:"POST",data:a,success:k,error:e})):(k="Y"===a["create-isPrivate"]?"private":"public",e={},e.sid=a.sid,"undefined"!==typeof a.createListToken&&(e.createListToken=a.createListToken),e.listType=a["create-registryType"],e.privacyStatus=k,"undefined"!==typeof a["create-name"]&&(e.listName=a["create-name"]),"undefined"!==typeof a["create-persistence"]&&
(e.persistence=a["create-persistence"]),"undefined"!==typeof a["create-sourceVendorId"]&&(e.vendorId=a["create-sourceVendorId"]),"undefined"!==typeof a["create-participant2-name"]&&(e.participantName=a["create-participant2-name"]),"undefined"!==typeof a["create-participant2-surName"]&&(e.participantGivenName=a["create-participant2-surName"]),"undefined"!==typeof a["create-participant2-givenName"]&&(e.participantSurName=a["create-participant2-givenName"]),"undefined"!==typeof a["create-participant2-relationship_Participant"]&&
(e.relationship=a["create-participant2-relationship_Participant"]),"undefined"!==typeof a["create-occasion1-fromDate_Day"]&&(e.occasionFromDate=a["create-occasion1-fromDate_Day"]),"undefined"!==typeof a["create-occasion1-fromDate_Month"]&&(e.occasionFromMonth=a["create-occasion1-fromDate_Month"]),"undefined"!==typeof a["create-occasion1-fromDate_Year"]&&(e.occasionFromYear=a["create-occasion1-fromDate_Year"]),"undefined"!==typeof a["create-occasion1-reminderOffset_Occasion"]&&(e.occasionReminderOffset=
a["create-occasion1-reminderOffset_Occasion"]),"undefined"!==typeof a.asin&&(e.asin=a.asin),"undefined"!==typeof a.customizationToken&&(e.customizationToken=a.customizationToken),"undefined"!==typeof a["create-recipient-name"]&&(e.recipientName=a["create-recipient-name"]),u(e,c,h)))}}});"use strict";f.register("mash-capabilities",function(){var d;return{isDispatchEventAvailable:function(){if(d!==p)return d;var f;a:{f=document.cookie.split(";");for(var b=0;b<f.length;b++){for(var h=f[b];" "===h.charAt(0);)h=
h.substring(1,h.length);if(0===h.indexOf("amzn-app-ctxt\x3d")){f=h.substring(14,h.length);break a}}f=null}b=0;if(null!==f)try{var m=f.match(/"cp":[0-9]*/);null===m&&(m=decodeURIComponent(f).match(/"cp":[0-9]*/));if(null!==m&&0<m.length){var n=m[0].split(/:/);if(null!==n&&2===n.length){var r=parseInt(n[1],10);b="number"===typeof r?r&2048:0}}}catch(v){}return d=0!==b}}});"use strict";f.when("A").register("weblab-trigger",function(d){var f=d.$;return function(b){f.ajax({url:"/hz/wishlist/triggerweblab?name\x3d"+
b,success:function(d){d||n.ueLogError(p,{logLevel:"FATAL",attribution:"ListsDPXCommonAssets::"+b,message:"failed To trigger weblab "+b})},timeout:2E4})}})});
/* ******** */
(function(p){var m=window.AmazonUIPageJS||window.P,t=m._namespace||m.attributeErrors,a=t?t("RegistryDPAssets",""):m;a.guardFatal?a.guardFatal(p)(a,window):a.execute(function(){p(a,window)})})(function(p,m,t){p.when("A","b2b-lists-detail").execute(function(a,g){function e(){var b=a.$("#free-form-quantity-dropdown"),f=a.$("#quantity-update-text"),h=a.$("#quantity"),e=1;0<b.length&&b.is(":visible")?(e=b.val(),0===e.length&&(e=f.val())):0<f.length&&f.is(":visible")?e=f.val():0<h.length&&h.is(":visible")&&
(e=h.val());return e}g.isEnabled()&&(a.on("a:dropdown:selected:quantity",function(a){g.updateQuantity(a.value)}),a.on("a:dropdown:selected:free-form-quantity-dropdown",function(b){0<b.value.length?g.updateQuantity(b.value):g.updateQuantity(a.$("#quantity-update-text").val())}),a.$(document).delegate("#quantity-update-text","change",function(a){g.updateQuantity(a.target.value)}),a.on("a:pageUpdate",function(){var b=a.$("#ASIN").val();g.updateQuantityAndAsin(e(),b)}))});p.when("A","a-modal").register("b2b-lists-detail",
function(a,g){function e(){return g.get(a.$("#business-list-modal"))}function b(a,b,e){var g=new RegExp("([?\x26])"+b+"\x3d.*?(\x26|$)","i"),n=a;a.match(g)&&(n=a.replace(g,"$1"+b+"\x3d"+e+"$2"));return n}return{updateQuantityAndAsin:function(f,h){var g=(a.state("businessListPageState")||{}).businessListUrl;g&&(g=b(g,"quantity",f),f=g=b(g,"asin",h),e().update({url:f}))},updateQuantity:function(f){var h=(a.state("businessListPageState")||{}).businessListUrl;h&&(f=h=b(h,"quantity",f),e().update({url:f}))},
isEnabled:function(){return 0<a.$("#add-business-list-button").length}}});"use strict";p.when("A","a-popover","atwl-common-util","atwl-dropdown-util","atwl-util","atwl-inline-util","add-to-wish-list:plugin-registry").register("add-to-wish-list",function(a,g,e,b,f,h,r){"undefined"!==typeof a.state.parse&&a.state.parse();var l=a.$,n=e.getState("atwl"),d=e.getState("popoverState"),A=e.atwlFormSelector(),q=m.currentType,z=e.getState("wishlistDPState").eventsBound,v=n.showInlineLink||!1;m.setRegistryId=
e.setRegistryId;var k=[],w=function(){l("#wishListMainButton,#"+n.activePopoverButtonId).addClass("a-hidden");b.hideDropDown();l("#atwl-error-holder").removeClass("a-hidden")},u=function(a){B();a=function(){var c=e.getState("popoverState"),c=document.getElementById(c.formId||"addToCart");if("undefined"===typeof c||null===c)c=document.getElementById("addToWL");null!==c&&(c=l("#add-to-wishlist-button-submit"),e.forceFormSubmit(c))};var c=r.getPlugin();c&&c.addToList?c.addToList(a):a()},p=function(b){"undefined"!==
typeof b&&b.preventDefault();B();b=function(){var c,b=l(A).find(e.popCommandSelector).val();c=e.getState("wishlistDPState");if(b&&""!==b){b=b.split("_");q=b[2];if("wishlist"!==q&&"giftlist"!==q&&"supplylist"!==q||l("html").hasClass("a-lt-ie9")){f.redirectToHUCPage();return}c="new"===b[1]?"create":"default"===b[1]&&c.isFirstCreate?"create":"add"}else if(q="wishlist",c=c.isFirstCreate?"create":"add","add"===c&&l("html").hasClass("a-lt-ie9")){f.redirectToHUCPage();return}a.state("wishlistDPState",{action:c,
type:q});m.currentType=q;l("#add-wishlist-declarative").trigger("click")};var c=r.getPlugin();c&&c.addToList?c.addToList(b):b()};a.on("addFormSubmit",p);var x=function(a){try{if("undefined"!==typeof a){var c="";if("undefined"!==typeof a.pcompHtml&&""!==a.pcompHtml.trim())c=a.pcompHtml;else{w();return}l("#wishListMainButton").hasClass("a-hidden")||(l("#wishListMainButton,#"+n.activePopoverButtonId).addClass("a-hidden"),b.hideDropDown(),l("#atwl-output-holder").empty(),l("#atwl-output-holder").append(c),
l("#atwl-output-holder").removeClass("a-hidden"))}else w();for(c=0;c<k.length;c++)if("function"===typeof k[c])k[c](a)}catch(f){w()}},t=function(b){b.preventDefault();B();b=function(){var c=e.getState("wishlistDPState"),b=l(A).find("[name\x3d'wlPopCommand']").val(),k=c.action,f=c.type;b&&""!==b&&(b=b.split("_"),k="new"===b[1]?"create":"default"===b[1]&&c.isFirstCreate?"create":"add",q=b[2],a.state("wishlistDPState",{action:k,type:q}),m.currentType=q);"add"===k?(h.showSpinner(),k=h.parseParams(k,f),
c.customizationToken&&(k.customizationToken=c.customizationToken),a.ajax("/gp/registry/atwl/add.html",{method:"post",params:k,success:h.addItemResponseHandler,error:h.showError})):l("#add-wishlist-declarative").trigger("click")};var c=r.getPlugin();c&&c.addToList?c.addToList(b):b()},y=function(b){var c=document.createElement("input");c.type="hidden";c.id=b;c.name=b;"undefined"!==typeof l("#addItemForm")&&l("#addItemForm").append(c);return c},B=function(){var b=e.getState("wishlistDPState");delete b.customizationToken;
delete b.customizedPrice;a.state.replace("wishlistDPState",b)};g=function(){(d.showWishListDropDown||d.showBabyRegDropdown||d.isAddToWishListDropDownAuiEnabled||d.showPopover)&&d.showPopover&&(a.capabilities.touch?l("#add-to-wishlist-button-submit").unbind("click").bind("click",u):v?l("#add-to-wishlist-button-submit").unbind("click").bind("click",t):l("#add-to-wishlist-button-submit").unbind("click").bind("click",p),z||(a.state("wishlistDPState",{eventsBound:!0}),a.declarative("add-wishlist-declarative",
["click"],function(b){b=e.getState("wishlistDPState");var c=f.parsePostData(b.action,b.type),k=m.ue;k&&k.count("lists:dp:addtolist:click",(k.count("lists:dp:addtolist:click")||0)+1);l("#atwl-dd-no-title-holder").hasClass("a-hidden")||l("#atwl-dd-no-title-holder").addClass("a-hidden");if("undefined"!==typeof c.asin&&0!==c.asin.length||"undefined"!==typeof c.name&&0!==c.name.length)if("false"===b.custRecognized){if(null===b.asin){b=y("name.0");var c=y("imageUrl.0"),k=y("productUrl.0"),d=y("priceInput"),
h=y("quantity.0");b.value=document.getElementById("name").value;c.value=document.getElementById("imageUrl").value;k.value=document.getElementById("productUrl").value;d.value=document.getElementById("price").value;h.value=1}l("#addItemForm").submit()}else a.ajax(c.url,{method:"get",dataType:"json",cache:!1,params:c,success:x,error:w});else l("#atwl-dd-no-title-holder").removeClass("a-hidden")})))};g();a.on("atwl-trigger-onload-bindings",g);return{setPostAddSuccess:function(b){k.push(b)}}});"use strict";
p.when("A","a-popover","atwl-common-util").register("atwl-dropdown-util",function(a,g,e){var b=a.$;e.getState("popoverState");var f=0,h,r=e.CONST,l=e.ie8NoScroll,n=e.setAtwlState,d=function(){b("#wishListDropDown").removeClass("a-button-selected");b("#wishListMainButton").removeClass("a-button-selected")},A=function(){var c=e.getState("atwl"),b=c.activePopoverButtonId;return"undefined"!==b&&"add-to-baby-button-group"===b?c.babyDropDownHtml:c.dropDownHtml},q=function(c){var b=e.getState("atwl").activePopoverButtonId;
"undefined"!==b&&"add-to-baby-button-group"===b?n({babyDropDownHtml:c}):n({dropDownHtml:c})},z=function(){var c=b("#atwl-dd-ul").parent();if(c&&c.get(0)){var a=c.get(0).scrollHeight,k=c.height(),c=2*parseInt(c.css("padding-top"),10);return a>k+c}return!1},v=function(c){c.find(".a-button-close").hide();c.find(".a-popover-content").css({"margin-right":"0px"});c.css({padding:"0"});c.find(".a-popover-inner").css({padding:"0"});setTimeout(function(){c.find(".a-arrow-border").addClass("aok-hidden");b("#atwl-rich-content").css({"margin-bottom":"0px",
width:"auto"});var k=e.getState("atwl");if(k.hzPopover){var f=document.getElementById(k.activePopoverButtonId);if(null!==f&&"undefined"!==typeof f){var d=f.getBoundingClientRect().left;a.capabilities.rtl&&(d=b(m).width()-f.getBoundingClientRect().right);c.css({left:d+"px"})}}b.browser.msie&&(d=b("#"+k.wishlistButtonSubmitId),k=d.offset(),f=d.height(),d=k.left,k=k.top+f,l()&&(d+=document.body.parentElement.scrollLeft,k+=document.body.parentElement.scrollTop),z()&&(d-=17),c.css({left:d+"px",top:k+"px"}))},
50)},k=function(c){var a;a=l()?50:0;setTimeout(function(){var a=b("#atwl-popover-inner"),k=a.width(),d=e.getState("atwl"),f=document.getElementById(d.activePopoverButtonId);d.hzPopover&&null!==f&&"undefined"!==typeof f?k=f.getBoundingClientRect().width:z()?k+=r.overflowWidth:b(".atwl-dd-list-name").each(function(c){c=b(this);c.width(c.width()+r.noOverflowWidth)});d=c.find("ul li a.a-active").first();d.css("margin-left","1px");d.parent().focus();a.width(k)},a)},w=function(){if(h){var c=g.get(h);c&&
c.hide()}},u=function(c){var a=r.widthStaticPopovers;try{a=document.getElementById("add-to-wishlist-button-group").clientWidth}catch(k){}b("#"+c).children().first().width(a);w();if(g){var d=g.get(h),f=e.getState("atwl"),d=d?g.get(h):g.create(b("#"+f.activePopoverButtonId),{content:b("#"+c).html(),name:"atwl",skin:function(c){return c},activate:"onmouseclick",width:a,position:f.dropDownPosition||"triggerBottom"});d.update({width:a,content:b("#"+c).html()});h=d.id;d.show().updatePosition();v(d.$popover)}},
p=function(){d();f++;w();u("atwl-dd-error-holder")},x=function(){var c=e.getState("atwl");return g.create(b("#"+c.activePopoverButtonId),{content:A(),name:"atwl",skin:function(c){return c},activate:"onmouseclick",position:c.dropDownPosition||"triggerBottom"})},t=function(c){c.update({content:A(),width:"auto"});c.show();v(c.$popover);k(c.$popover)},y=function(){var c=g.get("atwl");c&&c.isActive()?c.hide():(c=x(),g.remove(c),c=x(),t(c),a.capabilities.touch&&setTimeout(function(){var c=b("#wishlistButtonStack"),
a=c.clone(),k=c.parent();c.remove();k.append(a)},300),"function"===typeof m.uet&&m.uet("cf","addToListDropdown",{wb:1}),"function"===typeof m.uex&&m.uex("ld","addToListDropdown",{wb:1}))},B=function(){var c=g.get("atwl");c&&c.isActive()&&c.hide()},C=function(c,b,a){c.append('\x3cinput type\x3d"hidden" id\x3d"'+b+'" name\x3d"'+b+'" value\x3d"'+a+'"\x3e')};return{makeDropDownArrowInactive:d,getDropDownHtml:A,setDropDownHtml:q,resetDropDownHtml:function(){q("")},resetAjaxFailCount:function(){this.ajaxFailCount=
0},hideDropdown:B,hideError:function(){w();var c=e.getState("atwl");return f>=c.maxAjaxFailureCount},showUnavail:function(){w();w();u("atwl-dd-unavail-holder")},showSpinner:function(){u("atwl-dd-spinner-holder")},parseAjaxResponse:function(c){d();w();var k;if("object"===typeof c)k=c;else try{k=a.parseJSON(c)}catch(f){p();return}"undefined"!==typeof k.html&&"undefined"!==k.css?(q(k.html),c=k.css,b("body").append(c),y()):p()},showError:p,showDropDown:y,setInputRegistryId:function(c,k){"undefined"===
typeof k&&(k="wishlist");var d="pop_"+c+"_"+k,f=b(e.atwlFormSelector()),h=f.find(e.popCommandSelector);h.length?h.attr("value",d):C(f,"sourceCustomerOrgListID",d);d=f.find("[name\x3d'registryID']");d.length?d.attr("value",c):C(f,"registryID",c);c=f.find("[name\x3d'registryType']");c.length?c.attr("value",k):C(f,"registryType",k);n({inSubmit:!0});k=f.find("[name\x3d'submit.add-to-registry.wishlist'],[name\x3d'submit.add-to-wishlist']").eq(0);k.length?k.click():a.trigger("addFormSubmit");B();return!1}}});
"use strict";p.when("A","a-popover","a-modal","atwl-dropdown-util","atwl-common-util","atwl-inline-util","kbp","amazon-lists-csrf-utils").execute("atwl-dropdown",function(a,g,e,b,f,h,r,l){var n=a.$;e=f.getState("popoverState");var d=f.getState("atwl"),A=d.wireDeclaratives,q=function(){var b=n("#"+d.wishlistButtonId),f=n("#"+d.wishlistButtonSubmitId);if(d.inlineJsFix)a.on("wl-drop-down",function(b){v(b)});else b.addClass("a-declarative"),b.attr("data-action","atwl-splitbutton-arrow");f.addClass("a-declarative");
f.attr("data-action","atwl-splitbutton-main");n("#wishListMainButton").addClass("a-declarative").attr("data-action","add-wishlist-declarative");m.atwlEc&&setTimeout(function(){b.click();n("#atwl-dd-spinner-holder").addClass("a-hidden");m.atwlEc=!1},1);m.atwlLoaded=!0};a.on("a:pageUpdate",function(){n("#wishListMainButton").hasClass("a-declarative")||(q(),a.trigger("atwl-trigger-onload-bindings"))});var z=function(){var b;b=m.atwlEc?"lists:dp:ech:early":"lists:dp:ech:late";var a=m.ue;a&&a.count(b,
(a.count(b)||0)+1)},v=function(a){a.$event&&a.$event.originalEvent&&a.$event.originalEvent.acknowledge&&a.$event.originalEvent.acknowledge(a.$currentTarget.get(0));"function"===typeof m.uet&&m.uet("bb","addToListDropdown",{wb:1});z();f.setAtwlState({activePopoverButtonId:"add-to-wishlist-button-group"});a.$event?a.$event.preventDefault():a.preventDefault();setTimeout(function(){b.makeDropDownArrowInactive()},0);if("not-allowed"===(a.$target?a.$target:n(a.target)).css("cursor"))return!1;if(b.hideError())return b.showUnavail(),
!1;if((a=b.getDropDownHtml())&&a.length)b.showDropDown();else{b.showSpinner();a=f.getState("wishlistDPState");var h="website.wishlist.detail.add";"undefined"!==typeof a.vendorId&&(h=a.vendorId);a={sortMethod:d.sortMethod||0,type:"wishlist",useAll:d.showAllTypes||0,sourceVendorId:h};h=d.hzPopover?"/hz/wishlist/addtolist":"/gp/registry/atwl/popover.html";h+="?"+n.param(a);n.ajax({url:h,cache:!1,success:b.parseAjaxResponse,error:b.showError})}return!1};if(e.showWishListDropDown||e.isAddToWishListDropDownAuiEnabled||
e.showPopover)q(),f.setAtwlState({resetDropDownHtml:b.resetDropDownHtml}),A||(a.declarative("atwl-splitbutton-arrow","click",v),a.declarative("atwl-dd","click",function(a){a.$event.preventDefault();a=a.data;b.setInputRegistryId(a.id,a.type);return!1}),a.declarative("atwl-dd-dl","click",function(d){d.$event.preventDefault();b.hideDropdown();h.showSpinner();var e=f.getAsin(),g=f.getSid(),e=n.extend({},{asin:e,sid:g},d.data),g=[];l.addCsrfToken(g);a.post("/hz/wishlist/ajax/additem?ref\x3didea_dp_ai",
{params:e,headers:g,success:function(a){a.registryName=d.data.listName;h.addItemResponseHandler(a)},error:h.showError,abort:h.showError});return!1}),a.declarative("atwl-dd-cl","click",function(d){d.$event.preventDefault();b.hideDropdown();h.showSpinner();var e=f.getAsin(),g=f.getSid();d={asin:e,sid:g,listId:d.data.id,listType:d.data.type};e=[];l.addCsrfToken(e);a.post("/hz/wishlist/addasin?ref\x3dsmi_cl_dp_add",{params:d,headers:e,success:function(a){h.addItemResponseHandlerHZCharityList(a)},error:h.showError,
abort:h.showError});return!1}),a.declarative("atwl-kbp-landing","click",function(a){a=a.data;var b=f.getAsin();m.open(a.url+("\x26asin\x3d"+b));return!1})),d&&"kbp"===d.sortMethod&&(a.state("atwl",{kbpPromo:{mouseOver:!1,countDown:!1}}),a.ajax("/gp/toys/birthday/atwl-dpx.html",{method:"get",cache:!1,params:{isAUI:1},success:r.showKbpPromoPopover,error:function(){}}),A||(a.declarative("atwl-kbp-promo-mouseover","mouseleave",function(){var b=f.getState("atwl").kbpPromo;b.mouseOver=!1;if(b.countDown){var d=
g.get("kbpPromoPopover");d&&(d.unlock().hide(),g.remove(d))}a.state("atwl",{kbpPromo:b})}),a.declarative("atwl-kbp-promo-mouseover","mouseenter",function(){var b=f.getState("atwl").kbpPromo;b.mouseOver=!0;a.state("atwl",{kbpPromo:b})}),a.on("a:popover:hide:kbpPromoPopover",function(){var a=g.get("kbpPromoPopover");a.unlock().hide();g.remove(a)}))),f.setAtwlState({wireDeclaratives:!0})});"use strict";(function(){var a=!1;p.when("cf").execute(function(){a||(a=!0,g())});p.when("atwl-cf").execute(function(){a||
(a=!0,g())});var g=function(){p.now("cf-or-atwl-cf").execute(function(a){"undefined"===typeof a&&m.P.register("cf-or-atwl-cf")})}})();p.when("A","cf-or-atwl-cf").register("atwl-common-util",function(a){var g=a.$,e=function(){return"#"+(b("popoverState").formId||"addToCart")+",#addToWL"},b=function(b){a.state.parse();return 0===g('script[data-a-state\x3d"{"key":"'+b+'"}"]').length?{}:a.state(b)||JSON.parse(g('script[data-a-state\x3d"{"key":"'+b+'"}"]').text())||{}};return{CONST:{widthStaticPopovers:230,
overflowWidth:10,noOverflowWidth:10,scrollbarWidth:17},getAsin:function(){var a=g(e()).find("#ASIN").val();"undefined"===typeof a&&(a=g(e()).find("[name^\x3d'ASIN'],[name^\x3d'ASIN.0']").val());return a},getSid:function(){var a=g(e()).find("#session-id").val();"undefined"===typeof a&&(a=g(e()).find("[name\x3d'session-id']").val());return a},ie8NoScroll:function(){return 9>parseInt(g.browser.version,10)&&document.body&&document.body.parentElement?!(!document.body.parentElement.scrollLeft&&!document.body.parentElement.scrollTop):
!1},setRegistryID:function(a){var b=g(e());b.find("[name\x3d'sourceCustomerOrgListID'],[name\x3d'colid'],[name\x3d'wlPopCommand']").attr("value",a);b.find("[name\x3d'submit.add-to-registry.wishlist'],[name\x3d'submit.add-to-wishlist']").eq(0).click();return!1},setAtwlState:function(b){a.state("atwl",g.extend(a.state("atwl")||{},b))},getState:b,clearText:function(a){a.value===a.defaultValue&&(a.value="")},forceFormSubmit:function(a){var b=a.attr("name");a=a.parents("form");b=g('\x3cinput type\x3d"hidden" /\x3e').attr("name",
b).val("1");a.append(g(b));a.submit()},clearPopCommandFields:function(){for(var a=["wlPopCommand","sourceCustomerOrgListID"],b=0;b<a.length;b++){var e=g('[name^\x3d"'+a[b]+'"]');e&&e.length&&e.val("")}},atwlFormSelector:e,popCommandSelector:"[name\x3d'sourceCustomerOrgListID'],[name\x3d'colid'],[name\x3d'wlPopCommand']"}});"use strict";p.when("A","a-popover","atwl-common-util").register("kbp",function(a,g,e){var b=a.$,f=e.getState("atwl"),h=b("#"+f.wishlistButtonSubmitId);return{showKbpPromoPopover:function(b){if(b&&
b.promoEnabled){var f=b.html;if(f){var n=g.create(h.parent(),{name:"kbpPromoPopover",content:f,position:"triggerBottom",width:b.width});n.show().lock();a.delay(function(){var b=e.getState("atwl").kbpPromo||{};b.mouseOver?b.countDown=!0:(n.unlock().hide(),g.remove(n));a.state("atwl",{kbpPromo:b})},1E4)}}}}});"use strict";p.when("A","atwl-util","atwl-dropdown-util","atwl-common-util").execute("atwl-huc",function(a,g,e,b){var f=a.$,h=b.getState("popoverState"),r=b.getState("wishlistDPState"),l=b.getState("createInfo")||
{},n="addCreateToWishlist";l.isHorizonte&&(n="reg-create");r=r.eventsBound;(h.showWishListDropDown||h.showBabyRegDropdown||h.isAddToWishListDropDownAuiEnabled||h.showPopover)&&!r&&(a.on("a:popover:show:"+n,function(d){var h=d.popover;d=h.$popover;var n=b.getState("wishlistDPState"),r=n.action;d.addClass("pop-huc-"+r);var v=h.$trigger.closest(".a-button").find("input");d=n.type;v.closest(".a-button-selected").removeClass("a-button-selected");d=g.parsePostData(r,d);n.customizationToken&&(d.customizationToken=
n.customizationToken);var k=d.url,p=d.streaming,u="ajax_"+p,t=new Date;m.ue&&m.uet("tc",u);var x=function(){h.hide();b.forceFormSubmit(v)},D=function(){h.$popover.find("#popover-spinner").addClass("a-hidden");b.clearPopCommandFields()},y=function(){m.ue&&(m.uet("be",u),m.uex("ld",u))},B=function(a,b,d){m.ue&&(m.ues("id",u,a),m.ues("t0",u,b),m.ues("ctb",u,d))};if("create"!==r&&p){var C=b.getState("atwl");a.ajax(d.url,{method:"post",params:d,error:x,success:function(b,d,g){try{var k=g.http;if(2<k.readyState&&
"undefined"!==typeof k.status&&200===k.status&&("undefined"!==typeof k.response||"undefined"!==typeof k.responseText&&"undefined"!==typeof k.responseText)){b=[];"undefined"!==typeof k.response&&null!==k.response?b=k.response.split(",,,"):"undefined"!==typeof k.responseText&&"undefined"!==typeof k.responseText&&null!==k.responseText&&(b=k.responseText.split(",,,"));for(d=0;d<b.length;d++){var v=b[d],l;try{l=a.parseJSON(v)}catch(r){break}0===d&&l&&"skeleton"===l.name?l&&l.html&&(B(l.requestId,new Date,
"1"),l.status&&"no-asins"===l.status?x():(D(),h.$popover.find("#WLHUC_result").html(l.html).removeClass("a-hidden"))):l&&l.name&&l.html&&"pcomp"===l.name?f("#wishListMainButton").hasClass("a-hidden")||(f("#wishListMainButton,#"+C.activePopoverButtonId).addClass("a-hidden"),e.hideDropDown(),f("#wishlistButtonStack").append(l.html)):l&&l.name&&l.html&&"js"!==l.name?(h.$popover.find("#"+l.name).html(l.html),n.customizedPrice&&h.$popover.find("#price-text").text(n.customizedPrice),1===d&&m.ue&&m.uet("cf",
u)):l&&l.html&&h.$popover.find("#WLHUC_result").append(l.html);h.updatePosition()}4===k.readyState&&y()}else"undefined"!==typeof k.status&&200!==k.status&&x()}catch(r){x()}}})}else l.isHorizonte?a.ajax(k,{method:"get",contentType:"text/html",success:function(b){h.$popover.find("#popover-spinner").addClass("a-hidden");h.$popover.find("#WLHUC_result").html(b).removeClass("a-hidden");h.updatePosition()},error:x}):a.ajax(k,{method:"post",params:d,success:function(a){a&&a.html?(B(a.requestId,t,"1"),a.status&&
"no-asins"===a.status?x():(D(),"add"===r?h.$popover.find("#WLHUC_result").html(a.html).removeClass("a-hidden"):(h.$popover.find("#WLNEW_main").html(a.html).removeClass("a-hidden"),(a=b.getState("atwl"))&&a.resetDropDownHtml&&a.resetDropDownHtml()),h.updatePosition()),y()):("create"===r&&b.forceFormSubmit(v),h.hide())},error:x})}),a.on("a:popover:beforeShow:"+n,function(a){a=a.popover;var h=b.getState("wishlistDPState");a.$popover.find("#popover-spinner").css({margin:"10% 40%"});a.$popover.find("#popover-spinner").removeClass("a-hidden");
a.$popover.find(".wlAddCreatePop").html("").addClass("a-hidden");var e=h.action,f=e+"Header";"create"===e&&h.isFirstCreate&&(f="first"+f);a.update({width:h[e+"Width"],header:h[f],height:h[e+"Height"]});a.updatePosition()}),a.on("a:popover:hide:"+n,function(a){f(".a-modal-scroller").css({visibility:"hidden"});b.clearPopCommandFields()}))});"use strict";p.when("A","atwl-common-util","add-to-wish-list:plugin-registry").register("atwl-util",function(a,g,e){var b=a.$,f=function(){return g.getState("atwl").inlineLinkWeblabTreatment};
return{redirectToHUCPage:function(){var a=b("#add-wishlist-declarative").closest(".a-button").find("input");g.forceFormSubmit(a)},parsePostData:function(a,b){var l=g.getState("popoverState"),l=document.getElementById(l.formId||"addToCart");if("undefined"===typeof l||null===l)l=document.getElementById("addToWL");var n=[];if("undefined"!==typeof l&&null!==l){var d=[],m=!1,n=l.elements;n||(n=l.querySelectorAll("input"),m=!0);for(var q=0;q<n.length;q++){var p;if(!(p=m)){p=n[q];var v=/^(?:checkbox|radio)$/i,
k=/^(?:submit|button|image|reset|file)$/i,w=/^(?:input|select|textarea|keygen)/i;if(p){var u=p.type;p=p.name&&!p.disabled&&w.test(p.nodeName)&&!k.test(u)&&(p.checked||!v.test(u))}else p=!1}p&&d.push(n[q])}n=d}d={};m=g.getState("wishlistDPState");"undefined"!==typeof m.asin&&null!==m.asin&&(d.asin=m.asin);for(q=0;q<n.length;q++)"submit"!==n[q].type&&(d[n[q].name]=n[q].value);d.requestedQty=d.quantity=null!==l&&"undefined"!==typeof l.quantity?l.quantity.value:1;d.sid="undefined"!==typeof d["session-id"]?
d["session-id"]:m.sid;d.cache=!1;d.url=m[a+"Url"];d.action=a;d.type=d.registryType||"wishlist";l=f();typeof l!==t&&(d.inlineLinkWeblabTreatment=l);"add"===a?(d.type=d.registryType||b,d.caller="aui",d.streaming=m.streaming,d.sourceVendorId="undefined"!==typeof m.vendorId?m.vendorId:"website.wishlist.detail.add"):"create"===a&&(d.create_sid=d.sid,d.create_type=d.registryType||b,d.create_nextAction="add",d.create_includeEmptyList=1,d.create_isFirst=m.isFirstCreate?1:0,d.caller="aui",d.create_sourceVendorId=
"undefined"!==typeof m.vendorId?m.vendorId:"website.wishlist.detail.add");(a=e.getPlugin())&&a.filterFormData&&a.filterFormData(d);return d},parseButtonType:function(a){a=a.attr("name");var b=a.split("."),e=new RegExp("submit"+String.fromCharCode(92)+".add-to-registry"+String.fromCharCode(92)+"."),f=new RegExp("submit"+String.fromCharCode(92)+".add-to-");return e.test(a)?b[2]:f.test(a)?b[1].split("-")[2]:""},hideAddToListButtonStack:function(){b("#add-to-wishlist-button-group").hasClass("a-hidden")||
b("#add-to-wishlist-button-group").addClass("a-hidden")},showAddToListButtonStack:function(){b("#add-to-wishlist-button-group").hasClass("a-hidden")&&b("#add-to-wishlist-button-group").removeClass("a-hidden")},getInlineWeblabTreatment:f}});"use strict";p.when("A","atwl-util","atwl-dropdown-util","cf").register("atwl-inline-util",function(a,g,e){var b=a.$,f=function(){b("#atwl-inline-spinner").addClass("a-hidden")},h=function(){g.hideAddToListButtonStack();b("#atwl-inline-spinner").removeClass("a-hidden")},
m=function(){f();b("#atwl-inline").addClass("a-hidden");g.showAddToListButtonStack();e.makeDropDownArrowInactive();b("#atwl-inline-error").removeClass("a-hidden")},l=function(a){b("#atwl-inline-error-msg").empty();b("#atwl-inline-error-msg").html(a)},n=function(a,d){var e="wl_inline_title",f="/gp/registry/wishlist/";d&&"giftlist"===d?f="/gp/registry/giftlist/":d&&"discoverlist"===d&&(f="/idea/",e="idea_dp_inline");f+=a+"/ref\x3d"+e;b("#atwl-inline-link").attr("href",f)},d=function(a){b("#atwl-inline-link-text").empty();
b("#atwl-inline-link-text").text(a)},p=function(){f();b("#atwl-inline-error").addClass("a-hidden");b("#atwl-inline").removeClass("a-hidden")},q=function(a){a&&a.message&&l(a.message);m();b(".reg-create-form").closest(".a-popover").find(".a-button-close").click()},z=function(a){h();b(".reg-create-form").closest(".a-popover").find(".a-button-close").click();d(a.listName)};return{showSpinner:h,showError:m,showErrorClosePopover:q,parseParams:function(a,b){a=g.parsePostData(a,b);b=a.ASIN||a["ASIN.0"];
var d=a["session-id"],e=a.sourceVendorId,f=a.type||"wishlist",h;h="create"===a.action?"newsl":a.wlPopCommand?a.wlPopCommand.split("_")[1]:a.sourceCustomerOrgListID?a.sourceCustomerOrgListID.split("_")[1]:"default";a={asin:b,sid:d,sourceVendorId:e,type:f,registryID:h,pcomp:0,action:a.action};b=g.getInlineWeblabTreatment();typeof b!==t&&(a.inlineLinkWeblabTreatment=b);return a},addItemResponseHandler:function(a){try{typeof a!==t?1===a.isValid||!0===a.updateSuccessful?(n(a.registryID,a.registryType),
d(a.registryName),p()):typeof a.message!==t&&(l(a.message),m()):m()}catch(b){m()}},addItemResponseHandlerHZ:function(a){try{typeof a!==t&&!1===a.hasError?(z(a),n(a.listExternalId,a.listType),p()):m()}catch(b){m()}},addItemResponseHandlerHZIdeaList:function(a){try{typeof a!==t&&a.updateSuccessful?(z(a),n(a.listId,"discoverlist"),p()):q(a)}catch(b){q(a)}},addItemResponseHandlerHZCharityList:function(a){try{if(typeof a!==t&&!1===a.hasError){z(a);var d="/hz/charitylist/ls/"+a.listExternalId+"/ref\x3dsmi_cl_dp_lcl_cl";
b("#atwl-inline-link").attr("href",d);p()}else a&&a.message&&l(a.message),m()}catch(e){m()}}}});"use strict";p.register("add-to-wish-list:plugin-registry",function(){var a=null;return{registerPlugin:function(g){if(null!==a)throw Error("Only a single plugin can be registered.");a=g},getPlugin:function(){return a}}});"use strict";p.when("A","legacy-create-utils","atwl-inline-util").execute(function(a,g,e){var b=a.$;a.state.parse();if((a.state("createInfo")||{}).isHorizonte){var f=function(){b("#WLNEW_error").removeClass("a-hidden")},
h=function(a){try{if(typeof a!==t&&!1===a.hasError){b("#WLNEW_loading").addClass("a-hidden");var e=b(".reg-create-form");e.addClass("a-hidden");a.htmlMessage?e.parent().append(a.htmlMessage):f()}else f()}catch(h){f()}};a.declarative("reg-create-submit",["click"],function(a){g.submitCreate(a,h,f,e.addItemResponseHandlerHZIdeaList,e.showErrorClosePopover)})}});"use strict";p.when("A","jQuery").execute(function(a,g){a.declarative("remaining-customizations-action","click",function(a){var b=a.$currentTarget.parent().find(".remaining_customization_info");
b.show();b.removeClass("aok-hidden");a.$currentTarget.hide();a.$event.preventDefault()})});"use strict";p.when("A","create-utils").execute(function(a,g){var e=a.$,b=function(a){e("#create-list-loading").addClass("aok-hidden");e("#create-list-error").removeClass("aok-hidden");a.message?e("#create-list-error").html(a.message):m.ueLogError&&m.ueLogError({message:"Redesigned Create List failed.",logLevel:"FATAL"})},f=function(a){a&&!a.hasError?a.htmlMessage?(e("#create-list-loading").addClass("aok-hidden"),
e("#create-list-form").parent().append(a.htmlMessage)):b():b()};a.declarative("create-list-submit",["click"],function(a){g.submitCreate(a,f,b)})})});
/* ******** */
(function(l){var e=window.AmazonUIPageJS||window.P,r=e._namespace||e.attributeErrors,c=r?r("GenericRegistryDPXAssets",""):e;c.guardFatal?c.guardFatal(l)(c,window):c.execute(function(){l(c,window)})})(function(l,e,r){"use strict";l.when("A","a-modal").register("add-to-br-util",function(c,l){function q(d){var n=encodeURIComponent(f("#ASIN").val());d=encodeURIComponent(d.sessionId);var p={};p.asin=n;p.sid=d;c.post("/baby-reg/button-action/atbr-dpx/ref\x3ddpx_atbr_dsk",{params:p,timeout:5E3,success:function(c){e.location.href=
c!==r&&"failure"!==c.result?"/baby-reg/huc/ref\x3ddpx_atbr_dsk_huc?asin\x3d"+n+"\x26dup\x3d"+("duplicate"===c.result?!0:!1):"/baby-reg/ref\x3ddpx_atbr_dsk_hp?asin\x3d"+n},error:function(){e.location.href="/baby-reg/ref\x3ddpx_atbr_dsk_er?asin\x3d"+n}})}var f=c.$;c.state("atbrState");c.declarative("dpx-add-to-baby-registry-action",["click"],function(d){c.state.parse();d=c.state("atbrState");var n=d.hasBabyReg||!1,p="true"===f("#is-fully-selected-baby-reg").val()||!1,g=encodeURIComponent(f("#ASIN").val());
g!==r&&p&&(p=encodeURIComponent(d.sessionId),n?q(d):e.location.href="/baby-reg/signup/ref\x3ddp_create_br_desktop?asin\x3d"+g+"\x26sessionId\x3d"+p)})});"use strict";l.when("A","a-button","a-modal","ready").register("dpx-modal-add-to-wr-declarative-actions",function(c,l,q){var f=c.$,d=c.state("modal-add-to-wedding-registry-status");if(d&&d.weddingButtonId&&f("#"+d.weddingButtonId).length){var n={name:"wr-modal-add-to-reg-wedding-registry",header:d.modalHeader,url:""};f(document).delegate("#"+d.weddingButtonId,
"click",function(c){c.preventDefault();if(d.userSignedIn){var g=f("#quantity").val();g||(g=1);c=q.create(f("#"+d.weddingButtonId),n);var m=encodeURIComponent(f("#ASIN").val()),g=encodeURIComponent(g);d.hasWeddingRegistry?(c.update({cache:!1,url:"/wedding/modal/external-add-to-registry?asin\x3d"+m+"\x26quantity\x3d"+g+"\x26ref_\x3dhit_wr_dp_dp_mdl_pop"}).show(),"undefined"!==typeof e.ue&&e.ue.count("wrAddToRegModalPopup",(e.ue.count("wrAddToRegModalPopup")||0)+1)):e.location.href="/wedding/new-registry?asin."+
m+"\x3d"+g+"\x26vendorId\x3dgr-dpx-new-reg\x26associateId\x3d\x26associateSubId\x3d"}else e.location.href="/wedding/nosignin"});c.declarative("wr-modal-add-to-reg-rec-add-to-registry-action","click",function(d){var g=d.data;d=f("#wr-modal-add-to-reg-wrapper").data("token");var m=l("#wr-modal-add-to-reg-add-to-wr-"+g.recItemAsin);m.isEnabled()&&(m.disable(),!0===f("#wr-modal-add-to-reg-rec-product-card-"+g.recItemAsin).data("exist-in-registry")?(m.hide(),f("#wr-modal-add-to-reg-item-exist-message-"+
g.recItemAsin).removeClass("aok-hidden")):(d={items:JSON.stringify([{asin:g.recItemAsin,requestedQuantity:1}]),token:d},c.post("/wedding/registry-items/addItems?ref_\x3dhit_wr_dp_dp_mdl_sa",{params:d,contentType:"application/x-www-form-urlencoded; charset\x3dUTF-8",success:function(c){m.hide();c.success?f("#wr-modal-add-to-reg-item-added-message-"+g.recItemAsin).removeClass("aok-hidden"):"ITEM_ALREADY_EXIST"===c.errorCode?f("#wr-modal-add-to-reg-item-exist-message-"+g.recItemAsin).removeClass("aok-hidden"):
f("#wr-modal-add-to-reg-item-added-error-"+g.recItemAsin).removeClass("aok-hidden")},error:function(){f("#wr-modal-add-to-reg-item-added-error-"+g.recItemAsin).removeClass("aok-hidden");"undefined"!==typeof e.ue&&e.ue.count("wrAddToRegModalAddFromSimilaritiesError",(e.ue.count("wrAddToRegModalAddFromSimilaritiesError")||0)+1)}})),"undefined"!==typeof e.ue&&e.ue.count("wrAddToRegModalAddFromSimilarities",(e.ue.count("wrAddToRegModalAddFromSimilarities")||0)+1))});c.on("a:popover:beforeHide:wr-modal-add-to-reg-wedding-registry",
function(){"undefined"!==typeof e.ue&&e.ue.count("wrAddToRegModalDismissed",(e.ue.count("wrAddToRegModalDismissed")||0)+1)});c.declarative("wr-modal-add-to-reg-view-registry-action","click",function(c){"undefined"!==typeof e.ue&&e.ue.count("wrAddToRegModalViewRegistry",(e.ue.count("wrAddToRegModalViewRegistry")||0)+1);e.location.href="/wedding/organize-registry?ref_\x3dhit_wr_dp_dp_mdl_vr"})}});"use strict";l.when("A","a-button","a-modal","a-dropdown","a-splitdropdown","ready").register("ggr-add-to-registry-desktop-util",
function(c,l,q,f,d){function n(a){var b=h(k.registryItemTemplate).html(),b=b.replace("{img-tag}",'\x3cimg alt\x3d"{registryName}" src\x3d"{imageUrl}" class\x3d"atwl-hz-dd-image"\x3e'),c={registryType:a.typeText,registryName:a.name,imageUrl:a.imageUrl};return b.replace(/\{([\w]*)\}/g,function(b,e){b=c[e];if("undefined"!==typeof b&&null!==b)a=b;else return"";return a})}function p(){var a=[],b=c.state("modal-add-to-registry-dropdown-state");h.each(b.registryList,function(b,c){a.push(c.registryType)});
b={dataType:"json",url:"/registries/dpx/desktop/list-registry?"+h.param({alreadyHave:a,defaultType:b.defaultType},!0),cache:!1,success:g,error:m};h.ajax(b)}function g(a){c.state("modal-add-to-registry-dropdown-state");var b;if("object"===typeof a)b=a.result;else try{b=c.parseJSON(a)}catch(e){m();return}h.isArray(b)?(f.getSelect("add-to-registry-button").getOption(0).remove(),h.each(b,function(b,a){f.getSelect("add-to-registry-button").addOption({html_content:n(a),text:w(a.name),value:a.type+":ID\x3d"+
a.id},b)}),f.getSelect("add-to-registry-button").addOption({html_content:h("#gr-create-a-registry-item").html(),text:"Create a Registry",value:"New:ID\x3dDUMMY"},b.length)):m();h(k.spinnerWrapper).addClass("aok-hidden");h("#add-to-registry-button-announce").length?h("#add-to-registry-button-announce")[0].click():h("#add-to-registry-button")[0].click()}function m(){h(k.spinnerWrapper).addClass("aok-hidden");h(k.ajaxError).removeClass("aok-hidden")}function v(a){var b=c.state("modal-add-to-registry-dropdown-state"),
d=h("#quantity").val();d||(d=1);if(-1!==a.value.indexOf(":ID")){var f=a.value.substr(0,a.value.indexOf(":ID"));a=a.value.substr(a.value.indexOf(":ID")+3+1);var g=encodeURIComponent(h("#ASIN").val()),d=encodeURIComponent(d);u(k.metrics.dropdownItemClicked+":"+f.toLowerCase());if("Wedding"===f)if(b.hasWeddingRegistry){var b={name:k.popoverModalName,header:b.weddingModalHeader,url:""},t=q.get(b.name);t||(t=q.create(h("#GR-DROPDOWN-MODAL-TRIGGER"),b));t.update({header:b.header,cache:!1,url:"/wedding/modal/external-add-to-registry?asin\x3d"+
g+"\x26quantity\x3d"+d+"\x26ref_\x3dhit_wr_dp_dp_mdl_pop\x26sourceVendorId\x3damazon.wedding_registry.add.dpx.desktop"}).show()}else e.location.href="/wedding/new-registry?asin."+g+"\x3d"+d+"\x26vendorId\x3damazon.wedding_registry.add.dpx.desktop\x26associateId\x3d\x26associateSubId\x3d";else"Baby"===f?(f=c.state("modal-add-to-registry-dropdown-state"),a=f.hasBabyRegistry||!1,g=encodeURIComponent(h("#ASIN").val()),b=encodeURIComponent(f.sessionId),a?x(f):e.location.href="/baby-reg/signup/ref\x3ddp_create_br_desktop?asin\x3d"+
g+"\x26sourceVendorId\x3damazon.ggr.baby.add.dpx.desktop\x26sessionId\x3d"+b):"New"===f?e.location.href="/registries?ref\x3ddpx_create_registry_desktop\x26sessionId\x3d"+b.sessionId:b.hasGenericGiftRegistries?(b={name:k.popoverModalName,header:{Birthday:b.birthdayModalHeader,Custom:b.customModalHeader}[f],url:""},(t=q.get(b.name))||(t=q.create(h("#GR-DROPDOWN-MODAL-TRIGGER"),b)),t.update({header:b.header,cache:!1,url:"/registries/dpx-add-to-registry/"+f.toLowerCase()+"/"+a+"?asin\x3d"+g+"\x26quantity\x3d"+
d+"\x26ref_\x3dgr_ggr_dpx_mdl_pop\x26sourceid\x3damazon.ggr.add.dpx.desktop"}).show()):e.location.href="/registries/"+f.toLowerCase()+"/create?asin\x3d"+g+"\x26quantity\x3d"+d+"\x26sourceVendorId\x3damazon.ggr.add.dpx.desktop\x26ref_\x3dgr-dpx-"+f.toLowerCase()+"-reg"}}function w(a){var b=document.createElement("textarea");b.innerHTML=a;return b.value}function x(a){var b=encodeURIComponent(h("#ASIN").val());a=encodeURIComponent(a.sessionId);var d={};d.asin=b;d.sid=a;d.sourceVendorId="amazon.ggr.baby.add.dpx.desktop";
c.post("/baby-reg/button-action/atbr-dpx/ref\x3ddpx_atbr_dsk",{params:d,timeout:5E3,success:function(a){e.location.href=a!==r&&"failure"!==a.result?"/baby-reg/huc/ref\x3ddpx_atbr_dsk_huc?asin\x3d"+b+"\x26dup\x3d"+("duplicate"===a.result):"/baby-reg/ref\x3ddpx_atbr_dsk_hp?asin\x3d"+b},error:function(){e.location.href="/baby-reg/ref\x3ddpx_atbr_dsk_er?asin\x3d"+b}})}function u(a){"undefined"!==typeof e.ue&&(a=k.metrics.deviceType+":"+a,e.ue.count(a,(e.ue.count(a)||0)+1))}var h=c.$;if(d=c.state("modal-add-to-registry-dropdown-state")){var k=
{popoverModalName:"wr-modal-add-to-reg-wedding-registry",registryItemTemplate:"#gr-registry-item-template",addToRegistryButton:"#add-to-registry-button",modalAlreadyExist:".gr-already-exist-message",modalAddSuccess:".gr-add-success-message",modalAddError:".gr-add-error-message",ajaxError:"#gr-dd-error-holder",spinnerWrapper:"#gr-spinner-wrapper",metrics:{deviceType:"desktop",dropdownClicked:"dpx-ggr-dropdown-clicked",dropdownItemClicked:"dpx-ggr-dropdown-item-clicked",similarityClicked:"dpx-ggr-dropdown-similarity-clicked"}};
c.declarative("gr-nosignin-button-action","click",function(a){a=encodeURIComponent(e.location.href);e.location.href="/registries/product/nosignin?originURL\x3d"+a});c.on("a:dropdown:"+d.dropdownButtonId+":select",function(a){v(a)});c.on("a:splitdropdown:"+d.dropdownButtonId+":select",function(a){v(a)});h(document).delegate(".gr-modal-add-to-reg-rec-add-to-registry-action","click",function(a){var b=h(a.currentTarget);a=b.attr("data-asin");var d=b.data("type"),e=h("#gr-modal-add-to-reg-wrapper").data("token"),
f=l("#gr-modal-add-to-reg-add-to-wr-"+a);f.isEnabled()&&(f.disable(),!0===b.data("exist")?(f.hide(),b.find(k.modalAlreadyExist).removeClass("aok-hidden")):d&&"Wedding"!==d?(a={asin:a,desiredQuantity:1,registryId:b.data("id"),registryType:b.data("type"),itemType:"AMAZON_ITEM",vendorId:"amazon.ggr.add.dpx.desktop",token:e},c.post("/registries/registry-products/addProduct",{params:a,contentType:"application/x-www-form-urlencoded; charset\x3dUTF-8",success:function(a){f.hide();a.success?b.find(k.modalAddSuccess).removeClass("aok-hidden"):
"ITEM_ALREADY_EXIST"===a.errorCode?b.find(k.modalAlreadyExist).removeClass("aok-hidden"):b.find(k.modalAddError).removeClass("aok-hidden")},error:function(){f.hide();b.find(k.modalAddError).removeClass("aok-hidden")}})):(a={items:JSON.stringify([{asin:a,requestedQuantity:1}]),token:e},c.post("/wedding/registry-items/addItems?ref_\x3dhit_wr_dp_dp_mdl_sa",{params:a,contentType:"application/x-www-form-urlencoded; charset\x3dUTF-8",success:function(a){f.hide();a.success?b.find(k.modalAddSuccess).removeClass("aok-hidden"):
"ITEM_ALREADY_EXIST"===a.errorCode?b.find(k.modalAlreadyExist).removeClass("aok-hidden"):b.find(k.modalAddError).removeClass("aok-hidden")},error:function(){b.find(k.modalAddError).removeClass("aok-hidden")}})),u(k.metrics.similarityClicked))});f.getSelect(k.addToRegistryButton)&&f.getSelect(k.addToRegistryButton).update({status:"normal"});h(k.addToRegistryButton).one("click",function(a){h(k.spinnerWrapper).removeClass("aok-hidden");setTimeout(p,0);u(k.metrics.dropdownClicked);return!1});c.declarative("gr-modal-add-to-reg-view-registry-action",
"click",function(a){e.location.href=a.data&&a.data.type&&a.data.id?"/registries/"+a.data.type.toLowerCase()+"/owner-view?registryId\x3d"+a.data.id+"\x26ref_\x3dhit_gr_from_dpx":"/wedding/organize-registry?ref_\x3dhit_wr_dp_dp_mdl_vr"})}})});
/* ******** */
(function(l){var k=window.AmazonUIPageJS||window.P,e=k._namespace||k.attributeErrors,n=e?e("GoldboxUDPAssets",""):k;n.guardFatal?n.guardFatal(l)(n,window):n.execute(function(){l(n,window)})})(function(l,k,e){(function(){function e(b){c.push(b)}function a(b){return-1<c.indexOf(b)}var c=[];k.gb=k.gb||{};k.gb.sharedModuleRegistry=k.gb.sharedModuleRegistry||{register:e,isRegistered:a}})();gb.sharedModuleRegistry.isRegistered("gb-csm-ajax-metric-logger")||(gb.sharedModuleRegistry.register("gb-csm-ajax-metric-logger"),
l.register("gb-csm-ajax-metric-logger",function(){function e(b){a[b]||(a[b]=0);return b+c.SEPARATOR+ ++a[b]}var a={},c={ID:"id",CLICK_TIME:"tc",START_TIME:"t0",CRITICAL_FEATURE:"cf",BODY_END:"be",PAGE_LOAD:"ld",REQUEST_ID:"x-amz-rid",SEPARATOR:"-"};return function(b){var a=e(b);return{recordStart:function(){"function"===typeof uet&&uet(c.CLICK_TIME,a);return this},recordComplete:function(b){"function"===typeof ues&&(b=b&&b.getResponseHeader&&b.getResponseHeader(c.REQUEST_ID)?b.getResponseHeader(c.REQUEST_ID):
!1,ues(c.ID,a,b),ues(c.START_TIME,a,new Date));return this},recordFeatureComplete:function(){"function"===typeof uet&&(uet(c.CRITICAL_FEATURE,a),uet(c.BODY_END,a));return this},publishAjaxMetrics:function(){"function"===typeof uex&&uex(c.PAGE_LOAD,a);return this}}}}));gb.sharedModuleRegistry.isRegistered("gb-csm-counter-metrics")||(gb.sharedModuleRegistry.register("gb-csm-counter-metrics"),l.register("gb-csm-counter-metrics",function(){function e(b,a){if(b&&k.ue&&ue.count)return ue.count(b,a)}function a(b){var a;
a=b&&k.ue&&ue.count?ue.count(b)||0:void 0;e(b,a+1)}function c(b,a){e(b+":time",a)}var b={};return{incrementCounter:a,recordLatency:c,recordImageMetricMarker:function(b,g,f){var e="ImgLoad";f&&(e+=":"+f);switch(b){case "load":a(e+":success");if(b=parseInt(g.getAttribute("data-render-start"),10))b=(new Date).getTime()-b,c(e,b);break;case "error":a(e+":error")}},recordMaxPageDepthReached:function(a,c){var f="widgetPageDepth";gb.widgets&&a&&gb.widgets[a]&&gb.widgets[a].viewPortManager&&!isNaN(gb.widgets[a].viewPortManager.subnavPage)&&
(f+=":SN:"+gb.widgets[a].viewPortManager.subnavPage);b[f]&&b[f]>=c||(b[f]=c,e(f,c))}}}));gb.sharedModuleRegistry.isRegistered("gb-csm-error-logger")||(gb.sharedModuleRegistry.register("gb-csm-error-logger"),l.register("gb-csm-error-logger",function(){function e(a,c,b){var d=k.ueLogError;d&&d(c,{logLevel:a,attribution:"GoldboxMobileAssets",message:b||""})}return{logError:function(a,c){e("ERROR",a,c)},logWarning:function(a,c){e("WARN",a,c)},logFatal:function(a,c){e("FATAL",a,c)}}}));gb.sharedModuleRegistry.isRegistered("gb-csm")||
(gb.sharedModuleRegistry.register("gb-csm"),l.when("gb-csm-ajax-metric-logger","gb-csm-counter-metrics","gb-csm-error-logger").register("gb-csm",function(e,a,c){return{getAjaxMetricLogger:e,counterMetricLogger:a,errorLogger:c}}));l.when("A").register("gb-udp-event-emitter",function(e){return e.createClass({init:function(){this._events=this._events||{}},on:function(a,c){this._events[a]=this._events[a]||[];this._events[a].push(c)},off:function(a,c){!1!==a in this._events&&this._events[a].splice(this._events[a].indexOf(c),
1)},trigger:function(a){if(!1!==a in this._events)for(var c=0;c<this._events[a].length;c++)this._events[a][c].apply(this,Array.prototype.slice.call(arguments,1))}})});l.when("A").execute("gb-udp-deal-resources",function(n){k.GBResources||function(){k.GBResources=new function(a,c){if(c===e)for(var b in c)a[b]=c[b];c=a&&a.__init__||function(){};c.prototype=a;return c}({__init__:function(a){this.strings={};this.images={};this.features={};this.customerData={};this.categories=[];this.dealDebug=!1;this.loadedUrls=
{};this.amznMerchantID=this.preload_img_div=null;this.nodeIdToCategoryMap={};this.apiConfigs={};this.registered={};null!=a&&(a.strings&&this.registerStrings(a.strings),a.images&&this.registerImages(a.images),a.features&&this.registerFeatures(a.features),a.apiConfigs&&this.registerApiConfigs(a.apiConfigs))},registerStrings:function(a){this.registerResources(this.strings,a)},registerApiConfigs:function(a){this.registerResources(this.apiConfigs,a)},getString:function(a,c){if(!(a in this.strings))return this.log('StringId "'+
a+'" does not exist in the strings repository.'),"";a=""+this.strings[a];if(null==c)return a;for(var b in c)a=a.replace(new RegExp("\\${"+b+"}","g"),c[b]);return a},registerImages:function(a){this.registerResources(this.images,a);for(var c in this.images)this.preloadImage(this.images[c])},preloadImage:function(a){this.preload_img_div||(this.preload_img_div=this.div({style:"display:none"}));this.preload_img_div.appendChild(this.img({src:a}))},getImage:function(a){return this.images[a]},registerFeatures:function(a){this.registerResources(this.features,
a)},getFeature:function(a){return this.features[a]},registerCustomerData:function(a){this.registerResources(this.customerData,a)},getCustomerData:function(a){return this.customerData[a]},getApiConfigs:function(a){return this.apiConfigs[a]},registerResources:function(a,c){if(null!==c&&null!==a)for(var b in c)a[b]=c[b]},setDealDebug:function(a){this.dealDebug=a},getDealDebug:function(){return this.dealDebug},registerFromJSON:function(a){a.GBStrings&&this.registerStrings(a.GBStrings);a.GBImages&&this.registerImages(a.GBImages);
a.GBWeblabs&&this.registerFeatures(a.GBWeblabs);a.GBCustomerData&&this.registerCustomerData(a.GBCustomerData);a.GBWidgetName&&this.registerFeatures(a.GBWidgetName);a.GBZone&&this.registerFeatures(a.GBZone);a.GBDealDebug&&this.setDealDebug(a.GBDealDebug)},img:function(a){a=a||{};a.border=a.border||0;return this.el("img",a)},div:function(a,c){return this.el("div",a,c)},el:function(a,c,b){a=document.createElement(a);c&&this.set_attributes(a,c);b&&this.appendChildren(a,b);return a},set_attributes:function(a,
c){for(var b in c)"style"==b?a.style.cssText=c[b]:a[{"class":"className",checked:"defaultChecked",usemap:"useMap","for":"htmlFor",readonly:"readOnly",colspan:"colSpan",bgcolor:"bgColor",cellspacing:"cellSpacing",cellpadding:"cellPadding",valign:"vAlign",nowrap:"noWrap"}[b]||b]=c[b]},log:function(a){a=new Date+": "+a;k.console&&k.console.log(a)},getParamValueFromUrl:function(a,c){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");return(a=(new RegExp("[\\?\x26]"+a+"\x3d([^\x26#]*)")).exec(c))?k.decodeURIComponent(a[1].replace(/\+/g,
" ")):""}})}();k.P&&k.P.AUI_BUILD_DATE&&(k.gbResources||(k.gbResources=new GBResources),k.gbRegistered=k.gbRegistered||{},k.gbResources.registered=k.gbResources.registered||{},k.gbRegistered.dealResources||k.gbResources.registered.dealResources||(k.gbRegistered.dealResources=!0,k.gbResources.registered.dealResources=!0,l.register("dealResources",function(){return k.GBResources})))});l.when("A").execute("gb-udp-widget-common",function(n){k.Deal||function(){k.Deal={};Deal.availableStr="Available";Deal.inCartStr=
"InCart";Deal.claimedStr="Claimed";Deal.expiredStr="Expired";Deal.waitInLineStr="WaitInLine";Deal.pendingAtcStr="PendingAddToCart";Deal.min=function(a){for(var c=arguments[0],b=1;b<arguments.length;b++)arguments[b]<c&&(c=arguments[b]);return c};Deal.max=function(a){for(var c=arguments[0],b=1;b<arguments.length;b++)arguments[b]>c&&(c=arguments[b]);return c};Deal.sortByAsinTimes=function(a,c){return a.status.purchaseStatus.expiresDate-c.status.purchaseStatus.expiresDate};Deal.filterAsinsByState=function(a,
c){for(var b=[],d=0;d<a.length;d++)for(var g=a[d],f=0;f<c.length;f++)if(g.status.purchaseStatus.state==c[f]){b.push(g);break}return b};Deal.stateAlertsEnum={ATC_EXPIRES_SOON:0,ATC_EXPIRED:1,WL_PATC:2,WL_PATC_EXPIRED:3,WL_SOLD_OUT:4,WL_DEAL_ENDED:5};Deal.pStateTypeEnum={CART:0,WAITLIST:1,EITHER:2,NO_ACTION:3};Deal.accessTypeEnum={PRIME_EARLY_ACCESS:"PRIME_EARLY_ACCESS",PRIME_ONLY_LD:"PRIME_ONLY_LD",PRIME_ONLY_DOTD:"PRIME_ONLY_DOTD",APP_EARLY_ACCESS:"APP_EARLY_ACCESS",APP_ONLY_LD:"APP_ONLY_LD"};Deal.pStateTypeMap=
{};Deal.pStateTypeMap[Deal.availableStr]=Deal.pStateTypeEnum.NO_ACTION;Deal.pStateTypeMap[Deal.inCartStr]=Deal.pStateTypeEnum.CART;Deal.pStateTypeMap[Deal.claimedStr]=Deal.pStateTypeEnum.NO_ACTION;Deal.pStateTypeMap[Deal.expiredStr]=Deal.pStateTypeEnum.EITHER;Deal.pStateTypeMap[Deal.waitInLineStr]=Deal.pStateTypeEnum.WAITLIST;Deal.pStateTypeMap[Deal.pendingAtcStr]=Deal.pStateTypeEnum.WAITLIST;Deal.Class=function(a,c){if(c===e)for(var b in c)a[b]=c[b];c=a&&a.__init__||function(){};c.prototype=a;return c};
Deal.Signal={methods:["connect","disconnectAll","signal"],init:function(a){var c,b;if(a.__signals__)throw Error("already registered");if(a.signals===e)throw Error("expected 'signals' attribute");for(c=0;c<this.methods.length;c++)if(b=this.methods[c],a[b]!==e)throw Error("method "+b+" is already defined");a.__signals__={};for(c=0;c<a.signals.length;c++)a.__signals__[a.signals[c]]={};for(c=0;c<this.methods.length;c++)b=this.methods[c],a[b]=this[b]},next_id:100,connect:function(a,c,b){var d=this;if(d.__signals__[a]===
e)throw Error("no such signal "+a);var g=Deal.Signal.next_id++,f={signals:["disconnect"],disconnect:function(){delete d.__signals__[a][g];this.signal("disconnect");this.disconnect=function(){}}};if(c instanceof Function)f.trigger=c;else{if(c[b]===e)throw Error("method '"+b+"' for obj "+c+" doesn't exist");if(!c[b]instanceof Function)throw Error("method '"+b+"' for obj "+c+" isn't a Function");f.trigger=function(){c[b].apply(c,arguments)}}d.__signals__[a][g]=f;Deal.Signal.init(f);return f},disconnectAll:function(a){var c;
if(a){if(this.__signals__[a]===e)throw Error("no such signal "+a);for(var b in this.__signals__[a])this.__signals__[a][b].disconnect()}else for(c in this.__signals__)this.disconnectAll(c)},signal:function(a){if(this.__signals__[a]===e)throw Error("no such signal "+a);var c=[],b=1;1==arguments.length&&(b=0);for(b;b<arguments.length;b++)c.push(arguments[b]);var b=[],d;for(d in this.__signals__[a]){var g=this.__signals__[a][d];try{g.trigger.apply(g,c)}catch(f){b.push(f)}}if(1<b.length)throw c=Error("multiple errors. See 'errors'"),
c.errors=b,c;if(1==b.length)throw b[0];}};Deal.Model={};Deal.Model.Metadata=Deal.Class({__init__:function(a,c){this.filters=a;for(var b in this.filters){a=this.filters[b];this.filters[b]={};for(var d=0;d<a.length;d++)this.filters[b][a[d]]=!0}this.orderings=c},get_deal_ids:function(a,c){a=this.filters[a];c=c?this.orderings[c]:[];var b=[],d={},g,f;for(g=0;g<c.length;g++)f=c[g],d[f]=!0,a[f]&&b.push(f);for(f in a)d[f]||b.push(f);return b}});Deal.Model.Deals=Deal.Class({__init__:function(a){this.deals=
{};for(var c=0;c<a.length;c++){var b=a[c];this.get_deal(b.dealID).load_from_deal(b)}},get_deal:function(a){this.deals[a]===e&&(this.deals[a]=new Deal.Model.Deal(a));return this.deals[a]}});Deal.Model.Deal=Deal.Class({signals:["change","expire","status_expire","pstatus_expires_soon","pstatus_expire"],__init__:function(a){Deal.Signal.init(this);this.dealID=a;this.timeouts={};this.expired=this.loading=!0;this.status={expired:!0};this.detail={};this.asins=[];this.asinExpiresSoonStack=[];this.asinExpiredStack=
[];this.purchaseStatusWarningThreshold=6E5},_init_status:function(a){var c=this;c.status.cacheExpiresDate=new Date(a.getTime()+parseInt(c.status.msToCacheExpires,10));c.status.expired=!1;c.status.startDate=new Date(a.getTime()+parseInt(c.status.msToStart,10));c.status.started=0>=c.status.msToStart;c.status.endDate=new Date(a.getTime()+parseInt(c.status.msToEnd,10));c.status.ended=0>=c.status.msToEnd;c.timeouts.start_timeout&&k.clearTimeout(c.timeouts.start_timeout);c.status.started||(c.timeouts.start_timeout=
n.delay(function(){c.status.started=!0;c.signal("change",c)},c.status.startDate.getTime()-(new Date).getTime()));c.timeouts.end_timeout&&k.clearTimeout(c.timeouts.end_timeout);c.status.ended||(c.timeouts.end_timeout=n.delay(function(){c.status.ended=!0;c.signal("change",c)},c.status.endDate.getTime()-(new Date).getTime()));c.timeouts.status_expire_timeout&&k.clearTimeout(c.timeouts.status_expire_timeout);c.timeouts.status_expire_timeout=n.delay(function(){c.status.expired=!0;c.signal("status_expire",
c)},c.status.cacheExpiresDate.getTime()-(new Date).getTime())},_init_asin_statuses:function(){var a=this;if(a.asins){for(var c=new Date,b=Deal.filterAsinsByState(a.asins,[Deal.inCartStr,Deal.expiredStr,Deal.waitInLineStr,Deal.pendingAtcStr]),d=0;d<b.length;d++){var g=b[d];a.purchaseStatusWarningThreshold&&(g.status.purchaseStatus.expiresDate=new Date(c.getTime()+parseInt(g.status.purchaseStatus.msToExpiry,10)))}b.sort(Deal.sortByAsinTimes);a.asinExpiresSoonStack=[];a.asinExpiredStack=[];for(d=0;d<
b.length;d++){g=b[d];a.timeouts.pstatus_exp_soon[g.asin]&&k.clearTimeout(a.timeouts.pstatus_exp_soon[g.asin]);var c=g.status.purchaseStatus.expiresDate.getTime()-(new Date).getTime(),f=c-a.purchaseStatusWarningThreshold;0>f&&(f=0);var e=""+g.asin;0<c&&g.status.purchaseStatus.state!=Deal.waitInLineStr&&g.status.purchaseStatus.state!=Deal.pendingAtcStr&&(a.asinExpiresSoonStack.push(e),a.timeouts.pstatus_exp_soon[e]=n.delay(function(){var b=a.asinExpiresSoonStack.shift();a.signal("pstatus_expires_soon",
a,b)},f));a.timeouts.pstatus_expire[g.asin]&&k.clearTimeout(a.timeouts.pstatus_expire[g.asin]);a.asinExpiredStack.push(e);a.timeouts.pstatus_expire[g.asin]=n.delay(function(){var b=a.asinExpiredStack.shift();a.signal("pstatus_expire",a,b);a.signal("change",a)},c)}}else Deal.log("No Asins, not initializing statuses.")},load_from_deal:function(a){var c=this,b=new Date,d;for(d in a)c[d]=a[d];c.loading=!1;c.startDate=new Date(1E3*c.startDate);c.endDate=new Date(1E3*c.endDate);c.cacheExpiresDate=new Date(b.getTime()+
parseInt(c.msToCacheExpires,10));c.expired=!1;c.timeouts.expire_timeout&&k.clearTimeout(c.timeouts.expire_timeout);c.timeouts.expire_timeout=n.delay(function(){c.expired=!0;c.signal("expire",c)},c.cacheExpiresDate.getTime()-(new Date).getTime());c.limitedQuantity="1"==c.limitedQuantity;c.customer&&(c.customer.claimed="1"==c.customer.claimed);if(c.asins)for(c.timeouts.pstatus_exp_soon||(c.timeouts.pstatus_exp_soon={}),c.timeouts.pstatus_expire||(c.timeouts.pstatus_expire={}),a=0;a<c.asins.length;a++)c.asins[a].offerServiceSoldOut=
"1"==c.asins[a].offerServiceSoldOut;c._init_status(b);c._init_asin_statuses();c.signal("change",c)},load_from_status:function(a){this.status=a;this._init_status(new Date);this.signal("change",this)},load_from_asin_status:function(a){if(null!=this.asins&&null!=a){for(var c=a.asin,b=0;b<this.asins.length;b++)if(this.asins[b].asin==c){this.asins[b].status=a;break}this._init_asin_statuses();this.signal("change",this)}},setPurchaseStatusWarningThreshold:function(a){self.purchaseStatusWarningThreshold=
0<a?a:12E4},getPurchaseStatusWarningThreshold:function(){return this.purchaseStatusWarningThreshold},load_from_deal_dao:function(a){this.loading=!1;this.marketplaceID=a.detail.marketplaceID;null!==a.auxiliaryData.merchantDetails&&a.auxiliaryData.merchantDetails!==e&&(this.merchantID=a.auxiliaryData.merchantDetails.merchantID,this.merchantName=a.auxiliaryData.merchantDetails.merchantName);var c=a.auxiliaryData.reviewData;c&&(this.reviews={},this.reviews.URL=c.reviewsURL,this.reviews.total=c.totalReviews,
this.reviews.rating=c.averageRating);this.dealID=a.dealID;this.startDate=a.status.startDate;this.endDate=a.status.endDate;this.limitedQuantity=a.isLimitedQuantity;this.parentAsin=a.parentAsin;this.msToCacheExpires=a.status.msToCacheExpires;this.cacheExpiresDate=a.status.cacheExpiresDate;this.expired=a.expired;this.status={marketplaceID:a.detail.marketplaceID,dealID:a.dealID,percentClaimed:a.status.percentClaimed,msToStart:a.status.msToStart,startDate:a.status.startDate,started:a.status.started,msToEnd:a.status.msToEnd,
endDate:a.status.endDate,ended:a.status.ended,msToCacheExpires:a.status.msToCacheExpires,cacheExpiresDate:a.status.cacheExpiresDate,expired:a.status.expired};this.detail={marketplaceID:a.detail.marketplaceID,dealID:a.dealID,title:a.detail.title,description:a.detail.description,imageAsin:a.detail.imageAsin,url:a.detail.URL,buyBoxUrl:a.detail.buyBoxURL};this.asins=[];for(var c=a.dealAsins,b=0;b<c.length;b++){var d=c[b];this.asins.push({marketplaceID:a.detail.marketplaceID,dealID:a.dealID,asin:d.ASIN,
basisPrice:d.basisPrice,basisKind:d.basisKind,dealPrice:d.dealPrice,percentOff:d.percentOff,offerServiceSoldOut:d.status.offerServiceSoldOut,variationData:d.variationData,imageURL:d.imageURL,status:{marketplaceID:a.detail.marketplaceID,dealID:a.dealID,asin:d.ASIN,percentClaimed:d.status.percentClaimed,percentSoldOut:d.status.percentSoldOut,itemState:d.status.itemState,offerServiceSoldOut:d.status.offerServiceSoldOut,currentlyUnavailable:d.status.currentlyUnavailable,purchaseStatus:{state:d.status.state,
msToExpiry:d.status.msToExpiry}}})}this.customer={marketplaceID:a.detail.marketplaceID,dealID:a.dealID,customerID:a.customerID,claimed:a.claimed}},load_status_from_deal_dao:function(a){var c=this,b=new Date;c.load_from_deal_dao(a);c.timeouts.expire_timeout&&k.clearTimeout(c.timeouts.expire_timeout);c.cacheExpiresDate&&(c.timeouts.expire_timeout=n.delay(function(){c.expired=!0;c.signal("expire",c)},c.cacheExpiresDate.getTime()-(new Date).getTime()));c.asins&&(c.timeouts.pstatus_exp_soon||(c.timeouts.pstatus_exp_soon=
{}),c.timeouts.pstatus_expire||(c.timeouts.pstatus_expire={}));c._init_status(b);c._init_asin_statuses();c.signal("change",c)}});Deal.Controller=Deal.Class({signals:["cell_change","page_change","metadata_change"],__init__:function(a){Deal.Signal.init(this);this.login_uri=a.login_uri;this.images=a.images;this.buying={};this.deals=new Deal.Model.Deals(a.deals);this.metadata=new Deal.Model.Metadata(a.filters,a.orderings);this.browseNodes=a.browseNodes;this.ordering=a.ordering;this.varPopCloseFunction=
null;this.connections=[];this.cells=1;this.cell_to_deal={};this.deal_id_to_cell={};this.pages=this.page=1;this.order=this.filter=e;this.deal_ids=[]},closeVarPopover:function(){this.varPopCloseFunction&&this.varPopCloseFunction()},setVarPopCloseFunction:function(a){this.closeVarPopover();this.varPopCloseFunction=a},_calc_deal_ids:function(){this.deal_ids=this.metadata.get_deal_ids(this.filter,this.order);this._calc_pages()},_calc_pages:function(){this.pages=Math.ceil(this.deal_ids.length/this.cells)},
disconnect_all:function(){for(var a=0;a<this.connections.length;a++)this.connections[a].disconnect();this.connections=[]}});Deal.DOM={set_attributes:function(a,c){for(var b in c)"style"==b?a.style.cssText=c[b]:a[{"class":"className",checked:"defaultChecked",usemap:"useMap","for":"htmlFor",readonly:"readOnly",colspan:"colSpan",bgcolor:"bgColor",cellspacing:"cellSpacing",cellpadding:"cellPadding",valign:"vAlign",nowrap:"noWrap"}[b]||b]=c[b]},el:function(a,c,b){a=document.createElement(a);c&&Deal.DOM.set_attributes(a,
c);b&&this.appendChildren(a,b);return a},img:function(a){a=a||{};a.border=a.border||0;return this.el("img",a)},div:function(a,c){return this.el("div",a,c)},span:function(a,c){return this.el("span",a,c)},p:function(a,c){return this.el("p",a,c)},a:function(a,c){return this.el("a",a,c)},table:function(a,c){a||(a={});a.cellpadding=a.cellpadding||0;a.cellspacing=a.cellspacing||0;a.border=a.border||0;return this.el("table",a,[this.el("tbody",null,c)])},tr:function(a,c){return this.el("tr",a,c)},td:function(a,
c){return this.el("td",a,c)},td_nowrap:function(a,c){return this.el("td",a,[this.span({style:"white-space:nowrap"},c)])},br:function(a,c){return this.el("br",a,c)},hr:function(a){return this.el("hr")},select:function(a,c){return this.el("select",a,c)},option:function(a,c){return this.el("option",a,c)},appendChildren:function(a,c){for(var b=0;b<c.length;b++){var d=c[b];if("string"==typeof d||"number"==typeof d)d=this.text(d);else if(d instanceof Array){this.appendChildren(a,d);continue}else if(null===
d||d===e)continue;a.appendChild(d)}},clearChildren:function(a){for(;a.firstChild;)a.removeChild(a.firstChild)},replaceChildren:function(a,c){this.clearChildren(a);this.appendChildren.call(this,a,c)},text:function(a){return document.createTextNode(a)}};Deal.Widget={};Deal.Widget.preload_img=function(a){Deal.Widget.preload_img.div||(Deal.Widget.preload_img.div=Deal.DOM.div({style:"display:none"}));Deal.Widget.preload_img.div.appendChild(Deal.DOM.img({src:a}))};Deal.clock={signals:["tick"]};Deal.Signal.init(Deal.clock);
Deal.clock.tick=function(){Deal.clock.signal("tick")};n.interval(Deal.clock.tick,250)}()});l.when("A").execute("gb-udp-utilities",function(n){Deal.constants={WIDGET_ID_START:100,GET_DEALS_MAX_JITTER:2,NON_RETRYABLE_QUANTITY_RESTRICTION_VIOLATION_ERROR:"4002"};Deal.rankingStrategies={PERSONALIZED:"PERSONALIZED",CLAIMED_RATE:"CLAIMED_RATE",TRENDING:"TRENDING",NEW_TO_GL_EXCLUSIVE:"NEW_TO_GL_EXCLUSIVE",NEW_TO_GL_INCLUSIVE:"NEW_TO_GL_INCLUSIVE"};Deal.statusFilters={AVAILABLE:"available",UPCOMING:"upcoming",
MISSED:"missed"};Deal.availableStr="Available";Deal.inCartStr="InCart";Deal.claimedStr="Claimed";Deal.expiredStr="Expired";Deal.waitInLineStr="WaitInLine";Deal.waitlistFullStr="WaitlistFull";Deal.pendingAtcStr="PendingAddToCart";Deal.dealTypes={BD:"BEST_DEAL",LD:"LIGHTNING_DEAL",DOTD:"DEAL_OF_THE_DAY",LOCAL:"LOCAL_DEAL",COUPON:"COUPON_DEAL"};Deal.savingsBasisKind={LIST_PRICE:"LP",OUR_PRICE:"OP",PREV_PUBLISHED_PRICE:"PPP",UVP_LIST_PRICE:"ULP",ORIGINAL_EDITION_PRICE:"OEP",RETAIL_PREV_PRICE:"REP",SEPARATE_PURCHASE_LIST_PRICE:"SPLP",
DIGITAL_LIST_PRICE:"DLP",PRINT_LIST_PRICE:"PLP",UNRECOGNIZED:"UNR"};Deal.categoryFilters={ALL:"all"};Deal.dealStateEnum={Available:1,Variation:2,WaitListed:3,WaitListFull:4,WaitListOnly:5,Claimed:6,InCart:7,PendingAddToCart:8,LearnMore:9,ClipCoupon:10,ViewDeal:11,Upcoming:12,SoldOut:13,Expired:14,InvalidPurchaseState:-1};Deal.itemTypes={SingleItem:"SINGLE_ITEM",MultiItem:"MULTI_ITEM",ContentOnly:"CONTENT_ONLY"};Deal.itemStates={Available:"AVAILABLE",Soldout:"SOLDOUT",Expired:"EXPIRED",Upcoming:"UPCOMING",
Waitlist:"WAITLISTAVAILABLE",WaitlistFull:"WAITLISTFULL",Suppressed:"SUPPRESSED"};Deal.responseItemTypeToItemType={NONE:"CONTENT_ONLY",SINGLE_ITEM:"SINGLE_ITEM",MULTI_ITEM:"MULTI_ITEM",VARIATION_ITEM:"MULTI_ITEM"};Deal.clientActions={ADD_TO_CART:"A",JOIN_WAITLIST:"J",LEARN_MORE:"L",TITLE:"T",IMAGE:"P",REVIEWS:"R",DISCUSSION_BOARD:"D",IMPRESSION:"I"};Deal.purchaseTypes={ADD_TO_CART:"add_to_cart",JOIN_WAITLIST:"join_waitlist"};Deal.stateBasedSubTemplates={available:"image price_block title checking_deal_status prime progress_bar percent_claimed prime_early_access time_remaining prime_only_access claimed reviews state variation_status_message button description total_coupons_count share_bar geo_display_location merchant_name deal_action_content deal_status_content badge fast_track".split(" "),
expired:"image price_block title prime progress_bar percent_claimed claimed reviews state button total_coupons_count merchant_name description geo_display_location deal_action_content deal_status_content badge".split(" "),soldout:"image price_block title prime progress_bar percent_claimed claimed reviews button total_coupons_count merchant_name description deal_action_content".split(" "),coming_soon:"image title merchant_name share_bar reviews prime description badge".split(" "),upcoming:"image teaser starts_in description early_access_message prime_only_message".split(" "),
loading:["checking_deal_status","available"],empty:[]};Deal.stateToTemplateMap={Available:"available",SoldOut:"soldout",Expired:"expired",Upcoming:"upcoming",Loading:"loading",ComingSoon:"coming_soon",Waitlist:"available",WaitlistFull:"available"};Deal.dealStates={AVAILABLE:"Available",SOLDOUT:"SoldOut",EXPIRED:"Expired",UPCOMING:"Upcoming",WAITLIST:"Waitlist",WAITLISTAVAILABLE:"Waitlist",WAITLISTFULL:"WaitlistFull"};Deal.customerStates={NONE:Deal.availableStr,INCART:Deal.inCartStr,CLAIMED:Deal.claimedStr,
INWAITLIST:Deal.waitInLineStr,PENDINGATC:Deal.pendingAtcStr,EXPIRED:Deal.expiredStr};Deal.itemStateToPurchaseStateMap={AVAILABLE:Deal.dealStateEnum.Available,WAITLIST:Deal.dealStateEnum.WaitListOnly,WAITLISTED:Deal.dealStateEnum.WaitListed,WAITLISTFULL:Deal.dealStateEnum.WaitListFull,WAITLISTONLY:Deal.dealStateEnum.WaitListOnly,WAITLISTAVAILABLE:Deal.dealStateEnum.WaitListOnly,UPCOMING:Deal.dealStateEnum.Upcoming,SOLDOUT:Deal.dealStateEnum.SoldOut,EXPIRED:Deal.dealStateEnum.Expired};Deal.customerStateToPurchaseStateMap=
{AVAILABLE:Deal.dealStateEnum.Available,CLAIMED:Deal.dealStateEnum.Claimed,INCART:Deal.dealStateEnum.InCart,PENDINGADDTOCART:Deal.dealStateEnum.PendingAddToCart,PENDINGATC:Deal.dealStateEnum.PendingAddToCart,INWAITLIST:Deal.dealStateEnum.WaitListed,EXPIRED:Deal.dealStateEnum.Expired};Deal.apiName={GET_DEAL_METADATA:"GetDealMetadata",GET_DEALS:"GetDeals",GET_DEAL_STATUS:"GetDealStatus",REDEEM_DEAL:"RedeemDeal",CLAIM_DEAL:"ClaimDeal"};Deal.apiShortName={GET_DEAL_STATUS:"GDS",CLAIM_DEAL:"CD"};Deal.Class=
function(a,c){if(c!==e)for(var b in c)a[b]=c[b];c=a&&a.__init__||function(){};c.prototype=a;return c};Deal.log=function(a){k.gbResources!==e&&null!==k.gbResources&&k.gbResources.getDealDebug()&&(a=new Date+": "+a,k.console&&k.console.log(a))};Deal.parseBool=function(a){return!0===a||1===a||"1"===a};Deal.getRandomNumber=function(a,c){return Math.floor(Math.random()*(c-a+1))+a};Deal.areNestedKeysPresent=function(a,c){if(!_.isObject(a)||!_.isString(c))return!1;c=c.split(".");for(var b=0;b<c.length;b++){if(!a||
!a.hasOwnProperty(c[b]))return!1;a=a[c[b]]}return!0};Deal.checkIfDealExpired=function(a){return a===e||null===a?!1:a.status!==e&&null!==a.status&&a.status.msToEnd!==e&&null!==a.status.msToEnd&&0>=a.status.msToEnd||a.status.ended!==e&&null!==a.status.ended&&a.status.ended||a.status.endDate!==e&&null!==a.status.endDate&&a.status.endDate<new Date?!0:!1};Deal.sortByAsinTimes=function(a,c){return a.status.purchaseStatus.expiresDate-c.status.purchaseStatus.expiresDate};Deal.sortByDealAsinDAOTimes=function(a,
c){return a.status.expiresDate-c.status.expiresDate};Deal.setSafeTimeout=function(a,c){return a===e||null===a||c===e||null===c?(Deal.log("Cannot setTimeout on undefined/null fn/timeout."),null):2147483647<c?n.delay(a,1073741823):n.delay(a,10)};Deal.objectsIdentical=function(a,c){return a===e||c===e?(Deal.log("Cannot check for objectsIdentical for undefined requestArgs."),!1):_.isEqual(a,c)};Deal.filterAsinsByState=function(a,c){var b=[];_.each(a,function(a){_.each(c,function(c){a.status.purchaseStatus.state===
c&&b.push(a)})});return b};Deal.filterAsinsHashByState=function(a,c){var b=[];_.each(a,function(a){_.each(c,function(c){a.status.state===c&&b.push(a)})});return b};Deal.filterDealIdsByParams=function(a,c){var b=[];if(null===a||a===e||null===c||c===e)return b;for(var d=0;d<a.length;d++){var g=a[d];g in c&&(b=_.union(b,c[g]))}return b};Deal.getPaginationCellPositions=function(a,c,b,d){var g=[];a&&c&&b&&(g=1,d||(g=Math.ceil(b/c)),g=3>=g?_.range(0,b<g*c?b:g*c):1==a?_.union(_.range(0,2*c),_.range((g-1)*
c,b)):_.range((a-2)*c,b<(a+1)*c?b:(a+1)*c));return g};Deal.getCrypticPrice=function(a){return _.isNumber(a)?a.toString().split("").map(function(a){return String.fromCharCode(a.charCodeAt(0)+17).replace("?","X")}).join(""):null};Deal.hasPricingDetails=function(a){var c=!1;a=a.pricingData.dealPriceHash.max.price||a.pricingData.dealPriceHash.min.price;a!==e&&null!==a&&(c=!0);return c};Deal.Price={currencies:{USD:{decimals:2,format:function(a){return"$"+a}},MXN:{decimals:2,format:function(a){return"$"+
a}},BRL:{decimals:2,format:function(a){return"R$ "+a}},GBP:{decimals:2,format:function(a){return"\x26pound;"+a}},EUR:{decimals:2,format:function(a){return(a+" \x26euro;").replace(".",",")}},TRY:{decimals:2,format:function(a){return(a+" TL").replace(".",",")}},JPY:{decimals:0,format:function(a){return"\x26yen; "+a}},AUD:{decimals:2,format:function(a){return"$"+a}},CNY:{decimals:2,format:function(a){return"\x26yen;"+a}},CAD:{decimals:2,format:function(a){return("C$"+a).replace(",","")}},INR:{decimals:2,
format:function(a){return"\x26#8377;"+a}},other:{decimals:2,format:function(a){return a+" "+a.currency}}},make_price:function(a,c){return{currency:a,price:c}},test_same_currency:function(a,c){if(a.currency!=c.currency)throw Error("Currencies don't match: "+a.currency+" and "+c.currency);},minus:function(a,c){if(!a||!c)return e;this.test_same_currency(a,c);return this.make_price(a.currency,a.price-c.price)},percent_off:function(a,c){if(!a||!c||null===a.price||a.price===e||null===c.price||c.price===
e||0===c.price)return null;this.test_same_currency(a,c);var b=a.price-c.price;if(0>=b)return null;c=0;"CN"==gbResources.getCustomerData("realm")?(c=1,a=10*(1-b/a.price)):a=100*b/a.price;return Math.round(a*Math.pow(10,c))/Math.pow(10,c)},displayable_percent_off:function(a){return a&&"number"===typeof a?"CN"==gbResources.getCustomerData("realm")?(100-a)/10:a:null},format:function(a,c){if(!a)return c;c=this.currencies[a.currency]||this.currencies.other;a=c.format(Deal.commify(a.price,c.decimals));c=
Deal.DOM.span();c.innerHTML=a;return c.innerText||c.textContent},getEmptyPriceHash:function(){return{price:null,formattedPrice:null,currency:null}},getEmptyPriceObject:function(){return{maxBasisPrice:Deal.Price.getEmptyPriceHash(),minBasisPrice:Deal.Price.getEmptyPriceHash(),maxDealPrice:Deal.Price.getEmptyPriceHash(),minDealPrice:Deal.Price.getEmptyPriceHash()}},isEmptyPriceObject:function(a){var c=Deal.Price.getEmptyPriceObject();return _.isEqual(a,c)?!0:!1},findMaxMinPrices:function(a,c){if(a===
e||!a)return Deal.log("Cannot findMaxMinPrices on undefined/null deal obj"),{};if(!a.dealAsinsHash)return Deal.log("Cannot operate on undefined/null dealAsinsHash"),{};var b=null,d=null,g=null,f=null,m;for(m in a.dealAsinsHash){var p=a.dealAsinsHash[m];p.basisPrice&&(null===b?b=p.basisPrice:b.price<p.basisPrice.price&&(b=p.basisPrice),null===d?d=p.basisPrice:d.price>p.basisPrice.price&&(d=p.basisPrice));p.dealPrice&&(null===g?g=p.dealPrice:g.price<p.dealPrice.price&&(g=p.dealPrice),null===f?f=p.dealPrice:
f.price>p.dealPrice.price&&(f=p.dealPrice))}a.dealAsins&&0===a.dealAsins.length&&c&&c.currencyCode&&(null!==c.maxBAmount&&c.maxBAmount!==e&&null!==c.minBAmount&&c.minBAmount!==e&&(b={price:parseFloat(c.maxBAmount),currency:c.currencyCode},d={price:parseFloat(c.minBAmount),currency:c.currencyCode}),null!==c.maxDealPrice&&c.maxDealPrice!==e&&null!==c.minDealPrice&&c.minDealPrice!==e&&(g={price:parseFloat(c.maxDealPrice),currency:c.currencyCode},f={price:parseFloat(c.minDealPrice),currency:c.currencyCode}));
a=Deal.Price.getEmptyPriceObject();null!==b&&(a.maxBasisPrice={price:b.price,currency:b.currency,formattedPrice:Deal.Price.format(b)});null!==d&&(a.minBasisPrice={price:d.price,currency:d.currency,formattedPrice:Deal.Price.format(d)});null!==g&&(a.maxDealPrice={price:g.price,currency:g.currency,formattedPrice:Deal.Price.format(g)});null!==f&&(a.minDealPrice={price:f.price,currency:f.currency,formattedPrice:Deal.Price.format(f)});return a},hasPriceData:function(a){return a===e||null===a||a.max===e||
null===a.max||a.max.price===e||null===a.max.price||a.min===e||null===a.min||a.min.price===e||null===a.min.price||a.min.price>a.max.price?!1:!0},compareTo:function(a,c){if(a===e||null===a||c===e||null===c)return Deal.log("Cannot do compareTo on undefined/null prices"),2;var b=2;try{a==c?b=0:a>c?b=1:a<c&&(b=-1)}catch(d){Deal.log("Error caught during attempting compareTo"+d)}return b},maxEqualMin:function(a){return a!==e&&a?0===Deal.Price.compareTo(a.max.price,a.min.price)?!0:!1:(Deal.log("Cannot check if an undefined/null object has pricedata."),
!1)}};Deal.commify=function(a,c){a=parseFloat(a);a=c!==e?a.toFixed(c):a.toString();a=a.split(".");c=a[0];for(var b=c.length-3;0<b;b-=3)c=c.substr(0,b)+","+c.substr(b,c.length-b);return 2==a.length?c+"."+a[1]:c};Deal.amabotParams={pf_rd_p:"placementID",pf_rd_s:"slotName",pf_rd_t:"pageType",pf_rd_i:"pageIndent",pf_rd_m:"merchantID",pf_rd_r:"requestID"};Deal.reverseMapAmabotParams={placementID:"pf_rd_p",slotName:"pf_rd_s",pageType:"pf_rd_t",pageIndent:"pf_rd_i",merchantID:"pf_rd_m",requestID:"pf_rd_r"};
Deal.addAmabotRecordClickParameters=function(a,c){if(!a||!c)return Deal.log("Cannot add amabot record click params for undefined/null uri/params."),a;var b=Deal.reverseMapAmabotParams;c.merchantID&&(a=Deal.param_appender(a,b.merchantID+"\x3d"+c.merchantID));c.pageType&&(a=Deal.param_appender(a,b.pageType+"\x3d"+c.pageType));c.slotName&&(a=Deal.param_appender(a,b.slotName+"\x3d"+c.slotName));c.requestID&&(a=Deal.param_appender(a,b.requestID+"\x3d"+c.requestID));c.pageIndent&&(a=Deal.param_appender(a,
b.pageIndent+"\x3d"+c.pageIndent));c.placementID&&(a=Deal.param_appender(a,b.placementID+"\x3d"+c.placementID));return a};Deal.getSlotRefTag=function(a){if(!a)return Deal.log("Cannot get slot ref tag for undefined/null amabotParams."),"";if(a.slotName===e||null===a.slotName)return Deal.log("Cannot get slot ref tag for undefined/null slotName."),"";a=a.slotName;return 4>a.length?a+"_":a.substring(0,1)+a.substring(a.length-2,a.length)+"_"};Deal.getPlacementID=function(a){if(!a)return Deal.log("Cannot get placement id for undefined/null amabotParams."),
"";if(a.placementID===e||null===a.placementID)return Deal.log("Cannot get placement id for undefined/null slotName."),"";a=a.placementID;return 5>a.length?a+"_":a.substring(a.length-4,a.length)+"_"};Deal.addRefTag=function(a,c){var b=/^(.*)\?(.*)$/,d=/^(.*)#(.*)$/,g=/^(.*)\/$/,f=/^(.*)$/;c="ref\x3d"+c;b.test(a)?(g="/",/.*\/\?/.test(a)&&(g=""),a=a.replace(b,"$1"+g+c+"?$2")):d.test(a)?(g="/",/.*\/#/.test(a)&&(g=""),a=a.replace(d,"$1"+g+c+"#$2")):a=g.test(a)?a.replace(g,"$1/"+c):a.replace(f,"$1/"+c);
return a};Deal.param_appender=function(a,c){if(!a||!c)return Deal.log("Cannot apend refTags for undefined/null URI/refTag"),"";var b="?";a.match(/\?/)&&(b="?"===a.charAt(a.length-1)?"":"\x26");return a+b+c};Deal.getWidgetCDSRef=function(a){var c=Deal.controller.getAmabotParams(a);a=Deal.configManager[Deal.controller.widgetIdToWidgetNameMap[a]].widgetViewConfig.clickStreamRefMarker;_.isEmpty(c)||(a=a+"_"+Deal.getSlotRefTag(c),a+=Deal.getPlacementID(c));return a};Deal.shouldRecordClickAction=function(a){return null===
a||a===e?!1:Deal.controller.getDeal(a).impressionAsin?!0:!1};Deal.checkAndSetSSLImageUrl=function(a){if(null===a)return a;if("https:"===k.location.protocol){var c="images-na.ssl-images-amazon.com";"CN"===gbResources.getCustomerData("realm")&&(c="images-cn.ssl-images-amazon.com");var b=document.createElement("a");b.href=a;b.protocol="https:";b.hostname=c;a=b.href}return a};Deal.findBackBoneDealAsin=function(a,c){return a&&a.dealAsinsHash?_.find(a.dealAsinsHash,function(b){return!c||b.ASIN===c})||null:
null};Deal.PurchaseStatusGatherer=Deal.Class({__init__:function(a){a&&(this.deal=a,this.now=new Date,this.timeSensitiveStates={},this.timeSensitiveStates[Deal.inCartStr]=1,this.timeSensitiveStates[Deal.pendingAtcStr]=1,this.stateAsins={},this.gatherStates())},gatherStates:function(){if(this.deal&&this.deal.dealAsinsHash){for(var a in this.deal.dealAsinsHash){var c=this.deal.dealAsinsHash[a];if(c&&c.status){var b=c.status.state;b&&(this.stateAsins[b]===e&&(this.stateAsins[b]=[]),this.timeSensitiveStates[b]!==
e&&c&&c.status&&null!==c.status.expiresDate&&c.status.expiresDate<=this.now||this.stateAsins[b].push(c))}}for(var d in this.timeSensitiveStates)this.stateAsins[d]!==e&&null!==this.stateAsins[d]&&this.stateAsins[d].sort(Deal.sortByPurchaseStatusExpirations)}},hasTimeSensitiveState:function(){if(this.stateAsins===e||null===this.stateAsins)return Deal.log("Cannot check if a timesensitive stateexists on undefined/null stateAsins."),!1;var a=!1,c;for(c in this.stateAsins)if((c===Deal.inCartStr||c===Deal.pendingAtcStr||
c===Deal.waitInLineStr)&&this.stateAsins[c]!==e&&null!==this.stateAsins[c]&&0<this.stateAsins[c].length){a=!0;break}return a},getStateDisplayData:function(){var a={},c=!1,b=0,d;for(d in this.stateAsins){a[d]===e&&(a[d]=[]);d!=Deal.availableStr&&d!=Deal.expiredStr&&d!=Deal.claimedStr&&0<this.stateAsins[d].length&&(c=!0);var g=this.stateAsins[d],f;for(f=0;f<g.length;f++){b++;var m=g[f],p={asin:m.ASIN};1==this.timeSensitiveStates[d]&&m.status!==e&&m.status.expiresDate!==e&&(p.expiresDate=m.status.expiresDate);
a[d].push(p)}}a.hasActionableStatus=c;a.totalAsins=b;return a}});Deal.sortByPurchaseStatusExpirations=function(a,c){return a.status.expiresDate-c.status.expiresDate};Deal.UDPTimer=function(a,c,b){var d={};d.t=a;d.span=null;d.onTimeoutFunction=null;d.setOnTimeoutFunction=function(b){d.onTimeoutFunction=b};d.update=function(){var a=Deal.max(d.t.getTime()-(new Date).getTime(),0);if(0>=a){if(d.disconnect(),null!=d.onTimeoutFunction)d.onTimeoutFunction()}else d.timeString=Deal.getUDPTimeString(a,c,b),
null!=d.span&&d.span!=e&&(0<d.span.length?d.span.html(d.timeString):(l.when("A").execute(function(b){l.log("Price Block markup dump using A.$ - "+b.$("#price").html(),"WARN","GoldboxUDPAssets");l.log("A.$ Version - "+b.$.fn.jquery,"WARN","GoldboxUDPAssets")}),l.when("jQuery").execute(function(b){l.log("Price Block markup dump using jQuery - "+b("#price").html(),"WARN","GoldboxUDPAssets");l.log("jQuery Version - "+b.fn.jquery,"WARN","GoldboxUDPAssets")})))};d.disconnect=function(){d.cx.disconnect()};
d.cx=Deal.clock.connect("tick",d.update);d.update();return d};Deal.getUDPTimeString=function(a,c,b){var d=Math.floor(a/864E5),g=Math.floor(a/36E5),f=Math.floor(a/6E4%60);a=Math.floor(a/1E3%60);var e=gbResources.getString("gbd_ends_in_label"),p=gbResources.getString("gbd_prime_starts_in_label"),q=gbResources.getString("gb_starts_in"),r=gbResources.getString("gbd_hour_label"),n=gbResources.getString("gbd_min_label"),k=gbResources.getString("gbd_sec_label"),l=gbResources.getString("gbld-lbl-one-day"),
v=gbResources.getString("gbld-lbl-days");b=c?" ":b.detail.accessType===Deal.accessTypeEnum.PRIME_EARLY_ACCESS&&Deal.isDealInEarlyAccessWindow(b)&&!gbResources.getCustomerData("hasEarlyAccessBenefit")?p+" ":b.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS&&Deal.isDealInEarlyAccessWindow(b)?gbResources.getCustomerData("isApp")&&gbResources.getCustomerData("isMobile")?e+" ":q+" ":e+" ";0==c?(c=""!==l&&""!==v)&&1<d?b+=d+" "+v:c&&1==d?b+=l:(b=10>g?b+("0"+g+r+" "):b+(g+r+" "),b=10>f?b+("0"+f+
n+" "):b+(f+n+" "),b=10>a?b+("0"+a+k):b+(a+k)):(b+=f+":",b=10>a?b+("0"+a):b+a);return b};Deal.getOfferListingID=function(a,c){return a===e||null===a||a.dealAsinsHash===e||null===a.dealAsinsHash||a.dealAsinsHash[c]===e||null===a.dealAsinsHash[c]?a.offerListingID===e||null===a.offerListingID?null:a.offerListingID:a.dealAsinsHash[c].offerID};Deal.ConvertToPaladinUrl=function(a){return a===e||null===a?null:a.replace(/^https?:\/\/[a-z0-9\.\-]*\.amazon.com\//i,k.location.protocol+"//"+k.location.host+"/")};
Deal.digitalCategories={US:"16261631 2350149011 154606011 163856011 979455011 1233514011 2402172011".split(" ")};Deal.BookCategories={CN:["658390051"]};Deal.hasDigitalCategory=function(a){var c=gbResources.getCustomerData("realm");return _.intersection(a,Deal.digitalCategories[c]).length?!0:!1};Deal.getWhitelistedBookCategories=function(){var a=gbResources.getCustomerData("realm");return Deal.BookCategories[a]||[]};Deal.isDealInEarlyAccessWindow=function(a){var c=!1;a.detail&&(a.detail.accessType===
Deal.accessTypeEnum.PRIME_EARLY_ACCESS||a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS)&&a.status&&0>=a.status.msToStart&&-a.status.msToStart<a.detail.accessDurationInMs&&(c=!0);return c};Deal.isPrimeEarlyAccessDeal=function(a){var c=!1;a.detail&&a.detail.accessType===Deal.accessTypeEnum.PRIME_EARLY_ACCESS&&(c=!0);return c};Deal.isPrimeOnlyDeal=function(a){var c=!1;!a.detail||a.detail.accessType!==Deal.accessTypeEnum.PRIME_ONLY_LD&&a.detail.accessType!==Deal.accessTypeEnum.PRIME_ONLY_DOTD&&
a.detail.accessType!==Deal.accessTypeEnum.PRIME_ONLY_BD||(c=!0);return c};Deal.isPrimeOnlyDotd=function(a){var c=!1;a.detail&&a.detail.accessType===Deal.accessTypeEnum.PRIME_ONLY_DOTD&&(c=!0);return c};Deal.getEarlyAccessEndTime=function(a){return new Date(a.detail.accessDurationInMs+a.status.startDate.getTime())};Deal.setURLParameter=function(a,c,b){if(a){var d=a.indexOf("#"),g=-1===d?"":a.substr(d);a=-1===d?a:a.substr(0,d);var d=new RegExp("([?\x26])"+c+"\x3d.*?(\x26|$)","i"),f=-1!==a.indexOf("?")?
"\x26":"?";a=a.match(d)?a.replace(d,"$1"+c+"\x3d"+b+"$2"):a+f+c+"\x3d"+b;return a+g}return null};Deal.getParameterByName=function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");a=(new RegExp("[\\?\x26]"+a+"\x3d([^\x26#]*)")).exec(location.search);return null===a?"":decodeURIComponent(a[1].replace(/\+/g," "))};Deal.isPEAEnabledMarketplace=function(a){return"US"===a||"UK"===a||"CA"===a||"DE"===a||"FR"===a||"ES"===a||"IT"===a||"JP"===a};Deal.incrementCounter=function(a){a&&k.ue&&"function"===typeof k.ue.count&&
ue.count(a,(ue.count(a)||0)+1)};Deal.setCounter=function(a,c){a&&k.ue&&"function"===typeof k.ue.count&&ue.count(a,c)};Deal._generateAPIMetricName=function(a){if(!a)return null;var c="goldbox";a.apiName&&(c+=":"+a.apiName,a.apiVersion&&(c+=":"+a.apiVersion));c+=":"+(a.isSuccess?"success":"error");c+=":"+(a.isRetry?"retry":"noretry");a.clientId&&(c+=":"+a.clientId);return c.toLowerCase()};Deal.recordAPIMetrics=function(a){if(a){var c=Deal._generateAPIMetricName(a);Deal.incrementCounter(c);a.latency&&
Deal.setCounter(c+":time",a.latency)}}});(function(){function e(b,a,c){if(b===a)return 0!==b||1/b==1/a;if(null==b||null==a)return b===a;b._chain&&(b=b._wrapped);a._chain&&(a=a._wrapped);if(b.isEqual&&h.isFunction(b.isEqual))return b.isEqual(a);if(a.isEqual&&h.isFunction(a.isEqual))return a.isEqual(b);var d=p.call(b);if(d!=p.call(a))return!1;switch(d){case "[object String]":return b==String(a);case "[object Number]":return b!=+b?a!=+a:0==b?1/b==1/a:b==+a;case "[object Date]":case "[object Boolean]":return+b==
+a;case "[object RegExp]":return b.source==a.source&&b.global==a.global&&b.multiline==a.multiline&&b.ignoreCase==a.ignoreCase}if("object"!=typeof b||"object"!=typeof a)return!1;for(var g=c.length;g--;)if(c[g]==b)return!0;c.push(b);var g=0,f=!0;if("[object Array]"==d){if(g=b.length,f=g==a.length)for(;g--&&(f=g in b==g in a&&e(b[g],a[g],c)););}else{if("constructor"in b!="constructor"in a||b.constructor!=a.constructor)return!1;for(var m in b)if(h.has(b,m)&&(g++,!(f=h.has(a,m)&&e(b[m],a[m],c))))break;
if(f){for(m in a)if(h.has(a,m)&&!g--)break;f=!g}}c.pop();return f}var a=this,c=a._,b={},d=Array.prototype,g=Object.prototype,f=d.slice,m=d.unshift,p=g.toString,q=g.hasOwnProperty,r=d.forEach,k=d.map,l=d.reduce,y=d.reduceRight,v=d.filter,x=d.every,t=d.some,z=d.indexOf,F=d.lastIndexOf,g=Array.isArray,J=Object.keys,A=Function.prototype.bind,h=function(b){return new w(b)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=h),exports._=h):a._=h;h.VERSION=
"1.3.1";var u=h.each=h.forEach=function(a,c,d){if(null!=a)if(r&&a.forEach===r)a.forEach(c,d);else if(a.length===+a.length)for(var g=0,f=a.length;g<f&&!(g in a&&c.call(d,a[g],g,a)===b);g++);else for(g in a)if(h.has(a,g)&&c.call(d,a[g],g,a)===b)break};h.map=h.collect=function(b,a,c){var d=[];if(null==b)return d;if(k&&b.map===k)return b.map(a,c);u(b,function(b,g,f){d[d.length]=a.call(c,b,g,f)});b.length===+b.length&&(d.length=b.length);return d};h.reduce=h.foldl=h.inject=function(b,a,c,d){var g=2<arguments.length;
null==b&&(b=[]);if(l&&b.reduce===l)return d&&(a=h.bind(a,d)),g?b.reduce(a,c):b.reduce(a);u(b,function(b,f,I){g?c=a.call(d,c,b,f,I):(c=b,g=!0)});if(!g)throw new TypeError("Reduce of empty array with no initial value");return c};h.reduceRight=h.foldr=function(b,a,c,d){var g=2<arguments.length;null==b&&(b=[]);if(y&&b.reduceRight===y)return d&&(a=h.bind(a,d)),g?b.reduceRight(a,c):b.reduceRight(a);var f=h.toArray(b).reverse();d&&!g&&(a=h.bind(a,d));return g?h.reduce(f,a,c,d):h.reduce(f,a)};h.find=h.detect=
function(b,a,c){var d;G(b,function(b,g,f){if(a.call(c,b,g,f))return d=b,!0});return d};h.filter=h.select=function(b,a,c){var d=[];if(null==b)return d;if(v&&b.filter===v)return b.filter(a,c);u(b,function(b,g,f){a.call(c,b,g,f)&&(d[d.length]=b)});return d};h.reject=function(b,a,c){var d=[];if(null==b)return d;u(b,function(b,g,f){a.call(c,b,g,f)||(d[d.length]=b)});return d};h.every=h.all=function(a,c,d){var g=!0;if(null==a)return g;if(x&&a.every===x)return a.every(c,d);u(a,function(a,f,e){if(!(g=g&&
c.call(d,a,f,e)))return b});return g};var G=h.some=h.any=function(a,c,d){c||(c=h.identity);var g=!1;if(null==a)return g;if(t&&a.some===t)return a.some(c,d);u(a,function(a,f,e){if(g||(g=c.call(d,a,f,e)))return b});return!!g};h.include=h.contains=function(b,a){var c=!1;return null==b?c:z&&b.indexOf===z?-1!=b.indexOf(a):c=G(b,function(b){return b===a})};h.invoke=function(b,a){var c=f.call(arguments,2);return h.map(b,function(b){return(h.isFunction(a)?a||b:b[a]).apply(b,c)})};h.pluck=function(b,a){return h.map(b,
function(b){return b[a]})};h.max=function(b,a,c){if(!a&&h.isArray(b))return Math.max.apply(Math,b);if(!a&&h.isEmpty(b))return-Infinity;var d={computed:-Infinity};u(b,function(b,g,f){g=a?a.call(c,b,g,f):b;g>=d.computed&&(d={value:b,computed:g})});return d.value};h.min=function(b,a,c){if(!a&&h.isArray(b))return Math.min.apply(Math,b);if(!a&&h.isEmpty(b))return Infinity;var d={computed:Infinity};u(b,function(b,g,f){g=a?a.call(c,b,g,f):b;g<d.computed&&(d={value:b,computed:g})});return d.value};h.shuffle=
function(b){var a=[],c;u(b,function(b,d,g){0==d?a[0]=b:(c=Math.floor(Math.random()*(d+1)),a[d]=a[c],a[c]=b)});return a};h.sortBy=function(b,a,c){return h.pluck(h.map(b,function(b,d,g){return{value:b,criteria:a.call(c,b,d,g)}}).sort(function(b,a){b=b.criteria;a=a.criteria;return b<a?-1:b>a?1:0}),"value")};h.groupBy=function(b,a){var c={},d=h.isFunction(a)?a:function(b){return b[a]};u(b,function(b,a){a=d(b,a);(c[a]||(c[a]=[])).push(b)});return c};h.sortedIndex=function(b,a,c){c||(c=h.identity);for(var d=
0,g=b.length;d<g;){var f=d+g>>1;c(b[f])<c(a)?d=f+1:g=f}return d};h.toArray=function(b){return b?b.toArray?b.toArray():h.isArray(b)||h.isArguments(b)?f.call(b):h.values(b):[]};h.size=function(b){return h.toArray(b).length};h.first=h.head=function(b,a,c){return null==a||c?b[0]:f.call(b,0,a)};h.initial=function(b,a,c){return f.call(b,0,b.length-(null==a||c?1:a))};h.last=function(b,a,c){return null==a||c?b[b.length-1]:f.call(b,Math.max(b.length-a,0))};h.rest=h.tail=function(b,a,c){return f.call(b,null==
a||c?1:a)};h.compact=function(b){return h.filter(b,function(b){return!!b})};h.flatten=function(b,a){return h.reduce(b,function(b,c){if(h.isArray(c))return b.concat(a?c:h.flatten(c));b[b.length]=c;return b},[])};h.without=function(b){return h.difference(b,f.call(arguments,1))};h.uniq=h.unique=function(b,a,c){c=c?h.map(b,c):b;var d=[];h.reduce(c,function(c,g,f){0!=f&&(!0===a?h.last(c)==g:h.include(c,g))||(c[c.length]=g,d[d.length]=b[f]);return c},[]);return d};h.union=function(){return h.uniq(h.flatten(arguments,
!0))};h.intersection=h.intersect=function(b){var a=f.call(arguments,1);return h.filter(h.uniq(b),function(b){return h.every(a,function(a){return 0<=h.indexOf(a,b)})})};h.difference=function(b){var a=h.flatten(f.call(arguments,1));return h.filter(b,function(b){return!h.include(a,b)})};h.zip=function(){for(var b=f.call(arguments),a=h.max(h.pluck(b,"length")),c=Array(a),d=0;d<a;d++)c[d]=h.pluck(b,""+d);return c};h.indexOf=function(b,a,c){if(null==b)return-1;var d;if(c)return c=h.sortedIndex(b,a),b[c]===
a?c:-1;if(z&&b.indexOf===z)return b.indexOf(a);c=0;for(d=b.length;c<d;c++)if(c in b&&b[c]===a)return c;return-1};h.lastIndexOf=function(b,a){if(null==b)return-1;if(F&&b.lastIndexOf===F)return b.lastIndexOf(a);for(var c=b.length;c--;)if(c in b&&b[c]===a)return c;return-1};h.range=function(b,a,c){1>=arguments.length&&(a=b||0,b=0);c=arguments[2]||1;for(var d=Math.max(Math.ceil((a-b)/c),0),g=0,f=Array(d);g<d;)f[g++]=b,b+=c;return f};var H=function(){};h.bind=function(b,a){var c,d;if(b.bind===A&&A)return A.apply(b,
f.call(arguments,1));if(!h.isFunction(b))throw new TypeError;d=f.call(arguments,2);return c=function(){if(!(this instanceof c))return b.apply(a,d.concat(f.call(arguments)));H.prototype=b.prototype;var g=new H,e=b.apply(g,d.concat(f.call(arguments)));return Object(e)===e?e:g}};h.bindAll=function(b){var a=f.call(arguments,1);0==a.length&&(a=h.functions(b));u(a,function(a){b[a]=h.bind(b[a],b)});return b};h.memoize=function(b,a){var c={};a||(a=h.identity);return function(){var d=a.apply(this,arguments);
return h.has(c,d)?c[d]:c[d]=b.apply(this,arguments)}};h.delay=function(b,a){var c=f.call(arguments,2);return setTimeout(function(){return b.apply(b,c)},a)};h.defer=function(b){return h.delay.apply(h,[b,1].concat(f.call(arguments,1)))};h.throttle=function(b,a){var c,d,g,f,e,m=h.debounce(function(){e=f=!1},a);return function(){c=this;d=arguments;g||(g=setTimeout(function(){g=null;e&&b.apply(c,d);m()},a));f?e=!0:b.apply(c,d);m();f=!0}};h.debounce=function(b,a){var c;return function(){var d=this,g=arguments;
clearTimeout(c);c=setTimeout(function(){c=null;b.apply(d,g)},a)}};h.once=function(b){var a=!1,c;return function(){if(a)return c;a=!0;return c=b.apply(this,arguments)}};h.wrap=function(b,a){return function(){var c=[b].concat(f.call(arguments,0));return a.apply(this,c)}};h.compose=function(){var b=arguments;return function(){for(var a=arguments,c=b.length-1;0<=c;c--)a=[b[c].apply(this,a)];return a[0]}};h.after=function(b,a){return 0>=b?a():function(){if(1>--b)return a.apply(this,arguments)}};h.keys=
J||function(b){if(b!==Object(b))throw new TypeError("Invalid object");var a=[],c;for(c in b)h.has(b,c)&&(a[a.length]=c);return a};h.values=function(b){return h.map(b,h.identity)};h.functions=h.methods=function(b){var a=[],c;for(c in b)h.isFunction(b[c])&&a.push(c);return a.sort()};h.extend=function(b){u(f.call(arguments,1),function(a){for(var c in a)b[c]=a[c]});return b};h.defaults=function(b){u(f.call(arguments,1),function(a){for(var c in a)null==b[c]&&(b[c]=a[c])});return b};h.clone=function(b){return h.isObject(b)?
h.isArray(b)?b.slice():h.extend({},b):b};h.tap=function(b,a){a(b);return b};h.isEqual=function(b,a){return e(b,a,[])};h.isEmpty=function(b){if(h.isArray(b)||h.isString(b))return 0===b.length;for(var a in b)if(h.has(b,a))return!1;return!0};h.isElement=function(b){return!(!b||1!=b.nodeType)};h.isArray=g||function(b){return"[object Array]"==p.call(b)};h.isObject=function(b){return b===Object(b)};h.isArguments=function(b){return"[object Arguments]"==p.call(b)};h.isArguments(arguments)||(h.isArguments=
function(b){return!(!b||!h.has(b,"callee"))});h.isFunction=function(b){return"[object Function]"==p.call(b)};h.isString=function(b){return"[object String]"==p.call(b)};h.isNumber=function(b){return"[object Number]"==p.call(b)};h.isNaN=function(b){return b!==b};h.isBoolean=function(b){return!0===b||!1===b||"[object Boolean]"==p.call(b)};h.isDate=function(b){return"[object Date]"==p.call(b)};h.isRegExp=function(b){return"[object RegExp]"==p.call(b)};h.isNull=function(b){return null===b};h.isUndefined=
function(b){return void 0===b};h.has=function(b,a){return q.call(b,a)};h.noConflict=function(){a._=c;return this};h.identity=function(b){return b};h.times=function(b,a,c){for(var d=0;d<b;d++)a.call(c,d)};h.escape=function(b){return(""+b).replace(/&/g,"\x26amp;").replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g,"\x26#x27;").replace(/\//g,"\x26#x2F;")};h.mixin=function(b){u(h.functions(b),function(a){K(a,h[a]=b[a])})};var L=0;h.uniqueId=function(b){var a=L++;return b?
b+a:a};h.templateSettings={evaluate:/<~([\s\S]+?)~>/g,interpolate:/\$\(([\s\S]+?)\)/g,escape:/~\$\(([\s\S]+?)\)/g};var B=/.^/,C=function(b){return b.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};h.template=function(b,a){var c=h.templateSettings;b="var __p\x3d[],print\x3dfunction(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+b.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.escape||B,function(b,a){return"',_.escape("+C(a)+"),'"}).replace(c.interpolate||B,function(b,a){return"',"+C(a)+
",'"}).replace(c.evaluate||B,function(b,a){return"');"+C(a).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var d=new Function("obj","_",b);return a?d(a,h):function(b){return d.call(this,b,h)}};h.chain=function(b){return h(b).chain()};var w=function(b){this._wrapped=b};h.prototype=w.prototype;var D=function(b,a){return a?h(b).chain():b},K=function(b,a){w.prototype[b]=function(){var b=f.call(arguments);m.call(b,this._wrapped);
return D(a.apply(h,b),this._chain)}};h.mixin(h);u("pop push reverse shift sort splice unshift".split(" "),function(b){var a=d[b];w.prototype[b]=function(){var c=this._wrapped;a.apply(c,arguments);var d=c.length;"shift"!=b&&"splice"!=b||0!==d||delete c[0];return D(c,this._chain)}});u(["concat","join","slice"],function(b){var a=d[b];w.prototype[b]=function(){return D(a.apply(this._wrapped,arguments),this._chain)}});w.prototype.chain=function(){this._chain=!0;return this};w.prototype.value=function(){return this._wrapped}}).call(this);
l.when("A","gb-udp-event-emitter").register("gb-udp-deal-dao",function(n,a){return a.extend({init:function(a){this._super();if(!a)throw Error("Cannot create a DealDAO object with undefined dealID");this.timeouts={startTimeout:null,endTimeout:null,endTimeoutDelayed:null,statusExpireTimeout:null,expireTimeout:null,pstatusExpire:null,pstatusExpiresSoon:null};this.checkingDealStatus=!1;this.lastPstatusExpireState="";this.dealID=a;this.loading=!0;this.customerID=null;this.expired=!1;this.parentItems=this.parentAsin=
null;this.claimed=!1;this.itemType=this.dealType=null;this.dealState=Deal.stateToTemplateMap.Loading;this.offerListingID=this.impressionAsin=this.buyAsin=this.discussionBoardURL=this.cacheExpiresDate=this.msToCacheExpires=null;this.detail={title:null,description:null,marketplaceID:null,imageAsin:null,score:null,secondaryImages:null,URL:null,buyBoxURL:null,displayPriority:null,isFeatured:null,marketingMessage:null,geoDisplayName:null,accessType:null,isPrimeOnly:null,isPrimeEarly:null,accessDurationInMs:null};
this.pricingData={dealPriceHash:{isRange:null,max:{price:null,formattedPrice:null,currency:null},min:{price:null,formattedPrice:null,currency:null}},basisPriceHash:{isRange:null,max:{price:null,formattedPrice:null,currency:null},min:{price:null,formattedPrice:null,currency:null}}};this.percentOff={isRange:null,max:null,min:null};this.status={dealState:null,currentlyUnavailable:!1,percentClaimed:null,percentSoldOut:null,lastUpdated:null,totalCouponsCount:null,msToStart:null,msToEnd:null,startDate:null,
endDate:null,ended:null,msToCacheExpires:null,cacheExpiresDate:null,started:null,expired:null};this.isLimitedQuantity=null;this.teaser={teaserLine:null,teaserImage:null,teaserURL:null,teaserAsin:null};this.fastTrackMessage=this.swfContents=null;this.dealAsins=[];this.dealAsinsHash={};this.auxiliaryData={isPrimeEligible:null,breaksMAP:null,merchantDetails:{merchantID:null,merchantName:null},reviewData:{averageRating:null,totalReviews:null,reviewsURL:null}};this.purchaseStatusWarningThreshold=6E5},
validate:function(a){},setItemType:function(a){this.itemType=this.dealAsins&&1<this.dealAsins.length?Deal.itemTypes.MultiItem:this.dealAsins&&1===this.dealAsins.length?Deal.itemTypes.SingleItem:a?Deal.responseItemTypeToItemType[a]:Deal.itemTypes.ContentOnly},calculateStateData:function(){this.dealState=Deal.stateToTemplateMap.Available;0<this.status.msToStart&&!this.status.started?this.dealState=Deal.stateToTemplateMap.Upcoming:Deal.checkIfDealExpired(this)?this.dealState=Deal.stateToTemplateMap.Expired:
this.isDealSoldOut()&&(this.dealState=Deal.stateToTemplateMap.SoldOut)},calculateStatusData:function(a,b){if(a){this.status.currentlyUnavailable=a.currentlyUnavailable;this.status.percentClaimed=a.percentClaimed;var d;this.dealAsins&&(d=this.dealAsins.length);var g=0;if(d)for(var f=0;f<d;f++)100===this.dealAsins[f].status.percentClaimed&&g++;this.isDealSoldOut()&&(this.status.percentClaimed=100);this.status.percentSoldOut=a.percentSoldOut;this.status.totalCouponsCount=a.totalAvailable;this.status.msToCacheExpires=
a.msToCacheExpires;this.status.msToStart=a.msToStart;this.status.msToEnd=a.msToEnd;this.status.cacheExpiresDate=new Date(b.getTime()+parseInt(this.status.msToCacheExpires,10));this.status.endDate=new Date(b.getTime()+parseInt(this.status.msToEnd,10));this.status.startDate=new Date(b.getTime()+parseInt(this.status.msToStart,10))}else Deal.log("Cannot set Deal DAO status for undefined/null statusObj.")},isDealSoldOut:function(){if(!this.dealAsinsHash)return!1;for(var a in this.dealAsinsHash){var b=
this.dealAsinsHash[a];if(!b.status.offerServiceSoldOut&&100>b.status.percentSoldOut)return!1}return!0},calculatePriceData:function(a){var b=Deal.Price.findMaxMinPrices(this,a);Deal.Price.isEmptyPriceObject(b)||(this.pricingData.basisPriceHash.max=b.maxBasisPrice,this.pricingData.basisPriceHash.min=b.minBasisPrice,Deal.Price.maxEqualMin(this.pricingData.basisPriceHash)?this.pricingData.basisPriceHash.isRange=!1:this.pricingData.basisPriceHash.isRange=!0,this.pricingData.dealPriceHash.max=b.maxDealPrice,
this.pricingData.dealPriceHash.min=b.minDealPrice,Deal.Price.maxEqualMin(this.pricingData.dealPriceHash)?this.pricingData.dealPriceHash.isRange=!1:this.pricingData.dealPriceHash.isRange=!0);a&&(a.maxPercentOff&&(this.percentOff.max=parseInt(a.maxPercentOff)),a.minPercentOff&&(this.percentOff.min=parseInt(a.minPercentOff)),this.percentOff.isRange=this.percentOff.max===this.percentOff.min?!1:!0)},calculateAuxiliaryDataFromItem:function(){var a=Deal.findBackBoneDealAsin(this);if(a){if(null===this.auxiliaryData.isPrimeEligible||
this.auxiliaryData.isPrimeEligible===e)this.auxiliaryData.isPrimeEligible=a.auxiliaryData.isPrimeEligible;if(null===this.auxiliaryData.breaksMAP||this.auxiliaryData.breaksMAP===e)this.auxiliaryData.breaksMAP=a.auxiliaryData.breaksMAP;if(null===this.auxiliaryData.merchantDetails||this.auxiliaryData.merchantDetails===e)this.auxiliaryData.merchantDetails=a.auxiliaryData.merchantDetails;if(null===this.auxiliaryData.reviewData||this.auxiliaryData.reviewData===e)this.auxiliaryData.reviewData=a.auxiliaryData.reviewData}}})});
l.when("A","gb-udp-event-emitter").register("gb-udp-deal-asin-dao",function(n,a){return a.extend({init:function(a){this._super();if(a===e||!a)throw Error("Cannot create a DealAsinDAO object with undefined asin");Deal.log("Created DealAsinDAO instance for: "+a);this.ASIN=a;this.timeouts={};this.imageURL=this.basisKind=this.basisPriceFormatted=this.basisPrice=this.dealPriceFormatted=this.dealPrice=this.marketplaceID=this.parentDealDAO=this.dealID=null;this.isParent=!1;this.percentOff=this.percentOffBasisPrice=
this.totalAvailable=null;this.status={state:null,itemState:null,expiresDate:null,offerServiceSoldOut:null,currentlyUnavailable:null,percentClaimed:null,percentSoldOut:null,lastUpdated:null,msToExpiry:null,totalCouponsCount:null};this.isCustomerClaimed=!1;this.waitListStatus={position:null,chance:null,timeToWait:null};this.offerListingID=this.variationData=null;this.auxiliaryData={isPrimeEligible:null,breaksMAP:null,merchantDetails:{merchantID:null,merchantName:null},reviewData:{averageRating:null,
totalReviews:null,reviewsURL:null}};this.perCustomerAmount=this.offerID=this.isWaitlistable=this.isTimeLimited=this.isOneClickable=this.isParentItem=this.ingressUrl=this.egressUrl=null},validate:function(a){}})});l.when("A").register("deals-custom-integration-base",function(e){return e.createClass({isActive:!1,init:function(){this.isIntegrationActive()},isIntegrationActive:function(){throw Error("isIntegrationActive called from base");},appendArgumentsToEndpoint:function(){throw Error("appendArgumentsToEndpoint called from base");
},handleClaimDealSuccess:function(){throw Error("handleClaimDealSuccess called from base");},handleClaimDealError:function(){throw Error("handleClaimDealError called from base");},handleClaimDealRetry:function(){throw Error("handleClaimDealRetry called from base");},handleLDBuyBoxSelected:function(){throw Error("handleLDBuyBoxSelected called from base");},handleRegularBuyBoxSelected:function(){throw Error("handleRegularBuyBoxSelected called from base");}})});l.when("A","deals-custom-integration-base").register("deals-custom-integration-installments",
function(e,a){var c=e.$;return a.extend({init:function(){this._super()},isIntegrationActive:function(){var b=c('.installments-checkbox-wrapper input[name\x3d"installments-payment-checkbox"]'),a=c('.installments-checkbox-wrapper input[name\x3d"installments-programId"]');this.isActive=b.length&&a.length},appendArgumentsToEndpoint:function(){var b="",a=c('.installments-checkbox-wrapper input[name\x3d"installments-payment-checkbox"]'),g=c('.installments-checkbox-wrapper input[name\x3d"installments-programId"]');
g.length&&a.length&&a.is(":checked")&&(b="\x26installmentsProgramId\x3d"+g.val());return b},handleClaimDealSuccess:function(){c(".installments-checkbox-wrapper").hide()},handleClaimDealError:function(){},handleClaimDealRetry:function(){},handleLDBuyBoxSelected:function(){var b=c(".installments-deal-breakdown");b.length&&b.addClass("aok-hidden");b=c(".price-installment-payment");b.length&&b.removeClass("aok-hidden")},handleRegularBuyBoxSelected:function(){var b=c(".installments-deal-breakdown");b.length&&
b.removeClass("aok-hidden");b=c(".price-installment-payment");b.length&&b.addClass("aok-hidden")}})});l.when("A","deals-custom-integration-base").register("deals-custom-integration-preRegistration",function(e,a){var c=e.$;return a.extend({init:function(){this._super()},isIntegrationActive:function(){this.isActive=c('#preRegistration-container-deals input[name\x3d"account-linking-deals"]').length},appendArgumentsToEndpoint:function(){var b="",a=c('#preRegistration-container-deals input[name\x3d"account-linking-deals"]');
a.length&&(b=a.is(":checked")&&!a.prop("disabled")?"\x26isDevicePreRegistered\x3dtrue":"\x26isDevicePreRegistered\x3dfalse");return b},handleClaimDealSuccess:function(){c("#preRegistration-container-deals").hide()},handleClaimDealError:function(){},handleClaimDealRetry:function(){},handleLDBuyBoxSelected:function(){},handleRegularBuyBoxSelected:function(){}})});l.when("A","gb-udp-deal-asin-dao","gb-udp-event-emitter").register("gb-deal-content-service-translation-helper",function(n,a,c){return c.extend({init:function(b){this._super()},
validate:function(b){},populateFromGetDealMetadata:function(){},populateFromGetDeals:function(b,a){if(b&&a){b.loading=!1;b.legacyDeal||(b.legacyDeal=new Deal.Model.Deal(a.dealID));b.customerID=gbResources.getCustomerData("customerId");b.claimed=!1;b.dealID=a.dealID;b.parentAsin=null;b.dealType=a.type;if(a.parentItems){b.parentItems||(b.parentItems={});for(var c in a.parentItems)b.parentAsin||(b.parentAsin=c),b.parentItems[c]=a.parentItems[c]}b.isLimitedQuantity=!1;b.limitedQuantity=!1;a.quantity&&
(a.quantity=parseInt(a.quantity,10));if(b.dealType==Deal.dealTypes.LD||a.quantity&&0<a.quantity)b.isLimitedQuantity=!0,b.limitedQuantity=!0;b.detail.marketplaceID=null;b.detail.score=parseInt(a.score,10);b.detail.title=a.title;b.detail.description=a.description;b.detail.leakDescription=a.leakDescription;b.detail.marketingMessage=a.marketingMessage;b.detail.geoDisplayName=a.geoDisplayName;b.detail.imageAsin=Deal.checkAndSetSSLImageUrl(a.primaryImage);b.detail.secondaryImages=a.secondaryImages;b.detail.URL=
a.egressUrl;b.detail.buyBoxURL=a.ingressUrl;b.detail.displayPriority=parseInt(a.displayPriority,10);b.detail.isFeatured=Deal.parseBool(a.isFeatured);b.detail.imageAsin||(b.detail.imageAsin=gbResources.getImage("no_image"));a.impressionAsin&&(b.impressionAsin=a.impressionAsin);b.detail.isPrimeEarly=!1;b.detail.isPrimeOnly=!1;a.primeAccessType==Deal.accessTypeEnum.PRIME_EARLY_ACCESS?(b.detail.accessType=Deal.accessTypeEnum[a.primeAccessType],b.detail.accessDurationInMs=6E4*parseInt(a.primeAccessDuration,
10),b.detail.isPrimeEarly=!0):a.primeAccessType==Deal.accessTypeEnum.PRIME_ONLY_LD?(b.detail.isPrimeOnly=!0,b.detail.accessType=Deal.accessTypeEnum.PRIME_ONLY_LD):a.primeAccessType==Deal.accessTypeEnum.PRIME_ONLY_DOTD?(b.detail.isPrimeOnly=!0,b.detail.accessType=Deal.accessTypeEnum.PRIME_ONLY_DOTD):a.primeAccessType==Deal.accessTypeEnum.PRIME_ONLY_BD&&(b.detail.isPrimeOnly=!0,b.detail.accessType=Deal.accessTypeEnum.PRIME_ONLY_BD);b.discussionBoardURL="/gp/goldbox/discussion/"+b.dealID;b.auxiliaryData.isPrimeEligible=
Deal.parseBool(a.isPrimeEligible);b.auxiliaryData.breaksMAP=Deal.parseBool(a.isMAP);b.auxiliaryData.merchantDetails=a.merchantID||a.merchantName?{merchantID:a.merchantID,merchantName:a.merchantName}:null;a.reviewAsin?(b.buyAsin=a.reviewAsin,b.auxiliaryData.reviewData={averageRating:parseFloat(a.reviewRating),totalReviews:parseInt(a.totalReviews,10),reviewsURL:"/gp/product-reviews/"+a.reviewAsin}):b.auxiliaryData.reviewData=null;a.teaser&&(b.teaser.teaserLine=a.teaser,a.teaserImage&&(b.teaser.teaserImage=
Deal.checkAndSetSSLImageUrl(a.teaserImage)),a.teaserAsin&&(b.teaser.teaserAsin=a.teaserAsin,b.teaser.teaserURL="/gp/product/"+a.teaserAsin));a.items&&this.populateFromItems(b,a);this.executePostTranslationRules(b);b.legacyDeal.load_from_deal_dao(b)}else Deal.log("ERROR: DealContentServiceTranslationHelper: deal/jsonDeal object passed into populateFromGetDeals was null/undefined.")},translateClaimDealResponse:function(b,a,c){if(c!==e&&null!==c){var f=new Date;b.loading=!1;var m=_.find(b.dealAsins,
function(b){if(b.ASIN===a)return b}),p=c.dealItemStatus;m&&p!==e&&null!==p&&(m.status.itemState=c.dealItemStatus.itemState,m.status.state=Deal.customerStates[c.dealItemStatus.customerState],m.status.msToExpiry=c.dealItemStatus.msToCustomerStateExpiry);c.msCacheTtl!==e&&null!==c.msCacheTtl&&(b.status.msToCacheExpires=parseInt(c.msCacheTtl,10));b.legacyDeal=new Deal.Model.Deal(b.dealID);b.legacyDeal.load_from_deal_dao(b);this.initStatus(b,f);this.initAsinStatus(b)}},populateFromItems:function(b,c){if(b===
e||null==b||c==e||null==c){var g="";b?c||(g+="jsonDeal \x3d null. dealID \x3d "+b.dealID):g+="deal \x3d null";Deal.log("ERROR: DealContentServiceTranslationHelper: Deal object or jsonDeal object passed into populateFromItems was null or undefined. "+g)}else{var f=c.items,m;for(m=0;m<f.length;m++){var p=f[m],q=p.itemID;if(b.dealAsinsHash[q]===e||null===b.dealAsinsHash[q])p.itemID||(g="dealID \x3d "+b.dealID,Deal.log("ERROR: DealContentServiceTranslationHelper: populateFromItems: Null or undefined Asin passed. "+
g)),b.dealAsinsHash[q]=new a(p.itemID),b.dealAsins.push(b.dealAsinsHash[q]);b.dealAsinsHash[q].parentDealDAO=b;this.populateFromItem(b.dealAsinsHash[q],p,b.dealType)}b.setItemType(c.itemType);null!==b.itemType&&b.itemType!==e||b.itemType!=Deal.itemTypes.SingleItem||!b.dealAsins||1!=b.dealAsins.length||(b.buyAsin=b.dealAsins[0].ASIN);if(null===b.offerListingID||b.offerListingID===e)b.dealAsins&&1==b.dealAsins.length?b.offerListingID=b.dealAsins[0].offerID:b.itemType==Deal.itemTypes.SingleItem&&c.offerID&&
(b.offerListingID=c.offerID);b.calculatePriceData(c);b.calculateAuxiliaryDataFromItem();Deal.log("DealContentServiceTranslationHelper: Populate form Items Complete Pushed "+m+" DealAsins")}},populateFromItem:function(b,a,c){b.ASIN=a.itemID;b.dealID=a.dealID;a.variationDimensions&&(b.variationData=b.variationData||{},_.each(a.variationDimensions,function(c,g){c=c.replace(/\s+/g," ");a.variationDimensions[g]=c;b.variationData[g]=c}));a.dealPrice!==e&&null!==a.dealPrice&&(b.dealPrice={currency:a.currencyCode,
price:parseFloat(a.dealPrice)},b.dealPriceFormatted=Deal.Price.format(b.dealPrice));a.bAmount!==e&&null!==a.bAmount&&(b.basisPrice={currency:a.currencyCode,price:parseFloat(a.bAmount)},b.basisPriceFormatted=Deal.Price.format(b.basisPrice),b.basisKind=a.bKind);if(b.basisPrice&&b.dealPrice&&(b.percentOffBasisPrice=Deal.Price.percent_off(b.basisPrice,b.dealPrice),b.percentOffBasisPrice))try{b.percentOffBasisPriceFormatted=Math.round(b.percentOffBasisPrice)}catch(f){Deal.log("UnknownFormat percentageOffBasisPrice Object."+
f)}b.percentOff=Deal.Price.displayable_percent_off(parseInt(a.percentOff));b.egressUrl=a.egressUrl;b.ingressUrl=a.ingressUrl;b.isParentItem=a.isParentItem;b.imageURL=a.primaryImage;if(b.imageURL===e||null===b.imageURL)b.imageURL=gbResources.getImage("no_image");null!==a.isOneClickable&&a.isOneClickable!==e&&(b.isOneClickable=Deal.parseBool(a.isOneClickable));null!==a.isTimeLimited&&a.isTimeLimited!==e&&(b.isTimeLimited=Deal.parseBool(a.isTimeLimited));null!==a.isWaitlistable&&a.isWaitlistable!==e&&
(b.isWaitlistable=Deal.parseBool(a.isWaitlistable));b.offerID=a.offerID;null!==a.perCustomerAmount&&a.perCustomerAmount!==e&&(b.perCustomerAmount=parseInt(a.perCustomerAmount,10));b.auxiliaryData.isPrimeEligible=Deal.parseBool(a.isPrimeEligible);b.auxiliaryData.breaksMAP=Deal.parseBool(a.isMAP);b.auxiliaryData.merchantDetails={merchantID:a.merchantID,merchantName:a.merchantName};b.auxiliaryData.reviewData={averageRating:parseFloat(a.reviewRating),totalReviews:parseInt(a.totalReviews,10),reviewsURL:"/gp/product-reviews/"+
a.itemID};return b},populateFromSelectDealsMetadata:function(b,a){if(b===e||null===b)Deal.log("Cannot populate select deals metadata for undefined/null widgetID.");else if(a===e||null===a)Deal.log("Cannot populate select deals metadata for undefined/null data.");else{var c={};c.dealStateHash=a.dealsByState;c.dealCategoryHash=a.dealsByCategory;c.dealAccessTypeHash=a.dealsByAccessType;c.sortedDealList=a.sortedDealIDs;c.selectDealsPageSize=a.selectDealsPageSize;Deal.controller.metadata.registerResponseData(b,
c)}},populateFromGetDealStatuses:function(b,a){if(b===e||null===b)Deal.log("Cannot populateFromGetDealStatuses for undefined/null json obj.");else{var c,f;for(f in b)a.deals[f]!==e&&null!==a.deals[f]?(c=a.getDeal(f),this.populateFromGetDealStatus(c,b[f])):Deal.log("We cannot do a status update on a DealObject that doesn't exist.")}},populateFromGetDealStatus:function(b,c){var g=new Date;if(b===e||null===b)Deal.log("Cannot populateFromDealStatus for undefined/null deal obj.");else if(c===e||null===
c)Deal.log("Cannot populateFromDealStatus for undefined/null json obj.");else{if(c.lastUpdated!==e&&null!==c.lastUpdated){c.lastUpdated=parseInt(c.lastUpdated,10);if(b.status.lastUpdated!==e&&null!==b.status.lastUpdated&&b.status.lastUpdated>c.lastUpdated)return;b.status.lastUpdated=c.lastUpdated}if(!(b.dealType===Deal.dealTypes.LD&&b.status.cacheExpiresDate>g)){c.totalCouponCount!==e&&null!==c.totalCouponCount&&(b.status.totalCouponsCount=parseInt(c.totalCouponCount,10));if(c.dealState!==e&&null!==
c.dealState){b.status.dealState=c.dealState;var f=Deal.stateToTemplateMap[Deal.dealStates[c.dealState]];f!==e&&null!==f&&(b.dealState=f)}c.msToEnd!==e&&null!==c.msToEnd&&(b.status.msToEnd=parseInt(c.msToEnd,10));c.msToStart!==e&&null!==c.msToStart&&(b.status.msToStart=parseInt(c.msToStart,10),b.dealState===Deal.stateToTemplateMap.Upcoming&&0>=b.status.msToStart&&(b.dealState=Deal.stateToTemplateMap.ComingSoon));c.msCacheTtl!==e&&null!==c.msCacheTtl&&(b.status.msToCacheExpires=parseInt(c.msCacheTtl,
10));c.percentClaimed!==e&&null!==c.percentClaimed&&(b.status.percentClaimed=parseInt(c.percentClaimed,10));for(var m in c.dealItemStatus)if(null===b.dealAsinsHash[m]||b.dealAsinsHash[m]===e)f=new a(m),f.parentDealDAO=b,b.dealAsins.push(f),b.dealAsinsHash[m]=f;c.dealItemStatus!==e&&null!==c.dealItemStatus&&this.populateFromDealItemStatuses(b,c.dealItemStatus);this.initStatus(b,g);this.initAsinStatus(b);b.trigger("change",b);b.legacyDeal!==e&&null!==b.legacyDeal&&b.legacyDeal.load_status_from_deal_dao(b)}}},
populateFromDealItemStatuses:function(b,a){if(b===e||null===b)Deal.log("Cannot populateFromDealItemStatuses for undefined/null deal obj.");else if(a===e||null===a)Deal.log("Cannot populateFomDealItemStatuses for undefined/null json obj.");else{var c,f;for(f in a)b.dealAsinsHash[f]!==e&&null!==b.dealAsinsHash[f]?(c=b.dealAsinsHash[f],this.populateFromDealItemStatus(c,a[f])):Deal.log("Cannot populate itemStatus on a non-existed item for imte: "+f)}},populateFromDealItemStatus:function(b,a){if(b===e||
null===b)Deal.log("Cannot populateFromDealItemStatus for undefined/null dealAsin.");else if(a===e||null===a)Deal.log("Cannot populate DealItemStatus from undefined/null json obj.");else{if(a.lastUpdated!==e&&null!==a.lastUpdated){a.lastUpdated=parseInt(a.lastUpdated,10);if(b.status.lastUpdated!==e&&null!==b.status.lastUpdated&&b.status.lastUpdated>a.lastUpdated)return;b.status.lastUpdated=a.lastUpdated}a.totalCouponCount!==e&&null!==a.totalCouponCount&&(b.status.totalCouponsCount=parseInt(a.totalCouponCount,
10));a.customerState!==e&&null!==a.customerState&&(b.status.state=Deal.customerStates[a.customerState]);a.itemState!==e&&null!==a.itemState&&(b.status.itemState=a.itemState,Deal.itemStateToPurchaseStateMap[b.status.itemState]==Deal.dealStateEnum.SoldOut&&(b.status.percentSoldOut=100));a.msCacheTtl!==e&&null!==a.msCacheTtl&&(b.status.msToCacheExpires=parseInt(a.msCacheTtl,10));a.msToCustomerStateExpiry!==e&&null!==a.msToCustomerStateExpiry&&(b.status.msToExpiry=parseInt(a.msToCustomerStateExpiry,10));
a.percentClaimed!==e&&null!==a.percentClaimed&&(b.status.percentClaimed=parseInt(a.percentClaimed,10));a.waitlistChance!==e&&null!==a.waitlistChance&&(b.waitListStatus.chance=a.waitlistChance);a.waitlistPosition!==e&&null!==a.waitlistPosition&&(b.waitListStatus.position=parseInt(a.waitlistPosition,10));b.isCustomerClaimed=Deal.customerStates[a.customerState]===Deal.claimedStr?!0:!1}},initStatus:function(b,a){b.status.cacheExpiresDate=new Date(a.getTime()+parseInt(b.status.msToCacheExpires,10));b.status.expired=
!1;b.status.startDate=new Date(a.getTime()+parseInt(b.status.msToStart,10));b.status.started=0>=b.status.msToStart;b.status.endDate=new Date(a.getTime()+parseInt(b.status.msToEnd,10));b.status.ended=0>=b.status.msToEnd;b.claimed&&(b.claimed="1"==b.claimed);b.timeouts.startTimeout&&(k.clearTimeout(b.timeouts.startTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.startTimeout for deal: "+b.dealID));b.status.started||(b.timeouts.startTimeout=n.delay(function(){if(b.dealType===
Deal.dealTypes.LD&&Deal.hasPricingDetails(b))b.status.started=!0,b.status.msToStart=0,b.status.dealState=Deal.itemStates.Available,b.dealState=Deal.stateToTemplateMap[Deal.dealStates.AVAILABLE],_.each(b.dealAsinsHash,function(b,a,c){b.status.itemState=Deal.itemStates.Available}),b.trigger("change",b);else{var a=b.dealID;Deal.controller.dealServiceClients.DealContentService.dealsWithDetails[a]=!1;b.trigger("change",Deal.controller.getDeal("DummyDealID"));Deal.controller.dealServiceClients.DealContentService.addToGetDealsCache(a);
Deal.log("Triggering change signal on deal: "+b.dealID+" from deal.timeouts.startTimeout Trigger.")}},b.status.startDate.getTime()-(new Date).getTime()),Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.startTimeout for deal: "+b.dealID));b.timeouts.endTimeout&&(k.clearTimeout(b.timeouts.endTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.endTimeout for deal: "+b.dealID));b.status.ended||(a=b.status.endDate.getTime()-(new Date).getTime(),
b.timeouts.endTimeoutDelayed&&k.clearTimeout(b.timeouts.endTimeoutDelayed),b.timeouts.endTimeoutDelayed=Deal.setSafeTimeout(function(){b.timeouts.endTimeout=n.delay(function(){b.status.ended=!0;b.trigger("change",b);Deal.log("Triggering change signal on deal: "+b.dealID+" from deal.timeouts.endTimeout Trigger.")},b.status.endDate.getTime()-(new Date).getTime())},a),Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.endTimeOut for deal: "+b.dealID));b.timeouts.earlyAccessTimeOut&&
k.clearTimeout(b.timeouts.earlyAccessTimeOut);Deal.isDealInEarlyAccessWindow(b)&&(b.timeouts.earlyAccessTimeOut=n.delay(function(){b.status.msToStart=-b.detail.accessDurationInMs;b.trigger("change",b)},b.status.startDate.getTime()+b.detail.accessDurationInMs-(new Date).getTime()));b.timeouts.statusExpireTimeout&&(k.clearTimeout(b.timeouts.statusExpireTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.statusExpireTimeout for deal: "+b.dealID));a=b.status.cacheExpiresDate.getTime()-
(new Date).getTime();Deal.checkIfDealExpired(b)&&(new Deal.PurchaseStatusGatherer(b)).hasTimeSensitiveState()&&(a=12E3);b.timeouts.statusExpireTimeout=n.delay(function(){if(b.dealType!==Deal.dealTypes.LD||b.status.started||Deal.hasPricingDetails(b))b.status.expired=!0,b.trigger("status_expire",b),Deal.log("Triggering status_expire signal on deal: "+b.dealID+" from deal.timeouts.statusExpireTimeout Trigger.");else{var a=Deal.controller.dealServiceClients.DealContentService;a.dealsWithDetails[b.dealID]=
!1;a.addToGetDealsCache(b.dealID)}},a);Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.statusExpireTimeout for deal: "+b.dealID+" for timeout: "+(b.status.cacheExpiresDate.getTime()-(new Date).getTime()));Deal.log("DealContentServiceTranslationHelper.initStatus completed.")},initAsinStatus:function(b){if(b===e||null===b)Deal.log("Cannot operate on undefined/null deal object.");else if(b.dealType===e||null===b.dealType)Deal.log("Cannot operate on undefined/null dealType.");
else if(b.dealType!==Deal.dealTypes.LD)Deal.log("Returning initAsinStatus as NO-OP for non-LD's.");else if(b.dealAsinsHash){b.timeouts.pstatusExpiresSoon||(b.timeouts.pstatusExpiresSoon={});b.timeouts.pstatusExpire||(b.timeouts.pstatusExpire={});_.each(b.dealAsins,function(b){Deal.dealStates[b.status.itemState]===Deal.waitlistFullStr&&(b.status.currentlyUnavailable=!0)});for(var a=Deal.filterAsinsHashByState(b.dealAsinsHash,[Deal.inCartStr,Deal.expiredStr,Deal.waitInLineStr,Deal.pendingAtcStr]),c=
new Date,f=0;f<a.length;f++){var m=a[f];b.purchaseStatusWarningThreshold&&(m.status.expiresDate=new Date(c.getTime()+parseInt(m.status.msToExpiry,10)))}a.sort(Deal.sortByDealAsinDAOTimes);b.asinExpiresSoonStack=[];b.asinExpiredStack=[];for(f=0;f<a.length;f++){m=a[f];b.timeouts.pstatusExpiresSoon[m.ASIN]&&(k.clearTimeout(b.timeouts.pstatusExpiresSoon[m.ASIN]),Deal.log("DealContentServiceTranslationHelper.initAsinStatus: Clearing deal.timeouts.pstatusExpiresSoon for  ASIN: "+m.ASIN));var p=m.status.expiresDate.getTime()-
(new Date).getTime(),c=p-b.purchaseStatusWarningThreshold;0>c&&(c=0);var q=""+m.ASIN;0<p&&m.status.state!=Deal.waitInLineStr&&m.status.state!=Deal.pendingAtcStr&&(b.asinExpiresSoonStack.push(q),b.timeouts.pstatusExpiresSoon[q]=n.delay(function(){var a=b.asinExpiresSoonStack.shift();Deal.log("DealContentServiceTranslationHelper.initAsinStatus: TimeOut completed for pstatusExpiresSoon: originalStaticAsin: "+q+" tmpAsin: "+a)},c),Deal.log("DealContentServiceTranslationHelper.initAsinStatus: Timeout set for pstatusExpiresSoon for ASIN : "+
q+" for endsSoonTimeout: "+c));b.timeouts.pstatusExpire[m.ASIN]&&(k.clearTimeout(b.timeouts.pstatusExpire[m.ASIN]),Deal.log("DealContentServiceTranslationHelper.initAsinStatus: Clearing pstatusExpire for ASIN: "+m.ASIN));b.asinExpiredStack.push(q);0<p&&(b.timeouts.pstatusExpire[m.ASIN]=n.delay(function(){var a=p,c=b.asinExpiredStack.shift();a!==e&&null!==a&&0<a?b.trigger("pstatus_expire",b,c):b.trigger("change",b);Deal.log("DealContentServiceTranslationHelper.initAsinStatus: TimeOut completed for: pstatusExpire for ASIN: "+
m.ASIN+" tmpAsin: "+c)},p));Deal.log("DealContentServiceTranslationHelper.initAsinStatus: Timeout set for pstatusExpire for ASIN: "+m.ASIN+" pStatusTimeout: "+p)}Deal.log("DealContentServiceTranslationHelper.initAsinStatus completed.")}else Deal.log("No Asins, not initializing asinStatuses")},executePostTranslationRules:function(b){if(b!==e&&null!==b){if("LOCAL_DEAL"===b.dealType&&b.detail){var a=b.detail.URL;if(a){var c=a.match(/:\/\/(.[^/]+)/)[1];if(c&&c.match(/^local\./)){var f=a.split(c),c=c.replace(/^local\./,
"www."),a=f[0],f=f[1];a&&f&&(b.detail.URL=a+c+"/local"+f)}}}if(k.Deal.isPaladin&&1===k.Deal.isPaladin&&(b.detail&&(b.detail.URL=Deal.ConvertToPaladinUrl(b.detail.URL),b.detail.buyBoxURL=Deal.ConvertToPaladinUrl(b.detail.buyBoxURL)),b.dealAsinsHash))for(var m in b.dealAsinsHash)c=b.dealAsinsHash[m],null!==c&&c!==e&&(c.egressUrl=Deal.ConvertToPaladinUrl(c.egressUrl),c.ingressUrl=Deal.ConvertToPaladinUrl(c.ingressUrl))}}})});l.when("A","gb-udp-event-emitter").register("gb-deals-interface",function(e,
a){return a.extend({defaults:{versionInfo:null},baseRetryInterval:6E4,continueRequests:!0,timeout:3E5,maxRetries:1,marketplace_id:"1",includeVariations:"True",customer_id:"",session_id:null,translationHelper:null,log_attribution_name:"GoldboxUDPAssets",log_level_error:"ERROR",response_error_handling:{service_not_available:{response_code:503},throttling_exception:{response_code:400,response_message_pattern:/Rate exceeded/},request_failed_message:"Request failed",retries_timed_out_message:"Retries timed out"},
filter:{},statuses:{},browseNodes:null,ordering:null,controllerReference:null,init:function(){this._super()},_execErrorCallback:function(a){var b;b="";try{b=JSON.stringify(a.errorResponse)}catch(d){l.log("Could not serialize object: "+d.toString(),this.log_level_error,this.log_attribution_name)}b=[a.messagePrefix," ",a.url,b].join("");a.error(Error(b))},ajax_with_retries:function(a,b){var d=this,g=new Date,f=0,m,p=a.retryInterval||this.baseRetryInterval||6E4;delete a.retryInterval;var q=a.error;delete a.error;
a.retry&&(m=a.retry,delete a.retry);var r=a.success;a.success=function(d,e,m){"function"===typeof m.getResponseHeader&&m.getResponseHeader("X-CSRFToken")&&gbResources&&"function"===typeof gbResources.registerCustomerData&&gbResources.registerCustomerData({csrfToken:m.getResponseHeader("X-CSRFToken")});d&&Deal.parseBool(d.retry)?a.error():(b&&(b.isRetry=0<f,b.isSuccess=!0,b.latency=(new Date).getTime()-g.getTime(),Deal.recordAPIMetrics(b)),r(d,m))};var k=function(){d.continueRequests?(a.url=Deal.setURLParameter(a.url,
"nocache",(new Date).getTime()),a.error=function(r){var l=!0;b&&(b.isRetry=0<f,b.isSuccess=!1,b.latency=(new Date).getTime()-g.getTime(),Deal.recordAPIMetrics(b));if(r&&r.status===d.response_error_handling.service_not_available.response_code||r&&r.status===d.response_error_handling.throttling_exception.response_code&&r.responseText&&r.responseText.match(d.response_error_handling.throttling_exception.response_message_pattern))return d._execErrorCallback({messagePrefix:d.response_error_handling.request_failed_message,
url:a.url,errorResponse:r,error:q});a.url=Deal.setURLParameter(a.url,"retrying",1);if(m){var v=d.getRetryInterval(++f);f>d.maxRetries&&(d._execErrorCallback({messagePrefix:d.response_error_handling.retries_timed_out_message,url:a.url,errorResponse:r,error:q}),l=!1)}else v=p*(1+Math.pow(2,f++)*Math.random()),v+(new Date).getTime()-g.getTime()>d.timeout&&(d._execErrorCallback({messagePrefix:d.response_error_handling.retries_timed_out_message,url:a.url,errorResponse:r,error:q}),l=!1);l&&(Deal.log("Retrying after "+
v+"ms"),"function"===typeof m&&m(),e.delay(k,v))},e.$.ajax(a)):q(Error("continueRequests is false. No more requests should be made "+a.url))};k()},next_id:100,getRetryInterval:function(a){return Math.pow(2,a-1)*(this.baseRetryInterval+Deal.getRandomNumber(-1E3,1E3))}})});l.when("A","gb-deals-interface","gb-deal-content-service-translation-helper","gb-deal-custom-integration-service").register("gb-deal-redemption-service",function(e,a,c,b){var d=e.$;return a.extend({baseRetryInterval:4E3,endPoint:"/gp/deal/ajax/v2/claimDeal.html",
maxRetries:1,translationHelper:null,dealCustomIntegrationService:null,clientId:"goldbox",init:function(a){this._super();d.extend(this,gbResources.getApiConfigs(Deal.apiShortName.CLAIM_DEAL));this.translationHelper=new c;this.dealCustomIntegrationService=new b},claimDeal:function(a,b,c,d,e,r,k){var n=this.endPoint,l;gbResources&&"function"===typeof gbResources.getCustomerData&&gbResources.getCustomerData("csrfToken")&&(l=function(a){a.setRequestHeader("X-CSRFToken",gbResources.getCustomerData("csrfToken"))});
n+="/ref\x3d"+c+"?dealId\x3d"+a+"\x26itemId\x3d"+b+"\x26quantity\x3d"+d+"\x26clientId\x3d"+this.clientId;n=this.dealCustomIntegrationService.appendCustomArgumentsToEndpoint(n);this.call(n,{},e,r,{apiName:Deal.apiName.CLAIM_DEAL,clientId:this.clientId},k,l)},call:function(a,b,c,d,e,r,k){a={success:function(a,b){c(a,b)},error:d,retry:r,url:a,type:"POST",data:JSON.stringify(b),dataType:"json"};k&&(a.beforeSend=k);this.ajax_with_retries(a,e)}})});l.when("A","jQuery","gb-udp-event-emitter").register("gb-mnss-service",
function(k,a,c){return c.extend({base_retry_interval:2E4,continue_requests:!0,customer_id:"",session_id:null,timeout:3E5,init:function(a){this._super();this.customer_id=gbResources.getCustomerData("customerId");this.session_id=gbResources.getCustomerData("sessionId")},ajax_with_retries:function(b){var c=this,g=new Date,f=0,e=b.retryInterval||this.base_retry_interval||6E4;delete b.retryInterval;var p=b.error;delete b.error;var q=function(){c.continue_requests?(-1==b.url.indexOf("?")?b.url=b.url+"?nocache\x3d"+
(new Date).getTime():b.url=b.url+"\x26nocache\x3d"+(new Date).getTime(),b.error=function(a){var b=e*(1+Math.pow(2,f++)*Math.random());b+(new Date).getTime()-g.getTime()>c.timeout?p(Error("Retries timed out"+JSON.stringify(a))):(Deal.log("retrying after "+b+"ms"),k.delay(q,b))},a.ajax(b)):p(Error("continue_requests is false: no more requests should be made."))};q()},call:function(a,c,g,f,m){a={success:g,error:f,url:a,type:"POST",data:JSON.stringify(c),dataType:"json"};m!==e&&(a.retryInterval=m);this.ajax_with_retries(a)},
register_for_notifications:function(a,c,g){this.call("/gp/deal/ajax/registerForNotifications.html/ref\x3dgb_mshop?customer\x3d"+this.customer_id+"\x26sessionId\x3d"+this.session_id+"\x26token\x3d"+a.pushToken+"\x26application\x3d"+a.appID+"\x26protocol\x3d"+a.protocol,{},c,g,this.base_retry_interval)}})});l.when("A","gb-deals-interface","gb-deal-content-service-translation-helper","gb-csm").register("gb-deal-content-service",function(n,a,c,b){var d=n.$;return a.extend({client_id:"goldbox",continueRequests:!0,
baseRetryInterval:6E4,timeout:3E5,maxRetries:0,customer_id:null,dealsPerPage:null,marketplace_id:null,page:1,session_id:null,translationHelper:null,getDealsMaxJitter:Deal.constants.GET_DEALS_MAX_JITTER,widgetMetadataCache:{},selectDealsRequestArgs:{},uniqueSelectDealsRequestArgs:[],onGoingSelectDealsRequest:{},widgetIdToArgs:{},firstGetDeals:{},dealsWithDetails:{},dealStateFilter:{available:["AVAILABLE"],missed:["EXPIRED","SOLDOUT"],expired:["EXPIRED"],upcoming:["UPCOMING"],soldout:["SOLDOUT"]},getDealsCache:[],
init:function(a){this._super();this.customer_id=gbResources.getCustomerData("customerId");this.marketplace_id=gbResources.getCustomerData("marketplaceId");this.session_id=gbResources.getCustomerData("sessionId");d.extend(this,gbResources.getApiConfigs(Deal.apiShortName.GET_DEAL_STATUS));a&&a.client_id&&(this.client_id=a.client_id);this.translationHelper=new c},addToGetDealsCache:function(a){var b=this;null===a||a===e?Deal.log("addToGetDealsCache called with null/undefined dealID"):_.contains(b.getDealsCache,
a)||(b.getDealsCache.push(a),1===b.getDealsCache.length&&n.delay(function(){var a=[];_.each(b.getDealsCache,function(c){b.dealsWithDetails[c]||a.push(c)});b.getDealsCache=[];a.length&&b.get_Deals(a,Deal.controller,!1)},Math.floor(Math.random()*b.getDealsMaxJitter*1E3)+500))},getMetadataCacheWidgets:function(){return _.map(_.keys(this.widgetMetadataCache),function(a){return parseInt(a,10)}).sort()},processWidgetMetadataCache:function(a){for(var b=this.getMetadataCacheWidgets(),c=0;c<b.length;c++){var d=
b[c];this.isReadyToLoadMetadata(d,a)&&this.processWidgetMetadataCacheEntry(d,a)}},processWidgetMetadataCacheEntry:function(a,b){b.trigger("process_selectdeals_metadata"+a,a,this.widgetMetadataCache[a]);delete this.widgetMetadataCache[a]},isReadyToLoadMetadata:function(a,b){if(b.disableDeduping[a])return!0;b=b.getWidgetsToLoadMetadata(a);b.push(a);for(a=0;a<b.length;a++)if(!(b[a]in this.widgetMetadataCache))return!1;return!0},call:function(a,b,c,d,q,r){a={success:function(a,b){c(a,b)},error:d,url:a,
type:"POST",data:JSON.stringify(b),dataType:"json"};q!==e&&(a.retryInterval=q);this.ajax_with_retries(a,r)},getDeals:function(a,b,c,p,q,r,k,n){if(a===e||null===a)Deal.log("Need a proper controller reference to getDeals.");else if(b===e||null===b)Deal.log("Cannot getDeals for an undefined/null widgetID.");else{this.firstGetDeals[b]===e&&(this.firstGetDeals[b]=!0);a.listOfDeals[b]=[];var l=this;a.on("startGetDealStatusesAdhoc",function(b){for(var c=[],d=0;d<b.length;d++){var f=b[d];l.dealsWithDetails[f]||
(c.push(f),l.dealsWithDetails[f]=!0)}c.length&&l.get_Deals(c,a)});var v=function(c){delete l.onGoingSelectDealsRequest[b];Deal.log("Select Deals call returned.");a.off("selectdeals_change"+b,v);c===e||null===c?Deal.log("Cannot populateGetDeals data with undefined/null data."):(a.on("process_selectdeals_metadata"+b,function(b,c){Deal.log("Processing SelectDealsMetadataResponse for widgetID "+b);if(b===e||null===b)Deal.log("Cannont processSelectDealsMetadataResponse for null/undefined widgetID");else if(c===
e||null===c)Deal.log("Cannont processSelectDealsMetadataResponse for null/undefined metadataCacheEntry");else{var d=c.callingParams;l.translationHelper.populateFromSelectDealsMetadata(b,c.responseData);a.hasMetadata[b]=!0;a.trigger("metadata_change"+b);a.setOrdering(b,d.ordering);a.setFilter(b,d.filter);a.setCells(b,d.cells);a.trigger("startGetDealsConnectionWiring"+b);a.setPage(b,d.page)}}),l.widgetMetadataCache[b]={responseData:c,callingParams:{ordering:q,filter:r,cells:p,page:k}},l.processWidgetMetadataCache(a))},
x=function(){var c=[],d=Deal.getPaginationCellPositions(k,p,a.dealIDs[b].length,a.disablePagination[b]);a.listOfDeals[b]=[];for(var e=0;e<d.length;e++){var m=d[e],h=a.dealIDs[b][m],q=a.getDeal(h);null!==q&&(c.push(h),Deal.connectionManager.connectDealExpire(a,b,q),m<p*k&&m>=p*(k-1)&&a.listOfDeals[b].push(q))}a.trigger("startGetDealStatusesAdhoc",c);a.off("startGetDealsConnectionWiring"+b);a.trigger("startCellChangeAndStatusConnectionWiring"+b,a.listOfDeals[b])},t=a.getWidgetParams(b);n!==e&&null!==
n&&d.extend(!0,t,n);this.selectDealsRequestArgs[b]===e&&(this.selectDealsRequestArgs[b]=t);n=this.requestArgsExist(t);n||(this.selectDealsRequestArgs[b]=t,this.uniqueSelectDealsRequestArgs.push(t));!1!==this.firstGetDeals[b]||n||(this.firstGetDeals[b]=!0);if(!0===this.firstGetDeals[b])if(this.firstGetDeals[b]=!1,n&&this.onGoingSelectDealsRequestForArgs(t)&&this.onGoingSelectDealsRequest[b]===e){if(this.onGoingSelectDealsRequest[b]=!0,c=function(c){delete l.onGoingSelectDealsRequest[b];a.trigger("selectdeals_change"+
b,c)},t=this.currentWidgetIdForArgs(t),t!==e||null!==t)a.on("selectdeals_change"+b,v),a.on("startGetDealsConnectionWiring"+b,x),a.on("selectdeals_change"+t,c)}else a.on("selectdeals_change"+b,v),a.on("startGetDealsConnectionWiring"+b,x),this.onGoingSelectDealsRequest[b]=!0,this.recordArgs(b,t),this.select_deals(b,p,t,a);else a.metadata.checkIfStatusFilterSeen(b,c)&&this.onGoingSelectDealsRequest[b]===e&&(a.on("startGetDealsConnectionWiring"+b,x),a.trigger("startGetDealsConnectionWiring"+b))}},get_deal_statuses:function(a,
c){var d=b.getAjaxMetricLogger("dcs-get-deal-status").recordStart(),e=this,q=e.get_getDealStatuses_request_data(a);e.call("/xa/dealcontent/v2/GetDealStatus",q,function(b,q){d.recordComplete(q);q={};var k,n;for(k in b.dealStatus)n=b.dealStatus[k],a[k][0](n),q[k]=!0;var l=e._deal_ids_to_item_ids_from_callbacks(a);for(n=0;n<l.length;n++)if(k=l[n].dealID,!q[k])a[k][1](Error("No status returned for dealID "+k));e.translationHelper.populateFromGetDealStatuses(b.dealStatus,c);d.recordFeatureComplete().publishAjaxMetrics()},
function(b){var c,d,f=e._deal_ids_to_item_ids_from_callbacks(a);for(c=0;c<f.length;c++)d=f[c].dealID,a[d][1](b)},null,{apiName:Deal.apiName.GET_DEAL_STATUS,clientId:e.client_id})},get_Deals:function(a,c,d){var e=b.getAjaxMetricLogger("dcs-get-deal").recordStart(),q=this;d=q.getDeals_request_Data(a,d);q.call("/xa/dealcontent/v2/GetDeals",d,function(a,b){e.recordComplete(b);for(var d in a.dealDetails)b=c.getDeal(d),q.translationHelper.populateFromGetDeals(b,a.dealDetails[d]);q.translationHelper.populateFromGetDealStatuses(a.dealStatus,
c);e.recordFeatureComplete().publishAjaxMetrics()},function(b){for(b=0;b<a.length;b++)q.dealsWithDetails[a[b]]=!1},null,{apiName:Deal.apiName.GET_DEALS,clientId:q.client_id})},get_getDealStatuses_request_data:function(a){a=this._deal_ids_to_item_ids_from_callbacks(a);a={requestMetadata:{marketplaceID:this.marketplace_id,clientID:this.client_id,sessionID:this.session_id},dealTargets:a,responseSize:"STATUS_ONLY",itemResponseSize:"NONE"};null!==this.customer_id&&""!==this.customer_id&&(a.requestMetadata.customerID=
this.customer_id);return a},getDeals_request_Data:function(a,b){var c=a.sort();a=[];for(var d=0;d<c.length;d++)a.push({dealID:c[d]});a={requestMetadata:{marketplaceID:this.marketplace_id,clientID:this.client_id,sessionID:this.session_id},dealTargets:a,responseSize:"ALL",itemResponseSize:"DEFAULT_WITH_PREEMPTIVE_LEAKING"};b||null===this.customer_id||""===this.customer_id||(a.requestMetadata.customerID=this.customer_id);return a},requestArgsExist:function(a){if(a===e||null===a)return Deal.log("Cannot check if request args exist for undefined/null args."),
!1;if(0===this.uniqueSelectDealsRequestArgs.length)return!1;for(var b,c=0;c<this.uniqueSelectDealsRequestArgs.length;c++)if(b=this.uniqueSelectDealsRequestArgs[c],Deal.objectsIdentical(b,a))return!0;return!1},onGoingSelectDealsRequestForArgs:function(a){if(a===e||null===a)return Deal.log("Cannot check if onGoingSelectDealsRequestForArgs exist for undefined/null args."),!1;a=this.currentWidgetIdForArgs(a);return this.onGoingSelectDealsRequest[a]?!0:!1},currentWidgetIdForArgs:function(a){if(a===e||
null===a)return Deal.log("Cannot check if request args exist for undefined/null args."),null;for(var b in this.widgetIdToArgs)for(var c=0;c<this.widgetIdToArgs[b].length;c++)if(Deal.objectsIdentical(a,this.widgetIdToArgs[b][c]))return b;return null},recordArgs:function(a,b){a===e||null===a?Deal.log("Cannot recordArgs for undefined/null widgetID."):b===e||null===b?Deal.log("Cannot recordArgs for undefined/null args."):(this.widgetIdToArgs[a]===e&&(this.widgetIdToArgs[a]=[]),this.widgetIdToArgs[a].push(b))},
_deal_ids_to_item_ids_from_callbacks:function(a){a=_.keys(a).sort();for(var b=[],c=0;c<a.length;c++)b.push({dealID:a[c],itemIDs:null});return b},get_deal_status:function(a,b,c,d){return this._add_request("get_deal_status",a,b,c,d)},next_id:100,_pending:{select_deals:{current:!1,timeout:e,deal_ids:{}},get_deal_status:{current:!1,timeout:e,deal_ids:{}}},_add_request:function(a,b,c,d,q){var k=this._pending[a];k.deal_ids[b]===e&&(k.deal_ids[b]={});var n=k.deal_ids[b],l=this.next_id++;b={cancel:function(){delete n[l];
this.cancel=function(){throw Error("already cancelled");}},success:c,error:d};n[l]=b;this._start_request_timer(a,q);return b},_start_request_timer:function(a,b){var c=this,d=c._pending[a];d.current||(d.timeout&&k.clearTimeout(d.timeout),d.timeout=n.delay(function(){d.timeout=e;c._start_request(a,b)},0))},_start_request:function(a,b){var c=this,d=c._pending[a];d.timeout&&(k.clearTimeout(d.timeout),d.timeout=e);if(!d.current){var q=[],n={},l;for(l in d.deal_ids){if(10<=q.length)break;var E=!1,y;for(y in d.deal_ids[l]){E=
!0;break}if(!E){delete d.deal_ids[l];break}d.deal_ids[l].current||(d.deal_ids[l].current=!0,q.push(l),function(d){n[d]=[function(e){c._request_success(a,d,e,b)},function(e){c._request_error(a,d,e,b)}]}(l))}0!==q.length&&"get_deal_status"==a&&c.get_deal_statuses(n,b)}},_request_success:function(a,b,c,d){var q=this._pending[a];q.current=!1;var k=q.deal_ids[b];if(k!==e){delete q.deal_ids[b];delete k.current;for(var n in k)k[n].success(c)}this._start_request_timer(a,d)},_request_error:function(a,b,c,
d){var k=this._pending[a];k.current=!1;var n=k.deal_ids[b];if(n!==e){delete k.deal_ids[b];delete n.current;for(var l in n)n[l].error(c)}this._start_request_timer(a,d)},get_deal_asin_status2:function(){return{cancel:function(){}}},get_deal:function(){return{cancel:function(){}}}})});l.when("A","deals-custom-integration-installments").register("gb-deal-custom-integration-service",function(e,a){var c=e.$;return e.createClass({requiredFunctions:"isIntegrationActive appendArgumentsToEndpoint handleClaimDealSuccess handleClaimDealError handleClaimDealRetry handleLDBuyBoxSelected handleRegularBuyBoxSelected".split(" "),
registeredIntegrations:[new a],init:function(){this.bindEvents()},bindEvents:function(){e.on("deals_claimDealSuccess",c.proxy(function(){this.executeEventHandler("handleClaimDealSuccess")},this));e.on("deals_claimDealError",c.proxy(function(){this.executeEventHandler("handleClaimDealError")},this));e.on("deals_claimDealRetry",c.proxy(function(){this.executeEventHandler("handleClaimDealRetry")},this));e.on("deals_onSelectLDBuybox",c.proxy(function(){this.executeEventHandler("handleLDBuyBoxSelected")},
this));e.on("deals_onSelectRegularBuybox",c.proxy(function(){this.executeEventHandler("handleRegularBuyBoxSelected")},this))},appendCustomArgumentsToEndpoint:function(a){var d=a;c.each(this.registeredIntegrations,function(a,b){b.isActive&&(d+=b.appendArgumentsToEndpoint())});return d},executeEventHandler:function(a){c.each(this.registeredIntegrations,function(c,g){if(g.isActive)g[a]()})}})});l.when("A","gb-udp-event-emitter").register("gb-deal-config-manager",function(e,a){return a.extend({init:function(a){this._super();
if(!a)throw Error("Cannot initialize configManager with empty params.");a.dealContentServiceConfig&&(this.dealContentServiceConfig=a.dealContentServiceConfig);a.controllerConfig&&(this.controllerConfig=a.controllerConfig)},getWidgetConfig:function(a){return this[a]},getControllerConfig:function(){return this.controllerConfig},getABTestingConfig:function(){return this.abTestingConfig},getDealContentServiceConfig:function(){return this.dealContentServiceConfig},getDealViewTemplate:function(a,b){var d=
"";return a&&b?Deal.configManager[a]&&Deal.configManager[a].dealViewConfig&&Deal.configManager[a].dealViewConfig.templates&&Deal.configManager[a].dealViewConfig.templates[b]?d=Deal.configManager[a].dealViewConfig.templates[b]:(Deal.log("No entry exists for specified widgetName/templateName"),d):(Deal.log("No widget or template name specified."),d)},getWidgetViewTemplate:function(a,b){var d="";return a&&b?Deal.configManager[a]&&Deal.configManager[a].templates&&Deal.configManager[a].templates[b]?d=
Deal.configManager[a].templates[b]:d:(Deal.log("No widget or template name specified."),d)}})});l.when("A").execute("gb-udp-connection-manager",function(l){k.Deal||(k.Deal={});Deal.connectionManager={connections:{},dealObjectToCallBacks:[],nextSignalID:100,signals:{cell_change:{},pstatus_expire:{},page_change:{},metadata_change:{}},registerWidgetConnections:function(a){_.each(this.signals,function(c){c[a]={}});this.connections[a]===e&&(this.connections[a]=[])},connectDealExpire:function(a,c,b){if(!Deal.watcher.doesCallBackExist(b.dealID,
"expire")){var d=function(b){var d=a.dealServiceInstance[c].get_deal(b.dealID,function(d){b.off("cancelGetDealRequest");a.dealServiceInstance[c].translationHelper.populateFromGetDeals(b,d)},function(a){Deal.log("Error getting deal: "+a+" stack: "+a.stack)});b.on("cancelGetDealRequest",function(){d.cancel();b.off("cancelGetDealRequest")})};b.on("expire",d);this.dealObjectToCallBacks.push({signalName:"expire",scope:b,callBackValue:d});Deal.watcher.addCallBack(b.dealID,"expire")}(b.expired||b.loading)&&
b.trigger("expire",b)},connectDealChange:function(a,c,b,d){var g=function(d){a.trigger("cell_change"+c,{cell:b,deal:d})};d.on("change",g);this.connections[c].push({signalName:"change",scope:d,callBackValue:g})},connectPstatusExpire:function(a,c,b,d){var g=function(d,g){if(d.dealAsinsHash!==e&&null!==d.dealAsinsHash&&1>=_.keys(d.dealAsinsHash).length){var k=Deal.findBackBoneDealAsin(d);k!==e&&null!==k&&k.status!==e&&null!==k.status&&k.status.state!==e&&null!==k.status.state&&(d.lastPstatusExpireState=
k.status.state,!Deal.checkIfDealExpired(d)||k.status.state!==Deal.inCartStr&&k.status.state!==Deal.pendingAtcStr||(k.status.state="Expired",d.trigger("change",d)));d.checkingDealStatusTimeout=l.delay(function(){d.lastPstatusExpireState="";delete d.checkingDealStatusTimeout},4E4)}d.trigger("status_expire",d);a.trigger("pstatus_expire"+c,{cell:b,deal:d,expiring_asin:g})};d.on("pstatus_expire",g);this.connections[c].push({signalName:"pstatus_expire",scope:d,callBackValue:g})},connectDealStatusExpire:function(a,
c,b){if(!Deal.watcher.isDealBeingWatched(b.dealID,c)){var d=function(b){var d=a.dealServiceInstance[c].get_deal_status(b.dealID,function(d){b.off("cancelGetDealStatusRequest");a.dealServiceInstance[c].translationHelper.populateFromGetDealStatus(b,d)},function(a){Deal.log("Error getting status: "+a+" stack: "+a.stack)},a);b.on("cancelGetDealStatusRequest",function(){d.cancel();b.off("cancelGetDealStatusRequest")});var e=a.dealServiceInstance[c].get_deal_asin_status2(b.dealID,function(d){b.off("cancelGetDealAsinStatusRequest");
a.dealServiceInstance[c].translationHelper.populateFromGetDealAsinStatus(b,d);b.trigger("change",b)},function(a){Deal.log("Error with GetDealAsinStatus("+b.dealID+"): "+a)});b.on("cancelGetDealAsinStatusRequest",function(){e.cancel();b.off("cancelGetDealAsinStatusRequest")})};b.on("status_expire",d);this.dealObjectToCallBacks.push({signalName:"status_expire",scope:b,callBackValue:d})}!b.status.expired||b.expired||b.loading||b.trigger("status_expire",b)},connectSignal:function(a,c,b,d,g){if(a===e||
null===a||c===e||null===c||b===e||null===b||d===e||null===d||g===e||null===g)throw Error("Please provide a valid scope, signalName, widgetID, functionName");if(this.signals[c]===e)throw Error("Please provide a valid scope, signalName, widgetID, functionName");if(this.signals[c][b]===e)throw Error("Please provide a valid scope, signalName, widgetID, functionName");var f=this.nextSignalID,k;g!==e&&(k=g[d],g.on(c+b,k),d=function(a){g.trigger(c+b,a)});a.on(c+b,d);this.signals[c][b][f]={callBackValue:d,
scope:g,scopeCallBackValue:k};this.nextSignalID++;return{widgetID:b,id:f}},disconnectCurrentPageSignals:function(a,c){_.each(a.dealsInCurrentView[c],function(a){Deal.watcher.unwatchDeal(a.dealID,c)});_.each(a.dealsInNextView[c],function(a){Deal.watcher.unwatchDeal(a.dealID,c)});a.dealsInCurrentView[c]=[];a.dealsInNextView[c]=[];for(a=0;a<this.dealObjectToCallBacks.length;a++){var b=this.dealObjectToCallBacks[a];if(b!==e&&null!==b&&b.scope&&b.signalName&&b.scope.dealID){var d=b.scope;Deal.watcher.isDealBeingWatched(d.dealID)||
("expire"===b.signalName&&Deal.watcher.doesCallBackExist(d.dealID,"expire")&&(d.trigger("cancelGetDealRequest"),Deal.watcher.removeCallBack(d.dealID,"expire")),"status_expire"===b.signalName&&(d.trigger("cancelGetDealStatusRequest"),d.trigger("cancelGetDealAsinStatusRequest")),d.off(b.signalName,b.callBackValue),this.dealObjectToCallBacks.splice(_.indexOf(this.dealObjectToCallBacks,b),1),--a)}}for(a=0;a<this.connections[c].length;a++)b=this.connections[c][a],b!==e&&null!==b&&b.scope&&b.signalName&&
b.scope.dealID&&("change"===b.signalName||"pstatus_expire"===b.signalName)&&(b.scope.off(b.signalName,b.callBackValue),this.connections[c].splice(_.indexOf(this.connections[c],b),1),--a)}}});l.when("A","gb-udp-deal-watcher","gb-mnss-service","gb-deal-content-service","gb-deal-content-service-translation-helper","gb-deal-redemption-service","gb-udp-deal-dao","gb-udp-event-emitter","gb-csm").register("gb-udp-controller",function(n,a,c,b,d,g,f,m,p){return m.extend({loginURI:null,deals:{},buying:{},connections:{},
cells:{},cellToDeal:{},page:{},pages:{},widgetIdToWidgetNameMap:{},dealIDs:{},dealsInCurrentView:{},dealsInNextView:{},dealServiceClass:null,dealServiceInstance:null,dealRedemptionServiceClient:null,mnssInstance:null,dealServiceConfig:null,dealServiceVersion:null,buyboxWidgetID:200,nextWidgetID:200,varRedemptionCallback:{},canCustomerClaimPrimeOnlyDOTD:!0,isCustomerClaimingPrimeOnlyDOTD:!1,init:function(f){this._super();if(f!==e&&0!==f.length){this.login_uri=f.login_uri;this.dealServiceConfig=Deal.configManager.getDealContentServiceConfig();
this.dealServiceInstance=new b(this.dealServiceConfig);this.dcsTranslationHelper=new d;this.dealRedemptionServiceClient=new g;this.mnssInstance=new c;Deal.watcher=new a;f=Deal.getParameterByName("updateCart");var k=Deal.getParameterByName("cartQuantity");"1"==f&&this._updateNavCartQty(k)}else Deal.log("Error: Cannot instantiate UDPDealController with no Model/Config data")},registerWidget:function(a){if(a===e||!a)return Deal.log("Cannot register undefined/null widgetID"),null;var b=this.nextWidgetID;
this.widgetIdToWidgetNameMap[b]=a;Deal.connectionManager.registerWidgetConnections(b);this.cellToDeal[b]===e&&(this.cellToDeal[b]={});this.dealServiceInstance[b]=this.dealServiceInstance;this.dealIDs[b]===e&&(this.dealIDs[b]=[]);this.dealsInCurrentView[b]===e&&(this.dealsInCurrentView[b]=[]);this.dealsInNextView[b]===e&&(this.dealsInNextView[b]=[]);this.varRedemptionCallback[b]===e&&(this.varRedemptionCallback[b]=null);this.page[b]=1;this.nextWidgetID++;return b},getWidget:function(a){for(var b in Deal.Widgets)if(Deal.Widgets[b].widgetName===
a)return Deal.Widgets[b];return null},getDeal:function(a){return this.deals!==e?(this.deals[a]===e&&(this.deals[a]=new f(a),Deal.log("UDPDealController.getDeal: Created a new DealDAO obj for dealID: "+a)),this.deals[a]):null},setPageDealID:function(a,b){Deal.log("UDPDealController.setPageDealID called");var c;c=b.dealId;a!==e&&a?c!==e&&c?(Deal.connectionManager.disconnectCurrentPageSignals(this,a),c=this.getDeal(c),this.cellToDeal[a][0]=c,this.dealsInCurrentView[a].push(c),Deal.connectionManager.connectDealChange(this,
a,0,c),Deal.connectionManager.connectPstatusExpire(this,a,0,c),Deal.connectionManager.connectDealStatusExpire(this,a,c),this.dcsTranslationHelper.populateFromGetDealStatuses(b.dealStatus,this),this.trigger("cell_change"+a,{cell:0,deal:c}),Deal.watcher.watchDeal(c,a)):Deal.log("Cannot setPageDealID on undefined dealID"):Deal.log("Cannot setPageDealID on undefined widgetID")},redemptionCallback:function(a,b){if(this.varRedemptionCallback[a])this.varRedemptionCallback[a](b)},setRedemptionCallback:function(a,
b){this.varRedemptionCallback[a]=b},registerForNotifications:function(a){this.mnssInstance.register_for_notifications(a,function(){Deal.log("Registered customer for notification")},function(){Deal.log("Error registering customer for notification")})},claimDeal:function(a,b,c,d,e){var g=this,f=g.cellToDeal[a][0];e||(e=1);if(!g.buying[f.dealID]){g.buying[f.dealID]=!0;var k=p.getAjaxMetricLogger("drs-claim-deal").recordStart();g.dealRedemptionServiceClient.claimDeal(b,c,d,e,function(b,d){k.recordComplete(d);
Deal.isPrimeOnlyDotd(f)&&(g.isCustomerClaimingPrimeOnlyDOTD=!0,b&&b.errorCode===Deal.constants.NON_RETRYABLE_QUANTITY_RESTRICTION_VIOLATION_ERROR&&(g.canCustomerClaimPrimeOnlyDOTD=!1,g._updateNavCartQty(b.currentCartQuantity)));if(b&&b.dealItemStatus){g.dealRedemptionServiceClient.translationHelper.translateClaimDealResponse(f,c,b);var e=Deal.customerStates[b.dealItemStatus.customerState];if(e===Deal.inCartStr||e===Deal.waitInLineStr)g.redemptionCallback(a,c),l.when("A").execute(function(a){a=a.$;
a("#gb_in_cart_co").trigger("redeemed",e)});g._updateNavCartQty(b.currentCartQuantity);f.legacyDeal&&g.registerDealWithNotifier(c,f.legacyDeal)}delete g.buying[f.dealID];d=b.errorCode===Deal.constants.NON_RETRYABLE_QUANTITY_RESTRICTION_VIOLATION_ERROR;"undefined"===typeof b.retry||d?f.trigger("change",f):g.redemptionCallback(a,null);k.recordFeatureComplete().publishAjaxMetrics();n.trigger("deals_claimDealSuccess")},function(b){var c=n.$,d=function(){g.redemptionCallback(a,null);delete g.buying[f.dealID];
f.trigger("change",f)};0<c(".deal_atc_progress").length&&0<c("#deal_redemption_retry_failure_msg").length?(c(".deal_atc_progress").addClass("a-hidden"),c("#deal_redemption_retry_failure_msg").removeClass("a-hidden"),n.delay(function(){c(".deal_atc_progress").addClass("a-hidden");c("#deal_processing_msg").removeClass("a-hidden");d()},3E3)):d();n.trigger("deals_claimDealError")},function(){l.when("A").execute(function(a){var b=a.$;0<b(".deal_atc_progress").length&&0<b("#deal_redemption_retry_msg").length&&
(b(".deal_atc_progress").addClass("a-hidden"),b("#deal_redemption_retry_msg").removeClass("a-hidden"));a.trigger("deals_claimDealRetry")})})}},_updateNavCartQty:function(a){l.when("nav.setCartCount").execute(function(b){b(a)});l.when("mash").execute(function(b){b.cart.didUpdate({newCartQuantity:parseInt(a,10)})})},registerDealWithNotifier:function(a,b){k.dealNotifier&&dealNotifier.registerDeal(a,b)}})});l.when("A","gb-udp-event-emitter").register("gb-udp-deal-watcher",function(k,a){return a.extend({activeDealsHash:{},
callbackHash:{},asinImpressionsHash:{},hasRendered:{},hasImpressions:[],init:function(){this._super()},doesCallBackExist:function(a,b){return a===e||null===a||b===e||null===b?(Deal.log("DealWatcher.doesCallBackExist called with null/undefined dealID/signalName"),!1):this.callbackHash[a]===e?!1:_.contains(this.callbackHash[a],b)},addCallBack:function(a,b){a===e||null===a||b===e||null===b?Deal.log("DealWatcher.addCallBack called with null/undefined dealID/signalName"):(this.callbackHash[a]===e&&(this.callbackHash[a]=
[]),_.contains(this.callbackHash[a],b)||this.callbackHash[a].push(b))},removeCallBack:function(a,b){a===e||null===a||b===e||null===b?Deal.log("DealWatcher.removeCallBack called with null/undefined dealID/signalName"):this.callbackHash[a]!==e&&_.contains(this.callbackHash[a],b)&&(this.callbackHash[a].splice(_.indexOf(this.callbackHash[a],b),1),0===this.callbackHash[a].length&&delete this.callbackHash[a])},isDealBeingWatched:function(a,b){return a===e||null===a?(Deal.log("DealWatcher.isDealBeingWatched called with null/undefined dealID"),
!1):this.activeDealsHash[a]===e?!1:b===e?!0:_.contains(this.activeDealsHash[a].widgetIDs,b)},watchDeal:function(a,b){var d=a.dealID;d===e||null===d||b===e||null===b?Deal.log("DealWatcher.watchDeal called with null/undefined dealID/widgetID"):(this.activeDealsHash[d]===e&&(this.activeDealsHash[d]={deal:a,widgetIDs:[]}),_.contains(this.activeDealsHash[d].widgetIDs,b)||this.activeDealsHash[d].widgetIDs.push(b))},unwatchDeal:function(a,b){a===e||null===a||b===e||null===b?Deal.log("DealWatcher.unwatchDeal called with null/undefined dealID/widgetID"):
this.activeDealsHash[a]!==e&&_.contains(this.activeDealsHash[a].widgetIDs,b)&&(this.activeDealsHash[a].widgetIDs.splice(_.indexOf(this.activeDealsHash[a].widgetIDs,b),1),0===this.activeDealsHash[a].widgetIDs.length&&delete this.activeDealsHash[a])}})});l.when("A","gb-udp-deal-view","gb-udp-deal-asin-dao","gb-udp-event-emitter").register("gb-udp-deal-widget",function(k,a,c,b){return b.extend({dealViews:{},widgetID:0,widgetName:"",pushNotificationDetails:{},init:function(a){this._super();a!==e&&null!==
a&&(this.widgetID=Deal.udpController.registerWidget(a),this.widgetName=a);this.registerSignals()},registerSignals:function(){Deal.connectionManager.connectSignal(Deal.udpController,"page_change",this.widgetID,"pageChange",this);Deal.connectionManager.connectSignal(Deal.udpController,"cell_change",this.widgetID,"cellChange",this);Deal.connectionManager.connectSignal(Deal.udpController,"pstatus_expire",this.widgetID,"purchaseStatusExpire",this)},purchaseStatusExpire:function(a){a!==e&&a||Deal.log("UDPDealWidget.cellChange: Null params.");
if(a.deal!==e&&a.deal)if(a.cell===e||null===a.cell)Deal.log("UDPDealWidget.purchaseStatusExpire: Null/undefined cell");else{var b=this.getViewId(a.cell);this.dealViews[b]!==e&&this.dealViews[b].updatePurchaseState(a.deal)}else Deal.log("UDPDealWidget.purchaseStatusExpire: Null deal object.")},getViewId:function(a){return this.widgetID+"_udpDealView_"+a},cellChange:function(a){if(a!==e&&a){var b;a.deal!==e&&a.deal?(Deal.log("UDPDealWidget.cellChange:  Cell: "+a.cell+" has new data change for deal: "+
a.deal.dealID),b="available"):(Deal.log("UDPDealWidget.cellChange: Null deal object Clearing the dealView."),b="empty");var c=this.getViewId(a.cell),k=Deal.udpController&&Deal.udpController.buying&&a.deal.dealID&&Deal.udpController.buying[a.deal.dealID];this.dealViews[c]===e||k||this.dealViews[c].trigger("change",{state:b,deal:a.deal})}else Deal.log("UDPDealWidget.cellChange: Null params.")},pageChange:function(a){if(a!==e&&a){var b;a.deal!==e&&a.deal?(Deal.log("UDPDealWidget.cellChange:  Cell: "+
a.cell+" has new data change for deal: "+a.deal.dealID),b="available"):(Deal.log("UDPDealWidget.cellChange: Null deal object Clearing the dealView."),b="empty");var c=this.getViewId(a.cell);this.dealViews[c]!==e&&(Deal.log("UDPDealWidget.pageChange:  Triggering change signal for dealView: "+c),this.dealViews[c].trigger("change",{state:b,deal:a.deal}))}else Deal.log("UDPDealWidget.cellChange: Null params.")},setDealId:function(b){var g=Deal.udpController.getDeal(b.dealId),f=b.asin;g.detail.accessType=
b.primeAccessType;g.detail.accessDurationInMs=b.primeAccessDurationInMs;if(null===g.dealType||g.dealType===e)g.dealType=b.dealType;if(f&&g.dealAsinsHash&&!g.dealAsinsHash[f]){var k=new c(f);k.parentDealDAO=g;g.dealAsins.push(k);g.dealAsinsHash[f]=k}g=this.getViewId(0);this.dealViews[g]===e?this.dealViews[g]=new a(this.widgetID,g,b):this.dealViews[g].setDealInfo(b.dealId,b.asin);Deal.udpController.setPageDealID(this.widgetID,b)},setPushNotificationDetails:function(a){this.pushNotificationDetails=a;
var b=this.getViewId(0);this.dealViews[b].setPushNotificationDetails(a)},registerEvents:function(){var a=this;l.when("jQuery","accordionBuyBoxJS").execute(function(b){var c=a.getViewId(0);a.dealViews[c]!==e&&(b("#usedBuySection").bind("click",a.dealViews[c].onSelectRegularBuybox),b("#buyNewSection").bind("click",a.dealViews[c].onSelectRegularBuybox),b("#lightningDealSection").bind("click",a.dealViews[c].onSelectLDBuybox))});l.when("jQuery").execute(function(b){b("#gb_in_cart_co").bind("redeemed",
function(b,c){b=a.getViewId(0);a.dealViews[b]!==e&&a.dealViews[b].showChangeOver(c)})})}})});"use strict";l.when("A","gb-udp-availability-message-controller").register("gb-udp-buybox-selector",function(k,a){return{onSelectLDBuybox:function(c){var b=k.$;c=Deal.udpController.dealsInCurrentView[Deal.udpController.buyboxWidgetID];c!==e&&null!==c&&(c=c[0],c!==e&&"LIGHTNING_DEAL"===c.dealType&&(0<b("#priceblock_businessprice").size()?(b("#priceblock_businessprice_row").addClass("aok-hidden"),b("#priceblock_dealprice_row").removeClass("aok-hidden")):
(b("#priceblock_ourprice").removeClass("a-size-medium").addClass("a-size-base").removeClass("a-color-price").addClass("a-color-secondary").addClass("a-text-strike"),b("#priceblock_saleprice").removeClass("a-size-medium").addClass("a-size-base").removeClass("a-color-price").addClass("a-color-secondary").addClass("a-text-strike")),b("#priceblock_dealprice").removeClass("a-size-base").addClass("a-size-medium").removeClass("a-color-secondary").addClass("a-color-price"),b("#ourprice_shippingmessage").addClass("a-hidden"),
b("#businessprice_shippingmessage").addClass("aok-hidden"),b("#saleprice_shippingmessage").addClass("a-hidden"),b("#dealprice_shippingmessage").removeClass("a-hidden"),!0===gbResources.getCustomerData("suppressMultipleStrikeThroughPrices")&&(b("#priceblock_ourprice_row").addClass("aok-hidden"),b("#ourprice_creturns_message").addClass("aok-hidden"),b("#priceblock_saleprice_row").addClass("aok-hidden"),b("#priceblock_dealprice_row").removeClass("aok-hidden"),b("#dealprice_creturns_message").removeClass("aok-hidden")),
b("#priceblock_dealprice_row").find(".priceblock_vat_inc_price").addClass("a-color-price").removeClass("a-color-secondary"),b("#priceblock_dealprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").removeClass("a-hidden"),b("#priceblock_ourprice_row").find(".priceblock_vat_inc_price").removeClass("a-color-price").addClass("a-color-secondary"),b("#priceblock_ourprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").addClass("a-hidden"),
b("#priceblock_saleprice_row").find(".priceblock_vat_inc_price").removeClass("a-color-price").addClass("a-color-secondary"),b("#priceblock_saleprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").addClass("a-hidden"),b("#atfRedesign_priceblock_priceToPay, #atfRedesign_priceToPay_savings").removeClass("a-hidden"),b("#atfRedesign_priceblock_buyingPrice, #atfRedesign_buyingPrice_savings").addClass("a-hidden"),b("#atfRedesign_pricePerUnit").removeClass("a-hidden"),
b("#atfRedesign_buyingPricePerUnit").addClass("a-hidden"),l.when("A").execute(function(a){a.state("strikeThroughPrice")!==e&&a.state("strikeThroughPrice").hideStrikeThroughPrice&&b("#atfRedesign_strikeThroughPrice").removeClass("a-hidden")}),b("#dealprice_savings").removeClass("a-hidden"),b("#regularprice_savings").addClass("a-hidden"),b("#b2bnewprice_savings").addClass("a-hidden"),b("#negotiatedprice_savings").addClass("a-hidden"),b("#gbld_header_message").addClass("a-hidden"),b("#ourprice_fbabadge").addClass("a-hidden"),
0<b("#deal_availability").length&&!Deal.isPrimeOnlyDotd(c)&&a.renderDealAvailabilityMessage(),b("#product-price").removeClass("a-size-medium").addClass("a-size-base").removeClass("a-color-price").addClass("a-color-secondary"),b("#ourprice_addonitem").addClass("a-hidden"),b("#ourprice_prime").addClass("a-hidden"),k.trigger("deals_onSelectLDBuybox")))},onSelectRegularBuybox:function(c){var b=k.$;c=Deal.udpController.dealsInCurrentView[Deal.udpController.buyboxWidgetID];c!==e&&null!==c&&(c=c[0],c!==
e&&"LIGHTNING_DEAL"===c.dealType&&(0<b("#priceblock_businessprice").size()?(b("#priceblock_businessprice_row").removeClass("aok-hidden"),b("#priceblock_dealprice_row").addClass("aok-hidden")):(b("#priceblock_ourprice").removeClass("a-size-base").addClass("a-size-medium").removeClass("a-color-secondary").addClass("a-color-price").removeClass("a-text-strike"),b("#priceblock_saleprice").removeClass("a-size-base").addClass("a-size-medium").removeClass("a-color-secondary").addClass("a-color-price").removeClass("a-text-strike")),
b("#priceblock_dealprice").removeClass("a-size-medium").addClass("a-size-base").removeClass("a-color-price").addClass("a-color-secondary"),b("#ourprice_shippingmessage").removeClass("a-hidden"),b("#businessprice_shippingmessage").removeClass("aok-hidden"),b("#saleprice_shippingmessage").removeClass("a-hidden"),b("#dealprice_shippingmessage").addClass("a-hidden"),!0===gbResources.getCustomerData("suppressMultipleStrikeThroughPrices")&&(b("#priceblock_ourprice_row").removeClass("aok-hidden"),b("#ourprice_creturns_message").removeClass("aok-hidden"),
b("#priceblock_saleprice_row").removeClass("aok-hidden"),b("#priceblock_dealprice_row").addClass("aok-hidden"),b("#dealprice_creturns_message").addClass("aok-hidden")),b("#priceblock_dealprice_row").find(".priceblock_vat_inc_price").removeClass("a-color-price").addClass("a-color-secondary"),b("#priceblock_dealprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").addClass("a-hidden"),b("#priceblock_ourprice_row").find(".priceblock_vat_inc_price").addClass("a-color-price").removeClass("a-color-secondary"),
b("#priceblock_ourprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").removeClass("a-hidden"),b("#priceblock_saleprice_row").find(".priceblock_vat_inc_price").addClass("a-color-price").removeClass("a-color-secondary"),b("#priceblock_saleprice_row").find(".priceblock_vat_excl_label, .priceblock_vat_excl_price, .priceblock_vat_inc_label ").removeClass("a-hidden"),b("#atfRedesign_priceblock_priceToPay, #atfRedesign_priceToPay_savings").addClass("a-hidden"),
b("#atfRedesign_priceblock_buyingPrice, #atfRedesign_buyingPrice_savings").removeClass("a-hidden"),b("#atfRedesign_pricePerUnit").addClass("a-hidden"),b("#atfRedesign_buyingPricePerUnit").removeClass("a-hidden"),l.when("A").execute(function(a){a.state("strikeThroughPrice")!==e&&a.state("strikeThroughPrice").hideStrikeThroughPrice&&b("#atfRedesign_strikeThroughPrice").addClass("a-hidden")}),b("#dealprice_savings").addClass("a-hidden"),b("#regularprice_savings").removeClass("a-hidden"),b("#b2bnewprice_savings").removeClass("a-hidden"),
b("#negotiatedprice_savings").removeClass("a-hidden"),b("#gbld_header_message").removeClass("a-hidden"),b("#ourprice_fbabadge").removeClass("a-hidden"),0<b("#deal_availability").length&&a.renderRegularAvailabilityMessage(),b("#product-price").removeClass("a-size-base").addClass("a-size-medium").removeClass("a-color-secondary").addClass("a-color-price"),b("#ourprice_addonitem").removeClass("a-hidden"),b("#ourprice_prime").removeClass("a-hidden"),k.trigger("deals_onSelectRegularBuybox")))},onSelectBuybox:function(a){}}});
l.when("A","gb-udp-event-emitter","gb-udp-buybox-selector").register("gb-udp-deal-view",function(k,a,c){return a.extend(c).extend({className:"udp-deal-view",attribution:"GoldboxUDPAssets",timers:[],dealId:null,asin:null,widgetId:null,viewId:null,pushNotificationDetails:{},viewSpanIds:{appOnlyAccessMessage:"",appEarlyAccessMessage:"",spanATC:"",spanJoinWaitlist:"",spanWillNotify:"",spanTurnNotifOn:"",spanSoldOut:"",spanInCart:"",spanWaitInLine:"",spanPendingAtc:"",spanClaimed:"",spanDealOver:"",spanWaitlistFull:"",
spanDealTimerContainer:"",spanSpinner:"",availability:"",dotdCountdownTimer:"",dotdExpired:"",primeEarlyAccessMessage:"",primeOnlyAccessMessage:"",spanShowProgress:"",spanShowQuantity:"",spanPrimeOnlyDotdCartMessage:""},viewTimerSpanIds:{spanDealTimer:"",spanCheckoutTimer:"",spanPendingATCTimer:"",spanDealStsProgBar:"",spanDealStsPercent:"",spanDealStsAvailMsg:"",spanDealStsClaimedText:""},viewHeaderMsgSpanIds:{spanJoinWaitlist:"",spanSoldOut:"",spanInCart:"",spanWaitInLine:"",spanPendingAtc:"",spanClaimed:"",
spanDealOver:"",spanWaitlistFull:"",spanHeaderPrice:""},viewChangeOverSpanIds:{spanWaitInLine:"",spanInCart:"",spanDealOrderQuantity:"",spanBooksAvailabilitySection:"",spanBooksFastTrackMessaging:""},init:function(a,c,e){this._super();var f=this;f.timers=[];f.widgetId=a;f.viewId=c;f.pushNotificationDetails=Deal.udpController.getWidget("udpDealLDWidget").pushNotificationDetails;f.setDealInfo(e.dealId,e.asin);f.on("change",f.cleanup);f.on("change",f.render);l.when("A","ready").execute(function(a){a.on("a:accordion:buybox_accordion:gb_ld_buybox:select",
f.onSelectLDBuybox);a.on("a:accordion:buybox_accordion:regular_buybox:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox_accordion:sampling-accordion:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox_accordion:select",f.onSelectBuybox);a.on("a:accordion:buybox-accordion:gb_ld_buybox:select",f.onSelectLDBuybox);a.on("a:accordion:buybox-accordion:onetime-accordion:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:sns-accordion:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:sampling-accordion:select",
f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:select",f.onSelectBuybox);a.declarative("a-accordion",["click"],f.handleAccordionSelection);a.on("a:accordion:buybox-accordion:dealsAccordionRow:select",f.onSelectLDBuybox);a.on("a:accordion:buybox-accordion:newAccordionRow:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:SecondNewAccordionRow:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:usedAccordionRow:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRow:select",
f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobile:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobileApp:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMovedUp:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobileMovedUp:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobileAppMovedUp:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMiddle:select",
f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobileMiddle:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:snsAccordionRowMobileAppMiddle:select",f.onSelectRegularBuybox);a.on("a:accordion:buybox-accordion:select",f.onSelectBuybox);a.on("alohaLDBuyBox",function(){f.onSelectLDBuybox()});a.on("alohaNormalBuyBox",function(){f.onSelectRegularBuybox()})});l.when("accordionBuyBoxJS","ready").execute(function(){var a=k.$;a("#usedBuySection").bind("click",
f.onSelectRegularBuybox);a("#buyNewSection").bind("click",f.onSelectRegularBuybox);a("#lightningDealSection").bind("click",f.onSelectLDBuybox)})},setPushNotificationDetails:function(a){this.pushNotificationDetails=a},setDealInfo:function(a,c){var e=k.$;this.dealId=a;this.asin=c;this.viewSpanIds.spanATC=e("#gb_atc_"+this.dealId);this.viewSpanIds.spanJoinWaitlist=e("#gb_join_waitlist_"+this.dealId);this.viewSpanIds.spanSoldOut=e("#deal_soldout_"+this.dealId);this.viewSpanIds.spanInCart=e("#deal_in_cart_"+
this.dealId);this.viewSpanIds.spanWaitInLine=e("#deal_wait_in_line_"+this.dealId);this.viewSpanIds.spanWillNotify=e("#deal_waitlisted_will_notify_"+this.dealId);this.viewSpanIds.spanTurnNotifOn=e("#deal_waitlisted_turn_on_notif_"+this.dealId);this.viewSpanIds.spanPendingAtc=e("#deal_pending_atc_"+this.dealId);this.viewSpanIds.spanClaimed=e("#deal_claimed_"+this.dealId);this.viewSpanIds.spanDealOver=e("#deal_over_"+this.dealId);this.viewSpanIds.spanWaitlistFull=e("#deal_waitlist_full_"+this.dealId);
this.viewSpanIds.spanDealTimerContainer=e("#dealCountdownTimer_"+this.dealId);this.viewSpanIds.spanSpinner=e("#deal_processing_"+this.dealId);this.viewSpanIds.availability=e("#deal_availability_"+this.dealId);this.viewSpanIds.dotdCountdownTimer=e("#dotd_countdown_timer_"+this.dealId);this.viewSpanIds.dotdExpired=e("#dotd_expired_"+this.dealId);this.viewSpanIds.primeEarlyAccessMessage=e("#primeEarlyAccessMessage_"+this.dealId);this.viewSpanIds.primeOnlyAccessMessage=e("#primeOnlyAccessMessage_"+this.dealId);
this.viewSpanIds.appEarlyAccessMessage=e("#appEarlyAccessMessage_"+this.dealId);this.viewSpanIds.appOnlyAccessMessage=e("#appOnlyAccessMessage_"+this.dealId);this.viewSpanIds.primeEarlyAccessWaitlistAvailableMessage=e("#primeEarlyAccessWaitlistAvailableMessage_"+this.dealId);this.viewSpanIds.primeEarlyAccessWaitlistFullMessage=e("#primeEarlyAccessWaitlistFullMessage_"+this.dealId);this.viewSpanIds.primeEarlyAccessTryPrimeButton=e("#tryPrimeButton_"+this.dealId);this.viewSpanIds.appDownloadButton=
e("#appDownloadButton_"+this.dealId);this.viewSpanIds.spanShowProgress=e("#deal_status_progress_"+this.dealId);this.viewSpanIds.spanShowQuantity=e("#dealOrderQuantity");this.viewSpanIds.spanPrimeOnlyDotdCartMessage=e("#deal_podotd_cart_message_"+this.dealId);this.viewTimerSpanIds.spanDealTimer=e("#deal_expiry_timer_"+this.dealId);this.viewTimerSpanIds.spanDealStsProgBar=e("#dealStatusProgressBar_"+this.dealId);this.viewTimerSpanIds.spanDealStsPercent=e("#dealStatusPercentage_"+this.dealId);this.viewTimerSpanIds.spanDealStsAvailMsg=
e("#dealStatusAvailability_"+this.dealId);this.viewTimerSpanIds.spanCheckoutTimer=e("#deal_checkout_timer_"+this.dealId);this.viewTimerSpanIds.spanPendingATCTimer=e("#deal_pending_atc_timer_"+this.dealId);this.viewTimerSpanIds.spanDealStsClaimedText=e("#dealStatusClaimedText_"+this.dealId);this.viewHeaderMsgSpanIds.spanJoinWaitlist=e("#gbld_header_msg_waitlistonly");this.viewHeaderMsgSpanIds.spanSoldOut=e("#gbld_header_msg_soldout");this.viewHeaderMsgSpanIds.spanInCart=e("#gbld_header_msg_incart");
this.viewHeaderMsgSpanIds.spanWaitInLine=e("#gbld_header_msg_inwaitlist");this.viewHeaderMsgSpanIds.spanPendingAtc=e("#gbld_header_msg_pendingatc");this.viewHeaderMsgSpanIds.spanClaimed=e("#gbld_header_msg_claimed");this.viewHeaderMsgSpanIds.spanWaitlistFull=e("#gbld_header_msg_waitlistfull");this.viewChangeOverSpanIds.spanWaitInLine=e("#gb_wl_joined_co");this.viewChangeOverSpanIds.spanInCart=e("#gb_in_cart_co");this.viewChangeOverSpanIds.spanDealOrderQuantity=e("#dealOrderQuantity");this.viewChangeOverSpanIds.spanBooksAvailabilitySection=
e("#books_availability_section_"+this.dealId);this.viewChangeOverSpanIds.spanBooksFastTrackMessaging=e("#dp-fast-track_feature_div_"+this.dealId)},cleanup:function(){if(this.timers){for(var a=0;a<this.timers.length;a++)this.timers[a].disconnect();this.timers=[]}else Deal.log("No timers to clean up. Returning.")},render:function(a){a!==e&&a?a.state!==e&&a.deal!==e&&a.state&&a.deal?(this.cleanup(),this.renderDealDetails(a.deal)):Deal.log("DealView.render: Unknown state / Null deal object. params :"+
JSON.stringify(a)):Deal.log("DealView.render: Null params specified")},updatePurchaseState:function(a){Deal.checkIfDealExpired(a)&&(this.hideSpansExcept(["spanDealOver"]),this.viewTimerSpanIds.spanDealStsProgBar.addClass("a-inactive"));if(a.dealAsinsHash[a.dealAsins[0].ASIN].status.state===Deal.inCartStr||a.dealAsinsHash[a.dealAsins[0].ASIN].status.state===Deal.pendingAtcStr)a.dealAsinsHash[a.dealAsins[0].ASIN].status.msToExpiry=0;a.trigger("change",a)},showChangeOver:function(a){a===Deal.inCartStr?
this.viewChangeOverSpanIds.spanInCart.show():this.viewChangeOverSpanIds.spanWaitInLine.show()},renderDealDetails:function(a){Deal.isPrimeOnlyDotd(a)?this.renderPrimeOnlyDealOfTheDayBuybox(a):Deal.dealTypes.LD===a.dealType?this.renderLightningDealBuybox(a):Deal.dealTypes.DOTD===a.dealType?this.renderDealOfTheDay(a):Deal.log("UDPWidgetView: Unsupported deal type caught in renderDealDetails")},renderDealOfTheDay:function(a){if(Deal.checkIfDealExpired(a))this.viewSpanIds.dotdCountdownTimer.addClass("a-hidden"),
this.viewSpanIds.dotdExpired.removeClass("a-hidden");else if(a.status&&a.status.endDate){var c=Deal.UDPTimer(a.status.endDate,0,a);c.span=this.viewTimerSpanIds.spanDealTimer;36E5>a.status.msToEnd&&(c.span&&0<c.span.length?c.span.addClass("a-color-success"):(a=k.$("#deal_expiry_timer_"+this.dealId).html(),l.log(["No timer found. looking up element in dom now for deal id: ",this.dealId," found: ",a].join(""),"WARN",this.attribution)));this.timers.push(c)}},renderPrimeOnlyDealOfTheDayBuybox:function(a){var c=
Deal.udpController.canCustomerClaimPrimeOnlyDOTD,e=Deal.udpController.isCustomerClaimingPrimeOnlyDOTD;if(null!=a.dealAsinsHash){var f=a.dealAsinsHash[this.asin];null!=f&&null!=f.status&&(f.offerServiceSoldOut?(this.hideSpansExcept(["spanSoldOut","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanSoldOut")):Deal.checkIfDealExpired(a)?(this.hideSpansExcept(["spanDealOver","spanShowProgress","spanShowQuantity"]),this.viewTimerSpanIds.spanDealStsProgBar.addClass("a-inactive"),this.updateHeaderMessage()):
gbResources.getCustomerData("hasExclusiveAccessBenefit")?c?e?this.hideSpansExcept("spanATC primeOnlyAccessMessage spanDealTimerContainer spanShowProgress spanShowQuantity spanInCart".split(" ")):this.hideSpansExcept(["spanATC","primeOnlyAccessMessage","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]):(this.hideSpansExcept(["spanATC","primeOnlyAccessMessage","spanDealTimerContainer","spanShowProgress","spanPrimeOnlyDotdCartMessage"]),this.viewSpanIds.spanATC.removeClass("a-hidden").addClass("a-hidden")):
this.hideSpansExcept(["primeOnlyAccessMessage","spanShowProgress","spanDealTimerContainer","primeEarlyAccessTryPrimeButton"]),a.status&&a.status.endDate&&(c=Deal.UDPTimer(a.status.endDate,0,a),c.span=this.viewTimerSpanIds.spanDealTimer,36E5>a.status.msToEnd&&(c.span&&0<c.span.length?c.span.addClass("a-color-success"):(a=k.$("#deal_expiry_timer_"+this.dealId).html(),l.log(["No timer found. looking up element in dom now for deal id: ",this.dealId," found: ",a].join(""),"WARN",this.attribution))),this.timers.push(c)))}},
renderLightningDealBuybox:function(a){if(null!==a.dealAsinsHash&&a.dealAsinsHash!==e){var c=a.dealAsinsHash[this.asin];null!==c&&c!==e&&null!==c.status&&c.status!==e&&(c.status.state===Deal.claimedStr?(this.hideSpansExcept(["spanClaimed","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanClaimed")):c.status.state===Deal.inCartStr?0<c.status.msToExpiry?(this.hideSpansExcept(["spanInCart"]),this.updateHeaderMessage("spanInCart")):this.hideSpansExcept(["spanSpinner"]):
Deal.checkIfDealExpired(a)?(this.hideSpansExcept(["spanDealOver","spanShowProgress","spanShowQuantity"]),this.viewTimerSpanIds.spanDealStsProgBar.addClass("a-inactive"),this.updateHeaderMessage()):c.status.state===Deal.pendingAtcStr?0<c.status.msToExpiry?a.detail.accessType!==Deal.accessTypeEnum.APP_ONLY_LD||gbResources.getCustomerData("isApp")?(this.hideSpansExcept(["spanPendingAtc","spanATC"]),this.updateHeaderMessage("spanPendingAtc")):this.hideSpansExcept(["spanShowProgress","appOnlyAccessMessage",
"appDownloadButton","spanShowQuantity"]):this.hideSpansExcept(["spanSpinner"]):c.status.state===Deal.waitInLineStr?(this.pushNotificationDetails!==e&&null!==this.pushNotificationDetails&&this.pushNotificationDetails.pushToken!==e&&null!==this.pushNotificationDetails.pushToken?this.hideSpansExcept(["spanWaitInLine","spanWillNotify","spanDealTimerContainer","spanShowProgress"]):this.hideSpansExcept(["spanWaitInLine","spanTurnNotifOn","spanDealTimerContainer","spanShowProgress"]),this.updateHeaderMessage("spanWaitInLine")):
c.offerServiceSoldOut||100<=c.status.percentSoldOut?(this.hideSpansExcept(["spanSoldOut","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanSoldOut")):100<=c.status.percentClaimed?c.status.currentlyUnavailable?Deal.isDealInEarlyAccessWindow(a)?a.detail.accessType===Deal.accessTypeEnum.PRIME_EARLY_ACCESS?gbResources.getCustomerData("hasEarlyAccessBenefit")?(this.hideSpansExcept(["spanWaitlistFull","spanDealTimerContainer","spanShowProgress","primeEarlyAccessMessage","spanShowQuantity"]),
this.updateHeaderMessage("spanWaitlistFull")):this.hideSpansExcept(["primeEarlyAccessMessage","spanShowProgress","primeEarlyAccessWaitlistFullMessage","spanShowQuantity"]):a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS&&(gbResources.getCustomerData("isApp")?(this.hideSpansExcept(["spanWaitlistFull","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanWaitlistFull")):this.hideSpansExcept(["spanDealTimerContainer","spanShowProgress","appEarlyAccessMessage",
"appDownloadButton","spanShowQuantity"])):Deal.isPrimeOnlyDeal(a)?gbResources.getCustomerData("hasExclusiveAccessBenefit")?(this.hideSpansExcept(["spanWaitlistFull","spanDealTimerContainer","spanShowProgress","primeOnlyAccessMessage","spanShowQuantity"]),this.updateHeaderMessage("spanWaitlistFull")):this.hideSpansExcept(["primeOnlyAccessMessage","spanShowProgress","primeEarlyAccessWaitlistFullMessage","spanShowQuantity"]):a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD?gbResources.getCustomerData("isApp")?
(this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanWaitlistFull","spanShowQuantity"]),this.updateHeaderMessage("spanWaitlistFull")):this.hideSpansExcept(["appOnlyAccessMessage","appDownloadButton","spanShowProgress","spanShowQuantity"]):(this.hideSpansExcept(["spanWaitlistFull","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanWaitlistFull")):Deal.isDealInEarlyAccessWindow(a)?a.detail.accessType===Deal.accessTypeEnum.PRIME_EARLY_ACCESS&&
gbResources.getCustomerData("hasEarlyAccessBenefit")?(this.hideSpansExcept(["spanJoinWaitlist","spanDealTimerContainer","spanShowProgress","primeEarlyAccessMessage","spanShowQuantity"]),this.updateHeaderMessage("spanJoinWaitlist")):a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS?gbResources.getCustomerData("isApp")?(this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanShowQuantity","spanJoinWaitlist"]),this.updateHeaderMessage("spanJoinWaitlist")):this.hideSpansExcept(["spanShowProgress",
"spanDealTimerContainer","appEarlyAccessMessage","appDownloadButton","spanShowQuantity"]):this.hideSpansExcept(["primeEarlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessWaitlistAvailableMessage"]):Deal.isPrimeOnlyDeal(a)?gbResources.getCustomerData("hasExclusiveAccessBenefit")?(this.hideSpansExcept(["spanJoinWaitlist","spanDealTimerContainer","spanShowProgress","primeOnlyAccessMessage","spanShowQuantity"]),this.updateHeaderMessage("spanJoinWaitlist")):
this.hideSpansExcept(["primeOnlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessWaitlistAvailableMessage"]):a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD?gbResources.getCustomerData("isApp")?(this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanJoinWaitlist","spanShowQuantity"]),this.updateHeaderMessage("spanJoinWaitlist")):this.hideSpansExcept(["appOnlyAccessMessage","spanShowProgress","spanShowQuantity","appDownloadButton"]):
(this.hideSpansExcept(["spanJoinWaitlist","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage("spanJoinWaitlist")):null!=c.status.percentClaimed&&100>c.status.percentClaimed?(Deal.isDealInEarlyAccessWindow(a)||(this.viewSpanIds.primeEarlyAccessMessage.addClass("a-hidden"),this.viewSpanIds.appEarlyAccessMessage.addClass("a-hidden"),a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD?gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress",
"spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","appOnlyAccessMessage","appDownloadButton","spanShowQuantity"]):Deal.isPrimeOnlyDeal(a)?this.hideSpansExcept(["spanATC","primeOnlyAccessMessage","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]):this.hideSpansExcept(["spanATC","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage()),Deal.isDealInEarlyAccessWindow(a)?a.detail.accessType!==Deal.accessTypeEnum.PRIME_EARLY_ACCESS||
gbResources.getCustomerData("hasEarlyAccessBenefit")?a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS&&(gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","appEarlyAccessMessage","appDownloadButton","spanShowQuantity"])):this.hideSpansExcept(["primeEarlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessTryPrimeButton"]):
Deal.isPrimeOnlyDeal(a)&&!gbResources.getCustomerData("hasExclusiveAccessBenefit")?this.hideSpansExcept(["primeOnlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessTryPrimeButton"]):a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD&&(gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","appOnlyAccessMessage","appDownloadButton",
"spanShowQuantity"]))):Deal.log("UDPWidgetView: unhandled case in renderLightningDealBuybox"),this.updateDealStatus(a))}},hideSpansExcept:function(a){var c,e;for(e in this.viewSpanIds){c=!1;for(var f in a)if(a[f]===e){c=!0;this.viewSpanIds[e].removeClass("a-hidden");break}!1===c&&this.viewSpanIds[e].addClass("a-hidden")}},updateHeaderMessage:function(a){k.$("#gbld_header_message").children().addClass("a-hidden");a!==e&&null!==a&&this.viewHeaderMsgSpanIds[a].removeClass("a-hidden")},updateDealStatus:function(a){var c,
g=a.dealAsinsHash[this.asin],f=null,f=null;if(g.status.state===Deal.inCartStr)c=(new Date).getTime(),f=new Date(c+parseInt(g.status.msToExpiry)),f=Deal.UDPTimer(f,1,a),f.span=this.viewTimerSpanIds.spanCheckoutTimer,this.timers.push(f);else if(g.status.state===Deal.pendingAtcStr)c=(new Date).getTime(),f=new Date(c+parseInt(g.status.msToExpiry)),f=Deal.UDPTimer(f,1,a),f.span=this.viewTimerSpanIds.spanPendingATCTimer,this.timers.push(f);else if(a.status.endDate){c=this.viewTimerSpanIds.spanDealTimer;
var m=this.viewTimerSpanIds&&c&&0<c.length;m||(f=k.$("#deal_expiry_timer_"+this.dealId).html(),l.log(["No timer found. looking up element in dom now for deal id: ",this.dealId," found: ",f].join(""),"WARN",this.attribution));Deal.isDealInEarlyAccessWindow(a)?a.detail.accessType!==Deal.accessTypeEnum.PRIME_EARLY_ACCESS||gbResources.getCustomerData("hasEarlyAccessBenefit")?a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS?(f=Deal.getEarlyAccessEndTime(a),m&&c.addClass("a-color-success")):(f=
a.status.endDate,m&&c.removeClass("a-color-success").addClass("a-color-base")):f=Deal.getEarlyAccessEndTime(a):(f=a.status.endDate,m&&c.removeClass("a-color-success").addClass("a-color-base"));f=Deal.UDPTimer(f,0,a);f.span=c;36E5>a.status.msToEnd&&m&&f.span.addClass("a-color-success");this.timers.push(f)}(c=g.status.percentClaimed)&&0<=parseFloat(c)&&100>=parseFloat(c)&&(c=Math.round(c),m=this.viewTimerSpanIds.spanDealStsProgBar.find("#progBarBase"),f=this.viewTimerSpanIds.spanDealStsProgBar.find("#progBarTick"),
m.css("width",c+"%"),f.css("width",c+"%"),this.viewTimerSpanIds.spanDealStsPercent.html(c+"%"),this.viewTimerSpanIds.spanDealStsAvailMsg.html(c+"%"),89>=c?(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-error").removeClass("a-color-success").addClass("a-color-base"),this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-error").removeClass("a-color-success").addClass("a-color-base")):99>=c?(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-success"),
this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-success")):(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-error"),this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-error")),g.offerServiceSoldOut||100<=g.status.percentSoldOut||Deal.checkIfDealExpired(a))&&(m.removeClass("progbar"),f.removeClass("progbartick"),
m.addClass("progbarmissed"),f.addClass("progbartickmissed"));l.when("A").execute(function(c){var d=c.$;if(c.state("offerBadges")!==e){var f=c.state("offerBadges").displayOfferBadge;c=c.state("offerBadges").lightningDealString;!f||Deal.checkIfDealExpired(a)||Deal.isDealInEarlyAccessWindow(a)||Deal.isPrimeOnlyDeal(a)||0<d("#sticker-label").length&&d("#sticker-label").html(c)}});Deal.isDealInEarlyAccessWindow(a)||Deal.isPrimeOnlyDeal(a)||g.status.state===Deal.waitInLineStr||g.status.state===Deal.inCartStr||
this.viewChangeOverSpanIds.spanDealOrderQuantity.removeClass("a-hidden");Deal.isDealInEarlyAccessWindow(a)||Deal.isPrimeOnlyDeal(a)||(this.viewChangeOverSpanIds.spanBooksAvailabilitySection.removeClass("a-hidden"),this.viewChangeOverSpanIds.spanBooksFastTrackMessaging.removeClass("a-hidden"));Deal.isDealInEarlyAccessWindow(a)&&l.when("A").execute(function(a){a.on("a:popover:show:primePopoverContent",function(a){a.popover.$container.find("button").css("display","block")})})},expandLDBuybox:function(){k.$("#gb_ld_buybox").trigger("click")},
expandRegularBuybox:function(){k.$("#regular_buybox").trigger("click")},handleAccordionSelection:function(a){l.when("A").execute(function(c){var e=a.$target.closest(".a-accordion"),f=a.$target.closest(".a-box");c=f.find(".a-accordion-row");var f=e.find(".a-box").not(f).find(".a-accordion-row"),e=f.find(".gb-accordion-active"),f=f.find(".a-color-price"),k=c.find(".gb-accordion-inactive");c=c.find(".a-color-secondary");e.removeClass("gb-accordion-active").addClass("gb-accordion-inactive");f.removeClass("a-color-price").addClass("a-color-secondary");
k.removeClass("gb-accordion-inactive").addClass("gb-accordion-active");c.removeClass("a-color-secondary").addClass("a-color-price")})}})});l.when("A").execute("gb-udp-bootstrap",function(e){k.Deal||(k.Deal={});k.gbResources||(k.gbResources=new GBResources);k.Deal.configManager||l.when("gb-deal-config-manager").execute(function(a){Deal.configManager=new a({controllerConfig:{versionInfo:"",login_uri:""},dealContentServiceConfig:{continueRequests:!0,timeout:"10",baseRetryInterval:6E4,baseURL:"http://internal.amazon.com/coral/com.amazon.dcs.model/",
client_id:"goldbox_udp"}})});k.Deal.Widgets||(k.Deal.Widgets=[])});"use strict";k.P&&k.P.AUI_BUILD_DATE&&l.when("gb-udp-controller","gb-udp-deal-widget").register("udp_ld_widget_js",function(e,a){k.UDPDealController=e;k.UDPDealWidget=a;k.Backbone={setDomLibrary:function(){}};return{dealUdpComponent:function(){}}});l.when("A").register("gb-udp-availability-message-controller",function(e){var a=e.$;return{renderDealAvailabilityMessage:function(){if(0<a("#dealsAccordionRow").length){a("#centerCol #deal_availability").removeClass("a-hidden");
a("#centerCol #availability").addClass("a-hidden");var c=a("#newAccordionRow, #SecondNewAccordionRow");c.find("#deal_availability").removeClass("a-hidden");c.find("#availability").addClass("a-hidden");c=a("#snsAccordionRow, #snsAccordionRowMobile, #snsAccordionRowMobileApp, #snsAccordionRowMovedUp, #snsAccordionRowMobileMovedUp, #snsAccordionRowMobileAppMovedUp, #snsAccordionRowMiddle, #snsAccordionRowMobileMiddle, #snsAccordionRowMobileAppMiddle");c.find("#deal_availability").removeClass("a-hidden");
c.find("#availability").addClass("a-hidden")}else a("#deal_availability").removeClass("a-hidden"),a("#availability").addClass("a-hidden")},renderRegularAvailabilityMessage:function(){if(0<a("#dealsAccordionRow").length){a("#centerCol #deal_availability").addClass("a-hidden");a("#centerCol #availability").removeClass("a-hidden");var c=a("#newAccordionRow, #SecondNewAccordionRow");c.find("#deal_availability").addClass("a-hidden");c.find("#availability").removeClass("a-hidden");c=a("#snsAccordionRow, #snsAccordionRowMobile, #snsAccordionRowMobileApp, #snsAccordionRowMovedUp, #snsAccordionRowMobileMovedUp, #snsAccordionRowMobileAppMovedUp, #snsAccordionRowMiddle, #snsAccordionRowMobileMiddle, #snsAccordionRowMobileAppMiddle");
c.find("#deal_availability").addClass("a-hidden");c.find("#availability").removeClass("a-hidden")}else a("#deal_availability").addClass("a-hidden"),a("#availability").removeClass("a-hidden")}}})});
/* ******** */
(function(e){var f=window.AmazonUIPageJS||window.P,k=f._namespace||f.attributeErrors,b=k?k("DetailPageCommonScripts",""):f;b.guardFatal?b.guardFatal(e)(b,window):b.execute(function(){e(b,window)})})(function(e,f,k){e.when("A","jQuery").register("jumpLink",function(b,a){return{bind:function(b,d,m,h){try{d=d||1E3,m=m||0,a("body").delegate(b,"click",function(n){try{var e=a(b);if(e.get(0)){var g=e.attr("href");g&&"#"===g.charAt(0)&&(g=h&&0===a(g).length?"[name\x3d'"+g.substring(1)+"']":g,0!==a(g).length&&
(n.preventDefault(),a("html, body").animate({scrollTop:a(g).offset().top-m},d)))}}catch(l){f.ueLogError&&f.ueLogError(l,{logLevel:"FATAL",attribution:"jumpLink",message:"[JumpLink - Error in executing click handler]"})}})}catch(n){f.ueLogError&&f.ueLogError(n,{logLevel:"FATAL",attribution:"jumpLink",message:"[JumpLink - Error in binding click handler]"})}}}});"use strict";e.when("A").execute(function(b){b.declarative("mySummaryExpander_1","click",function(a){if(a=document.getElementById("summaryText"))a.style.display=
"block"===a.style.display?"none":"block"})});"use strict";e.when("A").register("dp-log-utils",function(b){b.on("dpLogFatalsEvent",function(a,b,d){f.ueLogError&&f.ueLogError({message:a},{logLevel:b,attribution:d})})});"use strict";e.register("dp-client-counter",function(){var b=function(){};f.ue&&f.ue.count&&"function"===typeof f.ue.count&&(b=f.ue.count);return{set:function(a,c){"undefined"!==typeof c&&b(a,c)},get:function(a){return b(a)},inc:function(a){b(a,(b(a)||0)+1)}}});"use strict";e.when("dp-client-counter").register("dp-click-counter",
function(b){return{record:function(a,c){a&&a.addEventListener("click",function(){b.inc(c+"-clicked")})}}});"use strict";e.when("A").register("cache",function(b){function a(a){d=this;this.data={};a&&(this.ttl=60*a);this.deleteTtlExpiredEntries=function(){if(d.ttl)for(var a in this.data)if(this.data.hasOwnProperty(a)){var b=this.data[a].timestamp;Math.round((new Date).getTime()/1E3)-b>this.ttl&&delete this.data[a]}}}function c(a){var d=a;if("object"===typeof a){var c="",d="";b.each(a,function(a,b){d+=
c+b+"\x3d"+a;c="\x26"})}return d}var d;a.prototype={put:function(a,b){a=c(a);b={timestamp:Math.round((new Date).getTime()/1E3),value:b};this.data[a]=b},get:function(a){this.deleteTtlExpiredEntries();if(this.exists(a))return a=c(a),this.data[a].value},exists:function(a){this.deleteTtlExpiredEntries();return c(a)in this.data}};return a});"use strict";e.register("dp-util-cookie",function(){return function(b){b+="\x3d";for(var a=decodeURIComponent(document.cookie).split(";"),c=0;c<a.length;c++){var d=
a[c],d=d.replace(/^\s+/,"");if(0===d.indexOf(b))return d.substring(b.length,d.length)}return""}});e.when("jQuery").register("quanityChangePriceUpdate",function(b){return{ajaxCall:function(a){}}});"use strict";e.when("A","jQuery","a-popover","a-dropdown","ready").register("moq-core",function(b,a,c,d){function e(a){return 0<a.length&&0<a.find("div[data-name\x3d'quantity.improvedMOQ']").length}function h(){return a(k.join(", "))}function f(a){return"locked"===a.find("div[data-name\x3d'quantity.improvedMOQ']").attr("moq-lock")}
function p(){return(a(g.join(", ")).length?g:a(l.join(", ")).length?l:a(q.join(", ")).length?q:["#buybox"]).map(function(b){return a(b)}).filter(e)}var g=["#newAccordionRow","#SecondNewAccordionRow"],l=["#oneTimeBuyBox","#snsBuyBox"],q=["#toggleBuyBox \x3e #sns","#toggleBuyBox \x3e #onetime"],k=["#snsBuyBox","#toggleBuyBox \x3e #sns"],r="#add-to-cart-button;#mobb\\.addToCart;#buy-now-button;#one-click-button;#oneClickBuyButton;#prime-toggle-main;#rcx-subscribe-submit-button input;#rcx-subscribe-submit-button button".split(";");
return{isSnsLocked:function(){var a=h();return f(a)},isLocked:f,getSnsSubscriptionContainer:h,offerContainerHasMoq:e,findMoqOfferContainers:p,findMoqOfferContainerWithDomElement:function(a){var b=p().filter(function(b){return b[0].contains(a)});return 0===b.length?null:b[0]},tweakDisplayTextForMoqQuantityDropdown:function(a){var b=d.getSelect(a).getOptions(0),c=b.info()[0];c.selected?b.update({text:c.value}):b.update({text:a.children("option[data-displayText]").attr("data-displayText")})},lockSubmission:function(b,
d,c){var e=b.find(r.join(", ")),h=b.find("div[data-name\x3d'quantity.improvedMOQ']");e.each(function(){"hidden"!==a(this).prop("type")&&(this.hasAttribute("moq-original-button-type")||a(this).attr("moq-original-button-type",a(this).prop("type")),h.attr("moq-lock","locked"),a(this).prop("type","button"),a(this).bind("click.moq",d),"function"===typeof c&&c(a(this)))})},unlockSubmission:function(b,d){var c=b.find(r.join(", ")),e=b.find("div[data-name\x3d'quantity.improvedMOQ']");c.each(function(){"button"===
a(this).prop("type")&&(e.attr("moq-lock","unlocked"),a(this).prop("type",a(this).attr("moq-original-button-type")),a(this).unbind("click.moq"),"function"===typeof d&&d(a(this)))})}}});"use strict";e.when("A","dp-pre-atc-monitor").execute("dp-pre-atc-execution",function(b,a){b.declarative("dp-pre-atc-declarative","click",function(c){var d=a.getInstance();b.$.isEmptyObject(d.preAddToCartHeroFunctionRegister.heroFunctionMap)||b.$.isEmptyObject(d.getHeroName())||d.triggerHeroFunction(c)})});"use strict";
e.when("A","ready").register("dp-pre-atc-hero-candidates",function(b){var a=void 0===b.state("dp-pre-atc-hero")?"":b.state("dp-pre-atc-hero").heroName;return{getHeroName:function(){return a},setHeroName:function(b){b&&(a=b)},hasHeroName:function(){return!b.$.isEmptyObject(a)},getHeroCandidates:void 0===b.state("dp-pre-atc-hero-candidates")?[]:b.state("dp-pre-atc-hero-candidates")}});"use strict";e.when("A").register("dp-pre-atc-hero-function-register",function(b){function a(){this.heroFunctionMap=
{};this.registerHero=function(a,b){if(a&&"function"===typeof b)this.heroFunctionMap[a]=b;else throw Error("PRE-ATC-ERROR-REGISTER-1 Failed to register as your Hero name might be invalid or triggerFunction is not function type.");}}var c;return{getInstance:function(){c||(c=new a);return c}}});"use strict";e.when("A","dp-pre-atc-hero-candidates","dp-pre-atc-hero-function-register").register("dp-pre-atc-monitor",function(b,a,c){function d(a,b){this.preAddToCartHeroCandidates=a;this.preAddToCartHeroFunctionRegister=
b;this.logAttribution="dp_pre_atc_monitor"}d.prototype={getHeroName:function(){return this.preAddToCartHeroCandidates.getHeroName()},updateHero:function(a){a?-1<this.preAddToCartHeroCandidates.getHeroCandidates.indexOf(a)?(this.preAddToCartHeroCandidates.setHeroName(a),b.state.replace("dp-pre-atc-hero",null),a=f.ue,"undefined"!==typeof a&&"undefined"!==typeof a.count&&a.count("dpOffers:preatc:updateHero",(a.count("dpOffers:preatc:updateHero")||0)+1)):b.trigger("dpLogFatalsEvent","PRE-ATC-ERROR-MONITOR-1 Failed to update Hero to "+
a+" as it is not registered on DPX side.","ERROR",this.logAttribution):b.trigger("dpLogFatalsEvent","PRE-ATC-ERROR-MONITOR-2 Empty Hero name, Hero has been deleted.","WARN",this.logAttribution)},triggerHeroFunction:function(a){if(!b.$.isEmptyObject(this.preAddToCartHeroFunctionRegister.heroFunctionMap)&&this.preAddToCartHeroCandidates.hasHeroName()){var d=this.getHeroName();try{this.preAddToCartHeroFunctionRegister.heroFunctionMap[d](a)}catch(c){b.trigger("dpLogFatalsEvent","PRE-ATC-ERROR-MONITOR-3 PreAddToCartMonitor could not find Hero's function.",
"ERROR",this.logAttribution)}}else b.trigger("dpLogFatalsEvent","PRE-ATC-ERROR-MONITOR-4 PreAddToCartMonitor tried to trigger Hero function when Hero does not exist.","ERROR",this.logAttribution)}};d.prototype.constructor=d;var e;return{getInstance:function(){e||(e=new d(a,c.getInstance()));return e}}});"use strict";e.when("A","dp-client-counter","dp-get-buybox-element-ids","ready").register("dp-accordion-click-counter",function(b,a,c){return{recordAccordionClick:function(d,e,f){(d=c.getAccordionRowIds(d))&&
d.length&&d.forEach(function(d){var c=e+":"+f+":"+d+":click";b.on("a:accordion:"+d+":select",function(b){a.inc(c)})})}}});"use strict";e.when("A","dp-client-counter","dp-get-buybox-element-ids","ready").register("dp-button-click-counter",function(b,a,c){var d=b.$;return{recordButtonClick:function(b,e,f){(b=c.getAccordionRowIds(b))&&b.length&&b.forEach(function(b){var g=c.getButtonIds(b);g&&g.length&&g.forEach(function(c){var g=e+":"+f+":"+b+":"+c+":click";d("#"+c).click(function(){a.inc(g)})})})}}});
"use strict";e.when("A","ready").register("dp-get-buybox-element-ids",function(b){function a(a){return c(a).length?c(a).map(function(){return this.id}).get():[]}var c=b.$;return{getAccordionRowIds:function(b){return a("#"+b+" [data-a-accordion-row-name]")},getButtonIds:function(b){return a("#"+b+" .a-button-input")}}})});
/* ******** */
(function(m){var g=window.AmazonUIPageJS||window.P,p=g._namespace||g.attributeErrors,d=p?p("DetailPageLatencyAssets",""):g;d.guardFatal?d.guardFatal(m)(d,window):d.execute(function(){m(d,window)})})(function(m,g,p){m.when("dp-interactive-feature-component-base","dp-click-to-ci-utils","A").register("dp-interactive-feature",function(d,e,b){function k(a,c){this.name=a;this._baseComponents={};this.getComponent("default",c)}function n(a){return h.isPlainObject(a)&&a.hasComponents&&h.isArray(a.components)}
var h=b.$;k.prototype={getTimeToInteractivity:function(a,c){a=a||{};var f,l,k=0,d=!1,g=[];n(a)?(b.each(a.components,function(a){h.isPlainObject(a)&&e.isValidNonEmptyString(a.name)&&(f=this.getComponent(a.name,c),(l=f.getTimeToInteractivity(c,a.events))&&l.interactive?l.interactiveTime>k&&(k=l.interactiveTime):g.push(a.name))},this),g.length||(d=!0)):(l=this.getComponent("default",c).getTimeToInteractivity(c,a.events),d=l.interactive,k=l.interactiveTime);return{interactive:d,interactiveTime:d?k:0}},
getComponent:function(a,c){a=a.toLowerCase();this._baseComponents[a]||(this._baseComponents[a]=new d(a,c));return this._baseComponents[a]},updateFeatureInformation:function(a,c){var f={timestamp:a.timestamp,type:a.type,options:{}},l=!1;n(a.options)?b.each(a.options.components,function(a){h.isPlainObject(a)&&e.isValidNonEmptyString(a.name)&&(f.options=a,a=this.getComponent(a.name,c).updateComponentInformation(f,c),l=l||a)},this):(f.options=a.options||{},l=this.getComponent("default",c).updateComponentInformation(f,
c));return l},updateRenderTime:function(a,c,f){a=a||{};var l;n(a)?b.each(a.components,function(a){h.isPlainObject(a)&&e.isValidNonEmptyString(a.name)&&(l=this.getComponent(a.name))&&f&&l.updateRenderTime(f,c)},this):this.getComponent("default",f).updateRenderTime(f,c)},resetFeatureInfo:function(a,c){a=a||{};var f;n(a)?b.each(a.components,function(a){h.isPlainObject(a)&&e.isValidNonEmptyString(a.name)&&(f=this.getComponent(a.name))&&c&&f.resetComponentInfo(c)},this):this.getComponent("default",c).resetComponentInfo(c)}};
return k});m.when("A","dp-interactive-feature","dp-click-to-ci","dp-critical-features","3p-promise","dp-click-to-ci-utils").register("dp-time-to-interactive",function(d,e,b,k,n,h){var a=d.$;return{_features:{},criticalFeatures:{},_clickToCI:{},pageType:"glance",getTimeToInteractivity:function(c,f){c=c||{};var l={features:c,longPoleFeatureName:"",interactiveTime:0,allFeaturesInteractive:!1,nonInteractiveFeatures:[]},b=[];a.isPlainObject(c)&&!a.isEmptyObject(c)&&(d.each(c,function(a,f){f=f.toLowerCase();
var c=this._features[f];c?(c=c.getTimeToInteractivity(a,this.pageType),c.interactive?(a.interactiveTime=c.interactiveTime,c.interactiveTime>l.interactiveTime&&(l.interactiveTime=c.interactiveTime,l.longPoleFeatureName=f)):b.push(f)):b.push(f)},this),b.length||(l.allFeaturesInteractive=!0),l.nonInteractiveFeatures=b);return l},updateFeatures:function(c){c=c||[];var f=!1;a.isArray(c)&&(d.each(c,function(c){var b=!1;a.isPlainObject(c)&&h.isValidNonEmptyString(c.name)&&c.timestamp&&(b=this.getFeatureObject(c.name).updateFeatureInformation(c,
this.pageType));f=f||b},this),this._getClickToCIObj(this.pageType).getMetricInfo().allFeaturesInteractive||this.updateMetricInfo());return f},getFeatureObject:function(a){a=a.toLowerCase();this._features[a]||(this._features[a]=new e(a,this.pageType));return this._features[a]},updateRenderTime:function(c){if(c&&"twisterupdate"===this.pageType){var f=this.getCriticalFeatureObj().getCriticalFeaturesPromise(),b=this._getClickToCIObj(this.pageType).getMetricInfo(),k=this;f&&f.then(function(f){a.isPlainObject(f)&&
!a.isEmptyObject(f)&&d.each(f,function(a,f){f=f.toLowerCase();(f=k._features[f])&&f.updateRenderTime(a,c,k.pageType)},this);b.allFeaturesInteractive||k.updateMetricInfo(!0)})}},updatePage:function(a){if(a){var f=this.pageType;this.pageType=a.toLowerCase();var l=this.getCriticalFeatureObj().getCriticalFeatures();h.logCounter("ClickToCITwisterUpdateTotalCount");l&&this._clickToCI[f]&&!this._clickToCI[f].isResolved()&&this._clickToCI[f].reject(Error("ClicktoCI not available "));this._resetFeatureInfo(l,
a);this._clickToCI[this.pageType]=new b;this.criticalFeatures=new k;"twisterupdate"===this.pageType&&this.criticalFeatures.setIgnoreCriticalFeatures("twister")}},_resetFeatureInfo:function(c,f){f=f.toLowerCase();c=c||{};a.isPlainObject(c)&&!a.isEmptyObject(c)&&d.each(c,function(a,c){c=c.toLowerCase();(c=this._features[c])&&c.resetFeatureInfo(a,f)},this)},_getClickToCIObj:function(a){a=a.toLowerCase();this._clickToCI[a]||(this._clickToCI[a]=new b);return this._clickToCI[a]},getCriticalFeatureObj:function(){a.isEmptyObject(this.criticalFeatures)&&
(this.criticalFeatures=new k);return this.criticalFeatures},updateMetricInfo:function(a){var f=this._getClickToCIObj(this.pageType),b=this,k=this.getCriticalFeatureObj();k.getCriticalFeaturesPromise().then(function(d){k.isCriticalFeaturesKnown&&!f.getMetricInfo().allFeaturesInteractive&&f.setMetricInfo(b.getTimeToInteractivity(d,b.pageType));f.getMetricInfo().allFeaturesInteractive&&b._clickToCI[b.pageType]&&!b._clickToCI[b.pageType].isResolved()?(b._clickToCI[b.pageType].resolve(f.getMetricInfo()),
b._clickToCI[b.pageType].setResolved(!0),a&&h.logCounter("ClickToCITwisterUpdateSuccessCount")):a&&!f.getMetricInfo().allFeaturesInteractive&&h.logCounter("ClickToCITwisterUpdateFailureCount")})},getClickToCIPromise:function(a){if(a){if(a=a.toLowerCase(),this._clickToCI[a])return this._clickToCI[a].getPromiseObject()}else if(this._clickToCI[this.pageType])return this._clickToCI[this.pageType].getPromiseObject()},updateCriticalFeatures:function(){this.getCriticalFeatureObj().updateCriticalInteractiveFeatures();
this.updateMetricInfo()}}});m.when("A").register("dp-interactive-feature-component",function(d){function e(b){if(b instanceof e){var n={};this._renderTime=0;this._isInteractive=b._isInteractive;d.each(b._events,function(b){b.alwaysInteractive&&(n[b.name]={name:b.name,interactiveTime:b.interactiveTime,alwaysInteractive:!0})},this);this._events=n}else this._renderTime=0,this._isInteractive=!0,this._events={}}var b=d.$;e.prototype={updateComponentInformation:function(k){var d=!1;if(b.isPlainObject(k))switch(k.type){case "render":d=
this._updateRenderInformation(k);break;case "interactive":d=this._updateInteractiveInformation(k)}return d},_updateRenderInformation:function(b){var d=!1,e=b.options||{};this._renderTime||(this._renderTime=b.timestamp,this._isInteractive=void 0===e.isInteractive?!0:e.isInteractive,d=!0);return d},_updateInteractiveInformation:function(b){var e;e=b.options||{};var h=e.alwaysInteractive||!1,a=!1;this._isInteractive&&(e=e.events||["click"],d.each(e,function(c){this._events[c]||(this._events[c]={name:c,
interactiveTime:b.timestamp,alwaysInteractive:h},a=!0)},this));return a},getTimeToInteractivity:function(k){var e=0,h=!1,a=[];this.isRendered()&&(this._isInteractive?(b.isArray(k)||(k=["click"]),d.each(k,function(b){var f=this._events[b];f?f.interactiveTime>e&&(e=f.interactiveTime):a.push(b)},this),a.length||(h=!0,this._renderTime>e&&(e=this._renderTime))):(h=!0,e=this._renderTime));return{interactive:h,interactiveTime:h?e:0}},isRendered:function(){return!!this._renderTime},updateRenderTime:function(b){b&&
!this.isRendered()&&(this._renderTime=b);return this._renderTime}};return e});"use strict";m.when("A","ready").register("GlanceViewMetric",function(d){function e(a){g.ue&&g.ue.tag&&g.ue.tag(a)}function b(a,b){g.ue&&d.$.isFunction(g.ue.count)&&g.ue.count(a,b)}function k(){var a=decodeURIComponent(g.location.pathname).split("/").pop();if(a&&a.startsWith("ref\x3d"))return a.slice(4);if(g.URLSearchParams)return a=new URLSearchParams(g.location.search),a.get("ref_")||a.get("ref")}var n=!1,h=g.performance,
a={};"object"===typeof h&&(d.$.isFunction(h.getEntriesByType)?d.each(h.getEntriesByType("navigation"),function(a){"back_forward"===a.type&&(n=!0);e(a.type)}):"object"===typeof h.navigation&&(a[h.navigation.TYPE_RELOAD]="reload",a[h.navigation.TYPE_BACK_FORWARD]="back_forward",a[h.navigation.TYPE_NAVIGATE]="navigate",h.navigation.type===h.navigation.TYPE_BACK_FORWARD&&(n=!0),a[h.navigation.type]&&e(a[h.navigation.type])));var c=function(){g.ue&&"function"===typeof g.ue.pause&&g.ue.pause(!1);g.uex&&
"function"===typeof g.uex&&g.uex("ld")};return{clearTimeOuts:function(){if(d.capabilities.localStorage)try{for(var a=0;a<localStorage.length;a++){var b=localStorage.key(a);if(!b.indexOf("dp_timeout_")){var c=localStorage.getItem(b),e=Date.now();c<=e&&localStorage.removeItem(b)}}}catch(k){m.log("Exception while clearing localStorage "+k.message,"FATAL","CachedGlanceViewMetric")}},requestGVLogging:function(a,l){var h=!1;if(d.capabilities.localStorage&&l)try{var q="dp_timeout_"+l.key,r=Date.now()+1E3*
l.timeout;!n&&localStorage.getItem(q)?(d.post(a,{params:{landingASIN:l.landingASIN||"",pageTypeId:l.pageTypeId||"",pageType:l.pageType||"",subPageType:l.subPageType||"",productGlId:l.productGlId||"",groupingASIN:l.groupingASIN||"",productGroupId:l.productGroupId||"",pageAction:l.pageAction||"",isGlanceView:l.isGlanceView||"",viewID:l.viewID||"",hitType:l.hitType||"",pageAssemblyType:l.pageAssemblyType||"",weblabName:l.weblabName||"",weblabTreatment:l.weblabTreatment||"",ref_:k()||""},success:function(a){g.ue&&
"function"===typeof g.ue.reset&&"string"===typeof a&&a.trim()&&(g.ue.reset(a.trim()),e("cachedPage"),b("cachedDetailPage",1));c()},failure:function(a){b("glance_View_request_failed",1);m.log("GV logging service failed with HTTP status "+a.http.status,"FATAL","CachedGlanceViewMetric");c()}}),h=!0):(e("nonCachedPage"),b("nonCachedDetailPage",1),localStorage.setItem(q,r))}catch(t){e("nonCachedPage"),b("nonCachedDetailPage",1),m.log("Exception while logging glance views "+t.message,"FATAL","CachedGlanceViewMetric")}else e("nonCachedPage"),
b("nonCachedDetailPage",1),m.log("Browser does not support local storage.","WARN","CachedGlanceViewMetric");h||c()}}});"use strict";m.when("A","GlanceViewMetric").execute("ClearPreviousTimeouts",function(d,e){e.clearTimeOuts()});m.when("A","GlanceViewMetric","DetailPageLatencyCachedGlanceViewMetricData").execute("LogGVMetric",function(d,e){d.state.parse();d=d.state("dp_latency_page_cache_info");e.requestGVLogging("/gp/latency/metric-logging",d)});m.when("dp-time-to-interactive").register("dp-interactive-page-refresh-handler",
function(d){return{twisterStartTime:null,createInteractivityObjectForTwisterUpdate:function(){this.twisterStartTime=g.parseInt((new Date).getTime());d.updatePage("twisterUpdate")},updateCriticalFeatures:function(){d.updateCriticalFeatures()},updateRenderTime:function(){d.updateRenderTime(this.twisterStartTime)},getClickToCIMetric:function(){return d.getClickToCIPromise("twisterUpdate")}}});m.when("dp-interactive-feature-component").register("dp-interactive-feature-component-base",function(d){function e(b,
e){this.compName=b;this._pageType={};this.getComponentByPageType(e)}e.prototype={getComponentByPageType:function(b){if(b)return this._pageType[b]||(this._pageType[b]=this.getComponent(b)),this._pageType[b]},updateComponentInformation:function(b,e){return this.getComponentByPageType(e).updateComponentInformation(b)},getTimeToInteractivity:function(b,e){return b?this.getComponentByPageType(b).getTimeToInteractivity(e):{interactive:!1,interactiveTime:0}},resetComponentInfo:function(b){b&&this._pageType[b]&&
(this._pageType[b]=this.getComponent(b))},updateRenderTime:function(b,e){return this.getComponentByPageType(b).updateRenderTime(e)},getComponent:function(b){return this._pageType[b]?new d(this._pageType[b]):this._pageType.glance?new d(this._pageType.glance):new d}};return e});m.when("3p-promise").register("dp-click-to-ci",function(d){function e(){this.reject=this.resolve=null;this.resolved=!1;var b=this;this.promiseObject=new d(function(e,d){b.resolve=e;b.reject=d});this.metricInfo={features:{},longPoleFeatureName:"",
interactiveTime:0,allFeaturesInteractive:!1}}e.prototype={getMetricInfo:function(){return this.metricInfo},setMetricInfo:function(b){this.metricInfo=b},getPromiseObject:function(){return this.promiseObject},isResolved:function(){return this.resolved},setResolved:function(b){this.resolved=b}};return e});m.when("A","dp-time-to-interactive","dp-click-to-ci-utils").register("dp-clicktoci-metric-for-glanceview",function(d,e,b){function k(){var f=e.getClickToCIPromise("GLANCE");f&&f.then(function(b){h(b.features);
a(b.features);n(b)}).catch(function(a){b.logCounter("ClickToCIFailureCount")})}function n(a){b.addTag("DPCIFLongPole"+a.longPoleFeatureName);b.widgetTime("cf","clickToCI",{wb:1},a.interactiveTime);b.widgetTime("fn",void 0,void 0,a.interactiveTime);b.postCSMMetrics("ld","clickToCI",{wb:1});g.ue&&ue.isl&&b.postCSMMetrics("at")}function h(a){c.isPlainObject(a.atc)?(a=a.atc,b.addTag("DPCIFBuyable"),b.widgetTime("cf","dpATCTTI",{wb:1},a.interactiveTime),b.postCSMMetrics("ld","dpATCTTI",{wb:1}),a.hasComponents&&
c.isArray(a.components)&&(a=a.components[0],c.isPlainObject(a)&&b.isValidNonEmptyString(a.name)&&b.addTag("DPCIFBuyable-"+a.name))):b.addTag("DPCIFNonBuyable")}function a(a){if(c.isPlainObject(a)){var e=g.performance;"object"===typeof e&&"object"===typeof e.timing&&d.each(a,function(a,c){var f="DP"+c+"TTI";b.logCounter("DPCF"+c+"TTI",a.interactiveTime-e.timing.navigationStart);b.widgetTime("cf",f,{wb:1},a.interactiveTime);b.postCSMMetrics("ld",f,{wb:1})})}}var c=d.$;b.widgetTime("bb","dpATCTTI",{wb:1});
k();m.when("atf").execute("dp-get-critical-interactive-features",function(){e.updateCriticalFeatures()});return{markClickToCI:k,publishTTIOfCriticalFeatures:a,tagBuyablibity:h,publishTimeToInteractive:n}});m.when("A").register("dp-click-to-ci-utils",function(d){return{widgetTime:function(e,b,d,g){"function"===typeof uet&&uet(e,b,d,g)},addTag:function(e){g.ue&&g.ue.tag&&g.ue.tag(e)},logCounter:function(e,b){g.ue&&d.$.isFunction(g.ue.count)&&(b=b||(g.ue.count(e)||0)+1,g.ue.count(e,b))},isValidNonEmptyString:function(e){return"string"===
typeof e&&0<e.length},postCSMMetrics:function(e,b,d){"function"===typeof uex&&uex(e,b,d)}}});m.when("A","3p-promise","dp-click-to-ci-utils").register("dp-critical-features",function(d,e,b){function k(){this._resolve;this._reject=null;var a=this;this._promiseObj=new e(function(b,f){a._resolve=b;a._reject=f});this._features=null;this.isCriticalFeaturesKnown=!1}var g=d.$,h=[];k.prototype={getCriticalFeatures:function(){return this._features},getCriticalFeaturesPromise:function(){return this._promiseObj},
setCriticalFeatures:function(a){g.isPlainObject(a)&&!g.isEmptyObject(a)&&(this._features=a,this._resolve(a),this.isCriticalFeaturesKnown=!0)},setIgnoreCriticalFeatures:function(a){h.push(a)},updateCriticalInteractiveFeatures:function(){var a={},c=g(".dp-cif");c.length?(c.each(function(){var c=(g(this).data()||{}).featureDetails;if(g.isPlainObject(c)&&b.isValidNonEmptyString(c.name)){var e;e=h.length&&h.includes(c.name)?!1:!0;e&&(a[c.name]=c)}else b.logCounter("DPCIFInvalidData")}),this._parseCriticalFeatures(a)):
b.addTag("DPCIFNoData")},_parseCriticalFeatures:function(a){var c={};g.isPlainObject(a)?(d.each(a,function(a,b){c[b]={};g.isPlainObject(a)&&(c[b]=a)}),g.isEmptyObject(c)?b.addTag("DPCIFNoData"):this.setCriticalFeatures(c)):b.addTag("DPCIFNoData")},resetIgnoreCriticalFeatures:function(){h=[]}};return k});"use strict";m.when("A","load").execute("logDpAssetInjectionMetric",function(d){var e=d.state("dp_injected_meta_assets");if("undefined"!=typeof performance&&"undefined"!=typeof performance.getEntries){for(var b=
0,k=0,n=0,h=0,a=performance.getEntries(),c=0;c<a.length;c++){var f=a[c],l=f.initiatorType;f.name.match(/\.css\?AUIClients\/AmazonUI/g)&&l&&"link"===l&&f.duration+f.startTime>b+k&&(b=f.duration,k=f.startTime);if("undefined"!=typeof e&&"undefined"!=typeof e.assetNames&&0<e.assetNames.length)for(var m=0;m<e.assetNames.length;m++)if(f.name.match(new RegExp("\\.css\\?AUIClients/"+e.assetNames[m]))&&l&&"link"===l){if(0===n||n>f.startTime)n=f.startTime;h<f.startTime&&(h=f.startTime);break}}g.ue&&d.$.isFunction(g.ue.count)&&
(g.ue.count("aui.auiDuration",b),g.ue.count("aui.auiStartTime",k),0!==n&&0!==h&&(g.ue.count("dpcss.dpStartTimeMin",n),g.ue.count("dpcss.dpStartTimeMax",h),g.ue.count("dpcss.auiDiffMin",n-k),g.ue.count("dpcss.auiDiffMax",h-k)))}});m.when("A","load").execute("dp-asset-metric-logging",function(d){function e(a){g.ue&&ue.tag&&ue.tag(a)}function b(a,b){g.ue&&ue.count&&a&&ue.count(a,b)}function k(a,c,e){0<c&&(b(a+"EncodeSize",Math.round(c/1024)),b(a+"DecodeSize",Math.round(e/1024)))}function n(a,b,e){return d.filter(a,
function(a){if(a&&a.initiatorType===e&&a.name&&a.name.match(b))return!0})}function h(a,c,e,g){var k={encodedSize:0,decodedSize:0,httpProtocol:"",count:0};d.each(c,function(c){var h=n(a,new RegExp("\\."+e+"\\?AUIClients/"+c),g)||[];k.count+=h.length;d.each(h,function(d,g){g=c+(g+1);if(d&&0<d.encodedBodySize){var h;h=d&&0===d.transferSize?!0:void 0;h?b("DP"+e+"Cached"+g,1):b("DP"+e+"NotCached"+g,1)}g=k.encodedSize;h=d&&d.encodedBodySize?d.encodedBodySize:0;k.encodedSize=g+h;g=k.decodedSize;d=d&&d.decodedBodySize?
d.decodedBodySize:0;k.decodedSize=g+d;k.httpProtocol=a.nextHopProtocol||""})});return k}(function(){if(g.performance&&performance.getEntriesByType){var a=performance.getEntriesByType("navigation")[0];a&&(0<a.encodedBodySize&&(b("DPEncodedSize",Math.round(a.encodedBodySize/1024)),b("DPDecodedSize",Math.round(a.decodedBodySize/1024))),a.nextHopProtocol&&e("DPhttpProtocol"+a.nextHopProtocol))}})();(function(){if(g.performance&&performance.getEntries){var a=performance.getEntries(),c=d.state("dp_injected_meta_assets"),
f=[];c&&c.assetNames&&(f=c.assetNames||[]);var c=h(a,f,"js","script"),l=h(a,["AmazonUI","AmazonUIjQuery"],"js","script"),f=h(a,f,"css","link"),a=h(a,["AmazonUI"],"css","link");k("DPJS",c.encodedSize,c.decodedSize);k("AUIJS",l.encodedSize,l.decodedSize);k("DPCSS",f.encodedSize,f.decodedSize);k("AUICSS",a.encodedSize,a.decodedSize);b("DPCSSResourceCount",f.count);b("DPJSResourceCount",c.count);c.httpProtocol&&e("DPJSHttpProtocal"+c.httpProtocol);f.httpProtocol&&e("DPCSSHttpProtocal"+f.httpProtocol)}})()});
m.when("A").register("get-resource-time",function(d){return{getResourceTimeByName:function(e,b){var k=[];g.performance&&performance.getEntries&&e&&d.$.isArray(b)&&0<b.length&&(k=performance.getEntries(),k=d.filter(k,function(g){return g&&g.initiatorType===e?-1<d.indexOfArray(b,g.name):!1}));return k}}});m.when("A","dp-click-to-ci-utils").register("dp-interactivity-metric-utils",function(d,e){var b=d.$;return{calculateInteractivity:function(d){var g=d.type,h=b(d.target),a=h.closest("div[id$\x3d'_feature_div']");
e.logCounter("Total-"+g);a&&((a=b(a).data("feature-name"))?e.logCounter(a+"-"+g):e.logCounter(d.target.id+"-"+g));(d=h.closest(".a-declarative"))&&(d=b(d).data("action"))&&e.logCounter(d+"-"+g)}}})});
/* ******** */
(function(f){var e=window.AmazonUIPageJS||window.P,l=e._namespace||e.attributeErrors,c=l?l("CommonDetailPageScripts",""):e;c.guardFatal?c.guardFatal(f)(c,window):c.execute(function(){f(c,window)})})(function(f,e,l){f.when("jQuery","jumpLink").execute(function(c,a){var p=c("#miniATFUDP"),b=0;0<p.length&&(b=p.height()+9);1===e.isACRJumplLinkAnimated?a.bind("#acrCustomerWriteReviewLink, #acrCustomerReviewLink, #reviewLink, #reviewLinkShort, #reviewCreateLink",1E3,b):2===e.isACRJumplLinkAnimated?a.bind("#acrCustomerWriteReviewLink, #acrCustomerReviewLink, #reviewLink, #reviewLinkShort, #reviewCreateLink",
1200,b):3===e.isACRJumplLinkAnimated?a.bind("#acrCustomerWriteReviewLink, #acrCustomerReviewLink, #reviewLink, #reviewLinkShort, #reviewCreateLink",1400,b):4===e.isACRJumplLinkAnimated?a.bind("#acrCustomerWriteReviewLink, #acrCustomerReviewLink, #reviewLink, #reviewLinkShort, #reviewCreateLink",10,b):0<p.length&&(b=p.height()+9,a.bind("#acrCustomerWriteReviewLink, #acrCustomerReviewLink, #reviewLink, #reviewLinkShort, #reviewCreateLink",10,b));0<c("#reviewStarsLinkedCustomerReviews").length&&a.bind("#reviewStarsLinkedCustomerReviews",
10,b);0<c("#askATFLink").length&&a.bind("#askATFLink",10,b);f.when("cf").execute(function(f){0<c("#important-information a[href\x3d'#legal-disclaimer']").length&&a.bind("#important-information a[href\x3d'#legal-disclaimer']",10,b,!0)});a.bind("#seeMoreDetailsLink",300,b)});"use strict";f.when("A","jQuery","ImageBlockATF","jumpLink","cf").register("miniATFUtils",function(c,a,p,b){function l(m){t&&!m||u||(m=(new Date).getTime()-x,m=50>m?50-m:10,t=1,t=0,x=(new Date).getTime(),setTimeout(function(){var m=
q.scrollTop(),c=a("#miniATFUDP");if(0<c.length){var d=y;if("T1"===d){d=a("#sims_fbt");if(0>=d.length||0>=d.height())d=a("#buyxgety_feature_div");var b=d,d=Number.MAX_VALUE;if(b&&0<b.length){var h=b.height(),b=b.offset();h&&b&&(d=b.top+h)}d=Math.min(d,1200)}else if("T2"===d){d="#product-details-grid_feature_div #prodDetails #important-information_feature_div #importantInformation #detail-bullets #detail_bullets_id #technical-data #technicalSpecifications_feature_div #productDescription #product-description-iframe #dpx-btf-hlcx-comparison_feature_div #HLCXComparisonWidget_feature_div".split(" ");
b=Number.MAX_VALUE;for(h=0;h<d.length;h++){var g=a(d[h]);if(g&&0<g.length&&0<g.height()){var k;k=Number.MAX_VALUE;g&&0<g.length&&(g=g.offset())&&(k=g.top);k<b&&(b=k)}}d=Math.min(b,1700)-100}else d=void 0;m>d?!v&&c.is(":hidden")&&(c.removeClass("a-hidden"),c.slideDown(200)):(c.slideUp(200),v=0)}},m))}b=a("#miniATFUDP");var z=a("#miniATFPartialSelection")[0],n=a(".twister-dropdown-highlight")[0];if(!(0>=b.length)){var q,v=0,x=0,t=0,r={},u=0,w=0,y="T2";r.setMiniATFShowHeight=function(a){y=a};r.setMiniATFScrollUpHeight=
function(b){w=0;"T1"===b&&(b=a("#productTitle"),0<b.length&&(b=b.offset())&&(w=b.top-20))};a("body").delegate(".go-to-top","click",function(){a("body, html").animate({scrollTop:w},300);v=1;z&&n&&(a(n).removeClass("transparentTwisterDropdownBorder"),a(n).addClass("highlightTwisterDropdownBorder"));return!1});z&&n&&a(n).click(function(){a(this).addClass("transparentTwisterDropdownBorder");a(this).removeClass("highlightTwisterDropdownBorder")});q=a(e);q.scroll(function(){l(0)});q.resize(function(){l(1)});
f.when("ImageBlockBTF").execute(function(b){var f=function(k){var c=k.getState().selected_variations;if(c){var d="",e=k.getState().variation_display_labels;a.each(b.visualDimensions,function(a,k){a=1===b.gIsNewTwister?k:e[k];c[a]&&(d+=" "+c[a])});return d&&d.substring(1)}},e=b.defaultColor,d=e,l=b.landingAsinColor,h,g=a("#miniATF_image");0<g.length&&(h=g.attr("src"));r.updateMiniATFDiv=function(){u=0;var b=a("#miniATF_image");0<b.length&&h&&b.attr("src",h)};c.on("image-block-twister-swatch-click",
function(a,c,g,n){u=1;a=(a=n?n:f(c))&&""!==a?a:e;a===l&&(a=e);a!==d&&(h=(c=a!==e&&a!==l?b:p)&&c.colorImages&&c.colorImages[a]&&0<c.colorImages[a].length&&c.colorImages[a][0]?c.colorImages[a][0].large:null,d=a)})});return r}});"use strict";f.when("ueCount","jQuery").execute(function(c,a){a("#miniATF_BackToTopLink").click(function(){c.incrementCounterByOne("sl_back_to_top_button_click_count")})});"use strict";f.when("jQuery","dp-util-cookie","cf").execute(function(c,a){"000-0000000-8675309"===c("#addToCart").find('input[name\x3d"session-id"]').val()&&
c("#addToCart").find('input[name\x3d"session-id"]').val(a("session-id"))})});
/* ******** */
(function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("SimilaritiesDetailJS",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){});
/* ******** */
(function(b){var d=window.AmazonUIPageJS||window.P,e=d._namespace||d.attributeErrors,a=e?e("DigitalDashDetailPageAssets",""):d;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,d,e){b.register("DigitalDashUtils",function(){return{redirect:function(a){if(!a)throw"Must pass a target URL.";d.location.href=a}}});"use strict";b.when("A","DigitalDashCreateForm").register("DigitalDashAddListeners",function(a,b){a.declarative("digital-dash-create","click",function(a){a.$event.preventDefault();
var c;a.$target.data("DigitalDashCreateForm")?c=a.$target.data("DigitalDashCreateForm"):(c=new b({el:a.data.el,href:a.data.href}),a.$target.data("DigitalDashCreateForm",c));c.submit(a.data.data);return!1});a.on("digital-dash:auto-create",function(a){(new b({el:a.el,href:a.href})).submit(a.data)})});"use strict";b.when("A","DigitalDashUtils","a-alert").register("DigitalDashCreateForm",function(a,g,d){function c(a){f.extend(this,h,a);if(!this.el)throw"Must specify an el";if(!this.href)throw"Must specify an href to post to";
this.$el=f(this.el);this.$el.find(this.errorAlertSelector).removeClass("aok-hidden").end();this.$errorAlert=d(this.$el.find(this.errorAlertSelector));this.baseErrorText=this.$errorAlert.text();this.$changeover=this.$el.find(this.changeoverSelector)}var f=a.$,h={errorAlertSelector:"#digital-dash-create-error-message",ajaxFieldName:"isAjax",changeoverSelector:"#digital-dash-create-success-changeover"};c.prototype.submit=function(b){this.$el.removeClass("success").removeClass("error");b[this.ajaxFieldName]=
!0;a.ajax(this.href,{method:"POST",params:b,success:f.proxy(this.handleAjaxSuccess,this),error:f.proxy(this.handleAjaxError,this)})};c.prototype.handleAjaxSuccess=function(a){a.success||510===a.error.errorCode?(this.$changeover.show(),this.$el.addClass("success")):(a.error.errorTitle&&this.$errorAlert.heading(a.error.errorTitle),a.error.errorMessage?this.$errorAlert.text(a.error.errorMessage):this.$errorAlert.text(this.baseErrorText),this.$el.addClass("error"))};c.prototype.handleAjaxError=function(a){if(401===
a.http.status)try{return g.redirect(a.http.responseText)}catch(c){b.log("Error parsing unauth response: "+c,"ERROR","DigitalDashCreateForm")}else b.log("Create dash button call failed, could not recognize response from server.","FATAL","DigitalDashCreateForm");this.$el.addClass("error")};return c});"use strict";b.when("A","DigitalDashAddListeners","load").execute("DigitalDashAutoAction",function(a){var b=a.state("digital-dash-auto-action");if(b)a.trigger(b.actionName,b.data);else a.on("a:state:update:digital-dash-auto-action",
function(d){a.trigger(b.actionName,a.state("digital-dash-auto-action").data)})});"use strict";b.when("A","a-popover").execute("DigitalDashPopoverManager",function(a,d){var e=a.$,c=a.throttle(function(a){a.updatePosition()},500,{trailing:!1});a.on("a:popover:ajaxContentLoaded:dd-create-learn-more",function(a){var d=a.popover;a=e(d.getContent());a.html()?a.find("img").each(function(){e(this).bind("load",function(){c(d)})}):b.log("dd-create-learn-more lazyPositionPopover popover content not ready","WARN",
"DigitalDashPopoverManager")})})});
/* ******** */
(function(d){var c=window.AmazonUIPageJS||window.P,a=c._namespace||c.attributeErrors,b=a?a("DetailPageOffersMulticlickAssets",""):c;b.guardFatal?b.guardFatal(d)(b,window):b.execute(function(){d(b,window)})})(function(d,c,a){d.when("A","preventMulticlick:forceFormSubmit","atf").execute(function(b,d){function e(b){c.ue&&c.ue.count&&c.ue.count(b,1)}var f=!1,a=function(c){var a=b.$(document);a&&a.delegate(c,"click",function(){var a=b.$(c);if(!a||"submit"!==a.prop("type"))return!0;if(f)return e("oneClickDisableOneClickButton"),
a.attr("disabled",!0),!1;e("oneClickTriggerOneClickFormSubmit");d(a);f=!0;setTimeout(function(){e("oneClickEnableOneClickButtonAfterTimeout");f=!1;a.attr("disabled",!1)},3E4);return!0})};b.on("mash:willReappear",function(){e("oneClickEnableOneClickButtonOnMashReappear");f=!1});a("#one-click-button");a("#oneClickBuyButton");a("#prime-toggle-main");e("oneClickPreventMultiClickModuleCalled")});"use strict";d.when("A","atf").register("preventMulticlick:forceFormSubmit",function(a){return function(a){}})});
/* ******** */
(function(c){var d=window.AmazonUIPageJS||window.P,g=d._namespace||d.attributeErrors,e=g?g("DetailPageDesktopOffersAssets",""):d;e.guardFatal?e.guardFatal(c)(e,window):e.execute(function(){c(e,window)})})(function(c,d,g){c.when("jQuery","a-popover","A","a-dropdown","moq-core","ready").register("moq",function(e,k,h,c,f){function d(a,b){0===c.getSelect(b).val().length?f.lockSubmission(a,e.noop,t):f.unlockSubmission(a,u)}function g(a){a=f.findMoqOfferContainerWithDomElement(a.nativeItemNode);if(null!==
a){var b=a.find("#quantity, #rcxsubsQuan");d(a,b);f.tweakDisplayTextForMoqQuantityDropdown(b)}}function l(a){return f.findMoqOfferContainerWithDomElement(a.popover.$trigger[0]).find("#quantity, #rcxsubsQuan")}function v(){n||(h.on("a:popover:beforeShow:moqAtcPopover",function(a){var b=l(a);0!==b.length&&(p(b),setTimeout(function(){b.addClass("highlightQuantityDropdownBorder")},20))}),h.on("a:popover:afterHide:moqAtcPopover",function(a){a=l(a);0!==a.length&&(a.removeClass("highlightQuantityDropdownBorder"),
q(a))}),h.on("a:popover:beforeShow:MOQPreLoadPopOver",function(a){a=l(a);0!==a.length&&p(a)}),h.on("a:popover:afterHide:MOQPreLoadPopOver",function(a){a=l(a);0!==a.length&&q(a)}),h.on("a:dropdown:rcxsubsQuan:select",g),h.on("a:dropdown:quantity:select",g),n=!0)}function r(a){var b=a.parent().parent("div").innerWidth()-a.prev("label").outerWidth()-5;100<b&&a.width(b)}function t(a){if(null===k.get(a)){var b=f.findMoqOfferContainerWithDomElement(a[0]).find("script#moqPopoverContent");0!==b.length&&(b=
b.html(),a.addClass("cursorDisabled"),k.create(a,{name:"moqAtcPopover",position:"triggerLeft",closeButton:"false",inlineContent:b}))}}function u(a){null!==k.get(a)&&(a.removeClass("cursorDisabled"),k.remove(a))}function q(a){setTimeout(function(){m--;0<m||(a.prop("disabled",!1),a.removeClass("quantityBarGrayOut"))},370)}function p(a){m++;0===c.getSelect(a).val().length&&(a.prop("disabled",!0),a.addClass("quantityBarGrayOut"))}function w(a){var b=a.find("#quantity, #rcxsubsQuan");0===b.length||b.hasClass("aok-hidden")||
(c.getSelect(b).setValue(""),r(b),x(a),d(a,b))}function x(a){if(0!==a.length){var b=a.find("#quantity, #rcxsubsQuan");a.click(function(){setTimeout(function(){r(b)},20)})}}var n=!1,m=0;return{initializeQuantitySelect:function(){var a=f.findMoqOfferContainers();0!==a.length&&(a.forEach(w),v())}}});"use strict";c.when("dp-click-counter").execute("dp-desktop-atc-click-counter",function(c){var d=document.getElementById("add-to-cart-button");d&&c.record(d,"dp-desktop-atc")})});
/* ******** */
(function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("DetailPageFeaturesAssets",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){});
/* ******** */
(function(p){var m=window.AmazonUIPageJS||window.P,w=m._namespace||m.attributeErrors,e=w?w("VasUpsellWidgetAsset",""):m;e.guardFatal?e.guardFatal(p)(e,window):e.execute(function(){p(e,window)})})(function(p,m,w){p.when("A","ready").register("vas-metrics-publisher",function(e){var b=e.$,a=function(a,c){if(a&&32>=a.length){var d="?",g="";c&&(c.additionalRequestData&&(g+=d+"additionalRequestData\x3d"+JSON.stringify(c.additionalRequestData),d="\x26"),c.productAsin&&(g+=d+"pageAsin\x3d"+c.productAsin,
d="\x26"),c.upsellAsin&&(g+=d+"pageTypeId\x3d"+c.upsellAsin,d="\x26"),c.pageType&&(g+=d+"pageType\x3d"+c.pageType,d="\x26"),c.subPageType&&(g+=d+"subPageType\x3d"+c.subPageType,d="\x26"),g=c.hitType?g+(d+"hitType\x3d"+c.hitType):g+(d+"hitType\x3dpopUp"),d="\x26",c.merchantId&&(g+=d+"merchantId\x3d"+c.merchantId,d="\x26"),c.upsellAsinPrice&&(g+=d+"sdpMinimumPriceNew\x3d"+c.upsellAsinPrice,d="\x26"),c.productAsinPrice&&(g+=d+"merchantAsinPrice\x3d"+c.productAsinPrice));b.get("/gp/ls/impress.html/ref\x3d"+
a+g)}},h=function(a,b,d){var c="";a&&b&&d&&(c=a+"_"+b+"_"+d);return c},c=function(a,b,d,c){var g="";a&&b&&d&&c&&(g=a+"_"+b+"_"+d+"_"+c);return g},g=function(a,b){"undefined"!==typeof m.ue&&"undefined"!==typeof m.ue.count&&("undefined"===typeof b?m.ue.count(a,1):m.ue.count(a,b))};return{metric:function(a){"undefined"!==typeof m.ue&&"undefined"!==m.ue.count&&m.ue.count("vas_ppd_"+a,1)},increaseMetricBy:function(a,b){"undefined"!==typeof m.ue&&"undefined"!==m.ue.count&&m.ue.count("vas_ppd_"+a,b)},log:function(a){m.ueLogError&&
m.ueLogError(a,{logLevel:"ERROR",attribution:"ppd-bundles"})},logFatal:function(a,b,d){m.ueLogError&&m.ueLogError({message:a},{message:d,logLevel:"FATAL",attribution:b})},logRefTag:function(a,c,d,g,n,e,h,x,r){if(a){var u="?",v="";c&&(v+=u+"pageType\x3d"+c,u="\x26");d&&(v+=u+"subPageType\x3d"+d,u="\x26");g&&(v+=u+"pageTypeId\x3d"+g,u="\x26");v=n?v+(u+"hitType\x3d"+n):v+(u+"hitType\x3dpopUp");u="\x26";e&&(v+=u+"merchantId\x3d"+e,u="\x26");h&&(v+=u+"pageAsin\x3d"+h,u="\x26");x&&(v+=u+"sdpMinimumPriceNew\x3d"+
x,u="\x26");r&&(v+=u+"merchantAsinPrice\x3d"+r);b.get("/gp/ls/impress.html/ref\x3d"+a+v);"undefined"!==typeof m.ue&&"undefined"!==m.ue.count&&m.ue.count(a,1)}},logUeMetricIncreaseCount:g,getCSMName:h,getRefMarker:c,increaseCSMCounterBy:function(a,b){a&&"undefined"!==typeof m.ue&&"undefined"!==typeof m.ue.count&&m.ue.count(a,(m.ue.count(a)||0)+b)},logCSMCounter:function(a){a&&"undefined"!==typeof m.ue&&"undefined"!==typeof m.ue.count&&m.ue.count(a,(m.ue.count(a)||0)+1)},createCSMNameAndLog:function(a,
b,d){a=this.getCSMName(a,b,d);this.logCSMCounter(a);return a},logHit:a,createRefMarkerAndLog:function(a,b,d,c,g){a=this.getRefMarker(a,b,d,c);this.logHit(a,g);return a},logReftagAndCSMMetricForWidgetAction:function(b,e,d,l,n){var q=h(l,e,b);g(q);b=c(l,d,e,b);a(b,n)},hitParameterKeys:{upsellAsin:"upsellAsin",productAsin:"productAsin",pageType:"pageType",subPageType:"subPageType",upsellAsinPrice:"upsellAsinPrice",productAsinPrice:"productAsinPrice",hitType:"hitType",additionalRequestData:"additionalRequestData",
merchantId:"merchantId",zipCode:"zip"},CSMActionTypes:{glanceView:"gv",addToCart:"att",buyBack:"bbk",buyNow:"bnw",serviceIncluded:"incl",serviceNotIncluded:"cncl",expandBulletPoints:"expbp",collapseBulletPoints:"colbp",redirect:"redir",skip:"skip",escape:"escape"},RefmarkerActionTypes:{glanceView:"gv",glanceViewDisabled:"gvDis",addToCart:"att",buyBack:"bbk",buyNow:"bnw",serviceIncluded:"incl",serviceNotIncluded:"cncl",expandBulletPoints:"expbp",collapseBulletPoints:"colbp",redirect:"redir",hyperLinkClick:"click",
popoverShow:"popshow"}}});p.register("vas-utilities",function(e){return{generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"===b?a:a&3|8).toString(16)})},getPriceValue:function(b){var a=/[+-]?\d+(\.\d+)?/g;if(null!==b.match(a))return b.match(a).map(function(a){return parseFloat(a)})[0]},validateZipCode:function(b,a){return(new RegExp(a.val())).test(b)?!0:!1}}});p.when("A","vas-common-settings","vas-metrics-publisher",
"vas-mobile-config").register("vas-metric-utils",function(e,b,a,h){var c=h.mobileMetricConstants;return{createHitParameters:function(c){var f=b.getSetting("widgetCommonVM"),e=b.getSetting("winningWidgetVM"),d={},l={},e=e.baseAsinOfferData===w?e:e.baseAsinOfferData;l[c.additionalRequestDataKeys.zipCode]=f.zipCode;d[a.hitParameterKeys.productAsin]=f.productAsin;d[a.hitParameterKeys.upsellAsin]=e.upsellAsin;d[a.hitParameterKeys.merchantId]=f.merchantId;d[a.hitParameterKeys.productAsinPrice]=f.buyboxPrice;
d[a.hitParameterKeys.pageType]=c.hitRecordConstants.pageType;d[a.hitParameterKeys.upsellAsinPrice]=e.winningServiceMinPrice;d[a.hitParameterKeys.subPageType]=c.hitRecordConstants.subPageType;d[a.hitParameterKeys.additionalRequestData]=l;return d},createGlobalHitParameters:function(c){var f={},e=b.getSetting("widgetCommonVM");if(e){if(null===c||c===w)c={};c[a.hitParameterKeys.zipCode]=e.zipCode;f[a.hitParameterKeys.additionalRequestData]=c;f[a.hitParameterKeys.productAsin]=e.productAsin;f[a.hitParameterKeys.merchantId]=
e.merchantId;if(c=b.getSetting("winningWidgetVM"))f[a.hitParameterKeys.upsellAsin]=(c.baseAsinOfferData===w?c:c.baseAsinOfferData).upsellAsin}return f},getMobileMetricConstants:function(){b.getSetting("widgetCommonVM").isApp?(c.metricPrefixes.widget="mobiletwister"===b.getSetting("winningWidgetVM").winningWidgetName?"aft":"aftxl",c.refmarkerPrefixes.widget="mobiletwister"===b.getSetting("winningWidgetVM").winningWidgetName?"aft":"aftxl"):(c.metricPrefixes.widget="mobiletwister"===b.getSetting("winningWidgetVM").winningWidgetName?
"mft":"mftxl",c.refmarkerPrefixes.widget="mobiletwister"===b.getSetting("winningWidgetVM").winningWidgetName?"mft":"mftxl");return c}}});p.register("vas-device-constants",function(){return{DIV:{PRODUCT_QUANTITY_ID:"#quantity"}}});p.when("A","ready").register("vas-url-util",function(e){function b(a){return l.Q_STRING_REGEX.test(a)}function a(a){a=l.VAS_REGEX.exec(a);return null===a||3>=a.length?"":a[2]}function h(a,b){return a.replace(l.VAS_REGEX,"$1vas\x3d"+encodeURIComponent(b))}function c(a){a=
a.replace(l.VAS_REGEX,"");return 0<a.length&&"\x26"===a.charAt(0)?"?"+a.substring(1,a.length):a}function g(a,b,c){delete b[c];b=d(b);return h(a,b)}function f(a,b){return 0!==Object.keys(a).length&&b in a?!0:!1}function k(a){return JSON.parse(a.replace(/'/g,'"'))}function d(a){return JSON.stringify(a).replace(/"/g,"'")}var l={VAS_REGEX:/(\?|\&)vas=(.*?)(?=(&|$))/,Q_STRING_REGEX:/\?.*$/};return{getDecodedQueryParamString:function(){return decodeURIComponent(m.location.search)},getPathName:function(){return m.location.pathname},
doesAnyQueryStringExist:b,doesVasQueryParamExist:function(a){return l.VAS_REGEX.test(a)},getVasQueryParamValue:a,addOrUpdateKeyInVasQryParam:function(b,c,f){b=a(b);b=k(b);b[c]=f;return d(b)},replaceExistingVasParam:h,appendVasQueryParam:function(a,d){var c;c=b(a)?"\x26":"?";return a+c+"vas\x3d"+encodeURIComponent(d)},removeOrUpdateVasQryParamWithMarker:function(a,b,d){if(!f(b,d))throw Error("vas: specified key "+d+" does not exist");return 1===Object.keys(b).length?c(a):g(a,b,d)},removeVasQueryParam:c,
removeMarkerFromVasQueryParam:g,doesKeyExist:f,parseSingleQuotedStringAsJson:k,stringifyJsonWithSingleQuotes:d}});p.when("A","vas-metrics-publisher","ready").register("vas-atc-tracker",function(e,b){e=e.$;var a=!1,h=null,c=null,g=0,f=null,k=null,d=!1,l,n=function(){return 0===g?!1:!0},q=function(a,d){"undefined"!==typeof d?b.logUeMetricIncreaseCount(a+(l.showSTSServiceInterstitial||l.isParentServiceAsin?"_sts":""),d):b.logUeMetricIncreaseCount(a+(l.showSTSServiceInterstitial||l.isParentServiceAsin?
"_sts":""))},t=function(){if(a){var d=h;null!==d&&(d=((new Date).getTime()-d)/1E3,q("vas_si_hijack_interval_time",d),300<d&&(b.logRefTag("vas_si_hijack_interval_time_5M_"+l.productAsin+"_"+l.serviceAsin),b.logFatal("Customer spending more than 5 min on SI widget","vas-si","[context::productAsin\x3d"+l.productAsin+",serviceAsin\x3d"+l.serviceAsin+",zip\x3d"+l.zipCode+"] ")))}},x=function(){if(n()){var a=c;null!==a&&(a=((new Date).getTime()-a)/1E3,q("vas_si_dismissal_interval_time",a),30<a&&(b.logRefTag("vas_si_hijack_dismissal_time_30S_"+
l.productAsin+"_"+l.serviceAsin),b.logFatal("Customer spending more than 30 sec on page after trying to dismiss SI widget","vas-si","[context::productAsin\x3d"+l.productAsin+",serviceAsin\x3d"+l.serviceAsin+",zip\x3d"+l.zipCode+"] ")))}},r=function(){if(!d&&(d=!0,a)){q("vas_si_hijack_unload");b.logRefTag("vas_si_hijack_unload"+l.productAsin+"_"+l.serviceAsin);var c=h;if(null!==c){var f=(new Date).getTime();q("vas_si_hijack_unload_total_time",f-c);b.logFatal("Customer may be stuck on SI widget","vas-si",
"[context::productAsin\x3d"+l.productAsin+",serviceAsin\x3d"+l.serviceAsin+",zip\x3d"+l.zipCode+"] ")}}return!0};e(m).unbind("beforeunload");e(m).bind("beforeunload",r);e(m).unbind("unload");e(m).bind("unload",r);return{isHijacked:function(){return a},setHijacked:function(){a||(a=!0,q("vas_si_atcHijack"),b.logRefTag("vas_si_atcHijack"),h=(new Date).getTime(),f=m.setInterval(t,6E4),k=m.setInterval(x,2E4))},unsetHijacked:function(){if(a){if(null!==h){var d=((new Date).getTime()-h)/1E3;q("vas_si_hijack_total_time",
d)}a=!1;q("vas_si_atcUnHijack");b.logRefTag("vas_si_atcUnHijack");h=null;g=0;c=null;null!==f&&(m.clearInterval(f),f=null);null!==k&&(m.clearInterval(k),k=null)}},getHijackTime:function(){return h},logHijackMetricOnPageUnload:r,setHijackDismissalAttempt:function(){0===g&&(c=(new Date).getTime());g++;1<g?q("vas_si_dismissal_count",1):q("vas_si_dismissal_count",0);2===g&&b.logFatal("SI widget is dismissed mulitple times","vas-si","[context::productAsin\x3d"+l.productAsin+",serviceAsin\x3d"+l.serviceAsin+
",zip\x3d"+l.zipCode+"] ")},getDismissalTime:function(){return c},isDismissalAttempted:n,setWidgetMetaData:function(a){l=a},logMetric:q}});p.when("A","vas-metrics-publisher","vas-atc-tracker","ready").register("vas-atc-helper",function(e,b,a){var h=e.$,c,g=function(){a.logMetric("vas_si_atcClick_returnFalse");c&&(b.logFatal("Add to cart is clicked multiple times with vas SI","vas-si","[context::productAsin\x3d"+c.productAsin+",serviceAsin\x3d"+c.serviceAsin+",zip\x3d"+c.zipCode+"] "),b.logHit("vas_si_atcClick_returnFalse",
{upsellAsin:c.serviceAsin,productAsin:c.productAsin,additionalRequestData:c.zipCode}));return!1},f=function(){a.logMetric("vas_si_forceSafeATC_click");c.isMBCClick&&c.atcButton.bind("click",function(){var a=h(this).find("a")[0];a&&a.href&&(m.location.href=a.href)});if(c.atcButton)c.atcButton.unbind("click.lsatc").click().bind("click.lsatc",g);else{var b=h("#addToCart");b.append('\x3cinput type\x3d"hidden" id\x3d"add-to-cart-button" name\x3d"submit.add-to-cart" value\x3d"Add To Cart" /\x3e');b.submit()}},
k=function(){a.logMetric("vas_si_safeATC_click");c.atcEventInProgress||f()},d=function(){return{"session-id":h("#session-id").attr("value"),ASIN:c.productAsin,offerListingID:h("#offerListingID").attr("value"),isMerchantExclusive:h("#isMerchantExclusive").attr("value"),merchantID:h("#merchantID").attr("value"),isAddon:h("#isAddon").attr("value"),nodeID:h("#nodeID").attr("value"),sellingCustomerID:h("#sellingCustomerID").attr("value"),qid:h("#qid").attr("value"),sr:h("#sr").attr("value"),storeID:h("#storeID").attr("value"),
tagActionCode:h("#tagActionCode").attr("value"),viewID:h("#viewID").attr("value"),rsid:h("#rsid").attr("value"),sourceCustomerOrgListID:h("#sourceCustomerOrgListID").attr("value"),sourceCustomerOrgListItemID:h("#sourceCustomerOrgListItemID").attr("value"),wlPopCommand:"",quantity:h("#quantity").attr("value"),"submit.add-to-cart":"Submit+Query"}},l=function(b,d,f){document.body.style.cursor="default";a.logMetric(f,0);if(c.productAsin&&c.serviceAsin){f={dsc:1,productASIN:c.productAsin};var e=c.zipCode;
b=h(b);if(b=(b=(b=(b=(b=h(".giftableItem, .nonGiftableItem",b))&&b[0])&&b.outerHTML)&&h(b))&&b.attr("itemid"))f.itemID=b,f.newItems=b+",1",f.isHUC="true";e&&(f.area=e);f=JSON.stringify(f).replace(/"/g,"'");f="?vas\x3d"+encodeURIComponent(f)+"\x26psc\x3d1";a.unsetHijacked();m.location.href="/gp/product/"+c.serviceAsin+"/ref\x3d"+d+f;a.logMetric("vas_siatc_sdp_redirect")}else a.logMetric("vas_siatc_huc_redirect"),a.unsetHijacked(),m.location.href="/gp/cart/view.html";return!1},n=function(b){a.logMetric(b);
document.body.style.cursor="default";f();return!1},q=function(){var a,b,d,f;c.isMBCClick&&"undefined"!==typeof c.offerListingID&&(d=c.atcButton.find("a")[0])&&d.href&&(a=d.href,c.showSIATC&&(b=2,(f=a.match(/itemCount=([0-9]+)/i))&&f[1]&&(f=parseInt(f[1],10))&&(b=f+1),a=a.replace(/itemCount=([0-9]+)/i,"itemCount\x3d"+b)+"\x26offeringID."+b+"\x3d"+c.offerListingID,d.href=a));return a},t=function(){var a={};a.upsellAsin=c.serviceAsin;a.offerlistingId=c.offerListingID;a.merchantId=c.merchantId;e.trigger("vas:add-service-asin-buybox-event",
a)};return{addServiceToCart:function(b){var f=q();if(c.showSIATC)t(),a.logMetric("vas_siatc_service_added"),k();else{if(c.atcEventInProgress)return!1;c.atcEventInProgress=!0;a.logMetric("vas_si_addProduct");var e=function(a){l(a,b,"vas_siatc_sdp_redirect_ajaxFail")},g=function(a){n("vas_siatc_sdp_redirect_ajaxFail")};c.isMBCClick?h.get(f).done(e).fail(g):(f=d(),h.post("/gp/product/handle-buy-box/ref\x3dvas_dphbb_"+c.productAsin+"_"+c.serviceAsin,f).done(e).fail(g));document.body.style.cursor="progress"}return!1},
addProductToCartAndGoToSDP:function(a){var b,f=function(b){l(b,a,"vas_siatc_handle_buybox_ajax_fail")},e=function(){n("vas_siatc_handle_buybox_ajax_fail")};if(c.isMBCClick){var g=c.atcButton.find("a")[0];g&&g.href&&(b=g.href);h.get(b).done(f).fail(e)}else b=d(),h.post("/gp/product/handle-buy-box/ref\x3dvas_dphbb_"+c.productAsin+"_"+c.serviceAsin,b).done(f).fail(e);document.body.style.cursor="progress";return!1},lsATCHandlerSuppressATC:g,safeATCClick:k,forceSafeATCClick:f,setWidgetMetaData:function(a){c=
a}}});p.when("A","vas-device-constants","vas-metrics-publisher","vas-metric-utils","ready").register("vas-service-quantity-helper",function(e,b,a,h){function c(c){var e=g(b.DIV.PRODUCT_QUANTITY_ID);if(0>=e.length)return 1;if(null===c||c===w)c="";e=Number(e.val());if(isNaN(e)||0>=e)return e=h.createGlobalHitParameters(),a.logHit("vas_qtyEval",e),a.createCSMNameAndLog("vas","qtyEval"+c,"fail"),1;a.createCSMNameAndLog("vas","qty"+c,"success");1<e&&(c=h.createGlobalHitParameters({qty:e}),a.logHit("vas_multiQty",
c));return e}var g=e.$;return{getServiceQuantity:function(a,b){return a?c(b):1}}});p.when("A","vas-metrics-publisher","vas-utilities","vas-common-settings","vas-service-quantity-helper","vas_manage_forms").register("vas-core-buybox",function(e,b,a,h,c,g){function f(){var b=h.getSetting("widgetCommonVM"),d={};d.itemAssocId=a.generateUUID();d.addItemAssociation=b.isShipToStore||b.shouldAddItemAssociation||b.showUnifiedGuruExperience;return d}function k(a){try{"undefined"!==typeof a.offerlistingId&&
x()&&t("add",a.offerlistingId),b.increaseMetricBy("mbcFormAppend_fail",0),b.metric("mbcFormAppend_success")}catch(d){b.increaseMetricBy("mbcFormAppend_success",0),b.metric("mbcFormAppend_fail"),b.log(d)}}function d(){try{x()&&t("remove"),b.increaseMetricBy("mbcFormRemove_fail",0),b.metric("mbcFormRemove_success")}catch(a){b.increaseMetricBy("mbcFormRemove_success",0),b.metric("mbcFormRemove_fail"),b.log(a)}}function l(a){var b=n(q.BUY_BACK_FORM_ID),d=n(q.ADD_TO_CART_FORM_ID),d=Math.max(d.find("input[name^\x3d'asin']").length+
1,b.find("input[name^\x3d'asin']").length+1);if(b.length){var f=c.getServiceQuantity(h.getSetting("widgetCommonVM").multiQuantityPurchaseEnabled);b.append('\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"quantity.'+d+'" name\x3d"quantity.'+d+'" value\x3d"'+f+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"asin.'+d+'" name\x3d"asin.'+d+'" value\x3d"'+a.upsellAsin+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"offeringID.'+
d+'" name\x3d"offeringID.'+d+'" value\x3d"'+a.offerlistingId+'" /\x3e')}}var n=e.$,q={PRODUCT_QUANTITY_ID:"#quantity",ADD_TO_CART_FORM_ID:"#addToCart",BUY_BACK_FORM_ID:"#buyBackBuyNow",MOBB_FORM_ID:"#second_new_accordion_form"},t=function(a,b){n("#mbc .a-button").each(function(){var d=n(this);d.text();var d=d.find("a")[0],c,f,e;if(d&&d.href){var g=d.href;(e=g.match(/itemCount=([0-9]+)/i))&&e[1]&&((f=parseInt(e[1],10))&&"add"===a?c=f+1:f&&"remove"===a&&(c=f-1));c&&(g=g.replace(/itemCount=([0-9]+)/i,
"itemCount\x3d"+c),"add"===a&&b?g+="\x26offeringID."+c+"\x3d"+b:"remove"===a&&(g=g.replace(new RegExp("\x26offeringID."+f+"\x3d[^\x26]*"),"")),d.href=g)}})},x=function(){var a=h.getSetting("widgetCommonVM");return(a.populateMBCATC||a.showFakeTwisterBundles||a.showEnhancedUpsellBundle)&&!a.showUnifiedGuruExperience},r=function(a){g.removeFieldsFromBuyBoxForm("addToCart");d();g.addFieldsInBuyBoxForm("addToCart",a.data.asinOfferData,f(),!1);k(a.data.asinOfferData);l(a.data.asinOfferData)},u={addServiceAsinBuybox:function(a){g.addFieldsInBuyBoxForm("addToCart",
a,f(),!1);k(a);var b=n(q.MOBB_FORM_ID),d=b.find("input[name^\x3d'offeringID']").length+1,e=b.find('input[name\x3d"itemCount"]');if(b.length){var l=c.getServiceQuantity(h.getSetting("widgetCommonVM").multiQuantityPurchaseEnabled),l='\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"quantity.'+d+'" name\x3d"quantity.'+d+'" value\x3d"'+l+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"asin.'+d+'" name\x3d"asin.'+d+'" value\x3d"'+a.upsellAsin+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"offeringID.'+
d+'" name\x3d"offeringID.'+d+'" value\x3d"'+a.offerlistingId+'" /\x3e';0===e.length?b.append('\x3cinput type\x3d"hidden" name\x3d"itemCount" value\x3d"'+d+'"\x3e'):e[0].value=d;b.append(l)}h.getSetting("widgetCommonVM").multiQuantityPurchaseEnabled&&(n(document.body).undelegate(q.PRODUCT_QUANTITY_ID,"change",r),n(document.body).delegate(q.PRODUCT_QUANTITY_ID,"change",{asinOfferData:a},r))},removeServiceAsinBuybox:function(){g.removeFieldsFromBuyBoxForm("addToCart");d();n(document.body).undelegate(q.PRODUCT_QUANTITY_ID,
"change",r)},addServiceAsinToBuyBack:function(a){l(a)}};return{registerBuyboxEventHandlers:function(){e.off("vas:add-service-asin-buybox-event");e.on("vas:add-service-asin-buybox-event",function(a){u.addServiceAsinBuybox(a)});e.off("vas:remove-service-asin-buybox-event");e.on("vas:remove-service-asin-buybox-event",function(){u.removeServiceAsinBuybox()});e.off("vas:add-service-asin-buyback-form-event");e.on("vas:add-service-asin-buyback-form-event",function(a){u.addServiceAsinToBuyBack(a)})}}});p.when("A",
"vas-metrics-publisher","vas-common-settings","vas-service-quantity-helper","ready").register("vas_manage_forms",function(e,b,a,h){function c(a,b){var c=g("*[id\x3d"+a+"]");if("retailheavybulky"===b.mappingSet||"heavybulky"===b.mappingSet)c=c.not("#usedAccordionRow *[id\x3d"+a+"]");return c}var g=e.$,f={retailheavybulky:"RetailHeavyBulky",heavybulky:"HeavyBulky"},k="vdo_devices_display_on_website premium_ce_brands_display_on_website amazon_ereaders_display_on_website amazon_home_display_on_website amazon_shm_display_on_website amazon_smp_display_on_website amazon_tablets_display_on_website digital_devices_7_display_on_website digital_products_3_display_on_website fsn_devices_display_on_website sud_devices_display_on_website digital_accessories_3_display_on_website digital_accessories_4_display_on_website digital_accessories_5_display_on_website digital_device_acc_display_on_website".split(" ");
return{addFieldsInBuyBoxForm:function(d,e,n,q){try{var t=a.getSetting("widgetCommonVM");c(d,t).each(function(){var b=g(this),d;d=q?b.find("input[name^\x3d'offeringID']").length:b.find("input[name^\x3d'offeringID']").length+1;var c=n.itemAssocId,v=d+1,p=n.addItemAssociation,m=h.getServiceQuantity(t.multiQuantityPurchaseEnabled),w=b.find('input[name\x3d"itemCount"]');0<k.indexOf(t.productWDG)&&(d=0===w.length?1:w[0].value);if("undefined"!==typeof e.offerlistingId){b.append('\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"quantity.'+
d+'" name\x3d"quantity.'+d+'" value\x3d"'+m+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"asin.'+d+'" name\x3d"asin.'+d+'" value\x3d"'+e.serviceAsin+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"offeringID.'+d+'" name\x3d"offeringID.'+d+'" value\x3d"'+e.offerlistingId+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"merchantID.'+d+'" name\x3d"merchantID.'+d+'" value\x3d"'+e.merchantId+'" /\x3e');if(p){c='\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-name.'+
v+'.1" name\x3d"custom-name.'+v+'.1" value\x3d"itemAssoc" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-value.'+v+'.1" name\x3d"custom-value.'+v+'.1" value\x3d"'+c+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-name.1.1" name\x3d"custom-name.1.1" value\x3d"itemAssoc" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-value.1.1" name\x3d"custom-value.1.1" value\x3d"'+c+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-name.1.2" name\x3d"custom-name.1.2" value\x3d"UNIQ-itemAssoc" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-value.1.2" name\x3d"custom-value.1.2" value\x3d"'+
c+'" /\x3e';a:{p=e.asin;if((m=a.getSetting("winningWidgetVM"))&&m.vasTwisterOptions&&m.vasTwisterOptions[p]&&(p=m.vasTwisterOptions[p].mappingSet)&&f.hasOwnProperty(p)){p=f[p];break a}p=void 0}p&&(c+='\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-name.1.3" name\x3d"custom-name.1.3" value\x3d"itemAssocType" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-value.1.3" name\x3d"custom-value.1.3" value\x3d"'+p+'" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-name.'+
v+'.2" name\x3d"custom-name.'+v+'.2" value\x3d"itemAssocType" /\x3e\x3cinput type\x3d"hidden" class\x3d"atcFormServiceAsinData" id\x3d"custom-value.'+v+'.2" name\x3d"custom-value.'+v+'.2" value\x3d"'+p+'" /\x3e');b.append(c)}0===w.length?b.append('\x3cinput type\x3d"hidden" name\x3d"itemCount" value\x3d"'+d+'"\x3e'):w[0].value=Math.max(d,w[0].value)}});b.increaseMetricBy("vas_"+d+"_FormAppend_fail",0);b.metric("vas_"+d+"_FormAppend_success")}catch(x){b.increaseMetricBy("vas_"+d+"_FormAppend_success",
0),b.metric("vas_"+d+"_FormAppend_fail"),b.log(x)}},removeFieldsFromBuyBoxForm:function(d){try{g(".atcFormServiceAsinData").remove();var c=g("#"+d).find('input[name\x3d"itemCount"]');-1===k.indexOf(a.getSetting("widgetCommonVM").productWDG)&&0!==c.length&&1<=c[0].value&&--c[0].value;b.increaseMetricBy("vas_"+d+"FormRemove_fail",0);b.metric("vas_"+d+"FormRemove_success")}catch(f){b.increaseMetricBy("vas_"+d+"FormRemove_success",0),b.metric("vas_"+d+"FormRemove_fail"),b.log(f)}}}});p.when("A","vas-metrics-publisher",
"vas-url-util","ready").register("vas-persist-widget",function(e,b,a){return{initialize:function(){m.history&&m.history.replaceState?(e.on("vas:add-widget-state-url",function(e){try{var c;var g=a.getDecodedQueryParamString(),f=e.preSelectedWidgetValue;if(a.doesVasQueryParamExist(g)){var k=a.addOrUpdateKeyInVasQryParam(g,"vw",f);c=a.replaceExistingVasParam(g,k)}else{e={};e.vw=f;var d=a.stringifyJsonWithSingleQuotes(e);c=a.appendVasQueryParam(g,d)}var l=a.getPathName()+c;m.history.replaceState({},document.title,
l)}catch(n){b.metric("addWidgetStateInUrl_fail"),b.log(n)}}),e.on("vas:remove-widget-state-url",function(){var e=a.getDecodedQueryParamString();if(a.doesVasQueryParamExist(e))try{var c=a.getVasQueryParamValue(e),g=a.parseSingleQuotedStringAsJson(c);if(a.doesKeyExist(g,"vw")){var f=a.removeOrUpdateVasQryParamWithMarker(e,g,"vw"),k=a.getPathName()+f;m.history.replaceState({},document.title,k)}}catch(d){b.metric("removeWidgetStateFromUrl_fail"),b.log(d)}})):b.metric("vas_unsupportedBrowser")}}});p.when("A",
"vas-metrics-publisher","vas-common-settings","vas-atc-tracker","vas-atc-helper","vas-service-interstitial","valueadds_controller").register("vas-core-interstitial",function(e,b,a,h,c,g,f){var k=e.$,d,l,n=!1,q,t,x=function(a){var b=k("#"+(d.showSTSServiceInterstitial?"sts-":"")+"pdp-service-siatc-modal-content");if(b&&b.length){var c=b.find("."+a);c.length&&(b.find("."+d.selectedOfferFulfillmentType).addClass("vas-hidecomponent"),c.removeClass("vas-hidecomponent"),d.selectedOfferFulfillmentType=a)}},
r=function(){var a=k("#ppdb-add-service-checkbox");if(!n){h.setHijacked();k(document.body).undelegate("#mbc .a-button","click.lsatc");h.logMetric("vas_si_atcClick");n=!0;d.isMBCClick=!1;d.atcButton=k(this);var g=d.atcButton.attr("id");if(g&&"add-to-cart-button"!==g)if("mobb.addToCart"!==g){if(d.isMBCClick=!0,(g=d.atcButton.text())&&!g.match(/cart/i))return document.body.style.cursor="default",c.safeATCClick(),!1}else d.isMOBBlick=!0;if(0<a.length&&a.is(":checked"))return a=!0===d.isUpsellCritical?
"1":"0",g="vas_bdlppd_",d.isMBCClick&&(g+="mbc_"),d.isMOBBClick&&(g+="mobb_"),b.logRefTag(g+"checked_atc_"+a+"_"+d.productAsin+"_"+d.serviceAsin),h.logMetric("vas_bdlppd_atc_click"),document.body.style.cursor="default",c.safeATCClick(),n?!0:!1;k(document.body).undelegate("#add-to-cart-button","click.lsatc");k(document.body).undelegate("#mobb\\.addToCart","click.lsatc");if(d.productAsin&&d.serviceAsin&&1===d.atcButton.length&&1===q.length)return d.atcButton.bind("click.lsatc",c.lsATCHandlerSuppressATC),
f.isValueAddsAvailable()?(a=k.parseJSON(k("#valueAddsInterstitial").attr("data-a-modal")))?(a={name:a.name,header:a.header},k("#valueAddsInterstitial").attr("data-a-modal",JSON.stringify(a)).click(),e.$(".a-popover-inner").addClass("pdp-service-modal-instance"),d.showSTSServiceInterstitial&&x(d.selectedOfferFulfillmentType)):c.safeATCClick():(a=k.parseJSON(k("#vasServiceInterstitial").attr("data-a-modal")))?(a={name:a.name,header:a.header},k("#vasServiceInterstitial").attr("data-a-modal",JSON.stringify(a)).click(),
e.$(".a-popover-inner").addClass("pdp-service-modal-instance"),d.showSTSServiceInterstitial&&x(d.selectedOfferFulfillmentType)):c.safeATCClick(),!1;document.body.style.cursor="default";c.safeATCClick();return!1}},u=function(){q=k("#addToCart");q.submit(function(){h.unsetHijacked();return!0});t=k("#second_new_accordion_form");t.submit(function(){h.unsetHijacked();return!0});d.hijackMBCATC&&(k(document).undelegate("#mbc .a-button","click.lsatc"),k(document.body).delegate("#mbc .a-button","click.lsatc",
r),k.get("/gp/ls/impress.html/ref\x3dvas_mbc_ld_"+d.productAsin+"_"+d.serviceAsin));k(document).undelegate("#add-to-cart-button","click.lsatc");k(document.body).delegate("#add-to-cart-button","click.lsatc",r);k(document).undelegate("#mobb\\.addToCart","click.lsatc");k(document.body).delegate("#mobb\\.addToCart","click.lsatc",r)};return{registerSIEventHandlers:function(){k(document.body).undelegate("#add-to-cart-button","click.lsatc");var f=0!==k("#abb-interstitial").length;f&&b.metric("devicesInterstitialPresentCount");
if(f=!f)f="undefined"!==typeof a.getSetting("winningWidgetVM")?a.getSetting("widgetCommonVM").hijackATC:!1;f&&(d=a.getSetting("widgetCommonVM"),d.isShipToStoreAsinSelected="in_store"===d.selectedOfferFulfillmentType,d.atcEventInProgress=!1,d.isMBCClick=!1,d.isMOBBClick=!1,l=d.isWarrantyPresent,c.setWidgetMetaData(d),h.setWidgetMetaData(d),g.setWidgetMetaData(d),d.doRedirect&&null===document.getElementById("servicesInterstitial")&&null===document.getElementById("attach-warranty-pane")&&!l&&(u(),g.registerSIEventHandlers()))}}});
p.when("A","vas-metrics-publisher").register("vas-addUpsell-to-cart",function(e,b){return{addUpsell:function(a,h,c,g){e.ajax("/gp/product/handle-buy-box/",{method:"POST",params:{"session-id":c,"quantity.1":g,itemCount:1,"submit.add-to-cart":"Add to Cart","asin.1":a,"offeringID.1":h},success:function(){b.logUeMetricIncreaseCount("vas_addupsell_cart_success",1);b.logUeMetricIncreaseCount("vas_addupsell_cart_fail",0);e.trigger("vas:ldbb-upsell-added:desktop")},error:function(){b.logUeMetricIncreaseCount("vas_addupsell_cart_fail",
1);b.logUeMetricIncreaseCount("vas_addupsell_cart_success",0)}})}}});p.register("vas-mobile-config",function(){return{mobileMetricConstants:{refmarkerPrefixes:{tenant:"vas"},hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip",isCritical:"crtcl"},metricPrefixes:{tenant:"vas"}}}});p.register("vas-widget-const",function(){return{COMMON:{DOM:{ADDSERVICE_SLOT:"addServices_feature_div",VAS_BUYBOX_SLOT:"vasBuyBox_feature_div",STS_BUYBOX_SLOT:"shipToStoreBuyBox_feature_div",
ADDONS_WIDGET_SLOT:"addons_feature_div",VALUE_ADDS_SLOT:"valueAdds_feature_div",VALUE_PROP_T1_SLOT:"valuePropT1_feature_div",VALUE_PROP_T2_SLOT:"valuePropT2_feature_div"},EVENT_NAME:{NO_BUYBOX:"vas:metrics:nobuybox",NO_PRODUCT:"vas:metrics:noproduct"},REFTAG_PREFIX:{NO_BUYBOX:"vas_nobb_d_ppd_",WIDGET_SUPRESSED:"vas-ppd-widget-suppressed",WIDGET_NO_PRODUCT:"vas-ppd-widget-should-suppressed"}},METRICS:{WIDGET_NAMES:{TABLET_PPD_BUNDLES:"tabbdl"},ACTION_NAMES:{GLANCE_VIEWS:"gv",ADD_TO_CART:"atc",REDIRECTION:"redir",
UPSELL_INCLUDED:"incl",UPSELL_EXCLUDED:"cncl"},TENANT_NAMES:{VAS:"vas"}}}});p.register("vas-common-settings",function(e){var b={};return{getSetting:function(a){return a?b[a]:b},setSetting:function(a,e,c){a&&c?b[a][c]=e:a&&(b[a]=e)},clearSettings:function(){b={}}}});p.when("A","vas-metrics-publisher","vas-common-settings","vas-widget-const","ready").register("vas-common-metrics",function(e,b,a,h){e.off(h.COMMON.EVENT_NAME.NO_BUYBOX);e.on(h.COMMON.EVENT_NAME.NO_BUYBOX,function(){var c=h.COMMON.REFTAG_PREFIX.NO_BUYBOX,
e=a.getSetting("widgetCommonVM").productAsin,f=a.getSetting("widgetCommonVM").zipCode;b.logRefTag(c+e+"_"+f,"LocalServicesWidget")});e.off(h.COMMON.EVENT_NAME.NO_PRODUCT);e.on(h.COMMON.EVENT_NAME.NO_PRODUCT,function(){var c=a.getSetting("widgetCommonVM").shouldSuppressWidget,e=a.getSetting("widgetCommonVM").isProductAvailable,f;c?f=h.COMMON.REFTAG_PREFIX.WIDGET_SUPRESSED:e||(f=h.COMMON.REFTAG_PREFIX.WIDGET_NO_PRODUCT);b.logRefTag(f,"LocalServicesWidget")})});p.when("A","vas-common-settings","vas-core-buybox",
"vas-core-interstitial","vas-widget-const","attach-to-ldbb","vas-persist-widget","valueadds_controller","ready").register("vas-widgets",function(e,b,a,h,c,g,f,k){var d=e.$,l=function(){b.clearSettings();var a,f,g=!1;k.isValueAddsAvailable()?e.each(d("#"+c.COMMON.DOM.VALUE_ADDS_SLOT).find("[data-a-state]"),function(c,l){f=e.parseJSON(d(c).attr("data-a-state")).key;"vas-common-vm"===f?(a=e.parseJSON(d(c).html()),b.setSetting("widgetCommonVM",a)):"vas-winning-widget-vm"===f&&(a=e.parseJSON(d(c).html()),
b.setSetting("winningWidgetVM",a),g=!0)}):e.each(d("#"+c.COMMON.DOM.ADDSERVICE_SLOT).find("[data-a-state]"),function(c,l){f=e.parseJSON(d(c).attr("data-a-state")).key;"vas-common-vm"===f?(a=e.parseJSON(d(c).html()),b.setSetting("widgetCommonVM",a)):"vas-winning-widget-vm"===f&&(a=e.parseJSON(d(c).html()),b.setSetting("winningWidgetVM",a),g=!0)});return g};return{initialize:function(){if(l()){a.registerBuyboxEventHandlers();h.registerSIEventHandlers();if("undefined"!==typeof b.getSetting("winningWidgetVM")){var d=
b.getSetting("winningWidgetVM").winningWidgetName;e.trigger("vas:widgetname:"+d)}else e.trigger(c.COMMON.EVENT_NAME.NO_BUYBOX);e.trigger(c.COMMON.EVENT_NAME.NO_PRODUCT);g.attachToLdbb();f.initialize()}}}});p.when("A","vas-metrics-publisher","vas-widget-const","atf","ready").register("vas-base-data-publisher",function(e,b,a,h){var c=e.$;h=function(){var g,f;e.each(c("#"+a.COMMON.DOM.VALUE_ADDS_SLOT).find("[data-a-state]"),function(a,b){f=e.parseJSON(c(a).attr("data-a-state")).key;"vas-base-vm"===f&&
(g=e.parseJSON(c(a).html()))});if(g){var h=!1,d={};if(0<c("#add-to-cart-button").length||0<c("#mbc .a-button").length)h=!0;d[b.hitParameterKeys.productAsin]=g.productAsin;d[b.hitParameterKeys.additionalRequestData]={asin:g.productAsin,dt:"d",zip:g.zipCode,ibba:h};b.logHit("hbs_product_data",d)}};h();return{publish:h}});p.when("A","vas-common-settings","vas-service-quantity-helper").register("attach-to-ldbb",function(e,b,a){var h=e.$,c=function(){h(document.body).undelegate(".gb-btn-atc","click.attachServicesHandler");
var c=a.getServiceQuantity(b.getSetting("widgetCommonVM").multiQuantityPurchaseEnabled,"ldbb");e.trigger("vas:ldbb-a2c-event:desktop",c)};return{attachToLdbb:function(){b.getSetting("widgetCommonVM").attachToLdbb&&(h(document.body).undelegate(".gb-btn-atc","click.attachServicesHandler"),h(document.body).delegate(".gb-btn-atc","click.attachServicesHandler",c))}}});p.register("vas-si-config",function(){return{siMetricConstants:{hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip",
isMBC:"mbc"},bsi_prefixes:{refmarkerPrefixes:{tenant:"vas",widget:"dbsi"},metricPrefixes:{tenant:"vas",widget:"dbsi"}},rsi_prefixes:{refmarkerPrefixes:{tenant:"vas",widget:"drsi"},metricPrefixes:{tenant:"vas",widget:"drsi"}}}}});p.when("A","vas-metrics-publisher","vas-utilities","ready").register("vas-zipcode-helper",function(e,b,a){var h=e.$,c,g,f,k,d,l,n,q,t,x,r,u,v,p,m,w,F,P,K,G,y,D,A,E,I=function(a,d){"undefined"!==typeof d?b.logUeMetricIncreaseCount(a+(y.showSTSServiceInterstitial||y.isParentServiceAsin?
"_sts":""),d):b.logUeMetricIncreaseCount(a+(y.showSTSServiceInterstitial||y.isParentServiceAsin?"_sts":""))},L=function(){d.hide();F.hide();w.hide();u.addClass("a-button-disabled").prop("disabled",!0)},Q=function(){L();q.hide();l.hide();t.show()};e.on("a:popover:show:VAS-SI-Zip-Update",function(a){E=a.popover});return{vasSIZipCodeUpdate:function(z,H){var J=z.bsi_prefixes.refmarkerPrefixes,R=z.additionalRequestDataKeys,B=z.bsi_prefixes.metricPrefixes;b.createCSMNameAndLog(B.tenant,B.widget,"updateZip");
z=m.val();if(a.validateZipCode(z,P)){A=m.val();var M=y.zipCode,S="vas_sx_zc_"+M+"_"+A,N="undefined"!==typeof y.childServiceAsins?y.childServiceAsins:[y.serviceAsin];b.logRefTag(S);if(A===D)return!1;e.ajax("/gp/ls/vas-ajax-handlers/vas-zipcode-refresh.html",{method:"get",params:{asinlist:N.join(","),vasZipcode:A,clientName:"vasBuyableSiZipRefresh",includeMerchantAddress:y.showSTSServiceInterstitial},success:function(a){var m,z,C=!(h.isEmptyObject(a)||"1"===a.hasError);if(C)for(var O=0;O<N.length;O++)if(z=
N[O],a[z]&&!m||!m.merchantId||y.showSTSServiceInterstitial&&"in_store"===a[z].fulfillmentType)m=a[z],y.serviceAsin=z;z=h(".vas-siatc-zip");z.length&&z.text(A);if(!C||e.objectIsEmpty(a)||1===a.hasError||e.objectIsEmpty(a[y.serviceAsin])||1===a[y.serviceAsin].hasError)return Q(),b.logRefTag("vas_sx_zaf_"+M+"_"+A),I("vas-si-atc-zip-ajaxFail"),b.createCSMNameAndLog(B.tenant,B.widget,"updateZipFail"),!1;e.objectIsEmpty(m.offerListingId)?(H.additionalRequestData[R.zipCode]=A,b.createRefMarkerAndLog(J.tenant,
y.mappingSet,J.widget,"zprfrsh0",H),L(),l.hide(),t.hide(),n.length&&n.text(A),q.show(),y.showSTSServiceInterstitial&&K.hide(),b.logRefTag("vas_sx_zfl_"+M+"_"+A),I("vas-si-atc-zipchange-nooffer")):(H.additionalRequestData[R.zipCode]=A,b.createRefMarkerAndLog(J.tenant,y.mappingSet,J.widget,"zprfrsh1",H),E&&E.hide(),a=m,y.offerListingID=a.offerListingId,y.isCBM=a.isCBM,y.merchantId=a.merchantId,y.isShipToStoreAsinSelected="in_store"===a.fulfillmentType,y.shouldAddItemAssociation=y.isShipToStoreAsinSelected,
a=m.isCBM,k.html(m.positiveRatingHtml),x.text(m.merchantName).prop("href",m.sellerReviewLink),c.html(m.price).className+="a-color-price",f.html(m.price).className+="a-color-price",a?(F.hide(),w.show(),v.hide(),p.show()):(w.hide(),F.show(),p.hide(),v.show()),e.objectIsEmpty(m.nextOfferPrice)||a?d.hide():(r.html(m.nextOfferPrice).className+="a-color-price",d.show()),q.hide(),l.hide(),u.removeClass("a-button-disabled").prop("disabled",!1),b.logRefTag(S),I("vas-si-atc-zipchange-offeravailable"),m.fulfillmentType&&
(a=m.fulfillmentType,g&&g.length&&(C=g.find("."+a),C.length&&(g.find("."+y.selectedOfferFulfillmentType).addClass("vas-hidecomponent"),C.removeClass("vas-hidecomponent"),y.selectedOfferFulfillmentType=a))),y.showSTSServiceInterstitial&&(K.show(),e.objectIsEmpty(m.merchantAddress)?G.hide():(G.text(m.merchantAddress.AddressLine1+", "+m.merchantAddress.City+", "+m.merchantAddress.StateOrRegion+" "+m.merchantAddress.PostalCode),G.show())));D=A},error:function(){D=A;Q();b.createCSMNameAndLog(B.tenant,
B.widget,"updateZipFail");I("vas-si-atc-zip-ajaxFail");E&&E.hide()}})}else D=z,L(),t.hide(),q.hide(),l.show();return!1},setZipCodeValuesFromDOM:function(){c=h("#vas-siatc-bestoffer-obm");f=h("#vas-siatc-bestoffer-cbm");k=h("#vas-siatc-ratingandreview");d=h("#vas-si-atc-remainingoffers");l=h("#vas-siatc-invalidzip-message");n=h("#vas-siatc-nooffer-zip");q=h("#vas-siatc-offerunavailable-message");t=h("#vas-siatc-zip-ajaxfail-message");x=h("#vas-siatc-merchantname");r=h("#vas-si-atc-remainingoffer-price");
u=h("#btnVasModalContinue");v=h("#vas-siatc-howitworks-obm");p=h("#vas-siatc-howitworks-cbm");w=h("#vas-siatc-cbm-gridrow");F=h("#vas-siatc-obm-gridrow");m=h("#vas-siatc-zip-input");P=h("#vas-zipCodeValidationRegexString");y.showSTSServiceInterstitial&&(g=h("#sts-pdp-service-siatc-modal-content"),h("#vas-sts-zip-update-modal"),g&&g.length&&(K=g.find(".vas-si-merchant"),G=g.find(".vas-si-merchant-address")))},setWidgetMetaData:function(a){y=a;D=y.zipCode}}});p.when("A","vas-common-settings","vas-atc-helper",
"vas-zipcode-helper","vas-atc-tracker","vas-metrics-publisher","vas-si-config","ready").register("vas-service-interstitial",function(e,b,a,h,c,g,f){var k=e.$,d,l,n=f.siMetricConstants.hitRecordConstants,q,t,x=f.siMetricConstants.additionalRequestDataKeys,r={addProductToCartAndGoToSDP:function(b,f){g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,g.RefmarkerActionTypes.redirect,d.hitParameters);g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.redirect);c.setHijackDismissalAttempt();c.logMetric(b);
d.atcEventInProgress?b=!0:(d.atcEventInProgress=!0,b=!1);if(!b)return a.addProductToCartAndGoToSDP(f),!1},triggerMetricsForPopoverShow:function(){c.logMetric("vas_si_show");var a=l+"show_"+d.serviceAsin;d.showSIATC?(c.logMetric("vas_buyable_si_show"),a=l+d.zipCode+"_"+d.merchantId):c.logMetric("vas_normal_si_show");g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.glanceView);g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,g.RefmarkerActionTypes.glanceView,d.hitParameters);g.logRefTag(a);
m.ue&&ue.trigger&&b.getSetting("widgetCommonVM").siRatingWeblabTreatment&&ue.trigger("DP_VAS_SI_RATING_235428",b.getSetting("widgetCommonVM").siRatingWeblabTreatment)},triggerMetricsForPopoverhide:function(){c.setHijackDismissalAttempt();c.logMetric("vas_si_hide_click");g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.escape);var b=l+"x1_"+d.productAsin+"_"+d.serviceAsin;d.showSIATC&&(b=l+"no_"+d.productAsin+"_"+d.serviceAsin);g.logRefTag(b);g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,
g.RefmarkerActionTypes.serviceNotIncluded,d.hitParameters);a.safeATCClick();return!1}};return{registerSIEventHandlers:function(){l="vas_si_";d.showSIATC&&(l="vas_sx_");d.isMBCClick&&(l+="mbc_");if(d.showSIATC){var b=k("#vas-siatc-zip-input");h.setZipCodeValuesFromDOM();b.keyup(function(a){13===a.keyCode&&k("#vas-siatc-zip-update").click()});k(document).undelegate("#vas-siatc-zip-update","click.vas-siatc-zip-refresh");k(document).delegate("#vas-siatc-zip-update","click.vas-siatc-zip-refresh",function(a){h.vasSIZipCodeUpdate(f.siMetricConstants,
d.hitParameters)});k(document).undelegate("#vas-si-moredetails","click.sdpredir");k(document).delegate("#vas-si-moredetails","click.sdpredir",function(a){r.addProductToCartAndGoToSDP("vas_siatc_see_more_details",l+"sm_"+d.productAsin+"_"+d.serviceAsin)});k(document).undelegate("#vas-si-otheroffers","click.sdpredir");k(document).delegate("#vas-si-otheroffers","click.sdpredir",function(a){r.addProductToCartAndGoToSDP("vas_siatc_otherOffersclick",l+"so_"+d.productAsin+"_"+d.serviceAsin)});k(document).undelegate("#vas-si-estimate-SDP",
"click.sdpredir");k(document).delegate("#vas-si-estimate-SDP","click.sdpredir",function(a){r.addProductToCartAndGoToSDP("vas_siatc_priceclick",l+"p_"+d.productAsin+"_"+d.serviceAsin)})}k(document).undelegate("#btnVasModalSkip","click");k(document).delegate("#btnVasModalSkip","click",function(b){c.setHijackDismissalAttempt();c.logMetric("vas_si_skip_click");g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.skip);b=l+"x2_"+d.productAsin+"_"+d.serviceAsin;d.showSIATC&&(b=l+"no_"+d.productAsin+
"_"+d.serviceAsin);g.logRefTag(b);g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,g.RefmarkerActionTypes.serviceNotIncluded,d.hitParameters);a.safeATCClick();return!1});k(document).undelegate("#btnVasModalContinue","click.pdpVasNext");k(document).delegate("#btnVasModalContinue","click.pdpVasNext",function(b){c.setHijackDismissalAttempt();c.logMetric("vas_si_yes_click");b=l+"y1_"+d.productAsin+"_"+d.serviceAsin;var f,e;d.showSIATC?(b=l+"atc_"+d.productAsin+"_"+d.serviceAsin,f=g.CSMActionTypes.addToCart,
e=g.RefmarkerActionTypes.addToCart):(f=g.CSMActionTypes.redirect,e=g.RefmarkerActionTypes.redirect);g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,e,d.hitParameters);g.createCSMNameAndLog(t.tenant,t.widget,f);a.addServiceToCart(b);return!1});e.off("a:popover:hide:vasServiceInterstitial");e.on("a:popover:hide:vasServiceInterstitial",function(a){r.triggerMetricsForPopoverhide()});e.off("a:popover:afterShow:vasServiceInterstitial");e.on("a:popover:afterShow:vasServiceInterstitial",function(a){r.triggerMetricsForPopoverShow()});
e.off("a:popover:hide:valueAddsInterstitial");e.on("a:popover:hide:valueAddsInterstitial",function(a){r.triggerMetricsForPopoverhide()});e.off("a:popover:afterShow:valueAddsInterstitial");e.on("a:popover:afterShow:valueAddsInterstitial",function(a){r.triggerMetricsForPopoverShow()});k("#buyableSIAsinRatingLink").unbind("click");k("#buyableSIAsinRatingLink").bind("click",function(){c.logMetric("vas_sx_sdp_rating_redirect");g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,g.RefmarkerActionTypes.redirect,
d.hitParameters);g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.redirect)});k("#siAsinRatingLink").unbind("click");k("#siAsinRatingLink").bind("click",function(){c.logMetric("vas_si_sdp_rating_redirect");g.createRefMarkerAndLog(q.tenant,d.mappingSet,q.widget,g.RefmarkerActionTypes.redirect,d.hitParameters);g.createCSMNameAndLog(t.tenant,t.widget,g.CSMActionTypes.redirect)})},setWidgetMetaData:function(a){d=a;h.setWidgetMetaData(a);d.showSIATC?(q=f.siMetricConstants.bsi_prefixes.refmarkerPrefixes,
t=f.siMetricConstants.bsi_prefixes.metricPrefixes):(q=f.siMetricConstants.rsi_prefixes.refmarkerPrefixes,t=f.siMetricConstants.rsi_prefixes.metricPrefixes);q.tenant=d.showSTSServiceInterstitial||d.isParentServiceAsin?"sts":"vas";t.tenant=d.showSTSServiceInterstitial||d.isParentServiceAsin?"sts":"vas";a=d;var b={},c={};c[x.zipCode]=d.zipCode;c[x.isMBC]=d.isMBCClick?1:0;b[g.hitParameterKeys.upsellAsin]=d.serviceAsin;b[g.hitParameterKeys.productAsin]=d.productAsin;b[g.hitParameterKeys.merchantId]=d.merchantId;
b[g.hitParameterKeys.pageType]=n.pageType;b[g.hitParameterKeys.subPageType]=n.subPageType;b[g.hitParameterKeys.additionalRequestData]=c;a.hitParameters=b}}});p.register("vas-twister-config",function(){return{vasTwisterMetricConstants:{refmarkerPrefixes:{tenant:"vas",widget:"dft"},hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip",isPromo:"promo",isCritical:"crtcl"},metricPrefixes:{tenant:"vas",widget:"dft"}}}});p.when("A","vas-common-settings",
"vas-metrics-publisher","vas-twister-config","vas-metric-utils","ready").register("vas-twister-setting",function(e,b,a,h,c){var g=e.$,f={baseAsinMetaData:{},isUpsellCritical:"",hasPrecheckEnabled:""},k=h.vasTwisterMetricConstants.refmarkerPrefixes,d=h.vasTwisterMetricConstants.additionalRequestDataKeys,l=h.vasTwisterMetricConstants.metricPrefixes;return{getSettings:function(a){return"undefined"!==typeof a?f[a]:f},fetchTwisterSetting:function(){var n=g("#ppdb-add-service-checkbox");n.is(":checked")&&
n.prop("checked",!1);var n=b.getSetting("winningWidgetVM"),q=n.winningServicePriceWithPromotionApplied;f.baseAsinMetaData.upsellAsin=n.upsellAsin;f.upsellAsin=n.serviceAsinToOffer;f.baseAsinMetaData.offerlistingId=n.offerListingID;f.baseAsinMetaData.merchantId=n.merchantId;f.baseAsinMetaData.price=n.winningServiceMinPrice;f.isUpsellCritical=n.isUpsellCritical;f.hasPrecheckEnabled=n.hasPrecheckEnabled;f.dynamicStringChangeOnTwisterSelection=n.dynamicStringChangeOnTwisterSelection;f.promotionMessagingWeblab=
"undefined"!==typeof n.promotionMessagingWeblab?n.promotionMessagingWeblab:!1;f.isPromoPriceDisplayed=!e.objectIsEmpty(g.trim(q));f.productAsin=b.getSetting("widgetCommonVM").productAsin;f.zipCode=b.getSetting("widgetCommonVM").zipCode;f.buyboxPrice=b.getSetting("widgetCommonVM").buyboxPrice;f.mappingSet=b.getSetting("widgetCommonVM").mappingSet;f.sessionId=b.getSetting("widgetCommonVM").sessionId;f.vasTwisterMetricConstants=h.vasTwisterMetricConstants;f.hitParameters=c.createHitParameters(f.vasTwisterMetricConstants);
n=f.hitParameters[a.hitParameterKeys.additionalRequestData];n[d.isPromo]=f.isPromoPriceDisplayed;n[d.isCritical]=f.isUpsellCritical;f.hitParameters[a.hitParameterKeys.additionalRequestData]=n;var n=f.upsellAsin,q=f.productAsin,t=f.baseAsinMetaData.price,x=f.baseAsinMetaData.merchantId,r="vas_bdlppd_fake_twister_"+(!0===f.isUpsellCritical?"1":"0")+"_a_"+f.zipCode;a.createCSMNameAndLog(l.tenant,l.widget,a.CSMActionTypes.glanceView);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.glanceView,
f.hitParameters);a.metric("vas_bdlppd_fake_twister_");a.logRefTag(r,"LocalServicesWidget","Impression",n,"popUp",x,q,t,f.buyboxPrice)},logTwisterInteractionReftag:function(b){var d=f.isUpsellCritical,c=f.upsellAsin,e=f.productAsin,g=f.baseAsinMetaData.price,h=f.baseAsinMetaData.merchantId,m="vas_bdlppd_fake_twister_";f.isPromoPriceDisplayed&&(m="vas_bdplppd_fake_twister_promo_");a.logRefTag(m+(b?"y":"n")+"_"+(!0===d?"1":"0")+"_a","LocalServicesWidget","AddServiceCheck",c,"popUp",h,e,g);a.createCSMNameAndLog(l.tenant,
l.widget,b?a.CSMActionTypes.serviceIncluded:a.CSMActionTypes.serviceNotIncluded);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,b?a.RefmarkerActionTypes.serviceIncluded:a.RefmarkerActionTypes.serviceNotIncluded,f.hitParameters)},logTwisterATCReftag:function(){var b=!0===f.isUpsellCritical?"1":"0",d="vas_bdlppd_fake_twister_atc_"+b,c=f.upsellAsin,e=f.productAsin,g=f.baseAsinMetaData.price,h=f.baseAsinMetaData.merchantId;f.isPromoPriceDisplayed&&(d="vas_bdlppd_fake_twister_atc_promo_"+b);a.createCSMNameAndLog(l.tenant,
l.widget,a.CSMActionTypes.addToCart);a.logRefTag(d,"LocalServicesWidget","CartAdd",c,"popUp",h,e,g,f.buyboxPrice);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.addToCart,f.hitParameters);return!0},logTwisterExpanderReftagAndMetric:function(b){var d=f.upsellAsin,c=f.productAsin,e=f.baseAsinMetaData.merchantId,g=b?"vas_bdlppd_fake_twister_sm_click":"vas_bdlppd_fake_twister_sl_click";a.createCSMNameAndLog(l.tenant,l.widget,b?a.CSMActionTypes.expandBulletPoints:a.CSMActionTypes.collapseBulletPoints);
a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,b?a.RefmarkerActionTypes.expandBulletPoints:a.RefmarkerActionTypes.collapseBulletPoints,f.hitParameters);a.increaseMetricBy(g,1);a.logRefTag(g,"LocalServicesWidget","SeeMoreClick",d,"popUp",e,c)},logTwisterSDPRedirectReftagAndMetric:function(){a.createCSMNameAndLog(l.tenant,l.widget,a.CSMActionTypes.redirect);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.redirect,f.hitParameters)}}});p.when("A","vas-twister-setting",
"vas-metrics-publisher","vas-addUpsell-to-cart","ready").execute("vas-twister-controller",function(e,b,a,h){var c=e.$,g=c("body"),f=!1,k=function(){b.logTwisterATCReftag()},d=function(){c("#ppdb-add-service-checkbox").prop("checked",!0);var d=b.getSettings("baseAsinMetaData");try{e.trigger("vas:add-service-asin-buybox-event",d),c("#addToCart").unbind("submit.ppdBundles"),c("#addToCart").bind("submit.ppdBundles",k),a.increaseMetricBy("a2cFormAddEventSend_success",1),a.increaseMetricBy("a2cFormAddEventSend_fail",
0)}catch(f){a.increaseMetricBy("a2cFormAddEventSend_success",0),a.increaseMetricBy("a2cFormAddEventSend_fail",1),a.log(f)}c("#vas-fake-twister-include-section").find("i").hasClass("a-icon-extender-collapse")||c("#vas-fake-twister-include-section").click();b.getSettings("isPromoPriceDisplayed")&&b.getSettings("promotionMessagingWeblab")&&(c("#vasTwisterSelectedPromotionMessage").removeClass("aok-hidden"),c("#vasTwisterNotSelectedPromotionMessage").addClass("aok-hidden"));e.trigger("vas:add-widget-state-url",
{preSelectedWidgetValue:b.getSettings("baseAsinMetaData").upsellAsin})},l=function(a){b.getSettings("dynamicStringChangeOnTwisterSelection")&&c("#vas-service-title-text").html(a.attr("data-title"))},n={vasTwisterTrigger:function(f){c(".vas-ppd-swatch-item").removeClass("vas-ppd-swatch-select");f.addClass("vas-ppd-swatch-select");l(f);if("removeOffer"===f.attr("data-twister-action")){c("#ppdb-add-service-checkbox").prop("checked",!1);try{e.trigger("vas:remove-service-asin-buybox-event"),c("#addToCart").unbind("submit.ppdBundles"),
a.increaseMetricBy("a2cFormRemoveEventSend_fail",0),a.metric("a2cFormRemoveEventSend_success"),e.trigger("vas:remove-widget-state-url")}catch(g){a.increaseMetricBy("a2cFormRemoveEventSend_success",0),a.metric("a2cFormRemoveEventSend_fail"),a.log(g)}b.getSettings("isPromoPriceDisplayed")&&b.getSettings("promotionMessagingWeblab")&&(c("#vasTwisterSelectedPromotionMessage").addClass("aok-hidden"),c("#vasTwisterNotSelectedPromotionMessage").removeClass("aok-hidden"));b.logTwisterInteractionReftag(!1)}else d(),
b.logTwisterInteractionReftag(!0)},vasTwisterExpander:function(){c("#vas-fake-twister-include-section").find("i").hasClass("a-icon-extender-collapse")?b.logTwisterExpanderReftagAndMetric(!1):b.logTwisterExpanderReftagAndMetric(!0)}},q=function(){c("#vas-fake-twister-include-section").unbind("click");c("#vas-fake-twister-include-section").bind("click",function(a){n.vasTwisterExpander()});c("#vas-fake-twiseter-detailLink").unbind("click");c("#vas-fake-twiseter-detailLink").bind("click",function(a){b.logTwisterSDPRedirectReftagAndMetric()})},
t=function(){f||(g.undelegate(".vas-ppd-swatch-item","click"),g.delegate(".vas-ppd-swatch-item","click",function(a){a=c(a.currentTarget);a.hasClass("vas-ppd-swatch-select")||n.vasTwisterTrigger(a)}),f=!0)},x=function(){e.off("vas:ldbb-a2c-event:desktop");e.on("vas:ldbb-a2c-event:desktop",function(a){if(c("#ppdb-add-service-checkbox").is(":checked")){var d=b.getSettings("baseAsinMetaData");h.addUpsell(d.upsellAsin,d.offerlistingId,b.getSettings("sessionId"),a)}});e.off("vas:ldbb-upsell-added:desktop");
e.on("vas:ldbb-upsell-added:desktop",function(){b.logTwisterATCReftag()})};e.off("vas:widgetname:twister");e.on("vas:widgetname:twister",function(){c("#vas-service-title-text");t();b.fetchTwisterSetting();b.getSettings("hasPrecheckEnabled")&&(d(),l(c(".vas-ppd-swatch-select")));q();x();c("#vasTwisterRow").removeClass("vas-twister-disabled")})});p.register("vas-twister-xl-config",function(){return{vasTwisterXLMetricConstants:{refmarkerPrefixes:{tenant:"vas",widget:"dftxl"},hitRecordConstants:{pageType:"DetailPage",
subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip"},metricPrefixes:{tenant:"vas",widget:"dftxl"}}}});p.when("A","vas-metrics-publisher","ready").register("vas-twister-page-refresh-common",function(e,b){function a(a){a=document.getElementById(a);var b=[];if(null===a||a===w)return b;a=a.getElementsByTagName("SCRIPT");e.each(a,function(a){b.push(a.innerHTML)});return b}function h(a,b){e.each(b,function(b){var c=document.createElement("script");c.type="text/javascript";c.text=b;b=document.getElementById(a);
null!==b&&b!==w&&b.appendChild(c)})}var c=e.$,g=null,f=function(d){try{var f=d.pageRefreshData,g=[];e.each(d.featuresWithScriptTags,function(b){g.push(a(b))});d.featuresToRefresh.forEach(function(a){c(a).replaceWith(c(f).find(a).prop("outerHTML"))});e.each(d.featuresWithScriptTags,function(a,b){h(a,g[b])});e.trigger("vas:vas-twister-page-refresh-complete",d);b.increaseMetricBy("vasTwisterUpdateFeatures_success",1);b.increaseMetricBy("vasTwisterUpdateFeatures_fail",0)}catch(k){e.trigger("vas:vas-twister-update-features-failed",
d),b.increaseMetricBy("vasTwisterUpdateFeatures_success",0),b.increaseMetricBy("vasTwisterUpdateFeatures_fail",1),b.log(k)}},k=function(a){e.trigger("vas:vas-twister-page-refresh-start",a);null!==g&&g.abort();g=e.ajax(a.ajaxUrl,{method:"POST",timeout:"90000",params:{isVariationalParent:a.isVariationalParent},success:function(c){a.pageRefreshData=c;f(a);b.increaseMetricBy("vasTwisterPageRefresh_success",1);b.increaseMetricBy("vasTwisterPageRefresh_fail",0)},error:function(){e.trigger("vas:vas-twister-page-refresh-failed",
a);b.increaseMetricBy("vasTwisterPageRefresh_success",0);b.increaseMetricBy("vasTwisterPageRefresh_fail",1)}})};return{performPageRefresh:function(a){"undefined"===typeof a.pageRefreshData?k(a):f(a)},abortPageRefreshRequests:function(){null!==g&&g.abort()},restoreInitialData:function(a){try{var f=a.pageRefreshData;e.each(a.featuresToRefresh,function(a){"undefined"!==typeof f[a]&&c(a).replaceWith(f[a])});b.increaseMetricBy("vasTwisterRestoreInitialData_success",1);b.increaseMetricBy("vasTwisterRestoreInitialData_fail",
0);e.trigger("vas:vas-twister-initialdata-restore-complete")}catch(g){b.increaseMetricBy("vasTwisterRestoreInitialData_success",0),b.increaseMetricBy("vasTwisterRestoreInitialData_fail",1),b.log(g)}}}});p.when("A","vas-common-settings","vas-metrics-publisher","vas-twister-xl-config","vas-metric-utils","ready").register("vas-twister-xl-setting",function(e,b,a,h,c){var g=e.$,f={vasTwisterOptions:{},baseAsinMetaData:{},productAsinAndOfferData:{},productPriceInTwisterVariation:{}},k=h.vasTwisterXLMetricConstants.refmarkerPrefixes,
d=h.vasTwisterXLMetricConstants.metricPrefixes,l=function(){var b=f.productAsinAndOfferData.asin,c=f.productAsinAndOfferData.merchantId,g="vas_bdlppd_fake_twister_a_"+f.productAsinAndOfferData.zipCode;a.metric("vas_bdlppd_vas_twister_");a.logRefTag(g,"LocalServicesWidget","Impression","","popUp",c,b,"","");a.createCSMNameAndLog(d.tenant,d.widget,a.CSMActionTypes.glanceView);e.each(f.vasTwisterOptions,function(b,c){var d=a.RefmarkerActionTypes.glanceView;b.isOfferAvailable||(d=a.RefmarkerActionTypes.glanceViewDisabled);
f.hitParameters[a.hitParameterKeys.upsellAsin]=c;a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,d,f.hitParameters)})},n=function(){try{var b=f.productAsinAndOfferData.asin,c=g("li[data-defaultasin\x3d"+b+"] .a-size-mini");c.length&&f.productPriceInTwisterVariation[b]===w&&(f.productPriceInTwisterVariation[b]=c.text());a.increaseMetricBy("saveInitialProductPriceContent_fail",0);a.metric("saveInitialProductPriceContent_success",1)}catch(e){a.createCSMNameAndLog(d.tenant,d.widget,"saveInitialProductError"),
a.increaseMetricBy("saveInitialProductPriceContent_success",0),a.metric("saveInitialProductPriceContent_fail",1),a.log(e)}};return{getProductAsinAndOfferData:function(a){return"undefined"!==typeof a?f.productAsinAndOfferData[a]:f.productAsinAndOfferData},getSettings:function(a){if("undefined"!==typeof a){a=f.vasTwisterOptions[a];var b={};b.asin=a.serviceAsin;b.offerlistingId=a.offerData.offerListingId;b.merchantId=a.offerData.merchantId;b.price=a.offerData.price;return b}},hasPrecheckEnabled:function(){return f.hasPrecheckEnabled},
getVasTwisterOption:function(a){if("undefined"!==typeof a)return f.vasTwisterOptions[a]},getInitialProductPriceContent:function(){return f.productPriceInTwisterVariation},setInitialWidgetSettings:function(){g("#ppdb-add-service-checkbox").is(":checked")&&g("#ppdb-add-service-checkbox").prop("checked",!1);var a=b.getSetting("winningWidgetVM"),d=a.vasTwisterOptions;f.productAsinAndOfferData=a.vasUpsellProductAsinAndOfferData;f.mappingSet=b.getSetting("widgetCommonVM").mappingSet;f.buyboxPrice=b.getSetting("widgetCommonVM").buyboxPrice;
e.each(d,function(a,b){f.vasTwisterOptions[b]=a});f.vasTwisterXLMetricConstants=h.vasTwisterXLMetricConstants;f.hitParameters=c.createHitParameters(f.vasTwisterXLMetricConstants);f.hasPrecheckEnabled=a.hasPrecheckEnabled;n();l()},logVasTwisterInteractionReftag:function(b,c){b&&(b=f.vasTwisterOptions[c].offerData.price,a.logRefTag("vas_bdlppd_vas_twister_a","LocalServicesWidget","AddServiceCheck",c,"popUp",f.vasTwisterOptions[c].offerData.merchantId,f.productAsinAndOfferData.asin,b),f.hitParameters[a.hitParameterKeys.upsellAsin]=
c,f.hitParameters[a.hitParameterKeys.upsellAsinPrice]=b);c=a.CSMActionTypes.serviceIncluded;a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.serviceIncluded,f.hitParameters);a.createCSMNameAndLog(d.tenant,d.widget,c)},logVasTwistetATCReftag:function(b){a.createCSMNameAndLog(d.tenant,d.widget,a.CSMActionTypes.addToCart);var c=f.productAsinAndOfferData.asin,e=f.vasTwisterOptions[b].offerData.price,g=f.vasTwisterOptions[b].offerData.merchantId;f.hitParameters[a.hitParameterKeys.upsellAsin]=
b;f.hitParameters[a.hitParameterKeys.upsellAsinPrice]=e;a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.addToCart,f.hitParameters);a.logRefTag("vas_bdlppd_vas_twister_atc_","LocalServicesWidget","CartAdd",b,"popUp",g,c,e,"${buybox.priceViewModel.buyingPrice}");return!0},logTwisterExpanderReftagAndMetric:function(b,c){var e=f.vasTwisterOptions[c].offerData.price;a.createCSMNameAndLog(d.tenant,d.widget,b?a.CSMActionTypes.expandBulletPoints:a.CSMActionTypes.collapseBulletPoints);
f.hitParameters[a.hitParameterKeys.upsellAsin]=c;f.hitParameters[a.hitParameterKeys.upsellAsinPrice]=e;a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,b?a.RefmarkerActionTypes.expandBulletPoints:a.RefmarkerActionTypes.collapseBulletPoints,f.hitParameters)},getVasTwisterXLMetricConstants:function(){return f.vasTwisterXLMetricConstants},getHitParameters:function(){return f.hitParameters},isMultiQuantityPurchaseEnabled:function(){return b.getSetting("widgetCommonVM").multiQuantityPurchaseEnabled},
isBusinessCustomer:function(){return b.getSetting("widgetCommonVM").businessCustomer}}});p.when("A","vas-twister-page-refresh-common","vas-metrics-publisher","vas-twister-xl-setting","vas-twister-xl-util","ready").register("vas-twister-page-refresh-webView",function(e,b,a,h,c){var g=e.$,f={},k={},d=function(a){a.pageRefreshData=f;b.restoreInitialData(a);n("1.0",a.featuresToRefresh)},l=function(){var a=h.getProductAsinAndOfferData().asin,b=g("#twister_feature_div"),c=g("li[data-defaultasin\x3d"+a+
"]"),a=g("li[data-defaultasin\x3d"+a+"] .a-size-mini"),d=g("#priceblock_ourprice"),f=g("#priceblock_saleprice");0>=b.length||0>=c.length||0>=a.length||(d.length?a.text(d.text()):f.length?a.text(f.text()):a.text(""))},n=function(a,b){e.each(b,function(b,c){g(b).css("opacity",a)})},q=function(){try{var b=h.getInitialProductPriceContent();e.each(b,function(a,b){b=g("li[data-defaultasin\x3d"+b+"] .a-size-mini");b.length&&b.text(a)});a.increaseMetricBy("restoreInitialPriceInProductTwister_fail",0);a.metric("restoreInitialPriceInProductTwister_success",
1)}catch(c){a.increaseMetricBy("restoreInitialPriceInProductTwister_success",0),a.metric("restoreInitialPriceInProductTwister_fail",1),a.log(c)}};e.off("vas:vas-twister-page-refresh-start");e.on("vas:vas-twister-page-refresh-start",function(a){n("0.5",a.featuresToRefresh);g("#vasTwisterRow").addClass("vas-twister-disabled")});e.off("vas:vas-twister-page-refresh-complete");e.on("vas:vas-twister-page-refresh-complete",function(a){k[a.baseOfferMerchantId+a.asin]=a.pageRefreshData;l();n("1.0",a.featuresToRefresh);
g("#vasTwisterRow").removeClass("vas-twister-disabled");e.trigger("vas:twister-update-widgets","hide");e.trigger("vas:add-asin-offer-data-to-cart",a.svcAsin)});e.off("vas:vas-twister-page-refresh-failed");e.on("vas:vas-twister-page-refresh-failed",function(a){n("1.0",a.featuresToRefresh);g("#vasTwisterRow").removeClass("vas-twister-disabled")});e.off("vas:vas-twister-update-features-failed");e.on("vas:vas-twister-update-features-failed",function(a){d(a.featuresToRefresh);n("1.0",a.featuresToRefresh)});
e.off("vas:vas-twister-initialdata-restore-complete");e.on("vas:vas-twister-initialdata-restore-complete",function(){q();e.trigger("vas:remove-asin-offer-data-to-cart");e.trigger("vas:twister-update-widgets","show")});e.off("vas:twister-update-widgets");e.on("vas:twister-update-widgets",function(a){var b=g("#dpFastTrack_feature_div"),c=g("#moreBuyingChoices_feature_div");0<b.length&&("show"===a?b.show():b.hide());0<c.length&&("show"===a?c.show():c.hide())});return{setInitialFeaturesData:function(a){e.each(a,
function(a,b){f[a]=g(a).prop("outerHTML")});e.trigger("vas:twister-update-widgets","show")},performPageRefresh:function(a){a.ajaxUrl=c.getAjaxUrl(a.asin,a.baseOfferMerchantId);a.pageRefreshData=k[a.baseOfferMerchantId+a.asin];a.featuresWithScriptTags=c.getFeaturesWithScriptTags();b.performPageRefresh(a)},abortPageRefreshRequests:function(){b.abortPageRefreshRequests()},restoreInitialPriceInProductTwister:q,restoreInitialData:d,updatePriceInProductTwisterDesktop:l,hideOfferUpdateWidget:function(){g("#vas-twister-price-update-div").hide()},
showOfferUpdateWidget:function(){g("#vas-twister-price-update-div").show()}}});p.when("A","vas-twister-xl-setting","ready").register("vas-twister-xl-util",function(e,b){function a(){return b.isBusinessCustomer()&&b.isMultiQuantityPurchaseEnabled()}function h(){return"{%27disableFreeFormQtyPicker%27:true}"}return{isRefreshRequired:function(a,e){return b.isBusinessCustomer()?a!==e||b.isMultiQuantityPurchaseEnabled()&&!b.hasPrecheckEnabled():a!==e},getAjaxUrl:function(b,e){b="/gp/product/"+b+"?m\x3d"+
e;return a()?b+"\x26vas\x3d"+h():b},getFeaturesWithScriptTags:function(){return b.isMultiQuantityPurchaseEnabled()&&!b.isBusinessCustomer()?["soldByThirdParty_feature_div","quantityLayoutHigh_feature_div"]:[]},disableQuantityRefresh:a,getQueryParamValueToDisableQuantityRefresh:h}});p.when("A","vas-twister-xl-setting","vas-twister-page-refresh-webView","vas-metrics-publisher","vas-twister-xl-util","ready").execute("vas-twister-xl-controller",function(e,b,a,h,c){var g=e.$,f="#buybox_feature_div #desktop_buybox #price_feature_div #unifiedPrice_feature_div #pmpux_feature_div #issuancePriceblockAmabot_feature_div #alternativeOfferEligibilityMessaging_feature_div #applicablePromotionList_feature_div #availability_feature_div #holidayDeliveryMessage_feature_div #dpFastTrack_feature_div #businessOnlyItem_feature_div #shipsFromSoldBy_feature_div #businessPricing_feature_div #smileEligibility_feature_div #holidayAvailabilityMessage_feature_div #moreBuyingChoices_feature_div #companyCompliancePolicies_feature_div".split(" "),
k=!1,d="",l="",n=function(){b.logVasTwistetATCReftag(l)},q=function(){try{e.trigger("vas:remove-service-asin-buybox-event"),g("#addToCart").unbind("submit.ppdBundles"),h.increaseMetricBy("a2cFormRemoveEventSend_fail",0),h.metric("a2cFormRemoveEventSend_success")}catch(a){h.increaseMetricBy("a2cFormRemoveEventSend_success",0),h.metric("a2cFormRemoveEventSend_fail"),h.log(a)}},m=function(a){try{e.trigger("vas:add-service-asin-buybox-event",a),g("#addToCart").bind("submit.ppdBundles",n),h.increaseMetricBy("a2cFormAddEventSend_success",
1),h.increaseMetricBy("a2cFormAddEventSend_fail",0)}catch(b){h.increaseMetricBy("a2cFormAddEventSend_success",0),h.increaseMetricBy("a2cFormAddEventSend_fail",1),h.log(b)}},p={vasTwisterExpander:function(a,c){g("#vas-fake-twister-includesection-"+a.attr("data-twister-svcAsin")).find("i").hasClass("a-icon-extender-collapse")?b.logTwisterExpanderReftagAndMetric(!1,c):b.logTwisterExpanderReftagAndMetric(!0,c)},ppdFakeTwisterTrigger:function(h){var n=h.attr("data-twister-svcAsin"),r={};if("undefined"===
typeof n||b.getVasTwisterOption(n).isOfferAvailable)if(g(".vas-ppd-swatch-item").removeClass("vas-ppd-swatch-select"),h.addClass("vas-ppd-swatch-select"),g(".vas-twister-whatsincluded").hide(),g("#vas-twister-title").html(h.attr("data-twister-callToAction")),"removeOffer"===h.attr("data-twister-action"))a.abortPageRefreshRequests(),g("#ppdb-add-service-checkbox").prop("checked",!1),l="undefined",c.isRefreshRequired(d,b.getProductAsinAndOfferData("merchantId"))?(r.featuresToRefresh=f,a.restoreInitialData(r),
d=b.getProductAsinAndOfferData("merchantId"),a.showOfferUpdateWidget()):a.hideOfferUpdateWidget(),q(),b.logVasTwisterInteractionReftag(!1,"ItemOnly"),e.trigger("vas:twister-update-widgets","show");else{!1===k&&(a.setInitialFeaturesData(f),k=!0);g("#ppdb-add-service-checkbox").prop("checked",!0);q();g("#vas-fake-twister-whatsincluded-"+h.attr("data-twister-svcAsin")).show();g("#vas-fake-twister-includesection-"+h.attr("data-twister-svcAsin")).find("i").hasClass("a-icon-extender-collapse")||(g("#vas-fake-twister-includesection-"+
h.attr("data-twister-svcAsin")).unbind("click"),g("#vas-fake-twister-includesection-"+h.attr("data-twister-svcAsin")).bind("click",function(a){p.vasTwisterExpander(h,n)}),g("#vas-fake-twister-includesection-"+h.attr("data-twister-svcAsin")).click());l=n;var w=b.getVasTwisterOption(n).baseOfferMerchantId;c.isRefreshRequired(d,w)?(r.asin=b.getProductAsinAndOfferData("asin"),r.svcAsin=n,r.merchantId=b.getVasTwisterOption(n).offerData.merchantId,r.isVariationalParent=!1,r.featuresToRefresh=f,r.baseOfferMerchantId=
w,a.performPageRefresh(r),d=w,a.showOfferUpdateWidget()):(e.trigger("vas:twister-update-widgets","hide"),m(b.getSettings(h.attr("data-twister-svcAsin"))),a.hideOfferUpdateWidget());b.logVasTwisterInteractionReftag(!0,n)}}};e.off("vas:add-asin-offer-data-to-cart");e.on("vas:add-asin-offer-data-to-cart",function(a){m(b.getSettings(a))});e.off("vas:remove-asin-offer-data-to-cart");e.on("vas:remove-asin-offer-data-to-cart",function(){q()});var r=function(){g(".vas-ppd-swatch-item").unbind("click");g(".vas-ppd-swatch-item").bind("click",
function(a){a=g(a.currentTarget);a.hasClass("vas-ppd-swatch-select")||p.ppdFakeTwisterTrigger(a)})};e.off("vas:widgetname:twister_xl");e.on("vas:widgetname:twister_xl",function(){b.setInitialWidgetSettings();r();d=b.getProductAsinAndOfferData("merchantId");a.restoreInitialPriceInProductTwister();if(b.hasPrecheckEnabled()){a.hideOfferUpdateWidget();var c=g(".vas-ppd-swatch-select");p.ppdFakeTwisterTrigger(c)}g("#vasTwisterRow").removeClass("vas-twister-disabled")})});p.when("A","dp-refresh-handler",
"vas-metrics-publisher","vas-twister-xl-setting","vas-twister-xl-util").register("vas-upsell-page-refresh",function(e,b,a,h,c){var g=e.$,f={featureName:"upsell"},k=function(b){return{pageRefreshUrl:"/gp/page/refresh",ajaxOptions:{method:"POST",timeout:"90000",success:function(){"undefined"===typeof b.svcAsin?e.trigger("vas:xl-twister-update-widgets","show"):(e.trigger("vas:add-asin-offer-data-to-cart",b.svcAsin),e.trigger("vas:xl-twister-update-widgets","hide"));a.increaseMetricBy("vasUpsellPageRefresh_success",
1);a.increaseMetricBy("vasUpsellPageRefresh_fail",0);e.trigger("vas:vas-xl-twister-page-refresh-complete",b)},error:function(){a.increaseMetricBy("vasUpsellPageRefresh_success",0);a.increaseMetricBy("vasUpsellPageRefresh_fail",1);e.trigger("vas:vas-xl-twister-page-refresh-complete",b)}}}},d=function(a,b){e.each(b,function(b,c){g(b).css("opacity",a)})};e.off("vas:vas-xl-twister-page-refresh-start");e.on("vas:vas-xl-twister-page-refresh-start",function(a){d("0.5",a.featuresToGreyOut);g("#vasTwisterRow").addClass("vas-twister-disabled")});
e.off("vas:vas-xl-twister-page-refresh-complete");e.on("vas:vas-xl-twister-page-refresh-complete",function(a){var b=h.getProductAsinAndOfferData().asin,c=g("#twister_feature_div"),f=g("li[data-defaultasin\x3d"+b+"]"),b=g("li[data-defaultasin\x3d"+b+"] .a-size-mini"),e=g("#priceblock_ourprice"),k=g("#priceblock_saleprice");0>=c.length||0>=f.length||0>=b.length||(e.length?b.text(e.text()):k.length?b.text(k.text()):b.text(""));d("1.0",a.featuresToGreyOut);g("#vasTwisterRow").removeClass("vas-twister-disabled")});
e.off("vas:xl-twister-update-widgets");e.on("vas:xl-twister-update-widgets",function(a){var b=g("#dpFastTrack_feature_div"),c=g("#moreBuyingChoices_feature_div");0<b.length&&("show"===a?b.show():b.hide());0<c.length&&("show"===a?c.show():c.hide())});return{performPageRefresh:function(a){var d=k(a),g=new b(f,w,d),h={};h.m=a.merchantId;h.triggerEvent=f.featureName;"undefined"!==typeof a.svcAsin&&c.disableQuantityRefresh()&&(h.vas=c.getQueryParamValueToDisableQuantityRefresh());h=g.createCustomParamsMap({},
h);e.trigger("vas:vas-xl-twister-page-refresh-start",a);g.doPageRefresh(h,d.ajaxOptions,!0)},hideOfferUpdateWidget:function(){g("#vas-twister-price-update-div").hide()},showOfferUpdateWidget:function(){g("#vas-twister-price-update-div").show()},restoreInitialPriceInProductTwister:function(){try{var b=h.getInitialProductPriceContent();e.each(b,function(a,b){b=g("li[data-defaultasin\x3d"+b+"] .a-size-mini");b.length&&b.text(a)});a.increaseMetricBy("restoreInitialPriceInProductTwister_fail",0);a.metric("restoreInitialPriceInProductTwister_success",
1)}catch(c){a.increaseMetricBy("restoreInitialPriceInProductTwister_success",0),a.metric("restoreInitialPriceInProductTwister_fail",1),a.log(c)}}}});p.register("vas-enhanceppd-config",function(){return{enhancedPPDMetricConstants:{refmarkerPrefixes:{tenant:"vas",widget:"eppdb"},hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip",isCritical:"crtcl"},metricPrefixes:{tenant:"vas",widget:"eppdb"}}}});p.when("A","vas-common-settings","vas-metrics-publisher",
"vas-utilities","vas-enhanceppd-config","vas-metric-utils","ready").register("vas-enhanceppd-setting",function(e,b,a,h,c,g){var f={enhancePpdViewModel:{}},k=c.enhancedPPDMetricConstants.refmarkerPrefixes,d=c.enhancedPPDMetricConstants.metricPrefixes;return{getSettings:function(a){return f.hasOwnProperty(a)?f[a]:f},setSettings:function(a,b,c){a&&c?f[a][c]=b:a&&(f[a]=b)},fetchEnhancePpdSetting:function(){f.enhancePpdViewModel=b.getSetting("winningWidgetVM");f.productAsin=b.getSetting("widgetCommonVM").productAsin;
f.zipCode=b.getSetting("widgetCommonVM").zipCode;f.buyboxPrice=b.getSetting("widgetCommonVM").buyboxPrice;f.isEnhanceUpsellPresence="undefined"===typeof f.enhancePpdViewModel.upsellAsinOfferData?!1:!0;f.sessionId=b.getSetting("widgetCommonVM").sessionId;f.mappingSet=b.getSetting("widgetCommonVM").mappingSet;f.enhancedPPDMetricConstants=c.enhancedPPDMetricConstants;f.hitParameters=g.createHitParameters(c.enhancedPPDMetricConstants);var e,n=!0===f.enhancePpdViewModel.isUpsellCritical?"1":"0",m=f.enhancePpdViewModel.baseAsinOfferData.upsellAsin,
p=f.enhancePpdViewModel.productAsin,x=h.getPriceValue(f.enhancePpdViewModel.winningServiceMinPrice),r=f.enhancePpdViewModel.baseAsinOfferData.merchantId,u=h.getPriceValue(f.buyboxPrice),v=f.zipCode;e=(!1===f.isEnhanceUpsellPresence?"vas_bdlppd_enh_":"vas_bdlppd_enh_upsell_")+n+"_a_"+v;a.logRefTag("vas_bdlppd_ld_"+n+"_a_"+v,"LocalServicesWidget","Impression",m,"popUp",r,p,x,u);a.logRefTag(e,"LocalServicesWidget","Impression",m,"popUp",r,p,x,u);e=f.isEnhanceUpsellPresence?"uppdb":d.widget;a.createCSMNameAndLog(d.tenant,
e,a.CSMActionTypes.glanceView);a.createRefMarkerAndLog(k.tenant,f.mappingSet,e,a.RefmarkerActionTypes.glanceView,f.hitParameters)},logPPDBundlesExpander:function(b){a.increaseMetricBy(!1===f.isEnhanceUpsellPresence?"vas_ppd_bdl_sm_clicks":"vas_ppd_bdl_sm_upg_clicks",1);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,b?a.CSMActionTypes.expandBulletPoints:a.CSMActionTypes.collapseBulletPoints,f.hitParameters);a.createCSMNameAndLog(d.tenant,d.widget,b?a.RefmarkerActionTypes.expandBulletPoints:
a.RefmarkerActionTypes.collapseBulletPoints)},logPPDBundlesATCReftag:function(){a.createCSMNameAndLog(d.tenant,d.widget,a.CSMActionTypes.addToCart);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.addToCart,f.hitParameters)},logCheckboxInteractionReftag:function(b){var c=!0===f.enhancePpdViewModel.isUpsellCritical?"1":"0",e=f.enhancePpdViewModel.baseAsinOfferData.upsellAsin,g=f.enhancePpdViewModel.productAsin,m=h.getPriceValue(f.enhancePpdViewModel.winningServiceMinPrice);
a.logRefTag("vas_bdlppd_"+b+"_"+f.ppdBundlesInteractionSlice+"_"+c+"_a","LocalServicesWidget","AddServiceCheck",e,"popUp",f.enhancePpdViewModel.baseAsinOfferData.merchantId,g,m);a.createCSMNameAndLog(d.tenant,d.widget,"y"===b?a.CSMActionTypes.serviceIncluded:a.CSMActionTypes.serviceNotIncluded);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,"y"===b?a.RefmarkerActionTypes.serviceIncluded:a.RefmarkerActionTypes.serviceNotIncluded,f.hitParameters)},logBuyBackReftagHandler:function(){var b=f.enhancePpdViewModel.baseAsinOfferData.upsellAsin,
c=f.enhancePpdViewModel.productAsin,e="vas_bbk_"+c+"_"+b,g=h.getPriceValue(f.enhancePpdViewModel.winningServiceMinPrice);a.logRefTag(e,"LocalServicesWidget","CartAdd",b,"popUp",f.enhancePpdViewModel.baseAsinOfferData.merchantId,c,g);a.createCSMNameAndLog(d.tenant,d.widget,a.CSMActionTypes.buyBack);a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.buyBack,f.hitParameters);return!0},logPPDBundlesBuyNowReftag:function(){a.createCSMNameAndLog(d.tenant,d.widget,a.CSMActionTypes.buyNow);
a.createRefMarkerAndLog(k.tenant,f.mappingSet,k.widget,a.RefmarkerActionTypes.buyNow,f.hitParameters)}}});p.when("A","vas-enhanceppd-setting","vas-metrics-publisher","vas-addUpsell-to-cart","ready").execute("vas-enhanceppd-controller",function(e,b,a,h){var c=e.$,g=function(){b.logPPDBundlesATCReftag()},f=function(){b.logPPDBundlesBuyNowReftag()},k=function(){b.logBuyBackReftagHandler()},d=function(){try{e.trigger("vas:remove-service-asin-buybox-event"),c("#add-to-cart-button").unbind("click.ppdBundles"),
c("#buy-now-button").unbind("click.ppdBundles"),c("#buyBackBuyNow").length&&c(document.body).undelegate("#buyBackBuyNow","submit.vasBuyBackReftag"),a.increaseMetricBy("a2cFormRemoveEventSend_fail",0),a.metric("a2cFormRemoveEventSend_success")}catch(b){a.increaseMetricBy("a2cFormRemoveEventSend_success",0),a.metric("a2cFormRemoveEventSend_fail"),a.log(b)}},l=function(b){try{e.trigger("vas:add-service-asin-buybox-event",b),c("#add-to-cart-button").bind("click.ppdBundles",g),c("#buy-now-button").bind("click.ppdBundles",
f),e.trigger("vas:add-service-asin-buyback-form-event",b),c(document.body).delegate("#buyBackBuyNow","submit.vasBuyBackReftag",k),a.increaseMetricBy("a2cFormAddEventSend_success",1),a.increaseMetricBy("a2cFormAddEventSend_fail",0)}catch(d){a.increaseMetricBy("a2cFormAddEventSend_success",0),a.increaseMetricBy("a2cFormAddEventSend_fail",1),a.log(d)}},n={ppdBundlesCheckBoxHandler:function(){var a,f=c("#ppdBundlesEnhancedWrapper"),e=c("#ppdBundlesEnhancedBox");c("#ppdb-add-service-checkbox").is(":checked")?
(a="y",d(),b.getSettings("isEnhanceUpsellPresence")&&c("#ppdb-upsell-service-checkbox").is(":checked")?l(b.getSettings("enhancePpdViewModel").upsellAsinOfferData):l(b.getSettings("enhancePpdViewModel").baseAsinOfferData),f.addClass("ppdBundlesOrangeBorder").removeClass("ppdBundlesGrayBorder"),e.addClass("ppdBundlesOrangeBox"),null===b.getSettings("ppdBundlesInteractionSlice")&&b.setSettings("ppdBundlesInteractionSlice",1),c("#ppdBundlesExpanderContent").is(":visible")||c("#ppdBundlesExpanderHeadingLink").click()):
(a="n",f.addClass("ppdBundlesGrayBorder").removeClass("ppdBundlesOrangeBorder"),e.removeClass("ppdBundlesOrangeBox"),b.getSettings("isEnhanceUpsellPresence")&&c("#ppdb-upsell-service-checkbox").is(":checked")&&c("#ppdb-upsell-service-checkbox").click(),d());b.logCheckboxInteractionReftag(a);b.setSettings("ppdBundlesInteractionSlice",1)},ppdBundlesUpsellCheckBoxHandler:function(){var a;c("#ppdb-upsell-service-checkbox").is(":checked")?(c("#ppdb-add-service-checkbox").is(":checked")?(d(),l(b.getSettings("enhancePpdViewModel").upsellAsinOfferData)):
c("#ppdb-add-service-checkbox").click(),a="y"):(d(),l(b.getSettings("enhancePpdViewModel").baseAsinOfferData),a="n");b.logCheckboxInteractionReftag(a)}},m=function(){e.off("a:expander:ppdBundlesExpander:toggle:expand");e.on("a:expander:ppdBundlesExpander:toggle:expand",function(a){b.logPPDBundlesExpander(!0)});e.off("a:expander:ppdBundlesExpander:toggle:collapse");e.on("a:expander:ppdBundlesExpander:toggle:collapse",function(a){b.logPPDBundlesExpander(!1)});c("#ppdb-add-service-checkbox").unbind("change");
c("#ppdb-add-service-checkbox").bind("change",function(){n.ppdBundlesCheckBoxHandler()});b.getSettings("isEnhanceUpsellPresence")&&(c("#ppdb-upsell-service-checkbox").unbind("change"),c("#ppdb-upsell-service-checkbox").bind("change",function(){n.ppdBundlesUpsellCheckBoxHandler()}))},p=function(){e.off("vas:ldbb-a2c-event:desktop");e.on("vas:ldbb-a2c-event:desktop",function(a){if(c("#ppdb-add-service-checkbox").is(":checked")){var d;d=b.getSettings("isEnhanceUpsellPresence")&&c("#ppdb-upsell-service-checkbox").is(":checked")?
b.getSettings("enhancePpdViewModel").upsellAsinOfferData:b.getSettings("enhancePpdViewModel").baseAsinOfferData;h.addUpsell(d.upsellAsin,d.offerlistingId,b.getSettings("sessionId"),a)}});e.off("vas:ldbb-upsell-added:desktop");e.on("vas:ldbb-upsell-added:desktop",function(){g()})};e.off("vas:widgetname:enhancedPPD");e.on("vas:widgetname:enhancedPPD",function(){b.fetchEnhancePpdSetting();m();p();c("#ppdb-add-service-checkbox").is(":checked")?(d(),c("#ppdBundlesEnhancedWrapper").addClass("ppdBundlesOrangeBorder").removeClass("ppdBundlesGrayBorder"),
c("#ppdBundlesEnhancedBox").addClass("ppdBundlesOrangeBox"),b.getSettings("isEnhanceUpsellPresence")&&c("#ppdb-upsell-service-checkbox").is(":checked")?l(b.getSettings("enhancePpdViewModel").upsellAsinOfferData):l(b.getSettings("enhancePpdViewModel").baseAsinOfferData)):(c("#ppdBundlesEnhancedWrapper").addClass("ppdBundlesGrayBorder").removeClass("ppdBundlesOrangeBorder"),c("#ppdBundlesEnhancedBox").removeClass("ppdBundlesOrangeBox"))})});p.register("vas-ppdbundle-config",function(){return{ppdBundlesMetricConstants:{refmarkerPrefixes:{tenant:"vas",
widget:"ppdb"},hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip",isCritical:"crtcl"},metricPrefixes:{tenant:"vas",widget:"ppdb"}}}});p.when("A","vas-common-settings","vas-metrics-publisher","vas-utilities","vas-ppdbundle-config","vas-metric-utils","ready").register("vas-ppdbundle-setting",function(e,b,a,h,c,g){var f=e.$,k={ppdBundleViewModel:{}},d=c.ppdBundlesMetricConstants.refmarkerPrefixes,l=c.ppdBundlesMetricConstants.metricPrefixes;
return{getSettings:function(a){return k.hasOwnProperty(a)?k[a]:k},setSettings:function(a,b,c){a&&c?k[a][c]=b:a&&(k[a]=b)},fetchPpdBundleSetting:function(){k.ppdBundleViewModel=b.getSetting("winningWidgetVM");k.productAsin=b.getSetting("widgetCommonVM").productAsin;k.zipCode=b.getSetting("widgetCommonVM").zipCode;k.buyboxPrice=b.getSetting("widgetCommonVM").buyboxPrice;k.sessionId=b.getSetting("widgetCommonVM").sessionId;k.mappingSet=b.getSetting("widgetCommonVM").mappingSet;k.ppdBundlesMetricConstants=
c.ppdBundlesMetricConstants;k.hitParameters=g.createHitParameters(k.ppdBundlesMetricConstants);var e=f("#ppdb-add-service-checkbox");e.is(":checked")&&e.prop("checked",!1);var e=!0===k.ppdBundleViewModel.isUpsellCritical?"1":"0",m=k.zipCode,p=k.productAsin,x=h.getPriceValue(k.ppdBundleViewModel.baseAsinOfferData.price),r=h.getPriceValue(k.buyboxPrice),u=k.ppdBundleViewModel.baseAsinOfferData.upsellAsin,v=k.ppdBundleViewModel.baseAsinOfferData.merchantId,w="vas_bdlppd_old_"+e+"_a_"+m;a.logRefTag("vas_bdlppd_ld_"+
e+"_a_"+m,"LocalServicesWidget","Impression",u,"popUp",v,p,x,r);a.logRefTag(w,"LocalServicesWidget","Impression",u,"popUp",v,p,x,r);a.metric("bdl_old_gv");a.createCSMNameAndLog(l.tenant,l.widget,a.CSMActionTypes.glanceView);a.createRefMarkerAndLog(d.tenant,k.mappingSet,d.widget,a.RefmarkerActionTypes.glanceView,k.hitParameters)},logCheckboxInteractionReftag:function(b){var c=!0===k.ppdBundleViewModel.isUpsellCritical?"1":"0",e=k.ppdBundleViewModel.baseAsinOfferData.upsellAsin,f=k.productAsin,g=h.getPriceValue(k.ppdBundleViewModel.baseAsinOfferData.price);
h.getPriceValue(k.buyboxPrice);a.logRefTag("vas_bdlppd_"+b+"_1_"+c+"_a","LocalServicesWidget","AddServiceCheck",e,"popUp",k.ppdBundleViewModel.baseAsinOfferData.merchantId,f,g);a.createCSMNameAndLog(l.tenant,l.widget,"y"===b?a.CSMActionTypes.serviceIncluded:a.CSMActionTypes.serviceNotIncluded);a.createRefMarkerAndLog(d.tenant,k.mappingSet,d.widget,"y"===b?a.RefmarkerActionTypes.serviceIncluded:a.RefmarkerActionTypes.serviceNotIncluded,k.hitParameters)},logATCInteraction:function(){a.createCSMNameAndLog(l.tenant,
l.widget,a.CSMActionTypes.addToCart);a.createRefMarkerAndLog(d.tenant,k.mappingSet,d.widget,a.RefmarkerActionTypes.addToCart,k.hitParameters)},logSDPRedirectReftagAndMetric:function(){a.createCSMNameAndLog(l.tenant,l.widget,a.CSMActionTypes.redirect);a.createRefMarkerAndLog(d.tenant,k.mappingSet,d.widget,a.RefmarkerActionTypes.redirect,k.hitParameters);return!0}}});p.when("A","vas-ppdbundle-setting","vas-metrics-publisher","vas-addUpsell-to-cart","ready").execute("vas-ppdbundle-controller",function(e,
b,a,h){var c=e.$,g={ppdBundlesCheckBoxHandler:function(){var d;if(c("#ppdb-add-service-checkbox").is(":checked")){d=b.getSettings("ppdBundleViewModel").baseAsinOfferData;b.logATCInteraction();try{e.trigger("vas:add-service-asin-buybox-event",d),a.increaseMetricBy("a2cFormAddEventSend_success",1),a.increaseMetricBy("a2cFormAddEventSend_fail",0)}catch(f){a.increaseMetricBy("a2cFormAddEventSend_success",0),a.increaseMetricBy("a2cFormAddEventSend_fail",1),a.log(f)}d="y"}else{try{e.trigger("vas:remove-service-asin-buybox-event"),
a.increaseMetricBy("a2cFormRemoveEventSend_fail",0),a.metric("a2cFormRemoveEventSend_success")}catch(f){a.increaseMetricBy("a2cFormRemoveEventSend_success",0),a.metric("a2cFormRemoveEventSend_fail"),a.log(f)}d="n"}b.logCheckboxInteractionReftag(d)}},f=function(){c("#ppdb-add-service-checkbox").unbind("change");c("#ppdb-add-service-checkbox").bind("change",function(){g.ppdBundlesCheckBoxHandler()});c("#ppdBundles-estimate-SDP").unbind("click");c("#ppdBundles-estimate-SDP").bind("click",function(){b.logSDPRedirectReftagAndMetric()})},
k=function(){e.off("vas:ldbb-a2c-event:desktop");e.on("vas:ldbb-a2c-event:desktop",function(a){if(c("#ppdb-add-service-checkbox").is(":checked")){var f=b.getSettings("ppdBundleViewModel").baseAsinOfferData;h.addUpsell(f.upsellAsin,f.offerlistingId,b.getSettings("sessionId"),a)}})};e.off("vas:widgetname:ppdBundle");e.on("vas:widgetname:ppdBundle",function(){b.fetchPpdBundleSetting();f();k()})});p.register("vas-regularPPD-config",function(){return{regularPPDMetricConstants:{refmarkerPrefixes:{tenant:"vas",
widget:"rpdp"},hitRecordConstants:{pageType:"DetailPage",subPageType:"AddServices"},additionalRequestDataKeys:{zipCode:"zip"},metricPrefixes:{tenant:"vas",widget:"rpdp"}}}});p.when("A","vas-common-settings","vas-metrics-publisher","vas-regularPPD-config","vas-metric-utils","ready").register("vas-regularppd-setting",function(e,b,a,h,c){var g,f,k,d,l=h.regularPPDMetricConstants.refmarkerPrefixes,m=h.regularPPDMetricConstants.metricPrefixes;return{fetchRegularPpdSetting:function(){g=b.getSetting("widgetCommonVM").productAsin;
f=b.getSetting("winningWidgetVM").upsellAsin;k=b.getSetting("widgetCommonVM").mappingSet;b.getSetting("widgetCommonVM");b.getSetting("widgetCommonVM");d=c.createHitParameters(h.regularPPDMetricConstants);a.createRefMarkerAndLog(l.tenant,k,l.widget,a.RefmarkerActionTypes.glanceView,d);a.createCSMNameAndLog(m.tenant,m.widget,a.CSMActionTypes.glanceView);a.logRefTag("vas_ppd_cs_"+g+"_"+f);a.logUeMetricIncreaseCount("vas_standard_pdp_show")},logRedirectMetrics:function(){a.createCSMNameAndLog(m.tenant,
m.widget,a.CSMActionTypes.redirect);a.createRefMarkerAndLog(l.tenant,k,l.widget,a.RefmarkerActionTypes.redirect,d)}}});p.when("A","vas-regularppd-setting","vas-metrics-publisher","ready").execute("vas-regularppd-controller",function(e,b,a){var h=e.$,c=function(){h(".sdpRedirect").unbind("click");h(".sdpRedirect").bind("click",function(){b.logRedirectMetrics();a.logUeMetricIncreaseCount("vas_pdp_sdp_redirect");b.logRedirectMetrics()})};e.off("vas:widgetname:regularPPD");e.on("vas:widgetname:regularPPD",
function(){c();b.fetchRegularPpdSetting()})});p.when("A","vas-common-settings","vas-metrics-publisher","ready").register("vas-brandmessaging-setting",function(e,b,a){var h,c,g;return{fetchBrandMessagingSettings:function(){h=b.getSetting("widgetCommonVM").productAsin;c=b.getSetting("winningWidgetVM").upsellAsin;g=b.getSetting("winningWidgetVM").impressionReftag;a.logRefTag(g,"LocalServicesWidget","Impression",c,null,null,h,null,null);a.logUeMetricIncreaseCount("vas_brand_gv")}}});p.when("A","vas-brandmessaging-setting",
"vas-metrics-publisher","ready").execute("vas-brandmessaging-controller",function(e,b,a){var h=e.$,c=function(){h("#vas-brand-messaging-details-redirect").unbind("click");h("#vas-brand-messaging-details-redirect").bind("click",function(){a.logUeMetricIncreaseCount("vas_brand_details_redir")})};e.off("vas:widgetname:brandMessagingDesktop");e.on("vas:widgetname:brandMessagingDesktop",function(){c();b.fetchBrandMessagingSettings()})});p.when("A","vas-widget-const","vas-value-prop-logger","vas-value-prop-constants",
"ready").register("vas-value-prop-controller",function(e,b,a,h){var c=e.$,g=b.COMMON.DOM.VALUE_PROP_T1_SLOT,f=h.VALUE_PROP_T1_WIDGET_NAME,k=function(){var b,h;e.each(c("#"+g).find("[data-a-state]"),function(g,k){h=e.parseJSON(c(g).attr("data-a-state")).key;"vas-value-prop-widget-vm"===h&&(b=e.parseJSON(c(g).html()),a.logGlanceViewRefTagAndCSM(b,f))})};b=function(){k();e.off(h.POPOVER_SHOW_EVENT);e.on(h.POPOVER_SHOW_EVENT,function(b){a.logPopoverShowRefTagAndCSM(f)});c(document.body).undelegate(h.HYPERLINK_TEXT_ID,
h.CLICK_EVENT);c(document.body).delegate(h.HYPERLINK_TEXT_ID,h.CLICK_EVENT,function(){a.logHyperLinkClickRefTagAndCSM(f)})};b();return{initialize:b}});p.when("A","vas-metrics-publisher").register("vas-value-prop-logger",function(e,b){var a=function(a){return{pageAsin:a.productAsin,services:h(a),zip:a.zipCode,additionalRequestData:{zip:a.zipCode,services:h(a)}}},h=function(a){var b=[];e.each(a.serviceOptions,function(a){b.push(a.serviceAsin)});return b},c=function(a,b){return["vas",b,a].join("_")};
return{logHyperLinkClickRefTagAndCSM:function(a){b.logHit(c(b.RefmarkerActionTypes.hyperLinkClick,a));b.logCSMCounter(c(b.RefmarkerActionTypes.hyperLinkClick,a))},logPopoverShowRefTagAndCSM:function(a){b.logHit(c(b.RefmarkerActionTypes.popoverShow,a));b.logCSMCounter(c(b.RefmarkerActionTypes.popoverShow,a))},logGlanceViewRefTagAndCSM:function(e,f){b.logHit(c(b.RefmarkerActionTypes.glanceView,f),a(e));b.logCSMCounter(c(b.RefmarkerActionTypes.glanceView,f))}}});p.when("ready").register("vas-value-prop-constants",
function(){return{CLICK_EVENT:"click",VALUE_PROP_T1_WIDGET_NAME:"valuePropT1",VALUE_PROP_T2_WIDGET_NAME:"valuePropT2",HYPERLINK_TEXT_ID:"#vas-valueProp-hyperLink-text",POPOVER_SHOW_EVENT:"a:popover:afterShow:valuePropClickThrough"}});p.when("A","vas-metrics-publisher","vas-common-settings").register("vas-si-conflicts",function(e,b,a){var h=e.$;return{isSIConflicting:function(){var c;c=!1;"undefined"!==typeof a.getSetting("widgetCommonVM")&&(c=a.getSetting("widgetCommonVM").isWarrantyPresent);(c=c||
null!==document.getElementById("servicesInterstitial")||null!==document.getElementById("attach-warranty-pane"))||(c=0!==h("#abb-interstitial").length)&&b.metric("devicesInterstitialPresentCount");return c},isHijackATC:function(){return"undefined"!==typeof a.getSetting("winningWidgetVM")?a.getSetting("widgetCommonVM").hijackATC:!1}}});p.when("A").register("valueadds_controller",function(e){return{isValueAddsAvailable:function(){return!1}}});p.when("A").register("vsx-services-constants",function(e){return{UNDEFINED:"undefined",
STRING:"string",NUMBER:"number",OBJECT:"object",BOOLEAN:"boolean",FEATURE_NAME:"VSXServices",FEATURE_ATTRIBUTION:"Value Added Services/Discovery/Value Adds Detail Page",ASIN:"asin",ADD_SELECTION_TYPE:"add",DELETE_SELECTION_TYPE:"delete",DELETE:"DELETE",AUI_BUTTON_SELECTED:"a-button-selected",AUI_BUTTON_FOCUS:"a-button-focus",AUI_BUTTON_TOGGLE_GROUP:".a-button-toggle-group",AUI_BUTTON_TOGGLE:".a-button-toggle",AUI_EXPANDER:"a:expander:",AUI_EXPANDER_EXPAND:":toggle:expand",AUI_EXPANDER_COLLAPSE:":toggle:collapse",
CLICK:"click",AUI_CARD_EXPANDED:"a-expander-content-expanded",ARIA_EXPANDED_STATE:"aria-expanded",ARIA_EXPANDED_STATE_VALUE_FALSE:"false",STYLE:"style",CARD_HIDDEN_STYLE:"overflow: hidden; display: none;",COLLAPSE_HEADING_ICON:"a-icon-section-collapse",EXPAND_HEADING_ICON:"a-icon-section-expand",CARD_OPENED:"tp_cc_vsx_dss_open",CARD_CLOSED:"tp_cc_vsx_dss_close",CARD_OPENED_SIMPLE_MESSAGING:"tp_cc_vsx_dss_open_simpleMessaging",CARD_CLOSED_SIMPLE_MESSAGING:"tp_cc_vsx_dss_close_simpleMessaging",CARD_OPENED_BUNDLE:"tp_cc_vsx_dss_open_bundle",
CARD_CLOSED_BUNDLE:"tp_cc_vsx_dss_close_bundle",ASIN_LINK_CLICK:"tp_cc_vsx_dss_asin_clk",ASIN_ADD:"tp_cc_vsx_dss_asin_add",ASIN_REMOVE:"tp_cc_vsx_dss_asin_rem",SEE_MORE_LINK:"tp_cc_vsx_dss_bsm_clk",GLANCE_VIEW:"tp_cc_vsx_dss_gv",GLANCE_VIEW_SIMPLE_MESSAGING:"tp_cc_vsx_dss_gv_simpleMessaging",GLANCE_VIEW_BUNDLE:"tp_cc_vsx_dss_gv_bundle",REF_TAG_BASE_URL:"/gp/product/ajax-handlers/reftag.html/ref\x3d",SIMPLE_MESSAGING_CARD_HEADER:"vsx-services-simpleMessaging-expander-header",SIMPLE_MESSAGING_DETAILS_LINK_ID:"#vsx-services-simpleMessaging-detailsLink",
SIMPLE_MESSAGING_DIV_ID:"#vsx-services-simpleMessaging",SIMPLE_MESSAGING_STATE_ELEMENT:"vsx-services-simpleMessaging-data",SIMPLE_MESSAGING_CARD_CONTENT_SELECTOR:".vsx-services-simpleMessaging .a-expander-content",SIMPLE_MESSAGING_HEADING_ICON_SELECTOR:".vsx-services-simpleMessaging .a-expander-container .a-expander-header .a-icon",SIMPLE_MESSAGING_GV:"vsx_simple_messaging_gv",BUNDLE_CARD_HEADER:"vsx-services-bundle-expander-header",BUNDLE_ASIN_LINK_ID:"#vsx-services-bundle-asinLink",BUNDLE_CARD_ICON_DIV_ID:"#vsx-services-bundle-icon",
BUNDLE_CARD_ICON_CSS:"vsx-services-bundle-icon-css",BUNDLE_CARD_ICON_SELECTED_CSS:"vsx-services-selected-icon-css",BUNDLE_CARD_POST_SELECTION_CLASS:"vsxServices-bundle-postSelection",BUNDLE_CARD_PRE_SELECTION_CLASS:"vsxServices-bundle-preSelection",BUNDLE_CARD_HIDDEN_CLASS:"vsxServices-bundle-hidden",BUNDLE_CARD_INCLUSION_BUTTON_ID:"#vsx-services-bundle-inclusionButton",BUNDLE_CARD_EXCLUSION_BUTTON_ID:"#vsx-services-bundle-exclusionButton",BUNDLE_DIV_ID:"#vsx-services-bundle",BUNDLE_STATE_ELEMENT:"vsx-services-bundle-data",
BUNDLE_CARD_CONTENT_SELECTOR:".vsx-services-bundle .a-expander-content",BUNDLE_HEADING_ICON_SELECTOR:".vsx-services-bundle .a-expander-container .a-expander-header .a-icon",BUNDLE_GV:"vsx_bundle_gv",BUNDLE_ASIN_MANDATORY:"vsx_bundle_asin_mandatory",BUNDLE_ASIN_ADDED:"vsx_bundle_asin_add",BUNDLE_ASIN_REMOVED:"vsx_bundle_asin_removed"}});p.when("A","cc-manager","vsx-services-constants").register("vsx-services-twister-registration",function(e,b,a){var h=e.$,c={init:function(){},validateInputParams:function(b){return b&&
typeof b!==a.UNDEFINED&&b.itemType===a.ASIN&&typeof b.asin===a.STRING&&typeof b.offerListingId===a.STRING?1:0},cardCollapse:function(){g(a.BUNDLE_CARD_CONTENT_SELECTOR,a.BUNDLE_HEADING_ICON_SELECTOR);g(a.SIMPLE_MESSAGING_CARD_CONTENT_SELECTOR,a.SIMPLE_MESSAGING_HEADING_ICON_SELECTOR)}},g=function(b,c){h(b).removeClass(a.AUI_CARD_EXPANDED).attr(a.ARIA_EXPANDED_STATE,a.ARIA_EXPANDED_STATE_VALUE_FALSE).attr(a.STYLE,a.CARD_HIDDEN_STYLE);h(c).removeClass(a.COLLAPSE_HEADING_ICON).addClass(a.EXPAND_HEADING_ICON)};
return{selectionUpdate:function(a,c){return b.ccSelectionUpdate(a,c)},registerFeature:function(){b.registerFeature({featureName:a.FEATURE_NAME,featureAttribution:a.FEATURE_ATTRIBUTION},c)},cardExpanderListener:function(){b.cardExpanded(a.FEATURE_NAME)}}})});
/* ******** */
(function(a){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,b=d?d("DetailPagePromotionalBundleAssets",""):c;b.guardFatal?b.guardFatal(a)(b,window):b.execute(function(){a(b,window)})})(function(a,c,d){a.when("A","ready").execute("kbpMobileExpander",function(b){var a=b.$;a(".pb-bundle-section-expander").click(function(b){a(".pb-bundle-mobile-box").removeClass("aok-hidden");a(".pb-bundle-expander-box").addClass("aok-hidden")})})});
/* ******** */
(function(a){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,c=d?d("DeliveryStaticPackard",""):b;c.guardFatal?c.guardFatal(a)(c,window):c.execute(function(){a(c,window)})})(function(a,b,d){a.when("A","GLUXWidget").execute(function(c,a){c.on("packard:glow:destinationChangeAll",function(){b.location.reload()})});a.when("A","GlowTriggerMetrics","a-modal").execute(function(c,b,e){c.declarative("dpContextualIngressPt","click",function(a){b.logGLOWTriggerCountFromIngress(b.getEvents().cip.desktop);
var d=e.get(c.$("#nav-global-location-slot"));d&&(a.$event.preventDefault(),d.show())})});a.when("A").register("GlowTriggerMetrics",function(c){var a={cip:{desktop:"cip.desktop",mobileWeb:"cip.mobileWeb",tabletApp:"cip.tabletApp",mobileApp:"cip.mobileApp",micron:"cip.micron"},glowTop:{tabletApp:"glow-top.tabletApp",mobileApp:"glow-top.mobileApp",micron:"glow-top.micron"},gpsOnLoad:{nativeApp:"gpsOnLoad.nativeApp"},unknown:{nativeApp:"unknown.nativeApp"}};return{getEvents:function(){return a},logGLOWTriggerCountFromIngress:function(a){a=
"GLOWTrigger."+a;b.ue?b.ue.count(a,1):(a="Failed to increment metrics counter: "+a+" because window.ue is not present.",b.ueLogError&&a&&b.ueLogError({message:a},{logLevel:"ERROR",attribution:"GLOWTrigger"}))}}})});
/* ******** */
(function(k){var m=window.AmazonUIPageJS||window.P,r=m._namespace||m.attributeErrors,b=r?r("DeliveryStatic",""):m;b.guardFatal?b.guardFatal(k)(b,window):b.execute(function(){k(b,window)})})(function(k,m,r){k.when("A","jQuery","ready").register("DeliveryCountdownComponent",function(b,a){function h(a,b,c,d,e){this.strings=a;this.asin=b;this.deliveryMessageSectionId=c;this.countdownElementId=d;this.secondsLeft=e;this.intervalHandle=null}m.DeliveryCountdownHandler=function(a){var b=a.strings,c=a.asin,
d=a.deliveryMessageSectionId,e=a.fastCountdownElementId,n=a.cheapCountdownElementId;this.cheapCountdownTimer=this.fastCountdownTimer=null;this.start=function(a,l){0<a&&(this.fastCountdownTimer=new h(b,c,d,e,a),this.fastCountdownTimer.start());0<l&&(this.cheapCountdownTimer=new h(b,c,d,n,l),this.cheapCountdownTimer.start())};this.stop=function(){this.fastCountdownTimer&&(this.fastCountdownTimer.stop(),this.fastCountdownTimer=null);this.cheapCountdownTimer&&(this.cheapCountdownTimer.stop(),this.cheapCountdownTimer=
null)}};h.prototype.start=function(){var a=this;this.intervalHandle=b.interval(function(){a&&a.updateCountdownText()},1E3)};h.prototype.stop=function(){this.intervalHandle&&m.clearInterval(this.intervalHandle)};h.prototype.updateCountdownText=function(){this.secondsLeft--;if(0<this.secondsLeft){var b=Math.floor(this.secondsLeft/60),g=b%60,b=Math.floor(b/60),c=this.secondsLeft%60,d=this.strings.inNext,e=1<b?this.strings.hours:this.strings.hour,n=1<g?this.strings.minutes:this.strings.minute,w=1<c?this.strings.seconds:
this.strings.second,h=this.strings.timeSeperator,g=0<b&&0<g?b+h+e+h+g+h+n+h+d:0<b&&0===g?b+h+e+d:0===b&&0<g?g+h+n+d:c+h+w+d;a(this.countdownElementId).html(g)}else this.stop(),g="\x3ca href\x3d'javacript:window.location.reload();'\x3e"+this.strings.refreshTimeout+"\x3c/a\x3e",a(this.deliveryMessageSectionId).html(g)}});k.when("A","jQuery","LUXContext").register("LUXController",function(b,a,h){function l(){return{addressLabel:n,addressId:w,obfuscatedId:y,countryCode:f,zipCode:t,state:u,city:x,district:p,
locationType:v}}function g(a){n=a.addressLabel;w=a.addressId;y=a.obfuscatedId;f=a.countryCode;t=a.zipCode;u=a.state;x=a.city;p=a.district;v=a.locationType}function c(a,f,d){a=b.copy(a);a.deviceType=h.deviceType;a.pageType=e;a.actionSource="locux";b.post("/gp/delivery/ajax/address-change.html",{contentType:"application/x-www-form-urlencoded;charset\x3dutf-8",params:a,success:function(a){if(a.sembuUpdated){a.address&&g(a.address);var c=l();h.fullPageRefresh?(k.when("LUXMetrics").execute(function(a){a.logLocationChange(c.locationType)}),
m.location.reload()):(b.trigger("DeliveryAddressDropdown_OnSembuUpdateSuccess",c),b.trigger("DeliveryAddressDropdown_OnAddressChange",c),f&&f(),k.when("LUXMetrics").execute(function(a){a.logLocationChange(c.locationType)}))}else d&&d()},error:function(){b.trigger("DeliveryAddressDropdown_OnSembuUpdateFail",l());d&&d()}})}var d=!1,e=null,n,w,y,f,t,u,x,p,v;return{locationChangeEventName:"DeliveryAddressDropdown_OnAddressChange",locationTypes:{defaultAddress:"DEFAULT_ADDRESS",accountAddress:"ACCOUNT_ADDRESS",
lockerAddress:"LOCKER_ADDRESS",locationInput:"LOCATION_INPUT",realmDefault:"REALM_DEFAULT",region:"REGION",country:"COUNTRY",ip2location:"IP2LOCATION"},init:function(a){k.when("LUXResponder").execute(function(f){d?b.equals(a,l())||(g(a),f.refresh()):(g(a),f.activate(),d=!0)});k.when("LUXCustom").execute(function(a){a.activate()});k.when("LUXMetrics").execute(function(a){e=a.getPageType()})},getLocationData:function(){return l()},changeLocation:function(a,b,f){c(a,b,f)}}});k.when("A","LUXDPOnly").register("LUXDPRefreshController",
function(b){function a(a){e=a;h({addressId:e.addressId,zipCode:e.zipCode,city:e.city,state:e.state,district:e.district,countryCode:e.countryCode,relatedRequestId:e.relatedRequestId});var b={asin:e.asin,merchantId:e.merchantId,deviceType:e.deviceType,smid:e.smid,wdg:e.wdg,exMerchId:e.exMerchId,oneClick:e.oneClick};k.when("UnifiedLocationUpdateHandler").execute(function(a){a.init(b);d=a});l(e.obfuscatedId);g(e.obfuscatedId)}function h(a){var d=c('#buybox select[name\x3d"quantity"]').val()||1;b.state("unifiedLocation",
{addressId:a.addressId,zipCode:a.zipCode,city:a.city,state:a.state,district:a.district,countryCode:a.countryCode,quantity:d,relatedRequestId:a.relatedRequestId})}function l(a){if(e&&e.oneClick){var d="unifiedLocation1ClickAddress";e.deviceType&&"mobileApp"===e.deviceType&&(d="addressID");a||(a=c("#"+d).data("addnewaddress"))||(a="new");d='[id\x3d"'+d+'"]';0<c(d).length&&c(d).val(a);if(e.deviceType&&e.deviceType in n&&(d=b.state("buyNowInfo"))){var f=d.urlParams,f=0<f.indexOf("addressID\x3d")?f.replace(/(addressID=)[^&]*/,
"$1"+a):f+"\x26addressID\x3d"+a;d.urlParams=f;b.state("buyNowInfo",d)}}}function g(a){e&&!e.oneClick&&"T1"===e.updateAddressForNon1Click&&(a||(a=c("#unifiedLocationAddress").data("addnewaddress")),1===c("#unifiedLocationAddress").length&&c("#unifiedLocationAddress").val(a))}var c=b.$,d=null,e=null,n={tabletApp:1,tabletLargeApp:1,iPad:1};b.on("DeliveryAddressDropdown_OnAddressChange",function(a){var c=b.state("unifiedLocation")?b.state("unifiedLocation").relatedRequestId:r;a.relatedRequestId=c;h(a);
l(a.obfuscatedId);g(a.obfuscatedId);null!==d&&(d.refresh(),b.trigger("LocationUX_OnAddressChange",a))});b.on("UnifiedLocationPostRefresh",function(){b.trigger("diodeAjaxRefreshed")});return{init:function(d){a(d)},updateFeaturesForNewQuantitySelection:function(a){h(a);null!==d&&(d.refresh(),b.trigger("LocationUX_OnAddressChange",a))}}});k.when("A","LUXController","LUXDPRefreshController","LUXDPOnly").register("LUXDPQuantityRefresh",function(b,a,h){b.declarative("quantity-dropdown","change",function(b){b=
a.getLocationData();h.updateFeaturesForNewQuantitySelection(b)})});k.when("A","detailPage:RefreshHandler","LUXDPOnly","a-state").execute(function(b,a){k.register("TwisterUpdateHandler",function(){return{init:function(a){b.state("unifiedLocation",a)},refresh:function(){var h=a.getHandlerInstance("LocationUX"),l=[],g="addressId zipCode city state district countryCode relatedRequestId".split(" ");if(h){var c=b.state("unifiedLocation"),d;for(d in c)if(c.hasOwnProperty(d)&&-1<b.$.inArray(d,g)){var e=typeof c[d];
("number"===e||"boolean"===e||"string"===e||c[d]instanceof String)&&l.push(h.getURLParamObject(d,null===c[d]?"":c[d],1))}}0<l.length&&h.doPageRefresh(l)}}})});k.when("A","LUXDPOnly","a-state").execute(function(b){k.register("UnifiedLocationUpdateHandler",function(){return{init:function(a){b.state("unifiedLocation",a)},refresh:function(){a=2;h()}}});var a=0,h=function(){var a=b.state("unifiedLocation");a.urlParams=JSON.stringify(a.urlParams);for(var e in a)if(a.hasOwnProperty(e)){var n=typeof a[e];
"number"===n||"boolean"===n||"string"===n||a[e]instanceof String||(null===a[e]?a[e]="":delete a[e])}a&&a.asin&&a.merchantId&&(b.trigger("UnifiedLocationPreRefresh"),b.ajax("/gp/product/features/unified-location/udp/refresh-features.html?_encoding\x3dUTF-8",{params:a,method:"POST",success:l,error:g,abort:c}))},l=function(){b.trigger("UnifiedLocationPostRefresh",!0)},g=function(){b.trigger("UnifiedLocationPostRefresh",!1);0<--a&&h()},c=function(a){b.trigger("UnifiedLocationPostRefresh",!1)}});k.when("A",
"jQuery","a-popover","LUXWidgetConfig","ready").execute(function(b,a,h,l){function g(c){var d=!1,e=c.selectedAddressId,n=c.selectedObfuscatedId,h=c.selectedAddressLabel,g=c.selectedCountryCode,f=c.selectedZipCode,t=c.selectedState,u=c.selectedCity,x=c.selectedDistrict,p=c.addressPopover.name,v=c.addressPopover.type,r=l.initialAddressLoadCount,z=l.addressReloadCount,q=c.deviceType,N=c.isRecognized,C=0,A=!1;this.init=function(){d||(d=!0,O())};this.destroy=function(){b.off("a:popover:beforeShow:"+p,
D);b.off("a:popover:afterHide:"+p,E);b.capabilities.tablet&&a.isFunction(b.off.orientationchange)&&b.off.orientationchange(F);a(document).undelegate("#unifiedLocationAddrInput","focus");a(document).undelegate("#unifiedLocationAddrInput","input");a(document).undelegate("#unifiedLocationSignIn","click");a(document).undelegate("#unifiedLocationAddrUpdate","click");a(document).undelegate("#unifiedLocationAccountAddrList input[type\x3dradio], #unifiedLocationPopoverSelections ul li .a-touch-link.a-touch-select",
"click");a(document).undelegate("#unifiedLocationSeeMore","click")};var G=function(){k.when(v).execute(function(a){a.get(p)&&a.get(p).hide()})},O=function(){b.on("a:popover:beforeShow:"+p,D);b.on("a:popover:afterHide:"+p,E);b.capabilities.tablet&&a.isFunction(b.on.orientationchange)&&b.on.orientationchange(F);a(document).delegate("#unifiedLocationAddrInput","focus",function(a){H()});a(document).delegate("#unifiedLocationSignIn","click",function(){var a=!0;"mobileApp"===q&&k.now("mash").execute(function(b){b&&
(a=!1,b.navstack.begin().back().end(),b.showLoginDialog({successCallback:function(){b.navstack.begin().back().forward(m.location.href).end()}}))});a&&(m.location.href=c.addressPopover.signInURL+m.location.pathname)});a(document).delegate("#unifiedLocationAddrInput","keyup",function(a){I()});a(document).delegate("#unifiedLocationAddrInput","keypress",function(a){13===(a.keyCode||a.which)&&J()});a(document).delegate("#unifiedLocationAddrUpdate","click",function(a){J()});a(document).delegate("#unifiedLocationAccountAddrList input[type\x3dradio], #unifiedLocationPopoverSelections ul li .a-touch-link.a-touch-select",
"click",function(b){b=a.parseJSON(a(this).hasClass("a-touch-link")?a(this).find("input[type\x3dhidden]").val():a(this).val());if(a(this).hasClass("a-active"))G();else if(b){var f=b.id;f!==e&&K({addressId:f,isDefaultShippingAddress:b.isDefault,addressLabel:b.label,deviceType:q},!1,a(this))}});a(document).delegate("#unifiedLocationSeeMore","click",function(a){L()});"tabletApp"===q&&m.scrollBy(0,1)},P=a("#unifiedLocationAddrInput").attr("placeholder"),I=function(){"tabletApp"===q&&(a("#unifiedLocationAddrInput").val()?
a("#unifiedLocationAddrInput").removeAttr("placeholder"):a("#unifiedLocationAddrInput").attr("placeholder",P))},J=function(){var b=a("#unifiedLocationAddrInput").val();b&&b.match(/^\d{5}$/)?K({zipCode:b,deviceType:q},!0,null):M()},D=function(f){a("#unifiedLocationInvalidInputAlert").hasClass("aok-hidden")||(a("#unifiedLocationAddrInput").val(""),H());b.capabilities.tablet&&a("#a-popover-lgtbox")&&a("#a-popover-lgtbox").css({position:"absolute",top:"0px",left:"0px",width:"100%",height:a("#a-page").css("height")});
I();A||L()},E=function(){"tabletApp"===q&&document.activeElement.blur()},F=function(){k.when(v).execute(function(a){a.get(p)&&a.get(p).refresh()})},L=function(){N&&a.ajax({type:"POST",url:"/gp/delivery/ajax/get-customer-address-list.html",contentType:"application/x-www-form-urlencoded;charset\x3dutf-8",data:{currentAddressCount:C,loadCount:A?z:r,selectedAddressId:e,deviceType:q},dataType:"json",success:function(b){if(b){var f=b.loadedAddressCount;if(0<f){var d=b.html;d&&(a("#unifiedLocationPopoverSelections").length?
(a("#unifiedLocationPopoverSelections ul li").has("span .a-touch-link.a-touch-select").remove(),a("#unifiedLocationPopoverSelections ul").html(d+a("#unifiedLocationPopoverSelections ul").html())):a("#unifiedLocationAccountAddrList").html(d),a("#unifiedLocationTitleSelectAddress").removeClass("a-hidden aok-hidden"),a("#unifiedLocationTitleNoAddress").addClass("aok-hidden"),a("#unifiedLocationSeeMoreDiv").removeClass("a-hidden aok-hidden"),k.when(v).execute(function(a){a.get(p)&&a.get(p).updatePosition()}),
b.hasMore?a("#unifiedLocationSeeMore").removeClass("a-hidden aok-hidden"):a("#unifiedLocationSeeMore").addClass("aok-hidden"),C=f)}}A=!0},error:function(){}})},M=function(){a("#unifiedLocationAddrInput").addClass("a-form-error");a("#unifiedLocationInvalidInputAlert").removeClass("a-hidden aok-hidden");"tabletApp"===q&&(document.activeElement.blur(),a("#unifiedLocationInvalidInputAlert")[0].scrollIntoView())},H=function(){a("#unifiedLocationAddrInput").removeClass("a-form-error");a("#unifiedLocationInvalidInputAlert").addClass("aok-hidden")},
K=function(b,d,c){a.ajax({type:"POST",url:"/gp/delivery/ajax/address-change.html",contentType:"application/x-www-form-urlencoded;charset\x3dutf-8",data:b,dataType:"json",success:function(b){if(b.sembuUpdated){if(b=b.address)e=b.addressId,n=b.obfuscatedId,h=b.addressLabel,g=b.countryCode,f=b.zipCode,t=b.state,u=b.city,x=b.district,b=h?h:(u?u+", ":"")+(t?t+" ":"")+f,a("#unifiedLocationSelectedAddressText").html(b),d&&(a("#unifiedLocationAccountAddrList input[type\x3dradio]:checked").attr("checked",
!1),a("#unifiedLocationAddrInput").val("")),a("#unifiedLocationPopoverSelections ul li .a-touch-link.a-touch-select.a-active").removeClass("a-active"),c&&c.hasClass("a-touch-link")&&c.addClass("a-active");G();B("DeliveryAddressDropdown_OnSembuUpdateSuccess");B("DeliveryAddressDropdown_OnAddressChange")}else b.isValidAddress||M()},error:function(){B("DeliveryAddressDropdown_OnSembuUpdateFail")}})},B=function(a){b.trigger(a,{addressId:e,obfuscatedId:n,countryCode:g,zipCode:f,state:t,city:u,district:x})}}
k.register("DeliveryAddressDropdown",function(){var a;return{init:function(b){a&&a.destroy();(a=new g(b)).init()}}})});k.when("A","jQuery","LUXContext","LUXWidgetConfig","LUXUtils","LUXController","LUXMetrics","ready").register("LUXResponder",function(b,a,h,l,g,c,d){function e(b){a("#unifiedLocationAddrInput").trigger("updateAlerts",[b]);1===b?(a("#unifiedLocationAddrInput").addClass("a-form-error"),a("#LUXInvalidZipCodeAlert").width(a("#LUXInvalidZipCodeAlert").parent().width()).removeClass("aok-hidden"),
a("#LUXMilitaryZipCodeAlert").addClass("aok-hidden")):2===b?(a("#unifiedLocationAddrInput").removeClass("a-form-error"),a("#LUXInvalidZipCodeAlert").addClass("aok-hidden"),a("#LUXMilitaryZipCodeAlert").width(a("#LUXMilitaryZipCodeAlert").parent().width()).removeClass("aok-hidden")):3===b&&(a("#unifiedLocationAddrInput").removeClass("a-form-error"),a("#LUXInvalidZipCodeAlert").addClass("aok-hidden"),a("#LUXMilitaryZipCodeAlert").addClass("aok-hidden"))}function n(b){a(".lux-location-label").html(g.generateLocationLabel(b))}
function w(f){a("#LUXAddressSelections input[type\x3dradio]:checked").attr("checked",!1);var d=a("#LUXAddressSelections .a-declarative").has(".a-radio input[type\x3dradio]");f=f.addressId;for(var c=d.length-1;0<=c;c--)if(b.parseJSON(d[c].getAttribute("data-lux-address-selection")).addressId===f){a(".a-radio input[type\x3dradio]",d[c]).attr("checked",!0);break}}function y(b){b=b.locationType===c.locationTypes.locationInput&&b.zipCode?b.zipCode:"";a("#unifiedLocationAddrInput").trigger("updateZipCodeField",
b);a("#unifiedLocationAddrInput").val(b);e(3)}function f(a){k.when("a-dropdown").execute(function(f){f=f.getSelect(l.countrySelectorComponentName);b.objectIsEmpty(f)||(a.locationType===c.locationTypes.country||a.locationType===c.locationTypes.region||a.locationType===c.locationTypes.ip2location&&!a.state?f.setValue(g.mapLocationDataToCode(a)):f.setValue(""))})}function t(){b.post("/gp/delivery/ajax/get-country-selections.html",{contentType:"application/x-www-form-urlencoded;charset\x3dutf-8",params:g.prepareCountrySelectionGeneratorInput(),
success:function(b){a("#unifiedLocationCountrySelectionDiv").html(b);f(c.getLocationData())}})}function u(a){c.changeLocation(a.data,null,function(){w(c.getLocationData())})}function x(a){c.changeLocation(g.mapCodeToLocationData(a.value),null,function(){f(c.getLocationData())})}function p(){var b=a("#unifiedLocationAddrInput").val();g.validateZipCode(b)?c.changeLocation({zipCode:g.preprocessZipCode(b),locationType:c.locationTypes.locationInput},function(){e(3)},function(){e(1)}):g.isMilitaryZipCode(b)?
e(2):e(1)}function v(){k.when(l.addressSelectorComponentType).execute(function(a){a.get(l.addressSelectorComponentName)&&a.get(l.addressSelectorComponentName).hide()})}function r(){var b=a("#LUXAddressSelections .a-radio"),f=a("#LUXAddressSelections .a-radio.aok-hidden"),b=b.length===f.length;f.slice(0,b?l.initialAddressLoadCount:l.addressReloadCount).removeClass("aok-hidden");0===a("#LUXAddressSelections .a-radio.aok-hidden").length&&(a("#LUXSeeMoreAddressLink").addClass("aok-hidden"),a("#LUXAddressActionSeparator").addClass("aok-hidden"));
b||d.logEvent(d.getEvents().click.seeMore)}function z(a){n(a);w(a);y(a);g.shouldPopulateCountrySelector()&&f(a);v()}function q(){var f=c.getLocationData();y(f);h.isRecognizedCustomer&&0===a("#LUXAddressSelections .a-radio").length&&0===a("#LUXNoAddressNote").length&&b.get("/gp/delivery/ajax/get-address-selections.html",{params:{currentAddressId:f.addressId,deviceType:h.deviceType,isOneClickFromContext:h.isOneClick,clientPage:h.clientPage},success:function(b){b&&(a("#unifiedLocationTitleNoAddress").remove(),
a("#unifiedLocationAccountAddrList").remove(),a("#unifiedLocationSeeMoreDiv").remove(),a("#unifiedLocationTitleSelectAddress").remove(),a(".lux-address-selector-divider").before(b),r())}});!a.trim(a("#unifiedLocationCountrySelectionDiv").html()).length&&g.shouldPopulateCountrySelector()&&t(f);d.logWidgetView(d.getEvents().view.addressSelector)}return{activate:function(){var f=c.getLocationData();d.logPageView(f.locationType);f.locationType===c.locationTypes.region&&n(f);b.on("a:popover:beforeShow:"+
l.addressSelectorComponentName,q);y(f);b.on(c.locationChangeEventName,z);b.declarative("lux-address-selection",["change"],u);a(document).delegate("#unifiedLocationAddrInput","keypress",function(a){13===a.which&&p()});a(document).delegate("#unifiedLocationAddrInput","focus",function(){e(3)});a(document).delegate("#unifiedLocationAddrUpdate","click",p);a(document).delegate("#unifiedLocationSignIn","click",function(){d.logEvent(d.getEvents().click.signIn);var a=l.signInURL+m.location.pathname;"Search"===
d.getPageType()&&(a+=m.location.search);m.location.href=a});a(document).delegate("#LUXSeeMoreAddressLink","click",r);a(document).delegate(".lux-manage-address-link","click",function(a){d.logEvent(d.getEvents().click.manageAddressBook);return!0});b.on("a:dropdown:"+l.countrySelectorComponentName+":select",x)},refresh:function(a){z(c.getLocationData())}}});k.declare("LUXWidgetConfig",{addressSelectorComponentName:"LUXAddressSelector",addressSelectorComponentType:"a-popover",countrySelectorComponentName:"LUXCountrySelector",
countrySelectorComponentType:"a-dropdown",initialAddressLoadCount:5,addressReloadCount:5,signInURL:"/gp/sign-in.html?ie\x3dUTF8\x26useRedirectOnSuccess\x3d1\x26path\x3d"});k.when("A","jQuery","LUXController","RegionNames","ready").register("LUXRegionData",function(b,a,h,l){function g(a){if(b.objectIsEmpty(a)||!a.countryCode||!a.zipCode)return null;for(var e in c)if(c.hasOwnProperty(e)&&b.reduce(c[e],function(n,h,g){return n&&!b.objectIsEmpty(a[g])&&b.equals(a[g],c[e][g])},!0))return e;return null}
var c={"GB-ML":{countryCode:"GB",zipCode:"KA10 6EB"},"GB-NI":{countryCode:"GB",zipCode:"BT1 3ES"},"GB-JE":{countryCode:"GB",zipCode:"JE2 4QA"},"GB-IS":{countryCode:"GB",zipCode:"ZE1 0BX"},"GB-BF":{countryCode:"GB",zipCode:"BFPO 204"},"GB-HI":{countryCode:"GB",zipCode:"PH41 4PU"},"DE-ML":{countryCode:"DE",zipCode:"60313"},"DE-GI":{countryCode:"DE",zipCode:"27498"},"FR-ML":{countryCode:"FR",zipCode:"75001"},"FR-CH":{countryCode:"FR",zipCode:"20000"},"FR-GP":{countryCode:"FR",zipCode:"97100"},"FR-GY":{countryCode:"FR",
zipCode:"97300"},"FR-MC":{countryCode:"FR",zipCode:"98000"},"FR-MQ":{countryCode:"FR",zipCode:"97200"},"FR-NC":{countryCode:"FR",zipCode:"98800"},"FR-PF":{countryCode:"FR",zipCode:"98700"},"FR-RE":{countryCode:"FR",zipCode:"97400"},"FR-SB":{countryCode:"FR",zipCode:"97133"},"FR-SM":{countryCode:"FR",zipCode:"97150"},"FR-SP":{countryCode:"FR",zipCode:"97500"},"FR-WF":{countryCode:"FR",zipCode:"98611"},"FR-YT":{countryCode:"FR",zipCode:"97600"},"IT-ML":{countryCode:"IT",zipCode:"20125"},"IT-II":{countryCode:"IT",
zipCode:"09121"},"ES-ML":{countryCode:"ES",zipCode:"28004"},"ES-BI":{countryCode:"ES",zipCode:"07003"},"ES-CI":{countryCode:"ES",zipCode:"35005"},"BR-SP":{countryCode:"BR",zipCode:"01319900"}};return{getRegions:function(){return c},mapLocationDataToRegionCode:function(a){return g(a)},mapRegionCodeToLocationData:function(b){b=c.hasOwnProperty(b)?a.extend({},{addressLabel:l[b],countryCode:c[b].countryCode,zipCode:c[b].zipCode,state:c[b].state,city:c[b].city,locationType:h.locationTypes.region}):null;
return b}}});k.when("A","jQuery","ready").register("LUXRegionConfig",function(b,a){var h=[],l="AD AE AF AG AI AL AM AN AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" "),
g=/^\d{5}([ \-]\d{4})?$/,c=/^[ \t]*([AFD](\.?)([ \t]?)P(\.?)([ \t]?)O(\.?)[ \t]*[A-Z]{2}[ \t]*[0-9]{5}([ \-][0-9]{4})?)[ \t]*$/;return{getPrimarySelections:function(){return h},getSecondarySelections:function(){return l},getZipCodePattern:function(){return g},getMilitaryZipCodePattern:function(){return c},preprocessZipCode:function(a){return a.toUpperCase().trim().substring(0,5)}}});k.declare("RegionNames",{"GB-ML":"UK - Mainland","GB-BF":"UK - BFPO","GB-JE":"UK - Channel Islands","GB-IS":"UK - Islands",
"GB-NI":"UK - Northern Ireland","GB-HI":"UK - Scottish Highlands","DE-ML":"Germany - Mainland","DE-GI":"German Islands","FR-ML":"France - Mainland","FR-CH":"Corsica","FR-GP":"Guadeloupe","FR-GY":"Guyane","FR-MC":"Monaco","FR-MQ":"Martinique","FR-NC":"New Caledonia","FR-PF":"French Polynesia","FR-RE":"Reunion","FR-SB":"Saint Barthélemy","FR-SM":"Saint Martin","FR-SP":"Saint Pierre and Miquelon","FR-WF":"Wallis and Futuna Islands","FR-YT":"Mayotte","IT-ML":"Italy - Mainland","IT-II":"Italian Islands",
"ES-ML":"Spain - Mainland","ES-BI":"Spain - Balearic Islands","ES-CI":"Spain - Canary Islands, Ceuta and Melilla","BR-SP":"Brazil"});k.declare("CountryNames",{AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AN:"Netherlands Antilles",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Aland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",
BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthelemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Saint Eustatius and Saba",BR:"Brazil",BS:"Bahamas, The",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos (Keeling) Islands",CD:"Congo, The Democratic Republic of the",CF:"Central African Republic",CG:"Congo",CH:"Switzerland",CI:"Cote D'ivoire",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",
CO:"Colombia",CR:"Costa Rica",CS:"Serbia and Montenegro",CU:"Cuba",CV:"Cape Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands (Malvinas)",FM:"Micronesia, Federated States of",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",
GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia, The",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HM:"Heard Island and the McDonald Islands",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran, Islamic Republic of",
IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"Korea, Democratic People's Republic of",KR:"Korea, Republic of",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Lao People's Democratic Republic",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova, Republic of",
ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"Macedonia, The Former Yugoslav Republic of",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",
OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestinian Territories",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Reunion",RO:"Romania",RS:"Serbia",RU:"Russian Federation",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",
SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Swaziland",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania, United Republic of",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",
US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands, British",VI:"Virgin Islands, U.S.",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",XK:"Kosovo",YE:"Yemen",YT:"Mayotte",YU:"Yugoslavia",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"});k.when("A","jQuery","LUXController","LUXRegionData","LUXRegionConfig","LUXContext","CountryNames","RegionNames").register("LUXUtils",function(b,a,h,l,g,c,d,e){function n(a){return!b.objectIsEmpty(a)&&
a.countryCode&&d.hasOwnProperty(a.countryCode)?b.equals(a.locationType,h.locationTypes.country)?a.countryCode:b.equals(a.locationType,h.locationTypes.region)?l.mapLocationDataToRegionCode(a):l.mapLocationDataToRegionCode(a)||a.countryCode:null}function k(a){return d.hasOwnProperty(a)?d[a]:e.hasOwnProperty(a)?e[a]:null}function m(a){var c={};if(!b.objectIsEmpty(a))for(var d=a.length,e=0;e<d;e++)c[k(a[e])]=a[e];return c}return{getNameForCode:function(a){return k(a)},mapCodeToLocationData:function(a){a=
a?d.hasOwnProperty(a)?{countryCode:a,locationType:h.locationTypes.country,district:a}:l.mapRegionCodeToLocationData(a):null;return a},mapLocationDataToCode:function(a){return n(a)},generateLocationLabel:function(a){a.addressLabel?a=a.addressLabel:a.locationType!==h.locationTypes.region&&a.locationType!==h.locationTypes.country&&a.zipCode?(g.formatZipCodeForAddressLabel&&(a.zipCode=g.formatZipCodeForAddressLabel(a.zipCode)),a=a.city||a.state?g.generateDiffLocationLabelForZip?g.generateDiffLocationLabelForZip(a):
(a.city?a.city+", ":"")+(a.state?a.state+" ":"")+a.zipCode:g.formatZipCodeForAddressLabel?a.zipCode:k(n(a))):a=k(n(a));return a},prepareCountrySelectionGeneratorInput:function(){return{deviceType:c.deviceType,primarySelections:JSON.stringify(m(g.getPrimarySelections())),primarySelectionsOrder:JSON.stringify(g.getPrimarySelections()),secondarySelections:JSON.stringify(m(g.getSecondarySelections()))}},validateZipCode:function(a){return!b.objectIsEmpty(a)&&g.getZipCodePattern().test(a.toUpperCase())},
preprocessZipCode:function(a){return g.preprocessZipCode(a)},isMilitaryZipCode:function(a){return!b.objectIsEmpty(a)&&g.getMilitaryZipCodePattern().test(a.toUpperCase())},shouldPopulateCountrySelector:function(){var a=!0;"undefined"!==typeof c.shouldPopulateCountrySelector&&(a=c.shouldPopulateCountrySelector);return a}}});k.when("A","jQuery","LUXContext","ready").register("LUXMetrics",function(b,a,h){function l(a,b){m.ueLogError&&a&&m.ueLogError({message:a},{logLevel:b||"ERROR",attribution:"LocationUX"})}
function g(a){m.ue?m.ue.count(a,(m.ue.count(a)||0)+1):l("Failed to increment metrics counter: "+a+" because window.ue is not present.","ERROR")}function c(){var a;if(a=m.ue_pty)a:{a=m.ue_pty;for(var c in d)if(d.hasOwnProperty(c)&&-1!==b.indexOfArray(d[c],a)){a=!0;break a}a=!1}return a?m.ue_pty:"unrecognizedPage"}var d={detail:["Detail","DetailAW","DetailWebView","TabletUDP"],search:["Search","SearchAW"],offerListing:["OfferListing","OfferListingAW","OfferListingMobileAppAW"]},e={click:{signIn:"click.signIn",
seeMore:"click.seeMore",manageAddressBook:"click.manageAddressBook"},view:{page:"view.page",addressSelector:"view.addressSelector",countrySelector:"view.countrySelector"},selection:"selection",override:"override"};return{getPageType:function(){return c()},getEvents:function(){return e},logLocationChange:function(a){k.when("LUXController").execute(function(k){var l=c(),f="LocationUX."+l,f=b.equals(a,k.locationTypes.locationInput)||b.equals(a,k.locationTypes.realmDefault)||b.equals(a,k.locationTypes.ip2location)?
f+("."+e.override+"."+a):f+("."+e.selection+"."+a);b.equals(a,k.locationTypes.defaultAddress)||b.equals(a,k.locationTypes.accountAddress)||b.equals(a,k.locationTypes.lockerAddress)||(f+="."+(h.isRecognizedCustomer?"recognized":"unrecognized"));-1!==b.indexOfArray(d.detail,l)&&h.isRecognizedCustomer&&(f+="."+(h.isOneClick?"1Click":"Non1Click"));g(f)})},logPageView:function(a){k.when("LUXController").execute(function(k){var l=c(),f="LocationUX."+l+"."+e.view.page+"."+a;b.equals(a,k.locationTypes.defaultAddress)||
b.equals(a,k.locationTypes.accountAddress)||b.equals(a,k.locationTypes.lockerAddress)||(f+="."+(h.isRecognizedCustomer?"recognized":"unrecognized"));-1!==b.indexOfArray(d.detail,l)&&h.isRecognizedCustomer&&(f+="."+(h.isOneClick?"1Click":"Non1Click"));g(f)})},logWidgetView:function(a){var e=c();a="LocationUX."+e+"."+a+"."+(h.isRecognizedCustomer?"recognized":"unrecognized");-1!==b.indexOfArray(d.detail,e)&&h.isRecognizedCustomer&&(a+="."+(h.isOneClick?"1Click":"Non1Click"));g(a)},logEvent:function(a){a=
"LocationUX."+c()+"."+a;g(a)},logError:function(a,b){l(a,b)}}})});
/* ******** */
(function(b){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,a=d?d("AmazonsChoiceAssets",""):c;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,c,d){b.when("A","a-popover","ready").execute(function(a,b){var g=a.$;g(document).delegate("#why-we-love-this-product-link","click mouseenter",function(a){b.get(g("#ac-badge-popover-declarative")).show();a.preventDefault()})});"use strict";b.when("A","atf","dp-refresh-handler","twisterModule","ac-state-utils").execute(function(a,
b,g,c,d){d.addACStateParamsToPageRefreshAjaxUrl()});"use strict";b.when("A","atf","dp-refresh-handler","ready").register("ac-state-utils",function(a,b,c){return{addACStateParamsToPageRefreshAjaxUrl:function(){var b={featureName:"acBadge"},d=a.$,e=a.state("acState");if(e){var f={};e.acAsin&&(f.acAsin=e.acAsin);e.modalityMetadata&&(f.ac_md=e.modalityMetadata);d.isEmptyObject(f)||(new c(b)).addParams(f)}}}})});
/* ******** */
(function(b){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,a=d?d("PrimeOneClickAssets",""):c;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,c,d){b.register("PrimeOneClickCountdown",function(){function a(e,a,b,c,d){if(!(1>e)){var f=this;this.endTime=this.getCurrentTime()+e;this.expirationCallback=a;this.displayElement=b;this.displayEnabled=!!d;this.formatFunction=c;this.update();this.currentTimer=setInterval(function(){f.update()},6E4)}}
a.prototype.update=function(){var a=this.endTime-this.getCurrentTime();0>a&&(a=0);this.updateDisplay(a);0===a&&("function"===typeof this.expirationCallback&&this.expirationCallback(),this.destroy())};a.prototype.updateDisplay=function(a){this.displayElement&&this.displayEnabled&&(this.displayElement.innerHTML=this.getCountdownDisplay(Math.floor(a/3600),Math.floor(a%3600/60),a%60))};a.prototype.getCountdownDisplay=function(a,b,c){return"function"===typeof this.formatFunction?this.formatFunction(a,
b,c):a+"h "+b+"m "+c+"s"};a.prototype.enableDisplay=function(){this.displayEnabled=!0;this.update()};a.prototype.disableDisplay=function(a){this.displayEnabled=!1;a&&this.displayElement&&(this.displayElement.innerHTML="")};a.prototype.getCurrentTime=function(){return Math.floor(+new Date/1E3)};a.prototype.destroy=function(){clearTimeout(this.currentTimer)};return{Countdown:a}})});
/* ******** */
(function(f){var n=window.AmazonUIPageJS||window.P,u=n._namespace||n.attributeErrors,b=u?u("ProductBundleUIAssets",""):n;b.guardFatal?b.guardFatal(f)(b,window):b.execute(function(){f(b,window)})})(function(f,n,u){f.when("A","ready").register("bundle-listing.model",function(b){function a(){this.asin="";this.isBundle=this.componentsPending=this.componentsAvailable=!1}var t=b.$,g,c=0,e,h,d,k,f,l=new a,p=function(a,c,r){if(h()&&!f()&&!k()){if(d()){var m={asin:d()};l.componentsPending=!0;return g=b.get("/gp/product/ajax-handlers/get-bundle-details.html",
{params:m,accepts:"text/html",timeout:2E3,indicator:r,success:function(q){null===q||t.trim(q).length?(l.componentsAvailable=!0,a(q)):e(a,c,r,p,"An empty Ajax response was received for bundleAsin: "+d(),null,!0)},error:function(q,b,d){e(a,c,r,p,b,d)}})}e(a,c,r,p)}};e=function(a,e,d,h,q,g,m){3>c?(l.componentsPending=!1,c+=1,m?h(a,e,d):b.delay(function(){h(a,e,d)},200)):(l.componentsPending=!0,e(q,g))};var m=function(){null!==g&&g!==u&&g.abort();l=new a;var b=t("#bundle-state");b.length&&(l.asin=b.data("asin"),
l.isBundle=b.data("isbundle"))};h=function(){return l.isBundle&&""!==d()};d=function(){return l.asin};k=function(){return l.componentsAvailable};f=function(){return l.componentsPending};m();return{isBundle:h,getBundleASIN:d,hasComponentsAvailable:k,hasComponentsPending:f,loadBundleComponents:p,refresh:m}});"use strict";f.when("A","bundle-constants","bundle-logger","bundle-state","ready").register("bundle-pricing",function(b,a,t,g){var c=b.$,e=!1,h="",d=0,k,f,l,p,m,v,w,r,n;b.on(a.BUNDLE_PRICING_AJAX_TRIGGER_EVENT,
function(){k(!1)});k=function(a){if(a||p())a={asin:g.getBundleASIN()},a.asin?l(a):(t.logWarning("Unable to find bundle asin, will retry","bundlePricingAjax"),f(!1))};l=function(a){b.get("/gp/product/ajax-handlers/get-bundle-pricing.html",{params:a,accepts:"text/html",timeout:2E3,success:m,failure:function(a,b,q){t.logWarning("Error in getBundlePricing, retrying.");f(!0,b,q)}})};f=function(a,c,e){3>d?(d+=1,b.delay(function(){k(!0)},200)):a&&t.logFatal(c,"bundlePricingAjax",e)};p=function(){var a=!e;
a||h===g.getBundleASIN()?(e=!0,h=g.getBundleASIN()):(a=!0,h=g.getBundleASIN(),d=0);return a};m=function(a){b.objectIsEmpty(a)||(w(a),n(a),r(a),v(a))};v=function(b){b[a.BUNDLE_LISTING_WIDGET_V2_PRIME_ELIGIBLE]&&c(a.BUNDLE_PRICEBLOCK_PRIME_ELIGIBLE).removeClass("aok-hidden")};w=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS],h=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS_LABEL],g=e[a.BUNDLE_LISTING_WIDGET_V2_YOU_SAVE],m=e[a.BUNDLE_LISTING_WIDGET_V2_YOU_SAVE_LABEL];e=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS_NO_YOU_SAVE_LABEL];
b.objectIsEmpty(d)||b.objectIsEmpty(h)||b.objectIsEmpty(g)||b.objectIsEmpty(m)?b.objectIsEmpty(d)||b.objectIsEmpty(h)||b.objectIsEmpty(m)?b.objectIsEmpty(g)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_PRICE).html(g.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_COLUMN).removeClass("aok-hidden")):(c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_LABEL).html(m.trim()),
c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(h.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_COLUMN).removeClass("aok-hidden")):(c(a.BUNDLE_PRICEBLOCK_SAVINGS_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_LABEL).html(m.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_PRICE).html(g.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(h.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_SAVINGS_YOU_SAVE_COLUMN).removeClass("aok-hidden"))};
r=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH];e=e[a.BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH_LABEL];b.objectIsEmpty(d)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_ROW).removeClass("aok-hidden"))};n=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_DEAL];e=e[a.BUNDLE_LISTING_WIDGET_V2_DEAL_LABEL];b.objectIsEmpty(d)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_DEAL_PRICE).html(d.trim()),
c(a.BUNDLE_PRICEBLOCK_DEAL_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_DEAL_ROW).removeClass("aok-hidden"))};return{parsePricingData:m,_retryCount:function(){return d}}});"use strict";f.when("A","ready").register("bundle-state",function(b){var a=b.$,f={bundleState:"#bundle-state"};return{elements:f,getBundleASIN:function(){var b=a(f.bundleState);if(b.length)return b.data("asin")}}});"use strict";f.when("A").register("bundle-logger",function(b){b=n.ue||!1;var a=b.count||!1,f=b.log||!1,g=n.ueLogError||
!1,c=function(a,b,c,k){"INFO"!==b&&g?(null!==k&&"object"===typeof k?k.message="["+a+"] "+k.message:k={message:"["+a+"]"},g(k,{logLevel:b,attribution:c,message:a})):"INFO"===b&&f&&f(a,c)};return{logCount:function(b,c){if(a)return a(b,c),a(b)},logInfo:function(a,b){c(a,"INFO",b,null)},logWarning:function(a,b,d){c(a,"WARN",b,d)},logError:function(a,b,d){c(a,"ERROR",b,d)},logFatal:function(a,b,d){c(a,"FATAL",b,d)}}});"use strict";f.when("A","ready").register("bundle-constants",function(){return{STRIKE_THROUGH_PRICE:"#bundle_strikethrough_price",
BUNDLE_PRICE:"#bundle_price",YOU_SAVE:"#bundle_you_save",BUNDLE_DEAL_PRICE:"#bundle_deal_price",TOTAL_BOUGHT_SEPARATELY:"#bundle_total_bought_separately",BUNDLE_PRICEBLOCK_DEAL_PRICE:"#priceblock-bundle-deal-price",BUNDLE_PRICEBLOCK_DEAL_LABEL:"#priceblock-bundle-deal-label",BUNDLE_PRICEBLOCK_DEAL_ROW:"#priceblock-bundle-deal-row",BUNDLE_PRICEBLOCK_SAVINGS_PRICE:"#priceblock-bundle-savings-price",BUNDLE_PRICEBLOCK_SAVINGS_ROW:"#priceblock-bundle-savings-row",BUNDLE_PRICEBLOCK_SAVINGS_LABEL:"#priceblock-bundle-savings-label",
BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL:"#bundle-v2-savings-atf-you-save-label",BUNDLE_PRICEBLOCK_YOU_SAVE_PRICE:"#priceblock-bundle-you-save-price",BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_PRICE:"#bundle-v2-savings-no-you-save-atf",BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_LABEL:"#bundle-v2-savings-no-you-save-label-atf",BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE:"#bundle-v2-price-strikethrough-atf",BUNDLE_PRICEBLOCK_STRIKETHROUGH_ROW:"#bundle-priceblock-strikethrough-row",BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE_LABEL:"#bundle-v2-price-strikethrough-atf-label",
BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_COLUMN:"#bundle-v2-savings-no-you-save-atf-column",BUNDLE_PRICEBLOCK_SAVINGS_YOU_SAVE_COLUMN:"#bundle-v2-you-save-atf-column",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_COLUMN:"#bundle-v2-you-save-no-savings-atf-column",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_LABEL:"#bundle-v2-you-save-no-savings-atf-label",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_PRICE:"#bundle-v2-you-save-no-savings-atf-price",BUNDLE_PRICEBLOCK_LESS_THAN_BUYING_SEPERATELY_PRICE:"#priceblock-bundle-less-than-buying-seperately-price",
BUNDLE_PRICEBLOCK_PRIME_ELIGIBLE:"#bundle-v2-atf-prime-logo",BUNDLE_TWISTER_PLUS_FEATURE:"#bundles-twister-plus",BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH:"bundle-listing-v2-strikethrough",BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH_LABEL:"bundle-listing-v2-strikethrough-label",BUNDLE_LISTING_WIDGET_V2_SAVINGS:"bundle-listing-v2-savings",BUNDLE_LISTING_WIDGET_V2_YOU_SAVE:"bundle-listing-v2-you-save",BUNDLE_LISTING_WIDGET_V2_YOU_SAVE_LABEL:"bundle-listing-v2-you-save-label",BUNDLE_LISTING_WIDGET_V2_DEAL:"bundle-listing-v2-deal",
BUNDLE_LISTING_WIDGET_V2_DEAL_LABEL:"bundle-listing-v2-deal-label",BUNDLE_LISTING_WIDGET_V2_SAVINGS_LABEL:"bundle-listing-v2-savings-label",BUNDLE_LISTING_WIDGET_V2_SAVINGS_NO_YOU_SAVE_LABEL:"bundle-listing-v2-you-save-no-savings-label",BUNDLE_LISTING_WIDGET_V2_PRIME_ELIGIBLE:"bundle-listing-v2-prime-eligible",BUNDLE_LISTING_V2_READY_EVENT:"bundle-listing-V2:widget:ready",BUNDLE_LISTING_BOTTOM_SHEET_READY_EVENT:"bundle-listing:sheet:ready",BUNDLE_PRICING_AJAX_TRIGGER_EVENT:"bundle-pricing-ajax-trigger-event"}});
"use strict";f.when("A","ready").execute(function(b){var a=b.$,f=2,g,c,e=!1,h,d=!1,k,n=function(){return b.interval(function(){b.onScreen("#customizable-secondary-view")&&!d&&c();d&&clearInterval(k)},500)};k=n();var l=function(c){e=!0;f=2;var d=a("#customizable_bundle_state"),g=a(c);c=a(g).find("#customizable-add-to-cart-token");d.length&&c.length&&(d=d.data("tiers"),b.each(d,function(b,c){c=a(g).find("#customizable-tier-ajax-"+b);a("#asin-faceouts-tier-"+b).html(c.html())}),b.trigger("customizable-faceouts-loaded",
c))},p=function(c){var d=a("#customizable_bundle_state").data("tiers");b.each(d,function(b,d){d=a("#asin-faceouts-tier-"+b);b=d.find(".a-spinner-wrapper");d=d.find("p");c?(b.addClass("aok-hidden"),d.removeClass("aok-hidden")):(b.removeClass("aok-hidden"),d.addClass("aok-hidden"))})};c=function(){d=!0;var c=a("#customizable_bundle_state").attr("data-asin");e&&c===h||(e=!1,h=c,p(!1),b.get("/gp/product/ajax-handlers/get-product-grouping-tiers.html",{params:{asin:c},accepts:"text/html",timeout:4E3,success:l,
failure:g}))};g=function(a,d,e){0>=f?(b.trigger("customizable-faceouts-not-loaded"),p(!0)):(f--,c())};b.on("a:popover:beforeShow:customizable_bundle_secondary_view",c);b.on("a:popover:afterHide:customizable_bundle_secondary_view",function(){d=!1;f=2;k=n()})});"use strict";f.when("jQuery").register("list-of-bundles",function(b){var a=b("#pba-lob-carousel-container");a.length&&(a.removeClass("a-carousel-static"),f.when("a-carousel-framework","dp-time-to-interactive").execute(function(b,f){f.getClickToCIPromise().then(function(){a.addClass("a-carousel-static");
b.createAll()})}))})});
/* ******** */
(function(f){var n=window.AmazonUIPageJS||window.P,t=n._namespace||n.attributeErrors,b=t?t("SmartHomeDPAssets",""):n;b.guardFatal?b.guardFatal(f)(b,window):b.execute(function(){f(b,window)})})(function(f,n,t){f.when("A","sh-accounting","ready").register("sh-badge-utils",function(b,C){var p=b.$;return{injectUniversalAddToCartParams:function(b,k){var h=p(k);h.empty();b.forEach(function(b,d){p("\x3cinput\x3e").attr({type:"hidden",name:"ASIN."+d,value:b.asin}).appendTo(h);p("\x3cinput\x3e").attr({type:"hidden",
name:"offerListingID."+d,value:b.offerListingId}).appendTo(h)})},updatePrice:function(b,k,h,f,d){h=C.formatNumber(h,"JPY"===f?"0":"2",","===d?".":",",d);k=k.replace(/([0.,]*[0][0.,]*)/,h);p(b).html(k)}}});f.register("sh-accounting",function(){function b(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function f(a){return y?y(a):"[object Array]"===z.call(a)}function p(a){return a&&"[object Object]"===z.call(a)}function n(a,c){var l;a=a||{};c=c||{};for(l in c)c.hasOwnProperty(l)&&null==a[l]&&(a[l]=c[l]);
return a}function k(a,c,l){var d=[],b,f;if(!a)return d;if(A&&a.map===A)return a.map(c,l);b=0;for(f=a.length;b<f;b++)d[b]=c.call(l,a[b],b,a);return d}function h(a,c){a=Math.round(Math.abs(a));return isNaN(a)?c:a}function t(a){var c=d.settings.currency.format;"function"===typeof a&&(a=a());return b(a)&&a.match("%v")?{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}:a&&a.pos&&a.pos.match("%v")?a:b(c)?d.settings.currency.format={pos:c,neg:c.replace("%v","-%v"),zero:c}:c}var d={version:"0.4.1",
settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},A=Array.prototype.map,y=Array.isArray,z=Object.prototype.toString,w=d.unformat=d.parse=function(a,c){if(f(a))return k(a,function(a){return w(a,c)});a=a||0;if("number"===typeof a)return a;c=c||d.settings.number.decimal;var b=new RegExp("[^0-9-"+c+"]",["g"]),b=parseFloat((""+a).replace(/\((.*)\)/,"-$1").replace(b,"").replace(c,"."));return isNaN(b)?
0:b},B=d.toFixed=function(a,c){c=h(c,d.settings.number.precision);var b=Math.pow(10,c);return(Math.round(d.unformat(a)*b)/b).toFixed(c)},x=d.formatNumber=d.format=function(a,c,b,r){if(f(a))return k(a,function(a){return x(a,c,b,r)});a=w(a);var m=n(p(c)?c:{precision:c,thousand:b,decimal:r},d.settings.number),q=h(m.precision),e=0>a?"-":"",g=parseInt(B(Math.abs(a||0),q),10)+"",v=3<g.length?g.length%3:0;return e+(v?g.substr(0,v)+m.thousand:"")+g.substr(v).replace(/(\d{3})(?=\d)/g,"$1"+m.thousand)+(q?m.decimal+
B(Math.abs(a),q).split(".")[1]:"")},D=d.formatMoney=function(a,c,b,r,m,q){if(f(a))return k(a,function(a){return D(a,c,b,r,m,q)});a=w(a);var e=n(p(c)?c:{symbol:c,precision:b,thousand:r,decimal:m,format:q},d.settings.currency),g=t(e.format);return(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",e.symbol).replace("%v",x(Math.abs(a),h(e.precision),e.thousand,e.decimal))};d.formatColumn=function(a,c,l,r,m,q){if(!a)return[];var e=n(p(c)?c:{symbol:c,precision:l,thousand:r,decimal:m,format:q},d.settings.currency),
g=t(e.format),v=g.pos.indexOf("%s")<g.pos.indexOf("%v")?!0:!1,u=0;a=k(a,function(a,c){if(f(a))return d.formatColumn(a,e);a=w(a);var b=(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",e.symbol).replace("%v",x(Math.abs(a),h(e.precision),e.thousand,e.decimal));b.length>u&&(u=b.length);return b});return k(a,function(a,c){return b(a)&&a.length<u?v?a.replace(e.symbol,e.symbol+Array(u-a.length+1).join(" ")):Array(u-a.length+1).join(" ")+a:a})};return d})});
/* ******** */
(function(g){var d=window.AmazonUIPageJS||window.P,r=d._namespace||d.attributeErrors,a=r?r("FreshDetailPageCommonAssets",""):d;a.guardFatal?a.guardFatal(g)(a,window):a.execute(function(){g(a,window)})})(function(g,d,r){g.when("A","jQuery","a-modal","afx-dp-uatc-proxy","afx-update-cart-count","a-dropdown","fresh-dp-double-click","afx-dp-csm-metrics-utils","fresh-show-atc-changeover","fresh-dp-quantity","afx-utils","ready").register("fresh-atc-handler",function(a,f,n,c,d,q,m,b,h,u,e){var p;g.when("EWC").execute(function(b){p=
b});g.when("nav.getFlyout").execute(function(b){b("ewc")});var F={"itemPrice:priceUnavailable:1":"PRICE_UNAVAILABLE","itemDeleted:itemCountOverflow:6":"QUANTITY_OVERFLOW"};return{addToFreshCart:function(q){function l(b,a,f,e){w(b);q.error(b,a,f,e)}function w(e,c){c=c||{};var d=e.data.sessionID;c.title=D(e.data.title);c.asin=e.data.asin;c.offerListingID=e.data.offerListingID;c.sessionID=d;switch(c.reasonCode?c.reasonCode:r){case t.itemNotAvailable:b.increment(k.freshUATCItemNotAvailableErrorCountMetric);
break;case t.itemPartiallyAvailable:b.increment(k.freshUATCItemPartiallyAvailableErrorCountMetric);break;case t.itemPartiallyAvailableForReservation:b.increment(k.freshUATCItemPartiallyAvailableForReservationErrorCountMetric);break;case t.itemNotAvailableForReservation:b.increment(k.freshUATCItemNotAvailableForReservationErrorCountMetric);break;case t.itemPriceUnavailable:b.increment(k.freshUATCItemPriceUnavailableErrorCountMetric);break;case t.itemCountOverflow:b.increment(k.freshUATCItemCountOverflowErrorCountMetric);
break;default:b.increment(k.freshUATCEmptyItemStatusCodeErrorCountMetric),g.log("fresh-atc-handler: No error status code.","ERROR")}c=f.param(c);n.create(e.$currentTarget,{name:"fresh-add-to-cart-modal",sessionID:d,url:"/afx/cart/reservation_conflict?"+c}).show();a.on("a:popover:afterHide:fresh-add-to-cart-modal",function(b){E(d);n.remove(b.popover)})}function D(b){var a={"\x26amp;":"\x26"},e;for(e in a)a.hasOwnProperty(e)&&(b=b.replace(e,a[e]));return b}function C(b){return b.filter(function(b){return b.statusKey in
F})}function x(b,a,e){e+=" returned by UATC is not an array";g.log(e,"Error",a);l(b,"","",e)}function y(e,f,d){d||(d=function(){});try{var n=e.data.asin;if(n)if(e.data.title){var h=e.data.offerListingID;if(h){var q=e.data.sessionID;if(q){var m=u.val();m||(g.log('fresh-atc-handler: "quantity" action parameter is missing.',"ERROR"),m=1);b.setWidgetClickTimestamp(k.freshUATCTCallScope);c({asin:n,offerListingID:h,sessionID:q,quantity:m,reftag:"afx-dp-addtocart",success:function(c){try{b.sendWidgetMetrics(k.freshUATCTCallScope);
var n;if(c&&c.isOK){var h=c.extraErrorInfos;if(h&&h.constructor===Array&&0<h.length)n=!0;else{var u=c.statusList,z;if(u&&u.constructor===Array&&0<u.length){var A=C(u);z=A&&0<A.length}else z=!1;n=z?!0:!1}}else n=!0;if(n)if(b.increment(k.freshUATCInvalidErrorResponseCountMetric),c)if(c.isOK){var t=c.extraErrorInfos,p=c.statusList;if(t&&t.constructor!==Array)x(e,t,"extraErrorInfos");else if(0<t.length){if(t&&!(0>=t.length)){var v=t[0];"ADDRESS_NOT_SELECTED"===v.statusCode?(b.increment(k.freshUATCAddressNotSelectedErrorCountMetric),
g.log("fresh-atc-handler: Address is not selected.","INFO")):w(e,{reasonCode:v.itemStatusCode,quantityAdded:v.availableQuantity,quantityRequested:v.requestedQuantity})}}else if(p&&p.constructor!==Array)x(e,p,"statusList");else if(0<p.length&&p&&!(0>=p.length)){var r=C(p);r&&0<r.length&&w(e,{reasonCode:F[r[0].statusKey]})}}else b.increment(k.freshUATCFailureCountMetric),l(e,"","","isOK returned by UATC is false");else b.increment(k.freshUATCFailureCountMetric),l(e,"","","No response from UATC");else b.increment(k.freshUATCSuccessCountMetric),
f(c,q,m)}catch(y){b.increment(k.freshAddToCartExceptionCountMetric),g.log("fresh-atc-handler exception: "+y,"ERROR")}finally{a.delay(d,B.reEnableDelay)}},error:function(c,f,n){try{b.sendWidgetMetrics(k.freshUATCTCallScope),b.increment(k.freshUATCFailureCountMetric),l(e,c,f,n)}catch(h){b.increment(k.freshAddToCartExceptionCountMetric),g.log("fresh-atc-handler exception: "+h,"ERROR")}finally{a.delay(d,B.reEnableDelay)}}})}else g.log('fresh-atc-handler: Required "sessionID" action parameter is missing.',
"ERROR"),b.increment(k.freshAddToCartMissingParameterCountMetric),l(e)}else g.log('fresh-atc-handler: Required "offerListingID" action parameter is missing.',"ERROR"),b.increment(k.freshAddToCartMissingParameterCountMetric),l(e)}else g.log('fresh-atc-handler: Required "title" action parameter is missing.',"ERROR"),b.increment(k.freshAddToCartMissingParameterCountMetric),l(e);else g.log('fresh-atc-handler: Required "asin" action parameter is missing.',"ERROR"),b.increment(k.freshAddToCartMissingParameterCountMetric),
l(e)}catch(z){b.increment(k.freshAddToCartExceptionCountMetric),g.log("fresh-atc-handler exception: "+z,"ERROR"),a.delay(d,B.reEnableDelay)}}function E(b){p&&"function"===typeof p.refresh?p.refresh():d(b)}var B={reEnableDelay:1E3},k={freshAddToCartClickCountMetric:"freshAddToCartClickCount",freshAddToCartMissingParameterCountMetric:"freshAddToCartMissingParameterCount",freshAddToCartExceptionCountMetric:"freshAddToCartExceptionCount",freshUATCTCallScope:"freshUATCCall",freshUATCSuccessCountMetric:"freshUATCSuccessCount",
freshUATCFailureCountMetric:"freshUATCFailureCount",freshUATCInvalidErrorResponseCountMetric:"freshUATCInvalidErrorResponseCount",freshUATCAddressNotSelectedErrorCountMetric:"freshUATCAddressNotSelectedErrorCount",freshUATCItemPartiallyAvailableErrorCountMetric:"freshUATCItemPartiallyAvailableErrorCount",freshUATCItemPartiallyAvailableForReservationErrorCountMetric:"freshUATCItemPartiallyAvailableForReservationErrorCount",freshUATCItemNotAvailableErrorCountMetric:"freshUATCItemNotAvailableErrorCount",
freshUATCItemNotAvailableForReservationErrorCountMetric:"freshUATCItemNotAvailableForReservationErrorCount",freshUATCEmptyItemStatusCodeErrorCountMetric:"freshUATCEmptyItemStatusCodeErrorCount",freshUATCItemPriceUnavailableErrorCountMetric:"freshUATCItemPriceUnavailableErrorCount",freshUATCItemCountOverflowErrorCountMetric:"freshUATCItemCountOverflowErrorCount"},t={itemNotAvailable:"ITEM_NOT_AVAILABLE",itemPartiallyAvailable:"ITEM_PARTIALLY_AVAILABLE",itemPartiallyAvailableForReservation:"ITEM_PARTIALLY_AVAILABLE_FOR_RESERVATION",
itemNotAvailableForReservation:"ITEM_NOT_AVAILABLE_FOR_RESERVATION",itemPriceUnavailable:"PRICE_UNAVAILABLE",itemCountOverflow:"QUANTITY_OVERFLOW"},z=function(b,e,a){h(a);E(e);q.success(b)};a.declarative("fresh-atc-handler","click",m(function(a,c){u.valid()?(e.vibrate(),b.increment(k.freshAddToCartClickCountMetric),y(a,z,c)):c()}))}}});"use strict";g.when("A","jQuery","a-button","fresh-show-atl-changeover","ready").register("FreshAddToShoppingList",function(a,f,d,c){function A(b){f("#"+b.asin+"-afx-atl-dropdown").change(function(a){b.$alreadyInMessage.addClass("aok-hidden");
b.$errorMessage.addClass("aok-hidden")})}function q(b){var f=(a.state("baseWidgetState")||{}).csrfToken;a.post("/afx/lists/json/shoppinglists/additem",{cache:!1,timeout:5E3,params:{asin:b.asin,listID:b.shoppingListID,token:f},success:function(a){b.addButtonInstance.enable();a.successful?(b.$modalParent.find("#"+b.cancelButtonID).click(),c()):1===a.errorCodes[0]?b.$alreadyInMessage.removeClass("aok-hidden"):m(b)},error:function(){b.addButtonInstance.enable();m(b)}})}function m(b){b.$errorMessage.removeClass("aok-hidden");
g.log("Failed to add asin "+b.asin+" to shopping list "+b.shoppingListID,"ERROR")}a.declarative("add-to-list","click",function(b){var a=b.$currentTarget.closest(".a-popover-wrapper");if(1>a.length)g.log("Could not find the element that parents this modal (it should contain class a-popover wrapper)","FATAL");else{var c=a.find("#"+b.data.addButtonID),e;1>c.length?(g.log("Could not find the button that will add the item. This is required for preventing double clicks","ERROR"),e=!1):b.data.asin?e=!0:
(g.log("ASIN was blank. Please supply the ASIN you wish to add to the list.","ERROR"),e=!1);e&&(c=d(c),c.isEnabled()&&(c.disable(),b={asin:b.data.asin,addButtonInstance:c,$modalParent:a,cancelButtonID:b.data.cancelButtonID,shoppingListID:a.find("#"+b.data.asin+"-afx-atl-dropdown").val(),$alreadyInMessage:a.find("#afx-atl-already-in"),$errorMessage:a.find("#afx-atl-service-error")},b.$alreadyInMessage.addClass("aok-hidden"),b.$errorMessage.addClass("aok-hidden"),A(b),q(b)))}})});"use strict";g.when("A",
"jQuery","fresh-add-to-cart","fresh-dp-quantity","fresh-show-atc-changeover").execute(function(a,f,d,c,A){d.addToFreshCart({success:function(a,c){A(a.data.renderableSellingQuantity?a.data.renderableSellingQuantity:a.data.quantity);a=c.couponClipStatus;if("CLIP_SUCCESSFUL"===a||"ALREADY_CLIPPED"===a)f("#unclippedCoupon").hide(),f("#clippedCoupon").show()},error:function(a,c,b,f){}});c.init();a.on("a:pageUpdate",function(){c.init();d.updateQuantity("freshAddToCartButton",c.val())});d.updateQuantity("freshAddToCartButton",
c.val());a.declarative("freshDetailPageQuantityUpdate","change",function(a){d.updateQuantity("freshAddToCartButton",c.val())});g.when("fresh-atfc-hook").execute(function(a){a.callback()})});g.when("A","jQuery","a-dropdown","fresh-dp-constants","fresh-add-to-cart","a-button").register("fresh-dp-quantity",function(a,f,d,c,g,q){return function(){var m,b,h,u,e,p,r,v,l,w,D,C,x,y=function(){if(!m){b=f(c.addToCartButtonSelector);e=d.getSelect(c.dropdownID);if(h=!!e){u=f(c.dropdownDivSelector);var a=e.getOptions().size();
a&&(r=a-1)}v=f(c.freeTextDivSelector);if(p=0!==v.length)l=f(c.freeTextInputSelector),w=f(c.freeTextErrorDivsSelector),D=f(c.freeTextErrorMsgMin),C=f(c.freeTextErrorMsgMax)}},E=function(){a.on(c.dropdownSelectedID,function(a){f(a.nativeItemNode).index()===r?(l.attr("validValue",x),l.val(x),v.show(),w.hide(),u.hide(),l.focus().select(),e.val("1")):x=e.val()});var d=function(){var a=l.attr("validValue");a&&(e.val(a),e.val()===a?(x=a,u.show(),v.hide()):(g.updateQuantity("freshAddToCartButton",a),b.focus()))},
n=function(){var a=B(l.val());l.attr("validValue",a?a:"")};l.change(n);l.keyup(n);l.keypress(function(a){if(0===a.which||8===a.which||a.ctrlKey||a.altKey||c.rxNumbersOnly.test(String.fromCharCode(a.which)))return!0;13===a.which&&(d(),b.click());return!1});l.blur(d)},B=function(){var a;a:{a=l.val();if(c.rxNumbersOnly.test(a)&&(a=parseInt(a,10),!isNaN(a)))break a;a=!1}w.hide();var b=q(c.addToCartButtonSelector);if(!1===a||0>=a)D.show(),b.isEnabled()&&b.disable();else if(1E3<=a)C.show();else return b.isEnabled()||
b.enable(),String(a);return!1};return{init:function(){m=!1;y();m=!0;if(p){v.hide().removeClass(c.auiHiddenClass);w.hide().removeClass(c.auiHiddenClass);var a=e.getOption(r),b=a.info()[0].text;a.update({value:"0",text:f.trim(b)+"+"});x=e.val();E()}},valid:function(){y();return p&&v.is(":visible")?!1!==B():!0},val:function(){y();return p&&v.is(":visible")?l.attr("validValue"):h?e.val():1}}}()});g.register("fresh-dp-constants",function(){return{actionPanelStateData:"apstate",actionPanelFreshState:"fresh",
mobileNavSearchFormSelector:'#nav-search-form, form[role\x3d"search"], #searchForm',rxNumbersOnly:/^\d+$/,auiHiddenClass:"aok-hidden",addToCartButtonSelector:"#freshAddToCartButton",dropdownID:"freshQuantity",dropdownSelectedID:"a:dropdown:selected:freshQuantity",dropdownDivSelector:"#quantitySelect",freeTextDivSelector:"#quantityText",freeTextInputSelector:"#quantityTextInput",freeTextErrorDivsSelector:"#quantityTextErrors \x3e div",freeTextErrorMsgMin:"#quantityFreeTextErrorMsgMin",freeTextErrorMsgMax:"#quantityFreeTextErrorMsgMax"}});
g.when("A","afx-dp-csm-metrics-utils","ready").execute(function(a,f){a.on("a:expander:ingredients-expander:toggle:expand",function(a){f.increment("almIngredientsExpand")});a.on("a:expander:ingredients-expander:toggle:collapse",function(a){f.increment("almIngredientsCollapse")})});g.when("A","ready").register("fresh-dp-prevent-atc-default",function(a){return{init:function(){a.$("#addToFreshCart").submit(function(a){a.preventDefault()})}}});"use strict";g.when("A","jQuery","a-button","ready").register("fresh-multiselleroffers-pagination-handler",
function(a,f,d){function c(a){var e=parseInt(m.attr("data-currentPage"),10),c=parseInt(m.attr("data-pageCount"),10),e="next"===a?e+1:e-1;m.attr("data-currentPage",e);0===e?b.disable():b.enable();e===c-1?h.disable():h.enable();f(".freshMultiSellerOffer").addClass("hidden");f('.freshMultiSellerOffer[data-page\x3d"'+e+'"]').removeClass("hidden")}var g=f("#freshMultiSellerOffersPreviousPage"),q=f("#freshMultiSellerOffersNextPage"),m=f("#freshMultiSellerOffersPagination"),b=d(g),h=d(q);a.declarative.create(g,
"fresh-multiselleroffers-previous-page",{});a.declarative.create(q,"fresh-multiselleroffers-next-page",{});a.declarative("fresh-multiselleroffers-previous-page","click",function(a){b.isEnabled()&&c("previous")});a.declarative("fresh-multiselleroffers-next-page","click",function(a){h.isEnabled()&&c("next")})});"use strict";g.when("A").register("afx-dp-uatc-proxy",function(a){return function(f){var d="/gp/add-to-cart/json";f.reftag!==r&&(d+="/ref\x3d"+f.reftag);a.post(d,{timeout:5E3,params:{"session-id":f.sessionID,
clientName:"SharedFreshHandler",nextPage:"cartitems",ASIN:f.asin,offerListingID:f.offerListingID,useUber:"1",source:"Fresh",ruleSet:"FreshGet",quantity:f.quantity},success:f.success,error:f.error})}});"use strict";g.when("A").register("afx-dp-get-cart-count",function(a){return function(f){a.get("/gp/api/cart/1.0/get-cart-count.json",{timeout:5E3,params:{sessionID:f.sessionID,clientName:"sharedFreshHandler"},success:f.success,error:f.error})}});"use strict";g.when("A").register("afx-dp-get-cart-item-count",
function(a){return function(a,d){if(d&&d.items){var c;for(c=0;c<d.items.length;++c){var g=d.items[c];if(g&&g.ASIN===a)return g.quantity}}}});"use strict";g.register("afx-dp-csm-metrics-utils",function(){return{setWidgetClickTimestamp:function(a){d.ue&&d.uet&&a&&d.uet("bb",a,{wb:1})},setWidgetTimestamp:function(a,f){d.ue&&d.uet&&a&&f&&d.uet(a,f,{wb:1})},increment:function(a){d.ue&&d.ue.count&&a&&d.ue.count(a,(d.ue.count(a)||0)+1)},setCount:function(a,f){d.ue&&d.ue.count&&a&&f&&d.ue.count(a,f)},sendWidgetMetrics:function(a){d.ue&&
d.uex&&a&&d.uex("ld",a,{wb:1})}}});"use strict";g.when("A","jQuery","a-button","ready").register("fresh-dp-double-click",function(a,d,g){return function(c){var d={disabled:"true"},f={};return function(g){var b=a.state("fresh-atc-status");b&&b.disabled||(b&&a.state("fresh-atc-status",d),c(g,function(){(b=a.state("fresh-atc-status"))&&a.state.replace("fresh-atc-status",f)}))}}});"use strict";g.register("afx-utils",function(){return{isFunction:function(a){return"function"===typeof a},isDefined:function(a){return"undefined"!==
typeof a},vibrate:function(){return d.amazon&&d.amazon.cordova&&d.amazon.cordova.notification&&d.amazon.cordova.notification.vibrate&&d.amazon.cordova.notification.vibrate(50)}}});"use strict";g.when("A","jQuery","fresh-show-atl-changeover","afx-dp-csm-metrics-utils","ready").register("FreshAddToAlexaLists",function(a,f,n,c){function r(a){c.increment(h.countAddToAlexaList);c.setWidgetClickTimestamp(h.addToAlexaListCallTime);q(a);f.ajax({url:a.data.url,type:"POST",contentType:"application/json",Accept:"application/json",
timeout:5E3,dataType:"json",data:JSON.stringify({value:b(a)}),headers:{"x-amzn-as-metadata":"{}"},success:function(b){c.sendWidgetMetrics(h.addToAlexaListCallTime);c.increment(h.addToAlexaListCallSuccess);n();m(a)},error:function(b,f,n){c.sendWidgetMetrics(h.addToAlexaListCallTime);c.increment(h.addToAlexaListCallFail);g.log("Error response: "+b.responseText,"ERROR");b.status===u?a&&a.data&&a.data.signInURL&&(d.location=a.data.signInURL):g.log("Failed to add item to shopping list "+a.data.title+", url : "+
a.data.url,"ERROR");m(a)}})}function q(a){a.$currentTarget.find(".afx-dp-add-to-alexa-list-link").addClass("aok-hidden");a.$currentTarget.siblings(".afx-dp-add-to-alexa-list-spinner").removeClass("aok-hidden")}function m(a){a.$currentTarget.siblings(".afx-dp-add-to-alexa-list-spinner").addClass("aok-hidden");a.$currentTarget.find(".afx-dp-add-to-alexa-list-link").removeClass("aok-hidden")}function b(a){a=a.data.title;return a.substring(0,Math.max(a.length,256))}a.declarative("add-to-alexa-lists",
"click",function(a){m(a);r(a)});var h={countAddToAlexaList:"countAddToAlexaList",addToAlexaListCallTime:"addToAlexaListCallTime",addToAlexaListCallSuccess:"addToAlexaListCallSuccess",addToAlexaListCallFail:"addToAlexaListCallFail"},u=401})});
/* ******** */
(function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("DetailPageVoltageComplianceAssets",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){});
/* ******** */
(function(b){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,a=d?d("DetailPageInteractiveBadgesAssets",""):c;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,c,d){b.when().register("interactive-badges-treatment",function(){return"C"})});
/* ******** */
(function(f){var k=window.AmazonUIPageJS||window.P,n=k._namespace||k.attributeErrors,b=n?n("ProductAdsDetailPageAssets",""):k;b.guardFatal?b.guardFatal(f)(b,window):b.execute(function(){f(b,window)})})(function(f,k,n){f.when("A","a-carousel-framework","a-carousel-ajax-standard").register("AmazonClicks",function(b,f,k){function q(a,b,g){var m=a.getAttr("pageNumber"),c;c=a.getAttr("initialSeenAsins");for(var e=a.getAttr("fetchedItems").slice(c.length),d=0;d<e.length;d++)e[d]&&e[d].oid&&c.push(e[d].oid);
c=JSON.stringify(c);g.pg=m;g.tot=a.getAttr("set_size");g.start=g.offset;g.num=g.count;g.cc=1===m?0:g.offset;g.oData=c;k.getItems(a,b,g)}function c(a,r){Array.isArray(a)&&b.each(a,function(a){e[a]=r})}function t(a){b.each(e,function(b,g){b===a&&delete e[g]})}var d={},e={},h={},a={},p=[],l=b.extend([],k),u=function(a,b,g){return function(){a.apply(b,g)}};l.init=function(a){var c=a.getAttr("ajax");if(c&&c.params){var g=c.params;if((c=a.getAttr("fetchedItems"))&&c.length!==g.start){var m=0;c.forEach(function(a){a&&
m++});var d=[];a.dom.$carousel.children("li").each(function(a,c){if(a>=g.start)return!1;d.push(b.trim(c.innerHTML))});m!==d.length&&(g.offset=d.length,a.setAttr("fetchedItems",d))}}k.init(a)};l.getItems=function(c,d,g){var m=!1,e=c.getAttr("name");b.each(a,function(a,b){b!==e&&(m=m||a)});c=u(q,this,[c,d,g]);(d=h[e]!==n)&&m?p.push(c):(d&&(a[e]=!0),c())};f.registerStrategy("ajax","clicksCustomAjax",l);return{registerFeedbackEvents:function(a,c,d,e,p){var f=!0,h=function(){b.$("#"+c).text(e);f=!1;b.$("."+
p).each(function(){b.$(this).show()})},l=function(){b.$("#"+c).text(d);f=!0;b.$("."+p).each(function(){b.$(this).hide()})};b.$("#"+c).click(function(){f?h():l()});b.on("a:carousel:"+a+":change:pageNumber",l);l()},registerFeedbackEventsWithSponsoredLabel:function(a,c,d,e){var f=!0,p=function(){b.$("#"+d).show();f=!1;b.$("."+e).each(function(){b.$(this).show()})},l=function(){b.$("#"+d).hide();f=!0;b.$("."+e).each(function(){b.$(this).hide()})};b.$("#"+c).click(function(){f?p():l()});b.on("a:carousel:"+
a+":change:pageNumber",l);l()},truncateTitles:function(a){b.$("."+a).each(function(){var c=b.$(this);if("hidden"===c.css("overflow")){var d=c.html(),e=b.$(this.cloneNode(!0)).hide().css("position","absolute").css("overflow","visible").width(c.width()).height("auto");c.after(e);for(e.html(d);0<d.length&&e.height()>c.height();)d=d.substr(0,d.length-1),e.html(d+"\x26#133;");c.html(e.html()).height("auto").removeClass(a);e.remove()}})},preventSpinners:function(a,c){d[a]===n&&(b.on("a:carousel:"+a+":ajaxSuccess",
function(a){b.delay(function(){var d=b.$("#"+c+" li.a-carousel-card-empty");0<d.length&&(a.carousel.setAttr("set_size",d[0].getAttribute("aria-posinset")-1),d.removeClass("a-carousel-card-empty"))},200)}),d[a]="defined")},registerCarouselToSaveAsins:function(d,e,f){t(d);c(f,d);a[d]=!1;h[d]===n&&(b.on("a:carousel:"+d+":ajaxSuccess",function(e){var f=e.carousel.getAttr("fetchedItems").slice(-1*e.params.count),g=[];b.each(f,function(a){g.push(a.oid)});c(g,d);a[e.carousel.getAttr("name")]=!1;0<p.length&&
p.shift()()}),h[d]=e)}}});(function(b,k,n){function q(){return b.P&&b.P.AUI_BUILD_DATE}q()?(f.when("jQuery").register("sponsored-products-truncator-jQuery",function(c){return c}),f.when("ready").register("sponsored-products-truncator-ready",function(){})):b.amznJQ&&(b.amznJQ.available("jQuery",function(){f.register("sponsored-products-truncator-jQuery",function(){return b.amznJQ.jQuery})}),b.amznJQ.onReady("jQuery",function(){f.register("sponsored-products-truncator-ready",function(){})}),b.amznJQ.available("amazonShoveler",
function(){f.register("sponsored-products-truncator-amznJQ-shoveler",function(){})}));f.register("sponsored-products-truncator-util",function(){function c(c,b){f({logLevel:c,attribution:"ProductAdsDetailPageAssets",message:"[sponsored-products-truncator] "+b})}var f=b.ueLogError;"function"!==typeof f&&(f=function(c,b){if(b&&b.message)throw Error(b.message);if(c&&c.message)throw Error(c.message);});return{constants:{FEATURE_NAME:"SponsoredProductsTitleTruncation"},count:b.ue&&b.ue.count||function(){},
isAUI:q,log:{warn:function(b){c("WARN",b)},error:function(b){c("ERROR",b)}}}})})(k,document);(function(b,k,n){f.when("A","sponsored-products-truncator-jQuery","sponsored-products-truncator-util").register("sponsored-products-truncator-line-truncator",function(b,c,f){function d(a){this.$element=a;this.$experimentElement=c("\x3cdiv\x3e").addClass("sponsored-products-truncator-offscreen-truncate");this.maxRows=a.attr("data-rows");this.text=a.attr("data-fulltext")?a.attr("data-fulltext"):this.$element.html();
this.lineHeight=this.getLineHeight();this.maxRows||f.log.error("Truncation element missing necessary line number data")}var e,h;e=/(?=[ \-\/])|(?=[\u3105-\u312F])|(?=[\u31A0-\u31BA])|(?=[\u4E00-\u9FD5])|(?=[\u3400-\u4DB5])|(?=[\uF900-\uFAFF])|(?=[\u3040-\u309F])|(?=[\u30A0-\u30FF])|(?=[\u3190-\u319F])/;h=/[^\/\-\[\]():\s]/;d.prototype.truncate=function(){var a=this.text,b,a=c.trim(a);this.$element.append(this.$experimentElement);this.checkLineFit(a)?this.text!==this.$element.html()&&this.$element.html(a):
(b=this.truncateByToken(a))?(this.$element.html(b),this.$element.attr({title:a})):f.log.error("Unable to successfully truncate line "+a);this.$experimentElement.remove()};d.prototype.getLineHeight=function(){var a=this.$element.html(),b;this.$element.html("\x26hellip;");b=this.$element.innerHeight();this.$element.html(a);return b};d.prototype.checkLineFit=function(a){this.$experimentElement.html(a);a=this.$experimentElement.get(0).clientHeight/this.lineHeight;return Math.round(a)<=this.maxRows};d.prototype.truncateByToken=
function(a){a=a.split(this.getTokenSeparatorRegex());var b=a.length,c=0,d,e,f;for(f=1;f!==b;)if(d=Math.floor((b+f)/2),e=a.slice(0,d).join("")+"\x26hellip;",this.checkLineFit(e)){if(1>=b-d){for(c=d;0<c&&!h.test(a[c-1]);)c--;break}f=d}else b=d;if(0!==c)return a.slice(0,c).join("")+"\x26hellip;"};d.prototype.getTokenSeparatorRegex=function(){return this.$element.attr("data-truncate-by-character")?"":e};return{truncateLines:function(a){a.find(".sponsored-products-truncator-truncate:visible, .sponsored-products-truncator-truncate-medium:visible").each(function(){(new d(c(this))).truncate();
c(this).addClass("sponsored-products-truncator-truncated").removeClass("sponsored-products-truncator-truncate sponsored-products-truncator-truncate-medium");c(this).removeClass(function(a,b){return(b.match(/sponsored-products-truncator-line-clamp-\d/g)||[]).join(" ")})});b.trigger("sponsored-products-truncator:linestruncated")}}});f.when("jQuery","A","sponsored-products-truncator-line-truncator","a-carousel-framework").register("sp-dp-carousel-truncation",function(b,c,f,d){function e(a){"string"===
typeof a?(f.truncateLines(c.$("#"+a)),d.getCarouselByName(a+"_carousel")&&c.trigger("spTruncationComplete",d.getCarouselByName(a+"_carousel"))):(f.truncateLines(a.carousel.dom.$container),c.trigger("spTruncationComplete",a.carousel))}var h="sp_detail sp_detail2 sp_detail_thematic sp_phone_detail sp_phone_detail2 sp_phoneapp_detail sp_phoneapp_detail2 sp_phone_detail_thematic sp_phoneapp_detail_thematic".split(" ");c.on("spCarouselNoTruncationRegistration",function(){var a=c.state("spTruncatorStatus");
if(!a||!a.truncationInitialized){for(a=h.length-1;0<=a;a--)e(h[a]),c.on("a:carousel:"+h[a]+"_carousel:change:animating",e),c.on("a:carousel:"+h[a]+"_carousel:change:loading",e),c.on("a:carousel:"+h[a]+"_carousel:change:pageSize",e);c.state("spTruncatorStatus",{truncationInitialized:!0})}});c.on("spMobileCarouselAjaxComplete",e);return{setUpTruncation:function(a){e(a);c.on("a:carousel:"+a+"_carousel:change:animating",e);c.on("a:carousel:"+a+"_carousel:change:loading",e);c.on("a:carousel:"+a+"_carousel:change:pageSize",
e)}}})})(k,document)});
/* ******** */
(function(d){var f=window.AmazonUIPageJS||window.P,r=f._namespace||f.attributeErrors,b=r?r("SponsoredProductsViewabilityAssets",""):f;b.guardFatal?b.guardFatal(d)(b,window):b.execute(function(){d(b,window)})})(function(d,f,r){d.when("A","SponsoredProductsEventBatcher","SPHAT").register("SponsoredProductsViewability",function(b,l,h){function k(c,a){c="SPView-"+a+"-"+c;f.ue&&f.ue.count(c,(f.ue.count(c)||0)+1)}function n(c){return{qualifier:a("qualifier",c),id:a("id",c),widgetName:a("widgetName",c),
adId:a("adId",c),adIndex:a("adIndex",c),eventType:a("eventType",c)}}function a(c,a){return(c=(new RegExp("[?\x26]"+c+"(\x3d([^\x26#]*)|\x26|#|$)")).exec(a))&&c[2]?decodeURIComponent(c[2].replace(/\+/g," ")):""}function e(c){g[c.selector].viewHandler=b.delay(function(){if(c){var a=c.data("viewpixelurl");a&&-1===d.indexOf(a)&&(l.sendRequest(n(a+"\x26eventType\x3d1")),d.push(a),g[c.selector]&&(g[c.selector].viewState="VIEWED",k("viewUrlSuccess",g[c.selector].placementId)),p())}},500)}function p(){for(var c in g)if("VIEWED"===
g[c].viewState)delete g[c];else{var a=b.$(c),m=g[a.selector].viewState;"VIEWED"!==m&&(b.onScreen(a,-.15*a.height())?"OFF"===m&&(g[a.selector].viewState="ON",e(a)):"ON"===m&&(g[a.selector].viewState="OFF",clearTimeout(g[a.selector].viewHandler)))}}var g={},d=[],q=[],m=[];b.on("spViewTrackingElementLoaded",p);return{registerViewTrackingElement:function(a,e){-1===d.indexOf(a.data("viewpixelurl"))&&(k("totalAds",e),g[a.selector]={viewState:"OFF",viewHandler:null,placementId:e},b.trigger("spViewTrackingElementLoaded"))},
registerAuiEvents:function(a){Array.isArray(a)&&a.forEach(function(a){if(-1===m.indexOf(a))b.on(a,p)})},loadImagePixel:function(a,b,e,m){!h.checkForHiddenElementsWithTargetList(b,e,m)&&Array.isArray(q)&&-1===q.indexOf(a)&&(q.push(a),l.sendRequest(n(a)))}}});d.when("A","SponsoredProductsViewabilityConfig").register("SponsoredProductsEventBatcher",function(b,l){function h(a,c){a||(q+=1,g+=c);p+=c;t+=1;k("avgRequestFailurePerPage",q/t);k("avgEventFailurePerPage",g/p)}function k(a,c){f.ue&&f.ue.count("SPBatch-"+
a,c)}function n(a){var c=[];b.each(a,function(a){c.push({data:a})});return{events:c}}function a(){if(0<e.length){var a=e.length,c=n(e);e=[];var g=/unagi-\w\w.amazon.com\/1\/events\/com.amazon.eel.SponsoredProductsEventTracking.(prod|gamma)/;l.eelEndpoint!==r&&g.test(l.eelEndpoint)?b.ajax(l.eelEndpoint,{method:"post",params:c,paramsFormat:"json",contentType:"application/json",accepts:"application/json",success:function(c,b,e){h(!0,a);k("batchSuccess",a)},error:function(c,b,e){d.log("Warning -- sushi response: "+
e+" | StatusText: "+b+" | xhrStatusCode: "+(c.http?c.http.status:"could not get xhr status code. ")+" | url: "+l.eelEndpoint,"WARN","SponsoredProductsViewabilityAssets");h(!1,a);k("batchError",a)}}):(h(!1,a),k("batchError",a),d.log("Warning -- sushi endpoint incorrectly configured with: "+l.eelEndpoint,"WARN","SponsoredProductsViewabilityAssets"))}}var e=[],p=0,g=0,t=0,q=0;b.interval(function(){a()},250);f.addEventListener("beforeunload",function(){a()});return{sendRequest:function(b){e.push(b);15<
e.length&&a()},_batchRequest:function(){a()}}});d.when("A","SponsoredProductsEventBatcher").register("SPHAT",function(b,d){function h(a,b){a&&f.ue&&f.ue.count&&f.ue.count(a,(f.ue.count(a)||0)+b?1:0)}function k(a,e){return a&&e?0<b.$(a).find(e.join(",")).filter(function(){return"hidden"===b.$(this).css("visibility")||"0"===b.$(this).css("opacity")||b.$(this).is(":hidden")}).length:!1}function n(a,e){var d=":hidden";b.$.each(e,function(a,b){d+=":not("+b+")"});return 0<b.$(a).children(d).length}return{checkForHiddenElementsWithTargetList:function(a,
b,d){a=k(a,b);h(d,a);return a},checkForHiddenElements:function(a,b,d){a=n(a,b);h(d,a);return a}}});d.when("A","ready").register("SponsoredProductsViewabilityConfigInitializer",function(b){function f(b){d.register("SponsoredProductsViewabilityConfig",function(){return{eelEndpoint:b,updateEelEndpoint:function(a){this.eelEndpoint=a}}})}var h=b.state("SpViewabilityConfigState"),k=!1;"undefined"!==typeof h&&null!==h&&"undefined"!==typeof h.eelEndpoint&&null!==h.eelEndpoint&&(k=!0,f(h.eelEndpoint));b.state.bind("SpViewabilityConfigState",
function(b,a){a.eelEndpoint&&"undefined"!==typeof b.eelEndpoint&&null!==b.eelEndpoint&&(k?d.when("SponsoredProductsViewabilityConfig").execute(function(a){a.updateEelEndpoint(b.eelEndpoint)}):(k=!0,f(b.eelEndpoint)))})})});
/* ******** */
(function(b){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,a=d?d("DetailPageClimatePledgeFriendlyNewAssets",""):c;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,c,d){b.when("A","climate-pledge-friendly-csm-counters","cf").execute(function(a,e){function f(){return a.capabilities.isAmazonApp?"map":a.capabilities.tablet?"twb":a.capabilities.mobile?"mwb":"dsk"}a.declarative("CPF-ATF-Badge","click",function(a){e.incrementCounter("cpf_dp_"+
f()+"_dppb_bgck")});a.declarative("CPF-BTF-CallToAction","click",function(a){e.incrementCounter("cpf_dp_"+f()+"_dpcd_lmlk")});a.declarative("a-modal","click",function(a){a=a.$currentTarget[0].id;-1!==a.indexOf("CPF-BTF-Certificate-Name")?e.incrementCounter("cpf_dp_"+f()+"_dpcd_cfnm"):-1!==a.indexOf("CPF-BTF-Certificate-Logo")&&e.incrementCounter("cpf_dp_"+f()+"_dpcd_cflg")});a.declarative("CPF-OpenExternalLink","click",function(l){e.incrementCounter("cpf_dp_"+f()+"_dpcd_excf");var k=l.$currentTarget[0].firstChild.href;
a.capabilities.isAmazonApp?b.when("mash").execute(function(a){a.openInExternalBrowser({url:k})}):c.open(k,"_blank")});b.when("A","a-sheet").execute("dp-cpf-bottom-sheet-declarative-action",function(a,b){var c=a.$,g;a.declarative("dp-cpf-sheet","click",function(d){var h=d&&d.data||{};g&&g.destroy();g=b.create({name:"dp-cpf-bottom-sheet",preloadDomId:"dp-cpf-bottom-sheet",height:1,closeType:"icon",sheetLabel:h.sheetLabel,sheetDescription:h.sheetDescription});b.showSheet(g);a.on("a:sheet:afterShow:dp-cpf-bottom-sheet",
function(a){var b=c("#"+h.preloadDomId).clone().removeAttr("id");b.find(".dp-cpf-container-bottom-sheet").attr("id","dp-cpf-bottom-sheet-content");g.getContentContainer().append(b.html());a.sheet.changeHeight({height:document.querySelector("#dp-cpf-bottom-sheet-content").offsetHeight,duration:.3});e.incrementCounter("cpf_dp_"+f()+"_dpcd_cfcd")})})})});"use strict";b.when("A").register("climate-pledge-friendly-csm-counters",function(a){return{incrementCounter:function(a,b){b=b||1;b=(ue.count(a)||0)+
b;ue.count(a,b)}}})});
/* ******** */
(function(p){var q=window.AmazonUIPageJS||window.P,u=q._namespace||q.attributeErrors,d=u?u("QuantitySelectorAssets",""):q;d.guardFatal?d.guardFatal(p)(d,window):d.execute(function(){p(d,window)})})(function(p,q,u){p.when("A","QuantitySelectorConstants","a-util").execute("qsAUIDeps-main",function(d,a,c){function e(){b&&b.enableCheckoutCompatibility&&g()}function g(){d.$('span[id^\x3d"'+a.getQsWidgetSummaryPriceId("")+'"][data-a-color\x3d"price"]').each(function(){d.$(this)[0].style.color="#B12704"});
d.$('span[id^\x3d"'+a.getQsWidgetButtonId("")+'"]').each(function(){var a=d.$(this);a.hasClass("a-button-dropdown")&&a.hasClass("a-button-small")&&(a=a.attr("id"),d.$('button[id^\x3d"'+a+'-announce"]').each(function(){d.$(this)[0].style.paddingRight="17px"}))})}function m(a){function b(a){return d.$(a+"-announce")}return function(a){return new b(a)}}function D(b){var e=function(a,f){var e=a+"-extradata",c=b.state(e);if(null==f)return e=b.state(a),f=d.$.extend({},e,c);c=d.$.extend({},c,f);b.state(e,
c)};e.parse=function(){for(var e=d.$(a.getQsWidgetGenericStateSelectorQuery()),f=a.getQsWidgetConfigurationId(""),n=0;n<e.length;n++){var g=e[n].getAttribute("data-a-state");if((g=c.parseJSON(g).key)&&g.substring(0,f.length)==f){var r=b.state(g);r&&r.id||(r=c.parseJSON(e[n].innerHTML),b.state(g,r))}}};e.replace=function(a,e){a+="-extradata";"function"===typeof b.state.replace?b.state.replace(a,e):b.state(a,e)};return{state:e}}var b;p.when("QuantitySelectorAUIDeps_AState","QuantitySelectorAUIDeps_AButton").execute("qsAUIDeps-register",
function(a,b){p.register("QuantitySelectorAUIDeps",function(){return{aUtil:c,aState:a.object,aButton:b.object,initialize:e}})});(function(){for(var e=d.$(a.getQsWidgetGenericStateSelectorQuery()),g=a.getQsWidgetGlobalConfigurationId(),h=0;h<e.length;h++){var f=e[h].getAttribute("data-a-state");if((f=c.parseJSON(f).key)&&f.substring(0,g.length)==g){b=c.parseJSON(e[h].innerHTML);break}}})();(function(){b&&b.enableCheckoutCompatibility?(p.when("a-state").execute("qsAUIDeps-checkout-compat-a-state-register",
function(a){p.register("QuantitySelectorAUIDeps_AState",function(){return{object:D(a)}})}),p.when("a-buttons").execute("qsAUIDeps-checkout-compat-a-button-register",function(a){p.register("QuantitySelectorAUIDeps_AButton",function(){return{object:m(a)}})}),d.on("checkout:afterReload",function(){d.trigger(a.getQsWidgetEventInitialize(),!1)})):(p.when("a-state").execute("qsAUIDeps-a-state-register",function(a){p.register("QuantitySelectorAUIDeps_AState",function(){return{object:a}})}),p.when("a-button").execute("qsAUIDeps-a-button-register",
function(a){p.register("QuantitySelectorAUIDeps_AButton",function(){return{object:a}})}));d.on("a:pageUpdate ready",function(){d.trigger(a.getQsWidgetEventInitialize(),!1)})})();e()});"use strict";p.when("A").register("QuantitySelectorConstants",function(d){var a={height:303,heightWithAtc:355,disclaimerTextAdjustment:41,disclaimerTextAdjustmentWithAtc:40},c={scrollEventStop:200,constant:19,increment:45,adjustment:20};return{getQsWidgetEventInitialize:function(){return"quantity-selector-widget:initialize"},
getQsWidgetEventLoadStatesAndInitialize:function(){return"quantity-selector-widget:loadStatesAndInitialize"},getQsWidgetEventTriggerAction:function(){return"quantity-selector-widget:triggerAction"},getQsWidgetVariationEventTriggerAction:function(){return"quantity-selector-widget-variation-selector:triggerAction"},getQsWidgetEventConfigureList:function(){return"quantity-selector-widget:configure:list"},getQsWidgetEventConfigureEnable:function(){return"quantity-selector-widget:configure:enable"},getQsWidgetEventConfigureDisable:function(){return"quantity-selector-widget:configure:disable"},
getQsWidgetEventConfigureReset:function(){return"quantity-selector-widget:configure:reset"},getQsWidgetEventConfigureGet:function(){return"quantity-selector-widget:configure:get"},getQsWidgetEventConfigureSet:function(){return"quantity-selector-widget:configure:set"},getQsWidgetEventSelectId:function(){return"quantity-selector-widget:selectId"},getQsWidgetVariationEventSelectId:function(){return"quantity-selector-widget-variation-selector:selectId"},getQsWidgetEventSelectQuantity:function(){return"quantity-selector-widget:selectQuantity"},
getQsWidgetEventAction:function(a){return"quantity-selector-widget:action:"+a},getQsWidgetAuiInputTextWrapperClass:function(){return"a-input-text-wrapper"},getQsWidgetActivateDebounce:function(){return 100},getQsWidgetInitialViewDropdown:function(){return"dropdown"},getQsWidgetInitialViewTextLink:function(){return"text_link"},getQsWidgetActionTriggerOnConfirmation:function(){return"on_confirmation"},getQsWidgetActionTriggerOnSelect:function(){return"on_select"},getQsWidgetGlobalConfigurationId:function(){return"qs-widget-global-configuration"},
getQsWidgetConfigurationId:function(a){return"qs-widget-configuration-"+a},getQsWidgetStateScriptSelectorQuery:function(a){return"script[data-a-state*\x3d'qs-widget-configuration-"+a+"'], "+("div[data-a-state*\x3d'qs-widget-configuration-"+a+"']")},getQsWidgetGenericStateSelectorQuery:function(){return"script[type\x3d'a-state'], div[data-a-state]"},getQsWidgetContainerId:function(a){return"qs-widget-container-"+a},getQsWidgetDivSelectorQueryForWidgetContainers:function(){return"div[id^\x3dqs-widget-container-]"},
getQsWidgetSpinnerId:function(a){return"qs-widget-spinner-"+a},getQsWidgetDivSelectorQueryForSpinners:function(){return"div[id^\x3dqs-widget-spinner-]"},getQsWidgetCheckboxId:function(a){return"qs-widget-checkbox-"+a},getQsWidgetInputSelectorQueryForCheckboxes:function(){return"input[id^\x3dqs-widget-checkbox-]"},getQsWidgetButtonContainerId:function(a){return"qs-widget-button-container-"+a},getQsWidgetButtonId:function(a){return"qs-widget-button-"+a},getQsWidgetDropdownContainerId:function(a){return"qs-widget-dropdown-container-"+
a},getQsWidgetDropdownId:function(a){return"qs-widget-dropdown-"+a},getQsWidgetDropdownViewId:function(a){return"qs-widget-dropdown-view-"+a},getQsWidgetVariationDropdownViewId:function(a){return"qs-widget-dropdown-view-variation-"+a},getQsWidgetDropdownItemId:function(a,c){return"qs-widget-dropdown-item-"+c+"-"+a},getQsWidgetDropdownItemAriaId:function(a,c){return"qs-widget-dropdown-item-aria-"+c+"-"+a},getQsWidgetDropdownItemQuantitySuffixId:function(a,c){return"qs-widget-dropdown-item-quantitySuffix-"+
c+"-"+a},getQsWidgetDropdownUnorderedListId:function(a){return"qs-widget-dropdown-unorderedlist-"+a},getQsWidgetDropdownVariationUnorderedListId:function(a){return"qs-widget-dropdown-variation-unorderedlist-"+a},getQsWidgetTextInputId:function(a){return"qs-widget-text-input-"+a},getQsWidgetTextInputContainerId:function(a){return"qs-widget-text-input-container-"+a},getQsWidgetTextInputUpdateButtonId:function(a){return"qs-widget-text-input-updatelink-"+a},getQsWidgetTextInputUpdateButtonContainerId:function(a){return"qs-widget-text-input-updatelink-container-"+
a},getQsWidgetTextInputUpdateButtonDecl:function(){return"qs-widget-text-input-updatelink-decl"},getQsWidgetTextInputDecl:function(){return"qs-widget-text-input-decl"},getQsWidgetQuantityContainerId:function(a){return"qs-widget-quantity-container-"+a},getQsWidgetQuantityId:function(a){return"qs-widget-quantity-"+a},getQsWidgetQuantitySuffixId:function(a){return"qs-widget-quantity-suffix-"+a},getQsWidgetInitialViewSuffixId:function(a){return"qs-widget-initialView-suffix-"+a},getQsWidgetSummaryId:function(){return"qs-widget-summary-"},
getQsWidgetSummaryPriceId:function(a){return"qs-widget-summary-price-"+a},getQsWidgetSummaryPriceSymbolId:function(a){return"qs-widget-summary-price-symbol-"+a},getQsWidgetSummaryPriceWholeId:function(a){return"qs-widget-summary-price-whole-"+a},getQsWidgetSummaryPriceFractionId:function(a){return"qs-widget-summary-price-fraction-"+a},getQsWidgetSummaryPriceDecimalId:function(a){return"qs-widget-summary-price-decimal-"+a},getQsWidgetSummaryAtcId:function(a){return"qs-widget-summary-atc-"+a},getQsWidgetFooterPriceContainerId:function(a){return"qs-widget-footer-price-container-"+
a},getQsWidgetFooterPriceSymbolId:function(a){return"qs-widget-footer-price-symbol-"+a},getQsWidgetFooterPriceWholeId:function(a){return"qs-widget-footer-price-whole-"+a},getQsWidgetFooterPriceFractionId:function(a){return"qs-widget-footer-price-fraction-"+a},getQsWidgetFooterPriceDecimalId:function(a){return"qs-widget-footer-price-decimal-"+a},getQsWidgetFooterQuantitySuffixContainerId:function(a){return"qs-widget-footer-quantitySuffix-container-"+a},getQsWidgetFooterQuantitySuffixId:function(a){return"qs-widget-footer-quantitySuffix-"+
a},getQsWidgetButtonDecl:function(){return"qs-widget-button-decl"},getQsWidgetSummaryAtcDecl:function(){return"qs-widget-summary-atc-decl"},getQsWidgetQuantityChangelinkId:function(a){return"qs-widget-quantity-changelink-"+a},getQsWidgetQuantityChangelinkDecl:function(){return"qs-widget-quantity-changelink-decl"},getQsWidgetDropdownItemDecl:function(){return"qs-widget-dropdown-item-decl"},getQsWidgetVariationDropdownItemDecl:function(){return"qs-widget-dropdown-variation-item-decl"},getQsWidgetDropdownDecl:function(){return"qs-widget-dropdown-decl"},
getQsWidgetDropdownScrollMetricThreshold:function(){return 20},getQsWidgetBottomSheetId:function(a){return"qs-widget-bottom-sheet-"+a},getQsWidgetBottomSheetContainerId:function(a){return"qs-widget-bottom-sheet-container-"+a},getQsWidgetBottomSheetQuantitySuffixId:function(a){return"qs-widget-bottom-sheet-quantitySuffix-"+a},getQsWidgetInitialViewTextLinkId:function(a){return"qs-widget-link-"+a},getQsWidgetBottomSheetHeightConfig:function(){return a},getQsWidgetBottomSheetDropDownScrollFactor:function(){return c},
getQsWidget1DBottomSheetSelectorCssClass:function(){return"qs-widget-new-1d-dropdown-li"},getQsWidget2DBottomSheetSelectorCssClass:function(){return"qs-widget-new-2d-dropdown-li"},getQsWidgetVariationSelectorListMapKey:function(){return"variationSelectorListsMap"},getQsWidgetVariationSelectorSelectedIdKey:function(){return"selectedId"},getQsWidgetVariationSelectorDisplayTextKey:function(){return"displayText"},getQsWidgetVariationSelectorDisplayTextWithQuantityKey:function(){return"displayTextWithQuantity"}}});
"use strict";p.when("A","QuantitySelectorState","QuantitySelectorAUIDeps").register("QuantitySelectorMetadata",function(d,a,c){function e(d){return(d=a.getQsWidgetConfiguration(d).metadata)?c.aUtil.parseJSON(d):null}return{isWeblabEnabled:function(a,c,d){a:{if((a=e(a))&&a.weblabs)for(var b=0;b<a.weblabs.length;b++){var k=a.weblabs[b];if(k.weblabName==c){c=k.treatment;break a}}c=null}return null==c?d:"T1"==c?!0:!1},getMetaConfiguration:function(a,c){return(a=e(a))?a[c]:null}}});"use strict";p.when("A",
"QuantitySelectorAUIDeps","QuantitySelectorConstants").register("QuantitySelectorMetrics",function(d,a,c){function e(a){q.ue&&q.ue.count&&a&&ue.count(a,(ue.count(a)||0)+1)}var g=Infinity;p.when("ready").execute(function(){g=d.now()});var m=new Set;return{incrementInitializeCount:function(a,b){var c="QuantitySelector-Initialize",c=a?c+"-Success-Count":c+"-Failed-Count";e(b?c+":mobile":c+":desktop")},incrementInvalidIdCount:function(){e("QuantitySelector-InvalidID")},incrementTriggerActionCount:function(a,
b,c){a="QuantitySelector-TriggerAction-"+a;a=b?a+"-Success-Count":a+"-Failed-Count";e(c?a+":mobile":a+":desktop")},incrementChangeLinkCount:function(){e("QuantitySelector-ChangeLink-Count")},incrementShowPopup:function(a){var b="QuantitySelector-ShowPopup-Count";e(a?b+":mobile":b+":desktop")},logLatencyMetric:function(a,b,c){"WidgetParsed"==a||"WidgetReady"==a?("WidgetParsed"==a&&b>=g?(m.add(c),c=!0):c="WidgetReady"==a?m.has(c):!1,c=!c):c=!0;c&&(a="QuantitySelector-TimeTo-"+a,q.ue&&q.ue.count&&a&&
"undefined"!==typeof q.ue_t0&&(b-=q.ue_t0,ue.count(a,b),ue.count(a+"Hundredths",Math.floor(b/10))))},logCsm:function(d,b){var k=a.aState.state(c.getQsWidgetConfigurationId(d));if(k&&(d="mobile"==k.viewType.toLowerCase()?"mob":"dsk",(k=k.qsCsm)&&k.almBrandRefMarker&&k.pageRefMarker)){var e;a:{e=k.sellingUomDimension;var h=k.pricingUomDimension;if(e&&h){var f="s";switch(e){case "count":f+="u";break;case "weight":f+="w";break;default:e=void 0;break a}f+="p";switch(h){case "count":f+="u";break;case "weight":f+=
"w";break;default:e=void 0;break a}e=f}else e=void 0}e&&(b={pageType:k.pageType,subPageType:k.subPageType,pageTypeId:k.pageTypeId,storeName:k.tabId,programRegionId:k.programRegionId,hitType:k.hitType,refMarker:k.almBrandRefMarker+"_"+d+"_"+k.pageRefMarker+"_qs_"+b+"_"+e},q.ue&&q.ue.event&&ue.event(b,"quantityselector_attr","quantityselector.QuantityselectorMetrics.1"))}}}});"use strict";p.when("A","QuantitySelectorConstants","QuantitySelectorMetrics","QuantitySelectorAUIDeps").register("QuantitySelectorState",
function(d,a,c,e){function g(b){var c=e.aState.state(a.getQsWidgetConfigurationId(b));c&&c.id||(m(b),c=e.aState.state(a.getQsWidgetConfigurationId(b)));return c}function m(b){var c=a.getQsWidgetConfigurationId(b);b=a.getQsWidgetStateScriptSelectorQuery(b);b=d.$(b).first();b=e.aUtil.parseJSON(b.html());e.aState.state(c,b)}function p(){for(var b=[],c=d.$(a.getQsWidgetGenericStateSelectorQuery()),g=a.getQsWidgetConfigurationId(""),h=0;h<c.length;h++){var f=c[h].getAttribute("data-a-state");(f=e.aUtil.parseJSON(f).key)&&
f.substring(0,g.length)==g&&(f=f.substring(g.length),b.push(f))}return b}d.on(a.getQsWidgetEventConfigureList(),function(a){"function"===typeof a&&a(p())});d.on(a.getQsWidgetEventConfigureGet(),function(a,c){a=g(a);"function"===typeof c&&c(a)});d.on(a.getQsWidgetEventConfigureSet(),function(b,c){e.aState.state.replace(a.getQsWidgetConfigurationId(b),c);d.trigger(a.getQsWidgetEventInitialize(),!0,b)});return{getQsWidgetConfiguration:g,loadQsWidgetStateConfiguration:m,saveOriginalSettings:function(b,
c){var d=a.getQsWidgetConfigurationId(b)+"-original",h=e.aState.state(d);!c&&h&&h.id||(b=g(b),e.aState.state(d,b))},loadOriginalSettings:function(b){var c=a.getQsWidgetConfigurationId(b)+"-original";(c=e.aState.state(c))&&c.id&&e.aState.state.replace(a.getQsWidgetConfigurationId(b),c)},setEnable:function(b,c){c={enable:c};e.aState.state(a.getQsWidgetConfigurationId(b),c)},setInitialized:function(b){e.aState.state(a.getQsWidgetConfigurationId(b),{initialized:!0})},setSelectedId:function(b,c){c={selectedId:c,
selectedQuantity:null};e.aState.state(a.getQsWidgetConfigurationId(b),c)},setSelectedQuantity:function(b,c){c={selectedId:null,selectedQuantity:c};e.aState.state(a.getQsWidgetConfigurationId(b),c)},setData:function(c,d){e.aState.state(a.getQsWidgetConfigurationId(c),d)},getQsUIDs:p}});"use strict";p.when("A","QuantitySelectorState","QuantitySelectorConstants","QuantitySelectorAUIDeps","QuantitySelectorMetrics").register("QuantitySelectorUtils",function(d,a,c,e,g){function m(a){return"true"==a||1==
a?!0:!1}function p(l){return"mobile"==a.getQsWidgetConfiguration(l).viewType.toLowerCase()?!0:!1}function b(l){l=a.getQsWidgetConfiguration(l);return m(l.showConfirmationView)?!0:!1}function k(l){l=a.getQsWidgetConfiguration(l);return m(l.allowZeroQuantity)?!0:!1}function r(a){var b=d.$("#"+c.getQsWidgetQuantityChangelinkId(a));a=d.$("#"+c.getQsWidgetTextInputUpdateButtonId(a));b.attr("draggable","false");a.attr("draggable","false")}function h(a){return d.$("#"+c.getQsWidgetContainerId(a))}function f(a){return e.aButton("#"+
c.getQsWidgetButtonId(a))}function n(a){return d.$("#"+c.getQsWidgetDropdownContainerId(a))}function t(a){return d.$("#"+c.getQsWidgetDropdownViewId(a))}function v(a){return d.$("#"+c.getQsWidgetDropdownUnorderedListId(a))}function q(a){return d.$("#"+c.getQsWidgetTextInputId(a))}function w(l,c){l=a.getQsWidgetConfiguration(l);for(var b=0;b<l.qsItems.length;b++)if(l.qsItems[b].id==c)return l.qsItems[b]}function A(l){var c=a.getQsWidgetConfiguration(l).selectedId;return c?c:y(l)}function y(l){l=a.getQsWidgetConfiguration(l);
if(l.qsItems)for(var c=0;c<l.qsItems.length;c++)if(m(l.qsItems[c].isSelected))return l.qsItems[c].id}function u(l){return a.getQsWidgetConfiguration(l).selectedQuantity}function B(a,c){return(k(a)?/^(([0-9]\d{0,2}))$/:/^(([1-9]\d{0,2})|(0[1-9]\d?)|(00[1-9]))$/).test(c)}function C(a){if(a){var b=d.$("#"+c.getQsWidgetCheckboxId(a)),f=h(a);a=d.$("#"+c.getQsWidgetSpinnerId(a))}else b=d.$(c.getQsWidgetInputSelectorQueryForCheckboxes()),a=d.$(c.getQsWidgetDivSelectorQueryForSpinners()),f=d.$(c.getQsWidgetDivSelectorQueryForWidgetContainers());
b.remove();a.removeClass("qs-widget-visible");a.addClass("qs-widget-hidden");f.removeClass("qs-widget-hidden")}var x=[];d.on(c.getQsWidgetEventTriggerAction(),function(l,b,f){var n=a.getQsWidgetConfiguration(l),h=n.selectedId,k=n.selectedQuantity;b||(b=n.actionId);var t="mobile"==n.viewType.toLowerCase(),r=!1;if(h)for(var m=0;m<n.qsItems.length;m++)if(n.qsItems[m].id==h){var r=e.aUtil.parseJSON(n.staticData),p=e.aUtil.parseJSON(n.qsItems[m].data),r=d.$.extend({qsUID:l,tunneledData:f},r,p);d.trigger(c.getQsWidgetEventAction(b),
r);g.incrementTriggerActionCount(b,!0,t);r=!0}k&&(r=e.aUtil.parseJSON(n.staticData),r=d.$.extend({qsUID:l,tunneledData:f},r,{quantity:k}),d.trigger(c.getQsWidgetEventAction(b),r),g.incrementTriggerActionCount(b,!0,t),r=!0);r||g.incrementTriggerActionCount(b,!1,t)});return{isInitialized:function(l){return(l=a.getQsWidgetConfiguration(l))?l.initialized:!1},isMobile:p,isQsWidgetEnabled:function(l){l=a.getQsWidgetConfiguration(l);return l.hasOwnProperty("enable")?m(l.enable):!0},isConfirmationViewEnabled:b,
isAllowZeroQuantityEnabled:k,isInitialViewDropdown:function(l){return a.getQsWidgetConfiguration(l).initialView.toLowerCase()==c.getQsWidgetInitialViewDropdown()?!0:!1},isInitialViewTextLink:function(l){return a.getQsWidgetConfiguration(l).initialView.toLowerCase()==c.getQsWidgetInitialViewTextLink()?!0:!1},isVariationSelectorEnabled:function(a){return!1},getQsWidgetBottomSheetConfig:function(l){var f=a.getQsWidgetConfiguration(l),d=c.getQsWidgetBottomSheetHeightConfig(),n=0;f.summaryDisclaimerText||
(n=b(l)?d.disclaimerTextAdjustmentWithAtc:d.disclaimerTextAdjustment);return b(l)?{closeMessage:f.bottomSheetCancelText,height:d.heightWithAtc-n}:{closeMessage:f.bottomSheetDoneText,height:d.height-n}},isActionTriggerOnConfirmation:function(l){return a.getQsWidgetConfiguration(l).actionTrigger.toLowerCase()==c.getQsWidgetActionTriggerOnConfirmation()?!0:!1},isActionTriggerOnSelect:function(l){return a.getQsWidgetConfiguration(l).actionTrigger.toLowerCase()==c.getQsWidgetActionTriggerOnSelect()?!0:
!1},isTextInputRequired:function(a,c){a=w(a,c).quantityText;return"+"==a.substr(a.length-1)?{result:!0,initialQuantityText:a.substr(0,a.length-1)}:{result:!1}},initializeWidget:function(a){var b=A(a);b?d.trigger(c.getQsWidgetEventSelectId(),a,b,!1,function(){r(a)}):(b=u(a))&&d.trigger(c.getQsWidgetEventSelectQuantity(),a,b,!1,function(){r(a)});C(a)},activateWidget:function(a){var b=x.indexOf(a);-1<b&&x.splice(b,1);setTimeout(function(){x.push(a)},c.getQsWidgetActivateDebounce())},deactivateWidget:function(a){a=
x.indexOf(a);-1<a&&x.splice(a,1)},getActivatedQsWidgets:function(){return x},hideComponent:function(a,b){a.addClass("aok-hidden")},showComponent:function(a){a.removeClass("aok-hidden")},isComponentVisible:function(a){return!a.hasClass("aok-hidden")},setComponentVisibility:function(a,b){b?a.css("visibility","visible"):a.css("visibility","hidden")},setHtml:function(a,b){a.html(b)},setQsWidgetContainerMinWidthAndHeight:function(a){a=h(a);a.css("min-width",a.width()+"px");a.css("min-height",a.height()+
"px")},resetQsWidgetContainerMinWidthAndHeight:function(a){a=h(a);a.css("min-width","0px");a.css("min-height","0px")},enableQsWidget:function(b){var c=f(b),d=q(b);c.enable();d.removeClass("a-form-disabled");d.addClass("a-form-normal");d.removeAttr("disabled");a.setEnable(b,!0)},disableQsWidget:function(b){var c=f(b),d=q(b);c.disable();d.removeClass("a-form-normal");d.addClass("a-form-disabled");d.attr("disabled","disabled");a.setEnable(b,!1)},popOutDropDownContainer:function(a){var b=h(a).offset();
a=n(a);a.appendTo(document.body);a.css({left:b.left,top:b.top})},getQsWidgetButtonContainer:function(a){return d.$("#"+c.getQsWidgetButtonContainerId(a))},getQsWidgetButtonAsComponent:f,getQsWidgetButton:function(a){return d.$("#"+c.getQsWidgetButtonId(a)+"-announce")},getQsWidgetDropdownContainer:n,getQsWidgetDropdownElement:function(a){return d.$("#"+c.getQsWidgetDropdownId(a))},getQsWidgetDropdownViewSelector:t,getQsWidgetDropdownUnorderedListElement:v,getQsWidgetDropdownVariationUnorderedListElement:function(a){return d.$("#"+
c.getQsWidgetDropdownVariationUnorderedListId(a))},getQsWidgetDropdownItemElement:function(a,b){return d.$("#"+c.getQsWidgetDropdownItemAriaId(a,b))},getQsWidgetTextInputContainer:function(a){return d.$("#"+c.getQsWidgetTextInputContainerId(a))},getQsWidgetTextInputElement:q,getQsWidgetTextInputUpdateButtonContainer:function(a){return d.$("#"+c.getQsWidgetTextInputUpdateButtonContainerId(a))},getQsWidgetQuantityContainer:function(a){return d.$("#"+c.getQsWidgetQuantityContainerId(a))},getQsWidgetQuantityElement:function(a){return d.$("#"+
c.getQsWidgetQuantityId(a))},getQsWidgetQuantitySuffixElement:function(a){return d.$("#"+c.getQsWidgetQuantitySuffixId(a))},getQsWidgetInitialViewSuffixElement:function(a){return d.$("#"+c.getQsWidgetInitialViewSuffixId(a))},getQsWidgetSummaryAtcButton:function(a){return d.$("#"+c.getQsWidgetSummaryAtcId(a))},getQsWidgetSummaryContainer:function(a){return d.$("#"+c.getQsWidgetSummaryPriceId(a))},getQsWidgetSummaryPriceSymbolElement:function(a){return d.$("#"+c.getQsWidgetSummaryPriceSymbolId(a))},
getQsWidgetSummaryPriceWholeElement:function(a){return d.$("#"+c.getQsWidgetSummaryPriceWholeId(a))},getQsWidgetSummaryPriceFractionElement:function(a){return d.$("#"+c.getQsWidgetSummaryPriceFractionId(a))},getQsWidgetSummaryPriceDecimalElement:function(a){return d.$("#"+c.getQsWidgetSummaryPriceDecimalId(a))},getQsWidgetFooterPriceContainer:function(a){return d.$("#"+c.getQsWidgetFooterPriceContainerId(a))},getQsWidgetFooterPriceSymbolElement:function(a){return d.$("#"+c.getQsWidgetFooterPriceSymbolId(a))},
getQsWidgetFooterPriceWholeElement:function(a){return d.$("#"+c.getQsWidgetFooterPriceWholeId(a))},getQsWidgetFooterPriceFractionElement:function(a){return d.$("#"+c.getQsWidgetFooterPriceFractionId(a))},getQsWidgetFooterPriceDecimalElement:function(a){return d.$("#"+c.getQsWidgetFooterPriceDecimalId(a))},getQsWidgetFooterQuantitySuffixContainer:function(a){return d.$("#"+c.getQsWidgetFooterQuantitySuffixContainerId(a))},getQsWidgetFooterQuantitySuffixElement:function(a){return d.$("#"+c.getQsWidgetFooterQuantitySuffixId(a))},
getQsWidgetBottomSheetQuantitySuffixElement:function(a){return d.$("#"+c.getQsWidgetBottomSheetQuantitySuffixId(a))},getQsWidgetInitialViewTextLinkElement:function(a){return d.$("#"+c.getQsWidgetInitialViewTextLinkId(a))},getQsItem:w,getSelectedQsItemId:A,getInitialSelectedQsItemId:y,getSelectedQuantity:u,getQsItemFromQuantityText:function(b,c){b=a.getQsWidgetConfiguration(b).qsItems;if(!b)return null;for(var f=0;f<b.length;f++)if(c.toLowerCase()==b[f].quantityText.toLowerCase()||parseFloat(c)==parseFloat(b[f].quantityText))return b[f]},
getFocusedQsItemIdInBottomSheet:function(b){var f=t(b).scrollTop(),d=c.getQsWidgetBottomSheetDropDownScrollFactor();f=parseInt((f-d.constant+d.adjustment)/d.increment);b=a.getQsWidgetConfiguration(b).qsItems;b=0>f?b[0].id:f>=b.length?b[b.length-1].id:b[f].id;return b},getIndexFromIdInBottomSheet:function(b,c){b=a.getQsWidgetConfiguration(b).qsItems;if(!b)return 0;for(var f=0;f<b.length;f++)if(c==b[f].id)return f},saveQsWidgetDropdownTopPosition:function(b){var c=v(b);c&&(c=c.position().top,a.setData(b,
{scrollTop:c}));return!1},setQsWidgetDropdownScrolled:function(b){a.setData(b,{scrollTop:-65536})},clearQsWidgetDropdownScrolled:function(b){a.setData(b,{scrollTop:c.getQsWidgetDropdownScrollMetricThreshold()})},isQsWidgetDropdownScrolled:function(b){var f=v(b);return f?(f=f.position().top,(b=a.getQsWidgetConfiguration(b).scrollTop)?Math.abs(f-b)>c.getQsWidgetDropdownScrollMetricThreshold():!1):!1},generateQsDropdownDOM:function(b){var f="",d=a.getQsWidgetConfiguration(b),n=d.qsItems,d=d.selectedId,
e=p(b);if(!n)return"";for(var h=0;h<n.length;h++){var k,g=n[h].id,t=n[h].quantityText;if(e){k=b;var r=c.getQsWidgetDropdownItemId(k,g),m=c.getQsWidgetDropdownItemAriaId(k,g),v=c.getQsWidgetDropdownItemDecl();k='\x3cspan class\x3d"a-declarative" data-action\x3d"'+v+'" data-'+v+'\x3d"{\x26quot;qsUID\x26quot;:\x26quot;'+k+"\x26quot;,\x26quot;id\x26quot;:"+g+'}"\x3e\x3cli tabindex\x3d"-1" role\x3d"option" id\x3d"'+r+'" aria-labelledby\x3d"'+m+'" class\x3d"qs-widget-dropdown-li"\x3e'+t+"\x3c/li\x3e\x3c/span\x3e"}else{k=
b;var q=n[h].quantityTextAbbreviatedSuffix,r=n[h].id==d,m=c.getQsWidgetDropdownItemId(k,g),v=c.getQsWidgetDropdownItemAriaId(k,g),w=c.getQsWidgetDropdownItemQuantitySuffixId(k,g),z=c.getQsWidgetDropdownDecl(k),u="";q&&(u='\x3cspan id\x3d"'+w+'" class\x3d"a-size-mini a-color-tertiary"\x3e'+q+"\x3c/span\x3e");q="false";w="qs-widget-dropdown-link";r&&(q="true",w+=" qs-widget-dropdown-link-active aok-block aok-nowrap");k='\x3cspan class\x3d"a-declarative" data-action\x3d"'+z+'" data-'+z+'\x3d"{\x26quot;qsUID\x26quot;:\x26quot;'+
k+"\x26quot;,\x26quot;id\x26quot;:"+g+'}"\x3e\x3cli tabindex\x3d"-1" role\x3d"option" id\x3d"'+m+'" aria-labelledby\x3d"'+v+'" aria-checked\x3d"'+q+'" class\x3d"qs-widget-dropdown-item"\x3e\x3ca tabindex\x3d"0" href\x3d"javascript:void(0)" draggable\x3d"false" id\x3d"'+v+'" class\x3d"'+w+'"\x3e'+t+"\x26nbsp;\x26nbsp;"+u+"\x3c/a\x3e\x3c/li\x3e\x3c/span\x3e"}f+=k}return f},generateVariationSelectorDOM:function(a){return""},isQsWidgetTextInputValid:B,validateQsWidgetTextInput:function(a){var b=q(a),
f=b.val();a=B(a,f);var d=b.parent().hasClass(c.getQsWidgetAuiInputTextWrapperClass())?b.parent():b;if(a)return b.val(f.replace(/^0{2,}$/,"0").replace(/^0+(\d+)/g,"$1")),d.removeClass("a-form-error"),d.addClass("a-form-normal"),!0;d.removeClass("a-form-normal");d.addClass("a-form-error");return!1},isUserClickInSummary:function(a){var b=c.getQsWidgetSummaryId();for(a=null==a?null:a.target;null!=a;){if(a.id.substring(0,b.length)==b)return!0;a=a.parentElement}return!1},hideSpinner:C}});"use strict";p.when("A",
"QuantitySelectorUtils","QuantitySelectorState","QuantitySelectorConstants").register("QuantitySelectorWidget",function(d,a,c,e){function g(b){a.deactivateWidget(b);var c=a.getQsWidgetButtonContainer(b),d=a.getQsWidgetDropdownContainer(b),e=a.getQsWidgetDropdownElement(b),f=a.getQsWidgetQuantityContainer(b),n=a.getQsWidgetSummaryAtcButton(b),g=a.getQsWidgetFooterPriceContainer(b),m=a.getQsWidgetFooterQuantitySuffixContainer(b);a.setComponentVisibility(g,!0);a.setComponentVisibility(m,!0);g=a.getQsWidgetTextInputContainer(b);
a.isComponentVisible(g)||a.showComponent(c);a.hideComponent(d);a.hideComponent(e);a.hideComponent(f);a.hideComponent(n);a.resetQsWidgetContainerMinWidthAndHeight(b)}function m(b,k,g){var h=a.getQsItem(b,k),f=h.quantityText,n=h.quantityTextAbbreviatedSuffix,t=h.quantityTextFullSuffix,m=h.selectedText,h=h.price,p=a.getQsWidgetSummaryPriceSymbolElement(b),q=a.getQsWidgetSummaryPriceWholeElement(b),u=a.getQsWidgetSummaryPriceFractionElement(b),y=a.getQsWidgetSummaryPriceDecimalElement(b);a.setHtml(p,
h.currencySymbol);a.setHtml(q,h.wholeValue);a.setHtml(u,h.fractionValue);a.setHtml(y,h.decimalSeparator);p=a.getQsWidgetQuantityElement(b);a.setHtml(p,f);f=a.getQsWidgetQuantitySuffixElement(b);n&&t?(a.setHtml(f,n),n=a.getQsWidgetInitialViewSuffixElement(b),a.setHtml(n,t)):a.setHtml(f,"");n=a.getQsWidgetFooterPriceSymbolElement(b);f=a.getQsWidgetFooterPriceWholeElement(b);p=a.getQsWidgetFooterPriceFractionElement(b);q=a.getQsWidgetFooterPriceDecimalElement(b);a.setHtml(n,h.currencySymbol);a.setHtml(f,
h.wholeValue);a.setHtml(p,h.fractionValue);a.setHtml(q,h.decimalSeparator);t&&(h=a.getQsWidgetFooterQuantitySuffixElement(b),a.setHtml(h,t));t="Current quantity "+m+". Click to change quantity";a.isInitialViewDropdown(b)?(a.getQsWidgetButtonAsComponent(b).text(m),a.getQsWidgetButton(b).attr("aria-label",t)):a.isInitialViewTextLink(b)&&(h=a.getQsWidgetInitialViewTextLinkElement(b),h.text(m),h.attr("aria-label",t));c.setSelectedId(b,k);g&&d.trigger(e.getQsWidgetEventTriggerAction(),b)}function p(b,
k){var g=a.getQsWidgetTextInputElement(b),h=g.val(),f=a.getQsWidgetButtonContainer(b),n=a.getQsWidgetTextInputContainer(b),t=a.getQsWidgetTextInputUpdateButtonContainer(b),q=a.getQsItemFromQuantityText(b,h);a.hideComponent(t);q?(a.hideComponent(n),a.showComponent(f),m(b,q.id,k)):(a.hideComponent(f),a.showComponent(n),g.blur(),c.setSelectedQuantity(b,h),k&&d.trigger(e.getQsWidgetEventTriggerAction(),b))}d.on(e.getQsWidgetEventSelectId(),function(b,c,d,e){m(b,c,d);c=a.getQsWidgetButtonContainer(b);
d=a.getQsWidgetTextInputContainer(b);b=a.getQsWidgetTextInputUpdateButtonContainer(b);a.hideComponent(b);a.hideComponent(d);a.showComponent(c);e&&e()});d.on(e.getQsWidgetEventSelectQuantity(),function(b,c,d,e){a.getQsWidgetTextInputElement(b).val(c);p(b,d);e&&e()});return{hideAllPopover:function(){for(var b=a.getActivatedQsWidgets(),c=0;c<b.length;c++)g(b[c])},showPopover:function(b){a.activateWidget(b);a.setQsWidgetContainerMinWidthAndHeight(b);var d=a.getQsWidgetDropdownUnorderedListElement(b),
e=a.getQsWidgetButtonContainer(b),h=a.getQsWidgetDropdownContainer(b),f=a.getQsWidgetDropdownElement(b),n=a.getQsWidgetQuantityContainer(b),g=a.getQsWidgetSummaryAtcButton(b);a.setHtml(d,a.generateQsDropdownDOM(b));var d=a.getQsWidgetFooterPriceContainer(b),m=a.getQsWidgetFooterQuantitySuffixContainer(b);a.setComponentVisibility(d,!1);a.setComponentVisibility(m,!1);a.showComponent(f);a.hideComponent(n);a.hideComponent(g);a.showComponent(h);a.hideComponent(e);a.popOutDropDownContainer(b);h=c.getQsWidgetConfiguration(b);
if(e=h.qsItems)h=h.selectedId,null===h&&(h=e[0].id),a.getQsWidgetDropdownItemElement(b,h).focus()},showConfirmation:function(b){a.activateWidget(b);var c=a.getQsWidgetButtonContainer(b),d=a.getQsWidgetDropdownContainer(b),e=a.getQsWidgetDropdownElement(b),f=a.getQsWidgetQuantityContainer(b);b=a.getQsWidgetSummaryAtcButton(b);a.hideComponent(e);a.showComponent(f);a.showComponent(b);a.showComponent(d);a.hideComponent(c)},showPrice:function(b,c){c=a.getQsItem(b,c).price;var d=a.getQsWidgetSummaryPriceSymbolElement(b),
e=a.getQsWidgetSummaryPriceWholeElement(b),f=a.getQsWidgetSummaryPriceFractionElement(b);b=a.getQsWidgetSummaryPriceDecimalElement(b);a.setHtml(d,c.currencySymbol);a.setHtml(e,c.wholeValue);a.setHtml(f,c.fractionValue);a.setHtml(b,c.decimalSeparator)},selectOption:m,showTextInput:function(b,c){var d=a.getQsWidgetTextInputContainer(b),e=a.getQsWidgetTextInputUpdateButtonContainer(b),f=a.getQsWidgetButtonContainer(b);a.hideComponent(f);a.showComponent(d);var n=a.getQsWidgetTextInputElement(b);c&&n.val(c);
c=n.val();a.isQsWidgetTextInputValid(b,c)&&a.getSelectedQuantity(b)!==c?a.showComponent(e):a.hideComponent(e);setTimeout(function(){n.focus()},200)},validateAndSelectQuantity:p,selectConfirmation:function(b){a.isActionTriggerOnConfirmation(b)&&d.trigger(e.getQsWidgetEventTriggerAction(),b);g(b)}}});"use strict";p.when("A","QuantitySelectorWidget","QuantitySelectorUtils","QuantitySelectorState","QuantitySelectorConstants","QuantitySelectorMetrics","QuantitySelectorAUIDeps","QuantitySelectorMetadata").register("QuantitySelector",
function(d,a,c,e,g,m,p,b){function k(a,d){try{var g=c.isMobile(d)}catch(h){h instanceof TypeError&&m.incrementInvalidIdCount();return}try{if(!c.isInitialized(d)||a)eval(b.getMetaConfiguration(d,"script")),e.setInitialized(d),e.saveOriginalSettings(d),c.initializeWidget(d),c.isQsWidgetEnabled(d)?c.enableQsWidget(d):c.disableQsWidget(d),m.incrementInitializeCount(!0,g)}catch(h){m.incrementInitializeCount(!1,g)}}function r(a){e.loadQsWidgetStateConfiguration(a);k(!0,a)}d.declarative(g.getQsWidgetButtonDecl(),
"click",function(b){var d=b.data.qsUID;(b=c.isMobile(d))?a.showBottomSheet(d):a.showPopover(d);m.incrementShowPopup(b);c.isInitialViewDropdown(d)?m.logCsm(d,"cqd"):m.logCsm(d,"ccq");setTimeout(function(){c.saveQsWidgetDropdownTopPosition(d)},250)});d.declarative(g.getQsWidgetDropdownDecl(),"click",function(b){var d=b.data.qsUID;b=b.data.id;var e=c.isActionTriggerOnSelect(d),g=c.isTextInputRequired(d,b),h=c.isConfirmationViewEnabled(d),k=c.isQsWidgetDropdownScrolled(d);h?k?(c.setQsWidgetDropdownScrolled(d),
m.logCsm(d,"dcq_scl")):(c.clearQsWidgetDropdownScrolled(d),m.logCsm(d,"dcq")):k?m.logCsm(d,"dsq_scl"):m.logCsm(d,"dsq");a.selectOption(d,b,e&&!g.result);g.result?a.showTextInput(d,g.initialQuantityText):h&&a.showConfirmation(d)});d.declarative(g.getQsWidgetDropdownItemDecl(),"click",function(b){a.alignQsItem(b.data.qsUID,b.data.id)});d.declarative(g.getQsWidgetVariationDropdownItemDecl(),"click",function(b){a.alignVariationSelectorItem(b.data.qsUID,b.data.id)});d.declarative(g.getQsWidgetDropdownDecl(),
"focusin",function(b){a.showPrice(b.data.qsUID,b.data.id)});d.declarative(g.getQsWidgetDropdownDecl(),"mouseenter",function(b){a.showPrice(b.data.qsUID,b.data.id)});d.declarative(g.getQsWidgetDropdownDecl(),"mouseleave",function(b){b=b.data.qsUID;var c=e.getQsWidgetConfiguration(b).selectedId;a.showPrice(b,c)});d.declarative(g.getQsWidgetQuantityChangelinkDecl(),"click",function(b){b=b.data.qsUID;a.showPopover(b);m.incrementChangeLinkCount();c.saveQsWidgetDropdownTopPosition(b);m.logCsm(b,"ccl")});
d.declarative(g.getQsWidgetSummaryAtcDecl(),"click",function(b){b=b.data.qsUID;a.selectConfirmation(b);c.isQsWidgetDropdownScrolled(b)?m.logCsm(b,"atc_scl"):m.logCsm(b,"atc")});d.declarative(g.getQsWidgetTextInputDecl(),"keydown",function(a){var b=a.data.qsUID,d=a.$event.which;8==d||9==d||13==d||37<=d&&40>=d||46==d||(!(48<=d&&57>=d||96<=d&&105>=d)||a.$event.shiftKey||a.$event.altKey||a.$event.ctrlKey||a.$event.metaKey?a.$event.preventDefault():3<=c.getQsWidgetTextInputElement(b).val().length&&a.$event.preventDefault())});
d.declarative(g.getQsWidgetTextInputDecl(),"keyup",function(b){var d=b.data.qsUID;c.validateQsWidgetTextInput(d)&&13==b.$event.keyCode?(b=c.isActionTriggerOnSelect(d),a.validateAndSelectQuantity(d,b)):a.showTextInput(d)});d.declarative(g.getQsWidgetTextInputDecl(),"focusout",function(b){b=b.data.qsUID;if(""===c.getQsWidgetTextInputElement(b).val()){var d;d=(d=e.getQsWidgetConfiguration(b).selectedId)?c.getQsItem(b,d).selectedText:c.getSelectedQuantity(b);a.showTextInput(b,d);c.validateQsWidgetTextInput(b)}});
d.declarative(g.getQsWidgetTextInputDecl(),"change",function(b){a.showTextInput(b.data.qsUID)});d.declarative(g.getQsWidgetTextInputUpdateButtonDecl(),"click",function(b){var d=b.data.qsUID;c.validateQsWidgetTextInput(d)&&(d=b.data.qsUID,b=c.isActionTriggerOnSelect(d),a.validateAndSelectQuantity(d,b))});d.$(document).click(function(b){0!=c.getActivatedQsWidgets().length&&(c.isUserClickInSummary(b)||a.hideAllPopover())});d.$(q).resize(function(){a.hideAllPopover()});d.on(g.getQsWidgetEventInitialize(),
function(a,b){p.initialize();if("string"==typeof b)k(a,b);else{b=e.getQsUIDs();for(var c=0;c<b.length;c++)k(a,b[c])}});d.on(g.getQsWidgetEventLoadStatesAndInitialize(),function(){for(var a=e.getQsUIDs(),b=0;b<a.length;b++){var d=a[b];c.isInitialized(d)||r(d)}});d.on(g.getQsWidgetEventConfigureEnable(),function(a){c.enableQsWidget(a)});d.on(g.getQsWidgetEventConfigureDisable(),function(a){c.disableQsWidget(a)});d.on(g.getQsWidgetEventConfigureReset(),function(a){for(var b=e.getQsUIDs(),c=0;c<b.length;c++){var h=
b[c];if("string"!==typeof a||a==h)e.loadOriginalSettings(h),d.trigger(g.getQsWidgetEventInitialize(),!0,h)}});var h=d.now();m.logLatencyMetric("JSReady",h);return{loadStateAndInitializeWidget:r}})});
/* ******** */
(function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("ConsumablesATCActionAssets",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){});
/* ******** */
(function(l){var p=window.AmazonUIPageJS||window.P,u=p._namespace||p.attributeErrors,a=u?u("QuantitySliderAssets",""):p;a.guardFatal?a.guardFatal(l)(a,window):a.execute(function(){l(a,window)})})(function(l,p,u){l.when("A").register("qs-cart-count-handler",function(a){var d=a.$,f={DEFAULT:function(g,e,b,h,f){a.post("/gp/api/cart/1.0/get-cart-count.json",{timeout:5E3,params:{sessionID:g,clientName:e},success:function(a){a&&a.isOK&&a.total?d.isFunction(h)&&h(a.total.numActiveItem):l.log("Malformed get-cart-count response for sessionId\x3d"+
g,"ERROR",b)},error:function(){l.log("Failed to retrieve get-cart-count response for sessionId\x3d"+g,"ERROR",b);d.isFunction(f)&&f()}})},UFG:function(d,a,b,h,f){}};return{getTotalCartCount:function(a,e){return(d.isFunction(f[e])?f[e]:f.DEFAULT)(a.request.sessionId,a.clientName,a.attribution,a.onSuccess,a.onError)}}});"use strict";l.when("A","quantity-slider-utils","qs-cart-update-utils").register("qs-cart-update-handler",function(a,d,f){function g(a){n||(n="quantity-slider-widget-"+a);return n}function e(a,
h){if(!h.atcFormSubmitDisabled){if((a=a.$target&&a.$target.closest(".qs-atc-form"))&&0!==a.length)return a;l.log("Missing $form object","ERROR",g(h.clientName))}}function b(b,r,f){a.trigger(d.ACTIONS.ADD_TO_CART_SUBMIT_START,{asin:b,cartType:r.cartType,clientName:r.clientName,isQSAction:f,request:r});h(b,r,!0,f)}function h(h,b,e,c){var q=b.cartType,n=JSON.stringify(c?f.getQSRequestObject(b,e,q):f.getATCRequestObject(b,q)),m=f.getAjaxUrl(b,e,q);m&&k.ajax({url:m,type:f.getHttpMethodType(e,q),data:n,
headers:f.getHeadersForRequest(b,e,q),xhrFields:{withCredentials:!0},success:function(m,q,k){m.jqXHR=k;delete t[h];(m=f.adaptResponseObject(m,b,e,b.cartType))?(d.setUpdatedQSParamsForAsin(h,{quantityInCart:m.quantity,cartItemId:m.itemId}),a.trigger(e?d.ACTIONS.ADD_TO_CART_SUBMIT_SUCCESS:d.ACTIONS.REMOVE_FROM_CART_SUBMIT_SUCCESS,{asin:h,cartType:b.cartType,request:b,response:m,clientName:b.clientName,attribution:g(b.clientName),isQSAction:c,isDecreaseQuantityAction:!e}),d.logUrl(b.loggingUrl)):l.log("Invalid Response from the server",
"ERROR",g(b.clientName))},error:function(m){delete t[h];m=m||{};l.log("Ajax request failed with type: "+(e?"addItems":"modifyItems")+", status code: "+m.status+", error: "+m.responseText,"ERROR",g(b.clientName));a.trigger(d.ACTIONS.QS_CART_SUBMIT_ERROR,{asin:h,cartType:q,clientName:b.clientName,isQSAction:c,isDecreaseQuantityAction:!e,isMaxOrderQuantityReached:b.quantityInCart>=b.maxOrderQuantity,response:m,request:b});e&&b.$form&&b.$form.submit()}})}var k=a.$,n="",t={};a.declarative("qs-add-to-cart-trigger",
"click",function(a){var h=a.data&&a.data.asin,f=d.getQSParamsForAsin(h);a.$event&&a.$event.preventDefault();t[h]||(t[h]=!0,f.isMultipleAsinsSubmitting=1<Object.keys(t).length,f.$form=e(a,f),f.triggeringEvent=a,b(h,f,!1))});a.declarative("qs-slider-widget-trigger","click",function(f){var g=f.data&&f.data.asin,k=d.getQSParamsForAsin(g),c=f.$target[0]&&f.$target[0].className||"",q=a.contains(c,"qs-increase-quantity")||a.contains(c,"qs-decrease-quantity"),c=a.contains(c,"qs-decrease-quantity");f.$event&&
f.$event.preventDefault();q&&!t[g]&&(t[g]=!0,k.isMultipleAsinsSubmitting=1<Object.keys(t).length,k.triggeringEvent=f,c?(a.trigger(d.ACTIONS.REMOVE_FROM_CART_SUBMIT_START,{asin:g,cartType:k.cartType,clientName:k.clientName,isQSAction:!0,isDecreaseQuantityAction:!0,request:k}),h(g,k,!1,!0)):(k.$form=e(f,k),b(g,k,!0)))});return{setAttribution:function(b){n=b}}});"use strict";l.when("A","qs-fresh-cart-update-utils","ready").register("qs-cart-update-utils",function(a,d){function f(c){var b=c.quantityInCart||
0;return{items:[{asin:c.asinId,offerListingId:c.offerListingId,quantity:b<c.minOrderQuantity?c.minOrderQuantity-b:1}]}}function g(c,b,a){return(e.isFunction(b[a])?b[a]:b.DEFAULT)(c)}var e=a.$,b={DEFAULT:f,UFG:d.getUfgCartRequestObject},h={DEFAULT:f,UFG:d.getUfgCartRequestObject},k={DEFAULT:function(c){var b=c.quantityInCart||0,a;a=c.cartItemId;a=!a||"C"!==a[0]&&"S"!==a[0]?a:a.substring(1);return{items:[{id:a,quantity:b<=c.minOrderQuantity?0:b-1}]}},UFG:d.getUfgCartRequestObject},n={DEFAULT:function(c){return c.ajaxCartUrl},
UFG:function(c){return c.addToCartUrl}},l={DEFAULT:function(c){return c.ajaxCartUrl}},p={DEFAULT:function(c){return(c=c.entity&&c.entity.items&&c.entity.items[0])?{itemId:c.id,quantity:c.quantity,isTotal:!0}:null},UFG:d.ufgCartResponseAdapter},r={DEFAULT:function(c,b){c=(b.quantityInCart||0)-1;return 0>c?null:{itemId:c?b.cartItemId:"",quantity:c,isTotal:!0}},UFG:d.ufgCartResponseAdapter},u={DEFAULT:"POST",UFG:"POST"},c={DEFAULT:"PUT",UFG:"POST"},q={DEFAULT:function(c){return{"x-api-csrf-token":c.csrfToken,
Accept:'application/vnd.com.amazon.api+json; type\x3d"cart.add-items/v1"',"Content-Type":'application/vnd.com.amazon.api+json; type\x3d"cart.add-items.request/v1"'}},UFG:function(c){return{"Content-Type":"application/json"}}},w={DEFAULT:function(c){return{"x-api-csrf-token":c.csrfToken,Accept:'application/vnd.com.amazon.api+json; type\x3d"cart.modify-items/v1"',"Content-Type":'application/vnd.com.amazon.api+json; type\x3d"cart.modify-items.request/v1"'}},UFG:function(c){return{"Content-Type":"application/json"}}};
return{getATCRequestObject:function(c,a){return g(c,b,a)},getQSRequestObject:function(c,b,a){return g(c,b?h:k,a)},adaptResponseObject:function(c,b,a,h){a=a?p:r;return(e.isFunction(a[h])?a[h]:a.DEFAULT)(c,b)},getHttpMethodType:function(b,a){b=b?u:c;return b[a]?b[a]:b.DEFAULT},getHeadersForRequest:function(c,b,a){b=b?q:w;return(e.isFunction(b[a])?b[a]:b.DEFAULT)(c)},getAjaxUrl:function(c,b,a){return g(c,b?n:l,a)}}});"use strict";l.when("A","ready").register("qs-fresh-cart-update-utils",function(a){function d(a,
d){return d&&d.items?d.items.find(function(d){return d.ASIN===a}):null}return{getUfgCartRequestObject:function(a){return a.additionalInput},ufgCartResponseAdapter:function(a,g){return(g=d(g.asinId,a.clientResponseModel))?{itemId:g.itemId,quantity:g.quantity,isTotal:!0,rawResponse:a}:{itemId:"invalidItemId",quantity:0,isTotal:!0,rawResponse:a}}}});"use strict";l.when("A","quantity-slider-utils").register("quantity-slider-metrics-handler",function(a,d){function f(a,b){return"QuantitySliderWidget::"+
a+"::"+(b?b+"::":"")}function g(b){var a=p.ue;"undefined"!==typeof a&&a.count(b,1)}function e(a,e){d.assert(a&&e.clientName,"Missing required properties while logging metrics");var n=e.isQSAction?e.isDecreaseQuantityAction?b.QS_DECREASE:b.QS_INCREASE:b.ATC;a=f(e.clientName,e.cartType)+a+"::"+n;g(a)}var b={ATC:"ATC",QS_INCREASE:"QSIncrease",QS_DECREASE:"QSDecrease"};return{logRequestStartMetrics:function(a){e("CountStart",a)},logRequestSuccessMetrics:function(a){e("CountSuccess",a)},logRequestErrorMetrics:function(a){e("CountError",
a)},logMaxQuantityReachedMetric:function(a){a=f(a.clientName,a.cartType)+"MaxQuantityReached";g(a)},logMultipleAsinsSubmittingMetric:function(a){a=f(a.clientName,a.cartType)+"MultipleAsinsSubmitting";g(a)}}});"use strict";l.when("A","quantity-slider-utils","qs-cart-update-handler","quantity-slider-metrics-handler").register("quantity-slider-widget",function(a,d,f,g){function e(c){return"."+c+"-qs-slider-button"}function b(c,a){c=e(c)+" .qs-decrease-quantity";a?d.disableButton(c):d.enableButton(c)}
function h(c,a){c=e(c)+" .qs-increase-quantity";a?d.disableButton(c):d.enableButton(c)}function k(c,a){c="."+c+"-qs-add-to-cart-button .qs-slider-atc-button";a?d.disableButton(c):d.enableButton(c)}function n(c){c.isQSAction&&(c.isDecreaseQuantityAction?d.deselectButton(e(c.asin)+" .qs-decrease-quantity"):d.deselectButton(e(c.asin)+" .qs-increase-quantity"))}function l(c){d.toggleDomNodeVisibility("."+c.asin+"-qs-slider-spinner",!1);var a=c.asin;c.isQSAction?(b(a,!1),h(a,!1)):k(a,!1);n(c);d.assert(c.asin&&
c.request&&c.response&&c.response.quantity!==u,"Required properties missing in payload object for UpdateQSWidget");r(c.asin,c.response.quantity,c.request.maxOrderQuantity);c.request.enableQuantityLimitMessage&&d.toggleDomNodeVisibility("."+c.asin+"-qs-quantity-limit-message",c.response.quantity>=c.request.maxOrderQuantity);d.updateTotalCartCountOnUI(c,c.cartType);g.logRequestSuccessMetrics(c)}function p(a){d.toggleDomNodeVisibility("."+a.asin+"-qs-slider-spinner",!0);var e=a.asin;a.isQSAction?(b(e,
!0),h(e,!0)):k(e,!0);g.logRequestStartMetrics(a);a.request&&a.request.isMultipleAsinsSubmitting&&g.logMultipleAsinsSubmittingMetric(a)}function r(a,b,f){var g="."+a+"-qs-add-to-cart-button",k=e(a);0<b?(d.changeATCtoQS(g,k),g=v("."+a+"-qs-qty-present-in-cart"),Number.isInteger(b)&&g.html(b),h(a,b>=f)):(d.changeQStoATC(g,k),h(a,!1))}var v=a.$;Number.isInteger||(Number.isInteger=function(a){return"number"===typeof a&&isFinite(a)&&-9007199254740992<a&&9007199254740992>a&&Math.floor(a)===a});a.on(d.ACTIONS.ADD_TO_CART_SUBMIT_START,
function(a){p(a)});a.on(d.ACTIONS.ADD_TO_CART_SUBMIT_SUCCESS,function(a){setTimeout(function(){l(a)},1500);a.response.quantity===a.request.maxOrderQuantity&&g.logMaxQuantityReachedMetric(a)});a.on(d.ACTIONS.REMOVE_FROM_CART_SUBMIT_START,function(a){p(a)});a.on(d.ACTIONS.REMOVE_FROM_CART_SUBMIT_SUCCESS,function(a){setTimeout(function(){l(a)},1500)});a.on(d.ACTIONS.QS_CART_SUBMIT_ERROR,function(a){d.toggleDomNodeVisibility("."+a.asin+"-qs-slider-spinner",!1);if(a.isQSAction&&a.isMaxOrderQuantityReached)b(a.asin,
!1);else{var e=a.asin;a.isQSAction?(b(e,!1),h(e,!1)):k(e,!1)}n(a);g.logRequestErrorMetrics(a)});return{ACTIONS:d.ACTIONS,CART_IDEMPOTENT_REQUEST_DELAY:1500,setAttribution:f.setAttribution,updateQuantitySliderWidget:r}});"use strict";l.when("A","qs-cart-count-handler","a-button").register("quantity-slider-utils",function(a,d,f){function g(a){return e("."+a+"-qs-slider-data").first().data("qs-model")}var e=a.$;return{ACTIONS:{ADD_TO_CART_SUBMIT_START:"quantity-slider:add-to-cart-start",ADD_TO_CART_SUBMIT_SUCCESS:"quantity-slider:add-to-cart-success",
REMOVE_FROM_CART_SUBMIT_START:"quantity-slider:remove-from-cart-start",REMOVE_FROM_CART_SUBMIT_SUCCESS:"quantity-slider:remove-from-cart-success",QS_CART_SUBMIT_ERROR:"quantity-slider:cart-submit-error"},assert:function(a,d){if(!a)throw Error(d);},changeATCtoQS:function(b,d){e(b).hasClass("aok-hidden")||(a.hide(b),a.show(d))},changeQStoATC:function(b,d){e(d).hasClass("aok-hidden")||(a.hide(d),a.show(b))},disableButton:function(a){f(e(a)).disable()},deselectButton:function(a){a=f(e(a));a.isEnabled()&&
a.setStatus("normal")},enableButton:function(a){f(e(a)).enable()},getQSParamsForAsin:g,setUpdatedQSParamsForAsin:function(b,d){var f=g(b);e("."+b+"-qs-slider-data").data(a.extend(f,d))},toggleDomNodeVisibility:function(b,d){d?a.show(b):a.hide(b)},updateTotalCartCountOnUI:function(b,f){b=a.extend({},b);b.onSuccess=function(a){p.$Nav&&p.$Nav.when("api.setCartCount").run(function(b){b(a)});l.when("mash").execute("quantity-slider-mash-update",function(b){b.cart&&e.isFunction(b.cart.didUpdate)&&b.cart.didUpdate({newCartQuantity:a})})};
d.getTotalCartCount(b,f)},logUrl:function(b){b&&a.post(b)}}})});
/* ******** */
(function(d){var f=window.AmazonUIPageJS||window.P,r=f._namespace||f.attributeErrors,b=r?r("ALMCartActionAssets",""):f;b.guardFatal?b.guardFatal(d)(b,window):b.execute(function(){d(b,window)})})(function(d,f,r){d.when("A").register("alm-cart-action-query-string-utils",function(b){function c(c,m){var h=e(c),g=a(c);h?m["discoveredAsins.0"]=c.asin:g&&(c=b.filter(c.items,function(a){return e(a)}),c=b.map(c,function(a){return a.asin}),b.each(c,function(a,e){m["discoveredAsins."+e.toString()]=a}));return m}
function a(a){return a&&a.items&&b.$.isArray(a.items)&&0<a.items.length}function e(a){return a&&a.asin&&"string"===typeof a.asin&&""!==a.asin}return{addQueryStringParamsToUrl:function(a,e){var h={};if(e&&e.reftag){var g=e.reftag;"string"===typeof g&&""!==g&&(h.ref_=g)}if(e&&e.queryLogInfoParams){var g=e.queryLogInfoParams,k;for(k in g)g.hasOwnProperty(k)&&"string"===typeof k&&""!==k&&"string"===typeof g[k]&&""!==g[k]&&(h[k]=g[k])}c(e,h);(e=b.$.param(h))&&"string"===typeof e&&""!==e&&(a+="?"+e);return a}}});
"use strict";d.when("A","jQuery").register("afx-add-all-helper",function(b,c){return{updateQuantityForAsin:function(a,e,b){a&&e&&!isNaN(b)&&c("#"+a).closest("form").find("#afx-add-all-"+e+"-quantity").attr("value",b)}}});"use strict";d.when("A","jQuery","a-button").register("fx-atfc-button-utils",function(b,c,a){function e(a){return"atfc-spinner-"+(a.asin?a.asin:a.clientId?a.clientId:"noAsin")}var q=!1;return{hideButtonAndRenderSpinner:function(a){var b=a.$currentTarget.find(".a-button");b&&b.length&&
(q=!0,a=e(a.data),b.wrap('\x3cdiv id\x3d"'+a+'" class\x3d"atfc-spinner"\x3e\x3c/div\x3e'),c("#"+a).css({width:b.outerWidth()+"px"}),c("#"+a).css({height:b.outerHeight()+"px"}),b.css("visibility","hidden"))},showButtonAndRemoveSpinner:function(a){var b=a.$currentTarget.find(".a-button");a=e(a.data);a=c("#"+a);b&&b.length&&a&&a.length&&(q=!1,b.css("visibility","visible"),b.unwrap())},shouldDisableButtonClicks:function(){return q}}});"use strict";d.when("fresh-shared-add-to-cart-v2","qs-fresh-shared-add-to-cart").register("fresh-add-to-cart",
function(b,c){function a(a){b.attachCallbacks(a)}b.initialize("desktop");c.initialize("desktop");return{addToFreshCart:function(b){a(b)},attachCallbacks:a,updateAddAllQuantityForAsin:b.updateAddAllQuantityForAsin,updateQuantity:b.updateQuantity}});"use strict";d.when("shared-alm-multi-add-to-cart").register("alm-multi-add-to-cart",function(b){function c(a){b.attachCallbacks(a)}b.initialize("desktop");return{multiAddToCart:function(a){c(a)},attachCallbacks:c,attachPreHandler:function(a){b.attachPreHandler(a)}}});
"use strict";d.when("A","alm-cart-action-query-string-utils").register("afx-atfc-v2-proxy",function(b,c){return{addToFreshCart:function(a){var e=c.addQueryStringParamsToUrl("/alm/addtofreshcart",a.data);b.$.ajax(e,{type:"POST",contentType:"application/json",data:JSON.stringify(a.data)}).done(a.success).fail(a.error)},showGenericErrorModal:function(a){b.post("/alm/atfcGenericErrorModal/",{timeout:5E3,success:a.success,error:a.error})}}});"use strict";d.when("A").register("fx-atfo-proxy",function(b){return{addToFreshOrder:function(c){var a=
"/fom/add-to-fresh-order";c.reftag!==r&&(a+="/ref\x3d"+c.reftag);c.data!==r&&c.data.csrfToken&&(a+="?csrf\x3d"+encodeURIComponent(c.data.csrfToken));b.post(a,{success:c.success,error:c.error,params:JSON.stringify(c.data),paramsFormat:"json",contentType:"application/json"})},getFallbackErrorModalHtml:function(){return{header:"Item was not added to the order",errorMessage:"We're sorry, there was an error and \x3cb\x3ethis item was not added to your order.\x3c/b\x3e Please try again.",footer:"\x3cspan class\x3d'a-declarative' data-action\x3d'a-popover-close'data-a-popover-close\x3d'{}'\x3e\n\x3cspan class\x3d'a-button primary-fresh-btn'\x3e\x3cspan class\x3d'a-button-inner'\x3e\x3cinput class\x3d'a-button-input'type\x3d'submit'\x3e\x3cspan class\x3d'a-button-text' aria-hidden\x3d'true'\x3eOK\n\x3c/span\x3e\x3c/span\x3e\x3c/span\x3e\n\x3c/span\x3e"}}}});
"use strict";d.when("A").register("afx-atfc-cart-conflicts-proxy",function(b){function c(a){a.ref=a.reftag;a.client="atfc";return a}return{getConflictSummary:function(a){var e=c(a.data);b.post("/afx/cartconflicts/getconflictsummary",{timeout:5E3,success:a.success,error:a.error,params:e})},resolve:function(a){var e=c(a.data);b.post("/afx/cartconflicts/resolve",{timeout:5E3,success:a.success,error:a.error,params:e})},substitute:function(a){a=c(a.data);a.sourceUrl=f.location.pathname+f.location.search;
a=b.$.param(a);f.location.href="/afx/cartconflicts/resolve/substitute?"+a}}});"use strict";d.when("A").register("afx-get-cart-count",function(b){return function(c){b.post("/gp/api/cart/1.0/get-cart-count.json",{timeout:5E3,params:{sessionID:c.sessionID,clientName:"SharedFreshHandler"},success:c.success,error:c.error})}});"use strict";d.when("A","alm-cart-action-query-string-utils").register("alm-multi-add-to-cart-proxy",function(b,c){return{multiAddToCart:function(a){var e=c.addQueryStringParamsToUrl("/alm/addtocart/multiple",
a.data);b.$.ajax(e,{type:"POST",contentType:"application/json",data:JSON.stringify(a.data)}).done(a.success).fail(a.error)}}});"use strict";d.register("afx-callbacks-helper",function(b){function c(b){var c=b in a;!c&&d.log("Unable to retrieve callback for "+b,"Error");return c}var a={};return{addCallbacks:function(b){a[b.clientID||"default"]=b},success:function(b,d,m){b=b in a?b:"default";c(b)&&a[b].success&&a[b].success(d,m)},error:function(b,d,m,h){b=b in a?b:"default";c(b)&&a[b].error&&a[b].error(d,
m,h)}}});"use strict";d.register("afx-preHandler-helper",function(b){var c={};return{addPreHandler:function(a){c[a.clientID||"default"]=a},getPreHandler:function(a){return c[a]}}});"use strict";d.register("afx-csm-metrics-utils",function(){var b={},c=function(a,b){f.ue&&f.ue.count&&a&&b&&f.ue.count(a,b)};return{startWidgetTimer:function(a){b[a]=Date.now()},endWidgetTimer:function(a,e){a=Date.now()-b[a];c(e,a)},setWidgetClickTimestamp:function(a){f.ue&&f.uet&&a&&f.uet("tc",a,{wb:1})},setWidgetTimestamp:function(a,
b){f.ue&&f.uet&&a&&b&&f.uet(a,b,{wb:1})},increment:function(a){f.ue&&f.ue.count&&a&&f.ue.count(a,(f.ue.count(a)||0)+1)},setCount:c,sendWidgetMetrics:function(a){f.ue&&f.uex&&a&&f.uex("ld",a,{wb:1})}}});"use strict";d.register("add-to-cart-common-utils",function(){return{vibrate:function(){return f.amazon&&f.amazon.cordova&&f.amazon.cordova.notification&&f.amazon.cordova.notification.vibrate&&f.amazon.cordova.notification.vibrate(50)}}});"use strict";d.when("A","a-modal").register("fresh-atfc-modal-utils",
function(b,c){return{removeModal:function(){var a=c.get("fresh-add-to-cart-modal");a&&c.remove(a)},showModal:function(a,e,d){e&&(e={name:"fresh-add-to-cart-modal",header:e.header,inlineContent:e.body,footer:e.footer},"desktop"===d&&(e.width=325),c.create(a.$currentTarget,e).show(),b.on("a:popover:afterHide:".concat("fresh-add-to-cart-modal"),function(a){c.remove(a.popover)}))}}});"use strict";d.when("A","jQuery","afx-atfc-v2-proxy","afx-csm-metrics-utils","afx-metrics-helper","afx-quantity-helper",
"fresh-atfc-ewc-helper").register("fresh-atfc-error-modal-utils",function(b,c,a,e,q,f,h){function g(a,c,e,g){d.when("a-modal").execute("showModal",function(d){c||k(a);a.data.quantity&&(f.updateQuantity("fresh-clear-slot-button",a.data.quantity),f.updateQuantity("alcohol-warning-fresh-add-to-cart-button",a.data.quantity));var n={name:"fresh-add-to-cart-error-modal",header:c.header,inlineContent:c.errorMessage,footer:c.footer,data:{event:a,response:g}};"desktop"===e&&(n.width=325);d.create(a.$currentTarget,
n).show();b.on("a:popover:afterHide:".concat("fresh-add-to-cart-error-modal"),function(b){h.refreshCart(a.data.sessionID);d.remove(b.popover)})})}function k(b,e){a.showGenericErrorModal({success:function(a,k,d){a&&(a=c.parseJSON(d.http.response),n(b,a,e))},error:function(){d.log("Failed to get the generic error modal","Error");g(b,{header:"Item was not added to the cart",errorMessage:"We're sorry, there was an error and \x3cb\x3ethis item was not added to your cart.\x3c/b\x3e Please try again.",footer:'\x3cspan class\x3d"a-declarative" data-action\x3d"a-popover-close"data-a-popover-close\x3d"{}"\x3e\n\x3cspan class\x3d"a-button primary-fresh-btn"\x3e\x3cspan class\x3d"a-button-inner"\x3e\x3cinput class\x3d"a-button-input"type\x3d"submit"\x3e\x3cspan class\x3d"a-button-text" aria-hidden\x3d"true"\x3eOK\n    \x3c/span\x3e\x3c/span\x3e\x3c/span\x3e\n\x3c/span\x3e'},
e)}})}function n(a,b,c){var k=b.errorModalHtml,d=q.getMetricsForDevice(c);b.clientResponseModel&&b.clientResponseModel.uberCartStatus&&b.clientResponseModel.uberCartStatus.errorStatusCode in d&&e.increment(d[b.clientResponseModel.uberCartStatus.errorStatusCode]);g(a,k,c,b)}return{removeModal:function(){d.when("a-modal").execute("removeModal",function(a){var b=a.get("fresh-add-to-cart-error-modal");b&&a.remove(b)})},showModal:g,showGenericErrorModal:k,parseResponseAndShowErrorModal:n}});"use strict";
d.when("A","jQuery","afx-atfc-v2-proxy","afx-get-cart-count").register("fresh-atfc-ewc-helper",function(b,c,a,e){function q(a){e({sessionID:a,success:function(a){a&&a.isOK&&a.total&&f(a.total.numActiveItem)},error:function(){d.log("Failed to get cart count","Error",a)}})}function f(a){d.when("nav.setCartCount").execute(function(b){b(a)});d.when("mash").execute(function(b){b.cart&&"function"===typeof b.cart.didUpdate&&b.cart.didUpdate({newCartQuantity:a})})}var h;d.when("EWC").execute("add-to-cart-refresh",
function(a){h=a});d.when("nav.getFlyout").execute(function(a){a("ewc")});return{refreshCart:function(a){h!==r&&"function"===typeof h.refresh?h.refresh():q(a)}}});"use strict";d.when("A","afx-storeIntroductionSheet-helper","afx-cpi-helper").register("f3-consumables-atc-helper",function(b,c,a){return{handleAddToCart:function(e,d,f){d.storeIntroductionSheetHtml&&d.storeIntroductionSheetHtml.content?c.render(e,d,f):d.renderUFGCartProgressIndicator?a.render(e):b.trigger("fresh-atfc:success","false",{almBrandId:e.brandId})}}});
"use strict";d.register("afx-metrics-helper",function(){var b={ATFC_COUNT:"afxAddToFreshCartCount",ALM_MULTI_ATC_COUNT:"almMultiAddToCartCount",ATFC_SUCCESSFUL_ADD_COUNT:"afxAddToFreshCartSuccessfulAddCount",ALM_MULTI_ATC_COUNT_SUCCESS:"almMultiAddToCartCountSuccess",ATFC_ERROR_MODAL_COUNT:"afxAddToFreshCartErrorModalCount",ALM_MULTI_ATC_COUNT_ERROR_MODAL:"almMultiAddToCartCountErrorModal",ATFC_UNEXPECTED_ERROR_COUNT:"afxAddToFreshCartUnexpectedErrorCount",ALM_MULTI_ATC_COUNT_ERROR_UNEXPECTED:"almMultiAddToCartCountErrorUnexpected",
ATFC_LATENCY_SCOPE:"afxAddToFreshCartLatencyScope",ATFC_ERROR_MODAL_LATENCY_SCOPE:"afxAddToFreshCartErrorModalLatencyScope",ATFC_CTCF:"afxAddToFreshCartCTCF",ATFC_STORE_INTRODUCTION_SHEET:"afxStoreIntroductionSheet",ATFC_OCX_STORE_INTRODUCTION_SHEET:"afxOfferComparisonStoreIntroductionSheet",CLEAR_SLOT_ATFC_CTCF:"afxClearSlotAndAddToFreshCartCTFC",CART_SERVICE_RESPONSE_FALSE:"afxCartServiceResponseIsNotOKErrorCount",ITEM_NOT_AVAILABLE:"afxItemNotAvailableErrorModalCount",ITEM_PARTIALLY_AVAILABLE:"afxItemPartiallyAvailableErrorModalCount",
ITEM_PARTIALLY_AVAILABLE_FOR_RESERVATION:"afxItemPartiallyAvailableErrorModalCount",ADDRESS_NOT_SELECTED:"afxAddressNotSelectedErrorCount",INPUT_INVALID:"afxGeneralErrorModalCount",ITEM_NOT_AVAILABLE_FOR_RESERVATION:"afxItemNotAvailableForReservationErrorModalCount",INTERNAL_SERVER_ERROR:"afxGeneralErrorModalCount",PRICE_UNAVAILABLE:"afxItemNotAvailableErrorModalCount",QUANTITY_OVERFLOW:"afxUniqueItemQuantityOverflowErrorModalCount"};return{getMetricsForDevice:function(c){var a={};Object.keys(b).forEach(function(e){a[e]=
b[e]+":"+c});return a}}});"use strict";d.when("A").register("afx-quantity-helper",function(b){var c={};return{updateQuantity:function(a,b){"undefined"!==typeof a&&null!==a&&!isNaN(b)&&0<b&&(c[a]=b||1)},getQuantity:function(a){a=a.closest(".a-button");return 0<a.length?c[a.attr("id")]||1:1}}});"use strict";d.when("A","afx-csm-metrics-utils","afx-metrics-helper").register("afx-storeIntroductionSheet-helper",function(b,c,a){function e(a,b){var c=b?400:190;d.when("a-sheet").execute(function(e){e.create({inlineContent:a,
closeType:"icon",height:c}).show();f("mobile",b)})}function f(b,e){b=a.getMetricsForDevice(b);e?c.increment(b.ATFC_OCX_STORE_INTRODUCTION_SHEET):c.increment(b.ATFC_STORE_INTRODUCTION_SHEET)}function m(){b.show(b.$("#sis-background"));b.$("body").css({overflow:"hidden"});b.$("#offer-comparison-store-introduction-side-sheet-container").show(function(){g({right:"0px"})});f("desktop",!0)}function h(){var a=b.$("#offer-comparison-store-introduction-side-sheet-container").width()+30;g({right:"-"+a+"px"},
function(){b.$("#offer-comparison-store-introduction-side-sheet-container").remove()});b.$("body").css({overflow:"scroll"});b.hide(b.$("#sis-background"));b.$("#offer-comparison-store-introduction-side-sheet-background-container").remove()}function g(a,c){b.animate(b.$("#offer-comparison-store-introduction-side-sheet-container"),a,300,"ease-out",c)}b.declarative("close-offer-comparison-store-introduction-side-sheet","click",function(a){h()});return{render:function(a,c,d){c=c.storeIntroductionSheetHtml.content;
a=a.additionalParams&&a.additionalParams.shouldRenderSIS;"mobile"===d?e(c,a):"desktop"===d&&(b.$("body").append(c),m())}}});"use strict";d.when("A").register("afx-cpi-helper",function(b){return{render:function(c){b.trigger("consumables-atc:success",{atcAction:{ASIN:c.asin,numberOfItems:c.quantity,operationType:"ADDED"},programDetails:{programType:"UFG",brandId:c.brandId,storeId:c.storeId},requestOverrides:{responseType:"HTML","cart-progress-indicator":{messageType:"topsheet"}}})}}});"use strict";
d.when("A","afx-atfc-cart-conflicts-proxy").register("afx-atfc-cart-conflicts-executor",function(b,c){return{execute:function(a){c.getConflictSummary({data:a.data,success:function(e,d,f){!0===e.isSuccess?!0===e.hasConflicts?c.substitute({data:a.data}):c.resolve({data:a.data,success:function(){b.trigger("fresh-cart-conflict-resolution:success");location.reload()},error:a.error}):a.error(f,d,"Failed to call getconflictsummary")},error:a.error})}}});"use strict";d.when("A","afx-atfc-v2-proxy","fx-atfo-proxy",
"fx-atfc-button-utils","afx-csm-metrics-utils","afx-metrics-helper","afx-quantity-helper","afx-callbacks-helper","afx-atfc-cart-conflicts-executor","fresh-atfc-error-modal-utils","fresh-atfc-ewc-helper","afx-add-all-helper","f3-consumables-atc-helper","add-to-cart-common-utils").register("fresh-shared-add-to-cart-v2",function(b,c,a,e,f,m,h,g,k,n,x,l,y,t){return{updateQuantity:h.updateQuantity,attachCallbacks:g.addCallbacks,updateAddAllQuantityForAsin:l.updateQuantityForAsin,initialize:function(l){function w(a){return a.isItemSoldByCount?
!JSON.parse(a.isItemSoldByCount):a.pickingStrategy?"bulk"===a.pickingStrategy||"catch"===a.pickingStrategy:!1}function p(a,b,d,k){t.vibrate();a.data.amountInUom===r&&w(a.data)&&(a.data.amountInUom=a.data.quantity,a.data.quantity=1);c.addToFreshCart({data:a.data,success:function(c,k,h){200===h.status&&(f.increment(u.ATFC_SUCCESSFUL_ADD_COUNT),k=u.ATFC_CTCF+":lineItemBucket:"+z(c),f.endWidgetTimer(b,k),x.refreshCart(a.data.sessionID),g.success(a.data.clientID,a,c.clientResponseModel),y.handleAddToCart(a.data,
c,l));n.removeModal();e.showButtonAndRemoveSpinner(a);d&&d()},error:function(c,d,h){var w=u.ATFC_CTCF,m=c.responseText,p;n.removeModal();m&&(p=JSON.parse(m),w=u.ATFC_CTCF+":lineItemBucket:"+z(p.clientResponseModel));400===c.status&&p?(f.increment(u.ATFC_ERROR_MODAL_COUNT),n.parseResponseAndShowErrorModal(a,p,l)):403===c.status?location.reload():(f.increment(u.ATFC_UNEXPECTED_ERROR_COUNT),n.showGenericErrorModal(a,l),g.error(a.data.clientID,a,c,d,h));f.endWidgetTimer(b,w);e.showButtonAndRemoveSpinner(a);
k&&k()}})}function A(a,c){f.startWidgetTimer(c);b.post("/afx/slotselection/cancel",{timeout:5E3,params:{token:a.data.additionalParams.csrfToken},success:function(){a.data.quantity=h.getQuantity(a.$target);p(a,c,function(){location.reload()})},error:function(){d.log("Failed to clear reservation");n.showGenericErrorModal(a,l)}})}function z(a){return a.items&&Math.ceil(a.items.length/5)}var u=m.getMetricsForDevice(l),v=u.ATFC_LATENCY_SCOPE+Date.now();b.on("quantity-selector-widget:action:AddToCartAction",
function(a){a.additionalParams&&(a.additionalParams=b.$.parseJSON(a.additionalParams));a.queryLogInfoParams&&(a.queryLogInfoParams=b.$.parseJSON(a.queryLogInfoParams));var c={data:a};if(a.tunneledData&&a.tunneledData.$target){var d=a.tunneledData.$target,c=b.$.extend(c,{$target:d,$currentTarget:d,$declarativeTarget:d});delete a.tunneledData}else a=b.$("#qs-widget-button-container-"+a.qsUID),c=b.$.extend(c,{$target:a,$currentTarget:a,$declarativeTarget:a}),e.hideButtonAndRenderSpinner(c);p(c,v)});
b.declarative("fresh-clear-slot","click",function(a){a.$currentTarget.context.disabled=!0;A(a,v)});b.declarative("fresh-add-to-cart","click",function(a){f.startWidgetTimer(v);f.increment(u.ATFC_COUNT);e.shouldDisableButtonClicks()||a.$currentTarget.find("input").is(":disabled")||(e.hideButtonAndRenderSpinner(a),a.data.qsUID?b.trigger("quantity-selector-widget:triggerAction",a.data.qsUID,"AddToCartAction",{$target:a.$currentTarget}):(a.data.quantity=h.getQuantity(a.$target),p(a,v)))});b.declarative("fresh-add-to-cart-alcohol",
"click",function(a){a.$currentTarget.context.disabled=!0;f.startWidgetTimer(v);a.data.quantity=h.getQuantity(a.$target);p(a,v)});b.declarative("fresh-add-to-cart-regions-resolve","click",function(a){a.$currentTarget.context.disabled=!0;n.removeModal();k.execute({data:a.data,error:function(b,c,e){n.showGenericErrorModal(a,l);g.error(a.data.clientID,a,b,c,e)}})});b.declarative("fresh-add-to-order","click",function(b){e.shouldDisableButtonClicks()||(e.hideButtonAndRenderSpinner(b),t.vibrate(),a.addToFreshOrder({data:b.data,
success:function(a,c,d){200===d.http.status&&g.success(b.data.clientID,b,a.clientResponseModel);e.showButtonAndRemoveSpinner(b)},error:function(c,d,f){n.removeModal();if(400===c.http.status)c=JSON.parse(c.responseText),n.parseResponseAndShowErrorModal(b,c,l);else if(401===c.http.status)location.reload();else{var k=a.getFallbackErrorModalHtml();n.showModal(b,k,l);g.error(b.data.clientID,b,c,d,f)}e.showButtonAndRemoveSpinner(b)}}))})}}});"use strict";d.when("A","alm-multi-add-to-cart-proxy","fx-atfc-button-utils",
"afx-csm-metrics-utils","afx-metrics-helper","afx-callbacks-helper","afx-preHandler-helper","fresh-atfc-error-modal-utils","fresh-atfc-ewc-helper","f3-consumables-atc-helper","add-to-cart-common-utils").register("shared-alm-multi-add-to-cart",function(b,c,a,e,d,f,h,g,k,n,x){return{attachCallbacks:f.addCallbacks,attachPreHandler:h.addPreHandler,initialize:function(l){function y(b,d,h,q){x.vibrate();c.multiAddToCart({data:b.data,success:function(c,d,p){200===p.status&&(e.increment(t.ALM_MULTI_ATC_COUNT_SUCCESS),
k.refreshCart(b.data.sessionID),f.success(b.data.clientId,b,c),n.handleAddToCart(b.data,c,l));g.removeModal();a.showButtonAndRemoveSpinner(b);h&&h()},error:function(c,d,k){a.showButtonAndRemoveSpinner(b);var h;g.removeModal();c.responseText&&(h=JSON.parse(c.responseText));400===c.status&&h?(e.increment(t.ALM_MULTI_ATC_COUNT_ERROR_MODAL),g.parseResponseAndShowErrorModal(b,h,l)):403===c.status?location.reload():(e.increment(t.ALM_MULTI_ATC_COUNT_ERROR_UNEXPECTED),g.showGenericErrorModal(b,l));f.error(b.data.clientId,
b,c,d,k);q&&q()}})}var t=d.getMetricsForDevice(l),r=t.ATFC_LATENCY_SCOPE+Date.now();b.declarative("alm-multi-add-to-cart","click",function(b){e.increment(t.ALM_MULTI_ATC_COUNT);var c=h.getPreHandler(b.data.clientId);c&&c.preHandle&&(c=c.preHandle(b))&&(b=c);c=b.$currentTarget.find("input");!b.data.items||1>b.data.items.length||a.shouldDisableButtonClicks()||c.is(":disabled")||(a.hideButtonAndRenderSpinner(b),y(b,r))})}}});d.when("A","f3-consumables-atc-helper","fresh-atfc-ewc-helper","afx-callbacks-helper",
"fresh-atfc-error-modal-utils","add-to-cart-common-utils").register("qs-fresh-shared-add-to-cart",function(b,c,a,e,d,f){return{initialize:function(h){function g(b){var f=b.response.rawResponse,g=f.jqXHR,l=b.request,m=l.triggeringEvent;m.data=l.additionalInput;200===g.status&&(a.refreshCart(l.sessionId),e.success(b.clientName,m,f.clientResponseModel),c.handleAddToCart(m.data,f,h));d.removeModal()}b.on("quantity-slider:add-to-cart-start",function(a){f.vibrate()});b.on("quantity-slider:remove-from-cart-start",
function(a){f.vibrate()});b.on("quantity-slider:remove-from-cart-success",function(a){g(a)});b.on("quantity-slider:add-to-cart-success",function(a){g(a)});b.on("quantity-slider:cart-submit-error",function(a){var b=a.request.triggeringEvent,c=a.response,f=c.responseText,g;d.removeModal();f&&(g=JSON.parse(f));b.data=a.request.additionalInput;400===c.status&&g?d.showModal(b,g.errorModalHtml,h):403===c.status?location.reload():(d.showGenericErrorModal(b,h),e.error(a.clientName,b,c,"error",c.statusText))})}}})});
/* ******** */