\n\t\t\t${l} v${z(t)} is available — you're on v${e}\n\t\t\t${function(e){if(!e.length)return"";const t=e.slice(0,3).map(({version:e,summary:t})=>`
v${z(e)}: ${z(t)}
`),o=e.length-3;return o>0&&t.push(`
and ${o} more ${1===o?"update":"updates"}
`),`
${t.join("")}
`}(o)}\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t`,a.appendChild(n),requestAnimationFrame(()=>n.classList.add(F("update-banner-visible")));const i=()=>{n.classList.remove(F("update-banner-visible")),setTimeout(()=>{n.remove(),a.children.length||a.remove()},400)};n.querySelector("."+F("update-banner-update")).addEventListener("click",()=>{window.open(Se(),"_blank"),i()}),n.querySelector("."+F("update-banner-later")).addEventListener("click",i),n.querySelector("."+F("update-banner-dismiss")).addEventListener("click",()=>{S("dismissedUpdateVersion",t),i()})}(we,await(t=we,Te().then(o=>(o||[]).filter(({version:o})=>$e(o,e)&&!$e(o,t)))))})}function Ie(e){const t=()=>{e.classList.toggle(F("update-available"),!!we),e.title=we?`Update available: v${we} (click to update)`:"Up to date"};t(),e.addEventListener("click",()=>{window.open(Se(),"_blank")}),Le().then(t)}const Fe="https://api.cyberspace.online/v1";class ze extends Error{}class qe extends Error{constructor(e,t){super(e),this.status=t}}async function Re(e,t,o){return(await He(e,t,o))?.data}async function He(e,t,o){const a=await new Promise(e=>{let t;try{t=indexedDB.open("firebaseLocalStorageDb")}catch(t){return void e(null)}t.onupgradeneeded=()=>{t.transaction.abort(),e(null)},t.onerror=()=>e(null),t.onsuccess=()=>{const o=t.result;let a;try{a=o.transaction("firebaseLocalStorage","readonly").objectStore("firebaseLocalStorage").getAll()}catch(t){return o.close(),void e(null)}a.onerror=()=>{o.close(),e(null)},a.onsuccess=()=>{o.close();const t=a.result.map(e=>e?.value?.stsTokenManager).filter(e=>"string"==typeof e?.accessToken&&Number(e.expirationTime)>Date.now()+6e4);e(t[0]?.accessToken??null)}}});if(!a)throw new Error("Not signed in to Cyberspace.");const n={Authorization:`Bearer ${a}`,"Content-Type":"application/json"},i=void 0===o?void 0:JSON.stringify(o),r=Fe+t,l=ke?await new Promise((t,o)=>{ke({method:e,url:r,headers:n,data:i,timeout:15e3,redirect:"error",onload:e=>{!e.finalUrl||e.finalUrl.startsWith(Fe)?t({status:e.status,text:e.responseText}):o(new ze("Cyberspace answered from another address, so the answer was ignored."))},onerror:()=>o(new ze("Could not reach Cyberspace.")),ontimeout:()=>o(new ze("Cyberspace did not answer."))})}):await fetch(r,{method:e,headers:n,body:i,redirect:"error",signal:AbortSignal.timeout(15e3)}).then(async e=>({status:e.status,text:await e.text()})).catch(()=>{throw new ze("Could not reach Cyberspace.")});let s=null;try{s=JSON.parse(l.text)}catch(e){}if(l.status<200||l.status>=300){const e=s?.error?.message||s?.message||`error ${l.status}`;throw new qe(`Cyberspace refused it: ${e}`,l.status)}return s}async function Be(){const e=await Re("GET","/users/me");if("string"!=typeof e?.username||!e.username)throw new Error("Cyberspace did not say who is signed in.");return e.username}async function Ve(e=null){const t=e?`?limit=50&cursor=${encodeURIComponent(e)}`:"?limit=50",o=await He("GET","/notes"+t);return{notes:Array.isArray(o?.data)?o.data:[],cursor:o?.cursor??null}}function Ue(e){const t=e?.noteId??e?.postId??e?.id;return"string"==typeof t&&t?t:null}async function Pe(e){return Re("GET",`/notes/${encodeURIComponent(e)}`)}class Ge extends Error{}async function We(e,t=Qe(16)){const o=await crypto.subtle.importKey("raw",(new TextEncoder).encode(e),"PBKDF2",!1,["deriveKey"]);return{salt:t,key:await crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:t,iterations:6e5},o,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}}async function _e(e){try{const t=tt(e.salt),o=await crypto.subtle.importKey("raw",tt(e.key),"AES-GCM",!0,["encrypt","decrypt"]);return 16===t.length?{salt:t,key:o}:null}catch(e){return console.error(i+" Could not use a kept key:",e),null}}function Ze(e){let t;try{t=tt(e.replace(/\s+/g,""))}catch(e){throw new Error("The locked text is damaged.")}if(t.length<=29||1!==t[0])throw new Error("The locked text is damaged, or from a newer version.");return{salt:t.subarray(1,17),iv:t.subarray(17,29),ciphertext:t.subarray(29)}}function Je(e){return Ze(e).salt}async function Ke(e,{key:t}){const{iv:o,ciphertext:a}=Ze(e);let n;try{n=await crypto.subtle.decrypt({name:"AES-GCM",iv:o,additionalData:new Uint8Array([1])},t,a)}catch(e){throw new Ge("That passphrase does not open it, or it was changed.")}try{return(new TextDecoder).decode(await Ye(Xe(n),new DecompressionStream("gzip")))}catch(e){throw new Error("The locked text opened, but is damaged.")}}async function Ye(e,t){const o=new Response(e).body.pipeThrough(t);return Xe(await new Response(o).arrayBuffer())}function Xe(e){const t=new Uint8Array(e),o=new Uint8Array(t.length);return o.set(t),o}function Qe(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),t}function et(e){let t="";for(let o=0;oe.charCodeAt(0))}function ot(e){return`linear-gradient(to right, ${e.map(e=>{const[t,o,a,n=1,i=null]=e;return`hsla(${t}, ${o}%, ${a}%, ${n})${null!==i?` ${i}%`:""}`}).join(", ")})`}function at(e){const{type:t="single",simple:o=!1,inline:a=!1,min:n=0,max:i=100,step:r=1,onChange:l,label:s}=e,c="range"===t,d=I("slider"),h=c?2:1,p=c?["minimum","maximum"]:[""],u=c?["▶","◀"]:[""],g=document.createElement("div");a&&!c&&s&&(g.className=F("slider-inline"));const m=e=>[s?d:"",c?`${d}-name-${e}`:""].filter(Boolean);g.innerHTML=`\n\t\t${s?``:""}\n\t\t
Site-wide override: ${z(O)} Your changes will override this locally.
`:""}\n\t\t\t${o.useSingleColor?'\n\t\t\t
\n\t\t\t\tPer-user color customization is disabled. Monochrome mode is enabled. \n\t\t\t\t\n\t\t\t
\n\t\t\t':`\n\t\t\t
Nick Color
\n\t\t\t\n\t\t\t${q({label:"Custom color value:",id:"picker-custom",placeholder:"#ff6b6b or hsl(280, 90%, 65%)",classes:"no-padding-bottom"})}\n\t\t\t${F?'
Color range is restricted. Preview shows mapped result. Click SETTINGS to adjust.
':""}\n\t\t\t`}\n\t\t\t\n\t\t`,buttons:[{label:"Save",class:"save",onClick:t=>{const o=ce();wi[e]=Wn(o,"typed")??{};const a=Zn({[e]:o},wi);a&&alert(`Saved.${Jn(a,"typed")}`),Si(),pr(),t(),ea(e)}},{label:"Reset",class:"reset",onClick:t=>{delete wi[e],Si(),pr(),t(),ea(e)}},{label:"Cancel",class:"cancel",onClick:e=>e()}]}),J=Z.querySelector("#picker-preview"),K=Z.querySelector("#picker-preview-mention"),Y=Z.querySelector("#picker-preview-inverted-nick"),Q=Z.querySelector("#picker-custom"),ee=Z.querySelector("#picker-sliders"),te=Z.querySelector("#picker-engine-container");let oe=!1;const ae=nt({schema:[{type:"hr"},{type:"section",label:"Custom Icons",hint:"Prepend/Append a custom character or emoji to the nickname.",fields:[{key:"prependIconEnabled",type:"tristate",label:"Prepend icon",default:s,defaultLabel:u},{key:"prependIconPicker",type:"custom",showWhen:{field:"prependIconEnabled",is:!0},render:()=>{const e=document.createElement("div");return e.innerHTML=_("settings-prependIcon"),e}},{key:"prependIcon",type:"text",label:"",ariaLabel:"Custom icon before nickname",default:r,placeholder:"custom icon before nickname",showWhen:{field:"prependIconEnabled",is:!0}},{key:"appendIconEnabled",type:"tristate",label:"Append icon",default:c,defaultLabel:g},{key:"appendIconPicker",type:"custom",showWhen:{field:"appendIconEnabled",is:!0},render:()=>{const e=document.createElement("div");return e.innerHTML=_("settings-appendIcon"),e}},{key:"appendIcon",type:"text",label:"",ariaLabel:"Custom icon after nickname",default:l,placeholder:"custom icon after nickname",showWhen:{field:"appendIconEnabled",is:!0}}]},{type:"section",label:"Style Variations",hint:"Override the global style settings for this user to add some visual flair.",fields:[{key:"fontWeight",type:"tristate",label:"Bold",default:"bold"===x||"normal"!==x&&null,defaultLabel:b},{key:"fontStyle",type:"tristate",label:"Italic",default:"italic"===S||"normal"!==S&&null,defaultLabel:f},{key:"fontVariant",type:"tristate",label:"Small Caps",default:"small-caps"===C||"normal"!==C&&null,defaultLabel:y},{key:"invert",type:"tristate",label:"Invert",default:!0===$||!1!==$&&null,defaultLabel:"auto"},{key:"customFontFamily",type:"tristate",label:"Custom Font",default:T,defaultLabel:N||"site default"},{key:"fontFamily",type:"text",label:"",ariaLabel:"Custom font family",default:A,placeholder:"Comic Sans MS, cursive",showWhen:{field:"customFontFamily",is:!0}}]},{type:"section",label:"Additional CSS",fields:[{key:"customCss",type:"textarea",label:"",default:n,placeholder:"background-color: #1a1a2e;\ntext-decoration: underline;",hint:"CSS properties, one per line"}]},{type:"section",label:"Backup",fields:[{key:"exportFile",type:"button",label:"Export user settings to file",buttonText:"Save Settings File",onClick:()=>{const t={[e]:ce()},o=(new Date).toISOString().slice(0,10);var a,n;a=t,n=`nick-colors-${e}-${o}.json`,Wt(JSON.stringify(Pi(a),null,2),n,"application/json")}},{key:"exportCopy",type:"button",label:"Export user settings to clipboard",buttonText:"Copy to Clipboard",onClick:async()=>{const t={[e]:ce()};await _t(JSON.stringify(Pi(t)),"Copied to clipboard!")}},{key:"importFile",type:"button",label:"Import user settings from file",buttonText:"Load Settings File",onClick:()=>Zt(de("file"),{parse:Wi})},{key:"importPaste",type:"button",label:"Import user settings from clipboard",buttonText:"Paste from Clipboard",onClick:()=>Jt(de("clipboard"),{parse:Wi})}]},{type:"section",label:"Request Override",noHr:!0,hint:'Ask for this style to be the default everyone sees for this name. Anyone who set their own style for it keeps theirs. If C-Mail opens instead with no message filled in, choose Copy to Clipboard in Backup above and send the text to @z0ylent.',fields:[{key:"requestOverride",type:"button",label:"Send this style as a request",buttonText:"Request Override",onClick:async()=>{if(oe)return;oe=!0;const t=Z.querySelector('[data-field-key="requestOverride"] button');t.textContent="Sending…";const o={[e]:ce()},a=`Hi! I'd like to request a site-wide nick color override: ${JSON.stringify(Pi(o))}`;try{Xt(await Qt("z0ylent",a),"z0ylent","Request sent to @z0ylent.")}finally{oe=!1,t.textContent="Request Override"}}}]}],values:{},onChange:()=>se(),container:te});ae.render();let ne=null,ie=null,re=null;if(ee&&!o.useSingleColor){const e=M?`Hue → mapped to ${o.minHue}-${o.maxHue}`:'Hue ',t=D?`Sat → mapped to ${o.minSaturation}-${o.maxSaturation}`:'Sat ',a=I?`Lit → mapped to ${o.minLightness}-${o.maxLightness}`:'Lit ';ne=at({label:e,min:0,max:360,value:180,onChange:()=>{Q.value="",se()}}),ie=at({label:t,min:0,max:100,value:85,onChange:()=>{Q.value="",se()}}),re=at({label:a,min:0,max:100,value:65,onChange:()=>{Q.value="",se()}}),ee.append(ne.el,ie.el,re.el)}const le=Z.querySelector("#picker-open-settings");function se(){!function(){if(!ne||!ie||!re)return;const e=ne.getValue(),t=ie.getValue(),a=re.getValue(),n=oi(e,o.minHue,o.maxHue),i=ai(t,o.minSaturation,o.maxSaturation),r=ai(a,o.minLightness,o.maxLightness),l=Array.from({length:13},(e,o)=>{const n=30*o;return[n,t,a,1,n/360*100]});if(M){const e=[];for(let t=0;t<=36;t++){const a=10*t,n=oi(a,o.minHue,o.maxHue),l=a/360*100;e.push([n,i,r,1,l])}ne.setSplitGradient(e,l)}else ne.setSplitGradient(null),ne.setGradient(l);const s=[[e,0,a,1,0],[e,100,a,1,100]];if(D){const e=[[n,o.minSaturation,r,1,0],[n,o.maxSaturation,r,1,100]];ie.setSplitGradient(e,s)}else ie.setSplitGradient(null),ie.setGradient(s);const c=[[e,t,0,1,0],[e,t,50,1,50],[e,t,100,1,100]];if(I){const e=[[n,i,o.minLightness,1,0],[n,i,o.maxLightness,1,100]];re.setSplitGradient(e,c)}else re.setSplitGradient(null),re.setGradient(c);const d=`hsl(${n}, ${i}%, ${r}%)`;ne.setThumbColor(d),ie.setThumbColor(d),re.setThumbColor(d);const h=ne.el.querySelector(".nc-slider-values"),p=ie.el.querySelector(".nc-slider-values"),u=re.el.querySelector(".nc-slider-values");h&&(h.textContent=`[${Math.round(e)} → ${Math.round(n)}]`),p&&(p.textContent=`[${Math.round(t)} → ${Math.round(i)}]`),u&&(u.textContent=`[${Math.round(a)} → ${Math.round(r)}]`);const g=Ji(ne.el),m=Ji(ie.el),b=Ji(re.el),f=o.maxHue-o.minHue,y=e/360;g.textContent=`t=${y.toFixed(3)} | ${o.minHue} + ${y.toFixed(3)} * (${o.maxHue} - ${o.minHue}) = ${o.minHue} + ${y.toFixed(3)} * ${f} = ${(o.minHue+y*f).toFixed(1)}`;const v=o.maxSaturation-o.minSaturation,w=t/100;m.textContent=`t=${w.toFixed(3)} | ${o.minSaturation} + ${w.toFixed(3)} * (${o.maxSaturation} - ${o.minSaturation}) = ${(o.minSaturation+w*v).toFixed(1)}`;const k=o.maxLightness-o.minLightness,x=a/100;b.textContent=`t=${x.toFixed(3)} | ${o.minLightness} + ${x.toFixed(3)} * (${o.maxLightness} - ${o.minLightness}) = ${(o.minLightness+x*k).toFixed(1)}`}();const t=Wn(ce(),"typed")??{},a=wi[e];wi[e]=t;const n={...fi};Object.assign(fi,o),fi.useSiteThemeHue=!1,fi.useSiteThemeSat=!1,fi.useSiteThemeLit=!1;const i=(t,o,a=!1)=>{t.style.cssText="",rr(t,e,{matchType:o?"mention":"nick",isInverted:a,debugData:$o})};i(J,!1,!1),K&&i(K,!0,!1),Y&&i(Y,!1,!0),Object.assign(fi,n),void 0!==a?wi[e]=a:delete wi[e]}if(le&&le.addEventListener("click",()=>{Z.close(),Ht(fr)}),t.color&&ne&&ie&&re){const e=ue(t.color,"hsl");e?(ne.setValue(e.h),ie.setValue(e.s),re.setValue(e.l)):Q&&(Q.value=t.color)}function ce(){const e=o.useSingleColor||!ne?Q?.value?.trim()||null:Q.value.trim()||`hsl(${ne.getValue()}, ${ie.getValue()}%, ${re.getValue()}%)`,t=ae.getFieldValue("prependIconEnabled"),a=ae.getFieldValue("appendIconEnabled"),n=ae.getFieldValue("fontWeight"),i=ae.getFieldValue("fontStyle"),r=ae.getFieldValue("fontVariant"),l=ae.getFieldValue("invert"),s={...ei(ae.getFieldValue("customCss")||"")};e&&(s.color=e),!0===t?s.prependIcon=(ae.getFieldValue("prependIcon")||"").trim():!1===t&&(s.prependIcon=""),!0===a?s.appendIcon=(ae.getFieldValue("appendIcon")||"").trim():!1===a&&(s.appendIcon=""),null!==n&&(s.fontWeight=n?"bold":"normal"),null!==i&&(s.fontStyle=i?"italic":"normal"),null!==r&&(s.fontVariant=r?"small-caps":"normal"),null!==l&&(s.invert=l);const c=ae.getFieldValue("customFontFamily");return!0===c?s.fontFamily=ae.getFieldValue("fontFamily")?.trim()||"":!1===c&&(s.fontFamily=""),s}function de(t){return(o,a)=>{if(a)return void alert(a.message);const n=o&&"object"==typeof o?o[e]||Object.values(o)[0]:null,i=Wn(n,"imported");i?(function(e){if(e.color&&ne&&ie&&re){const t=ue(e.color,"hsl");t?(ne.setValue(t.h),ie.setValue(t.s),re.setValue(t.l)):Q&&(Q.value=e.color)}const t=[];if(e.backgroundColor&&t.push(`background-color: ${e.backgroundColor}`),e.letterSpacing&&t.push(`letter-spacing: ${e.letterSpacing}`),e.textDecoration&&t.push(`text-decoration: ${e.textDecoration}`),t.length>0&&ae.setFieldValue("customCss",t.join(";\n")),void 0!==e.prependIcon&&(""===e.prependIcon?ae.setFieldValue("prependIconEnabled",!1):(ae.setFieldValue("prependIconEnabled",!0),ae.setFieldValue("prependIcon",e.prependIcon))),void 0!==e.appendIcon&&(""===e.appendIcon?ae.setFieldValue("appendIconEnabled",!1):(ae.setFieldValue("appendIconEnabled",!0),ae.setFieldValue("appendIcon",e.appendIcon))),void 0!==e.fontWeight){const t="bold"===e.fontWeight||"normal"!==e.fontWeight&&null;ae.setFieldValue("fontWeight",t)}if(void 0!==e.fontStyle){const t="italic"===e.fontStyle||"normal"!==e.fontStyle&&null;ae.setFieldValue("fontStyle",t)}if(void 0!==e.fontVariant){const t="small-caps"===e.fontVariant||"normal"!==e.fontVariant&&null;ae.setFieldValue("fontVariant",t)}void 0!==e.fontFamily&&(""===e.fontFamily?ae.setFieldValue("customFontFamily",!1):(ae.setFieldValue("customFontFamily",!0),ae.setFieldValue("fontFamily",e.fontFamily))),void 0!==e.invert&&ae.setFieldValue("invert",e.invert),se()}(i),alert(`Settings imported!${Jn(Zn({[e]:n},{[e]:i}),"imported")}`)):alert(`No valid user settings found in ${t}`)}}Q&&Q.addEventListener("input",se),te.addEventListener("click",e=>{const t=e.target.closest(".nc-icon-option");if(t){const e=t.textContent,o=t.closest(".picker-icon-options"),a=o?.dataset.target;if(a){const t="settings-prependIcon"===a?"prependIcon":"appendIcon";ae.setFieldValue(t,e),se()}void 0===t.dataset.restingBackground&&(t.dataset.restingBackground=t.style.background),clearTimeout(t.flashTimer),t.style.background="var(--atmo-fg-dim)",t.flashTimer=setTimeout(()=>{t.style.background=t.dataset.restingBackground},150)}}),se()}const fr="atmospheric-modulator-nick-colors";function yr(e=4.5){return{contrastEnabled:e>0,contrastThreshold:e>0?e:4.5}}function vr(e){const t=se(ui,e),o=Object.keys(ui).find(e=>ui[e]===t);return o?o.toLowerCase():""}function wr(){const e=ri(),t=ye(null,"hsl");return{presets:kr(),preview:'\n\t\t\t',content:`\n\t\t\t${Zi({"Site Theme":Object.entries(t).length?""+Object.entries(t).filter(([e,t])=>!e.match(/^info|error|warn|success/i)).map(([e,t])=>`${e}: ${ue(t,"hsl-string")+` ███`}`).join(" ")+"":"not detected","Effective Config":`H:${e.minHue}-${e.maxHue} S:${e.minSaturation}-${e.maxSaturation} L:${e.minLightness}-${e.maxLightness}`,"Contrast Threshold":e.contrastThreshold,"Custom Colors Saved":Object.keys(wi).length})}\n\t\t\t\n\t\t\t\n\t\t`}}function kr(){const e=I("settings-preset"),t=Object.keys(ui).map(e=>{const t=se(Q,e)?.colors,o=t?` style="--${O}-chip-fg: ${z(t.fg)}; --${O}-chip-bg: ${z(t.bg)}"`:"";return`\n\t\t`}).join("");return`\n\t\t
\n\t\t\t
\n\t\t\t\tPreset theme\n\t\t\t\t${q({type:"toggle",id:I("settings-follow-theme"),label:"Follow site theme",checked:!!fi.followSiteTheme,classes:"nc-settings-follow-theme"})}\n\t\t\t
Changes save as you make them. Per-user colors: right-click a username and ${$i}. \n\t\t \n\t\tSelect a Preset theme below to create a starting point to adjust colors from, or toggle on "Follow site theme" to have the preset follow you when you change your site's theme.
\n\t\t\n\t\t${t}\n\t\t
Nick color examples on your theme's background and inverted, from your settings below.
\n\t\t
${o}
\n\t\t${a}\n\t\t\n\t\t
\n\t\t\t
Reset Nick Color Theme
\n\t\t\t${q({type:"button",id:n,classes:F("caution"),label:"Put the color settings back to the selected preset, or with none selected to the site theme's. Chooms, per-user colors and notes stay.",buttonText:"Reset to Preset"})}\n\t\t
\n\t`,nt({container:e.querySelector("[data-nick-color-for]"),values:{colorFor:Ai},schema:[{key:"colorFor",type:"select",label:"Whose nicks get colored",options:ta}],onChange:(e,t)=>{"colorFor"===e&&(ji(t),pr(),Oi()||Mi())}}).render();const i=Er(e,{onImported:()=>xr(e)});Sr(e);const r=e.querySelector("#"+n);r.addEventListener("click",()=>J({title:"Reset to preset?",message:`This puts the nick color settings back to the selected preset, or with none selected to the site theme's. Chooms, per-user colors, notes and the ${d} section stay.`,confirmLabel:"RESET",tone:"caution",onConfirm:()=>{i.reset(),r.isConnected||Ft(fr)}}))}function Sr(e){e.dataset.ncFocusClear||(e.dataset.ncFocusClear="true",e.addEventListener("focusin",t=>{const o=t.target;requestAnimationFrame(()=>{const t=e.querySelector(".nc-settings-preview");if(!t||document.activeElement!==o)return;if(!(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING))return;const a=o.closest("[data-field-key]")||o,n=t.getBoundingClientRect();if(a.getBoundingClientRect().bottom<=n.top)return;const i=n.bottom-Cr(a);i>0&&($r(o).scrollTop-=i)})}))}function Cr(e){let t=e.getBoundingClientRect().top;for(const o of[e,...e.querySelectorAll("*")]){const e=getComputedStyle(o);if(!e.outlineStyle||"none"===e.outlineStyle)continue;const a=(parseFloat(e.outlineWidth)||0)+(parseFloat(e.outlineOffset)||0);t=Math.min(t,o.getBoundingClientRect().top-a)}return t}function $r(e){for(let t=e.parentElement;t;t=t.parentElement){const{overflowY:e}=getComputedStyle(t);if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t}return document.scrollingElement||document.documentElement}function Ar(){const e=Object.keys(wi).length;J({title:"Reset custom user styles?",message:`This removes the custom color, icons and style set for ${1===e?"1 user":`${e} users`}, and cannot be undone. A name with a site-wide override goes back to it. Notes stay. To keep a copy, choose Save Settings File under ${h} first.`,confirmLabel:"RESET CUSTOM SETTINGS",tone:"danger",onConfirm:()=>{Ci({}),pr(),ea()}})}function Er(e,{onImported:t}){const o=ri(),a=ye(null,"hsl"),{settings:n,colorVariables:i}=Kn();let r=!1;const l=e.querySelector("[data-settings-engine]"),s=Array.from(e.querySelectorAll(".nc-settings-preset [data-preset]")),c=e.querySelector('.nc-settings-follow-theme input[type="checkbox"]');let d=mi||"",h=!1,p="";const u=e=>{p=e;for(const t of s)t.setAttribute("aria-pressed",String(t.dataset.preset===e))},g=e.querySelector("[data-settings-preview]"),m=e.querySelector("[data-settings-preview-inverted]");function b(){if(c.checked&&(mi||"")!==d&&!h){d=mi||"",h=!0;try{S(vr(d))}finally{h=!1}}fi={...y.getValues(),followSiteTheme:c.checked,followedTheme:c.checked?d:""},vi(),pr()}const f=["z0ylent","fr33Kevin","triNity","an0nym0us","ZeR0C00L","l1sb3th","enki","genghis_khan","acidBurn","neo","N3tRuNn3r","ByteMe99","CyB3rPuNk"];f.forEach(e=>{const t=document.createElement("span");t.className="preview-nick",t.textContent=e,g.appendChild(t)}),f.forEach(e=>{const t=document.createElement("span");t.className="preview-nick",t.textContent=e,m.appendChild(t)});const y=nt({schema:[{type:"section",label:"Monochrome Mode",fields:[{key:"useSingleColor",type:"toggle",label:"Use monochrome mode",default:!1},{type:"hint",text:"All usernames will use the same color. Per-user color customization is disabled.",showWhen:{field:"useSingleColor",is:!0}},{key:"singleColorHue",type:"slider",label:"Hue",min:0,max:360,default:i.fg?.h??180,simple:!1,showWhen:{field:"useSingleColor",is:!0}},{key:"singleColorSat",type:"slider",label:"Saturation",min:0,max:100,default:i.fg?.s??85,simple:!1,showWhen:{field:"useSingleColor",is:!0}},{key:"singleColorLit",type:"slider",label:"Lightness",min:0,max:100,default:i.fg?.l??65,simple:!1,showWhen:{field:"useSingleColor",is:!0}},{key:"singleColorCustom",type:"text",label:"Or use a custom color:",placeholder:"#ff6b6b or hsl(280, 90%, 65%)",default:"",showWhen:{field:"useSingleColor",is:!0}}]},{type:"section",label:"Hue Range"+(a.fg?"":' (no site theme)'),showWhen:{field:"useSingleColor",is:!1},fields:[{key:"useSiteThemeHue",type:"toggle",label:"Use site theme foreground hue"+(a.fg?` (${a.fg.h}°)`:""),default:!1,disabled:!a.fg,showWhen:{field:"useSingleColor",is:!1}},{key:"hueSpread",type:"slider",label:"Hue spread (±°)",min:5,max:180,default:30,showWhen:{all:[{field:"useSingleColor",is:!1},{field:"useSiteThemeHue",is:!0}]}},{key:"hueRange",type:"range",label:"Hue Range",min:0,max:360,default:[0,360],showWhen:{field:"useSingleColor",is:!1}}]},{type:"section",label:"Saturation Range",showWhen:{field:"useSingleColor",is:!1},fields:[{key:"useSiteThemeSat",type:"toggle",label:"Use site theme foreground saturation"+(a?.fg?` (${a.fg.s}%)`:""),default:!1,disabled:!a.fg,showWhen:{field:"useSingleColor",is:!1}},{key:"satSpread",type:"slider",label:"Saturation spread (±%)",min:0,max:50,default:15,showWhen:{all:[{field:"useSingleColor",is:!1},{field:"useSiteThemeSat",is:!0}]}},{key:"satRange",type:"range",label:"Saturation Range",min:0,max:100,default:[70,100],showWhen:{field:"useSingleColor",is:!1}}]},{type:"section",label:"Lightness Range",showWhen:{field:"useSingleColor",is:!1},fields:[{key:"useSiteThemeLit",type:"toggle",label:"Use site theme foreground lightness"+(a?.fg?` (${a.fg.l}%)`:""),default:!1,disabled:!a.fg,showWhen:{field:"useSingleColor",is:!1}},{key:"litSpread",type:"slider",label:"Lightness spread (±%)",min:0,max:50,default:10,showWhen:{all:[{field:"useSingleColor",is:!1},{field:"useSiteThemeLit",is:!0}]}},{key:"litRange",type:"range",label:"Lightness Range",min:0,max:100,default:[55,75],showWhen:{field:"useSingleColor",is:!1}}]},{type:"section",label:"Contrast",fields:[{key:"contrastEnabled",type:"toggle",label:"Enable contrast auto-inversion",default:!0},{type:"hint",text:"Auto-invert colors when WCAG contrast ratio is below threshold (3 = large text, 4.5 = AA, 7 = AAA)",showWhen:{field:"contrastEnabled",is:!0}},{key:"contrastThreshold",type:"slider",label:"Contrast Threshold (WCAG ratio)",min:1,max:21,step:.5,default:4.5,showWhen:{field:"contrastEnabled",is:!0}}]},{type:"section",label:"Style Variation",fields:[{type:"hint",text:"Add non-color variation to usernames (useful for limited color ranges)"},{key:"varyWeight",type:"toggle",label:"Vary font weight",default:!1},{key:"varyItalic",type:"toggle",label:"Vary italic",default:!1},{key:"varyCase",type:"toggle",label:"Vary small-caps",default:!1},{key:"prependIcon",type:"toggle",label:"Prepend icon",default:!1},{key:"appendIcon",type:"toggle",label:"Append icon",default:!1},{key:"iconSet",type:"text",label:"Icon set (space-separated)",placeholder:"● ○ ◆ ◇ ■ □ ▲ △ ★ ☆",default:"● ○ ◆ ◇ ■ □ ▲ △ ★ ☆ ♦ ♠ ♣ ♥ ☢ ☣ ☠ ⚙ ⬡ ⬢ ♻ ⚛ ⚠ ⛒",showWhen:{any:[{field:"prependIcon",is:!0},{field:"appendIcon",is:!0}]}}]},{type:"section",label:"Moving from Nick Colors",noHr:!0,fields:[{type:"button",label:"Bring your colors and notes over from the separate Nick Colors userscript",id:"settings-import-nick-colors",buttonText:"Import from Nick Colors",onClick:()=>_i(t)}]}],values:{...o,hueRange:[o.minHue,o.maxHue],satRange:[o.minSaturation,o.maxSaturation],litRange:[o.minLightness,o.maxLightness],...yr(o.contrastThreshold)},defaults:n,onChange:(e,t)=>{"useSingleColor"===e&&t&&r&&function(){if(!a.fg||y.getFieldValue("singleColorCustom"))return;const e=["singleColorHue","singleColorSat","singleColorLit"].every(e=>y.getFieldValue(e)===hi[e]);e&&y.setValues({singleColorHue:Math.round(a.fg.h),singleColorSat:Math.round(a.fg.s),singleColorLit:Math.round(a.fg.l)})}(),"useSiteThemeHue"!==e&&"hueSpread"!==e||v("hue"),"useSiteThemeSat"!==e&&"satSpread"!==e||v("sat"),"useSiteThemeLit"!==e&&"litSpread"!==e||v("lit"),k(),x(),r&&b()},container:l});function v(e){if(!a.fg)return;if(!y.getFieldValue(`useSiteTheme${e.charAt(0).toUpperCase()+e.slice(1)}`))return;const t=y.getFieldValue(`${e}Spread`),o=y.getField(`${e}Range`);if("hue"===e){const e=(a.fg.h-t+360)%360,n=(a.fg.h+t)%360;o?.setValues([e,n])}else if("sat"===e){const e=Math.max(0,a.fg.s-t),n=Math.min(100,a.fg.s+t);o?.setValues([e,n])}else if("lit"===e){const e=Math.max(0,a.fg.l-t),n=Math.min(100,a.fg.l+t);o?.setValues([e,n])}}function w(e,t){y.getField(e)?.setDisabled?.(t)}function k(){const e=y.getField("hueRange"),t=y.getField("satRange"),o=y.getField("litRange"),a=y.getField("singleColorHue"),n=y.getField("singleColorSat"),i=y.getField("singleColorLit");if(!e||!t||!o)return;const[r,l]=e.getValues?.()||[0,360],[s,c]=t.getValues?.()||[70,100],[d,h]=o.getValues?.()||[55,75],p=(r+l)/2,u=(s+c)/2,g=(d+h)/2,m=Array.from({length:13},(e,t)=>[30*t,u,g,1,30*t/360*100]);if(e.setGradient?.(m),t.setGradient?.([[p,0,g,1,0],[p,100,g,1,100]]),o.setGradient?.([[p,u,0,1,0],[p,u,50,1,50],[p,u,100,1,100]]),e.setThumbColor?.([`hsl(${r}, ${u}%, ${g}%)`,`hsl(${l}, ${u}%, ${g}%)`]),t.setThumbColor?.([`hsl(${p}, ${s}%, ${g}%)`,`hsl(${p}, ${c}%, ${g}%)`]),o.setThumbColor?.([`hsl(${p}, ${u}%, ${d}%)`,`hsl(${p}, ${u}%, ${h}%)`]),a&&n&&i){const e=a.getValue?.()??180,t=n.getValue?.()??85,o=i.getValue?.()??65,r=Array.from({length:13},(e,a)=>{const n=30*a;return[n,t,o,1,n/360*100]});a.setGradient?.(r),n.setGradient?.([[e,0,o,1,0],[e,100,o,1,100]]),i.setGradient?.([[e,t,0,1,0],[e,t,50,1,50],[e,t,100,1,100]]),a.setThumbColor?.(`hsl(${e}, ${t}%, ${o}%)`),n.setThumbColor?.(`hsl(${e}, ${t}%, ${o}%)`),i.setThumbColor?.(`hsl(${e}, ${t}%, ${o}%)`)}w("hueRange",y.getFieldValue("useSiteThemeHue")),w("satRange",y.getFieldValue("useSiteThemeSat")),w("litRange",y.getFieldValue("useSiteThemeLit"))}function x(){k();const e=function(){const e=y.getValues(),t={...e};return e.hueRange&&(t.minHue=e.hueRange[0],t.maxHue=e.hueRange[1]),e.satRange&&(t.minSaturation=e.satRange[0],t.maxSaturation=e.satRange[1]),e.litRange&&(t.minLightness=e.litRange[0],t.maxLightness=e.litRange[1]),t}(),t=p||mi||"";g.querySelectorAll(".preview-nick").forEach((o,a)=>{rr(o,f[a],{effectiveConfig:e,themeName:t,isInverted:!1,debugData:$o})}),m.querySelectorAll(".preview-nick").forEach((o,a)=>{rr(o,f[a],{effectiveConfig:e,themeName:t,isInverted:!0,debugData:$o})})}y.render();const S=e=>{u(e);const t=Yn(e);t&&(y.setValues({hueRange:[t.minHue,t.maxHue],satRange:[t.minSaturation,t.maxSaturation],litRange:[t.minLightness,t.maxLightness],...yr(t.contrastThreshold)},!0),x())};for(const e of s)e.addEventListener("click",()=>{c.checked&&(c.checked=!1,B(c)),S(e.dataset.preset)});c.addEventListener("change",()=>{B(c),d=mi||"",c.checked&&S(vr(d)),r&&b()}),c.checked&&u(vr(mi));const C=y.getValues.bind(y);return y.getValues=()=>{const e=C(),t={...e};return e.hueRange&&(t.minHue=e.hueRange[0],t.maxHue=e.hueRange[1],delete t.hueRange),e.satRange&&(t.minSaturation=e.satRange[0],t.maxSaturation=e.satRange[1],delete t.satRange),e.litRange&&(t.minLightness=e.litRange[0],t.maxLightness=e.litRange[1],delete t.litRange),e.contrastEnabled||(t.contrastThreshold=0),delete t.contrastEnabled,t},v("hue"),v("sat"),v("lit"),x(),r=!0,{engine:y,save:b,reset:function(){c.checked&&(d=mi||"");const e=(c.checked?d:p)||mi||"",t=Kn(e),o=t.settings,a=t.colorVariables;y.setValues({...o,...yr(o.contrastThreshold),hueRange:[o.minHue,o.maxHue],satRange:[o.minSaturation,o.maxSaturation],litRange:[o.minLightness,o.maxLightness],singleColorHue:a.fg?.h??o.singleColorHue,singleColorSat:a.fg?.s??o.singleColorSat,singleColorLit:a.fg?.l??o.singleColorLit},!0),u(vr(e)),x()}}}function Lr(e){br(e,or(e))}function Nr(e){const t=document.createElement("button");t.type="button",t.className=F("color-name"),t.dataset.entryControl="color";const o=document.createElement("span");return o.className=F("color-preview"),o.dataset.previewUser=e,o.textContent=e,t.appendChild(o),Or(o,e),t.addEventListener("click",()=>Lr(e)),t}function Tr(){const e=document.createElement("div");e.className=F("settings-section"),e.innerHTML="
Reset User Specific Styles
"+q({type:"button",id:I("nick-colors-clear-custom"),classes:F("danger"),label:"Remove the custom color, icons and style set for each user. ★'s notes and other settings stay.",buttonText:"Reset Custom User Styles"});const t=e.querySelector("button");return t.dataset.userListAction="clear-custom-nick-colors",t.addEventListener("click",Ar),[e]}function jr(){document.querySelectorAll(`[${lt}="${Go}"] .${F("color-preview")}`).forEach(e=>{Or(e,e.dataset.previewUser)})}function Or(e,t){const o=Ni(t);o?rr(e,t):ur(e);const a=e.closest("button");a&&(a.title=o?"Edit color":"Edit color (shows once they are a choom)")}Fo({key:"nickColors",usesChooms:!0,onStorageReady(e){yi(),ki(),Li(),e&&pr()},exportBackup:()=>Pi(Fi()),importBackup(e,t){const o=Bi(e,{recolor:t,replaceAll:!0});return o.success&&(Ft(fr),ea()),{...o,notice:Jn(o.dropped,"imported").trim()}},resetSettings(e){const t=Bi({},{recolor:e,replaceAll:!0});if(Ft(fr),ea(),!t.success)throw new Error(t.message)},debugLog:Ki,reportSummary:Yi,onSwitch:()=>pr(),boot(){var e,t;mi=document.documentElement?.dataset?.theme||null,oe(),bi(),ve(),Xn(),Vo({label:"Edit Color",order:10,group:Ho,showFor:e=>No.nickColors&&Ni(e),onSelect:Lr}),e=()=>pr(),aa.push(e),t=()=>No.nickColors?ar(`sample-${Math.random()}`,"hsl-string"):null,Io.nickColorSample=t,Jo({order:10,isShown:()=>No.nickColors,usernames:()=>Object.keys(wi),name:Nr,parts:()=>[],actions:Tr}),T&&(T("Nick Colors Settings",()=>Ya(fr)),T("Refresh Nick Colors",gr),T("Clear All Custom Colors",Ar)),Nt({key:fr,title:"Nick Colors",isShown:()=>No.nickColors,render:xr}),(ci?xe(ci).then(e=>{const t=_n(JSON.parse(e),"imported");di={...t,...di},jr(),Eo(si+" Loaded remote overrides:",Object.keys(t).length)}).catch(e=>console.error(si+" Failed to load remote overrides:",e)):Promise.resolve()).then(()=>xo(e=>e.forEach(hr))),new MutationObserver(e=>{e.some(e=>"data-theme"===e.attributeName)&&(Eo(si+" Theme changed, refreshing colors"),mi=document.documentElement.getAttribute("data-theme")||null,oe(),bi(),ve(),Xn()&&Ft(fr),pr())}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),console.log(si+` Loaded. Right-click or long-press a username, then ${$i}, to customize it.`)}})}{const Dr=r("nick-notes");let Ir={};const Fr=300;function zr(){try{const e=JSON.parse(C("nickNotes","{}"));Ir=e&&"object"==typeof e?e:{}}catch(e){Ir={}}}function qr(){S("nickNotes",JSON.stringify(Ir))}function Rr(){let e;try{e=JSON.parse(C("customNickColors","{}"))}catch(e){return}if(!e||"object"!=typeof e)return;let t=0;for(const[o,a]of Object.entries(e))a&&"object"==typeof a&&"userNotes"in a&&("string"==typeof a.userNotes&&a.userNotes&&(Ir[o]=a.userNotes),delete a.userNotes,t++);t&&(qr(),S("customNickColors",JSON.stringify(e)),Eo(Dr+` Moved ${t} notes out of nick colors' storage`))}function Hr(){zr(),Rr()}function Br(e){const t=Yr(e),o=I("nick-notes"),a=X({title:`Notes: ${z(e)}`,width:"350px",onHelp:null,onSettings:()=>Ht(_a),content:q({type:"textarea",id:o,label:"Notes",hint:"Only you see these, when you hover their name.",value:Ir[t]||""}),buttons:[{label:"Save",class:"save",onClick:o=>{const n=a.value.trim();n?Ir[t]=n:delete Ir[t],qr(),o(),ea(e)}},{label:"Cancel",class:"cancel",onClick:e=>e()}]}).querySelector("#"+o);a.focus()}Hr();let Vr=null,Ur=null,Pr=null;function Gr(e){return e.target instanceof Element?e.target.closest(io):null}function Wr(e){_r();const t=Ir[Yr(vo(e))];e.classList.toggle("nn-has-notes",!!t),t&&(Pr=e,Ur=setTimeout(()=>{if(!e.isConnected)return void _r();const o=(Vr||(Vr=document.createElement("div"),Vr.className="nn-tooltip",Vr.id=I("nick-notes-tooltip"),Vr.setAttribute("role","tooltip"),Vr.addEventListener("mouseleave",e=>{Pr?.contains(e.relatedTarget)||_r()}),document.body.appendChild(Vr)),Vr);o.textContent=t;const a=e.getBoundingClientRect();o.style.left=a.left+"px",o.style.top=a.bottom+"px",o.classList.add("visible"),e.setAttribute("aria-describedby",o.id)},Fr))}function _r(){clearTimeout(Ur),Ur=null,Vr?.classList.remove("visible"),Pr?.removeAttribute("aria-describedby"),Pr=null}function Zr(){return null!==Pr}function Jr(){const e=Object.keys(Ir).length;return`${e} ${1===e?"note":"notes"}`}const Kr='';function Yr(e){const t=e.toLowerCase();return Object.keys(Ir).find(e=>e.toLowerCase()===t)??e}function Xr(e){const t=Yr(e),o=Ir[t];if(!o){const e=document.createElement("button");return e.type="button",e.className=F("note-add"),e.dataset.entryControl="note",e.textContent="add note",e.setAttribute("aria-label",`add note on @${t}`),e.addEventListener("click",()=>Br(t)),[Ko(e,"text")]}const a=document.createElement("p");a.className=F("entry-text","note-text"),a.textContent=o,a.title="Edit notes",a.addEventListener("click",()=>Br(t));const n=W(Kr,`Edit notes on @${t}`,()=>Br(t));n.dataset.entryControl="note";const i=W(G,`Delete notes on @${t}`,()=>Qr(t),"danger");return i.dataset.entryControl="trash",[Ko(a,"text"),Ko(n,"edit"),Ko(i,"delete")]}function Qr(e){J({title:"Delete these notes?",message:`This deletes your notes on @${z(e)}, and cannot be undone.`,confirmLabel:"DELETE",tone:"danger",onConfirm:()=>{delete Ir[e],qr(),ea(e)}})}Fo({key:"nickNotes",onStorageReady(){Hr(),ea()},exportBackup:()=>({...Ir}),importBackup:e=>e&&"object"==typeof e?(Ir=Object.fromEntries(Object.entries(e).filter(([,e])=>"string"==typeof e&&e)),qr(),ea(),{success:!0,message:"Notes imported."}):{success:!1,message:"The notes are not readable."},resetSettings(){Ir={},qr(),ea()},debugLog:Jr,reportSummary:Jr,boot(){Vo({label:"Edit Notes",order:12,group:Ho,showFor:()=>No.nickNotes,onSelect:Br}),Jo({order:20,isShown:()=>No.nickNotes,usernames:()=>Object.keys(Ir),parts:Xr}),xo(),document.addEventListener("mouseover",e=>{const t=Gr(e);t&&!t.contains(e.relatedTarget)&&Wr(t)}),document.addEventListener("mouseout",e=>{const t=Gr(e);!t||t.contains(e.relatedTarget)||Vr?.contains(e.relatedTarget)||_r()}),document.addEventListener("focusin",e=>{const t=Gr(e);t&&Wr(t)}),document.addEventListener("focusout",e=>{Gr(e)&&_r()}),document.addEventListener("pointerdown",e=>{Zr()&&!Vr?.contains(e.target)&&_r()},!0),document.addEventListener("keydown",e=>{"Escape"===e.key&&Zr()&&_r()})}})}{const el=r("world-clock"),tl='#circ-room-header, .circ-rail div[data-debug="header"]',ol=[{id:"utc",label:"UTC",timeZone:"UTC"},{id:"los-angeles",label:"LA",timeZone:"America/Los_Angeles"},{id:"chicago",label:"Chicago",timeZone:"America/Chicago"},{id:"new-york",label:"NYC",timeZone:"America/New_York"},{id:"sao-paulo",label:"São Paulo",timeZone:"America/Sao_Paulo"},{id:"london",label:"London",timeZone:"Europe/London"},{id:"paris",label:"Paris",timeZone:"Europe/Paris"},{id:"berlin",label:"Berlin",timeZone:"Europe/Berlin"},{id:"moscow",label:"Moscow",timeZone:"Europe/Moscow"},{id:"dubai",label:"Dubai",timeZone:"Asia/Dubai"},{id:"mumbai",label:"Mumbai",timeZone:"Asia/Kolkata"},{id:"singapore",label:"Singapore",timeZone:"Asia/Singapore"},{id:"hong-kong",label:"Hong Kong",timeZone:"Asia/Hong_Kong"},{id:"tokyo",label:"Tokyo",timeZone:"Asia/Tokyo"},{id:"sydney",label:"Sydney",timeZone:"Australia/Sydney"},{id:"auckland",label:"Auckland",timeZone:"Pacific/Auckland"}],al={cities:["new-york","london","sydney"],hour24:!0,showOffsets:!1,custom:[]},nl=20,il=40;let rl={...al};function ll(e){if(!e||"object"!=typeof e)return{...al,custom:[]};const t=new Set(ol.map(e=>e.id));return{cities:Array.isArray(e.cities)?[...new Set(e.cities.filter(e=>t.has(e)))]:[...al.cities],hour24:"boolean"==typeof e.hour24?e.hour24:al.hour24,showOffsets:"boolean"==typeof e.showOffsets?e.showOffsets:al.showOffsets,custom:sl(e.custom)}}function sl(e){if(!Array.isArray(e))return[];const t=new Set,o=[];for(const a of e){const e=hl(a?.timeZone),n=cl(a?.label),i=dl({label:n,timeZone:e});if(e&&n&&!t.has(i)&&(t.add(i),o.push({label:n,timeZone:e}),o.length===nl))break}return o}function cl(e){return"string"!=typeof e?"":e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,il).trim()}function dl(e){return`${e.timeZone}|${e.label}`}function hl(e){if("string"!=typeof e||!e)return null;let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e}).resolvedOptions().timeZone}catch(e){return null}return pl(e)??t}function pl(e){const t=e.toLowerCase();return ul().find(e=>e.toLowerCase()===t)}function ul(){return"function"==typeof Intl.supportedValuesOf?Intl.supportedValuesOf("timeZone"):[]}function gl(e){const t=e.trim().replace(/ +/g,"_");if(!t)return null;const o=t.toLowerCase();return pl(t)??ul().find(e=>e.toLowerCase().split("/").pop()===o)??hl(t)}function ml(e){return e.split("/").pop().replace(/_/g," ")}function bl(){return rl.cities.length>0||rl.custom.length>0}function fl(){try{rl=ll(JSON.parse(C("worldClock","null")))}catch(e){rl=ll(null)}}function yl(e){rl=ll(e),S("worldClock",JSON.stringify(rl)),Ll()}function vl(e,t){const o=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).formatToParts(t).map(e=>[e.type,Number(e.value)])),a=Date.UTC(o.year,o.month-1,o.day,o.hour,o.minute),n=6e4*Math.floor(t.getTime()/6e4);return Math.round((a-n)/6e4)}function wl(e){const t=e<0?"-":"+",o=Math.floor(Math.abs(e)/60),a=Math.abs(e)%60;return`UTC${t}${o}${a?":"+String(a).padStart(2,"0"):""}`}function kl(e,t,o){return new Intl.DateTimeFormat("en-US",o?{timeZone:e,hourCycle:"h23",hour:"2-digit",minute:"2-digit"}:{timeZone:e,hour12:!0,hour:"numeric",minute:"2-digit"}).format(t)}function xl(e){const t=[...ol.filter(e=>rl.cities.includes(e.id)),...rl.custom].map(t=>({city:t,offset:vl(t.timeZone,e)})),o=({city:e,offset:t})=>"UTC"===e.timeZone?-1/0:t;return t.sort((e,t)=>o(e)-o(t)),t.map(({city:t,offset:o})=>{let a=kl(t.timeZone,e,rl.hour24);return rl.showOffsets&&"UTC"!==t.timeZone&&(a+=` (${wl(o)})`),{label:t.label,time:a}})}fl();let Sl=null,Cl=!1;const $l=F("world-clock");function Al(){return Array.from(document.querySelectorAll(tl))}function El(e){return!!e?.classList.contains($l)}function Ll(){const e=Cl&&No.worldClock&&bl()?Al():[];if(document.querySelectorAll("."+$l).forEach(t=>{e.includes(t.previousElementSibling)||t.remove()}),!e.length)return clearTimeout(Sl),void(Sl=null);const t=xl(new Date);for(const o of e){let e=o.nextElementSibling;El(e)||(e=document.createElement("div"),e.className=`${$l} border-b border-border`,e.setAttribute("role","group"),e.setAttribute("aria-label","World clock"),o.after(e)),Nl(e,t)}clearTimeout(Sl),Sl=setTimeout(Ll,6e4-Date.now()%6e4)}function Nl(e,t){e.textContent="",t.forEach((t,o)=>{if(o){const t=document.createElement("span");t.className=F("world-clock-divider"),t.setAttribute("aria-hidden","true"),t.textContent="|",e.append(t)}const a=document.createElement("span");a.className=F("world-clock-city"),a.textContent=`${t.label} ${t.time}`,e.append(a)})}function Tl(e){e.textContent="";const t=document.createElement("div");e.append(t),nt({container:t,values:{hour24:rl.hour24,showOffsets:rl.showOffsets},schema:[{type:"section",label:"Clock",noHr:!0,fields:[{key:"hour24",type:"toggle",label:"24-hour time",default:al.hour24},{key:"showOffsets",type:"toggle",label:"Show each city's UTC offset, as (UTC-4)",default:al.showOffsets}]}],onChange:(e,t)=>yl({...rl,[e]:t})}).render(),e.append(jl(),Ol())}function jl(){const e=document.createElement("fieldset");e.className=F("world-clock-cities","chip-row");const t=document.createElement("legend");t.textContent="Cities",e.append(t);for(const t of ol){const o=document.createElement("button");o.type="button",o.className=F("chip"),o.dataset.city=t.id,o.textContent=t.label;const a=()=>o.setAttribute("aria-pressed",String(rl.cities.includes(t.id)));a(),o.addEventListener("click",()=>{const e=rl.cities.includes(t.id)?rl.cities.filter(e=>e!==t.id):[...rl.cities,t.id];yl({...rl,cities:e}),a()}),e.append(o)}return e}function Ol(){const e=document.createElement("fieldset");e.className=F("world-clock-custom");const t=document.createElement("legend");t.textContent="Your cities";const o=document.createElement("div"),a=I("world-clock-name"),n=I("world-clock-zone"),i=I("world-clock-error"),r=I("world-clock-zones"),l=document.createElement("div");l.className=F("world-clock-add"),l.innerHTML=`\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t
\n\t\t\t\n\t\t
\n\t\t\n\t\t`;const s=l.querySelector("#"+a),c=l.querySelector("#"+n),d=l.querySelector("#"+i);l.querySelector("datalist").append(...ul().map(e=>{const t=document.createElement("option");return t.value=e,t}));const h=()=>{o.textContent="",o.append(_(rl.custom.map(e=>{const t=document.createElement("span");t.textContent=`${e.label} (${e.timeZone})`;const a=W(G,`Remove ${e.label}`,()=>{yl({...rl,custom:rl.custom.filter(t=>dl(t)!==dl(e))}),Z(o,h,dl(e),s)},"danger");return a.dataset.entryControl="remove",{key:dl(e),parts:[t,a]}}),"None yet. Add any city by its time zone."))},p=e=>{d.textContent=e,c.setAttribute("aria-invalid","true"),c.focus()},u=()=>{const e=gl(c.value);if(!e)return p("Pick a time zone from the suggestions, such as America/Denver.");if(rl.custom.length>=nl)return p(`You can add up to ${nl} cities. Remove one first.`);const t={label:cl(s.value)||ml(e),timeZone:e};if(rl.custom.some(e=>dl(e)===dl(t)))return p(`${t.label} is already on the list.`);yl({...rl,custom:[...rl.custom,t]}),h(),d.textContent="",c.removeAttribute("aria-invalid"),s.value="",c.value="",s.focus()};l.querySelector("button").addEventListener("click",u);for(const e of[s,c])e.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),u())});return h(),e.append(t,o,l),e}const Ml="atmospheric-modulator-world-clock";Fo({key:"worldClock",onStorageReady(e){fl(),e&&(Ll(),Ft(Ml))},exportBackup:()=>({...rl}),importBackup:(e,t)=>e&&"object"==typeof e?(yl(e),t&&Ft(Ml),{success:!0,message:"World clock settings imported."}):{success:!1,message:"The world clock settings are not readable."},resetSettings(e){yl(null),e&&Ft(Ml)},reportSummary:()=>{const e=rl.cities.length+rl.custom.length;return`${e} ${1===e?"city":"cities"}`},onSwitch:()=>Ll(),boot(){Nt({key:Ml,title:"World Clock",isShown:()=>No.worldClock,render:Tl}),Cl=!0,new MutationObserver(()=>{if(!No.worldClock||!bl())return;const e=Al(),t=e.some(e=>!El(e.nextElementSibling)),o=Array.from(document.querySelectorAll("."+$l)).some(t=>!e.includes(t.previousElementSibling));(t||o)&&Ll()}).observe(document.documentElement,{childList:!0,subtree:!0}),Eo(el+" Watching for cIRC headers"),Ll()}})}{const Dl=r("nick-effects"),Il=/^Online \(\d+\)$/,Fl=/^→\s*(\S+)\s+joined$/,zl=40,ql=".toast-notification",Rl=6e4,Hl=".chat-message",Bl=3e3,Vl=3,Ul=/^(\d{2}):(\d{2}):(\d{2})$/,Pl=12e4,Gl=6e5,Wl=3,_l={amount:{min:5,max:150,step:5},size:{min:8,max:40,step:1},duration:{min:1,max:5,step:.5},spin:{min:0,max:720,step:30},drift:{min:0,max:200,step:10},stagger:{min:0,max:80,step:5},rockets:{min:1,max:5,step:1},rocketDistance:{min:20,max:80,step:5},sprayDistance:{min:20,max:80,step:5},wobble:{min:0,max:80,step:5},spread:{min:10,max:90,step:5}},Zl=[{value:"linear",label:"Linear",css:"linear"},{value:"ease",label:"Ease",css:"ease"},{value:"ease-in",label:"Ease in",css:"ease-in"},{value:"ease-out",label:"Ease out",css:"ease-out"},{value:"ease-in-out",label:"Ease in-out",css:"ease-in-out"},{value:"overshoot",label:"Overshoot",css:"cubic-bezier(0.34, 1.56, 0.64, 1)"}],Jl=[{value:"fall",label:"Fall/Rise",gravity:!0,fades:!0,spins:!0,drifts:!0},{value:"burst",label:"Burst from name",gravity:!0,fades:!0,spins:!0,drifts:!0},{value:"firework",label:"Firework",direction:"up",gravity:!0,fades:!0,spins:!0,drifts:!0},{value:"bubbles",label:"Bubbles",gravity:!0,fades:!1,spins:!0,drifts:!0},{value:"rain",label:"Rain",gravity:!0,fades:!1,spins:!1,drifts:!0},{value:"fountain",label:"Fountain",direction:"up",gravity:!0,fades:!0,spins:!0,drifts:!0},{value:"zoom",label:"Starfield zoom",gravity:!1,fades:!0,spins:!0,drifts:!1}],Kl=[{value:"down",label:"Down"},{value:"up",label:"Up"},{value:"left",label:"Left"},{value:"right",label:"Right"}],Yl={rockets:"firework",rocketDistance:"firework",sprayDistance:"fountain",wobble:"bubbles",splash:"rain",spread:"fountain"},Xl=24,Ql=16,es=12,ts=500,os=30,as=30,ns=1e4,is={Confetti:{glyphs:"▪●▲■◆",colors:["#ff4d4d","#ffd84d","#4dff88","#4dc3ff","#d24dff"],colorSource:"theme",useNickname:!1,motion:"fall",direction:"down",gravity:"down",amount:80,size:14,duration:3,easing:"linear",spin:360,drift:60,stagger:40,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Snow:{glyphs:"❄❅❆•",colors:["#ffffff","#cfe8ff"],colorSource:"theme",useNickname:!1,motion:"fall",direction:"down",gravity:"down",amount:50,size:16,duration:5,easing:"linear",spin:90,drift:100,stagger:50,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Stars:{glyphs:"★✦✧☆",colors:["#fff6a0","#ffd84d","#ffffff"],colorSource:"theme",useNickname:!1,motion:"burst",direction:"down",gravity:"down",amount:40,size:18,duration:3,easing:"ease-out",spin:360,drift:0,stagger:15,fadeOut:!0,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Hearts:{glyphs:"♥❤",colors:["#ff4d8d","#ff8fb8","#ff2d55"],colorSource:"theme",useNickname:!1,motion:"fall",direction:"down",gravity:"up",amount:30,size:20,duration:4,easing:"ease-in",spin:30,drift:60,stagger:40,fadeOut:!0,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Fireworks:{glyphs:"✦✧•*+",colors:["#ffd84d","#ff4d8d","#4dc3ff","#ffffff"],colorSource:"theme",useNickname:!1,motion:"firework",direction:"up",gravity:"down",amount:150,size:18,duration:2.5,easing:"ease-out",spin:180,drift:20,stagger:30,fadeOut:!0,rockets:4,rocketDistance:35,sprayDistance:50,wobble:30,splash:!0,spread:40},Bubbles:{glyphs:"○◯°o",colors:["#cfe8ff","#9fd4ff","#ffffff"],colorSource:"theme",useNickname:!1,motion:"bubbles",direction:"down",gravity:"down",amount:30,size:20,duration:5,easing:"ease-out",spin:0,drift:20,stagger:50,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Rain:{glyphs:"│|,",colors:["#9fd4ff","#4dc3ff","#cfe8ff"],colorSource:"theme",useNickname:!1,motion:"rain",direction:"down",gravity:"down",amount:100,size:16,duration:3,easing:"ease-in",spin:0,drift:40,stagger:70,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Fountain:{glyphs:"•∙·*",colors:["#4dc3ff","#9fd4ff","#ffffff"],colorSource:"theme",useNickname:!1,motion:"fountain",direction:"up",gravity:"down",amount:80,size:14,duration:4,easing:"linear",spin:90,drift:0,stagger:70,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},Starfield:{glyphs:"·•✦*",colors:["#ffffff","#fff6a0","#cfe8ff"],colorSource:"theme",useNickname:!1,motion:"zoom",direction:"down",gravity:"down",amount:80,size:12,duration:3,easing:"ease-in",spin:0,drift:0,stagger:60,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40},"Matrix Rain":{glyphs:"01アイウエオカキクケコ",colors:["#00ff41","#00c832"],colorSource:"theme",useNickname:!1,motion:"fall",direction:"down",gravity:"down",amount:70,size:14,duration:3,easing:"ease-in",spin:0,drift:0,stagger:60,fadeOut:!1,rockets:4,rocketDistance:50,sprayDistance:50,wobble:30,splash:!0,spread:40}},rs="Confetti",ls=[{value:"theme",label:"Cyberspace theme"},{value:"nickTheme",label:"Nick colors theme"},{value:"nick",label:"Choom's nick color"},{value:"custom",label:"Custom"}],ss=12,cs="best";let ds=Cs(null);function hs(e){const t=Object.hasOwn(is,e)?is[e]:us(e).effect;return{...t,colors:[...t.colors]}}function ps(){return[...Object.keys(is),...ds.presets.map(e=>e.name)]}function us(e){return ds.presets.find(t=>t.name.toLowerCase()===e.toLowerCase())}function gs(e){return Object.keys(is).some(t=>t.toLowerCase()===e.toLowerCase())}function ms(e){return"string"==typeof e?e.replace(/[\s\u0000-\u001f\u007f]+/g," ").trim():""}function bs(e){return e?e.length>as?`Use ${as} characters or fewer.`:gs(e)?`${e} is a built-in preset. Pick another name.`:!us(e)&&ds.presets.length>=os?`You can save up to ${os} presets. Delete one first.`:null:"Type a name for the preset."}function fs(e,t,o){if("number"!=typeof e||!Number.isFinite(e))return o;const a=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,a))}function ys(e){if("string"!=typeof e)return"";const t=[];for(const o of So(e.replace(/[\s\u0000-\u001f\u007f]+/g,"")))if(o.length<=Ql&&t.push(o),t.length===Xl)break;return t.join("")}function vs(e){return"string"==typeof e&&/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(e)}function ws(e){return/^#[0-9a-f]{3}$/i.test(e)?"#"+e.slice(1).split("").map(e=>e+e).join(""):e}function ks(e){const t=hs(rs);if(!e||"object"!=typeof e)return t;const o="rise"===e.motion?"fall":Jl.some(t=>t.value===e.motion)?e.motion:t.motion;return{glyphs:ys(e.glyphs)||t.glyphs,colors:Array.isArray(e.colors)?e.colors.filter(vs).slice(0,es):t.colors,colorSource:ls.some(t=>t.value===e.colorSource)?e.colorSource:!0===e.useNickColor?"nick":!1===e.matchTheme?"custom":t.colorSource,useNickname:"boolean"==typeof e.useNickname?e.useNickname:t.useNickname,motion:o,direction:Ss(o).direction?xs(e.direction)?e.direction:Ss(o).direction:Kl[0].value,gravity:Ss(o).gravity?xs(e.gravity)?e.gravity:"rise"===e.motion?"up":"fall"===o&&xs(e.direction)?e.direction:Kl[0].value:Kl[0].value,amount:fs(e.amount,_l.amount,t.amount),size:fs(e.size,_l.size,t.size),duration:fs(e.duration,_l.duration,t.duration),easing:Zl.some(t=>t.value===e.easing)?e.easing:t.easing,spin:Ss(o).spins?fs(e.spin,_l.spin,t.spin):0,drift:Ss(o).drifts?fs(e.drift,_l.drift,t.drift):0,stagger:fs(e.stagger,_l.stagger,t.stagger),fadeOut:!!Ss(o).fades&&("boolean"==typeof e.fadeOut?e.fadeOut:t.fadeOut),...Object.fromEntries(Object.entries(Yl).map(([a,n])=>[a,n!==o?t[a]:"boolean"==typeof t[a]?"boolean"==typeof e[a]?e[a]:t[a]:fs(e[a],_l[a],t[a])]))}}function xs(e){return Kl.some(t=>t.value===e)}function Ss(e){return Jl.find(t=>t.value===e)}function Cs(e){const t={},o=e&&"object"==typeof e&&e.users&&"object"==typeof e.users?e.users:{};for(const[e,a]of Object.entries(o)){if(Object.keys(t).length===ts)break;const o=e.toLowerCase();fo(e)&&!(o in Object.prototype)&&a&&"object"==typeof a&&(t[o]=ks(a))}const a=[];for(const t of Array.isArray(e?.presets)?e.presets:[]){if(a.length===os)break;const e=ms(t?.name);!e||e.length>as||!t.effect||"object"!=typeof t.effect||a.some(t=>t.name.toLowerCase()===e.toLowerCase())||a.push({name:e,effect:ks(t.effect)})}const n=new Set(Object.keys(is).concat(a.map(e=>e.name)).map(e=>e.toLowerCase())),i=a.map(({name:e,effect:t})=>{if(!gs(e))return{name:e,effect:t};let o=e;for(let t=2;n.has(o.toLowerCase());t++)o=`${e.slice(0,as-String(t).length-1)} ${t}`;return n.add(o.toLowerCase()),{name:o,effect:t}});return{playFor:ia(e?.playFor)?e.playFor:cs,onNotify:"boolean"!=typeof e?.onNotify||e.onNotify,default:ks(e?.default),users:t,presets:i}}function $s(e){const t=e=>{const t=ks(e);return"custom"!==t.colorSource&&delete t.colors,JSON.stringify(t)},o=t(e);return ps().find(e=>t(hs(e))===o)??null}function As(){try{ds=Cs(JSON.parse(C("nickEffects","null")))}catch(e){ds=Cs(null)}}function Es(e){ds=Cs(e),S("nickEffects",JSON.stringify(ds))}function Ls(e){return na(ds.playFor,ha(e))}function Ns(e){const t=e.toLowerCase();return Object.hasOwn(ds.users,t)?ds.users[t]:ds.default}function Ts(){const e=Object.keys(ds.users).length;return`${e} ${1===e?"user":"users"} with their own effect`}As();const js=F("effect"),Os="choom",Ms=".messages-scroller",Ds=.55,Is=.35,Fs=.8,zs=1.2,qs=.6,Rs=.2,Hs=4e3;function Bs(e,t){return e+Math.random()*(t-e)}function Vs(e){const t=e.toLowerCase();return Array.from(document.querySelectorAll(io)).find(e=>vo(e).toLowerCase()===t)}function Us(e){return e?getComputedStyle(e).color:null}function Ps(e,t){const{width:o,height:a}=t,n="down"===e||"up"===e;return{length:n?a:o,breadth:n?o:a,point:{down:(e,t)=>({x:e,y:t}),up:(e,t)=>({x:e,y:a-t}),right:(e,t)=>({x:t,y:e}),left:(e,t)=>({x:o-t,y:e})}[e]}}function Gs(e,t,o,a){const n=1e3*e.duration,{width:i,height:r}=t,l=Bs(-e.spin,e.spin),s=Bs(-e.drift,e.drift),c=Bs(0,e.stagger/100)*n,d=(n-c)*Bs(Ds,1),h=Zl.find(t=>t.value===e.easing).css,p=e.fadeOut?0:1,u=Ws(e.gravity),g=(e,t,o)=>({x:e.x+u.x*t+u.y*o,y:e.y+u.y*t+u.x*o});if(a){const o=Ps(e.direction,t),c=Bs(0,2*Math.PI),d=Bs(.1,.3)*Math.min(i,r),p=o.point(a.across,a.peak),u={x:Math.cos(c)*d,y:Math.sin(c)*d},m=n-a.delay,b=Bs(Fs,1),f=Is/b,y=t=>{const o=1-(1-t)**3;return{transform:_s(g({x:p.x+u.x*o,y:p.y+u.y*o},d*zs*t*t,s*t),l*t,String(tt.classList.remove(e),Hs)}const r=t?.getBoundingClientRect(),l=r&&r.left+r.width/2-a.left,s=r&&r.top+r.height/2-a.top,c=r&&r.width&&l>=0&&l<=a.width&&s>=0&&s<=a.height?{x:l,y:s}:{x:a.width/2,y:a.height/2},d=Co(e.useNickname?n:e.glyphs),h=Zs(e,o),p=document.createElement("div");p.className=js,p.classList.toggle(F("effect-over-dialogs"),i),Object.assign(p.style,{left:`${a.left}px`,top:`${a.top}px`,width:`${a.width}px`,height:`${a.height}px`}),p.setAttribute("aria-hidden","true");const u="firework"===e.motion?hc(e,a):null,g=u&&h.length?gc(h):null;for(let t=0;to.remove())}document.body.append(p),setTimeout(()=>p.remove(),1e3*e.duration+100)}const Qs=.45,ec=.4,tc=.5,oc=10,ac=.7;function nc(e){return 2*e.size}function ic(e,t){return t.map(t=>{const{point:o,rotate:a,scale:n,opacity:i}=e(t);return{transform:_s(o,a,n),opacity:i,offset:t}})}function rc(e){return Array.from({length:e+1},(t,o)=>o/e)}const lc={fall:{speed:1,keyframes(e,t,{spin:o,drift:a,endOpacity:n}){const i=Ps(e.gravity,t),r=Bs(0,i.breadth),l=-nc(e),s=i.length+nc(e);return ic(e=>({point:i.point(r+a*e,l+(s-l)*e),rotate:o*e,scale:"1",opacity:e<1?1:n}),[0,ac,1])}},bubbles:{speed:1,keyframes(e,t,{spin:o,drift:a}){const n=Ps(e.gravity,t),i=Bs(0,n.breadth),r=n.length+nc(e),l=n.length*Bs(.1,.4),s=Bs(1.5,3),c=Bs(0,2*Math.PI);return ic(t=>{const d=Math.min(t/.9,1);return{point:n.point(i+a*d+e.wobble*Math.sin(c+d*s*Math.PI*2),r+(l-r)*d),rotate:o*d,scale:t<1?"1":"1.6",opacity:t<1?1:0}},[...rc(oc).map(e=>.9*e),1])}},rain:{speed:Qs,keyframes(e,t,{drift:o}){const a=Ps(e.gravity,t),n=Bs(0,a.breadth),i=-nc(e),r=e.splash?a.length-e.size:a.length+nc(e),l=a.point(n,i),s=a.point(n+o,r),c=-180*Math.atan2(s.x-l.x,s.y-l.y)/Math.PI,d=[[0,{point:l,rotate:c,scale:"1",opacity:1}]];e.splash?(d.push([.85,{point:s,rotate:c,scale:"1",opacity:1}]),d.push([1,{point:s,rotate:c,scale:"2, 0.2",opacity:0}])):d.push([1,{point:s,rotate:c,scale:"1",opacity:1}]);const h=new Map(d);return ic(e=>h.get(e),d.map(([e])=>e))}},fountain:{speed:1,keyframes(e,t,{spin:o,drift:a}){const n=Ps(e.direction,t),i=Ws(e.gravity),r=nc(e),l=-r,s=n.length*(e.sprayDistance/100+Bs(-cc,cc))-l,c=Bs(-e.spread/2,e.spread/2)*Math.PI/180,d=s/(ec*ec),h=2*d*ec,p=h*Math.tan(c)+a,u=e=>n.point(n.breadth/2+p*e,l+h*e),g=u(1),m=i.x?g.x*i.x:g.y*i.y,b=i.x?i.x>0?t.width:0:i.y>0?t.height:0,f=Math.max(d,b*(i.x||i.y)+r+1-m),y=e=>{const t=u(e);return{x:t.x+i.x*f*e*e,y:t.y+i.y*f*e*e}},v=rc(oc),w=v.find(e=>{return e>0&&((o=y(e)).x<=-r||o.y<=-r||o.x>=t.width+r||o.y>=t.height+r);var o})??1,k=w*tc;return ic(t=>({point:y(t),rotate:o*t,scale:"1",opacity:e.fadeOut?Math.min(1,Math.max(0,(w-t)/(w-k))):1}),v)}},zoom:{speed:1,keyframes(e,t,{spin:o,endOpacity:a}){const n=t.width/2,i=t.height/2,r=Bs(0,2*Math.PI),l=Math.hypot(t.width,t.height)/2+2*nc(e),s=Bs(0,.15)*l;return ic(e=>{const t=s+(l-s)*e;return{point:{x:n+Math.cos(r)*t,y:i+Math.sin(r)*t},rotate:o*e,scale:String(.1+1.9*e),opacity:0===e?0:e<1?1:a}},[0,.2,1])}}},sc=.1,cc=sc,dc=.3;function hc(e,t){const o=e.rockets,a=e.stagger/100*e.duration*1e3,n=Ps(e.direction,t),i=1===o?0:a/(o-1),r=gc(Array.from({length:o},(e,t)=>t));return Array.from({length:o},(t,l)=>({across:n.breadth*(l+Bs(.3,.7))/o,peak:n.length*Bs(-sc,sc)+n.length*e.rocketDistance/100,delay:Math.min(a,Math.max(0,i*(r[l]+Bs(-dc,dc))))}))}const pc={h:10,s:10,l:10};function uc(e){const t=ws(e),o=ue(t,"hsl");if(!o)return e;const a=String(t).match(/^(?:rgba|hsla)\([^)]*,\s*([\d.]+)\s*\)$/i)?.[1],n=(e,t,o)=>Math.min(o,Math.max(0,e+Bs(-t,t))),i=`${((o.h+Bs(-pc.h,pc.h)+360)%360).toFixed(1)}, ${n(o.s,pc.s,100).toFixed(1)}%, ${n(o.l,pc.l,100).toFixed(1)}%`;return void 0===a?`hsl(${i})`:`hsla(${i}, ${a})`}function gc(e){const t=e.slice();for(let e=t.length-1;e>0;e--){const o=Math.floor(Math.random()*(e+1));[t[e],t[o]]=[t[o],t[e]]}return t}function mc(e,t,o){Eo(Dl+" Playing for:",e);const a=Vs(e);Xs(Ns(e),t,Us(a),o,bc(e,a))}function bc(e,t){return t?vo(t):e}let fc=null,yc="",vc=new Set;const wc=new Map,kc=new Map,xc=new WeakMap;let Sc=-1/0;const Cc=new Map,$c=new WeakSet;let Ac=null;const Ec="nickEffectsOwnUsername";let Lc=null,Nc=-1/0;const Tc=6e4;function jc(){const e=C(Ec,null);Ac="string"==typeof e&&fo(e)?e.toLowerCase():null}function Oc(e,t,o){const a=t=>o-(t.get(e)??-1/0){fo(e)&&(Ac=e.toLowerCase(),C(Ec,null)!==Ac&&S(Ec,Ac))},e=>Eo(Dl+" Could not tell who is signed in:",e.message)).finally(()=>{Lc=null}))}function qc(){if(fc?.isConnected)return fc;const e=Array.from(document.querySelectorAll("div.uppercase")).find(e=>Il.test(e.textContent.trim()));return e?.nextElementSibling??null}function Rc(e){const t=new Map;for(const o of e.querySelectorAll("a[href]")){const e=o.getAttribute("href").match(/^\/([^/?#]+)$/);e&&fo(e[1])&&t.set(e[1].toLowerCase(),o)}return t}function Hc(){const e=qc();if(!e)return void(fc=null);const t=Rc(e),o=[...t.keys()].filter(e=>!vc.has(e)),a=e!==fc||location.pathname!==yc||!vc.size,n=Date.now();if(!a)for(const e of vc)t.has(e)||wc.set(e,n);if(fc=e,yc=location.pathname,vc=new Set(t.keys()),o.length&&No.nickEffects&&Eo(Dl+` New on the Online list: ${o.join(", ")}`+(a?" (first read of this list: already here)":o.length>Wl?" (too many at once: taken for a reload)":"")),!(a||o.length>Wl)&&No.nickEffects)for(const e of o)Oc(e,t.get(e),n)}function Bc(e,t){const o=e.closest(Hl);if(!o)return`not in a ${Hl} row`;if(o.querySelector("a[href]"))return"its row has a link, as a typed message does";const a=xc.get(o.parentElement);if(void 0===a)return"its chat is new";if(t-ae.textContent.trim().match(Ul)).find(Boolean);if(!n)return null;const[i,r,l]=n.slice(1).map(Number),s=1e3*(60*(60*i+r)+l),c=new Date(t),d=1e3*(60*(60*c.getHours()+c.getMinutes())+c.getSeconds()),h=Math.abs(d-s);return Math.min(h,864e5-h)>Pl?`stamped ${n[0]}, not about now`:null}function Vc(e,t){for(const o of e){if(!(o instanceof Element))continue;const e=o.matches(Hl)?[o]:o.querySelectorAll(Hl);for(const o of e)o.parentElement&&!xc.has(o.parentElement)&&xc.set(o.parentElement,t)}}function Uc(e,t,o){const a=new Map;for(const t of e){const e=Array.from(t.removedNodes).filter(e=>e instanceof Element&&e.matches(Hl)).length;e&&t.target instanceof Element&&a.set(t.target,(a.get(t.target)??0)+e)}const n=new Set(t);for(const[e,t]of a)(!Array.from(e.children).some(e=>e.matches(Hl)&&!n.has(e))||t>Vl)&&xc.set(e,o)}function Pc(e){const t=e.filter(e=>e instanceof Element),o=t.reduce((e,t)=>e+1+t.getElementsByTagName("*").length,0);if(!t.length)return[];if(o>zl)return $o&&t.some(e=>/ joined/.test(e.textContent))&&Eo(Dl+` A join line came in a change of ${o} elements, over ${zl}: taken for history`),[];const a=[];for(const e of t)for(const t of[e,...e.querySelectorAll("span")]){if("SPAN"!==t.tagName)continue;const e=t.textContent.trim().match(Fl);e&&fo(e[1])&&a.push({name:e[1].toLowerCase(),line:t})}if($o&&!a.length){const e=t.map(e=>e.textContent.trim()).find(e=>/ joined/.test(e));e&&Eo(Dl+' Text with "joined" that is not a join line:',JSON.stringify(e.slice(0,120)))}return a}function Gc(e){const t=Date.now(),o=e.flatMap(e=>Array.from(e.addedNodes));Uc(e,o,t);const a=No.nickEffects?Pc(o).filter(({name:e,line:o})=>{const a=Bc(o,t);return a&&Eo(Dl+` Join line for ${e} skipped: ${a}`),!a}):[];if(Vc(o,t),a.length>Wl)Eo(Dl+` ${a.length} join lines at once: taken for a reload`);else for(const{name:e,line:o}of a)Oc(e,o,t)}function Wc(){let e=!1,t=[];new MutationObserver(o=>{Gc(o),No.nickEffects&&t.push(...Fc(o.flatMap(e=>Array.from(e.addedNodes)))),e||(e=!0,setTimeout(()=>{e=!1,Hc();const o=Date.now();for(const e of t){const t=Ic(e);t&&Dc(t.name,t.element,o)}t=[]},0))}).observe(document.documentElement,{childList:!0,subtree:!0}),Vc([document.documentElement],Date.now()),Fc([document.documentElement]),Hc(),Eo(Dl+" Watching the cIRC user list, join lines and notifications")}function _c(e){return{any:Jl.filter(e).map(e=>({field:"motion",is:e.value}))}}function Zc(e,t){let o=[...e];const a=document.createElement("fieldset");a.className=F("effect-colors");const n=document.createElement("legend");n.textContent="Colors";const i=document.createElement("div"),r=document.createElement("div");r.className="hint",r.setAttribute("role","status"),r.setAttribute("aria-live","polite");const l=document.createElement("button");function s(){i.textContent="",i.append(_(o.map((e,a)=>{const n=`Color ${a+1}`,c=document.createElement("input");c.type="color",c.value=ws(e),c.setAttribute("aria-label",n),c.dataset.entryControl="picker";const d=document.createElement("input");d.type="text",d.value=e,d.spellcheck=!1,d.setAttribute("aria-label",`${n} hex code`),d.dataset.entryControl="hex";const h=e=>{o[a]=e,r.textContent="",t([...o])};c.addEventListener("input",()=>{d.value=c.value,h(c.value)}),d.addEventListener("change",()=>{const e=d.value.trim().replace(/^#?/,"#").toLowerCase();if(!vs(e))return r.textContent=`${n} kept ${o[a]}: "${d.value.trim()}" is not a hex code, such as #ff4d4d or #f00.`,void(d.value=o[a]);d.value=e,c.value=ws(e),h(e)});const p=W(G,`Remove ${n.toLowerCase()}`,()=>{o=o.filter((e,t)=>t!==a),r.textContent="",t([...o]),Z(i,s,String(a),l)},"danger");return p.dataset.entryControl="remove",{key:String(a),parts:[c,d,p]}}),"No colors.")),l.disabled=o.length>=es}return l.type="button",l.className=F("inline-btn"),l.textContent="+ Add color",l.addEventListener("click",()=>{o=[...o,o.at(-1)??is[rs].colors[0]],t([...o]),s(),i.querySelector('li:last-child [data-entry-control="picker"]').focus()}),a.append(n,i,r,l),s(),a}function Jc(e,t){return Array.from(e?.querySelectorAll("[data-effect-preset]")??[]).find(e=>e.dataset.effectPreset===t)}function Kc(e,t){const o=I("preset-name"),a=I("preset-name-error"),n=X({title:"Save Preset",width:"360px",onHelp:null,warning:"",attribution:[],content:`\n\t\t\t${q({type:"text",label:"Preset name",id:o,value:e,stacked:!0})}\n\t\t\t`,buttons:[{label:"CANCEL",class:"cancel",onClick:e=>e()},{label:"SAVE",class:"save",onClick:e=>{const o=ms(i.value),a=bs(o);if(a)return r.textContent=a,i.setAttribute("aria-invalid","true"),void i.focus();e(),t(o)}}]}),i=n.querySelector("#"+o),r=n.querySelector("#"+a);i.maxLength=as,i.setAttribute("aria-describedby",a),i.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),n.querySelector(`.${F("dialog-footer")} button.save`).click())}),i.focus(),i.select()}function Yc(e,t,o){zc(Date.now());const a=o??(Ac&&bc(Ac,Vs(Ac)))??Os,n=t.closest("."+F("dialog")),i=(n&&Ys(n))??Ks(t);Xs(e,t,Us(Vs(a)),i,a,!0)}function Xc(e,t,o,a,{buttons:n=null,picked:i=null}={}){e.textContent="";let r=t;const l=(t,i)=>Xc(e,t,o,a,{buttons:n,picked:i}),s=(e,t)=>{const o=document.createElement("button");return o.type="button",o.className=F("inline-btn",`effect-${t}`),o.textContent=e,o},c=n?.preview??s("Preview","preview"),d=n?.savePreset??s("Save preset","save-preset"),h=document.createElement("fieldset");h.className=F("effect-presets","chip-row");const p=document.createElement("legend");p.textContent="Presets",h.append(p);const u=ps().map(t=>{const a=document.createElement("button");if(a.type="button",a.className=F("chip"),a.dataset.effectPreset=t,a.textContent=t,a.addEventListener("click",()=>{o(hs(t)),l(hs(t),t),Jc(e,t).focus()}),Object.hasOwn(is,t))return h.append(a),a;const n=document.createElement("span");return n.className=F("effect-saved-preset"),n.append(a,W(G,`Delete preset ${t}`,()=>J({title:"Delete Preset",message:`Delete the preset ${z(t)}? Effects already set from it keep their settings.`,confirmLabel:"DELETE",onConfirm:()=>{Es({...ds,presets:ds.presets.filter(e=>e.name!==t)}),g(null)}}),"danger")),h.append(n),a});function g(t){Ot(e)||Ft(od),l(r,t??i),(t&&Jc(e,t)||n?.savePreset||e.querySelector("."+F("effect-save-preset"))).focus()}d.onclick=()=>Kc(i&&us(i)?i:"",e=>{const t=()=>{const t=ds.presets.filter(t=>t.name.toLowerCase()!==e.toLowerCase()),o=ds.presets.findIndex(t=>t.name.toLowerCase()===e.toLowerCase()),a={name:e,effect:ks(r)};t.splice(-1===o?t.length:o,0,a),Es({...ds,presets:t}),g(e)};if(!us(e))return t();J({title:"Replace Preset",message:`Replace the preset ${z(us(e).name)} with these settings?`,confirmLabel:"REPLACE",tone:"caution",onConfirm:t})});const m=()=>{const e=$s(r);u.forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.effectPreset===e)))};m(),c.onclick=()=>Yc(r,c,a);const b=document.createElement("div");b.className=F("effect-form"),e.append(h,b);const f=nt({container:b,inlineSliders:!0,values:r,schema:[{type:"section",label:"Effect",noHr:!0,fields:[{key:"useNickname",type:"toggle",label:"Use their nick name as the characters"},{key:"glyphs",type:"text",label:"Custom characters",placeholder:is[rs].glyphs,sub:!0,showWhen:{field:"useNickname",is:!1}},{key:"colorSource",type:"select",label:"Effect character colors match",options:ls},{key:"colors",type:"custom",sub:!0,showWhen:{field:"colorSource",is:"custom"},render:(e,t)=>Zc(e,e=>t.setFieldValue("colors",e))},{key:"motion",type:"select",label:"Animation effect",options:Jl},{key:"gravity",type:"select",label:"Gravity direction",options:Kl,sub:!0,showWhen:_c(e=>e.gravity)},{key:"direction",type:"select",label:"Launch direction",options:Kl,sub:!0,showWhen:_c(e=>e.direction)},{key:"rockets",type:"slider",label:"Rocket count",..._l.rockets,sub:!0,showWhen:{field:"motion",is:Yl.rockets}},{key:"rocketDistance",type:"slider",label:"Rocket distance (%)",..._l.rocketDistance,sub:!0,showWhen:{field:"motion",is:Yl.rocketDistance}},{key:"sprayDistance",type:"slider",label:"Spray distance (%)",..._l.sprayDistance,sub:!0,showWhen:{field:"motion",is:Yl.sprayDistance}},{key:"wobble",type:"slider",label:"Wobble (px)",..._l.wobble,sub:!0,showWhen:{field:"motion",is:Yl.wobble}},{key:"splash",type:"toggle",label:"Splash where it lands",sub:!0,showWhen:{field:"motion",is:Yl.splash}},{key:"spread",type:"slider",label:"Spread (degrees)",..._l.spread,sub:!0,showWhen:{field:"motion",is:Yl.spread}},{key:"amount",type:"slider",label:"Particle/Character count",..._l.amount},{key:"size",type:"slider",label:"Character Size (px)",..._l.size},{key:"duration",type:"slider",label:"Animation length (sec)",..._l.duration},{key:"easing",type:"select",label:"Animation easing",options:Zl},{key:"spin",type:"slider",label:"Character spin (degrees)",..._l.spin,showWhen:_c(e=>e.spins)},{key:"drift",type:"slider",label:"Drift sideways (px)",..._l.drift,showWhen:_c(e=>e.drifts)},{key:"stagger",type:"slider",label:"Stagger effects (%)",..._l.stagger},{key:"fadeOut",type:"toggle",label:"Fade out",showWhen:_c(e=>e.fades)},...n?[]:[{type:"custom",render:()=>{const e=document.createElement("div");return e.className=F("effect-actions"),e.append(c,d),e}}]]}],onChange:(e,t)=>{if(r=ks({...r,[e]:t}),o(r),m(),"motion"===e){const e={direction:Ss(t).direction??r.direction,gravity:r.gravity,fadeOut:r.fadeOut,spin:r.spin,drift:r.drift,...Object.fromEntries(Object.keys(Yl).map(e=>[e,r[e]]))};for(const[t,o]of Object.entries(e)){const e=f.getField(t);o===r[t]&&o===e.getValue()||e.setValue(o)}}}});f.render()}function Qc(e){ed(e),e.innerHTML='\n\t\t
Changes save as you make them. Per-user effects: right-click or long-press a username and choose Edit Effect. \n\t\t \n\t\tAn effect plays when they join the cIRC room you have open. Using cIRC in the sidebar? Turn on Show joins and leaves in cIRC in the Settings > Content tab, or no effect will play. The effect below is your default effect: pick a preset to start from and customize to your heart\'s content.
\n\t\t\t\n\t\t`,buttons:[{label:"SAVE NOTE",class:"save",onClick:async t=>{let o={key:null,passphrase:null};if(l.checked){const t=c.value;if(t||d.value||!e.key){if(t.lengthasync function(e,t){let o,a,n;try{o=await jn(e)}catch(e){return En("finding the note to save to",e),void alert(`Could not read your Cyberspace notes, so nothing was saved. ${On(e,!1)}`)}try{a=t.passphrase?await async function(e,t){if(t?.backup.encrypted)try{const o=await We(e,Je(t.backup.body));return await Ke(t.backup.body,o),o}catch(e){if(e instanceof TypeError)throw e}return We(e)}(t.passphrase,o):t.key,n=await async function(e){const t=JSON.stringify(tn());return e?`${yn}\n\n${bn}${fn}${wn}\n${await async function(e,{salt:t,key:o}){const a=Qe(12),n=await Ye((new TextEncoder).encode(e),new CompressionStream("gzip")),i=Xe(await crypto.subtle.encrypt({name:"AES-GCM",iv:a,additionalData:new Uint8Array([1])},o,n)),r=new Uint8Array(29+i.length);return r.set([1],0),r.set(t,1),r.set(a,17),r.set(i,29),et(r)}(t,e)}`:`${yn}\n\n${bn}${wn}\n${t}`}(a)}catch(e){return En("locking the settings",e),void alert(`The settings were not saved to Cyberspace. ${e.message}`)}if(n.length>kn)return void alert(a?"Your settings are too big for a Cyberspace note. Use Save Settings File instead.":"Your settings are too big for a Cyberspace note. Encrypting compresses them, and may make them fit; else use Save Settings File.");const i=e=>An(()=>Dn(o,e,n,a));if(!o)return Dn(null,!1,n,a);const r=a&&o.backup.encrypted&&!Mn(o.backup.body,a);if(!a||o.backup.encrypted&&!r){if(o.known)return Dn(o,!1,n,a);J({title:"Replace the backup note?",message:"There is a settings backup note on Cyberspace that this browser has not saved or loaded. Saving replaces it with this browser's settings. Its earlier versions stay in the note's history on Cyberspace.",confirmLabel:"REPLACE",tone:"caution",onConfirm:()=>i(!1)})}else J({title:"Start a new backup note?",message:`Your backup note's history keeps every version, ${o.backup.encrypted?"some under another passphrase":"some of them unencrypted"}. Saving makes a new encrypted note and deletes the old one, with all its versions. Cyberspace hides a deleted note, though it may keep a copy.`,confirmLabel:"SAVE AND DELETE OLD NOTE",tone:"caution",onConfirm:()=>i(!0)})}(e.id,o))}},{label:"CANCEL",class:"cancel",onClick:e=>e()}]}),l=r.querySelector("#"+t),s=r.querySelector("[data-backup-note-passphrase]"),c=r.querySelector("#"+o),d=r.querySelector("#"+a),h=r.querySelector("#"+n);c.setAttribute("autocomplete","new-password"),d.setAttribute("autocomplete","new-password");const p=()=>{B(l),s.hidden=!l.checked,h.innerHTML=l.checked?"":P("Without a passphrase, anyone who sees this note can read your settings, your notes on other users included: if it is ever published to your journal, or if Cyberspace's data leaks."),l.checked?l.removeAttribute("aria-describedby"):l.setAttribute("aria-describedby",n)};l.addEventListener("change",p),p(),(l.checked?c:l).focus()}()},{type:"button",id:"backup-note-load",label:"Load settings from Cyberspace note",buttonText:"Load from Note",onClick:()=>async function(e){await An(async()=>{const t=await Ln();let o;try{o=await jn(t.id)}catch(e){return En("finding the note to load",e),void alert(`Could not read your Cyberspace notes. ${On(e,!1)}`)}if(o){if(!o.backup.encrypted)return t.encrypted?void J({title:"Load an unencrypted backup?",message:"This browser saved your backup note encrypted, but it is not encrypted now: it was changed on Cyberspace. Load it only if you changed it yourself.",confirmLabel:"LOAD ANYWAY",tone:"caution",onConfirm:()=>An(()=>In(o.id,o.backup.body,null,e,t.key))}):void await In(o.id,o.backup.body,null,e);if(t.key&&Mn(o.backup.body,t.key)){let a;try{a=await Ke(o.backup.body,t.key)}catch(e){return En("opening the note with the remembered key",e),void alert(`The backup note could not be opened. ${e.message}`)}return void await In(o.id,a,t.key,e)}try{Je(o.backup.body)}catch(e){return En("reading the note's lock",e),void alert(`The backup note could not be opened. ${e.message}`)}!function(e,t){const o=I("backup-note-open");let a=!1;const n=X({title:"Load from Note",onClose:()=>{a=!0},width:"400px",onHelp:null,warning:"",attribution:[],content:`\n\t\t\t\n\t\t\t${q({type:"password",stacked:!0,id:o,label:"Passphrase",hint:"The one the settings were saved with. This browser remembers the key it makes, not the passphrase."})}`,buttons:[{label:"LOAD",class:"save",onClick:o=>An(async()=>{let r,l;try{r=await We(n.value,Je(e.backup.body)),l=await Ke(e.backup.body,r)}catch(e){if(a)return;return e instanceof Ge||En("opening the note with the passphrase",e),alert(e.message),void n.focus()}a||(Eo(i+" Backup note: the passphrase opened it"),o(),await In(e.id,l,r,t))})},{label:"CANCEL",class:"cancel",onClick:e=>e()}]}).querySelector("#"+o);n.setAttribute("autocomplete","current-password"),n.focus()}(o,e)}else alert("There is no settings backup note on Cyberspace yet. Choose Save to Note first, on the browser that has your settings.")})}(t)}]},{type:"section",label:"Site Theme",fields:[{type:"hint",text:"Only your custom colors and options from Cyberspace's Appearance settings. Every backup above has them too."},{type:"button",id:"site-theme-copy",label:"Copy the site theme to the clipboard",buttonText:"Copy Site Theme",onClick:()=>function(){const e=ae();e?_t(JSON.stringify(e),"Site theme copied to the clipboard."):alert("This browser has no Cyberspace custom theme. Make one in the site's Appearance settings first.")}()},{type:"button",id:"site-theme-paste",label:"Load a site theme from the clipboard",buttonText:"Paste Site Theme",onClick:()=>Jt(sn,{parse:ln,title:"Paste Site Theme",label:"Paste a site theme from Copy Site Theme, or the site's custom_theme value."})}]},{type:"section",label:"Troubleshooting",fields:[{key:"debugMode",type:"toggle",label:"Debug mode: log details to the console, and show nick colors' calculations",default:!1},{type:"button",id:"debug-save-file",label:"Save the debug log to a file",buttonText:"Save Debug File",onClick:()=>Wt(an(),`atmospheric-modulator-debug-${a()}.txt`)},{type:"button",id:"debug-copy",label:"Copy the debug log to the clipboard",buttonText:"Copy Debug Log",onClick:()=>_t(an(),"Debug log copied to the clipboard.")},{type:"button",id:"report-issue",label:"Send a problem report to @z0ylent",buttonText:"Report Issue",onClick:()=>function(){const t=`Debug: ${function(){const t=[`v${e}`,`Features: ${JSON.stringify(No)}`];for(const e of Mo)if(e.reportSummary)try{t.push(`${e.key}: ${e.reportSummary()}`)}catch(o){t.push(`${e.key}: could not read (${o.message})`)}return t.join(" | ")}()} | Page: ${window.location.href}`,o=I("report-issue"),a=I("report-steps"),n=I("report-errors"),i=X({title:"Report Issue",width:"400px",onHelp:null,warning:"",attribution:[],content:`\n\t\t\t
Describe the problem and how to make it happen. The script's version and settings are sent with it.
\n\t\t\t${q({type:"textarea",id:o,label:"What went wrong? (required)"})}\n\t\t\t${q({type:"textarea",id:a,label:"Steps to make it happen (required)",placeholder:"1. Go to...\n2. Click on...\n3. See error..."})}\n\t\t\t${q({type:"text",id:n,label:"Error messages from the browser console (optional)"})}\n\t\t\t\n\t\t\t\tAlso sent\n\t\t\t\t
${z(t)}
\n\t\t\t\n\t\t\t\n\t\t`,buttons:[{label:"SEND REPORT",class:"save",onClick:e=>async function(e){if(h)return;const o=r.value.trim(),a=s.value.trim(),n=c.value.trim();if(!o)return alert("Describe what went wrong."),void r.focus();if(!a)return alert("List the steps that make it happen."),void s.focus();let i=`[${l} Issue Report] | Issue: ${o} | Steps: ${a}`;n&&(i+=` | Errors: ${n}`),i+=` | ${t}`,h=!0,d.textContent="Sending…";const p=await Qt("z0ylent",i);e(),Xt(p,"z0ylent","Report sent to @z0ylent. Thank you!")}(e)},{label:"CANCEL",class:"cancel",onClick:e=>e()}]}),r=i.querySelector("#"+o),s=i.querySelector("#"+a),c=i.querySelector("#"+n),d=i.querySelector('[role="status"]');let h=!1;r.focus()}()}]},{type:"section",label:"Reset",noHr:!0,fields:[{type:"button",id:"erase-all",danger:!0,label:"Erase every setting, per-name style and note",buttonText:"Erase All Settings",onClick:()=>function(e){J({title:"Erase all settings?",message:"This erases every setting, every per-name style and every note, and cannot be undone. Your Cyberspace site theme is kept. To keep a copy, choose Save Settings File first.",confirmLabel:"ERASE EVERYTHING",tone:"danger",onConfirm:()=>{const t=function(){const e=[];for(const t of Mo)if(t.resetSettings)try{t.resetSettings(t.booted)}catch(o){console.error(i+` Could not reset ${t.key}:`,o),e.push(`${t.key}: ${o.message}`)}for(const e of Object.keys(No))delete No[e];return Object.assign(No,Lo),Oo(),$o=!1,Ao(),S(Cn,"null"),qo(),Ft(_a),Ft(en),e.length?{success:!1,message:`Some settings could not be erased; they may come back on reload. ${e.join(" ")}`}:{success:!0,message:"All settings erased."}}();alert(t.message),e()}})}(o)}]}]}function hn(e){const t=e.closest(`[${lt}]`)?.parentElement??document;Ka(e,dn({onImported:()=>{},onErased:()=>Bt(en,t)}),(e,t)=>{"debugMode"===e&&($o=t,Ao())})}async function pn(t){t.textContent="";const o=document.createElement("p");o.className="hint",o.setAttribute("role","status"),o.textContent="Loading the changelog…",t.append(o);const[a]=await Promise.all([Te(),Le()]);if(function(e,t){const o=Ot(e);if(!o)return;let a=o.querySelector("."+F("settings-badge"));if(!t)return void a?.remove();a||(a=document.createElement("span"),a.className=F("settings-badge"),o.append(a)),a.title=t,a.textContent="";const n=document.createElement("span");n.className=F("settings-badge-text"),n.textContent=` (${t})`,a.append(n)}(t,we?`update to v${we} available`:null),!a?.length)return o.textContent="Could not load the list of changes.",void t.append(gn());o.textContent=we?`Version ${we} is available; you have ${e}.`:!1===we?`You have the latest version, ${e}.`:`Could not check for updates; you have ${e}.`;const n=document.createElement("ul");n.className=F("changelog");for(const{version:e,summary:t}of a){const o=document.createElement("li"),a=document.createElement("strong");a.textContent=`v${e}`,o.append(a,`${un(e)}: ${t}`),n.append(o)}if(t.append(n),we){const e=document.createElement("div");e.innerHTML=q({type:"button",id:I("changelog-update"),label:"Open the new version to install it",buttonText:`Update to v${z(we)}`}),e.querySelector("button").addEventListener("click",()=>window.open(Se(),"_blank")),t.append(e)}t.append(gn())}function un(t){return t===e?" (installed)":$e(t,e)?we&&!$e(t,we)?" (update available)":" (newer)":""}function gn(){const e=document.createElement("p"),t=document.createElement("a");return t.href="https://github.com/z0mbieparade/cyberspace-atmospheric-modulator/blob/main/CHANGELOG.md",t.target="_blank",t.rel="noopener noreferrer",t.textContent="Read the full changelog on GitHub",e.append(t),e}const mn="atmomod",bn="Atmospheric Modulator settings backup v1",fn=", encrypted",yn="# DO NOT PUBLISH OR EDIT\nThis is your Atmospheric Modulator settings backup. Editing it breaks it, and publishing it shows your settings, notes on other users included, to everyone.",vn=1e3,wn=". Load it with Atmospheric Modulator: Settings > AtmoMod > Backup & Troubleshooting > Load from Note.",kn=32768,xn=12,Sn=20,Cn="backupNote";let $n=!1;async function An(e){if(!$n){$n=!0;try{await e()}catch(e){En("a step",e),alert(`Something went wrong with the Cyberspace note. ${e.message} Turn on debug mode and try again to see where in the console.`)}finally{$n=!1}}}function En(e,t){console.error(`${i} Backup note: ${e} failed:`,t)}async function Ln(){let e;try{e=JSON.parse(C(Cn,"null"))}catch(t){e=null}return{id:"string"==typeof e?.id?e.id:null,encrypted:!0===e?.encrypted,key:e?.key?await _e(e.key):null}}async function Nn(e,t,o){const a=o&&(g||f)?await async function({salt:e,key:t}){return{salt:et(e),key:et(Xe(await crypto.subtle.exportKey("raw",t)))}}(o):null;S(Cn,JSON.stringify({id:e,encrypted:t,key:a}))}function Tn(e){if("string"!=typeof e)return null;const t=e.indexOf("\n"+bn),o=e.startsWith(bn)?0:-1!==t&&te===a[t])}catch(e){return!1}var o,a}async function Dn(e,t,o,a){let n,r=e&&!t?e.id:null;try{if(r)try{n=await async function(e,t,o){return Re("PATCH",`/notes/${encodeURIComponent(e)}`,{content:t,topics:o})}(r,o,[mn])}catch(e){if(!(e instanceof qe&&404===e.status))throw e;r=null}r||(n=await async function(e,t){return Re("POST","/notes",{content:e,topics:t})}(o,[mn]))}catch(e){return En("saving the note",e),void alert(`The settings were not saved to Cyberspace. ${On(e,!0)}`)}let l=a?"Settings saved to your Cyberspace note, encrypted.":"Settings saved to your Cyberspace note.";if(t)try{await async function(e){await Re("DELETE",`/notes/${encodeURIComponent(e)}`)}(e.id)}catch(e){e instanceof qe&&404===e.status||(l+=` The old note could not be deleted: delete it on Cyberspace. ${On(e,!1)}`)}if(r=Ue(n)??r,!r){console.warn(i+" Cyberspace saved the note without an ID this version recognizes");const t=await jn(null).catch(()=>null);r=t&&t.id!==e?.id?t.id:null}if(r)try{await Nn(r,!!a,a)}catch(e){En("remembering the note and key",e)}alert(l)}async function In(e,t,o,a,n=null){let r;Eo(i+" Backup note: opened, reading the settings");try{r=on(t)}catch(e){return En("reading the opened settings",e),void alert(`The backup note is damaged. ${e.message}`)}Eo(i+" Backup note: remembering the note and key");try{await Nn(e,!(!o&&!n),o??n)}catch(e){En("remembering the note and key",e)}Eo(i+" Backup note: importing the settings"),nn(r,a),Eo(i+" Backup note: imported")}if(L(o)||E(a))console.log(i+" Excluded, doing nothing.");else{function fh(){var e;!function(){const e=document.createElement("style");e.id="atmo-styles",e.textContent='\ufeff[data-atmo-settings-section]>h3[tabindex="-1"]:focus{outline:none}.atmo-entry-list{list-style:none;margin:0;padding:0}.atmo-entry-list>li{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--spacing-xs) var(--spacing-sm);padding-block:var(--spacing-xs);border-bottom:1px dashed var(--atmo-border)}.atmo-entry-text{flex:1 1 12rem;min-width:0;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.atmo-icon-btn{padding:0 var(--spacing-xs);border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-icon-btn:hover,.atmo-icon-btn:focus,.atmo-icon-btn:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-icon-btn:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-icon-btn,.atmo-dialog .atmo-icon-btn{flex:none;padding:0 var(--spacing-xs)}.atmo-icon-btn{display:inline-flex;align-items:center}.atmo-icon-btn.atmo-danger:hover{--atmo-bare-color: var(--atmo-error)}.atmo-settings-fold{padding:0 0;border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-settings-fold:hover,.atmo-settings-fold:focus,.atmo-settings-fold:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-settings-fold:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-settings-fold,.atmo-dialog .atmo-settings-fold{flex:none;padding:0 0}.atmo-settings-fold{display:inline-flex;align-items:center;gap:.5em;letter-spacing:inherit;text-transform:inherit}.atmo-settings-fold-marker::before{content:"▸"}[aria-expanded=true]>.atmo-settings-fold-marker::before{content:"▾"}.atmo-settings-badge{display:inline-block;width:.5em;height:.5em;border-radius:50%;background:var(--atmo-warn)}.atmo-settings-badge-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;white-space:nowrap}h3:has(>.atmo-settings-fold[aria-expanded=false]){margin-bottom:0}.atmo-dialog-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:999999}.atmo-dialog{background:var(--atmo-bg);border:1px solid var(--atmo-border);color:var(--atmo-fg);max-height:80vh;display:flex;flex-direction:column}.atmo-dialog:focus{outline:none}.atmo-dialog ::-webkit-scrollbar-track{background:var(--atmo-code-bg);border-radius:0px;border:none}.atmo-dialog ::-webkit-scrollbar-thumb{background:var(--atmo-bg);opacity:.5;border-radius:0px;border:none;box-shadow:none}.atmo-dialog ::-webkit-scrollbar-thumb:hover{opacity:.75}.atmo-dialog ::-webkit-scrollbar-thumb:active{opacity:1}.atmo-dialog ::-webkit-scrollbar-corner{background:var(--atmo-bg)}.atmo-dialog ::-webkit-scrollbar-button{background:var(--atmo-bg)}.atmo-dialog *{scrollbar-width:auto;scrollbar-color:var(--atmo-bg) var(--atmo-code-bg)}.atmo-dialog .spacer,.atmo-panel .spacer{flex:1}.atmo-dialog h3,.atmo-panel h3{margin:0;color:var(--atmo-fg);font-size:var(--font-size-base, 1rem);text-transform:uppercase;letter-spacing:.05em}.atmo-dialog h4,.atmo-panel h4{margin:var(--spacing-xs) 0;color:var(--atmo-fg);font-size:var(--font-size-base, 1rem);text-transform:uppercase;letter-spacing:.1em}.atmo-dialog h4:first-child,.atmo-panel h4:first-child{margin-top:0;padding-top:0}.atmo-dialog hr,.atmo-panel hr{border:1px dashed var(--atmo-border);background:rgba(0,0,0,0);height:0;margin:1rem 0}.atmo-dialog .atmo-input-row,.atmo-dialog .atmo-input-row-stacked,.atmo-panel .atmo-input-row,.atmo-panel .atmo-input-row-stacked{padding:var(--spacing-xs) 0;display:flex;flex-direction:row;gap:var(--spacing-sm)}.atmo-dialog .atmo-input-row-stacked,.atmo-panel .atmo-input-row-stacked{flex-direction:column;gap:var(--spacing-xs)}.atmo-dialog .atmo-input-row.no-padding-bottom,.atmo-dialog .atmo-input-row-stacked.no-padding-bottom,.atmo-panel .atmo-input-row.no-padding-bottom,.atmo-panel .atmo-input-row-stacked.no-padding-bottom{padding-bottom:0}.atmo-dialog .atmo-input-row.no-padding-top,.atmo-dialog .atmo-input-row-stacked.no-padding-top,.atmo-panel .atmo-input-row.no-padding-top,.atmo-panel .atmo-input-row-stacked.no-padding-top{padding-top:0}.atmo-dialog .atmo-input-row label,.atmo-panel .atmo-input-row label{font-size:var(--font-size-base);color:var(--atmo-fg)}.atmo-dialog .hint,.atmo-panel .hint{font-size:calc(var(--font-size-base, 1rem)*.875);color:var(--atmo-fg-dim)}.atmo-dialog .buttons,.atmo-panel .buttons{display:flex;gap:var(--spacing-sm);justify-content:flex-end}.atmo-dialog .atmo-sub-setting,.atmo-panel .atmo-sub-setting{margin-left:var(--spacing-sm);padding-left:var(--spacing-sm);border-left:1px dashed var(--atmo-border)}.atmo-dialog .atmo-chip-row,.atmo-panel .atmo-chip-row{display:flex;flex-wrap:wrap;gap:var(--spacing-sm, 0.5rem)}.atmo-dialog button,.atmo-panel button{flex:1 0 auto;padding:var(--spacing-sm)}.atmo-dialog button.atmo-chip,.atmo-panel button.atmo-chip{flex:none;display:inline-flex;align-items:center;gap:.5rem;padding:.25rem .5rem;font:inherit;font-size:calc(var(--font-size-base, 1rem)*.75);border:1px solid var(--atmo-chip-fg, var(--atmo-fg));border-radius:.125rem;cursor:pointer}.atmo-dialog button.atmo-chip,.atmo-dialog button.atmo-chip:hover,.atmo-dialog button.atmo-chip:focus,.atmo-dialog button.atmo-chip:active,.atmo-panel button.atmo-chip,.atmo-panel button.atmo-chip:hover,.atmo-panel button.atmo-chip:focus,.atmo-panel button.atmo-chip:active{background:var(--atmo-chip-bg, transparent) !important;color:var(--atmo-chip-fg, var(--atmo-fg)) !important}.atmo-dialog button.atmo-chip:hover,.atmo-panel button.atmo-chip:hover{border-color:var(--atmo-chip-fg, var(--atmo-fg));text-decoration:underline}.atmo-dialog button.atmo-chip[aria-pressed=true],.atmo-dialog button.atmo-chip[aria-pressed=true]:hover,.atmo-dialog button.atmo-chip[aria-pressed=true]:focus,.atmo-dialog button.atmo-chip[aria-pressed=true]:active,.atmo-panel button.atmo-chip[aria-pressed=true],.atmo-panel button.atmo-chip[aria-pressed=true]:hover,.atmo-panel button.atmo-chip[aria-pressed=true]:focus,.atmo-panel button.atmo-chip[aria-pressed=true]:active{background:var(--atmo-chip-fg, var(--atmo-fg)) !important;border-color:var(--atmo-chip-fg, var(--atmo-fg));color:var(--atmo-chip-bg, var(--atmo-bg)) !important}.atmo-dialog button.atmo-chip .atmo-chip-check,.atmo-panel button.atmo-chip .atmo-chip-check{display:none}.atmo-dialog button.atmo-chip[aria-pressed=true] .atmo-chip-check,.atmo-panel button.atmo-chip[aria-pressed=true] .atmo-chip-check{display:inline}.atmo-dialog button.atmo-chip.atmo-chip-themed,.atmo-panel button.atmo-chip.atmo-chip-themed{box-shadow:0 0 0 1px var(--atmo-fg)}.atmo-dialog button:hover,.atmo-panel button:hover{border-color:var(--atmo-fg-dim)}.atmo-dialog button:focus-visible,.atmo-panel button:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-dialog button.link-brackets,.atmo-panel button.link-brackets{background:none;border:none;padding:0;color:var(--atmo-fg-dim);flex:0 0 auto;text-transform:uppercase}.atmo-dialog button.link-brackets:hover,.atmo-panel button.link-brackets:hover{border-color:var(--atmo-fg)}.atmo-dialog button.link-brackets .inner::before,.atmo-panel button.link-brackets .inner::before{content:"["}.atmo-dialog button.link-brackets .inner::after,.atmo-panel button.link-brackets .inner::after{content:"]"}.atmo-dialog button.atmo-inline-btn,.atmo-panel button.atmo-inline-btn{flex:0 0 auto;padding:.5rem 1rem;font-size:calc(var(--font-size-base)*.875);background:rgba(0,0,0,0);border:1px solid var(--atmo-fg);border-radius:.125rem;color:var(--atmo-fg);cursor:pointer;transition:background-color .15s,color .15s}.atmo-dialog button.atmo-inline-btn:hover,.atmo-panel button.atmo-inline-btn:hover{background:var(--atmo-fg);color:var(--atmo-bg)}.atmo-dialog .atmo-danger .atmo-inline-btn,.atmo-panel .atmo-danger .atmo-inline-btn{color:var(--atmo-error);border-color:var(--atmo-error)}.atmo-dialog .atmo-danger .atmo-inline-btn:hover,.atmo-panel .atmo-danger .atmo-inline-btn:hover{background:var(--atmo-error);border-color:var(--atmo-error);color:var(--atmo-bg)}.atmo-dialog .atmo-dialog-footer button.atmo-danger,.atmo-panel .atmo-dialog-footer button.atmo-danger{color:var(--atmo-error)}.atmo-dialog .atmo-caution .atmo-inline-btn,.atmo-panel .atmo-caution .atmo-inline-btn{color:var(--atmo-warn);border-color:var(--atmo-warn)}.atmo-dialog .atmo-caution .atmo-inline-btn:hover,.atmo-panel .atmo-caution .atmo-inline-btn:hover{background:var(--atmo-warn);border-color:var(--atmo-warn);color:var(--atmo-bg)}.atmo-dialog .atmo-dialog-footer button.atmo-caution,.atmo-panel .atmo-dialog-footer button.atmo-caution{color:var(--atmo-warn)}.atmo-dialog input[type=text],.atmo-dialog input[type=number],.atmo-dialog textarea,.atmo-dialog select,.atmo-panel input[type=text],.atmo-panel input[type=number],.atmo-panel textarea,.atmo-panel select{width:100%;padding:var(--spacing-xs) var(--spacing-sm);background:var(--atmo-bg);border:1px solid var(--atmo-border);color:var(--atmo-fg);font-family:inherit;font-size:var(--font-size-base);box-sizing:border-box}.atmo-dialog input[type=text]:focus-visible,.atmo-dialog input[type=number]:focus-visible,.atmo-dialog textarea:focus-visible,.atmo-dialog select:focus-visible,.atmo-panel input[type=text]:focus-visible,.atmo-panel input[type=number]:focus-visible,.atmo-panel textarea:focus-visible,.atmo-panel select:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-dialog select,.atmo-panel select{appearance:none;padding-right:calc(var(--spacing-sm)*3.5);background-image:linear-gradient(45deg, transparent 50%, var(--atmo-fg) 50%),linear-gradient(135deg, var(--atmo-fg) 50%, transparent 50%);background-position:calc(100% - var(--spacing-sm) - 5px) 50%,calc(100% - var(--spacing-sm)) 50%;background-size:5px 5px;background-repeat:no-repeat;cursor:pointer}.atmo-dialog .atmo-input-row select,.atmo-panel .atmo-input-row select{width:auto;max-width:60%;min-width:0}.atmo-dialog textarea,.atmo-panel textarea{min-height:70px;resize:vertical}.atmo-dialog .atmo-toggle,.atmo-panel .atmo-toggle{display:flex;margin:var(--spacing-xs) 0}.atmo-dialog .atmo-toggle-label,.atmo-panel .atmo-toggle-label{display:inline-flex;align-items:center;gap:.75rem;cursor:pointer;flex-shrink:0}.atmo-dialog .atmo-toggle-value,.atmo-panel .atmo-toggle-value{font-size:var(--font-size-base);color:var(--atmo-fg-dim);text-transform:uppercase;letter-spacing:.05em}.atmo-dialog .atmo-toggle-track,.atmo-panel .atmo-toggle-track{position:relative;width:2.5rem;height:1.25rem;border:1px solid var(--atmo-border);border-radius:var(--radius-md);transition:background-color .15s}.atmo-dialog .atmo-toggle-track.active,.atmo-panel .atmo-toggle-track.active{background:var(--atmo-fg)}.atmo-dialog .atmo-toggle-track:not(.active),.atmo-panel .atmo-toggle-track:not(.active){background:var(--atmo-fg-dim)}.atmo-dialog .atmo-sr-only:focus-visible+.atmo-toggle-label .atmo-toggle-track,.atmo-panel .atmo-sr-only:focus-visible+.atmo-toggle-label .atmo-toggle-track{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-dialog .atmo-sr-only:disabled+.atmo-toggle-label,.atmo-panel .atmo-sr-only:disabled+.atmo-toggle-label{cursor:not-allowed;opacity:.5}.atmo-dialog .atmo-toggle-thumb,.atmo-panel .atmo-toggle-thumb{position:absolute;top:2px;width:1rem;height:.875rem;background:var(--atmo-bg);border-radius:var(--radius-md);transition:transform .15s}.atmo-dialog .atmo-toggle-thumb.pos-start,.atmo-panel .atmo-toggle-thumb.pos-start{transform:translateX(2px)}.atmo-dialog .atmo-toggle-thumb.pos-middle,.atmo-panel .atmo-toggle-thumb.pos-middle{transform:translateX(10px)}.atmo-dialog .atmo-toggle-thumb.pos-end,.atmo-panel .atmo-toggle-thumb.pos-end{transform:translateX(20px)}.atmo-dialog .atmo-sr-only,.atmo-panel .atmo-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;white-space:nowrap}.atmo-dialog .atmo-text-dim,.atmo-panel .atmo-text-dim{color:var(--atmo-fg-dim)}.atmo-dialog .atmo-dialog-attribution,.atmo-panel .atmo-dialog-attribution{width:100%;display:flex;justify-content:right;gap:var(--spacing-xs);border-top:1px dotted var(--atmo-border);margin-top:var(--spacing-xs);padding-top:var(--spacing-xs);font-size:calc(var(--font-size-base)*.875);line-height:calc(var(--font-size-base)*.875);color:var(--atmo-fg-dim)}.atmo-dialog .atmo-dialog-attribution>span,.atmo-panel .atmo-dialog-attribution>span{flex:0 0 auto;border-right:1px solid var(--atmo-border);padding-right:var(--spacing-xs);margin-right:var(--spacing-xs)}.atmo-dialog .atmo-dialog-attribution>span:last-child,.atmo-panel .atmo-dialog-attribution>span:last-child{border-right:none;padding-right:0;margin-right:0}.atmo-dialog .atmo-dialog-attribution a,.atmo-panel .atmo-dialog-attribution a{color:var(--atmo-fg-dim);text-decoration:underline}.atmo-dialog .atmo-dialog-attribution a.github-link,.atmo-panel .atmo-dialog-attribution a.github-link{height:calc(var(--font-size-base)*.875)}.atmo-dialog .atmo-dialog-error,.atmo-dialog .atmo-dialog-warning,.atmo-dialog .atmo-dialog-success,.atmo-dialog .atmo-dialog-info,.atmo-panel .atmo-dialog-error,.atmo-panel .atmo-dialog-warning,.atmo-panel .atmo-dialog-success,.atmo-panel .atmo-dialog-info{font-size:calc(var(--font-size-base)*.875);line-height:calc(var(--line-height-base)*.875);padding:var(--spacing-xs) var(--spacing-sm)}.atmo-dialog .atmo-dialog-error,.atmo-panel .atmo-dialog-error{color:var(--atmo-error);background-color:var(--atmo-error-bg);border:1px dashed var(--atmo-error)}.atmo-dialog .atmo-dialog-warning,.atmo-panel .atmo-dialog-warning{color:var(--atmo-warn);background-color:var(--atmo-warn-bg);border:1px dashed var(--atmo-warn)}.atmo-dialog .atmo-dialog-warning a,.atmo-panel .atmo-dialog-warning a{color:inherit;text-decoration:underline}.atmo-dialog .atmo-dialog-success,.atmo-panel .atmo-dialog-success{color:var(--atmo-success);background-color:var(--atmo-success-bg);border:1px dashed var(--atmo-success)}.atmo-dialog .atmo-dialog-info,.atmo-panel .atmo-dialog-info{color:var(--atmo-info);background-color:var(--atmo-info-bg);border:1px dashed var(--atmo-info)}.atmo-dialog .atmo-flex,.atmo-panel .atmo-flex{display:flex}.atmo-dialog .atmo-flex-wrap,.atmo-panel .atmo-flex-wrap{flex-wrap:wrap}.atmo-dialog .atmo-flex-shrink-0,.atmo-panel .atmo-flex-shrink-0{flex-shrink:0}.atmo-dialog .atmo-items-center,.atmo-panel .atmo-items-center{align-items:center}.atmo-dialog .atmo-justify-between,.atmo-panel .atmo-justify-between{justify-content:space-between}.atmo-dialog .atmo-gap-2,.atmo-panel .atmo-gap-2{gap:var(--spacing-sm)}.atmo-dialog .atmo-gap-3,.atmo-panel .atmo-gap-3{gap:.75rem}.atmo-dialog .atmo-gap-4,.atmo-panel .atmo-gap-4{gap:1rem}.atmo-dialog .atmo-cursor-pointer,.atmo-panel .atmo-cursor-pointer{cursor:pointer}.atmo-dialog-header{padding:var(--spacing-sm);border-bottom:1px solid var(--atmo-border);flex-shrink:0;width:100%;box-sizing:border-box;gap:var(--spacing-sm)}.atmo-dialog-content{padding:var(--spacing-sm);overflow-y:auto;flex:1}.atmo-dialog-preview{padding:var(--spacing-xs) var(--spacing-sm);border-bottom:1px solid var(--atmo-border);flex-shrink:0;background:var(--atmo-code-bg);display:flex;flex-direction:column;gap:var(--spacing-xs)}.atmo-dialog-preview .preview,.atmo-dialog-preview .preview-row{font-size:var(--font-size-base);line-height:var(--line-height-base);margin:0;border:1px solid var(--atmo-border);padding:var(--spacing-xs) var(--spacing-sm);background:var(--atmo-bg);max-height:calc(var(--font-size-h)*2*var(--line-height-base) + var(--spacing-xs)*3);overflow:hidden}.atmo-dialog-preview .preview.preview-inverted,.atmo-dialog-preview .preview-row.preview-inverted{background:var(--atmo-inverted-bg);color:var(--atmo-inverted-fg)}.atmo-dialog-preview .preview-row{display:flex;gap:var(--spacing-xs);flex-wrap:wrap;justify-content:space-around}.atmo-panel .atmo-dialog-preview{flex-flow:row wrap;border-bottom:none}.atmo-panel .atmo-dialog-preview .preview-row{flex:1 1 20rem}.atmo-dialog-footer{padding:var(--spacing-sm);border-top:1px solid var(--atmo-border);flex-shrink:0}.atmo-slider{--thumb-w: 14px;position:relative;isolation:isolate;height:24px;margin:.5rem 0 .25rem}.atmo-slider.atmo-slider-simple{--thumb-w: 10px;height:16px}.atmo-slider.atmo-slider-simple .atmo-slider-track{inset:7px 0;height:2px;border:none;background:var(--atmo-border)}.atmo-slider.atmo-slider-simple .atmo-slider-thumb{top:3px;height:10px;border-radius:50%}.atmo-slider.atmo-slider-split{height:34px}.atmo-slider.atmo-slider-split .atmo-slider-track{top:calc(50% + 1px);bottom:4px}.atmo-slider.atmo-slider-split .atmo-slider-track-mapped{display:block !important}.atmo-slider.atmo-slider-split .atmo-slider-thumb{height:32px}.atmo-slider-track{position:absolute;inset:4px 0;border:1px solid var(--atmo-border);background:var(--atmo-code-bg);box-sizing:border-box}.atmo-slider-track-mapped{display:none;position:absolute;top:4px;bottom:calc(50% + 1px);left:0;right:0;border:1px solid var(--atmo-border);background:var(--atmo-code-bg);box-sizing:border-box}.atmo-slider-input{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;background:rgba(0,0,0,0);opacity:0;appearance:none;z-index:3;cursor:pointer}.atmo-slider-input::-webkit-slider-runnable-track{height:100%;background:rgba(0,0,0,0)}.atmo-slider-input::-moz-range-track{height:100%;background:rgba(0,0,0,0)}.atmo-slider-input::-webkit-slider-thumb{width:var(--thumb-w);height:100%;border:none;border-radius:0;background:rgba(0,0,0,0);cursor:ew-resize;pointer-events:auto;appearance:none}.atmo-slider-input::-moz-range-thumb{width:var(--thumb-w);height:100%;border:none;border-radius:0;background:rgba(0,0,0,0);cursor:ew-resize;pointer-events:auto;appearance:none}.atmo-slider-range .atmo-slider-input{pointer-events:none}.atmo-slider-thumb{position:absolute;top:0;width:var(--thumb-w);height:22px;background:var(--atmo-fg);border:2px solid var(--atmo-bg);outline:1px solid var(--atmo-border);transform:translateX(-50%);z-index:2;display:flex;align-items:center;justify-content:center;font-size:8px;color:var(--atmo-bg);user-select:none;pointer-events:none;box-sizing:border-box}.atmo-slider-input:focus-visible+.atmo-slider-thumb{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-slider-disabled .atmo-slider-input{cursor:default}.atmo-slider-disabled .atmo-slider-thumb{background:var(--atmo-fg-dim)}.atmo-slider-labels{display:flex;justify-content:space-between;font-size:calc(var(--font-size-base, 1rem)*.625);line-height:calc(var(--font-size-base, 1rem)*.625);margin-bottom:var(--spacing-sm)}.atmo-slider-labels,.atmo-slider-labels span,.atmo-slider-labels button{color:var(--atmo-fg-dim)}.atmo-slider-labels button{background:none;border:none;padding:0;font:inherit;cursor:pointer;flex:0 0 auto}.atmo-slider-labels button:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-dialog .atmo-slider-labels .atmo-slider-value-input,.atmo-slider-labels .atmo-slider-value-input{width:4em;text-align:center;font-size:inherit;padding:0 .25em;background:var(--atmo-bg);border:1px solid var(--atmo-border);color:var(--atmo-fg)}.atmo-slider-inline{display:grid;grid-template-columns:1fr minmax(6rem, 12rem) auto;align-items:center;column-gap:var(--spacing-sm);margin-bottom:var(--spacing-sm)}.atmo-slider-inline .atmo-slider,.atmo-slider-inline .atmo-slider-labels{margin:0}.atmo-slider-inline .atmo-slider-labels button{min-width:3ch;text-align:end}.atmo-menu{position:fixed}.atmo-menu:focus:not(:focus-visible){outline:none}.atmo-menu{z-index:999998;display:flex;flex-direction:column;padding:var(--spacing-xs, 0.25rem) 0;background:var(--atmo-bg);border:1px solid var(--atmo-border);color:var(--atmo-fg);font-size:var(--font-size-base, 1rem)}.atmo-menu-item{padding:var(--spacing-xs, 0.25rem) var(--spacing-sm, 0.5rem);background:none;border:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.atmo-menu-item:hover,.atmo-menu-item:focus-visible{background:var(--atmo-fg);color:var(--atmo-bg)}.atmo-menu-item:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px;outline-offset:-2px}.atmo-menu-item[role=menuitemcheckbox]::before{content:"";display:inline-block;width:1.25em}.atmo-menu-item[aria-checked=true]::before{content:"✓";content:"✓"/""}.atmo-menu-separator{margin:var(--spacing-xs, 0.25rem) 0;border-top:1px solid var(--atmo-border)}.atmo-update-banners{position:fixed;top:0;left:0;right:0;z-index:999998;display:flex;flex-direction:column;align-items:center;pointer-events:none}.atmo-update-banners>*{pointer-events:auto}.atmo-update-banner{width:fit-content;max-width:100%;display:flex;align-items:center;gap:var(--spacing-sm, 0.5rem);padding:var(--spacing-xs, 0.25rem) var(--spacing-sm, 0.5rem);background:var(--atmo-warn-bg);color:var(--atmo-warn);border:1px solid var(--atmo-warn);font-size:calc(var(--font-size-base, 1rem)*.875);line-height:calc(var(--line-height-base, 1.5)*.875);transform:translateY(-200%);transition:transform .35s ease-out}.atmo-update-banner.atmo-update-banner-visible{transform:translateY(0)}.atmo-update-banner .atmo-update-banner-text{flex:1 1 auto;min-width:0}.atmo-update-banner .atmo-update-banner-news{margin:0;padding:0;list-style:none}.atmo-update-banner .atmo-update-banner-actions{flex:0 0 auto;display:flex;align-items:center;gap:var(--spacing-sm, 0.5rem)}.atmo-update-banner button.link-brackets{background:none;border:none;padding:0;color:var(--atmo-warn);text-transform:uppercase;cursor:pointer;font-size:inherit;font-family:inherit}.atmo-update-banner button.link-brackets:hover{color:var(--atmo-fg)}.atmo-update-banner button.link-brackets .inner::before{content:"["}.atmo-update-banner button.link-brackets .inner::after{content:"]"}@media(max-width: 480px){.atmo-update-banner{align-items:flex-start;flex-wrap:wrap}}@media(prefers-reduced-motion: reduce){.atmo-update-banner{transition:none}}.atmo-dialog .atmo-dialog-attribution .atmo-version-link,.atmo-panel .atmo-dialog-attribution .atmo-version-link{flex:0 0 auto;padding:0;border:none;background:none;color:var(--atmo-fg-dim);font:inherit;cursor:pointer;transition:color .15s}.atmo-dialog .atmo-dialog-attribution .atmo-version-link:hover,.atmo-panel .atmo-dialog-attribution .atmo-version-link:hover{color:var(--atmo-fg)}.atmo-dialog .atmo-dialog-attribution .atmo-version-link.atmo-update-available,.atmo-panel .atmo-dialog-attribution .atmo-version-link.atmo-update-available{color:var(--atmo-warn);font-weight:bold}.atmo-dialog .atmo-dialog-attribution .atmo-version-link.atmo-update-available:hover,.atmo-panel .atmo-dialog-attribution .atmo-version-link.atmo-update-available:hover{color:var(--atmo-fg)}.atmo-dialog pre,.atmo-dialog div.nc-dialog-debug{max-width:100%;background-color:var(--atmo-code-bg);color:var(--atmo-fg);font-size:calc(var(--font-size-base)*.875);padding:var(--spacing-xs) var(--spacing-sm);border:2px dashed var(--atmo-border)}.atmo-dialog pre{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word}.atmo-dialog div.nc-dialog-debug{display:flex;flex-direction:column;gap:var(--spacing-xs);margin-bottom:var(--spacing-xs)}.atmo-dialog div.nc-dialog-debug>span{display:flex;flex-direction:row;gap:.25rem;width:100%;max-width:100%;min-width:0}.atmo-dialog div.nc-dialog-debug>span>*{flex:0 1 auto}.atmo-dialog div.nc-dialog-debug>span>strong{flex:0 0 auto;font-weight:bold;min-width:7.5rem;text-align:right}.atmo-dialog .nc-debug-color{display:inline-block;padding:0 .25em;font-size:.75em;border:1px solid var(--atmo-border)}.nc-help-content h4{margin:var(--spacing-sm) 0 var(--spacing-xs);padding-top:var(--spacing-xs);border-top:1px dotted var(--atmo-border)}.nc-help-content h4:first-child{margin-top:0;padding-top:0;border-top:none}.nc-help-content p{margin:0 0 var(--spacing-xs);color:var(--atmo-fg-dim);font-size:calc(var(--font-size-base)*.875);line-height:1.4}.nc-help-content ul{margin:0 0 var(--spacing-xs);padding-left:1.25rem;list-style:disc}.nc-help-content li{margin:var(--spacing-xs) 0;color:var(--atmo-fg-dim);font-size:calc(var(--font-size-base)*.875);line-height:1.4}.nc-help-content li strong{color:var(--atmo-fg)}.nc-debug-tooltip{position:fixed;z-index:9999999;background:var(--atmo-bg, #0a0a0a);border:1px solid var(--atmo-border, #333);color:var(--atmo-fg, #e0e0e0);padding:.25rem;font-size:11px;font-family:monospace;max-width:350px;opacity:0;pointer-events:none;transition:opacity .15s;box-shadow:0 2px 8px rgba(0,0,0,.5)}.nc-debug-tooltip.visible{opacity:1}.nc-debug-row{display:flex;gap:var(--spacing-sm);padding:.125rem 0;border-bottom:1px dotted var(--atmo-border, #333)}.nc-debug-row:last-child{border-bottom:none}.nc-debug-label{color:var(--atmo-fg-dim, #888);min-width:90px;flex-shrink:0}.nc-debug-value{color:var(--atmo-fg, #e0e0e0);display:flex;align-items:center;gap:.25rem}.nc-debug-swatch{display:inline-block;width:12px;height:12px;border:1px solid var(--atmo-border, #333);flex-shrink:0}.nc-has-debug{cursor:help}html[data-theme=poetry] [data-mention-colored=true],html[data-theme=poetry] [data-nick-colored=true],body[data-theme=poetry] [data-mention-colored=true],body[data-theme=poetry] [data-nick-colored=true]{border-radius:var(--radius-md)}.atmo-color-name{padding:0 0;border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-color-name:hover,.atmo-color-name:focus,.atmo-color-name:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-color-name:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-color-name,.atmo-dialog .atmo-color-name{flex:none;padding:0 0}.atmo-choom-stars{display:inline-flex;gap:var(--spacing-xs)}.atmo-choom-toggle{padding:0 0;border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-choom-toggle:hover,.atmo-choom-toggle:focus,.atmo-choom-toggle:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-choom-toggle:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-choom-toggle,.atmo-dialog .atmo-choom-toggle{flex:none;padding:0 0}.atmo-choom-toggle{--atmo-bare-color: var(--atmo-fg-muted)}.atmo-choom-toggle[aria-pressed=true]{--atmo-bare-color: var(--atmo-fg)}.nc-settings-preview-label{margin-top:var(--spacing-sm)}.atmo-dialog-preview.nc-settings-preview{position:sticky;top:0;z-index:1;background:linear-gradient(var(--atmo-code-bg), var(--atmo-code-bg)),var(--atmo-bg)}.main:has(.nc-settings-preview){overflow-x:clip;overflow-y:visible}.nn-tooltip{position:fixed;z-index:9999999;background:var(--atmo-bg, #0a0a0a);border:1px solid var(--atmo-border, #333);color:var(--atmo-fg, #e0e0e0);padding:.5rem .75rem;font-size:var(--font-size-base, 12px);font-family:inherit;max-width:300px;white-space:pre-wrap;word-wrap:break-word;opacity:0;visibility:hidden;transition:opacity .15s;box-shadow:0 2px 8px rgba(0,0,0,.5)}.nn-tooltip.visible{opacity:1;visibility:visible}.nn-has-notes{cursor:help}.atmo-note-text{cursor:pointer}.atmo-note-add{padding:0 0;border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-note-add:hover,.atmo-note-add:focus,.atmo-note-add:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-note-add:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-note-add,.atmo-dialog .atmo-note-add{flex:none;padding:0 0}.atmo-note-add{--atmo-bare-color: var(--atmo-fg-muted)}.atmo-world-clock{display:flex;flex-wrap:wrap;gap:var(--spacing-xs) var(--spacing-sm);padding:var(--spacing-xs) var(--spacing-sm);font-size:calc(var(--font-size-base, 1rem)*.875);font-variant-numeric:tabular-nums}.atmo-world-clock-cities,.atmo-world-clock-custom{margin:var(--spacing-sm) 0 0;padding:0;border:0}.atmo-world-clock-cities legend,.atmo-world-clock-custom legend{padding:0;margin-bottom:var(--spacing-xs)}.atmo-world-clock-add{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-xs) var(--spacing-sm);margin-top:var(--spacing-xs)}.atmo-world-clock-add .hint{flex-basis:100%}.atmo-world-clock-add-action{flex-basis:100%;margin-top:var(--spacing-sm);text-align:center}.atmo-effect{position:fixed;z-index:999997;overflow:hidden;pointer-events:none}.atmo-effect-over-dialogs{z-index:1000000}.atmo-effect-glyph{position:absolute;top:0;left:0;line-height:1;will-change:transform,opacity}.atmo-effect-highlight{outline:2px solid currentColor;outline-offset:2px}.atmo-effect-presets{margin:var(--spacing-sm) 0 0;padding:0;border:0}.atmo-effect-presets legend{padding:0;margin-bottom:var(--spacing-xs)}.atmo-effect-form>.atmo-settings-section-wrapper:first-child>.atmo-settings-section>h4{margin-top:calc(var(--spacing-sm)*2)}.atmo-effect-colors{margin:0;padding:0;border:0}.atmo-effect-colors legend{padding:0;margin-bottom:var(--spacing-xs)}.atmo-effect-colors .atmo-entry-list>li{align-items:center}.atmo-effect-colors input[type=color]{width:2rem;height:1.5rem;padding:0;border:1px solid var(--atmo-border);background:none;cursor:pointer}.atmo-effect-colors input[type=color]:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-effect-colors input[type=text]{width:calc(7ch + var(--spacing-sm)*2 + 2px);font-family:monospace}.atmo-effect-form .atmo-sub-setting+.atmo-settings-field:not(.atmo-sub-setting){margin-top:var(--spacing-sm)}.atmo-effect-actions{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);margin-top:var(--spacing-sm)}.atmo-effect-saved-preset{display:inline-flex;align-items:center}.atmo-emoji-button{display:inline-flex;align-items:center;justify-content:center}.atmo-emoji-tabs{display:flex;gap:var(--spacing-sm);margin-bottom:calc(-1*var(--spacing-sm))}.atmo-emoji-tab{padding:0 var(--spacing-xs);border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-emoji-tab:hover,.atmo-emoji-tab:focus,.atmo-emoji-tab:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-emoji-tab:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-emoji-tab,.atmo-dialog .atmo-emoji-tab{flex:none;padding:0 var(--spacing-xs)}.atmo-emoji-tab{--atmo-bare-color: var(--atmo-fg-muted);border-bottom:2px solid rgba(0,0,0,0);margin-bottom:-1px}.atmo-dialog .atmo-emoji-tab{padding:var(--spacing-xs)}.atmo-emoji-tab[aria-selected=true]{--atmo-bare-color: var(--atmo-fg);border-bottom-color:currentColor}.atmo-emoji-group h4{margin:var(--spacing-sm) 0 var(--spacing-xs)}.atmo-emoji-grid{display:flex;flex-wrap:wrap;gap:2px}.atmo-emoji-pick{padding:0 var(--spacing-xs);border:none;background:none;color:var(--atmo-bare-color, currentColor);font:inherit;cursor:pointer}.atmo-emoji-pick:hover,.atmo-emoji-pick:focus,.atmo-emoji-pick:active{background:none !important;color:var(--atmo-bare-color, currentColor) !important}.atmo-emoji-pick:focus-visible{outline:2px solid var(--atmo-fg);outline-offset:2px}.atmo-panel .atmo-emoji-pick,.atmo-dialog .atmo-emoji-pick{flex:none;padding:0 var(--spacing-xs)}.atmo-emoji-pick{line-height:1.4;border:1px solid rgba(0,0,0,0)}.atmo-dialog .atmo-emoji-pick:hover{border-color:var(--atmo-border)}.atmo-emoji-pick[hidden]{display:none}.atmo-emoji-pick-emoji{font-size:1.375em;min-width:1.75em}.atmo-emoji-pick-kaomoji,.atmo-emoji-pick-emoticons{white-space:pre;border-color:var(--atmo-border)}.atmo-dialog .atmo-emoji-pick-kaomoji:hover,.atmo-dialog .atmo-emoji-pick-emoticons:hover{border-color:var(--atmo-fg)}.atmo-emoji-status:empty{display:none}.atmo-emoji-button-apart{margin-right:var(--spacing-sm)}.atmo-changelog{margin:var(--spacing-xs) 0;padding-left:1.25em}.atmo-changelog li{margin-bottom:var(--spacing-xs)}.atmo-revealed{outline:1px solid var(--color-border, #666);object-fit:cover}.atmo-gif-overlay{position:absolute;pointer-events:none}.atmo-user-list>li{display:grid;grid-template-columns:auto minmax(0, 10rem) minmax(0, 1fr) auto auto;align-items:baseline;column-gap:0}.atmo-user-list>li>*{justify-self:start}.atmo-user-col-name{grid-column:2;margin-right:var(--spacing-sm);overflow-wrap:anywhere;text-align:left}.atmo-user-col-mark{grid-column:1;margin-right:var(--spacing-sm)}.atmo-user-col-text{grid-column:3}.atmo-user-col-edit{grid-column:4;margin-left:var(--spacing-xs)}.atmo-user-col-delete{grid-column:5;margin-left:var(--spacing-xs)}.atmo-user-list-actions{margin-top:var(--spacing-sm)}.atmo-sidebar-link,.atmo-mobile-nav-link{color:inherit}.atmo-sidebar-link:focus-visible,.atmo-mobile-nav-link:focus-visible{outline:2px solid currentColor;outline-offset:2px}.atmo-sidebar-link{display:flex;align-items:center;justify-content:flex-start;gap:.5rem;padding-inline:.5rem;font:inherit}.atmo-sidebar-link-icon{display:none;flex-shrink:0}.sidebar-minimized .atmo-sidebar-link{justify-content:center}.sidebar-minimized .atmo-sidebar-link-icon{display:block}.sidebar-minimized .atmo-sidebar-link-label{display:none}.atmo-section-icon{display:inline-block;width:1.25em;height:1.25em;margin-right:.5em;vertical-align:-0.25em}',document.head.appendChild(e)}(),function(){function e(t=0){Eo(i+` tryOpenCompose attempt ${t}, readyState: ${document.readyState}`);let o=null;const a=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1);let n;for(;n=a.nextNode();){const e=n.textContent?.trim()||"";if(e.includes("[C]")&&e.includes("C-Mail")){o=n.parentElement,Eo(i+` Found text node with C-Mail, parent: ${o?.tagName}, text: "${e}"`);break}}if(o){Eo(i+" Found C-Mail button, clicking it:",o),o.click();const e=sessionStorage.getItem(Yt);e&&(sessionStorage.removeItem(Yt),setTimeout(()=>eo(e),300))}else t>30?Eo(i+" Max attempts reached, giving up"):(Eo(i+" C-Mail button not found, retrying in 500ms"),setTimeout(()=>e(t+1),500))}"true"===sessionStorage.getItem(Kt)&&(sessionStorage.removeItem(Kt),Eo(i+" Detected openCompose flag, will try to open compose"),Eo(i+" readyState:",document.readyState),"complete"===document.readyState?(Eo(i+" Page already complete, starting in 1s"),setTimeout(e,1e3)):(Eo(i+" Waiting for load event"),window.addEventListener("load",()=>{Eo(i+" Load event fired, starting in 1s"),setTimeout(e,1e3)})))}(),T&&(T(d,Ya),T("Dump Image Undither Diagnostics",Ua)),document.addEventListener("mouseover",za),document.addEventListener("mouseout",qa),document.addEventListener("focusin",za),document.addEventListener("focusout",qa),j({findTarget:e=>No.unditherImages?Fa(e):null,getDuration:Ra,onHold:Da,onRelease:(e,t)=>{t&&Ia(e)}}),e=`[data-nick-colored]:not([${ao}]), [data-mention-colored]:not([${ao}])`,mo.push(e),function(){let e=null;Vo({label:"Poke",order:90,group:"go",showFor:e=>!N(e),onSelect:async t=>{if(e)alert(`Still poking @${e}. Wait for that to finish.`);else{e=t;try{await async function(e){await Re("POST",`/users/${encodeURIComponent(e)}/poke`)}(t),alert(`Poked @${t}.`)}catch(e){alert(e instanceof ze?`The poke to @${t} may not have gone through. Cyberspace allows one an hour, so trying again may be refused even if it did.`:`Could not poke @${t}. ${e.message}`)}finally{e=null}}}}),Vo({label:"Profile",order:100,group:"go",showFor:e=>!N(e),onSelect:(e,t)=>{t.matches("a")&&t.getAttribute("href")==="/"+e?t.click():window.location.assign("/"+encodeURIComponent(e))}});let t=!1;document.addEventListener("keydown",()=>{t=!0},!0),document.addEventListener("pointerdown",()=>{t=!1},!0),document.addEventListener("contextmenu",e=>{const o=Uo(e);if(!o)return;e.preventDefault();const a=t;Po(o,a?null:{x:e.clientX,y:e.clientY},a)});let o=0;document.addEventListener("click",e=>{Date.now()500,onPress:e=>{e.style.transition="opacity 0.15s, transform 0.15s",e.style.opacity="0.7",e.style.transform="scale(0.97)"},onHold:e=>Po(e,null,!1),onRelease:(e,t)=>{e.style.opacity="",e.style.transform="",t&&(o=Date.now()+600)}})}(),function(){const e={order:20,group:"chooms",showFor:()=>ua()};Vo({...e,label:"★ Choom",checkedFor:e=>ga(e,"choom"),onSelect:e=>ma(e,"choom")}),Vo({...e,order:21,label:"★★ Best choom",checkedFor:e=>ga(e,"best"),onSelect:e=>ma(e,"best")}),Jo({order:5,isShown:ua,usernames:()=>oa.users,parts:ba})}(),ka(),new MutationObserver(ka).observe(document.body,{childList:!0,subtree:!0}),function({label:e,title:t="",hash:o=wt,warning:a="",attribution:n=[]}){document.documentElement.setAttribute(ft,e),document.documentElement.setAttribute(yt,t),document.documentElement.setAttribute(vt,o),document.documentElement.setAttribute(kt,a),document.documentElement.setAttribute(xt,JSON.stringify(n)),document.documentElement.setAttribute(St,M),Vt(),Gt()}({label:s,title:c,hash:"atmomod",warning:Pa,attribution:Ga()}),Nt({key:_a,title:d,description:"Usability features userscript: undither an image, give nicknames a hashed color, keep notes on users, show world times in cIRC, play a silly animation when users join or message you, and insert emojis in your messages. Changes save as you make them.",icon:va("atmo-section-icon"),startsOpen:!0,render:Xa}),Nt({key:Go,title:"Chooms",isShown:Xo,render:Qo}),Nt({key:en,title:h,order:1,render:hn}),Nt({key:"atmospheric-modulator-changelog",title:"Changelog",order:2,render:pn}),Do=!0,zo(),De(),console.log(i+" Loaded. Hover (or press and hold) any dithered image to see the original.")}Aa||(document.addEventListener(Ca.mapped,function(e){let t;try{t=JSON.parse(e.detail)}catch(e){return}if(!Array.isArray(t))return;const[o,a]=t;"string"==typeof o&&/^blob:/.test(o)&&"string"==typeof a&&/^(https?|blob):/.test(a)&&(function(e,t){for($a.delete(e),$a.set(e,t);$a.size>1024;)$a.delete($a.keys().next().value)}(o,a),Eo(Sa+" mapped",a,"->",o),"true"===C(Ba,"")&&S(Ba,""))}),function(e){const t=e.head||e.documentElement;if(!t)return!1;const o=e.createElement("script");try{return o.textContent="("+La.toString()+")(window, "+JSON.stringify(Ca)+');document.currentScript.dataset.atmoRan="1";',t.appendChild(o),"1"===o.dataset.atmoRan}catch(e){return!1}finally{o.remove()}}(document)?Ea="page":(La("undefined"!=typeof unsafeWindow?unsafeWindow:window,Ca),Ea="undefined"!=typeof unsafeWindow?"unsafeWindow":"window"),Aa=!0),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",fh,{once:!0}):fh()}}();