if(window.userledSettings)window.userledSettings.enableDynamicAssets=true;if(window.userledSettings)window.userledSettings.version='3dc5809665caff9cb00a5e8722a5c1f115b4674f';var Vi=Object.defineProperty;var Ki=(e,t,n)=>t in e?Vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $=(e,t,n)=>Ki(e,typeof t!="symbol"?t+"":t,n);const We=e=>{try{return window.localStorage.getItem(e)}catch{return null}},wo=(e,t)=>{try{window.localStorage.setItem(e,t)}catch{return}},On=e=>{try{window.localStorage.removeItem(e)}catch{return}},Rn=e=>{const t=We(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}},Ln=(e,t)=>{t?wo(e,JSON.stringify(t)):On(e)};class Rr{constructor(t){$(this,"promise");$(this,"_isResolved");$(this,"_resolve");$(this,"_reject");if(t!=null&&t.defaultResolved){this._isResolved=!0,this.resolve=()=>{},this.promise=new Promise(n=>{n(t.defaultResolved)});return}this._isResolved=!1,this.promise=new Promise((n,r)=>{this._resolve=o=>{this._isResolved=!0,this._resolve=void 0,this._reject=void 0,n(o)},this._reject=o=>{this._isResolved=!1,this._resolve=void 0,this._reject=void 0,r(o)}})}isResolved(){return this._isResolved}resolve(t){var n;(n=this._resolve)==null||n.call(this,t)}reject(t){var n;(n=this._reject)==null||n.call(this,t)}}function fe(e){return e()}function Wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const qi="userled_disable_ignore_events";function Yi(){try{return window.localStorage.getItem(qi)==="true"}catch{return!1}}function Xi(e,t,n){return typeof e=="number"?t<e:e(t,n)}async function Eo(e,t,n=0){return e().catch(r=>{if(console.error(r),Xi(t,n,r))return Eo(e,t,n+1);throw r})}function Ji(e){return e.replace(/&/g,"&#38;").replace(/'/g,"&#39;").replace(/"/g,"&#34;").replace(/>/g,"&#62;").replace(/</g,"&#60;")}function Zi(e,t){return new Promise((n,r)=>{setTimeout(()=>{n()},e)})}const Qi=["Abel","Abril Fatface","Anton","Archivo","Arimo","Arvo","Asap","Asap Condensed","Assistant","Barlow","Barlow Condensed","Bebas Neue","Bitter","Cabin","Cairo","Catamaran","Caveat","Comfortaa","Cormorant Garamond","Crimson Text","DM Sans","Dancing Script","Dosis","EB Garamond","Exo 2","Fira Code","Fira Sans","Fira Sans Condensed","Fjalla One","Geologica","Heebo","Hind","Hind Madurai","Hind Siliguri","IBM Plex Mono","IBM Plex Sans","Inconsolata","Inter","Josefin Sans","Jost","Kanit","Karla","Lato","Libre Baskerville","Libre Franklin","Lobster","Lora","M PLUS Rounded 1c","Manrope","Maven Pro","Merriweather","Merriweather Sans","Montserrat","Mukta","Mulish","Nanum Gothic","Noto Color Emoji","Noto Sans","Noto Sans Arabic","Noto Sans JP","Noto Sans KR","Noto Sans SC","Noto Sans TC","Noto Serif","Noto Serif JP","Nunito","Nunito Sans","Open Sans","Oswald","Outfit","Overpass","Oxygen","PT Sans","PT Sans Narrow","PT Serif","Pacifico","Playfair Display","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Raleway","Red Hat Display","Righteous","Roboto","Roboto Condensed","Roboto Mono","Roboto Slab","Rubik","Shadows Into Light","Signika Negative","Slabo 27px","Source Code Pro","Space Grotesk","Tajawal","Teko","Titillium Web","Ubuntu","Varela Round","Work Sans","Yanone Kaffeesatz","Zilla Slab","Pixelify Sans"];function es(e){return Qi.includes(e)?"google":"brand"}function mt(e){return e.unit==="%"?`${String(e.value*100)}%`:`${String(e.value)}${e.unit}`}var en,Lr;function ts(){if(Lr)return en;Lr=1;function e(t){for(var n=-1,r=t==null?0:t.length,o=0,s=[];++n<r;){var c=t[n];c&&(s[o++]=c)}return s}return en=e,en}var ns=ts();const rs=Wi(ns),os=["clearbit","hubspot","salesforce","clearbit","sixsense","demandbase","linkedin","csv","traits","utm","marketo","source",""],is=["account","contact","person","row","industry","owner","","lead"];function Y(e){return{...e,domain:"brand",get raw(){return e.raw?e.raw:`{{ brand.${e.property}.${String(e.field)} }}`}}}const G=e=>({...e,get raw(){return e.raw?e.raw:`{{ ${this.domain}.${this.record}.${this.field} }}`}}),vo=G({label:"Logo",domain:"clearbit",record:"account",field:"logo"});G({label:"Name",domain:"traits",record:"account",field:"name"});G({label:"Full Name",domain:"traits",record:"owner",field:"full_name"});G({label:"First Name",domain:"traits",record:"owner",field:"first_name"});G({label:"Last Name",domain:"traits",record:"owner",field:"last_name"});G({label:"Title",domain:"traits",record:"owner",field:"title"});G({label:"Phone Number",domain:"traits",record:"owner",field:"phone_number"});G({label:"Email",domain:"traits",record:"owner",field:"email"});G({label:"Profile Picture",domain:"traits",record:"owner",field:"profile_image_url"});G({label:"Calendar Link",domain:"traits",record:"owner",field:"calendar_url"});Y({property:"font",field:"heading"}),Y({property:"font",field:"body"}),Y({property:"color",field:"accent"}),Y({property:"color",field:"dark"}),Y({property:"color",field:"light"}),Y({property:"color",field:"primary"}),Y({property:"logo",field:"default"}),Y({property:"name",field:"value"});const Et=/{{(.*?)}}/g;function So(e){const t=e.match(Et);return rs((t||[]).map(n=>{var w;const s=((w=n.replace(Et,"$1").trim().split("||")[0])==null?void 0:w.split("."))??[];if((s==null?void 0:s.length)!==3)return null;if(s[0]==="brand")return Y({raw:n,property:s[1],field:s[2]});const[c,d,m]=s;return!_o(c)||!Io(d)||!m?null:G({raw:n,field:m??"",label:m??"",domain:c,record:d,postResolveOperations:[y=>typeof y=="string"?Ji(y):y]})}))}const _o=e=>os.some(t=>t===e),Io=e=>is.some(t=>t===e);function Pn(e){const t=(e.match(Et)??[])[0];if(!t)return null;const n=t.replace(Et,"$1").trim().split(".");if(n.length!==3)return null;const[r,o,s]=n;return r!=="brand"?null:{raw:e,domain:"brand",property:o,field:s}}const ss="modulepreload",as=function(e){return"/"+e},Pr={},Ke=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let w=function(y){return Promise.all(y.map(O=>Promise.resolve(O).then(ee=>({status:"fulfilled",value:ee}),ee=>({status:"rejected",reason:ee}))))};var c=w;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=w(n.map(y=>{if(y=as(y),y in Pr)return;Pr[y]=!0;const O=y.endsWith(".css"),ee=O?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${ee}`))return;const P=document.createElement("link");if(P.rel=O?"stylesheet":ss,O||(P.as="script"),P.crossOrigin="",P.href=y,m&&P.setAttribute("nonce",m),document.head.appendChild(P),O)return new Promise((Ze,kt)=>{P.addEventListener("load",Ze),P.addEventListener("error",()=>kt(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&s(m.reason);return t().catch(s)})};function pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)r!=="__proto__"&&(e[r]=n[r])}return e}var cs={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function gn(e,t){function n(o,s,c){if(!(typeof document>"u")){c=pt({},t,c),typeof c.expires=="number"&&(c.expires=new Date(Date.now()+c.expires*864e5)),c.expires&&(c.expires=c.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var m in c)c[m]&&(d+="; "+m,c[m]!==!0&&(d+="="+c[m].split(";")[0]));return document.cookie=o+"="+e.write(s,o)+d}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var s=document.cookie?document.cookie.split("; "):[],c={},d=0;d<s.length;d++){var m=s[d].split("="),w=m.slice(1).join("=");try{var y=decodeURIComponent(m[0]);if(y in c||(c[y]=e.read(w,y)),o===y)break}catch{}}return o?c[o]:c}}return Object.create({set:n,get:r,remove:function(o,s){n(o,"",pt({},s,{expires:-1}))},withAttributes:function(o){return gn(this.converter,pt({},this.attributes,o))},withConverter:function(o){return gn(pt({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var ne=gn(cs,{path:"/"});const ls=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function us(e){return typeof e=="string"&&ls.test(e)}const L=[];for(let e=0;e<256;++e)L.push((e+256).toString(16).slice(1));function ds(e,t=0){return(L[e[t+0]]+L[e[t+1]]+L[e[t+2]]+L[e[t+3]]+"-"+L[e[t+4]]+L[e[t+5]]+"-"+L[e[t+6]]+L[e[t+7]]+"-"+L[e[t+8]]+L[e[t+9]]+"-"+L[e[t+10]]+L[e[t+11]]+L[e[t+12]]+L[e[t+13]]+L[e[t+14]]+L[e[t+15]]).toLowerCase()}let tn;const fs=new Uint8Array(16);function ms(){if(!tn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");tn=crypto.getRandomValues.bind(crypto)}return tn(fs)}const ps=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Dr={randomUUID:ps};function To(e,t,n){var o;if(Dr.randomUUID&&!t&&!e)return Dr.randomUUID();e=e||{};const r=e.random??((o=e.rng)==null?void 0:o.call(e))??ms();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[n+s]=r[s];return t}return ds(r)}const Dn=e=>{const t=["co.uk",".co.jp",".co.kr",".co.nf",".co.nz"],n=e.split(".");if(n.length===1||/^[0-9.]+$/.test(e))return e;for(let r=0;r<t.length;r++){const o=t[r];if(o&&e.endsWith(o)){const s=o.split(".");return n.slice(-(s.length+1)).join(".")}}return n.slice(-2).join(".")},nn="userled_consent";class Nn{constructor(t){$(this,"isGranted",!1);$(this,"subscribers",[]);const n=ne.get(nn)==="true";this.isGranted=n||!t,this.isGranted&&this.setConsentCookie(!0)}grantConsent(){return typeof window>"u"?null:(this.setConsentCookie(!0),this.isGranted=!0,this.subscribers.forEach(t=>t(this.isGranted)),{url:window.location.href,isGranted:this.isGranted})}revokeConsent(){return typeof window>"u"?null:(this.setConsentCookie(!1),this.isGranted=!1,this.subscribers.forEach(t=>t(this.isGranted)),{url:window.location.href,isGranted:this.isGranted})}subscribe(t){t(this.isGranted),this.subscribers.push(t)}checkIfGranted(){return this.isGranted}setConsentCookie(t){if(typeof window>"u")return;const n=Dn(window.location.hostname),o={...!xn.includes(n)&&{domain:`.${n}`}};if(!t){ne.remove(nn,o);return}ne.set(nn,"true",{...o,sameSite:"lax",expires:400})}}class kn extends Error{}const Ao="userled_",bt="userled_user_id",yn="userled_session_id",je="userled_fingerprint",Co="hubspotutk",Oo="_mkto_trk",xn=["canva.com"],Nr=300*1e3,rn=".",hs=7,kr="|";class gs{constructor(){$(this,"consentPromise");$(this,"queue",[]);$(this,"queueIndex");this.queueIndex=0,this.consentPromise=void 0}registerConsent(t){this.consentPromise=new Rr,t.subscribe(n=>{var r;if(n)this.queueIndex=0,this.flush(),(r=this.consentPromise)==null||r.resolve(!0);else{Object.keys(ne.get()).filter(s=>s.startsWith(Ao)).forEach(s=>{ne.remove(s)});const o=this.consentPromise;this.consentPromise=new Rr,o==null||o.reject(new kn)}})}async get(t){return this.consentPromise&&!this.consentPromise.isResolved()&&await this.consentPromise.promise,this.flush(),ne.get(t)}set(t,n,r={}){this.queue.push(()=>{const o=Dn(window.location.hostname),s=!xn.includes(o);ne.set(t,n,{...s&&{domain:`.${o}`},sameSite:"lax",expires:400,secure:!0,...r})}),(!this.consentPromise||this.consentPromise&&this.consentPromise.isResolved())&&this.flush()}flush(){const t=this.queue.slice(this.queueIndex);this.queueIndex=this.queue.length,t.forEach(n=>{n()})}}const ue=new gs,oe={async getUserId(){const e=We(bt);return e&&this.setUserId(e),ue.get(bt)},setUserId(e){ue.set(bt,e)},async getSessionId(){const e=await ue.get(yn),n=this.parseSessionValue(e)??To();if(e){let r=e.lastIndexOf(rn);if(r===-1&&(r=e.lastIndexOf("|")),r!==-1){const o=parseInt(e.substring(r+1),10);if(!isNaN(o)&&Date.now()-o>Nr){const s=e.substring(0,r),c=new Date(o).toISOString(),d=Math.round((Date.now()-o)/1e3);console.log(`[userled:session] [${new Date().toISOString()}] Creating new session (${n}), existing session ${s} was created at ${c} (${d}s ago)`)}}}return this.setSessionId(n),n},setSessionId(e){const t=`${e}${rn}${Date.now()}`;ue.set(yn,t,{expires:1/288})},parseSessionValue(e){if(!e)return;let t=e.lastIndexOf(rn);if(t===-1&&(t=e.lastIndexOf("|")),t===-1)return e;const n=e.substring(0,t),r=e.substring(t+1),o=parseInt(r,10);if(!(!n||isNaN(o))&&!(Date.now()-o>Nr))return n},async getHubspotUTK(){return ne.get(Co)},async getMarketoTrk(){return ne.get(Oo)},async getFingerprintId(){const e=We(je);e&&(this.setFingerprintId(e),On(je));const t=await ue.get(je);if(!t)return;const n=t.split(kr);if(n.length===1){const r=n[0];return r?(this.setFingerprintId(r),r):void 0}if(n.length===2){const r=n[0],o=n[1];if(!r||!o)return;const s=parseInt(o,10);return isNaN(s)?(this.setFingerprintId(r),r):(Date.now()-s)/(1e3*60*60*24)>hs?void 0:r}},setFingerprintId(e){const t=`${e}${kr}${Date.now()}`;ue.set(je,t,{expires:7})}};let ht=null;const ys=async()=>{if(ht)return ht;const e=await Ke(()=>import("./assets/fp.esm.min-uxOc2rQ7.js"),[]);return ht=e.start({apiKey:"sIiAbkgrzW4YhxhEpck0",region:"eu",endpoints:e.withoutDefault("https://identity.userled.io")}),ht},Ro=async()=>{const e=await oe.getFingerprintId();return e?{userFingerprint:e}:bs()},bs=async()=>{try{const n=(await(await ys()).get()).visitor_id;return n?(oe.setFingerprintId(n),{userFingerprint:n}):void 0}catch(e){console.error("cannot generate user fingerprint",e);return}},Lo=()=>`userled_matched_inbound_campaign_${window.location.href}`,Po=e=>{Ln(Lo(),e)},Do=()=>Rn(Lo()),No="userled_inbound_campaigns",ko=e=>{Ln(No,e)},xo=()=>Rn(No),Mn=e=>({...e,getValue:t=>e.vars[t.raw]}),Mo=async e=>{const t=await fetch(e.serverUrl+"/api/inbound-campaigns/match",{method:"POST",body:JSON.stringify(e)});if(!t.ok){const r=await t.text();throw new Error(`Failed to match inbound campaign - status=${t.status} error=${r}`)}const n=await t.json();return n?Mn(n):null},bn=async e=>{try{const t=await Mo(e);return Po(t),t}catch(t){throw new Error(`Failed to match inbound campaign: ${t}`)}},Uo=async e=>{const t=Do();return t?(bn(e),Mn(t)):bn(e)};async function ws(e,t,n){const r=await vs(e,t);if(r)try{await Es(r),window.vector.partnerId=n,window.vector.identify("")}catch(o){console.error("Vector integration failed:",o)}}function Es(e){return new Promise((t,n)=>{var d;const r=()=>{window.vector.load(e)};if((d=window.vector)!=null&&d.loaded)return t();if(window.vector)return r(),t();const o={q:[],loaded:!1,load(m){this.q.push(["load",[m]])},identify(m){this.q.push(["identify",[m]])},on(m,w){this.q.push(["on",[m,w]])}};window.vector=o;const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src="https://cdn.vector.co/pixel.js",s.onload=()=>{try{r(),t()}catch(m){n(new Error(`Vector initialization failed: ${m}`))}},s.onerror=()=>{n(new Error("Failed to load Vector script"))};const c=document.getElementsByTagName("script")[0];c!=null&&c.parentNode?c.parentNode.insertBefore(s,c):document.head.appendChild(s)})}async function vs(e,t){try{const n=await fetch(`${e}/vector/id/${t}`,{method:"GET"});if(n.status!==200)return null;const r=await n.json();return typeof r!="string"?null:r}catch(n){return console.error("Error fetching vectorOrgId:",n),null}}class X extends Error{constructor(n,r){super(n);$(this,"type");$(this,"cause");$(this,"status");this.name="Failed to identify user",this.type=r.type??"unknown",this.cause=r.cause,this.status=r.status}get isRateLimited(){return this.status===429}}const xr=3e4,Ss=3,Mr=2e3,_s=async(e,t)=>{const n=new AbortController,r=setTimeout(()=>n.abort(),xr);try{const o=await fetch(`${t.apiUrl}/identify`,{signal:n.signal,method:"POST",headers:{"Content-Type":"application/json","Userled-Request-Start":new Date().getTime().toString()},body:JSON.stringify({orgId:e,snippetVersion:t.snippetVersion,fingerprint:t.fingerprint,skipDenon:t.skipDenon,assetId:t.assetId,contentHubAssetId:t.contentHubAssetId,hutk:await oe.getHubspotUTK(),marketoTrk:await oe.getMarketoTrk(),accountId:t.accountId,contactId:t.contactId,email:t.email,firstName:t.firstName,lastName:t.lastName,linkedinAccountId:t.linkedinAccountId,linkedinAccountName:t.linkedinAccountName,userId:t.userId,...t.source?{source:t.source}:{},pageURL:t.pageURL,title:t.title,referrer:t.referrer})});if(!o.ok)throw new X(`Identify user request returned a non-ok response [${o.status}] - ${o.statusText}`,{type:"server_response",status:o.status});const s=await o.json();if(!Ts(s))throw new X(`Identify user request returned garbled response - ${JSON.stringify(s)}`,{type:"invalid_data"});return oe.setUserId(s.userId),t.skipDenon||ws(t.apiUrl,e,s.userId),s}catch(o){throw o instanceof X?o:o instanceof Error&&(o.name==="TimeoutError"||o.name==="AbortError")?new X(`Identify user request timed out after ${xr}ms`,{type:"timeout",cause:o}):o instanceof TypeError&&o.message==="Failed to fetch"?new X("Failed to fetch. Browser stopped the request - User navigation, CORS, AdBlocker",{type:"browser",cause:o}):o instanceof Error?new X(`Failed to identify user - ${o.message}`,{type:"unknown",cause:o}):o}finally{clearTimeout(r)}},Fo=async(e,{useFingerprint:t,rateLimitedRetries:n=Ss,...r})=>{const o=await oe.getUserId(),s=await fe(async()=>{if(!t)return;const c=await Ro();return c==null?void 0:c.userFingerprint});for(let c=0;;c++)try{return await _s(e,{...r,fingerprint:s,userId:o})}catch(d){if(!(d instanceof X&&d.isRateLimited)||c>=n)throw d;await Zi(Is(c))}};function Is(e){const t=Mr*2**e,n=Math.random()*Mr;return t+n}function Ts(e){return!(!e||typeof e!="object"||typeof e.userId!="string"||!e.userId||e.contactId!==void 0&&(typeof e.contactId!="string"||!e.contactId)||e.accountId!==void 0&&(typeof e.accountId!="string"||!e.accountId))}function wn(e,t){if(!(e.includes("img.logo.dev")||e.includes("logo.clearbit.com")))return e;const r=As(e);if(!r)return e;const o=t.env==="development",s=!!t.logoToken;return o&&!s?`https://logo.clearbit.com/${r}`:`https://img.logo.dev/${r}?token=${t.logoToken}&size=${Ur.size}&fallback=${Ur.fallback}`}function As(e){try{return new URL(e).pathname.replace("/","")}catch{return}}const Ur={size:"128",fallback:"404"};function En(e){if(e&&us(e))return e}const vn=3e4,Cs=["mktoform_","hsform_"];function Os(e){const t=e.toLowerCase().trim();for(const n of Cs)if(t.startsWith(n))return t.slice(n.length);return t}function $o(e){const t=e.email.toLowerCase().trim();return e.formId?`${t}|${Os(e.formId)}`:`${t}||${e.formName??""}`}const gt=new Map;function Rs(e){const t=Date.now(),n=gt.get(e);if(n!==void 0&&t-n<vn)return!1;for(const[r,o]of gt)t-o>=vn&&gt.delete(r);return gt.set(e,t),!0}function Ls(e){if(e.firstName||e.lastName||!e.name)return{firstName:e.firstName,lastName:e.lastName};const[t,...n]=e.name.trim().split(/\s+/);return{firstName:t,lastName:n.length>0?n.join(" "):void 0}}function Ps(){const e=typeof document<"u";return{pageURL:typeof window<"u"?window.location.href:void 0,title:e?document.title:void 0,referrer:e&&document.referrer||void 0}}async function Ds(e,t){if(!(!t.identifyUser||!t.orgId||!t.apiUrl))try{await t.identifyUser(t.orgId,{apiUrl:t.apiUrl,rateLimitedRetries:0,email:e.email,...Ls(e),...Ps()})}catch(n){console.warn("Failed to re-identify user with form data:",n)}}function Ns(e,t){const n={pageId:t.pageId,assetId:t.assetId??null,email:e.email,formId:e.formId,formType:e.formType,formName:e.formName,channel:t.channel??(t.assetId?"outbound":"website"),caseId:t.caseId,campaignId:t.campaignId,url:t.url,prevUrl:t.prevUrl,pageName:t.pageName};return e.firstName||e.lastName?(n.firstName=e.firstName,n.lastName=e.lastName):e.name&&(n.name=e.name),e.rawPayload&&Object.keys(e.rawPayload).length>0&&(n.rawPayload=e.rawPayload),n}async function Ho(e,t){if(!e.email){console.warn("Form submission tracking skipped: email is required");return}if(Rs($o(e)))try{await Ds(e,t),await t.sendEvent(Ns(e,t.getPageInfo()))}catch(n){console.warn("Failed to track form submission:",n)}}const ks=Object.freeze(Object.defineProperty({__proto__:null,COOKIE_HUBSPOT_UTK:Co,COOKIE_MARKETO_TRK:Oo,Consent:Nn,ConsentRevokedError:kn,DISABLE_CROSS_SUBDOMAIN_TRACKING:xn,FORM_DEDUPE_WINDOW_MS:vn,IdentifyError:X,USERLED_COOKIE_FINGERPRINT_ID:je,USERLED_COOKIE_KEY_PREFIX:Ao,USERLED_COOKIE_SESSION_ID:yn,USERLED_COOKIE_USER_ID:bt,cookieStore:ue,cookies:oe,createBrandVariable:Y,createTargetVariable:G,defaultLogoVariable:vo,extractVariables:So,fetchInboundCampaignMatch:Mo,findBrandVariable:Pn,getApexDomain:Dn,getFingerprint:Ro,getFormDedupeKey:$o,getInboundCampaignCache:xo,getInboundCampaignMatchCache:Do,getItem:We,identifyUser:Fo,isDomain:_o,isRecord:Io,matchInboundCampaign:Uo,newMatchInboundCampaignResponse:Mn,readCache:Rn,refreshInboundCampaignMatchCache:bn,removeItem:On,resolveLogoUrl:wn,sanitiseUUID:En,setItem:wo,trackFormSubmission:Ho,updateInboundCampaignCache:ko,updateInboundCampaignMatchCache:Po,writeCache:Ln},Symbol.toStringTag,{value:"Module"})),Un=To,Fn=(e,t)=>!e||!t?null:new URLSearchParams(e).get(t),xs=e=>e.replace(/&/g,"&amp;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/>/g,"&gt;").replace(/</g,"&lt;"),$n=(e,t)=>{try{return new URL(e,t)}catch{return null}},Ot=()=>window.Userled,k=()=>{var e;return((e=window.userledSettings)==null?void 0:e.app_id)??""},Hn=()=>{var e;return((e=window.userledSettings)==null?void 0:e.region)??""},zn=()=>{var e;return((e=window.userledSettings)==null?void 0:e.version)??""},Z=()=>window.userledEditor,zo=()=>Ot().snippetVersion??"",Rt=()=>Z()||Lt()||vt(),Bo=()=>{var e;return((e=window.userledSettings)==null?void 0:e.enableIdentification)??!1},jo=()=>{var e;return((e=window.userledSettings)==null?void 0:e.requireConsent)??!1},Lt=()=>Fn(window.location.search,"userled_screenshot")==="true",vt=()=>Fn(window.location.search,"userled_preview")==="true",Ms=Object.freeze(Object.defineProperty({__proto__:null,AppId:k,DryMode:Rt,IsEditorMode:Z,IsIdentificationEnabled:Bo,IsPreview:vt,IsTakingScreenshot:Lt,Region:Hn,RequireConsent:jo,SnippetVersion:zo,Userled:Ot,Version:zn},Symbol.toStringTag,{value:"Module"})),St="https://assets.userled.io",Go="https://us.assets.userled.io",Us="us.api.userled.io",Fr="api.userled.io",Fs="app.userled.io",Ge="true",Vo=void 0,$s=/^(localhost|127\.0\.0\.1)(:\d+)?$/;function Ko(e){return($s.test(e)?"http://":"https://")+e}const _t=Ko(Fs),Hs=()=>{switch(Hn()){case"eu-west-2":return Fr;case"us-east-1":return Us;default:return Fr}},zs=()=>{switch(Hn()){case"eu-west-2":return St;case"us-east-1":return Go;default:return St}},te=()=>Ko(Hs()),Bs=e=>{const t=St;if(e.length===8)return t;if(e.length===9)switch(e[0]){case"A":return St;case"B":return Go;default:return t}return t},Q=()=>({BaseUrl:`${te()}/api`,Asset:e=>`${`${Bs(e)}/v2/${e}`}?ts=${Date.now()}`,MatchAssetCase:e=>`${te()}/api/campaigns/assets/${e}/match`,Latency:`${te()}/latency`,Debug:`${te()}/api/debug`,Metrics:`${te()}/api/metrics`,Events:`${te()}/api/sdk/events`,ConsentSubmissions:`${te()}/api/consent-submissions`}),Wo={Inbound:e=>`${zs()}/inbound/${e}`},qo={Preview:`${_t}/preview`},js=Object.freeze(Object.defineProperty({__proto__:null,ApiRoutes:Q,CloudfrontRoutes:Wo,HTTP_SERVER:te,HTTP_WEBAPP:_t,INBOUND_V2:Ge,PAGE_CLOSED_TIMEOUT:Vo,WebAppRoutes:qo},Symbol.toStringTag,{value:"Module"})),Gs=new Date().getTime(),J=()=>new Date().getTime()-Gs;let on=document.visibilityState==="visible"?new Date().getTime():0;on||document.addEventListener("visibilitychange",()=>{!on&&document.visibilityState==="visible"&&(on=new Date().getTime())});const Vs=e=>{},Ks="userled_show_logs",Yo=!!We(Ks),Ws=e=>Yo?(console.time(e),()=>{console.timeEnd(e)}):()=>{},_=Yo?console.log.bind(window.console):()=>{},qs=(e,t)=>{if(e==="PAGE_CLOSED"){const n=t;_(`Sent PAGE_CLOSED event [${n.pageId}] (timeActive=${n.timeActive}secs)`,J());return}if(e==="PAGE_LOADED"){_(`Sent PAGE_LOADED event pageId [${t.pageId}]`,J());return}_(`Sent ${e} message`,t)},Ys=async e=>{var n;const t=Q().Asset(e);try{const r=await fetch(t);if(!r.ok)throw r;const o=await r.json();return Array.isArray(o)||typeof o!="object"||o===null?(_(`Unexpected response shape for asset id=${e}`),null):o}catch(r){const o=await((n=r.text)==null?void 0:n.call(r)),s=r.status;return _(`Could not fetch asset with id=${e} - status=${s} error=${o}`),null}},Xs=async(e,t,n)=>{const r=Q().MatchAssetCase(e);try{const o=await fetch(r,{method:"POST",body:JSON.stringify({url:n,userId:t,orgId:k()})});if(!o.ok)throw o;return await o.json()}catch(o){const s=await o.text(),c=o.status;return _(`Could not match asset case with assetId=${e} - status=${c} error=${s}`),null}};async function Js(e){const t=new Date().getTime();fetch(Q().Latency).then(n=>{if(!n.ok)throw n;const r=new Date().getTime();return _("Reporting latency (ms)",r-t),fetch(`${Q().Latency}?latency=${r-t}&orgId=${e}`)}).catch(async n=>{_("Failed to report latency",n.text(),n.status)})}const Bn={getAsset:Ys,matchAssetCase:Xs,reportLatency:Js},Ct=class Ct{static enqueue(t){return new Promise((n,r)=>{this.queue.push({promise:t,resolve:n,reject:r}),this.dequeue()})}static async dequeue(){if(this.workingOnPromise)return;const t=this.queue.shift();if(t){this.workingOnPromise=!0;try{const n=await t.promise();t.resolve(n)}catch(n){t.reject(n)}this.workingOnPromise=!1,this.dequeue()}}};Ct.queue=[],Ct.workingOnPromise=!1;let Sn=Ct;function Zs(e){const{baseStyle:t,mobileStyle:n}=e,r={};return n.fontSize!==void 0&&(r.fontSize=`${String(n.fontSize)}px`),n.letterSpacing!==void 0&&(r.letterSpacing=mt(n.letterSpacing)),n.fontStyle!==void 0&&(r.fontStyle=n.fontStyle),n.lineHeight!==void 0&&(r.lineHeight=mt(n.lineHeight)),{propStyle:{fontFamily:{type:es(t.fontFamily),name:t.fontFamily}},customStyle:{fontWeight:t.fontWeight,fontSize:`${String(t.fontSize)}px`,letterSpacing:mt(t.letterSpacing),fontStyle:t.fontStyle,lineHeight:mt(t.lineHeight)},mobileStyle:r}}function Qs(e){return typeof e=="object"&&e!==null&&"id"in e&&"baseStyle"in e}const ea=Symbol("unresolved"),Xe=(e,t,n)=>{var r;if(!e)return{};if(!t)return e;if(n!=null&&n.matchedCase){const o=(r=e.caseOverwrites)==null?void 0:r[n.matchedCase.id];e={...e,...o},delete e.caseOverwrites}switch(e.type){case"text":return ra(e,t,n);case"button":return ia(e,t,n);case"logo":return aa(e,t);case"image":return ca(e,t,n);case"input":return la(e,t,n);case"container":return ta(e,t,n);case"video":return ua(e,t,n);case"iframe":return da(e,t,n);case"calendar":return fa(e,t,n);case"contentHubCarousel":return sa(e,t,n);case"marketoForm":return ma(e,t);case"collapsible":case"tabs":case"accordion":return na(e,t,n);case"background":case"contactForm":case"placeholder":case"svg":case"square":return e}},Xo=(e,t,n)=>{const r=e.children.map(o=>Xe(o,t,n));return{customStyle:de(e.customStyle,["backgroundColor","borderColor"],t),mobileStyle:de(e.mobileStyle,["backgroundColor","borderColor"],t),children:r}},ta=(e,t,n)=>({...e,...Xo(e,t,n)}),na=(e,t,n)=>({...e,...Xo(e,t,n)}),ra=(e,t,n)=>{const r=oa(e,t);return{...e,propStyle:de(r.propStyle,["fontFamily"],t),customStyle:de(r.customStyle,["color"],t),mobileStyle:de(r.mobileStyle,["color"],t),value:N(e.value,t,n)}};function oa(e,t){var w;const n={propStyle:e.propStyle,customStyle:e.customStyle,mobileStyle:e.mobileStyle},r=(w=e.propStyle)==null?void 0:w.typographyStyle;if(typeof r!="string")return n;const o=Pn(r);if((o==null?void 0:o.property)!=="typography")return n;const{typographyStyle:s,...c}=e.propStyle??{},d=t.getValue(o);if(!Qs(d))return{...n,propStyle:c};const m=Zs(d);return{propStyle:{...c,...m.propStyle},customStyle:{...e.customStyle,...m.customStyle},mobileStyle:{...e.mobileStyle,...m.mobileStyle}}}const ia=(e,t,n)=>{var s;const r=(s=e.children)==null?void 0:s.map(c=>Xe(c,t,n)),o=fe(()=>{var c,d;if(e.contentHubMetadata)return{...e.contentHubMetadata,header:((c=e.contentHubMetadata.header)==null?void 0:c.imageUrl)!==void 0&&((d=e.contentHubMetadata.header)==null?void 0:d.title)!==void 0?{imageUrl:N(e.contentHubMetadata.header.imageUrl,t,n),title:N(e.contentHubMetadata.header.title,t,n)}:void 0}});return{...e,propStyle:de(e.propStyle,["fontFamily","color","backgroundColor"],t),value:e.value?N(e.value,t,n):e.value,href:N(e.href,t,n),contentHubMetadata:o,children:r}},sa=(e,t,n)=>({...e,hubHeaderTitle:e.hubHeaderTitle?N(e.hubHeaderTitle,t,n):void 0,hubHeaderImageUrl:e.hubHeaderImageUrl?N(e.hubHeaderImageUrl,t,n):void 0}),aa=(e,t)=>({...e,name:N(e.name,t),url:N(e.url,t,{keepUnresolved:!0})}),ca=(e,t,n)=>{if(e.imageType==="variable"&&e.src)return{...e,src:N(e.src,t,n)};if(e.imageType==="smart")return{...e,props:e.props?Object.fromEntries(Object.entries(e.props).map(([s,c])=>[s,Xe(c,t,n)])):void 0};if(e.useTargetLogo!==void 0&&!e.useTargetLogo||e.imageType&&e.imageType!=="target_logo")return e;const r=t.getValue(vo),o=typeof r=="string"?r:e.src;return n!=null&&n.isCustomSiteTemplate?{...e,src:o?wn(o,n.env):void 0}:{...e,src:o&&(n!=null&&n.env)?wn(o,n.env):o}},la=(e,t,n)=>!e.placeholder&&!e.value?e:{...e,value:e.value?N(e.value,t,n):e.value,placeholder:e.placeholder?N(e.placeholder,t,n):e.placeholder},ua=(e,t,n)=>({...e,src:e.src?N(e.src,t,n):e.src}),da=(e,t,n)=>({...e,src:e.src?N(e.src,t,n):e.src,srcdoc:e.srcdoc?N(e.srcdoc,t,n):e.srcdoc}),fa=(e,t,n)=>({...e,propStyle:de(e.propStyle,["backgroundColor","primaryColor"],t),url:N(e.url,t,n)}),ma=(e,t)=>{const n=de(e.propStyle,["backgroundColor","color","ctaBackgroundColor","ctaTextColor"],t);return{...e,propStyle:n??e.propStyle}},N=(e,t,n)=>So(e).reduce((o,s)=>{let c=t.getValue(s);if(s.domain!=="brand")for(const d of s.postResolveOperations??[])c=d(c);return typeof c=="string"?!c&&(n!=null&&n.keepUnresolved)?o:o.replace(s.raw,c):o},e),pa={backgroundColor:"color",borderColor:"color",color:"color",ctaBackgroundColor:"color",ctaTextColor:"color",primaryColor:"color",fontFamily:"font"};function de(e,t,n){if(e)return t.reduce((r,o)=>{const s=e[o];if(typeof s!="string")return r;const c=Pn(s);if(!c)return r;if(c.property!==pa[o])return delete r[o],r;const d=n.getValue(c);return d!==ea?r[o]=d:delete r[o],r},{...e})}const ha=(e,t)=>{const n=Object.entries(e.props??{}).reduce((r,[o,s])=>(r[o]=Xe(s,t),r),{});return{...e,props:n}},Jo=(e,t,n)=>{if(!e.dynamic||!e.cases)return e;try{const r=Object.entries(e.props??{}).reduce((o,[s,c])=>(o[s]=Xe(c,t,{matchedCase:n}),o),{});return{...e,props:r}}catch(r){return console.error(`Could not resolve dynamic asset [${e.id}]: ${r}`),e}},$r="a",Hr="c",zr="ul_e",Br="ul_fn",jr="ul_ln",Gr="ul_li_acc_id",Vr="ul_li_acc_name";let sn;const ga=()=>(sn||(sn=ya()),sn),ya=()=>{const e=$n(window.location.href);if(!e)return console.error("Invalid URL"),{accountId:void 0,contactId:void 0,email:void 0,firstName:void 0,lastName:void 0};const t=e.searchParams,n=En(t.get($r)),r=En(t.get(Hr)),o=t.get(zr)??void 0,s=t.get(Br)??void 0,c=t.get(jr)??void 0,d=t.get(Gr)??void 0,m=t.get(Vr)??void 0,w=n||r||o||s||c||d||m;return n&&t.delete($r),r&&t.delete(Hr),o&&t.delete(zr),s&&t.delete(Br),c&&t.delete(jr),d&&t.delete(Gr),m&&t.delete(Vr),w&&window.history.replaceState({},"",e.toString()),{accountId:n,contactId:r,email:o,firstName:s,lastName:c}};let an;async function Pt(){return an===void 0&&(an=ba()),an}const ba=async()=>{const e=Je()??void 0,t=Bo()||!!e&&!0,n=ga();return Eo(()=>Fo(k(),{apiUrl:Q().BaseUrl,snippetVersion:zo(),useFingerprint:t,assetId:e,accountId:n.accountId,contactId:n.contactId,email:n.email,firstName:n.firstName,lastName:n.lastName,pageURL:window.location.href,title:document.title,referrer:document.referrer||void 0}),(o,s)=>s instanceof kn?!0:s instanceof X&&s.isRateLimited?!1:o<3)},qe=async e=>{try{await fetch(Q().Debug,{method:"POST",body:JSON.stringify({...e,url:window.location.href,version:zn()}),keepalive:!0})}catch(t){console.error("Failed to send debug log",t)}},wa=async e=>{var t;try{await fetch(Q().Metrics,{method:"POST",body:JSON.stringify(e),keepalive:!0})}catch(n){let r;n instanceof Error&&(r=n.stack),qe({message:"Failed to send metrics",error:String(n),stack:r,name:(t=e[0])==null?void 0:t.name})}},jn=()=>{const e=performance.now();return t=>{const r=(performance.now()-e)/1e3;wa([{name:"userled_sdk_latency_seconds",value:r,labels:t}])}};async function It(e,t){if(Rt())return;const[n,r]=await Promise.all([Pt(),oe.getSessionId()]),o=fe(()=>"channel"in t?t.channel??"none":"none");return qs(e,t),fetch(Q().Events,{method:"POST",headers:{"Userled-Org-Id":k()},body:JSON.stringify({id:Un(),userId:n.userId,sessionId:r,orgId:k(),name:e,body:t,happenedAt:new Date().toISOString(),userAgent:navigator.userAgent,channel:o,version:zn(),disableIgnoreEvents:Yi()})})}const Ea=parseInt(Vo)||7e3,va=38e3;function Sa(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function _a(){return Ea+Sa(-2,2)*1e3}class Ia{constructor(){this.pageId="",this.lastPageUrl="",this.listenersAdded=!1,this.isActive=!0,this.lastActivityTimestamp=performance.now(),this.pageClosedTimeout=null,this.hasInteracted=!0,this.lastInteractionTime=performance.now(),this.interactionCheckInterval=null,this.pageParams={channel:"website",campaignId:"",caseId:""}}setupEventListeners(){this.listenersAdded||(window.addEventListener("blur",this.onPageHidden.bind(this)),window.addEventListener("focus",this.onPageShown.bind(this)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.onPageHidden():this.onPageShown()}),window.addEventListener("mousemove",this.onInteraction.bind(this)),window.addEventListener("touchmove",this.onInteraction.bind(this)),window.addEventListener("scroll",this.onInteraction.bind(this)),this.startInteractionCheckInterval(),this.listenersAdded=!0)}onInteraction(){this.hasInteracted||(this.onPageShown(),this.startInteractionCheckInterval()),this.hasInteracted=!0,this.lastInteractionTime=performance.now()}startInteractionCheckInterval(){this.interactionCheckInterval===null&&(this.interactionCheckInterval=window.setInterval(()=>{this.lastInteractionTime&&this.hasInteracted&&performance.now()-this.lastInteractionTime>va&&(this.hasInteracted=!1,this.stopInteractionCheckInterval(),this.onPageHidden())},1e3))}stopInteractionCheckInterval(){this.interactionCheckInterval!==null&&(window.clearInterval(this.interactionCheckInterval),this.interactionCheckInterval=null)}onPageHidden(){_("onPageHidden",{isActive:this.isActive,hasInteracted:this.hasInteracted}),this.isActive&&(this.isActive=!1,this.stopPageClosedTimeout(),this.stopInteractionCheckInterval(),this.sendPageClosedEvent(this.getTimeActive()))}onPageShown(){_("onPageShown",{isActive:this.isActive,hasInteracted:this.hasInteracted}),!this.isActive&&(this.isActive=!0,this.startInteractionCheckInterval(),this.onPageChange({skipPageClosedEvent:!0}))}getPageId(){return this.pageId}setAssetInfo(t){this.pageParams={...this.pageParams,assetId:t.assetId,channel:t.channel,campaignId:t.campaignId,name:t.name||document.title||window.location.href,caseId:t.caseId??""}}getAssetInfo(){return{assetId:this.pageParams.assetId,channel:this.pageParams.channel,campaignId:this.pageParams.campaignId,caseId:this.pageParams.caseId,name:this.pageParams.name}}async onPageChange({skipPageClosedEvent:t=!1}){const n=$n(window.location.href);if(!n){console.error("Invalid URL");return}if(Vs(n.href),_(`page url:${n.href} prev:${document.referrer} name:${window.name}`,J()),this.pageId&&!t){this.stopPageClosedTimeout();try{await this.sendPageClosedEvent(this.getTimeActive())}catch(r){_("Error sending page closed event",r),qe({message:"Failed to send page closed event.",errorType:"unknown_error",orgId:k(),pageId:this.pageId,error:String(r),stack:r.stack,userAgent:navigator.userAgent,duration:J()})}}this.pageId=Un(),this.lastActivityTimestamp=performance.now(),this.isActive=!0,await this.sendPageLoadedEvent(),this.lastPageUrl=n.href,this.setupEventListeners(),this.startPeriodicPageClosed()}startPeriodicPageClosed(){this.stopPageClosedTimeout();const t=_a();this.pageClosedTimeout=window.setTimeout(async()=>{if(this.isActive){try{await this.sendPageClosedEvent(this.getTimeActive())}catch(n){_("Error sending page closed event",n),qe({message:"Failed to send page closed event.",errorType:"unknown_error",orgId:k(),pageId:this.pageId,error:String(n),stack:n.stack,userAgent:navigator.userAgent,duration:J()})}this.startPeriodicPageClosed()}},t)}stopPageClosedTimeout(){this.pageClosedTimeout!==null&&(window.clearTimeout(this.pageClosedTimeout),this.pageClosedTimeout=null)}getTimeActive(){return Math.round(performance.now()-this.lastActivityTimestamp)}async sendPageClosedEvent(t){if(!this.pageId)return;const{assetId:n,caseId:r,campaignId:o}=this.getAssetInfo();let s=this.pageParams.channel;!n&&!s&&(s="website");const c=Math.max(Math.floor(t/1e3),1);await It("PAGE_CLOSED",{assetId:n,pageId:this.pageId,timeActive:c,url:window.location.href,channel:s,caseId:r,campaignId:o}),this.lastActivityTimestamp=performance.now()}async sendPageLoadedEvent(){const{assetId:t,caseId:n,campaignId:r,name:o}=this.getAssetInfo();let s=this.pageParams.channel;!t&&!s&&(s="website"),await It("PAGE_LOADED",{campaignId:r,pageId:this.pageId,pageName:o,url:window.location.href,prevUrl:document.referrer||this.lastPageUrl,assetId:t,channel:s,caseId:n})}}const Dt=new Ia,Tt=()=>Dt.getPageId(),Gn=e=>Dt.setAssetInfo(e),Zo=()=>Dt.getAssetInfo(),Ta=()=>Dt.onPageChange({}),Aa=["div","li"],Ca=["h1","h2","h3","h4","h5","p","button",...Aa],Oa=["img"],Ra=["picture"],La=["source"],Pa=["a"],Da=["input"],Na=["iframe"],Kr=e=>Ca.includes(e.tagName.toLowerCase()),Wr=e=>Oa.includes(e.tagName.toLowerCase()),ka=e=>Ra.includes(e.tagName.toLowerCase()),xa=e=>La.includes(e.tagName.toLowerCase()),qr=e=>Pa.includes(e.tagName.toLowerCase()),Yr=e=>Da.includes(e.tagName.toLowerCase()),Xr=e=>Na.includes(e.tagName.toLowerCase()),Jr=e=>e instanceof SVGElement;Ke(()=>import("./assets/finder-BavXHd7L.js"),[]).then(e=>e.findSelector);const wt=new Map,Vn="data-userled-id",_n="parent-userled-id",Ma="data-userled-noselect",Qo=".hbspt-form",Ua=e=>`[${Vn}='${e}']`,Fa=e=>{e.dataset.originalDisplay=e.style.display,e.style.setProperty("display","none","important")},$a=e=>{e.style.display=e.dataset.originalDisplay||"",e.removeAttribute("data-original-display")},Ha=(e,t)=>{var n;e.dataset.userledHubspotFormScriptHandled="true",(n=e.parentElement)==null||n.querySelectorAll(Qo).forEach(r=>{r instanceof HTMLElement&&(r.style.setProperty("display","none","important"),r.dataset.userledHubspotFormId=t)})};function Zr(e){return`hbspt.forms.create(${JSON.stringify({region:e.region,portalId:e.portalId,formId:e.formId}).replace(/</g,"\\u003c")});`}const za=(e,t,{trigger:n}={})=>{const r=document.createElement("script");if(n){const o=document.createTextNode(Zr(t));return r.appendChild(o),e.insertAdjacentElement("afterend",r),r}return e.insertAdjacentHTML("afterend",`<script>${Zr(t)}<\/script>`),e.nextElementSibling},Ba=(e,t)=>{var n,r;(r=(n=e.parentElement)==null?void 0:n.querySelectorAll(Qo))==null||r.forEach(o=>{o instanceof HTMLElement&&(o.dataset.userledHubspotFormId?(o.style.removeProperty("display"),delete o.dataset.userledHubspotFormId):(wt.set(t,o.cloneNode(!0)),o.remove()))})},Qr=(e,t,n)=>(Ha(e,t),wt.has(t)&&e.insertAdjacentElement("afterend",wt.get(t)),za(e,n,{trigger:!wt.has(t)})),ja=(e,t)=>{switch(t.tagName.toLowerCase()){case"button":Ga(e,t);break;case"input":Va(e,t);break;case"img":case"div":case"p":case"li":case"span":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":Ka(e,t);break}},Ga=(e,t)=>{e.addEventListener("click",()=>{re(t,{event:"click"})}),e.addEventListener("blur",()=>{re(t,{event:"blur"})})},Va=(e,t)=>{e.addEventListener("input",()=>{re(t,{event:"input",value:e.value})}),e.addEventListener("change",()=>{re(t,{event:"change",value:e.value})}),e.addEventListener("focus",()=>{re(t,{event:"focus"})}),e.addEventListener("blur",()=>{re(t,{event:"blur"})})},Ka=(e,t)=>{e.addEventListener("click",()=>{re(t,{event:"click"})}),e.addEventListener("blur",()=>{re(t,{event:"blur"})}),e.addEventListener("focusout",()=>{re(t,{event:"focusout"})})},re=(e,{event:t,...n})=>{var s;if(!(e instanceof Element))throw new Error(`Expected an Element but received ${typeof e} instead!`);const[r,o]=Object.entries(n)[0]??[];if(r){const c=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),r);(s=c==null?void 0:c.set)==null||s.call(e,o)}e.dispatchEvent(new Event(t,{bubbles:!0}))},ei=(e,t)=>{const n=s=>{let c=s==null?void 0:s.replace(new RegExp("(^(http(s)?:\\/\\/)?(www\\.)?)|((\\/)?(\\?.*)?$)","gi"),"");return c=c.replace(/^(localhost|127\.0\.0\.1|\[::1\])(:\d+)?/,"localhost"),c},r=n(e),o=n(t);return r===o};function eo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Wa(e){if(Array.isArray(e))return e}function qa(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,c,d=[],m=!0,w=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(d.push(r.value),d.length!==t);m=!0);}catch(y){w=!0,o=y}finally{try{if(!m&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(w)throw o}}return d}}function Ya(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xa(e,t){return Wa(e)||qa(e,t)||Ja(e,t)||Ya()}function Ja(e,t){if(e){if(typeof e=="string")return eo(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eo(e,t):void 0}}const ti=Object.entries,to=Object.setPrototypeOf,Za=Object.isFrozen,Qa=Object.getPrototypeOf,ec=Object.getOwnPropertyDescriptor;let C=Object.freeze,R=Object.seal,Pe=Object.create,ni=typeof Reflect<"u"&&Reflect,In=ni.apply,Tn=ni.construct;C||(C=function(t){return t});R||(R=function(t){return t});In||(In=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)});Tn||(Tn=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const be=A(Array.prototype.forEach),tc=A(Array.prototype.lastIndexOf),no=A(Array.prototype.pop),He=A(Array.prototype.push),nc=A(Array.prototype.splice),De=Array.isArray,Ve=A(String.prototype.toLowerCase),cn=A(String.prototype.toString),ro=A(String.prototype.match),ze=A(String.prototype.replace),oo=A(String.prototype.indexOf),rc=A(String.prototype.trim),oc=A(Number.prototype.toString),ic=A(Boolean.prototype.toString),io=typeof BigInt>"u"?null:A(BigInt.prototype.toString),so=typeof Symbol>"u"?null:A(Symbol.prototype.toString),U=A(Object.prototype.hasOwnProperty),Be=A(Object.prototype.toString),D=A(RegExp.prototype.test),ce=sc(TypeError);function A(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return In(e,t,r)}}function sc(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Tn(e,n)}}function b(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ve;if(to&&to(e,null),!De(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Za(t)||(t[r]=s),o=s)}e[o]=!0}return e}function ac(e){for(let t=0;t<e.length;t++)U(e,t)||(e[t]=null);return e}function z(e){const t=Pe(null);for(const r of ti(e)){var n=Xa(r,2);const o=n[0],s=n[1];U(e,o)&&(De(s)?t[o]=ac(s):s&&typeof s=="object"&&s.constructor===Object?t[o]=z(s):t[o]=s)}return t}function cc(e){switch(typeof e){case"string":return e;case"number":return oc(e);case"boolean":return ic(e);case"bigint":return io?io(e):"0";case"symbol":return so?so(e):"Symbol()";case"undefined":return Be(e);case"function":case"object":{if(e===null)return Be(e);const t=e,n=j(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Be(r)}return Be(e)}default:return Be(e)}}function j(e,t){for(;e!==null;){const r=ec(e,t);if(r){if(r.get)return A(r.get);if(typeof r.value=="function")return A(r.value)}e=Qa(e)}function n(){return null}return n}function lc(e){try{return D(e,""),!0}catch{return!1}}const ao=C(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ln=C(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),un=C(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),uc=C(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),dn=C(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),dc=C(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),co=C(["#text"]),lo=C(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),fn=C(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),uo=C(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),yt=C(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fc=R(/{{[\w\W]*|^[\w\W]*}}/g),mc=R(/<%[\w\W]*|^[\w\W]*%>/g),pc=R(/\${[\w\W]*/g),hc=R(/^data-[\-\w.\u00B7-\uFFFF]+$/),gc=R(/^aria-[\-\w]+$/),fo=R(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yc=R(/^(?:\w+script|data):/i),bc=R(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wc=R(/^html$/i),Ec=R(/^[a-z][.\w]*(-[.\w]+)+$/i),mo=R(/<[/\w!]/g),po=R(/<[/\w]/g),vc=R(/<\/no(script|embed|frames)/i),Sc=R(/\/>/i),H={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ri=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],_c=C(b({},ri)),Ic=(function(){const e={};return be(ri,t=>{e[t]=R(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),C(e)})(),Tc=function(){return typeof window>"u"?null:window},Ac=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},ho=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},le=function(t,n,r,o){return U(t,n)&&De(t[n])?b(o.base?z(o.base):{},t[n],o.transform):r},mn=function(t,n,r){const o=U(t,n)?t[n]:void 0;return o&&typeof o=="object"?z(o):r()};function oi(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tc();const t=u=>oi(u);if(t.version="3.4.16",t.removed=[],!e||!e.document||e.document.nodeType!==H.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,c=e.Node,d=e.Element,m=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const w=e.DOMParser,y=e.trustedTypes,O=d.prototype,ee=j(O,"cloneNode"),P=j(O,"remove"),Ze=j(O,"removeAttributeNode"),kt=j(O,"nextSibling"),we=j(O,"childNodes"),Ee=j(O,"parentNode"),Xn=j(O,"shadowRoot"),xt=j(O,"attributes"),me=c&&c.prototype?j(c.prototype,"nodeType"):null,ve=c&&c.prototype?j(c.prototype,"nodeName"):null,Qe=c&&c.prototype?j(c.prototype,"ownerDocument"):null,xe=function(i){return me?me(i):i.nodeType},Mt=function(i){return ve?ve(i):i.nodeName};if(typeof s=="function"){const u=n.createElement("template");u.content&&u.content.ownerDocument&&(n=u.content.ownerDocument)}let M,pe="",Ut,Jn=!1,Me=0;const Zn=function(){if(Me>0)throw ce('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(i){Zn(),Me++;try{return M.createHTML(i)}finally{Me--}},yi=function(i){Zn(),Me++;try{return M.createScriptURL(i)}finally{Me--}},bi=function(){return Jn||(Ut=Ac(y,o),Jn=!0),Ut},et=n,Ft=et.implementation,Qn=et.createNodeIterator,wi=et.createDocumentFragment,Ei=et.getElementsByTagName,vi=r.importNode;let E=ho();t.isSupported=typeof ti=="function"&&typeof Ee=="function"&&Ft&&Ft.createHTMLDocument!==void 0;const Si=fc,_i=mc,Ii=pc,Ti=hc,Ai=gc,Ci=yc,er=bc,Oi=Ec;let tr=fo,v=null;const $t=b({},[...ao,...ln,...un,...dn,...co]);let S=null;const Ht=b({},[...lo,...fn,...uo,...yt]);let K=Object.seal(Pe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,nr=null;const ie=Object.seal(Pe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let rr=!0,zt=!0,or=!1,ir=!0,se=!1,he=!0,ge=!1,Bt=!1,tt=null,nt=null,jt=!1,_e=!1,rt=!1,ot=!1,sr=!0,ar=!1;const cr="user-content-";let Gt=!0,Vt=!1,Ie={},Te=null;const lr=b({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ur=null;const dr=b({},["audio","video","img","source","image","track"]);let fr=null;const mr=b({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),it="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",W="http://www.w3.org/1999/xhtml";let Ae=W,Kt=!1,Wt=null;const Ri=b({},[it,st,W],cn),pr=C(["mi","mo","mn","ms","mtext"]);let qt=b({},pr);const hr=C(["annotation-xml"]);let Yt=b({},hr);const Li=b({},["title","style","font","a","script"]);let Fe=null;const Pi=["application/xhtml+xml","text/html"],Di="text/html";let T=null,Ce=null;const Ni=n.createElement("form"),gr=function(i){return i instanceof RegExp||i instanceof Function},Xt=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ce&&Ce===i)return;(!i||typeof i!="object")&&(i={}),i=z(i),Fe=Pi.indexOf(i.PARSER_MEDIA_TYPE)===-1?Di:i.PARSER_MEDIA_TYPE,T=Fe==="application/xhtml+xml"?cn:Ve,v=le(i,"ALLOWED_TAGS",$t,{transform:T}),S=le(i,"ALLOWED_ATTR",Ht,{transform:T}),Wt=le(i,"ALLOWED_NAMESPACES",Ri,{transform:cn}),fr=le(i,"ADD_URI_SAFE_ATTR",mr,{transform:T,base:mr}),ur=le(i,"ADD_DATA_URI_TAGS",dr,{transform:T,base:dr}),Te=le(i,"FORBID_CONTENTS",lr,{transform:T}),Ue=le(i,"FORBID_TAGS",z({}),{transform:T}),nr=le(i,"FORBID_ATTR",z({}),{transform:T}),Ie=U(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?z(i.USE_PROFILES):i.USE_PROFILES:!1,rr=i.ALLOW_ARIA_ATTR!==!1,zt=i.ALLOW_DATA_ATTR!==!1,or=i.ALLOW_UNKNOWN_PROTOCOLS||!1,ir=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=i.SAFE_FOR_TEMPLATES||!1,he=i.SAFE_FOR_XML!==!1,ge=i.WHOLE_DOCUMENT||!1,_e=i.RETURN_DOM||!1,rt=i.RETURN_DOM_FRAGMENT||!1,ot=i.RETURN_TRUSTED_TYPE||!1,jt=i.FORCE_BODY||!1,sr=i.SANITIZE_DOM!==!1,ar=i.SANITIZE_NAMED_PROPS||!1,Gt=i.KEEP_CONTENT!==!1,Vt=i.IN_PLACE||!1,tr=lc(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:fo,Ae=typeof i.NAMESPACE=="string"?i.NAMESPACE:W,qt=mn(i,"MATHML_TEXT_INTEGRATION_POINTS",()=>b({},pr)),Yt=mn(i,"HTML_INTEGRATION_POINTS",()=>b({},hr));const a=mn(i,"CUSTOM_ELEMENT_HANDLING",()=>Pe(null));if(K=Pe(null),U(a,"tagNameCheck")&&gr(a.tagNameCheck)&&(K.tagNameCheck=a.tagNameCheck),U(a,"attributeNameCheck")&&gr(a.attributeNameCheck)&&(K.attributeNameCheck=a.attributeNameCheck),U(a,"allowCustomizedBuiltInElements")&&typeof a.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=a.allowCustomizedBuiltInElements),R(K),se&&(zt=!1),rt&&(_e=!0),Ie&&(v=b({},co),S=Pe(null),Ie.html===!0&&(b(v,ao),b(S,lo)),Ie.svg===!0&&(b(v,ln),b(S,fn),b(S,yt)),Ie.svgFilters===!0&&(b(v,un),b(S,fn),b(S,yt)),Ie.mathMl===!0&&(b(v,dn),b(S,uo),b(S,yt))),ie.tagCheck=null,ie.attributeCheck=null,U(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?ie.tagCheck=i.ADD_TAGS:De(i.ADD_TAGS)&&(v===$t&&(v=z(v)),b(v,i.ADD_TAGS,T))),U(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?ie.attributeCheck=i.ADD_ATTR:De(i.ADD_ATTR)&&(S===Ht&&(S=z(S)),b(S,i.ADD_ATTR,T))),U(i,"ADD_FORBID_CONTENTS")&&De(i.ADD_FORBID_CONTENTS)&&(Te===lr&&(Te=z(Te)),b(Te,i.ADD_FORBID_CONTENTS,T)),Gt&&(v["#text"]=!0),ge&&b(v,["html","head","body"]),v.table&&(b(v,["tbody"]),delete Ue.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const l=M;M=i.TRUSTED_TYPES_POLICY;try{pe=Se("")}catch(f){throw M=l,f}}else i.TRUSTED_TYPES_POLICY===null?(M=void 0,pe=""):(M===void 0&&(M=bi()),M&&typeof pe=="string"&&(pe=Se("")));C&&C(i),Ce=i},yr=b({},[...ln,...un,...uc]),br=b({},[...dn,...dc]),ki=function(i,a,l){return a.namespaceURI===W?i==="svg":a.namespaceURI===it?i==="svg"&&(l==="annotation-xml"||qt[l]):!!yr[i]},xi=function(i,a,l){return a.namespaceURI===W?i==="math":a.namespaceURI===st?i==="math"&&Yt[l]:!!br[i]},Mi=function(i,a,l){return a.namespaceURI===st&&!Yt[l]||a.namespaceURI===it&&!qt[l]?!1:!br[i]&&(Li[i]||!yr[i])},Ui=function(i){let a=Ee(i);(!a||!a.tagName)&&(a={namespaceURI:Ae,tagName:"template"});const l=Ve(i.tagName),f=Ve(a.tagName);return Wt[i.namespaceURI]?i.namespaceURI===st?ki(l,a,f):i.namespaceURI===it?xi(l,a,f):i.namespaceURI===W?Mi(l,a,f):!!(Fe==="application/xhtml+xml"&&Wt[i.namespaceURI]):!1},ae=function(i){He(t.removed,{element:i});try{Ee(i).removeChild(i)}catch{if(P(i),!Ee(i))throw ce("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},wr=function(i,a,l){try{Ze(i,a)}catch{try{i.removeAttribute(l)}catch{}}},at=function(i){ct(i);const a=we(i);if(a){const f=[];be(a,p=>{He(f,p)}),be(f,p=>{try{P(p)}catch{}})}const l=xt(i);if(l)for(let f=l.length-1;f>=0;--f){const p=l[f],h=p&&p.name;typeof h=="string"&&wr(i,p,h)}},ye=function(i,a,l){if(!l)try{l=a.getAttributeNode(i)}catch{l=null}He(t.removed,{attribute:l||null,from:a});try{l?Ze(a,l):a.removeAttribute(i)}catch{try{a.removeAttribute(i)}catch{}}if(i==="is")if(_e||rt)try{ae(a)}catch{}else try{a.setAttribute(i,"")}catch{}},Fi=function(i){const a=xt(i);if(a)for(let l=a.length-1;l>=0;--l){const f=a[l],p=f&&f.name;typeof p!="string"||S[T(p)]||wr(i,f,p)}},ct=function(i){const a=[i];for(;a.length>0;){const l=a.pop();xe(l)===H.element&&Fi(l);const f=we(l);if(f)for(let p=f.length-1;p>=0;--p)a.push(f[p])}},Er=function(i,a){return he?i==="patchsrc"?!0:i==="for"&&a!=="label"&&a!=="output":!1},$i=function(i){if(!he)return;const a=[i];for(;a.length>0;){const l=a.pop(),f=xe(l);if(f===H.processingInstruction||f===H.comment&&D(po,l.data)){try{P(l)}catch{}continue}if(f===H.element){const h=l,g=T(Mt(l));try{h.hasAttribute&&h.hasAttribute("patchsrc")&&h.removeAttribute("patchsrc"),h.hasAttribute&&h.hasAttribute("for")&&Er("for",g)&&h.removeAttribute("for")}catch{}}const p=we(l);if(p)for(let h=p.length-1;h>=0;--h)a.push(p[h])}},vr=function(i){let a=null,l=null;if(jt)i="<remove></remove>"+i;else{const h=ro(i,/^[\r\n\t ]+/);l=h&&h[0]}Fe==="application/xhtml+xml"&&Ae===W&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");const f=M?Se(i):i;if(Ae===W)try{a=new w().parseFromString(f,Fe)}catch{}if(!a||!a.documentElement){a=Ft.createDocument(Ae,"template",null);try{a.documentElement.innerHTML=Kt?pe:f}catch{}}const p=a.body||a.documentElement;return i&&l&&p.insertBefore(n.createTextNode(l),p.childNodes[0]||null),Ae===W?Ei.call(a,ge?"html":"body")[0]:ge?a.documentElement:p},Sr=function(i){const a=Qe?Qe(i):i.ownerDocument;return Qn.call(a||i,i,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},lt=function(i){return i=ze(i,Si," "),i=ze(i,_i," "),i=ze(i,Ii," "),i},Jt=function(i){var a;i.normalize();const l=Qe?Qe(i):i.ownerDocument,f=Qn.call(l||i,i,m.SHOW_TEXT|m.SHOW_COMMENT|m.SHOW_CDATA_SECTION|m.SHOW_PROCESSING_INSTRUCTION,null);let p=f.nextNode();for(;p;)p.data=lt(p.data),p=f.nextNode();const h=(a=i.querySelectorAll)===null||a===void 0?void 0:a.call(i,"template");h&&be(h,g=>{Oe(g.content)&&Jt(g.content)})},ut=function(i){const a=ve?ve(i):null;return typeof a!="string"||T(a)!=="form"?!1:typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||i.attributes!==xt(i)||typeof i.removeAttribute!="function"||typeof i.removeAttributeNode!="function"||typeof i.getAttributeNode!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function"||i.nodeType!==me(i)||i.childNodes!==we(i)},Oe=function(i){if(!me||typeof i!="object"||i===null)return!1;try{return me(i)===H.documentFragment}catch{return!1}},$e=function(i){if(!me||typeof i!="object"||i===null)return!1;try{return typeof me(i)=="number"}catch{return!1}};function q(u,i,a){u.length!==0&&be(u,l=>{l.call(t,i,a,Ce)})}const Hi=function(i,a){return!!(he&&i.hasChildNodes()&&!$e(i.firstElementChild)&&D(mo,i.textContent)&&D(mo,i.innerHTML)||he&&i.namespaceURI===W&&_c[a]&&($e(i.firstElementChild)||typeof i.textContent=="string"&&D(Ic[a],i.textContent))||i.nodeType===H.processingInstruction||he&&i.nodeType===H.comment&&D(po,i.data))},dt=function(i,a){if(i instanceof RegExp)return D(i,a);if(i instanceof Function){for(var l=arguments.length,f=new Array(l>2?l-2:0),p=2;p<l;p++)f[p-2]=arguments[p];return!!i(a,...f)}return!1},zi=function(i,a,l){if(!Ue[a]&&Ar(a)&&dt(K.tagNameCheck,a))return!1;if(Gt&&!Te[a]){const f=Ee(i),p=we(i);if(p&&f){const h=p.length;for(let g=h-1;g>=0;--g){const I=i===l?ee(p[g],!0):p[g];f.insertBefore(I,kt(i))}}}return ae(i),!0},_r=function(i,a,l,f){return i.length===0?a:a===l||a===f?z(a):a},Re=function(i,a){return i===a||Ee(i)!==null?!1:(Vt&&ct(i),!0)},Ir=function(i,a){if(q(E.beforeSanitizeElements,i,null),Re(i,a))return!0;if(ut(i))return ae(i),!0;const l=T(Mt(i));if(v=_r(E.uponSanitizeElement,v,$t,tt),q(E.uponSanitizeElement,i,{tagName:l,allowedTags:v}),Re(i,a))return!0;if(Hi(i,l))return ae(i),!0;if(Ue[l]||!(ie.tagCheck instanceof Function&&ie.tagCheck(l))&&!v[l]){const f=zi(i,l,a);return f===!1&&(q(E.afterSanitizeElements,i,null),Re(i,a))?!0:f}if(xe(i)===H.element&&!Ui(i)||(l==="noscript"||l==="noembed"||l==="noframes")&&D(vc,i.innerHTML))return ae(i),!0;if(se&&i.nodeType===H.text){const f=lt(i.textContent);i.textContent!==f&&(He(t.removed,{element:i.cloneNode()}),i.textContent=f)}return q(E.afterSanitizeElements,i,null),Re(i,a)},Tr=function(i,a,l){if(nr[a]||Er(a,i)||sr&&(a==="id"||a==="name")&&(l in n||l in Ni))return!1;const f=S[a]||ie.attributeCheck instanceof Function&&ie.attributeCheck(a,i);return zt&&D(Ti,a)||rr&&D(Ai,a)?!0:f?fr[a]||D(tr,ze(l,er,""))||(a==="src"||a==="xlink:href"||a==="href")&&i!=="script"&&oo(l,"data:")===0&&ur[i]||or&&!D(Ci,ze(l,er,""))?!0:!l:Ar(i)&&dt(K.tagNameCheck,i)&&dt(K.attributeNameCheck,a,i)||a==="is"&&K.allowCustomizedBuiltInElements&&dt(K.tagNameCheck,l)},Bi=b({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ar=function(i){return!Bi[Ve(i)]&&D(Oi,i)},ji=function(i,a,l,f){if(M&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!l)switch(y.getAttributeType(i,a)){case"TrustedHTML":return Se(f);case"TrustedScriptURL":return yi(f)}return f},Gi=function(i,a,l,f){try{return l?i.setAttributeNS(l,a,f):i.setAttribute(a,f),ut(i)?(ae(i),!1):!0}catch{return ye(a,i),!1}},Cr=function(i,a){if(q(E.beforeSanitizeAttributes,i,null),Re(i,a))return;const l=i.attributes;if(!l||ut(i))return;S=_r(E.uponSanitizeAttribute,S,Ht,nt);const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:S,forceKeepAttr:void 0};let p=l.length;const h=T(i.nodeName);for(;p--;){const g=l[p],I=g.name,B=g.namespaceURI,F=g.value,Le=T(I),Qt=F;let x=I==="value"?Qt:rc(Qt),Or=!1;if(f.attrName=Le,f.attrValue=x,f.keepAttr=!0,f.forceKeepAttr=void 0,q(E.uponSanitizeAttribute,i,f),x=f.attrValue,ar&&(Le==="id"||Le==="name")&&oo(x,cr)!==0&&(ye(I,i,g),x=cr+x,Or=!0),he&&D(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,x)){ye(I,i,g);continue}if(Le==="attributename"&&ro(x,"href")){ye(I,i,g);continue}if(!f.forceKeepAttr){if(!f.keepAttr){ye(I,i,g);continue}if(!ir&&D(Sc,x)){ye(I,i,g);continue}if(se&&(x=lt(x)),!Tr(h,Le,x)){ye(I,i,g);continue}x=ji(h,Le,B,x),x!==Qt&&Gi(i,I,B,x)&&Or&&no(t.removed)}}q(E.afterSanitizeAttributes,i,null),Re(i,a)},ft=function(i){let a=null;const l=Sr(i);for(q(E.beforeSanitizeShadowDOM,i,null);a=l.nextNode();)if(q(E.uponSanitizeShadowNode,a,null),Ir(a,i),Cr(a,i),Oe(a.content)&&ft(a.content),xe(a)===H.element){const f=Xn(a);Oe(f)&&(Zt(f),ft(f))}q(E.afterSanitizeShadowDOM,i,null)},Zt=function(i){const a=[{node:i,shadow:null}];for(;a.length>0;){const l=a.pop();if(l.shadow){ft(l.shadow);continue}const f=l.node,p=xe(f)===H.element,h=we(f);if(h)for(let g=h.length-1;g>=0;--g)a.push({node:h[g],shadow:null});if(p){const g=ve?ve(f):null;if(typeof g=="string"&&T(g)==="template"){const I=f.content;Oe(I)&&a.push({node:I,shadow:null})}}if(p){const g=Xn(f);Oe(g)&&a.push({node:null,shadow:g},{node:g,shadow:null})}}};return t.sanitize=function(u){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,f=null,p=null;if(Kt=!u,Kt&&(u="<!-->"),typeof u!="string"&&!$e(u)&&(u=cc(u),typeof u!="string"))throw ce("dirty is not a string, aborting");if(!t.isSupported)return u;Bt?(v=tt,S=nt):Xt(i),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(v=z(v)),E.uponSanitizeAttribute.length>0&&(S=z(S)),t.removed=[];const h=Vt&&typeof u!="string"&&$e(u);if(h){$i(u);const B=Mt(u);if(typeof B=="string"){const F=T(B);if(!v[F]||Ue[F])throw at(u),ce("root node is forbidden and cannot be sanitized in-place")}if(ut(u))throw at(u),ce("root node is clobbered and cannot be sanitized in-place");try{Zt(u)}catch(F){throw at(u),F}}else if($e(u))a=vr("<!---->"),l=a.ownerDocument.importNode(u,!0),l.nodeType===H.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l),Zt(a);else{if(!_e&&!se&&!ge&&u.indexOf("<")===-1)return M&&ot?Se(u):u;if(a=vr(u),!a)return _e?null:ot?pe:""}a&&jt&&ae(a.firstChild);const g=h?u:a;try{const B=Sr(g);for(;f=B.nextNode();)Ir(f,g),Cr(f,g),Oe(f.content)&&ft(f.content)}catch(B){throw h&&(at(u),be(t.removed,F=>{F.element&&ct(F.element)})),B}if(h){let B=!1;if(be(t.removed,F=>{F.element&&(F.element===u&&(B=!0),ct(F.element))}),B)throw ce("a node selected for removal could not be safely returned; refusing to sanitize in place");return se&&Jt(u),u}if(_e){if(se&&Jt(a),rt)for(p=wi.call(a.ownerDocument);a.firstChild;)p.appendChild(a.firstChild);else p=a;return(S.shadowroot||S.shadowrootmode)&&(p=vi.call(r,p,!0)),p}let I=ge?a.outerHTML:a.innerHTML;return ge&&v["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&D(wc,a.ownerDocument.doctype.name)&&(I="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
`+I),se&&(I=lt(I)),M&&ot?Se(I):I},t.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xt(u),Bt=!0,tt=v,nt=S},t.clearConfig=function(){Ce=null,Bt=!1,tt=null,nt=null,M=Ut,pe=""},t.isValidAttribute=function(u,i,a){Ce||Xt({});const l=T(u),f=T(i);return Tr(l,f,a)},t.addHook=function(u,i){typeof i=="function"&&U(E,u)&&He(E[u],i)},t.removeHook=function(u,i){if(U(E,u)){if(i!==void 0){const a=tc(E[u],i);return a===-1?void 0:nc(E[u],a,1)[0]}return no(E[u])}},t.removeHooks=function(u){U(E,u)&&(E[u]=[])},t.removeAllHooks=function(){E=ho()},t}var ii=oi();const Cc={link:new Set(["http:","https:","mailto:","tel:"]),frame:new Set(["http:","https:"])};function si(e){return ii.sanitize(e,{ADD_ATTR:["target"]})}function Oc(e){const n=ii.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0}).firstElementChild;return n instanceof SVGSVGElement?n:null}function ai(e,t){var r;const n=(r=$n(e,document.baseURI))==null?void 0:r.protocol;return n!==void 0&&Cc[t].has(n)}function Rc(e){return`data:text/html;charset=utf-8,${encodeURIComponent(e)}`}const Lc=e=>e.match(/{{.*?}}/g),Pc=e=>{const t=e.match(/{{ *query\.([a-zA-Z_]+) *( \|\| +([a-z]+) *){0,1}}}/);if(!t||t.length<2)return["",void 0];const[n,r]=[t[1],t[3]];return n?r?[n,xc[r]]:[n,ci]:["",void 0]};function Dc(e){const t=/\b[a-z]/;return e.replace(t,Kn)}function Nc(e){const t=/\b[a-z]/g;return e.replace(t,Kn)}function Kn(e){return e.toUpperCase()}function kc(e){return e.toLowerCase()}const ci=e=>e,xc={"":ci,title:Nc,capitalised:Dc,upper:Kn,lower:kc};let pn;const li=e=>{const t=new Set,n=new Set;return e.forEach(r=>{n.has(r.propKey)||(n.add(r.propKey),t.add(r))}),Array.from(t)},Mc=e=>{var r;if(!(e!=null&&e.oldValue)||!e.target)return[];const t=e.target,n=(r=e.oldValue)==null?void 0:r.split(";").reduce((o,s)=>{var m;const[c,d]=s.split(":");return c&&(o[c.trim()]=(m=d==null?void 0:d.split("!important")[0])==null?void 0:m.trim()),o},{});return Object.entries(t.style).filter(([o,s])=>(n[o]||void 0)!==(s||void 0))};class ui{constructor(t,n){this.mutationObserver=new MutationObserver(()=>{this.isEditing||hn(this)}),this.styleObserver=new MutationObserver(r=>{if(!this.originalElement||!this.element)return;const o=Mc(r[0]),s=this.element.style;o.forEach(([c,d])=>{s.setProperty(c,d??null)})}),this.srcObserver=new MutationObserver(r=>{const o=r[0],s=o==null?void 0:o.attributeName;if(!s||this.prop.type!=="image"||!(this.element instanceof HTMLImageElement))return;const c=this.prop.imageType==="smart",d=c?mi(this.prop,this.element).src:this.prop.src;if(!(!d||!d.length)&&(s==="src"||s==="srcset")){if(c&&this.element[s].startsWith("blob:")||this.element[s]===d)return;Cn(this.element,d)}}),this.apply=r=>{if(An===void 0&&Uc(),this.isApplied||r!=null&&r.skipClone)return this.originalElement&&this.prop.type==="contactForm"&&Qr(this.originalElement,this.id,this.prop),hn(this),this;V.set(this.id,this);const o=this.originalElement;if(o===void 0)return this;o.setAttribute(_n,this.id);let s;return this.prop.type==="contactForm"?s=Qr(o,this.id,this.prop):(s=o.cloneNode(!0),this.prop.type==="text"&&Z()&&window.userledSettings.enableInlineEditing&&s.setAttribute("contenteditable","true"),Fa(o),o.insertAdjacentElement("afterend",s)),s.setAttribute(Vn,this.id),this.registerElement(s),hn(this),this.observe(),this.isApplied=!0,this},this.registerElement=r=>{this.originalElement&&(this.element=r,!Z()&&ja(this.element,this.originalElement))},this.getSelector=()=>this.isApplied?Ua(this.id):this.prop.propKey,this.getDOMElement=()=>{const r=this.getSelector();return document.querySelector(r)},this.remove=()=>{const r=this.originalElement;if(r===void 0)return console.error("Trying to remove an element with no original ref",this.id),this;const o=this.element;return o===void 0?(console.error("Trying to remove an element which is not on the page",this.id),this):(this.prop.type==="contactForm"?Ba(o,this.id):$a(r),o.remove(),r.removeAttribute(_n),this)},this.observe=()=>{this.element!==void 0&&(this.mutationObserver.observe(this.element,{subtree:!0,characterData:!0}),this.prop.type==="image"&&this.srcObserver.observe(this.element,{attributes:!0,attributeFilter:["src","srcset"],attributeOldValue:!0}),this.originalElement&&this.styleObserver.observe(this.originalElement,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}))},this.reset=()=>{this.mutationObserver.disconnect(),this.styleObserver.disconnect(),this.originalElement=void 0,this.element=void 0,this.isApplied=!1,this.isEditing=!1},this.id=t.userledId||Un(),this.prop=t,this.isApplied=!1,this.originalElement=n,this.isEditing=!1,this.prop.userledId=this.id}}const V=new Map;let An;const Uc=()=>{An=new MutationObserver(e=>{e.some(n=>{var r,o;return n.type==="childList"||n.type==="attributes"||(((r=n.addedNodes)==null?void 0:r.length)||0)>0||(((o=n.removedNodes)==null?void 0:o.length)||0)>0})&&setTimeout(()=>{for(const[,n]of V){let r=n.getDOMElement();document.contains(n.originalElement??null)||(n.reset(),r=n.getDOMElement(),r&&(n.originalElement=r)),n.isApplied&&!r&&(n.isApplied=!1,r=n.getDOMElement()),!n.isApplied&&r&&di(n.prop)}},25)}),An.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","class"]})},Wn=(e,t)=>{if(pn&&!t){_(`Ignoring applyAsset: there's already an active asset [${pn.id}].`);return}if(!e.url||!ei(e.url,window.location.href)){console.warn(`Trying to apply asset [${e.id}] on the wrong url.`);return}Nt(),pn=e;const n=Object.values(e.props??{});return qn(n),Z()||qc(),!0},Fc=e=>{var t;return(t=V.get(e))==null?void 0:t.prop},di=async e=>{var o;if(e.userledId&&((o=V.get(e.userledId))!=null&&o.isApplied)){const s=V.get(e.userledId);if(s)return s.prop=e,s.apply(),e}const t=Nt(),n=[e,...t],r=li(n);return qn(r),e},$c=async e=>{for(const o of V.values()){const s=o.prop.userledId;!e.find(d=>d.userledId===s)&&s&&Yn(s)}if(e.every(o=>{var s;return o.userledId&&((s=V.get(o.userledId))==null?void 0:s.isApplied)})){for(const o of e){const s=V.get(o.userledId??"");s&&(s.prop=o,s.apply())}return e}const n=Nt(),r=li([...e,...n]);return qn(r)},qn=e=>{const t=new Set;for(const n of e){const r=document.querySelector(n.propKey)||void 0,o=new ui(n,r);t.add(o)}for(const n of t)n.apply();return e},Nt=()=>{const e=[];for(const[t,n]of V)Yn(t),e.push(n.prop);return e},Yn=e=>{var n;const t=V.get(e);if(t!=null&&t.prop.propKey&&((n=document.getElementById(fi(t.prop.propKey)))==null||n.remove()),!t){console.error("Trying to remove an element which is not applied.",e);return}return t.remove(),V.delete(e),t.prop},hn=async e=>{const t=e.element,n=e.originalElement;if(!t||!n){console.error("Trying to apply edit with no element or original",t,n);return}switch(e.prop.type){case"text":return Z()&&(t.addEventListener("focus",()=>{e.isEditing=!0}),t.addEventListener("blur",()=>{e.isEditing=!1}),t.addEventListener("focusout",()=>{e.isEditing=!1})),e.isEditing?void 0:Hc(e.prop,t,n);case"image":return Gc(e.prop,t,n);case"button":return Bc(e.prop,t,n);case"input":return Kc(e.prop,t,n);case"iframe":return zc(e.prop,t,n);case"svg":return Vc(e.prop,t,n);case"contactForm":return;default:console.error("unknown edit type",e.prop.type);return}},Hc=async(e,t,n)=>{if(!Kr(t)||!Kr(n)){console.error("trying to apply text edit to non-text element",e.propKey);return}const r=Ne(e.value);r!==null&&(t.innerHTML=si(r),ke(t,n,e.customStyle))},zc=async(e,t,n)=>{if(!Xr(t)||!Xr(n)){console.error("trying to apply iframe edit to non-iframe element",e.propKey);return}const r=e.src?Ne(e.src):null,o=e.srcdoc?Ne(e.srcdoc)??e.srcdoc:null,s=r?ai(r,"frame"):!1;if(!e.srcdoc&&!s){console.error("invalid iframe source:",e.propKey,r);return}r&&s?t.src=r:o&&(t.removeAttribute("srcdoc"),t.src=Rc(o)),ke(t,n,e.customStyle)},Bc=async(e,t,n)=>{if(!qr(t)||!qr(n)){console.error("trying to apply button edit to non-button element",e.propKey);return}if(e.value!==void 0){const r=Ne(e.value);if(r===null)return;t.innerHTML=si(r)}if(jc(t,e),ke(t,n,e.customStyle),e.trackClicks&&e.trackingName){const{assetId:r,channel:o,caseId:s,campaignId:c}=Zo();t.addEventListener("click",()=>{It("BUTTON_CLICKED",{pageId:Tt(),buttonId:e.propKey,buttonName:e.trackingName,assetId:r,isConversion:e.isConversion||!1,channel:o??"none",caseId:s,campaignId:c,buttonValue:e.value})})}for(const r of e.children??[]){const o=r.propKey.substring(e.propKey.length),s=n.querySelector(o);if(!s){console.error("could not find button original child element",r);return}const c=t.querySelector(o);if(!c){console.error("could not find button child element",r);return}const d=new ui(r,s);d.registerElement(c),d.apply({skipClone:!0})}};function jc(e,t){if(!ai(t.href,"link")){console.error("unsafe button href:",t.propKey);return}e.href=t.href}const Gc=async(e,t,n)=>{if(!Wr(t)||!Wr(n)){console.error("trying to apply image edit to non-image element",e.propKey);return}let r=e.src;if(e.imageType==="smart"){const{src:s,needApplying:c}=mi(e,t);if(!c)return;r=s}if(r){if(Cn(t,r),t.parentElement&&ka(t.parentElement))for(let s=0;s<t.parentElement.children.length;s++){const c=t.parentElement.children[s];c&&xa(c)&&Cn(c,r)}ke(t,n,e.customStyle)}},Vc=async(e,t,n)=>{if(!Jr(t)||!Jr(n)){console.error("trying to apply svg edit to non-svg element",e.propKey);return}const r=e.value;if(!r)return;const o=Oc(r);if(!o){console.error("invalid svg value:",e.propKey);return}[...o.attributes].forEach(({name:s,value:c})=>{s!==Vn&&s!==_n&&t.setAttribute(s,c)}),t.replaceChildren(...o.childNodes),ke(t,n,e.customStyle)},Cn=(e,t)=>{const n=e.getAttribute("srcset");e.srcset=t,e.src="",n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n)},fi=e=>`userled-loader-${e}`,mi=(e,t)=>{var o,s,c,d,m,w;if(!Z())return{src:e.src??"",needApplying:!0};const n=fi(e.propKey);if(!e.props)return(o=document.getElementById(n))==null||o.remove(),t.alt="Please select a smart image",{src:"https://assets.userled.io/media/gradient.png",needApplying:!0};if(e.customSitePreviewBlob)return(s=document.getElementById(n))==null||s.remove(),t.style.display=((c=e.customStyle)==null?void 0:c.display)??"",{src:URL.createObjectURL(e.customSitePreviewBlob),needApplying:!0};if(document.getElementById(n))return{src:"",needApplying:!1};t.style.display="none";const r=Wc(n,((d=e.customStyle)==null?void 0:d.width)??"100%",((m=e.customStyle)==null?void 0:m.height)??"100%");return(w=t.parentElement)==null||w.insertBefore(r,t),{src:"",needApplying:!1}},Kc=async(e,t,n)=>{if(!Yr(t)||!Yr(n)){console.error("trying to apply input edit to non-input element",e.propKey);return}if(e.placeholder===void 0&&e.value===void 0)return;const r=Ne(e.value??""),o=Ne(e.placeholder??"");t.value=r??"",t.placeholder=o??"",t.dispatchEvent(new Event("change")),t.dispatchEvent(new Event("input")),ke(t,n,e.customStyle)},ke=(e,t,n)=>{if(n){e.style.cssText=t.style.cssText||"",e.style.display=t.dataset.originalDisplay||"";for(const[r,o]of Object.entries(n)){const s=r.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();e.style.setProperty(s,o,"important")}}},Wc=(e,t,n)=>{const r=document.createElement("div");r.id=e,r.style.display="inline-block",r.style.width=t,r.style.height=n;const o=document.createElement("div");o.style.width="100%",o.style.height="100%",o.style.background="linear-gradient(-45deg, #ffe56f 0%, #FFC4F6 100%)",o.style.backgroundSize="300%",o.style.backgroundPosition="center",o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center";const s=document.createElement("div");return s.classList.add("userled-smart-image-loader"),s.setAttribute(Ma,"true"),o.appendChild(s),r.appendChild(o),r},qc=()=>{const e=new URLSearchParams(window.location.search);if(e.delete(pi),!e.toString())return;document.querySelectorAll("a").forEach(n=>{try{const r=new URL(n.href);for(const[o,s]of e.entries())r.searchParams.set(o,s);n.href=r.toString()}catch{}})},Ne=e=>{if(Z())return e;const t=Lc(e);if(!t)return e;let n=e;const r=new URLSearchParams(window.location.search);for(const o of t){const[s,c]=Pc(o);if(!s||!c)return null;const d=r.get(s);if(!d)return null;const m=xs(c(d));n=n.replace(o,()=>m)}return n},pi="userled_asset",Je=()=>{let e=Fn(window.location.search,pi);return e!=null&&e.endsWith("/")&&(e=e.slice(0,-1)),e&&/^[a-zA-Z0-9]{8,9}$/.test(e)?e:null};async function hi(e){const t=await Bn.getAsset(e);return t?t.orgId!==k()?(console.error("Asset does not belong to this organization"),null):t:null}const Yc=async()=>{const e=Je();if(!e)return;const t=fe(async()=>{const{userId:n}=await Pt();return!window.userledSettings.enableDynamicAssets||!n?null:Bn.matchAssetCase(e,n,window.location.href)});try{const n=await hi(e);if(!n)return;const[r,o]=await fe(async()=>{var d;if(!n.dynamic)return[n];const s=await t,c=(d=n.cases)==null?void 0:d.find(m=>m.id===(s==null?void 0:s.caseId));return!s||!c?[n]:[Jo(n,{getValue:m=>{if(!(m.raw in s.variables))throw new Error("Variable not found in match result");return s.variables[m.raw]}},c),c]});Wn(r),Gn({channel:"outbound",assetId:n.id,campaignId:n.campaignId,caseId:o==null?void 0:o.id})}catch(n){console.error(`Could not render site asset [${e}]: ${n}`)}};let Ye=new Nn(!0);function Xc(){Ye=new Nn(jo()),ue.registerConsent(Ye)}async function Jc(e){const{identifyUser:t}=await Ke(async()=>{const{identifyUser:o}=await Promise.resolve().then(()=>ks);return{identifyUser:o}},void 0),{ApiRoutes:n}=await Ke(async()=>{const{ApiRoutes:o}=await Promise.resolve().then(()=>js);return{ApiRoutes:o}},void 0),{AppId:r}=await Ke(async()=>{const{AppId:o}=await Promise.resolve().then(()=>Ms);return{AppId:o}},void 0);await Ho(e,{sendEvent:async o=>{await It("FORM_SUBMITTED",o)},getPageInfo:()=>{const o=Tt(),s=Zo(),c=typeof document<"u"&&document.referrer||"";let d;e.assetId!=null?d=e.assetId:s.assetId!=null?d=s.assetId:typeof window<"u"?d=Je():d=null;const m=s.channel??(d?"outbound":void 0);return{pageId:o,assetId:d,channel:m,caseId:s.caseId,campaignId:s.campaignId,url:typeof window<"u"?window.location.href:void 0,prevUrl:c||void 0,pageName:s.name}},identifyUser:async(o,s)=>{await t(o,s)},orgId:r(),apiUrl:n().BaseUrl})}let At;const Zc=()=>{Ye.subscribe(e=>{e?Qc():el()})};function Qc(){At||(At=window.setInterval(async()=>{await oe.getHubspotUTK()},2e3))}const el=()=>{At&&(console.log("Stopping hubspot cookie detection"),window.clearInterval(At))},go=async e=>{try{const t=await fetch(Wo.Inbound(e));if(!t.ok)throw new Error("Failed to fetch inbound campaigns from cloudfront");const n=await t.json();return ko(n),n}catch{return[]}},tl=async e=>{const t=xo();return t?(go(e),t):go(e)},nl=async()=>{const e=k(),{userId:t}=await Pt();if(!e||!t)return!1;const n=Ws(`Fetching and matching inbound campaigns of [${e}]`),[r,o]=await Promise.all([Uo({orgId:e,userId:t,serverUrl:te(),url:window.location.href}),tl(e)]);if(n(),!r)return _("Inbound campaign not matched, skipping"),!1;if(!o||o.length===0)return _("No inbound campaigns, skipping"),!1;const s=o.find(m=>m.id===r.inboundCampaignId);if(!s)return _("No inbound campaign found, skipping"),!1;const c=s.inboundAssets.find(m=>m.status!=="active"?!1:ei(m.url,window.location.href));if(!c)return _("No inbound asset found for the current URL",window.location.href),!1;const d=ha(c,r);return Wn(d),Gn({channel:"inbound",assetId:c.id,campaignId:s.id}),n(),!0},rl=(()=>{try{if(Ge.toLowerCase()==="true")return!0;if(Ge.toLowerCase()==="false")return!1;const e=Ge.split(",").map(n=>n.trim()),t=k();return t?e.includes(t):!1}catch(e){return console.error("Failed to parse inbound v2",e),!1}})();async function ol(e){if(!e)return;const t=await hi(e);if(!t)return;const n=t.cases||[],r=document.createElement("iframe");r.style.cssText="position:fixed;bottom:2.5rem;height:64px;z-index:1000;left:50%;transform:translateX(-50%);overflow:hidden;border:none;width:calc(100% - 5rem);max-width:834px;",r.setAttribute("scrolling","no"),r.setAttribute("allow","clipboard-write");const o=window.matchMedia("(max-width: 480px)").matches,s=n.length>0,c=n.map(w=>{const y=document.createElement("option");return y.value=w.id,y.innerText=w.name,y}),d=s?`
      <div style="display:flex;align-items:center;gap:16px;border-left:1px solid #fff;border-right:1px solid #fff;padding-inline:16px;flex:1;">
        <div style="font-size:14px;font-weight:600;">Preview variant</div>
        <select id="variant-select" style="height:32px;min-width:130px;border-radius:.5rem;border-width:1px;border-color:#0000;padding-left:.5rem;padding-right:.5rem;padding-top:.25rem;padding-bottom:.25rem;font-size:.875rem;line-height:1.25rem;font-weight:600;background:white;color:black;font-family:inherit;">
          <option value="">Default</option>
          ${c.map(w=>w.outerHTML).join("")}
        </select>
      </div>`:o?"":`
      <div style="display:flex;flex-direction:column;align-items:center;text-align:center;">
        <div style="font-size:12px;font-weight:600;">This is a preview for a Userled website.</div>
        <div style="font-size:12px;font-weight:500;">Internal use only.</div>
      </div>
    `,m=`
    <html>
      <head>
        <style>
          @import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,100..1000&display=swap');
        </style>
      </head>
      <body style="margin:0;padding:0;font-family:'DM Sans',sans-serif;display:flex;justify-content:center">
        <div style="width:fit-content;padding-right:1.25rem;padding-top:1rem;padding-bottom:1rem;padding-left:1.5rem;background-repeat:no-repeat;background-position:0 100%;background-size:auto;background-image:url(${_t}/brush.png);background-color:#FFC4F6;border-radius:9999px;display:flex;align-items:center;gap:16px;justify-content:space-between;">
          <img src="${_t}/userled_logo.svg" style="height:16px;" />
          ${d}
          <button id="share-button" style="cursor:pointer;display:inline-flex;height:32px;min-width:130px;align-items:center;justify-content:center;white-space:nowrap;border-radius:.5rem;border-width:1px;border-color:#0000;padding-left:1rem;padding-right:1rem;padding-top:.25rem;padding-bottom:.25rem;font-size:.875rem;line-height:1.25rem;font-weight:600;background:black;color:white;font-family:inherit;">
            Share preview
          </button>
          <script>
            document.addEventListener("DOMContentLoaded", () => {
              document.getElementById("share-button").addEventListener("click", (e) => {
                navigator.clipboard.writeText('${qo.Preview}/${e}');
                e.target.innerText = "Link copied!";
              });

              document.getElementById("variant-select")?.addEventListener("change", (e) => {
                const caseId = e.target.value;
                window.parent.postMessage({ type: "apply-case", caseId }, "*");
              });
            });
          <\/script>
        </div>
      </body>
    </html>
  `;r.setAttribute("srcdoc",m),document.body.appendChild(r),window.addEventListener("message",w=>{if(!(w.source!==r.contentWindow||w.origin!==window.location.origin)&&w.data.type==="apply-case"){const y=w.data.caseId,O=n.find(P=>P.id===y),ee=O?Jo(t,{getValue:P=>P.raw},O):t;Wn(ee,!0)}})}(async()=>{if(Xc(),cl(),Rt()){_(`Running SDK in DRY mode. Editor: ${Z()}, Screenshot: ${Lt()}, Preview: ${vt()}`),vt()&&ol(Je());return}const e=jn();try{Pt().then(t=>{t.cached||e({org_id:k(),metric:"setup_sdk"})}),Zc()}catch(t){if(t instanceof X){qe({message:"Failed to identify user",errorType:t.type,orgId:k(),pageId:Tt(),error:t.message,stack:t.stack,userAgent:navigator.userAgent,duration:J()});return}qe({message:"Failed to identify user",errorType:"unknown_error",orgId:k(),pageId:Tt(),error:String(t),stack:t.stack,userAgent:navigator.userAgent,duration:J()})}})();function yo(){const e=Ot();for(_(`Flushing ${e.queue.length} items from queue`,J());e.queue.length>0;){const t=e.queue.shift();if(!t)continue;const[n,,r,...o]=t,s=gi(r,o);n(s)}}window.addEventListener("load",()=>{Rt()||setTimeout(()=>Bn.reportLatency(k()),1e3)});async function il(){if(Z()||Lt())return;const e=Je();switch(fe(()=>e?"outbound":rl?"inbound":"website")){case"outbound":await sl();break;case"inbound":await al();break}await Ta()}async function sl(){const e=jn();await Yc(),e({org_id:k(),metric:"outbound"})}async function al(){const e=jn();await fe(async()=>{try{const n=await nl();return e({org_id:k(),metric:"inbound"}),n}catch(n){_("Error matching inbound campaign",n)}return!1})||Gn({name:document.title||window.location.href})}function cl(){_("Setting up SDK",J());const e=Ot();yo(),e.call=async t=>{const[n,...r]=t;return await gi(n,r)},yo(),_("Done settings up SDK",J())}async function gi(e,t){switch(e){case"page":return Sn.enqueue(()=>il());case"grantConsent":return bo("grant");case"revokeConsent":return bo("revoke");case"getAssetProp":return Fc(t[0]);case"applyAssetProp":return di(t[0]);case"applyAssetProps":return $c(t[0]);case"removeAssetProp":return Yn(t[0]);case"removeAssetProps":return Nt();case"trackFormSubmission":return Jc(t[0]);default:return console.error("command undefined: ",e),Promise.resolve()}}function bo(e){_("user consent toggled: ",e);const t=fe(()=>{switch(e){case"grant":return Ye.grantConsent();case"revoke":return Ye.revokeConsent()}});if(!t)return;const n={url:t.url,consentGranted:t.isGranted};fetch(Q().ConsentSubmissions,{method:"POST",body:JSON.stringify(n)})}
