class ReimagineSOUtils{static querySelectorDeep=(selector,rootNode=document.body,deep=false)=>{const results=this.querySelectorAllDeep(selector,rootNode,deep,false);return Array.isArray(results)&&results.length?results[0]:results};static querySelectorAllDeep=(selector,rootNode=document.body,deep=false,all=true)=>{if(!selector)return null;if(!deep){return all?Array.from(rootNode.querySelectorAll(selector)):rootNode.querySelector(selector)}const results=[];const traverser=node=>{if(!all&&results.length)return;if(node.nodeType!==Node.ELEMENT_NODE)return;if(node.matches(selector)){results.push(node);if(!all)return}for(const child of node.children){traverser(child)}if(node.shadowRoot){for(const shadowChild of node.shadowRoot.children){traverser(shadowChild)}}};traverser(rootNode);return all?results:results.length?results[0]:null}} /*! 1113728 - Reconcile recordClick on shadow-DOM vs light-DOM actionables */ (function reconcileRecordClickListeners(){let EVENTS=["AfterProcess-ReimagineButton","AfterProcess-ReimagineLink"];let TAGS=["reimagine-button","reimagine-link"];function getUtils(){return window.reimagineTelemetry&&window.reimagineTelemetry.utils}function deepFindActionable(root){if(!root)return null;if(root.tagName==="A"||root.tagName==="BUTTON")return root;if(root.shadowRoot){let r=deepFindActionable(root.shadowRoot);if(r)return r}let children=root.children||[];for(let i=0;i{const domains={"azure.microsoft.com":"cn33fv2fqq"};const storeClarityId="rcwvv0hsnp";const sites=[["ai","fklpdhl3lg"],["customers","nqgr9bv86z"],["dynamics-365","56ntj8n5ti"],["education","qbw8y1v5xr"],["evalcenter","co915hf5d5"],["events","bx9lrsl3v8"],["fasttrack","co87mqlj22"],["flexibility","8j710qd1zy"],["frontier-company","x92qftvsp3"],["health-solutions","qch4fin049"],["hololens","8j7188n0nf"],["industry","8j70sts7ed"],["isv","co8cdtj65f"],["marketplace","sxijn6d0cr"],["mesh","8j7188n0nf"],["microsoft-365","8qumfcbe49"],["microsoft-365-copilot","8qumfcbe49"],["microsoft-cloud","8rugvc69mo"],["microsoft-copilot","jf75j84chi"],["microsoft-fabric","gnlfnng0p8"],["microsoft-learn","gxa46mx9ho"],["microsoft-loop","co87wrbsd6"],["microsoft-teams","8j6z5n8me5"],["microsoft-viva","8j70e2bszm"],["power-platform","69q536qdr1"],["security","8j70lgy2cr"],["software-development-companies","r2mqwu0t85"],["sovereignty","v9s43lmegt"],["sql-server","8j71hxh8mv"],["startups","h9oep2750d"],["store",storeClarityId],["sustainability","co90igj0k6"],["system-center","8ruh2qg98n"],["trust-center","8j70lgy2cr"],["us-government","v9s516swgw"],["windows-365","8j705rlc54"],["windows-server","8ruh98y350"]];const sitePathPattern=String.raw`\/([a-z]{2}|[a-z]{2}-[a-z]{2}|[a-z]{2}-[a-z]{4}-[a-z]{2})\/%SECTION%(\/$|\/.*|$)`;const regexList=sites.map(([section,id])=>[new RegExp(sitePathPattern.replace("%SECTION%",section.replace(/-/g,"\\-")),"i"),id]);const homepagePattern=/^\/([a-z]{2}|[a-z]{2}-[a-z]{2}|[a-z]{2}-[a-z]{4}-[a-z]{2})\/?$/i;function getClarityId(){const host=window.location.hostname;if(domains[host]){return domains[host]}const urlPath=window.location.pathname;for(const[regex,id]of regexList){if(regex.test(urlPath)){return id}}if(host==="www.microsoft.com"&&homepagePattern.test(urlPath)){return storeClarityId}return null}const waitForWcpConsentObj=(maxRetries=100,interval=50)=>{return new Promise((resolve,reject)=>{let retries=0;const checkWcpConsent=setInterval(()=>{if(window.WcpConsent&&window.WcpConsent.siteConsent){clearInterval(checkWcpConsent);resolve()}else if(retries>=maxRetries){clearInterval(checkWcpConsent);reject(new Error("WcpConsent object not found within the expected time"))}retries++},interval)})};function isWcpConsentPresent(){return typeof WcpConsent!=="undefined"&&WcpConsent&&typeof WcpConsent.siteConsent!=="undefined"&&WcpConsent.siteConsent}function isGpcOptInPresent(){return typeof GPC_DataSharingOptIn!=="undefined"&&GPC_DataSharingOptIn!=null}function isConsentRequired(){if(isWcpConsentPresent()&&WcpConsent.siteConsent&&WcpConsent.siteConsent.isConsentRequired!==undefined&&WcpConsent.siteConsent.isConsentRequired!==null){return WcpConsent.siteConsent.isConsentRequired}return true}function isConsentGranted(userConsent){return userConsent&&userConsent.Advertising&&userConsent.Analytics&&userConsent.SocialMedia}function getUserConsent(){if(WcpConsent&&WcpConsent.siteConsent&&0!==Object.keys(WcpConsent.siteConsent).length){return WcpConsent.siteConsent.getConsent()}return undefined}function checkUserConsent(){var userConsent=getUserConsent();return isConsentGranted(userConsent)}const loadClarity=()=>{const clarityId=getClarityId();if(!clarityId){console.warn("Clarity not loaded: No matching Clarity project for this site");return}(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);t.id="oc-clarity-script-1092966"})(window,document,"clarity","script",clarityId)};await waitForWcpConsentObj().then(()=>{if(isGpcOptInPresent()&&GPC_DataSharingOptIn===true&&(!isConsentRequired()||checkUserConsent())){loadClarity();console.log("Clarity loaded")}else{console.log("Clarity not loaded due to lack of user consent")}}).catch(error=>{console.error("Error loading Clarity:",error)})})(); /*! ticket 1093350 */ (()=>{document.addEventListener("DOMContentLoaded",()=>{const featuredElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-featured");featuredElements.forEach(featuredElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(featuredElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineFeatured")})});const allElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"[data-bi-compnm]");allElements.forEach(elem=>{const compnmValue=elem.getAttribute("data-bi-compnm");if(compnmValue&&compnmValue.includes("-")){const pascalCaseValue=compnmValue.split("-").map(word=>{return word.charAt(0).toUpperCase()+word.slice(1)}).join("");elem.setAttribute("data-bi-compnm",pascalCaseValue)}});const bannerFeaturedElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-banner-featured");bannerFeaturedElements.forEach(bannerElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(bannerElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineBannerFeatured")})});const carouselCardGridElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-carousel-card-grid");carouselCardGridElements.forEach(carouselElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(carouselElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineCarouselCardGrid")})})})})();(()=>{const pageScope={"azure.microsoft.com":{paths:["/products/visual-studio-code"],markets:["en-us"]},previews:true};if(!window.SOUtil||!window.SOUtil.pageIsInScope(pageScope)){return}let overrideId="1099449";const styleText=` .experiencefragment reimagine-featured { --ds-ui-shell-gap: 0; } reimagine-secondary-nav .cq-placeholder { display: none; } @media (max-width: 539.98px) { .experiencefragment reimagine-button-group reimagine-button, .experiencefragment reimagine-button-group reimagine-link { width: auto; } .experiencefragment reimagine-button-group { --ds-button-group-margin-inline: auto; --ds-button-group-flex-direction: row; } } `;if(styleText.trim()){window.SOUtil.addStylesheet(styleText,overrideId)}})(); /*! 1100751 - Update visibility if already defined */ (()=>{const TAGS=["reimagine-pricing-grid","reimagine-timeline","reimagine-story-telling","reimagine-hero-author","reimagine-editorial-agenda","reimagine-media-text-stacked","reimagine-banner-timer","reimagine-banner-search","reimagine-media-playlist-video-item","reimagine-media-playlist-video","reimagine-data-tiles","reimagine-immersive-scroll","reimagine-media-with-caption","reimagine-media-video","reimagine-jumplinks","reimagine-long-form-seo","reimagine-banner-heading","reimagine-cta-banner","reimagine-statement-banner","reimagine-section-with-media","reimagine-banner-news","reimagine-banner-featured","reimagine-data-with-icon","reimagine-data-with-caption","reimagine-featured","reimagine-featured-stack","reimagine-card-grid-staggered","reimagine-card-grid-product","reimagine-mixed-stack","reimagine-hero-impact","reimagine-hero-featured-slider","reimagine-hero-featured-slider-item","reimagine-hero-dynamic-text","reimagine-hero-article","reimagine-hero-ai-search","reimagine-hero-search","reimagine-hero-featured-xl-video","reimagine-hero-product","reimagine-hero-category","reimagine-logo-testimonials","reimagine-high-impact-product-accordion","reimagine-media-demo","reimagine-carousel-card-grid","reimagine-carousel-featured","reimagine-filtered-search","reimagine-high-impact-featured-accordion","reimagine-high-impact-accordion","reimagine-features-and-pricing-product-highlight","reimagine-features-and-pricng-3-col","reimagine-dynamic-search-results","reimagine-search-results","reimagine-story-grid","reimagine-editorial-article-takeaway","reimagine-editorial-article-summary","reimagine-story-summary","reimagine-article-list","reimagine-article-list-item","reimagine-editorial-article-chapter","reimagine-editorial-article-quote","reimagine-editorial-article-header","reimagine-editorial-featured","reimagine-secondary-nav","reimagine-scroll-spy","reimagine-announcement","reimagine-base-ui-shell"];const forceVisible=el=>{el.style.setProperty("visibility","visible","important");el.style.setProperty("opacity","1","important")};const isHiddenByCss=el=>{const cs=getComputedStyle(el);return cs.visibility==="hidden"||cs.opacity==="0"};const checkAndUpdateVisibility=()=>{const presentTags=TAGS.filter(t=>document.querySelector(t));if(!presentTags.length){console.info("[WC Visibility Fix] None of the target tags were found in the DOM.");return}for(const tag of presentTags){const els=Array.from(document.querySelectorAll(tag));const registryCtor=customElements.get(tag);for(const el of els){const isRegistered=!!registryCtor;if(isRegistered&&isHiddenByCss(el)){forceVisible(el)}}}};window.SOUtil.runOnPageLoad(()=>{checkAndUpdateVisibility()})})(); /*! 1102133 - Fix ump visibility when not autoplay */ (()=>{const waitForUmpReady=async(ump,maxRetries=50)=>{for(let i=0;isetTimeout(resolve,100))}return false};window.SOUtil.runOnPageLoad(async()=>{const umps=document.querySelectorAll("reimagine-media universal-media-player");for(const ump of umps){const isReady=await waitForUmpReady(ump);if(isReady&&!ump.options.autoplay){ump.classList.add("ump-visible");ump.classList.remove("ump-hidden")}}})})(); /*! 1106652 - Fix inline footnote links */ (()=>{const bindFootnoteLinkFix=()=>{const links=ReimagineSOUtils.querySelectorAllDeep("reimagine-footnote-item a.ms-rte-link");if(!Array.isArray(links)||!links.length)return;links.forEach(link=>{link.addEventListener("click",event=>{event.stopImmediatePropagation()},true)})};window.SOUtil.runOnPageLoad(()=>{bindFootnoteLinkFix()})})(); /*! 1103186 - VFI appears when clicking card grid area */ (()=>{const cardGridFeaturedSelector="reimagine-featured";const tabPanelSelector="reimagine-tab-panel";const soAttr="data-so-1103186";const shadowStyleText=` .tab-panel__base:focus:not(:focus-visible) { outline: none; } `;const removeTabPanelClickVFI=panel=>{if(panel.shadowRoot&&!panel.hasAttribute(soAttr)){panel.setAttribute(soAttr,"");const shadowStyle=document.createElement("style");shadowStyle.textContent=shadowStyleText;panel.shadowRoot.appendChild(shadowStyle)}};const processTabPanels=container=>{const panels=container.querySelectorAll(tabPanelSelector);panels.forEach(removeTabPanelClickVFI)};window.SOUtil.runOnPageLoad(async()=>{await customElements.whenDefined(cardGridFeaturedSelector);await customElements.whenDefined(tabPanelSelector);const featuredElements=document.querySelectorAll(cardGridFeaturedSelector);featuredElements.forEach(featured=>{processTabPanels(featured)})})})(); /*! 1099449 - Update SecondaryNav on the Exchange and VS Code page so it aligns flush with the left edge of the layout. */ (()=>{const pageScope={"www.microsoft.com":{paths:["/microsoft-365/exchange"],markets:["en-us"],allSubpaths:true},"azure.microsoft.com":{paths:["/products/visual-studio-code"],markets:["en-us"],allSubpaths:true}};if(!window.SOUtil||!window.SOUtil.pageIsInScope(pageScope)){return}const overrideId="1099449";const styleText=` reimagine-secondary-nav { --ds-secondary-nav-label-display: none; --ds-secondary-nav-gap: 0; --ds-secondary-nav-scrollslider-padding-inline: 0; } `;if(styleText.trim()){window.SOUtil.addStylesheet(styleText,overrideId)}})(); /*! 16012401 - Update the back to top button position based on the chatbot position */ (()=>{if(typeof window==="undefined"||!window.SOUtil||!("MutationObserver"in window)){return}window.SOUtil.runOnPageLoad(()=>{const SELECTORS={chatbot:".sa-default-entry-container",flyout:".sa-highlight-entry-container",flyoutContent:".sa-highlight-entry-content",backToTop:"reimagine-back-to-top"};let chatbot;let flyout;let flyoutContent;let backToTop;let rafId=0;let lastBottomValue=null;let flyoutObserver;let observedFlyout=null;let resizeObserver;let discoveryObserver;let discoveryTimeoutId=0;let hasSeenChatbot=false;let hasSeenFlyout=false;const resizeObserved=new WeakSet;const CHATBOT_CLASS=SELECTORS.chatbot.slice(1);const FLYOUT_CLASS=SELECTORS.flyout.slice(1);const BACK_TO_TOP_TAG=SELECTORS.backToTop;const isConnected=element=>Boolean(element?.isConnected);const findTargets=()=>{chatbot=isConnected(chatbot)?chatbot:document.querySelector(SELECTORS.chatbot);flyout=isConnected(flyout)?flyout:document.querySelector(SELECTORS.flyout);flyoutContent=isConnected(flyoutContent)?flyoutContent:flyout?.querySelector(SELECTORS.flyoutContent);backToTop=isConnected(backToTop)?backToTop:document.querySelector(SELECTORS.backToTop);hasSeenChatbot=hasSeenChatbot||Boolean(chatbot);hasSeenFlyout=hasSeenFlyout||Boolean(flyout)};const setBackToTopBottom=value=>{if(!backToTop||value===lastBottomValue)return;lastBottomValue=value;if(value){backToTop.style.setProperty("--ds-back-to-top-bottom",value)}else{backToTop.style.removeProperty("--ds-back-to-top-bottom")}};const updateBackToTopPosition=()=>{rafId=0;findTargets();if(!backToTop)return;if(flyout&&!flyout.classList.contains("is-hidden")){flyoutContent=isConnected(flyoutContent)?flyoutContent:flyout.querySelector(SELECTORS.flyoutContent);if(flyoutContent){const bottom=Math.max(0,window.innerHeight-flyoutContent.getBoundingClientRect().top+12);setBackToTopBottom(`${bottom}px`);return}}if(chatbot){setBackToTopBottom(`${chatbot.getBoundingClientRect().height+24}px`);return}setBackToTopBottom(null)};const scheduleUpdate=()=>{if(!rafId)rafId=requestAnimationFrame(updateBackToTopPosition)};const observeResize=element=>{if(!element||!resizeObserver||resizeObserved.has(element))return;resizeObserved.add(element);resizeObserver.observe(element)};const observeTargets=()=>{if(flyout&&flyout!==observedFlyout){if(flyoutObserver){flyoutObserver.disconnect()}flyoutObserver=new MutationObserver(scheduleUpdate);flyoutObserver.observe(flyout,{attributes:true,attributeFilter:["class"]});observedFlyout=flyout}if("ResizeObserver"in window){resizeObserver=resizeObserver||new ResizeObserver(scheduleUpdate);[chatbot,flyout,flyoutContent].forEach(observeResize)}};const refreshTargets=()=>{findTargets();observeTargets();scheduleUpdate()};const nodeHasTarget=node=>{if(!node||node.nodeType!==Node.ELEMENT_NODE)return false;const el=node;if(el.classList?.contains(CHATBOT_CLASS)||el.classList?.contains(FLYOUT_CLASS)||el.localName===BACK_TO_TOP_TAG){return true}if(!el.firstElementChild)return false;if(el.getElementsByClassName(CHATBOT_CLASS).length)return true;if(el.getElementsByClassName(FLYOUT_CLASS).length)return true;if(el.getElementsByTagName(BACK_TO_TOP_TAG).length)return true;return false};const stopDiscovery=()=>{if(discoveryObserver){discoveryObserver.disconnect();discoveryObserver=null}if(discoveryTimeoutId){clearTimeout(discoveryTimeoutId);discoveryTimeoutId=0}};const teardownObservers=()=>{if(flyoutObserver){flyoutObserver.disconnect();flyoutObserver=null;observedFlyout=null}if(resizeObserver){resizeObserver.disconnect();resizeObserver=null}stopDiscovery();if(rafId){cancelAnimationFrame(rafId);rafId=0}};refreshTargets();window.addEventListener("pagehide",teardownObservers,{once:true});discoveryObserver=new MutationObserver(mutations=>{let foundRelevantNode=false;for(const mutation of mutations){for(const node of mutation.addedNodes){if(nodeHasTarget(node)){foundRelevantNode=true;break}}if(foundRelevantNode)break}if(!foundRelevantNode)return;refreshTargets();if(backToTop&&hasSeenChatbot&&hasSeenFlyout){stopDiscovery()}});discoveryObserver.observe(document.body,{childList:true,subtree:true});discoveryTimeoutId=setTimeout(stopDiscovery,1e4)})})(); /*! 1112840 - add theme dark to card promo */ (()=>{const pageScope={"www.microsoft.com":{paths:["/store/b/sale","/store/category/sale"],markets:["en-au"]},previews:true};function addDarkThemeToCardPromo(){const cardPromos=document.querySelectorAll("reimagine-card-promo");cardPromos.forEach(card=>{const textBlock=card.querySelector("reimagine-text-block");if(textBlock?.getAttribute("theme")==="dark"){card.setAttribute("theme","dark")}})}if(globalThis.SOUtil?.pageIsInScope(pageScope)){globalThis.SOUtil.runOnPageLoad(addDarkThemeToCardPromo)}})(); /*! 1114382, 1114841 - Fix stat cards, update theme attribute */ (()=>{const STAT_CARD_SELECTOR="reimagine-card-stat";const STAT_SELECTOR="reimagine-stat";const CONFIGURATION_ATTR="configuration";const STAT_TYPE_ATTR="type";window.SOUtil.runOnPageLoad(async()=>{await customElements.whenDefined(STAT_CARD_SELECTOR);await customElements.whenDefined(STAT_SELECTOR);function fixStatCards(){const statCards=document.querySelectorAll(STAT_CARD_SELECTOR);statCards.forEach(card=>{const stat=card.querySelector(STAT_SELECTOR);const isSizeMissing=stat&&!stat.hasAttribute("size");const isTypeMissing=stat&&!stat.hasAttribute(STAT_TYPE_ATTR);if(stat&&isSizeMissing&&isTypeMissing){const config=card.getAttribute(CONFIGURATION_ATTR);if(config==="vertical"){stat.setAttribute(STAT_TYPE_ATTR,"large--stacked")}else if(config==="banner"){stat.setAttribute(STAT_TYPE_ATTR,"large")}}if(stat&&stat.getAttribute("theme")==="night"){stat.setAttribute("theme","dark")}})}fixStatCards()})})();(()=>{const pageScope={"www.microsoft.com":{paths:["/ec/microsoft-experience-centers-"],markets:["en-us"]},previews:true};function updateHeadings(){const textBlocks=document.querySelectorAll("reimagine-text-block");textBlocks.forEach((block,index)=>{const heading=block.querySelector('[slot="text-block__heading"]');const enTitle=block.getAttribute("data-en-title")?.trim();if(heading&&enTitle){heading.textContent=enTitle}})}if(globalThis.SOUtil?.pageIsInScope(pageScope)){globalThis.SOUtil.runOnPageLoad(()=>updateHeadings())}})(); /*! 1117286 Remove the Tabs Dropdown in mobile view */ (()=>{const pageScope={"www.microsoft.com":{paths:["/store/b/sale"]},previews:true};if(!window.SOUtil||!window.SOUtil.pageIsInScope(pageScope)){return}const overrideId="1117286";const REIMAGINE_TABS="reimagine-tabs";const REIMAGINE_SCROLLSLIDER_ITEM="reimagine-scrollslider-item";window.SOUtil.runOnPageLoad(async()=>{await customElements.whenDefined(REIMAGINE_TABS);const reimagineTabs=document.querySelector(REIMAGINE_TABS);if(!reimagineTabs)return;const hasTabItems=!!reimagineTabs.querySelector(`${REIMAGINE_SCROLLSLIDER_ITEM}:not(.tabs__base__last)`);if(!hasTabItems){reimagineTabs.removeAttribute("configuration");reimagineTabs.querySelector(REIMAGINE_SCROLLSLIDER_ITEM)?.remove()}})})();