1WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}} 2; 3try { 4/* module-key = 'com.atlassian.confluence.plugins.confluence-frontend:split_src_packages_theme-switcher_index_tsx', location = 'src_packages_theme-switcher_index_tsx.js' */ 5"use strict";(globalThis.webpackChunk_atlassian_dc_product_confluence_frontend_plugins_confluence_frontend=globalThis.webpackChunk_atlassian_dc_product_confluence_frontend_plugins_confluence_frontend||[]).push([["src_packages_theme-switcher_index_tsx"],{4194:(e,t,a)=>{a.d(t,{O:()=>h,Y:()=>d});var o=a(6560),r=a(2720),n=a(5161),c=a(6772);const l=(...e)=>{const t=new URL(...e),{attributes:a}=document.documentElement,o=a.getNamedItem("data-color-mode"),r=a.getNamedItem("data-theme");if(o&&r){const e=o.value,n=r.value,c=(n.match(/dark:([^\s]*)/i)?n.match(/dark:([^\s]*)/i):["",""])[1],l=(n.match(/light:([^\s]*)/i)?n.match(/light:([^\s]*)/i):["",""])[1],s=!!a.getNamedItem("data-color-mode-auto"),i=t.searchParams;return e&&i.set("atlThemeColorMode",e),c&&i.set("atlThemeDark",c),l&&i.set("atlThemeLight",l),i.set("atlThemeMatchUa",s?"true":"false"),t.href}return e[0]},s={light:{colorMode:"LIGHT",darkThemeKey:"dark",lightThemeKey:"light"},dark:{colorMode:"DARK",darkThemeKey:"dark",lightThemeKey:"light"},auto:{colorMode:"MATCHING",darkThemeKey:"dark",lightThemeKey:"light"}},i=Object.entries(s).reduce((e,[t,a])=>(e[t]="auto"===t?{...a,colorMode:"AUTO"}:a,e),{}),d=async(e,t)=>{try{t&&(await fetch(`${r.CONTEXT_PATH}/rest/atlassian-theme/1/user-preferences`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s[e])}),(0,n.trigger)("analyticsEvent",{name:"confluence.thememode",data:{toggle:e}}));const a=document.getElementsByTagName("iframe");Array.from(a).forEach(t=>{var a;null===(a=t.contentWindow)||void 0===a||a.postMessage(JSON.stringify({...i[e],id:e,type:"theme.change"}),"*")}),localStorage.setItem("latest-theme-preference",e)}catch(t){t instanceof Error&&console.error(`Unable to set theme: ${e} - ${t.message}`)}},h=()=>{var e;const t=document.documentElement;return null!==(null==t?void 0:t.getAttribute("data-color-mode-auto"))?"auto":((null==t||null===(e=t.getAttribute("data-theme"))||void 0===e?void 0:e.split(" ").reduce((e,t)=>{const[a,o]=t.split(":");return e[a]=o,e},{}))||{})[null==t?void 0:t.getAttribute("data-color-mode")]},m=async(e,t=!0)=>{switch(await d(e,t),e){case"dark":o.D.dark.onClick();break;case"light":o.D.light.onClick();break;case"auto":o.D.auto.onClick()}};window.addEventListener("pageshow",e=>{try{if(e.persisted){const e=localStorage.getItem("latest-theme-preference");null!==e&&e!==h()&&location.reload()}else(async()=>{try{localStorage.setItem("latest-theme-preference",h())}catch(e){console.error("Unable to store the latest theme preference",e)}})()}catch(e){console.error("Failed to handle themes across navigation",e)}}),(0,c.A)("confluence/theme-switcher",()=>({toThemeUrl:l,setTheme:m}))}}]); 6}catch(e){WRMCB(e)};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.