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}} /*! 1082501 - Add clarity script after page load */ /*! 1102131 - Add domain and site specific Clarity ID */ (async()=>{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, reimagine-featured-v1");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, reimagine-banner-featured-v1");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, reimagine-carousel-card-grid-v1");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, .experiencefragment reimagine-featured-v1 { --ds-ui-shell-gap: 0; } reimagine-secondary-nav .cq-placeholder, reimagine-secondary-nav-v1 .cq-placeholder { display: none; } @media (max-width: 539.98px) { .experiencefragment reimagine-button-group reimagine-button, .experiencefragment reimagine-button-group reimagine-link, .experiencefragment reimagine-button-group-v1 reimagine-button-v1, .experiencefragment reimagine-button-group-v1 reimagine-link-v1 { width: auto; } .experiencefragment reimagine-button-group, .experiencefragment reimagine-button-group-v1 { --ds-button-group-margin-inline: auto; --ds-button-group-flex-direction: row; } } `;if(styleText.trim()){window.SOUtil.addStylesheet(styleText,overrideId)}})(); /*! 1106652 - Fix inline footnote links */ (()=>{const bindFootnoteLinkFix=()=>{const links=ReimagineSOUtils.querySelectorAllDeep("reimagine-footnote-item a.ms-rte-link, reimagine-footnote-item-v1 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, reimagine-featured-v1";const tabPanelSelector="reimagine-tab-panel, reimagine-tab-panel-v1";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()=>{const featuredElements=document.querySelectorAll(cardGridFeaturedSelector);const featuredTags=new Set(Array.from(featuredElements,featured=>featured.localName));await Promise.all(Array.from(featuredTags,tag=>customElements.whenDefined(tag)));const tabPanels=Array.from(featuredElements).flatMap(featured=>Array.from(featured.querySelectorAll(tabPanelSelector)));const tabPanelTags=new Set(tabPanels.map(panel=>panel.localName));await Promise.all(Array.from(tabPanelTags,tag=>customElements.whenDefined(tag)));featuredElements.forEach(featured=>{processTabPanels(featured)})})})(); /*! 16012401 - Update the back to top button position based on the chatbot position */ /*! 1308603 - Add Store version of the back to top button to existing functionality */ (()=>{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:"store-back-to-top, reimagine-back-to-top, reimagine-back-to-top-v1"};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_TAGS=["store-back-to-top","reimagine-back-to-top","reimagine-back-to-top-v1"];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)||BACK_TO_TOP_TAGS.includes(el.localName)){return true}if(!el.firstElementChild)return false;if(el.getElementsByClassName(CHATBOT_CLASS).length)return true;if(el.getElementsByClassName(FLYOUT_CLASS).length)return true;if(BACK_TO_TOP_TAGS.some(tag=>el.getElementsByTagName(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)})})(); /*! 1307903 - Apply the authored Scheduled Theme stylesheet and collapse its empty XF wrapper */ (()=>{const overrideId="1307903";const THEME_COMPONENT="[data-scheduled-theme]";const THEME_PATH_MARKER="clientlib-reimagineui/foundation/themes/";const XF_WRAPPER=".xf-content-height";const collapseEmptyWrapper=themeElement=>{const wrapper=themeElement.closest(XF_WRAPPER);if(!wrapper||wrapper.dataset.so1307903Collapsed==="true")return;wrapper.style.setProperty("min-height","0","important");wrapper.style.setProperty("height","0","important");wrapper.style.setProperty("overflow","hidden","important");wrapper.dataset.so1307903Collapsed="true"};const applyScheduledTheme=()=>{const themeElement=document.querySelector(THEME_COMPONENT);if(!themeElement)return;collapseEmptyWrapper(themeElement);if(document.getElementById(`so-${overrideId}-theme`))return;const{theme,startTime,endTime}=themeElement.dataset;if(!theme||!startTime||!endTime)return;const themeName=theme.split(".")[1];if(!themeName)return;const startTimestamp=Date.parse(`${startTime}Z`);const endTimestamp=Date.parse(`${endTime}Z`);if(Number.isNaN(startTimestamp)||Number.isNaN(endTimestamp))return;const now=Date.now();if(nowendTimestamp)return;const referenceHref=Array.from(document.querySelectorAll("link[href]")).map(link=>link.getAttribute("href")).find(href=>href&&href.includes(THEME_PATH_MARKER));if(!referenceHref)return;const themeDirectory=referenceHref.slice(0,referenceHref.indexOf(THEME_PATH_MARKER)+THEME_PATH_MARKER.length);const themeStylesheet=document.createElement("link");themeStylesheet.id=`so-${overrideId}-theme`;themeStylesheet.rel="stylesheet";themeStylesheet.type="text/css";themeStylesheet.href=`${themeDirectory}${themeName}.min.css`;document.body.appendChild(themeStylesheet)};if(window.SOUtil&&window.SOUtil.runOnPageLoad){window.SOUtil.runOnPageLoad(applyScheduledTheme)}else{applyScheduledTheme()}})(); /*! 1307903 - Apply holiday theme schedule */ (()=>{"use strict";const campaigns=[{name:"NA",locales:["en-us","en-ca","fr-ca"],launch:new Date("2026-10-27T16:00:00Z"),teardown:new Date("2026-12-29T17:00:00Z")},{name:"EMEA",locales:["en-gb","de-de","fr-fr","it-it","es-es","nl-nl","de-at","de-ch","fr-ch","nl-be","fr-be","de-lu","fr-lu","en-ie","pt-pt","nb-no","da-dk","sv-se","fi-fi","pl-pl"],launch:new Date("2026-10-27T15:00:00Z"),teardown:new Date("2026-12-29T09:00:00Z")},{name:"APAC",locales:["en-au","ja-jp","en-sg","en-nz"],launch:new Date("2026-10-27T16:00:00Z"),teardown:new Date("2026-12-29T17:00:00Z")}];const dealsLocales=["en-us","en-ca","fr-ca","en-gb","de-de","fr-fr","es-es","it-it","en-au","ja-jp"];const chooserLocales=campaigns.flatMap(campaign=>campaign.locales);const chooserMarkets=new Set(chooserLocales);const pageScopes=[{livePath:"/store/b/sale",authorPaths:["/store/b/sale","/store/category/sale"],markets:new Set(dealsLocales),excludedSections:[]},{livePath:"/store/b/buy-surface-laptop",authorPaths:["/store/b/buy-surface-laptop","/store/category/buy-surface-laptop"],markets:chooserMarkets,excludedSections:["store-featured"]},{livePath:"/store/b/buy-surface-pro",authorPaths:["/store/b/buy-surface-pro","/store/category/buy-surface-pro"],markets:chooserMarkets,excludedSections:["store-featured"]}];const livePages=new Map(pageScopes.map(scope=>[scope.livePath,scope]));const authorPages=new Map(pageScopes.flatMap(scope=>scope.authorPaths.map(path=>[path,scope])));const previewHosts=["golf-author.adobeprod.microsoft.com","echo-author.adobeprod.microsoft.com"];const hostname=window.location.hostname.toLowerCase();const isAuthorPreview=previewHosts.includes(hostname);if(hostname!=="www.microsoft.com"&&!isAuthorPreview)return;let pathname=window.location.pathname.toLowerCase();if(isAuthorPreview){pathname=pathname.replace(/^\/editor\.html(?=\/content\/)/,"");pathname=pathname.replace(/^\/content\/launches(\/[^/]+){4}/,"");const contentMatch=pathname.match(/^\/content\/microsoft(?:\/bade)?(\/.*)$/);if(!contentMatch)return;pathname=contentMatch[1].replace(/\.html$/,"")}const pages=isAuthorPreview?authorPages:livePages;const pathMatch=pathname.replace(/\/$/,"").match(/^\/([^/]+)(\/.*)$/);const pageScope=pathMatch&&pages.get(pathMatch[2]);if(!pageScope?.markets.has(pathMatch[1]))return;const excludedSelectors=[...pageScope.excludedSections,":is(store-media, reimagine-media) :is(store-tag, reimagine-tag)"];const excludedSelector=excludedSelectors.join(",");const exclusionSuffix=excludedSelector?`:not(:where(${excludedSelectors.flatMap(selector=>[selector,`${selector} *`]).join(",")}))`:"";const locale=pathMatch[1];const campaign=campaigns.find(item=>item.locales.includes(locale));const params=new URLSearchParams(window.location.search);const previewMode=params.get("previewHoliday")==="true"&&(isAuthorPreview||params.get("previewLiveHoliday")==="true");if(!previewMode&&(!campaign?.launch||!campaign.teardown))return;const holidayColors={primaryBgColor:"#882A8B",primaryFgColor:"#FFFFFF",secondaryBgColor:"#ECDEED",secondaryFgColor:"#5F166C"};function isHolidayActive(){if(previewMode)return true;const now=Date.now();return now>=campaign.launch.getTime()&&now`${selector}${exclusionSuffix}`);return scopedSelectors.join(",\n")+` {\n background-color: ${bg} !important;\n color: ${fg} !important;\n fill: ${fg} !important;\n`+` --badge-bg-color: ${bg};\n --badge-fg-color: ${fg};\n`+` --ds-badge-background: ${bg} !important;\n --ds-badge-text-color: ${fg} !important;\n`+` --ds-link-color: ${fg} !important;\n`+` --ds-tag-background: ${bg} !important;\n --ds-tag-color: ${fg} !important;\n}\n`+scopedSelectors.map(selector=>`${selector} > .store-pricing${exclusionSuffix}`).join(",\n")+` {\n color: ${fg} !important;\n}\n`}function buildAnnouncementRule(bg,fg){const hosts=":is(store-announcement, reimagine-announcement)";const labels=["announcement__label","announcement__post-label","announcement__expired-label","announcement__expired-post-label"].map(slot=>`[slot="${slot}"]`).join(", ");return`${hosts} {\n`+` --ds-fill-color-override: ${bg} !important;\n`+` --ds-text-color-override: ${fg} !important;\n`+` --ds-announcement-background: ${bg} !important;\n`+` --ds-announcement-chooser-background-color: ${bg} !important;\n`+` --ds-announcement-chooser-text-color: ${fg} !important;\n`+` --ds-button-ghost-color: ${fg} !important;\n`+` --ds-button-ghost-hover-color: ${fg} !important;\n`+` --ds-button-ghost-pressed-color: ${fg} !important;\n`+` background-color: ${bg} !important;\n color: ${fg} !important;\n fill: ${fg} !important;\n}\n`+`${hosts} > :is(${labels}) {\n color: ${fg} !important;\n}\n`+`${hosts} > [slot="announcement__link"],\n`+`${hosts} > [slot="announcement__link"] :is(a, button) {\n`+` --ds-link-color: ${fg} !important;\n --ds-button-color: ${fg} !important;\n`+` --ds-button-background-color: ${bg} !important;\n`+` color: ${fg} !important;\n}\n`}function buildShadowRootCss(c){return buildRule(PRIMARY_SELECTORS,c.primaryBgColor,c.primaryFgColor)+buildRule(SECONDARY_SELECTORS,c.secondaryBgColor,c.secondaryFgColor)}let holidayShadowSheet=null;let documentStyle=null;let hostObserver=null;let boundaryTimer=null;let active=false;let generation=0;const trackedHosts=new Map;const hostSelector=SHADOW_HOST_SELECTORS.join(",");const shadowCss=buildShadowRootCss(holidayColors);function removeRootStyles(root){if(!root)return;if(holidayShadowSheet&&root.adoptedStyleSheets){root.adoptedStyleSheets=root.adoptedStyleSheets.filter(sheet=>sheet!==holidayShadowSheet)}root.getElementById(STYLE_ID)?.remove()}function isExcluded(host){if(!excludedSelector)return false;for(let node=host;node;node=node.getRootNode().host){if(node.closest(excludedSelector))return true}return false}async function prepareHost(host){if(isExcluded(host)||trackedHosts.has(host))return;trackedHosts.set(host,null);const currentGeneration=generation;await customElements.whenDefined(host.localName);if(!active||currentGeneration!==generation||!host.isConnected||isExcluded(host))return;await host.updateComplete;if(!active||currentGeneration!==generation||!host.isConnected||isExcluded(host))return;if(!isHolidayActive()){reconcile();return}const root=host.shadowRoot;if(!root){trackedHosts.delete(host);console.error("Holiday theme: expected an open shadow root on",host);return}if(holidayShadowSheet&&"adoptedStyleSheets"in root){if(!root.adoptedStyleSheets.includes(holidayShadowSheet)){root.adoptedStyleSheets=[...root.adoptedStyleSheets,holidayShadowSheet]}}else if(!root.getElementById(STYLE_ID)){const style=document.createElement("style");style.id=STYLE_ID;style.textContent=shadowCss;root.appendChild(style)}trackedHosts.set(host,root)}function discoverHosts(node){if(!(node instanceof Element))return;const prepare=host=>{prepareHost(host).catch(error=>{console.error("Holiday theme: unable to style comparison table",error)})};if(node.matches(hostSelector))prepare(node);node.querySelectorAll(hostSelector).forEach(prepare)}function injectShadowRootStyles(){if(!holidayShadowSheet&&"adoptedStyleSheets"in ShadowRoot.prototype&&"replaceSync"in CSSStyleSheet.prototype){holidayShadowSheet=new CSSStyleSheet;holidayShadowSheet.replaceSync(shadowCss)}hostObserver=new MutationObserver(records=>{if(!isHolidayActive()){reconcile();return}if(records.some(record=>record.removedNodes.length)){trackedHosts.forEach((root,host)=>{if(!host.isConnected||isExcluded(host)){removeRootStyles(root);trackedHosts.delete(host)}})}records.forEach(record=>record.addedNodes.forEach(discoverHosts))});hostObserver.observe(document.body,{childList:true,subtree:true});discoverHosts(document.body)}function applyHolidayBadgeOverrides(){active=true;generation++;if(!document.getElementById(STYLE_ID)){const c=holidayColors;const style=document.createElement("style");style.id=STYLE_ID;style.textContent=buildAnnouncementRule(c.primaryBgColor,c.primaryFgColor)+buildRule(PRIMARY_SELECTORS,c.primaryBgColor,c.primaryFgColor)+buildRule(SECONDARY_SELECTORS,c.secondaryBgColor,c.secondaryFgColor);document.head.appendChild(style);documentStyle=style}injectShadowRootStyles()}function removeHolidayBadgeOverrides(){active=false;generation++;hostObserver?.disconnect();hostObserver=null;documentStyle?.remove();documentStyle=null;trackedHosts.forEach(removeRootStyles);trackedHosts.clear()}function reconcile(){clearTimeout(boundaryTimer);boundaryTimer=null;const shouldApply=isHolidayActive();if(shouldApply&&!active)applyHolidayBadgeOverrides();else if(!shouldApply&&active)removeHolidayBadgeOverrides();if(!previewMode){const now=Date.now();const nextBoundary=[campaign.launch.getTime(),campaign.teardown.getTime()].find(time=>time>now);if(nextBoundary!==undefined){boundaryTimer=setTimeout(reconcile,Math.min(nextBoundary-now,2147483647))}}}function init(){reconcile();document.addEventListener("visibilitychange",()=>{if(!document.hidden)reconcile()})}if(window.SOUtil&&window.SOUtil.runOnPageLoad){window.SOUtil.runOnPageLoad(init)}else if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",init)}else{init()}})();