var WSB;(function(n){function hr(n,i){var r=[],u,f;if(i)if(n)r=i.slice();else{u=function(n){var t=i.find(function(t){return t.verb&&t.verb.toLocaleLowerCase()==n.toLocaleLowerCase()});t&&r.push(t)};for(f in t)u(f)}return r}function cr(n){return n?n.filter(function(n){return!n.verb||n.verb.toLowerCase()!="open"}):[]}function f(t,i,r,u,f,e){e()&&(t=t.slice(),i.getExtraVerbsAsync?n.Async.safeChain("getExtraVerbsAsync",function(){return i.getExtraVerbsAsync(u)},function(n){return l(tt(t,n,!0),i,u,f,e)},function(){return l(t,i,u,f,e)},null,r):l(t,i,u,f,e))}function l(n,t,i,r,u){if(u()){var f=t.getExtraVerbs?tt(n,t.getExtraVerbs(i),!1):n;f[0]==b&&f.shift();r(f)}}function lr(i,r,u,f){return i.map(function(i){var e,o,s,h;if(i.verb){switch(i.verb.toLocaleLowerCase()){case yt:e="PinnedToStart";break;case g:e="PinnedToTaskbar";break;case pt:e="UnpinnedFromStart";break;case nt:e="UnpinnedFromTaskbar";break;case vt:o=n.config.useCobaltCSS?"UninstallMessage":"UninstallConfirmation";e="UninstallationInProgress";break;case sr:e="PathCopied"}return s=function(t){t();n.RuntimeConfig.AlwaysWide&&e=="UninstallationInProgress"?(r.uninstallationInProgress=!0,f&&f()):e?u.showTemporaryMessage(n.Host.getLocString(e,HitHighlightingParser.removeMarkers(r.text))):u.hideTemporaryMessage();i.verb.toLocaleLowerCase()==g&&n.Host.addItemToPinnedToTaskbar(r.deviceItem.id);i.verb.toLocaleLowerCase()==nt&&n.Host.removeItemFromPinnedToTaskbar(r.deviceItem.id)},h=i.icon||t[i.verb.toLocaleLowerCase()],new n.DeviceItemVerbWrapper(i,h,function(t){o&&n.DialogBox?n.DialogBox.show(n.Host.getLocString(o),[{id:null,text:i.displayName,action:function(){return s(t)},selected:!1,useAccentColor:n.config.useCobaltCSS?!0:!1},{id:null,text:n.Host.getLocString("Cancel"),selected:!0}],n.config.useCobaltCSS?n.Host.getLocString("UninstallConfirmationTitle",HitHighlightingParser.removeMarkers(r.text)):""):s(t)})}return i})}function kt(t,i,r,u,e,o){if(n.isJumpListSuggestion(i))return n.Async.safeChain("jumpListItem.getVerbsAsync",function(){return i.jumpListItem.getVerbsAsync()},function(n){return f(cr(n),i,s,u,e,o)},function(){return f([],i,s,u,e,o)},null,t+" "+i.type),!0;var s=t+" "+i.type,h=n.getItemWithFileMetadata(i);return h&&h.canHaveContextMenu?(n.Async.safeChain("item.getVerbsAsync",function(){return h.getVerbsAsync()},function(n){return f(hr(r,n),i,s,u,e,o)},function(){return f([],i,s,u,e,o)},null,s),!0):i.getExtraVerbsAsync?(f([],i,s,u,e,o),!0):i.getExtraVerbs?(l([],i,u,e,o),!0):(u&&e([]),!1)}function e(n,t,i){var r=HitHighlightingParser.removeMarkers(n.text),u=r?r.length:0;return n.additionalInfoText&&!i&&(u+=n.additionalInfoText.length),u>(i?er:or)}function dt(n){for(var i,r={topResults:n.topResults.slice(0),groups:[]},t=0,u=n.groups;t0&&t.length>0){var r=i?n.concat(b):n;return r.concat(t)}return n.length>0?n:t.length>0?i?[b].concat(t):t:[]}function i(t,i){return t.find(function(t){return n.sameGroup(t.typeWithSource,i)})}function ni(t,i){return t.find(function(t){return n.sameGroup(t.group.typeWithSource,i)})}function ti(n,t){return n.queryToFetch.substring(0,t.queryToFetch.lastIndexOf("\\"))}function ii(t){switch(t){case n.GroupType.AnaheimDataTile:case n.GroupType.TopApps:case n.GroupType.People:return!0}return!1}function pr(t,i){if(!t.isSearchHomeZI||t.scope==n.Scope.All||i==n.GroupType.RecommendedDocs)return null;if(t.scope==n.Scope.Web){if(i==n.GroupType.Websites)return n.Host.getLocString("RecentWebsiteSection");if(i==n.GroupType.SearchSuggestions)return n.Host.getLocString("RecentWebSearchSection")}return ii(i)?n.Host.getLocString("FrequentSection"):n.Host.getLocString("RecentSection")}function wr(t){return n.Host.getLocString(t?typeof n.getIsMsbEduTenantEnabled=="function"&&n.getIsMsbEduTenantEnabled()?"SearchSchoolAndWeb":"SearchWorkAndWeb":"SearchTheWeb")}function br(){return n.Host.getLocString("Websites")}function kr(){return n.SubstrateTenantName?n.Host.getLocString("MsbTenantRecommended").replace("{0}",n.SubstrateTenantName):n.Host.getLocString("QuickWorkSearchSuggestionsSection")}function ri(t,i,r,u){var o,e,f,s,h;if(i==n.GroupType.PathCompletion)return o=ti(t,t)+"\\"+String.fromCharCode(8206),{title:o,narratorText:o};if(r&&(e=r.groupDisplayName,e))return{title:e,narratorText:u?n.Host.getLocString("AddingScopeNarratorText",e):e};if(f=pr(t,i),!f)switch(i){case n.GroupType.Command:f=n.Host.getLocString("CommandGroup");break;case n.GroupType.Cortana:f=n.Host.getLocString("CortanaGroup");break;case n.GroupType.Store:f=n.Host.getLocString("StoreGroup");break;case n.GroupType.LocalPlaces:f=n.Host.getLocString("LocalPlacesGroup");break;case n.GroupType.Related:f=n.Host.getLocString("RelatedSuggestionsGroup");break;case n.GroupType.SearchSuggestions:f=wr(n.msbEnabledForQuery(t));break;case n.GroupType.Websites:f=br();break;case n.GroupType.Contact:f=n.Host.getLocString("ContactGroup");break;case n.GroupType.LocalSearchHistory:f="Search history";break;case n.GroupType.CuratedSuggestions:f=n.Host.getLocString("SuggestedSection");break;case n.GroupType.CuratedSettings:f=n.Host.getLocString("QuickSearchSuggestionsSection");break;case n.GroupType.TopApps:f=n.Host.getLocString("TopAppsSection");break;case n.GroupType.QuickSearch:f=n.Host.getLocString("QuickSearchSuggestionsSection");break;case n.GroupType.QuickWorkSearch:case n.GroupType.QuickWorkSearchTopList:f=kr();break;case n.GroupType.VisualSearch:f="Visual search";break;case n.GroupType.MSNNews:f=n.Host.getLocString(n.config.msnNewsTitleResource);break;case n.GroupType.WelcomeExperience:f=n.Host.getLocString("WelcomeExperienceTitle");break;case n.GroupType.Upsell:f=n.Host.getLocString("RecommendedGroup");break;case n.GroupType.MRUHistory:f=n.Host.getLocString("MRUHistoryGroup");break;case n.GroupType.AnaheimDataTile:f=n.Host.getLocString("AnaheimDataTopSites");break;case n.GroupType.AnaheimDataList:r.type=="QSSG"?f=n.Host.getLocString("QuickSearchSuggestionsSection"):r.type=="ANAH"?f=n.Host.getLocString("AnaheimDataHistory"):r.type=="ANAT"?f=n.Host.getLocString("AnaheimDataTopSites"):r.type=="ANAR"&&(f=n.Host.getLocString("AnaheimDataRecentlyClosed"));break;case n.GroupType.AnaheimDataTopHit:n.config.topHitMuse&&r.type=="ANATH"&&(f="Best match for Edge history");break;case n.GroupType.RecommendedDocs:f=n.Host.getLocString("RecommendedDocsGroup");n.config.msbEnableDocumentZQ&&(f=n.Host.getLocString("RecommendedZQGroup"));break;case n.GroupType.PromoBanner:f=n.Host.getLocString("VaccineUpdate")}if(!f){if(s=n.getScope(i),s==n.Scope.All)throw new Error("Unknown group type: "+i);h=n.ScopeConfig[s];f=n.getScopeDisplayName(h)}return{title:f,narratorText:u?n.Host.getLocString("AddingScopeNarratorText",f.toLocaleLowerCase()):f}}function dr(t){var r,u,i=n.AnaheimDataProvider.getSelectedProfile();return n.config.enableAnaheimDataProfile&&i&&(i.accountType=="MSA"?r=i.id:i.accountType=="AAD"&&(u=i.id)),[{text:n.Host.getLocString("AnaheimDataEdgeSettings"),id:"anaheimDataEdgeSettings",selected:!1,useAccentColor:!0,action:function(){return n.Host.launchUrlWithEdgeProtocol(null,{edgeSettingsUrl:n.config.anaheimDataEdgeSettings,cid:r,oid:u})},instItem:n.InstrumentedItem.getNonSuggestionInstrumentedItem("ANA",n.SyntheticQSCodesMaps.KValues,19),sequenceNumber:t}]}function ui(t,i,r,u,f){var e,o=[],h,c,l=n.canShowAnaheimDataSHTile(r),p=n.canShowAnaheimDataSHList(r),w=n.canShowAnaheimDataQF(),a=t==n.GroupType.AnaheimDataTile&&l;if((t==n.GroupType.AnaheimDataTile&&l||t==n.GroupType.AnaheimDataList&&p||t==n.GroupType.SearchSuggestions&&w||t==n.GroupType.AnaheimDataTopHit&&n.config.topHitMuse)&&(e="AnaheimDataGroupPopup",c="anaheimDataPopover",o=dr(f)),e){var s=t+"informationBubble",v=c||t+"groupTitlePopover",y=function(){return i.showPopover(n.Host.getLocString(e),o,_ge(s),!0,!0,v,a)},b=function(t,r){if(r==1){y();return}i.showPopover(n.Host.getLocString(e),o,_ge(s),!0,!1,v,a)};h={subItem:{id:s,selected:!1,selectedStyleSuspended:!1,narratorText:"",tooltip:"",text:"",onSelected:y},onMouseEnter:b}}return h}var it=4,rt=6,a=8,r=12,ut=1,u=20,v=n.config.useCobaltCSS?20:16,ei=n.config.useCobaltCSS?20:16,oi=n.config.useCobaltCSS?42:u+2*a,ft=n.config.useCobaltCSS?40:ei+2*a,si=n.config.useCobaltCSS?40:ft,et=n.config.useCobaltCSS?70:60,hi=n.config.useCobaltCSS?50:u+2*r,ci=n.config.useCobaltCSS?70:u+v+it+2*r,li=n.config.useCobaltCSS?88:u+2*(v+it)+2*r,ai=80+2*r,vi=n.config.useCobaltCSS?18:a,ot=u,yi=n.config.useCobaltCSS?58:48,pi=48,y=1,st=n.IconSize_GridLayout+2*(rt+ut),ht=n.IconSize_GridLayout_Medium+2*(rt+ut),wi=n.config.useCobaltCSS?44:32,bi=8,ki=n.config.useCobaltCSS?139:140,di=156,p=8,gi=n.config.useCobaltCSS?572:600,nr=510,tr=400,ir=350,o=184,w=692,rr=628,ur=565,fr=501,ct=200,lt=3,at=4,er=n.config.useCobaltCSS?33:39,or=n.config.useCobaltCSS?33:42,b={},k="runas",d="tabletmode_opennewwindow",vt="tile.uninstall",yt="startpin",g="taskbarpin",pt="startunpin",nt="taskbarunpin",wt="MRUNoItemsAvailable",s="launchIndexingOptions",sr="s_copyfullpath",h=[{id:"FlyoutNextButton",selected:!1,text:null},{id:"FlyoutButton",selected:!1,text:null},{id:"FlyoutHyperLinkButton",selected:!1,text:null},{id:"FlyoutDismissFooterButton",selected:!1,text:null},{id:"flyoutDismissIcon",selected:!1,text:null}],c={id:"SearchBox",selected:!1,text:"SearchBox"},t={},bt,fi;t[k]={content:"",type:1};t.runasuser={content:"",type:1};t.openinbrowser={content:"",type:1};t.openfilelocation={content:"",type:2};t.opencontaining={content:"",type:2};t[d]={content:"",type:2};t[pt]={content:"",type:1};t[nt]={content:"",type:1};t[yt]={content:"",type:2};t[g]={content:"",type:2};t.settings={content:"",type:2};t.manage={content:"",type:1};t.review={content:"",type:2};t.share={content:"",type:1};t.connectnetworkdrive={content:"",type:1};t.disconnectnetworkdrive={content:"",type:1};t.uninstall={content:"",type:2};t[vt]={content:"",type:2};t.itemproperties={content:"",type:2};bt=function(){var t={};return t[n.GroupType.PathCompletion]="GPT",t[n.GroupType.Store]="GT",t[n.GroupType.SearchSuggestions]="GW",t[n.GroupType.WelcomeExperience]="WWE",t[n.GroupType.MRUHistory]="MRUH",t[n.GroupType.QuickSearch]="QSCH",t[n.GroupType.CuratedSuggestions]="DFLS",t[n.GroupType.CuratedSettings]="CUSE",t[n.GroupType.MSNNews]="MSNN",t[n.GroupType.VisualSearch]="SNSC",t}();n.extendVerbs=lr;n.getVerbsAsync=kt;n.wrapsToTwoLines=e;n.joinVerbs=tt;n.getGroupTitleAndNarratorText=ri;n.getGroupPopover=ui;fi=function(){function t(t,i,r,u,f,e,o,s,h){var c=this;this._autoComplete=t;this._navigationHelper=i;this._page=r;this._previewPane=u;this._menuFactory=f;this._upsellViewModel=e;this._lightweightStorage=o;this._popoverFactory=s;this._headerFooterViewModel=h;this._pendingSubmitSequenceNumber=-1;this._pendingSubmitModifierKeys=null;this._pendingSubmitTimeStamp=null;this._itemLaunchEventHandlers=[];this.groups=[];this.topResults=[];this._lastUpdatedSequenceNumber=-1;this._topResultsRenderingDisabled=!1;this._groupRenderingDisabled=!1;this._resultsCounter={topResults:[],groups:[]};this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];n.Host.bindShown(function(){c._selectedItem=null});r.setSuggestionClickHandler(this.doubleClickGuardedHandler(function(t,i){n.safeExecute(function(){return c.click(n.getCurrentTime(),t,n.getInputType(i),null)},"suggestionClickHandler")}));r.setContextMenuHandler(function(t,i){n.safeExecute(function(){return c._menuFactory.showContextMenuOnXY(t,i.pageX,i.pageY,function(){return n.Host.setFocusInSearchBox(null,"contextMenuDismiss")},n.getInputType(i))},"contextMenuHandler")});r.setOpenPreviewPaneClickHandler(function(t,i){n.safeExecute(function(){return c.openPreviewPane(t,i)},"openPreviewPaneClickHandler")});r.setExpanderClickInstrumentation(function(t,i,r){var u="Expander"+(r?"Opened":"Closed"),f={st:i,K:t.instItem.getLayoutKValue()};n.InstrumentationHelper.logClientInstEvent("Select",u,null,f)});this._previewPane&&(this._previewPane.init(this),this._previewPane.bindBeforeItemLaunch(function(t,i,r,u,f,e){return n.InstrumentationHelper.instrumentItemClickForPreviewPane(t,i.instItem,i.sequenceNumber,i.instrumentPingBack,r,null,u,f,e)}),this._previewPane.bindAfterItemLaunch(function(n,t,i){return c.onSuggestionLaunch(n,t,i)}));n.Host.bindShown(function(){n.config.setIndexerDefaultValue&&(n.config.searchServiceDisabled=!0);SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync&&n.Async.safeChain("getSearchServiceStatusAsync",function(){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync()},function(t){n.InstrumentationHelper.setSearchServiceStatus(yr(t));switch(t){case 1:case 2:case 5:case 6:case 7:n.config.searchServiceDisabled=!0;c.showIndexingMessage(!1);break;case 0:case 4:if(n.config.queryIndexerOnRunningOnly){n.config.searchServiceDisabled=!0;c.showIndexingMessage(!0);break}n.config.searchServiceDisabled=!1;break;case 3:n.config.searchServiceDisabled=!1}})});r.bindOnNarratorLaunch(function(t){for(var i,f=n.getCurrentTime(),e=c.getSelectableItems(),r=0,u=e;r0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),t?(this._partialQuery.showProgressBar||this._partialQuery.queryToFetch=="")&&(this._progressTimer=n.safeSetTimeout(function(){i._progressTimer&&(i._page.setProgressIndicatorVisibility(!0),i._progressTimer=null)},250,"showProgress")):n.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),this._page.setProgressIndicatorVisibility(!1)))},t.prototype.resetPendingSubmitSequenceNumber=function(){this._pendingSubmitSequenceNumber=null;this._pendingSubmitModifierKeys=null;this._pendingSubmitTimeStamp=null},t.prototype.onAfterKeyDown=function(t,i,r,u){var a,e,f,p,o,c,l,w,b,v,y;if(!this._partialQuery||!this._menuFactory.isMenuVisible()&&(!this._popoverFactory||!this._popoverFactory.isPopoverVisible())&&t==13)return!1;if(e=i&&i.shiftKey,n.DialogBox&&n.DialogBox.isVisible())return t!=9||u||this.handleCrossViewModelsTabKeyNavigation(null,e),!0;if(f=this._previewPane&&this._previewPane.hasFocus(),p="rvm onAfterKeyDown",this._page.hideTemporaryMessage(),this.resetPendingSubmitSequenceNumber(),!r&&n.isContextMenuKey(t,e)&&!f)return this.tryShowContextMenuOnSelectedSuggestion(),!0;if(this._menuFactory.isMenuVisible()){if(t==37||t==39||t==13||n.isUpOrDownKey(t)){if(o=this._menuFactory.onAfterKeyDown(t,i,r,u),o)return!0;if(n.isUpOrDownKey(t))return!1}else if(t==9)return this._menuFactory.dismiss(!0),!0;this._menuFactory.dismiss(!0)}if(this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if(t==37||t==39||t==13||n.isUpOrDownKey(t)){if(o=this._popoverFactory.onAfterKeyDown(t,i,r,u),o)return!0;if(t==37||t==39)return!1}this._popoverFactory.dismiss(!1)}if(n.RuntimeConfig.QfMode==5&&t==46)return(c=this._selectedItem,c&&c.removeIcon)?(c.removeIcon.click(n.getCurrentTime(),1),!0):!1;if(l=n.getCurrentActiveElement(),!this.isScopeTile(l)||f||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()||t!=39&&t!=37)if(t==9)if(n.config.allowTabToSelectSuggestions||e||!this._selectedItem||f||this.isScopeElement(this._selectedItem))if(u){if(n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane&&this._selectedItem&&!this.isScopeElement(this._selectedItem)){this._previewPane.onAfterKeyDownWhenNewSelection(t,this._partialQuery,this._selectedItem);if(f)return!0}}else this.handleCrossViewModelsTabKeyNavigation(l,e);else this.select(this._headerFooterViewModel.getSelectableItems()[0],!1);else if(typeof n.msbDsbHost!="object"||!n.msbDsbHost.isEnabled()||this.isScopeElement(this._selectedItem)||((a=this._selectedItem)===null||a===void 0?void 0:a.hasPreviewPaneOpened)||t!==39){if(n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane&&this._selectedItem&&!this.isScopeElement(this._selectedItem)){this._previewPane.onAfterKeyDownWhenNewSelection(t,this._partialQuery,this._selectedItem);if(f)return!0}}else return this.select(n.msbDsbHost.getSelectableItems()[0],!1),!0;else w=n.getRtlAdjustedKey(t),this._headerFooterViewModel.focusNextScopeTile(l,w==39),b=this._headerFooterViewModel.getSelectableItems(),this.select(b[0],!1);return f=this._previewPane&&this._previewPane.hasFocus(),this._selectedItem&&(n.isUpOrDownKey(t)||t==9)&&!f&&(v=this.isScopeElement(this._selectedItem),v||this._selectedItem==this.topResults[0]?this._page.scrollToTop():this._page.scrollTo(this._selectedItem),y=p+"-AdjustFocus",v||this.isAdvancedOption(this._selectedItem)||this.isFlyout(this._selectedItem)?(this.isAdvancedOption(this._selectedItem)&&this._selectedItem.id!==s?_ge(this._selectedItem.id).querySelector("input").focus():_ge(this._selectedItem.id).focus(),n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView(y)):this.isDSBItem(this._selectedItem)?_ge(this._selectedItem.id).focus():t!=9&&n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(t,y)),this.isFlyoutVisible()&&h.indexOf(this._selectedItem)>=0&&(t==39?this.selectNextFlyoutItem(1):t==37&&this.selectNextFlyoutItem(-1)),!1},t.prototype.isFlyoutVisible=function(){return n.config.enableEducationalFlyout&&!_ge("flyoutContainer").classList.contains("b_hide")},t.prototype.selectNextFlyoutItem=function(n){if(this.isFlyoutVisible()){var t=h.filter(function(n){return _ge(n.id)}),r=t.indexOf(this._selectedItem),i=(r+n)%t.length;this._selectedItem=t[i>=0?i:t.length-1];_ge(this._selectedItem.id).focus()}},t.prototype.handleCrossViewModelsTabKeyNavigation=function(t,i){var v=n.RuntimeConfig.PreviewPaneAvailable&&!!this._previewPane,h=v&&this._previewPane.isOpened(),y=h&&this._previewPane.hasFocus(),o,c,l,e,s,u,a,r,f;if(n.DialogBox&&n.DialogBox.isVisible())o=n.DialogBox.getSelectableItemsByGroup(),i?this.select(o[o.length-1][0],!1):this.select(o[0][0],!1);else if(y)if(i)this._previewPane.blur(),f=null,this._headerFooterViewModel&&(c=this._headerFooterViewModel.getSelectableItemsByGroup(),f=c[c.length-1][0]),this.select(f,!1);else{this._previewPane.blur();u=this.getSelectableItems();this.select(u[0],!0);this._previewPane.onAfterKeyDownWhenNewSelection(9,this._partialQuery,u[0])}else this.isScopeTile(t)?(l=!1,n.dsbManager&&i&&(r=n.dsbManager.getSelectableItemsByGroup(),r.length>0&&(s=r[r.length-1][0],this.select(s,!1),l=!0)),l||(!h||i?(e=this.getSelectableSuggestionsByGroup(),e.length>0?(s=i?e[e.length-1][0]:e[0][0],this.select(s,!0)):(u=this.getSelectableItems(),u.length>0?this.select(u[0],!0):this.select(null,!0)),a="handleCrossBordersNavigationWithTab",n.safeSetTimeout(function(){return n.Host.setFocusInSearchBox(9,a)},0,a)):(this.select(this._previewPane.getPreviewedSuggestion(),!0),this._previewPane.focus(!0)))):this._selectedItem?i?h?this._previewPane.focus():(r=this.getSelectableItemsByGroup(),f=r[r.length-1][0],this.select(f,!1)):this.select(this.getSelectableItemsByGroup()[0][0],!1):this.select(this.getSelectableItemsByGroup()[0][0],!1)},t.prototype.tryShowContextMenuOnSelectedSuggestion=function(t){var r=this,i=this._selectedItem&&this.isSuggestion(this._selectedItem)?this._selectedItem:null;i&&n.safeExecute(function(){return r._menuFactory.showContextMenuOnElement(i,_ge(i.id),function(){return n.Host.setFocusInSearchBox(null,"contextMenuDismiss")},t)},"contextMenuHandler")},t.prototype.onQueryChanged=function(t,i){var s=this,h,u,f,e,c,l,o,a,r;if(n.DialogBox&&n.DialogBox.hide(),this._menuFactory.dismiss(),!this._partialQuery||!this._partialQuery.equals(t)){if(this._page.hideTemporaryMessage(),n.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),t.showProgressBar?this._progressTimer=n.safeSetTimeout(function(){s._progressTimer&&(s._page.setProgressIndicatorVisibility(!0),s._progressTimer=null)},250,"showProgress"):this._page.setProgressIndicatorVisibility(!1)),this._partialQuery&&this._partialQuery.scope!=t.scope&&(this._turnOnIndexingInstItem||this.hideIndexingMessage()),h=this._partialQuery?this._partialQuery.queryToFetch:"",u=t.queryToFetch,this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable)this._previewPane.onQueryChanged(t);for(this._partialQuery=t,f=!1,e=0,c=this.topResults;eh.length&&u.startsWith(h)&&r.query.toLowerCase().includes(t.queryToFetch.toLowerCase())&&(l=r.text.indexOf(HitHighlightingParser.endMarker),l>=0&&l0||this.groups.length>0&&this.groups.some(function(n){return n.suggestions.length>0})},t.prototype.getSuggestions=function(n){var t=this.getCurrentTopResults();return this.groups.forEach(function(n){return t=t.concat(n.suggestions)}),n&&(this._pendingSuggestionsInExistingGroups.forEach(function(n){return t=t.concat(n.suggestions)}),this._pendingSuggestionsInMissingGroups.forEach(function(n){return t=t.concat(n.suggestions)})),t},t.prototype.getSelectableItems=function(){var t,r,u,i,f;if(n.DialogBox&&n.DialogBox.isVisible())return n.DialogBox.getSelectableItems();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItems();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItems();if(typeof n.msbDsbHost=="object"&&n.msbDsbHost.hasFocus())return[];for(t=[],this._launchIndexingDataModel&&t.push(this._launchIndexingDataModel.action),t.push.apply(t,this.topResults),r=0,u=this.groups;r0})}return[]},t.prototype.getSelectableItemsByGroup=function(){if(n.DialogBox&&n.DialogBox.isVisible())return n.DialogBox.getSelectableItemsByGroup();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItemsByGroup();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItemsByGroup();var t=[];return this.isFlyoutVisible()&&t.push([h.find(function(n){return!!_ge(n.id)})]),this._headerFooterViewModel&&t.push.apply(t,this._headerFooterViewModel.getSelectableItemsByGroup()),this._launchIndexingDataModel&&t.push([this._launchIndexingDataModel.action]),this.areSuggestionsPresent()?(t.push.apply(t,this.getSelectableSuggestionsByGroup()),n.dsbManager&&t.push.apply(t,n.dsbManager.getSelectableItemsByGroup())):(n.dsbManager&&t.push.apply(t,n.dsbManager.getSelectableItemsByGroup()),t.push([c])),t},t.prototype.getSelectedItem=function(){return n.DialogBox&&n.DialogBox.isVisible()?n.DialogBox.getSelectedItem():this._menuFactory.isMenuVisible()?this._menuFactory.getSelectedItem():this._previewPane&&this._previewPane.hasFocus()?this._previewPane.getSelectedItem():this._selectedItem?this._selectedItem:c},t.prototype.updateSelectionState=function(t){n.contains(this.topResults,t)?this.renderTopResults():this.groups.some(function(i){return n.contains(i.suggestions,t)})&&this.renderGroups()},t.prototype.isSubItem=function(n){return n&&typeof n.itemView!="undefined"},t.prototype.getSuggestionById=function(n){for(var i,t=0;t-1&&(i=this.groups[t].suggestions.findIndex(function(t){return t.id===n.id}),i>-1&&(this.groups[t].suggestions[i].selected=!1)))},t.prototype.renderGroups=function(t){if(this._partialQuery){var i=this._partialQuery.queryToFetch?n.config.maxSuggestionsPerGroup:0;i&&i>0&&this.groups.forEach(function(n,t,r){r[t].suggestions=n.suggestions.slice(0,i)})}this._groupRenderingDisabled||(this.adjustMsbGroups(),this._page.updateGroupsView({query:this._contentQuery,topResults:this.topResults,groups:this.groups},t),n.InstrumentationHelper.updateSuggestionsList(this.topResults,this.groups))},t.prototype.adjustMsbGroups=function(){this.suppressDefault();this.msbGroupsMergeDocsIntoQws();this.msbGroupsSetupTopList();this.msbGroupsSetLayout()},t.prototype.suppressDefault=function(){var t;if(typeof n.enableQws=="function"&&n.enableQws()&&((t=this._contentQuery)===null||t===void 0?void 0:t.isSearchHomeZI)){var i=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearchTopList})[0],r=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearch})[0],u=this.groups.filter(function(t){return t.type===n.GroupType.RecommendedDocs})[0];(i||r||u)&&(this.groups=this.groups.filter(function(t){return t.type!==n.GroupType.TopApps&&t.type!==n.GroupType.QuickSearch}))}},t.prototype.getMaxMsbItems=function(){var i,r=this.getMaxNumberOfRecentItems(n.GroupType.CuratedSuggestions),t;return typeof n.qwsShowTopList=="function"&&n.qwsShowTopList()&&(t=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearchTopList})[0],((i=t===null||t===void 0?void 0:t.suggestions)===null||i===void 0?void 0:i.length)>0)?r-2:r},t.prototype.msbGroupsMergeDocsIntoQws=function(){var u,f,r,i,t;if(typeof n.enableQwsRecDocs=="function"&&n.enableQwsRecDocs()&&((u=this._contentQuery)===null||u===void 0?void 0:u.isSearchHomeZI)&&(r=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearch})[0],i=this.groups.filter(function(t){return t.type===n.GroupType.RecommendedDocs})[0],r&&((f=i===null||i===void 0?void 0:i.suggestions)===null||f===void 0?void 0:f.length)>0)){t=r.suggestions;n.isMsbQwsDocsCacheEnabled(this._partialQuery)&&(t=t.filter(function(n){return n.type!=="FL"}));var e=i.suggestions.slice(0,n.config.ziRecommendedDocsResultsCount),o=this.getMaxMsbItems(),s=o-e.length;t=t.slice(0,s);t.push.apply(t,e);r.suggestions=t;this.groups=this.groups.filter(function(t){return t.type!==n.GroupType.RecommendedDocs});this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearch}).map(function(n){return n.instRegionName="QuickWorkSearchWithRecDocs"})}},t.prototype.msbGroupsSetupTopList=function(){var i,t,r,u;typeof n.qwsShowTopList=="function"&&n.qwsShowTopList()&&((i=this._contentQuery)===null||i===void 0?void 0:i.isSearchHomeZI)&&(t=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearchTopList})[0],t&&(r=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearch})[0],r&&(r.hideGroupHeader=!0),u=this.groups.filter(function(t){return t.type===n.GroupType.RecommendedDocs})[0],u&&(u.hideGroupHeader=!0),t.cssClasses=(t.cssClasses||"")+" msbQwsTop"))},t.prototype.msbGroupsSetLayout=function(){var u,f,t,e,i,r;typeof n.qwsShowTopList=="function"&&n.qwsShowTopList()&&((u=this._contentQuery)===null||u===void 0?void 0:u.isSearchHomeZI)&&(t=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearch})[0],t?t.cssClasses=(t.cssClasses||"")+" colRight":(e=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearchTopList})[0],i=this.groups.filter(function(t){return t.type===n.GroupType.RecommendedDocs})[0],e&&((f=e.suggestions)===null||f===void 0?void 0:f.length)>0&&i&&(i.cssClasses=(i.cssClasses||"")+" colRight")),r=this.groups.filter(function(t){return t.type===n.GroupType.QuickWorkSearchTopList})[0],r&&(r.cssClasses=(r.cssClasses||"")+" colRight"))},t.prototype.select=function(t,i){var f,e,r,u;(n.cohortProfileManager===null||n.cohortProfileManager===void 0?void 0:n.cohortProfileManager.isTourVisible())&&((f=t===null||t===void 0?void 0:t.id)===null||f===void 0?void 0:f.toLowerCase().search(/flyout/i))==-1||(n.DialogBox&&n.DialogBox.isVisible()?n.DialogBox.select(t):this._menuFactory.isMenuVisible()&&n.contains(this._menuFactory.getSelectableItems(),t)?this._menuFactory.select(t,!1):this._previewPane&&n.contains(this._previewPane.getSelectableItems(),t)?this._previewPane.select(t,!1):(r=this._selectedItem,r&&(r.selected=!1,this.setSelectedStyleSuspended(r,!1)),t==c?(this._selectedItem=null,n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(null,"rvm_select")):(this._selectedItem=t,t&&(this.isDSBItem(t)&&n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView("rvm_dsb_select"),t.selected=!0,(e=t.onSelected)===null||e===void 0?void 0:e.call(t),this.setSelectedStyleSuspended(t,!n.Host.searchBoxHasFocus()))),i&&t&&(t.arrowOrTabAction=!0),this.renderSelection(this._selectedItem,r),this.isScopeElement(t)&&this._headerFooterViewModel.select(t,!1),i&&(u=t?t.query:null,u&&this._partialQuery.scopePrefix&&(u=this._partialQuery.scopePrefix.trim()+": "+u),n.Host.updateQueryWithoutRefetching(u))))},t.prototype.resetIconTimers=function(n,t){var o=typeof n=="undefined"||!n,s=typeof n=="undefined"||n,i,f,u,e,r;if(o){if(t)for(i=0,f=this._renderGroupsIconsCBs;i=0},t.prototype.isBodyOrSuggestion=function(n){return n&&(n.tagName.toLowerCase()=="body"||n.tagName.toLowerCase()=="iframe"||n.className&&n.classList.contains("suggestion"))},t.prototype.submit=function(t,i,r,u,f){var c,o=f?5:i?6:1,a=n.getCurrentActiveElement(),e,h,l,v;if(n.DialogBox&&n.DialogBox.isVisible()){n.DialogBox.submit();return}if(this._previewPane&&this._previewPane.hasFocus()){if(e=this._previewPane.getSelectedItem(),e&&e.click&&e.optionType===undefined){e.click(t,o);return}}else if(!this._selectedItem||!this.isScopeElement(this._selectedItem)||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if((n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&!this._selectedItem){n.Host.submitFileExplorerTextSuggestion(this._partialQuery.queryToFetch);return}}else{_ge(this._selectedItem.id).click();return}if(h=this._menuFactory.getSelectedItem(),h){h.click&&h.click(t,o,u);return}if(l=this._popoverFactory?this._popoverFactory.getSelectedItem():null,l){this._popoverFactory.submit(l);return}if(((c=this._selectedItem)===null||c===void 0?void 0:c.id)===s){this.click(t,this._selectedItem,o,u);return}if(v=!this.isBodyOrSuggestion(a),v){n.Host.isRequestFocusAvailable()||a.click();return}if(this._lastUpdatedSequenceNumber!=r&&(!this._selectedItem||this._selectedItem==this.topResults[0])){this._pendingSubmitSequenceNumber=r;this._pendingSubmitModifierKeys=u;this._pendingSubmitTimeStamp=t;return}this._selectedItem?this.click(t,this._selectedItem,o,u):this.groups.length>0&&this._partialQuery.fullPartialQuery&&this.showDisableEnterMessage()},t.prototype.doubleClickGuardedHandler=function(t){var i;return function(r,u){i&&n.getCurrentTime()-i<=250||(i=n.getCurrentTime(),t(r,u))}},t.prototype.click=function(t,i,r,u){if(this._page.hideTemporaryMessage(),this.isAdvancedOption(i)){i.click&&i.click(t,r,u);return}var f=n.isGroup(i)||this.isSubItem(i)?null:i;if(!i.instItem||f&&f.isReformulation||n.InstrumentationHelper.instrumentItemClick(t,i.instItem,i.sequenceNumber,f?f.instrumentPingBack:null,r,u),!f){i.click&&i.click(t,r,u);return}u=u||n.Host.getModifierKeyState();u.ctrlKey&&u.shiftKey?this.launchVerb(f,k,t):u.shiftKey?this.launchVerb(f,d,t):f.click(t,r,u);this.onSuggestionLaunch(f,this._partialQuery)},t.prototype.onSuggestionLaunch=function(t,i,r){n.isChildSuggestion(t)&&t.parent&&(t=t.parent);this._itemLaunchEventHandlers.forEach(function(n){return n(t,i,r)})},t.prototype.launchVerb=function(t,i,r){var u=kt("launchVerb",t,n.config.rawVerbs,!1,function(u){for(var s,h,e=!1,c=function(t){if(t.verb&&t.verb.toLocaleLowerCase()==i.toLocaleLowerCase())return t.executeSync?n.safeExecute(function(){return t.executeSync()},"verb.executeSync",null,i):n.Async.safeChain("verb.executeAsync",function(){return t.executeAsync()},function(){return n.Host.manuallyDismissApp()},null,null,i),e=!0,"break"},f=0,o=u;f=615)return o={content:"",type:2},f=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),u=function(){return s.dismissTour(t)},[u,null,f,e,o];break;case n.GroupType.AnaheimDataTile:if(n.canShowAnaheimDataSHTile(this._lightweightStorage))return o={content:"",type:2,className:"anaheimDataTileDismissGroup"},f=n.Host.getLocString("DismissAnaheimData"),e=n.Host.getLocString("DismissAnaheimData"),u=function(){s._lightweightStorage.setItem("AnaheimDataTileDismissed","1");n.Host.refreshCurrentPane()},[u,null,f,e,o];break;case n.GroupType.AnaheimDataList:if(n.canShowAnaheimDataSHList(this._lightweightStorage))return o={content:"",type:2,className:"anaheimDataListDismissGroup"},f=n.Host.getLocString("DismissAnaheimData"),e=n.Host.getLocString("DismissAnaheimData"),u=function(){s._lightweightStorage.setItem("AnaheimDataListDismissed","1");n.Host.refreshCurrentPane()},[u,null,f,e,o];break;case n.GroupType.PromoBanner:return o={content:"",type:2},f=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),u=this._upsellViewModel.getDismissButtonAction(),[u,null,f,e,o]}if(u){if(!r)throw"No QS code for: "+n.GroupType[i.type];return l=n.InstrumentedItem.getNonSuggestionInstrumentedItem(r,n.SyntheticQSCodesMaps.KValues),[u,l,f,e,o]}return[null,null,null,null,null]},t.prototype.shouldShowPlusIconInGroupHeader=function(t,i){if(n.getScope(t)==n.Scope.Web||t==n.GroupType.Store)return!1;if(t==n.GroupType.Apps&&this._partialQuery.queryToFetch.lengtho)return h.groups.splice(r,0,t),u=!0,"break"},h=this,r=0;r0||t.length>0)&&this.showDisableEnterMessage();else{var i=this.topResults[0];return n.InstrumentationHelper.instrumentItemClick(this._pendingSubmitTimeStamp,i.instItem,i.sequenceNumber,i.instrumentPingBack,1,this._pendingSubmitModifierKeys),this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.ctrlKey&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(i,k,this._pendingSubmitTimeStamp):this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(i,d,this._pendingSubmitTimeStamp):i.click(this._pendingSubmitTimeStamp,0,this._pendingSubmitModifierKeys),0}}finally{this.resetPendingSubmitSequenceNumber()}return 1},t.prototype.showDisableEnterMessage=function(){this._page.showTemporaryMessage(n.Host.getLocString("EnterOnAmbiguousTopHitMessageText"))},t.prototype.showIndexingMessage=function(t){var i=this,r;t?(this._turnOnIndexingInstItem=null,this._launchIndexingDataModel=null):(this._turnOnIndexingInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMIO",n.SyntheticQSCodesMaps.KValues),r={id:s,selected:null,text:n.Host.getLocString("WindowsIndexingDisabledAction"),title:null,instItem:this._turnOnIndexingInstItem,click:function(t,r){var u=n.SequenceNumberManager.getSequenceNumber();u>i._lastUpdatedSequenceNumber&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(u,"IMIO",i._turnOnIndexingInstItem);n.InstrumentationHelper.instrumentItemClick(t,i._turnOnIndexingInstItem,u,null,r,null);n.LocalDataProvider.launchIndexingOptions(!1)},layout:1,isSelectable:!0});this._launchIndexingDataModel={messageText:t?n.Host.getLocString("WindowsIndexingInProgressMessage"):n.Host.getLocString("WindowsIndexingDisabledMessage"),icon:t?{content:"",type:2}:null,messageClassName:"indexingMessage",title:t?n.Host.getLocString("WindowsIndexingInProgressToolTip"):n.Host.getLocString("WindowsIndexingDisabledToolTip"),action:r};this._page.updateTemporaryMessageView(this._launchIndexingDataModel)},t.prototype.hideIndexingMessage=function(){this._turnOnIndexingInstItem=null;this._page.updateTemporaryMessageView(null)},t.prototype.getAvailableSpace=function(t){var r=this,i;return n.isL2(this._partialQuery)&&this._partialQuery.queryToFetch?Number.MAX_VALUE:(i=this._page.getSuggestionsContainerHeight(),n.config.extraTopPadding&&!n.RuntimeConfig.SearchBoxOnTop&&(i-=n.config.extraTopPadding),n.RuntimeConfig.ScopesAvailable&&(i-=yi),t.topResults.length==0||n.RuntimeConfig.FlatListWithoutGroups||(i-=si),t.topResults.forEach(function(t){return i-=gt(t,n.isL2(r._partialQuery))}),t.groups.forEach(function(n){return i-=vr(r._partialQuery,n)}),t.groups.some(function(t){return t.typeWithSource&&n.isTopHitChildGroup(t.typeWithSource)})&&t.groups.some(function(t){return t.typeWithSource&&!n.isTopHitChildGroup(t.typeWithSource)})&&(i-=vi),i)},t.prototype.getAvailableSpaceForZeroInputHomeTopSection=function(t,i){var r=this._page.getSuggestionsContainerWidth(),u,f;return n.shouldShowStaticSearchHome(this._partialQuery)||n.shouldShowDSBLayout(this._partialQuery)?r:(r-=n.RuntimeConfig.AlwaysWide?wi:bi,r-=p,u=t?t.suggestions.filter(function(n){return n&&!n.suppressed}).length:0,u+=i.suppressed?0:1,f=n.RuntimeConfig.AlwaysWide?ki:di,r-=(f+p)*u,n.config.useCobaltCSS&&(r+=2*p),r)},t.prototype.canFitSuggestion=function(t,r,u){if(r.type==n.GroupType.SearchSuggestions&&(n.config.enableFullFitSearchTheWebMaxSuggestionsStandAlone||u.suppressed&&n.config.enableSearchTheWebMaxSuggestions&&n.config.enableFullFitSearchTheWebMaxSuggestions)&&this.getAvailableSpace(this._resultsCounter)>=0)return u.suppressed&&(u.suppressed=!1),!0;if(u.suppressed||n.getTweakedSetting("scrollBarInL1")||u.handoffType===21&&n.config.msbVerticalChildSuggestionsNoTrim)return!0;var o=dt(this._resultsCounter),f;return t?(f={typeWithSource:r,suggestions:[]},o.groups.push(f)):f=i(o.groups,r),f.suggestions.push({mainTextWrapsToTwoLines:u&&e(u,r.type,!1),isSuppressed:u&&u.suppressed,hasTwoLines:u&&n.contains(u.classNames,"forceNoWrapOutsideTopResult")}),this._partialQuery.isSearchHomeZI?this.canFitSuggestionInZeroInputHome(r,u):this.getAvailableSpace(o)>=0},t.prototype.canFitSuggestionInZeroInputHome=function(t,r){var u,e,f;return r.type==="SNSC"?!0:typeof n.enableQws=="function"&&n.enableQws()&&(t.type===n.GroupType.QuickWorkSearch||t.type===n.GroupType.RecommendedDocs)?!0:(u=i(this.groups,t),t.type==n.GroupType.MRUHistory)?!0:ii(t.type)?this.getAvailableSpaceForZeroInputHomeTopSection(u,r)>=0:!(n.shouldShowStaticSearchHome(this._partialQuery)||n.shouldShowDSBLayout(this._partialQuery))&&this.isGroupTypeInRightCol(t.type)?(e=n.config.maxSuggestionsInRightCol,f=0,n.config.useCobaltCSS||(f=this.getCountOfSuggestionsToReduce()),(u?u.suggestions.length:0)>=e-f)?!1:!0:(u?u.suggestions.length:0)w&&r&&(u0){for(t={suggestions:[]},f=0;f0&&(r.cssClasses+=n.isL2(this._partialQuery)?" gridLayout":" gridLayout gridLayoutMedium")},t.prototype.onGroupsCleared=function(){this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this._resultsCounter.groups=[];this._turnOnIndexingInstItem&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(this._lastUpdatedSequenceNumber,"IMIO",this._turnOnIndexingInstItem)},t.prototype.dismissTour=function(t){var i={query:t.queryToFetch};this._lightweightStorage.setItem("wweTourTook","1");this._lightweightStorage.setItem("wweTourRefreshed","1");this._lightweightStorage.removeItem("wweTourEnabled");_ge("root").classList.remove("overlayEnabled");n.setZeroInputDataSourcesForL1();n.Host.refreshCurrentPane();this._lightweightStorage.removeItem("wweTourRefreshed");n.InstrumentationHelper.logClientInstEvent("Select","WWETourDismiss",null,i)},t.prototype.launchSearch=function(t,i){var r=t.queryToFetch;n.Host.launchSearch(r,this._navigationHelper.getSearchUrl(t.fullPartialQuery,r,i),!1)},t.prototype.setRemoveIcon=function(t){var r=this,u=t.getExtraVerbs&&t.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromDeviceHistory"}),e=t.type=="HS"&&n.config.removeSuggUrl,o=n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.forceRemoveIcon,f=t.getExtraVerbs&&t.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromDeviceHistoryAll"}),i;(o||u||e||f)&&(i=f?"RemoveFromDeviceHistoryAll":u?"RemoveFromDeviceHistory":"RemoveFromWebHistory",t.removeIcon={icon:{content:"",type:2},title:n.Host.getLocString(i),click:function(u,f){r._page.hideTemporaryMessage();n.InstrumentationHelper.instrumentItemClickForContextMenu(u,t.instItem,t.sequenceNumber,t.instrumentPingBack,f,null,i);r.launchVerb(t,i,u);n.Host.setFocusInSearchBox(null,"remove")}})},t.prototype.updateNarratorWithPreviewMessage=function(t){var r=n.RuntimeConfig.AlwaysWide?"PreviewPaneButtonNarratorMessageWidePane":"PreviewPaneButtonNarratorMessage",i=n.Host.getLocString(r);t.narratorText&&t.previewPaneType&&t.narratorText.indexOf(i)==-1&&(t.narratorText+=", "+i)},t.prototype.handleWorkScopeRequeryTophit=function(n,t){var i=t.findIndex(function(t){return t.msbVerticalHash===n.msbVerticalHash});i>-1&&(t[i].selected=!0,this._selectedItem=n);this._previewPane.onQueryChanged(this._partialQuery,n)},t.prototype.onBeforeRenderTopResults=function(t,i,r,u,f){var s=this,l,c,a,e,o,y,p,v,h,w;return this.topResults.forEach(function(n){s.setRemoveIcon(n);s.updateNarratorWithPreviewMessage(n)}),l=1,this.topResults.length!=1||this.topResults[0].hasChildSuggestionsDisplayed||r.some(function(t){return n.isChildSuggestion(t)})&&(this.topResults[0].hasChildSuggestionsDisplayed=!0,l=0),c=!1,a=this.getSelectableItems(),n.RuntimeConfig.FirstSuggestionSelectedByDefault?(!this._selectedItem||!n.contains(a,this._selectedItem)||this.isScopeElement(this._selectedItem)||this._selectedItem==i[0]&&this.topResults[0]!=i[0]||this._selectedItem!=a[0]||this._selectedItem.previewPaneNeedsRefreshAfterDeduping)&&(e=this._partialQuery.queryToFetch&&this.topResults.length>0?this.topResults[0]:null,o=this._selectedItem&&this.isSuggestion(this._selectedItem)?this._selectedItem:null,n.config.synthWebNoBestMatch&&n.isNullOrUndefined(e)&&(y=[n.GroupType.SearchSuggestions,n.GroupType.Websites],p=r.filter(function(t){return!n.contains(y,n.getGroupType(t))}),p.length==0&&(e=r.length>0?r[0]:null)),this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable&&(this._partialQuery.queryToFetch&&this._partialQuery.scope===n.Scope.Work&&o&&typeof n.isMsbWorkScope=="function"&&n.isMsbWorkScope(o.handoffType)&&this._previewPane.getPreviewedSuggestion()&&o.reactKey!=undefined?(e=o,this.handleWorkScopeRequeryTophit(e,r),c=!0):(c=!1,n.safeExecute(function(){return s._previewPane.onTopHitUpdated(s._partialQuery,o,e,s.getSuggestions(!1))},"ppOnTopHitUpdated"))),this.select(e,!1),this._page.scrollToTop()):t&&this.select(null,!1),v=this.topResults.length>0,h=function(t){return!t.suppressed&&t.staticGroupType!=n.GroupType.VisualSearch},this._headerFooterViewModel&&!c&&(w=v||r.some(h)||this.groups.some(function(n){return n.suggestions.some(h)})||this._pendingSuggestionsInMissingGroups.some(function(n){return n.suggestions.some(h)})||this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.some(h)}),this._headerFooterViewModel.render(this._partialQuery,v,w,u,f)),l},t.prototype.isRankable=function(t){return n.config.enableAnaheimRelevance==2?t.typeWithSource.type!=n.GroupType.Websites&&t.typeWithSource.type!=n.GroupType.LocalPlaces&&!t.suggestions.some(n.enforceOriginalOrder):t.typeWithSource.type!=n.GroupType.SearchSuggestions&&t.typeWithSource.type!=n.GroupType.Websites&&t.typeWithSource.type!=n.GroupType.LocalPlaces&&!t.suggestions.some(n.enforceOriginalOrder)},t.prototype.isNotRankableWithRecourse=function(t){return t.typeWithSource.type==n.GroupType.Emails},t.prototype.openPreviewPane=function(t,i){i.stopPropagation();this._previewPane.showPreview(this._partialQuery,t);this.select(t,!0);n.config.reactGroups&&this.selectGroupItem(t);n.Host.setFocusInSearchBox(null,"openPreviewPane")},t.prototype.mayNeedFlush=function(){return!n.RuntimeConfig.FlatListWithoutGroups},t.prototype.update=function(t,i,r,u,f,o,s,h,c,l){var a=this,g=this.topResults,p,nt,tt,w,rt,v,st,d,lt,et;if(t&&(this._contentQuery=this._partialQuery,this._renderTopResultsTimerForIcons=null,this._renderGroupsTimerForIcons=null),n.config.enableMRUHint)for(p=0,nt=i;p0&&this._selectedItem==this.topResults[0]&&this._autoComplete.apply(this.topResults[0]),this.handlePendingSubmit(f)==0)return this.toggleProgressBar(!0),0;this._partialQuery&&this._partialQuery.isSearchHomeZI&&this.toggleProgressBar(!c);var ut=!1,b=0,vt=this.createIconRenderInfo(),ht=function(){var t,i;ut&&(t=a.groups.map(function(n){return n.typeWithSource.type}),a._contentQuery.queryToFetch||b!=0||(i=a._cvidAtLastRender!=n.Host.getConversationId(),a._cvidAtLastRender=n.Host.getConversationId(),n.InstrumentationHelper.instrumentZiRendered(u,i)),n.InstrumentationHelper.instrumentRenderFinished(u,s,t,b!=0,!a._contentQuery.queryToFetch))},ft=function(n,t){var r=!1,i;if(a.isRankable(t)&&a._partialQuery&&a._partialQuery.queryToFetch)for(i=0;it.suggestions[i].rankingScore){t.suggestions.splice(i,0,n);r=!0;break}r||t.suggestions.push(n);++b;a.setupIcon(u,n,vt,function(){--b;ht()});a.onSuggestionAddedToGroup(n,t)},y=this.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup()-this.groups.length,k=!1,ct=function(){var i,f,t,e;if(y!=0&&r||a.flush(ft,u,h),a.groups.sort(function(t,i){return h.findIndex(function(i){return n.sameGroup(i,t.typeWithSource)})-h.findIndex(function(t){return n.sameGroup(t,i.typeWithSource)})}),a._partialQuery&&a._partialQuery.queryToFetch)for(i=0,f=a.groups;i0||o.length>0?(this.renderGroupsAfter(function(){for(var ut,s,c,k,d,v,nt,p,tt,i,w,rt,e=0,b=o;e0&&a.canFitSuggestion(!1,f,t)?ft(t,r):a._partialQuery.isSearchHomeZI||a.queueSuggestionInExistingGroup(t,r)):y>0&&a.canFitSuggestion(!0,f,t)?(r=a.addGroup(f,t,u,h,l),a.shouldTrackGroupCount(r)&&(r.count=1),ft(t,r),y-=1):a._partialQuery.isSearchHomeZI||a.queueSuggestionInMissingGroup(t,f,l)},c=0,k=g;c0})||this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.length>0}))&&(this.renderGroupsAfter(function(){return ct()}),k=!0,ut=!0),(it||k)&&(d=void 0,it?k||(d=!0):d=!1,this.resetIconTimers(d,!0)),lt=this.groups.findIndex(function(t){return t.type==n.GroupType.MRUHistory}),lt>-1&&(et=this.groups.findIndex(function(t){return t.type==n.GroupType.CuratedSuggestions}),et>-1&&this.groups.splice(et,1)),ht(),c&&this.toggleProgressBar(!1),n.config.mruSearchHome&&this._partialQuery.isSearchHomeZI&&this._partialQuery.scope==n.Scope.All&&this.sortMRUList(),1},t.prototype.sortMRUList=function(){var r=this.groups.filter(function(t){return t.type==n.GroupType.MRUHistory}),u=this.groups.filter(function(t){return t.type!=n.GroupType.MRUHistory}),f=this.getMaxNumberOfRecentItems(n.GroupType.MRUHistory),t,i;r.length>0?(this._lightweightStorage.removeItem(wt),t=r[0],t.suggestions.sort(function(n,t){return t.lastLaunchTime-n.lastLaunchTime}),t.suggestions.length>f&&(t.suggestions=t.suggestions.splice(0,f)),i=-1,this.groups.forEach(function(t,r){i=t.type==n.GroupType.MRUHistory?r:i}),u.splice(i,0,t),this.groups=u,this.renderGroups()):this._lightweightStorage.setItem(wt,"1")},t.prototype.canGoToL2=function(n){return n.click&&!n.instItem},t.prototype.populateGroupHeaderFlags=function(n){if(this.canGoToL2(n)){var t=n.suggestions.every(function(n){return n.suppressed});n.showCountInHeader=t}},t.prototype.shouldTrackGroupCount=function(n){return this.canGoToL2(n)},t.prototype.getGroupData=function(t){var r={type:n.getGroupType(t),source:t.sourceForGroup};return n.enableMRUSearchHome()&&r.type==n.GroupType.MRUHistory&&(r.source=undefined),[r,i(this.groups,r)]},t.prototype.removePendingSuggestionFromExistingGroup=function(n,t){for(var r,u,i=0;i0&&i.length>0){var u=i[0];this.canFitSuggestion(!1,t.typeWithSource,u)&&r(u,t);i.splice(0,1);n-=1}},t.prototype.flush=function(t,i,r){for(var e,s,u,c,l=this,a=function(u){var o=u.suggestions[0],e;o&&f.canFitSuggestion(!0,u.typeWithSource,o)&&(e=f.addGroup(u.typeWithSource,o,i,r,u.extraSignalsMap),f.shouldTrackGroupCount(e)&&(e.count=u.suggestions.length),f.partialFlush(n.config.minSuggestionsPerGroup,e,u.suggestions,t),u.suggestions.forEach(function(n){return l.queueSuggestionInExistingGroup(n,e)}),u.suggestions=[])},f=this,o=0,h=this._pendingSuggestionsInMissingGroups;o0}))for(e=0,s=this._pendingSuggestionsInExistingGroups;e