Sunteți pe pagina 1din 11

var __extends=this&&this.__extends||function(){var 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])};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 oi(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 si(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 s(k(n,t,!0),i,u,f,e)},function(){return
s(n,i,u,f,e)},null,r):s(n,i,u,f,e))}function s(n,t,i,r,u){if(u()){var
f=t.getExtraVerbs?k(n,t.getExtraVerbs(i),!1):n;f[0]==a&&f.shift();r(f)}}function
lt(n,r,u,f){return n.map(function(n){var e,o,s,h;if(n.verb)
{switch(n.verb.toLocaleLowerCase()){case ht:e="PinnedToStart";break;case
p:e="PinnedToTaskbar";break;case ct:e="UnpinnedFromStart";break;case
w:e="UnpinnedFromTaskbar";break;case
st:o="UninstallConfirmation";e="UninstallationInProgress"}return s=function(t)
{t();e?
u.showTemporaryMessage(f.getLocString(e,HitHighlightingParser.removeMarkers(r.text)
),
{content:"&#xE946",type:2}):u.hideTemporaryMessage();n.verb.toLocaleLowerCase()==p&
&f.addItemToPinnedToTaskbar(r.deviceItem.id);n.verb.toLocaleLowerCase()==w&&f.remov
eItemFromPinnedToTaskbar(r.deviceItem.id)},h=n.icon||
i[n.verb.toLocaleLowerCase()],new t.DeviceItemVerbWrapper(n,h,function(i)
{o&&t.DialogBox?t.DialogBox.show(f.getLocString(o),
[{id:null,text:n.displayName,action:function(){return s(i)},selected:!1},
{id:null,text:f.getLocString("Cancel"),selected:!0}]):s(i)})}return n})}function
b(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(si(n),i,h,u,f,o)},function()
{return e([],i,h,u,f,o)},null,n+" "+i.type),!0;var h=n+"
"+i.type,c=t.getItemWithFileMetadata(i);return c&&c.canHaveContextMenu?
(t.Promise.safeChain("getVerbsAsync",function(){return
c.getVerbsAsync()},function(n){return e(oi(r,n),i,h,u,f,o)},function(){return
e([],i,h,u,f,o)},null,h),!0):i.getExtraVerbsAsync?(e([],i,h,u,f,o),!
0):i.getExtraVerbs?(s([],i,u,f,o),!0):(u&&f([]),!1)}function o(n,i,r)
{if(i==t.GroupType.EdgeHistory&&!r)return!1;var
u=HitHighlightingParser.removeMarkers(n.text),f=u?u.length:0;return
n.additionalInfoText&&!r&&(f+=n.additionalInfoText.length),f>(r?fi:ei)}function
at(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.s
lice(0)});return r}function vt(n,i){if(n.isHtmlAnswer)return ii;if(n.grid)return(i?
t.IconSize_GridLayout:t.IconSize_GridLayout_Medium)+2*u;var r=n.numberOfLines==3?
ti:n.numberOfLines==2?ni:gt;return
n.mainTextWrapsToTwoLines&&(r+=rt),r<it&&(r=it),r}function hi(n,i)
{if(i&&t.uses3lineTemplate(t.getScope(i.type)))return vt({mainTextWrapsToTwoLines:!
1,numberOfLines:3,isHtmlAnswer:!1,isSuppressed:n.isSuppressed,grid:!1},!
1);if(n.isSuppressed)return 0;var r=kt;return n.hasTwoLines?
r+=c+2:n.mainTextWrapsToTwoLines&&(r+=rt),r}function ci(n,i){var
r=tt;if(i.typeWithSource&&t.displayedInGridLayout(i.typeWithSource.type)){var
u=t.isL2(n),f=Math.ceil(i.suggestions.length/(u?et:ot)),e=u?
ut:ft;r+=e*f;r+=2*l}else i.suggestions.forEach(function(n){return
r+=hi(n,i.typeWithSource)});return r}function li(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(a):n;return r.concat(t)}return
n.length>0?n:t.length>0?i?[a].concat(t):t:[]}function r(n,i){return
n.find(function(n){return t.sameGroup(n.typeWithSource,i)})}function yt(n,i){return
n.find(function(n){return t.sameGroup(n.group.typeWithSource,i)})}function pt(n,t)
{return n.queryToFetch.substring(0,t.queryToFetch.lastIndexOf("\\"))}function
wt(n,i,r,u,f){var s,o,e,h,c;if(r==t.GroupType.PathCompletion)return s=pt(n,n)
+"\\"+String.fromCharCode(8206),
{title:s,narratorText:s};if(u&&(o=u.groupDisplayName,o))return{title:o,narratorText
:f?i.getLocString("AddingScopeNarratorText",o):o};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.PowerBi:e="Power BI";break;case
t.GroupType.EdgeHistory:e=i.getLocString("EdgeHistoryGroup");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);break;case
t.GroupType.Websites:e=t.getWebsitesGroupHeader(i);break;case
t.GroupType.Contact:e=i.getLocString("ContactGroup")}if(!e)
{if(h=t.getScope(r),h==t.Scope.All)throw new Error("Unknown group type:
"+r);c=t.ScopeConfig[h];e=t.getScopeDisplayName(c,i)}return{title:e,narratorText:f?
i.getLocString("AddingScopeNarratorText",e.toLocaleLowerCase()):e}}var
d=4,g=6,h=8,u=12,nt=1,f=20,c=16,kt=f+2*h,tt=16+2*h,dt=tt,it=60,gt=f+2*u,ni=f+c+d+2*
u,ti=f+2*(c+d)
+2*u,ii=80+2*u,ri=h,rt=f,ui=48,l=1,ut=t.IconSize_GridLayout+2*(g+nt),ft=t.IconSize_
GridLayout_Medium+2*(g+nt),et=3,ot=4,fi=39,ei=42,a={},v="runas",y="tabletmode_openn
ewwindow",st="tile.uninstall",ht="startpin",p="taskbarpin",ct="startunpin",w="taskb
arunpin",i={},bt;i[v]={content:"&#xE7EF",type:1};i.runasuser={content:"&#xE7EE",typ
e:1};i.openinbrowser={content:"&#xE774",type:1};i.openfilelocation={content:"&#xE83
8",type:2};i.opencontaining={content:"&#xE838",type:2};i[y]={content:"&#xE8A7",type
:2};i.pintostartscreen={content:"&#xE718",type:2};i[ct]={content:"&#xE77A",type:1};
i[w]={content:"&#xE77A",type:1};i[ht]={content:"&#xE718",type:2};i[p]={content:"&#x
E718",type:2};i.settings={content:"&#xE713",type:2};i.manage={content:"&#xE912",typ
e:1};i.review={content:"&#xE728",type:2};i.share={content:"&#xE72D",type:1};i.conne
ctnetworkdrive={content:"&#xE8CE",type:1};i.disconnectnetworkdrive={content:"&#xE8C
D",type:1};i.uninstall={content:"&#xE74D",type:2};i[st]={content:"&#xE74D",type:2};
i.itemproperties={content:"&#xF106",type:2};t.extendVerbs=lt;t.getVerbsAsync=b;t.wr
apsToTwoLines=o;t.joinVerbs=k;t.getGroupTitleAndNarratorText=wt;bt=function(i)
{function u(r,u,f,e,o,s,h,c,l){var a=i.call(this,r,f,e,s)||this,v;return
a._host=r,a._autoComplete=u,a._navigationHelper=o,a._headerFooterViewModel=h,a._pre
viewPane=c,a._contextMenu=l,a._pendingSubmitSequenceNumber=-
1,a._pendingSubmitModifierKeys=null,a._pendingSubmitTimeStamp=null,a._resultsCounte
r={topResults:[],groups:
[]},a._pendingSuggestionsInExistingGroups=[],a._pendingSuggestionsInMissingGroups=[
],s.setSuggestionClickHandler(a.doubleClickGuardedHandler(function(t,i)
{n.safeExecute(function(){return
a.click(n.getCurrentTime(),t,n.getInputType(i),null)},"suggestionClickHandler")})),
s.setContextMenuHandler(function(t,i){n.safeExecute(function(){return
a.showContextMenu(t,i.pageX,i.pageY)},"contextMenuHandler")}),s.setOpenPreviewPaneC
lickHandler(function(t,i){n.safeExecute(function(){return
a.openPreviewPane(t,i)},"openPreviewPaneClickHandler")}),s.setExpanderClickInstrume
ntation(function(n,t,i,r){var u="Expander"+
(r?"Opened":"Closed"),f={si:t,st:i,K:n.instItem.getLayoutKValue()};a._instrumentati
onHelper.logClientInstEvent("Select",u,null,f)}),a._previewPane&&(a._previewPane.in
it(a),a._previewPane.bindBeforeItemLaunch(function(n,t,i,r,u){return
a._instrumentationHelper.instrumentItemClick(n,t.instItem,t.sequenceNumber,t.instru
mentPingBack,i,null,null,r,u)}),a._previewPane.bindAfterItemLaunch(function(n,t,i)
{return a.onSuggestionLaunch(n,t,i)})),r.bindKeyUp(function(n,t,i){return
a.onKeyUp(n,t,i)}),r.bindShown(function(){!
t.isMobileCache&&SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getS
earchServiceStatusAsync&&t.Promise.safeChain("getSearchServiceStatusAsync",function
(){return
SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatu
sAsync()},function(n){a._instrumentationHelper.setSearchServiceStatus(li(n));n!
=0&&n!=4&&n!=3&&n!=7&&a.showIndexingMessage(!1)})}),r.bindKeyDown(function(i)
{i=t.getRtlAdjustedKey(i);var r=n.getCurrentActiveElement();t.isScopeTile(r)?
((i==39||
i==37)&&a._headerFooterViewModel.focusNextScopeTile(r,i==39),t.config.allowUpForSco
pes&&a._selectedItem&&a.select(a._headerFooterViewModel.getSelectableItems()[0],!
1)):t.isOptInBtn(r)&&(i==39||
i==37)&&a._headerFooterViewModel.handleOptInOutNavigation(r,i==39)}),r.bindDismisse
d(function()
{a._pendingSuggestionsInExistingGroups=[];a._pendingSuggestionsInMissingGroups=[];a
.removeProgressBar();a._contextMenu.dismiss();a._previewPane&&t.previewPaneAvailabl
e&&a._previewPane.dismiss();a._page.hideTemporaryMessage();a.hideIndexingMessage();
t.DialogBox&&t.DialogBox.hide();a._headerFooterViewModel.render(null,!1,!1,!1,!
0);t.config.glyphInSearchBox&&a._host.setSearchBoxGlyphIcon()}),s.bindOnNarratorLau
nch(function(t){for(var
i,f=n.getCurrentTime(),e=a.getSelectableItems(),r=0,u=e;r<u.length;r+
+)if(i=u[r],i.id==t){a.isSuggestionOrGroup(i)?(a.select(i,!1),a.submit(f,!
1,i.sequenceNumber,null,!
0)):a._headerFooterViewModel.isScopeElement(i)&&_ge(i.id).click();break}}),a._heade
rFooterViewModel.bindOnL2TransitionEnd(function(){return
a.resetAriaSelected(a.getSelectedItem())}),t.config.searchBoxFocusEvents?
(r.bindSearchBoxGotFocus(function(){a._contextMenu.dismiss();var
t=n.getCurrentActiveElement();t&&t.blur();a.topResults.length>0&&!
a._headerFooterViewModel.isScopesL2Visible()&&a._headerFooterViewModel.isScopeEleme
nt(a._selectedItem)?
a.select(a.topResults[0],a.topResults[0].sequenceNumber==a._sequ
enceNumberReader.getSequenceNumber()):a.renderSelectedSuggestionState(!
1)}),r.bindSearchBoxLostFocus(function(){var
i=t.isScopeTile(n.getCurrentActiveElement());i?sb_st(function()
{a._host.searchBoxHasFocus()||
a._headerFooterViewModel.isScopeElement(a._selectedItem)||
a.renderSelectedSuggestionState(!0)},75):a.renderSelectedSuggestionState(!0)})):
(v=SearchAppWrapper.CortanaApp.searchBox,v.addEventListener("keydown",function(n)
{n.keyCode==9&&a._selectedItem&&a.renderSelectedSuggestionState(!
0)})),sj_evt.bind("CortanaPaneWidthSet",function(n){return
a.onPaneWidthSet(n[1])}),sj_be(_ge("qfContainer"),"scroll",function(){return
a._contextMenu.dismiss()}),a}return
__extends(u,i),u.prototype.onPaneWidthSet=function(n){ot=Math.floor((n-
2*l)/ft);et=Math.floor((n-
2*l)/ut)},u.prototype.setSelectedStyleSuspended=function(n,i)
{n.selectedStyleSuspended=t.qfMode!
=3&&i},u.prototype.renderSelectedSuggestionState=function(n)
{this._selectedItem&&t.qfMode!
=3&&(this.setSelectedStyleSuspended(this._selectedItem,n),this.renderSelection(this
._selectedItem))},u.prototype.removeProgressBar=function()
{t.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._p
rogressTimer),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){var
f,e;if(this._partialQuery&&(i!
=13&&(this._page.hideTemporaryMessage(),this.resetPendingSubmitSequenceNumber()),(!
t.DialogBox||!t.DialogBox.isVisible())&&!
this._headerFooterViewModel.isScopesL2Visible())){if(!
u&&n.isContextMenuKey(i,r.shiftKey,!1)&&!
this._headerFooterViewModel.isScopesL2Visible())
{this.tryShowContextMenuOnSelectedSuggestion();return}if(this._contextMenu.isContex
tMenuVisible()){n.isUpOrDownKey(i)||i==13||
this._contextMenu.dismiss();return}if(this._previewPane&&t.previewPaneAvailable&&th
is._selectedItem&&this.isSuggestion(this._selectedItem))
{this._previewPane.onAfterKeyDownWhenSuggestionSelected(i,this._partialQuery,this._
selectedItem);if(this._previewPane.hasFocus())return}n.isUpOrDownKey(i)&&this._sele
ctedItem&&(this._selectedItem==this.topResults[0]?
this._page.scrollToTop():this._page.scrollTo(this._selectedItem),this._headerFooter
ViewModel.isScopeElement(this._selectedItem)?
(_ge(this._selectedItem.id).focus(),this._host.searchBoxHasFocus()&&SearchAppWrappe
r.CortanaApp.focusWebView()):this._host.setFocusInSearchBox("onAfterKeydown"));t.co
nfig.forceTypedQueryOnTopSupported&&i==46&&this._partialQuery&&this._selectedItem&&
this._selectedItem===this.topResults[0]&&this.topResults[0].query.toLocaleLowerCase
()!
=this._partialQuery.queryToFetch.toLocaleLowerCase()&&(f=this._host.getQuery(),f.or
iginalQuery==this._partialQuery.originalQuery&&(e=f.originalCursorPosition==f.origi
nalQuery.length,e&&this._host.reformulate(this._partialQuery.originalQuery,null,1))
)}},u.prototype.onKeyUp=function(i,r,u){if(i==9&&this._selectedItem&&!
t.config.searchBoxFocusEvents){var
f=n.getCurrentActiveElement();this.renderSelectedSuggestionState(!
t.isBodyOrSuggestion(f));return}if(!u&&n.isContextMenuKey(i,r.shiftKey,!0)&&!
this._headerFooterViewModel.isScopesL2Visible())
{this.tryShowContextMenuOnSelectedSuggestion();return}},u.prototype.tryShowContextM
enuOnSelectedSuggestion=function(){var
n=this._selectedItem&&this.isSuggestion(this._selectedItem)?
this._selectedItem:null,t;n&&(t=_ge(n.id),this.showContextMenu(n,120,t.offsetTop+th
is._page.getScrollTop()+24))},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._contextMenu
.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.show
ProgressBar?this._progressTimer=sb_st(function(){return n.safeExecute(function()
{c._progressTimer&&(c._page.setProgressIndicatorVisibility(!
0),c._progressTimer=null)},"showProgress")},250):this._page.setProgressIndicatorVis
ibility(!1)),this._partialQuery&&this._partialQuery.scope!
=r.scope&&(this._turnOnIndexingInstItem||
this.hideIndexingMessage()),l=this._partialQuery?
this._partialQuery.queryToFetch:"",e=r.queryToFetch,this._previewPane&&t.previewPan
eAvailable)this._previewPane.onQueryChanged(r);for(p=this._partialQuery?
this._partialQuery.scope:t.Scope.All,i.prototype.onQueryChanged.call(this,r,u),w=t.
qfMode!=3&&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.queryToFetc
h.toLowerCase())&&(v=f.text.indexOf(HitHighlightingParser.endMarker),v>=0&&v<f.text
.length-
1&&(f.text=HitHighlightingParser.addMarkers(HitHighlightingParser.removeMarkers(f.t
ext),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.renderTop
Results()}}},u.prototype.onSuggestionsParsed=function(n,i,r,u){(u==="NI"||
u==="PI")&&(r=="PP"||r=="ST"||n.scope!=t.Scope.All)&&n.scope!
=t.Scope.Web&&this.showIndexingMessage(!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(fu
nction(n){return
t=t.concat(n.suggestions)}),this._pendingSuggestionsInMissingGroups.forEach(functio
n(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._contextMenu.isContextMenuVisible())return
this._contextMenu.getSelectableItems();if(this._previewPane&&this._previewPane.hasF
ocus())return
this._previewPane.getSelectableItems();if(this._headerFooterViewModel.isScopesL2Vis
ible())return
this._headerFooterViewModel.getSelectableItems();for(n=this.topResults,i=0,u=this.g
roups;i<u.length;i+
+)r=u[i],r.click&&(n=n.concat(r)),n=n.concat(r.suggestions.filter(function(n)
{return!n.suppressed}));return
t.config.allowUpForScopes&&(n=n.concat(this._headerFooterViewModel.getSelectableIte
ms())),n},u.prototype.getSelectedItem=function(){return
t.DialogBox&&t.DialogBox.isVisible()?
t.DialogBox.getSelectedItem():this._contextMenu.isContextMenuVisible()?
this._contextMenu.getSelectedItem():this._previewPane&&this._previewPane.hasFocus()
?
this._previewPane.getSelectedItem():this._headerFooterViewModel.isScopesL2Visible()
?
this._headerFooterViewModel.getSelectedItem():this._selectedItem},u.prototype.updat
eSelectionState=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=fun
ction(t,i){(t&&this.isSuggestion(t)&&n.contains(this.topResults,t)||
i&&this.isSuggestion(i)&&n.contains(this.topResults,i))&&this.renderTopResults();
(t&&this.isGroup(t)&&n.contains(this.groups,t)||
t&&this.isSuggestion(t)&&this.groups.some(function(i){return
n.contains(i.suggestions,t)})||i&&this.isGroup(i)&&n.contains(this.groups,i)||
i&&this.isSuggestion(i)&&this.groups.some(function(t){return
n.contains(t.suggestions,i)}))&&this.renderGroups()},u.prototype.select=function(i,
r){var u,e,f;t.DialogBox&&t.DialogBox.isVisible()?
t.DialogBox.select(i):this._contextMenu.isContextMenuVisible()?
this._contextMenu.select(i,!
1):this._previewPane&&this._previewPane.hasFocus()&&n.contains(this._previewPane.ge
tSelectableItems(),i)?this._previewPane.select(i,!
1):this._headerFooterViewModel.isScopesL2Visible()?
this._headerFooterViewModel.select(i,!1):(u=this._selectedItem,u&&(u.selected=!
1,this.setSelectedStyleSuspended(u,!1)),this._selectedItem=i,i&&(i.selected=!
0,this.setSelectedStyleSuspended(i,!
this._host.searchBoxHasFocus())),this.renderSelection(this._selectedItem,u),e=(t.qf
Mode==3?
t.config.glyphInSearchBoxTabShell:t.config.glyphInSearchBox)==2,e&&this.setSearchBo
xGlyphIcon(i),r&&(f=i?
i.query:null,f&&this._partialQuery.scopePrefix&&(f=this._partialQuery.scopePrefix.t
rim()+":
"+f),this._host.updateQueryWithoutRefetching(f)))},u.prototype.setSearchBoxGlyphIco
n=function(i){var u,r,f,e;i&&(r=i.icon,r&&n.contains([2,1],r.type)?u=r:
(f=this.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.setu
pIcon=function(i,r,u,f){var e=this,o;r.getIcon&&!r.suppressed?
(this._instrumentationHelper.notifyIconPending(i,u,r.instItem.getLayoutKValue(),r.t
ype),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._instrumentati
onHelper.notifyIconReady(i,u,r.instItem.getLayoutKValue(),r.type),u?
n.contains(e.topResults,r)&&e.renderTopResults():e.groups.some(function(t){return
n.contains(t.suggestions,r)})&&e.renderGroups(),f())};t.populateImageRatio(r.icon,r
.type,s)})):f()},u.prototype.getImageSize=function(n,i,r){return
n.scope==t.Scope.Apps&&!n.queryToFetch?3:t.displayedInGridLayout(i.type)?2:r?
0:1},u.prototype.isGroup=function(n){return!!
n.suggestions},u.prototype.isSuggestionOrGroup=function(n){return!
this._headerFooterViewModel.isScopeElement(n)},u.prototype.isSuggestion=function(n)
{return!this.isGroup(n)&&!
this._headerFooterViewModel.isScopeElement(n)},u.prototype.submit=function(i,r,u,f,
e){var h=e?5:r?
6:1,o=n.getCurrentActiveElement(),c,s,l,a,v;if(this._headerFooterViewModel.isScopes
L2Visible()){if(c=this._headerFooterViewModel.getSelectedItem(),c)
{c.click();return}}else{if(o&&(o.id=="optInYesBtn"||o.id=="optInNoBtn"))
{o.click();return}if(this._selectedItem&&this._headerFooterViewModel.isScopeEle
ment(this._selectedItem))
{_ge(this._selectedItem.id).click();return}if(t.DialogBox&&t.DialogBox.isVisible())
{t.DialogBox.submit();return}if(this._previewPane&&this._previewPane.hasFocus()&&(s
=this._previewPane.getSelectedItem(),s&&s.click))
{s.click(i,h);return}}if(l=this._contextMenu.getSelectedItem(),l)
{l.click(i,h,f);return}if(a=!
t.isBodyOrSuggestion(o),v=this._host.isRequestFocusAvailable(),a){v||
o.click();return}if(this._lastUpdatedSequenceNumber!=u&&(!this._selectedItem||
this._selectedItem==this.topResults[0]))
{this._pendingSubmitSequenceNumber=u;this._pendingSubmitModifierKeys=f;this._pendin
gSubmitTimeStamp=i;return}this._selectedItem?
this.click(i,this._selectedItem,h,f):this.groups.length>0&&this._partialQuery.fullP
artialQuery&&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)
{this._page.hideTemporaryMessage();var f=this.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(n);return}u=u||
this._host.getModifierKeyState();u.ctrlKey&&u.shiftKey?
this.launchVerb(f,v,n):u.shiftKey?this.launchVerb(f,y,n):f.click(n);t.qfMode!=3||
f.isReformulation||
this._host.updateQueryWithoutRefetching("");this.onSuggestionLaunch(f,this._partial
Query)},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=b("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)},function(){return!0});f||
i.click(u)},u.prototype.showContextMenu=function(n,i,r){var
u=this,f=b("showContextMenu",n,t.config.rawVerbs,!1,function(t){return
sb_st(function(){return
u._contextMenu.showContextMenu(lt(t,n,u._page,u._host),i,r,function(t,i,r,f)
{u._instrumentationHelper.instrumentItemClick(i,n.instItem,n.sequenceNumber,n.instr
umentPingBack,r,f,t)},function(){return
u._host.setFocusInSearchBox("contextMenuDismiss")})},0)},function(){return!0});f||
(this._page.hideTemporaryMessage(),this._host.setFocusInSearchBox("noContextMenu"))
},u.prototype.getGroupHeaderClickAction=function(i,r,u){var
f=this,e,o,s;if(t.scopesAvailable&&(e=t.getScope(r.type),e!=t.Scope.All))return
t.isL2(i)||!t.isScopeEnabled(e,t.ScopeConfig[e])?[null,null]:[function(){return
f._headerFooterViewModel.clickHandler(e,"groupHeader",r)},null];switch(r.type){case
t.GroupType.Store:o=function(){return
f._host.launchStoreSearch(i.queryToFetch)};break;case
t.GroupType.SearchSuggestions:o=function(){return f.launchSearch(i,u)};break;case
t.GroupType.PathCompletion:o=function(){return
f._host.launchFolder(pt(i,f._partialQuery))}}if(o){if(!u)throw"No QS code for:
"+t.GroupType[r.type];return
s=n.InstrumentedItem.getNonSuggestionInstrumentedItem(u,t.SyntheticQSCodesMaps.KVal
ues),
[o,s]}return[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.minLength
ForIBAonL1)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 c;if(r(this.groups,n))throw new
Error("Trying to add repeated group "+n);var
l=t.GroupHeaderQSCodes[n.type],a=this.getGroupHeaderClickAction(this._partialQuery,
n,l),s=a[0],h=a[1],o=wt(this._partialQuery,this._host,n.type,i,s);return
n.source&&(o.title+=" -
"+t.getGroupSourceDisplayName(n.source,this._host)),c={typeWithSource:n,id:"gr"+n.t
ype+(n.source||""),text:o.title,narratorText:o.narratorText,tooltip:s?
o.narratorText:null,click:s,suggestions:
[],instRegionName:t.GroupType[n.type],instItem:h,selected:!
1,cssClasses:t.isTopHitChildGroup(n)?"topHitConnectedToGroup":null,sequenceNumber:u
,showPlusIconInHeader:this.shouldShowPlusIconInGroupHeader(n.type,e)},h&&this._inst
rumentationHelper.instrumentSyntheticInstrumentedItem(u,l,h),this._resultsCounter.g
roups.push({typeWithSource:n,suggestions:
[]}),this.insertGroup(c,f),c},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.inst
Item,t.sequenceNumber,t.instrumentPingBack,1,this._pendingSubmitModifierKeys),this.
_pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.ctrlKey&&this._pendingS
ubmitModifierKeys.shiftKey?
this.launchVerb(t,v,this._pendingSubmitTimeStamp):this._pendingSubmitModifierKeys&&
this._pendingSubmitModifierKeys.shiftKey?
this.launchVerb(t,y,this._pendingSubmitTimeStamp):t.click(this._pendingSubmitTimeSt
amp),0}}finally{this.resetPendingSubmitSequenceNumber()}return
1},u.prototype.showDisableEnterMessage=function()
{this._page.showTemporaryMessage(this._host.getLocString("EnterOnAmbiguousTopHitMes
sageText"),{content:"&#xE946",type:2})},u.prototype.showIndexingMessage=function(i)
{var r=this,u;t.isMobileCache||(t.config.showEnableIndexerLink&&!i?
(this._turnOnIndexingInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("
IMIO",t.SyntheticQSCodesMaps.KValues),u={text:this._host.getLocString("WindowsIndex
ingDisabledAction"),instItem:this._turnOnIndexingInstItem,click:function(i){var
f=n.getCurrentTime(),u=r._sequenceNumberReader.getSequenceNumber();u>r._lastUpdated
SequenceNumber&&r._instrumentationHelper.instrumentSyntheticInstrumentedItem(u,"IMI
O",r._turnOnIndexingInstItem);r._instrumentationHelper.instrumentItemClick(f,r._tur
nOnIndexingInstItem,u,null,n.getInputType(i));t.LocalDataProvider.launchIndexingOpt
ions(r._host,!
1)}}):this._turnOnIndexingInstItem=null,this._page.showIndexingMessage(i,u))},u.pro
totype.hideIndexingMessage=function(){t.isMobileCache||
(this._turnOnIndexingInstItem=null,this._page.hideIndexingMessage())},u.prototype.g
etAvailableSpace=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.searchBoxOnTop&&(i-=t.config.extraTopPadding),t.scopesAvailable&&(i-
=ui),n.topResults.length==0||
t.shouldRenderFlatListWithoutGroups(this._partialQuery)||(i-
=dt),n.topResults.forEach(function(n){return i-
=vt(n,t.isL2(r._partialQuery))}),n.groups.forEach(function(n){return i-
=ci(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-
=ri),i)},u.prototype.canFitSuggestion=function(t,i,u){if(u.suppressed)return!0;var
e=at(this._resultsCounter),f;return t?(f={typeWithSource:i,suggestions:
[]},e.groups.push(f)):f=r(e.groups,i),f.suggestions.push({mainTextWrapsToTwoLines:u
&&o(u,i.type,!
1),isSuppressed:u&&u.suppressed,hasTwoLines:u&&n.contains(u.classNames,"forceNoWrap
OutsideTopResult")}),this.getAvailableSpace(e)>=0},u.prototype.getMaxNumberOfGroups
ToFitMinSuggestionsPerGroup=function(){var
i,r,u,n,f;if(t.isL2(this._partialQuery)&&this._partialQuery.queryToFetch)return
Number.MAX_VALUE;for(i=at(this._resultsCounter),r=0,u=i.groups;r<u.length;r+
+)for(n=u[r];n.suggestions.length<t.config.minSuggestionsPerGroup;)n.suggestions.pu
sh(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.disp
layed=!
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.setRemoveIconHistorySuggest
ions(i);s=r(this._resultsCounter.groups,u.typeWithSource);s.suggestions.push({mainT
extWrapsToTwoLines:o(i,u.typeWithSource.type,!
1),isSuppressed:i.suppressed,hasTwoLines:n.contains(i.classNames,"forceNoWrapOutsid
eTopResult")});t.displayedInGridLayout(u.typeWithSource.type)&&u.suggestions.filter
(function(n){return!
n.suppressed}).length>0&&(u.cssClasses+=t.isL2(this._partialQuery)?" gridLayout":"
gridLayout gridLayoutMedium")},u.prototype.onGroupsCleared=function()
{this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroup
s=[];this._resultsCounter.groups=[];this._turnOnIndexingInstItem&&this._instrumenta
tionHelper.instrumentSyntheticInstrumentedItem(this._lastUpdatedSequenceNumber,"IMI
O",this._turnOnIndexingInstItem)},u.prototype.launchSearch=function(n,t){var
i=n.queryToFetch;this._host.launchSearch(i,this._navigationHelper.getSearchUrl(n.fu
llPartialQuery,i,t),!1)},u.prototype.setRemoveIconHistorySuggestions=function(i)
{var
r=this,u=i.getExtraVerbs&&i.getExtraVerbs(!1).some(function(n){return
n.verb=="RemoveFromDeviceHistory"}),e=i.type=="HS"&&t.config.removeSuggUrl,o=t.conf
ig.th&&ClientTestHooks.isTesthookParamSet("forceRemoveIcon"),f;(o||u||
e)&&(f=u?"RemoveFromDeviceHistory":"RemoveFromWebHistory",i.removeIcon={icon:
{content:"&#xE711",type:2},title:this._host.getLocString(u?"RemoveFromDeviceHistory
":"RemoveFromWebHistory"),click:function(t){var
u=n.getCurrentTime();t.stopPropagation();r._page.hideTemporaryMessage();r._instrume
ntationHelper.instrumentItemClick(u,i.instItem,i.sequenceNumber,i.instrumentPingBac
k,n.getInputType(t),null,f);r.launchVerb(i,f,u);r._host.setFocusInSearchBox("remove
")}})},u.prototype.updateNarratorWithPreviewMessage=function(n){var
r=t.alwaysWide?"PreviewPaneButtonNarratorMessageWidePane":"PreviewPaneButtonNarrato
rMessage",i=this._host.getLocString(r);n.narratorText&&t.supportsPreview(n)!
=0&&n.narratorText.indexOf(i)==-1&&(n.narratorText+=",
"+i)},u.prototype.onBeforeRenderTopResults=function(i,r,u,f){var
e=this,s,c,h;this.topResults.forEach(function(n)
{e.setRemoveIconHistorySuggestions(n);e.updateNarratorWithPreviewMessage(n)});s=1;t
his.topResults.length!=1||this.topResults[0].hasChildSuggestionsDisplayed||
r.some(function(n){return
t.isChildSuggestion(n)})&&(this.topResults[0].hasChildSuggestionsDisplayed=!
0,s=0);c=this.getSelectableItems();this._selectedItem&&n.contains(c,this._selectedI
tem)&&!
this._headerFooterViewModel.isScopeElement(this._selectedItem)&&(this._selectedItem
!=i[0]||this.topResults[0]==i[0])||
(h=this._partialQuery.queryToFetch&&this.topResults.length>0?
this.topResults[0]:null,this._previewPane&&t.previewPaneAvailable&&n.safeExecute(fu
nction(){return
e._previewPane.onTopHitUpdated(e._partialQuery,e._selectedItem&&e.isSuggestion(e._s
electedItem)?e._selectedItem:null,h,e.getSuggestions(!1))},"ppOnTopHitUpdated
1"),this.select(h,!1),this._page.scrollToTop());var
l=this.topResults.length>0,o=function(n){return!n.suppressed&&(!
t.config.recourseOnlyInGroups||!t.isRecourse(n))},a=l||r.some(o)||
this.groups.some(function(n){return n.suggestions.some(o)})||
this._pendingSuggestionsInMissingGroups.some(function(n){return
n.suggestions.some(o)})||this._pendingSuggestionsInExistingGroups.some(function(n)
{return n.suggestions.some(o)});return
this._headerFooterViewModel.render(this._partialQuery,l,a,u,f),s},u.prototype.isRan
kable=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=f
unction(n){return
n.typeWithSource.type==t.GroupType.Emails},u.prototype.openPreviewPane=function(n,t
)
{t.stopPropagation();this._previewPane.showPreview(this._partialQuery,n);this.selec
t(n,!
0);this._host.setFocusInSearchBox("openPreviewPane")},u.prototype.mayNeedFlush=func
tion(){return!
t.shouldRenderFlatListWithoutGroups(this._partialQuery)},u.prototype.shouldRenderGr
oup=function(i){return
t.previewPaneAvailable&&t.config.suppressedGroups&&n.contains(t.config.suppressedGr
oups,i)?!1:!0},u.prototype.update=function(i,r,u,f,e,s,h,c,l,a){var
v=this,k=this.topResults,w,d,y,it;i&&(this._contentQuery=this._partialQuery);var
tt=this.updateTopResults(i,r,u,f,e,l),ft=tt[0],et=tt[1];for(et(),this._resultsCount
er.topResults=[],w=0,d=this.topResults;w<d.length;w++)y=d[w],it=1+
(y.primaryMetadata?1:0)+(y.secondaryMetadata||y.stars?
1:0),this._resultsCounter.topResults.push({mainTextWrapsToTwoLines:o(y,null,!
0),numberOfLines:it,isHtmlAnswer:!!y.htmlContent,isSuppressed:!
1,grid:t.displayedInGridLayout(y.type)});if(this._autoComplete&&this.topResults.len
gth>0&&this._selectedItem==this.topResults[0]&&this._autoComplete.apply(this.topRes
ults[0]),this.handlePendingSubmit(e)==0)return this.removeProgressBar(),0;var b=!
1,g=0,rt=function()
{b&&g==0&&(v._instrumentationHelper.instrumentRenderFinished(f,h),b=!
1)},nt=function(n,t){var r=!
1,i;if(v.isRankable(t)&&v._partialQuery&&v._partialQuery.queryToFetch)for(i=0;i<t.s
uggestions.length;i++)if(n.rankingScore>t.suggestions[i].rankingScore)
{t.suggestions.splice(i,0,n);r=!0;break}r||
t.suggestions.push(n);g+=1;v.setupIcon(f,n,!1,function(){g-
=1;rt()});v.onSuggestionAddedToGroup(n,t)},p=this.getMaxNumberOfGroupsToFitMinSugge
stionsPerGroup()-this.groups.length,ut=function(){var i,r,n,e;if(p!=0&&u||
v.flush(nt,f,c),v._partialQuery&&v._partialQuery.queryToFetch)for(v.groups.sort(fun
ction(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)};return i||e.length>0||s.length>0?
(this.renderGroupsAfter(function(){for(var
et,h,l,g,y,tt,w,it,r,b,rt,o=0,d=s;o<d.length;o+
+)r=d[o],et=v.removeSuggestion(r,a),et&&(p+=1);for(h=function(n,i){var
o=v.getGroupData(n),u=o[0],r=o[1],e;v.shouldRenderGroup(u.type)&&(r?
(r.count&&(r.count+=1),e=void 0,e=t.config.minSuggestionsPerGroup&&!i?
t.config.minSuggestionsPerGroup-r.suggestions.length:999,e>0&&v.canFitSuggestion(!
1,u,n)?nt(n,r):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),nt(n,r),p-
=1):v.queueSuggestionInMissingGroup(n,u,a))},l=0,g=k;l<g.length;l++){var
ot=g[l],st=v.getGroupData(ot),u=st[1];u&&u.count&&(u.count-=1)}if(ft&&!i)
{for(y=0,tt=e;y<tt.length;y++)r=tt[y],n.contains(k,r)&&h(r,!
0);for(w=0,it=e;w<it.length;w++)r=it[w],n.contains(k,r)||h(r,!1)}else
e.forEach(function(n){return h(n,!1)});for(b=0,rt=v.topResults;b<rt.length;b++){var
ot=rt[b],ht=v.getGroupData(ot),u=ht[1];u&&u.count&&(u.count+=1)}ut()}),b=!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
ut()}),b=!
0),t.alwaysWide&&this.topResults.length==0&&this.groups.length>0&&this.autoSelectTo
pResultWhenNoTopHit(),rt(),l&&this.removeProgressBar(),1},u.prototype.autoSelectTop
ResultWhenNoTopHit=function(){var f=this,t=this.groups,i,r,u,o,s,e;if(t.length!
=0&&!t[0].suggestions[0].selected){for(u=0;u<t.length;+
+u)if(i=t[u].suggestions.findIndex(function(n){return n.selected}),i>=0)
{r=u;break}r>=0?
(r>0&&(o=t[r],t.splice(r,1),t.unshift(o)),i>0&&(s=t[0].suggestions[i],t[0].suggesti
ons.splice(i,1),t[0].suggestions.unshift(s))):
(e=t[0].suggestions[0],n.safeExecute(function(){return
f._previewPane.onTopHitUpdated(f._partialQuery,undefined,e,f.getSuggestions(!
1))},"ppOnTopHitUpdated 2"),this.select(e,!
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.pr
ototype.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.i
ndexOf(n),u==-1)throw new Error("Pending suggestion not
found");else{r.suggestions.splice(u,1);r.suggestions.length==0&&this._pendingSugges
tionsInExistingGroups.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._pendingSugges
tionsInMissingGroups.splice(r,1);return}throw new Error("Pending suggestion not
found");},u.prototype.queueSuggestionInExistingGroup=function(n,t){var
i=yt(this._pendingSuggestionsInExistingGroups,t.typeWithSource);i?
i.suggestions.push(n):(i={group:t,suggestions:
[n]},this._pendingSuggestionsInExistingGroups.push(i))},u.prototype.queueSuggestion
InMissingGroup=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.prototyp
e.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.sh
ouldTrackGroupCount(e)&&(e.count=u.suggestions.length),f.partialFlush(t.config.minS
uggestionsPerGroup,e,u.suggestions,n),u.suggestions.forEach(function(n){return
l.queueSuggestionInExistingGroup(n,e)}),u.suggestions=[])},f=this,o=0,h=this._pendi
ngSuggestionsInMissingGroups;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.len
gth;e++)u=s[e],c=t.config.minSuggestionsPerGroup?
1:u.suggestions.length,this.partialFlush(c,u.group,u.suggestions,n)},u.prototype.re
moveSuggestion=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.su
ggestions.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=yt(this._pendingSuggestionsInExistingGroups,f.typeWithSource),s&&this._pendi
ngSuggestionsInMissingGroups.push({typeWithSource:f.typeWithSource,suggestions:s.su
ggestions,extraSignalsMap:u}),!0}else
this.removePendingSuggestionFromExistingGroup(i,f);else
this.removePendingSuggestionFromMissingGroup(i,h);return!1},u}
(n.BaseRootViewModel);t.RootViewModel=bt})(t=n.WSB||(n.WSB={}))})(AutoSuggest||
(AutoSuggest={}))

S-ar putea să vă placă și