(function(){"use strict";var r={};(function(){r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t}})(),(function(){r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var p=e=>{let t=!1;const n=()=>document.readyState==="complete"||document.readyState==="interactive"||document.readyState==="loaded",o=()=>{window.removeEventListener("DOMContentLoaded",c),document.removeEventListener("readystatechange",i)},a=()=>{t||(t=!0,e(),o())},c=()=>{a()},i=()=>{n()&&a()};n()?a():(window.addEventListener("DOMContentLoaded",c),document.addEventListener("readystatechange",i))},_=window.WPD_Modal,w=r.n(_);const u=(e,t,n={})=>{if(!e)throw new Error("Cookie name is required.");const{days:o,hours:a,minutes:c,path:i="/",domain:f,secure:g,sameSite:h}=n;let m="";if(o||a||c){const l=new Date,D=(o||0)*24*60*60*1e3+(a||0)*60*60*1e3+(c||0)*60*1e3;l.setTime(l.getTime()+D),m=`; expires=${l.toUTCString()}`}let s=`${encodeURIComponent(e)}=${encodeURIComponent(t)}${m}; path=${i}`;f&&(s+=`; domain=${f}`),g&&(s+="; secure"),h&&(s+=`; samesite=${h}`),document.cookie=s},v=e=>{if(!e)throw new Error("Cookie name is required.");const t=encodeURIComponent(e)+"=",o=decodeURIComponent(document.cookie).split("; ");for(const a of o)if(a.startsWith(t))return a.substring(t.length);return null},E=(e,t={})=>{if(!e)throw new Error("Cookie name is required.");u(e,"",{...t,days:-1})};var k=window.wp.apiFetch,y=r.n(k),b=window.wp.url;let d={};function C(e,t=!1,n=!0){const o=JSON.stringify(e);if(!t&&d[o])return d[o];n&&(e.path=(0,b.addQueryArgs)(e.path,{timestamp:Date.now()}));const a=y()(e).then(c=>c).catch(c=>{throw delete d[o],c});return d[o]=a,a}function S(e){if(e===void 0){d={};return}delete d[e]}p(()=>{C({path:"/ajax-search-pro/timed_modal/get",method:"GET"}).then(e=>{if(e){const t={type:e.type??"info",header:e.heading,content:e.content,showCloseIcon:!!e.show_close_icon,closeOnBackgroundClick:!!e.close_on_background_click};if(e.buttons){const n={};Object.keys(e.buttons).forEach((o,a)=>{n[o]={text:e.buttons[o].text,type:e.buttons[o].type},n[o].click=c=>{if(c.preventDefault(),e.buttons[o].dismmisses_forever&&u(e.clicked_okay_cookie_name,"yes",{days:1}),e.buttons[o].href)if(e.buttons[o].target&&e.buttons[o].target=="_blank"){let i=document.createElement("a");i.target="_blank",i.href=e.buttons[o].href,i.click()}else location.href=e.buttons[o].href}}),t.buttons=n}w().show(t),u(e.displayed_cookie_name,"yes",{days:1})}}).catch(e=>{console.log("Timed modal fetch error.",e)})})})();
