HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
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)}}(),__spreadArrays,WSB;(function(n){function f(t,r,u,f,e,o,s,h){i(t,r,u,function(t){var i=null;t.status==200&&(i=t.responseText?n.safeExecute(function(){return JSON.parse(t.responseText)},"JSON.parse"):{success:!0});f(i)},e,o,s,h)}function i(i,r,u,f,e,o,s,h,c){var l=c&&_w.XMLHttpRequest?new XMLHttpRequest:sj_gx(),v,a;try{l.open(u?"POST":"GET",i,!0)}catch(y){SharedLogHelper.LogError("fetchUrl",i,y);f&&f({responseText:"",contentType:"",status:-1,result:3});return}if(r)for(v in r)l.setRequestHeader(v,r[v]);e&&(a=e.register(function(){return l.abort()},!1,"xhr abort"));n.config.useEventListeners?(l.addEventListener("load",function(){t(l,0,f,a,e,o)}),l.addEventListener("timeout",function(){t(l,1,f,a,e,o)}),l.addEventListener("abort",function(){t(l,2,f,a,e,o)}),l.addEventListener("error",function(){t(l,3,f,a,e,o)})):(l.onreadystatechange=function(){l.readyState==4&&l.status>0&&t(l,0,f,a,e,o)},l.ontimeout=function(){return t(l,1,f,a,e,o)},l.onabort=function(){return t(l,2,f,a,e,o)},l.onerror=function(){return t(l,3,f,a,e,o)});typeof s!="undefined"?l.withCredentials=s:l.withCredentials!==undefined&&(l.withCredentials=!0);h&&h>0&&(l.timeout=h);l.send(u)}function t(n,t,i,r,u,f){(!f||f())&&(n.readyState==4&&(n.onreadystatechange=function(){}),r&&u.unregister(r),i&&i({responseText:n.responseText,contentType:n.getResponseHeader("content-type")||"",status:n.status,result:t}))}function e(n){var t=n.IconContent;return t?t[0]=="S"?{content:t.slice(1),type:1}:{content:t,type:2}:n.Icon?{content:n.Icon,type:0}:null}var r,u;n.fetchUrlJson=f;n.fetchUrl=i;r=function(){function t(t){this._dataSource=t;this._delay=n.config.webDataSourcesWithThrottling[t]||0;this._timers=[]}return t.prototype.getBaseUrl=function(){throw new Error("Not Implemented");},t.prototype.getPostBody=function(){return undefined},t.prototype.onBeforeFetchUrl=function(){},t.prototype.createUrl=function(t){return decodeURIComponent(this.getBaseUrl())+(t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"")},t.prototype.addParamsToUrl=function(n,t){var i=t?Object.keys(t):[];return i.length>0&&(n+=n.includes("?")?"&":"?",n+=i.map(function(n){return n+"="+t[n]}).join("&")),n},t.prototype.fetch=function(t,i,r,u,f,e,o,s,h,c){var p=this,l,v,a,y,w;if(n.isDataSourceEnabled(this._dataSource,t)){if(l=this.addParamsToUrl(this.createUrl(t),e),v=this.getPostBody(t)||"",this._lastSequenceNumber!=r){for(a=0,y=this._timers;a<y.length;a++)w=y[a],sb_ct(w);this._timers=[];this._lastSequenceNumber=r}if(this._delay>0&&!t.isFormulatedQuery)this._timers.push(n.safeSetTimeout(function(){p.onBeforeFetchUrl(r,l);p.fetchUrl(l,o,v,i,u,f,s,h,c)},this._delay,"fetchDelay"));else{this.onBeforeFetchUrl(r,l);this.fetchUrl(l,o,v,i,u,f,s,h,c)}}},t.prototype.fetchUrl=function(t,r,u,f,e,o,s,h,c){var l=this;i(t,r,u,function(i){var r=i.responseText,o=i.contentType,u=i.status,e;u==200&&(n.TestHookUrlParameters&&r&&(r=r.replace(new RegExp("<!--[^]*?-->","gm"),"")),r&&o.includes("json")&&(e=n.safeExecute(function(){return JSON.parse(r)},"parseWebProviderResponse",null,t)));f(l._dataSource,e,u==200?null:u.toString())},this._delay>0?e:null,o,h,s,c)},t}();n.JsonDataProvider=r;u=function(t){function i(n,i){var r=t.call(this,"Web")||this;return r._instrumentationHelper=n,r._responseCacheManager=i,r}return __extends(i,t),i.prototype.getName=function(){return"AsSuggestionsDataProvider"},i.prototype.getBaseUrl=function(){return n.config.u},i.prototype.onBeforeFetchUrl=function(n,t){this._instrumentationHelper.instrumentSnRProviderFetchUrl(n,t)},i.prototype.fetch=function(i,r,u,f,e,o,s){var c=this,h;n.isDataSourceEnabled(this._dataSource,i)&&(h=r,h=function(t,u,f,e){u&&n.isEmptyUrlPrefix(i)&&(u.Suggestions=[]);c.processResourceResponse(u);r(t,u,f,e)},this._responseCacheManager?this.fetchWithCache(i,h,u,f,e,o,s):t.prototype.fetch.call(this,i,h,u,f,e,o,s))},i.prototype.fetchWithCache=function(n,i,r,u,f,e,o){var h=this,c=this._responseCacheManager.get(n),l,a,s;if(c){l=this.addParamsToUrl(this.createUrl(n),e);this.onBeforeFetchUrl(r,l);i(this._dataSource,c,null,1)}else a=function(){return!0},s=i,s=function(t,r,u){f()&&i(t,r,u,0);n.queryToFetch&&h.responseIsValidForCaching(u,r)&&(r.ELToken&&(r=Object.assign({},r),delete r.ELToken),h._responseCacheManager.put(n,r))},t.prototype.fetch.call(this,n,s,r,u,a,e,o)},i.prototype.responseIsValidForCaching=function(n,t){var i="HS";return!n&&t&&t.Suggestions.every(function(n){return!n.InstantAnswer&&n.Attributes.stype!=i})},i.prototype.processResourceResponse=function(n){var t,i;n&&(t=n.Resources,t)&&(this._downloadedStylesResources?this.updateWithDownloadedResources(t):this._downloadedStylesResources=t.Styles,i={Styles:t.Styles,Scripts:null},JsonInject.WriteHeadAndBeforeContentResources(i))},i.prototype.updateWithDownloadedResources=function(n){var t,i;for(t in n.Styles)for(i in n.Styles[t])this._downloadedStylesResources[t][i]?delete n.Styles[t][i]:this._downloadedStylesResources[t][i]=n.Styles[t][i]},i}(r);n.AsSuggestionsDataProvider=u;n.getIconFromOnlineResponse=e})(WSB||(WSB={})),function(n){var t;(function(t){function f(n,t,i,r,f){typeof indexedDB!="undefined"&&new u(n,f,t,i,r)}function e(n,t,i,r,f){typeof indexedDB!="undefined"&&new u(n,f,t,i,r)}function o(n,t,i,r,f,e){typeof indexedDB!="undefined"&&new u(n,e,t,i,r,f)}function s(n,t,i,r,f,e){typeof indexedDB!="undefined"&&new u(n,e,t,i,r,f)}function h(n,t,u){i(n,"deleteDatabase requested");try{var f=indexedDB.deleteDatabase(n);f.onsuccess=function(){i(n,"deleteDatabase completed");t&&t()};f.onerror=r("deleteDatabase.onError",function(t){SharedLogHelper.LogError("deleteDB",n,t);u&&u(t)})}catch(e){u&&u(e)}}function r(n,t){return function(i){var r=n;try{r+=" "+i.target.error.name}catch(u){}t(new Error(r))}}var i,u;t.instanceWithNumberKeys=f;t.instanceWithStringKeys=e;t.instanceWithNumberKeysAndSecondaryKey=o;t.instanceWithStringKeysAndSecondaryKey=s;i=(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.dbTrace)?function(t,i){return n.log("["+t+"] "+i)}:function(){};t.deleteDatabase=h;t.handleErrorEvent=r;u=function(){function t(n,u,f,e,o,s){var h=this,c;this._databaseName=n;this.onClosed=o;this._secondaryIndex=s;this._closePending=!1;this._storeName=n+"Store";i(this._databaseName,"open requested");try{c=indexedDB.open(n,u||1)}catch(l){e(new Error("IndexedDbClientSideStorage.const: Could not open database"));return}c.onsuccess=function(n){h._database=n.target.result;t._allInstances.push(h);i(h._databaseName,"open completed");f(h)};c.onupgradeneeded=function(n){var t,r;i(h._databaseName,"upgrading");t=n.target.result;t.objectStoreNames.contains(h._storeName)&&t.deleteObjectStore(h._storeName);r=t.createObjectStore(h._storeName);h._secondaryIndex&&r.createIndex(h._secondaryIndex,h._secondaryIndex,{unique:!1})};c.onerror=r("open.onError",e);c.onblocked=r("open.onBlocked",e)}return t.prototype.put=function(n,t,i,r){this.safeDbOperation("put",n.toString(),"readwrite",i,function(i,r,u){var f=i.put(t,n);f.onsuccess=r;f.onerror=u},r)},t.prototype.putMultiple=function(n,t,i){this.safeDbOperation("putMultiple",n.length.toString(),"readwrite",t,function(t,i,r){var u=0,f=function(){if(u<n.length){var e=t.put(n[u].value,n[u].key);u+=1;e.onsuccess=u==n.length?i:f;e.onerror=r}};f()},i)},t.prototype.getValue=function(n,t,i){this.safeDbOperation("getValue",n.toString(),"readonly",function(n){return t(n.target.result)},function(t,i,r){var u=t.get(n);u.onsuccess=i;u.onerror=r},i)},t.prototype.getRange=function(n,t,i,r){var u=this;this.safeDbOperation("getRange","["+n+", "+t+")","readonly",i,function(i,r,f){var e=IDBKeyRange.bound(n,t,!1,!0);u.queryFromCursor(i.openCursor(e),r,f)},r)},t.prototype.getRangeOnSecondaryKey=function(n,t,i,r){var u=this;this._secondaryIndex?this.safeDbOperation("getRangeOnSecondaryKey","["+n+", "+t+")","readonly",i,function(i,r,f){var e=i.index(u._secondaryIndex),o=IDBKeyRange.bound(n,t,!1,!0);u.queryFromCursor(e.openCursor(o),r,f)},r):r(new Error("getRangeOnSecondaryKey: Index name is missing"))},t.prototype.removeRange=function(n,t,i,r){var u=this;this.safeDbOperation("removeRange","["+n+","+t+"]","readwrite",i,function(i,r,f){var e=IDBKeyRange.bound(n,t,!1,!0);u.removeFromCursor(i.openCursor(e),r,f)},r)},t.prototype.removeRangeOnSecondaryKey=function(n,t,i,r){var u=this;this._secondaryIndex?this.safeDbOperation("removeRangeOnSecondaryKey","["+n+","+t+"]","readwrite",i,function(i,r,f){var e=i.index(u._secondaryIndex),o=IDBKeyRange.bound(n,t,!1,!0);u.removeFromCursor(e.openCursor(o),r,f)},r):r(new Error("removeRangeOnSecondaryKey: Index name is missing"))},t.prototype.getAll=function(n,t){var i=this;this.safeDbOperation("getAll",null,"readonly",n,function(n,t,r){return i.queryFromCursor(n.openCursor(),t,r)},t)},t.prototype.close=function(){i(this._databaseName,"close requested");this.innerClose()},t.prototype.innerClose=function(){var f,e,r,u,o;if(t._requestsInProgress>0)i(this._databaseName,"delaying close because of "+t._requestsInProgress+" requests in progress"),this._closePending=!0;else for(f=function(t){t._database&&(n.safeExecute(function(){return t._database.close()},e._databaseName+".close"),i(t._databaseName,"close completed"),t._database=null,t.onClosed())},e=this,r=0,u=t._allInstances;r<u.length;r++)o=u[r],f(o)},t.prototype.queryFromCursor=function(t,i,r){var u=[];t.onsuccess=function(t){var r=t.target.result;r&&u.push({key:r.primaryKey,value:r.value});r&&u.length!=n.config.maxIndexedDBCursorIterations?r["continue"]():i(u)};t.onerror=r},t.prototype.removeFromCursor=function(t,i,r){var u=0;t.onsuccess=function(t){var r=t.target.result;r&&(r["delete"](),u+=1);r&&u!=n.config.maxIndexedDBCursorIterations?r["continue"]():i(null)};t.onerror=r},t.prototype.safeDbOperation=function(n,u,f,e,o,s){var h=this,l,c,a;i(this._databaseName,n+" requested"+(u?" "+u:""));t._requestsInProgress+=1;l=function(r){i(h._databaseName,n+" completed "+(u?u+" ":""));t._requestsInProgress-=1;e(r);h._closePending&&t._requestsInProgress==0&&h.innerClose()};c=function(n){t._requestsInProgress-=1;s(n);h._closePending&&t._requestsInProgress==0&&h.innerClose()};try{this._database?(a=this._database.transaction(this._storeName,f).objectStore(this._storeName),o(a,l,r(n+".onError",c))):c(new Error(n+" Database not initialized"))}catch(v){c(v)}},t._requestsInProgress=0,t._allInstances=[],t}()})(t=n.ClientSideStorage||(n.ClientSideStorage={}))}(WSB||(WSB={})),function(n){var t;(function(t){var i=function(){function t(t,i,r,u,f){var e=this;this._storageFactory=t;this.createResponse=i;this.dataPopulated=r;this.getDataSourceState=u;this._dataSource=f;this._storageOpenInProgress=!1;this._pendingQueries=[];n.Host&&(n.Host.bindAppVisible(function(){return e.initStorage()}),n.Host.bindDismissed(function(){return e._pendingQueries=[]}),n.Host.bindAppHidden(function(){return e.teardownStorage()}))}return t.prototype.teardownStorage=function(){this._storage&&this._storage.close()},t.prototype.initStorage=function(){var n=this;!this._storageOpenInProgress&&this.dataPopulated()&&(this._storageOpenInProgress=!0,this._storageFactory(function(t){n._storage=t;n._storageOpenInProgress=!1;n._pendingQueries.forEach(function(n){return n()});n._pendingQueries=[]},function(t){n.onError(t,"open storage");n._storageOpenInProgress=!1;n._pendingQueries.forEach(function(n){return n()});n._pendingQueries=[]},function(){return n._storage=null}))},t.prototype.onError=function(n,t){t!="open storage"&&SharedLogHelper.LogError(t,this._dataSource,n);this.teardownStorage()},t.prototype.reloadStorage=function(){this.teardownStorage();this.initStorage()},t.prototype.isReady=function(){return!!this._storage},t.prototype.getKey=function(n){return n.queryToFetch?n.queryToFetch.toLocaleLowerCase():""},t.prototype.fetch=function(t,i,r,u,f){var o=this,e;n.isDataSourceEnabled(this._dataSource,t)&&(e=function(n,r){var u=r=="R";f()&&i(o._dataSource,o.createResponse(t,n,u),o.getDataSourceState(r))},this.innerQueryStorage(1,this.getKey(t),function(n){return e(n,"R")},function(){return e(null,"E")},function(){return e(null,"X")},function(){return e(null,"T")}))},t.prototype.withStorage=function(n){return this._storage?(n(this._storage),!0):!1},t.prototype.getMaxKey=function(n){return n.slice(0,n.length-1)+String.fromCharCode(n.charCodeAt(n.length-1)+1)},t.prototype.getStorage=function(n,t,i,r){this.innerQueryStorage(null,null,function(t){return n(t)},t,i,r)},t.prototype.queryStorage=function(n,t,i,r,u){this.innerQueryStorage(0,n,t,i,r,u)},t.prototype.innerQueryStorage=function(t,i,r,u,f,e){var h=this,o=null,s=!1,c=!0,a=function(){if(c)if(c=!1,h._storage){var n=function(n){o&&sb_ct(o);h.onError(n,"query");s||(s=!0,u())};t==0?h._storage.getValue(i,function(n){o&&sb_ct(o);s||(s=!0,r(n))},n):i?h._storage.getRange(i,h.getMaxKey(i),function(n){o&&sb_ct(o);s||(s=!0,r(n))},n):h._storage.getAll(function(n){o&&sb_ct(o);s||(s=!0,r(n))},n)}else o&&sb_ct(o),s||(s=!0,u())},l;if(this._storage)a();else if(this.initStorage(),this._storageOpenInProgress)this._pendingQueries.push(a);else{f();return}l=i?n.config.indexedDBTimeout:n.config.latencyTimeoutForZeroInput;l&&(o=n.safeSetTimeout(function(){o=null;c=!1;s||(s=!0,e())},l,"innerQueryStorage"))},t}();t.StorageBasedDataProvider=i})(t=n.ClientSideStorage||(n.ClientSideStorage={}))}(WSB||(WSB={})),function(n){var t=function(){function t(n,t,i){this._instrumentationHelper=n;this._navigationHelper=t;this._temporaryMessageHandler=i}return t.prototype.parse=function(t,i,r,u,f,e,o){var c=this,l=[],a=[],v=[],y=[],p=[],w=[],b=[],k,s,h,d;if(u&&u.Suggestions)for(k=function(r){var u=r.suggestionData,f,e;u.handoffType==2?n.isApp(u.type)?(f=u,a.push(f.id),p.push(r)):n.isSetting(u.type)?(f=u,v.push(f.id),w.push(r)):n.isFileOrFolder(u.type)&&(f=u,y.push(f.id),b.push(r)):n.isBingEnabled()&&(e=n.safeExecute(function(){return c.parseMRUWebSuggestion(t,r,i)},"parseMRUWebSuggestion"),e&&l.push(e))},s=0,h=u.Suggestions;s<h.length;s++)d=h[s],k(d);n.lookupById(t,"MPP",a,p,function(n){return[n.suggestionData.id]},"MST",v,w,function(n){return n.suggestionData.id},f,i,e,o,function(n,r,u,f){return c.parseIdLookupResponse(t,i,n,r,u,f)},"MFF",y,b,function(n){return n.suggestionData.id},this._instrumentationHelper);e("MRU",l,u)},t.prototype.parseIdLookupResponse=function(t,i,r,u,f,e){var s=this,o=r.suggestionData,h,c;((n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockMRUDataFile)&&f.length==0&&(h={displayName:o.id,id:o.id,kind:"document",getProperty:null,propertyHits:[],rankScore:1e3},f.push(n.createLocalResponseSuggestionWithDeviceItemImage(h,o.type,u))),f.length==1)&&(c=function(n){return s.setupRemoveFromHistoryContextMenu(n,r,t),n.lastLaunchTime=r.rankingData.lastLaunchTime,o.appContextData&&(n.appContext=o.appContextData.appContext,n.query=o.appContextData.query,n.text=t.queryToFetch?HitHighlightingParser.addMarkers(o.appContextData.textWithoutHH,t.queryToFetch):o.appContextData.textWithoutHH),s.setRankingSignals(n,o),!0},n.safeExecute(function(){return n.parseLocalSuggestion(t,f[0],u,i,s._temporaryMessageHandler,o.type,s._instrumentationHelper,e,c)},"parseLocalSuggestion "+u))},t.prototype.setRankingSignals=function(n,t){n.hc=t.hc;n.highConfidenceMetaSuggestionScore=t.highConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.prefetchConfidenceScore;n.fromHistory=!0;n.hasMruData=!0},t.prototype.parseMRUWebSuggestion=function(t,i,r){var l=this,f=i.suggestionData,u=n.createSuggestion(t,t.queryToFetch?HitHighlightingParser.addMarkers(f.textWithoutHH,t.queryToFetch):f.textWithoutHH,null,f.icon,f.type,f.query,n.InstrumentedItem.createInstrumentedItem(r,f.type),f.handoffType,r,!1),e,h,o,c,s;u.lastLaunchTime=i.rankingData.lastLaunchTime;this.setRankingSignals(u,f);switch(u.handoffType){case 5:case 4:if(!n.isCortanaEnabledCache||u.type=="CSK"||(e=f,u.primaryMetadata=e.annotation||e.secondaryText,!n.setCat1SuggestionProperties(u,t,r,e.actionUri,e.taskFrame,e.confidence,e.source)))return null;break;case 10:return null;case 0:if(!n.isDataSourceEnabled("MRS",t))return null;h=f;u.click=function(){n.Host.launchSearch(u.text,l._navigationHelper.getSearchUrl(t.fullPartialQuery,u.query,u.type,null,u.handoffType),u.useRaf)};n.setWebSearchSuggestionProperties(u,t,r,h.url,this._navigationHelper);break;case 1:o=f;c=i.rankingData;t.queryToFetch.length>3&&(u.autoOpenPreviewPaneWhenOnTopHit=!!c.previewPaneLaunchCount);s=o.title||o.secondaryText;t.isSearchHomeZI&&s?(u.additionalInfoText=o.url,u.text=HitHighlightingParser.removeMarkers(s)):u.primaryMetadata=s;n.setUrlSuggestionProperties(u,t,r,o.url);break;default:return SharedLogHelper.LogError("parseMruWebSuggestion",null,new Error("Unexpected handoff type: "+f.handoffType)),null}return n.isValidSuggestion(u,"parseMruWebSuggestion")?(this.setupRemoveFromHistoryContextMenu(u,i,t),u):null},t.prototype.setupRemoveFromHistoryContextMenu=function(t,i,r){var u=this;n.RuntimeConfig.QfMode!=5&&n.RuntimeConfig.QfMode!=9&&i.remove&&n.setExtraVerbs(t,function(f){if(f||!i.remove)return[];if(!t.removeIcon&&t.duplicates&&t.duplicates.some(function(n){return!n.fromHistory}))return[];var e=n.config.mruSearchHome&&r.scope==n.Scope.All,o={verb:e?"RemoveFromDeviceHistoryAll":"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:function(){i.remove(function(){n.Host.refreshCurrentPane();e||u._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemovedFromDeviceHistory",HitHighlightingParser.removeMarkers(t.text)))});delete i.remove},icon:{content:"&#xE711",type:2}};return[o]},!0)},t}();n.MRUParser=t}(WSB||(WSB={}));__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)}}(),function(n){var t;(function(t){var r="LastUpdated",i="MRUNoItemsAvailable",u=function(t){function u(i,u,f,e,o,s,h,c,l,a){var v=this;i&&i.bindItemLaunch(function(n,t,i){return v.onLaunch(n,t,i)});var y,p=function(t,i,f){return u(s,function(i){t(i);var r=n.getTimeDiffInDays(y);(r===null||r>=1)&&(y=n.getCurrentDate(),v.prune());v.getStorage(function(n){return v.instrumentMRUSize(n)},function(){return v.onAfterWrite()},function(){return v.onAfterWrite()},function(){return v.onAfterWrite()})},i,f,r)},w=function(t,i,r){return n.MockUrlParameters&&typeof n.MockedMRUData=="object"&&(i=n.MockedMRUData),n.safeExecute(function(){return v.createMruResponse(t,i,r)},"createMruResponse")},b=function(){return!0},k=function(n){return n=="R"?undefined:n};return n.Host.bindClearMRURequested(function(t){v.teardownStorage();n.ClientSideStorage.deleteDatabase(s,function(){return t(!0)},function(){return t(!1)})}),v=t.call(this,p,w,b,k,"MRU")||this,v.candidatesEnabled=h,v.loggingEnabled=c,v.getSuggestionKey=f,v.getGroupType=e,v.isMRUHistoryGroupType=o,v.instrumentationHelper=l,v.lightweightStorage=a,v._pendingWrites=[],sj_evt.bind("clearMRUButtonClicked",function(){n.ClientSideStorage.deleteDatabase(n.MRUDatabaseName);v.reloadStorage()}),v}return __extends(u,t),u.prototype.getName=function(){return"MRUDataProvider"},u.prototype.shouldStoreSuggestions=function(){return n.config.historySettingsPresent&&this.candidatesEnabled()},u.prototype.createMruResponse=function(t,i,r){var c=this,f,s,u,o,h;if(i=i||[],f=this.getKey(t),this._lastKey=r?f:null,s=r?i.find(function(n){return n.key==f}):null,this._valueForLastKey=s?s.value:null,u={},n.config.mruSignalsEnabled&&this._valueForLastKey&&(u.SuggestionEngagementData=this._valueForLastKey.SuggestionEngagementData),u.LookupCompletions=i.map(function(n){return{key:n.key,value:n.value.SuggestionEngagementData}}),this.shouldStoreSuggestions()){var e=[],v=this.getOldestDateToKeep(),y=function(n,t){var u,i,r,f;if(t.Suggestions)for(u=function(i){var r=l.getRankingData(t,i);r&&r.lastLaunchTime&&r.lastLaunchTime>=v&&e.push({rankingData:n==l._lastKey?{prefixLaunchCount:r.prefixLaunchCount,lastLaunchTime:r.lastLaunchTime,previewPaneLaunchCount:r.previewPaneLaunchCount,lastPreviewPaneLaunchTime:r.lastPreviewPaneLaunchTime}:r,suggestionData:i,remove:function(t){return c.remove(n,i,t)}})},i=0,r=t.Suggestions;i<r.length;i++)f=r[i],u(f)},l=this;for(o=0,h=i;o<h.length;o++){var a=h[o],p=a.key,w=a.value;y(p,w)}e.length>0&&(u.Suggestions=[],e.sort(function(n,t){return t.rankingData.lastLaunchTime-n.rankingData.lastLaunchTime}),e.forEach(function(n){return c.addToResponseIfNotPresent(u.Suggestions,n)}),f?f.length<=n.config.mruLengthA?u.Suggestions.splice(n.config.maxMruA):f.length<=n.config.mruLengthB&&u.Suggestions.splice(n.config.maxMruB):u.Suggestions.splice(n.config.maxMruZeroInput))}return u},u.removeRankerSignals=function(n,t){return n=="highConfidenceMetaSuggestionScore"||n=="prefetchConfidenceScore"?undefined:t},u.prototype.addToResponseIfNotPresent=function(n,t){var f=JSON.stringify(t.suggestionData,u.removeRankerSignals),i=n.find(function(n){return JSON.stringify(n.suggestionData,u.removeRankerSignals)==f}),r;i?(r=i.remove,i.remove=function(n){return r(function(){return t.remove(n)})},i.rankingData.lastLaunchTime=Math.max(i.rankingData.lastLaunchTime,t.rankingData.lastLaunchTime),i.rankingData.prefixLaunchCount+=t.rankingData.prefixLaunchCount,t.rankingData.previewPaneLaunchCount&&(i.rankingData.previewPaneLaunchCount=(i.rankingData.previewPaneLaunchCount||0)+t.rankingData.previewPaneLaunchCount),t.rankingData.lastPreviewPaneLaunchTime&&(i.rankingData.lastPreviewPaneLaunchTime=i.rankingData.lastPreviewPaneLaunchTime?Math.max(i.rankingData.lastPreviewPaneLaunchTime,t.rankingData.lastPreviewPaneLaunchTime):t.rankingData.lastPreviewPaneLaunchTime)):n.push(t)},u.prototype.addToDataIfNotPresent=function(n,t){var i=JSON.stringify(t,u.removeRankerSignals),r=n.find(function(n){return JSON.stringify(n,u.removeRankerSignals)==i});r||n.push(t)},u.prototype.onAfterWrite=function(){if(this._writing=!1,this._pendingWrites.length>0){var n=this._pendingWrites.shift();n()}else this._tearDownPending&&this.teardownStorage()},u.prototype.teardownStorage=function(){this._writing?this._tearDownPending=!0:(this._tearDownPending=!1,t.prototype.teardownStorage.call(this))},u.prototype.onLaunch=function(n,t,i){var r=this,u;if(this.loggingEnabled()){if(this._writing){this._pendingWrites.push(function(){return r.onLaunch(n,t,i)});return}this._writing=!0;u=this.getKey(t);this._lastKey==u?this.updateAndSaveLaunchData(u,this._valueForLastKey,n,i):this.queryStorage(u,function(t){return r.updateAndSaveLaunchData(u,t,n,i)},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()})}},u.prototype.remove=function(n,t,i){var r=this;if(this._writing){this._pendingWrites.push(function(){return r.remove(n,t,i)});return}this._writing=!0;this._lastKey==n?this.removeAndSaveLaunchData(n,this._valueForLastKey,t,i):this.queryStorage(n,function(u){return r.removeAndSaveLaunchData(n,u,t,i)},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()})},u.getUnixTime=function(n){return n||(n=new Date),Math.round(n.getTime()/1e3)},u.prototype.createOrUpdateDbEntry=function(n,t,r,f){var e,o;return t?(t.LastUpdated=u.getUnixTime(),t.SuggestionEngagementData=t.SuggestionEngagementData||{}):t={LastUpdated:u.getUnixTime(),SuggestionEngagementData:{}},e=this.getSuggestionKey(r),t.SuggestionEngagementData[e]=this.updateMRUEntryClicksAndTime(t.SuggestionEngagementData[e],t.LastUpdated,f),this.getGroupType&&(t.SuggestionEngagementData[e].groupType=this.getGroupType(r)),this.lightweightStorage.getItem(i)=="1"&&this.isMRUHistoryGroupType&&this.isMRUHistoryGroupType(r)&&this.lightweightStorage.removeItem(i),this.shouldStoreSuggestions()&&(o=r.getMruData(),o&&n&&(t.Suggestions||(t.Suggestions=[]),this.addToDataIfNotPresent(t.Suggestions,o))),t},u.prototype.updateMRUEntryClicksAndTime=function(n,t,i){return n?(n.prefixLaunchCount+=1,n.lastLaunchTime=t):n={prefixLaunchCount:1,lastLaunchTime:t},i&&(n.previewPaneLaunchCount=(n.previewPaneLaunchCount||0)+1,n.lastPreviewPaneLaunchTime=t),n},u.prototype.getOldestDateToKeep=function(){var t=n.getCurrentDate();return t.setDate(t.getDate()-n.config.mruMaxAgeInDays),u.getUnixTime(t)},u.prototype.updateAndSaveLaunchData=function(t,i,r,u){var f=this;if(i=n.safeExecute(function(){return f.createOrUpdateDbEntry(t,i,r,u)},"createOrUpdateDbEntry"),!i){this.onAfterWrite();return}n.safeExecute(function(){return f.removeOldLaunches(i,f.getOldestDateToKeep())},"removeOldLaunches");this._lastKey=t;this._valueForLastKey=i;this.withStorage(function(n){return n.put(t,i,function(){return f.onAfterWrite()},function(n){f.onError(n,"updateAndSaveLaunchData");f.onAfterWrite()})})||this.onAfterWrite()},u.prototype.removeAndSaveLaunchData=function(n,t,i,r){var u=this,e,f;if(!t){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("MRU entry not present"));this.onAfterWrite();return}if(e=JSON.stringify(i),f=(t.Suggestions||[]).findIndex(function(n){return JSON.stringify(n)==e}),f==-1){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("Suggestion not present in MRU"));this.onAfterWrite();return}t.Suggestions.splice(f,1);this._lastKey=n;this._valueForLastKey=t;this.withStorage(function(i){return i.put(n,t,function(){r&&r();u.onAfterWrite()},function(n){u.onError(n,"removeAndSaveLaunchData");u.onAfterWrite()})})||this.onAfterWrite()},u.prototype.getRankingData=function(n,t){return n.SuggestionEngagementData?n.SuggestionEngagementData[t.suggestionKey]:undefined},u.prototype.removeOldLaunches=function(n,t){var i,r,u;if(n.Suggestions)for(i=n.Suggestions.length-1;i>=0;--i)r=this.getRankingData(n,n.Suggestions[i]),u=r?r.lastLaunchTime:null,(!u||u<t)&&n.Suggestions.splice(i,1);this.removeOldEngagementData(n.SuggestionEngagementData,t)},u.prototype.removeOldEngagementData=function(n,t){var i,r,u;if(n)for(i in n)r=n[i],r&&(u=r.lastLaunchTime,(!u||u<t)&&delete n[i])},u.prototype.prune=function(n){var t=this;if(this._writing){this._pendingWrites.push(function(){return t.prune(n)});return}this._writing=!0;this.withStorage(function(i){return i.removeRangeOnSecondaryKey(0,t.getOldestDateToKeep(),function(){n&&n();t.onAfterWrite()},function(n){t.onError(n,"MRUDataProvider prune");t.onAfterWrite()})})||this.onAfterWrite()},u.prototype.instrumentMRUSize=function(n){for(var i,f,r=0,t=0,u=n;t<u.length;t++)i=u[t].value,i.Suggestions&&(r+=i.Suggestions.length);f={totalnumberOfEntries:n.length.toString(),totalNumberOfSuggestions:r.toString()};this.instrumentationHelper.logClientInstEvent("Select","MRUSize",null,f)},u}(n.ClientSideStorage.StorageBasedDataProvider);t.MRUDataProvider=u})(t=n.MRU||(n.MRU={}))}(WSB||(WSB={}));__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u},function(n){var t;(function(t){function o(t,i){var r,f;if(u||tt(),r=u[t],!r)throw new Error("Unsupported data source: "+t);if(n.config.indexerQuerySimplified&&t=="IFF"&&i.queryToFetch.length<=8)return r[4];if(f=r.filter(function(n){return!n.enabled||n.enabled(i)}),f.length==0)throw new Error("No enabled strategies for data source: "+t);else if(f.length>1)throw new Error("Multiple strategies for data source: "+t);else return f[0]}function sr(n){return u||tt(),!!u[n]}function hr(n,t,i){if(!u||!u[i]||t.taskFrame)return!1;var r=o(i,t);return r.sfgaoFilter?!r.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function i(n,t){return n=ai.concat(n),t&&(n=n.concat(yi)),n}function tt(){var tt=0,v=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getUserSID(),gt=f(n.getKnownFolderPathLC(n.FOLDERID_Profile)),it=ni(tt,v,!1),rt=it[0],w=it[1],ft=ni(tt,v,!0),o=ft[0],t=ft[1];k=rt;yt=w;var et='"System.Kind" != ANY ARRAY['+g.concat("link").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+rt,ti="\"System.Kind\" = SOME ARRAY['program'] AND "+o,s='"System.Kind" != ANY ARRAY['+wt.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,nt='"System.Kind" != ANY ARRAY['+pt.concat(g).concat("folder").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,ii="\"System.Kind\" = SOME ARRAY['folder'] AND "+o,bt="\"System.Kind\" = SOME ARRAY['Music'] AND "+o,kt="\"System.Kind\" = SOME ARRAY['Picture'] AND "+o,dt='"System.Kind" = SOME ARRAY['+d.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,ri="\"System.Kind\" != ANY ARRAY['game', 'calendar', 'web history', 'feed', 'contact', 'task', 'journal', 'note', 'instantmessage'] AND "+o,ui="SCOPE = 'file:"+gt+"' AND \"System.Kind\" = SOME ARRAY['folder'] AND "+o,fi=ou(0,v);u={};u.IFF=[{selectFields:i(e,!1),filterFieldsSets:[ot],mostRelevantProps:c,kindAndScopeClauses:et,sortClause:n.config.enableIndexerQueryExtensionSort?y(h):r,searchOptions:3,sfgaoFilter:w,enabled:function(t){return!!t.queryToFetch&&!n.supportsShortcuts("IFF",t)}},{selectFields:i(e,!1),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:et,sortClause:n.config.enableIndexerQueryExtensionSort?y(h):r,searchOptions:0,sfgaoFilter:w,enabled:function(t){return!t.queryToFetch&&!n.supportsShortcuts("IFF",t)}},{selectFields:i(st,!0),filterFieldsSets:[pi],mostRelevantProps:c,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?y(h):r,searchOptions:3,sfgaoFilter:t,enabled:function(t){return!!t.queryToFetch&&n.supportsShortcuts("IFF",t)}},{selectFields:i(st,!0),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?y(h):r,searchOptions:0,sfgaoFilter:t,enabled:function(t){return!t.queryToFetch&&n.supportsShortcuts("IFF",t)}},{selectFields:i(e,!0),filterFieldsSets:[wi],mostRelevantProps:c.concat(["System.Title"]),kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?y(h):r,searchOptions:0,sfgaoFilter:t,enabled:function(t){return n.config.indexerQuerySimplified&&t.queryToFetch.length<=8&&!!t.queryToFetch}}];u.MDOC=[{selectFields:i(l,!0),filterFieldsSets:[ht.concat(nr)],mostRelevantProps:p,kindAndScopeClauses:nt,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(t){return t.queryToFetch&&n.config.minLengthForContentMatch&&t.queryToFetch.length>=n.config.minLengthForContentMatch}},{selectFields:i(l,!0),filterFieldsSets:[ht],mostRelevantProps:p,kindAndScopeClauses:nt,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(t){return t.queryToFetch&&(!n.config.minLengthForContentMatch||t.queryToFetch.length<n.config.minLengthForContentMatch)}},{selectFields:i(l,!0),filterFieldsSets:[],mostRelevantProps:p,kindAndScopeClauses:nt,sortClause:r,searchOptions:0,sfgaoFilter:t,enabled:function(n){return!n.queryToFetch}},];u.MPVD=[{selectFields:i(l.concat(a).concat(a),!0),filterFieldsSets:[gi],mostRelevantProps:p,kindAndScopeClauses:ri,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(n){return!!n.queryToFetch}}];u.MFOL=[{selectFields:i(tr,!0),filterFieldsSets:[rr],mostRelevantProps:ir,kindAndScopeClauses:ii,sortClause:r,searchOptions:3,sfgaoFilter:t}];u.MPHO=[{selectFields:i(b,!0),filterFieldsSets:[ur],mostRelevantProps:ct,kindAndScopeClauses:kt,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(n){return!!n.queryToFetch}},{selectFields:i(b,!0),filterFieldsSets:[],mostRelevantProps:ct,kindAndScopeClauses:kt,sortClause:r,searchOptions:0,sfgaoFilter:t,enabled:function(n){return!n.queryToFetch}},];u.MVID=[{selectFields:i(a,!0),filterFieldsSets:[fr],mostRelevantProps:lt,kindAndScopeClauses:dt,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(n){return!!n.queryToFetch}},{selectFields:i(a,!0),filterFieldsSets:[],mostRelevantProps:lt,kindAndScopeClauses:dt,sortClause:r,searchOptions:0,sfgaoFilter:t,enabled:function(n){return!n.queryToFetch}},];u.MMUS=[{selectFields:i(at,!0),filterFieldsSets:[er],mostRelevantProps:vt,kindAndScopeClauses:bt,sortClause:r,searchOptions:3,sfgaoFilter:t,enabled:function(n){return!!n.queryToFetch}},{selectFields:i(at,!0),filterFieldsSets:[],mostRelevantProps:vt,kindAndScopeClauses:bt,sortClause:r,searchOptions:0,sfgaoFilter:t,enabled:function(n){return!n.queryToFetch}},];u.IBA=[{selectFields:i(bi,!0),filterFieldsSets:[di],mostRelevantProps:ki,kindAndScopeClauses:ti,sortClause:r,searchOptions:3,sfgaoFilter:t}];u.MFF=[{selectFields:i(e,!1),filterFieldsSets:[or],mostRelevantProps:null,kindAndScopeClauses:null,sortClause:null,searchOptions:0,sfgaoFilter:null}];u.LDIC=[{selectFields:i(e,!0),filterFieldsSets:[],mostRelevantProps:null,kindAndScopeClauses:ui,sortClause:r,searchOptions:0,sfgaoFilter:t}];u[ut]=[{selectFields:i(e,!0),filterFieldsSets:[],mostRelevantProps:null,kindAndScopeClauses:s,sortClause:r,searchOptions:0,sfgaoFilter:t}];u.ANA=[{selectFields:i(vi,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:fi,sortClause:r,searchOptions:3,sfgaoFilter:null,enabled:function(){return n.config.enableAnaheimData}}]}function cr(n,t,i,r,u){return gr(n.queryToFetch).then(function(f){return yr(n,f,t,i,r,u)})}function lr(n,t,i,r){var u=o(t,n),f="SELECT TOP "+i.length+" "+w(u.selectFields)+" FROM SystemIndex WHERE "+br(u,i,r),e=it(r);return e!=""&&(f+=" AND "+e),f}function ar(t,i){var r=o(t,null),e=n.config.maxDeviceItemCacheSize,u="SELECT TOP "+e+" "+w(r.selectFields)+" FROM SystemIndex WHERE ",f=it(i);return f!=""&&(u+=f+" AND "),u+r.kindAndScopeClauses}function vr(){var n=o(ut,null),t="WorkId, "+w(n.selectFields),i=n.kindAndScopeClauses;return"SELECT "+t+" FROM SystemIndex WHERE "+i+" ORDER BY "+n.sortClause}function yr(n,t,i,r,u,f){var s=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getLCIDStringForText(n.queryToFetch),e=n.taskFrame?fu(u,n.taskFrame.parsed,s):o(u,n),h="SELECT TOP "+r+" "+w(e.selectFields)+" FROM SystemIndex WHERE "+kr(e,n.queryToFetch,t,i,e.searchOptions,s,f),c=it(f);return c!=""&&(h+=" AND "+c),h+(" ORDER BY "+e.sortClause)}function pr(n){var f,i,r,t,u;if(n.kind=="link"||n.kind=="program")for(f=n.getProperty("System.Kind"),i=0,r=f;i<r.length;i++){if(t=r[i],t=="program")return wr(n,t);if(t!="link")return u={displayName:n.displayName,id:n.id,kind:t,getProperty:function(t){return n.getProperty(t)},propertyHits:n.propertyHits,rankScore:n.rankScore,getImageAsync:function(t){return n.getImageAsync(t)},imageType:n.imageType,canHaveContextMenu:n.canHaveContextMenu,getVerbsAsync:function(){return n.getVerbsAsync()},extension:n.extension,itemTypeDisplayName:n.itemTypeDisplayName,createdDate:n.createdDate,lastModifiedDate:n.lastModifiedDate},u.originalDeviceItem=n,u}return n}function wr(t,i){var r=t.displayName,u,f;return r.toLocaleLowerCase().endsWith(".lnk")&&(r=r.substr(0,r.length-4)),u=n.indexerFilePathToRegularPath(t.id),f={displayName:r,id:u,kind:i,getProperty:function(n){return t.getProperty(n)},propertyHits:t.propertyHits,rankScore:t.rankScore,getImageAsync:function(n){return t.getImageAsync(n)},imageType:t.imageType,canHaveContextMenu:t.canHaveContextMenu,getVerbsAsync:function(){return t.getVerbsAsync()},extension:t.extension,itemTypeDisplayName:t.itemTypeDisplayName,createdDate:t.createdDate,lastModifiedDate:t.lastModifiedDate,filePath:u,lastAccessed:t.getProperty("System.DateAccessed"),version:null,isImmersive:!1,logoBackgroundColor:null,launchArguments:null,totalLaunches:null,isTrustedApp:!1,packageFamilyName:null,jumpList:null,getJumpListAsync:null,voiceCommandExamples:null,rawIndexResponse:null},f.originalDeviceItem=t,f}function w(n){return n.map(function(n){return n=="System.ParsingPath"?"path":'"'+n+'"'}).join(",")}function it(t){return n.config.useWhereId&&t?"ReuseWhere("+t+") ":""}function br(n,t){return"("+nu(n,t)+")"}function kr(n,t,i,r,u,f){var e="",o;return n.mostRelevantProps.length>0&&(e+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps "),o=tu(n,t,i,u,f),o&&(e+="("+o+") AND "),r&&(e+="(Scope = '"+r+"') AND "),e+n.kindAndScopeClauses}function dr(n,t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.tokenize(n,t)}function gr(n){return SearchAppWrapper.CortanaApp.queryFormulationView.getLinguisticDataAsync(n)}function bt(t,i){var r="",u=t.filterFieldsSets.length>1;return t.filterFieldsSets.forEach(function(t){var s,f,h,l,e,o,c,a;for(u&&(r?r+=") AND (":r="("),s=!0,f=0,h=t;f<h.length;f++){for(l=h[f],e=!1,o=0,c=i;o<c.length;o++)a=c[o],s?(r+="(",s=!1):r+=e?" OR ":" OR (",r+=n.formatString(l,[a]),e=!0;e&&(r+=")")}}),u&&(r+=")"),r}function nu(n,t){var i=t.map(function(n){return rt(n)});return bt(n,i)}function tu(n,t,i,r,u){var o=[t],e,f;return i.alternatives&&i.alternatives.forEach(function(n){return o.push(n)}),e=o.map(function(n){return rt(n)}),f=bt(n,e),(r&2)==2&&(f=iu(r,i,e,f,u)),f}function iu(t,i,r,u,f){for(var k,c,l,p,e,s,v,w,d,g=ru(t),h=!1,y=0,b=g;y<b.length;y++){for(k=b[y],c=!1,l=0,p=r;l<p.length;l++){var nt=p[l],a=[],o=dr(nt,i.language);if(h&&n.config.indexerQueryMWLimit){if((t&4)==0||o.length<=n.config.indexerQueryMWLimit)for(e=0;e<Math.min(o.length,n.config.indexerQueryMWLimit);++e)a.push(o[e])}else if((t&4)==0||o.length<=et)for(e=0;e<Math.min(o.length,et);++e)a.push(o[e]);if(a.length>1){for(s="",v=0,w=a;v<w.length;v++)d=w[v],s&&(s+=" AND "),s+='"'+d+(h?'*"':'"');u?u+=c?" OR ":" OR (":u="(";u+=n.formatString(k,[s,f]);c=!0}}c&&(u+=")");h=!h}return u}function ru(n){var t=[];return t.push("CONTAINS(#MRProps, '{0}', {1}) RANK BY COERCION(ABSOLUTE, 600)"),(n&1)==1&&t.push("CONTAINS(#MRProps, '{0}', {1}) RANK BY COERCION(ABSOLUTE, 550)"),t}function kt(n,t){return n=n.replace(/'/g,"''"),n=n.replace(/"/g," "),t>=2&&(n=n.replace(/%/g,"[%]"),n=n.replace(/_/g,"[_]"),n=n.replace(/\[/g,"[[]"),t==3?(n=n.replace(/\*/g,"%"),n=n.replace(/\?/g,"_")):(n=n.replace(/\*/g," "),n=n.replace(/\?/g," "))),n}function f(n){return kt(n,1)}function rt(n){return kt(n,2)}function uu(n){var t=v[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function s(n,t,i){for(var u=[],r=3;r<arguments.length;r++)u[r-3]=arguments[r];typeof i=="string"?(i=rt(i),t.push(u.map(function(t){return"CONTAINS("+t+",'\""+i+"*\"',"+n+") RANK BY COERCION(ABSOLUTE, 1000)"}))):i&&i.Value&&s.apply(void 0,__spreadArrays([n,t,i.Value],u))}function fu(n,t,i){var f=[],e='"System.Kind" != ANY ARRAY['+nt+"]",o,u;if(t.FileType&&t.FileType.Value){o=t.FileType.Value;switch(o){case"Document":break;case"Picture":e="\"System.Kind\" = SOME ARRAY['Picture']";break;case"Video":e='"System.Kind" = SOME ARRAY['+d.map(function(n){return"'"+n+"'"}).join(", ")+"]";break;case"Powerpoint":case"Word":case"Excel":e="CONTAINS(System.ItemType,'\""+dt[o]+"*\"',"+i+') RANK BY COERCION(ABSOLUTE, 1000) AND "System.Kind" != ANY ARRAY['+nt+"]";break;default:e='"System.Kind" != ANY ARRAY['+nt+"]";s(i,f,o,"System.ItemType","System.ItemTypeText")}}return s(i,f,t.Title,"System.ItemNameDisplay","System.Title"),s(i,f,t.Body,"System.ItemNameDisplay","System.Title","System.FileDescription","System.Keywords","System.Search.Contents"),t.People&&t.People.forEach(function(n){var t=n.Value;t&&s(i,f,t=="me"?SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.userName:t,"System.Author","System.FileOwner","System.Document.LastAuthor","System.Photo.TagViewAggregate")}),s(i,f,t.Place,"System.Photo.TagViewAggregate"),u=eu(t.Time),u&&f.push(["System.DateCreated>='"+u[0]+"' AND System.DateCreated<'"+u[1]+"'","System.DateModified>='"+u[0]+"' AND System.DateModified<'"+u[1]+"'","System.DateAccessed>='"+u[0]+"' AND System.DateAccessed<'"+u[1]+"'","System.DateArchived>='"+u[0]+"' AND System.DateArchived<'"+u[1]+"'","System.DateAcquired>='"+u[0]+"' AND System.DateAcquired<'"+u[1]+"'",]),{selectFields:uu(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+k:k,mostRelevantProps:[],searchOptions:0,sortClause:r,sfgaoFilter:yt}}function eu(t){var i,f,u,e,r;return t?(i=t.value,!i)?null:(f=i.indexOf("T"),f!=-1&&(i=i.substr(0,f)),u=i.split("-"),u.length<2||u.length>3)?null:(e=new Date(i),!n.isValidDate(e))?null:(r=new Date(i),u.length==3?r.setUTCDate(r.getUTCDate()+1):r.setUTCMonth(r.getUTCMonth()+1),[gt(e),gt(r)]):null}function gt(n){var t=n.toISOString();return t.substr(0,t.indexOf("T"))}function ou(n,t){var i="";switch(n){case 0:i+="(scope = 'winrt://{"+t+"}/LS/Microsoft.SDKSamples.Indexer.CS_8wekyb3d8bbwe/TopSites')";break;case 1:i+="(scope = 'winrt://{"+t+"}/LS/Microsoft.SDKSamples.Indexer.CS_8wekyb3d8bbwe/RecentlyClosed')";break;case 2:i+="(scope = 'winrt://{"+t+"}/LS/Microsoft.SDKSamples.Indexer.CS_8wekyb3d8bbwe/Favorites')";break;case 3:i+="(scope = 'winrt://{"+t+"}/LS/Microsoft.SDKSamples.Indexer.CS_8wekyb3d8bbwe/History')"}return i}function ni(t,i,r){var u,h,c,e,o,s,l,a,v;r||(u="NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['hidden'] AND NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['system'] AND NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['link']");r?h=function(n){return!(n&si)&&!(n&oi)&&(!!(n&&hi)||n&&li&&!!(n&&ft)||n&&ci&&!!(n&&ft))}:(u+=" AND (System.Shell.SFGAOFlagsStrings = SOME ARRAY['stream']",u+=" OR (System.Shell.SFGAOFlagsStrings = SOME ARRAY['fileanc'] AND System.Shell.SFGAOFlagsStrings = SOME ARRAY['folder'])",u+=" OR (System.Shell.SFGAOFlagsStrings = SOME ARRAY['storageanc'] AND System.Shell.SFGAOFlagsStrings = SOME ARRAY['folder'])",u+=")");r?u="System.Shell.OmitFromView != 'true'":u+=" AND System.Shell.OmitFromView != 'true'";c=f(n.getKnownFolderPathLC(n.FOLDERID_Profile));switch(t){case 0:e=f(n.getKnownFolderPathLC(ri));u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}') AND (Scope <> 'file:"+c+"\\AppData') AND (Scope <> 'file:"+e+"\\Default\\AppData') AND (Scope <> 'file:"+e+"\\Administrator\\AppData')";o=f(n.getKnownFolderPathLC(ti));s=f(n.getKnownFolderPathLC(ii));u+=" AND (Scope <> 'file:"+o+"')";s!=o&&(u+=" AND (Scope <> 'file:"+s+"')");l=f(n.getKnownFolderPathLC(ui));u+=" AND (Scope <> 'file:"+l+"')";a=f(n.getKnownFolderPathLC(fi));u+=" AND (Scope <> 'file:"+a+"')";r&&(v=f(n.getKnownFolderPathLC(ei)),u+=" AND (Scope <> 'file:"+v+"')");break;case 1:u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}')";break;default:throw new Error("Unknown SearchScope: "+t);}return[u,h]}function y(n){for(var e,i="CASE ",u=1,t=0,f=n;t<f.length;t++)e=f[t],i+="WHEN 'System.FileExtension' = "+e+" THEN "+u.toString()+" ",u+=1;return i+("ELSE 999 END ASC, "+r)}var ut="PRIME",ti="{905e63b6-c1bf-494e-b29c-65b732d3d21a}",ii="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}",ri="{0762D272-C50A-4BB0-A382-697DCD729B80}",ui="{A4115719-D62E-491D-AA7C-E74B8BE3B067}",fi="{0482af6c-08f1-4c34-8c90-e17ec98b1e17}",ei="{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}",oi=4096,si=524288,hi=4194304,ft=536870912,ci=8388608,li=268435456,et=3,r='"System.Search.Rank" DESC, "System.DateModified" DESC, "System.ItemNameDisplay" ASC',h=['".exe"','".xlsx"','".lnk"','".docx"','".xls"','".doc"','".bat"','".pptx"','".pdf"','".txt"',],ai=["System.Kind","System.Search.Rank","System.ParsingPath","System.DateCreated","System.DateModified","System.Search.QueryPropertyHits","System.ItemNameDisplay","System.FileExtension","System.ItemType",],vi=["System.Keywords","System.Comment",],yi=["System.Link.TargetParsingPath","System.SFGAOFlags",],e=["System.Title","System.Music.AlbumTitle","System.Music.DisplayArtist"],c=["System.ItemNameDisplay","System.Music.DisplayArtist","System.Music.AlbumTitle",],ot=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 860)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 760)","CONTAINS(System.Music.AlbumTitle, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 660)",],st=e.concat("System.DateAccessed"),pi=ot.concat(["CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)"]),wi=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 860)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)",],bi=["System.DateAccessed",],ki=["System.ItemNameDisplay",],di=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 795)",],l=["System.Search.AutoSummary","System.Keywords","System.Title","System.Author","System.Document.LastAuthor",],p=["System.ItemNameDisplay","System.Keywords","System.Title",],gi=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","System.Keywords = '{0}' RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Keywords, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","System.Photo.TagViewAggregate = '{0}' RANK BY COERCION(ABSOLUTE, 940)","CONTAINS(System.Photo.TagViewAggregate, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)","System.Music.DisplayArtist = '{0}' RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","System.Music.Genre = '{0}' RANK BY COERCION(ABSOLUTE, 950)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)",],ht=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","CONTAINS(System.Keywords, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)",],nr="CONTAINS(System.Search.Contents, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 545)",tr=[],ir=["System.ItemNameDisplay",],rr=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)",],b=["System.Photo.TagViewAggregate","System.Title",],ct=["System.ItemNameDisplay","System.Photo.TagViewAggregate",],ur=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","CONTAINS(System.Photo.TagViewAggregate, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)",],a=["System.Title","System.Keywords","System.Music.DisplayArtist","System.Music.Genre",],lt=["System.ItemNameDisplay","System.Title","System.Keywords",],fr=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)","CONTAINS(System.Keywords, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)",],at=["System.Title","System.Music.DisplayArtist","System.Music.AlbumTitle","System.Music.Genre",],vt=["System.ItemNameDisplay","System.Title","System.Music.AlbumTitle",],er=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","CONTAINS(System.Music.AlbumTitle, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 865)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)",],or=["path = '{0}'"],u,v,dt;t.getStrategy=o;t.dataSourceSupported=sr;t.suppress=hr;var k,yt,d=["Movie","RecordedTV","Video"],pt=d.concat(["Picture","Music"]),wt=["calendar","game","web history","feed","contact","task","journal","note","instantmessage"],g=wt.concat("program"),nt=pt.concat(g).concat(["folder","link"]).map(function(n){return"'"+n+"'"}).join(",");t.initStrategies=tt;t.generateIndexerQueryAsync=cr;t.generateIndexerQueryForMRUFilesAndFolders=lr;t.generateIndexerQueryForDeviceItemCache=ar;t.generateIndexerPrimerQuery=vr;t.fixKind=pr;v={};v.MPHO=i(b,!1);v.MVID=i(a,!1);v.MDOC=i(l,!1);dt=function(){var n={};return n.Powerpoint="ppt",n.Word="doc",n.Excel="xls",n}()})(t=n.IndexerQueryGenerator||(n.IndexerQueryGenerator={}))}(WSB||(WSB={})),function(n){function c(t,i,r,u,f,e,o,s){var h=u?r+" "+i:r;return n.Promise.safeChainWithGlobalCaching("getIcon",function(i){return t.getImageAsync(n.getImageSizeValue(i))},function(n){return n+"_"+i},function(t){return n.toIcon(t,"getIcon.toIcon",e,o,h)},e,f?function(){var n;return((n=t)===null||n===void 0?void 0:n.imageType)===0}:null,h,null,s)}function t(t,i,r,u,f,e){return{deviceItem:t,getIcon:c(t,t.id,r,r&&!n.localDataSourceMayContainPII(r),n.displayedInGridLayout(i),u,f,0),icon:e?u:null,suggestionType:i}}function l(n,t,i){return{deviceItem:n,icon:i,suggestionType:t}}function lt(n){return n.map(function(n){return{isSimulated:!0,displayName:n,id:null,kind:null,getProperty:null,propertyHits:null,rankScore:null}})}function a(){var t=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getAllAppsAsync();return t.then(function(t){var r=[],u,i;for(u in t)(i=t[u],i)&&(n.config.allowZeroLaunchTopApps||i.totalLaunches>0)&&!n.contains(ct,i.id)&&r.push(i);return n.config.minTopApps&&r.length<n.config.minTopApps?[]:r}).then(function(n){return n}).then(function(n){return n}).then(function(t){return t.sort(function(t,i){return t.totalLaunches!==0||i.totalLaunches!==0?i.totalLaunches-t.totalLaunches:n.contains(e,t.id)?n.contains(e,i.id)?e.indexOf(t.id)-e.indexOf(i.id):-1:n.contains(e,i.id)?1:0}),[].concat(t)})}function i(t,i,r){switch(t){case"program":return"IBA";case"picture":return i&&n.contains(v,i.toLowerCase())?"FL":"LI";case"video":return i&&n.contains(y,i.toLowerCase())?"FL":"LV";case"movie":case"recordedtv":return"LV";case"music":return"MU";case"folder":return"FD";default:return r}}function o(t,i,r,u,f,e,o,s,h){var l=o&&h?t.filter(function(t){return n.contains(Object.keys(tt),t)}):[],c;l.length>0&&(t=t.filter(function(t){return!n.contains(l,t)}));c=function(t){for(var u,e,r=0,f=l;r<f.length;r++)u=f[r],e=tt[u],t[u]={deviceItem:{id:u,displayName:n.Host.getLocString(e.locStringKey),kind:null,getProperty:function(){return null},propertyHits:[],rankScore:1e3},icon:e.icon};i(t)};n.safeExecute(function(){var h,i,l,a,v;if(t.length==0)c({});else{if(h={},i=t.slice(0),s)for(l=t.length-1;l>=0;--l)a=t[l],s.hasOwnProperty(a)&&(h[a]=s[a],i.splice(l,1));i.length==0?c(h):(v=!o||n.localDataSourceMayContainPII(o)?o:o+" "+i,n.Promise.safeChain(r,function(){return u(i)},function(r){var e=n.Map.map(i,r,function(n){return f(n)}),u;if(s&&i.forEach(function(n){return s[n]=e[n]}),i.length!=t.length)for(u in h)h.hasOwnProperty(u)&&(e[u]=h[u]);c(e)},function(){return c({})},e,v))}},"resolveIdsWithCache",null,o,function(){return c({})})}function pt(n,t){if(!t.launchArguments||yt.test(n.query))return!0;var i=t.id.toLowerCase();return it.some(function(n){return i.includes(n)})?!0:!1}function rt(t,i,r,u,f){if(!f)return!1;var o=t.displayName.toLocaleLowerCase(),e=i.queryToFetch.toLocaleLowerCase(),s=null;if(f.Parses&&f.Parses.length>0&&f.Parses[0].SubParses&&f.Parses[0].SubParses.length>1&&f.Parses[0].SubParses[0].Interpretation&&f.Parses[0].SubParses[0].Interpretation==="regex"&&e.length>=f.Parses[0].SubParses[0].QueryEnd&&f.Query!=null){if(e.length===f.Parses[0].SubParses[0].QueryEnd)return!0;e=e.substr(f.Parses[0].SubParses[0].QueryEnd+1);f.Query=f.Query.substr(f.Parses[0].SubParses[0].QueryEnd+1)}return e.length<n.config.filterCICandidatesPrefixLength&&!ut(e,o)&&(s=n.matchesOnPropertyHH(o,e),!s)?!0:dt(o,e,t,r,u,f)?!0:!1}function dt(t,i,r,u,f,e){var o,s,h;return!i||!e||!e.MatchScore||!e.Parses||e.Parses.length==0||!e.Parses[0].Entities||e.Parses[0].Entities.length==0||!e.Query?!1:t.startsWith(i)&&i.length>=n.config.filterCICandidatesPrefixLength?!1:(o=e.Query,o.startsWith(i))?!1:n.config.bypassCIFilterOnSubstringMatch&&t.split(" ").some(function(n){return n.startsWith(i)})?!1:(s=t.startsWith(o),!s)?!0:(h=1,f.Counter>=h)?!0:(f.Counter++,!1)}function ut(n,t){var r,i;if(!!t&&t.length==0||(r=t.split(" "),n.length!=r.length))return!1;for(i=0;i<r.length;i++)if(r[i].length==0||r[i][0]!=n[i])return!1;return!0}function ft(n){var i=n.id.toLowerCase(),t;if(i.startsWith("http:")||i.startsWith("https:")||n.kind=="link"&&i.endsWith(".url"))return 1;if(i.startsWith("file:")||n.kind=="document")return 0;if(t=n.filePath,t&&(t=t.toLowerCase(),t!=i)){if(t.startsWith("http:")||t.startsWith("https:")||n.kind=="link"&&t.endsWith(".url"))return 1;if(t.startsWith("file:"))return 0}return 2}function et(n,t){if(t.dataSource=="PP"){var i=ft(n);if(i==1)return"LURL";if(i==0)return"LDOC"}return t.getSuggestionType(n)}function ot(t){return t&&t.rawIndexResponse?n.safeExecute(function(){return JSON.parse(t.rawIndexResponse)},"parseConstraintIndexMetaData"):undefined}function st(t,i,r,u,f,e){var w,a,s,p,c,o,v,l,h;if(n.IndexerQueryGenerator&&n.IndexerQueryGenerator.suppress(i,t,u))return!0;if(r=="PP")return(w=i.id,n.contains(wt,w))?!0:(a=i,rt(a,t,!0,f,e))?!0:(s=i.kind,s&&(s=s.toLocaleLowerCase(),s!="program"&&s!="unknown"))?!0:u=="LRA"&&ft(a)!=2?!0:(p=a.extension,p&&p.toLowerCase()==".chm")?!0:!1;if(r!="LURL"&&i.kind=="link"&&n.RuntimeConfig.QfMode!=5)return!0;if(n.isSetting(r))return rt(i,t,!1,f,e)?!0:!1;if((c=i,!n.IndexerQueryGenerator&&u=="MDOC"&&c.propertyHits.length==1&&c.propertyHits[0]=="System.Search.Contents"&&(!n.config.minLengthForContentMatch||t.queryToFetch.length<n.config.minLengthForContentMatch))||(o=c.id,o&&(n.RuntimeConfig.QfMode!=5&&(o.includes("\\.")||o.includes("/."))||(o=o.toLowerCase(),t.queryToFetch.toLocaleLowerCase()!=i.displayName.toLocaleLowerCase()&&kt.some(function(n){return o.includes("\\"+n+"\\")||o.includes("/"+n+"/")}))))||(v=c.extension,v&&n.RuntimeConfig.QfMode!=5&&!t.queryToFetch.toLowerCase().includes(v.toLowerCase())&&n.contains(bt,v.toLowerCase())))return!0;if(r=="CG"){if(l=i,h=l.displayName.split(" ")[0].toLowerCase(),h.includes("\\")||h.indexOf(":")==1)return!1;var y=l.id.toLowerCase(),b=y.lastIndexOf("."),k=y.lastIndexOf("\\"),d=l.kind=="folder"||b<0||b<k;if(d&&!h.includes("%")||![".exe",".com"].some(function(n){return h.includes(n)})&&(at.some(function(n){return y.includes(n)})||!l.launchArguments&&it.some(function(n){return y.includes(n)})||n.contains(vt,h)))return!0}return!1}var s=":wux:",h="Classic_{87d66a43-7b11-4a28-9811-c86ee395acf7}",ct=["Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App"],e=["Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge","windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel","Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","Microsoft.ScreenSketch_8wekyb3d8bbwe!App","{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}\\mspaint.exe","{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\mspaint.exe"],v,y,ht,f;n.getIcon=c;n.createLocalResponseSuggestionWithDeviceItemImage=t;n.fetchForTopLocalApps=a;v=[".dwg",".ai",".psd"];y=[".ts"];n.getSuggestionTypeFromKindAndExtension=i;var p={getResultsContainer:function(n){return n.apps},dataSource:"PP",getSuggestionType:function(){return"PP"},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Apps].icon,i.isImmersive?i.logoBackgroundColor:undefined)},supportsEmptyQuery:!0},w={getResultsContainer:function(n){return n.settings},dataSource:"ST",getSuggestionType:function(){return"ST"},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){if(n.isModernSetting(i)){var f=i.glyph,e=f?{content:f,type:1}:n.ScopeConfig[n.Scope.Settings].icon;return l(i,r,e)}return t(i,r,u,n.ScopeConfig[n.Scope.Settings].icon)},supportsEmptyQuery:!1},b=[p,w,{getResultsContainer:function(n){return n.media},dataSource:"LM",getSuggestionType:function(n){return i(n.kind,n.extension,"FL")},maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:function(n){return n.files},dataSource:"FL",getSuggestionType:function(n){return i(n.kind,n.extension,"FL")},maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:function(){throw Error("Only supported via IndexerQuery");},dataSource:"IBA",getSuggestionType:function(){return"IBA"},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Apps].icon)},supportsEmptyQuery:!1},{getResultsContainer:function(){throw Error("Only supported via IndexerQuery");},dataSource:"IFF",getSuggestionType:function(n){return i(n.kind,n.extension,"FL")},maxUpTo3chars:7,maxAfter3chars:15,maxAfter8charsOrInL2ZeroInput:25,supportsEmptyQuery:!0},],k=[{getResultsContainer:function(n){return n.files},dataSource:"MDOC",getSuggestionType:function(n){return i(n.kind,n.extension,"FL")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Documents].icon,null,!0)},supportsEmptyQuery:!1},{getResultsContainer:function(n){return n.folders},dataSource:"MFOL",getSuggestionType:function(n){return i(n.kind,n.extension,"FD")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Folders].icon,null,!0)},supportsEmptyQuery:!1},{getResultsContainer:function(n){return n.pictures},dataSource:"MPHO",getSuggestionType:function(n){return i(n.kind,n.extension,"LI")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Photos].icon,null,!0)},supportsEmptyQuery:!1},{getResultsContainer:function(n){return n.video},dataSource:"MVID",getSuggestionType:function(n){return i(n.kind,n.extension,"LV")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Videos].icon,null,!0)},supportsEmptyQuery:!1},{getResultsContainer:function(n){return n.music},dataSource:"MMUS",getSuggestionType:function(){return"MU"},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Music].icon,null,!0)},supportsEmptyQuery:!1},{getResultsContainer:function(n){return n.files},dataSource:"MPVD",getSuggestionType:function(n){return i(n.kind,n.extension,"FL")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Documents].icon,null,!0)},supportsEmptyQuery:!1},],d=[{getResultsContainer:function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.startPathCompletionQuery(n.originalQuery,"")},dataSource:"PT",getSuggestionType:function(){return"PT"},maxUpTo3chars:15,maxAfter3chars:15,maxAfter8charsOrInL2ZeroInput:15,customCancellation:function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastPathCompletionQuery()},supportsEmptyQuery:!1},{getResultsContainer:function(){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getRecentAppsAsync()},getResults:function(n){return n},dataSource:"LRA",getSuggestionType:function(){return"PP"},customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Apps].icon,i.isImmersive?i.logoBackgroundColor:undefined)},supportsEmptyQuery:!0},{getResultsContainer:function(t){return ThresholdUtilities.createPromise(function(i){var r=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.recentSearches||[],u,f,e;r=r.filter(function(n){return!!n});r.length>0&&t.queryToFetch&&(u=n.escapeRegex(t.queryToFetch),f=u.split(" ").map(function(n){return new RegExp("^"+n+"| "+n,"i")}),r=r.filter(function(n){return f.every(function(t){return t.test(n)})}));e=lt(r);i(e)})},getResults:function(n){return n},dataSource:"FEH",getSuggestionType:function(){return"FEH"},customCreateLocalResponseSuggestion:function(n,t){return l(n,t,{type:2,content:"&#xE81C"})},supportsEmptyQuery:!0},{getResultsContainer:function(){return a()},getResults:function(n,t){return n.then(function(n){return t?n.slice(0,t):n})},dataSource:"TOPP",getSuggestionType:function(){return"TOPL"},customGetMax:function(){return 5},customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Apps].icon,i.isImmersive?i.logoBackgroundColor:undefined)},supportsEmptyQuery:!0},{getResultsContainer:function(n){return ThresholdUtilities.createPromise(function(t){var i=r?r.retrieveItemsFromCache(n.queryToFetch):[];t(i)})},getResults:function(n){return n},dataSource:"LDIC",getSuggestionType:function(n){return i(n.kind,n.extension,"FD")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,supportsEmptyQuery:!1},],g=[{getResultsContainer:function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.startCommandLineQuery(n.originalQuery,"")},dataSource:"CG",getSuggestionType:function(){return"CG"},customCancellation:function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastCommandLineQuery()},supportsEmptyQuery:!1},];n.LocalDataProviderDataSources=b.concat(k).concat(d).concat(g).map(function(n){return n.dataSource});var u={suggestions:[],maxedOut:!1},nt={},r,tt={"shell:RecycleBinFolder":{icon:{content:"&#xEF87",type:2},locStringKey:"RecycleBin"}};var at=["\\system32\\user.exe","\\system32\\sidebar.exe","\\system32\\at.exe","\\system32\\change.exe","\\system32\\control.exe","\\system32\\find.exe","\\system32\\net.exe","\\system32\\share.exe","\\system32\\rundll32.exe","\\system32\\append.exe","\\system32\\choice.exe","\\system32\\clip.exe","\\system32\\comp.exe","\\system32\\compact.exe","\\system32\\consent.exe","\\system32\\convert.exe","\\system32\\format.exe","\\system32\\graphics.com","\\system32\\label.exe","\\system32\\mem.exe","\\system32\\mode.com","\\system32\\more.com","\\system32\\recover.exe","\\system32\\replace.exe","\\system32\\reset.exe","\\system32\\shadow.exe","\\system32\\sort.exe","\\system32\\tree.com","\\system32\\webcam.exe","\\system32\\systemsettings.exe","\\system32\\command.com","\\system32\\tabtip.exe","\\system32\\services.exe","\\system32\\help.exe","\\system32\\where.exe","\\system32\\skydrive.exe","\\system32\\calc.exe","\\system32\\fc.exe","\\accessories\\wordpad.exe",n.config.blocklistNotepadCommand?"\\system32\\notepad.exe":null,].filter(function(n){return!!n}),it=["\\system32\\finger.exe","\\system32\\ping.exe","\\system32\\print.exe","\\system32\\shutdown.exe","\\system32\\expand.exe","\\system32\\tskill.exe","\\system32\\reg.exe","\\system32\\sc.exe",],vt=["uninstall","outlook","excel","skype","nero","onenote","lync","vmware","firefox","itunes","photoshop","print","opera","visio","thunderbird","smartscreen"],yt=/[\/\.\-\\]/;n.isRealCommand=pt;var wt=["Microsoft.Cortana_8wekyb3d8bbwe!CortanaUI","Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI",],bt=[".dll",".pdb",".obj",".bin",".etl",".bak",".config",".resx",".manifest",".ini",".searchconnector-ms",".settingcontent-ms",".vstx",".vssx",".ms-one-stub",],kt=["visio content","bin","debug","obj","objd","amd64","x86","microsoftedgebackups",];n.isInitials=ut;n.getSuggestionTypeOverride=et;n.parseConstraintIndexMetaData=ot;n.isSuppressed=st;ht=function(){function e(t,i){var u=this;this._previousKeystrokeCache=t;i&&(r=i,n.Host.bindShown(function(){r&&(r.clean(),u.cacheDeviceItems())}));n.Host.bindAppHidden(function(){nt={}})}return e.prototype.getName=function(){return"LocalDataProvider"},e.setWhereId=function(n){e.whereId=n},e.prototype.fetch=function(t,i,r,u,o){var it=this,s,c,rt,a,ut,h,v,st,y,ft,p,ht,ct,w,et,nt,lt,at,tt,ot,l;if(u&&u.register(function(){return n.Promise.clearPendingItemsFromCache()},!1,"clearPendingItemsFromCache"),s=[],c=b.filter(function(i){return n.isDataSourceEnabled(i.dataSource,t)}),n.IndexerQueryGenerator&&(s=s.concat(c.filter(function(t){return n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),c=c.filter(function(t){return!n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),c.length>0){if(!t.queryToFetch&&!c.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);if(u&&u.register(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastDeviceQuery()},!1,"cancelLastDeviceQuery"),rt=n.safeExecute(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(t.queryToFetch)},"startDeviceQuery",null,t.queryToFetch),rt)for(a=0,ut=c;a<ut.length;a++)l=ut[a],this.searchFolderWithMultipleResults(t,l,rt,i,o,u,e.whereId);else this.emptyFetch(c,i)}if(h=k.filter(function(i){return n.isDataSourceEnabled(i.dataSource,t)}),n.IndexerQueryGenerator&&(s=s.concat(h.filter(function(t){return n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),h=h.filter(function(t){return!n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),h.length>0){if(!t.queryToFetch&&!h.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);v=t.taskFrame?t.taskFrame.raw:"";n.Promise.safeChain("executeSearchAsync",function(){return SearchAppWrapper.CortanaApp.searchResultsView.executeSearchAsync(t.queryToFetch,v)},function(n){var r,f,s;if(o())if(n)for(r=0,f=h;r<f.length;r++)s=f[r],it.searchFolderWithMultipleResults(t,s,n,i,o,u,e.whereId);else it.emptyFetch(h,i)},function(){return it.emptyFetch(h,i)},null,v?t.queryToFetch+"\n"+v:t.queryToFetch)}if(s.length>0){if(e.lastQuery&&!t.fullPartialQuery.startsWith(e.lastQuery)&&e.setWhereId(null),e.lastQuery=t.fullPartialQuery,!t.queryToFetch&&!s.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);if(s.some(function(n){return n.dataSource=="MPHO"})&&s.some(function(n){return n.dataSource=="MVID"})&&s.some(function(n){return n.dataSource=="MDOC"})&&s.some(function(n){return n.dataSource=="MPVD"}))st=s.find(function(n){return n.dataSource=="MPVD"}),this.searchFolderWithMultipleResults(t,st,null,i,o,u,e.whereId);else for(y=0,ft=s;y<ft.length;y++)l=ft[y],this.searchFolderWithMultipleResults(t,l,null,i,o,u,e.whereId)}if(p=d.filter(function(i){return n.isDataSourceEnabled(i.dataSource,t)}),p.length>0){if(!t.queryToFetch&&!p.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);for(ht=function(n){u&&n.customCancellation&&u.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");ct.searchFolderWithMultipleResults(t,n,t,i,o,u,e.whereId)},ct=this,w=0,et=p;w<et.length;w++)l=et[w],ht(l)}if(nt=g.filter(function(i){return n.isDataSourceEnabled(i.dataSource,t)}),nt.length>0){if(!t.queryToFetch&&!nt.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);for(lt=function(n){u&&n.customCancellation&&u.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");at.searchFolderWithSingleResult(t,n,t,i,o)},at=this,tt=0,ot=nt;tt<ot.length;tt++)l=ot[tt],lt(l)}t.taskFrame&&n.safeExecute(function(){return SearchAppWrapper.CortanaApp.searchResultsView.setTaskFrame(t.originalQuery,"")},"reset task frame")},e.prototype.emptyFetch=function(n,t){for(var f,i=0,r=n;i<r.length;i++)f=r[i],this.logProviderFailure(f.dataSource),t(f.dataSource,u,e.getDataSourceState(0))},e.prototype.getMax=function(t,i){return i.customGetMax?i.customGetMax(t):n.RuntimeConfig.QfMode==5||t.scope!=n.Scope.All?t.queryToFetch?i.maxAfter8charsOrInL2ZeroInput*2:i.maxAfter8charsOrInL2ZeroInput:t.queryToFetch.length>8?i.maxAfter8charsOrInL2ZeroInput:t.queryToFetch.length>3?i.maxAfter3chars:i.maxUpTo3chars},e.prototype.toLocalResponse=function(i,r,u,f,e){var y,p,a,w,o,v;e&&(p=f,p.getGroupDisplayName&&(y=p.getGroupDisplayName(e)));var k={Counter:0},b=[],d=u.length<i;for(a=0,w=u;a<w.length;a++){var c=w[a],l=et(c,f),h=n.isApp(l)||n.isSetting(l)?ot(c):undefined;st(r,c,l,f.dataSource,k,h)||(o=void 0,o=f.customCreateLocalResponseSuggestion?f.customCreateLocalResponseSuggestion(c,l,f.dataSource):t(c,l,f.dataSource),y&&(o.groupDisplayName=y),h&&(o.ciMetaData=h,h.Query&&h.Query.includes(s)&&(v=h.Query.split(s),v.length==2&&(o.uxHint=v[1],o.ciMetaData.Query=v[0]))),b.push(o))}return{suggestions:b,maxedOut:d}},e.prototype.getResults=function(n,t,i,r){if(r.getResults)return r.getResults(i,t);var u=i,f=this.enableSpellCorrection(n);return u.getItemsAsyncWithSpeller?u.getItemsAsyncWithSpeller(0,t,f):i.getItemsAsync(0,t)},e.prototype.enableSpellCorrection=function(t){return t.queryToFetch.length>=n.config.enableCISpellerAtPrefixLength&&this._previousKeystrokeCache&&this._previousKeystrokeCache.enableCISpeller(t.queryToFetch)?!0:t.queryToFetch.length>=n.config.enableCISpellerAtPrefixLength&&n.config.enableCISpeller==1?!0:!1},e.prototype.searchFolderWithMultipleResults=function(t,i,r,f,o,s,h){var y=this,c=i.dataSource,p=this.getMax(t,i),l=!r,w,a,v;if(l){if(n.RuntimeConfig.QfMode==5&&(v=n.Host.getFileExplorerCurrentPath()),v&&!/^[a-zA-Z]\:\\/.test(v)){f(c,u,null,null,!0);return}w=function(){return n.IndexerQueryGenerator.generateIndexerQueryAsync(t,v,p,c,h).then(function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(n)})}}else{if(a=n.safeExecute(function(){return i.getResultsContainer(r)},"getResultsContainer "+c),!a){f(c,u,null);return}w=function(){return y.getResults(t,p,a,i)}}n.Promise.safeChain(l?"queryWindowsSearchIndexerAsync":"getItemsAsync",w,function(r){var u,s,h;o()&&(u=r.resultSet,s=void 0,e.setWhereId(r.whereId),u?s=r.state:u=typeof r.length=="undefined"?Object.keys(r).map(function(n){return r[n]}):r,l&&n.supportsShortcuts(c,t)&&(u=u.map(function(t){return n.IndexerQueryGenerator.fixKind(t)})),h=e.getDataSourceState(s),f(c,y.toLocalResponse(p,t,u,i,a),h))},function(t){n.isCancellation(t)||y.logProviderFailure(c);f(c,u,null)},l?s:null,c+" "+t.queryToFetch)},e.prototype.searchFolderWithSingleResult=function(t,i,r,f,e){var s=this,o=i.dataSource,h=n.safeExecute(function(){return i.getResultsContainer(r)},"getResultsContainer "+o);h?n.Promise.safeChain("tryGetResultAsync "+o,function(){return h.tryGetResultAsync()},function(n){e()&&f(o,s.toLocalResponse(1,t,n?[n]:[],i,null),null)},function(t){n.isCancellation(t)||s.logProviderFailure(o);f(o,u,null)},null,t.queryToFetch):f(o,u,null)},e.prototype.logProviderFailure=function(t){var i=n.providerFailureLogName(t);i&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(i,"ErrorForTopHit")},"logProviderFailure")},e.prototype.cacheDeviceItems=function(){var t="LDIC",i=function(){var i=n.IndexerQueryGenerator.generateIndexerQueryForDeviceItemCache(t,e.whereId);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(i)};r.setReady(!1);n.Promise.safeChain("initializeDeviceItemCacheAsync",i,function(n){var t,i,u;for(e.setWhereId(n.whereId),t=0,i=n.resultSet;t<i.length;t++)u=i[t],r.addItemToCache(u);r.setReady(!0)})},e.getDataSourceState=function(n){switch(n){case 0:return"UN";case 1:return"NI";case 2:return"PI"}return undefined},e.getApps=function(n,t,i,r){o(n,t,"findAppsAsync",function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findAppsAsync(n)},function(n){return p.customCreateLocalResponseSuggestion(n,null,r)},i,r,null,!0)},e.getSettings=function(n,t,i,r){o(n,t,"findSettingsAsync",function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findSettingsAsync(n)},function(n){return w.customCreateLocalResponseSuggestion(n,null,r)},i,r,null)},e.getFiles=function(r,u,f,s,h){o(r,u,"findFilesAsync",function(t){if(n.IndexerQueryGenerator){var i=n.IndexerQueryGenerator.generateIndexerQueryForMRUFilesAndFolders(f,"MFF",t,e.whereId);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(i).then(function(n){var i,t,r,u;for(e.setWhereId(n.whereId),i={},t=0,r=n.resultSet;t<r.length;t++)u=r[t],i[u.id]=u;return i})}return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findFilesAsync(t)},function(n){return t(n,i(n.kind,n.extension,"FL"),h)},s,h,nt)},e.launchIndexingOptions=function(t){var i=this;e.getSettings([h],function(r){var u=r[h];u?n.Host.launchDeviceItem(u.deviceItem,"ST"):t||i.launchIndexingOptions(!0)},null,null,!0)},e}();n.LocalDataProvider=ht;f="Local provider doesn't support empty query"}(WSB||(WSB={}));__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u},function(n){var t,r="UpsellDismissed",u="moreButton",i="feedbackButton",f="optionsButton",e="rewardsBadgeButton",o="userProfileButton",s=function(){function s(s,h,c,l,a,v,y,p){var w=this,b,k,d;(this._page=s,this._accessTokenManager=h,this._msRewardsViewModel=c,this._menuFactory=l,this._substrateProfilePictureProvider=a,this._instHelper=v,this._optionsWindow=y,this._moreButton={id:u,selected:!1,text:null},this._feedbackButton={id:i,selected:!1,text:null},this._optionsButton={id:f,selected:!1,text:null},this._rewardsBadgeButton={id:e,selected:!1,text:null},this._userProfileButton={id:o,selected:!1,text:null},this._topHitPresent=!1,this._resultsPresent=!1,this._currentScopeTileIndex=-1,this._moreMenuOpened=!1,this._optionsMenuOpened=!1,this._lockscreenMenuOpened=!1,this._userProfileMenuOpened=!1,this._shouldRenderScopes=!0,this._advancedOptionsIdCounter=0,this._advancedOptionsScope=[],this._userProfilesCache={},this._storage=p,this._upsellGotDismissed=p.getItem(r)=="1",t=SearchAppWrapper.CortanaApp,this._scopesHeaderElement=_ge("scopesHeader"),n.config.scopesOrderBegin.length!=0)&&(b=function(){w._currentQuery&&w.renderScopes()},n.Host.bindAppHidden(function(){w._scopeTiles=null;w._effectiveScopeOrder=null}),n.Host.bindQueryChangedOrInitialized(function(n){w._currentQuery=n;w._currentScopeTileIndex=-1}),n.Host.bindDismissed(function(){w._shouldRenderScopes=!0;w._currentScopeTileIndex=-1;w._verifyAccountForAADRequired=!1;w._verifyAccountForMSARequired=!1}),n.Host.bindButtonRightOfSearchBoxClick(function(t){(t==""||t=="")&&(n.Host.reformulate(""),w.setFocusInSearchBox("clear search box"),v.logClientInstEvent("Select","ClearSearchBox",null))}),n.Host.bindScopeListRequiresUpdate(function(){w.init();b()}),n.Host.bindOnFeedbackClosing(function(t){!t&&n.RuntimeConfig.AlwaysWide&&_ge(i).focus()}),this._substrateUpsellDismiss={action:function(){w._upsellGotDismissed=!0;p.setItem(r,"1");n.Host.refreshCurrentPane()},icon:{content:"&#xE711",type:2}},c&&c.bindRewardsBadgeUpdated(function(){w._shouldRenderScopes=n.config.optScopesRender;b()}),h&&(k=function(){if(w._currentQuery){var t=n.ScopeConfig[w._currentQuery.scope];w.refreshAdvancedOptionsScopeList(t);w.updateTopHitHeader()}},d=function(n,t,i){n==0?(t=="https://substrate.office.com/SubstrateSearch-Internal.ReadWrite"||t=="service::cortana.bing.com::mbi_ssl")&&(w._verifyAccountForMSARequired=i,k()):n==1&&t=="https://substrate.office.com"&&(w._verifyAccountForAADRequired=i,k())},h.bindVerifyAccountRequired(function(n,t){d(n,t,!0)}),h.bindAccessTokenAvailable(function(n,t){d(n,t,!1)})))}return s.prototype.focusNextScopeTile=function(t,i){var r=[].slice.call(this._scopesHeaderElement.getElementsByClassName("scopeTile")),u=n.shouldSkipSelectedScope()?r.filter(function(n){return!n.classList.contains("selectedScope")}):r;this._currentScopeTileIndex=u.indexOf(t);i?this._currentScopeTileIndex!=u.length-1&&++this._currentScopeTileIndex:this._currentScopeTileIndex>0&&--this._currentScopeTileIndex;n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=r.indexOf(u[this._currentScopeTileIndex]));this._menuFactory.dismiss();r[this._currentScopeTileIndex].focus()},s.prototype.render=function(t,i,r,u,f){if(this._currentQuery=t,t){var e=n.getEffectiveScope(t);this.innerRender(t.scope,e,t,i,r,u,f)}else this.cleanUp()},s.prototype.getScopeToolTip=function(t,i){var u=n.ScopeConfig[t],f=n.getScopeDisplayName(u),r;return r=i&&!this._allScopeButtonPresent?"RemovingScopeNarratorText2":t==n.Scope.All?"AddingScopeNarratorTextAll2":"AddingScopeNarratorText",n.Host.getLocString(r,f.toLocaleLowerCase())},s.prototype.selectScope=function(n){var i,r,t;for(this._selectedScope&&(this._selectedScope.tooltip=this.getScopeToolTip(this._selectedScope.type,!1),this._selectedScope.enabled=!1,this._selectedScope=null),i=0,r=this._scopeTiles;i<r.length;i++)if(t=r[i],t.enabled=t.type==n,t.enabled){t.tooltip=this.getScopeToolTip(n,!0);this._selectedScope=t;break}},s.prototype.innerRender=function(t,i,r,u,f,e,o){this._topHitPresent=u;this._resultsPresent=f;n.RuntimeConfig.ScopesAvailable&&(this._scopeTiles||this.init(),this._scopeTiles&&(!this._selectedScope||this._selectedScope.type!=t)&&this.selectScope(t));this.renderTopHitHeader(t,i,r,f,e,o);n.RuntimeConfig.ScopesAvailable&&this.renderScopes()},s.prototype.refreshAdvancedOptionsScopeList=function(t){this._advancedOptionsScope=n.RuntimeConfig.ScopesAvailable&&t.showUpsellOnSuggestionsList&&t.showUpsellOnSuggestionsList()?this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),0):[]},s.prototype.renderTopHitHeader=function(t,i,r,u,f,e){var o=n.ScopeConfig[i],l=r.showProgressBar?e:!f,a=!r||!r.queryToFetch,v=this.getEmptyResultsMessage(u,l,a,i,o),s=v[0],h=v[1],c=l||a||u||!this._lastRenderedTopHitHeader||n.uses3lineTemplate(i)?this.getHeaderText(i,o):this._lastRenderedTopHitHeader.headerText,y;(this.refreshAdvancedOptionsScopeList(o),n.RuntimeConfig.AlwaysWide&&(this._advancedOptionsScope=this._advancedOptionsScope.concat(this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),1))),this._lastRenderedTopHitHeader&&this._lastRenderedTopHitHeader.scope==t&&this._lastRenderedTopHitHeader.message==s&&this._lastRenderedTopHitHeader.subMessage==h&&this._lastRenderedTopHitHeader.headerText==c&&this._lastRenderedTopHitHeader.advancedOptions==this._advancedOptionsScope)||(this._lastRenderedTopHitHeader={scope:t,headerText:c,message:s,subMessage:h,advancedOptions:this._advancedOptionsScope,scopeForDisplay:i},y={headerText:c,message:s,subMessage:h,messageIcon:s?o.icon:null,advancedOptions:this._advancedOptionsScope},this._page.updateTopHitHeaderView(y))},s.prototype.updateTopHitHeader=function(){if(this._lastRenderedTopHitHeader){var t=n.ScopeConfig[this._lastRenderedTopHitHeader.scopeForDisplay],i={headerText:this._lastRenderedTopHitHeader.headerText,message:this._lastRenderedTopHitHeader.message,subMessage:this._lastRenderedTopHitHeader.subMessage,messageIcon:this._lastRenderedTopHitHeader.message?t.icon:null,advancedOptions:this._advancedOptionsScope};this._page.updateTopHitHeaderView(i)}},s.prototype.shouldShowRewardsBadge=function(t){return n.RuntimeConfig.AlwaysWide||!!t&&t.scope==n.Scope.All},s.prototype.getScopesHeaderDataModel=function(){var t=this;this._advancedOptionsIdCounter=0;var r=this.getScopeBarElements(),u=this.getHiddenScopeElements(r)||[],f=this._msRewardsViewModel&&this._msRewardsViewModel.getDataModel(),i=n.cohortProfileManager===null||n.cohortProfileManager===void 0?void 0:n.cohortProfileManager.isTourVisible();i&&(r=r.map(function(n){return Object.assign({},n,{click:undefined,tooltip:undefined})}),f&&(f.click=function(){return null}));var e=n.config.userProfileButtonEnabled?this.getUserProfileButtonData():[null,null],o=e[0],s=e[1];return{scopes:n.config.pureRender?n.deepCopy(r):r,showFeedback:this.isFeedbackEnabled()?i?function(){return}:function(){return t.showFeedback()}:null,rewardsBadgeDataModel:this.shouldShowRewardsBadge(this._currentQuery)&&f,moreMenuDataModel:u.length>0?{opened:this._moreMenuOpened,menuItems:u,buttonClickHandler:function(){return i?null:t._moreMenuOpened?t.closeMoreMenuDropDown():t.openMoreMenuDropDown(u)}}:null,optionsMenuDataModel:{opened:this._optionsMenuOpened,buttonClickHandler:function(){return i?null:t._optionsMenuOpened?t.closeOptionsMenuDropDown():t.openOptionsMenuDropDown()}},userProfileButtonDataModel:n.config.userProfileButtonEnabled&&o?{opened:this._userProfileMenuOpened,buttonClickHandler:function(){return i?null:t._userProfileMenuOpened?t.closeUserProfileDropDown():t.openUserProfileDropDown()},icon:o,userName:s}:null,lockscreenMenuDataModel:{opened:this._lockscreenMenuOpened,buttonClickHandler:function(){return i?null:t._lockscreenMenuOpened?t.closeLockscreenMenuDropDown():t.openLockscreenMenuDropDown()}}}},s.prototype.renderScopes=function(){(!n.config.optScopesRender||this._currentQuery&&this._currentQuery.scopePrefix||(this._selectedScope?this._selectedScope.selected==!1:this._currentQuery.scope==n.Scope.All)||this._moreMenuOpened||this._optionsMenuOpened)&&(this._shouldRenderScopes=!0);this._shouldRenderScopes&&(this._page.updateScopesHeaderView(this.getScopesHeaderDataModel()),this._shouldRenderScopes=!1)},s.prototype.createTourFlyout=function(){var t=this,e=Object.keys(n.Host.getQuery().enabledDataSources),o=e.indexOf("MRU")!=-1?this._storage.getItem("MRUNoItemsAvailable")=="1":!0,u=[{id:"web_Tour",message:n.Host.getLocString("TourSearchText"),title:n.Host.getLocString("TourSearchTitle"),group:'document.createElement(\'search\').setAttribute("id", "search")',enabled:!0,icon:"WebSearch"},{id:o?"gr37_TourWide":"gr37_Tour",message:n.Host.getLocString("TourQuickSearchText"),title:n.Host.getLocString("TourQuickSearchTitle"),group:"gr37",enabled:n.shouldEnableQuickSearches(n.Host.getLanguage().toLowerCase()),icon:"QuickSearch"},{id:"SNSC_Tour",message:n.Host.getLocString("TourSnipSearchText"),title:n.Host.getLocString("TourSnipSearchTitle"),group:"SNSC",enabled:n.shouldEnableSnipSearch(),icon:"VisualSearch"},{id:"rewardsBadgeButton_Tour",message:n.Host.getLocString("TourRewardsText"),title:n.Host.getLocString("TourRewardsTitle"),group:"rewardsBadgeButton",enabled:this._msRewardsViewModel.isRewardsEnabled(),icon:"RewardsTrophy"}],i=this._page.createFlyout("WWETour",this._storage,this._instHelper),r,f;if(i==null){this._storage.removeItem("wweTourEnabled");n.setZeroInputDataSourcesForL1();n.Host.refreshCurrentPane();_ge("root").classList.remove("overlayEnabled");this._storage.removeItem("wweTourRefreshed");return}n.Host.bindAppHidden(function(){t.removeTourFlyout();t._page.hideOverlayAreaView();t._page.hideFlyoutAreaView();t._page.updateScopesHeaderView(t.getScopesHeaderDataModel())});this._page.updateScopesHeaderView(this.getScopesHeaderDataModel());i.icon("WebSearch").overlay(!0);u.forEach(function(n){n.enabled&&i.addMessage(n.message,n.title,_ge(n.group),n.id,n.icon)});r=u.filter(function(n){return n.enabled}).length;f=r==1;this._instHelper.logClientInstEvent("Select","WWETour",null,{intendedFlyouts:r.toString()});i.target(_ge("groups")).button(n.Host.getLocString("WelcomeExpTourFinish"),function(){t.removeTourFlyout();t._page.hideOverlayAreaView();t._page.updateScopesHeaderView(t.getScopesHeaderDataModel())}).showButton(f).show()},s.prototype.removeTourFlyout=function(){this._storage.removeItem("wweTourRefreshed");this._storage.removeItem("wweTourEnabled");_ge("root").classList.remove("overlayEnabled")},s.prototype.openMoreMenuDropDown=function(t){var i=this;this._menuFactory.showDropdownMenu(t,document.getElementById(this._moreButton.id),1,function(){n.safeSetTimeout(function(){return i.closeMoreMenuDropDown()},0,"closeMoreMenuDropDown")});this._moreMenuOpened=!0;this.renderScopes()},s.prototype.closeMoreMenuDropDown=function(){this._moreMenuOpened=!1;this.renderScopes()},s.prototype.openOptionsMenuDropDown=function(){var t=this,i=n.RuntimeConfig.AlwaysWide?1:2,r=this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),i);this._menuFactory.showDropdownMenu(r,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return t.closeOptionsMenuDropDown()},0,"closeOptionsMenuDropDown")});this._optionsMenuOpened=!0;this.renderScopes()},s.prototype.openLockscreenMenuDropDown=function(){var t=this,i=this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),3);this._menuFactory.showDropdownMenu(i,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return t.closeLockscreenMenuDropDown()},0,"closeLockscreenMenuDropDown")});this._lockscreenMenuOpened=!0;this.renderScopes()},s.prototype.closeOptionsMenuDropDown=function(){this._optionsMenuOpened=!1;this.renderScopes()},s.prototype.closeLockscreenMenuDropDown=function(){this._lockscreenMenuOpened=!1;this.renderScopes()},s.prototype.openUserProfileDropDown=function(){var t=this,i=this.getAccountOptionsForUserProfileButton(n.SequenceNumberManager.getSequenceNumber());this._menuFactory.showDropdownMenu(i,document.getElementById(this._userProfileButton.id),2,function(){n.safeSetTimeout(function(){return t.closeUserProfileDropDown()},0,"closeUserProfileDropDown")});this._userProfileMenuOpened=!0;this.renderScopes()},s.prototype.closeUserProfileDropDown=function(){this._userProfileMenuOpened=!1;this.renderScopes()},s.prototype.cleanUp=function(){this._lastRenderedTopHitHeader=null;this._page.updateTopHitHeaderView(null);this._page.updateScopesHeaderView(null)},s.prototype.scopeNamesElements=function(t){var i=this;return t.map(function(t){return i._scopeTiles.find(function(i){return n.Scope[i.type]==t})}).filter(function(n){return!!n})},s.prototype.getEffectiveScopeOrder=function(){var i,r,u,t,f;return!this._scopeTiles||this._scopeTiles.length==0?[]:this._effectiveScopeOrder&&!n.config.pathCompletionReplacesAll?this._effectiveScopeOrder.slice(0):(n.RuntimeConfig.AlwaysWide?(i=n.config.scopesOrderBeginAlwaysWide,r=n.config.scopesOrderLastAlwaysWide,u=n.config.numberOfScopesToRenderAlwaysWide):(i=n.config.scopesOrderBegin,r=n.config.scopesOrderLast,u=n.config.numberOfScopesToRender),t=[],i&&(n.config.pathCompletionReplacesAll&&(r=r.filter(function(n){return n!="PathCompletion"}),this._currentQuery&&this._currentQuery.canBePathCompletion&&(i=i.map(function(n){return n=="All"?"PathCompletion":n}))),f=r?this.scopeNamesElements(r):[],t=this.scopeNamesElements(i),t=t.slice(0,u-f.length),t.push.apply(t,f)),this._effectiveScopeOrder=t,t.slice(0))},s.prototype.getHiddenScopeElements=function(t){return this._moreScopeTiles?this._moreScopeTiles.filter(function(i){return t.find(function(n){return n.type==i.type})==undefined&&n.Scope[i.type]!="PathCompletion"&&n.Scope[i.type]!="All"}):[]},s.prototype.getScopeBarElements=function(){var u=this,t,i,r;return this._scopeTiles?(t=this.getEffectiveScopeOrder(),i=t.some(function(n){return n.enabled}),!i&&this._selectedScope&&(n.config.pathCompletionReplacesAll&&n.Scope[this._selectedScope.type]=="PathCompletion"||(r=this._scopeTiles.find(function(n){return n.type==u._selectedScope.type}),t.push(r),i=!0)),t):[]},s.prototype.isFeedbackEnabled=function(){return n.isBingEnabled()},s.prototype.showFeedback=function(){typeof WindowsFeedbackForm!="undefined"&&WindowsFeedbackForm.Show("")},s.prototype.getHeaderText=function(t,i){var r,u;if(n.RuntimeConfig.FlatListWithoutGroups)return null;if(r=n.getScopeDisplayName(i),r){if(this._topHitPresent)return t==n.Scope.All||t==n.Scope.PathCompletion?(u=n.config.quickMatchLabel?"QuickMatch":"BestMatch",n.Host.getLocString(u)):(u=n.config.quickMatchLabel?"QuickMatchFor":"BestMatchFor",n.Host.getLocString(u,r.toLocaleLowerCase()));if(this._resultsPresent)return null;if(t!=n.Scope.All)return r}return n.Host.getLocString("BestMatch")},s.prototype.getEmptyResultsMessage=function(t,i,r,u,f){return n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9||t||!i&&!r||u!=n.Scope.Documents&&f.showUpsellOnSuggestionsList&&f.showUpsellOnSuggestionsList()?["",""]:r?f.getEmptyZIMessages():[n.Host.getLocString("NoResults",this._currentQuery.queryToFetch),""]},s.prototype.init=function(){var r,u,i,t;if(n.initScopePrefixes(),this._scopeTiles=[],this._moreScopeTiles=[],n.RuntimeConfig.ScopesAvailable){r=n.RuntimeConfig.AlwaysWide?n.config.scopesOrderBeginAlwaysWide:n.config.scopesOrderBegin;this._allScopeButtonPresent=n.contains(r,"All");for(u in n.ScopeConfig)(i=parseInt(u),t=n.ScopeConfig[i],(t.prefixes||t.prefixesLocString||t.scopeNameLocString)&&n.isScopeEnabled(i,t))&&((i!=n.Scope.All||this._allScopeButtonPresent)&&this._scopeTiles.push(this.createScopeElement(i,t,!1)),this._moreScopeTiles.push(this.createScopeElement(i,t,!0)));this._moreScopeTiles.sort(function(t,i){return t.type==n.Scope.All?-1:i.type==n.Scope.All?1:t.text.localeCompare(i.text)});this._selectedScope&&this.selectScope(this._selectedScope.type);this._effectiveScopeOrder=null}},s.prototype.createScopeElement=function(t,i,r){var u=this;return{isScopeElement:!0,id:(r?"scope":"l1scope")+t,type:t,enabled:!1,text:n.getScopeDisplayName(i),title:null,icon:t==n.Scope.All?{content:"&#xE8A9",type:1}:i.icon,click:function(){return u.clickHandler(t,"scopeBar")},selected:!1,tooltip:this.getScopeToolTip(t,!1),isSelectable:!0}},s.prototype.clickHandler=function(t,i,r){var h=n.getScopeDisplayName(n.ScopeConfig[t]),e,u=this._currentQuery,f=u.scope,o,s,c;if(this._shouldRenderScopes=!0,this._scopeTiles.some(function(n){return n.type==f})||(f=n.Scope.All),h&&f!=t)e=(t==n.Scope.All||t==n.Scope.PathCompletion?"":h.toLocaleLowerCase()+": ")+u.queryToFetch,this.innerRender(t,t,u,this._topHitPresent,this._resultsPresent,!0,!1),o={query:this._currentQuery,topResults:[],groups:[]},this._page.updateTopResultsView(o,!1),this._page.updateGroupsView(o,!1);else{if(f==n.Scope.All||this._allScopeButtonPresent){this.setFocusInSearchBox("scope clickHandler noop");return}e=u.queryToFetch;t=n.Scope.All;this.innerRender(t,t,u,this._topHitPresent,this._resultsPresent,!0,!1)}s=n.Scope[t];c={Scope:s,Source:i,GroupSource:r&&r.source?r.source.toString():undefined};this._instHelper.logClientInstEvent("Select","ScopeChanged",null,c);f!=t&&n.Host.reformulate(e,undefined,undefined,r);this.setFocusInSearchBox("scope clickHandler "+s)},s.prototype.setFocusInSearchBox=function(t){n.Host.setFocusInSearchBox(null,t);var i=n.getCurrentActiveElement();i&&i.blur()},s.prototype.isScopeElement=function(t){return t&&this._scopeTiles&&(this.isScopeButton(t.id)||n.contains(this._scopeTiles,t))},s.prototype.isMenuElement=function(n){return n&&this.isMenuButton(n.id)},s.prototype.isScopeButton=function(n){return n==this._feedbackButton.id||n==this._rewardsBadgeButton.id||n==this._userProfileButton.id||this.isMenuButton(n)},s.prototype.isMenuButton=function(n){return n==this._moreButton.id||n==this._optionsButton.id},s.prototype.getSelectableItems=function(){var t=[],i;return n.RuntimeConfig.ScopesAvailable&&(t=t.concat(this.getScopeSelectableItems())),i=this._advancedOptionsScope.filter(function(n){return n.layout==0||n.layout==6}),i.length>0&&(t=t.concat(i)),t},s.prototype.getSelectableItemsByGroup=function(){var i=[],t=this.getScopeBarElements(),r,u,e,f;return n.shouldSkipSelectedScope()&&this._selectedScope==t[0]&&(t=t.slice(1)),i.push(t.slice(0,1)),r=t.findIndex(function(n){return n.selected}),r>0?i.push(t.slice(r,r+1)):n.shouldSkipSelectedScope()||(u=t.findIndex(function(n){return n.enabled}),u>0&&i.push(t.slice(u,u+1))),e=[this._moreButton,this._rewardsBadgeButton,this._userProfileButton,this._feedbackButton,this._optionsButton],e.forEach(function(n){_ge(n.id)&&i.push([n])}),f=this._advancedOptionsScope.filter(function(n){return n.layout==0||n.layout==6}),f.length>0&&i.push.apply(i,f.map(function(n){return[n]})),i},s.prototype.getScopeSelectableItems=function(){var r=this.getScopeBarElements(),t=this._currentScopeTileIndex,h=r.length,s;if(n.shouldSkipSelectedScope()&&this._selectedScope==r[0]&&(r=r.slice(1),--t,--h),t<0&&this._selectedScope&&!n.shouldSkipSelectedScope())return[this._selectedScope];if(s=n.getCurrentActiveElement(),s)switch(s.id){case u:return[this._moreButton];case i:return[this._feedbackButton];case f:return[this._optionsButton];case e:return[this._rewardsBadgeButton];case o:return[this._userProfileButton]}return(t<0||t>=h)&&(t=0),r.slice(t,t+1)},s.prototype.getSelectedItem=function(){return null},s.prototype.select=function(t){var i=[].slice.call(this._scopesHeaderElement.getElementsByClassName("scopeTile")),r=n.shouldSkipSelectedScope()?i.filter(function(n){return!n.classList.contains("selectedScope")}):i;this._currentScopeTileIndex=r.indexOf(_ge(t.id));n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=i.indexOf(r[this._currentScopeTileIndex]))},s.prototype.onAfterKeyDown=function(){return!1},s.prototype.getSubstrateUpsellClickHandler=function(t){var r=this,i=function(){n.Host.refreshCurrentPane();n.Host.setFocusInSearchBox(null,"SubstrateUpsell")};return function(){return r._accessTokenManager.promptAutheticateDialog(t,n.getSubstrateResourceOrScope(t),i,i)}},s.prototype.getSubstrateUpsell=function(t,i,r){var c=null,u="VerifyAccountToSearch",f=0,l="CloudSearch",a=["Verify"],e=null,o=[],v,s,h;return r==0?(v=n.getEffectiveScope(this._currentQuery),f=6,s=this._accessTokenManager?this._accessTokenManager.getCachedAccountInfo(t):null,s&&o.push(s.accountUserName),h=[n.Scope.People,n.Scope.Emails,n.Scope.Documents],n.config.accountVerificationInAllScope&&h.push(n.Scope.All),n.contains(h,v)&&(o.length>0&&(u="VerifyAccount"),e=this._substrateUpsellDismiss),l=""):r==2&&(u=null,f=2,c={content:"&#xE9BE",type:2,needsAccentColor:!0},e=this._substrateUpsellDismiss,a=["VerifyAccountToSearch"]),this.createAdvancedOption(t==1?"COFA":"COOA",i,l,u,a,this.getSubstrateUpsellClickHandler(t),f,e,c,null,o,"VerifyButton")},s.prototype.getOneDriveUpsell=function(t){return this.createAdvancedOption("SDSC",t,null,null,["SeeResultsFromOneDrive"],function(){n.Host.launchCortanaSignIn()},2,null,{content:"&#xE9BE",type:2,needsAccentColor:!1})},s.prototype.getIndexingOption=function(t){var i=n.config.controlPanelSearchSettings?function(){return n.Host.launchSearchSettings()}:function(){return n.LocalDataProvider.launchIndexingOptions(!1)};return this.createAdvancedOption("OMIO",t,"",null,["OptionsMenuIndexing"],i,2,null,{type:2,content:"&#xED52"})},s.prototype.getAdvancedOptionCssClass=function(n){return n==4?"menuInfo":n==5?"menuLabel":null},s.prototype.createContextMenuGroup=function(n,t,i,r){var u=this.createAdvancedOption(n,t,null,i,null,null,5);return u.groupItems=r,u.narratorText=u.message,u},s.prototype.createBuildVersionOption=function(){var t=n.Host.getLocString("Build");return{id:"advancedOption"+this._advancedOptionsIdCounter++,selected:!1,title:t,message:undefined,text:t+": "+n.config.snrVersion,instItem:undefined,click:undefined,layout:4,cssClass:this.getAdvancedOptionCssClass(4),isSelectable:!1,subItems:undefined,isExpanded:!1}},s.prototype.createPoweredByBingOption=function(){var t=n.Host.getLocString("PoweredBy","Bing");return{id:"advancedOption"+this._advancedOptionsIdCounter++,selected:!1,title:t,message:undefined,text:t,instItem:undefined,click:undefined,layout:4,cssClass:this.getAdvancedOptionCssClass(4),isSelectable:!1,subItems:undefined,isExpanded:!1}},s.prototype.createDebugFallbackOption=function(t){return this.createAdvancedOption(null,t,"FallbackBundleText",null,["FallbackBundleText"],function(){return n.fallbackToPrepopulatedBundle(new Error("Fallback button clicked"))},2,null,{type:2,content:"&#xE81F"})},s.prototype.createAdvancedOption=function(t,i,r,u,f,e,o,s,h,c,l,a){var w=this,v,p,y;return t&&(v=n.InstrumentedItem.getNonSuggestionInstrumentedItem(t,n.SyntheticQSCodesMaps.KValues,n.SyntheticQSCodesMaps.HandoffsForNonSuggestions[t]),this._instHelper.instrumentSyntheticInstrumentedItem(i,t,v)),p="advancedOption"+this._advancedOptionsIdCounter++,c&&c.length==0&&(c=null),y={id:p,selected:!1,title:n.Host.getLocString(r),message:u?n.Host.getLocString.apply(n.Host,__spreadArrays([u],l?l:[])):null,text:f?n.Host.getLocString(f[0]):null,instItem:v,click:undefined,layout:o,dismiss:s,icon:h,cssClass:this.getAdvancedOptionCssClass(o),isSelectable:!!e||!!c,subItems:c,buttonLabel:n.Host.getLocString(a),isExpanded:!c?undefined:!1},y.click=e?function(t,i){v&&w._instHelper.instrumentItemClick(t,v,n.SequenceNumberManager.getSequenceNumber(),null,i,null);e(y)}:undefined,y},s.prototype.getAccountOptions=function(t){var r=[];if(!this._accessTokenManager)return r;var u=this._accessTokenManager.getCachedAccountInfo(0),f=this._accessTokenManager.getCachedAccountInfo(1),h=this._accessTokenManager.isMsaAvailable(),c=this._accessTokenManager.isAadAvailable(),e="menuItemWithButton focusable",o="removeHover",s="highlight",i;return(u||f)&&(i=this.createAdvancedOption(null,t,null,"ConnectedAccounts",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),u&&n.isCloudSearchEnabledMsaCache&&(i=this.createAdvancedOption(null,t,null,null,["MicrosoftAccount"],null,4),i.message=u.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),n.isSubstrateOutlookAccountConnected||(i.cssClass+=" "+s),r.push(i),this._verifyAccountForMSARequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),i.cssClass=o,i.icon={type:2,content:"&#xE946"},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),i.cssClass=e,r.push(i))),f&&n.isCloudSearchEnabledAadCache&&(i=this.createAdvancedOption(null,t,null,null,["AadAccount"],null,4),i.message=f.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),r.push(i),n.isSubstrateO365AccountConnected||(i.cssClass+=" "+s),this._verifyAccountForAADRequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),i.cssClass=o,i.icon={type:2,content:"&#xE946"},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),i.cssClass=e,r.push(i))),r.push(this.getMenuDividerOption()),i=this.createAdvancedOption("OMAC",t,null,null,["ManageAccounts"],function(){return n.Host.launchWindowsAccountSettings()},2,null,{type:2,content:"&#xE716"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),u&&(n.isCloudSearchEnabledMsaCache||!h)||(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],n.isCloudSearchEnabledMsaCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),f&&(n.isCloudSearchEnabledAadCache||!c)||(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],n.isCloudSearchEnabledAadCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),r},s.prototype.getUserProfileButtonData=function(){var i=this,r,t,n=this._accessTokenManager.getSelectedAccountInfo(),u;return n?(t=n.accountProviderAuthority=="consumers"?0:1,r=this._userProfilesCache[n.accountUserName],!r)?(u=this._substrateProfilePictureProvider.getPersonDefaultIcon(n.accountUserName),this._userProfilesCache[n.accountUserName]=u,this._accessTokenManager.getAccount(t,t==1?"https://outlook.office.com/":"https://outlook.office.com/User.ReadWrite",!1,!0,function(r){if(r&&r.Token){var u=i._substrateProfilePictureProvider.getProfilePictureIconForToken(t,r.Token,n.accountUserName);u&&u(1,function(t){t&&(i._userProfilesCache[n.accountUserName]=t,i.renderScopes())})}}),[u,n.accountUserName]):[r,n.accountUserName]:[null,null]},s.prototype.getAccountOptionsForUserProfileButton=function(t){var l=this,r,i,u,a,h,e,c,v;if(!this._accessTokenManager)return[];var o=this._accessTokenManager.getAllAvailableAccounts(0),s=this._accessTokenManager.getAllAvailableAccounts(1),f=o.concat(s);if(o.length+s.length==0)return[];if(r=[],u=this._accessTokenManager.getSelectedAccountInfo(),u&&(f=f.filter(function(n){return n.accountUserName!=u.accountUserName}),i=this.createAdvancedOption(null,t,null,"ConnectedAccount",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),i=this.createAdvancedOption(null,t,null,null,u.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],null,4),i.message=u.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),r.push(i)),f.length>0)for(i=this.createAdvancedOption(null,t,null,"AvailableAccounts",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),a=function(u){i=h.createAdvancedOption("APPA",t,null,null,u.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],function(){l._accessTokenManager.setSelectedAccount(u);n.Host.notifyAccountSelected(u);l._menuFactory.dismiss()},0,null,{type:2,content:"&#xE77B"});i.message=u.accountUserName;i.cssClass=h.getAdvancedOptionCssClass(0);r.push(i)},h=this,e=0,c=f;e<c.length;e++)v=c[e],a(v);return r.push(this.getMenuDividerOption()),i=this.createAdvancedOption("OMAC",t,null,null,["ManageAccounts"],function(){return n.Host.launchWindowsAccountSettings()},2,null,{type:2,content:"&#xE716"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i),o.length==0&&(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],n.isCloudSearchEnabledMsaCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),s.length==0&&(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],n.isCloudSearchEnabledAadCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),r},s.prototype.getMenuDividerOption=function(){return{id:null,selected:!1,title:"",message:null,isSeparator:!0,text:"",instItem:null,click:null,layout:3,isSelectable:!1}},s.prototype.addZiCustomization=function(t,i,r){var h=this,f,c,u,o,e,s,v,y;if(r===void 0&&(r=!0),n.config.enableSearchHomeCustomization&&this._currentQuery.isSearchHomeZI&&this._currentQuery.scope==n.Scope.All){f={};for(c in this._currentQuery.availableDataSources)if(u=this._currentQuery.availableDataSources[c],u&&u.suggestionGroupToggler){if(typeof u.groupType!="number")throw new Error("missing groupType declaration for suggestionGroupToggler");f[u.groupType]||(f[u.groupType]=u.suggestionGroupToggler)}if(o=this._currentQuery.staticGroupOrder?this._currentQuery.staticGroupOrder.filter(function(n){return!!f[n]}):Object.keys(f).map(function(n){return+n}),o.length!=0){var l=[],p=function(t){var r=f[t],u=r.isHidden(),e=a.createAdvancedOption("OMZI",i,null,null,[],function(){r.toggle(!u);h._menuFactory.dismiss();n.Host.refreshCurrentPane()},2,null,null,null),o=n.getGroupTitleAndNarratorText(a._currentQuery,t,null,!1).title;e.text=n.Host.getLocString(u?"ShowSomething":"HideSomething",o);l.push(e)},a=this;for(e=0,s=o;e<s.length;e++)v=s[e],p(v);y=this.createAdvancedOption(null,i,null,null,["CustomizeSearchHome"],function(n){return h._menuFactory.showSubMenu(n)},2,null,{type:2,content:"&#xE70F"},l);r&&t.push(this.getMenuDividerOption());t.push(y)}}},s.prototype.addSinglepPaneOptions=function(i,r){var e=this,o=this.getScopeBarElements(),s=this.getHiddenScopeElements(o).filter(function(t){return t.type!=n.Scope.All}).map(function(n){var t=n;return t.layout=0,t}),u,f;i.push(this.createContextMenuGroup(null,r,"MoreScopesListToolTip",s));i.push(this.getMenuDividerOption());u=[];t.authenticationManager.getAllSearchWebAccountsAsync?n.config.userProfileButtonEnabled||(f=this.getAccountOptions(r),u.push(this.createAdvancedOption(null,r,null,null,["ConnectedAccounts"],null,2,null,{type:2,content:"&#xE716"},f)),u.push(this.createAdvancedOption("OMSS",r,null,null,["SearchSettings"],function(){return n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettings()},2,null,{type:2,content:"&#xE713"}))):n.isCloudSearchEnabledCache&&this.addCloudSearchUpsells(u,r,2);u.push(this.getIndexingOption(r,1));this.addZiCustomization(u,r,!1);i.push(this.createContextMenuGroup(null,r,"OptionsButtonToolTip",u));this.isFeedbackEnabled()&&(i.push(this.getMenuDividerOption()),i.push(this.createAdvancedOption("FB",r,null,null,["FeedbackButtonText"],function(){return e.showFeedback()},2,null,{type:2,content:"&#xED15"},null)))},s.prototype.getAdvancedOptions=function(i,r){var f=this,u=[],e,o;return r==1&&(t.authenticationManager.getAllSearchWebAccountsAsync&&(n.config.userProfileButtonEnabled||u.push.apply(u,this.getAccountOptions(i)),u.push(this.createAdvancedOption("OMSS",i,null,null,["SearchSettings"],function(){return n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettings()},2,null,{type:2,content:"&#xE713"}))),u.push(this.getIndexingOption(i,r)),this.isFeedbackEnabled()&&n.config.feedbackUnderOption&&(u.push(this.getMenuDividerOption()),e=this.createAdvancedOption("FB",i,null,null,["FeedbackButtonText"],function(){return f.showFeedback()},2,null,{type:2,content:"&#xED15"},null),e.cssClass=this.getAdvancedOptionCssClass(2),u.push(e)),this.addZiCustomization(u,i)),r==2&&this.addSinglepPaneOptions(u,i),r==0&&n.isCloudSearchEnabledCache&&this.addCloudSearchUpsells(u,i,r),r!=2&&n.config.troubleshootButton&&u.push(this.getMenuDividerOption()),n.config.troubleshootButton&&(r==1||r==2)&&u.push(this.createAdvancedOption("OMTS",i,null,null,["Troubleshoot"],function(){return n.Host.launchUri("https://aka.ms/fixsearch")},2,null,{type:2,content:"&#xE90F"},null)),(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest)||!this._optionsWindow||r!=1&&r!=2||u.push(this.createAdvancedOption(null,i,null,null,["OptionsWindowButton"],function(){f._optionsWindow.showOptionsWindow();f._menuFactory.dismiss()},2,null,{type:2,content:"&#xE90F"},null)),r!=0&&n.TestHookUrlParameters&&n.config.debugFallbackScenario&&u.push(this.createDebugFallbackOption(i)),n.config.snrVersion&&(r==1||r==2)&&u.push(this.createBuildVersionOption()),(n.enableProngWeather(n.getCurrentLanguage())||n.shouldEnableWeatherTile(n.getCurrentLanguage())&&n.config.removableWeatherTile)&&u.push(this.createPoweredByBingOption()),r==3&&(o=this.createAdvancedOption("OMTS",n.SequenceNumberManager.getSequenceNumber(),null,null,["LockScreenSettings"],function(){return n.Host.launchLockscreenSettings()},2,null,{type:1,content:"&#xEE3F"}),o.cssClass=this.getAdvancedOptionCssClass(2),u.push(o)),u},s.prototype.addCloudSearchUpsells=function(t,i,r){var e,f,u;if((this.addMsbUpsell(t,i,r),e=n.substrateProvidersEnabled(),r==0||r==2)&&(f=[n.Scope.People,n.Scope.Emails,n.Scope.Documents],n.config.accountVerificationInAllScope&&f.push(n.Scope.All),r!=0||this._selectedScope!=null&&n.contains(f,this._selectedScope.type)))if(e){if(this._upsellGotDismissed&&this._selectedScope&&n.contains(f,this._selectedScope.type)&&r==0)return;u=n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType();(u==1||u==4)&&this._verifyAccountForAADRequired&&t.push(this.getSubstrateUpsell(1,i,r));(u==2||u==4)&&this._verifyAccountForMSARequired&&t.push(this.getSubstrateUpsell(0,i,r))}else n.isBingEnabled()&&n.isCortanaEnabledCache&&t.push(this.getOneDriveUpsell(i))},s.prototype.addMsbUpsell=function(t,i,r){var c=this;if(n.config.msbAccountVerificationInSearchHome&&n.msbEnabledForQuery(null)&&r==0&&this._selectedScope!=null&&this._selectedScope.type==n.Scope.All&&this._currentQuery!=null&&this._currentQuery.isSearchHomeZI){var f=!1,e="MsbVerifyAccount",o=[],s=n.getStoredMsbTenantName(this._storage);s&&(f=!0,e="MsbReverifyAccount",o=[s]);var u={isReverify:f,WSB_SessinRandom:n.Host.createGuid(),WSB_Position:r,WSB_SequenceNumber:i,WSB_ScopeType:this._selectedScope.type},l=function(){var t=function(){_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountSuccess","",u);n.Host.refreshCurrentPane();n.Host.setFocusInSearchBox(null,"MsbAadUpsell")},i=function(){_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountFailed","",u);n.Host.refreshCurrentPane();n.Host.setFocusInSearchBox(null,"MsbAadUpsell")};_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountDialogShown","",u);c._accessTokenManager.promptAutheticateDialog(1,"9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7",t,i)},h=this.createAdvancedOption("MSBA",i,null,e,null,l,6,null,{type:2,content:"&#xE814"},null,o,"VerifyButton");h.cssClass="msb-aad-upsell";t.push(h);_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountUpsellAdded","",u)}},s}();n.HeaderFooterViewModel=s}(WSB||(WSB={})),function(n){function t(n,t){var i=HitHighlightingParser.removeMarkers(n.text),r;!i.includes(t.queryToFetch)&&i.toLowerCase().startsWith(t.queryToFetch.toLowerCase())&&(r=t.queryToFetch+i.substr(t.queryToFetch.length),n.text=HitHighlightingParser.addMarkers(r,t.queryToFetch));!n.query.includes(t.queryToFetch)&&n.query.toLowerCase().startsWith(t.queryToFetch.toLowerCase())&&(n.query=t.queryToFetch+n.query.substr(t.queryToFetch.length))}function i(i,r,u,f,e,o,s){var c,h;if(i.actionUri=f,i.confidence=o,i.source=s,i.handoffType==4)if(c=i.query.toLowerCase()==r.queryToFetch.toLowerCase(),i.updateFromQuery=function(t){return c?(i.query=t.queryToFetch,i.text=HitHighlightingParser.addMarkers(i.query,t.queryToFetch),i.narratorText=n.getNarratorText(i),!0):!1},h=n.parseTaskFrame(e),h)i.isReformulation=!0,i.click=function(){return n.safeSetTimeout(function(){return n.Host.reformulate(i.query,h)},0,"Cat1Click-Reformulation")};else return!1;else i.classNames.push("action"),i.click=function(){return n.Host.launchCat1(i.query,f,e)};return i.icon={type:3},t(i,r),i.narratorText=n.getNarratorText(i),i.type!="CSK"&&(i.getMruData=function(){return{type:i.type,handoffType:i.handoffType,hc:i.hc,highConfidenceMetaSuggestionScore:i.highConfidenceMetaSuggestionScore,prefetchConfidenceScore:i.prefetchConfidenceScore,query:i.query,textWithoutHH:HitHighlightingParser.removeMarkers(i.text),annotation:i.primaryMetadata,icon:i.getIcon?null:i.icon,actionUri:f,taskFrame:e,confidence:o,source:s,suggestionKey:n.getSuggestionKey(i)}}),!0}function o(i,r,u,e,o,s,h,c,l,a,v){if(i.isAnswer=!0,i.htmlContent=e&&e.Content?e.Content.HTML:null,i.baseSearchUrl=h,i.segments=c,i.htmlContent){var y=JsonInject.GetResourceKeys([e]);y&&(i.executeScript=function(){return JsonInject.WriteAfterContentResources(JsonInject.FilterResources(a,y))})}s&&(i.secondaryIcon={content:s,type:0});i.text.includes(HitHighlightingParser.startMarker)||(i.text=HitHighlightingParser.addMarkers(i.text,r.queryToFetch));i.htmlContent||o&&(i.primaryMetadata=o,i.additionalInfoText=" - "+o);i.handoffType==10?(i.classNames.push("action"),t(i,r),i.icon={type:3},i.click=function(){return n.Host.launchCat2or3a(i.query,l)},i.allowedInGroups=!i.htmlContent):(f(i,r),i.click=function(){return n.Host.launchSearch(i.query,v.getSearchUrl(r.fullPartialQuery,i.query,i.type,i.baseSearchUrl),!1)},i.allowedInGroups=i.secondaryIcon?!!i.additionalInfoText:!i.htmlContent);i.narratorText=n.getNarratorText(i)}function r(t,i,r,u,e,o){f(t,i);i.queryToFetch||(t.text=HitHighlightingParser.addMarkers(t.text));t.baseSearchUrl=u;t.click=function(){return n.Host.launchSearch(t.query,e.getSearchUrl(i.fullPartialQuery,t.query,t.type,t.baseSearchUrl,t.handoffType),t.useRaf)};t.narratorText=n.getNarratorText(t);t.getMruData=function(){return{type:t.type,handoffType:t.handoffType,hc:t.hc,highConfidenceMetaSuggestionScore:t.highConfidenceMetaSuggestionScore,prefetchConfidenceScore:t.prefetchConfidenceScore,query:t.query,textWithoutHH:HitHighlightingParser.removeMarkers(t.text),title:t.primaryMetadata,icon:t.getIcon?null:t.icon,url:t.baseSearchUrl,suggestionKey:n.getSuggestionKey(t)}};t.type=="HS"&&n.setExtraVerbs(t,function(){var i=[{verb:"ManageSearchHistory",displayName:n.Host.getLocString("ManageSearchHistory"),executeSync:function(){return n.Host.launchPrivacyPortal()},icon:{content:"&#xE81C",type:2}}];return n.config.removeSuggUrl&&i.unshift({verb:"RemoveFromWebHistory",displayName:n.Host.getLocString("RemoveFromWebHistory"),executeSync:function(){return o(t.text)},icon:{content:"&#xE711",type:2}}),i},!0)}function u(t,i,r,u){t.url=u;t.tooltip=i.isSearchHomeZI?t.text+"\n\n"+u:u+"\n\n"+HitHighlightingParser.removeMarkers(t.primaryMetadata);n.isValidIcon(t.icon)||(t.getIcon=n.Host.getEdgeIcon);t.click=function(){return n.Host.launchUri(u)};t.narratorText=n.getNarratorText(t,n.Host.getLocString("DirectNavSuggestion"));t.getMruData=function(){return{type:t.type,handoffType:t.handoffType,hc:t.hc,highConfidenceMetaSuggestionScore:t.highConfidenceMetaSuggestionScore,prefetchConfidenceScore:t.prefetchConfidenceScore,query:t.query,textWithoutHH:HitHighlightingParser.removeMarkers(t.text),title:t.primaryMetadata,icon:t.getIcon?null:t.icon,url:u,suggestionKey:n.getSuggestionKey(t)}}}function f(t,i){n.isValidIcon(t.icon)||(t.icon=t.type=="HS"?{content:"&#xE81C",type:2}:t.handoffType===13?{content:"&#xEB9F",type:2}:t.handoffType===14?{content:"&#xE714",type:1}:n.getSearchSuggestionIcon());t.primaryMetadata||t.secondaryIcon||t.htmlContent||t.additionalInfoText||(t.primaryMetadata=t.handoffType===13?n.Host.getLocString("SearchForWebImages"):t.handoffType===14?n.Host.getLocString("SearchForWebVideos"):n.getWebSuggestionAnnotation(n.msbEnabledForQuery(i)))}var e=function(){function t(t,i,r,u,f){var e=this;this._instrumentationHelper=t;this._navigationHelper=i;this._temporaryMessageHandler=r;this._accessTokenManager=u;this._previousKeystrokeCache=f;this.removeBingHistorySuggestionCallBack=function(t){e._accessTokenManager?e._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,function(n){if(n&&n.Token){var i={};i["X-Search-RPSToken"]=n.Token;e.sendRemoveBingHistorySuggestionRequest(t,i)}}):e.sendRemoveBingHistorySuggestionRequest(t,null)}}return t.prototype.parse=function(n,t,i,r,u,f,e){this.parseOnlineSuggestions(n,t,r,u,f,e,i)},t.prototype.parseOnlineSuggestions=function(t,i,r,u,f,e,o){var l=this,s,c,b;if(!r){n.isDataSourceEnabled("Web",t)&&f("Web",[],null);n.isDataSourceEnabled("OSTMA",t)&&f("OSTMA",[],null);n.isDataSourceEnabled("QS",t)&&f("QS",[],null);return}r&&r.ELToken&&(n.Host.setElToken(r.ELToken),r.LC==1&&n.Host.sendElToken());var a=[],v=[],y=[],h=[],p=[],w=n.isDataSourceEnabled("Web",t);n.safeExecute(function(){for(var e,s=function(u){var s=u.Attributes,c=s.appId,f,e;if(c)return v.push(u),c.split(";").forEach(function(t){n.contains(h,t)||h.push(t)}),"continue";if(f=s.settingId,f)return y.push(u),p.push(f),"continue";w&&(e=n.safeExecute(function(){return l.parseOnlineSuggestion(t,u,i,r.Resources,o)},"parseOnlineSuggestion"),e&&a.push(e))},u=0,f=r.Suggestions;u<f.length;u++)e=f[u],s(e)},"parseOnlineSuggestions");w&&(s=null,c=null,r.RankingSignals&&(s=n.safeExecute(function(){return n.parseWebEngagementSignals(r.RankingSignals)},"parseWebEngagementSignals"),n.isL2(t)||(c=n.safeExecute(function(){return n.parseWebSuppressionSignals(r.RankingSignals,t)},"parseWebSuppressionSignals"))),this._previousKeystrokeCache&&this._previousKeystrokeCache.updateWebSignalsData(t.queryToFetch,s),b={rankingSignals:r.RankingSignals,engagementSignals:s,suppressedGroups:c,webTopResultRoutingType:r.PrefixRoutingType},f("Web",a,b));n.lookupById(t,"OSTMA",h,v,function(n){return n.Attributes.appId.split(";")},"QS",p,y,function(n){return n.Attributes.settingId},u,i,f,e,function(n,u,f,e){return l.parseIdLookupResponse(r,t,i,n,u,f,e)},null,null,null,null,this._instrumentationHelper)},t.prototype.parseIdLookupResponse=function(t,r,u,f,e,o,s){var h=this,c,l;if(o.length!=1){c=n.safeExecute(function(){return h.parseOnlineSuggestion(r,f,u,t.Resources,e)},"parseOnlineSuggestion "+e);c&&s.push(c);return}l=function(t){var e=f.Attributes;return h.compliesWithMinVersion(e.appMinVersion,t.deviceItem.version)?(t.appContext=e.appContext,h.setRankingSignals(t,f),f.Text&&e.query&&(!n.isApp(t.type)||t.appContext)&&(t.text=f.Text,t.query=e.query),f.SecondaryText&&(t.primaryMetadata=f.SecondaryText),t.handoffType==5)?i(t,r,u,e.actionUri,e.taskFrame,parseFloat(e.confidence),parseInt(e.source)):!0:!1};n.safeExecute(function(){return n.parseLocalSuggestion(r,o[0],e,u,h._temporaryMessageHandler,f.Attributes.stype,h._instrumentationHelper,s,l)},"parseLocalSuggestion "+e)},t.prototype.parseOnlineSuggestion=function(t,f,e,s,h){var d=this,c=f.Attributes,a=c.stype,y,l,v;if(a=="CS"||c.appId||c.settingId)return null;if(y=c.isAnswer==="1"?c.url||c.vertical?n.verticalToHandoffType(c.vertical):10:c.taskFrame?c.actionUri.startsWith("action://FindMyStuff/")?4:5:a=="MD"||a=="ML"?1:n.verticalToHandoffType(c.vertical),l=n.createSuggestion(t,f.Text,null,n.getIconFromOnlineResponse(f),a,c.query,n.InstrumentedItem.createInstrumentedItem(e,a),y,e,!1),l.primaryMetadata=f.SecondaryText,this.setRankingSignals(l,f),l.autoOpenPreviewPaneWhenOnTopHit=c.openPP==="1",c.isAnswer==="1"){if(!c.url&&!n.isCortanaEnabledCache)return null;l.signals=f.Signals;o(l,t,e,f.InstantAnswer,c.additionalInfoText,c.secondaryIconUrl,c.url,c.segments,c.taskFrame,s,this._navigationHelper);c.noHeightRestriction==="1"&&l.classNames.push("noHeightRestriction")}else if(c.taskFrame){if(!n.isCortanaEnabledCache||!i(l,t,e,c.actionUri,c.taskFrame,parseFloat(c.confidence),parseInt(c.source)))return null}else{if(!c.url)return null;if(l.autoOpenPreviewPaneWhenOnTopHit=c.openPP==="1",l.type=="MD"||l.type=="ML")v=n.prettyPrintUrl(c.query,t.queryToFetch,!0),v!=l.query&&(l.query=v,l.text=t.queryToFetch?HitHighlightingParser.addMarkers(v,t.queryToFetch):v),l.primaryMetadata&&!l.primaryMetadata.includes(HitHighlightingParser.startMarker)&&(l.primaryMetadata=HitHighlightingParser.addMarkers(l.primaryMetadata,t.queryToFetch)),u(l,t,e,c.url);else{if(n.queryLooksLikeUrl(l.query))return null;r(l,t,e,c.url,this._navigationHelper,this.removeBingHistorySuggestionCallBack)}}if(!n.isValidSuggestion(l,"parseOnlineSuggestion"))return null;var g=["Actor","City","Place","Country","State","Animal","Attraction","Food","Artist","People"],nt=["Song","TvShow","Movie"],p=l.segments,w=p?p.split(","):[],b=w.some(function(t){return n.contains(g,t)}),k=w.some(function(t){return n.contains(nt,t)});return(f.ChildSuggestions||b||k)&&(l.calculateChildSuggestions=function(){return d.calculateRelatedSuggestions(l,t,f,h,b,k)}),l},t.prototype.setRankingSignals=function(n,t){var i=t.Attributes;n.hc=i.hc==="1";n.highConfidenceSuggestionScore=+i.hcs;n.highConfidenceMetaSuggestionScore=t.HighConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.PrefetchConfidenceScore;n.suggestionLogMeta=i.lm},t.prototype.compliesWithMinVersion=function(n,t){var r,u,i,f,e;if(!n)return!0;if(!t)return!1;for(r=n.split("."),u=t.split(".");r.length>u.length;)u.push("0");for(i=0;i<r.length;++i){if(f=u[i],e=r[i],f<e)return!1;if(f>e)return!0}return!0},t.prototype.sendRemoveBingHistorySuggestionRequest=function(t,i){var u=this,r;t=HitHighlightingParser.removeMarkers(t);r=n.config.removeSuggUrl.replace("%7b0%7d",encodeURIComponent(t)).replace("%7bSID%7d",sj_cook.get("_SS","SID"));n.fetchUrlJson(r,i,null,function(i){i&&i.success&&(n.Host.refreshCurrentPane(),n.safeSetTimeout(function(){return u._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemoveFromWebHistoryConfirmation",t))},250,"removeBingHistorySuggestion"))})},t.prototype.addRelatedSuggestion=function(t,i,u,f,e,o,s){var h=n.createSuggestion(i,f,null,e,o,t?t.Query:u.query,n.InstrumentedItem.createInstrumentedItem(u.sequenceNumber,o),s,u.sequenceNumber,!1,null,null,!0);h.groupType=n.GroupType.Related;h.parent=u;h.tooltip=t?t.SecondaryText:null;h.rankingScore=t?t.RankingScore:0;h.category=t?t.Category:null;h.isAnswer=!0;r(h,i,u.sequenceNumber,t?t.Url:null,this._navigationHelper,this.removeBingHistorySuggestionCallBack);h.primaryMetadata=null;n.isValidSuggestion(h,"calculateRelatedSuggestions")&&u.childSuggestions.push(h)},t.prototype.calculateRelatedSuggestions=function(t,i,r,u,f,e){var s,h,o;if(t.childSuggestions=[],r.ChildSuggestions)for(s=0,h=r.ChildSuggestions;s<h.length;s++)o=h[s],this.addRelatedSuggestion(o,i,t,o.Text,n.getIconFromOnlineResponse(o),o.Type,0);f&&this.addRelatedSuggestion(null,i,t,n.Host.getLocString("Images"),null,"EIM",13);e&&this.addRelatedSuggestion(null,i,t,n.Host.getLocString("Videos"),null,"EVI",14);t.childSuggestions.length>0&&this._instrumentationHelper.instrumentDataSource(t.sequenceNumber,u,t.childSuggestions,null)},t}();n.OnlineSuggestionsParser=e;n.adjustCasing=t;n.setCat1SuggestionProperties=i;n.setWebSearchSuggestionProperties=r;n.setUrlSuggestionProperties=u}(WSB||(WSB={})),function(n){function p(n){return n?[n]:[]}function ut(n){if(n){var t=n.lastIndexOf(".");if(t>=0)return n.substring(t)}return""}function ft(t){var i=t?new Date(t):null;return n.isValidDate(i)?i:null}function et(t){if(t){var i=n.getCurrentDate();if(i.getDate()==t.getDate()&&i.getMonth()==t.getMonth()&&i.getFullYear()==t.getFullYear())return t.toLocaleTimeString(n.uiLanguageCache,{hour:"numeric",minute:"numeric"})}return null}function r(t,r,u,e,o){var g,nt,p,c,h,w,l,v,s,y,b;if(o===void 0&&(o=!1),!o&&e.extensionLC&&SearchAppWrapper.CortanaApp.hideFileExtensions){var k=e.extensionLC.length,a=e.query,d=a.toLocaleLowerCase();d.endsWith(e.extensionLC)&&(g=HitHighlightingParser.addMarkers(a,r),g.toLocaleLowerCase().endsWith(e.extensionLC)&&(e.query=a.substring(0,a.length-k),nt=HitHighlightingParser.removeMarkers(e.text||"").toLocaleLowerCase(),d==nt&&(p=e.text.toLocaleLowerCase().lastIndexOf(e.extensionLC),e.text=e.text.substring(0,p)+e.text.substr(p+k))))}for(e.lastModifiedDate&&(c=e.lastModifiedDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),h=e.path,e.tooltip=at(e,h,c),e.primaryMetadata=e.sourceForGroup&&e.sourceForGroup!=1?n.getGroupSourceDisplayName(e.sourceForGroup):e.itemTypeDisplayName,(t.isSearchHomeZI||n.RuntimeConfig.QfMode==8)&&(e.additionalInfoText=h),e.classNames=[],e.match?(w=(vt(e.match.matchType)?n.Host.getLocString(n.MatchType[e.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(e.match.matchedText,r),e.additionalInfoText=w,e.secondaryMetadata=w,e.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")):c&&n.RuntimeConfig.QfMode!=5&&(e.secondaryMetadata=n.Host.getLocString("LastModified")+": "+c),e.narratorText=n.getNarratorText(e),n.displayedInGridLayout(e.type)&&(u?e.classNames.push("bigIcon","biggerIcon"):e.classNames.push("bigIcon")),!o&&e.handoffType==2&&SearchAppWrapper.CortanaApp.copyToClipboard&&i(e,function(){return[{verb:n.JumplistActionItemType[n.JumplistActionItemType.S_CopyFullPath],displayName:n.Host.getLocString("CopyFullPath"),executeSync:function(){return SearchAppWrapper.CortanaApp.copyToClipboard(e.path,"")},icon:{type:1,content:"&#xE8C8"}}]},!1),l={},h&&(v=h.lastIndexOf("/"),v<0&&(v=h.lastIndexOf("\\")),s=h.substring(0,v),s.endsWith(":")&&(s=s+"\\"),l[n.Host.getLocString("Location")]=[{text:s,click:function(){return n.isUncOrLocalPath(s)?SearchAppWrapper.CortanaApp.launcher.startLaunchFolder(s):e.locationUrl?SearchAppWrapper.CortanaApp.launcher.launchUriAsync(decodeURI(e.locationUrl)):SearchAppWrapper.CortanaApp.launcher.launchUriAsync(s)}}]),l[n.Host.getLocString("LastModified")]=[{text:c}],y=0,b=f;y<b.length;y++){var tt=b[y],rt=tt[0],ut=tt[1],it=e[ut];it&&(l[n.Host.getLocString(n.MatchType[rt])]=[{text:it}])}e.previewMetadata=l}function ot(t,i,u){var e,o;for(i.match||!u.match||i.parentFolderDisambig||(i.match=u.match,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0),e=0,o=f;e<o.length;e++){var c=o[e],s=c[1],h=u[s];h&&!i[s]&&(i[s]=h,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0)}(n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&(i.needsRefreshAfterDeduping=!1,i.previewPaneNeedsRefreshAfterDeduping=!1);i.needsRefreshAfterDeduping&&r(t,n.getEffectiveQuery(t),n.isL2(t),i,!0)}function st(t,i){return n.Promise.safeChainWithGlobalCaching("getIconForTypeAsync",function(t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getIconForTypeAsync(i,n.getImageSizeValue(t))},function(n){return n+"_"+i},function(i){return n.toIcon(i,"getIconForTypeAsync",t)},t)}function w(n){return n!=null&&(n.type==3||!!n.content||!!n.className)}function e(n,t,i){i===void 0&&(i=!0);var r=n.mayContainPII;return n.text?n.query?!n.handoffType&&n.handoffType!==0?(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing handoff type")),!1):n.type?i&&!n.getIcon&&!w(n.icon)?(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing icon")),!1):!0:(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing suggestion type")),!1):(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing query")),!1):(SharedLogHelper.LogError(t,r?"":n.deviceItem?n.deviceItem.id:"",new Error("Missing text")),!1)}function i(t,i,r){var u=t.getExtraVerbs;t.getExtraVerbs=function(t){var f=u?u(t):[],e=i(t);return n.joinVerbs(f,e,r)}}function ht(t,i,r){var u=t.getExtraVerbsAsync;t.getExtraVerbsAsync=u?function(t){return ThresholdUtilities.createPromise(function(f){return u(t).then(function(u){return i(t).then(function(t){return f(n.joinVerbs(u,t,r))})})})}:i}function u(n,t){var r=n.propertyHits||[],i=r.indexOf(t);return typeof i=="object"&&i.returnValue!==undefined?i.returnValue:i>=0}function ct(n){var i,t;if(n&&typeof n=="object"&&n.length){for(i="",t=0;t<n.length;t++)i+=n[t],t!=n.length-1&&(i+=", ");return i}return n}function t(t,i,r){return n.safeExecute(function(){return ct(t.getProperty(i))},"get"+i,undefined,r)}function lt(t){for(var r,f,o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];for(r=0,f=o;r<f.length;r++){var e=f[r],h=e[0],s=e[1],c=e[2];if(s&&u(t,c))return n.createMatch(h,s)}return null}function at(t,i,r){var u=i||"",o,s,e,h;for(t.textContentIfMatched&&(u+=(u?"\n\n":"")+t.textContentIfMatched),o=!!u,s=function(){u&&(u+="\n");o&&(u+="\n",o=!1)},r&&(s(),u+=n.Host.getLocString("LastModified")+": "+r),e=0,h=f;e<h.length;e++){var c=h[e],a=c[0],l=c[1],v=t[l];v&&(s(),u+=n.Host.getLocString(n.MatchType[a])+": "+t[l])}return u}function vt(t){switch(t){case n.MatchType.Author:case n.MatchType.LastModifiedBy:case n.MatchType.Tags:case n.MatchType.Genre:case n.MatchType.Album:case n.MatchType.Artist:return!0;case n.MatchType.Content:case n.MatchType.Location:return!1;default:throw new Error("Unknown match type: "+t);}}function yt(t,i,r,u,f,e,o,s,h,c,l,a,v,y,w,b,k,d,g){i&&n.isDataSourceEnabled(i,t)&&n.LocalDataProvider.getApps(r,function(t){var e,s,r,o,h;if(c()){for(g.instrumentResponseReceived(l,i,null,0,!1,!1),e=[],s=function(r){n.safeExecute(function(){return y(r,i,f(r).map(function(n){return t[n]}).filter(function(n){return!!n}),e)},"parseApp "+i)},r=0,o=u;r<o.length;r++)h=o[r],s(h);a(i,e,null)}},v,i);e&&n.isDataSourceEnabled(e,t)&&n.LocalDataProvider.getSettings(o,function(t){var u,o,r,f,v;if(c()){for(g.instrumentResponseReceived(l,e,null,0,!1,!1),u=[],o=function(r){n.safeExecute(function(){return y(r,e,p(t[h(r)]),u)},"parseSetting "+i)},r=0,f=s;r<f.length;r++)v=f[r],o(v);a(e,u,null)}},v,e);w&&n.isDataSourceEnabled(w,t)&&n.LocalDataProvider.getFiles(b,function(t){var r,f,i,u,e;if(c()){for(g.instrumentResponseReceived(l,w,null,0,!1,!1),r=[],f=function(i){n.safeExecute(function(){return y(i,w,p(t[d(i)]),r)},"parseFile "+w)},i=0,u=k;i<u.length;i++)e=u[i],f(e);a(w,r,null)}},t,v,w)}function pt(t){return n.EdgeAppIds.some(function(n){return t.id==n})?n.Host.getLocString("MicrosoftRecommendedBrowser"):n.Host.getLocString("App")}function wt(t){return n.isModernSetting(t)?n.Host.getLocString("SystemSettingsAnnotation"):n.Host.getLocString("ControlPanelAnnotation")}function bt(t){return n.isFileOrFolder(t.type)?t.deviceItem:null}function kt(t,u,f,e,o,s){var h=n.getAppItem(o),l,a,c,v,p,y,w;if(h){e&&k(o,h);o.primaryMetadata=pt(h);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";o.type=="IBA"&&(o.tooltip=h.id,o.path=h.id);return}if(n.isSetting(o.type)){o.primaryMetadata=wt(o.deviceItem);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";return}if(o.type=="LURL"&&(h=o.deviceItem,h)){l=h.id;o.narratorText=n.getNarratorText(o,n.Host.getLocString("DirectNavSuggestion"));o.tooltip=o.query+"\n\n"+l;o.url=l;return}if(a=bt(o),a){dt(t,u,f,e,s,o,a);return}if(o.type=="PT"||o.type=="CG"){if(c=o,o.type!="PT"&&o.deviceItem.launchArguments||(c.path=o.deviceItem.id),v=o.deviceItem,p=v.kind,p=="program"){d(o);return}if(y=gt(v),y){c.itemTypeDisplayName=y;r(t,u,f,c);return}o.type=="CG"&&d(o);return}if(o.type=="FEH"){o.narratorText=n.getNarratorText(o,n.Host.getLocString("SearchHistorySuggestion"));u&&(o.text=HitHighlightingParser.addMarkers(o.text,u));SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.onSearchHistoryRemoved&&(w={verb:"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:function(){SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.onSearchHistoryRemoved(o.query);n.Host.refreshCurrentPane()},icon:{content:"&#xE711",type:2}},i(o,function(){return[w]},!1));return}throw new Error("Unexpected type: "+o.type);}function dt(i,f,e,o,s,h,c){var y,p,d,w,b,v,a,l,g,nt;if(d=h.type=="LDOC"?n.resolveKnownFolderGUIDsInPath(c.id):n.indexerFilePathToRegularPath(c.id),h.path=d,h.itemTypeDisplayName=c.itemTypeDisplayName,o&&k(h,c),w=c.lastModifiedDate,n.isValidDate(w)&&(h.lastModifiedDate=w),b=c.extension,b&&(h.extensionLC=b.toLocaleLowerCase()),s!="MFF"||n.IndexerQueryGenerator){h.type=="MU"&&(h.artist=n.IndexerQueryGenerator?t(c,"System.Music.DisplayArtist",s):t(c,"System.Music.Artist",s),h.album=t(c,"System.Music.AlbumTitle",s));v=void 0;switch(s){case"MPVD":h.author=t(c,"System.Author",s);h.lastModifiedBy=t(c,"System.Document.LastAuthor",s);h.tags=t(c,"System.Keywords",s);h.tags+=t(c,"System.Photo.TagViewAggregate",s);u(c,"System.Search.Contents")&&(a=t(c,"System.Search.AutoSummary",s),a&&(y=n.tryGetTextContentMatch(a,f),h.textContentIfMatched=y[0],v=y[1]),c.propertyHits.length==1&&(h.matchedOnlyOnContent=!0));n.IndexerQueryGenerator&&(h.artist=t(c,"System.Music.DisplayArtist",s),h.genre=t(c,"System.Music.Genre",s));break;case"MDOC":h.author=t(c,"System.Author",s);h.lastModifiedBy=t(c,"System.Document.LastAuthor",s);h.tags=t(c,"System.Keywords",s);u(c,"System.Search.Contents")&&(a=t(c,"System.Search.AutoSummary",s),a&&(p=n.tryGetTextContentMatch(a,f),h.textContentIfMatched=p[0],v=p[1]),c.propertyHits.length==1&&(h.matchedOnlyOnContent=!0));break;case"MPHO":h.tags=t(c,"System.Photo.TagViewAggregate",s);break;case"MVID":n.IndexerQueryGenerator&&(h.artist=t(c,"System.Music.DisplayArtist",s),h.genre=t(c,"System.Music.Genre",s));h.tags=t(c,"System.Keywords",s);break;case"MMUS":h.genre=t(c,"System.Music.Genre",s)}!h.text.includes(HitHighlightingParser.startMarker)&&f&&(l=void 0,g=s!="LM"&&s!="FL",g&&(s=="MFF"?(l=t(c,"System.Title",s),l&&!n.matchesOnPropertyHH(l,f)&&(l=undefined)):u(c,"System.Title")&&(l=t(c,"System.Title",s))),l?h.text=HitHighlightingParser.addMarkers(l,f):v?h.match=v:(nt=n.IndexerQueryGenerator?"System.Music.DisplayArtist":"System.Music.Artist",h.match=lt(c,s,[n.MatchType.Album,h.album,"System.Music.AlbumTitle"],[n.MatchType.Artist,h.artist,nt],[n.MatchType.Genre,h.genre,"System.Music.Genre"],[n.MatchType.Tags,h.tags,"System.Keywords"],[n.MatchType.Tags,h.tags,"System.Photo.TagViewAggregate"],[n.MatchType.Author,h.author,"System.Author"],[n.MatchType.LastModifiedBy,h.lastModifiedBy,"System.Document.LastAuthor"])))}r(i,f,e,h);ni(h)}function k(t,i){var r=n.safeExecute(function(){return i.getProperty("System.Link.TargetParsingPath")},"getTargetPath"),u,f,e;r&&(r=r.toLocaleLowerCase(),u=n.getKnownFolderPathLC(n.FOLDERID_Profile),u&&(f=n.getKnownFolderPathLC(n.FOLDERID_SystemX86),f&&r.startsWith(f+"\\config\\systemprofile")?r=u+r.substr(f.length+21):(e=n.getKnownFolderPathLC(n.FOLDERID_System),e&&r.startsWith(e+"\\config\\systemprofile")&&(r=u+r.substr(e.length+21)))),t.targetPathLC=r)}function gt(n){if(n.launchArguments)return null;var t=n.itemTypeDisplayName;return t&&t[0]!="."?t:null}function o(t){for(var f,a,o,s,c,i,h,r,l,e=[],u=0;u<t.length-1;++u)if(!n.displayedInGridLayout(t[u].type))for(f=u+1;f<t.length;++f)if(t[u].type==t[f].type&&t[u].text.toLocaleLowerCase()==t[f].text.toLocaleLowerCase()){e[u]=!0;e[f]=!0;break}if(e.length!=0)for(a=t.filter(function(n,t){return e[t]}),o=n.Host.getLocString("InfoTextWithSource"),s=0,c=a;s<c.length;s++)if(i=c[s],i.path){if(h=i.path.lastIndexOf("\\"),h==-1)continue;if(r=i.path.slice(i.path.lastIndexOf("\\",h-1)+1,h),l=i.handoffType==2?null:i.primaryMetadata,l&&r.endsWith(":"))continue;i.type=="IBA"?(i.secondaryMetadata=i.primaryMetadata,i.primaryMetadata=r):i.primaryMetadata=i.primaryMetadata?l?n.formatString(o,[r,i.primaryMetadata]):n.formatString(o,[i.primaryMetadata,r]):r;i.additionalInfoText=n.formatString(o,[" -",r]);i.match&&(i.classNames=i.classNames.filter(function(n){return n!="withMatchAnnotation"&&n!="forceNoWrapOutsideTopResult"}));i.narratorText=n.getNarratorText(i);i.parentFolderDisambig=r}}function d(t){t.primaryMetadata=n.Host.getLocString("RunCommandPrompt");t.classNames.push("action");t.narratorText=n.getNarratorText(t)}function g(t,i,r,u,f,o,s,h,c){var b=n.localDataSourceMayContainPII(r),k,p,a,w,d;if(!o){k=i.deviceItem.kind;SharedLogHelper.LogError("parseLocalSuggestion"+r,b?"":i.deviceItem.displayName||i.deviceItem.id,new Error("Unrecognized kind: "+k));return}if(p=o=="LURL"?1:2,n.isSuggestionTypeEnabled(r,o,p,t)){var v=n.getEffectiveQuery(t),y=i.deviceItem.displayName,g=y&&v?HitHighlightingParser.addMarkers(y,v):y,l=n.createSuggestion(t,g,i.getIcon,i.icon,o,y,n.InstrumentedItem.createInstrumentedItem(u,o),p,u,b);l.uxHint=fi(i,v);i.deviceItem.isSimulated||(l.deviceItem=i.deviceItem);l.ciMetaData=i.ciMetaData;n.isApp(o)&&(l.pinnedToTaskbar=n.Host.isPinnedToTaskbar(i.deviceItem.id));i.groupDisplayName&&(l.groupDisplayName=i.groupDisplayName);a=n.getAppItem(l);a?(l.click=function(){return n.Host.launchAppItem(a,r,l.appContext)},n.config.maxJLcm&&ti(t,l,a,f,u,r,s)):l.click=l.type=="FEH"?function(){return n.Host.submitFileExplorerTextSuggestion(l.query)}:l.type=="FD"&&n.RuntimeConfig.QfMode==5?function(){return n.Host.submitFileExplorerFolderSuggestion(l.path)}:function(){return n.Host.launchDeviceItem(l.deviceItem,r)};a&&l.type!="IBA"||n.isSetting(l.type)||n.isFileOrFolder(l.type)&&l.type!="LDOC"?l.getMruData=function(){return{type:l.type,handoffType:l.handoffType,hc:l.hc,highConfidenceMetaSuggestionScore:l.highConfidenceMetaSuggestionScore,prefetchConfidenceScore:l.prefetchConfidenceScore,id:i.deviceItem.id,suggestionKey:n.getSuggestionKey(l),appContextData:l.appContext?{appContext:l.appContext,query:l.query,textWithoutHH:HitHighlightingParser.removeMarkers(l.text)}:undefined}}:(w=n.getCommandLineItem(l),w&&(l.hc=n.isRealCommand(l,w)));d=n.getGroupType(l);n.shouldSetThisPcGroupSource(d,t)&&(l.sourceForGroup=1);kt(t,v,n.isL2(t),n.supportsShortcuts(r,t),l,r);(n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&(l.additionalInfoText=undefined,l.primaryMetadata=undefined,l.secondaryMetadata=undefined);e(l,"parseLocalSuggestion "+r)&&c(l)&&h.push(l)}}function ni(t){i(t,function(){var i,r;return t.duplicates&&(i=t.duplicates.find(function(n){return n.handoffType==7||n.handoffType==8}),i)?(r=[],r.push({verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenInBrowser],displayName:n.Host.getLocString("OpenInBrowser"),executeSync:function(){return n.Host.launchUri(i.url+(i.handoffType==8?"?web=1":""))},icon:{type:1,content:"&#xE774"}}),i.locationUrl&&r.push({verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenFileLocationInBrowser],displayName:n.Host.getLocString("OpenFileLocationIn",n.getGroupSourceDisplayName(i.sourceForGroup)),executeSync:function(){return n.Host.launchUri(i.locationUrl)},icon:{type:2,content:"&#xE838"}}),r):[]},!0)}function nt(t,i){return!n.config.enableFallbackIconsForJumpLists||!y[t]?!1:n.contains(y[t],i)}function ti(t,r,u,f,e,o,h){var y=u.id,w=u.filePath,l,b,p;if(!n.config.forceAllJumplists){if(l=n.config.enableJumplistRestrictions&&it[y],!l&&w){b=w.toLowerCase();for(p in v)if(b.includes(p)){l=v[p];break}if(!l&&n.config.enableJumplistRestrictions)for(p in a)if(b.includes(p)){l=a[p];break}}if(l&&l.length==0)return}(n.RuntimeConfig.AlwaysWide||!rt.find(function(n){return n==y}))&&(r.calculateChildSuggestions=function(){return ii(t,y,w,r,u,l,f,e,o,h)},n.config.maxJLcm&&i(r,function(t){var i=[],e,o;return t||(r.calculateChildSuggestions&&r.calculateChildSuggestions(),!r.childSuggestions||n.RuntimeConfig.AlwaysWide&&r.previewPaneType||(e=!1,r.childSuggestions.filter(function(t){return t.type=="JL"&&!t.displayed&&t.groupType==n.GroupType.JumpListTasks}).slice(0,n.config.maxJLcm).forEach(function(n){e=!0;var t=nt(r.deviceItem.id,n.groupType)?r.getIcon:s(n.jumpListItem,n.parent,!1,y),o={verb:"JumpListTask_"+y+"_"+n.text,displayName:n.text,executeSync:function(){return c(u,n,f)},getIcon:t};i.push(o)}),o=!1,r.childSuggestions.filter(function(t){return t.type=="JL"&&!t.displayed&&t.groupType!=n.GroupType.JumpListTasks}).slice(0,n.config.maxJLcm).forEach(function(n,t){var r,h;e&&!o&&(r={},i.push(r));o=!0;h={verb:"JumpList_"+y+"_"+t,displayName:n.text,executeSync:function(){return c(u,n,f)},getIcon:s(n.jumpListItem,n.parent,!0,y)};i.push(h)}))),i},!0))}function ii(t,i,r,u,f,l,a,v,y,p){var d,b,ft,w,g,rt,k,it,ut,st;if(u.calculateChildSuggestions=null,d=f.jumpList,d&&d.length!=0){for(b=r||"",ft=b.indexOf("}"),b=b.substr(ft+1),w=[],g=0,rt=d;g<rt.length;g++)if(k=rt[g],!l||n.contains(l,k.type)){var et=h(k.type),ot=et!=n.GroupType.JumpListTasks,ht=function(r){var y;if(tt(r))return"continue";var p=nt(u.deviceItem.id,h(k.type))?u.getIcon:s(r,u,ot,i),l="JL",o=n.createSuggestion(t,r.displayName,p,null,l,r.displayName,n.InstrumentedItem.createInstrumentedItem(v,l),2,u.sequenceNumber,ot,null,null,!0);o.click=function(){return c(f,o,a)};o.jumpListItem=r;o.groupType=et;o.groupDisplayName=k.name;o.parent=u;o.tooltip=r.description;y=b&&r.path.endsWith(b);y||(o.path=r.path);e(o,"calculateJumpListSuggestions")&&(w.push(o),ri(f,o,a))};for(it=0,ut=k.items;it<ut.length;it++)st=ut[it],ht(st)}w.length>0&&(u.childSuggestions=u.childSuggestions?u.childSuggestions.concat(w):w,o(w),p.instrumentDataSource(v,y,w,null))}}function s(t,i,r,u){return function(f,e){return n.getIcon(t,u+"_"+t.path+"_"+t.displayName,"jumpList",!r,!1,null,null,0)(f,function(n){n?e(n):i.getIcon(f,e)})}}function tt(t){return t.displayName?!n.RuntimeConfig.AlwaysWide&&n.olderThan2Weeks(t.lastAccessed)?!0:!1:!0}function h(t){switch(t){case 0:return n.GroupType.JumpListTasks;case 1:return n.GroupType.JumpListPinned;case 2:return n.GroupType.JumpListRecent;case 3:return n.GroupType.JumpListFrequent;default:return n.GroupType.JumpListCustom}}function c(t,i,r){n.Promise.safeChain("launchJumpList",function(){return i.jumpListItem.launchAsync()},null,function(){i.jumpListItem.deleteAsync&&n.DialogBox?n.DialogBox.show(n.Host.getLocString("JumpListItemUnavailableDeleteConfirmation"),[{id:null,text:n.Host.getLocString("Cancel"),selected:!0,action:function(){return n.Host.setFocusInSearchBox(null,"jumpListItemDialogBoxCancel")}},{id:null,text:n.Host.getLocString("Remove"),selected:!1,action:function(){l(t,i,r);n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable1")}}]):(r.showTemporaryMessage(n.Host.getLocString("JumpListItemUnavailable")),l(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable2"))})}function l(t,i,r){var u=function(){return ui(i)},f;i.jumpListItem.deleteAsync?(f=i.parent.childSuggestions.length==1,n.Promise.safeChain("deleteJumpList",function(){return i.jumpListItem.deleteAsync()},function(){t.getJumpListAsync&&n.Promise.safeChain("getJumpListAsync",function(){return t.getJumpListAsync()},function(t){f&&t.some(function(n){return h(n.type)==i.groupType&&n.items.some(function(n){return!tt(n)})})?u():(n.Host.refreshCurrentPane(),r.showTemporaryMessage(n.Host.getLocString("RemovedFromList",i.text)))},u)},u)):u()}function ri(t,r,u){r.jumpListItem.deleteAsync&&i(r,function(){var i={verb:"RemoveFromThisList",displayName:n.Host.getLocString("RemoveFromThisList"),executeSync:function(){return l(t,r,u)},icon:{type:2,content:"&#xE711"}};return[i]},!0)}function ui(t){var i=_ge(t.id);n.setVisibility(i,!1);t.suppressed=!0}function fi(t,i){if(t&&t.uxHint){var r=i?HitHighlightingParser.addMarkers(t.uxHint,i):t.uxHint;return n.Host.getLocString("RelatedSynonym",r)}return null}var it={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},a={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},v={"\\msedge.exe":[0]},rt=["Microsoft.Windows.Explorer",],f=[[n.MatchType.LastModifiedBy,"lastModifiedBy"],[n.MatchType.Author,"author"],[n.MatchType.Artist,"artist"],[n.MatchType.Album,"album"],[n.MatchType.Genre,"genre"],[n.MatchType.Tags,"tags"],],y={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[n.GroupType.JumpListTasks],"Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks],"Microsoft.XboxApp_8wekyb3d8bbwe!Microsoft.XboxApp":[n.GroupType.JumpListCustom],"com.squirrel.Teams.Teams":[n.GroupType.JumpListTasks],"Microsoft.ScreenSketch_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks]},b;n.getFileExtension=ut;n.toDate=ft;n.getTodayTimeString=et;n.setFileTemplate=r;n.enrichMetadataFromDuplicate=ot;n.getIconForTypeAsync=st;n.isValidIcon=w;n.isValidSuggestion=e;n.setExtraVerbs=i;n.setExtraVerbsAsync=ht;b=function(){function t(n,t){this._instrumentationHelper=n;this._temporaryMessageHandler=t}return t.prototype.parse=function(t,i,r,u,f,e){for(var a,v,c=this,s=[],y=function(u){n.safeExecute(function(){return g(t,u,r,i,c._temporaryMessageHandler,u.suggestionType,c._instrumentationHelper,s,function(){return!0})},"parseLocalSuggestion "+r)},h=0,l=u.suggestions;h<l.length;h++)a=l[h],y(a);(n.isFileOrFolderLocalDataSource(r)||r=="IBA")&&o(s);v={maxedOut:u.maxedOut};e(r,s,v)},t}();n.SuggestionsParser=b;n.lookupById=yt;n.decorateSuggestionsWithParentFolder=o;n.parseLocalSuggestion=g}(WSB||(WSB={})),function(n){var t;(function(t){t.currentCIVersion="-1";var i=function(){function i(r,u){var f=this;(this._lightweightStorage=u,n.Host.bindShown(function(){var n=f.getContstraintIndexInfo(r.lastUrl);t.currentCIVersion=n?String(n.version):"-1"}),n.Host.hasFallbackHappened())||n.Host.bindAppHidden(function(){var l,s,e,h;if(n.isBingEnabled()&&n.isBrowserOnline()){var c=f.safeGetLastUrl(r),w=f.safeGetUrlResult(r),b=n.getWindowHost().toLowerCase(),nt=b=="bing.com"||b.endsWith(".bing.com");if(!nt&&!(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest))return;if(l=f._lightweightStorage.getItem(i.LastCIDownloadAttemptKey),s=null,l&&(s=new Date(l)),s&&(f.getTimeDiffInMins(s)<n.config.waitBetweenCIDownloadCallsInMins?n.config.waitBetweenCIDownloadCallsInMins:0))return;e=f.getContstraintIndexInfo(c);t.currentCIVersion=String(e.version);var a=n.getCurrentLanguage(),u=n.config.ciVersion,o=f.parseUrlResult(w),v=f.getUrlForCiCab(u,a),k=n.contains(n.config.blocklistedCiVersions,e.version)&&u<e.version,tt=u==o.version&&o.errorCode!="00000000";if(u>0&&n.config.supportedCiMarkets[a]&&(a!=e.language||u>e.version||k||tt)&&(!o.url||k||c==o.url||o.errorCode!="00000000")){var y="cis_v"+u,p="ci_v"+u,d=f._lightweightStorage.getItem(y)?parseInt(f._lightweightStorage.getItem(y)):0,g=f._lightweightStorage.getItem(p)?parseInt(f._lightweightStorage.getItem(p)):0;f._lightweightStorage.setItem(i.LastCIDownloadAttemptKey,n.getCurrentDate().toString());h="constraintIndexDownloader.tryDownloadFromUrlAsync";n.Promise.safeChain(h,function(){return r.tryDownloadFromUrlAsync(v)},function(n){if(n){var i=f.getContstraintIndexInfo(c);t.currentCIVersion=String(i.version);d++;f._lightweightStorage.setItem(y,d.toString())}else SharedLogHelper.LogError(h,"urlResult: "+w,"Download failed");g++;f._lightweightStorage.setItem(p,g.toString())},function(n){SharedLogHelper.LogError(h,"onError - url:  "+v,n.message)},null,v,0)}}})}return i.prototype.parseUrlResult=function(n){var r=null,t=null,u=1,i,f;return n?(i=n.split(":0x"),i.length>1?(r=i[0],t=i[1],t!="00000000"&&SharedLogHelper.LogWarning("constraintIndexDownloader.urlResult",t,"Download encountered problems"),f=this.getContstraintIndexInfo(r),u=f.version):SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","urlResult: "+n,"Invalid URL")):SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","No urlResult"),{url:r,version:u,errorCode:t}},i.prototype.getContstraintIndexInfo=function(n){var r=-1,u="",t,i;return n?(t=n.split("/"),t.length>1?(i=t[t.length-1].split("."),u=i.length==2?i[0]:"",r=+t[t.length-2]):SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","url: "+n,"Invalid URL")):SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","No Url"),{version:r,language:u}},i.prototype.safeGetLastUrl=function(t){if(!n.config.ciDownloadUpdate)return t.lastUrl;var r="https://www.bing.com/bcs/ci/-1/en-us.cab",i=r;try{return i=t.lastUrl,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}},i.prototype.safeGetUrlResult=function(t){if(!n.config.ciDownloadUpdate)return t.urlResult;var r="https://www.bing.com/bcs/ci/-1/en-us.cab:0x8000FFFF",i=r;try{return i=t.urlResult,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}},i.prototype.getUrlForCiCab=function(n,t){return"https://www.bing.com/bcs/ci/"+n+"/"+t+".cab"},i.prototype.getTimeDiffInMins=function(t){if(!n.isValidDate(t))return 0;var i=t.getTime(),r=n.getCurrentTime();return Math.round((r-i)%864e5%36e5/6e4)},i.LastCIDownloadAttemptKey="LastCIDownloadAttempt",i}();t.ConstraintIndexDataLoader=i})(t=n.ConstraintIndex||(n.ConstraintIndex={}))}(WSB||(WSB={}));__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)}}(),function(n){function h(n){switch(n.type){case"Folder":return"FD";case"Photo":return"LI";case"Video":return"LV";case"Audio":case"Music":return"MU";default:return n.fileSize?"FL":"FD"}}function c(t){switch(t){case"FD":return n.Scope.Folders;case"LI":return n.Scope.Photos;case"LV":return n.Scope.Videos;case"MU":return n.Scope.Music;default:return n.Scope.Documents}}var t="https://onedrive.live.com",i=t+"/redir.aspx?resid=",f="&ancestorId=",e="&contentMatch=",r="OneDrive provider called without {0}",o=621355968e5,s=function(t){function i(n){var i=t.call(this,"ODC")||this;return i._accessTokenManager=n,i}return __extends(i,t),i.prototype.getName=function(){return"OneDriveDataProvider"},i.prototype.addOneDriveAncestorResourceIdQueryString=function(){if(n.RuntimeConfig.QfMode==5&&!n.isFileExplorerCurrentPathThisPcOrQuickAccess){var t=void 0,i=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri?n.tryParseUrl(SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri,!1):null;if(i&&i.parameters&&(t=i.parameters.substr(1).split("&").find(function(n){return n.startsWith("id=")}).substr(3)),t)return f+t;SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootResourceId"])))}return""},i.prototype.addOneDriveContentMatchQueryString=function(t){return n.RuntimeConfig.QfMode==5||t.scope==n.Scope.Documents?e+"1":""},i.prototype.createUrl=function(t){var i=decodeURIComponent(n.config.oneDriveDotComRootUrl),r;return i+=this.addOneDriveAncestorResourceIdQueryString(),i+=this.addOneDriveContentMatchQueryString(t),r=t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"",i+"&q="+r},i.prototype.getAllAccountTokens=function(t){if(n.RuntimeConfig.QfMode==5){var i=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootAccount;i?this._accessTokenManager.getAccountByUserName(!1,0,i,!1,!0,function(n){n&&n.Token?t([n.Token]):t(null,"AccountNotFound")}):n.isFileExplorerCurrentPathThisPcOrQuickAccess?this._accessTokenManager.getAllSyncingAccounts(!1,0,!1,!0,function(n){n.length>0?t(n.map(function(n){return n.Token})):t(null,"NoAccountsFound")}):(SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootAccount"]))),t(null,"CurrentSyncRootAccount"))}else n.AccessTokenManager.getWindowsAccountType()==2?this._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,function(n){n&&n.Token?t([n.Token]):t(null,"NoAccountsFound")}):t(null)},i.prototype.fetch=function(i,r,u,f,e,o,s){var l=this,h,c;n.isDataSourceEnabled(this._dataSource,i)&&(h={numOfPendingResponses:0},s||(s={}),s["BingAPIs-Authorization-Source"]="Explicit",c=function(c){var v=Object.assign({},s),a;c&&(v["X-Search-RPSToken"]=c);a=Object.assign({},o);delete a[n.Service.QueryParams.ImpressionGuid];delete a[n.Service.QueryParams.RequestElToken];t.prototype.fetch.call(l,i,function(n,t,i,u,f){--h.numOfPendingResponses;r(n,t,i,u,f,h.numOfPendingResponses!=0)},u,f,e,a,v)},this.getAllAccountTokens(function(n,t){t?r(l._dataSource,null,t,null,null,!1):n?(h.numOfPendingResponses=n.length,n.forEach(function(n){return c(n)})):(h.numOfPendingResponses=1,c(null))}))},i}(n.JsonDataProvider),u;n.OneDriveDataProvider=s;u=function(){function r(){}return r.prototype.parse=function(t,i,r,u,f,e){var h=[],o,c,l,s,a,v;if(u&&u.suggestionGroups)for(o=0,c=u.suggestionGroups;o<c.length;o++)if(l=c[o],l.searchSuggestions)for(s=0,a=l.searchSuggestions;s<a.length;s++)v=a[s],this.addContent(t,h,v,i);n.decorateSuggestionsWithParentFolder(h);e("ODC",h,null)},r.prototype.isValidSuggestion=function(n){return!n.result||n.result.length!=1?!1:n.result[0].type==="History"?(SharedLogHelper.LogError("OneDriveParser",null,new Error("History should be disabled in the request URL")),!1):n.result[0].type==="Tag"?!1:!0},r.prototype.addContent=function(r,u,f,e){var l,a,w;if(this.isValidSuggestion(f)&&(l=f.result[0],a=h(l),n.isSuggestionTypeEnabled("ODC",a,7,r))){var v=l.rawResourceId,b="https://storage.live.com/items/"+v+":Cropped176x176#h=176&w=176",p=n.ScopeConfig[c(a)].icon,y=a=="FD"?"":n.getFileExtension(l.path),k=this.getOneDriveSuggestionIcon(n.isMedia(a),p,b,y,v),s=n.createSuggestion(r,f.displayText,k,p,a,f.query,n.InstrumentedItem.createInstrumentedItem(e,a),7,e,!0);s.url=i+v;s.path="OneDrive:\\"+l.path.slice(1).replace(/[/]/g,"\\");s.extensionLC=y?y.toLocaleLowerCase():undefined;w=+l.dateModified/1e4-o;s.lastModifiedDate=n.toDate(w);s.sourceForGroup=2;n.setFileTemplate(r,n.getEffectiveQuery(r),n.isL2(r),s);s.click=function(){return n.Host.launchUri(s.url)};s.locationUrl=l.parentFolder&&l.parentFolder.id?i+l.parentFolder.id:t;n.setExtraVerbs(s,function(){var t={verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenFileLocationInBrowser],displayName:n.Host.getLocString("OpenFileLocationIn",n.getGroupSourceDisplayName(2)),executeSync:function(){return n.Host.launchUri(s.locationUrl)},icon:{type:2,content:"&#xE838"}};return[t]},!0);n.isValidSuggestion(s,"OneDriveParser")&&u.push(s)}},r.prototype.getOneDriveSuggestionIcon=function(t,i,r,u){return n.getIconForTypeAsync(i,u)},r}();n.OneDriveParser=u}(WSB||(WSB={})),function(n){var t;(function(t){var i=function(){function t(){var t=this;n.Host.bindQueryChangedOrInitialized(function(){t._previousWebSignals=t._currentWebSignals;t._currentWebSignals=null;(!n.config.enableCISpeller||t._currentSpellerTrigger)&&(t._previousSpellerTrigger=t._currentSpellerTrigger,t._currentSpellerTrigger=null)});n.Host.bindConversationStart(function(){t._previousWebSignals=null;t._currentWebSignals=null;t._previousSpellerTrigger=null;t._currentSpellerTrigger=null;t._previousBestMatchSuggestion=null;t._previousQuery=null})}return t.prototype.setPreviousQuery=function(n){this._previousQuery=n},t.prototype.getPreviousQuery=function(){return this._previousQuery||""},t.prototype.updateWebSignalsData=function(n,t){this._currentWebSignals={query:n,signals:t}},t.prototype.setPreviousTopHit=function(n){this._previousBestMatchSuggestion=n},t.prototype.getPreviousTopHit=function(){return this._previousBestMatchSuggestion},t.prototype.updateSpellerTriggerData=function(n,t){this._currentSpellerTrigger={query:n,triggerSpeller:this.triggerSpellerOnTheNextKeyStroke(t,n)}},t.prototype.getPreviousEventWebSignalsData=function(n){return this._previousWebSignals&&this.isPreviousEventQuery(this._previousWebSignals.query,n)?this._previousWebSignals.signals:null},t.prototype.disableCISpeller=function(n){return this._previousSpellerTrigger&&this._previousSpellerTrigger.triggerSpeller&&this.isPossibleFirstMisspelling(n,this._previousSpellerTrigger.query)?!0:!1},t.prototype.enableCISpeller=function(t){return n.config.enableCISpeller?this._previousSpellerTrigger&&this._previousSpellerTrigger.triggerSpeller&&this.disableCISpeller(t)?!1:this._previousSpellerTrigger&&this.isPossibleFirstMisspelling(this._previousSpellerTrigger.query,t)?!0:this._previousSpellerTrigger&&(this.isTypedEventQuery(this._previousSpellerTrigger.query,t)||this.isBackspaceEventQuery(this._previousSpellerTrigger.query,t))&&this._previousSpellerTrigger.triggerSpeller:this._previousSpellerTrigger&&this.isPreviousEventQuery(this._previousSpellerTrigger.query,t)&&this._previousSpellerTrigger.triggerSpeller},t.prototype.triggerSpellerOnTheNextKeyStroke=function(t,i){return n.config.enableCISpeller==1?!0:t.every(function(n){return n.notAResult})?!0:t.length>0&&this.isWebSpellCorrectedSuggestion(t[0])&&t.every(function(n){return n.handoffType==0})?!0:n.config.enableCISpeller==2&&!t.some(function(t){return n.isApp(t.type)||n.isSetting(t.type)})?!0:this.enableCISpeller(i)?!0:!1},t.prototype.isWebSpellCorrectedSuggestion=function(n){return n.type=="SC"||n.type=="OS"},t.prototype.isPreviousEventQuery=function(n,t){return n&&t&&n.length==t.length-1&&t.startsWith(n)},t.prototype.isBackspaceEventQuery=function(n,t){return n&&t&&n.length==t.length+1&&n.startsWith(t)},t.prototype.isTypedEventQuery=function(n,t){return(n||n==="")&&t&&n.length<t.length&&t.startsWith(n)},t.prototype.isPossibleFirstMisspelling=function(t,i){if(this._previousBestMatchSuggestion){var r=this._previousBestMatchSuggestion.ciMatchedQuery||this._previousBestMatchSuggestion.query;return r.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())&&!r.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())&&this.isTypedEventQuery(t,i)&&i.length>=n.config.enableCISpellerAtPrefixLength?!0:!1}return this._previousBestMatchSuggestion&&this._previousBestMatchSuggestion.query.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())&&!this._previousBestMatchSuggestion.query.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())&&this.isTypedEventQuery(t,i)&&i.length>=n.config.enableCISpellerAtPrefixLength?!0:!1},t}();t.PreviousKeystrokeCache=i})(t=n.Cache||(n.Cache={}))}(WSB||(WSB={})),function(n){var t;(function(t){function c(t){e=t;var f=_ge("dialogBox");f&&(sj_be(f,"click",function(n){var r=n.target.id,t=i().filter(function(n){return n.id==r}).shift();t?(t.action&&t.action(),u()):r=="dialog_overlay"&&u();sj_sp(n)},!0),n.Host.bindKeyDown(function(n){var e,o,t,s,f,u;if(r){e=void 0;switch(n){case 39:for(t=i(),o=!1,f=0,u=void 0;u=t[f];f++)if(o){e=u;break}else if(o=u.selected==!0,o&&f+1==t.length){e=t[0];break}break;case 37:for(t=i(),s=void 0,f=0,u=void 0;u=t[f];f++){if(u.selected==!0){e=s?s:t[t.length-1];break}s=u}}e&&h(e)}}),n.Host.bindKeyEscape(function(n){o()&&(u(),n.handled=!0)}))}function l(t,i,u,o){var s,h;if(f=[],i.length==0)throw new Error("DialogBox: Empty buttons array");f=i.map(function(n,t){var i=n;return i.id="dialog_b"+t,i.narratorText=i.text,i.selected&&(s=i.id),i});h={isVisible:!0,title:u,messageText:t,buttons:f,isModal:o};e.updateDialogBox(h);s&&n.safeSetTimeout(function(){return _ge(s).focus()},0,"DialogBox.show");n.Host.setFocusInWebView("dialogBoxViewModel");r=!0}function u(){if(r)e.updateDialogBox({isVisible:!1}),r=!1}function o(){return r}function i(){return f}function a(){return i().map(function(n){return[n]})}function s(){return i().filter(function(n){return n.selected}).shift()}function h(n){for(var r,t=0,u=i();t<u.length;t++)r=u[t],r.selected=r.id==n.id,r.selected&&_ge(n.id).focus()}function v(){if(o()){var n=s();n&&(n.action&&n.action(),u())}}function y(){return!1}var f=[],e,r=!1;t.init=c;t.show=l;t.hide=u;t.isVisible=o;t.getSelectableItems=i;t.getSelectableItemsByGroup=a;t.getSelectedItem=s;t.select=h;t.submit=v;t.onAfterKeyDown=y})(t=n.DialogBox||(n.DialogBox={}))}(WSB||(WSB={})),function(n){function h(n){return n.includes("form=vsranf")}function c(t){var i=n.tryParseUrl(t,!0);return!!i&&/[\?\&]q=/i.test(i.parameters)&&!/[\?\&]view=detail/i.test(i.parameters)}function lt(t){var i=n.tryParseUrl(t,!0);return!!i&&ct.test(i.parameters)}function at(n){switch(n){case 17:case 1:case 0:return 1;case 13:return 2;case 14:return 3;default:throw Error("Unsupported handoff type: "+n);}}function l(n){switch(n){case 1:return 1;case 2:return 7;case 3:return 8;default:throw Error("Unsupported vertical: "+n);}}function a(t){var i=n.tryGetBingPathLC(t);return i?n.contains(st,i)?2:n.contains(ht,i)?3:n.contains(n.WebSearchPaths,i)?1:null:null}var o=n.PreviewPaneWidth-24,y="miniserp_focus",p="disableOutline",i=2,w=["tab-active","slide"],b=["aria-expanded"],k="videoPreview",d=300,u=30,g="IsSearchAppXYFocusEnabled",nt="WinJS",tt="dFocusExit",t="win-xyfocus-suspended",it="Rewards.ReportActivity.Success",rt="Rewards.ReportActivity.Failure",v,e;n.MiniSerpIframeId="miniIframeSerp";n.MiniSerpFetchEvent="miniSERP.Fetch";n.MiniSerpLoadedEvent="MiniSerpContentLoaded";n.MiniSerpClearingEvent="MiniSerpContentClearing";var ut=["/account/","/settings.aspx"],r=function(){var n={};return n[37]="left",n[39]="right",n[38]="up",n[40]="down",n}(),ft=1e4,s=800,et=100,ot=["&form=s00037&"],st=["/images/search","/images"],ht=["/videos/search","/videos"],ct=/[\?\&]FORM=HDRSC[1-3]/i,f="ClientInst";v=function(){function t(t,i,r){var u=this;this._navigationHelper=t;this._instrumentationHelper=i;this._msRewardsViewModel=r;this._deviceScale=1;this._previewRequestId=0;this._previousURLs=[];this.blockedMiniSERPUrls=[_w.location.origin+_w.location.pathname];n.Host.bindShown(function(){ThresholdUtilities.getCortanaHeaders(function(n){n&&n["X-BM-DeviceScale"]&&(u._deviceScale=+n["X-BM-DeviceScale"]/100)});u.setVertical(1)});n.Host.bindAppHidden(function(){u._seeAllResults&&(u._seeAllResults.innerText="");u._currentVertical=null});n.Host.bindSearchBoxGotFocus(function(){u._focusHelper&&u._focusHelper.onSearchBoxFocusChanged()});sj_evt.bind(n.MiniSerpLoadedEvent,function(){u._onIFrameLoadedCallback&&(u._onIFrameLoadedCallback(),u._onIFrameLoadedCallback=null)});this._msRewardsViewModel&&(sj_evt.bind(it,function(n){var t=n[1];u._msRewardsViewModel.notifyPointsRewarded(t)}),sj_evt.bind(rt,function(n){var t=n[1];SharedLogHelper.LogError("RewardsReportActivityFailureEvent",null,t?new Error(t):null)}))}return t.prototype.init=function(t,i){var u=this;this._previewPaneViewModelParent=t;this._root=i;this._seeAllResults=this._root.querySelector("#seeAllResults");this._footer=this._root.querySelector("#footer");this._mask=this._root.querySelector("#previewMask");this._forceLoadScreen=this._root.querySelector("#forceLoadMessage");this._contentContainer=this._root.querySelector("#miniSerpPaneContainer");this._scrollArea=this._root.querySelector("#miniSerpScollArea");this._loadingScreen=this._root.querySelector("#loadingScreen");sj_be(this._scrollArea,"scroll",function(t){u._iframe&&n.contains([2,3],u._currentVertical)&&u._iframe.contentWindow.dispatchEvent(new Event(t.type,t));u._calculateIFrameHeight&&u._calculateIFrameHeight()});this._footer&&sj_be(this._footer,"keydown",function(t){u._iframe&&n.isUpOrDownKey(t.keyCode)?(t.keyCode==38?u.tryExecuteFocusOnMiniSerp(function(){return u._focusHelper.moveFocusToEdgeFocusableElement(1)}):n.RuntimeConfig.AllowKeyboardNavCycling&&u.tryExecuteFocusOnMiniSerp(function(){return u._focusHelper.moveFocusToEdgeFocusableElement(0)}),sj_pd(t),sj_sp(t)):t.keyCode==13&&u._footer.click()});this._mask&&n.RuntimeConfig.MiniSERPMode!=0&&sj_be(this._mask,"keydown",function(n){n.keyCode==13&&u._mask.click()});sj_be(_w,"message",function(t){var f=t.data?t.data.msWinJSXYFocusControlMessage:null,i,e;f&&f.type==tt&&(i=f.direction,e=f.keyCode,u._focusHelper&&!u._focusHelper.isL2Visible()&&u._focusHelper.getXYFocusRoot()!=u._originalMiniSerpXYFocusRoot?(u._focusHelper.setXYFocusRoot(u._originalMiniSerpXYFocusRoot),u.tryExecuteFocusOnMiniSerp(function(){return u._focusHelper.moveFocus(i,e)})):(i!=r[n.getRtlAdjustedKey(39)]&&t.source.blur(),i==r[40]||i==r[38]&&n.RuntimeConfig.AllowKeyboardNavCycling?u._footer?u._footer.focus():u._focusHelper.moveFocusToEdgeFocusableElement(i==r[38]?1:0):i!=r[n.getRtlAdjustedKey(37)]||n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(e,"previewPaneUnfocus")))})},t.prototype.finalizeKeystroke=function(){this.instrumentOnPreviewPaneRendered(!1,!0)},t.prototype.getSelectableItems=function(){return[]},t.prototype.getSelectableItemsByGroup=function(){return[]},t.prototype.getSelectedItem=function(){return null},t.prototype.select=function(){},t.prototype.onAfterKeyDown=function(){return!1},t.prototype.clear=function(){this._previewedSuggestion=null;this._onPreviewPaneRendered=null;this._footer&&(n.setVisibility(this._footer,!1),this._footer.onclick=null);this._mask&&(n.setVisibility(this._mask,!1),this._mask.onclick=null);this._forceLoadScreen&&this.clearForceLoadPage();this.clearContent();this._previousURLs=[]},t.prototype.showForceLoad=function(t,i){var r=this;this._instrumentationHelper.logClientInstEvent("Select","ForceLoadOpened",n.SequenceNumberManager.getSequenceNumber(),{suggestionText:t});this.stopLoadingScreen();n.setVisibility(this._scrollArea,!1);n.setVisibility(this._footer,!1);n.setVisibility(this._mask,!1);n.setVisibility(this._forceLoadScreen,!0);this.formatForceLoadPage(t);this._forceLoadScreen.onclick=function(){r.clearForceLoadPage();r.startLoadingScreen();i()}},t.prototype.clearForceLoadPage=function(){for(n.setVisibility(this._forceLoadScreen,!1),n.setVisibility(this._scrollArea,!0),this._forceLoadScreen.onclick=null,this._forceLoadScreen.classList.remove("forceLoadContainer");this._forceLoadScreen.hasChildNodes();)this._forceLoadScreen.removeChild(this._forceLoadScreen.lastChild)},t.prototype.formatForceLoadPage=function(t){var h=n.Host.getLocString("ForceLoadMessage"),c=n.Host.getLocString("ForceLoadButton"),o=h.split("{0}"),s=sj_ce("div","","accentColor"),u,r,f,e,i;this._forceLoadScreen.appendChild(s);u=_d.createElement("span");u.id="forceLoadIcon";u.innerHTML="&#xE721";s.appendChild(u);r=sj_ce("div","forceLoadQueryText","");r.appendChild(_d.createTextNode(o[0]));f=_d.createElement("span");f.textContent=t;r.appendChild(f);r.appendChild(_d.createTextNode(o[1]));this._forceLoadScreen.appendChild(r);e=sj_ce("div","","");this._forceLoadScreen.appendChild(e);i=_d.createElement("button");i.className="c-button";i.id="forceLoadSubmit";i.type="submit";i.textContent=c;e.appendChild(i)},t.prototype.startLoadingScreen=function(){n.setVisibility(this._scrollArea,!1);n.setVisibility(this._footer,!1);n.setVisibility(this._mask,!1);n.setVisibility(this._loadingScreen,!0)},t.prototype.stopLoadingScreen=function(){n.setVisibility(this._loadingScreen,!1);n.setVisibility(this._scrollArea,!0)},t.prototype.clearContent=function(){for(this._previewRequestId+=1,this._focusHelper=null,this._onIFrameLoadedCallback=null,sj_evt.fire(n.MiniSerpClearingEvent);this._contentContainer.hasChildNodes();)this._contentContainer.removeChild(this._contentContainer.lastChild);this._iframe&&(this._iframe=null,this._calculateIFrameHeight=null);this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},t.prototype.hasFocus=function(){if(n.Host.searchBoxHasFocus())return!1;var t=n.getCurrentActiveElement();return t&&t!=this._iframe&&this._root.contains(t)},t.prototype.focus=function(){var i=this,t;this.hasFocus()||(this._iframe?(t=this.tryExecuteFocusOnMiniSerp(function(){return i._focusHelper.moveFocusToLastFocusedElement()}),t?n.Host.setFocusInWebView("miniserp focus"):n.Host.setFocusInSearchBox(null,"MiniSERP VM Focus failed")):this._previewPaneViewModelParent.focusPending=!0)},t.prototype.readyToBlur=function(){return!0},t.prototype.blur=function(){},t.prototype.setVertical=function(t){if(t!=this._currentVertical){if(this._seeAllResults)switch(t){case 1:this._seeAllResults.innerText=n.Host.getLocString("OpenResultsBrowser");break;case 2:this._seeAllResults.innerText=n.Host.getLocString("SeeAllImageResults");break;case 3:this._seeAllResults.innerText=n.Host.getLocString("SeeAllVideoResults");break;default:throw new Error("Unsupported vertical type: "+t);}this._currentVertical=t}},t.prototype.instrumentOnPreviewPaneRendered=function(n,t){if(this._timestampFirstRender&&this._onPreviewPaneRendered){var i={firstRenderTS:this._timestampFirstRender};this._onPreviewPaneRendered(t,!n,i)}},t.prototype.update=function(t,i,r,u,f,e){var o=this,h,l,a,c;if(this._onPreviewPaneErrored=e,!f){this.instrumentOnPreviewPaneRendered(!0,!1);return}if(this.instrumentOnPreviewPaneRendered(!1,!0),this.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelUpdate"),n.config.disableOfflineRequest&&!n.isBrowserOnline()){this.renderOfflineMessage(t.query);return}if(this._previewedSuggestion=t,this._onPreviewPaneRendered=f,this._timestampFirstRender=null,h=t.type=="MB"&&t.segments=="Organization"?null:t.baseSearchUrl,l=at(t.handoffType),this.setVertical(l),this._footer&&(this._footer.onclick=function(r){o._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(r),3);n.Host.launchSearch(t.query,o._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType),!1);o._previewPaneViewModelParent.onAfterItemLaunch(3)}),this._mask&&(this._mask.onclick=function(r){o._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(r),3);n.Host.launchSearch(t.query,o._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType),!1);o._previewPaneViewModelParent.onAfterItemLaunch(3)}),n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.noSerp){this.renderIframe(null,"<html><body><\/body><\/html>",{},undefined,!1);a=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(a);return}var v=r==0,y=n.RuntimeConfig.QfMode==6?undefined:v?"WMSRPA":"WMSRPM",s=this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType,y,!0,null,v);if(s+="&qfig="+this._instrumentationHelper.getImpressionGuid(n.SequenceNumberManager.getSequenceNumber()),this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&(s+="&rewards=1"),i.serpURLParams)for(c in i.serpURLParams)s=ThresholdUtilities.setUrlParameter(s,c,i.serpURLParams[c]);this._previousURLs=[];this.downloadAndDisplayMiniSerp(t,s,null,r)},t.prototype.miniSERPRenderTimeoutInstrumentation=function(t){var i;i={FunctionCalled:t};this._instrumentationHelper.logClientInstEvent(f,"MiniSERPRenderTimeout",n.SequenceNumberManager.getSequenceNumber(),i)},t.prototype.miniSerpErrorInstrumentation=function(t,i,r){var u;u=r?{ErrorCause:t,ResponseRecievedTimeStamp:i.toString(),ResponseText:r.responseText,ContentType:r.contentType,ResponseStatusCode:r.status.toString(),RequestStatusCode:r.result.toString()}:{ErrorCause:t};this._instrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber());this._instrumentationHelper.logClientInstEvent(f,"MiniSERPError",n.SequenceNumberManager.getSequenceNumber(),u)},t.prototype.renderOfflineMessage=function(t){for(var f,e=n.isBrowserOnline(),o=n.Host.getLocString("PreviewPaneOfflineTitle"),r=n.Host.getLocString("PreviewPaneOfflineMessage").split("{0}"),u=[],s=r.length-1,i=0;i<r.length;i++)i==s?u.push({text:r[i],click:function(){return n.Host.launchUri("ms-settings:troubleshoot")}}):u.push({text:r[i]});f={isOnline:e,previewPaneTitle:o,previewPaneItems:u,fullPartialQuery:t};this._onPreviewPaneErrored(f)},t.prototype.renderErrorMessage=function(t){for(var f,e=n.isBrowserOnline(),r=n.Host.getLocString("PreviewPaneErrorMessage").split("{0}"),u=[],i=0;i<r.length;i++)u.push({text:r[i]});f={isOnline:e,previewPaneTitle:"",previewPaneItems:u,fullPartialQuery:t};this._onPreviewPaneErrored(f)},t.prototype.downloadAndDisplayMiniSerp=function(t,i,r,u){var f=this,s=!1,h,c,l,a,v,e,y,p,w;(n.TestHookUrlParameters||n.MockUrlParameters)&&(s=!!n.MockUrlParameters,h=n.TestHookUrlParameters!==null&&n.TestHookUrlParameters!==void 0?n.TestHookUrlParameters:n.MockUrlParameters,c=h.previewPaneUrlOverride,i=c?decodeURIComponent(c):n.UrlParameters.copyTestParametersTo(i),s&&(i=ThresholdUtilities.setUrlParameter(i,"client","windowsMiniSerp")),l=h.miniSerpBag,l&&(i=ThresholdUtilities.setUrlParameter(i,"bag",l)),a=h.dummyref,a&&(i=ThresholdUtilities.setUrlParameter(i,"dummyref",a)));v=u==0;sj_evt.fire(n.MiniSerpFetchEvent,t,v);e=n.Host.getCustomHeaders(null);e["X-BM-DeviceDimensionsLogical"]=o+"x"+this._root.clientHeight;e["X-BM-DeviceDimensions"]=String(Math.round(o*this._deviceScale))+"x"+this._root.clientHeight;s||(e["User-Agent"]=navigator.userAgent+" RestrictedAPI");r&&(e["Content-Type"]=r.contentType);e["X-Search-SafeSearch"]="Strict";y=++this._previewRequestId;p=function(u){if(f._shouldRenderMiniSerp)sb_ct(f._ppMiniSerpRenderTimer),f._ppMiniSerpRenderTimer=null,f._shouldRenderMiniSerp=!1;else return;f.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelCallback");var o=n.getCurrentTime();f._previewPaneViewModelParent.onResponseReceived(o);u.status==200&&u.responseText?(f._previousURLs.push(i),f.renderIframe(i,u.responseText,e,s,!!r)):(f._instrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),f.miniSerpErrorInstrumentation("renderErrorMessage",o,u),f.renderErrorMessage(t.query))};this._ppMiniSerpRenderTimer&&(sb_ct(this._ppMiniSerpRenderTimer),this._ppMiniSerpRenderTimer=null);this._shouldRenderMiniSerp=!0;w=(n.config.miniSERPRequestRetries+1)*n.config.miniSERPRequestTimeout+1e3;this._ppMiniSerpRenderTimer=n.safeSetTimeout(function(){f._previewedSuggestion!=null&&f._previewedSuggestion==t&&(f._shouldRenderMiniSerp=!1,f._instrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),f.miniSERPRenderTimeoutInstrumentation("ppMiniSerpRenderTimeout"),f.stopLoadingScreen(),f.renderErrorMessage(t.query))},w,"ppMiniSerpRenderTimer");this.fetchMiniSerpUrl(i,r?r.data:null,e,p,y,r?0:n.config.miniSERPRequestRetries)},t.prototype.isDarkModeEnabled=function(){var t=n.Host.getWindowsTheme(),i=n.Host.getAppTheme();return t==2&&i==2},t.prototype.fetchMiniSerpUrl=function(t,i,r,u,e,o){var s=this,h=u;o>0&&(h=function(i){if(i.result==0&&i.responseText)u(i);else{var h={Url:t,StatusCode:i.status.toString(),Timeout:n.config.miniSERPRequestTimeout.toString(),RetriesRemaining:o.toString()};s._instrumentationHelper.logClientInstEvent(f,"MiniSERPRefetch",n.SequenceNumberManager.getSequenceNumber(),h);s.fetchMiniSerpUrl(t,null,r,u,e,o-1)}});n.config.darkMode&&this.isDarkModeEnabled()&&!t.includes("&darkschemeovr=1")&&(t+="&darkschemeovr=1");n.fetchUrl(t,r,i,h,null,function(){return e==s._previewRequestId},!0,i?undefined:n.config.miniSERPRequestTimeout)},t.prototype.renderIframe=function(t,i,r,u,f){var e=this;this.clearContent();this._iframe=sj_ce("iframe",n.MiniSerpIframeId);this._iframe.setAttribute("scrolling","no");this._contentContainer.appendChild(this._iframe);var s=this._iframe.contentWindow,o=this._iframe.contentDocument,h=!1;this._footer&&(n.setVisibility(this._footer,!f),n.setVisibility(this._mask,!f));this.setIframeHeight(0);this._onIFrameLoadedCallback=function(){var f=o.body,h=0,i;e._calculateIFrameHeight=function(){var n=f.offsetHeight;n!=h&&n>0&&(h=e.setIframeHeight(n))};e._calculateIFrameHeight();e.overrideAjaxCalls(s,r,u);e.captureNavigationsAndSizeEvents(t,f,s,o);e._scrollArea.scrollTop=0;n.config.backStackSearchEnabled&&(e._shouldAddSearchBackStack=!0,e._currentBackStackTimeout&&clearTimeout(e._currentBackStackTimeout),e._currentBackStackTimeout=sb_st(function(){e._shouldAddSearchBackStack=!1},n.config.miniSerpRedirectTimeoutInMs));n.contains([2,3],e._currentVertical)&&(i={childList:!0,subtree:!0},e._mutationObserver=new MutationObserver(function(){e._calculateIFrameHeight&&e._calculateIFrameHeight()}),n.safeExecute(function(){e._currentVertical===2?e._mutationObserver.observe(o.getElementById("images"),i):e._currentVertical===3&&e._mutationObserver.observe(o.getElementById("video"),i)},"onIFrameLoadedCallback"));e._msRewardsViewModel&&e._msRewardsViewModel.isRewardsEnabled()&&s.sj_rra&&s.sj_rra(t);e._timestampFirstRender=n.getCurrentTime();e.instrumentOnPreviewPaneRendered(!0,!1)};this._iframe.onload=function(){if(h){e.tryLaunchUrl(t,s.location.href,0);return}h=!0;e.overrideAjaxCalls(s,r,u)};o.open();o.write(i);o.write("<base href='"+t+"' target='_parent' />");o.write("<script>window.parent.sj_evt.fire('"+n.MiniSerpLoadedEvent+"')<\/script>");o.close()},t.prototype.setIframeHeight=function(n){return n<s&&(n=s),this._iframe.style.height=n+"px",n},t.prototype.overrideAjaxCalls=function(n,t,i){var r=this;n.sj_gx=function(){var n=sj_gx(),u=n.open;return n.open=function(f,e,o,s,h){if(r.blockedMiniSERPUrls.some(function(n){return e.startsWith(n)}))throw new Error("MiniSERP blocked URL request: iFrame URL: "+r._iframe.contentDocument.baseURI+" requestUrl: "+e);f=="GET"&&i&&(e=ThresholdUtilities.setUrlParameter(e,"client","windowsMiniSerp"));u(f,e,o,s,h);for(var c in t)n.setRequestHeader(c,t[c])},n}},t.prototype.captureNavigationsAndSizeEvents=function(t,i,r,u){var e=this,c;this._focusHelper=this.createFocusHelper(r,u);this._focusHelper&&(this._originalMiniSerpXYFocusRoot=this._focusHelper.getXYFocusRoot());this._previewPaneViewModelParent.focusPending&&(this._previewPaneViewModelParent.focusPending=!1,this.focus());this._iframe.contentWindow.overlay_onBeforeContentLoad=function(){e.setIframeHeight(ft)};this._iframe.contentWindow.overlay_onBeforeSuccess=function(n){e.setIframeHeight(n.clientHeight+et)};var o=function(){r.sj_lc=function(n){if(n)e.tryLaunchUrl(t,n,0);else{var i=e._previousURLs[e._previousURLs.length-2];e._previousURLs.splice(e._previousURLs.length-2,2);e.tryLaunchUrl(t,i,0)}};r.MiniSerp=!0;e._calculateIFrameHeight()},h=function(n){e._focusHelper.setXYFocusRoot(n);e._focusHelper.moveFocusToEdgeFocusableElement(0)},s=r.sj_evt;s?(c=["onP1","ajaxReady"],c.forEach(function(n){return s.bind(n,o)}),s.bind("l2_overlay_visible",function(n){o();var t=e._iframe.contentDocument.getElementById(n[1]);t&&(e._focusHelper.setIsL2Visible(!0),h(t))}),s.bind("l2_overlay_hidden",function(){o();e._focusHelper.setIsL2Visible(!1);h(e._iframe.contentDocument.body)})):o();r.open=function(n){return e.tryLaunchUrl(t,n,0),null};i.onclick=function(i){var r=i.target;if(r){if(r.id=="miniSERPToWeb"){e._instrumentationHelper.logClientInstEvent(f,"AdultExplicitLoad",n.SequenceNumberManager.getSequenceNumber(),{url:t,query:e._previewedSuggestion.query});e._footer.click();return}while(r&&!r.href)r=r.parentNode}r&&e.tryLaunchUrl(t,r.href,n.getInputType(i))==0&&i.preventDefault()}},t.prototype.navigateInPlace=function(t,i,r,u){var s=this,f=l(u),e,o;this._previewPaneViewModelParent.onBeforeItemLaunch(i,r,f);this._footer&&(this._footer.onclick=function(){return n.Host.launchSearch(null,s.enrichBingSearchUrlParameters(t),!1)});this.clearContent();this._previewPaneViewModelParent.focusPending=!0;this.startLoadingScreen();e=this.enrichBingSearchUrlParameters(t,!0);this.setVertical(u);o={destinationVertical:u.toString(),url:t};this._instrumentationHelper.logClientInstEvent("Select","NavigateInPlace",n.SequenceNumberManager.getSequenceNumber(),o);this.downloadAndDisplayMiniSerp(this._previewedSuggestion,e,null,1);this._previewPaneViewModelParent.onAfterItemLaunch(f)},t.prototype.tryLaunchUrl=function(t,i,r){var o,u,s,f,v,e;if(!i)return 1;if(o=n.getCurrentTime(),i=i.trim(),u=i.toLowerCase(),s=a(i),s!==null&&c(i)&&!h(u)&&lt(i)&&s!==this._currentVertical)return this.navigateInPlace(i,o,r,s),0;if(u.startsWith("javascript:location.reload"))return 0;if(i==t+"#"||u.startsWith("javascript:"))return 1;if(u=="/loading")return 0;if(i.startsWith(window.location.href))return SharedLogHelper.LogError("previewPane.tryLaunchUrl",t,new Error("Anchor navigation on PreviewPane")),0;if(i.startsWith("/")&&(i=n.getWindowProtocol()+"//"+n.getWindowHost()+i),f=a(i),f){if(f==this._currentVertical&&c(i)&&ot.some(function(n){return u.includes(n)}))return this.navigateInPlace(i,o,r,f),0;i=this.enrichBingSearchUrlParameters(i)}v=f?l(f):2;this._previewPaneViewModelParent.onBeforeItemLaunch(o,r,v);if(e=n.tryGetBingPathLC(i),e)if(ut.some(function(n){return e.startsWith(n)})||h(u))n.Host.launchUri(n.config.settingsUri);else if(e.startsWith("/profile/interests"))n.Host.launchCat1(null,"ms-cortana://navigate/Notebook",null);else if(e.startsWith("/fd/auth/")){var y=SearchAppWrapper.CortanaApp,p=y.isCortanaEnabled?n.safeExecute(function(){return y.getCortanaCapabilities()},"getCortanaCapabilities","").split(","):[],w=n.contains(p,"Personalization");w?SharedLogHelper.LogError("previewPane.tryLaunchUrl",t,new Error("Redirecting to sign in page when already signed in")):n.Host.launchUri("ms-cortana://CapabilitiesPrompt/?RequestedCapabilities=Personalization")}else n.config.backStackAdsEnabled&&this._shouldAddSearchBackStack&&i.indexOf("aclk?ld=")>-1&&(sb_ct(this._currentBackStackTimeout),i=this.buildAdsRedirectUrl(this._previewedSuggestion.query,i)),n.Host.launchUri(i);else this._shouldAddSearchBackStack&&!u.startsWith("ms-settings")&&(sb_ct(this._currentBackStackTimeout),i=this.buildRedirectUrl(this._previewedSuggestion.query,i)),n.Host.launchUri(i);this._previewPaneViewModelParent.onAfterItemLaunch(v);return 0},t.prototype.enrichBingSearchUrlParameters=function(n,t){return t===void 0&&(t=!1),n=this._navigationHelper.enrichUrlWithMarketInfo(n),n=this._navigationHelper.enrichUrlWithDeviceInfo(n),n=this._navigationHelper.enrichUrlWithCvid(n),n=this._navigationHelper.enrichUrlWithSuggestionType(n,this._previewedSuggestion.type),t||(n=this._navigationHelper.enrichUrlWithMuidInfo(n),n=this._navigationHelper.enrichUrlWithSafeSearchInfo(n)),n},t.prototype.createFocusHelper=function(n,t){var i=this.getSearchAppWinJSXYFocus(n);return!i&&SearchAppWinJS&&SearchAppWinJS.initXYFocus&&(SearchAppWinJS.initXYFocus(n),i=this.getSearchAppWinJSXYFocus(n),n[g]=i?!0:!1),i?new e(t,n,i,this._scrollArea,this._currentVertical):null},t.prototype.getSearchAppWinJSXYFocus=function(n){var i,t=n[nt];return t&&t.UI&&(i=t.UI.XYFocus),i},t.prototype.tryExecuteFocusOnMiniSerp=function(n){var t=!1;return this._focusHelper&&(t=n()),t||this._footer&&(this._footer.focus(),t=!0),t},t.prototype.buildAdsRedirectUrl=function(t,i){var r=new URL(i);return!r||!r.search||r.search.length<1?i:_w.location.protocol+"//"+_w.location.host+"/WS/redirect/?q="+n.encodeQueryParameter(t)+"&form=WSBBST&cvid="+n.encodeQueryParameter(n.Host.getConversationId())+"&rtk="+this._iframe.contentWindow.rtk+"&"+r.search.substring(1)},t.prototype.buildRedirectUrl=function(t,i){return _w.location.protocol+"//"+_w.location.host+"/WS/redirect/?q="+n.encodeQueryParameter(t)+"&url="+btoa(i)+"&form=WSBBST&cvid="+n.encodeQueryParameter(n.Host.getConversationId())+"&rtk="+this._iframe.contentWindow.rtk},t}();n.MiniSerpViewModel=v;e=function(){function f(t,i,r,u,f,e){var o=this,s;this._targetDocument=t;this._targetWindow=i;this._searchAppXYFocus=r;this._scrollArea=u;this._verticalType=f;this._useStickyFocusOverride=e;this._isL2Visible=!1;this._useStickyFocus=!1;(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.stickyFocus)===!0&&(this._useStickyFocus=!0);this._useStickyFocusOverride!=null&&(this._useStickyFocus=this._useStickyFocusOverride);var h="b_hide",c="acc-inactive",l=".b_slidebar";this._focusDiv=sj_ce("div",y,h);t.body.appendChild(this._focusDiv);sj_be(t,"blur",function(t){o._useStickyFocus?(!t.srcElement.offsetParent||t.srcElement.classList.contains("b_hide")||t.relatedTarget)&&n.setVisibility(o._focusDiv,!1):n.setVisibility(o._focusDiv,!1)},!0);s=!0;sj_be(t,"click",function(){return s=!1},!0);sj_be(t,"keydown",function(){return s=!0},!0);sj_be(t,"focus",function(){return o.updateFocusedElementAndOutline(o._targetDocument.activeElement,s)},!0);sj_be(t,"scroll",function(n){o._lastElementFocused&&(n.srcElement==o._lastElementFocused||o._lastElementFocused.compareDocumentPosition(n.srcElement)&Node.DOCUMENT_POSITION_CONTAINS)&&o.updateFocusedElementAndOutline(o._lastElementFocused,s)},!0);sj_be(t,"transitionend",function(n){var t=o._targetDocument.activeElement;(n.propertyName=="height"||n.srcElement==t.closest(l))&&(o._focusOutlineTimeout?(o.clearFocusOutlineTimeout(),o.outlineElementAndScrollIntoView(t)):o._focusDiv.classList.contains(h)||o.outlineElementAndScrollIntoView(t),n.srcElement.style.height=="0px"?n.srcElement.classList.add(c):n.srcElement.classList.remove(c))});this._searchAppXYFocus.keyCodeMap.home.push(36);this._searchAppXYFocus.keyCodeMap.end.push(35)}return f.prototype.getXYFocusRoot=function(){return this._searchAppXYFocus.focusRoot},f.prototype.isL2Visible=function(){return this._isL2Visible},f.prototype.setIsL2Visible=function(n){this._isL2Visible=n},f.prototype.setXYFocusRoot=function(n){this._searchAppXYFocus.focusRoot=n},f.prototype.moveFocus=function(n,t){return this._searchAppXYFocus._xyFocus(n,t)},f.prototype.moveFocusToEdgeFocusableElement=function(n,t){var i,h;if(t===void 0&&(t=!1),this._targetWindow.focus(),t&&n==0)i=this.focusFirstSerpElement();else{var f=void 0,e=void 0,u=void 0,o=this._targetWindow.innerWidth,s=this._targetWindow.innerHeight;n==0?(f=-1,e=0,u=40):n==1&&(f=s,e=s+1,u=38);h={top:f,bottom:e,right:o,left:0,height:1,width:o};i=this._searchAppXYFocus._xyFocus(r[u],u,h)}return i&&(this.scrollTo(n),this.updateFocusedElementAndOutline(this._targetDocument.activeElement)),i},f.prototype.onSearchBoxFocusChanged=function(){this._targetDocument.hasFocus()?this.updateFocusedElementAndOutline(this._targetDocument.activeElement):this._useStickyFocus||n.setVisibility(this._focusDiv,!1)},f.prototype.isVisible=function(n){var t=_w.getComputedStyle(n);return!(t.visibility=="hidden"||t.display=="none"||n.offsetWidth===0&&n.offsetHeight===0)},f.prototype.moveFocusToLastFocusedElement=function(){return this._lastElementFocused&&this.isVisible(this._lastElementFocused)?(this._lastElementFocused.focus(),this.updateFocusedElementAndOutline(this._lastElementFocused),!0):this.moveFocusToEdgeFocusableElement(0,!0)},f.prototype.updateFocusedElementAndOutline=function(t,i){var r=this,u;(i===void 0&&(i=!0),t&&t!=this._targetDocument.body)&&(this.processFocusedElement(t),i)&&(u=this._lastElementFocused&&t.elementType&&t.elementType==this._lastElementFocused.elementType&&t.parentElement==this._lastElementFocused.parentElement?d:0,u?(n.setVisibility(this._focusDiv,!1),this._focusOutlineTimeout=n.safeSetTimeout(function(){r._targetDocument.activeElement==t&&r.outlineElementAndScrollIntoView(t);r.clearFocusOutlineTimeout()},u,"updateFocusedElementAndOutline")):this.outlineElementAndScrollIntoView(t),this._lastElementFocused=t)},f.prototype.outlineElementAndScrollIntoView=function(t){var f,o,s;if(t!=this._targetDocument.body&&(this._useStickyFocus||this._targetDocument.hasFocus())){var r=t.getBoundingClientRect(),y=this._targetDocument.documentElement.scrollWidth-i*2,p=this._targetDocument.documentElement.scrollHeight-i*2,h=r.top+this._targetWindow.pageYOffset,e=r.left+this._targetWindow.pageXOffset,w=y-e,b=p-h,c=e<0?Math.floor(r.width+e-i):r.width;if(c<=0){n.setVisibility(this._focusDiv,!1);return}if(f=r.height,f<=0&&t.children.length>0)for(o=0;o<t.children.length;o++)s=t.children[o].getBoundingClientRect(),s.height>f&&(f=s.height,h=s.top);this._focusDiv.style.top=Math.max(i,h)+"px";this._focusDiv.style.left=Math.max(this.isL2Visible?i:i*4,e)+"px";this._focusDiv.style.width=Math.min(w,c)+"px";this._focusDiv.style.height=Math.min(b,f)+"px";n.setVisibility(this._focusDiv,!0);var l=t.getBoundingClientRect(),a=this._scrollArea.offsetHeight+this._scrollArea.scrollTop-l.bottom-u,v=l.top-this._scrollArea.scrollTop-u;a<0?this._scrollArea.scrollTop+=u-a:v<0&&(this._scrollArea.scrollTop+=v-u)}},f.prototype.scrollTo=function(n){var t=0;n==1&&(t=this._scrollArea.scrollHeight);this._scrollArea.scrollTop=t},f.prototype.processFocusedElement=function(i){var r=this,u,e,o,c,f,s,h;i.isProcessed||(u=i.tagName.toLocaleLowerCase(),e=i.getAttribute("type"),u=="select"&&(sj_be(i,"keydown",function(n){n.keyCode==32?i.classList.add(t):n.keyCode==13&&i.classList.remove(t)},!0),this.reactivateXYFocusOnBlur(i)),u=="input"&&e=="range"&&(sj_be(i,"keydown",function(n){var r=n.target,f=+r.getAttribute("min"),e=+r.getAttribute("step"),u=n.keyCode==37,o=n.keyCode==39,s=+r.value-e<f&&u;n.keyCode==38||n.keyCode==40||s?i.classList.remove(t):(u||o)&&i.classList.add(t)},!0),this.reactivateXYFocusOnBlur(i)),o=function(n,r){var u;if(!r.readOnly){if(u=r.selectionStart!=r.selectionEnd,u){i.classList.add(t);return}var f=r.selectionEnd==0,e=r.selectionEnd==r.value.length,o=n.keyCode==36&&!f,s=n.keyCode==35&&!e,h=n.keyCode==37&&!f,c=n.keyCode==39&&!e;h||c||o||s?i.classList.add(t):i.classList.remove(t)}},u=="textarea"&&(sj_be(i,"keydown",function(n){return o(n,n.target)},!0),this.reactivateXYFocusOnBlur(i)),u=="input"&&(e=="number"||e=="text")&&(sj_be(i,"keydown",function(n){return o(n,n.target)},!0),this.reactivateXYFocusOnBlur(i)),w.some(function(n){return i.classList.contains(n)})?(i.elementType="slide",c=Array.prototype.slice.call(i.querySelectorAll("a:not([onclick='TestHooks.HideShowTestHooks(this);']):not([disabled])"),0),f=c.filter(function(n){return r.isVisible(n)&&n.offsetHeight>0&&n.offsetWidth>0}),f&&sj_be(i,"keydown",function(n){var t=r.countUniqueHrefs(f),u=n.keyCode;n.srcElement==i&&(t>1&&u==40?(n.preventDefault(),r._searchAppXYFocus.focusRoot=i,f[0].focus()):t==1&&u==13&&f[0].click())})):b.some(function(n){return i.hasAttribute(n)})?(i.elementType="expansion",s=function(t){t===void 0&&(t=!0);n.setVisibility(r._focusDiv,!1);r.updateFocusedElementAndOutline(r._targetDocument.activeElement,t)},sj_be(i,"keyup",function(n){n.keyCode==13&&s()},!0),sj_be(i,"click",function(){s(!1)})):i.classList.contains(k)&&(h=function(){var n=r._targetDocument.getElementById("vidPreStopButton"),t,u;n&&n.focus();t=function(){i.focus()};sj_be(n,"click",t);sj_be(n,"keydown",function(n){n=sj_ev(n);n.keyCode===13&&t()});u=r._targetDocument.getElementsByTagName("video")[0];sj_be(u,"ended",t)},sj_be(i,"keydown",function(n){n.keyCode==13&&h()},!0),sj_be(i,"click",function(){h()})),i.classList.add(p),i.isProcessed=!0)},f.prototype.countUniqueHrefs=function(n){var r={},t,i;if(n)for(t=0;t<n.length;t++)i=n[t],i&&(r[i.href]=!0);return Object.keys(r).length},f.prototype.reactivateXYFocusOnBlur=function(n){sj_be(n,"blur",function(){n.classList.remove(t)})},f.prototype.focusFirstSerpElement=function(){var n,i,t,r;switch(this._verticalType){case 1:n=this._targetDocument.getElementById("b_content");break;case 2:n=this._targetDocument.getElementById("images");break;case 3:n=this._targetDocument.getElementById("video");break;default:throw Error("Unknown vertical type "+this._verticalType);}if(n)for(i=n.querySelectorAll('a:not([onclick=\'TestHooks.HideShowTestHooks(this);\']):not([disabled]):not([tabindex="-1"]), button:not([disabled]), input[type=text]:not([disabled]), input[type=submit]:not([disabled]), textarea:not([disabled]), select:not([disabled]):not(#tta_sl):not(#tta_srcsl), [tabindex]:not([disabled]):not([tabindex="-1"]):not(#tta_playiconsrc)'),t=0;t<i.length;t++)if(r=i[t],this.isVisible(r))return r.focus(),!0;return!1},f.prototype.clearFocusOutlineTimeout=function(){sb_ct(this._focusOutlineTimeout);this._focusOutlineTimeout=null},f}();n.WSBMiniSerpFocusHelper=e}(WSB||(WSB={})),function(n){function i(n,t){switch(n){case"arrowRight":case"button":case"submit":return 1;case"autoContent":case"keepOpen":case"alwaysWide":case"refresh":return t&&t.inorganic?3:0;case"arrowUpOrDown":return 0;default:throw new Error("Unknown open type: "+n);}}var t="noScroll",r=function(){function r(t,i,r,u,f){var e=this;this._page=t;this._instrumentationHelper=i;this._previewPaneId=0;this._beforeItemLaunchEventHandlers=[];this._afterItemLaunchEventHandlers=[];var c=function(n,t,i,r,u){e._clickLoggedForCurrentPreviewPane||e._beforeItemLaunchEventHandlers.forEach(function(f){return f(n,e._previewedSuggestion,t,i,r,u)})},l=function(n){e._clickLoggedForCurrentPreviewPane||(e._afterItemLaunchEventHandlers.forEach(function(t){return t(e._previewedSuggestion,e._queryForPreviewedSuggestion,n)}),e._clickLoggedForCurrentPreviewPane=!0)},a=function(t){e._previewPaneResponseReceivedTimeStamp=t;(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.isLoading)||!e.isPreviewPaneWithLoaderViewModel(e._activePreviewPaneViewModel)||e._activePreviewPaneViewModel.stopLoadingScreen()};this._previewPaneViewModelParent={focusPending:!1,onBeforeItemLaunch:c,onAfterItemLaunch:l,onResponseReceived:a};var o=_ge("localPane"),s=_ge("miniSerpPane"),h=_ge("msbPane");r.init(this._previewPaneViewModelParent,s);u&&u.init(this._previewPaneViewModelParent,o);f&&f.init(this._previewPaneViewModelParent,h);SearchAppWrapper.CortanaApp.addEventListener("resettingtodefaultsize",function(){return e.dismiss()});n.Host.bindKeyDown(function(){e._previewPaneViewModelParent.focusPending=!1});n.Host.bindSearchBoxGotFocus(function(){return e._previewPaneViewModelParent.focusPending=!1});n.Host.bindQueryChangedOrInitialized(function(n){return e._currentQuery=n},!0);n.Host.bindAccountChanged(function(){e._miniSerpMustRefresh=!0});i.bindFinalizeKeystroke(function(n){e._activePreviewPaneViewModel&&n&&e._activePreviewPaneViewModel.finalizeKeystroke()});this._previewPaneInfos=[];this._previewPaneInfos[0]={paneElement:_ge("errorPane"),viewModel:null};this._previewPaneInfos[1]={paneElement:s,viewModel:r,disableRootScroll:!0};this._previewPaneInfos[2]={paneElement:o,viewModel:u};this._previewPaneInfos[3]={paneElement:h,viewModel:f};this._previewPaneScrollElement=_ge("qfPreviewScrollArea")}return r.prototype.init=function(n){this._selectionHandler=n},r.prototype.getSelectableItems=function(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectableItems():[]},r.prototype.getSelectableItemsByGroup=function(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectableItemsByGroup():[]},r.prototype.getSelectedItem=function(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectedItem():null},r.prototype.select=function(n,t){this._activePreviewPaneViewModel&&this._activePreviewPaneViewModel.select(n,t)},r.prototype.onAfterKeyDown=function(n,t,i,r){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.onAfterKeyDown(n,t,i,r):!1},r.prototype.getPreviewedSuggestion=function(){return this._previewedSuggestion},r.prototype.getPreviewedSuggestionToForceTopHit=function(){return this._forceTopHitForPreviewedSuggestion&&!this._closeTimer?this._previewedSuggestion:null},r.prototype.getOnPreviewPaneRendered=function(t,r,u,f){var o=this,h=++this._previewPaneId,s=!0,c=n.getCurrentTime(),e;if(this._instrumentedOpenThisImpression=!1,e="None",t)switch(t.previewPaneType){case 2:e="Local";break;case 3:e="Msb";break;case 1:e="Web"}return n!==undefined&&n.config.perfLogging&&n.WSBPerformance&&n.WSBPerformance.getInstance().beginMark("RenderPreviewPane - "+e),function(l,a,v){var y,p;if(l||!a){if(a||(s=!1),!o._instrumentedOpenThisImpression){if(y={ppId:""+h,openType:r,suggestion:t?t.instItem.getLayoutKValue():undefined,suggestionType:t?t.type:undefined,startOpening:""+c,openDelay:u?""+u:undefined},v)for(p in v)y[p]=v[p];y.waitingForMore=s?"true":undefined;o._instrumentationHelper.previewPaneOpenedOrClosed(!0,n.SequenceNumberManager.getSequenceNumber(),t?t.instItem:undefined,t?t.previewPaneType:undefined,i(r,f)==0,y)}o._instrumentedOpenThisImpression=!0;l&&(o._instrumentedOpenThisImpression=!1,r="keepOpen");!s&&n!==undefined&&n.config.perfLogging&&n.WSBPerformance&&n.WSBPerformance.getInstance().endMark("RenderPreviewPane - "+e)}}},r.prototype.onPreviewPaneErrored=function(i){for(var f,r=0,u=this._previewPaneInfos;r<u.length;r++)f=u[r],n.setVisibility(f.paneElement,!1);this._previewPaneScrollElement.classList.remove(t);this._page.updatePreviewErrorMessageView(i);n.setVisibility(this._previewPaneInfos[0].paneElement,!0)},r.prototype.showPreview=function(t,r,u,f,e,o){var h=this,s;u===void 0&&(u="button");f===void 0&&(f=!1);e===void 0&&(e=0);o===void 0&&(o=!1);this._previewPaneOpenedForThisQuery=!0;this.clearSuggOpeningState(this._pendingPreviewedSuggestion);this.clearOpenTimer();this.clearCloseTimer();(r!=this._previewedSuggestion||f)&&(n.RuntimeConfig.AlwaysWide||this._page.setPreviewPaneVisibility(!0),s=this.getOnPreviewPaneRendered(r,u,e,t),o?this._instrumentationHelper.notifyPreviewPanePending(n.SequenceNumberManager.getSequenceNumber(),r.previewPaneType,r.type):this._instrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),this.setPreviewPaneContent(t,r,i(u,t),this._previewPaneId,s,function(n){return h.onPreviewPaneErrored(n)}));u!="button"&&this._selectionHandler.updateSelectionState(r)},r.prototype.showPreviewAndFocus=function(n,t,i){i===void 0&&(i="submit");(this._closeTimer||this._previewedSuggestion!=t)&&this.showPreview(n,t,i);this._activePreviewPaneViewModel.focus(!1);this._forceTopHitForPreviewedSuggestion=!0},r.prototype.focus=function(n){return this._activePreviewPaneViewModel?(this._activePreviewPaneViewModel.focus(n),!0):!1},r.prototype.blur=function(){this._activePreviewPaneViewModel&&this._activePreviewPaneViewModel.blur()},r.prototype.dismiss=function(){this.close(!0)},r.prototype.close=function(t){var r=this,i;this.clearOpenTimer();i=t?0:n.config.closePreviewPaneDelay;i?this._closeTimer||(this._closeTimer=n.safeSetTimeout(function(){r._closeTimer=null;r.innerClose(t)},i,"ppCloseTimer")):(this.clearCloseTimer(),this.innerClose(t))},r.prototype.innerClose=function(t){var i,r;this._previewedSuggestion&&(i=!0,t&&(this._clickLoggedForCurrentPreviewPane?i=!1:this._previewPaneResponseReceivedTimeStamp&&n.getCurrentTime()>this._previewPaneResponseReceivedTimeStamp+1e3&&(i=!1)),i&&(r=t?{fromQFDismiss:"1"}:undefined,this._instrumentationHelper.previewPaneOpenedOrClosed(!1,n.SequenceNumberManager.getSequenceNumber(),this._previewedSuggestion.instItem,this._previewedSuggestion.previewPaneType,undefined,r)),n.RuntimeConfig.AlwaysWide||t||this._page.setPreviewPaneVisibility(!1),this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen(),this.clear())},r.prototype.clear=function(){for(var t=0;t<this._previewPaneInfos.length;++t)n.setVisibility(this._previewPaneInfos[t].paneElement,!1);this._previewedSuggestion&&(this._previewedSuggestion.hasPreviewPaneOpened=!1,this._selectionHandler.updateSelectionState(this._previewedSuggestion),this._previewedSuggestion=null);this._forceTopHitForPreviewedSuggestion=!1;this._clickLoggedForCurrentPreviewPane=!1;this._previewPaneViewModelParent.focusPending=!1;this._activePreviewPaneViewModel&&(this._activePreviewPaneViewModel.clear(),this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen());this._queryForPreviewedSuggestion=null;this._previewPaneResponseReceivedTimeStamp=null;this._activePreviewPaneViewModel=null},r.prototype.onQueryChanged=function(t){var i,r;if((this._previewPaneOpenedForThisQuery=!1,i=this._queryForPendingPreviewedSuggestion||this._queryForPreviewedSuggestion,this._queryIsContinuationOfPreviousQuery=i&&t.queryToFetch.toLocaleLowerCase().startsWith(i.queryToFetch.toLocaleLowerCase()),i&&t.queryToFetch.toLocaleLowerCase()!=i.queryToFetch.toLocaleLowerCase())&&(r=this._pendingPreviewedSuggestion&&this._pendingPreviewedSuggestion.updateFromQuery?this._pendingPreviewedSuggestion:this._previewedSuggestion&&!this._closeTimer&&this._previewedSuggestion.updateFromQuery?this._previewedSuggestion:null,r)){if(n.RuntimeConfig.AlwaysWide){this.autoOpen(t,r,"alwaysWide",!0,!0);return}this._queryIsContinuationOfPreviousQuery?(this._forceTopHitForPreviewedSuggestion=!1,this.autoOpen(t,r,"keepOpen",!0,!0)):this.close(!1)}},r.prototype.clearSuggOpeningState=function(n){n&&(n.isPreviewPaneOpening=!1,this._selectionHandler.updateSelectionState(n))},r.prototype.clearOpenTimer=function(){this._openTimer&&(sb_ct(this._openTimer),this._openTimer=null,this._pendingPreviewedSuggestion=null,this._queryForPendingPreviewedSuggestion=null,this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen())},r.prototype.clearCloseTimer=function(){this._closeTimer&&(sb_ct(this._closeTimer),this._closeTimer=null)},r.prototype.onTopHitUpdated=function(t,i,r,u){if(r){if(!this._closeTimer&&(this._openTimer&&this._pendingPreviewedSuggestion!=r&&this.clearOpenTimer(),!this._miniSerpMustRefresh||r.previewPaneType!=1)){if(this._pendingPreviewedSuggestion&&n.isEquivalentForPreviewPanePurposes(t,this._pendingPreviewedSuggestion,r)){this._pendingPreviewedSuggestion=r;this._queryForPendingPreviewedSuggestion=t;r.hasPreviewPaneOpened=!0;this._selectionHandler.updateSelectionState(r);return}if(this._previewedSuggestion&&n.isEquivalentForPreviewPanePurposes(t,this._previewedSuggestion,r)){(!n.contains(u,i)||r.previewPaneNeedsRefreshAfterDeduping)&&(this._previewedSuggestion=r,this._queryForPreviewedSuggestion=t,r.hasPreviewPaneOpened=!0,this._selectionHandler.updateSelectionState(r),this.refreshLocalContent(t,r,n.SequenceNumberManager.getSequenceNumber()));return}}if(this._miniSerpMustRefresh=!1,this._forceTopHitForPreviewedSuggestion=!1,r.previewPaneType){if(n.RuntimeConfig.AlwaysWide){this.autoOpen(t,r,"alwaysWide",!1,!0);return}if(r==u[0]&&!this._previewPaneOpenedForThisQuery){if(r.autoOpenPreviewPaneWhenOnTopHit){this.autoOpen(t,r,"autoContent",!1,!0);return}if(this._previewedSuggestion&&this._queryIsContinuationOfPreviousQuery){this.autoOpen(t,r,"keepOpen",!1,!0);return}}}}this._openTimer&&(this.clearSuggOpeningState(this._pendingPreviewedSuggestion),this.clearOpenTimer());this._previewedSuggestion&&this.close(!1)},r.prototype.getDelayForMiniSerp=function(t,i,r){var u=n.getTweakedSetting("preventAutomaticMiniSerp");switch(t){case"keepOpen":case"alwaysWide":return r&&r.inorganic?0:u?Number.MAX_VALUE:n.config.probabilityNextKeyStrokeEnabled&&i.featureStore&&i.featureStore[264]!==undefined?this.calculateDelayForProbabilitySignal(i.featureStore[264]):n.RuntimeConfig.AlwaysWide?i.isAnswer?0:n.getTenantMsbStatus&&n.getTenantMsbStatus()===n.TenantMsbStatus.Enabled?n.config.msbMiniSerpDelay:n.config.autoOpenMiniSerpDelay:n.config.keepMiniSerpOpenDelay;case"arrowUpOrDown":return u?Number.MAX_VALUE:n.config.openOnKeybNavMiniSerpDelay}return 0},r.prototype.calculateDelayForProbabilitySignal=function(t){for(var i=n.config.probabilityNextKeyStrokeThresholds.length-1;i>=0;i--)if(t>=n.config.probabilityNextKeyStrokeThresholds[i])return n.config.probabilityNextKeyStrokeDelays[i];return 0},r.prototype.shouldOpenMiniSerp=function(t){return SearchAppWrapper.CortanaApp.hostingEnvironment==4?!0:n.RuntimeConfig.MiniSERPMode==0||t.previewPaneType!=1?!1:t.isAnswer?(n.RuntimeConfig.MiniSERPMode&1)!=0:t.type=="MD"?(n.RuntimeConfig.MiniSERPMode&2)!=0:(n.RuntimeConfig.MiniSERPMode&4)!=4?!1:t.query.length>=n.config.minPrefixLengthForMiniSerp},r.prototype.autoOpen=function(t,i,r,u,f){var e=this,s,h,o;this._instrumentationHelper.notifyPreviewPaneStartRender(n.SequenceNumberManager.getSequenceNumber());f&&this._instrumentationHelper.notifyPreviewPanePending(n.SequenceNumberManager.getSequenceNumber(),i.previewPaneType,i.type);h=n.config.disableOfflineRequest?n.isBrowserOnline()&&this.shouldOpenMiniSerp(i):this.shouldOpenMiniSerp(i);o=h?this.getDelayForMiniSerp(r,i,t):0;o?((i===null||i===void 0?void 0:i.previewPaneType)!=((s=this._previewedSuggestion)===null||s===void 0?void 0:s.previewPaneType)&&this.clear(),r=="arrowUpOrDown"&&(this.clear(),this.clearSuggOpeningState(this._pendingPreviewedSuggestion),this.clearSuggOpeningState(this._previewedSuggestion)),i.isPreviewPaneOpening=!0,this._selectionHandler.updateSelectionState(i),this.clearOpenTimer(),this.clearCloseTimer(),this._pendingPreviewedSuggestion=i,this._queryForPendingPreviewedSuggestion=t,this.setActivePreviewPaneContainer(i),this._openTimer=o==Number.MAX_VALUE?Number.MAX_VALUE:n.safeSetTimeout(function(){e._openTimer=null;i=e._pendingPreviewedSuggestion;e._pendingPreviewedSuggestion=null;e._queryForPendingPreviewedSuggestion=null;e.showPreview(t,i,r,u,o,f)},o,"ppOpenTimer"),this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.startLoadingScreen()):this.showPreview(t,i,r,u,null,f)},r.prototype.onAfterKeyDownWhenNewSelection=function(t,i,r){var f=n.RuntimeConfig.AlwaysWide&&n.config.openOnKeybNavMiniSerp,u;if(n.isGroup(r)){f&&(this.clearSuggOpeningState(this._pendingPreviewedSuggestion),this.clearSuggOpeningState(this._previewedSuggestion),this._instrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),this.clear(),this.clearOpenTimer(),this.clearCloseTimer(),this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen());return}u=r;u.previewPaneType?f&&(t==40||t==38)?this._previewedSuggestion!=u&&this.autoOpen(i,u,"arrowUpOrDown",!1,!1):t==n.getRtlAdjustedKey(39)&&this._currentQuery.originalCursorPosition==this._currentQuery.originalQuery.length&&n.Host.searchBoxHasFocus()?this.showPreviewAndFocus(i,u,"arrowRight"):t==n.getRtlAdjustedKey(37)&&this._activePreviewPaneViewModel&&this._activePreviewPaneViewModel.hasFocus()&&this._activePreviewPaneViewModel.readyToBlur()&&n.Host.setFocusInSearchBox(t,"previewPaneUnfocus"):this.clear()},r.prototype.refreshLocalContent=function(n,t,i){var f=this,r=null,u;this._instrumentedOpenThisImpression&&(r=this.getOnPreviewPaneRendered(t,"refresh",0,n));u=function(n){return f.onPreviewPaneErrored(n)};this._instrumentationHelper.notifyPreviewPanePending(i,t.previewPaneType,t.type);this._activePreviewPaneViewModel.update(t,n,0,this._previewPaneId,r,u,!0)},r.prototype.setActivePreviewPaneContainer=function(i){var r=i.previewPaneType;i.previewPaneType!=2&&(this.shouldOpenMiniSerp(i)||i.previewPaneType!=1)||(r=2);n.setVisibility(this._previewPaneInfos[r].paneElement,!0);this._activePreviewPaneViewModel=this._previewPaneInfos[r].viewModel;this._previewPaneInfos[r].disableRootScroll?this._previewPaneScrollElement.classList.add(t):this._previewPaneScrollElement.classList.remove(t);this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.startLoadingScreen()},r.prototype.setPreviewPaneContent=function(n,t,i,r,u,f){this.clear();this._previewedSuggestion=t;this._previewedSuggestion&&(this._previewedSuggestion.hasPreviewPaneOpened=!0,this._previewedSuggestion.isPreviewPaneOpening=!1);this._previewPaneResponseReceivedTimeStamp=null;this._queryForPreviewedSuggestion=n;this.setActivePreviewPaneContainer(t);this._activePreviewPaneViewModel.update(t,n,i,r,u,f,t.previewPaneNeedsRefreshAfterDeduping)},r.prototype.bindBeforeItemLaunch=function(n){this._beforeItemLaunchEventHandlers.push(n)},r.prototype.bindAfterItemLaunch=function(n){this._afterItemLaunchEventHandlers.push(n)},r.prototype.hasFocus=function(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.hasFocus():!1},r.prototype.isOpened=function(){return!!this._previewedSuggestion},r.prototype.isPreviewPaneWithLoaderViewModel=function(n){var t;return!!((t=n)===null||t===void 0?void 0:t.startLoadingScreen)},r}();n.PreviewPane=r}(WSB||(WSB={}));__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)}}(),function(n){var t=function(t){function i(){return t!==null&&t.apply(this,arguments)||this}return __extends(i,t),i.prototype.fetchUrl=function(t,i,r,u,f,e){var s=this,o;if(n.isBrowserOnline()){var a=r?1:0,h=SearchAppWrapper.CortanaApp,c=h.createStringMap(),l=h.createStringMap();if(i)for(o in i)o.toLowerCase().startsWith("content")?l[o]=i[o]:c[o]=i[o];n.Promise.safeChain("makeHttpRequestAsync",function(){return h.makeHttpRequestAsync(a,t,c,r,l)},function(t){e()&&(t.statusCode===200?n.Promise.safeChain("readResponse",function(){return t.readAsStringAsync()},function(t){if(e()){n.TestHookUrlParameters&&t&&(t=t.replace(new RegExp("<!--[^]*?-->","gm"),""));var i=t?n.safeExecute(function(){return JSON.parse(t)},"parseCortanaHttpResponse",null,null):null;i!=null?u(s._dataSource,i,null):u(s._dataSource,null,null)}},function(){return u(s._dataSource,null,null)},f):u(s._dataSource,null,t.statusCode.toString()))},function(){return u(s._dataSource,null,null)},f)}else u(this._dataSource,null,null,null,!0)},i}(n.JsonDataProvider);n.CortanaJsonDataProvider=t}(WSB||(WSB={}));1