File: C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Desktop/22.txt
var WSB;(function(n){function bi(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 ki(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.Promise.safeChain("getExtraVerbsAsync",function(){return i.getExtraVerbsAsync(u)},function(n){return h(k(t,n,!0),i,u,f,e)},function(){return h(t,i,u,f,e)},null,r):h(t,i,u,f,e))}function h(n,t,i,r,u){if(u()){var f=t.getExtraVerbs?k(n,t.getExtraVerbs(i),!1):n;f[0]==v&&f.shift();r(f)}}function di(i,r,u,f){return i.map(function(i){var e,o,s,h;if(i.verb){switch(i.verb.toLocaleLowerCase()){case at:e="PinnedToStart";break;case w:e="PinnedToTaskbar";break;case vt:e="UnpinnedFromStart";break;case b:e="UnpinnedFromTaskbar";break;case lt:o="UninstallConfirmation";e="UninstallationInProgress"}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()==w&&n.Host.addItemToPinnedToTaskbar(r.deviceItem.id);i.verb.toLocaleLowerCase()==b&&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},{id:null,text:n.Host.getLocString("Cancel"),selected:!0}]):s(t)})}return i})}function wt(t,i,r,u,e,o){if(n.isJumpListSuggestion(i))return n.Promise.safeChain("jumpListItem.getVerbsAsync",function(){return i.jumpListItem.getVerbsAsync()},function(n){return f(ki(n),i,s,u,e,o)},function(){return f([],i,s,u,e,o)},null,t+" "+i.type),!0;var s=t+" "+i.type,c=n.getItemWithFileMetadata(i);return c&&c.canHaveContextMenu?(n.Promise.safeChain("item.getVerbsAsync",function(){return c.getVerbsAsync()},function(n){return f(bi(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?(h([],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?pi:wi)}function bt(n){for(var i,r={topResults:n.topResults.slice(0),groups:[]},t=0,u=n.groups;t<u.length;t++)i=u[t],r.groups.push({typeWithSource:i.typeWithSource,suggestions:i.suggestions.slice(0)});return r}function kt(t,i){if(t.isHtmlAnswer)return si;if(t.grid)return(i?n.IconSize_GridLayout:n.IconSize_GridLayout_Medium)+2*r;var u=t.numberOfLines==3?oi:t.numberOfLines==2?ei:fi;return t.mainTextWrapsToTwoLines&&(u+=rt),u<it&&(u=it),u}function gi(t,i){if(i&&n.uses3lineTemplate(n.getScope(i.type)))return kt({mainTextWrapsToTwoLines:!1,numberOfLines:3,isHtmlAnswer:!1,isSuppressed:t.isSuppressed,grid:!1},!1);if(t.isSuppressed)return 0;var r=ri;return t.hasTwoLines?r+=l+2:t.mainTextWrapsToTwoLines&&(r+=rt),r}function nr(t,i){var r=tt;if(i.typeWithSource&&n.displayedInGridLayout(i.typeWithSource.type)){var u=n.isL2(t),f=Math.ceil(i.suggestions.length/(u?ht:ct)),e=u?ut:ft;r+=e*f;r+=2*a}else i.suggestions.forEach(function(n){return r+=gi(n,i.typeWithSource)});return n.config.enableEdgeUpsellBottom&&i&&i.typeWithSource&&i.typeWithSource.type==n.GroupType.Upsell&&(r=li),r}function tr(n){switch(n){case 0:return"CP";case 7:return"DI";case 1:return"PP";case 2:return"PD";case 4:return"SP";case 5:return"TP";case 6:return"SD"}return undefined}function k(n,t,i){if(n.length>0&&t.length>0){var r=i?n.concat(v):n;return r.concat(t)}return n.length>0?n:t.length>0?i?[v].concat(t):t:[]}function i(t,i){return t.find(function(t){return n.sameGroup(t.typeWithSource,i)})}function dt(t,i){return t.find(function(t){return n.sameGroup(t.group.typeWithSource,i)})}function gt(n,t){return n.queryToFetch.substring(0,t.queryToFetch.lastIndexOf("\\"))}function ni(t){switch(t){case n.GroupType.TopApps:case n.GroupType.MSNWeather:case n.GroupType.People:return!0}return!1}function ir(t,i){if(!t.isSearchHomeZI||t.scope==n.Scope.All)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 ni(i)?n.Host.getLocString("FrequentSection"):n.Host.getLocString("RecentSection")}function rr(t){return n.Host.getLocString(t?"SearchWorkAndWeb":"SearchTheWeb")}function ur(){return n.Host.getLocString("Websites")}function ti(t,i,r,u){var o,e,f,s,h;if(i==n.GroupType.PathCompletion)return o=gt(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=ir(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=rr(n.msbEnabledForQuery(t));break;case n.GroupType.Websites:f=ur();break;case n.GroupType.Contact:f=n.Host.getLocString("ContactGroup");break;case n.GroupType.LocalSearchHistory:f="Search history";break;case n.GroupType.TopApps:f=n.Host.getLocString("TopAppsSection");break;case n.GroupType.QuickSearch:f=n.Host.getLocString("QuickSearchSuggestionsSection");break;case n.GroupType.VisualSearch:f="Visual search";break;case n.GroupType.MSNNews:f=n.Host.getLocString(n.config.msnNewsTitleResource);break;case n.GroupType.LockscreenQuickSearch:f=n.Host.getLocString("LockscreenQuickSearchSection");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.BingDailyImage:f=n.Host.getLocString("BingImageOfDay");break;case n.GroupType.MSNWeather:f=n.Host.getLocString("Weather");break;case n.GroupType.MeetingPrep:f=n.Host.getLocString("MeetingPrepGroup")}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}}var d=4,g=6,c=8,r=12,nt=1,u=20,l=16,ri=u+2*c,tt=16+2*c,ui=tt,it=60,fi=u+2*r,ei=u+l+d+2*r,oi=u+2*(l+d)+2*r,si=80+2*r,hi=c,rt=u,ci=48,li=140,a=1,ut=n.IconSize_GridLayout+2*(g+nt),ft=n.IconSize_GridLayout_Medium+2*(g+nt),ai=32,vi=8,et=140,yi=156,ot=8,st=200,ht=3,ct=4,pi=39,wi=42,v={},y="runas",p="tabletmode_opennewwindow",lt="tile.uninstall",at="startpin",w="taskbarpin",vt="startunpin",b="taskbarunpin",yt="MRUNoItemsAvailable",o=[{id:"FlyoutNextButton",selected:!1,text:null},{id:"FlyoutButton",selected:!1,text:null},{id:"FlyoutDismissFooterButton",selected:!1,text:null},{id:"flyoutDismissIcon",selected:!1,text:null}],s={id:"SearchBox",selected:!1,text:"SearchBox"},t={},pt,ii;t[y]={content:"",type:1};t.runasuser={content:"",type:1};t.openinbrowser={content:"",type:1};t.openfilelocation={content:"",type:2};t.opencontaining={content:"",type:2};t[p]={content:"",type:2};t[vt]={content:"",type:1};t[b]={content:"",type:1};t[at]={content:"",type:2};t[w]={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[lt]={content:"",type:2};t.itemproperties={content:"",type:2};pt=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.MSNNews]="MSNN",t[n.GroupType.VisualSearch]="SNSC",t}();n.extendVerbs=di;n.getVerbsAsync=wt;n.wrapsToTwoLines=e;n.joinVerbs=k;n.getGroupTitleAndNarratorText=ti;ii=function(){function t(t,i,r,u,f,e,o,s,h,c){var l=this;this._autoComplete=t;this._instrumentationHelper=i;this._navigationHelper=r;this._page=u;this._previewPane=f;this._menuFactory=e;this._upsellViewModel=o;this._lightweightStorage=s;this._popoverFactory=h;this._headerFooterViewModel=c;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(){l._selectedItem=null});u.setSuggestionClickHandler(this.doubleClickGuardedHandler(function(t,i){l.clickedWeatherUnitConverter(i)||n.safeExecute(function(){return l.click(n.getCurrentTime(),t,n.getInputType(i),null)},"suggestionClickHandler")}));u.setContextMenuHandler(function(t,i){n.safeExecute(function(){return l._menuFactory.showContextMenuOnXY(t,i.pageX,i.pageY,function(){return n.Host.setFocusInSearchBox(null,"contextMenuDismiss")})},"contextMenuHandler")});u.setOpenPreviewPaneClickHandler(function(t,i){n.safeExecute(function(){return l.openPreviewPane(t,i)},"openPreviewPaneClickHandler")});u.setExpanderClickInstrumentation(function(n,t,i){var r="Expander"+(i?"Opened":"Closed"),u={st:t,K:n.instItem.getLayoutKValue()};l._instrumentationHelper.logClientInstEvent("Select",r,null,u)});this._previewPane&&(this._previewPane.init(this),this._previewPane.bindBeforeItemLaunch(function(n,t,i,r,u,f){return l._instrumentationHelper.instrumentItemClickForPreviewPane(n,t.instItem,t.sequenceNumber,t.instrumentPingBack,i,null,r,u,f)}),this._previewPane.bindAfterItemLaunch(function(n,t,i){return l.onSuggestionLaunch(n,t,i)}));n.Host.bindShown(function(){n.config.setIndexerDefaultValue&&(n.config.searchServiceDisabled=!0);SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync&&n.Promise.safeChain("getSearchServiceStatusAsync",function(){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync()},function(t){l._instrumentationHelper.setSearchServiceStatus(tr(t));switch(t){case 1:case 2:case 5:case 6:case 7:n.config.searchServiceDisabled=!0;l.showIndexingMessage(!1);break;case 0:case 4:if(n.config.queryIndexerOnRunningOnly){n.config.searchServiceDisabled=!0;l.showIndexingMessage(!0);break}n.config.searchServiceDisabled=!1;break;case 3:n.config.searchServiceDisabled=!1}})});u.bindOnNarratorLaunch(function(t){for(var i,f=n.getCurrentTime(),e=l.getSelectableItems(),r=0,u=e;r<u.length;r++)if(i=u[r],i.id==t){l.isSuggestionOrGroup(i)?(l.select(i,!1),l.submit(f,!1,i.sequenceNumber,null,!0)):l.isScopeElement(i)&&_ge(i.id).click();break}});n.Host.bindSearchBoxGotFocus(function(){l._menuFactory.dismiss();var t=n.getCurrentActiveElement();t&&t.blur();l._selectedItem&&!l.isScopeElement(l._selectedItem)&&l.renderSelectedSuggestionState(!1)});n.Host.bindSearchBoxLostFocus(function(){var t=l.isScopeTile(n.getCurrentActiveElement());t?n.safeSetTimeout(function(){n.Host.searchBoxHasFocus()||l.isScopeElement(l._selectedItem)||l.renderSelectedSuggestionState(!0)},75,"RootViewModel.bindSearchBoxLostFocus"):l.renderSelectedSuggestionState(!0)});sj_evt.bind("CortanaPaneWidthSet",function(n){return l.onPaneWidthSet(n[1])});sj_be(_ge("qfContainer"),"scroll",function(){l._menuFactory.dismiss();l._popoverFactory&&l._popoverFactory.dismiss()});this._iconRenderInfos=[]}return t.prototype.isScopeTile=function(n){return n&&n.classList.contains("scopeTile")},t.prototype.onDismiss=function(){this.topResults=[];this.renderTopResults(!0);this.groups=[];this.renderGroups(!0);this._partialQuery=null;this._lastUpdatedSequenceNumber=-1;this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this.toggleProgressBar(!1);this._menuFactory.dismiss();this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane.dismiss();this._page.hideTemporaryMessage();this.hideIndexingMessage();n.DialogBox&&n.DialogBox.hide();this._headerFooterViewModel&&this._headerFooterViewModel.render(null,!1,!1,!1,!0);n.Host.setSearchBoxGlyphIcon()},t.prototype.bindItemLaunch=function(n){this._itemLaunchEventHandlers.push(n)},t.prototype.onPaneWidthSet=function(n){ct=Math.floor((n-2*a)/ft);ht=Math.floor((n-2*a)/ut)},t.prototype.setSelectedStyleSuspended=function(t,i){t.selectedStyleSuspended=i&&n.Host.isRequestFocusAvailable()},t.prototype.renderSelectedSuggestionState=function(n){this._selectedItem&&(this.setSelectedStyleSuspended(this._selectedItem,n),this.renderSelection(this._selectedItem))},t.prototype.toggleProgressBar=function(t){var i=this;n.config.dataSourcesWithProgressBar.length>0&&(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 e,f,v,s,h,c,y,p,l,a;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(),v="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(s=this._menuFactory.onAfterKeyDown(t,i,r,u),s)return!0;if(n.isUpOrDownKey(t))return!1}this._menuFactory.dismiss(!0)}if(this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if(t==37||t==39||t==13||n.isUpOrDownKey(t)){if(s=this._popoverFactory.onAfterKeyDown(t,i,r,u),s)return!0;if(t==37||t==39)return!1}this._popoverFactory.dismiss(!1)}if(n.RuntimeConfig.QfMode==5&&t==46)return(h=this._selectedItem,h&&h.removeIcon)?(h.removeIcon.click(n.getCurrentTime(),1),!0):!1;if(c=n.getCurrentActiveElement(),!this.isScopeTile(c)||f||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()||t!=39&&t!=37){if(t==9)n.config.allowTabToSelectSuggestions||e||!this._selectedItem||f||this.isScopeElement(this._selectedItem)?u||this.handleCrossViewModelsTabKeyNavigation(c,e):this.select(this._headerFooterViewModel.getSelectableItems()[0],!1);else 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 y=n.getRtlAdjustedKey(t),this._headerFooterViewModel.focusNextScopeTile(c,y==39),p=this._headerFooterViewModel.getSelectableItems(),this.select(p[0],!1);return f=this._previewPane&&this._previewPane.hasFocus(),this._selectedItem&&(n.isUpOrDownKey(t)||t==9)&&!f&&(l=this.isScopeElement(this._selectedItem),l||this._selectedItem==this.topResults[0]?this._page.scrollToTop():this._page.scrollTo(this._selectedItem),a=v+"-AdjustFocus",l||this.isAdvancedOption(this._selectedItem)||this.isFlyout(this._selectedItem)?(this.isAdvancedOption(this._selectedItem)?_ge(this._selectedItem.id).querySelector("input").focus():_ge(this._selectedItem.id).focus(),n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView(a)):t!=9&&n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(t,a)),this.isFlyoutVisible()&&o.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=o.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 a=n.RuntimeConfig.PreviewPaneAvailable&&!!this._previewPane,o=a&&this._previewPane.isOpened(),v=o&&this._previewPane.hasFocus(),e,s,f,l,u,h,c,r;n.DialogBox&&n.DialogBox.isVisible()?(e=n.DialogBox.getSelectableItemsByGroup(),i?this.select(e[e.length-1][0],!1):this.select(e[0][0],!1)):v?i?(this._previewPane.blur(),r=null,this._headerFooterViewModel&&(s=this._headerFooterViewModel.getSelectableItemsByGroup(),r=s[s.length-1][0]),this.select(r,!1)):(this._previewPane.blur(),u=this.getSelectableItems(),this.select(u[0],!0)):this.isScopeTile(t)?!o||i?(f=this.getSelectableSuggestionsByGroup(!0),f.length>0?(l=i?f[f.length-1][0]:f[0][0],this.select(l,!0)):(u=this.getSelectableItems(),u.length>0?this.select(u[0],!0):this.select(null,!0)),h="handleCrossBordersNavigationWithTab",n.safeSetTimeout(function(){return n.Host.setFocusInSearchBox(9,h)},0,h)):(this.select(this._previewPane.getPreviewedSuggestion(),!0),this._previewPane.focus(!0)):this._selectedItem?i?o?this._previewPane.focus():(c=this.getSelectableItemsByGroup(),r=c[c.length-1][0],this.select(r,!1)):this.select(this.getSelectableItemsByGroup()[0][0],!1):this.select(this.getSelectableItemsByGroup()[0][0],!1)},t.prototype.tryShowContextMenuOnSelectedSuggestion=function(){var i=this,t=this._selectedItem&&this.isSuggestion(this._selectedItem)?this._selectedItem:null;t&&n.safeExecute(function(){return i._menuFactory.showContextMenuOnElement(t,_ge(t.id),function(){return n.Host.setFocusInSearchBox(null,"contextMenuDismiss")})},"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;e<c.length;e++)r=c[e],r.updateFromQuery&&!r.hasPreviewPaneOpened?r.updateFromQuery(t)&&(f=!0):u.length>h.length&&u.startsWith(h)&&r.query.toLowerCase().includes(t.queryToFetch.toLowerCase())&&(l=r.text.indexOf(HitHighlightingParser.endMarker),l>=0&&l<r.text.length-1&&(r.text=HitHighlightingParser.addMarkers(HitHighlightingParser.removeMarkers(r.text),u),f=!0));if(f){for(o=0,a=this.topResults;o<a.length;o++)r=a[o],r.sequenceNumber=i,this.updateNarratorWithPreviewMessage(r);this.renderTopResults()}this.resetIconTimers();this._iconRenderInfos=[]}},t.prototype.onSuggestionsParsed=function(t,i,r,u,f){var s=t.enabledDataSources[r].groupType,e,o,h;if(typeof s=="number")for(e=0,o=f;e<o.length;e++)h=o[e],h.staticGroupType=s;(u==="NI"||u==="PI")&&(r=="PP"||r=="ST"||t.scope!=n.Scope.All)&&n.RuntimeConfig.ScopesAvailable&&t.scope!=n.Scope.Web&&this.showIndexingMessage(!0)},t.prototype.areSuggestionsPresent=function(){return this.topResults.length>0||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,i,u,r,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();for(t=[],t.push.apply(t,this.topResults),i=0,u=this.groups;i<u.length;i++)r=u[i],r.click&&t.push(r),f=r.suggestions.filter(function(n){return!n.suppressed}),f.forEach(function(n){n.unselectable||t.push(n);n.subItems&&t.push.apply(t,n.subItems.filter(function(n){return!n.disabled}))});return this.areSuggestionsPresent()||t.push(s),n.config.allowUpForScopes&&this._headerFooterViewModel&&t.push.apply(t,this._headerFooterViewModel.getSelectableItems()),t},t.prototype.getSelectableSuggestionsByGroup=function(t){if(n.config.allowTabToSelectSuggestions){var i=[];return i.push(this.topResults),this.groups.forEach(function(n){n.click&&i.push([n]);var t=[],r=n.suggestions.filter(function(n){return!n.suppressed});r.forEach(function(n){n.unselectable||t.push(n);n.subItems&&t.push.apply(t,n.subItems.filter(function(n){return!n.disabled}))});i.push(t)}),!t&&this._headerFooterViewModel&&i.push(this._headerFooterViewModel.getSelectableItems()),i.filter(function(n){return n.length>0})}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([o.find(function(n){return!!_ge(n.id)})]),this._headerFooterViewModel&&t.push.apply(t,this._headerFooterViewModel.getSelectableItemsByGroup()),this.areSuggestionsPresent()?t.push.apply(t,this.getSelectableSuggestionsByGroup(!0)):t.push([s]),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:s},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.renderSelection=function(t,i){this.isSubItem(t)&&(t=t.suggestion);i&&this.isSubItem(i)&&(i=i.suggestion);(t&&this.isSuggestion(t)&&n.contains(this.topResults,t)||i&&this.isSuggestion(i)&&n.contains(this.topResults,i))&&this.renderTopResults();this._headerFooterViewModel&&(t&&this.isAdvancedOption(t)||i&&this.isAdvancedOption(i))&&this._headerFooterViewModel.updateTopHitHeader();(t&&n.isGroup(t)&&n.contains(this.groups,t)||t&&this.isSuggestion(t)&&this.groups.some(function(i){return n.contains(i.suggestions,t)})||i&&n.isGroup(i)&&n.contains(this.groups,i)||i&&this.isSuggestion(i)&&this.groups.some(function(t){return n.contains(t.suggestions,i)}))&&this.renderGroups()},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._page.updateGroupsView({query:this._contentQuery,topResults:this.topResults,groups:this.groups},t),this._instrumentationHelper.updateSuggestionsList(this.topResults,this.groups))},t.prototype.select=function(t,i){var f,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==s?(this._selectedItem=null,n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(null,"rvm_select")):(this._selectedItem=t,t&&(t.selected=!0,this.setSelectedStyleSuspended(t,!n.Host.searchBoxHasFocus()))),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<f.length;i++)r=f[i],r();this._renderGroupsIconsCBs=[];this._renderGroupsTimerForIcons&&(sb_ct(this._renderGroupsTimerForIcons),this._renderGroupsTimerForIcons=null)}if(s){if(t)for(u=0,e=this._renderTopResultsIconsCBs;u<e.length;u++)r=e[u],r();this._renderTopResultsIconsCBs=[];this._renderTopResultsTimerForIcons&&(sb_ct(this._renderTopResultsTimerForIcons),this._renderTopResultsTimerForIcons=null)}},t.prototype.setupIcon=function(t,i,r,u){var f=this,e,o,s;if(n.config.noFetchIcons){u();return}if(e=function(){r.isTopResult?f.renderTopResults():f.renderGroups();f.resetIconTimers(r.isTopResult,!0)},o=function(t){r.iconsPendingReturn==0?(e(),t&&t()):r.isTopResult?(t&&f._renderTopResultsIconsCBs.push(t),f._renderTopResultsTimerForIcons||(f._renderTopResultsTimerForIcons=n.safeSetTimeout(function(){f._renderTopResultsTimerForIcons=null;e()},st,"renderTRIconsAsync"))):(t&&f._renderGroupsIconsCBs.push(t),f._renderGroupsTimerForIcons||(f._renderGroupsTimerForIcons=n.safeSetTimeout(function(){f._renderGroupsTimerForIcons=null;e()},st,"renderGRPIconsAsync")))},++r.iconsPendingReturn,!i.suppressed&&i.getIcon)this._instrumentationHelper.notifyIconPending(t,r.isTopResult),s=this._partialQuery,i.getIcon(this.getImageSize(s,i,r.isTopResult),function(e){i.icon=e;var s=function(){--r.iconsPendingReturn;n.config.reactGroups&&e&&i.onIconLoaded?i.onIconLoaded():f._partialQuery&&t==n.SequenceNumberManager.getSequenceNumber()&&(f._instrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult),(r.isTopResult&&n.contains(f.topResults,i)||!r.isTopResult&&f.groups.some(function(t){return n.contains(t.suggestions,i)}))&&o(u))};n.populateImageRatio(i.icon,i.type,s)});else if(!i.suppressed&&i.icon&&n.canIconFail(i.icon)){this._instrumentationHelper.notifyIconPending(t,r.isTopResult);var h=i.icon.getFallbackIcon,c=function(n,t){return t(i.icon)},l=i.icon.isValidSize,a=function(){i.getIcon=h;f.setupIcon(t,i,r,u);f._instrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult)},v=function(){i.icon.isSmall=!0;i.getIcon=c;f.setupIcon(t,i,r,u);f._instrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult)};i.icon.onIconError=a;i.icon.onIconRendered=function(n,e){l(n,e)||i.icon.isSmall?(f._instrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult),u()):v()};--r.iconsPendingReturn;o()}else--r.iconsPendingReturn,u()},t.prototype.getImageSize=function(t,i,r){return t.isSearchHomeZI?i.type=="TOPL"?7:8:t.scope==n.Scope.Apps&&!t.queryToFetch?3:n.displayedInGridLayout(i.type)?2:r?0:1},t.prototype.isSuggestionOrGroup=function(n){return!this.isScopeElement(n)},t.prototype.isSuggestion=function(t){return!n.isGroup(t)&&!this.isScopeElement(t)&&!this.isAdvancedOption(t)},t.prototype.isAdvancedOption=function(n){return typeof n.layout=="number"},t.prototype.isFlyout=function(n){return this.isFlyoutVisible()&&o.indexOf(n)>=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 s=f?5:i?6:1,c=n.getCurrentActiveElement(),e,o,h,l;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,s);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(o=this._menuFactory.getSelectedItem(),o){o.click&&o.click(t,s,u);return}if(h=this._popoverFactory?this._popoverFactory.getSelectedItem():null,h){this._popoverFactory.submit(h);return}if(l=!this.isBodyOrSuggestion(c),l){n.Host.isRequestFocusAvailable()||c.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,s,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||this._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,y,t):u.shiftKey?this.launchVerb(f,p,t):f.click(t,r,u);this.onSuggestionLaunch(f,this._partialQuery)},t.prototype.onSuggestionLaunch=function(t,i,r){n.isChildSuggestion(t)&&(t=t.parent);this._itemLaunchEventHandlers.forEach(function(n){return n(t,i,r)})},t.prototype.launchVerb=function(t,i,r){var u=wt("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.Promise.safeChain("verb.executeAsync",function(){return t.executeAsync()},null,null,null,i),e=!0,"break"},f=0,o=u;f<o.length;f++)if(s=o[f],h=c(s),h==="break")break;e||t.click(r,0)},function(){return!0});u||t.click(r,0)},t.prototype.getGroupHeaderClickAction=function(t,i,r,u){var h=this,f,o,e,s,c,l,a;if(n.RuntimeConfig.QfMode==8)return[null,null,null,null,null];if(e=null,s=null,n.RuntimeConfig.ScopesAvailable&&(c=n.getScope(i.type),c!=n.Scope.All))if(i.type==n.GroupType.SearchSuggestions&&t.isSearchHomeZI)o=n.Host.getLocString("OpenPrivacyPortalButtonText"),e=n.Host.getLocString("ManageSearchHistory"),f=function(){return n.Host.launchPrivacyPortal()};else return n.isL2(t)||!n.isScopeEnabled(c,n.ScopeConfig[c])?[null,null,null,null,null]:(l=function(){return h._headerFooterViewModel.clickHandler(c,"groupHeader",i)},[l,null,null,null,null]);if(!f)switch(i.type){case n.GroupType.Store:f=function(){return n.Host.launchStoreSearch(t.queryToFetch)};break;case n.GroupType.SearchSuggestions:f=function(){return h.launchSearch(t,r)};break;case n.GroupType.PathCompletion:f=function(){return n.Host.launchFolder(gt(t,h._partialQuery))};break;case n.GroupType.MSNNews:if(!n.config.msnNewsAlternativeUX)return o=n.Host.getLocString("QuickSearchSuggestionsSection"),e=n.Host.getLocString("MSNNewsQuickSearchHover"),f=function(){h._lightweightStorage.setItem(n.currentTabStorageKey,n.MSNNewsTabs.QuickSearches);n.Host.refreshCurrentPane();h._instrumentationHelper.logClientInstEvent("Select","MSNNewsTabChange",null,{newtab:"QuickSearches"})},[f,null,o,e,s];break;case n.GroupType.Upsell:if(t.isSearchHomeZI||n.config.enableEdgeUpsellBottom)return s={content:"",type:2},o=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=this._upsellViewModel.getDismissButtonAction(t),[f,null,o,e,s];break;case n.GroupType.MeetingPrep:return s={content:"",type:2},o=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=u.dismissAction,[f,null,o,e,s];case n.GroupType.QuickSearch:if(n.config.msnNewsSearch&&n.shouldEnableMSNNewsSearches(n.getCurrentLanguage()))return o=n.Host.getLocString(n.config.msnNewsTitleResource),e=n.Host.getLocString(n.config.msnNewsHoverResource),f=function(){h._lightweightStorage.setItem(n.currentTabStorageKey,n.MSNNewsTabs.News);n.Host.refreshCurrentPane();h._instrumentationHelper.logClientInstEvent("Select","MSNNewsTabChange",null,{newtab:"MSNNews"})},[f,null,o,e,s];break;case n.GroupType.WelcomeExperience:if(n.config.enableWWETour&&n.RuntimeConfig.PreviewPaneAvailable&&SearchAppWrapper.CortanaApp.height>=615)return s={content:"",type:2},o=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=function(){return h.dismissTour(t)},[f,null,o,e,s];break;case n.GroupType.BingDailyImage:if(n.canShowBingDailyImage(this._lightweightStorage))return s={content:"",type:2,className:"bingImageDismissGroup"},o=n.Host.getLocString("DismissBingImage"),e=n.Host.getLocString("DismissBingImage"),f=function(){h._lightweightStorage.setItem("BingImageDismissed","1");n.Host.refreshCurrentPane();h._instrumentationHelper.logClientInstEvent("Select","BingImageDismiss",null)},[f,null,o,e,s];break;case n.GroupType.SkypeBanner:return s={content:"",type:2},o=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=this._upsellViewModel.getDismissButtonAction(t),[f,null,o,e,s]}if(f){if(!r)throw"No QS code for: "+n.GroupType[i.type];return a=n.InstrumentedItem.getNonSuggestionInstrumentedItem(r,n.SyntheticQSCodesMaps.KValues),[f,a,o,e,s]}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.length<n.config.minLengthForIBAonL1)return!0;if(t==n.GroupType.Apps||t==n.GroupType.Settings){var r=i[t==n.GroupType.Apps?"PP":"ST"];return!(r&&r.maxedOut)}return!0},t.prototype.shouldHideGroupHeader=function(t){if(t===n.GroupType.MSNWeather||t===n.GroupType.TopApps&&this._partialQuery.scope==n.Scope.All&&n.shouldEnableWeatherTile(n.getCurrentLanguage())&&!n.config.prong1)return n.isWeatherTileVisible(this._lightweightStorage);if(t===n.GroupType.QuickSearch&&n.shouldEnableMSNNewsSearches(n.getCurrentLanguage())&&n.canShowMSNNewsTab(this._lightweightStorage))return!0;if(n.RuntimeConfig.QfMode!=8||t==n.GroupType.QuickSearch||this._partialQuery&&this._partialQuery.queryToFetch){if(t===n.GroupType.VisualSearch||t===n.GroupType.MSNNews&&n.config.msnNewsAlternativeUX)return!0}else return!0;return!1},t.prototype.addGroup=function(t,r,u,f,e){var w,o,a;if(i(this.groups,t))throw new Error("Trying to add repeated group "+t);var v=pt[t.type],s=this.getGroupHeaderClickAction(this._partialQuery,t,v,r),h=s[0],c=s[1],y=s[2],b=s[3],p=s[4],l=ti(this._partialQuery,t.type,r,!!h);return t.source&&(l.title+=" - "+n.getGroupSourceDisplayName(t.source)),o=[],n.isTopHitChildGroup(t)?o.push("topHitConnectedToGroup"):t.type==n.GroupType.TopApps||this._partialQuery.isSearchHomeZI&&t.type==n.GroupType.People?o.push("topItemsGroup"):t.type==n.GroupType.QuickSearch?o.push("balloonSuggGroup"):t.type==n.GroupType.VisualSearch?o.push("snipSuggGroup"):t.type==n.GroupType.MSNNews?o.push("msnNewsGroup"):t.type==n.GroupType.LockscreenQuickSearch?o.push("lockscreenQuickSuggGroup"):t.type==n.GroupType.WelcomeExperience?o.push("welcomeExperience"):t.type==n.GroupType.Upsell?o.push("upsellSuggGroup"):t.type==n.GroupType.MeetingPrep?o.push("meetingPrepSuggGroup"):t.type==n.GroupType.SkypeBanner?o.push("skypePromoSuggGroup"):t.type==n.GroupType.BingDailyImage?o.push("bingImageGroup"):t.type==n.GroupType.MSNWeather?o.push("msnWeatherGroup"):n.RuntimeConfig.QfMode==8?t.type==n.GroupType.Apps?o.push("appsGroup"):(t.type==n.GroupType.Documents||t.type==n.GroupType.Photos||t.type==n.GroupType.Videos||t.type==n.GroupType.Folders)&&o.push("filesGroup"):t.type==n.GroupType.MRUHistory&&(o.push("mruHistory"),w=n.Host.getLocString("MRUHistoryEducation")),a={type:t.type,typeWithSource:t,id:"gr"+t.type+(t.source||""),text:l.title,secondaryText:y,secondaryIcon:p,narratorText:l.narratorText,tooltip:b,click:(n.cohortProfileManager===null||n.cohortProfileManager===void 0?void 0:n.cohortProfileManager.isTourVisible())?null:h,onlyAnnotationIsClickable:h&&(!!y||!!p),suggestions:[],instRegionName:n.GroupType[t.type],instItem:c,selected:!1,cssClasses:o.join(" ")||undefined,sequenceNumber:u,showPlusIconInHeader:this.shouldShowPlusIconInGroupHeader(t.type,e),hideGroupHeader:this.shouldHideGroupHeader(t.type),education:w},c&&this._instrumentationHelper.instrumentSyntheticInstrumentedItem(u,v,c),this._resultsCounter.groups.push({typeWithSource:t,suggestions:[]}),this.insertGroup(a,f),a},t.prototype.insertGroup=function(t,i){for(var f,e=this,o=i.findIndex(function(i){return n.sameGroup(i,t.typeWithSource)}),u=!1,s=function(r){var f=i.findIndex(function(t){return n.sameGroup(t,e.groups[r].typeWithSource)});if(f>o)return h.groups.splice(r,0,t),u=!0,"break"},h=this,r=0;r<this.groups.length;r++)if(f=s(r),f==="break")break;u||this.groups.push(t)},t.prototype.handlePendingSubmit=function(n){if(this._pendingSubmitSequenceNumber==this._lastUpdatedSequenceNumber)try{if(this.topResults.length==0)(this.groups.length>0||n.length>0)&&this.showDisableEnterMessage();else{var t=this.topResults[0];return this._instrumentationHelper.instrumentItemClick(this._pendingSubmitTimeStamp,t.instItem,t.sequenceNumber,t.instrumentPingBack,1,this._pendingSubmitModifierKeys),this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.ctrlKey&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(t,y,this._pendingSubmitTimeStamp):this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(t,p,this._pendingSubmitTimeStamp):t.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,u;t?this._turnOnIndexingInstItem=null:(this._turnOnIndexingInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMIO",n.SyntheticQSCodesMaps.KValues),r={id:null,selected:null,text:n.Host.getLocString("WindowsIndexingDisabledAction"),title:null,instItem:this._turnOnIndexingInstItem,click:function(t,r){var u=n.SequenceNumberManager.getSequenceNumber();u>i._lastUpdatedSequenceNumber&&i._instrumentationHelper.instrumentSyntheticInstrumentedItem(u,"IMIO",i._turnOnIndexingInstItem);i._instrumentationHelper.instrumentItemClick(t,i._turnOnIndexingInstItem,u,null,r,null);n.LocalDataProvider.launchIndexingOptions(!1)},layout:1,isSelectable:!0});u={messageText:t?n.Host.getLocString("WindowsIndexingInProgressMessage"):n.Host.getLocString("WindowsIndexingDisabledMessage"),title:t?n.Host.getLocString("WindowsIndexingInProgressToolTip"):n.Host.getLocString("WindowsIndexingDisabledToolTip"),action:r};this._page.updateIndexingMessageView(u)},t.prototype.hideIndexingMessage=function(){this._turnOnIndexingInstItem=null;this._page.updateIndexingMessageView(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-=ci),t.topResults.length==0||n.RuntimeConfig.FlatListWithoutGroups||(i-=ui),t.topResults.forEach(function(t){return i-=kt(t,n.isL2(r._partialQuery))}),t.groups.forEach(function(n){return i-=nr(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-=hi),i)},t.prototype.getAvailableSpaceForZeroInputHomeTopSection=function(t,i){var r=this._page.getSuggestionsContainerWidth(),u,f;return r-=n.RuntimeConfig.AlwaysWide?ai:vi,r-=ot,u=t?t.suggestions.filter(function(n){return n&&!n.suppressed}).length:0,u+=i.suppressed?0:1,f=n.RuntimeConfig.AlwaysWide?et:yi,r-(f+ot)*u},t.prototype.canFitSuggestion=function(t,r,u){if(u.suppressed||n.getTweakedSetting("scrollBarInL1"))return!0;var o=bt(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,o,f;return r.type==="SNSC"?!0:(u=i(this.groups,t),t.type==n.GroupType.MRUHistory)?!0:ni(t.type)?this._partialQuery.scope===n.Scope.All&&n.config.prong1&&t.type==n.GroupType.TopApps?(e=u?u.suggestions.length:0,e<5):n.isWeatherTileVisible(this._lightweightStorage)&&this._partialQuery.scope===n.Scope.All&&n.shouldEnableWeatherTile(n.getCurrentLanguage())?u?this.getAvailableSpaceForZeroInputHomeTopSection(u,r)>=et:!0:this.getAvailableSpaceForZeroInputHomeTopSection(u,r)>=0:t.type===n.GroupType.QuickSearch?(o=n.config.maxQuickSearches+(n.config.resumeSearch?1:0),f=0,SearchAppWrapper.CortanaApp.height<600&&(f=2),(u?u.suggestions.length:0)>=o-f)?!1:!0:t.type===n.GroupType.LockscreenQuickSearch?!0:(u?u.suggestions.length:0)<this.getMaxNumberOfRecentItems(t.type)},t.prototype.getMaxNumberOfRecentItems=function(t){if(t===n.GroupType.MSNNews)return 5;if(n.enableProngWeather(n.getCurrentLanguage())&&t===n.GroupType.MRUHistory)return SearchAppWrapper.CortanaApp.height<600?4:SearchAppWrapper.CortanaApp.height<620?6:7;if(t==n.GroupType.MRUHistory){var i=n.ScopeConfig[n.Scope.All].enabledDataSourcesForZeroInput,r=i.some(function(n){return n&&n.suggestionGroupToggler&&n.suggestionGroupToggler.isHidden()});if(n.RuntimeConfig.PreviewPaneAvailable&&n.shouldEnableQuickSearches(n.Host.getLanguage().toLowerCase())&&!r&&SearchAppWrapper.CortanaApp.height<600)return n.config.activityInZI-2}return n.config.activityInZI},t.prototype.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup=function(){var i,r,u,t,f;if(n.isL2(this._partialQuery)&&this._partialQuery.queryToFetch||n.getTweakedSetting("scrollBarInL1"))return Number.MAX_VALUE;if(this._partialQuery.isSearchHomeZI)return n.RuntimeConfig.QfMode==8?4:4;for(i=bt(this._resultsCounter),r=0,u=i.groups;r<u.length;r++)for(t=u[r];t.suggestions.length<n.config.minSuggestionsPerGroup;)t.suggestions.push(t.suggestions[0]);while(this.getAvailableSpace(i)>0){for(t={suggestions:[]},f=0;f<n.config.minSuggestionsPerGroup;++f)t.suggestions.push({mainTextWrapsToTwoLines:!1,isSuppressed:!1,hasTwoLines:!1});i.groups.push(t)}return i.groups.length-1},t.prototype.onSuggestionAddedToGroup=function(t,r){var f=this,u,o;this.updateNarratorWithPreviewMessage(t);n.isChildSuggestion(t)&&(t.displayed=!0,u=t.parent,t.id=u.id+"_"+u.childSuggestions.indexOf(t),n.isJumpListSuggestion(t)&&t.tooltip===undefined&&n.Promise.safeChain("getJumpListDescription",function(){return t.jumpListItem.getDescriptionAsync()},function(i){t.tooltip=i;f.groups.some(function(i){return n.contains(i.suggestions,t)})&&f.renderGroups()}));this.setRemoveIcon(t);o=i(this._resultsCounter.groups,r.typeWithSource);o.suggestions.push({mainTextWrapsToTwoLines:e(t,r.typeWithSource.type,!1),isSuppressed:t.suppressed,hasTwoLines:n.contains(t.classNames,"forceNoWrapOutsideTopResult")});n.displayedInGridLayout(r.typeWithSource.type)&&r.suggestions.filter(function(n){return!n.suppressed}).length>0&&n.RuntimeConfig.QfMode!=8&&(r.cssClasses+=n.isL2(this._partialQuery)?" gridLayout":" gridLayout gridLayoutMedium")},t.prototype.onGroupsCleared=function(){this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this._resultsCounter.groups=[];this._turnOnIndexingInstItem&&this._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");this._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,i;if(n.RuntimeConfig.QfMode!=8){var u=t.getExtraVerbs&&t.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromDeviceHistory"}),o=t.type=="HS"&&n.config.removeSuggUrl,s=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"}),e=t.getExtraVerbs&&t.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromWeatherTile"});(s||u||o||f||e)&&(i=f?"RemoveFromDeviceHistoryAll":u?"RemoveFromDeviceHistory":e?"RemoveFromWeatherTile":"RemoveFromWebHistory",t.removeIcon={icon:{content:"",type:2},title:n.Host.getLocString(i),click:function(u,f){r._page.hideTemporaryMessage();r._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.onBeforeRenderTopResults=function(t,i,r,u,f){var e=this,h,c,o,a,v,l,s,y;return this.topResults.forEach(function(n){e.setRemoveIcon(n);e.updateNarratorWithPreviewMessage(n)}),h=1,this.topResults.length!=1||this.topResults[0].hasChildSuggestionsDisplayed||r.some(function(t){return n.isChildSuggestion(t)})&&(this.topResults[0].hasChildSuggestionsDisplayed=!0,h=0),c=this.getSelectableItems(),n.RuntimeConfig.FirstSuggestionSelectedByDefault?(!this._selectedItem||!n.contains(c,this._selectedItem)||this.isScopeElement(this._selectedItem)||this._selectedItem==i[0]&&this.topResults[0]!=i[0]||this._selectedItem!=c[0]||this._selectedItem.previewPaneNeedsRefreshAfterDeduping)&&(o=this._partialQuery.queryToFetch&&this.topResults.length>0?this.topResults[0]:null,n.config.synthWebNoBestMatch&&n.isNullOrUndefined(o)&&(a=[n.GroupType.SearchSuggestions,n.GroupType.Websites],v=r.filter(function(t){return!n.contains(a,n.getGroupType(t))}),v.length==0&&(o=r.length>0?r[0]:null)),this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable&&n.safeExecute(function(){return e._previewPane.onTopHitUpdated(e._partialQuery,e._selectedItem&&e.isSuggestion(e._selectedItem)?e._selectedItem:null,o,e.getSuggestions(!1))},"ppOnTopHitUpdated"),n.RuntimeConfig.QfMode==8&&n.isNullOrUndefined(o)&&(o=r.length>0?r[0]:null),this.select(o,!1),this._page.scrollToTop()):t&&this.select(null,!1),l=this.topResults.length>0,s=function(t){return!t.suppressed&&(t.staticGroupType!=n.GroupType.QuickSearch||n.RuntimeConfig.QfMode==8)&&(n.RuntimeConfig.QfMode!=6||t.type!="LSQS")},this._headerFooterViewModel&&(y=l||r.some(s)||this.groups.some(function(n){return n.suggestions.some(s)})||this._pendingSuggestionsInMissingGroups.some(function(n){return n.suggestions.some(s)})||this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.some(s)}),this._headerFooterViewModel.render(this._partialQuery,l,y,u,f)),h},t.prototype.isRankable=function(t){return 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.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,ot,d;if(t&&(this._contentQuery=this._partialQuery,this._renderTopResultsTimerForIcons=null,this._renderGroupsTimerForIcons=null),n.config.enableMRUHint)for(p=0,nt=i;p<nt.length;p++)tt=nt[p],tt.mruHintEnabled&&(tt.uxHint=n.Host.getLocString("MruBestMatch"));var et=this.updateTopResults(t,i,r,u,f,c),it=et[0],ct=et[1];for(ct(),this._resultsCounter.topResults=[],w=0,rt=this.topResults;w<rt.length;w++)v=rt[w],v.previewPaneNeedsRefreshAfterDeduping=!1,ot=1+(v.primaryMetadata?1:0)+(v.secondaryMetadata?1:0),this._resultsCounter.topResults.push({mainTextWrapsToTwoLines:e(v,null,!0),numberOfLines:ot,isHtmlAnswer:!!v.htmlContent,isSuppressed:!1,grid:n.displayedInGridLayout(v.type)});if(this._autoComplete&&this.topResults.length>0&&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,lt=this.createIconRenderInfo(),st=function(){if(ut){var t=a.groups.map(function(n){return n.typeWithSource.type}),i=a._contentQuery.queryToFetch&&n.RuntimeConfig.QfMode==8;a._contentQuery.queryToFetch||b!=0||a._instrumentationHelper.instrumentZiRendered(u);a._instrumentationHelper.instrumentRenderFinished(u,s,t,b!=0,i,!a._contentQuery.queryToFetch)}},ft=function(n,t){var r=!1,i;if(a.isRankable(t)&&a._partialQuery&&a._partialQuery.queryToFetch)for(i=0;i<t.suggestions.length;i++)if(n.rankingScore>t.suggestions[i].rankingScore){t.suggestions.splice(i,0,n);r=!0;break}r||t.suggestions.push(n);++b;a.setupIcon(u,n,lt,function(){--b;st()});a.onSuggestionAddedToGroup(n,t)},y=this.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup()-this.groups.length,k=!1,ht=function(){var i,f,t,e;if(y!=0&&r||a.flush(ft,u,h),a._partialQuery&&a._partialQuery.queryToFetch)for(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)})}),i=0,f=a.groups;i<f.length;i++)t=f[i],a.isRankable(t)?t.suggestions.sort(function(n,t){return t.rankingScore-n.rankingScore}):a.isNotRankableWithRecourse(t)&&(e=t.suggestions.map(function(n){return n.notAResult}).findIndex(function(n){return n}),e!=-1&&t.suggestions.splice(t.suggestions.length-1,0,t.suggestions.splice(e,1)[0])),a.populateGroupHeaderFlags(t);else a.groups.forEach(function(t){var i,r;t.type===n.GroupType.VisualSearch&&(i=t.suggestions.findIndex(function(n){return n.type==="SNSC"}),i>=0&&(r=t.suggestions.splice(i,1)[0],t.suggestions.push(r)))})};return t||f.length>0||o.length>0?(this.renderGroupsAfter(function(){for(var ut,s,c,k,d,v,nt,p,tt,i,w,rt,e=0,b=o;e<b.length;e++)i=b[e],ut=a.removeSuggestion(i,l),ut&&(y+=1);for(s=function(t,i){var e=a.getGroupData(t),f=e[0],r=e[1],o;(n.cohortProfileManager===null||n.cohortProfileManager===void 0?void 0:n.cohortProfileManager.isTourVisible())&&(t.click=undefined,t.tooltip=undefined);r?(r.count&&r.count++,o=n.config.minSuggestionsPerGroup&&!i?n.config.minSuggestionsPerGroup-r.suggestions.length:999,o>0&&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;c<k.length;c++){var et=k[c],ot=a.getGroupData(et),r=ot[1];r&&r.count&&(r.count-=1)}if(d=function(){return a._contentQuery.isSearchHomeZI||n.getTweakedSetting("scrollBarInL1")},it&&!t){for(v=0,nt=f;v<nt.length;v++)i=nt[v],n.contains(g,i)&&s(i,!0);for(p=0,tt=f;p<tt.length;p++)i=tt[p],n.contains(g,i)||s(i,d())}else f.forEach(function(n){return s(n,d())});for(w=0,rt=a.topResults;w<rt.length;w++){var et=rt[w],st=a.getGroupData(et),r=st[1];r&&r.count&&(r.count+=1)}ht()}),k=!0,ut=!0):y!=0&&r||(this._pendingSuggestionsInMissingGroups.some(function(n){return n.suggestions.length>0})||this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.length>0}))&&(this.renderGroupsAfter(function(){return ht()}),k=!0,ut=!0),(it||k)&&(d=void 0,it?k||(d=!0):d=!1,this.resetIconTimers(d,!0)),st(),c&&this.toggleProgressBar(!1),n.config.mruSearchHome&&this._partialQuery.isSearchHomeZI&&this._partialQuery.scope==n.Scope.All&&this.sortMRUList(c),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(yt),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(yt,"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;i<this._pendingSuggestionsInExistingGroups.length;++i)if(r=this._pendingSuggestionsInExistingGroups[i],r.group==t)if(u=r.suggestions.indexOf(n),u==-1)throw new Error("Pending suggestion not found");else{r.suggestions.splice(u,1);r.suggestions.length==0&&this._pendingSuggestionsInExistingGroups.splice(i,1);return}throw new Error("Pending suggestion not found");},t.prototype.removePendingSuggestionFromMissingGroup=function(t,i){for(var u,f,r=0;r<this._pendingSuggestionsInMissingGroups.length;++r)if(u=this._pendingSuggestionsInMissingGroups[r],n.sameGroup(u.typeWithSource,i))if(f=u.suggestions.indexOf(t),f==-1)throw new Error("Pending suggestion not found");else{u.suggestions.splice(f,1);u.suggestions.length==0&&this._pendingSuggestionsInMissingGroups.splice(r,1);return}throw new Error("Pending suggestion not found");},t.prototype.queueSuggestionInExistingGroup=function(n,t){var i=dt(this._pendingSuggestionsInExistingGroups,t.typeWithSource);i?i.suggestions.push(n):(i={group:t,suggestions:[n]},this._pendingSuggestionsInExistingGroups.push(i))},t.prototype.queueSuggestionInMissingGroup=function(n,t,r){var u=i(this._pendingSuggestionsInMissingGroups,t);u?u.suggestions.push(n):(u={typeWithSource:t,suggestions:[n],extraSignalsMap:r},this._pendingSuggestionsInMissingGroups.push(u))},t.prototype.partialFlush=function(n,t,i,r){while(n>0&&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;o<h.length;o++)u=h[o],a(u);while(this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.length>0}))for(e=0,s=this._pendingSuggestionsInExistingGroups;e<s.length;e++)u=s[e],c=n.config.minSuggestionsPerGroup?1:u.suggestions.length,this.partialFlush(c,u.group,u.suggestions,t)},t.prototype.removeSuggestion=function(t,r){var s={type:n.getGroupType(t),source:t.sourceForGroup},u=i(this.groups,s),f,h,o;if(u)if(n.tryRemove(u.suggestions,t)){if(f=i(this._resultsCounter.groups,u.typeWithSource),h=e(t,u.typeWithSource.type,!1),n.removeFirstWhere(f.suggestions,function(n){return n.mainTextWrapsToTwoLines==h}),n.displayedInGridLayout(u.typeWithSource.type)&&u.suggestions.filter(function(n){return!n.suppressed}).length==0&&(u.cssClasses=""),u.suggestions.length==0)return n.tryRemove(this.groups,u),this._resultsCounter.groups=this._resultsCounter.groups.filter(function(n){return n!=f}),o=dt(this._pendingSuggestionsInExistingGroups,u.typeWithSource),o&&this._pendingSuggestionsInMissingGroups.push({typeWithSource:u.typeWithSource,suggestions:o.suggestions,extraSignalsMap:r}),!0}else this.removePendingSuggestionFromExistingGroup(t,u);else this.removePendingSuggestionFromMissingGroup(t,s);return!1},t.prototype.isScopeElement=function(n){return this._headerFooterViewModel&&this._headerFooterViewModel.isScopeElement(n)},t.prototype.clickedWeatherUnitConverter=function(t){return!n.shouldEnableWeatherTile(n.getCurrentLanguage())&&!n.enableProngWeather(n.getCurrentLanguage())?!1:t.target&&t.target.className.indexOf("secondaryUnit")!=-1},t.prototype.createIconRenderInfo=function(n){var t={iconsPendingReturn:0,isTopResult:n};return this._iconRenderInfos.push(t),t},t.prototype.getCurrentTopResults=function(){return this.topResults.slice(0)},t.prototype.getTopResultsWhichFitInCanvas=function(n){return n},t.prototype.resetAriaSelected=function(n){n&&this._page.render(function(){var t=_ge(n.id);t&&(t.setAttribute("aria-selected","false"),t.setAttribute("aria-selected","true"))})},t.prototype.updateTopResults=function(t,i,r,u,f,e){var s=this,a,o,h,y;t!=(u!=this._lastUpdatedSequenceNumber)&&SharedLogHelper.LogError("updateTopResult",t+" != (sequenceNumber "+u+" != lastUpdateSequenceNumber "+this._lastUpdatedSequenceNumber+")",new Error("Precondition failed"));this._lastUpdatedSequenceNumber=u;t&&(this.groups=[],this.onGroupsCleared());a=this._selectedItem;o=this.topResults;i=this.getTopResultsWhichFitInCanvas(i);h=!n.sequenceEqual(i,o)||o.some(function(n){return n.needsRefreshAfterDeduping});h&&(this.topResults=i.slice(0));var c=!1,l=h?i.length:0,p=this.createIconRenderInfo(!0),v=function(){c&&(n.config.enableLocalInstrumentation&&s._instrumentationHelper.instrumentRenderedLocalSuggestion(u,i),s._instrumentationHelper.instrumentTopResultRendered(u,i.map(function(n){return n.type}),l!=0))};return h?(this.renderTopResultsAfter(function(){for(var h,i=0,c=s.topResults;i<c.length;i++)h=c[i],h.needsRefreshAfterDeduping=!1,n.contains(o,h)?l-=1:s.setupIcon(u,h,p,function(){l-=1;v()});s.onBeforeRenderTopResults(t,o,f,r,e)}),c=!0):(y=this.onBeforeRenderTopResults(t,o,f,r,e),y==0&&(this.renderTopResults(),c=!0)),this._selectedItem&&(a!=this._selectedItem||t)&&n.contains(this.topResults,this._selectedItem)&&this.resetAriaSelected(this._selectedItem),[h,v]},t.prototype.renderGroupsAfter=function(n){var t=this._groupRenderingDisabled;this._groupRenderingDisabled=!0;try{n()}finally{this._groupRenderingDisabled=t;this.renderGroups()}},t.prototype.renderTopResults=function(n){this._topResultsRenderingDisabled||(this._page.updateTopResultsView({query:this._contentQuery,topResults:this.topResults,groups:this.groups},n),this._instrumentationHelper.updateSuggestionsList(this.topResults,this.groups))},t.prototype.renderTopResultsAfter=function(n){var u=this._topResultsRenderingDisabled,t,i,r;this._topResultsRenderingDisabled=!0;try{n()}finally{for(this._topResultsRenderingDisabled=u,this.renderTopResults(),t=0,i=this.topResults;t<i.length;t++)r=i[t],r.executeScript&&r.executeScript()}},t}();n.RootViewModel=ii})(WSB||(WSB={}))