<script src="(()=>{try{window.gocertify={debug:!1},gocertify._log=function(e){gocertify.debug===!0&&console.log(`[gocertify] ${e}`)},gocertify.domain="https://secure.gocertify.me",gocertify.assetsHost="https://assets.gocertify.me",gocertify.cssLoaded={native:!1,iframe:!1},gocertify.jsLoaded={native:!1,iframe:!1},gocertify.loaded=!1,gocertify.loadedLocation="",gocertify.params={embed:!0,popup:!1},gocertify.custom_location=!1,gocertify.scrollToIframe=!1,gocertify.timeoutId=null,document.currentScript&&(document.currentScript.dataset.subid&&(gocertify.params.subid=document.currentScript.dataset.subid),document.currentScript.dataset.clickref&&(gocertify.params.clickref=document.currentScript.dataset.clickref),gocertify.autoload=document.currentScript.dataset.autoload||"true",gocertify.location=document.currentScript.dataset.location,gocertify.mode=document.currentScript.dataset.mode);let i=new URL(document.location.href);if(i.searchParams.get("gc_debug")=="true"&&(gocertify.debug=!0),i.searchParams.get("subid")&&(gocertify.params.subid=encodeURIComponent(i.searchParams.get("subid"))),i.searchParams.has("clickref")&&(gocertify.params.clickref=encodeURIComponent(i.searchParams.get("clickref"))),i.searchParams.get("gc_loc")){let e=decodeURIComponent(i.searchParams.get("gc_loc"));(e.startsWith("/at/")||e.startsWith("at/"))&&(gocertify.custom_location=e,gocertify.scrollToIframe=!0)}gocertify._log("script loaded"),gocertify._setMode=function(){return gocertify.location?(gocertify.location.endsWith("/hub")&&gocertify.mode!="iframe"?(gocertify.mode="native",gocertify.params.native=!0):(gocertify.mode="iframe",gocertify.params.iframe=!0),gocertify.mode):!1},gocertify._loadNativeCss=function(){if(gocertify.cssLoaded.native)return!1;gocertify._loadCss(`${gocertify.assetsHost}/assets/hub.css`),gocertify.cssLoaded.native=!0},gocertify._loadIframeCss=function(){if(gocertify.cssLoaded.iframe)return!1;gocertify._loadCss(`${gocertify.domain}${gocertify._brandLocation()}/iframe_css`),gocertify.cssLoaded.iframe=!0},gocertify._loadNativeJs=function(){if(gocertify.jsLoaded.native)return!1;gocertify._loadJs(`${gocertify.assetsHost}/assets/hub.js`),gocertify.jsLoaded.native=!0},gocertify._addNativeListeners=function(){window.addEventListener("message",e=>{if(e.data.command=="location"){let t={command:"setParentLocation",location:window.location.href};e.source.postMessage(t,"*")}},!1)},gocertify._setRoot=function(){let e=document.getElementById("gocertify-root"),t=document.currentScript||document.querySelectorAll('script[src*="assets/embed"]')[0];if(e)gocertify.root=e,gocertify._log("cleaning root element..."),gocertify.root.querySelectorAll("*").forEach(o=>o.remove()),gocertify.root.textContent="";else{if(t==null||t.parentElement==null||t.parentElement.nodeName.toLowerCase()=="head")return gocertify._log("can't set root element - root node is in the section"),gocertify._log(t==null),gocertify._log(t.parentElement==null),gocertify._log(t.parentElement.nodeName.toLowerCase()),!1;let o=document.createElement("div");o.setAttribute("id","gocertify-root"),o.setAttribute("data-location",t.dataset.location),o.setAttribute("data-autoload",t.dataset.autoload||"true"),o.setAttribute("data-subid",t.dataset.subid||""),o.setAttribute("data-clickref",t.dataset.clickref||""),o.setAttribute("data-mode",t.dataset.mode||""),t.parentNode.insertBefore(o,t.nextSibling),gocertify.root=o}return gocertify.root.dataset.location&&(gocertify.location=gocertify.root.dataset.location),gocertify.root.dataset.autoload&&(gocertify.autoload=gocertify.root.dataset.autoload),gocertify.root.dataset.subid&&(gocertify.params.subid=gocertify.root.dataset.subid),gocertify.root.dataset.clickref&&(gocertify.params.clickref=gocertify.root.dataset.clickref),gocertify.root.dataset.mode&&(gocertify.mode=gocertify.root.dataset.mode),gocertify.custom_location&&(gocertify.location=gocertify.custom_location),gocertify.root.style.width="100%",!0},gocertify._widgetUrl=function(){let e=Object.keys(gocertify.params).map(o=>`${o}=${gocertify.params[o]}`).join("&"),t=gocertify.location;return t.startsWith("/")?t=`${gocertify.domain}${t}`:t=`${gocertify.domain}/${t}`,t.match(/\?/)?`${t}&${e}`:`${t}?${e}`},gocertify._trackPageView=function(){fetch(`${gocertify.domain}/api/v1/analytics/pv`,{method:"POST",body:JSON.stringify({url:`${gocertify.domain}${gocertify.location}`}),headers:{"Content-Type":"application/json"}}).then(e=>{e.ok?gocertify._log("page view tracked"):gocertify._log("page view tracking failed")}).catch(e=>{gocertify._log("page view tracking failed")})},gocertify._initNative=function(){gocertify._loadNativeCss(),gocertify._loadNativeJs(),gocertify._addNativeListeners(),gocertify._log(`fetching location: ${gocertify._widgetUrl()} (${gocertify.mode})`),gocertify.root.innerHTML='
',fetch(gocertify._widgetUrl()).then(e=>e.text()).then(e=>{gocertify.root.innerHTML=e;let a=new DOMParser().parseFromString(e,"text/html").getElementById("hub-popup");if(a){let r=document.createElement("div");r.classList.add("gcme"),r.appendChild(a),document.body.appendChild(r);let c=gocertify.root.querySelector("#hub-popup");c&&c.remove()}gocertify._trackPageView()}).catch(e=>gocertify._log(e))},gocertify._initIframe=function(){gocertify._loadIframeCss(),gocertify._log(`loading iframe: ${gocertify._widgetUrl()} (${gocertify.mode})`),gocertify.iframe=document.getElementById("gocertify-iframe"),gocertify.iframe||(gocertify.iframe=document.createElement("iframe"),gocertify.iframe.setAttribute("id","gocertify-iframe"),gocertify.iframe.setAttribute("allow","camera *;microphone *"),gocertify.iframe.setAttribute("style","border: 0; width: 1px; min-width: 100%; height: 600px; transition: height 0.2s ease;")),gocertify.iframe.setAttribute("src",gocertify._widgetUrl()),gocertify.root.appendChild(gocertify.iframe),gocertify.scrollToIframe&&setTimeout(function(){gocertify._log("scrolling to iframe"),document.getElementById("gocertify-iframe").scrollIntoView({behavior:"smooth",block:"start"})},300),gocertify._addIframeListeners()},gocertify._addIframeListeners=function(){window.addEventListener("message",e=>{if(gocertify.domain.startsWith(e.origin))if(gocertify._log(`iframe message received: ${JSON.stringify(e.data)}`),e.data.command=="reveal"){let t=new URL(document.location.href);t.searchParams.set("gc_loc",encodeURIComponent(e.data.verifiedPath)),window.open(t.href,"_blank")?window.location=e.data.affiliateLink:window.location=t.href}else if(e.data.command=="resize")gocertify._resizeIframe(e.data.height);else if(e.data.command=="open"&&e.data.link)window.open(e.data.link,"_blank");else if(e.data.command=="redirect"&&e.data.link)document.location=e.data.link;else if(e.data.command=="location"){let t={command:"setParentLocation",location:window.location.href};gocertify.iframe.contentWindow.postMessage(t,"*")}else e.data.command=="closePopup"&&gocertify.modal&&(gocertify.modal.style.display="none")},!1)},gocertify._resizeIframe=function(e){clearTimeout(gocertify.timeoutId),gocertify.timeoutId=setTimeout(function(){gocertify.params.popup!=!0&&(e+=80),gocertify._log(`resizing iframe to ${e}px`);var t=document.getElementById("gocertify-iframe");t?t.style.height=`${e}px`:gocertify._log("iframe not found")},100)},gocertify._createModal=function(){let e=document.getElementById("gc-modal");if(!e){gocertify._log("creating modal");let t=document.getElementById("gocertify-root");t&&t.remove();let o=document.createElement("div");return o.setAttribute("id","gc-modal"),o.innerHTML=`
`,document.body.appendChild(o),o}return e},gocertify.popup=function(e=null){gocertify.modal=gocertify._createModal(),gocertify.mode="popup",gocertify.params.popup=!0,e&&e!=gocertify.location&&(gocertify._log(`Setting new location: ${e}`),gocertify.location=e),gocertify.modal.style.display="block",gocertify.init(),window.onclick=function(t){t.target==gocertify.modal&&(gocertify.modal.style.display="none")}},gocertify.init=function(e=!1){if(gocertify._log("init attempt!"),e&&gocertify.autoload=="false")return gocertify._log("stopping autoload - autoload is false"),!1;if(gocertify.loaded&&gocertify.loadedLocation==gocertify.location){if(document.getElementById("gocertify-root").childElementCount>0)return gocertify._log("stopping init - widget already loaded"),!1;gocertify.loaded=!1}if(!gocertify._setRoot())return gocertify._log("stopping init - no root"),!1;if(!gocertify.location.startsWith("/at/"))return gocertify._log("stopping init - no valid data-location"),!1;if(gocertify.root.parentElement==null)return gocertify._log("stopping init - parent node is null"),!1;if(gocertify.root.parentElement.nodeName.toLowerCase()=="head")return gocertify._log("stopping init - root node is in the section"),!1;gocertify._setMode()=="native"?gocertify._initNative():gocertify._initIframe(),gocertify._log(`widget loaded (${gocertify.mode})`),gocertify.loaded=!0,gocertify.loadedLocation=gocertify.location},gocertify._loadCss=function(e){try{gocertify._log(`loading css: ${e}`);let t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t)}catch(t){gocertify._log(t)}},gocertify._loadJs=function(e){try{gocertify._log(`loading js: ${e}`);let t=document.createElement("script");t.src=e,document.head.appendChild(t)}catch(t){gocertify._log(t)}},gocertify._brandLocation=function(){return gocertify.location.split("?")[0].split("/").slice(0,3).join("/")},window.addEventListener("DOMContentLoaded",e=>gocertify.init(!0)),window.addEventListener("load",e=>gocertify.init(!0)),gocertify.init(!0)}catch(i){console.log(`gocertify error: ${i}`)}})();data-location="/at/chi-chi-london/hub"></script>