(function(h){var g=window.AmazonUIPageJS||window.P,y=g._namespace||g.attributeErrors,e=y?y("TradeInInstantSavingsAssets@launcher","TradeInInstantSavingsAssets"):g;e.guardFatal?e.guardFatal(h)(e,window):e.execute(function(){h(e,window)})})(function(h,g,y){h.when("A").register("trade-in-constants",function(e){return{unauthorizedCode:401,maxTradeInItemQuantityStatusCode:204,autoCompleteUrl:"https://completion.amazon.com/api/2017/suggestions?",autoCompleteUrlSuffix:"/api/2017/suggestions?",tradeInRouteBase:"/tradein/hzw/",
appraisalInputName:"appraisal",customerIpPreferenceInputName:"instantPaymentPreference",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",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",priceBlockSessionStorageKey:"launchTradeInPriceBlock",tanookiSessionStorageKey:"launchTradeIn",tanookiV2SessionStorageKey:"launchAsinCategoryTradeIn",priceBlockTanookiV2SessionStorageKey:"launchAsinCategoryTradeInPriceBlock",
priceBlockIngressType:"tradein-price-block",recycleAndSaveIngressType:"tradein-recycle-save",tanookiBuyboxMetric:"tanooki_launch_buy_box",tanookiBuyboxMobileMetric:"tanooki_launch_buy_box_mobile",tanookiPriceblockMetric:"tanooki_launch_price_block",tanookiPriceblockMobileMetric:"tannoki_launch_price_block_mobile",tanookiV2PastPurchaseSelectedMetric:"tv2_past_purchase_item_selected",refTagPrefix:"dp_trdv2_is_",refTagPrefixMobile:"dp_trdv2_is_m_",refTagPriceBlockPrefix:"dp_price_block_",refTagPriceBlockPrefixMobile:"dp_price_block_m_",
refTagRecycleAndSaveTanookiPrefix:"dp_recycle_save_tanooki_ingress_",refTagRecycleAndSaveTanookiPrefixMobile:"dp_recycle_save_tanooki_ingress_m",refTagListItemsView:"list_items_view",refTagSearchItemsView:"search_items_view",refTagConditionView:"condition_view",refTagConfirmationView:"confirmation_view",refTagSuccessfulView:"success_view",refTagSearchTermRequest:"search_term_request_",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",refTagViewDropOffLocations:"view_drop_off_locations",refTagViewUBIFLocations:"view_ubif_locations",
refTagButtonExperimentPreFix:"tanooki_",refTagTanookiLaunchedWithBlue:"lwbl",refTagTanookiLaunchedWithBorder:"lwbo",refTagTermsAndConditions:"select_terms_and_conditions",refTagHowToLink:"select_how_to_link",refTagPrintShippingLabel:"tv2_print_shipping_label",refTagNearbyProcessorsMobile:"nearby_processors_m",refTagNearbyProcessorsDesktop:"nearby_processors",refTagStorefront:"sf",refTagDetailPage:"detail_page",refTagTv2:"tv2_",refTagPriceBlockIngress:"pb_",refTagAuthRequired:"AuthReq",refTagAuthCompleted:"AuthComp",
refTagBackButton:"Back_",refTagExit:"Exit_",refTagEnd:"End",refTagChangeCondition:"ChgCond",refTagRemoveCartItem:"RmvItm",refTagHazmatError:"HazmatError",refTagIPDowngrade:"IPDowngrade",refTagIPUpgrade:"IPUpgrade",refTagMFAFailure:"_mfaFailure",refTagMFASuccess:"_mfaSuccess",BIFURCATION_REF_TAG:["tradein-manufacturer","tradein-vg-type"],VIEW_REF_TAG:{manufacturer:"Man",model:"Mod","model-family":"ModFam","storage-size":"Stor","product-category":"product_category",carrier:"Carr","Console-Generation":"ConGen",
"Console-generation":"ConGen",Games:"Games",Accessories:"Access",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",gl_digital_products_3:"AUCC"},PRODUCT_GROUP_SHORT_REF_TAG:{gl_wireless:"WL",gl_electronics:"WL",gl_video_games:"VG",
gl_digital_video_games:"VG",gl_digital_text:"eink",gl_digital_text_2:"tablet",gl_digital_products_3:"efd",gl_digital_devices_4:"smp",gl_digital_products_9_accessory:"vicc_rg",gl_vdo_devices:"vicc_bl",gl_digital_products_22_accessory:"eero",gl_digital_products_18_accessory:"health"},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",dropOffBannerNoLinkComponentId:"#dropOffBannerNoLinkComponent",dropOffBannerNoLinkTemplateId:"#dropOffBannerNoLinkTemplate",dropOffLocationExpanderId:"#dropOffLocationExpander",dropOffLocationsTemplateId:"#dropOffLocationsTemplate",dropOffLocationListTemplateId:"#dropOffLocationListTemplate",offlineMessageSectionClass:".offline-message-section",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",
tradeInAmountExceededErrorSelector:".tradein-templates .tradein-info-amount-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",tradeInWirelessGl:"gl_wireless",tradeInVGGl:"gl_video_games",tradeInDigitalVGGL:"gl_digital_video_games",tradeInElectronicsGL:"gl_electronics",tradeInVGProductGroups:["gl_video_games","gl_digital_video_games"],
wirelessVgProductGroups:["gl_wireless","gl_video_games","gl_digital_video_games","gl_electronics"],tradeInCCCardEligibleGls:["gl_wireless"],tradeInLaunchButtonDeclarativeActionSelector:"#tradeInLaunchAction",instantPaymentPreferenceInputName:"instantPaymentPreference",instantPaymentNow:"PAID_NOW",instantPaymentLater:"PAID_LATER"}});"use strict";h.when("A","trade-in-constants","tanooki-ingress-button-treatment").register("trade-in-common-utils",function(e,d,b){var c=e.$,f={locale:null,currencyCode:null,
productGroup:null,deviceType:null,asin:null,selectedAsin:null,modalTitle:null,isStorefront:!1,refTagPrefix:null,refTagPrefixMobile:null,priceBlockEnabled:null,buyingPriceUpgradeAsin:null,promoDiscount:null,autoSearchTerm:"",captureTradeInContext:function(){var a=c("#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("recycleAndSaveTitle")?this.modalTitle=a.recycleAndSaveTitle:a.hasOwnProperty("tanookiTitle")?this.modalTitle=a.tanookiTitle:this.recordMetric("deviceModalHeaderMissing"),a.hasOwnProperty("asin")&&(this.asin=a.asin),a.hasOwnProperty("buyingPrice")&&(this.buyingPriceUpgradeAsin=a.buyingPrice),a.hasOwnProperty("selectedAsin")&&(this.selectedAsin=a.selectedAsin),a.hasOwnProperty("autoSearchTerm")&&(this.autoSearchTerm=a.autoSearchTerm)):this.recordMetric("widgetContextMissing")},updateTradeInContext:function(a){var b=
c("#tanookiWidgetState").data("tanookiWidgetState");b.hasOwnProperty("productGroup")&&a.hasOwnProperty("productGroup")&&(b.productGroup=a.productGroup);b.hasOwnProperty("deviceType")&&a.hasOwnProperty("deviceType")&&(b.deviceType=a.deviceType);b.hasOwnProperty("tanookiTitle")&&a.hasOwnProperty("tanookiTitle")&&(b.tanookiTitle=a.tanookiTitle);b.hasOwnProperty("asin")&&a.hasOwnProperty("asin")&&(b.asin=a.asin);b.hasOwnProperty("buyingPrice")&&a.hasOwnProperty("buyingPrice")&&(b.buyingPrice=a.buyingPrice);
a.hasOwnProperty("selectedAsin")&&(b.selectedAsin=a.selectedAsin);a.hasOwnProperty("autoSearchTerm")&&(b.autoSearchTerm=a.autoSearchTerm);document.getElementById("tanookiWidgetState").dataset.tanookiWidgetState=JSON.stringify(b);this.captureTradeInContext()},setProductGroup:function(a){this.productGroup=a},getProductGroup:function(){return this.productGroup},setRefTagPrefix:function(a){this.refTagPrefix=a},getRefTagPrefix:function(){return this.refTagPrefix?this.refTagPrefix:d.refTagPrefix},getUpgradeAsinBuyingPrice:function(){return this.buyingPriceUpgradeAsin},
setRefTagPrefixMobile:function(a){this.refTagPrefixMobile=a},getRefTagPrefixMobile:function(){return this.refTagPrefixMobile?this.refTagPrefixMobile:d.refTagPrefixMobile},getCurrentAsin:function(){return this.asin},getSelectedAsin:function(){return this.selectedAsin},getDeviceType:function(){return this.deviceType},getModalTitle:function(){return this.modalTitle||""},getIsStoreFront:function(){return this.isStorefront},setIsStoreFront:function(a){this.isStorefront=a},setLocale:function(a){this.locale=
a},setPriceBlockEnabled:function(a){this.priceBlockEnabled=a},isPriceBlockEnabled:function(){return this.priceBlockEnabled},setPromoDiscount:function(a){this.promoDiscount=a},getPromoDiscount:function(){return this.promoDiscount},setCurrencyCode:function(a){this.currencyCode=a},formatCurrency:function(a,b){this.currencyCode||this.recordError("Missing currency code","trade-in-common-utils");var l={style:"currency",currency:this.currencyCode};b&&c.extend(l,b);a=parseFloat(a);return a.toLocaleString(this.locale.replace("_",
"-"),l)},formatDate:function(a){if(!a)return"";a=a.split(" ");return a[0]+" "+a[1]+" "+a[2]},getRedirectAuthUrl:function(a){var b=g.location,c="https://"+b.host;b=b.pathname+b.search+b.hash;var d=c;-1<c.indexOf("aka.corp.amazon.com")&&(d="https://development.amazon.com");return 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"+
encodeURIComponent(c+b)},redirectToAuth:function(a,b){a=this.getRedirectAuthUrl(a);try{g.sessionStorage&&!this.hasStorefrontAutoLaunchParams()&&sessionStorage.setItem(b,!0)}catch(r){this.recordSessionStorageBlockedError(r)}g.location.href=a},redirectToMFA:function(a){var b="https://"+g.location.host;-1<b.indexOf("aka.corp.amazon.com")&&(b="https://development.amazon.com");g.location.href=encodeURI(b+a)},getAuthPortalHandleFromHostname:function(){var a=g.location.hostname.match(/^(?:(?:(?:(\w\w)-)?pre-prod)|(?:(?:(\w\w)-)?development)|(?:.+))\.amazon.(?:(\w\w)|(com)|(?:co\.(?:(\w\w))))?$/);
if(a)for(var b=1;b<a.length;b++)if(a[b])return d.AUTH_PORTAL_ASSOC_HANDLE[a[b]];return d.AUTH_PORTAL_ASSOC_HANDLE.com},recordError:function(a,b){g.ueLogError&&g.ueLogError({message:a,logLevel:"ERROR",attribution:"tradein: "+b})},recordSessionStorageBlockedError:function(a){g.ueLogError&&g.ueLogError({message:a,logLevel:"WARN",attribution:"tradein: "+d.sessionStorageAccessErrorMsg})},recordMetric:function(a){g.ue&&g.ue.count&&(a="tradeIn_"+a,g.ue.count(a,(g.ue.count(a)||0)+1))},findMinMaxTivInContainer:function(a){var b,
c;Object.keys(a).forEach(function(d,l){d=a[d];0===l?c=b=d.tiv:(l=d.tiv,b=l<b?l:b,c=l>c?l:c)});return[b,c]},getMashModalUrl:function(a){var b="https://"+g.location.host,c="\x26cb\x3d"+Math.round((new Date).getTime()/1E3);return b+a+c},getCsrfTokenByKey:function(a,b){return b.hasOwnProperty(d.csrfKeyMap)&&b[d.csrfKeyMap][a]?b[d.csrfKeyMap][a]:""},updateCsrfTokenByKey:function(a,b,c){b.hasOwnProperty(a)&&c.hasOwnProperty(d.csrfKeyMap)&&(c[d.csrfKeyMap][a]=b[a])},recordRefTag:function(a,b,c,d){a=b+c+
this.getIngressPageRefTag()+"_"+a;d=a+"_"+this.deviceType+"_"+this.getProductGroupShortReftag(d);this.doRecordRefTag(a);this.doRecordRefTag(d)},recordTv2RefTag:function(a,b,c){var d="";Array.isArray(c)&&0<c.length&&(d=c.join("_")+"_");a=b+this.getTv2RefTagPrefix()+"_"+d+a+"_"+this.getTv2RefTagPostfix();this.doRecordRefTag(a)},doRecordRefTag:function(a){e.get(a,{error:c.proxy(function(a,b,c){this.recordError(b+"::"+c,"Error encountered during refTag record request")},this)})},getIngressButtonRefTag:function(){return c(".tradein-price-block.blue").length?
d.refTagTanookiLaunchedWithBlue:d.refTagTanookiLaunchedWithBorder},getIngressPageRefTag:function(){return this.isStorefront?d.refTagStorefront:d.refTagDetailPage},getIngressTypeRefTag:function(){return this.isPriceBlockEnabled()?d.refTagPriceBlockIngress:""},getDRAMIngressRefTag:function(){var a=this.getRefTagPrefix(),b=c('input[name\x3d"tanookiPainterRefTag"]'),d=c('input[name\x3d"tanookiPainterSlotId"]');return a=b.length&&""!==b.val()?a+(b.val()+"_tile_launch"):d.length&&""!==d.val()?a+(d.val()+
"_tile_launch"):a+"tile_launch"},isMobileVariant:function(a){return 0<=["mobile","mobileApp","mobileWeb"].indexOf(a)},getTanookiV2RowSize:function(a){return this.isMobileVariant(a)?d.tanookiV2MobileRowSize:d.tanookiV2DesktopRowSize},getTanookiV2SearchPageSize:function(a){return this.isMobileVariant(a)?d.tanookiV2MobileSearchPageSize:d.tanookiV2DesktopSearchPageSize},isWirelessVgProductGroup:function(a){return-1!==d.wirelessVgProductGroups.indexOf(a)},isVGProductGroup:function(a){return-1!==d.tradeInVGProductGroups.indexOf(a)},
shouldLaunchTanookiOnPageLoad:function(a){try{if(g.sessionStorage){var b=sessionStorage.getItem(a);this.updateWidgetStateFromSessionStorage();return b?(sessionStorage.removeItem(a),this.resetSessionStorage(),!0):!1}}catch(r){return this.recordSessionStorageBlockedError(r),!1}},resetSessionStorage:function(){try{g.sessionStorage&&(sessionStorage.removeItem("storefront-product-group"),sessionStorage.removeItem("storefront-device-type"),sessionStorage.removeItem("storefront-modal-title"),sessionStorage.removeItem("is-storefront"))}catch(a){this.recordSessionStorageBlockedError(a)}},
updateWidgetStateFromSessionStorage:function(){try{if(g.sessionStorage){var a={productGroup:sessionStorage.getItem("storefront-product-group"),deviceType:sessionStorage.getItem("storefront-device-type"),tanookiTitle:sessionStorage.getItem("storefront-modal-title")};a.productGroup&&this.updateTradeInContext(a)}}catch(l){this.recordSessionStorageBlockedError(l)}},hasStorefrontAutoLaunchParams:function(){var a=g.location.href;return-1!==a.indexOf("tipg\x3d")||-1!==a.indexOf("selectedAsin\x3d")?!0:!1},
getStorefrontSessionStorage:function(){try{g.sessionStorage&&sessionStorage.getItem("is-storefront")&&(this.isStorefront=!0)}catch(a){this.recordSessionStorageBlockedError(a)}return this.getIsStoreFront()},setStorefrontSessionStorage:function(a){try{g.sessionStorage&&(a&&sessionStorage.setItem("is-storefront",!0),sessionStorage.setItem("storefront-product-group",f.getProductGroup()),sessionStorage.setItem("storefront-device-type",f.getDeviceType()),sessionStorage.setItem("storefront-modal-title",
f.getModalTitle()))}catch(l){this.recordSessionStorageBlockedError(l)}},getSortedConditionTradeInValues:function(a){var b=[],e=a.conditionOfferMap,f=d.validConditions,g;for(g in e)if(e.hasOwnProperty(g))if(-1===c.inArray(g,f))this.recordError("Invalid condition",g+" was not found in validConditions array for type: "+a.tradeInItemType);else{var h=e[g];h.hasOwnProperty("tiv")&&b.push(h.tiv)}b.sort(function(a,b){return a-b});return b},getProductGroupShortReftag:function(a){return d.PRODUCT_GROUP_SHORT_REF_TAG[a]},
getTv2RefTagPrefix:function(){return d.refTagTv2+this.getIngressPageRefTag()+"_"+this.getIngressTypeRefTag()+this.getProductGroupShortReftag(this.productGroup)},getTv2RefTagPostfix:function(){return("web"===this.deviceType?"D_":"M_")+d.PRODUCT_GROUP_REF_TAG[this.productGroup]},generatePrettyTitle:function(a){return a.split("(Trade")[0]},getIngressTypeFromActionParams:function(a){return a&&a.hasOwnProperty("data")&&a.data.hasOwnProperty("ingressType")?a.data.ingressType:null},isGlEligibleForPastPurchases:function(a){return a===
d.tradeInEchoGl},isGlEligibleForPromotions:function(a){return a===d.tradeInEchoGl},isCETechGl:function(a){return a===d.tradeInWirelessGl||a===d.tradeInDigitalVGGL||a===d.tradeInVGGl||a===d.tradeInElectronicsGL},isTradeInLaunchedFromWisper:function(a){return["launch-tanooki-wireless","redirect-to-login-wireless"].includes(a)},isGlEligibleForCCCard:function(a){return d.tradeInCCCardEligibleGls.includes(a)},createNearbyProcessorsList:function(a,b,d){b.empty();c.each(a,c.proxy(function(a,e){a=c("\x3cdiv/\x3e");
var f=c("\x3cdiv/\x3e"),l=c("\x3cdiv/\x3e"),g=c("\x3cdiv/\x3e"),r=e.processorAddress.line1+" "+e.processorAddress.line2,h=e.processorAddress.city+" "+e.processorAddress.state+" "+e.processorAddress.postalCode+" "+e.processorAddress.countryCode;a.html(e.processorAddress.fullName).addClass("a-text-bold a-spacing-top-medium");f.html(r);l.html(h);b.append(a).append(f).append(l).append(g);d.append(b)},this))},renderPriceBlockRecommendationMessages:function(a,b,c){var d=f.getUpgradeAsinBuyingPrice();d=
parseFloat(d);a.find("#selectedItemTotalCount").html(b);b=f.getPromoDiscount()?f.getPromoDiscount():0;c=d-(d*b+c);0<=c?(a.find("#finalPriceLowTiv").html(f.formatCurrency(c)),a.find("#buyingPrice").html(f.formatCurrency(d)).wrap("\x3cs\x3e"),a.find(".low-tiv").show(),a.find(".high-tiv").hide()):(a.find("#finalPriceHighTiv").html(f.formatCurrency(0)),a.find("#buyingPrice").html(f.formatCurrency(d)).wrap("\x3cs\x3e"),a.find("#gcAmount").html(f.formatCurrency(-1*c)),a.find(".low-tiv").hide(),a.find(".high-tiv").show());
a.show()}};e.on("a:tradein:record:reftag",function(a){f.doRecordRefTag(d.tradeInRouteBase+"recordRefTag?ref_\x3d"+a.refTag)});e.on("a:pageUpdate",function(){e.state.parse();f.captureTradeInContext()});return f});"use strict";h.when("A","a-modal","trade-in-constants","trade-in-common-utils","tradein-desktop-side-sheet","tanooki-rebates-cx-launcher","recycle-and-save-helper","ready").execute(function(e,d,b,c,f,a,l){function h(a){-1<a.indexOf(b.refTagPriceBlockPrefix)&&c.setRefTagPrefix(b.refTagPriceBlockPrefix);
if(!c.getIsStoreFront()){var n=b.tradeInRouteBase+"recordRefTag?deviceType\x3d"+c.getDeviceType()+"\x26ref_\x3d",e=c.getIngressButtonRefTag();c.recordRefTag(e,n,b.refTagButtonExperimentPreFix,c.getProductGroup())}(n=c.getProductGroup())?(a=a+"_"+n,a={deviceType:c.getDeviceType(),currentAsin:c.getCurrentAsin(),buyingPrice:c.getUpgradeAsinBuyingPrice(),selectedAsin:c.getSelectedAsin(),productGroup:n,ref_:a},""!==c.autoSearchTerm&&(a.autoSearchTerm=c.autoSearchTerm,e=m("#tanookiWidgetState").data("tanookiWidgetState"),
e.autoSearchTerm="",c.updateTradeInContext(e)),a=b.tradeInRouteBase+"getCustomerItems?"+m.param(a)):a=b.tradeInRouteBase+"generalerror?ref_\x3d"+(a+"_pg_missing");(n=d.get(b.tradeInModalName+"_"+n))||(n=d.create(m("\x3cdiv /\x3e"),{url:a,name:b.tradeInModalName,header:c.getModalTitle(),width:700,cache:!1,padding:"none",timeout:3E4}));n.show()}function v(){u||c.recordTv2RefTag(b.refTagAuthRequired,q);var a=c.getAuthPortalHandleFromHostname();c.isPriceBlockEnabled()?c.redirectToAuth(a,b.priceBlockTanookiV2SessionStorageKey):
c.redirectToAuth(a,b.tanookiV2SessionStorageKey);c.setStorefrontSessionStorage(x)}function t(a){var d=c.getIngressButtonRefTag();c.recordTv2RefTag(d,q);a=b.refTagTv2+a;var e=c.getProductGroup(),l=c.getCurrentAsin();e?(d=a+"_"+e,d={deviceType:c.getDeviceType(),productGroup:e,ref_:d,currentAsin:l,buyingPrice:c.getUpgradeAsinBuyingPrice()},d=m.param(d),d=b.tradeInRouteBase+"wirelessTradeInSearchRefinements?"+d):d=b.tradeInRouteBase+"generalerror?ref_\x3d"+(a+"_pg_missing");w=m.get(d);f.initialize();
m("body").addClass("scroll-disabled");f.show(w,function(){u=!0;0<m("#tradein-desktop-side-sheet").find(".tradein-logged-out-view").length?c.recordTv2RefTag(b.refTagAuthRequired,q):0<=a.indexOf("auth_launch")&&c.recordTv2RefTag(b.refTagAuthCompleted,q)})}var m=e.$,w,x=c.getIsStoreFront(),q=b.tradeInRouteBase+"recordRefTag?deviceType\x3d"+c.getDeviceType()+"\x26ref_\x3d",u=!1,k=null;c.captureTradeInContext();x=c.getStorefrontSessionStorage();c.shouldLaunchTanookiOnPageLoad(b.tanookiV2SessionStorageKey)?
t(b.refTagPrefix+"auth_launch"):c.shouldLaunchTanookiOnPageLoad(b.priceBlockTanookiV2SessionStorageKey)&&(c.setPriceBlockEnabled(!0),t(b.refTagPrefix+"auth_launch"));e.on("a:popover:afterHide:tradeInModal",function(){k&&k.focus()});e.on("a:tradein:tanooki:launch",function(a){c.setIsStoreFront(!0);c.updateTradeInContext(a.widgetState);e.trigger("a:tradein:productgroup:update");var b=a.refTag?a.refTag:c.getDRAMIngressRefTag();c.isWirelessVgProductGroup(a.widgetState.productGroup)?t(b):h(b)});e.declarative("launch-tanooki-wireless",
"click",function(){t("launch")});e.declarative("launch-tanooki-v2","click",function(a){c.getIngressTypeFromActionParams(a)===b.priceBlockIngressType&&c.setPriceBlockEnabled(!0);t("launch")});e.declarative("launch-tanooki-v2-storefront","click",function(a){c.setIsStoreFront(!0);c.updateTradeInContext(a.data);t("launch")});e.declarative("redirect-to-login-wireless","click",function(){v()});e.declarative("redirect-to-login-v2","click",function(a){c.getIngressTypeFromActionParams(a)===b.priceBlockIngressType&&
c.setPriceBlockEnabled(!0);v()});e.declarative("launch-tanooki","click",function(a){var d=c.getIngressTypeFromActionParams(a),e=b.refTagPrefix,f=b.tanookiBuyboxMetric;k=a.$target;d===b.priceBlockIngressType?(e=b.refTagPriceBlockPrefix,f=b.tanookiPriceblockMetric):d===b.recycleAndSaveIngressType&&(e=b.refTagRecycleAndSaveTanookiPrefix);c.setRefTagPrefix(e);h(e+"launch");c.recordMetric(f)});e.declarative("redirect-to-login","click",function(a){a=c.getIngressTypeFromActionParams(a);var d=c.getAuthPortalHandleFromHostname();
c.getIsStoreFront()&&c.setStorefrontSessionStorage(!0);var e=b.tanookiSessionStorageKey;a===b.priceBlockIngressType&&(e=b.priceBlockSessionStorageKey);c.redirectToAuth(d,e)});try{g.sessionStorage&&(c.shouldLaunchTanookiOnPageLoad(b.tanookiSessionStorageKey)&&h(b.refTagPrefix+"auth_launch"),sessionStorage.getItem(b.priceBlockSessionStorageKey)&&("launch-recycle-and-save"===m(b.tradeInLaunchButtonDeclarativeActionSelector).data("action")?l.launchRecycleAndSaveWeb(d,"_auth_launch"):h(b.refTagPriceBlockPrefix+
"auth_launch"),sessionStorage.removeItem(b.priceBlockSessionStorageKey)))}catch(p){c.recordSessionStorageBlockedError(p)}e.trigger("a:tradein:tanooki:launcher:loaded")});"use strict";h.when("A","ready").register("tradein-desktop-side-sheet",function(e){var d,b=e.$,c,f,a;return{initialize:function(){c=b("\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");c.hide();c.appendTo(document.body);c.click(this.close);
a=b('\x3cdiv id\x3d"tradein-desktop-side-sheet" class\x3d"a-section"\x3e\x3c/div\x3e');a.addClass("aok-hidden");b('\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(a);a.appendTo(document.body);b(document).unbind("keydown",this.onKeyDown);b(document).keydown(this.onKeyDown);d=this.close},onKeyDown:function(a){27===a.which&&d()},close:function(){e.trigger("tanooki-trade-in-desktop-side-sheet-close");c.hide();
b(a).animate({right:f},{duration:500,complete:function(){b(a).remove();b(c).remove();b("body").removeClass("scroll-disabled")}})},show:function(d,e){b(a).removeClass("aok-hidden");b(a).animate({right:"0"},500,"linear");b(a).find(".sidesheet-spinner").addClass("active");c.show();b.when(d).done(function(c){b(a).find(".sidesheet-spinner").remove("active");b("#tradein-desktop-side-sheet").html(c);e&&"function"===typeof e&&e()});f=b(a).css("right")}}});"use strict";h.when("trade-in-cc-device").register("trade-in-cc-constants",
function(e){return{featureName:"tradeInInstantSavingsCC",featureAttribution:"Website/CETech/WirelessPlans",actions:{expand:"trade-in-cc-card:expanded",collapse:"trade-in-cc-card:collapse",atfRefresh:"PageRefresh:ATF",ingress:"trade-in-button:ingress",postTradeInExp:"trade-in-cc:postTradeInExp",postTradeInMultiCardExp:"trade-in-cc:postTradeInMultiCardExp"},selectors:{expanderIcon:".trade-in-cc-header-icon",expanderContentWrapper:".trade-in-cc-expander-content-wrapper",expanderContent:".trade-in-cc-expander-content",
expanderContentPre:".trade-in-cc-expander-content-pre",expandInitiallyInput:".trade-in-cc-expand-initially-input",tradeInCCCardTemplate:".trade-in-cc-card-template",successMessage:".trade-in-cc-card-template .trade-in-cc-success-message",tivMessage:".trade-in-cc-tiv-message",promoMessage:".trade-in-cc-promo-message",subtitleWrapper:".trade-in-cc-subtitle-wrapper",subtitle:".trade-in-cc-subtitle",submittedMessage:".trade-in-cc-submitted-message",ccCardTotalTiv:".cc-card-total-tiv",ccCardIpTiv:".cc-card-ip-tiv",
promoTitle:".trade-in-cc-promo-title",promoSubtitle:".trade-in-cc-promo-subtitle",ipPromoSubtitle:".trade-in-cc-ip-promo-subtitle",nipPromoSubtitle:".trade-in-cc-non-ip-promo-subtitle",promoTitleSingle:".trade-in-cc-promo-title-single",singlePromoTitle:".single-promo-title",promoTitleMultiple:".trade-in-cc-promo-title-multiple",lastPromoTitle:".last-promo-title",remainingPromoAmount:".remaining-promo-amount",ccPostTradeInMessageTemplate:".cc-post-trade-in-message-template",ccTiMessageContent:".cc-post-trade-in-message-content",
ccIpTiMessage:".trade-in-cc-ip-ti-message",ccNipTiMessage:".trade-in-cc-non-ip-ti-message",ccMixedTiMessage:".trade-in-cc-mix-ti-message",ccPromoMessageContent:".trade-in-cc-promo-message-content",multiCardExperimentData:"wireless-multi-card",multiCardExperimentElement:"[data-wireless-multi-card]",activeTPlusCards:"#twister-plus-active-cards",defaultOptionSwatch:".tradein-twister-box-group-default-option",expandContentSuccessMessage:".trade-in-cc-expander-content .trade-in-cc-success-message"},classes:{hidden:"aok-hidden",
rotate:"rotate",tradeInCCExpanded:"trade-in-cc-expander-content-wrapper-expanded",contentHidden:"content-hidden",selectedSwatch:"tradein-options-selected-box-group"}}});"use strict";h.when("A","trade-in-cc-constants").register("trade-in-cc-expander",function(e,d){var b=e.$,c=d.selectors,f=d.classes;return{toggleCard:function(a){b(c.expanderIcon).toggleClass(f.rotate,a);b(c.subtitleWrapper).toggleClass(f.hidden,a);b(c.expanderContent).toggleClass(f.contentHidden,!a);return b(c.expanderContentWrapper).toggleClass(f.tradeInCCExpanded,
a).hasClass(f.tradeInCCExpanded)}}});"use strict";h.when("A","cc-manager","trade-in-cc-constants").register("trade-in-cc-registration",function(e,d,b){var c={featureName:b.featureName,featureAttribution:b.featureAttribution};e.on(b.actions.expand,function(){d.cardExpanded(b.featureName)});d.registerFeature(c,{init:function(){},validateInputParams:function(){return!0},cardCollapse:function(){e.trigger(b.actions.collapse)}})});"use strict";h.when("A","trade-in-cc-constants","trade-in-cc-expander","trade-in-cc-experiment-clean-up",
"trade-in-cc-registration").execute(function(e,d,b,c){function f(){("true"===a(g.expandInitiallyInput).val()||c.isEnabled)&&b.toggleCard(!0)}var a=e.$,l=d.actions,g=d.selectors,h=d.classes;e.declarative("toggle-trade-in-cc-card","click",function(){var c=!a(g.expanderContentWrapper).hasClass(h.tradeInCCExpanded);b.toggleCard(c);c&&e.trigger(l.expand)});e.on(l.collapse,function(){b.toggleCard(!1)});e.on(l.atfRefresh,function(){f()});f()});"use strict";h.when("A","trade-in-cc-constants","trade-in-cc-registration").execute("trade-in-cc-metrics",
function(e,d){var b=d.actions,c=function(){var b=g.ue;return{incrementCount:function(a){b&&b.count&&a&&(a="twisterPlus_tradeIn_"+a+"."+d.featureName,b.count(a,(b.count(a)||0)+1))}}}();e.declarative("launch-tanooki-v2",function(){e.trigger(b.ingress)});e.on(b.expand,function(){c.incrementCount("ccExpanded")});e.on(b.ingress,function(){c.incrementCount("ccIngress")})});"use strict";h.register("trade-in-cc-device",function(){return{isMobile:!1}});"use strict";h.register("trade-in-cc-experiment-clean-up",
function(){return{isEnabled:!0}});"use strict";h.register("tanooki-ingress-button-treatment",function(){return{isEnabled:!1}});"use strict";h.register("tanooki-rebates-cx-launcher",function(){return{isEnabled:!1}});"use strict";h.when("A","a-modal","trade-in-common-utils","recycle-and-save-constants","recycle-and-save-helper","ready").execute(function(e,d,b,c,f){var a=null;e.declarative("launch-recycle-and-save-banyan","click",function(c){a=c.$target;c=c.data;var e=c.ingressProductGroup?c.ingressProductGroup:
"gl_digital_products_3",g=c.ingressPriceSurfaced?c.ingressPriceSurfaced:"";f.setIngressAsin(c.ingressAsin?c.ingressAsin:"");f.setIsPageRenderTargetSPP(!0);f.setIsFixedPricePromo("FIXED"===c.promoDiscountType);f.setIngressPriceSurfaced(g);b.setProductGroup(e);b.deviceType="web";f.launchRecycleAndSaveWeb(d)});e.declarative("launch-recycle-and-save","click",function(b){a=b.$target;f.setIngressAsin(f.getCurrentAsinFromDetailPage());f.setIngressPriceSurfaced(f.getIngressFppPriceSurfacedFromDetailPage());
f.launchRecycleAndSaveWeb(d)});e.declarative("recycle-and-save-claim-promo","click",function(a){var b=d.get(c.recycleAndSaveModalName);f.claimRecycleAndSavePromo(a.data.csrfKey,b,!1)});e.on("a:popover:afterHide:recycleAndSaveModal",function(){a&&a.focus()})});h.when("recycle-and-save-helper","ready").execute(function(e){e.triggerRecycleAndSaveWeblab()});"use strict";h.when("A").register("recycle-and-save-constants",function(e){return{recycleAndSaveModalName:"recycleAndSaveModal",recycleAndSaveSecondaryViewName:"recycleAndSaveSecondaryView",
recycleAndSaveRouteBase:"/tradein/hzw/",recycleAndSaveRecordRefTagUrl:"/tradein/hzw/recordRefTag?ref_\x3d",recycleAndSavePrefix:"recycleAndSave/",recycleAndSaveViewUrl:"getView?",recycleAndSaveClaimPromoUrl:"claimPromo?",recycleAndSavePriceblockMetric:"recycle_and_save_launch_price_block",recycleAndSavePriceblockMobileMetric:"recycle_and_save_launch_price_block_mobile",recycleAndSavePromoAccessErrorMetric:"recycle_and_save_promo_access_error",recycleAndSaveFixedPromoAccessErrorMetric:"rs_fpp_promo_access_error",
refTagRecycleAndSavePrefix:"dp_recycle_save_price_block_",refTagRecycleAndSaveMobilePrefix:"dp_recycle_save_price_block_m_",refTagRecycleAndSaveReftagLaunch:"dp_rs_pb_launch",refTagRecycleAndSaveReftagMobileLaunch:"dp_rs_pb_launch_m",refTagRecycleAndSaveOnSPPLaunch:"spp_recycle_save_upgrader_launch",refTagRecycleAndSaveOnSPPMobileLaunch:"spp_recycle_save_upgrader_launch_m",refTagRecycleAndSaveClaimPromo:"dp_recycle_save_price_claim_promo_",refTagRecycleAndSaveFixedClaimPromo:"dp_rs_pb_fpp_claim_promo_",
refTagRecycleAndSaveSPPClaimPromo:"spp_recycle_save_price_claim_promo_",refTagRecycleAndSaveSPPFixedClaimPromo:"spp_rs_pb_fpp_claim_promo_",refTagRecycleAndSaveShortPrefixLaunch:"rs_la_",refTagRecycleAndSaveShortPrefixClaimPromo:"rs_cl_",refTagMobile:"m_",refTagFixedPromoSuffix:"_fpp",refTagPreFixDetailPage:"dp",refTagPreFixSppBanyan:"by",refTagPreFixEchoCategory:"ec",refTagPreFixFireTVCategory:"ftvc",refTagPreFixUnknown:"unknown",promoAccessAvailable:"available",promoAccessClaimed:"claimed",promoAlreadyClaimed:"ALREADY_CLAIMED",
fixedPromoDiscountType:"FIXED"}});"use strict";h.when("A","trade-in-common-utils","recycle-and-save-constants","ready").register("recycle-and-save-helper",function(e,d,b){function c(a,c){var e=d.getProductGroup(),n=p.getIngressAsin(),g=p.getIngressPageType();return e?(d.doRecordRefTag(b.recycleAndSaveRecordRefTagUrl+a+"_"+g),n.length&&f(b.refTagRecycleAndSaveShortPrefixLaunch,c,g,n),a={deviceType:c?"mobile":d.getDeviceType(),productGroup:e,ref_:a,pageRenderTarget:p.getIsPageRenderTargetSPP()?"spp":
"dp",pageIngressType:g,ips:p.getIngressPriceSurfaced(),currentAsin:n},b.recycleAndSaveRouteBase+b.recycleAndSavePrefix+b.recycleAndSaveViewUrl+k.param(a)):b.recycleAndSaveRouteBase+"generalerror?ref_\x3d"+(a+"_pg_missing")}function f(a,c,e,f){a+=c?b.refTagMobile:"";a=a+(e+"_")+(p.getIsFixedPricePromo()?"fpp_":"");a+=d.getProductGroup()+"_"+f;d.doRecordRefTag(b.recycleAndSaveRecordRefTagUrl+a)}function a(){k(".recycleSaveErrorAlert").each(function(){k(this).removeClass("aok-hidden")})}function h(){k(".recycleSaveClaimAlert").each(function(){k(this).removeClass("aok-hidden")})}
function r(){k("#recycleSaveClaimPromoDeclarAct").removeClass("a-declarative");k(".recycle-save-redeem-button").each(function(){k(this).removeClass("a-button-normal").addClass("a-button-disabled")})}function v(a){e.declarative.remove(k("#launch-recycle-and-save"),"launchRecycleAndSave");var b=k(".tradein-instant-savings-launch-button"),c=k(a?".recycle-and-save-wrapper-mobile":".recycle-and-save-wrapper").find("#successfulRecycleAndSaveButtonText").first();k.each(b,function(){k(this).replaceWith(c.clone())});
k(".tradein-price-block").each(function(){k(this).html(c.clone())});a=k(".tradein-price-block.blue");a.length&&a.removeClass("blue").addClass("green")}function t(a){w(a).each(function(){var a=k(this).clone().addClass("aok-hidden");k(this).replaceWith(a)});x(a).each(function(){var a=k(this).clone().removeClass("aok-hidden").addClass("recycle-and-save-spp-ingress-success");k(this).replaceWith(a)})}function m(){return"#recycle-and-save-spp-ingress-"+p.getIngressAsin()}function w(a){a=a?m()+" .ucw-cards-upgrader-btn-text":
".recycle-and-save-spp-ingress-percent .ucw-cards-upgrader-btn-text";return k(a)}function x(a){a=a?m()+" #ucw-upgrader-offer-claimed-text":".recycle-and-save-spp-ingress-percent #ucw-upgrader-offer-claimed-text";return k(a)}function q(){var a=document.getElementById("recycleAndSavePromoData");if(a&&a.dataset)return a.dataset}function u(a){var c=q();return c&&c.promoDiscountType&&b.fixedPromoDiscountType===c.promoDiscountType?(p.setIsFixedPricePromo(!0),a+b.refTagFixedPromoSuffix):a}var k=e.$,p={isPageRenderTargetSPP:!1,
isFixedPricePromo:!1,ingressAsin:"",ingressPriceSurfaced:"",setIsPageRenderTargetSPP:function(a){this.isPageRenderTargetSPP=a},getIsPageRenderTargetSPP:function(){return this.isPageRenderTargetSPP},setIsFixedPricePromo:function(a){this.isFixedPricePromo=a},getIsFixedPricePromo:function(){return this.isFixedPricePromo},setIngressAsin:function(a){this.ingressAsin=a},getIngressAsin:function(){return this.ingressAsin},setIngressPriceSurfaced:function(a){this.ingressPriceSurfaced=a},getIngressPriceSurfaced:function(){return this.ingressPriceSurfaced},
launchRecycleAndSaveWeb:function(a,e){e=e||"";d.setRefTagPrefix(b.refTagRecycleAndSavePrefix);var f=this.getIsPageRenderTargetSPP()?b.refTagRecycleAndSaveOnSPPLaunch:b.refTagRecycleAndSaveReftagLaunch;f=u(f);e=f+"_"+d.getProductGroup()+e;e=c(e,!1);a.create(k("\x3cdiv /\x3e"),{url:e,name:b.recycleAndSaveModalName,header:d.getModalTitle(),width:929,cache:!1,padding:"none",timeout:3E4}).show();d.recordMetric(b.recycleAndSavePriceblockMetric)},launchRecycleAndSaveMobile:function(a,e){e=e||"";d.setRefTagPrefix(b.refTagRecycleAndSaveMobilePrefix);
var f=this.getIsPageRenderTargetSPP()?b.refTagRecycleAndSaveOnSPPMobileLaunch:b.refTagRecycleAndSaveReftagMobileLaunch;f=u(f);e=f+"_"+d.getProductGroup()+e;e=c(e,!0);a.create(k("\x3cdiv /\x3e"),{url:e,name:b.recycleAndSaveSecondaryViewName,cache:!1,backButtonText:"Close",padding:"none",timeout:3E4}).show();d.recordMetric(b.recycleAndSavePriceblockMobileMetric)},triggerRecycleAndSaveWeblab:function(){var a=k("input[id^\x3d'recycleAndSaveWeblabToTrigger']");a&&a.length&&a.each(function(){var a=k(this).data("weblabname"),
b=k(this).data("weblabtreatment");a&&a.length&&b&&b.length&&g.ue&&g.ue.trigger&&g.ue.trigger(a,b)})},getClaimRecycleAndSavePromoRefTagPrefix:function(a){return this.getIsPageRenderTargetSPP()?a?b.refTagRecycleAndSaveSPPFixedClaimPromo:b.refTagRecycleAndSaveSPPClaimPromo:a?b.refTagRecycleAndSaveFixedClaimPromo:b.refTagRecycleAndSaveClaimPromo},claimRecycleAndSavePromo:function(c,g,l){var n=d.getProductGroup(),m=l?b.refTagMobile:"",p=this.getIsFixedPricePromo(),q=this.getIngressPageType();m=this.getClaimRecycleAndSavePromoRefTagPrefix(p)+
m+n;d.doRecordRefTag(b.recycleAndSaveRecordRefTagUrl+m+"_"+q);var u=this.getIngressAsin();u.length&&f(b.refTagRecycleAndSaveShortPrefixClaimPromo,l,q,u);c={productGroup:n,requestToken:c,ref_:m,currentAsin:this.getIngressAsin(),pageIngressType:q};c=b.recycleAndSaveRouteBase+b.recycleAndSavePrefix+b.recycleAndSaveClaimPromoUrl+k.param(c);e.post(c,{success:k.proxy(function(c){c.claimPromoSuccess?(g.hide(),this.getIsPageRenderTargetSPP()?t(p):v(l)):(c.claimPromoFailureReason&&c.claimPromoFailureReason===
b.promoAlreadyClaimed?h():a(),r())},this),error:k.proxy(function(){d.recordMetric(p?b.recycleAndSaveFixedPromoAccessErrorMetric:b.recycleAndSavePromoAccessErrorMetric);a();r()},this),async:!1})},getIngressFppPriceSurfacedFromDetailPage:function(){var a=q();return a&&a.ips?a.ips:""},getCurrentAsinFromDetailPage:function(){var a=q();return a&&a.ingressAsin?a.ingressAsin:""},getIngressPageType:function(){var a=g.location.href;return-1<a.indexOf("B0CXRRF584")||-1<a.indexOf("B0DCCNHWV5")?b.refTagPreFixSppBanyan:
-1<a.indexOf("9818047011")?b.refTagPreFixEchoCategory:-1<a.indexOf("8521791011")?b.refTagPreFixFireTVCategory:-1<a.indexOf("/dp/")&&!this.getIsPageRenderTargetSPP()?b.refTagPreFixDetailPage:b.refTagPreFixUnknown}};return p})});