const TYPE_PRIORITY={hotel:1,experience:2,cruiseLine:3,cruiseShip:4,experienceLinkableMention:5,hotelLinkableMention:6,cruiseLinkableMention:7,hotelLink:8,experienceLink:9,cruiseLineLink:10,cruiseShipLink:11,hotelsListPlace:12,hotelsSearchBox:13},ELEMENTS_IDS={HOTELS_LIST_EXPLORE_PLANNIN_BUTTON:"plannin-element-hotels-list-explore-plannin-button",HOTELS_SEARCH_BOX:"plannin-element-hotels-search-box",SEARCH_BOX:"plannin-element-search-box",HOTELS_LIST:"plannin-element-hotels-list",EXPERIENCES_LIST:"plannin-element-experiences-list",HOTEL_LINK_PREVIEW:"plannin-element-hotel-link-preview",CITY_LINK_PREVIEW:"plannin-element-city-link-preview",A_HREF:"plannin-element-ahref-"},ALLOWED_OPTION_TO_TYPE={allowHotel:["hotel","hotelLinkableMention","hotelsListPlace","hotelLink"],allowExperience:["experience","experienceLinkableMention","experiencesListPlace","experienceLink"],allowCruise:["cruiseLine","cruiseShipLink","cruiseShip","cruiseShipLink","cruiseLinkableMention"]},PAGE_HOSTNAME=new URL(window.location.origin).hostname;let REPLACEMENTS_LIST=[],PLANNIN_SCRIPT_OPTIONS=null,blogId=null;function md5cycle(e,t){let[n,s,o,i]=e;function a(e,t,n,s,o,i,a){return e=e+(t&n|~t&s)+o+a,(e<<i|e>>>32-i)+t}function r(e,t,n,s,o,i,a){return e=e+(t&s|n&~s)+o+a,(e<<i|e>>>32-i)+t}function c(e,t,n,s,o,i,a){return e=e+(t^n^s)+o+a,(e<<i|e>>>32-i)+t}function l(e,t,n,s,o,i,a){return e=e+(n^(t|~s))+o+a,(e<<i|e>>>32-i)+t}n=a(n,s,o,i,t[0],7,-680876936),i=a(i,n,s,o,t[1],12,-389564586),o=a(o,i,n,s,t[2],17,606105819),s=a(s,o,i,n,t[3],22,-1044525330),n=a(n,s,o,i,t[4],7,-176418897),i=a(i,n,s,o,t[5],12,1200080426),o=a(o,i,n,s,t[6],17,-1473231341),s=a(s,o,i,n,t[7],22,-45705983),n=a(n,s,o,i,t[8],7,1770035416),i=a(i,n,s,o,t[9],12,-1958414417),o=a(o,i,n,s,t[10],17,-42063),s=a(s,o,i,n,t[11],22,-1990404162),n=a(n,s,o,i,t[12],7,1804603682),i=a(i,n,s,o,t[13],12,-40341101),o=a(o,i,n,s,t[14],17,-1502002290),s=a(s,o,i,n,t[15],22,1236535329),n=r(n,s,o,i,t[1],5,-165796510),i=r(i,n,s,o,t[6],9,-1069501632),o=r(o,i,n,s,t[11],14,643717713),s=r(s,o,i,n,t[0],20,-373897302),n=r(n,s,o,i,t[5],5,-701558691),i=r(i,n,s,o,t[10],9,38016083),o=r(o,i,n,s,t[15],14,-660478335),s=r(s,o,i,n,t[4],20,-405537848),n=r(n,s,o,i,t[9],5,568446438),i=r(i,n,s,o,t[14],9,-1019803690),o=r(o,i,n,s,t[3],14,-187363961),s=r(s,o,i,n,t[8],20,1163531501),n=r(n,s,o,i,t[13],5,-1444681467),i=r(i,n,s,o,t[2],9,-51403784),o=r(o,i,n,s,t[7],14,1735328473),s=r(s,o,i,n,t[12],20,-1926607734),n=c(n,s,o,i,t[5],4,-378558),i=c(i,n,s,o,t[8],11,-2022574463),o=c(o,i,n,s,t[11],16,1839030562),s=c(s,o,i,n,t[14],23,-35309556),n=c(n,s,o,i,t[1],4,-1530992060),i=c(i,n,s,o,t[4],11,1272893353),o=c(o,i,n,s,t[7],16,-155497632),s=c(s,o,i,n,t[10],23,-1094730640),n=c(n,s,o,i,t[13],4,681279174),i=c(i,n,s,o,t[0],11,-358537222),o=c(o,i,n,s,t[3],16,-722521979),s=c(s,o,i,n,t[6],23,76029189),n=c(n,s,o,i,t[9],4,-640364487),i=c(i,n,s,o,t[12],11,-421815835),o=c(o,i,n,s,t[15],16,530742520),s=c(s,o,i,n,t[2],23,-995338651),n=l(n,s,o,i,t[0],6,-198630844),i=l(i,n,s,o,t[7],10,1126891415),o=l(o,i,n,s,t[14],15,-1416354905),s=l(s,o,i,n,t[5],21,-57434055),n=l(n,s,o,i,t[12],6,1700485571),i=l(i,n,s,o,t[3],10,-1894986606),o=l(o,i,n,s,t[10],15,-1051523),s=l(s,o,i,n,t[1],21,-2054922799),n=l(n,s,o,i,t[8],6,1873313359),i=l(i,n,s,o,t[15],10,-30611744),o=l(o,i,n,s,t[6],15,-1560198380),s=l(s,o,i,n,t[13],21,1309151649),n=l(n,s,o,i,t[4],6,-145523070),i=l(i,n,s,o,t[11],10,-1120210379),o=l(o,i,n,s,t[2],15,718787259),s=l(s,o,i,n,t[9],21,-343485551),e[0]=e[0]+n|0,e[1]=e[1]+s|0,e[2]=e[2]+o|0,e[3]=e[3]+i|0}function md5blk(e){let t=[];for(let n=0;n<64;n+=4)t[n>>2]=e.charCodeAt(n)+(e.charCodeAt(n+1)<<8)+(e.charCodeAt(n+2)<<16)+(e.charCodeAt(n+3)<<24);return t}function md51(e){let o=e?.length,s=[1732584193,-271733879,-1732584194,271733878],t;for(t=64;t<=o;t+=64)md5cycle(s,md5blk(e.substring(t-64,t)));e=e.substring(t-64);let n=new Array(16).fill(0);for(t=0;t<e?.length;t++)n[t>>2]|=e.charCodeAt(t)<<t%4*8;return n[t>>2]|=128<<t%4*8,t>55&&(md5cycle(s,n),n=new Array(16).fill(0)),n[14]=o*8,md5cycle(s,n),s}function rhex(e){let n="",t=0;for(;t<4;t++)n+="0123456789abcdef".charAt(e>>t*8+4&15)+"0123456789abcdef".charAt(e>>t*8&15);return n}function hex(e){for(let t=0;t<e?.length;t++)e[t]=rhex(e[t]);return e.join("")}function md5(e){return hex(md51(e))}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function normalizeContent(e){return e.replace(/\s+/g," ").trim()}function normalizeUrl(e){let t=e;try{t=decodeURIComponent(e)}catch{console.warn("Invalid URI component, skipping decode:",e)}return t.replace(/&amp;/g,"&").toLowerCase()}function prepareCheckInCheckOutDates(){const t=new Date,o=t.getDay(),i=(12-o)%7+14,e=new Date(t);e.setDate(t.getDate()+i);const n=new Date(e);n.setDate(e.getDate()+3);const s=e=>e.toISOString().split("T")[0],a=s(e),r=s(n);return{checkIn:a,checkOut:r}}function sortEntitiesByType(e){return e?.length?e.sort((e,t)=>TYPE_PRIORITY[e.type]-TYPE_PRIORITY[t.type]):[]}function findAllShadowRoots(e=document.body){const n=[];function t(e){e.shadowRoot&&(n.push(e.shadowRoot),t(e.shadowRoot));const s=e.children||[];for(const e of s)t(e)}return t(e),n}function replacePlannin(e){if(!(e instanceof Node))return;const t=document?.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:function(e){return e.parentNode.id===ELEMENTS_IDS.HOTELS_LIST_EXPLORE_PLANNIN_BUTTON?NodeFilter.FILTER_REJECT:e.parentNode&&e.parentNode.nodeName==="A"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1),n=[];for(;t.nextNode();){const e=t.currentNode;/(?:^|\s)(plannin\.com|Plannin)(?![\w.-])/i.test(e.nodeValue)&&n.push(e)}for(const e of n){const t=document.createElement("span"),s=/(?:^|\s)(plannin\.com|Plannin)(?![\w.-])/gi;t.innerHTML=e.nodeValue.replace(s,(e,t)=>{const n=e.slice(0,e.indexOf(t));return`${n}<a id="${ELEMENTS_IDS.A_HREF}plannin-web-page" class="plannin-analytics-element" data-entity-id="plannin" href="https://plannin.com/en?refId=thelocaltourist" target="_blank">${t}</a>`}),e.parentNode.replaceChild(t,e)}}function prepareEventIdAndUrl(e){const t=`bl_45524o326lx44lm_${blogId||""}_${crypto.randomUUID()}`;return new URL(e).search?e=`${e}&e=${t}`:e=`${e}?e=${t}`,{evtId:t,url:e}}function buildReplaceKeyRegex(e){return new RegExp(`(?<![\\w-])(${escapeRegExp(e).replace(/\s+/g,"(?:\\s|<[^>]+>)*").replace(/&/,"&(?:amp;)?")})(?![\\w-])`,"gi")}function replace(e,t,n){if(!(e instanceof Node))return;const o=document?.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{const t=e.parentNode?.tagName?.toLowerCase();return/^h[1-5]$/.test(t)?NodeFilter.FILTER_REJECT:e.parentNode?.id?.startsWith("plannin-element")||e.parentNode?.["data-plannin-mount"]?.startsWith("plannin-element")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1);let s;for(;s=o.nextNode();)if(t.test(s.textContent)){let i=s.parentNode;if(i.tagName?.toLowerCase()==="a")continue;if(i.tagName?.toLowerCase()==="img")continue;const o=document.createElement("span"),e=`${ELEMENTS_IDS.A_HREF}${n.id}`;if(o.innerHTML=s.textContent.replace(t,`<a 
          id="${e}" 
          class="plannin-analytics-element" 
          data-entity-id=${n.id} 
          href="${n.url}" 
          target="_blank">
            $1
        </a>`),s.parentNode.replaceChild(o,s),PLANNIN_SCRIPT_OPTIONS?.allowHotelUrlPopup&&["hotel","hotelLink"].includes(n.type)){const t=document.getElementById(e);if(t){const i=`${ELEMENTS_IDS.HOTEL_LINK_PREVIEW}${n.id}`,s=document.createElement("div");s.id=i,s.anchorElement=t,s.setAttribute("data-script-id","45524o326lx44lm"),s.setAttribute("data-blog-id",blogId),s.setAttribute("data-creator-id","b638efd7-e410-495d-b594-cafb0bfb27ea"),s.setAttribute("data-plannin-web-url","https://plannin.com"),s.setAttribute("data-ref-id","thelocaltourist"),s.setAttribute("data-hotel",JSON.stringify(n)),s.setAttribute("data-anchor-id",e),o.insertAdjacentElement("afterend",s),window.PlanninWidgets.hotelLinkPreview(`${ELEMENTS_IDS.HOTEL_LINK_PREVIEW}${n.id}`)}}if(PLANNIN_SCRIPT_OPTIONS?.allowCityUrlPopup&&["experienceLinkableMention","hotelLinkableMention"].includes(n.type)){const t=document.getElementById(e);if(t){const i=`${ELEMENTS_IDS.CITY_LINK_PREVIEW}${n.id}`,s=document.createElement("div");s.id=i,s.anchorElement=t,s.setAttribute("data-script-id","45524o326lx44lm"),s.setAttribute("data-blog-id",blogId),s.setAttribute("data-creator-id","b638efd7-e410-495d-b594-cafb0bfb27ea"),s.setAttribute("data-plannin-web-url","https://plannin.com"),s.setAttribute("data-ref-id","thelocaltourist"),s.setAttribute("data-entity",JSON.stringify(n)),s.setAttribute("data-anchor-id",e),o.insertAdjacentElement("afterend",s),window.PlanninWidgets.cityLinkPreview(`${ELEMENTS_IDS.CITY_LINK_PREVIEW}${n.id}`)}}}if(["hotelLink","experienceLink","cruiseShipLink","cruiseLineLink","partnerLink"].includes(n.type)){const t=e.querySelectorAll("a");for(const e of t){const s=e.getAttribute("href");if(!s)continue;try{existingHrefHostname=new URL(s).hostname}catch{continue}try{if(existingHrefHostname.replace("www.","").toLowerCase().trim()===PAGE_HOSTNAME.replace("www.","").toLowerCase().trim())continue;const t=normalizeUrl(n.key),o=normalizeUrl(s);if("partnerLink"===n.type&&!e.dataset.listenerAdded){const t=(e.textContent||"").toLowerCase(),s=n.key.toLowerCase();t&&s.includes(t)&&(e.dataset.listenerAdded="true",e.setAttribute("href",n.url),e.setAttribute("id",`${ELEMENTS_IDS.A_HREF}${n.id}`),e.addEventListener("click",e=>{e.preventDefault();const{evtId:t,url:s}=prepareEventIdAndUrl(n.url);window.open(s,"_blank"),emitAnalyticsEvent("click",{...n,evtId:t})}))}else o.startsWith(t)&&(e.setAttribute("href",n.url),e.setAttribute("id",`${ELEMENTS_IDS.A_HREF}${n.id}`),e.addEventListener("click",e=>{e.preventDefault();const{evtId:t,url:s}=prepareEventIdAndUrl(n.url);window.open(s,"_blank"),emitAnalyticsEvent("click",{...n,evtId:t})},{once:!0}))}catch(e){console.error(e)}}}}function prepareReplacements(e){let t=sortEntitiesByType(e);return PLANNIN_SCRIPT_OPTIONS.replaceExistingLinks||(t=t.filter(e=>!["hotelLink","experienceLink","cruiseShipLink","cruiseShipLink"].includes(e.type))),t}function skipNoNeededProperties(e){return e.querySelectorAll("script").forEach(e=>e.remove()),e.querySelectorAll("style").forEach(e=>e.remove()),e.querySelectorAll("iframe").forEach(e=>e.remove()),e.querySelectorAll("svg").forEach(e=>e.remove()),e.querySelectorAll("img").forEach(e=>e.remove()),e.querySelectorAll('[id^="plannin-element"]').forEach(e=>e.remove()),e.querySelectorAll('[data-plannin-mount^="plannin-element"]').forEach(e=>e.remove()),e.querySelectorAll("*").forEach(e=>{Array.from(e.attributes).forEach(t=>e.removeAttribute(t.name))}),e}function getShadowDomHtml(){const e=[],t=findAllShadowRoots();for(const n of t)e.push(n.getHTML());return e.join(`
`)}function replaceTextLinks(e,t){if(!t)return;PLANNIN_SCRIPT_OPTIONS?.enableNumberOfLinksPerPage&&e.length>PLANNIN_SCRIPT_OPTIONS.numberOfLinksPerPage&&(e=e.slice(0,PLANNIN_SCRIPT_OPTIONS.numberOfLinksPerPage));for(const n of e){if(!n.key||!n.url)continue;const s=escapeRegExp(n.key.trim()),o=buildReplaceKeyRegex(s);replace(t,o,n)}}function placeHotelsList(){const i=document.querySelector(`#${ELEMENTS_IDS.HOTELS_LIST}`);if(i||!window.PlanninWidgets?.hotelsList)return;const t=REPLACEMENTS_LIST.find(e=>e.type==="hotelsListPlace");if(!t||!t.tag)return;const n=REPLACEMENTS_LIST.filter(e=>e.type==="hotel"&&e.isListItem).slice(0,4);if(!n?.length||n?.length===1)return;const e=document.createElement("div");e.id=ELEMENTS_IDS.HOTELS_LIST,e.setAttribute("data-script-id","45524o326lx44lm"),e.setAttribute("data-blog-id",blogId),e.setAttribute("data-creator-id","b638efd7-e410-495d-b594-cafb0bfb27ea"),e.setAttribute("data-plannin-web-url","https://plannin.com"),e.setAttribute("data-ref-id","thelocaltourist"),e.setAttribute("data-hotels",JSON.stringify(n)),e.setAttribute("data-city",t.city),e.setAttribute("data-explore-all-hotels-url",t.url),t.state&&e.setAttribute("data-state",t.state);const a=t.tag.toLowerCase(),s=parseInt(t.tagIndex,10),o=document.querySelectorAll(a);if(o?.length>s){const t=o[s];t.insertAdjacentElement("afterend",e),window.PlanninWidgets.hotelsList(ELEMENTS_IDS.HOTELS_LIST)}}function placeExperiencesList(){const i=document.querySelector(`#${ELEMENTS_IDS.EXPERIENCES_LIST}`);if(i||!window.PlanninWidgets?.experiencesList)return;const t=REPLACEMENTS_LIST.find(e=>e.type==="experiencesListPlace");if(!t||typeof t.tag!="string")return;const n=REPLACEMENTS_LIST.filter(e=>e.type==="experience"&&e.isListItem).slice(0,4);if(!n?.length||n?.length===1)return;const e=document.createElement("div");e.id=ELEMENTS_IDS.EXPERIENCES_LIST,e.setAttribute("data-script-id","45524o326lx44lm"),e.setAttribute("data-blog-id",blogId),e.setAttribute("data-creator-id","b638efd7-e410-495d-b594-cafb0bfb27ea"),e.setAttribute("data-plannin-web-url","https://plannin.com"),e.setAttribute("data-ref-id","thelocaltourist"),e.setAttribute("data-experiences",JSON.stringify(n)),e.setAttribute("data-city",t.city),e.setAttribute("data-explore-all-experiences-url",t.url),t.state&&e.setAttribute("data-state",t.state);const a=t.tag.toLowerCase(),s=parseInt(t.tagIndex,10),o=document.querySelectorAll(a);if(o?.length>s){const t=o[s];t.insertAdjacentElement("afterend",e),window.PlanninWidgets.experiencesList(ELEMENTS_IDS.EXPERIENCES_LIST)}}function placeSearchBox(){const t=REPLACEMENTS_LIST.find(e=>e.type==="searchBoxPlace");if(!t||typeof t.tag!="string")return;const o=document.querySelector(`#${ELEMENTS_IDS.SEARCH_BOX}`);if(o||!window.PlanninWidgets?.searchBox)return;const e=document.createElement("div");if(e.id=ELEMENTS_IDS.SEARCH_BOX,e.setAttribute("data-script-id","45524o326lx44lm"),e.setAttribute("data-blog-id",blogId),e.setAttribute("data-creator-id","b638efd7-e410-495d-b594-cafb0bfb27ea"),e.setAttribute("data-plannin-web-url","https://plannin.com"),e.setAttribute("data-ref-id","thelocaltourist"),e.setAttribute("data-default-search-box-type",PLANNIN_SCRIPT_OPTIONS.defaultSearchBoxType),PLANNIN_SCRIPT_OPTIONS?.enableHotelsSearchBox&&e.setAttribute("data-enable-hotels-search-box",PLANNIN_SCRIPT_OPTIONS.enableHotelsSearchBox),PLANNIN_SCRIPT_OPTIONS?.enableHotelsSearchBoxLbh&&e.setAttribute("data-enable-hotels-search-box-lbh",PLANNIN_SCRIPT_OPTIONS.enableHotelsSearchBoxLbh),PLANNIN_SCRIPT_OPTIONS?.enableExperiencesSearchBox&&e.setAttribute("data-enable-experiences-search-box",PLANNIN_SCRIPT_OPTIONS.enableExperiencesSearchBox),PLANNIN_SCRIPT_OPTIONS?.enableExperiencesSearchBoxLbh&&e.setAttribute("data-enable-experiences-search-box-lbh",PLANNIN_SCRIPT_OPTIONS.enableExperiencesSearchBoxLbh),t.monolithCityId&&e.setAttribute("data-city-id",t.monolithCityId),PLANNIN_SCRIPT_OPTIONS.allowHotel&&e.setAttribute("data-allow-hotels-search-box",PLANNIN_SCRIPT_OPTIONS.allowHotel),PLANNIN_SCRIPT_OPTIONS.allowExperience&&e.setAttribute("data-allow-experiences-search-box",PLANNIN_SCRIPT_OPTIONS.allowExperience),t.city){let n=t.city;t.state&&(n=`${n}, ${t.state}`),e.setAttribute("data-location-name",`${n}`)}const i=t.tag.toLowerCase(),n=parseInt(t.tagIndex,10),s=document.querySelectorAll(i);if(s?.length>n){const t=s[n];t.insertAdjacentElement("afterend",e),window.PlanninWidgets.searchBox(ELEMENTS_IDS.SEARCH_BOX)}}function addAnalyticsListeners(){document.querySelectorAll(".plannin-analytics-element").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),handleOnLinkClick(e)})})}function handleOnLinkClick(e){const{evtId:t,url:o}=prepareEventIdAndUrl(e.href);window.open(o,"_blank");const n=e.dataset.entityId;if(n==="plannin"){emitAnalyticsEvent("click",{evtId:t,isOnPlanninClick:!0});return}const s=REPLACEMENTS_LIST.find(e=>e.id===n);if(!s)return;emitAnalyticsEvent("click",{...s,evtId:t})}async function loadWidgetScript(){try{const t=await fetch(`https://prod-blogs-tool.plannin.com/api/v1/load-script-widgets/45524o326lx44lm`);if(!t.ok)return;const n=await t.text(),e=document.createElement("script");e.type="text/javascript",e.text=n,document.head.appendChild(e)}catch(e){console.error(e)}}function filterAllowed(e){if(!e?.length)return[];const t=[];return PLANNIN_SCRIPT_OPTIONS.allowHotel||t.push(...ALLOWED_OPTION_TO_TYPE.allowHotel),PLANNIN_SCRIPT_OPTIONS.allowExperience||t.push(...ALLOWED_OPTION_TO_TYPE.allowExperience),PLANNIN_SCRIPT_OPTIONS.allowCruise||t.push(...ALLOWED_OPTION_TO_TYPE.allowCruise),t.length?e.filter(e=>!t.includes(e.type)):e}function getBlogContent(){let e=document.body.cloneNode(!0);e=skipNoNeededProperties(e);const t=e.querySelectorAll(":scope > article");if(t.length){const n=Array.from(t).reduce((e,t)=>(e.content+=`
${t.innerText?.trim()||t.textContent?.trim()}`,e.html+=t.innerHTML?.trim(),e),{content:"",html:""});return n.hash=md5(e.innerText?.trim()),n.shadowRootsHtml=getShadowDomHtml(),n}return{content:e.innerText?.trim()||e.textContent?.trim(),hash:md5(e.innerText?.trim()),html:e.innerHTML?.trim(),shadowRootsHtml:getShadowDomHtml()||""}}const runReplacements=(e,t)=>{console.info(`[Plannin] placing content`),REPLACEMENTS_LIST=filterAllowed(e),REPLACEMENTS_LIST=prepareReplacements(REPLACEMENTS_LIST),PLANNIN_SCRIPT_OPTIONS.enableTextLinks&&replaceTextLinks(REPLACEMENTS_LIST,t),PLANNIN_SCRIPT_OPTIONS.enableList&&placeHotelsList(),PLANNIN_SCRIPT_OPTIONS.enableExperiencesList&&placeExperiencesList(),(PLANNIN_SCRIPT_OPTIONS.enableHotelsSearchBox||PLANNIN_SCRIPT_OPTIONS.enableExperiencesSearchBox)&&placeSearchBox(),replacePlannin(t)};function execute(){const e=getBlogContent();if(!e.html)return;const t={title:document.title,url:window.location.href,...e};fetch("https://prod-blogs-tool.plannin.com/api/v1/blog-tool/802e5xz27r80h1p/45524o326lx44lm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(async e=>{if(!e.ok)return;const t=await e.json();let n=t.data?.records??t.data;if(PLANNIN_SCRIPT_OPTIONS=t.data?.options??{},blogId=t.data?.blogId??null,blogId&&emitAnalyticsEvent("page_view"),!n?.length)return;console.info(`[Plannin] start`);const s=document.querySelector("body");await loadWidgetScript(),runReplacements(n,s),setInterval(()=>runReplacements(),5e3),addAnalyticsListeners()}).catch(e=>{console.error(e)})}function getOrCreateBrowserId(){let e=localStorage.getItem("p_b_t_b_id");return e||(e=crypto.randomUUID(),localStorage.setItem("p_b_t_b_id",e)),e}function emitAnalyticsEvent(e,t={}){const n={service:"blogs_tool",creatorId:"b638efd7-e410-495d-b594-cafb0bfb27ea",eventType:e,payload:{...t,blogId,blogUrl:window.location.href,userAgent:navigator.userAgent,browserId:getOrCreateBrowserId(),at:new Date,clientTz:Intl.DateTimeFormat().resolvedOptions().timeZone,scriptId:"45524o326lx44lm",title:document.title}};fetch("https://collector.plannin.com/event",{method:"POST",headers:{"X-API-KEY":"R13f4Kj4m5gM94Op1nHb9mdqcXo926EC","Content-Type":"application/json","Access-Control-Request-Headers":"X-API-KEY"},body:JSON.stringify(n)})}function onContentLoaded(e){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{waitForBodyContent(e)}):waitForBodyContent(e)}function waitForBodyContent(e){const n=setTimeout(()=>{e()},5e3),t=setInterval(()=>{document.body.innerText.trim()?.length>1e3&&(e(),clearInterval(t),clearTimeout(n))},500);setTimeout(()=>{clearInterval(t)},5e3)}onContentLoaded(()=>{execute()})