GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Local/Desktop/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Local/Desktop/22.js
var WSB;(function(n){function u(t,r,u,f,e,o,s,h){i(t,r,u,t=>{var i=null;t.status==200&&(i=t.responseText?n.safeExecute(()=>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,l,a){n.config.fixInvalidMUID&&sj_cook&&sj_cook.clear("MUID","/");let v=c&&_w.XMLHttpRequest?new XMLHttpRequest:sj_gx();const p=l!==null&&l!==void 0?l:u?"POST":"GET";try{v.open(p,i,!0)}catch(w){n.LogWSBError("fetchUrl",i,w,undefined,undefined,"WindowsTelemetry");f&&f({responseText:"",contentType:"",status:-1,result:3});return}if(r)for(let n in r)v.setRequestHeader(n,r[n]);let y;e&&(y=e.register(()=>v.abort(),!1,"xhr abort"));n.config.useEventListeners?(v.addEventListener("load",()=>{t(v,0,f,y,e,o,a)}),v.addEventListener("timeout",()=>{t(v,1,f,y,e,o,a)}),v.addEventListener("abort",()=>{t(v,2,f,y,e,o,a)}),v.addEventListener("error",()=>{t(v,3,f,y,e,o,a)})):(v.onreadystatechange=()=>{v.readyState==4&&v.status>0&&t(v,0,f,y,e,o,a)},v.ontimeout=()=>t(v,1,f,y,e,o,a),v.onabort=()=>t(v,2,f,y,e,o,a),v.onerror=()=>t(v,3,f,y,e,o,a));typeof s!="undefined"?v.withCredentials=s:v.withCredentials!==undefined&&(v.withCredentials=!0);h&&h>0&&(v.timeout=h);v.send(u)}function t(n,t,i,r,u,f,e){if(!f||f()){n.readyState==4&&(n.onreadystatechange=function(){});r&&u.unregister(r);let f={};e&&e.map(t=>f[t]=n.getResponseHeader(t));i&&i({responseText:n.responseText,contentType:n.getResponseHeader("content-type")||"",status:n.status,result:t,responseURL:n.responseURL,responseHeaders:Object.keys(f).length===0?null:f})}}function e(n){let 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}n.fetchUrlJson=u;n.fetchUrl=i;class r{constructor(t){this._dataSource=t;this._delay=n.config.webDataSourcesWithThrottling[t]||0;this._timers=[]}getBaseUrl(){throw new Error("Not Implemented");}getPostBody(){return undefined}onBeforeFetchUrl(){}createUrl(t){return decodeURIComponent(this.getBaseUrl())+(t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"")}addParamsToUrl(n,t){let i=t?Object.keys(t):[];return i.length>0&&(n+=n.includes("?")?"&":"?",n+=i.map(n=>n+"="+t[n]).join("&")),n}fetch(t,i,r,u,f,e,o,s,h,c){if(n.isDataSourceEnabled(this._dataSource,t)){let l=this.addParamsToUrl(this.createUrl(t),e),a=this.getPostBody(t)||"";if(this._lastSequenceNumber!=r){for(let n of this._timers)sb_ct(n);this._timers=[];this._lastSequenceNumber=r}if(this._delay>0&&!t.isFormulatedQuery)this._timers.push(n.safeSetTimeout(()=>{this.onBeforeFetchUrl(r,l);this.fetchUrl(l,o,a,i,u,f,s,h,c)},this._delay,"fetchDelay"));else{this.onBeforeFetchUrl(r,l);this.fetchUrl(l,o,a,i,u,f,s,h,c)}}}fetchUrl(t,r,u,f,e,o,s,h,c){let l=[];n.isWebXTFlightsTelemetry()&&l.push("X-FlightsTelemetry-Flight");i(t,r,u,({responseText:u,contentType:i,status:e,responseHeaders:r})=>{let o;if(e==200&&(n.TestHookUrlParameters&&u&&(u=u.replace(new RegExp("<!--[^]*?-->","gm"),"")),u&&i.includes("json")&&(o=n.safeExecute(()=>JSON.parse(u),"parseWebProviderResponse",null,t))),n.isWebXTFlightsTelemetry()){const n=Object.assign(Object.assign({},o),r?{responseHeaders:Object.assign({},JSON.parse(JSON.stringify(r)))}:{});f(this._dataSource,n,e==200?null:e.toString())}else f(this._dataSource,o,e==200?null:e.toString())},this._delay>0?e:null,o,h,s,c,undefined,l)}}n.JsonDataProvider=r;class f extends r{getName(){return"AsSuggestionsDataProvider"}constructor(t){super("Web");this._responseCacheManager=t;this.asBaseUrl=n.config.u;n.config.enableOfflineWithWeb&&n.config.webHost&&n.isBrowserOnline()&&(this.asBaseUrl=n.config.webHost+this.asBaseUrl)}setBaseUrl(n){this.asBaseUrl=n}getBaseUrl(){return this.asBaseUrl}onBeforeFetchUrl(t,i){n.config.fixInvalidMUID&&sj_cook&&sj_cook.clear("MUID","/");n.InstrumentationHelper.instrumentSnRProviderFetchUrl(t,i)}fetch(t,i,r,u,f,e,o){if(n.isDataSourceEnabled(this._dataSource,t)){let s=i;if(s=(r,u,f,e)=>{u&&n.isEmptyUrlPrefix(t)&&(u.Suggestions=[]),this.processResourceResponse(u),i(r,u,f,e)},n.config.enableSearchHistoryMru&&(t===null||t===void 0?void 0:t.isSearchHomeZI)){let f=n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType();const i=(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(55182095))&&n.config.enabledMsaAuthV2?"X-Search-MsaV2Token":"X-Search-RPSToken";if(f===2&&(o[i]===undefined||o[i]===null||o[i].length===0)){s("Web",null,null,0);return}this.fetchAndCacheSearchHistory(t,s,r,u,e,o);return}this._responseCacheManager?this.fetchWithCache(t,s,r,u,f,e,o):super.fetch(t,s,r,u,f,e,o)}}fetchAndCacheSearchHistory(t,i,r,u,f,e){i("Web",null,null,0);let s=this.addParamsToUrl(this.createUrl(t),f!==null&&f!==void 0?f:{});this.onBeforeFetchUrl(r,s);let h=()=>!0,o=i;o=(i,r,u)=>{try{if(!t.queryToFetch&&this.mruResponseIsValidForCaching(u,r)){r.ELToken&&(r=Object.assign({},r),delete r.ELToken);let t={cacheTime:Math.round((new Date).getTime()/1e3),response:r},i=n.getHistoryCacheKeyForSelectedAccount();n.LightweightStorage.setItem(i,JSON.stringify(t))}}catch(f){n.LogWSBError("writeCacheFailedWeb",f,new Error("Web Provider write to local cache failed"),undefined,undefined,"WindowsTelemetry")}};super.fetch(t,o,r,u,h,f,e)}fetchWithCache(t,i,r,u,f,e,o){let s=this._responseCacheManager.get(t);if(s){let h=this.addParamsToUrl(this.createUrl(t),e);this.onBeforeFetchUrl(r,h);if(i(this._dataSource,s,null,1),n.config.forceUseNifQF&&this._dataSource=="Web"){let s=n.deepCopy(e);s.wsbnoas="1";this.fetchWithoutCache(t,i,r,u,f,s,o)}}else{let s=()=>!0,n=i;n=(n,r,u)=>{f()&&i(n,r,u,0),t.queryToFetch&&this.responseIsValidForCaching(u,r)&&(r.ELToken&&(r=Object.assign({},r),delete r.ELToken),this._responseCacheManager.put(t,r))};super.fetch(t,n,r,u,s,e,o)}}fetchWithoutCache(n,t,i,r,u,f,e){let s=()=>!0,o=t;o=(n,i,r)=>{u()&&t(n,i,r,0)};super.fetch(n,o,i,r,s,f,e)}responseIsValidForCaching(n,t){const i="HS";return!n&&t&&t.Suggestions&&t.Suggestions.length>=0&&t.Suggestions.every(n=>!n.InstantAnswer&&n.Attributes.stype!=i)}mruResponseIsValidForCaching(n,t){return!n&&t&&t.Suggestions&&t.Suggestions.length>0&&t.Suggestions.every(n=>!n.InstantAnswer)}processResourceResponse(n){if(n){let t=n.Resources;if(t){this._downloadedStylesResources?this.updateWithDownloadedResources(t):this._downloadedStylesResources=t.Styles;let i={Styles:t.Styles,Scripts:null};JsonInject.WriteHeadAndBeforeContentResources(i)}}}updateWithDownloadedResources(n){for(let t in n.Styles)for(let i in n.Styles[t])this._downloadedStylesResources[t][i]?delete n.Styles[t][i]:this._downloadedStylesResources[t][i]=n.Styles[t][i]}}n.AsSuggestionsDataProvider=f;n.getIconFromOnlineResponse=e})(WSB||(WSB={})),function(n){var t;(function(t){var i;(function(t){function e(n,t,r,u,f){typeof indexedDB!="undefined"&&new i(n,f,t,r,u)}function o(n,t,r,u,f){typeof indexedDB!="undefined"&&new i(n,f,t,r,u)}function s(n,t,r,u,f,e){typeof indexedDB!="undefined"&&new i(n,e,t,r,u,f)}function h(n,t,r,u,f,e){typeof indexedDB!="undefined"&&new i(n,e,t,r,u,f)}function c(n,t,i){r(n,"deleteDatabase requested");try{let f=indexedDB.deleteDatabase(n);f.onsuccess=()=>{r(n,"deleteDatabase completed"),t&&t()};f.onerror=u("deleteDatabase.onError",t=>{SharedLogHelper.LogError("deleteDB",n,t),i&&i(t)})}catch(f){i&&i(f)}}function u(n,t){return i=>{let r=n;try{r+=" "+i.target.error.name}catch(u){}t(new Error(r))}}const f=100;t.instanceWithNumberKeys=e;t.instanceWithStringKeys=o;t.instanceWithNumberKeysAndSecondaryKey=s;t.instanceWithStringKeysAndSecondaryKey=h;let r=(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.dbTrace)?(t,i)=>n.log("["+t+"] "+i):()=>{};t.deleteDatabase=c;t.handleErrorEvent=u;class i{constructor(n,t,f,e,o,s){this._databaseName=n;this.onClosed=o;this._secondaryIndex=s;this._closePending=!1;this._storeName=n+"Store";r(this._databaseName,"open requested");let h;try{h=indexedDB.open(n,t||1)}catch(c){e(new Error("IndexedDbClientSideStorage.const: Could not open database"));return}h.onsuccess=n=>{this._database=n.target.result,i._allInstances.push(this),r(this._databaseName,"open completed"),f(this)};h.onupgradeneeded=n=>{r(this._databaseName,"upgrading");let t=n.target.result;t.objectStoreNames.contains(this._storeName)&&t.deleteObjectStore(this._storeName);let i=t.createObjectStore(this._storeName);this._secondaryIndex&&i.createIndex(this._secondaryIndex,this._secondaryIndex,{unique:!1})};h.onerror=u("open.onError",e);h.onblocked=u("open.onBlocked",e)}put(n,t,i,r){this.safeDbOperation("put",n.toString(),"readwrite",i,(i,r,u)=>{let f=i.put(t,n);f.onsuccess=r;f.onerror=u},r)}putMultiple(n,t,i){this.safeDbOperation("putMultiple",n.length.toString(),"readwrite",t,(t,i,r)=>{let u=0,f=()=>{if(u<n.length){let e=t.put(n[u].value,n[u].key);u+=1;e.onsuccess=u==n.length?i:f;e.onerror=r}};f()},i)}getValue(n,t,i){this.safeDbOperation("getValue",n.toString(),"readonly",n=>t(n.target.result),(t,i,r)=>{let u=t.get(n);u.onsuccess=i;u.onerror=r},i)}getRange(n,t,i,r){this.safeDbOperation("getRange","["+n+", "+t+")","readonly",i,(i,r,u)=>{let f=IDBKeyRange.bound(n,t,!1,!0);this.queryFromCursor(i.openCursor(f),r,u)},r)}getRangeOnSecondaryKey(n,t,i,r){this._secondaryIndex?this.safeDbOperation("getRangeOnSecondaryKey","["+n+", "+t+")","readonly",i,(i,r,u)=>{let f=i.index(this._secondaryIndex),e=IDBKeyRange.bound(n,t,!1,!0);this.queryFromCursor(f.openCursor(e),r,u)},r):r(new Error("getRangeOnSecondaryKey: Index name is missing"))}removeRange(n,t,i,r){this.safeDbOperation("removeRange","["+n+","+t+"]","readwrite",i,(i,r,u)=>{let f=IDBKeyRange.bound(n,t,!1,!0);this.removeFromCursor(i.openCursor(f),r,u)},r)}removeRangeOnSecondaryKey(n,t,i,r){this._secondaryIndex?this.safeDbOperation("removeRangeOnSecondaryKey","["+n+","+t+"]","readwrite",i,(i,r,u)=>{let f=i.index(this._secondaryIndex),e=IDBKeyRange.bound(n,t,!1,!0);this.removeFromCursor(f.openCursor(e),r,u)},r):r(new Error("removeRangeOnSecondaryKey: Index name is missing"))}getAll(n,t){this.safeDbOperation("getAll",null,"readonly",n,(n,t,i)=>this.queryFromCursor(n.openCursor(),t,i),t)}close(){r(this._databaseName,"close requested");this.innerClose()}innerClose(){if(i._requestsInProgress>0)r(this._databaseName,"delaying close because of "+i._requestsInProgress+" requests in progress"),this._closePending=!0;else for(let t of i._allInstances)t._database&&(n.safeExecute(()=>t._database.close(),this._databaseName+".close"),r(t._databaseName,"close completed"),t._database=null,t.onClosed())}queryFromCursor(n,t,i){let r=[];n.onsuccess=n=>{let i=n.target.result;i&&r.push({key:i.primaryKey,value:i.value});i&&r.length!=f?i.continue():t(r)};n.onerror=i}removeFromCursor(n,t,i){let r=0;n.onsuccess=n=>{let i=n.target.result;i&&(i.delete(),r+=1);i&&r!=f?i.continue():t(null)};n.onerror=i}safeDbOperation(n,t,f,e,o,s){r(this._databaseName,n+" requested"+(t?" "+t:""));i._requestsInProgress+=1;let c=u=>{r(this._databaseName,n+" completed "+(t?t+" ":"")),i._requestsInProgress-=1,e(u),this._closePending&&i._requestsInProgress==0&&this.innerClose()},h=n=>{i._requestsInProgress-=1,s(n),this._closePending&&i._requestsInProgress==0&&this.innerClose()};try{if(this._database){let t=this._database.transaction(this._storeName,f).objectStore(this._storeName);o(t,c,u(n+".onError",h))}else h(new Error(n+" Database not initialized"))}catch(l){h(l)}}}i._requestsInProgress=0;i._allInstances=[];n.ClientSideStorage=n.Old.ClientSideStorage})(i=t.ClientSideStorage||(t.ClientSideStorage={}))})(t=n.Old||(n.Old={}))}(WSB||(WSB={})),function(n){var t;(function(t){var i;(function(i){const r=250,u=3;class f{constructor(t,i,r,u,f){this._storageFactory=t;this.createResponse=i;this.dataPopulated=r;this.getDataSourceState=u;this._dataSource=f;this._pendingQueries=[];this._storageOpenInProgress=!1;this._retryCount=0;n.Host&&(n.Host.bindAppVisible(()=>this.initStorage()),n.Host.bindDismissed(()=>this._pendingQueries=[]),n.Host.bindAppHidden(()=>this.teardownStorage()))}onAfterWrite(){if(this._writing=!1,this._pendingWrites.length>0){let n=this._pendingWrites.shift();n()}else this._tearDownPending&&this.teardownStorage()}teardownStorage(){this._writing?this._tearDownPending=!0:(this._tearDownPending=!1,this._storage&&this._storage.close())}initStorage(){!this._storageOpenInProgress&&this.dataPopulated()&&(this._storageOpenInProgress=!0,this._storageFactory(n=>{this._storage=n,this._storageOpenInProgress=!1,this._pendingQueries.forEach(n=>n()),this._pendingQueries=[]},n=>{this.onError(n,"open storage");this._storageOpenInProgress=!1;this._pendingQueries.forEach(n=>n());this._pendingQueries=[]},()=>this._storage=null))}static getUnixTime(t){return t||(t=n.getCurrentDate()),Math.round(t.getTime()/1e3)}onError(t,i){i!="open storage"&&n.LogWSBError(i,this._dataSource,t,undefined,undefined,"WindowsTelemetry");this.teardownStorage()}reloadStorage(){this.teardownStorage();this.initStorage()}isReady(){return!!this._storage}getTimeout(t,i){return!t||(i===null||i===void 0?void 0:i.isSearchHomeZI)?n.LatencyTimeout:r}getKey(t,i,r){let u;return u=this._dataSource=="ANA"?"anaheimData":t.queryToFetch?t.queryToFetch.toLocaleLowerCase():"",(n.hasCopilotSettingEnabled()&&i==n.GroupType.AIFeed||n.config.wsbWithCopilotQF&&r=="CP")&&(u="AIFD"),u}fetch(i,r,u,f,e){let s=n.getCurrentTime();if(n.isDataSourceEnabled(this._dataSource,i)){this._dataSource=="ANA"&&(t.AnaheimDataProvider.InstrumentStringNumber.FTC=1);let o=(t,u)=>{let f=n.getCurrentTime()-s;n.InstrumentationHelper.instrumentPerfEvent(n.SequenceNumberManager.getSequenceNumber(),"Fetch"+this._dataSource,f);let o=u=="R";e()&&r(this._dataSource,this.createResponse(i,t,o),this.getDataSourceState(u))};this.innerQueryStorage(1,this.getKey(i),n=>o(n,"R"),()=>o(null,"E"),()=>o(null,"X"),()=>o(null,"T"),i)}}withStorage(n){return this._storage?(n(this._storage),!0):!1}getMaxKey(n){return n.slice(0,n.length-1)+String.fromCharCode(n.charCodeAt(n.length-1)+1)}getStorage(n,t,i,r){this.innerQueryStorage(null,null,t=>n(t),t,i,r)}queryStorage(n,t,i,r,u){this.innerQueryStorage(0,n,t,i,r,u)}innerQueryStorage(t,r,f,e,o,s,h){let c=null,l=!1,a=!0,v=()=>{if(a)if(a=!1,this._storage){let n=n=>{(n===null||n===void 0?void 0:n.message)==="NotFoundError"&&(this._retryCount+=1);c&&sb_ct(c);this.onError(n,"query");l||(l=!0,e())};t==0?this._storage.getValue(r,n=>{c&&sb_ct(c),l||(l=!0,f(n))},n):r?this._storage.getRange(r,this.getMaxKey(r),n=>{c&&sb_ct(c),l||(l=!0,f(n))},n):this._storage.getAll(n=>{c&&sb_ct(c),l||(l=!0,f(n))},n)}else c&&sb_ct(c),l||(l=!0,e())};if(this._storage)v();else if(this._retryCount<u)if(this.initStorage(),this._storageOpenInProgress)this._pendingQueries.push(v);else{o();return}else{this._retryCount=0;let t=n.DataProviderDBName[this.getName()];this.onError(new Error("Corrupted "+t+". Will delete and reloading."),"IndexDBCorruption");i.deleteDatabase(t);return}let y=this.getTimeout(r,h);y&&(c=n.safeSetTimeout(()=>{c=null,a=!1,l||(l=!0,s())},y,"innerQueryStorage"))}}i.StorageBasedDataProvider=f})(i=t.ClientSideStorage||(t.ClientSideStorage={}))})(t=n.Old||(n.Old={}))}(WSB||(WSB={})),function(n){class r{constructor(){this.pendingWritingPromises={}}async getItemAsync(n){const t=await this.openDBAsync("get");if(!t||!n)return null;this.pendingWritingPromises.hasOwnProperty(n)&&this.pendingWritingPromises[n]&&await this.pendingWritingPromises[n];const i=new Promise((i,u)=>{const e=t.transaction(r.MRUStoreName,"readonly"),o=e.objectStore(r.MRUStoreName),f=o.get(n);f.onsuccess=()=>{const n=f.result;i(n)};f.onerror=()=>{u(null)}});return await i}async setItemAsync(n,t){const i=await this.openDBAsync("set");if(!i||!n)return!1;try{this.pendingWritingPromises.hasOwnProperty(n)&&this.pendingWritingPromises[n]&&await this.pendingWritingPromises[n];this.pendingWritingPromises[n]=new Promise((u,f)=>{const o=i.transaction(r.MRUStoreName,"readwrite"),s=o.objectStore(r.MRUStoreName),e=s.put(t,n);e.onsuccess=()=>{u(!0)};e.onerror=()=>{f(!1)}});return await this.pendingWritingPromises[n]}finally{delete this.pendingWritingPromises[n]}}async openDBAsync(t){if(r.stat_openDBCallCount++,this.pendingOpeningPromise&&await this.pendingOpeningPromise,this.mruDB)return this.mruDB;r.stat_openDBCount++;r.stat_openDBCaller=t;try{this.pendingOpeningPromise=new Promise((t,i)=>{let u;try{u=indexedDB.open(n.MRUDatabaseName,r.MRUDBVersion);u.onsuccess=()=>{let n=u.result;this.mruDB=n;r.stat_openDBSuccessCount++;t(n)};u.onupgradeneeded=()=>{try{let n=u.result;if(this.mruDB=n,!n.objectStoreNames.contains(r.MRUStoreName)){const t=n.createObjectStore(r.MRUStoreName);t.createIndex(r.SECONDARY_KEY,r.SECONDARY_KEY,{unique:!1})}}catch(n){SharedLogHelper.LogError("PSDbUpgrade",null,n)}};u.onerror=()=>{r.stat_openDBFailureCount++,i(null)};u.onblocked=()=>{i(null)}}catch(f){SharedLogHelper.LogError("PSDbOpen",null,f);this.pendingOpeningPromise=null;i(null)}});const t=await this.pendingOpeningPromise;t&&(this.mruDB=t)}finally{return delete this.pendingOpeningPromise,this.mruDB}}static mkReset(){r.stat_openDBCaller&&r.stat_openDBCallCount&&r.stat_openDBCount>=Number.MAX_SAFE_INTEGER&&r.stat_openDBSuccessCount&&r.stat_openDBFailureCount&&(r.stat_openDBCaller=null,r.stat_openDBCallCount=0,r.stat_openDBCount=0,r.stat_openDBSuccessCount=0,r.stat_openDBFailureCount=0)}}r.MRUDBVersion=1;r.MRUStoreName="mruWithIndexStore";r.SECONDARY_KEY="LastUpdated";r.stat_openDBCallCount=0;r.stat_openDBCount=0;r.stat_openDBSuccessCount=0;r.stat_openDBFailureCount=0;class i{static resetPSCache(){i.HasMRUDbEntriesFirstBackup=!1;i.HasMRUDbEntriesInit=!1;i.HasMRUDbEntriesChange=!1;i.HasMRUSearchHistoryCacheChange=!1;i.HasMRUDismissCacheChange=!1;i.HasSelectedAccountIdChange=!1}static setMRUDbEntries(n){t.SetMRUBackfillSignalDone&&(i.HasMRUDbEntriesInit=!0,i.MRUDbEntries=n||[])}static changeMRUDbEntries(n,r){if(t.SetMRUBackfillSignalDone){let u=i.MRUDbEntries;if(u&&i.HasMRUDbEntriesInit){let t=u.findIndex(t=>t.key==n);t!=-1?u[t].value=r:u.push({key:n,value:r});i.HasMRUDbEntriesChange=!0}}}static changeSearchHistoryCache(n){t.SetMRUBackfillSignalDone&&i.MRUSearchHistoryCache!=n&&(i.MRUSearchHistoryCache=n,i.HasMRUSearchHistoryCacheChange=!0)}static changeMRUDismissCache(n){t.SetMRUBackfillSignalDone&&i.MRUDismissCache!=n&&(i.MRUDismissCache=n,i.HasMRUDismissCacheChange=!0)}static changeSelectedAccountId(n){t.SetMRUBackfillSignalDone&&i.SelectedAccountId!=n&&(i.SelectedAccountId=n,i.HasSelectedAccountIdChange=!0)}}i.HasMRUDbEntriesFirstBackup=!1;i.HasMRUDbEntriesInit=!1;i.HasMRUDbEntriesChange=!1;i.HasMRUSearchHistoryCacheChange=!1;i.HasMRUDismissCacheChange=!1;i.HasSelectedAccountIdChange=!1;n.PSCache=i;class t{static resetPSManager(){t.mruIndexedDB=new r;i.resetPSCache();t.SetMRUBackfillSignalDone=!1;t.stat_backfillInProgress=!1;t.stat_backupInProgress=!1;t.stat_clearInProgress=!1;t.stat_backfillCaller&&t.stat_backfillCallCount&&t.stat_backfillCount>=Number.MAX_SAFE_INTEGER&&t.stat_backfillSuccessCount&&t.stat_backfillFailureCount&&t.stat_backfillInst&&(t.stat_backfillCaller=null,t.stat_backfillCallCount=0,t.stat_backfillCount=0,t.stat_backfillSuccessCount=0,t.stat_backfillFailureCount=0,t.stat_backfillInst={});t.stat_backupCaller&&t.stat_backupCallCount&&t.stat_backupCount>=Number.MAX_SAFE_INTEGER&&t.stat_backupSuccessCount&&t.stat_backupFailureCount&&(t.stat_backupCaller=null,t.stat_backupCallCount=0,t.stat_backupCount=0,t.stat_backupSuccessCount=0,t.stat_backupFailureCount=0);t.stat_clearCaller&&t.stat_clearCallCount&&t.stat_clearCount>=Number.MAX_SAFE_INTEGER&&t.stat_clearSuccessCount&&t.stat_clearFailureCount&&(t.stat_clearCaller=null,t.stat_clearCallCount=0,t.stat_clearCount=0,t.stat_clearSuccessCount=0,t.stat_clearFailureCount=0);r.mkReset()}static isPSFeatureEnabled(i){return(n.config.bypassPSTestEnvCheck||!t.isTestEnvironment())&&n.config.enablePersistentStorageCarryover&&i=="MRU"&&n.VelocityKeys.getFeatureStatus(50659858)!="0"}static isTestEnvironment(){return n.TestHookUrlParameters||n.MockUrlParameters?!0:!1}static async checkAndBackfillMRUAtBootstrapAsync(i="init"){if((t.stat_backfillCallCount++,t.SetMRUBackfillSignalDone&&!n.config.alwaysReadPersistentStorageForTest)||t.stat_backfillInProgress)return!0;t.stat_backfillInProgress=!0;t.stat_backfillCount++;t.stat_backfillCaller=i;const f=performance.now(),r={},e=await t.checkMRUBackfillKeyAsync(r);let u=!0;return(!e||n.config.alwaysReadPersistentStorageForTest)&&(t.backfillLocalStorage(r),u=await t.backfillIndexedDBAsync(r),r.PSBFL=performance.now()-f,t.uploadInst("PSBackfill",r)),t.stat_backfillInst=r,t.SetMRUBackfillSignalDone=await t.setMRUBackfillSignalAsync(),t.stat_backfillInProgress=!1,u?t.stat_backfillSuccessCount++:t.stat_backfillFailureCount++,u}static checkAndBackupMRUAtDismiss(r){if(t.stat_backupCallCount++,!t.SetMRUBackfillSignalDone)return!1;if(t.stat_backupInProgress)return!0;t.stat_backupInProgress=!0;t.stat_backupCount++;t.stat_backupCaller=r;const e=performance.now();t.stat_backupCount++;let u=[];if((!i.HasMRUDbEntriesFirstBackup||i.HasMRUDbEntriesChange||n.config.alwaysWritePersistentStorageForTest)&&i.HasMRUDbEntriesInit){const n=t.serializeMRUEntries(i.MRUDbEntries);u=u.concat(n);i.HasMRUDbEntriesFirstBackup=!0;i.HasMRUDbEntriesChange=!1}if(i.HasMRUSearchHistoryCacheChange){const n=t.getSHCachePSKVPs(i.MRUSearchHistoryCache);u=u.concat(n);i.HasMRUSearchHistoryCacheChange=!1}i.HasMRUDismissCacheChange&&(u.push({key:n.config.mruWsDismissCacheKey,value:i.MRUDismissCache||""}),i.HasMRUDismissCacheChange=!1);i.HasSelectedAccountIdChange&&(u.push({key:n.SelectedAccountIdStorageKey,value:i.SelectedAccountId||""}),i.HasSelectedAccountIdChange=!1);let f=!0;if(u.length>0){const n={};f=t.backupPersistentStorage(u,n);n.PSBUL=performance.now()-e;t.uploadInst("PSBackup",n)}return t.stat_backupInProgress=!1,f?t.stat_backupSuccessCount++:t.stat_backupFailureCount++,f}static async clearMRUAtButtonClickedAsync(n){if(t.stat_clearCallCount++,t.stat_clearInProgress)return!0;t.stat_clearInProgress=!0;t.stat_clearCount++;t.stat_clearCaller=n;const o=performance.now();i.setMRUDbEntries([]);t.SetMRUBackfillSignalDone=await t.setMRUBackfillSignalAsync();let f=0,u=0;const s=performance.now();for(const n of t.MRUPSKeys){const t=SearchAppWrapper.CortanaApp.persistentStorage.removeItem(n);t?f++:u++}const e=performance.now()-s,r={};return r.PSCRL=performance.now()-o,r.PSRTL=e,r.PSRKL=e/t.MRUPSKeys.length,r.PSRSC=f,r.PSRFC=u,t.uploadInst("PSClear",r),t.stat_clearInProgress=!1,u==0?t.stat_clearSuccessCount++:t.stat_clearFailureCount++,u==0}static async checkMRUBackfillKeyAsync(n){const r=performance.now(),i=await t.mruIndexedDB.getItemAsync(t.MRUBackfillSignalKey);return n.DBGKL=performance.now()-r,n.DBGRC=i?1:0,i?!0:!1}static backfillLocalStorage(i){const e=performance.now(),r=SearchAppWrapper.CortanaApp.persistentStorage.getItems(t.CacheKeys),u=performance.now()-e;let f=0;if(r)for(const t in r)if(r.hasOwnProperty(t)){const i=r[t];i&&(f++,n.LightweightStorage.setItem(t,i))}i.PSGTL2=u;i.PSGKL2=u/t.CacheKeys.length;i.PSGKC2=t.CacheKeys.length;i.PSGRC2=f;t.backfillLocalStorageWithSearchHistoryCache(i)}static backfillLocalStorageWithSearchHistoryCache(i){const e=performance.now(),r=SearchAppWrapper.CortanaApp.persistentStorage.getItems(t.SHCachePSKeys),u=performance.now()-e;let f=0;if(r){let i="";for(const n in t.SHCachePSKeys)if(r.hasOwnProperty(n)){const t=r[n];t&&(f++,i=i.concat(t))}i&&n.LightweightStorage.setItem(n.config.mruAsSearchHistoryCacheKey,i)}i.PSGTL3=u;i.PSGKL3=u/t.CacheKeys.length;i.PSGKC3=t.CacheKeys.length;i.PSGRC3=f}static async backfillIndexedDBAsync(n){const e=performance.now(),i=SearchAppWrapper.CortanaApp.persistentStorage.getItems(t.MRUPSKeys),u=performance.now()-e;let r=!0,f=0;if(i)for(const n in i)if(i.hasOwnProperty(n)){const u=i[n];if(u){f++;try{let n=JSON.parse(u);n&&n.key&&n.value&&(r=r&&await t.mruIndexedDB.setItemAsync(n.key,n.value))}catch(e){SharedLogHelper.LogError("PSBFDB",null,e);r=!1}}}return n.PSGTL=u,n.PSGKL=u/t.MRUPSKeys.length,n.PSGKC=t.MRUPSKeys.length,n.PSGRC=f,r}static async setMRUBackfillSignalAsync(){return await t.mruIndexedDB.setItemAsync(t.MRUBackfillSignalKey,t.MRUBackfillSignalValue)}static serializeMRUEntries(n){let r=[],i=0;for(const u of n){if(i>=t.MaxMRUBackkfillCount)break;if(u&&u.key&&u.value){if(u.key===t.MRUBackfillSignalKey)continue;try{r.push({key:t.MRUPSKeys[i],value:JSON.stringify(u)});i++}catch(f){}}}while(i<t.MaxMRUBackkfillCount)r.push({key:t.MRUPSKeys[i],value:""}),i++;return r}static backupPersistentStorage(n,i){let u=0,r=0;if(n&&n.length>0){const f=new Date;f.setDate(f.getDate()+t.MruMaxAgeInDays);const o=performance.now();for(const t of n){const n=SearchAppWrapper.CortanaApp.persistentStorage.setItem(t.key,t.value,f);n?u++:r++}const e=performance.now()-o;i.PSSTL=e;i.PSSKL=e/n.length;i.PSSSC=u;i.PSSFC=r}return r==0}static getSHCachePSKVPs(n){let i=[];if(n&&n.length<=t.MaxSHCacheStringLength)for(let r=0;r<t.MaxSHCachePSCount;r++){let u=r*t.MaxSHCachePSValueLength;if(n.length>u){let f=Math.min((r+1)*t.MaxSHCachePSValueLength,n.length);i.push({key:t.SHCachePSKeys[r],value:n.substring(u,f)||""})}else i.push({key:t.SHCachePSKeys[r],value:""})}else for(let n=0;n<t.MaxSHCachePSCount;n++)i.push({key:t.SHCachePSKeys[n],value:""});return i}static getSHCacheKey(t){return`${n.config.mruAsSearchHistoryCacheKey}_${t}`}static getMRUPSKey(n){return`MRU_${n}`}static getUnixTime(t){return t||(t=n.getCurrentDate()),Math.round(t.getTime()/1e3)}static uploadInst(t,i){try{let r=_G.IG;if(!r){SharedLogHelper.LogError("uploadInst "+t,"Could not instrument as server IG not known");return}let u=n.InstrumentationCommon.createPerfPingEvent(r,[i],t);n.InstrumentationHelper.logPerfPingEvent(u)}catch(r){typeof SharedLogHelper!="undefined"&&SharedLogHelper.LogError("uploadInstError",t,r)}}}t.MRUBackfillSignalKey="MRUBackfillSignal";t.SetMRUBackfillSignalDone=!1;t.MruMaxAgeInDays=30;t.MRUBackfillSignalValue={LastUpdated:t.getUnixTime(),SuggestionEngagementData:{}};t.MaxMRUBackkfillCount=20;t.MRUPSKeys=Array.from({length:t.MaxMRUBackkfillCount},(n,i)=>t.getMRUPSKey(i+1));t.MaxSHCachePSCount=3;t.SHCachePSKeys=Array.from({length:t.MaxSHCachePSCount},(n,i)=>t.getSHCacheKey(i+1));t.MaxSHCachePSValueLength=3999;t.MaxSHCacheStringLength=t.MaxSHCachePSCount*t.MaxSHCachePSValueLength;t.CacheKeys=[n.config.mruWsDismissCacheKey,n.SelectedAccountIdStorageKey];t.mruIndexedDB=new r;t.stat_backfillInProgress=!1;t.stat_backupInProgress=!1;t.stat_clearInProgress=!1;t.stat_backfillCallCount=0;t.stat_backfillCount=0;t.stat_backfillSuccessCount=0;t.stat_backfillFailureCount=0;t.stat_backupCallCount=0;t.stat_backupCount=0;t.stat_backupSuccessCount=0;t.stat_backupFailureCount=0;t.stat_clearCallCount=0;t.stat_clearCount=0;t.stat_clearSuccessCount=0;t.stat_clearFailureCount=0;t.stat_backfillInst={};n.PSManager=t}(WSB||(WSB={})),function(n){const t=3;class i{constructor(n,t,i,r=null){this._navigationHelper=n;this._temporaryMessageHandler=t;this.dataSource=i;this._wsbCopilotViewModel=r}parse(i,r,u,f,e,o,s){var a,v;let h=[],y=[],p=[],w=[],b=[],k=[],d=[],c=[],l=[];if(f&&f.Suggestions)for(let e of f.Suggestions){let f=e.suggestionData;if(f.handoffType==2){let t=f;n.isApp(f.type)?(y.push(t.id),b.push(e)):n.isSetting(f.type)?(p.push(t.id),k.push(e)):n.isFileOrFolder(f.type)&&(w.push(t.id),d.push(e))}else if(n.isBrowserOnline()){if(n.isSupportWebResultsInAllScopeInDMAEnabled()){let o=e.suggestionData;if(n.Host.getThirdPartySearchAppByName((a=o.sourceAppDisplayName)!==null&&a!==void 0?a:"")){if(n.config.msbMruLimitEnabled&&u==="MWS"&&i.scope===n.Scope.All&&h.length===t)break;let o=n.safeExecute(()=>this.parseMRUWebSuggestion(i,e,r,u,n.config.enableMruProviderInQF),"parseMRUWebSuggestion");o&&(n.config.enableMruProviderInQF&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())===3?i.isSearchHomeZI&&f.handoffType==0?c.push(o):h.push(o):f.handoffType==0?c.push(o):h.push(o))}else continue}else if(n.isBingEnabled()){if(n.config.msbMruLimitEnabled&&u==="MWS"&&i.scope===n.Scope.All&&h.length===t)break;let o=n.safeExecute(()=>this.parseMRUWebSuggestion(i,e,r,u,n.config.enableMruProviderInQF),"parseMRUWebSuggestion");o&&(n.config.enableMruProviderInQF&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())===3?i.isSearchHomeZI&&f.handoffType==0?c.push(o):h.push(o):f.handoffType==0?c.push(o):h.push(o))}}else continue}if(this.shouldFetchBingSearchHistory(i)&&!n.canShowSearchHomeAIFeed(i)){let n=this.parseASBingSearchHistory(i,r),t=this.dedupeLocalAndMRSASSuggestions(c,n);l=this.filterDismissedSuggestionsForMRSSuggestions(t)}else l=c;if(n.shouldFetchCopilotHistory(i)){let n=(v=this._wsbCopilotViewModel)===null||v===void 0?void 0:v.parseCopilotHistory(i,r);(n===null||n===void 0?void 0:n.length)>0&&l.push(...n)}n.hasCopilotSettingEnabled()&&l.push(...[]);u!="MWS"&&(n.lookupById(i,"MPP",y,b,undefined,null,null,n=>[n.suggestionData.id],"MST",p,k,n=>n.suggestionData.id,e,r,o,s,(n,t,u,f)=>this.parseIdLookupResponse(i,r,n,t,u,f),"MFF",w,d,n=>n.suggestionData.id),n.isDataSourceEnabled("MRS",i)&&o("MRS",l,f));o(u,h,f)}parseIdLookupResponse(t,i,r,u,f,e){let o=r.suggestionData;if((n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockMRUDataFile)&&f.length==0){const t={displayName:o.id,id:o.id,kind:"document",getProperty:null,propertyHits:[],rankScore:1e3};f.push(n.createLocalResponseSuggestionWithDeviceItemImage(t,o.type,u))}if(f.length==1){let s=i=>{if(this.setupRemoveFromHistoryContextMenu(i,r,t),i.lastLaunchTime=r.rankingData.lastLaunchTime,n.config.optimizeRecentRank&&(i.mruRankingData=Object.assign(Object.assign({},r.rankingData),{localSuggestionDistanceScore:0})),o.appContextData&&(i.appContext=o.appContextData.appContext,i.query=o.appContextData.query,i.text=t.queryToFetch?HitHighlightingParser.addMarkers(o.appContextData.textWithoutHH,t.queryToFetch):o.appContextData.textWithoutHH),(n.Host.getIFFPolarisProviderEnabled()||n.Host.getVegaProviderEnabled())&&n.isFileOrFolder(i===null||i===void 0?void 0:i.type)){const n=i===null||i===void 0?void 0:i.deviceItem;n&&(n.matchType=o.matchType)}if(n.Host.getJupiterProviderEnabled()&&(i===null||i===void 0?void 0:i.type)==="CoPST"){let n=i;n.relevance=o.relevance;n.match=o.match;n.previewMetadata=o.previewMetadata;n.deviceItem&&(n.deviceItem.matchType=o.matchType)}return this.setRankingSignals(i,o),!0};n.safeExecute(()=>n.parseLocalSuggestion(t,f[0],u,i,this._temporaryMessageHandler,o.type,e,s),"parseLocalSuggestion "+u)}}shouldFetchBingSearchHistory(t){return n.config.enableSearchHistoryMru&&n.isBingEnabled()&&t.isSearchHomeZI&&((n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())==2||n.config.enableSyncedHistoryLocal&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())==3)?!0:!1}parseASBingSearchHistory(t,i){var r;let f=[],e=n.getHistoryCacheKeyForSelectedAccount();const u=n.LightweightStorage.getItem(e);if(u){(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&n.PSCache&&n.PSCache.changeSearchHistoryCache(u);const{cacheTime:o,response:e}=JSON.parse(u),s=Math.round((new Date).getTime()/1e3)-o>=86400;s||((r=e===null||e===void 0?void 0:e.Suggestions)===null||r===void 0?void 0:r.forEach(r=>{let u=n.safeExecute(()=>this.parseASMRUWebSuggestion(t,r,i),"parseASMRUWebSuggestion");u&&f.push(u)}))}return f}dedupeLocalAndMRSASSuggestions(n,t){let i=n;for(let n of t){let t=-1;t=i.findIndex(t=>t.query===n.query);t!==-1?i[t].lastLaunchTime<n.lastLaunchTime&&(i[t]=n):i.push(n)}return i}filterDismissedSuggestionsForMRSSuggestions(t){let i=this.loadDismissedMruWebSugFromCache(),r=t;if(!n.isNullOrUndefined(i)&&i.length>0&&!n.isNullOrUndefined(i[0]))for(let t of i){let u=-1;if(u=r.findIndex(n=>n.query===t.query),u!=-1)if(r[u].lastLaunchTime<t.lastDismissedTime)r.splice(u,1);else{let r=i.indexOf(t);i.splice(r,1);n.LightweightStorage.setItem(n.config.mruWsDismissCacheKey,JSON.stringify(i))}}return r}loadDismissedMruWebSugFromCache(){let i=[];const t=n.LightweightStorage.getItem(n.config.mruWsDismissCacheKey);return t&&(n.PSManager&&n.PSCache&&n.PSManager.isPSFeatureEnabled(this.dataSource)&&n.PSCache.changeMRUDismissCache(t),i=JSON.parse(t)),i}updateDismissedMruWebSugCache(t){let r=new Date,i=this.loadDismissedMruWebSugFromCache(),u=i.findIndex(n=>n.query===t.query);u!==-1?i[u].lastDismissedTime=Math.round(r.getTime()/1e3):(i.length>=n.config.dismissedMrsCacheSize&&(i.sort((n,t)=>n.lastDismissedTime-t.lastDismissedTime),i.splice(0,1)),i.push({query:t.query,lastDismissedTime:Math.round(r.getTime()/1e3)}));const f=JSON.stringify(i);n.LightweightStorage.setItem(n.config.mruWsDismissCacheKey,f);(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&n.PSCache&&n.PSCache.changeMRUDismissCache(f)}setRankingSignals(n,t){n.hc=t.hc;n.highConfidenceMetaSuggestionScore=t.highConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.prefetchConfidenceScore;n.fromHistory=!0;n.hasMruData=!0}setRankingSignalsForAsSuggestion(n,t){var i;let r=t.Attributes;n.hc=r.hc==="1";n.suggestionLogMeta=r.lm;n.highConfidenceSuggestionScore=+((i=r.hcs)!==null&&i!==void 0?i:0);n.highConfidenceMetaSuggestionScore=t.HighConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.PrefetchConfidenceScore;n.fromHistory=!0}parseMRUWebSuggestion(t,i,r,u,f){var s,h;let o=i.suggestionData,e=null;f?(e=n.createWebSuggestion(t,t.queryToFetch?HitHighlightingParser.addMarkers(o.textWithoutHH,t.queryToFetch):o.textWithoutHH,null,o.icon,o.type,o.query,n.InstrumentedItem.createInstrumentedItem(r,o.type),o.handoffType,r,o.mayContainPII,o.subType,o.additionalInfoText,o.primaryMetadata,o.autoOpenPreviewPaneWhenOnTopHit,o.isAnswer,o.previewPaneType,o.secondaryIcon,o.segments,o.narratorText,0,o.childSuggestionsInJsonString),e.allowedInGroups=e.secondaryIcon?!!e.additionalInfoText:!e.htmlContent,e.childSuggestions&&e.childSuggestions.forEach(i=>{i.parent=e,i.sequenceNumber=e.sequenceNumber,i.instItem=n.InstrumentedItem.createInstrumentedItem(r,i.type),i.getMruData=()=>n.getMruWebSuggestionData(i),i.click=()=>n.Host.launchSearchAsync(e.query,this._navigationHelper.getSearchUrl(t.fullPartialQuery,i.query,i.type,null,e.handoffType,"WSQFLH"),e.useRaf,"WSQFLH")})):e=n.createSuggestion(t,t.queryToFetch?HitHighlightingParser.addMarkers(o.textWithoutHH,t.queryToFetch):o.textWithoutHH,null,o.icon,o.type,o.query,n.InstrumentedItem.createInstrumentedItem(r,o.type),o.handoffType,r,!1);e.lastLaunchTime=i.rankingData.lastLaunchTime;n.config.optimizeRecentRank&&(e.mruRankingData=Object.assign(Object.assign({},i.rankingData),{localSuggestionDistanceScore:0}));e.webUrl=o.webUrl;this.setRankingSignals(e,o);switch(e.handoffType){case 5:case 4:if(!n.isCortanaEnabledCache||e.type=="CSK")return null;let c=o;if(e.primaryMetadata=c.annotation||c.secondaryText,e.reactKey=e.type+e.primaryMetadata,!n.setCat1SuggestionProperties(e,t,r,c.actionUri,c.taskFrame,c.confidence,c.source))return null;break;case 3:case 10:return null;case 0:case 13:case 14:case 21:case 17:if(!(n.isDataSourceEnabled("MRS",t)||n.isDataSourceEnabled("MWS",t)))return null;let a=o;(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())&&u=="MWS"&&(t.isWorkScopeZI||t.isSearchHomeZI)?n.msbHost.qfUtils.setMsbMruSuggestionProperties(e,o):(!t.isSearchHomeZI||t.scope==n.Scope.Web&&n.config.enableZeroInputSearchHomeWeb&&!n.canEnableDsbWebMruInWebScope(t)||(e=this.setTextAndIconForLBSHSuggestion(e,a)),n.setWebSearchSuggestionProperties(e,t,r,a.url,this._navigationHelper,null,!0));e.reactKey=this.generateReactKey(t,e);break;case 1:let f=o,v=i.rankingData;t.queryToFetch.length>3&&(e.autoOpenPreviewPaneWhenOnTopHit=!!v.previewPaneLaunchCount);let l=f.title||f.secondaryText;!n.isSupportWebResultsInAllScopeInDMAEnabled()&&t.isSearchHomeZI&&l?(e.additionalInfoText=f.url,e.text=HitHighlightingParser.removeMarkers(l)):e.primaryMetadata=l;e.reactKey=f.type+f.url;n.setUrlSuggestionProperties(e,t,r,f.url);n.config.directNavPreviewPane&&e.type=="MD"&&e.url&&(e.getIcon=n.getFaviconUrlForRawUrl(e.url,64,64,1.5),t.isSearchHomeZI||(e.previewPaneType=2));n.isSupportWebResultsInAllScopeInDMAEnabled()&&(e.sourceApp=n.Host.getThirdPartySearchAppByName((s=f.sourceAppDisplayName)!==null&&s!==void 0?s:""),e.sourceApp&&e.sourceApp.getLogoAsDataUriAsync?e.getIcon=n.getDmaSuggestionIcon(e.sourceApp):e.icon={type:2,content:"&#xE81C"},t.isSearchHomeZI||(e.previewPaneUrl=(h=f.previewPaneUrl)!==null&&h!==void 0?h:""));break;default:return n.LogWSBError("parseMruWebSuggestion",null,new Error("Unexpected handoff type: "+o.handoffType),undefined,undefined,"WindowsTelemetry"),null}return n.isValidSuggestion(e,"parseMruWebSuggestion")?(this.setupRemoveFromHistoryContextMenu(e,i,t),e):null}parseASMRUWebSuggestion(t,i,r){var e,o;const u=i.Attributes;if(!u.url)return null;let s;s=u.isAnswer==="1"?u.url||u.vertical?n.verticalToHandoffType(u.vertical):10:n.verticalToHandoffType(u.vertical);let f=n.createSuggestion(t,(e=u.query)!==null&&e!==void 0?e:"",undefined,this.getIconForMRUSearchHistorySuggestion(),u.stype,(o=u.query)!==null&&o!==void 0?o:"",n.InstrumentedItem.createInstrumentedItem(r,u.stype),s,r,!1);if(f.lastLaunchTime=Number(u.llt),f.primaryMetadata=i.SecondaryText,this.setRankingSignalsForAsSuggestion(f,i),n.setWebSearchSuggestionProperties(f,t,r,u.url,this._navigationHelper),f.reactKey=this.generateReactKey(t,f),n.isValidSuggestion(f,"parseMruWebSuggestion")){let t=()=>{this.updateDismissedMruWebSugCache(f),n.Host.refreshCurrentPane()};return n.setExtraVerbs(f,()=>{let i={verb:"RemoveFromDeviceHistoryAll",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:()=>{t()},icon:{content:"&#xE711",type:2}};return[i]},!0),f}return null}setTextAndIconForLBSHSuggestion(n,t){return n.text=t.query,n.icon=this.getIconForMRUSearchHistorySuggestion(),n}getIconForMRUSearchHistorySuggestion(){return n.config.enableEdgeIconForWebSuggInSH?{type:0,className:"EdgeIconForWebSugg"}:n.config.networkIconForWebSugg?{type:0,className:"NetworkIcon"}:n.config.networkWithSpyglassIconForWebSugg?{type:0,className:"NetworkWithSpyglassIcon"}:n.config.bingIconForWebSugg?{type:0,className:"BingIcon"}:n.config.disableMruLBSHColorfulIcon?{type:2,content:"&#xE721"}:{type:0,className:n.config.enableLBSHGradientIcon?"LBSHGradientSpyglass":n.config.enableLBSHSolidBlueIcon?"LBSHSolidBlueSpyglass":n.config.mirrorMruLBSHItemIcon?"LBSHSpyglassSV2":"LBSHSpyglass"}}setupRemoveFromHistoryContextMenu(t,i,r){n.RuntimeConfig.QfMode!=5&&n.RuntimeConfig.QfMode!=9&&i.remove&&n.setExtraVerbs(t,u=>{if(u||!i.remove)return[];if(!t.removeIcon&&t.duplicates&&t.duplicates.some(n=>!n.fromHistory))return[];const f=n.config.mruSearchHome&&((r===null||r===void 0?void 0:r.scope)===n.Scope.All||(r===null||r===void 0?void 0:r.scope)===n.Scope.Work);let e={verb:f?"RemoveFromDeviceHistoryAll":"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:()=>{i.remove(()=>{t.handoffType!==2&&this.updateDismissedMruWebSugCache(t),n.Host.refreshCurrentPane(),f||this._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemovedFromDeviceHistory",HitHighlightingParser.removeMarkers(t.text)))}),delete i.remove},icon:{content:"&#xE711",type:2}};return[e]},!0)}generateReactKey(t,i){var r;return(t===null||t===void 0?void 0:t.isSearchHomeZI)?n.config.enableFromYourHistory?`${i.type}${"MRS"}${i.text}`:`${"MRS"}${i.text}`:n.config.enableMruProviderInQF?i.type+((r=i.childSuggestions)===null||r===void 0?void 0:r.some)+i.query:i.type+t.fullPartialQuery}}n.MRUParser=i}(WSB||(WSB={})),function(n){var t;(function(t){var i;(function(i){const f=30,e=3,o=8,s=2,h=4,c=n.config.mruImprovement3?50:15,l="LastUpdated",u="MRUNoItemsAvailable";class r extends t.ClientSideStorage.StorageBasedDataProvider{static getMRUInstrumentationStringMap(){return r._instrumentedStrings}getName(){return this.dataSource==="MWS"?"MRUWorkSearchDataProvider":"MRUDataProvider"}constructor(i,r,u,f,e,o,s,h,c,a){i&&(i.bindItemLaunch((n,t,i)=>this.storeSuggestionToMRU(n,t,i)),i.bindConversationEnds((n,t,i)=>this.storeSuggestionToMRU(n,t,i)));let v,y=(t,i,u)=>r(o,i=>{t(i);let r=n.getTimeDiffInDays(v);(r===null||r>=1)&&(v=n.getCurrentDate(),this.prune());this.getStorage(n=>this.instrumentMRUSize(n),()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite())},i,u,l),p=(t,i,r)=>(n.MockUrlParameters&&!n.MockUrlParameters.mockMRUDataOff&&(i=this.dataSource==="MWS"?n.MockedMSBMRUData:n.MockedMRUData),this.dataSource!=="MWS"||(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())||(i=[]),n.safeExecute(()=>this.createMruResponse(t,i,r),"createMruResponse")),w=()=>!0,b=n=>n=="R"?undefined:n;n.Host.bindClearMRURequested(async i=>{this.teardownStorage(),t.ClientSideStorage.deleteDatabase(o,()=>i(!0),()=>i(!1)),(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&await n.PSManager.clearMRUAtButtonClickedAsync("ClearRequested")},o);super(y,p,w,b,c);this.dataSource=c;this.dmaWebRecentsType=[0,13,14,16,15];n.config.enableMruProviderInQF&&(this._mruInMemoryCache=a);this.candidatesEnabled=s;this.loggingEnabled=h;this.getSuggestionKey=u;this.getGroupType=f;this.isMRUHistoryGroupType=e;this._pendingWrites=[];sj_evt.bind("clearMRUButtonClicked",async()=>{t.ClientSideStorage.deleteDatabase(o),this.reloadStorage(),(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&await n.PSManager.clearMRUAtButtonClickedAsync("ButtonClicked")});(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&(n.Host.bindBootstrapDone(async()=>{(n.config.backfillActionCode==1||n.config.backfillActionCode==11||n.config.backfillActionCode==21)&&await n.PSManager.checkAndBackfillMRUAtBootstrapAsync("BootstrapDone")}),n.Host.bindShown(async()=>{(n.config.backfillActionCode==10||n.config.backfillActionCode==11||n.config.backfillActionCode==12)&&await n.PSManager.checkAndBackfillMRUAtBootstrapAsync(""),n.config.backupActionCode==10&&n.PSManager.checkAndBackupMRUAtDismiss("Shown")}),n.Host.bindDismissed(async()=>{(n.config.backfillActionCode==20||n.config.backfillActionCode==21||n.config.backfillActionCode==22)&&await n.PSManager.checkAndBackfillMRUAtBootstrapAsync("Dismiss"),n.config.backupActionCode==20&&n.PSManager.checkAndBackupMRUAtDismiss("Dismiss")}))}createMruResponse(t,i,r){var l,a,v,y,p;t&&t.isSearchHomeZI&&(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&n.PSCache&&(i&&(i=i.filter(t=>t.key!=n.PSManager.MRUBackfillSignalKey)),n.PSCache.setMRUDbEntries(i));i=i||[];let f=this.getKey(t);this._lastKey=r?f:null;let w=r?i.find(n=>n.key==f):null;this._valueForLastKey=w?w.value:null;let u={};if(this._valueForLastKey&&(u.SuggestionEngagementData=this._valueForLastKey.SuggestionEngagementData),u.LookupCompletions=i.map(n=>({key:n.key,value:n.value.SuggestionEngagementData})),this.candidatesEnabled()){let r=[],v=this.getOldestDateToKeep();for(let{key:t,value:n}of i)if(n.Suggestions)for(let i of n.Suggestions){let u=this.getRankingData(n,i);u&&u.lastLaunchTime&&u.lastLaunchTime>=v&&r.push({rankingData:t==this._lastKey?{prefixLaunchCount:u.prefixLaunchCount,lastLaunchTime:u.lastLaunchTime,previewPaneLaunchCount:u.previewPaneLaunchCount,lastPreviewPaneLaunchTime:u.lastPreviewPaneLaunchTime}:u,suggestionData:i,remove:n=>this.remove(t,i,n)})}if(r.length>0){if(u.Suggestions=[],r.sort((n,t)=>t.rankingData.lastLaunchTime-n.rankingData.lastLaunchTime),r.forEach(n=>this.addToResponseIfNotPresent(u.Suggestions,n)),n.config.enableMruProviderInQF&&this._mruInMemoryCache&&!(t===null||t===void 0?void 0:t.isSearchHomeZI)&&this._mruInMemoryCache.getSize()==0&&u.Suggestions&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())===3)for(const t of(l=u.Suggestions)===null||l===void 0?void 0:l.values())if(this._mruInMemoryCache.getSize()<n.config.mruInMemoryCacheSize&&((a=t===null||t===void 0?void 0:t.suggestionData)===null||a===void 0?void 0:a.handoffType)==0){let i=t===null||t===void 0?void 0:t.suggestionData;i&&this._mruInMemoryCache.add(i.query,t,n.config.useLaunchCount,n.config.useLaunchTime)}f?f.length<=e?u.Suggestions.splice(s):f.length<=o&&u.Suggestions.splice(h):n.config.enableMRUDSBV2&&n.shouldShowDSBFullWidth()?u.Suggestions.splice(n.config.maxMruDSBV2):u.Suggestions.splice(c)}}if(n.config.enableMruProviderInQF&&((v=this._mruInMemoryCache)===null||v===void 0?void 0:v.getSize())>0&&!(t===null||t===void 0?void 0:t.isSearchHomeZI)&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())===3){u.Suggestions||(u.Suggestions=[]);let r=(y=u.Suggestions)===null||y===void 0?void 0:y.filter(n=>{var t;return((t=n===null||n===void 0?void 0:n.suggestionData)===null||t===void 0?void 0:t.handoffType)!=0});u.Suggestions=r;let i=(p=this._mruInMemoryCache)===null||p===void 0?void 0:p.search(t===null||t===void 0?void 0:t.queryToFetch,n.config.useLaunchCount,n.config.useLaunchTime,n.config.useRankerRankScore);i&&i.forEach(n=>u.Suggestions.push(n))}return u}fetch(t,i,r,u,f){if(n.isDataSourceEnabled(this.dataSource,t))return super.fetch(t,i,r,u,f)}static removeRankerSignals(n,t){return n=="highConfidenceMetaSuggestionScore"||n=="prefetchConfidenceScore"?undefined:t}addToResponseIfNotPresent(n,t){let i=n.find(n=>n.suggestionData.suggestionKey==t.suggestionData.suggestionKey);if(i){let n=i.remove;i.remove=i=>n(()=>t.remove(i));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)}else n.push(t)}addToDataIfNotPresent(t,i){if(n.config.enableMruProviderInQF){let n=t.find(n=>this.areEqual(n,i));n||t.push(i)}else{let n=JSON.stringify(i,r.removeRankerSignals),u=t.find(t=>JSON.stringify(t,r.removeRankerSignals)==n);u||t.push(i)}}areEqual(n,t){return n.handoffType==t.handoffType&&n.hc==t.hc&&n.suggestionKey==t.suggestionKey&&n.type==t.type&&(n===null||n===void 0?void 0:n.additionalInfoText)==(t===null||t===void 0?void 0:t.additionalInfoText)&&(n===null||n===void 0?void 0:n.isAnswer)==(t===null||t===void 0?void 0:t.isAnswer)&&(n===null||n===void 0?void 0:n.narratorText)==(t===null||t===void 0?void 0:t.narratorText)&&(n===null||n===void 0?void 0:n.query)==(t===null||t===void 0?void 0:t.query)&&(n===null||n===void 0?void 0:n.segments)==(t===null||t===void 0?void 0:t.segments)&&(n===null||n===void 0?void 0:n.primaryMetadata)==(t===null||t===void 0?void 0:t.primaryMetadata)}isSuggestionGroupTypeSupported(t){return this.dataSource==="MWS"?(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())?n.isWorkScopeMruGroupType(t):!1:!n.isWorkScopeMruGroupType(t)}storeSuggestionToMRU(t,i,r){if(this.isSuggestionGroupTypeSupported(t)&&this.loggingEnabled()&&(!n.isZeroInputRecentsDisabledByRegionalPolicy()||!this.dmaWebRecentsType.includes(t.handoffType))){if(this._writing){this._pendingWrites.push(()=>this.storeSuggestionToMRU(t,i,r));return}this._writing=!0;let u=this.getKey(i,t===null||t===void 0?void 0:t.staticGroupType);this._lastKey==u?this.updateAndSaveLaunchData(u,this._valueForLastKey,t,r):this.queryStorage(u,n=>this.updateAndSaveLaunchData(u,n,t,r),()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite())}}remove(n,t,i){if(this._writing){this._pendingWrites.push(()=>this.remove(n,t,i));return}this._writing=!0;this._lastKey==n?this.removeAndSaveLaunchData(n,this._valueForLastKey,t,i):this.queryStorage(n,r=>this.removeAndSaveLaunchData(n,r,t,i),()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite())}createOrUpdateDbEntry(i,r,f,e){r?(r.LastUpdated=t.ClientSideStorage.StorageBasedDataProvider.getUnixTime(),r.SuggestionEngagementData=r.SuggestionEngagementData||{}):r={LastUpdated:t.ClientSideStorage.StorageBasedDataProvider.getUnixTime(),SuggestionEngagementData:{}};let o=this.getSuggestionKey(f);if(r.SuggestionEngagementData[o]=this.updateMRUEntryClicksAndTime(r.SuggestionEngagementData[o],r.LastUpdated,e),this.getGroupType&&(r.SuggestionEngagementData[o].groupType=this.getGroupType(f)),n.LightweightStorage.getItem(u)=="1"&&this.isMRUHistoryGroupType&&this.isMRUHistoryGroupType(f)&&n.LightweightStorage.removeItem(u),this.candidatesEnabled()){let t=f.getMruData();if(t&&i&&(r.Suggestions||(r.Suggestions=[]),this.addToDataIfNotPresent(r.Suggestions,t),n.config.enableMruProviderInQF&&this._mruInMemoryCache)){let i=t;if(i&&(i===null||i===void 0?void 0:i.handoffType)==0){let u={suggestionData:t,rankingData:r.SuggestionEngagementData[o],remove:()=>{}};this._mruInMemoryCache.add(i.query,u,n.config.useLaunchCount,n.config.useLaunchTime)}}}return r}updateMRUEntryClicksAndTime(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}getOldestDateToKeep(){let i=n.getCurrentDate();return i.setDate(i.getDate()-f),t.ClientSideStorage.StorageBasedDataProvider.getUnixTime(i)}updateAndSaveLaunchData(t,i,r,u){if(i=n.safeExecute(()=>this.createOrUpdateDbEntry(t,i,r,u),"createOrUpdateDbEntry"),!i){this.onAfterWrite();return}n.safeExecute(()=>this.removeOldLaunches(i,this.getOldestDateToKeep()),"removeOldLaunches");this._lastKey=t;this._valueForLastKey=i;(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&n.PSCache&&n.PSCache.changeMRUDbEntries(t,i);this.withStorage(n=>n.put(t,i,()=>this.onAfterWrite(),n=>{this.onError(n,"updateAndSaveLaunchData");this.onAfterWrite()}))||this.onAfterWrite()}removeAndSaveLaunchData(t,i,r,u){if(!i){n.LogWSBError("removeAndSaveLaunchData",null,new Error("MRU entry not present"),undefined,undefined,"WindowsTelemetry");this.onAfterWrite();return}let f=-1;if(n.config.enableMruProviderInQF)f=(i.Suggestions||[]).findIndex(n=>this.areEqual(n,r));else{let n=JSON.stringify(r);f=(i.Suggestions||[]).findIndex(t=>JSON.stringify(t)==n)}if(f==-1){n.LogWSBError("removeAndSaveLaunchData",null,new Error("Suggestion not present in MRU"),undefined,undefined,"WindowsTelemetry");this.onAfterWrite();return}i.Suggestions.splice(f,1);this._lastKey=t;this._valueForLastKey=i;(n.PSManager===null||n.PSManager===void 0?void 0:n.PSManager.isPSFeatureEnabled(this.dataSource))&&n.PSCache&&n.PSCache.changeMRUDbEntries(t,i);this.withStorage(f=>f.put(t,i,()=>{if(u&&u(),n.config.enableMruProviderInQF&&this._mruInMemoryCache){let t=r;t&&(t===null||t===void 0?void 0:t.handoffType)==0&&this._mruInMemoryCache.remove(t===null||t===void 0?void 0:t.query,n.config.useLaunchCount,n.config.useLaunchTime)}this.onAfterWrite()},n=>{this.onError(n,"removeAndSaveLaunchData");this.onAfterWrite()}))||this.onAfterWrite()}getRankingData(n,t){return n.SuggestionEngagementData?n.SuggestionEngagementData[t.suggestionKey]:undefined}removeOldLaunches(n,t){if(n.Suggestions)for(let i=n.Suggestions.length-1;i>=0;--i){let 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)}removeOldEngagementData(n,t){if(n)for(let i in n){let r=n[i];if(r){let u=r.lastLaunchTime;(!u||u<t)&&delete n[i]}}}prune(n){if(this._writing){this._pendingWrites.push(()=>this.prune(n));return}this._writing=!0;this.withStorage(t=>t.removeRangeOnSecondaryKey(0,this.getOldestDateToKeep(),()=>{n&&n(),this.onAfterWrite()},n=>{this.onError(n,"MRUDataProvider prune");this.onAfterWrite()}))||this.onAfterWrite()}instrumentMRUSize(t){let i=0;for(let{value:n}of t)n.Suggestions&&(i+=n.Suggestions.length);let r={totalnumberOfEntries:t.length.toString(),totalNumberOfSuggestions:i.toString()};n.InstrumentationHelper.logClientInstEvent("ClientInst","MRUSize",null,r,"WindowsTelemetry",33554432)}}r._instrumentedStrings={};i.MRUDataProvider=r;n.MRU=n.Old.MRU})(i=t.MRU||(t.MRU={}))})(t=n.Old||(n.Old={}))}(WSB||(WSB={})),function(n){var t;(function(t){function d(t,i){if(!i)throw new Error("Undefined query IQuery for data source: "+t);u||ht();let r=u[t];if(!r)throw new Error("Unsupported data source: "+t);if(n.config.indexerQuerySimplified&&t=="IFF"&&(i===null||i===void 0?void 0:i.queryToFetch.length)<=8)return r[4];let f=r.filter(n=>!n.enabled||n.enabled(i));if(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 tu(n){return u||ht(),!!u[n]}function iu(n,t,i){if(!u||!u[i]||t.taskFrame)return!1;let r=d(i,t);return r.sfgaoFilter?!r.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function i(n,t){return n=rr.concat(n),t&&(n=n.concat(ur)),n}function ht(){a=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getUserSID();let t=0,[f,e]=ki(t,a,!1),[o,s]=ki(t,a,!0);ft=f;ci=e;u={};n.config.win10FastFileProviderSqlOptimizations?uu(a,u):ru(f,o,e,s,u);let h='"System.Kind" != ANY ARRAY'+fr+" AND "+o;u.MFF=[{selectFields:i(c,!1),filterFieldsSets:[nu],mostRelevantProps:null,kindAndScopeClauses:null,sortClause:null,searchOptions:0,sfgaoFilter:null}];u[yt]=[{selectFields:i(c,!0),filterFieldsSets:[],mostRelevantProps:null,kindAndScopeClauses:h,sortClause:r,searchOptions:0,sfgaoFilter:s}];fu(a,u)}function ru(t,u,f,e,o){let v='"System.Kind" != ANY ARRAY['+ot.concat("link").map(n=>"'"+n+"'").join(", ")+"] AND "+t,tt="\"System.Kind\" = SOME ARRAY['program'] AND "+u,s='"System.Kind" != ANY ARRAY['+ai.map(n=>"'"+n+"'").join(", ")+"] AND "+u,a='"System.Kind" != ANY ARRAY['+li.concat(ot).concat("folder").map(n=>"'"+n+"'").join(", ")+"] AND "+u,ft="\"System.Kind\" = SOME ARRAY['folder'] AND "+u,p="\"System.Kind\" = SOME ARRAY['Music'] AND "+u,w="\"System.Kind\" = SOME ARRAY['Picture'] AND "+u,d='"System.Kind" = SOME ARRAY['+et.map(n=>"'"+n+"'").join(", ")+"] AND "+u,st="\"System.Kind\" != ANY ARRAY['game', 'calendar', 'web history', 'feed', 'contact', 'task', 'journal', 'note', 'instantmessage'] AND "+u;o.IFF=[{selectFields:i(c,!1),filterFieldsSets:[ri],mostRelevantProps:b,kindAndScopeClauses:v,sortClause:n.config.enableIndexerQueryExtensionSort?g(y):r,searchOptions:3,sfgaoFilter:f,enabled:t=>!!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)},{selectFields:i(c,!1),filterFieldsSets:[],mostRelevantProps:b,kindAndScopeClauses:v,sortClause:n.config.enableIndexerQueryExtensionSort?g(y):r,searchOptions:0,sfgaoFilter:f,enabled:t=>!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)},{selectFields:i(it,!0),filterFieldsSets:[lr],mostRelevantProps:b,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?g(y):r,searchOptions:3,sfgaoFilter:e,enabled:t=>!!(t===null||t===void 0?void 0:t.queryToFetch)&&n.supportsShortcuts("IFF",t)},{selectFields:i(it,!0),filterFieldsSets:[],mostRelevantProps:b,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?g(y):r,searchOptions:0,sfgaoFilter:e,enabled:t=>t&&!t.queryToFetch&&n.supportsShortcuts("IFF",t)},{selectFields:i(c,!0),filterFieldsSets:[ar],mostRelevantProps:b.concat(["System.Title"]),kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?g(y):r,searchOptions:0,sfgaoFilter:e,enabled:t=>n.config.indexerQuerySimplified&&(t===null||t===void 0?void 0:t.queryToFetch.length)<=8&&!!(t===null||t===void 0?void 0:t.queryToFetch)}];o.MDOC=[{selectFields:i(h,!0),filterFieldsSets:[fi.concat(pr)],mostRelevantProps:nt,kindAndScopeClauses:a,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:t=>(t===null||t===void 0?void 0:t.queryToFetch)&&n.config.minLengthForContentMatch&&(t===null||t===void 0?void 0:t.queryToFetch.length)>=n.config.minLengthForContentMatch},{selectFields:i(h,!0),filterFieldsSets:[fi],mostRelevantProps:nt,kindAndScopeClauses:a,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:t=>(t===null||t===void 0?void 0:t.queryToFetch)&&(!n.config.minLengthForContentMatch||(t===null||t===void 0?void 0:t.queryToFetch.length)<n.config.minLengthForContentMatch)},{selectFields:i(h,!0),filterFieldsSets:[],mostRelevantProps:nt,kindAndScopeClauses:a,sortClause:r,searchOptions:0,sfgaoFilter:e,enabled:n=>n&&!n.queryToFetch},];o.MPVD=[{selectFields:i(h.concat(l).concat(n.config.myStuffPhotoVideoStrategyFix?k:l),!0),filterFieldsSets:[rt],mostRelevantProps:nt,kindAndScopeClauses:st,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)}];o.MFOL=[{selectFields:i(ei,!0),filterFieldsSets:[br],mostRelevantProps:wr,kindAndScopeClauses:ft,sortClause:r,searchOptions:3,sfgaoFilter:e}];o.MPHO=[{selectFields:i(k,!0),filterFieldsSets:[kr],mostRelevantProps:oi,kindAndScopeClauses:w,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(k,!0),filterFieldsSets:[],mostRelevantProps:oi,kindAndScopeClauses:w,sortClause:r,searchOptions:0,sfgaoFilter:e,enabled:n=>n&&!n.queryToFetch},];o.MVID=[{selectFields:i(l,!0),filterFieldsSets:[dr],mostRelevantProps:si,kindAndScopeClauses:d,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(l,!0),filterFieldsSets:[],mostRelevantProps:si,kindAndScopeClauses:d,sortClause:r,searchOptions:0,sfgaoFilter:e,enabled:n=>n&&!n.queryToFetch},];o.MMUS=[{selectFields:i(ut,!0),filterFieldsSets:[gr],mostRelevantProps:hi,kindAndScopeClauses:p,sortClause:r,searchOptions:3,sfgaoFilter:e,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(ut,!0),filterFieldsSets:[],mostRelevantProps:hi,kindAndScopeClauses:p,sortClause:r,searchOptions:0,sfgaoFilter:e,enabled:n=>n&&!n.queryToFetch},];o.IBA=[{selectFields:i(ui,!0),filterFieldsSets:[yr],mostRelevantProps:vr,kindAndScopeClauses:tt,sortClause:r,searchOptions:3,sfgaoFilter:e}]}function uu(n,t){let r=ef(n);t.IFF=[{selectFields:i(it,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MDOC=[{selectFields:i(h,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:ii+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MPVD=[{selectFields:i(h,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:ii+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MFOL=[{selectFields:i(ei,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:er+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MPHO=[{selectFields:i(k,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:sr+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MVID=[{selectFields:i(l,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:hr+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.MMUS=[{selectFields:i(ut,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:or+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}];t.IBA=[{selectFields:i(ui,!0),filterFieldsSets:[o],mostRelevantProps:e,kindAndScopeClauses:cr+" AND "+r,sortClause:s,searchOptions:3,sfgaoFilter:null}]}function fu(t,r){let u=cu(t);r.ANA=[{selectFields:i(w,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:u,sortClause:p,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&!n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==0},{selectFields:i(w,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:p,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==1},{selectFields:i(w,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:p,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==2},{selectFields:i(w,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:p,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==3},{selectFields:i(w,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:p,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==4},]}function eu(n,t,i,r,u){var f;return bu((f=n===null||n===void 0?void 0:n.queryToFetch)!==null&&f!==void 0?f:"").then(f=>yi(n,f,t,i,r,u))}function ou(n,t,i,r){let u=d(t,n),f="SELECT TOP "+i.length+" "+lt(u.selectFields)+" FROM SystemIndex WHERE "+yu(u,i,r),e=pi(r);return e!=""&&(f+=" AND "+e),f}function su(){let n=d(yt,null),t="WorkId, "+lt(n.selectFields),i=n.kindAndScopeClauses;return"SELECT "+t+" FROM SystemIndex WHERE "+i+" ORDER BY "+n.sortClause}function hu(n,t){u&&u[n]&&u[n][t]&&(u[n][t].kindAndScopeClauses=lu(a,t))}function cu(t){let i=(n.AnaheimDataProvider===null||n.AnaheimDataProvider===void 0?void 0:n.AnaheimDataProvider.getExpirationThreshold())?n.AnaheimDataProvider===null||n.AnaheimDataProvider===void 0?void 0:n.AnaheimDataProvider.getExpirationThreshold():14,r='"System.DateCreated" > DATEADD(day, -'+i+", GETGMTDATE())",u="(SCOPE = 'winrt://{"+t+"}/LS/Desktop/Microsoft Edge/Canary/Profiles/' OR SCOPE = 'winrt://{"+t+"}/LS/Desktop/Microsoft Edge/Dev/Profiles/' OR SCOPE = 'winrt://{"+t+"}/LS/Desktop/Microsoft Edge/Beta/Profiles/' OR SCOPE = 'winrt://{"+t+"}/LS/Desktop/Microsoft Edge/Stable/Profiles/' OR SCOPE = 'winrt://{"+t+"}/LS/Desktop/Microsoft Edge/undefined/Profiles/')";return r+" AND "+u}function vi(t,i,r,u){let f="";return f+='"System.Link.TargetUrl" IS NOT NULL AND "System.Title" IS NOT NULL AND ',f+='"System.DateCreated" > DATEADD(day, -'+(n.AnaheimDataProvider===null||n.AnaheimDataProvider===void 0?void 0:n.AnaheimDataProvider.getExpirationThreshold())+", GETGMTDATE()) AND (",f+=ct(t,i,r,u),f+")"}function ct(n,t,i,r){let u="";for(let f=0;f<i.length;f++){if(u+="SCOPE = 'winrt://{"+n+"}/LS/Desktop/Microsoft Edge/"+i[f].displayName+"/"+r.displayName+"/"+t+"/'",f==i.length-1)break;u+=" OR "}return u}function lu(t,i){let r=n.AnaheimDataProvider===null||n.AnaheimDataProvider===void 0?void 0:n.AnaheimDataProvider.getAvailableChannels(),u=n.AnaheimDataProvider===null||n.AnaheimDataProvider===void 0?void 0:n.AnaheimDataProvider.getSelectedProfile();if(r&&u)switch(i){case 1:return vi(t,"History",r,u);case 2:return ct(t,"QuickLinks",r,u);case 3:return vi(t,"RecentlyClosed",r,u);case 4:return ct(t,"Favorites",r,u)}return""}function yi(n,t,i,r,u,f){var s,h;let c=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getLCIDStringForText((s=n===null||n===void 0?void 0:n.queryToFetch)!==null&&s!==void 0?s:""),e=n.taskFrame?uf(u,n.taskFrame.parsed,c):d(u,n),o="SELECT TOP "+r+" "+lt(e.selectFields)+" FROM SystemIndex",l=pu(e,(h=n===null||n===void 0?void 0:n.queryToFetch)!==null&&h!==void 0?h:"",t,i,e.searchOptions,c,f);if(l!=""){o=o+" WHERE "+l;let n=pi(f);n!=""&&(o+=" AND "+n)}return o+=" ORDER BY "+e.sortClause}function au(n){if(n.kind=="link"||n.kind=="program"){let i=n.getProperty("System.Kind");for(var t=0;t<i.length;t++){let r=i[t];if(r=="program")return vu(n,r);if(r!="link"){let t={displayName:n.displayName,id:n.id,kind:r,getProperty:t=>n.getProperty(t),propertyHits:n.propertyHits,rankScore:n.rankScore,getImageAsync:t=>n.getImageAsync(t),getIconAsync:t=>n.getIconAsync(t),imageType:n.imageType,canHaveContextMenu:n.canHaveContextMenu,getVerbsAsync:()=>n.getVerbsAsync(),getItemStorageStateAsync:()=>n.getItemStorageStateAsync(),extension:n.extension,itemTypeDisplayName:n.itemTypeDisplayName,createdDate:n.createdDate,lastModifiedDate:n.lastModifiedDate,matchType:n.matchType};return t.originalDeviceItem=n,t}}}return n}function vu(t,i){let r=t.displayName;r.toLocaleLowerCase().endsWith(".lnk")&&(r=r.substr(0,r.length-4));let u=n.indexerFilePathToRegularPath(t.id),f={displayName:r,id:u,kind:i,getProperty:n=>t.getProperty(n),propertyHits:t.propertyHits,rankScore:t.rankScore,getImageAsync:n=>t.getImageAsync(n),getIconAsync:n=>t.getIconAsync(n),imageType:t.imageType,canHaveContextMenu:t.canHaveContextMenu,getVerbsAsync:()=>t.getVerbsAsync(),getItemStorageStateAsync:()=>t.getItemStorageStateAsync(),extension:t.extension,itemTypeDisplayName:t.itemTypeDisplayName,createdDate:t.createdDate,lastModifiedDate:t.lastModifiedDate,matchType:t.matchType,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};return f.originalDeviceItem=t,f}function lt(n){return n.map(n=>n=="System.ParsingPath"?"path":`"${n}"`).join(",")}function pi(t){return n.config.useWhereId&&t?"ReuseWhere("+t+") ":""}function yu(n,t){return"("+ku(n,t)+")"}function pu(n,t,i,r,u,e){let o="";n.mostRelevantProps.length>0&&(o+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps ");let s=du(n,t,i,u,e);s&&(o+="("+s+") AND ");let h=r?f(r):r;return h&&(o+="(Scope = '"+h+"') AND "),o+n.kindAndScopeClauses}function wu(n,t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.tokenize(n,t)}function bu(n){return SearchAppWrapper.CortanaApp.queryFormulationView.getLinguisticDataAsync(n)}function at(t,i,r){let u="",f=t.filterFieldsSets.length>1;return t.filterFieldsSets.forEach(t=>{f&&(u?u+=") AND (":u="(");let e=!0;for(let f of t){let t=!1;for(let o of i)e?(u+="(",e=!1):u+=t?" OR ":" OR (",u+=n.config.win10FastFileProviderSqlOptimizations?n.formatString(f,[o,r]):n.formatString(f,[o]),t=!0;t&&(u+=")")}}),f&&(u+=")"),u}function ku(t,i){let r=[];return r=n.config.disableMRUFilesAndFoldersWildCards?i.map(n=>f(n)):i.map(n=>vt(n)),at(t,r)}function du(t,i,r,u,f){let s=[i];(r===null||r===void 0?void 0:r.alternatives)&&r.alternatives.forEach(n=>s.push(n));let e=s.map(n=>vt(n)),o=n.config.win10FastFileProviderSqlOptimizations?at(t,e,f):at(t,e);return(u&2)==2&&(o=gu(u,r,e,o,f)),o}function gu(t,i,r,u,f){let o=nf(t),e=!1;for(let s of o){let o=!1;for(let h of r){let c=[],r=wu(h,i.language);if(e&&n.config.indexerQueryMWLimit){if((t&4)==0||r.length<=n.config.indexerQueryMWLimit)for(let t=0;t<Math.min(r.length,n.config.indexerQueryMWLimit);++t)c.push(r[t])}else if((t&4)==0||r.length<=ti)for(let n=0;n<Math.min(r.length,ti);++n)c.push(r[n]);if(c.length>1){let t="";for(let n of c)t&&(t+=" AND "),t+='"'+n+(e?'*"':'"');u?u+=o?" OR ":" OR (":u="(";u+=n.formatString(s,[t,f]);o=!0}}o&&(u+=")");e=!e}return u}function nf(n){let 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 wi(t,i){return t.length>0&&(t=t.replace(/'/g,"''"),t=t.replace(/"/g," "),i>=2&&(n.config.sqlEscFix&&(t=t.replace(/\[/g,"[[]")),t=t.replace(/%/g,"[%]"),t=t.replace(/_/g,"[_]"),n.config.sqlEscFix||(t=t.replace(/\[/g,"[[]")),i==3?(t=t.replace(/\*/g,"%"),t=t.replace(/\?/g,"_")):(t=t.replace(/\*/g," "),t=t.replace(/\?/g," ")))),t}function f(n){return wi(n,1)}function vt(n){return wi(n,2)}function tf(n){let t=tt[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function v(n,t,i,...r){typeof i=="string"?(i=vt(i),t.push(r.map(t=>`CONTAINS(${t},'"${i}*"',${n}) RANK BY COERCION(ABSOLUTE, 1000)`))):i&&i.Value&&v(n,t,i.Value,...r)}function uf(n,t,i){let f=[],e='"System.Kind" != ANY ARRAY['+st+"]";if(t.FileType&&t.FileType.Value){let n=t.FileType.Value;switch(n){case"Document":break;case"Picture":e="\"System.Kind\" = SOME ARRAY['Picture']";break;case"Video":e='"System.Kind" = SOME ARRAY['+et.map(n=>"'"+n+"'").join(", ")+"]";break;case"Powerpoint":case"Word":case"Excel":e="CONTAINS(System.ItemType,'\""+rf[n]+"*\"',"+i+') RANK BY COERCION(ABSOLUTE, 1000) AND "System.Kind" != ANY ARRAY['+st+"]";break;default:e='"System.Kind" != ANY ARRAY['+st+"]";v(i,f,n,"System.ItemType","System.ItemTypeText")}}v(i,f,t.Title,"System.ItemNameDisplay","System.Title");v(i,f,t.Body,"System.ItemNameDisplay","System.Title","System.FileDescription","System.Keywords","System.Search.Contents");t.People&&t.People.forEach(n=>{let t=n.Value;t&&v(i,f,t=="me"?SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.userName:t,"System.Author","System.FileOwner","System.Document.LastAuthor","System.Photo.TagViewAggregate")});v(i,f,t.Place,"System.Photo.TagViewAggregate");let u=ff(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]+"'",]);return{selectFields:tf(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+ft:ft,mostRelevantProps:[],searchOptions:0,sortClause:r,sfgaoFilter:ci}}function ff(t){if(!t)return null;let i=t.value;if(!i)return null;let f=i.indexOf("T");f!=-1&&(i=i.substr(0,f));let u=i.split("-");if(u.length<2||u.length>3)return null;let e=new Date(i);if(!n.isValidDate(e))return null;let r=new Date(i);return u.length==3?r.setUTCDate(r.getUTCDate()+1):r.setUTCMonth(r.getUTCMonth()+1),[bi(e),bi(r)]}function bi(n){let t=n.toISOString();return t.substr(0,t.indexOf("T"))}function ki(t,i,r){let u,e;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?e=n=>!(n&gi)&&!(n&di)&&(!!(n&&nr)||n&&ir&&!!(n&&ni)||n&&tr&&!!(n&&ni)):(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'";let o=f(n.getKnownFolderPathLC(n.FOLDERID_Profile));switch(t){case 0:let e=f(n.getKnownFolderPathLC(bt));u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}') AND (Scope <> 'file:"+o+"\\AppData') AND (Scope <> 'file:"+e+"\\Default\\AppData') AND (Scope <> 'file:"+e+"\\Administrator\\AppData')";let s=f(n.getKnownFolderPathLC(pt)),h=f(n.getKnownFolderPathLC(wt));u+=" AND (Scope <> 'file:"+s+"')";h!=s&&(u+=" AND (Scope <> 'file:"+h+"')");let c=f(n.getKnownFolderPathLC(kt));u+=" AND (Scope <> 'file:"+c+"')";let l=f(n.getKnownFolderPathLC(dt));if(u+=" AND (Scope <> 'file:"+l+"')",r){let t=f(n.getKnownFolderPathLC(gt));u+=" AND (Scope <> 'file:"+t+"')"}break;case 1:u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}')";break;default:throw new Error("Unknown SearchScope: "+t);}return[u,e]}function ef(t){let i="",o=f(n.getKnownFolderPathLC(n.FOLDERID_Profile)),r=f(n.getKnownFolderPathLC(bt));i+="(Scope = 'file://' OR Scope = 'csc://{"+t+"}') AND (Scope <> 'file:"+o+"\\AppData') AND (Scope <> 'file:"+r+"\\Default\\AppData') AND (Scope <> 'file:"+r+"\\Administrator\\AppData')";let u=f(n.getKnownFolderPathLC(pt)),e=f(n.getKnownFolderPathLC(wt));i+=" AND (Scope <> 'file:"+u+"')";e!=u&&(i+=" AND (Scope <> 'file:"+e+"')");let s=f(n.getKnownFolderPathLC(kt));i+=" AND (Scope <> 'file:"+s+"')";let h=f(n.getKnownFolderPathLC(dt));i+=" AND (Scope <> 'file:"+h+"')";let c=f(n.getKnownFolderPathLC(gt));return i+(" AND (Scope <> 'file:"+c+"')")}function g(n){let t="CASE ",i=1;for(let r of n)t+="WHEN 'System.FileExtension' = "+r+" THEN "+i.toString()+" ",i+=1;return t+="ELSE 999 END ASC, "+r}const yt="PRIME",pt="{905e63b6-c1bf-494e-b29c-65b732d3d21a}",wt="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}",bt="{0762D272-C50A-4BB0-A382-697DCD729B80}",kt="{A4115719-D62E-491D-AA7C-E74B8BE3B067}",dt="{0482af6c-08f1-4c34-8c90-e17ec98b1e17}",gt="{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}",di=4096,gi=524288,nr=4194304,ni=536870912,tr=8388608,ir=268435456,ti=3,r='"System.Search.Rank" DESC, "System.DateModified" DESC, "System.ItemNameDisplay" ASC',y=['".exe"','".xlsx"','".lnk"','".docx"','".xls"','".doc"','".bat"','".pptx"','".pdf"','".txt"',],rr=["System.Kind","System.Search.Rank","System.ParsingPath","System.DateCreated","System.DateModified","System.Search.QueryPropertyHits","System.ItemNameDisplay","System.FileExtension","System.ItemType",],ur=["System.Link.TargetParsingPath","System.SFGAOFlags",],e=["System.ItemNameDisplay",],o=["(CONTAINS(#MRProps, '\"{0}\"', {1}) RANK BY COERCION(ABSOLUTE, 990))","(CONTAINS(#MRProps, '\"{0}*\"', {1}) RANK BY COERCION(ABSOLUTE, 980))",],s='"System.Search.Rank" DESC, "System.DateModified" DESC',fr="['calendar', 'game', 'web history', 'feed', 'contact', 'task', 'journal', 'note', 'instantmessage']",er="\"System.Kind\" = 'folder'",or="\"System.Kind\" = 'music'",sr="\"System.Kind\" = 'picture'",hr="\"System.Kind\" = SOME ARRAY['Movie', 'RecordedTV', 'Video']",ii='("System.Kind" = \'document\' or "System.Kind" IS NULL)',cr="\"System.Kind\" = SOME ARRAY['program', 'link']",p='"System.DateCreated" DESC, "System.Link.DateVisited" DESC, "System.History.VisitCount" DESC, "System.History.SelectionCount" DESC',w=["System.ApplicationName","System.Document.Version","System.Identity","System.Status","System.ContentType","System.ProviderItemID","System.Link.TargetUrl","System.Title","System.Link.DateVisited","System.History.VisitCount","System.History.SelectionCount",],c=["System.Title","System.Music.AlbumTitle","System.Music.DisplayArtist"],b=["System.ItemNameDisplay","System.Music.DisplayArtist","System.Music.AlbumTitle",];let ri=["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)",];const it=c.concat("System.DateAccessed"),lr=ri.concat(["CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)"]);let ar=["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)",];const ui=["System.DateAccessed",],vr=["System.ItemNameDisplay",];let yr=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 795)",];const h=["System.Search.AutoSummary","System.Keywords","System.Title","System.Author","System.Document.LastAuthor",],nt=["System.ItemNameDisplay","System.Keywords","System.Title",];let rt=["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)","CONTAINS(System.Photo.TagViewAggregate, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)",];n.config.onlyWhereContains||(rt=rt.concat(["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","System.Keywords = '{0}' RANK BY COERCION(ABSOLUTE, 960)","System.Photo.TagViewAggregate = '{0}' RANK BY COERCION(ABSOLUTE, 940)","System.Music.DisplayArtist = '{0}' RANK BY COERCION(ABSOLUTE, 960)","System.Music.Genre = '{0}' RANK BY COERCION(ABSOLUTE, 950)",]));let fi=["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)",];const pr="CONTAINS(System.Search.Contents, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 545)",ei=[],wr=["System.ItemNameDisplay",];let br=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)",];const k=["System.Photo.TagViewAggregate","System.Title",],oi=["System.ItemNameDisplay","System.Photo.TagViewAggregate",];let kr=["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)",];const l=["System.Title","System.Keywords","System.Music.DisplayArtist","System.Music.Genre",],si=["System.ItemNameDisplay","System.Title","System.Keywords",];let dr=["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)",],ut=["System.Title","System.Music.DisplayArtist","System.Music.AlbumTitle","System.Music.Genre",];const hi=["System.ItemNameDisplay","System.Title","System.Music.AlbumTitle",];let gr=["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)",];const nu=["path = '{0}'"];let u;t.getStrategy=d;t.dataSourceSupported=tu;t.suppress=iu;let a,ft,ci;const et=["Movie","RecordedTV","Video"],li=et.concat(["Picture","Music"]),ai=["calendar","game","web history","feed","contact","task","journal","note","instantmessage"],ot=ai.concat("program"),st=li.concat(ot).concat(["folder","link"]).map(n=>"'"+n+"'").join(",");t.initStrategies=ht;t.generateIndexerQueryAsync=eu;t.generateIndexerQueryForMRUFilesAndFolders=ou;t.generateIndexerPrimerQuery=su;t.updateAnaheimStrategy=hu;t.generateIndexerQuery=yi;t.fixKind=au;let tt={};tt.MPHO=i(k,!1);tt.MVID=i(l,!1);tt.MDOC=i(h,!1);const rf=(()=>{let n={};return n.Powerpoint="ppt",n.Word="doc",n.Excel="xls",n})()})(t=n.IndexerQueryGenerator||(n.IndexerQueryGenerator={}))}(WSB||(WSB={})),function(n){function p(t,i,r,u,f,e,o,s){let h=u?r+" "+i:r;return(r,u,c=false)=>n.Host.getGetIconAsyncEnabled()&&c?n.Async.safeChainWithGlobalCaching("getIcon",i=>t.getIconAsync(n.getImageSizeValue(i)),n=>n+"_"+i,i=>n.toIcon(i,"getIcon.toIcon",e,o,h,t===null||t===void 0?void 0:t.imageType),e,f?()=>(t===null||t===void 0?void 0:t.imageType)===0:null,h,null,s)(r,u):n.Async.safeChainWithGlobalCaching("getIcon",i=>t.getImageAsync(n.getImageSizeValue(i)),n=>n+"_"+i,i=>n.toIcon(i,"getIcon.toIcon",e,o,h,n.config.newFilesPreviewPane?t===null||t===void 0?void 0:t.imageType:null),e,f?()=>(t===null||t===void 0?void 0:t.imageType)===0:null,h,null,s)(r,u)}function i(t,i,r,u,f,e){return{deviceItem:t,getIcon:p(t,t.id,r,r&&!n.localDataSourceMayContainPII(r),n.displayedInGridLayout(i),u,f,0),icon:e?u:null,suggestionType:i}}function c(n,t,i){return{deviceItem:n,icon:i,suggestionType:t}}function pt(n){return n.map(n=>({isSimulated:!0,displayName:n,id:null,kind:null,getProperty:null,propertyHits:null,rankScore:null}))}function w(){if(n.config.wsbWebView2&&SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.fetchForTopLocalAppsAsync){let t=n.config.wsbWithCopilot?4:6;return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.fetchForTopLocalAppsAsync(f,y,t)}else{let t=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getAllAppsAsync();return t.then(t=>{let i=[];for(let r in t){let u=t[r];u&&(n.config.allowZeroLaunchTopApps||u.totalLaunches>0)&&!n.contains(y,u.id)&&i.push(u)}return n.config.minTopApps&&i.length<n.config.minTopApps?[]:i}).then(n=>n).then(n=>n).then(n=>{return wt(n),[].concat(n)})}}function wt(t){return t.sort((t,i)=>{let u=t.totalLaunches,e=i.totalLaunches;if(u!==0||e!==0)return e-u;let o=t.id,r=i.id;return n.contains(f,o)?n.contains(f,r)?f.indexOf(o)-f.indexOf(r):-1:n.contains(f,r)?1:0}),t}function u(t,i,r){switch(t){case"program":return"IBA";case"picture":return i&&n.contains(l,i.toLowerCase())?"FL":"LI";case"video":return i&&n.contains(b,i.toLowerCase())?"FL":"LV";case"movie":case"recordedtv":return"LV";case"music":return"MU";case"folder":return"FD";default:return r}}function k(t,i,r){switch(t){case"picture":return i&&n.contains(l,i.toLowerCase())?r==="PSFL"?"PSFL":"CSFL":r==="PSFL"?"PSLI":"CSLI";case"document":return r==="PSFL"?"PSFL":"CSFL";case"folder":return r==="PSFL"?"PSFD":"CSFD";default:return r}}function bt(t,i){switch(t){case"picture":return i&&n.contains(l,i.toLowerCase())?!0:!1;case"video":return i&&n.contains(b,i.toLowerCase())?!0:!1;case"calendar":case"contact":case"email":case"feed":case"folder":case"game":case"instantmessage":case"journal":case"movie":case"music":case"note":case"playlist":case"recordedtv":case"searchfolder":case"task":case"web history":return!1;case"document":case"program":case"link":default:return!0}}function d(n,t){let i=t.filter(n=>bt(n.kind,n.extension));return i.slice(0,n)}function ft(t,i,r,u,f,o,s,h,c){let a=s&&c?t.filter(t=>n.contains(Object.keys(e),t)):[];a.length>0&&(t=t.filter(t=>!n.contains(a,t)));let l=t=>{for(let i of a){let r=e[i];t[i]={deviceItem:{id:i,displayName:n.Host.getLocString(r.locStringKey),kind:null,getProperty:()=>null,propertyHits:[],rankScore:1e3},icon:r.icon}}i(t)};n.safeExecute(()=>{if(t.length==0)l({});else{let e={},i=t.slice(0);if(h)for(let n=t.length-1;n>=0;--n){let r=t[n];h.hasOwnProperty(r)&&(e[r]=h[r],i.splice(n,1))}if(i.length==0)l(e);else{let c=!s||n.localDataSourceMayContainPII(s)?s:s+" "+i;n.Async.safeChain(r,()=>u(i),r=>{let u=n.Map.map(i,r,n=>f(n));if(h&&i.forEach(n=>h[n]=u[n]),i.length!=t.length)for(let n in e)e.hasOwnProperty(n)&&(u[n]=e[n]);l(u)},()=>l({}),o,c)}}},"resolveIdsWithCache",null,s,()=>l({}))}function kt(t,i,r,u,f,e,o,s){n.safeExecute(()=>{if((t===null||t===void 0?void 0:t.length)==0)i({});else{let c={},h=t===null||t===void 0?void 0:t.slice(0);if(s)for(let n=t.length-1;n>=0;--n){let i=t[n].toLowerCase();s.hasOwnProperty(i)&&(c[i]=s[i],h.splice(n,1))}if(h.length==0)i(c);else{let l=!o||n.localDataSourceMayContainPII(o)?o:o+" "+h;n.Async.safeChain(r,()=>u(h),r=>{let u=n.Map.map(h,r,n=>{let t=[];return n.forEach(n=>t.push(f(n))),t});if(s&&h.forEach(n=>s[n]=u[n]),h.length!=t.length)for(let n in c)c.hasOwnProperty(n)&&(u[n]=c[n]);i(u)},()=>i({}),e,l)}}},"resolveDisplayNames",null,o,()=>i({}))}function dt(t,i,r,u,f,o,s,h,c){let v=s&&c?t.filter(t=>n.contains(Object.keys(e),t)):[];v.length>0&&(t=t.filter(t=>!n.contains(v,t)));let l=t=>{for(let i of v){let r=e[i];t[i]={deviceItem:{id:i,displayName:n.Host.getLocString(r.locStringKey),kind:null,getProperty:()=>null,propertyHits:[],rankScore:1e3},icon:r.icon}}i(t)},a=(t=new window.Map)=>{for(let i of v){let r=e[i];t.set(i,{deviceItem:{id:i,displayName:n.Host.getLocString(r.locStringKey),kind:null,getProperty:()=>null,propertyHits:[],rankScore:1e3},icon:r.icon})}i(t)};n.safeExecute(()=>{if(t.length==0)n.config.mapWrapperToJsMap?a():l({});else{let e={},c=new window.Map,i=t.slice(0);if(h)for(let r=t.length-1;r>=0;--r){let u=t[r];h.hasOwnProperty(u)&&(n.config.mapWrapperToJsMap?c.set(u,h[u]):e[u]=h[u],i.splice(r,1))}if(i.length==0)n.config.mapWrapperToJsMap?a(c):l(e);else{let v=!s||n.localDataSourceMayContainPII(s)?s:s+" "+i;n.Async.safeChain(r,()=>u(i),r=>{if(n.config.mapWrapperToJsMap){let n=new window.Map;if(i.forEach(t=>{let i=r[t];i&&n.set(t,f(i))}),h&&i.forEach(t=>h[t]=n.get(t)),i.length!=t.length)for(let[i,t]of c)t&&n.set(i,t);a(n)}else{let u=n.Map.map(i,r,n=>f(n));if(h&&i.forEach(n=>h[n]=u[n]),i.length!=t.length)for(let n in e)e.hasOwnProperty(n)&&(u[n]=e[n]);l(u)}},()=>n.config.mapWrapperToJsMap?a():l({}),o,v)}}},"resolveIdsWithCache",null,s,()=>n.config.mapWrapperToJsMap?a():l({}))}function ii(n,t){if(!t.launchArguments||ti.test(n.query))return!0;let i=t.id.toLowerCase();return et.some(n=>i.includes(n))?!0:!1}function ot(t,i,r,u,f){if(!f)return!1;let 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&&!st(e,o)&&(s=n.matchesOnPropertyHH(o,e),!s)?!0:ei(o,e,t,r,u,f)?!0:!1}function ei(t,i,r,u,f,e){if(!i||!e||!e.MatchScore||!e.Parses||e.Parses.length==0||!e.Parses[0].Entities||e.Parses[0].Entities.length==0||!e.Query||t.startsWith(i)&&i.length>=n.config.filterCICandidatesPrefixLength)return!1;let o=e.Query;if(o.startsWith(i)||n.config.bypassCIFilterOnSubstringMatch&&t.split(" ").some(n=>n.startsWith(i)))return!1;let s=t.startsWith(o);if(!s)return!0;return f.Counter>=1?!0:(f.Counter++,!1)}function st(n,t){if(!!t&&t.length==0)return!1;let i=t.split(" ");if(n.length!=i.length)return!1;for(let t=0;t<i.length;t++)if(i[t].length==0||i[t][0]!=n[t])return!1;return!0}function ht(n){let i=n.id.toLowerCase();if(i.startsWith("http:")||i.startsWith("https:")||n.kind=="link"&&i.endsWith(".url"))return 1;if(i.startsWith("file:")||n.kind=="document")return 0;let t=n.filePath;if(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 ct(n,t){if(t.dataSource=="PP"){let t=ht(n);if(t==1)return"LURL";if(t==0)return"LDOC"}return t.getSuggestionType(n)}function lt(t){return t&&t.rawIndexResponse?n.safeExecute(()=>JSON.parse(t.rawIndexResponse),"parseConstraintIndexMetaData"):undefined}function at(t,i,r,u,f,e){if(n.IndexerQueryGenerator&&n.IndexerQueryGenerator.suppress(i,t,u))return!0;if(r=="PP"){let h=i.id;if(n.contains(ri,h))return!0;let o=i;if(ot(o,t,!0,f,e))return!0;let r=i.kind;if(r&&(r=r.toLocaleLowerCase(),r!="program"&&r!="unknown")||u=="LRA"&&ht(o)!=2)return!0;let s=o.extension;return s&&s.toLowerCase()==".chm"?!0:!1}if(r!="LURL"&&i.kind=="link"&&n.RuntimeConfig.QfMode!=5)return!0;if(n.isSetting(r))return ot(i,t,!1,f,e)?!0:!1;let o=i;if(!n.IndexerQueryGenerator&&u=="MDOC"&&((o===null||o===void 0?void 0:o.propertyHitsString)=="System.Search.Contents"||o.propertyHits.length==1&&o.propertyHits[0]=="System.Search.Contents")&&(!n.config.minLengthForContentMatch||t.queryToFetch.length<n.config.minLengthForContentMatch))return!0;let s=o.id;if(s&&(n.RuntimeConfig.QfMode!=5&&(s.includes("\\.")||s.includes("/."))||(s=s.toLowerCase(),t.queryToFetch.toLocaleLowerCase()!=i.displayName.toLocaleLowerCase()&&fi.some(n=>s.includes("\\"+n+"\\")||s.includes("/"+n+"/")))))return!0;let h=o.extension;if(h&&n.RuntimeConfig.QfMode!=5&&!t.queryToFetch.toLowerCase().includes(h.toLowerCase())&&n.contains(ui,h.toLowerCase()))return!0;if(r=="CG"){let r=i,t=r.displayName.split(" ")[0].toLowerCase();if(t.includes("\\")||t.indexOf(":")==1)return!1;let u=r.id.toLowerCase(),f=u.lastIndexOf("."),e=u.lastIndexOf("\\"),o=r.kind=="folder"||f<0||f<e;if(o&&!t.includes("%")||![".exe",".com"].some(n=>t.includes(n))&&(gt.some(n=>u.includes(n))||!r.launchArguments&&et.some(n=>u.includes(n))||n.contains(ni,t)))return!0}return!1}const v=":wux:",s="Classic_{87d66a43-7b11-4a28-9811-c86ee395acf7}",h="AAA_SettingsPageSearchIndex",y=["Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App"],f=["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"],vt=new Set(["!","@","#","$","^","%","&","*","(",")","<",">","[","]","{","}","~","`","?","/",",",".","+","-","_","=",":",";","|"]),yt=1;n.getIcon=p;n.createLocalResponseSuggestionWithDeviceItemImage=i;n.fetchForTopLocalApps=w;const l=[".dwg",".ai",".psd"],b=[".ts"];n.getSuggestionTypeFromKindAndExtension=u;const a={getResultsContainer:n=>n.apps,dataSource:"PP",getSuggestionType:()=>"PP",maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Apps].icon,t.isImmersive?t.logoBackgroundColor:undefined),supportsEmptyQuery:!0};n.filterIFFResultsToHighPriFiles=d;const g={getResultsContainer:n=>n.settings,dataSource:"ST",getSuggestionType:()=>"ST",maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>{if(n.isModernSetting(t)){let i=t.glyph,u;return u=n.config.useCobaltCSS&&t.glyphFontFamily==="Settings Fluent Icons"?{content:i,type:8}:i?{content:i,type:1}:n.ScopeConfig[n.Scope.Settings].icon,c(t,r,u)}return i(t,r,u,n.ScopeConfig[n.Scope.Settings].icon)},supportsEmptyQuery:!1},nt=[a,g,{getResultsContainer:n=>n.media,dataSource:"LM",getSuggestionType:n=>u(n.kind,n.extension,"FL"),maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:n=>n.files,dataSource:"FL",getSuggestionType:n=>u(n.kind,n.extension,"FL"),maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:()=>{throw Error("Only supported via IndexerQuery");},dataSource:"IBA",getSuggestionType:()=>"IBA",maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Apps].icon),supportsEmptyQuery:!1},{getResultsContainer:()=>{throw Error("Only supported via IndexerQuery");},dataSource:"IFF",getSuggestionType:n=>u(n.kind,n.extension,"FL"),maxUpTo3chars:n.config.win10FastFileProviderSqlOptimizations?30:7,maxAfter3chars:n.config.win10FastFileProviderSqlOptimizations?30:15,maxAfter8charsOrInL2ZeroInput:n.config.win10FastFileProviderSqlOptimizations?30:25,supportsEmptyQuery:!0},{getResultsContainer:()=>{throw Error("Only supported via IndexerQuery");},dataSource:"CoPIFF",getSuggestionType:n=>k(n.kind,n.extension,"PSFL"),maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:()=>{throw Error("Only supported via IndexerQuery");},dataSource:"CoPCFP",getSuggestionType:n=>k(n.kind,n.extension,"CSFL"),maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:()=>{throw Error("Only supported via IndexerQuery");},dataSource:"CoPST",getSuggestionType:()=>"CoPST",maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0,customCreateLocalResponseSuggestion:(t,r,u)=>{if(n.isModernSetting(t)){let i=t.glyph,u;return u=n.config.useCobaltCSS&&t.glyphFontFamily==="Settings Fluent Icons"?{content:i,type:8}:i?{content:i,type:1}:n.ScopeConfig[n.Scope.Settings].icon,c(t,r,u)}return i(t,r,u,n.ScopeConfig[n.Scope.Settings].icon)}},],tt=[{getResultsContainer:n=>n.files,dataSource:"MDOC",getSuggestionType:n=>u(n.kind,n.extension,"FL"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Documents].icon,null,!0),supportsEmptyQuery:!1},{getResultsContainer:n=>n.folders,dataSource:"MFOL",getSuggestionType:n=>u(n.kind,n.extension,"FD"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Folders].icon,null,!0),supportsEmptyQuery:!1},{getResultsContainer:n=>n.pictures,dataSource:"MPHO",getSuggestionType:n=>u(n.kind,n.extension,"LI"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Photos].icon,null,!0),supportsEmptyQuery:!1},{getResultsContainer:n=>n.video,dataSource:"MVID",getSuggestionType:n=>u(n.kind,n.extension,"LV"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Videos].icon,null,!0),supportsEmptyQuery:!1},{getResultsContainer:n=>n.music,dataSource:"MMUS",getSuggestionType:()=>"MU",maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Music].icon,null,!0),supportsEmptyQuery:!1},{getResultsContainer:n=>n.files,dataSource:"MPVD",getSuggestionType:n=>u(n.kind,n.extension,"FL"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Documents].icon,null,!0),supportsEmptyQuery:!1},],it=[{getResultsContainer:n=>SearchAppWrapper.CortanaApp.queryFormulationView.startPathCompletionQuery(n.originalQuery,""),dataSource:"PT",getSuggestionType:()=>"PT",maxUpTo3chars:15,maxAfter3chars:15,maxAfter8charsOrInL2ZeroInput:15,customCancellation:()=>SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastPathCompletionQuery(),supportsEmptyQuery:!1},{getResultsContainer:()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getRecentAppsAsync(),getResults:n=>n,dataSource:"LRA",getSuggestionType:()=>"PP",customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Apps].icon,t.isImmersive?t.logoBackgroundColor:undefined),supportsEmptyQuery:!0},{getResultsContainer:t=>ThresholdUtilities.createPromise(i=>{let r=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.recentSearches||[];if(r=r.filter(n=>!!n),r.length>0&&t.queryToFetch){const i=n.escapeRegex(t.queryToFetch),u=i.split(/\s+/).filter(n=>!!n).map(n=>new RegExp("^"+n+"| "+n,"i"));r=r.filter(n=>u.every(t=>t.test(n)))}let u=pt(r);i(u)}),getResults:n=>n,dataSource:"FEH",getSuggestionType:()=>"FEH",customCreateLocalResponseSuggestion:(n,t)=>{return c(n,t,{type:2,content:"&#xE81C"})},supportsEmptyQuery:!0},{getResultsContainer:()=>w(),getResults:(n,t)=>n.then(n=>t?n.slice(0,t):n),dataSource:"TOPP",getSuggestionType:()=>"TOPL",customGetMax:t=>n.shouldShowStaticSearchHome(t)?6:5,customCreateLocalResponseSuggestion:(t,r,u)=>i(t,r,u,n.ScopeConfig[n.Scope.Apps].icon,t.isImmersive?t.logoBackgroundColor:undefined),supportsEmptyQuery:!0}],rt=[{getResultsContainer:n=>SearchAppWrapper.CortanaApp.queryFormulationView.startCommandLineQuery(n.originalQuery,""),dataSource:"CG",getSuggestionType:()=>"CG",customCancellation:()=>SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastCommandLineQuery(),supportsEmptyQuery:!1},];n.LocalDataProviderDataSources=nt.concat(tt).concat(it).concat(rt).map(n=>n.dataSource);const r={suggestions:[],maxedOut:!1};let ut={},e={"shell:RecycleBinFolder":{icon:{content:"&#xEF87",type:2},locStringKey:"RecycleBin"}};const gt=["\\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(n=>!!n),et=["\\system32\\finger.exe","\\system32\\ping.exe","\\system32\\print.exe","\\system32\\shutdown.exe","\\system32\\expand.exe","\\system32\\tskill.exe","\\system32\\reg.exe","\\system32\\sc.exe",],ni=["uninstall","outlook","excel","skype","nero","onenote","lync","vmware","firefox","itunes","photoshop","print","opera","visio","thunderbird","smartscreen"],ti=/[\/\.\-\\]/;n.isRealCommand=ii;const ri=["Microsoft.Cortana_8wekyb3d8bbwe!CortanaUI","Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI",],ui=[".dll",".pdb",".obj",".bin",".etl",".bak",".config",".resx",".manifest",".ini",".searchconnector-ms",".settingcontent-ms",".vstx",".vssx",".ms-one-stub",],fi=["visio content","bin","debug","obj","objd","amd64","x86","microsoftedgebackups",];n.isInitials=st;n.getSuggestionTypeOverride=ct;n.parseConstraintIndexMetaData=lt;n.isSuppressed=at;class t{getName(){return"LocalDataProvider"}constructor(t){this._previousKeystrokeCache=t;n.Host.bindAppHidden(()=>{ut={}})}static setWhereId(n){var r,i;if(!n||n.close){if(t.lastResultHandle&&!n){(i=(r=t.lastResultHandle).close)===null||i===void 0?void 0:i.call(r);t.lastResultHandle=null;return}t.lastResultHandle=n}}fetch(i,r,u,f,e){var l,a,v,y;f&&f.register(()=>n.Async.clearPendingItemsFromCache(),!1,"clearPendingItemsFromCache");let s=[],c=nt.filter(t=>n.isDataSourceEnabled(t.dataSource,i));if(n.IndexerQueryGenerator&&(s=s.concat(c.filter(t=>n.IndexerQueryGenerator.dataSourceSupported(t.dataSource))),c=c.filter(t=>!n.IndexerQueryGenerator.dataSourceSupported(t.dataSource))),c.length>0){if(!i.queryToFetch&&!c.every(n=>n.supportsEmptyQuery))throw new Error(o);f&&f.register(()=>SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastDeviceQuery(),!1,"cancelLastDeviceQuery");let u=n.safeExecute(()=>{let t=n.Host.getRawImpressionGuid();return n.config.logClientPerf&&n.InstrumentationHelper.instrumentDeviceQueryBegin(t),SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(i.queryToFetch,t)},"startDeviceQuery",null,i.queryToFetch);if(u)for(let n of c)this.searchFolderWithMultipleResults(i,n,u,r,e,f,(l=t.lastResultHandle)===null||l===void 0?void 0:l.whereId);else this.emptyFetch(c,r)}let h=tt.filter(t=>n.isDataSourceEnabled(t.dataSource,i));if(n.IndexerQueryGenerator&&(s=s.concat(h.filter(t=>n.IndexerQueryGenerator.dataSourceSupported(t.dataSource))),h=h.filter(t=>!n.IndexerQueryGenerator.dataSourceSupported(t.dataSource))),h.length>0){if(!i.queryToFetch&&!h.every(n=>n.supportsEmptyQuery))throw new Error(o);let u=i.taskFrame?i.taskFrame.raw:"";n.Async.safeChain("executeSearchAsync",()=>SearchAppWrapper.CortanaApp.searchResultsView.executeSearchAsync(i.queryToFetch,u),n=>{var u;if(e())if(n)for(let o of h)this.searchFolderWithMultipleResults(i,o,n,r,e,f,(u=t.lastResultHandle)===null||u===void 0?void 0:u.whereId);else this.emptyFetch(h,r)},()=>this.emptyFetch(h,r),null,u?i.queryToFetch+"\n"+u:i.queryToFetch)}if(s.length>0){if(t.lastQuery&&!i.fullPartialQuery.startsWith(t.lastQuery)&&t.setWhereId(null),t.lastQuery=i.fullPartialQuery,!i.queryToFetch&&!s.every(n=>n.supportsEmptyQuery))throw new Error(o);if(s.some(n=>n.dataSource=="MPHO")&&s.some(n=>n.dataSource=="MVID")&&s.some(n=>n.dataSource=="MDOC")&&s.some(n=>n.dataSource=="MPVD")){let n=s.find(n=>n.dataSource=="MPVD");this.searchFolderWithMultipleResults(i,n,null,r,e,f,(a=t.lastResultHandle)===null||a===void 0?void 0:a.whereId)}else for(let n of s){let u=null;(n.dataSource==="CoPIFF"||n.dataSource==="CoPCFP"||n.dataSource==="CoPST")&&(u=n.dataSource);this.searchFolderWithMultipleResults(i,n,u,r,e,f,(v=t.lastResultHandle)===null||v===void 0?void 0:v.whereId)}}let p=it.filter(t=>n.isDataSourceEnabled(t.dataSource,i));if(p.length>0){if(!i.queryToFetch&&!p.every(n=>n.supportsEmptyQuery))throw new Error(o);for(let n of p)f&&n.customCancellation&&f.register(()=>n.customCancellation(),!0,n.dataSource+" cancellation"),this.searchFolderWithMultipleResults(i,n,i,r,e,f,(y=t.lastResultHandle)===null||y===void 0?void 0:y.whereId)}let w=rt.filter(t=>n.isDataSourceEnabled(t.dataSource,i));if(w.length>0){if(!i.queryToFetch&&!w.every(n=>n.supportsEmptyQuery))throw new Error(o);for(let n of w)f&&n.customCancellation&&f.register(()=>n.customCancellation(),!0,n.dataSource+" cancellation"),this.searchFolderWithSingleResult(i,n,i,r,e)}i.taskFrame&&n.safeExecute(()=>SearchAppWrapper.CortanaApp.searchResultsView.setTaskFrame(i.originalQuery,""),"reset task frame")}emptyFetch(n,i){for(let u of n)this.logProviderFailure(u.dataSource),i(u.dataSource,r,t.getDataSourceState(0))}getMax(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}toLocalResponse(t,r,u,f,e){let o;if(e){let n=f;n.getGroupDisplayName&&(o=n.getGroupDisplayName(e))}let h={Counter:0},s=[],c=u.length<t;for(let t of u){let e=ct(t,f),u=n.isApp(e)||n.isSetting(e)?lt(t):undefined;if(!at(r,t,e,f.dataSource,h,u)){let n;if(n=f.customCreateLocalResponseSuggestion?f.customCreateLocalResponseSuggestion(t,e,f.dataSource):i(t,e,f.dataSource),o&&(n.groupDisplayName=o),u&&(n.ciMetaData=u,u.Query&&u.Query.includes(v))){let t=u.Query.split(v);t.length==2&&(n.uxHint=t[1],n.ciMetaData.Query=t[0])}s.push(n)}}return{suggestions:s,maxedOut:c}}getResults(n,t,i,r){if(r.getResults)return r.getResults(i,t);let u=i,f=this.enableSpellCorrection(n);return u.getItemsAsyncWithSpeller?u.getItemsAsyncWithSpeller(0,t,f):i.getItemsAsync(0,t)}enableSpellCorrection(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}searchFolderWithMultipleResults(i,u,f,e,o,s,h){let c=u.dataSource,a=this.getMax(i,u),y=!f,l,p;if(y){let t;if(n.RuntimeConfig.QfMode==5&&(t=n.Host.getFileExplorerCurrentPath()),t&&!/^[a-zA-Z]\:\\/.test(t)){e(c,r,null,null,!0);return}if(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(41150162))if(n.config.noSqlFetchWhenShortCircuit&&(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(45721604)))if(n.config.queryShortCircuitAPIFix)l=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.querySearchIndexerResultsAsync(undefined,i.originalQuery,n.Host.getRawImpressionGuid());else{let t={rawSQL:undefined,queryText:i.originalQuery,impressionID:n.Host.getRawImpressionGuid()};l=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.querySearchIndexerResultsAsync(t)}else{if(this.shouldSkipGenerateIndexerQuerySearch(i)){e(c,r,null,null,!0);return}l=()=>n.IndexerQueryGenerator.generateIndexerQueryAsync(i,t,a,c,h).then(t=>{if(!o())return null;if(n.config.queryShortCircuitAPIFix){let r=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.querySearchIndexerResultsAsync(t,i.originalQuery,n.Host.getRawImpressionGuid());return n.config.wsbWebView2&&r.done(()=>{},()=>{n.LogWSBError("debugWindowsIndexerQueryTimeout",t,undefined,undefined,undefined,"WindowsTelemetry")}),r}let r={rawSQL:t,queryText:i.originalQuery,impressionID:n.Host.getRawImpressionGuid()};return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.querySearchIndexerResultsAsync(r)})}else{if(this.shouldSkipGenerateIndexerQuerySearch(i)){e(c,r,null,null,!0);return}l=()=>n.IndexerQueryGenerator.generateIndexerQueryAsync(i,t,n.config.win10ScopeIFFToHighPriorityFiles?a*2:a,c,h).then(t=>{let i=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(t);return n.config.wsbWebView2&&i.done(()=>{},()=>{n.LogWSBError("debugWindowsIndexerQueryTimeout",t,undefined,undefined,undefined,"WindowsTelemetry")}),i})}}else if(c=="CoPIFF")if(n.Host.getIFFPolarisProviderEnabled()){let t;if(n.RuntimeConfig.QfMode==5&&(t=n.Host.getFileExplorerCurrentPath()),t&&!/^[a-zA-Z]\:\\/.test(t)){e(c,r,null,null,!0);return}l=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.polarisProvider.queryAsync(i.originalQuery,n.Host.getRawImpressionGuid(),undefined)}else{e(c,r,null);return}else if(c=="CoPCFP"){let t;if(t=n.config.enableVegaProviderNullCheck?n.Host.getVegaProviderEnabled()&&!!SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.vegaProvider:n.Host.getVegaProviderEnabled(),t){let t;if(n.RuntimeConfig.QfMode==5&&(t=n.Host.getFileExplorerCurrentPath()),t&&!/^[a-zA-Z]\:\\/.test(t)){e(c,r,null,null,!0);return}l=()=>new Promise((t,r)=>{n.Async.safeChain("vega",()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.vegaProvider.queryAsync(i.originalQuery,n.Host.getRawImpressionGuid()),n=>{var i;let r=[];if(((i=n===null||n===void 0?void 0:n.providerResultSet)===null||i===void 0?void 0:i.length)>0)for(let t of n.providerResultSet)t.status===0&&r.push(...t.resultSet);const u={state:0,resultSet:r,whereId:null,close:null};t(u)},r,s)})}else{e(c,r,null);return}}else if(c=="CoPST")if(n.Host.getJupiterProviderEnabled())l=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.jupiterProvider.queryAsync(i.queryToFetch,n.Host.getRawImpressionGuid());else{e(c,r,null);return}else{if(p=n.safeExecute(()=>u.getResultsContainer(f),"getResultsContainer "+c),!p){e(c,r,null);return}l=()=>this.getResults(i,a,p,u)}let v="getItemsAsync";y?v="queryWindowsSearchIndexerAsync":c=="CoPIFF"?v="polarisProvider":c=="CoPCFP"?v="vegaProvider":c=="CoPST"&&(v="jupiterProvider");let w=null;(y||c=="CoPCFP"&&n.Host.getVegaProviderEnabled())&&(w=s);n.Async.safeChain(v,l,r=>{if(o()){if(!r){n.LogWSBError("[searchFolderWithMultipleResults] - Items is null for data source:",c,undefined,undefined,undefined,"WindowsTelemetry");return}let f=r.resultSet,o;r.whereId&&t.setWhereId(r);f?o=r.state:f=typeof r.length=="undefined"?Object.keys(r).map(n=>r[n]):r;y&&(n.config.win10ScopeIFFToHighPriorityFiles&&u.dataSource=="IFF"?(f=f.map(t=>n.IndexerQueryGenerator.fixKind(t)),f=d(a,f,u)):n.supportsShortcuts(c,i)&&(f=f.map(t=>n.IndexerQueryGenerator.fixKind(t))));let s=t.getDataSourceState(o);e(c,this.toLocalResponse(a,i,f,u,p),s)}},t=>{n.isCancellation(t)||this.logProviderFailure(c),e(c,r,null)},w,c+" "+i.queryToFetch)}searchFolderWithSingleResult(t,i,u,f,e){let o=i.dataSource,s=n.safeExecute(()=>i.getResultsContainer(u),"getResultsContainer "+o);s?n.Async.safeChain("tryGetResultAsync "+o,()=>s.tryGetResultAsync(),n=>{e()&&f(o,this.toLocalResponse(1,t,n?[n]:[],i,null),null)},t=>{n.isCancellation(t)||this.logProviderFailure(o),f(o,r,null)},null,t.queryToFetch):f(o,r,null)}logProviderFailure(t){let i=n.providerFailureLogName(t);i&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(()=>SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(i,"ErrorForTopHit"),"logProviderFailure")}static getDataSourceState(n){switch(n){case 0:return"UN";case 1:return"NI";case 2:return"PI"}return undefined}static getApps(n,t,i,r){ft(n,t,"findAppsAsync",n=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findAppsAsync(n),n=>a.customCreateLocalResponseSuggestion(n,null,r),i,r,null,!0)}static getAppsByDisplayName(n,t,i,r){kt(n,t,"getAppItemsByAppDisplayNames",n=>this.getAppItemsByAppDisplayNames(n),n=>a.customCreateLocalResponseSuggestion(n,null,r),i,r,null)}static getSettings(n,t,i,r){dt(n,t,"findSettingsAsync",n=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findSettingsAsync(n),n=>g.customCreateLocalResponseSuggestion(n,null,r),i,r,null)}static getFiles(r,f,e,o,s){ft(r,f,"findFilesAsync",i=>{var r;if(n.IndexerQueryGenerator){let u=n.IndexerQueryGenerator.generateIndexerQueryForMRUFilesAndFolders(e,"MFF",i,(r=t.lastResultHandle)===null||r===void 0?void 0:r.whereId);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(u).then(n=>{n.whereId&&t.setWhereId(n);let i={};for(let t of n.resultSet)i[t.id]=t;return i})}return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findFilesAsync(i)},n=>i(n,u(n.kind,n.extension,"FL"),s),o,s,ut)}static launchIndexingOptions(i){t.getSettings([s],t=>{let r;r=n.config.mapWrapperToJsMap&&t instanceof window.Map?t.get(s):t[s];r?n.Host.launchDeviceItemAsync(r.deviceItem,"ST"):i||this.launchIndexingOptions(!0)},null,null,!0)}static launchIndexingStatus(i){t.getSettings([h],t=>{let r;r=n.config.mapWrapperToJsMap&&t instanceof window.Map?t.get(h):t[h];r&&r.deviceItem?n.Host.launchDeviceItemAsync(r.deviceItem,"ST"):i||this.launchIndexingStatus(!0)},null,null,!0)}isAllSymbols(n){var t;if((t=n===null||n===void 0?void 0:n.split(""))!==null&&t!==void 0)return t.every(n=>vt.has(n))}isWin10IFFMinQueryLengthApplicable(t){var i,r;let u=n.config.win10FastFileProviderSqlOptimizations&&n.config.win10IFFMinQueryLengthEnabled&&n.config.win10IFFMinQueryLengthLangs;if(u){r=n.Host.getLanguage().split("-")[0].toLowerCase();let u=Object.keys(n.config.win10IFFMinQueryLengthLangs);return(u===null||u===void 0?void 0:u.length)>0&&n.contains(u,r)&&((i=t===null||t===void 0?void 0:t.queryToFetch)===null||i===void 0?void 0:i.length)<n.config.win10IFFMinQueryLengthLangs[r]}return!1}shouldSkipGenerateIndexerQuerySearch(t){var i,r;return(t===null||t===void 0?void 0:t.scope)==n.Scope.All&&(this.isWin10IFFMinQueryLengthApplicable(t)||this.isAllSymbols(t===null||t===void 0?void 0:t.queryToFetch)||n.config.thresholdForQFToSkipGIQS>0&&((i=t===null||t===void 0?void 0:t.queryToFetch)===null||i===void 0?void 0:i.length)<=n.config.thresholdForQFToSkipGIQS)?!0:n.config.win10FastFileProviderSqlOptimizations&&n.Host.getLanguage().toLowerCase().startsWith("en")&&((r=t===null||t===void 0?void 0:t.queryToFetch)===null||r===void 0?void 0:r.length)<=yt?!0:!1}static getAppItemsByAppDisplayNames(t){let i={},u=[],f=n.Host.getRawImpressionGuid();t.forEach(t=>{var r,e;let o=(e=(r=SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(t,f))===null||r===void 0?void 0:r.apps)===null||e===void 0?void 0:e.getItemsAsyncWithSpeller(0,30,!0).then(r=>{let u=r===null||r===void 0?void 0:r.resultSet;u||typeof(r===null||r===void 0?void 0:r.length)!="undefined"?u||(u=r):u=Object.keys(r).map(n=>r[n]);for(let r in u){let f=u[r];f&&(typeof f=="object"||!n.config.wsbWebView2||typeof f=="function")&&(f&&i[t]?i[t].push(f):i[t]=[f])}return i});u.push(o)});let r=Promise.all(u).then(()=>i);return{then:r.then.bind(r),"catch":r.catch.bind(r),done:undefined,cancel:undefined}}}n.LocalDataProvider=t;let o="Local provider doesn't support empty query"}(WSB||(WSB={})),function(n){let i;const f="UpsellDismissed",e="moreButton",r="feedbackButton",o="chatButtonLeft",s="chatButtonRight",h="optionsButton",c="rewardsBadgeButton",l="userProfileButton",a="closeButton",v="backButton",y="search-home-toggle",p="tp-search-toggle-",w="searchSettingsButton",u=4.5;let t=10;class b{constructor(u,y,p,b,k,d){if(this._page=u,this._accessTokenManager=y,this._msRewardsViewModel=p,this._menuFactory=b,this._substrateProfilePictureProvider=k,this._optionsWindow=d,this._moreButton={id:e,selected:!1,text:null},this._feedbackButton={id:r,selected:!1,text:null},this._optionsButton={id:h,selected:!1,text:null},this._rewardsBadgeButton={id:c,selected:!1,text:null},this._userProfileButton={id:l,selected:!1,text:null},this._closeButton={id:a,selected:!1,text:null},this._backButton={id:v,selected:!1,text:null},this._codexChatLeftButton={id:o,selected:!1,text:null},this._codexChatRightButton={id:s,selected:!1,text:null},this._searchSettingsButton={id:w,selected:!1,text:null},this._topHitPresent=!1,this._resultsPresent=!1,this._currentScopeTileIndex=-1,this._moreMenuOpened=!1,this._optionsMenuOpened=!1,this._userProfileMenuOpened=!1,this._shouldRenderScopes=!0,this._advancedOptionsIdCounter=0,this._advancedOptionsScope=[],this._shouldShowBuildNumber=!1,this._userProfilesCache={},this.menuDividerId=0,this._upsellGotDismissed=n.LightweightStorage.getItem(f)=="1",i=SearchAppWrapper.CortanaApp,n.shouldUseMsbEnterpriseScopes()){if(n.config.scopesOrderBeginMsbEnterprise.length==0)return}else if(n.config.scopesOrderBegin.length==0)return;const g=()=>{this._currentQuery&&this.renderScopes()};if(n.Host.bindAppHidden(()=>{this._scopeTiles=null,this._effectiveScopeOrder=null}),n.Host.bindQueryChangedOrInitialized(n=>{this._currentQuery=n,this._currentScopeTileIndex=-1}),n.Host.bindDismissed(()=>{this._shouldRenderScopes=!0,this._currentScopeTileIndex=-1,this._verifyAccountForAADRequired=!1,this._verifyAccountForMSARequired=!1}),n.Host.bindButtonRightOfSearchBoxClick(t=>{(t==""||t=="")&&(n.Host.reformulate(""),this.setFocusInSearchBox("clear search box"),n.InstrumentationHelper.logClientInstEvent("Select","ClearSearchBox",null))}),n.Host.bindScopeListRequiresUpdate(()=>{this.init(),g()}),n.Host.bindOnFeedbackClosing(t=>{var i;!t&&n.RuntimeConfig.AlwaysWide&&((i=_ge(r))===null||i===void 0?void 0:i.focus())}),n.Host.bindKeyDown((n,t)=>{t.ctrlKey&&n==13&&t.shiftKey&&(this._shouldShowBuildNumber=!0)}),n.config.disbaleWideForLargeTextScale&&(t=2),this._substrateUpsellDismiss={action:()=>{this._upsellGotDismissed=!0,n.LightweightStorage.setItem(f,"1"),n.Host.refreshCurrentPane()},icon:{content:"&#xE711",type:2}},p&&p.bindRewardsBadgeUpdated(()=>{this._shouldRenderScopes=n.config.optScopesRender,g()}),y){const t=()=>{if(this._currentQuery){const t=n.ScopeConfig[this._currentQuery.scope];this.refreshAdvancedOptionsScopeList(t);this.updateTopHitHeader()}},i=(i,r,u)=>{n.setVisibility(n.StaticHtmlElements.aadVerificationContainer,!1),i==0?(r=="https://substrate.office.com/SubstrateSearch-Internal.ReadWrite"||r=="https://substrate.office.com/M365.Access"||r=="service::cortana.bing.com::mbi_ssl"||r=="077c9b95-2f57-4442-8872-134fcc08fcb3/Bing.MSA.Default")&&(this._verifyAccountForMSARequired=u,t()):i==1&&(r=="https://substrate.office.com"&&(this._verifyAccountForAADRequired=u,n.isAADVerificationRequired=this._verifyAccountForAADRequired,t()),n.msbHost&&this._verifyAccountForAADRequired&&this.initializeAADVerification(i))};y.bindVerifyAccountRequired((n,t)=>{i(n,t,!0)});y.bindAccessTokenAvailable((n,t)=>{i(n,t,!1)})}}focusNextScopeTile(t,i){let u=[].slice.call(n.StaticHtmlElements.scopesHeader.getElementsByClassName("scope-tile")),r=n.shouldSkipSelectedScope()?u.filter(n=>!n.classList.contains("scope-tile--selected")):u;r=r.filter(n=>n.tabIndex==-1);this._currentScopeTileIndex=r.indexOf(t);i?this._currentScopeTileIndex!=r.length-1&&++this._currentScopeTileIndex:this._currentScopeTileIndex>0&&--this._currentScopeTileIndex;n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=u.indexOf(r[this._currentScopeTileIndex]));this._menuFactory.dismiss();u[this._currentScopeTileIndex].focus()}render(t,i,r,u,f,e){if(this._currentQuery=t,t){let o=n.getEffectiveScope(t);this.innerRender(t.scope,o,t,i,r,u,f,e,t.thirdPartySearch)}else this.cleanUp()}getScopeToolTip(t,i,r){let e=n.ScopeConfig[t],u=n.getScopeDisplayName(e),f;return(f=i&&!this._allScopeButtonPresent?"RemovingScopeNarratorText2":t==n.Scope.All?u.toLowerCase()==="windows"?"AddingDMAWindowsScopeNarratorText":"AddingScopeNarratorTextAll2":"AddingScopeNarratorText",n.isThirdPartySearchAllowed())?n.Host.getLocString(f,r!==null&&r!==void 0?r:u):n.Host.getLocString(f,u)}selectScope(n){this._selectedScope&&(this._selectedScope.tooltip=this.getScopeToolTip(this._selectedScope.type,!1),this._selectedScope.enabled=!1,this._selectedScope=null);for(let t of this._scopeTiles)if(t.enabled=t.type==n,t.enabled){t.tooltip=this.getScopeToolTip(n,!0);this._selectedScope=t;break}}selectThirdPartyScope(t){var i;if(!t)return!1;if(this._selectedScope){if(this._selectedScope.searchExtension!=undefined&&this._selectedScope.searchExtension.applicationUserModelId==t.applicationUserModelId)return!1;this._selectedScope.tooltip=this.getScopeToolTip(this._selectedScope.type,!1,(i=this._selectedScope.searchExtension)===null||i===void 0?void 0:i.displayName);this._selectedScope.enabled=!1;this._selectedScope=null}for(let i of this._scopeTiles)if(i.enabled=i.type==n.Scope.ThirdPartyWeb&&i.searchExtension!=undefined&&i.searchExtension.applicationUserModelId==t.applicationUserModelId,i.enabled)return i.tooltip=this.getScopeToolTip(i.type,!1,t.displayName),this._selectedScope=i,!0;return!1}innerRender(t,i,r,u,f,e,o,s,h){this._topHitPresent=u;this._resultsPresent=f;n.RuntimeConfig.ScopesAvailable&&(this._scopeTiles||this.init(),t===n.Scope.PathCompletion?this._selectedScope&&this._selectedScope.type!==n.Scope.All&&this.clearPrevSelectedScope():n.isThirdPartySearchAllowed()&&t==n.Scope.ThirdPartyWeb&&this._scopeTiles?this.selectThirdPartyScope(h):this._scopeTiles&&(!this._selectedScope||this._selectedScope.type!=t)&&this.selectScope(t));this.renderTopHitHeader(t,i,r,f,e,o,s);n.RuntimeConfig.ScopesAvailable&&(this.renderScopes(),this.renderTopBrandingBar());let c=this._advancedOptionsScope.filter(n=>n.layout==1||n.layout==6);c&&this._page.renderAdvancedOptionsMessages(c)}refreshAdvancedOptionsScopeList(t){this._advancedOptionsScope=n.RuntimeConfig.ScopesAvailable&&t.showUpsellOnSuggestionsList&&t.showUpsellOnSuggestionsList()?this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),0):[]}updateWorkScopeZIContent(t){var i,r,u,f,e,o,s;const h=!t&&n.canShowWorkScopeZiPageContent(this._currentQuery)&&!n.canShowCuratedSuggestionInEnterpriseScope(this._currentQuery);if(!h){(i=n.StaticHtmlElements.qfContainerScroll)===null||i===void 0?void 0:i.classList.remove("twoLayoutQfContainerScroll");(r=n.StaticHtmlElements.qfContainer)===null||r===void 0?void 0:r.classList.remove("twoLayoutMsbDsbContainerScroll","twoLayoutMsbDsbContainerScrollSmall");return}SearchAppWrapper.CortanaApp.entryPoint=="WNSGLY"&&((u=n.StaticHtmlElements.qfContainer)===null||u===void 0?void 0:u.classList.add("twoLayoutMsbDsbContainerScrollSmall"));n.isDSBAllowedInEntryPoint()&&n.Host.isDSBEnabledByClient()&&!(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockFRE)?(n.isDSBAllowedInEntryPoint()||(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockFRE))&&((o=n.StaticHtmlElements.qfContainerScroll)===null||o===void 0?void 0:o.classList.remove("twoLayoutQfContainerScroll","twoLayoutMsbDsbContainerScrollSmall"),(s=n.StaticHtmlElements.qfContainer)===null||s===void 0?void 0:s.classList.add("twoLayoutMsbDsbContainerScroll")):((f=n.StaticHtmlElements.qfContainer)===null||f===void 0?void 0:f.classList.remove("twoLayoutMsbDsbContainerScroll","twoLayoutMsbDsbContainerScrollSmall"),(e=n.StaticHtmlElements.qfContainerScroll)===null||e===void 0?void 0:e.classList.add("twoLayoutQfContainerScroll"))}getNoResultInstrumentData(t){var i;const r=!t&&((i=this._currentQuery)===null||i===void 0?void 0:i.isWorkScopeZI);if(!n.config.msbWorkNoResultLoggingEnabled||!r)return null;return n.InstrumentedItem.getNonSuggestionInstrumentedItem("WSNR",n.SyntheticQSCodesMaps.KValues,21)}renderTopHitHeader(t,i,r,u,f,e,o){if(!n.canShowSearchHomeAIFeed(r)){let s=n.ScopeConfig[i],a=r.showProgressBar?e:!f,v=!r||!r.queryToFetch;this.updateWorkScopeZIContent(u);let[h,c]=this.getEmptyResultsMessage(u,a,v,i,s,e,o),l=a||v||u||!this._lastRenderedTopHitHeader||n.uses3lineTemplate(i)?this.getHeaderText(i,s,r):this._lastRenderedTopHitHeader.headerText;if(this.refreshAdvancedOptionsScopeList(s),n.RuntimeConfig.AlwaysWide&&(this._advancedOptionsScope=this._advancedOptionsScope.concat(this.getAdvancedOptions(n.SequenceNumberManager.getSequenceNumber(),1))),!this._lastRenderedTopHitHeader||this._lastRenderedTopHitHeader.scope!=t||this._lastRenderedTopHitHeader.message!=h||this._lastRenderedTopHitHeader.subMessage!=c||this._lastRenderedTopHitHeader.headerText!=l||this._lastRenderedTopHitHeader.advancedOptions!=this._advancedOptionsScope||t==n.Scope.ThirdPartyWeb){this._lastRenderedTopHitHeader={scope:t,headerText:l,message:h,subMessage:c,advancedOptions:this._advancedOptionsScope,scopeForDisplay:i};let y={headerText:l,message:h,subMessage:c,messageIcon:h?s.icon:null,isTwoColumnsLayout:n.canShowMsbDsbInWorkScopeZi(this._currentQuery),freDataModel:this.getMsbFreDataModel(),instItem:this.getNoResultInstrumentData(u)};this._page.updateTopHitHeaderView(y)}}}updateTopHitHeader(){if(this._lastRenderedTopHitHeader){let t=n.ScopeConfig[this._lastRenderedTopHitHeader.scopeForDisplay];const i=this.getMsbFreDataModel();let r={headerText:this._lastRenderedTopHitHeader.headerText,message:this._lastRenderedTopHitHeader.message,subMessage:this._lastRenderedTopHitHeader.subMessage,messageIcon:this._lastRenderedTopHitHeader.message?t.icon:null,isTwoColumnsLayout:n.canShowMsbDsbInWorkScopeZi(this._currentQuery),freDataModel:i};this._page.updateTopHitHeaderView(r)}}getMsbFreDataModel(){var i;if(!n.canShowWorkFreZiPageContent(this._currentQuery))return undefined;let[r,u]=n.config.userProfileButtonEnabled?this.getUserProfileButtonData():[null,null];const t=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.getAadUserInfo();return{userProfileButtonDataModel:n.config.userProfileButtonEnabled&&r?{opened:this._userProfileMenuOpened,buttonClickHandler:null,icon:r,userName:u}:null,userFirstName:(t===null||t===void 0?void 0:t.userFirstName)||"",tenantName:(t===null||t===void 0?void 0:t.tenantName)||"",isWorkScopeZi:(i=this._currentQuery)===null||i===void 0?void 0:i.isWorkScopeZI}}shouldShowRewardsBadge(t){return n.RuntimeConfig.QfMode!=11&&(n.RuntimeConfig.AlwaysWide||!!t)}initializeAADVerification(){if(this._page!=null){const t=_ge("userProfileButton");(t||(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest))&&n.AccessTokenManager.getWindowsAccountType()==1&&n.msbHost&&this.createAADVerificationFlyout()}}getDMAToggleTiles(t){const i=[{id:y,selected:!t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("Select","Microsoft1PSearchToggleClicked",null,null,"WindowsTelemetry",33554432),n.Host.switchToSearchScope(),n.Host.setMRUSearchApp(),this.setFocusInSearchBox("scope clickHandler All")},label:n.isServicingSearchBingAs3PEnabled()?n.Host.getLocString("DmaAllScopeName"):n.Host.getLocString("SearchToggle"),tooltip:this.getScopeToolTip(n.Scope.All)}],r=n.Host.getThirdPartySearchApps();return r.forEach((r,u)=>{r.displayName&&i.push({id:p+u,selected:(t===null||t===void 0?void 0:t.applicationUserModelId)===r.applicationUserModelId,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("Select","3PSearchToggleClicked",null,null,"WindowsTelemetry",33554432),n.Host.switchToThirdPartyScope(r),n.Host.setMRUSearchApp(r),this.setFocusInSearchBox("scope clickHandler "+r.displayName)},label:r.displayName,tooltip:this.getScopeToolTip(n.Scope.ThirdPartyWeb,null,r.displayName)})}),i}getScopesHeaderDataModel(){var r,u,f,e,o,s,h,c,l;this._advancedOptionsIdCounter=0;let a=this.getScopeBarElements(),v=this.getHiddenScopeElements(a)||[],w=this._msRewardsViewModel&&!(n.config.isDMARegion||n.isThirdPartySearchAllowed())&&this._msRewardsViewModel.getDataModel();const b=(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isScopeListBrandingLogoEnabled())?this.getTenantBrandingDataModel():null,t=n.canShowSearchHomeAIFeed(this._currentQuery);let[p,k]=n.config.userProfileButtonEnabled?this.getUserProfileButtonData():[null,null],y;if(n.isChatScopeEnabled()&&(((r=this._currentQuery)===null||r===void 0?void 0:r.isSearchHomeZI)||((u=this._currentQuery)===null||u===void 0?void 0:u.scope)==n.Scope.Chat)){let t=((f=this._currentQuery)===null||f===void 0?void 0:f.scope)==n.Scope.Chat;y=[{id:"search-home-toggle",selected:!t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("ClientInst","ToggleClickSearch",null,null,"WindowsTelemetry",33554432),n.Host.reformulate("")},label:n.Host.getLocString("SearchToggle"),icon:{type:2,content:"&#xE721"}},{id:"chat-toggle",selected:t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("ClientInst","ToggleClickChat",null,null,"WindowsTelemetry",33554432),n.Host.switchToScope(n.Scope.Chat)},label:n.Host.getLocString("ChatToggle"),iconComponent:"ChatWithBingIcon",iconComponentProps:{id:"chatToggle"}}]}if(n.config.useCobaltCSS&&n.RuntimeConfig.AlwaysWide&&!n.isSupportWebResultsInAllScopeInDMAEnabled()&&n.isThirdPartySearchAllowed()&&n.isThirdPartyZeroInputEnabledByRegionalPolicy()&&(((e=this._currentQuery)===null||e===void 0?void 0:e.isThirdPartyZI)||!((o=this._currentQuery)===null||o===void 0?void 0:o.originalQuery))&&n.Host.isThirdPartySearchAppsEnabled()){let n=(s=this._currentQuery)===null||s===void 0?void 0:s.thirdPartySearch;y=this.getDMAToggleTiles(n)}const i=n.Host.getLocString("AskCopilot");return{isWin11DSB:n.isWin11DSB(this._currentQuery)||n.config.wsbWithCopilotQF,isWorkScopeHomePage:(h=this._currentQuery)===null||h===void 0?void 0:h.isWorkScopeZI,isSearchHome:(c=this._currentQuery)===null||c===void 0?void 0:c.isSearchHomeZI,isCopilotSearchHome:t,scopes:n.config.pureRender?n.deepCopy(a):a,showFeedback:this.isFeedbackEnabled()?()=>this.showFeedback():null,scopesBackBtnHandler:()=>this.scopesBackBtnClicked(),scopesLeftCaretBtnHandler:()=>this.scopesLeftCaretClicked(),scopesRightCaretBtnHandler:()=>this.scopesRightCaretClicked(),shouldShowRewardBalance:n.RuntimeConfig.AlwaysWide||((l=this._currentQuery)===null||l===void 0?void 0:l.scope)==n.Scope.All,rewardsBadgeDataModel:!t&&this.shouldShowRewardsBadge(this._currentQuery)&&w,moreMenuDataModel:v.length>0?{opened:this._moreMenuOpened,menuItems:v,buttonClickHandler:(n,t,i)=>this._moreMenuOpened?this.closeMoreMenuDropDown():this.openMoreMenuDropDown(v,n,t,i)}:null,optionsMenuDataModel:{opened:this._optionsMenuOpened,buttonClickHandler:(n,t,i)=>this._optionsMenuOpened?this.closeOptionsMenuDropDown():this.openOptionsMenuDropDown(n,t,i)},userProfileButtonDataModel:n.config.userProfileButtonEnabled&&p?{opened:this._userProfileMenuOpened,buttonClickHandler:(n,t,i)=>this._userProfileMenuOpened?this.closeUserProfileDropDown():this.openUserProfileDropDown(n,t,i),icon:p,userName:k}:null,brandBarDataModel:b,closeButtonClickHandler:(n,t,i)=>this.closeButtonClicked(n,t,i),codexChatLeftDataModel:n.isCodexEligible()&&n.config.codexSimple&&!t?{buttonClickHandler:async(n,t,i)=>await this.chatButtonClicked(n,t,!0,i),iconText:n.Host.getLocString("CodexChatButton"),toolTip:i,ariaText:i}:undefined,codexChatRightDataModel:n.isCodexEligible()&&n.config.codexBtnUpperRight&&!t?{buttonClickHandler:async(n,t,i)=>await this.chatButtonClicked(n,t,!1,i),toolTip:i,ariaText:i}:undefined,searchHomeToggleTiles:y,isFullWidthDSB:n.shouldShowDSBFullWidth(),enableDsbWebMruInWebScope:n.canEnableDsbWebMruInWebScope(this===null||this===void 0?void 0:this._currentQuery),enableSearchSettingsButton:n.config.wsbSettingsIconEntryPoint,searchSettingsHandler:()=>n.Host.launchSearchSettings(),inConversationMode:n.Host.isInConversationMode()}}renderScopes(){var t,i,r;(!n.config.optScopesRender||this._currentQuery&&this._currentQuery.scopePrefix||(this._selectedScope?this._selectedScope.selected==!1||((t=this._currentQuery)===null||t===void 0?void 0:t.scope)==n.Scope.Work:((i=this._currentQuery)===null||i===void 0?void 0:i.scope)==n.Scope.All)||this._moreMenuOpened||this._optionsMenuOpened)&&(this._shouldRenderScopes=!0);this._shouldRenderScopes&&(this._page.updateScopesHeaderView(this.getScopesHeaderDataModel()),(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072))&&n.config.useCobaltCSS&&((r=this._selectedScope)===null||r===void 0?void 0:r.type)==n.Scope.ThirdPartyWeb&&!n.isServicingSearchBingAs3PEnabled()&&this.scopesRightCaretClicked(),this._shouldRenderScopes=!1,n.config.useCobaltCSS&&n.RuntimeConfig.AlwaysWide&&this.scopesPresentInstrumentationLog())}scopesPresentInstrumentationLog(){n.isWin11DSB(this._currentQuery)||n.InstrumentationHelper.logClientInstEvent("ClientInst","ScopesArePresent",null,null,"WindowsTelemetry",33554432)}getTenantBrandingDataModel(){var t;if(n.msbHost){const i=n.msbHost.getTenantBranding(),r=n.shouldShowDSBLayout(this._currentQuery)&&n.config.msbDsbUseServerGleam&&n.config.undocked&&n.msbHost.tenantHasLogo();if(r)return null;if(!!i)return{msbBranding:i,isWin11DSB:n.isWin11DSB(this._currentQuery),areScopesVisibile:(t=this._currentQuery)===null||t===void 0?void 0:t.isWorkScopeZI}}return null}renderTopBrandingBar(){const t=_ge("msbTopBrandingBar");if(t){if(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isTopBrandingBarEnabled()){const n=this.getTenantBrandingDataModel();if(n===null||n===void 0?void 0:n.msbBranding){this._page.updateTopBrandingBarView(n);return}}this._page.updateTopBrandingBarView(null)}}createAADVerificationFlyout(){let t=this._page.createFlyout("AADVerification");if(t==null){n.StaticHtmlElements.root.classList.remove("aadVerificationContainer");return}t.addMessage("aadVerification");let i="VFO",r=n.SequenceNumberManager.getSequenceNumber(),u=n.InstrumentedItem.getNonSuggestionInstrumentedItem(i,n.SyntheticQSCodesMaps.KValues,24);n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(r,i,u);const f=_ge("userProfileButton");t.target(f,"Left").button("aadverificationFlyout",()=>{const t=()=>{n.Host.refreshCurrentPane(),n.Host.setFocusInSearchBox(null,"AADVerificationFlyout")};let i=()=>{n.InstrumentationHelper.logClientInstEvent("Select","AADVerificationFlyoutVerifyButtonSucceed",null,null,"WindowsTelemetry",16777216),t()},r=()=>{n.InstrumentationHelper.logClientInstEvent("Select","AADVerificationFlyoutVerifyButtonFailed",null,null,"WindowsTelemetry",16777216),t()};this._accessTokenManager.promptAutheticateDialog(1,n.getSubstrateResourceOrScope(1),i,r)},0);this._page.renderAADVerificationAreaView(t.dataModel())}getInstItem(t,i){let r=n.InstrumentedItem.getNonSuggestionInstrumentedItem(t,n.SyntheticQSCodesMaps.KValues,n.SyntheticQSCodesMaps.HandoffsForNonSuggestions[t]);return n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(i,t,r),r}closeButtonClicked(t,i,r){let u=n.SequenceNumberManager.getSequenceNumber(),f=this.getInstItem("CB",u);n.InstrumentationHelper.instrumentItemClick(t,f,u,null,i,r);SearchAppWrapper.CortanaApp.dismissApp()}openMoreMenuDropDown(t,i,r,u){let f=n.SequenceNumberManager.getSequenceNumber(),e=this.getInstItem("MMB",f);n.InstrumentationHelper.instrumentItemClick(i,e,f,null,r,u);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(t,document.getElementById(this._moreButton.id),1,()=>{n.safeSetTimeout(()=>this.closeMoreMenuDropDown(),0,"closeMoreMenuDropDown")},r);this._moreMenuOpened=!0;this.renderScopes()}closeMoreMenuDropDown(){this._moreMenuOpened=!1;this.renderScopes()}openOptionsMenuDropDown(t,i,r){let f=n.RuntimeConfig.AlwaysWide||n.config.wsbWithCopilotQF?1:2,u=n.SequenceNumberManager.getSequenceNumber(),e=this.getAdvancedOptions(u,f),o=this.getInstItem("OMB",u);n.InstrumentationHelper.instrumentItemClick(t,o,u,null,i,r);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(e,document.getElementById(this._optionsButton.id),2,()=>{n.safeSetTimeout(()=>this.closeOptionsMenuDropDown(),0,"closeOptionsMenuDropDown")},i);this._optionsMenuOpened=!0;this.renderScopes()}closeOptionsMenuDropDown(){this._optionsMenuOpened=!1;this._shouldShowBuildNumber=!1;this.renderScopes()}openUserProfileDropDown(t,i){let r=n.SequenceNumberManager.getSequenceNumber(),u=this.getAccountOptionsForUserProfileButton(r),f=this.getInstItem("APB",r);n.InstrumentationHelper.instrumentItemClick(t,f,r,null,i,null);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(u,document.getElementById(this._userProfileButton.id),2,()=>{n.safeSetTimeout(()=>this.closeUserProfileDropDown(),0,"closeUserProfileDropDown")},i);this._userProfileMenuOpened=!0;this.renderScopes()}closeUserProfileDropDown(){this._userProfileMenuOpened=!1;this.renderScopes()}cleanUp(){_w.ReactDOM&&(ReactDOM.unmountComponentAtNode(n.StaticHtmlElements.topResults),ReactDOM.unmountComponentAtNode(n.StaticHtmlElements.groups),ReactDOM.unmountComponentAtNode(n.StaticHtmlElements.topHitHeader),ReactDOM.unmountComponentAtNode(n.StaticHtmlElements.scopesHeader));this._lastRenderedTopHitHeader=null;this._page.updateTopHitHeaderView(null);this._page.updateScopesHeaderView(null)}scopeNamesElements(t){return t.map(t=>this._scopeTiles.find(i=>n.Scope[i.type]==t)).filter(n=>!!n)}getEffectiveScopeOrder(){if(!this._scopeTiles||this._scopeTiles.length==0)return[];if(n.config.disbaleWideForLargeTextScale&&this._effectiveScopeOrder&&!n.config.pathCompletionReplacesAll&&!n.config.useCobaltCSS)return n.RuntimeConfiguration.TextScaleFactor<=1.25?this._effectiveScopeOrder.slice(0):n.RuntimeConfiguration.TextScaleFactor<=1.5?this._effectiveScopeOrder.slice(0,this._effectiveScopeOrder.length-1):n.RuntimeConfiguration.TextScaleFactor<=1.75?this._effectiveScopeOrder.slice(0,this._effectiveScopeOrder.length-2):n.RuntimeConfiguration.TextScaleFactor<=2.25?this._effectiveScopeOrder.slice(0,this._effectiveScopeOrder.length-3):this._effectiveScopeOrder.slice(0,this._effectiveScopeOrder.length-3);if(this._effectiveScopeOrder&&!n.config.pathCompletionReplacesAll)return this._effectiveScopeOrder.slice(0);let t,i,u;n.shouldUseMsbEnterpriseScopes()?n.RuntimeConfig.AlwaysWide?(t=n.config.scopesOrderBeginAlwaysWideMsbEnterprise,i=n.config.scopesOrderLastAlwaysWide,u=n.config.numberOfScopesToRenderAlwaysWideMsbEnterprise):(t=n.config.scopesOrderBeginMsbEnterprise,i=n.config.scopesOrderLast,u=n.config.numberOfScopesToRenderMsbEnterprise):n.RuntimeConfig.AlwaysWide?(t=n.config.scopesOrderBeginAlwaysWide,i=n.config.scopesOrderLastAlwaysWide,u=n.config.numberOfScopesToRenderAlwaysWide):(t=n.isServicingSearchBingAs3PEnabled()?n.config.scopesOrderBeginTP:n.config.scopesOrderBegin,i=n.config.scopesOrderLast,u=n.config.numberOfScopesToRender);let r=[];if(t){n.config.pathCompletionReplacesAll&&(i=i.filter(n=>n!="PathCompletion"),this._currentQuery&&this._currentQuery.canBePathCompletion&&(t=t.map(n=>n=="All"?"PathCompletion":n)));let f=i?this.scopeNamesElements(i):[];if(r=this.scopeNamesElements(t),n.isServicingSearchBingAs3PEnabled()&&this._scopeTiles){let t=this._scopeTiles.filter(t=>t.type===n.Scope.ThirdPartyWeb);t.length>0&&r.splice(1,0,...t)}r=r.slice(0,u-f.length);r.push(...f)}return this._effectiveScopeOrder=r,r.slice(0)}getHiddenScopeElements(t){if(!this._moreScopeTiles)return[];if(n.config.useCobaltCSS){let i=["scope2","scope11","scope7","scope3"];if(n.isThirdPartySearchAllowed()){let r=n.Host.getThirdPartySearchApps().length,t=Array.from({length:r},(n,t)=>"scope"+(1e4+t));i=n.isServicingSearchBingAs3PEnabled()?[...t,"scope1","scope6","scope2","scope11","scope7","scope3"]:["scope2","scope11","scope7","scope3",...t]}const r=[];for(let n=0;n<this._moreScopeTiles.length;n++){let t=this._moreScopeTiles.filter(({id:t})=>t===i[n]);r.push(...t)}return n.isThirdPartySearchAllowed()&&!n.RuntimeConfig.AlwaysWide?r.filter(i=>!t.some(t=>{var r,u;return t.type==n.Scope.ThirdPartyWeb?((r=t.searchExtension)===null||r===void 0?void 0:r.applicationUserModelId)==((u=i.searchExtension)===null||u===void 0?void 0:u.applicationUserModelId):t.type==i.type})):r}return this._moreScopeTiles.filter(i=>{const r=t.find(t=>{var r,u;return t.type==n.Scope.ThirdPartyWeb?((r=t.searchExtension)===null||r===void 0?void 0:r.applicationUserModelId)==((u=i.searchExtension)===null||u===void 0?void 0:u.applicationUserModelId):t.type==i.type});return!r&&n.Scope[i.type]!="PathCompletion"&&n.Scope[i.type]!="All"})}getScopeBarElements(){var i;if(!this._scopeTiles)return[];let t=this.getEffectiveScopeOrder();if(n.config.useCobaltCSS&&n.RuntimeConfig.AlwaysWide){let r=this.getHiddenScopeElements(t)||[],u=r.findIndex(n=>{var t;return(n===null||n===void 0?void 0:n.type)==((t=this._selectedScope)===null||t===void 0?void 0:t.type)});n.isThirdPartySearchAllowed()&&((i=this._selectedScope)===null||i===void 0?void 0:i.type)==n.Scope.ThirdPartyWeb&&(u=r.findIndex(n=>{var t,i,r;return((t=n===null||n===void 0?void 0:n.searchExtension)===null||t===void 0?void 0:t.applicationUserModelId)==((r=(i=this._selectedScope)===null||i===void 0?void 0:i.searchExtension)===null||r===void 0?void 0:r.applicationUserModelId)}));u>=0&&(r[u].enabled=!0);let f=t.map(n=>n.type);t=t.concat(r.filter(n=>f.indexOf(n.type)==-1));this._scopeTiles=t}else{let i=t.some(n=>n.enabled);if(!i&&this._selectedScope&&(!n.config.pathCompletionReplacesAll||n.Scope[this._selectedScope.type]!="PathCompletion")){if(n.isServicingSearchBingAs3PEnabled()){let r;this._selectedScope.type==n.Scope.ThirdPartyWeb?(i=t.some(n=>{var t,i,r;return((t=n.searchExtension)===null||t===void 0?void 0:t.applicationUserModelId)==((r=(i=this._selectedScope)===null||i===void 0?void 0:i.searchExtension)===null||r===void 0?void 0:r.applicationUserModelId)}),i||(r=this._scopeTiles.find(n=>{var t,i,r;return((t=n.searchExtension)===null||t===void 0?void 0:t.applicationUserModelId)==((r=(i=this._selectedScope)===null||i===void 0?void 0:i.searchExtension)===null||r===void 0?void 0:r.applicationUserModelId)}),t.push(r))):(r=this._scopeTiles.find(n=>n.type==this._selectedScope.type),t.push(r))}else{let i=this._scopeTiles.find(t=>{var i,r,u;return this._selectedScope.type==n.Scope.ThirdPartyWeb?((i=t.searchExtension)===null||i===void 0?void 0:i.applicationUserModelId)==((u=(r=this._selectedScope)===null||r===void 0?void 0:r.searchExtension)===null||u===void 0?void 0:u.applicationUserModelId):t.type==this._selectedScope.type});t.push(i)}i=!0}}return t}isFeedbackEnabled(){return n.isBingEnabled()&&!n.isServicingSearchBingAs3PEnabled()}showFeedback(){n.Host.showFeedbackForm();this._msRewardsViewModel&&this._msRewardsViewModel.hide()}sliderDirection(t){const u=_qs(".scope-with-background__slider"),i=_qs(".scope-with-background__leftCaret"),r=_qs(".scope-with-background__rightCaret"),f=n.isRtl();u&&i&&r&&(f?t==2||t==0?(r.classList.add("b_hide"),i.classList.remove("b_hide")):(i.classList.add("b_hide"),r.classList.remove("b_hide")):t==1||t==0?(i.classList.add("b_hide"),r.classList.remove("b_hide")):(r.classList.add("b_hide"),i.classList.remove("b_hide")),t==0&&(u.scrollLeft=0))}sliderDirectionLargeTextSize(t){const i=_qs(".scope-with-background__slider"),r=_qs(".scope-with-background__leftCaret"),u=_qs(".scope-with-background__rightCaret"),f=n.isRtl();i&&r&&u&&(f?t==2||t==0?(console.log(i.scrollLeft,i.clientWidth,i.scrollWidth),i.scrollLeft+i.clientWidth>=i.scrollWidth&&(console.log("should hide right button"),u.classList.add("b_hide"),r.classList.remove("b_hide"))):i.scrollLeft<5&&(r.classList.add("b_hide"),u.classList.remove("b_hide")):t==1||t==0?i.scrollLeft<5&&(r.classList.add("b_hide"),u.classList.remove("b_hide")):(console.log(i.scrollLeft,i.clientWidth,i.scrollWidth),i.scrollLeft+i.clientWidth>=i.scrollWidth&&(console.log("should hide right button"),u.classList.add("b_hide"),r.classList.remove("b_hide"))),t==0&&(i.scrollLeft=0))}scopesSlider(t,i,r){const u=_qs(".scope-with-background__slider"),o=n.isRtl();if(u){let f=u.scrollWidth;n.config.disbaleWideForLargeTextScale?(this.sliderDirectionLargeTextSize(t),f=u.offsetWidth):this.sliderDirection(t);let e=0,s=setInterval(()=>{o?t===2?u.scrollLeft-=r:t===1&&(u.scrollLeft+=r):t===1?u.scrollLeft-=r:t===2&&(u.scrollLeft+=r),e>=f&&window.clearInterval(s),e+=r},i)}}scopesBackBtnClicked(){(n.RuntimeConfig.AlwaysWide||n.config.wsbWithCopilotQF)&&(this.scopesSliderReset(),n.Host.reformulate(""),n.InstrumentationHelper.logClientInstEvent("Select","ScopeBackBtnSelected",null,null,"WindowsTelemetry",33554432))}scopesSliderReset(i){this.scopesSlider(0,u,t);i&&n.RuntimeConfig.AlwaysWide&&this._selectedScope&&this._selectedScope.type!==n.Scope.All&&this.clearPrevSelectedScope()}clearPrevSelectedScope(){if(this._scopeTiles)for(let t of this._scopeTiles)t.type===n.Scope.All?(t.enabled=!0,this._selectedScope=t):t.enabled=!1}scopesLeftCaretClicked(){this.scopesSlider(1,u,t)}scopesRightCaretClicked(){this.scopesSlider(2,u,t)}getHeaderText(t,i,r){if(n.RuntimeConfig.FlatListWithoutGroups)return null;let u=n.getScopeDisplayName(i);if(n.isThirdPartySearchAllowed()&&t==n.Scope.ThirdPartyWeb)return n.isServicingSearchBingAs3PEnabled()&&(r===null||r===void 0?void 0:r.isThirdPartyZI)?n.Host.getLocString("SuggestedSection"):n.Host.getLocString("BestMatch");if(u){if(this._topHitPresent)if(t==n.Scope.All||t==n.Scope.PathCompletion){let t=n.config.quickMatchLabel?"QuickMatch":"BestMatch";return n.Host.getLocString(t)}else{let i=this.getBestMatchScopeName(t);return n.Host.getLocString(i,u)}if(this._resultsPresent)return null;if(t!=n.Scope.All)return u}return n.Host.getLocString("BestMatch")}getBestMatchScopeName(t){return n.config.quickMatchLabel?`QuickMatchFor${n.Scope[t]}`:`BestMatchFor${t===n.Scope.Work?this.getWorkScopeName():n.Scope[t]}`}getWorkScopeName(){return(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isEduTenant())?"School":"Work"}getEmptyResultsMessage(t,i,r,u,f,e,o){var s;return n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9||t||!i&&!r||u!=n.Scope.Documents&&(f===null||f===void 0?void 0:f.showUpsellOnSuggestionsList)&&f.showUpsellOnSuggestionsList()?["",""]:(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.qfUtils.isDocumentZeroQueryEnabled())&&u==n.Scope.Documents?e&&o===!1&&(f===null||f===void 0?void 0:f.getEmptyZIMessages)?f.getEmptyZIMessages():["",""]:u==n.Scope.All&&n.isDSBFullWidthFlightEnabled()&&n.isDynamicSearchContentPossible()&&SearchAppWrapper.CortanaApp.entryPoint=="WNSDSB"&&!n.isMsbDsbEnabled()&&n.isBrowserOnline()?["",""]:r&&(f===null||f===void 0?void 0:f.getEmptyZIMessages)?f.getEmptyZIMessages():[n.Host.getLocString("NoResults",(s=this._currentQuery)===null||s===void 0?void 0:s.queryToFetch),""]}init(){if(n.initScopePrefixes(),this._scopeTiles=[],this._moreScopeTiles=[],n.RuntimeConfig.ScopesAvailable){let t;t=n.shouldUseMsbEnterpriseScopes()?n.RuntimeConfig.AlwaysWide?n.config.scopesOrderBeginAlwaysWideMsbEnterprise:n.config.scopesOrderBeginMsbEnterprise:n.RuntimeConfig.AlwaysWide?n.config.scopesOrderBeginAlwaysWide:n.isServicingSearchBingAs3PEnabled()?n.config.scopesOrderBeginTP:n.config.scopesOrderBegin;this._allScopeButtonPresent=n.contains(t,"All");for(let t in n.ScopeConfig){let r=parseInt(t),i=n.ScopeConfig[r];if((i.prefixes||i.prefixesLocString||i.scopeNameLocString)&&n.isScopeEnabled(r,i)){if(n.isThirdPartySearchAllowed()&&r==n.Scope.ThirdPartyWeb){let t=n.Host.getThirdPartySearchApps();this._scopeTiles.push(...this.createThirdPartyScopeElements(t,i,!1));this._moreScopeTiles.push(...this.createThirdPartyScopeElements(t,i,!0));continue}(r!=n.Scope.All||this._allScopeButtonPresent)&&this._scopeTiles.push(this.createScopeElement(r,i,!1));this._moreScopeTiles.push(this.createScopeElement(r,i,!0))}}this._moreScopeTiles.sort((t,i)=>{if(t.type==n.Scope.All)return-1;if(i.type==n.Scope.All)return 1;if(n.isServicingSearchBingAs3PEnabled()){if(t.type==n.Scope.ThirdPartyWeb)return-1;if(i.type==n.Scope.ThirdPartyWeb)return 1}else{if(t.type==n.Scope.ThirdPartyWeb)return 1;if(i.type==n.Scope.ThirdPartyWeb)return-1}return t.text.localeCompare(i.text)});this._selectedScope&&this.selectScope(this._selectedScope.type);this._effectiveScopeOrder=null}}createThirdPartyScopeElements(t,i,r){let f=[],u=n.Scope.ThirdPartyWeb,e=0;return t.forEach(n=>{f.push({isScopeElement:!0,id:(r?"scope":"l1scope")+(u+e++),type:u,enabled:!1,text:n.displayName,title:null,icon:i.icon,click:()=>this.thirdPartyClickHandler("scopeBar",n),selected:!1,tooltip:this.getScopeToolTip(u,null,n.displayName),isSelectable:!0,searchExtension:n})}),f}createScopeElement(t,i,r){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:()=>this.clickHandler(t,"scopeBar"),selected:!1,tooltip:this.getScopeToolTip(t,!1),isSelectable:!0}}thirdPartyClickHandler(t,i){if(n.isThirdPartySearchAllowed()){let u=i.displayName,r=this._currentQuery,e=r.scope;this._shouldRenderScopes=!0;u&&n.isThirdPartyMRUEnabledByRegionalPolicy()&&n.Host.setMRUSearchApp(i);let f=this.selectThirdPartyScope(i);if(u&&f){this.innerRender(n.Scope.ThirdPartyWeb,n.Scope.ThirdPartyWeb,r,this._topHitPresent,this._resultsPresent,!0,!1,undefined,i);let t={query:this._currentQuery,topResults:[],groups:[]};this._page.updateTopResultsView(t,!1);this._page.updateGroupsView(t,!1)}let o=n.Scope[n.Scope.ThirdPartyWeb],s={Scope:o,Source:t,ThirdPartyAppName:i.displayName,ThirdPartyId:i.applicationUserModelId};n.InstrumentationHelper.logClientInstEvent("Select","ScopeChanged",null,s,"WindowsTelemetry",33554432);(e!=n.Scope.ThirdPartyWeb||f)&&n.Host.switchToThirdPartyScope(i,r.queryToFetch);this.setFocusInSearchBox("scope clickHandler "+i.displayName)}}clickHandler(t,i,r){let o=n.getScopeDisplayName(n.ScopeConfig[t]);n.config.msbDsbScopeBarChangeGleam&&(n.msbDsbHost===null||n.msbDsbHost===void 0?void 0:n.msbDsbHost.setLastSelectedScope(t));let e,u=this._currentQuery,f=u.scope;if(this._shouldRenderScopes=!0,this._scopeTiles.some(n=>n.type==f)||(f=n.Scope.All),o&&f!=t){e=(t==n.Scope.All||t==n.Scope.PathCompletion?"":o+": ")+u.queryToFetch;this.innerRender(t,t,u,this._topHitPresent,this._resultsPresent,!0,!1);let i={query:this._currentQuery,topResults:[],groups:[]};this._page.updateTopResultsView(i,!1);this._page.updateGroupsView(i,!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)}n.isThirdPartySearchAllowed()&&n.Host.setMRUSearchApp();let s=n.Scope[t],h={Scope:s,Source:i,GroupSource:r&&r.source?r.source.toString():undefined};n.InstrumentationHelper.logClientInstEvent("Select","ScopeChanged",null,h,"WindowsTelemetry",33554432);f!=t&&n.Host.reformulate(e,undefined,undefined,r);this.setFocusInSearchBox("scope clickHandler "+s)}setFocusInSearchBox(t){n.Host.setFocusInSearchBox(null,t);let i=n.getCurrentActiveElement();i&&i.blur()}isScopeElement(t){return t&&this._scopeTiles&&(this.isScopeButton(t.id)||n.contains(this._scopeTiles,t))}isMenuElement(n){return n&&this.isMenuButton(n.id)}isScopeButton(n){return n==this._feedbackButton.id||n==this._rewardsBadgeButton.id||n==this._userProfileButton.id||n==this._closeButton.id||n==this._backButton.id||n==this._codexChatLeftButton.id||n==this._codexChatRightButton.id||n==this._searchSettingsButton.id||n==y||(n===null||n===void 0?void 0:n.startsWith(p))||this.isMenuButton(n)}isMenuButton(n){return n==this._moreButton.id||n==this._optionsButton.id}getSelectableItems(){let t=[];n.RuntimeConfig.ScopesAvailable&&(t=t.concat(this.getScopeSelectableItems()));let i=this._advancedOptionsScope.filter(n=>n.layout==0||n.layout==6);return i.length>0&&(t=t.concat(i)),t}getSelectableItemsByGroup(){let t=[],i=this.getScopeBarElements();if(n.shouldSkipSelectedScope()&&this._selectedScope==i[0]&&(i=i.slice(1)),n.isWin11DSB(this._currentQuery))n.isThirdPartySearchAllowed()&&n.Host.isThirdPartySearchAppsEnabled()&&t.push(this.getDMAToggleTiles());else{t.push(i.slice(0,1));let r=i.findIndex(n=>n.selected);if(r>0)t.push(i.slice(r,r+1));else if(!n.shouldSkipSelectedScope()){let n=i.findIndex(n=>n.enabled);n>0&&t.push(i.slice(n,n+1))}}const u=[this._backButton,this._codexChatLeftButton].map(n=>_ge(n.id)?[n]:undefined).filter(n=>n),f=[this._moreButton,this._rewardsBadgeButton,this._userProfileButton,this._feedbackButton,this._searchSettingsButton,this._optionsButton,this._closeButton,this._codexChatRightButton].map(n=>_ge(n.id)?[n]:undefined).filter(n=>n);t=[...u,...t,...f];let r=this._advancedOptionsScope.filter(n=>n.layout==0||n.layout==6);return r.length>0&&t.push(...r.map(n=>[n])),t}getScopeSelectableItems(){var u,f;let i=this.getScopeBarElements(),t=this._currentScopeTileIndex,y=i.length;if(n.isWin11DSB(this._currentQuery)&&!((u=this._currentQuery)===null||u===void 0?void 0:u.isWorkScopeZI))return t<0&&(t=0),this.getSelectableItemsByGroup()[t];if(n.shouldSkipSelectedScope()&&this._selectedScope==i[0]&&(i=i.slice(1),--t,--y),t<0&&this._selectedScope&&!n.shouldSkipSelectedScope())return[this._selectedScope];else{let u=n.getCurrentActiveElement();if(u)switch(u.id){case e:return[this._moreButton];case w:return[this._searchSettingsButton];case r:return[this._feedbackButton];case h:return[this._optionsButton];case c:return[this._rewardsBadgeButton];case l:return[this._userProfileButton];case a:return[this._closeButton];case v:return[this._backButton];case o:return[this._codexChatLeftButton];case s:return[this._codexChatRightButton]}return!n.isCodexEligible()||!n.config.codexSimple||((f=this._currentQuery)===null||f===void 0?void 0:f.isSearchHomeZI)?!n.config.useCobaltCSS||!n.RuntimeConfig.AlwaysWide||!n.isSupportWebResultsInAllScopeInDMAEnabled()&&n.isThirdPartySearchAllowed()||--t:--t,(t<0||t>=y)&&(t=0),i.slice(t,t+1)}}getSelectedItem(){return null}select(t){let i=[].slice.call(n.StaticHtmlElements.scopesHeader.getElementsByClassName("scope-tile")),r=n.shouldSkipSelectedScope()?i.filter(n=>!n.classList.contains("scope-tile--selected")):i;this._currentScopeTileIndex=r.indexOf(_ge(t.id));n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=i.indexOf(r[this._currentScopeTileIndex]))}onAfterKeyDown(){return!1}getSubstrateUpsellClickHandler(t){let i=()=>{n.Host.refreshCurrentPane(),n.Host.setFocusInSearchBox(null,"SubstrateUpsell")};return()=>this._accessTokenManager.promptAutheticateDialog(t,n.getSubstrateResourceOrScope(t),i,i)}getSubstrateUpsell(t,i,r){let s=null,u="VerifyAccountToSearch",f=0,h="CloudSearch",c=["Verify"],e=null,o=[];if(r==0){let s=n.getEffectiveScope(this._currentQuery);f=6;let i=this._accessTokenManager?this._accessTokenManager.getCachedAccountInfo(t):null;i&&o.push(i.accountUserName);let r=[n.Scope.People,n.Scope.Emails,n.Scope.Documents];n.config.accountVerificationInAllScope&&r.push(n.Scope.All);n.contains(r,s)&&(o.length>0&&(u="VerifyAccount"),e=this._substrateUpsellDismiss);h=""}else r==2&&(u=null,f=2,s={content:"&#xE9BE",type:2,needsAccentColor:!0},e=this._substrateUpsellDismiss,c=["VerifyAccountToSearch"]);return this.createAdvancedOption(t==1?"COFA":"COOA",i,h,u,c,this.getSubstrateUpsellClickHandler(t),f,e,s,null,o,"VerifyButton")}getOneDriveUpsell(t){return this.createAdvancedOption("SDSC",t,null,null,["SeeResultsFromOneDrive"],()=>{n.Host.launchCortanaSignInAsync()},2,null,{content:"&#xE9BE",type:2,needsAccentColor:!1})}getIndexingOption(t){let i=n.config.controlPanelSearchSettings?()=>n.Host.launchSearchSettingsAsync():()=>n.LocalDataProvider.launchIndexingOptions(!1);return this.createAdvancedOption("OMIO",t,"",null,["OptionsMenuIndexing"],i,2,null,{type:2,content:"&#xED52"})}getAdvancedOptionCssClass(n,t){return n==4?t?"menuInfo selectedAccount":"menuInfo":n==5?"menuLabel":null}createContextMenuGroup(n,t,i,r){let u=this.createAdvancedOption(n,t,null,i,null,null,5);return u.groupItems=r,u.narratorText=u.message,u}createBuildVersionOption(){const 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}}createDebugFallbackOption(t){return this.createAdvancedOption(null,t,"FallbackBundleText",null,["FallbackBundleText"],()=>n.fallbackToPrepopulatedBundle(new Error("Fallback button clicked")),2,null,{type:2,content:"&#xE81F"})}createAdvancedOption(t,i,r,u,f,e,o,s,h,c,l,a,v){let p;t&&(p=this.getInstItem(t,i));let w="advancedOption"+this._advancedOptionsIdCounter++;c&&c.length==0&&(c=null);let y={id:w,selected:!1,title:n.Host.getLocString(r),message:u?n.Host.getLocString(u,...(l?l:[])):null,text:f?n.Host.getLocString(f[0]):null,instItem:p,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,toggleType:v};return y.narratorText=y.text,y.click=e?(t,i)=>{p&&n.InstrumentationHelper.instrumentItemClick(t,p,n.SequenceNumberManager.getSequenceNumber(),null,i,null),e(y)}:undefined,y}getAccountOptions(t,i){let u=[];if(!this._accessTokenManager)return u;let f=this._accessTokenManager.getCachedAccountInfo(0),e=this._accessTokenManager.getCachedAccountInfo(1),c=this._accessTokenManager.isMsaAvailable(),l=this._accessTokenManager.isAadAvailable(),o="menuItemWithButton focusable",s="removeHover",h="highlight",r;return(f||e)&&!i&&(r=this.createAdvancedOption(null,t,null,"ConnectedAccounts",null,null,5),r.cssClass=this.getAdvancedOptionCssClass(5),u.push(r),f&&n.isCloudSearchEnabledMsaCache&&(r=this.createAdvancedOption(null,t,null,null,["MicrosoftAccount"],null,4),r.message=f.accountUserName,r.narratorText=r.message,r.cssClass=this.getAdvancedOptionCssClass(4),n.isSubstrateOutlookAccountConnected||(r.cssClass+=" "+h),u.push(r),this._verifyAccountForMSARequired&&(r=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),r.cssClass=s,r.icon={type:2,content:"&#xE946"},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),r.cssClass=o,u.push(r))),e&&n.isCloudSearchEnabledAadCache&&(r=this.createAdvancedOption(null,t,null,null,["AadAccount"],null,4),r.message=e.accountUserName,r.narratorText=r.message,r.cssClass=this.getAdvancedOptionCssClass(4),u.push(r),n.isSubstrateO365AccountConnected||(r.cssClass+=" "+h),this._verifyAccountForAADRequired&&(r=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),r.cssClass=s,r.icon={type:2,content:"&#xE946"},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),r.cssClass=o,u.push(r))),u.push(this.getMenuDividerOption()),r=this.createAdvancedOption("OMAC",t,null,null,["ManageAccounts"],()=>n.Host.launchWindowsAccountSettingsAsync(),2,null,{type:2,content:"&#xE716"}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r)),i&&this._accessTokenManager.getSelectedAccountInfo()||(f&&(n.isCloudSearchEnabledMsaCache||!c)||(r=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],n.isCloudSearchEnabledMsaCache?()=>n.Host.launchWindowsAccountSettingsAsync():()=>n.Host.launchSearchPermissions(),2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r)),e&&(n.isCloudSearchEnabledAadCache||!l)||(r=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],n.isCloudSearchEnabledAadCache?()=>n.Host.launchWindowsAccountSettingsAsync():()=>n.Host.launchSearchPermissions(),2,null,{type:2,content:n.isCloudSearchEnabledAadCache?"&#xE8FA":"&#xE9BE"}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r))),u}getUserProfileButtonData(){var r;let u,i,t=this._accessTokenManager.getSelectedAccountInfo();if(t){if(i=t.accountProviderAuthority=="consumers"?0:1,u=this._userProfilesCache[t.accountUserName],!u){const u=(r=this._substrateProfilePictureProvider)===null||r===void 0?void 0:r.getPersonDefaultIcon(t.accountUserName);return u&&(this._userProfilesCache[t.accountUserName]=u),this._accessTokenManager.getAccount(i,n.getProfilePictureResourceOrScope(i),!1,!0,n=>{var r;if(n&&n.Token){let u=(r=this._substrateProfilePictureProvider)===null||r===void 0?void 0:r.getProfilePictureIconForToken(i,n.Token,t.accountUserName);u&&u(1,n=>{n&&(this._userProfilesCache[t.accountUserName]=n,this.renderScopes())})}},undefined),u&&t.accountUserName?[u,t.accountUserName]:[null,null]}return[u,t.accountUserName]}return[null,null]}getAccountOptionsForUserProfileButton(t){if(!this._accessTokenManager)return[];let s="removeHover",h="menuItemWithButton focusable",e=this._accessTokenManager.getAllAvailableAccounts(0),o=this._accessTokenManager.getAllAvailableAccounts(1),c=this._accessTokenManager.getCachedAccountInfo(0),l=this._accessTokenManager.getCachedAccountInfo(1),f=e.concat(o);if(e.length+o.length==0)return[];let r=[],i,u=this._accessTokenManager.getSelectedAccountInfo();if(u&&(f=f.filter(n=>n.accountUserName!=u.accountUserName),n.config.useCobaltCSS||(i=this.createAdvancedOption(null,t,null,"Accounts",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,null,this._userProfilesCache[u.accountUserName]),i.message=u.accountUserName,i.narratorText=i.message,i.cssClass=this.getAdvancedOptionCssClass(4,u),i.isSelectedAccount=u&&n.config.useCobaltCSS,r.push(i),c&&n.isCloudSearchEnabledMsaCache&&this._verifyAccountForMSARequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),i.cssClass=s,i.icon={type:2,content:"&#xE946"},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),i.cssClass=h,r.push(i)),l&&n.isCloudSearchEnabledAadCache&&this._verifyAccountForAADRequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),i.cssClass=s,i.icon={type:2,content:"&#xE946"},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),i.cssClass=h,r.push(i))),f.length>0){r.push(this.getMenuDividerOption());for(let u of f)i=this.createAdvancedOption("APPA",t,null,null,u.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],()=>{this._accessTokenManager.setSelectedAccount(u,3),n.Host.notifyAccountSelected(u),this._menuFactory.dismiss()},0,null,{type:2,content:"&#xE77B"}),i.message=u.accountUserName,i.narratorText=i.message,i.cssClass=this.getAdvancedOptionCssClass(0),r.push(i)}return r.push(this.getMenuDividerOption()),i=this.createAdvancedOption("OMAC",t,null,null,["ManageAccounts"],()=>n.Host.launchWindowsAccountSettingsAsync(),2,null,{type:2,content:"&#xE716"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i),e&&(n.isCloudSearchEnabledMsaCache||!this._accessTokenManager.isMsaAvailable())||(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],n.isCloudSearchEnabledMsaCache?()=>n.Host.launchWindowsAccountSettingsAsync():()=>n.Host.launchSearchPermissions(),2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),o&&(n.isCloudSearchEnabledAadCache||!this._accessTokenManager.isAadAvailable())||(i=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],n.isCloudSearchEnabledAadCache?()=>n.Host.launchWindowsAccountSettingsAsync():()=>n.Host.launchSearchPermissions(),2,null,{type:2,content:n.isCloudSearchEnabledAadCache?"&#xE8FA":"&#xE9BE"}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),r}getMenuDividerOption(){return{id:`divider_${this.menuDividerId++}`,selected:!1,title:"",message:null,isSeparator:!0,text:"",instItem:null,click:null,layout:3,isSelectable:!1}}addSinglePaneOptions(t,r){if(!n.isThirdPartySearchAllowed()){let i=this.getScopeBarElements(),u=this.getHiddenScopeElements(i).filter(t=>t.type!=n.Scope.All).map(n=>{let t=n;return t.layout=0,t});t.push(this.createContextMenuGroup(null,r,"MoreScopesListToolTip",u));t.push(this.getMenuDividerOption())}let u=[];if(i.authenticationManager.getAllSearchWebAccountsAsync){if(!this._accessTokenManager.getSelectedAccountInfo()||!n.config.userProfileButtonEnabled){let n=this.getAccountOptions(r);u.push(this.createAdvancedOption(null,r,null,null,["ConnectedAccounts"],null,2,null,{type:2,content:"&#xE716"},n))}n.config.wsbSettingsIconEntryPoint||u.push(this.createAdvancedOption("OMSS",r,null,null,["SearchSettings"],()=>n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettingsAsync(),2,null,{type:2,content:"&#xE713"}))}else(n.isCloudSearchEnabledAadCache||n.isCloudSearchEnabledMsaCache)&&this.addCloudSearchUpsells(u,r,2);n.config.wsbSettingsIconEntryPoint||u.push(this.getIndexingOption(r,1));t.push(this.createContextMenuGroup(null,r,"OptionsButtonToolTip",u));this.isFeedbackEnabled()&&(n.config.wsbSettingsIconEntryPoint&&n.isCloudSearchEnabledAadCache||t.push(this.getMenuDividerOption()),t.push(this.createAdvancedOption("FB",r,null,null,["FeedbackButtonText"],()=>{this.showFeedback(),this._menuFactory.dismiss()},2,null,{type:2,content:"&#xED15"},null)))}getAdvancedOptions(t,r){let u=[];if(r==1){if(i.authenticationManager.getAllSearchWebAccountsAsync&&(u.push(...this.getAccountOptions(t,n.config.userProfileButtonEnabled)),n.config.wsbSettingsIconEntryPoint||u.push(this.createAdvancedOption("OMSS",t,null,null,["SearchSettings"],()=>n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettingsAsync(),2,null,{type:2,content:"&#xE713"}))),n.config.wsbSettingsIconEntryPoint||u.push(this.getIndexingOption(t,r)),n.isSearchHoverSettingsEnabled()){u.push(this.getMenuDividerOption());let n=this.createAdvancedOption("TSO",t,null,null,["ToggleSwitchOption"],null,2,null,null);n.isSelectable=!0;n.cssClass="menuItem__optionsToggle";u.push(n)}if(n.config.wsbWithCopilot){u.push(this.getMenuDividerOption());let n=this.createAdvancedOption("TSO",t,"ToggleSwitchOptionCopilotHeader",null,["ToggleSwitchOptionCopilotDescription"],null,2,null,null,null,null,null,2),i=this.createAdvancedOption("TSO",t,"ToggleSwitchOptionPersonalizationHeader",null,["ToggleSwitchOptionPersonalizationDescription"],null,2,null,null,null,null,null,3);n.isSelectable=!0;n.cssClass="menuItem__optionsToggle";u.push(n);i.isSelectable=!0;i.cssClass="menuItem__optionsToggle";u.push(i)}if(this.isFeedbackEnabled()&&n.isTwoPanesZIEnabled()){n.config.wsbSettingsIconEntryPoint&&n.isCloudSearchEnabledAadCache||u.push(this.getMenuDividerOption());let i=this.createAdvancedOption("FB",t,null,null,["FeedbackButtonText"],()=>{this.showFeedback(),this._menuFactory.dismiss()},2,null,{type:2,content:"&#xED15"},null);i.cssClass=this.getAdvancedOptionCssClass(2);u.push(i)}}return r==2&&this.addSinglePaneOptions(u,t),r==0&&(n.isCloudSearchEnabledAadCache||n.isCloudSearchEnabledMsaCache)&&this.addCloudSearchUpsells(u,t,r),r!=2&&n.config.troubleshootButton&&u.push(this.getMenuDividerOption()),n.config.troubleshootButton&&(r==1||r==2)&&u.push(this.createAdvancedOption("OMTS",t,null,null,["Troubleshoot"],()=>n.Host.launchUriAsync("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,t,null,null,["OptionsWindowButton"],()=>{this._optionsWindow.showOptionsWindow(),this._menuFactory.dismiss()},2,null,{type:2,content:"&#xE90F"},null)),r!=0&&n.TestHookUrlParameters&&n.config.debugFallbackScenario&&u.push(this.createDebugFallbackOption(t)),n.config.snrVersion&&(r==1||r==2)&&(this._shouldShowBuildNumber||n.TestHookUrlParameters||n.isMsftAccountConnected)&&u.push(this.createBuildVersionOption()),u}addCloudSearchUpsells(t,i,r){this.addMsbUpsell(t,i,r);let e=n.substrateProvidersEnabled();if(r==0||r==2){let f=[n.Scope.People,n.Scope.Emails,n.Scope.Documents];if(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;var 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))}}addMsbUpsell(t,i,r){if(n.config.msbAccountVerificationInSearchHome&&n.msbHost&&n.msbEnabledForQuery(null)&&r==0&&this._selectedScope!=null&&this._selectedScope.type==n.Scope.All&&this._currentQuery!=null&&this._currentQuery.isSearchHomeZI){let f=!1,e="MsbVerifyAccount",o=[];const s=n.msbHost.getTenantName();s&&(f=!0,e="MsbReverifyAccount",o=[s]);const u={isReverify:f,WSB_SessinRandom:n.Host.createGuid(),WSB_Position:r,WSB_SequenceNumber:i,WSB_ScopeType:this._selectedScope.type},c=()=>{const t=()=>{_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountSuccess","",u),n.Host.refreshCurrentPane(),n.Host.setFocusInSearchBox(null,"MsbAadUpsell")},i=()=>{_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountFailed","",u),n.Host.refreshCurrentPane(),n.Host.setFocusInSearchBox(null,"MsbAadUpsell")};_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountDialogShown","",u);this._accessTokenManager.promptAutheticateDialog(1,"9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7",t,i)},h=this.createAdvancedOption("MSBA",i,null,e,null,c,6,null,{type:2,content:"&#xE814"},null,o,"VerifyButton");h.cssClass="msb-aad-upsell";t.push(h);_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountUpsellAdded","",u)}}async chatButtonClicked(t,i,r,u){const o=n.SequenceNumberManager.getSequenceNumber();let e=this.getInstItem(r?"CCBL":"CCBR",o);e=n.InstrumentationHelper.createCodexClickItemProps(e,r?"ChatButtonLeft":"ChatButtonRight");n.InstrumentationHelper.instrumentItemClick(t,e,o,null,i,u);let f=r?`${location.origin}/search?form=WSBCSL&showconv=1&sendquery=1&q=${this._currentQuery.queryToFetch}`:(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())==1?n.config.codexBtnUpperRightLaunchURIAAD:n.config.codexBtnUpperRightLaunchURI,s={campaign:n.config.moreEdgeProtocolOCID,medium:r?"CodexButtonLeft":"CodexButtonRight"};f&&(n.config.enableCopilotNative&&f.includes(n.CMC_URL_PROD)&&(f=await n.getCopilotLaunchUrl(f,"WSBTRC")),n.Host.launchCodexUriAsync(f,s))}}n.HeaderFooterViewModel=b}(WSB||(WSB={})),function(n){function t(n,t){let i=HitHighlightingParser.removeMarkers(n.text);if(!i.includes(t.queryToFetch)&&i.toLowerCase().startsWith(t.queryToFetch.toLowerCase())){let 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){if(i.actionUri=f,i.confidence=o,i.source=s,i.handoffType==4){let u=i.query.toLowerCase()==r.queryToFetch.toLowerCase();i.updateFromQuery=t=>u?(i.query=t.queryToFetch,i.text=HitHighlightingParser.addMarkers(i.query,t.queryToFetch),i.narratorText=n.getNarratorText(i),!0):!1;let t=n.parseTaskFrame(e);if(t)i.isReformulation=!0,i.click=()=>n.safeSetTimeout(()=>n.Host.reformulate(i.query,t),0,"Cat1Click-Reformulation");else return!1}else i.classNames.push("action"),i.click=()=>n.Host.launchCat1Async(i.query,f,e);return i.icon={type:3},t(i,r),i.narratorText=n.getNarratorText(i),i.type!="CSK"&&(i.getMruData=()=>Object.assign(Object.assign({},n.getMruWebSuggestionData(i)),{annotation:i.primaryMetadata,actionUri:f,taskFrame:e,confidence:o,source:s})),!0}function s(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.segments=c,i.htmlContent){let n=JsonInject.GetResourceKeys([e]);n&&(i.executeScript=()=>JsonInject.WriteAfterContentResources(JsonInject.FilterResources(a,n)))}if(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=()=>n.Host.launchCat2or3aAsync(i.query,l),i.allowedInGroups=!i.htmlContent;else{if(f(i,r),i.type=="HS"){let t=r.isSearchHomeZI?"WSSHRH":"WSQFSH";i.click=()=>n.Host.launchSearchAsync(i.query,v.getSearchUrl(r.fullPartialQuery,i.query,i.type,h,null,t),!1)}else i.click=i.subType=="MRUHS"?()=>n.Host.launchSearchAsync(i.query,v.getSearchUrl(r.fullPartialQuery,i.query,i.type,h,null,"WSQFLH"),!1):()=>n.Host.launchSearchAsync(i.query,v.getSearchUrl(r.fullPartialQuery,i.query,i.type,h),!1);i.allowedInGroups=i.secondaryIcon?!!i.additionalInfoText:!i.htmlContent;i.getMruData=()=>n.getMruUrlSuggestionData(i,h)}i.narratorText=n.getNarratorText(i)}function r(t,i,r,u,e,o,s){f(t,i);i.queryToFetch||(t.text=HitHighlightingParser.addMarkers(t.text));let h;i.isSearchHomeZI?(h=s?"WSHBSH":"WSSHRH",n.shouldSHSuggToBingChat(t.handoffType,t.query)&&(u=n.replaceSearchWithChatPath(n.appendBingChatParams(u!==null&&u!==void 0?u:`/search?q=${n.encodeQueryParameter(t.query)}`)))):n.shouldQFSuggToBingChat(t.handoffType,t.query,t.type)&&(u=n.replaceSearchWithChatPath(n.appendBingChatParams(u!==null&&u!==void 0?u:`/search?q=${n.encodeQueryParameter(t.query)}`)),n.setSearchSuggestionChatIcon(t),h="WSBQFC");t.subType!="MRUHS"||i.isSearchHomeZI||(h="WSQFLH");t.type!="HS"||i.isSearchHomeZI||(h="WSQFSH");t.click=()=>n.Host.launchSearchAsync(t.query,e.getSearchUrl(i.fullPartialQuery,t.query,t.type,u,t.handoffType,h),t.useRaf,h);t.narratorText=n.getNarratorText(t);t.getMruData=()=>n.getMruUrlSuggestionData(t,u);n.config.enableHistoryExtraVerb&&i.isSearchHomeZI&&n.setExtraVerbs(t,()=>{let i=[{verb:"ManageSearchHistory",displayName:n.Host.getLocString("ManageSearchHistory"),executeSync:()=>n.Host.launchPrivacyPortalAsync(),icon:{content:"&#xE81C",type:2}}];return n.config.removeSuggUrl&&i.unshift({verb:"RemoveFromWebHistory",displayName:n.Host.getLocString("RemoveFromWebHistory"),executeSync:()=>o(t.text),icon:{content:"&#xE711",type:2}}),i},!0)}function u(t,i,r,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.url=u;t.click=n.isSupportWebResultsInAllScopeInDMAEnabled()&&i.isSearchHomeZI?()=>{var i;return n.Host.launchThirdPartyUriWithProtocolAsync(u,(i=t.sourceApp)===null||i===void 0?void 0:i.protocol)}:n.config.enableLaunchWithProfile&&t.handoffType==1?()=>n.Host.launchUrlWithEdgeProtocolAsync(u,{}):()=>n.Host.launchUriAsync(u);t.narratorText=n.getNarratorText(t,n.Host.getLocString("DirectNavSuggestion"));t.getMruData=()=>n.getMruUrlSuggestionData(t,u)}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.handoffType===13?t.primaryMetadata=n.Host.getLocString("SearchForWebImages"):t.handoffType===14?t.primaryMetadata=n.Host.getLocString("SearchForWebVideos"):(t.primaryMetadata=n.getWebSuggestionAnnotation(n.msbEnabledForQuery(i)),t.itemType=2));n.config.enableWSStaticSecondaryText&&t.handoffType===0&&n.config.wsStaticSecondaryText&&(t.primaryMetadata=n.Host.getLocString(n.config.wsStaticSecondaryText))}function e(n){if(typeof n=="string"&&n.indexOf("filters")>0){let t=n.substring(n.indexOf("filters"));return t.indexOf("&")>0&&(t=t.substring(0,t.indexOf("&"))),t}return null}class o{constructor(t,i,r,u,f){this._navigationHelper=t;this._temporaryMessageHandler=i;this._accessTokenManager=r;this._mruInMemoryCache=u;this._previousKeystrokeCache=f;this.removeBingHistorySuggestionCallBack=t=>{this._accessTokenManager?this._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,i=>{if(i&&i.Token){let r={};(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(55182095))&&n.config.enabledMsaAuthV2?r["X-Search-MsaV2Token"]=i.Token:r["X-Search-RPSToken"]=i.Token;this.sendRemoveBingHistorySuggestionRequest(t,r)}},undefined):this.sendRemoveBingHistorySuggestionRequest(t,null)}}parse(n,t,i,r,u,f,e){this.parseOnlineSuggestions(n,t,r,u,f,e,i)}parseOnlineSuggestions(t,i,r,u,f,e,o){if(!r){n.isDataSourceEnabled("Web",t)&&f("Web",[],null);n.isDataSourceEnabled("OSTMA",t)&&f("OSTMA",[],null);n.isDataSourceEnabled("OSTMAN",t)&&f("OSTMAN",[],null);n.isDataSourceEnabled("QS",t)&&f("QS",[],null);return}r&&r.ELToken&&(n.Host.setElToken(r.ELToken),r.LC==1&&n.Host.sendElToken());let s=[],l=[],a=[],v=[],y=[],h=[],p=[],c=n.isDataSourceEnabled("Web",t);if(n.safeExecute(()=>{var u;if(r.Suggestions)for(let f of r.Suggestions){let e=f.Attributes;if(n.config.enableWebSynonymForNames&&e.stype==="QP"){let n=(u=e.appDisplayName)===null||u===void 0?void 0:u.toLowerCase();if(n){v.push(f);y.push(n);continue}}let w=e.appId;if(w){l.push(f);w.split(";").forEach(t=>{n.contains(h,t)||h.push(t)});continue}let b=e.settingId;if(b){a.push(f);p.push(b);continue}if(c){let u=n.safeExecute(()=>this.parseOnlineSuggestion(t,f,i,r.Resources,o),"parseOnlineSuggestion");u&&s.push(u)}}if(c&&n.config.enableWinStoreAppPreview&&r.SuggestionsExt&&r.SuggestionsExt.Results&&!n.config.isDMARegion&&!(n.isMsbEnterprise()||n.AccessTokenManager.getWindowsAccountType()==1))for(let u of r.SuggestionsExt.Results){let f=n.safeExecute(()=>this.parseOnlineSuggestion(t,u,i,r.Resources,o),"parseOnlineSuggestion");f&&s.push(f)}},"parseOnlineSuggestions"),c){let i=null,u=null;r.RankingSignals&&(i=n.safeExecute(()=>n.parseWebEngagementSignals(r.RankingSignals),"parseWebEngagementSignals"),n.isL2(t)||(u=n.safeExecute(()=>n.parseWebSuppressionSignals(r.RankingSignals,t),"parseWebSuppressionSignals")));this._previousKeystrokeCache&&this._previousKeystrokeCache.updateWebSignalsData(t.queryToFetch,i);let e={rankingSignals:r.RankingSignals,engagementSignals:i,suppressedGroups:u,webTopResultRoutingType:r.PrefixRoutingType,responseHeader:r.responseHeaders};f("Web",s,e)}n.lookupById(t,"OSTMA",h,l,"OSTMAN",y,v,n=>n.Attributes.appId.split(";"),"QS",p,a,n=>n.Attributes.settingId,u,i,f,e,(n,u,f,e,o)=>this.parseIdLookupResponse(r,t,i,n,u,f,e,o),null,null,null,null)}static getAllAppsInstalledInLocal(t){var i;let r=SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(t,null);return r?(i=r.apps)===null||i===void 0?void 0:i.getItemsAsync(0,4).then(i=>{var u;let r=i.resultSet;r||typeof i.length!="undefined"?r||(r=i):r=Object.keys(i).map(n=>i[n]);let f=[];for(let i in r){let e=r[i];if(e){let o=(u=e.displayName)===null||u===void 0?void 0:u.toLowerCase();f.push(o);n.Host.addInstalledAppsByQueryInCurrentConversation(o,t)}}return f}):null}parseIdLookupResponse(t,r,u,f,e,o,s,h){if((!n.config.enableWebSynonymForNames||!h)&&(o===null||o===void 0?void 0:o.length)!=1){let i=n.safeExecute(()=>this.parseOnlineSuggestion(r,f,u,t.Resources,e),"parseOnlineSuggestion "+e);i&&s.push(i);return}let c=t=>{let e=f.Attributes;return this.compliesWithMinVersion(e.appMinVersion,t.deviceItem.version)?(t.appContext=e.appContext,this.setRankingSignals(t,f),n.config.enableWebSynonymScoreTopHit&&Math.abs(f.PrefetchConfidenceScore-1e4)<Number.MIN_VALUE&&(t.prefetchConfidenceScore=f.PrefetchConfidenceScore),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};if(n.config.enableWebSynonymForNames&&h)for(let t=0;t<(o===null||o===void 0?void 0:o.length);t++)n.safeExecute(()=>n.parseLocalSuggestion(r,o[t],e,u,this._temporaryMessageHandler,"PP",s,c),"parseLocalSuggestion "+e);else n.safeExecute(()=>n.parseLocalSuggestion(r,o[0],e,u,this._temporaryMessageHandler,f.Attributes.stype,s,c),"parseLocalSuggestion "+e)}parseOnlineSuggestion(t,f,o,h,c){let l=f.Attributes,v=l.stype;if(n.config.enableMultiEntityQF&&l.isAnswer=="1"&&l.asbtype==="HS"&&(v=l.asbtype),v=="CS")return null;if(n.config.enableWebSynonymForNames){if(l.appId||l.settingId||l.appDisplayName)return null}else if(l.appId||l.settingId)return null;let y;y=l.isAnswer==="1"?l.url||l.vertical?n.verticalToHandoffType(l.vertical):10:l.taskFrame?l.actionUri.startsWith("action://FindMyStuff/")?4:5:n.config.enableWinStoreAppPreview&&v=="SPP"?3:v=="MD"||v=="ML"?1:n.verticalToHandoffType(l.vertical);let a=n.createSuggestion(t,f.Text,null,n.getIconFromOnlineResponse(f),v,l.query,n.InstrumentedItem.createInstrumentedItem(o,v),y,o,!1);if(n.config.enableMruProviderInQF&&this._mruInMemoryCache,a.primaryMetadata=f.SecondaryText,this.setRankingSignals(a,f),a.autoOpenPreviewPaneWhenOnTopHit=l.openPP==="1",l.isAnswer==="1"){if(!l.url&&!n.isCortanaEnabledCache)return null;a.signals=f.Signals;s(a,t,o,f.InstantAnswer,l.additionalInfoText,l.secondaryIconUrl,l.url,l.segments,l.taskFrame,h,this._navigationHelper);l.noHeightRestriction==="1"&&a.classNames.push("noHeightRestriction");a.reactKey=v+l.url;n.config.propagateFiltersToMiniserpUrl&&(a.filters=e(l.url))}else if(l.taskFrame){if(!n.isCortanaEnabledCache||!i(a,t,o,l.actionUri,l.taskFrame,parseFloat(l.confidence),parseInt(l.source)))return null;a.reactKey=v+l.taskFrame}else if(n.config.enableWinStoreAppPreview&&a.type=="SPP")this.setMSStoreSuggestionProperties(a,l);else{if(!l.url)return null;if(a.autoOpenPreviewPaneWhenOnTopHit=l.openPP==="1",a.reactKey=v+t.queryToFetch+l.url,n.config.propagateFiltersToMiniserpUrl&&(a.filters=e(l.url)),a.type=="MD"||a.type=="ML"){let i=n.prettyPrintUrl(l.query,t.queryToFetch,!0);i!=a.query&&(a.query=i,a.text=t.queryToFetch?HitHighlightingParser.addMarkers(i,t.queryToFetch):i);a.primaryMetadata&&!a.primaryMetadata.includes(HitHighlightingParser.startMarker)&&(a.primaryMetadata=HitHighlightingParser.addMarkers(a.primaryMetadata,t.queryToFetch));u(a,t,o,l.url)}else{if(n.queryLooksLikeUrl(a.query))return null;r(a,t,o,l.url,this._navigationHelper,this.removeBingHistorySuggestionCallBack,!1)}}if(!n.isValidSuggestion(a,"parseOnlineSuggestion"))return null;const d=["Actor","City","Place","Country","State","Animal","Attraction","Food","Artist","People"],g=["Song","TvShow","Movie"];let p=a.segments,w=p?p.split(","):[],b=w.some(t=>n.contains(d,t)),k=w.some(t=>n.contains(g,t));return(f.ChildSuggestions||b||k)&&(n.config.wsbWithCopilotQF||n.config.disableChildSuggestions||(a.calculateChildSuggestions=()=>this.calculateRelatedSuggestions(a,t,f,c,b,k))),n.config.directNavPreviewPane&&a.type=="MD"&&a.url&&(a.getIcon=n.getFaviconUrlForRawUrl(a.url,64,64,1.5),a.previewPaneType=2),a}setMSStoreSuggestionProperties(t,i){t.installed=!1;t.classNames.push("action");t.productName=i.appName;let r=n.Host.getWindowsTheme(),u=r==2?i.darkThumbnailUrl:i.lightThumbnailUrl,f=r==2?i.darkScreenShotUrl:i.lightScreenShotUrl;t.icon=n.toIcon(u,"getStoreImage");let e=parseFloat(i.rating);t.averageRating=this.getStarsRating(e);t.publisherName=i.publisherName;t.shortDescription=i.shortDescription;t.longDescription=i.longDescription;t.screenshot=f;t.deeplink=i.launchUri;t.query=i.appName;t.scope=n.Scope.Apps;t.primaryMetadata=n.Host.getLocString("AppInMicrosoftStore");t.packageFamilyName=i.packageFamilyName;t.click=()=>n.Host.launchUriAsync(t===null||t===void 0?void 0:t.deeplink,!0);t.narratorText=n.getNarratorText(t);t.reactKey="SPP"+i.appName}getStarsRating(n){let t=Math.round(n*2)/2;return Math.max(0,Math.min(5,t))}setRankingSignals(n,t){let i=t.Attributes;n.hc=i.hc==="1";n.highConfidenceSuggestionScore=+i.hcs;n.highConfidenceMetaSuggestionScore=t.HighConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.PrefetchConfidenceScore;n.suggestionLogMeta=i.lm}compliesWithMinVersion(n,t){if(!n)return!0;if(!t)return!1;let i=n.split("."),r=t.split(".");while(i.length>r.length)r.push("0");for(let n=0;n<i.length;++n){let t=r[n],u=i[n];if(t<u)return!1;if(t>u)return!0}return!0}sendRemoveBingHistorySuggestionRequest(t,i){t=HitHighlightingParser.removeMarkers(t);let r=n.config.removeSuggUrl.replace("%7b0%7d",encodeURIComponent(t)).replace("%7bSID%7d",sj_cook.get("_SS","SID"));n.fetchUrlJson(r,i,null,i=>{i&&i.success&&(n.Host.refreshCurrentPane(),n.safeSetTimeout(()=>this._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemoveFromWebHistoryConfirmation",t)),250,"removeBingHistorySuggestion"))})}addRelatedSuggestion(t,i,u,f,e,o,s){let 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.isChild=!0;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,!1);h.primaryMetadata=null;h.reactKey=o+f+(t?t.Category+t.SecondaryText:"");n.isValidSuggestion(h,"calculateRelatedSuggestions")&&u.childSuggestions.push(h)}calculateRelatedSuggestions(t,i,r,u,f,e){if(t.childSuggestions=[],r.ChildSuggestions)for(let u of r.ChildSuggestions)this.addRelatedSuggestion(u,i,t,u.Text,n.getIconFromOnlineResponse(u),u.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&&n.InstrumentationHelper.instrumentDataSource(t.sequenceNumber,u,t.childSuggestions,null)}}n.OnlineSuggestionsParser=o;n.adjustCasing=t;n.setCat1SuggestionProperties=i;n.setWebSearchSuggestionProperties=r;n.setUrlSuggestionProperties=u}(WSB||(WSB={})),function(n){function w(n){return n?[n]:[]}function ft(n){if(n){let t=n.lastIndexOf(".");if(t>=0)return n.substring(t)}return""}function et(t){let i=t?new Date(t):null;return n.isValidDate(i)?i:null}function ot(t){if(t){let 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 u(t,r,u,f,s=false){if(!s&&f.extensionLC&&n.hideFileExtensionsCache){let i=f.extensionLC.length,t=f.query,u=t.toLocaleLowerCase();if(u.endsWith(f.extensionLC)){let e=r?HitHighlightingParser.addMarkers(t,r):t,o=n.config.disableSyntaxHighlight?r===""||!f.extensionLC.toLocaleLowerCase().startsWith("."+r.toLocaleLowerCase()):e.toLocaleLowerCase().endsWith(f.extensionLC);if(o){f.query=t.substring(0,t.length-i);let n=f.text.toLocaleLowerCase(),r=HitHighlightingParser.removeMarkers(n);if(u==r){let t=n.lastIndexOf(f.extensionLC);t>0&&(f.text=f.text.substring(0,t)+f.text.substr(t+i))}}}}if(f.lastModifiedDate&&(f.lastModifiedDateString=f.lastModifiedDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),f.lastAccessDate&&(f.lastAccessDateString=f.lastAccessDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),f.primaryMetadata=f.sourceForGroup&&f.sourceForGroup!=1?n.getGroupSourceDisplayName(f.sourceForGroup):f.itemTypeDisplayName,f.explanation?f.additionalInfoText=f.explanation:t.isSearchHomeZI&&(f.additionalInfoText=f.prettyPrintedPath||f.path),f.classNames=f.classNames.indexOf("fbig")>=0?["fbig"]:[],f.match){let t=(pt(f.match.matchType)?n.Host.getLocString(n.MatchType[f.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(f.match.matchedText,r);f.additionalInfoText=t;f.secondaryMetadata=t;f.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")}else f.lastModifiedDateString&&n.RuntimeConfig.QfMode!=5&&(f.secondaryMetadata=n.Host.getLocString("LastModified")+": "+f.lastModifiedDateString);f.narratorText=n.getNarratorText(f);n.displayedInGridLayout(f.type)&&(u?f.classNames.push("bigIcon","biggerIcon"):f.classNames.push("bigIcon"));!s&&f.handoffType==2&&SearchAppWrapper.CortanaApp.copyToClipboard&&i(f,()=>[{verb:n.JumplistActionItemType[n.JumplistActionItemType.S_CopyFullPath],displayName:n.Host.getLocString("CopyFullPath"),executeSync:()=>SearchAppWrapper.CortanaApp.copyToClipboard(f.path,""),icon:{type:1,content:"&#xE8C8"}}],!1);let c={},h=f.prettyPrintedPath||f.path;if(h){let i=h.lastIndexOf("/");i<0&&(i=h.lastIndexOf("\\"));i<0&&(i=h.lastIndexOf(" > "));let t=h.substring(0,i);t.endsWith(":")&&(t=t+"\\");f.parentFolder=t;c[n.Host.getLocString("Location")]=[{text:t,click:()=>n.isUncOrLocalPath(t)?SearchAppWrapper.CortanaApp.launcher.startLaunchFolder(t):f.locationUrl?SearchAppWrapper.CortanaApp.launcher.launchUriAsync(decodeURI(f.locationUrl)):SearchAppWrapper.CortanaApp.launcher.launchUriAsync(t)}]}let l=n.nicerCloudFilesEnabled(t,f);f.tooltip=yt(f,l);for(let[t,i,r]of e){let u=f[r];u&&!t&&(c[n.Host.getLocString(i)]=[{text:u}]);f.previewMetadata=c}o(f)&&((n.isDocument(f===null||f===void 0?void 0:f.type)||n.isFolder(f===null||f===void 0?void 0:f.type))&&(f.previewMetadata[n.Host.getLocString("Relevance")]=[{text:n.Host.getLocString("ContentRelatedHasBeenFound",`{${r}}`)}]),n.isPhoto(f===null||f===void 0?void 0:f.type)&&(f.previewMetadata[n.Host.getLocString("Relevance")]=[{text:n.Host.getLocString("ImageRelatedHasBeenFound",`{${r}}`)}]))}function o(t){var i;return((i=t===null||t===void 0?void 0:t.match)===null||i===void 0?void 0:i.matchType)===n.MatchType.Relevance}function st(t,i){return t.type==="CoPST"&&i.type==="ST"||t.type==="ST"&&i.type==="CoPST"?(t.duplicates=t.duplicates||[],n.contains(t.duplicates,i)||(t.duplicates.push(i),t.needsRefreshAfterDeduping=!0,t.previewPaneNeedsRefreshAfterDeduping=!1),!0):!1}function ht(t,i,r){var f,o;i.match||!r.match||i.parentFolderDisambig||r.match.matchType!==n.MatchType.Relevance&&(i.match=r.match,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0);n.Host.getFindSharedFilesEnabled()&&((f=r.match)===null||f===void 0?void 0:f.matchType)===n.MatchType.LastSharedBy&&((o=i.match)===null||o===void 0?void 0:o.matchType)===n.MatchType.Author&&(i.match=r.match,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0);for(let[,,n]of e){let t=r[n];t&&!i[n]&&(i[n]=t,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0)}(n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&(i.needsRefreshAfterDeduping=!1,i.previewPaneNeedsRefreshAfterDeduping=!1);i.needsRefreshAfterDeduping&&u(t,n.getEffectiveQuery(t),n.isL2(t),i,!0)}function ct(t,i,r=1){return n.Async.safeChainWithGlobalCaching("getIconForTypeAsync",t=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getIconForTypeAsync(i,n.getImageSizeValue(t)),n=>n+"_"+i,i=>n.toIcon(i,"getIconForTypeAsync",t),t,null,null,r)}function b(n){return n!=null&&(n.type==3||!!n.content||!!n.className)}function f(t,i,r=true){let u=t.mayContainPII;return t.text?t.query?!t.handoffType&&t.handoffType!==0?(n.LogWSBError(i,u?"":t.text,new Error("Missing handoff type"),undefined,undefined,"WindowsTelemetry"),!1):t.type?r&&!t.getIcon&&!b(t.icon)?(n.LogWSBError(i,u?"":t.text,new Error("Missing icon"),undefined,undefined,"WindowsTelemetry"),!1):!0:(n.LogWSBError(i,u?"":t.text,new Error("Missing suggestion type"),undefined,undefined,"WindowsTelemetry"),!1):(n.LogWSBError(i,u?"":t.text,new Error("Missing query"),undefined,undefined,"WindowsTelemetry"),!1):(n.LogWSBError(i,u?"":t.deviceItem?t.deviceItem.id:"",new Error("Missing text"),undefined,undefined,"WindowsTelemetry"),!1)}function i(t,i,r){let u=t.getExtraVerbs;t.getExtraVerbs=t=>{let f=u?u(t):[],e=i(t);return n.joinVerbs(f,e,r)}}function lt(t,i,r){let u=t.getExtraVerbsAsync;t.getExtraVerbsAsync=u?t=>ThresholdUtilities.createPromise(f=>u(t).then(u=>i(t).then(t=>f(n.joinVerbs(u,t,r))))):i}function r(n,t){let r=n.propertyHits||[],i=r.indexOf(t);return typeof i=="object"&&i.returnValue!==undefined?i.returnValue:i>=0}function at(n){if(n&&typeof n=="object"&&n.length){let t="";for(let i=0;i<n.length;i++)t+=n[i],i!=n.length-1&&(t+=", ");return t}return n}function t(t,i,r){return n.safeExecute(()=>at(t.getProperty(i)),"get"+i,undefined,r)}function vt(t,i,...u){for(let[f,i,e]of u)if(i&&r(t,e))return n.createMatch(f,i);return null}function yt(t,i){let r=i?t.query+"\n"+t.parentFolder:t.prettyPrintedPath||t.path||"";t.textContentIfMatched&&(r+=(r?"\n\n":"")+t.textContentIfMatched);let u=!!r,f=()=>{r&&(r+="\n"),u&&(r+="\n",u=!1)};for(let[o,s,u]of e)if(!i||u!="lastModifiedBy"||!t.lastModifiedDateString){let e=t[u];e&&(!o||i)&&(f(),i&&u=="lastModifiedDateString"&&t.lastModifiedBy&&(e=n.Host.getLocString("LastModifiedCombined",e,t.lastModifiedBy)),r+=n.Host.getLocString(s)+": "+e)}return t.explanation&&t.meeting&&(r=HitHighlightingParser.removeMarkers(t.explanation)+"\n\n"+r),r}function pt(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:case n.MatchType.LastSharedBy:return!0;case n.MatchType.Relevance:case n.MatchType.Content:case n.MatchType.Location:return!1;default:throw new Error("Unknown match type: "+t);}}function bt(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,b,k,d,g,nt,tt){i&&n.isDataSourceEnabled(i,t)&&n.LocalDataProvider.getApps(r,t=>{if(v()){n.InstrumentationHelper.instrumentResponseReceived(y,i,null,0,!1,!1);let r=[];for(let f of u)n.safeExecute(()=>k(f,i,s(f).map(n=>t[n]).filter(n=>!!n),r),"parseApp "+i);p(i,r,null)}},b,i);n.config.enableWebSynonymForNames&&f&&n.isDataSourceEnabled(f,t)&&n.LocalDataProvider.getAppsByDisplayName(e,t=>{if(v()){n.InstrumentationHelper.instrumentResponseReceived(y,f,null,0,!1,!1);let i=[];if(!n.isNullOrUndefined(e)&&!n.isNullOrUndefined(o))for(let r=0;r<o.length;r++)n.safeExecute(()=>k(o[r],f,t[e[r]],i,!0),"parseApp "+f);p(f,i,null)}},b,f);h&&n.isDataSourceEnabled(h,t)&&n.LocalDataProvider.getSettings(c,t=>{if(v()){n.InstrumentationHelper.instrumentResponseReceived(y,h,null,0,!1,!1);let r=[];for(let u of l){let f;f=n.config.mapWrapperToJsMap&&t instanceof window.Map?t.get(a(u)):t[a(u)];n.safeExecute(()=>k(u,h,w(f),r),"parseSetting "+i)}p(h,r,null)}},b,h);d&&n.isDataSourceEnabled(d,t)&&n.LocalDataProvider.getFiles(g,t=>{if(v()){if(n.config.enableMRUFilesAndFoldersTelemetry||n.config.disableMRUFilesAndFoldersWildCards){let i=0,r=0;for(let n in t)t[n]||i++,r++;n.Host.setMRUFilesAndFoldersDefinedCount(r);n.Host.setMRUFilesAndFoldersUndefinedCount(i)}n.InstrumentationHelper.instrumentResponseReceived(y,d,null,0,!1,!1);let i=[];for(let r of nt)n.safeExecute(()=>k(r,d,w(t[tt(r)]),i),"parseFile "+d);p(d,i,null)}},t,b,d)}function k(t){if(t.id.endsWith(".lnk"))try{let i=t.getProperty("System.Link.TargetParsingPath");if(i&&n.DiscoApps.some(n=>i.endsWith(n))){let i=n.calculateMd5("{0E272F4A-8F49-4563-8754-4D6DE060AE87}"+t.getProperty("LinkArgs"));return n.DiscoArgs.some(n=>i==n)}}catch(i){return!1}return!1}function kt(t){return n.EdgeAppIds.some(n=>t.id==n)&&!(n.config.isDMARegion||(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072)))?n.Host.getLocString("MicrosoftRecommendedBrowser"):(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(44571814))&&(k(t)||n.DMAConsentAppIds.some(n=>t.id==n)||t.isSystemApp)?n.Host.getLocString("SystemApp"):n.Host.getLocString("App")}function dt(t){let i=n.config.addOpenPrefixToTopHitAnnotation?"OpenMicrosoftRecommendedBrowser":"MicrosoftRecommendedBrowser";if(n.EdgeAppIds.some(n=>t.id==n)&&!(n.config.isDMARegion||(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072))))return n.Host.getLocString(i);let r=n.config.addOpenPrefixToTopHitAnnotation?"OpenSystemApp":"SystemApp";if((n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(44571814))&&(k(t)||n.DMAConsentAppIds.some(n=>t.id==n)||t.isSystemApp))return n.Host.getLocString(r);let u=n.config.addOpenPrefixToTopHitAnnotation?"OpenApp":"App";return n.Host.getLocString(u)}function gt(t){return n.isModernSetting(t)?n.Host.getLocString("SystemSettingsAnnotation"):n.Host.getLocString("ControlPanelAnnotation")}function ni(t){let i=n.config.addOpenPrefixToTopHitAnnotation?"OpenSystemSettingsAnnotation":"SystemSettingsAnnotation",r=n.config.addOpenPrefixToTopHitAnnotation?"OpenControlPanelAnnotation":"ControlPanelAnnotation";return n.isModernSetting(t)?n.Host.getLocString(i):n.Host.getLocString(r)}function ti(t){return n.isFileOrFolder(t.type)?t.deviceItem:null}function ii(t,r,f,e,o,s){let h=n.getAppItem(o);if(h){e&&d(o,h);o.primaryMetadata=dt(h);o.primaryMetadataInPreviewPane=kt(h);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";o.type=="IBA"&&(o.tooltip=h.id,o.path=h.id);o.itemType=0;return}if(n.isSetting(o.type)){o.primaryMetadata=ni(o.deviceItem);o.primaryMetadataInPreviewPane=gt(o.deviceItem);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";o.itemType=1;fi(o,s,r);return}if(o.type=="LURL"&&(h=o.deviceItem,h)){let t=h.id;o.narratorText=n.getNarratorText(o,n.Host.getLocString("DirectNavSuggestion"));o.tooltip=o.query+"\n\n"+t;o.url=t;return}let c=ti(o);if(c){ri(t,r,f,e,s,o,c);return}if(o.type=="PT"||o.type=="CG"){let n=o;o.type!="PT"&&o.deviceItem.launchArguments||(n.path=o.deviceItem.id);let i=o.deviceItem,s=i.kind;if(s=="program"){g(o);return}let e=ui(i);if(e){n.itemTypeDisplayName=e;u(t,r,f,n);return}o.type=="CG"&&g(o);return}if(o.type=="FEH"){if(o.narratorText=n.getNarratorText(o,n.Host.getLocString("SearchHistorySuggestion")),r&&(o.text=HitHighlightingParser.addMarkers(o.text,r)),SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.onSearchHistoryRemoved){let t={verb:"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:()=>{SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.onSearchHistoryRemoved(o.query);n.Host.refreshCurrentPane()},icon:{content:"&#xE711",type:2}};i(o,()=>[t],!1)}return}throw new Error("Unexpected type: "+o.type);}function ri(i,f,e,o,s,h,c){let l;l=h.type=="LDOC"?n.resolveKnownFolderGUIDsInPath(c.id):n.indexerFilePathToRegularPath(c.id);h.path=l;h.itemTypeDisplayName=c.itemTypeDisplayName;o&&d(h,c);let a=c.lastModifiedDate;n.isValidDate(a)&&(h.lastModifiedDate=a);let v=c.extension;if(v&&(h.extensionLC=v.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));let i;switch(s){case"MPVD":if(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),r(c,"System.Search.Contents")){let r=t(c,"System.Search.AutoSummary",s);r&&([h.textContentIfMatched,i]=n.tryGetTextContentMatch(r,f));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":if(h.author=t(c,"System.Author",s),h.lastModifiedBy=t(c,"System.Document.LastAuthor",s),h.tags=t(c,"System.Keywords",s),r(c,"System.Search.Contents")){let r=t(c,"System.Search.AutoSummary",s);r&&([h.textContentIfMatched,i]=n.tryGetTextContentMatch(r,f));c.propertyHits.length==1&&(h.matchedOnlyOnContent=!0)}break;case"MPHO":h.tags=t(c,"System.Photo.TagViewAggregate",s);break;case"CoPIFF":if(h.type=="PSLI")h.tags=t(c,"System.Photo.TagViewAggregate",s);else if(h.type=="PSFL"&&(h.author=t(c,"System.Author",s),h.lastModifiedBy=t(c,"System.Document.LastAuthor",s),h.tags=t(c,"System.Keywords",s),r(c,"System.Search.Contents"))){let r=t(c,"System.Search.AutoSummary",s);r&&([h.textContentIfMatched,i]=n.tryGetTextContentMatch(r,f));c.propertyHits.length==1&&(h.matchedOnlyOnContent=!0)}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)}let u=n.config.disableSyntaxHighlight?!h.text.startsWith(n.Host.getQuery().queryToFetch)&&f:!h.text.includes(HitHighlightingParser.startMarker)&&f;if(u){let u,e=s!="LM"&&s!="FL";if(e&&(s=="MFF"?(u=t(c,"System.Title",s),u&&!n.matchesOnPropertyHH(u,f)&&(u=undefined)):r(c,"System.Title")&&(u=t(c,"System.Title",s))),u)h.text=HitHighlightingParser.addMarkers(u,f);else if(i)h.match=i;else{let t=n.IndexerQueryGenerator?"System.Music.DisplayArtist":"System.Music.Artist";h.match=vt(c,s,[n.MatchType.Album,h.album,"System.Music.AlbumTitle"],[n.MatchType.Artist,h.artist,t],[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"])}}}if((s==="CoPIFF"||s==="CoPCFP"||n.isContentSearch(h===null||h===void 0?void 0:h.type))&&(h.match=n.createMatch(n.MatchType.Relevance,"")),(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(48449532))&&n.isFileOrFolder(h===null||h===void 0?void 0:h.type)){let t=h.deviceItem;(t===null||t===void 0?void 0:t.matchType)===2&&(h.match=n.createMatch(n.MatchType.Relevance,""))}u(i,f,e,h);ei(h)}function d(t,i){let r=n.safeExecute(()=>i.getProperty("System.Link.TargetParsingPath"),"getTargetPath");if(r){r=r.toLocaleLowerCase();let i=n.getKnownFolderPathLC(n.FOLDERID_Profile);if(i){let t=n.getKnownFolderPathLC(n.FOLDERID_SystemX86);if(t&&r.startsWith(t+"\\config\\systemprofile"))r=i+r.substr(t.length+21);else{let t=n.getKnownFolderPathLC(n.FOLDERID_System);t&&r.startsWith(t+"\\config\\systemprofile")&&(r=i+r.substr(t.length+21))}}t.targetPathLC=r}}function ui(n){if(n.launchArguments)return null;let t=n.itemTypeDisplayName;return t&&t[0]!="."?t:null}function s(t){let i=[];for(let r=0;r<t.length-1;++r){let u=t[r];if(!n.displayedInGridLayout(u.type)&&!u.explanation)for(let n=r+1;n<t.length;++n){let f=t[n];if(u.type==f.type&&u.text.toLocaleLowerCase()==f.text.toLocaleLowerCase()){i[r]=!0;i[n]=!0;break}}}if(i.length!=0){let u=t.filter((n,t)=>i[t]),r=n.Host.getLocString("InfoTextWithSource");for(let t of u)if(t.path){let u=t.path.lastIndexOf("\\");if(u==-1)continue;let i=t.path.slice(t.path.lastIndexOf("\\",u-1)+1,u),f=t.handoffType==2?null:t.primaryMetadata;if(f&&i.endsWith(":"))continue;t.type=="IBA"?(t.secondaryMetadata=t.primaryMetadata,t.primaryMetadata=i):t.primaryMetadata=t.primaryMetadata?f?n.formatString(r,[i,t.primaryMetadata]):n.formatString(r,[t.primaryMetadata,i]):i;t.additionalInfoText=n.formatString(r,[" -",i]);t.match&&(t.classNames=t.classNames.filter(n=>n!="withMatchAnnotation"&&n!="forceNoWrapOutsideTopResult"));t.narratorText=n.getNarratorText(t);t.parentFolderDisambig=i}}}function g(t){t.primaryMetadata=n.Host.getLocString("RunCommandPrompt");t.classNames.push("action");t.narratorText=n.getNarratorText(t)}function fi(t,i,r){n.Host.getJupiterProviderEnabled()&&i==="CoPST"&&(t.match=n.createMatch(n.MatchType.Relevance,""),o(t)&&(t.previewMetadata||(t.previewMetadata={}),t.previewMetadata[n.Host.getLocString("Relevance")]=[{text:n.Host.getLocString("SettingRelatedHasBeenFound",`{${r}}`)}]))}function nt(t,i,r,u,e,o,s,h){var y;let p=n.localDataSourceMayContainPII(r);if(!o){let t=i.deviceItem.kind;n.LogWSBError("parseLocalSuggestion"+r,p?"":i.deviceItem.displayName||i.deviceItem.id,new Error("Unrecognized kind: "+t),undefined,undefined,"WindowsTelemetry");return}let w=o=="LURL"?1:2;if(n.isSuggestionTypeEnabled(r,o,w,t)){let a=n.getEffectiveQuery(t),v=i.deviceItem.displayName,b=v&&a?HitHighlightingParser.addMarkers(v,a):v,c=n.createSuggestion(t,b,i.getIcon,i.icon,o,v,n.InstrumentedItem.createInstrumentedItem(u,o),w,u,p);c.uxHint=ci(i,a);i.deviceItem.isSimulated||(c.deviceItem=i.deviceItem);c.ciMetaData=i.ciMetaData;n.isApp(o)&&(c.pinnedToTaskbar=n.Host.isPinnedToTaskbar(i.deviceItem.id));i.groupDisplayName&&(c.groupDisplayName=i.groupDisplayName);let l=n.getAppItem(c);if(l?(c.click=()=>n.Host.launchAppItemAsync(l,r,c.appContext),n.config.maxJLcm&&oi(t,c,l,e,u,r),c.reactKey=o+l.id):c.type=="FEH"?(c.click=()=>n.Host.submitFileExplorerTextSuggestion(c.query),c.reactKey=o+c.query):c.type=="FD"&&n.RuntimeConfig.QfMode==5?(c.click=()=>n.Host.submitFileExplorerFolderSuggestion(c.path),c.reactKey=o+c.deviceItem.id):(c.click=()=>n.Host.launchDeviceItemAsync(c.deviceItem,r),c.reactKey=o+c.deviceItem.id),l&&c.type!="IBA"||n.isSetting(c.type)||n.isFileOrFolder(c.type)&&c.type!="LDOC")c.getMruData=()=>{var t;return Object.assign(Object.assign({},n.getMruSuggestionData(c)),{id:i.deviceItem.id,appContextData:c.appContext?{appContext:c.appContext,query:c.query,textWithoutHH:HitHighlightingParser.removeMarkers(c.text)}:undefined,matchType:(t=i.deviceItem)===null||t===void 0?void 0:t.matchType})};else{let t=n.getCommandLineItem(c);t&&(c.hc=n.isRealCommand(c,t))}let k=n.getGroupType(c);if(n.shouldSetThisPcGroupSource(k,t)&&(c.sourceForGroup=1),ii(t,a,n.isL2(t),n.supportsShortcuts(r,t),c,r),(n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&(c.additionalInfoText=undefined,c.primaryMetadata=undefined,c.secondaryMetadata=undefined),c.reactKey||(c.reactKey=o+t+i.deviceItem.id),n.config.enableCopIFFExpPlan||n.config.mergeMultipleResouces){if(!n.isNullOrUndefined(c===null||c===void 0?void 0:c.deviceItem)&&n.isDocument(c===null||c===void 0?void 0:c.type)||n.isPhoto(c===null||c===void 0?void 0:c.type)||n.isFolder(c===null||c===void 0?void 0:c.type)){let n=c.deviceItem;(n===null||n===void 0?void 0:n.matchType)===2?c.isFullTextMatched=!0:(n===null||n===void 0?void 0:n.matchType)===1?c.isLexicalMatched=!0:(n===null||n===void 0?void 0:n.matchType)===3?(c.isPolarisMatched=!0,c.indexerIntentFeature=!0):(n===null||n===void 0?void 0:n.matchType)===4&&(c.isVegaMatched=!0,c.indexerIntentFeature=!0)}if(n.Host.getJupiterProviderEnabled()&&!n.isNullOrUndefined(c===null||c===void 0?void 0:c.deviceItem)&&n.isSetting(c===null||c===void 0?void 0:c.type)){let n=c.deviceItem;(n===null||n===void 0?void 0:n.matchType)===5&&(c.isJupiterMatched=!0,c.indexerIntentFeature=!0)}}if((n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(48449532))&&n.config.newFilesPreviewPane&&r=="IFF"){if(f(c,"parseLocalSuggestion "+r)){let t=-1;h(c)&&(t=s.findIndex(t=>n.isDuplicateDocument(t,c)),t!=-1&&(c.deviceItem.rankScore>s[t].deviceItem.rankScore&&(s[t]=c),(n.config.enableCopIFFExpPlan||n.config.mergeMultipleResouces)&&(s[t].isFullTextMatched=!0,s[t].isLexicalMatched=!0)),t==-1&&s.push(c))}}else f(c,"parseLocalSuggestion "+r)&&h(c)&&s.push(c);if((n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(55758958))&&n.config.enableVegaProviderDedupe&&r=="CoPCFP"){const n=(y=c.deviceItem)===null||y===void 0?void 0:y.getProperty("System.ContentUri");n&&(c.url=n)}}}function ei(t){i(t,()=>{if(t.duplicates){let i=t.duplicates.find(n=>n.handoffType==8);if(i){let t=[];return t.push({verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenInBrowser],displayName:n.Host.getLocString("OpenInBrowser"),executeSync:()=>n.Host.launchUrlWithEdgeProtocolAsync(i.url+(i.handoffType==8?"?web=1":""),{medium:"MSBLink"}),icon:{type:1,content:"&#xE774"}}),i.locationUrl&&t.push({verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenFileLocationInBrowser],displayName:n.Host.getLocString("OpenFileLocationIn",n.getGroupSourceDisplayName(i.sourceForGroup)),executeSync:()=>n.Host.launchUrlWithEdgeProtocolAsync(i.locationUrl,{medium:"MSBLink"}),icon:{type:2,content:"&#xE838"}}),t}}return[]},!0)}function tt(t,i){return!n.config.enableFallbackIconsForJumpLists||!p[t]?!1:n.contains(p[t],i)}function oi(t,r,u,f,e,o){let c=u.id,a=u.filePath,s;if(!n.config.forceAllJumplists){if(s=n.config.enableJumplistRestrictions&&rt[c],!s&&a){let t=a.toLowerCase();for(let n in y)if(t.includes(n)){s=y[n];break}if(!s&&n.config.enableJumplistRestrictions)for(let n in v)if(t.includes(n)){s=v[n];break}}if(s&&s.length==0)return}(n.RuntimeConfig.AlwaysWide||!ut.find(n=>n==c))&&(r.calculateChildSuggestions=()=>si(t,c,a,r,u,s,f,e,o),n.config.maxJLcm&&i(r,t=>{let i=[];if(!t&&(r.calculateChildSuggestions&&r.calculateChildSuggestions(),r.childSuggestions&&(!n.RuntimeConfig.AlwaysWide||!r.previewPaneType))){let t=!1;r.childSuggestions.filter(t=>t.type=="JL"&&!t.displayed&&t.groupType==n.GroupType.JumpListTasks).slice(0,n.config.maxJLcm).forEach(n=>{t=!0;let e=tt(r.deviceItem.id,n.groupType)?r.getIcon:h(n.jumpListItem,n.parent,!1,c),o={verb:"JumpListTask_"+c+"_"+n.text,displayName:n.text,executeSync:()=>l(u,n,f),getIcon:e};i.push(o)});let e=!1;r.childSuggestions.filter(t=>t.type=="JL"&&!t.displayed&&t.groupType!=n.GroupType.JumpListTasks).slice(0,n.config.maxJLcm).forEach((n,r)=>{if(t&&!e)i.push({});e=!0;let o={verb:"JumpList_"+c+"_"+r,displayName:n.text,executeSync:()=>l(u,n,f),getIcon:h(n.jumpListItem,n.parent,!0,c)};i.push(o)})}return i},!0))}function si(t,i,r,u,e,o,a,v,y){u.calculateChildSuggestions=null;let b=e.jumpList;if(b&&b.length!=0){let w=r||"",k=w.indexOf("}");w=w.substr(k+1);let p=[];for(let r of b)if(!o||n.contains(o,r.type)){let s=c(r.type),y=s!=n.GroupType.JumpListTasks;for(let o of r.items)if(!it(o)){let d=tt(u.deviceItem.id,c(r.type))?u.getIcon:h(o,u,y,i),k="JL",b=n.createSuggestion(t,o.displayName,d,null,k,o.displayName,n.InstrumentedItem.createInstrumentedItem(v,k),2,u.sequenceNumber,y,null,null,!0);b.click=()=>l(e,b,a);b.jumpListItem=o;b.groupType=s;b.groupDisplayName=r.name;b.parent=u;b.tooltip=o.description;let g=w&&o.path.endsWith(w);g||(b.path=o.path);f(b,"calculateJumpListSuggestions")&&(p.push(b),hi(e,b,a))}}p.length>0&&(u.childSuggestions=u.childSuggestions?u.childSuggestions.concat(p):p,s(p),n.InstrumentationHelper.instrumentDataSource(v,y,p,null))}}function h(t,i,r,u){return(f,e)=>n.getIcon(t,u+"_"+t.path+"_"+t.displayName,"jumpList",!r,!1,null,null,0)(f,n=>{n?e(n):i.getIcon(f,e)})}function it(t){return t.displayName?!n.RuntimeConfig.AlwaysWide&&n.olderThan2Weeks(t.lastAccessed)?!0:!1:!0}function c(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 l(t,i,r){n.Async.safeChain("launchJumpList",()=>i.jumpListItem.launchAsync(),()=>n.Host.manuallyDismissApp(),()=>{n.DialogBox?n.DialogBox.show(n.Host.getLocString("JumpListItemUnavailableDeleteConfirmation"),[{id:null,text:n.Host.getLocString("Cancel"),selected:!0,action:()=>n.Host.setFocusInSearchBox(null,"jumpListItemDialogBoxCancel")},{id:null,text:n.Host.getLocString("Remove"),selected:!1,action:()=>{a(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable1")}}]):(r.showTemporaryMessage(n.Host.getLocString("JumpListItemUnavailable")),a(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable2"))})}function a(t,i,r){let u=()=>r.showTemporaryMessage(n.Host.getLocString("RemoveFromListFailure",i.text)),f=i.parent.childSuggestions.length==1;n.Async.safeChain("deleteJumpList",()=>i.jumpListItem.deleteAsync(),()=>{n.Async.safeChain("getJumpListAsync",()=>t.getJumpListAsync(),t=>{f&&t.some(n=>c(n.type)==i.groupType&&n.items.some(n=>!it(n)))?u():(n.Host.refreshCurrentPane(),r.showTemporaryMessage(n.Host.getLocString("RemovedFromList",i.text)))},u)},u)}function hi(t,r,u){r.jumpListItem.deleteAsync&&i(r,()=>{let i={verb:"RemoveFromThisList",displayName:n.Host.getLocString("RemoveFromThisList"),executeSync:()=>a(t,r,u),icon:{type:2,content:"&#xE711"}};return[i]},!0)}function ci(t,i){if(t&&t.uxHint){let r=i?HitHighlightingParser.addMarkers(t.uxHint,i):t.uxHint;return n.Host.getLocString("RelatedSynonym",r)}return null}const rt={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},v={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},y={"\\msedge.exe":[0]},ut=["Microsoft.Windows.Explorer",],e=[[!0,"LastAccessed","lastAccessDateString"],[!1,"LastModified","lastModifiedDateString"],[!1,"LastModifiedBy","lastModifiedBy"],[!1,"Author","author"],[!1,"Activity","activity"],[!1,"Artist","artist"],[!1,"Album","album"],[!1,"Genre","genre"],[!1,"Tags","tags"],[!1,"Relevance","relevance"],],p={"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]};n.getFileExtension=ft;n.toDate=et;n.getTodayTimeString=ot;n.setFileTemplate=u;n.shouldShowRelevanceString=o;n.checkAndEnrichMetaForSettingSuggestions=st;n.enrichMetadataFromDuplicate=ht;n.getIconForTypeAsync=ct;n.isValidIcon=b;n.isValidSuggestion=f;n.setExtraVerbs=i;n.setExtraVerbsAsync=lt;class wt{constructor(n){this._temporaryMessageHandler=n}parse(t,i,r,u,f,e){let o=[];for(let f of u.suggestions)n.safeExecute(()=>nt(t,f,r,i,this._temporaryMessageHandler,f.suggestionType,o,()=>!0),"parseLocalSuggestion "+r);(n.isFileOrFolderLocalDataSource(r)||r=="IBA")&&s(o);let h={maxedOut:u.maxedOut};e(r,o,h)}}n.SuggestionsParser=wt;n.lookupById=bt;n.decorateSuggestionsWithParentFolder=s;n.parseLocalSuggestion=nt}(WSB||(WSB={})),function(n){var t;(function(t){t.currentCIVersion="-1";class i{constructor(r){(n.Host.bindShown(()=>{let n=this.getContstraintIndexInfo(r.lastUrl);t.currentCIVersion=n?String(n.version):"-1"}),n.Host.hasFallbackHappened())||n.Host.bindAppHidden(()=>{if(n.isBingEnabled()&&n.isBrowserOnline()){let s=this.safeGetLastUrl(r),y=this.safeGetUrlResult(r),l=n.getWindowHost().toLowerCase(),p=l=="bing.com"||l.endsWith(".bing.com");if(!p&&!(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest))return;let a=n.LightweightStorage.getItem(i.LastCIDownloadAttemptKey),h=null;if(a&&(h=new Date(a)),h&&(this.getTimeDiffInMins(h)<n.config.waitBetweenCIDownloadCallsInMins?n.config.waitBetweenCIDownloadCallsInMins:0))return;let f=this.getContstraintIndexInfo(s);t.currentCIVersion=String(f.version);let c=n.getCurrentLanguage(),u=n.config.ciVersion,e=this.parseUrlResult(y),o=this.getUrlForCiCab(u,c),v=n.contains(n.config.blocklistedCiVersions,f.version)&&u<f.version,w=u==e.version&&e.errorCode!="00000000";if(u>0&&n.config.supportedCiMarkets[c]&&(c!=f.language||u>f.version||v||w)&&(!e.url||v||s==e.url||e.errorCode!="00000000")){let f="cis_v"+u,e="ci_v"+u,c=n.LightweightStorage.getItem(f)?parseInt(n.LightweightStorage.getItem(f)):0,l=n.LightweightStorage.getItem(e)?parseInt(n.LightweightStorage.getItem(e)):0;n.LightweightStorage.setItem(i.LastCIDownloadAttemptKey,n.getCurrentDate().toString());const h="constraintIndexDownloader.tryDownloadFromUrlAsync";n.Async.safeChain(h,()=>r.tryDownloadFromUrlAsync(o),i=>{if(i){let i=this.getContstraintIndexInfo(s);t.currentCIVersion=String(i.version);c++;n.LightweightStorage.setItem(f,c.toString())}else SharedLogHelper.LogError(h,"urlResult: "+o,"Download failed");l++;n.LightweightStorage.setItem(e,l.toString())},n=>{SharedLogHelper.LogError(h,`onError - url:  ${o}`,n.message)},null,o,0)}}})}parseUrlResult(t){let r=null,i=null,u=1;if(t){let f=t.split(":0x");if(f.length>1){r=f[0];i=f[1];i!="00000000"&&n.LogWSBWarning("constraintIndexDownloader.urlResult",i,"Download encountered problems","WindowsTelemetry");let t=this.getContstraintIndexInfo(r);u=t.version}else SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","urlResult: "+t,"Invalid URL")}else SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","No urlResult");return{url:r,version:u,errorCode:i}}getContstraintIndexInfo(n){let t=-1,i="";if(n){let r=n.split("/");if(r.length>1){let n=r[r.length-1].split(".");i=n.length==2?n[0]:"";t=+r[r.length-2]}else SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","url: "+n,"Invalid URL")}else SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","No Url");return{version:t,language:i}}safeGetLastUrl(t){if(!n.config.ciDownloadUpdate)return t.lastUrl;const r="/bcs/ci/-1/en-us.cab";let i=r;try{return i=t.lastUrl,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}}safeGetUrlResult(t){if(!n.config.ciDownloadUpdate)return t.urlResult;const r="/bcs/ci/-1/en-us.cab:0x8000FFFF";let i=r;try{return i=t.urlResult,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}}getUrlForCiCab(n,t){return"/bcs/ci/"+n+"/"+t+".cab"}getTimeDiffInMins(t){if(!n.isValidDate(t))return 0;let i=t.getTime(),r=n.getCurrentTime();return Math.round((r-i)%n.DayToMs%n.HourToMs/n.MinuteToMs)}}i.LastCIDownloadAttemptKey="LastCIDownloadAttempt";t.ConstraintIndexDataLoader=i})(t=n.ConstraintIndex||(n.ConstraintIndex={}))}(WSB||(WSB={})),function(n){var t;(function(t){class i{constructor(){n.Host.bindQueryChangedOrInitialized(()=>{this._previousWebSignals=this._currentWebSignals,this._currentWebSignals=null,(!n.config.enableCISpeller||this._currentSpellerTrigger)&&(this._previousSpellerTrigger=this._currentSpellerTrigger,this._currentSpellerTrigger=null)});n.Host.bindConversationStart(()=>{this._previousWebSignals=null,this._currentWebSignals=null,this._previousSpellerTrigger=null,this._currentSpellerTrigger=null,this._previousBestMatchSuggestion=null,this._previousQuery=null})}setPreviousQuery(n){this._previousQuery=n}getPreviousQuery(){return this._previousQuery||""}updateWebSignalsData(n,t){this._currentWebSignals={query:n,signals:t}}setPreviousTopHit(n){this._previousBestMatchSuggestion=n}getPreviousTopHit(){return this._previousBestMatchSuggestion}updateSpellerTriggerData(n,t){this._currentSpellerTrigger={query:n,triggerSpeller:this.triggerSpellerOnTheNextKeyStroke(t,n)}}getPreviousEventWebSignalsData(n){return this._previousWebSignals&&this.isPreviousEventQuery(this._previousWebSignals.query,n)?this._previousWebSignals.signals:null}disableCISpeller(n){return this._previousSpellerTrigger&&this._previousSpellerTrigger.triggerSpeller&&this.isPossibleFirstMisspelling(n,this._previousSpellerTrigger.query)?!0:!1}enableCISpeller(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}triggerSpellerOnTheNextKeyStroke(t,i){return n.config.enableCISpeller==1?!0:t.every(n=>n.notAResult)?!0:t.length>0&&this.isWebSpellCorrectedSuggestion(t[0])&&t.every(n=>n.handoffType==0)?!0:n.config.enableCISpeller==2&&!t.some(t=>n.isApp(t.type)||n.isSetting(t.type))?!0:this.enableCISpeller(i)?!0:!1}isWebSpellCorrectedSuggestion(n){return n.type=="SC"||n.type=="OS"}isPreviousEventQuery(n,t){return n&&t&&n.length==t.length-1&&t.startsWith(n)}isBackspaceEventQuery(n,t){return n&&t&&n.length==t.length+1&&n.startsWith(t)}isTypedEventQuery(n,t){return(n||n==="")&&t&&n.length<t.length&&t.startsWith(n)}isPossibleFirstMisspelling(t,i){if(this._previousBestMatchSuggestion){let 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.PreviousKeystrokeCache=i})(t=n.Cache||(n.Cache={}))}(WSB||(WSB={})),function(n){var t;(function(t){function c(t){(e=t,n.StaticHtmlElements.dialogBox)&&(sj_be(n.StaticHtmlElements.dialogBox,"click",n=>{let r=n.target.id,t=i().filter(n=>n.id==r).shift();t?(t.action&&t.action(),u()):r=="dialog_overlay"&&u();sj_sp(n)},!0),n.Host.bindKeyDown(n=>{if(r){let t;switch(n){case 39:{let n=i(),r=!1;for(let i=0,u;u=n[i];i++)if(r){t=u;break}else if(r=u.selected==!0,r&&i+1==n.length){t=n[0];break}break}case 37:{let n=i(),r;for(let u=0,i;i=n[u];u++){if(i.selected==!0){t=r?r:n[n.length-1];break}r=i}break}}t&&h(t)}}),n.Host.bindKeyEscape(n=>{o()&&(u(),n.handled=!0)}))}function l(n,t,i,u){if(f=[],t.length==0)throw new Error("DialogBox: Empty buttons array");f=t.map((n,t)=>{let i=n;return i.id="dialog_b"+t,i.narratorText=i.text,i});let o={isVisible:!0,title:i,messageText:n,buttons:f,isModal:u};e.updateDialogBox(o);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(n=>[n])}function s(){return i().filter(n=>n.selected).shift()}function h(n){for(let t of i())t.selected=t.id==n.id,t.selected&&_ge(n.id).focus()}function v(){if(o()){let n=s();n&&(n.action&&n.action(),u())}}function y(){return!1}let 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 b(n){return n.includes("form=vsranf")}function k(t){let i=n.tryParseUrl(t,!0);return!!i&&/[\?\&]q=/i.test(i.parameters)&&!/[\?\&]view=detail/i.test(i.parameters)}function fi(t){let i=n.tryParseUrl(t,!0);return!!i&&ni.test(i.parameters)}function ei(n){switch(n){case 17:case 21:case 1:case 0:return 1;case 13:return 2;case 14:return 3;default:throw Error("Unsupported handoff type: "+n);}}function d(n){switch(n){case 1:return 1;case 2:return 7;case 3:return 8;default:throw Error("Unsupported vertical: "+n);}}function g(t){let i=n.tryGetBingPathLC(t);return i?n.contains(dt,i)?2:n.contains(gt,i)?3:n.contains(n.WebSearchPaths,i)?1:null:null}const f=["bfbVerticalConfig","bfbTenantSettings","bfbUserConfigs","bfbSubstrateUnifiedSearch"],o=["bfbTenantSettingsFailed","bfbUserConfigsFailed","bfbSubstrateUnifiedSearchFailed"],h=n.PreviewPaneWidth-24,tt="miniserp_focus",it="disableOutline",i=2,rt=["tab-active","slide"],ut=["aria-expanded"],ft="videoPreview",et=300,e=30,ot="IsSearchAppXYFocusEnabled",st="WinJS",ht="dFocusExit",t="win-xyfocus-suspended",ct="Rewards.ReportActivity.Success",lt="Rewards.ReportActivity.Failure";n.MiniSerpIframeId="miniIframeSerp";n.MiniSerpFetchEvent="miniSERP.Fetch";n.MiniSerpLoadedEvent="MiniSerpContentLoaded";n.MiniSerpClearingEvent="MiniSerpContentClearing";const at=["/account/","/settings.aspx"],r=function(){let n={};return n[37]="left",n[39]="right",n[38]="up",n[40]="down",n}(),vt=1e4,yt=800,s=535,c=580,l=150,pt=439,wt=441,bt=100,kt=["&form=s00037&"],dt=["/images/search","/images"],gt=["/videos/search","/videos"],ni=/[\?\&]FORM=HDRSC[1-3]/i,u="ClientInst",a="wsbpf",ti="wsbPrefetchGuid",v="inprocess",ii="wsbstoploadingscreen",ri="wsbstoprequeryloadingscreen",ui="chat_clickthrough",y="noIcon",p="netural",w="searchGlyph";n.VerticalConfigLocalStorageKeyV2=(n.config===null||n.config===void 0?void 0:n.config.disableMsbBundle)?"WsbMsbVerticalConfig":n.VerticalConfigLocalStorageKey;class oi{constructor(t,i){var r;this._navigationHelper=t;this._msRewardsViewModel=i;this._deviceScale=1;this._previewRequestId=0;this._previousURLs=[];this.blockedMiniSERPUrls=[_w.location.origin+_w.location.pathname];this._msbContext=(r=_w.BingAtWork)===null||r===void 0?void 0:r.context;this._wsbPrefetchModel={};this._msbContext&&(this._msbContext.isWsbPrefetchEnabled=!0);n.Host.bindQueryChangedOrInitialized(t=>{const i=t.scope===n.Scope.Work&&!n.isWorkScopeDsbGleamRedirect();i&&this.warmup3s()});n.config.msbEnableAccountManager?n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.accountManager.bindAccountStatusChanged(async t=>{const{changeType:i}=t;i==="TenantSettingsDone"&&n.isWorkScopeDsbGleamRedirect()&&this.warmup3s()}):n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.tenantManager.bindTenantEnabled(()=>{n.isWorkScopeDsbGleamRedirect()&&this.warmup3s()});n.Host.bindShown(()=>{const t=n.Host.getCachedCortanaHeaders();t&&t["X-BM-DeviceScale"]?this._deviceScale=+t["X-BM-DeviceScale"]/100:ThresholdUtilities.getCortanaHeaders(t=>{t?n.Host.setCortanaHeadersCache(t):SharedLogHelper===null||SharedLogHelper===void 0?void 0:SharedLogHelper.LogError("miniserpDeviceScale",undefined,"get Cortana headers failed"),t&&t["X-BM-DeviceScale"]&&(this._deviceScale=+t["X-BM-DeviceScale"]/100)});this.setVertical(1)});n.Host.bindAppHidden(()=>{this._seeAllResults&&(this._seeAllResults.innerText=""),this._currentVertical=null});n.Host.bindSearchBoxGotFocus(()=>{this._focusHelper&&this._focusHelper.onSearchBoxFocusChanged()});sj_evt.bind(n.MiniSerpLoadedEvent,()=>{this._onIFrameLoadedCallback&&(this._onIFrameLoadedCallback(),this._onIFrameLoadedCallback=null)});this._msRewardsViewModel&&(sj_evt.bind(ct,([,n])=>{this._msRewardsViewModel.notifyPointsRewarded(n)}),sj_evt.bind(lt,([,t])=>{n.LogWSBError("RewardsReportActivityFailureEvent",null,t?new Error(t):null,undefined,undefined,"WindowsTelemetry")}))}init(t,i){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("#miniSerpScrollArea");this._loadingScreen=this._root.querySelector("#loadingScreen");this._hasErrored=!1;this._selectedItem=null;sj_be(this._scrollArea,"scroll",t=>{this._iframe&&n.contains([2,3],this._currentVertical)&&this._iframe.contentWindow.dispatchEvent(new Event(t.type,t)),this._calculateIFrameHeight&&this._calculateIFrameHeight()});this._contentContainer&&n.config.enableMiniserpOverlay&&this._contentContainer.classList.add("minioverlay");this._footer&&!n.config.disableMiniserpButton&&(sj_be(this._footer,"keydown",t=>{this._iframe&&n.isUpOrDownKey(t.keyCode)?(t.keyCode==38?this.tryExecuteFocusOnMiniSerp(()=>this._focusHelper.moveFocusToEdgeFocusableElement(1)):n.RuntimeConfig.AllowKeyboardNavCycling&&this.tryExecuteFocusOnMiniSerp(()=>this._focusHelper.moveFocusToEdgeFocusableElement(0)),sj_pd(t),sj_sp(t)):t.keyCode==13?this._footer.click():t.keyCode==9&&this._focusHelper.moveFocusToWindow()}),n.config.enableChatButtonInMiniserp&&this._footer.classList.add(ui),this.updateFooterIconClass());this._mask&&n.RuntimeConfig.MiniSERPMode!=0&&sj_be(this._mask,"keydown",n=>{n.keyCode==13&&this._mask.click()});sj_be(_w,"message",t=>{let i=t.data?t.data.msWinJSXYFocusControlMessage:null;if(i&&i.type==ht){let u=i.direction,f=i.keyCode;this._focusHelper&&!this._focusHelper.isL2Visible()&&this._focusHelper.getXYFocusRoot()!=this._originalMiniSerpXYFocusRoot?(this._focusHelper.setXYFocusRoot(this._originalMiniSerpXYFocusRoot),this.tryExecuteFocusOnMiniSerp(()=>this._focusHelper.moveFocus(u,f))):(u!=r[n.getRtlAdjustedKey(39)]&&t.source.blur(),u==r[40]||u==r[38]&&n.RuntimeConfig.AllowKeyboardNavCycling?this._footer?this._footer.focus():this._focusHelper.moveFocusToEdgeFocusableElement(u==r[38]?1:0):u!=r[n.getRtlAdjustedKey(37)]||n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(f,"previewPaneUnfocus"))}})}finalizeKeystroke(){this.instrumentOnPreviewPaneRendered(!1,!0)}getSelectableItems(){return this._selectedItem?[this._selectedItem]:[]}getSelectableItemsByGroup(){return[]}getSelectedItem(){return this._selectedItem}select(){}onAfterKeyDown(){return!1}clear(){this._previewedSuggestion=null;this._onPreviewPaneRendered=null;this._hasErrored=!1;this._selectedItem=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=[]}showForceLoad(t,i){n.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=()=>{this.clearForceLoadPage(),this.startLoadingScreen(),i()}}clearForceLoadPage(){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)}formatForceLoadPage(t){var f,u,i,e;let h=n.Host.getLocString("ForceLoadMessage"),c=n.Host.getLocString("ForceLoadButton"),o=h.split("{0}");f=sj_ce("div","","accentColor");this._forceLoadScreen.appendChild(f);u=_d.createElement("span");u.id="forceLoadIcon";u.innerHTML="&#xE721";f.appendChild(u);i=sj_ce("div","forceLoadQueryText","");i.appendChild(_d.createTextNode(o[0]));let s=_d.createElement("span");s.textContent=t;i.appendChild(s);i.appendChild(_d.createTextNode(o[1]));this._forceLoadScreen.appendChild(i);e=sj_ce("div","","");this._forceLoadScreen.appendChild(e);let r=_d.createElement("button");r.className="c-button";r.id="forceLoadSubmit";r.type="submit";r.textContent=c;e.appendChild(r)}startLoadingScreen(){n.setVisibility(this._scrollArea,!1);n.setVisibility(this._footer,!1);n.setVisibility(this._mask,!1);n.setVisibility(this._loadingScreen,!0)}stopLoadingScreen(){n.setVisibility(this._loadingScreen,!1);n.setVisibility(this._scrollArea,!0)}clearContent(t){this._previewRequestId+=1;this._focusHelper=null;this._onIFrameLoadedCallback=null;sj_evt.fire(n.MiniSerpClearingEvent);this.destroyLogger(()=>{while(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&&t()})}destroyLogger(t){var i;if(this._iframe){const r=this._iframe.contentWindow;if(r&&((i=r.BingAtWork)===null||i===void 0?void 0:i.miniSerpDestroyLogger)&&!n.config.msbDisableMiniSerpDestroyLogger){try{r.BingAtWork.miniSerpDestroyLogger(t)}catch(u){t()}return}}t()}hasFocus(){if(n.Host.searchBoxHasFocus())return!1;let t=n.getCurrentActiveElement();return t&&t!=this._iframe&&this._root.contains(t)}focus(){if(!this.hasFocus())if(this._iframe){let t=this.tryExecuteFocusOnMiniSerp(()=>this._focusHelper.moveFocusToLastFocusedElement());t?n.Host.setFocusInWebView("miniserp focus"):n.Host.setFocusInSearchBox(null,"MiniSERP VM Focus failed")}else this._hasErrored&&n.config.edgeTransferOnTimeout?(_ge("errorFooter").focus(),this._selectedItem={id:"errorFooter",text:null,selected:!0},n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView("errorPP focus")):this._previewPaneViewModelParent.focusPending=!0}readyToBlur(){return!0}blur(){}setVertical(t){if(t!=this._currentVertical){if(this._seeAllResults)if(n.config.enableChatButtonInMiniserp)this.setFooterText("ChatWithBingAI");else switch(t){case 1:this.setFooterText(n.config.miniserpFooterText);break;case 2:this.setFooterText("SeeAllImageResults");break;case 3:this.setFooterText("SeeAllVideoResults");break;default:throw new Error("Unsupported vertical type: "+t);}this._currentVertical=t}}setFooterText(t){this._seeAllResults.innerText=n.Host.getLocString(t)}instrumentOnPreviewPaneRendered(n,t){if(this._timestampFirstRender&&this._onPreviewPaneRendered){let i={firstRenderTS:this._timestampFirstRender};this._onPreviewPaneRendered(t,!n,i)}}updateFooterIconClass(){if(n.config.miniserpFooterIcon)switch(n.config.miniserpFooterIcon){case 1:this._footer.classList.add(y);break;case 2:this._footer.classList.add(p);break;case 3:this._footer.classList.add(w)}if(n.config.miniserpFooterSize)switch(n.config.miniserpFooterSize){case 1:this._footer.classList.add("largerFooter1");break;case 2:this._footer.classList.add("largerFooter2")}}clearFooterIconClass(){this._footer.classList.remove(y);this._footer.classList.remove(p);this._footer.classList.remove(w)}update(t,i,r,u,f,e){var c,l,a,v;this._onPreviewPaneErrored=e;this._currentSuggestion=t;this._currentQuery=i;let o,y=n.isThirdPartySearchAllowed()&&i.scope==n.Scope.ThirdPartyWeb;if(n.isSupportWebResultsInAllScopeInDMAEnabled()&&(y=t.type==="TP"),y?(o=(c=t.previewPaneUrl)!==null&&c!==void 0?c:"",this.clearFooterIconClass(),this._footer.classList.add("thirdPartyFooter")):(this._footer.classList.remove("thirdPartyFooter"),this.updateFooterIconClass()),(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(t.handoffType))&&this._iframe&&this.isWorkScopeSubVerticalChange(t)&&(this._timestampFirstRender=n.getCurrentTime()),!f){this.instrumentOnPreviewPaneRendered(!0,!1);return}if(this.instrumentOnPreviewPaneRendered(!1,!0),this.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelUpdate"),n.config.disableOfflineRequest&&!n.isBrowserOnline()){this.renderOfflineMessage(t.query);return}this._currentHandoffType=t.handoffType;const p="hideBingLogo";if(this.hideBingLogoOnLaunchBrowserButton()?(l=this._footer)===null||l===void 0?void 0:l.classList.add(p):(a=this._footer)===null||a===void 0?void 0:a.classList.remove(p),(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(t.handoffType))&&this._iframe){const r=this._iframe.contentWindow;if(r&&((v=r.BingAtWork)===null||v===void 0?void 0:v.workVerticalNavClickHandler)){let u={navigationPayload:{domain:t.navDomain,id:t.navDomainId},query:t.query,impressionGuid:n.InstrumentationHelper.getImpressionGuid(n.SequenceNumberManager.getSequenceNumber())};if(this._footer&&!n.config.disableMiniserpButton&&n.setVisibility(this._footer,!0),this.isWorkScopeSubVerticalChange(t)){this.stopLoadingScreen();this._scrollArea.scrollTop=0;u.isRequery=!1;r.BingAtWork.workVerticalNavClickHandler(u);this.updatePreviousState(t,f);return}if(i.scope===n.Scope.Work&&t.previousQuery&&!(t.query===this._queryShown)){this._scrollArea.scrollTop=0;this.startLoadingScreen();const e=n.Host.createGuid(),i=`${ri}${e}`;this.handleLoadingStateEvent(i);u.isRequery=!0;u.loadingStateEventKey=i;r.BingAtWork.workVerticalNavClickHandler(u);this.updatePreviousState(t,f);return}}}this.updatePreviousState(t,f);let h=t.type=="MB"&&t.segments=="Organization"?null:t.baseSearchUrl,k=ei(t.handoffType);if(this.setVertical(k),this._footer&&!n.config.disableMiniserpButton&&(this._footer.onclick=r=>{var u;this._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(r),3);let f=n.config.enableChatButtonInMiniserp?this._navigationHelper.getChatUrl(t.query):this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType,undefined,undefined,undefined,undefined,t.msbVerticalHash)+this._navigationHelper.enrichUrlWithWorkScopeHash(t.handoffType,t.msbVerticalHash);o?n.Host.launchThirdPartyUriWithProtocolAsync(o,(u=i.thirdPartySearch)===null||u===void 0?void 0:u.protocol):(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(t.handoffType))?n.msbHost.proactiveSearchManager.launchProactiveWorkSearchAsync({query:t.query,formCode:n.mapOSFormCode("WSBWS0"),intent:"None"}):n.Host.launchSearchAsync(t.query,f,!1);this._previewPaneViewModelParent.onAfterItemLaunch(3)}),this._mask&&(this._mask.onclick=r=>{this._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(r),3);n.Host.launchSearchAsync(t.query,this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType,undefined,undefined,undefined,undefined,t.msbVerticalHash),!1);this._previewPaneViewModelParent.onAfterItemLaunch(3)}),this._contentContainer&&n.config.enableMiniserpOverlay&&(this._contentContainer.onclick=r=>{var u;this._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(r),3);let f=this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType,undefined,undefined,undefined,undefined,t.msbVerticalHash);o?n.Host.launchThirdPartyUriWithProtocolAsync(o,(u=i.thirdPartySearch)===null||u===void 0?void 0:u.protocol):n.Host.launchSearchAsync(t.query,f,!1);this._previewPaneViewModelParent.onAfterItemLaunch(3)}),n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.noSerp){this.renderIframe(null,"<html><body><\/body><\/html>",{},undefined,!1,!1);let t=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(t);return}const w=r==0,b=SearchAppWrapper.CortanaApp.entryPoint=="WNSHVR",d=b?"WMSHVA":n.mapOSFormCode("WMSRPA"),g=b?"WMSHVM":n.mapOSFormCode("WMSRPM"),nt=w?d:g;let s=this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,h,t.handoffType,nt,!0,null,w,t.msbVerticalHash,t.filters);if(s+="&qfig="+n.InstrumentationHelper.getImpressionGuid(n.SequenceNumberManager.getSequenceNumber()),this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&(s+="&rewards=1"),i.serpURLParams)for(let n in i.serpURLParams)s=ThresholdUtilities.setUrlParameter(s,n,i.serpURLParams[n]);this._previousURLs=[];this.downloadAndDisplayMiniSerp(t,s,null,r,o)}getCurrentHandoffType(){return this._currentHandoffType}isIframeActive(){return this._iframe!==null}updatePreviousState(n,t){this._queryShown=n.query;this._previewedSuggestion=n;this._onPreviewPaneRendered=t;this._timestampFirstRender=null}miniSERPRenderTimeoutInstrumentation(t){let i;i={FunctionCalled:t};n.InstrumentationHelper.logClientInstEvent(u,"MiniSERPRenderTimeout",n.SequenceNumberManager.getSequenceNumber(),i)}miniSerpErrorInstrumentation(t,i,r){let f;f=r?{ErrorCause:t,ResponseRecievedTimeStamp:i.toString(),ResponseText:r.responseText,ContentType:r.contentType,ResponseStatusCode:r.status.toString(),RequestStatusCode:r.result.toString()}:{ErrorCause:t};n.InstrumentationHelper.logClientInstEvent(u,"MiniSERPError",n.SequenceNumberManager.getSequenceNumber(),f)}hideBingLogoOnLaunchBrowserButton(){return(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(this._currentHandoffType))&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.shouldHideBingLogoOnLaunchBrowserButtons())}renderOfflineMessage(t){let f=n.isBrowserOnline(),u=n.Host.getLocString("PreviewPaneOfflineTitle"),i=n.Host.getLocString("PreviewPaneOfflineMessage").split("{0}"),r=[],e=i.length-1;for(let t=0;t<i.length;t++)t==e?r.push({text:i[t],click:()=>n.Host.launchUriAsync("ms-settings:troubleshoot")}):r.push({text:i[t]});let o={isOnline:f,previewPaneTitle:u,previewPaneItems:r,fullPartialQuery:t,narratorMessage:u,hideBingLogo:this.hideBingLogoOnLaunchBrowserButton()};this._onPreviewPaneErrored(o)}renderErrorMessage(t){let u=n.isBrowserOnline(),i=n.Host.getLocString("PreviewPaneErrorMessage").split("{0}"),r=[],f=n.Host.getLocString("PreviewPaneErrorMessage",t)+" "+n.Host.getLocString("PreviewPaneTimeoutMessage");for(let n=0;n<i.length;n++)r.push({text:i[n]});let e={isOnline:u,previewPaneTitle:"",previewPaneItems:r,fullPartialQuery:t,narratorMessage:f,hideBingLogo:this.hideBingLogoOnLaunchBrowserButton()};this._hasErrored=!0;this._onPreviewPaneErrored(e)}downloadAndDisplayMiniSerp(t,i,r,f,e){let s=!1;this._queryShown=t.query;let a=t.type==="TP";if(n.TestHookUrlParameters||n.MockUrlParameters){s=!!n.MockUrlParameters;let t=n.TestHookUrlParameters!==null&&n.TestHookUrlParameters!==void 0?n.TestHookUrlParameters:n.MockUrlParameters,r=t.previewPaneUrlOverride;i=r?decodeURIComponent(r):n.UrlParameters.copyTestParametersTo(i);s&&(i=ThresholdUtilities.setUrlParameter(i,"client","windowsMiniSerp"));let u=t.miniSerpBag;u&&(i=ThresholdUtilities.setUrlParameter(i,"bag",u));let f=t.miniSerpAjaxBag;f&&(i=ThresholdUtilities.setUrlParameter(i,"ajaxbag",f));let e=t.dummyref;e&&(i=ThresholdUtilities.setUrlParameter(i,"dummyref",e));let o=t.clientIP;o&&(i=ThresholdUtilities.setUrlParameter(i,"clientip",o))}let y=f==0;sj_evt.fire(n.MiniSerpFetchEvent,t,y);let o=n.Host.getCustomHeaders(null);if(o["X-BM-DeviceDimensionsLogical"]=h+"x"+this._root.clientHeight,o["X-BM-DeviceDimensions"]=String(Math.round(h*this._deviceScale))+"x"+this._root.clientHeight,s||(n.config.restrictedAPIHeaderChange?o["X-RestrictedAPI"]="1":o["User-Agent"]=n.getUserAgent()+" RestrictedAPI"),r&&(o["Content-Type"]=r.contentType),n.config.msbMockToken){const n=_w.BingAtWork&&_w.BingAtWork.wsb&&_w.BingAtWork.wsb.wsbAccessToken;n&&(o.Authorization="Bearer "+n)}(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(t.handoffType))&&(this.bindWsbPrefetchResponseWithModel(),n.msbHost.prefetchManager.FetchMsbUnifiedSearch(t.query),n.msbHost.prefetchManager.FetchTenantSettings(),n.msbHost.prefetchManager.FetchUserConfigs());o["X-Search-SafeSearch"]="Strict";let c=++this._previewRequestId,l=f=>{if(n.config.enableMiniserpFetchTelemetry){let t=n.getCurrentTime()-this._fetchStartTime,i={miniserpFetchLatency:t.toString()};n.InstrumentationHelper.logClientInstEvent(u,"MiniSerpFetchLatency",n.SequenceNumberManager.getSequenceNumber(),i)}if(this._shouldRenderMiniSerp)sb_ct(this._ppMiniSerpRenderTimer),this._ppMiniSerpRenderTimer=null,this._shouldRenderMiniSerp=!1;else return;this.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelCallback");let e=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(e);f.status==200&&f.responseText?(this._previousURLs.push(i),this.renderIframe(i,f.responseText,o,s,!!r,a)):(n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),this.miniSerpErrorInstrumentation("renderErrorMessage",e,f),this.renderErrorMessage(t.query))};this._ppMiniSerpRenderTimer&&(sb_ct(this._ppMiniSerpRenderTimer),this._ppMiniSerpRenderTimer=null);this._shouldRenderMiniSerp=!0;let p=(n.config.miniSERPRequestRetries+1)*n.config.miniSERPRequestTimeout+1e3;this._ppMiniSerpRenderTimer=n.safeSetTimeout(()=>{this._previewedSuggestion!=null&&this._previewedSuggestion==t&&(this._shouldRenderMiniSerp=!1,n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),this.miniSERPRenderTimeoutInstrumentation("ppMiniSerpRenderTimeout"),this.stopLoadingScreen(),this.renderErrorMessage(t.query))},p,"ppMiniSerpRenderTimer");let v={"User-Agent":n.getUserAgent()+" RestrictedAPI"};if(n.isServicingSearchBingAs3PEnabled()&&a){let i=t;!e&&i.url&&(e=i.url);e&&(e=n.addQueryParamsToUrl(e,{wsbpreviewpane:"1"}));this.fetchMiniSerpUrl(e,null,n.config.wsbDefaultBundle?v:null,l,c,n.config.miniSERPRequestRetries,!0);return}if(t.scope==n.Scope.ThirdPartyWeb&&e){this.fetchMiniSerpUrl(e,null,n.config.wsbDefaultBundle?v:null,l,c,n.config.miniSERPRequestRetries,!0);return}this.fetchMiniSerpUrl(i,r?r.data:null,o,l,c,r?0:n.config.miniSERPRequestRetries)}fetchMiniSerpUrl(t,i,r,f,e,o,s){n.config.enableMiniserpFetchTelemetry&&(this._fetchStartTime=n.getCurrentTime());let h=f;o>0&&(h=n.isSupportWebResultsInAllScopeInDMAEnabled()&&s&&!t?()=>{f({responseText:"",contentType:"",status:-1,result:4})}:i=>{if(i.result==0&&i.responseText)f(i);else{let s={Url:t,StatusCode:i.status.toString(),Timeout:n.config.miniSERPRequestTimeout.toString(),RetriesRemaining:o.toString()};n.InstrumentationHelper.logClientInstEvent(u,"MiniSERPRefetch",n.SequenceNumberManager.getSequenceNumber(),s);this.fetchMiniSerpUrl(t,null,r,f,e,o-1)}});n.config.isThemeAware&&n.isDarkModeEnabled()&&(t=ThresholdUtilities.setUrlParameter(t,"darkschemeovr","1"));!n.config.useCobaltCSS||t.includes("addfeaturesnoexpansion=wsbcobalt")||s||(t+="&addfeaturesnoexpansion=wsbcobalt");n.fetchUrl(t,r,i,h,null,()=>e==this._previewRequestId,!0,i?undefined:n.config.miniSERPRequestTimeout)}renderIframe(n,t,i,r,u,f){this.clearContent(()=>{this.renderIframeContent(n,t,i,r,u,f)})}renderIframeContent(t,i,r,u,f,e){this._iframe=sj_ce("iframe",n.MiniSerpIframeId);this._iframe.setAttribute("scrolling","no");this._contentContainer.appendChild(this._iframe);let s=this._iframe.contentWindow,o=this._iframe.contentDocument,c=!1;const h=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(this._currentHandoffType);if(this._footer&&!n.config.disableMiniserpButton&&(n.setVisibility(this._footer,!f),n.setVisibility(this._mask,!f)),this.setIframeHeight(0),this._onIFrameLoadedCallback=()=>{h&&(this.handleWorkScopeInst(),this.handleWorkResultsSize(),this.handleWsbPrefetch(),this.handleLoadingStateForWorkScope());let i=o.body,f=0;if(this._calculateIFrameHeight=()=>{let n=i.offsetHeight;n!=f&&n>0&&(f=this.setIframeHeight(n,h))},this._calculateIFrameHeight(),this.overrideAjaxCalls(s,r,u,e),this.captureNavigationsAndSizeEvents(t,i,s,o,e),this._scrollArea.scrollTop=0,n.config.backStackSearchEnabled&&(this._shouldAddSearchBackStack=!0,this._currentBackStackTimeout&&clearTimeout(this._currentBackStackTimeout),this._currentBackStackTimeout=sb_st(()=>{this._shouldAddSearchBackStack=!1},n.config.miniSerpRedirectTimeoutInMs)),n.contains([2,3],this._currentVertical)){let t={childList:!0,subtree:!0};this._mutationObserver=new MutationObserver(()=>{this._calculateIFrameHeight&&this._calculateIFrameHeight()});n.safeExecute(()=>{this._currentVertical===2?this._mutationObserver.observe(o.getElementById("images"),t):this._currentVertical===3&&this._mutationObserver.observe(o.getElementById("video"),t)},"onIFrameLoadedCallback")}this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&s.sj_rra&&s.sj_rra(t);this._timestampFirstRender=n.getCurrentTime();this.instrumentOnPreviewPaneRendered(!0,!1)},this._iframe.onload=()=>{if(h&&(this._scrollArea.scrollTop=0,this.clearWsbPrefetchStorage(),this.stopLoadingScreen()),c){this.tryLaunchUrl(t,s.location.href,0,e);return}c=!0;this.overrideAjaxCalls(s,r,u,e)},e)i=DOMPurify.sanitize(i,{WHOLE_DOCUMENT:!0,ADD_TAGS:["meta","link"],ADD_ATTR:["name","charset","content","http-equiv","id","href","rel","type","size","media",]});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()}setIframeHeight(n,t){const i=t?s:yt;return n<i&&(n=i),this._iframe.style.height=n+"px",n}overrideAjaxCalls(t,i,r,u){u||(t.sj_gx=()=>{let t=sj_gx(),u=t.open;return t.open=(f,e,o,s,h)=>{if(this.blockedMiniSERPUrls.some(n=>e.startsWith(n)))throw new Error("MiniSERP blocked URL request: iFrame URL: "+this._iframe.contentDocument.baseURI+" requestUrl: "+e);f=="GET"&&r&&(e=ThresholdUtilities.setUrlParameter(e,"client","windowsMiniSerp"));n.config.isThemeAware&&n.isDarkModeEnabled()&&(e=ThresholdUtilities.setUrlParameter(e,"darkschemeovr","1"));n.config.useCobaltCSS&&!e.includes("&addfeaturesnoexpansion=wsbcobalt")&&(e=ThresholdUtilities.setUrlParameter(e,"addfeaturesnoexpansion","wsbcobalt"));u(f,e,o,s,h);for(let n in i)t.setRequestHeader(n,i[n])},t})}captureNavigationsAndSizeEvents(t,i,r,f,e){this._focusHelper=this.createFocusHelper(r,f);this._focusHelper&&(this._originalMiniSerpXYFocusRoot=this._focusHelper.getXYFocusRoot());this._previewPaneViewModelParent.focusPending&&(this._previewPaneViewModelParent.focusPending=!1,this.focus());this._iframe.contentWindow.overlay_onBeforeContentLoad=()=>{this.setIframeHeight(vt)};this._iframe.contentWindow.overlay_onBeforeSuccess=n=>{this.setIframeHeight(n.clientHeight+bt)};let o=()=>{r.sj_lc=n=>{if(n)this.tryLaunchUrl(t,n,0,e);else{let n=this._previousURLs[this._previousURLs.length-2];this._previousURLs.splice(this._previousURLs.length-2,2);this.tryLaunchUrl(t,n,0,e)}},r.MiniSerp=!0,this._calculateIFrameHeight()},h=n=>{this._focusHelper.setXYFocusRoot(n),this._focusHelper.moveFocusToEdgeFocusableElement(0)},s=r.sj_evt;if(s)["onP1","ajaxReady"].forEach(n=>s.bind(n,o)),s.bind("l2_overlay_visible",n=>{o();var t=this._iframe.contentDocument.getElementById(n[1]);t&&(this._focusHelper.setIsL2Visible(!0),h(t))}),s.bind("l2_overlay_hidden",()=>{o(),this._focusHelper.setIsL2Visible(!1),h(this._iframe.contentDocument.body)});else o();r.open=n=>(this.tryLaunchUrl(t,n,0,e),null);i.onclick=i=>{let r=i.target;if(r){if(r.id=="miniSERPToWeb"){n.InstrumentationHelper.logClientInstEvent(u,"AdultExplicitLoad",n.SequenceNumberManager.getSequenceNumber(),{url:t,query:this._previewedSuggestion.query},"BingTelemetry");this._footer.click();return}while(r&&!r.href)r=r.parentNode}r&&this.tryLaunchUrl(t,r.href,n.getInputType(i),e)==0&&i.preventDefault()}}navigateInPlace(t,i,r,u){let f=d(u);this._previewPaneViewModelParent.onBeforeItemLaunch(i,r,f);this._footer&&(this._footer.onclick=()=>n.Host.launchSearchAsync(null,this.enrichBingSearchUrlParameters(t),!1));this.clearContent();this._previewPaneViewModelParent.focusPending=!0;this.startLoadingScreen();let e=this.enrichBingSearchUrlParameters(t,!0);this.setVertical(u);let o={destinationVertical:u.toString(),url:t};n.InstrumentationHelper.logClientInstEvent("Select","NavigateInPlace",n.SequenceNumberManager.getSequenceNumber(),o);this.downloadAndDisplayMiniSerp(this._previewedSuggestion,e,null,1);this._previewPaneViewModelParent.onAfterItemLaunch(f)}tryLaunchUrl(t,i,r,u){var s;if(!i)return 1;let h=n.getCurrentTime();i=i.trim();let f=i.toLowerCase(),c=g(i);if(c!==null&&k(i)&&!b(f)&&fi(i)&&c!==this._currentVertical)return this.navigateInPlace(i,h,r,c),0;if(f.startsWith("javascript:location.reload"))return 0;if(i==t+"#"||f.startsWith("javascript:"))return 1;if(f=="/loading")return 0;if(i.startsWith(window.location.href))return n.LogWSBError("previewPane.tryLaunchUrl",t,new Error("Anchor navigation on PreviewPane"),undefined,undefined,"WindowsTelemetry"),0;if(i.startsWith("/")&&(i=n.getWindowProtocol()+"//"+n.getWindowHost()+i),n.isThirdPartySearchAllowed()&&u)return n.Host.launchThirdPartyUriWithProtocolAsync(i,(s=this._currentQuery.thirdPartySearch)===null||s===void 0?void 0:s.protocol),0;let e=g(i);if(e){if(e==this._currentVertical&&k(i)&&kt.some(n=>f.includes(n)))return this.navigateInPlace(i,h,r,e),0;i=this.enrichBingSearchUrlParameters(i)}let l=e?d(e):2;this._previewPaneViewModelParent.onBeforeItemLaunch(h,r,l);let o=n.tryGetBingPathLC(i);(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(this._previewedSuggestion.handoffType))?n.msbHost.proactiveSearchManager.tryLaunchProactiveWorkSearchAsync(i):o?at.some(n=>o.startsWith(n))||b(f)?n.Host.launchUriAsync(n.config.settingsUri):o.startsWith("/profile/interests")?n.Host.launchCat1Async(null,"ms-cortana://navigate/Notebook",null):(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isTenantMsbEnabled())&&(o=="/work/search"||o=="/school/search")?n.msbHost.proactiveSearchManager.tryLaunchProactiveWorkSearchAsync(i,!0):(this._shouldAddSearchBackStack&&i.indexOf("aclk?ld=")>-1&&(sb_ct(this._currentBackStackTimeout),i=this.buildAdsRedirectUrl(this._previewedSuggestion.query,i)),n.Host.launchUriAsync(i)):(this._shouldAddSearchBackStack&&!f.startsWith("ms-settings")&&(sb_ct(this._currentBackStackTimeout),i=this.buildRedirectUrl(this._previewedSuggestion.query,i)),n.Host.launchUrlWithEdgeProtocolAsync(i,{campaign:n.config.moreEdgeProtocolOCID,medium:"Miniserp"}));this._previewPaneViewModelParent.onAfterItemLaunch(l);return 0}enrichBingSearchUrlParameters(n,t=false){return 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}createFocusHelper(n,t){let i=this.getSearchAppWinJSXYFocus(n);return!i&&typeof SearchAppWinJS!="undefined"&&SearchAppWinJS&&SearchAppWinJS.initXYFocus&&(SearchAppWinJS.initXYFocus(n),i=this.getSearchAppWinJSXYFocus(n),n[ot]=i?!0:!1),i?new nt(t,n,i,this._scrollArea,this._currentVertical):null}getSearchAppWinJSXYFocus(n){let i,t=n[st];return t&&t.UI&&(i=t.UI.XYFocus),i}tryExecuteFocusOnMiniSerp(t){let i=!1;return this._focusHelper&&(i=t()),i||this._footer&&!n.config.disableMiniserpButton&&(this._footer.focus(),i=!0),i}buildAdsRedirectUrl(t,i){var r=new URL(i);if(!r||!r.search||r.search.length<1)return i;let u;return u=n.config.enableOfflineWithWeb&&n.config.webHost&&n.isBrowserOnline()?n.config.webHost:_w.location.protocol+"//"+_w.location.host,u+"/WS/redirect/?q="+n.encodeQueryParameter(t)+"&form="+n.mapOSFormCode("WSBBST")+"&cvid="+n.encodeQueryParameter(n.Host.getConversationId())+"&rtk="+this._iframe.contentWindow.rtk+"&"+r.search.substring(1)}buildRedirectUrl(t,i){let r;return r=n.config.enableOfflineWithWeb&&n.config.webHost&&n.isBrowserOnline()?n.config.webHost:_w.location.protocol+"//"+_w.location.host,r+"/WS/redirect/?q="+n.encodeQueryParameter(t)+"&url="+btoa(i)+"&form="+n.mapOSFormCode("WSBBST")+"&cvid="+n.encodeQueryParameter(n.Host.getConversationId())+"&rtk="+this._iframe.contentWindow.rtk}warmup3s(){n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.prefetchManager.Warmup3s()}bindWsbPrefetchResponseWithModel(){this._wsbPrefetchGuid=n.Host.createGuid();this._wsbPrefetchModel={};this.bindWsbPrefetchSuccessWithModel();this.bindWsbPrefetchFailureWithModel()}bindWsbPrefetchSuccessWithModel(){f.forEach(t=>{if(t==="bfbVerticalConfig"){const i=n.LightweightStorage.getItem(n.VerticalConfigLocalStorageKeyV2);if(i){const n=JSON.parse(i),r={status:"done",response:{"0":"bfbVerticalConfig","1":n.data}};this._wsbPrefetchModel[t]=r}}else this.bindWsbPrefetchResponse(t)})}bindWsbPrefetchResponse(n){this._wsbPrefetchModel[n]={status:"inprogress"};const t=i=>{const r={status:"done",response:i};this._wsbPrefetchModel[n]=r;sj_evt.unbind(n,t)};sj_evt.bind(n,t,!1,0,!0)}bindWsbPrefetchFailureWithModel(){o.forEach(n=>{const t=i=>{const r={status:"failed",response:i};this._wsbPrefetchModel[n]=r;sj_evt.unbind(n,t)};sj_evt.bind(n,t,!1,0,!0)})}handleLoadingStateForWorkScope(){this.handleLoadingStateEvent(ii)}handleLoadingStateEvent(n){var t,i;if((i=(t=this._iframe)===null||t===void 0?void 0:t.contentWindow)===null||i===void 0?void 0:i.sj_evt){const t=()=>{var i;this.stopLoadingScreen();(i=this._iframe.contentWindow.sj_evt)===null||i===void 0?void 0:i.unbind(n,t)};this._iframe.contentWindow.sj_evt.bind(n,t,!0,0,!0)}}handleWorkResultsSize(){var t,i;((i=(t=this._iframe)===null||t===void 0?void 0:t.contentWindow)===null||i===void 0?void 0:i.BingAtWork)&&!this._iframe.contentWindow.BingAtWork.workVerticalResultsRendered&&(this._iframe.contentWindow.BingAtWork.workVerticalResultsRendered=t=>{n.config.useCobaltCSS?(t=!this._currentSuggestion.navDomain&&t===wt?this._iframe.contentDocument.body.offsetHeight:t+l,t=t<c?c:t):(t=!this._currentSuggestion.navDomain&&t===pt?this._iframe.contentDocument.body.offsetHeight:t+l,t=t<s?s:t),this.setIframeHeight(t,!0)})}handleWorkScopeInst(){var t,i;if((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWsbLoggerForDmaRegionDisabled())&&(((t=this._iframe)===null||t===void 0?void 0:t.contentWindow)&&(this._iframe.contentWindow.ClientInstConfig=this._iframe.contentWindow.ClientInstConfig||{},this._iframe.contentWindow.ClientInstConfig.isInstrumentationEnabled=!1,this._iframe.contentWindow.sb_ppCPL=1),(i=this._iframe)===null||i===void 0?void 0:i.contentDocument)){const n=this._iframe.contentDocument.getElementById("b_footer");n===null||n===void 0?void 0:n.addEventListener("mousedown",n=>{n.stopPropagation()})}}handleWsbPrefetch(){this._iframe.contentWindow&&(this._iframe.contentWindow[ti]=this._wsbPrefetchGuid,f.forEach(n=>{const t=this._wsbPrefetchModel[n];t&&this.setWsbPrefetchToInframeStorageAndFireEvent(t,n,!1,"handleWsbPrefetch:success")}),o.forEach(n=>{const t=this._wsbPrefetchModel[n];t&&t.status==="failed"&&this.setWsbPrefetchToInframeStorageAndFireEvent(t,n,!1,"handleWsbPrefetch:failure")}));this.bindAndSetWsbPrefetchToChildIframeStorage()}setWsbPrefetchToInframeStorageAndFireEvent(n,t,i,r){var u,f;if(n){const o=JSON.stringify(n),e=`${a}${t}-${this._wsbPrefetchGuid}`;try{((u=this._iframe)===null||u===void 0?void 0:u.contentWindow)&&(this._iframe.contentWindow.sessionStorage.setItem(e,o),i&&((f=this._iframe.contentWindow.sj_evt)===null||f===void 0?void 0:f.fire(`${v}${e}`,n)))}catch(s){}}}bindAndSetWsbPrefetchToChildIframeStorage(){this._iframe.contentWindow&&(this.bindAndSetWsbPrefetchSuccess(),this.bindAndSetWsbPrefetchFailure())}bindAndSetWsbPrefetchSuccess(){f.forEach(n=>{const t=i=>{if(i){let t={status:"done",response:i};this.setWsbPrefetchToInframeStorageAndFireEvent(t,n,!0,"bindAndSetWsbPrefetchSuccess")}sj_evt.unbind(n,t)};sj_evt.bind(n,t,!1,0,!0)})}bindAndSetWsbPrefetchFailure(){o.forEach(n=>{const t=i=>{let r={status:"failed",response:i};this.setWsbPrefetchToInframeStorageAndFireEvent(r,n,!0,"bindAndSetWsbPrefetchFailure");sj_evt.unbind(n,t)};sj_evt.bind(n,t,!1,0,!0)})}clearWsbPrefetchStorage(){var n;((n=this._iframe)===null||n===void 0?void 0:n.contentWindow)&&(f.forEach(n=>{var t,i;const r=`${a}${n}`;(i=(t=this._iframe)===null||t===void 0?void 0:t.contentWindow)===null||i===void 0?void 0:i.sessionStorage.removeItem(r)}),this._wsbPrefetchModel={})}isWorkScopeSubVerticalChange(t){return t.scope===n.Scope.Work&&t.query===this._queryShown}}n.MiniSerpViewModel=oi;class nt{constructor(t,i,r,u,f,e){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);const s="b_hide",h="acc-inactive",c=".b_slidebar";this._focusDiv=sj_ce("div",tt,s);t.body.appendChild(this._focusDiv);sj_be(t,"blur",t=>{this._useStickyFocus?(!t.srcElement.offsetParent||t.srcElement.classList.contains("b_hide")||t.relatedTarget)&&n.setVisibility(this._focusDiv,!1):n.setVisibility(this._focusDiv,!1)},!0);var o=!0;sj_be(t,"click",()=>o=!1,!0);sj_be(t,"keydown",()=>o=!0,!0);sj_be(t,"focus",()=>this.updateFocusedElementAndOutline(this._targetDocument.activeElement,o),!0);sj_be(t,"scroll",n=>{this._lastElementFocused&&(n.srcElement==this._lastElementFocused||this._lastElementFocused.compareDocumentPosition(n.srcElement)&Node.DOCUMENT_POSITION_CONTAINS)&&this.updateFocusedElementAndOutline(this._lastElementFocused,o)},!0);sj_be(t,"transitionend",n=>{let t=this._targetDocument.activeElement;(n.propertyName=="height"||n.srcElement==t.closest(c))&&(this._focusOutlineTimeout?(this.clearFocusOutlineTimeout(),this.outlineElementAndScrollIntoView(t)):this._focusDiv.classList.contains(s)||this.outlineElementAndScrollIntoView(t),n.srcElement.style.height=="0px"?n.srcElement.classList.add(h):n.srcElement.classList.remove(h))});this._searchAppXYFocus.keyCodeMap.home.push(36);this._searchAppXYFocus.keyCodeMap.end.push(35)}getXYFocusRoot(){return this._searchAppXYFocus.focusRoot}isL2Visible(){return this._isL2Visible}setIsL2Visible(n){this._isL2Visible=n}setXYFocusRoot(n){this._searchAppXYFocus.focusRoot=n}moveFocus(n,t){return this._searchAppXYFocus._xyFocus(n,t)}moveFocusToWindow(){this._targetWindow.focus()}moveFocusToEdgeFocusableElement(n,t=false){this._targetWindow.focus();let i;if(t&&n==0)i=this.focusFirstSerpElement();else{let u,f,t,e=this._targetWindow.innerWidth,o=this._targetWindow.innerHeight;n==0?(u=-1,f=0,t=40):n==1&&(u=o,f=o+1,t=38);let s={top:u,bottom:f,right:e,left:0,height:1,width:e};i=this._searchAppXYFocus._xyFocus(r[t],t,s)}return i&&(this.scrollTo(n),this.updateFocusedElementAndOutline(this._targetDocument.activeElement)),i}onSearchBoxFocusChanged(){this._targetDocument.hasFocus()?this.updateFocusedElementAndOutline(this._targetDocument.activeElement):this._useStickyFocus||n.setVisibility(this._focusDiv,!1)}isVisible(n){let t=_w.getComputedStyle(n);return!(t.visibility=="hidden"||t.display=="none"||n.offsetWidth===0&&n.offsetHeight===0)}moveFocusToLastFocusedElement(){return this._lastElementFocused&&this.isVisible(this._lastElementFocused)?(this._lastElementFocused.focus(),this.updateFocusedElementAndOutline(this._lastElementFocused),!0):this.moveFocusToEdgeFocusableElement(0,!0)}updateFocusedElementAndOutline(t,i=true){if(t&&t!=this._targetDocument.body&&(this.processFocusedElement(t),n.config.disbaleWideForLargeTextScale&&(_qs(".resultsContainer").scrollLeft=_qs(".resultsContainer").scrollWidth),i)){let r=this._lastElementFocused&&t.elementType&&t.elementType==this._lastElementFocused.elementType&&t.parentElement==this._lastElementFocused.parentElement?et:0;r?(n.setVisibility(this._focusDiv,!1),this._focusOutlineTimeout=n.safeSetTimeout(()=>{this._targetDocument.activeElement==t&&this.outlineElementAndScrollIntoView(t),this.clearFocusOutlineTimeout()},r,"updateFocusedElementAndOutline")):this.outlineElementAndScrollIntoView(t);this._lastElementFocused=t}}outlineElementAndScrollIntoView(t){if(t!=this._targetDocument.body&&(this._useStickyFocus||this._targetDocument.hasFocus())){let r=t.getBoundingClientRect(),a=this._targetDocument.documentElement.scrollWidth-i*2,v=this._targetDocument.documentElement.scrollHeight-i*2,o=r.top+this._targetWindow.pageYOffset,u=r.left+this._targetWindow.pageXOffset,y=a-u,p=v-o,s=u<0?Math.floor(r.width+u-i):r.width;if(s<=0){n.setVisibility(this._focusDiv,!1);return}let f=r.height;if(f<=0&&t.children.length>0)for(let n=0;n<t.children.length;n++){let i=t.children[n].getBoundingClientRect();i.height>f&&(f=i.height,o=i.top)}this._focusDiv.style.top=Math.max(i,o)+"px";this._focusDiv.style.left=Math.max(this.isL2Visible?i:i*4,u)+"px";this._focusDiv.style.width=Math.min(y,s)+"px";this._focusDiv.style.height=Math.min(p,f)+"px";n.setVisibility(this._focusDiv,!0);let h=t.getBoundingClientRect(),c=this._scrollArea.offsetHeight+this._scrollArea.scrollTop-h.bottom-e,l=h.top-this._scrollArea.scrollTop-e;c<0?this._scrollArea.scrollTop+=e-c:l<0&&(this._scrollArea.scrollTop+=l-e)}}scrollTo(n){let t=0;n==1&&(t=this._scrollArea.scrollHeight);this._scrollArea.scrollTop=t}processFocusedElement(i){if(!i.isProcessed){let r=i.tagName.toLocaleLowerCase(),u=i.getAttribute("type");r=="select"&&(sj_be(i,"keydown",n=>{n.keyCode==32?i.classList.add(t):n.keyCode==13&&i.classList.remove(t)},!0),this.reactivateXYFocusOnBlur(i));r=="input"&&u=="range"&&(sj_be(i,"keydown",n=>{let 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));r=="button"&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeApplicable())&&sj_be(i,"click",()=>n.setVisibility(this._focusDiv,!1));let f=(n,r)=>{if(!r.readOnly){let e=r.selectionStart!=r.selectionEnd;if(e){i.classList.add(t);return}let u=r.selectionEnd==0,f=r.selectionEnd==r.value.length,o=n.keyCode==36&&!u,s=n.keyCode==35&&!f,h=n.keyCode==37&&!u,c=n.keyCode==39&&!f;h||c||o||s?i.classList.add(t):i.classList.remove(t)}};if(r=="textarea"&&(sj_be(i,"keydown",n=>f(n,n.target),!0),this.reactivateXYFocusOnBlur(i)),r=="input"&&(u=="number"||u=="text")&&(sj_be(i,"keydown",n=>f(n,n.target),!0),this.reactivateXYFocusOnBlur(i)),rt.some(n=>i.classList.contains(n))){i.elementType="slide";let t=Array.prototype.slice.call(i.querySelectorAll("a:not([onclick='TestHooks.HideShowTestHooks(this);']):not([disabled])"),0),n=t.filter(n=>this.isVisible(n)&&n.offsetHeight>0&&n.offsetWidth>0);n&&sj_be(i,"keydown",t=>{let r=this.countUniqueHrefs(n),u=t.keyCode;t.srcElement==i&&(r>1&&u==40?(t.preventDefault(),this._searchAppXYFocus.focusRoot=i,n[0].focus()):r==1&&u==13&&n[0].click())})}else if(ut.some(n=>i.hasAttribute(n))){i.elementType="expansion";let t=(t=true)=>{n.setVisibility(this._focusDiv,!1),this.updateFocusedElementAndOutline(this._targetDocument.activeElement,t)};sj_be(i,"keyup",n=>{n.keyCode==13&&t()},!0);sj_be(i,"click",()=>{t(!1)})}else if(i.classList.contains(ft)){let n=()=>{let n=this._targetDocument.getElementById("vidPreStopButton");n&&n.focus();let t=()=>{i.focus()};sj_be(n,"click",t);sj_be(n,"keydown",function(n){n=sj_ev(n);n.keyCode===13&&t()});let r=this._targetDocument.getElementsByTagName("video")[0];sj_be(r,"ended",t)};sj_be(i,"keydown",t=>{t.keyCode==13&&n()},!0);sj_be(i,"click",()=>{n()})}i.classList.add(it);i.isProcessed=!0}}countUniqueHrefs(n){let t={};if(n)for(let i=0;i<n.length;i++){let r=n[i];r&&(t[r.href]=!0)}return Object.keys(t).length}reactivateXYFocusOnBlur(n){sj_be(n,"blur",()=>{n.classList.remove(t)})}focusFirstSerpElement(){let n;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;case 4:n=this._targetDocument.getElementById("dsb_first_foc");break;default:throw Error("Unknown vertical type "+this._verticalType);}if(n){let t=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)');for(let n=0;n<t.length;n++){let i=t[n];if(this.isVisible(i))return i.focus(),!0}}return!1}clearFocusOutlineTimeout(){sb_ct(this._focusOutlineTimeout);this._focusOutlineTimeout=null}}n.WSBMiniSerpFocusHelper=nt}(WSB||(WSB={})),function(n){function r(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);}}function u(n){let t="None";switch(n){case 2:t="Local";break;case 3:t="Msb";break;case 1:t="Web"}return t}const t="noScroll",i="msStoreApp";n.getPreviewPaneTypeAsString=u;class f{constructor(t,i,r,u){this._page=t;this._previewPaneId=0;this._beforeItemLaunchEventHandlers=[];this._afterItemLaunchEventHandlers=[];let s=(n,t,i,r,u)=>{this._clickLoggedForCurrentPreviewPane||this._beforeItemLaunchEventHandlers.forEach(f=>f(n,this._previewedSuggestion,t,i,r,u))},h=n=>{this._clickLoggedForCurrentPreviewPane||(this._afterItemLaunchEventHandlers.forEach(t=>t(this._previewedSuggestion,this._queryForPreviewedSuggestion,n)),this._clickLoggedForCurrentPreviewPane=!0)},c=t=>{var i,r;this._previewPaneResponseReceivedTimeStamp=t;const u=((i=this._activePreviewPaneViewModel)===null||i===void 0?void 0:i.getCurrentHandoffType)?((r=this._activePreviewPaneViewModel)===null||r===void 0?void 0:r.getCurrentHandoffType())===21:!1;(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.isLoading)||!this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)||u||this._activePreviewPaneViewModel.stopLoadingScreen()};this._previewPaneViewModelParent={focusPending:!1,onBeforeItemLaunch:s,onAfterItemLaunch:h,onResponseReceived:c};let f=_ge("localPane"),e=_ge("miniSerpPane"),o=_ge("msbPane");i.init(this._previewPaneViewModelParent,e);r&&r.init(this._previewPaneViewModelParent,f);u&&u.init(this._previewPaneViewModelParent,o);SearchAppWrapper.CortanaApp.addEventListener("resettingtodefaultsize",()=>this.dismiss());n.Host.bindKeyDown(()=>{this._previewPaneViewModelParent.focusPending=!1});n.Host.bindSearchBoxGotFocus(()=>this._previewPaneViewModelParent.focusPending=!1);n.Host.bindQueryChangedOrInitialized(n=>this._currentQuery=n,!0);n.Host.bindAccountChanged(()=>{this._miniSerpMustRefresh=!0});n.InstrumentationHelper.bindFinalizeKeystroke(n=>{this._activePreviewPaneViewModel&&n&&this._activePreviewPaneViewModel.finalizeKeystroke()});this._previewPaneInfos=[];this._previewPaneInfos[0]={paneElement:_ge("errorPane"),viewModel:null};this._previewPaneInfos[1]={paneElement:e,viewModel:i,disableRootScroll:!0};this._previewPaneInfos[2]={paneElement:f,viewModel:r,disableRootScroll:n.config.useCobaltCSS?!0:!1};this._previewPaneInfos[3]={paneElement:o,viewModel:u}}init(n){this._selectionHandler=n}getSelectableItems(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectableItems():[]}getSelectableItemsByGroup(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectableItemsByGroup():[]}getSelectedItem(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.getSelectedItem():null}select(n,t){this._activePreviewPaneViewModel&&this._activePreviewPaneViewModel.select(n,t)}onAfterKeyDown(n,t,i,r){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.onAfterKeyDown(n,t,i,r):!1}getPreviewedSuggestion(){return this._previewedSuggestion}getPreviewedSuggestionToForceTopHit(){return this._forceTopHitForPreviewedSuggestion&&!this._closeTimer?this._previewedSuggestion:null}getOnPreviewPaneRendered(t,i,f,e){let h=++this._previewPaneId,o=!0,c=n.getCurrentTime();this._instrumentedOpenThisImpression=!1;let s=t?u(t.previewPaneType):"None";return n!==undefined&&n.config.perfLogging&&n.WSBPerformance&&n.WSBPerformance.getInstance().beginMark("RenderPreviewPane - "+s),(u,l,a)=>{if(u||!l){if(l||(o=!1),!this._instrumentedOpenThisImpression){let u={ppId:""+h,openType:i,suggestion:t?t.instItem.getLayoutKValue():undefined,suggestionType:t?t.type:undefined,startOpening:""+c,openDelay:f?""+f:undefined};if(a)for(let n in a)u[n]=a[n];u.waitingForMore=o?"true":undefined;n.InstrumentationHelper.previewPaneOpenedOrClosed(!0,n.SequenceNumberManager.getSequenceNumber(),t?t.instItem:undefined,t?t.previewPaneType:undefined,r(i,e)==0,u)}this._instrumentedOpenThisImpression=!0;u&&(this._instrumentedOpenThisImpression=!1,i="keepOpen");!o&&n!==undefined&&n.config.perfLogging&&n.WSBPerformance&&n.WSBPerformance.getInstance().endMark("RenderPreviewPane - "+s)}}}onPreviewPaneErrored(i){for(let t of this._previewPaneInfos)n.setVisibility(t.paneElement,!1);this._page.updateNarratorMessageView(null);n.StaticHtmlElements.qfPreviewScrollArea.classList.remove(t);this._page.updatePreviewErrorMessageView(i);n.setVisibility(this._previewPaneInfos[0].paneElement,!0);this._page.updateNarratorMessageView(i.narratorMessage)}startOrResetPreviewPaneDwellTimer(t,i){if(n.isSemanticSearchTelemetryEnabled()){if(this.clearDwellTimer(),!i&&!n.isPhoto(t.type))return;n.isNullOrUndefined(n.config.dwellPreviewDuraThres)||(this._previewPaneTimer=n.safeSetTimeout(()=>{n.InstrumentationHelper.InstrumentQFPreviewPaneDwell(t)},n.config.dwellPreviewDuraThres,"preview pane photo",this._previewPaneId.toString()))}}showPreview(t,i,u="button",f=false,e=0,o=false){if(this.updateMsbWorkScopeSuggestion(t,i),this._previewPaneOpenedForThisQuery=!0,this.clearSuggOpeningState(this._pendingPreviewedSuggestion),this.clearOpenTimer(),this.clearCloseTimer(),this.startOrResetPreviewPaneDwellTimer(i,!1),i!=this._previewedSuggestion||f){n.RuntimeConfig.AlwaysWide||this._page.setPreviewPaneVisibility(!0);let f=this.getOnPreviewPaneRendered(i,u,e,t);o?n.InstrumentationHelper.notifyPreviewPanePending(n.SequenceNumberManager.getSequenceNumber(),i.previewPaneType,i.type):n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber());this.setPreviewPaneContent(t,i,r(u,t),this._previewPaneId,f,n=>this.onPreviewPaneErrored(n));this._selectionHandler.updateLastMiniSerpAutoSuggestion(i)}u!="button"&&this._selectionHandler.updateSelectionState(i)}updateMsbWorkScopeSuggestion(t,i){var r,u,f;const e=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(i.handoffType);e&&(i.previousQuery=(r=this._previewedSuggestion)===null||r===void 0?void 0:r.query,i.previousScope=(u=this._previewedSuggestion)===null||u===void 0?void 0:u.scope,i.query=t.queryToFetch,i.scope=t.scope,i.previousMsbVerticalHash=(f=this._previewedSuggestion)===null||f===void 0?void 0:f.msbVerticalHash)}showPreviewAndFocus(n,t,i="submit"){var r;(this._closeTimer||this._previewedSuggestion!=t)&&this.showPreview(n,t,i);(r=this._activePreviewPaneViewModel)===null||r===void 0?void 0:r.focus(!1);this._forceTopHitForPreviewedSuggestion=!0}focus(n){return this._activePreviewPaneViewModel?(this._activePreviewPaneViewModel.focus(n),!0):!1}blur(){this._activePreviewPaneViewModel&&this._activePreviewPaneViewModel.blur()}dismiss(){this.close(!0)}close(t){this.clearOpenTimer();var i=t?0:n.config.closePreviewPaneDelay;i?this._closeTimer||(this._closeTimer=n.safeSetTimeout(()=>{this._closeTimer=null,this.innerClose(t)},i,"ppCloseTimer")):(this.clearCloseTimer(),this.innerClose(t));n.isSemanticSearchTelemetryEnabled()&&this.clearDwellTimer()}innerClose(t){if(this._previewedSuggestion){let i=!0;if(t&&(this._clickLoggedForCurrentPreviewPane?i=!1:this._previewPaneResponseReceivedTimeStamp&&n.getCurrentTime()>this._previewPaneResponseReceivedTimeStamp+1e3&&(i=!1)),i){let i=t?{fromQFDismiss:"1"}:undefined;n.InstrumentationHelper.previewPaneOpenedOrClosed(!1,n.SequenceNumberManager.getSequenceNumber(),this._previewedSuggestion.instItem,this._previewedSuggestion.previewPaneType,undefined,i)}n.RuntimeConfig.AlwaysWide||t||this._page.setPreviewPaneVisibility(!1);this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen();this.clear()}}clear(t){for(let 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&&(t||this._activePreviewPaneViewModel.clear(),this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen());this._queryForPreviewedSuggestion=null;this._previewPaneResponseReceivedTimeStamp=null;this._activePreviewPaneViewModel=null}onQueryChanged(t,i){this._previewPaneOpenedForThisQuery=!1;this.startOrResetPreviewPaneDwellTimer(this._previewedSuggestion,!0);let r=this._queryForPendingPreviewedSuggestion||this._queryForPreviewedSuggestion;if(this._queryIsContinuationOfPreviousQuery=r&&t.queryToFetch.toLocaleLowerCase().startsWith(r.queryToFetch.toLocaleLowerCase()),r&&t.queryToFetch.toLocaleLowerCase()!=r.queryToFetch.toLocaleLowerCase()){let u=this._pendingPreviewedSuggestion&&this._pendingPreviewedSuggestion.updateFromQuery?this._pendingPreviewedSuggestion:this._previewedSuggestion&&!this._closeTimer&&this._previewedSuggestion.updateFromQuery?this._previewedSuggestion:null;if(u){if(n.RuntimeConfig.AlwaysWide){this.autoOpen(t,u,"alwaysWide",!0,!0);return}this._queryIsContinuationOfPreviousQuery?(this._forceTopHitForPreviewedSuggestion=!1,this.autoOpen(t,u,"keepOpen",!0,!0)):this.close(!1)}else i&&this.autoOpen(t,i,"keepOpen",!0,!0)}}clearSuggOpeningState(n){n&&(n.isPreviewPaneOpening=!1,this._selectionHandler.updateSelectionState(n))}clearOpenTimer(){this._openTimer&&(sb_ct(this._openTimer),this._openTimer=null,this._pendingPreviewedSuggestion.isPreviewPaneOpening=!1,this._pendingPreviewedSuggestion=null,this._queryForPendingPreviewedSuggestion=null,this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen())}clearCloseTimer(){this._closeTimer&&(sb_ct(this._closeTimer),this._closeTimer=null)}clearDwellTimer(){sb_ct(this._previewPaneTimer);this._previewPaneTimer=null}onTopHitUpdated(t,i,r,u){if(r){if(!this._closeTimer&&(this._openTimer&&this._pendingPreviewedSuggestion!=r&&this.clearOpenTimer(),i&&r&&i.scope==r.scope&&i.scope==n.Scope.ThirdPartyWeb&&i.reactKey!=r.reactKey&&(this._miniSerpMustRefresh=!0),!this._miniSerpMustRefresh||r.previewPaneType!=1)){if(r.scope=t.scope,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.config.previewPaneRefreshPerfOpt?(this._previewedSuggestion=r,this._queryForPreviewedSuggestion=t,r.hasPreviewPaneOpened=!0,this._selectionHandler.updateSelectionState(r),(i.reactKey!=r.reactKey||r.previewPaneNeedsRefreshAfterDeduping)&&this.refreshLocalContent(t,r,n.SequenceNumberManager.getSequenceNumber())):(!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)}getDelayForMiniSerp(t,i,r){const 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.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isTenantMsbEnabled())?n.config.msbMiniSerpDelay:n.config.autoOpenMiniSerpDelay:n.config.keepMiniSerpOpenDelay;case"arrowUpOrDown":return u?Number.MAX_VALUE:n.config.openOnKeybNavMiniSerpDelay}return 0}calculateDelayForProbabilitySignal(t){for(let i=n.config.probabilityNextKeyStrokeThresholds.length-1;i>=0;i--)if(t>=n.config.probabilityNextKeyStrokeThresholds[i])return n.config.probabilityNextKeyStrokeDelays[i];return 0}shouldOpenMiniSerp(t){return n.RuntimeConfig.MiniSERPMode==0||t.previewPaneType!=1?!1:t.isAnswer?(n.RuntimeConfig.MiniSERPMode&1)!=0:t.type=="MD"||t.type=="TP"?(n.RuntimeConfig.MiniSERPMode&2)!=0:(n.RuntimeConfig.MiniSERPMode&4)!=4?!1:t.query.length>=n.config.minPrefixLengthForMiniSerp}shouldOpenCopilot(n){return n.previewPaneType==4?!0:!1}autoOpen(t,i,r,u,f){var o;n.InstrumentationHelper.notifyPreviewPaneStartRender(n.SequenceNumberManager.getSequenceNumber());f&&n.InstrumentationHelper.notifyPreviewPanePending(n.SequenceNumberManager.getSequenceNumber(),i.previewPaneType,i.type);let s=n.config.disableOfflineRequest?n.isBrowserOnline()&&this.shouldOpenMiniSerp(i):this.shouldOpenMiniSerp(i),e=s?this.getDelayForMiniSerp(r,i,t):0;if(n.config.wsbWithCopilotQF){let t=n.config.disableOfflineRequest?n.isBrowserOnline()&&this.shouldOpenCopilot(i):this.shouldOpenCopilot(i);t&&(e=n.config.autoOpenCopilotDelay)}e?((i===null||i===void 0?void 0:i.previewPaneType)!=((o=this._previewedSuggestion)===null||o===void 0?void 0:o.previewPaneType)&&this.clear(),(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(i.handoffType))||r!="arrowUpOrDown"||(this.clear(),this.clearSuggOpeningState(this._pendingPreviewedSuggestion),this.clearSuggOpeningState(this._previewedSuggestion)),i.isPreviewPaneOpening=!0,this._selectionHandler.updateSelectionState(i),this.clearOpenTimer(),this.clearCloseTimer(),n.isSemanticSearchTelemetryEnabled()&&this.clearDwellTimer(),this._pendingPreviewedSuggestion=i,this._queryForPendingPreviewedSuggestion=t,this.setActivePreviewPaneContainer(i,t),this._openTimer=e==Number.MAX_VALUE?Number.MAX_VALUE:n.safeSetTimeout(()=>{this._openTimer=null,i=this._pendingPreviewedSuggestion,this._pendingPreviewedSuggestion=null,this._queryForPendingPreviewedSuggestion=null,this.showPreview(t,i,r,u,e,f)},e,"ppOpenTimer"),!this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)||!this.isStartLoadingRequiredInWorkScopeScenarios(t,i)&&(r=="arrowUpOrDown"||this._previewedSuggestion!=null)||this._activePreviewPaneViewModel.startLoadingScreen()):this.showPreview(t,i,r,u,null,f)}onAfterKeyDownWhenNewSelection(t,i,r){let f=n.RuntimeConfig.AlwaysWide&&n.config.openOnKeybNavMiniSerp;if(n.isGroup(r)){if(f){this.clearSuggOpeningState(this._pendingPreviewedSuggestion);this.clearSuggOpeningState(this._previewedSuggestion);n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber());const t=r.type==n.GroupType.Related&&i.scope===n.Scope.Work;this.clear(t);this.clearOpenTimer();this.clearCloseTimer();n.isSemanticSearchTelemetryEnabled()&&this.clearDwellTimer();this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.stopLoadingScreen()}return}let u=r;u.previewPaneType?f&&(t==40||t==38||t==9)?(this._previewedSuggestion!=u||(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(u.handoffType)))&&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()}isStartLoadingRequiredInWorkScopeScenarios(t,i){var r;const u=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(i.handoffType),f=i.msbVerticalHash!=""&&t.scope===n.Scope.Work,e=i.previousMsbVerticalHash!=""&&i.msbVerticalHash==""&&t.scope===n.Scope.Work,o=((r=this._previewedSuggestion)===null||r===void 0?void 0:r.query)!==t.queryToFetch&&t.scope===n.Scope.Work;return u&&!f&&!o&&!e}refreshLocalContent(t,i,r){var u;let f=null;this._instrumentedOpenThisImpression&&(f=this.getOnPreviewPaneRendered(i,"refresh",0,t));let e=n=>this.onPreviewPaneErrored(n);n.InstrumentationHelper.notifyPreviewPanePending(r,i.previewPaneType,i.type);(u=this._activePreviewPaneViewModel)===null||u===void 0?void 0:u.update(i,t,0,this._previewPaneId,f,e,!0)}setActivePreviewPaneContainer(r){let u=r.previewPaneType;r.previewPaneType!=2&&(this.shouldOpenMiniSerp(r)||r.previewPaneType!=1)||(u=2);n.setVisibility(this._previewPaneInfos[u].paneElement,!0);this._activePreviewPaneViewModel=this._previewPaneInfos[u].viewModel;this._previewPaneInfos[u].disableRootScroll&&!n.isStore(r===null||r===void 0?void 0:r.type)?n.StaticHtmlElements.qfPreviewScrollArea.classList.add(t):n.StaticHtmlElements.qfPreviewScrollArea.classList.remove(t);(n.config.enableWinStoreAppPreview||n.config.enableWinStoreAppDataProvider)&&(n.isStore(r===null||r===void 0?void 0:r.type)?n.StaticHtmlElements.qfPreviewScrollArea.classList.add(i):n.StaticHtmlElements.qfPreviewScrollArea.classList.remove(i));this.isPreviewPaneWithLoaderViewModel(this._activePreviewPaneViewModel)&&this._activePreviewPaneViewModel.startLoadingScreen()}setPreviewPaneContent(t,i,r,u,f,e){var o,s;if(!((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(i.handoffType))&&((o=this._previewedSuggestion)===null||o===void 0?void 0:o.previewPaneType)===1)){const i=t.scope===n.Scope.Work&&!!t.queryToFetch;this.clear(i)}this._previewedSuggestion=i;this._previewedSuggestion&&(this._previewedSuggestion.hasPreviewPaneOpened=!0,this._previewedSuggestion.isPreviewPaneOpening=!1);this._previewPaneResponseReceivedTimeStamp=null;this._queryForPreviewedSuggestion=t;this.setActivePreviewPaneContainer(i,t);(s=this._activePreviewPaneViewModel)===null||s===void 0?void 0:s.update(i,t,r,u,f,e,i.previewPaneNeedsRefreshAfterDeduping)}bindBeforeItemLaunch(n){this._beforeItemLaunchEventHandlers.push(n)}bindAfterItemLaunch(n){this._afterItemLaunchEventHandlers.push(n)}hasFocus(){return this._activePreviewPaneViewModel?this._activePreviewPaneViewModel.hasFocus():!1}isOpened(){return!!this._previewedSuggestion}isPreviewPaneWithLoaderViewModel(n){return!!(n===null||n===void 0?void 0:n.startLoadingScreen)}}n.PreviewPane=f}(WSB||(WSB={})),function(n){const t="NR",i="RF",r="CHN",u="OFL";class f extends n.JsonDataProvider{getHostByReg(n){try{let t=/\/\/([^\/]+)/.exec(n);return t?t[1]:"invalidUrl"}catch(t){return"invalidUrl"}}getHost(n){let t=null;try{t=new URL(n)}catch(r){t=null}let i=t===null||t===void 0?void 0:t.hostname;return i||(i=`${this.getHostByReg(n)}_reg`),i}fetchUrl(f,e,o,s,h,c){if(n.isBrowserOnline()){const u=this.getHost(f),l=()=>{if(n.config.wsbUseFetchSendRequest){const t={url:f,body:o,requestType:o?"POST":"GET",headers:e};return n.fetchUrlAsync(`makeHttpRequestAsync_${u}`,t)}else{let r=o?1:0,n=SearchAppWrapper.CortanaApp,t=n.createStringMap(),i=n.createStringMap();if(e)for(let n in e)n.toLowerCase().startsWith("content")?i[n]=e[n]:t[n]=e[n];return n.makeHttpRequestAsync(r,f,t,o,i)}},a=r=>{c()&&(r.statusCode===200?n.Async.safeChain("cortanaJson_ReadResponse",()=>r.readAsStringAsync(),i=>{if(c()){n.TestHookUrlParameters&&i&&(i=i.replace(new RegExp("<!--[^]*?-->","gm"),""));let r=i?n.safeExecute(()=>JSON.parse(i),"parseCortanaHttpResponse",null,u):null;r!=null?s(this._dataSource,r,null):s(this._dataSource,null,t)}},()=>s(this._dataSource,null,i),h):s(this._dataSource,null,r.statusCode.toString()))};n.Async.safeChain(`makeHttpRequestAsync_${u}`,l,a,()=>s(this._dataSource,null,r),h)}else s(this._dataSource,null,u,null,!0)}}n.CortanaJsonDataProvider=f}(WSB||(WSB={})),function(n){var t;(function(t){function e(){return n.MockUrlParameters&&typeof n.MockedAnaheimDataResponse=="object"}function o(n){return n?n=="consumers"?1:n=="organizations"?2:9:0}function s(n){return n?n=="MSA"?1:n=="AAD"?2:9:0}const h=n.config.enableAnaheimDataQFPassive?80:20,u=5,f=2,r="ANA",c="lastUpdated";t.isForTest=e;t.getAccountTypeFromAuthority=o;t.getAccountTypeFromContentType=s;class i extends t.ClientSideStorage.StorageBasedDataProvider{static getResultsCount(){return i._getResultsCount}static getResultsExceptionCount(){return i._getResultsExceptionCount}static decreaseRetryCount(){return i.retryCount-=1}static getRetryCount(){return i.retryCount}static getExpirationThreshold(){let n=i.retryCount;return i.expirationThresholds[n]}static getAvailableChannels(){return i.availableChannels}static getSelectedProfile(){return i.selectedANAAccountProfile}static isInitialized(){return i.initialized}static setShouldShowAnaheimDataSH(n){return i.shouldShowAnaheimDataSH=n}static getShouldShowAnaheimDataSH(){return i.shouldShowAnaheimDataSH}static setShouldShowAnaheimDataQF(n){return i.shouldShowAnaheimDataQF=n}static getShouldShowAnaheimDataQF(){return i.shouldShowAnaheimDataQF}static setCachedAnaheimDismissedDataItemIds(n){var r,u,f,e,o,s,h,c;let t=[];t.push(...((u=(r=n===null||n===void 0?void 0:n.anaHistoryItems)===null||r===void 0?void 0:r.filter(({dismissed:n})=>n).map(n=>n.id))!==null&&u!==void 0?u:[]));t.push(...((e=(f=n===null||n===void 0?void 0:n.anaTopSitesItems)===null||f===void 0?void 0:f.filter(({dismissed:n})=>n).map(n=>n.id))!==null&&e!==void 0?e:[]));t.push(...((s=(o=n===null||n===void 0?void 0:n.anaRecentlyClosedItems)===null||o===void 0?void 0:o.filter(({dismissed:n})=>n).map(n=>n.id))!==null&&s!==void 0?s:[]));t.push(...((c=(h=n===null||n===void 0?void 0:n.anaFavoritesItems)===null||h===void 0?void 0:h.filter(({dismissed:n})=>n).map(n=>n.id))!==null&&c!==void 0?c:[]));i.cachedAnaheimDismissedDataItemIds=t}static setCachedAnaheimAccount(n){i.cachedAnaheimAccount=n===null||n===void 0?void 0:n.anaheimAccount}getName(){return"AnaheimDataProvider"}constructor(t,r){let u=(t,i,u)=>r(n.ANADatabaseName,n=>{t(n)},i,u,c),f=(t,r,u)=>(i.InstrumentStringNumber.LFC=++i._lifetimeFetchCount,n.safeExecute(()=>this.createAnaheimDataResponse(t,r,u),"createAnaheimDataResponse")),e=()=>!0,o=n=>n=="R"?undefined:n;super(u,f,e,o,"ANA");this.searchIndexerTime=0;n.Host.bindShown(()=>{this.resetInitialized(null),this.queryStorage("anaheimData",n=>{i.setCachedAnaheimAccount(n),i.setCachedAnaheimDismissedDataItemIds(n)},()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite()),this.searchIndexerWithMultipleResults(n.Host.getQuery(),new n.CancellationManager)});this.accessTokenManager=t;this._pendingWrites=[]}validateAndCompareAccount(n,t){return n?t?n.accountId==t.accountId&&n.accountProviderAuthority==t.accountProviderAuthority&&n.accountProviderId==t.accountProviderId&&n.accountState==t.accountState&&n.isDefaultAccount==Boolean(t.isDefaultAccount)?!0:!1:!1:!0}createAnaheimDataResponse(t,r){var h,c,l,a;i.setShouldShowAnaheimDataSH(!0);i.setShouldShowAnaheimDataQF(!0);n.config.reverseAnaheimData?i.InstrumentStringNumber.REV=1:i.InstrumentStringNumber.FWD=1;let v=this.selectedWSBAccount?o(this.selectedWSBAccount.accountProviderAuthority):-1,y=i.selectedANAAccountProfile?s(i.selectedANAAccountProfile.accountType):-1;i.InstrumentStringNumber.WAT=v;i.InstrumentStringNumber.AAT=y;i.InstrumentStringNumber.ACnt=i.aadCnt;i.InstrumentStringNumber.MCnt=i.msaCnt;i.InstrumentStringNumber.OCnt=i.otherCnt;let f=i.score;f==-1&&(f=this.getUserNameWithTypeScore(v,(c=(h=this.selectedWSBAccount)===null||h===void 0?void 0:h.accountUserName)!==null&&c!==void 0?c:"",y,(a=(l=i.selectedANAAccountProfile)===null||l===void 0?void 0:l.emailAddress)!==null&&a!==void 0?a:""),f==-1&&i.selectedANAAccountProfile&&(f=0));i.InstrumentStringNumber.Score=f;let u={anaheimDataItems:[],quickAnswers:[]};if(n.config.enableQuickSearch||!n.canShowQuickSearchWithoutANA(t)||n.isTrendingSearchDataEnabled(t)||(u=n.QuickSearchSuggestionsDataProvider.getQuickSearchResponse(u)),n.config.anaheimAccountCheckLevel==0||i.selectedANAAccountProfile||(r=[]),r)for(let{value:f}of r)if(f){let o=this.getSelectedWindowsAccount(),s=f===null||f===void 0?void 0:f.anaheimAccount,r=f===null||f===void 0?void 0:f.anaHistoryItems,e=f===null||f===void 0?void 0:f.anaTopSitesItems;if(this.validateAndCompareAccount(o,s)){if(i.InstrumentStringNumber.CFCC=++i._cachedFetchCount,r){let f=r===null||r===void 0?void 0:r.filter(({dismissed:n})=>!n);i.InstrumentStringNumber.PVDHS=f.length;n.config.enableAnaheimDataHS&&f.length>0&&!n.isTrendingSearchDataEnabled(t)&&u.anaheimDataItems.push(...f)}if(e){let t=e===null||e===void 0?void 0:e.filter(({dismissed:n})=>!n);i.InstrumentStringNumber.PVDTS=t.length;n.config.enableAnaheimDataTSTile&&t.length>0&&u.anaheimDataItems.push(...t)}}}return e()&&(u.anaheimDataItems=this.transformDeviceItemToAnaheimDataItem(n.MockedAnaheimDataResponse.deviceItems,undefined),u.quickAnswers=n.MockedAnaheimDataResponse.quickAnswers),t.isSearchHomeZI&&(u.remove=(n,t)=>this.dismissSingleAnaheimSuggestion(n,t)),u}isAnaheimDataItemDismissed(n){var t;if((t=i.cachedAnaheimDismissedDataItemIds)!==null&&t!==void 0)return t.some(t=>t===n)}shouldCompareWithCache(n,t){return t?n?JSON.stringify(n)===JSON.stringify(t):!1:!0}getDedupeKey(n){let t=n.getProperty("System.Link.TargetUrl");return t?new URL(t).hostname.replace("www.","")+n.getProperty("System.Title"):undefined}transformDeviceItemToAnaheimDataItem(n,t){var r,u,f;let o=this.shouldCompareWithCache(i.cachedAnaheimAccount,t),e=[];for(let t of n){let n={id:t.id,dateCreatedInS:0,lastUpdatedInS:0,dataType:"",url:t.getProperty("System.Link.TargetUrl"),title:t.getProperty("System.Title"),dateCreated:(r=t.getProperty("System.DateCreated"))===null||r===void 0?void 0:r.toString(),dateModified:(u=t.getProperty("System.DateModified"))===null||u===void 0?void 0:u.toString(),dateVisited:(f=t.getProperty("System.Link.DateVisited"))===null||f===void 0?void 0:f.toString(),visitCount:t.getProperty("System.History.VisitCount"),urlTypedCount:t.getProperty("System.History.SelectionCount"),dismissed:o?this.isAnaheimDataItemDismissed(t.id):!1,duplicated:!1,dedupeKey:this.getDedupeKey(t)};e.push(n)}return e}resetInitialized(){i.retryCount=f;i.expirationThresholds=[3,7,14];i.initialized=!1;i.InstrumentStringNumber={};this.anaheimStrategy=0;this.anaheimDataEntry={lastUpdated:0,anaheimAccount:null}}saveAnaheimDataToStorage(n){if(this._writing){this._pendingWrites.push(()=>this.saveAnaheimDataToStorage(n));return}this._writing=!0;let r;this.selectedWSBAccount&&(r={id:"",dateCreatedInS:0,lastUpdatedInS:0,dataType:"",accountId:this.selectedWSBAccount.accountId,accountType:-2,accountState:this.selectedWSBAccount.accountState,accountUserName:this.selectedWSBAccount.accountUserName,accountProviderId:this.selectedWSBAccount.accountProviderId,accountProviderAuthority:this.selectedWSBAccount.accountProviderAuthority,accountProviderDisplayName:this.selectedWSBAccount.accountProviderDisplayName,anaIdentity:"",anaAccType:-2,anaNameDsp:"",anaStatus:"",anaContType:"",anaProviderItemID:"",isDefaultAccount:this.selectedWSBAccount.isDefaultAccount?1:0,aCnt:0,mCnt:0,oCnt:0,score:0});let i=this.transformDeviceItemToAnaheimDataItem(n,r);if(i.length>0){let n=i[0];n.id.indexOf("History")>-1?this.anaheimDataEntry.anaHistoryItems=i:n.id.indexOf("QuickLinks")>-1?this.anaheimDataEntry.anaTopSitesItems=i:n.id.indexOf("RecentlyClosed")>-1?this.anaheimDataEntry.anaRecentlyClosedItems=i:n.id.indexOf("Favorites")>-1&&(this.anaheimDataEntry.anaFavoritesItems=i)}this.anaheimDataEntry.lastUpdated=t.ClientSideStorage.StorageBasedDataProvider.getUnixTime();this.anaheimDataEntry.anaheimAccount=r;this.searchIndexerTime<=1?this.onAfterWrite():this.withStorage(n=>n.put("anaheimData",this.anaheimDataEntry,()=>this.onAfterWrite(),n=>{this.onError(n,"saveAnaheimDataToStorage");this.onAfterWrite()}))||this.onAfterWrite()}searchIndexerWithMultipleResults(t,e,o){i.getRetryCount()==f&&(t.anaheimStrategy=this.anaheimStrategy);let s=n.IndexerQueryGenerator.generateIndexerQuery(t,null,"",h,r,o);if(s.indexOf("WHERE")>-1){let o=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(s);n.Async.safeChain("queryAnaheimData",o,f=>{if(i.isInitialized()){this.searchIndexerTime++;i.InstrumentStringNumber.IFC=++i._indexerFetchCount;let n=f.resultSet;this.saveAnaheimDataToStorage(n)}else{i._lifetimeFetchCount=0;i._cachedFetchCount=0;i._indexerFetchCount=0;i._getResultsCount=0;i._getResultsExceptionCount=0;let e=f.resultSet,t=this.getSelectedWindowsAccount();if(t&&(this.selectedWSBAccount=t),this.selectAnaheimChannelAndProfile(e,this.selectedWSBAccount),!i.getSelectedProfile())return;for(let t=1;t<u;t++)n.IndexerQueryGenerator.updateAnaheimStrategy(r,t);i.initialized=!0;this.searchIndexerTime=0}i._getResultsCount++;this.anaheimStrategy++;this.anaheimStrategy<u&&this.searchIndexerWithMultipleResults(t,e)},o=>{n.isCancellation(o)||this.logProviderFailure(r),i._getResultsExceptionCount++,o.number===-2147215865&&i.getRetryCount()>0?i.decreaseRetryCount():(this.anaheimStrategy++,i.retryCount=f),i.isInitialized()&&this.anaheimStrategy<u&&this.searchIndexerWithMultipleResults(t,e)},e,r)}}getSelectedWindowsAccount(){let n=this.accessTokenManager.getSelectedAccountInfo();return n||(n=this.accessTokenManager.getSelectedAccountInfo()),n}selectAnaheimChannelAndProfile(t,r){var f,h,c,l;if(n.config.anaheimAccountCheckLevel!=-1){let u=[],a=[{displayName:"canary"},{displayName:"dev"},{displayName:"beta"},{displayName:"stable"},];for(let n of t)if(n){let t=n.id;if(t.indexOf("Profiles")>-1){let t={displayName:n.displayName,emailAddress:n.getProperty("System.Identity"),timestamp:n.getProperty("System.DateCreated"),status:n.getProperty("System.Status"),accountType:n.getProperty("System.ContentType"),id:n.getProperty("System.ProviderItemID")};u.push(t)}}if(i.availableChannels=a,u.sort(this.sortProfilesHelper),n.config.anaheimAccountCheckLevel==3){let v=this.selectedWSBAccount?o(this.selectedWSBAccount.accountProviderAuthority):-1,y=(h=(f=this.selectedWSBAccount)===null||f===void 0?void 0:f.accountUserName)!==null&&h!==void 0?h:"",n,t,r,e=0,l=0,a=0;for(let i of u){let u=s(i.accountType),o=(c=i.emailAddress)!==null&&c!==void 0?c:"";u==2?e++:u==1?l++:a++;let f=this.getUserNameWithTypeScore(v,y,u,o);f==3?n=i:f==2?t=i:f==1&&(r=i)}i.aadCnt=e;i.msaCnt=l;i.otherCnt=a;n?(i.selectedANAAccountProfile=n,i.score=3):t?(i.selectedANAAccountProfile=t,i.score=2):r&&(i.selectedANAAccountProfile=r,i.score=1)}else if(i.selectedANAAccountProfile=null,i.otherCnt=(l=u===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0,r){for(let n in u)if(u[n].emailAddress===r.accountUserName){i.selectedANAAccountProfile=u[n];i.score=3;break}}else i.selectedANAAccountProfile=u[0],i.score=0;e()||i.selectedANAAccountProfile||(i.setShouldShowAnaheimDataSH(!1),i.setShouldShowAnaheimDataQF(!1));i.InstrumentStringNumber.ACC=a.length;i.InstrumentStringNumber.APC=u.length}}getUserNameWithTypeScore(n,t,i,r){var u,f;t=(u=t===null||t===void 0?void 0:t.toLocaleLowerCase())!==null&&u!==void 0?u:"";r=(f=r===null||r===void 0?void 0:r.toLocaleLowerCase())!==null&&f!==void 0?f:"";switch(n){case 1:return r?t==r?3:-1:2;case-1:case 0:case 9:return r?1:2;default:return-1}}sortProfilesHelper(n,t){return n.timestamp>t.timestamp?-1:n.timestamp<t.timestamp?1:0}logProviderFailure(t){let i=n.providerFailureLogName(t);i&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(()=>SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(i,"ErrorForTopHit"),"logProviderFailure")}dismissSingleAnaheimSuggestion(n,t){if(!n||!n.type||!n.id){t();return}if(this._writing){this._pendingWrites.push(()=>this.dismissSingleAnaheimSuggestion(n,t));return}this._writing=!0;this.queryStorage("anaheimData",i=>this.setDismissedAndSaveAnaheimData(n,i,t),()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite())}setDismissed(n,t){let i=t===null||t===void 0?void 0:t.find(t=>t.id===n.id);return i&&i.dedupeKey&&(t===null||t===void 0?void 0:t.map(n=>{n.dedupeKey===i.dedupeKey&&(n.dismissed=!0)})),t}setDismissedAndSaveAnaheimData(n,i,r){if(!i){r();return}switch(n.type){case"ANAH":i.anaHistoryItems=this.setDismissed(n,i===null||i===void 0?void 0:i.anaHistoryItems);break;case"ANAT":i.anaTopSitesItems=this.setDismissed(n,i===null||i===void 0?void 0:i.anaTopSitesItems);break;case"ANAR":i.anaRecentlyClosedItems=this.setDismissed(n,i===null||i===void 0?void 0:i.anaRecentlyClosedItems);break;case"ANAF":i.anaFavoritesItems=this.setDismissed(n,i===null||i===void 0?void 0:i.anaFavoritesItems)}i.lastUpdated=t.ClientSideStorage.StorageBasedDataProvider.getUnixTime();this.withStorage(n=>n.put("anaheimData",i,()=>{r&&r(),this.onAfterWrite()},n=>{this.onError(n,"setDismissedAndSaveAnaheimData");this.onAfterWrite()}))||this.onAfterWrite()}}i.availableChannels=[];i.cachedAnaheimDismissedDataItemIds=[];i.expirationThresholds=[];i.InstrumentStringNumber={};i._lifetimeFetchCount=0;i._cachedFetchCount=0;i._indexerFetchCount=0;i._getResultsCount=0;i._getResultsExceptionCount=0;i.aadCnt=-1;i.msaCnt=-1;i.otherCnt=-1;i.score=-1;t.AnaheimDataProvider=i;n.isForTest=n.Old.isForTest;n.getAccountTypeFromAuthority=n.Old.getAccountTypeFromAuthority;n.getAccountTypeFromContentType=n.Old.getAccountTypeFromContentType;n.AnaheimDataProvider=n.Old.AnaheimDataProvider})(t=n.Old||(n.Old={}))}(WSB||(WSB={})),function(n){class t{static getANANumberMap(){return t._instrumentStringNumber}static getANAHistoryCount(){return t.HistoryCount}static getANATopSitesCount(){return t.TopSitesCount}static getANARecentlyClosedCount(){return t.RecentlyClosedCount}static getANAFavoriteCount(){return t.FavoriteCount}getName(){return"AnaheimDataParser"}constructor(){}parse(i,r,u,f,e,o){t._instrumentStringNumber.TUC=f&&f.anaheimDataItems?f.anaheimDataItems.length:0;let s=[];(n.AnaheimDataProvider.getShouldShowAnaheimDataSH()||n.AnaheimDataProvider.getShouldShowAnaheimDataQF()||n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable())&&n.safeExecute(()=>{this.parseAnaheimDataSuggestions(f,i,r,e,s)},"parseAnaheimDataSuggestions "+u);(!i.isSearchHomeZI||n.canShowAnaheimDataSH())&&(i.isSearchHomeZI||n.canShowAnaheimDataQF())&&!n.config.reverseAnaheimData||(s=[],t.HistorySuggestionCount=0,t.RecentlyClosedSuggestionCount=0,t.FavoriteSuggestionCount=0,t.TopSitesSuggestionCount=0);!n.config.enableQuickSearch&&n.canShowQuickSearchWithoutANA(i)&&n.QuickSearchSuggestionsParser.parseQuickSearchSuggestions(i,r,"QSCH",f,s);n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable()||(t._instrumentStringNumber.RCC=n.AnaheimDataProvider.getResultsCount(),t._instrumentStringNumber.ECC=n.AnaheimDataProvider.getResultsExceptionCount());o(u,s,null)}isValidQuery(n){return n&&!n.isSearchHomeZI&&!n.queryToFetch?!1:!0}isUrlMatched(t,i){if(!this.isValidQuery(t)||!i)return!1;if(n.config.enableAnaheimDataQFPassive){let r=n.computeDomainlMatchLength(i,t.queryToFetch.toLowerCase());return r>0?!0:!1}return!1}isTitleMatched(n,t){if(!this.isValidQuery(n)||!t)return!1;let i=t.toLocaleLowerCase(),e=i.split(" "),u=n.queryToFetch.toLocaleLowerCase(),r=!1,f=0;for(let n of e){if(n.startsWith(u)){r=!0;break}let t=i.substring(f,i.length);if(f+=n.length+1,t.startsWith(u)){r=!0;break}}return r?!0:!1}parseAnaheimDataSuggestions(i,r,u,f,e){var o;let s={};if(i&&i.anaheimDataItems)for(let t of i.anaheimDataItems)n.safeExecute(()=>this.parseAnaheimDataSuggestion(i,t,r,u,f,s),"parseAnaheimDataSuggestion");t.HistoryCount=0;t.TopSitesCount=0;t.RecentlyClosedCount=0;t.FavoriteCount=0;t.HistorySuggestionCount=0;t.TopSitesSuggestionCount=0;t.RecentlyClosedSuggestionCount=0;t.FavoriteSuggestionCount=0;for(let i in s){let u=s[i];if(n.config.enableAnaheimDataHS&&u.type=="ANAH")if(t.HistoryCount+=1,r.isSearchHomeZI){let i=(o=n.config.anaheimHSReturnMaxCount)!==null&&o!==void 0?o:4;t.HistoryCount<=i&&(e.push(u),t.HistorySuggestionCount++)}else e.push(u),t.HistorySuggestionCount++;n.config.enableAnaheimDataRC&&u.type=="ANAR"&&(t.RecentlyClosedCount++,r.isSearchHomeZI?t.RecentlyClosedCount<=6&&(e.push(u),t.RecentlyClosedSuggestionCount++):(e.push(u),t.RecentlyClosedSuggestionCount++));n.config.enableAnaheimDataFV&&u.type=="ANAF"&&(t.FavoriteCount++,r.isSearchHomeZI?t.FavoriteCount<=6&&(e.push(u),t.FavoriteSuggestionCount++):(e.push(u),t.FavoriteSuggestionCount++));n.config.enableAnaheimDataTSTile&&u.type=="ANAT"&&(t.TopSitesCount+=1,t.TopSitesCount<=6&&(e.push(u),t.TopSitesSuggestionCount++))}if(t._instrumentStringNumber.TSC=e.length,t._instrumentStringNumber.BHSC=t.HistoryCount,t._instrumentStringNumber.TSSC=t.TopSitesCount,t._instrumentStringNumber.RCSC=t.RecentlyClosedCount,t._instrumentStringNumber.FVSC=t.FavoriteCount,e.sort((n,t)=>{var i,r,u,f;return((r=(i=t.anaheimRankingSignals)===null||i===void 0?void 0:i.dateCreated)===null||r===void 0?void 0:r.getTime())-((f=(u=n.anaheimRankingSignals)===null||u===void 0?void 0:u.dateCreated)===null||f===void 0?void 0:f.getTime())}),n.config.topHitMuse){let i=0,t=0,r=3;e.filter(n=>n.type=="ANAH").filter(()=>i++<r).forEach(i=>{i.type="ANATH",i.rankingScore=1.1-t/10,i.text=n.formatString("[{0}] [{1}]",[t.toString(),i.text]),t++})}}parseAnaheimDataSuggestion(t,i,r,u,f,e){var o,s,h;if(i&&f()){let l,p;if(i.id.indexOf("Favorites")>-1)l="ANAF",p="EdgeFavorites";else if(i.id.indexOf("History")>-1)l="ANAH",p="EdgeBrowsingHistory";else if(i.id.indexOf("QuickLinks")>-1)l="ANAT",p="EdgeTopSites";else if(i.id.indexOf("RecentlyClosed")>-1)l="ANAR",p="EdgeRecentClosed";else return;if(!(n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable())){let t=new Date(i.dateCreated),r=n.AnaheimDataProvider.getExpirationThreshold();if(l=="ANAH"&&(!t||n.getTimeDiffInDays(t)>r))return}let c=i.url,a=i.title;if(!r.isSearchHomeZI&&!this.isTitleMatched(r,a)&&!this.isUrlMatched(r,c))return;let d=r.isSearchHomeZI?a:HitHighlightingParser.addMarkers(a,r.queryToFetch);n.config.topHitMuse&&(r.fullPartialQuery=a);let w,b;if(n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable()&&n.config.enableAnaheimDataProfile)n.AnaheimDataProviderV2.ANAAccountType==1?w=n.AnaheimDataProviderV2.ANAProviderItemID:n.AnaheimDataProviderV2.ANAAccountType==2&&(b=n.AnaheimDataProviderV2.ANAProviderItemID);else if(n.AnaheimDataProvider&&n.config.enableAnaheimDataProfile){let t=n.AnaheimDataProvider.getSelectedProfile();t&&t.accountType=="MSA"?w=t.id:t&&t.accountType=="AAD"&&(b=t.id)}let f=n.createSuggestion(r,d,n.getFaviconUrlForRawUrl(c,64,64,1.5),null,l,r.fullPartialQuery,n.InstrumentedItem.createInstrumentedItemHandOffOverride(u,l,1),1,u,!0,i.id,()=>n.Host.launchUrlWithEdgeProtocolAsync(c,{campaign:n.config.anaheimDataLaunchOCID,medium:p,cid:w,oid:b}),null,l+a+i.id),k=c===null||c===void 0?void 0:c.replace(/(^\w+:|^)\/\//,""),v=c?new URL(c):undefined;n.safeExecute(()=>{f.primaryMetadata=(v===null||v===void 0?void 0:v.hostname)?HitHighlightingParser.addMarkers(decodeURIComponent(k),v.hostname):decodeURIComponent(k)},"decodeURIComponenturl:"+c+"urlWithoutProtocol:"+k);f.tooltip=a;l=="ANAT"&&(f.tooltip+="\n"+c);f.url=c;f.narratorText=n.getNarratorText(f);f.template=1;f.anaheimRankingSignals={dateCreated:new Date(i.dateCreated),dateModified:new Date(i.dateModified),dateVisited:new Date(i.dateVisited),visitCount:Number(i.visitCount),urlTypedCount:Number(i.urlTypedCount)};this.setupRemoveFromHistoryContextMenu(f,t);let y=((o=v===null||v===void 0?void 0:v.hostname)===null||o===void 0?void 0:o.replace("www.",""))+a;if(e[y]&&f.type=="ANAH"){let n=f.id,r=e[y].id,t=(s=f.anaheimRankingSignals.dateCreated)===null||s===void 0?void 0:s.valueOf(),i=(h=e[y].anaheimRankingSignals.dateCreated)===null||h===void 0?void 0:h.valueOf();r.indexOf("stable")>-1?n.indexOf("stable")>-1&&t>i&&(e[y]=f):(n.indexOf("stable")>-1||t>i)&&(e[y]=f)}else e[y]=f}}setupRemoveFromHistoryContextMenu(t,i){i.remove&&n.setExtraVerbs(t,r=>{if(r||!i.remove)return[];let u={verb:"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:()=>{i.remove(t,()=>{n.Host.refreshCurrentPane()}),delete i.remove},icon:{content:"&#xE711",type:2}};return[u]},!0)}}t._instrumentStringNumber={};t.HistoryCount=0;t.TopSitesCount=0;t.RecentlyClosedCount=0;t.FavoriteCount=0;t.HistorySuggestionCount=0;t.TopSitesSuggestionCount=0;t.RecentlyClosedSuggestionCount=0;t.FavoriteSuggestionCount=0;n.AnaheimDataParser=t}(WSB||(WSB={})),function(n){function i(t){n.LightweightStorage.setItem(u,JSON.stringify(t))}function t(){const t=n.LightweightStorage.getItem(u);return t?JSON.parse(t):null}function f(){var n;const i=t();let r;if(i){const{trendingSearchSuggestions:t}=i;t&&t.length>0&&(r=(n=t[0])===null||n===void 0?void 0:n.Query)}return r}const r="TS",e=n.config.trendingSearchUpdateMillis,o=500,s="/dsb/scenario?name=EditorialTrendingSearch",h="/dsb/scenario?name=TrendingSearchWithCache",u="WSBTrendingSearchCache";n.setTSContentToCache=i;n.loadTSContentFromWSBCache=t;n.loadFirstTSQueryFromWSBCache=f;class c{getName(){return"TrendingSearchDataProvider"}constructor(){n.config.trendingSearchInWin11LeftPane?n.Host.bindDismissed(()=>{n.isTSWin11LeftPaneEnabled=(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())!=1}):n.Host.bindShown(()=>{n.isTSFallbackToANA=!1})}fetch(n,t){n.enabledDataSources[r]&&t(r,this.generateTSDataResponse(),null)}generateTSDataResponse(){let r=[];if(n.MockUrlParameters&&typeof n.MockedTSData=="object"&&!n.config.trendingSearchInWin11LeftPane){let t=n.MockedTSData.suggestions;return n.isTSInSearchBoxEnabled()&&t.length>12&&(t.push(t.shift()),t.splice(12)),{suggestions:t}}if(n.config.trendingSearchInWin11LeftPane){const t=this.loadTSContentFromDSBCache();if(t)r=[...t.trendingSearchSuggestions],r.splice(4);else n.isTSWin11LeftPaneEnabled=!1;return{suggestions:r}}const u=t();if(n.isTSFallbackToANA=!1,u){const{cacheTime:f,trendingSearchSuggestions:o}=u;r=[...o];(f===0||f+e<n.getCurrentTime())&&this.fetchTSUrlWithTimeout().then(u=>{var f,e;if(u){if(n.isTSInSearchBoxEnabled()){let{cacheTime:u,trendingSearchSuggestions:n}=t();if((n===null||n===void 0?void 0:n.length)>0&&((f=r[0])===null||f===void 0?void 0:f.Query)!==((e=n[0])===null||e===void 0?void 0:e.Query)){let t=n.findIndex(n=>{var t;return(n===null||n===void 0?void 0:n.Query)===((t=r[0])===null||t===void 0?void 0:t.Query)});t!=-1&&n.splice(t,1);r=[r[0],...n];i({cacheTime:u,trendingSearchSuggestions:r})}}n.Host.refreshCurrentPane()}})}else{const t=this.loadTSContentFromDSBCache();t?r=[...t.trendingSearchSuggestions]:(n.isTSFallbackToANA=!0,n.Host.refreshCurrentPane());this.fetchTSUrl()}return{suggestions:r}}async fetchTSUrlWithTimeout(){let i=!1,t=n.safeSetTimeout(()=>{i=!0},o,"fetchTSContentTimer");const r=async()=>{const r=await this.fetchTSUrl();return r?i?(n.LogWSBWarning("fetchTrendingSearchContentDone","Fetch trending search content succeed but timeout, will render on next shown",null,"BingTelemetry"),!1):(t&&(sb_ct(t),t=null),!0):!1};return await r()}async fetchTSUrl(){const e=n.isBrowserOnline(),u=n.Host.getLanguage().toLowerCase(),r=n.Host.getRegion().toLowerCase(),f=n.revIpRegionCache.toLowerCase();let o;o=f=="cn"||r=="cn"||r=="hk"&&u.startsWith("zh")?s:h;let t=`${location.origin}${o}`;t=ThresholdUtilities.setUrlParameter(t,"cc",r);t=ThresholdUtilities.setUrlParameter(t,"setlang",u);try{let s=await fetch(t),o=await s.json(),h={ImpressionGuid:o.impressionGuid};if(s.status==200){if(this.isValidTSContent(o)){const t=o.scenarios[0].items;return n.isTSInSearchBoxEnabled()&&t.length>12&&t.splice(12),i({cacheTime:n.getCurrentTime(),trendingSearchSuggestions:t}),n.isTSFallbackToANA=!1,n.InstrumentationHelper.instrumentDSBEvent(h),!0}n.InstrumentationHelper.instrumentDSBEvent(h);throw new Error(`Invalid trending search content. Online status ${e}. Response data ${o?JSON.stringify(o):"undefined"}.`);}else if(s.status==203){const t=f=="cn"?`and revip ${f}`:null;n.InstrumentationHelper.instrumentDSBEvent(h);n.LogWSBWarning("fetchTrendingSearchUrl",`Trending Search is not supporting this region ${r} and language ${u} ${t}`,null,"BingTelemetry")}else throw new Error(`http status:${s.status}. Online status ${e}`);}catch(c){}finally{n.isTSInSearchBoxEnabled()&&(n.placeholdertextNeedUpdate=!0)}return n.isTSFallbackToANA=!0,n.Host.refreshCurrentPane(),!1}isValidTSContent(n){var t;return(n===null||n===void 0?void 0:n.scenarios)&&(n===null||n===void 0?void 0:n.scenarios.length)>0&&((t=n.scenarios[0])===null||t===void 0?void 0:t.items)&&n.scenarios[0].items.length>0}loadTSContentFromDSBCache(){var t,i,r,u,f;const e=n.LightweightStorage.getItem(n.config.dsbCacheKey);if(e){const o=JSON.parse(e),n=(r=(i=(t=o.response)===null||t===void 0?void 0:t.ContentCollection[0])===null||i===void 0?void 0:i.Data)===null||r===void 0?void 0:r.filter(n=>{var t;return((t=n===null||n===void 0?void 0:n.Cards[0])===null||t===void 0?void 0:t.Scenario)=="TrendingSearch"});if(n&&(n===null||n===void 0?void 0:n.length)==1){const t=(f=(u=n[0].Cards[0].FieldsStore)===null||u===void 0?void 0:u.Items)===null||f===void 0?void 0:f.map(n=>{var t,i,r,u;return{Query:n.Title,Thumbnail:{ThumbnailUrl:(t=n.Thumbnail)===null||t===void 0?void 0:t.ThumbnailUrl,ThumbnailId:(i=n.Thumbnail)===null||i===void 0?void 0:i.ThumbnailId,ThumbnailHeight:(r=n.Thumbnail)===null||r===void 0?void 0:r.ThumbnailHeight,ThumbnailWidth:(u=n.Thumbnail)===null||u===void 0?void 0:u.ThumbnailWidth}}});return{cacheTime:o.cacheTime,trendingSearchSuggestions:t?t:null}}}return null}}n.TrendingSearchDataProvider=c;class l{constructor(n){this._navigationHelper=n}parse(t,i,r,u,f,e){let o=[];for(let e of u.suggestions)n.safeExecute(()=>this.parseTrendingSearchDataSuggestion(t,e,r,i,f,o),"parseTrendingSearchDataSuggestion "+r);e(r,o,null)}parseTrendingSearchDataSuggestion(t,i,r,u,e,o){var s;const h="TS",l=n.InstrumentedItem.createInstrumentedItem(u,h),c=i.Query;if(e()){let r=n.createSuggestion(t,c,null,null,h,c,l,0,u,!1);if(n.isThumbnailForTSEnabled()){const t=(s=i.Thumbnail)===null||s===void 0?void 0:s.ThumbnailId;if(t){let i=24,u=24;n.isTSInSearchBoxEnabled()&&o.length<2&&(i=310,u=140);const f=n.config.imageHostName+`${t}${i?`&w=${i}`:""}${u?`&h=${u}`:""}&c=1&rs=1&p=0`;r.icon={type:0,content:f}}}n.config.trendingSearchInWin11LeftPane&&(r.icon={type:0,className:"LBSHSpyglass"});r.reactKey=`${h} ${c}`;r.click=()=>{n.Host.launchSearchAsync(r.query,this._navigationHelper.getSearchUrl(t.fullPartialQuery,r.query,r.type,null,r.handoffType,n.mapOSFormCode("SSHTRD")),!!r.useRaf,n.mapOSFormCode("SSHTRD")),n.isTSInSearchBoxEnabled()&&r.query===f()&&(n.updateTrendingsearchCacheSort(),n.placeholdertextNeedUpdate=!0)};o.push(r)}}}n.TrendingSearchDataParser=l}(WSB||(WSB={})),function(n){class t extends n.JsonDataProvider{getName(){return"ThirdPartyDataProvider"}constructor(n){super("TPWeb");this.webSearchExtension=n}getBaseUrl(){return this.webSearchExtension.endpoint}fetch(t,i,r,u,f,e){if(n.isDataSourceEnabled(this._dataSource,t)&&t.scope==n.Scope.ThirdPartyWeb){const s=n.getCurrentDateDSB();let h=s.toLocaleString("en-US");e.dateTime=encodeURIComponent(h);e.qry=t?t.queryToFetch.toLowerCase():"";e.cvid=n.Host.getConversationId();n.isServicingSearchBingAs3PEnabled()&&(e.wsbsuggestions="1");let o=this.addParamsToUrl(decodeURIComponent(this.getBaseUrl()),e);n.fetchUrl(o,undefined,undefined,({responseText:r,contentType:t,status:u})=>{let f;u==200&&r&&t.includes("json")&&(f=n.safeExecute(()=>JSON.parse(r),"parseThirdPartyProviderResponse",null,o));i(this._dataSource,f,u==200?undefined:u.toString())},undefined,f)}}}n.ThirdPartyDataProvider=t;class i{constructor(){}parse(t,i,r,u,f,e){n.isThirdPartySearchAllowed()&&r=="TPWeb"&&this.parseThirdPartySuggestions(t,i,u,e)}parseThirdPartySuggestions(t,i,r,u){if(!r){n.isDataSourceEnabled("TPWeb",t)&&u("TPWeb",[],null);return}let f=[],e=n.isDataSourceEnabled("TPWeb",t);e&&(n.safeExecute(()=>{for(let u of r.Suggestions){let r=n.safeExecute(()=>this.parseThirdPartySuggestion(t,u,i),"parseThirdPartySuggestion");r&&f.push(r)}},"parseThirdPartySuggestions"),u("TPWeb",f,{}))}parseThirdPartySuggestion(t,i,r){var o;let e=i.Attributes,s="TP",f=e.url;if(!f)return null;let u=n.createSuggestion(t,e.query,null,{type:2},s,e.query,n.InstrumentedItem.createInstrumentedItem(r,s),1,r,!1);return(u.autoOpenPreviewPaneWhenOnTopHit=!0,u.reactKey=s+t.queryToFetch+f,u.staticGroupType=n.GroupType.SearchSuggestions,u.scope=n.Scope.ThirdPartyWeb,u.previewPaneType=1,u.previewPaneUrl=e.previewPaneUrl,n.isServicingSearchBingAs3PEnabled()&&((o=t.thirdPartySearch)===null||o===void 0?void 0:o.protocol)=="microsoft-edge"&&e.stype&&!this.isUrlAbsolute(f)&&(f=n.config.wsbDefaultBundle?`${n.config.webHost}${f}`:`${location.origin}${f}`),this.setUrlSuggestionProperties(u,t,f),!n.isValidSuggestion(u,"parseThirdPartySuggestion"))?null:u}setUrlSuggestionProperties(t,i,r){let u=i.thirdPartySearch;n.isSupportWebResultsInAllScopeInDMAEnabled()&&u&&u.getLogoAsDataUriAsync?t.getIcon=n.getDmaSuggestionIcon(u):t.icon=n.getSearchSuggestionIcon();t.url=r;t.click=()=>{var t;return n.Host.launchThirdPartyUriWithProtocolAsync(r,(t=i.thirdPartySearch)===null||t===void 0?void 0:t.protocol)};t.narratorText=n.getNarratorText(t,n.Host.getLocString("DirectNavSuggestion"))}isUrlAbsolute(n){return n.indexOf("://")>0||n.indexOf("//")===0}}n.ThirdPartySuggestionsParser=i}(WSB||(WSB={})),function(n){const t=500;class i extends n.JsonDataProvider{constructor(n="TPWeb"){super("TPWeb");this.dataSourceType=n}getName(){return"DmaWebDataProvider"}fetch(n,t,i,r,u){n.enabledDataSources[this.dataSourceType]&&u()&&this.fetchDmaWebProviderResponse(n).then(n=>{t(this.dataSourceType,n,undefined)}).catch(n=>{SharedLogHelper.LogError("DmaWebDataProvider.fetch",`Fetching DMA web provider response failed: ${n}`)})}async fetchDmaWebProviderResponse(t){var i;let r=[],u=n.Host.getThirdPartySearchApps();try{if(t.scope===n.Scope.ThirdPartyWeb){if(!((i=t.thirdPartySearch)===null||i===void 0?void 0:i.applicationUserModelId))return{dmaAppSuggestions:[]};let n=u.find(n=>{var i;return n.applicationUserModelId===((i=t.thirdPartySearch)===null||i===void 0?void 0:i.applicationUserModelId)});if(n){const i=this.composeDmaWebEndpointUrl(n.endpoint,t),r=await this.fetchDMAWebEndpointWithTimeout(i);return{dmaAppSuggestions:[{suggestions:r||[],app:n},]}}}else{const n=u.map(async n=>{const i=this.composeDmaWebEndpointUrl(n.endpoint,t);try{const t=await this.fetchDMAWebEndpointWithTimeout(i);return{status:"fulfilled",suggestions:t,app:n}}catch(r){return SharedLogHelper.LogError("fetchDmaWebProviderResponse",`Fetching failed for ${i}: ${r}`),{status:"rejected",suggestions:[],app:n}}}),i=await Promise.all(n);i.forEach(n=>{n.status==="fulfilled"&&Array.isArray(n.suggestions)&&r.push({suggestions:n.suggestions.length>0?n.suggestions:[],app:n.app})})}}catch(f){SharedLogHelper.LogError("fetchDmaWebProviderResponse",`Fetching DMA web provider response failed: ${f}`)}return{dmaAppSuggestions:r}}async fetchDMAWebEndpoint(n){var t;try{const i=await fetch(n);if(i.ok){const n=await i.json();return(t=n.Suggestions)!==null&&t!==void 0?t:[]}throw new Error(`HTTP status: ${i.status}`);}catch(i){return SharedLogHelper.LogError("fetchSuggestions",`Fetching suggestions from '${n}' failed: ${i}`),null}}async fetchDMAWebEndpointWithTimeout(i){return new Promise(r=>{let u=n.safeSetTimeout(()=>{SharedLogHelper.LogError("fetchDMAWebEndpoint",`fetch dma web suggestions timeout for url: ${i}`),r(null)},t,"fetchDMAWebEndpointTimer");this.fetchDMAWebEndpoint(i).then(n=>{sb_ct(u),r(n)}).catch(n=>{sb_ct(u),SharedLogHelper.LogError("fetchDMAWebEndpointWithTimeout",`Fetching failed for ${i}: ${n}`),r(null)})})}composeDmaWebEndpointUrl(t,i){let r=n.Host.initUrlParameters();const u=n.getCurrentDateDSB();let f=u.toLocaleString("en-US");return r.dateTime=encodeURIComponent(f),r.qry=i?i.queryToFetch.toLowerCase():"",r.cvid=n.Host.getConversationId(),n.isSupportWebResultsInAllScopeInDMAEnabled()&&(r.wsbsuggestions="1"),this.addParamsToUrl(decodeURIComponent(t),r)}}n.DmaWebDataProvider=i;class r{constructor(n){this.dataSourceType=n!==null&&n!==void 0?n:"TPWeb"}parse(t,i,r,u,f,e){var o;let s=[];(o=u===null||u===void 0?void 0:u.dmaAppSuggestions)===null||o===void 0?void 0:o.forEach(({suggestions:e,app:u})=>{e.forEach(e=>{n.safeExecute(()=>this.parseDmaWebSuggestion(t,e,r,i,f,s,u),"parseDmaWebSuggestion "+r)})});e(r,s,undefined)}parseDmaWebSuggestion(t,i,r,u,f,e,o){var c;let s=i.Attributes,l="TP",a=1,h=s.url;if(h&&f()){const r=`${o.displayName}-${s.query}`;let i=n.createSuggestion(t,s===null||s===void 0?void 0:s.query,null,{type:2},l,s.query,n.InstrumentedItem.createInstrumentedItem(u,l),a,u,!1,r);if(i.autoOpenPreviewPaneWhenOnTopHit=!0,i.reactKey=r,i.staticGroupType=n.GroupType.DMAWeb,i.scope=t.scope,i.previewPaneType=1,i.previewPaneUrl=s.previewPaneUrl,i.sourceApp=o,i.primaryMetadata=n.Host.getLocString("DMAWebSearchResults",o.displayName),n.isSupportWebResultsInAllScopeInDMAEnabled()&&((c=t.thirdPartySearch)===null||c===void 0?void 0:c.protocol)=="microsoft-edge"&&s.stype&&!this.isUrlAbsolute(h)&&(h=n.config.wsbDefaultBundle?`${n.config.webHost}${h}`:`${location.origin}${h}`),this.setUrlSuggestionProperties(i,t,h),!n.isValidSuggestion(i,"parseThirdPartySuggestion"))return;e.push(i)}}setUrlSuggestionProperties(t,i,r){let u=t.sourceApp;n.isSupportWebResultsInAllScopeInDMAEnabled()&&u&&u.getLogoAsDataUriAsync?t.getIcon=n.getDmaSuggestionIcon(u):t.icon=n.getSearchSuggestionIcon();t.url=r;t.click=()=>{var i;return n.Host.launchThirdPartyUriWithProtocolAsync(r,(i=t.sourceApp)===null||i===void 0?void 0:i.protocol)};t.narratorText=n.getNarratorText(t,n.Host.getLocString("DirectNavSuggestion"));t.getMruData=()=>n.getMruUrlSuggestionData(t,r)}isUrlAbsolute(n){return n.indexOf("://")>0||n.indexOf("//")===0}}n.DmaWebSuggestionsParser=r}(WSB||(WSB={})),function(n){const t="SWMF";class i{constructor(){this.getName=()=>"SharedFilesDataProvider"}fetch(i,r,u,f,e){if(n.isDataSourceEnabled(t,i)){let o=()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.sharedFileSearchProvider.queryAsync(i.queryToFetch,n.Host.getRawImpressionGuid());n.Async.safeChain("fetchSharedFilesResult",o,n=>{if(e())if(n===null||n===void 0?void 0:n.resultSet){let i=n.resultSet;r(t,{sharedFileItems:i})}else r(t,{})},i=>{n.isCancellation(i)||n.LogWSBError("SharedFilesFetch","failed",undefined,undefined,undefined,"WindowsTelemetry"),r(t,{})},f)}}}n.SharedFilesDataProvider=i}(WSB||(WSB={})),function(n){class t{constructor(n){this.dataSourceType=n!==null&&n!==void 0?n:"SWMF"}parse(t,i,r,u,f,e){if(f()&&n.isDataSourceEnabled(r,t)){let o=[];if(!u||!u.sharedFileItems||u.sharedFileItems.length===0){e(r,o,null);return}let h=n.getEffectiveQuery(t),s=n.getEffectiveScope(t),c={};if(s===n.Scope.Documents||s===n.Scope.All)for(let r of u.sharedFileItems){let u=n.safeExecute(()=>this.buildDocumentSuggestion(r,i,h,t,c),"buildDocumentSuggestion");u&&n.isValidSuggestion(u,"parseSharedFilesSearchResponse")&&o.push(u)}n.decorateSuggestionsWithParentFolder(o);e(r,o,null)}}buildDocumentSuggestion(t,i,r,u,f){let o=t.displayName+"."+t.fileExtension,s=r?HitHighlightingParser.addMarkers(o,r):o,h=n.config.disableSyntaxHighlight?s.toLocaleLowerCase().includes(r.toLocaleLowerCase()):s.includes(HitHighlightingParser.startMarker),c=t.lastSharedByName,l=n.matchesOnPropertyHH(c,r),a=t.author,v=n.matchesOnPropertyHH(a,r),y=t.url,e=t.accountUserName.toLocaleLowerCase();if(f[e]===undefined&&(f[e]=n.getAccessTokenManager().getAllAvailableAccounts(1).some(n=>n.accountUserName.toLocaleLowerCase()===e)?1:n.getAccessTokenManager().getAllAvailableAccounts(0).some(n=>n.accountUserName.toLocaleLowerCase()===e)?0:-1),f[e]!==1)return null;let p=t.location.toLocaleLowerCase().includes("onedrive")?"OneDriveBusiness":"SharePoint";return n.buildSubstrateDocumentSuggestion(undefined,u,y,null,s,o,t.fileExtension,p,t.lastModifiedDateTime,t.lastModifiedBy,null,a,!h&&!l&&v,!1,undefined,i,r,n.isL2(u),"",undefined,"",t.activity,c,!h&&l,!0)}}n.SharedFileSuggestionsParser=t}(WSB||(WSB={})),function(n){var t;(function(t){const u="mruWithIndex",i="mruWithIndexStore",f=1,r="LastUpdated",e=100;class o{constructor(){this.pendingWritingPromises={};this.cacheInfo={name:u};this.deleteItemsFromOneDayAgo(e)}async setDSBQueryAsync(n,t){let u=this.isDSBOrSSHTSUrl(t),f=this.getQueryFromUrl(n),i=this.decodeQuery(f),e=this.isShowConv(n),o=this.isVideoOrImageVertical(n),r=await this.cachedQuery(i);if(u&&!e&&!o&&i!=""){r&&r.length>0&&await this.deleteItemAsync(r);let t=this.convertDSBQueryToMruDbEntry(i,n);await this.setItemAsync(i,t)}}isDSBOrSSHTSUrl(n){return n.medium==="DynamicSearchBox"||n.medium==="SSHTrendingSearch"}isVideoOrImageVertical(n){return(n=decodeURIComponent(n),n.indexOf("/videos/search")>=0||n.indexOf("/images/search")>=0)?!0:!1}isShowConv(n){n=decodeURIComponent(n);return n.indexOf("showconv=1")>=0?!0:!1}getQueryFromUrl(n){var t;try{if(n=decodeURIComponent(n),n=n.startsWith("microsoft-edge")?n.split("?",3)[2]:n.split("?",2)[1],t=n.split("&").filter(n=>n.startsWith("q=")),t.length>0)return t[0].split("=")[1]}catch(i){SharedLogHelper.LogError("getQueryFromUrl",n,i)}return""}decodeQuery(n){return n=decodeURIComponent(n),n.split("+").join(" ")}convertDSBQueryToMruDbEntry(i){let r={};r[n.GroupType.SearchSuggestions.toString()+"\t"+i]={prefixLaunchCount:1,lastLaunchTime:t.StorageBasedDataProvider.getUnixTime(),groupType:n.GroupType.SearchSuggestions};let u={type:"DSBMRU",handoffType:0,hc:!0,highConfidenceMetaSuggestionScore:0,suggestionKey:n.GroupType.SearchSuggestions.toString()+"\t"+i,prefetchConfidenceScore:0,query:i};return{SuggestionEngagementData:r,LastUpdated:t.StorageBasedDataProvider.getUnixTime(),Suggestions:[u]}}async setItemAsync(n,t){try{const i=await this.openDbAsync();await this.writeDbStoreAsync(i,n,t)}catch(i){SharedLogHelper.LogError("setItemAsync",n,i)}}async writeDbStoreAsync(n,t,r){this.assertKeyIsTruthy(t);await this.pendingWritingPromises[t];try{this.pendingWritingPromises[t]=new Promise((u,f)=>{const o=n.transaction(i,"readwrite"),s=o.objectStore(i),e=s.put(r,t);e.onerror=()=>f(Error);e.onsuccess=()=>u()});await this.pendingWritingPromises[t]}finally{delete this.pendingWritingPromises[t]}}async deleteItemsFromOneDayAgo(n){try{const r=await this.openDbAsync(),t=await this.getDbKvStoreKeysAsync(r),i=[];if(t.length>n)for(const n in t){const r=await this.getItemAsync(t[n]);this.getTimeDiffInDaysNumber(r.LastUpdated)>=1&&i.push(t[n])}const u=i.map(n=>this.deleteItemAsync(n));await Promise.all(u)}catch(t){console.error(t);SharedLogHelper.LogError("deleteItemsFromOneDayAgo","${maxItemCount}",t)}}async openDbAsync(){return this.openedDb?this.openedDb:this.pendingOpeningPromise?this.pendingOpeningPromise:(this.pendingOpeningPromise=new Promise((n,t)=>{const{name:r}=this.cacheInfo,i=indexedDB.open(r,f);i.onupgradeneeded=n=>{this.upgradeDb(i.result,n.newVersion,n.oldVersion)};i.onerror=()=>{delete this.pendingOpeningPromise,t(Error)};i.onsuccess=()=>{const t=i.result;this.openedDb=t;delete this.pendingOpeningPromise;n(this.openedDb)}}),this.pendingOpeningPromise)}stringifyError(n){try{return n instanceof Error?JSON.stringify(n,Object.getOwnPropertyNames(n)):JSON.stringify(n)}catch(t){return"<failed to stringify error>"}}upgradeDb(t,u,f){const e=n.config.disableMsbBundle?this.stringifyError:n.stringifyError;if(f===0&&u===1)try{const n=t.createObjectStore(i);n.createIndex(r,r,{unique:!1})}catch(o){}}async getDbKvStoreKeysAsync(n){return new Promise((t,r)=>{const f=n.transaction(i,"readwrite"),u=f.objectStore(i);if(typeof u.getAllKeys=="function"){const n=u.getAllKeys();n.onerror=()=>r(Error);n.onsuccess=()=>t(n.result)}else{const n=u.openCursor(),i=[];n.onerror=()=>r(Error);n.onsuccess=()=>{const r=n.result;r?(i.push(r.key),r.continue()):t(i)}}})}async getItemAsync(n){try{const t=await this.openDbAsync();return await this.readDbStoreAsync(t,n)}catch(t){return SharedLogHelper.LogError("getItemAsync",n,t),undefined}}async readDbStoreAsync(n,t){return this.assertKeyIsTruthy(t),await this.pendingWritingPromises[t],new Promise((r,u)=>{const e=n.transaction(i,"readonly"),o=e.objectStore(i),f=o.get(t);f.onerror=()=>u(Error);f.onsuccess=()=>r(f.result)})}assertKeyIsTruthy(n){if(!n)throw"Key is null";}getTimeDiffInDaysNumber(t){t=t*1e3;const i=n.getCurrentTime();return Math.abs(i-t)/864e5}async deleteItemAsync(n){try{const t=await this.openDbAsync();await this.deleteDbStoreAsync(t,n)}catch(t){SharedLogHelper.LogError("deleteItemAsync",n,t)}}async deleteDbStoreAsync(n,t){this.assertKeyIsTruthy(t);await this.pendingWritingPromises[t];try{this.pendingWritingPromises[t]=new Promise((r,u)=>{const e=n.transaction(i,"readwrite"),o=e.objectStore(i),f=o.delete(t);f.onerror=()=>u(Error);f.onsuccess=()=>r()});await this.pendingWritingPromises[t]}finally{delete this.pendingWritingPromises[t]}}async cachedQuery(n){const i=await this.openDbAsync(),t=await this.getDbKvStoreKeysAsync(i),r=Math.min(t.length,15);for(let i=0;i<r;i++){const r=await this.getItemAsync(t[i]);if(r)for(const u of r.Suggestions){const r=u;if(n.toLowerCase()===r.query.toLowerCase())return t[i]}}return""}}t.IndexedDbDSBEngagedDataStorage=o})(t=n.ClientSideStorage||(n.ClientSideStorage={}))}(WSB||(WSB={}));1

Anon7 - 2022
AnonSec Team