(function(g){var k=window.AmazonUIPageJS||window.P,m=k._namespace||k.attributeErrors,f=m?m("NileInlineCustomerExperienceWidgetCommonAssets",""):k;f.guardFatal?f.guardFatal(g)(f,window):f.execute(function(){g(f,window)})})(function(g,k,m){g.now("nile-inline-error-chunk-handler").execute(function(f){f||g.when("A","nile-inline-loader-utils","nile-inline-element-prefix-utils","ready").register("nile-inline-error-chunk-handler",function(d,b,a){return{handleChunk:function(e,g){var c=a.prefixed("nile-inline-hidden");
if(d.$(a.prefixedId("nile-inline-answer-generic-error")).hasClass(c)){b.hideLoader();b.hideTrailingLoader();var h=a.prefixedId("nile-inline-answer-container");d.$(h).removeClass(c);h=a.prefixedId("nile-inline-answer-text-container-error");d.$(h).removeClass(c);d.$(h).addClass(a.prefixed("nile-inline-text-container-collapsed-error"));var f=a.prefixedId("nile-inline-ai-generated-label");"sensitive_chunk"===g?d.$(f).addClass(c):d.$(f).removeClass(c);d.$(h).html(e)}}}})});g.now("nile-inline-feedback-chunk-handler").execute(function(f){f||
g.when("A","nile-inline-element-prefix-utils","nile-inline-feedback-actions","ready").register("nile-inline-feedback-chunk-handler",function(d,b,a){return{handleChunk:function(e){e=d.$(e);d.$(b.prefixedId("nile-inline-feedback-container")).html(e);a.showFeedback();return e}}})});g.now("nice-srp-utils").execute(function(f){f||g.when("A","ready").register("nice-srp-utils",function(d){function b(l,a){l=(l||"").split(".").map(Number);for(a=(a||"").split(".").map(Number);l.length<a.length;)l.push(0);for(;a.length<
l.length;)a.push(0);for(var c=0;c<l.length;++c)if(l[c]!==a[c])return l[c]>a[c]?1:-1;return 0}function a(){var a=c();return"Amazon"===a.name||"Amazon.com"===a.name}var e=d.$,f=[],c=function(){var a;return function(){if(!a){var c=document.cookie.match(/(?:^|;)\s*amzn-app-id\s*=\s*([^\s;]+)/);c=c?c[1].split("/"):[];var b=/(?:^|;)\s*micron\s*=\s*1\s*(?:$|;)/.test(document.cookie);a={name:c[0],version:c[1],isMicron:b}}return a}}(),h=function(){var a;return function(){if(!a){var c=document.cookie.match(/(?:^|;)\s*session-id\s*=\s*([^\s;]+)/);
c&&(a=c[1])}return a}}(),g=function(){var a;return function(){if(!a){var c=document.cookie.match(/(?:^|;)\s*amzn-app-ctxt\s*=\s*\d\.\d?\s*([^\s;]+)/);if(c)try{a=JSON.parse(decodeURIComponent(c[1]))}catch(n){}}return a}}();return{getAppInfo:c,getAppSessionId:h,getAppContext:g,makeIdempotent:function(a){var c=!1;return function(){c||(a.apply(this,arguments),c=!0)}},makeRateLimited:function(a,c){var b=!1,d=e.extend(!0,{},{minPeriodInMilliseconds:2E3},c);return function(){b||a.apply(this,arguments);b=
!0;setTimeout(function(){b=!1},d.minPeriodInMilliseconds)}},idempotentDeclarative:function(a,c,b){function e(a,c,b){var e;d.declarative(a,c,function(a){e===m&&(e=a.type);a.type===e&&b(a)})}var h=a+c;f[h]||("click touchstart"===c||"touchstart click"===c?e(a,c,b):d.declarative(a,c,b),f[h]=!0)},goToUrl:function(a){k.location.href=a},isMshop:a,isAppXSupported:function(){var e=c();return a()&&e.version&&!e.isMicron?Number(e.version.split(".")[0])%2?0<=b(e.version,"15.11"):0<=b(e.version,"20.8"):!1},truncateURIComponent:function(a,
c,b){if(!a||encodeURIComponent(a).length<=c)return a;b=b||"…";c-=encodeURIComponent(b).length;for(var e="",d=0,h=a.length-1;d<=h;){var f=Math.floor((h+d)/2),g=a.slice(0,f);encodeURIComponent(g).length<=c?(e=g,d=f+1):h=f-1}return e+b},decodeHtmlEntities:function(a){var c=document.createElement("textarea");c.innerHTML=a;return c.value}}})});g.now("nile-inline-csm").execute(function(f){f||g.when("A","ready").register("nile-inline-csm",function(){function d(b,a,e){"function"===typeof uet&&(e?uet(b,a,
{wb:1},e):uet(b,a,{wb:1}))}return{recordRequestStart:function(b,a){"string"===typeof b&&b.trim()&&d("bb",b,a)},recordFirstInferenceLatency:function(b){"string"===typeof b&&b.trim()&&(d("be",b),"function"===typeof uex&&uex("ld",b,{wb:1}))},recordCsmCount:function(b){ue.count(b,1)}}})});g.now("nile-inline-csrf").execute(function(f){f||g.when("A","ready").register("nile-inline-csrf",function(d){return{getRawCsrfToken:function(b){return d.$(b).find("input[name\x3danti-csrftoken-a2z]").val()}}})});g.now("nile-inline-element-prefix-utils").execute(function(f){f||
g.when("ready").register("nile-inline-element-prefix-utils",function(){var d="";return{setupElementPrefix:function(b){d=b+"-"},prefixed:function(b){return d+b},prefixedId:function(b){return"#"+d+b}}})});g.now("nile-inline-loader-utils").execute(function(f){f||g.when("A","nile-inline-element-prefix-utils","ready").register("nile-inline-loader-utils",function(d,b){return{showTrailingLoader:function(){var a=b.prefixed("nile-inline-hidden");var e=b.prefixedId("nile-inline-feedback-container");(e=!d.$(e).hasClass(a)&&
0<d.$(e).children().length)||(e=b.prefixedId("nile-inline-answer-generic-error"),e=!d.$(e).hasClass(a)&&0<d.$(e).children().length);e||(e=b.prefixedId("nile-inline-answer-text-container-error"),e=!d.$(e).hasClass(a)&&0<d.$(e).children().length);e||d.$(b.prefixedId("nile-trailing-loader")).removeClass(a)},hideTrailingLoader:function(){var a=b.prefixed("nile-inline-hidden");d.$(b.prefixedId("nile-trailing-loader")).addClass(a)},showLoader:function(){var a=b.prefixed("nile-inline-hidden");d.$(b.prefixedId("nile-inline-data-container")).removeClass(a);
d.$(b.prefixedId("nile-inline-loader-spinner")).removeClass(a)},hideLoader:function(){var a=b.prefixed("nile-inline-hidden");d.$(b.prefixedId("nile-inline-loader-spinner")).addClass(a);d.$(b.prefixedId("nile-inline-data-container")).addClass(a)}}})});g.now("nile-inline-state-manager").execute(function(f){f||g.when("A","nile-inline-element-prefix-utils","ready").register("nile-inline-state-manager",function(d,b){function a(){return b.prefixed("nice-state")}return{getState:function(){d.state(a())||
d.state.parse();return d.state(a())},setState:function(b){d.state.replace(a(),b)},extend:function(b){d.state(a(),b)}}})});g.now("nile-inline-uuid-generator").execute(function(f){f||g.when("A","ready").register("nile-inline-uuid-generator",function(d){return{generateUuid:function(){function b(){var a=new Uint32Array(4);k.crypto.getRandomValues(a);var b=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){b++;var e=a[b>>3]>>b%8*4&15;return("x"===c?e:e&3|8).toString(16)})}function a(){function a(){return Math.floor(65536*
(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}return function(){return"undefined"!=typeof k.crypto&&"undefined"!=typeof k.crypto.getRandomValues?b():a()}}()}})});g.now("nile-inline-event-stream-builder").execute(function(f){f||g.when("A","jQuery","ready").register("nile-inline-event-stream-builder",function(d,b){function a(a){this.url=a;this.eventListeners={};this.connectionSuccessfullyClosedCallback=this.errorCallback=this.httpRequest=m}function e(a){var c=
a.newMessage();return function(b,d){if(0===b.length){if(c.type in a.eventListeners)a.eventListeners[c.type](c);c=a.newMessage()}else if(0<d){var e=b.slice(0,d);b=b.slice(d+(" "===b[d+1]?2:1));switch(e){case "data":c.data=c.data?c.data+"\n"+b:b;break;case "event":c.type=b;break;case "id":c.lastEventId=b;break;case "retry":e=parseInt(b,10),isNaN(e)||(c.retry=e,a.retryCallback(c.retry))}}}}function f(a){var c=0,b=-1,d=!1;return function(e){for(var f=e.length,g=c;c<f;){d&&"\n"===e[c]&&(g=++c);for(var h=
-1;c<f&&-1===h;++c)switch(e[c]){case ":":-1===b&&(b=c-g);break;case "\r":d=!0;h=c;break;case "\n":h=c}if(-1===h)break;a(e.slice(g,h),b);g=c;b=-1}g!==f&&0!==g&&(c=g)}}a.prototype.addEventListener=function(a,b){this.eventListeners[a]=b};a.prototype.setErrorCallback=function(a){this.errorCallback=a};a.prototype.setConnectionSuccessfullyClosedCallback=function(a){this.connectionSuccessfullyClosedCallback=a};a.prototype.newMessage=function(){return{lastEventId:"",type:"",data:""}};a.prototype.isSuccessfulStatusCode=
function(a){return 0===a||200<=a&&300>a};a.prototype.buildRequestStageChangeCallback=function(a){return function(){switch(a.httpRequest.readyState){case XMLHttpRequest.DONE:a.isSuccessfulStatusCode(a.httpRequest.status)?a.connectionSuccessfullyClosedCallback!==m&&a.connectionSuccessfullyClosedCallback():a.errorCallback!==m&&a.errorCallback()}}};a.prototype.buildOnProgressCallback=function(a,b){return function(){b(a.httpRequest.responseText)}};a.prototype.retryCallback=function(a){};a.prototype.startPostStream=
function(a,b,d){var c=f(e(this));this.httpRequest=new XMLHttpRequest;this.httpRequest.onreadystatechange=this.buildRequestStageChangeCallback(this);this.httpRequest.onprogress=this.buildOnProgressCallback(this,c);this.httpRequest.ontimeout=this.errorCallback;this.httpRequest.onerror=this.errorCallback;this.httpRequest.open("POST",this.url,!0);this.httpRequest.timeout=d;this.httpRequest.setRequestHeader("accept","text/event-stream");this.httpRequest.setRequestHeader("Content-Type","application/json");
this.httpRequest.setRequestHeader("anti-csrftoken-a2z",b);this.httpRequest.send(JSON.stringify(a))};a.prototype.close=function(a){this.httpRequest.onerror=function(){};this.httpRequest.abort()};return{buildStreamingEndpointCall:function(b){return new a(b)}}})});g.now("nile-inline-collapse-bottom-sheet").execute(function(f){f||g.when("A","nile-inline-element-prefix-utils").register("nile-inline-collapse-bottom-sheet",function(d,b){return{registerCollapseBottomSheetActions:function(){var a=b.prefixed("nile-inline-widget");
a=d.$("[data-component-type\x3d"+a+"]");if(1===a.length||1===a.parent().length){a=a.parent()[0];var e=!1;(new IntersectionObserver(function(a){e?a[0].isIntersecting?g.when("mash").execute(function(a){a.dispatchEvent({type:"nice:inViewPort"})}):g.when("mash").execute(function(a){a.dispatchEvent({type:"nice:outViewPort"})}):e=!0},{threshold:.05})).observe(a)}}}})})});
/* ******** */
'use strict';(function(c){var h=window.AmazonUIPageJS||window.P,k=h._namespace||h.attributeErrors,b=k?k("NileInlineCustomerExperienceWidgetDPXRexAssets@ask",""):h;b.guardFatal?b.guardFatal(c)(b,window):b.execute(function(){c(b,window)})})(function(c,h,k){c.now("askSearch").execute(function(b){b||c.when("A","jQuery","rufusAskExpander","ready").register("askSearch",function(l,e,a){function b(){c&&c.abort();e(".askAnswerContainer").remove()}var c;return{setupExpander:function(){a.setupDesktopSeeMoreLessToggle();
a.setupMobileExpander()},executeSearch:function(a,g,m){m&&b();a={indicator:e("#ask-only-spinner"),params:{asin:a,query:g,isBlue:m},timeout:1E4,success:function(d){b();e("#ask-answer-container").append(d)}};c=l.get("/rufus/web/askSearch",a)},clearSearch:b}})});c.now("rufusAskExpander").execute(function(b){b||c.when("A","jQuery","ready").register("rufusAskExpander",function(b,e){return{setupDesktopSeeMoreLessToggle:function(){e(document).delegate(".askSeeMore","click",function(a){e(a.currentTarget).closest(".askExpanderContainer").addClass("askExpanderExpanded");
a.preventDefault()});e(document).delegate(".askSeeLess","click",function(a){e(a.currentTarget).parents(".askExpanderContainer").removeClass("askExpanderExpanded");a.preventDefault()})},setupMobileExpander:function(){b.on("a:expander:askMobileLiveSearchResultExpander:toggle:expand",function(a){a=a.expander.$expander;a.find(".askMobileLiveSearchResultHeaderTextExpanded").css("display","block");a.find(".askMobileLiveSearchResultHeaderTextCollapsed").hide()});b.on("a:expander:askMobileLiveSearchResultExpander:toggle:collapse",
function(a){a=a.expander.$expander;a.find(".askMobileLiveSearchResultHeaderTextExpanded").hide();a.find(".askMobileLiveSearchResultHeaderTextCollapsed").css("display","block")})}}})});c.now("askAbstractPostQuestion").execute(function(b){b||c.when("A","ready").register("askAbstractPostQuestion",function(b){var e=b.$,a={postQuestionTextInputSelector:"input",callbacks:{goodQuestion:function(){},badQuestion:function(){},emptyQuestion:function(){}}};return{setup:function(c,l){var f=e.extend(!0,{},a,l),
g=!1;if(f.modalName)b.on("a:popover:beforeShow:"+f.modalName,function(a){g=!1});if(f.bottomSheetName)b.on("a:sheet:beforeShow:"+f.bottomSheetName,function(a){g=!1});b.declarative(c,"click",function(){var a=e(f.postQuestionTextInputSelector).find("input").andSelf().filter("input").val();a||(a=e(f.postQuestionTextInputSelector).find("textarea").andSelf().filter("textarea").val());var d=e(f.formSelector+" .promptPostQuestionTextInput"),b=e(f.modalFormSelector+" textarea");a=b.length?b.val():d.length?
d.val():a;"undefined"===typeof a||a.match(/^\s*$/)?f.callbacks.emptyQuestion():g?f.callbacks.goodQuestion():-1===a.indexOf("?")&&-1===a.indexOf("؟")?(f.callbacks.badQuestion(),g=!0):f.callbacks.goodQuestion()})}}})});c.now("askPostQuestion").execute(function(b){b||c.when("A","askAbstractPostQuestion","nile-inline-csrf","nile-inline-state-manager","ready").register("askPostQuestion",function(b,c,a,h){function e(a){d(".askMobilePostQuestionSuccessContainer").find(".post-success-response").html(a);g(".askMobilePostQuestionSuccessContainer")}
function f(a){if(401===a.status||466===a.status)d(".askMobilePostQuestionFormInBottomSheet").submit();else{a=a.http.responseText;var b=d(".askMobilePostQuestionFailureContainer").find(".failureDefaultMsg");a&&0<a.length?(d(".askMobilePostQuestionFailureContainer").find(".failureResponseMsg").html(a),b.hide()):b.show();g(".askMobilePostQuestionFailureContainer")}}function g(a,b){b=b||d("#ask-mobile-post-question-modal-container");b.children().hide();a=b.find(a);a.removeClass("aok-hidden");a.show()}
function m(c,e,f){var n={};d.each(c.serializeArray(),function(a,b){n[b.name]=b.value});n.askAsin=h.getState().asin;b.post(c.attr("action"),{withCredentials:!0,params:JSON.stringify(n),paramsFormat:"json",headers:{"anti-csrftoken-a2z":a.getRawCsrfToken("#rufusInlineCsrfTokenContainer"),"Content-Type":"application/json"},timeout:1E4,indicator:d(".askMobilePostQuestionSpinner"),success:e,error:f})}var d=b.$,k=null,l=function(a){d("#ask-post-question-text-area").attr("aria-invalid","true");g(a,d(".askMobilePostQuestionMsgContainer"))},
p={postQuestionTextInputSelector:"#ask-mobile-post-question-modal-container .askMobilePostQuestionInput",bottomSheetName:"ask-mobile-post-question-modal",callbacks:{goodQuestion:function(){d("#ask-post-question-text-area").removeAttr("aria-invalid");d(".askMobilePostQuestionSubmitButtons").hide();d(".askMobilePostQuestionMsgContainer").children().hide();m(d(".askMobilePostQuestionFormInBottomSheet"),e,f)},badQuestion:function(){l(".askBadQuestionError")},emptyQuestion:function(){l(".askEmptyQuestionError")}}};
return{registerDeclarativeActions:function(){var a=function(){var a=d("*[id*\x3dask-mobile-post-question-modal]");1<a.length&&0<d(".a-sheet-content-container #ask-mobile-post-question-modal").length&&a.each(function(){0>=d(this).closest(".a-sheet-content-container").length&&d(this).remove()})},e=function(b){a();b=d("#dpx-rex-nile-search-text-input").val();if(k!==b){var c=d("#ask-mobile-post-question-modal-container .askMobilePostQuestionInput").find("input").andSelf().filter("input");c&&0!==c.length||
(c=d("#ask-mobile-post-question-modal-container .askMobilePostQuestionInput").find("textarea").andSelf().filter("textarea"));c.val(b);k=b}d(".askMobilePostQuestionMsgContainer").children().hide();g(".askMobilePostQuestionFormInBottomSheet");d(".askMobilePostQuestionSubmitButtons").show()};b.on("a:sheet:beforeShow:ask-mobile-post-question-modal",e);b.on("a:popover:beforeShow:ask-mobile-post-question-modal",e);b.declarative("ask-mobile-post-question-input-keyup","keypress",function(a){a&&a.$event&&
13===a.$event.which&&a.$event.preventDefault()});c.setup("ask-mobile-post-question-submit",p)}}})})});
/* ******** */
'use strict';(function(g){var v=window.AmazonUIPageJS||window.P,w=v._namespace||v.attributeErrors,d=w?w("NileInlineCustomerExperienceWidgetDPXRexAssets@rufus",""):v;d.guardFatal?d.guardFatal(g)(d,window):d.execute(function(){g(d,window)})})(function(g,v,w){g.now("nile-inline-answer-chunk-handler").execute(function(d){d||g.when("A","jQuery","a-truncate","nile-inline-html-truncator","nile-inline-loader-utils","dpx-rex-nile-inline-display-utils","ready").register("nile-inline-answer-chunk-handler",function(a,
d,m,h,k,e){function c(a){return a.filter('[id^\x3d"section_groupId_"]').map(function(){return this.id}).get()}function g(a,e,k){c(k).forEach(function(f){var c=f.includes("related_questions")?e:a,h=k.filter("#"+f);f=c.find("#"+f);if(f.length){c=parseInt(f.attr("data-ask-sequenceId"));var d=parseInt(h.attr("data-ask-sequenceId"));if(isNaN(c)||isNaN(d)||c<=d)f.html(h.html()),f.attr("data-ask-sequenceId",h.attr("data-ask-sequenceId"))}else c.append(h)})}var q=a.$("#dpx-rex-nile-inline-see-more-outer");
return{handleChunk:function(a){var c=d("#dpx-rex-nile-inline-answer-text-container").attr("role","status"),m=d("#dpx-rex-nile-inline-followon-pills-outside-container");if(a=a.trim()){k.hideLoader();e.show("#dpx-rex-nile-inline-answer-container");var f=d(a);a=f[0]&&f[0].dataset.askBlueChunkType?f:d("\x3cdiv/\x3e").append(a);g(c,m,d(a));h.maybeTruncate(c,q,9);return c}}}})});g.now("nile-inline-chunk-renderer").execute(function(d){d||g.when("A","nile-inline-answer-chunk-handler","nile-inline-error-chunk-handler",
"nile-inline-feedback-chunk-handler","nile-inline-state-manager","dpx-nile-inline-constants").register("nile-inline-chunk-renderer",function(a,d,m,h,k,e){return{renderChunk:function(a,g){g.beforeChunk(a);if("CONTEXT_CHUNK"===a.type)a=JSON.parse(a.data).requestContext,k.getState()&&a&&k.extend({conversationHistoryId:a.conversationHistoryId,requestId:a.requestId});else if("chunk"===a.type){var c=JSON.parse(a.data).htmlRenderedChunk;if(c){var q=null;if("text"===a.lastEventId)q=d.handleChunk(c);else if("feedback_chunk"===
a.lastEventId)q=h.handleChunk(c);else if("sensitive_chunk"===a.lastEventId||"softlanding_error_chunk"===a.lastEventId||"internal_error_chunk"===a.lastEventId)k.extend({streamingState:e.streamingState.ERROR}),m.handleChunk(c,a.lastEventId);g.afterChunkRender(a,q)}}}}})});g.now("dpx-rex-nile-inline-widget-instrumentation").execute(function(d){d||g.when("A","nice-srp-utils","nile-inline-state-manager","ready").register("dpx-rex-nile-inline-widget-instrumentation",function(a,d,g){function h(b){var a=
Array.from(arguments).slice(1,arguments.length);return function(){for(var l=arguments.length,f=Array(l),c=0;c<l;c++)f[c]=arguments[c];b.apply(void 0,a.concat(f))}}function k(b){b=[b.dataset.blueMetrics,b.dataset.actionId];b=b.filter(function(b){return b!==w&&null!==b&&""!==b});return b.join(":")}function e(b){for(var a=Object.keys(b),f=0;f<a.length;f++){var c=a[f],e=b[c];null===e||e===w?e="":"number"===typeof e&&(e=e.toString());b[c]=e}return b}function c(b,a){var l=d.getAppInfo(),f=d.getAppContext(),
c=g.getState();b=Object.assign({timestamp:u(new Date),producerId:"mshop-nile",metadata:'{"program":"BLUE_DPX"}',isBeta:!1,deviceTypeId:f&&f.di&&f.di.dti||"",directedCustomerId:c.directedCustomerId||"",appVersion:l&&l.version||"",locale:c.locale||"UNKNOWN",marketplaceId:c.marketplaceId||"UNKNOWN",uxSessionId:"",sessionId:d.getAppSessionId()||""},b);"undefined"!==typeof ue&&ue.event(e(b),"mshop-nile",a)}function m(b,a){"CONTEXT_CHUNK"===a.type?b.requestId||(b.requestId=JSON.parse(a.data).requestContext.requestId,
x(b,b.actionId||"ANSWER"),b.searchTrigger!==w&&c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(b.requestStartAt),nileRequestId:b.requestId,clickstreamRequestId:null,eventName:"SEARCH_TRIGGER",eventDetail:b.searchTrigger},"mshop.nile.events.4")):"chunk"===a.type&&O.includes(a.lastEventId)&&b.chunks.addFromEvent(a)}function q(b,a){if(a=a[0])a.isIntersecting||!b.answer.impressingStartAt?b.answer.impressingStartAt=new Date:(b.answer.impressingEndAt=new Date,0===a.boundingClientRect.width&&0===a.boundingClientRect.height?
z(b,"SEARCH_RESULTS_CLEARED"):z(b,"SCROLLED_AWAY"),b.answer.impressingStartAt=null,b.answer.impressingEndAt=null)}function n(b,a){var f=b.luggage,l=f.items[b.key];if(a=a[0])a.isIntersecting?(l.impressingStartAt=new Date,f.visibleElems.add(l.key)):l.impressingStartAt&&(l.impressingEndAt=new Date,l.reason=0===a.boundingClientRect.width&&0===a.boundingClientRect.height?"SEARCH_RESULTS_CLEARED":"SCROLLED_AWAY",A(b),l.impressingStartAt=null,l.impressingEndAt=null,f.visibleElems.remove(l.key))}function F(b){var a=
b.luggage.items[b.key];a.impressingStartAt&&"visible"!==document.visibilityState&&(document.contains(a.elem)&&(a.impressingEndAt=new Date,a.reason="PAGE_HIDDEN",A(b)),document.removeEventListener("visibilitychange",a.pageVisibilityChangeListener))}function r(b){b.answer.impressingStartAt&&"visible"!==document.visibilityState&&(b.answer.impressingEndAt=new Date,z(b,"PAGE_HIDDEN"),b.answer.observer.unobserve(b.answer.elem),document.removeEventListener("visibilitychange",b.answer.visibilityChangeListener))}
function f(b,a,f){f=f.find("[data-blue-metrics]");var l=h(G,b);b.visibilityChangeListenerForLatency=l;document.addEventListener("visibilitychange",b.visibilityChangeListenerForLatency);(l=document.getElementById("dpx-rex-nile-search-text-input"))&&!l.hasAttribute("listenerOnFocus")&&(l.addEventListener("touchend",h(v,b)),l.setAttribute("listenerOnFocus","true"));(l=document.getElementsByClassName("dpx-rex-nice-clear-widget")[0])&&!l.hasAttribute("listenerOnErase")&&(l.addEventListener("touchend",
h(U,b)),l.setAttribute("listenerOnErase","true"));t(b);for(l=0;l<f.length;l++){var c=f[l],e=k(c);b.items[e]?b.items[e].elem=c:(b.items[e]={key:e,elem:c,name:c.dataset.blueMetrics,detail:c.dataset.actionId},y(b,a,c.dataset.actionId));c={luggage:b,key:e};e=c;var d=e.luggage.items[e.key];d.elem.observer||(d.elem.observer=new IntersectionObserver(h(n,e),{threshold:.85}),d.elem.observer.observe(d.ghost||d.elem),d.pageVisibilityChangeListener||(d.pageVisibilityChangeListener=h(F,e),document.addEventListener("visibilitychange",
d.pageVisibilityChangeListener)));e=c.luggage.items[c.key];e.elem.clickListener||(e.elem.clickListener=h(V,c),e.elem.addEventListener("click",e.elem.clickListener))}}function t(b){var a=document.getElementById("dpx-rex-nile-search-text-input");a&&!a.hasAttribute("listenerOnErase")&&(a.addEventListener("input",function(){!H&&0<a.value.length?H=!0:H&&0===a.value.length&&(c({schemaId:"mshop.nile.events.4",eventTimeUTC:(new Date).toISOString(),nileRequestId:C.luggage&&C.luggage.requestId,clickstreamRequestId:null,
eventName:"SEARCH_INPUT_ERASE",eventDetail:"CLEAR"},"mshop.nile.events.4"),H=!1)}),a.setAttribute("listenerOnErase","true"))}function D(b,l,c){if("chunk"===l.type&&O.includes(l.lastEventId)){var e=b.chunks.markAsRendered(l);if("text"===l.lastEventId){if(l=document.getElementById("dpx-rex-nile-inline-answer-text-container")){var d=b.answer,k=document.getElementById("ghost");if(!k){var g=document.createElement("div");a.$(g).addClass("nile-inline-ghost");k=document.createElement("div");k.id="ghost";
k.className="ghost-inner-div";a.$(g).append(k);a.$(l).append(g)}d.ghost=k;b.answer.elem=l;y(b,e,"ANSWER");l=b.answer;l.observer||(l.observer=new IntersectionObserver(h(q,b),{threshold:.85}),l.visibilityChangeListener=h(r,b),document.addEventListener("visibilitychange",l.visibilityChangeListener),l.observer.observe(l.ghost||l.elem));f(b,e,c);e=c.find("#nile-category-cards-mobile-carousel");c=c.find("[id^\x3dsection_groupId_related_questions]");I(b,e,"category_list_carousel_horizontal");I(b,c,"FOLLOW_ON_PILLS_OUTSIDE_SEEMORE")}}else"feedback_chunk"===
l.lastEventId&&(y(b,e,"ANSWER_FEEDBACK"),e=c.find("#dpx-rex-nile-thumbs-up")[0],c=c.find("#dpx-rex-nile-thumbs-down")[0],e&&c&&(e.addEventListener("touchend",h(K,b),{once:!0}),c.addEventListener("touchend",h(L,b),{once:!0})))}}function T(b,a){b.chunks.addFromEvent(a)}function M(b,a,e){b.requestEndAt=new Date;a=b.chunks.markAsRendered(a);var l=e[0].matches("[data-blue-request-id]")&&e[0]||e[0].querySelector("[data-blue-request-id]");l&&(b.requestId=l.dataset.blueRequestId,c({schemaId:"mshop.nile.events.4",
eventTimeUTC:u(b.requestStartAt),nileRequestId:b.requestId,clickstreamRequestId:null,eventName:"INVOKE_NILE",eventDetail:b.actionId||"default_pills_fetched"},"mshop.nile.events.4"),x(b),f(b,a,e),I(b,e,"DEFAULT_PILLS"))}function K(b,a){Q(b,"THUMBS_UP")}function L(b,a){Q(b,"THUMBS_DOWN")}function I(b,a,f){a&&(a=a.find(".a-carousel-viewport")[0])&&a.addEventListener("scroll",h(B,b,f),{once:!0})}function J(b,a){b.requestEndAt=new Date;document.removeEventListener("visibilitychange",b.visibilityChangeListenerForLatency)}
function G(b){if("visible"!==document.visibilityState&&!b.requestEndAt){b.interruptedAt=new Date;var a=b.flow.toUpperCase(),f=b.chunks.maybeGetLastRendered();c({schemaId:"mshop.nile.latency.6",nileRequestId:b.requestId,elementId:a,seqId:f?f.index+1:0,requestStartTimeUTC:u(b.requestStartAt),renderingStartTimeUTC:"",renderingEndTimeUTC:"",interruptedTimeUTC:u(b.interruptedAt)},"mshop.nile.latency.6");0<Object.keys(b.items).length||(document.removeEventListener("visibilitychange",b.visibilityChangeListenerForLatency),
R(b,"PAGE_HIDDEN"))}}function z(b,a){c({schemaId:"mshop.nile.impressions.1",nileRequestId:b.requestId,elementId:"ANSWER",seqId:0,requestStartTimeUTC:u(b.requestStartAt),impressionStartTimeUTC:u(b.answer.impressingStartAt),impressionEndTimeUTC:u(b.answer.impressingEndAt),impressionEndReason:a},"mshop.nile.impressions.1")}function A(b){var a=b.luggage;b=a.items[b.key];c({schemaId:"mshop.nile.impressions.1",nileRequestId:a.requestId,elementId:b.detail||b.name,seqId:b.chunkId||0,requestStartTimeUTC:u(a.requestStartAt),
impressionStartTimeUTC:u(b.impressingStartAt),impressionEndTimeUTC:u(b.impressingEndAt),impressionEndReason:b.reason},"mshop.nile.impressions.1")}function y(b,a,f){c({schemaId:"mshop.nile.latency.6",nileRequestId:b.requestId,elementId:f,seqId:a.index,requestStartTimeUTC:u(b.requestStartAt),renderingStartTimeUTC:u(a.renderingStartAt),renderingEndTimeUTC:u(a.renderingEndAt),interruptedTimeUTC:""},"mshop.nile.latency.6")}function x(a,f){c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(a.requestStartAt),
nileRequestId:a.requestId,clickstreamRequestId:null,eventName:"INVOKE_NILE_BACKEND_API",eventDetail:f},"mshop.nile.events.4")}function Q(a,f){c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(new Date),nileRequestId:a.requestId,clickstreamRequestId:null,eventName:"MAIN_FEEDBACK_REQUEST",eventDetail:f},"mshop.nile.events.4")}function V(a){var b=a.luggage.items[a.key];c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(new Date),nileRequestId:a.luggage.requestId,clickstreamRequestId:null,eventName:b.name,
eventDetail:b.detail},"mshop.nile.events.4")}function B(a,f){c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(new Date),nileRequestId:a.requestId,clickstreamRequestId:null,eventName:"SCROLL_BUTTON_CAROUSEL",eventDetail:f},"mshop.nile.events.4")}function v(a){c({schemaId:"mshop.nile.events.4",eventTimeUTC:(new Date).toISOString(),nileRequestId:C.luggage&&C.luggage.requestId,clickstreamRequestId:null,eventName:"SEARCH_INPUT_FOCUS",eventDetail:"TOUCH"},"mshop.nile.events.4")}function U(a){c({schemaId:"mshop.nile.events.4",
eventTimeUTC:(new Date).toISOString(),nileRequestId:a.requestId,clickstreamRequestId:null,eventName:"CLEAR_BUTTON_PRESS",eventDetail:"clear_button_touch"},"mshop.nile.events.4");H=!1}function R(a,f){c({schemaId:"mshop.nile.events.4",eventTimeUTC:u(a.interruptedAt),nileRequestId:a.requestId,clickstreamRequestId:null,eventName:"CONVERSATION_ABANDONMENT",eventDetail:f},"mshop.nile.events.4")}function N(){var a=document.getElementById("dpx-rex-nile-search-text-input");return a&&a.value||""}function S(){if("visible"!==
document.visibilityState){var a=N();""!==a&&a!==C.textInputValue&&(R({interruptedAt:new Date},"QUERY_NOT_SUBMITTED"),document.removeEventListener("visibilitychange",S))}}function u(a){return a instanceof Date?a.toISOString():""}function W(a){return(a=(a=a&&a.event&&a.event.$event&&a.event.$event.target)&&a.closest("[data-blue-metrics]"))&&a.dataset&&a.dataset.actionId}function X(a){var b=a.flow;var f="answer"!==a.flow?w:a.event.triggerSource||"ENTER_PRESSED_SOURCE";return{flow:b,searchTrigger:f,actionId:W(a),
chunks:{length:0,addFromEvent:function(a){var b={event:a,renderingStartAt:new Date,index:this.length};a.index=b.index;return[].push.call(this,b)},getFromEvent:function(a){return this[a.index]},maybeGetLastRendered:function(){for(var a=this.length,b=0;b<a&&this[b].renderingEndAt;b++);return 0===b?null:this[b-1]},markAsRendered:function(a){a=this.getFromEvent(a);a.renderingEndAt=new Date;return a}},requestStartAt:new Date,requestEndAt:null,answer:{},visibleElems:{length:0,add:function(a){this[a]||[].push.call(this,
a)},remove:function(a){delete this[a]}},items:{}}}var O=["text","feedback_chunk"],C={textInputValue:N()},H=!1;document.addEventListener("visibilitychange",S);return{executeAndLogMetrics:function(a,f){f=X(f);var b=C.luggage;b&&(document.removeEventListener("visibilitychange",b.visibilityChangeListenerForLatency),b.answer&&b.answer.observer&&(b.answer.observer.unobserve(b.answer.elem),document.removeEventListener("visibilitychange",b.answer.visibilityChangeListener)));C.luggage=f;C.textInputValue=N();
f={beforeChunk:h(m,f),afterChunkRender:h(D,f),afterFullRender:h(J,f),beforePillRender:h(T,f),afterPillRender:h(M,f)};a(f)},buildContext:function(a,f){return{flow:a,event:f}}}})});g.now("nile-inline-answer-streamer").execute(function(d){d||g.when("A","nile-inline-html-truncator","nile-inline-chunk-renderer","nile-inline-loader-utils","nile-inline-csrf","nile-inline-event-stream-builder","nile-inline-uuid-generator","nile-inline-container-manager","nile-inline-search-input-button-controller","nile-inline-state-manager",
"dpx-rex-nile-inline-display-utils","dpx-rex-nile-inline-widget-instrumentation","dpx-nile-inline-constants","askSearch","ready").register("nile-inline-answer-streamer",function(a,d,g,h,k,e,c,E,p,n,F,r,f,t){function m(a,e){return function(c){a===z&&(g.renderChunk(c,e),n.extend({streamingState:f.streamingState.ANSWER_LOADING}))}}function q(a){return function(){a.close();n.extend({streamingState:f.streamingState.ERROR});F.displayGenericError()}}function M(e,c){return function(){z=null;e.close();n.getState().streamingState!==
f.streamingState.ERROR&&n.extend({streamingState:f.streamingState.ANSWER_RENDERED});c.afterFullRender();a.$("#dpx-rex-nile-inline-answer-text-container").attr("tabindex","0");a.$("#dpx-rex-nile-inline-answer-text-container").focus();h.hideLoader();h.hideTrailingLoader()}}function K(e,c){E.clearAnswerContainer();p.showClearButton();c&&(J(),n.extend({streamingState:f.streamingState.ANSWER_LOADING}),d.setIsAnswerExpanded(!1),F.hide("#dpx-rex-nile-inline-default-pills-container"),e&&(a.$("#dpx-rex-nile-search-text-input").val(e),
a.$("#dpx-rex-nile-search-text-input").removeAttr("aria-describedby")),h.showLoader(),h.showTrailingLoader(),a.$("#dpx-rex-nile-trailing-loader").attr("tabindex","0"),a.$("#dpx-rex-nile-trailing-loader").focus())}function L(a,f,e){a=r.buildContext(f,a);r.executeAndLogMetrics(function(a){e(a)},a)}function I(a){var e=n.getState(),c=e.streamingState===f.streamingState.ERROR;e=(e.streamingState===f.streamingState.ANSWER_RENDERED||e.streamingState===f.streamingState.ANSWER_LOADING)&&a===A;return a?c?!0:
e?!1:!0:!1}function J(){G&&G.close()}var G=null,z=null;n.extend({streamingState:f.streamingState.NOT_STARTED});var A;return{streamAnswer:function(a,f,d){var h=a.query;if(I(h)){A=h;var g=n.getState().blueEnabled;K(h,g);g&&L(f,d,function(f){var d=c.generateUuid();z=d;var h=k.getRawCsrfToken("#rufusInlineCsrfTokenContainer"),g=e.buildStreamingEndpointCall("/rufus/web/renderedAnswer?");d=m(d,f);var t=q(g);f=M(g,f);g.setErrorCallback(t);g.addEventListener("CONTEXT_CHUNK",d);g.addEventListener("chunk",
d);g.addEventListener("close",f);g.startPostStream(a,h,6E4);G=g});t.executeSearch(a.asin,h,g)}},closeStream:J}})});g.now("nile-inline-request-builder").execute(function(d){d||g.when("A","nile-inline-state-manager","ready").register("nile-inline-request-builder",function(a,d){function g(a){return(a=(a=(a=a&&a.$target)&&a.closest("[data-action-url]")[0])&&a.dataset)?{actionUrl:a.actionUrl}:{}}function h(a,c,g){var e=d.getState();return Object.assign({query:a,searchSource:c,asin:e.asin,programId:"BLUE_DPX_REX"},
g)}function k(){var a=d.getState();return{programId:"BLUE_DPX_REX",conversationId:a&&a.conversationHistoryId||"",turnRequestId:a&&a.requestId||"",gmtTime:(new Date).toISOString()}}return{buildFollowOnPillClickRequest:function(a,c){return h(a,"BLUE_FOLLOWON_PILL_CLICK_SOURCE",g(c))},buildDefaultPillClickRequest:function(a,c){return h(a,"BLUE_PILL_CLICK_SOURCE",g(c))},buildSearchInputRequest:function(a){return h(a,"LIVE_SEARCH_SOURCE",{})},buildFocusedOutRequest:function(a){return h(a,"BLUE_FOCUS_OUT_SOURCE",
{})},buildFeedbackRequest:function(a,c,d){return Object.assign({feedbackType:a,mainFeedback:c},d,k())},buildDetailFeedbackRequest:function(a,c){return Object.assign({feedbackType:"DETAIL_FEEDBACK",detailFeedback:a,freeformFeedback:c},k())}}})});g.now("dpx-rex-nile-inline-display-utils").execute(function(d){d||g.when("A","nile-inline-loader-utils","ready").register("dpx-rex-nile-inline-display-utils",function(a,d){function g(e){a.$(e).removeClass(k.join(" "));a.$(e).removeAttr("aria-hidden")}function h(e){return k.some((c)=>
a.$(e).hasClass(c))}var k=["dpx-rex-nile-inline-hidden","nile-inline-hidden","askHidden"];return{show:g,hide:function(e){a.$(e).addClass("dpx-rex-nile-inline-hidden");a.$(e).attr("aria-hidden","true")},isHidden:h,isButtonClickEvent:function(a){var c=a.$event;return 32===c.keyCode?(c.preventDefault(),!0):13===c.keyCode||"click"===a.type},displayGenericError:function(){h("#dpx-rex-nile-inline-answer-text-container-error")&&(g("#dpx-rex-nile-inline-answer-generic-error"),d.hideLoader(),d.hideTrailingLoader(),
g("#dpx-rex-nile-inline-answer-container"),g("#nile-inline-ai-generated-label"),a.$("#dpx-rex-nile-search-text-input").attr("aria-describedby","dpx-rex-nile-inline-answer-generic-error"),a.$("#dpx-rex-nile-inline-answer-generic-error").attr("tabindex","0"),a.$("#dpx-rex-nile-inline-answer-generic-error").focus())}}})});g.now("nile-inline-container-manager").execute(function(d){d||g.when("A","nile-inline-feedback-actions","dpx-rex-nile-inline-display-utils","nile-inline-state-manager","dpx-nile-inline-constants",
"nile-inline-loader-utils","ready").register("nile-inline-container-manager",function(a,d,g,h,k,e){var c=a.$;return{clearAnswerContainer:function(){h.extend({streamingState:k.streamingState.NOT_STARTED});g.hide("#dpx-rex-nile-inline-answer-container");c("#dpx-rex-nile-inline-answer-text-container").empty();c("#dpx-rex-nile-inline-answer-container-truncating-sandbox").find(".a-truncate-full").empty();c("#dpx-rex-nile-inline-followon-pills-outside-container").empty();d.setFeedbackSent(!1);d.clearFeedbackContainer();
c("#dpx-rex-nile-inline-answer-text-container-error").empty();e.hideLoader();e.hideTrailingLoader();g.hide("#dpx-rex-nile-inline-data-container, #dpx-rex-nile-inline-answer-text-container-error, #nile-inline-ai-generated-label, #dpx-rex-nile-inline-answer-generic-error");c("#dpx-rex-nile-inline-answer-text-container-error, #dpx-rex-nile-inline-answer-generic-error").removeClass("nile-inline-text-container-collapsed-error")}}})});g.now("nile-inline-html-truncator").execute(function(d){d||g.when("A",
"nile-inline-feedback-actions","nile-inline-loader-utils","nile-inline-state-manager","dpx-nile-inline-constants","dpx-rex-nile-inline-display-utils").register("nile-inline-html-truncator",function(a,d,g,h,k,e){function c(a){var f=a.children();a[0].style.removeProperty("height");a.find("#"+m(a,"html-truncator-marker")).addClass("dpx-rex-nile-inline-hidden");Array.from(f).forEach((a)=>{a.removeAttribute("aria-hidden")})}function m(a,c){return a[0].id?a[0].id+"-"+c:c}function q(f,c,e){e=m(f,"html-truncator-marker");
var d=f.find("#"+e);0===d.length?(c=c.clone(!0),c.removeClass("nile-inline-hidden"),d=a.$(document.createElement("span")),d[0].id=e,d.addClass("nile-inline-truncation-overflow-marker"),d.append(c),f.append(d)):d.removeClass("dpx-rex-nile-inline-hidden");return d}function n(a,c,e,d,g,h,k,m){k=a.children();d=q(a,d,g);var f=d[0].getBoundingClientRect(),t=document.createRange();t.selectNode(c);var n=t.getBoundingClientRect();t=a[0].getBoundingClientRect();var r=n.height/Math.round(n.height/m);a[0].style.setProperty("height",
t.height-(f.bottom-(n.bottom-h*r))+(m-r)/2+"px");a=document.createElement("span");c.nodeType===Node.TEXT_NODE?"BR"===c.tagName?c.before(a):c.after(a):"BR"===c.tagName?c.before(a):c.append(a);c=t.width-d.children()[0].offsetWidth-10;m=a.offsetLeft+10;0<h&&k[e].setAttribute("aria-hidden","true");0===h&&m<c?d[0].style.setProperty("left",m+"px"):(d[0].style.removeProperty("left"),k[e].setAttribute("aria-hidden","true"));Array.from(k).slice(e+1).forEach((a)=>{a.id!==g&&a.setAttribute("aria-hidden","true")});
a.remove()}var F=["absolute","fixed"],r=!1;return{maybeTruncate:function(a,d,e){if(r)return!1;var f=m(a,"html-truncator-marker");var h=m(a,"sandbox");var k=a.parent().find("#"+h);k[0]||(k=a.clone(),k[0].id=h,k.addClass("a-offscreen"),a.after(k));h=k;k=a.children();h.empty();var q=h[0].getBoundingClientRect().height;h.append("\x3cbr\x3e");q=h[0].getBoundingClientRect().height-q;for(var t=0,p=null,E=0,z=0,A=!1,y=0;y<k.length;y++){var x=0;if(A)break;if(-1===F.indexOf(v.getComputedStyle(k[y]).position)&&
k[y].id!==f){var w=k[y].childNodes;h.empty();for(var D=0;D<w.length;D++){var B=w[D];if(B.nodeType!==Node.TEXT_NODE||""!==B.textContent.trim()){var P=B.nodeType===Node.TEXT_NODE?"inline":v.getComputedStyle(B).display;if(P&&P.startsWith("inline")&&t<=e)if(x=B.cloneNode(!0),x.removeAttribute&&x.removeAttribute("id"),h.append(x),x=Math.round(h[0].offsetHeight/q),t+x===e)p=B,E=y;else if(t+x>e){A=!0;z=p?0:t+x-e;E=(p=p||B)?E:y;break}}}t+=x}}A?(n(a,p,E,d,f,z,h,q),g.hideTrailingLoader()):c(a);return A},expand:c,
registerTruncationActions:function(){a.declarative("nile-inline-see-more","click",function(f){c(a.$("#dpx-rex-nile-inline-answer-text-container"));r=!0;h.getState().streamingState===k.streamingState.ANSWER_LOADING&&g.showTrailingLoader()});a.declarative.create(a.$("#dpx-rex-nile-inline-see-more-action"),"nile-inline-see-more",{})},getIsAnswerExpanded:function(){return r},setIsAnswerExpanded:function(a){r=a}}})});g.now("dpx-nile-inline-constants").execute(function(d){d||g.declare("dpx-nile-inline-constants",
{streamingState:{NOT_STARTED:0,ANSWER_LOADING:1,ANSWER_RENDERED:2,ERROR:3}})});g.now("nile-inline-search-input-button-controller").execute(function(d){d||g.when("dpx-rex-nile-inline-display-utils","nile-inline-state-manager","ready").register("nile-inline-search-input-button-controller",function(a,d){return{showSubmitButton:function(){var g=d.getState().blueEnabled;a.hide("#dpx-rex-nice-clear-button");g&&a.show("#dpx-rex-nile-submit-button")},showClearButton:function(){a.hide("#dpx-rex-nile-submit-button");
a.show("#dpx-rex-nice-clear-button")}}})});g.now("nile-inline-dpx-reset-widget").execute(function(d){d||g.when("A","nile-inline-default-pill-actions","nile-inline-container-manager","nile-inline-answer-streamer","nile-inline-html-truncator","nile-inline-search-input-button-controller","askSearch").register("nile-inline-dpx-reset-widget",function(a,d,g,h,k,e,c){return function(){h.closeStream();g.clearAnswerContainer();k.setIsAnswerExpanded(!1);d.showDefaultPills();a.$("#dpx-rex-nile-search-text-input").val("");
a.$("#dpx-rex-nile-search-text-input").removeAttr("aria-describedby");e.showSubmitButton();c.clearSearch()}})});g.now("nile-inline-clear-button-actions").execute(function(d){d||g.when("A","nile-inline-dpx-reset-widget","dpx-rex-nile-inline-display-utils").register("nile-inline-clear-button-actions",function(a,d,g){return{registerClearButtonActions:function(){a.declarative("dpx-rex-nice-clear-button-click","click keydown",function(a){g.isButtonClickEvent(a)&&d()})}}})});g.now("nile-inline-default-pill-actions").execute(function(d){d||
g.when("A","nile-inline-request-builder","nile-inline-answer-streamer","dpx-rex-nile-inline-display-utils","ready").register("nile-inline-default-pill-actions",function(a,d,g,h){return{registerDefaultPillActions:function(){a.declarative("dpx-rex-nile-inline-pill-clicked","click",function(a){var e=d.buildDefaultPillClickRequest(a.$target[0].value,a);g.streamAnswer(e,a,"pills")})},showDefaultPills:function(){h.show("#dpx-rex-nile-inline-default-pills-container")}}})});g.now("nile-inline-search-input-actions").execute(function(d){d||
g.when("A","nile-inline-answer-streamer","nile-inline-search-input-button-controller","nile-inline-request-builder","nile-inline-state-manager","nile-inline-dpx-reset-widget","dpx-rex-nile-inline-display-utils","ready").register("nile-inline-search-input-actions",function(a,d,g,h,k,e,c){function m(a){var c=p("#dpx-rex-nile-search-text-input");c=p.trim(c.val());c="focusout"===a.type?h.buildFocusedOutRequest(c):h.buildSearchInputRequest(c);d.streamAnswer(c,a,"answer")}var p=a.$,n=!1,q=a.debounce(m,
200);return{registerSearchInputActions:function(){var d=k.getState().blueEnabled;a.declarative("dpx-rex-submit-button-clicked","click keydown",function(a){c.isButtonClickEvent(a)&&(Object.assign(a,{triggerSource:"SUBMIT_BUTTON_SOURCE"}),m(a))});d?(p("#dpx-rex-nile-search-text-input").keydown(function(a){n=13===a.which}),p("#dpx-rex-nile-search-text-input").focusout(function(a){a=a.relatedTarget;n||p(a).is("input.a-button-input")||"dpx-rex-nile-submit-button-announce"===a.id||p("#dpx-rex-nile-search-text-input").trigger({type:"keyup",
which:13,keyCode:13});n=!1}),p("#dpx-rex-nile-search-text-input").keyup(function(a){""===a.target.value&&e();13!==a.which?g.showSubmitButton():(p("#dpx-rex-nile-search-text-input").blur(),m(a))})):p("#dpx-rex-nile-search-text-input").keyup(function(a){""===a.target.value&&e();q(a)})}}})});g.now("nile-inline-feedback-actions").execute(function(d){d||g.when("A","nile-inline-csrf","nile-inline-request-builder","a-popover","dpx-rex-nile-inline-display-utils","a-button","ready").register("nile-inline-feedback-actions",
function(a,d,g,h,k,e){function c(){k.hide("#ask-blue-ai-generated-label");k.show("#ask-feedback-success-text-container")}function m(d){"THUMBS_UP"===d?(k.hide("#thumbs-up-not-selected"),k.show("#thumbs-up-selected"),a.$("#ask-blue-thumbs-up").attr("aria-disabled","true"),a.$("#ask-blue-thumbs-up").removeAttr("tabindex"),a.$("#ask-blue-thumbs-down").remove(),f.forEach(k.hide),c()):(k.hide("#thumbs-down-not-selected"),k.show("#thumbs-down-selected"),0<a.$("#a-popover-ask-blue-detail-feedback").length?
h.get(a.$("#ask-blue-detail-feedback-action")).show():k.show("#ask-blue-feedback-box"))}function p(){a.$("#ask-blue-feedback-box").remove();h.remove("ask-blue-detail-feedback");f.forEach(k.hide);a.$("#ask-blue-thumbs-up").remove();c();a.$("#ask-blue-thumbs-down").attr("aria-disabled","true").focus()}function n(c){a.$.ajax({url:"/rufus/web/feedback?",data:c,dataType:"json",type:"POST",timeout:1E4,headers:{"anti-csrftoken-a2z":d.getRawCsrfToken("#rufusInlineCsrfTokenContainer"),"Content-Type":"application/json"}})}
function q(){var c=a.$(".ask-blue-feedback-checkbox:checked").map(function(c,d){return a.$(d).val()}).get(),d;a.$("#ask-blue-feedback-option-freetext").is(":checked")&&(d=a.$("#ask-blue-feedback-textbox").val().substring(0,500));n(JSON.stringify(g.buildDetailFeedbackRequest(c,d)))}var r=!1,f=["#thumbs-up-not-selected","#thumbs-down-not-selected","#ask-blue-space-between-thumbs"];return{registerFeedbackActions:function(){a.declarative("ask-blue-thumbs-up-click","click keydown",function(a){!r&&k.isButtonClickEvent(a)&&
(n(JSON.stringify(g.buildFeedbackRequest("MAIN_FEEDBACK","THUMBS_UP",void 0))),m("THUMBS_UP"),r=!0)});a.declarative("ask-blue-thumbs-down-click","click keydown",function(a){!r&&k.isButtonClickEvent(a)&&(n(JSON.stringify(g.buildFeedbackRequest("MAIN_FEEDBACK","THUMBS_DOWN",void 0))),m("THUMBS_DOWN"),r=!0)});a.declarative("ask-blue-feedback-option-click","click",function(){1<=a.$(".ask-blue-feedback-checkbox:checked").length?(e("#ask-blue-feedback-submit").enable(),a.$("#ask-blue-feedback-submit").prop("disabled",
!1)):(e("#ask-blue-feedback-submit").disable(),a.$("#ask-blue-feedback-submit").prop("disabled",!0));a.$("#ask-blue-feedback-option-freetext").is(":checked")?k.show("#ask-blue-feedback-textbox"):k.hide("#ask-blue-feedback-textbox")});a.declarative("ask-blue-feedback-close-click","click keydown",function(a){k.isButtonClickEvent(a)&&p()});a.declarative("ask-blue-feedback-cancel-click","click",function(){p()});a.declarative("ask-blue-feedback-submit-click","click",function(){q();p()})},setFeedbackSent:function(a){r=
a},hideFeedback:function(){k.hide("#dpx-rex-nile-inline-feedback-container")},showFeedback:function(){k.show("#dpx-rex-nile-inline-feedback-container")},clearFeedbackContainer:function(){a.$("#dpx-rex-nile-inline-feedback-container").empty()}}})});g.now("nile-inline-followon-pill-actions").execute(function(d){d||g.when("A","jQuery","nile-inline-request-builder","nile-inline-answer-streamer","ready").register("nile-inline-followon-pill-actions",function(a,d,g,h){return{registerFollowOnPillActions:function(){a.declarative("followon-pill-click",
"click keypress",function(d){var e=g.buildFollowOnPillClickRequest(d.$target[0].value,d);h.streamAnswer(e,d,"pills");e=a.$("#dpx-rex-nice-widget-container");d=e.offset().top;e=d+e.outerHeight();var c=a.$(v).scrollTop(),k=c+a.$(v).height();(e<c||d>k)&&a.$(v).scrollTop(d-(0<a.$(".s-mobile-toolbar-offscreen").length?0:a.$(".s-mobile-toolbar-sticky")?a.$(".s-mobile-toolbar-sticky").outerHeight():0))})}}})});g.now("nile-inline-widget").execute(function(d){d||g.when("A","jQuery","nile-inline-feedback-actions",
"nile-inline-default-pill-actions","nile-inline-html-truncator","nile-inline-answer-chunk-handler","nile-inline-followon-pill-actions","dpx-rex-nile-inline-widget-instrumentation","nile-inline-clear-button-actions","nile-inline-search-input-actions","nile-inline-collapse-bottom-sheet","nile-inline-element-prefix-utils","askSearch","askPostQuestion","nile-inline-state-manager","ready").register("nile-inline-widget",function(a,d,g,h,k,e,c,v,p,n,w,r,f,t,D){r.setupElementPrefix("dpx-rex");var m=d("#dpx-rex-nile-inline-default-pills-container");
g.registerFeedbackActions();h.registerDefaultPillActions();k.registerTruncationActions();c.registerFollowOnPillActions();p.registerClearButtonActions();w.registerCollapseBottomSheetActions();n.registerSearchInputActions();f.setupExpander();t.registerDeclarativeActions();D.getState().blueEnabled&&(a=v.buildContext("pills"),v.executeAndLogMetrics(function(a){var c={type:"default_pills"};a.beforePillRender(c);var e=d(m);a.afterPillRender(c,e)},a))})})});
/* ******** */
