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){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){SharedLogHelper.LogError("fetchUrl",i,w);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: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);n.config.shGAWDx&&(t===null||t===void 0?void 0:t.fromSearchHome)&&(t===null||t===void 0?void 0:t.queryToFetch)==="Good news - MSN"&&(l="https://api.msn.com/news/feed?ocid=winsearch&market=en-us&query=good%20news&apikey=uvobH5fEn1uz1xwZ5yuwtWzu2y32WpRZ6EMpZx7o09");let 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){i(t,r,u,({responseText:r,contentType:i,status:u})=>{let e;u==200&&(n.TestHookUrlParameters&&r&&(r=r.replace(new RegExp("","gm"),"")),r&&i.includes("json")&&(e=n.safeExecute(()=>JSON.parse(r),"parseWebProviderResponse",null,t)));f(this._dataSource,e,u==200?null:u.toString())},this._delay>0?e:null,o,h,s,c)}}n.JsonDataProvider=r;class f extends r{getName(){return"AsSuggestionsDataProvider"}constructor(n){super("Web");this._responseCacheManager=n}getBaseUrl(){return n.config.u}onBeforeFetchUrl(t,i){n.InstrumentationHelper.instrumentSnRProviderFetchUrl(t,i)}fetch(t,i,r,u,f,e,o){if(n.isDataSourceEnabled(this._dataSource,t)){n.config.enableFetchStartLogging&&n.InstrumentationHelper.instrumentFetchProviderBegin(r,"ASDP:"+this._dataSource);let s=i;s=(r,u,f,e)=>{u&&n.isEmptyUrlPrefix(t)&&(u.Suggestions=[]),this.processResourceResponse(u),i(r,u,f,e)};this._responseCacheManager?this.fetchWithCache(t,s,r,u,f,e,o):super.fetch(t,s,r,u,f,e,o)}}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.every(n=>!n.InstantAnswer&&n.Attributes.stype!=i)}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(ut(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(n,t){t!="open storage"&&SharedLogHelper.LogError(t,this._dataSource,n);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(n){return this._dataSource=="ANA"?"anaheimData":n.queryToFetch?n.queryToFetch.toLocaleLowerCase():""}fetch(i,r,u,f,e){let s=n.getCurrentTime();if(n.config.enableFetchStartLogging&&n.InstrumentationHelper.instrumentFetchProviderBegin(u,"SBDP:"+this._dataSource),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{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){const t=3;class i{constructor(n,t){this._navigationHelper=n;this._temporaryMessageHandler=t}parse(i,r,u,f,e,o,s){let h=[],c=[],l=[],a=[],v=[],y=[],p=[],w=[];if(f&&f.Suggestions)for(let e of f.Suggestions){let f=e.suggestionData;if(f.handoffType==2){if(n.isApp(f.type)){let n=f;c.push(n.id);v.push(e)}else if(n.isSetting(f.type)){let n=f;l.push(n.id);y.push(e)}else if(n.isFileOrFolder(f.type)){let n=f;a.push(n.id);p.push(e)}}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),"parseMRUWebSuggestion");o&&(f.handoffType==0?w.push(o):h.push(o))}}u!="MWS"&&(n.lookupById(i,"MPP",c,v,n=>[n.suggestionData.id],"MST",l,y,n=>n.suggestionData.id,e,r,o,s,(n,t,u,f)=>this.parseIdLookupResponse(i,r,n,t,u,f),"MFF",a,p,n=>n.suggestionData.id),n.isDataSourceEnabled("MRS",i)&&o("MRS",w,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=n=>(this.setupRemoveFromHistoryContextMenu(n,r,t),n.lastLaunchTime=r.rankingData.lastLaunchTime,o.appContextData&&(n.appContext=o.appContextData.appContext,n.query=o.appContextData.query,n.text=t.queryToFetch?HitHighlightingParser.addMarkers(o.appContextData.textWithoutHH,t.queryToFetch):o.appContextData.textWithoutHH),this.setRankingSignals(n,o),!0);n.safeExecute(()=>n.parseLocalSuggestion(t,f[0],u,i,this._temporaryMessageHandler,o.type,e,s),"parseLocalSuggestion "+u)}}setRankingSignals(n,t){n.hc=t.hc;n.highConfidenceMetaSuggestionScore=t.highConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.prefetchConfidenceScore;n.fromHistory=!0;n.hasMruData=!0}parseMRUWebSuggestion(t,i,r,u){let e=i.suggestionData,f=n.createSuggestion(t,t.queryToFetch?HitHighlightingParser.addMarkers(e.textWithoutHH,t.queryToFetch):e.textWithoutHH,null,e.icon,e.type,e.query,n.InstrumentedItem.createInstrumentedItem(r,e.type),e.handoffType,r,!1);f.lastLaunchTime=i.rankingData.lastLaunchTime;this.setRankingSignals(f,e);switch(f.handoffType){case 5:case 4:if(!n.isCortanaEnabledCache||f.type=="CSK")return null;let o=e;if(f.primaryMetadata=o.annotation||o.secondaryText,f.reactKey=f.type+f.primaryMetadata,!n.setCat1SuggestionProperties(f,t,r,o.actionUri,o.taskFrame,o.confidence,o.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 c=e;(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())&&u=="MWS"&&(t.isWorkScopeZI||t.isSearchHomeZI)?n.msbHost.qfUtils.setMsbMruSuggestionProperties(f,e):(!t.isSearchHomeZI||t.scope==n.Scope.Web&&n.config.enableZeroInputSearchHomeWeb||(f=this.setTextAndIconForLBSHSuggestion(f,c)),n.setWebSearchSuggestionProperties(f,t,r,c.url,this._navigationHelper));f.reactKey=this.generateReactKey(t,f);break;case 1:let s=e,l=i.rankingData;t.queryToFetch.length>3&&(f.autoOpenPreviewPaneWhenOnTopHit=!!l.previewPaneLaunchCount);let h=s.title||s.secondaryText;t.isSearchHomeZI&&h?(f.additionalInfoText=s.url,f.text=HitHighlightingParser.removeMarkers(h)):f.primaryMetadata=h;f.reactKey=s.type+s.url;n.setUrlSuggestionProperties(f,t,r,s.url);n.config.directNavPreviewPane&&f.type=="MD"&&f.url&&(f.getIcon=n.getFaviconUrlForRawUrl(f.url,64,64,1.5),t.isSearchHomeZI||(f.previewPaneType=2));break;default:return SharedLogHelper.LogError("parseMruWebSuggestion",null,new Error("Unexpected handoff type: "+e.handoffType)),null}return n.isValidSuggestion(f,"parseMruWebSuggestion")?(this.setupRemoveFromHistoryContextMenu(f,i,t),f):null}setTextAndIconForLBSHSuggestion(n,t){return n.text=t.query,n.icon=this.getIconForLBSHSuggestion(),n}getIconForLBSHSuggestion(){return n.config.disableMruLBSHColorfulIcon?{type:2,content:""}:{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.scope===n.Scope.All||r.scope===n.Scope.Work);let e={verb:f?"RemoveFromDeviceHistoryAll":"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:()=>{i.remove(()=>{n.Host.refreshCurrentPane(),f||this._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemovedFromDeviceHistory",HitHighlightingParser.removeMarkers(t.text)))}),delete i.remove},icon:{content:"",type:2}};return[e]},!0)}generateReactKey(n,t){return(n===null||n===void 0?void 0:n.isSearchHomeZI)?t.type+t.text:t.type+n.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=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){i&&(i.bindItemLaunch((n,t,i)=>this.storeSuggestionToMRU(n,t,i)),i.bindConversationEnds((n,t,i)=>this.storeSuggestionToMRU(n,t,i)));let a,v=(t,i,u)=>r(o,i=>{t(i);let r=n.getTimeDiffInDays(a);(r===null||r>=1)&&(a=n.getCurrentDate(),this.prune());this.getStorage(n=>this.instrumentMRUSize(n),()=>this.onAfterWrite(),()=>this.onAfterWrite(),()=>this.onAfterWrite())},i,u,l),y=(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")),p=()=>!0,w=n=>n=="R"?undefined:n;n.Host.bindClearMRURequested(n=>{this.teardownStorage(),t.ClientSideStorage.deleteDatabase(o,()=>n(!0),()=>n(!1))},o);super(v,y,p,w,c);this.dataSource=c;this.dmaWebRecentsType=[0,13,14,16,15];this.candidatesEnabled=s;this.loggingEnabled=h;this.getSuggestionKey=u;this.getGroupType=f;this.isMRUHistoryGroupType=e;this._pendingWrites=[];sj_evt.bind("clearMRUButtonClicked",()=>{t.ClientSideStorage.deleteDatabase(o),this.reloadStorage()})}createMruResponse(t,i,r){i=i||[];let f=this.getKey(t);this._lastKey=r?f:null;let l=r?i.find(n=>n.key==f):null;this._valueForLastKey=l?l.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 t=[],r=this.getOldestDateToKeep();for(let{key:u,value:n}of i)if(n.Suggestions)for(let i of n.Suggestions){let f=this.getRankingData(n,i);f&&f.lastLaunchTime&&f.lastLaunchTime>=r&&t.push({rankingData:u==this._lastKey?{prefixLaunchCount:f.prefixLaunchCount,lastLaunchTime:f.lastLaunchTime,previewPaneLaunchCount:f.previewPaneLaunchCount,lastPreviewPaneLaunchTime:f.lastPreviewPaneLaunchTime}:f,suggestionData:i,remove:n=>this.remove(u,i,n)})}t.length>0&&(u.Suggestions=[],t.sort((n,t)=>t.rankingData.lastLaunchTime-n.rankingData.lastLaunchTime),t.forEach(n=>this.addToResponseIfNotPresent(u.Suggestions,n)),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))}return u}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(n,t){let i=JSON.stringify(t,r.removeRankerSignals),u=n.find(n=>JSON.stringify(n,r.removeRankerSignals)==i);u||n.push(t)}isSuggestionGroupTypeSupported(t){return(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())?this.dataSource==="MWS"?n.isWorkScopeMruGroupType(t):!n.isWorkScopeMruGroupType(t):!0}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);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 n=f.getMruData();n&&i&&(r.Suggestions||(r.Suggestions=[]),this.addToDataIfNotPresent(r.Suggestions,n))}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;this.withStorage(n=>n.put(t,i,()=>this.onAfterWrite(),n=>{this.onError(n,"updateAndSaveLaunchData");this.onAfterWrite()}))||this.onAfterWrite()}removeAndSaveLaunchData(n,t,i,r){if(!t){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("MRU entry not present"));this.onAfterWrite();return}let f=JSON.stringify(i),u=(t.Suggestions||[]).findIndex(n=>JSON.stringify(n)==f);if(u==-1){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("Suggestion not present in MRU"));this.onAfterWrite();return}t.Suggestions.splice(u,1);this._lastKey=n;this._valueForLastKey=t;this.withStorage(i=>i.put(n,t,()=>{r&&r(),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||uthis.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)}}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 o(t,i){if(!i)throw new Error("Undefined query IQuery for data source: "+t);r||ft();let u=r[t];if(!u)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 u[4];let f=u.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 vr(n){return r||ft(),!!r[n]}function yr(n,t,i){if(!r||!r[i]||t.taskFrame)return!1;let u=o(i,t);return u.sfgaoFilter?!u.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function i(n,t){return n=di.concat(n),t&&(n=n.concat(gi)),n}function ft(){p=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getUserSID();let ut=0,lt=f(n.getKnownFolderPathLC(n.FOLDERID_Profile)),[ft,d]=oi(ut,p,!1),[o,t]=oi(ut,p,!0);tt=ft;gt=d;let et='"System.Kind" != ANY ARRAY['+rt.concat("link").map(n=>"'"+n+"'").join(", ")+"] AND "+ft,at="\"System.Kind\" = SOME ARRAY['program'] AND "+o,s='"System.Kind" != ANY ARRAY['+ti.map(n=>"'"+n+"'").join(", ")+"] AND "+o,g='"System.Kind" != ANY ARRAY['+ni.concat(rt).concat("folder").map(n=>"'"+n+"'").join(", ")+"] AND "+o,ii="\"System.Kind\" = SOME ARRAY['folder'] AND "+o,ot="\"System.Kind\" = SOME ARRAY['Music'] AND "+o,st="\"System.Kind\" = SOME ARRAY['Picture'] AND "+o,ht='"System.Kind" = SOME ARRAY['+it.map(n=>"'"+n+"'").join(", ")+"] AND "+o,ri="\"System.Kind\" != ANY ARRAY['game', 'calendar', 'web history', 'feed', 'contact', 'task', 'journal', 'note', 'instantmessage'] AND "+o,ui="SCOPE = 'file:"+lt+"' AND \"System.Kind\" = SOME ARRAY['folder'] AND "+o,fi=gr(p);r={};r.IFF=[{selectFields:i(e,!1),filterFieldsSets:[vt],mostRelevantProps:a,kindAndScopeClauses:et,sortClause:n.config.enableIndexerQueryExtensionSort?w(h):u,searchOptions:3,sfgaoFilter:d,enabled:t=>!!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)},{selectFields:i(e,!1),filterFieldsSets:[],mostRelevantProps:a,kindAndScopeClauses:et,sortClause:n.config.enableIndexerQueryExtensionSort?w(h):u,searchOptions:0,sfgaoFilter:d,enabled:t=>!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)},{selectFields:i(yt,!0),filterFieldsSets:[nr],mostRelevantProps:a,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?w(h):u,searchOptions:3,sfgaoFilter:t,enabled:t=>!!(t===null||t===void 0?void 0:t.queryToFetch)&&n.supportsShortcuts("IFF",t)},{selectFields:i(yt,!0),filterFieldsSets:[],mostRelevantProps:a,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?w(h):u,searchOptions:0,sfgaoFilter:t,enabled:t=>t&&!t.queryToFetch&&n.supportsShortcuts("IFF",t)},{selectFields:i(e,!0),filterFieldsSets:[tr],mostRelevantProps:a.concat(["System.Title"]),kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?w(h):u,searchOptions:0,sfgaoFilter:t,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)}];r.MDOC=[{selectFields:i(v,!0),filterFieldsSets:[pt.concat(fr)],mostRelevantProps:b,kindAndScopeClauses:g,sortClause:u,searchOptions:3,sfgaoFilter:t,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(v,!0),filterFieldsSets:[pt],mostRelevantProps:b,kindAndScopeClauses:g,sortClause:u,searchOptions:3,sfgaoFilter:t,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&&!n.queryToFetch},];r.MPVD=[{selectFields:i(v.concat(y).concat(n.config.myStuffPhotoVideoStrategyFix?k:y),!0),filterFieldsSets:[nt],mostRelevantProps:b,kindAndScopeClauses:ri,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)}];r.MFOL=[{selectFields:i(er,!0),filterFieldsSets:[sr],mostRelevantProps:or,kindAndScopeClauses:ii,sortClause:u,searchOptions:3,sfgaoFilter:t}];r.MPHO=[{selectFields:i(k,!0),filterFieldsSets:[hr],mostRelevantProps:wt,kindAndScopeClauses:st,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(k,!0),filterFieldsSets:[],mostRelevantProps:wt,kindAndScopeClauses:st,sortClause:u,searchOptions:0,sfgaoFilter:t,enabled:n=>n&&!n.queryToFetch},];r.MVID=[{selectFields:i(y,!0),filterFieldsSets:[cr],mostRelevantProps:bt,kindAndScopeClauses:ht,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(y,!0),filterFieldsSets:[],mostRelevantProps:bt,kindAndScopeClauses:ht,sortClause:u,searchOptions:0,sfgaoFilter:t,enabled:n=>n&&!n.queryToFetch},];r.MMUS=[{selectFields:i(kt,!0),filterFieldsSets:[lr],mostRelevantProps:dt,kindAndScopeClauses:ot,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:n=>!!(n===null||n===void 0?void 0:n.queryToFetch)},{selectFields:i(kt,!0),filterFieldsSets:[],mostRelevantProps:dt,kindAndScopeClauses:ot,sortClause:u,searchOptions:0,sfgaoFilter:t,enabled:n=>n&&!n.queryToFetch},];r.IBA=[{selectFields:i(ir,!0),filterFieldsSets:[ur],mostRelevantProps:rr,kindAndScopeClauses:at,sortClause:u,searchOptions:3,sfgaoFilter:t}];r.MFF=[{selectFields:i(e,!1),filterFieldsSets:[ar],mostRelevantProps:null,kindAndScopeClauses:null,sortClause:null,searchOptions:0,sfgaoFilter:null}];r.LDIC=[{selectFields:i(e,!0),filterFieldsSets:[],mostRelevantProps:null,kindAndScopeClauses:ui,sortClause:u,searchOptions:0,sfgaoFilter:t}];r[ct]=[{selectFields:i(e,!0),filterFieldsSets:[],mostRelevantProps:null,kindAndScopeClauses:s,sortClause:u,searchOptions:0,sfgaoFilter:t}];r.ANA=[{selectFields:i(l,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:fi,sortClause:c,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&!n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==0},{selectFields:i(l,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:c,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==1},{selectFields:i(l,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:c,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==2},{selectFields:i(l,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:c,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==3},{selectFields:i(l,!1),filterFieldsSets:[],mostRelevantProps:[],kindAndScopeClauses:"",sortClause:c,searchOptions:0,sfgaoFilter:null,enabled:t=>n.isDataSourceEnabled("ANA",null)&&n.AnaheimDataProvider.isInitialized()&&t.anaheimStrategy==4},]}function pr(t,i,r,u,f){var e;return n.config.enableNaturalLanguageIndexerQuery?SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSqlFromNQSInput(t.queryToFetch).then(e=>{var o;return e&&e.length>0&&!n.config.enableNaturalLanguageIndexQueryCounterFactual?(n.InstrumentationHelper.notifyNaturalQuerySyntaxFetched(n.SequenceNumberManager.getSequenceNumber(),!0),Promise.resolve(e)):(n.InstrumentationHelper.notifyNaturalQuerySyntaxFetched(n.SequenceNumberManager.getSequenceNumber(),!1),ri((o=t===null||t===void 0?void 0:t.queryToFetch)!==null&&o!==void 0?o:"").then(n=>ot(t,n,i,r,u,f)))}):ri((e=t===null||t===void 0?void 0:t.queryToFetch)!==null&&e!==void 0?e:"").then(n=>ot(t,n,i,r,u,f))}function wr(n,t,i,r){let u=o(t,n),f="SELECT TOP "+i.length+" "+d(u.selectFields)+" FROM SystemIndex WHERE "+ru(u,i,r),e=st(r);return e!=""&&(f+=" AND "+e),f}function br(t,i){let r=o(t,null),e=n.config.maxDeviceItemCacheSize,u="SELECT TOP "+e+" "+d(r.selectFields)+" FROM SystemIndex WHERE ",f=st(i);return f!=""&&(u+=f+" AND "),u+r.kindAndScopeClauses}function kr(){let n=o(ct,null),t="WorkId, "+d(n.selectFields),i=n.kindAndScopeClauses;return"SELECT "+t+" FROM SystemIndex WHERE "+i+" ORDER BY "+n.sortClause}function dr(n,t){r&&r[n]&&r[n][t]&&(r[n][t].kindAndScopeClauses=nu(p,t))}function gr(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 ii(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+=et(t,i,r,u),f+")"}function et(n,t,i,r){let u="";for(let f=0;fn.getProperty(t),propertyHits:n.propertyHits,rankScore:n.rankScore,getImageAsync:t=>n.getImageAsync(t),imageType:n.imageType,canHaveContextMenu:n.canHaveContextMenu,getVerbsAsync:()=>n.getVerbsAsync(),extension:n.extension,itemTypeDisplayName:n.itemTypeDisplayName,createdDate:n.createdDate,lastModifiedDate:n.lastModifiedDate};return t.originalDeviceItem=n,t}}}return n}function iu(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),imageType:t.imageType,canHaveContextMenu:t.canHaveContextMenu,getVerbsAsync:()=>t.getVerbsAsync(),extension:t.extension,itemTypeDisplayName:t.itemTypeDisplayName,createdDate:t.createdDate,lastModifiedDate:t.lastModifiedDate,filePath:u,lastAccessed:t.getProperty("System.DateAccessed"),version:null,isImmersive:!1,logoBackgroundColor:null,launchArguments:null,totalLaunches:null,isTrustedApp:!1,packageFamilyName:null,jumpList:null,getJumpListAsync:null,voiceCommandExamples:null,rawIndexResponse:null};return f.originalDeviceItem=t,f}function d(n){return n.map(n=>n=="System.ParsingPath"?"path":`"${n}"`).join(",")}function st(t){return n.config.useWhereId&&t?"ReuseWhere("+t+") ":""}function ru(n,t){return"("+eu(n,t)+")"}function uu(n,t,i,r,u,e){let o="";n.mostRelevantProps.length>0&&(o+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps ");let s=ou(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 fu(n,t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.tokenize(n,t)}function ri(n){return SearchAppWrapper.CortanaApp.queryFormulationView.getLinguisticDataAsync(n)}function ui(t,i){let r="",u=t.filterFieldsSets.length>1;return t.filterFieldsSets.forEach(t=>{u&&(r?r+=") AND (":r="(");let f=!0;for(let u of t){let t=!1;for(let e of i)f?(r+="(",f=!1):r+=t?" OR ":" OR (",r+=n.formatString(u,[e]),t=!0;t&&(r+=")")}}),u&&(r+=")"),r}function eu(t,i){let r=[];return r=n.config.disableMRUFilesAndFoldersWildCards?i.map(n=>f(n)):i.map(n=>ht(n)),ui(t,r)}function ou(n,t,i,r,u){let e=[t];(i===null||i===void 0?void 0:i.alternatives)&&i.alternatives.forEach(n=>e.push(n));let o=e.map(n=>ht(n)),f=ui(n,o);return(r&2)==2&&(f=su(r,i,o,f,u)),f}function su(t,i,r,u,f){let o=hu(t),e=!1;for(let s of o){let o=!1;for(let h of r){let c=[],r=fu(h,i.language);if(e&&n.config.indexerQueryMWLimit){if((t&4)==0||r.length<=n.config.indexerQueryMWLimit)for(let t=0;t1){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 hu(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 fi(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 fi(n,1)}function ht(n){return fi(n,2)}function cu(n){let t=g[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function s(n,t,i,...r){typeof i=="string"?(i=ht(i),t.push(r.map(t=>`CONTAINS(${t},'"${i}*"',${n}) RANK BY COERCION(ABSOLUTE, 1000)`))):i&&i.Value&&s(n,t,i.Value,...r)}function au(n,t,i){let f=[],e='"System.Kind" != ANY ARRAY['+ut+"]";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['+it.map(n=>"'"+n+"'").join(", ")+"]";break;case"Powerpoint":case"Word":case"Excel":e="CONTAINS(System.ItemType,'\""+lu[n]+"*\"',"+i+') RANK BY COERCION(ABSOLUTE, 1000) AND "System.Kind" != ANY ARRAY['+ut+"]";break;default:e='"System.Kind" != ANY ARRAY['+ut+"]";s(i,f,n,"System.ItemType","System.ItemTypeText")}}s(i,f,t.Title,"System.ItemNameDisplay","System.Title");s(i,f,t.Body,"System.ItemNameDisplay","System.Title","System.FileDescription","System.Keywords","System.Search.Contents");t.People&&t.People.forEach(n=>{let t=n.Value;t&&s(i,f,t=="me"?SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.userName:t,"System.Author","System.FileOwner","System.Document.LastAuthor","System.Photo.TagViewAggregate")});s(i,f,t.Place,"System.Photo.TagViewAggregate");let r=vu(t.Time);r&&f.push(["System.DateCreated>='"+r[0]+"' AND System.DateCreated<'"+r[1]+"'","System.DateModified>='"+r[0]+"' AND System.DateModified<'"+r[1]+"'","System.DateAccessed>='"+r[0]+"' AND System.DateAccessed<'"+r[1]+"'","System.DateArchived>='"+r[0]+"' AND System.DateArchived<'"+r[1]+"'","System.DateAcquired>='"+r[0]+"' AND System.DateAcquired<'"+r[1]+"'",]);return{selectFields:cu(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+tt:tt,mostRelevantProps:[],searchOptions:0,sortClause:u,sfgaoFilter:gt}}function vu(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),[ei(e),ei(r)]}function ei(n){let t=n.toISOString();return t.substr(0,t.indexOf("T"))}function oi(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&pi)&&!(n&yi)&&(!!(n&&wi)||n&&ki&&!!(n&<)||n&&bi&&!!(n&<)):(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(ci));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(si)),h=f(n.getKnownFolderPathLC(hi));u+=" AND (Scope <> 'file:"+s+"')";h!=s&&(u+=" AND (Scope <> 'file:"+h+"')");let c=f(n.getKnownFolderPathLC(li));u+=" AND (Scope <> 'file:"+c+"')";let l=f(n.getKnownFolderPathLC(ai));if(u+=" AND (Scope <> 'file:"+l+"')",r){let t=f(n.getKnownFolderPathLC(vi));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 w(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, "+u}const ct="PRIME",si="{905e63b6-c1bf-494e-b29c-65b732d3d21a}",hi="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}",ci="{0762D272-C50A-4BB0-A382-697DCD729B80}",li="{A4115719-D62E-491D-AA7C-E74B8BE3B067}",ai="{0482af6c-08f1-4c34-8c90-e17ec98b1e17}",vi="{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}",yi=4096,pi=524288,wi=4194304,lt=536870912,bi=8388608,ki=268435456,at=3,u='"System.Search.Rank" DESC, "System.DateModified" DESC, "System.ItemNameDisplay" ASC',h=['".exe"','".xlsx"','".lnk"','".docx"','".xls"','".doc"','".bat"','".pptx"','".pdf"','".txt"',],di=["System.Kind","System.Search.Rank","System.ParsingPath","System.DateCreated","System.DateModified","System.Search.QueryPropertyHits","System.ItemNameDisplay","System.FileExtension","System.ItemType",],gi=["System.Link.TargetParsingPath","System.SFGAOFlags",],c='"System.DateCreated" DESC, "System.Link.DateVisited" DESC, "System.History.VisitCount" DESC, "System.History.SelectionCount" DESC',l=["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",],e=["System.Title","System.Music.AlbumTitle","System.Music.DisplayArtist"],a=["System.ItemNameDisplay","System.Music.DisplayArtist","System.Music.AlbumTitle",];let vt=["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 yt=e.concat("System.DateAccessed"),nr=vt.concat(["CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)"]);let tr=["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 ir=["System.DateAccessed",],rr=["System.ItemNameDisplay",];let ur=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 795)",];const v=["System.Search.AutoSummary","System.Keywords","System.Title","System.Author","System.Document.LastAuthor",],b=["System.ItemNameDisplay","System.Keywords","System.Title",];let nt=["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||(nt=nt.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 pt=["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 fr="CONTAINS(System.Search.Contents, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 545)",er=[],or=["System.ItemNameDisplay",];let sr=["CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)",];const k=["System.Photo.TagViewAggregate","System.Title",],wt=["System.ItemNameDisplay","System.Photo.TagViewAggregate",];let hr=["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 y=["System.Title","System.Keywords","System.Music.DisplayArtist","System.Music.Genre",],bt=["System.ItemNameDisplay","System.Title","System.Keywords",];let cr=["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)",],kt=["System.Title","System.Music.DisplayArtist","System.Music.AlbumTitle","System.Music.Genre",];const dt=["System.ItemNameDisplay","System.Title","System.Music.AlbumTitle",];let lr=["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 ar=["path = '{0}'"];let r;t.getStrategy=o;t.dataSourceSupported=vr;t.suppress=yr;let p,tt,gt;const it=["Movie","RecordedTV","Video"],ni=it.concat(["Picture","Music"]),ti=["calendar","game","web history","feed","contact","task","journal","note","instantmessage"],rt=ti.concat("program"),ut=ni.concat(rt).concat(["folder","link"]).map(n=>"'"+n+"'").join(",");t.initStrategies=ft;t.generateIndexerQueryAsync=pr;t.generateIndexerQueryForMRUFilesAndFolders=wr;t.generateIndexerQueryForDeviceItemCache=br;t.generateIndexerPrimerQuery=kr;t.updateAnaheimStrategy=dr;t.generateIndexerQuery=ot;t.fixKind=tu;let g={};g.MPHO=i(k,!1);g.MVID=i(y,!1);g.MDOC=i(v,!1);const lu=(()=>{let n={};return n.Powerpoint="ppt",n.Word="doc",n.Excel="xls",n})()})(t=n.IndexerQueryGenerator||(n.IndexerQueryGenerator={}))}(WSB||(WSB={})),function(n){function a(t,i,r,u,f,e,o,s){let h=u?r+" "+i:r;return n.Async.safeChainWithGlobalCaching("getIcon",i=>t.getImageAsync(n.getImageSizeValue(i)),n=>n+"_"+i,t=>n.toIcon(t,"getIcon.toIcon",e,o,h),e,f?()=>(t===null||t===void 0?void 0:t.imageType)===0:null,h,null,s)}function i(t,i,r,u,f,e){return{deviceItem:t,getIcon:a(t,t.id,r,r&&!n.localDataSourceMayContainPII(r),n.displayedInGridLayout(i),u,f,0),icon:e?u:null,suggestionType:i}}function v(n,t,i){return{deviceItem:n,icon:i,suggestionType:t}}function ct(n){return n.map(n=>({isSimulated:!0,displayName:n,id:null,kind:null,getProperty:null,propertyHits:null,rankScore:null}))}function y(){if(n.config.enableFetchStartLogging&&n.InstrumentationHelper.instrumentFetchProviderBegin(n.SequenceNumberManager.getSequenceNumber(),"TOPP"),n.config.wsbWebView2&&SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.fetchForTopLocalAppsAsync)return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.fetchForTopLocalAppsAsync(e,l,6);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(l,u.id)&&i.push(u)}return n.config.minTopApps&&i.lengthn).then(n=>n).then(n=>{return lt(n),[].concat(n)})}}function lt(t){return t.sort((t,i)=>{let u=t.totalLaunches,f=i.totalLaunches;if(u!==0||f!==0)return f-u;let o=t.id,r=i.id;return n.contains(e,o)?n.contains(e,r)?e.indexOf(o)-e.indexOf(r):-1:n.contains(e,r)?1:0}),t}function r(t,i,r){switch(t){case"program":return"IBA";case"picture":return i&&n.contains(at,i.toLowerCase())?"FL":"LI";case"video":return i&&n.contains(vt,i.toLowerCase())?"FL":"LV";case"movie":case"recordedtv":return"LV";case"music":return"MU";case"folder":return"FD";default:return r}}function s(t,i,r,u,f,e,o,s,h){let l=o&&h?t.filter(t=>n.contains(Object.keys(tt),t)):[];l.length>0&&(t=t.filter(t=>!n.contains(l,t)));let c=t=>{for(let i of l){let r=tt[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)c({});else{let h={},i=t.slice(0);if(s)for(let n=t.length-1;n>=0;--n){let r=t[n];s.hasOwnProperty(r)&&(h[r]=s[r],i.splice(n,1))}if(i.length==0)c(h);else{let l=!o||n.localDataSourceMayContainPII(o)?o:o+" "+i;n.Async.safeChain(r,()=>u(i),r=>{let u=n.Map.map(i,r,n=>f(n));if(s&&i.forEach(n=>s[n]=u[n]),i.length!=t.length)for(let n in h)h.hasOwnProperty(n)&&(u[n]=h[n]);c(u)},()=>c({}),e,l)}}},"resolveIdsWithCache",null,o,()=>c({}))}function bt(n,t){if(!t.launchArguments||wt.test(n.query))return!0;let i=t.id.toLowerCase();return it.some(n=>i.includes(n))?!0:!1}function rt(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)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 ut(n,t){if(!!t&&t.length==0)return!1;let i=t.split(" ");if(n.length!=i.length)return!1;for(let t=0;tJSON.parse(t.rawIndexResponse),"parseConstraintIndexMetaData"):undefined}function st(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(kt,h))return!0;let o=i;if(rt(o,t,!0,f,e))return!0;let r=i.kind;if(r&&(r=r.toLocaleLowerCase(),r!="program"&&r!="unknown")||u=="LRA"&&ft(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 rt(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.lengths.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(dt,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||ft.includes(n))&&(yt.some(n=>u.includes(n))||!r.launchArguments&&it.some(n=>u.includes(n))||n.contains(pt,t)))return!0}return!1}const h=":wux:",c="Classic_{87d66a43-7b11-4a28-9811-c86ee395acf7}",l=["Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App"],e=["Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge","windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel","Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","Microsoft.ScreenSketch_8wekyb3d8bbwe!App","{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}\\mspaint.exe","{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\mspaint.exe"],ht=new Set(["!","@","#","$","^","%","&","*","(",")","<",">","[","]","{","}","~","`","?","/",",",".","+","-","_","=",":",";","|"]);n.getIcon=a;n.createLocalResponseSuggestionWithDeviceItemImage=i;n.fetchForTopLocalApps=y;const at=[".dwg",".ai",".psd"],vt=[".ts"];n.getSuggestionTypeFromKindAndExtension=r;const p={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},w={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,v(t,r,u)}return i(t,r,u,n.ScopeConfig[n.Scope.Settings].icon)},supportsEmptyQuery:!1},b=[p,w,{getResultsContainer:n=>n.media,dataSource:"LM",getSuggestionType:n=>r(n.kind,n.extension,"FL"),maxUpTo3chars:7,maxAfter3chars:10,maxAfter8charsOrInL2ZeroInput:20,supportsEmptyQuery:!0},{getResultsContainer:n=>n.files,dataSource:"FL",getSuggestionType:n=>r(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=>r(n.kind,n.extension,"FL"),maxUpTo3chars:7,maxAfter3chars:15,maxAfter8charsOrInL2ZeroInput:25,supportsEmptyQuery:!0},],k=[{getResultsContainer:n=>n.files,dataSource:"MDOC",getSuggestionType:n=>r(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=>r(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=>r(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=>r(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=>r(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},],d=[{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=ct(r);i(u)}),getResults:n=>n,dataSource:"FEH",getSuggestionType:()=>"FEH",customCreateLocalResponseSuggestion:(n,t)=>{return v(n,t,{type:2,content:""})},supportsEmptyQuery:!0},{getResultsContainer:()=>y(),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},{getResultsContainer:n=>ThresholdUtilities.createPromise(t=>{let i=f?f.retrieveItemsFromCache(n.queryToFetch):[];t(i)}),getResults:n=>n,dataSource:"LDIC",getSuggestionType:n=>r(n.kind,n.extension,"FD"),maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,supportsEmptyQuery:!1},],g=[{getResultsContainer:n=>SearchAppWrapper.CortanaApp.queryFormulationView.startCommandLineQuery(n.originalQuery,""),dataSource:"CG",getSuggestionType:()=>"CG",customCancellation:()=>SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastCommandLineQuery(),supportsEmptyQuery:!1},];n.LocalDataProviderDataSources=b.concat(k).concat(d).concat(g).map(n=>n.dataSource);const u={suggestions:[],maxedOut:!1};let nt={},f,tt={"shell:RecycleBinFolder":{icon:{content:"",type:2},locStringKey:"RecycleBin"}};const yt=["\\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),it=["\\system32\\finger.exe","\\system32\\ping.exe","\\system32\\print.exe","\\system32\\shutdown.exe","\\system32\\expand.exe","\\system32\\tskill.exe","\\system32\\reg.exe","\\system32\\sc.exe",],pt=["uninstall","outlook","excel","skype","nero","onenote","lync","vmware","firefox","itunes","photoshop","print","opera","visio","thunderbird","smartscreen"],wt=/[\/\.\-\\]/;n.isRealCommand=bt;const kt=["Microsoft.Cortana_8wekyb3d8bbwe!CortanaUI","Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI",],dt=[".dll",".pdb",".obj",".bin",".etl",".bak",".config",".resx",".manifest",".ini",".searchconnector-ms",".settingcontent-ms",".vstx",".vssx",".ms-one-stub",],gt=["visio content","bin","debug","obj","objd","amd64","x86","microsoftedgebackups",];n.isInitials=ut;n.getSuggestionTypeOverride=et;n.parseConstraintIndexMetaData=ot;n.isSuppressed=st;class t{getName(){return"LocalDataProvider"}constructor(t,i){this._previousKeystrokeCache=t;i&&(f=i,n.Host.bindShown(()=>{f&&(f.clean(),this.cacheDeviceItems())}));n.Host.bindAppHidden(()=>{nt={}})}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=b.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=k.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)this.searchFolderWithMultipleResults(i,n,null,r,e,f,(v=t.lastResultHandle)===null||v===void 0?void 0:v.whereId)}let p=d.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=g.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 r of n)this.logProviderFailure(r.dataSource),i(r.dataSource,u,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 c={Counter:0},s=[],l=u.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,r,f,e,o,s,h){let c=r.dataSource,a=this.getMax(i,r),v=!f,l,y;if(v){let t;if(n.RuntimeConfig.QfMode==5&&(t=n.Host.getFileExplorerCurrentPath()),t&&!/^[a-zA-Z]\:\\/.test(t)){e(c,u,null,null,!0);return}if(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(41150162))if(n.Host.getLanguage()=="en-US"&&n.config.noSqlFetchWhenShortCircuit)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,u,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(()=>{},()=>{SharedLogHelper.LogError("debugWindowsIndexerQueryTimeout",t)}),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,u,null,null,!0);return}l=()=>n.IndexerQueryGenerator.generateIndexerQueryAsync(i,t,a,c,h).then(t=>{let i=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(t);return n.config.wsbWebView2&&i.done(()=>{},()=>{SharedLogHelper.LogError("debugWindowsIndexerQueryTimeout",t)}),i})}}else{if(y=n.safeExecute(()=>r.getResultsContainer(f),"getResultsContainer "+c),!y){e(c,u,null);return}l=()=>this.getResults(i,a,y,r)}n.Async.safeChain(v?"queryWindowsSearchIndexerAsync":"getItemsAsync",l,u=>{if(o()){let f=u.resultSet,o;u.whereId&&t.setWhereId(u);f?o=u.state:f=typeof u.length=="undefined"?Object.keys(u).map(n=>u[n]):u;v&&n.supportsShortcuts(c,i)&&(f=f.map(t=>n.IndexerQueryGenerator.fixKind(t)));let s=t.getDataSourceState(o);e(c,this.toLocalResponse(a,i,f,r,y),s)}},t=>{n.isCancellation(t)||this.logProviderFailure(c),e(c,u,null)},v?s:null,c+" "+i.queryToFetch)}searchFolderWithSingleResult(t,i,r,f,e){let o=i.dataSource,s=n.safeExecute(()=>i.getResultsContainer(r),"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,u,null)},null,t.queryToFetch):f(o,u,null)}logProviderFailure(t){let i=n.providerFailureLogName(t);i&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(()=>SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(i,"ErrorForTopHit"),"logProviderFailure")}cacheDeviceItems(){let i="LDIC",r=()=>{var r;let u=n.IndexerQueryGenerator.generateIndexerQueryForDeviceItemCache(i,(r=t.lastResultHandle)===null||r===void 0?void 0:r.whereId);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(u)};f.setReady(!1);n.Async.safeChain("initializeDeviceItemCacheAsync",r,n=>{n.whereId&&t.setWhereId(n);for(let t of n.resultSet)f.addItemToCache(t);f.setReady(!0)})}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){s(n,t,"findAppsAsync",n=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findAppsAsync(n),n=>p.customCreateLocalResponseSuggestion(n,null,r),i,r,null,!0)}static getSettings(n,t,i,r){s(n,t,"findSettingsAsync",n=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findSettingsAsync(n),n=>w.customCreateLocalResponseSuggestion(n,null,r),i,r,null)}static getFiles(u,f,e,o,h){s(u,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,r(n.kind,n.extension,"FL"),h),o,h,nt)}static launchIndexingOptions(i){t.getSettings([c],t=>{let r=t[c];r?n.Host.launchDeviceItemAsync(r.deviceItem,"ST"):i||this.launchIndexingOptions(!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=>ht.has(n))}shouldSkipGenerateIndexerQuerySearch(t){var i;return(t===null||t===void 0?void 0:t.scope)==n.Scope.All&&(n.config.skipGIQSWhenQFAllSymbols&&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:!1}}n.LocalDataProvider=t;let o="Local provider doesn't support empty query"}(WSB||(WSB={})),function(n){let t;const f="UpsellDismissed",e="moreButton",i="feedbackButton",o="chatButtonLeft",s="chatButtonRight",h="optionsButton",c="rewardsBadgeButton",l="userProfileButton",a="closeButton",v="backButton",y="search-home-toggle",p="tp-search-toggle-",r=4.5,u=10;class w{constructor(r,u,y,p,w,b){if(this._page=r,this._accessTokenManager=u,this._msRewardsViewModel=y,this._menuFactory=p,this._substrateProfilePictureProvider=w,this._optionsWindow=b,this._moreButton={id:e,selected:!1,text:null},this._feedbackButton={id:i,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._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",t=SearchAppWrapper.CortanaApp,n.shouldUseMsbEnterpriseScopes()){if(n.config.scopesOrderBeginMsbEnterprise.length==0)return}else if(n.config.scopesOrderBegin.length==0)return;const k=()=>{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(),k()}),n.Host.bindOnFeedbackClosing(t=>{var r;!t&&n.RuntimeConfig.AlwaysWide&&((r=_ge(i))===null||r===void 0?void 0:r.focus())}),n.Host.bindKeyDown((n,t)=>{t.ctrlKey&&n==13&&t.shiftKey&&(this._shouldShowBuildNumber=!0)}),this._substrateUpsellDismiss={action:()=>{this._upsellGotDismissed=!0,n.LightweightStorage.setItem(f,"1"),n.Host.refreshCurrentPane()},icon:{content:"",type:2}},y&&y.bindRewardsBadgeUpdated(()=>{this._shouldRenderScopes=n.config.optScopesRender,k()}),u){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")&&(this._verifyAccountForMSARequired=u,t()):i==1&&(r=="https://substrate.office.com"&&(this._verifyAccountForAADRequired=u,n.isAADVerificationRequired=this._verifyAccountForAADRequired,t()),this._verifyAccountForAADRequired&&n.config.msbAADVerificationFlyoutEnabled&&this.initializeAADVerification(i))};u.bindVerifyAccountRequired((n,t)=>{i(n,t,!0)});u.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],f=n.getScopeDisplayName(e),u;return(u=i&&!this._allScopeButtonPresent?"RemovingScopeNarratorText2":t==n.Scope.All?"AddingScopeNarratorTextAll2":"AddingScopeNarratorText",n.isThirdPartySearchAllowed())?n.Host.getLocString(u,r!==null&&r!==void 0?r:f):n.Host.getLocString(u,f)}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.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockFRE)?((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")):(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"))}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){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):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&&t.scope==n.Scope.All)}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&&this.createAADVerificationFlyout()}}getDMAToggleTiles(t){const i=[{id:y,selected:!t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("Select","Microsoft1PSearchToggleClicked",null,null),n.Host.switchToSearchScope(),n.Host.setMRUSearchApp(),this.setFocusInSearchBox("scope clickHandler All")},label:n.Host.getLocString("SearchToggle")}],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),n.Host.switchToThirdPartyScope(r),n.Host.setMRUSearchApp(r),this.setFocusInSearchBox("scope clickHandler "+r.displayName)},label:r.displayName})}),i}getScopesHeaderDataModel(){var i,r,u,f,e,o,s,h;this._advancedOptionsIdCounter=0;let c=this.getScopeBarElements(),l=this.getHiddenScopeElements(c)||[],y=this._msRewardsViewModel&&this._msRewardsViewModel.getDataModel();const p=(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isScopeListBrandingLogoEnabled())?this.getTenantBrandingDataModel():null;let[v,w]=n.config.userProfileButtonEnabled?this.getUserProfileButtonData():[null,null],a;if(n.isChatScopeEnabled()&&(((i=this._currentQuery)===null||i===void 0?void 0:i.isSearchHomeZI)||((r=this._currentQuery)===null||r===void 0?void 0:r.scope)==n.Scope.Chat)){let t=((u=this._currentQuery)===null||u===void 0?void 0:u.scope)==n.Scope.Chat;a=[{id:"search-home-toggle",selected:!t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("ClientInst","ToggleClickSearch",null,null),n.Host.reformulate("")},label:n.Host.getLocString("SearchToggle"),icon:{type:2,content:""}},{id:"chat-toggle",selected:t,clickHandler:()=>{n.InstrumentationHelper.logClientInstEvent("ClientInst","ToggleClickChat",null,null),n.Host.switchToScope(n.Scope.Chat)},label:n.Host.getLocString("ChatToggle"),iconComponent:"ChatWithBingIcon",iconComponentProps:{id:"chatToggle"}}]}if(n.config.useCobaltCSS&&n.RuntimeConfig.AlwaysWide&&n.isThirdPartySearchAllowed()&&n.isThirdPartyZeroInputEnabledByRegionalPolicy()&&(((f=this._currentQuery)===null||f===void 0?void 0:f.isThirdPartyZI)||!((e=this._currentQuery)===null||e===void 0?void 0:e.originalQuery))&&n.Host.isThirdPartySearchAppsEnabled()){let n=(o=this._currentQuery)===null||o===void 0?void 0:o.thirdPartySearch;a=this.getDMAToggleTiles(n)}const t=n.Host.getLocString("CodexChatButtonUpperRightToolTip");return{isWin11DSB:n.isWin11DSB(this._currentQuery),isWorkScopeHomePage:(s=this._currentQuery)===null||s===void 0?void 0:s.isWorkScopeZI,isSearchHome:(h=this._currentQuery)===null||h===void 0?void 0:h.isSearchHomeZI,scopes:n.config.pureRender?n.deepCopy(c):c,showFeedback:this.isFeedbackEnabled()?()=>this.showFeedback():null,scopesBackBtnHandler:()=>this.scopesBackBtnClicked(),scopesLeftCaretBtnHandler:()=>this.scopesLeftCaretClicked(),scopesRightCaretBtnHandler:()=>this.scopesRightCaretClicked(),rewardsBadgeDataModel:this.shouldShowRewardsBadge(this._currentQuery)&&y,moreMenuDataModel:l.length>0?{opened:this._moreMenuOpened,menuItems:l,buttonClickHandler:(n,t,i)=>this._moreMenuOpened?this.closeMoreMenuDropDown():this.openMoreMenuDropDown(l,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&&v?{opened:this._userProfileMenuOpened,buttonClickHandler:(n,t,i)=>this._userProfileMenuOpened?this.closeUserProfileDropDown():this.openUserProfileDropDown(n,t,i),icon:v,userName:w}:null,brandBarDataModel:p,closeButtonClickHandler:(n,t,i)=>this.closeButtonClicked(n,t,i),codexChatLeftDataModel:n.isCodexEligible()&&n.config.codexSimple?{buttonClickHandler:(n,t,i)=>this.chatButtonClicked(n,t,!0,i),iconText:n.Host.getLocString("CodexChatButton"),toolTip:t,ariaText:t}:undefined,codexChatRightDataModel:n.isCodexEligible()&&n.config.codexBtnUpperRight?{buttonClickHandler:(n,t,i)=>this.chatButtonClicked(n,t,!1,i),toolTip:t,ariaText:t}:undefined,searchHomeToggleTiles:a}}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.config.supportDMA&&n.config.useCobaltCSS&&((r=this._selectedScope)===null||r===void 0?void 0:r.type)==n.Scope.ThirdPartyWeb&&this.scopesRightCaretClicked(),this._shouldRenderScopes=!1,n.config.scopeWithBackground&&n.RuntimeConfig.AlwaysWide&&this.scopesPresentInstrumentationLog())}scopesPresentInstrumentationLog(){n.isWin11DSB(this._currentQuery)||n.InstrumentationHelper.logClientInstEvent("ClientInst","ScopesArePresent",null,null)}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),t()},r=()=>{n.InstrumentationHelper.logClientInstEvent("Select","AADVerificationFlyoutVerifyButtonFailed",null),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?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(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.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):[];r=this.scopeNamesElements(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.scopeWithBackground){let t=["scope2","scope11","scope7","scope3"];if(n.isThirdPartySearchAllowed()){let i=n.Host.getThirdPartySearchApps().length,r=Array.from({length:i},(n,t)=>"scope"+(1e4+t));t=["scope2","scope11","scope7","scope3",...r]}const i=[];for(let n=0;ni===t[n]);i.push(...r)}return i}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.scopeWithBackground&&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")){let r=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(r);i=!0}}return t}isFeedbackEnabled(){return n.isBingEnabled()}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))}scopesSlider(t,i,r){const u=_qs(".scope-with-background__slider"),e=n.isRtl();if(u){let o=u.scrollWidth;this.sliderDirection(t);let f=0,s=setInterval(()=>{e?t===2?u.scrollLeft-=r:t===1&&(u.scrollLeft+=r):t===1?u.scrollLeft-=r:t===2&&(u.scrollLeft+=r),f>=o&&window.clearInterval(s),f+=r},i)}}scopesBackBtnClicked(){n.RuntimeConfig.AlwaysWide&&(this.scopesSliderReset(),n.config.ignoreClearQuerySignalOnDismiss&&this.setFocusInSearchBox("scopes back Btn clicked"),n.Host.reformulate(""),n.InstrumentationHelper.logClientInstEvent("Select","ScopeBackBtnSelected",null,null))}scopesSliderReset(t){this.scopesSlider(0,r,u);t&&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,r,u)}scopesRightCaretClicked(){this.scopesSlider(2,r,u)}getHeaderText(t,i){if(n.RuntimeConfig.FlatListWithoutGroups)return null;let r=n.getScopeDisplayName(i);if(n.isThirdPartySearchAllowed()&&t==n.Scope.ThirdPartyWeb)return n.Host.getLocString("BestMatch");if(r){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,r)}if(this._resultsPresent)return null;if(t!=n.Scope.All)return r}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.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._allScopeButtonPresent&&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)=>t.type==n.Scope.All?-1:i.type==n.Scope.All?1:t.type==n.Scope.ThirdPartyWeb?1:i.type==n.Scope.ThirdPartyWeb?-1:t.text.localeCompare(i.text));this._selectedScope&&this.selectScope(this._selectedScope.type);this._effectiveScopeOrder=null}}createThirdPartyScopeElements(t,i,r){let u=[],f=n.Scope.ThirdPartyWeb,e=0;return t.forEach(n=>{u.push({isScopeElement:!0,id:(r?"scope":"l1scope")+(f+e++),type:f,enabled:!1,text:n.displayName,title:null,icon:i.icon,click:()=>this.thirdPartyClickHandler("scopeBar",n),selected:!1,tooltip:n.displayName,isSelectable:!0,searchExtension:n})}),u}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:"",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);(e!=n.Scope.ThirdPartyWeb||f)&&n.Host.switchToThirdPartyScope(i,r.queryToFetch);this.setFocusInSearchBox("scope clickHandler "+i.displayName)}}clickHandler(t,i,r){let s=n.getScopeDisplayName(n.ScopeConfig[t]),e,f=this._currentQuery,u=f.scope;if(this._shouldRenderScopes=!0,this._scopeTiles.some(n=>n.type==u)||(u=n.Scope.All),s&&u!=t){e=(t==n.Scope.All||t==n.Scope.PathCompletion?"":s+": ")+f.queryToFetch;this.innerRender(t,t,f,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(u==n.Scope.All||this._allScopeButtonPresent){this.setFocusInSearchBox("scope clickHandler noop");return}e=f.queryToFetch;t=n.Scope.All;this.innerRender(t,t,f,this._topHitPresent,this._resultsPresent,!0,!1)}n.isThirdPartySearchAllowed()&&n.Host.setMRUSearchApp();let o=n.Scope[t],h={Scope:o,Source:i,GroupSource:r&&r.source?r.source.toString():undefined};n.InstrumentationHelper.logClientInstEvent("Select","ScopeChanged",null,h);n.config.ignoreClearQuerySignalOnDismiss?(this.setFocusInSearchBox("scope clickHandler "+o),u!=t&&n.Host.reformulate(e,undefined,undefined,r)):(u!=t&&n.Host.reformulate(e,undefined,undefined,r),this.setFocusInSearchBox("scope clickHandler "+o))}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==y||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._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 r=this.getScopeBarElements(),t=this._currentScopeTileIndex,y=r.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==r[0]&&(r=r.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 i: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.scopeWithBackground&&n.RuntimeConfig.AlwaysWide&&!n.isThirdPartySearchAllowed()&&--t:--t,(t<0||t>=y)&&(t=0),r.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,i){i=i&&[...i,`HeaderFooterViewModel::getSubstrateUpsellClickHandler(authType=${t})`];let r=()=>{n.Host.refreshCurrentPane(),n.Host.setFocusInSearchBox(null,"SubstrateUpsell")};return()=>this._accessTokenManager.promptAutheticateDialog(t,n.getSubstrateResourceOrScope(t),r,r,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:"",type:2,needsAccentColor:!0},e=this._substrateUpsellDismiss,c=["VerifyAccountToSearch"]);return this.createAdvancedOption(t==1?"COFA":"COOA",i,h,u,c,this.getSubstrateUpsellClickHandler(t,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getSubstrateUpsell(authType=${t}, position=${r})`]:undefined),f,e,s,null,o,"VerifyButton")}getOneDriveUpsell(t){return this.createAdvancedOption("SDSC",t,null,null,["SeeResultsFromOneDrive"],()=>{n.Host.launchCortanaSignInAsync()},2,null,{content:"",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:""})}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:""})}createAdvancedOption(t,i,r,u,f,e,o,s,h,c,l,a){let y;t&&(y=this.getInstItem(t,i));let p="advancedOption"+this._advancedOptionsIdCounter++;c&&c.length==0&&(c=null);let v={id:p,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:y,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};return v.narratorText=v.text,v.click=e?(t,i)=>{y&&n.InstrumentationHelper.instrumentItemClick(t,y,n.SequenceNumberManager.getSequenceNumber(),null,i,null),e(v)}:undefined,v}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,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptions(VerifyAccountAttention|MSA)`]:undefined),4),r.cssClass=s,r.icon={type:2,content:""},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptions(VerifyButton|MSA)`]:undefined),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,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptions(VerifyAccountAttention|AAD)`]:undefined),4),r.cssClass=s,r.icon={type:2,content:""},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptions(VerifyButton|AAD)`]:undefined),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:""}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r)),i&&this._accessTokenManager.getSelectedAccountInfo((n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::getAccountOptions"]:undefined)||(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?"":""}),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?"":""}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r))),u}getUserProfileButtonData(){let r,i,t=this._accessTokenManager.getSelectedAccountInfo((n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::getUserProfileButtonData"]:undefined);if(t){if(i=t.accountProviderAuthority=="consumers"?0:1,r=this._userProfilesCache[t.accountUserName],!r){const r=this._substrateProfilePictureProvider.getPersonDefaultIcon(t.accountUserName);return this._userProfilesCache[t.accountUserName]=r,this._accessTokenManager.getAccount(i,i==1?"https://outlook.office.com/":n.config.useCobaltCSS?"https://outlook.office.com/M365.Access":"https://outlook.office.com/User.ReadWrite",!1,!0,r=>{if(r&&r.Token){let n=this._substrateProfilePictureProvider.getProfilePictureIconForToken(i,r.Token,t.accountUserName);n&&n(1,n=>{n&&(this._userProfilesCache[t.accountUserName]=n,this.renderScopes())})}else n.logAuthRelatedInfo("getAccountOnFailure::HeaderFooterViewModel::getUserProfileButtonData",`authenticate failed for accType ${i}.`)},undefined,n.Host.isAuthInvestigation()?["HeaderFooterViewModel::getUserProfileButtonData"]:undefined),[r,t.accountUserName]}return[r,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((n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::getAccountOptionsForUserProfileButton"]:undefined);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,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptionsForUserProfileButton(VerifyAccountAttention|MSA)`]:undefined),4),i.cssClass=s,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptionsForUserProfileButton(VerifyButton|MSA)`]:undefined),2),i.cssClass=h,r.push(i)),l&&n.isCloudSearchEnabledAadCache&&this._verifyAccountForAADRequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptionsForUserProfileButton(VerifyAccountAttention|AAD)`]:undefined),4),i.cssClass=s,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?[`HeaderFooterViewModel::getAccountOptionsForUserProfileButton(VerifyButton|AAD)`]:undefined),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===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::getAccountOptionsForUserProfileButton::"]:undefined),n.Host.notifyAccountSelected(u),this._menuFactory.dismiss()},0,null,{type:2,content:""}),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:""}),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?"":""}),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?"":""}),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(i,r){let f=this.getScopeBarElements(),e=this.getHiddenScopeElements(f).filter(t=>t.type!=n.Scope.All).map(n=>{let t=n;return t.layout=0,t});i.push(this.createContextMenuGroup(null,r,"MoreScopesListToolTip",e));i.push(this.getMenuDividerOption());let u=[];if(t.authenticationManager.getAllSearchWebAccountsAsync){if(!this._accessTokenManager.getSelectedAccountInfo((n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::addSinglePaneOptions"]:undefined)||!n.config.userProfileButtonEnabled){let n=this.getAccountOptions(r);u.push(this.createAdvancedOption(null,r,null,null,["ConnectedAccounts"],null,2,null,{type:2,content:""},n))}u.push(this.createAdvancedOption("OMSS",r,null,null,["SearchSettings"],()=>n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettingsAsync(),2,null,{type:2,content:""}))}else(n.isCloudSearchEnabledAadCache||n.isCloudSearchEnabledMsaCache)&&this.addCloudSearchUpsells(u,r,2);u.push(this.getIndexingOption(r,1));i.push(this.createContextMenuGroup(null,r,"OptionsButtonToolTip",u));this.isFeedbackEnabled()&&(i.push(this.getMenuDividerOption()),i.push(this.createAdvancedOption("FB",r,null,null,["FeedbackButtonText"],()=>{this.showFeedback(),this._menuFactory.dismiss()},2,null,{type:2,content:""},null)))}getAdvancedOptions(i,r){let u=[];if(r==1&&(t.authenticationManager.getAllSearchWebAccountsAsync&&(u.push(...this.getAccountOptions(i,n.config.userProfileButtonEnabled)),u.push(this.createAdvancedOption("OMSS",i,null,null,["SearchSettings"],()=>n.config.controlPanelSearchSettings?n.Host.launchSearchPermissions():n.Host.launchSearchSettingsAsync(),2,null,{type:2,content:""}))),u.push(this.getIndexingOption(i,r)),this.isFeedbackEnabled()&&n.isTwoPanesZIEnabled())){u.push(this.getMenuDividerOption());let n=this.createAdvancedOption("FB",i,null,null,["FeedbackButtonText"],()=>{this.showFeedback(),this._menuFactory.dismiss()},2,null,{type:2,content:""},null);n.cssClass=this.getAdvancedOptionCssClass(2);u.push(n)}return r==2&&this.addSinglePaneOptions(u,i),r==0&&(n.isCloudSearchEnabledAadCache||n.isCloudSearchEnabledMsaCache)&&this.addCloudSearchUpsells(u,i,r),r!=2&&n.config.troubleshootButton&&u.push(this.getMenuDividerOption()),n.config.troubleshootButton&&(r==1||r==2)&&u.push(this.createAdvancedOption("OMTS",i,null,null,["Troubleshoot"],()=>n.Host.launchUriAsync("https://aka.ms/fixsearch"),2,null,{type:2,content:""},null)),(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest)||!this._optionsWindow||r!=1&&r!=2||u.push(this.createAdvancedOption(null,i,null,null,["OptionsWindowButton"],()=>{this._optionsWindow.showOptionsWindow(),this._menuFactory.dismiss()},2,null,{type:2,content:""},null)),r!=0&&n.TestHookUrlParameters&&n.config.debugFallbackScenario&&u.push(this.createDebugFallbackOption(i)),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,(n.Host===null||n.Host===void 0?void 0:n.Host.isAuthInvestigation())?["HeaderFooterViewModel::onNavigate(MsbAadUpsell)"]:undefined)},h=this.createAdvancedOption("MSBA",i,null,e,null,c,6,null,{type:2,content:""},null,o,"VerifyButton");h.cssClass="msb-aad-upsell";t.push(h);_w.bfbWsbTel&&bfbWsbTel.logValue("VerifyAccountUpsellAdded","",u)}}chatButtonClicked(t,i,r,u){const e=n.SequenceNumberManager.getSequenceNumber();let f=this.getInstItem(r?"CCBL":"CCBR",e);f=n.InstrumentationHelper.createCodexClickItemProps(f,r?"ChatButtonLeft":"ChatButtonRight");n.InstrumentationHelper.instrumentItemClick(t,f,e,null,i,u);let o=r?`${location.origin}/search?form=WSBCSL&showconv=1&sendquery=1&q=${this._currentQuery.queryToFetch}`:n.config.codexBtnUpperRightLaunchURI,s={campaign:n.config.moreEdgeProtocolOCID,medium:r?"CodexButtonLeft":"CodexButtonRight"};o&&n.Host.launchCodexUriAsync(o,s)}}n.HeaderFooterViewModel=w}(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 o(i,r,u,e,o,s,h,c,l,a,v){if(i.isAnswer=!0,i.htmlContent=e&&e.Content?e.Content.HTML:null,i.segments=c,i.htmlContent){let n=JsonInject.GetResourceKeys([e]);n&&(i.executeScript=()=>JsonInject.WriteAfterContentResources(JsonInject.FilterResources(a,n)))}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):(f(i,r),i.click=i.type=="HS"?()=>n.Host.launchSearchAsync(i.query,v.getSearchUrl(r.fullPartialQuery,i.query,i.type,h,null,"WSQFSH"),!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){f(t,i);i.queryToFetch||(t.text=HitHighlightingParser.addMarkers(t.text));let s;i.isSearchHomeZI?(s="WSHBSH",n.shouldSHSuggToBingChat(t.handoffType,t.query)&&(u=n.appendBingChatParams(u!==null&&u!==void 0?u:`/search?q=${n.encodeQueryParameter(t.query)}`))):n.shouldQFSuggToBingChat(t.handoffType,t.query,t.type)&&(u=n.appendBingChatParams(u!==null&&u!==void 0?u:`/search?q=${n.encodeQueryParameter(t.query)}`),n.setSearchSuggestionChatIcon(t),s="WSBQFC");t.type=="HS"&&(s="WSQFSH");t.click=n.config.enableMoreEdgeProtocol?()=>n.Host.launchSearchAsync(t.query,e.getSearchUrl(i.fullPartialQuery,t.query,t.type,u,t.handoffType,s),t.useRaf,s):()=>n.Host.launchSearchAsync(t.query,e.getSearchUrl(i.fullPartialQuery,t.query,t.type,u,t.handoffType,s),t.useRaf);t.narratorText=n.getNarratorText(t);t.getMruData=()=>n.getMruUrlSuggestionData(t,u);t.type=="HS"&&n.setExtraVerbs(t,()=>{let i=[{verb:"ManageSearchHistory",displayName:n.Host.getLocString("ManageSearchHistory"),executeSync:()=>n.Host.launchPrivacyPortalAsync(),icon:{content:"",type:2}}];return n.config.removeSuggUrl&&i.unshift({verb:"RemoveFromWebHistory",displayName:n.Host.getLocString("RemoveFromWebHistory"),executeSync:()=>o(t.text),icon:{content:"",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.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:"",type:2}:t.handoffType===13?{content:"",type:2}:t.handoffType===14?{content:"",type:1}:n.getSearchSuggestionIcon());t.primaryMetadata||t.secondaryIcon||t.htmlContent||t.additionalInfoText||(t.primaryMetadata=t.handoffType===13?n.Host.getLocString("SearchForWebImages"):t.handoffType===14?n.Host.getLocString("SearchForWebVideos"):n.getWebSuggestionAnnotation(n.msbEnabledForQuery(i)))}class e{constructor(t,i,r,u){this._navigationHelper=t;this._temporaryMessageHandler=i;this._accessTokenManager=r;this._previousKeystrokeCache=u;this.removeBingHistorySuggestionCallBack=t=>{this._accessTokenManager?this._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,i=>{if(i&&i.Token){let n={};n["X-Search-RPSToken"]=i.Token;this.sendRemoveBingHistorySuggestionRequest(t,n)}else n.logAuthRelatedInfo("getAccountOnFailure::OnlineSuggParser::removeBingHistorySuggestionCallBack","authenticate failed for MSA account.")},undefined,n.Host.isAuthInvestigation()?["OnlineSuggestionParser::removeBingHistorySuggestionCallBack"]: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("QS",t)&&f("QS",[],null);return}r&&r.ELToken&&(n.Host.setElToken(r.ELToken),r.LC==1&&n.Host.sendElToken());let h=[],c=[],l=[],s=[],a=[],v=n.isDataSourceEnabled("Web",t);if(n.safeExecute(()=>{for(let u of r.Suggestions){let f=u.Attributes,e=f.appId;if(e){c.push(u);e.split(";").forEach(t=>{n.contains(s,t)||s.push(t)});continue}let y=f.settingId;if(y){l.push(u);a.push(y);continue}if(v){let f=n.safeExecute(()=>this.parseOnlineSuggestion(t,u,i,r.Resources,o),"parseOnlineSuggestion");f&&h.push(f)}}},"parseOnlineSuggestions"),v){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};f("Web",h,e)}n.lookupById(t,"OSTMA",s,c,n=>n.Attributes.appId.split(";"),"QS",a,l,n=>n.Attributes.settingId,u,i,f,e,(n,u,f,e)=>this.parseIdLookupResponse(r,t,i,n,u,f,e),null,null,null,null)}parseIdLookupResponse(t,r,u,f,e,o,s){if(o.length!=1){let i=n.safeExecute(()=>this.parseOnlineSuggestion(r,f,u,t.Resources,e),"parseOnlineSuggestion "+e);i&&s.push(i);return}let h=t=>{let e=f.Attributes;return this.compliesWithMinVersion(e.appMinVersion,t.deviceItem.version)?(t.appContext=e.appContext,this.setRankingSignals(t,f),f.Text&&e.query&&(!n.isApp(t.type)||t.appContext)&&(t.text=f.Text,t.query=e.query),f.SecondaryText&&(t.primaryMetadata=f.SecondaryText),t.handoffType==5)?i(t,r,u,e.actionUri,e.taskFrame,parseFloat(e.confidence),parseInt(e.source)):!0:!1};n.safeExecute(()=>n.parseLocalSuggestion(r,o[0],e,u,this._temporaryMessageHandler,f.Attributes.stype,s,h),"parseLocalSuggestion "+e)}parseOnlineSuggestion(t,f,e,s,h){let c=f.Attributes,a=c.stype;if(a=="CS"||c.appId||c.settingId)return null;let v;v=c.isAnswer==="1"?c.url||c.vertical?n.verticalToHandoffType(c.vertical):10:c.taskFrame?c.actionUri.startsWith("action://FindMyStuff/")?4:5:a=="MD"||a=="ML"?1:n.verticalToHandoffType(c.vertical);let l=n.createSuggestion(t,f.Text,null,n.getIconFromOnlineResponse(f),a,c.query,n.InstrumentedItem.createInstrumentedItem(e,a),v,e,!1);if(l.primaryMetadata=f.SecondaryText,this.setRankingSignals(l,f),l.autoOpenPreviewPaneWhenOnTopHit=c.openPP==="1",c.isAnswer==="1"){if(!c.url&&!n.isCortanaEnabledCache)return null;l.signals=f.Signals;o(l,t,e,f.InstantAnswer,c.additionalInfoText,c.secondaryIconUrl,c.url,c.segments,c.taskFrame,s,this._navigationHelper);c.noHeightRestriction==="1"&&l.classNames.push("noHeightRestriction");l.reactKey=a+c.url}else if(c.taskFrame){if(!n.isCortanaEnabledCache||!i(l,t,e,c.actionUri,c.taskFrame,parseFloat(c.confidence),parseInt(c.source)))return null;l.reactKey=a+c.taskFrame}else{if(!c.url)return null;if(l.autoOpenPreviewPaneWhenOnTopHit=c.openPP==="1",l.reactKey=a+t.queryToFetch+c.url,l.type=="MD"||l.type=="ML"){let i=n.prettyPrintUrl(c.query,t.queryToFetch,!0);i!=l.query&&(l.query=i,l.text=t.queryToFetch?HitHighlightingParser.addMarkers(i,t.queryToFetch):i);l.primaryMetadata&&!l.primaryMetadata.includes(HitHighlightingParser.startMarker)&&(l.primaryMetadata=HitHighlightingParser.addMarkers(l.primaryMetadata,t.queryToFetch));u(l,t,e,c.url)}else{if(n.queryLooksLikeUrl(l.query))return null;r(l,t,e,c.url,this._navigationHelper,this.removeBingHistorySuggestionCallBack)}}if(!n.isValidSuggestion(l,"parseOnlineSuggestion"))return null;const k=["Actor","City","Place","Country","State","Animal","Attraction","Food","Artist","People"],d=["Song","TvShow","Movie"];let y=l.segments,p=y?y.split(","):[],w=p.some(t=>n.contains(k,t)),b=p.some(t=>n.contains(d,t));return(f.ChildSuggestions||w||b)&&(l.calculateChildSuggestions=()=>this.calculateRelatedSuggestions(l,t,f,h,w,b)),n.config.directNavPreviewPane&&l.type=="MD"&&l.url&&(l.getIcon=n.getFaviconUrlForRawUrl(l.url,64,64,1.5),l.previewPaneType=2),l}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;nu)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);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=e;n.adjustCasing=t;n.setCat1SuggestionProperties=i;n.setWebSearchSuggestionProperties=r;n.setUrlSuggestionProperties=u}(WSB||(WSB={})),function(n){function p(n){return n?[n]:[]}function rt(n){if(n){let t=n.lastIndexOf(".");if(t>=0)return n.substring(t)}return""}function ut(t){let i=t?new Date(t):null;return n.isValidDate(i)?i:null}function ft(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 r(t,r,u,e,o=false){if(!o&&e.extensionLC&&n.hideFileExtensionsCache){let i=e.extensionLC.length,t=e.query,u=t.toLocaleLowerCase();if(u.endsWith(e.extensionLC)){let f=r?HitHighlightingParser.addMarkers(t,r):t,o=n.config.disableSyntaxHighlight?r===""||!e.extensionLC.toLocaleLowerCase().startsWith("."+r.toLocaleLowerCase()):f.toLocaleLowerCase().endsWith(e.extensionLC);if(o){e.query=t.substring(0,t.length-i);let n=e.text.toLocaleLowerCase(),r=HitHighlightingParser.removeMarkers(n);if(u==r){let t=n.lastIndexOf(e.extensionLC);t>0&&(e.text=e.text.substring(0,t)+e.text.substr(t+i))}}}}if(e.lastModifiedDate&&(e.lastModifiedDateString=e.lastModifiedDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),e.lastAccessDate&&(e.lastAccessDateString=e.lastAccessDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),e.primaryMetadata=e.sourceForGroup&&e.sourceForGroup!=1?n.getGroupSourceDisplayName(e.sourceForGroup):e.itemTypeDisplayName,e.explanation?e.additionalInfoText=e.explanation:t.isSearchHomeZI&&(e.additionalInfoText=e.prettyPrintedPath||e.path),e.classNames=e.classNames.indexOf("fbig")>=0?["fbig"]:[],e.match){let t=(at(e.match.matchType)?n.Host.getLocString(n.MatchType[e.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(e.match.matchedText,r);e.additionalInfoText=t;e.secondaryMetadata=t;e.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")}else e.lastModifiedDateString&&n.RuntimeConfig.QfMode!=5&&(e.secondaryMetadata=n.Host.getLocString("LastModified")+": "+e.lastModifiedDateString);e.narratorText=n.getNarratorText(e);n.displayedInGridLayout(e.type)&&(u?e.classNames.push("bigIcon","biggerIcon"):e.classNames.push("bigIcon"));!o&&e.handoffType==2&&SearchAppWrapper.CortanaApp.copyToClipboard&&i(e,()=>[{verb:n.JumplistActionItemType[n.JumplistActionItemType.S_CopyFullPath],displayName:n.Host.getLocString("CopyFullPath"),executeSync:()=>SearchAppWrapper.CortanaApp.copyToClipboard(e.path,""),icon:{type:1,content:""}}],!1);let h={},s=e.prettyPrintedPath||e.path;if(s){let i=s.lastIndexOf("/");i<0&&(i=s.lastIndexOf("\\"));i<0&&(i=s.lastIndexOf(" > "));let t=s.substring(0,i);t.endsWith(":")&&(t=t+"\\");e.parentFolder=t;h[n.Host.getLocString("Location")]=[{text:t,click:()=>n.isUncOrLocalPath(t)?SearchAppWrapper.CortanaApp.launcher.startLaunchFolder(t):e.locationUrl?SearchAppWrapper.CortanaApp.launcher.launchUriAsync(decodeURI(e.locationUrl)):SearchAppWrapper.CortanaApp.launcher.launchUriAsync(t)}]}let c=n.nicerCloudFilesEnabled(t,e);e.tooltip=lt(e,c);for(let[t,i,r]of f){let u=e[r];u&&!t&&(h[n.Host.getLocString(i)]=[{text:u}]);e.previewMetadata=h}}function et(t,i,u){i.match||!u.match||i.parentFolderDisambig||(i.match=u.match,i.needsRefreshAfterDeduping=!0,i.previewPaneNeedsRefreshAfterDeduping=!0);for(let[,,n]of f){let t=u[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&&r(t,n.getEffectiveQuery(t),n.isL2(t),i,!0)}function ot(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 w(n){return n!=null&&(n.type==3||!!n.content||!!n.className)}function e(n,t,i=true){let r=n.mayContainPII;return n.text?n.query?!n.handoffType&&n.handoffType!==0?(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing handoff type")),!1):n.type?i&&!n.getIcon&&!w(n.icon)?(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing icon")),!1):!0:(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing suggestion type")),!1):(SharedLogHelper.LogError(t,r?"":n.text,new Error("Missing query")),!1):(SharedLogHelper.LogError(t,r?"":n.deviceItem?n.deviceItem.id:"",new Error("Missing text")),!1)}function i(t,i,r){let u=t.getExtraVerbs;t.getExtraVerbs=t=>{let f=u?u(t):[],e=i(t);return n.joinVerbs(f,e,r)}}function st(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 u(n,t){let r=n.propertyHits||[],i=r.indexOf(t);return typeof i=="object"&&i.returnValue!==undefined?i.returnValue:i>=0}function ht(n){if(n&&typeof n=="object"&&n.length){let t="";for(let i=0;iht(t.getProperty(i)),"get"+i,undefined,r)}function ct(t,i,...r){for(let[f,i,e]of r)if(i&&u(t,e))return n.createMatch(f,i);return null}function lt(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,e=()=>{r&&(r+="\n"),u&&(r+="\n",u=!1)};for(let[o,s,u]of f)if(!i||u!="lastModifiedBy"||!t.lastModifiedDateString){let f=t[u];f&&(!o||i)&&(e(),i&&u=="lastModifiedDateString"&&t.lastModifiedBy&&(f=n.Host.getLocString("LastModifiedCombined",f,t.lastModifiedBy)),r+=n.Host.getLocString(s)+": "+f)}return t.explanation&&t.meeting&&(r=HitHighlightingParser.removeMarkers(t.explanation)+"\n\n"+r),r}function at(t){switch(t){case n.MatchType.Author:case n.MatchType.LastModifiedBy:case n.MatchType.Tags:case n.MatchType.Genre:case n.MatchType.Album:case n.MatchType.Artist:return!0;case n.MatchType.Content:case n.MatchType.Location:return!1;default:throw new Error("Unknown match type: "+t);}}function yt(t,i,r,u,f,e,o,s,h,c,l,a,v,y,w,b,k,d){i&&n.isDataSourceEnabled(i,t)&&n.LocalDataProvider.getApps(r,t=>{if(c()){n.InstrumentationHelper.instrumentResponseReceived(l,i,null,0,!1,!1);let r=[];for(let e of u)n.safeExecute(()=>y(e,i,f(e).map(n=>t[n]).filter(n=>!!n),r),"parseApp "+i);a(i,r,null)}},v,i);e&&n.isDataSourceEnabled(e,t)&&n.LocalDataProvider.getSettings(o,t=>{if(c()){n.InstrumentationHelper.instrumentResponseReceived(l,e,null,0,!1,!1);let r=[];for(let u of s)n.safeExecute(()=>y(u,e,p(t[h(u)]),r),"parseSetting "+i);a(e,r,null)}},v,e);w&&n.isDataSourceEnabled(w,t)&&n.LocalDataProvider.getFiles(b,t=>{if(c()){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(l,w,null,0,!1,!1);let i=[];for(let r of k)n.safeExecute(()=>y(r,w,p(t[d(r)]),i),"parseFile "+w);a(w,i,null)}},t,v,w)}function pt(t){return n.EdgeAppIds.some(n=>t.id==n)?n.Host.getLocString("MicrosoftRecommendedBrowser"):(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(44571814))&&(n.DMAConsentAppIds.some(n=>t.id==n)||t.isSystemApp)?n.Host.getLocString("SystemApp"):n.Host.getLocString("App")}function wt(t){return n.isModernSetting(t)?n.Host.getLocString("SystemSettingsAnnotation"):n.Host.getLocString("ControlPanelAnnotation")}function bt(t){return n.isFileOrFolder(t.type)?t.deviceItem:null}function kt(t,u,f,e,o,s){let h=n.getAppItem(o);if(h){e&&b(o,h);o.primaryMetadata=pt(h);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";o.type=="IBA"&&(o.tooltip=h.id,o.path=h.id);return}if(n.isSetting(o.type)){o.primaryMetadata=wt(o.deviceItem);o.narratorText=n.getNarratorText(o);o.tooltip=t.isSearchHomeZI?o.text:"";return}if(o.type=="LURL"&&(h=o.deviceItem,h)){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=bt(o);if(c){dt(t,u,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"){k(o);return}let e=gt(i);if(e){n.itemTypeDisplayName=e;r(t,u,f,n);return}o.type=="CG"&&k(o);return}if(o.type=="FEH"){if(o.narratorText=n.getNarratorText(o,n.Host.getLocString("SearchHistorySuggestion")),u&&(o.text=HitHighlightingParser.addMarkers(o.text,u)),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:"",type:2}};i(o,()=>[t],!1)}return}throw new Error("Unexpected type: "+o.type);}function dt(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&&b(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),u(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),u(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"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 r=n.config.disableSyntaxHighlight?!h.text.startsWith(n.Host.getQuery().queryToFetch)&&f:!h.text.includes(HitHighlightingParser.startMarker)&&f;if(r){let r,e=s!="LM"&&s!="FL";if(e&&(s=="MFF"?(r=t(c,"System.Title",s),r&&!n.matchesOnPropertyHH(r,f)&&(r=undefined)):u(c,"System.Title")&&(r=t(c,"System.Title",s))),r)h.text=HitHighlightingParser.addMarkers(r,f);else if(i)h.match=i;else{let t=n.IndexerQueryGenerator?"System.Music.DisplayArtist":"System.Music.Artist";h.match=ct(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"])}}}r(i,f,e,h);ni(h)}function b(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 gt(n){if(n.launchArguments)return null;let t=n.itemTypeDisplayName;return t&&t[0]!="."?t:null}function o(t){let i=[];for(let r=0;ri[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 k(t){t.primaryMetadata=n.Host.getLocString("RunCommandPrompt");t.classNames.push("action");t.narratorText=n.getNarratorText(t)}function d(t,i,r,u,f,o,s,h){let y=n.localDataSourceMayContainPII(r);if(!o){let n=i.deviceItem.kind;SharedLogHelper.LogError("parseLocalSuggestion"+r,y?"":i.deviceItem.displayName||i.deviceItem.id,new Error("Unrecognized kind: "+n));return}let p=o=="LURL"?1:2;if(n.isSuggestionTypeEnabled(r,o,p,t)){let a=n.getEffectiveQuery(t),v=i.deviceItem.displayName,w=v&&a?HitHighlightingParser.addMarkers(v,a):v,c=n.createSuggestion(t,w,i.getIcon,i.icon,o,v,n.InstrumentedItem.createInstrumentedItem(u,o),p,u,y);c.uxHint=ui(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&&ti(t,c,l,f,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=()=>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});else{let t=n.getCommandLineItem(c);t&&(c.hc=n.isRealCommand(c,t))}let b=n.getGroupType(c);n.shouldSetThisPcGroupSource(b,t)&&(c.sourceForGroup=1);kt(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);e(c,"parseLocalSuggestion "+r)&&h(c)&&s.push(c)}}function ni(t){i(t,()=>{if(t.duplicates){let i=t.duplicates.find(n=>n.handoffType==7||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:""}}),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:""}}),t}}return[]},!0)}function g(t,i){return!n.config.enableFallbackIconsForJumpLists||!y[t]?!1:n.contains(y[t],i)}function ti(t,r,u,f,e,o){let l=u.id,y=u.filePath,h;if(!n.config.forceAllJumplists){if(h=n.config.enableJumplistRestrictions&&tt[l],!h&&y){let t=y.toLowerCase();for(let n in v)if(t.includes(n)){h=v[n];break}if(!h&&n.config.enableJumplistRestrictions)for(let n in a)if(t.includes(n)){h=a[n];break}}if(h&&h.length==0)return}(n.RuntimeConfig.AlwaysWide||!it.find(n=>n==l))&&(r.calculateChildSuggestions=()=>ii(t,l,y,r,u,h,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=g(r.deviceItem.id,n.groupType)?r.getIcon:s(n.jumpListItem,n.parent,!1,l),o={verb:"JumpListTask_"+l+"_"+n.text,displayName:n.text,executeSync:()=>c(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_"+l+"_"+r,displayName:n.text,executeSync:()=>c(u,n,f),getIcon:s(n.jumpListItem,n.parent,!0,l)};i.push(o)})}return i},!0))}function ii(t,i,r,u,f,l,a,v,y){u.calculateChildSuggestions=null;let b=f.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(!l||n.contains(l,r.type)){let o=h(r.type),y=o!=n.GroupType.JumpListTasks;for(let l of r.items)if(!nt(l)){let d=g(u.deviceItem.id,h(r.type))?u.getIcon:s(l,u,y,i),k="JL",b=n.createSuggestion(t,l.displayName,d,null,k,l.displayName,n.InstrumentedItem.createInstrumentedItem(v,k),2,u.sequenceNumber,y,null,null,!0);b.click=()=>c(f,b,a);b.jumpListItem=l;b.groupType=o;b.groupDisplayName=r.name;b.parent=u;b.tooltip=l.description;let tt=w&&l.path.endsWith(w);tt||(b.path=l.path);e(b,"calculateJumpListSuggestions")&&(p.push(b),ri(f,b,a))}}p.length>0&&(u.childSuggestions=u.childSuggestions?u.childSuggestions.concat(p):p,o(p),n.InstrumentationHelper.instrumentDataSource(v,y,p,null))}}function s(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 nt(t){return t.displayName?!n.RuntimeConfig.AlwaysWide&&n.olderThan2Weeks(t.lastAccessed)?!0:!1:!0}function h(t){switch(t){case 0:return n.GroupType.JumpListTasks;case 1:return n.GroupType.JumpListPinned;case 2:return n.GroupType.JumpListRecent;case 3:return n.GroupType.JumpListFrequent;default:return n.GroupType.JumpListCustom}}function c(t,i,r){n.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:()=>{l(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable1")}}]):(r.showTemporaryMessage(n.Host.getLocString("JumpListItemUnavailable")),l(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable2"))})}function l(t,i,r){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=>h(n.type)==i.groupType&&n.items.some(n=>!nt(n)))?u():(n.Host.refreshCurrentPane(),r.showTemporaryMessage(n.Host.getLocString("RemovedFromList",i.text)))},u)},u)}function ri(t,r,u){r.jumpListItem.deleteAsync&&i(r,()=>{let i={verb:"RemoveFromThisList",displayName:n.Host.getLocString("RemoveFromThisList"),executeSync:()=>l(t,r,u),icon:{type:2,content:""}};return[i]},!0)}function ui(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 tt={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},a={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},v={"\\msedge.exe":[0]},it=["Microsoft.Windows.Explorer",],f=[[!0,"LastAccessed","lastAccessDateString"],[!1,"LastModified","lastModifiedDateString"],[!1,"LastModifiedBy","lastModifiedBy"],[!1,"Author","author"],[!1,"Artist","artist"],[!1,"Album","album"],[!1,"Genre","genre"],[!1,"Tags","tags"],],y={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[n.GroupType.JumpListTasks],"Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks],"Microsoft.XboxApp_8wekyb3d8bbwe!Microsoft.XboxApp":[n.GroupType.JumpListCustom],"com.squirrel.Teams.Teams":[n.GroupType.JumpListTasks],"Microsoft.ScreenSketch_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks]};n.getFileExtension=rt;n.toDate=ut;n.getTodayTimeString=ft;n.setFileTemplate=r;n.enrichMetadataFromDuplicate=et;n.getIconForTypeAsync=ot;n.isValidIcon=w;n.isValidSuggestion=e;n.setExtraVerbs=i;n.setExtraVerbsAsync=st;class vt{constructor(n){this._temporaryMessageHandler=n}parse(t,i,r,u,f,e){let s=[];for(let f of u.suggestions)n.safeExecute(()=>d(t,f,r,i,this._temporaryMessageHandler,f.suggestionType,s,()=>!0),"parseLocalSuggestion "+r);(n.isFileOrFolderLocalDataSource(r)||r=="IBA")&&o(s);let h={maxedOut:u.maxedOut};e(r,s,h)}}n.SuggestionsParser=vt;n.lookupById=yt;n.decorateSuggestionsWithParentFolder=o;n.parseLocalSuggestion=d}(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 o=this.safeGetLastUrl(r),l=this.safeGetUrlResult(r),a=n.getWindowHost().toLowerCase(),p=a=="bing.com"||a.endsWith(".bing.com");if(!p&&!(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.isTest))return;let v=n.LightweightStorage.getItem(i.LastCIDownloadAttemptKey),s=null;if(v&&(s=new Date(v)),s&&(this.getTimeDiffInMins(s)0&&n.config.supportedCiMarkets[h]&&(h!=f.language||u>f.version||y||w)&&(!e.url||y||o==e.url||e.errorCode!="00000000")){let f="cis_v"+u,e="ci_v"+u,h=n.LightweightStorage.getItem(f)?parseInt(n.LightweightStorage.getItem(f)):0,a=n.LightweightStorage.getItem(e)?parseInt(n.LightweightStorage.getItem(e)):0;n.LightweightStorage.setItem(i.LastCIDownloadAttemptKey,n.getCurrentDate().toString());const s="constraintIndexDownloader.tryDownloadFromUrlAsync";n.Async.safeChain(s,()=>r.tryDownloadFromUrlAsync(c),i=>{if(i){let i=this.getContstraintIndexInfo(o);t.currentCIVersion=String(i.version);h++;n.LightweightStorage.setItem(f,h.toString())}else SharedLogHelper.LogError(s,"urlResult: "+l,"Download failed");a++;n.LightweightStorage.setItem(e,a.toString())},n=>{SharedLogHelper.LogError(s,`onError - url: ${c}`,n.message)},null,c,0)}}})}parseUrlResult(n){let i=null,t=null,r=1;if(n){let u=n.split(":0x");if(u.length>1){i=u[0];t=u[1];t!="00000000"&&SharedLogHelper.LogWarning("constraintIndexDownloader.urlResult",t,"Download encountered problems");let n=this.getContstraintIndexInfo(i);r=n.version}else SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","urlResult: "+n,"Invalid URL")}else SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","No urlResult");return{url:i,version:r,errorCode:t}}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="https://www.bing.com/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="https://www.bing.com/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"https://www.bing.com/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){function u(n){switch(n.type){case"Folder":return"FD";case"Photo":return"LI";case"Video":return"LV";case"Audio":case"Music":return"MU";default:return n.fileSize?"FL":"FD"}}function h(t){switch(t){case"FD":return n.Scope.Folders;case"LI":return n.Scope.Photos;case"LV":return n.Scope.Videos;case"MU":return n.Scope.Music;default:return n.Scope.Documents}}const t="https://onedrive.live.com",i=t+"/redir.aspx?resid=",f="&ancestorId=",e="&contentMatch=",r="OneDrive provider called without {0}",o=621355968e5;class s extends n.JsonDataProvider{getName(){return"OneDriveDataProvider"}constructor(n){super("ODC");this._accessTokenManager=n}addOneDriveAncestorResourceIdQueryString(){if(n.RuntimeConfig.QfMode==5&&!n.isFileExplorerCurrentPathThisPcOrQuickAccess){let t,i=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri?n.tryParseUrl(SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri,!1):null;if(i&&i.parameters&&(t=i.parameters.substr(1).split("&").find(n=>n.startsWith("id=")).substr(3)),t)return f+t;SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootResourceId"])))}return""}addOneDriveContentMatchQueryString(t){return n.RuntimeConfig.QfMode==5||t.scope==n.Scope.Documents?e+"1":""}createUrl(t){let i=decodeURIComponent(n.config.oneDriveDotComRootUrl);i+=this.addOneDriveAncestorResourceIdQueryString();i+=this.addOneDriveContentMatchQueryString(t);let r=t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"";return i+"&q="+r}getAllAccountTokens(t){let i=n.Host.isAuthInvestigation()?["OneDriveDataProvider::getAllAccountTokens"]:undefined;if(n.RuntimeConfig.QfMode==5){let u=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootAccount;u?this._accessTokenManager.getAccountByUserName(!1,0,u,!1,!0,n=>{n&&n.Token?t([n.Token]):t(null,"AccountNotFound")},i):n.isFileExplorerCurrentPathThisPcOrQuickAccess?this._accessTokenManager.getAllSyncingAccounts(!1,0,!1,!0,n=>{n.length>0?t(n.map(n=>n.Token)):t(null,"NoAccountsFound")},i):(SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootAccount"]))),t(null,"CurrentSyncRootAccount"))}else n.AccessTokenManager.getWindowsAccountType()==2?this._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,n=>{n&&n.Token?t([n.Token]):t(null,"NoAccountsFound")},undefined,i):t(null)}fetch(t,i,r,u,f,e,o){if(n.isDataSourceEnabled(this._dataSource,t)){let s={numOfPendingResponses:0};o||(o={});o["BingAPIs-Authorization-Source"]="Explicit";let h=h=>{let l=Object.assign({},o);h&&(l["X-Search-RPSToken"]=h);let c=Object.assign({},e);delete c[n.Service.QueryParams.ImpressionGuid];delete c[n.Service.QueryParams.RequestElToken];super.fetch(t,(n,t,r,u,f)=>{--s.numOfPendingResponses,i(n,t,r,u,f,s.numOfPendingResponses!=0)},r,u,f,c,l)};this.getAllAccountTokens((n,t)=>{t?i(this._dataSource,null,t,null,null,!1):n?(s.numOfPendingResponses=n.length,n.forEach(n=>h(n))):(s.numOfPendingResponses=1,h(null))})}}}n.OneDriveDataProvider=s;class c{constructor(){}parse(t,i,r,u,f,e){let o=[];if(u&&u.suggestionGroups)for(let n of u.suggestionGroups)if(n.searchSuggestions)for(let r of n.searchSuggestions)this.addContent(t,o,r,i);n.decorateSuggestionsWithParentFolder(o);e("ODC",o,null)}isValidSuggestion(n){return!n.result||n.result.length!=1?!1:n.result[0].type==="History"?(SharedLogHelper.LogError("OneDriveParser",null,new Error("History should be disabled in the request URL")),!1):n.result[0].type==="Tag"?!1:!0}addContent(r,f,e,s){if(this.isValidSuggestion(e)){let l=e.result[0],a=u(l);if(n.isSuggestionTypeEnabled("ODC",a,7,r)){let v=l.rawResourceId,w="https://storage.live.com/items/"+v+":Cropped176x176#h=176&w=176",p=n.ScopeConfig[h(a)].icon,y=a=="FD"?"":n.getFileExtension(l.path),b=this.getOneDriveSuggestionIcon(n.isMedia(a),p,w,y,v),c=n.createSuggestion(r,e.displayText,b,p,a,e.query,n.InstrumentedItem.createInstrumentedItem(s,a),7,s,!0);c.url=i+v;c.path="OneDrive:\\"+l.path.slice(1).replace(/[/]/g,"\\");c.extensionLC=y?y.toLocaleLowerCase():undefined;let k=+l.dateModified/1e4-o;c.lastModifiedDate=n.toDate(k);c.sourceForGroup=2;n.setFileTemplate(r,n.getEffectiveQuery(r),n.isL2(r),c);c.click=()=>n.Host.launchUriAsync(c.url);c.locationUrl=l.parentFolder&&l.parentFolder.id?i+l.parentFolder.id:t;c.reactKey=this.generateReactKey(l);n.setExtraVerbs(c,()=>{let t={verb:n.JumplistActionItemType[n.JumplistActionItemType.S_OpenFileLocationInBrowser],displayName:n.Host.getLocString("OpenFileLocationIn",n.getGroupSourceDisplayName(2)),executeSync:()=>n.Host.launchUriAsync(c.locationUrl),icon:{type:2,content:""}};return[t]},!0);n.isValidSuggestion(c,"OneDriveParser")&&f.push(c)}}}generateReactKey(n){return u(n)+n.path+n.rawResourceId}getOneDriveSuggestionIcon(t,i,r,u){return n.getIconForTypeAsync(i,u)}}n.OneDriveParser=c}(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=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(t,i,u,o){f=[];let s;if(i.length==0)throw new Error("DialogBox: Empty buttons array");f=i.map((n,t)=>{let i=n;return i.id="dialog_b"+t,i.narratorText=i.text,i.selected&&(s=i.id),i});let h={isVisible:!0,title:u,messageText:t,buttons:f,isModal:o};e.updateDialogBox(h);s&&n.safeSetTimeout(()=>_ge(s).focus(),0,"DialogBox.show");n.Host.setFocusInWebView("dialogBoxViewModel");r=!0}function u(){if(r)e.updateDialogBox({isVisible:!1}),r=!1}function o(){return r}function i(){return f}function a(){return i().map(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 y(n){return n.includes("form=vsranf")}function p(t){let i=n.tryParseUrl(t,!0);return!!i&&/[\?\&]q=/i.test(i.parameters)&&!/[\?\&]view=detail/i.test(i.parameters)}function ii(t){let i=n.tryParseUrl(t,!0);return!!i&&kt.test(i.parameters)}function ri(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 w(n){switch(n){case 1:return 1;case 2:return 7;case 3:return 8;default:throw Error("Unsupported vertical: "+n);}}function b(t){let i=n.tryGetBingPathLC(t);return i?n.contains(wt,i)?2:n.contains(bt,i)?3:n.contains(n.WebSearchPaths,i)?1:null:null}const u=["bfbVerticalConfig","bfbTenantSettings","bfbUserConfigs","bfbSubstrateUnifiedSearch"],o=["bfbTenantSettingsFailed","bfbUserConfigsFailed","bfbSubstrateUnifiedSearchFailed"],h=n.PreviewPaneWidth-24,d="miniserp_focus",g="disableOutline",i=2,nt=["tab-active","slide"],tt=["aria-expanded"],it="videoPreview",rt=300,f=30,ut="IsSearchAppXYFocusEnabled",ft="WinJS",et="dFocusExit",t="win-xyfocus-suspended",ot="Rewards.ReportActivity.Success",st="Rewards.ReportActivity.Failure";n.MiniSerpIframeId="miniIframeSerp";n.MiniSerpFetchEvent="miniSERP.Fetch";n.MiniSerpLoadedEvent="MiniSerpContentLoaded";n.MiniSerpClearingEvent="MiniSerpContentClearing";const ht=["/account/","/settings.aspx"],r=function(){let n={};return n[37]="left",n[39]="right",n[38]="up",n[40]="down",n}(),ct=1e4,lt=800,s=535,c=580,l=150,at=439,vt=441,yt=100,pt=["&form=s00037&"],wt=["/images/search","/images"],bt=["/videos/search","/videos"],kt=/[\?\&]FORM=HDRSC[1-3]/i,e="ClientInst",a="wsbpf",dt="wsbPrefetchGuid",v="inprocess",gt="wsbstoploadingscreen",ni="wsbstoprequeryloadingscreen",ti="chat_clickthrough";class ui{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.bindShown(()=>{ThresholdUtilities.getCortanaHeaders(n=>{n&&n["X-BM-DeviceScale"]&&(this._deviceScale=+n["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(ot,([,n])=>{this._msRewardsViewModel.notifyPointsRewarded(n)}),sj_evt.bind(st,([,n])=>{SharedLogHelper.LogError("RewardsReportActivityFailureEvent",null,n?new Error(n):null)}))}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._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()}),n.config.enableChatButtonInMiniserp&&this._footer.classList.add(ti));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==et){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="";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(n){var t;if(this._iframe){const i=this._iframe.contentWindow;if(i&&((t=i.BingAtWork)===null||t===void 0?void 0:t.miniSerpDestroyLogger)){try{i.BingAtWork.miniSerpDestroyLogger(n)}catch(r){n()}return}}n()}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._seeAllResults.innerText=n.Host.getLocString("ChatWithBingAI");else switch(t){case 1:this._seeAllResults.innerText=n.Host.getLocString("OpenResultsBrowser");break;case 2:this._seeAllResults.innerText=n.Host.getLocString("SeeAllImageResults");break;case 3:this._seeAllResults.innerText=n.Host.getLocString("SeeAllVideoResults");break;default:throw new Error("Unsupported vertical type: "+t);}this._currentVertical=t}}instrumentOnPreviewPaneRendered(n,t){if(this._timestampFirstRender&&this._onPreviewPaneRendered){let i={firstRenderTS:this._timestampFirstRender};this._onPreviewPaneRendered(t,!n,i)}}update(t,i,r,u,f,e){var h,c;this._onPreviewPaneErrored=e;this._currentSuggestion=t;let s;if(n.isThirdPartySearchAllowed()&&i.scope==n.Scope.ThirdPartyWeb&&(s=(h=t.previewPaneUrl)!==null&&h!==void 0?h:""),(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}if(this._currentHandoffType=t.handoffType,(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(t.handoffType))&&this._iframe){const r=this._iframe.contentWindow;if(r&&((c=r.BingAtWork)===null||c===void 0?void 0:c.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=`${ni}${e}`;this.handleLoadingStateEvent(i);u.isRequery=!0;u.loadingStateEventKey=i;r.BingAtWork.workVerticalNavClickHandler(u);this.updatePreviousState(t,f);return}}}this.updatePreviousState(t,f);let l=t.type=="MB"&&t.segments=="Organization"?null:t.baseSearchUrl,y=ri(t.handoffType);if(this.setVertical(y),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,l,t.handoffType,undefined,undefined,undefined,undefined,t.msbVerticalHash);s?n.Host.launchThirdPartyUriWithProtocolAsync(s,(u=i.thirdPartySearch)===null||u===void 0?void 0:u.protocol):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,l,t.handoffType,undefined,undefined,undefined,undefined,t.msbVerticalHash),!1);this._previewPaneViewModelParent.onAfterItemLaunch(3)}),n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.noSerp){this.renderIframe(null,"<\/body><\/html>",{},undefined,!1);let t=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(t);return}const a=r==0,v=SearchAppWrapper.CortanaApp.entryPoint=="WNSHVR",p=v?"WMSHVA":n.mapOSFormCode("WMSRPA"),w=v?"WMSHVM":n.mapOSFormCode("WMSRPM"),b=a?p:w;let o=this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,l,t.handoffType,b,!0,null,a,t.msbVerticalHash);if(o+="&qfig="+n.InstrumentationHelper.getImpressionGuid(n.SequenceNumberManager.getSequenceNumber()),this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&(o+="&rewards=1"),i.serpURLParams)for(let n in i.serpURLParams)o=ThresholdUtilities.setUrlParameter(o,n,i.serpURLParams[n]);this._previousURLs=[];this.downloadAndDisplayMiniSerp(t,o,null,r,s)}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(e,"MiniSERPRenderTimeout",n.SequenceNumberManager.getSequenceNumber(),i)}miniSerpErrorInstrumentation(t,i,r){let u;u=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(e,"MiniSERPError",n.SequenceNumberManager.getSequenceNumber(),u)}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;tn.Host.launchUriAsync("ms-settings:troubleshoot")}):r.push({text:i[t]});let o={isOnline:f,previewPaneTitle:u,previewPaneItems:r,fullPartialQuery:t,narratorMessage:u};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{if(this._shouldRenderMiniSerp)sb_ct(this._ppMiniSerpRenderTimer),this._ppMiniSerpRenderTimer=null,this._shouldRenderMiniSerp=!1;else return;this.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelCallback");let f=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(f);u.status==200&&u.responseText?(this._previousURLs.push(i),this.renderIframe(i,u.responseText,e,o,!!r)):(n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber()),this.miniSerpErrorInstrumentation("renderErrorMessage",f,u),this.renderErrorMessage(t.query))};this._ppMiniSerpRenderTimer&&(sb_ct(this._ppMiniSerpRenderTimer),this._ppMiniSerpRenderTimer=null);this._shouldRenderMiniSerp=!0;let a=(n.config.miniSERPRequestRetries+1)*n.config.miniSERPRequestTimeout+1e3;if(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))},a,"ppMiniSerpRenderTimer"),t.scope==n.Scope.ThirdPartyWeb&&f){this.fetchMiniSerpUrl(f,null,null,c,s,n.config.miniSERPRequestRetries,!0);return}this.fetchMiniSerpUrl(i,r?r.data:null,e,c,s,r?0:n.config.miniSERPRequestRetries)}fetchMiniSerpUrl(t,i,r,u,f,o,s){let h=u;o>0&&(h=i=>{if(i.result==0&&i.responseText)u(i);else{let s={Url:t,StatusCode:i.status.toString(),Timeout:n.config.miniSERPRequestTimeout.toString(),RetriesRemaining:o.toString()};n.InstrumentationHelper.logClientInstEvent(e,"MiniSERPRefetch",n.SequenceNumberManager.getSequenceNumber(),s);this.fetchMiniSerpUrl(t,null,r,u,f,o-1)}});n.config.isThemeAware&&n.isDarkModeEnabled()&&!t.includes("&darkschemeovr=1")&&(t+="&darkschemeovr=1");!n.config.useCobaltCSS||t.includes("addfeaturesnoexpansion=wsbcobalt")||s||(t+="&addfeaturesnoexpansion=wsbcobalt");n.fetchUrl(t,r,i,h,null,()=>f==this._previewRequestId,!0,i?undefined:n.config.miniSERPRequestTimeout)}renderIframe(n,t,i,r,u){this.clearContent(()=>{this.renderIframeContent(n,t,i,r,u)})}renderIframeContent(t,i,r,u,f){this._iframe=sj_ce("iframe",n.MiniSerpIframeId);this._iframe.setAttribute("scrolling","no");this._contentContainer.appendChild(this._iframe);let o=this._iframe.contentWindow,e=this._iframe.contentDocument,h=!1;const s=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isWorkScope(this._currentHandoffType);this._footer&&!n.config.disableMiniserpButton&&(n.setVisibility(this._footer,!f),n.setVisibility(this._mask,!f));this.setIframeHeight(0);this._onIFrameLoadedCallback=()=>{s&&(this.handleWorkResultsSize(),this.handleWsbPrefetch(),this.handleLoadingStateForWorkScope());let i=e.body,f=0;if(this._calculateIFrameHeight=()=>{let n=i.offsetHeight;n!=f&&n>0&&(f=this.setIframeHeight(n,s))},this._calculateIFrameHeight(),this.overrideAjaxCalls(o,r,u),this.captureNavigationsAndSizeEvents(t,i,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(e.getElementById("images"),t):this._currentVertical===3&&this._mutationObserver.observe(e.getElementById("video"),t)},"onIFrameLoadedCallback")}this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&o.sj_rra&&o.sj_rra(t);this._timestampFirstRender=n.getCurrentTime();this.instrumentOnPreviewPaneRendered(!0,!1)};this._iframe.onload=()=>{if(s&&(this._scrollArea.scrollTop=0,this.clearWsbPrefetchStorage(),this.stopLoadingScreen()),h){this.tryLaunchUrl(t,o.location.href,0);return}h=!0;this.overrideAjaxCalls(o,r,u)};e.open();e.write(i);e.write("");e.write("