@syntrologie/runtime-sdk 2.8.0-canary.251 → 2.8.0-canary.252

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -500,7 +500,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
500
500
  .runtimeRef=${this.runtimeRef}
501
501
  ></syntro-tile-stack>`:J}
502
502
  </div>
503
- `}};hl.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",hl);function fl(r,e,t="merge"){return t==="first-match"?$C(r,e):PC(r,e)}function $C(r,e){for(let t of e){let n=r.getFeatureValue?.(t,null);if(!n||typeof n!="object")continue;let i=n,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return qv([i])}return null}function PC(r,e){let t=[];for(let n of e){let i=r.getFeatureValue?.(n,null);if(!i||typeof i!="object")continue;let s=i,o=s.tiles&&s.tiles.length>0,a=s.actions&&s.actions.length>0;(o||a)&&t.push(s)}return t.length===0?null:qv(t)}function qv(r){let e=[],t=[],n=new Set,i,s,o,a,l,c,d,p;for(let h of r){if(h.tiles&&e.push(...h.tiles),h.actions)for(let f of h.actions){let v=f.label;if(v){if(n.has(v))continue;n.add(v)}t.push(f)}i??(i=h.fetchedAt),s??(s=h.schemaVersion),o??(o=h.configVersion),a??(a=h.canvasTitle),l??(l=h.displayMode),c??(c=h.theme),d??(d=h.launcher),p??(p=h.meta)}return{tiles:e,actions:t,fetchedAt:i??new Date().toISOString(),...s&&{schemaVersion:s},...o&&{configVersion:o},...a&&{canvasTitle:a},...l&&{displayMode:l},...c&&{theme:c},...d&&{launcher:d},...p&&{meta:p}}}var ld=!1;function Zv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function cd(r){if(Zv()){ld=!0;return}ld=r??!1}function OC(){return Zv()?!0:ld}function G(r,e,t){OC()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function st(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function gl(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var ml=class{constructor(e){this.config=e;this.counters=new Map;this.histograms=new Map;this.windowStartMs=Date.now();this.timer=null;this.pagehideHandler=null;this.runtime=null;this.adapterCleanup=null;this.resource=e.resource,this.flushIntervalMs=e.flushIntervalMs??6e4}bindRuntime(e){this.runtime=e}attachAdapterCleanup(e){this.adapterCleanup=e}increment(e,t=1){this.counters.set(e,(this.counters.get(e)??0)+t)}snapshotCounters(){let e={};for(let[t,n]of this.counters)e[t]=n;return e}recordHistogram(e,t){let n=this.histograms.get(e)??[];n.push(t),this.histograms.set(e,n)}snapshotHistograms(){let e={};for(let[t,n]of this.histograms){if(n.length===0)continue;let i=[...n].sort((s,o)=>s-o);e[t]={count:i.length,p50:Gv(i,.5),p95:Gv(i,.95)}}return e}async flush(){let e=this.snapshotCounters(),t=this.snapshotHistograms();if(!(Object.keys(e).length>0||Object.keys(t).length>0))return;let i=null,s="";try{i=this.runtime?.getSurface()??null}catch{}try{s=this.runtime?.getSessionId()??""}catch{}let o={resource:{...this.resource,sessionId:s,surfaceType:i?.type??"unknown",surfaceHost:i?.host??"unknown",surfaceDevice:i?.device??"unknown",surfaceMode:i?.mode??"unknown"},windowSeconds:Math.max(1,Math.round((Date.now()-this.windowStartMs)/1e3)),windowStartUnixMs:this.windowStartMs,counters:e,histograms:t};this.counters.clear(),this.histograms.clear(),this.windowStartMs=Date.now();try{await this.config.emit(o)}catch{}}start(){this.timer===null&&(this.timer=setInterval(()=>{this.flush()},this.flushIntervalMs),typeof window<"u"&&(this.pagehideHandler=()=>{this.flush()},window.addEventListener("pagehide",this.pagehideHandler)))}stop(){if(this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.pagehideHandler!==null&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pagehideHandler),this.pagehideHandler=null),this.adapterCleanup!==null){try{this.adapterCleanup()}catch{}this.adapterCleanup=null}}};function Gv(r,e){if(r.length===0)return 0;let t=(r.length-1)*e,n=Math.floor(t),i=Math.ceil(t);return n===i?r[n]:r[n]+(r[i]-r[n])*(t-n)}var ro=null;function ud(r){return ro?.stop(),ro=new ml(r),ro.start(),ro}function nr(){return ro}var Sr=(r,e)=>({key:r,value:{stringValue:e}}),dd=(r,e)=>({key:r,value:{intValue:Math.round(e)}}),Kv=(r,e)=>({key:r,value:{doubleValue:e}});function LC(r){let{resource:e,counters:t,histograms:n,windowSeconds:i,windowStartUnixMs:s}=r,o=[Sr("service.name",e.serviceName),Sr("service.version",e.serviceVersion),Sr("syntro.posthog_key",e.posthogKey),Sr("syntro.session_id",e.sessionId),Sr("syntro.surface_type",e.surfaceType),Sr("syntro.surface_host",e.surfaceHost),Sr("syntro.surface_device",e.surfaceDevice),Sr("syntro.surface_mode",e.surfaceMode),Sr("syntro.host_origin",e.hostOrigin)],a=[dd("window_seconds",i)];for(let[d,p]of Object.entries(t))p!==void 0&&a.push(dd(d,p));for(let[d,p]of Object.entries(n))p!==void 0&&(a.push(dd(`${d}_count`,p.count)),a.push(Kv(`${d}_p50`,p.p50)),a.push(Kv(`${d}_p95`,p.p95)));let l=`${Date.now()}000000`,c=`${s}000000`;return{resourceLogs:[{resource:{attributes:o},scopeLogs:[{scope:{name:"syntro.sdk.health"},logRecords:[{timeUnixNano:c,observedTimeUnixNano:l,severityText:"INFO",body:{stringValue:"sdk_health_window"},attributes:a}]}]}]}}function pd(r){let e=r.fetchImpl??fetch;return async t=>{let n=JSON.stringify(LC(t)),i=()=>e(r.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0,mode:"cors"});try{let s=await i();if(!s.ok&&s.status>=500)try{await i()}catch{}}catch{try{await i()}catch{}}}}function NC(){if(typeof document>"u")return;let r=document.currentScript;if(r?.src)return r.src;try{let e=Array.from(document.scripts);for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.src;if(typeof n=="string"&&(n.includes("runtime-sdk")||n.includes("smart-canvas")))return n}}catch{}}var hd=NC();function fd(){if(!hd)return;let r=hd.lastIndexOf("/");if(r!==-1)return hd.substring(0,r+1)}var iy=-1,Ii=r=>{addEventListener("pageshow",(e=>{e.persisted&&(iy=e.timeStamp,r(e))}),!0)},ir=(r,e,t,n)=>{let i,s;return o=>{e.value>=0&&(o||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(e.value,t),r(e)))}},Sd=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},kd=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},no=()=>kd()?.activationStart??0,sr=(r,e=-1)=>{let t=kd(),n="navigate";return iy>=0?n="back-forward-cache":t&&(document.prerendering||no()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},gd=new WeakMap;function Ed(r,e){return gd.get(r)||gd.set(r,new e),gd.get(r)}var vd=class{constructor(){de(this,"t");de(this,"i",0);de(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},io=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},Cd=r=>{let e=!1;return()=>{e||(r(),e=!0)}},Ri=-1,sy=new Set,Yv=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,yd=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of sy)e();isFinite(Ri)||(Ri=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",yd,!0))}},yl=()=>{if(Ri<0){let r=no();Ri=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??Yv(),addEventListener("visibilitychange",yd,!0),addEventListener("prerenderingchange",yd,!0),Ii((()=>{setTimeout((()=>{Ri=Yv()}))}))}return{get firstHiddenTime(){return Ri},onHidden(r){sy.add(r)}}},bl=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},Xv=[1800,3e3],Ad=(r,e={})=>{bl((()=>{let t=yl(),n,i=sr("FCP"),s=io("paint",(o=>{for(let a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime<t.firstHiddenTime&&(i.value=Math.max(a.startTime-no(),0),i.entries.push(a),n(!0)))}));s&&(n=ir(r,i,Xv,e.reportAllChanges),Ii((o=>{i=sr("FCP"),n=ir(r,i,Xv,e.reportAllChanges),Sd((()=>{i.value=performance.now()-o.timeStamp,n(!0)}))})))}))},Jv=[.1,.25],oy=(r,e={})=>{let t=yl();Ad(Cd((()=>{let n,i=sr("CLS",0),s=Ed(e,vd),o=l=>{for(let c of l)s.h(c);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},a=io("layout-shift",o);a&&(n=ir(r,i,Jv,e.reportAllChanges),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ii((()=>{s.i=0,i=sr("CLS",0),n=ir(r,i,Jv,e.reportAllChanges),Sd((()=>n()))})),setTimeout(n))})))},ay=0,md=1/0,vl=0,FC=r=>{for(let e of r)e.interactionId&&(md=Math.min(md,e.interactionId),vl=Math.max(vl,e.interactionId),ay=vl?(vl-md)/7+1:0)},bd,Qv=()=>bd?ay:performance.interactionCount??0,DC=()=>{"interactionCount"in performance||bd||(bd=io("event",FC,{type:"event",buffered:!0,durationThreshold:0}))},ey=0,_d=class{constructor(){de(this,"u",[]);de(this,"l",new Map);de(this,"m");de(this,"p")}v(){ey=Qv(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Qv()-ey)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},ly=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=Cd(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},ty=[200,500],cy=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=yl();bl((()=>{DC();let n,i=sr("INP"),s=Ed(e,_d),o=l=>{ly((()=>{for(let d of l)s.h(d);let c=s.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=io("event",o,{durationThreshold:e.durationThreshold??40});n=ir(r,i,ty,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ii((()=>{s.v(),i=sr("INP"),n=ir(r,i,ty,e.reportAllChanges)})))}))},xd=class{constructor(){de(this,"m")}h(e){this.m?.(e)}},ry=[2500,4e3],uy=(r,e={})=>{bl((()=>{let t=yl(),n,i=sr("LCP"),s=Ed(e,xd),o=l=>{e.reportAllChanges||(l=l.slice(-1));for(let c of l)s.h(c),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-no(),0),i.entries=[c],n())},a=io("largest-contentful-paint",o);if(a){n=ir(r,i,ry,e.reportAllChanges);let l=Cd((()=>{o(a.takeRecords()),a.disconnect(),n(!0)})),c=d=>{d.isTrusted&&(ly(l),removeEventListener(d.type,c,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,c,{capture:!0});Ii((d=>{i=sr("LCP"),n=ir(r,i,ry,e.reportAllChanges),Sd((()=>{i.value=performance.now()-d.timeStamp,n(!0)}))}))}}))},ny=[800,1800],wd=r=>{document.prerendering?bl((()=>wd(r))):document.readyState!=="complete"?addEventListener("load",(()=>wd(r)),!0):setTimeout(r)},dy=(r,e={})=>{let t=sr("TTFB"),n=ir(r,t,ny,e.reportAllChanges);wd((()=>{let i=kd();i&&(t.value=Math.max(i.responseStart-no(),0),t.entries=[i],n(!0),Ii((()=>{t=sr("TTFB",0),n=ir(r,t,ny,e.reportAllChanges),n(!0)})))}))};var py="__syntro_vitals_bound",_l="__syntro_vitals_current_reporter";function Td(r,e){if(typeof window>"u")return()=>{};let t=window;t[_l]=r;let n=null,i=e?.attributedScriptUrlPrefix;if(i&&"PerformanceObserver"in window)try{n=new PerformanceObserver(s=>{let o=t[_l];if(o)for(let a of s.getEntries()){let l=a.attribution;if(!l)continue;l.some(d=>(d.containerSrc??d.name??"").startsWith(i))&&(o.increment("longtasks_self_count"),o.increment("longtasks_self_blocking_ms",Math.round(a.duration)))}}),n.observe({type:"longtask",buffered:!0})}catch{n=null}if(!t[py]){t[py]=!0;let s=o=>a=>{t[_l]?.recordHistogram(o,a.value)};uy(s("lcp_ms")),cy(s("inp_ms")),Ad(s("fcp_ms")),dy(s("ttfb_ms")),oy(o=>{t[_l]?.recordHistogram("cls_score",o.value)})}return()=>{n?.disconnect()}}var so="2.8.0-canary.251";var Kr="2.0";var HC=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function BC(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",r),!1):HC.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] Config URI host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid config URI:",r),!1}}function VC(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var hy="syntro_config_cache",UC=1440*60*1e3;function fy(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function jC(r,e){if(fy())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(hy,JSON.stringify(t))}catch{}}function WC(r){if(!fy())return null;try{let e=localStorage.getItem(hy);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==r||Date.now()-t.timestamp>UC?null:t.config}catch{return null}}var Rd=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function zC(r,e,t){if(e){let n=r.getFeatureValue?.(e,null);if(n&&typeof n=="object"){let i=n.variant_flags;if(i&&i.length>0)return i}}if(r.getAllFeatures){let n=r.getAllFeatures();return t?Object.keys(n).filter(i=>i.startsWith(t)):Object.keys(n)}return[]}var Mi=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let h=e.getFeatureValue?.(i,null);if(h&&typeof h=="object")return G("SmartCanvas Config","Resolved config directly from feature flag",h),h}if(e&&(s||o||e.getAllFeatures)){let h=zC(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",h.length,"keys found"),h.length>0){let f=fl(e,h);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",f?`tiles=${f.tiles?.length}`:"null"),f)return G("SmartCanvas Config","Resolved config from variant flags",f),f}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=Rd({configUri:r,experiments:e,featureKey:t});if(!l)return G("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!BC(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(VC(l)?"include":"omit"),d=performance.now(),p=!1;try{let h=await fetch(l,{credentials:c,headers:{"X-SDK-Version":so,"X-SDK-Schema-Version":Kr}});if(!h.ok)throw nr()?.increment("flag_fetch_errors"),p=!0,new Error(`SmartCanvas: failed to fetch config (${h.status})`);let f=await h.json(),v=performance.now()-d;return nr()?.increment("flag_fetch_count"),nr()?.recordHistogram("flag_fetch_latency_ms",v),G("SmartCanvas Config","Fetched config from URI",f),a&&jC(f,a),f}catch(h){if(p||nr()?.increment("flag_fetch_errors"),a){let f=WC(a);if(f)return G("SmartCanvas Config","Serving config from offline cache"),f}throw h}};var Id=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let n=sessionStorage?.getItem("syntro:editor:panel-open");n!==null&&(t=JSON.parse(n))}catch{}this.state={open:t}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOpen(e){if(this.state.open!==e){this.state={...this.state,open:e};try{sessionStorage?.setItem("syntro:editor:panel-open",JSON.stringify(e))}catch{}this.emit()}}toggle(){this.setOpen(!this.state.open)}emit(){for(let e of this.listeners)e(this.state)}},gy=r=>new Id(r);var Wt={white:"#ffffff",black:"#000000"},oe={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},k={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},ke={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Qe={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Pe={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},or={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},oo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},ao={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},lo={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var xt={primary:k[10],secondary:k[9],tertiary:k[8]},VL={primary:k[2],secondary:k[0]},Md={primary:k[4],secondary:k[3]},xl={primary:{text:Wt.white,icon:Wt.white,border:oe[3],backgroundDefault:oe[3],backgroundHover:oe[2]},neutral:{text:k[10],textHover:Wt.white,icon:k[10],iconHover:Wt.white,border:k[4],background:k[2]},link:{text:Wt.white,icon:Wt.white,hover:oe[5]},error:{text:Pe[5],hover:Pe[6]},success:{text:ke[5],hover:ke[6]}},UL={slateGrey:{content:k[10],pillOutline:k[10],borderPrimary:k[5],borderSecondary:k[5],background:k[3]},brand:{content:oe[9],pillOutline:oe[9],borderPrimary:oe[6],borderSecondary:oe[6],background:oe[0]},red:{content:Pe[8],pillOutline:Pe[4],borderPrimary:Pe[2],borderSecondary:Pe[2],background:Pe[0]},yellow:{content:Qe[8],pillOutline:Qe[4],borderPrimary:Qe[2],borderSecondary:Qe[2],background:Qe[0]},green:{content:ke[8],pillOutline:ke[4],borderPrimary:ke[2],borderSecondary:ke[2],background:ke[0]},purple:{content:ao[8],pillOutline:ao[4],borderPrimary:ao[2],borderSecondary:ao[2],background:ao[0]},blue:{content:or[8],pillOutline:or[4],borderPrimary:or[2],borderSecondary:or[2],background:or[0]},orange:{content:oo[8],pillOutline:oo[4],borderPrimary:oo[2],borderSecondary:oo[2],background:oo[0]},pink:{content:lo[8],pillOutline:lo[4],borderPrimary:lo[2],borderSecondary:lo[2],background:lo[0]}},jL={green:{content:ke[8],border:ke[2],background:ke[0]},yellow:{content:Qe[8],border:Qe[2],background:Qe[0]},red:{content:Pe[8],border:Pe[2],background:Pe[0]}},WL={green:{content:ke[1],background:ke[9]},yellow:{content:Qe[1],background:Qe[9]},red:{content:Pe[1],background:Pe[9]}},zL={content:k[10],border:k[4],background:k[3]},qL={backgroundDefault:k[2],backgroundHover:k[1],selected:k[3]},ZL={background:k[2],icon:k[10],borderDefault:k[4],borderSelected:oe[3],textLabel:k[9],textPlaceholder:k[8],textHint:k[8]},GL={backgroundDefault:k[2],backgroundDisabled:k[0],textLabel:k[9],textPlaceholder:k[8],textHint:k[8],textError:Pe[5],iconDefault:k[9],iconPlaceholder:k[10],iconError:Pe[5],borderDefault:k[4],borderSelected:oe[3],borderError:Pe[5]},KL={handleDefault:Wt.white,handleDisabled:k[10],off:{backgroundDefault:k[4],backgroundHover:k[5],backgroundDisabled:k[4]},on:{backgroundDefault:ke[3],backgroundHover:ke[2],backgroundDisabled:k[4]}},YL={off:{backgroundDefault:"#00000000",backgroundHover:k[5],backgroundDisabled:k[2],border:k[6]},on:{backgroundDefault:ke[0],backgroundHover:ke[1],backgroundDisabled:k[2],border:ke[3]}},XL={content:k[10],background:k[4]},JL={background:k[4],active:ke[3]},QL={background:k[1],content:k[9],border:k[4]},e4={backgroundDefault:k[1],backgroundHover:k[3],backgroundActive:k[4],border:k[4],contentPrimary:k[10],contentSecondary:k[9],contentTertiary:k[8]},t4={background:k[1],content:k[9],border:k[4]},r4={activeBackground:k[3],activeContent:oe[5],inactiveContent:k[9],border:k[4]},n4={header:{textDefault:k[9],textHover:k[8],backgroundDefault:k[1]},border:k[4],cell:{textPrimary:k[10],textSecondary:k[9],backgroundDefault:k[2],backgroundHover:k[1]}},i4={textPrimaryDefault:k[10],textPrimaryHover:k[10],textSecondaryDefault:k[8],textSecondaryHover:k[9],iconPrimary:k[10],iconSecondary:k[8]},s4={background:ke[1],active:ke[5]},o4={textDefault:k[10],textSelected:Wt.white,textDisabled:k[7],backgroundDefault:k[2],backgroundMiddle:k[3],backgroundSelected:oe[3],border:k[4]},a4=k[9];var d4={size:56,inset:12,background:Wt.black,color:Wt.white,border:`2px solid ${oe[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};function ae(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var k4={colorPrimary:oe[3],colorPrimaryHover:oe[4],colorPrimaryMuted:oe[0],colorBackground:ae(k[1],.95),colorBackgroundElevated:ae(k[3],.95),colorBackgroundSubtle:ae(k[0],.2),colorSurface:ae(k[4],.8),colorSurfaceHover:ae(k[5],.8),colorText:xt.primary,colorTextSecondary:xt.secondary,colorTextMuted:xt.tertiary,colorTextInverse:k[1],colorBorder:Md.primary,colorBorderSubtle:Md.secondary,colorSuccess:ke[4],colorSuccessMuted:ke[0],colorWarning:Qe[4],colorWarningMuted:Qe[0],colorError:Pe[4],colorErrorMuted:Pe[0],colorInfo:or[4],colorInfoMuted:or[0],colorNotification:oe[4],colorNotificationMuted:ae(oe[4],.4),glassBackground:ae(k[1],.6),glassBackgroundHover:ae(k[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},E4={colorPrimary:oe[3],colorPrimaryHover:oe[2],colorPrimaryMuted:ae(oe[5],.1),colorBackground:ae(k[12],.95),colorBackgroundElevated:ae(k[11],.95),colorBackgroundSubtle:ae(k[0],.02),colorSurface:ae(k[11],.6),colorSurfaceHover:ae(k[10],.6),colorText:k[1],colorTextSecondary:k[6],colorTextMuted:k[8],colorTextInverse:k[12],colorBorder:ae(k[0],.12),colorBorderSubtle:ae(k[0],.06),colorSuccess:ke[4],colorSuccessMuted:ae(ke[4],.12),colorWarning:Qe[4],colorWarningMuted:ae(Qe[4],.12),colorError:Pe[4],colorErrorMuted:ae(Pe[4],.12),colorInfo:or[4],colorInfoMuted:ae(or[4],.12),colorNotification:oe[3],colorNotificationMuted:ae(oe[3],.4),glassBackground:ae(k[12],.7),glassBackgroundHover:ae(k[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function qC(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var my={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:oe[3],colorPrimaryHover:oe[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",padding:"0"},launcher:{background:xl.primary.backgroundDefault,backgroundHover:xl.primary.backgroundHover,color:xl.primary.icon,size:"56px",shadow:`0 8px 32px ${ae(k[0],.6)}`,borderRadius:"9999px"},tile:{background:ae(k[1],.6),backgroundHover:ae(k[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:xt.primary,textColor:xt.secondary,iconBackground:`linear-gradient(135deg, ${oe[3]} 0%, ${oe[3]}cc 100%)`,iconShadow:`0 2px 8px ${oe[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[1],.6),textColor:xt.primary,titleColor:xt.primary,arrowColor:ae(k[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${oe[3]}`},notification:{background:ae(k[0],.95),textColor:xt.primary,textSecondaryColor:xt.secondary,border:`1px solid ${k[5]}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Pe[4],iconBackground:ae(oe[3],.15),progressGradient:`linear-gradient(90deg, ${oe[3]}, ${oe[4]})`},content:{background:ae(k[3],.8),backgroundHover:ae(k[5],.6),border:`1px solid ${ae(k[5],.5)}`,borderRadius:"8px",textColor:xt.primary,textSecondaryColor:xt.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:ae(k[3],.8),searchColor:xt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},vy={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:oe[3],colorPrimaryHover:oe[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.3)",padding:"0"},launcher:{background:oe[3],backgroundHover:oe[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:ae(k[12],.7),backgroundHover:ae(k[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:k[1],textColor:k[6],iconBackground:`linear-gradient(135deg, ${oe[3]} 0%, ${oe[3]}cc 100%)`,iconShadow:`0 2px 8px ${oe[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[12],.7),textColor:k[1],titleColor:k[1],arrowColor:ae(k[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${oe[3]}`},notification:{background:ae(k[12],.95),textColor:k[1],textSecondaryColor:k[6],border:`1px solid ${ae(k[0],.12)}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Pe[4],iconBackground:ae(oe[3],.1),progressGradient:`linear-gradient(90deg, ${oe[3]}, ${oe[2]})`},content:{background:ae(k[12],.8),backgroundHover:ae(k[11],.6),border:`1px solid ${k[11]}`,borderRadius:"8px",textColor:k[1],textSecondaryColor:k[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:k[12],searchColor:k[1],chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}};function yy(r){let e=r.mode==="light"?vy:my;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content},mobile:{canvas:{...e.mobile.canvas,...r.mobile?.canvas}}}}function by(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?vy:my;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content},mobile:{canvas:{...n.mobile.canvas,...r.mobile?.canvas,...e.mobile?.canvas}}}}var ZC=["canvas","launcher","tile","overlay","notification","content"];function _y(r){let e={};r.fontFamily&&(e["--sc-font-family"]=r.fontFamily),r.colorPrimary&&(e["--sc-color-primary"]=r.colorPrimary),r.colorPrimaryHover&&(e["--sc-color-primary-hover"]=r.colorPrimaryHover),r.borderRadius&&(e["--sc-border-radius"]=r.borderRadius);for(let t of ZC){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${qC(i)}`]=s)}return e}var Yr,Zn,Gn,kr,Er,$d,wl,co=class{constructor(e,t,n){me(this,Er);me(this,Yr);me(this,Zn);me(this,Gn);me(this,kr);ne(this,Yr,e),ne(this,Zn,t??{}),ne(this,Gn,n),ne(this,kr,be(this,Er,$d).call(this)),e.addController(this)}get config(){return W(this,kr).config}get mode(){return W(this,kr).mode}get cssVariables(){return W(this,kr).cssVariables}hostConnected(){be(this,Er,wl).call(this)}hostDisconnected(){}hostUpdated(){be(this,Er,wl).call(this)}setThemeConfig(e,t){ne(this,Zn,e),ne(this,Gn,t),ne(this,kr,be(this,Er,$d).call(this)),be(this,Er,wl).call(this),W(this,Yr).requestUpdate()}};Yr=new WeakMap,Zn=new WeakMap,Gn=new WeakMap,kr=new WeakMap,Er=new WeakSet,$d=function(){let e=W(this,Gn)?by(W(this,Gn),W(this,Zn)):yy(W(this,Zn)),t=_y(e);return{config:e,mode:e.mode,cssVariables:t}},wl=function(){let e=W(this,Yr).shadowRoot??("renderRoot"in W(this,Yr)?W(this,Yr).renderRoot:null);if(!e||!(e instanceof ShadowRoot))return;let t=e.querySelector("#sc-theme-vars");t||(t=document.createElement("style"),t.id="sc-theme-vars",e.insertBefore(t,e.firstChild));let n=Object.entries(W(this,kr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
503
+ `}};hl.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",hl);function fl(r,e,t="merge"){return t==="first-match"?$C(r,e):PC(r,e)}function $C(r,e){for(let t of e){let n=r.getFeatureValue?.(t,null);if(!n||typeof n!="object")continue;let i=n,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return qv([i])}return null}function PC(r,e){let t=[];for(let n of e){let i=r.getFeatureValue?.(n,null);if(!i||typeof i!="object")continue;let s=i,o=s.tiles&&s.tiles.length>0,a=s.actions&&s.actions.length>0;(o||a)&&t.push(s)}return t.length===0?null:qv(t)}function qv(r){let e=[],t=[],n=new Set,i,s,o,a,l,c,d,p;for(let h of r){if(h.tiles&&e.push(...h.tiles),h.actions)for(let f of h.actions){let v=f.label;if(v){if(n.has(v))continue;n.add(v)}t.push(f)}i??(i=h.fetchedAt),s??(s=h.schemaVersion),o??(o=h.configVersion),a??(a=h.canvasTitle),l??(l=h.displayMode),c??(c=h.theme),d??(d=h.launcher),p??(p=h.meta)}return{tiles:e,actions:t,fetchedAt:i??new Date().toISOString(),...s&&{schemaVersion:s},...o&&{configVersion:o},...a&&{canvasTitle:a},...l&&{displayMode:l},...c&&{theme:c},...d&&{launcher:d},...p&&{meta:p}}}var ld=!1;function Zv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function cd(r){if(Zv()){ld=!0;return}ld=r??!1}function OC(){return Zv()?!0:ld}function G(r,e,t){OC()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function st(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function gl(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var ml=class{constructor(e){this.config=e;this.counters=new Map;this.histograms=new Map;this.windowStartMs=Date.now();this.timer=null;this.pagehideHandler=null;this.runtime=null;this.adapterCleanup=null;this.resource=e.resource,this.flushIntervalMs=e.flushIntervalMs??6e4}bindRuntime(e){this.runtime=e}attachAdapterCleanup(e){this.adapterCleanup=e}increment(e,t=1){this.counters.set(e,(this.counters.get(e)??0)+t)}snapshotCounters(){let e={};for(let[t,n]of this.counters)e[t]=n;return e}recordHistogram(e,t){let n=this.histograms.get(e)??[];n.push(t),this.histograms.set(e,n)}snapshotHistograms(){let e={};for(let[t,n]of this.histograms){if(n.length===0)continue;let i=[...n].sort((s,o)=>s-o);e[t]={count:i.length,p50:Gv(i,.5),p95:Gv(i,.95)}}return e}async flush(){let e=this.snapshotCounters(),t=this.snapshotHistograms();if(!(Object.keys(e).length>0||Object.keys(t).length>0))return;let i=null,s="";try{i=this.runtime?.getSurface()??null}catch{}try{s=this.runtime?.getSessionId()??""}catch{}let o={resource:{...this.resource,sessionId:s,surfaceType:i?.type??"unknown",surfaceHost:i?.host??"unknown",surfaceDevice:i?.device??"unknown",surfaceMode:i?.mode??"unknown"},windowSeconds:Math.max(1,Math.round((Date.now()-this.windowStartMs)/1e3)),windowStartUnixMs:this.windowStartMs,counters:e,histograms:t};this.counters.clear(),this.histograms.clear(),this.windowStartMs=Date.now();try{await this.config.emit(o)}catch{}}start(){this.timer===null&&(this.timer=setInterval(()=>{this.flush()},this.flushIntervalMs),typeof window<"u"&&(this.pagehideHandler=()=>{this.flush()},window.addEventListener("pagehide",this.pagehideHandler)))}stop(){if(this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.pagehideHandler!==null&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pagehideHandler),this.pagehideHandler=null),this.adapterCleanup!==null){try{this.adapterCleanup()}catch{}this.adapterCleanup=null}}};function Gv(r,e){if(r.length===0)return 0;let t=(r.length-1)*e,n=Math.floor(t),i=Math.ceil(t);return n===i?r[n]:r[n]+(r[i]-r[n])*(t-n)}var ro=null;function ud(r){return ro?.stop(),ro=new ml(r),ro.start(),ro}function nr(){return ro}var Sr=(r,e)=>({key:r,value:{stringValue:e}}),dd=(r,e)=>({key:r,value:{intValue:Math.round(e)}}),Kv=(r,e)=>({key:r,value:{doubleValue:e}});function LC(r){let{resource:e,counters:t,histograms:n,windowSeconds:i,windowStartUnixMs:s}=r,o=[Sr("service.name",e.serviceName),Sr("service.version",e.serviceVersion),Sr("syntro.posthog_key",e.posthogKey),Sr("syntro.session_id",e.sessionId),Sr("syntro.surface_type",e.surfaceType),Sr("syntro.surface_host",e.surfaceHost),Sr("syntro.surface_device",e.surfaceDevice),Sr("syntro.surface_mode",e.surfaceMode),Sr("syntro.host_origin",e.hostOrigin)],a=[dd("window_seconds",i)];for(let[d,p]of Object.entries(t))p!==void 0&&a.push(dd(d,p));for(let[d,p]of Object.entries(n))p!==void 0&&(a.push(dd(`${d}_count`,p.count)),a.push(Kv(`${d}_p50`,p.p50)),a.push(Kv(`${d}_p95`,p.p95)));let l=`${Date.now()}000000`,c=`${s}000000`;return{resourceLogs:[{resource:{attributes:o},scopeLogs:[{scope:{name:"syntro.sdk.health"},logRecords:[{timeUnixNano:c,observedTimeUnixNano:l,severityText:"INFO",body:{stringValue:"sdk_health_window"},attributes:a}]}]}]}}function pd(r){let e=r.fetchImpl??fetch;return async t=>{let n=JSON.stringify(LC(t)),i=()=>e(r.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0,mode:"cors"});try{let s=await i();if(!s.ok&&s.status>=500)try{await i()}catch{}}catch{try{await i()}catch{}}}}function NC(){if(typeof document>"u")return;let r=document.currentScript;if(r?.src)return r.src;try{let e=Array.from(document.scripts);for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.src;if(typeof n=="string"&&(n.includes("runtime-sdk")||n.includes("smart-canvas")))return n}}catch{}}var hd=NC();function fd(){if(!hd)return;let r=hd.lastIndexOf("/");if(r!==-1)return hd.substring(0,r+1)}var iy=-1,Ii=r=>{addEventListener("pageshow",(e=>{e.persisted&&(iy=e.timeStamp,r(e))}),!0)},ir=(r,e,t,n)=>{let i,s;return o=>{e.value>=0&&(o||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(e.value,t),r(e)))}},Sd=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},kd=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},no=()=>kd()?.activationStart??0,sr=(r,e=-1)=>{let t=kd(),n="navigate";return iy>=0?n="back-forward-cache":t&&(document.prerendering||no()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},gd=new WeakMap;function Ed(r,e){return gd.get(r)||gd.set(r,new e),gd.get(r)}var vd=class{constructor(){de(this,"t");de(this,"i",0);de(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},io=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},Cd=r=>{let e=!1;return()=>{e||(r(),e=!0)}},Ri=-1,sy=new Set,Yv=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,yd=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of sy)e();isFinite(Ri)||(Ri=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",yd,!0))}},yl=()=>{if(Ri<0){let r=no();Ri=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??Yv(),addEventListener("visibilitychange",yd,!0),addEventListener("prerenderingchange",yd,!0),Ii((()=>{setTimeout((()=>{Ri=Yv()}))}))}return{get firstHiddenTime(){return Ri},onHidden(r){sy.add(r)}}},bl=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},Xv=[1800,3e3],Ad=(r,e={})=>{bl((()=>{let t=yl(),n,i=sr("FCP"),s=io("paint",(o=>{for(let a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime<t.firstHiddenTime&&(i.value=Math.max(a.startTime-no(),0),i.entries.push(a),n(!0)))}));s&&(n=ir(r,i,Xv,e.reportAllChanges),Ii((o=>{i=sr("FCP"),n=ir(r,i,Xv,e.reportAllChanges),Sd((()=>{i.value=performance.now()-o.timeStamp,n(!0)}))})))}))},Jv=[.1,.25],oy=(r,e={})=>{let t=yl();Ad(Cd((()=>{let n,i=sr("CLS",0),s=Ed(e,vd),o=l=>{for(let c of l)s.h(c);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},a=io("layout-shift",o);a&&(n=ir(r,i,Jv,e.reportAllChanges),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ii((()=>{s.i=0,i=sr("CLS",0),n=ir(r,i,Jv,e.reportAllChanges),Sd((()=>n()))})),setTimeout(n))})))},ay=0,md=1/0,vl=0,FC=r=>{for(let e of r)e.interactionId&&(md=Math.min(md,e.interactionId),vl=Math.max(vl,e.interactionId),ay=vl?(vl-md)/7+1:0)},bd,Qv=()=>bd?ay:performance.interactionCount??0,DC=()=>{"interactionCount"in performance||bd||(bd=io("event",FC,{type:"event",buffered:!0,durationThreshold:0}))},ey=0,_d=class{constructor(){de(this,"u",[]);de(this,"l",new Map);de(this,"m");de(this,"p")}v(){ey=Qv(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Qv()-ey)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},ly=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=Cd(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},ty=[200,500],cy=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=yl();bl((()=>{DC();let n,i=sr("INP"),s=Ed(e,_d),o=l=>{ly((()=>{for(let d of l)s.h(d);let c=s.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=io("event",o,{durationThreshold:e.durationThreshold??40});n=ir(r,i,ty,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ii((()=>{s.v(),i=sr("INP"),n=ir(r,i,ty,e.reportAllChanges)})))}))},xd=class{constructor(){de(this,"m")}h(e){this.m?.(e)}},ry=[2500,4e3],uy=(r,e={})=>{bl((()=>{let t=yl(),n,i=sr("LCP"),s=Ed(e,xd),o=l=>{e.reportAllChanges||(l=l.slice(-1));for(let c of l)s.h(c),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-no(),0),i.entries=[c],n())},a=io("largest-contentful-paint",o);if(a){n=ir(r,i,ry,e.reportAllChanges);let l=Cd((()=>{o(a.takeRecords()),a.disconnect(),n(!0)})),c=d=>{d.isTrusted&&(ly(l),removeEventListener(d.type,c,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,c,{capture:!0});Ii((d=>{i=sr("LCP"),n=ir(r,i,ry,e.reportAllChanges),Sd((()=>{i.value=performance.now()-d.timeStamp,n(!0)}))}))}}))},ny=[800,1800],wd=r=>{document.prerendering?bl((()=>wd(r))):document.readyState!=="complete"?addEventListener("load",(()=>wd(r)),!0):setTimeout(r)},dy=(r,e={})=>{let t=sr("TTFB"),n=ir(r,t,ny,e.reportAllChanges);wd((()=>{let i=kd();i&&(t.value=Math.max(i.responseStart-no(),0),t.entries=[i],n(!0),Ii((()=>{t=sr("TTFB",0),n=ir(r,t,ny,e.reportAllChanges),n(!0)})))}))};var py="__syntro_vitals_bound",_l="__syntro_vitals_current_reporter";function Td(r,e){if(typeof window>"u")return()=>{};let t=window;t[_l]=r;let n=null,i=e?.attributedScriptUrlPrefix;if(i&&"PerformanceObserver"in window)try{n=new PerformanceObserver(s=>{let o=t[_l];if(o)for(let a of s.getEntries()){let l=a.attribution;if(!l)continue;l.some(d=>(d.containerSrc??d.name??"").startsWith(i))&&(o.increment("longtasks_self_count"),o.increment("longtasks_self_blocking_ms",Math.round(a.duration)))}}),n.observe({type:"longtask",buffered:!0})}catch{n=null}if(!t[py]){t[py]=!0;let s=o=>a=>{t[_l]?.recordHistogram(o,a.value)};uy(s("lcp_ms")),cy(s("inp_ms")),Ad(s("fcp_ms")),dy(s("ttfb_ms")),oy(o=>{t[_l]?.recordHistogram("cls_score",o.value)})}return()=>{n?.disconnect()}}var so="2.8.0-canary.252";var Kr="2.0";var HC=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function BC(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",r),!1):HC.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] Config URI host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid config URI:",r),!1}}function VC(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var hy="syntro_config_cache",UC=1440*60*1e3;function fy(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function jC(r,e){if(fy())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(hy,JSON.stringify(t))}catch{}}function WC(r){if(!fy())return null;try{let e=localStorage.getItem(hy);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==r||Date.now()-t.timestamp>UC?null:t.config}catch{return null}}var Rd=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function zC(r,e,t){if(e){let n=r.getFeatureValue?.(e,null);if(n&&typeof n=="object"){let i=n.variant_flags;if(i&&i.length>0)return i}}if(r.getAllFeatures){let n=r.getAllFeatures();return t?Object.keys(n).filter(i=>i.startsWith(t)):Object.keys(n)}return[]}var Mi=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let h=e.getFeatureValue?.(i,null);if(h&&typeof h=="object")return G("SmartCanvas Config","Resolved config directly from feature flag",h),h}if(e&&(s||o||e.getAllFeatures)){let h=zC(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",h.length,"keys found"),h.length>0){let f=fl(e,h);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",f?`tiles=${f.tiles?.length}`:"null"),f)return G("SmartCanvas Config","Resolved config from variant flags",f),f}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=Rd({configUri:r,experiments:e,featureKey:t});if(!l)return G("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!BC(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(VC(l)?"include":"omit"),d=performance.now(),p=!1;try{let h=await fetch(l,{credentials:c,headers:{"X-SDK-Version":so,"X-SDK-Schema-Version":Kr}});if(!h.ok)throw nr()?.increment("flag_fetch_errors"),p=!0,new Error(`SmartCanvas: failed to fetch config (${h.status})`);let f=await h.json(),v=performance.now()-d;return nr()?.increment("flag_fetch_count"),nr()?.recordHistogram("flag_fetch_latency_ms",v),G("SmartCanvas Config","Fetched config from URI",f),a&&jC(f,a),f}catch(h){if(p||nr()?.increment("flag_fetch_errors"),a){let f=WC(a);if(f)return G("SmartCanvas Config","Serving config from offline cache"),f}throw h}};var Id=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let n=sessionStorage?.getItem("syntro:editor:panel-open");n!==null&&(t=JSON.parse(n))}catch{}this.state={open:t}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOpen(e){if(this.state.open!==e){this.state={...this.state,open:e};try{sessionStorage?.setItem("syntro:editor:panel-open",JSON.stringify(e))}catch{}this.emit()}}toggle(){this.setOpen(!this.state.open)}emit(){for(let e of this.listeners)e(this.state)}},gy=r=>new Id(r);var Wt={white:"#ffffff",black:"#000000"},oe={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},k={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},ke={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Qe={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Pe={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},or={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},oo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},ao={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},lo={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var xt={primary:k[10],secondary:k[9],tertiary:k[8]},VL={primary:k[2],secondary:k[0]},Md={primary:k[4],secondary:k[3]},xl={primary:{text:Wt.white,icon:Wt.white,border:oe[3],backgroundDefault:oe[3],backgroundHover:oe[2]},neutral:{text:k[10],textHover:Wt.white,icon:k[10],iconHover:Wt.white,border:k[4],background:k[2]},link:{text:Wt.white,icon:Wt.white,hover:oe[5]},error:{text:Pe[5],hover:Pe[6]},success:{text:ke[5],hover:ke[6]}},UL={slateGrey:{content:k[10],pillOutline:k[10],borderPrimary:k[5],borderSecondary:k[5],background:k[3]},brand:{content:oe[9],pillOutline:oe[9],borderPrimary:oe[6],borderSecondary:oe[6],background:oe[0]},red:{content:Pe[8],pillOutline:Pe[4],borderPrimary:Pe[2],borderSecondary:Pe[2],background:Pe[0]},yellow:{content:Qe[8],pillOutline:Qe[4],borderPrimary:Qe[2],borderSecondary:Qe[2],background:Qe[0]},green:{content:ke[8],pillOutline:ke[4],borderPrimary:ke[2],borderSecondary:ke[2],background:ke[0]},purple:{content:ao[8],pillOutline:ao[4],borderPrimary:ao[2],borderSecondary:ao[2],background:ao[0]},blue:{content:or[8],pillOutline:or[4],borderPrimary:or[2],borderSecondary:or[2],background:or[0]},orange:{content:oo[8],pillOutline:oo[4],borderPrimary:oo[2],borderSecondary:oo[2],background:oo[0]},pink:{content:lo[8],pillOutline:lo[4],borderPrimary:lo[2],borderSecondary:lo[2],background:lo[0]}},jL={green:{content:ke[8],border:ke[2],background:ke[0]},yellow:{content:Qe[8],border:Qe[2],background:Qe[0]},red:{content:Pe[8],border:Pe[2],background:Pe[0]}},WL={green:{content:ke[1],background:ke[9]},yellow:{content:Qe[1],background:Qe[9]},red:{content:Pe[1],background:Pe[9]}},zL={content:k[10],border:k[4],background:k[3]},qL={backgroundDefault:k[2],backgroundHover:k[1],selected:k[3]},ZL={background:k[2],icon:k[10],borderDefault:k[4],borderSelected:oe[3],textLabel:k[9],textPlaceholder:k[8],textHint:k[8]},GL={backgroundDefault:k[2],backgroundDisabled:k[0],textLabel:k[9],textPlaceholder:k[8],textHint:k[8],textError:Pe[5],iconDefault:k[9],iconPlaceholder:k[10],iconError:Pe[5],borderDefault:k[4],borderSelected:oe[3],borderError:Pe[5]},KL={handleDefault:Wt.white,handleDisabled:k[10],off:{backgroundDefault:k[4],backgroundHover:k[5],backgroundDisabled:k[4]},on:{backgroundDefault:ke[3],backgroundHover:ke[2],backgroundDisabled:k[4]}},YL={off:{backgroundDefault:"#00000000",backgroundHover:k[5],backgroundDisabled:k[2],border:k[6]},on:{backgroundDefault:ke[0],backgroundHover:ke[1],backgroundDisabled:k[2],border:ke[3]}},XL={content:k[10],background:k[4]},JL={background:k[4],active:ke[3]},QL={background:k[1],content:k[9],border:k[4]},e4={backgroundDefault:k[1],backgroundHover:k[3],backgroundActive:k[4],border:k[4],contentPrimary:k[10],contentSecondary:k[9],contentTertiary:k[8]},t4={background:k[1],content:k[9],border:k[4]},r4={activeBackground:k[3],activeContent:oe[5],inactiveContent:k[9],border:k[4]},n4={header:{textDefault:k[9],textHover:k[8],backgroundDefault:k[1]},border:k[4],cell:{textPrimary:k[10],textSecondary:k[9],backgroundDefault:k[2],backgroundHover:k[1]}},i4={textPrimaryDefault:k[10],textPrimaryHover:k[10],textSecondaryDefault:k[8],textSecondaryHover:k[9],iconPrimary:k[10],iconSecondary:k[8]},s4={background:ke[1],active:ke[5]},o4={textDefault:k[10],textSelected:Wt.white,textDisabled:k[7],backgroundDefault:k[2],backgroundMiddle:k[3],backgroundSelected:oe[3],border:k[4]},a4=k[9];var d4={size:56,inset:12,background:Wt.black,color:Wt.white,border:`2px solid ${oe[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};function ae(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var k4={colorPrimary:oe[3],colorPrimaryHover:oe[4],colorPrimaryMuted:oe[0],colorBackground:ae(k[1],.95),colorBackgroundElevated:ae(k[3],.95),colorBackgroundSubtle:ae(k[0],.2),colorSurface:ae(k[4],.8),colorSurfaceHover:ae(k[5],.8),colorText:xt.primary,colorTextSecondary:xt.secondary,colorTextMuted:xt.tertiary,colorTextInverse:k[1],colorBorder:Md.primary,colorBorderSubtle:Md.secondary,colorSuccess:ke[4],colorSuccessMuted:ke[0],colorWarning:Qe[4],colorWarningMuted:Qe[0],colorError:Pe[4],colorErrorMuted:Pe[0],colorInfo:or[4],colorInfoMuted:or[0],colorNotification:oe[4],colorNotificationMuted:ae(oe[4],.4),glassBackground:ae(k[1],.6),glassBackgroundHover:ae(k[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},E4={colorPrimary:oe[3],colorPrimaryHover:oe[2],colorPrimaryMuted:ae(oe[5],.1),colorBackground:ae(k[12],.95),colorBackgroundElevated:ae(k[11],.95),colorBackgroundSubtle:ae(k[0],.02),colorSurface:ae(k[11],.6),colorSurfaceHover:ae(k[10],.6),colorText:k[1],colorTextSecondary:k[6],colorTextMuted:k[8],colorTextInverse:k[12],colorBorder:ae(k[0],.12),colorBorderSubtle:ae(k[0],.06),colorSuccess:ke[4],colorSuccessMuted:ae(ke[4],.12),colorWarning:Qe[4],colorWarningMuted:ae(Qe[4],.12),colorError:Pe[4],colorErrorMuted:ae(Pe[4],.12),colorInfo:or[4],colorInfoMuted:ae(or[4],.12),colorNotification:oe[3],colorNotificationMuted:ae(oe[3],.4),glassBackground:ae(k[12],.7),glassBackgroundHover:ae(k[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function qC(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var my={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:oe[3],colorPrimaryHover:oe[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",padding:"0"},launcher:{background:xl.primary.backgroundDefault,backgroundHover:xl.primary.backgroundHover,color:xl.primary.icon,size:"56px",shadow:`0 8px 32px ${ae(k[0],.6)}`,borderRadius:"9999px"},tile:{background:ae(k[1],.6),backgroundHover:ae(k[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:xt.primary,textColor:xt.secondary,iconBackground:`linear-gradient(135deg, ${oe[3]} 0%, ${oe[3]}cc 100%)`,iconShadow:`0 2px 8px ${oe[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[1],.6),textColor:xt.primary,titleColor:xt.primary,arrowColor:ae(k[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${oe[3]}`},notification:{background:ae(k[0],.95),textColor:xt.primary,textSecondaryColor:xt.secondary,border:`1px solid ${k[5]}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Pe[4],iconBackground:ae(oe[3],.15),progressGradient:`linear-gradient(90deg, ${oe[3]}, ${oe[4]})`},content:{background:ae(k[3],.8),backgroundHover:ae(k[5],.6),border:`1px solid ${ae(k[5],.5)}`,borderRadius:"8px",textColor:xt.primary,textSecondaryColor:xt.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:ae(k[3],.8),searchColor:xt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},vy={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:oe[3],colorPrimaryHover:oe[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.3)",padding:"0"},launcher:{background:oe[3],backgroundHover:oe[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:ae(k[12],.7),backgroundHover:ae(k[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:k[1],textColor:k[6],iconBackground:`linear-gradient(135deg, ${oe[3]} 0%, ${oe[3]}cc 100%)`,iconShadow:`0 2px 8px ${oe[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[12],.7),textColor:k[1],titleColor:k[1],arrowColor:ae(k[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${oe[3]}`},notification:{background:ae(k[12],.95),textColor:k[1],textSecondaryColor:k[6],border:`1px solid ${ae(k[0],.12)}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Pe[4],iconBackground:ae(oe[3],.1),progressGradient:`linear-gradient(90deg, ${oe[3]}, ${oe[2]})`},content:{background:ae(k[12],.8),backgroundHover:ae(k[11],.6),border:`1px solid ${k[11]}`,borderRadius:"8px",textColor:k[1],textSecondaryColor:k[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:k[12],searchColor:k[1],chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}};function yy(r){let e=r.mode==="light"?vy:my;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content},mobile:{canvas:{...e.mobile.canvas,...r.mobile?.canvas}}}}function by(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?vy:my;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content},mobile:{canvas:{...n.mobile.canvas,...r.mobile?.canvas,...e.mobile?.canvas}}}}var ZC=["canvas","launcher","tile","overlay","notification","content"];function _y(r){let e={};r.fontFamily&&(e["--sc-font-family"]=r.fontFamily),r.colorPrimary&&(e["--sc-color-primary"]=r.colorPrimary),r.colorPrimaryHover&&(e["--sc-color-primary-hover"]=r.colorPrimaryHover),r.borderRadius&&(e["--sc-border-radius"]=r.borderRadius);for(let t of ZC){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${qC(i)}`]=s)}return e}var Yr,Zn,Gn,kr,Er,$d,wl,co=class{constructor(e,t,n){me(this,Er);me(this,Yr);me(this,Zn);me(this,Gn);me(this,kr);ne(this,Yr,e),ne(this,Zn,t??{}),ne(this,Gn,n),ne(this,kr,be(this,Er,$d).call(this)),e.addController(this)}get config(){return W(this,kr).config}get mode(){return W(this,kr).mode}get cssVariables(){return W(this,kr).cssVariables}hostConnected(){be(this,Er,wl).call(this)}hostDisconnected(){}hostUpdated(){be(this,Er,wl).call(this)}setThemeConfig(e,t){ne(this,Zn,e),ne(this,Gn,t),ne(this,kr,be(this,Er,$d).call(this)),be(this,Er,wl).call(this),W(this,Yr).requestUpdate()}};Yr=new WeakMap,Zn=new WeakMap,Gn=new WeakMap,kr=new WeakMap,Er=new WeakSet,$d=function(){let e=W(this,Gn)?by(W(this,Gn),W(this,Zn)):yy(W(this,Zn)),t=_y(e);return{config:e,mode:e.mode,cssVariables:t}},wl=function(){let e=W(this,Yr).shadowRoot??("renderRoot"in W(this,Yr)?W(this,Yr).renderRoot:null);if(!e||!(e instanceof ShadowRoot))return;let t=e.querySelector("#sc-theme-vars");t||(t=document.createElement("style"),t.id="sc-theme-vars",e.insertBefore(t,e.firstChild));let n=Object.entries(W(this,kr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
504
504
  `);t.textContent=`:host {
505
505
  ${n}
506
506
  }`};var GC=new Set(["tag_name","$el_text"]);function KC(r){return GC.has(r)||r.startsWith("attr__")}function xy(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function YC(r){let{events:e,match:t}=r;return n=>{if(!e.includes(n.name))return!1;if(t){for(let[i,s]of Object.entries(t))if(KC(i)){let o=n.props?.elements;if(!o||!o.some(l=>xy(s,l[i])))return!1}else if(!xy(s,n.props?.[i]))return!1}return!0}}function wy(r,e){for(let t of r.rules)for(let n of t.conditions)if(n.type==="event_count"&&n.key){let i=n.counter,s=i?YC(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function $i(r,e,t){for(let n of r){let i=n.props;if(!i)continue;let s=i.actions;if(s)for(let o of s)o.triggerWhen?.type==="rules"&&wy(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&wy(i.triggerWhen,e)}}var XC="syntro-runtime",Sy="smart-canvas",ky=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function Ey(r){let e=typeof window<"u"?window.SynOS?.interventionTracker:null;if(e)for(let t of r)e.trackTriggered(t.id,t.widget??"unknown")}var bt,Oi,ar,Cr,zt,Kn,uo,Yn,Xn,Jn,po,ho,Qn,ei,Xr,Jr,Qr,en,ti,ri,Li,fo,xe,Cy,Ay,Ni,Sl,Ty,Pd,Od,Ld,Nd,Ry,Fd,kl,Pi=class extends ye{constructor(){super();me(this,xe);this.fetcher=void 0;this.configUri=void 0;this.configUriFeatureKey=void 0;this.configFeatureKey=void 0;this.fetchCredentials="include";this.experiments=void 0;this.telemetry=void 0;this.runtime=void 0;this.launcherLabel=void 0;this.initialBatchHandle=null;this.initialBatchActions=void 0;this.workspaceTheme=void 0;this._tiles=[];this._configActions=[];this._isLoading=!0;this._error=void 0;this._theme=void 0;this._launcher=void 0;this._canvasTitle=void 0;this._displayMode="standard";this._isOpen=!1;this._pageUrl=typeof window<"u"?window.location.href:"/";me(this,bt);me(this,Oi,null);me(this,ar,null);me(this,Cr,null);me(this,zt,null);me(this,Kn);me(this,uo,0);me(this,Yn,null);me(this,Xn,"[]");me(this,Jn,"[]");me(this,po,"null");me(this,ho,"null");me(this,Qn,null);me(this,ei,null);me(this,Xr,null);me(this,Jr,null);me(this,Qr,null);me(this,en,null);me(this,ti,!1);me(this,ri,()=>{this._pageUrl=window.location.href});me(this,Li);me(this,fo);me(this,Ni,0);me(this,kl,t=>{W(this,bt).toggle()});ne(this,bt,gy()),ne(this,Kn,!1),ne(this,Li,new co(this)),ne(this,fo,new Ti(this,{context:XC,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),ne(this,Oi,W(this,bt).subscribe(t=>{this._isOpen&&!t.open&&ne(this,ti,!1),this._isOpen=t.open})),this._isOpen=W(this,bt).getState().open,ne(this,ar,document.createElement("div")),W(this,ar).id="overlayContainer",Object.assign(W(this,ar).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(W(this,ar)),ne(this,Cr,document.createElement("div")),W(this,Cr).id="portalRoot",this.shadowRoot.appendChild(W(this,Cr)),be(this,xe,Pd).call(this),be(this,xe,Fd).call(this),be(this,xe,Ld).call(this)}disconnectedCallback(){var t,n,i,s,o,a;super.disconnectedCallback(),(t=W(this,Oi))==null||t.call(this),ne(this,Oi,null),(n=W(this,ei))==null||n.call(this),ne(this,ei,null),(i=W(this,Xr))==null||i.call(this),ne(this,Xr,null),(s=W(this,Jr))==null||s.call(this),ne(this,Jr,null),(o=W(this,Qr))==null||o.call(this),ne(this,Qr,null),(a=W(this,en))==null||a.call(this),ne(this,en,null),be(this,xe,Od).call(this),W(this,zt)&&(W(this,zt).revertAll().catch(l=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",l)}),ne(this,zt,null)),W(this,ar)?.remove(),ne(this,ar,null),W(this,Cr)?.remove(),ne(this,Cr,null)}updated(t){var i;t.has("runtime")&&(W(this,fo).setValue(this.runtime??null),be(this,xe,Ry).call(this),be(this,xe,Ld).call(this),be(this,xe,Fd).call(this),be(this,xe,Od).call(this),be(this,xe,Pd).call(this));let n=t.has("runtime")||t.has("fetcher")||t.has("configUri")||t.has("configUriFeatureKey")||t.has("configFeatureKey")||t.has("fetchCredentials")||t.has("experiments");if(n&&(be(this,xe,Cy).call(this),(i=W(this,ei))==null||i.call(this),this.experiments?.onFeaturesChanged&&ne(this,ei,this.experiments.onFeaturesChanged(()=>this._loadConfig({silent:!0})))),(n||t.has("_pageUrl"))&&this._loadConfig(),t.has("_pageUrl")&&ne(this,ti,!1),(t.has("_theme")||t.has("workspaceTheme"))&&W(this,Li).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&be(this,xe,Ty).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&W(this,bt).getState().open&&!W(this,ti)&&W(this,bt).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(ne(this,zt,this.initialBatchHandle),ne(this,Kn,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,ne(this,Xn,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error,n=this._isLoading||t;if(this._displayMode==="inline")return n?L`
@@ -1074,7 +1074,7 @@ Actions:`,_.map((P,K)=>` [${K}] ${P.kind} ${P.anchorId?`anchor="${P.anchorId.se
1074
1074
  `,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),mb=!0}var up=async(r={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(r.antiFlicker){let g=typeof r.antiFlicker=="object"?r.antiFlicker:{};e=pb(g)}let t=null,n=null,i=null,{runtime:s}=r;async function o(g){!s?.actions||g.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(g))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(r.fetcher)try{n=r.fetcher,console.log("[SmartCanvas] Fetching initial config...");let g=await r.fetcher();t=g,console.log("[SmartCanvas] Config fetched:",`tiles=${g.tiles?.length??0},`,`actions=${g.actions?.length??0},`,`theme=${g.theme?.mode??"default"}`),g.actions?.length&&console.log("[SmartCanvas] Actions to apply:",g.actions.map((b,x)=>`[${x}] ${b.kind}${b.anchorId?` anchor="${b.anchorId.selector}"`:""}${b.label?` "${b.label}"`:""}`).join(", ")),g.actions&&g.actions.length>0&&s?.actions&&(await o(g.actions),console.log("[SmartCanvas] Initial actions applied successfully")),g.tiles&&s?.accumulator&&$i(g.tiles,s.accumulator,g.actions)}catch(g){console.error("[SmartCanvas] Error fetching/applying initial config:",g)}e&&e();let l=Ll();El();let c=document.createElement("smart-canvas");if(r.tokens)for(let[g,b]of Object.entries(r.tokens))c.style.setProperty(g,b);let d=r.integrations?.experiments,p=r.integrations?.telemetry,h=r.fetcher??Mi({configUri:r.configUri,experiments:d,featureKey:r.configUriFeatureKey,credentials:r.fetchCredentials});n||(n=h);let f={fetcher:h,configUri:r.configUri,configUriFeatureKey:r.configUriFeatureKey,fetchCredentials:r.fetchCredentials,experiments:d,telemetry:p,runtime:s,initialBatchHandle:i,initialBatchActions:i?t?.actions??[]:void 0,workspaceTheme:r.workspaceTheme};c.mountLitApp(f),r.defaultOpen&&c.open();let v=()=>{let g=r.target??document.body;if(g){g.appendChild(c);let b=c.getOverlayContainer();b&&vb(b)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),gb(r.editorUrl).catch(console.error));let m={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:g=>{for(let[b,x]of Object.entries(g))c.style.setProperty(b,x)},getConfig:async()=>{if(n)try{let g=await n();return t=g,g}catch(g){console.error("[SmartCanvas] Error fetching config:",g)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async g=>{g?t&&await o(t.actions):await a()},setOverrideFetcher:g=>{n=g,c.setOverrideFetcher(g),s?.accumulator&&g().then(b=>{b?.tiles&&$i(b.tiles,s.accumulator,b.actions)}).catch(()=>{})},registerTelemetryProperties:g=>{p?.register?.(g)},getSessionId:()=>p?.getSessionId?.(),startSessionRecording:()=>{p?.startSessionRecording?.()},track:(g,b)=>p?.track?(p.track(g,b),!0):!1,previewNotification:g=>c.previewNotification(g),runtime:s};if(typeof window<"u"){let g=window.SynOS;g&&(g.handle=m)}return m};typeof window<"u"&&(window.SmartCanvas={async create(r){return up(r)}});var dp="syn_";function bo(r){if(!r.startsWith(dp))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(dp.length).replace(/-/g,"+").replace(/_/g,"/"),n=atob(t),i=JSON.parse(n);if(i.v!==1)throw new Error(`Unsupported token version: ${i.v}`);return i}function pp(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return dp+t}function Pt(r){if(typeof process<"u"&&process.env)return process.env[r];if(typeof import.meta.env<"u"&&import.meta.env)return import.meta.env[r]}function hp(r,e){if(typeof window>"u")return null;try{let t=localStorage.getItem(r);if(!t)return null;let n=JSON.parse(t);return!n||typeof n.ts!="number"||!("data"in n)||e!=null&&Date.now()-n.ts>e?null:n.data}catch{return null}}function fp(r,e){if(!(typeof window>"u"))try{let t={ts:Date.now(),data:e};localStorage.setItem(r,JSON.stringify(t))}catch{}}var xb="syntro_segment_attributes";function wb(){let r=hp(xb);return r?(G("Syntro Bootstrap","Loaded cached segment attributes:",r),r):{}}function Sb(r){fp(xb,r),G("Syntro Bootstrap","Cached segment attributes:",r)}function kb(r){if(!r)return{};let e={};for(let[t,n]of Object.entries(r))t.startsWith("in_segment_")&&(e[t]=n===!0);return e}function gp(){if(typeof window>"u")return{};let r={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let n=e.get(t);n&&(r[t]=n)}}catch{}try{navigator.language&&(r.browser_language=navigator.language),navigator.languages?.length&&(r.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;r.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){r.referrer=document.referrer;try{r.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?r.browser="Edge":e.includes("OPR/")||e.includes("Opera")?r.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?r.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?r.browser="Safari":e.includes("Firefox/")&&(r.browser="Firefox"),e.includes("Windows")?r.os="Windows":e.includes("iPhone")||e.includes("iPad")?r.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?r.os="macOS":e.includes("Android")?r.os="Android":e.includes("Linux")&&(r.os="Linux")}catch{}try{r.page_url=window.location.href,r.page_path=window.location.pathname,r.page_host=window.location.hostname,window.location.search&&(r.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(r.surface_type="telegram",r.surface_host=e.platform||"unknown"):(r.surface_type="web",r.surface_host="web")}catch{r.surface_type="web",r.surface_host="web"}try{let e=r.surface_type;e==="telegram"||e==="mcp-app"?r.surface="personal_agent":r.device_type==="mobile"?r.surface="mobile":r.surface="desktop"}catch{r.surface="desktop"}return r}var Eb="syntro_initial_attrs",SA=1800*1e3,bb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function kA(r){if(typeof window>"u")return!1;try{return r===window.location.hostname}catch{return!1}}function mp(r,e){let t={},n=bb.some(o=>typeof r[o]=="string");for(let o of bb){let a=n?r[o]:e?.[o];a&&(t[o]=a)}let i=typeof r.referrer_hostname=="string"?r.referrer_hostname:void 0;return!(i?kA(i):!0)&&typeof r.referrer=="string"?(t.referrer=r.referrer,i&&(t.referrer_hostname=i)):e?.referrer&&(t.referrer=e.referrer,e.referrer_hostname&&(t.referrer_hostname=e.referrer_hostname)),e?.initial_page_url?(t.initial_page_url=e.initial_page_url,e.initial_page_path&&(t.initial_page_path=e.initial_page_path),e.initial_page_query&&(t.initial_page_query=e.initial_page_query)):(typeof r.page_url=="string"&&(t.initial_page_url=r.page_url),typeof r.page_path=="string"&&(t.initial_page_path=r.page_path),typeof r.page_query=="string"&&(t.initial_page_query=r.page_query)),t}function Cb(){return hp(Eb,SA)}function Ab(r){fp(Eb,r),G("Syntro Bootstrap","Cached initial attrs:",r)}var _b="syntro_geo",Tb="https://geo.syntrologie.com";async function vp(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(_b);if(e){let t=JSON.parse(e);return G("Syntro Bootstrap","Geo: using cached data:",t),t}}catch{}try{let e=await fetch(r,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json(),n={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s&&(n[i]=s);try{localStorage.setItem(_b,JSON.stringify(n))}catch{}return G("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var Rb=!1;function Ib(r){return typeof window<"u"&&typeof window.Shopify<"u"&&!Rb&&(Rb=!0,console.warn("[syntrologie-sdk] This Shopify storefront is loading the lite SDK bundle (smart-canvas.min.js), which no longer includes Shopify integration. Update your snippet to load smart-canvas.shopify.min.js \u2014 see https://docs.syntrologie.com/sdk/shopify-migration")),{}}var yp=null;if(typeof document<"u")try{let r=document.currentScript instanceof HTMLScriptElement?document.currentScript.src:null;if(r){let e=new URL(r),t=e.pathname.replace(/\/[^/]*$/,"");yp=`${e.origin}${t}`}}catch{yp=null}function Mb(){return yp}var $b=["fbclid","ttclid","gclid","gbraid","wbraid","msclkid","twclid","li_fat_id","epik","ScCid","yclid","_kx","mc_eid","mc_cid"];function bp(r){if(typeof window>"u"||!r.setPersonPropertiesOnce)return;let e=new URLSearchParams(window.location.search),t={};for(let n of $b){let i=e.get(n);i&&(t[`$initial_${n}`]=i)}Object.keys(t).length>0&&r.setPersonPropertiesOnce(t)}var EA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,CA=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,AA=[/@yopmail\.com$/i,/@mailinator\.com$/i,/@guerrillamail\.(com|info|net|org|biz)$/i,/@10minutemail\.com$/i,/^test@/i,/^noreply@/i,/^no-reply@/i];function Nl(r){return r?CA.test(r):!1}function Pb(r){return AA.some(e=>e.test(r))}function TA(r){if(r.type==="email")return!0;let e=(r.name||"").toLowerCase(),t=(r.id||"").toLowerCase();return!!(/email/.test(e)||/email/.test(t))}function RA(r){return r.closest("[data-syntro-no-identify]")!==null}function IA(r){return r?EA.test(r):!0}function _p(r,e){if(typeof document>"u")return()=>{};if(!r.identify&&!r.alias)return()=>{};let t=new Set,n=s=>{let o=r.getDistinctId?.();if(o===s){t.add(s);return}IA(o)?r.identify?.(s,{email:s}):r.alias?.(s),t.add(s)},i=s=>{let o=s.target;if(!(o instanceof HTMLInputElement)||RA(o)||!TA(o))return;let a=(o.value??"").trim().toLowerCase();if(!Nl(a)||Pb(a)||t.has(a))return;if(!e){n(a);return}let l=e.getStatus();if(l==="granted"){n(a);return}l!=="denied"&&e.resolvePending().then(c=>{c==="granted"&&n(a)})};return document.addEventListener("change",i,!0),()=>{document.removeEventListener("change",i,!0),t.clear()}}var Ob="_syu",MA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function $A(r){return r?MA.test(r):!0}function xp(r,e){if(typeof window>"u"||!r.identify&&!r.alias)return;let t=new URLSearchParams(window.location.search).get(Ob);if(!t)return;let n=t.trim();if(!n)return;let i=()=>{let a=r.getDistinctId?.();if(a===n)return;let l=Nl(n)?{email:n}:void 0;$A(a)?r.identify?.(n,l):r.alias?.(n)};if(!e){i();return}if(e.getStatus()==="granted"){i();return}let s=!1,o=e.subscribe(a=>{s||a==="granted"&&(s=!0,o(),i())})}var PA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function OA(r){return r.is_eu==="true"||r.country_code==="GB"||r.country_code==="CH"||!r.is_eu&&!r.country_code}function LA(r){if(!r)return"";try{return new URL(r).hostname}catch{return""}}function wp(){return typeof window>"u"?"":`${window.location.origin}${window.location.pathname}`}function Sp(r,e){if(typeof window>"u"||typeof document>"u"||!r.setPersonPropertiesOnce)return;let t=document.referrer||"",n=new URLSearchParams(window.location.search),i={$initial_pathname:window.location.pathname,$initial_referrer:t,$initial_referring_domain:LA(t)};for(let s of PA){let o=n.get(s);o&&(i[`$initial_${s}`]=o)}if(r.setPersonPropertiesOnce(i),!e){r.setPersonPropertiesOnce({$initial_url:wp()});return}e.then(s=>{let o=OA(s)?wp():window.location.href;r.setPersonPropertiesOnce?.({$initial_url:o})}).catch(()=>{r.setPersonPropertiesOnce?.({$initial_url:wp()})})}var Lb=new Set(["email","telephone","streetAddress","addressLocality","addressRegion","postalCode","givenName","familyName"]),Nb=500,kp=3;function Fl(r){if(Array.isArray(r))return r.map(Fl);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Lb.has(t)||(e[t]=Fl(n));return e}return r}function Dl(r){if(Array.isArray(r))return r.map(Dl);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))if(!(t==="description"&&typeof n=="string"&&n.length>Nb)){if(t==="image"&&Array.isArray(n)&&n.length>kp){e[t]=n.slice(0,kp);continue}e[t]=Dl(n)}return e}return r}function NA(){return typeof document>"u"?[]:Array.from(document.querySelectorAll('script[type="application/ld+json"]')).filter(r=>!r.hasAttribute("data-syntro-no-jsonld")).map(r=>{try{return JSON.parse(r.textContent??"")}catch{return null}}).filter(r=>r!==null)}function Ep(r){if(!r.register)return;let e=NA().map(Dl).map(Fl);e.length!==0&&r.register({json_ld:e})}function Fb(r,e,t={}){Sp(r,t.geoPromise),bp(r),Ep(r),xp(r,e);let n=_p(r,e);return()=>{n()}}var Db="app:",FA="syntro:",DA=/^[a-z][a-z0-9_]*$/;function Cp(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(FA))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(Db))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(Db.length).split(":");if(e.length<2)return{valid:!1,reason:`Event name must have at least 2 segments after "app:" (app:{category}:{action}). Got: "${r}"`};for(let t of e)if(!DA.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function HA(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Hb(r,e,t=0){if(t>=e)return!1;for(let n of Object.values(r))if(n!==null&&typeof n=="object"&&!Array.isArray(n)&&!Hb(n,e,t+1))return!1;return!0}function Ap(r){if(r===void 0)return{valid:!0};if(r===null||typeof r!="object"||Array.isArray(r))return{valid:!1,reason:"Props must be a plain object"};if(!Hb(r,2))return{valid:!1,reason:"Props nesting depth exceeds 2 levels"};let e=[];for(let[t,n]of Object.entries(r))n!==null&&typeof n=="object"||HA(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Hl(r,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(r.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(n=>{try{return new RegExp(n).test(r.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(r.source)):!0}var Bl=class{constructor(e={}){this.subscriptions=new Set;this.history=[];this.maxHistorySize=e.maxHistorySize??100,this.debug=e.debug??!1,this.emitHistory=e.history??null,this.posthogCapture=e.posthogCapture??null,this.testMode=e.testMode??!1}subscribe(e,t){let n,i;typeof e=="function"?(n=void 0,i=e):(n=e,i=t);let s={filter:n,callback:i};return this.subscriptions.add(s),()=>{this.subscriptions.delete(s)}}publish(e,t,n="canvas"){let i={ts:Date.now(),name:e,source:n,props:t,schemaVersion:De};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(Hl(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=Cp(e);if(!n.valid)return console.warn(`[EventBus] emit() rejected: ${n.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let i=Ap(t);if(!i.valid)return console.warn(`[EventBus] emit() rejected props: ${i.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let s={ts:Date.now(),name:e,source:"custom",props:t,schemaVersion:De};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(Hl(s,l.filter))try{l.callback(s),o++}catch(c){console.error("[EventBus] Subscriber error:",c),o++}let a=!1;if(this.posthogCapture&&!this.testMode)try{this.posthogCapture(e,t),a=!0}catch(l){console.error("[EventBus] PostHog capture error:",l)}if(this.emitHistory&&this.emitHistory.record({name:e,props:t,source:"custom",timestamp:s.ts,matchedRules:[]}),this.debug)return console.debug("[EventBus] emit()",{name:e,props:t,listenersNotified:o,posthogCaptured:a}),{delivered:!0,matchedRules:[],posthogCaptured:a,listenersNotified:o}}setPosthogCapture(e){this.posthogCapture=e}getRecent(e,t){let n=this.history;return e&&(n=n.filter(i=>Hl(i,e))),t&&t>0&&(n=n.slice(-t)),n}hasRecentEvent(e,t,n){let i=Date.now()-t;return this.history.some(s=>s.name===e&&s.ts>=i&&(n===void 0||s.source===n))}countRecentEvents(e,t){let n=this.history.filter(i=>Hl(i,e));if(t!==void 0){let i=Date.now()-t;n=n.filter(s=>s.ts>=i)}return n.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function _o(r={}){return new Bl(r)}var xo=class{constructor(e=100){this.entries=[];this.maxSize=e}record(e){this.entries.push(e),this.maxSize>0&&this.entries.length>this.maxSize&&this.entries.shift()}getAll(){return[...this.entries]}clear(){this.entries=[]}};var Vb={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Ub(){return Vb}function Tp(r){let e=2166136261,t=r.length;for(let n=0;n<t;n++)e^=r.charCodeAt(n),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function wo(r,e,t){return t===2?Tp(Tp(r+e)+"")%1e4/1e4:t===1?Tp(e+r)%1e3/1e3:null}function BA(r){return r<=0?[]:new Array(r).fill(1/r)}function Vl(r,e){return r>=e[0]&&r<e[1]}function jb(r,e){let t=wo("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Wb(r,e){for(let t=0;t<e.length;t++)if(Vl(r,e[t]))return t;return-1}function Ip(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function Ul(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=jA(r,e[i].type,e[i].pattern);if(e[i].include===!1){if(s)return!1}else t=!0,s&&(n=!0)}return n||!t}function VA(r,e,t){try{let n=e.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(n="\\/?"+n.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+n+"$","i").test(r)}catch{return!1}}function UA(r,e){try{let t=new URL(e.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),n=[[r.host,t.host,!1],[r.pathname,t.pathname,!0]];return t.hash&&n.push([r.hash,t.hash,!1]),t.searchParams.forEach((i,s)=>{n.push([r.searchParams.get(s)||"",i,!1])}),!n.some(i=>!VA(i[0],i[1],i[2]))}catch{return!1}}function jA(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=Ip(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return UA(n,t);return!1}catch{return!1}}function zb(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=BA(r);t=t||n,t.length!==r&&(t=n);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=n);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function qb(r,e,t){if(!e)return null;let n=e.split("?")[1];if(!n)return null;let i=n.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===r).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function Zb(r){try{return r()}catch(e){return console.error(e),!1}}var Rp=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function ni(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Vb.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Rp(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Rp(i)},n,Rp(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function So(r){return typeof r=="string"?r:JSON.stringify(r)}function wt(r){typeof r=="number"&&(r=r+""),(!r||typeof r!="string")&&(r="0");let e=r.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function Gb(){let r;try{r="1.6.4"}catch{r=""}return r}function Kb(r,e){let t,n;try{t=new URL(r),n=new URL(e)}catch(i){return console.error(`Unable to merge query strings: ${i}`),e}return t.searchParams.forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),n.toString()}function Bb(r){return typeof r=="object"&&r!==null}function jl(r){return r.urlPatterns&&r.variations.some(e=>Bb(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>Bb(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Wl(r,e){return new Promise(t=>{let n=!1,i,s=o=>{n||(n=!0,i&&clearTimeout(i),t(o||null))};e&&(i=setTimeout(()=>s(),e)),r.then(o=>s(o)).catch(()=>s())})}var ot={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},ur=Ub(),Fi={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>ur.fetch(`${r}/api/features/${e}`,{headers:t}),fetchRemoteEvalCall:({host:r,clientKey:e,payload:t,headers:n})=>{let i={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)};return ur.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new ur.EventSource(`${r}/sub/${e}`,{headers:t}):new ur.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),qA()):document.visibilityState==="hidden"&&(r=window.setTimeout(zA,ot.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(ur.localStorage=globalThis.localStorage)}catch{}var Di=new Map,Yb=!1,Rr=new Map,zl=new Map,Hi=new Map,Bi=new Set;function Jb(r){Object.assign(ot,r),ot.backgroundSync||Np()}async function Qb({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(ot.backgroundSync=!1),ZA({instance:r,allowStale:n,timeout:e,skipCache:t})}function WA(r){let e=ko(r),t=Di.get(e)||new Set;t.add(r),Di.set(e,t)}function e_(r){Di.forEach(e=>e.delete(r))}function zA(){Hi.forEach(r=>{r&&(r.state="idle",Op(r))})}function qA(){Hi.forEach(r=>{r&&r.state==="idle"&&Lp(r)})}async function Xb(){try{if(!ur.localStorage)return;await ur.localStorage.setItem(ot.cacheKey,JSON.stringify(Array.from(Rr.entries())))}catch{}}async function ZA({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=ko(r),s=$p(r),o=new Date,a=new Date(o.getTime()-ot.maxAge+ot.staleTTL);await GA();let l=!ot.disableCache&&!n?Rr.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Bi.add(i),l.staleAt<o?Mp(r):Pp(r),{data:l.data,success:!0,source:"cache"}):await Wl(Mp(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function ko(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function $p(r){let e=ko(r);if(!("isRemoteEval"in r)||!r.isRemoteEval())return e;let t=r.getAttributes(),n=r.getCacheKeyAttributes()||Object.keys(r.getAttributes()),i={};n.forEach(a=>{i[a]=t[a]});let s=r.getForcedVariations(),o=r.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}async function GA(){if(!Yb){Yb=!0;try{if(ur.localStorage){let r=await ur.localStorage.getItem(ot.cacheKey);if(!ot.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{Rr.set(t,{...n,staleAt:new Date(n.staleAt)})}),t_()}}}catch{}if(!ot.disableIdleStreams){let r=Fi.startIdleListener();r&&(Fi.stopIdleListener=r)}}}function t_(){let r=Array.from(Rr.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,Rr.size-ot.maxEntries),Rr.size);for(let t=0;t<e;t++)Rr.delete(r[t].key)}function r_(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+ot.staleTTL),s=ot.disableCache?void 0:Rr.get(e);if(s&&n&&s.version===n){s.staleAt=i,Xb();return}ot.disableCache||(Rr.set(e,{data:t,version:n,staleAt:i,sse:Bi.has(r)}),t_()),Xb();let o=Di.get(r);o&&o.forEach(a=>KA(a,t))}async function KA(r,e){await r.setPayload(e||r.getPayload())}async function Mp(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=ko(r),o=$p(r),a=zl.get(o);return a||(a=(i?Fi.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Fi.fetchFeaturesCall({host:e,clientKey:n,headers:t})).then(c=>{if(!c.ok)throw new Error(`HTTP error: ${c.status}`);return c.headers.get("x-sse-support")==="enabled"&&Bi.add(s),c.json()}).then(c=>(r_(s,o,c),Pp(r),zl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(zl.delete(o),{data:null,source:"error",success:!1,error:c})),zl.set(o,a)),a}function Pp(r,e=!1){let t=ko(r),n=$p(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Bi.add(t),ot.backgroundSync&&Bi.has(t)&&ur.EventSource){if(Hi.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Di.get(t);c&&c.forEach(d=>{Mp(d)})}else if(l.type==="features"){let c=JSON.parse(l.data);r_(t,n,c)}a.errors=0}catch{n_(a)}},errors:0,state:"active"};Hi.set(t,a),Lp(a)}}function n_(r){if(r.state!=="idle"&&(r.errors++,r.errors>3||r.src&&r.src.readyState===2)){let e=Math.pow(3,r.errors-3)*(1e3+Math.random()*1e3);Op(r),setTimeout(()=>{["idle","active"].includes(r.state)||Lp(r)},Math.min(e,3e5))}}function Op(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function Lp(r){r.src=Fi.eventSourceCall({host:r.host,clientKey:r.clientKey,headers:r.headers}),r.state="active",r.src.addEventListener("features",r.cb),r.src.addEventListener("features-updated",r.cb),r.src.onerror=()=>n_(r),r.src.onopen=()=>{r.errors=0}}function YA(r,e){Op(r),Hi.delete(e)}function Np(){Bi.clear(),Hi.forEach(YA),Di.clear(),Fi.stopIdleListener()}function ql(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Pp(r,!0),WA(r)}}var XA=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Hp={revert:function(){}},Yl=new Map,Bp=new Set;function JA(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function Xl(r){var e=Yl.get(r);return e||(e={element:r,attributes:{}},Yl.set(r,e)),e}function Jl(r,e,t,n,i){var s=t(r),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:r,_positionTimeout:null,observer:new MutationObserver(function(){if(!(e==="position"&&o._positionTimeout)){e==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var a=t(r);e==="position"&&a.parentNode===o.virtualValue.parentNode&&a.insertBeforeNode===o.virtualValue.insertBeforeNode||a!==o.virtualValue&&(o.originalValue=a,i(o))}}),mutationRunner:i,setValue:n,getCurrentValue:t};return e==="position"&&r.parentNode?o.observer.observe(r.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(r,JA(e)),o}function Ql(r,e){var t=e.getCurrentValue(e.el);e.virtualValue=r,r&&typeof r!="string"?(!t||r.parentNode!==t.parentNode||r.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,i_()):r!==t&&(e.isDirty=!0,i_())}function QA(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Ql(h2(e),r)}function e2(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),Ql(Array.from(e).filter(Boolean).join(" "),r)}function t2(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Ql(e,r)}function r2(r){var e=r.parentSelector,t=r.insertBeforeSelector,n=document.querySelector(e);if(!n)return null;var i=t?document.querySelector(t):null;return t&&!i?null:{parentNode:n,insertBeforeNode:i}}function n2(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=r2(n);e=i||e}),Ql(e,r)}var i2=function(e){return e.innerHTML},s2=function(e,t){return e.innerHTML=t};function o_(r){var e=Xl(r);return e.html||(e.html=Jl(r,"html",i2,s2,QA)),e.html}var o2=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},a2=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function a_(r){var e=Xl(r);return e.position||(e.position=Jl(r,"position",o2,a2,n2)),e.position}var l2=function(e,t){return t?e.className=t:e.removeAttribute("class")},c2=function(e){return e.className};function l_(r){var e=Xl(r);return e.classes||(e.classes=Jl(r,"class",c2,l2,e2)),e.classes}var u2=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},d2=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function c_(r,e){var t=Xl(r);return t.attributes[e]||(t.attributes[e]=Jl(r,e,u2(e),d2(e),t2)),t.attributes[e]}function p2(r,e){var t=Yl.get(r);if(t)if(e==="html"){var n,i;(n=t.html)==null||(i=n.observer)==null||i.disconnect(),delete t.html}else if(e==="class"){var s,o;(s=t.classes)==null||(o=s.observer)==null||o.disconnect(),delete t.classes}else if(e==="position"){var a,l;(a=t.position)==null||(l=a.observer)==null||l.disconnect(),delete t.position}else{var c,d,p;(c=t.attributes)==null||(d=c[e])==null||(p=d.observer)==null||p.disconnect(),delete t.attributes[e]}}var Zl;function h2(r){return Zl||(Zl=document.createElement("div")),Zl.innerHTML=r,Zl.innerHTML}function Gl(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||p2(r,e),t.setValue(r,n)}}function f2(r,e){r.html&&Gl(e,"html",r.html),r.classes&&Gl(e,"class",r.classes),r.position&&Gl(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){Gl(e,t,r.attributes[t])})}function i_(){Yl.forEach(f2)}function g2(r,e){var t=null;r.kind==="html"?t=o_(e):r.kind==="class"?t=l_(e):r.kind==="attribute"?t=c_(e,r.attribute):r.kind==="position"&&(t=a_(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function m2(r,e){var t=null;if(r.kind==="html"?t=o_(e):r.kind==="class"?t=l_(e):r.kind==="attribute"?t=c_(e,r.attribute):r.kind==="position"&&(t=a_(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function u_(r){if(!(r.kind==="position"&&r.elements.size===1)){var e=new Set(r.elements),t=document.querySelectorAll(r.selector);t.forEach(function(n){e.has(n)||(r.elements.add(n),g2(r,n))})}}function v2(r){r.elements.forEach(function(e){return m2(r,e)}),r.elements.clear(),Bp.delete(r)}function s_(){Bp.forEach(u_)}var Fp;function y2(){typeof document>"u"||(Fp||(Fp=new MutationObserver(function(){s_()})),s_(),Fp.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}y2();function ec(r){return typeof document>"u"?Hp:(Bp.add(r),u_(r),{revert:function(){v2(r)}})}function Dp(r,e){return ec({kind:"html",elements:new Set,mutate:e,selector:r})}function d_(r,e){return ec({kind:"position",elements:new Set,mutate:e,selector:r})}function Eo(r,e){return ec({kind:"class",elements:new Set,mutate:e,selector:r})}function Kl(r,e,t){return XA.test(e)?e==="class"||e==="className"?Eo(r,function(n){var i=t(Array.from(n).join(" "));n.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return n.add(s)})}):ec({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):Hp}function b2(r){var e=r.selector,t=r.action,n=r.value,i=r.attribute,s=r.parentSelector,o=r.insertBeforeSelector;if(i==="html"){if(t==="append")return Dp(e,function(a){return a+(n??"")});if(t==="set")return Dp(e,function(){return n??""})}else if(i==="class"){if(t==="append")return Eo(e,function(a){n&&a.add(n)});if(t==="remove")return Eo(e,function(a){n&&a.delete(n)});if(t==="set")return Eo(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return d_(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return Kl(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return Kl(e,i,function(){return n??""});if(t==="remove")return Kl(e,i,function(){return null})}return Hp}var _2={html:Dp,classes:Eo,attribute:Kl,position:d_,declarative:b2},p_=_2;var Vp={};function nn(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!g_(r,i,t))return!1;break;case"$nor":if(g_(r,i,t))return!1;break;case"$and":if(!E2(r,i,t))return!1;break;case"$not":if(nn(r,i,t))return!1;break;default:if(!Co(i,x2(r,n),t))return!1}return!0}function x2(r,e){let t=e.split("."),n=r;for(let i=0;i<t.length;i++)if(n&&typeof n=="object"&&t[i]in n)n=n[t[i]];else return null;return n}function h_(r,e=!1){let t=`${r}${e?"/i":""}`;return Vp[t]||(Vp[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Vp[t]}function Co(r,e,t,n=!1){if(typeof r=="string")return n?String(e).toLowerCase()===r.toLowerCase():e+""===r;if(typeof r=="number")return e*1===r;if(typeof r=="boolean")return e!==null&&!!e===r;if(r===null)return e===null;if(Array.isArray(r)||!m_(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!k2(i,e,r[i],t))return!1;return!0}function m_(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function w2(r){if(r===null)return"null";if(Array.isArray(r))return"array";let e=typeof r;return["string","number","boolean","object","undefined"].includes(e)?e:"unknown"}function S2(r,e,t){if(!Array.isArray(r))return!1;let n=m_(e)?i=>Co(e,i,t):i=>nn(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function Vi(r,e,t=!1){if(t){let n=i=>typeof i=="string"?i.toLowerCase():i;return Array.isArray(r)?r.some(i=>e.some(s=>n(i)===n(s))):e.some(i=>n(r)===n(i))}return Array.isArray(r)?r.some(n=>e.includes(n)):e.includes(r)}function f_(r,e,t,n=!1){if(!Array.isArray(r))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<r.length;o++)if(Co(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function k2(r,e,t,n){switch(r){case"$veq":return wt(e)===wt(t);case"$vne":return wt(e)!==wt(t);case"$vgt":return wt(e)>wt(t);case"$vgte":return wt(e)>=wt(t);case"$vlt":return wt(e)<wt(t);case"$vlte":return wt(e)<=wt(t);case"$eq":return e===t;case"$ne":return e!==t;case"$lt":return e<t;case"$lte":return e<=t;case"$gt":return e>t;case"$gte":return e>=t;case"$exists":return t?e!=null:e==null;case"$in":return Array.isArray(t)?Vi(e,t):!1;case"$ini":return Array.isArray(t)?Vi(e,t,!0):!1;case"$inGroup":return Vi(e,n[t]||[]);case"$notInGroup":return!Vi(e,n[t]||[]);case"$nin":return Array.isArray(t)?!Vi(e,t):!1;case"$nini":return Array.isArray(t)?!Vi(e,t,!0):!1;case"$not":return!Co(t,e,n);case"$size":return Array.isArray(e)?Co(t,e.length,n):!1;case"$elemMatch":return S2(e,t,n);case"$all":return Array.isArray(t)?f_(e,t,n):!1;case"$alli":return Array.isArray(t)?f_(e,t,n,!0):!1;case"$regex":try{return h_(t).test(e)}catch{return!1}case"$regexi":try{return h_(t,!0).test(e)}catch{return!1}case"$type":return w2(e)===t;default:return console.error("Unknown operator: "+r),!1}}function g_(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(nn(r,e[n],t))return!0;return!1}function E2(r,e,t){for(let n=0;n<e.length;n++)if(!nn(r,e[n],t))return!1;return!0}var C2="Feature Evaluated",A2="Experiment Viewed";function T2(r){let e=new Map;return r.global.forcedFeatureValues&&r.global.forcedFeatureValues.forEach((t,n)=>e.set(n,t)),r.user.forcedFeatureValues&&r.user.forcedFeatureValues.forEach((t,n)=>e.set(n,t)),e}function R2(r){return r.global.forcedVariations&&r.user.forcedVariations?{...r.global.forcedVariations,...r.user.forcedVariations}:r.global.forcedVariations?r.global.forcedVariations:r.user.forcedVariations?r.user.forcedVariations:{}}async function Ui(r){try{await r()}catch{}}function v_(r,e,t){if(r.user.trackedExperiments){let i=nc(e,t);if(r.user.trackedExperiments.has(i))return[];r.user.trackedExperiments.add(i)}r.user.enableDevMode&&r.user.devLogs&&r.user.devLogs.push({experiment:e,result:t,timestamp:Date.now().toString(),logType:"experiment"});let n=[];if(r.global.trackingCallback){let i=r.global.trackingCallback;n.push(Ui(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(Ui(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(Ui(()=>i(A2,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function I2(r,e,t){if(r.user.trackedFeatureUsage){let n=JSON.stringify(t.value);if(r.user.trackedFeatureUsage[e]===n)return;r.user.trackedFeatureUsage[e]=n,r.user.enableDevMode&&r.user.devLogs&&r.user.devLogs.push({featureKey:e,result:t,timestamp:Date.now().toString(),logType:"feature"})}if(r.global.onFeatureUsage){let n=r.global.onFeatureUsage;Ui(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;Ui(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;Ui(()=>n(C2,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function tc(r,e){if(e.stack.evaluatedFeatures.has(r))return sn(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=T2(e);if(t.has(r))return sn(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return sn(e,r,null,"unknownFeature");let n=e.global.features[r];if(n.rules){let i=new Set(e.stack.evaluatedFeatures);e:for(let s of n.rules){if(s.parentConditions)for(let l of s.parentConditions){e.stack.evaluatedFeatures=new Set(i);let c=tc(l.id,e);if(c.source==="cyclicPrerequisite")return sn(e,r,null,"cyclicPrerequisite");let d={value:c.value};if(!nn(d,l.condition||{})){if(l.gate)return sn(e,r,null,"prerequisite");continue e}}if(s.filters&&__(s.filters,e))continue;if("force"in s){if(s.condition&&!b_(s.condition,e)||!M2(e,s.seed||r,s.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(l=>{!v_(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),sn(e,r,s.force,"force",s.id)}if(!s.variations)continue;let o={variations:s.variations,key:s.key||r};"coverage"in s&&(o.coverage=s.coverage),s.weights&&(o.weights=s.weights),s.hashAttribute&&(o.hashAttribute=s.hashAttribute),s.fallbackAttribute&&(o.fallbackAttribute=s.fallbackAttribute),s.disableStickyBucketing&&(o.disableStickyBucketing=s.disableStickyBucketing),s.bucketVersion!==void 0&&(o.bucketVersion=s.bucketVersion),s.minBucketVersion!==void 0&&(o.minBucketVersion=s.minBucketVersion),s.namespace&&(o.namespace=s.namespace),s.meta&&(o.meta=s.meta),s.ranges&&(o.ranges=s.ranges),s.name&&(o.name=s.name),s.phase&&(o.phase=s.phase),s.seed&&(o.seed=s.seed),s.hashVersion&&(o.hashVersion=s.hashVersion),s.filters&&(o.filters=s.filters),s.condition&&(o.condition=s.condition);let{result:a}=rc(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return sn(e,r,a.value,"experiment",s.id,o,a)}}return sn(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function rc(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:Me(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Me(t,r,-1,!1,e)};if(r=$2(r,t),r.urlPatterns&&!Ul(t.user.url||"",r.urlPatterns))return{result:Me(t,r,-1,!1,e)};let s=qb(n,t.user.url||"",i);if(s!==null)return{result:Me(t,r,s,!1,e)};let o=R2(t);if(n in o){let g=o[n];return{result:Me(t,r,g,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:Me(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=ii(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:Me(t,r,-1,!1,e)};let c=-1,d=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:g,versionIsBlocked:b}=L2({ctx:t,expKey:r.key,expBucketVersion:r.bucketVersion,expHashAttribute:r.hashAttribute,expFallbackAttribute:r.fallbackAttribute,expMinBucketVersion:r.minBucketVersion,expMeta:r.meta});d=g>=0,c=g,p=!!b}if(!d){if(r.filters){if(__(r.filters,t))return{result:Me(t,r,-1,!1,e)}}else if(r.namespace&&!jb(l,r.namespace))return{result:Me(t,r,-1,!1,e)};if(r.include&&!Zb(r.include))return{result:Me(t,r,-1,!1,e)};if(r.condition&&!b_(r.condition,t))return{result:Me(t,r,-1,!1,e)};if(r.parentConditions){let g=new Set(t.stack.evaluatedFeatures);for(let b of r.parentConditions){t.stack.evaluatedFeatures=new Set(g);let x=tc(b.id,t);if(x.source==="cyclicPrerequisite")return{result:Me(t,r,-1,!1,e)};let w={value:x.value};if(!nn(w,b.condition||{}))return{result:Me(t,r,-1,!1,e)}}}if(r.groups&&!O2(r.groups,t))return{result:Me(t,r,-1,!1,e)}}if(r.url&&!P2(r.url,t))return{result:Me(t,r,-1,!1,e)};let h=wo(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:Me(t,r,-1,!1,e)};if(!d){let g=r.ranges||zb(i,r.coverage===void 0?1:r.coverage,r.weights);c=Wb(h,g)}if(p)return{result:Me(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:Me(t,r,-1,!1,e)};if("force"in r)return{result:Me(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Me(t,r,-1,!1,e)};if(r.status==="stopped")return{result:Me(t,r,-1,!1,e)};let f=Me(t,r,c,!0,e,h,d);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:g,key:b,doc:x}=F2(t,a,So(l),{[Up(r.key,r.bucketVersion)]:f.key});g&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[b]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=v_(t,r,f);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:r,result:f});let m=v.length?v.length===1?v[0]:Promise.all(v).then(()=>{}):void 0;return"changeId"in r&&r.changeId&&t.global.recordChangeId&&t.global.recordChangeId(r.changeId),{result:f,trackingCall:m}}function sn(r,e,t,n,i,s,o){let a={value:t,on:!!t,off:!t,source:n,ruleId:i||""};return s&&(a.experiment=s),o&&(a.experimentResult=o),n!=="override"&&I2(r,e,a),a}function y_(r){return{...r.user.attributes,...r.user.attributeOverrides}}function b_(r,e){return nn(y_(e),r,e.global.savedGroups||{})}function __(r,e){return r.some(t=>{let{hashValue:n}=ii(e,t.attribute);if(!n)return!0;let i=wo(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Vl(i,s))})}function M2(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=ii(r,t,n);if(!a)return!1;let l=wo(e,a,o||1);return l===null?!1:i?Vl(l,i):s!==void 0?l<=s:!0}function Me(r,e,t,n,i,s,o){let a=!0;(t<0||t>=e.variations.length)&&(t=0,a=!1);let{hashAttribute:l,hashValue:c}=ii(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),d=e.meta?e.meta[t]:{},p={key:d.key||""+t,featureId:i,inExperiment:a,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return d.name&&(p.name=d.name),s!==void 0&&(p.bucket=s),d.passthrough&&(p.passthrough=d.passthrough),p}function $2(r,e){let t=r.key,n=e.global.overrides;return n&&n[t]&&(r=Object.assign({},r,n[t]),typeof r.url=="string"&&(r.url=Ip(r.url))),r}function ii(r,e,t){let n=e||"id",i="",s=y_(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function P2(r,e){let t=e.user.url;if(!t)return!1;let n=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(r.test(t)||r.test(n))}function O2(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function L2({ctx:r,expKey:e,expBucketVersion:t,expHashAttribute:n,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){t=t||0,s=s||0,n=n||"id",o=o||[];let a=Up(e,t),l=N2(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=Up(e,p);if(l[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let c=l[a];if(c===void 0)return{variation:-1};let d=o.findIndex(p=>p.key===c);return d<0?{variation:-1}:{variation:d}}function Up(r,e){return e=e||0,`${r}__${e}`}function jp(r,e){return`${r}||${e}`}function N2(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=ii(r,e),s=jp(n,So(i)),{hashAttribute:o,hashValue:a}=ii(r,t),l=a?jp(o,So(a)):null,c={};return l&&r.user.stickyBucketAssignmentDocs[l]&&Object.assign(c,r.user.stickyBucketAssignmentDocs[l].assignments||{}),r.user.stickyBucketAssignmentDocs[s]&&Object.assign(c,r.user.stickyBucketAssignmentDocs[s].assignments||{}),c}function F2(r,e,t,n){let i=jp(e,t),s=r.user.stickyBucketAssignmentDocs&&r.user.stickyBucketAssignmentDocs[i]?r.user.stickyBucketAssignmentDocs[i].assignments||{}:{},o={...s,...n},a=JSON.stringify(s)!==JSON.stringify(o);return{key:i,doc:{attributeName:e,attributeValue:t,assignments:o},changed:a}}function D2(r,e){let t=new Set,n=e&&e.features?e.features:r.global.features||{},i=e&&e.experiments?e.experiments:r.global.experiments||[];return Object.keys(n).forEach(s=>{let o=n[s];if(o.rules)for(let a of o.rules)a.variations&&(t.add(a.hashAttribute||"id"),a.fallbackAttribute&&t.add(a.fallbackAttribute))}),i.map(s=>{t.add(s.hashAttribute||"id"),s.fallbackAttribute&&t.add(s.fallbackAttribute)}),Array.from(t)}async function x_(r,e,t){let n=Wp(r,t);return e.getAllAssignments(n)}function Wp(r,e){let t={};return D2(r,e).forEach(i=>{let{hashValue:s}=ii(r,i);t[i]=So(s)}),t}async function w_(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await ni(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await ni(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await ni(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function S_(r){let e=r.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(r.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:r.apiHostRequestHeaders,streamingHostRequestHeaders:r.streamingHostRequestHeaders}}function nc(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var ji=typeof window<"u"&&typeof document<"u",H2=Gb(),Ao=class{constructor(e){if(e=e||{},this.version=H2,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch{}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=n=>t.saveAssignments(n)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),ji&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let t in this._options.stickyBucketAssignmentDocs){let n=this._options.stickyBucketAssignmentDocs[t];n&&this._options.stickyBucketService.saveAssignments(n).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await w_(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,ql(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Jb(e.cacheSettings),e.payload)return await this.setPayload(e.payload),ql(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return ql(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return S_(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:n,streaming:i}){if(!this._options.clientKey)throw new Error("Missing clientKey");return Qb({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,backgroundSync:i??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){let i=await ni(e,t||this._options.decryptionKey,n);this.setFeatures(JSON.parse(i))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){let i=await ni(e,t||this._options.decryptionKey,n);this.setExperiments(JSON.parse(i))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(t=>{try{t()}catch(n){console.error(n)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,e_(this),e.destroyAllStreams&&Np(),this.logs=[],ji&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(t=>{t.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=rc(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(n=>n.key===e).map(n=>this._runAutoExperiment(n)).filter(n=>n!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;let i=this._isAutoExperimentBlockedByContext(e),s,o;i?s=Me(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=rc(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&n&&n.valueHash===a)return s;if(n&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=jl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Kb(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(Ul(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:d,delay:p}=this._getNavigateFunction();if(d)if(ji)Promise.all([...o?[Wl(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??p))]).then(()=>{try{d(c)}catch(h){console.error(h)}});else try{d(c)}catch(h){console.error(h)}}else if(l==="visual"){let c=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(s.value):this._applyDOMChanges(s.value);c&&this._activeAutoExperiments.set(e,{undo:c,valueHash:a})}}return s}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{n.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(let i of t){let s=this._runAutoExperiment(i,e);if(s&&s.inExperiment&&jl(i)==="redirect")break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(i=>{try{i(e,t)}catch(s){console.error(s)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return tc(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(t=>t&&t.experiment&&t.result).map(t=>[nc(t.experiment,t.result),t]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error("Invalid deferred tracking call",{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error("Cannot log event to destroyed GrowthBook instance");return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(n){console.error(n)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set(nc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(ji?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=jl(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(n=>n.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let n=new URL(this._getContextUrl());for(let i of e.variations){if(!i||!i.urlRedirect)continue;let s=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==n.protocol||s.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:e.key,error:n}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:ji?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!ji)return;let t=[];if(e.css){let n=document.createElement("style");n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement("script");n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(n=>{t.push(p_.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await x_(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let n=this._getEvalContext(),i=Wp(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var B2="https://experiment.syntrologie.com",zp=class{constructor(e={}){this.featureListeners=new Set;if(e.client)this.gb=e.client;else{let t=e.onExperimentViewed?(n,i)=>{e.onExperimentViewed(n.key,i.variationId,typeof i.value=="string"?i.value:`variation_${i.variationId}`)}:void 0;this.gb=new Ao({...e,apiHost:e.apiHost??B2,enableDevMode:e.enableDevMode??!0,trackingCallback:t}),e.autoInit&&this.gb.init({streaming:!0})}}get _internal(){return this.gb}async refreshFeatures(){await this.gb.loadFeatures()}setAttributes(e){this.gb.setAttributes({...this.gb.getAttributes(),...e})}setForcedVariations(e){this.gb.setForcedVariations(e)}getFeatureValue(e,t){return this.gb.getFeatureValue(e,t)}getAllFeatures(){let e=this.gb.getFeatures(),t={};for(let n of Object.keys(e))t[n]=this.gb.getFeatureValue(n,null);return t}shouldRenderRectangle(e){return!0}onFeaturesChanged(e){return this.featureListeners.add(e),this.featureListeners.size===1&&this.gb.setRenderer(()=>{for(let t of this.featureListeners)t()}),()=>{this.featureListeners.delete(e),this.featureListeners.size===0&&this.gb.setRenderer(null)}}};function qp(r={}){return new zp(r)}var k_={growthbook:r=>qp({...r,autoInit:!0})};function E_(r,e){let t=k_[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(k_).join(", ")}`);return t(e)}var V2=["cdn.syntrologie.com","localhost","127.0.0.1"];function U2(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] CDN URL must use HTTPS:",r),!1):V2.some(i=>e.hostname===i)?!0:(console.warn("[SmartCanvas] CDN host not in allowlist:",e.hostname),!1)}catch{return console.warn("[SmartCanvas] Invalid CDN URL:",r),!1}}var Zp=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!U2(this.url))throw new Error(`[SmartCanvas] CDN URL not allowed: ${this.url}`)}async fetch(){let e=performance.now(),t=await fetch(this.url,{credentials:"omit",cache:"default"});if(!t.ok)throw new Error(`[SmartCanvas] Failed to fetch config from CDN (${t.status})`);let n=await t.text();if(this.integrity){let l=await j2(n),c=this.integrity.replace("sha384-","");if(l!==c)throw new Error(`[SmartCanvas] Config integrity check failed. Expected ${c}, got ${l}`)}let i=JSON.parse(n),s=performance.now()-e,o=t.headers.get("cache-control"),a=t.headers.get("age");return{config:i,meta:{source:"cdn",fetchTimeMs:s,cached:o?.includes("public")??!1,cacheAge:a?parseInt(a,10):void 0}}}};async function j2(r){let t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-384",t),i=new Uint8Array(n);return btoa(String.fromCharCode(...i))}function C_(r){return new Zp(r)}var W2="syntro_exp",z2="syntro_var",Gp=class{constructor(e){this.name="experiments";this.client=e.client,this.featureKey=e.featureKey,this.manifestKey=e.manifestKey,this.variantFlagPrefix=e.variantFlagPrefix}async fetch(){let e=performance.now();if(typeof window<"u"){let i=new URLSearchParams(window.location.search),s=i.get(W2),o=i.get(z2);if(s&&o!==null&&this.client.setForcedVariations){let a=parseInt(o,10);Number.isNaN(a)||(console.log(`[SmartCanvas] Preview mode: forcing "${s}" to variation ${a}`),this.client.setForcedVariations({[s]:a}))}}if(this.manifestKey||this.variantFlagPrefix||this.client.getAllFeatures){let i=this.fetchMultiFlag();if(i){let s=performance.now()-e;return{config:i,meta:{source:"experiments",fetchTimeMs:s,cached:!0}}}}if(!this.featureKey)throw new Error("[SmartCanvas] No featureKey configured and no variant flags found. Ensure at least one config feature flag exists in your experiment platform.");let t=this.client.getFeatureValue?.(this.featureKey,null);if(!t||typeof t!="object")throw new Error(`[SmartCanvas] Feature "${this.featureKey}" not found or invalid. Ensure the feature is configured in your experiment platform.`);let n=performance.now()-e;return{config:t,meta:{source:"experiments",fetchTimeMs:n,cached:!0}}}fetchMultiFlag(){let e=this.getVariantFlagKeys();return!e||e.length===0?null:fl(this.client,e)}getVariantFlagKeys(){if(this.manifestKey){let e=this.client.getFeatureValue?.(this.manifestKey,null);if(e&&typeof e=="object"){let t=e.variant_flags;if(t&&t.length>0)return t}}if(this.client.getAllFeatures){let e=this.client.getAllFeatures();return this.variantFlagPrefix?Object.keys(e).filter(t=>t.startsWith(this.variantFlagPrefix)):Object.keys(e)}return[]}};function A_(r){return new Gp(r)}var q2="https://cdn.syntrologie.com/configs",T_={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return C_({baseUrl:r.baseUrl??q2,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return A_({featureKey:r.featureKey})}};function R_(r,e={}){let t=T_[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(T_).join(", ")}`);return t(e)}var I_="syntro_session_metrics",ic=class{constructor(e={}){this.metrics=new Map;this.subscribers=new Set;this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,t=1){let i=(this.metrics.get(e)??0)+t;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),this.notifySubscribers(),i}set(e,t){this.metrics.set(e,t),this.saveToStorage(),this.updateExperimentAttributes(e,t),this.onMetricChange?.(e,t),this.notifySubscribers()}get(e){return this.metrics.get(e)??0}meetsThreshold(e,t){return this.get(e)>=t}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0),this.notifySubscribers()}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let t={};for(let n of e)t[`${this.attributePrefix}${n}`]=0,this.onMetricChange?.(n,0);this.experiments?.setAttributes?.(t),this.notifySubscribers()}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}destroy(){this.subscribers.clear()}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,t){if(!this.experiments?.setAttributes)return;let n=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[n]:t})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[t,n]of this.metrics)e[`${this.attributePrefix}${t}`]=n;this.experiments.setAttributes(e)}notifySubscribers(){for(let e of this.subscribers)try{e()}catch{}}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(I_);if(e){let t=JSON.parse(e);for(let[n,i]of Object.entries(t))this.metrics.set(n,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[t,n]of this.metrics)e[t]={count:n,lastUpdated:Date.now()};sessionStorage.setItem(I_,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Kp(r={}){return new ic(r)}var To=class{constructor(e){this.unsubUnload=null,this.unsubLoad=null,this.destroyed=!1,this.adapter=e}activate(){this.destroyed||(this.unsubUnload=this.adapter.onRegionWillUnload(e=>{this.hideContentInSection(e)}),this.unsubLoad=this.adapter.onRegionDidLoad(e=>{this.revealContentInSection(e)}))}destroy(){this.destroyed=!0,this.unsubUnload?.(),this.unsubLoad?.(),this.unsubUnload=null,this.unsubLoad=null}hideContentInSection(e){let t=this.sectionSelector(e),n=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of n)i.style.opacity="0",i.style.transition="none"}revealContentInSection(e){let t=this.sectionSelector(e);requestAnimationFrame(()=>{if(this.destroyed)return;let n=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of n)i.style.transition="opacity 120ms ease-in",i.style.opacity="1"})}sectionSelector(e){let t=typeof CSS<"u"?CSS.escape(e):e;return document.getElementById(`shopify-section-${e}`)?`#shopify-section-${t}`:`.shopify-section[id$="-${t}"]`}};var Ro=class{constructor(e){this.name="shopify",this.loadCallbacks=new Set,this.unloadCallbacks=new Set,this.abortController=null,this.antiFlicker=null,this.initTimeoutMs=e?.initTimeoutMs??3e3}detect(){return typeof window>"u"||typeof document>"u"?!1:!!("Shopify"in window&&window.Shopify!=null||document.querySelector('meta[name="shopify-checkout-api-token"]'))}async onInit(){this.abortController=new AbortController;let{signal:e}=this.abortController;this.attachSectionListeners(e),this.antiFlicker=new To(this),this.antiFlicker.activate(),await this.waitForInitialSections(this.initTimeoutMs,e)}onRegionDidLoad(e){return this.loadCallbacks.add(e),()=>{this.loadCallbacks.delete(e)}}onRegionWillUnload(e){return this.unloadCallbacks.add(e),()=>{this.unloadCallbacks.delete(e)}}onRegionMutated(e){}getAnchorScope(e){let t=e.closest(".shopify-section");return t?.id?`#${typeof CSS<"u"?CSS.escape(t.id):t.id} `:""}destroy(){this.antiFlicker?.destroy(),this.antiFlicker=null,this.abortController&&(this.abortController.abort(),this.abortController=null),this.loadCallbacks.clear(),this.unloadCallbacks.clear()}attachSectionListeners(e){document.addEventListener("shopify:section:load",t=>{let n=t.detail?.sectionId;if(n)for(let i of this.loadCallbacks)try{i(n)}catch{}},{signal:e}),document.addEventListener("shopify:section:unload",t=>{let n=t.detail?.sectionId;if(n)for(let i of this.unloadCallbacks)try{i(n)}catch{}},{signal:e})}waitForInitialSections(e,t){return new Promise(n=>{if(document.querySelector(".shopify-section")){n();return}let i=!1,s=()=>{i||(i=!0,n())};document.addEventListener("shopify:section:load",()=>s(),{once:!0,signal:t});let o=setTimeout(s,e);t.addEventListener("abort",()=>{clearTimeout(o),s()},{once:!0})})}};var fF=720*60*60;var M_=[()=>new Ro];function $_(){for(let r of M_){let e=r();if(e.detect())return e}return null}function O_(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Xp(r,e){return r==="telegram"||r==="mcp-app"?"agent":e==="mobile"?"mobile":"desktop"}function X2(r="web",e="web"){let t=Date.now(),n=typeof window<"u"?window.innerWidth:0,i=typeof window<"u"?window.innerHeight:0,s=O_(n);return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:t,pageHistory:[]},viewport:{width:n,height:i},surface:{type:r,host:e,device:s,mode:Xp(r,s)}}}function Yp(r,e){if(!e)return;let t;try{t=new URL(r).pathname}catch{t=r}if(t.startsWith("/")||(t=`/${t}`),e.exclude){for(let n of e.exclude)if(P_(t,n))return}if(e.include){for(let n of e.include)if(P_(t,n))return n;return}return t}function P_(r,e){let t=r.replace(/\/$/,"")||"/",n=e.replace(/\/$/,"")||"/";if(t===n)return!0;let i=n.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var sc=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=X2(e.initialSurfaceType,e.initialSurfaceHost),this.previousContext={...this.context},e.telemetry?.getSessionId){let t=e.telemetry.getSessionId();t&&(this.context.session.sessionId=t)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=Yp(this.context.page.url,this.routes),this.addPageToHistory(this.context.page.url),typeof window<"u"&&this.setupBrowserListeners()}get(){return{...this.context}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setRoutes(e){this.routes=e;let t=Yp(this.context.page.url,this.routes);t!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:t}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}setSurfaceType(e){if(e===this.context.surface.type)return;let t=Xp(e,this.context.surface.device);this.updateContext({surface:{...this.context.surface,type:e,mode:t}})}setSurfaceHost(e){e!==this.context.surface.host&&this.updateContext({surface:{...this.context.surface,host:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",t),this.cleanupFns.push(()=>window.removeEventListener("resize",t));let n=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(n)}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight},t=e.width!==this.context.viewport.width,n=e.height!==this.context.viewport.height;if(!t&&!n)return;let i={viewport:e};if(t){let s=O_(e.width);if(s!==this.context.surface.device){let o=Xp(this.context.surface.type,s);i.surface={...this.context.surface,device:s,mode:o}}}this.updateContext(i)}updatePage(){let e=window.location.href,{title:t}=document,n=Yp(e,this.routes),i={url:e,title:t,routeId:n};(i.url!==this.context.page.url||i.title!==this.context.page.title||i.routeId!==this.context.page.routeId)&&(i.url!==this.context.page.url&&this.addPageToHistory(i.url),this.updateContext({page:i}))}addPageToHistory(e){let t={url:e,ts:Date.now()},n=[...this.context.session.pageHistory||[],t];n.length>50&&n.shift(),this.context.session.pageHistory=n}updateContext(e){this.previousContext={...this.context},this.context={...this.context,...e},this.notifyListeners()}notifyListeners(){for(let e of this.listeners)try{e(this.context,this.previousContext)}catch(t){console.error("[ContextManager] Listener error:",t)}}};function Jp(r){return new sc(r)}function L_(r,e){let{context:t,state:n,events:i}=e;switch(r.type){case"page_url":{let{url:s}=r,o=t.page.url.split("?")[0].split("#")[0],a=s.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*");return new RegExp(`^${a}$`).test(o)}case"route":return t.page.routeId===r.routeId;case"anchor_visible":{let s=t.anchors?.find(o=>o.anchorId===r.anchorId);switch(r.state){case"visible":return s?.visible===!0;case"present":return s?.present===!0;case"absent":return!s?.present;default:return!1}}case"event_occurred":{if(!i)return!1;let s=r.withinMs??6e4;return i.hasRecentEvent(r.eventName,s)}case"state_equals":return n?.getValue?n.getValue(r.key)===r.value:!1;case"viewport":{let{width:s,height:o}=t.viewport;return!(r.minWidth!==void 0&&s<r.minWidth||r.maxWidth!==void 0&&s>r.maxWidth||r.minHeight!==void 0&&o<r.minHeight||r.maxHeight!==void 0&&o>r.maxHeight)}case"session_metric":{let s=e.sessionMetrics?e.sessionMetrics.get(r.key):n?.getSessionMetric(r.key);if(s===void 0)return!1;let{operator:o,threshold:a}=r;switch(o){case"gte":return s>=a;case"lte":return s<=a;case"eq":return s===a;case"gt":return s>a;case"lt":return s<a;default:return!1}}case"dismissed":{if(!n)return r.inverted??!1;let s=n.isDismissed(r.key);return r.inverted?!s:s}case"cooldown_active":{if(!n)return r.inverted??!1;let s=n.isCooldownActive(r.key);return r.inverted?!s:s}case"frequency_limit":{if(!n)return r.inverted??!1;let o=n.getFrequencyCount(r.key)>=r.limit;return r.inverted?!o:o}case"event_count":{if(!e.accumulator)return!1;let s=r,o=e.accumulator.getCount(s.key,s.withinMs);switch(s.operator){case"gte":return o>=s.count;case"lte":return o<=s.count;case"eq":return o===s.count;case"gt":return o>s.count;case"lt":return o<s.count;default:return!1}}default:return console.warn("[RuleStrategy] Unknown condition type:",r.type),!1}}function N_(r,e){let t=[];for(let n of r.conditions){let i=L_(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function oc(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=N_(n,e);if(i)return{value:n.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:t,evaluatedConditions:s}}}return{value:r.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function ac(r,e){let{context:t}=e,n=t.augmented?.[r.field];return n===void 0||typeof n!="number"?{value:r.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:n>=r.threshold?r.above:r.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function F_(r,e){let{state:t,events:n,sessionMetrics:i,accumulator:s}=e;return{context:r,state:t?{isDismissed:o=>t.dismissals.isDismissed(o),isCooldownActive:o=>t.cooldowns.isActive(o),getFrequencyCount:o=>t.frequency.count(o),getSessionMetric:o=>i?.get(o)??0,getValue:o=>t.session.get(o)??t.user.get(o)}:void 0,sessionMetrics:i?{get:o=>i.get(o)??0}:void 0,events:n?{hasRecentEvent:(o,a)=>n.hasRecentEvent(o,a)}:void 0,accumulator:s?{getCount:(o,a)=>s.getCount(o,a)}:void 0}}async function D_(r,e,t={}){let n=F_(e,t);switch(r.type){case"rules":return oc(r,n);case"score":return ac(r,n);case"model":return{value:r.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:r.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",r.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:r.type}}}}function H_(r,e,t={}){let n=F_(e,t);switch(r.type){case"rules":return oc(r,n);case"score":return ac(r,n);case"model":case"external":return{value:r.default,isFallback:!0,matchInfo:{strategyType:r.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:r.type}}}}function Qp(r){return{evaluate:(e,t)=>D_(e,t,r),evaluateSync:(e,t)=>H_(e,t,r)}}function eh(r){let{eventBus:e,stateStore:t}=r,n=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let d=!1;for(let p of n.values()){if(!p.predicate(c))continue;let h=o.get(p.stateKey)||{count:0};h.count++,p.needsTimestamps&&(h.timestamps||(h.timestamps=[]),h.timestamps.push(c.ts),h.timestamps.length>200&&(h.timestamps=h.timestamps.slice(-200))),o.set(p.stateKey,h),d=!0}if(d)for(let p of i)try{p()}catch(h){console.error("[EventAccumulator] Subscriber error:",h)}}function l(){s||n.size===0||(s=e.subscribe(a))}return{register(c,d,p=!1){let h=`ev:${c}`,f=n.get(h);if(f){p&&!f.needsTimestamps&&(f.needsTimestamps=!0);return}n.set(h,{stateKey:h,needsTimestamps:p,predicate:d}),l()},getCount(c,d){let p=`ev:${c}`,h=o.get(p);if(!h)return 0;if(d===void 0||!h.timestamps)return h.count;let f=Date.now()-d;return h.timestamps.filter(v=>v>=f).length},subscribe(c){return i.add(c),()=>{i.delete(c)}},destroy(){s&&(s(),s=null),n.clear(),i.clear()}}}var Io=class{constructor(){this.listeners=new Set;this.destroyed=!1;this.onPopState=()=>{this.notify(window.location.href,"popstate")};this.wasNative=this.isNativeFunction(history.pushState),this.capturedPushState=history.pushState,this.capturedReplaceState=history.replaceState,history.pushState=(...e)=>{this.capturedPushState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"pushState"))},history.replaceState=(...e)=>{this.capturedReplaceState.call(history,...e),queueMicrotask(()=>this.notify(window.location.href,"replaceState"))},window.addEventListener("popstate",this.onPopState)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}diagnose(){return{isNative:this.wasNative,subscriberCount:this.listeners.size}}destroy(){this.destroyed||(this.destroyed=!0,history.pushState=this.capturedPushState,history.replaceState=this.capturedReplaceState,window.removeEventListener("popstate",this.onPopState),this.listeners.clear())}notify(e,t){if(!this.destroyed)for(let n of this.listeners)try{n(e,t)}catch{}}isNativeFunction(e){try{return Function.prototype.toString.call(e).includes("[native code]")}catch{return!1}}};var th="cooldown:";function B_(r){return{set(e,t){let n=th+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=th+e,n=r.get(t);if(n===void 0)return 0;let i=n-Date.now();return i<=0?(r.remove(t),0):i},clear(e){let t=th+e;r.remove(t)}}}var Mo="dismissed:";function V_(r,e){return{mark(t,n=!1){let i=Mo+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Mo+t;return r.has(n)||e.has(n)},clear(t){let n=Mo+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Mo)&&r.remove(t);for(let t of e.keys())t.startsWith(Mo)&&e.remove(t)}}}var rh="freq:";function U_(r){function e(t){let n=rh+t,i=r.get(n);if(i){if(i.resetAt&&Date.now()>=i.resetAt){r.remove(n);return}return i}}return{increment(t,n){let i=rh+t,s=e(t),o=(s?.count??0)+1,a={count:o,resetAt:s?.resetAt??(n?Date.now()+n:void 0)};return r.set(i,a),o},count(t){return e(t)?.count??0},reset(t){let n=rh+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var J2="syntro";function nh(r,e){let t=`${e}:`;return{get(n){if(r)try{let i=r.getItem(t+n);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){r.removeItem(t+n);return}return s.value}catch{return}},set(n,i,s){if(r)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};r.setItem(t+n,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(n){r&&r.removeItem(t+n)},has(n){return r?this.get(n)!==void 0:!1},keys(){if(!r)return[];let n=[];for(let i=0;i<r.length;i++){let s=r.key(i);s?.startsWith(t)&&n.push(s.slice(t.length))}return n},clear(){if(!r)return;let n=this.keys();for(let i of n)r.removeItem(t+i)}}}function $o(r){let e=new Map,t=`${r}:`;return{get(n){let i=e.get(t+n);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+n);return}return i.value}},set(n,i,s){e.set(t+n,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(n){e.delete(t+n)},has(n){return this.get(n)!==void 0},keys(){let n=[];for(let i of e.keys())i.startsWith(t)&&n.push(i.slice(t.length));return n},clear(){for(let n of e.keys())n.startsWith(t)&&e.delete(n)}}}var lc=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??J2;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?nh(window.sessionStorage,this.namespace):$o(this.namespace),this.user=t(window.localStorage)?nh(window.localStorage,this.namespace):$o(this.namespace)):(this.session=$o(this.namespace),this.user=$o(this.namespace)),this.dismissals=V_(this.session,this.user),this.cooldowns=B_(this.user),this.frequency=U_(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?nh(sessionStorage,t):$o(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function ih(r={}){return new lc(r)}function Po(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function cc(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var j_={drawer_right:{position:"fixed",top:"0",right:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_left:{position:"fixed",top:"0",left:"0",bottom:"0",width:"360px",maxWidth:"90vw"},drawer_bottom:{position:"fixed",left:"0",right:"0",bottom:"0",maxHeight:"50vh"},overlay_center:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"90vw",maxHeight:"90vh"},overlay_corner_br:{position:"fixed",bottom:"16px",right:"16px",maxWidth:"400px",maxHeight:"80vh"},overlay_corner_bl:{position:"fixed",bottom:"16px",left:"16px",maxWidth:"400px",maxHeight:"80vh"},toast_top:{position:"fixed",top:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"},toast_bottom:{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",maxWidth:"90vw"}},Oo={fade:[{opacity:0},{opacity:1}],slide:[{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"translateY(0)"}],scale:[{opacity:0,transform:"scale(0.95)"},{opacity:1,transform:"scale(1)"}],none:[]},W_={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function sh(r,e,t){let n=j_[e];Object.assign(r.style,n),t&&(t.maxWidth&&(r.style.maxWidth=t.maxWidth),t.maxHeight&&(r.style.maxHeight=t.maxHeight),t.minWidth&&(r.style.minWidth=t.minWidth),t.minHeight&&(r.style.minHeight=t.minHeight))}function oh(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Ra(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Ma()),t.shift!==!1&&i.push(Ia({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Ta(e,r,async()=>{let{x:o,y:a,strategy:l}=await $a(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function ah(r,e,t="append"){return r.style.position="relative",r.style.display="inline-block",t==="prepend"?e.insertBefore(r,e.firstChild):e.appendChild(r),()=>{r.remove()}}function lh(r,e){return e==="none"||Oo[e].length===0?null:r.animate(Oo[e],W_)}function ch(r,e){if(e==="none"||Oo[e].length===0)return Promise.resolve();let t=[...Oo[e]].reverse(),n=r.animate(t,W_);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function uh(r,e){let t=document.createElement("div");return t.setAttribute("data-syntro-surface",r),t.setAttribute("data-syntro-mount-id",e),t.className="syntro-surface",Object.assign(t.style,{pointerEvents:"auto",boxSizing:"border-box",overflow:"auto"}),t}function dh(r){switch(Po(r)){case"static":return r.startsWith("drawer")?2147483640:r.startsWith("overlay")?2147483642:r.startsWith("toast")?2147483644:2147483640;case"inline":return 1;case"adjacent":return 2147483638;default:return 2147483640}}function z_(r){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(r),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=r;let n=t.content,i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,null),s=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]),o=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!s.has(l)){o.push(a);continue}for(let c of Array.from(a.attributes)){let d=c.name.toLowerCase(),p=c.value.trim().toLowerCase(),h=d.startsWith("on"),f=(d==="href"||d==="src")&&p.startsWith("javascript:");(h||f)&&a.removeAttribute(c.name)}}for(let a of o){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML=(n.firstChild,t.innerHTML)}var Q2=0;function ph(r){let{overlayRoot:e,eventBus:t,anchorResolver:n,defaultAnimation:i="fade",widgetRegistry:s}=r,o=new Map,a=new Map,l=new Map;function c(){return`mount-${++Q2}`}function d(y,S){t&&t.publish(y,S)}function p(y){let S=l.get(y);if(S){let T=g(y);for(let _ of S)try{_(T)}catch(C){console.error("[Surfaces] State callback error:",C)}}}let h=new Map;function f(y,S,T){switch(S.type){case"html":y.innerHTML=z_(S.content);return;case"widget":{if(s?.has(S.widgetId)){let _=s.mount(S.widgetId,y,S.config);return T&&h.set(T,_),()=>{_.unmount(),T&&h.delete(T)}}console.warn(`[Surfaces] Widget not found: ${S.widgetId}`),y.innerHTML=`<div data-widget-id="${S.widgetId}" data-widget-missing="true">Widget: ${S.widgetId}</div>`;return}case"custom":return S.mount(y);case"react":y.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(y,S,T){let _=c(),C=Po(y),R=T?.priority??0,N=T?.animation??i,$=T?.exclusive??!0,F=o.get(y);if(F&&$){if(F.options.priority>R)throw new Error(`Slot ${y} is occupied by higher priority content (${F.options.priority} > ${R})`);m(F)}let V=uh(y,_);V.style.zIndex=String(dh(y));let P;if(C==="static")sh(V,y,T?.constraints),e.appendChild(V);else if(C==="inline"){let D=cc(y);if(!D)throw new Error(`Invalid inline slot: ${y}`);if(!n)throw new Error("Anchor resolver required for inline slots");let te=n({selector:D,route:"**"});if(!te)throw new Error(`Anchor not found for inline slot: ${D}`);P=ah(V,te)}else if(C==="adjacent"){let D=cc(y);if(!D)throw new Error(`Invalid adjacent slot: ${y}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let te=n({selector:D,route:"**"});if(!te)throw new Error(`Anchor not found for adjacent slot: ${D}`);e.appendChild(V),P=oh(V,te,T?.position??{placement:"bottom"})}let K=f(V,S,_);lh(V,N);let Y={id:_,slot:y,content:S,options:{priority:R,exclusive:$,animation:N,position:T?.position??{placement:"auto"},constraints:T?.constraints??{},adaptiveId:T?.adaptiveId,autoUnmountOnRouteChange:T?.autoUnmountOnRouteChange??!0},container:V,cleanup:()=>{P?.(),K?.()},mountedAt:Date.now()};return o.set(y,Y),a.set(y,(a.get(y)??0)+1),d("surface.mounted",{slot:y,id:_,adaptiveId:T?.adaptiveId}),p(y),{id:_,update(D){let te=o.get(y);if(!te||te.id!==_)throw new Error("Mount no longer active");let Ze=h.get(_);if(Ze){if(D.type==="widget"){Ze.update(D.config),te.content=D;return}Ze.unmount(),h.delete(_)}te.container.innerHTML="";let at=f(te.container,D,_);if(te.content=D,at){let Le=te.cleanup;te.cleanup=()=>{Le?.(),at()}}},setOptions(D){let te=o.get(y);if(!te||te.id!==_)throw new Error("Mount no longer active");D.priority!==void 0&&(te.options.priority=D.priority),D.animation!==void 0&&(te.options.animation=D.animation),D.constraints&&C==="static"&&(D.constraints.maxWidth&&(te.container.style.maxWidth=D.constraints.maxWidth),D.constraints.maxHeight&&(te.container.style.maxHeight=D.constraints.maxHeight),D.constraints.minWidth&&(te.container.style.minWidth=D.constraints.minWidth),D.constraints.minHeight&&(te.container.style.minHeight=D.constraints.minHeight)),p(y)},async unmount(){let D=o.get(y);!D||D.id!==_||await m(D)},isMounted(){return o.get(y)?.id===_},getContainer(){let D=o.get(y);return D?.id===_?D.container:null}}}async function m(y){y.container.isConnected&&await ch(y.container,y.options.animation);try{y.cleanup?.()}catch(S){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",S)}try{y.container.remove()}catch{}o.delete(y.slot),d("surface.unmounted",{slot:y.slot,id:y.id}),p(y.slot)}function g(y){let S=o.get(y);return{slot:y,occupied:!!S,currentPriority:S?.options.priority,currentAdaptiveId:S?.options.adaptiveId,mountCount:a.get(y)??0,currentMountId:S?.id}}function b(y,S){let T=l.get(y);return T||(T=new Set,l.set(y,T)),T.add(S),()=>{T?.delete(S),T?.size===0&&l.delete(y)}}function x(y,S){let T=o.get(y);return T?S!==void 0?S>=T.options.priority:!1:!0}function w(){for(let y of o.values())try{y.cleanup?.(),y.container.remove()}catch(S){console.error("[Surfaces] Error during cleanup:",S)}o.clear(),l.clear()}return{mount:v,getState:g,onStateChange:b,canMount:x,destroy:w}}var uc=class{constructor(){this.widgets=new Map;this.mountedWidgets=new Map;this.mountIdCounter=0;this.listeners=new Set}bindRuntime(e){this.runtimeRef=e}register(e,t,n="custom",i){if(this.widgets.has(e)){if(this.widgets.get(e).source==="built-in")throw new Error(`Cannot override built-in widget: ${e}`);console.warn(`[WidgetRegistry] Overriding widget: ${e}`)}this.widgets.set(e,{id:e,widget:t,source:n,metadata:i}),this.notify({type:"registered",widgetId:e})}unregister(e){let t=this.widgets.get(e);return t?t.source==="built-in"?(console.warn(`[WidgetRegistry] Cannot unregister built-in widget: ${e}`),!1):(this.widgets.delete(e),this.notify({type:"unregistered",widgetId:e}),!0):!1}unregisterBySource(e){for(let[t,n]of this.widgets.entries())n.source===e&&this.widgets.delete(t)}get(e){return this.widgets.get(e)?.widget}getRegistration(e){return this.widgets.get(e)}has(e){return this.widgets.has(e)}mount(e,t,n){let i=this.widgets.get(e);if(!i)throw new Error(`Widget not found: ${e}`);let s=`widget-mount-${++this.mountIdCounter}`;t.setAttribute("data-widget-mount-id",s),t.setAttribute("data-widget-id",e);let o={...n,runtime:this.runtimeRef},a=i.widget.mount(t,o);return this.mountedWidgets.set(s,{cleanup:a??void 0,container:t}),{widgetId:e,container:t,unmount:()=>{let c=this.mountedWidgets.get(s);c&&(t.isConnected&&c.cleanup?.(),this.mountedWidgets.delete(s),t.removeAttribute("data-widget-mount-id"),t.removeAttribute("data-widget-id"),t.innerHTML="")},update:c=>{if(i.widget.update)i.widget.update(t,c);else{let d=this.mountedWidgets.get(s);if(d){d.cleanup?.(),t.innerHTML="";let p={...c,runtime:this.runtimeRef},h=i.widget.mount(t,p);d.cleanup=h??void 0}}}}}list(){return Array.from(this.widgets.keys())}listRegistrations(){return Array.from(this.widgets.values())}getBySource(e){return Array.from(this.widgets.values()).filter(t=>t.source===e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){for(let t of this.listeners)try{t(e)}catch(n){console.error("[WidgetRegistry] Listener error:",n)}}destroy(){for(let[e,t]of this.mountedWidgets.entries())t.cleanup?.(),t.container.innerHTML="";this.mountedWidgets.clear()}},hh=new uc;var Z_="2.0.0";function eT(r,e){if(!e)return!0;let t;try{t=new URL(r).pathname}catch{t=r}t.startsWith("/")||(t=`/${t}`);let n=t.replace(/\/$/,"")||"/";if(e.exclude){for(let i of e.exclude)if(fh(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(fh(n,i))return!0;return!1}return!0}function fh(r,e){let t=e.replace(/\/$/,"")||"/";if(r===t)return!0;let n=t.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*").replace(/:[^/]+/g,"[^/]+");return new RegExp(`^${n}$`).test(r)}function q_(r){let t=(typeof window<"u"?window.location.pathname:"/").replace(/\/$/,"")||"/";return(Array.isArray(r.route)?r.route:[r.route]).some(i=>{let s=i;if(/^https?:\/\//.test(s))try{s=new URL(s).pathname}catch{}return fh(t,s)})}function gh(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??hh,a=r.executors??Ar,l=r.apps??Cs,c=new Io,d=Jp({telemetry:e,routes:n,navigation:c,initialSurfaceType:r.initialSurfaceType,initialSurfaceHost:r.initialSurfaceHost}),p=r.events??_o(),h=ih({namespace:s}),f=eh({eventBus:p,stateStore:h}),v=Qp({state:h,events:p,sessionMetrics:t,accumulator:f}),m=yb(),g=ap(),b=$=>q_($)?g.resolve($.selector):null,x=async($,F)=>{if(!q_($))return null;try{return await g.waitFor($.selector,F)}catch{return null}},w=ph({overlayRoot:m,eventBus:p,anchorResolver:b,widgetRegistry:o}),y=np({overlayRoot:m,eventBus:p,surfaces:w,anchorResolver:b,waitForAnchor:x,executorRegistry:a,subscribeNavigation:$=>c.subscribe($),runtime:{evaluateSync:$=>v.evaluateSync($,d.get()),context:d,accumulator:f,sessionMetrics:t,events:p?{subscribe:$=>p.subscribe(()=>$())}:void 0}}),S;if(t){let $=t;$.increment("page_views");let F=typeof window<"u"?window.location.pathname:"/";S=c.subscribe((V,P)=>{if(P!=="replaceState")try{let K=new URL(V).pathname;K!==F&&(F=K,$.increment("page_views"),T=0,$.set("time_on_page",0),$.set("scroll_depth",0))}catch{}})}let T=0,_,C;if(t){let $=t;_=setInterval(()=>{T++},1e3),C=setInterval(()=>{$.set("time_on_page",T)},5e3)}let R;if(t&&p){let $=t;R=p.subscribe({names:["ui.scroll"]},F=>{let V=F.props?.scrollPercentage;typeof V=="number"&&V>$.get("scroll_depth")&&$.set("scroll_depth",V)})}let N={telemetry:e,context:d,events:p,state:h,sessionMetrics:t,actions:y,surfaces:w,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:g,navigation:c,version:Z_,mode:i,async evaluate($){return v.evaluate($,d.get())},evaluateSync($){return v.evaluateSync($,d.get())},async filterTiles($){let F=d.get().page.url,V=[];for(let P of $){if(P.dismissible!==!1&&h.dismissals.isDismissed(P.id))continue;let K=P.activation;if(!K){V.push(P);continue}if(eT(F,K.routes)){if(K.onlyIfPopulated){let Y=P.props?.actions??[];if(Y.length>0&&!Y.some(D=>D.triggerWhen?v.evaluateSync(D.triggerWhen,d.get()).value:!0))continue}V.push(P)}}return V},setRoutes($){d.setRoutes($)},destroy(){l.unbind().catch($=>{console.error("[Runtime] Error unbinding apps registry:",$)}),S?.(),R?.(),_&&clearInterval(_),C&&clearInterval(C),g.destroy(),f.destroy(),c.destroy(),d.destroy(),y.destroy(),w.destroy()}};return l.bind(N),o.bindRuntime(N),N}function G_(r){return r==="granted"?"granted":r==="denied"?"denied":"pending"}function mh(r){return r?Array.isArray(r)&&r[0]==="consent"?r[2]?.analytics_storage??null:typeof r=="object"&&r.event==="consent_update"?r.analytics_storage??null:null:null}var Lo=class{constructor(){this.name="gtm-consent-mode-v2"}detect(){if(typeof window>"u")return!1;let e=window.dataLayer;if(!Array.isArray(e))return!1;for(let t of e)if(mh(t)!==null)return!0;return!1}initialize(e){if(typeof window>"u")return e("pending"),()=>{};Array.isArray(window.dataLayer)||(window.dataLayer=[]),e(this.readCurrentState());let t=window.dataLayer,n=t.push.bind(t),i=(...s)=>{let o=n(...s);for(let a of s){let l=mh(a);l!==null&&e(G_(l))}return o};return t.push=i,()=>{t.push===i&&(t.push=n)}}readCurrentState(){if(typeof window>"u")return"pending";let e=window.dataLayer;if(!Array.isArray(e))return"pending";for(let t=e.length-1;t>=0;t--){let n=mh(e[t]);if(n!==null)return G_(n)}return"pending"}};var No=class{constructor(){this.name="iab-tcf-v2"}detect(){return typeof window>"u"?!1:typeof window.__tcfapi=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.__tcfapi;if(typeof t!="function")return()=>{};let n;return t("addEventListener",2,(i,s)=>{if(!s||!i||(n===void 0&&typeof i.listenerId=="number"&&(n=i.listenerId),!(i.eventStatus==="tcloaded"||i.eventStatus==="useractioncomplete")))return;if(i.gdprApplies===!1){e("granted");return}let a=i.purpose?.consents??{},l=a[1]===!0,c=a[8]===!0;e(l&&c?"granted":"denied")}),()=>{if(n!==void 0)try{t("removeEventListener",2,()=>{},n)}catch{}}}};var K_="visitorConsentCollected",Fo=class{constructor(){this.name="shopify-customer-privacy"}detect(){return typeof window>"u"?!1:typeof window.Shopify?.loadFeatures=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.Shopify;if(!t?.loadFeatures)return()=>{};let n;return t.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],i=>{if(i)return;let s=t.customerPrivacy?.userCanBeTracked()??!0;e(s?"granted":"denied"),n=o=>{let a=o.detail;e(a?.analyticsAllowed?"granted":"denied")},document.addEventListener(K_,n)}),()=>{n&&document.removeEventListener(K_,n)}}};var Do=class{constructor(e){this.options=e}async start(e){for(let n of this.options.adapters){let i=!1;try{i=n.detect()}catch{continue}if(i)try{let s=n.initialize(o=>e.setStatus(o));return this.options.onAdapterSelected?.(n.name),s}catch(s){console.warn(`[Syntro consent] Adapter "${n.name}" failed:`,s)}}this.options.onAdapterSelected?.(null);let t=await this.resolveFallback();return e.setStatus(t),()=>{}}async resolveFallback(){if(!this.options.fallbackStatus)return"pending";try{return await this.options.fallbackStatus()}catch{return"pending"}}};var Ho=class{constructor(e={}){this.listeners=new Set;this.destroyed=!1;this.status=e.initialStatus??"pending",this.configCallback=e.onConsentChange,this.gtmEnabled=e.readFromGtmConsentMode??!1,this.pendingResolverFn=e.pendingResolver}grant(){this.setStatus("granted")}deny(){this.setStatus("denied")}getStatus(){return this.status}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}subscribeOnce(e){if(this.status!=="pending")return queueMicrotask(()=>e(this.status)),()=>{};let t=this.subscribe(n=>{n!=="pending"&&(t(),e(n))});return t}async resolvePending(){if(this.status!=="pending")return this.status;if(!this.pendingResolverFn)return"denied";try{return await this.pendingResolverFn()}catch{return"denied"}}setStatus(e){this.applyStatus(e)}pollGtmConsent(){if(!this.gtmEnabled||typeof window>"u")return;let e=window.dataLayer;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n)continue;if(n[0]==="consent"&&n[1]==="update"&&n[2]){let s=n[2].analytics_storage;s==="granted"?this.setStatus("granted"):s==="denied"&&this.setStatus("denied");return}}}destroy(){this.destroyed=!0,this.listeners.clear()}applyStatus(e){this.destroyed||this.status!==e&&(this.status=e,this.notify(e))}notify(e){if(this.configCallback)try{this.configCallback(e)}catch{}for(let t of this.listeners)try{t(e)}catch{}}};var Bo=class{constructor(e,t){this.seenSet=new Set;this.triggeredSet=new Set;this.telemetry=e,this.variantId=t}trackServed(e,t){this.telemetry.track?.("syntro_config_served",{variant_id:this.variantId,tiles:e,actions:t})}trackSeen(e,t){this.seenSet.has(e)||(this.seenSet.add(e),this.telemetry.track?.("syntro_intervention_seen",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackTriggered(e,t){this.triggeredSet.has(e)||(this.triggeredSet.add(e),this.telemetry.track?.("syntro_intervention_triggered",{variant_id:this.variantId,intervention_id:e,intervention_kind:t}))}trackInteracted(e,t,n){this.telemetry.track?.("syntro_intervention_interacted",{variant_id:this.variantId,intervention_id:e,intervention_kind:t,interaction_type:n})}resetPage(){this.seenSet.clear(),this.triggeredSet.clear()}};function tT(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var vh=class{constructor(){this.sessionId=tT(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,n){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,n){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}identify(e,t){}alias(e,t){}optInCapturing(){}optOutCapturing(){}};function yh(){return new vh}var E=typeof window<"u"?window:void 0,rt=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(rt.self=rt),typeof File>"u"&&(rt.File=function(){});var z0=Array.prototype,Y_=z0.forEach,X_=z0.indexOf,kt=rt?.navigator,U=rt?.document,tt=rt?.location,Nh=rt?.fetch,Fh=rt!=null&&rt.XMLHttpRequest&&"withCredentials"in new rt.XMLHttpRequest?rt.XMLHttpRequest:void 0,J_=rt?.AbortController,_t=kt?.userAgent,ee=E??{},$r={DEBUG:!1,LIB_VERSION:"1.341.0"};function Q_(r,e,t,n,i,s,o){try{var a=r[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,i)}function Gi(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){Q_(s,n,i,o,a,"next",l)}function a(l){Q_(s,n,i,o,a,"throw",l)}o(void 0)}))}}function q(){return q=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},q.apply(null,arguments)}function q0(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var rT=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],e0=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return rT.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},nT=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function he(r,e){return r.indexOf(e)!==-1}var Bc=function(r){return r.trim()},Dh=function(r){return r.replace(/^\$/,"")},iT=Array.isArray,Z0=Object.prototype,G0=Z0.hasOwnProperty,Vc=Z0.toString,_e=iT||function(r){return Vc.call(r)==="[object Array]"},dn=r=>typeof r=="function",ze=r=>r===Object(r)&&!_e(r),Ki=r=>{if(ze(r)){for(var e in r)if(G0.call(r,e))return!1;return!0}return!1},j=r=>r===void 0,qe=r=>Vc.call(r)=="[object String]",Hh=r=>qe(r)&&r.trim().length===0,qt=r=>r===null,ge=r=>j(r)||qt(r),Dr=r=>Vc.call(r)=="[object Number]"&&r==r,qi=r=>Dr(r)&&r>0,Fr=r=>Vc.call(r)==="[object Boolean]",sT=r=>r instanceof FormData,oT=r=>he(nT,r);function Bh(r){return r===null||typeof r!="object"}function yc(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function K0(r){return!j(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var aT=[!0,"true",1,"1","yes"],bh=r=>he(aT,r),lT=[!1,"false",0,"0","no"];function pr(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),Dr(r)?r>t?(n.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(n.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+i),pr(i||t,e,t,n))}var Vh=class{constructor(e){this.t={},this.i=e.i,this.o=pr(e.bucketSize,0,100,e.h),this.m=pr(e.refillRate,0,this.o,e.h),this.$=pr(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,i=Math.floor(n/this.$);if(i>0){var s=i*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+i*this.$}}consumeRateLimit(e){var t,n=Date.now(),i=String(e),s=this.t[i];return s?this.S(s,n):(s={tokens:this.o,lastAccess:n},this.t[i]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.i)==null||t.call(this,e)),s.tokens===0)}stop(){this.t={}}},Ot="Mobile",bc="iOS",Nr="Android",aa="Tablet",Y0=Nr+" "+aa,X0="iPad",J0="Apple",Q0=J0+" Watch",la="Safari",Qi="BlackBerry",ex="Samsung",tx=ex+"Browser",rx=ex+" Internet",li="Chrome",cT=li+" OS",nx=li+" "+bc,Yf="Internet Explorer",ix=Yf+" "+Ot,Xf="Opera",uT=Xf+" Mini",Jf="Edge",sx="Microsoft "+Jf,Xi="Firefox",ox=Xi+" "+bc,ca="Nintendo",ua="PlayStation",Ji="Xbox",ax=Nr+" "+Ot,lx=Ot+" "+la,Yo="Windows",Uh=Yo+" Phone",t0="Nokia",jh="Ouya",cx="Generic",dT=cx+" "+Ot.toLowerCase(),ux=cx+" "+aa.toLowerCase(),Wh="Konqueror",pt="(\\d+(\\.\\d+)?)",_h=new RegExp("Version/"+pt),pT=new RegExp(Ji,"i"),hT=new RegExp(ua+" \\w+","i"),fT=new RegExp(ca+" \\w+","i"),Qf=new RegExp(Qi+"|PlayBook|BB10","i"),gT={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},dc,r0,xh,mT=(r,e)=>e&&he(e,J0)||(function(t){return he(t,la)&&!he(t,li)&&!he(t,Nr)})(r),dx=function(r,e){return e=e||"",he(r," OPR/")&&he(r,"Mini")?uT:he(r," OPR/")?Xf:Qf.test(r)?Qi:he(r,"IE"+Ot)||he(r,"WPDesktop")?ix:he(r,tx)?rx:he(r,Jf)||he(r,"Edg/")?sx:he(r,"FBIOS")?"Facebook "+Ot:he(r,"UCWEB")||he(r,"UCBrowser")?"UC Browser":he(r,"CriOS")?nx:he(r,"CrMo")||he(r,li)?li:he(r,Nr)&&he(r,la)?ax:he(r,"FxiOS")?ox:he(r.toLowerCase(),Wh.toLowerCase())?Wh:mT(r,e)?he(r,Ot)?lx:la:he(r,Xi)?Xi:he(r,"MSIE")||he(r,"Trident/")?Yf:he(r,"Gecko")?Xi:""},vT={[ix]:[new RegExp("rv:"+pt)],[sx]:[new RegExp(Jf+"?\\/"+pt)],[li]:[new RegExp("("+li+"|CrMo)\\/"+pt)],[nx]:[new RegExp("CriOS\\/"+pt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pt)],[la]:[_h],[lx]:[_h],[Xf]:[new RegExp("(Opera|OPR)\\/"+pt)],[Xi]:[new RegExp(Xi+"\\/"+pt)],[ox]:[new RegExp("FxiOS\\/"+pt)],[Wh]:[new RegExp("Konqueror[:/]?"+pt,"i")],[Qi]:[new RegExp(Qi+" "+pt),_h],[ax]:[new RegExp("android\\s"+pt,"i")],[rx]:[new RegExp(tx+"\\/"+pt)],[Yf]:[new RegExp("(rv:|MSIE )"+pt)],Mozilla:[new RegExp("rv:"+pt)]},yT=function(r,e){var t=dx(r,e),n=vT[t];if(j(n))return null;for(var i=0;i<n.length;i++){var s=n[i],o=r.match(s);if(o)return parseFloat(o[o.length-2])}return null},n0=[[new RegExp(Ji+"; "+Ji+" (.*?)[);]","i"),r=>[Ji,r&&r[1]||""]],[new RegExp(ca,"i"),[ca,""]],[new RegExp(ua,"i"),[ua,""]],[Qf,[Qi,""]],[new RegExp(Yo,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Uh,""];if(new RegExp(Ot).test(e)&&!/IEMobile\b/.test(e))return[Yo+" "+Ot,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=gT[n]||"";return/arm/i.test(e)&&(i="RT"),[Yo,i]}return[Yo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[bc,e.join(".")]}return[bc,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=j(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Nr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Nr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Nr,e.join(".")]}return[Nr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[cT,""]],[/Linux|debian/i,["Linux",""]]],i0=function(r){return fT.test(r)?ca:hT.test(r)?ua:pT.test(r)?Ji:new RegExp(jh,"i").test(r)?jh:new RegExp("("+Uh+"|WPDesktop)","i").test(r)?Uh:/iPad/.test(r)?X0:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Q0:Qf.test(r)?Qi:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(t0,"i").test(r)?t0:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(Ot).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?Nr:Y0:new RegExp("(pda|"+Ot+")","i").test(r)?dT:new RegExp(aa,"i").test(r)&&!new RegExp(aa+" pc","i").test(r)?ux:""},bT=r=>r instanceof Error;function _T(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return xh&&t.length===r0||(r0=t.length,xh=t.reduce(((n,i)=>{dc||(dc={});var s=dc[i];if(s)n[s[0]]=s[1];else for(var o=r(i),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,d=e[i];if(c&&d){n[c]=d,dc[i]=[c,d];break}}return n}),{})),xh}}var zh=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Gi((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&_e(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n,i;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),q({},e,{cause:n,stack:i})}applyChunkIds(e,t){return e.map((n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Gi((function*(){var n=e;for(var i of t.modifiers)n=yield i(n);return n}))()}convertToExceptionList(e,t){var n,i,s,o={type:e.type,value:e.value,mechanism:{type:(n=t.type)!==null&&n!==void 0?n:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,q({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:_T(this.stackParser)}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(s,a)}};return q({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},es="?";function qh(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?es:t,in_app:!0};return j(n)||(s.lineno=n),j(i)||(s.colno=i),s}var px=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,n=r.indexOf("safari-web-extension")!==-1;return t||n?[r.indexOf("@")!==-1?r.split("@")[0]:es,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},xT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ST=/\((\S*)(?::(\d+))(?::(\d+))\)/,kT=(r,e)=>{var t=xT.exec(r);if(t){var[,n,i,s]=t;return qh(e,n,es,+i,+s)}var o=wT.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=ST.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=px(o[1]||es,o[2]);return qh(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ET=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,CT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,AT=(r,e)=>{var t=ET.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=CT.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var i=t[3],s=t[1]||es;return[s,i]=px(s,i),qh(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},s0=/\(error: (.*)\)/,o0=50;function TT(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return function(i,s){s===void 0&&(s=0);for(var o=[],a=i.split(`
1075
1075
  `),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var d=s0.test(c)?c.replace(s0,"$1"):c;if(!d.match(/\S*Error: /)){for(var p of t){var h=p(d,r);if(h){o.push(h);break}}if(o.length>=o0)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,o0).map((m=>{return q({},m,{filename:m.filename||(g=v,g[g.length-1]||{}).filename,function:m.function||es});var g}))})(o)}})("web:javascript",kT,AT)}var Zh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=qe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return yc(e,"DOMException")}isDOMError(e){return yc(e,"DOMError")}},Gh=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},Kh=class{constructor(){}match(e){return yc(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var n,i=t.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},RT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Yh=class{match(e){return typeof e=="string"}coerce(e,t){var n,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var t="Error",n=e,i=e.match(RT);return i&&(t=i[1],n=i[2]),[t,n]}},IT=["fatal","error","warning","log","info","debug"];function hx(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var n=t.length;n>0;n--){var i=t.slice(0,n).join(", ");if(!(i.length>e))return n===t.length||i.length<=e?i:i.slice(0,e)+"..."}return""}var Xh=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=t.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return K0(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+hx(e)}isSeverityLevel(e){return qe(e)&&!Hh(e)&&IT.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(bT(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Jh=class{match(e){return K0(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+hx(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Qh=class{match(e){return Bh(e)}coerce(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},ef=class{match(e){return yc(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Bh(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){if(Bh(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},fx=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&($r.DEBUG||ee.POSTHOG_DEBUG||t)&&!j(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];s(r,...a)}},info:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("log",...s)},warn:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("warn",...s)},error:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("error",...s)},critical:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];console.error(r,...s)},uninitializedWarning:i=>{n.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>fx(r+" "+i,s)};return n},z=fx("[PostHog.js]"),Oe=z.createLogger,MT=Oe("[ExternalScriptsLoader]"),a0=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return MT.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=U?.querySelectorAll("script");if(n){for(var i,s=function(){if(n[o].src===e){var l=n[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;o<n.length;o++)if(i=s())return i.v}var a=()=>{if(!U)return t("document not found");var l=U.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=p=>{l.__posthog_loading_callback_fired=!0,t(void 0,p)},l.onerror=p=>t(p),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")U.head.appendChild(l);else{var c,d=U.querySelectorAll("body > script");d.length>0?(c=d[0].parentNode)==null||c.insertBefore(l,d[0]):U.body.appendChild(l)}};U!=null&&U.body?a():U?.addEventListener("DOMContentLoaded",a)};ee.__PosthogExtensions__=ee.__PosthogExtensions__||{},ee.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var n="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(n="/array/"+r.config.token+"/config.js"),e==="toolbar"){var i=3e5;n=n+"&t="+Math.floor(Date.now()/i)*i}var s=r.requestRouter.endpointFor("assets",n);a0(r,s,t)},ee.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);a0(r,n,t)};var _c={};function pn(r,e,t){if(_e(r)){if(Y_&&r.forEach===Y_)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var n=0,i=r.length;n<i;n++)if(n in r&&e.call(t,r[n],n)===_c)return}}}function Ae(r,e,t){if(!ge(r)){if(_e(r))return pn(r,e,t);if(sT(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===_c)return}else for(var i in r)if(G0.call(r,i)&&e.call(t,r[i],i)===_c)return}}var He=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return pn(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},rs=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return pn(t,(function(i){pn(i,(function(s){r.push(s)}))})),r};function mc(r){for(var e=Object.keys(r),t=e.length,n=new Array(t);t--;)n[t]=[e[t],r[e[t]]];return n}var l0=function(r){try{return r()}catch{return}},$T=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}catch(i){z.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),z.critical(i)}}},eg=function(r){var e={};return Ae(r,(function(t,n){(qe(t)&&t.length>0||Dr(t))&&(e[n]=t)})),e};function PT(r,e){return t=r,n=s=>qe(s)&&!qt(e)?s.slice(0,e):s,i=new Set,(function s(o,a){return o!==Object(o)?n?n(o,a):o:i.has(o)?void 0:(i.add(o),_e(o)?(l=[],pn(o,(c=>{l.push(s(c))}))):(l={},Ae(o,((c,d)=>{i.has(c)||(l[d]=s(c,d))}))),l);var l})(t);var t,n,i}var OT=["herokuapp.com","vercel.app","netlify.app"];function LT(r){var e=r?.hostname;if(!qe(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of OT)if(t===n)return!1;return!0}function gx(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function je(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var mx="$people_distinct_id",Xo="__alias",Jo="__timers",c0="$autocapture_disabled_server_side",tf="$heatmaps_enabled_server_side",u0="$exception_capture_enabled_server_side",rf="$error_tracking_suppression_rules",d0="$error_tracking_capture_extension_exceptions",p0="$web_vitals_enabled_server_side",vx="$dead_clicks_enabled_server_side",h0="$product_tours_enabled_server_side",f0="$web_vitals_allowed_metrics",wh="$session_recording_remote_config",xc="$sesid",yx="$session_is_sampled",Yi="$enabled_feature_flags",Qo="$early_access_features",nf="$feature_flag_details",ea="$stored_person_properties",ai="$stored_group_properties",sf="$surveys",wc="$flag_call_reported",Pr="$user_state",of="$client_session_props",af="$capture_rate_limit",lf="$initial_campaign_params",cf="$initial_referrer_info",Sc="$initial_person_info",kc="$epp",bx="__POSTHOG_TOOLBAR__",Vo="$posthog_cookieless",NT=[mx,Xo,"__cmpns",Jo,"$session_recording_enabled_server_side",tf,xc,Yi,rf,Pr,Qo,nf,ai,ea,sf,wc,of,af,lf,cf,kc,Sc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function g0(r){return r instanceof Element&&(r.id===bx||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Uc(r){return!!r&&r.nodeType===1}function hn(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function _x(r){return!!r&&r.nodeType===3}function xx(r){return!!r&&r.nodeType===11}function tg(r){return r?Bc(r).split(/\s+/):[]}function m0(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Ec(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return tg(e)}function wx(r){return ge(r)?null:Bc(r).split(/(\s+)/).filter((e=>da(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ha(r){var e="";return uf(r)&&!Ax(r)&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;_x(t)&&t.textContent&&(e+=(n=wx(t.textContent))!==null&&n!==void 0?n:"")})),Bc(e)}function Sx(r){return j(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var rg=["a","button","form","input","select","textarea","label"];function kx(r,e){if(j(e))return!0;var t,n=function(s){if(e.some((o=>s.matches(o))))return{v:!0}};for(var i of r)if(t=n(i))return t.v;return!1}function Ex(r){var e=r.parentNode;return!(!e||!Uc(e))&&e}var FT=["next","previous","prev",">","<"],v0=10,y0=[".ph-no-rageclick",".ph-no-capture"];function DT(r,e){if(!E||ng(r))return!1;var t,n,i;if(Fr(e)?(t=!!e&&y0,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:y0,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=Cx(r,!1);return!(function(o,a){if(o===!1||j(o))return!1;var l;if(o===!0)l=FT;else{if(!_e(o))return!1;if(o.length>v0)return z.error("[PostHog] content_ignorelist array cannot exceed "+v0+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:d,ariaLabel:p}=c;return l.some((h=>d.includes(h)||p.includes(h)))}))})(n,s.map((o=>{var a;return{safeText:ha(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!kx(s,t)}var ng=r=>!r||hn(r,"html")||!Uc(r),Cx=(r,e)=>{if(!E||ng(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!hn(i,"body");)if(xx(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=Ex(i);if(!s)break;if(e||rg.indexOf(s.tagName.toLowerCase())>-1)t=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}n.push(s),i=s}return{parentIsUsefulElement:t,targetElementList:n}};function HT(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||ng(r)||(s=t)!=null&&s.url_allowlist&&!m0(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&m0(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:d,targetElementList:p}=Cx(r,n);if(!(function(v,m){var g=m?.element_allowlist;if(j(g))return!0;var b,x=function(y){if(g.some((S=>y.tagName.toLowerCase()===S)))return{v:!0}};for(var w of v)if(b=x(w))return b.v;return!1})(p,t)||!kx(p,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var h=E.getComputedStyle(r);if(h&&h.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return d?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(rg.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function uf(r){for(var e=r;e.parentNode&&!hn(e,"body");e=e.parentNode){var t=Ec(e);if(he(t,"ph-sensitive")||he(t,"ph-no-capture"))return!1}if(he(Ec(r),"ph-include"))return!0;var n=r.type||"";if(qe(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(qe(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function Ax(r){return!!(hn(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||hn(r,"select")||hn(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Tx="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",BT=new RegExp("^(?:"+Tx+")$"),VT=new RegExp(Tx),Rx="\\d{3}-?\\d{2}-?\\d{4}",UT=new RegExp("^("+Rx+")$"),jT=new RegExp("("+Rx+")");function da(r,e){return e===void 0&&(e=!0),!(ge(r)||qe(r)&&(r=Bc(r),(e?BT:VT).test((r||"").replace(/[- ]/g,""))||(e?UT:jT).test(r)))}function Ix(r){var e=ha(r);return da(e=(e+" "+Mx(r)).trim())?e:""}function Mx(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=ha(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Mx(t)).trim())}catch(s){z.error("[AutoCapture]",s)}})),e}function WT(r){return(function(e){var t=e.map((n=>{var i,s,o="";if(n.tag_name&&(o+=n.tag_name),n.attr_class)for(var a of(n.attr_class.sort(),n.attr_class))o+="."+a.replace(/"/g,"");var l=q({},n.text?{text:n.text}:{},{"nth-child":(i=n.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=n.nth_of_type)!==null&&s!==void 0?s:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),c={};return mc(l).sort(((d,p)=>{var[h]=d,[f]=p;return h.localeCompare(f)})).forEach((d=>{var[p,h]=d;return c[b0(p.toString())]=b0(h.toString())})),o+=":",o+=mc(c).map((d=>{var[p,h]=d;return p+'="'+h+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var n,i,s={text:(n=t.$el_text)==null?void 0:n.slice(0,400),tag_name:t.tag_name,href:(i=t.attr__href)==null?void 0:i.slice(0,2048),attr_class:zT(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return mc(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return s.attributes[a]=l})),s}))})(r))}function b0(r){return r.replace(/"|\\"/g,'\\"')}function zT(r){var e=r.attr__class;return e?_e(e)?e:tg(e):void 0}var Cc=class{constructor(e){this.disabled=e===!1;var t=ze(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&n-i.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},Ac=r=>{var e=U?.createElement("a");return j(e)?null:(e.href=r,e)},qT=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return Ae(r,(function(s,o){j(s)||j(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),n=encodeURIComponent(o),i[i.length]=n+"="+t)})),i.join(e)},Tc=function(r,e){for(var t,n=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<n.length;i++){var s=n[i].split("=");if(s[0]===e){t=s;break}}if(!_e(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{z.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},fa=function(r,e,t){if(!r||!e||!e.length)return r;for(var n=r.split("#"),i=n[0]||"",s=n[1],o=i.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),d=[],p=0;p<c.length;p++){var h=c[p].split("=");_e(h)&&(e.includes(h[0])?d.push(h[0]+"="+t):d.push(c[p]))}var f=l;return a!=null&&(f+="?"+d.join("&")),s!=null&&(f+="#"+s),f},Rc=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Sh="$copy_autocapture",_0=Oe("[AutoCapture]");function kh(r,e){return e.length>r?e.slice(0,r)+"...":e}function ZT(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Uc(e));return e}function GT(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};rg.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=kh(1024,Ix(r)):s.$el_text=kh(1024,ha(r)));var o=Ec(r);o.length>0&&(s.classes=o.filter((function(d){return d!==""}))),Ae(r.attributes,(function(d){var p;if((!Ax(r)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(n==null||!n.includes(d.name))&&!e&&da(d.value)&&(p=d.name,!qe(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=d.value;d.name==="class"&&(h=tg(h).join(" ")),s["attr__"+d.name]=kh(1024,h)}}));for(var a=1,l=1,c=r;c=ZT(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function KT(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],d=r;d.parentNode&&!hn(d,"body");)xx(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var p,h=[],f={},v=!1,m=!1;if(Ae(c,(y=>{var S=uf(y);y.tagName.toLowerCase()==="a"&&(v=y.getAttribute("href"),v=S&&v&&da(v)&&v),he(Ec(y),"ph-no-capture")&&(m=!0),h.push(GT(y,s,o,a));var T=(function(_){if(!uf(_))return{};var C={};return Ae(_.attributes,(function(R){if(R.name&&R.name.indexOf("data-ph-capture-attribute")===0){var N=R.name.replace("data-ph-capture-attribute-",""),$=R.value;N&&$&&da($)&&(C[N]=$)}})),C})(y);He(f,T)})),m)return{props:{},explicitNoCapture:m};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Ix(r):h[0].$el_text=ha(r)),v){var g,b;h[0].attr__href=v;var x=(g=Ac(v))==null?void 0:g.host,w=E==null||(b=E.location)==null?void 0:b.host;x&&w&&x!==w&&(p=v)}return{props:He({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:WT(h)},(t=h[0])!=null&&t.$el_text?{$el_text:(n=h[0])==null?void 0:n.$el_text}:{},p&&i.type==="click"?{$external_click_url:p}:{},f)}}var df=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Cc(e.config.rageclick),this.C=null}get R(){var e,t,n=ze(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}F(){if(this.isBrowserSupported()){if(E&&U){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){_0.error("Failed to capture event",i)}};if(je(U,"submit",e,{capture:!0}),je(U,"change",e,{capture:!0}),je(U,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,Sh)};je(U,"copy",t,{capture:!0}),je(U,"cut",t,{capture:!0})}}}else _0.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c0]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((i=>{var s=U?.querySelectorAll(i);s?.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[c0],i=this.T;if(qt(i)&&!Fr(n)&&!this.instance.M())return!1;var s=(t=this.T)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Sx(e);_x(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&DT(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===Sh;if(i&&HT(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=KT(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),t===Sh){var c,d=wx(E==null||(c=E.getSelection())==null?void 0:c.toString()),p=e.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=p}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return dn(U?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Dr(r)&&isFinite(r)&&Math.floor(r)===r});var x0="0123456789abcdef",pf=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||e<0||t<0||n<0||i<0||e>0xffffffffffff||t>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new r(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+x0.charAt(this.bytes[t]>>>4)+x0.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},hf=class{constructor(){this.A=0,this.j=0,this.D=new ff}generate(){var e=this.generateOrAbort();if(j(e)){this.A=0;var t=this.generateOrAbort();if(j(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return pf.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},w0,$x=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};E&&!j(E.crypto)&&crypto.getRandomValues&&($x=r=>crypto.getRandomValues(r));var ff=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&($x(this.N),this.U=0),this.N[this.U++]}},un=()=>YT().toString(),YT=()=>(w0||(w0=new hf)).generate(),Uo="",XT=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function JT(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=U),Uo)return Uo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+un();!Uo&&a--;){var c=o.slice(a).join("."),d=l+"=1;domain=."+c+";path=/";s.cookie=d+";max-age=3",s.cookie.includes(l)&&(s.cookie=d+";max-age=0",Uo=c)}return Uo})(r);if(!t){var n=(i=>{var s=i.match(XT);return s?s[0]:""})(r);n!==t&&z.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var dr={H:()=>!!U,B:function(r){z.error("cookieStore error: "+r)},q:function(r){if(U){try{for(var e=r+"=",t=U.cookie.split(";").filter((s=>s.length)),n=0;n<t.length;n++){for(var i=t[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(dr.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(U)try{var s="",o="",a=JT(U.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&z.warn("cookieStore warning: large cookie, len="+c.length),U.cookie=c,c}catch{return}},V:function(r,e){if(U!=null&&U.cookie)try{dr.G(r,"",-1,e)}catch{return}}},Eh=null,$e={H:function(){if(!qt(Eh))return Eh;var r=!0;if(j(E))r=!1;else try{var e="__mplssupport__";$e.G(e,"xyz"),$e.q(e)!=='"xyz"'&&(r=!1),$e.V(e)}catch{r=!1}return r||z.error("localStorage unsupported; falling back to cookie store"),Eh=r,r},B:function(r){z.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){$e.B(e)}return null},W:function(r){try{return JSON.parse($e.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){$e.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){$e.B(e)}}},QT=["$device_id","distinct_id",xc,yx,kc,Sc],pc={},eR={H:function(){return!0},B:function(r){z.error("memoryStorage error: "+r)},q:function(r){return pc[r]||null},W:function(r){return pc[r]||null},G:function(r,e){pc[r]=e},V:function(r){delete pc[r]}},si=null,et={H:function(){if(!qt(si))return si;if(si=!0,j(E))si=!1;else try{var r="__support__";et.G(r,"xyz"),et.q(r)!=='"xyz"'&&(si=!1),et.V(r)}catch{si=!1}return si},B:function(r){z.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){et.B(e)}return null},W:function(r){try{return JSON.parse(et.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){et.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){et.B(e)}}},Or=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),gf=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Or.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Or.DENIED||this.consent===Or.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Or.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return bh(e)?Or.GRANTED:he(lT,e)?Or.DENIED:Or.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?$e:dr;var t=e==="localStorage"?dr:$e;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(bh(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!gx([kt?.doNotTrack,kt?.msDoNotTrack,ee.doNotTrack],(e=>bh(e)))}},hc=Oe("[Dead Clicks]"),tR=()=>!0,rR=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(vx)),n=r.instance.config.capture_dead_clicks;return Fr(n)?n:!!ze(n)||t},Ic=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[vx]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?hc.error("failed to load script",i):e()}))}et(){var e;if(U){if(!this.tt&&(e=ee.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=ze(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=ee.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(U),hc.info("starting...")}}else hc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,hc.info("stopping..."))}},jo=Oe("[ExceptionAutocapture]"),mf=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=ee.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=ee.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=ee.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=ee.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){jo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[u0]),this.dt=new Vh({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,h:jo}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ze(e)?t=q({},t,e):(j(e)?this.ht:e)&&(t=q({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(jo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return jo.error("failed to load script",i);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[u0]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,n,i=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(i)?jo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function S0(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return dn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var vf=class{constructor(e){var t;this._instance=e,this.ct=(E==null||(t=E.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(z.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,z.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||S0(E.history,"pushState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("pushState")})),(t=E.history.replaceState)!=null&&t.__posthog_wrapped__||S0(E.history,"replaceState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("replaceState")})),this.bt()}}_t(e){try{var t,n=E==null||(t=E.location)==null?void 0:t.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=n}catch(i){z.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};je(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},Ch=Oe("[SegmentIntegration]");function nR(r,e){var t=r.config.segment;if(!t)return e();(function(n,i){var s=n.config.segment;if(!s)return i();var o=l=>{var c=()=>l.anonymousId()||un();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(Pr,"identified")),i()},a=s.user();"then"in a&&dn(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||Ch.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===n.get_distinct_id()||(Ch.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(Ch.info("UserId set, identifying with PostHog"),n.identify(s.event.userId));var a=n.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(r)).then((()=>{e()}))}))}var Px="posthog-js";function Ox(r,e){var{organization:t,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,d,p,h;if(!(s==="*"||s.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var f=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=f,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],m=v.map((b=>q({},b,{stacktrace:b.stacktrace?q({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map((x=>q({},x,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:((c=v[0])==null?void 0:c.value)||a.message,$exception_type:(d=v[0])==null?void 0:d.type,$exception_level:a.level,$exception_list:m,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((p=v[0])==null?void 0:p.value)||a.message,$sentry_exception_type:(h=v[0])==null?void 0:h.type,$sentry_tags:a.tags};return t&&n&&(g.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(g),a}}var yf=class{constructor(e,t,n,i,s,o){this.name=Px,this.setupOnce=function(a){a(Ox(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},iR=E!=null&&E.location?Rc(E.location.hash,"__posthog")||Rc(location.hash,"state"):null,k0="_postHogToolbarParams",E0=Oe("[Toolbar]"),cn=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(cn||{}),bf=class{constructor(e){this.instance=e}yt(e){ee.ph_toolbar_state=e}wt(){var e;return(e=ee.ph_toolbar_state)!==null&&e!==void 0?e:cn.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!E||!U)return!1;e=e??E.location,n=n??E.history;try{if(!t){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}t=E?.localStorage}var i,s=iR||Rc(e.hash,"__posthog")||Rc(e.hash,"state"),o=s?l0((()=>JSON.parse(atob(decodeURIComponent(s)))))||l0((()=>JSON.parse(decodeURIComponent(s)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(k0)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=ee.ph_load_toolbar||ee.ph_load_editor;!ge(t)&&dn(t)?t(e,this.instance):E0.warn("No toolbar load function found")}loadToolbar(e){var t=!(U==null||!U.getElementById(bx));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=q({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(k0,JSON.stringify(q({},i,{source:void 0}))),this.wt()===cn.LOADED)this.xt(i);else if(this.wt()===cn.UNINITIALIZED){var s;this.yt(cn.LOADING),(s=ee.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return E0.error("[Toolbar] Failed to load",o),void this.yt(cn.UNINITIALIZED);this.yt(cn.LOADED),this.xt(i)})),je(E,"turbolinks:load",(()=>{this.yt(cn.UNINITIALIZED),this.loadToolbar(i)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},sR=Oe("[TracingHeaders]"),_f=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;j(this.$t)&&((t=ee.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.St)&&((n=ee.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return sR.error("failed to load script",i);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},fc="https?://(.*)",ns=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],oR=rs(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ns),ga="<masked>",aR=["li_fat_id"];function Lx(r,e,t){if(!U)return{};var n,i=e?rs([],ns,t||[]):[],s=Nx(fa(U.URL,i,ga),r),o=(n={},Ae(aR,(function(a){var l=dr.q(a);n[a]=l||null})),n);return He(o,s)}function Nx(r,e){var t=oR.concat(e||[]),n={};return Ae(t,(function(i){var s=Tc(r,i);n[i]=s||null})),n}function Fx(r){var e=(function(s){return s?s.search(fc+"google.([^/?]*)")===0?"google":s.search(fc+"bing.com")===0?"bing":s.search(fc+"yahoo.com")===0?"yahoo":s.search(fc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!qt(e)){n.$search_engine=e;var i=U?Tc(U.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function C0(){return navigator.language||navigator.userLanguage}function Dx(){return U?.referrer||"$direct"}function Hx(r,e){var t=r?rs([],ns,e||[]):[],n=tt?.href.substring(0,1e3);return{r:Dx().substring(0,1e3),u:n?fa(n,t,ga):void 0}}function Bx(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Ac(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=Ac(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=Nx(n);He(i,o)}if(t){var a=Fx(t);He(i,a)}return i}function Vx(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function lR(){try{return new Date().getTimezoneOffset()}catch{return}}function cR(r,e){if(!_t)return{};var t,n,i,s=r?rs([],ns,e||[]):[],[o,a]=(function(l){for(var c=0;c<n0.length;c++){var[d,p]=n0[c],h=d.exec(l),f=h&&(dn(p)?p(h,l):p);if(f)return f}return["",""]})(_t);return He(eg({$os:o,$os_version:a,$browser:dx(_t,navigator.vendor),$device:i0(_t),$device_type:(n=_t,i=i0(n),i===X0||i===Y0||i==="Kobo"||i==="Kindle Fire"||i===ux?aa:i===ca||i===Ji||i===ua||i===jh?"Console":i===Q0?"Wearable":i?Ot:"Desktop"),$timezone:Vx(),$timezone_offset:lR()}),{$current_url:fa(tt?.href,s,ga),$host:tt?.host,$pathname:tt?.pathname,$raw_user_agent:_t.length>1e3?_t.substring(0,997)+"...":_t,$browser_version:yT(_t,navigator.vendor),$browser_language:C0(),$browser_language_prefix:(t=C0(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:"web",$lib_version:$r.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var on=Oe("[Web Vitals]"),A0=9e5,xf=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((n,i)=>q({},n,{["$web_vitals_"+i.name+"_event"]:q({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=n=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(j(s))on.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();j(o)||(ge(n?.name)||ge(n?.value)?on.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?on.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),j(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=j(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(q({},n,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var n,i,s,o,a=ee.__PosthogExtensions__;j(a)||j(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),n&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):on.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[p0]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=ze(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ge(n)?((t=this._instance.persistence)==null?void 0:t.props[f0])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=ze(this._instance.config.capture_performance)&&Dr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:A0;return 0<e&&e<=6e4?A0:e}get isEnabled(){var e=tt?.protocol;if(e!=="http:"&&e!=="https:")return on.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Fr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Fr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(on.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=ze(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=ze(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p0]:t}),this._instance.persistence.register({[f0]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=ee.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?on.error("failed to load script",s):e()}))}}Ct(){var e=E?E.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,i=t?rs([],ns,n||[]):[];return fa(e,i,ga)}on.error("Could not determine current URL")}},uR=Oe("[Heatmaps]");function T0(r){return ze(r)&&"clientX"in r&&"clientY"in r&&Dr(r.clientX)&&Dr(r.clientY)}var wf=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[tf]),this.rageclicks=new Cc(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return ze(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ge(this.instance.config.capture_heatmaps)?ge(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;uR.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tf]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(U)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&U&&(this.Nt=this.Lt.bind(this),je(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),je(U,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),je(U,"mousemove",this.zt,{capture:!0}),this.Bt=new Ic(this.instance,tR,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),je(U,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&U&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&U.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&U.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&U.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=(function(a,l,c){for(var d=a;d&&Uc(d)&&!hn(d,"body");){if(d===c)return!1;if(he(l,E?.getComputedStyle(d).position))return!0;d=Ex(d)}return!1})(Sx(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Dt(e,t){var n;if(t===void 0&&(t="click"),!g0(e.target)&&T0(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(q({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!g0(e.target)&&T0(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(E){var t=E.location.href,n=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,s=n?rs([],ns,i||[]):[],o=fa(t,s,ga);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Ki(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Mc=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(z.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var n,i=this.Qt(e,t);return this.Kt={pathname:(n=E?.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var n=this.Kt;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:d,maxContentY:p}=s;if(!(j(o)||j(a)||j(l)||j(c)||j(d)||j(p))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d),p=Math.ceil(p);var h=o<=1?1:pr(a/o,0,1,z),f=o<=1?1:pr(l/o,0,1,z),v=c<=1?1:pr(d/c,0,1,z),m=c<=1?1:pr(p/c,0,1,z);i=He(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};var Lr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Lt=Uint8Array,ht=Uint16Array,ts=Uint32Array,ig=new Lt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sg=new Lt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),R0=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ux=function(r,e){for(var t=new ht(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new ts(t[30]);for(n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},jx=Ux(ig,2),dR=jx[0],Sf=jx[1];dR[28]=258,Sf[258]=28;for(kf=Ux(sg,0)[1],$c=new ht(32768),Te=0;Te<32768;++Te)an=(43690&Te)>>>1|(21845&Te)<<1,an=(61680&(an=(52428&an)>>>2|(13107&an)<<2))>>>4|(3855&an)<<4,$c[Te]=((65280&an)>>>8|(255&an)<<8)>>>1;var an,kf,$c,Te,ia=function(r,e,t){for(var n=r.length,i=0,s=new ht(e);i<n;++i)++s[r[i]-1];var o,a=new ht(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new ht(1<<e);var l=15-e;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],d=e-r[i],p=a[r[i]-1]++<<d,h=p|(1<<d)-1;p<=h;++p)o[$c[p]>>>l]=c}else for(o=new ht(n),i=0;i<n;++i)o[i]=$c[a[r[i]-1]++]>>>15-r[i];return o},ci=new Lt(288);for(Te=0;Te<144;++Te)ci[Te]=8;for(Te=144;Te<256;++Te)ci[Te]=9;for(Te=256;Te<280;++Te)ci[Te]=7;for(Te=280;Te<288;++Te)ci[Te]=8;var Pc=new Lt(32);for(Te=0;Te<32;++Te)Pc[Te]=5;var pR=ia(ci,9,0),hR=ia(Pc,5,0),Wx=function(r){return(r/8>>0)+(7&r&&1)},zx=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof ht?ht:r instanceof ts?ts:Lt)(t-e);return n.set(r.subarray(e,t)),n},Ir=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},Wo=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8,r[n+2]|=t>>>16},Ah=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return[new Lt(0),0];if(i==1){var o=new Lt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(S,T){return S.f-T.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,d=1,p=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=i-1;)a=t[t[c].f<t[p].f?c++:p++],l=t[c!=d&&t[c].f<t[p].f?c++:p++],t[d++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(n=1;n<i;++n)s[n].s>h&&(h=s[n].s);var f=new ht(h+1),v=Ef(t[d-1],f,0);if(v>e){n=0;var m=0,g=v-e,b=1<<g;for(s.sort((function(S,T){return f[T.s]-f[S.s]||S.f-T.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;m+=b-(1<<v-f[x]),f[x]=e}for(m>>>=g;m>0;){var w=s[n].s;f[w]<e?m-=1<<e-f[w]++-1:++n}for(;n>=0&&m;--n){var y=s[n].s;f[y]==e&&(--f[y],++m)}v=e}return[new Lt(f),v]},Ef=function(r,e,t){return r.s==-1?Math.max(Ef(r.l,e,t+1),Ef(r.r,e,t+1)):e[r.s]=t},I0=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new ht(++e),n=0,i=r[0],s=1,o=function(l){t[n++]=l},a=1;a<=e;++a)if(r[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=r[a]}return[t.subarray(0,n),e]},zo=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Cf=function(r,e,t){var n=t.length,i=Wx(e+2);r[i]=255&n,r[i+1]=n>>>8,r[i+2]=255^r[i],r[i+3]=255^r[i+1];for(var s=0;s<n;++s)r[i+s+4]=t[s];return 8*(i+4+n)},M0=function(r,e,t,n,i,s,o,a,l,c,d){Ir(e,d++,t),++i[256];for(var p=Ah(i,15),h=p[0],f=p[1],v=Ah(s,15),m=v[0],g=v[1],b=I0(h),x=b[0],w=b[1],y=I0(m),S=y[0],T=y[1],_=new ht(19),C=0;C<x.length;++C)_[31&x[C]]++;for(C=0;C<S.length;++C)_[31&S[C]]++;for(var R=Ah(_,7),N=R[0],$=R[1],F=19;F>4&&!N[R0[F-1]];--F);var V,P,K,Y,le=c+5<<3,D=zo(i,ci)+zo(s,Pc)+o,te=zo(i,h)+zo(s,m)+o+14+3*F+zo(_,N)+(2*_[16]+3*_[17]+7*_[18]);if(le<=D&&le<=te)return Cf(e,d,r.subarray(l,l+c));if(Ir(e,d,1+(te<D)),d+=2,te<D){V=ia(h,f,0),P=h,K=ia(m,g,0),Y=m;var Ze=ia(N,$,0);for(Ir(e,d,w-257),Ir(e,d+5,T-1),Ir(e,d+10,F-4),d+=14,C=0;C<F;++C)Ir(e,d+3*C,N[R0[C]]);d+=3*F;for(var at=[x,S],Le=0;Le<2;++Le){var H=at[Le];for(C=0;C<H.length;++C){var Q=31&H[C];Ir(e,d,Ze[Q]),d+=N[Q],Q>15&&(Ir(e,d,H[C]>>>5&127),d+=H[C]>>>12)}}}else V=pR,P=ci,K=hR,Y=Pc;for(C=0;C<a;++C)if(n[C]>255){Q=n[C]>>>18&31,Wo(e,d,V[Q+257]),d+=P[Q+257],Q>7&&(Ir(e,d,n[C]>>>23&31),d+=ig[Q]);var re=31&n[C];Wo(e,d,K[re]),d+=Y[re],re>3&&(Wo(e,d,n[C]>>>5&8191),d+=sg[re])}else Wo(e,d,V[n[C]]),d+=P[n[C]];return Wo(e,d,V[256]),d+P[256]},fR=new ts([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gR=(function(){for(var r=new ts(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),mR=function(r,e,t,n,i){return(function(s,o,a,l,c,d){var p=s.length,h=new Lt(l+p+5*(1+Math.floor(p/7e3))+c),f=h.subarray(l,h.length-c),v=0;if(!o||p<8)for(var m=0;m<=p;m+=65535){var g=m+65535;g<p?v=Cf(f,v,s.subarray(m,g)):(f[m]=d,v=Cf(f,v,s.subarray(m,p)))}else{for(var b=fR[o-1],x=b>>>13,w=8191&b,y=(1<<a)-1,S=new ht(32768),T=new ht(y+1),_=Math.ceil(a/3),C=2*_,R=function(jc){return(s[jc]^s[jc+1]<<_^s[jc+2]<<C)&y},N=new ts(25e3),$=new ht(288),F=new ht(32),V=0,P=0,K=(m=0,0),Y=0,le=0;m<p;++m){var D=R(m),te=32767&m,Ze=T[D];if(S[te]=Ze,T[D]=te,Y<=m){var at=p-m;if((V>7e3||K>24576)&&at>423){v=M0(s,f,0,N,$,F,P,K,le,m-le,v),K=V=P=0,le=m;for(var Le=0;Le<286;++Le)$[Le]=0;for(Le=0;Le<30;++Le)F[Le]=0}var H=2,Q=0,re=w,fe=te-Ze&32767;if(at>2&&D==R(m-fe))for(var Ce=Math.min(x,at)-1,we=Math.min(32767,m),Ie=Math.min(258,at);fe<=we&&--re&&te!=Ze;){if(s[m+H]==s[m+H-fe]){for(var Ne=0;Ne<Ie&&s[m+Ne]==s[m+Ne-fe];++Ne);if(Ne>H){if(H=Ne,Q=fe,Ne>Ce)break;var Zt=Math.min(fe,Ne-2),va=0;for(Le=0;Le<Zt;++Le){var fn=m-fe+Le+32768&32767,Fe=fn-S[fn]+32768&32767;Fe>va&&(va=Fe,Ze=fn)}}}fe+=(te=Ze)-(Ze=S[te])+32768&32767}if(Q){N[K++]=268435456|Sf[H]<<18|kf[Q];var ya=31&Sf[H],pg=31&kf[Q];P+=ig[ya]+sg[pg],++$[257+ya],++F[pg],Y=m+H,++V}else N[K++]=s[m],++$[s[m]]}}v=M0(s,f,d,N,$,F,P,K,le,m-le,v)}return zx(h,0,l+Wx(v)+c)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,n,!0)},Th=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function vR(r,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,d=0;d<l.length;++d)c=gR[255&c^l[d]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=mR(r,e,10+((i=e).filename&&i.filename.length+1||0),8),o=s.length;return(function(a,l){var c=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&Th(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var d=0;d<=c.length;++d)a[d+10]=c.charCodeAt(d)}})(s,e),Th(s,o-8,t.d()),Th(s,o-4,n),s}var yR=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
1076
1076
  `).replace(/\r/g,`
1077
- `)).length,i=0;i<n;i++){var o=r.charCodeAt(i),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),qt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},bR=!!Fh||!!Nh,$0="text/plain",Oc=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=q({},e),a=(n=s?.split("&").map((c=>{var d,[p,h]=c.split("="),f=t&&(d=o[p])!==null&&d!==void 0?d:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=qT(o);return l&&a.push(l),i+"?"+a.join("&")},ta=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Rh=r=>{var{data:e,compression:t}=r;if(e){if(t===Lr.GZipJS){var n=vR((function(l,c){var d=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new Lt(l.length+(l.length>>>1)),h=0,f=function(b){p[h++]=b},v=0;v<d;++v){if(h+5>p.length){var m=new Lt(h+8+(d-v<<1));m.set(p),p=m}var g=l.charCodeAt(v);g<128||c?f(g):g<2048?(f(192|g>>>6),f(128|63&g)):g>55295&&g<57344?(f(240|(g=65536+(1047552&g)|1023&l.charCodeAt(++v))>>>18),f(128|g>>>12&63),f(128|g>>>6&63),f(128|63&g)):(f(224|g>>>12),f(128|g>>>6&63),f(128|63&g))}return zx(p,0,h)})(ta(e)),{mtime:0}),i=new Blob([n],{type:$0});return{contentType:$0,body:i,estimatedSize:i.size}}if(t===Lr.Base64){var s=(function(l){var c,d,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,b="",x=[];if(!l)return l;l=yR(l);do c=(f=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,d=f>>12&63,p=f>>6&63,h=63&f,x[g++]=v.charAt(c)+v.charAt(d)+v.charAt(p)+v.charAt(h);while(m<l.length);switch(b=x.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b})(ta(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:ta(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ta(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vc=[];Nh&&vc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Rh(r))!==null&&e!==void 0?e:{},o=new Headers;Ae(r.headers,(function(d,p){o.append(p,d)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(J_){var c=new J_;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Nh(a,q({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((d=>d.text().then((p=>{var h={statusCode:d.status,text:p};if(d.status===200)try{h.json=JSON.parse(p)}catch(f){z.error(f)}r.callback==null||r.callback(h)})))).catch((d=>{z.error(d),r.callback==null||r.callback({statusCode:0,text:d})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Fh&&vc.push({transport:"XHR",method:r=>{var e,t=new Fh;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Rh(r))!==null&&e!==void 0?e:{};Ae(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(s)}},t.send(i)}}),kt!=null&&kt.sendBeacon&&vc.push({transport:"sendBeacon",method:r=>{var e=Oc(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Rh(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;kt.sendBeacon(e,s)}catch{}}});var Lc=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function P0(r,e,t){return ta({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var qx={exact:(r,e)=>e.some((t=>r.some((n=>t===n)))),is_not:(r,e)=>e.every((t=>r.every((n=>t!==n)))),regex:(r,e)=>e.some((t=>r.some((n=>Lc(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Lc(t,n))))),icontains:(r,e)=>e.map(gc).some((t=>r.map(gc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(gc).every((t=>r.map(gc).every((n=>!t.includes(n))))),gt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n>parseFloat(i)))})),lt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n<parseFloat(i)))}))},gc=r=>r.toLowerCase();function Zx(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(j(s)||qt(s))return!1;var o=[String(s)],a=qx[i.operator];return!!a&&a(i.values,o)}))}var Ih=Oe("[Error tracking]"),Af=class{constructor(e){var t,n;this.Zt=[],this.ti=new zh([new Zh,new ef,new Kh,new Gh,new Jh,new Xh,new Yh,new Qh],TT()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(rf))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,i,s=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Zt=s,this._instance.persistence&&this._instance.persistence.register({[rf]:this.Zt,[d0]:o})}get ii(){var e,t=!!this._instance.get_property(d0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Ih.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Ih.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Ih.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:s,value:o}=i;return qe(s)&&s.length>0&&n.$exception_types.push(s),qe(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Zt.some((n=>{var i=n.values.map((s=>{var o,a=qx[s.operator],l=_e(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!ge(e)&&_e(e)}},St=Oe("[FeatureFlags]"),qo=Oe("[FeatureFlags]",{debugEnabled:!0}),Mh="$active_feature_flags",Wi="$override_feature_flags",O0="$feature_flag_payloads",Zo="$override_feature_flag_payloads",L0="$feature_flag_request_id",N0="$feature_flag_evaluated_at",F0=r=>{var e={};for(var[t,n]of mc(r||{}))n&&(e[t]=n);return e},_R=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload})).map((t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]})))):St.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},xR=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),Tf=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(St.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||St.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(nf),t=this._instance.get_property(Wi),n=this._instance.get_property(Zo);if(!n&&!t)return e||{};var i=He({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],d=t?.[o],p=j(d)?(a=c?.enabled)!==null&&a!==void 0&&a:!!d,h=j(d)?c.variant:typeof d=="string"?d:void 0,f=n?.[o],v=q({},c,{enabled:p,variant:p?h??c?.variant:void 0});p!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),f&&(v.metadata=q({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(St.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Yi),t=this._instance.get_property(Wi);if(!t)return e||{};for(var n=He({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(St.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(O0),t=this._instance.get_property(Zo);if(!t)return e||{};for(var n=He({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(St.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.oi=!0),n}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout((()=>{this.mi()}),5))}bi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.bi(),!this._instance.M())if(this.li)this.hi=!0;else{var n=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:q({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(ea)||{}),group_properties:this._instance.get_property(ai)};qt(i)||j(i)||(s.$device_id=i),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.pi()&&(s.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",a+l);o&&(s.timezone=Vx()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:Lr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:d=>{var p,h,f=!0;if(d.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=d.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!f,d.json&&(p=d.json.quotaLimited)!=null&&p.includes(xR.FeatureFlags))St.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var v;s.disable_flags||this.receivedFeatureFlags((v=d.json)!==null&&v!==void 0?v:{},f),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(n=i?.variant)!==null&&n!==void 0?n:i?.enabled}St.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(L0)||void 0,c=this._instance.get_property(N0)||void 0,d=this._instance.get_property(wc)||{};if((t.send_event||!("send_event"in t))&&(!(e in d)||!d[e].includes(a))){var p,h,f,v,m,g,b,x,w;_e(d[e])?d[e].push(a):d[e]=[a],(p=this._instance.persistence)==null||p.register({[wc]:d});var y=this.getFeatureFlagDetails(e),S={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((h=this._instance.config.bootstrap)==null||(h=h.featureFlags)==null?void 0:h[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};j(y==null||(v=y.metadata)==null?void 0:v.version)||(S.$feature_flag_version=y.metadata.version);var T,_=(m=y==null||(g=y.reason)==null?void 0:g.description)!==null&&m!==void 0?m:y==null||(b=y.reason)==null?void 0:b.code;_&&(S.$feature_flag_reason=_),y!=null&&(x=y.metadata)!=null&&x.id&&(S.$feature_flag_id=y.metadata.id),j(y?.original_variant)&&j(y?.original_enabled)||(S.$feature_flag_original_response=j(y.original_variant)?y.original_enabled:y.original_variant),y!=null&&(w=y.metadata)!=null&&w.original_payload&&(S.$feature_flag_original_payload=y==null||(T=y.metadata)==null?void 0:T.original_payload),this._instance.capture("$feature_flag_called",S)}if(i){var C=o;if(!j(o))try{C=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:C}}}else St.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(i.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:Lr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return j(n)?void 0:!!n}St.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,c,d){l===void 0&&(l={}),c===void 0&&(c={}),d===void 0&&(d={});var p=_R(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(_e(f)){St.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(f)for(var x=0;x<f.length;x++)b[f[x]]=!0;a&&a.register({[Mh]:f,[Yi]:b})}else{var w=f,y=v,S=h;if(o.errorsWhileComputingFlags)if(h){var T=new Set(Object.keys(h).filter((_=>{var C;return!((C=h[_])!=null&&C.failed)})));w=q({},l,Object.fromEntries(Object.entries(w).filter((_=>{var[C]=_;return T.has(C)})))),y=q({},c,Object.fromEntries(Object.entries(y||{}).filter((_=>{var[C]=_;return T.has(C)})))),S=q({},d,Object.fromEntries(Object.entries(S||{}).filter((_=>{var[C]=_;return T.has(C)}))))}else w=q({},l,w),y=q({},c,y),S=q({},d,S);a&&a.register(q({[Mh]:Object.keys(F0(w)),[Yi]:w||{},[O0]:y||{},[nf]:S||{}},m?{[L0]:m}:{},g?{[N0]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),St.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return St.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Wi),this._instance.persistence.unregister(Zo),this.wi(),qo.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.oi=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(Wi),qo.info("Flag overrides cleared");else if(n.flags){if(_e(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[Wi]:i})}else this._instance.persistence.register({[Wi]:n.flags});qo.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Zo),qo.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Zo]:n.payloads}),qo.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this._instance.get_property(Qo)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=q({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Mh]:Object.keys(F0(l)),[Yi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(Qo),s=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Qo),(l=this._instance.persistence)==null||l.register({[Qo]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(ea)||{};this._instance.register({[ea]:q({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ea)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(ai)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=q({},n[i],e[i]),delete e[i]})),this._instance.register({[ai]:q({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ai)||{};this._instance.register({[ai]:q({},t,{[e]:{}})})}else this._instance.unregister(ai)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.bi(),this.oi=!1}},wR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sa=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(n=>{var i="";return n.token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&z.info("Persistence loaded",e.persistence,q({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){wR.indexOf(e.persistence.toLowerCase())===-1&&(z.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(i){i===void 0&&(i=[]);var s=[...QT,...i];return q({},$e,{W:function(o){try{var a={};try{a=dr.W(o)||{}}catch{}var l=He(a,JSON.parse($e.q(o)||"{}"));return $e.G(o,l),l}catch{}return null},G:function(o,a,l,c,d,p){try{$e.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&dr.G(o,h,l,c,d,p)}catch(f){$e.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),dr.V(o,a)}catch(l){$e.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&$e.H()?$e:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&et.H()?et:n==="memory"?eR:n==="cookie"?dr:t.H()?t:dr}properties(){var e={};return Ae(this.props,(function(t,n){if(n===Yi&&ze(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=n,l=!1,(qt(o=NT)?l:X_&&o.indexOf===X_?o.indexOf(a)!=-1:(Ae(o,(function(c){if(l||(l=c===a))return _c})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=He({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(ze(e)){j(t)&&(t="None"),this.Pi=j(n)?this.Ci:n;var i=!1;if(Ae(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(ze(e)){this.Pi=j(t)?this.Ci:t;var n=!1;if(Ae(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=Lx(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Ki(eg(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=U?.referrer)?Fx(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Dx(),$referring_domain:U!=null&&U.referrer&&((e=Ac(U.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[lf]||this.props[cf]||this.register_once({[Sc]:Hx(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ae([cf,lf],(o=>{var a=this.props[o];a&&Ae(a,(function(l,c){e["$initial_"+Dh(c)]=l}))}));var t,n,i=this.props[Sc];if(i){var s=(t=Bx(i),n={},Ae(t,(function(o,a){n["$initial_"+Dh(a)]=o})),n);He(e,s)}return e}safe_merge(e){return Ae(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((d,p)=>d===c[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.Si(e),s=this.props;this.clear(),this.Y=i,this.props=s,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Jo]||{};n[e]=t,this.props[Jo]=n,this.save()}remove_event_timer(e){var t=(this.props[Jo]||{})[e];return j(t)||(delete this.props[Jo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},D0=Oe("[Product Tours]"),$h="ph_product_tours",Rf=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[h0]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(h0)||this.it((()=>this.Oi()))}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?D0.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=ee.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=ee.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!_e(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[$h];if(_e(i)&&!t)return this.Fi=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var o=s.statusCode;if(o!==200||!s.json){var a="Product Tours API could not be loaded, status: "+o;return D0.error(a),void e([],{isLoaded:!1,error:a})}var l=_e(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[$h]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ge(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister($h)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Go=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),OD=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),LD=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),ND=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),Ph=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),FD=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),DD=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),HD=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),ra=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Oh=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),If=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ee=Oe("[Surveys]"),Gx="seenSurvey_",SR=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},H0=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Gx,r),kR=[Ph.Popover,Ph.Widget,Ph.API],ER={ignoreConditions:!1,ignoreDelay:!1,displayType:If.Popover},pa=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((n=>n!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var i of this.Mi["*"]||[])i(e,t)}};function zi(r,e,t){if(ge(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Mf=class{constructor(e){this.Ai=new pa,this.ji=(t,n)=>this.Di(t,n)&&this.Li(t,n)&&this.Ni(t,n)&&this.Ui(t,n),this.Di=(t,n)=>n==null||!n.event||t?.event===n?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!j((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((n,i)=>{this.on(n,i)}))}}register(e){var t,n;if(!j((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Hi)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var d;(d=this.zi)==null||d.add(c?.event||"")}))})),(n=this._instance)!=null&&n.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&s.add(l?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,t){var n;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((n=this.Hi)==null?void 0:n.size)>0&&this.Hi.forEach((i=>{this.Bi(t,i)&&this.Ai.emit("actionCaptured",i.name)}))}qi(e){this.onAction("actionCaptured",(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!zi(i,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var n;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>zi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&zi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var n;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>zi(c.text,t.text,t.text_matching||"exact")||zi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!l&&(s=(function(c){for(var d,p=[],h=/(?::|")text="(.*?)"/g;!ge(d=h.exec(c));)p.includes(d[1])||p.push(d[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>zi(c,o,a))))}Vi(e,t){var n,i;if(t==null||!t.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||Zx(t.properties.reduce(((n,i)=>{var s=_e(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},$f=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Zx(e.propertyFilters,t?.properties)}Zi(e,t){var n=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}te(e,t,n){var i=(n===Go.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;j((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Mf(this._instance),this.se.init(),this.se.qi((n=>{this.onAction(n)}))),t.forEach((n=>{var i,s,o,a,l;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var d=this.Xi.get(c.name);d&&d.push(n.id),this.Xi.set(c.name,d||[n.id])}})))})))}ee(e){var t,n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(n.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,Go.Activation),this.Yi=this.Zi(e,Go.Cancellation))}onEvent(e,t){var n,i=this.ne(),s=this.oe(),o=this.ae(),a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var l,c;i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var d=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(d){var p=a.indexOf(d);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,Go.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var m=a.indexOf(v.id);m>=0&&a.splice(m,1),this.ue(v.id)})),this.le(a))}if(this.Ki.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,Go.Activation);this.le(a.concat(f.map((v=>v.id))||[]))}}}onAction(e){var t,n=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));n.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},Pf=class extends $f{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return ra.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return Ee}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Of=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ge(t))return Ee.warn("Flags not loaded yet. Not loading surveys.");var n=_e(t);this.ve=n?t.length>0:t,Ee.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Gx)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Ee.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ee.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ee.info("Not loading surveys in cookieless mode without consent.");else{var e=ee?.__PosthogExtensions__;if(e){if(!j(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,t);var i=e.loadExternalDependency;if(!i)return void this._e("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(s=>{s||!e.generateSurveys?this._e("Could not load surveys script",s):this.ge(e.generateSurveys,t)}))}catch(s){throw this._e("Error initializing surveys",s),s}finally{this.ce=!1}}}else Ee.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Pf(this._instance),Ee.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Ee.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Ee.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(sf);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then((s=>{var{surveys:o,context:a}=s;return e(o,a)})):(typeof Promise<"u"&&(this.pe=new Promise((s=>{n=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.pe=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;Ee.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var d,p=s.json.surveys||[],h=p.filter((v=>(function(m){return!(!m.start_date||m.end_date)})(v)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(v)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(v))));h.length>0&&((d=this._surveyEventReceiver)==null||d.register(h)),(o=this._instance.persistence)==null||o.register({[sf]:p});var f={isLoaded:!0};e(p,f),n?.({surveys:p,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Ee.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ee.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Ee.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(Ee.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ge(this._surveyManager))Ee.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(kR.includes(s.type)){var o=U?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(Ee.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;Ee.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o,n),Ee.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ee.warn("Survey element not found")}else Ee.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ee.warn("Survey not found")}}displaySurvey(e,t){var n;if(ge(this._surveyManager))Ee.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=q({},i,{appearance:q({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==If.Popover&&t.initialResponses&&Ee.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Ee.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==If.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ee.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?Ee.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Mr=Oe("[Conversations]"),Lf=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ge(t)||(Fr(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=ee?.__PosthogExtensions__;if(e&&!j(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Mr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}Se(e,t){Mr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!qt(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Gi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Mr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return Gi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Gi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Gi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Nf=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ge(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Oe("[logs]"),t=ee?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",(i=>{var s;i||(s=t.logs)==null||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},B0=Oe("[RateLimiter]"),Ff=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{B0.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void B0.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(n=this.instance.persistence)==null?void 0:n.get_property(af))!==null&&t!==void 0?t:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var c=l.tokens<1;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(af,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},oi=Oe("[RemoteConfig]"),Df=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(oi.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return oi.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void oi.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return oi.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie((t=>{this.yi(t)}));this.yi(e)}))}catch(e){oi.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):oi.info("__preview_remote_config is disabled. Logging config instead",e):oi.error("Failed to fetch remote config from PostHog.")}},Hf=3e3,Bf=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=pr(t?.flush_interval_ms||Hf,250,5e3,z.createLogger("flush interval"),Hf),this.Oe=e}enqueue(e){this.Re.push(e),this.Me||this.Ae()}unload(){this.je();var e=this.Re.length>0?this.De():{},t=Object.values(e);[...t.filter((n=>n.url.indexOf("/e")===0)),...t.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.Oe(q({},n,{transport:"sendBeacon"}))}))}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Me=setTimeout((()=>{if(this.je(),this.Re.length>0){var t=this.De(),n=function(){var s=t[i],o=new Date().getTime();s.data&&_e(s.data)&&Ae(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return Ae(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;j(e[s])&&(e[s]=q({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},CR=["retriesPerformedSoFar"],Vf=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!j(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},je(E,"online",this.ze),je(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=q0(e,CR);qi(t)&&(n.url=Oc(n.url,{retry_count:t})),this._instance._send_request(q({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(q({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),d=(Math.random()-.5)*(c-l);return Math.ceil(c+d)})(t),i=Date.now()+n;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),z.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout((()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()}),this.Ne)}Lt(){var e=Date.now(),t=[],n=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,j(E)||(this.ze&&(E.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(E.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(q({},e,{transport:"sendBeacon"}))}catch(t){z.error(t)}this.Re=[]}},Uf=class{constructor(e){this.Ge=()=>{var t,n,i,s;this.Ve||(this.Ve={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),d=o?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(a),this.Ve.maxScrollY=Math.max(a,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(n=this.Ve.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ve.lastContentY=c,this.Ve.maxContentY=Math.max(c,(i=this.Ve.maxContentY)!==null&&i!==void 0?i:0),this.Ve.maxContentHeight=Math.max(d,(s=this.Ve.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){je(E,"scroll",this.Ge,{capture:!0}),je(E,"scrollend",this.Ge,{capture:!0}),je(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=_e(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=E?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}},AR=r=>Hx(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Nc=class{constructor(e,t,n,i){this.Je=s=>{var o=this.Ke();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ye(this._instance)};this.Xe.register({[of]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||AR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[of]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Bx(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ae(eg(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Dh(n)]=t})),e}},Lh=Oe("[SessionId]"),Fc=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,n){var i;if(this.tr=[],this.ir=void 0,this.Ze=new pa,this.er=(d,p)=>!(!qi(d)||!qi(p))&&Math.abs(d-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||un,this.ar=n||un;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pr(o,60,36e3,Lh.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var a=et.W(this.ur),l=et.W(this.hr);a&&!l?this.rr=a:et.V(this.ur),et.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(d=>{var p=d.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(d){Lh.error("Invalid sessionID in bootstrap",d)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&et.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&et.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?et.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[xc]:[t,e,n]}))}_r(){var e=this.Xe.props[xc];return _e(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&E&&(E.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&et.V(this.hr)},je(E,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=qi(o)&&Math.abs(n-o)>864e5,c=!1,d=!s,p=!d&&!e&&this.er(n,i);d||p||l?(s=this.nr(),a=this.ar(),Lh.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=qi(i)&&e&&!l?i:n,f=qi(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,f),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}lr(){clearTimeout(this.mr),this.mr=setTimeout((()=>{var[e]=this._r();if(this.er(new Date().getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},TR=["$set_once","$set"],ln=Oe("[SiteApps]"),jf=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var n=this.globalsForEvent(t);this.br.push(n),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,n,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:d[h],type:h,properties:f};var{$set_once:v,$set:m}=e;return{event:q({},q0(e,TR),{properties:q({},e.properties,m?{$set:q({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:q({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var a;!t.errored&&this.br.length&&(ln.info("Processing "+this.br.length+" events for site app with id "+e.id),this.br.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.wr)==null||a.call(this))},i=!1,s=a=>{t.errored=!a,t.loaded=!0,ln.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){ln.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){ln.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){ln.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,i,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",(c=>this.$r(c)))):void ln.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.wr)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var d;ee["__$$ph_site_app_"+c]=s._instance,(d=ee.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(s._instance,l,(p=>{if(p)return ln.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else ln.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Kx=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&e0(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>e0(i?.brand,e))))return!0}catch{}return!!r.webdriver},na=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),V0="i.posthog.com",Wf=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+V0,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=na.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=na.EU:this.Sr[this.apiHost]=na.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===na.CUSTOM)return this.apiHost+t;var n=V0+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},RR={icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!E&&Lc(e.href,r),not_regex:(r,e)=>!!E&&!Lc(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},zf=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);qe(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=Tc(e?.search,"__experiment_id"),n=Tc(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!ge(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||RR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.utm))return!0;var n=Lx();if(n.utm_source){var i,s,o,a,l,c,d,p,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,m=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return h&&v&&m&&f}return!1}static kr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];z.info("[WebExperiments] "+e,n)}Tr(e,t,n){this._is_bot()?r.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach((i=>{if(i.selector){var s;r.kr("applying transform of variant "+t+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)}))}})):r.kr("Control variants leave the page unmodified.")}_is_bot(){return kt&&this._instance?Kx(kt,this._instance.config.custom_blocked_useragents):void 0}},IR=Oe("[PostHog ExternalIntegrations]"),MR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},qf=class{constructor(e){this._instance=e}it(e,t){var n;(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return IR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=ee.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(MR[o],(()=>{var d;(d=ee.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[o])==null||d.start(e._instance)})),!i&&(l=ee.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=ee.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[n,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(n)}}},Zf="[SessionRecording]",Ko=Oe(Zf),Dc=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Ko.error("started without valid sessionManager"),new Error(Zf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Zf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(wh))==null||!e.enabled),n=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var n=!j(Object.assign)&&!j(Array.from);this.Ar&&n?(this.Dr(e),Ko.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(ee!=null&&(t=ee.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=ee.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=ee.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Ko.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(yx)}zr(e){if(this._instance.persistence){var t,n,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[wh]:q({enabled:!!o},o,{networkPayloadCapture:q({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:j(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Ko.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;t===void 0&&(t="log"),(n=this.Or)!=null&&n.log?this.Or.log(e,t):Ko.warn("log called before recorder was ready")}get Nr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(wh);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=ee.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=ee.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Or||(n=this._instance.persistence)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Or)==null||!n.tryAddCustomEvent(e,t))}},oa={},Gf=()=>{},Zi="posthog",Yx=!bR&&_t?.indexOf("MSIE")===-1&&_t?.indexOf("Mozilla")===-1,U0=r=>{var e;return q({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:LT(U?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Gf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:tt&&qe(tt?.search)&&tt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;z.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Hf},error_tracking:{},_onCapture:Gf,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(r))},j0=r=>{var e={};j(r.process_person)||(e.person_profiles=r.process_person),j(r.xhr_headers)||(e.request_headers=r.xhr_headers),j(r.cookie_name)||(e.persistence_name=r.cookie_name),j(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),j(r.store_google)||(e.save_campaign_params=r.store_google),j(r.verbose)||(e.debug=r.verbose);var t=He({},e,r);return _e(r.property_blacklist)&&(j(r.property_denylist)?t.property_denylist=r.property_blacklist:_e(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:z.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Kf=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Hc=class r{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Kf,this.Br=!1,this.version=$r.LIB_VERSION,this.qr=new pa,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=U0(),this.SentryIntegration=yf,this.sentryIntegration=e=>(function(t,n){var i=Ox(t,n);return{name:Px,processEvent:s=>i(s)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new Tf(this),this.toolbar=new bf(this),this.scrollManager=new Uf(this),this.pageViewManager=new Mc(this),this.surveys=new Of(this),this.conversations=new Lf(this),this.logs=new Nf(this),this.experiments=new zf(this),this.exceptions=new Af(this),this.rateLimiter=new Ff(this),this.requestRouter=new Wf(this),this.consent=new gf(this),this.externalIntegrations=new qf(this),this.people={set:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>z.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==Zi){var i,s=(i=oa[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),oa[n]=s,oa[Zi][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),j(e)||Hh(e))return z.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(He({},U0(t.defaults),j0(t),{name:n,token:e})),this.config.on_xhr_error&&z.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Lr.GZipJS;var s=this.Qr();this.persistence=new sa(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sa(q({},this.config,{persistence:"sessionStorage"}),s);var o=q({},this.persistence.props),a=q({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Bf((x=>this.ts(x)),this.config.request_queue_config),this.es=new Vf(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Fc(this),this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(z.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(z.info("Initializing extensions synchronously"),this.rs(l)),$r.DEBUG=$r.DEBUG||this.config.debug,$r.DEBUG&&z.info("Starting in debug mode",{this:this,config:t,thisC:q({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,d,p=this.config.get_device_id(un()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Pr,(d=t.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,m=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var w;return!((w=t.bootstrap)==null||(w=w.featureFlags)==null||!w[x])})).reduce(((x,w)=>{var y;return x[w]=((y=t.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[w])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,w)=>{var y,S;return(y=t.bootstrap)!=null&&(y=y.featureFlagPayloads)!=null&&y[w]&&(x[w]=(S=t.bootstrap)==null||(S=S.featureFlagPayloads)==null?void 0:S[w]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:Vo,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(un());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Pr,"anonymous")}return je(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?nR(this,(()=>this.ns())):this.ns(),dn(this.config._onCapture)&&this.config._onCapture!==Gf&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&z.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}rs(e){var t=performance.now();this.historyAutocapture=new vf(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new _f(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new jf(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Dc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new df(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Rf(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new wf(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new xf(this)})),n.push((()=>{this.exceptionObserver=new mf(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Ic(this,rR),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(n,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var n=e.shift();if(n)try{n()}catch(s){z.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:i}),this.config.__preview_deferred_init_extensions&&z.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,d;if(!U||!U.body)return z.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=he(e.supportedCompression,Lr.GZipJS)?Lr.GZipJS:he(e.supportedCompression,Lr.Base64)?Lr.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(d=this.deadClicksAutocapture)==null||d.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(n){z.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&tt!=null&&tt.hostname){var e=tt.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Df(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&pn(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Yx?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Oc(e.url,{ip:this.config.ip?1:0}),e.headers=q({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,i,s,o=q({},t);o.timeout=o.timeout||6e4,o.url=Oc(o.url,{_:new Date().getTime().toString(),ver:$r.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=vc.filter((d=>!o.disableTransport||!d.transport||!o.disableTransport.includes(d.transport))),c=(i=(s=gx(l,(d=>d.transport===a)))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!c)throw new Error("No available transport method");c(o)})(q({},e,{callback:t=>{var n,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(i=this.config).on_request_error)==null||n.call(i,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,n=[],i=[],s=[];pn(e,(a=>{a&&(t=a[0],_e(t)?s.push(a):dn(a)?a.call(this):_e(a)&&t==="alias"?n.push(a):_e(a)&&t.indexOf("capture")!==-1&&dn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){pn(a,(function(c){if(_e(c[0])){var d=l;Ae(c,(function(p){d=d[p[0]].apply(d,p.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(n,this),o(i,this),o(s,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!j(e)&&qe(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!qe(t?.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=n?.timestamp||a,c=un(),d={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n?.$set&&(d.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(d.$set_once=f),(d=PT(d,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,j(n?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=a),e===ra.DISMISSED||e===ra.SENT){var v=t?.[Oh.SURVEY_ID],m=t?.[Oh.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(H0(p))||localStorage.setItem(H0(p),"true"),d.$set=q({},d.$set,{[SR({id:v,current_iteration:m},e===ra.SENT?"responded":"dismissed")]:!0})}else e===ra.SHOWN&&(d.$set=q({},d.$set,{[Oh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=q({},d.properties.$set,d.$set);if(Ki(g)||this.setPersonPropertiesForFlags(g),!ge(this.config.before_send)){var b=this.cs(d);if(!b)return;d=b}this.qr.emit("eventCaptured",d);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ts(x):this.Zr.enqueue(x),d}z.critical("This capture call is ignored due to client rate limiting.")}}else z.error("No event name provided to posthog.capture")}else z.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=q({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=q({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!qe(a.distinct_id)&&!Dr(a.distinct_id)||Hh(a.distinct_id))&&z.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,d=cR(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&He(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&He(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===na.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=He(a,c),e==="$pageview"&&U&&(a.title=U.title),!j(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}_t&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=He({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),_e(this.config.property_denylist)?Ae(this.config.property_denylist,(function(b){delete a[b]})):z.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(z.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var g=this.fs();return a.$process_person_profile=g,g&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),o=He({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(z.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Ki(o)?void 0:o}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var i;(i=this.persistence)==null||i.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,n){var i=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},s=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},o=q({},i,e),a=q({},s,t),l={};for(var[c,d]of Object.entries(o)){var p=typeof d=="string";l[c]={key:c,enabled:!!p||!!d,variant:p?d:void 0,reason:void 0,metadata:j(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=ER),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning("posthog.identify");if(Dr(e)&&(e=e.toString(),z.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))z.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Vo){if(this.ps("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Xo)&&(this.unregister(Xo),this.register({distinct_id:e}));var o=(this.persistence.get_property(Pr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Pr,"identified"),this.setPersonPropertiesForFlags(q({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=P0(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(wc))}}else z.critical('The string "'+Vo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else z.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=P0(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(q({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):z.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:q({},i,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),i[e]===t||n||this.reloadFeatureFlags()}else z.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,i,s;if(z.info("reset"),!this.__loaded)return z.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(Pr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Vo,$device_id:null},"");else{var a=this.config.get_device_id(un());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(mx)?(z.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Xo,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(z.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=q({},this.config);if(ze(e)){var n,i,s,o,a,l,c;He(this.config,j0(e));var d=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sa(q({},this.config,{persistence:"sessionStorage"}),d);var p=this.Kr(this.config.debug);Fr(p)&&(this.config.debug=p),Fr(this.config.debug)&&(this.config.debug?($r.DEBUG=!0,$e.H()&&$e.G("ph_debug","true"),z.info("set_config",{config:e,oldConfig:t,newConfig:q({},this.config)})):($r.DEBUG=!1,$e.H()&&$e.V("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(c=this.externalIntegrations)==null||c.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),n.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(q({},i,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Zi;return t!==Zi&&(t=Zi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Pr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Pr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ki(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Xo])&&((t=this.persistence)==null||(t=t.props)==null||!t[kc]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(z.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(kc,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,n,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.ki)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var n,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Fc(this),this.pageViewManager=new Mc(this),this.persistence&&(this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Dc(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(j(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else z.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,n;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Vo,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.hs())):z.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Or.GRANTED?"granted":e===Or.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return kt?Kx(kt,this.config.custom_blocked_useragents):void 0}hs(){U&&(U.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:U.title},{send_instantly:!0}),this.Gr&&(U.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),je(U,"visibilitychange",this.Gr)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,n,i,s,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(z.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",i=!1,s=z,o=(t="advanced_disable_flags")in(e=l)&&!ge(e[t]),a=n in e&&!ge(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):i)}cs(e){if(ge(this.config.before_send))return e;var t=_e(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ge(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return oT(e.event)?z.warn(s+". This can cause unexpected behavior."):z.info(s),null}n.properties&&!Ki(n.properties)||z.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Kr(e){var t=Fr(e)&&!e,n=$e.H()&&$e.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=$T(r.prototype[e[t]])})(Hc,["identify"]);var W0;var Xx=(W0=oa[Zi]=new Hc,(function(){function r(){r.done||(r.done=!0,Yx=!1,Ae(oa,(function(e){e._dom_loaded()})))}U!=null&&U.addEventListener?U.readyState==="complete"?r():je(U,"DOMContentLoaded",r,{capture:!1}):E&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),W0);var og=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,n=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0};e.cookieless_mode&&(o.cookieless_mode=e.cookieless_mode);let a=Xx.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],d=typeof c=="string"?c:c?.event,p=typeof c=="string"?void 0:c?.properties;typeof d=="string"&&this.captureCallback?.(d,p)}),t&&this.featureFlagsCallback&&this.client){this.client.onFeatureFlags(()=>{let c=this.getAllFeatureFlags();c&&this.featureFlagsCallback&&this.featureFlagsCallback(c)});let l=this.getAllFeatureFlags();l&&Object.keys(l).length>0&&this.featureFlagsCallback(l)}this.rrwebCallback&&this.client&&this.setupRRWebIntercept()}setupRRWebIntercept(e=30){let t=this.client?.sessionRecording;if(!t){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let n=null,i=t;for(let o of Object.getOwnPropertyNames(i)){let a=i[o];if(a&&typeof a=="object"&&typeof a.onRRwebEmit=="function"&&typeof a.start=="function"&&a!==t){n=a;break}}if(!n){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=n.onRRwebEmit.bind(n);n.onRRwebEmit=o=>{this.rrwebCallback?.({kind:"rrweb",...o}),s(o)},typeof window<"u"&&(window.__RRWEB_INTERCEPT_READY__=!0)}getAllFeatureFlags(){return this.client?.featureFlags?.getFlagVariants()}getSegmentFlags(){let e=this.getAllFeatureFlags();if(!e)return{};let t={};for(let[n,i]of Object.entries(e))n.startsWith("in_segment_")&&(t[n]=i===!0);return t}identify(e,t){this.client?.identify(e,t)}alias(e,t){this.client?.alias(e,t)}optInCapturing(){this.client?.opt_in_capturing()}optOutCapturing(){this.client?.opt_out_capturing()}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function ag(r={}){return new og(r)}var Jx={posthog:r=>ag(r),noop:()=>yh()};function Qx(r,e){let t=Jx[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Jx).join(", ")}`);return t(e)}async function ew(r){cd(),G("Syntro Bootstrap","====== INIT ======"),G("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Ll();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",yo()),console.log("[DIAG] editorConf:",Ol()),G("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let H=!!window.__SYNTRO_EDITOR_PARAMS__,Q=!!window.__SYNTRO_AUDIT_LEGEND__,re=!!window.__SYNTRO_REVIEW_DATA__;if(H||Q||re){let fe=[H&&"__SYNTRO_EDITOR_PARAMS__",Q&&"__SYNTRO_AUDIT_LEGEND__",re&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${fe.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let Q=Ol()?.syntro_token;Q?.startsWith("syn_")&&(t=Q,G("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))G("Syntro Bootstrap","Token starts with syn_, decoding..."),n=bo(t),cd(n.d);else if(e)G("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw gl("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),gl("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)G("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw gl("Syntro Bootstrap","\u274C No token provided and NOT in editor/audit/review mode!"),new Error("Syntro token is required (unless in editor, audit, or review mode)");let i=Pt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||Pt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=Pt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||Pt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th;if(n!=null&&n.obd!==!0&&s)try{let H=`${s.replace(/\/$/,"")}/sdk-otel/v1/logs`,Q=ud({resource:{serviceName:"syntro-runtime-sdk",serviceVersion:so,posthogKey:n.t??"",hostOrigin:typeof window<"u"?window.location.origin:""},emit:pd({endpoint:H})}),re=fd()??"https://cdn.syntrologie.com/runtime-sdk/",fe=Td(Q,{attributedScriptUrlPrefix:re});Q.attachAdapterCleanup(fe)}catch{}let o=Pt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||Pt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||Pt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||Pt("VITE_SYNTRO_GEO_HOST")||Tb,l=wb(),c=gp(),d=r.appSignalsInit??{},p=Cb(),h=mp(c,p);Ab(h);let f={...c,...h,...l,...d};G("Syntro Bootstrap","Phase 1: Browser metadata:",c),G("Syntro Bootstrap","Phase 1: Initial attrs:",h),G("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(d).length>0&&G("Syntro Bootstrap","Phase 1: App signals:",d);let v=vp(a),m=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(H=>{let Q=setTimeout(()=>{window.removeEventListener("message",re),H(null)},500);function re(fe){let Ce=fe.data;Ce?.jsonrpc==="2.0"&&Ce?.id===1&&Ce?.result?.hostInfo&&(clearTimeout(Q),window.removeEventListener("message",re),H(Ce.result.hostInfo))}window.addEventListener("message",re);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(Q),window.removeEventListener("message",re),H(null)}})})(),g,b=r.debug||r.testMode,x=_o({debug:r.debug,history:b?new xo(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let w=sd({elementResolver:typeof window<"u"?(H,Q)=>{let re=document.elementFromPoint(H,Q);if(!re)return null;let fe={tag_name:re.tagName.toLowerCase()};re.id&&(fe.attr__id=re.id),re.className&&typeof re.className=="string"&&(fe.classes=re.className.split(" ").filter(Boolean));for(let Ce of re.attributes)Ce.name.startsWith("data-")&&(fe[`attr__${Ce.name}`]=Ce.value);return fe}:void 0});w.onEvent(H=>x.publishEvent(H)),typeof window<"u"&&(setInterval(()=>w.tick(Date.now()),1e3),document.addEventListener("click",H=>{let Q=[],re=H.target;for(;re&&re!==document.body;){let fe={tag_name:re.tagName.toLowerCase()};for(let Ce of re.attributes)(Ce.name.startsWith("data-")||Ce.name==="id"||Ce.name==="class"||Ce.name==="aria-label")&&(fe[`attr__${Ce.name}`]=Ce.value);Q.push(fe),re=re.parentElement}w.enrichClickAttributes(Date.now(),Q)},!0));let y=$_(),S,T=H=>{G("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let Q=kb(H);if(G("Syntro Bootstrap","Segment flags from PostHog:",Q),Sb(Q),g){let re=C?.getAll?.()??{},fe={...c,...h,...re,...Q,...d};G("Syntro Bootstrap","Updating GrowthBook with attributes:",fe),g.setAttributes?.(fe)}if(S&&_?.getDistinctId){let re=_.getDistinctId();re&&s&&n?.t&&S.updateContext({distinctId:re,telemetryHost:s,telemetryKey:n.t})}},_;if(n?.t){let H=n.t==="noop"?"noop":"posthog";_=Qx(H,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,cookieless_mode:"on_reject",onFeatureFlagsLoaded:T,onCapture:(we,Ie)=>{w.ingest({kind:"posthog",event:we,properties:Ie,timestamp:Date.now()})},onRRWebEvent:we=>{w.ingest(we)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${H}) with EventBus wiring`),Object.keys(d).length>0&&(_.track?.("app_signals_init",d),G("Syntro Bootstrap","Tracked app signals event:",d));let Q=_;x.setPosthogCapture((we,Ie)=>{Q.track?.(we,Ie)});let re=_,fe=async()=>{let we=await v;return we.is_eu==="true"||we.country_code==="GB"||we.country_code==="CH"?"denied":"granted"},Ce=new Ho({initialStatus:"pending",pendingResolver:fe,onConsentChange:we=>{we==="granted"?re.optInCapturing?.():we==="denied"&&re.optOutCapturing?.()}});try{Fb(_,Ce,{geoPromise:v}),G("Syntro Bootstrap","SDK defaults installed (D-1..D-5) with consent gate")}catch(we){st("Syntro Bootstrap","installDefaults failed",we)}try{new Do({adapters:[new Fo,new No,new Lo],fallbackStatus:fe,onAdapterSelected:Ie=>{re.track?.("syntro_consent_adapter_selected",{adapter:Ie??"none"}),G("Syntro Bootstrap",`Consent adapter selected: ${Ie??"none"}`)}}).start(Ce).catch(Ie=>{st("Syntro Bootstrap","Consent detector failed to start",Ie)})}catch(we){st("Syntro Bootstrap","Consent detector setup failed",we)}try{S=Ib({telemetry:_,telemetryHost:s,telemetryKey:n.t,platformAdapter:y,debug:G,warn:st}).shopifyPixelBridge}catch(we){st("Syntro Bootstrap","wirePlatformAdapters failed",we)}}let C;n?.e&&(g=E_("growthbook",{clientKey:n.e,apiHost:i,attributes:f,onExperimentViewed:_?.trackExperiment?(H,Q,re)=>{_.trackExperiment(H,Q,re)}:void 0})),C=Kp({experiments:g,onMetricChange:(H,Q)=>{G("Syntro Bootstrap",`Session metric changed: ${H} = ${Q}`)}}),G("Syntro Bootstrap","SessionMetricTracker created");let R="production";e==="editor"?R="editor":e==="audit"?R="audit":Pt("NODE_ENV")==="development"&&(R="development");let N=typeof c.surface_type=="string"?c.surface_type:"web",$=typeof c.surface_host=="string"?c.surface_host:"web",F=gh({telemetry:_,sessionMetrics:C,mode:R,events:x,initialSurfaceType:N,initialSurfaceHost:$});G("Syntro Bootstrap","Runtime created:",{version:F.version,mode:F.mode,hasContext:!!F.context,hasEvents:!!F.events,hasState:!!F.state}),G("Syntro Bootstrap","Core app executors already registered");let V=r.cdnBase||Pt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||Pt("VITE_SYNTRO_CDN_BASE")||Mb()||"https://cdn.syntrologie.com",P=yu({cdnBase:V,registry:F.apps,onLoadStart:H=>{G("Syntro Bootstrap",`Loading app from CDN: ${H}`)},onLoadEnd:(H,Q,re)=>{Q?G("Syntro Bootstrap",`App loaded successfully: ${H}`):st("Syntro Bootstrap",`Failed to load app: ${H}`,re)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:F.apps,appLoader:P,runtime:F,version:F.version},G("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&P.loadApp("adaptive-mcp").catch(H=>{G("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",H)});let K=F.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${K.length} apps in registry:`,K.map(H=>`${H.manifest.id}(${H.state})`).join(", "));for(let H of K)if(H.state==="registered")try{await F.apps.activate(H.manifest.id),console.log(`[DIAG] Activated: ${H.manifest.id} \u2192 widgets: [${F.widgets.list().join(", ")}]`)}catch(Q){console.error(`[DIAG] FAILED to activate: ${H.manifest.id}`,Q),st("Syntro Bootstrap",`Failed to auto-activate built-in app: ${H.manifest.id}`,Q)}if(console.log(`[DIAG] Activation complete. Total widgets: [${F.widgets.list().join(", ")}]`),g?.refreshFeatures)try{await g.refreshFeatures(),G("Syntro Bootstrap","GrowthBook features loaded")}catch(H){st("Syntro Bootstrap","Failed to load GrowthBook features:",H)}let Y=await v;if(g&&Object.keys(Y).length>0){let H={...c,...h,...Y,...d};G("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",Y),g.setAttributes?.(H)}let le=await m;le&&g&&(c.surface_type="mcp-app",c.surface_host=le.name,g.setAttributes?.({...c,...h,...Y}),F.context.setSurfaceType("mcp-app"),F.context.setSurfaceHost(le.name),G("Syntro Bootstrap","MCP App detected:",le.name));let D;if(r.fetcher)D=r.fetcher;else if(n?.f){let H=R_(n.f,n.o??{});D=async()=>{let Q=await H.fetch();return{...Q.config,tiles:Q.config.tiles??[]}}}else g&&(D=Mi({experiments:g}));let te=new Set,Ze=D?async()=>{let H=await D(),Q=H.tiles?.length??0,re=H.actions?.length??0,fe=H.meta?.variant_id;if((Q>0||re>0)&&(fe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),_&&fe){let Ie=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,Ne=Ie?.interventionTracker,Zt;Ne&&Ne.variantId===fe?Zt=Ne:(Zt=new Bo(_,fe),Ie&&(Ie.interventionTracker=Zt),F.navigation.subscribe(()=>{Zt.resetPage()})),Zt.trackServed(Q,re)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${H.tiles?.length??0},`,`actions=${H.actions?.length??0},`,`theme=${H.theme?.name??"none"}`),H.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",H.actions.map((Ie,Ne)=>`[${Ne}] ${Ie.kind}${Ie.anchorId?` anchor="${Ie.anchorId.selector}"`:""}${Ie.label?` "${Ie.label}"`:""}`).join(", "));let Ce=H,we=P.getRequiredApps(Ce);return we.length>0?console.log("[Syntro Bootstrap] Required external apps:",we.join(", ")):G("Syntro Bootstrap","No external apps required (all executors are built-in)"),we.length>0&&await P.loadAppsForConfig(Ce).then(async Ne=>{let Zt=Ne.filter(Fe=>Fe.success),va=Ne.filter(Fe=>!Fe.success);Zt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${Zt.map(Fe=>Fe.appId).join(", ")}`);let fn=va.filter(Fe=>!te.has(Fe.appId));fn.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",fn.map(Fe=>`${Fe.appId} (${Fe.error})`).join(", ")),fn.forEach(Fe=>te.add(Fe.appId)));for(let Fe of we)if(F.apps.has(Fe))try{await F.apps.activate(Fe),console.log(`[Syntro Bootstrap] App activated: ${Fe}`)}catch(ya){console.error(`[Syntro Bootstrap] Failed to activate app: ${Fe}`,ya)}else console.error(`[Syntro Bootstrap] App "${Fe}" required by config but NOT registered.`,`Available apps: [${Array.from(F.apps.list?.()??[]).join(", ")}]`)}),H}:void 0;if(y){G("Syntro Bootstrap",`Detected platform: ${y.name}`);try{await y.onInit(),G("Syntro Bootstrap",`Platform adapter initialized: ${y.name}`)}catch(H){st("Syntro Bootstrap",`Platform adapter init failed: ${y.name}`,H)}}let at=await up({...r.canvas,fetcher:Ze,integrations:{experiments:g,telemetry:_},editorUrl:o,runtime:F});if(at.setOverrideFetcher){let H=at.setOverrideFetcher.bind(at);at.setOverrideFetcher=Q=>{H(async()=>{let fe=await Q(),Ce=fe;if(P.getRequiredApps(Ce).length>0){let Ie=await P.loadAppsForConfig(Ce);for(let Ne of Ie)if(Ne.success&&F.apps.has(Ne.appId))try{await F.apps.activate(Ne.appId)}catch{}}return fe})}}let Le=nr();if(Le!==null)try{let H=_,Q=F;Le.bindRuntime({getSessionId:()=>{try{return H?.getSessionId?.()??""}catch{return""}},getSurface:()=>{try{let re=Q.context.get().surface;return re?{...re}:null}catch{return null}}})}catch{}return Le?.increment("bootstrap_ok"),{canvas:at,runtime:F,experiments:g,telemetry:_,sessionMetrics:C,appLoader:P}}async function $R(r){try{return await ew(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),nr()?.increment("bootstrap_errors"),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function PR(r,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:r,source:"custom",props:e})}async function OR(r){if(typeof window>"u")return{appId:r,success:!1,error:"no-window"};let e=window.SynOS?.appLoader;return e?e.loadApp(r):{appId:r,success:!1,error:"syntro-not-initialized"}}var tw={init:$R,loadAdaptive:OR,encodeToken:pp,decodeToken:bo,events:{emit:PR}};typeof window<"u"&&(window.Syntro=tw);function ma(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function w3(r){let e=[],t=[];if(!r||typeof r!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let n=r;if(n.tiles||t.push("Config missing required field: tiles"),n.actions||t.push("Config missing required field: actions"),n.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=n.schemaVersion||"1.0",s=ma(i),o=ma(Kr);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Kr}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!n.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${Kr}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:LR(n,i)}):{valid:!0,warnings:e,errors:t}}function LR(r,e){let t={...r};return ma(e).major===1&&(t=NR(t)),t.schemaVersion=Kr,t}function NR(r){let e={schemaVersion:"2.0",tiles:[],actions:r.actions||[],fetchedAt:r.fetchedAt||new Date().toISOString()};return r.tiles&&Array.isArray(r.tiles)&&(e.tiles=r.tiles.map(t=>{let n={...t};return t.experiment&&delete n.experiment,n})),r.configVersion&&(e.configVersion=r.configVersion),r.canvasTitle&&(e.canvasTitle=r.canvasTitle),r.theme&&(e.theme=r.theme),r.launcher&&(e.launcher=r.launcher),e}function S3(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=ma(t),i=ma(Kr);return n.major<i.major||!e.schemaVersion}var FR=u.object({url:u.string(),routeId:u.string().optional(),title:u.string().optional(),locale:u.string().optional()}),DR=u.object({url:u.string(),ts:u.number()}),HR=u.object({sessionId:u.string(),startTs:u.number(),pageHistory:u.array(DR).optional()}),BR=u.object({width:u.number(),height:u.number()}),VR=u.object({x:u.number(),y:u.number(),w:u.number(),h:u.number()}),UR=u.object({anchorId:u.string(),present:u.boolean(),visible:u.boolean().optional(),boundingBox:VR.optional()}),jR=u.record(u.string(),u.union([u.number(),u.string(),u.boolean(),u.undefined()])),WR=u.object({page:FR,session:HR,viewport:BR,anchors:u.array(UR).optional(),augmented:jR.optional()});function C3(r){return WR.safeParse(r)}var lg=class{constructor(e,t,n,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=n,this._defaultValue=i,this._value=i,e.addController(this)}get value(){return this._value}get isFallback(){return this._isFallback}get isLoading(){return this._isLoading}hostConnected(){this._evaluate()}hostDisconnected(){this._cancelled=!0}setStrategy(e){this._strategy=e,this._evaluate()}_evaluate(){if(this._cancelled=!1,!this._runtime||!this._strategy){this._value=this._defaultValue,this._isFallback=!0,this._isLoading=!1,this._host.requestUpdate();return}this._isLoading=!0,this._host.requestUpdate();let e=this._strategy;this._runtime.evaluate(e).then(t=>{this._cancelled||(this._value=t.value,this._isFallback=t.isFallback,this._isLoading=!1,this._host.requestUpdate())})}};var cg=class{constructor(e,t){this._unsubscribe=null;this.host=e,this._runtime=t,this._context=t.context.get(),e.addController(this)}hostConnected(){this._context=this._runtime.context.get(),this._unsubscribe=this._runtime.context.subscribe(e=>{this._context=e,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}get runtime(){return this._runtime}get context(){return this._context}get page(){return this._context?.page??null}get session(){return this._context?.session??null}get viewport(){return this._context?.viewport??null}};var ug=class{constructor(e,t,n,i){this._runtime=t,this._filter=n,this._callback=i,e.addController(this)}hostConnected(){this._subscribe()}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0}setFilter(e){this._filter=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}setCallback(e){this._callback=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}_subscribe(){this._runtime&&(this._unsubscribe=this._filter?this._runtime.events.subscribe(this._filter,this._callback):this._runtime.events.subscribe(this._callback))}};var rw=u.enum(["posthog","canvas","derived"]),zR=u.object({ts:u.number(),name:u.string(),source:rw,props:u.record(u.string(),u.unknown()).optional(),schemaVersion:u.string()}),qR=u.object({names:u.array(u.string()).optional(),patterns:u.array(u.string()).optional(),sources:u.array(rw).optional()});function Y3(r){return zR.safeParse(r)}function X3(r){return qR.safeParse(r)}var nw=u.union([u.object({type:u.literal("data"),key:u.string(),value:u.string().optional()}),u.object({type:u.literal("css"),value:u.string()}),u.object({type:u.literal("aria"),role:u.string().optional(),label:u.string().optional()}),u.object({type:u.literal("shadow-css"),value:u.string()}),u.object({type:u.literal("ref"),el:u.any()})]),ZR=u.object({kind:u.literal("tooltip"),id:u.string(),anchor:nw,content:u.object({title:u.string().optional(),body:u.string()}),placement:u.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:u.number().optional(),blocking:u.boolean().optional(),trigger:u.enum(["immediate","hover","click"]).optional(),dismiss:u.object({onEsc:u.boolean().optional(),closeButton:u.boolean().optional(),timeoutMs:u.number().optional()}).optional()}),GR=u.object({kind:u.literal("highlight"),id:u.string(),anchor:nw,copy:u.string().optional(),ring:u.object({paddingPx:u.number().optional(),radiusPx:u.number().optional()}).optional(),scrim:u.object({opacity:u.number().optional()}).optional(),ringColor:u.string().optional(),blocking:u.boolean().optional(),dismiss:u.object({onClickOutside:u.boolean().optional(),onEsc:u.boolean().optional(),timeoutMs:u.number().optional()}).optional()}),dg=u.object({id:u.string(),version:u.number(),routes:u.array(u.string()).optional(),steps:u.array(u.union([ZR,GR]))});function pH(r){return dg.parse(r)}var mH=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Rd({configUri:r,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:n});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return dg.parse(o)};var KR=u.object({value:u.unknown(),expiresAt:u.number().optional()}),YR=u.object({count:u.number(),resetAt:u.number().optional()});function bH(r){return KR.safeParse(r)}function _H(r){return YR.safeParse(r)}var iw="2026-05-21T09:23:45.620Z (496097bc2a98)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${iw} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Cs;window.SynOS={...r,appRegistry:e,_runtimeBuild:iw,_renderer:"lit"},El(),Pv(e)}export{Oo as ANIMATION_KEYFRAMES,$l as ActivationConfigZ,Ky as AddClassZ,$t as AnchorIdZ,UR as AnchorStateZ,qu as AnchorVisibleConditionZ,Es as AppRegistry,jR as AugmentationZ,Dy as BadgePositionZ,tb as BadgeZ,VR as BoundingBoxZ,to as CanvasEvents,dg as CanvasRecipeZ,Gr as ConditionZ,sc as ContextManager,Ju as CooldownActiveConditionZ,Ws as CounterDefZ,op as CtaButtonZ,od as DEFAULT_COOLDOWN,lg as DecisionController,Ys as DecisionStrategyZ,Xu as DismissedConditionZ,De as EVENT_SCHEMA_VERSION,Bl as EventBus,ed as EventCountConditionZ,qR as EventFilterZ,xo as EventHistory,Zu as EventOccurredConditionZ,rw as EventSourceZ,Tl as ExecutorRegistry,Ks as ExternalStrategyZ,YR as FrequencyEntryZ,Qu as FrequencyLimitConditionZ,GR as HighlightStepZ,Fy as HighlightStyleZ,Qy as HighlightZ,Jy as InsertHtmlZ,Uy as InsertPositionZ,Bo as InterventionTracker,dl as MAX_VISIBLE_TOASTS,tl as MOUNT_PLUMBING_KEYS,js as MatchOpZ,Vy as ModalContentZ,nb as ModalZ,Gs as ModelStrategyZ,ob as MountWidgetZ,sb as NavigateZ,Io as NavigationMonitor,zR as NormalizedEventZ,eo as NotificationsController,FR as PageContextZ,DR as PageHistoryEntryZ,Wu as PageUrlConditionZ,cb as ParallelZ,Hy as PlacementZ,eb as PulseZ,iw as RUNTIME_SDK_BUILD,Z_ as RUNTIME_VERSION,Yy as RemoveClassZ,zu as RouteConditionZ,Ly as RouteFilterZ,qs as RuleStrategyZ,zs as RuleZ,WR as RuntimeContextZ,cg as RuntimeController,ug as RuntimeEventsController,Kr as SDK_SCHEMA_VERSION,so as SDK_VERSION,j_ as STATIC_SLOT_STYLES,Zs as ScoreStrategyZ,qy as ScrollBehaviorZ,sp as ScrollLogicalPositionZ,ib as ScrollToZ,nw as SelectorZ,lb as SequenceZ,HR as SessionContextZ,Yu as SessionMetricConditionZ,ic as SessionMetricTracker,Gy as SetAttrZ,Xy as SetStyleZ,Zy as SetTextZ,Id as SmartCanvasController,Pi as SmartCanvasElementLit,Ke as StandardEvents,Gu as StateEqualsConditionZ,lc as StateStore,KR as StoredValueZ,tw as Syntro,co as ThemeController,By as TooltipContentZ,ZR as TooltipStepZ,jy as TooltipTriggerZ,rb as TooltipZ,zy as TourStepForSchemaZ,ub as TourZ,rl as TriggerWhenZ,Ku as ViewportConditionZ,BR as ViewportContextZ,ab as WaitZ,Wy as WidgetConfigZ,uc as WidgetRegistry,sh as applyStaticSlotStyles,mA as coreActionStepSchemas,np as createActionEngine,ap as createAnchorResolver,Mi as createCanvasConfigFetcher,Jp as createContextManager,Qp as createDecisionEngine,eh as createEventAccumulator,_o as createEventBus,qp as createGrowthBookClient,yh as createNoopClient,mH as createOverlayRecipeFetcher,ag as createPostHogClient,Wv as createPostHogNormalizer,Kp as createSessionMetricTracker,up as createSmartCanvas,gy as createSmartCanvasController,gh as createSmartCanvasRuntime,ih as createStateStore,uh as createSurfaceContainer,ph as createSurfaces,A5 as decisionSchemas,bo as decodeToken,pp as encodeToken,D_ as evaluate,L_ as evaluateCondition,N_ as evaluateRule,oc as evaluateRuleStrategy,ac as evaluateScoreStrategy,H_ as evaluateSync,Ar as executorRegistry,vA as getAntiFlickerSnippet,rA as getExecutor,cc as getSlotAnchorId,Po as getSlotType,dh as getSlotZIndex,Vd as hasExecutor,S3 as needsMigration,Js as normalizePostHogEvent,ma as parseVersion,lh as playEnterAnimation,ch as playExitAnimation,$i as registerConfigPredicates,El as registerSmartCanvasElement,Rd as resolveConfigUri,XC as runtimeContext,oh as setupAdjacentPositioning,ah as setupInlinePositioning,Qs as shouldNormalizeEvent,ju as stripMountPlumbing,lr as validateAction,Ml as validateActions,C5 as validateActivationConfig,k5 as validateCondition,w3 as validateConfig,X3 as validateEventFilter,Cp as validateEventName,_H as validateFrequencyEntry,Y3 as validateNormalizedEvent,Ap as validateProps,pH as validateRecipe,C3 as validateRuntimeContext,bH as validateStoredValue,E5 as validateStrategy,hh as widgetRegistry};
1077
+ `)).length,i=0;i<n;i++){var o=r.charCodeAt(i),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),qt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},bR=!!Fh||!!Nh,$0="text/plain",Oc=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=q({},e),a=(n=s?.split("&").map((c=>{var d,[p,h]=c.split("="),f=t&&(d=o[p])!==null&&d!==void 0?d:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=qT(o);return l&&a.push(l),i+"?"+a.join("&")},ta=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Rh=r=>{var{data:e,compression:t}=r;if(e){if(t===Lr.GZipJS){var n=vR((function(l,c){var d=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new Lt(l.length+(l.length>>>1)),h=0,f=function(b){p[h++]=b},v=0;v<d;++v){if(h+5>p.length){var m=new Lt(h+8+(d-v<<1));m.set(p),p=m}var g=l.charCodeAt(v);g<128||c?f(g):g<2048?(f(192|g>>>6),f(128|63&g)):g>55295&&g<57344?(f(240|(g=65536+(1047552&g)|1023&l.charCodeAt(++v))>>>18),f(128|g>>>12&63),f(128|g>>>6&63),f(128|63&g)):(f(224|g>>>12),f(128|g>>>6&63),f(128|63&g))}return zx(p,0,h)})(ta(e)),{mtime:0}),i=new Blob([n],{type:$0});return{contentType:$0,body:i,estimatedSize:i.size}}if(t===Lr.Base64){var s=(function(l){var c,d,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,b="",x=[];if(!l)return l;l=yR(l);do c=(f=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,d=f>>12&63,p=f>>6&63,h=63&f,x[g++]=v.charAt(c)+v.charAt(d)+v.charAt(p)+v.charAt(h);while(m<l.length);switch(b=x.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b})(ta(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:ta(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ta(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vc=[];Nh&&vc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Rh(r))!==null&&e!==void 0?e:{},o=new Headers;Ae(r.headers,(function(d,p){o.append(p,d)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(J_){var c=new J_;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Nh(a,q({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((d=>d.text().then((p=>{var h={statusCode:d.status,text:p};if(d.status===200)try{h.json=JSON.parse(p)}catch(f){z.error(f)}r.callback==null||r.callback(h)})))).catch((d=>{z.error(d),r.callback==null||r.callback({statusCode:0,text:d})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Fh&&vc.push({transport:"XHR",method:r=>{var e,t=new Fh;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Rh(r))!==null&&e!==void 0?e:{};Ae(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(s)}},t.send(i)}}),kt!=null&&kt.sendBeacon&&vc.push({transport:"sendBeacon",method:r=>{var e=Oc(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Rh(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;kt.sendBeacon(e,s)}catch{}}});var Lc=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function P0(r,e,t){return ta({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var qx={exact:(r,e)=>e.some((t=>r.some((n=>t===n)))),is_not:(r,e)=>e.every((t=>r.every((n=>t!==n)))),regex:(r,e)=>e.some((t=>r.some((n=>Lc(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Lc(t,n))))),icontains:(r,e)=>e.map(gc).some((t=>r.map(gc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(gc).every((t=>r.map(gc).every((n=>!t.includes(n))))),gt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n>parseFloat(i)))})),lt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n<parseFloat(i)))}))},gc=r=>r.toLowerCase();function Zx(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(j(s)||qt(s))return!1;var o=[String(s)],a=qx[i.operator];return!!a&&a(i.values,o)}))}var Ih=Oe("[Error tracking]"),Af=class{constructor(e){var t,n;this.Zt=[],this.ti=new zh([new Zh,new ef,new Kh,new Gh,new Jh,new Xh,new Yh,new Qh],TT()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(rf))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,i,s=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Zt=s,this._instance.persistence&&this._instance.persistence.register({[rf]:this.Zt,[d0]:o})}get ii(){var e,t=!!this._instance.get_property(d0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Ih.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Ih.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Ih.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:s,value:o}=i;return qe(s)&&s.length>0&&n.$exception_types.push(s),qe(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Zt.some((n=>{var i=n.values.map((s=>{var o,a=qx[s.operator],l=_e(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!ge(e)&&_e(e)}},St=Oe("[FeatureFlags]"),qo=Oe("[FeatureFlags]",{debugEnabled:!0}),Mh="$active_feature_flags",Wi="$override_feature_flags",O0="$feature_flag_payloads",Zo="$override_feature_flag_payloads",L0="$feature_flag_request_id",N0="$feature_flag_evaluated_at",F0=r=>{var e={};for(var[t,n]of mc(r||{}))n&&(e[t]=n);return e},_R=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload})).map((t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]})))):St.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},xR=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),Tf=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(St.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||St.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(nf),t=this._instance.get_property(Wi),n=this._instance.get_property(Zo);if(!n&&!t)return e||{};var i=He({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],d=t?.[o],p=j(d)?(a=c?.enabled)!==null&&a!==void 0&&a:!!d,h=j(d)?c.variant:typeof d=="string"?d:void 0,f=n?.[o],v=q({},c,{enabled:p,variant:p?h??c?.variant:void 0});p!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),f&&(v.metadata=q({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(St.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Yi),t=this._instance.get_property(Wi);if(!t)return e||{};for(var n=He({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(St.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(O0),t=this._instance.get_property(Zo);if(!t)return e||{};for(var n=He({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(St.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.oi=!0),n}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout((()=>{this.mi()}),5))}bi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.bi(),!this._instance.M())if(this.li)this.hi=!0;else{var n=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:q({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(ea)||{}),group_properties:this._instance.get_property(ai)};qt(i)||j(i)||(s.$device_id=i),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.pi()&&(s.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",a+l);o&&(s.timezone=Vx()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:Lr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:d=>{var p,h,f=!0;if(d.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=d.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!f,d.json&&(p=d.json.quotaLimited)!=null&&p.includes(xR.FeatureFlags))St.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var v;s.disable_flags||this.receivedFeatureFlags((v=d.json)!==null&&v!==void 0?v:{},f),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(n=i?.variant)!==null&&n!==void 0?n:i?.enabled}St.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(L0)||void 0,c=this._instance.get_property(N0)||void 0,d=this._instance.get_property(wc)||{};if((t.send_event||!("send_event"in t))&&(!(e in d)||!d[e].includes(a))){var p,h,f,v,m,g,b,x,w;_e(d[e])?d[e].push(a):d[e]=[a],(p=this._instance.persistence)==null||p.register({[wc]:d});var y=this.getFeatureFlagDetails(e),S={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((h=this._instance.config.bootstrap)==null||(h=h.featureFlags)==null?void 0:h[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};j(y==null||(v=y.metadata)==null?void 0:v.version)||(S.$feature_flag_version=y.metadata.version);var T,_=(m=y==null||(g=y.reason)==null?void 0:g.description)!==null&&m!==void 0?m:y==null||(b=y.reason)==null?void 0:b.code;_&&(S.$feature_flag_reason=_),y!=null&&(x=y.metadata)!=null&&x.id&&(S.$feature_flag_id=y.metadata.id),j(y?.original_variant)&&j(y?.original_enabled)||(S.$feature_flag_original_response=j(y.original_variant)?y.original_enabled:y.original_variant),y!=null&&(w=y.metadata)!=null&&w.original_payload&&(S.$feature_flag_original_payload=y==null||(T=y.metadata)==null?void 0:T.original_payload),this._instance.capture("$feature_flag_called",S)}if(i){var C=o;if(!j(o))try{C=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:C}}}else St.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(i.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:Lr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return j(n)?void 0:!!n}St.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,c,d){l===void 0&&(l={}),c===void 0&&(c={}),d===void 0&&(d={});var p=_R(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(_e(f)){St.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(f)for(var x=0;x<f.length;x++)b[f[x]]=!0;a&&a.register({[Mh]:f,[Yi]:b})}else{var w=f,y=v,S=h;if(o.errorsWhileComputingFlags)if(h){var T=new Set(Object.keys(h).filter((_=>{var C;return!((C=h[_])!=null&&C.failed)})));w=q({},l,Object.fromEntries(Object.entries(w).filter((_=>{var[C]=_;return T.has(C)})))),y=q({},c,Object.fromEntries(Object.entries(y||{}).filter((_=>{var[C]=_;return T.has(C)})))),S=q({},d,Object.fromEntries(Object.entries(S||{}).filter((_=>{var[C]=_;return T.has(C)}))))}else w=q({},l,w),y=q({},c,y),S=q({},d,S);a&&a.register(q({[Mh]:Object.keys(F0(w)),[Yi]:w||{},[O0]:y||{},[nf]:S||{}},m?{[L0]:m}:{},g?{[N0]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),St.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return St.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Wi),this._instance.persistence.unregister(Zo),this.wi(),qo.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.oi=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(Wi),qo.info("Flag overrides cleared");else if(n.flags){if(_e(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[Wi]:i})}else this._instance.persistence.register({[Wi]:n.flags});qo.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Zo),qo.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Zo]:n.payloads}),qo.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this._instance.get_property(Qo)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=q({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Mh]:Object.keys(F0(l)),[Yi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(Qo),s=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Qo),(l=this._instance.persistence)==null||l.register({[Qo]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(ea)||{};this._instance.register({[ea]:q({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ea)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(ai)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=q({},n[i],e[i]),delete e[i]})),this._instance.register({[ai]:q({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ai)||{};this._instance.register({[ai]:q({},t,{[e]:{}})})}else this._instance.unregister(ai)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.bi(),this.oi=!1}},wR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sa=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(n=>{var i="";return n.token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&z.info("Persistence loaded",e.persistence,q({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){wR.indexOf(e.persistence.toLowerCase())===-1&&(z.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(i){i===void 0&&(i=[]);var s=[...QT,...i];return q({},$e,{W:function(o){try{var a={};try{a=dr.W(o)||{}}catch{}var l=He(a,JSON.parse($e.q(o)||"{}"));return $e.G(o,l),l}catch{}return null},G:function(o,a,l,c,d,p){try{$e.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&dr.G(o,h,l,c,d,p)}catch(f){$e.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),dr.V(o,a)}catch(l){$e.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&$e.H()?$e:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&et.H()?et:n==="memory"?eR:n==="cookie"?dr:t.H()?t:dr}properties(){var e={};return Ae(this.props,(function(t,n){if(n===Yi&&ze(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=n,l=!1,(qt(o=NT)?l:X_&&o.indexOf===X_?o.indexOf(a)!=-1:(Ae(o,(function(c){if(l||(l=c===a))return _c})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=He({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(ze(e)){j(t)&&(t="None"),this.Pi=j(n)?this.Ci:n;var i=!1;if(Ae(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(ze(e)){this.Pi=j(t)?this.Ci:t;var n=!1;if(Ae(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=Lx(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Ki(eg(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=U?.referrer)?Fx(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Dx(),$referring_domain:U!=null&&U.referrer&&((e=Ac(U.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[lf]||this.props[cf]||this.register_once({[Sc]:Hx(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ae([cf,lf],(o=>{var a=this.props[o];a&&Ae(a,(function(l,c){e["$initial_"+Dh(c)]=l}))}));var t,n,i=this.props[Sc];if(i){var s=(t=Bx(i),n={},Ae(t,(function(o,a){n["$initial_"+Dh(a)]=o})),n);He(e,s)}return e}safe_merge(e){return Ae(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((d,p)=>d===c[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.Si(e),s=this.props;this.clear(),this.Y=i,this.props=s,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Jo]||{};n[e]=t,this.props[Jo]=n,this.save()}remove_event_timer(e){var t=(this.props[Jo]||{})[e];return j(t)||(delete this.props[Jo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},D0=Oe("[Product Tours]"),$h="ph_product_tours",Rf=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[h0]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(h0)||this.it((()=>this.Oi()))}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?D0.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=ee.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=ee.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!_e(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[$h];if(_e(i)&&!t)return this.Fi=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var o=s.statusCode;if(o!==200||!s.json){var a="Product Tours API could not be loaded, status: "+o;return D0.error(a),void e([],{isLoaded:!1,error:a})}var l=_e(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[$h]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ge(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister($h)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Go=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),OD=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),LD=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),ND=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),Ph=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),FD=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),DD=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),HD=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),ra=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Oh=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),If=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ee=Oe("[Surveys]"),Gx="seenSurvey_",SR=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},H0=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Gx,r),kR=[Ph.Popover,Ph.Widget,Ph.API],ER={ignoreConditions:!1,ignoreDelay:!1,displayType:If.Popover},pa=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((n=>n!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var i of this.Mi["*"]||[])i(e,t)}};function zi(r,e,t){if(ge(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Mf=class{constructor(e){this.Ai=new pa,this.ji=(t,n)=>this.Di(t,n)&&this.Li(t,n)&&this.Ni(t,n)&&this.Ui(t,n),this.Di=(t,n)=>n==null||!n.event||t?.event===n?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!j((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((n,i)=>{this.on(n,i)}))}}register(e){var t,n;if(!j((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Hi)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var d;(d=this.zi)==null||d.add(c?.event||"")}))})),(n=this._instance)!=null&&n.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&s.add(l?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,t){var n;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((n=this.Hi)==null?void 0:n.size)>0&&this.Hi.forEach((i=>{this.Bi(t,i)&&this.Ai.emit("actionCaptured",i.name)}))}qi(e){this.onAction("actionCaptured",(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!zi(i,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var n;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>zi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&zi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var n;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>zi(c.text,t.text,t.text_matching||"exact")||zi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!l&&(s=(function(c){for(var d,p=[],h=/(?::|")text="(.*?)"/g;!ge(d=h.exec(c));)p.includes(d[1])||p.push(d[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>zi(c,o,a))))}Vi(e,t){var n,i;if(t==null||!t.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||Zx(t.properties.reduce(((n,i)=>{var s=_e(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},$f=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Zx(e.propertyFilters,t?.properties)}Zi(e,t){var n=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}te(e,t,n){var i=(n===Go.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;j((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Mf(this._instance),this.se.init(),this.se.qi((n=>{this.onAction(n)}))),t.forEach((n=>{var i,s,o,a,l;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var d=this.Xi.get(c.name);d&&d.push(n.id),this.Xi.set(c.name,d||[n.id])}})))})))}ee(e){var t,n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(n.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,Go.Activation),this.Yi=this.Zi(e,Go.Cancellation))}onEvent(e,t){var n,i=this.ne(),s=this.oe(),o=this.ae(),a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[s])||[];if(o===e&&t&&a.length>0){var l,c;i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var d=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(d){var p=a.indexOf(d);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,Go.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var m=a.indexOf(v.id);m>=0&&a.splice(m,1),this.ue(v.id)})),this.le(a))}if(this.Ki.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,Go.Activation);this.le(a.concat(f.map((v=>v.id))||[]))}}}onAction(e){var t,n=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));n.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},Pf=class extends $f{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return ra.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return Ee}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Of=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ge(t))return Ee.warn("Flags not loaded yet. Not loading surveys.");var n=_e(t);this.ve=n?t.length>0:t,Ee.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Gx)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Ee.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ee.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ee.info("Not loading surveys in cookieless mode without consent.");else{var e=ee?.__PosthogExtensions__;if(e){if(!j(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,t);var i=e.loadExternalDependency;if(!i)return void this._e("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(s=>{s||!e.generateSurveys?this._e("Could not load surveys script",s):this.ge(e.generateSurveys,t)}))}catch(s){throw this._e("Error initializing surveys",s),s}finally{this.ce=!1}}}else Ee.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Pf(this._instance),Ee.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Ee.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Ee.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(sf);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then((s=>{var{surveys:o,context:a}=s;return e(o,a)})):(typeof Promise<"u"&&(this.pe=new Promise((s=>{n=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.pe=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;Ee.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var d,p=s.json.surveys||[],h=p.filter((v=>(function(m){return!(!m.start_date||m.end_date)})(v)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(v)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(v))));h.length>0&&((d=this._surveyEventReceiver)==null||d.register(h)),(o=this._instance.persistence)==null||o.register({[sf]:p});var f={isLoaded:!0};e(p,f),n?.({surveys:p,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Ee.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ee.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Ee.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(Ee.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ge(this._surveyManager))Ee.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(kR.includes(s.type)){var o=U?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(Ee.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;Ee.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o,n),Ee.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ee.warn("Survey element not found")}else Ee.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ee.warn("Survey not found")}}displaySurvey(e,t){var n;if(ge(this._surveyManager))Ee.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=q({},i,{appearance:q({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==If.Popover&&t.initialResponses&&Ee.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Ee.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==If.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ee.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?Ee.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Mr=Oe("[Conversations]"),Lf=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ge(t)||(Fr(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=ee?.__PosthogExtensions__;if(e&&!j(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Mr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}Se(e,t){Mr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!qt(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Gi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Mr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return Gi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Gi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Gi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Nf=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ge(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Oe("[logs]"),t=ee?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",(i=>{var s;i||(s=t.logs)==null||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},B0=Oe("[RateLimiter]"),Ff=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{B0.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void B0.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(n=this.instance.persistence)==null?void 0:n.get_property(af))!==null&&t!==void 0?t:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var c=l.tokens<1;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(af,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},oi=Oe("[RemoteConfig]"),Df=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(oi.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return oi.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void oi.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return oi.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie((t=>{this.yi(t)}));this.yi(e)}))}catch(e){oi.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):oi.info("__preview_remote_config is disabled. Logging config instead",e):oi.error("Failed to fetch remote config from PostHog.")}},Hf=3e3,Bf=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=pr(t?.flush_interval_ms||Hf,250,5e3,z.createLogger("flush interval"),Hf),this.Oe=e}enqueue(e){this.Re.push(e),this.Me||this.Ae()}unload(){this.je();var e=this.Re.length>0?this.De():{},t=Object.values(e);[...t.filter((n=>n.url.indexOf("/e")===0)),...t.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.Oe(q({},n,{transport:"sendBeacon"}))}))}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Me=setTimeout((()=>{if(this.je(),this.Re.length>0){var t=this.De(),n=function(){var s=t[i],o=new Date().getTime();s.data&&_e(s.data)&&Ae(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return Ae(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;j(e[s])&&(e[s]=q({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},CR=["retriesPerformedSoFar"],Vf=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!j(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},je(E,"online",this.ze),je(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=q0(e,CR);qi(t)&&(n.url=Oc(n.url,{retry_count:t})),this._instance._send_request(q({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(q({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),d=(Math.random()-.5)*(c-l);return Math.ceil(c+d)})(t),i=Date.now()+n;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),z.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout((()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()}),this.Ne)}Lt(){var e=Date.now(),t=[],n=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,j(E)||(this.ze&&(E.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(E.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(q({},e,{transport:"sendBeacon"}))}catch(t){z.error(t)}this.Re=[]}},Uf=class{constructor(e){this.Ge=()=>{var t,n,i,s;this.Ve||(this.Ve={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),d=o?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(a),this.Ve.maxScrollY=Math.max(a,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(n=this.Ve.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ve.lastContentY=c,this.Ve.maxContentY=Math.max(c,(i=this.Ve.maxContentY)!==null&&i!==void 0?i:0),this.Ve.maxContentHeight=Math.max(d,(s=this.Ve.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){je(E,"scroll",this.Ge,{capture:!0}),je(E,"scrollend",this.Ge,{capture:!0}),je(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=_e(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=E?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}},AR=r=>Hx(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Nc=class{constructor(e,t,n,i){this.Je=s=>{var o=this.Ke();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ye(this._instance)};this.Xe.register({[of]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||AR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[of]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Bx(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ae(eg(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Dh(n)]=t})),e}},Lh=Oe("[SessionId]"),Fc=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,n){var i;if(this.tr=[],this.ir=void 0,this.Ze=new pa,this.er=(d,p)=>!(!qi(d)||!qi(p))&&Math.abs(d-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||un,this.ar=n||un;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pr(o,60,36e3,Lh.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var a=et.W(this.ur),l=et.W(this.hr);a&&!l?this.rr=a:et.V(this.ur),et.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(d=>{var p=d.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(d){Lh.error("Invalid sessionID in bootstrap",d)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&et.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&et.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?et.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[xc]:[t,e,n]}))}_r(){var e=this.Xe.props[xc];return _e(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&E&&(E.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&et.V(this.hr)},je(E,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=qi(o)&&Math.abs(n-o)>864e5,c=!1,d=!s,p=!d&&!e&&this.er(n,i);d||p||l?(s=this.nr(),a=this.ar(),Lh.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=qi(i)&&e&&!l?i:n,f=qi(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,f),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}lr(){clearTimeout(this.mr),this.mr=setTimeout((()=>{var[e]=this._r();if(this.er(new Date().getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},TR=["$set_once","$set"],ln=Oe("[SiteApps]"),jf=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var n=this.globalsForEvent(t);this.br.push(n),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,n,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:d[h],type:h,properties:f};var{$set_once:v,$set:m}=e;return{event:q({},q0(e,TR),{properties:q({},e.properties,m?{$set:q({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:q({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var a;!t.errored&&this.br.length&&(ln.info("Processing "+this.br.length+" events for site app with id "+e.id),this.br.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.wr)==null||a.call(this))},i=!1,s=a=>{t.errored=!a,t.loaded=!0,ln.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){ln.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){ln.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){ln.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,i,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",(c=>this.$r(c)))):void ln.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.wr)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var d;ee["__$$ph_site_app_"+c]=s._instance,(d=ee.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(s._instance,l,(p=>{if(p)return ln.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else ln.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Kx=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&e0(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>e0(i?.brand,e))))return!0}catch{}return!!r.webdriver},na=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),V0="i.posthog.com",Wf=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+V0,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=na.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=na.EU:this.Sr[this.apiHost]=na.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===na.CUSTOM)return this.apiHost+t;var n=V0+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},RR={icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!E&&Lc(e.href,r),not_regex:(r,e)=>!!E&&!Lc(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},zf=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);qe(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=Tc(e?.search,"__experiment_id"),n=Tc(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!ge(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||RR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.utm))return!0;var n=Lx();if(n.utm_source){var i,s,o,a,l,c,d,p,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,m=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return h&&v&&m&&f}return!1}static kr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];z.info("[WebExperiments] "+e,n)}Tr(e,t,n){this._is_bot()?r.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach((i=>{if(i.selector){var s;r.kr("applying transform of variant "+t+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)}))}})):r.kr("Control variants leave the page unmodified.")}_is_bot(){return kt&&this._instance?Kx(kt,this._instance.config.custom_blocked_useragents):void 0}},IR=Oe("[PostHog ExternalIntegrations]"),MR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},qf=class{constructor(e){this._instance=e}it(e,t){var n;(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return IR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=ee.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(MR[o],(()=>{var d;(d=ee.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[o])==null||d.start(e._instance)})),!i&&(l=ee.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=ee.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[n,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(n)}}},Zf="[SessionRecording]",Ko=Oe(Zf),Dc=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Ko.error("started without valid sessionManager"),new Error(Zf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Zf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(wh))==null||!e.enabled),n=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var n=!j(Object.assign)&&!j(Array.from);this.Ar&&n?(this.Dr(e),Ko.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(ee!=null&&(t=ee.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=ee.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=ee.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Ko.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(yx)}zr(e){if(this._instance.persistence){var t,n,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[wh]:q({enabled:!!o},o,{networkPayloadCapture:q({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:j(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Ko.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;t===void 0&&(t="log"),(n=this.Or)!=null&&n.log?this.Or.log(e,t):Ko.warn("log called before recorder was ready")}get Nr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(wh);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=ee.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=ee.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Or||(n=this._instance.persistence)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Or)==null||!n.tryAddCustomEvent(e,t))}},oa={},Gf=()=>{},Zi="posthog",Yx=!bR&&_t?.indexOf("MSIE")===-1&&_t?.indexOf("Mozilla")===-1,U0=r=>{var e;return q({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:LT(U?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Gf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:tt&&qe(tt?.search)&&tt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;z.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Hf},error_tracking:{},_onCapture:Gf,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(r))},j0=r=>{var e={};j(r.process_person)||(e.person_profiles=r.process_person),j(r.xhr_headers)||(e.request_headers=r.xhr_headers),j(r.cookie_name)||(e.persistence_name=r.cookie_name),j(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),j(r.store_google)||(e.save_campaign_params=r.store_google),j(r.verbose)||(e.debug=r.verbose);var t=He({},e,r);return _e(r.property_blacklist)&&(j(r.property_denylist)?t.property_denylist=r.property_blacklist:_e(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:z.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Kf=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Hc=class r{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Kf,this.Br=!1,this.version=$r.LIB_VERSION,this.qr=new pa,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=U0(),this.SentryIntegration=yf,this.sentryIntegration=e=>(function(t,n){var i=Ox(t,n);return{name:Px,processEvent:s=>i(s)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new Tf(this),this.toolbar=new bf(this),this.scrollManager=new Uf(this),this.pageViewManager=new Mc(this),this.surveys=new Of(this),this.conversations=new Lf(this),this.logs=new Nf(this),this.experiments=new zf(this),this.exceptions=new Af(this),this.rateLimiter=new Ff(this),this.requestRouter=new Wf(this),this.consent=new gf(this),this.externalIntegrations=new qf(this),this.people={set:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>z.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==Zi){var i,s=(i=oa[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),oa[n]=s,oa[Zi][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),j(e)||Hh(e))return z.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(He({},U0(t.defaults),j0(t),{name:n,token:e})),this.config.on_xhr_error&&z.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Lr.GZipJS;var s=this.Qr();this.persistence=new sa(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sa(q({},this.config,{persistence:"sessionStorage"}),s);var o=q({},this.persistence.props),a=q({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Bf((x=>this.ts(x)),this.config.request_queue_config),this.es=new Vf(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Fc(this),this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(z.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(z.info("Initializing extensions synchronously"),this.rs(l)),$r.DEBUG=$r.DEBUG||this.config.debug,$r.DEBUG&&z.info("Starting in debug mode",{this:this,config:t,thisC:q({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,d,p=this.config.get_device_id(un()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Pr,(d=t.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,m=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var w;return!((w=t.bootstrap)==null||(w=w.featureFlags)==null||!w[x])})).reduce(((x,w)=>{var y;return x[w]=((y=t.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[w])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,w)=>{var y,S;return(y=t.bootstrap)!=null&&(y=y.featureFlagPayloads)!=null&&y[w]&&(x[w]=(S=t.bootstrap)==null||(S=S.featureFlagPayloads)==null?void 0:S[w]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:Vo,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(un());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Pr,"anonymous")}return je(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?nR(this,(()=>this.ns())):this.ns(),dn(this.config._onCapture)&&this.config._onCapture!==Gf&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&z.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}rs(e){var t=performance.now();this.historyAutocapture=new vf(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new _f(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new jf(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Dc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new df(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Rf(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new wf(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new xf(this)})),n.push((()=>{this.exceptionObserver=new mf(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Ic(this,rR),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(n,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var n=e.shift();if(n)try{n()}catch(s){z.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:i}),this.config.__preview_deferred_init_extensions&&z.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,d;if(!U||!U.body)return z.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=he(e.supportedCompression,Lr.GZipJS)?Lr.GZipJS:he(e.supportedCompression,Lr.Base64)?Lr.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(d=this.deadClicksAutocapture)==null||d.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(n){z.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&tt!=null&&tt.hostname){var e=tt.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Df(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&pn(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Yx?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Oc(e.url,{ip:this.config.ip?1:0}),e.headers=q({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,i,s,o=q({},t);o.timeout=o.timeout||6e4,o.url=Oc(o.url,{_:new Date().getTime().toString(),ver:$r.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=vc.filter((d=>!o.disableTransport||!d.transport||!o.disableTransport.includes(d.transport))),c=(i=(s=gx(l,(d=>d.transport===a)))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!c)throw new Error("No available transport method");c(o)})(q({},e,{callback:t=>{var n,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(i=this.config).on_request_error)==null||n.call(i,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,n=[],i=[],s=[];pn(e,(a=>{a&&(t=a[0],_e(t)?s.push(a):dn(a)?a.call(this):_e(a)&&t==="alias"?n.push(a):_e(a)&&t.indexOf("capture")!==-1&&dn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){pn(a,(function(c){if(_e(c[0])){var d=l;Ae(c,(function(p){d=d[p[0]].apply(d,p.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(n,this),o(i,this),o(s,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!j(e)&&qe(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!qe(t?.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=n?.timestamp||a,c=un(),d={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n?.$set&&(d.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(d.$set_once=f),(d=PT(d,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,j(n?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=a),e===ra.DISMISSED||e===ra.SENT){var v=t?.[Oh.SURVEY_ID],m=t?.[Oh.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(H0(p))||localStorage.setItem(H0(p),"true"),d.$set=q({},d.$set,{[SR({id:v,current_iteration:m},e===ra.SENT?"responded":"dismissed")]:!0})}else e===ra.SHOWN&&(d.$set=q({},d.$set,{[Oh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=q({},d.properties.$set,d.$set);if(Ki(g)||this.setPersonPropertiesForFlags(g),!ge(this.config.before_send)){var b=this.cs(d);if(!b)return;d=b}this.qr.emit("eventCaptured",d);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ts(x):this.Zr.enqueue(x),d}z.critical("This capture call is ignored due to client rate limiting.")}}else z.error("No event name provided to posthog.capture")}else z.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=q({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=q({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!qe(a.distinct_id)&&!Dr(a.distinct_id)||Hh(a.distinct_id))&&z.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,d=cR(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&He(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&He(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===na.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=He(a,c),e==="$pageview"&&U&&(a.title=U.title),!j(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}_t&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=He({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),_e(this.config.property_denylist)?Ae(this.config.property_denylist,(function(b){delete a[b]})):z.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(z.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var g=this.fs();return a.$process_person_profile=g,g&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),o=He({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(z.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Ki(o)?void 0:o}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var i;(i=this.persistence)==null||i.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,n){var i=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},s=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},o=q({},i,e),a=q({},s,t),l={};for(var[c,d]of Object.entries(o)){var p=typeof d=="string";l[c]={key:c,enabled:!!p||!!d,variant:p?d:void 0,reason:void 0,metadata:j(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=ER),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning("posthog.identify");if(Dr(e)&&(e=e.toString(),z.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))z.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Vo){if(this.ps("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Xo)&&(this.unregister(Xo),this.register({distinct_id:e}));var o=(this.persistence.get_property(Pr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Pr,"identified"),this.setPersonPropertiesForFlags(q({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=P0(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(wc))}}else z.critical('The string "'+Vo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else z.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=P0(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(q({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):z.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:q({},i,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),i[e]===t||n||this.reloadFeatureFlags()}else z.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,i,s;if(z.info("reset"),!this.__loaded)return z.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(Pr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Vo,$device_id:null},"");else{var a=this.config.get_device_id(un());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(mx)?(z.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Xo,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(z.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=q({},this.config);if(ze(e)){var n,i,s,o,a,l,c;He(this.config,j0(e));var d=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sa(q({},this.config,{persistence:"sessionStorage"}),d);var p=this.Kr(this.config.debug);Fr(p)&&(this.config.debug=p),Fr(this.config.debug)&&(this.config.debug?($r.DEBUG=!0,$e.H()&&$e.G("ph_debug","true"),z.info("set_config",{config:e,oldConfig:t,newConfig:q({},this.config)})):($r.DEBUG=!1,$e.H()&&$e.V("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(c=this.externalIntegrations)==null||c.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),n.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(q({},i,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Zi;return t!==Zi&&(t=Zi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Pr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Pr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ki(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Xo])&&((t=this.persistence)==null||(t=t.props)==null||!t[kc]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(z.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(kc,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,n,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.ki)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var n,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Fc(this),this.pageViewManager=new Mc(this),this.persistence&&(this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Dc(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(j(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else z.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,n;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Vo,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.hs())):z.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Or.GRANTED?"granted":e===Or.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return kt?Kx(kt,this.config.custom_blocked_useragents):void 0}hs(){U&&(U.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:U.title},{send_instantly:!0}),this.Gr&&(U.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),je(U,"visibilitychange",this.Gr)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,n,i,s,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(z.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",i=!1,s=z,o=(t="advanced_disable_flags")in(e=l)&&!ge(e[t]),a=n in e&&!ge(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):i)}cs(e){if(ge(this.config.before_send))return e;var t=_e(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ge(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return oT(e.event)?z.warn(s+". This can cause unexpected behavior."):z.info(s),null}n.properties&&!Ki(n.properties)||z.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Kr(e){var t=Fr(e)&&!e,n=$e.H()&&$e.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=$T(r.prototype[e[t]])})(Hc,["identify"]);var W0;var Xx=(W0=oa[Zi]=new Hc,(function(){function r(){r.done||(r.done=!0,Yx=!1,Ae(oa,(function(e){e._dom_loaded()})))}U!=null&&U.addEventListener?U.readyState==="complete"?r():je(U,"DOMContentLoaded",r,{capture:!1}):E&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),W0);var og=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,n=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0};e.cookieless_mode&&(o.cookieless_mode=e.cookieless_mode);let a=Xx.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],d=typeof c=="string"?c:c?.event,p=typeof c=="string"?void 0:c?.properties;typeof d=="string"&&this.captureCallback?.(d,p)}),t&&this.featureFlagsCallback&&this.client){this.client.onFeatureFlags(()=>{let c=this.getAllFeatureFlags();c&&this.featureFlagsCallback&&this.featureFlagsCallback(c)});let l=this.getAllFeatureFlags();l&&Object.keys(l).length>0&&this.featureFlagsCallback(l)}this.rrwebCallback&&this.client&&this.setupRRWebIntercept()}setupRRWebIntercept(e=30){let t=this.client?.sessionRecording;if(!t){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let n=null,i=t;for(let o of Object.getOwnPropertyNames(i)){let a=i[o];if(a&&typeof a=="object"&&typeof a.onRRwebEmit=="function"&&typeof a.start=="function"&&a!==t){n=a;break}}if(!n){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=n.onRRwebEmit.bind(n);n.onRRwebEmit=o=>{this.rrwebCallback?.({kind:"rrweb",...o}),s(o)},typeof window<"u"&&(window.__RRWEB_INTERCEPT_READY__=!0)}getAllFeatureFlags(){return this.client?.featureFlags?.getFlagVariants()}getSegmentFlags(){let e=this.getAllFeatureFlags();if(!e)return{};let t={};for(let[n,i]of Object.entries(e))n.startsWith("in_segment_")&&(t[n]=i===!0);return t}identify(e,t){this.client?.identify(e,t)}alias(e,t){this.client?.alias(e,t)}optInCapturing(){this.client?.opt_in_capturing()}optOutCapturing(){this.client?.opt_out_capturing()}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function ag(r={}){return new og(r)}var Jx={posthog:r=>ag(r),noop:()=>yh()};function Qx(r,e){let t=Jx[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Jx).join(", ")}`);return t(e)}async function ew(r){cd(),G("Syntro Bootstrap","====== INIT ======"),G("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Ll();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",yo()),console.log("[DIAG] editorConf:",Ol()),G("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let H=!!window.__SYNTRO_EDITOR_PARAMS__,Q=!!window.__SYNTRO_AUDIT_LEGEND__,re=!!window.__SYNTRO_REVIEW_DATA__;if(H||Q||re){let fe=[H&&"__SYNTRO_EDITOR_PARAMS__",Q&&"__SYNTRO_AUDIT_LEGEND__",re&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${fe.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let Q=Ol()?.syntro_token;Q?.startsWith("syn_")&&(t=Q,G("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))G("Syntro Bootstrap","Token starts with syn_, decoding..."),n=bo(t),cd(n.d);else if(e)G("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw gl("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),gl("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)G("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw gl("Syntro Bootstrap","\u274C No token provided and NOT in editor/audit/review mode!"),new Error("Syntro token is required (unless in editor, audit, or review mode)");let i=Pt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||Pt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=Pt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||Pt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th;if(n!=null&&n.obd!==!0&&s)try{let H=`${s.replace(/\/$/,"")}/sdk-otel/v1/logs`,Q=ud({resource:{serviceName:"syntro-runtime-sdk",serviceVersion:so,posthogKey:n.t??"",hostOrigin:typeof window<"u"?window.location.origin:""},emit:pd({endpoint:H})}),re=fd()??"https://cdn.syntrologie.com/runtime-sdk/",fe=Td(Q,{attributedScriptUrlPrefix:re});Q.attachAdapterCleanup(fe)}catch{}let o=Pt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||Pt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||Pt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||Pt("VITE_SYNTRO_GEO_HOST")||Tb,l=wb(),c=gp(),d=r.appSignalsInit??{},p=Cb(),h=mp(c,p);Ab(h);let f={...c,...h,...l,...d};G("Syntro Bootstrap","Phase 1: Browser metadata:",c),G("Syntro Bootstrap","Phase 1: Initial attrs:",h),G("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(d).length>0&&G("Syntro Bootstrap","Phase 1: App signals:",d);let v=vp(a),m=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(H=>{let Q=setTimeout(()=>{window.removeEventListener("message",re),H(null)},500);function re(fe){let Ce=fe.data;Ce?.jsonrpc==="2.0"&&Ce?.id===1&&Ce?.result?.hostInfo&&(clearTimeout(Q),window.removeEventListener("message",re),H(Ce.result.hostInfo))}window.addEventListener("message",re);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(Q),window.removeEventListener("message",re),H(null)}})})(),g,b=r.debug||r.testMode,x=_o({debug:r.debug,history:b?new xo(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let w=sd({elementResolver:typeof window<"u"?(H,Q)=>{let re=document.elementFromPoint(H,Q);if(!re)return null;let fe={tag_name:re.tagName.toLowerCase()};re.id&&(fe.attr__id=re.id),re.className&&typeof re.className=="string"&&(fe.classes=re.className.split(" ").filter(Boolean));for(let Ce of re.attributes)Ce.name.startsWith("data-")&&(fe[`attr__${Ce.name}`]=Ce.value);return fe}:void 0});w.onEvent(H=>x.publishEvent(H)),typeof window<"u"&&(setInterval(()=>w.tick(Date.now()),1e3),document.addEventListener("click",H=>{let Q=[],re=H.target;for(;re&&re!==document.body;){let fe={tag_name:re.tagName.toLowerCase()};for(let Ce of re.attributes)(Ce.name.startsWith("data-")||Ce.name==="id"||Ce.name==="class"||Ce.name==="aria-label")&&(fe[`attr__${Ce.name}`]=Ce.value);Q.push(fe),re=re.parentElement}w.enrichClickAttributes(Date.now(),Q)},!0));let y=$_(),S,T=H=>{G("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let Q=kb(H);if(G("Syntro Bootstrap","Segment flags from PostHog:",Q),Sb(Q),g){let re=C?.getAll?.()??{},fe={...c,...h,...re,...Q,...d};G("Syntro Bootstrap","Updating GrowthBook with attributes:",fe),g.setAttributes?.(fe)}if(S&&_?.getDistinctId){let re=_.getDistinctId();re&&s&&n?.t&&S.updateContext({distinctId:re,telemetryHost:s,telemetryKey:n.t})}},_;if(n?.t){let H=n.t==="noop"?"noop":"posthog";_=Qx(H,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,cookieless_mode:"on_reject",onFeatureFlagsLoaded:T,onCapture:(we,Ie)=>{w.ingest({kind:"posthog",event:we,properties:Ie,timestamp:Date.now()})},onRRWebEvent:we=>{w.ingest(we)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${H}) with EventBus wiring`),Object.keys(d).length>0&&(_.track?.("app_signals_init",d),G("Syntro Bootstrap","Tracked app signals event:",d));let Q=_;x.setPosthogCapture((we,Ie)=>{Q.track?.(we,Ie)});let re=_,fe=async()=>{let we=await v;return we.is_eu==="true"||we.country_code==="GB"||we.country_code==="CH"?"denied":"granted"},Ce=new Ho({initialStatus:"pending",pendingResolver:fe,onConsentChange:we=>{we==="granted"?re.optInCapturing?.():we==="denied"&&re.optOutCapturing?.()}});try{Fb(_,Ce,{geoPromise:v}),G("Syntro Bootstrap","SDK defaults installed (D-1..D-5) with consent gate")}catch(we){st("Syntro Bootstrap","installDefaults failed",we)}try{new Do({adapters:[new Fo,new No,new Lo],fallbackStatus:fe,onAdapterSelected:Ie=>{re.track?.("syntro_consent_adapter_selected",{adapter:Ie??"none"}),G("Syntro Bootstrap",`Consent adapter selected: ${Ie??"none"}`)}}).start(Ce).catch(Ie=>{st("Syntro Bootstrap","Consent detector failed to start",Ie)})}catch(we){st("Syntro Bootstrap","Consent detector setup failed",we)}try{S=Ib({telemetry:_,telemetryHost:s,telemetryKey:n.t,platformAdapter:y,debug:G,warn:st}).shopifyPixelBridge}catch(we){st("Syntro Bootstrap","wirePlatformAdapters failed",we)}}let C;n?.e&&(g=E_("growthbook",{clientKey:n.e,apiHost:i,attributes:f,onExperimentViewed:_?.trackExperiment?(H,Q,re)=>{_.trackExperiment(H,Q,re)}:void 0})),C=Kp({experiments:g,onMetricChange:(H,Q)=>{G("Syntro Bootstrap",`Session metric changed: ${H} = ${Q}`)}}),G("Syntro Bootstrap","SessionMetricTracker created");let R="production";e==="editor"?R="editor":e==="audit"?R="audit":Pt("NODE_ENV")==="development"&&(R="development");let N=typeof c.surface_type=="string"?c.surface_type:"web",$=typeof c.surface_host=="string"?c.surface_host:"web",F=gh({telemetry:_,sessionMetrics:C,mode:R,events:x,initialSurfaceType:N,initialSurfaceHost:$});G("Syntro Bootstrap","Runtime created:",{version:F.version,mode:F.mode,hasContext:!!F.context,hasEvents:!!F.events,hasState:!!F.state}),G("Syntro Bootstrap","Core app executors already registered");let V=r.cdnBase||Pt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||Pt("VITE_SYNTRO_CDN_BASE")||Mb()||"https://cdn.syntrologie.com",P=yu({cdnBase:V,registry:F.apps,onLoadStart:H=>{G("Syntro Bootstrap",`Loading app from CDN: ${H}`)},onLoadEnd:(H,Q,re)=>{Q?G("Syntro Bootstrap",`App loaded successfully: ${H}`):st("Syntro Bootstrap",`Failed to load app: ${H}`,re)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:F.apps,appLoader:P,runtime:F,version:F.version},G("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&P.loadApp("adaptive-mcp").catch(H=>{G("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",H)});let K=F.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${K.length} apps in registry:`,K.map(H=>`${H.manifest.id}(${H.state})`).join(", "));for(let H of K)if(H.state==="registered")try{await F.apps.activate(H.manifest.id),console.log(`[DIAG] Activated: ${H.manifest.id} \u2192 widgets: [${F.widgets.list().join(", ")}]`)}catch(Q){console.error(`[DIAG] FAILED to activate: ${H.manifest.id}`,Q),st("Syntro Bootstrap",`Failed to auto-activate built-in app: ${H.manifest.id}`,Q)}if(console.log(`[DIAG] Activation complete. Total widgets: [${F.widgets.list().join(", ")}]`),g?.refreshFeatures)try{await g.refreshFeatures(),G("Syntro Bootstrap","GrowthBook features loaded")}catch(H){st("Syntro Bootstrap","Failed to load GrowthBook features:",H)}let Y=await v;if(g&&Object.keys(Y).length>0){let H={...c,...h,...Y,...d};G("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",Y),g.setAttributes?.(H)}let le=await m;le&&g&&(c.surface_type="mcp-app",c.surface_host=le.name,g.setAttributes?.({...c,...h,...Y}),F.context.setSurfaceType("mcp-app"),F.context.setSurfaceHost(le.name),G("Syntro Bootstrap","MCP App detected:",le.name));let D;if(r.fetcher)D=r.fetcher;else if(n?.f){let H=R_(n.f,n.o??{});D=async()=>{let Q=await H.fetch();return{...Q.config,tiles:Q.config.tiles??[]}}}else g&&(D=Mi({experiments:g}));let te=new Set,Ze=D?async()=>{let H=await D(),Q=H.tiles?.length??0,re=H.actions?.length??0,fe=H.meta?.variant_id;if((Q>0||re>0)&&(fe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),_&&fe){let Ie=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,Ne=Ie?.interventionTracker,Zt;Ne&&Ne.variantId===fe?Zt=Ne:(Zt=new Bo(_,fe),Ie&&(Ie.interventionTracker=Zt),F.navigation.subscribe(()=>{Zt.resetPage()})),Zt.trackServed(Q,re)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${H.tiles?.length??0},`,`actions=${H.actions?.length??0},`,`theme=${H.theme?.name??"none"}`),H.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",H.actions.map((Ie,Ne)=>`[${Ne}] ${Ie.kind}${Ie.anchorId?` anchor="${Ie.anchorId.selector}"`:""}${Ie.label?` "${Ie.label}"`:""}`).join(", "));let Ce=H,we=P.getRequiredApps(Ce);return we.length>0?console.log("[Syntro Bootstrap] Required external apps:",we.join(", ")):G("Syntro Bootstrap","No external apps required (all executors are built-in)"),we.length>0&&await P.loadAppsForConfig(Ce).then(async Ne=>{let Zt=Ne.filter(Fe=>Fe.success),va=Ne.filter(Fe=>!Fe.success);Zt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${Zt.map(Fe=>Fe.appId).join(", ")}`);let fn=va.filter(Fe=>!te.has(Fe.appId));fn.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",fn.map(Fe=>`${Fe.appId} (${Fe.error})`).join(", ")),fn.forEach(Fe=>te.add(Fe.appId)));for(let Fe of we)if(F.apps.has(Fe))try{await F.apps.activate(Fe),console.log(`[Syntro Bootstrap] App activated: ${Fe}`)}catch(ya){console.error(`[Syntro Bootstrap] Failed to activate app: ${Fe}`,ya)}else console.error(`[Syntro Bootstrap] App "${Fe}" required by config but NOT registered.`,`Available apps: [${Array.from(F.apps.list?.()??[]).join(", ")}]`)}),H}:void 0;if(y){G("Syntro Bootstrap",`Detected platform: ${y.name}`);try{await y.onInit(),G("Syntro Bootstrap",`Platform adapter initialized: ${y.name}`)}catch(H){st("Syntro Bootstrap",`Platform adapter init failed: ${y.name}`,H)}}let at=await up({...r.canvas,fetcher:Ze,integrations:{experiments:g,telemetry:_},editorUrl:o,runtime:F});if(at.setOverrideFetcher){let H=at.setOverrideFetcher.bind(at);at.setOverrideFetcher=Q=>{H(async()=>{let fe=await Q(),Ce=fe;if(P.getRequiredApps(Ce).length>0){let Ie=await P.loadAppsForConfig(Ce);for(let Ne of Ie)if(Ne.success&&F.apps.has(Ne.appId))try{await F.apps.activate(Ne.appId)}catch{}}return fe})}}let Le=nr();if(Le!==null)try{let H=_,Q=F;Le.bindRuntime({getSessionId:()=>{try{return H?.getSessionId?.()??""}catch{return""}},getSurface:()=>{try{let re=Q.context.get().surface;return re?{...re}:null}catch{return null}}})}catch{}return Le?.increment("bootstrap_ok"),{canvas:at,runtime:F,experiments:g,telemetry:_,sessionMetrics:C,appLoader:P}}async function $R(r){try{return await ew(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),nr()?.increment("bootstrap_errors"),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function PR(r,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:r,source:"custom",props:e})}async function OR(r){if(typeof window>"u")return{appId:r,success:!1,error:"no-window"};let e=window.SynOS?.appLoader;return e?e.loadApp(r):{appId:r,success:!1,error:"syntro-not-initialized"}}var tw={init:$R,loadAdaptive:OR,encodeToken:pp,decodeToken:bo,events:{emit:PR}};typeof window<"u"&&(window.Syntro=tw);function ma(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function w3(r){let e=[],t=[];if(!r||typeof r!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let n=r;if(n.tiles||t.push("Config missing required field: tiles"),n.actions||t.push("Config missing required field: actions"),n.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=n.schemaVersion||"1.0",s=ma(i),o=ma(Kr);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Kr}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!n.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${Kr}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:LR(n,i)}):{valid:!0,warnings:e,errors:t}}function LR(r,e){let t={...r};return ma(e).major===1&&(t=NR(t)),t.schemaVersion=Kr,t}function NR(r){let e={schemaVersion:"2.0",tiles:[],actions:r.actions||[],fetchedAt:r.fetchedAt||new Date().toISOString()};return r.tiles&&Array.isArray(r.tiles)&&(e.tiles=r.tiles.map(t=>{let n={...t};return t.experiment&&delete n.experiment,n})),r.configVersion&&(e.configVersion=r.configVersion),r.canvasTitle&&(e.canvasTitle=r.canvasTitle),r.theme&&(e.theme=r.theme),r.launcher&&(e.launcher=r.launcher),e}function S3(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=ma(t),i=ma(Kr);return n.major<i.major||!e.schemaVersion}var FR=u.object({url:u.string(),routeId:u.string().optional(),title:u.string().optional(),locale:u.string().optional()}),DR=u.object({url:u.string(),ts:u.number()}),HR=u.object({sessionId:u.string(),startTs:u.number(),pageHistory:u.array(DR).optional()}),BR=u.object({width:u.number(),height:u.number()}),VR=u.object({x:u.number(),y:u.number(),w:u.number(),h:u.number()}),UR=u.object({anchorId:u.string(),present:u.boolean(),visible:u.boolean().optional(),boundingBox:VR.optional()}),jR=u.record(u.string(),u.union([u.number(),u.string(),u.boolean(),u.undefined()])),WR=u.object({page:FR,session:HR,viewport:BR,anchors:u.array(UR).optional(),augmented:jR.optional()});function C3(r){return WR.safeParse(r)}var lg=class{constructor(e,t,n,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=n,this._defaultValue=i,this._value=i,e.addController(this)}get value(){return this._value}get isFallback(){return this._isFallback}get isLoading(){return this._isLoading}hostConnected(){this._evaluate()}hostDisconnected(){this._cancelled=!0}setStrategy(e){this._strategy=e,this._evaluate()}_evaluate(){if(this._cancelled=!1,!this._runtime||!this._strategy){this._value=this._defaultValue,this._isFallback=!0,this._isLoading=!1,this._host.requestUpdate();return}this._isLoading=!0,this._host.requestUpdate();let e=this._strategy;this._runtime.evaluate(e).then(t=>{this._cancelled||(this._value=t.value,this._isFallback=t.isFallback,this._isLoading=!1,this._host.requestUpdate())})}};var cg=class{constructor(e,t){this._unsubscribe=null;this.host=e,this._runtime=t,this._context=t.context.get(),e.addController(this)}hostConnected(){this._context=this._runtime.context.get(),this._unsubscribe=this._runtime.context.subscribe(e=>{this._context=e,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}get runtime(){return this._runtime}get context(){return this._context}get page(){return this._context?.page??null}get session(){return this._context?.session??null}get viewport(){return this._context?.viewport??null}};var ug=class{constructor(e,t,n,i){this._runtime=t,this._filter=n,this._callback=i,e.addController(this)}hostConnected(){this._subscribe()}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0}setFilter(e){this._filter=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}setCallback(e){this._callback=e,this._unsubscribe!==void 0&&(this._unsubscribe(),this._unsubscribe=void 0,this._subscribe())}_subscribe(){this._runtime&&(this._unsubscribe=this._filter?this._runtime.events.subscribe(this._filter,this._callback):this._runtime.events.subscribe(this._callback))}};var rw=u.enum(["posthog","canvas","derived"]),zR=u.object({ts:u.number(),name:u.string(),source:rw,props:u.record(u.string(),u.unknown()).optional(),schemaVersion:u.string()}),qR=u.object({names:u.array(u.string()).optional(),patterns:u.array(u.string()).optional(),sources:u.array(rw).optional()});function Y3(r){return zR.safeParse(r)}function X3(r){return qR.safeParse(r)}var nw=u.union([u.object({type:u.literal("data"),key:u.string(),value:u.string().optional()}),u.object({type:u.literal("css"),value:u.string()}),u.object({type:u.literal("aria"),role:u.string().optional(),label:u.string().optional()}),u.object({type:u.literal("shadow-css"),value:u.string()}),u.object({type:u.literal("ref"),el:u.any()})]),ZR=u.object({kind:u.literal("tooltip"),id:u.string(),anchor:nw,content:u.object({title:u.string().optional(),body:u.string()}),placement:u.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:u.number().optional(),blocking:u.boolean().optional(),trigger:u.enum(["immediate","hover","click"]).optional(),dismiss:u.object({onEsc:u.boolean().optional(),closeButton:u.boolean().optional(),timeoutMs:u.number().optional()}).optional()}),GR=u.object({kind:u.literal("highlight"),id:u.string(),anchor:nw,copy:u.string().optional(),ring:u.object({paddingPx:u.number().optional(),radiusPx:u.number().optional()}).optional(),scrim:u.object({opacity:u.number().optional()}).optional(),ringColor:u.string().optional(),blocking:u.boolean().optional(),dismiss:u.object({onClickOutside:u.boolean().optional(),onEsc:u.boolean().optional(),timeoutMs:u.number().optional()}).optional()}),dg=u.object({id:u.string(),version:u.number(),routes:u.array(u.string()).optional(),steps:u.array(u.union([ZR,GR]))});function pH(r){return dg.parse(r)}var mH=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Rd({configUri:r,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:n});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return dg.parse(o)};var KR=u.object({value:u.unknown(),expiresAt:u.number().optional()}),YR=u.object({count:u.number(),resetAt:u.number().optional()});function bH(r){return KR.safeParse(r)}function _H(r){return YR.safeParse(r)}var iw="2026-05-21T14:24:50.777Z (aaeef28e37b5)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${iw} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Cs;window.SynOS={...r,appRegistry:e,_runtimeBuild:iw,_renderer:"lit"},El(),Pv(e)}export{Oo as ANIMATION_KEYFRAMES,$l as ActivationConfigZ,Ky as AddClassZ,$t as AnchorIdZ,UR as AnchorStateZ,qu as AnchorVisibleConditionZ,Es as AppRegistry,jR as AugmentationZ,Dy as BadgePositionZ,tb as BadgeZ,VR as BoundingBoxZ,to as CanvasEvents,dg as CanvasRecipeZ,Gr as ConditionZ,sc as ContextManager,Ju as CooldownActiveConditionZ,Ws as CounterDefZ,op as CtaButtonZ,od as DEFAULT_COOLDOWN,lg as DecisionController,Ys as DecisionStrategyZ,Xu as DismissedConditionZ,De as EVENT_SCHEMA_VERSION,Bl as EventBus,ed as EventCountConditionZ,qR as EventFilterZ,xo as EventHistory,Zu as EventOccurredConditionZ,rw as EventSourceZ,Tl as ExecutorRegistry,Ks as ExternalStrategyZ,YR as FrequencyEntryZ,Qu as FrequencyLimitConditionZ,GR as HighlightStepZ,Fy as HighlightStyleZ,Qy as HighlightZ,Jy as InsertHtmlZ,Uy as InsertPositionZ,Bo as InterventionTracker,dl as MAX_VISIBLE_TOASTS,tl as MOUNT_PLUMBING_KEYS,js as MatchOpZ,Vy as ModalContentZ,nb as ModalZ,Gs as ModelStrategyZ,ob as MountWidgetZ,sb as NavigateZ,Io as NavigationMonitor,zR as NormalizedEventZ,eo as NotificationsController,FR as PageContextZ,DR as PageHistoryEntryZ,Wu as PageUrlConditionZ,cb as ParallelZ,Hy as PlacementZ,eb as PulseZ,iw as RUNTIME_SDK_BUILD,Z_ as RUNTIME_VERSION,Yy as RemoveClassZ,zu as RouteConditionZ,Ly as RouteFilterZ,qs as RuleStrategyZ,zs as RuleZ,WR as RuntimeContextZ,cg as RuntimeController,ug as RuntimeEventsController,Kr as SDK_SCHEMA_VERSION,so as SDK_VERSION,j_ as STATIC_SLOT_STYLES,Zs as ScoreStrategyZ,qy as ScrollBehaviorZ,sp as ScrollLogicalPositionZ,ib as ScrollToZ,nw as SelectorZ,lb as SequenceZ,HR as SessionContextZ,Yu as SessionMetricConditionZ,ic as SessionMetricTracker,Gy as SetAttrZ,Xy as SetStyleZ,Zy as SetTextZ,Id as SmartCanvasController,Pi as SmartCanvasElementLit,Ke as StandardEvents,Gu as StateEqualsConditionZ,lc as StateStore,KR as StoredValueZ,tw as Syntro,co as ThemeController,By as TooltipContentZ,ZR as TooltipStepZ,jy as TooltipTriggerZ,rb as TooltipZ,zy as TourStepForSchemaZ,ub as TourZ,rl as TriggerWhenZ,Ku as ViewportConditionZ,BR as ViewportContextZ,ab as WaitZ,Wy as WidgetConfigZ,uc as WidgetRegistry,sh as applyStaticSlotStyles,mA as coreActionStepSchemas,np as createActionEngine,ap as createAnchorResolver,Mi as createCanvasConfigFetcher,Jp as createContextManager,Qp as createDecisionEngine,eh as createEventAccumulator,_o as createEventBus,qp as createGrowthBookClient,yh as createNoopClient,mH as createOverlayRecipeFetcher,ag as createPostHogClient,Wv as createPostHogNormalizer,Kp as createSessionMetricTracker,up as createSmartCanvas,gy as createSmartCanvasController,gh as createSmartCanvasRuntime,ih as createStateStore,uh as createSurfaceContainer,ph as createSurfaces,A5 as decisionSchemas,bo as decodeToken,pp as encodeToken,D_ as evaluate,L_ as evaluateCondition,N_ as evaluateRule,oc as evaluateRuleStrategy,ac as evaluateScoreStrategy,H_ as evaluateSync,Ar as executorRegistry,vA as getAntiFlickerSnippet,rA as getExecutor,cc as getSlotAnchorId,Po as getSlotType,dh as getSlotZIndex,Vd as hasExecutor,S3 as needsMigration,Js as normalizePostHogEvent,ma as parseVersion,lh as playEnterAnimation,ch as playExitAnimation,$i as registerConfigPredicates,El as registerSmartCanvasElement,Rd as resolveConfigUri,XC as runtimeContext,oh as setupAdjacentPositioning,ah as setupInlinePositioning,Qs as shouldNormalizeEvent,ju as stripMountPlumbing,lr as validateAction,Ml as validateActions,C5 as validateActivationConfig,k5 as validateCondition,w3 as validateConfig,X3 as validateEventFilter,Cp as validateEventName,_H as validateFrequencyEntry,Y3 as validateNormalizedEvent,Ap as validateProps,pH as validateRecipe,C3 as validateRuntimeContext,bH as validateStoredValue,E5 as validateStrategy,hh as widgetRegistry};
1078
1078
  /*! Bundled license information:
1079
1079
 
1080
1080
  @lit/reactive-element/css-tag.js: