var AutoSuggest;(function(n){var t;(function(t){function c(n){return n.toLocaleLowerCase().replace(l,"").trim()}function o(n,t,i,r,u){if(!n)return i;if(typeof n!="string")try{return{content:URL.createObjectURL(n),type:0,bgColor:r}}catch(f){return SharedLogHelper.LogError("convertToHtmlImage "+t,u,f),i}else return{content:n,type:0,bgColor:r}}var s=!!_ge("wsb_form_q"),i,e,u,r,f,l=/[\.,:;?!¿¡]/g,h=-933981677285477,a=400;t.toIcon=o;var v={"action://Help/Launch":"Help","ms-cortana://navigate/Notebook":"Notebook"},y={"ms-cortana://navigate/Settings":t.config.settingsUri},p=function(){function l(s){var c=this,a,l,v,y,p;this._accessTokenManager=s;this._queryParamsCache={};this._locStrings=[];this._enUsLocStrings=[];this._modifierKeyState={altKey:!1,ctrlKey:!1,shiftKey:!1};this._bootstrapDoneEventHandlers=[];this._appVisibleEventHandlers=[];this._shownEventHandlers=[];this._conversationStartEventHandlers=[];this._dismissedEventHandlers=[];this._appHiddenEventHandlers=[];this._searchBoxGotFocusEventHandlers=[];this._searchBoxLostFocusEventHandlers=[];this._onSubmitHandlers=[];this._onFeedbackClosingHandlers=[];this._onSearchBoxGlyphIconClick=[];this._onSearchBoxClick=[];this._onButtonRightOfSearchBoxClick=[];this._queryChangedHandlers=[];this._rawQueryChangedHandlers=[];this._keyDownHandlers=[];this._keyUpHandlers=[];this._keyEscapeHandlers=[];this._onAccentColorAndThemeRefreshed=[];this._accessTokenAvailableHandlers=[];this._fileDropHandlers=[];this._scopeListRequiresUpdate=[];this._accountChangedHandlers=[];this._pinnedApps={};this._state=0;this._paneCloseCount=0;this._qfDismissCount=0;this._currentPaneHeight=0;this._root=_ge("root");this._rootContainer=_ge("rootContainer");this._defaultBrowser=0;this.usedImpressionIds={};this.getEdgeIcon=function(n,t){var i=c._defaultBrowserIconCache&&c.getUriLaunchPolicy()==0?c._defaultBrowserIconCache:c._edgeIconCache;return i(n,t)};this._suggestionsContainer=_ge("suggestionsList");i=SearchAppWrapper.CortanaApp;e=i.queryFormulationView;u=i.launcher;r=typeof SearchBoxController=="object"?SearchBoxController:i.searchBox;f=n.Service.QueryParams;n.refreshBingEnabledCache(i.isBingEnabled,t.getMarketForBingAvailability());this._currentCVID=n.cleanGuid(this.createGuid());this._randomPrivacyNumber=this.getNewPrivacyNumber();this.initLanguage();a=n.safeExecute(function(){return+e.perfMetrics.lookup(32)},"perfMetricsFallbackLookup",h);this._hasFallbackHappened=a!=h;l=e.searchHistory;l&&l.addEventListener("cleardevicehistoryrequested",function(){var t=function(t){return n.safeExecute(function(){return l.signalClearDeviceHistoryCompleted(t)},"signalClearDeviceHistoryCompleted")};c._clearStorageRequestedHandlers?n.safeExecute(function(){return c._clearStorageRequestedHandlers(t),!0},"clearDeviceHistoryRequested")||t(!1):t(!1)});i.addEventListener("statechanged",function(n){c.updateState(c._state,n.newState,!1)});r.addEventListener("querytextchanged",function(n){if(!c._qfDisabled){c._feedbackFormIsVisible&&c.closeFeedbackForm();var t=n.queryText;c._queryPropertiesOverrides&&c._queryPropertiesOverrides.query!=t&&(c._queryPropertiesOverrides=null);c.updateState(c._state,2,!0);c._queryToIgnoreOnQueryTextChangedEvent!=n.queryText&&(c._queryToIgnoreOnQueryTextChangedEvent=null);c.callQueryChangedHandlers(n,!1,c._queryToIgnoreOnQueryTextChangedEvent!=null,n.impressionId)}});r.addEventListener("keydown",function(u){var f,e,o,s,h;if(f=u.keyCode,t.config.debugDismissEvents){if(f==121){c.updateState(c._state,1,!1);return}if(f==122){e=c._state==0?2:0;c.updateState(c._state,e,!1);return}}if(c._qfDisabled){if(i.hostingEnvironment==3&&f==13){o=r.getQueryText().queryText;i.fileExplorerSuggestionPage.onSuggestionSelection(o)}return}if(f!=9&&!n.isFunctionalKey(f)){if(f==27){c.keyDownEscapeHandler();return}s={shiftKey:u.isShiftKeyPressed,ctrlKey:u.isControlKeyPressed,altKey:!1};h=u.isHandled;c._keyDownHandlers.forEach(function(t){return n.safeExecute(function(){return t(f,s,h)},"keyDown")})}});sj_b.addEventListener("keydown",function(i){var r,o,s,u,f,e;if(!c._qfDisabled){if(r=i.keyCode,t.config.debugDismissEvents){if(r==121){c.updateState(c._state,1,!1);return}if(r==122){o=c._state==0?2:0;c.updateState(c._state,o,!1);return}}if(!n.isFunctionalKey(r)){if(r!=9||c._feedbackFormIsVisible||i.preventDefault(),s=t.RuntimeConfig.AlwaysWide||t.config.enableLocalPreviewPaneInSingleColumn,u=i.target,u){if(f=_ge("fbpgdg"),f&&f.contains(u))return;if(r==27){c.keyDownEscapeHandler();return}if(!s&&t.RuntimeConfig.PreviewPaneAvailable&&(e=_ge("qfPreviewPane"),e&&e.contains(u)&&(!t.DialogBox||t.DialogBox.isVisible())))if(r==37)sj_pd(i);else return}n.contains([38,40],r)&&sj_pd(i);c._keyDownHandlers.forEach(function(t){return n.safeExecute(function(){return t(i.keyCode,i,!1)},"body.keyDown")})}}});r.addEventListener("keyup",function(t){var i,r,u;c._qfDisabled||(i=t.keyCode,i==9||n.isFunctionalKey(i))||(r={shiftKey:t.isShiftKeyPressed,ctrlKey:t.isControlKeyPressed,altKey:!1},u=t.isHandled,c._keyUpHandlers.forEach(function(t){return n.safeExecute(function(){return t(i,r,u)},"keyUp")}))});sj_b.addEventListener("keyup",function(t){if(!c._qfDisabled){var i=t.keyCode;n.isFunctionalKey(i)||c._keyUpHandlers.forEach(function(r){return n.safeExecute(function(){return r(i,t,!1)},"keyUp")})}});r.addEventListener("gotfocus",function(){c._qfDisabled||c._searchBoxGotFocusEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"gotfocus")})});r.addEventListener("lostfocus",function(){c._qfDisabled||c._searchBoxLostFocusEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"lostfocus")})});r.addEventListener("submitbuttonclick",function(){if(!c._qfDisabled){var r=n.getCurrentTime(),i=c.getFeatureString("SubmitButtonGlyph").featureValue;i&&i!=""||t.RuntimeConfig.QfMode==2?c._onButtonRightOfSearchBoxClick.forEach(function(t){return n.safeExecute(function(){return t(i)},"submitbuttonclick.custom")}):c._onSubmitHandlers.forEach(function(t){return n.safeExecute(function(){return t(r,!0,null)},"submitbuttonclick")})}});r.addEventListener("searchboxglyphclick",function(){c._qfDisabled||c._onSearchBoxGlyphIconClick.forEach(function(t){return n.safeExecute(function(){return t()},"searchboxglyphclick")})});r.addEventListener("searchboxtapped",function(){c._qfDisabled||c._onSearchBoxClick.forEach(function(t){return n.safeExecute(function(){return t()},"searchboxtapped")})});r.addEventListener("searchboxclick",function(){c._qfDisabled||c._onSearchBoxClick.forEach(function(t){return n.safeExecute(function(){return t()},"searchboxclick")})});t.config.enableDragDropSearch&&(v=function(n){var i=[],r,u,t;if(n.dataTransfer.items)for(t=0;t<n.dataTransfer.items.length;++t)r=n.dataTransfer.items[t],u=r&&r.getAsFile(),u&&i.push(u);else for(t=0;t<n.dataTransfer.files.length;++t)i.push(n.dataTransfer.files[t]);return i},document.addEventListener("dragover",function(n){c._qfDisabled||n.preventDefault()}),document.addEventListener("drop",function(n){if(!c._qfDisabled){n.preventDefault();var t=v(n);t.length>0&&c._fileDropHandlers.forEach(function(n){return n(t)})}}));sj_evt.bind("ajax.feedback.initialized",sj_dm(this,this.registerFeedbackDebugCallback),!0);this.bindAppVisible(function(){c.appVisibleInit()});this.bindShown(function(){if(n.safeFireEvent("ajax.threshold.pageStart",n.getCurrentTime()),c.shownInit(),!c._qfDisabled){var i=c.getNewConversationId();t.updateErrorHandlingCVID(i);c._currentCVID!=i&&(c._currentCVID=i,c._randomPrivacyNumber=c.getNewPrivacyNumber(),c._conversationStartEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"conversationStart")}));c._lastKeyWasEnter=!1}});this.bindDismissed(function(){c._qfDismissCount+=1;n.safeFireEvent("threshold.pageUnload");c.dismissCleanup()});this.bindAppHidden(function(){c._paneCloseCount+=1;c.appHiddenCleanup();c.uploadClientErrorLog()});this.bindKeyDown(function(t,i){var r,u;c._modifierKeyState=i;r=t==13;r&&!c._lastKeyWasEnter&&(u=n.getCurrentTime(),c._onSubmitHandlers.forEach(function(t){return n.safeExecute(function(){return t(u,!1,i)},"onSubmit handlers")}));c._lastKeyWasEnter=r});this.bindKeyUp(function(n){c._lastKeyWasEnter=!1;switch(n){case 16:c._modifierKeyState.shiftKey=!1;break;case 17:c._modifierKeyState.ctrlKey=!1}});this.bindOnFeedbackClosing(function(n){n&&c.setFocusInSearchBox(null,"onFeedbackClosing")});t.config.refreshWhenTokenArrives&&this.bindAccessTokenAvailable(function(n){var i=n==1?function(n){return n.dataSource=="SSEE"||n.dataSource=="SSUE"}:function(n){return n.dataSource=="SSEC"||n.dataSource=="SSUC"};c._currentQuery&&(c._currentQuery.queryToFetch.length>=t.config.minLengthFor3SonL1||t.isL2(c._currentQuery))&&c._currentQuery.originalQuery==r.getQueryText().queryText&&t.ScopeConfig[c._currentQuery.scope].enabledDataSources.some(i)&&c.refreshCurrentPane()});_G.PN="QF";this._edgeIconCache=t.Promise.safeChainWithGlobalCaching("edgeIcon",function(n){return e.deviceSearch.findAppsAsync(t.EdgeAppIds).then(function(i){var r=t.EdgeAppIds.map(function(n){return i[n]}).filter(function(n){return!!n})[0];return r.getImageAsync(t.getImageSizeValue(n)).then(function(n){return o(n,"edgeIcon",null,r.isImmersive?r.logoBackgroundColor:null)})})},function(n){return n+"_edgeIcon"});sj_evt.bind("onFeedbackStarting",function(n){var t=n===void 0?[undefined,undefined]:n,i=t[1];c._feedbackFormIsVisible=!0;c._feedbackFormIsOpenedByClient=i;c.adjustHeight()});sj_evt.bind("onFeedbackClosing",function(){c._feedbackFormIsVisible=!1;c.adjustHeight();c._onFeedbackClosingHandlers.forEach(function(t){return n.safeExecute(function(){return t(c._feedbackFormIsOpenedByClient)},"onFeedbackClosing handlers")})});this._accessTokenManager&&(this._accessTokenManager.bindAccessTokenAvailable(function(n){c._accessTokenAvailableHandlers.forEach(function(t){return t(n)})}),this._accessTokenManager.bindAccountTypesChanged(function(){return c.updateScopeList()}),y=function(){return!0},p=this._qfDismissCount,this._accessTokenManager.enumerateMultiAccountAuthority(y,function(){return c.initHeadersOverrides(p)}))}return l.prototype.refreshDefaultBrowserInfo=function(){if(this._defaultBrowser=0,i.getDefaultBrowserInfo){var r=n.safeExecute(function(){return i.getDefaultBrowserInfo()},"getDefaultBrowserInfo");r&&(this._defaultBrowser=this.calculateBrowserType(r.path),this._defaultBrowserIconCache=e.deviceSearch.getIconForDefaultBrowserAsync&&this.getUriLaunchPolicy()==0&&this._defaultBrowser!=3?t.Promise.safeChainWithGlobalCaching("defaultBrowserIcon",function(n){return e.deviceSearch.getIconForDefaultBrowserAsync(t.getImageSizeValue(n),0).then(function(n){return o(n,"defaultBrowserIcon")})},function(n){return n+"_"+r.progId}):null)}!t.isMobileCache&&i.setDefaultUriLaunchPolicy&&i.setDefaultUriLaunchPolicy(this.getUriLaunchPolicy())},l.prototype.getDefaultBrowser=function(){return this._defaultBrowser},l.prototype.calculateBrowserType=function(n){return n?n.endsWith("\\chrome.exe")?6:n.endsWith("LaunchWinApp.exe")?3:n.endsWith("firefox.exe")?5:n.endsWith("\\msedge.exe")?4:n.endsWith("Opera\\Launcher.exe")?7:n.endsWith("\\iexplore.exe")?2:0:0},l.prototype.getUriLaunchPolicy=function(){return this._defaultBrowser==4||this._defaultBrowser==3?0:2},l.prototype.getConnectedAccountInfo=function(n){return this._accessTokenManager?this._accessTokenManager.getCachedAccountInfo(n):null},l.prototype.isInternetConnectionMetered=function(){return n.safeExecute(function(){return i.networkEnvironment&&i.networkEnvironment.isMeteredConnection},"isInternetConnectionMetered",!1)},l.prototype.isInputPanelVisible=function(){return n.safeExecute(function(){return r.isInputPaneVisible},"isInputPanelVisible")},l.prototype.uploadClientErrorLog=function(){var o,u,e,t,f,r;if(i.getFlightingLogsAndDelete)for(o=n.safeExecute(function(){return i.getFlightingLogsAndDelete()},"getFlightingLogsAndDelete",""),u=0,e=o.split("\r\n");u<e.length;u++)t=e[u],t!=""&&(f=t.indexOf("|"),f<0||f+1==t.length?SharedLogHelper.LogWarning("clientError",t,"Malformed clientError data"):(r=t.substr(f+1),r.startsWith("Critical:")||r.startsWith("Error:")?SharedLogHelper.LogError("clientError",null,r):SharedLogHelper.LogWarning("clientError",null,r)))},l.prototype.registerFeedbackDebugCallback=function(n){var t=n[1].debugCollector;t.registerCollectionCallback(sj_dm(this,this.collectDebugInfo))},l.prototype.collectDebugInfo=function(){var r={},o=this._currentQuery&&this._currentQuery.originalQuery,u,f;return o&&(r.query=o),r.conversationId=this._currentCVID,r.entryPoint=i.entryPoint,r.previousExperience=e.previousExperience,n.WSB.ConstraintIndex&&(r.ciVersion=n.WSB.ConstraintIndex.currentCIVersion),t.config.snrVersion&&(r.snrVersion=t.config.snrVersion),t.config.osSKU&&(r.ossku=t.config.osSKU.toString()),u=i.width,u&&(r.width=u.toString()),f=i.height,f&&(r.height=f.toString()),r},l.prototype.clearInitialFetchTimer=function(){this._initialFetchTimer&&(sb_ct(this._initialFetchTimer),this._initialFetchTimer=null)},l.prototype.callQueryChangedHandlers=function(t,r,u,f){var e,o;if(this._qfDisabled)throw"Not supported";(e=this.getStructuredQuery(t,null,this._currentQuery),this._rawQueryChangedHandlers.forEach(function(t){return n.safeExecute(function(){return t(e,r)},"rawQueryTextChanged")}),u||this.clearInitialFetchTimer(),f||(o=i.impressionId,this.usedImpressionIds[o]||(f=o,this.usedImpressionIds[o]=!0)),f&&f!=this._currentRawImpressionId?(this._currentRawImpressionId=f,this._currentRawImpressionIdCreatedByTheClient=!0):(this._currentRawImpressionId=this.createGuid(),this._currentRawImpressionIdCreatedByTheClient=!1),u)||(this._previousQuery=this._currentQuery,this._currentQuery=e,this._queryChangedHandlers.forEach(function(t){return n.safeExecute(function(){return t(e,r)},"queryTextChanged")}))},l.prototype.getStructuredQuery=function(r,u,f){var o=r.queryText,c=r.cursorPosition,s,e,h;return u&&u.originalQuery===o&&u.originalCursorPosition===c?u:(s=this._queryPropertiesOverrides&&this._queryPropertiesOverrides.query==o,e=s&&t.isCortanaEnabledCache?this._queryPropertiesOverrides.taskFrame:null,!e&&t.isCortanaEnabledCache&&i.searchResultsView.getTaskFrame&&(h=n.safeExecute(function(){return i.searchResultsView.getTaskFrame(o)},"getTaskFrame"),h&&(e=t.parseTaskFrame(h))),!e&&f&&f.taskFrame&&f.originalQuery==o&&(e=f.taskFrame),t.parseQuery(o,c,f,e,s&&this._queryPropertiesOverrides))},l.prototype.updateState=function(u,f,e){var h=this,o,s;u!=f&&(this._state=f,u==0&&this._appVisibleEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"appVisible")}),f==2&&(this._shownEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"shown")}),e||this._qfDisabled||(o=i.entryPoint=="WNSSTB",this._initialFetchTimer=n.safeSetTimeout(function(){return h.callQueryChangedHandlers(r.getQueryText(),!1,!1)},o?t.config.initialFetchTimerDelayFromStartMenu||0:0,"initialFetch"))),u==2&&(this.clearInitialFetchTimer(),s=this._currentQuery,this._dismissedEventHandlers.forEach(function(t){return n.safeExecute(function(){return t(s)},"dismissed")})),f==0&&this._appHiddenEventHandlers.forEach(function(t){return n.safeExecute(function(){return t()},"appHidden")}))},l.prototype.searchBoxHasFocus=function(){return r.hasFocus},l.prototype.initializeEvents=function(){this.updateState(this._state,i.currentState,!1)},l.prototype.bindClearMRURequested=function(n){this._clearStorageRequestedHandlers&&SharedLogHelper.LogError("bindClearMRURequested",null,new Error("Only one event handler supported"));this._clearStorageRequestedHandlers=n},l.prototype.shouldRequestEltoken=function(){return this._shouldRequestEltoken},l.prototype.getElToken=function(){return this._elToken},l.prototype.setElToken=function(n){this._elToken=n;this._shouldRequestEltoken=!1},l.prototype.sendElToken=function(){this._sendElTokenInSuggstionRequest=!0},l.prototype.canHaveSearchHistory=function(){return t.searchHistoryAllowed()},l.prototype.getInstrumentationParameters=function(n){var t=i.createStringMap?i.createStringMap():{};return _G.nclid&&(t[f.HashedMuid]=_G.nclid),t[f.FormCode]=n||this.getFormCode(),t[f.ConversationId]=this.getConversationId(),t},l.prototype.appHiddenCleanup=function(){t.Promise.clearGlobalCache();this._locStrings=[];t.cleanScopePrefixes();this.cleanTaskBarPinnedItems();t.clearPathExpansionCache()},l.prototype.initLanguage=function(){var r,u,e;t.uiLanguageCache=t.config.th&&ClientTestHooks.getUrlValue(n.Service.QueryParams.SetLang)||i.systemLanguage||i.uiLanguage||"";this.initCortanaEnabledAndRegion();this._queryParamsCache[n.Service.QueryParams.SetLang]=t.uiLanguageCache;var o=this._enUsLocStrings.length==0,s=function(i){var r={uiCulture:"en-US",name:i,namespace:"WindowsSearchBox"},u;o&&f._enUsLocStrings.push(LocStringManager.getLocString(r));t.uiLanguageCache.toLowerCase()!="en-us"&&(r.uiCulture=t.uiLanguageCache,u=n.safeExecute(function(){return LocStringManager.getLocString(r)},"getLocString",null,r.uiCulture),u&&f._locStrings.push(u))},f=this;for(r=0,u=t.config.locStrings;r<u.length;r++)e=u[r],s(e)},l.prototype.appVisibleInit=function(){var r=this;this.initLanguage();n.refreshBingEnabledCache(i.isBingEnabled,t.getMarketForBingAvailability());t.RuntimeConfig.OnAppVisible(this);this._isFileExplorerOrControlPanel=t.RuntimeConfig.QfMode==5||t.RuntimeConfig.QfMode==9;t.setZeroInputDataSourcesForL1();t.isCloudSearchEnabledCache=i.isCloudSearchEnabled!==!1;t.isMultiAccountCloudSearchSupportedCache=i.isMultiAccountCloudSearchSupported!==!1;t.isCloudSearchEnabledMsaCache=t.RuntimeConfig.QfMode==5||(t.isMultiAccountCloudSearchSupportedCache?i.isCloudSearchEnabledForMSA!==!1:t.isCloudSearchEnabledCache);t.isCloudSearchEnabledAadCache=t.RuntimeConfig.QfMode==5||(t.isMultiAccountCloudSearchSupportedCache?i.isCloudSearchEnabledForAAD!==!1:t.isCloudSearchEnabledCache);this.checkIfBitmapInClipboardSupported();this.updateScopeList();this.populateTaskbarPinnedItemsAsync();this._suggestionsContainer.setAttribute("aria-label",this.getLocString("ResultsList"));this._elToken=null;this.refreshAccentColorShades();this.refreshDefaultBrowserInfo();ThresholdUtilities.getThemeColor(function(n,t){r._accentColor=n;r._onAccentColorAndThemeRefreshed.forEach(function(i){return i(n,t)})});ThresholdUtilities.setBodyLangAttributes(t.uiLanguageCache)},l.prototype.refreshAccentColorShades=function(){this._accentColorShades=null;var n=i.themeColors;n&&(this._accentColorShades={dark:[n.accent,n.accentDark1,n.accentDark2,n.accentDark3,],light:[n.accent,n.accentLight1,n.accentLight2,n.accentLight3,]},this._accentColorShades.dark=this._accentColorShades.dark.map(function(n){return"#"+n.substr(3)}),this._accentColorShades.light=this._accentColorShades.light.map(function(n){return"#"+n.substr(3)}))},l.prototype.shownInit=function(){var r=this,u=this._qfDismissCount,e,s,o,h;if(t.RuntimeConfig.QfMode==999999||t.config.enableSnipSearchV2&&i.entryPoint=="WNSSBS"){this._qfDisabled=!0;return}t.RuntimeConfig.QfMode==5&&(e=n.safeExecute(function(){return i.fileExplorerSuggestionPage.currentLocation},"fileExplorerSuggestionPage.currentLocation"),this._fileExplorerCurrentPath=e&&!e.startsWith("::")?e:null);this.initCortanaEnabledAndRegion();s=i.isBingEnabled;s!=n.isBingEnabled()&&(n.refreshBingEnabledCache(s,t.getMarketForBingAvailability()),this.updateScopeList());o=i.homeGeographicRegion;this._queryParamsCache[f.CountryCode]=t.regionCache;o&&o!=t.regionCache&&(this._queryParamsCache[f.HomeGeographicRegion]=o);t.isCortanaEnabledCache&&i.getVcdKeywordsAsync&&t.Promise.safeChain("vcdKeywords",function(){return i.getVcdKeywordsAsync()},function(n){u==r._qfDismissCount&&(r._vcdKeywords=n)});this._accessTokenManager&&(h=function(){return u==r._qfDismissCount},this._accessTokenManager.enumerateMultiAccountAuthority(h,function(){return r.initHeadersOverrides(u)}));this.initHeadersOverrides(u);this.keepWSBOpen(t.config.keepCortanaOpened||t.getTweakedSetting("keepCortanaOpenedTweak"));t.RuntimeConfig.QfMode==8&&(this._queryParamsCache[f.Host]=t.RuntimeConfig.HostName,this._queryParamsCache[f.CortanaVersion]=t.RuntimeConfig.CortanaVersion)},l.prototype.initCortanaEnabledAndRegion=function(){t.isCortanaEnabledCache=i.isCortanaEnabled;t.regionCache=t.config.th&&ClientTestHooks.getUrlValue(n.Service.QueryParams.CountryCode)||(t.config.ignoreCortanaMarketOverride?i.homeGeographicRegion:i.region)||""},l.prototype.updateScopeList=function(){this._scopeListRequiresUpdate.forEach(function(n){return n()})},l.prototype.dismissCleanup=function(){this.keepWSBOpen(!1);delete this._queryParamsCache[f.HomeGeographicRegion];t.windowsAccountType=0;this._queryToIgnoreOnQueryTextChangedEvent=null;this._currentQuery=null;this._vcdKeywords=null;this._fileExplorerCurrentPath=null;t.regionCache=null;this.closeFeedbackForm();this.removeFeedbackForm();this._qfDisabled=!1},l.prototype.closeFeedbackForm=function(){n.safeFireEvent("WindowsFeedback.Form.Hide")},l.prototype.removeFeedbackForm=function(){typeof WindowsFeedbackForm!="undefined"&&WindowsFeedbackForm.Remove&&WindowsFeedbackForm.Remove()},l.prototype.getAccentColor=function(n){if(n===void 0&&(n=0),!Number.isInteger(n))throw"Invalid argument "+n;if(this._accentColorShades){var t=n<0?this._accentColorShades.light:this._accentColorShades.dark,i=Math.min(3,Math.abs(n));return t[i]}return this._accentColor},l.prototype.checkIfBitmapInClipboardSupported=function(){if(i.getClipboardAvailableFormats)try{var n=i.getClipboardAvailableFormats();this._isBitmapInClipboardSupported=n!=null}catch(t){this._isBitmapInClipboardSupported=!1}else this._isBitmapInClipboardSupported=!1},l.prototype.isBitmapInClipboardSupported=function(){return this._isBitmapInClipboardSupported},l.prototype.getBitmapURIFromClipboardAsync=function(r){var u=n.safeExecute(function(){return i.getClipboardAvailableFormats()},"getClipboardAvailableFormats",[]);n.contains(u,"Bitmap")||r(null);t.Promise.safeChain("getClipboardBitmapAsync",function(){return i.getClipboardBitmapAsync()},function(n){return r(URL.createObjectURL(n))},function(){return r(null)})},l.prototype.setAuthHeadersFromWindowsTokens=function(){var n,i,r;this._accessTokenManager&&(n=this._headersCache,t.config.userProfileButtonEnabled?(i=this._accessTokenManager.getSelectedAccountInfo(),i&&(r=i.accountProviderAuthority=="consumers"?0:1,this._accessTokenManager.getAccountByUserName(!1,r,i.accountUserName,!1,!0,function(t){t&&t.Token&&(r==0?n["X-Search-RPSToken"]=t.Token:n.Authorization="Bearer "+t.Token)}))):t.windowsAccountType==2||t.windowsAccountType==4?this._accessTokenManager.getAccount(0,t.getBingResourceOrScope(0),!1,!0,function(t){t&&t.Token&&(n["X-Search-RPSToken"]=t.Token)}):t.windowsAccountType==1&&this._accessTokenManager.getAccount(1,t.getBingResourceOrScope(1),!1,!0,function(t){t&&t.Token&&(n.Authorization="Bearer "+t.Token)}))},l.prototype.initHeadersOverrides=function(n){var u=this,r=[];this._headersCache={};i.systemRAMInMB&&i.systemRAMInMB<=512&&r.push("LowMemoryDevice");r.push("FontV22");r.push("LightAnswers");t.RuntimeConfig.PreviewPaneAvailable&&r.push("PreviewPaneAvailable");t.isSmallerAnswersUX()&&r.push("SmallerAnswers");r.length>0&&(this._headersCache["X-BM-ClientFeatures"]=r.join());this.setAuthHeadersFromWindowsTokens();ThresholdUtilities.getCortanaHeaders(function(i){if(i&&n==u._qfDismissCount){u._shouldRequestEltoken=!!i["X-Search-Location"];var f=i["X-BM-ClientFeatures"];f&&(Array.prototype.push.apply(r,f.split(",")),u._headersCache["X-BM-ClientFeatures"]=r.join());u._safeSearchSetting=i["X-Search-SafeSearch"];u._isEducationEnvironment=i["X-Device-EnableRegulatoryPsm"]=="1";u._isWindowsS=i["X-Device-EnableCPsm"]=="1";u._partnerSearchCode=i["X-Device-PSC"];t.substrateProvidersEnabled()||u.updateScopeList();typeof BingAtWork!="undefined"&&BingAtWork&&BingAtWork.wsb&&BingAtWork.wsb.cortanaToken&&(delete i["X-Search-RPSToken"],i.Authorization="Bearer "+BingAtWork.wsb.cortanaToken)}})},l.prototype.createGuid=function(){return n.safeExecute(function(){return i.createGuid()},"createGuid","")},l.prototype.getLocString=function(t){for(var i,u,e,o,f=[],r=1;r<arguments.length;r++)f[r-1]=arguments[r];for(u=0,e=this._locStrings;u<e.length;u++)if(o=e[u],i=o[t],i)break;return i||(i=this.getEnUsLocString(t)),i&&f.length>0&&(i=n.formatString(i,f)),i},l.prototype.getEnUsLocString=function(n){for(var u,r,t=0,i=this._enUsLocStrings;t<i.length;t++)if(u=i[t],r=u[n],r)return r;return undefined},l.prototype.getRawImpressionGuid=function(){return this._currentRawImpressionId},l.prototype.getConversationId=function(){return this._currentCVID},l.prototype.getPrivacyNumber=function(){return this._randomPrivacyNumber},l.prototype.getNewConversationId=function(){var t=n.cleanGuid(n.safeExecute(function(){return e.perfMetrics.conversationId},"conversationId"));return t||(SharedLogHelper.LogWarning("getNewConversationId",null,new Error("Client returned null conversation ID")),t=n.cleanGuid(this.createGuid())),t},l.prototype.getNewPrivacyNumber=function(){return Math.floor(Math.random()*Number.MAX_VALUE)},l.prototype.keyDownEscapeHandler=function(){var t={handled:!1};this._keyEscapeHandlers.forEach(function(i){return n.safeExecute(function(){return i(t)},"escapeKey")});t.handled||n.safeExecute(function(){return SearchAppWrapper.CortanaApp.dismissApp()},"dismissApp");return},l.prototype.bindQueryChangedOrInitialized=function(n,t){t?this._rawQueryChangedHandlers.push(n):this._queryChangedHandlers.push(n)},l.prototype.bindOnSubmit=function(n){this._onSubmitHandlers.push(n)},l.prototype.bindOnFeedbackClosing=function(n){this._onFeedbackClosingHandlers.push(n)},l.prototype.bindSearchBoxGlyphIconClick=function(n){this._onSearchBoxGlyphIconClick.push(n)},l.prototype.bindSearchBoxClick=function(n){this._onSearchBoxClick.push(n)},l.prototype.bindButtonRightOfSearchBoxClick=function(n){this._onButtonRightOfSearchBoxClick.push(n)},l.prototype.bindSearchBoxGotFocus=function(n){this._searchBoxGotFocusEventHandlers.push(n)},l.prototype.bindSearchBoxLostFocus=function(n){this._searchBoxLostFocusEventHandlers.push(n)},l.prototype.getModifierKeyState=function(){return this._modifierKeyState},l.prototype.notifyBootstrapDone=function(){this._bootstrapDoneEventHandlers.forEach(function(n){return n()})},l.prototype.bindBootstrapDone=function(n){this._bootstrapDoneEventHandlers.push(n)},l.prototype.bindAppVisible=function(n){this._appVisibleEventHandlers.push(n)},l.prototype.bindShown=function(n){this._shownEventHandlers.push(n)},l.prototype.bindConversationStart=function(n){this._conversationStartEventHandlers.push(n)},l.prototype.bindDismissed=function(n){this._dismissedEventHandlers.push(n)},l.prototype.bindAppHidden=function(n){this._appHiddenEventHandlers.push(n)},l.prototype.bindKeyEscape=function(n){this._keyEscapeHandlers.push(n)},l.prototype.bindKeyDown=function(n){this._keyDownHandlers.push(n)},l.prototype.bindKeyUp=function(n){this._keyUpHandlers.push(n)},l.prototype.bindAccessTokenAvailable=function(n){this._accessTokenAvailableHandlers.push(n)},l.prototype.bindAccentColorAndThemeRefreshed=function(n){this._onAccentColorAndThemeRefreshed.push(n)},l.prototype.bindFilesDrop=function(n){this._fileDropHandlers.push(n)},l.prototype.bindScopeListRequiresUpdate=function(n){this._scopeListRequiresUpdate.push(n)},l.prototype.bindAccountChanged=function(n){this._accountChangedHandlers.push(n)},l.prototype.getQuery=function(){return this.getStructuredQuery(r.getQueryText(),this._currentQuery,this._previousQuery)},l.prototype.refreshCurrentPane=function(){var n=this._currentQuery?this._currentQuery.originalQuery:"";this.setQuery(n,!1,!0)},l.prototype.keepWSBOpen=function(n){var r=i.hostingEnvironment==3;!r&&i.changeExplicitDismissMode&&(!n&&t.config.changeExplicitDismissModeFixEnabled&&i.changeExplicitDismissMode(!0),i.changeExplicitDismissMode(n))},l.prototype.notifyAccountSelected=function(n){this.setAuthHeadersFromWindowsTokens();this.refreshCurrentPane();this._accountChangedHandlers.forEach(function(t){return t(n)})},l.prototype.updateQueryWithoutRefetching=function(n){t.isNullOrUndefined(n)&&(n=this._currentQuery?this._currentQuery.originalQuery:"");this.setQuery(n,!1,!1)},l.prototype.reformulate=function(n,t,i,r,u,f){var e={query:n,taskFrame:t,topHitRestriction:i,forceGroupOnTop:r,inorganic:u,serpURLParams:f};this.setQuery(n||"",!0,!1,e)},l.prototype.reformulateOverrideAction=function(n,t,i){var r={query:n,overrideAction:t,overrideActionHandlerAsync:i};this.setQuery(n||"",!0,!1,r)},l.prototype.setQuery=function(u,f,e,o){var s=this,h,c,l,a;if(t.isNullOrUndefined(u))throw new Error("query parameter can't be null");if(!f&&o)throw new Error("Property overrides only allowed on query reformulations");h=!f&&!e;this._queryPropertiesOverrides=o;h&&(this._queryToIgnoreOnQueryTextChangedEvent=u);c=!!t.config.setQueryKeyboardNavParamAvailable&&h&&r.getQueryText().queryText!=u;n.safeExecute(function(){return r.setQueryText(u,f,s._currentRawImpressionIdCreatedByTheClient?s._currentRawImpressionId:i.impressionId,c)},"setQueryText");l=f&&this.getQuery().originalQuery==u||e;l&&(a=function(){return s.callQueryChangedHandlers({queryText:u,cursorPosition:u.length},e,!1)},n.safeExecute(a,"triggerQueryTextChangedEvent"))},l.prototype.setAutoCompleteQueryText=function(t){var i=this;n.safeExecute(function(){return r.setAutoCompleteQueryText(t,i._currentRawImpressionId)},"setAutoCompleteQueryText")},l.prototype.manuallyDismissApp=function(){t.config.manuallyDismissApp&&!t.isMobileCache&&SearchAppWrapper.CortanaApp.dismissApp()},l.prototype.launchUri=function(n,i,r,f){var e=this,o=function(n){n?(r&&r(),e.manuallyDismissApp()):f&&f()};t.isMobileCache?t.Promise.safeChain("launchUri",function(){return u.launchUriAsync(n)},o,f):t.Promise.safeChain("launchUri",function(){var t=u.createUriLaunchOptions();return t.launchPolicy=e.getUriLaunchPolicy(),t.dismissAppBeforeLaunchingURI=i,u.launchUriAsync(n,t)},o,f)},l.prototype.launchOutlook=function(n,i,r){var f=this;t.Promise.safeChain("launchOutlook",function(){return u.launchEmailInOutlookNativeAsync(n)},function(n){n?(i&&i(),f.manuallyDismissApp()):r&&r()},r)},l.prototype.submitFileExplorerTextSuggestion=function(t){n.safeExecute(function(){return i.fileExplorerSuggestionPage.onSuggestionSelection(t)},"submitFileExplorerTextSuggestion")},l.prototype.submitFileExplorerFolderSuggestion=function(t){n.safeExecute(function(){return i.fileExplorerSuggestionPage.onFolderSelection(t)},"submitFileExplorerFolderSuggestion")},l.prototype.populateTaskbarPinnedItemsAsync=function(){var n=this,i=this._qfDismissCount;t.config.pinnedToTaskBarSignalEnabled&&!t.isMobileCache&&e.deviceSearch.getTaskbarPinnedItemsAsync&&t.Promise.safeChain("pinnedTaskBarItems",function(){return e.deviceSearch.getTaskbarPinnedItemsAsync()},function(t){i==n._qfDismissCount&&t&&t.forEach(function(t){return n._pinnedApps[t]=!0})})},l.prototype.removeItemFromPinnedToTaskbar=function(n){this._pinnedApps[n]=!1},l.prototype.addItemToPinnedToTaskbar=function(n){this._pinnedApps[n]=!0},l.prototype.cleanTaskBarPinnedItems=function(){this._pinnedApps={}},l.prototype.isPinnedToTaskbar=function(n){return this._pinnedApps[n]},l.prototype.launchSearchInFileExplorer=function(t){i.launcher.launchExplorerSearch?n.safeExecute(function(){return i.launcher.launchExplorerSearch("query="+n.encodeURIComponentForWindowsProtocol(t)+"&crumb=kind:docs&crumb=location:")},"launchExplorerSearch"):n.safeExecute(function(){return i.launcher.launchSearchInApp(1,t)},"launchSearchInApp")},l.prototype.matchesVcd=function(n){var t,r,i,u,f,e;if(this._vcdKeywords&&n&&(t=c(n),t))for(r in this._vcdKeywords)if(this._vcdKeywords.hasOwnProperty(r)&&(i=c(r),i&&(u=t.indexOf(i),u>=0&&((f=this._vcdKeywords[r],f&1)||f&2&&u==0||f&4&&(u==t.length-i.length||(e=t.lastIndexOf(i),e==t.length-i.length))))))return!0;return!1},l.prototype.isRequestFocusAvailable=function(){return!!r.requestFocus},l.prototype.setFocusInSearchBox=function(t,i){var u,f,e;this.isRequestFocusAvailable()&&(u=function(){return r.requestFocus()},f="requestFocus",t==9?n.safeSetTimeout(u,0,f,i):n.safeExecute(u,f,null,i),e=n.getCurrentActiveElement(),e&&e.blur())},l.prototype.setFocusInWebView=function(t){i.focusWebView&&n.safeExecute(function(){return i.focusWebView()},"focusWebView",null,t)},l.prototype.getFeatureEnabled=function(t){var r={validFeature:!1,featureEnabled:!1};return i.getFeatureEnabled?n.safeExecute(function(){return i.getFeatureEnabled(t)},"getFeatureEnabled",r,t):r},l.prototype.getFeatureDWORD=function(t){var r={validFeature:!1,featureValue:0};return i.getFeatureDWORD?n.safeExecute(function(){return i.getFeatureDWORD(t)},"getFeatureDWORD",r,t):r},l.prototype.getFeatureString=function(t){var r={validFeature:!1,featureValue:""};return i.getFeatureString?n.safeExecute(function(){return i.getFeatureString(t)},"getFeatureString",r,t):r},l.prototype.launchInApp=function(i,u,f){this.updateQueryWithoutRefetching(u);n.safeExecute(f,i);t.isMobileCache&&r.requestUnfocus&&n.safeExecute(function(){return r.requestUnfocus()},"requestUnfocus",null,i)},l.prototype.launchVoiceFlow=function(n){var t=this;this.launchInApp("launchVoiceFlow",n,function(){return u.launchRAFAsync(n,t.getFormCode(),t.getInstrumentationParameters())})},l.prototype.launchSearch=function(n,i,r){r&&!t.config.disableRAF?this.launchVoiceFlow(n):t.isMobileCache?this.launchInApp("launchSearch",n,function(){var t=u.createSearchLaunchOptions();t.searchQuery=n;var r=i.indexOf("/search"),f=i.indexOf("/",i.indexOf("//")+2),e=f==r?"":i.substring(f+1,r);e&&(t.pivot=e);t.mode=1;t.uriContext=i.substr(i.indexOf("&")+1);u.launchSearchAsync(t)}):this.launchUri(i)},l.prototype.launchCat1=function(n,t,r){var o=this,f=v[t],e;f?this.launchInApp("launch"+f,n,function(){return i.launchExperienceByName(f,null)}):(e=y[t],e?this.launchUri(e):this.launchInApp("launchCat1",n,function(){return u.launchCat1Async(n,r,o.getInstrumentationParameters())}))},l.prototype.launchCat2or3a=function(n,t){var i=this;this.launchInApp("launchCat2",n,function(){return u.launchCat2Async(n,i.getFormCode(),t,i.getInstrumentationParameters())})},l.prototype.launchStoreSearch=function(i){var r="ms-windows-store:search?query="+n.encodeQueryParameter(i)+"&ocid="+n.encodeQueryParameter(t.config.storeHandoffTag)+"&type=apps";this.launchUri(r)},l.prototype.launchFolder=function(t){n.safeExecute(function(){return u.startLaunchFolder(t)},"launchFolder")},l.prototype.launchWindowsCortanaSettings=function(){this.launchUri("ms-settings:cortana")},l.prototype.launchWindowsIndexingOptions=function(){t.LocalDataProvider.launchIndexingOptions(this,!1)},l.prototype.launchCortanaSignIn=function(){this.launchUri("ms-cortana://CapabilitiesPrompt/?RequestedCapabilities=Personalization")},l.prototype.launchCortanaNotebook=function(){this.launchUri("ms-cortana://StartMode=Notebook")},l.prototype.launchCortanaDevices=function(){this.launchUri("ms-cortana://StartMode=Devices")},l.prototype.launchWindowsAccountSettings=function(){this.launchUri("ms-settings:emailandaccounts")},l.prototype.launchSearchSettings=function(){this.launchUri("ms-settings:cortana-windowssearch")},l.prototype.launchSearchDetails=function(){this.launchUri("ms-settings:search-moredetails")},l.prototype.launchSearchPermissions=function(){this.launchUri("ms-settings:search-permissions")},l.prototype.launchLockscreenSettings=function(){this.launchUri("ms-settings:personalization-lockscreen")},l.prototype.getErrorCodeToIgnoreOnLaunch=function(n){return t.isIndexerBasedDataSource(n)||n=="PT"?-2147467263:undefined},l.prototype.launchDeviceItem=function(r,f){var s=this,e=r.id,o=f,h,c;t.localDataSourceMayContainPII(f)||(o+="\n"+e);e.startsWith("shell:")?n.safeExecute(function(){return u.startLaunchFolder(e)},"launchDeviceItem",null,o):(h=function(){if(s._isFileExplorerOrControlPanel)i.fileExplorerSuggestionPage.onFileSelection(r);else s.manuallyDismissApp()},c=r.originalDeviceItem||r,t.Promise.safeChain("launchDeviceItem",function(){return u.launchSearchItemAsync(c)},h,null,null,o,this.getErrorCodeToIgnoreOnLaunch(f)))},l.prototype.launchAppItem=function(i,r,f){var h=this,e=i.id,o=r+"\n"+e,s;f&&o+"\n"+f;e.startsWith("shell:")?n.safeExecute(function(){return u.startLaunchFolder(e)},"launchAppItem",null,o):(s=i.originalDeviceItem||i,t.Promise.safeChain("launchAppItem",function(){var n;return f&&(n=u.createAppLaunchOptions(),n.appContext=f),u.launchSearchItemAsync(s,n)},function(){return h.manuallyDismissApp()},null,null,o,this.getErrorCodeToIgnoreOnLaunch(r)))},l.prototype.launchWebContent=function(n,t,i){this.launchInApp("launchWebContent",t,function(){var t=u.createWebContentLaunchOptions();t.uri=n;i&&t.setAuthorization("Bearer",i);u.launchWebContent(t)})},l.prototype.launchPrivacyPortal=function(){this.launchUri("https://go.microsoft.com/fwlink/?LinkId=780764")},l.prototype.getCustomUrlParameters=function(i){var r=Object.assign({},this._queryParamsCache),u=i.scope;return u==t.Scope.All?delete r[f.Scope]:r[f.Scope]=t.Scope[u].toLowerCase(),t.searchHistoryAllowed()||(r[n.Service.QueryParams.NoHistory]="1"),this._sendElTokenInSuggstionRequest&&(r[n.Service.QueryParams.ElTokenValue]=this._elToken),r},l.prototype.getCustomHeaders=function(n){var i=Object.assign({},this._headersCache),r;return n&&n.scope==t.Scope.Apps||(r=(i["X-BM-ClientFeatures"]||"").split(","),r.push("RevStore"),i["X-BM-ClientFeatures"]=r.join()),i},l.prototype.reloadWebView=function(){t.Promise.safeChain("reloadWebViewAsync",function(){return i.reloadWebViewAsync()})},l.prototype.throwIfResourcesMissing=function(){var t=_ge("cssCanary"),n=_w.getComputedStyle(t).fontFamily;if(n!="CANARY"&&n!='"CANARY"')throw new Error("Missing CSS Bundle");},l.prototype.getFormCode=function(){switch(t.RuntimeConfig.QfMode){case 6:return"WNSALK";case 8:return"W10XLS";default:return"WNSGPH"}},l.prototype.getRegion=function(){return t.regionCache},l.prototype.getLanguage=function(){return t.uiLanguageCache},l.prototype.dataSourceDependencies=function(t){return t==n.WebDataSource?["OSTMA","QS"]:[]},l.prototype.getPaneCloseCount=function(){return this._paneCloseCount},l.prototype.hasFallbackHappened=function(){return this._hasFallbackHappened},l.prototype.getSafeSearchSetting=function(){return this._safeSearchSetting},l.prototype.isEducationEnvironment=function(){return this._isEducationEnvironment},l.prototype.isWindowsS=function(){return this._isWindowsS},l.prototype.getPartnerSearchCode=function(){return this._partnerSearchCode},l.prototype.getMSNRefIg=function(){return null},l.prototype.setSearchBoxGlyphIcon=function(t){var i,u,f;r.setSearchBoxGlyphIcon&&(t?(i=t.content||"",i.startsWith("&#x")&&(u=parseInt(i.substr(3),16),i=u?String.fromCharCode(u):""),f=t.type==2?"/Assets/Fonts/CortMDL2.ttf#Cortana MDL2 Assets":"",n.safeExecute(function(){return r.setSearchBoxGlyphIcon(i,f)},"setSearchBoxGlyphIcon custom")):n.safeExecute(function(){return r.setSearchBoxGlyphIcon("","")},"setSearchBoxGlyphIcon default"))},l.prototype.adjustHeightWithoffset=function(){},l.prototype.adjustHeight=function(){var f=this,r,u;t.RuntimeConfig.PanelCanResize&&i.setWebViewHeight&&(this._pendingAdjustHeightTimer&&(sb_ct(this._pendingAdjustHeightTimer),this._pendingAdjustHeightTimer=null),t.config.th&&ClientTestHooks.getUrlValueNumber("clientversion")&&(s?this._rootContainer.style.height="auto":this._root.style.height="auto"),r=this._feedbackFormIsVisible?a:this._root.offsetHeight,s&&(r+=36),u=function(){r*=i.textScaleFactor||1;i.isCenterScreen&&i.setCenterScreenAcrylicBackgroundHeight(r+2);i.setWebViewHeight(r);f._currentPaneHeight=r;f._pendingAdjustHeightTimer=null},!t.config.paneResizeDelay||r>=this._currentPaneHeight?u():this._pendingAdjustHeightTimer=n.safeSetTimeout(u,t.config.paneResizeDelay,"adjustHeight"))},l.prototype.isClientLocationAvailable=function(){return this._shouldRequestEltoken||!!this._elToken},l.prototype.getFileExplorerCurrentPath=function(){if(t.RuntimeConfig.QfMode!=5)throw"Not supported";return this._fileExplorerCurrentPath},l}();t.Host=p})(t=n.WSB||(n.WSB={}))})(AutoSuggest||(AutoSuggest={}))