(function(){"use strict";const lo="glue_devmode",na="devmode",uo=typeof performance<"u"&&performance.now?performance.now():0;let me=null;const ra=["#6366f1","#0ea5e9","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#f97316"];function hg(){try{return localStorage.getItem(lo)??localStorage.getItem(na)}catch{return null}}function fo(e){try{e===null?(localStorage.removeItem(lo),localStorage.removeItem(na)):localStorage.setItem(lo,e)}catch{}}function go(e){if(e===null)return null;const t=e.trim().toLowerCase();return t===""||t==="false"||t==="0"||t==="off"?null:t==="true"||t==="1"||t==="on"||t==="*"?"*":new Set(t.split(",").map(n=>n.trim()).filter(Boolean))}function yg(){let e=null;try{e=new URLSearchParams(window.location.search).get("devmode")}catch{}e!==null?(me=go(e),fo(me===null?null:e)):me=go(hg())}yg();function Ge(e){return me===null?!1:me==="*"?!0:me.has(e)}function wg(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return ra[Math.abs(t)%ra.length]}function bg(){if(!uo&&uo!==0)return"";const e=(typeof performance<"u"&&performance.now?performance.now():0)-uo;return e<1e3?`+${Math.round(e)}ms`:`+${(e/1e3).toFixed(1)}s`}function nn(e){return[`%c${e==="glue"?"glue":`glue·${e}`}%c ${bg()}`,`background:${wg(e)};color:#fff;border-radius:3px;padding:1px 5px;font-weight:600`,"color:#94a3b8;font-weight:400"]}function W(e){return{log(...t){if(!Ge(e))return;const[n,r,o]=nn(e);console.log(n,r,o,...t)},info(...t){if(!Ge(e))return;const[n,r,o]=nn(e);console.info(n,r,o,...t)},warn(...t){if(!Ge(e))return;const[n,r,o]=nn(e);console.warn(n,r,o,...t)},error(...t){if(!Ge(e))return;const[n,r,o]=nn(e);console.error(n,r,o,...t)},group(t,n=!1){if(!Ge(e))return;const[r,o,i]=nn(e);n?console.group(`${r} ${t}`,o,i):console.groupCollapsed(`${r} ${t}`,o,i)},groupEnd(){Ge(e)&&console.groupEnd()},table(t,n){Ge(e)&&console.table(t,n)},enabled(){return Ge(e)}}}function vg(e){const t=e&&e.trim()?e:"true";me=go(t),fo(t),console.log("%cglue%c devmode ON"+(e?` (filter: ${e})`:""),"background:#6366f1;color:#fff;border-radius:3px;padding:1px 5px;font-weight:600","color:inherit")}function Sg(){me=null,fo(null)}function oa(){return{enabled:me!==null,filter:me===null?"":me==="*"?"*":[...me].join(",")}}const mo=["glue_sessions","glue_events","glue_user_profile"];function Eg(e){if(e===null)return null;try{return JSON.parse(e)}catch{return e}}function kg(){try{const e={},t={};try{for(const r of Object.keys(localStorage))(r.startsWith("glue_")||r.startsWith("utm_")||r.startsWith("temp_"))&&(e[r]=localStorage.getItem(r)??"")}catch{}try{for(const r of Object.keys(sessionStorage))(r.startsWith("glue_")||r.startsWith("utm_")||r.startsWith("temp_"))&&(t[r]=sessionStorage.getItem(r)??"")}catch{}console.group("%cglue%c state dump","background:#6366f1;color:#fff;border-radius:3px;padding:1px 5px;font-weight:600","color:inherit");const n={};for(const[r,o]of Object.entries(e))mo.includes(r)||(n[r]={value:o,scope:"local"});for(const[r,o]of Object.entries(t))!mo.includes(r)&&!(r in n)&&(n[r]={value:o,scope:"session"});Object.keys(n).length&&(console.groupCollapsed(`identity + attribution (${Object.keys(n).length} keys)`),console.table(n),console.groupEnd());for(const r of mo){const o=Eg(e[r]??t[r]??null);if(o===null)continue;const i=Array.isArray(o)?o:[o];console.groupCollapsed(`${r} (${i.length})`),console.table(i.slice(-25)),i.length>25&&console.log(`… ${i.length-25} older entries not shown`),console.groupEnd()}console.groupEnd()}catch(e){console.warn("glue: state dump failed",e)}}const I=W("glue");function ia(e){const t=globalThis?.__glueConfig?.moduleHashes?.[e];return typeof t=="string"&&/^[0-9a-f]{8}$/.test(t)?`&h=${t}`:""}var Ag=Object.defineProperty,Tg=(e,t,n)=>t in e?Ag(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cg=(e,t,n)=>Tg(e,t+"",n);const Ig=W("modules"),xg=1e4,Og=5*60*1e3,Lg=2,sa=new Map;function rn(e,t){return`${e}@${t}`}function Mg(e,t){const n=rn(e,t);let r=sa.get(n);return r||(r={status:{name:e,version:t,state:"idle",attempts:0},promise:null,exports:void 0,failedAt:0},sa.set(n,r)),r}function po(){const e=globalThis;return e.__glueModules||(e.__glueModules={}),e.__glueModules}class ft extends Error{constructor(t,n){super(n),Cg(this,"reason"),this.name="ModuleLoadError",this.reason=t}}function Rg(e,t){const r=globalThis?.__glueConfig?.supabaseUrl;return typeof r!="string"||!r?null:`${r}/functions/v1/glue?module=${encodeURIComponent(e)}&v=${encodeURIComponent(t)}${ia(e)}`}function $g(e,t){return new Promise((n,r)=>{if(typeof document>"u"||!document.head){r(new ft("exception","document unavailable"));return}let o=!1;const i=document.createElement("script"),s=c=>{o||(o=!0,clearTimeout(a),i.onload=null,i.onerror=null,c?r(c):n())},a=setTimeout(()=>s(new ft("timeout",`module load timed out after ${t}ms`)),t);i.src=e,i.async=!0,i.crossOrigin="anonymous",i.onload=()=>s(),i.onerror=()=>s(new ft(navigator?.onLine===!1?"network":"csp",`module script failed: ${e}`)),document.head.appendChild(i)})}async function Ng(e,t,n){const o=po()[rn(e,t)];if(o)return o;const i=Rg(e,t);if(!i)throw new ft("disabled","no supabaseUrl configured for module loading");await $g(i,n);const s=po()[rn(e,t)];if(!s){const a=Object.keys(po()).find(c=>c.startsWith(`${e}@`));throw new ft(a?"version_mismatch":"exception",a?`module ${e} registered as ${a}, expected ${t}`:`module ${e}@${t} did not register`)}return s}function _o(e,t,n={}){const r=Mg(e,t);if(r.status.state==="loaded")return Promise.resolve(r.exports);if(r.promise)return r.promise;if(r.status.state==="failed"&&!(r.status.attempts<Lg&&Date.now()-r.failedAt>=Og))return Promise.reject(new ft(r.status.reason??"exception",`module ${rn(e,t)} unavailable`));r.status.state="loading",r.status.attempts+=1,r.status.reason=void 0;const o=typeof n.timeoutMs=="number"?n.timeoutMs:xg;return r.promise=Ng(e,t,o).then(i=>(r.exports=i,r.status.state="loaded",r.status.at=Date.now(),r.promise=null,i)).catch(i=>{throw r.status.state="failed",r.status.reason=i instanceof ft?i.reason:"exception",r.status.at=Date.now(),r.failedAt=Date.now(),r.promise=null,Ig.warn(`module ${rn(e,t)} failed (${r.status.reason})`),i}),r.promise}const aa="__dataglue_toolbar",ho="glue_flag_qa",ca={},Dg=/^[A-Za-z0-9_-]{20,200}$/;function Pg(e=typeof location>"u"?"":location.hash){if(!e)return null;const t=e.charAt(0)==="#"?e.slice(1):e;if(t.indexOf(aa)===-1)return null;for(const n of t.split("&")){const r=n.indexOf("=");if(r===-1||n.slice(0,r)!==aa)continue;let o=n.slice(r+1);try{o=decodeURIComponent(o)}catch{}return Dg.test(o)?{token:o}:null}return null}const Fg="toolbar",Ug="1";let la=!1;function jg(){if(la||typeof window>"u"||typeof document>"u")return Promise.resolve();const e=Pg();if(!e)return Promise.resolve();la=!0;try{window.sessionStorage?.setItem(ho,"1")}catch{}return _o(Fg,Ug).then(t=>t.start({token:e.token,pauseWebTests:()=>ca.pauseWebTests?.()??(()=>{})})).then(()=>{}).catch(t=>{I.warn("toolbar: could not start",t)})}jg();let nr=null,Ee=()=>!0;const rr=new Map,yo=new Map,wo=new Map;function qg(e){Ee=e}function Hg(){nr=null}function Bg(){return nr||(nr=new URLSearchParams(window.location.search)),nr}function bo(e){try{return Bg().get(e)}catch(t){return I.warn(`Failed to get URL parameter '${e}':`,t),null}}function F(e,t){try{const n=typeof t=="string"?t:JSON.stringify(t);if(!Ee("sessionStorage")){yo.set(e,n);return}sessionStorage.setItem(e,n)}catch(n){I.warn(`Failed to set sessionStorage item '${e}':`,n)}}function B(e){try{return Ee("sessionStorage")?sessionStorage.getItem(e):yo.get(e)??null}catch(t){return I.warn(`Failed to get sessionStorage item '${e}':`,t),null}}function Mt(e){try{if(yo.delete(e),!Ee("sessionStorage"))return;sessionStorage.removeItem(e)}catch(t){I.warn(`Failed to remove sessionStorage item '${e}':`,t)}}function k(e,t){try{const n=typeof t=="string"?t:JSON.stringify(t);if(!Ee("localStorage")){rr.set(e,n);return}localStorage.setItem(e,n)}catch(n){I.warn(`Failed to set localStorage item '${e}':`,n)}}function h(e){try{return Ee("localStorage")?localStorage.getItem(e):rr.get(e)??null}catch(t){return I.warn(`Failed to get localStorage item '${e}':`,t),null}}function ua(e){try{if(!Ee("localStorage"))return[...rr.keys()].filter(n=>n.startsWith(e));const t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r?.startsWith(e)&&t.push(r)}return t}catch{return[]}}function da(e){try{return Object.keys(window[e])}catch(t){return I.warn(`Failed to list ${e} keys:`,t),[]}}function ie(e){try{if(rr.delete(e),!Ee("localStorage"))return;localStorage.removeItem(e)}catch(t){I.warn(`Failed to remove localStorage item '${e}':`,t)}}let or=null,on=null;function J(e,t,n){try{if(!Ee("cookie")){wo.set(e,t);return}const r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);const o="expires="+r.toUTCString(),i=window.location.protocol==="https:"?";Secure":"";document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)};${o};path=/;SameSite=Lax${i}`,or=null,on=null}catch(r){I.warn(`Failed to set cookie '${e}':`,r)}}function fa(e){try{return decodeURIComponent(e)}catch{return e}}function ga(e){const t=[];for(const n of e.split(";")){const r=n.trim(),o=r.indexOf("=");o!==-1&&t.push([fa(r.slice(0,o)),fa(r.slice(o+1))])}return t}function ma(){try{return document.cookie}catch(e){return I.warn("Failed to read cookies:",e),""}}function pe(e){try{if(!Ee("cookie"))return wo.get(e)??null;const t=document.cookie;if(t===or&&on)return on.get(e)??null;const n=new Map;for(const[r,o]of ga(t))n.has(r)||n.set(r,o);return or=t,on=n,n.get(e)??null}catch(t){return I.warn(`Failed to read cookie '${e}':`,t),null}}function vo(e){try{if(wo.delete(e),!Ee("cookie"))return;document.cookie=`${encodeURIComponent(e)}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;SameSite=Lax`,or=null,on=null}catch(t){I.warn(`Failed to delete cookie '${e}':`,t)}}const zg=[{name:"chrome",regex:/Chrome/},{name:"safari",regex:/Safari/},{name:"firefox",regex:/Firefox/},{name:"ie",regex:/MSIE|Trident/}],Vg=[{name:"windows",regex:/Win/},{name:"mac",regex:/Mac/},{name:"linux",regex:/Linux/},{name:"android",regex:/Android/},{name:"ios",regex:/like Mac/}];function So(e){const t=e||(typeof navigator<"u"?navigator.userAgent:"");if(!t)return{browser:"unknown",os:"unknown"};const n=zg.find(({regex:o})=>o.test(t))?.name||"unknown",r=Vg.find(({regex:o})=>o.test(t))?.name||"unknown";return I.log("Browser detection:",{browser:n,os:r,userAgent:t}),{browser:n,os:r}}function Wg(){const{browser:e,os:t}=So();typeof document<"u"&&document.documentElement&&(document.documentElement.classList.add(`browser-${e}`,`os-${t}`),I.log("Added browser/OS classes:",{browser:e,os:t}))}/**
 * uuidv7: An experimental implementation of the proposed UUID Version 7
 *
 * @license Apache-2.0
 * @copyright 2021-2023 LiosK
 * @packageDocumentation
 */const pa="0123456789abcdef";class gt{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new gt(t)}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||t<0||n<0||r<0||o<0||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/2**40,i[1]=t/2**32,i[2]=t/2**24,i[3]=t/2**16,i[4]=t/2**8,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=o>>>24,i[13]=o>>>16,i[14]=o>>>8,i[15]=o,new gt(i)}static parse(t){var n;const o=(n=/^([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{12})$/.exec(t))===null||n===void 0?void 0:n.slice(1,6).join("");if(o){const i=new Uint8Array(16);for(let s=0;s<16;s+=4){const a=parseInt(o.substring(2*s,2*s+8),16);i[s+0]=a>>>24,i[s+1]=a>>>16,i[s+2]=a>>>8,i[s+3]=a}return new gt(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let n=0;n<this.bytes.length;n++)t+=pa.charAt(this.bytes[n]>>>4),t+=pa.charAt(this.bytes[n]&15),(n===3||n===5||n===7||n===9)&&(t+="-");return t}toJSON(){return this.toString()}getType(){return this.getVariant()}getVariant(){const t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(n=>n===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(n=>n===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new gt(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;n<16;n++){const r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class Eo{constructor(t){this.random=t,this.timestamp=0,this.counter=0}static create(){return new Eo(Gg())}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,n){let r=this.generateOrAbortCore(t,n);return r===void 0&&(this.timestamp=0,r=this.generateOrAbortCore(t,n)),r}generateOrAbortCore(t,n){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(n<0||n>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+n>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return gt.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){const t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,gt.ofInner(t)}}const Gg=()=>{if(typeof crypto<"u"&&typeof crypto.getRandomValues<"u")return new Kg;if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");return{nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}};class Kg{constructor(){this.buffer=new Uint32Array(8),this.cursor=65535}nextUint32(){return this.cursor>=this.buffer.length&&(crypto.getRandomValues(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}let _a;const se=()=>Jg().toString(),Jg=()=>(_a||(_a=Eo.create())).generate();var Xg=Object.defineProperty,Yg=(e,t,n)=>t in e?Xg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ha=(e,t,n)=>Yg(e,typeof t!="symbol"?t+"":t,n),ya=(e=>(e.COLLECTION_FAILED="COLLECTION_FAILED",e.GEOLOCATION_DENIED="GEOLOCATION_DENIED",e.GEOLOCATION_TIMEOUT="GEOLOCATION_TIMEOUT",e.STORAGE_ERROR="STORAGE_ERROR",e.PARSING_ERROR="PARSING_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.PERMISSION_DENIED="PERMISSION_DENIED",e))(ya||{});class Zg extends Error{constructor(t,n,r){super(n),ha(this,"code"),ha(this,"context"),this.code=t,this.context=r,this.name="AttributionError"}}const Ne=W("geo");function wa(){const e=window.__glueConfig?.visitorIp;e&&(k("glue_user_ip",e),Ne.log("✓ IP address stored (from Cloudflare):",e))}async function ba(){try{const e=await fetch("https://get.geojs.io/v1/ip/geo.json");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json(),n=`${t.country_code} | ${t.country} | ${t.city} | ${t.latitude}, ${t.longitude}`;k("glue_user_geolocation",n),!h("glue_user_ip")&&t.ip&&(k("glue_user_ip",t.ip),Ne.log("✓ IP address stored (from geojs fallback):",t.ip)),Ne.log("✓ Geolocation stored:",n)}catch(e){throw Ne.error("Failed to fetch geolocation data:",e),new Zg(ya.NETWORK_ERROR,"Failed to fetch geolocation data",{error:e instanceof Error?e.message:String(e)})}}function Qg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"unknown"}}async function em(e){const t=new AbortController,n=setTimeout(()=>t.abort(),5e3);try{const r=await fetch(e,{method:"GET",signal:t.signal});if(clearTimeout(n),!r.ok)return null;const o=await r.json();return{ip_address:o.ip_address,source_type:"ip_lookup",country_code:o.country_code,country_name:o.country_name,region:o.region,city:o.city,postal_code:o.postal_code,latitude:o.latitude,longitude:o.longitude,accuracy_radius:o.accuracy_radius,timezone:o.timezone,isp:o.isp,organization:o.organization,connection_type:o.connection_type}}catch(r){return clearTimeout(n),Ne.warn("Edge function geolocation failed:",r),null}}async function tm(){const e=new AbortController,t=setTimeout(()=>e.abort(),5e3);try{const n=await fetch("https://get.geojs.io/v1/ip/geo.json",{signal:e.signal});if(clearTimeout(t),!n.ok)return null;const r=await n.json();return{ip_address:r.ip,source_type:"fallback",country_code:r.country_code,country_name:r.country,region:r.region,city:r.city,latitude:r.latitude?parseFloat(r.latitude):void 0,longitude:r.longitude?parseFloat(r.longitude):void 0,timezone:r.timezone}}catch(n){return clearTimeout(t),Ne.warn("GeoJS fallback failed:",n),null}}async function nm(e){const t=Qg();let n=null;if(e&&(n=await em(e),n&&Ne.log("✓ Geolocation from edge function:",n.city,n.country_name)),n||(n=await tm(),n&&Ne.log("✓ Geolocation from geojs fallback:",n.city,n.country_name)),n){const r=n.timezone&&t!=="unknown"?n.timezone!==t:void 0;n.raw_data={browser_timezone:t,timezone_mismatch:r},r&&Ne.log("⚠ Timezone mismatch detected:",{ip_timezone:n.timezone,browser_timezone:t}),!h("glue_user_ip")&&n.ip_address&&k("glue_user_ip",n.ip_address)}return n}const rm=Object.freeze(Object.defineProperty({__proto__:null,fetchAndStoreGeoLocation:ba,getGeolocationWithFallback:nm,storeCloudflareIP:wa},Symbol.toStringTag,{value:"Module"})),ko=["none","essential","analytics","full"],va={necessary:"essential",strictly_necessary:"essential",required:"essential",statistics:"analytics",performance:"analytics",marketing:"full",advertising:"full",all:"full"};function sn(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return ko.includes(t)?t:Object.prototype.hasOwnProperty.call(va,t)?va[t]:null}function De(e,t){const n=sn(e)??"none",r=sn(t)??"full";return ko.indexOf(n)>=ko.indexOf(r)}var om=Object.defineProperty,im=(e,t,n)=>t in e?om(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ir=(e,t,n)=>im(e,typeof t!="symbol"?t+"":t,n);const mt="glue_consent_state",an="glue_consent_fallback",Ao="glue_consent_check",sm=400*24*60*60,am=/^(none|essential|analytics)\.([1-9][0-9]*)$/;function Sa(e,t){return!e||!t?e??t:De(t.level,e.level)?e:t}function Ea(e){if(!e)return null;try{const t=JSON.parse(e),n=sn(t?.level);return n&&t.timestamp?{...t,level:n}:null}catch{return null}}function cm(){try{return Ea(localStorage.getItem(mt))}catch{return}}function To(e){try{return document.cookie.split(";").map(t=>t.trim()).filter(t=>t.startsWith(`${e}=`)).map(t=>t.slice(e.length+1))}catch{return[]}}function ka(e,t,n,r="/"){try{const o=window.location.protocol==="https:"?";Secure":"",i=new Date(n>0?Date.now()+n*1e3:0).toUTCString();document.cookie=`${e}=${t};expires=${i};path=${r};SameSite=Lax${o}`}catch{}}function Co(){let e=null;for(const t of To(an)){const n=am.exec(t),r=n?Number(n[2]):0,o=n&&Number.isSafeInteger(r)?{level:n[1],timestamp:r}:{level:"none",timestamp:0};e=Sa(e,o)}return e}function lm({level:e,timestamp:t}){const n=`${e}.${t}`;return ka(an,n,sm),To(an).includes(n)}function um(){const{pathname:e}=window.location,t=new Set(["/"]);for(let n=1;n<=e.length;n++)(n===e.length||e[n]==="/")&&(t.add(e.slice(0,n)),t.add(e.slice(0,n+1)));return[...t]}function Aa(){for(const e of um())ka(an,"",0,e);return To(an).length===0}function Ta(){const e=String(Date.now());let t=!1;try{localStorage.setItem(Ao,e),t=localStorage.getItem(Ao)===e}catch{}try{localStorage.removeItem(Ao)}catch{}return t}function dm(e,t){const n=typeof t=="string"?Ea(t):null;if(n&&De(e,n.level))return"holds";try{localStorage.removeItem(mt)}catch{}try{return typeof t=="string"&&localStorage.getItem(mt)===null?"empty":null}catch{return null}}class fm{constructor(t){ir(this,"config"),ir(this,"consentState"),ir(this,"listeners",new Set),ir(this,"kept",!0),this.config=t,this.consentState=this.initializeConsentState(),qg(n=>this.canUseStorage(n))}isConsentRequired(){return this.config.consent_required}getConsentLevel(){return this.config.consent_required?this.consentState.level:"full"}getConsentTimestamp(){const t=this.consentState.timestamp;return typeof t=="number"&&Number.isFinite(t)?t:1/0}isFeatureAllowed(t){if(!this.config.consent_required)return!0;if(!this.config.features[t])return!1;const n=this.getConsentLevel();return n==="none"?!1:n==="essential"?t==="form_capture":!0}canUseStorage(t){if(!this.config.consent_required)return!0;if(this.getConsentLevel()==="none")return!1;switch(this.config.storage_mode){case"memory":return!1;case"cookieless":return t!=="cookie";case"full":default:return!0}}setConsent(t,n){const r=sn(t);if(r){if(this.config.consent_required){const o=Co();if(o&&!De(o.level,r)&&!Aa())return}this.consentState={level:r,timestamp:Date.now(),source:n},this.kept=this.saveChoice(),this.listeners.forEach(o=>o(this.consentState))}}saveChoice(){const t=this.consentState,n=JSON.stringify({level:t.level,timestamp:t.timestamp});if(!this.config.consent_required){try{localStorage.setItem(mt,n)}catch{}return!0}let r;try{r=localStorage.getItem(mt)}catch{}let o=!1;try{localStorage.setItem(mt,n),o=localStorage.getItem(mt)===n}catch{}if(De(t.level,"full"))return!0;const i=o?"holds":dm(t.level,r),s=lm(t),a=s?null:Co();if(s||!!a&&De(t.level,a.level))return!0;const l=!a||Aa();return i==="holds"||i==="empty"&&l&&this.config.external.mode==="none"}canSaveConsent(){return this.config.consent_required?this.kept&&Ta():!0}isChoiceKept(){return!this.config.consent_required||this.kept}onConsentChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}getConfig(){return this.config}initializeConsentState(){if(!this.config.consent_required)return{level:"full",timestamp:Date.now(),source:"default"};if(this.config.respect_dnt&&this.shouldRespectDNT())return{level:"essential",timestamp:Date.now(),source:"default"};const t=cm(),n=Co(),r=this.startingChoice(t,n);return(r===t||r===n&&n.timestamp>0)&&t!==void 0&&!De(r.level,"full")&&(t?.level!==r.level||n?.level!==r.level)&&(this.consentState=r,this.kept=this.saveChoice()),r}startingChoice(t,n){const r=Sa(t??null,n);if(r)return r;const o=t===null?this.checkExternalConsent():null;return o&&(o.level==="none"||Ta())?o:{level:"none",timestamp:Date.now(),source:"default"}}shouldRespectDNT(){return navigator.doNotTrack==="1"||window.doNotTrack==="1"||navigator.msDoNotTrack==="1"}checkExternalConsent(){if(this.config.external.mode==="none")return null;for(const t of this.config.external.providers){const n=this.parseProviderConsent(t);if(n)return n}for(const t of this.config.external.cookie_names){const n=pe(t);if(n)return this.parseGenericConsent(n)}return null}parseProviderConsent(t){switch(t.toLowerCase()){case"onetrust":return this.parseOneTrustConsent();case"cookiebot":return this.parseCookiebotConsent();case"cookieyes":return this.parseCookieYesConsent();case"termly":return this.parseTermlyConsent();default:return null}}parseOneTrustConsent(){const t=pe("OptanonConsent");if(!t)return null;const n=t.match(/groups=([^&]*)/)?.[1];if(!n)return null;const r=n.includes("C0002:1"),o=n.includes("C0004:1");let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}parseCookiebotConsent(){const t=pe("CookieConsent");if(!t)return null;try{const n=decodeURIComponent(t),r=n.includes("statistics:true"),o=n.includes("marketing:true");let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}catch{return null}}parseCookieYesConsent(){const t=pe("cookieyes-consent");if(!t)return null;const n=t.includes("analytics:yes"),r=t.includes("advertisement:yes");let o="essential";return r?o="full":n&&(o="analytics"),{level:o,timestamp:Date.now(),source:"external"}}parseTermlyConsent(){const t=pe("termly_consent");if(!t)return null;try{const n=JSON.parse(decodeURIComponent(t)),r=n.analytics===!0,o=n.marketing===!0||n.advertising===!0;let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}catch{return null}}parseGenericConsent(t){const n=t.toLowerCase();return n==="true"||n==="accept"||n==="all"||n==="1"?{level:"full",timestamp:Date.now(),source:"external"}:n==="false"||n==="decline"||n==="none"||n==="0"?{level:"essential",timestamp:Date.now(),source:"external"}:{level:"analytics",timestamp:Date.now(),source:"external"}}}let Pe=null;function gm(e){return Pe=new fm(e),Pe}function pt(){return Pe}const Ca=()=>Pe?.isConsentRequired()??!1,Ia=()=>Pe?.getConsentLevel()??"full",mm=()=>Pe?.getConsentTimestamp()??0,cn=e=>Pe?.isFeatureAllowed(e)??!0,pm=()=>Pe?.canSaveConsent()??!0,_m=e=>Pe?.onConsentChange(e)??(()=>{}),hm=["glue_user_geolocation","glue_geo_cache"];function ym(e){return!e||typeof e!="object"?!0:e.location!==!1}function Io(){const e=globalThis.__glueConfig?.tracking?.features;return ym(e)&&cn("geolocation")}function wm(){let e=!1;for(const t of hm)h(t)!==null&&(ie(t),e=!0);return e}var bm=Object.defineProperty,vm=(e,t,n)=>t in e?bm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>vm(e,typeof t!="symbol"?t+"":t,n);function Rt(){return parseInt(String(new Date().getTime()/1e3),10)}function ln(e,t=null){const r=new RegExp(`(^|&|\\?)${e}=(.*?)($|&)`,"ig").exec(t||window.location.search);return r!==null&&r.length>1?r[2]:null}function xa(e){let t="",n=null;try{t=window.localStorage.getItem(e)||""}catch{}if(!t){const r=ma().match(new RegExp(`(^| )${e}=([^;]+)`));r&&r.length>1&&(t=r[2])}try{n=window.JSON.parse(t)}catch{}return n}function Oa(e,t){const n=window.JSON.stringify(t);try{window.localStorage.setItem(e,n)}catch{try{window.document.cookie=`${e}=${n};path=/;`}catch{}}}class Oe{constructor(t,n=null,r=Rt()){Q(this,"channel"),Q(this,"value"),Q(this,"timestamp"),this.channel=t,this.value=n,this.timestamp=r}getChannel(){return this.channel}getValue(){return this.value}getTimestamp(){return this.timestamp}updateTimestamp(){this.timestamp=Rt()}toJSON(){return{c:this.channel.getId(),v:this.value,t:this.timestamp}}static fromJSON(t,n){if(!n||typeof n.c>"u"||typeof n.t>"u")throw new Error('Touchpoint.fromJSON: expected data in form of {"c":"id","v":"value","t":1234567890}');const r=t.getChannelById(n.c);if(!r)throw new Error(`Touchpoint.fromJSON: channel "${n.c}" not found in provided engine`);return new Oe(r,n.v,n.t)}}class $t{constructor(t,n,r={}){Q(this,"id"),Q(this,"label"),Q(this,"options"),this.id=t,this.label=n,this.options=r,typeof this.options.canOverwrite>"u"&&(this.options.canOverwrite=!1),typeof this.options.isFirstViewOnly>"u"&&(this.options.isFirstViewOnly=!1),typeof this.options.priority>"u"&&(this.options.priority=100)}getId(){return this.id}getLabel(){return this.label}execute(){return null}}class xo extends $t{constructor(t,n,r,o=null,i={}){super(t,n,i),Q(this,"matchPattern"),Q(this,"valueParamName"),this.matchPattern=r,this.valueParamName=o}execute(){let t=null;if(typeof this.matchPattern=="string")t=ln(this.matchPattern)!==null;else if(this.matchPattern instanceof RegExp)t=window.location.search.match(this.matchPattern);else if(typeof this.matchPattern=="object"){const n=Object.keys(this.matchPattern),r=[];for(let o=0;o<n.length;o++){const i=this.matchPattern[n[o]],s=ln(n[o]);r.push(typeof i=="boolean"?!!s===i:s===i)}t=r.indexOf(!1)===-1}if(t){let n=null;return typeof this.valueParamName=="string"&&(n=decodeURIComponent(ln(this.valueParamName)||"")),new Oe(this,n)}return null}}class un extends $t{constructor(t,n,r,o={}){super(t,n,o),Q(this,"matchPattern"),this.matchPattern=r}execute(){let t=this.matchPattern;if((this.matchPattern instanceof RegExp||typeof this.matchPattern=="function")&&(t=[this.matchPattern]),Array.isArray(t)&&t.length>0)for(let n=0;n<t.length;n++){const r=t[n];if(r instanceof RegExp&&window.document.referrer.match(r)||typeof r=="function"&&r(window.document.referrer))return new Oe(this)}return null}}const La=class ta extends $t{execute(){for(let t=0;t<ta.searchEngineRules.length;t++){const n=ta.searchEngineRules[t];if(window.document.referrer.match(n.rule))return new Oe(this,n.valueParam?ln(n.valueParam):"")}return null}};Q(La,"searchEngineRules",[{rule:/(\.)?(google|googlesyndication|googleadservices|naver|bing|yahoo|yandex|daum|baidu|myway|ecosia|ask|dogpile|sogou|seznam|aolsvc|altavista|duckduckgo|mywebsearch|wow|webcrawler|infospace|blekko|docomo)(?=\.[a-z.]{2,5})/gi,valueParam:!1},{rule:/(\.)?(goo\.gl)/ig,valueParam:!1},{rule:/^android-app:\/\/com\.google\.android/ig,valueParam:!1}]);let Ma=La;class ae{constructor(t,n=100){Q(this,"touchpoint"),Q(this,"weight"),this.touchpoint=t,this.weight=n}getTouchpoint(){return this.touchpoint}getWeight(){return this.weight}}class Sm{constructor(t,n=[],r=1800,o="gktp"){Q(this,"model"),Q(this,"channelConfig"),Q(this,"cookieName"),Q(this,"visitDuration"),Q(this,"touchpointHistory"),Q(this,"lastTouchTimestamp"),this.model=t,this.channelConfig=n,this.cookieName=o,this.visitDuration=r,this.touchpointHistory=[],this.lastTouchTimestamp=0;const i=xa(this.cookieName);i&&this.restoreFromData(i)}execute(){const t=Rt();let n=null;for(let r=0;r<this.channelConfig.length;r++){const o=this.channelConfig[r];if(n=o.execute(),n){const s=this.touchpointHistory.length>0?this.touchpointHistory[this.touchpointHistory.length-1]:null;o.options.isFirstViewOnly&&t-this.lastTouchTimestamp<this.visitDuration?n=null:s&&s.getValue()===n.getValue()&&s.getChannel().getId()===n.getChannel().getId()?s.updateTimestamp():this.touchpointHistory.push(n);break}}return this.lastTouchTimestamp=t,Oa(this.cookieName,this.saveToData()),n}getAttributionItems(){return this.model.execute(this.getTouchpointHistory())}getTouchpointHistory(){return this.touchpointHistory}getChannelById(t){for(let n=0;n<this.channelConfig.length;n++)if(this.channelConfig[n].getId()===t)return this.channelConfig[n];return null}restoreFromData(t){t&&(this.lastTouchTimestamp=t.lt,this.touchpointHistory=[],t.e.forEach(n=>{try{const r=Oe.fromJSON(this,n);r&&this.touchpointHistory.push(r)}catch{}}))}saveToData(){return{e:this.touchpointHistory.map(t=>t.toJSON()),lt:this.lastTouchTimestamp}}}const Em=Object.freeze(Object.defineProperty({__proto__:null,AttributionEngine:Sm,AttributionItem:ae,Channel:$t,ReferrerMatchingChannel:un,SearchEngineChannel:Ma,Touchpoint:Oe,URLMatchingChannel:xo,getCurrentTime:Rt,getQueryParam:ln,storageRead:xa,storageWrite:Oa},Symbol.toStringTag,{value:"Module"})),_e=W("attribution"),km=["tt_appInfo","tt_pixel_session_index","tt_sessionId"],Am=["_fbp","_fbc"];function Ra(){_e.group("TikTok Attribution");const e={};return km.forEach(t=>{try{const n=B(t);if(n&&n!=="null"&&n!==""){const r=`glue_${t}`;k(r,n),F(r,n),J(r,n,30),e[t]=n,_e.log(`✓ ${t}:`,n)}else _e.log(`⏭ ${t} not found (normal if TikTok Pixel not present)`)}catch(n){_e.error(`Error collecting ${t}:`,n)}}),_e.log(`✓ Collected ${Object.keys(e).length} TikTok attribution fields`),_e.groupEnd(),e}function $a(){_e.group("Facebook Attribution");const e={};return Am.forEach(t=>{try{const n=pe(t);if(n&&n!=="null"&&n!==""){const r=`glue_fb_${t.substring(1)}`;k(r,n),F(r,n),J(r,n,30),e[t]=n,_e.log(`✓ ${t}:`,n)}else _e.log(`⏭ ${t} not found (normal if Facebook Pixel not present)`)}catch(n){_e.error(`Error collecting ${t}:`,n)}}),_e.log(`✓ Collected ${Object.keys(e).length} Facebook attribution fields`),_e.groupEnd(),e}var Tm=Object.defineProperty,Cm=(e,t,n)=>t in e?Tm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oo=(e,t,n)=>Cm(e,typeof t!="symbol"?t+"":t,n);const Na=class pg extends un{constructor(t="social",n="Social Media",r={}){super(t,n,pg.socialPlatforms,r)}};Oo(Na,"socialPlatforms",[/(?:\/\/|\.)facebook\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)fb\.com(?:[\/:?#]|$)/i,/m\.facebook\.com/i,/(?:\/\/|\.)instagram\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)(?:twitter\.com|t\.co|x\.com)(?:[\/:?#]|$)/i,/(?:\/\/|\.)linkedin\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)lnkd\.in(?:[\/:?#]|$)/i,/(?:\/\/|\.)tiktok\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)reddit\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)redd\.it(?:[\/:?#]|$)/i,/(?:\/\/|\.)pinterest\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)pin\.it(?:[\/:?#]|$)/i,/(?:\/\/|\.)youtube\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)youtu\.be(?:[\/:?#]|$)/i,/(?:\/\/|\.)snapchat\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)tumblr\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)whatsapp\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)telegram\.org(?:[\/:?#]|$)/i,/(?:\/\/|\.)t\.me(?:[\/:?#]|$)/i,/wechat\.com/i,/weibo\.com/i,/(?:\/\/|\.)discord\.gg(?:[\/:?#]|$)/i,/(?:\/\/|\.)discord\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)slack\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)vk\.com(?:[\/:?#]|$)/i,/vkontakte\.ru/i,/qq\.com/i,/(?:\/\/|\.)line\.me(?:[\/:?#]|$)/i,/viber\.com/i,/medium\.com/i,/quora\.com/i,/twitch\.tv/i,/github\.com/i,/stackoverflow\.com/i,/gitlab\.com/i,/bitbucket\.org/i]);let Lo=Na;class Mo extends $t{execute(){const t=[{pattern:/[?&]gclid=/i,platform:"google_ads"},{pattern:/[?&]fbclid=/i,platform:"facebook_ads"},{pattern:/[?&]msclkid=/i,platform:"microsoft_ads"},{pattern:/[?&]ttclid=/i,platform:"tiktok_ads"},{pattern:/[?&]li_fat_id=/i,platform:"linkedin_ads"},{pattern:/[?&]twclid=/i,platform:"twitter_ads"},{pattern:/[?&]epik=/i,platform:"pinterest_ads"},{pattern:/[?&]ScCid=/i,platform:"snapchat_ads"},{pattern:/[?&]utm_medium=(cpc|ppc|paid|paidsocial)/i,platform:"paid_search"}];for(const n of t)if(window.location.search.match(n.pattern))return new Oe(this,n.platform);return null}}const Da=class _g extends un{execute(){const t=super.execute();return t||(window.location.search.match(/[?&]utm_medium=email/i)?new Oe(this,"email_campaign"):null)}constructor(t="email",n="Email Marketing",r={}){super(t,n,_g.emailPlatforms,r)}};Oo(Da,"emailPlatforms",[/mail\.google\.com/i,/mail\.yahoo\.com/i,/outlook\.live\.com/i,/outlook\.office\.com/i,/mail\.aol\.com/i,/mailchimp\.com/i,/sendgrid\.net/i,/constantcontact\.com/i,/campaignmonitor\.com/i,/aweber\.com/i,/getresponse\.com/i,/activecampaign\.com/i,/klaviyo\.com/i,/hubspot\.com/i,/marketo\.com/i,/pardot\.com/i]);let Ro=Da;class $o extends $t{execute(){return(!window.document.referrer||window.document.referrer==="")&&!window.location.search.match(/utm_/i)&&!window.location.search.match(/gclid|fbclid|ttclid|msclkid/i)?new Oe(this,"direct"):null}}class sr extends Ma{}Oo(sr,"searchEngineRules",[{rule:/(\.)?(google|googlesyndication|googleadservices)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(bing)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(yahoo)(?=\.[a-z.]{2,5})/gi,valueParam:"p"},{rule:/(\.)?(yandex)(?=\.[a-z.]{2,5})/gi,valueParam:"text"},{rule:/(\.)?(baidu)(?=\.[a-z.]{2,5})/gi,valueParam:"wd"},{rule:/(\.)?(duckduckgo)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(sogou)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(soso|so)(?=\.[a-z.]{2,5})/gi,valueParam:"w"},{rule:/(\.)?(360|haosou)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(naver)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(daum)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(docomo)(?=\.[a-z.]{2,5})/gi,valueParam:"MT"},{rule:/(\.)?(seznam)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(wp)(?=\.[a-z.]{2,5})/gi,valueParam:"szukaj"},{rule:/(\.)?(startpage)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(qwant)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(searx|searxng)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(swisscows)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(mojeek)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(ecosia)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(ask)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(aol|aolsvc)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(altavista)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(dogpile)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(mywebsearch)(?=\.[a-z.]{2,5})/gi,valueParam:"searchfor"},{rule:/(\.)?(wow)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(webcrawler)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(infospace)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(blekko)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(myway)(?=\.[a-z.]{2,5})/gi,valueParam:"searchfor"},{rule:/(\.)?(wolframalpha)(?=\.[a-z.]{2,5})/gi,valueParam:"i"},{rule:/(\.)?(brave)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(neeva)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(you)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(kagi)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(rambler)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(mail\.ru)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(goo\.gl)/ig,valueParam:!1},{rule:/^android-app:\/\/com\.google\.android/ig,valueParam:!1}]);function Im(){const e=[];return e.push(new Mo("paid_ad","Paid Advertising",{canOverwrite:!0,priority:10})),e.push(new xo("utm_campaign","UTM Campaign","utm_campaign","utm_campaign",{canOverwrite:!0,priority:20})),e.push(new Lo("social","Social Media",{canOverwrite:!0,priority:30})),e.push(new Ro("email","Email Marketing",{canOverwrite:!0,priority:40})),e.push(new sr("search","Search Engine",{canOverwrite:!1,priority:50})),e.push(new un("referral","Referral",/.+/,{canOverwrite:!1,priority:60})),e.push(new $o("direct","Direct",{canOverwrite:!1,isFirstViewOnly:!0,priority:100})),e}function xm(e){if(!e.is_enabled)return null;const t={canOverwrite:e.options.canOverwrite??!1,isFirstViewOnly:e.options.isFirstViewOnly??!1,priority:e.priority};switch(e.channel_type){case"url_matching":return new xo(e.channel_id,e.channel_name,e.match_config.matchPattern||"",e.match_config.valueParamName||null,t);case"referrer_matching":return new un(e.channel_id,e.channel_name,e.match_config.referrerPatterns||[],t);case"search_engine":return new sr(e.channel_id,e.channel_name,t);case"social_media":return new Lo(e.channel_id,e.channel_name,t);case"paid_ad":return new Mo(e.channel_id,e.channel_name,t);case"email":return new Ro(e.channel_id,e.channel_name,t);case"direct":return new $o(e.channel_id,e.channel_name,t);default:return null}}function Om(e,t){return[...t,...e].sort((r,o)=>{const i=r.options.priority??100,s=o.options.priority??100;return i-s})}const Lm=Object.freeze(Object.defineProperty({__proto__:null,DirectChannel:$o,EmailMarketingChannel:Ro,ExtendedSearchEngineChannel:sr,PaidAdChannel:Mo,SocialMediaChannel:Lo,collectFacebookAttribution:$a,collectTikTokAttribution:Ra,createChannelFromConfig:xm,createDefaultChannels:Im,mergeChannelConfigs:Om},Symbol.toStringTag,{value:"Module"})),V=W("attribution"),Mm=["email","fname","lname","first_name","last_name","full_name","name","mobile","phone","phone_number","work_phone","home_phone","address","address1","address2","street","city","state","zip","zipcode","postal_code","country","company","company_name","organization","job_title","title","department","industry","website","birthday","dob","age","gender","linkedin","twitter","facebook","instagram"],No=["utm_id","utm_source","utm_medium","utm_campaign","utm_term","utm_content","fbclid","gclid","gclsrc","wbraid","gbraid","dclid","msclkid","ttclid","li_fat_id","twclid","epik","ScCid","irclickid","adset_id","ad_id","adgroup_id","campaign_id","placement","comet_source","comet_ad_id","comet_campaign","comet_ad_group","comet_network","comet_keyword","comet_placement","comet_type","comet_custom"];function Rm(e){const t=No.some(n=>n.startsWith("utm_")&&!!e.get(n));return t&&No.forEach(n=>{if(n.startsWith("utm_")&&!e.get(n)){const r=`glue_last_${n}`;ie(r),vo(r)}}),No.forEach(n=>{const r=e.get(n);if(r){const o=`glue_initial_${n}`;h(o)||k(o,r);const i=`glue_last_${n}`;k(i,r),J(i,r,365),V.log(`✓ Captured ${n}: ${r} (first & last touch)`)}}),t}const $m={comet_source:"utm_source",comet_campaign:"utm_campaign",comet_keyword:"utm_term",comet_network:"utm_medium"},Nm={comet_ad_id:"ad_id",comet_ad_group:"adgroup_id",comet_placement:"placement"},Dm={fbclid:{source:"facebook",medium:"paid"},gclid:{source:"google",medium:"cpc"},gbraid:{source:"google",medium:"cpc"},wbraid:{source:"google",medium:"cpc"},dclid:{source:"google",medium:"display"},msclkid:{source:"bing",medium:"cpc"},ttclid:{source:"tiktok",medium:"paid"},li_fat_id:{source:"linkedin",medium:"paid"},twclid:{source:"twitter",medium:"paid"},epik:{source:"pinterest",medium:"paid"},ScCid:{source:"snapchat",medium:"paid"},irclickid:{source:"impact",medium:"affiliate"}},Pm=[{pattern:/google\.[a-z.]+\/(search|url)/i,source:"google",medium:"organic"},{pattern:/bing\.com\/search/i,source:"bing",medium:"organic"},{pattern:/duckduckgo\.com/i,source:"duckduckgo",medium:"organic"},{pattern:/yahoo\.[a-z.]+\/search/i,source:"yahoo",medium:"organic"},{pattern:/baidu\.com/i,source:"baidu",medium:"organic"},{pattern:/yandex\.[a-z]+/i,source:"yandex",medium:"organic"},{pattern:/ecosia\.org/i,source:"ecosia",medium:"organic"},{pattern:/facebook\.com|fb\.com|fbcdn\.net/i,source:"facebook",medium:"social"},{pattern:/instagram\.com/i,source:"instagram",medium:"social"},{pattern:/(?:\/\/|\.)(?:twitter\.com|t\.co|x\.com)(?:[\/:?#]|$)/i,source:"twitter",medium:"social"},{pattern:/linkedin\.com|lnkd\.in/i,source:"linkedin",medium:"social"},{pattern:/tiktok\.com/i,source:"tiktok",medium:"social"},{pattern:/pinterest\.[a-z.]+/i,source:"pinterest",medium:"social"},{pattern:/snapchat\.com/i,source:"snapchat",medium:"social"},{pattern:/reddit\.com/i,source:"reddit",medium:"social"},{pattern:/youtube\.com|youtu\.be/i,source:"youtube",medium:"social"},{pattern:/threads\.net/i,source:"threads",medium:"social"},{pattern:/whatsapp\.com/i,source:"whatsapp",medium:"social"},{pattern:/telegram\.org|(?:\/\/|\.)t\.me(?:[\/:?#]|$)/i,source:"telegram",medium:"social"},{pattern:/mail\.google\.com/i,source:"gmail",medium:"email"},{pattern:/outlook\.(live|office)\.com/i,source:"outlook",medium:"email"},{pattern:/mail\.yahoo\.com/i,source:"yahoo_mail",medium:"email"},{pattern:/mail\.aol\.com/i,source:"aol_mail",medium:"email"},{pattern:/protonmail\.com|proton\.me/i,source:"protonmail",medium:"email"},{pattern:/news\.ycombinator\.com/i,source:"hackernews",medium:"referral"},{pattern:/medium\.com/i,source:"medium",medium:"referral"},{pattern:/substack\.com/i,source:"substack",medium:"referral"}],Fm=[{pattern:/FBAN|FBAV/i,app:"facebook_app",source:"facebook"},{pattern:/Instagram/i,app:"instagram_app",source:"instagram"},{pattern:/musical_ly|Bytedance|TikTok/i,app:"tiktok_app",source:"tiktok"},{pattern:/LinkedInApp/i,app:"linkedin_app",source:"linkedin"},{pattern:/Twitter/i,app:"twitter_app",source:"twitter"},{pattern:/Snapchat/i,app:"snapchat_app",source:"snapchat"},{pattern:/Pinterest/i,app:"pinterest_app",source:"pinterest"},{pattern:/Line\//i,app:"line_app",source:"line"},{pattern:/Slack/i,app:"slack_app",source:"slack"},{pattern:/Discord/i,app:"discord_app",source:"discord"}];function Um(e){Object.entries($m).forEach(([t,n])=>{const r=`glue_initial_${n}`,o=`glue_initial_${t}`,i=`glue_last_${t}`;if(!h(r)){const s=h(o)||h(i);s&&(k(r,s),e||(k(`glue_last_${n}`,s),J(`glue_last_${n}`,s,365)),V.log(`✓ Backfilled ${n} from ${t}: ${s}`))}})}function jm(){Object.entries(Nm).forEach(([e,t])=>{const n=`glue_initial_${t}`,r=`glue_initial_${e}`,o=`glue_last_${e}`;if(!h(n)){const i=h(r)||h(o);i&&(k(n,i),k(`glue_last_${t}`,i),J(`glue_last_${t}`,i,365),V.log(`✓ Backfilled ${t} from ${e}: ${i}`))}})}function qm(){if(!h("glue_initial_utm_source")){for(const[e,t]of Object.entries(Dm))if(h(`glue_initial_${e}`)||h(`glue_last_${e}`)){k("glue_initial_utm_source",t.source),k("glue_last_utm_source",t.source),J("glue_last_utm_source",t.source,365),k("glue_initial_utm_medium",t.medium),k("glue_last_utm_medium",t.medium),J("glue_last_utm_medium",t.medium,365),k("glue_attribution_derived_from",e),V.log(`✓ Derived source=${t.source}, medium=${t.medium} from ${e}`);return}}}function Hm(){if(h("glue_initial_utm_source"))return;const e=document.referrer;if(e){try{const t=new URL(e).hostname,n=window.location.hostname;if(t===n)return}catch{return}for(const{pattern:t,source:n,medium:r}of Pm)if(t.test(e)){k("glue_initial_utm_source",n),k("glue_last_utm_source",n),J("glue_last_utm_source",n,365),k("glue_initial_utm_medium",r),k("glue_last_utm_medium",r),J("glue_last_utm_medium",r,365),k("glue_attribution_derived_from","referrer"),V.log(`✓ Derived source=${n}, medium=${r} from referrer: ${e}`);return}try{const t=new URL(e).hostname.replace(/^www\./,"");k("glue_initial_utm_source",t),k("glue_last_utm_source",t),J("glue_last_utm_source",t,365),k("glue_initial_utm_medium","referral"),k("glue_last_utm_medium","referral"),J("glue_last_utm_medium","referral",365),k("glue_attribution_derived_from","referrer"),V.log(`✓ Derived source=${t}, medium=referral from unknown referrer`)}catch{}}}function Bm(){if(/Twitter/i.test(navigator.userAgent))return;const e=h("glue_in_app_browser")==="twitter_app";e&&(ie("glue_in_app_browser"),Mt("glue_in_app_browser"));const t=h("glue_attribution_derived_from")==="in_app_browser",n=e||h("glue_initial_utm_source")==="twitter"||h("glue_last_utm_source")==="twitter";!t||!n||(ie("glue_attribution_derived_from"),h("glue_initial_utm_source")==="twitter"&&(ie("glue_initial_utm_source"),ie("glue_initial_utm_medium")),h("glue_last_utm_source")==="twitter"&&(ie("glue_last_utm_source"),ie("glue_last_utm_medium"),vo("glue_last_utm_source"),vo("glue_last_utm_medium")),V.log("✓ Cleared legacy twitter_app false positive from storage"))}function zm(){const e=navigator.userAgent;for(const{pattern:t,app:n,source:r}of Fm)if(t.test(e)){k("glue_in_app_browser",n),F("glue_in_app_browser",n),h("glue_initial_utm_source")?V.log(`✓ Detected in-app browser: ${n}`):(k("glue_initial_utm_source",r),k("glue_last_utm_source",r),J("glue_last_utm_source",r,365),k("glue_initial_utm_medium","social"),k("glue_last_utm_medium","social"),J("glue_last_utm_medium","social",365),k("glue_attribution_derived_from","in_app_browser"),V.log(`✓ Detected in-app browser: ${n}, derived source=${r}`));return}}function Vm(){const e=h("glue_initial_utm_source"),t=document.referrer,n=window.location.pathname==="/"||window.location.pathname==="";let r;e?r="attributed":!t&&n?r="direct":!t&&!n?(r="dark_social",k("glue_initial_utm_source","dark_social"),k("glue_last_utm_source","dark_social"),J("glue_last_utm_source","dark_social",365),k("glue_initial_utm_medium","social"),k("glue_last_utm_medium","social"),J("glue_last_utm_medium","social",365),V.log("✓ Detected dark social traffic (no referrer, deep page)")):r="unknown",k("glue_traffic_type",r),F("glue_traffic_type",r),V.log(`✓ Traffic type: ${r}`)}function Wm(){if(!["fbclid","gclid","ttclid","msclkid"].some(n=>h(`glue_initial_${n}`)||h(`glue_last_${n}`)))return;let t=!1;(h("glue_initial_fbclid")||h("glue_last_fbclid"))&&typeof window.fbq>"u"&&(t=!0),(h("glue_initial_gclid")||h("glue_last_gclid"))&&typeof window.gtag>"u"&&typeof window.dataLayer>"u"&&(t=!0),t&&(k("glue_adblocker_detected","true"),F("glue_adblocker_detected","true"),V.log("⚠️ Ad blocker likely active (click ID present but pixel not loaded)"))}function Gm(e){V.group("Attribution Enrichment"),Um(e),jm(),qm(),Bm(),zm(),Hm(),Vm(),Wm(),V.groupEnd()}function Km(e){e.forEach((t,n)=>{if(n.startsWith("glue_")||Mm.includes(n)){const r=n.startsWith("glue_")?n:`glue_${n}`;k(r,t),F(r,t),J(r,t,30),V.log(`✓ PII data captured from query param - ${r}`)}})}function Jm(e){const t=e.get("calendly");t&&(k("calendly",t),F("calendly",t),J("calendly",t,30),V.log("✓ Calendly parameter captured:",t))}function Xm(){const e=h("glue_user_id");if(e)return e;const t=se();return k("glue_user_id",t),J("glue_user_id",t,365),V.log("✓ New user ID generated:",t),t}function Ym(){if(!h("glue_user_geolocation"))return!1;const e=h("glue_geo_cache");if(!e)return!1;try{const{data:t,timestamp:n}=JSON.parse(e),r=Date.now()-n;return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.keys(t).length>0&&Number.isFinite(n)&&r>=0&&r<864e5}catch{return!1}}function Do(){V.group("Capturing Visitor Context");const e=new URL(window.location.href),t=document.referrer,n=e.searchParams,r=So(navigator.userAgent);if(F("glue_url_current",e.href),t&&F("glue_url_last",t),F("glue_user_browser",JSON.stringify(r)),Xm(),!h("glue_user_firstseen")){const a=new Date().toISOString();k("glue_user_firstseen",a),V.log("✓ First visit captured:",a)}const o=Rm(n);if(Gm(o),Km(n),Jm(n),h("glue_url_first")||(k("glue_url_first",e.href),V.log("✓ Entry URL captured:",e.href)),t&&!h("glue_user_referrer")){const a=new URL(t).hostname;k("glue_user_referrer",a),V.log("✓ Referrer captured:",a)}const i=new Date().toISOString();F("glue_session_start",i),Io()?Ym()?V.log("✓ Skipping geolocation fetch (fresh cache present)"):ba().catch(a=>{V.error("Geolocation fetch failed:",a)}):V.log("✓ Skipping geolocation fetch (location capture is off)"),Ra(),$a();const s={userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack==="1"?!0:navigator.doNotTrack==="0"?!1:null,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`};return V.log("✓ Visitor context captured successfully"),V.groupEnd(),s}const Nt=W("forms");function ar(e,t=40){return e.length>t?`${e.slice(0,t)}…`:e}function Zm(e,t){e.forEach(n=>{n instanceof HTMLInputElement?(n.value=t,n.setAttribute("value",t)):n instanceof HTMLElement&&(n.textContent=t)})}function Qm(e){const t=[],n=e.getAttribute("glue");n&&t.push(n);const r=e.getAttribute("data-field-reference");r&&t.push(r);const o=e.id;if(o){const a=o.match(/_glue_([^_\s]+)/);a&&t.push(a[1]);const c=o.match(/field_([^_\s]+)/);c&&t.push(c[1]);const l=o.match(/^glue_([^_\s]+)/);l&&t.push(l[1])}const i=e.getAttribute("name");if(i){const a=i.match(/_glue_([^_\s]+)/);a&&t.push(a[1])}return e.classList.forEach(a=>{const c=a.match(/_glue_([^_\s]+)/);c&&t.push(c[1]);const l=a.match(/field_([^_\s]+)/);l&&t.push(l[1])}),[...new Set(t)]}function ep(){const e=new Map,t=["[glue]","[data-field-reference]",'[id*="_glue_"]','[id*="field_"]','[id^="glue_"]','[class*="_glue_"]','[class*="field_"]','[name*="_glue_"]'].join(", ");return document.querySelectorAll(t).forEach(r=>{const o=Qm(r);if(o.forEach(i=>{e.has(i)||e.set(i,[]),e.get(i).push(r)}),!(r instanceof HTMLInputElement)){const i=r.querySelectorAll("input");i.length>0&&o.forEach(s=>{i.forEach(a=>{e.get(s).includes(a)||e.get(s).push(a)})})}}),e}function Po(e,t,n){if(t==="null"||t==="")return 0;const r=n.get(e);return r&&r.length>0?(Zm(r,t),r.length):0}function tp(e){const t={temp_fname:"billing_first_name",temp_lname:"billing_last_name",temp_mobile:"billing_phone",temp_email:"billing_email"};Object.keys(t).forEach(n=>{const r=h(n)||B(n)||pe(n);if(r&&r!=="null"&&r!==""){const o=document.querySelector(`input[name="${t[n]}"]`);o&&(o.value=r,o.setAttribute("value",r),o.setAttribute("data-frmval",r),Nt.enabled()&&e.push({key:t[n],value:ar(r),source:"billing-map",elements:1}))}})}function Pa(){const e=ep(),t=da("localStorage"),n=da("sessionStorage"),r=[...new Set([...t,...n])],o=[],i=Nt.enabled();if(r.forEach(s=>{const a=h(s),c=B(s);if(a!==null&&a!=="null"&&a!==""){const l=Po(s,a,e);i&&l&&o.push({key:s,value:ar(a),source:"localStorage",elements:l})}if(c!==null&&c!=="null"&&c!==""){const l=Po(s,c,e);i&&l&&o.push({key:s,value:ar(c),source:"sessionStorage",elements:l})}}),ga(ma()).forEach(([s,a])=>{if(s&&a&&a!=="null"){const c=Po(s,a,e);i&&c&&o.push({key:s,value:ar(a),source:"cookie",elements:c})}}),tp(o),i){const s=o.reduce((a,c)=>a+c.elements,0);Nt.group(`autofill — filled ${s} element(s) from ${o.length} key(s), ${e.size} mapped key(s) on page`),o.length&&Nt.table(o),e.size&&Nt.log("mapped keys:",[...e.keys()].join(", ")),Nt.groupEnd()}}const Fo=W("ids"),Fa="glue_user_id",Uo="glue_session_id",jo="glue_session_last_activity",qo="glue_session_started_ms",Ua="glue_window_id",Ho="glue_window_claim",cr="glue_page_view_id",Bo="glue_recording_id",dn="glue_recording_seq",zo="glue_capture_sample",Vo=30*60*1e3,np=24*60*60*1e3,rp=5e3,op=15e3,ip=5*60*1e3;let fn=null;function ja(){if(fn)return fn;fn="memory";try{const e=`glue_probe_${Math.random().toString(36).slice(2)}`;F(e,"1");const t=typeof sessionStorage<"u"&&sessionStorage.getItem(e)==="1";Mt(e),t&&(fn="persistent")}catch{}return fn}function qa(){return ja()==="memory"?{storage:"memory"}:{}}let gn="";function sp(e){gn=typeof e=="string"?e:""}function ap(){if(gn)return gn;try{const e=globalThis?.__glueConfig?.workspaceId;typeof e=="string"&&(gn=e)}catch{}return gn}function cp(){const e=h(Fa);if(e)return e;const t=se();return k(Fa,t),t}function Wo(){try{const e=h(Ho);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const r of Object.keys(t)){const o=Number(t[r]);Number.isFinite(o)&&(n[r]=o)}return n}catch{return{}}}function Ha(e){const t=Date.now();for(const n of Object.keys(e))t-e[n]>ip&&delete e[n];try{Object.keys(e).length===0?ie(Ho):k(Ho,JSON.stringify(e))}catch{}}function Go(e){const t=Wo();t[e]=Date.now(),Ha(t)}function lp(e){const t=Wo();delete t[e],Ha(t)}let le=null;function Ko(){if(le)return le;const e=B(Ua);if(e){const t=Wo()[e];typeof t=="number"&&Date.now()-t<op?Fo.log("duplicated tab detected, minting a new window_id"):le=e}return le||(le=se(),F(Ua,le),F(cr,se())),Go(le),le}function Ba(){const e=B(cr);if(e)return e;const t=se();return F(cr,t),t}function Jo(){const e=se();return F(cr,e),e}function mn(){return B(Bo)||null}function Xo(e){e?F(Bo,e):(Mt(Bo),Mt(dn))}function za(){const e=parseInt(B(dn)||"0",10),t=Number.isFinite(e)&&e>=0?e:0;return F(dn,String(t+1)),t}function Va(){const e=parseInt(B(dn)||"0",10);return Number.isFinite(e)&&e>=0?e:0}function Yo(e){if(!Number.isFinite(e))return;const t=Math.max(Va(),Math.floor(e)+1);F(dn,String(t))}const lr=[];function Wa(e){return lr.push(e),()=>{const t=lr.indexOf(e);t>=0&&lr.splice(t,1)}}function up(e){for(const t of lr.slice())try{t(e)}catch(n){Fo.warn("session rotation hook failed:",n)}}function Ga(){const e=parseInt(B(qo)||"0",10),t=parseInt(B(jo)||"0",10);return{started:Number.isFinite(e)?e:0,activity:Number.isFinite(t)?t:0}}function pn(e,t){const n=B(Uo)||null,r=mn(),o=se();return F(Uo,o),F(qo,String(t)),F(jo,String(t)),Mt(zo),n&&(Jo(),Xo(null),Fo.log(`session rotated (${e}):`,n,"->",o),up({session_id:o,previous_session_id:n,previous_recording_id:r,reason:e,at:t})),{session_id:o,started_at:t,last_activity:t,rotated:!0,reason:e}}function Zo(e="human",t=Date.now()){const n=B(Uo);if(!n)return pn("new",t);const{started:r,activity:o}=Ga();return o&&t-o>Vo?pn("idle",t):r&&t-r>np?pn("max_length",t):(e==="human"&&F(jo,String(t)),r||F(qo,String(o||t)),{session_id:n,started_at:r||o||t,last_activity:e==="human"?t:o||t,rotated:!1,reason:null})}let ur=null;function Ka(){typeof setTimeout=="function"&&(ur&&clearTimeout(ur),ur=setTimeout(()=>{ur=null;const{activity:e}=Ga();e&&Date.now()-e>Vo?pn("idle",Date.now()):Ka()},Vo*1.1))}function dp(e="explicit"){return pn(e,Date.now())}function _t(){return{workspace_id:ap(),glue_user_id:cp(),session_id:Zo("passive").session_id,window_id:Ko(),page_view_id:Ba(),recording_id:mn()}}function fp(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function gp(e){try{const t=JSON.parse(B(zo)||"null");return!t||typeof t!="object"?{v:e}:t.v!==e?{v:e}:t}catch{return{v:e}}}function dr(e,t,n=""){const r=typeof t=="number"&&isFinite(t)?t:1;if(r>=1)return!0;if(r<=0)return!1;const o=gp(n);if(typeof o[e]=="boolean")return o[e];const i=Zo("passive").session_id,s=fp(`${e}:${i}`)/4294967296<r;o[e]=s,o.v=n;try{F(zo,JSON.stringify(o))}catch{}return s}let Ja=!1;function fr(){Ja||typeof window>"u"||(Ja=!0,Ko(),Ka(),setInterval(()=>{le&&Go(le)},rp),window.addEventListener("pagehide",()=>{le&&lp(le)}),window.addEventListener("pageshow",e=>{e?.persisted&&(le&&Go(le),Jo())}))}function Xa(e){return typeof e=="string"&&/^https:\/\/[a-z0-9.-]+\/ingest$/i.test(e)?e:null}const Fe=W("sync"),mp="plugins-4",Ya="glue_pending_batches",Za="glue_pending_batch_v2:",gr=new Set;let Qa=!1;const pp=20,_p=2e5,hp=6,Qo=[1e3,4e3,16e3],yp=.2,ec=1e4,tc=5*60*1e3,nc=6e4,wp=1e4;let he=null,ei=null,ht=null,ti=null,_n=null,ke={},hn=0,rc=!1,Ue=null,je={device_fingerprint:!1,geolocation:!1,enhanced_context:!1,devtools_data_timestamp:0},ye={device_fingerprint:!1,geolocation:!1,enhanced_context:!1,devtools_data:!1};function Ke(e){return Za+e}function Je(){if(Ue||(Ue=[]),!Qa){Qa=!0;try{const n=JSON.parse(h(Ya)||"[]");if(Array.isArray(n)){for(const r of n)!r?.id||!r.payload||h(Ke(r.id))||k(Ke(r.id),JSON.stringify(r));n.every(r=>!r?.id||h(Ke(r.id)))&&ie(Ya)}}catch{Fe.warn("legacy pending queue could not be migrated")}}const e=ua(Za),t=new Set;for(const n of e)try{const r=JSON.parse(h(n)||"null");if(!r||typeof r.id!="string"||!r.payload||he?.workspaceId&&r.payload.workspace_id&&r.payload.workspace_id!==he.workspaceId)continue;t.add(r.id),gr.add(r.id),Ue.some(o=>o.id===r.id)||Ue.push(r)}catch{}return Ue=Ue.filter(n=>!gr.has(n.id)||t.has(n.id)),Ue.sort((n,r)=>n.created_at-r.created_at)}function oc(e){gr.has(e.id)&&!h(Ke(e.id))||(k(Ke(e.id),JSON.stringify(e)),h(Ke(e.id))&&gr.add(e.id))}function bp(){const e=Je();for(;e.length>pp||e.length>0&&JSON.stringify(e).length>_p;){const t=e.shift();ie(Ke(t.id)),Fe.warn(`pending batch capacity reached: ${t.id} (${(t.payload.events||[]).length} events)`)}}function vp(e){ie(Ke(e.id)),Ue=(Ue||[]).filter(t=>t.id!==e.id)}function ic(e){return(Array.isArray(e?.events)?e.events:[]).map(n=>n&&typeof n.event_id=="string"?n.event_id:"").filter(n=>n.length>0)}function Sp(){const e=new Set;for(const t of Je())for(const n of ic(t.payload))e.add(n);return e}function Ep(e){ei=e}function kp(e){const t=new Set,n=[];for(const r of e||[]){const o=r&&typeof r.event_id=="string"?r.event_id:"";if(o){if(t.has(o))continue;t.add(o)}n.push(r)}return n}function Ap(e){const t={};for(const n of Object.keys(e))n!=="devtools_data"&&(t[n]=e[n]);return JSON.parse(JSON.stringify(t))}function Tp(e,t){const n=se();e.batch_id=n,e.sent_at=new Date().toISOString(),e.attempt=1,e.sdk={version:mp,page_leave:t};const r={id:n,payload:Ap(e),attempt:0,status:"pending",created_at:Date.now(),next_at:Date.now(),unknown:0};return Je().push(r),oc(r),bp(),r}function sc(){const e=typeof window<"u"?window.__glueConfig?.ingestUrl:void 0;return Xa(e)??`${he.supabaseUrl}/functions/v1/ingest-events`}function Cp(e,t,n){const r=e>=200&&e<300;return t?.ledger==="unavailable"||t?.accepted===!1?"failed":r&&t&&t.success===!0&&t.batch_id===n&&(t.accepted===!0||t.duplicate===!0)?"delivered":r?"unknown":"failed"}function Ip(e){return e===429?"throttled":e===0||e===408||e>=500?"transient":e>=400?"permanent":"transient"}function xp(e,t=Date.now()){if(!e)return null;const n=Number(e);if(Number.isFinite(n)&&n>=0)return Math.min(n*1e3,tc);const r=Date.parse(e);return Number.isNaN(r)?null:Math.min(Math.max(0,r-t),tc)}async function ni(e,t,n){let r=!1,o=null,i;const s=globalThis.AbortController;if(typeof s=="function"){const a=new s;i=a.signal,o=setTimeout(()=>{r=!0;try{a.abort()}catch{}},ec)}try{const a=await fetch(sc(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:n,...i?{signal:i}:{}});let c=null;try{c=await a.json()}catch{c=null}const l=Cp(a.status,c,e.id);if(l!=="failed")return{ack:l,failure:null,retryAfterMs:null};const u=Ip(a.status),d=xp(typeof a.headers?.get=="function"?a.headers.get("Retry-After"):null);return Fe.error(`sync rejected (${a.status}, ${u})`,c),{ack:l,failure:u,retryAfterMs:d}}catch(a){return r?Fe.warn(`sync request timed out after ${ec}ms`):Fe.error("supabase sync error:",a),{ack:"failed",failure:"transient",retryAfterMs:null}}finally{o&&clearTimeout(o)}}let ac=0;function Op(){return ac}const Lp=64e3;function Mp(e){try{if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return!1;const t=JSON.stringify(e),n=new Blob([t]).size;if(n>nc)return!1;const r=navigator.sendBeacon(sc(),new Blob([t],{type:"application/json"}));return r&&(ac+=n),r}catch{return!1}}function cc(e){const t=e*yp;return Math.max(0,Math.round(e-t+Math.random()*t*2))}function mr(e,t){const n=typeof t=="string"?t:t.ack,r=typeof t=="string"?null:t.failure,o=typeof t=="string"?null:t.retryAfterMs;if(n==="delivered"){if(vp(e),ei)try{ei(ic(e.payload))}catch(i){Fe.warn("delivered hook failed",i)}return}if(e.attempt+=1,n==="unknown"&&(e.unknown+=1),r&&(e.failure=r),r==="permanent")e.status="exhausted",e.next_at=null;else if(e.attempt>=hp)e.status="exhausted",e.next_at=null;else if(n==="blind")e.next_at=null;else if(r==="throttled")e.next_at=Date.now()+(o??cc(Qo[Qo.length-1]));else{const i=Qo[e.attempt-1];e.next_at=i===void 0?null:Date.now()+cc(i)}oc(e),Rp()}function Rp(){if(ti||typeof setTimeout!="function")return;let e=1/0;for(const t of Je())t.status!=="pending"||t.next_at===null||t.next_at<e&&(e=t.next_at);isFinite(e)&&(ti=setTimeout(()=>{ti=null,pr()},Math.max(0,e-Date.now())))}let ri=!1;async function pr(e=!1){if(!(!he||ri)){ri=!0;try{const t=Date.now();for(const n of Je().slice()){if(n.status!=="pending"||!e&&(n.next_at===null||n.next_at>t))continue;const r={...n.payload,batch_id:n.id,attempt:n.attempt+1,sent_at:new Date().toISOString()};mr(n,await ni(n,r,!1))}}finally{ri=!1}}}function $p(e){he=e,!rc&&typeof window<"u"&&(rc=!0,window.addEventListener("pagehide",()=>{queueMicrotask(()=>{oi(!0)})}),window.addEventListener("online",()=>{pr(!0)})),pr(!0)}function Np(e){ke={...ke,...e}}function Dp(e){const t=Date.now(),n={device_fingerprint:!!(ke.device_fingerprint&&!je.device_fingerprint&&!ye.device_fingerprint),geolocation:!!(ke.geolocation&&!je.geolocation&&!ye.geolocation),enhanced_context:!!(ke.enhanced_context&&!je.enhanced_context&&!ye.enhanced_context),devtools_data:!!(ke.devtools_data&&t-je.devtools_data_timestamp>=3e4&&!ye.devtools_data),devtools_data_timestamp:t};return n.device_fingerprint&&(e.device_fingerprint=ke.device_fingerprint),n.geolocation&&(e.geolocation=ke.geolocation),n.enhanced_context&&(e.enhanced_context=ke.enhanced_context),n.devtools_data&&(e.devtools_data=ke.devtools_data),n.device_fingerprint&&(ye.device_fingerprint=!0),n.geolocation&&(ye.geolocation=!0),n.enhanced_context&&(ye.enhanced_context=!0),n.devtools_data&&(ye.devtools_data=!0),n}function lc(e){e.device_fingerprint&&(je.device_fingerprint=!0),e.geolocation&&(je.geolocation=!0),e.enhanced_context&&(je.enhanced_context=!0),e.devtools_data&&(je.devtools_data_timestamp=Math.max(je.devtools_data_timestamp,e.devtools_data_timestamp))}function Pp(e){e.device_fingerprint&&(ye.device_fingerprint=!1),e.geolocation&&(ye.geolocation=!1),e.enhanced_context&&(ye.enhanced_context=!1),e.devtools_data&&(ye.devtools_data=!1)}function Fp(e,t){const n=e,r=Sp(),o=kp(n.events).filter(a=>!(a&&a.delivered===!0)).filter(a=>!(a&&typeof a.event_id=="string"&&r.has(a.event_id))),i={hostname:he.hostname,profile:n.profile,sessions:n.sessions,events:o,touchpoints:ke.touchpoints};he.workspaceId?i.workspace_id=he.workspaceId:he.workspaceApiKey&&(i.workspace_api_key=he.workspaceApiKey);const s=qa();return s.storage&&(i.meta=s),i}async function _r(e,t={}){if(!he)return Fe.warn("supabase sync not initialized"),!1;let n;try{const r=Fp(e,!!t.keepalive);n=Dp(r);const o=Tp(r,!!t.keepalive);if(t.keepalive)return uc(o,r),lc(n),!0;const i=await ni(o,r,!1),s=i.ack;return mr(o,i),s==="delivered"?(lc(n),Fe.log(`synced batch ${o.id} (${s})`),!0):!1}catch(r){return Fe.warn("could not queue tracking batch",r),!1}finally{n&&Pp(n)}}function uc(e,t){const r=Je().filter(o=>o.status==="pending").slice(-5);r.indexOf(e)===-1&&r.push(e);for(const o of r){const s={...o===e?t:o.payload,batch_id:o.id,attempt:o.attempt+1};if(!(new Blob([JSON.stringify(s)]).size>nc)){if(Mp(s)){mr(o,"blind");continue}ni(o,s,!0).then(a=>mr(o,a.ack==="failed"?"blind":a))}}}function Up(e,t=5e3){if(_n=e,hn||(hn=Date.now()),Date.now()-hn>=wp){oi();return}ht&&clearTimeout(ht),ht=setTimeout(()=>{ht=null;const n=_n;_n=null,hn=0,n&&_r(n())},t)}async function oi(e=!1){ht&&(clearTimeout(ht),ht=null);const t=_n;if(_n=null,hn=0,!t){if(e){const n=Je().slice(-1)[0];n&&uc(n,n.payload)}return!0}return _r(t(),{keepalive:e})}async function jp(e,t,n){return _r({profile:e,sessions:[t],events:[n]})}function qp(){const e=Date.now(),t=Je().map(r=>({id:r.id,status:r.status,attempt:r.attempt,events:Array.isArray(r.payload.events)?r.payload.events.length:0,age_ms:e-r.created_at,...r.failure?{failure:r.failure}:{}})),n=t.filter(r=>r.status==="pending");return{pending:n.length,exhausted:t.length-n.length,events_pending:n.reduce((r,o)=>r+o.events,0),oldest_pending_age_ms:n.length?Math.max(...n.map(r=>r.age_ms)):0,batches:t}}function Hp(){return he!==null}const ee={initializeSupabaseSync:$p,onBatchDelivered:Ep,setExtendedData:Np,syncToSupabase:_r,debouncedSync:Up,flushPendingSync:oi,syncEvent:jp,drainPending:pr,getDeliveryDiagnostics:qp,isSupabaseSyncEnabled:Hp};function Bp(e){const t=n=>{if(!n.isTrusted)return;const o=n.composedPath().find(c=>c instanceof Element)?.closest('a[href],button,[role="button"],input[type="submit"],input[type="button"]');if(!o||o.closest("[data-glue-ignore],[data-private]")||o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true")return;const i=o.getAttribute("href"),a={text:(o.getAttribute("aria-label")||o.getAttribute("data-framer-name")||o.textContent||"").trim().replace(/\s+/g," ").slice(0,200),id:o.id||void 0,element:o.tagName.toLowerCase(),path:location.pathname,keyboard:n.detail===0};if(i){try{const c=new URL(i,location.href);if(!["http:","https:","mailto:","tel:"].includes(c.protocol))return;c.username="",c.password="",a.href=c.href.slice(0,2048),a.link_type=c.protocol==="mailto:"?"email":c.protocol==="tel:"?"phone":o.hasAttribute("download")?"download":c.origin===location.origin?"internal":"outbound"}catch{return}e("link_click",a)}else e("button_click",a)};return document.addEventListener("click",t,{capture:!0,passive:!0}),()=>document.removeEventListener("click",t,!0)}function dc(e){const t=new URL(e);return t.origin+t.pathname+t.search+(/^#(?:\/|!)/.test(t.hash)?t.hash:"")}let ii=Date.now(),hr=0,si=0,ai=0,ci=0,fc=0,yn=Date.now(),Dt=!document.hidden,li=!1,gc,mc=0,pc=0,_c=0,hc=0,yc=0,wc=!1,Pt=[],ui=0,bc=0,di=0,vc=0,Sc=0,Ec=0,wn=[],bn=[],kc=0,Ac=0,Tc=0,Cc=0,Ic=0,fi,gi,xc=0,mi,Oc=0,Lc=0,Mc=null,Rc=null,$c=null,Nc=null;function zp(){if(wc)return;wc=!0;const e=Dc(()=>{pc++,yr()},100);window.addEventListener("scroll",()=>{hr=Math.max(hr,window.scrollY),si=Math.max(si,window.scrollX),e()},{passive:!0}),document.addEventListener("visibilitychange",()=>{const t=Date.now(),n=t-yn;Dt?ai+=n:ci+=n,Dt=!document.hidden,yn=t,fc++}),document.addEventListener("click",t=>{const n=Date.now();mc++,wn.push(n),wn.length>5&&wn.shift(),wn.filter(i=>n-i<500).length>=3&&(vc++,wn.length=0);const o=t.target;o&&!Vp(o)&&Sc++,yr()},{passive:!0}),document.addEventListener("keydown",t=>{const n=Date.now();if(_c++,di++,ui>0){const r=n-ui;r<2e3&&(Pt.push(r),Pt.length>20&&Pt.shift())}ui=n,t.key==="Backspace"&&(bc++,bn.push(n),bn.length>5&&bn.shift(),bn.filter(o=>n-o<500).length>=3&&(Ec++,bn.length=0)),yr()},{passive:!0}),document.addEventListener("touchstart",()=>{hc++,yr()},{passive:!0}),document.addEventListener("mousemove",Dc(()=>{yc++},100),{passive:!0}),document.addEventListener("copy",()=>{kc++},{passive:!0}),document.addEventListener("paste",()=>{Ac++},{passive:!0}),document.addEventListener("cut",()=>{Tc++},{passive:!0}),window.addEventListener("beforeprint",()=>{Cc++}),document.addEventListener("contextmenu",()=>{Ic++},{passive:!0}),Wp()}function Vp(e){const t=["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL"],n=["button","link","checkbox","radio","tab","menuitem"];return!!(t.includes(e.tagName)||e.getAttribute("role")&&n.includes(e.getAttribute("role"))||e.onclick||e.getAttribute("onclick")||e.closest('a, button, [role="button"], [onclick]'))}function Wp(){try{const e=performance.getEntriesByType("navigation")[0];if(e&&(mi=e.responseStart-e.requestStart),"PerformanceObserver"in window){try{Mc=new PerformanceObserver(t=>{const n=t.getEntries();fi=n[n.length-1].startTime}),Mc.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{Rc=new PerformanceObserver(t=>{for(const n of t.getEntries())n.hadRecentInput||(xc+=n.value)}),Rc.observe({type:"layout-shift",buffered:!0})}catch{}try{$c=new PerformanceObserver(t=>{const n=t.getEntries()[0];gi=n.processingStart-n.startTime}),$c.observe({type:"first-input",buffered:!0})}catch{}try{Nc=new PerformanceObserver(t=>{for(const n of t.getEntries())Oc++,Lc+=Math.max(0,n.duration-50)}),Nc.observe({type:"longtask",buffered:!0})}catch{}}}catch{}}function yr(){li||(li=!0,gc=Date.now())}function Dc(e,t){let n=0;return(...r)=>{const o=Date.now();o-n>=t&&(n=o,e(...r))}}function Pc(){const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return{effectiveType:e?.effectiveType,downlink:e?.downlink,rtt:e?.rtt,saveData:e?.saveData,type:e?.type,online:navigator.onLine}}function Fc(){const e=r=>{try{return window.matchMedia(r).matches}catch{return!1}};let t="no-preference";e("(prefers-color-scheme: dark)")?t="dark":e("(prefers-color-scheme: light)")&&(t="light");let n="no-preference";return e("(prefers-contrast: more)")?n="more":e("(prefers-contrast: less)")&&(n="less"),{colorScheme:t,reducedMotion:e("(prefers-reduced-motion: reduce)"),reducedData:e("(prefers-reduced-data: reduce)"),contrast:n,reducedTransparency:e("(prefers-reduced-transparency: reduce)"),forcedColors:e("(forced-colors: active)")}}function Uc(){const e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight),t=window.innerHeight,n=e-t,r=n>0?Math.round(window.scrollY/n*100):0,o=n>0?Math.round(hr/n*100):0;return{scrollY:Math.round(window.scrollY),scrollX:Math.round(window.scrollX),maxScrollY:Math.round(hr),maxScrollX:Math.round(si),scrollDepthPercent:Math.min(100,r),maxScrollDepthPercent:Math.min(100,o),documentHeight:e,viewportHeight:t}}function jc(){const e=Date.now(),t=e-yn,n=Dt?ai+t:ai,r=Dt?ci:ci+t;return{visibilityState:document.visibilityState,hasFocus:document.hasFocus(),timeVisible:n,timeHidden:r,visibilityChanges:fc,lastVisibleAt:Dt?e:yn,lastHiddenAt:Dt?yn:e}}function qc(){const t=Date.now()-ii;let n,r,o,i;try{const s=performance.getEntriesByType("navigation")[0];s&&(n=Math.round(s.domContentLoadedEventEnd),r=Math.round(s.loadEventEnd));const a=performance.getEntriesByType("paint");for(const c of a)c.name==="first-paint"?o=Math.round(c.startTime):c.name==="first-contentful-paint"&&(i=Math.round(c.startTime))}catch{}return{pageLoadTime:t,timeOnPage:t,sessionStartTime:ii,navigationStart:performance.timeOrigin||ii,domContentLoaded:n,loadComplete:r,firstPaint:o,firstContentfulPaint:i}}function Hc(){return{hasInteracted:li,firstInteractionTime:gc,clickCount:mc,scrollCount:pc,keyPressCount:_c,touchCount:hc,mouseMovements:yc}}function Bc(){const e=Pt.length>0?Math.round(Pt.reduce((t,n)=>t+n,0)/Pt.length):0;return{rageClicks:vc,deadClicks:Sc,rapidBackspaces:Ec,typingCadence:e,backspaceRatio:di>0?Math.round(bc/di*100)/100:0,copyCount:kc,pasteCount:Ac,cutCount:Tc,printAttempts:Cc,contextMenuCount:Ic}}function zc(){let e=0,t=0,n=0;try{const i=performance.getEntriesByType("resource");e=i.length;const s=window.location.hostname;for(const a of i){t+=a.transferSize||0;try{new URL(a.name).hostname!==s&&n++}catch{}}}catch{}let r,o;try{const i=performance.memory;i&&(r=i.usedJSHeapSize,o=i.jsHeapSizeLimit)}catch{}return{LCP:fi?Math.round(fi):void 0,FID:gi?Math.round(gi):void 0,CLS:Math.round(xc*1e3)/1e3,INP:void 0,TTFB:mi?Math.round(mi):void 0,resourceCount:e,resourceTotalSize:t,thirdPartyRequests:n,longTaskCount:Oc,totalBlockingTime:Math.round(Lc),usedJSHeapSize:r,jsHeapSizeLimit:o}}async function Gp(){const e={},t=["notifications","geolocation","camera","microphone","clipboard-read"],n=["notifications","geolocation","camera","microphone","clipboard"];for(let r=0;r<t.length;r++)try{const o=await navigator.permissions.query({name:t[r]});e[n[r]]=o.state}catch{}return e}async function Kp(){return new Promise(e=>{try{const t=document.createElement("div");t.className="adsbox ad-banner ad-placeholder pub_300x250 textAd",t.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;",t.innerHTML="&nbsp;",document.body.appendChild(t),setTimeout(()=>{const n=t.offsetHeight===0||t.offsetWidth===0||t.clientHeight===0||window.getComputedStyle(t).display==="none"||window.getComputedStyle(t).visibility==="hidden";t.remove(),e(n)},50)}catch{e(!1)}})}async function Jp(){try{if("storage"in navigator&&"estimate"in navigator.storage){const{quota:e}=await navigator.storage.estimate();return!!(e&&e<13e7)}return"webkitRequestFileSystem"in window?new Promise(e=>{window.webkitRequestFileSystem(0,1,()=>e(!1),()=>e(!0))}):null}catch{return null}}async function Xp(){const[e,t,n]=await Promise.all([Gp(),Kp(),Jp()]);return{network:Pc(),preferences:Fc(),scroll:Uc(),attention:jc(),timing:qc(),interaction:Hc(),biometrics:Bc(),vitals:zc(),permissions:e,adBlocker:t,incognito:n}}function Yp(){return{network:Pc(),preferences:Fc(),scroll:Uc(),attention:jc(),timing:qc(),interaction:Hc(),biometrics:Bc(),vitals:zc()}}function Vc(){const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Wc(){return/Android/i.test(navigator.userAgent)}function Gc(){const e=navigator.userAgent;return/iPad|Android.*Tablet|Kindle|Silk|PlayBook/i.test(e)?"tablet":/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(e)||navigator.maxTouchPoints>0&&window.innerWidth<768?"mobile":navigator.maxTouchPoints>0&&window.innerWidth<1024?"tablet":"desktop"}function Zp(){return new Promise(e=>{if(!window.DeviceOrientationEvent){e(void 0);return}const t=n=>{window.removeEventListener("deviceorientation",t),e({alpha:n.alpha,beta:n.beta,gamma:n.gamma,absolute:n.absolute})};window.addEventListener("deviceorientation",t,{once:!0}),setTimeout(()=>{window.removeEventListener("deviceorientation",t),e(void 0)},500)})}function Qp(){return new Promise(e=>{if(!window.DeviceMotionEvent){e(void 0);return}const t=n=>{window.removeEventListener("devicemotion",t),e({acceleration:{x:n.acceleration?.x??null,y:n.acceleration?.y??null,z:n.acceleration?.z??null},accelerationIncludingGravity:{x:n.accelerationIncludingGravity?.x??null,y:n.accelerationIncludingGravity?.y??null,z:n.accelerationIncludingGravity?.z??null},rotationRate:{alpha:n.rotationRate?.alpha??null,beta:n.rotationRate?.beta??null,gamma:n.rotationRate?.gamma??null},interval:n.interval})};window.addEventListener("devicemotion",t,{once:!0}),setTimeout(()=>{window.removeEventListener("devicemotion",t),e(void 0)},500)})}async function Kc(){const e=Vc(),t=Wc(),n=Gc(),r=n==="mobile",o=n==="tablet";let i,s;return(r||o)&&([i,s]=await Promise.all([Zp(),Qp()])),{isIOS:e,isAndroid:t,isMobile:r,isTablet:o,deviceType:n,deviceOrientation:i,deviceMotion:s}}const Jc={collectMobileData:Kc,detectIOS:Vc,detectAndroid:Wc,detectDeviceType:Gc},e_=Object.freeze(Object.defineProperty({__proto__:null,collectMobileData:Kc,default:Jc},Symbol.toStringTag,{value:"Module"})),pi=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],Xc=["gclid","gclsrc","wbraid","gbraid","dclid","fbclid","ttclid","msclkid","li_fat_id","twclid","epik","ScCid","irclickid"],Yc=[...pi,...Xc,"campaign_id","adset_id","ad_id","adgroup_id","placement","comet_source","comet_ad_id","comet_campaign","comet_ad_group","comet_network","comet_keyword","comet_placement","comet_type","comet_custom"],Zc={gclid:["google","cpc"],gclsrc:["google","cpc"],wbraid:["google","cpc"],gbraid:["google","cpc"],dclid:["google","display"],fbclid:["facebook","paid_social"],ttclid:["tiktok","paid_social"],msclkid:["bing","cpc"],li_fat_id:["linkedin","paid_social"],twclid:["x","paid_social"],epik:["pinterest","paid_social"],ScCid:["snapchat","paid_social"],irclickid:["impact","affiliate"]},t_={"google.":"google","bing.":"bing","yahoo.":"yahoo","duckduckgo.":"duckduckgo","baidu.":"baidu","yandex.":"yandex"};function n_(e){return/^fb\.\d\.\d+\.(.+)$/.exec(e)?.[1]}function r_(e,t=Date.now()){return`fb.1.${t}.${e}`}function Qc(e,t){return Object.fromEntries(t.flatMap(n=>{const r=e.get(n)?.trim();return r?[[n,r]]:[]}))}function o_(e,t){if(!e)return null;try{const n=new URL(e).hostname.toLowerCase();if(!n||n===t||n.endsWith(`.${t}`))return null;const r=Object.entries(t_).find(([o])=>n.includes(o));return r?{source:r[1],medium:"organic",kind:"organic"}:{source:n.replace(/^www\./,""),medium:"referral",kind:"referral"}}catch{return null}}function i_(){const e=h("glue_last_non_direct_acquisition");if(e)try{return JSON.parse(e)}catch{return}}function s_(e=90){const t=i_();if(!t)return;const n=Date.parse(t.captured_at);if(!(!Number.isFinite(n)||Date.now()-n>e*864e5))return t}function el(e=window.location.href,t=document.referrer){const n=new URL(e),r=Qc(n.searchParams,pi),o=Qc(n.searchParams,Yc.filter(d=>!pi.includes(d))),i=pe("_fbp")||h("glue_fbp"),s=pe("_fbc")||h("glue_fbc");i&&(o.fbp=i),o.fbclid&&(!s||n_(s)!==o.fbclid)?o.fbc=r_(o.fbclid):s&&(o.fbc=s);let a=r.utm_source,c=r.utm_medium,l=a?"campaign":"direct";if(!a){const d=Xc.find(g=>o[g]&&Zc[g]);d&&([a,c]=Zc[d],l="paid_click")}if(!a){const d=o_(t,n.hostname.toLowerCase());d&&({source:a,medium:c,kind:l}=d)}const u={source:a||"direct",medium:c||"(none)",campaign:r.utm_campaign,kind:l,is_direct:!a,captured_at:new Date().toISOString(),landing_page:`${n.pathname}${n.search}${n.hash}`,referrer:t||void 0,utm:r,tracking:o};return F("glue_current_acquisition",JSON.stringify(u)),u.is_direct||(h("glue_first_acquisition")||k("glue_first_acquisition",JSON.stringify(u)),k("glue_last_non_direct_acquisition",JSON.stringify(u)),k("glue_last_non_direct_at",u.captured_at),u.tracking.fbp&&k("glue_fbp",u.tracking.fbp),u.tracking.fbc&&k("glue_fbc",u.tracking.fbc)),u}function a_(e=window.location.href){const t=new URL(e).searchParams;return Yc.some(n=>!!t.get(n))}function tl(e){return JSON.stringify({source:e.source,medium:e.medium,campaign:e.campaign,utm:e.utm,tracking:e.tracking})}const ce=W("journey"),U={sessions:null,events:null,sessionsDirty:!1,eventsDirty:!1,lastFlush:0},c_=100;let _i=null;function wr(){_i||(_i=setTimeout(()=>{_i=null,vn()},c_))}function vn(){U.sessionsDirty&&U.sessions&&(k("glue_sessions",JSON.stringify(U.sessions)),U.sessionsDirty=!1),U.eventsDirty&&U.events&&(k("glue_events",JSON.stringify(U.events)),U.eventsDirty=!1),U.lastFlush=Date.now()}typeof window<"u"&&(window.addEventListener("beforeunload",vn),window.addEventListener("pagehide",vn));const hi={maxEvents:1e3,maxSessions:100,autoTrackPageViews:!0,autoTrackClicks:!0,autoTrackFormSubmits:!0,autoSync:!1,syncInterval:6e4,piiCaptureEnabled:!0,formInjectionEnabled:!0},l_=100;let nl=!1,rl=!1;function Sn(e="human"){const t=Zo(e),r=Xe().find(o=>o.session_id===t.session_id);return r||ol(t.session_id)}function u_(){return ol(dp("explicit").session_id)}function ol(e){const t=new URL(window.location.href),n=el(),r=n.is_direct?s_():n,o=c=>n.utm[c]||n.tracking[c]||void 0,i={session_id:e,session_start:new Date().toISOString(),landing_page:`${t.pathname}${t.search}${t.hash}`,referrer:document.referrer,utm:{utm_source:o("utm_source"),utm_medium:o("utm_medium"),utm_campaign:o("utm_campaign"),utm_term:o("utm_term"),utm_content:o("utm_content"),utm_id:o("utm_id")},tracking:{gclid:o("gclid"),gclsrc:o("gclsrc"),wbraid:o("wbraid"),gbraid:o("gbraid"),dclid:o("dclid"),fbclid:o("fbclid"),fbc:o("fbc"),fbp:o("fbp"),ttclid:o("ttclid"),msclkid:o("msclkid"),li_fat_id:o("li_fat_id"),twclid:o("twclid"),epik:o("epik"),ScCid:o("ScCid"),irclickid:o("irclickid"),adset_id:o("adset_id"),ad_id:o("ad_id"),adgroup_id:o("adgroup_id"),campaign_id:o("campaign_id"),placement:o("placement"),comet_source:o("comet_source"),comet_ad_id:o("comet_ad_id"),comet_campaign:o("comet_campaign"),comet_ad_group:o("comet_ad_group"),comet_network:o("comet_network"),comet_keyword:o("comet_keyword"),comet_placement:o("comet_placement"),comet_type:o("comet_type"),comet_custom:o("comet_custom"),in_app_browser:h("glue_in_app_browser")||void 0,traffic_type:h("glue_traffic_type")||void 0,attribution_derived_from:h("glue_attribution_derived_from")||void 0,adblocker_detected:h("glue_adblocker_detected")||void 0},acquisition:n,conversion_attribution:r,pages_viewed:0,events_count:0,converted:!1};F("glue_session_start",i.session_start);const s=Xe();s.push(i);const a=hi.maxSessions;return s.length>a&&s.splice(0,s.length-a),U.sessions=s,U.sessionsDirty=!0,wr(),ce.log("New session started:",e),i}function il(e){const t=B("glue_session_id");if(!t)return;const n=Xe(),r=n.findIndex(o=>o.session_id===t);if(r>=0){const o=n[r],i=new Date(o.session_start).getTime(),s=Date.now(),a=Math.floor((s-i)/1e3);n[r]={...o,...e,session_end:new Date().toISOString(),duration:a},U.sessions=n,U.sessionsDirty=!0,wr(),ce.log("Session updated:",t)}}function Xe(){if(U.sessions!==null)return U.sessions;try{const e=h("glue_sessions");if(!e)return U.sessions=[],[];const t=JSON.parse(e);return U.sessions=Array.isArray(t)?t:[],U.sessions}catch(e){return ce.error("Error parsing sessions:",e),U.sessions=[],[]}}function d_(){const e=Yp();return{user_agent:navigator.userAgent,viewport:`${window.innerWidth}x${window.innerHeight}`,scroll_depth:e.scroll?.scrollDepthPercent,max_scroll_depth:e.scroll?.maxScrollDepthPercent,time_on_page:e.timing?.timeOnPage,visibility_state:e.attention?.visibilityState,has_focus:e.attention?.hasFocus,time_visible:e.attention?.timeVisible,interaction_count:(e.interaction?.clickCount||0)+(e.interaction?.scrollCount||0)+(e.interaction?.keyPressCount||0),network_type:e.network?.effectiveType,network_online:e.network?.online,color_scheme:e.preferences?.colorScheme,reduced_motion:e.preferences?.reducedMotion}}function sl(e){const t=e.properties;return e.event==="click"&&typeof t.x_pct=="number"&&typeof t.y_pct=="number"&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.vw=="number"&&typeof t.vh=="number"}function f_(e){let t=0;for(let n=e.length-1;n>=0;n--)sl(e[n])&&(t++,t>l_&&e.splice(n,1))}const br=[];function vr(e){return br.push(e),()=>{const t=br.indexOf(e);t>=0&&br.splice(t,1)}}function Y(e,t={},n={}){const r=Sn(n.activity??"human").session_id;e==="page_view"&&Jo();const o=mn(),i={event_id:se(),session_id:r,event:e,timestamp:new Date().toISOString(),properties:{...t,window_id:Ko(),page_view_id:Ba(),...o?{recording_id:o}:{}},context:d_()},s=Ft();s.push(i),sl(i)&&f_(s);const a=hi.maxEvents;s.length>a&&s.splice(0,s.length-a),U.events=s,U.eventsDirty=!0,wr();const c=Xe(),l=c.findIndex(u=>u.session_id===r);if(l>=0&&(c[l].events_count=(c[l].events_count||0)+1,e==="page_view"&&(c[l].pages_viewed=(c[l].pages_viewed||0)+1),e==="form_submit"&&(c[l].converted=!0,c[l].conversion_event="form_submit"),U.sessions=c,U.sessionsDirty=!0),ce.enabled()){const u=i.properties&&Object.keys(i.properties).length?i.properties:void 0;ce.log(`event: ${e}`,...u?[u]:[],`(${i.event_id})`)}for(const u of br)try{u(i)}catch(d){ce.warn("event hook failed:",d)}return ee.isSupabaseSyncEnabled()&&ee.debouncedSync(()=>Sr(),1e4),i}function Ft(){if(U.events!==null)return U.events;try{const e=h("glue_events");if(!e)return U.events=[],[];const t=JSON.parse(e);return U.events=Array.isArray(t)?t:[],U.events}catch(e){return ce.error("Error parsing events:",e),U.events=[],[]}}function yt(){try{const n=h("glue_user_profile");if(n)return JSON.parse(n)}catch(n){ce.error("Error parsing user profile:",n)}const e=h("glue_user_id")||se();k("glue_user_id",e);const t={glue_user_id:e,traits:{},first_seen:h("glue_user_firstseen")||new Date().toISOString(),last_seen:new Date().toISOString(),identified:!1,context:{}};return k("glue_user_profile",JSON.stringify(t)),t}function wt(e){const t=yt(),n={...t,...e,last_seen:new Date().toISOString(),traits:{...t.traits,...e.traits||{}},context:{...t.context,...e.context||{}}};k("glue_user_profile",JSON.stringify(n)),ce.log("User profile updated")}function g_(e){e&&(wt({crm_id:e}),ee.isSupabaseSyncEnabled()&&ee.debouncedSync(()=>Sr(),2e3))}function al(e,t={}){const n=yt(),r=new Date().toISOString(),o=n.first_touch_traits||{...t,captured_at:r},i={...t,captured_at:r},s={...n.traits,...t};wt({email:e,traits:s,first_touch_traits:o,last_touch_traits:i,identified:!0,identified_at:n.identified_at||r}),Y("user_identified",{email:e,traits_count:Object.keys(t).length}),ee.isSupabaseSyncEnabled()&&ee.debouncedSync(()=>Sr()),ce.log("User identified:",e,"| Traits:",Object.keys(t))}let Ae=null;function m_(){Ae||(Ae={initial_utm_source:h("glue_initial_utm_source")||void 0,initial_utm_medium:h("glue_initial_utm_medium")||void 0,initial_utm_campaign:h("glue_initial_utm_campaign")||void 0,user_referrer:h("glue_user_referrer")||void 0,url_first:h("glue_url_first")||void 0,last_utm_source:h("glue_last_utm_source")||void 0,last_utm_medium:h("glue_last_utm_medium")||void 0,last_utm_campaign:h("glue_last_utm_campaign")||void 0});const e=Xe(),t=e[e.length-1];return{first_touch:{utm_source:Ae.initial_utm_source,utm_medium:Ae.initial_utm_medium,utm_campaign:Ae.initial_utm_campaign,referrer:Ae.user_referrer,landing_page:Ae.url_first},last_touch:{utm_source:Ae.last_utm_source,utm_medium:Ae.last_utm_medium,utm_campaign:Ae.last_utm_campaign,referrer:t?.referrer,landing_page:t?.landing_page}}}function Sr(){const e=En();return{...e,events:e.events.filter(t=>!t.delivered)}}function cl(e){if(!e||e.length===0)return;const t=new Set(e);let n=!1;for(const r of Ft())!r.delivered&&t.has(r.event_id)&&(r.delivered=!0,n=!0);n&&(U.eventsDirty=!0,wr())}function En(){const e=yt(),t=Xe(),n=Ft(),r=new Date(e.first_seen),o=new Date(e.last_seen),i=Math.floor((o.getTime()-r.getTime())/(1e3*60*60*24)),s=t.map(c=>({date:c.session_start.split("T")[0],source:c.utm.utm_source||"direct",medium:c.utm.utm_medium,campaign:c.utm.utm_campaign})),a=m_();return{profile:e,sessions:t,events:n,summary:{total_sessions:t.length,total_events:n.length,converted_sessions:t.filter(c=>c.converted).length,first_visit:e.first_seen,last_visit:e.last_seen,days_active:i,attribution:a,touchpoints:s}}}function p_(){U.sessions=[],U.events=[],U.sessionsDirty=!0,U.eventsDirty=!0,vn(),k("glue_user_profile",""),Ae=null,ce.log("Journey data cleared")}function __(){const e=B("glue_session_id");if(!e)return{session:void 0,events:[]};const n=Xe().find(o=>o.session_id===e),r=Ft().filter(o=>o.session_id===e);return{session:n,events:r}}function h_(){const e=En();return JSON.stringify(e,null,2)}const y_=new Set(["fname","lname","first_name","last_name","full_name","name","glue_fname","glue_lname","glue_first_name","glue_last_name","glue_full_name","glue_name","mobile","phone","phone_number","work_phone","home_phone","glue_mobile","glue_phone","glue_phone_number","glue_work_phone","glue_home_phone","address","address1","address2","street","city","state","zip","zipcode","postal_code","country","glue_address","glue_address1","glue_address2","glue_street","glue_city","glue_state","glue_zip","glue_zipcode","glue_postal_code","glue_country","company","company_name","organization","job_title","title","department","industry","glue_company","glue_company_name","glue_organization","glue_job_title","glue_title","glue_department","glue_industry","website","birthday","dob","age","gender","glue_website","glue_birthday","glue_dob","glue_age","glue_gender","linkedin","twitter","facebook","instagram","glue_linkedin","glue_twitter","glue_facebook","glue_instagram"]);function w_(){const e=new URLSearchParams(window.location.search),t=e.get("email")||e.get("glue_email"),n={};let r=!1;if(e.forEach((o,i)=>{if(y_.has(i)){const s=i.replace("glue_","");n[s]=o,r=!0}}),t&&t.includes("@"))al(t,n),ce.log("Auto-identified from URL params:",t,"with traits:",Object.keys(n));else if(r){const o=yt();wt({traits:{...o.traits,...n}}),ce.log("Updated profile with PII from URL params (no email):",Object.keys(n))}}let ll=0,ul=-1,dl=-1;const b_=50;let yi=null;function v_(){return yi===null&&(yi=Jc.detectDeviceType()),yi}function S_(e){if(!e||!e.tagName)return"";const t=e.tagName.toLowerCase();let n=t;if(e.id)n=`${t}#${e.id}`;else{const r=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";if(r)n=`${t}.${r}`;else if(e.parentElement){let o=0;const i=e.parentElement.children;for(let s=0;s<i.length&&!(i[s].tagName===e.tagName&&(o++,i[s]===e));s++);n=`${t}:nth-of-type(${o})`}}return n.length>100?n.slice(0,100):n}function E_(){document.addEventListener("click",e=>{const t=Date.now(),n=e.target,r=e.clientX,o=e.clientY,i=t-ll<b_&&r===ul&&o===dl;if(e.isTrusted&&e.detail>0&&!i){ll=t,ul=r,dl=o;const s=window.innerWidth,a=window.innerHeight;Y("click",{x_pct:Math.round(r/(s||1)*100),y_pct:Math.round(o/(a||1)*100),x:r,y:o,vw:s,vh:a,selector:S_(n),device_type:v_()})}},{passive:!0})}let wi=!1,bi=!1;function k_(){let e=!1;const t=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;const n=document.documentElement.scrollHeight-window.innerHeight;if(n>0){const r=Math.round(window.scrollY/n*100);!wi&&r>=50&&(wi=!0,Y("scroll_depth_50",{percent:r})),!bi&&r>=75&&(bi=!0,Y("scroll_depth_75",{percent:r}))}wi&&bi&&window.removeEventListener("scroll",t)}))};window.addEventListener("scroll",t,{passive:!0})}function A_(){document.addEventListener("submit",e=>{const t=e.target;Y("form_submit",{form_id:t.getAttribute("data-glue-form")||t.getAttribute("id")||t.getAttribute("name")||"",form_name:t.getAttribute("data-glue-form")||t.getAttribute("name")||t.getAttribute("id")||"",form_action:t.action})})}function T_(){const e=()=>{vn(),il({session_end:new Date().toISOString()})};window.addEventListener("beforeunload",e),document.addEventListener("visibilitychange",()=>{document.hidden&&e()})}function C_(){if(rl)return;rl=!0;let e=window.location.href;const t=()=>{if(window.location.href===e)return;const o=e;e=window.location.href,dc(o)!==dc(e)&&(Hg(),queueMicrotask(()=>{const i=Sn(),s=el();a_()&&(!i.acquisition||tl(s)!==tl(i.acquisition))&&(il({session_end:new Date().toISOString()}),u_()),Y("page_view",{url:window.location.href,title:document.title,path:window.location.pathname,referrer:o,navigation_type:"spa"})}))},n=history.pushState,r=history.replaceState;history.pushState=function(...o){n.apply(this,o),t()},history.replaceState=function(...o){r.apply(this,o),t()},window.addEventListener("popstate",t)}function I_(e={}){if(nl)return;nl=!0;const t={...hi,...e};ee.onBatchDelivered(cl),sp(window?.__glueConfig?.workspaceId),fr(),Sn(),t.autoTrackPageViews&&(Y("page_view",{url:window.location.href,title:document.title,path:window.location.pathname,referrer:document.referrer}),C_()),wt({context:{user_agent:navigator.userAgent,browser:navigator.userAgent.split(" ").pop(),os:navigator.platform,geolocation:h("glue_user_geolocation")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language}}),t.piiCaptureEnabled?w_():ce.log("PII capture disabled via privacy settings"),t.autoTrackClicks&&Bp(Y),t.autoTrackClickMap&&E_(),t.autoTrackScroll&&k_(),t.autoTrackFormSubmits&&A_(),T_(),ce.log("Journey tracking initialized")}const we={initializeJourneyTracking:I_,trackEvent:Y,identifyUser:al,setCrmId:g_,getCurrentSession:Sn,getCompleteUserData:En,getPendingSyncData:Sr,markEventsDelivered:cl,getUserProfile:yt,updateUserProfile:wt,getSessions:Xe,getEvents:Ft,getCurrentSessionJourney:__,exportJourneyData:h_,clearJourneyData:p_},vi=W("config-refresh"),fl=5*60*1e3,x_=60*1e3,O_=1e4;let Er=null,gl=null,kr=null,ml=!1,pl=0,Si="";function L_(){return fl+(Math.random()*2-1)*x_}function M_(){return`${Er.supabaseUrl}/functions/v1/glue?workspace-id=${encodeURIComponent(Er.workspaceId)}&config=1`}function R_(e){return!!(e&&typeof e.config_version=="string"&&e.tracking&&typeof e.tracking=="object"&&e.tracking.features&&typeof e.tracking.features=="object")}async function $_(){if(!Er)return null;let e=null,t;const n=globalThis.AbortController;if(typeof n=="function"){const r=new n;t=r.signal,e=setTimeout(()=>{try{r.abort()}catch{}},O_)}try{const r=await fetch(M_(),{method:"GET",credentials:"omit",...t?{signal:t}:{}});if(!r.ok)return null;const o=await r.json();return R_(o)?o:(vi.warn("config endpoint returned an unrecognised shape; keeping current configuration"),null)}catch{return null}finally{pl=Date.now(),e&&clearTimeout(e)}}async function _l(){const e=await $_();if(e&&e.config_version!==Si){Si=e.config_version,vi.log(`configuration changed: ${e.config_version}`);try{gl?.(e)}catch(t){vi.warn("config listener failed:",t)}}}function Ei(){typeof setTimeout=="function"&&(kr&&clearTimeout(kr),kr=setTimeout(()=>{kr=null,typeof document>"u"||document.visibilityState!=="hidden"?_l().finally(Ei):Ei()},L_()))}function N_(e,t,n=""){!e.supabaseUrl||!e.workspaceId||(Er=e,gl=t,Si=n,Ei(),!ml&&typeof document<"u"&&(ml=!0,document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-pl>=fl&&_l()})))}const kn=[],D_=1500,P_=200,F_="capture_all",U_=new Set(["performance_vitals","session_recording","console_logs","network_diagnostics"]),j_=new Set(["session_recording"]),An=new Map;let ki={},hl={},Tn="";function re(e){kn.some(t=>t.name===e.name)||kn.push(e)}function q_(){return kn.filter(e=>An.get(e.name)?.state==="active").map(e=>e.name)}function H_(e){let t=An.get(e.name);return t||(t={plugin:e,state:"idle",cleanup:null,extraCleanups:[],disposers:[],starting:null,configVersion:""},An.set(e.name,t)),t}function B_(){let e=new Map,t=0;return{take(n,r=P_){const o=e.get(n)??0;return o>=r||t>=D_?!1:(e.set(n,o+1),t+=1,!0)},reset(){e=new Map,t=0}}}const Ai=B_();let yl=!1;function z_(){yl||(yl=!0,vr(e=>{e.event==="page_view"&&Ai.reset()}))}let wl=!1;const Ti=new Set;let Ci=!1;function V_(){if(wl||typeof window>"u")return;wl=!0;const e=t=>{if(!Ci){Ci=!0;for(const n of Array.from(Ti))try{n(t)}catch(r){I.warn("plugin leave handler failed:",r)}}};window.addEventListener("pagehide",()=>e("pagehide")),window.addEventListener("beforeunload",()=>e("beforeunload")),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?e("hidden"):Ci=!1})}function W_(e){const{plugin:t}=e,n=t.feature,r=hl[n]??{},o=i=>(e.disposers.push(i),i);return{features:ki,config:r,configVersion:Tn,track(i,s={}){if(Ai.take(i))try{Y(i,s,{activity:U_.has(n)?"passive":"human"})}catch(a){I.warn(`plugin ${t.name} track failed:`,a)}},onEvent(i){return o(vr(s=>{try{i(s)}catch(a){I.warn(`plugin ${t.name} onEvent failed:`,a)}}))},onNavigate(i){let s=typeof window<"u"?window.location.href:null;return o(vr(a=>{if(a.event!=="page_view")return;const c=window.location.href,l={url:c,previousUrl:s};s=c;try{i(l)}catch(u){I.warn(`plugin ${t.name} onNavigate failed:`,u)}}))},onLeave(i){return V_(),Ti.add(i),o(()=>Ti.delete(i))},budget:Ai,route:()=>window.location.pathname,log:I,ids:_t,onCleanup(i){typeof i=="function"&&e.extraCleanups.push(i)},loadModule(i,s){return _o(i,s)},sampled(){return dr(n,r.sample_rate,Tn)}}}async function Ii(e){if(e.state==="active")return!0;if(e.starting)return e.starting;e.state="starting";const t=W_(e);return e.starting=(async()=>{try{e.plugin.modules?.length&&await Promise.all(e.plugin.modules.map(r=>_o(r.name,r.version)));const n=await e.plugin.init(t);return e.cleanup=typeof n=="function"?n:null,e.state="active",e.configVersion=Tn,!0}catch(n){return I.warn(`plugin ${e.plugin.name} failed to initialise:`,n),e.state="failed",bl(e),!1}finally{e.starting=null}})(),e.starting}function bl(e){for(const t of e.extraCleanups.slice().reverse())try{t()}catch(n){I.warn(`plugin ${e.plugin.name} cleanup failed:`,n)}if(e.extraCleanups=[],e.cleanup)try{e.cleanup()}catch(t){I.warn(`plugin ${e.plugin.name} cleanup failed:`,t)}e.cleanup=null;for(const t of e.disposers.splice(0))try{t()}catch(n){I.warn(`plugin ${e.plugin.name} unsubscribe failed:`,n)}}function xi(e){const t=An.get(e);return!t||t.state!=="active"&&t.state!=="failed"?!1:(bl(t),t.state="stopped",I.log(`capture plugin stopped: ${e}`),!0)}function G_(e,t){return t[F_]===!1?!1:t[e.feature]===!0}async function vl(e,t,n){ki=e??{},hl=t??{},Tn=n??"",z_(),fr(),K_();const r=[];for(const i of kn){const s=H_(i);if(!G_(i,ki)){s.state==="active"&&xi(i.name);continue}if(s.state==="active"){s.configVersion!==Tn&&(xi(i.name),r.push(Ii(s)));continue}s.state!=="failed"&&r.push(Ii(s))}await Promise.all(r);const o=q_();o.length&&I.log("capture plugins active:",o.join(", "))}let Sl=!1;function K_(){Sl||(Sl=!0,Wa(()=>{for(const e of kn){if(!j_.has(e.feature))continue;const t=An.get(e.name);!t||t.state!=="active"||(xi(e.name),Ii(t))}}))}let El=!1;function J_(e={},t={},n=""){const r=vl(e,t,n);if(!El){El=!0;const o=globalThis?.__glueConfig;o?.supabaseUrl&&o?.workspaceId&&N_({supabaseUrl:o.supabaseUrl,workspaceId:o.workspaceId},i=>{vl(i.tracking.features??{},i.tracking.featureConfig??{},i.config_version)},n)}return r}const X_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Y_=/^[0-9a-f]{24}$/i,Z_=/^\d+$/;function Ar(e,t){if(Array.isArray(t)){for(const r of t)if(!(!r||!r.pattern||!r.template))try{if(new RegExp(r.pattern).test(e))return String(r.template)}catch{}}const n=String(e||"/").split("/");for(let r=1;r<n.length;r++){const o=n[r];o&&(X_.test(o)||Y_.test(o)||Z_.test(o)||r>1&&o.length>=12)&&(n[r]=":id")}return n.join("/")||"/"}const kl=1e3,Q_=5e3,eh=6e4,th=1e3,Al=.5,Oi=40,Tl=50,nh=500,rh=[25,50,75,100],oh="[data-glue-section],section[id],article[id],h1[id],h2[id]",Ye=()=>Date.now(),Cn={passive:!0},Cl={passive:!0,capture:!0};function In(e,t=80){return String(e||"").replace(/\s+/g," ").trim().slice(0,t)}function ih(e){if(typeof window>"u"||typeof document>"u")return;const t=document,n=e.config&&e.config.route_patterns,r=C=>Ar(C,n),o=()=>t.visibilityState==="hidden",i=C=>j=>{try{C(j)}catch(q){e.log.warn("engagement:",q)}},s=(C,j,q,xe)=>C.addEventListener(j,q,xe);let a="",c="",l="",u=0,d=0,g=0,f=0,m=0,y=!1,b=0,p=[],v=0,E=0,T=0,A=0,S=!1,x=!1,_=!1,L=null,M=0,N=null,w=null,O=null,R=null,P=0,$=new WeakSet;const z=new Map,D=[];let We=!1;const ve=()=>{L!=null&&(clearInterval(L),L=null)},Lt=()=>{if(x||o())return;const C=Ye();C-m<=Q_?f+=kl:!y&&C-m>=eh&&(y=!0,e.track("idle_start",{path:a}))},Se=()=>{if(!(L!=null||o()))try{L=setInterval(i(Lt),kl)}catch{L=null}},tn=()=>{const C=Ye();y&&(y=!1,e.track("idle_end",{path:a,idle_ms:Math.round(C-m)})),m=C},dt=()=>Math.round(Ye()-u),cE=(C,j,q)=>{v>=Oi||(v+=1,e.track("section_view",{section_id:In(C.getAttribute("data-glue-section")||C.id,120)||"section-"+v,section_label:lE(C),visible_ms:Math.round(Ye()-q),viewport_pct:Math.round(j*100),order:v}))},lE=C=>{const j=C.getAttribute("data-glue-section-label")||C.getAttribute("aria-label");if(j)return In(j);if(/^H[1-3]$/.test(C.tagName))return In(C.textContent);let q=null;try{q=C.querySelector("h1,h2,h3")}catch{}return In(q?q.textContent:"")},ug=()=>{if(!w||P>=Oi)return;let C;try{C=t.querySelectorAll(oh)}catch{return}for(let j=0;j<C.length&&P<Oi;j++){const q=C[j];$.has(q)||($.add(q),P+=1,w.observe(q))}},uE=()=>{P=0,$=new WeakSet,z.forEach(clearTimeout),z.clear(),w&&w.disconnect(),ug()},dE=()=>{if(typeof IntersectionObserver=="function")try{w=new IntersectionObserver(i(C=>{for(const j of C){const q=j.target;if(j.isIntersecting&&j.intersectionRatio>=Al){if(z.has(q))continue;const xe=Ye(),$e=j.intersectionRatio;z.set(q,setTimeout(i(()=>{z.delete(q),w&&w.unobserve(q),cE(q,$e,xe)}),th))}else z.has(q)&&(clearTimeout(z.get(q)),z.delete(q))}}),{threshold:[Al]})}catch{w=null}},dg=()=>{const j=((t.documentElement||{}).scrollHeight||0)-(window.innerHeight||0);if(j<=0)return;const q=window.scrollY||window.pageYOffset||0,xe=Math.max(0,Math.min(100,Math.round(q/j*100)));xe>b&&(b=xe);for(const $e of rh)xe<$e||p.indexOf($e)>=0||(p.push($e),e.track("scroll_depth",{percent:$e,path:a,route_template:r(a),ms_since_page:dt()}))},fE=i(()=>{if(tn(),We)return;We=!0;const C=()=>{We=!1;try{dg()}catch{}};typeof requestAnimationFrame=="function"?requestAnimationFrame(C):setTimeout(C,50)}),fg=()=>{const C=Ye();a=e.route(),c=a+(window.location.search||""),l=In(t.title,200),u=C,m=C,d=0,g=o()?0:C,f=0,y=!1,b=0,p=[],v=0,E=0,T=0,A=0,S=!1,x=!1,M=0,ve(),Se(),uE(),dg()},gg=C=>{if(x)return;x=!0,ve();const j=Ye();e.track("page_engaged",{path:a,route_template:r(a),title:l,engaged_ms:f,visible_ms:Math.round(d+(g?j-g:0)),total_ms:Math.round(j-u),max_scroll_pct:b,scroll_milestones:p.slice(),sections_seen:v,clicks:T,keypresses:A,leave_reason:C})},gE=()=>{const C=N||"push";return N=null,C};try{const C=window.history,j=(q,xe)=>{const $e=C[q];if(typeof $e!="function"||$e.__glueNav)return;const mg=function(){return N=xe,$e.apply(this,arguments)};mg.__glueNav=!0,C[q]=mg};j("pushState","push"),j("replaceState","replace")}catch{}s(window,"hashchange",()=>{N="hash"},Cn),s(window,"popstate",i(()=>{N="pop";const C=e.route(),j=D.lastIndexOf(C);j>=0&&j<D.length-1&&(D.length=j+1,e.track("back_navigation",{from_path:a,to_path:C}))}),Cn),s(window,"pageshow",i(C=>{C&&C.persisted&&e.track("back_navigation",{from_path:null,to_path:e.route()})}),Cn);for(const C of["pointerdown","pointermove","touchstart","wheel","keydown","click"]){const j=C==="keydown",q=C==="click";s(t,C,i(()=>{tn(),j?A+=1:q&&(T+=1)}),Cl)}if(s(window,"scroll",fE,Cn),s(t,"mouseout",i(C=>{if(!S&&!C.relatedTarget&&!((C.clientY==null?1:C.clientY)>0)){try{if(typeof window.matchMedia=="function"&&!window.matchMedia("(pointer: fine)").matches)return}catch{}S=!0,e.track("exit_intent",{ms_since_page:dt(),max_scroll_pct:b})}}),Cl),s(t,"visibilitychange",i(()=>{const C=Ye();o()?(g&&(d+=C-g,g=0),ve(),M=C,E<Tl&&(E+=1,e.track("tab_hidden",{path:a}))):(g=C,m=C,Se(),E<Tl&&(E+=1,e.track("tab_visible",{path:a,hidden_ms:M?Math.round(C-M):0})))}),Cn),typeof MutationObserver=="function")try{O=new MutationObserver(i(()=>{R==null&&(R=setTimeout(i(()=>{R=null,ug()}),nh))})),O.observe(t.documentElement||t,{childList:!0,subtree:!0})}catch{O=null}return e.onNavigate(()=>{const C=e.route(),j=C+(window.location.search||"");if(_&&j===c)return;const q=_?a:null,xe=q===null?"load":gE();gg("navigate"),fg(),D[D.length-1]!==C&&D.push(C),e.track("route_change",{from_path:q,to_path:C,route_template:r(C),method:xe,title:l})}),e.onLeave(C=>gg(C)),dE(),fg(),_=!0,D.push(a),()=>{ve(),w&&w.disconnect(),O&&O.disconnect()}}re({name:"engagement",feature:"engagement",init:ih});const sh=40,ah=800,ch=1e3,Li=30,lh=500,uh="video,audio",dh="input[type=search],input[name=q],input[name=s],input[name=query],input[name=search]",fh="q,s,query,search".split(","),gh=[25,50,75],mh=[1e3,3e3,1e4],ph=()=>Date.now(),Ze={passive:!0},Il={passive:!0,capture:!0};function xl(e){return String(e.getAttribute("title")||e.getAttribute("aria-label")||e.getAttribute("data-title")||"").slice(0,120)}function Ol(e){const t=e&&e.nodeType===1?e:e&&e.parentElement,n=t&&t.closest&&t.closest("[data-glue-section],[id]");return n?String(n.getAttribute("data-glue-section")||n.id).slice(0,120):null}function _h(e){if(typeof window>"u"||typeof document>"u")return;const t=document,n=w=>O=>{try{w(O)}catch(R){e.log.warn("content:",R)}},r=(w,O,R,P)=>w.addEventListener(O,R,P);let o=0,i=0,s=0,a=0,c=null,l=null,u=null,d=null;const g=[],f=new WeakMap,m=[],y=new WeakMap,b=()=>{try{const w=window.getSelection&&window.getSelection();return w?String(w.toString()||""):""}catch{return""}},p=()=>{try{const w=window.getSelection&&window.getSelection();return w?w.anchorNode||w.focusNode:null}catch{return null}};r(t,"copy",n(()=>{const w=b();if(!w)return;const O=ph();o>=Li||O-s<ch||(s=O,o+=1,e.track("text_copied",{chars:w.length,section_id:Ol(p()),path:e.route()}))}),Il),r(t,"selectionchange",n(()=>{i>=Li||(clearTimeout(c),c=setTimeout(n(()=>{c=null;const w=b();w.length<sh||w.length===a||i>=Li||(a=w.length,i+=1,e.track("text_selected",{chars:w.length,section_id:Ol(p())}))}),ah))}),Ze),r(window,"beforeprint",n(()=>e.track("print_intent",{path:e.route()})),Ze);try{const w=navigator;if(typeof w.share=="function"&&!w.share.__glueContent){const O=w.share,R=function(...P){const $=O.apply(this,P);try{$&&typeof $.then=="function"&&$.then(()=>e.track("share",{path:e.route(),target:"web_share"}),()=>{})}catch{}return $};R.__glueContent=!0,w.share=R}}catch{}const v=(w,O)=>{e.track("site_search",{query_length:w,results_path:O})},E=()=>{let w;try{w=new URLSearchParams(window.location.search||"")}catch{return}for(const O of fh){const R=w.get(O);if(R==null)continue;const P=e.route()+"?"+O;if(P===d)return;d=P,v(R.length,e.route());return}};r(t,"submit",n(w=>{const O=w&&w.target;if(!O||O.tagName!=="FORM")return;let R=null;try{R=O.querySelector(dh)}catch{}if(!R)return;let P=e.route();const $=O.getAttribute("action");if($)try{P=new URL($,window.location.href).pathname}catch{}v(String(R.value||"").length,P)}),Il);const T=(w,O,R,P,$,z)=>{const D={provider:O,video_id:R.id,title:R.title||null,position_s:Math.round(P),duration_s:$>0&&$<1/0?Math.round($):null};z!=null&&(D.percent=z),e.track(w,D)},A=(w,O,R,P)=>{if(!(P>0)||P===1/0)return;const $=R/P*100;for(const z of gh)$<z||O.seen.indexOf(z)>=0||(O.seen.push(z),T("video_progress",w,O,R,P,z))},S=w=>{if(f.has(w))return;const O=w.currentSrc||w.getAttribute("src")||"",R={id:w.id||(O?String(O).split("?")[0].split("/").pop():"")||"media",title:xl(w),seen:[]};f.set(w,R);const P=()=>[Number(w.currentTime)||0,Number(w.duration)];r(w,"play",n(()=>T("video_play","html5",R,P()[0],P()[1])),Ze),r(w,"pause",n(()=>{w.ended||T("video_pause","html5",R,P()[0],P()[1])}),Ze),r(w,"timeupdate",n(()=>{const[$,z]=P();A("html5",R,$,z)}),Ze),r(w,"ended",n(()=>{const[,$]=P();R.seen.indexOf(100)>=0||(R.seen.push(100),T("video_complete","html5",R,$,$,100))}),Ze)},x=(w,O)=>{try{w.contentWindow&&w.contentWindow.postMessage(O,"*")}catch{}},_=w=>{if(y.has(w))return;const O=w.getAttribute&&w.getAttribute("src")||"";if(!O)return;let R;try{R=new URL(O,window.location.href)}catch{return}const P=R.hostname;let $,z;if(/(^|\.)player\.vimeo\.com$/i.test(P))$=R.pathname.split("/").pop()||"",z=()=>{for(const ve of["play","pause","ended","timeupdate"])x(w,JSON.stringify({method:"addEventListener",value:ve}))};else if(/(^|\.)youtube(-nocookie)?\.com$/i.test(P)&&R.pathname.indexOf("/embed/")===0){if(R.searchParams.get("enablejsapi")!=="1"&&!window.YT)return;$=R.pathname.slice(7),z=()=>{x(w,JSON.stringify({event:"listening",id:1,channel:"widget"})),x(w,JSON.stringify({event:"command",func:"addEventListener",args:["onStateChange"],id:1,channel:"widget"}))}}else return;const D={id:$.slice(0,64),title:xl(w),seen:[],send:z};y.set(w,D),m.push(w);const We=n(()=>{D.open||z()});r(w,"load",We,Ze);for(const ve of mh)g.push(setTimeout(We,ve));z()},L=w=>{w.resent||!w.send||(w.resent=!0,w.send())},M=w=>{for(const O of m)try{if(O.contentWindow===w)return O}catch{}return null};r(window,"message",n(w=>{const O=String(w&&w.origin||""),R=O.indexOf("youtube")>=0,P=O.indexOf("vimeo")>=0;if(!R&&!P)return;let $=w.data;if(typeof $=="string")try{$=JSON.parse($)}catch{return}if(!$||typeof $!="object")return;const z=M(w.source);if(!z)return;const D=y.get(z);if(!D)return;if(D.open=!0,R){const Se=$.info;if(!Se)return;const tn=Number(Se.currentTime)||0,dt=Number(Se.duration);Se.playerState!=null&&Se.playerState!==D.state&&(D.state=Se.playerState,Se.playerState===1?(L(D),T("video_play","youtube",D,tn,dt)):Se.playerState===2?T("video_pause","youtube",D,tn,dt):Se.playerState===0&&D.seen.indexOf(100)<0&&(D.seen.push(100),T("video_complete","youtube",D,dt,dt,100))),A("youtube",D,tn,dt);return}const We=$.data||{},ve=Number(We.seconds)||0,Lt=Number(We.duration);if($.event==="play"){if(D.state===1)return;D.state=1,L(D),T("video_play","vimeo",D,ve,Lt)}else if($.event==="pause"){if(D.state===2)return;D.state=2,T("video_pause","vimeo",D,ve,Lt)}else if($.event==="ended"){if(D.state=0,D.seen.indexOf(100)>=0)return;D.seen.push(100),T("video_complete","vimeo",D,Lt,Lt,100)}else $.event==="timeupdate"&&A("vimeo",D,ve,Lt)}),Ze);const N=()=>{try{const w=t.querySelectorAll(uh);for(let O=0;O<w.length;O++)S(w[O])}catch{}try{const w=t.querySelectorAll("iframe");for(let O=0;O<w.length;O++)_(w[O])}catch{}};if(typeof MutationObserver=="function")try{l=new MutationObserver(n(()=>{u==null&&(u=setTimeout(n(()=>{u=null,N()}),lh))})),l.observe(t.documentElement||t,{childList:!0,subtree:!0})}catch{l=null}return e.onNavigate(()=>{o=0,i=0,s=0,a=0,E(),N()}),e.onLeave(()=>{clearTimeout(c),c=null}),N(),E(),()=>{l&&l.disconnect(),clearTimeout(c);for(const w of g)clearTimeout(w);g.length=0}}re({name:"content",feature:"content",init:_h});function Mi(e,t){try{return new URL(e,t)}catch{return null}}function Ri(e,t){return typeof e!="string"||!e?null:Mi(e,t)?.origin??null}const hh=/^\/functions\/v1\/(?:ingest-events|ingest-replay|geolocate|glue)(?:\/|$)/;function Ll(e){return e.pathname.replace(/\/+$/,"")||"/"}function Ml(e,t){if(typeof e!="string"||!e)return null;const n=Mi(e,t);return n?n.origin+Ll(n):null}function yh(e,t){const n=Xa(e.ingestUrl);return{supabaseOrigin:Ri(e.supabaseUrl,t),proxyIngest:Ml(n,t),proxyOrigin:Ri(n,t),scriptEndpoint:Ml(e.scriptUrl,t),scriptOrigin:Ri(e.scriptUrl,t),workspaceId:typeof e.workspaceId=="string"?e.workspaceId:""}}function Rl(e,t,n){const r=Mi(e,n);if(!r)return!1;const o=Ll(r);return t.supabaseOrigin&&r.origin===t.supabaseOrigin&&hh.test(o)||t.proxyIngest&&r.origin+o===t.proxyIngest?!0:t.workspaceId===""||r.searchParams.get("workspace-id")!==t.workspaceId?!1:t.scriptEndpoint&&r.origin+o===t.scriptEndpoint?!0:o!=="/"?!1:r.origin===t.proxyOrigin?!0:r.origin===t.scriptOrigin&&r.searchParams.get("uid")==="1"}let $i=null;function wh(e){$i=e}function Ni(e){return!$i||typeof document>"u"?!1:Rl(e,$i,document.baseURI||window.location.href)}const bh=600,vh=30,Sh=3,Eh=800,kh=1e3,Ah=3,Th=80,Ch=120,xn=300,$l='a[href],button,[role="button"],input[type="submit"],input[type="button"],summary,select,label,[onclick]',Nl=Symbol.for("glue.errorBus");function Ih(){if(typeof window>"u")return null;const e=window;let t=e[Nl];if(!t){const n=new Set;let r="",o=0;t={subs:n,sourced:!1,publish(i){const s=Date.now();if(!(i===r&&s-o<50)){r=i,o=s;for(const a of Array.from(n))try{a(i)}catch{}}}},e[Nl]=t}return t}function Dl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Ut(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function xh(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,location.href);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function Oh(e){if(e instanceof Error)return Ut(e.message||e.name||"Error",xn);if(e&&typeof e=="object")try{return Ut(JSON.stringify(e),xn)}catch{return Ut(String(e),xn)}return Ut(e,xn)}function On(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function Lh(e){const t=typeof e.composedPath=="function"?e.composedPath():null;return t&&t.find(r=>r instanceof Element)||(e.target instanceof Element?e.target:null)}function Mh(e){if(!e)return"";const t=e.closest($l)||e,n=t.getAttribute("aria-label")||t.getAttribute("data-framer-name")||t.textContent||"";return Ut(n,Th)}function Rh(e){const t=[];let n=e;for(let r=0;n&&r<4&&n.nodeType===1;r++){const o=n.tagName.toLowerCase();if(o==="html"||o==="body")break;if(n.id&&/^[A-Za-z][\w-]*$/.test(n.id)){t.unshift(o+"#"+n.id);break}const i=(n.getAttribute("class")||"").trim().split(/\s+/).filter(a=>a&&a.length<=24)[0];let s=i?o+"."+i:o;if(!i){const a=n.parentElement;if(a){const c=Array.prototype.filter.call(a.children,l=>l.tagName===n.tagName);c.length>1&&(s+=":nth-of-type("+(c.indexOf(n)+1)+")")}}t.unshift(s),n=n.parentElement}return t.join(">").slice(0,Ch)}re({name:"frustration",feature:"frustration",init(e){if(typeof window>"u"||typeof document>"u")return;const t=[],n=new WeakMap;let r=0,o=0,i=0;const s=()=>{r=On()},a=()=>{i=On()};document.addEventListener("focusin",s,!0),window.addEventListener("popstate",a),window.addEventListener("hashchange",a),window.addEventListener("pagehide",a),t.push(()=>{document.removeEventListener("focusin",s,!0),window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a),window.removeEventListener("pagehide",a)});try{if(typeof PerformanceObserver=="function"){const p=new PerformanceObserver(v=>{try{for(const E of v.getEntries())Ni(E.name||"")||(o=Math.max(o,E.startTime||On()))}catch{}});p.observe({type:"resource",buffered:!1}),t.push(()=>{try{p.disconnect()}catch{}})}}catch{}const c=p=>{if(!p)return!1;if(p.closest($l))return!0;const v=n.get(p);if(v!==void 0)return v;let E=!1;try{E=window.getComputedStyle(p).cursor==="pointer"}catch{E=!1}return n.set(p,E),E};let l=[],u=!1,d=null,g=0;const f=p=>{try{if(!p.isTrusted)return;const v=Lh(p);if(!v||v.closest("[data-glue-ignore],[data-private]"))return;const E=On(),T=p.clientX||0,A=p.clientY||0,S=Mh(v),x=Rh(v);if(d={at:E,label:S,selector:x,fired:!1},l=l.filter(_=>E-_.at<=bh&&Math.hypot(_.x-T,_.y-A)<=vh),l.length||(u=!1),l.push({at:E,x:T,y:A}),l.length>=Sh&&!u){u=!0;const _=window.innerWidth||1,L=window.innerHeight||1;e.track("rage_click",{count:l.length,target_label:S,selector:x,x_pct:Math.round(T/_*100),y_pct:Math.round(A/L*100),path:e.route()})}if(g>=Ah||!c(v))return;y(E,S,x)}catch(v){e.log.warn("frustration: click handler failed:",v)}},m=new Set;t.push(()=>{for(const p of m)window.clearTimeout(p.timer),p.stop();m.clear()});const y=(p,v,E)=>{const T=location.href,A=document.activeElement;let S=!1,x=null;if(typeof MutationObserver=="function"){x=new MutationObserver(()=>{S=!0,x&&(x.disconnect(),x=null)});try{x.observe(document.documentElement||document,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}catch{x=null}}g++;const _={timer:0,stop:()=>{try{x&&x.disconnect()}catch{}}};_.timer=window.setTimeout(()=>{g=Math.max(0,g-1),m.delete(_),_.stop();try{if(S||location.href!==T||i>=p||o>=p||r>=p||document.activeElement!==A)return;e.track("dead_click",{target_label:v,selector:E,path:e.route()})}catch(L){e.log.warn("frustration: dead click check failed:",L)}},Eh),m.add(_)};document.addEventListener("click",f,{capture:!0,passive:!0}),t.push(()=>document.removeEventListener("click",f,!0));const b=Ih();if(b){const p=v=>{const E=d;!E||E.fired||On()-E.at>kh||(E.fired=!0,e.track("error_click",{target_label:E.label,selector:E.selector,error_hash:v}))};if(b.subs.add(p),t.push(()=>b.subs.delete(p)),!e.features.errors&&!b.sourced){b.sourced=!0;const v=T=>{try{if(T&&T.target&&T.target!==window&&T.target.tagName)return;const A=Ut(T?.message||T?.error&&T.error.message||"Script error",xn),S=xh(T?.filename||""),x=Number.isFinite(T?.lineno)?T.lineno:0;b.publish(Dl(A+"|"+S+"|"+x))}catch{}},E=T=>{try{const A=T&&"reason"in T?T.reason:T;b.publish(Dl("rejection|"+Oh(A)))}catch{}};window.addEventListener("error",v,!0),window.addEventListener("unhandledrejection",E),t.push(()=>{b.sourced=!1,window.removeEventListener("error",v,!0),window.removeEventListener("unhandledrejection",E)})}}return t.push(e.onNavigate(()=>{l=[],u=!1,d=null})),()=>{for(const p of t)try{p()}catch{}}}});const Tr={enabled:!0,consoleEnabled:!0,networkEnabled:!0,performanceEnabled:!0,stateEnabled:!1,consoleLimits:{maxEntries:500},networkLimits:{maxRequests:200,maxBodySize:10240},performanceLimits:{sampleInterval:1e3,maxSamples:300},stateLimits:{maxChanges:200,maxStateSize:10240},sensitivePatterns:[/password/i,/token/i,/bearer/i,/api_key/i,/apikey/i,/secret/i,/credit_card/i,/creditcard/i,/card_number/i,/cardnumber/i,/ssn/i,/social_security/i,/auth/i],sanitizedHeaders:["authorization","cookie","x-api-key","x-auth-token","x-access-token","set-cookie"]},Pl=Symbol.for("glue.network"),bt="__glueNetworkWrapper";function Di(){if(typeof window>"u")return null;const e=window;let t=e[Pl];if(!t){const n=new Set,r=new Set;t={subs:n,producers:r,subscribe(o){return n.add(o),()=>{n.delete(o)}},emit(o){for(const i of Array.from(n))try{i(o)}catch{}},claim(o){for(const i of Array.from(r)){r.delete(i);try{i()}catch{}}return r.add(o),()=>{r.delete(o)}}},e[Pl]=t}return t}function $h(e){const t=[];return{entries:t,maxSize:e,push(n){t.length>=e&&t.shift(),t.push(n)},getAll(){return[...t]},clear(){t.length=0},size(){return t.length}}}let Z,Cr=Tr,Ir=!1,qe=0,jt=null,xr=null;const Fl=new WeakSet;function Ln(e){if(!jt||Fl.has(e))return;Fl.add(e);let t=!0;try{t=new URL(e.url,window.location.href).origin===window.location.origin}catch{}jt.emit({kind:e.type,method:e.method,url:e.url,status:e.status||0,duration_ms:Math.max(0,Math.round(e.duration||0)),same_origin:t,error:e.error&&e.error.indexOf("HTTP ")!==0?e.error:void 0})}let Mn,Rn,$n,Nn;function Ul(){return`net_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function vt(e,t){const n={},r=t.map(o=>o.toLowerCase());for(const[o,i]of Object.entries(e))r.includes(o.toLowerCase())?n[o]="[REDACTED]":n[o]=i;return n}function Or(e){if(!e)return;const t=parseInt(e,10);return Number.isFinite(t)?t:void 0}function jl(e,t){const n=t.toLowerCase();for(const[r,o]of Object.entries(e))if(r.toLowerCase()===n)return o}function ql(e){try{const t=new URL(e,document.baseURI||window.location.href);return["token","api_key","apikey","key","secret","password","auth"].forEach(r=>{t.searchParams.has(r)&&t.searchParams.set(r,"[REDACTED]")}),t.toString()}catch{return e}}function Nh(){Mn=XMLHttpRequest.prototype.open,Rn=XMLHttpRequest.prototype.send,$n=XMLHttpRequest.prototype.setRequestHeader;const e=new WeakMap,t=function(o,i,s,a,c){const l={id:Ul(),method:o.toUpperCase(),url:ql(i.toString()),startTime:Date.now(),requestHeaders:{},responseHeaders:{},type:"xhr"};return e.set(this,l),Mn.call(this,o,i,s??!0,a,c)},n=function(o,i){const s=e.get(this);return s&&(s.requestHeaders[o]=i),$n.call(this,o,i)},r=function(o){const i=e.get(this),s=Cr.sanitizedHeaders||[];return i&&(i.requestSize=Or(jl(i.requestHeaders,"content-length")),this.addEventListener("loadend",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.status=this.status,i.statusText=this.statusText;const a=this.getAllResponseHeaders();a&&a.split(`\r
`).forEach(c=>{const[l,...u]=c.split(": ");l&&(i.responseHeaders[l]=u.join(": "))}),i.responseSize=Or(this.getResponseHeader("content-length")),i.requestHeaders=vt(i.requestHeaders,s),i.responseHeaders=vt(i.responseHeaders,s),(this.status>=400||this.status===0)&&(i.error=this.status===0?"Network Error":`HTTP ${this.status}`,qe++),Z&&Z.push(i),Ln(i)}),this.addEventListener("error",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.error="Network Error",i.requestHeaders=vt(i.requestHeaders,s),qe++,Z&&Z.push(i),Ln(i)}),this.addEventListener("timeout",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.error="Timeout",i.requestHeaders=vt(i.requestHeaders,s),qe++,Z&&Z.push(i),Ln(i)})),Rn.call(this,o)};t[bt]=Mn,n[bt]=$n,r[bt]=Rn,XMLHttpRequest.prototype.open=t,XMLHttpRequest.prototype.setRequestHeader=n,XMLHttpRequest.prototype.send=r}function Dh(){Nn=window.fetch;const e=async function(t,n){const r=Cr.sanitizedHeaders||[],o=typeof t=="string"?t:t instanceof URL?t.toString():t.url,i=n?.method||(t instanceof Request?t.method:"GET"),s={id:Ul(),method:i.toUpperCase(),url:ql(o),startTime:Date.now(),requestHeaders:{},responseHeaders:{},type:"fetch"};n?.headers&&(n.headers instanceof Headers?n.headers.forEach((a,c)=>{s.requestHeaders[c]=a}):Array.isArray(n.headers)?n.headers.forEach(([a,c])=>{s.requestHeaders[a]=c}):Object.entries(n.headers).forEach(([a,c])=>{s.requestHeaders[a]=c})),s.requestSize=Or(jl(s.requestHeaders,"content-length"));try{const a=await Nn.call(window,t,n);return s.endTime=Date.now(),s.duration=s.endTime-s.startTime,s.status=a.status,s.statusText=a.statusText,a.headers.forEach((c,l)=>{s.responseHeaders[l]=c}),s.responseSize=Or(a.headers.get("content-length")),s.requestHeaders=vt(s.requestHeaders,r),s.responseHeaders=vt(s.responseHeaders,r),a.ok||(s.error=`HTTP ${a.status}`,qe++),Z&&Z.push(s),Ln(s),a}catch(a){throw s.endTime=Date.now(),s.duration=s.endTime-s.startTime,s.error=a?.message||"Network Error",s.requestHeaders=vt(s.requestHeaders,r),qe++,Z&&Z.push(s),Ln(s),a}};e[bt]=Nn,window.fetch=e}function Ph(e){if(Ir)return;Cr={...Tr,...e};const t=Cr.networkLimits?.maxRequests||200;Z=$h(t),qe=0,jt=Di(),xr=jt?jt.claim(()=>{}):null,Nh(),Dh(),Ir=!0}function Fh(){return Z?Z.getAll():[]}function Uh(){return Z?Z.size():0}function jh(){return qe}function qh(){Z&&Z.clear(),qe=0}function Hh(){Ir&&(xr&&xr(),xr=null,jt=null,Mn&&(XMLHttpRequest.prototype.open=Mn),Rn&&(XMLHttpRequest.prototype.send=Rn),$n&&(XMLHttpRequest.prototype.setRequestHeader=$n),Nn&&(window.fetch=Nn),Z&&Z.clear(),qe=0,Ir=!1)}const Lr={init:Ph,getRequests:Fh,getCount:Uh,getFailedCount:jh,clear:qh,destroy:Hh},Bh=300,zh=2e3,Vh=20,Wh=20,Gh=20,Kh=50,Jh=/^(?:img|script|link)$/,Hl=Symbol.for("glue.errorBus");function Xh(){if(typeof window>"u")return null;const e=window;let t=e[Hl];if(!t){const n=new Set;let r="",o=0;t={subs:n,sourced:!1,publish(i){const s=Date.now();if(!(i===r&&s-o<50)){r=i,o=s;for(const a of Array.from(n))try{a(i)}catch{}}}},e[Hl]=t}return t}function Pi(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Yh(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function Fi(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,typeof location<"u"?location.href:void 0);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function Bl(e){if(!e)return"";try{return new URL(e,document.baseURI||location.href).href}catch{return e}}function zl(e){try{return new URL(e,location.href).origin===location.origin}catch{return!0}}function Ui(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function Vl(e,t){if(!t)return;const n=e&&typeof e=="object"?e.stack:void 0;if(typeof n!="string")return;const r=[];for(const o of n.split(`
`).slice(1,21)){const i=o.match(/(https?:\/\/[^\s)]+):(\d+):(\d+)/);if(i)try{r.push(`${new URL(i[1]).origin}/[script]:${i[2]}:${i[3]}`)}catch{}}return r.length?r.join(`
`).slice(0,zh):void 0}function Wl(e){const t=e&&typeof e=="object"?e.name:"";return/^(Error|TypeError|RangeError|ReferenceError|SyntaxError|URIError|EvalError)$/.test(t)?t:"Unhandled rejection"}re({name:"errors",feature:"errors",init(e){if(typeof window>"u")return;const t=Xh(),n=e.config.capture_stack===!0,r=[];let o={},i=new Set;const s=(g,f)=>{const m=o[g]||0;return m>=f?!1:(o[g]=m+1,!0)},a=(g,f)=>{const m=g+":"+f;return i.has(m)?!1:(i.add(m),!0)},c=g=>{try{const f=g.target;if(f&&f!==window&&f.tagName){const A=String(f.tagName).toLowerCase();if(!Jh.test(A))return;const S=String(f.src||f.href||""),x=Fi(S);if(!x||Ni(S)||!a("resource_error",Pi(A+"|"+x))||!s("resource_error",Gh))return;e.track("resource_error",{tag:A,url:x,path:e.route()});return}const m=g,y=Yh(m.message||m.error&&m.error.message||"Script error",Bh),b=m.error?Wl(m.error):"Script error",p=Fi(m.filename||""),v=Number.isFinite(m.lineno)?m.lineno:0,E=Number.isFinite(m.colno)?m.colno:0,T=Pi(y+"|"+p+"|"+v);if(t&&t.publish(T),!a("js_error",T)||!s("js_error",Vh))return;e.track("js_error",{message:b,source:p,line:v,col:E,error_hash:T,stack:Vl(m.error,n),path:e.route()})}catch(f){e.log.warn("errors: error handler failed:",f)}},l=g=>{try{const f=g&&"reason"in g?g.reason:g,m=Wl(f),y=Pi("rejection|"+m);if(t&&t.publish(y),!a("unhandled_rejection",y)||!s("unhandled_rejection",Wh))return;e.track("unhandled_rejection",{reason:m,error_hash:y,stack:Vl(f,n),path:e.route()})}catch(f){e.log.warn("errors: rejection handler failed:",f)}};window.addEventListener("error",c,!0),window.addEventListener("unhandledrejection",l),r.push(()=>{window.removeEventListener("error",c,!0),window.removeEventListener("unhandledrejection",l)});const u=g=>{try{const f=g.url;if(Ni(f))return;const m=Fi(f);if(!m)return;const y=g.status||0;if(!g.error&&y<400||!s("network_error",Kh))return;e.track("network_error",{method:g.method||"GET",url:m,status:y,duration_ms:Math.max(0,Math.round(g.duration_ms||0)),kind:g.kind==="xhr"?"xhr":"fetch",same_origin:zl(f)})}catch(f){e.log.warn("errors: network report failed:",f)}},d=e.config.wrap_network!==!1?Di():null;return d&&(r.push(d.subscribe(u)),d.producers.size||r.push(Zh(d))),r.push(e.onNavigate(()=>{o={},i=new Set})),()=>{for(const g of r)try{g()}catch{}}}});function Zh(e){const t=window,n=[];let r=!0;const o=(c,l,u,d,g,f)=>{r&&e.emit({kind:c,method:l,url:u,status:d,duration_ms:Math.max(0,Math.round(Ui()-g)),same_origin:zl(u),error:f})};if(typeof t.fetch=="function"){const c=t.fetch,l=function(u,d){let g="",f="GET";try{g=Bl(typeof u=="string"?u:u&&typeof u.url=="string"?u.url:String(u??"")),f=String(d&&d.method||u&&u.method||"GET").toUpperCase()}catch{}const m=Ui();let y;try{y=c.apply(this||t,arguments)}catch(b){throw g&&o("fetch",f,g,0,m,"Network Error"),b}return!g||!y||typeof y.then!="function"?y:y.then(b=>{try{b&&o("fetch",f,g,Number(b.status)||0,m)}catch{}return b},b=>{try{o("fetch",f,g,0,m,"Network Error")}catch{}throw b})};l[bt]=c,t.fetch=l,n.push(()=>{t.fetch===l&&(t.fetch=c)})}const i=t.XMLHttpRequest;if(typeof i=="function"&&i.prototype&&typeof i.prototype.open=="function"){const c=i.prototype,l=c.open,u=c.send,d=new WeakMap,g=function(m,y){try{d.set(this,{method:String(m||"GET").toUpperCase(),url:Bl(String(y||"")),started:0})}catch{}return l.apply(this,arguments)},f=function(){try{const m=d.get(this);m&&m.url&&(m.started=Ui(),this.addEventListener("load",()=>o("xhr",m.method,m.url,this.status,m.started)),this.addEventListener("error",()=>o("xhr",m.method,m.url,0,m.started,"Network Error")),this.addEventListener("timeout",()=>o("xhr",m.method,m.url,0,m.started,"Timeout")))}catch{}return u.apply(this,arguments)};g[bt]=l,f[bt]=u,c.open=g,c.send=f,n.push(()=>{c.open===g&&(c.open=l),c.send===f&&(c.send=u)})}const s=()=>{r=!1;for(const c of n)try{c()}catch{}n.length=0},a=e.claim(s);return()=>{a(),s()}}const Qh=5e3,ey=1e3,ty=40,ny="web_vitals",ry="6.2.1",oy=["CLS","FCP","INP","LCP","TTFB"],iy=["INP","LCP"],sy=9e5,ay=1;function Le(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t):null}function cy(){try{const e=navigator.userAgent||"";if(/tablet|ipad/i.test(e))return"tablet";if(/mobile|android|iphone/i.test(e))return"mobile"}catch{}return"desktop"}function Gl(){return{lcp:null,fcp:null,fid:null,cls:0,sessionValue:0,sessionStart:0,sessionLast:0,interactions:new Map}}function St(e,t,n={}){try{if(typeof PerformanceObserver!="function")return null;const r=PerformanceObserver.supportedEntryTypes;if(Array.isArray(r)&&r.indexOf(e)===-1)return null;const o=new PerformanceObserver(i=>{try{t(i.getEntries())}catch{}});return o.observe({type:e,buffered:!0,...n}),()=>{try{o.disconnect()}catch{}}}catch{return null}}function ly(){try{if(typeof performance>"u")return null;const e=typeof performance.getEntriesByType=="function"?performance.getEntriesByType("navigation"):null,t=e&&e[0];if(t)return{ttfb:Le(t.responseStart),dcl:Le(t.domContentLoadedEventEnd),load:Le(t.loadEventEnd),type:t.type||"navigate"}}catch{}return null}function uy(e){if(!e.size)return null;const t=Array.from(e.values()).sort((r,o)=>o-r),n=Math.min(t.length-1,Math.floor(e.size/50));return Le(t[n])}function dy(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function fy(e,t){return!Number.isFinite(t)||t>=1?!0:t<=0?!1:dy(`performance_vitals:${e}`)/4294967295<t}function gy(){const t=[],n=[],r=St("longtask",i=>{for(const s of i)t.push({duration_ms:Le(s.duration)??0,start_ms:Le(s.startTime)??0}),t.length>10&&t.shift()}),o=St("resource",i=>{for(const s of i){const a=Le(s.duration)??0;if(a<500)continue;let c=String(s.name||"");const l=c.indexOf("?");l!==-1&&(c=c.slice(0,l)),n.push({url:c,duration_ms:a}),n.length>10&&n.shift()}});return{longTasks:()=>t.slice().sort((i,s)=>s.duration_ms-i.duration_ms).slice(0,5),slowResources:()=>n.slice().sort((i,s)=>s.duration_ms-i.duration_ms).slice(0,5),stop:()=>{r?.(),o?.()}}}function my(e){try{return new TextEncoder().encode(JSON.stringify(e)).length}catch{return JSON.stringify(e??"").length}}function py(e,t){if(typeof window>"u"||typeof e.loadModule!="function")return e.log.warn?.("performance_vitals: ctx.loadModule unavailable in this registry build — per-metric web_vital events disabled, summary unaffected"),()=>{};const n=e.config||{},r=Array.isArray(n.metrics)?n.metrics:oy,o=Array.isArray(n.attribution_metrics)?n.attribution_metrics:iy,i=typeof n.max_value_ms=="number"?n.max_value_ms:sy,s=typeof n.sample_rate=="number"?n.sample_rate:ay;let a=null,c=null,l=null;const u=e.onEvent(p=>{l=p.session_id||l;const v=p.properties||{};typeof v.window_id=="string"&&(a=v.window_id),typeof v.page_view_id=="string"&&(c=v.page_view_id)}),d=()=>{if(typeof e.ids=="function")try{const p=e.ids();a=p.window_id??a,c=p.page_view_id??c,l=p.session_id??l}catch{}},g=r.indexOf("INP")>-1||r.indexOf("LCP")>-1?gy():null,f=new Set,m=cy(),y=p=>{const v=`${p.metric}:${p.metric_id}`;if(f.has(v))return;if(f.add(v),typeof p.value=="number"&&p.value>=i){e.log.warn?.(`performance_vitals: dropping implausible ${p.metric} value`,p.value);return}if(d(),typeof e.sampled=="function"){if(!e.sampled())return}else if(!fy(l||"unknown",s))return;let E=null;if(o.indexOf(p.metric)>-1&&p.attribution){const S=p.attribution,x={};S.target&&(x.target=String(S.target).slice(0,200)),S.target_el&&(x.target_el=S.target_el),S.interaction_type&&(x.interaction_type=S.interaction_type),S.load_state&&(x.load_state=S.load_state),S.phases&&(x.phases=S.phases),S.lcp&&(x.lcp=S.lcp),S.cls&&(x.cls=S.cls),Object.keys(x).length&&(E=my(x)<=2048?x:null)}const T=t(),A={metric:p.metric,value:p.value,rating:p.rating,delta:p.delta,metric_id:p.metric_id,nav_type:p.nav_type,path:T,route_template:Ar(T,e.config&&e.config.route_patterns),window_id:a,page_view_id:c,device_type:m,attribution:E};if(g&&(p.metric==="INP"||p.metric==="LCP")){const S=g.longTasks(),x=g.slowResources();S.length&&(A.long_tasks=S),x.length&&(A.slow_resources=x)}e.track("web_vital",A)};let b=!1;return e.loadModule(ny,ry).then(p=>{if(b||!p||typeof p.startWebVitals!="function"){e.log.warn?.("performance_vitals: web_vitals module loaded without a usable API — falling back to summary only");return}p.startWebVitals({metrics:r,attributionMetrics:o,onReport:y})}).catch(p=>{e.log.warn?.("performance_vitals: web_vitals module failed to load, summary event unaffected",p)}),()=>{b=!0,u(),g?.stop()}}re({name:"vitals",feature:"performance_vitals",init(e){if(typeof window>"u")return;const t=[];let n=Gl(),r=location.pathname,o=!1,i=!1;const s=[St("largest-contentful-paint",c=>{const l=c[c.length-1];l&&(n.lcp=Le(l.renderTime||l.startTime))}),St("paint",c=>{for(const l of c)l.name==="first-contentful-paint"&&(n.fcp=Le(l.startTime))}),St("first-input",c=>{const l=c[0];l&&n.fid===null&&(n.fid=Le(l.processingStart-l.startTime))}),St("layout-shift",c=>{for(const l of c){if(l.hadRecentInput)continue;const u=l.startTime||0;n.sessionValue&&u-n.sessionLast<ey&&u-n.sessionStart<Qh?n.sessionValue+=l.value:(n.sessionValue=l.value,n.sessionStart=u),n.sessionLast=u,n.sessionValue>n.cls&&(n.cls=n.sessionValue)}}),St("event",c=>{for(const l of c){const u=l.interactionId;if(!u)continue;const d=n.interactions.get(u)||0;l.duration>d&&n.interactions.set(u,l.duration)}},{durationThreshold:ty})];for(const c of s)c&&t.push(c);const a=c=>{if(i)return;i=!0;const l=o?null:ly(),u=navigator.connection;e.track("web_vitals",{path:c,route_template:Ar(c,e.config&&e.config.route_patterns),ttfb_ms:l?l.ttfb:null,fcp_ms:o?null:n.fcp,lcp_ms:o?null:n.lcp,cls:Math.round(n.cls*1e3)/1e3,inp_ms:uy(n.interactions),fid_ms:o?null:n.fid,dom_content_loaded_ms:l?l.dcl:null,load_ms:l?l.load:null,nav_type:o?"spa":l?l.type:"navigate",connection:u&&u.effectiveType||null,device_memory:navigator.deviceMemory??null})};return t.push(e.onNavigate(()=>{a(r),n=Gl(),o=!0,i=!1,r=location.pathname})),t.push(e.onLeave(()=>a(r))),t.push(py(e,()=>r)),()=>{for(const c of t)try{c()}catch{}}}});const Dn=W("forms"),ji=new Set;function Kl(e){return ji.add(e),()=>{ji.delete(e)}}function Mr(e){for(const t of Array.from(ji))try{t(e)}catch(n){Dn.warn("[FormFieldAnalytics] subscriber failed",n)}}const _y=/(pass(?:word|code)|\bpwd\b|\bcvv\b|\bcvc\b|\bcsc\b|security[\s_-]?code|card[\s_-]?(?:number|num|no)|cardnumber|credit|debit|\bexp(?:iry|iration)?[\s_-]?(?:date|month|year|mm|yy)?\b|\bssn\b|social[\s_-]?security|tax[\s_-]?(?:id|file)|\btfn\b|passport|licen[cs]e|medicare|driver|national[\s_-]?id|\bnric\b|\bdob\b|date[\s_-]?of[\s_-]?birth|birth[\s_-]?date|health|medical|diagnos|patient|\biban\b|\bswift\b|\bbsb\b|routing[\s_-]?number|account[\s_-]?number|sort[\s_-]?code|honeypot|honey[\s_-]?pot|\bhp[\s_-]?field\b|\bpin\b)/i,hy=/(compan(?:y|ies)|business|organi[sz]ation|organisation|street|address|city|suburb|state|country|user|account|file|domain|product|property|card|brand|project|event|role|title|bank|school|team|pet)[\s_-]?name/i;function yy(e){return[e.getAttribute("autocomplete"),e.getAttribute("name"),e.id,e.getAttribute("placeholder"),e.getAttribute("aria-label"),e.getAttribute("data-field-reference"),wy(e)].filter(Boolean).join(" ").toLowerCase().replace(/[_.\-]+/g," ")}function wy(e){try{const t=e.labels;if(t&&t[0])return t[0].textContent?.trim().slice(0,80)||"";const n=e.closest("label");return n&&n.textContent?.trim().slice(0,80)||""}catch{return""}}function by(e){const t=e.tagName,n=(e.getAttribute("type")||(t==="TEXTAREA"?"textarea":"text")).toLowerCase(),r=(e.getAttribute("autocomplete")||"").toLowerCase();if(n==="password"||n==="hidden"||r.startsWith("cc-")||r==="new-password"||r==="current-password"||r==="one-time-code")return"other";const o=yy(e);if(_y.test(o))return"other";if(n==="email"||r.includes("email")||/\be-?mail\b/.test(o))return"email";if(n==="tel"||r.includes("tel")||/\b(phone|mobile|telephone|cell)\b/.test(o))return"phone";if(!hy.test(o)){if(r==="given-name"||/\b(first[\s_-]?name|fname|given[\s_-]?name|forename)\b/.test(o))return"first_name";if(r==="family-name"||/\b(last[\s_-]?name|lname|surname|family[\s_-]?name)\b/.test(o))return"last_name";if(r==="name"||/\b(full[\s_-]?name|your[\s_-]?name|name)\b/.test(o))return"full_name"}return t==="SELECT"?"select":t==="TEXTAREA"?"textarea":n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"||n==="range"?"number":["date","datetime-local","month","week","time"].includes(n)?"date":["text","search","url"].includes(n)?"text":"other"}let H={domIntelligence:!1,enabled:!1,trackFocusBlur:!0,trackTyping:!0,trackValidation:!0,trackAbandonment:!0,captureFieldLength:!0,detectAutofill:!0,hesitationMs:3e3,correctionThreshold:2},Me=new Map,Qe=null,et=null,Jl=!1;const Xl=new WeakMap,Yl=new WeakMap,qi=new WeakMap;let vy=0,Sy=0,Et=null;function Ey(e){if(H={...H,...e},!H.enabled){Dn.log("[FormFieldAnalytics] Disabled via config");return}Pn(),!Jl&&(Jl=!0,ky(),Ly(),My(),Zl(),H.domIntelligence&&Fy(),Dn.log("[FormFieldAnalytics] Initialized",H))}function Pn(e=document){(e instanceof HTMLFormElement?[e]:e.querySelectorAll("form")).forEach(n=>{const r=qt(n),o=Array.from(n.querySelectorAll("input, textarea, select")).filter(Te),i=Me.get(r)||{form_id:r,form_name:Uy(n),form_action:n.action||window.location.href,fields:new Map,field_order:[],started_at:null,completed:!1,abandoned:!1,total_fields:o.length,completed_fields:0,fields_with_errors:0,average_field_time:0,completion_rate:0};o.forEach(s=>{const a=s,c=tt(a);i.fields.has(c)||i.fields.set(c,{field_id:c,field_name:a.name||c,field_type:a.type||"text",field_label:jy(a),form_id:r,first_focus:null,last_blur:null,total_focus_time:0,focus_count:0,character_count:0,backspace_count:0,paste_count:0,autocomplete_detected:!1,completed:!1,abandoned:!1,validation_errors:0,hesitation_time:0,correction_ratio:0,field_kind:by(a),focused_at:null,corrections:0,corrections_reported:0,hesitation_reported:!1,deleting:!1,pending_reentry:!1,last_length:a.value?a.value.length:0})}),i.total_fields=i.fields.size,Me.set(r,i),Dn.log(`[FormFieldAnalytics] Discovered form: ${r} with ${o.length} fields`)})}function ky(){document.addEventListener("focus",e=>{const t=e.target;!Te(t)||!H.enabled||H.trackFocusBlur&&Ay(t)},!0),document.addEventListener("blur",e=>{const t=e.target;!Te(t)||!H.enabled||H.trackFocusBlur&&Ty(t)},!0),document.addEventListener("input",e=>{const t=e.target;!Te(t)||!H.enabled||H.trackTyping&&Cy(t)},!0),document.addEventListener("paste",e=>{const t=e.target;!Te(t)||!H.enabled||H.trackTyping&&Iy(t)},!0),document.addEventListener("keydown",e=>{const t=e.target;!Te(t)||!H.enabled||H.trackTyping&&(e.key==="Backspace"||e.key==="Delete")&&xy(t)},!0),document.addEventListener("change",e=>{const t=e.target;!Te(t)||!H.enabled||Oy(t)},!0)}function Ay(e){const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);if(!r)return;const o=Date.now();t.started_at||(t.started_at=o,Y("form_started",{form_id:t.form_id,form_name:t.form_name,total_fields:t.total_fields})),Et||Zl(),r.first_focus||(r.first_focus=o,t.field_order.push(n)),r.focus_count++,qi.set(e,o),r.focused_at=o,r.last_blur!==null&&e.value.length>0&&(r.pending_reentry=!0),Qe={element:e,interaction:r},et&&clearTimeout(et),et=setTimeout(()=>{Qe&&Qe.interaction.character_count===0&&(Qe.interaction.hesitation_time=Date.now()-(Qe.interaction.first_focus||Date.now()))},3e3),Y("field_focus",{form_id:t.form_id,field_id:n,field_name:r.field_name,field_type:r.field_type,field_kind:r.field_kind,focus_count:r.focus_count}),Fn("focus",t,r,e),Vi(t)}function Ty(e){const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);if(!r)return;const o=Date.now(),i=qi.get(e);if(i!==void 0){const c=o-i;r.total_focus_time+=c,r.last_blur=o,qi.delete(e)}const s=r.completed,a=e.value.trim();r.completed=a.length>0,r.completed!==s&&(t.completed_fields+=r.completed?1:-1),!r.completed&&r.focus_count>0&&(r.abandoned=!0,Y("field_abandoned",{form_id:t.form_id,form_name:t.form_name,field_id:n,field_name:r.field_name,focus_time:r.total_focus_time,focus_count:r.focus_count})),r.character_count>0&&(r.correction_ratio=r.backspace_count/r.character_count),Qe&&Qe.element===e&&(Qe=null),et&&clearTimeout(et),Y("field_blur",{form_id:t.form_id,field_id:n,field_name:r.field_name,field_kind:r.field_kind,completed:r.completed,character_count:r.character_count,focus_time:r.total_focus_time,correction_ratio:r.correction_ratio}),r.focused_at=null,r.corrections>=H.correctionThreshold&&r.corrections>r.corrections_reported&&(r.corrections_reported=r.corrections,Fn("correction",t,r,e,{corrections:r.corrections,final_length:e.value.length})),Fn("blur",t,r,e)}function Cy(e){const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);if(!r)return;const o=Date.now();if(r.focused_at!==null){const s=o-r.focused_at;r.focused_at=null,s>=H.hesitationMs&&!r.hesitation_reported&&(r.hesitation_reported=!0,Fn("hesitation",t,r,e,{ms_to_first_input:s}))}const i=e.value.length;if(r.pending_reentry&&(r.pending_reentry=!1,r.corrections++),i<r.last_length?r.deleting||(r.deleting=!0,r.corrections++):i>r.last_length&&(r.deleting=!1),r.last_length=i,Fn("input",t,r,e,{length:i}),et&&(clearTimeout(et),et=null),H.captureFieldLength){const s=r.character_count;r.character_count=e.value.length,H.detectAutofill&&r.character_count-s>5&&(r.autocomplete_detected=!0,Y("field_autofill_detected",{form_id:t.form_id,field_id:n,field_name:r.field_name,characters_added:r.character_count-s,detection:"length_jump_heuristic"}))}}function Iy(e){const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);r&&(r.paste_count++,Y("field_paste",{form_id:t.form_id,field_id:n,field_name:r.field_name,paste_count:r.paste_count}))}function xy(e){const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);r&&r.backspace_count++}function Oy(e){if(!H.trackValidation)return;const t=Ht(e);if(!t)return;const n=tt(e),r=t.fields.get(n);if(r&&e.validity&&!e.validity.valid){r.validation_errors===0&&t.fields_with_errors++,r.validation_errors++;const o=e.validity;Y("field_validation_error",{form_id:t.form_id,field_id:n,field_name:r.field_name,error_type:ou(o),error_count:r.validation_errors})}}function Ly(){document.addEventListener("submit",e=>{const t=e.target;if(!H.enabled)return;Pn(t);const n=qt(t),r=Me.get(n);r&&(r.completed=!0,Wi(r),Ny(t),Ql(r),Y("form_completed",{form_id:r.form_id,form_name:r.form_name,total_fields:r.total_fields,completed_fields:r.completed_fields,completion_rate:r.completion_rate,fields_with_errors:r.fields_with_errors,average_field_time:r.average_field_time,time_to_complete:r.started_at?Date.now()-r.started_at:0,field_order:r.field_order}))})}function My(){window.addEventListener("beforeunload",()=>{!H.enabled||!H.trackAbandonment||Me.forEach(e=>{!e.completed&&e.started_at&&(e.abandoned=!0,Wi(e),Ql(e),Y("form_abandoned",{form_id:e.form_id,form_name:e.form_name,total_fields:e.total_fields,completed_fields:e.completed_fields,completion_rate:e.completion_rate,time_spent:Date.now()-e.started_at,last_field:e.field_order[e.field_order.length-1]}))})})}function Zl(){Et&&clearInterval(Et),Et=setInterval(()=>{if(!H.enabled)return;let e=!1;Me.forEach(t=>{t.started_at&&!t.completed&&(e=!0,Wi(t),Y("form_progress",{form_id:t.form_id,completion_rate:t.completion_rate,completed_fields:t.completed_fields,total_fields:t.total_fields,time_elapsed:Date.now()-t.started_at}))}),!e&&Et&&(clearInterval(Et),Et=null)},3e4)}function Fn(e,t,n,r,o){Mr({type:e,form_id:t.form_id,form_name:t.form_name,field_id:n.field_id,field_kind:n.field_kind,element:r,data:o})}function Ql(e){if(eu.has(e.form_id)||!e.field_order.length)return;eu.add(e.form_id);let t=0;e.fields.forEach(n=>{n.first_focus&&t++}),Mr({type:"fill_order",form_id:e.form_id,form_name:e.form_name,data:{order:e.field_order.slice(0,60),last_field_id:e.field_order[e.field_order.length-1],fields_total:e.total_fields,fields_touched:t,completed:e.completed}})}const eu=new Set,tu=new Map,nu=new Set;let Hi=null;function Ry(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return(t>>>0).toString(36)}function $y(e){return e?.trim()?"Validation message shown":""}function Bi(e){if(e.getAttribute("role")==="alert")return!0;const t=typeof e.className=="string"?e.className:"";return/(^|[\s_-])(error|invalid|has-error|is-invalid|field-error|form-error)([\s_-]|$)/i.test(t)}function zi(e){let t=e,n=0;for(;t&&n++<12;){if(t.hidden||t.getAttribute&&t.getAttribute("aria-hidden")==="true")return!1;const r=t.style;if(r&&(r.display==="none"||r.visibility==="hidden"||r.opacity==="0"))return!1;t=t.parentElement}return!0}function ru(e){if(e.id){const r=document.querySelector(`[aria-describedby~="${CSS.escape(e.id)}"],[aria-errormessage="${CSS.escape(e.id)}"]`);if(r&&Te(r))return r}let t=e.parentElement,n=0;for(;t&&n++<4;){const r=Array.from(t.querySelectorAll("input,textarea,select")).filter(Te);if(r.length)return r[0];if(t.tagName==="FORM")break;t=t.parentElement}return null}function Un(e,t,n){if(!H.enabled||!H.trackValidation)return;const r=t||(e?e.closest("form"):null);if(!r)return;Pn(r);const o=Me.get(qt(r));if(!o)return;const i=e?tt(e):void 0,s=$y(n),a=Ry(`${i||""}:${n}`),c=`${o.form_id}:${a}`,l=Date.now(),u=tu.get(c);if(u!==void 0&&l-u<1e3)return;tu.set(c,l);const d=i?o.fields.get(i):void 0;Mr({type:"validation_shown",form_id:o.form_id,form_name:o.form_name,field_id:i,field_kind:d?.field_kind,data:{message:s,message_hash:a}})}function Ny(e,t){if(!H.trackValidation)return;const n=Array.from(e.querySelectorAll("input,textarea,select")).filter(Te);for(const r of n){const o=r.validity;o&&!o.valid&&Un(r,e,r.validationMessage||ou(o)),r.getAttribute("aria-invalid")==="true"&&Un(r,e,r.validationMessage||"aria-invalid")}}function Dy(e){return Array.from(e.querySelectorAll('fieldset,[data-glue-step],[data-step],[data-step-index],[class*="step"],[class*="Step"]'))}function Py(e,t){const n=e.getAttribute("data-glue-step")||e.getAttribute("data-step")||e.getAttribute("aria-label");if(n&&n.trim())return n.trim().slice(0,80);const o=e.querySelector("legend,h1,h2,h3,h4,[data-step-label]")?.textContent?.trim();return o&&o.slice(0,80)||`Step ${t+1}`}function Vi(e){if(!H.enabled)return;const t=Array.from(document.querySelectorAll("form"));for(const n of t){const r=qt(n);if(e&&e.form_id!==r)continue;const o=Dy(n);o.length<2||o.forEach((i,s)=>{const a=`${r}:${s}`;nu.has(a)||!zi(i)||(nu.add(a),Mr({type:"step_view",form_id:r,form_name:Me.get(r)?.form_name||r,data:{step_index:s,step_label:Py(i,s)}}))})}}function Fy(){if(typeof MutationObserver>"u"||Hi)return;let e=null;Hi=new MutationObserver(t=>{if(H.enabled)try{let n=!1;for(const r of t)if(r.type==="attributes"){const o=r.target;if(!o||o.nodeType!==1)continue;r.attributeName==="aria-invalid"?o.getAttribute("aria-invalid")==="true"&&Te(o)&&Un(o,null,o.validationMessage||"aria-invalid"):Bi(o)&&zi(o)&&Un(ru(o),null,o.textContent||""),o.closest("form")&&(n=!0)}else r.addedNodes.forEach(o=>{if(o.nodeType!==1)return;const i=o;n=!0;const s=Bi(i)?[i]:Array.from(i.querySelectorAll('[role="alert"],[class*="error"],[class*="invalid"]'));for(const a of s)Bi(a)&&zi(a)&&Un(ru(a),null,a.textContent||"");(i.tagName==="FORM"||i.querySelector("form"))&&Pn()});n&&e===null&&(e=setTimeout(()=>{e=null,Vi()},150))}catch(n){Dn.warn("[FormFieldAnalytics] DOM intelligence failed",n)}}),Hi.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-invalid","class","style","hidden","aria-hidden"]}),Vi()}function Wi(e){e.completion_rate=e.total_fields?e.completed_fields/e.total_fields*100:0;let t=0,n=0;e.fields.forEach(r=>{r.total_focus_time>0&&(t+=r.total_focus_time,n++)}),e.average_field_time=n>0?t/n:0}function ou(e){return e.valueMissing?"required":e.typeMismatch?"type_mismatch":e.patternMismatch?"pattern_mismatch":e.tooLong?"too_long":e.tooShort?"too_short":e.rangeUnderflow?"range_underflow":e.rangeOverflow?"range_overflow":e.stepMismatch?"step_mismatch":e.badInput?"bad_input":"unknown"}function Te(e){if(!["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.closest("[data-glue-ignore],[data-private]"))return!1;const t=(e.getAttribute("type")||"").toLowerCase(),n=e.getAttribute("name")||"";return!["password","hidden","submit","button","reset"].includes(t)&&!/^(?:_gbf_hp|cf-turnstile-response|g-recaptcha-response)$/i.test(n)&&!(e.getAttribute("autocomplete")||"").startsWith("cc-")}function qt(e){let t=Xl.get(e);return t||(t=e.getAttribute("data-glue-form")||e.getAttribute("id")||e.getAttribute("name")||`form_${++vy}`,Xl.set(e,t)),t}function Uy(e){return e.getAttribute("data-glue-form")||e.getAttribute("name")||e.getAttribute("id")||qt(e)}function Ht(e){if(!H.enabled)return null;const t=e.closest("form");return t?(Pn(t),Me.get(qt(t))||null):null}function tt(e){let t=Yl.get(e);return t||(t=e.id||e.getAttribute("name")||`field_${++Sy}`,Yl.set(e,t)),t}function jy(e){if(e.id){const n=e.labels?.[0];if(n)return n.textContent?.trim()||""}const t=e.closest("label");return t?t.textContent?.trim()||"":e.placeholder?e.placeholder:e.name||e.id||"Unknown field"}function qy(){return new Map(Me)}function Hy(e){return Me.get(e)||null}re({name:"formIntelligence",feature:"form_intelligence",init(e){return Kl(t=>{const n={form_id:t.form_id,form_name:t.form_name},r=t.data||{};switch(t.type){case"hesitation":e.track("field_hesitation",{...n,field_id:t.field_id,field_kind:t.field_kind,ms_to_first_input:Math.round(r.ms_to_first_input||0)});break;case"correction":e.track("field_correction",{form_id:t.form_id,field_id:t.field_id,field_kind:t.field_kind,corrections:r.corrections||0,final_length:r.final_length||0});break;case"validation_shown":e.track("form_validation_shown",{form_id:t.form_id,field_id:t.field_id,message_hash:r.message_hash,message:r.message});break;case"step_view":e.track("form_step_view",{form_id:t.form_id,step_index:r.step_index,step_label:r.step_label});break;case"fill_order":e.track("form_fill_order",{form_id:t.form_id,order:r.order||[],last_field_id:r.last_field_id,fields_total:r.fields_total||0,fields_touched:r.fields_touched||0});break}})}});const By=["email","phone","first_name","last_name","full_name"],zy=/^[^\s@]+@[^\s@]+\.[a-z]{2,}$/i,Vy=1500,Wy=200;function Gy(){try{const e=window.glue?.privacy?.isFeatureAllowed;if(typeof e=="function")return e("form_capture")!==!1}catch{}return cn("form_capture")}function Ky(e,t){const n=t.trim().slice(0,Wy);return n?e==="email"?zy.test(n)?n:null:e==="phone"?n.replace(/\D/g,"").length>=8?n:null:n.length>=2&&!/\d/.test(n)?n:null:null}re({name:"leadCapture",feature:"lead_capture",init(e){if(!e.features.lead_capture)return;const t=new Map,n=new Map,r=new Set;let o=!1;const i=u=>{const d=n.get(u);d&&(clearTimeout(d),n.delete(u))},s=u=>{const d=u.element,g=u.field_kind;if(!d||!g||By.indexOf(g)===-1||o||r.has(u.form_id)||!Gy())return;try{if(d.closest("[data-glue-ignore],[data-private]"))return}catch{return}const f=Ky(g,String(d.value||""));if(!f)return;const m=`${u.form_id}:${u.field_id}`;t.get(m)!==f&&(t.set(m,f),e.track("lead_field_captured",{form_id:u.form_id,form_name:u.form_name,field_id:u.field_id,field_kind:g,value:f,valid:!0,path:e.route(),consent_basis:"site_privacy_policy"}))},a=Kl(u=>{const d=`${u.form_id}:${u.field_id}`;u.type==="input"?(i(d),n.set(d,setTimeout(()=>{n.delete(d),s(u)},Vy))):u.type==="blur"&&(i(d),s(u))}),c=e.onNavigate(()=>{t.clear(),r.clear(),o=!1;for(const u of Array.from(n.keys()))i(u)}),l=e.onEvent(u=>{if(u.event!=="form_submitted"||u.properties?.source!=="server"&&!u.properties?.submission_id)return;const d=u.properties&&u.properties.form_id;typeof d=="string"&&d?r.add(d):o=!0;for(const g of Array.from(n.keys()))i(g)});return()=>{a(),l(),c();for(const u of Array.from(n.keys()))i(u)}}});const iu=["dg_uid","dg_cid","dg_src","_dg"],Jy=12e4,Xy=1e3,Yy=50,Zy=/^[A-Za-z0-9._:-]{8,128}$/,Qy=/^(.+)\.(\d{10,16})$/,ew=/^(?:com|co|net|org|gov|edu|ac|id|or|ne|asn)$/;function tw(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Gi(){const e=h("glue_user_id");if(e)return e;try{const t=h("glue_user_profile");if(t)return JSON.parse(t).glue_user_id||null}catch{}return null}function su(e){return String(e??"").trim().toLowerCase().replace(/^https?:\/\//,"").split("/")[0].replace(/^\*?\./,"")}function au(e){const t=e.split(".").filter(Boolean);if(t.length<=2)return t.join(".");const n=t[t.length-1],r=t[t.length-2];return t.slice(n.length===2&&ew.test(r)?-3:-2).join(".")}function nw(e){const t=su(location.hostname),n=Array.isArray(e.domains)?e.domains.map(su).filter(Boolean):[];if(n.length)return o=>o!==t&&n.some(i=>o===i||o.endsWith("."+i));const r=au(t);return o=>!!r&&o!==t&&au(o)===r}function rw(e){try{const t=window.history,n=typeof History<"u"&&typeof History.prototype.replaceState=="function"?History.prototype.replaceState:t&&t.replaceState;if(!t||typeof n!="function")return;const r=location.search.slice(1).split("&").filter(o=>{if(!o)return!1;const i=o.split("=")[0];let s=i;try{s=decodeURIComponent(i.replace(/\+/g," "))}catch{}return iu.indexOf(s)===-1});n.call(t,t.state,"",location.pathname+(r.length?"?"+r.join("&"):"")+location.hash)}catch(t){e.log.warn("identityLinks: could not strip params:",t)}}function cu(e,t){let n="";try{n=location.search}catch{return}if(!n||n.length<2)return;const r=new URLSearchParams(n),o=iu.filter(a=>r.has(a));if(!o.length)return;const i=Gi(),s=Date.now();for(const a of o){const c=(r.get(a)||"").trim(),l=a+"="+c;if(!c||t.has(l))continue;if(t.add(l),a==="dg_src"||a==="dg_cid"){if(c.length>128)continue;e.track("identity_link_param",{param:a,raw:c,adopted:!1});continue}let u=c,d,g=!0,f="url_param";if(a==="_dg"){const b=Qy.exec(c);if(!b)continue;u=b[1],d=s-Number(b[2]),g=d>=0&&d<=Jy,f="cross_domain"}if(!Zy.test(u))continue;const m=g&&!!i&&u!==i,y={param:a,value_hash:tw(u),adopted:m};d!==void 0&&(y.age_ms=d),e.track("identity_link_param",y),m&&e.track("identity_alias",{alias_glue_user_id:u,current_glue_user_id:i,source:f})}rw(e)}function lu(e,t){return e.searchParams.set("_dg",t+"."+Date.now()),e.href}function uu(e,t){if(!e)return null;try{const n=new URL(e,location.href);return n.protocol!=="http:"&&n.protocol!=="https:"||n.searchParams.has("_dg")||!t(n.hostname.toLowerCase())?null:n}catch{return null}}function du(e,t,n){const r=e.getAttribute(t)||"";e.setAttribute(t,n),setTimeout(()=>{try{e.getAttribute(t)===n&&e.setAttribute(t,r)}catch{}},Xy)}function ow(e,t){let n=0;const r=(a,c)=>{n>=Yy||(n+=1,e.track("cross_domain_link",{to_host:a,element:c}))},o=a=>{try{if(!a.isTrusted||a.type==="auxclick"&&a.button!==1)return;const l=(typeof a.composedPath=="function"?a.composedPath():[a.target]).find(f=>f instanceof Element),u=l&&l.closest("a[href]");if(!u||u.closest("[data-glue-ignore]"))return;const d=uu(u.getAttribute("href"),t),g=d&&Gi();if(!d||!g)return;du(u,"href",lu(d,g)),r(d.hostname.toLowerCase(),"a")}catch(c){e.log.warn("identityLinks: click decoration failed:",c)}},i=a=>{try{if(!a.isTrusted)return;const c=a.target instanceof Element?a.target.closest("form"):null;if(!c||c.closest("[data-glue-ignore]"))return;const l=uu(c.getAttribute("action"),t),u=l&&Gi();if(!l||!u)return;du(c,"action",lu(l,u)),r(l.hostname.toLowerCase(),"form")}catch(c){e.log.warn("identityLinks: form decoration failed:",c)}},s={capture:!0,passive:!0};return document.addEventListener("click",o,s),document.addEventListener("auxclick",o,s),document.addEventListener("submit",i,s),()=>{document.removeEventListener("click",o,!0),document.removeEventListener("auxclick",o,!0),document.removeEventListener("submit",i,!0)}}re({name:"identityLinks",feature:"identity_links",init(e){if(typeof window>"u"||typeof document>"u")return;const t=new Set;cu(e,t);const n=e.onNavigate(()=>cu(e,t)),r=ow(e,nw(e.config||{}));return()=>{n(),r()}}});const fu="glue_fp_uid",iw=3e3,sw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,aw=/^[0-9a-fA-F-]{8,64}$/,cw=/^(?:com|co|net|org|gov|edu|ac|id|or|ne|asn)$/,gu=/(?:^|\.)(?:supabase\.(?:co|com|in|net)|vercel\.app|localhost)$/;let Ki="";try{const e=typeof document<"u"?document.currentScript:null;Ki=e&&typeof e.src=="string"&&e.src||""}catch{}function lw(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function uw(){const e=h("glue_user_id");if(e)return e;try{const t=h("glue_user_profile");if(t)return JSON.parse(t).glue_user_id||null}catch{}return null}function mu(e){const t=e.split(".").filter(Boolean);if(t.length<2)return"";const n=t[t.length-1],r=t[t.length-2];return t.slice(n.length===2&&cw.test(r)?-3:-2).join(".")}function dw(e){const t=Ki?[Ki]:[],n=[];try{const r=document.querySelectorAll('script[src*="workspace-id="]');for(let o=0;o<r.length;o++){const i=r[o].src||"";i&&(i.indexOf(e)===-1?n:t).push(i)}}catch{}return t.concat(n)}function fw(e){const t=mu(String(location.hostname||"").toLowerCase());if(!t||gu.test(t))return null;for(const n of dw(e))try{const r=new URL(n,location.href),o=r.hostname.toLowerCase();if(r.protocol!=="https:"||gu.test(o)||mu(o)!==t)continue;return r.origin}catch{}return null}function gw(e){let t=null,n=null;try{return t=new AbortController,n=setTimeout(()=>{try{t.abort()}catch{}},iw),fetch(e,{method:"GET",credentials:"include",cache:"no-store",keepalive:!1,signal:t.signal}).then(r=>r&&r.ok?r.json():null).then(r=>{const o=r&&typeof r.uid=="string"?r.uid.trim():"";return sw.test(o)?o:null}).catch(()=>null).then(r=>(clearTimeout(n),r))}catch{return n!==null&&clearTimeout(n),Promise.resolve(null)}}re({name:"firstPartyCookie",feature:"first_party_cookie",init(e){if(typeof window>"u"||typeof document>"u"||typeof fetch!="function"||typeof AbortController!="function")return;const t=window.__glueConfig,n=String(t&&t.workspaceId||"").trim();if(!aw.test(n))return;const r=fw(n);if(!r||B(fu))return;let o=!1;const i=r+"/?workspace-id="+encodeURIComponent(n)+"&uid=1";return gw(i).then(s=>{if(o||!s)return;F(fu,s);const a=uw();a&&a===s||(e.track("identity_link_param",{param:"_dg_cookie",value_hash:lw(s),adopted:!!a}),e.track("identity_alias",{alias_glue_user_id:s,current_glue_user_id:a,source:"first_party_cookie"}))}).catch(s=>e.log.warn("firstPartyCookie: uid lookup failed:",s)),()=>{o=!0}}});const pu="glue_click_id",_u="glue_first_touch",hu="dg_click",mw="_dg_click",Ji=/^dg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,pw=6e4,_w=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],hw=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid"];function yw(){const e=typeof crypto<"u"?crypto:null;return e&&typeof e.randomUUID=="function"?e.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function ww(e){try{const t=window.history,n=typeof History<"u"&&typeof History.prototype.replaceState=="function"?History.prototype.replaceState:t&&t.replaceState;if(!t||typeof n!="function")return;const r=location.search.slice(1).split("&").filter(o=>{if(!o)return!1;let i=o.split("=")[0];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}return i!==hu});n.call(t,t.state,"",location.pathname+(r.length?"?"+r.join("&"):"")+location.hash)}catch(t){e.log.warn("clickId: could not strip dg_click:",t)}}function bw(){try{return new URLSearchParams(location.search)}catch{return null}}function vw(e,t){const n={},r={};if(e){for(const i of _w){const s=(e.get(i)||"").trim();s&&(n[i]=s.slice(0,200))}for(const i of hw){const s=(e.get(i)||"").trim();s&&(r[i]=s.slice(0,200))}}t&&(r.dg_click=t);let o="";try{o=(document.referrer||"").slice(0,512)}catch{}return{utm:n,click_ids:r,referrer:o,landing_page:(location.origin+location.pathname).slice(0,512),captured_at:new Date().toISOString()}}re({name:"clickId",feature:"click_id",init(e){if(typeof window>"u")return;const t=bw(),n=(t?.get(hu)||"").trim(),r=(pe(mw)||"").trim(),o=(h(pu)||"").trim();let i=null,s=null;Ji.test(n)?(i=n,s="param"):Ji.test(r)&&(i=r,s="cookie"),i&&i!==o&&(k(pu,i),wt({traits:{click_id:i}}),e.track("click_id_captured",{click_id:i,source:s})),n&&ww(e);const a=i||(Ji.test(o)?o:null);if(!h(_u)){const f=vw(t,a);k(_u,JSON.stringify(f)),wt({traits:{first_touch:f}}),e.track("first_touch_captured",f)}let c=null,l=0;const u=()=>{const f=Date.now();return(!c||f-l>pw)&&(c=yw(),l=f),c},d=f=>(m={})=>{const y={event_id:u(),event_name:typeof m.eventName=="string"?m.eventName:void 0,external_id:typeof m.externalId=="string"?m.externalId:void 0,amount_minor:typeof m.amount=="number"?m.amount:void 0,currency:typeof m.currency=="string"?m.currency:void 0,invoice_id:typeof m.invoiceId=="string"?m.invoiceId:void 0,click_id:a||void 0,authoritative:!1};for(const b of Object.keys(y))y[b]===void 0&&delete y[b];return e.track(f,y),y.event_id},g={eventId:u,lead:d("lead"),sale:d("sale")};try{const f=window;f.glue&&typeof f.glue=="object"?f.glue.conversions=g:f.__glueConversions=g}catch(f){e.log.warn("clickId: could not expose window.glue.conversions:",f)}}});const Sw=120,Ew=5,yu=100,Rr=10,kw=200,Aw=2048,Tw=32,Cw=20,Iw=["id","name","type","role","title","alt","aria-label","href","class","data-glue-action","data-glue-section","data-testid","data-framer-name"],wu=/pass|token|secret|auth|card|ssn|email|phone/i,xw='a[href],button,[role="button"],input[type="submit"],input[type="button"],summary,select,label,[onclick]';function bu(e,t,n,r){const o=typeof e=="number"&&Number.isFinite(e)?Math.round(e):r;return Math.min(n,Math.max(t,o))}function vu(e){return Math.min(1,Math.max(0,e))}function Su(e){return Math.round(e*100)/100}function $r(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function jn(e){return(e.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean)}function Ow(e){const t=e.tagName.toLowerCase();if(t==="select"||t==="textarea"||e.getAttribute("contenteditable")==="true")return!0;if(t==="input"){const n=(e.getAttribute("type")||"text").toLowerCase();return!["button","submit","reset","checkbox","radio","image"].includes(n)}return!1}function Lw(e){const t=e.parentNode;return t&&t.nodeType===11&&t.host?t.host:null}function Mw(e){const t=Lw(e);return t?{parent:t,crossedShadow:!0}:{parent:e.parentElement??null,crossedShadow:!1}}function Xi(e){const t=e;let r=(typeof t.composedPath=="function"?t.composedPath():[]).find(o=>o instanceof Element)??(e.target instanceof Element?e.target:null);return r?(r.namespaceURI==="http://www.w3.org/2000/svg"&&(r=r.closest("button, a")||r),r):null}function Eu(e){return e.closest(xw)||e.closest("[data-glue-action]")||null}function ku(e,t){if(!e||e.closest("[data-glue-ignore],[data-private]"))return!0;if(t&&t.length){for(const n of t)if(n)try{if(e.closest(n))return!0}catch{}}return!1}function Rw(e){if(!e)return null;try{const t=new URL(e,location.href);return["http:","https:","mailto:","tel:"].includes(t.protocol)?(t.username="",t.password="",t.href.slice(0,Aw)):null}catch{return null}}function $w(e){const t=e.tagName==="A"?e:e.closest("a[href]");return t?Rw(t.getAttribute("href")):null}function Au(e){let t=1,n=1,r=e;for(;r=r.previousElementSibling;)t++,r.tagName===e.tagName&&n++;return{nth_child:t,nth_of_type:n}}function Nw(e){return Ow(e)||!!e.closest("[data-glue-mask],[data-private]")}function Tu(e){if(Nw(e))return"";let t="";for(const n of Array.from(e.childNodes))n.nodeType===3&&n.textContent&&(t+=n.textContent);return t.trim()}function Cu(e){let t="";for(const n of Array.from(e.children)){if(n.tagName!=="SPAN")continue;const r=Tu(n);t=`${t} ${r}`.trim(),n.children.length&&(t=`${t} ${Cu(n)}`.trim())}return t}function Dw(e,t){const n=Tu(e),r=e.tagName==="A"||e.tagName==="BUTTON"?`${n} ${Cu(e)}`.trim():n;return $r(r,t)}function Iu(e,t,n,r){const o={},i=s=>(t.has(s)||s.startsWith("data-glue-"))&&!n.has(s)&&!wu.test(s);if(r.dense)for(const s of t){if(n.has(s)||wu.test(s))continue;const a=e.getAttribute(s);o[s]=a==null?null:s==="class"?jn(e).slice(0,Rr).join(" "):$r(a,yu)}for(const s of Array.from(e.attributes))s.name in o||i(s.name)&&(o[s.name]=s.name==="class"?jn(e).slice(0,Rr).join(" "):$r(s.value,yu));return o}function Pw(e){const n=e.closest("[data-glue-action]")?.getAttribute("data-glue-action");return n?$r(n,100):null}function Fw(){try{return window.self!==window.top}catch{return!0}}function Uw(e){try{return typeof e.getBoundingClientRect!="function"?null:e.getBoundingClientRect()}catch{return null}}function jw(e){let t=e;for(let n=0;t&&n<Cw;n++){try{const r=window.getComputedStyle(t).position;if(r==="fixed"||r==="sticky")return!0}catch{break}t=t.parentElement}return!1}function qw(e,t){const n=typeof window<"u"&&window.innerWidth||0,r=typeof window<"u"&&window.innerHeight||0,o=typeof window<"u"&&window.scrollX||0,i=typeof window<"u"&&window.scrollY||0,s=e,a=!!s&&typeof s.clientX=="number"&&(s.detail??0)>0;let c,l;a?(c=s.clientX,l=s.clientY):t?(c=t.left+t.width/2,l=t.top+t.height/2):(c=0,l=0);let u=.5,d=.5;return t&&t.width>0&&t.height>0&&(u=vu((c-t.left)/t.width),d=vu((l-t.top)/t.height)),{page_x:Math.round(c+o),page_y:Math.round(l+i),viewport_x:Math.round(c),viewport_y:Math.round(l),viewport_w:n,viewport_h:r,scroll_x:Math.round(o),scroll_y:Math.round(i),rel_x:Su(u),rel_y:Su(d)}}function xu(e,t){const n=e.tagName.toLowerCase(),r=t?jn(e)[0]:void 0;let o=r?`${n}.${r}`:n;const i=e.parentElement;if(i){const s=Array.prototype.filter.call(i.children,a=>a.tagName===e.tagName);s.length>1&&(o+=`:nth-of-type(${s.indexOf(e)+1})`)}return o}function Hw(e,t){const r=t.slice().reverse().map(o=>xu(o,!1));return r.push(xu(e,!0)),r.join(" > ").slice(0,kw)}function Bw(e){const t=[],n=new Set([e]);let r=0,o=e;for(let i=0;i<Tw;i++){const{parent:s,crossedShadow:a}=Mw(o);if(!s||n.has(s))break;const c=s.tagName?.toLowerCase();if(c==="body"||c==="html")break;n.add(s),a&&r++,t.push(s),o=s}return{chain:t,shadowDepth:r}}const zw=new Set(["id","class","role"]);function Vw(e,t,n){const{nth_child:r}=Au(e),o=new Set([...n,...zw]);return{tag:e.tagName.toLowerCase(),id:e.id||null,role:e.getAttribute("role"),classes:jn(e).slice(0,Rr),nth_child:r,attrs:Iu(e,t,o,{dense:!1})}}function Yi(e,t={}){if(!(e instanceof Element))return null;const n=t.config||{};if(ku(e,n.ignore_selectors))return null;const r=bu(n.text_chars,1,500,Sw),o=bu(n.ancestor_depth,0,10,Ew),i=new Set([...Iw,...n.attr_allow||[]]),s=new Set(n.attr_deny||[]),{chain:a,shadowDepth:c}=Bw(e),l=Uw(e),{nth_child:u,nth_of_type:d}=Au(e);return{tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),text:Dw(e,r),attrs:Iu(e,i,s,{dense:!0}),classes:jn(e).slice(0,Rr),href:$w(e),selector:Hw(e,a),nth_child:u,nth_of_type:d,ancestors:a.slice(0,o).map(g=>Vw(g,i,s)),shadow_depth:c,in_iframe:Fw(),action_id:Pw(e),target_fixed:jw(e),el_w:l?Math.round(l.width):0,el_h:l?Math.round(l.height):0,...qw(t.event,l)}}const Ww=new Set(["Enter"," ","Spacebar"]),Gw='[role="button"],[tabindex]';function Kw(e){try{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}catch{return null}}function Ou(e,t){return!e||!e.length?!1:e.some(n=>Kw(n)?.test(t)??!1)}function Jw(e){const t=location.origin+location.pathname;return!(Ou(e.url_deny,t)||e.url_allow&&e.url_allow.length&&!Ou(e.url_allow,t))}re({name:"autocapture",feature:"autocapture_rich",init(e){if(typeof window>"u"||typeof document>"u")return;const t=(o,i)=>{try{const s=e.config||{};if(!Jw(s))return;const a=Eu(o);if(!a||ku(a,s.ignore_selectors))return;const c=Yi(a,{event:i,config:s});if(!c)return;e.track("autocapture_click",{el:c,path:e.route()})}catch(s){e.log.warn("autocapture: capture failed:",s)}},n=o=>{if(!o.isTrusted)return;const i=Xi(o);i&&t(i,o)},r=o=>{if(!o.isTrusted||!Ww.has(o.key))return;const i=Xi(o);if(!i)return;const s=i.closest(Gw);!s||s.closest("a,button")||t(s,o)};return document.addEventListener("click",n,{capture:!0,passive:!0}),document.addEventListener("keydown",r,{capture:!0,passive:!0}),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("keydown",r,!0)}}});const Xw=600,Yw=30,Zw=3,Qw=200,eb=500,tb=5,Lu="[data-glue-ignore],[data-private]";function nb(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function rb(){try{return sessionStorage.getItem("glue_session_id")||""}catch{return""}}function ob(e,t,n){return t>=1?!0:t<=0?!1:n?nb(`${e}:${n}`)/4294967296<t:!0}function Mu(e){try{const t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}catch{return null}}function ib(e,t,n){const r=Array.isArray(n)?n:[];for(const i of r){const s=typeof i=="string"?Mu(i):null;if(s&&s.test(e))return!1}const o=Array.isArray(t)?t:[];if(!o.length)return!0;for(const i of o){const s=typeof i=="string"?Mu(i):null;if(s&&s.test(e))return!0}return!1}function Ru(e){const t=Xi(e);return t?Eu(t)||t:null}function $u(e){return e.target_fixed?{...e,page_x:e.viewport_x,page_y:e.viewport_y}:e}re({name:"heatmaps",feature:"heatmaps",init(e){if(typeof window>"u"||typeof document>"u")return;const t=e.config||{},n=typeof t.sample_rate=="number"?t.sample_rate:1,r=rb();if(!ob("heatmaps",n,r)){e.log.log("heatmaps: session sampled out (rate",n,")");return}if(!ib(window.location.origin+window.location.pathname,t.url_allow,t.url_deny)){e.log.log("heatmaps: url excluded by url_allow/url_deny");return}const i=t.budgets||{},s=Number(i.max_clicks_per_page)>0?Number(i.max_clicks_per_page):Qw,a=Number(i.max_moves_per_page)>0?Number(i.max_moves_per_page):eb,c=!!t.capture_pointer_moves,l=Number(t.move_sample_hz)>0?Number(t.move_sample_hz):tb,u=1e3/l,d=[];let g=[];const f=b=>{const p=Date.now();return g=g.filter(v=>p-v.at<=Xw&&Math.hypot(v.x-b.clientX,v.y-b.clientY)<=Yw),g.push({at:p,x:b.clientX,y:b.clientY}),g.length>=Zw},m=()=>({path:e.route(),route_template:Ar(e.route(),t.route_patterns)}),y=b=>{try{if(!b.isTrusted)return;const p=Ru(b);if(!p||p.closest(Lu))return;const v=Yi(p,{event:b,config:t});if(!v)return;const E=$u(v),T=f(b);if(!e.budget.take("heatmap_click",s))return;e.track("heatmap_click",{...E,is_rageclick:T,...m()})}catch(p){e.log.warn("heatmaps: click handler failed:",p)}};if(document.addEventListener("click",y,{capture:!0,passive:!0}),d.push(()=>document.removeEventListener("click",y,!0)),c){let b=0;const p=v=>{try{const E=Date.now();if(E-b<u)return;b=E;const T=Ru(v);if(!T||T.closest(Lu))return;const A=Yi(T,{event:v,config:t});if(!A)return;const S=$u(A);if(!e.budget.take("heatmap_pointermove",a))return;e.track("heatmap_pointermove",{...S,sample_hz:l,...m()})}catch(E){e.log.warn("heatmaps: pointermove handler failed:",E)}};document.addEventListener("mousemove",p,{capture:!0,passive:!0}),d.push(()=>document.removeEventListener("mousemove",p,!0))}return d.push(e.onNavigate(()=>{g=[]})),()=>{for(const b of d)try{b()}catch{}}}});const Nr="surveys",Zi="1",sb=1e4,ab=50,Qi=new Map;function cb(e,t){return`${e}@${t}`}function es(){const e=window;return e.__glueModules||(e.__glueModules={}),e.__glueModules}function lb(e,t){const n=es();return n[e]?Promise.resolve(n[e]):new Promise((r,o)=>{const i=Date.now(),s=()=>{const a=es()[e];if(a){r(a);return}if(Date.now()-i>=t){o(new Error(`surveys module load timed out: ${e}`));return}setTimeout(s,ab)};s()})}function ub(e,t){return new Promise((n,r)=>{const o=document.createElement("script");o.src=e,o.crossOrigin="anonymous",o.async=!0;const i=setTimeout(()=>r(new Error("surveys module script load timed out")),t);o.onload=()=>{clearTimeout(i),n()},o.onerror=()=>{clearTimeout(i),r(new Error("surveys module script failed to load"))},(document.head||document.documentElement).appendChild(o)})}function db(e,t,n={}){if(typeof e.loadModule=="function")return e.loadModule(Nr,Zi);const r=cb(Nr,Zi),o=Qi.get(r);if(o)return o;const i=n.timeoutMs??sb,s=es(),a=s[r]?Promise.resolve(s[r]):(async()=>{const c=`${t.replace(/\/$/,"")}/functions/v1/glue?module=${Nr}&v=${Zi}${ia(Nr)}`;return await ub(c,i),lb(r,i)})();return Qi.set(r,a),a.catch(()=>Qi.delete(r)),a}const Nu="glue_survey_sample";function fb(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function gb(e,t,n){const r=typeof t=="number"&&t>=0&&t<=1?t:1;if(r>=1)return!0;if(r<=0)return!1;const o=mb();if(o&&o.v===n)return o.sampled;const i=fb("surveys:"+e)/4294967295<r;try{F(Nu,JSON.stringify({v:n,sampled:i}))}catch{}return i}function mb(){try{const e=B(Nu);return e?JSON.parse(e):null}catch{return null}}const pb="glue_survey_session_shown";function _b(){const e=B(pb),t=e?parseInt(e,10):0;return Number.isFinite(t)?t:0}re({name:"surveys",feature:"surveys",init(e){if(typeof window>"u"||typeof document>"u"||!e.features.surveys)return;const t=e.config||{},n=typeof t.max_per_session=="number"?t.max_per_session:1,r="[data-glue-form], [data-glue-form-id]",o=n<=0||_b()>=n,i=window.__glueConfig||{},s=i.workspaceId,a=i.supabaseUrl;if(!s||!a)return;const c=Sn(),l=String(i.tracking?.config_version||"unversioned");if(!gb(c.session_id,typeof t.sample_rate=="number"?t.sample_rate:1,l))return;const u=h("glue_user_id")||"";if(!u)return;let d=!1,g=null,f=!1,m=null;const y=()=>{f||d||(f=!0,db(e,a).then(b=>{d||(g=b.start({features:e.features,config:t,track:e.track,onEvent:e.onEvent,onNavigate:e.onNavigate,onLeave:e.onLeave,route:e.route,log:e.log,workspaceId:s,glueUserId:u,sessionId:c.session_id,supabaseUrl:a,flag:p=>{const v=window.glue?.flags;if(!v)return null;const E=v.getAllFlags()[p]??!1,T=v.getFlagDetails(p);return[E,T&&T.value===E?T.payload:null]},exposeFlag:p=>{window.glue?.flags?.getFeatureFlag(p)},glue:{glue_user_id:u,session_id:c.session_id,utm:c.utm||{},tracking:c.tracking||{}}}))}).catch(b=>e.log.warn("surveys: module load failed:",b)))};return!o||document.querySelector(r)?y():document.documentElement&&(m=new MutationObserver(()=>{document.querySelector(r)&&(m?.disconnect(),m=null,y())}),m.observe(document.documentElement,{childList:!0,subtree:!0})),()=>{d=!0,m?.disconnect(),g&&g()}}});const Du="__dg_flag",Pu="__dg_variant",Fu=e=>e===Du||e===Pu,hb=/^[a-z0-9][a-z0-9_-]{0,31}$/,ts=e=>typeof e=="string"&&e&&e.length<=64?e:void 0;function Uu(){try{const e=globalThis.__glueConfig?.edge,t=e?.labels,n=Array.isArray(t?.networks)?t.networks.filter(i=>typeof i=="string"&&hb.test(i)).slice(0,20):[],r=e?.geo,o=r&&typeof r=="object"?{country_code:ts(r.country_code),region:ts(r.region),city:ts(r.city)}:null;return{team:t?.team===!0,networks:n,geo:o}}catch{return{team:!1,networks:[],geo:null}}}const yb=0xfffffffffffffffn;function wb(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e);const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r>=55296&&r<56320&&n+1<e.length?(r=65536+(r-55296<<10)+(e.charCodeAt(++n)-56320),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)):t.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(t)}function bb(e){const t=wb(e),n=t.length,r=(n+8>>6<<4)+16,o=new Uint32Array(r);for(let f=0;f<n;f++)o[f>>2]|=t[f]<<24-f%4*8;o[n>>2]|=128<<24-n%4*8,o[r-1]=n*8>>>0,o[r-2]=Math.floor(n*8/4294967296);let i=1732584193,s=4023233417,a=2562383102,c=271733878,l=3285377520;const u=new Uint32Array(80),d=(f,m)=>f<<m|f>>>32-m;for(let f=0;f<r;f+=16){for(let E=0;E<16;E++)u[E]=o[f+E];for(let E=16;E<80;E++)u[E]=d(u[E-3]^u[E-8]^u[E-14]^u[E-16],1);let m=i,y=s,b=a,p=c,v=l;for(let E=0;E<80;E++){let T,A;E<20?(T=y&b|~y&p,A=1518500249):E<40?(T=y^b^p,A=1859775393):E<60?(T=y&b|y&p|b&p,A=2400959708):(T=y^b^p,A=3395469782);const S=d(m,5)+T+v+A+u[E]>>>0;v=p,p=b,b=d(y,30)>>>0,y=m,m=S}i=i+m>>>0,s=s+y>>>0,a=a+b>>>0,c=c+p>>>0,l=l+v>>>0}const g=new Uint8Array(20);for(const[f,m]of[i,s,a,c,l].entries())g[f*4]=m>>>24,g[f*4+1]=m>>>16&255,g[f*4+2]=m>>>8&255,g[f*4+3]=m&255;return g}function ju(e,t,n=""){const r=bb(`${e}${t}${n}`);let o=0n;for(let i=0;i<8;i++)o=o<<8n|BigInt(r[i]);return o>>=4n,Number(o)/Number(yb)}function vb(e,t){if(t in e)return e[t];const n=t.split(".");let r=e;for(const o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}const kt=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null},ns=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null},te=e=>String(e??"").toLowerCase(),Bt=e=>Array.isArray(e)?e:e==null?[]:[e];function Sb(e,t){if(e.type==="segment"||e.key==="segment"){const o=new Set(t.segments??[]),s=Bt(e.value).map(String).some(a=>o.has(a));return e.operator==="is_not"||e.operator==="not_in"?!s:s}const n=vb(t.properties,e.key),r=e.value;if(Array.isArray(n)&&/^(exact|in|is_not|not_in|is_set|is_not_set)$/.test(e.operator)){const o=Bt(r).map(te),i=e.operator.endsWith("set")?n.length>0:n.some(s=>o.includes(te(s)));return e.operator==="exact"||e.operator==="in"||e.operator==="is_set"?i:!i}switch(e.operator){case"is_set":return n!=null&&n!=="";case"is_not_set":return n==null||n==="";case"exact":case"in":return n==null?!1:Bt(r).some(o=>te(o)===te(n));case"is_not":case"not_in":return n==null?!0:!Bt(r).some(o=>te(o)===te(n));case"icontains":return n!=null&&te(n).includes(te(r));case"not_icontains":return!(n!=null&&te(n).includes(te(r)));case"starts_with":return n!=null&&te(n).startsWith(te(r));case"not_starts_with":return!(n!=null&&te(n).startsWith(te(r)));case"ends_with":return n!=null&&te(n).endsWith(te(r));case"not_ends_with":return!(n!=null&&te(n).endsWith(te(r)));case"regex":case"not_regex":{if(n==null)return e.operator==="not_regex";let o=!1;try{o=new RegExp(String(r)).test(String(n))}catch{o=!1}return e.operator==="regex"?o:!o}case"gt":case"gte":case"lt":case"lte":{const o=kt(n),i=kt(r);return o===null||i===null?!1:e.operator==="gt"?o>i:e.operator==="gte"?o>=i:e.operator==="lt"?o<i:o<=i}case"between":case"not_between":{const o=kt(n),[i,s]=Bt(r).map(kt);if(o===null||i===null||s===null)return!1;const a=o>=i&&o<=s;return e.operator==="between"?a:!a}case"is_date_before":case"is_date_after":{const o=ns(n),i=ns(r);return o===null||i===null?!1:e.operator==="is_date_before"?o<i:o>i}default:return!1}}function Eb(e){const t=[];let n=0;for(const r of e){const o=Math.max(0,Number(r.rollout_percentage)||0)/100;t.push({key:r.key,min:n,max:n+o}),n+=o}return t}function kb(e,t){if(!e.variants.length)return null;const n=ju(`${e.key}.`,t,"variant");for(const r of Eb(e.variants))if(n>=r.min&&n<r.max)return e.variants.find(o=>o.key===r.key)??null;return null}const Ab=[{properties:[],rollout_percentage:100}];function qu(e,t,n){const r=t.length?t:Ab;for(const[o,i]of r.entries()){if(!i.properties.every(a=>Sb(a,n)))continue;const s=Math.min(100,Math.max(0,Number(i.rollout_percentage)||0));if(!(s<100&&ju(`${e}.`,n.identifier,"")>s/100))return{cond:i,index:o}}return null}const Tb=new Set(["exact","is_not","icontains","not_icontains","starts_with","not_starts_with","ends_with","not_ends_with","regex","not_regex","gt","gte","lt","lte","between","not_between","is_set","is_not_set","is_date_before","is_date_after","in","not_in"]),rs=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function Cb(e){if(!rs(e)||typeof e.key!="string"||!e.key)return"every filter needs a property";const t=e.operator;if(typeof t!="string"||!Tb.has(t))return`unknown operator "${String(t)}"`;if(e.type!==void 0&&e.type!==null&&e.type!=="property"&&e.type!=="segment")return`unknown filter type "${String(e.type)}"`;if(t==="is_set"||t==="is_not_set")return"";if(e.value===void 0||e.value===null)return`"${e.key}" needs a value`;if(t==="regex"||t==="not_regex")try{new RegExp(String(e.value))}catch{return`"${e.key}" has an invalid regex`}if((t==="gt"||t==="gte"||t==="lt"||t==="lte")&&kt(e.value)===null)return`"${e.key}" needs a number`;if(t==="between"||t==="not_between"){const n=Bt(e.value);if(n.length!==2||n.some(r=>kt(r)===null))return`"${e.key}" needs two numbers`}return(t==="is_date_before"||t==="is_date_after")&&ns(e.value)===null?`"${e.key}" needs a date`:""}function Ib(e){if(!rs(e)||typeof e.key!="string"||!e.key)return"holdout key required";if(!Array.isArray(e.release_conditions))return"conditions must be a list";for(const[t,n]of e.release_conditions.entries()){if(!rs(n)||!Array.isArray(n.properties))return`condition ${t+1}: properties must be a list`;const r=kt(n.rollout_percentage);if(r===null||r<0||r>100)return`condition ${t+1}: rollout must be 0–100`;for(const o of n.properties){const i=Cb(o);if(i)return`condition ${t+1}: ${i}`}}return""}function xb(e,t){if(e==null)return!1;try{return Ib(e)?!0:qu(e.key,e.release_conditions,t)!==null}catch{return!0}}function Ob(e,t){const n={key:e.key,value:!1,variant:null,payload:null,reason:"inactive",condition_index:null,experiment_id:e.experiment_id??null};if(!e.active)return n;if(xb(e.holdout,t)){const c=e.variants.find(l=>l.key==="control");return{...n,value:c?c.key:!1,payload:c?.payload??null,reason:"holdout"}}const r=t.persisted?.[e.key];if(e.ensure_experience_continuity&&r){const c=e.variants.find(l=>l.key===r&&Number(l.rollout_percentage)>0)??null;if(c||r==="true"&&!e.variants.length)return{...n,value:c?c.key:!0,variant:c?.key??null,payload:c?.payload??e.payload??null,reason:"persisted"}}const o=qu(e.key,e.release_conditions,t);if(!o)return{...n,reason:"no_condition_match"};const{cond:i,index:s}=o;if(i.variant){const c=e.variants.find(l=>l.key===i.variant)??null;if(c)return{...n,value:c.key,variant:c.key,payload:c.payload??null,reason:"variant_override",condition_index:s}}const a=kb(e,t.identifier);return e.variants.length&&!a?{...n,reason:"no_condition_match",condition_index:s}:{...n,value:a?a.key:!0,variant:a?.key??null,payload:a?.payload??e.payload??null,reason:"condition_rollout",condition_index:s}}function Hu(e,t){const n={};for(const r of e)n[r.key]=Ob(r,t);return n}const Lb=/^(script|style|iframe|frame|frameset|object|embed|base|meta|link|template|noscript|svg|math)$/i,He="form,iframe,input,select,textarea,button[type=submit],.ikit-native-booking,[data-lead-form],[data-report-gate],[data-fillout-id],[data-glue-survey-host],[data-dg-protect]",Mb=["class",...Array.from(He.matchAll(/\[([\w-]+)/g),e=>e[1])],Rb=/^(href|src|alt|title|placeholder|value|class|id|target|rel|width|height|aria-[a-z]+)$/i;function $b(e){try{return/^https?:$/.test(new URL(e,"https://x.invalid/").protocol)}catch{return!1}}function Bu(e){if(!e||typeof e.selector!="string"||!e.selector.trim()||e.selector.length>1e3||/[{};@]/.test(e.selector))return"selector";if(e.html!=null)return"html";if(e.text!=null&&typeof e.text!="string")return"text";if(e.fingerprint!=null&&(typeof e.fingerprint!="string"||e.fingerprint.length>300))return"fingerprint";for(const[t,n]of Object.entries(e.attributes??{})){if(!Rb.test(t))return`attr:${t}`;if(typeof n!="string"||/^(href|src)$/i.test(t)&&!$b(n))return`value:${t}`}if(e.css!=null&&(typeof e.css!="string"||/url\s*\(|expression\s*\(|@import|javascript:|behavior|binding|[<>\\]/i.test(e.css)))return"css";try{e.path!=null&&new RegExp(String(e.path))}catch{return"path"}return""}const os="glue_flag_assignments",zu="glue_flag_overrides",is="glue_flag_properties",ss="glue_flag_bucket",Nb="$feature_flag_called",Vu=200,Wu=200;function qn(e,t,n=!1){try{const r=n?B(e):h(e);if(!r)return t;const o=JSON.parse(r);return o&&typeof o=="object"?o:t}catch{return t}}function as(e,t,n=!1){try{const r=JSON.stringify(t);n?F(e,r):k(e,r)}catch{}}function Gu(e){const t={};for(const n of["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"]){const r=h(`${e}${n}`);r&&(t[n]=r)}return t}function Ku(e,t=!0){const n=Gu("glue_last_"),r=Gu("glue_initial_"),o=h("glue_user_geolocation")||"",[i="",s="",a=""]=o.split("|").map(y=>y.trim()),c=Uu(),l=t&&c.geo||{},u=h("glue_email")||"",d={};for(const y of["gclid","gbraid","wbraid","fbclid","ttclid","msclkid"]){const b=h(`glue_last_${y}`);b&&(d[y]=b)}const g=new Date,f=typeof location<"u"?location:{},m=typeof navigator<"u"?navigator:{};return{...n,...Object.fromEntries(Object.entries(r).map(([y,b])=>[`initial_${y}`,b])),...d,referrer:h("glue_user_referrer")||(typeof document<"u"?document.referrer:""),landing_url:h("glue_url_first")||"",url:{href:f.href,path:f.pathname,host:f.hostname,search:f.search,hash:f.hash},geo:l.country_code?{country_code:l.country_code,country:l.country_code===i?s:"",city:l.city||(l.country_code===i?a:""),region:l.region||""}:{country_code:i,country:s,city:a,region:""},email:u,email_domain:u.includes("@")?u.split("@").pop():"",identified:!!u,device:{user_agent:m.userAgent||"",language:m.language||"",mobile:typeof window<"u"?window.innerWidth<768:!1,viewport_width:typeof window<"u"?window.innerWidth:0},returning:!!h("glue_url_first")&&h("glue_url_first")!==f.href,hour:g.getHours(),weekday:g.getDay(),...Object.fromEntries(Object.entries(e).filter(([y])=>y[0]!=="$")),$team:c.team,$network:c.networks}}const fe=new Map;let Ju,cs=0,Dr=!1;function Xu(e){for(const[,t]of e.reverse())try{t()}catch{}}function Hn(e){const t=fe.get(e);fe.delete(e),t&&Xu(t.undo),ls()||(At?.disconnect(),At=void 0)}function ls(){for(const e of fe.values())for(const t of e.done.values())if(t.size)return!0;return!1}function Db(){for(const e of fe.values()){for(const t of e.done.keys())t.isConnected||e.done.delete(t);e.undo=e.undo.filter(([t])=>t.isConnected)}ls()||(At?.disconnect(),At=void 0)}function us(){cs++;for(const e of Array.from(fe.keys()))Hn(e)}function ds(e,t){if(!e)return!0;try{return new RegExp(e).test(t)}catch{return!1}}function Yu(e){return e.namespaceURI==="http://www.w3.org/1999/xhtml"&&!Lb.test(e.tagName)&&!e.closest(`svg,math,${He}`)&&!e.querySelector(He)}function Pb(e,t){if(typeof t.text=="string"&&e.textContent!==t.text)return!1;for(const[n,r]of Object.entries(t.attributes??{}))if(e.getAttribute(n)!==r)return!1;if(typeof t.css=="string"){const n=document.createElement("i").style;n.cssText=t.css;for(let r=0;r<n.length;r++)if(e.style.getPropertyValue(n[r])!==n.getPropertyValue(n[r]))return!1}return!0}function Zu(e,t,n,r){const o=fe.get(e);o&&(o.variant!==t||o.t!==n&&JSON.stringify(o.t)!==JSON.stringify(n))&&Hn(e);const i=location.pathname,s=[],a=new Map;for(const[d,g]of n.entries()){if(Bu(g))return!1;if(!ds(g.path,i))continue;let f;try{f=Array.from(document.querySelectorAll(g.selector)).slice(0,50)}catch{return!1}const m=new Set([typeof g.text=="string"?"t":"",...Object.keys(g.attributes??{}).map(y=>`a${y.toLowerCase()}`),...(g.css??"").split(";").map(y=>`c${y.split(":")[0].trim().toLowerCase()}`)].filter(y=>y.length>1||y=="t"));for(const y of f){if(!Yu(y))return!1;for(const[p,v]of fe)if(p!==e&&v.done.get(y)?.size)return!1;const b=a.get(y)??new Set;for(const p of m){if(b.has(p))return!1;b.add(p)}a.set(y,b),s.push([y,g,d])}}const c=fe.get(e)??{variant:t,t:n,undo:[],done:new Map};fe.set(e,c);const l=c.undo.length,u=[];try{for(const[d,g,f]of s){const m=c.done.get(d)??new Set;if(c.done.set(d,m),!(m.has(f)&&!(r&&!Pb(d,g)))){if(typeof g.text=="string"){const y=Array.from(d.childNodes),b=g.text,p=document.createTextNode(b);d.replaceChildren(p),c.undo.push([d,()=>{p.parentNode===d&&p.data===b&&p.replaceWith(...y.filter(v=>!v.parentNode))}])}for(const[y,b]of Object.entries(g.attributes??{})){const p=d.getAttribute(y);c.undo.push([d,()=>{d.getAttribute(y)===b&&(p===null?d.removeAttribute(y):d.setAttribute(y,p))}]),d.setAttribute(y,b)}if(typeof g.css=="string"){const y=d.style,b=document.createElement("i").style;b.cssText=g.css;for(let p=0;p<b.length;p++){const v=b[p],E=y.getPropertyValue(v),T=y.getPropertyPriority(v);y.setProperty(v,b.getPropertyValue(v),b.getPropertyPriority(v));const A=y.getPropertyValue(v),S=y.getPropertyPriority(v);c.undo.push([d,()=>{y.getPropertyValue(v)!==A||y.getPropertyPriority(v)!==S||(E?y.setProperty(v,E,T):y.removeProperty(v))}])}}m.add(f),u.push([m,f])}}return!0}catch{Xu(c.undo.splice(l));for(const[d,g]of u)d.delete(g);return!1}}function fs(e,t){return e.variants.some(n=>n.redirect_url||(n.transforms??[]).some(r=>ds(r?.path,t)))}const gs="glue-flags-hide";let Qu,nt,At;const Fb=`:not(${He},${He.replace(/,/g," *,")} *):not(:has(${He}))`,Pr=e=>{try{return document.querySelector(e),!0}catch{return!1}};function zt(){clearTimeout(Qu);try{document.getElementById(gs)?.remove()}catch{}}function Ub(e){try{let t="";for(const r of ms(e))for(const o of r.variants)for(const i of o.transforms??[]){if(Bu(i)||!ds(i.path,location.pathname))continue;const s=`:is(${i.selector})${Fb}`;Pr(i.selector)&&!Pr(`${i.selector})`)&&!Pr(`${i.selector}]`)&&Pr(s)&&(t+=`${s}{opacity:0!important}`)}if(!t||Dr||document.getElementById(gs))return;const n=document.createElement("style");n.id=gs,n.textContent=t,(document.head||document.documentElement).appendChild(n),Qu=setTimeout(zt,800)}catch{zt()}}function ed(){if(zt(),td(),nt||!fe.size||typeof MutationObserver>"u")return;let e=50;const t=()=>{nt?.disconnect(),nt=void 0};nt=new MutationObserver(()=>{for(const[r,o]of fe){const i=o.undo.length;if(!Zu(r,o.variant,o.t,!0)){Hn(r),Bn?.(r);continue}if(o.undo.length>i&&--e<0)return t()}td(),nt?.takeRecords()}),nt.observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),setTimeout(t,2e3);const n=()=>{window.requestIdleCallback?.(t)};document.readyState=="complete"?n():addEventListener("load",n,{once:!0})}function td(){At||!ls()||typeof MutationObserver>"u"||(At=new MutationObserver(e=>{const t=new Set,n=[];let r=!1;for(const o of e)if(o.type=="attributes")o.target.matches(He)&&n.push(o.target);else{r||(r=o.removedNodes.length>0);for(const i of Array.from(o.addedNodes))i.nodeType==1&&i.isConnected&&t.add(i)}for(const o of t){let i=o.parentElement;for(;i&&!t.has(i);)i=i.parentElement;!i&&(o.closest(He)||o.querySelector(He))&&n.push(o)}for(const o of n)for(const[i,s]of fe)for(const a of s.done.keys())if((a.contains(o)||o.contains(a))&&!Yu(a)){Hn(i),Bn?.(i);break}r&&Db()}),At.observe(document.documentElement,{childList:!0,subtree:!0,attributeFilter:Mb}))}let Fr,Bn;function jb(){return Dr=!0,nt?.disconnect(),nt=void 0,us(),zt(),()=>{Dr=!1,Fr?.()}}ca.pauseWebTests=jb;function nd(e,t,n,r){if(Dr||typeof location>"u")return!1;for(const o of e){const i=t[o.key];if(i===!1||i===void 0||!fs(o,location.pathname))continue;const s=o.variants.find(a=>a.key===i);if(s){if(s.redirect_url)try{const a=new URL(s.redirect_url,location.href),c=a.origin+a.pathname===location.origin+location.pathname&&(!a.search||a.search===location.search);if(/^https?:$/.test(a.protocol)&&!c)return n(o.key),!a.search&&location.search&&(a.search=location.search),location.replace(a.href),!0}catch{}Zu(o.key,s.key,s.transforms??[])?n(o.key):r(o.key)}}return!1}function ms(e){return Array.isArray(e?.definitions)?e.definitions.filter(t=>t&&typeof t.key=="string"&&Array.isArray(t.variants)):[]}function ps(e){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e())}let rd=!1;function qb(){if(rd)return!0;try{return oa().enabled||window.sessionStorage?.getItem(ho)==="1"}catch{return!1}}function od(e){let t="";try{t=location.search}catch{return null}if(!t.includes("__dg_"))return null;const n=new URLSearchParams(t),r=n.get(Du),o=n.get(Pu);return r===null&&o===null?null:r&&o&&r.length<=Wu&&o.length<=Wu&&e.some(i=>i.key===r&&i.variants.some(s=>s.key===o))?{flag:r,variant:o}:(I.log("flags: preview link ignored: it needs both params, each at most 200 characters, naming a live flag on this page and one of its variants"),null)}function Hb(e,t){if(!t)return zt();try{const n=ms(e);if(!n.some(l=>fs(l,location.pathname)))return;let r=h(ss)||h("glue_user_id");r||(r=`fb_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,k(ss,r));const o=qn(is,{}),i=Hu(n,{identifier:r,properties:Ku(o,!1),persisted:qn(os,{})}),s={};for(const[l,u]of Object.entries(i))s[l]=u.value;const a=od(n);a&&i[a.flag]?.reason!=="holdout"&&(s[a.flag]=a.variant);const c=cs;ps(()=>{c===cs&&!nd(n,s,()=>{},()=>{})&&ed()})}catch{zt()}}try{const e=window.__glueConfig?.tracking;e?.features?.flags===!0&&e.features.capture_all!==!1&&Ub(e.featureConfig?.flags)}catch{}re({name:"flags",feature:"flags",init(e){const t=ms(e.config),n=new Set;let r=qn(zu,{},!0),o=qn(is,{}),i=qn(os,{}),s={},a={},c=new Set,l=new Set,u=!1;clearTimeout(Ju);const d=_=>t.find(L=>L.key===_)?.variants.some(L=>L.key==="control")?"control":!1,g=()=>h(ss)||e.ids().glue_user_id,f=()=>{const _={identifier:g(),properties:Ku(o),segments:Array.isArray(o.segments)?o.segments:[],persisted:i};s=Hu(t,_),a={};let L=!1;for(const[M,N]of Object.entries(s))if(a[M]=l.has(M)?d(M):M in r&&N.reason!=="holdout"?r[M]:N.value,N.value!==!1&&N.reason!=="holdout"){const w=typeof N.value=="string"?N.value:"true";i[M]!==w&&(i[M]=w,L=!0)}if(L){const M=Object.keys(i);if(M.length>Vu)for(const N of M.slice(0,M.length-Vu))delete i[N];as(os,i)}for(const M of n)try{M({...a})}catch(N){e.log.warn("onFeatureFlags listener failed",N)}},m=_=>{const L=t.find(M=>M.key===_);return!!(L&&fs(L,location.pathname))},y=_=>{m(_)||b(_)},b=_=>{const L=a[_];if(L===void 0||L===!1||l.has(_)||s[_]?.reason==="holdout")return;const M=typeof L=="string"?L:"true",N=`${_}:${M}`;if(c.has(N))return;c.add(N);const w=t.find(R=>R.key===_),O=Uu();e.track(Nb,{flag_key:_,variant:M,experiment_id:w?.experiment_id??null,flag_version:w?.version??null,reason:_ in r?"override":s[_]?.reason??null,...qb()?{qa:!0}:{},...O.team?{team:!0}:{},...O.networks.length?{networks:O.networks}:{}})},p=_=>{r=_,as(zu,r,!0),c=new Set},v=()=>{const _=od(t);_&&(rd=!0,F(ho,"1"),r[_.flag]!==_.variant&&p({...r,[_.flag]:_.variant}))},E=_=>{l.add(_),a[_]=d(_),e.log.warn(`flags: ${_} change refused or failed; showing control`)},T=()=>{for(const[_,L]of fe)a[_]!==L.variant&&Hn(_);u||(u=nd(t,a,b,E)),u||ed()},A={getFeatureFlag:_=>{const L=a[_]??!1;return y(_),L},isFeatureEnabled:_=>A.getFeatureFlag(_)!==!1,getFeatureFlagPayload:_=>{const L=a[_];if(L===void 0||L===!1)return null;y(_);const M=s[_];if(M?.reason==="holdout")return M.payload??null;const N=t.find(O=>O.key===_);return N?.variants.find(O=>O.key===L)?.payload??N?.payload??null},getAllFlags:()=>({...a}),getBucketId:g,getFlagDetails:_=>s[_]??null,onFeatureFlags:_=>{n.add(_);try{_({...a})}catch{}return()=>n.delete(_)},overrideFeatureFlags:_=>{p(_===!1?{}:{..._}),f()},setProperties:_=>{o={...o,..._},as(is,o),f()},reload:()=>f()};v(),f(),ps(T),Fr=T,Bn=E;const S=window;if(S.glue&&typeof S.glue=="object"){S.glue.flags=A;for(const _ of["getFeatureFlag","isFeatureEnabled","getFeatureFlagPayload","onFeatureFlags","overrideFeatureFlags"])typeof S.glue[_]!="function"&&(S.glue[_]=(...L)=>S.glue.flags?.[_](...L))}const x=e.onNavigate(()=>{c=new Set,l=new Set,v(),f(),ps(T)});return e.log.log(`flags: ${t.length} definition(s), ${Object.values(a).filter(_=>_!==!1).length} on`),()=>{x(),n.clear(),Fr===T&&(Fr=void 0),Bn===E&&(Bn=void 0),S.glue&&S.glue.flags===A&&delete S.glue.flags,Ju=setTimeout(us,0)}}});const id="analytics";let _s=id;function Bb(e,t){const n=sn(e)??"full";return De(id,n)?!0:t()?(De(_s,n)||(_s=n),!0):!1}const zb=e=>!De(e,_s),Vb="tags",Wb="1",sd=()=>({required:Ca(),level:Ia()}),ad=50;re({name:"tags",feature:"tags",init(e){const t=e.config?.tags;if(!Array.isArray(t)||t.length===0)return;const n=e.config?.conversions;let r=[],o=null;if(n){const a=e.ids().page_view_id,c=sd(),l=mm();r=Ft().filter(u=>u?.properties?.page_view_id===a).slice(-ad/2).map(u=>({event:u,consent:Date.parse(u.timestamp)>l?c:{required:c.required,level:"none"}})),e.onEvent(u=>{const d=sd();o?o(u,d):r.length<ad&&r.push({event:u,consent:d})})}let i=!1,s=null;return e.loadModule(Vb,Wb).then(a=>{i||!a||typeof a.start!="function"||(s=a.start({tags:t,consent:{required:()=>Ca(),level:()=>Ia(),onChange:c=>_m(()=>c()),hold:c=>Bb(c,pm)},onNavigate:c=>e.onNavigate(()=>c()),conversions:n,onEvent:n?c=>{const l=r;r=[],o=c;for(const{event:u,consent:d}of l)c(u,d);return()=>{o=null}}:void 0,log:e.log}))}).catch(a=>e.log.warn("tags module failed to load:",a)),()=>{i=!0,s?.()}}});const Gb=1,cd=1,Kb=30*60*1e3;function hs(e){const t=3e3*2**e,n=t/2,r=Math.min(Kb,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}const Be=W("replay-sync"),ys="replay-1",ld="glue_replay_pending:",ud=8,Jb=1e6,Xb=6e4,dd=12;let ws=dd;const Yb=6e4,Zb=3,fd=15e3,Qb=5,gd=5*60*1e3,ev=49152,tv=4096;let Vt=null,rt=null,bs=!1,vs=null,md=!1,Ur=[],jr=0,Wt=!1,zn=ev;const ze={};let pd=0,qr=null;const nv=10;function Hr(e){return ld+e}function rv(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&n+1<e.length?(t+=4,n++):t+=3}return t}function Gt(){rt||(rt=[]);for(const e of ua(ld))try{const t=JSON.parse(h(e)||"null");if(!t||typeof t.chunk_id!="string"||!t.payload)continue;rt.some(n=>n.chunk_id===t.chunk_id)||rt.push(t)}catch{}return rt.sort((e,t)=>e.created_at-t.created_at)}function Br(e){k(Hr(e.chunk_id),JSON.stringify(e))}function _d(e){ie(Hr(e.chunk_id)),rt=(rt||[]).filter(t=>t.chunk_id!==e.chunk_id)}function Vn(e,t=1){ze[e]=(ze[e]||0)+t}function hd(e){return{workspace_id:e.workspace_id,hostname:Vt.hostname,glue_user_id:e.glue_user_id,session_id:e.session_id,window_id:e.window_id,recording_id:e.recording_id,schema_version:Gb,sdk:{version:ys,page_leave:!1},client_ts:Date.now(),url:ov()}}function ov(){if(typeof location>"u")return null;const e=String(location.href||""),t=e.indexOf("?"),n=e.indexOf("#"),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?e:e.slice(0,r)}function iv(){let e=1;try{const r=globalThis?.window?.__glueConfig?.tracking?.featureConfig?.session_recording?.sample_rate;typeof r=="number"&&isFinite(r)&&(e=r)}catch{}let t=!0;try{t=dr("session_recording",e,sv())}catch{t=!0}return{sample_rate:e,sampled:t}}function sv(){try{const e=globalThis?.window?.__glueConfig;return String(e?.tracking?.config_version||e?.config_version||"")}catch{return""}}function av(e,t){const n={},r=qa();r.storage&&Object.assign(n,r),t&&Object.keys(ze).length&&(n.drops={...ze}),Object.keys(n).length&&(e.meta=n)}function cv(){const e=Gt(),t=()=>e.reduce((n,r)=>n+r.bytes,0);for(;e.length>ud||e.length>0&&t()>Jb;){let n=e.findIndex(o=>o.status==="exhausted");n===-1&&(n=0);const[r]=e.splice(n,1);ie(Hr(r.chunk_id)),Vn("queue_full"),Be.warn(`replay pending capacity reached, dropped chunk ${r.chunk_id} (seq ${r.seq})`)}rt=e}function yd(){return`${Vt.supabaseUrl}/functions/v1/ingest-replay`}function lv(e,t,n){if(e===409)return"conflict";const r=e>=200&&e<300;return r&&t&&t.success===!0&&t.chunk_id===n&&(t.accepted===!0||t.duplicate===!0)?"delivered":t?.ledger==="unavailable"||t?.accepted===!1?"failed":r?"unknown":"failed"}function uv(e,t=Date.now()){if(!e)return null;const n=Number(e);if(Number.isFinite(n)&&n>=0)return Math.min(n*1e3,gd);const r=Date.parse(e);return Number.isNaN(r)?null:Math.min(Math.max(0,r-t),gd)}function dv(e=Date.now()){return Ur=Ur.filter(t=>e-t<Yb),Ur.length>=ws}function fv(){return ws}function wd(){try{const t=globalThis?.window?.__glueConfig?.tracking?.featureConfig?.session_recording?.budgets?.session_chunks_per_minute;if(typeof t=="number"&&isFinite(t)&&t>0)return Math.floor(t)}catch{}return dd}async function gv(e,t){let n=!1,r=null,o;const i=globalThis.AbortController;if(typeof i=="function"){const s=new i;o=s.signal,r=setTimeout(()=>{n=!0;try{s.abort()}catch{}},fd)}Ur.push(Date.now());try{const s=await fetch(yd(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:t,...o?{signal:o}:{}});let a=null;try{a=await s.json()}catch{a=null}const c=lv(s.status,a,e.chunk_id),l=uv(typeof s.headers?.get=="function"?s.headers.get("Retry-After"):null),u=typeof a?.next_expected_seq=="number"?a.next_expected_seq:null;return{ack:c,status:s.status,nextExpectedSeq:u,retryAfterMs:l,payloadTooLarge:s.status===413||a?.error==="payload_too_large",maxBytes:typeof a?.max_bytes=="number"?a.max_bytes:null}}catch(s){return n?Be.warn(`replay chunk request timed out after ${fd}ms`):Be.warn("replay chunk request failed:",s),{ack:"failed",status:0,nextExpectedSeq:null,retryAfterMs:null,payloadTooLarge:!1,maxBytes:null}}finally{r&&clearTimeout(r)}}function bd(){if(vs||typeof setTimeout!="function")return;let e=1/0;for(const t of Gt())t.status!=="pending"||t.next_at===null||t.next_at<e&&(e=t.next_at);isFinite(e)&&(vs=setTimeout(()=>{vs=null,zr()},Math.max(0,e-Date.now())))}function mv(e,t){if(t.ack==="delivered"){jr=0,t.nextExpectedSeq!==null&&t.nextExpectedSeq>e.seq+1&&(Be.warn(`replay gap: collector expects seq ${t.nextExpectedSeq}, we sent ${e.seq}`),Yo(t.nextExpectedSeq-1)),_d(e);return}if(t.ack==="conflict"){t.nextExpectedSeq!==null?Yo(t.nextExpectedSeq-1):Yo(e.seq),Vn("seq_conflict");const n=e.chunk_id,r=za();e.seq=r,e.chunk_id=se(),e.payload.chunk.seq=r,e.payload.chunk.chunk_id=e.chunk_id,e.attempt+=1,e.next_at=Date.now()+hs(e.attempt),ie(Hr(n)),Br(e),bd();return}if(t.payloadTooLarge){zn=Math.max(tv,Math.floor(zn/2)),Be.warn(`replay chunk too large, target halved to ${zn} bytes`),Vn("record_too_large"),_d(e);return}t.status===429?(jr+=1,jr>=Zb&&(Wt=!0,Vn("throttled"),Be.warn("replay upload paused for the rest of this session after repeated throttling"))):t.status!==0&&(jr=0),e.attempt+=1,e.attempt>=Qb?(e.status="exhausted",e.next_at=null):t.ack==="blind"?e.next_at=null:t.status===429?e.next_at=Date.now()+(t.retryAfterMs??hs(e.attempt)):t.status>=400&&t.status<500&&t.status!==408?(e.status="exhausted",e.next_at=null):e.next_at=Date.now()+hs(e.attempt-1),Br(e),bd()}function vd(e){Vt=e,ws=e.chunksPerMinute&&e.chunksPerMinute>0?Math.floor(e.chunksPerMinute):wd(),!md&&typeof window<"u"&&(md=!0,window.addEventListener("pagehide",()=>{pv()}),window.addEventListener("online",()=>{zr(!0)})),zr(!0)}function Ss(e){if(!Vt)return Be.warn("replay sync not initialized"),null;if(Wt)return Vn("throttled"),null;const t=_t();if(!t.recording_id)return Be.warn("replay chunk dropped: no open recording"),null;const n=se(),r=za(),o=typeof e.bytes=="number"&&e.bytes>=0?e.bytes:rv(typeof e.payload=="string"?e.payload:JSON.stringify(e.payload)),i=iv(),s={...hd(t),chunk:{chunk_id:n,seq:r,kind:e.kind,started_at:e.started_at,ended_at:e.ended_at??Date.now(),rel_start_ms:e.rel_start_ms??null,rel_end_ms:e.rel_end_ms??null,record_count:e.record_count??0,bytes:o,encoding:e.encoding??"json",checksum:e.checksum,payload:e.payload,sample_rate:i.sample_rate,sampled:i.sampled}};e.end&&(s.end=!0,s.end_reason=e.end_reason||"client_end",qr=t.recording_id),pd+=1,av(s,pd%nv===0||!!e.end);const a={chunk_id:n,recording_id:t.recording_id,seq:r,bytes:o,attempt:0,status:"pending",created_at:Date.now(),next_at:Date.now(),payload:s};return Gt().push(a),Br(a),cv(),zr(),a}async function zr(e=!1){if(!(!Vt||bs||Wt)){bs=!0;try{const t=Date.now();for(const n of Gt().slice())if(n.status==="pending"&&!(!e&&(n.next_at===null||n.next_at>t))){if(dv()){Be.log("replay upload paced: client rate budget reached");break}if(mv(n,await gv(n,!1)),Wt)break}}finally{bs=!1}}}function pv(){if(!Vt||Wt)return;let e=Lp-Op();const t=_t();function n(s){return s.length>Xb||s.length>e||typeof navigator>"u"||typeof navigator.sendBeacon!="function"||!navigator.sendBeacon(yd(),new Blob([s],{type:"application/json"}))?!1:(e-=s.length,!0)}const r=Gt().slice().reverse(),o=!!t.recording_id&&qr!==t.recording_id;let i=!1;for(const s of r){if(s.status!=="pending")continue;const a=o&&!i,c=JSON.stringify({...s.payload,sdk:{version:ys,page_leave:!0},...a?{end:!0,end_reason:"page_leave",meta:{...s.payload.meta||{},...Object.keys(ze).length?{drops:{...ze}}:{}}}:{}});try{if(!n(c))continue}catch{return}a&&(i=!0,qr=t.recording_id),s.attempt+=1,s.next_at=null,Br(s)}if(o&&!i){const s=JSON.stringify({...hd(t),sdk:{version:ys,page_leave:!0},end:!0,end_reason:"page_leave",meta:Object.keys(ze).length?{drops:{...ze}}:void 0});try{n(s)&&(qr=t.recording_id)}catch{}}}function _v(){return zn}function Sd(){const e=Gt(),t=e.filter(n=>n.status==="pending");return{pending:t.length,exhausted:e.length-t.length,bytes_pending:t.reduce((n,r)=>n+r.bytes,0),paused:Wt,chunk_target_bytes:zn,drops:{...ze}}}const hv={chunk_bytes:49152,flush_ms:5e3,max_duration_ms:36e5,max_bytes:12582912,snapshot_interval_ms:3e5,idle_flush_ms:3e4,max_chunks:900,snapshot_bytes:2097152,max_body_bytes:524288,beacon_bytes:6e4,idle_ms:3e5,max_record_bytes:943718,compress_min_bytes:0,compress_max_bytes:524288},yv={sample_rate:.2};function ue(e,t,n,r){const o=typeof e=="number"?e:Number(e);return Number.isFinite(o)?Math.min(r,Math.max(n,Math.floor(o))):t}function Vr(e,t=50){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(typeof r!="string")continue;const o=r.trim();if(o&&n.push(o.slice(0,300)),n.length>=t)break}return n}function wv(e){const t=e?.inputs;return{inputs:t==="sensitive"||t==="none"?t:"all",selectors:Vr(e?.selectors),unmask_selectors:Vr(e?.unmask_selectors)}}function bv(e){const t=hv;return{chunk_bytes:ue(e?.chunk_bytes,t.chunk_bytes,4096,262144),flush_ms:ue(e?.flush_ms,t.flush_ms,500,6e4),idle_flush_ms:ue(e?.idle_flush_ms,t.idle_flush_ms,1e3,3e5),max_duration_ms:ue(e?.max_duration_ms,t.max_duration_ms,3e4,36e5),max_bytes:ue(e?.max_bytes,t.max_bytes,65536,12582912),max_chunks:ue(e?.max_chunks,t.max_chunks,4,900),snapshot_interval_ms:ue(e?.snapshot_interval_ms,t.snapshot_interval_ms,3e4,18e5),snapshot_bytes:ue(e?.snapshot_bytes,t.snapshot_bytes,65536,8388608),idle_ms:ue(e?.idle_ms,t.idle_ms,5e3,18e5),max_record_bytes:ue(e?.max_record_bytes,t.max_record_bytes,16384,4194304),max_body_bytes:ue(e?.max_body_bytes,t.max_body_bytes,65536,524288),beacon_bytes:ue(e?.beacon_bytes,t.beacon_bytes,4096,6e4),compress_min_bytes:ue(e?.compress_min_bytes,t.compress_min_bytes,0,262144),compress_max_bytes:ue(e?.compress_max_bytes,t.compress_max_bytes,4096,4194304)}}function vv(e){const t=e&&typeof e=="object"?e:{},n=typeof t.sample_rate=="number"?t.sample_rate:Number(t.sample_rate);return{sample_rate:Number.isFinite(n)?Math.min(1,Math.max(0,n)):yv.sample_rate,url_allow:Vr(t.url_allow),url_deny:Vr(t.url_deny),mask:wv(t.mask),budgets:bv(t.budgets),capture_canvas:t.capture_canvas===!0,capture_iframes:t.capture_iframes==="all"?"all":t.capture_iframes==="none"?"none":"same_origin"}}const Ed="recorder",Es="1",Sv="session_recording",kd="session_replay",ks=new Map;function Ev(e){if(ks.has(e))return ks.get(e);let t=null;try{const n=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");t=new RegExp("^"+n+"$","i")}catch{t=null}return ks.set(e,t),t}function kv(e){try{const t=new URL(e);return t.origin+t.pathname}catch{return""}}function Ad(e,t){for(const n of t){const r=Ev(n);if(r&&r.test(e))return!0}return!1}function Av(e,t=[],n=[]){const r=kv(e);return!(!r||n.length&&Ad(r,n)||t.length&&!Ad(r,t))}const Td=`${Ed}@${Es}`;function Wr(){return typeof window>"u"?null:window}function Tv(e){if(typeof window>"u")return;const t=vv(e.config);if(!cn(kd)){e.log.log("replay: not allowed by privacy settings");return}if(!Av(window.location.href,t.url_allow,t.url_deny)){e.log.log("replay: url excluded by workspace rules");return}if(!e.sampled()){e.log.log("replay: session not sampled");return}if(!Cv(e))return;let n=null,r=!1;return Iv(e).then(o=>{if(r||!o)return;if(o.version!==Es){e.log.warn(`replay: recorder module version mismatch (${o.version})`);return}n=o.create({config:t,host:{ids:()=>e.ids(),enqueue:Ss,chunkTargetBytes:_v,onSessionRotated:Wa,storage:{get:B,set:F,remove:Mt},recording:{getId:mn,setId:Xo,peekSeq:Va}},hostname:window.location.hostname,log:e.log,isAllowed:()=>cn(kd),storageMode:ja()==="memory"?"memory":"full",onStopped:s=>{r||s!=="max_duration"&&s!=="session_rotated"||setTimeout(()=>{r||n?.start()},0)}}),n.start(),e.onCleanup(e.onNavigate(()=>n?.notifyNavigate())),e.onCleanup(e.onLeave(s=>n?.notifyLeave(s)));const i=Wr();i&&(i.glueReplay={start:()=>n?.start(),stop:s=>n?.stop(s??"manual"),pause:()=>n?.pause(),resume:()=>n?.resume(),flush:()=>n?.flush(),status:()=>n?.status()??{state:"idle"}})}).catch(o=>e.log.warn("replay: recorder module failed to load:",o)),()=>{r=!0;const o=Wr();o&&o.glueReplay&&delete o.glueReplay,n?.stop("feature_disabled"),n=null}}function Cv(e){const t=Wr()?.__glueConfig?.supabaseUrl;return t?(vd({supabaseUrl:String(t),hostname:typeof location<"u"?location.hostname:""}),fr(),!0):(e.log.warn("replay: no supabaseUrl in __glueConfig; recorder not started"),!1)}async function Iv(e){const t=Wr(),n=t?.__glueModules?.[Td];return n||(await e.loadModule(Ed,Es)??t?.__glueModules?.[Td]??null)}re({name:"sessionRecording",feature:Sv,init:Tv});const xv=4,As=500,Ts=20,Ov=20,Lv=4096;function Gr(e,t){return e.length>t?`${e.slice(0,t)}…[+${e.length-t} chars]`:e}function Mv(e){return typeof Node<"u"&&e instanceof Node}function Rv(e){try{const t=String(e.tagName||e.nodeName||"node").toLowerCase(),n=e.id?`#${e.id}`:"";return`[DOMNode <${t}${n}>]`}catch{return"[DOMNode]"}}function Cs(e,t,n){if(e==null)return e;const r=typeof e;if(r==="string")return Gr(e,As);if(r==="number"||r==="boolean")return e;if(r==="bigint")return`${e}n`;if(r==="function")return`[Function: ${e.name||"anonymous"}]`;if(r==="symbol")return String(e);if(e instanceof Error)return{__type:"Error",name:e.name,message:Gr(String(e.message??""),As)};if(Mv(e))return Rv(e);if(r!=="object")return String(e);const o=e;if(n.has(o))return"[Circular]";if(t>=xv)return Array.isArray(o)?"[Array]":"[Object]";n.add(o);try{if(Array.isArray(o)){const c=o.slice(0,Ts).map(l=>Cs(l,t+1,n));return o.length>Ts&&c.push(`…[+${o.length-Ts} more]`),c}let i;try{i=Object.keys(o)}catch{return"[Unserializable]"}const s={};let a=0;for(const c of i){if(a>=Ov){s["…"]=`+${i.length-a} more`;break}let l;try{l=Object.getOwnPropertyDescriptor(o,c)}catch{s[c]="[Unreadable]",a++;continue}if(l&&(l.get||l.set)&&!("value"in l)){s[c]="[Getter]",a++;continue}let u;try{u=o[c]}catch{s[c]="[Unreadable]",a++;continue}s[c]=Cs(u,t+1,n),a++}return s}finally{n.delete(o)}}function $v(e){try{const t=JSON.stringify(e);return t?t.length:0}catch{return 1/0}}function Cd(e,t=Lv){const n=Cs(e,0,new WeakSet),r=$v(n);return r<=t?n:{__truncated:!0,approx_bytes:r}}function Nv(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${Gr(String(e.message??""),As)}`;if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="object")try{return JSON.stringify(Cd(e))}catch{return"[Unserializable]"}return String(e)}function Id(e,t=2e3){const n=e.map(Nv).join(" ");return Gr(n,t)}const xd=/^\s*at .*(\S+:\d+|\(native\))/m,Dv=/^(eval@)?(\[native code])?$/;function Od(e){if(e.indexOf(":")===-1)return[e,void 0,void 0];const n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return n?[n[1],n[2]?Number(n[2]):void 0,n[3]?Number(n[3]):void 0]:[e,void 0,void 0]}function Pv(e){return e.split(`
`).filter(n=>!!n.match(xd)).map(n=>{let r=n;r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let o=r.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=o.match(/ (\((.+):(\d+):(\d+)\)$)/);o=i?o.replace(i[0],""):o;const s=o.split(/\s+/).slice(1),[a,c,l]=Od(i?i[1]:s.pop()??"");return{functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(a)>-1?void 0:a,lineNumber:c,columnNumber:l}})}function Fv(e){return e.split(`
`).filter(n=>!n.match(Dv)).map(n=>{if(n.indexOf("@")===-1&&n.indexOf(":")===-1)return{functionName:n};const r=/((.*".+"[^@]*)?[^@]*)(?:@)/,o=n.match(r),i=o&&o[1]?o[1]:void 0,[s,a,c]=Od(n.replace(r,""));return{functionName:i,fileName:s,lineNumber:a,columnNumber:c}})}function Uv(e){return!e||!e.stack?[]:e.stack.match(xd)?Pv(e.stack):Fv(e.stack)}const jv=2e3,qv=20;function Is(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Hv(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,typeof location<"u"?location.href:void 0);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function xs(e){if(typeof e!="string")return;const t=Uv({stack:e}).slice(0,qv),n=[];for(const o of t)if(!(!o.fileName||typeof o.lineNumber!="number"||typeof o.columnNumber!="number"))try{const i=new URL(o.fileName).origin;n.push(`${i}/[script]:${o.lineNumber}:${o.columnNumber}`)}catch{}const r=n.join(`
`).slice(0,jv);return n.length?r.split(`
`):void 0}function Bv(e){const t=e&&typeof e=="object"?e.name:"";return/^(Error|TypeError|RangeError|ReferenceError|SyntaxError|URIError|EvalError)$/.test(String(t))?String(t):"Unhandled rejection"}const Ld="glue_diag_recording_started_ms",Md="glue_diag_seq";function Rd(){const e=B(Md),t=parseInt(e||"0",10),n=Number.isFinite(t)&&t>=0?t:0;return F(Md,String(n+1)),n}function Os(){mn()||(Xo(se()),F(Ld,String(Date.now())))}function Kr(e){const t=B(Ld);if(!t)return null;const n=parseInt(t,10);return Number.isFinite(n)?e-n:null}const $d="__glueConsoleWrapper",Nd="__glueConsoleLayer__";function Dd(e){return typeof e=="function"}function Pd(e){return Dd(e)?e[Nd]:void 0}function zv(e,t,n){const r=e[t];if(!Dd(r))return null;const o={next:r},s=n(function(...a){return o.next.apply(this,a)});return Object.defineProperties(s,{[$d]:{enumerable:!1,value:r},[Nd]:{enumerable:!1,value:o}}),e[t]=s,()=>{if(e[t]===s){e[t]=o.next;return}let a=e[t],c=Pd(a);for(;c;){if(c.next===s){c.next=o.next;return}a=c.next,c=Pd(a)}}}const Ls={levels:["warn","error"],sampleRate:1,urlAllow:[],urlDeny:[],budgets:{maxPerSession:500,maxPerPage:200,messageChars:2e3,argsBytes:4096}},Fd=["log","info","warn","error","debug"],Vv=/^%cglue/,Wv=/^(?:img|script|link)$/,Gv=2e3,Ud=500;function jd(e){const t=[];return{push(n){t.length>=e&&t.shift(),t.push(n)},getAll(){return[...t]},clear(){t.length=0},size(){return t.length}}}let Ce=Ls,ot=!1,be="disabled",Wn=jd(Ud),Jr=null;const Ms={};let Xr=0,Gn=0,Rs="",it=new Map;function qd(e){const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function Kv(){if(typeof location>"u")return!0;const e=location.origin+location.pathname;return Ce.urlDeny.some(t=>qd(t).test(e))?!1:Ce.urlAllow.length?Ce.urlAllow.some(t=>qd(t).test(e)):!0}function $s(e){return ot&&be==="active"&&Ce.levels.includes(e)}function Jv(e){e&&e!==Rs&&(Rs=e,Gn=0)}function Xv(){return Xr<Ce.budgets.maxPerSession&&Gn<Ce.budgets.maxPerPage}function Yv(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return"[Unserializable]"}}function Hd(e,t){t.timer!==null&&clearTimeout(t.timer),t.timer=setTimeout(()=>{it.delete(e)},Gv)}function Ns(e,t,n,r){const o=_t();Jv(o.page_view_id);const i=it.get(r.hash);if(i){i.record.repeat_count+=1,i.record.last_at=Date.now(),i.legacy.repeatCount=i.record.repeat_count,Hd(r.hash,i);return}if(!Xv())return;Os();const s=_t(),a=Date.now(),c=se(),l={log_id:c,level:e,message:t,args_preview:n,repeat_count:1,first_at:a,last_at:a,rel_ms:Kr(a),seq:Rd(),url:r.source,source:r.source,line:r.line,col:r.col,stack:r.stack,hash:r.hash,schema_version:cd,session_id:s.session_id,window_id:s.window_id,page_view_id:s.page_view_id,recording_id:s.recording_id,workspace_id:s.workspace_id},u={id:c,level:e,message:t,args:Array.isArray(n)?n.map(Yv):[],timestamp:a,stackTrace:r.stack?r.stack.join(`
`):void 0,url:r.source,lineNumber:r.line,columnNumber:r.col};Xr+=1,Gn+=1,Wn.push(u);const d={record:l,legacy:u,timer:null};if(it.set(r.hash,d),Hd(r.hash,d),Jr)try{Jr(l)}catch{}}function Zv(e,t){if(!$s(e)||typeof t[0]=="string"&&Vv.test(t[0]))return;const n=Id(t,Ce.budgets.messageChars),r=Cd(t.slice(0,10),Ce.budgets.argsBytes);let o,i,s,a;if(e==="error"){const l=t.find(u=>u instanceof Error);if(l){a=xs(l.stack);const u=a&&a[0],d=u?u.match(/^(.*)\/\[script\]:(\d+):(\d+)$/):null;d&&(o=d[1],i=Number(d[2]),s=Number(d[3]))}}const c=Is(`${e}|${n}|${o||""}|${i||0}`);Ns(e,n,r,{source:o,line:i,col:s,stack:a,hash:c})}function Qv(e){const t=window;if(!t.console)return;const n=t.console[e];if(n&&n[$d]!==void 0)return;const r=zv(t.console,e,o=>function(...i){try{Zv(e,i)}catch{}return o.apply(this,i)});r&&(Ms[e]=r)}function e0(e){const t=Ms[e];t&&t(),delete Ms[e]}function Bd(e){if(!$s("error"))return;const t=e.target;if(t&&t!==window&&t.tagName&&Wv.test(String(t.tagName).toLowerCase()))return;const n=e,r=String(n.message||n.error&&n.error.message||"Script error").slice(0,300),o=Hv(n.filename||""),i=Number.isFinite(n.lineno)?n.lineno:0,s=Number.isFinite(n.colno)?n.colno:0,a=xs(n.error&&n.error.stack),c=Is(`${r}|${o}|${i}`),l=Id([r],Ce.budgets.messageChars);Ns("error",l,[{message:r,source:o,line:i,col:s}],{source:o,line:i,col:s,stack:a,hash:c})}function zd(e){if(!$s("error"))return;const t=e&&typeof e=="object"&&"reason"in e?e.reason:e,n=Bv(t),r=xs(t&&typeof t=="object"?t.stack:void 0),o=Is(`rejection|${n}`),i=`Unhandled rejection: ${n}`;Ns("error",i,[n],{stack:r,hash:o})}function t0(e,t,n="v0"){return ot?be:(Ce={...Ls,...e,budgets:{...Ls.budgets,...e?.budgets||{}}},Jr=t||null,Wn=jd(Ud),Xr=0,Gn=0,Rs="",it=new Map,Kv()?dr("console_logs",Ce.sampleRate,n)?(be="active",ot=!0,Fd.forEach(Qv),typeof window<"u"&&(window.addEventListener("error",Bd,!0),window.addEventListener("unhandledrejection",zd)),be):(be="sampled_out",ot=!0,be):(be="disabled",ot=!0,be))}function n0(){ot&&(be==="active"&&(Fd.forEach(e0),typeof window<"u"&&(window.removeEventListener("error",Bd,!0),window.removeEventListener("unhandledrejection",zd))),it.forEach(e=>{e.timer!==null&&clearTimeout(e.timer)}),it.clear(),ot=!1,be="disabled",Jr=null)}function r0(){return Wn.getAll()}function o0(){return Wn.size()}function i0(){return be}function s0(){return ot&&be==="active"}function a0(){Wn.clear(),it.forEach(e=>{e.timer!==null&&clearTimeout(e.timer)}),it.clear(),Xr=0,Gn=0}const Yr={init:t0,destroy:n0,getEntries:r0,getCount:o0,getCaptureState:i0,isActive:s0,clear:a0};let Zr=null;function c0(){return Zr!==null||(Zr=typeof CompressionStream<"u"&&typeof Response<"u"&&typeof Blob<"u"),Zr}function l0(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode.apply(null,Array.from(e.subarray(r,r+32768)));return btoa(t)}async function u0(e,t,n){const r=new TextEncoder().encode(t),o={encoding:"json",payload:e,bytes:r.length};if(!c0()||r.length<n.compress_min_bytes||r.length>n.compress_max_bytes)return o;try{const i=new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")),s=new Uint8Array(await new Response(i).arrayBuffer());if(s.length*4/3>=r.length)return o;const a=l0(s);return{encoding:"gzip-base64",payload:a,bytes:a.length}}catch{return o}}var d0=Object.defineProperty,f0=(e,t,n)=>t in e?d0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g0=(e,t,n)=>f0(e,t+"",n);const Vd={flushMs:5e3,idleFlushMs:3e4,maxRecordsPerChunk:40,chunksPerMinute:12},m0=2,p0=524288;class Wd{constructor(){g0(this,"entries",[])}push(t){this.entries.push({record:t,capturedAt:Date.now()})}get length(){return this.entries.length}drain(){const t=this.entries;if(this.entries=[],!t.length){const n=Date.now();return{records:[],startedAt:n,endedAt:n}}return{records:t.map(n=>n.record),startedAt:t[0].capturedAt,endedAt:t[t.length-1].capturedAt}}clear(){this.entries=[]}}let Kt=!1,Gd=Ss,Tt=Vd,Ds,Jt=new Wd,Xt=new Wd,Ps=null,Fs=!0,Qr="console",Kn=0,Kd=()=>Sd().pending;function _0(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}async function h0(e){try{if(typeof crypto<"u"&&crypto.subtle&&typeof TextEncoder<"u"){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}`}}catch{}return`sha256:${_0(e).padEnd(64,"0")}`}function y0(e){return{window_id:e.window_id,page_view_id:e.page_view_id,log_id:e.log_id,level:e.level,message:e.message,args_preview:e.args_preview,repeat_count:e.repeat_count,ts:e.first_at,last_ts:e.last_at,rel_ms:e.rel_ms,seq:e.seq,url:e.url,source:e.source,line:e.line,col:e.col,stack:e.stack,hash:e.hash}}function w0(e){return{window_id:e.window_id,page_view_id:e.page_view_id,record_id:e.record_id,method:e.method,url:e.url,status:e.status,duration_ms:e.duration_ms,kind:e.kind,same_origin:e.same_origin,error:e.error,request_bytes:e.request_bytes,response_bytes:e.response_bytes,rel_ms:e.rel_ms,seq:e.seq,ts:e.ts}}async function Jd(e,t){if(!t.length)return;const{records:n,startedAt:r,endedAt:o}=t.drain();if(!n.length)return;Os();const i=e==="console"?n.map(y0):n.map(w0),s=JSON.stringify(i),a=await u0(i,s,{compress_min_bytes:0,compress_max_bytes:p0}),c=typeof a.payload=="string"?a.payload:s,l=await h0(c),u={kind:e,payload:a.payload,encoding:a.encoding,started_at:r,ended_at:o,rel_start_ms:Kr(r),rel_end_ms:Kr(o),record_count:i.length,bytes:a.bytes,checksum:l};!Gd(u)&&Ds&&Ds("send_failed",e)}function Xd(){const e=Tt.chunksPerMinute>0?Tt.chunksPerMinute:12;return Math.ceil(6e4/e)}function Us(){try{return Kd()>=ud-m0}catch{return!1}}async function b0(){if(!Kt||Us())return;const e=v0();e&&(Qr=e==="console"?"network":"console",Kn=Date.now(),await Jd(e,e==="console"?Jt:Xt))}function v0(){const e=Jt.length,t=Xt.length;return!e&&!t?null:Qr==="console"?e?"console":"network":t?"network":"console"}function eo(){if(Ps!==null||!Kt)return;const e=Fs?Tt.flushMs:Tt.idleFlushMs,t=Math.max(e,Xd()),n=Date.now()-Kn,r=Math.max(0,t-Math.max(0,n))||t;Ps=setTimeout(()=>{Ps=null,b0().finally(()=>{(Jt.length||Xt.length)&&eo()})},Us()?t*2:r)}function S0(){Fs=typeof document<"u"?document.visibilityState!=="hidden":!0}function Yd(e,t){if(Date.now()-Kn<Xd()||Us()){eo();return}Kn=Date.now(),Qr=e==="console"?"network":"console",Jd(e,t)}function E0(e){Kt&&(Jt.push(e),Jt.length>=Tt.maxRecordsPerChunk?Yd("console",Jt):eo())}function k0(e){Kt&&(Xt.push(e),Xt.length>=Tt.maxRecordsPerChunk?Yd("network",Xt):eo())}function A0(e={}){Kt||(Kt=!0,Gd=e.enqueue||Ss,Kd=e.pendingChunks||(()=>Sd().pending),Qr="console",Kn=0,Tt={...Vd,chunksPerMinute:Math.min(fv(),wd()),...e.budgets},Ds=e.onDrop,Fs=typeof document<"u"?document.visibilityState!=="hidden":!0,typeof document<"u"&&document.addEventListener("visibilitychange",S0))}const T0={requestId:"",frustrationId:"",takenAt:0,failures:[]};function C0(e){const t=!!e.error&&e.error.indexOf("HTTP ")!==0;return!t&&!((e.status??0)>=400)?"":`${e.method} ${e.url.split(/[?#]/)[0]} ${t?e.error:e.status}`}function I0(e,t){let n="";const r=[];for(let c=e.requests.length-1;c>=0;c--){const l=e.requests[c];if(l.id===t.requestId)break;if(e.isOwn(l.url))continue;n||(n=l.id);const u=C0(l);u&&t.failures.indexOf(u)<0&&r.indexOf(u)<0&&r.push(u)}const o=e.frustrationEvents[e.frustrationEvents.length-1],i=o?o.id:"",s=i!==""&&i!==t.frustrationId,a=!e.hidden&&e.activityAt>=t.takenAt;return!s&&r.length===0&&!(n&&a)?null:{requestId:n||t.requestId,frustrationId:i,takenAt:e.now,failures:r.length?t.failures.concat(r.reverse()).slice(-50):t.failures}}let Zd=0;const Qd=["pointerdown","keydown","touchstart","scroll"],ef={capture:!0,passive:!0};function Jn(){Zd=Date.now()}function tf(){document.visibilityState==="visible"&&Jn()}function x0(){return Zd}function O0(){Jn();for(const e of Qd)window.addEventListener(e,Jn,ef);return document.addEventListener("visibilitychange",tf,ef),()=>{for(const e of Qd)window.removeEventListener(e,Jn,!0);document.removeEventListener("visibilitychange",tf,!0)}}let to=Tr,nf=!1,js=null,qs=null,Xn=[],Ct=[];const L0=500,no=[],Yn=new WeakMap;function Yt(){return typeof window<"u"?window.__glueConfig:void 0}function rf(e){return!!Yt()?.tracking?.features?.[e]}function of(e){return Yt()?.tracking?.featureConfig?.[e]||{}}function sf(){return String(Yt()?.tracking?.config_version||Yt()?.config_version||"v0")}function M0(){const t=Yt()?.supabaseUrl;t&&(vd({supabaseUrl:String(t),hostname:typeof location<"u"?location.hostname:""}),fr())}let Zn="disabled",Hs=0,ro=0,Bs="",zs={maxPerSession:500,maxPerPage:200},af=[],cf=[],lf=!1;function oo(e,t,n){if(!(typeof t!="string"||!t))try{const r=typeof location<"u"?location.href:void 0,o=new URL(t,r),i=o.hostname.toLowerCase();if(!i)return;const s=n??(o.pathname||"/");if(e.some(a=>a.host===i&&a.pathPrefix===s))return;e.push({host:i,pathPrefix:s})}catch{}}function R0(){const e=[],t=Yt();oo(e,t?.supabaseUrl,"/functions/v1/"),oo(e,t?.ingestUrl);try{if(typeof document<"u"){const n=document.currentScript;n&&typeof n.src=="string"&&oo(e,n.src);const r=document.querySelectorAll("script[src]");for(let o=0;o<r.length;o++){const i=r[o].src||"";i.indexOf("workspace-id=")===-1&&i.indexOf("/functions/v1/glue")===-1||oo(e,i)}}}catch{}return e}function $0(e,t){const n=String(t||"").trim().toLowerCase().replace(/^\*\./,".");return n?n.charAt(0)==="."?e===n.slice(1)||e.endsWith(n):e===n:!1}function N0(e){let t="",n="";try{const r=typeof location<"u"?location.href:void 0,o=new URL(String(e||""),r);t=o.hostname.toLowerCase(),n=o.pathname}catch{return!1}for(const r of af)if(r.host===t&&n.indexOf(r.pathPrefix)===0)return!0;for(const r of cf)if($0(t,r))return!0;return!1}function D0(e){const t=String(e||"");if(lf)return t;const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}function P0(){const e=_t();return e.page_view_id!==Bs&&(Bs=e.page_view_id,ro=0),Hs<zs.maxPerSession&&ro<zs.maxPerPage}function F0(e){if(Zn!=="active"||N0(e.url)||!P0())return;Hs+=1,ro+=1,Os();const t=_t(),n=Date.now(),r={record_id:se(),method:e.method,url:D0(e.url),status:e.status,duration_ms:e.duration_ms,kind:e.kind,same_origin:e.same_origin,error:e.error,ts:n,rel_ms:Kr(n),seq:Rd(),schema_version:cd,session_id:t.session_id,window_id:t.window_id,page_view_id:t.page_view_id,recording_id:t.recording_id,workspace_id:t.workspace_id};k0(r)}function U0(){if(!rf("network_diagnostics")){Zn="disabled";return}const t=of("network_diagnostics"),n=typeof t.sample_rate=="number"?t.sample_rate:1;if(!dr("network_diagnostics",n,sf())){Zn="sampled_out";return}const o=t.budgets||{};zs={maxPerSession:typeof o.max_per_session=="number"?o.max_per_session:500,maxPerPage:typeof o.max_per_page=="number"?o.max_per_page:200},cf=Array.isArray(t.deny_hosts)?t.deny_hosts.filter(s=>typeof s=="string"):[],lf=t.capture_query===!0,af=R0(),Hs=0,ro=0,Bs="",Zn="active";const i=Di();i&&i.subscribe(F0)}function j0(){if(!rf("console_logs"))return;const t=of("console_logs");Yr.init({levels:t.levels||["warn","error"],sampleRate:typeof t.sample_rate=="number"?t.sample_rate:1,urlAllow:t.url_allow||[],urlDeny:t.url_deny||[],budgets:{maxPerSession:t.budgets?.max_per_session??500,maxPerPage:t.budgets?.max_per_page??200,messageChars:t.budgets?.message_chars??2e3,argsBytes:t.budgets?.args_bytes??4096}},n=>E0(n),sf())}function Vs(){return`frust_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function Ws(e){no.length>=L0&&no.shift(),no.push(e)}function q0(e){const t=e.target?.tagName||"unknown",n=Date.now();Xn=Xn.filter(o=>n-o.timestamp<1e3),Xn.push({timestamp:n,target:t});const r=Xn.filter(o=>o.target===t);if(r.length>=3){const o={id:Vs(),type:"rage_click",timestamp:n,target:t,details:{clickCount:r.length,duration:n-r[0].timestamp}};Ws(o),Xn=[]}}function H0(e){const t=Yn.get(e);if(t!==void 0)return t;const n=e.hasAttribute("onclick"),r=e.classList.contains("btn")||e.classList.contains("button");if(n||r)return Yn.set(e,!0),!0;if(Math.random()<.1)try{const i=window.getComputedStyle(e).cursor==="pointer";return Yn.set(e,i),i}catch{return Yn.set(e,!1),!1}return Yn.set(e,!1),!1}function B0(e){const t=e.target;if(!t)return;const n=t.tagName.toLowerCase();if(!["a","button","input","select","textarea"].includes(n)&&H0(t)){const o={id:Vs(),type:"dead_click",timestamp:Date.now(),target:`${n}${t.className?`.${t.className.split(" ").join(".")}`:""}`,details:{text:t.textContent?.slice(0,50)}};Ws(o)}}function z0(){const e=Date.now();if(Ct=Ct.filter(t=>e-t<1e4),Ct.push(e),Ct.length>=3){const t={id:Vs(),type:"error_cascade",timestamp:e,details:{errorCount:Ct.length,duration:e-Ct[0]}};Ws(t),Ct=[]}}function V0(e){q0(e),B0(e)}function W0(){z0()}function G0(e){nf||(to={...Tr,...e},to.enabled&&(to.networkEnabled&&Lr.init(to),document.addEventListener("click",V0,!0),window.addEventListener("error",W0),O0(),e?.consoleEnabled!==!1&&j0(),e?.networkDiagEnabled!==!1&&U0(),(Yr.isActive()||Zn==="active")&&(M0(),A0()),nf=!0))}function It(){return{consoleLogs:Yr.getEntries(),consoleLogCount:Yr.getCount(),networkRequests:Lr.getRequests(),networkRequestCount:Lr.getCount(),networkFailedCount:Lr.getFailedCount(),performanceSamples:[],performanceSummary:{},longTasks:[],layoutShifts:[],stateChanges:[],stateStoreType:void 0,frustrationEvents:[...no]}}function K0(e,t=3e4){js&&clearInterval(js),qs=e,js=window.setInterval(()=>{if(qs){const n=It();qs(n)}},t)}function J0(e){window.OneTrust?.OnConsentChanged&&window.OneTrust.OnConsentChanged(()=>{const n=uf();n&&e.setConsent(n,"external")}),window.addEventListener("consent.onetrust",()=>{const n=uf();n&&e.setConsent(n,"external")}),window.addEventListener("CookiebotOnAccept",()=>{if(window.Cookiebot?.consent){const n=window.Cookiebot.consent;let r="essential";n.marketing?r="full":n.statistics&&(r="analytics"),e.setConsent(r,"external")}}),window.addEventListener("CookiebotOnDecline",()=>{e.setConsent("essential","external")}),window.addEventListener("cookieyes_consent_update",n=>{const r=n.detail||{};let o="essential";r.advertisement==="yes"?o="full":r.analytics==="yes"&&(o="analytics"),e.setConsent(o,"external")}),window.addEventListener("glue:consent",n=>{n.detail?.level&&e.setConsent(n.detail.level,"external")}),window.glue=window.glue||{};const t=window.glue;t.setConsent=n=>{e.setConsent(n.level,"api")},t.getConsent=()=>({level:e.getConsentLevel(),required:e.isConsentRequired()})}function uf(){const e=document.cookie.match(/OptanonConsent=([^;]*)/)?.[1];if(!e)return null;const t=e.match(/groups=([^&]*)/)?.[1];if(!t)return null;const n=t.includes("C0002:1");return t.includes("C0004:1")?"full":n?"analytics":"essential"}const X0={headline:"We value your privacy",description:"We use cookies and tracking technologies to improve your experience and analyze site traffic.",acceptAllLabel:"Accept All",analyticsLabel:"Analytics Only",essentialLabel:"Essential Only"},Y0=`
  #glue-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
  }
  #glue-consent-banner * {
    box-sizing: border-box;
  }
  #glue-consent-banner.position-bottom { bottom: 0; }
  #glue-consent-banner.position-top { top: 0; }
  #glue-consent-banner.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    border-radius: 12px;
  }
  .glue-banner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999998;
  }
  .glue-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
  }
  .glue-banner-text {
    flex: 1;
    min-width: 280px;
  }
  .glue-banner-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.375rem 0;
    color: #111827;
  }
  .glue-banner-text p {
    font-size: 0.875rem;
    margin: 0;
    color: #6b7280;
    line-height: 1.4;
  }
  .glue-banner-text a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
  }
  .glue-banner-text a:hover {
    text-decoration: underline;
  }
  .glue-banner-buttons {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
  }
  .glue-banner-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
  }
  .glue-banner-btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
  }
  .glue-banner-btn-primary:hover {
    background: #2563eb;
  }
  .glue-banner-btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
  }
  .glue-banner-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
  }
`;function Z0(e,t){if(!document.getElementById("glue-consent-styles")){const a=document.createElement("style");a.id="glue-consent-styles",a.textContent=Y0+(e.style?.customCss||""),document.head.appendChild(a)}const n={...X0,...e.content},r=e.position||"bottom";let o=null;r==="center"&&(o=document.createElement("div"),o.className="glue-banner-overlay",document.body.appendChild(o));const i=document.createElement("div");i.id="glue-consent-banner",i.className=`position-${r}`,e.style&&(e.style.backgroundColor&&(i.style.background=e.style.backgroundColor),e.style.borderRadius&&(i.style.borderRadius=e.style.borderRadius)),i.innerHTML=`
    <div class="glue-banner-content">
      <div class="glue-banner-text">
        <h4 style="${e.style?.textColor?`color: ${e.style.textColor}`:""}">${n.headline}</h4>
        <p style="${e.style?.textColor?`color: ${e.style.textColor}`:""}">${n.description}</p>
        ${n.privacyPolicyUrl?`<a href="${n.privacyPolicyUrl}" target="_blank" rel="noopener">Privacy Policy</a>`:""}
      </div>
      <div class="glue-banner-buttons">
        <button class="glue-banner-btn glue-banner-btn-secondary" data-consent="essential">
          ${n.essentialLabel}
        </button>
        <button class="glue-banner-btn glue-banner-btn-secondary" data-consent="analytics">
          ${n.analyticsLabel}
        </button>
        <button class="glue-banner-btn glue-banner-btn-primary" data-consent="full"
          style="${e.style?.buttonColor?`background: ${e.style.buttonColor}`:""}">
          ${n.acceptAllLabel}
        </button>
      </div>
    </div>
  `;const s=()=>{i.remove(),o?.remove()};i.querySelectorAll("[data-consent]").forEach(a=>{a.addEventListener("click",()=>{const c=a.getAttribute("data-consent");t.setConsent(c,"banner"),s()})}),document.body.appendChild(i)}var Ve=(e=>(e.TRACKING_INITIALIZATION_FAILED="TRACKING_INITIALIZATION_FAILED",e.EVENT_SEND_FAILED="EVENT_SEND_FAILED",e.ELEMENT_NOT_FOUND="ELEMENT_NOT_FOUND",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.STORAGE_ERROR="STORAGE_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e))(Ve||{});class st extends Error{constructor(t,n,r){super(n),this.code=t,this.context=r,this.name="AnalyticsError"}}const at=W("analytics");function Q0(e){try{const t=e.getAttribute("glue-event-category"),n=e.getAttribute("glue-event-action"),r=e.getAttribute("glue-event-label"),o=e.getAttribute("glue-event-value");if(!n){at.warn("Analytics event missing required action attribute",e);return}if(typeof window.gtag!="function"){at.warn("Google Analytics (gtag) not found. Event not sent:",{action:n,category:t,label:r,value:o});return}const i={action:n,...t&&{event_category:t},...r&&{event_label:r},...o&&{value:o}};window.gtag("event",i.action,{event_category:i.event_category,event_label:i.event_label,value:i.value}),at.log("Analytics event sent:",i)}catch(t){const n=new st(Ve.EVENT_SEND_FAILED,"Failed to send analytics event",{element:e.tagName,error:t instanceof Error?t.message:String(t)});throw at.error("Analytics event send failed:",n),n}}function eS(e={}){const n={...{trackLinks:!0,trackButtons:!0,trackSubmissions:!0,defaultCategory:"User Interaction",customSelector:"[glue-event-action]",attributePrefix:"glue-event"},...e},r=[],o=[];let i=0;try{const s=document.querySelectorAll(n.customSelector||"[glue-event-action]");return at.log(`Found ${s.length} elements with analytics attributes`),s.forEach((a,c)=>{try{if(!a.hasAttribute("glue-event-action")){o.push(`Element ${c} missing required glue-event-action attribute`);return}const u=()=>{try{Q0(a)}catch(d){at.error("Click handler error:",d)}};a.addEventListener("click",u),i++,at.log("Analytics tracking attached to element:",{tagName:a.tagName,action:a.getAttribute("glue-event-action"),category:a.getAttribute("glue-event-category")})}catch(l){const u=`Failed to attach tracking to element ${c}: ${l instanceof Error?l.message:String(l)}`;r.push(u),at.error(u)}}),{success:r.length===0,elementsTracked:i,errors:r,warnings:o}}catch(s){const a=new st(Ve.TRACKING_INITIALIZATION_FAILED,"Failed to initialize analytics tracking",{error:s instanceof Error?s.message:String(s)});return r.push(a.message),{success:!1,elementsTracked:0,errors:r,warnings:o}}}function tS(){return eS()}const ct=W("analytics");function nS(e={}){const n={...{trackLinks:!0,trackButtons:!0,trackSubmissions:!0,defaultCategory:document.title||"Auto Analytics",customSelector:'a, button, input[type="submit"]',attributePrefix:"glue-event"},...e},r=[],o=[];let i=0;const s={links:0,buttons:0,submissions:0};try{let a="";const c=[];if(n.trackLinks&&c.push("a[href]"),n.trackButtons&&c.push("button"),n.trackSubmissions&&c.push('input[type="submit"]'),n.customSelector&&c.push(n.customSelector),a=c.join(", "),!a)return o.push("No element types configured for tracking"),{success:!0,elementsTracked:0,errors:r,warnings:o,configuredElements:s};const l=document.querySelectorAll(a),u=n.defaultCategory;return ct.log(`Processing ${l.length} elements for auto-analytics`),l.forEach((d,g)=>{try{if(d.hasAttribute("glue-event-action")){ct.log(`Element ${g} already has analytics configured, skipping`);return}if(d.hasAttribute("glue-event-category")||d.setAttribute("glue-event-category",u),!d.hasAttribute("glue-event-action")){const m=rS(d);if(m)d.setAttribute("glue-event-action",m);else{o.push(`Could not generate action for element ${g}`);return}}if(!d.hasAttribute("glue-event-label")){const m=oS(d);d.setAttribute("glue-event-label",m)}if(!d.hasAttribute("glue-event-value")){const m=iS(d);d.setAttribute("glue-event-value",m)}const f=d.tagName.toLowerCase();f==="a"?s.links++:f==="button"?s.buttons++:f==="input"&&d instanceof HTMLInputElement&&d.type==="submit"&&s.submissions++,i++,ct.log(`Auto-analytics configured for ${f}:`,{category:d.getAttribute("glue-event-category"),action:d.getAttribute("glue-event-action"),label:d.getAttribute("glue-event-label"),value:d.getAttribute("glue-event-value")})}catch(f){const m=`Failed to configure element ${g}: ${f instanceof Error?f.message:String(f)}`;r.push(m),ct.error(m)}}),{success:r.length===0,elementsTracked:i,errors:r,warnings:o,configuredElements:s}}catch(a){const c=new st(Ve.TRACKING_INITIALIZATION_FAILED,"Failed to process auto-analytics",{error:a instanceof Error?a.message:String(a)});return r.push(c.message),{success:!1,elementsTracked:0,errors:r,warnings:o,configuredElements:s}}}function rS(e){const t=e.tagName.toLowerCase();try{if(t==="a")return`Clicked link ${io(e)}`;if(t==="button")return`Clicked button ${io(e)}`;if(t==="input"&&e instanceof HTMLInputElement&&e.type==="submit")return`Clicked submit input ${e.name||e.value||"submit"}`;const n=io(e);return`Clicked ${t} ${n}`}catch(n){return ct.warn("Error generating action description:",n),`Clicked ${t}`}}function oS(e){try{const t=io(e);return t||(e instanceof HTMLInputElement&&e.name?e.name:e.id?e.id:e.tagName.toLowerCase())}catch(t){return ct.warn("Error generating element label:",t),e.tagName.toLowerCase()}}function iS(e){try{return e instanceof HTMLAnchorElement&&e.href?e.href:e instanceof HTMLInputElement&&e.type==="submit"?"Form Submit":e instanceof HTMLButtonElement?e.form||e.closest("form")?"Form Submit":"Button Click":"Element Interaction"}catch(t){return ct.warn("Error generating element value:",t),"Element Interaction"}}function io(e){try{const t=(e.innerText||e.textContent||"").trim(),n=50;return t.length>n?t.substring(0,n)+"...":t}catch(t){return ct.warn("Error extracting element text:",t),""}}function df(e){return nS(e)}const ff=W("analytics");function sS(){try{const e=bo("gclid");e&&(J("gclid",e,30),typeof localStorage<"u"&&localStorage.removeItem("gclid"),ff.log("GCLID captured and stored:",e))}catch(e){ff.error("Error capturing GCLID:",e)}}const ne=W("forms"),gf={enabled:!0,includeFullJourney:!1,fieldPrefix:"glue_",formSelector:"form",maxDataSize:1e4,fields:{userId:!0,sessionId:!0,totalSessions:!0,totalEvents:!0,daysActive:!0,firstTouch:!0,lastTouch:!0,journeyData:!1}};let G={...gf},Re=null;function mf(){const e=En(),t=h("glue_user_id")||"",n=B("glue_session_id")||"",r={glue_user_id:t,session_id:n,total_sessions:e.summary.total_sessions,total_events:e.summary.total_events,days_active:e.summary.days_active||0,converted_sessions:e.summary.converted_sessions,first_touch_source:e.summary.attribution.first_touch.utm_source,first_touch_medium:e.summary.attribution.first_touch.utm_medium,first_touch_campaign:e.summary.attribution.first_touch.utm_campaign,first_touch_referrer:e.summary.attribution.first_touch.referrer,last_touch_source:e.summary.attribution.last_touch.utm_source,last_touch_medium:e.summary.attribution.last_touch.utm_medium,last_touch_campaign:e.summary.attribution.last_touch.utm_campaign,last_touch_referrer:e.summary.attribution.last_touch.referrer};if(G.includeFullJourney)try{const o=JSON.stringify(e);o.length<=(G.maxDataSize||1e4)?r.journey_data=o:ne.warn("Journey data exceeds max size, skipping full journey injection")}catch(o){ne.error("Failed to stringify journey data:",o)}return r}function aS(e,t){const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n.setAttribute("data-glue-injected","true"),n}function cS(e){e.querySelectorAll('input[data-glue-injected="true"]').forEach(n=>n.remove())}function Gs(e){if(!G.enabled){ne.log("Form journey injection disabled");return}try{cS(e);const t=mf(),n=G.fieldPrefix||"glue_";let r=0;const o=(i,s,a=!0)=>{if(a&&s!==void 0&&s!==null&&s!==""){const c=`${n}${i}`;if(!e.querySelector(`[name="${c}"]`)){const u=aS(c,String(s));e.appendChild(u),r++,ne.log(`Injected field: ${c} = ${String(s).substring(0,50)}`)}}};G.fields?.userId&&o("user_id",t.glue_user_id),G.fields?.sessionId&&o("session_id",t.session_id),G.fields?.totalSessions&&o("total_sessions",t.total_sessions),G.fields?.totalEvents&&o("total_events",t.total_events),G.fields?.daysActive&&o("days_active",t.days_active),G.fields?.firstTouch&&(o("first_touch_source",t.first_touch_source),o("first_touch_medium",t.first_touch_medium),o("first_touch_campaign",t.first_touch_campaign),o("first_touch_referrer",t.first_touch_referrer)),G.fields?.lastTouch&&(o("last_touch_source",t.last_touch_source),o("last_touch_medium",t.last_touch_medium),o("last_touch_campaign",t.last_touch_campaign),o("last_touch_referrer",t.last_touch_referrer)),G.fields?.journeyData&&t.journey_data&&o("journey_data",t.journey_data),ne.log(`Form journey injection complete: ${r} fields added to form ${e.id||e.name||"unnamed"}`)}catch(t){ne.error("Failed to inject journey data into form:",t)}}function pf(e={}){if(G={...gf,...e},!G.enabled){ne.log("Form journey injection is disabled");return}const t=G.formSelector||"form",n=o=>{o.__glue_journey_injection_attached||(o.addEventListener("submit",i=>{ne.log("Form submit detected, injecting journey data..."),Gs(o)}),o.__glue_journey_injection_attached=!0,ne.log(`Journey injection listener attached to form: ${o.id||o.name||"unnamed"}`))},r=document.querySelectorAll(t);r.forEach(n),ne.log(`Form journey injection setup complete: ${r.length} forms found`),typeof MutationObserver<"u"&&(Re&&Re.disconnect(),Re=new MutationObserver(o=>{o.forEach(i=>{i.addedNodes.forEach(s=>{s instanceof HTMLFormElement&&s.matches(t)?n(s):s instanceof HTMLElement&&s.querySelectorAll(t).forEach(n)})})}),Re.observe(document.body,{childList:!0,subtree:!0}),ne.log("MutationObserver active for dynamically added forms"))}function lS(e){try{const t=document.querySelector(e);return t?(Gs(t),!0):(ne.error(`Form not found: ${e}`),!1)}catch(t){return ne.error("Failed to inject into specific form:",t),!1}}function uS(e){G={...G,...e},ne.log("Form injection config updated:",G)}function dS(){return{...G}}function fS(){G.enabled=!0,pf(G),ne.log("Form journey injection enabled")}function gS(){G.enabled=!1,Re&&(Re.disconnect(),Re=null),ne.log("Form journey injection disabled")}function mS(){Re&&(Re.disconnect(),Re=null),G.enabled=!1,ne.log("Form journey injection cleaned up")}const Zt={setupFormJourneyInjection:pf,injectJourneyDataIntoForm:Gs,injectIntoForm:lS,getJourneySummaryFields:mf,updateConfig:uS,getConfig:dS,enable:fS,disable:gS,cleanup:mS},Ie=W("forms"),_f={selectors:['div[class^="temp_"] input'],autoSave:!0,storage:["cookies","sessionStorage"],debounceTime:300,updateVisitorContext:!0,validator:()=>!0};function hf(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function yf(e){try{const t=e.closest('div[class^="temp_"]');if(!t)return null;const n=t.className.match(/temp_([a-zA-Z0-9_-]+)/);return!n||!n[1]?null:`temp_${n[1]}`}catch(t){return Ie.error("Error extracting storage key:",t),null}}function pS(e,t=_f){const n=Date.now();try{const r=yf(e);if(!r)return{element:e,key:"",value:e.value,lastSaved:n,success:!1,error:"Could not extract storage key from parent element"};const o=e.value;if(t.validator&&!t.validator(o,e))return{element:e,key:r,value:o,lastSaved:n,success:!1,error:"Input value failed validation"};const i=[];t.storage.forEach(a=>{try{switch(a){case"cookies":J(r,o,.5);break;case"sessionStorage":window.sessionStorage.setItem(r,o);break;case"localStorage":window.localStorage.setItem(r,o);break;default:throw new Error(`Unknown storage type: ${a}`)}}catch(c){const l=`Failed to save to ${a}: ${c instanceof Error?c.message:String(c)}`;i.push(l),Ie.error(l)}}),e.isTracked=!0,e.lastSaved=n;const s=i.length===0;return s&&Ie.log("Input data saved successfully:",{key:r,value:o.substring(0,20)+"..."}),{element:e,key:r,value:o,lastSaved:n,success:s,error:i.length>0?i.join("; "):void 0}}catch(r){const o=r instanceof Error?r.message:String(r);return Ie.error("Error saving input data:",o),{element:e,key:"",value:e.value,lastSaved:n,success:!1,error:o}}}const wf=new WeakSet;let Qn=null,Ks=null;const so=new Set;let Js=!1;function bf(e){return wf.has(e)?!1:(wf.add(e),e.addEventListener("input",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{Qn()})})}),!0)}function vf(e){let t=0;return e instanceof HTMLInputElement&&bf(e)&&t++,e.querySelectorAll("input").forEach(n=>{bf(n)&&t++}),t}function _S(){if(Ks||typeof MutationObserver>"u")return;const e=document.body||document.documentElement;e&&(Ks=new MutationObserver(t=>{t.forEach(n=>{n.addedNodes.forEach(r=>{r instanceof Element&&so.add(r)})}),!(Js||so.size===0)&&(Js=!0,queueMicrotask(()=>{Js=!1;let n=0;so.forEach(r=>{n+=vf(r)}),so.clear(),n>0&&(Ie.log(`Set up visitor context updates for ${n} new input elements`),Qn())}))}),Ks.observe(e,{childList:!0,subtree:!0}))}function Sf(){Qn||(Qn=hf(()=>{try{Pa()}catch(t){Ie.error("Failed to update visitor context:",t)}},100));const e=()=>{const t=vf(document);_S(),Ie.log(`Set up visitor context updates for ${t} new input elements`),t>0&&Qn()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}function hS(e={}){const t={..._f,...e},n=[],r=[];let o=0;try{t.updateVisitorContext&&Sf();const i=t.selectors.join(", "),s=document.querySelectorAll(i);if(s.length===0)return Ie.log(`No inputs found matching selectors: ${i}`),{success:!0,fieldsProcessed:0,fieldsSaved:[],errors:[]};Ie.log(`Found ${s.length} inputs matching selectors`);const a=hf(c=>{const l=pS(c,t);if(l.success){const u={name:c.name||c.id||`input_${o}`,value:l.value,type:c.type,selector:`[name="${c.name}"]`,persist:!0,storage:t.storage.includes("localStorage")?"localStorage":t.storage.includes("sessionStorage")?"sessionStorage":"cookies"};r.push(u)}else l.error&&n.push(l.error)},t.debounceTime||300);return s.forEach(c=>{try{const l=yf(c);if(!l){n.push(`Could not extract storage key for input: ${c.name||c.type}`);return}const u=()=>{t.autoSave&&a(c)};c.addEventListener("input",u),c.isTracked=!0,o++,Ie.log(`Attached listener to input with key: ${l}`)}catch(l){const u=`Failed to setup listener for input: ${l instanceof Error?l.message:String(l)}`;n.push(u),Ie.error(u)}}),{success:n.length===0,fieldsProcessed:o,fieldsSaved:r,errors:n}}catch(i){const s=new st(Ve.TRACKING_INITIALIZATION_FAILED,"Failed to setup input listener",{error:i instanceof Error?i.message:String(i)});return n.push(s.message),{success:!1,fieldsProcessed:0,fieldsSaved:[],errors:n}}}function yS(){return hS()}Sf();const K=W("forms");function wS(e){const{key:t,value:n,exactMatch:r=!0,checkStorage:o=["params","localStorage","sessionStorage","cookies"]}=e;try{for(const i of o){let s=null;switch(i){case"params":s=bo(t);break;case"localStorage":s=h(t);break;case"sessionStorage":s=B(t);break;case"cookies":s=pe(t);break;default:K.warn(`Unknown storage type: ${i}`);continue}if(s!==null){const a=r?s===n:s.toLowerCase().includes(n.toLowerCase());if(K.log(`Condition check [${i}] ${t}=${s} ${a?"MATCHES":"NO MATCH"} expected ${n}`),a)return!0}}return!1}catch(i){return K.error(`Error checking condition for key ${t}:`,i),!1}}function bS(){try{const e=['[id*="glue_redirect_url"]','[class*="glue_redirect_url"]','[name="glue_redirect_url"]','[glue="redirect_url"]','input[name*="redirect"]','input[id*="redirect_url"]'],t=document.querySelectorAll(e.join(", "));return Array.from(t).filter(n=>n.tagName==="INPUT"&&typeof n.value=="string")}catch(e){return K.error("Error finding redirect inputs:",e),[]}}function vS(e,t){try{const n=t||bS();let r=0;return n.forEach(o=>{try{o.value=e,o.setAttribute("value",e),(o.hasAttribute("data-frmval")||o.closest("[data-frmval]"))&&o.setAttribute("data-frmval",e),r++,K.log(`Updated redirect input ${o.name||o.id||"unnamed"} with URL: ${e}`)}catch(i){K.error("Error updating redirect input:",i)}}),r}catch(n){return K.error("Error updating redirect inputs:",n),0}}function SS(e){const t=[];try{K.log("processRedirectURL called");const n=e||window.glue_redirect_conditions;if(!n||!Array.isArray(n)){const o="Redirect conditions not defined or not an array";return t.push(o),K.error(o),{inputsUpdated:0,errors:t}}K.log("Checking conditions:",n);let r;for(const o of n)try{if(!o.key||!o.value||!o.redirectUrl){K.warn("Invalid condition structure:",o);continue}if(wS(o)){r=o,K.log("Matched condition:",r);break}}catch(i){const s=`Error checking condition ${o.key}: ${i instanceof Error?i.message:String(i)}`;t.push(s),K.error(s)}if(r){const o=vS(r.redirectUrl);return o===0&&t.push("No redirect input elements found to update"),{inputsUpdated:o,matchedCondition:r,errors:t,redirectUrl:r.redirectUrl}}else return K.warn("No matching condition found for redirection"),{inputsUpdated:0,errors:t}}catch(n){const r=`Error processing redirect URL: ${n instanceof Error?n.message:String(n)}`;return t.push(r),K.error(r),{inputsUpdated:0,errors:t}}}function ES(e={}){const{formSelector:t=".glue_redirect form, form.glue_redirect",preventDefaultSubmission:n=!0,logRedirections:r=!0}=e;try{const o=document.querySelectorAll(t);let i=0;return o.forEach(s=>{try{const a=c=>{try{const l=['[id*="glue_redirect_url"]','[class*="glue_redirect_url"]','[name="glue_redirect_url"]','[glue="redirect_url"]'];let u=null;for(const d of l)if(u=s.querySelector(d),!u&&s.parentElement&&(u=s.parentElement.querySelector(d)),u)break;if(u&&u.value.trim()){n&&c.preventDefault();const d=u.value.trim();r&&K.log(`Form redirection triggered to: ${d}`);try{new URL(d)}catch{K.warn("Redirect URL is not a full URL, treating as relative path")}window.location.href=d}else r&&K.log("No redirect URL found, allowing normal form submission")}catch(l){K.error("Error in form redirection handler:",l)}};s.addEventListener("submit",a),i++,K.log(`Attached redirection handler to form: ${s.id||s.className||"unnamed"}`)}catch(a){K.error("Error setting up form redirection handler:",a)}}),K.log(`Set up redirection handlers for ${i} forms`),i}catch(o){return K.error("Error in setupFormRedirection:",o),0}}function kS(){return SS()}function AS(){return ES()}const xt=W("fillout"),TS=new Set(["glue_user_id","glue_session_id","glue_user_firstseen","glue_session_start","glue_url_first","glue_url_current","glue_url_last","glue_referrer","glue_user_ip","glue_initial_utm_id","glue_last_utm_id","glue_initial_utm_source","glue_last_utm_source","glue_initial_utm_medium","glue_last_utm_medium","glue_initial_utm_campaign","glue_last_utm_campaign","glue_initial_utm_term","glue_last_utm_term","glue_initial_utm_content","glue_last_utm_content","glue_fb_fbp","glue_fb_fbc","glue_fb_fbclid","glue_initial_fbclid","glue_last_fbclid","glue_tt_clickid","glue_initial_ttclid","glue_last_ttclid","glue_gclid","glue_initial_gclid","glue_last_gclid","glue_initial_gclsrc","glue_last_gclsrc","glue_initial_wbraid","glue_last_wbraid","glue_initial_gbraid","glue_last_gbraid","glue_initial_dclid","glue_last_dclid","glue_msclkid","glue_initial_msclkid","glue_last_msclkid","glue_initial_li_fat_id","glue_last_li_fat_id","glue_initial_twclid","glue_last_twclid","glue_initial_epik","glue_last_epik","glue_initial_ScCid","glue_last_ScCid","glue_initial_irclickid","glue_last_irclickid","glue_initial_adset_id","glue_last_adset_id","glue_initial_ad_id","glue_last_ad_id","glue_initial_adgroup_id","glue_last_adgroup_id","glue_initial_campaign_id","glue_last_campaign_id","glue_initial_placement","glue_last_placement","glue_initial_comet_source","glue_last_comet_source","glue_initial_comet_ad_id","glue_last_comet_ad_id","glue_initial_comet_campaign","glue_last_comet_campaign","glue_initial_comet_ad_group","glue_last_comet_ad_group","glue_initial_comet_network","glue_last_comet_network","glue_initial_comet_keyword","glue_last_comet_keyword","glue_initial_comet_placement","glue_last_comet_placement","glue_initial_comet_type","glue_last_comet_type","glue_initial_comet_custom","glue_last_comet_custom","glue_in_app_browser","glue_traffic_type","glue_attribution_derived_from","glue_adblocker_detected"]),CS="utm_";function IS(e,t=!1){return t||e.startsWith(CS)?!0:TS.has(e)}function Ef(e,t,n){const r=`data-${t}`;e.forEach(o=>{o.setAttribute(r,n)})}function xS(){const e=new Map;return kf(e,"localStorage"),kf(e,"sessionStorage"),e}function kf(e,t){const n=ao(t,()=>window[t]);if(!n)return;const r=ao(t,()=>n.length)??0;for(let o=0;o<r;o++){const i=ao(t,()=>n.key(o));if(i&&!e.has(i)&&IS(i,!1)){const s=ao(t,()=>n.getItem(i));s&&s!=="null"&&s!==""&&e.set(i,s)}}}function ao(e,t){try{return t()}catch(n){return xt.warn(`could not read ${e}:`,n),null}}function OS(e){const t=xS();let n=0;return t.forEach((r,o)=>{Ef(e,o,r),n++}),n}function LS(e){const t=new URLSearchParams(window.location.search);if(!t.toString())return 0;let n=0;return t.forEach((r,o)=>{o.startsWith("glue_")||o.startsWith("utm_")||Fu(o)||(Ef(e,o,r),n++)}),n}function MS(e){xt.log("form info:",{form_id:e.getAttribute("data-fillout-id"),domain:e.getAttribute("data-fillout-domain"),total_attributes:e.attributes.length});const t=Array.from(e.attributes).filter(n=>n.name.startsWith("data-")&&!n.name.startsWith("data-fillout-")).reduce((n,r)=>(n[r.name]=r.value.length>50?`${r.value.substring(0,50)}...`:r.value,n),{});xt.table(t)}function Af(){const e=document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])');if(!e.length){xt.log("no Fillout forms on page, skipping data injection");return}const t=OS(e),n=LS(e);if(xt.enabled()){const r=Array.from(e).map(o=>o.getAttribute("data-fillout-id")).join(", ");xt.group(`injected ${t+n} data attributes (${t} stored, ${n} query) into ${e.length} form(s) [${r}]`),MS(e[0]),xt.groupEnd()}}const de=W("integrations"),Xs={endpoint:"",projectId:"",includeLocalStorage:!0,includeSessionStorage:!0,includeCookies:!0,includeParams:!0,excludeKeys:[],headers:{"Content-Type":"application/json"},timeout:1e4};async function RS(e,t,n,r={}){const o=Date.now();try{if(!e||!t)throw new st(Ve.INVALID_CONFIGURATION,"Endpoint and project ID are required for console sync");const i=`${e.replace(/\/$/,"")}/${t}`,s={...Xs,...r},a=new AbortController,c=setTimeout(()=>a.abort(),s.timeout);try{const l=await fetch(i,{method:"POST",headers:s.headers||{},body:JSON.stringify(n),signal:a.signal});clearTimeout(c);let u=null;try{u=await l.json()}catch{u=await l.text()}const d=Date.now()-o;return l.ok?(de.log(`Data sent to server. Response status: ${l.status}, Time: ${d}ms`),{success:!0,status:l.status,response:u,syncTime:d}):(de.error(`Console sync failed with status ${l.status}:`,u),{success:!1,status:l.status,response:u,error:`HTTP ${l.status}: ${l.statusText}`,syncTime:d})}finally{clearTimeout(c)}}catch(i){const s=Date.now()-o,a=i instanceof Error?i.message:String(i);return de.error("Error sending data to server:",i),{success:!1,status:0,error:a,syncTime:s}}}function $S(e={}){const t={...Xs,...e},n=new Set(t.excludeKeys);try{const r={project_id:t.projectId,session_id:h("glue_user_id")??`session_${Date.now()}`,timestamp:Date.now(),url:window.location.href,user_agent:navigator.userAgent,localStorage:{},sessionStorage:{},cookies:{},params:{},custom:{}};if(t.includeLocalStorage)try{Object.keys(localStorage).forEach(i=>{if(!n.has(i)){const s=h(i);s!==null&&(r.localStorage[i]=s)}})}catch(o){de.warn("Failed to collect localStorage data:",o)}if(t.includeSessionStorage)try{Object.keys(sessionStorage).forEach(i=>{if(!n.has(i)){const s=B(i);s!==null&&(r.sessionStorage[i]=s)}})}catch(o){de.warn("Failed to collect sessionStorage data:",o)}if(t.includeCookies)try{document.cookie.split("; ").forEach(i=>{if(i.trim()){const[s,...a]=i.split("="),c=a.join("=");s&&!n.has(s)&&(r.cookies[s]=c||"")}})}catch(o){de.warn("Failed to collect cookie data:",o)}if(t.includeParams)try{new URLSearchParams(window.location.search).forEach((i,s)=>{!n.has(s)&&!Fu(s)&&(r.params[s]=i)})}catch(o){de.warn("Failed to collect URL parameters:",o)}return r}catch(r){return de.error("Error collecting sync data:",r),{project_id:t.projectId,session_id:`error_session_${Date.now()}`,timestamp:Date.now(),url:window.location.href,user_agent:navigator.userAgent,localStorage:{},sessionStorage:{},cookies:{},params:{},custom:{error:r instanceof Error?r.message:String(r)}}}}function NS(){try{const e=document.querySelector('script[src*="glue.min.js"]');if(!e)return de.warn("DataGlue script tag not found"),{};const t=e.getAttribute("project-id")||e.getAttribute("data-project-id")||window.glue_project_id,n=e.getAttribute("endpoint")||e.getAttribute("data-endpoint")||window.glue_endpoint;return{...t&&{projectId:t},...n&&{endpoint:n}}}catch(e){return de.error("Error extracting configuration from script tag:",e),{}}}async function DS(e={}){try{const t=NS(),n={...Xs,...t,...e};if(!n.projectId||!n.endpoint)throw new st(Ve.INVALID_CONFIGURATION,"Project ID and endpoint are required for console sync. Check script tag attributes.");const r=async a=>{try{de.log(`Console sync triggered by: ${a}`);const c=$S(n);return c.custom={...c.custom,trigger_event:a,trigger_timestamp:Date.now()},await RS(n.endpoint,n.projectId,c,n)}catch(c){return de.error(`Console sync failed for event ${a}:`,c),{success:!1,status:0,error:c instanceof Error?c.message:String(c),syncTime:0}}},i=(()=>{const a=()=>r("page_load"),c=l=>{l.target.tagName==="BUTTON"&&r("button_click")};return window.addEventListener("load",a),document.addEventListener("click",c),de.log("Console sync event listeners attached"),()=>{window.removeEventListener("load",a),document.removeEventListener("click",c),de.log("Console sync event listeners removed")}})(),s=await r("initialization");return window.consoleSyncCleanup=i,s}catch(t){return{success:!1,status:0,error:new st(Ve.TRACKING_INITIALIZATION_FAILED,"Failed to initialize console sync",{error:t instanceof Error?t.message:String(t)}).message,syncTime:0}}}async function PS(){return DS()}const oe=W("integrations"),Tf={endpoint:"",autoSync:!1,syncInterval:6e4,retryAttempts:3,retryDelay:1e3};let X={...Tf},Qt=null;function FS(e){if(X={...Tf,...e},!X.endpoint){oe.warn("Profile sync endpoint not configured");return}oe.log("Profile sync initialized with endpoint:",X.endpoint),X.autoSync&&Cf()}function Cf(){Qt&&clearInterval(Qt),Qt=setInterval(()=>{xf().catch(e=>{oe.error("Auto-sync failed:",e)})},X.syncInterval),oe.log("Auto-sync started with interval:",X.syncInterval)}function If(){Qt&&(clearInterval(Qt),Qt=null,oe.log("Auto-sync stopped"))}async function US(e,t={}){if(!X.endpoint)return oe.warn("Cannot identify: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const n=h("glue_user_id"),r=B("glue_session_id");if(!n||!r)return oe.error("Cannot identify: missing glue_user_id or session_id"),{success:!1,error:"Missing required IDs"};const o={glue_user_id:n,email:e,traits:t,context:{session_id:r,utm_source:h("glue_initial_utm_source")||void 0,utm_medium:h("glue_initial_utm_medium")||void 0,utm_campaign:h("glue_initial_utm_campaign")||void 0,referrer:h("glue_user_referrer")||void 0,page:{url:window.location.href,title:document.title,path:window.location.pathname},visitor:{user_agent:navigator.userAgent,browser:navigator.userAgent.split(" ").pop(),os:navigator.platform,geolocation:h("glue_user_geolocation")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language}}};return co(`${X.endpoint}/identify`,o)}async function jS(e,t={}){if(!X.endpoint)return oe.warn("Cannot track: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const n=h("glue_user_id"),r=B("glue_session_id");if(!n||!r)return oe.error("Cannot track: missing glue_user_id or session_id"),{success:!1,error:"Missing required IDs"};const o=yt(),i={glue_user_id:n,session_id:r,email:o.email,event:e,properties:t,timestamp:Date.now(),context:{utm_source:h("glue_last_utm_source"),utm_medium:h("glue_last_utm_medium"),utm_campaign:h("glue_last_utm_campaign"),page:{url:window.location.href,title:document.title,path:window.location.pathname},referrer:document.referrer}};return co(`${X.endpoint}/track`,i)}async function xf(){if(!X.endpoint)return oe.warn("Cannot sync: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const e=h("glue_user_id");if(!e)return oe.error("Cannot sync: missing glue_user_id"),{success:!1,error:"Missing glue_user_id"};const t=En(),n={glue_user_id:e,data:t,synced_at:new Date().toISOString(),merge_strategy:{profile:"keep_filled",traits:"keep_filled",events:"merge_all"}},r=await co(`${X.endpoint}/sync`,n);return r.success&&Y("data_synced",{sessions_count:t.sessions.length,events_count:t.events.length}),r}async function co(e,t,n=1){try{oe.log(`Sending request to ${e} (attempt ${n})`);const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return oe.log("Request successful:",e),{success:!0,...o}}catch(r){return oe.error(`Request failed (attempt ${n}):`,r),n<X.retryAttempts?(oe.log(`Retrying in ${X.retryDelay}ms...`),await new Promise(o=>setTimeout(o,X.retryDelay)),co(e,t,n+1)):{success:!1,error:r instanceof Error?r.message:String(r)}}}function qS(e,t={}){if(!X.endpoint)return!1;const n=h("glue_user_id"),r=B("glue_session_id");if(!n||!r)return!1;const o=yt(),i={glue_user_id:n,session_id:r,email:o.email,event:e,properties:t,timestamp:Date.now(),context:{}},s=new Blob([JSON.stringify(i)],{type:"application/json"});return navigator.sendBeacon(`${X.endpoint}/track`,s)}function HS(){return{...X}}function BS(e){X={...X,...e},e.syncInterval&&X.autoSync&&(If(),Cf()),oe.log("Sync config updated:",X)}const er={initializeProfileSync:FS,identify:US,track:jS,syncCompleteData:xf,trackBeacon:qS,stopAutoSync:If,getSyncConfig:HS,updateSyncConfig:BS},ge=W("integrations");function Ys(e,t,n,r){try{const o=e(t),i=n?o===n:o!==null;return r&&ge.log(`[${r}] Retrieved [${o}] for key [${t}] - ${i?"PASS":"FAIL"}`),{key:t,expectedValue:n,actualValue:o,matchedStorage:i?r:void 0,passed:i}}catch(o){return ge.error(`Error checking ${r||"storage"}:`,o),{key:t,expectedValue:n,actualValue:null,passed:!1}}}function zS(e,t){try{const n=new URLSearchParams(window.location.search).get(e),r=t?n===t:n!==null;return ge.log(`[URL] Retrieved [${n}] from URL for key [${e}] - ${r?"PASS":"FAIL"}`),{key:e,expectedValue:t,actualValue:n,matchedStorage:r?"params":void 0,passed:r}}catch(n){return ge.error("Error checking URL parameters:",n),{key:e,expectedValue:t,actualValue:null,passed:!1}}}function VS(e){const t=[],n=[],r=[];try{const{redirect:o,key:i,value:s,keys:a,access_denied:c,access_granted:l,selector:u,checkParams:d=!0,checkStorage:g=["localStorage","sessionStorage","cookies","params"],caseSensitive:f=!0}=e;if(!u)throw new st(Ve.INVALID_CONFIGURATION,"Selector is required for dynamic content configuration");const m=a||(i?[{key:i,value:s}]:[]);m.length===0&&ge.warn("No conditions specified for dynamic content, granting access by default");let y=!0;const b=[];for(const v of m){const{key:E,value:T}=v;let A=!1;const S=f||!T?T:T.toLowerCase();for(const x of g){let _;switch(x){case"localStorage":_=Ys(h,E,S,"LocalStorage");break;case"sessionStorage":_=Ys(B,E,S,"SessionStorage");break;case"cookies":_=Ys(pe,E,S,"Cookie");break;case"params":_=zS(E,S);break;default:continue}if(!f&&T&&_.actualValue&&(_.passed=_.actualValue.toLowerCase()===S),b.push(_),_.passed){A=!0;break}}A||(y=!1)}ge.log(`Access determination: ${y} for selector ${u}`);const p=document.querySelector(u);if(!p){const v=`Target element not found for selector: ${u}`;return t.push(v),ge.error(v),{success:!1,elementsProcessed:0,grantedElements:[],deniedElements:[],errors:t}}if(y)p.style.display="block",l&&(p.innerHTML=l),n.push(u),ge.log(`Access granted for selector: ${u}`);else if(c?(p.style.display="block",p.innerHTML=c):p.style.display="none",r.push(u),ge.log(`Access denied for selector: ${u}`),o){ge.log(`Redirecting to: ${o}`);try{window.location.replace(o)}catch(v){const E=`Failed to redirect to ${o}: ${v instanceof Error?v.message:String(v)}`;t.push(E),ge.error(E)}}return{success:t.length===0,elementsProcessed:1,grantedElements:n,deniedElements:r,errors:t}}catch(o){const i=`Failed to process dynamic content configuration: ${o instanceof Error?o.message:String(o)}`;return t.push(i),ge.error(i),{success:!1,elementsProcessed:0,grantedElements:[],deniedElements:[],errors:t}}}function Of(e){const t=Array.isArray(e)?e:[e];let n=0;const r=[],o=[],i=[];for(const s of t)try{const a=VS(s);n+=a.elementsProcessed,r.push(...a.grantedElements),o.push(...a.deniedElements),i.push(...a.errors)}catch(a){const c=`Error processing configuration: ${a instanceof Error?a.message:String(a)}`;i.push(c),ge.error(c)}return{success:i.length===0,elementsProcessed:n,grantedElements:r,deniedElements:o,errors:i}}function WS(){document.querySelectorAll("[data-fillout-id]").length>0&&Lf()}function Lf(){const e=document.createElement("script");e.src="https://server.fillout.com/embed/v1/",e.onload=()=>{if(!I.enabled())return;const t=document.querySelector("[data-fillout-id]");if(t){I.group("Fillout form data after embed script load");const n={form_id:t.getAttribute("data-fillout-id"),attributes:Array.from(t.attributes).filter(r=>r.name.startsWith("data-")&&!r.name.startsWith("data-fillout-")).reduce((r,o)=>(r[o.name]=o.value,r),{})};I.table([n]),I.groupEnd()}},document.body.appendChild(e)}const Zs=new WeakSet;function GS(e){e.forEach(t=>Zs.add(t))}function KS(){if(typeof MutationObserver>"u"||!document.body)return;let e=!1;const t=()=>{e=!1;const r=document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])');let o=!1;r.forEach(i=>{Zs.has(i)||(Zs.add(i),o=!0)}),o&&(I.log("Fillout: detected dynamically-injected form(s), decorating and rendering"),Af(),Lf())};new MutationObserver(()=>{e||(e=!0,queueMicrotask(t))}).observe(document.body,{childList:!0,subtree:!0})}function JS(){try{const e=localStorage.getItem("glue_privacy_disable_pii")==="true",t=localStorage.getItem("glue_privacy_disable_form")==="true";return{capturePII:!e,injectJourney:!t}}catch(e){return I.warn("Unable to read privacy preferences:",e),{capturePII:!0,injectJourney:!0}}}window.glue=window.glue||{},window.glue.dynamicContent&&typeof window.glue.dynamicContent=="object"&&Of(window.glue.dynamicContent),window.glue.dynamicContent=function(e){Of(e)},window.glue.getVisitorContext=function(){return Do()},window.glue.setAttribution=function(e){e.utm_source!==void 0&&(k("glue_last_utm_source",e.utm_source),h("glue_initial_utm_source")||k("glue_initial_utm_source",e.utm_source)),e.utm_medium!==void 0&&(k("glue_last_utm_medium",e.utm_medium),h("glue_initial_utm_medium")||k("glue_initial_utm_medium",e.utm_medium)),e.utm_campaign!==void 0&&(k("glue_last_utm_campaign",e.utm_campaign),h("glue_initial_utm_campaign")||k("glue_initial_utm_campaign",e.utm_campaign)),e.utm_term!==void 0&&k("glue_last_utm_term",e.utm_term),e.utm_content!==void 0&&k("glue_last_utm_content",e.utm_content),e.gclid!==void 0&&k("glue_gclid",e.gclid),e.fbclid!==void 0&&k("glue_fbclid",e.fbclid),e.msclkid!==void 0&&k("glue_msclkid",e.msclkid),e.ttclid!==void 0&&k("glue_ttclid",e.ttclid),I.log("Attribution data set:",e)},window.glue.getAttribution=function(){return Do().attribution},window.glue.journey={track:(e,t)=>we.trackEvent(e,t),identify:(e,t)=>we.identifyUser(e,t),setCrmId:e=>we.setCrmId(e),getProfile:()=>we.getUserProfile(),getSessions:()=>we.getSessions(),getEvents:()=>we.getEvents(),getCompleteData:()=>we.getCompleteUserData(),exportData:()=>we.exportJourneyData(),clear:()=>we.clearJourneyData()},window.glue.sync={identify:(e,t)=>er.identify(e,t),track:(e,t)=>er.track(e,t),syncAll:()=>er.syncCompleteData(),config:e=>er.updateSyncConfig(e),sendToSupabase:()=>{const e=we.getPendingSyncData();return ee.syncToSupabase(e)}},window.glue.forms={enableJourneyInjection:()=>Zt.enable(),disableJourneyInjection:()=>Zt.disable(),injectIntoForm:e=>Zt.injectIntoForm(e),getJourneySummary:()=>Zt.getJourneySummaryFields(),config:e=>Zt.updateConfig(e),getFormAnalytics:()=>Object.fromEntries(qy()),getFormById:e=>Hy(e)},window.glue.storage={set:(e,t,n)=>{k(e,t),n&&J(e,t,n)},get:e=>h(e),remove:e=>{localStorage.removeItem(e),J(e,"",-1)},clear:()=>{localStorage.clear()},getSyncedAttributes:()=>{try{const e=h("glue_synced_attributes");return e?JSON.parse(e):{}}catch{return{}}},getCustomAttributes:()=>{try{const e=h("glue_custom_attributes");return e?JSON.parse(e):{}}catch{return{}}}},window.glue.devtools={getData:()=>It(),getConsoleLogs:()=>It().consoleLogs,getNetworkRequests:()=>It().networkRequests,getPerformanceData:()=>{const e=It();return{samples:e.performanceSamples,summary:e.performanceSummary,longTasks:e.longTasks,layoutShifts:e.layoutShifts}},getStateChanges:()=>It().stateChanges,getFrustrationEvents:()=>It().frustrationEvents},window.glue.debug={enable:e=>vg(e),disable:()=>Sg(),status:()=>oa(),dump:()=>kg()},window.glue.privacy={isRequired:()=>pt()?.isConsentRequired()??!1,getLevel:()=>pt()?.getConsentLevel()??"full",setConsent:e=>{pt()?.setConsent(e,"api")},isFeatureAllowed:e=>pt()?.isFeatureAllowed(e)??!0,onConsentChange:e=>pt()?.onConsentChange(e)??(()=>{})},window.glue.getAttribute=e=>h(`glue_attr_${e}`),window.glue.getAttributes=()=>{const e={};for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(n?.startsWith("glue_attr_")){const r=n.replace("glue_attr_","");e[r]=localStorage.getItem(n)||""}}return e},window.glue.onAttributeChange=e=>{const t=n=>{const r=n;e(r.detail.key,r.detail.value)};return window.addEventListener("glue:attribute",t),()=>window.removeEventListener("glue:attribute",t)};let Mf=!1,Rf=!1,$f=!1,Nf=!1;async function Df(){const e=window.__glueConfig,t=JS(),n=document.currentScript||document.querySelector('script[src*="api.dataglue.io"]')||document.querySelector('script[src*="glue"]');let r=[],o=null,i=null,s=!1,a=["pageview","form_submit"],c=!0,l=!1,u="glue_",d=null,g=null,f=null;if(e){d=e.workspaceId,g=e.apiKey,f=e.supabaseUrl,s=e.autoSync!==void 0?e.autoSync:!1,c=e.injectJourney!==void 0?e.injectJourney:!0,Array.isArray(e.tracking?.events)&&(a=e.tracking.events.filter(L=>typeof L=="string"));const A=e.privacy??{consent_required:!1,default_consent_level:"full",storage_mode:"full",features:{fingerprinting:!0,geolocation:!0,form_capture:!0,session_replay:!0},banner:null,external:{mode:"none",providers:[],cookie_names:[]},respect_dnt:!1},S=pt()??gm(A);I.log("Privacy manager initialized:",{consent_required:A.consent_required,consent_level:S.getConsentLevel()}),Mf||(Mf=!0,A.external.mode!=="none"&&(J0(S),I.log("External banner listeners initialized")),A.banner&&S.getConsentLevel()==="none"&&(Z0(A.banner,S),I.log("Consent banner displayed")));const x=S.getConsentLevel(),_=x==="analytics"||x==="full";if(S.isConsentRequired()&&!_){Rf||(Rf=!0,S.onConsentChange(M=>{(M.level==="analytics"||M.level==="full")&&Df()})),I.log("Analytics tracking paused until analytics consent is granted");const L=e.tracking?.features??{};L.flags===!0&&L.capture_all!==!1&&(Hb(e.tracking.featureConfig?.flags,S.canUseStorage("localStorage")),S.onConsentChange(()=>{S.canUseStorage("localStorage")||us()}));return}wa()}if(Nf)return;Nf=!0;const m=pt();if(m?.isConsentRequired()&&!$f){$f=!0;let A=!1;m.onConsentChange(S=>{A||!zb(S.level)||m.isChoiceKept()&&(A=!0,window.location.reload())})}if(n){const A=n.getAttribute("modules");A&&(r=A.split(",")),o=n.getAttribute("endpoint"),i=n.getAttribute("profile-endpoint")||n.getAttribute("data-profile-endpoint");const S=n.getAttribute("auto-sync")||n.getAttribute("data-auto-sync");S!==null&&(s=S==="true");const x=n.getAttribute("track-events")||n.getAttribute("data-track-events");x&&(a=x.split(",").map(N=>N.trim()));const _=n.getAttribute("inject-journey")||n.getAttribute("data-inject-journey");_!==null&&(c=_!=="false");const L=n.getAttribute("inject-full-journey")||n.getAttribute("data-inject-full-journey");L!==null&&(l=L==="true");const M=n.getAttribute("journey-field-prefix")||n.getAttribute("data-journey-field-prefix");M&&(u=M),d||(d=n.getAttribute("workspace-id")||n.getAttribute("data-workspace-id")),g||(g=n.getAttribute("api-key")||n.getAttribute("data-api-key")),f||(f=n.getAttribute("supabase-url")||n.getAttribute("data-supabase-url"))}I.enabled()&&(I.group("boot",!0),I.log("config",{workspaceId:d,configSource:e?"__glueConfig (edge)":"script tag",autoSync:s,trackEvents:a,injectJourney:c,injectFullJourney:l,journeyFieldPrefix:u,modules:r,endpoint:o,profileEndpoint:i,capturePII:t.capturePII}),I.log("tip: glue.debug.dump() prints stored state · glue.debug.enable('forms,fillout') filters namespaces"),I.groupEnd()),!Io()&&wm()&&I.log("Location capture is off: stored location removed"),bo(),Do(),Pa(),tS(),So(),Wg(),sS(),yS(),kS(),AS(),"requestIdleCallback"in window?requestIdleCallback(()=>{df(),I.log("Auto-analytics attributes applied (deferred)")},{timeout:2e3}):setTimeout(()=>{df(),I.log("Auto-analytics attributes applied (fallback)")},100),zp(),I.log("Enhanced context tracking initialized");let y=null,b=null,p=[];try{const{AttributionEngine:A}=await Promise.resolve().then(()=>Em),{createDefaultChannels:S,createChannelFromConfig:x,mergeChannelConfigs:_}=await Promise.resolve().then(()=>Lm),{createAttributionModel:L}=await Promise.resolve().then(()=>QS);if(e?.channels&&e?.attributionModel){const M=e.channels.map(x).filter(Boolean),N=S(),w=_(N,M),O=L(e.attributionModel),R=new A(O,w),P=R.execute();P&&I.log("Attribution touchpoint recognized:",P.getChannel().getLabel()),p=R.getTouchpointHistory().map($=>({channel_id:$.getChannel().getId(),channel_name:$.getChannel().getLabel(),channel_type:"custom",channel_value:$.getValue(),timestamp:new Date($.getTimestamp()*1e3).toISOString(),referrer:document.referrer,landing_page:window.location.pathname,utm_data:{},tracking_data:{},context:{}})),ee.setExtendedData({touchpoints:p})}}catch(A){I.error("Error initializing attribution:",A)}"requestIdleCallback"in window&&cn("fingerprinting")&&requestIdleCallback(async()=>{try{const{getOrGenerateFingerprint:A}=await Promise.resolve().then(()=>oE),{generateDeviceFingerprint:S}=await Promise.resolve().then(()=>aE),{collectMobileData:x}=await Promise.resolve().then(()=>e_);y=await A(async()=>{const _=await S(),L=await x();return L&&(_.mobile_data=L),_}),ee.setExtendedData({device_fingerprint:y}),I.log("Device fingerprint ready:",y.composite_id)}catch(A){I.error("Failed to generate fingerprint:",A)}},{timeout:3e3});const v=async()=>{try{const A=await Xp();ee.setExtendedData({enhanced_context:A}),I.log("Enhanced context collected:",{network:A.network.effectiveType,colorScheme:A.preferences.colorScheme,adBlocker:A.adBlocker})}catch(A){I.error("Failed to collect enhanced context:",A)}document.removeEventListener("click",v),document.removeEventListener("scroll",v)};document.addEventListener("click",v,{once:!0,passive:!0}),document.addEventListener("scroll",v,{once:!0,passive:!0}),setTimeout(v,5e3),"requestIdleCallback"in window&&Io()&&requestIdleCallback(async()=>{try{const{getGeolocationWithFallback:A}=await Promise.resolve().then(()=>rm),S=h("glue_geo_cache");if(S)try{const{data:_,timestamp:L}=JSON.parse(S),M=Date.now()-L;if(typeof _=="object"&&_!==null&&!Array.isArray(_)&&Object.keys(_).length>0&&Number.isFinite(L)&&M>=0&&M<864e5){b=_,ee.setExtendedData({geolocation:b}),I.log("Using cached geolocation");return}}catch{}const x=f?`${f}/functions/v1/geolocate`:void 0;b=await A(x),b&&(k("glue_geo_cache",JSON.stringify({data:b,timestamp:Date.now()})),ee.setExtendedData({geolocation:b}),I.log("Geolocation data collected:",b?.city,b?.country_name))}catch(A){I.error("Failed to get geolocation:",A)}},{timeout:5e3});const E=()=>document.baseURI||window.location.href,T=yh({supabaseUrl:f,workspaceId:d,ingestUrl:e?.ingestUrl,scriptUrl:n?.src},E());if(wh(T),d&&f){ee.initializeSupabaseSync({workspaceId:d,workspaceApiKey:g||void 0,hostname:window.location.hostname,supabaseUrl:f}),I.log("Supabase sync initialized for workspace:",d);try{const S=h("glue_user_id");if(S){const x=new URL(`${f}/functions/v1/ingest-events`);x.searchParams.set("workspace_id",d),x.searchParams.set("glue_user_id",S),x.searchParams.set("hostname",window.location.hostname),fetch(x.toString(),{method:"GET"}).then(_=>_.json()).then(_=>{_.pending_sync_data&&Object.keys(_.pending_sync_data).length>0&&(I.log("Received browser attributes from server:",_.pending_sync_data),Object.entries(_.pending_sync_data).forEach(([L,M])=>{const N=typeof M=="object"&&M.value!==void 0?M.value:M;if(typeof M=="object"&&M.expires_at&&new Date(M.expires_at)<new Date){I.log(`Skipping expired attribute: ${L}`);return}k(`glue_attr_${L}`,String(N)),window.dispatchEvent(new CustomEvent("glue:attribute",{detail:{key:L,value:N}}))}),k("glue_synced_attributes",JSON.stringify(_.pending_sync_data))),_.custom_attributes&&Object.keys(_.custom_attributes).length>0&&k("glue_custom_attributes",JSON.stringify(_.custom_attributes))}).catch(_=>{I.warn("Failed to fetch enrichment data:",_)})}}catch(S){I.warn("Two-way sync check failed:",S)}const A=e?.devtools||{enabled:!0};if(A.enabled!==!1){G0({enabled:!0,networkEnabled:A.networkEnabled!==!1});let S=T0,x=!1;vr(_=>{_.event==="page_view"&&Jn()}),K0(async _=>{if(x)return;const L=E(),M=I0({requests:_.networkRequests,frustrationEvents:_.frustrationEvents,isOwn:N=>Rl(N,T,L),activityAt:x0(),hidden:document.visibilityState==="hidden",now:Date.now()},S);if(M){x=!0,ee.setExtendedData({devtools_data:_});try{await ee.syncToSupabase(we.getPendingSyncData())&&(S=M)}catch(N){I.warn("DevTools snapshot sync failed:",N)}finally{ee.setExtendedData({devtools_data:null}),x=!1}}},31e3),I.log("DevTools collectors initialized (network + frustration)")}}we.initializeJourneyTracking({autoTrackPageViews:a.includes("pageview"),autoTrackClicks:a.includes("click"),autoTrackClickMap:a.includes("click_map"),autoTrackScroll:a.includes("scroll"),autoTrackFormSubmits:a.includes("form_submit"),autoSync:s&&ee.isSupabaseSyncEnabled(),piiCaptureEnabled:t.capturePII,formInjectionEnabled:t.injectJourney}),J_(e?.tracking?.features??{},e?.tracking?.featureConfig??{},e?.tracking?.config_version??""),Ey({enabled:!0,domIntelligence:e?.tracking?.features?.form_intelligence===!0,trackFocusBlur:!0,trackTyping:!0,trackValidation:!0,trackAbandonment:!0,captureFieldLength:!0,detectAutofill:!0}),I.log("Form field analytics enabled"),i&&(er.initializeProfileSync({endpoint:i,autoSync:s,syncInterval:6e4,retryAttempts:3,retryDelay:1e3}),I.log("Profile sync enabled with endpoint:",i)),t.injectJourney&&c?Zt.setupFormJourneyInjection({enabled:c,includeFullJourney:l,fieldPrefix:u,formSelector:"form",maxDataSize:1e4,fields:{userId:!0,sessionId:!0,totalSessions:!0,totalEvents:!0,daysActive:!0,firstTouch:!0,lastTouch:!0,journeyData:l}}):I.log("Form journey injection disabled via privacy settings"),I.log("Form journey injection initialized:",{enabled:c,includeFullJourney:l,fieldPrefix:u}),r.includes("formSearch")&&I.log("FormSearch module requested but not yet implemented in TypeScript version"),o&&PS(),WS(),Af(),GS(document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])')),KS(),I.log("DataGlue TypeScript initialization complete")}Df().catch(e=>{console.error("DataGlue initialization failed:",e)});var XS=Object.defineProperty,YS=(e,t,n)=>t in e?XS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,en=(e,t,n)=>YS(e,typeof t!="symbol"?t+"":t,n);class Ot{constructor(t=2592e3){en(this,"touchpointLifetime"),this.touchpointLifetime=t}filterValidTouchpoints(t){const n=Rt();return t.filter(r=>r.getTimestamp()>n-this.touchpointLifetime)}}class Qs extends Ot{execute(t=[]){const n=this.filterValidTouchpoints(t);let r=null;return n.forEach(o=>{(r===null||o.getChannel().options.canOverwrite)&&(r=o)}),r?[new ae(r,100)]:[]}}class Pf extends Ot{execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=n[0];return[new ae(r,100)]}}class Ff extends Ot{execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=100/n.length;return n.map(o=>new ae(o,r))}}class Uf extends Ot{constructor(t=2592e3,n=7){super(t),en(this,"decayRate"),this.decayRate=n*86400}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=Rt(),o=[];let i=0;return n.forEach(s=>{const a=r-s.getTimestamp(),c=Math.exp(-(Math.LN2/this.decayRate)*a);o.push(c),i+=c}),n.map((s,a)=>{const c=o[a]/i*100;return new ae(s,c)})}}class jf extends Ot{constructor(t=2592e3,n=40,r=40,o=20){if(super(t),en(this,"firstWeight"),en(this,"lastWeight"),en(this,"middleWeight"),this.firstWeight=n,this.lastWeight=r,this.middleWeight=o,n+r+o!==100)throw new Error("Position-based weights must sum to 100")}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];if(n.length===1)return[new ae(n[0],100)];if(n.length===2)return[new ae(n[0],this.firstWeight),new ae(n[1],this.lastWeight+this.middleWeight)];const r=n.slice(1,-1),o=this.middleWeight/r.length,i=[];return i.push(new ae(n[0],this.firstWeight)),r.forEach(s=>{i.push(new ae(s,o))}),i.push(new ae(n[n.length-1],this.lastWeight)),i}}class qf extends Ot{constructor(t=2592e3,n=[]){if(super(t),en(this,"positionWeights"),this.positionWeights=n,n.reduce((o,i)=>o+i,0)!==100&&n.length>0)throw new Error("Custom position weights must sum to 100")}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];if(this.positionWeights.length===0){const r=100/n.length;return n.map(o=>new ae(o,r))}if(n.length>this.positionWeights.length){const r=[];let o=0;for(let c=0;c<this.positionWeights.length;c++)r.push(new ae(n[c],this.positionWeights[c])),o+=this.positionWeights[c];const i=100-o,s=n.length-this.positionWeights.length,a=i/s;for(let c=this.positionWeights.length;c<n.length;c++)r.push(new ae(n[c],a));return r}return n.map((r,o)=>new ae(r,this.positionWeights[o]))}}function ZS(e){const t=e.touchpoint_lifetime_days*86400;switch(e.model_type){case"last_touch":return new Qs(t);case"first_touch":return new Pf(t);case"linear":return new Ff(t);case"time_decay":return new Uf(t,e.config.decay_rate||7);case"position_based":return new jf(t,e.config.first_weight||40,e.config.last_weight||40,e.config.middle_weight||20);case"custom_weighted":return new qf(t,e.config.position_weights||[]);default:return new Qs(t)}}const QS=Object.freeze(Object.defineProperty({__proto__:null,AttributionModel:Ot,CustomWeightedAttributionModel:qf,FirstTouchAttributionModel:Pf,LastTouchAttributionModel:Qs,LinearAttributionModel:Ff,PositionBasedAttributionModel:jf,TimeDecayAttributionModel:Uf,createAttributionModel:ZS},Symbol.toStringTag,{value:"Module"})),tr=W("fingerprint"),eE="glue_fingerprint_db",lt="fingerprints",tE=7*24*60*60*1e3;function ea(){return new Promise((e,t)=>{const n=indexedDB.open(eE,1);n.onerror=()=>t(n.error),n.onsuccess=()=>e(n.result),n.onupgradeneeded=r=>{const o=r.target.result;o.objectStoreNames.contains(lt)||o.createObjectStore(lt,{keyPath:"composite_id"})}})}async function Hf(){try{const n=(await ea()).transaction(lt,"readonly").objectStore(lt);return new Promise(r=>{const o=n.getAll();o.onsuccess=()=>{const i=o.result;if(i&&i.length>0){const s=i.sort((a,c)=>c.timestamp-a.timestamp)[0];Date.now()-s.timestamp<tE?r(s.data):r(null)}else r(null)},o.onerror=()=>r(null)})}catch(e){return tr.error("error getting cached fingerprint:",e),null}}async function Bf(e){try{const r=(await ea()).transaction(lt,"readwrite").objectStore(lt),o={data:e,timestamp:Date.now(),composite_id:e.composite_id};r.put(o);const i=r.getAll();i.onsuccess=()=>{const s=i.result;s.length>3&&s.sort((l,u)=>u.timestamp-l.timestamp).slice(3).forEach(l=>{r.delete(l.composite_id)})}}catch(t){tr.error("error caching fingerprint:",t)}}async function nE(){try{(await ea()).transaction(lt,"readwrite").objectStore(lt).clear()}catch(e){tr.error("error clearing fingerprint cache:",e)}}async function rE(e){const t=await Hf();if(t)return tr.log("using cached fingerprint (instant)"),t;tr.log("generating new fingerprint…");const n=await e();return await Bf(n),n}const oE=Object.freeze(Object.defineProperty({__proto__:null,cacheFingerprint:Bf,clearFingerprintCache:nE,getCachedFingerprint:Hf,getOrGenerateFingerprint:rE},Symbol.toStringTag,{value:"Module"}));function ut(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(36)}function zf(){return{width:window.screen.width,height:window.screen.height,availWidth:window.screen.availWidth,availHeight:window.screen.availHeight,colorDepth:window.screen.colorDepth,pixelDepth:window.screen.pixelDepth,devicePixelRatio:window.devicePixelRatio||1,orientation:window.screen.orientation?.type||"unknown"}}function Vf(){return{userAgent:navigator.userAgent,language:navigator.language,languages:Array.from(navigator.languages||[]),platform:navigator.platform,vendor:navigator.vendor||"unknown",cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack||null,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}function Wf(){return{hardwareConcurrency:navigator.hardwareConcurrency||0,deviceMemory:navigator.deviceMemory,maxTouchPoints:navigator.maxTouchPoints||0,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0}}async function Gf(){try{if("getBattery"in navigator){const e=await navigator.getBattery();return{charging:e.charging,level:e.level,chargingTime:e.chargingTime,dischargingTime:e.dischargingTime}}}catch{}return null}function Kf(){try{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return null;e.width=200,e.height=50,t.textBaseline="top",t.font='14px "Arial"',t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText("DataGlue 🔍",2,15),t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("DataGlue 🔍",4,17),t.globalCompositeOperation="multiply",t.fillStyle="rgb(255,0,255)",t.beginPath(),t.arc(50,25,20,0,Math.PI*2,!0),t.closePath(),t.fill(),t.fillStyle="rgb(0,255,255)",t.beginPath(),t.arc(70,25,20,0,Math.PI*2,!0),t.closePath(),t.fill();const n=e.toDataURL();return ut(n)}catch{return null}}function Jf(){try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return null;const n=t.getExtension("WEBGL_debug_renderer_info"),r=n?t.getParameter(n.UNMASKED_VENDOR_WEBGL):"unknown",o=n?t.getParameter(n.UNMASKED_RENDERER_WEBGL):"unknown",i=t.getSupportedExtensions()?.join(",")||"",s=[t.getParameter(t.VERSION),t.getParameter(t.SHADING_LANGUAGE_VERSION),t.getParameter(t.MAX_TEXTURE_SIZE),t.getParameter(t.MAX_VERTEX_ATTRIBS),t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),t.getParameter(t.MAX_VARYING_VECTORS),t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS)].join("|"),a=`${r}|${o}|${i}|${s}`;return ut(a)}catch{return null}}function Xf(){return new Promise(e=>{try{const t=window.AudioContext||window.webkitAudioContext;if(!t){e(null);return}const n=new t,r=n.createOscillator(),o=n.createAnalyser(),i=n.createGain(),s=n.createScriptProcessor(4096,1,1);i.gain.value=0,r.type="triangle",r.connect(o),o.connect(s),s.connect(i),i.connect(n.destination),s.onaudioprocess=function(a){const c=a.outputBuffer.getChannelData(0),l=Array.from(c.slice(0,30)).map(u=>u.toFixed(6)).join(",");r.disconnect(),s.disconnect(),o.disconnect(),i.disconnect(),e(ut(l))},r.start(0),setTimeout(()=>{try{r.stop()}catch{}e(null)},100)}catch{e(null)}})}function Yf(){const e=["monospace","sans-serif","serif"],t=["Arial","Verdana","Times New Roman","Courier New","Georgia","Palatino","Garamond","Bookman","Comic Sans MS","Trebuchet MS","Impact","Arial Black","Helvetica","Tahoma","Geneva","Lucida Sans","Lucida Console","Monaco","Consolas","Andale Mono","Century Gothic","Calibri","Cambria","Candara","Franklin Gothic","Futura","Optima","Segoe UI","Roboto","Ubuntu","Droid Sans","Open Sans","Lato","Montserrat","Raleway"],r=document.createElement("canvas").getContext("2d");if(!r)return[];const o="mmmmmmmmmmlli",i="72px",s=[],a={};return e.forEach(c=>{r.font=`${i} ${c}`,a[c]=r.measureText(o).width}),t.forEach(c=>{let l=!1;e.forEach(u=>{r.font=`${i} '${c}', ${u}`,r.measureText(o).width!==a[u]&&(l=!0)}),l&&s.push(c)}),s}function Zf(){const e={localStorage:null,indexedDB:null,cookie:null};try{let t=localStorage.getItem("_glue_fpid");t||(t=Qf(),localStorage.setItem("_glue_fpid",t)),e.localStorage=t}catch{}try{const t=document.cookie.match(/_glue_fpid=([^;]+)/);if(t)e.cookie=t[1];else{const n=Qf();document.cookie=`_glue_fpid=${n};max-age=31536000;path=/`,e.cookie=n}}catch{}return e}function Qf(){return`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}async function iE(){const e=zf(),t=Vf(),n=Wf(),r=Zf(),[o,i,s,a,c]=await Promise.all([Gf(),Promise.resolve(Kf()),Promise.resolve(Jf()),Xf(),lg()]),l=Yf(),u={screen:e,browser:t,hardware:n,canvas:i,webgl:s,audio:a,fonts:l,battery:o,storage:r},d=JSON.stringify(u),g=ut(d),f=ut([i,s,a,e.width,e.height,t.userAgent,l.join(","),c.mathHash,c.voiceHash,c.codecHash,c.gpu?.renderer,r.localStorage,r.cookie].filter(Boolean).join("|"));return{fingerprint_hash:g,canvas_hash:i,webgl_hash:s,audio_hash:a,screen_data:e,browser_data:t,hardware_data:n,font_list:l,battery_data:o,storage_ids:r,mobile_data:null,composite_id:f,raw_fingerprint:u,enhanced:c}}function sE(){try{const e=document.createElement("canvas"),t=e.getContext("2d");return!t||(t.fillText("test",0,0),e.toDataURL()==="data:,")}catch{return!0}}function eg(){try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return null;const n=t.getExtension("WEBGL_debug_renderer_info");return n?{vendor:t.getParameter(n.UNMASKED_VENDOR_WEBGL)||"unknown",renderer:t.getParameter(n.UNMASKED_RENDERER_WEBGL)||"unknown"}:null}catch{return null}}function tg(){return new Promise(e=>{try{if(!("speechSynthesis"in window)){e(null);return}const t=()=>{const r=speechSynthesis.getVoices();if(r.length===0)return null;const o=r.map(i=>`${i.name}|${i.lang}|${i.localService?"l":"r"}`).sort().join(",");return{hash:ut(o),count:r.length}};let n=t();if(n){e(n);return}speechSynthesis.onvoiceschanged=()=>{n=t(),e(n)},setTimeout(()=>e(t()),500)}catch{e(null)}})}async function ng(){try{if(!navigator.mediaDevices?.enumerateDevices)return null;const e=await navigator.mediaDevices.enumerateDevices(),t={audioinput:0,audiooutput:0,videoinput:0};for(const n of e)n.kind in t&&t[n.kind]++;return t}catch{return null}}function rg(){const e=[Math.tan(-1e300),Math.sin(1),Math.cos(1),Math.exp(1),Math.log(2),Math.sqrt(2),Math.pow(Math.PI,-100),Math.acos(.123456789),Math.asin(.123456789),Math.atan(.123456789),Math.atan2(.123456789,.987654321),Math.sinh(1),Math.cosh(1),Math.tanh(1)];return ut(e.map(t=>t.toString()).join("|"))}function og(){const e=document.createElement("video"),n=['video/mp4; codecs="avc1.42E01E"','video/mp4; codecs="avc1.4D401E"','video/mp4; codecs="avc1.64001E"','video/webm; codecs="vp8"','video/webm; codecs="vp9"','video/webm; codecs="av1"','video/ogg; codecs="theora"','audio/mp4; codecs="mp4a.40.2"','audio/webm; codecs="opus"','audio/ogg; codecs="vorbis"',"audio/wav","audio/flac"].map(r=>{const o=e.canPlayType(r);return o==="probably"?"2":o==="maybe"?"1":"0"}).join("");return ut(n)}async function ig(){const e={widevine:!1,playready:!1,fairplay:!1};if(!navigator.requestMediaKeySystemAccess)return e;const t=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4; codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"'}]}];try{await navigator.requestMediaKeySystemAccess("com.widevine.alpha",t),e.widevine=!0}catch{}try{await navigator.requestMediaKeySystemAccess("com.microsoft.playready",t),e.playready=!0}catch{}try{await navigator.requestMediaKeySystemAccess("com.apple.fps.1_0",t),e.fairplay=!0}catch{}return e}function sg(){return{bluetooth:"bluetooth"in navigator,usb:"usb"in navigator,serial:"serial"in navigator,midi:"requestMIDIAccess"in navigator,gamepad:"getGamepads"in navigator,xr:"xr"in navigator,payment:"PaymentRequest"in window,share:"share"in navigator,wakeLock:"wakeLock"in navigator,pdfViewer:navigator.pdfViewerEnabled??!1}}function ag(){return new Promise(e=>{const t=new Set;try{const n=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});n.createDataChannel(""),n.onicecandidate=r=>{if(!r.candidate){n.close(),e(Array.from(t));return}const o=r.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}|([a-f0-9]{1,4}:){7}[a-f0-9]{1,4}/gi);o&&o.forEach(i=>{!i.includes(".local")&&i!=="0.0.0.0"&&t.add(i)})},n.createOffer().then(r=>n.setLocalDescription(r)).catch(()=>e([])),setTimeout(()=>{n.close(),e(Array.from(t))},2e3)}catch{e([])}})}function cg(){const e={webdriver:!!navigator.webdriver,headless:!1,phantom:!1,selenium:!1,puppeteer:!1,playwright:!1,automationControlled:!1,chromeProtocol:!1,inconsistentUA:!1,noPlugins:!1,noLanguages:!1,suspiciousScreen:!1,missingAPIs:!1};e.headless=/HeadlessChrome/.test(navigator.userAgent)||navigator.webdriver===!0||!window.chrome?.runtime,e.phantom=!!(window.callPhantom||window._phantom||window.phantom),e.selenium=!!(window.__selenium_unwrapped||window.__webdriver_evaluate||window.__driver_evaluate||document.documentElement.getAttribute("selenium")||document.documentElement.getAttribute("webdriver")||document.documentElement.getAttribute("driver")),e.puppeteer=!!(window.__puppeteer_evaluation_script__||navigator.userAgent.includes("puppeteer")),e.playwright=!!(window.__playwright||window.__pw_manual),e.automationControlled=!!(navigator.webdriver||window.cdc_adoQpoasnfa76pfcZLmcfl_Array||window.cdc_adoQpoasnfa76pfcZLmcfl_Promise),e.chromeProtocol=!!(window.domAutomation||window.domAutomationController);const t=/Chrome/.test(navigator.userAgent)&&!/Edge|Edg/.test(navigator.userAgent);e.inconsistentUA=t&&!window.chrome,e.noPlugins=navigator.plugins.length===0,e.noLanguages=!navigator.languages||navigator.languages.length===0,e.suspiciousScreen=window.outerWidth===0||window.outerHeight===0||window.screen.width===0||window.screen.height===0,e.missingAPIs=typeof window.alert!="function"||typeof window.confirm!="function"||typeof window.prompt!="function";let n=0;return e.webdriver&&(n+=30),e.headless&&(n+=25),e.phantom&&(n+=40),e.selenium&&(n+=35),e.puppeteer&&(n+=35),e.playwright&&(n+=35),e.automationControlled&&(n+=30),e.chromeProtocol&&(n+=25),e.inconsistentUA&&(n+=15),e.noPlugins&&(n+=10),e.noLanguages&&(n+=10),e.suspiciousScreen&&(n+=20),e.missingAPIs&&(n+=20),{isBot:n>=30,confidence:Math.min(100,n),signals:e}}async function lg(){const[e,t,n,r]=await Promise.all([tg(),ng(),ig(),ag()]);return{gpu:eg()||void 0,voiceHash:e?.hash,voiceCount:e?.count,mediaDevices:t||void 0,mathHash:rg(),codecHash:og(),drm:n,capabilities:sg(),webrtcIPs:r.length>0?r:void 0,bot:cg()}}const aE=Object.freeze(Object.defineProperty({__proto__:null,collectBatteryData:Gf,collectBrowserData:Vf,collectEnhancedFingerprint:lg,collectHardwareData:Wf,collectScreenData:zf,detectBot:cg,detectFonts:Yf,generateAudioFingerprint:Xf,generateCanvasFingerprint:Kf,generateDeviceFingerprint:iE,generateWebGLFingerprint:Jf,getCodecFingerprint:og,getDRMSupport:ig,getGPUInfo:eg,getHardwareCapabilities:sg,getMathFingerprint:rg,getMediaDevicesCount:ng,getStorageIds:Zf,getVoiceFingerprint:tg,getWebRTCIPs:ag,isFingerprintingBlocked:sE},Symbol.toStringTag,{value:"Module"}))})();
