????

Your IP : 216.73.216.188


Current Path : C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Desktop/
Upload File :
Current File : C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Desktop/23.txt

var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),AutoSuggest;(function(n){var t;(function(t){function nr(n,t){var r=[],u,f;if(t)if(n)r=t.slice();else{u=function(n){var i=t.find(function(t){return t.verb&&t.verb.toLocaleLowerCase()==n.toLocaleLowerCase()});i&&r.push(i)};for(f in i)u(f)}return r}function tr(n){return n?n.filter(function(n){return!n.verb||n.verb.toLowerCase()!="open"}):[]}function e(n,i,r,u,f,e){e()&&(n=n.slice(),i.getExtraVerbsAsync?t.Promise.safeChain("getExtraVerbsAsync",function(){return i.getExtraVerbsAsync(u)},function(t){return l(g(n,t,!0),i,u,f,e)},function(){return l(n,i,u,f,e)},null,r):l(n,i,u,f,e))}function l(n,t,i,r,u){if(u()){var f=t.getExtraVerbs?g(n,t.getExtraVerbs(i),!1):n;f[0]==p&&f.shift();r(f)}}function ir(n,r,u,f,e){return n.map(function(n){var o,s,h,c;if(n.verb){switch(n.verb.toLocaleLowerCase()){case wt:o="PinnedToStart";break;case k:o="PinnedToTaskbar";break;case bt:o="UnpinnedFromStart";break;case d:o="UnpinnedFromTaskbar";break;case pt:s="UninstallConfirmation";o="UninstallationInProgress"}return h=function(i){i();t.RuntimeConfig.AlwaysWide&&o=="UninstallationInProgress"?(r.uninstallationInProgress=!0,e&&e()):o?u.showTemporaryMessage(f.getLocString(o,HitHighlightingParser.removeMarkers(r.text))):u.hideTemporaryMessage();n.verb.toLocaleLowerCase()==k&&f.addItemToPinnedToTaskbar(r.deviceItem.id);n.verb.toLocaleLowerCase()==d&&f.removeItemFromPinnedToTaskbar(r.deviceItem.id)},c=n.icon||i[n.verb.toLocaleLowerCase()],new t.DeviceItemVerbWrapper(n,c,function(i){s&&t.DialogBox?t.DialogBox.show(f.getLocString(s),[{id:null,text:n.displayName,action:function(){return h(i)},selected:!1},{id:null,text:f.getLocString("Cancel"),selected:!0}]):h(i)})}return n})}function kt(n,i,r,u,f,o){if(t.isJumpListSuggestion(i))return t.Promise.safeChain("jumpListItem.getVerbsAsync",function(){return i.jumpListItem.getVerbsAsync()},function(n){return e(tr(n),i,s,u,f,o)},function(){return e([],i,s,u,f,o)},null,n+" "+i.type),!0;var s=n+" "+i.type,h=t.getItemWithFileMetadata(i);return h&&h.canHaveContextMenu?(t.Promise.safeChain("getVerbsAsync",function(){return h.getVerbsAsync()},function(n){return e(nr(r,n),i,s,u,f,o)},function(){return e([],i,s,u,f,o)},null,s),!0):i.getExtraVerbsAsync?(e([],i,s,u,f,o),!0):i.getExtraVerbs?(l([],i,u,f,o),!0):(u&&f([]),!1)}function o(n,t,i){var r=HitHighlightingParser.removeMarkers(n.text),u=r?r.length:0;return n.additionalInfoText&&!i&&(u+=n.additionalInfoText.length),u>(i?di:gi)}function dt(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 gt(n,i){if(n.isHtmlAnswer)return ci;if(n.grid)return(i?t.IconSize_GridLayout:t.IconSize_GridLayout_Medium)+2*u;var r=n.numberOfLines==3?hi:n.numberOfLines==2?si:oi;return n.mainTextWrapsToTwoLines&&(r+=ft),r<ut&&(r=ut),r}function rr(n,i){if(i&&t.uses3lineTemplate(t.getScope(i.type)))return gt({mainTextWrapsToTwoLines:!1,numberOfLines:3,isHtmlAnswer:!1,isSuppressed:n.isSuppressed,grid:!1},!1);if(n.isSuppressed)return 0;var r=fi;return n.hasTwoLines?r+=v+2:n.mainTextWrapsToTwoLines&&(r+=ft),r}function ur(n,i){var r=rt;if(i.typeWithSource&&t.displayedInGridLayout(i.typeWithSource.type)){var u=t.isL2(n),f=Math.ceil(i.suggestions.length/(u?vt:yt)),e=u?et:ot;r+=e*f;r+=2*y}else i.suggestions.forEach(function(n){return r+=rr(n,i.typeWithSource)});return r}function fr(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 g(n,t,i){if(n.length>0&&t.length>0){var r=i?n.concat(p):n;return r.concat(t)}return n.length>0?n:t.length>0?i?[p].concat(t):t:[]}function r(n,i){return n.find(function(n){return t.sameGroup(n.typeWithSource,i)})}function ni(n,i){return n.find(function(n){return t.sameGroup(n.group.typeWithSource,i)})}function ti(n,t){return n.queryToFetch.substring(0,t.queryToFetch.lastIndexOf("\\"))}function ii(n){switch(n){case t.GroupType.TopApps:case t.GroupType.People:return!0}return!1}function er(n,i,r){if(!n.isSearchHomeZI||n.scope==t.Scope.All)return null;if(n.scope==t.Scope.Web){if(r==t.GroupType.Websites)return i.getLocString("RecentWebsiteSection");if(r==t.GroupType.SearchSuggestions)return i.getLocString("RecentWebSearchSection")}return ii(r)?i.getLocString("FrequentSection"):i.getLocString("RecentSection")}function ri(n,i,r,u,f){var h,o,e,s,c;if(r==t.GroupType.PathCompletion)return h=ti(n,n)+"\\"+String.fromCharCode(8206),{title:h,narratorText:h};if(u&&(o=u.groupDisplayName,o))return{title:o,narratorText:f?i.getLocString("AddingScopeNarratorText",o):o};if(e=er(n,i,r),!e)switch(r){case t.GroupType.Command:e=i.getLocString("CommandGroup");break;case t.GroupType.Cortana:e=i.getLocString("CortanaGroup");break;case t.GroupType.Store:e=i.getLocString("StoreGroup");break;case t.GroupType.LocalPlaces:e=i.getLocString("LocalPlacesGroup");break;case t.GroupType.Related:e=i.getLocString("RelatedSuggestionsGroup");break;case t.GroupType.SearchSuggestions:e=t.getWebSuggestionsGroupHeader(i,t.msbEnabledForQuery(n));break;case t.GroupType.Websites:e=t.getWebsitesGroupHeader(i);break;case t.GroupType.Contact:e=i.getLocString("ContactGroup");break;case t.GroupType.LocalSearchHistory:e="Search history";break;case t.GroupType.ActivityFeedSuggestions:e=i.getLocString("RecentActivitiesSection");break;case t.GroupType.TopApps:e=t.config.topAppsNotInTaskbar?i.getLocString("TopAppsNoTaskBarTitle"):t.shouldEnableTopSites(t.getCurrentLanguage())?i.getLocString("TopSitesSection"):i.getLocString("TopAppsSection");break;case t.GroupType.QuickSearch:e=t.shouldEnableTrendingSearches(i.getLanguage().toLowerCase())?i.getLocString("TrendingSearchSuggestionsSection"):i.getLocString("QuickSearchSuggestionsSection");break;case t.GroupType.LockscreenQuickSearch:e=i.getLocString("LockscreenQuickSearchSection");break;case t.GroupType.WelcomeExperience:e=i.getLocString("WelcomeExperienceTitle");break;case t.GroupType.PromoBanner:e=i.getLocString("WhatsHappening");break;case t.GroupType.Upsell:e=i.getLocString("RecommendedGroup")}if(!e){if(s=t.getScope(r),s==t.Scope.All)throw new Error("Unknown group type: "+r);t.config.newFilesScope2&&r==t.GroupType.Documents&&(s=t.Scope.AllFiles);c=t.ScopeConfig[s];e=t.getScopeDisplayName(c,i)}return{title:e,narratorText:f?i.getLocString("AddingScopeNarratorText",e.toLocaleLowerCase()):e}}var nt=4,tt=6,a=8,u=12,it=1,f=20,v=16,fi=f+2*a,rt=16+2*a,ei=rt,ut=60,oi=f+2*u,si=f+v+nt+2*u,hi=f+2*(v+nt)+2*u,ci=80+2*u,li=a,ft=f,ai=48,y=1,et=t.IconSize_GridLayout+2*(tt+it),ot=t.IconSize_GridLayout_Medium+2*(tt+it),vi=32,yi=8,pi=140,wi=156,st=8,bi=48,ht=8,ct=12,lt=10,ki=72,at=200,vt=3,yt=4,di=39,gi=42,s=SearchAppWrapper.CortanaApp,p={},w="runas",b="tabletmode_opennewwindow",pt="tile.uninstall",wt="startpin",k="taskbarpin",bt="startunpin",d="taskbarunpin",h=[{id:"FlyoutNextButton",selected:!1,text:null},{id:"FlyoutButton",selected:!1,text:null},{id:"FlyoutDismissFooterButton",selected:!1,text:null},{id:"flyoutDismissIcon",selected:!1,text:null}],c={id:"SearchBox",selected:!1,text:"SearchBox"},i={},ui;i[w]={content:"&#xE7EF",type:1};i.runasuser={content:"&#xE7EE",type:1};i.openinbrowser={content:"&#xE774",type:1};i.openfilelocation={content:"&#xE838",type:2};i.opencontaining={content:"&#xE838",type:2};i[b]={content:"&#xE8A7",type:2};i[bt]={content:"&#xE77A",type:1};i[d]={content:"&#xE77A",type:1};i[wt]={content:"&#xE718",type:2};i[k]={content:"&#xE718",type:2};i.settings={content:"&#xE713",type:2};i.manage={content:"&#xE912",type:1};i.review={content:"&#xE728",type:2};i.share={content:"&#xE72D",type:1};i.connectnetworkdrive={content:"&#xE8CE",type:1};i.disconnectnetworkdrive={content:"&#xE8CD",type:1};i.uninstall={content:"&#xE74D",type:2};i[pt]={content:"&#xE74D",type:2};i.itemproperties={content:"&#xF106",type:2};t.config.extraActions&&(i.copy={content:"&#xE8C8",type:1},i.print={content:"&#xE749",type:1},i.edit={content:"&#xE70F",type:2},i.shelledit={content:"&#xE70F",type:2},i["3d edit"]={content:"&#xE70F",type:2},i.properties={content:"&#xE946",type:2});t.extendVerbs=ir;t.getVerbsAsync=kt;t.wrapsToTwoLines=o;t.joinVerbs=g;t.getGroupTitleAndNarratorText=ri;ui=function(i){function u(r,u,f,e,o,h,c,l,a,v){var y=i.call(this,r,f,e,h)||this;return y._host=r,y._autoComplete=u,y._navigationHelper=o,y._headerFooterViewModel=c,y._previewPane=l,y._menuFactory=a,y._upsellViewModel=v,y._pendingSubmitSequenceNumber=-1,y._pendingSubmitModifierKeys=null,y._pendingSubmitTimeStamp=null,y._resultsCounter={topResults:[],groups:[]},y._pendingSuggestionsInExistingGroups=[],y._pendingSuggestionsInMissingGroups=[],h.setSuggestionClickHandler(y.doubleClickGuardedHandler(function(t,i){n.safeExecute(function(){return y.click(n.getCurrentTime(),t,n.getInputType(i),null)},"suggestionClickHandler")})),h.setContextMenuHandler(function(t,i){n.safeExecute(function(){return y._menuFactory.showContextMenuOnXY(t,i.pageX,i.pageY,function(){return y._host.setFocusInSearchBox(null,"contextMenuDismiss")})},"contextMenuHandler")}),h.setOpenPreviewPaneClickHandler(function(t,i){n.safeExecute(function(){return y.openPreviewPane(t,i)},"openPreviewPaneClickHandler")}),h.setExpanderClickInstrumentation(function(n,t,i){var r="Expander"+(i?"Opened":"Closed"),u={st:t,K:n.instItem.getLayoutKValue()};y._instrumentationHelper.logClientInstEvent("Select",r,null,u)}),y._previewPane&&(y._previewPane.init(y),y._previewPane.bindBeforeItemLaunch(function(n,t,i,r,u,f){return y._instrumentationHelper.instrumentItemClickForPreviewPane(n,t.instItem,t.sequenceNumber,t.instrumentPingBack,i,null,r,u,f)}),y._previewPane.bindAfterItemLaunch(function(n,t,i){return y.onSuggestionLaunch(n,t,i)})),r.bindShown(function(){!t.isMobileCache&&s.queryFormulationView.deviceSearch.getSearchServiceStatusAsync&&t.Promise.safeChain("getSearchServiceStatusAsync",function(){return s.queryFormulationView.deviceSearch.getSearchServiceStatusAsync()},function(n){y._instrumentationHelper.setSearchServiceStatus(fr(n));n!=0&&n!=4&&n!=3&&n!=7&&y.showIndexingMessage(!1)})}),h.bindOnNarratorLaunch(function(t){for(var i,f=n.getCurrentTime(),e=y.getSelectableItems(),r=0,u=e;r<u.length;r++)if(i=u[r],i.id==t){y.isSuggestionOrGroup(i)?(y.select(i,!1),y.submit(f,!1,i.sequenceNumber,null,!0)):y._headerFooterViewModel.isScopeElement(i)&&_ge(i.id).click();break}}),r.bindSearchBoxGotFocus(function(){y._menuFactory.dismiss();var t=n.getCurrentActiveElement();t&&t.blur();y._selectedItem&&!y._headerFooterViewModel.isScopeElement(y._selectedItem)&&y.renderSelectedSuggestionState(!1)}),r.bindSearchBoxLostFocus(function(){var i=t.isScopeTile(n.getCurrentActiveElement());i?n.safeSetTimeout(function(){y._host.searchBoxHasFocus()||y._headerFooterViewModel.isScopeElement(y._selectedItem)||y.renderSelectedSuggestionState(!0)},75,"RootViewModel.bindSearchBoxLostFocus"):y.renderSelectedSuggestionState(!0)}),sj_evt.bind("CortanaPaneWidthSet",function(n){return y.onPaneWidthSet(n[1])}),sj_be(_ge("qfContainer"),"scroll",function(){return y._menuFactory.dismiss()}),y}return __extends(u,i),u.prototype.onDismiss=function(){i.prototype.onDismiss.call(this);this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this.toggleProgressBar(!1);this._menuFactory.dismiss();this._previewPane&&t.RuntimeConfig.PreviewPaneAvailable&&this._previewPane.dismiss();this._page.hideTemporaryMessage();this.hideIndexingMessage();t.DialogBox&&t.DialogBox.hide();this._headerFooterViewModel.render(null,!1,!1,!1,!0);t.config.glyphInSearchBox&&this._host.setSearchBoxGlyphIcon()},u.prototype.onPaneWidthSet=function(n){yt=Math.floor((n-2*y)/ot);vt=Math.floor((n-2*y)/et)},u.prototype.setSelectedStyleSuspended=function(n,t){n.selectedStyleSuspended=t&&this._host.isRequestFocusAvailable()},u.prototype.renderSelectedSuggestionState=function(n){this._selectedItem&&(this.setSelectedStyleSuspended(this._selectedItem,n),this.renderSelection(this._selectedItem))},u.prototype.toggleProgressBar=function(i){var r=this;t.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),i?(this._partialQuery.showProgressBar||this._partialQuery.queryToFetch=="")&&(this._progressTimer=n.safeSetTimeout(function(){r._progressTimer&&(r._page.setProgressIndicatorVisibility(!0),r._progressTimer=null)},250,"showProgress")):t.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),this._page.setProgressIndicatorVisibility(!1)))},u.prototype.resetPendingSubmitSequenceNumber=function(){this._pendingSubmitSequenceNumber=null;this._pendingSubmitModifierKeys=null;this._pendingSubmitTimeStamp=null},u.prototype.onAfterKeyDown=function(i,r,u,f){var o,e,y,p,s,c,w,b,a,v,l,k;if(!this._partialQuery||!this._menuFactory.isMenuVisible()&&i==13)return!1;if(this._partialQuery.inorganic=!1,o=r&&r.shiftKey,t.DialogBox&&t.DialogBox.isVisible())return i!=9||f||this.handleCrossViewModelsTabKeyNavigation(null,o),!0;if(e=this._previewPane&&this._previewPane.hasFocus(),y="rvm onAfterKeyDown",this._page.hideTemporaryMessage(),this.resetPendingSubmitSequenceNumber(),!u&&n.isContextMenuKey(i,o)&&!e)return this.tryShowContextMenuOnSelectedSuggestion(),!0;if(this._menuFactory.isMenuVisible()){if(i==37||i==39||i==13||n.isUpOrDownKey(i)){if(p=this._menuFactory.onAfterKeyDown(i,r,u,f),p)return!0;if(n.isUpOrDownKey(i))return!1}this._menuFactory.dismiss(!0)}if(t.RuntimeConfig.QfMode==5&&i==46)return(s=this._selectedItem,s&&s.removeIcon)?(s.removeIcon.click(n.getCurrentTime(),1),!0):!1;if(c=n.getCurrentActiveElement(),!t.isScopeTile(c)||e||this._menuFactory.isMenuVisible()||i!=39&&i!=37){if(i==9)t.config.allowTabToSelectSuggestions||o||!this._selectedItem||e||this._headerFooterViewModel.isScopeElement(this._selectedItem)?f||this.handleCrossViewModelsTabKeyNavigation(c,o):this.select(this._headerFooterViewModel.getSelectableItems()[0],!1);else if(t.RuntimeConfig.PreviewPaneAvailable&&this._previewPane&&this._selectedItem&&!this._headerFooterViewModel.isScopeElement(this._selectedItem)){this._previewPane.onAfterKeyDownWhenNewSelection(i,this._partialQuery,this._selectedItem);if(e)return!0}}else w=t.getRtlAdjustedKey(i),this._headerFooterViewModel.focusNextScopeTile(c,w==39),b=this._headerFooterViewModel.getSelectableItems(),this.select(b[0],!1);return e=this._previewPane&&this._previewPane.hasFocus(),this._selectedItem&&(n.isUpOrDownKey(i)||i==9)&&!e&&(a=this._headerFooterViewModel.isScopeElement(this._selectedItem),a||this._selectedItem==this.topResults[0]?this._page.scrollToTop():this._page.scrollTo(this._selectedItem),v=y+"-AdjustFocus",a||this.isAdvancedOption(this._selectedItem)||this.isFlyout(this._selectedItem)?(this.isAdvancedOption(this._selectedItem)?_ge(this._selectedItem.id).querySelector("input").focus():_ge(this._selectedItem.id).focus(),this._host.searchBoxHasFocus()&&this._host.setFocusInWebView(v)):i!=9&&this._host.searchBoxHasFocus()||this._host.setFocusInSearchBox(i,v)),t.config.forceTypedQueryOnTopSupported&&i==46&&this._partialQuery&&this._selectedItem&&this._selectedItem===this.topResults[0]&&this.topResults[0].query.toLocaleLowerCase()!=this._partialQuery.queryToFetch.toLocaleLowerCase()&&(l=this._host.getQuery(),l.originalQuery==this._partialQuery.originalQuery&&(k=l.originalCursorPosition==l.originalQuery.length,k&&this._host.reformulate(this._partialQuery.originalQuery,null,1))),this.isFlyoutVisible()&&h.indexOf(this._selectedItem)>=0&&(i==39?this.selectNextFlyoutItem(1):i==37&&this.selectNextFlyoutItem(-1)),!1},u.prototype.isFlyoutVisible=function(){return t.config.EnableEducationalFlyout&&!_ge("flyoutContainer").classList.contains("b_hide")},u.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()}},u.prototype.handleCrossViewModelsTabKeyNavigation=function(i,r){var v=this,y=t.RuntimeConfig.PreviewPaneAvailable&&!!this._previewPane,s=y&&this._previewPane.isOpened(),p=s&&this._previewPane.hasFocus(),e,h,f,a,u,c,l,o;t.DialogBox&&t.DialogBox.isVisible()?(e=t.DialogBox.getSelectableItemsByGroup(),r?this.select(e[e.length-1][0],!1):this.select(e[0][0],!1)):p?r?(this._previewPane.blur(),h=this._headerFooterViewModel.getSelectableItemsByGroup(),o=h[h.length-1][0],this.select(o,!1)):(this._previewPane.blur(),u=this.getSelectableItems(),this.select(u[0],!0)):t.isScopeTile(i)?!s||r?(f=this.getSelectableSuggestionsByGroup(!0),f.length>0?(a=r?f[f.length-1][0]:f[0][0],this.select(a,!0)):(u=this.getSelectableItems(),u.length>0?this.select(u[0],!0):this.select(null,!0)),c="handleCrossBordersNavigationWithTab",n.safeSetTimeout(function(){return v._host.setFocusInSearchBox(9,c)},0,c)):(this.select(this._previewPane.getPreviewedSuggestion(),!0),this._previewPane.focus(!0)):this._selectedItem?r?s?this._previewPane.focus():(l=this.getSelectableItemsByGroup(),o=l[l.length-1][0],this.select(o,!1)):this.select(this.getSelectableItemsByGroup()[0][0],!1):this.select(this.getSelectableItemsByGroup()[0][0],!1)},u.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 i._host.setFocusInSearchBox(null,"contextMenuDismiss")})},"contextMenuHandler")},u.prototype.onQueryChanged=function(r,u){var c=this,l,e,p,w,b,o,s,a,v,h,y,f;if(t.DialogBox&&t.DialogBox.hide(),this._menuFactory.dismiss(),!this._partialQuery||!this._partialQuery.equals(r)){if(this._page.hideTemporaryMessage(),t.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),r.showProgressBar?this._progressTimer=n.safeSetTimeout(function(){c._progressTimer&&(c._page.setProgressIndicatorVisibility(!0),c._progressTimer=null)},250,"showProgress"):this._page.setProgressIndicatorVisibility(!1)),this._partialQuery&&this._partialQuery.scope!=r.scope&&(this._turnOnIndexingInstItem||this.hideIndexingMessage()),l=this._partialQuery?this._partialQuery.queryToFetch:"",e=r.queryToFetch,this._previewPane&&t.RuntimeConfig.PreviewPaneAvailable)this._previewPane.onQueryChanged(r);for(p=this._partialQuery?this._partialQuery.scope:t.Scope.All,i.prototype.onQueryChanged.call(this,r,u),w=t.config.glyphInSearchBox==1,w&&r.scope!=p&&(b=t.ScopeConfig[r.scope],r.scope==t.Scope.All?this._host.setSearchBoxGlyphIcon():this._host.setSearchBoxGlyphIcon(b.icon)),o=!1,s=0,a=this.topResults;s<a.length;s++)f=a[s],f.updateFromQuery&&!f.hasPreviewPaneOpened?f.updateFromQuery(r)&&(o=!0):e.length>l.length&&e.startsWith(l)&&f.query.toLowerCase().includes(r.queryToFetch.toLowerCase())&&(v=f.text.indexOf(HitHighlightingParser.endMarker),v>=0&&v<f.text.length-1&&(f.text=HitHighlightingParser.addMarkers(HitHighlightingParser.removeMarkers(f.text),e),o=!0));if(o){for(h=0,y=this.topResults;h<y.length;h++)f=y[h],f.sequenceNumber=u,this.updateNarratorWithPreviewMessage(f);this.renderTopResults()}}},u.prototype.onSuggestionsParsed=function(n,i,r,u,f){var s=n.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"||n.scope!=t.Scope.All)&&t.RuntimeConfig.ScopesAvailable&&n.scope!=t.Scope.Web&&this.showIndexingMessage(!0)},u.prototype.areSuggestionsPresent=function(){return this.topResults.length>0||this.groups.length>0&&this.groups.some(function(n){return n.suggestions.length>0})},u.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},u.prototype.getSelectableItems=function(){var n,i,u,r;if(t.DialogBox&&t.DialogBox.isVisible())return t.DialogBox.getSelectableItems();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItems();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItems();for(n=[],n.push.apply(n,this.topResults),i=0,u=this.groups;i<u.length;i++)r=u[i],r.click&&n.push(r),n.push.apply(n,r.suggestions.filter(function(n){return!n.suppressed}));return this.areSuggestionsPresent()||n.push(c),t.config.allowUpForScopes&&n.push.apply(n,this._headerFooterViewModel.getSelectableItems()),n},u.prototype.getSelectableSuggestionsByGroup=function(n){if(t.config.allowTabToSelectSuggestions){var i=[];return i.push(this.topResults),this.groups.forEach(function(n){n.click&&i.push([n]);i.push(n.suggestions.filter(function(n){return!n.suppressed}))}),n||i.push(this._headerFooterViewModel.getSelectableItems()),i.filter(function(n){return n.length>0})}return[]},u.prototype.getSelectableItemsByGroup=function(){if(t.DialogBox&&t.DialogBox.isVisible())return t.DialogBox.getSelectableItemsByGroup();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItemsByGroup();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItemsByGroup();var n=[];return this.isFlyoutVisible()&&n.push([h.find(function(n){return!!_ge(n.id)})]),n.push.apply(n,this._headerFooterViewModel.getSelectableItemsByGroup()),this.areSuggestionsPresent()?n.push.apply(n,this.getSelectableSuggestionsByGroup(!0)):n.push([c]),n},u.prototype.getSelectedItem=function(){return t.DialogBox&&t.DialogBox.isVisible()?t.DialogBox.getSelectedItem():this._menuFactory.isMenuVisible()?this._menuFactory.getSelectedItem():this._previewPane&&this._previewPane.hasFocus()?this._previewPane.getSelectedItem():this._selectedItem?this._selectedItem:c},u.prototype.updateSelectionState=function(t){n.contains(this.topResults,t)?this.renderTopResults():this.groups.some(function(i){return n.contains(i.suggestions,t)})&&this.renderGroups()},u.prototype.renderSelection=function(i,r){(i&&this.isSuggestion(i)&&n.contains(this.topResults,i)||r&&this.isSuggestion(r)&&n.contains(this.topResults,r))&&this.renderTopResults();(i&&this.isAdvancedOption(i)||r&&this.isAdvancedOption(r))&&this._headerFooterViewModel.updateTopHitHeader();(i&&t.isGroup(i)&&n.contains(this.groups,i)||i&&this.isSuggestion(i)&&this.groups.some(function(t){return n.contains(t.suggestions,i)})||r&&t.isGroup(r)&&n.contains(this.groups,r)||r&&this.isSuggestion(r)&&this.groups.some(function(t){return n.contains(t.suggestions,r)}))&&this.renderGroups()},u.prototype.renderGroups=function(n){var r=this._partialQuery.isSearchHomeZI?t.config.maxSuggestionsPerGroupZI:t.config.maxSuggestionsPerGroup;r>0&&this.groups.forEach(function(n,t,i){i[t].suggestions=n.suggestions.slice(0,r)});i.prototype.renderGroups.call(this,n)},u.prototype.select=function(i,r){var u,e,f;t.DialogBox&&t.DialogBox.isVisible()?t.DialogBox.select(i):this._menuFactory.isMenuVisible()&&n.contains(this._menuFactory.getSelectableItems(),i)?this._menuFactory.select(i,!1):this._previewPane&&n.contains(this._previewPane.getSelectableItems(),i)?this._previewPane.select(i,!1):(u=this._selectedItem,u&&(u.selected=!1,this.setSelectedStyleSuspended(u,!1)),i==c?(this._selectedItem=null,this._host.searchBoxHasFocus()||this._host.setFocusInSearchBox(null,"rvm_select")):(this._selectedItem=i,i&&(i.selected=!0,this.setSelectedStyleSuspended(i,!this._host.searchBoxHasFocus()))),this.renderSelection(this._selectedItem,u),e=t.config.glyphInSearchBox==2,e&&this.setSearchBoxGlyphIcon(i),this._headerFooterViewModel.isScopeElement(i)&&this._headerFooterViewModel.select(i,!1),r&&(t.config.dontUpdateSB&&i.handoffType!=0?this._host.updateQueryWithoutRefetching(null):(f=i?i.query:null,f&&this._partialQuery.scopePrefix&&(f=this._partialQuery.scopePrefix.trim()+": "+f),this._host.updateQueryWithoutRefetching(f))))},u.prototype.setSearchBoxGlyphIcon=function(i){var u,r,f,e;i&&(r=i.icon,r&&n.contains([2,1],r.type)?u=r:(f=t.isGroup(i)?i.typeWithSource.type:this.isSuggestion(i)?t.getGroupType(i):null,f!=null&&(e=t.getScope(f),u=e==t.Scope.All?null:t.ScopeConfig[e].icon)));this._host.setSearchBoxGlyphIcon(u)},u.prototype.renderTopResultsToUpdateIcons=function(){var i=this;t.config.delayRenderingForIcons?this._renderTopResultsTimerForIcons||(this._renderTopResultsTimerForIcons=n.safeSetTimeout(function(){i._renderTopResultsTimerForIcons=null;i.renderTopResults()},at,"renderTopResultsToUpdateIcons")):this.renderTopResults()},u.prototype.renderGroupsToUpdateIcons=function(){var i=this;t.config.delayRenderingForIcons?this._renderGroupsTimerForIcons||(this._renderGroupsTimerForIcons=n.safeSetTimeout(function(){i._renderGroupsTimerForIcons=null;i.renderGroups()},at,"renderGroups")):this.renderGroups()},u.prototype.setupIcon=function(i,r,u,f){var e=this,o;if(!r.suppressed&&r.getIcon)this._instrumentationHelper.notifyIconPending(i,u,r.instItem.getLayoutKValue(),r.type),o=this._partialQuery,r.getIcon(this.getImageSize(o,r,u),function(o){r.icon=o;var s=function(){e._partialQuery&&i==e._sequenceNumberReader.getSequenceNumber()&&(e._instrumentationHelper.notifyIconReady(i,u,r.instItem.getLayoutKValue(),r.type),u?n.contains(e.topResults,r)&&e.renderTopResultsToUpdateIcons():e.groups.some(function(t){return n.contains(t.suggestions,r)})&&e.renderGroupsToUpdateIcons(),f())};t.populateImageRatio(r.icon,r.type,s)});else if(!r.suppressed&&r.icon&&n.canIconFail(r.icon)){this._instrumentationHelper.notifyIconPending(i,u,r.instItem.getLayoutKValue(),r.type);var s=r.icon.getFallbackIcon,h=function(n,t){return t(r.icon)},c=r.icon.isValidSize,l=function(){r.getIcon=s;e.setupIcon(i,r,u,f)},a=function(){r.icon.isSmall=!0;r.getIcon=h;e.setupIcon(i,r,u,f)};r.icon.onIconError=l;r.icon.onIconRendered=function(n,t){c(n,t)?(e._instrumentationHelper.notifyIconReady(i,u,r.instItem.getLayoutKValue(),r.type),f()):a()};u?this.renderTopResultsToUpdateIcons():this.renderGroupsToUpdateIcons()}else f()},u.prototype.getImageSize=function(n,i,r){return n.isSearchHomeZI?i.type=="TOPL"?7:i.type=="AFC"?6:8:n.scope==t.Scope.Apps&&!n.queryToFetch?3:t.displayedInGridLayout(i.type)?2:r?0:1},u.prototype.isSuggestionOrGroup=function(n){return!this._headerFooterViewModel.isScopeElement(n)},u.prototype.isSuggestion=function(n){return!t.isGroup(n)&&!this._headerFooterViewModel.isScopeElement(n)&&!this.isAdvancedOption(n)},u.prototype.isAdvancedOption=function(n){return typeof n.layout=="number"},u.prototype.isFlyout=function(n){return this.isFlyoutVisible()&&h.indexOf(n)>=0},u.prototype.submit=function(i,r,u,f,e){var h=e?5:r?6:1,c=n.getCurrentActiveElement(),o,s,l;if(t.DialogBox&&t.DialogBox.isVisible()){t.DialogBox.submit();return}if(this._previewPane&&this._previewPane.hasFocus()){if(o=this._previewPane.getSelectedItem(),o&&o.click&&o.optionType===undefined){o.click(i,h);return}}else{if(this._selectedItem&&this._headerFooterViewModel.isScopeElement(this._selectedItem)&&!this._menuFactory.isMenuVisible()){_ge(this._selectedItem.id).click();return}if((t.RuntimeConfig.QfMode==5||t.RuntimeConfig.QfMode==9)&&!this._selectedItem){this._host.submitFileExplorerTextSuggestion(this._partialQuery.queryToFetch);return}}if(s=this._menuFactory.getSelectedItem(),s){s.click&&s.click(i,h,f);return}if(l=!t.isBodyOrSuggestion(c),l){this._host.isRequestFocusAvailable()||c.click();return}if(this._lastUpdatedSequenceNumber!=u&&(!this._selectedItem||this._selectedItem==this.topResults[0])){this._pendingSubmitSequenceNumber=u;this._pendingSubmitModifierKeys=f;this._pendingSubmitTimeStamp=i;return}this._selectedItem?this.click(i,this._selectedItem,h,f):this.groups.length>0&&this._partialQuery.fullPartialQuery&&this.showDisableEnterMessage()},u.prototype.doubleClickGuardedHandler=function(t){var i;return function(r,u){i&&n.getCurrentDate().getTime()-i<=250||(i=n.getCurrentDate().getTime(),t(r,u))}},u.prototype.click=function(n,i,r,u){if(this._page.hideTemporaryMessage(),this.isAdvancedOption(i)){i.click&&i.click(n,r,u);return}var f=t.isGroup(i)?null:i;if(!i.instItem||f&&f.isReformulation||this._instrumentationHelper.instrumentItemClick(n,i.instItem,i.sequenceNumber,f?f.instrumentPingBack:null,r,u),!f){i.click&&i.click(n,r,u);return}u=u||this._host.getModifierKeyState();u.ctrlKey&&u.shiftKey?this.launchVerb(f,w,n):u.shiftKey?this.launchVerb(f,b,n):f.click(n,r,u);this.onSuggestionLaunch(f,this._partialQuery)},u.prototype.onSuggestionLaunch=function(n,r,u){t.isChildSuggestion(n)&&(n=n.parent);i.prototype.onSuggestionLaunch.call(this,n,r,u)},u.prototype.launchVerb=function(i,r,u){var f=kt("launchVerb",i,t.config.rawVerbs,!1,function(f){for(var h,c,o=!1,l=function(i){if(i.verb&&i.verb.toLocaleLowerCase()==r.toLocaleLowerCase())return i.executeSync?n.safeExecute(function(){return i.executeSync()},"verb.executeSync",null,r):t.Promise.safeChain("verb.executeAsync",function(){return i.executeAsync()},null,null,null,r),o=!0,"break"},e=0,s=f;e<s.length;e++)if(h=s[e],c=l(h),c==="break")break;o||i.click(u,0)},function(){return!0});f||i.click(u,0)},u.prototype.getGroupHeaderClickAction=function(i,r,u){var e=this,f,s,h,c,o,l,a;if(t.RuntimeConfig.QfMode==8)return[null,null,null,null,null];if(h=null,c=null,t.RuntimeConfig.ScopesAvailable&&(o=t.getScope(r.type),o!=t.Scope.All))if((t.config.newFilesScope1||t.config.newFilesScope2)&&t.isFileOrFolderScope(o)&&(o=t.Scope.AllFiles),r.type==t.GroupType.SearchSuggestions&&i.isSearchHomeZI)s=this._host.getLocString("OpenPrivacyPortalButtonText"),h=this._host.getLocString("ManageSearchHistory"),f=function(){return e._host.launchPrivacyPortal()};else return t.isL2(i)||!t.isScopeEnabled(o,t.ScopeConfig[o])?[null,null,null,null,null]:(l=function(){return e._headerFooterViewModel.clickHandler(o,"groupHeader",r)},[l,null,null,null,null]);if(!f)switch(r.type){case t.GroupType.Store:f=function(){return e._host.launchStoreSearch(i.queryToFetch)};break;case t.GroupType.SearchSuggestions:f=function(){return e.launchSearch(i,u)};break;case t.GroupType.PathCompletion:f=function(){return e._host.launchFolder(ti(i,e._partialQuery))};break;case t.GroupType.TopApps:t.config.getPopularApps&&(s=this._host.getLocString("GetPopularApps"),f=function(){return e._host.launchUri(t.config.getPopularAppsUrl)});break;case t.GroupType.ActivityFeedSuggestions:s=this._host.getLocString("OpenTimelineButtonText");h=this._host.getLocString("ManageActivityFeed");f=function(){return e._host.launchUri("ms-taskswitcher://?invoketo=timeline")};break;case t.GroupType.Upsell:t.config.enableEdgeUpsellTop&&!i.isSearchHomeZI||(c={content:"&#xE711",type:2},s=this._host.getLocString("DismissUpsell"),h=this._host.getLocString("DismissUpsell"),f=this._upsellViewModel.getDismissButtonAction(i));break;case t.GroupType.PromoBanner:c={content:"&#xE711",type:2};s=this._host.getLocString("DismissUpsell");h=this._host.getLocString("DismissUpsell");f=function(){return e.dismissPromo()}}if(f){if(!u)throw"No QS code for: "+t.GroupType[r.type];return a=n.InstrumentedItem.getNonSuggestionInstrumentedItem(u,t.SyntheticQSCodesMaps.KValues),[f,a,s,h,c]}return[null,null,null,null,null]},u.prototype.shouldShowPlusIconInGroupHeader=function(n,i){if(t.getScope(n)==t.Scope.Web||n==t.GroupType.Store)return!1;if(n==t.GroupType.Apps&&this._partialQuery.queryToFetch.length<t.config.minLengthForIBAonL1)return!0;if(n==t.GroupType.Apps||n==t.GroupType.Settings){var r=i[n==t.GroupType.Apps?"PP":"ST"];return!(r&&r.maxedOut)}return!0},u.prototype.addGroup=function(n,i,u,f,e){var o,a;if(r(this.groups,n))throw new Error("Trying to add repeated group "+n);var v=t.GroupHeaderQSCodes[n.type],s=this.getGroupHeaderClickAction(this._partialQuery,n,v),h=s[0],c=s[1],y=s[2],w=s[3],p=s[4],l=ri(this._partialQuery,this._host,n.type,i,!!h);return n.source&&(l.title+=" - "+t.getGroupSourceDisplayName(n.source,this._host)),o=[],t.isTopHitChildGroup(n)?o.push("topHitConnectedToGroup"):n.type==t.GroupType.TopApps||this._partialQuery.isSearchHomeZI&&n.type==t.GroupType.People?o.push("topItemsGroup"):n.type==t.GroupType.ActivityFeedSuggestions?o.push("activityFeedGroup"):n.type==t.GroupType.QuickSearch?o.push("balloonSuggGroup"):n.type==t.GroupType.LockscreenQuickSearch?o.push("lockscreenQuickSuggGroup"):n.type==t.GroupType.WelcomeExperience?o.push("welcomeExperience"):n.type==t.GroupType.PromoBanner?o.push("promoSuggGroup"):n.type==t.GroupType.Upsell?o.push("upsellSuggGroup"):t.RuntimeConfig.QfMode==8&&(n.type==t.GroupType.Apps?o.push("appsGroup"):(n.type==t.GroupType.Documents||n.type==t.GroupType.Photos||n.type==t.GroupType.Videos||n.type==t.GroupType.Folders)&&o.push("filesGroup")),a={type:n.type,typeWithSource:n,id:"gr"+n.type+(n.source||""),text:l.title,secondaryText:y,secondaryIcon:p,narratorText:l.narratorText,tooltip:w,click:h,onlyAnnotationIsClickable:h&&(!!y||!!p),suggestions:[],instRegionName:t.GroupType[n.type],instItem:c,selected:!1,cssClasses:o.join(" ")||undefined,sequenceNumber:u,showPlusIconInHeader:this.shouldShowPlusIconInGroupHeader(n.type,e),hideGroupHeader:n.type===t.GroupType.TopApps&&t.shouldEnableWeatherTile(t.getCurrentLanguage())},c&&this._instrumentationHelper.instrumentSyntheticInstrumentedItem(u,v,c),this._resultsCounter.groups.push({typeWithSource:n,suggestions:[]}),this.insertGroup(a,f),a},u.prototype.insertGroup=function(n,i){for(var f,e=this,o=i.findIndex(function(i){return t.sameGroup(i,n.typeWithSource)}),u=!1,s=function(r){var f=i.findIndex(function(n){return t.sameGroup(n,e.groups[r].typeWithSource)});if(f>o)return h.groups.splice(r,0,n),u=!0,"break"},h=this,r=0;r<this.groups.length;r++)if(f=s(r),f==="break")break;u||this.groups.push(n)},u.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,w,this._pendingSubmitTimeStamp):this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(t,b,this._pendingSubmitTimeStamp):t.click(this._pendingSubmitTimeStamp,0,this._pendingSubmitModifierKeys),0}}finally{this.resetPendingSubmitSequenceNumber()}return 1},u.prototype.showDisableEnterMessage=function(){this._page.showTemporaryMessage(this._host.getLocString("EnterOnAmbiguousTopHitMessageText"))},u.prototype.showIndexingMessage=function(i){var r=this,u,f;t.isMobileCache||(i?this._turnOnIndexingInstItem=null:(this._turnOnIndexingInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMIO",t.SyntheticQSCodesMaps.KValues),u={id:null,selected:null,text:this._host.getLocString("WindowsIndexingDisabledAction"),title:null,instItem:this._turnOnIndexingInstItem,click:function(n,i){var u=r._sequenceNumberReader.getSequenceNumber();u>r._lastUpdatedSequenceNumber&&r._instrumentationHelper.instrumentSyntheticInstrumentedItem(u,"IMIO",r._turnOnIndexingInstItem);r._instrumentationHelper.instrumentItemClick(n,r._turnOnIndexingInstItem,u,null,i,null);t.LocalDataProvider.launchIndexingOptions(r._host,!1)},layout:1,isSelectable:!0}),f={messageText:i?this._host.getLocString("WindowsIndexingInProgressMessage"):this._host.getLocString("WindowsIndexingDisabledMessage"),title:i?this._host.getLocString("WindowsIndexingInProgressToolTip"):this._host.getLocString("WindowsIndexingDisabledToolTip"),action:u},this._page.updateIndexingMessageView(f))},u.prototype.hideIndexingMessage=function(){t.isMobileCache||(this._turnOnIndexingInstItem=null,this._page.updateIndexingMessageView(null))},u.prototype.getAvailableSpace=function(n){var r=this,i;return t.isL2(this._partialQuery)&&this._partialQuery.queryToFetch?Number.MAX_VALUE:(i=this._page.getSuggestionsContainerHeight(),t.config.extraTopPadding&&!t.RuntimeConfig.SearchBoxOnTop&&(i-=t.config.extraTopPadding),t.RuntimeConfig.ScopesAvailable&&(i-=ai),n.topResults.length==0||t.RuntimeConfig.FlatListWithoutGroups||(i-=ei),n.topResults.forEach(function(n){return i-=gt(n,t.isL2(r._partialQuery))}),n.groups.forEach(function(n){return i-=ur(r._partialQuery,n)}),n.groups.some(function(n){return n.typeWithSource&&t.isTopHitChildGroup(n.typeWithSource)})&&n.groups.some(function(n){return n.typeWithSource&&!t.isTopHitChildGroup(n.typeWithSource)})&&(i-=li),i)},u.prototype.getAvailableSpaceForZeroInputHomeTopSection=function(n,i){var r=this._page.getSuggestionsContainerWidth(),u,f;return r-=t.RuntimeConfig.AlwaysWide?vi:yi,r-=st,u=n?n.suggestions.filter(function(n){return n&&!n.suppressed}).length:0,u+=i.suppressed?0:1,f=t.RuntimeConfig.AlwaysWide?pi:wi,r-(f+st)*u},u.prototype.canFitSuggestion=function(i,u,f){if(f.suppressed||t.getTweakedSetting("scrollBarInL1"))return!0;var s=dt(this._resultsCounter),e;return i?(e={typeWithSource:u,suggestions:[]},s.groups.push(e)):e=r(s.groups,u),e.suggestions.push({mainTextWrapsToTwoLines:f&&o(f,u.type,!1),isSuppressed:f&&f.suppressed,hasTwoLines:f&&n.contains(f.classNames,"forceNoWrapOutsideTopResult")}),this._partialQuery.isSearchHomeZI?this.canFitSuggestionInZeroInputHome(u,f):this.getAvailableSpace(s)>=0},u.prototype.getBubblesAvaiableWidth=function(){var n=this._page.getSuggestionsContainerWidth();return n-=bi,t.shouldEnableSnipSearch(this._host)&&(n-=ki),n},u.prototype.canFitSuggestionInZeroInputHome=function(n,i){var s=this,u,o,e,f;return i.type==="SNSC"?!0:(u=r(this.groups,n),ii(n.type))?this._partialQuery.scope===t.Scope.All&&t.shouldEnableWeatherTile(t.getCurrentLanguage())?u?u.suggestions.length<=3:!0:this.getAvailableSpaceForZeroInputHomeTopSection(u,i)>=0:n.type===t.GroupType.QuickSearch?(o=t.config.maxQuickSearches+(t.config.resumeSearch?1:0)+(t.shouldEnableSnipSearch(this._host)?1:0),(u?u.suggestions.length:0)>=o)?!1:t.config.searchHomeTwoCols?!0:(e=t.config.trendingSearchTwoRows?2:1,f=this.getBubblesAvaiableWidth(),u&&u.suggestions.forEach(function(n){if(n.type!=="SNSC"){var t=ct+ht+lt*n.text.length;if(f>=t){f-=t;return}f=s.getBubblesAvaiableWidth();e-=1}}),e>1?!0:e===1?f>ct+ht+lt*i.text.length:!1):n.type===t.GroupType.LockscreenQuickSearch?!0:(u?u.suggestions.length:0)<this.getMaxNumberOfRecentItems(n.type)},u.prototype.getMaxNumberOfRecentItems=function(n){if(n===t.GroupType.ActivityFeedSuggestions){var i=t.ScopeConfig[t.Scope.All].enabledDataSourcesForZeroInput,r=i.some(function(n){return n&&n.suggestionGroupToggler&&n.suggestionGroupToggler.isHidden()});if(t.RuntimeConfig.PreviewPaneAvailable&&s.height<640&&t.shouldEnableQuickSearches(this._host.getLanguage().toLowerCase())&&!r&&!t.config.searchHomeTwoCols||t.canShowSearchHomeUpsell()&&s.height<654||t.shouldEnableTrendingSearches(this._host.getLanguage().toLowerCase())&&t.config.trendingSearchTwoRows)return t.config.activityInZI-1}return t.config.activityInZI},u.prototype.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup=function(){var i,r,u,n,f;if(t.isL2(this._partialQuery)&&this._partialQuery.queryToFetch||t.getTweakedSetting("scrollBarInL1"))return Number.MAX_VALUE;if(this._partialQuery.isSearchHomeZI)return t.RuntimeConfig.QfMode==8?4:3;for(i=dt(this._resultsCounter),r=0,u=i.groups;r<u.length;r++)for(n=u[r];n.suggestions.length<t.config.minSuggestionsPerGroup;)n.suggestions.push(n.suggestions[0]);while(this.getAvailableSpace(i)>0){for(n={suggestions:[]},f=0;f<t.config.minSuggestionsPerGroup;++f)n.suggestions.push({mainTextWrapsToTwoLines:!1,isSuppressed:!1,hasTwoLines:!1});i.groups.push(n)}return i.groups.length-1},u.prototype.onSuggestionAddedToGroup=function(i,u){var e=this,f,s;this.updateNarratorWithPreviewMessage(i);t.isChildSuggestion(i)&&(i.displayed=!0,f=i.parent,i.id=f.id+"_"+f.childSuggestions.indexOf(i),t.isJumpListSuggestion(i)&&i.tooltip===undefined&&t.Promise.safeChain("getJumpListDescription",function(){return i.jumpListItem.getDescriptionAsync()},function(t){i.tooltip=t;e.groups.some(function(t){return n.contains(t.suggestions,i)})&&e.renderGroups()}));this.setRemoveIconHistorySuggestions(i);s=r(this._resultsCounter.groups,u.typeWithSource);s.suggestions.push({mainTextWrapsToTwoLines:o(i,u.typeWithSource.type,!1),isSuppressed:i.suppressed,hasTwoLines:n.contains(i.classNames,"forceNoWrapOutsideTopResult")});t.displayedInGridLayout(u.typeWithSource.type)&&u.suggestions.filter(function(n){return!n.suppressed}).length>0&&t.RuntimeConfig.QfMode!=8&&(u.cssClasses+=t.isL2(this._partialQuery)?" gridLayout":" gridLayout gridLayoutMedium")},u.prototype.onGroupsCleared=function(){this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this._resultsCounter.groups=[];this._turnOnIndexingInstItem&&this._instrumentationHelper.instrumentSyntheticInstrumentedItem(this._lastUpdatedSequenceNumber,"IMIO",this._turnOnIndexingInstItem)},u.prototype.dismissPromo=function(){var t=new n.LightweightStorage;t.setItem("PromoCovidDismissed","1");this._host.refreshCurrentPane()},u.prototype.launchSearch=function(n,t){var i=n.queryToFetch;this._host.launchSearch(i,this._navigationHelper.getSearchUrl(n.fullPartialQuery,i,t),!1)},u.prototype.setRemoveIconHistorySuggestions=function(n){var i=this,u=n.getExtraVerbs&&n.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromDeviceHistory"}),e=n.type=="HS"&&t.config.removeSuggUrl,f=n.getExtraVerbs&&n.getExtraVerbs(!1).some(function(n){return n.verb=="RemoveFromActivityFeed"}),o=t.config.th&&ClientTestHooks.isTesthookParamSet("forceRemoveIcon"),r;(o||u||e||f)&&(r=u?"RemoveFromDeviceHistory":f?"RemoveFromActivityFeed":"RemoveFromWebHistory",n.removeIcon={icon:{content:"&#xE711",type:2},title:this._host.getLocString(r),click:function(t,u){i._page.hideTemporaryMessage();i._instrumentationHelper.instrumentItemClickForContextMenu(t,n.instItem,n.sequenceNumber,n.instrumentPingBack,u,null,r);i.launchVerb(n,r,t);i._host.setFocusInSearchBox(null,"remove")}})},u.prototype.updateNarratorWithPreviewMessage=function(n){var r=t.RuntimeConfig.AlwaysWide?"PreviewPaneButtonNarratorMessageWidePane":"PreviewPaneButtonNarratorMessage",i=this._host.getLocString(r);n.narratorText&&n.previewPaneType&&n.narratorText.indexOf(i)==-1&&(n.narratorText+=", "+i)},u.prototype.onBeforeRenderTopResults=function(i,r,u,f,e){var o=this,c,l,s,a,v;this.topResults.forEach(function(n){o.setRemoveIconHistorySuggestions(n);o.updateNarratorWithPreviewMessage(n)});c=1;this.topResults.length!=1||this.topResults[0].hasChildSuggestionsDisplayed||u.some(function(n){return t.isChildSuggestion(n)})&&(this.topResults[0].hasChildSuggestionsDisplayed=!0,c=0);l=this.getSelectableItems();t.RuntimeConfig.FirstSuggestionSelectedByDefault?this._selectedItem&&n.contains(l,this._selectedItem)&&!this._headerFooterViewModel.isScopeElement(this._selectedItem)&&(this._selectedItem!=r[0]||this.topResults[0]==r[0])||(s=this._partialQuery.queryToFetch&&this.topResults.length>0?this.topResults[0]:null,t.config.synthWebNoBestMatch&&t.isNullOrUndefined(s)&&(a=[t.GroupType.SearchSuggestions,t.GroupType.Websites],v=u.filter(function(i){return!n.contains(a,t.getGroupType(i))}),v.length==0&&(s=u.length>0?u[0]:null)),this._previewPane&&t.RuntimeConfig.PreviewPaneAvailable&&n.safeExecute(function(){return o._previewPane.onTopHitUpdated(o._partialQuery,o._selectedItem&&o.isSuggestion(o._selectedItem)?o._selectedItem:null,s,o.getSuggestions(!1))},"ppOnTopHitUpdated"),t.RuntimeConfig.QfMode==8&&t.isNullOrUndefined(s)&&(s=u.length>0?u[0]:null),this.select(s,!1),this._page.scrollToTop()):i&&this.select(null,!1);var y=this.topResults.length>0,h=function(n){return!n.suppressed&&(!t.config.recourseOnlyInGroups||!t.isRecourse(n))&&(n.staticGroupType!=t.GroupType.QuickSearch||t.RuntimeConfig.QfMode==8)&&(t.RuntimeConfig.QfMode!=6||n.type!="LSQS")},p=y||u.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)});return this._headerFooterViewModel.render(this._partialQuery,y,p,f,e),c},u.prototype.isRankable=function(n){return n.typeWithSource.type!=t.GroupType.SearchSuggestions&&n.typeWithSource.type!=t.GroupType.Websites&&n.typeWithSource.type!=t.GroupType.LocalPlaces&&!n.suggestions.some(t.enforceOriginalOrder)},u.prototype.isNotRankableWithRecourse=function(n){return n.typeWithSource.type==t.GroupType.Emails},u.prototype.openPreviewPane=function(n,i){i.stopPropagation();this._previewPane.showPreview(this._partialQuery,n);this.select(n,!t.config.dontUpdateSB);this._host.setFocusInSearchBox(null,"openPreviewPane")},u.prototype.mayNeedFlush=function(){return!t.RuntimeConfig.FlatListWithoutGroups},u.prototype.shouldRenderGroup=function(i){return t.RuntimeConfig.PreviewPaneAvailable&&t.config.suppressedGroups&&n.contains(t.config.suppressedGroups,i)?!1:!0},u.prototype.update=function(i,r,u,f,e,s,h,c,l,a){var v=this,d=this.topResults,w,g,nt,b,tt,y,ft;if(i&&(this._contentQuery=this._partialQuery,this._renderTopResultsTimerForIcons=null,this._renderGroupsTimerForIcons=null),t.config.enableMRUHint)for(w=0,g=r;w<g.length;w++)nt=g[w],nt.mruHintEnabled&&(nt.uxHint=this._host.getLocString("MruBestMatch"));var ut=this.updateTopResults(i,r,u,f,e,l),st=ut[0],ht=ut[1];for(ht(),this._resultsCounter.topResults=[],b=0,tt=this.topResults;b<tt.length;b++)y=tt[b],ft=1+(y.primaryMetadata?1:0)+(y.secondaryMetadata?1:0),this._resultsCounter.topResults.push({mainTextWrapsToTwoLines:o(y,null,!0),numberOfLines:ft,isHtmlAnswer:!!y.htmlContent,isSuppressed:!1,grid:t.displayedInGridLayout(y.type)});if(this._autoComplete&&this.topResults.length>0&&this._selectedItem==this.topResults[0]&&this._autoComplete.apply(this.topResults[0]),this.handlePendingSubmit(e)==0)return this.toggleProgressBar(!0),0;this._partialQuery&&this._partialQuery.isSearchHomeZI&&this.toggleProgressBar(!l);var k=!1,it=0,et=function(){if(k&&it==0){var n=v.groups.map(function(n){return n.typeWithSource.type});v._instrumentationHelper.instrumentRenderFinished(f,h,n,t.RuntimeConfig.QfMode==8);k=!1;v._contentQuery.isSearchHomeZI&&v._instrumentationHelper.instrumentZiRendered(f)}},rt=function(n,t){var r=!1,i;if(v.isRankable(t)&&v._partialQuery&&v._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);it+=1;v.setupIcon(f,n,!1,function(){it-=1;et()});v.onSuggestionAddedToGroup(n,t)},p=this.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup()-this.groups.length,ot=function(){var i,r,n,e;if(p!=0&&u||v.flush(rt,f,c),v._partialQuery&&v._partialQuery.queryToFetch)for(v.groups.sort(function(n,i){return c.findIndex(function(i){return t.sameGroup(i,n.typeWithSource)})-c.findIndex(function(n){return t.sameGroup(n,i.typeWithSource)})}),i=0,r=v.groups;i<r.length;i++)n=r[i],v.isRankable(n)?n.suggestions.sort(function(n,t){return t.rankingScore-n.rankingScore}):v.isNotRankableWithRecourse(n)&&(e=n.suggestions.map(function(n){return n.notAResult}).findIndex(function(n){return n}),e!=-1&&n.suggestions.splice(n.suggestions.length-1,0,n.suggestions.splice(e,1)[0])),v.populateGroupHeaderFlags(n);else t.config.searchHomeTwoCols&&v.groups.forEach(function(n){var i,r;n.type===t.GroupType.QuickSearch&&(i=n.suggestions.findIndex(function(n){return n.type==="SNSC"}),i>=0&&(r=n.suggestions.splice(i,1)[0],n.suggestions.push(r)))})};return i||e.length>0||s.length>0?(this.renderGroupsAfter(function(){for(var ft,h,l,g,nt,y,tt,w,it,r,b,ut,o=0,k=s;o<k.length;o++)r=k[o],ft=v.removeSuggestion(r,a),ft&&(p+=1);for(h=function(n,i){var e=v.getGroupData(n),u=e[0],r=e[1],o;v.shouldRenderGroup(u.type)&&(r?(r.count&&r.count++,o=t.config.minSuggestionsPerGroup&&!i?t.config.minSuggestionsPerGroup-r.suggestions.length:999,o>0&&v.canFitSuggestion(!1,u,n)?rt(n,r):v._partialQuery.isSearchHomeZI||v.queueSuggestionInExistingGroup(n,r)):p>0&&v.canFitSuggestion(!0,u,n)?(r=v.addGroup(u,n,f,c,a),v.shouldTrackGroupCount(r)&&(r.count=1),rt(n,r),p-=1):v._partialQuery.isSearchHomeZI||v.queueSuggestionInMissingGroup(n,u,a))},l=0,g=d;l<g.length;l++){var et=g[l],ht=v.getGroupData(et),u=ht[1];u&&u.count&&(u.count-=1)}if(nt=function(){return v._contentQuery.isSearchHomeZI||t.getTweakedSetting("scrollBarInL1")},st&&!i){for(y=0,tt=e;y<tt.length;y++)r=tt[y],n.contains(d,r)&&h(r,!0);for(w=0,it=e;w<it.length;w++)r=it[w],n.contains(d,r)||h(r,nt())}else e.forEach(function(n){return h(n,nt())});for(b=0,ut=v.topResults;b<ut.length;b++){var et=ut[b],ct=v.getGroupData(et),u=ct[1];u&&u.count&&(u.count+=1)}ot()}),k=!0):p!=0&&u||(this._pendingSuggestionsInMissingGroups.some(function(n){return n.suggestions.length>0})||this._pendingSuggestionsInExistingGroups.some(function(n){return n.suggestions.length>0}))&&(this.renderGroupsAfter(function(){return ot()}),k=!0),et(),l&&this.toggleProgressBar(!1),1},u.prototype.populateGroupHeaderFlags=function(n){if(t.canGoToL2(n)){var i=n.suggestions.every(function(n){return n.suppressed});n.showCountInHeader=i}},u.prototype.shouldTrackGroupCount=function(n){return t.canGoToL2(n)},u.prototype.getGroupData=function(n){var i={type:t.getGroupType(n),source:n.sourceForGroup};return[i,r(this.groups,i)]},u.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");},u.prototype.removePendingSuggestionFromMissingGroup=function(n,i){for(var u,f,r=0;r<this._pendingSuggestionsInMissingGroups.length;++r)if(u=this._pendingSuggestionsInMissingGroups[r],t.sameGroup(u.typeWithSource,i))if(f=u.suggestions.indexOf(n),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");},u.prototype.queueSuggestionInExistingGroup=function(n,t){var i=ni(this._pendingSuggestionsInExistingGroups,t.typeWithSource);i?i.suggestions.push(n):(i={group:t,suggestions:[n]},this._pendingSuggestionsInExistingGroups.push(i))},u.prototype.queueSuggestionInMissingGroup=function(n,t,i){var u=r(this._pendingSuggestionsInMissingGroups,t);u?u.suggestions.push(n):(u={typeWithSource:t,suggestions:[n],extraSignalsMap:i},this._pendingSuggestionsInMissingGroups.push(u))},u.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}},u.prototype.flush=function(n,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(t.config.minSuggestionsPerGroup,e,u.suggestions,n),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=t.config.minSuggestionsPerGroup?1:u.suggestions.length,this.partialFlush(c,u.group,u.suggestions,n)},u.prototype.removeSuggestion=function(i,u){var h={type:t.getGroupType(i),source:i.sourceForGroup},f=r(this.groups,h),e,c,s;if(f)if(n.tryRemove(f.suggestions,i)){if(e=r(this._resultsCounter.groups,f.typeWithSource),c=o(i,f.typeWithSource.type,!1),n.removeFirstWhere(e.suggestions,function(n){return n.mainTextWrapsToTwoLines==c}),t.displayedInGridLayout(f.typeWithSource.type)&&f.suggestions.filter(function(n){return!n.suppressed}).length==0&&(f.cssClasses=""),f.suggestions.length==0)return n.tryRemove(this.groups,f),this._resultsCounter.groups=this._resultsCounter.groups.filter(function(n){return n!=e}),s=ni(this._pendingSuggestionsInExistingGroups,f.typeWithSource),s&&this._pendingSuggestionsInMissingGroups.push({typeWithSource:f.typeWithSource,suggestions:s.suggestions,extraSignalsMap:u}),!0}else this.removePendingSuggestionFromExistingGroup(i,f);else this.removePendingSuggestionFromMissingGroup(i,h);return!1},u}(n.BaseRootViewModel);t.RootViewModel=ui})(t=n.WSB||(n.WSB={}))})(AutoSuggest||(AutoSuggest={}))