(()=>{vare;e=window.commonIan||(window.commonIan={}),window.addEventListener("load",(function(t){e.icon=document.querySelector('[data-tec-ian-trigger="iconIan"]'),e.sidebar=document.querySelector('[data-tec-ian-trigger="sideIan"]'),e.notifications=document.querySelector('[data-tec-ian-trigger="notifications"]'),e.readAll=document.querySelector('[data-tec-ian-trigger="readAllIan"]'),e.optin=document.querySelector('[data-tec-ian-trigger="optinIan"]'),e.close=document.querySelector('[data-tec-ian-trigger="closeIan"]'),e.empty=document.querySelector('[data-tec-ian-trigger="emptyIan"]'),e.loader=document.querySelector('[data-tec-ian-trigger="loaderIan"]'),e.consent=e.notifications.dataset.consent,e.feed={read:[],unread:[]};constn=n=>{switch(i(),n.target.dataset.tecIanTrigger){case"iconIan":n.preventDefault(),n.stopPropagation(),e.sidebar.classList.toggle("is-hidden"),e.icon.classList.toggle("active");break;case"closeIan":n.preventDefault(),n.stopPropagation(),e.sidebar.classList.add("is-hidden"),e.icon.classList.remove("active");break;case"optinIan":n.preventDefault(),n.stopPropagation(),s();break;case"dismissIan":n.preventDefault(),n.stopPropagation(),c(n.target.dataset.id,n.target.dataset.slug);break;case"readIan":n.preventDefault(),n.stopPropagation(),t.stopPropagation(),l(n.target.dataset.id,n.target.dataset.slug);break;case"readAllIan":n.preventDefault(),n.stopPropagation(),p();break;default:console.log("e.composedPath",n.composedPath())}},a=()=>{conste=document.querySelector(".wrap .ian-header");lett={top:0,height:0};e&&(t=e.getBoundingClientRect());letn=document.getElementById("tribe-settings-tabs");n&&(n=window.innerWidth>500?n:document.querySelector(".tec-settings-header-wrap"),t=n.getBoundingClientRect());consta=document.getElementById("tec-admin-page-header");returna&&(t=a.getBoundingClientRect()),t.top+t.height},i=()=>{constt=a();e.sidebar.style.top=`${t}px`};letd=!1;consto=()=>{constt=window.innerWidth>782?32:window.innerWidth>600?46:0;window.scrollY,a()<=t?e.sidebar.style.top=t+"px":i(),d=!1},s=async()=>{e.optin.classList.add("disable"),e.loader.classList.remove("is-hidden");constt=newFormData;t.append("action","ian_optin"),t.append("nonce",e.nonce);try{(awaitfetch(e.ajaxUrl,{method:"POST",credentials:"same-origin",body:t}).then((e=>e.json()))).success&&r()}catch(e){console.error("Error during opt-in:",e)}finally{e.optin.classList.remove("disable"),e.loader.classList.add("is-hidden")}},r=asynct=>{e.notifications.classList.remove("is-hidden"),t||e.loader.classList.remove("is-hidden");constn=newFormData;n.append("action","ian_get_feed"),n.append("nonce",e.nonce),n.append("plugin",g());try{constt=awaitfetch(e.ajaxUrl,{method:"POST",credentials:"same-origin",body:n}).then((e=>e.json()));if(e.loader.classList.add("is-hidden"),t.success)if(e.optin&&e.optin.remove(),0===t.data.length)e.feed={read:[],unread:[]},e.notifications.classList.add("is-hidden"),e.empty.classList.remove("is-hidden");else{letn="",a="";Object.entries(t.data).forEach((([e,t])=>{t.read?(n+=t.html,commonIan.feed.read.push(t)):(a+=t.html,commonIan.feed.unread.push(t))}));consti=`<div class="ian-sidebar__separator"><div>${e.readTxt}</div><span></span></div>`;e.notifications.innerHTML=a+i+n}m()}catch(e){console.error("Error fetching Ian feed:",e)}finally{e.loader.classList.add("is-hidden")}},c=async(t,n)=>{e.loader.classList.remove("is-hidden");consta=document.getElementById(`notification_${t}`);a.classList.add("fade-out");consti=newFormData;i.append("action","ian_dismiss"),i.append("slug",n),i.append("id",t),i.append("nonce",a.dataset.nonce);try{constn=awaitfetch(e.ajaxUrl,{method:"POST",credentials:"same-origin",body:i}).then((e=>e.json()));if(e.loader.classList.add("is-hidden"),n.success){a.remove();const{read:n,unread:i}=e.feed,d=e=>e.filter((e=>e.id!==parseInt(t)));e.feed.read=d(n),e.feed.unread=d(i),m()}elseconsole.error("Failed to dismiss notification:",n.message||"Unknown error")}catch(e){console.error("Error dismissing notification:",e)}finally{e.loader.classList.add("is-hidden")}},l=async(t,n)=>{e.reading=t,e.loader