@syntrologie/runtime-sdk 2.8.0-canary.152 → 2.8.0-canary.154

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.
@@ -1,4 +1,4 @@
1
- var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnPropertyDescriptor;var p0=Object.getOwnPropertyNames;var h0=Object.prototype.hasOwnProperty;var Af=r=>{throw TypeError(r)};var f0=(r,e,t)=>e in r?No(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Rf=(r,e)=>{for(var t in e)No(r,t,{get:e[t],enumerable:!0})},g0=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p0(e))!h0.call(r,i)&&i!==t&&No(r,i,{get:()=>e[i],enumerable:!(n=d0(e,i))||n.enumerable});return r};var m0=r=>g0(No({},"__esModule",{value:!0}),r);var me=(r,e,t)=>f0(r,typeof e!="symbol"?e+"":e,t),Hc=(r,e,t)=>e.has(r)||Af("Cannot "+t);var U=(r,e,t)=>(Hc(r,e,"read from private field"),t?t.call(r):e.get(r)),ge=(r,e,t)=>e.has(r)?Af("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ne=(r,e,t,n)=>(Hc(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),ye=(r,e,t)=>(Hc(r,e,"access private method"),t);var Bc=(r,e,t,n)=>({set _(i){ne(r,e,i,t)},get _(){return U(r,e,n)}});var yA={};Rf(yA,{ANIMATION_KEYFRAMES:()=>Oi,ActivationConfigZ:()=>Bs,AddClassZ:()=>Id,AnchorIdZ:()=>ct,AnchorStateZ:()=>t0,AnchorVisibleConditionZ:()=>wa,AppRegistry:()=>Kn,AugmentationZ:()=>r0,BadgePositionZ:()=>_d,BadgeZ:()=>Ld,BoundingBoxZ:()=>e0,CanvasEvents:()=>mi,CanvasRecipeZ:()=>Nc,ConditionZ:()=>nr,ContextManager:()=>Xs,CooldownActiveConditionZ:()=>Ra,CounterDefZ:()=>si,CtaButtonZ:()=>ol,DEFAULT_COOLDOWN:()=>Va,DecisionController:()=>Mc,DecisionStrategyZ:()=>di,DismissedConditionZ:()=>Aa,EVENT_SCHEMA_VERSION:()=>Te,EventBus:()=>Ws,EventCountConditionZ:()=>Ia,EventFilterZ:()=>s0,EventHistory:()=>ki,EventOccurredConditionZ:()=>ka,EventSourceZ:()=>bf,ExecutorRegistry:()=>Ds,ExternalStrategyZ:()=>ui,FrequencyEntryZ:()=>c0,FrequencyLimitConditionZ:()=>Ta,HighlightStepZ:()=>a0,HighlightStyleZ:()=>yd,HighlightZ:()=>Pd,InsertHtmlZ:()=>Od,InsertPositionZ:()=>kd,InterventionTracker:()=>Pi,MAX_VISIBLE_TOASTS:()=>Ba,MatchOpZ:()=>ii,ModalContentZ:()=>wd,ModalZ:()=>Dd,ModelStrategyZ:()=>ci,MountWidgetZ:()=>Vd,NavigateZ:()=>Bd,NavigationMonitor:()=>$i,NormalizedEventZ:()=>i0,NotificationsController:()=>gi,PageContextZ:()=>Yb,PageHistoryEntryZ:()=>Xb,PageUrlConditionZ:()=>ba,ParallelZ:()=>Ud,PlacementZ:()=>bd,PulseZ:()=>Nd,RUNTIME_SDK_BUILD:()=>wf,RUNTIME_VERSION:()=>Tp,RemoveClassZ:()=>$d,RouteConditionZ:()=>xa,RouteFilterZ:()=>md,RuleStrategyZ:()=>ai,RuleZ:()=>oi,RuntimeContextZ:()=>n0,RuntimeController:()=>Oc,RuntimeEventsController:()=>Pc,SDK_SCHEMA_VERSION:()=>ir,SDK_VERSION:()=>Ga,STATIC_SLOT_STYLES:()=>Ap,ScoreStrategyZ:()=>li,ScrollBehaviorZ:()=>Ad,ScrollLogicalPositionZ:()=>sl,ScrollToZ:()=>Hd,SelectorZ:()=>xf,SequenceZ:()=>Wd,SessionContextZ:()=>Jb,SessionMetricConditionZ:()=>Ca,SessionMetricTracker:()=>Ys,SetAttrZ:()=>Td,SetStyleZ:()=>Md,SetTextZ:()=>Rd,SmartCanvasController:()=>Ya,SmartCanvasElementLit:()=>Cn,StandardEvents:()=>He,StateEqualsConditionZ:()=>Sa,StateStore:()=>ro,StoredValueZ:()=>l0,Syntro:()=>_f,ThemeController:()=>vi,TooltipContentZ:()=>xd,TooltipStepZ:()=>o0,TooltipTriggerZ:()=>Sd,TooltipZ:()=>Fd,TourStepForSchemaZ:()=>Cd,TourZ:()=>zd,TriggerWhenZ:()=>As,ViewportConditionZ:()=>Ea,ViewportContextZ:()=>Qb,WaitZ:()=>jd,WidgetConfigZ:()=>Ed,WidgetRegistry:()=>io,applyStaticSlotStyles:()=>jl,coreActionStepSchemas:()=>Cv,createActionEngine:()=>il,createAnchorResolver:()=>al,createCanvasConfigFetcher:()=>wn,createContextManager:()=>Dl,createDecisionEngine:()=>Hl,createEventAccumulator:()=>Bl,createEventBus:()=>wi,createGrowthBookClient:()=>Ol,createNoopClient:()=>Jl,createOverlayRecipeFetcher:()=>gA,createPostHogClient:()=>$c,createPostHogNormalizer:()=>Bu,createSessionMetricTracker:()=>Pl,createSmartCanvas:()=>dl,createSmartCanvasController:()=>zu,createSmartCanvasRuntime:()=>Xl,createStateStore:()=>Vl,createSurfaceContainer:()=>Zl,createSurfaces:()=>Kl,decisionSchemas:()=>GS,decodeToken:()=>xi,encodeToken:()=>pl,evaluate:()=>wp,evaluateCondition:()=>bp,evaluateRule:()=>xp,evaluateRuleStrategy:()=>Js,evaluateScoreStrategy:()=>Qs,evaluateSync:()=>kp,executorRegistry:()=>Wt,getAntiFlickerSnippet:()=>Tv,getExecutor:()=>Ev,getSlotAnchorId:()=>no,getSlotType:()=>Mi,getSlotZIndex:()=>Gl,hasExecutor:()=>tl,needsMigration:()=>uA,normalizePostHogEvent:()=>hi,parseVersion:()=>Ki,playEnterAnimation:()=>zl,playExitAnimation:()=>ql,registerConfigPredicates:()=>En,registerSmartCanvasElement:()=>Ns,resolveConfigUri:()=>Ka,runtimeContext:()=>gv,setupAdjacentPositioning:()=>Wl,setupInlinePositioning:()=>Ul,shouldNormalizeEvent:()=>fi,validateAction:()=>Nt,validateActions:()=>Hs,validateActivationConfig:()=>ZS,validateCondition:()=>zS,validateConfig:()=>aA,validateEventFilter:()=>hA,validateEventName:()=>hl,validateFrequencyEntry:()=>vA,validateNormalizedEvent:()=>pA,validateProps:()=>fl,validateRecipe:()=>fA,validateRuntimeContext:()=>dA,validateStoredValue:()=>mA,validateStrategy:()=>qS,widgetRegistry:()=>Yl});function Tf(r,e,t,n){let i=n?.maxRetries??3,s=n?.debounceMs??50,o=r.parentElement??e.parentElement;if(!o)return()=>{};let a=0,l=null,c=!1,u=new MutationObserver(p=>{if(!c){for(let h of p)for(let f of h.removedNodes)if(f===r){if(a>=i){u.disconnect(),c=!0;return}l&&clearTimeout(l),l=setTimeout(()=>{if(!c){if(!e.isConnected){u.disconnect(),c=!0;return}a++;try{t()}catch{u.disconnect(),c=!0}}},s);return}}});return u.observe(o,{childList:!0,subtree:!0}),()=>{c=!0,u.disconnect(),l&&clearTimeout(l)}}var v0=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function Vc(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=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!v0.has(l)){s.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),p=c.value.trim().toLowerCase(),h=u.startsWith("on"),v=(u==="href"||u==="src"||u==="formaction")&&(p.startsWith("javascript:")||p.startsWith("vbscript:")||p.startsWith("data:text/html"));(h||v)&&a.removeAttribute(c.name)}}let o=Array.from(n.querySelectorAll("svg"));for(let a of o)s.some(l=>a.contains(l)&&l.tagName.toLowerCase()==="script")&&s.push(a);for(let a of s){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML}var If=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=Vc(r.html),i="data-syntro-insert-label",s=r.label;if(s){let p=CSS.escape(s),f=(t.parentElement??t).querySelector(`[${i}="${p}"]`);f&&f.remove()}let o=document.createElement("div");o.setAttribute("data-syntro-action-id",e.generateId()),s&&o.setAttribute(i,s),o.innerHTML=n;let a=null;switch(r.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":a=t.innerHTML,t.replaceWith(o);break}let l=null;if(r.deepLink){let{tileId:p,itemId:h}=r.deepLink;l=()=>{let f=window.SynOS?.handle;f&&(f.open(),f.runtime?.events?.publish("notification.deep_link",{tileId:p,itemId:h}))},o.style.cursor="pointer",o.addEventListener("click",l)}e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:r.anchorId,position:r.position});let u=Tf(o,t,()=>{switch(r.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":break}});return{cleanup:()=>{if(l&&o.removeEventListener("click",l),u(),!!o.isConnected)try{if(r.position==="replace"&&a!==null){let p=document.createElement(t.tagName);p.innerHTML=a,Array.from(t.attributes).forEach(h=>{p.setAttribute(h.name,h.value)}),o.replaceWith(p)}else o.remove()}catch{}},updateFn:p=>{"html"in p&&typeof p.html=="string"&&(o.innerHTML=Vc(p.html))}}};function $f(r){if(r.children.length===0)return r;let e=Array.from(r.children).filter(t=>t.textContent?.trim());if(e.length===1){let t=e[0];if(t.textContent?.trim()===r.textContent?.trim())return $f(t)}return r}var Mf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=$f(t),i=n.textContent??"";return n.textContent=r.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:r.anchorId}),{cleanup:()=>{t.isConnected&&(n.textContent=i)},updateFn:s=>{"text"in s&&typeof s.text=="string"&&(n.textContent=s.text)}}},Of=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=r.attr.toLowerCase();if(n.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${r.attr}`);if(n==="href"||n==="src"||n==="formaction"){let a=r.value.trim().toLowerCase();if(a.startsWith("javascript:")||a.startsWith("vbscript:")||a.startsWith("data:text/html"))throw new Error(`Dangerous URL not allowed in ${r.attr}: ${r.value}`)}let s=t.getAttribute(r.attr),o=t.hasAttribute(r.attr);return t.setAttribute(r.attr,r.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:r.anchorId,attr:r.attr}),{cleanup:()=>{t.isConnected&&(o&&s!==null?t.setAttribute(r.attr,s):t.removeAttribute(r.attr))},updateFn:a=>{"value"in a&&typeof a.value=="string"&&t.setAttribute(r.attr,a.value)}}},Pf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=t.classList.contains(r.className);return t.classList.add(r.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:r.anchorId,className:r.className}),{cleanup:()=>{t.isConnected&&(n||t.classList.remove(r.className))}}},Nf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=t.classList.contains(r.className);return t.classList.remove(r.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:r.anchorId,className:r.className}),{cleanup:()=>{t.isConnected&&n&&t.classList.add(r.className)}}},Lf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=new Map;for(let i of Object.keys(r.styles)){let s=t.style.getPropertyValue(i);n.set(i,s)}for(let[i,s]of Object.entries(r.styles))t.style.setProperty(i,s);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:r.anchorId,styles:Object.keys(r.styles)}),{cleanup:()=>{if(t.isConnected)for(let[i,s]of n)s?t.style.setProperty(i,s):t.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[s,o]of Object.entries(i.styles))t.style.setProperty(s,o)}}},jc=[{kind:"content:insertHtml",executor:If},{kind:"content:setText",executor:Mf},{kind:"content:setAttr",executor:Of},{kind:"content:addClass",executor:Pf},{kind:"content:removeClass",executor:Nf},{kind:"content:setStyle",executor:Lf}],Wc={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:jc};var y0={light:50,medium:100,heavy:200},_0=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Ff={init(r,e,t){let n=y0[t.intensity],i=t.colors.length>0?t.colors:_0,s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(r,e,t){let n=!1;for(let i of r)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(n=!0);return n},render(r,e){for(let t of e)t.opacity<.01||(r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.translate(t.x,t.y),r.rotate(t.rotation),t.shape==="circle"?(r.beginPath(),r.arc(0,0,t.size/2,0,Math.PI*2),r.fill()):r.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),r.restore())}};var b0={light:20,medium:40,heavy:80},x0="\u{1F389}",Df={init(r,e,t){let n=b0[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:x0,s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(r,e,t){let n=!1;for(let i of r){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(n=!0)}return n},render(r,e){for(let t of e)t.opacity<.01||!t.emoji||(r.save(),r.globalAlpha=t.opacity,r.font=`${t.size}px serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(t.emoji,t.x,t.y),r.restore())}};var w0={light:20,medium:40,heavy:80},k0={light:3,medium:4,heavy:5},Hf={init(r,e,t){let n=w0[t.intensity],i=k0[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*r*.8+r*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let p=0;p<n;p++){let h=Math.PI*2*p/n+(Math.random()-.5)*.3,f=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*f,vy:Math.sin(h)*f,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(r,e,t){let n=!1;for(let i of r)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(n=!0);return n},render(r,e){for(let t of e)t.opacity<.01||(r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.shadowBlur=12,r.shadowColor=t.color,r.beginPath(),r.arc(t.x,t.y,t.size,0,Math.PI*2),r.fill(),r.restore())}};var S0={light:30,medium:60,heavy:120},Bf={init(r,e,t){let n=S0[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(r,e,t){let n=!1;for(let i of r){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(n=!0)}return n},render(r,e){for(let t of e){if(t.opacity<.01)continue;r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.translate(t.x,t.y),r.rotate(t.rotation);let n=t.size;r.beginPath(),r.moveTo(0,-n),r.lineTo(n*.3,-n*.3),r.lineTo(n,0),r.lineTo(n*.3,n*.3),r.lineTo(0,n),r.lineTo(-n*.3,n*.3),r.lineTo(-n,0),r.lineTo(-n*.3,-n*.3),r.closePath(),r.fill(),r.restore()}}};var Lo=class{constructor(){this.canvas=null,this.ctx=null,this.rafId=null,this.particles=[],this.startTime=0,this.lastFrame=0,this.duration=0,this.effect=null,this.container=null}start(e,t,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=n.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,n),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,n=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,n,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var E0=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function C0(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function A0(r){try{let e=getComputedStyle(r),t=e.getPropertyValue("--sc-color-primary")?.trim(),n=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return C0(t,n||t)}catch{}return null}var Vf=new Map([["confetti",Ff],["fireworks",Hf],["sparkles",Bf],["emoji-rain",Df]]),jf=async(r,e)=>{let t=Vf.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...Vf.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??A0(e.overlayRoot)??E0,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new Lo;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}};var zc="syntro_active_tour",Fo=new Map;function R0(r){try{let e=localStorage.getItem(zc);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Uc(r){try{localStorage.setItem(zc,JSON.stringify(r))}catch{}}function T0(){try{localStorage.removeItem(zc)}catch{}}function Xi(){return window.location.pathname}function I0(r){if(!r.route)return!0;let e=Xi();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var qc=async(r,e)=>{let{tourId:t,steps:n,startStep:i,autoStart:s=!0}=r;if(n.length===0)throw new Error(`Tour "${t}" has no steps`);if(Fo.has(t))return{cleanup:async()=>{let k=Fo.get(t);k&&await k.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=R0(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Uc(o));let l=n.findIndex(k=>k.id===o.currentStepId);if(l===-1){let k=i||n[0].id;l=n.findIndex(_=>_.id===k),l===-1&&(l=0),o.currentStepId=n[l].id,Uc(o)}let c=n[l];if(!I0(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Xi()}),{cleanup:()=>{}};let u=!1,p=null,h=null,f=null,v=async()=>{h&&(h(),h=null),p?.isApplied()&&(await p.revert(),p=null)},m=async k=>{if(u)return;if(await v(),k==="end"){T0(),e.publishEvent("tour.completed",{tourId:t,totalSteps:n.length}),u=!0;return}let _=n.find(w=>w.id===k);if(!_){console.error(`[Tour] Step "${k}" not found`);return}if(o.currentStepId=k,Uc(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:k}),_.route&&_.route!==Xi()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:k,targetRoute:_.route});return}await g(_)},g=async k=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:k.id,stepIndex:n.findIndex(_=>_.id===k.id),totalSteps:n.length});try{p=await e.applyAction(k.action)}catch(_){console.error(`[Tour] Failed to execute step "${k.id}":`,_),e.publishEvent("tour.step_failed",{tourId:t,stepId:k.id,error:String(_)});return}if(k.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",R=>{let b=R?.actionId;if(b&&k.onAction){let A=k.onAction[b];A&&m(A)}});let _=e.subscribeEvent("action.tooltip_cta_clicked",R=>{let b=R?.actionId;if(b&&k.onAction){let A=k.onAction[b];A&&m(A)}}),w=h;h=()=>{w(),_()}}}};f=(()=>{let k=Xi(),_=()=>{let b=Xi();b!==k&&(k=b,e.publishEvent("tour.route_changed",{tourId:t,newRoute:b}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>_());window.addEventListener("popstate",_);let w=history.pushState.bind(history),R=history.replaceState.bind(history);return history.pushState=(...b)=>{w(...b),queueMicrotask(_)},history.replaceState=(...b)=>{R(...b),queueMicrotask(_)},()=>{window.removeEventListener("popstate",_),history.pushState=w,history.replaceState=R}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:n.length,startStepId:o.currentStepId}),await g(c);let x=async()=>{u=!0,Fo.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Fo.set(t,{cleanup:x}),{cleanup:x}};var Et={white:"#ffffff",black:"#000000"},te={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},S={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"},_e={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},je={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Re={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},ot={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Ji={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},ht={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Qi={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var at={primary:S[10],secondary:S[9],tertiary:S[8]},FA={primary:S[2],secondary:S[0]},Zc={primary:S[4],secondary:S[3]},Do={primary:{text:Et.white,icon:Et.white,border:te[3],backgroundDefault:te[3],backgroundHover:te[2]},neutral:{text:S[10],textHover:Et.white,icon:S[10],iconHover:Et.white,border:S[4],background:S[2]},link:{text:Et.white,icon:Et.white,hover:te[5]},error:{text:Re[5],hover:Re[6]},success:{text:_e[5],hover:_e[6]}},DA={slateGrey:{content:S[10],pillOutline:S[10],borderPrimary:S[5],borderSecondary:S[5],background:S[3]},brand:{content:te[9],pillOutline:te[9],borderPrimary:te[6],borderSecondary:te[6],background:te[0]},red:{content:Re[8],pillOutline:Re[4],borderPrimary:Re[2],borderSecondary:Re[2],background:Re[0]},yellow:{content:je[8],pillOutline:je[4],borderPrimary:je[2],borderSecondary:je[2],background:je[0]},green:{content:_e[8],pillOutline:_e[4],borderPrimary:_e[2],borderSecondary:_e[2],background:_e[0]},purple:{content:ht[8],pillOutline:ht[4],borderPrimary:ht[2],borderSecondary:ht[2],background:ht[0]},blue:{content:ot[8],pillOutline:ot[4],borderPrimary:ot[2],borderSecondary:ot[2],background:ot[0]},orange:{content:Ji[8],pillOutline:Ji[4],borderPrimary:Ji[2],borderSecondary:Ji[2],background:Ji[0]},pink:{content:Qi[8],pillOutline:Qi[4],borderPrimary:Qi[2],borderSecondary:Qi[2],background:Qi[0]}},HA={green:{content:_e[8],border:_e[2],background:_e[0]},yellow:{content:je[8],border:je[2],background:je[0]},red:{content:Re[8],border:Re[2],background:Re[0]}},BA={green:{content:_e[1],background:_e[9]},yellow:{content:je[1],background:je[9]},red:{content:Re[1],background:Re[9]}},VA={content:S[10],border:S[4],background:S[3]},jA={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},WA={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:te[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},UA={backgroundDefault:S[2],backgroundDisabled:S[0],textLabel:S[9],textPlaceholder:S[8],textHint:S[8],textError:Re[5],iconDefault:S[9],iconPlaceholder:S[10],iconError:Re[5],borderDefault:S[4],borderSelected:te[3],borderError:Re[5]},zA={handleDefault:Et.white,handleDisabled:S[10],off:{backgroundDefault:S[4],backgroundHover:S[5],backgroundDisabled:S[4]},on:{backgroundDefault:_e[3],backgroundHover:_e[2],backgroundDisabled:S[4]}},qA={off:{backgroundDefault:"#00000000",backgroundHover:S[5],backgroundDisabled:S[2],border:S[6]},on:{backgroundDefault:_e[0],backgroundHover:_e[1],backgroundDisabled:S[2],border:_e[3]}},ZA={content:S[10],background:S[4]},GA={background:S[4],active:_e[3]},KA={background:S[1],content:S[9],border:S[4]},YA={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},XA={background:S[1],content:S[9],border:S[4]},JA={activeBackground:S[3],activeContent:te[5],inactiveContent:S[9],border:S[4]},QA={header:{textDefault:S[9],textHover:S[8],backgroundDefault:S[1]},border:S[4],cell:{textPrimary:S[10],textSecondary:S[9],backgroundDefault:S[2],backgroundHover:S[1]}},eR={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},tR={background:_e[1],active:_e[5]},rR={textDefault:S[10],textSelected:Et.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:te[3],border:S[4]},nR=S[9];var aR={size:56,inset:12,background:Et.black,color:Et.white,border:`2px solid ${te[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)"};var Wf=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Uf(r,e,t){let n=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${ot[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),p=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),f=document.createElement("div");f.className="syntro-spotlight-scrim";let v=a||l;Object.assign(f.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:p||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(f),requestAnimationFrame(()=>f.style.opacity="1");let m=document.createElement("div");m.className="syntro-spotlight-ring",Object.assign(m.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||ot[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(m);let g=[];if(!Wf)for(let $=0;$<4;$++){let N=document.createElement("div");N.style.position="fixed",N.style.background="inherit",g.push(N),f.appendChild(N)}let y=$=>{f.style.clipPath=$,f.style.webkitClipPath=$},x=()=>{if(!r.isConnected){A.destroy();return}let $=r.getBoundingClientRect(),N=$.left-n,M=$.top-n,K=$.width+n*2,L=$.height+n*2;if(Object.assign(m.style,{left:`${N}px`,top:`${M}px`,width:`${K}px`,height:`${L}px`}),Wf){let O=window.innerWidth,q=window.innerHeight,Y=Math.min(i,K/2,L/2),se=`M 0 0 L ${O} 0 L ${O} ${q} L 0 ${q} Z`,C=`M ${N+Y} ${M} A ${Y} ${Y} 0 0 0 ${N} ${M+Y} L ${N} ${M+L-Y} A ${Y} ${Y} 0 0 0 ${N+Y} ${M+L} L ${N+K-Y} ${M+L} A ${Y} ${Y} 0 0 0 ${N+K} ${M+L-Y} L ${N+K} ${M+Y} A ${Y} ${Y} 0 0 0 ${N+K-Y} ${M} L ${N+Y} ${M} Z`;y(`path('${se} ${C}')`)}else{let[O,q,Y,se]=g;Object.assign(O.style,{left:"0px",top:"0px",width:"100vw",height:`${M}px`}),Object.assign(Y.style,{left:"0px",top:`${M+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(M+L))}px`}),Object.assign(se.style,{left:"0px",top:`${M}px`,width:`${N}px`,height:`${L}px`}),Object.assign(q.style,{left:`${N+K}px`,top:`${M}px`,width:`${Math.max(0,window.innerWidth-(N+K))}px`,height:`${L}px`})}},k=new ResizeObserver(()=>requestAnimationFrame(x));k.observe(r);let _=()=>requestAnimationFrame(x),w=()=>requestAnimationFrame(x);window.addEventListener("scroll",_,!0),window.addEventListener("resize",w);let R=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),A.destroy())};c&&window.addEventListener("keydown",R);let b=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),A.destroy())};f.addEventListener("click",b);let A={destroy(){k.disconnect(),window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",R),f.removeEventListener("click",b),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{m.remove()}catch{}},220)}};return x(),A}var $0=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function lt(r){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(r),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=r;let n=t.content,i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!$0.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),p=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(p||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var Ur={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},Gc=async(r,e)=>{let{content:t,size:n="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=r,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
1
+ var SyntrologieSDK=(()=>{var Do=Object.defineProperty;var f0=Object.getOwnPropertyDescriptor;var g0=Object.getOwnPropertyNames;var m0=Object.prototype.hasOwnProperty;var If=r=>{throw TypeError(r)};var v0=(r,e,t)=>e in r?Do(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var $f=(r,e)=>{for(var t in e)Do(r,t,{get:e[t],enumerable:!0})},y0=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g0(e))!m0.call(r,i)&&i!==t&&Do(r,i,{get:()=>e[i],enumerable:!(n=f0(e,i))||n.enumerable});return r};var _0=r=>y0(Do({},"__esModule",{value:!0}),r);var me=(r,e,t)=>v0(r,typeof e!="symbol"?e+"":e,t),jc=(r,e,t)=>e.has(r)||If("Cannot "+t);var U=(r,e,t)=>(jc(r,e,"read from private field"),t?t.call(r):e.get(r)),he=(r,e,t)=>e.has(r)?If("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ne=(r,e,t,n)=>(jc(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),ye=(r,e,t)=>(jc(r,e,"access private method"),t);var Wc=(r,e,t,n)=>({set _(i){ne(r,e,i,t)},get _(){return U(r,e,n)}});var wA={};$f(wA,{ANIMATION_KEYFRAMES:()=>Oi,ActivationConfigZ:()=>Ws,AddClassZ:()=>Od,AnchorIdZ:()=>ut,AnchorStateZ:()=>i0,AnchorVisibleConditionZ:()=>Ea,AppRegistry:()=>Kn,AugmentationZ:()=>s0,BadgePositionZ:()=>wd,BadgeZ:()=>Hd,BoundingBoxZ:()=>n0,CanvasEvents:()=>mi,CanvasRecipeZ:()=>Dc,ConditionZ:()=>nr,ContextManager:()=>eo,CooldownActiveConditionZ:()=>$a,CounterDefZ:()=>si,CtaButtonZ:()=>cl,DEFAULT_COOLDOWN:()=>Ua,DecisionController:()=>Nc,DecisionStrategyZ:()=>di,DismissedConditionZ:()=>Ia,EVENT_SCHEMA_VERSION:()=>Te,EventBus:()=>qs,EventCountConditionZ:()=>Oa,EventFilterZ:()=>l0,EventHistory:()=>ki,EventOccurredConditionZ:()=>Ca,EventSourceZ:()=>kf,ExecutorRegistry:()=>Vs,ExternalStrategyZ:()=>ui,FrequencyEntryZ:()=>p0,FrequencyLimitConditionZ:()=>Ma,HighlightStepZ:()=>u0,HighlightStyleZ:()=>xd,HighlightZ:()=>Fd,InsertHtmlZ:()=>Ld,InsertPositionZ:()=>Cd,InterventionTracker:()=>Pi,MAX_VISIBLE_TOASTS:()=>Wa,MatchOpZ:()=>ii,ModalContentZ:()=>Ed,ModalZ:()=>Vd,ModelStrategyZ:()=>ci,MountWidgetZ:()=>Ud,NavigateZ:()=>Wd,NavigationMonitor:()=>$i,NormalizedEventZ:()=>a0,NotificationsController:()=>gi,PageContextZ:()=>Qb,PageHistoryEntryZ:()=>e0,PageUrlConditionZ:()=>ka,ParallelZ:()=>Zd,PlacementZ:()=>kd,PulseZ:()=>Dd,RUNTIME_SDK_BUILD:()=>Ef,RUNTIME_VERSION:()=>Mp,RemoveClassZ:()=>Pd,RouteConditionZ:()=>Sa,RouteFilterZ:()=>_d,RuleStrategyZ:()=>ai,RuleZ:()=>oi,RuntimeContextZ:()=>o0,RuntimeController:()=>Lc,RuntimeEventsController:()=>Fc,SDK_SCHEMA_VERSION:()=>ir,SDK_VERSION:()=>Xa,STATIC_SLOT_STYLES:()=>Ip,ScoreStrategyZ:()=>li,ScrollBehaviorZ:()=>Id,ScrollLogicalPositionZ:()=>ll,ScrollToZ:()=>jd,SelectorZ:()=>Sf,SequenceZ:()=>qd,SessionContextZ:()=>t0,SessionMetricConditionZ:()=>Ta,SessionMetricTracker:()=>Qs,SetAttrZ:()=>Md,SetStyleZ:()=>Nd,SetTextZ:()=>$d,SmartCanvasController:()=>Qa,SmartCanvasElementLit:()=>Cn,StandardEvents:()=>Be,StateEqualsConditionZ:()=>Aa,StateStore:()=>so,StoredValueZ:()=>d0,Syntro:()=>wf,ThemeController:()=>vi,TooltipContentZ:()=>Sd,TooltipStepZ:()=>c0,TooltipTriggerZ:()=>Ad,TooltipZ:()=>Bd,TourStepForSchemaZ:()=>Td,TourZ:()=>Gd,TriggerWhenZ:()=>As,ViewportConditionZ:()=>Ra,ViewportContextZ:()=>r0,WaitZ:()=>zd,WidgetConfigZ:()=>Rd,WidgetRegistry:()=>ao,applyStaticSlotStyles:()=>zl,coreActionStepSchemas:()=>Tv,createActionEngine:()=>al,createAnchorResolver:()=>ul,createCanvasConfigFetcher:()=>wn,createContextManager:()=>Vl,createDecisionEngine:()=>jl,createEventAccumulator:()=>Wl,createEventBus:()=>wi,createGrowthBookClient:()=>Ll,createNoopClient:()=>tc,createOverlayRecipeFetcher:()=>_A,createPostHogClient:()=>Pc,createPostHogNormalizer:()=>Wu,createSessionMetricTracker:()=>Fl,createSmartCanvas:()=>fl,createSmartCanvasController:()=>Gu,createSmartCanvasRuntime:()=>ec,createStateStore:()=>Ul,createSurfaceContainer:()=>Yl,createSurfaces:()=>Jl,decisionSchemas:()=>JS,decodeToken:()=>xi,encodeToken:()=>gl,evaluate:()=>Ep,evaluateCondition:()=>kp,evaluateRule:()=>Sp,evaluateRuleStrategy:()=>to,evaluateScoreStrategy:()=>ro,evaluateSync:()=>Cp,executorRegistry:()=>Wt,getAntiFlickerSnippet:()=>Mv,getExecutor:()=>Rv,getSlotAnchorId:()=>oo,getSlotType:()=>Mi,getSlotZIndex:()=>Xl,hasExecutor:()=>il,needsMigration:()=>fA,normalizePostHogEvent:()=>hi,parseVersion:()=>Ki,playEnterAnimation:()=>Gl,playExitAnimation:()=>Kl,registerConfigPredicates:()=>En,registerSmartCanvasElement:()=>Ds,resolveConfigUri:()=>Ja,runtimeContext:()=>yv,setupAdjacentPositioning:()=>ql,setupInlinePositioning:()=>Zl,shouldNormalizeEvent:()=>fi,validateAction:()=>Nt,validateActions:()=>js,validateActivationConfig:()=>XS,validateCondition:()=>KS,validateConfig:()=>dA,validateEventFilter:()=>vA,validateEventName:()=>ml,validateFrequencyEntry:()=>xA,validateNormalizedEvent:()=>mA,validateProps:()=>vl,validateRecipe:()=>yA,validateRuntimeContext:()=>gA,validateStoredValue:()=>bA,validateStrategy:()=>YS,widgetRegistry:()=>Ql});function Mf(r,e,t,n){let i=n?.maxRetries??3,s=n?.debounceMs??50,o=r.parentElement??e.parentElement;if(!o)return()=>{};let a=0,l=null,c=!1,u=new MutationObserver(p=>{if(!c){for(let h of p)for(let f of h.removedNodes)if(f===r){if(a>=i){u.disconnect(),c=!0;return}l&&clearTimeout(l),l=setTimeout(()=>{if(!c){if(!e.isConnected){u.disconnect(),c=!0;return}a++;try{t()}catch{u.disconnect(),c=!0}}},s);return}}});return u.observe(o,{childList:!0,subtree:!0}),()=>{c=!0,u.disconnect(),l&&clearTimeout(l)}}var b0=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function Uc(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=[];for(;i.nextNode();){let a=i.currentNode,l=a.tagName.toLowerCase();if(!b0.has(l)){s.push(a);continue}for(let c of Array.from(a.attributes)){let u=c.name.toLowerCase(),p=c.value.trim().toLowerCase(),h=u.startsWith("on"),v=(u==="href"||u==="src"||u==="formaction")&&(p.startsWith("javascript:")||p.startsWith("vbscript:")||p.startsWith("data:text/html"));(h||v)&&a.removeAttribute(c.name)}}let o=Array.from(n.querySelectorAll("svg"));for(let a of o)s.some(l=>a.contains(l)&&l.tagName.toLowerCase()==="script")&&s.push(a);for(let a of s){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML}var Of=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=Uc(r.html),i="data-syntro-insert-label",s=r.label;if(s){let p=CSS.escape(s),f=(t.parentElement??t).querySelector(`[${i}="${p}"]`);f&&f.remove()}let o=document.createElement("div");o.setAttribute("data-syntro-action-id",e.generateId()),s&&o.setAttribute(i,s),o.innerHTML=n;let a=null;switch(r.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":a=t.innerHTML,t.replaceWith(o);break}let l=null;if(r.deepLink){let{tileId:p,itemId:h}=r.deepLink;l=()=>{let f=window.SynOS?.handle;f&&(f.open(),f.runtime?.events?.publish("notification.deep_link",{tileId:p,itemId:h}))},o.style.cursor="pointer",o.addEventListener("click",l)}e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:r.anchorId,position:r.position});let u=Mf(o,t,()=>{switch(r.position){case"before":t.insertAdjacentElement("beforebegin",o);break;case"after":t.insertAdjacentElement("afterend",o);break;case"prepend":t.insertBefore(o,t.firstChild);break;case"append":t.appendChild(o);break;case"replace":break}});return{cleanup:()=>{if(l&&o.removeEventListener("click",l),u(),!!o.isConnected)try{if(r.position==="replace"&&a!==null){let p=document.createElement(t.tagName);p.innerHTML=a,Array.from(t.attributes).forEach(h=>{p.setAttribute(h.name,h.value)}),o.replaceWith(p)}else o.remove()}catch{}},updateFn:p=>{"html"in p&&typeof p.html=="string"&&(o.innerHTML=Uc(p.html))}}};function Pf(r){if(r.children.length===0)return r;let e=Array.from(r.children).filter(t=>t.textContent?.trim());if(e.length===1){let t=e[0];if(t.textContent?.trim()===r.textContent?.trim())return Pf(t)}return r}var Nf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=Pf(t),i=n.textContent??"";return n.textContent=r.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:r.anchorId}),{cleanup:()=>{t.isConnected&&(n.textContent=i)},updateFn:s=>{"text"in s&&typeof s.text=="string"&&(n.textContent=s.text)}}},Lf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=r.attr.toLowerCase();if(n.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${r.attr}`);if(n==="href"||n==="src"||n==="formaction"){let a=r.value.trim().toLowerCase();if(a.startsWith("javascript:")||a.startsWith("vbscript:")||a.startsWith("data:text/html"))throw new Error(`Dangerous URL not allowed in ${r.attr}: ${r.value}`)}let s=t.getAttribute(r.attr),o=t.hasAttribute(r.attr);return t.setAttribute(r.attr,r.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:r.anchorId,attr:r.attr}),{cleanup:()=>{t.isConnected&&(o&&s!==null?t.setAttribute(r.attr,s):t.removeAttribute(r.attr))},updateFn:a=>{"value"in a&&typeof a.value=="string"&&t.setAttribute(r.attr,a.value)}}},Ff=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=t.classList.contains(r.className);return t.classList.add(r.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:r.anchorId,className:r.className}),{cleanup:()=>{t.isConnected&&(n||t.classList.remove(r.className))}}},Df=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=t.classList.contains(r.className);return t.classList.remove(r.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:r.anchorId,className:r.className}),{cleanup:()=>{t.isConnected&&n&&t.classList.add(r.className)}}},Hf=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=new Map;for(let i of Object.keys(r.styles)){let s=t.style.getPropertyValue(i);n.set(i,s)}for(let[i,s]of Object.entries(r.styles))t.style.setProperty(i,s);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:r.anchorId,styles:Object.keys(r.styles)}),{cleanup:()=>{if(t.isConnected)for(let[i,s]of n)s?t.style.setProperty(i,s):t.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[s,o]of Object.entries(i.styles))t.style.setProperty(s,o)}}},zc=[{kind:"content:insertHtml",executor:Of},{kind:"content:setText",executor:Nf},{kind:"content:setAttr",executor:Lf},{kind:"content:addClass",executor:Ff},{kind:"content:removeClass",executor:Df},{kind:"content:setStyle",executor:Hf}],qc={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:zc};var x0={light:50,medium:100,heavy:200},w0=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Bf={init(r,e,t){let n=x0[t.intensity],i=t.colors.length>0?t.colors:w0,s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*-e*.3,vx:(Math.random()-.5)*4,vy:Math.random()*2+1,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.2,size:Math.random()*6+4,color:i[Math.floor(Math.random()*i.length)],opacity:1,shape:Math.random()>.5?"rect":"circle"});return s},update(r,e,t){let n=!1;for(let i of r)i.vy+=.15,i.vx*=.99,i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.y>0&&i.opacity>0&&i.y>500&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(n=!0);return n},render(r,e){for(let t of e)t.opacity<.01||(r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.translate(t.x,t.y),r.rotate(t.rotation),t.shape==="circle"?(r.beginPath(),r.arc(0,0,t.size/2,0,Math.PI*2),r.fill()):r.fillRect(-t.size/2,-t.size/2,t.size,t.size*.6),r.restore())}};var k0={light:20,medium:40,heavy:80},S0="\u{1F389}",Vf={init(r,e,t){let n=k0[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:S0,s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*-200,vx:0,vy:Math.random()*1.5+1,rotation:0,rotationSpeed:0,size:Math.random()*12+16,color:"#000000",opacity:1,shape:"emoji",emoji:i,data:{wobblePhase:Math.random()*Math.PI*2,wobbleAmp:Math.random()*1.5+.5,originX:0}});for(let o of s)o.data&&(o.data.originX=o.x);return s},update(r,e,t){let n=!1;for(let i of r){i.y+=i.vy;let s=i.data?.wobblePhase??0,o=i.data?.wobbleAmp??1,a=i.data?.originX??i.x;i.x=a+Math.sin(t*.003+s)*o*20,i.y>600&&(i.opacity-=.02,i.opacity<0&&(i.opacity=0)),i.opacity>.01&&(n=!0)}return n},render(r,e){for(let t of e)t.opacity<.01||!t.emoji||(r.save(),r.globalAlpha=t.opacity,r.font=`${t.size}px serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(t.emoji,t.x,t.y),r.restore())}};var E0={light:20,medium:40,heavy:80},C0={light:3,medium:4,heavy:5},jf={init(r,e,t){let n=E0[t.intensity],i=C0[t.intensity],s=t.colors.length>0?t.colors:["#ff4444","#44ff44","#4444ff"],o=[];for(let a=0;a<i;a++){let l=Math.random()*r*.8+r*.1,c=Math.random()*e*.6,u=s[Math.floor(Math.random()*s.length)];for(let p=0;p<n;p++){let h=Math.PI*2*p/n+(Math.random()-.5)*.3,f=Math.random()*3+2;o.push({x:l,y:c,vx:Math.cos(h)*f,vy:Math.sin(h)*f,rotation:0,rotationSpeed:0,size:Math.random()*3+2,color:u,opacity:1,shape:"circle",data:{centerX:l,centerY:c}})}}return o},update(r,e,t){let n=!1;for(let i of r)i.vx*=.97,i.vy*=.97,i.vy+=.03,i.x+=i.vx,i.y+=i.vy,i.opacity-=.008,i.opacity<0&&(i.opacity=0),i.opacity>.01&&(n=!0);return n},render(r,e){for(let t of e)t.opacity<.01||(r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.shadowBlur=12,r.shadowColor=t.color,r.beginPath(),r.arc(t.x,t.y,t.size,0,Math.PI*2),r.fill(),r.restore())}};var A0={light:30,medium:60,heavy:120},Wf={init(r,e,t){let n=A0[t.intensity],i=t.colors.length>0?t.colors:["#ffd700","#ffffff","#fffacd"],s=[];for(let o=0;o<n;o++)s.push({x:Math.random()*r,y:Math.random()*e,vx:(Math.random()-.5)*.3,vy:-(Math.random()*.5+.2),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.1,size:Math.random()*4+2,color:i[Math.floor(Math.random()*i.length)],opacity:Math.random()*.5+.5,shape:"circle",data:{phase:Math.random()*Math.PI*2,baseOpacity:Math.random()*.5+.5}});return s},update(r,e,t){let n=!1;for(let i of r){i.x+=i.vx,i.y+=i.vy,i.rotation+=i.rotationSpeed,i.data&&(i.data.baseOpacity=(i.data.baseOpacity??1)-.001,i.data.baseOpacity<0&&(i.data.baseOpacity=0));let s=i.data?.phase??0,o=i.data?.baseOpacity??1;if(o<=.01)i.opacity=0;else{let a=Math.sin(t*.005+s)*.4+.6;i.opacity=o*a}i.opacity>.01&&(n=!0)}return n},render(r,e){for(let t of e){if(t.opacity<.01)continue;r.save(),r.globalAlpha=t.opacity,r.fillStyle=t.color,r.translate(t.x,t.y),r.rotate(t.rotation);let n=t.size;r.beginPath(),r.moveTo(0,-n),r.lineTo(n*.3,-n*.3),r.lineTo(n,0),r.lineTo(n*.3,n*.3),r.lineTo(0,n),r.lineTo(-n*.3,n*.3),r.lineTo(-n,0),r.lineTo(-n*.3,-n*.3),r.closePath(),r.fill(),r.restore()}}};var Ho=class{constructor(){this.canvas=null,this.ctx=null,this.rafId=null,this.particles=[],this.startTime=0,this.lastFrame=0,this.duration=0,this.effect=null,this.container=null}start(e,t,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=e,this.effect=t,this.duration=n.duration;let s=document.createElement("canvas");s.setAttribute("data-syntro-celebrate",""),Object.assign(s.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let o=window.devicePixelRatio||1,a=window.innerWidth,l=window.innerHeight;s.width=a*o,s.height=l*o,s.style.width=`${a}px`,s.style.height=`${l}px`;let c=s.getContext("2d");c&&(c.scale(o,o),this.canvas=s,this.ctx=c,e.appendChild(s),this.particles=t.init(a,l,n),this.startTime=performance.now(),this.lastFrame=this.startTime,this.tick=this.tick.bind(this),this.rafId=requestAnimationFrame(this.tick))}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas&&this.container&&(this.canvas.remove(),this.canvas=null),this.ctx=null,this.effect=null,this.container=null,this.particles=[]}tick(e){if(!this.ctx||!this.canvas||!this.effect)return;let t=e-this.startTime,n=e-this.lastFrame;if(this.lastFrame=e,t>=this.duration){this.stop();return}let i=this.canvas.width/(window.devicePixelRatio||1),s=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,i,s),!this.effect.update(this.particles,n,t)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}};var R0=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function T0(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function I0(r){try{let e=getComputedStyle(r),t=e.getPropertyValue("--sc-color-primary")?.trim(),n=e.getPropertyValue("--sc-color-primary-hover")?.trim();if(t?.startsWith("#")&&t.length>=7)return T0(t,n||t)}catch{}return null}var Uf=new Map([["confetti",Bf],["fireworks",jf],["sparkles",Wf],["emoji-rain",Vf]]),zf=async(r,e)=>{let t=Uf.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...Uf.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??I0(e.overlayRoot)??R0,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new Ho;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}};var Gc="syntro_active_tour",Bo=new Map;function $0(r){try{let e=localStorage.getItem(Gc);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Zc(r){try{localStorage.setItem(Gc,JSON.stringify(r))}catch{}}function M0(){try{localStorage.removeItem(Gc)}catch{}}function Xi(){return window.location.pathname}function O0(r){if(!r.route)return!0;let e=Xi();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var Kc=async(r,e)=>{let{tourId:t,steps:n,startStep:i,autoStart:s=!0}=r;if(n.length===0)throw new Error(`Tour "${t}" has no steps`);if(Bo.has(t))return{cleanup:async()=>{let k=Bo.get(t);k&&await k.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=$0(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Zc(o));let l=n.findIndex(k=>k.id===o.currentStepId);if(l===-1){let k=i||n[0].id;l=n.findIndex(_=>_.id===k),l===-1&&(l=0),o.currentStepId=n[l].id,Zc(o)}let c=n[l];if(!O0(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Xi()}),{cleanup:()=>{}};let u=!1,p=null,h=null,f=null,v=async()=>{h&&(h(),h=null),p?.isApplied()&&(await p.revert(),p=null)},g=async k=>{if(u)return;if(await v(),k==="end"){M0(),e.publishEvent("tour.completed",{tourId:t,totalSteps:n.length}),u=!0;return}let _=n.find(w=>w.id===k);if(!_){console.error(`[Tour] Step "${k}" not found`);return}if(o.currentStepId=k,Zc(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:k}),_.route&&_.route!==Xi()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:k,targetRoute:_.route});return}await m(_)},m=async k=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:k.id,stepIndex:n.findIndex(_=>_.id===k.id),totalSteps:n.length});try{p=await e.applyAction(k.action)}catch(_){console.error(`[Tour] Failed to execute step "${k.id}":`,_),e.publishEvent("tour.step_failed",{tourId:t,stepId:k.id,error:String(_)});return}if(k.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",R=>{let b=R?.actionId;if(b&&k.onAction){let A=k.onAction[b];A&&g(A)}});let _=e.subscribeEvent("action.tooltip_cta_clicked",R=>{let b=R?.actionId;if(b&&k.onAction){let A=k.onAction[b];A&&g(A)}}),w=h;h=()=>{w(),_()}}}};f=(()=>{let k=Xi(),_=()=>{let b=Xi();b!==k&&(k=b,e.publishEvent("tour.route_changed",{tourId:t,newRoute:b}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>_());window.addEventListener("popstate",_);let w=history.pushState.bind(history),R=history.replaceState.bind(history);return history.pushState=(...b)=>{w(...b),queueMicrotask(_)},history.replaceState=(...b)=>{R(...b),queueMicrotask(_)},()=>{window.removeEventListener("popstate",_),history.pushState=w,history.replaceState=R}})(),a?e.publishEvent("tour.resumed",{tourId:t,stepId:o.currentStepId}):e.publishEvent("tour.started",{tourId:t,totalSteps:n.length,startStepId:o.currentStepId}),await m(c);let x=async()=>{u=!0,Bo.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Bo.set(t,{cleanup:x}),{cleanup:x}};var Et={white:"#ffffff",black:"#000000"},te={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},S={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"},_e={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},je={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Re={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},at={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Ji={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},ft={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Qi={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var lt={primary:S[10],secondary:S[9],tertiary:S[8]},VA={primary:S[2],secondary:S[0]},Yc={primary:S[4],secondary:S[3]},Vo={primary:{text:Et.white,icon:Et.white,border:te[3],backgroundDefault:te[3],backgroundHover:te[2]},neutral:{text:S[10],textHover:Et.white,icon:S[10],iconHover:Et.white,border:S[4],background:S[2]},link:{text:Et.white,icon:Et.white,hover:te[5]},error:{text:Re[5],hover:Re[6]},success:{text:_e[5],hover:_e[6]}},jA={slateGrey:{content:S[10],pillOutline:S[10],borderPrimary:S[5],borderSecondary:S[5],background:S[3]},brand:{content:te[9],pillOutline:te[9],borderPrimary:te[6],borderSecondary:te[6],background:te[0]},red:{content:Re[8],pillOutline:Re[4],borderPrimary:Re[2],borderSecondary:Re[2],background:Re[0]},yellow:{content:je[8],pillOutline:je[4],borderPrimary:je[2],borderSecondary:je[2],background:je[0]},green:{content:_e[8],pillOutline:_e[4],borderPrimary:_e[2],borderSecondary:_e[2],background:_e[0]},purple:{content:ft[8],pillOutline:ft[4],borderPrimary:ft[2],borderSecondary:ft[2],background:ft[0]},blue:{content:at[8],pillOutline:at[4],borderPrimary:at[2],borderSecondary:at[2],background:at[0]},orange:{content:Ji[8],pillOutline:Ji[4],borderPrimary:Ji[2],borderSecondary:Ji[2],background:Ji[0]},pink:{content:Qi[8],pillOutline:Qi[4],borderPrimary:Qi[2],borderSecondary:Qi[2],background:Qi[0]}},WA={green:{content:_e[8],border:_e[2],background:_e[0]},yellow:{content:je[8],border:je[2],background:je[0]},red:{content:Re[8],border:Re[2],background:Re[0]}},UA={green:{content:_e[1],background:_e[9]},yellow:{content:je[1],background:je[9]},red:{content:Re[1],background:Re[9]}},zA={content:S[10],border:S[4],background:S[3]},qA={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},ZA={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:te[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},GA={backgroundDefault:S[2],backgroundDisabled:S[0],textLabel:S[9],textPlaceholder:S[8],textHint:S[8],textError:Re[5],iconDefault:S[9],iconPlaceholder:S[10],iconError:Re[5],borderDefault:S[4],borderSelected:te[3],borderError:Re[5]},KA={handleDefault:Et.white,handleDisabled:S[10],off:{backgroundDefault:S[4],backgroundHover:S[5],backgroundDisabled:S[4]},on:{backgroundDefault:_e[3],backgroundHover:_e[2],backgroundDisabled:S[4]}},YA={off:{backgroundDefault:"#00000000",backgroundHover:S[5],backgroundDisabled:S[2],border:S[6]},on:{backgroundDefault:_e[0],backgroundHover:_e[1],backgroundDisabled:S[2],border:_e[3]}},XA={content:S[10],background:S[4]},JA={background:S[4],active:_e[3]},QA={background:S[1],content:S[9],border:S[4]},eR={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},tR={background:S[1],content:S[9],border:S[4]},rR={activeBackground:S[3],activeContent:te[5],inactiveContent:S[9],border:S[4]},nR={header:{textDefault:S[9],textHover:S[8],backgroundDefault:S[1]},border:S[4],cell:{textPrimary:S[10],textSecondary:S[9],backgroundDefault:S[2],backgroundHover:S[1]}},iR={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},sR={background:_e[1],active:_e[5]},oR={textDefault:S[10],textSelected:Et.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:te[3],border:S[4]},aR=S[9];var dR={size:56,inset:12,background:Et.black,color:Et.white,border:`2px solid ${te[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)"};var qf=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Zf(r,e,t){let n=t?.paddingPx??12,i=t?.radiusPx??12,s=Math.min(Math.max(t?.scrimOpacity??.55,0),1),o=t?.ringColor??`var(--syntro-ring, ${at[5]})`,a=t?.blocking??!1,l=t?.onClickOutside??!0,c=t?.onEsc??!0,u=getComputedStyle(document.documentElement),p=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),f=document.createElement("div");f.className="syntro-spotlight-scrim";let v=a||l;Object.assign(f.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:p||`rgba(2, 6, 23, ${s})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(f),requestAnimationFrame(()=>f.style.opacity="1");let g=document.createElement("div");g.className="syntro-spotlight-ring",Object.assign(g.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${o||h||at[5]}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(g);let m=[];if(!qf)for(let $=0;$<4;$++){let N=document.createElement("div");N.style.position="fixed",N.style.background="inherit",m.push(N),f.appendChild(N)}let y=$=>{f.style.clipPath=$,f.style.webkitClipPath=$},x=()=>{if(!r.isConnected){A.destroy();return}let $=r.getBoundingClientRect(),N=$.left-n,M=$.top-n,K=$.width+n*2,L=$.height+n*2;if(Object.assign(g.style,{left:`${N}px`,top:`${M}px`,width:`${K}px`,height:`${L}px`}),qf){let P=window.innerWidth,q=window.innerHeight,Y=Math.min(i,K/2,L/2),re=`M 0 0 L ${P} 0 L ${P} ${q} L 0 ${q} Z`,C=`M ${N+Y} ${M} A ${Y} ${Y} 0 0 0 ${N} ${M+Y} L ${N} ${M+L-Y} A ${Y} ${Y} 0 0 0 ${N+Y} ${M+L} L ${N+K-Y} ${M+L} A ${Y} ${Y} 0 0 0 ${N+K} ${M+L-Y} L ${N+K} ${M+Y} A ${Y} ${Y} 0 0 0 ${N+K-Y} ${M} L ${N+Y} ${M} Z`;y(`path('${re} ${C}')`)}else{let[P,q,Y,re]=m;Object.assign(P.style,{left:"0px",top:"0px",width:"100vw",height:`${M}px`}),Object.assign(Y.style,{left:"0px",top:`${M+L}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(M+L))}px`}),Object.assign(re.style,{left:"0px",top:`${M}px`,width:`${N}px`,height:`${L}px`}),Object.assign(q.style,{left:`${N+K}px`,top:`${M}px`,width:`${Math.max(0,window.innerWidth-(N+K))}px`,height:`${L}px`})}},k=new ResizeObserver(()=>requestAnimationFrame(x));k.observe(r);let _=()=>requestAnimationFrame(x),w=()=>requestAnimationFrame(x);window.addEventListener("scroll",_,!0),window.addEventListener("resize",w);let R=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),A.destroy())};c&&window.addEventListener("keydown",R);let b=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),A.destroy())};f.addEventListener("click",b);let A={destroy(){k.disconnect(),window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",R),f.removeEventListener("click",b),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{g.remove()}catch{}},220)}};return x(),A}var P0=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button","svg","path","circle","line","polyline","polygon","rect","g"]);function ct(r){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(r),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=r;let n=t.content,i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,null),s=[];for(;i.nextNode();){let o=i.currentNode,a=o.tagName.toLowerCase();if(!P0.has(a)){s.push(o);continue}for(let l of Array.from(o.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),p=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(p||h)&&o.removeAttribute(l.name)}}for(let o of s){for(;o.firstChild;)o.parentNode?.insertBefore(o.firstChild,o);o.remove()}return t.innerHTML}var Ur={bg:"var(--sc-overlay-background, #ffffff)",title:"var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",text:"var(--sc-overlay-text-color, #4b5563)",accent:"var(--sc-color-primary, #4f46e5)",radius:"var(--sc-border-radius, 12px)"},Xc=async(r,e)=>{let{content:t,size:n="md",blocking:i=!1,scrim:s,dismiss:o,ctaButtons:a}=r,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  background: rgba(0, 0, 0, ${s?.opacity??.6});
@@ -19,7 +19,7 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
19
19
  opacity: 0;
20
20
  transition: opacity 200ms ease-out, transform 200ms ease-out;
21
21
  padding: 24px;
22
- `;let p="";if(t.title&&(p+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${Ur.title};">${lt(t.title)}</h2>`),p+=`<div class="syntro-modal-body" style="color: ${Ur.text}; line-height: 1.5;">${lt(t.body)}</div>`,o?.closeButton!==!1&&(p+=`
22
+ `;let p="";if(t.title&&(p+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${Ur.title};">${ct(t.title)}</h2>`),p+=`<div class="syntro-modal-body" style="color: ${Ur.text}; line-height: 1.5;">${ct(t.body)}</div>`,o?.closeButton!==!1&&(p+=`
23
23
  <button class="syntro-modal-close" data-syntro-action="dismiss" style="
24
24
  position: absolute;
25
25
  top: 16px;
@@ -38,7 +38,7 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
38
38
  `),a&&a.length>0){p+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let w of a){let R=w.primary??!1;p+=`
39
39
  <button
40
40
  class="syntro-modal-btn ${R?"syntro-modal-btn-primary":""}"
41
- data-syntro-action="${lt(w.actionId)}"
41
+ data-syntro-action="${ct(w.actionId)}"
42
42
  style="
43
43
  padding: 10px 20px;
44
44
  border-radius: 8px;
@@ -49,11 +49,11 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
49
49
  ${R?`background: ${Ur.accent}; color: white; border: none;`:`background: transparent; color: ${Ur.accent}; border: 1px solid currentColor; opacity: 0.7;`}
50
50
  "
51
51
  >
52
- ${lt(w.label)}
52
+ ${ct(w.label)}
53
53
  </button>
54
- `}p+="</div>"}c.innerHTML=p,e.overlayRoot.appendChild(c);let h=null,f=c.querySelectorAll("[data-syntro-action]"),v=w=>{let b=w.currentTarget.getAttribute("data-syntro-action");b&&(h=b,e.publishEvent("action.modal_cta_clicked",{actionId:b}),_.destroy())};f.forEach(w=>w.addEventListener("click",v));let m=w=>{w.key==="Escape"&&o?.onEsc!==!1&&_.destroy()};window.addEventListener("keydown",m);let g=()=>{i||_.destroy()};l.addEventListener("click",g);let y=[];i&&Array.from(document.body.children).forEach(w=>{w!==e.overlayRoot&&w.getAttribute("inert")===null&&!w.querySelector("[data-syntro-editor-panel]")&&!w.hasAttribute("data-syntro-editor-panel")&&(w.setAttribute("inert",""),y.push(w))});let x;o?.timeoutMs&&(x=setTimeout(()=>{_.destroy()},o.timeoutMs));let k=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');k.length>0&&requestAnimationFrame(()=>k[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:n,blocking:i});let _={destroy(){x&&clearTimeout(x),window.removeEventListener("keydown",m),l.removeEventListener("click",g),f.forEach(w=>w.removeEventListener("click",v)),y.forEach(w=>w.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{_.destroy()}}};var Zf=["top","right","bottom","left"];var _r=Math.min,Gt=Math.max,ts=Math.round,rs=Math.floor,Ct=r=>({x:r,y:r}),M0={left:"right",right:"left",bottom:"top",top:"bottom"},O0={start:"end",end:"start"};function Bo(r,e,t){return Gt(r,_r(e,t))}function zr(r,e){return typeof r=="function"?r(e):r}function br(r){return r.split("-")[0]}function Hn(r){return r.split("-")[1]}function Kc(r){return r==="x"?"y":"x"}function Vo(r){return r==="y"?"height":"width"}var P0=new Set(["top","bottom"]);function Kt(r){return P0.has(br(r))?"y":"x"}function jo(r){return Kc(Kt(r))}function Gf(r,e,t){t===void 0&&(t=!1);let n=Hn(r),i=jo(r),s=Vo(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=es(o)),[o,es(o)]}function Kf(r){let e=es(r);return[Ho(r),e,Ho(e)]}function Ho(r){return r.replace(/start|end/g,e=>O0[e])}var zf=["left","right"],qf=["right","left"],N0=["top","bottom"],L0=["bottom","top"];function F0(r,e,t){switch(r){case"top":case"bottom":return t?e?qf:zf:e?zf:qf;case"left":case"right":return e?N0:L0;default:return[]}}function Yf(r,e,t,n){let i=Hn(r),s=F0(br(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Ho)))),s}function es(r){return r.replace(/left|right|bottom|top/g,e=>M0[e])}function D0(r){return{top:0,right:0,bottom:0,left:0,...r}}function Yc(r){return typeof r!="number"?D0(r):{top:r,right:r,bottom:r,left:r}}function qr(r){let{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Xf(r,e,t){let{reference:n,floating:i}=r,s=Kt(e),o=jo(e),a=Vo(o),l=br(e),c=s==="y",u=n.x+n.width/2-i.width/2,p=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2,f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:p};break;case"left":f={x:n.x-i.width,y:p};break;default:f={x:n.x,y:n.y}}switch(Hn(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}async function eg(r,e){var t;e===void 0&&(e={});let{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:h=!1,padding:f=0}=zr(e,r),v=Yc(f),g=a[h?p==="floating"?"reference":"floating":p],y=qr(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(g)))==null||t?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=p==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),_=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},w=qr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,strategy:l}):x);return{top:(y.top-w.top+v.top)/_.y,bottom:(w.bottom-y.bottom+v.bottom)/_.y,left:(y.left-w.left+v.left)/_.x,right:(w.right-y.right+v.right)/_.x}}var tg=async(r,e,t)=>{let{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e)),c=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:u,y:p}=Xf(c,n,l),h=n,f={},v=0;for(let g=0;g<a.length;g++){var m;let{name:y,fn:x}=a[g],{x:k,y:_,data:w,reset:R}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(m=o.detectOverflow)!=null?m:eg},elements:{reference:r,floating:e}});u=k??u,p=_??p,f={...f,[y]:{...f[y],...w}},R&&v<=50&&(v++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):R.rects),{x:u,y:p}=Xf(c,h,l)),g=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},rg=r=>({name:"arrow",options:r,async fn(e){let{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=zr(r,e)||{};if(c==null)return{};let p=Yc(u),h={x:t,y:n},f=jo(i),v=Vo(f),m=await o.getDimensions(c),g=f==="y",y=g?"top":"left",x=g?"bottom":"right",k=g?"clientHeight":"clientWidth",_=s.reference[v]+s.reference[f]-h[f]-s.floating[v],w=h[f]-s.reference[f],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),b=R?R[k]:0;(!b||!await(o.isElement==null?void 0:o.isElement(R)))&&(b=a.floating[k]||s.floating[v]);let A=_/2-w/2,$=b/2-m[v]/2-1,N=_r(p[y],$),M=_r(p[x],$),K=N,L=b-m[v]-M,O=b/2-m[v]/2+A,q=Bo(K,O,L),Y=!l.arrow&&Hn(i)!=null&&O!==q&&s.reference[v]/2-(O<K?N:M)-m[v]/2<0,se=Y?O<K?O-K:O-L:0;return{[f]:h[f]+se,data:{[f]:q,centerOffset:O-q-se,...Y&&{alignmentOffset:se}},reset:Y}}});var ng=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;let{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...g}=zr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=br(i),x=Kt(a),k=br(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(k||!m?[es(a)]:Kf(a)),R=v!=="none";!h&&R&&w.push(...Yf(a,m,v,_));let b=[a,...w],A=await l.detectOverflow(e,g),$=[],N=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&$.push(A[y]),p){let O=Gf(i,o,_);$.push(A[O[0]],A[O[1]])}if(N=[...N,{placement:i,overflows:$}],!$.every(O=>O<=0)){var M,K;let O=(((M=s.flip)==null?void 0:M.index)||0)+1,q=b[O];if(q&&(!(p==="alignment"?x!==Kt(q):!1)||N.every(C=>Kt(C.placement)===x?C.overflows[0]>0:!0)))return{data:{index:O,overflows:N},reset:{placement:q}};let Y=(K=N.filter(se=>se.overflows[0]<=0).sort((se,C)=>se.overflows[1]-C.overflows[1])[0])==null?void 0:K.placement;if(!Y)switch(f){case"bestFit":{var L;let se=(L=N.filter(C=>{if(R){let P=Kt(C.placement);return P===x||P==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(P=>P>0).reduce((P,G)=>P+G,0)]).sort((C,P)=>C[1]-P[1])[0])==null?void 0:L[0];se&&(Y=se);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function Jf(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Qf(r){return Zf.some(e=>r[e]>=0)}var ig=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=zr(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=Jf(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Qf(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=Jf(o,t.floating);return{data:{escapedOffsets:a,escaped:Qf(a)}}}default:return{}}}}};var H0=new Set(["left","top"]);async function B0(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=br(t),a=Hn(t),l=Kt(t)==="y",c=H0.has(o)?-1:1,u=s&&l?-1:1,p=zr(e,r),{mainAxis:h,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}var sg=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;let{x:i,y:s,placement:o,middlewareData:a}=e,l=await B0(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},og=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){let{x:t,y:n,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x,y:k}=y;return{x,y:k}}},...c}=zr(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=Kt(br(i)),f=Kc(h),v=u[f],m=u[h];if(o){let y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=v+p[y],_=v-p[x];v=Bo(k,v,_)}if(a){let y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=m+p[y],_=m-p[x];m=Bo(k,m,_)}let g=l.fn({...e,[f]:v,[h]:m});return{...g,data:{x:g.x-t,y:g.y-n,enabled:{[f]:o,[h]:a}}}}}};function Wo(){return typeof window<"u"}function Zr(r){return lg(r)?(r.nodeName||"").toLowerCase():"#document"}function tt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function At(r){var e;return(e=(lg(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function lg(r){return Wo()?r instanceof Node||r instanceof tt(r).Node:!1}function ft(r){return Wo()?r instanceof Element||r instanceof tt(r).Element:!1}function Rt(r){return Wo()?r instanceof HTMLElement||r instanceof tt(r).HTMLElement:!1}function ag(r){return!Wo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof tt(r).ShadowRoot}var V0=new Set(["inline","contents"]);function Vn(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=gt(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!V0.has(i)}var j0=new Set(["table","td","th"]);function cg(r){return j0.has(Zr(r))}var W0=[":popover-open",":modal"];function ns(r){return W0.some(e=>{try{return r.matches(e)}catch{return!1}})}var U0=["transform","translate","scale","rotate","perspective"],z0=["transform","translate","scale","rotate","perspective","filter"],q0=["paint","layout","strict","content"];function Uo(r){let e=zo(),t=ft(r)?gt(r):r;return U0.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||z0.some(n=>(t.willChange||"").includes(n))||q0.some(n=>(t.contain||"").includes(n))}function ug(r){let e=Yt(r);for(;Rt(e)&&!Gr(e);){if(Uo(e))return e;if(ns(e))return null;e=Yt(e)}return null}function zo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Z0=new Set(["html","body","#document"]);function Gr(r){return Z0.has(Zr(r))}function gt(r){return tt(r).getComputedStyle(r)}function is(r){return ft(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Yt(r){if(Zr(r)==="html")return r;let e=r.assignedSlot||r.parentNode||ag(r)&&r.host||At(r);return ag(e)?e.host:e}function dg(r){let e=Yt(r);return Gr(e)?r.ownerDocument?r.ownerDocument.body:r.body:Rt(e)&&Vn(e)?e:dg(e)}function Bn(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=dg(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=tt(i);if(s){let a=qo(o);return e.concat(o,o.visualViewport||[],Vn(i)?i:[],a&&t?Bn(a):[])}return e.concat(i,Bn(i,[],t))}function qo(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function gg(r){let e=gt(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=Rt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=ts(t)!==s||ts(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function Jc(r){return ft(r)?r:r.contextElement}function jn(r){let e=Jc(r);if(!Rt(e))return Ct(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=gg(e),o=(s?ts(t.width):t.width)/n,a=(s?ts(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var G0=Ct(0);function mg(r){let e=tt(r);return!zo()||!e.visualViewport?G0:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function K0(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==tt(r)?!1:e}function Kr(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=Jc(r),o=Ct(1);e&&(n?ft(n)&&(o=jn(n)):o=jn(r));let a=K0(s,t,n)?mg(s):Ct(0),l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,p=i.height/o.y;if(s){let h=tt(s),f=n&&ft(n)?tt(n):n,v=h,m=qo(v);for(;m&&n&&f!==v;){let g=jn(m),y=m.getBoundingClientRect(),x=gt(m),k=y.left+(m.clientLeft+parseFloat(x.paddingLeft))*g.x,_=y.top+(m.clientTop+parseFloat(x.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,p*=g.y,l+=k,c+=_,v=tt(m),m=qo(v)}}return qr({width:u,height:p,x:l,y:c})}function Zo(r,e){let t=is(r).scrollLeft;return e?e.left+t:Kr(At(r)).left+t}function vg(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Zo(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function Y0(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=At(n),a=e?ns(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Ct(1),u=Ct(0),p=Rt(n);if((p||!p&&!s)&&((Zr(n)!=="body"||Vn(o))&&(l=is(n)),Rt(n))){let f=Kr(n);c=jn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?vg(o,l):Ct(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function X0(r){return Array.from(r.getClientRects())}function J0(r){let e=At(r),t=is(r),n=r.ownerDocument.body,i=Gt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Gt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+Zo(r),a=-t.scrollTop;return gt(n).direction==="rtl"&&(o+=Gt(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var pg=25;function Q0(r,e){let t=tt(r),n=At(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=zo();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Zo(n);if(c<=0){let u=n.ownerDocument,p=u.body,h=getComputedStyle(p),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(n.clientWidth-p.clientWidth-f);v<=pg&&(s-=v)}else c<=pg&&(s+=c);return{width:s,height:o,x:a,y:l}}var ex=new Set(["absolute","fixed"]);function tx(r,e){let t=Kr(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Rt(r)?jn(r):Ct(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function hg(r,e,t){let n;if(e==="viewport")n=Q0(r,t);else if(e==="document")n=J0(At(r));else if(ft(e))n=tx(e,t);else{let i=mg(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return qr(n)}function yg(r,e){let t=Yt(r);return t===e||!ft(t)||Gr(t)?!1:gt(t).position==="fixed"||yg(t,e)}function rx(r,e){let t=e.get(r);if(t)return t;let n=Bn(r,[],!1).filter(a=>ft(a)&&Zr(a)!=="body"),i=null,s=gt(r).position==="fixed",o=s?Yt(r):r;for(;ft(o)&&!Gr(o);){let a=gt(o),l=Uo(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&ex.has(i.position)||Vn(o)&&!l&&yg(r,o))?n=n.filter(u=>u!==o):i=a,o=Yt(o)}return e.set(r,n),n}function nx(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?ns(e)?[]:rx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=hg(e,u,i);return c.top=Gt(p.top,c.top),c.right=_r(p.right,c.right),c.bottom=_r(p.bottom,c.bottom),c.left=Gt(p.left,c.left),c},hg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ix(r){let{width:e,height:t}=gg(r);return{width:e,height:t}}function sx(r,e,t){let n=Rt(e),i=At(e),s=t==="fixed",o=Kr(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Ct(0);function c(){l.x=Zo(i)}if(n||!n&&!s)if((Zr(e)!=="body"||Vn(i))&&(a=is(e)),n){let f=Kr(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!n&&i&&c();let u=i&&!n&&!s?vg(i,a):Ct(0),p=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:p,y:h,width:o.width,height:o.height}}function Xc(r){return gt(r).position==="static"}function fg(r,e){if(!Rt(r)||gt(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return At(r)===t&&(t=t.ownerDocument.body),t}function _g(r,e){let t=tt(r);if(ns(r))return t;if(!Rt(r)){let i=Yt(r);for(;i&&!Gr(i);){if(ft(i)&&!Xc(i))return i;i=Yt(i)}return t}let n=fg(r,e);for(;n&&cg(n)&&Xc(n);)n=fg(n,e);return n&&Gr(n)&&Xc(n)&&!Uo(n)?t:n||ug(r)||t}var ox=async function(r){let e=this.getOffsetParent||_g,t=this.getDimensions,n=await t(r.floating);return{reference:sx(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ax(r){return gt(r).direction==="rtl"}var lx={convertOffsetParentRelativeRectToViewportRelativeRect:Y0,getDocumentElement:At,getClippingRect:nx,getOffsetParent:_g,getElementRects:ox,getClientRects:X0,getDimensions:ix,getScale:jn,isElement:ft,isRTL:ax};function bg(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function cx(r,e){let t=null,n,i=At(r);function s(){var a;clearTimeout(n),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();let c=r.getBoundingClientRect(),{left:u,top:p,width:h,height:f}=c;if(a||e(),!h||!f)return;let v=rs(p),m=rs(i.clientWidth-(u+h)),g=rs(i.clientHeight-(p+f)),y=rs(u),k={rootMargin:-v+"px "+-m+"px "+-g+"px "+-y+"px",threshold:Gt(0,_r(1,l))||1},_=!0;function w(R){let b=R[0].intersectionRatio;if(b!==l){if(!_)return o();b?o(!1,b):n=setTimeout(()=>{o(!1,1e-7)},1e3)}b===1&&!bg(c,r.getBoundingClientRect())&&o(),_=!1}try{t=new IntersectionObserver(w,{...k,root:i.ownerDocument})}catch{t=new IntersectionObserver(w,k)}t.observe(r)}return o(!0),s}function Go(r,e,t,n){n===void 0&&(n={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=Jc(r),u=i||s?[...c?Bn(c):[],...Bn(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let p=c&&a?cx(c,t):null,h=-1,f=null;o&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let v,m=l?Kr(r):null;l&&g();function g(){let y=Kr(r);m&&!bg(m,y)&&t(),m=y,v=requestAnimationFrame(g)}return t(),()=>{var y;u.forEach(x=>{i&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),p?.(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(v)}}var Ko=sg;var Yo=og,Xo=ng;var xg=ig,wg=rg;var Jo=(r,e,t)=>{let n=new Map,i={platform:lx,...t},s={...i.platform,_c:n};return tg(r,e,{...i,platform:s})};function ux(r){let e=r.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;if(!(e.width>t*.8||e.height>n*.8))return r;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,n),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function kg(r,e,t){if(!t.trigger||t.trigger==="immediate"){let m=r.getBoundingClientRect();m.width>window.innerWidth*.8||m.height>window.innerHeight*.8||r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let n=document.createElement("div");if(n.className="syntro-tooltip",n.setAttribute("role","tooltip"),n.innerHTML=lt(t.html),!t.trigger||t.trigger==="immediate"){let m=document.createElement("button");m.className="syntro-tooltip-close",m.setAttribute("aria-label","Close"),m.textContent="\xD7",Object.assign(m.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),m.addEventListener("mouseenter",()=>{m.style.opacity="1"}),m.addEventListener("mouseleave",()=>{m.style.opacity="0.6"}),m.addEventListener("click",()=>v.destroy()),n.style.position="relative",n.appendChild(m)}let i=n.querySelectorAll("[data-syntro-action]"),s=m=>{let y=m.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(m=>m.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",n.appendChild(o),e.appendChild(n);let a=[Ko(t.offsetPx??8),Xo(),Yo({padding:8}),xg(),wg({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Go(r,n,async()=>{if(!r.isConnected){v.destroy();return}let m=ux(r),g=await Jo(m,n,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:x,strategy:k,middlewareData:_,placement:w}=g;if(Object.assign(n.style,{left:`${y}px`,top:`${x}px`,position:k}),_.arrow){let{x:R,y:b}=_.arrow,A=w.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:R!=null?`${R}px`:"",top:b!=null?`${b}px`:"",right:"",bottom:"",[$[A]]:"-4px"});let N={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${N[A]||"0deg"})`}}),u=m=>{m.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let p=[];if(t.blocking){Array.from(document.body.children).forEach(g=>{g!==e&&g.getAttribute("inert")===null&&(g.setAttribute("inert",""),p.push(g.id||g.tagName))});let m=Array.from(n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(m.length>0){let g=m[0],y=m[m.length-1],x=k=>{k.key==="Tab"&&(k.shiftKey?document.activeElement===g&&(y.focus(),k.preventDefault()):document.activeElement===y&&(g.focus(),k.preventDefault()))};n.addEventListener("keydown",x),requestAnimationFrame(()=>g.focus())}}let f=(()=>{if(t.trigger==="hover"){let m=null,g=()=>{m&&(clearTimeout(m),m=null),n.style.visibility="visible",n.style.opacity="1"},y=()=>{m=setTimeout(()=>{n.style.visibility="hidden",n.style.opacity="0",m=null},100)};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("mouseenter",g),r.addEventListener("mouseleave",y),n.addEventListener("mouseenter",g),n.addEventListener("mouseleave",y),r.addEventListener("focus",g),r.addEventListener("blur",y),()=>{m&&clearTimeout(m),r.removeEventListener("mouseenter",g),r.removeEventListener("mouseleave",y),n.removeEventListener("mouseenter",g),n.removeEventListener("mouseleave",y),r.removeEventListener("focus",g),r.removeEventListener("blur",y)}}if(t.trigger==="click"){let m=()=>{n.style.visibility==="visible"?v.destroy():(n.style.visibility="visible",n.style.opacity="1")};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("click",m),()=>r.removeEventListener("click",m)}return n.style.opacity="0",n.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{n.style.opacity="1"}),()=>{}})(),v={el:n,destroy(){c(),f(),window.removeEventListener("keydown",u),i.forEach(m=>m.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(m=>{m!==e&&m.removeAttribute("inert")}),n.style.pointerEvents="none",n.style.opacity="0",setTimeout(()=>{try{n.remove()}catch{}},200)}};return v}var Qo=globalThis,ea=Qo.ShadowRoot&&(Qo.ShadyCSS===void 0||Qo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qc=Symbol(),Sg=new WeakMap,ss=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Qc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ea&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Sg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Sg.set(t,e))}return e}toString(){return this.cssText}},Eg=r=>new ss(typeof r=="string"?r:r+"",void 0,Qc),Yr=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[s+1],r[0]);return new ss(t,r,Qc)},Cg=(r,e)=>{if(ea)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Qo.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},eu=ea?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Eg(t)})(r):r;var{is:dx,defineProperty:px,getOwnPropertyDescriptor:hx,getOwnPropertyNames:fx,getOwnPropertySymbols:gx,getPrototypeOf:mx}=Object,xr=globalThis,Ag=xr.trustedTypes,vx=Ag?Ag.emptyScript:"",yx=xr.reactiveElementPolyfillSupport,os=(r,e)=>r,tu={toAttribute(r,e){switch(e){case Boolean:r=r?vx:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Tg=(r,e)=>!dx(r,e),Rg={attribute:!0,type:String,converter:tu,reflect:!1,useDefault:!1,hasChanged:Tg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),xr.litPropertyMetadata??(xr.litPropertyMetadata=new WeakMap);var Xt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Rg){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&px(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=hx(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){let a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Rg}static _$Ei(){if(this.hasOwnProperty(os("elementProperties")))return;let e=mx(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(os("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(os("properties"))){let t=this.properties,n=[...fx(t),...gx(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(eu(i))}else e!==void 0&&t.push(eu(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Cg(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let s=(n.converter?.toAttribute!==void 0?n.converter:tu).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let s=n.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:tu;this._$Em=i;let a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,n,i=!1,s){if(e!==void 0){let o=this.constructor;if(i===!1&&(s=this[e]),n??(n=o.getPropertyOptions(e)),!((n.hasChanged??Tg)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,s]of n){let{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[os("elementProperties")]=new Map,Xt[os("finalized")]=new Map,yx?.({ReactiveElement:Xt}),(xr.reactiveElementVersions??(xr.reactiveElementVersions=[])).push("2.1.2");var ls=globalThis,Ig=r=>r,ta=ls.trustedTypes,$g=ta?ta.createPolicy("lit-html",{createHTML:r=>r}):void 0,Fg="$lit$",wr=`lit$${Math.random().toFixed(9).slice(2)}$`,Dg="?"+wr,_x=`<${Dg}>`,Qr=document,cs=()=>Qr.createComment(""),us=r=>r===null||typeof r!="object"&&typeof r!="function",lu=Array.isArray,bx=r=>lu(r)||typeof r?.[Symbol.iterator]=="function",ru=`[
55
- \f\r]`,as=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mg=/-->/g,Og=/>/g,Xr=RegExp(`>|${ru}(?:([^\\s"'>=/]+)(${ru}*=${ru}*(?:[^
56
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Pg=/'/g,Ng=/"/g,Hg=/^(?:script|style|textarea|title)$/i,cu=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),j=cu(1),zR=cu(2),qR=cu(3),Tt=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),Lg=new WeakMap,Jr=Qr.createTreeWalker(Qr,129);function Bg(r,e){if(!lu(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $g!==void 0?$g.createHTML(e):e}var xx=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=as;for(let a=0;a<t;a++){let l=r[a],c,u,p=-1,h=0;for(;h<l.length&&(o.lastIndex=h,u=o.exec(l),u!==null);)h=o.lastIndex,o===as?u[1]==="!--"?o=Mg:u[1]!==void 0?o=Og:u[2]!==void 0?(Hg.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=Xr):u[3]!==void 0&&(o=Xr):o===Xr?u[0]===">"?(o=i??as,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?Xr:u[3]==='"'?Ng:Pg):o===Ng||o===Pg?o=Xr:o===Mg||o===Og?o=as:(o=Xr,i=void 0);let f=o===Xr&&r[a+1].startsWith("/>")?" ":"";s+=o===as?l+_x:p>=0?(n.push(c),l.slice(0,p)+Fg+l.slice(p)+wr+f):l+wr+(p===-2?a:f)}return[Bg(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ds=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0,a=e.length-1,l=this.parts,[c,u]=xx(e,t);if(this.el=r.createElement(c,n),Jr.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Jr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(Fg)){let h=u[o++],f=i.getAttribute(p).split(wr),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?iu:v[1]==="?"?su:v[1]==="@"?ou:Un}),i.removeAttribute(p)}else p.startsWith(wr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(Hg.test(i.tagName)){let p=i.textContent.split(wr),h=p.length-1;if(h>0){i.textContent=ta?ta.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],cs()),Jr.nextNode(),l.push({type:2,index:++s});i.append(p[h],cs())}}}else if(i.nodeType===8)if(i.data===Dg)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(wr,p+1))!==-1;)l.push({type:7,index:s}),p+=wr.length-1}s++}}static createElement(e,t){let n=Qr.createElement("template");return n.innerHTML=e,n}};function Wn(r,e,t=r,n){if(e===Tt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=us(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Wn(r,i._$AS(r,e.values),i,n)),e}var nu=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??Qr).importNode(t,!0);Jr.currentNode=i;let s=Jr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new ps(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new au(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=Jr.nextNode(),o++)}return Jr.currentNode=Qr,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ps=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Wn(this,e,t),us(e)?e===J||e==null||e===""?(this._$AH!==J&&this._$AR(),this._$AH=J):e!==this._$AH&&e!==Tt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):bx(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==J&&us(this._$AH)?this._$AA.nextSibling.data=e:this.T(Qr.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ds.createElement(Bg(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new nu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Lg.get(e.strings);return t===void 0&&Lg.set(e.strings,t=new ds(e)),t}k(e){lu(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let s of e)i===t.length?t.push(n=new r(this.O(cs()),this.O(cs()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ig(e).nextSibling;Ig(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Un=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=J,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=J}_$AI(e,t=this,n,i){let s=this.strings,o=!1;if(s===void 0)e=Wn(this,e,t,0),o=!us(e)||e!==this._$AH&&e!==Tt,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Wn(this,a[n+l],t,l),c===Tt&&(c=this._$AH[l]),o||(o=!us(c)||c!==this._$AH[l]),c===J?e=J:e!==J&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},iu=class extends Un{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},su=class extends Un{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},ou=class extends Un{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Wn(this,e,t,0)??J)===Tt)return;let n=this._$AH,i=e===J&&n!==J||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==J&&(n===J||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},au=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Wn(this,e)}};var wx=ls.litHtmlPolyfillSupport;wx?.(ds,ps),(ls.litHtmlVersions??(ls.litHtmlVersions=[])).push("3.3.2");var Vg=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new ps(e.insertBefore(cs(),s),s,void 0,t??{})}return i._$AI(r),i};var hs=globalThis,he=class extends Xt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Vg(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Tt}};he._$litElement$=!0,he.finalized=!0,hs.litElementHydrateSupport?.({LitElement:he});var kx=hs.litElementPolyfillSupport;kx?.({LitElement:he});(hs.litElementVersions??(hs.litElementVersions=[])).push("4.2.2");var ra={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},na=r=>(...e)=>({_$litDirective$:r,values:e}),zn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var jg="important",Sx=" !"+jg,I=na(class extends zn{constructor(r){if(super(r),r.type!==ra.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(let n in e){let i=e[n];if(i!=null){this.ft.add(n);let s=typeof i=="string"&&i.endsWith(Sx);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?jg:""):t[n]=i}}return Tt}});var kr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Le=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},fs,gs,qn,Jt,ms,ia,Zn,Wg="#1969fe",Ex="#24ad32",Cx="#0e1114",uu="#677384",Ax="#a8afba",Ug="#f6f7f9",Rx="#ffffff";function zg(r){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${Rx})`,color:`var(--se-color-text-primary, ${Cx})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=r.title,e.appendChild(t),r.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=r.body,e.appendChild(s)}document.body.appendChild(e);let n,i=setTimeout(()=>{e.style.opacity="0",n=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(n),e.remove()}}function Tx(r){let e=new Map;for(let t of r){let n=t.action;if(n.kind==="overlays:tour"&&n.workflow&&n.tourId){let i=n.workflow,o=(n.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(n.tourId,{meta:i,steps:o})}}return e}var Gn="syntro-workflow-tracker",vs=class extends he{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,fs.set(this,null),gs.set(this,null),qn.set(this,[]),Jt.set(this,new Set),ms.set(this,{}),ia.set(this,!1),Zn.set(this,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let e=this.runtimeRef?.actions?.getActive?.()??[],t=Tx(e);if(kr(this,Zn,t,"f"),t.size===0)return;let n=this._stateNs,i=n?.get("dismissed")??[],s=n?.get("completed")??{};this._workflowEntries=(()=>{let o=new Set(this._workflowEntries.map(l=>l.tourId)),a=[];for(let[l,{meta:c,steps:u}]of t){if(o.has(l))continue;let p="active";i.includes(l)?p="dismissed":s[l]&&(p="completed"),a.push({tourId:l,meta:c,steps:u,currentStepId:null,completedSteps:[],status:p,completedAt:s[l]||void 0})}return a.length>0?[...this._workflowEntries,...a]:this._workflowEntries})();for(let[o,{meta:a}]of t){let l=n?.get("dismissed")??[],c=n?.get("completed")??{};if(!Le(this,Jt,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Le(this,Jt,"f").add(o),n?.set("notified",[...Le(this,Jt,"f")]);let u=zg(a.notification);Le(this,qn,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Le(this,qn,"f"))e();kr(this,qn,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Le(this,ia,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let n of e)Le(this,Jt,"f").add(n);let t=this._stateNs.get("completed")??{};kr(this,ms,{...t},"f"),kr(this,ia,!0,"f")}kr(this,fs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),kr(this,gs,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Le(this,fs,"f")?.call(this),kr(this,fs,null,"f"),Le(this,gs,"f")?.call(this),kr(this,gs,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Le(this,Zn,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Le(this,Zn,"f").has(t))return;let n=this._stateNs;this._workflowEntries=this._workflowEntries.map(i=>{if(i.tourId!==t)return i;switch(e.name){case"tour.started":{let s=e.props?.startStepId||i.steps[0]?.id||null;if(!Le(this,Jt,"f").has(t)){Le(this,Jt,"f").add(t),n?.set("notified",[...Le(this,Jt,"f")]);let a=Le(this,Zn,"f").get(t);if(a?.meta.notification){let l=zg(a.meta.notification);Le(this,qn,"f").push(l)}}let o=this._workflowEntries.filter(a=>a.status==="active"||a.tourId===t).map(a=>a.tourId);return o.includes(t)||o.push(t),n?.set("active",[...new Set(o)]),{...i,status:"active",currentStepId:s,completedSteps:i.status==="active"?i.completedSteps:[]}}case"tour.step_started":{let s=e.props?.stepId;return{...i,currentStepId:s||i.currentStepId}}case"tour.step_changed":{let s=e.props?.previousStepId,o=e.props?.nextStepId,a=s&&!i.completedSteps.includes(s)?[...i.completedSteps,s]:i.completedSteps;return{...i,currentStepId:o||i.currentStepId,completedSteps:a}}case"tour.completed":{let s=Date.now();return Le(this,ms,"f")[t]=s,n?.set("completed",{...Le(this,ms,"f")}),{...i,status:"completed",currentStepId:null,completedSteps:i.steps.map(o=>o.id),completedAt:s}}case"tour.paused":return i;default:return i}})}_handleStepClick(e,t){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:e,stepId:t}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:e,stepId:t}}))}_handleDismiss(e){this._workflowEntries=this._workflowEntries.map(n=>n.tourId===e?{...n,status:"dismissed"}:n);let t=this._workflowEntries.filter(n=>n.status==="dismissed").map(n=>n.tourId);this._stateNs?.set("dismissed",t),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:e}}))}_renderProgressBar(e,t){let n=t>0?Math.round(e/t*100):0,i={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},s={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${Wg})`,transition:"width 0.3s ease",width:`${n}%`};return j`
54
+ `}p+="</div>"}c.innerHTML=p,e.overlayRoot.appendChild(c);let h=null,f=c.querySelectorAll("[data-syntro-action]"),v=w=>{let b=w.currentTarget.getAttribute("data-syntro-action");b&&(h=b,e.publishEvent("action.modal_cta_clicked",{actionId:b}),_.destroy())};f.forEach(w=>w.addEventListener("click",v));let g=w=>{w.key==="Escape"&&o?.onEsc!==!1&&_.destroy()};window.addEventListener("keydown",g);let m=()=>{i||_.destroy()};l.addEventListener("click",m);let y=[];i&&Array.from(document.body.children).forEach(w=>{w!==e.overlayRoot&&w.getAttribute("inert")===null&&!w.querySelector("[data-syntro-editor-panel]")&&!w.hasAttribute("data-syntro-editor-panel")&&(w.setAttribute("inert",""),y.push(w))});let x;o?.timeoutMs&&(x=setTimeout(()=>{_.destroy()},o.timeoutMs));let k=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');k.length>0&&requestAnimationFrame(()=>k[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:n,blocking:i});let _={destroy(){x&&clearTimeout(x),window.removeEventListener("keydown",g),l.removeEventListener("click",m),f.forEach(w=>w.removeEventListener("click",v)),y.forEach(w=>w.removeAttribute("inert")),c.style.pointerEvents="none",l.style.pointerEvents="none",c.style.opacity="0",c.style.transform="translate(-50%, -50%) scale(0.95)",l.style.opacity="0",setTimeout(()=>{try{c.remove()}catch{}try{l.remove()}catch{}},200),e.publishEvent("action.modal_dismissed",{actionClicked:h})}};return{cleanup:()=>{_.destroy()}}};var Yf=["top","right","bottom","left"];var _r=Math.min,Gt=Math.max,ts=Math.round,rs=Math.floor,Ct=r=>({x:r,y:r}),N0={left:"right",right:"left",bottom:"top",top:"bottom"},L0={start:"end",end:"start"};function Wo(r,e,t){return Gt(r,_r(e,t))}function zr(r,e){return typeof r=="function"?r(e):r}function br(r){return r.split("-")[0]}function Hn(r){return r.split("-")[1]}function Jc(r){return r==="x"?"y":"x"}function Uo(r){return r==="y"?"height":"width"}var F0=new Set(["top","bottom"]);function Kt(r){return F0.has(br(r))?"y":"x"}function zo(r){return Jc(Kt(r))}function Xf(r,e,t){t===void 0&&(t=!1);let n=Hn(r),i=zo(r),s=Uo(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=es(o)),[o,es(o)]}function Jf(r){let e=es(r);return[jo(r),e,jo(e)]}function jo(r){return r.replace(/start|end/g,e=>L0[e])}var Gf=["left","right"],Kf=["right","left"],D0=["top","bottom"],H0=["bottom","top"];function B0(r,e,t){switch(r){case"top":case"bottom":return t?e?Kf:Gf:e?Gf:Kf;case"left":case"right":return e?D0:H0;default:return[]}}function Qf(r,e,t,n){let i=Hn(r),s=B0(br(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(jo)))),s}function es(r){return r.replace(/left|right|bottom|top/g,e=>N0[e])}function V0(r){return{top:0,right:0,bottom:0,left:0,...r}}function Qc(r){return typeof r!="number"?V0(r):{top:r,right:r,bottom:r,left:r}}function qr(r){let{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function eg(r,e,t){let{reference:n,floating:i}=r,s=Kt(e),o=zo(e),a=Uo(o),l=br(e),c=s==="y",u=n.x+n.width/2-i.width/2,p=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2,f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:p};break;case"left":f={x:n.x-i.width,y:p};break;default:f={x:n.x,y:n.y}}switch(Hn(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}async function ng(r,e){var t;e===void 0&&(e={});let{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:h=!1,padding:f=0}=zr(e,r),v=Qc(f),m=a[h?p==="floating"?"reference":"floating":p],y=qr(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(m)))==null||t?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=p==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),_=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},w=qr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,strategy:l}):x);return{top:(y.top-w.top+v.top)/_.y,bottom:(w.bottom-y.bottom+v.bottom)/_.y,left:(y.left-w.left+v.left)/_.x,right:(w.right-y.right+v.right)/_.x}}var ig=async(r,e,t)=>{let{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e)),c=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:u,y:p}=eg(c,n,l),h=n,f={},v=0;for(let m=0;m<a.length;m++){var g;let{name:y,fn:x}=a[m],{x:k,y:_,data:w,reset:R}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:ng},elements:{reference:r,floating:e}});u=k??u,p=_??p,f={...f,[y]:{...f[y],...w}},R&&v<=50&&(v++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):R.rects),{x:u,y:p}=eg(c,h,l)),m=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},sg=r=>({name:"arrow",options:r,async fn(e){let{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=zr(r,e)||{};if(c==null)return{};let p=Qc(u),h={x:t,y:n},f=zo(i),v=Uo(f),g=await o.getDimensions(c),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",k=m?"clientHeight":"clientWidth",_=s.reference[v]+s.reference[f]-h[f]-s.floating[v],w=h[f]-s.reference[f],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),b=R?R[k]:0;(!b||!await(o.isElement==null?void 0:o.isElement(R)))&&(b=a.floating[k]||s.floating[v]);let A=_/2-w/2,$=b/2-g[v]/2-1,N=_r(p[y],$),M=_r(p[x],$),K=N,L=b-g[v]-M,P=b/2-g[v]/2+A,q=Wo(K,P,L),Y=!l.arrow&&Hn(i)!=null&&P!==q&&s.reference[v]/2-(P<K?N:M)-g[v]/2<0,re=Y?P<K?P-K:P-L:0;return{[f]:h[f]+re,data:{[f]:q,centerOffset:P-q-re,...Y&&{alignmentOffset:re}},reset:Y}}});var og=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;let{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:g=!0,...m}=zr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=br(i),x=Kt(a),k=br(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(k||!g?[es(a)]:Jf(a)),R=v!=="none";!h&&R&&w.push(...Qf(a,g,v,_));let b=[a,...w],A=await l.detectOverflow(e,m),$=[],N=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&$.push(A[y]),p){let P=Xf(i,o,_);$.push(A[P[0]],A[P[1]])}if(N=[...N,{placement:i,overflows:$}],!$.every(P=>P<=0)){var M,K;let P=(((M=s.flip)==null?void 0:M.index)||0)+1,q=b[P];if(q&&(!(p==="alignment"?x!==Kt(q):!1)||N.every(C=>Kt(C.placement)===x?C.overflows[0]>0:!0)))return{data:{index:P,overflows:N},reset:{placement:q}};let Y=(K=N.filter(re=>re.overflows[0]<=0).sort((re,C)=>re.overflows[1]-C.overflows[1])[0])==null?void 0:K.placement;if(!Y)switch(f){case"bestFit":{var L;let re=(L=N.filter(C=>{if(R){let O=Kt(C.placement);return O===x||O==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(O=>O>0).reduce((O,Z)=>O+Z,0)]).sort((C,O)=>C[1]-O[1])[0])==null?void 0:L[0];re&&(Y=re);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function tg(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function rg(r){return Yf.some(e=>r[e]>=0)}var ag=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=zr(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=tg(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:rg(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=tg(o,t.floating);return{data:{escapedOffsets:a,escaped:rg(a)}}}default:return{}}}}};var j0=new Set(["left","top"]);async function W0(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=br(t),a=Hn(t),l=Kt(t)==="y",c=j0.has(o)?-1:1,u=s&&l?-1:1,p=zr(e,r),{mainAxis:h,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}var lg=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;let{x:i,y:s,placement:o,middlewareData:a}=e,l=await W0(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},cg=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){let{x:t,y:n,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x,y:k}=y;return{x,y:k}}},...c}=zr(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=Kt(br(i)),f=Jc(h),v=u[f],g=u[h];if(o){let y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=v+p[y],_=v-p[x];v=Wo(k,v,_)}if(a){let y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=g+p[y],_=g-p[x];g=Wo(k,g,_)}let m=l.fn({...e,[f]:v,[h]:g});return{...m,data:{x:m.x-t,y:m.y-n,enabled:{[f]:o,[h]:a}}}}}};function qo(){return typeof window<"u"}function Zr(r){return dg(r)?(r.nodeName||"").toLowerCase():"#document"}function rt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function At(r){var e;return(e=(dg(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function dg(r){return qo()?r instanceof Node||r instanceof rt(r).Node:!1}function gt(r){return qo()?r instanceof Element||r instanceof rt(r).Element:!1}function Rt(r){return qo()?r instanceof HTMLElement||r instanceof rt(r).HTMLElement:!1}function ug(r){return!qo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof rt(r).ShadowRoot}var U0=new Set(["inline","contents"]);function Vn(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=mt(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!U0.has(i)}var z0=new Set(["table","td","th"]);function pg(r){return z0.has(Zr(r))}var q0=[":popover-open",":modal"];function ns(r){return q0.some(e=>{try{return r.matches(e)}catch{return!1}})}var Z0=["transform","translate","scale","rotate","perspective"],G0=["transform","translate","scale","rotate","perspective","filter"],K0=["paint","layout","strict","content"];function Zo(r){let e=Go(),t=gt(r)?mt(r):r;return Z0.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||G0.some(n=>(t.willChange||"").includes(n))||K0.some(n=>(t.contain||"").includes(n))}function hg(r){let e=Yt(r);for(;Rt(e)&&!Gr(e);){if(Zo(e))return e;if(ns(e))return null;e=Yt(e)}return null}function Go(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Y0=new Set(["html","body","#document"]);function Gr(r){return Y0.has(Zr(r))}function mt(r){return rt(r).getComputedStyle(r)}function is(r){return gt(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Yt(r){if(Zr(r)==="html")return r;let e=r.assignedSlot||r.parentNode||ug(r)&&r.host||At(r);return ug(e)?e.host:e}function fg(r){let e=Yt(r);return Gr(e)?r.ownerDocument?r.ownerDocument.body:r.body:Rt(e)&&Vn(e)?e:fg(e)}function Bn(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=fg(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=rt(i);if(s){let a=Ko(o);return e.concat(o,o.visualViewport||[],Vn(i)?i:[],a&&t?Bn(a):[])}return e.concat(i,Bn(i,[],t))}function Ko(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function yg(r){let e=mt(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=Rt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=ts(t)!==s||ts(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function tu(r){return gt(r)?r:r.contextElement}function jn(r){let e=tu(r);if(!Rt(e))return Ct(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=yg(e),o=(s?ts(t.width):t.width)/n,a=(s?ts(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var X0=Ct(0);function _g(r){let e=rt(r);return!Go()||!e.visualViewport?X0:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function J0(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==rt(r)?!1:e}function Kr(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=tu(r),o=Ct(1);e&&(n?gt(n)&&(o=jn(n)):o=jn(r));let a=J0(s,t,n)?_g(s):Ct(0),l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,p=i.height/o.y;if(s){let h=rt(s),f=n&&gt(n)?rt(n):n,v=h,g=Ko(v);for(;g&&n&&f!==v;){let m=jn(g),y=g.getBoundingClientRect(),x=mt(g),k=y.left+(g.clientLeft+parseFloat(x.paddingLeft))*m.x,_=y.top+(g.clientTop+parseFloat(x.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,p*=m.y,l+=k,c+=_,v=rt(g),g=Ko(v)}}return qr({width:u,height:p,x:l,y:c})}function Yo(r,e){let t=is(r).scrollLeft;return e?e.left+t:Kr(At(r)).left+t}function bg(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Yo(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function Q0(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=At(n),a=e?ns(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Ct(1),u=Ct(0),p=Rt(n);if((p||!p&&!s)&&((Zr(n)!=="body"||Vn(o))&&(l=is(n)),Rt(n))){let f=Kr(n);c=jn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?bg(o,l):Ct(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function ex(r){return Array.from(r.getClientRects())}function tx(r){let e=At(r),t=is(r),n=r.ownerDocument.body,i=Gt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Gt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+Yo(r),a=-t.scrollTop;return mt(n).direction==="rtl"&&(o+=Gt(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var gg=25;function rx(r,e){let t=rt(r),n=At(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=Go();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Yo(n);if(c<=0){let u=n.ownerDocument,p=u.body,h=getComputedStyle(p),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(n.clientWidth-p.clientWidth-f);v<=gg&&(s-=v)}else c<=gg&&(s+=c);return{width:s,height:o,x:a,y:l}}var nx=new Set(["absolute","fixed"]);function ix(r,e){let t=Kr(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Rt(r)?jn(r):Ct(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function mg(r,e,t){let n;if(e==="viewport")n=rx(r,t);else if(e==="document")n=tx(At(r));else if(gt(e))n=ix(e,t);else{let i=_g(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return qr(n)}function xg(r,e){let t=Yt(r);return t===e||!gt(t)||Gr(t)?!1:mt(t).position==="fixed"||xg(t,e)}function sx(r,e){let t=e.get(r);if(t)return t;let n=Bn(r,[],!1).filter(a=>gt(a)&&Zr(a)!=="body"),i=null,s=mt(r).position==="fixed",o=s?Yt(r):r;for(;gt(o)&&!Gr(o);){let a=mt(o),l=Zo(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&nx.has(i.position)||Vn(o)&&!l&&xg(r,o))?n=n.filter(u=>u!==o):i=a,o=Yt(o)}return e.set(r,n),n}function ox(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?ns(e)?[]:sx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=mg(e,u,i);return c.top=Gt(p.top,c.top),c.right=_r(p.right,c.right),c.bottom=_r(p.bottom,c.bottom),c.left=Gt(p.left,c.left),c},mg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ax(r){let{width:e,height:t}=yg(r);return{width:e,height:t}}function lx(r,e,t){let n=Rt(e),i=At(e),s=t==="fixed",o=Kr(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Ct(0);function c(){l.x=Yo(i)}if(n||!n&&!s)if((Zr(e)!=="body"||Vn(i))&&(a=is(e)),n){let f=Kr(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!n&&i&&c();let u=i&&!n&&!s?bg(i,a):Ct(0),p=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:p,y:h,width:o.width,height:o.height}}function eu(r){return mt(r).position==="static"}function vg(r,e){if(!Rt(r)||mt(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return At(r)===t&&(t=t.ownerDocument.body),t}function wg(r,e){let t=rt(r);if(ns(r))return t;if(!Rt(r)){let i=Yt(r);for(;i&&!Gr(i);){if(gt(i)&&!eu(i))return i;i=Yt(i)}return t}let n=vg(r,e);for(;n&&pg(n)&&eu(n);)n=vg(n,e);return n&&Gr(n)&&eu(n)&&!Zo(n)?t:n||hg(r)||t}var cx=async function(r){let e=this.getOffsetParent||wg,t=this.getDimensions,n=await t(r.floating);return{reference:lx(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ux(r){return mt(r).direction==="rtl"}var dx={convertOffsetParentRelativeRectToViewportRelativeRect:Q0,getDocumentElement:At,getClippingRect:ox,getOffsetParent:wg,getElementRects:cx,getClientRects:ex,getDimensions:ax,getScale:jn,isElement:gt,isRTL:ux};function kg(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function px(r,e){let t=null,n,i=At(r);function s(){var a;clearTimeout(n),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();let c=r.getBoundingClientRect(),{left:u,top:p,width:h,height:f}=c;if(a||e(),!h||!f)return;let v=rs(p),g=rs(i.clientWidth-(u+h)),m=rs(i.clientHeight-(p+f)),y=rs(u),k={rootMargin:-v+"px "+-g+"px "+-m+"px "+-y+"px",threshold:Gt(0,_r(1,l))||1},_=!0;function w(R){let b=R[0].intersectionRatio;if(b!==l){if(!_)return o();b?o(!1,b):n=setTimeout(()=>{o(!1,1e-7)},1e3)}b===1&&!kg(c,r.getBoundingClientRect())&&o(),_=!1}try{t=new IntersectionObserver(w,{...k,root:i.ownerDocument})}catch{t=new IntersectionObserver(w,k)}t.observe(r)}return o(!0),s}function Xo(r,e,t,n){n===void 0&&(n={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=tu(r),u=i||s?[...c?Bn(c):[],...Bn(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let p=c&&a?px(c,t):null,h=-1,f=null;o&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let v,g=l?Kr(r):null;l&&m();function m(){let y=Kr(r);g&&!kg(g,y)&&t(),g=y,v=requestAnimationFrame(m)}return t(),()=>{var y;u.forEach(x=>{i&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),p?.(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(v)}}var Jo=lg;var Qo=cg,ea=og;var Sg=ag,Eg=sg;var ta=(r,e,t)=>{let n=new Map,i={platform:dx,...t},s={...i.platform,_c:n};return ig(r,e,{...i,platform:s})};function hx(r){let e=r.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;if(!(e.width>t*.8||e.height>n*.8))return r;let s=Math.max(e.left,0),o=Math.max(e.top,0),a=Math.min(e.right,t),l=Math.min(e.bottom,n),c=(s+a)/2,u=(o+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function Cg(r,e,t){if(!t.trigger||t.trigger==="immediate"){let g=r.getBoundingClientRect();g.width>window.innerWidth*.8||g.height>window.innerHeight*.8||r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}let n=document.createElement("div");if(n.className="syntro-tooltip",n.setAttribute("role","tooltip"),n.innerHTML=ct(t.html),!t.trigger||t.trigger==="immediate"){let g=document.createElement("button");g.className="syntro-tooltip-close",g.setAttribute("aria-label","Close"),g.textContent="\xD7",Object.assign(g.style,{position:"absolute",top:"4px",right:"4px",background:"none",border:"none",color:"inherit",fontSize:"16px",lineHeight:"1",cursor:"pointer",opacity:"0.6",padding:"2px 4px"}),g.addEventListener("mouseenter",()=>{g.style.opacity="1"}),g.addEventListener("mouseleave",()=>{g.style.opacity="0.6"}),g.addEventListener("click",()=>v.destroy()),n.style.position="relative",n.appendChild(g)}let i=n.querySelectorAll("[data-syntro-action]"),s=g=>{let y=g.currentTarget.getAttribute("data-syntro-action");y&&t.onAction&&t.onAction(y)};i.forEach(g=>g.addEventListener("click",s));let o=document.createElement("div");o.className="syntro-tooltip-arrow",n.appendChild(o),e.appendChild(n);let a=[Jo(t.offsetPx??8),ea(),Qo({padding:8}),Sg(),Eg({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Xo(r,n,async()=>{if(!r.isConnected){v.destroy();return}let g=hx(r),m=await ta(g,n,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:x,strategy:k,middlewareData:_,placement:w}=m;if(Object.assign(n.style,{left:`${y}px`,top:`${x}px`,position:k}),_.arrow){let{x:R,y:b}=_.arrow,A=w.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:R!=null?`${R}px`:"",top:b!=null?`${b}px`:"",right:"",bottom:"",[$[A]]:"-4px"});let N={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${N[A]||"0deg"})`}}),u=g=>{g.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let p=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),p.push(m.id||m.tagName))});let g=Array.from(n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(g.length>0){let m=g[0],y=g[g.length-1],x=k=>{k.key==="Tab"&&(k.shiftKey?document.activeElement===m&&(y.focus(),k.preventDefault()):document.activeElement===y&&(m.focus(),k.preventDefault()))};n.addEventListener("keydown",x),requestAnimationFrame(()=>m.focus())}}let f=(()=>{if(t.trigger==="hover"){let g=null,m=()=>{g&&(clearTimeout(g),g=null),n.style.visibility="visible",n.style.opacity="1"},y=()=>{g=setTimeout(()=>{n.style.visibility="hidden",n.style.opacity="0",g=null},100)};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("focus",m),r.addEventListener("blur",y),()=>{g&&clearTimeout(g),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("focus",m),r.removeEventListener("blur",y)}}if(t.trigger==="click"){let g=()=>{n.style.visibility==="visible"?v.destroy():(n.style.visibility="visible",n.style.opacity="1")};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("click",g),()=>r.removeEventListener("click",g)}return n.style.opacity="0",n.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{n.style.opacity="1"}),()=>{}})(),v={el:n,destroy(){c(),f(),window.removeEventListener("keydown",u),i.forEach(g=>g.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(g=>{g!==e&&g.removeAttribute("inert")}),n.style.pointerEvents="none",n.style.opacity="0",setTimeout(()=>{try{n.remove()}catch{}},200)}};return v}var ra=globalThis,na=ra.ShadowRoot&&(ra.ShadyCSS===void 0||ra.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ru=Symbol(),Ag=new WeakMap,ss=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ru)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(na&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ag.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ag.set(t,e))}return e}toString(){return this.cssText}},Rg=r=>new ss(typeof r=="string"?r:r+"",void 0,ru),Yr=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[s+1],r[0]);return new ss(t,r,ru)},Tg=(r,e)=>{if(na)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=ra.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},nu=na?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Rg(t)})(r):r;var{is:fx,defineProperty:gx,getOwnPropertyDescriptor:mx,getOwnPropertyNames:vx,getOwnPropertySymbols:yx,getPrototypeOf:_x}=Object,xr=globalThis,Ig=xr.trustedTypes,bx=Ig?Ig.emptyScript:"",xx=xr.reactiveElementPolyfillSupport,os=(r,e)=>r,iu={toAttribute(r,e){switch(e){case Boolean:r=r?bx:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Mg=(r,e)=>!fx(r,e),$g={attribute:!0,type:String,converter:iu,reflect:!1,useDefault:!1,hasChanged:Mg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),xr.litPropertyMetadata??(xr.litPropertyMetadata=new WeakMap);var Xt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$g){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&gx(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=mx(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){let a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$g}static _$Ei(){if(this.hasOwnProperty(os("elementProperties")))return;let e=_x(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(os("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(os("properties"))){let t=this.properties,n=[...vx(t),...yx(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(nu(i))}else e!==void 0&&t.push(nu(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Tg(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let s=(n.converter?.toAttribute!==void 0?n.converter:iu).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let s=n.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:iu;this._$Em=i;let a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,n,i=!1,s){if(e!==void 0){let o=this.constructor;if(i===!1&&(s=this[e]),n??(n=o.getPropertyOptions(e)),!((n.hasChanged??Mg)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,s]of n){let{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[os("elementProperties")]=new Map,Xt[os("finalized")]=new Map,xx?.({ReactiveElement:Xt}),(xr.reactiveElementVersions??(xr.reactiveElementVersions=[])).push("2.1.2");var ls=globalThis,Og=r=>r,ia=ls.trustedTypes,Pg=ia?ia.createPolicy("lit-html",{createHTML:r=>r}):void 0,Bg="$lit$",wr=`lit$${Math.random().toFixed(9).slice(2)}$`,Vg="?"+wr,wx=`<${Vg}>`,Qr=document,cs=()=>Qr.createComment(""),us=r=>r===null||typeof r!="object"&&typeof r!="function",du=Array.isArray,kx=r=>du(r)||typeof r?.[Symbol.iterator]=="function",su=`[
55
+ \f\r]`,as=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ng=/-->/g,Lg=/>/g,Xr=RegExp(`>|${su}(?:([^\\s"'>=/]+)(${su}*=${su}*(?:[^
56
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Fg=/'/g,Dg=/"/g,jg=/^(?:script|style|textarea|title)$/i,pu=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),j=pu(1),KR=pu(2),YR=pu(3),Tt=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),Hg=new WeakMap,Jr=Qr.createTreeWalker(Qr,129);function Wg(r,e){if(!du(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Pg!==void 0?Pg.createHTML(e):e}var Sx=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=as;for(let a=0;a<t;a++){let l=r[a],c,u,p=-1,h=0;for(;h<l.length&&(o.lastIndex=h,u=o.exec(l),u!==null);)h=o.lastIndex,o===as?u[1]==="!--"?o=Ng:u[1]!==void 0?o=Lg:u[2]!==void 0?(jg.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=Xr):u[3]!==void 0&&(o=Xr):o===Xr?u[0]===">"?(o=i??as,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?Xr:u[3]==='"'?Dg:Fg):o===Dg||o===Fg?o=Xr:o===Ng||o===Lg?o=as:(o=Xr,i=void 0);let f=o===Xr&&r[a+1].startsWith("/>")?" ":"";s+=o===as?l+wx:p>=0?(n.push(c),l.slice(0,p)+Bg+l.slice(p)+wr+f):l+wr+(p===-2?a:f)}return[Wg(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ds=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0,a=e.length-1,l=this.parts,[c,u]=Sx(e,t);if(this.el=r.createElement(c,n),Jr.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Jr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(Bg)){let h=u[o++],f=i.getAttribute(p).split(wr),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?au:v[1]==="?"?lu:v[1]==="@"?cu:Un}),i.removeAttribute(p)}else p.startsWith(wr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(jg.test(i.tagName)){let p=i.textContent.split(wr),h=p.length-1;if(h>0){i.textContent=ia?ia.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],cs()),Jr.nextNode(),l.push({type:2,index:++s});i.append(p[h],cs())}}}else if(i.nodeType===8)if(i.data===Vg)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(wr,p+1))!==-1;)l.push({type:7,index:s}),p+=wr.length-1}s++}}static createElement(e,t){let n=Qr.createElement("template");return n.innerHTML=e,n}};function Wn(r,e,t=r,n){if(e===Tt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=us(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Wn(r,i._$AS(r,e.values),i,n)),e}var ou=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??Qr).importNode(t,!0);Jr.currentNode=i;let s=Jr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new ps(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new uu(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=Jr.nextNode(),o++)}return Jr.currentNode=Qr,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ps=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Wn(this,e,t),us(e)?e===J||e==null||e===""?(this._$AH!==J&&this._$AR(),this._$AH=J):e!==this._$AH&&e!==Tt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):kx(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==J&&us(this._$AH)?this._$AA.nextSibling.data=e:this.T(Qr.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ds.createElement(Wg(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new ou(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Hg.get(e.strings);return t===void 0&&Hg.set(e.strings,t=new ds(e)),t}k(e){du(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let s of e)i===t.length?t.push(n=new r(this.O(cs()),this.O(cs()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Og(e).nextSibling;Og(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Un=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=J,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=J}_$AI(e,t=this,n,i){let s=this.strings,o=!1;if(s===void 0)e=Wn(this,e,t,0),o=!us(e)||e!==this._$AH&&e!==Tt,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Wn(this,a[n+l],t,l),c===Tt&&(c=this._$AH[l]),o||(o=!us(c)||c!==this._$AH[l]),c===J?e=J:e!==J&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},au=class extends Un{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},lu=class extends Un{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},cu=class extends Un{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Wn(this,e,t,0)??J)===Tt)return;let n=this._$AH,i=e===J&&n!==J||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==J&&(n===J||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},uu=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Wn(this,e)}};var Ex=ls.litHtmlPolyfillSupport;Ex?.(ds,ps),(ls.litHtmlVersions??(ls.litHtmlVersions=[])).push("3.3.2");var Ug=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new ps(e.insertBefore(cs(),s),s,void 0,t??{})}return i._$AI(r),i};var hs=globalThis,fe=class extends Xt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ug(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Tt}};fe._$litElement$=!0,fe.finalized=!0,hs.litElementHydrateSupport?.({LitElement:fe});var Cx=hs.litElementPolyfillSupport;Cx?.({LitElement:fe});(hs.litElementVersions??(hs.litElementVersions=[])).push("4.2.2");var sa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},oa=r=>(...e)=>({_$litDirective$:r,values:e}),zn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var zg="important",Ax=" !"+zg,I=oa(class extends zn{constructor(r){if(super(r),r.type!==sa.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(let n in e){let i=e[n];if(i!=null){this.ft.add(n);let s=typeof i=="string"&&i.endsWith(Ax);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?zg:""):t[n]=i}}return Tt}});var kr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},fs,gs,qn,Jt,ms,aa,Zn,qg="#1969fe",Rx="#24ad32",Tx="#0e1114",hu="#677384",Ix="#a8afba",Zg="#f6f7f9",$x="#ffffff";function Gg(r){let e=document.createElement("div");e.setAttribute("data-testid","workflow-toast"),Object.assign(e.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483646",padding:"12px 16px",borderRadius:"8px",backgroundColor:`var(--se-color-bg-surface, ${$x})`,color:`var(--se-color-text-primary, ${Tx})`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",maxWidth:"320px",fontFamily:"var(--se-font-family, system-ui, sans-serif)",fontSize:"14px",lineHeight:"1.4",transition:"opacity 0.3s ease"});let t=document.createElement("div");if(t.style.fontWeight="600",t.textContent=r.title,e.appendChild(t),r.body){let s=document.createElement("div");s.style.marginTop="4px",s.style.fontSize="13px",s.style.color="var(--se-color-text-secondary, #666)",s.textContent=r.body,e.appendChild(s)}document.body.appendChild(e);let n,i=setTimeout(()=>{e.style.opacity="0",n=setTimeout(()=>{e.remove()},300)},4e3);return()=>{clearTimeout(i),clearTimeout(n),e.remove()}}function Mx(r){let e=new Map;for(let t of r){let n=t.action;if(n.kind==="overlays:tour"&&n.workflow&&n.tourId){let i=n.workflow,o=(n.steps||[]).map(a=>({id:a.id,title:i.stepTitles?.[a.id]||a.id}));e.set(n.tourId,{meta:i,steps:o})}}return e}var Gn="syntro-workflow-tracker",vs=class extends fe{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,fs.set(this,null),gs.set(this,null),qn.set(this,[]),Jt.set(this,new Set),ms.set(this,{}),aa.set(this,!1),Zn.set(this,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let e=this.runtimeRef?.actions?.getActive?.()??[],t=Mx(e);if(kr(this,Zn,t,"f"),t.size===0)return;let n=this._stateNs,i=n?.get("dismissed")??[],s=n?.get("completed")??{};this._workflowEntries=(()=>{let o=new Set(this._workflowEntries.map(l=>l.tourId)),a=[];for(let[l,{meta:c,steps:u}]of t){if(o.has(l))continue;let p="active";i.includes(l)?p="dismissed":s[l]&&(p="completed"),a.push({tourId:l,meta:c,steps:u,currentStepId:null,completedSteps:[],status:p,completedAt:s[l]||void 0})}return a.length>0?[...this._workflowEntries,...a]:this._workflowEntries})();for(let[o,{meta:a}]of t){let l=n?.get("dismissed")??[],c=n?.get("completed")??{};if(!Fe(this,Jt,"f").has(o)&&a.notification&&!l.includes(o)&&!c[o]){Fe(this,Jt,"f").add(o),n?.set("notified",[...Fe(this,Jt,"f")]);let u=Gg(a.notification);Fe(this,qn,"f").push(u)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let e of Fe(this,qn,"f"))e();kr(this,qn,[],"f")}updated(e){e.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),e.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Fe(this,aa,"f")&&this._stateNs){let e=this._stateNs.get("notified")??[];for(let n of e)Fe(this,Jt,"f").add(n);let t=this._stateNs.get("completed")??{};kr(this,ms,{...t},"f"),kr(this,aa,!0,"f")}kr(this,fs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1}),"f"),kr(this,gs,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},e=>{this._handleTourEvent(e)}),"f"),this._rescanWorkflows()}}_teardownSubscriptions(){Fe(this,fs,"f")?.call(this),kr(this,fs,null,"f"),Fe(this,gs,"f")?.call(this),kr(this,gs,null,"f")}_handleTourEvent(e){let t=e.props?.tourId;if(!t)return;if(!Fe(this,Zn,"f").has(t)&&e.name==="tour.started"){this._actionVersion+=1;return}if(!Fe(this,Zn,"f").has(t))return;let n=this._stateNs;this._workflowEntries=this._workflowEntries.map(i=>{if(i.tourId!==t)return i;switch(e.name){case"tour.started":{let s=e.props?.startStepId||i.steps[0]?.id||null;if(!Fe(this,Jt,"f").has(t)){Fe(this,Jt,"f").add(t),n?.set("notified",[...Fe(this,Jt,"f")]);let a=Fe(this,Zn,"f").get(t);if(a?.meta.notification){let l=Gg(a.meta.notification);Fe(this,qn,"f").push(l)}}let o=this._workflowEntries.filter(a=>a.status==="active"||a.tourId===t).map(a=>a.tourId);return o.includes(t)||o.push(t),n?.set("active",[...new Set(o)]),{...i,status:"active",currentStepId:s,completedSteps:i.status==="active"?i.completedSteps:[]}}case"tour.step_started":{let s=e.props?.stepId;return{...i,currentStepId:s||i.currentStepId}}case"tour.step_changed":{let s=e.props?.previousStepId,o=e.props?.nextStepId,a=s&&!i.completedSteps.includes(s)?[...i.completedSteps,s]:i.completedSteps;return{...i,currentStepId:o||i.currentStepId,completedSteps:a}}case"tour.completed":{let s=Date.now();return Fe(this,ms,"f")[t]=s,n?.set("completed",{...Fe(this,ms,"f")}),{...i,status:"completed",currentStepId:null,completedSteps:i.steps.map(o=>o.id),completedAt:s}}case"tour.paused":return i;default:return i}})}_handleStepClick(e,t){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:e,stepId:t}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:e,stepId:t}}))}_handleDismiss(e){this._workflowEntries=this._workflowEntries.map(n=>n.tourId===e?{...n,status:"dismissed"}:n);let t=this._workflowEntries.filter(n=>n.status==="dismissed").map(n=>n.tourId);this._stateNs?.set("dismissed",t),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:e}}))}_renderProgressBar(e,t){let n=t>0?Math.round(e/t*100):0,i={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},s={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${qg})`,transition:"width 0.3s ease",width:`${n}%`};return j`
57
57
  <div style=${I(i)}>
58
58
  <div
59
59
  role="progressbar"
@@ -63,7 +63,7 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
63
63
  style=${I(s)}
64
64
  ></div>
65
65
  </div>
66
- `}_renderStepItem(e,t,n,i){let s={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:n?`var(--se-color-text-primary, ${Ug})`:`var(--se-color-text-secondary, ${Ax})`,fontWeight:n?"600":"400"},o={flexShrink:"0",width:"16px",textAlign:"center"},a={display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:n?`var(--se-color-primary, ${Wg})`:"rgba(255,255,255,0.12)"},l={color:`var(--se-color-success, ${Ex})`},c={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},u=t?j`<span role="img" aria-label="completed" style=${I(l)}>&#10003;</span>`:n?j`<span style=${I(a)}></span>`:j`<span style=${I(a)}></span>`;return j`
66
+ `}_renderStepItem(e,t,n,i){let s={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontSize:"12px",lineHeight:"1.4",color:n?`var(--se-color-text-primary, ${Zg})`:`var(--se-color-text-secondary, ${Ix})`,fontWeight:n?"600":"400"},o={flexShrink:"0",width:"16px",textAlign:"center"},a={display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:n?`var(--se-color-primary, ${qg})`:"rgba(255,255,255,0.12)"},l={color:`var(--se-color-success, ${Rx})`},c={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},u=t?j`<span role="img" aria-label="completed" style=${I(l)}>&#10003;</span>`:n?j`<span style=${I(a)}></span>`:j`<span style=${I(a)}></span>`;return j`
67
67
  <button
68
68
  type="button"
69
69
  data-testid=${`step-${e.id}`}
@@ -76,7 +76,7 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
76
76
  <span style=${I(o)}>${u}</span>
77
77
  <span style=${I(c)}>${e.title}</span>
78
78
  </button>
79
- `}_renderWorkflowCard(e){let t=e.completedSteps.length,n=e.steps.length,i={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},s={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},o={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${Ug})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${uu})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},l={marginBottom:"8px"},c={fontSize:"10px",color:`var(--se-color-text-tertiary, ${uu})`,marginTop:"4px"},u={display:"flex",flexDirection:"column"};return j`
79
+ `}_renderWorkflowCard(e){let t=e.completedSteps.length,n=e.steps.length,i={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},s={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},o={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${Zg})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${hu})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},l={marginBottom:"8px"},c={fontSize:"10px",color:`var(--se-color-text-tertiary, ${hu})`,marginTop:"4px"},u={display:"flex",flexDirection:"column"};return j`
80
80
  <div style=${I(i)}>
81
81
  <!-- Header: icon + title + dismiss -->
82
82
  <div style=${I(s)}>
@@ -104,11 +104,11 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
104
104
  ${e.steps.map(p=>this._renderStepItem(p,e.completedSteps.includes(p.id),e.currentStepId===p.id,e.tourId))}
105
105
  </div>
106
106
  </div>
107
- `}render(){let e=this._workflowEntries.filter(n=>n.status==="active");if(e.length===0){let n={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${uu})`};return j`<div style=${I(n)}>No active workflows</div>`}return j`
107
+ `}render(){let e=this._workflowEntries.filter(n=>n.status==="active");if(e.length===0){let n={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${hu})`};return j`<div style=${I(n)}>No active workflows</div>`}return j`
108
108
  <div style=${I({display:"flex",flexDirection:"column",gap:"8px"})}>
109
109
  ${e.map(n=>this._renderWorkflowCard(n))}
110
110
  </div>
111
- `}};fs=new WeakMap,gs=new WeakMap,qn=new WeakMap,Jt=new WeakMap,ms=new WeakMap,ia=new WeakMap,Zn=new WeakMap;vs.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(Gn)&&customElements.define(Gn,vs);var qg={mount(r,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(Gn)&&customElements.define(Gn,vs);let n=document.createElement(Gn);return n.runtimeRef=t,r.appendChild(n),()=>{n.remove()}},update(r,e){let t=r.querySelector(Gn);if(!t)return;let n=e?.runtime??null;t.runtimeRef=n}};var Zg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};if(t.getAttribute("data-syntro-highlight-dismissed"))return{cleanup:()=>{}};t.getAttribute("data-syntro-highlight")&&e.overlayRoot.querySelectorAll(".syntro-spotlight-scrim, .syntro-spotlight-ring").forEach(a=>a.remove()),t.setAttribute("data-syntro-highlight","true");let i=r.style?.color;if(!i)try{let o=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();o&&(i=o)}catch{}let s=Uf(t,e.overlayRoot,{paddingPx:r.style?.paddingPx??12,radiusPx:r.style?.radiusPx??12,scrimOpacity:r.style?.scrimOpacity??.55,ringColor:i,blocking:r.blocking??!1,onClickOutside:r.onClickOutside??!0,onEsc:r.onEsc??!0,onDismiss:()=>{t.setAttribute("data-syntro-highlight-dismissed","true")}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:highlight",anchorId:r.anchorId}),{cleanup:()=>{s.destroy(),t.removeAttribute("data-syntro-highlight"),t.removeAttribute("data-syntro-highlight-dismissed")}}},Gg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=r.duration??4e3;await new Promise(m=>requestAnimationFrame(m));let i=m=>({r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16)}),o={r:79,g:70,b:229},a=null;try{let m=getComputedStyle(e.overlayRoot),g=m.getPropertyValue("--sc-color-primary")?.trim(),y=m.getPropertyValue("--sc-color-primary-hover")?.trim();g?.startsWith("#")&&g.length>=7&&(o=i(g)),y?.startsWith("#")&&y.length>=7&&(a=i(y))}catch{}let l=document.querySelector("[data-syntro-pulse-styles]");l&&l.remove();let c=document.createElement("style");c.setAttribute("data-syntro-pulse-styles","");let{r:u,g:p,b:h}=o;if(a){let{r:m,g,b:y}=a;c.textContent=`
111
+ `}};fs=new WeakMap,gs=new WeakMap,qn=new WeakMap,Jt=new WeakMap,ms=new WeakMap,aa=new WeakMap,Zn=new WeakMap;vs.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(Gn)&&customElements.define(Gn,vs);var Kg={mount(r,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(Gn)&&customElements.define(Gn,vs);let n=document.createElement(Gn);return n.runtimeRef=t,r.appendChild(n),()=>{n.remove()}},update(r,e){let t=r.querySelector(Gn);if(!t)return;let n=e?.runtime??null;t.runtimeRef=n}};var Yg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};if(t.getAttribute("data-syntro-highlight-dismissed"))return{cleanup:()=>{}};t.getAttribute("data-syntro-highlight")&&e.overlayRoot.querySelectorAll(".syntro-spotlight-scrim, .syntro-spotlight-ring").forEach(a=>a.remove()),t.setAttribute("data-syntro-highlight","true");let i=r.style?.color;if(!i)try{let o=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();o&&(i=o)}catch{}let s=Zf(t,e.overlayRoot,{paddingPx:r.style?.paddingPx??12,radiusPx:r.style?.radiusPx??12,scrimOpacity:r.style?.scrimOpacity??.55,ringColor:i,blocking:r.blocking??!1,onClickOutside:r.onClickOutside??!0,onEsc:r.onEsc??!0,onDismiss:()=>{t.setAttribute("data-syntro-highlight-dismissed","true")}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:highlight",anchorId:r.anchorId}),{cleanup:()=>{s.destroy(),t.removeAttribute("data-syntro-highlight"),t.removeAttribute("data-syntro-highlight-dismissed")}}},Xg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=r.duration??4e3;await new Promise(g=>requestAnimationFrame(g));let i=g=>({r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16)}),o={r:79,g:70,b:229},a=null;try{let g=getComputedStyle(e.overlayRoot),m=g.getPropertyValue("--sc-color-primary")?.trim(),y=g.getPropertyValue("--sc-color-primary-hover")?.trim();m?.startsWith("#")&&m.length>=7&&(o=i(m)),y?.startsWith("#")&&y.length>=7&&(a=i(y))}catch{}let l=document.querySelector("[data-syntro-pulse-styles]");l&&l.remove();let c=document.createElement("style");c.setAttribute("data-syntro-pulse-styles","");let{r:u,g:p,b:h}=o;if(a){let{r:g,g:m,b:y}=a;c.textContent=`
112
112
  @keyframes syntro-pulse-anim {
113
113
  0%, 100% {
114
114
  box-shadow: 0 0 0 0 rgba(${u}, ${p}, ${h}, 0.35);
@@ -117,10 +117,10 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
117
117
  box-shadow: 0 0 0 12px rgba(${u}, ${p}, ${h}, 0);
118
118
  }
119
119
  50% {
120
- box-shadow: 0 0 0 0 rgba(${m}, ${g}, ${y}, 0.35);
120
+ box-shadow: 0 0 0 0 rgba(${g}, ${m}, ${y}, 0.35);
121
121
  }
122
122
  75% {
123
- box-shadow: 0 0 0 12px rgba(${m}, ${g}, ${y}, 0);
123
+ box-shadow: 0 0 0 12px rgba(${g}, ${m}, ${y}, 0);
124
124
  }
125
125
  }
126
126
  `}else c.textContent=`
@@ -132,22 +132,22 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
132
132
  box-shadow: 0 0 0 12px rgba(${u}, ${p}, ${h}, 0);
133
133
  }
134
134
  }
135
- `;document.head.appendChild(c);let f=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=f,t.removeAttribute("data-syntro-pulse")},n);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:r.anchorId,duration:n}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=f,t.removeAttribute("data-syntro-pulse"))}}},Kg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n="#4f46e5";try{let a=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();a?.startsWith("#")&&a.length>=7&&(n=a)}catch{}let i=document.createElement("div");i.textContent=r.content,i.setAttribute("data-syntro-badge",r.anchorId.selector),Object.assign(i.style,{position:"absolute",padding:"2px 6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",color:"white",background:n,borderRadius:"9999px",pointerEvents:"none",zIndex:"2147483646",whiteSpace:"nowrap"});let s=r.position??"top-right",o=t.style.position;switch(getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(i),s){case"top-left":Object.assign(i.style,{top:"-8px",left:"-8px"});break;case"top-right":Object.assign(i.style,{top:"-8px",right:"-8px"});break;case"bottom-left":Object.assign(i.style,{bottom:"-8px",left:"-8px"});break;case"bottom-right":Object.assign(i.style,{bottom:"-8px",right:"-8px"});break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:badge",anchorId:r.anchorId,content:r.content,position:s}),{cleanup:()=>{try{i.remove()}catch{}t.isConnected&&o!==void 0&&(t.style.position=o)},updateFn:a=>{"content"in a&&typeof a.content=="string"&&(i.textContent=a.content)}}},Yg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let{content:n}=r,i="";if(n.title&&(i+=`<div class="syntro-tt-title">${lt(n.title)}</div>`),i+=`<div class="syntro-tt-body">${lt(n.body)}</div>`,n.ctaButtons&&n.ctaButtons.length>0){i+='<div class="syntro-tt-actions">';for(let o of n.ctaButtons){let a=o.primary??!1;i+=`
135
+ `;document.head.appendChild(c);let f=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=f,t.removeAttribute("data-syntro-pulse")},n);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:r.anchorId,duration:n}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=f,t.removeAttribute("data-syntro-pulse"))}}},Jg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n="#4f46e5";try{let a=getComputedStyle(e.overlayRoot).getPropertyValue("--sc-color-primary")?.trim();a?.startsWith("#")&&a.length>=7&&(n=a)}catch{}let i=document.createElement("div");i.textContent=r.content,i.setAttribute("data-syntro-badge",r.anchorId.selector),Object.assign(i.style,{position:"absolute",padding:"2px 6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",color:"white",background:n,borderRadius:"9999px",pointerEvents:"none",zIndex:"2147483646",whiteSpace:"nowrap"});let s=r.position??"top-right",o=t.style.position;switch(getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(i),s){case"top-left":Object.assign(i.style,{top:"-8px",left:"-8px"});break;case"top-right":Object.assign(i.style,{top:"-8px",right:"-8px"});break;case"bottom-left":Object.assign(i.style,{bottom:"-8px",left:"-8px"});break;case"bottom-right":Object.assign(i.style,{bottom:"-8px",right:"-8px"});break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:badge",anchorId:r.anchorId,content:r.content,position:s}),{cleanup:()=>{try{i.remove()}catch{}t.isConnected&&o!==void 0&&(t.style.position=o)},updateFn:a=>{"content"in a&&typeof a.content=="string"&&(i.textContent=a.content)}}},Qg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let{content:n}=r,i="";if(n.title&&(i+=`<div class="syntro-tt-title">${ct(n.title)}</div>`),i+=`<div class="syntro-tt-body">${ct(n.body)}</div>`,n.ctaButtons&&n.ctaButtons.length>0){i+='<div class="syntro-tt-actions">';for(let o of n.ctaButtons){let a=o.primary??!1;i+=`
136
136
  <button
137
137
  class="syntro-tt-btn ${a?"syntro-tt-btn-primary":""}"
138
- data-syntro-action="${lt(o.actionId)}"
138
+ data-syntro-action="${ct(o.actionId)}"
139
139
  >
140
- ${lt(o.label)}
140
+ ${ct(o.label)}
141
141
  </button>
142
142
  `}i+="</div>"}else n.cta&&(i+=`<div class="syntro-tt-actions">
143
143
  <button class="syntro-tt-btn syntro-tt-btn-primary" data-syntro-action="cta">
144
- ${lt(n.cta.label)}
144
+ ${ct(n.cta.label)}
145
145
  </button>
146
- </div>`);let s=kg(t,e.overlayRoot,{html:i,placement:r.placement??"top",trigger:r.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&n.cta)e.publishEvent("action.cta_clicked",{anchorId:r.anchorId,ctaLabel:n.cta.label});else if(n.ctaButtons){let a=n.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},du=[{kind:"overlays:highlight",executor:Zg},{kind:"overlays:pulse",executor:Gg},{kind:"overlays:badge",executor:Kg},{kind:"overlays:tooltip",executor:Yg},{kind:"overlays:modal",executor:Gc},{kind:"overlays:tour",executor:qc},{kind:"overlays:celebrate",executor:jf}],pu={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:du,widgets:[{id:"adaptive-overlays:workflow-tracker",component:qg,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function hu(r){let{appId:e,runtime:t,isBuiltIn:n=!1}=r,i=`app:${e}:`,s=[],o=[],a=t.state.ns(`app:${e}`);return{appId:e,state:{get:c=>a.get(c),set:(c,u)=>a.set(c,u),remove:c=>a.remove(c)},telemetry:t.telemetry?{emit:(c,u)=>{t.events.publish(c,{...u,_appId:e})},getSessionId:()=>t.telemetry?.getSessionId?.()}:void 0,surfaces:{mount:(c,u,p)=>{let h=t.surfaces.mount(c,u,{...p,adaptiveId:e});return{unmount:()=>h.unmount(),update:f=>h.update(f)}},canMount:(c,u)=>t.surfaces.canMount(c,u)},events:{subscribe:c=>t.events.subscribe(u=>{c(u)}),publish:(c,u)=>{t.events.publish(c,{...u,_appId:e})}},registerAction:c=>{t.executors.register(c.kind,c.executor,c.schema,e,n),s.push(c.kind)},registerWidget:c=>{t.widgets.register(c.id,c.component,e,c.metadata),o.push(c.id)}}}function fu(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var Ix=new Set(["overlays:highlight","overlays:pulse","overlays:badge","overlays:tooltip","overlays:modal","content:insertHtml","content:setText","content:setAttr","content:addClass","content:removeClass","content:setStyle","core:mountWidget","core:wait","core:sequence","core:parallel","overlays:tour"]),$x=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),Mx={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function Xg(r){return Mx[r]??r}function Jg(r){return Ix.has(r)}function Qg(r){if(Jg(r))return null;let e=r.indexOf(":");return e===-1?null:Xg(r.slice(0,e))}function gu(r){let e=r.indexOf(":");return e===-1?null:Xg(r.slice(0,e))}function mu(r){let{cdnBase:e,registry:t,timeout:n=1e4,onLoadStart:i,onLoadEnd:s}=r,o=new Map,a=new Set,l=new Map;function c(m){return`${e}/adaptives/${m}/index.js`}async function u(m){if(t.has(m))return{appId:m,success:!0,manifest:t.get(m)?.manifest};if(l.has(m))return l.get(m);if(o.has(m))return o.get(m);let g=(async()=>{i?.(m);try{let y=c(m);if(a.has(y)){let w=t.get(m);if(w)return s?.(m,!0),{appId:m,success:!0,manifest:w.manifest}}let x=new Promise((w,R)=>{setTimeout(()=>R(new Error(`Timeout loading app: ${m}`)),n)}),k=p(y,m);await Promise.race([k,x]),a.add(y);let _=t.get(m);if(!_)throw new Error(`App ${m} did not register after loading`);return s?.(m,!0),{appId:m,success:!0,manifest:_.manifest}}catch(y){let x=y instanceof Error?y.message:String(y);s?.(m,!1,x);let k={appId:m,success:!1,error:x};return l.set(m,k),k}finally{o.delete(m)}})();return o.set(m,g),g}async function p(m,g){if(typeof window<"u"){try{let y=await import(m);y.manifest?t.register(y.manifest):y.default?.manifest?t.register(y.default.manifest):y.default&&t.register(y.default);return}catch{}return new Promise((y,x)=>{let k=document.createElement("script");k.src=m,k.async=!0,k.onload=()=>{t.get(g)?y():x(new Error(`App ${g} did not self-register`))},k.onerror=()=>{x(new Error(`Failed to load app script: ${m}`))},document.head.appendChild(k)})}throw new Error("Dynamic app loading not supported in SSR")}function h(m){let g=new Set;if(m.apps)for(let y of m.apps)g.add(y);if(m.actions)for(let y of m.actions){let x=Qg(y.kind);if(x&&g.add(x),y.kind==="core:mountWidget"){let k=y.widget?.widgetId;if(k){let _=gu(k);_&&g.add(_)}}}if(m.tiles){for(let y of m.tiles)if(y.widget){let x=gu(y.widget);x&&g.add(x)}}for(let y of $x)g.delete(y);return Array.from(g)}async function f(m){let g=h(m);return g.length===0?[]:await Promise.all(g.map(x=>u(x)))}async function v(m){return Promise.all(m.map(g=>u(g)))}return{loadApp:u,loadAppsForConfig:f,preloadApps:v,getRequiredApps:h,getAppUrl:c}}var Kn=class{constructor(){this.apps=new Map;this.eventListeners=new Set;this.runtime=null}bind(e){this.runtime=e}async unbind(){for(let[e,t]of this.apps)t.state==="active"&&await this.deactivate(e);this.runtime=null}register(e){if(!e.id||typeof e.id!="string")throw new Error("App manifest must have an 'id' property");if(!e.version||typeof e.version!="string")throw new Error("App manifest must have a 'version' property");if(!e.name||typeof e.name!="string")throw new Error("App manifest must have a 'name' property");if(this.apps.has(e.id)){if(this.apps.get(e.id).state==="active")throw new Error(`Cannot re-register active app: ${e.id}`);console.warn(`[AppRegistry] Overriding existing app registration: ${e.id}`)}let t={manifest:e,state:"registered",registeredAt:Date.now()};return this.apps.set(e.id,t),this.emit({type:"app:registered",appId:e.id,manifest:e}),t}async activate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state==="active"||t.state==="activating"){console.warn(`[AppRegistry] App already ${t.state}: ${e}`);return}if(!this.runtime)throw new Error("AppRegistry not bound to a runtime. Call bind() first.");if(t.manifest.dependencies)for(let n of t.manifest.dependencies){let i=this.apps.get(n);if(!i||i.state!=="active")throw new Error(`App ${e} depends on ${n}, which is not active`)}t.state="activating";try{let n=t.manifest.metadata?.isBuiltIn===!0,i=hu({appId:e,runtime:this.runtime,isBuiltIn:n}),{runtime:s}=t.manifest,o=[];if(s){if(s.actions)for(let a of s.actions)i.registerAction(a);if(s.widgets)for(let a of s.widgets)i.registerWidget(a);if(s.events)for(let a of s.events){let l=this.runtime.events.subscribe(c=>{if(a.names.includes(c.name)){let u={appId:e,state:i.state,telemetry:i.telemetry,surfaces:i.surfaces};try{a.handler(c,u)}catch(p){console.error(`[AppRegistry] Event handler error in ${e}:`,p)}}});o.push(l)}}t.cleanup=async()=>{for(let a of o)try{await a()}catch(l){console.error(`[AppRegistry] Cleanup error in ${e}:`,l)}fu(e,this.runtime)},t.state="active",t.activatedAt=Date.now(),this.emit({type:"app:activated",appId:e})}catch(n){throw t.state="error",t.error=String(n),this.emit({type:"app:error",appId:e,error:String(n)}),n}}async deactivate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state!=="active"){console.warn(`[AppRegistry] App not active: ${e}`);return}for(let[n,i]of this.apps)if(i.state==="active"&&i.manifest.dependencies?.includes(e))throw new Error(`Cannot deactivate ${e}: app ${n} depends on it`);t.state="deactivating";try{t.cleanup&&(await t.cleanup(),t.cleanup=void 0),t.state="inactive",this.emit({type:"app:deactivated",appId:e})}catch(n){throw t.state="error",t.error=String(n),this.emit({type:"app:error",appId:e,error:String(n)}),n}}async unregister(e){let t=this.apps.get(e);t&&(t.state==="active"&&await this.deactivate(e),this.apps.delete(e),this.emit({type:"app:unregistered",appId:e}))}get(e){return this.apps.get(e)}has(e){return this.apps.has(e)}isActive(e){return this.apps.get(e)?.state==="active"}list(){return Array.from(this.apps.values())}listActive(){return Array.from(this.apps.values()).filter(e=>e.state==="active")}listEditable(){return Array.from(this.apps.values()).filter(e=>e.manifest.editor!==void 0)}subscribe(e){return this.eventListeners.add(e),()=>{this.eventListeners.delete(e)}}emit(e){for(let t of this.eventListeners)try{t(e)}catch(n){console.error("[AppRegistry] Event listener error:",n)}}async destroy(){await this.unbind(),this.apps.clear(),this.eventListeners.clear()}},ys=new Kn;function em(r,e,t){if(e){let n=r.getState().items.find(i=>i.config.id===e);if(n)return n}if(t){let n=r.findByQuestion(t);if(n)return n}throw new Error("FAQ item not found")}async function Ox(r,e,t){let n=em(t,r.itemId,r.itemQuestion),{id:i}=n.config;r.expand!==!1&&t.expand(i);let s=document.querySelector(`[data-faq-item-id="${i}"]`);return s&&s.scrollIntoView({behavior:r.behavior??"smooth"}),e.publishEvent("faq:scroll_to",{itemId:i}),{cleanup:()=>{}}}async function Px(r,e,t){let n=em(t,r.itemId,r.itemQuestion),{id:i}=n.config,s=r.state??"toggle",o;switch(s){case"open":t.expand(i),o="open";break;case"closed":t.collapse(i),o="closed";break;default:{let a=t.getState().expandedItems.has(i);t.toggle(i),o=a?"closed":"open";break}}return e.publishEvent("faq:toggle",{itemId:i,newState:o}),{cleanup:()=>{}}}async function Nx(r,e,t){switch(r.operation){case"add":{let n=r.items??[],i=r.position==="prepend"?"prepend":"append";t.addItems(n,i);break}case"remove":{if(!r.itemId)throw new Error("FAQ item not found");if(!t.getState().items.some(i=>i.config.id===r.itemId))throw new Error("FAQ item not found");t.removeItem(r.itemId);break}case"reorder":{let n=r.order??[];t.reorderItems(n);break}case"replace":{let n=r.items??[];t.replaceItems(n);break}}return e.publishEvent("faq:update",{operation:r.operation}),{cleanup:()=>{}}}var tm=[{kind:"faq:scroll_to",executor:Ox},{kind:"faq:toggle_item",executor:Px},{kind:"faq:update",executor:Nx}];var _s=class extends zn{constructor(e){if(super(e),this.it=J,e.type!==ra.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===J||e==null)return this._t=void 0,this.it=e;if(e===Tt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};_s.directiveName="unsafeHTML",_s.resultType=1;var sa=na(_s);function bu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rn=bu();function lm(r){rn=r}var en={exec:()=>null};function de(r,e=""){let t=typeof r=="string"?r:r.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ye.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var Lx=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ye={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}>`)},Fx=/^(?:[ \t]*(?:\n|$))+/,Dx=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hx=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ks=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bx=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,cm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,um=de(cm).replace(/bull/g,xu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Vx=de(cm).replace(/bull/g,xu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),wu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jx=/^[^\n]+/,ku=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Wx=de(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ku).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ux=de(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xu).getRegex(),da="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Su=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zx=de("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Su).replace("tag",da).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),dm=de(wu).replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex(),qx=de(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",dm).getRegex(),Eu={blockquote:qx,code:Dx,def:Wx,fences:Hx,heading:Bx,hr:ks,html:zx,lheading:um,list:Ux,newline:Fx,paragraph:dm,table:en,text:jx},rm=de("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex(),Zx={...Eu,lheading:Vx,table:rm,paragraph:de(wu).replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex()},Gx={...Eu,html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Su).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:en,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:de(wu).replace("hr",ks).replace("heading",` *#{1,6} *[^
147
- ]`).replace("lheading",um).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Kx=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Yx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pm=/^( {2,}|\\)\n(?!\s*$)/,Xx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,pa=/[\p{P}\p{S}]/u,Cu=/[\s\p{P}\p{S}]/u,hm=/[^\s\p{P}\p{S}]/u,Jx=de(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Cu).getRegex(),fm=/(?!~)[\p{P}\p{S}]/u,Qx=/(?!~)[\s\p{P}\p{S}]/u,ew=/(?:[^\s\p{P}\p{S}]|~)/u,gm=/(?![*_])[\p{P}\p{S}]/u,tw=/(?![*_])[\s\p{P}\p{S}]/u,rw=/(?:[^\s\p{P}\p{S}]|[*_])/u,nw=de(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Lx?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mm=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,iw=de(mm,"u").replace(/punct/g,pa).getRegex(),sw=de(mm,"u").replace(/punct/g,fm).getRegex(),vm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ow=de(vm,"gu").replace(/notPunctSpace/g,hm).replace(/punctSpace/g,Cu).replace(/punct/g,pa).getRegex(),aw=de(vm,"gu").replace(/notPunctSpace/g,ew).replace(/punctSpace/g,Qx).replace(/punct/g,fm).getRegex(),lw=de("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hm).replace(/punctSpace/g,Cu).replace(/punct/g,pa).getRegex(),cw=de(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,gm).getRegex(),uw="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",dw=de(uw,"gu").replace(/notPunctSpace/g,rw).replace(/punctSpace/g,tw).replace(/punct/g,gm).getRegex(),pw=de(/\\(punct)/,"gu").replace(/punct/g,pa).getRegex(),hw=de(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fw=de(Su).replace("(?:-->|$)","-->").getRegex(),gw=de("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",fw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),la=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,mw=de(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",la).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ym=de(/^!?\[(label)\]\[(ref)\]/).replace("label",la).replace("ref",ku).getRegex(),_m=de(/^!?\[(ref)\](?:\[\])?/).replace("ref",ku).getRegex(),vw=de("reflink|nolink(?!\\()","g").replace("reflink",ym).replace("nolink",_m).getRegex(),nm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Au={_backpedal:en,anyPunctuation:pw,autolink:hw,blockSkip:nw,br:pm,code:Yx,del:en,delLDelim:en,delRDelim:en,emStrongLDelim:iw,emStrongRDelimAst:ow,emStrongRDelimUnd:lw,escape:Kx,link:mw,nolink:_m,punctuation:Jx,reflink:ym,reflinkSearch:vw,tag:gw,text:Xx,url:en},yw={...Au,link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",la).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",la).getRegex()},vu={...Au,emStrongRDelimAst:aw,emStrongLDelim:sw,delLDelim:cw,delRDelim:dw,url:de(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",nm).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:de(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",nm).getRegex()},_w={...vu,br:de(pm).replace("{2,}","*").getRegex(),text:de(vu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},oa={normal:Eu,gfm:Zx,pedantic:Gx},bs={normal:Au,gfm:vu,breaks:_w,pedantic:yw},bw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},im=r=>bw[r];function Dt(r,e){if(e){if(Ye.escapeTest.test(r))return r.replace(Ye.escapeReplace,im)}else if(Ye.escapeTestNoEncode.test(r))return r.replace(Ye.escapeReplaceNoEncode,im);return r}function sm(r){try{r=encodeURI(r).replace(Ye.percentDecode,"%")}catch{return null}return r}function om(r,e){let t=r.replace(Ye.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Ye.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(Ye.slashPipe,"|");return n}function xs(r,e,t){let n=r.length;if(n===0)return"";let i=0;for(;i<n;){let s=r.charAt(n-i-1);if(s===e&&!t)i++;else if(s!==e&&t)i++;else break}return r.slice(0,n-i)}function xw(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function ww(r,e=0){let t=e,n="";for(let i of r)if(i===" "){let s=4-t%4;n+=" ".repeat(s),t+=s}else n+=i,t++;return n}function am(r,e,t,n,i){let s=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function kw(r,e,t){let n=r.match(t.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
146
+ </div>`);let s=Cg(t,e.overlayRoot,{html:i,placement:r.placement??"top",trigger:r.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&n.cta)e.publishEvent("action.cta_clicked",{anchorId:r.anchorId,ctaLabel:n.cta.label});else if(n.ctaButtons){let a=n.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},fu=[{kind:"overlays:highlight",executor:Yg},{kind:"overlays:pulse",executor:Xg},{kind:"overlays:badge",executor:Jg},{kind:"overlays:tooltip",executor:Qg},{kind:"overlays:modal",executor:Xc},{kind:"overlays:tour",executor:Kc},{kind:"overlays:celebrate",executor:zf}],gu={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:fu,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Kg,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function mu(r){let{appId:e,runtime:t,isBuiltIn:n=!1}=r,i=`app:${e}:`,s=[],o=[],a=t.state.ns(`app:${e}`);return{appId:e,state:{get:c=>a.get(c),set:(c,u)=>a.set(c,u),remove:c=>a.remove(c)},telemetry:t.telemetry?{emit:(c,u)=>{t.events.publish(c,{...u,_appId:e})},getSessionId:()=>t.telemetry?.getSessionId?.()}:void 0,surfaces:{mount:(c,u,p)=>{let h=t.surfaces.mount(c,u,{...p,adaptiveId:e});return{unmount:()=>h.unmount(),update:f=>h.update(f)}},canMount:(c,u)=>t.surfaces.canMount(c,u)},events:{subscribe:c=>t.events.subscribe(u=>{c(u)}),publish:(c,u)=>{t.events.publish(c,{...u,_appId:e})}},registerAction:c=>{t.executors.register(c.kind,c.executor,c.schema,e,n),s.push(c.kind)},registerWidget:c=>{t.widgets.register(c.id,c.component,e,c.metadata),o.push(c.id)}}}function vu(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var Ox=new Set(["overlays:highlight","overlays:pulse","overlays:badge","overlays:tooltip","overlays:modal","content:insertHtml","content:setText","content:setAttr","content:addClass","content:removeClass","content:setStyle","core:mountWidget","core:wait","core:sequence","core:parallel","overlays:tour"]),Px=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),Nx={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function em(r){return Nx[r]??r}function tm(r){return Ox.has(r)}function rm(r){if(tm(r))return null;let e=r.indexOf(":");return e===-1?null:em(r.slice(0,e))}function yu(r){let e=r.indexOf(":");return e===-1?null:em(r.slice(0,e))}function _u(r){let{cdnBase:e,registry:t,timeout:n=1e4,onLoadStart:i,onLoadEnd:s}=r,o=new Map,a=new Set,l=new Map;function c(g){return`${e}/adaptives/${g}/index.js`}async function u(g){if(t.has(g))return{appId:g,success:!0,manifest:t.get(g)?.manifest};if(l.has(g))return l.get(g);if(o.has(g))return o.get(g);let m=(async()=>{i?.(g);try{let y=c(g);if(a.has(y)){let w=t.get(g);if(w)return s?.(g,!0),{appId:g,success:!0,manifest:w.manifest}}let x=new Promise((w,R)=>{setTimeout(()=>R(new Error(`Timeout loading app: ${g}`)),n)}),k=p(y,g);await Promise.race([k,x]),a.add(y);let _=t.get(g);if(!_)throw new Error(`App ${g} did not register after loading`);return s?.(g,!0),{appId:g,success:!0,manifest:_.manifest}}catch(y){let x=y instanceof Error?y.message:String(y);s?.(g,!1,x);let k={appId:g,success:!1,error:x};return l.set(g,k),k}finally{o.delete(g)}})();return o.set(g,m),m}async function p(g,m){if(typeof window<"u"){try{let y=await import(g);y.manifest?t.register(y.manifest):y.default?.manifest?t.register(y.default.manifest):y.default&&t.register(y.default);return}catch{}return new Promise((y,x)=>{let k=document.createElement("script");k.src=g,k.async=!0,k.onload=()=>{t.get(m)?y():x(new Error(`App ${m} did not self-register`))},k.onerror=()=>{x(new Error(`Failed to load app script: ${g}`))},document.head.appendChild(k)})}throw new Error("Dynamic app loading not supported in SSR")}function h(g){let m=new Set;if(g.apps)for(let y of g.apps)m.add(y);if(g.actions)for(let y of g.actions){let x=rm(y.kind);if(x&&m.add(x),y.kind==="core:mountWidget"){let k=y.widget?.widgetId;if(k){let _=yu(k);_&&m.add(_)}}}if(g.tiles){for(let y of g.tiles)if(y.widget){let x=yu(y.widget);x&&m.add(x)}}for(let y of Px)m.delete(y);return Array.from(m)}async function f(g){let m=h(g);return m.length===0?[]:await Promise.all(m.map(x=>u(x)))}async function v(g){return Promise.all(g.map(m=>u(m)))}return{loadApp:u,loadAppsForConfig:f,preloadApps:v,getRequiredApps:h,getAppUrl:c}}var Kn=class{constructor(){this.apps=new Map;this.eventListeners=new Set;this.runtime=null}bind(e){this.runtime=e}async unbind(){for(let[e,t]of this.apps)t.state==="active"&&await this.deactivate(e);this.runtime=null}register(e){if(!e.id||typeof e.id!="string")throw new Error("App manifest must have an 'id' property");if(!e.version||typeof e.version!="string")throw new Error("App manifest must have a 'version' property");if(!e.name||typeof e.name!="string")throw new Error("App manifest must have a 'name' property");if(this.apps.has(e.id)){if(this.apps.get(e.id).state==="active")throw new Error(`Cannot re-register active app: ${e.id}`);console.warn(`[AppRegistry] Overriding existing app registration: ${e.id}`)}let t={manifest:e,state:"registered",registeredAt:Date.now()};return this.apps.set(e.id,t),this.emit({type:"app:registered",appId:e.id,manifest:e}),t}async activate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state==="active"||t.state==="activating"){console.warn(`[AppRegistry] App already ${t.state}: ${e}`);return}if(!this.runtime)throw new Error("AppRegistry not bound to a runtime. Call bind() first.");if(t.manifest.dependencies)for(let n of t.manifest.dependencies){let i=this.apps.get(n);if(!i||i.state!=="active")throw new Error(`App ${e} depends on ${n}, which is not active`)}t.state="activating";try{let n=t.manifest.metadata?.isBuiltIn===!0,i=mu({appId:e,runtime:this.runtime,isBuiltIn:n}),{runtime:s}=t.manifest,o=[];if(s){if(s.actions)for(let a of s.actions)i.registerAction(a);if(s.widgets)for(let a of s.widgets)i.registerWidget(a);if(s.events)for(let a of s.events){let l=this.runtime.events.subscribe(c=>{if(a.names.includes(c.name)){let u={appId:e,state:i.state,telemetry:i.telemetry,surfaces:i.surfaces};try{a.handler(c,u)}catch(p){console.error(`[AppRegistry] Event handler error in ${e}:`,p)}}});o.push(l)}}t.cleanup=async()=>{for(let a of o)try{await a()}catch(l){console.error(`[AppRegistry] Cleanup error in ${e}:`,l)}vu(e,this.runtime)},t.state="active",t.activatedAt=Date.now(),this.emit({type:"app:activated",appId:e})}catch(n){throw t.state="error",t.error=String(n),this.emit({type:"app:error",appId:e,error:String(n)}),n}}async deactivate(e){let t=this.apps.get(e);if(!t)throw new Error(`App not registered: ${e}`);if(t.state!=="active"){console.warn(`[AppRegistry] App not active: ${e}`);return}for(let[n,i]of this.apps)if(i.state==="active"&&i.manifest.dependencies?.includes(e))throw new Error(`Cannot deactivate ${e}: app ${n} depends on it`);t.state="deactivating";try{t.cleanup&&(await t.cleanup(),t.cleanup=void 0),t.state="inactive",this.emit({type:"app:deactivated",appId:e})}catch(n){throw t.state="error",t.error=String(n),this.emit({type:"app:error",appId:e,error:String(n)}),n}}async unregister(e){let t=this.apps.get(e);t&&(t.state==="active"&&await this.deactivate(e),this.apps.delete(e),this.emit({type:"app:unregistered",appId:e}))}get(e){return this.apps.get(e)}has(e){return this.apps.has(e)}isActive(e){return this.apps.get(e)?.state==="active"}list(){return Array.from(this.apps.values())}listActive(){return Array.from(this.apps.values()).filter(e=>e.state==="active")}listEditable(){return Array.from(this.apps.values()).filter(e=>e.manifest.editor!==void 0)}subscribe(e){return this.eventListeners.add(e),()=>{this.eventListeners.delete(e)}}emit(e){for(let t of this.eventListeners)try{t(e)}catch(n){console.error("[AppRegistry] Event listener error:",n)}}async destroy(){await this.unbind(),this.apps.clear(),this.eventListeners.clear()}},ys=new Kn;function nm(r,e,t){if(e){let n=r.getState().items.find(i=>i.config.id===e);if(n)return n}if(t){let n=r.findByQuestion(t);if(n)return n}throw new Error("FAQ item not found")}async function Lx(r,e,t){let n=nm(t,r.itemId,r.itemQuestion),{id:i}=n.config;r.expand!==!1&&t.expand(i);let s=document.querySelector(`[data-faq-item-id="${i}"]`);return s&&s.scrollIntoView({behavior:r.behavior??"smooth"}),e.publishEvent("faq:scroll_to",{itemId:i}),{cleanup:()=>{}}}async function Fx(r,e,t){let n=nm(t,r.itemId,r.itemQuestion),{id:i}=n.config,s=r.state??"toggle",o;switch(s){case"open":t.expand(i),o="open";break;case"closed":t.collapse(i),o="closed";break;default:{let a=t.getState().expandedItems.has(i);t.toggle(i),o=a?"closed":"open";break}}return e.publishEvent("faq:toggle",{itemId:i,newState:o}),{cleanup:()=>{}}}async function Dx(r,e,t){switch(r.operation){case"add":{let n=r.items??[],i=r.position==="prepend"?"prepend":"append";t.addItems(n,i);break}case"remove":{if(!r.itemId)throw new Error("FAQ item not found");if(!t.getState().items.some(i=>i.config.id===r.itemId))throw new Error("FAQ item not found");t.removeItem(r.itemId);break}case"reorder":{let n=r.order??[];t.reorderItems(n);break}case"replace":{let n=r.items??[];t.replaceItems(n);break}}return e.publishEvent("faq:update",{operation:r.operation}),{cleanup:()=>{}}}var im=[{kind:"faq:scroll_to",executor:Lx},{kind:"faq:toggle_item",executor:Fx},{kind:"faq:update",executor:Dx}];var _s=class extends zn{constructor(e){if(super(e),this.it=J,e.type!==sa.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===J||e==null)return this._t=void 0,this.it=e;if(e===Tt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};_s.directiveName="unsafeHTML",_s.resultType=1;var la=oa(_s);function ku(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rn=ku();function dm(r){rn=r}var en={exec:()=>null};function pe(r,e=""){let t=typeof r=="string"?r:r.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Xe.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var Hx=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}>`)},Bx=/^(?:[ \t]*(?:\n|$))+/,Vx=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jx=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ks=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Wx=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Su=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,pm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hm=pe(pm).replace(/bull/g,Su).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ux=pe(pm).replace(/bull/g,Su).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Eu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,zx=/^[^\n]+/,Cu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qx=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Cu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Zx=pe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Su).getRegex(),fa="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Au=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Gx=pe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Au).replace("tag",fa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fm=pe(Eu).replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fa).getRegex(),Kx=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fm).getRegex(),Ru={blockquote:Kx,code:Vx,def:qx,fences:jx,heading:Wx,hr:ks,html:Gx,lheading:hm,list:Zx,newline:Bx,paragraph:fm,table:en,text:zx},sm=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fa).getRegex(),Yx={...Ru,lheading:Ux,table:sm,paragraph:pe(Eu).replace("hr",ks).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fa).getRegex()},Xx={...Ru,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Au).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:en,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:pe(Eu).replace("hr",ks).replace("heading",` *#{1,6} *[^
147
+ ]`).replace("lheading",hm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Jx=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Qx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gm=/^( {2,}|\\)\n(?!\s*$)/,ew=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ga=/[\p{P}\p{S}]/u,Tu=/[\s\p{P}\p{S}]/u,mm=/[^\s\p{P}\p{S}]/u,tw=pe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Tu).getRegex(),vm=/(?!~)[\p{P}\p{S}]/u,rw=/(?!~)[\s\p{P}\p{S}]/u,nw=/(?:[^\s\p{P}\p{S}]|~)/u,ym=/(?![*_])[\p{P}\p{S}]/u,iw=/(?![*_])[\s\p{P}\p{S}]/u,sw=/(?:[^\s\p{P}\p{S}]|[*_])/u,ow=pe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Hx?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_m=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,aw=pe(_m,"u").replace(/punct/g,ga).getRegex(),lw=pe(_m,"u").replace(/punct/g,vm).getRegex(),bm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cw=pe(bm,"gu").replace(/notPunctSpace/g,mm).replace(/punctSpace/g,Tu).replace(/punct/g,ga).getRegex(),uw=pe(bm,"gu").replace(/notPunctSpace/g,nw).replace(/punctSpace/g,rw).replace(/punct/g,vm).getRegex(),dw=pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mm).replace(/punctSpace/g,Tu).replace(/punct/g,ga).getRegex(),pw=pe(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ym).getRegex(),hw="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fw=pe(hw,"gu").replace(/notPunctSpace/g,sw).replace(/punctSpace/g,iw).replace(/punct/g,ym).getRegex(),gw=pe(/\\(punct)/,"gu").replace(/punct/g,ga).getRegex(),mw=pe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vw=pe(Au).replace("(?:-->|$)","-->").getRegex(),yw=pe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),da=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,_w=pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",da).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xm=pe(/^!?\[(label)\]\[(ref)\]/).replace("label",da).replace("ref",Cu).getRegex(),wm=pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Cu).getRegex(),bw=pe("reflink|nolink(?!\\()","g").replace("reflink",xm).replace("nolink",wm).getRegex(),om=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Iu={_backpedal:en,anyPunctuation:gw,autolink:mw,blockSkip:ow,br:gm,code:Qx,del:en,delLDelim:en,delRDelim:en,emStrongLDelim:aw,emStrongRDelimAst:cw,emStrongRDelimUnd:dw,escape:Jx,link:_w,nolink:wm,punctuation:tw,reflink:xm,reflinkSearch:bw,tag:yw,text:ew,url:en},xw={...Iu,link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",da).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",da).getRegex()},bu={...Iu,emStrongRDelimAst:uw,emStrongLDelim:lw,delLDelim:pw,delRDelim:fw,url:pe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",om).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:pe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",om).getRegex()},ww={...bu,br:pe(gm).replace("{2,}","*").getRegex(),text:pe(bu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ca={normal:Ru,gfm:Yx,pedantic:Xx},bs={normal:Iu,gfm:bu,breaks:ww,pedantic:xw},kw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},am=r=>kw[r];function Dt(r,e){if(e){if(Xe.escapeTest.test(r))return r.replace(Xe.escapeReplace,am)}else if(Xe.escapeTestNoEncode.test(r))return r.replace(Xe.escapeReplaceNoEncode,am);return r}function lm(r){try{r=encodeURI(r).replace(Xe.percentDecode,"%")}catch{return null}return r}function cm(r,e){let t=r.replace(Xe.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Xe.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(Xe.slashPipe,"|");return n}function xs(r,e,t){let n=r.length;if(n===0)return"";let i=0;for(;i<n;){let s=r.charAt(n-i-1);if(s===e&&!t)i++;else if(s!==e&&t)i++;else break}return r.slice(0,n-i)}function Sw(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function Ew(r,e=0){let t=e,n="";for(let i of r)if(i===" "){let s=4-t%4;n+=" ".repeat(s),t+=s}else n+=i,t++;return n}function um(r,e,t,n,i){let s=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Cw(r,e,t){let n=r.match(t.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
148
148
  `).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
149
- `)}var ca=class{constructor(r){me(this,"options");me(this,"rules");me(this,"lexer");this.options=r||rn}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:xs(t,`
150
- `)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=kw(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=xs(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:xs(e[0],`
149
+ `)}var pa=class{constructor(r){me(this,"options");me(this,"rules");me(this,"lexer");this.options=r||rn}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:xs(t,`
150
+ `)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=Cw(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=xs(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:xs(e[0],`
151
151
  `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=xs(e[0],`
152
152
  `).split(`
153
153
  `),n="",i="",s=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
@@ -156,20 +156,20 @@ var SyntrologieSDK=(()=>{var No=Object.defineProperty;var d0=Object.getOwnProper
156
156
  ${c}`:c,i=i?`${i}
157
157
  ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=p,t.length===0)break;let h=s.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){let f=h,v=f.raw+`
158
158
  `+t.join(`
159
- `),m=this.blockquote(v);s[s.length-1]=m,n=n.substring(0,n.length-f.raw.length)+m.raw,i=i.substring(0,i.length-f.text.length)+m.text;break}else if(h?.type==="list"){let f=h,v=f.raw+`
159
+ `),g=this.blockquote(v);s[s.length-1]=g,n=n.substring(0,n.length-f.raw.length)+g.raw,i=i.substring(0,i.length-f.text.length)+g.text;break}else if(h?.type==="list"){let f=h,v=f.raw+`
160
160
  `+t.join(`
161
- `),m=this.list(v);s[s.length-1]=m,n=n.substring(0,n.length-h.raw.length)+m.raw,i=i.substring(0,i.length-f.raw.length)+m.raw,t=v.substring(s.at(-1).raw.length).split(`
162
- `);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,i={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let s=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",u="";if(!(e=s.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let p=ww(e[2].split(`
161
+ `),g=this.list(v);s[s.length-1]=g,n=n.substring(0,n.length-h.raw.length)+g.raw,i=i.substring(0,i.length-f.raw.length)+g.raw,t=v.substring(s.at(-1).raw.length).split(`
162
+ `);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,i={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let s=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",u="";if(!(e=s.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let p=Ew(e[2].split(`
163
163
  `,1)[0],e[1].length),h=r.split(`
164
164
  `,1)[0],f=!p.trim(),v=0;if(this.options.pedantic?(v=2,u=p.trimStart()):f?v=e[1].length+1:(v=p.search(this.rules.other.nonSpaceChar),v=v>4?1:v,u=p.slice(v),v+=e[1].length),f&&this.rules.other.blankLine.test(h)&&(c+=h+`
165
- `,r=r.substring(h.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(v),g=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),k=this.rules.other.htmlBeginRegex(v),_=this.rules.other.blockquoteBeginRegex(v);for(;r;){let w=r.split(`
166
- `,1)[0],R;if(h=w,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),R=h):R=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||x.test(h)||k.test(h)||_.test(h)||m.test(h)||g.test(h))break;if(R.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
167
- `+R.slice(v);else{if(f||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(p)||x.test(p)||g.test(p))break;u+=`
165
+ `,r=r.substring(h.length+1),l=!0),!l){let g=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),k=this.rules.other.htmlBeginRegex(v),_=this.rules.other.blockquoteBeginRegex(v);for(;r;){let w=r.split(`
166
+ `,1)[0],R;if(h=w,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),R=h):R=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||x.test(h)||k.test(h)||_.test(h)||g.test(h)||m.test(h))break;if(R.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
167
+ `+R.slice(v);else{if(f||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(p)||x.test(p)||m.test(p))break;u+=`
168
168
  `+h}f=!h.trim(),c+=w+`
169
- `,r=r.substring(w.length+1),p=R.slice(v)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!i.loose){let c=l.tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=om(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
170
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<t.length;o++)s.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(om(o,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
171
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=xs(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=xw(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),am(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[n.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return am(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let i=[...n[0]].length-1,s,o,a=i,l=0,c=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(n=c.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){a+=o;continue}else if((n[5]||n[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...n[0]][0].length,p=r.slice(0,i+n.index+u+o);if(Math.min(i,o)%2){let f=p.slice(1,-1);return{type:"em",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let n=this.rules.inline.delLDelim.exec(r);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...n[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(n=l.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==i))continue;if(n[3]||n[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...n[0]][0].length,u=r.slice(0,i+n.index+c+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},It=class yu{constructor(e){me(this,"tokens");me(this,"options");me(this,"state");me(this,"inlineQueue");me(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rn,this.options.tokenizer=this.options.tokenizer||new ca,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ye,block:oa.normal,inline:bs.normal};this.options.pedantic?(t.block=oa.pedantic,t.inline=bs.pedantic):this.options.gfm&&(t.block=oa.gfm,this.options.breaks?t.inline=bs.breaks:t.inline=bs.gfm),this.tokenizer.rules=t}static get rules(){return{block:oa,inline:bs}}static lex(e,t){return new yu(t).lex(e)}static lexInline(e,t){return new yu(t).inlineTokens(e)}lex(e){e=e.replace(Ye.carriageReturn,`
172
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Ye.tabCharGlobal," ").replace(Ye.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=t.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
169
+ `,r=r.substring(w.length+1),p=R.slice(v)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!i.loose){let c=l.tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=cm(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
170
+ `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<t.length;o++)s.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(cm(o,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
171
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=xs(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=Sw(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),um(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[n.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return um(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let i=[...n[0]].length-1,s,o,a=i,l=0,c=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(n=c.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){a+=o;continue}else if((n[5]||n[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...n[0]][0].length,p=r.slice(0,i+n.index+u+o);if(Math.min(i,o)%2){let f=p.slice(1,-1);return{type:"em",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let n=this.rules.inline.delLDelim.exec(r);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...n[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(n=l.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==i))continue;if(n[3]||n[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...n[0]][0].length,u=r.slice(0,i+n.index+c+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},It=class xu{constructor(e){me(this,"tokens");me(this,"options");me(this,"state");me(this,"inlineQueue");me(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rn,this.options.tokenizer=this.options.tokenizer||new pa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Xe,block:ca.normal,inline:bs.normal};this.options.pedantic?(t.block=ca.pedantic,t.inline=bs.pedantic):this.options.gfm&&(t.block=ca.gfm,this.options.breaks?t.inline=bs.breaks:t.inline=bs.gfm),this.tokenizer.rules=t}static get rules(){return{block:ca,inline:bs}}static lex(e,t){return new xu(t).lex(e)}static lexInline(e,t){return new xu(t).inlineTokens(e)}lex(e){e=e.replace(Xe.carriageReturn,`
172
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Xe.tabCharGlobal," ").replace(Xe.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=t.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
173
173
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
174
174
  `)?"":`
175
175
  `)+i.raw,o.text+=`
@@ -182,7 +182,7 @@ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
182
182
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i),n=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
183
183
  `)?"":`
184
184
  `)+i.raw,o.text+=`
185
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=t.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},ua=class{constructor(r){me(this,"options");me(this,"parser");this.options=r||rn}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(Ye.notSpaceStart)?.[0],i=r.replace(Ye.endingNewline,"")+`
185
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=t.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},ha=class{constructor(r){me(this,"options");me(this,"parser");this.options=r||rn}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(Xe.notSpaceStart)?.[0],i=r.replace(Xe.endingNewline,"")+`
186
186
  `;return n?'<pre><code class="language-'+Dt(n)+'">'+(t?i:Dt(i,!0))+`</code></pre>
187
187
  `:"<pre><code>"+(t?i:Dt(i,!0))+`</code></pre>
188
188
  `}blockquote({tokens:r}){return`<blockquote>
@@ -200,10 +200,10 @@ ${this.parser.parse(r)}</blockquote>
200
200
  `}tablerow({text:r}){return`<tr>
201
201
  ${r}</tr>
202
202
  `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
203
- `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${Dt(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let n=this.parser.parseInline(t),i=sm(r);if(i===null)return n;r=i;let s='<a href="'+r+'"';return e&&(s+=' title="'+Dt(e)+'"'),s+=">"+n+"</a>",s}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let i=sm(r);if(i===null)return Dt(t);r=i;let s=`<img src="${r}" alt="${Dt(t)}"`;return e&&(s+=` title="${Dt(e)}"`),s+=">",s}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:Dt(r.text)}},Ru=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},$t=class _u{constructor(e){me(this,"options");me(this,"renderer");me(this,"textRenderer");this.options=e||rn,this.options.renderer=this.options.renderer||new ua,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ru}static parse(e,t){return new _u(t).parse(e)}static parseInline(e,t){return new _u(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let s=i;switch(s.type){case"space":{t+=this.renderer.space(s);break}case"hr":{t+=this.renderer.hr(s);break}case"heading":{t+=this.renderer.heading(s);break}case"code":{t+=this.renderer.code(s);break}case"table":{t+=this.renderer.table(s);break}case"blockquote":{t+=this.renderer.blockquote(s);break}case"list":{t+=this.renderer.list(s);break}case"checkbox":{t+=this.renderer.checkbox(s);break}case"html":{t+=this.renderer.html(s);break}case"def":{t+=this.renderer.def(s);break}case"paragraph":{t+=this.renderer.paragraph(s);break}case"text":{t+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){let n="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=a||"";continue}}let o=s;switch(o.type){case"escape":{n+=t.text(o);break}case"html":{n+=t.html(o);break}case"link":{n+=t.link(o);break}case"image":{n+=t.image(o);break}case"checkbox":{n+=t.checkbox(o);break}case"strong":{n+=t.strong(o);break}case"em":{n+=t.em(o);break}case"codespan":{n+=t.codespan(o);break}case"br":{n+=t.br(o);break}case"del":{n+=t.del(o);break}case"text":{n+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},aa,ws=(aa=class{constructor(r){me(this,"options");me(this,"block");this.options=r||rn}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?It.lex:It.lexInline}provideParser(){return this.block?$t.parse:$t.parseInline}},me(aa,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),me(aa,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),aa),Tu=class{constructor(...r){me(this,"defaults",bu());me(this,"options",this.setOptions);me(this,"parse",this.parseMarkdown(!0));me(this,"parseInline",this.parseMarkdown(!1));me(this,"Parser",$t);me(this,"Renderer",ua);me(this,"TextRenderer",Ru);me(this,"Lexer",It);me(this,"Tokenizer",ca);me(this,"Hooks",ws);this.use(...r)}walkTokens(r,e){let t=[];for(let n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let i=n;for(let s of i.header)t=t.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let o of s)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=n;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=n;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){let i=this.defaults.renderer||new ua(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}n.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ca(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new ws;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=i[o];ws.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&ws.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,c);return l.call(i,p)})();let u=a.call(i,c);return l.call(i,u)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,c);return p===!1&&(p=await l.apply(i,c)),p})();let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;n.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return It.lex(r,e??this.defaults)}parser(r,e){return $t.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let n={...t},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():r?It.lex:It.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():r?$t.parse:$t.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():r?It.lex:It.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():r?$t.parse:$t.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(r,e){return t=>{if(t.message+=`
204
- Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+Dt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},tn=new Tu;function ve(r,e){return tn.parse(r,e)}ve.options=ve.setOptions=function(r){return tn.setOptions(r),ve.defaults=tn.defaults,lm(ve.defaults),ve};ve.getDefaults=bu;ve.defaults=rn;ve.use=function(...r){return tn.use(...r),ve.defaults=tn.defaults,lm(ve.defaults),ve};ve.walkTokens=function(r,e){return tn.walkTokens(r,e)};ve.parseInline=tn.parseInline;ve.Parser=$t;ve.parser=$t.parse;ve.Renderer=ua;ve.TextRenderer=Ru;ve.Lexer=It;ve.lexer=It.lex;ve.Tokenizer=ca;ve.Hooks=ws;ve.parse=ve;var HT=ve.options,BT=ve.setOptions,VT=ve.use,jT=ve.walkTokens,WT=ve.parseInline;var UT=$t.parse,zT=It.lex;var We={container:{fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"800px",margin:"0 auto"},searchWrapper:{marginBottom:"8px"},searchInput:{width:"100%",padding:"12px 16px",borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.15s ease",backgroundColor:"var(--sc-content-search-background)",color:"var(--sc-content-search-color)"},accordion:{display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"},item:{borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.15s ease"},question:{width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:500,textAlign:"left",transition:"background-color 0.15s ease"},chevron:{fontSize:"20px",transition:"transform 0.2s ease",color:"var(--sc-content-chevron-color, currentColor)"},answer:{padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:1.6,overflow:"hidden",transition:"max-height 0.2s ease, padding 0.2s ease"},category:{display:"inline-block",fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",padding:"4px 8px",borderRadius:"4px",marginBottom:"8px"},categoryHeader:{fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",marginTop:"var(--sc-content-category-gap, 4px)"},feedback:{display:"flex",alignItems:"center",gap:"8px",marginTop:"12px",paddingTop:"10px",borderTop:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"13px"},feedbackButton:{background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"4px 8px",borderRadius:"4px",transition:"background-color 0.15s ease, border-color 0.15s ease"},feedbackButtonSelected:{borderColor:"rgba(0, 0, 0, 0.2)",backgroundColor:"rgba(0, 0, 0, 0.04)"},emptyState:{textAlign:"center",padding:"48px 24px",fontSize:"14px"},noResults:{textAlign:"center",padding:"32px 16px",fontSize:"14px"}},ha={light:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[11]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:ht[8],color:ht[2]},categoryHeader:{color:S[7]},emptyState:{color:S[8]},feedbackPrompt:{color:S[7]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[5]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:ht[0],color:ht[6]},categoryHeader:{color:S[8]},emptyState:{color:S[7]},feedbackPrompt:{color:S[8]}}};var bm=new Tu({async:!1,gfm:!0,breaks:!0});function Sw(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function Ew(r){return typeof r=="string"?bm.parse(r):r.type==="rich"?r.html:bm.parse(r.content)}function Cw(r){return r?r===!0?{style:"thumbs"}:r:null}function Aw(r){return r.prompt??"Was this helpful?"}function Rw(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var fa=class extends he{constructor(){super(...arguments),this.faqConfig={expandBehavior:"single",searchable:!1,theme:"auto",actions:[]},this.runtime=null,this.instanceId="faq-widget",this._expandedIds=new Set,this._highlightId=null,this._searchQuery="",this._feedbackState=new Map,this._hoveredId=null,this._unsubContext=null,this._unsubAccumulator=null,this._unsubCta=null,this._unsubDeepLink=null,this._unsubSessionMetrics=null,this._highlightTimer=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._subscribeAll()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeAll(),this._highlightTimer!==null&&(clearTimeout(this._highlightTimer),this._highlightTimer=null)}updated(e){e.has("runtime")&&(this._unsubscribeAll(),this._subscribeAll())}_subscribeAll(){if(this.runtime){if(this._unsubContext=this.runtime.context.subscribe(()=>{this.requestUpdate()}),this.runtime.accumulator?.subscribe&&(this._unsubAccumulator=this.runtime.accumulator.subscribe(()=>{this.requestUpdate()})),this.runtime.sessionMetrics?.subscribe&&(this._unsubSessionMetrics=this.runtime.sessionMetrics.subscribe(()=>{this.requestUpdate()})),this.runtime.events.subscribe){if(this.runtime.events.getRecent){let t=this.runtime.events.getRecent({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},10).filter(n=>{let i=n.props?.actionId;return typeof i=="string"&&i.startsWith("faq:open:")}).pop();if(t&&Date.now()-t.ts<1e4){let n=t.props.actionId.replace("faq:open:","");this._expandedIds=new Set([n]),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})})}}this._unsubCta=this.runtime.events.subscribe({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},e=>{let t=e.props?.actionId;if(typeof t!="string"||!t.startsWith("faq:open:"))return;let n=t.replace("faq:open:","");this._expandedIds=new Set([n]),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})}),this.runtime?.events.publish("canvas.requestOpen")})}if(this.runtime.events.subscribe){let e=t=>{let n=t.props?.tileId,i=t.props?.itemId;n===this.instanceId&&i&&(this._expandedIds=new Set([i]),this._highlightId=i,this._highlightTimer!==null&&clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout(()=>{this._highlightId=null,this._highlightTimer=null},1500),requestAnimationFrame(()=>{let s=document.querySelector(`[data-faq-item-id="${i}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})}))};if(this.runtime.events.getRecent){let n=this.runtime.events.getRecent({names:["notification.deep_link"]},5).filter(i=>i.props?.tileId===this.instanceId&&i.props?.itemId).pop();n&&Date.now()-n.ts<1e4&&e(n)}this._unsubDeepLink=this.runtime.events.subscribe({names:["notification.deep_link"]},e)}}}_unsubscribeAll(){this._unsubContext?.(),this._unsubAccumulator?.(),this._unsubSessionMetrics?.(),this._unsubCta?.(),this._unsubDeepLink?.(),this._unsubContext=null,this._unsubAccumulator=null,this._unsubSessionMetrics=null,this._unsubCta=null,this._unsubDeepLink=null}_handleToggle(e){let t=this._expandedIds,n;this.faqConfig.expandBehavior==="single"?n=t.has(e)?new Set:new Set([e]):(n=new Set(t),t.has(e)?n.delete(e):n.add(e));let i=!t.has(e);this._expandedIds=n,this.runtime?.events.publish("faq:toggled",{instanceId:this.instanceId,questionId:e,expanded:i,timestamp:Date.now()})}_handleFeedback(e,t,n){let i=new Map(this._feedbackState);i.set(e,n),this._feedbackState=i,this.runtime?.events.publish("faq:feedback",{itemId:e,question:t,value:n})}_visibleQuestions(){return(this.faqConfig.actions??[]).filter(e=>!e.triggerWhen||!this.runtime?!0:this.runtime.evaluateSync(e.triggerWhen).value)}_orderedQuestions(e){return this.faqConfig.ordering==="priority"?[...e].sort((t,n)=>(n.config.priority??0)-(t.config.priority??0)):e}_filteredQuestions(e){let t=this._searchQuery.trim().toLowerCase();return!this.faqConfig.searchable||!t?e:e.filter(n=>n.config.question.toLowerCase().includes(t)||Sw(n.config.answer).toLowerCase().includes(t)||n.config.category?.toLowerCase().includes(t))}_categoryGroups(e){let t=new Map;for(let n of e){let i=n.config.category;t.has(i)||t.set(i,[]),t.get(i).push(n)}return t}_renderAnswer(e){let t=Ew(e);return j`<div style="margin:0" data-faq-markdown="">${sa(t)}</div>`}_renderFeedback(e,t,n,i){let s=ha[i],o={...We.feedback,...s.feedbackPrompt};return j`
203
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${Dt(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let n=this.parser.parseInline(t),i=lm(r);if(i===null)return n;r=i;let s='<a href="'+r+'"';return e&&(s+=' title="'+Dt(e)+'"'),s+=">"+n+"</a>",s}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let i=lm(r);if(i===null)return Dt(t);r=i;let s=`<img src="${r}" alt="${Dt(t)}"`;return e&&(s+=` title="${Dt(e)}"`),s+=">",s}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:Dt(r.text)}},$u=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},$t=class wu{constructor(e){me(this,"options");me(this,"renderer");me(this,"textRenderer");this.options=e||rn,this.options.renderer=this.options.renderer||new ha,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $u}static parse(e,t){return new wu(t).parse(e)}static parseInline(e,t){return new wu(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let s=i;switch(s.type){case"space":{t+=this.renderer.space(s);break}case"hr":{t+=this.renderer.hr(s);break}case"heading":{t+=this.renderer.heading(s);break}case"code":{t+=this.renderer.code(s);break}case"table":{t+=this.renderer.table(s);break}case"blockquote":{t+=this.renderer.blockquote(s);break}case"list":{t+=this.renderer.list(s);break}case"checkbox":{t+=this.renderer.checkbox(s);break}case"html":{t+=this.renderer.html(s);break}case"def":{t+=this.renderer.def(s);break}case"paragraph":{t+=this.renderer.paragraph(s);break}case"text":{t+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){let n="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=a||"";continue}}let o=s;switch(o.type){case"escape":{n+=t.text(o);break}case"html":{n+=t.html(o);break}case"link":{n+=t.link(o);break}case"image":{n+=t.image(o);break}case"checkbox":{n+=t.checkbox(o);break}case"strong":{n+=t.strong(o);break}case"em":{n+=t.em(o);break}case"codespan":{n+=t.codespan(o);break}case"br":{n+=t.br(o);break}case"del":{n+=t.del(o);break}case"text":{n+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},ua,ws=(ua=class{constructor(r){me(this,"options");me(this,"block");this.options=r||rn}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?It.lex:It.lexInline}provideParser(){return this.block?$t.parse:$t.parseInline}},me(ua,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),me(ua,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ua),Mu=class{constructor(...r){me(this,"defaults",ku());me(this,"options",this.setOptions);me(this,"parse",this.parseMarkdown(!0));me(this,"parseInline",this.parseMarkdown(!1));me(this,"Parser",$t);me(this,"Renderer",ha);me(this,"TextRenderer",$u);me(this,"Lexer",It);me(this,"Tokenizer",pa);me(this,"Hooks",ws);this.use(...r)}walkTokens(r,e){let t=[];for(let n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let i=n;for(let s of i.header)t=t.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let o of s)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=n;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=n;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){let i=this.defaults.renderer||new ha(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}n.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new pa(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new ws;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=i[o];ws.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&ws.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,c);return l.call(i,p)})();let u=a.call(i,c);return l.call(i,u)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,c);return p===!1&&(p=await l.apply(i,c)),p})();let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;n.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return It.lex(r,e??this.defaults)}parser(r,e){return $t.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let n={...t},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():r?It.lex:It.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():r?$t.parse:$t.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():r?It.lex:It.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():r?$t.parse:$t.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(r,e){return t=>{if(t.message+=`
204
+ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+Dt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},tn=new Mu;function ve(r,e){return tn.parse(r,e)}ve.options=ve.setOptions=function(r){return tn.setOptions(r),ve.defaults=tn.defaults,dm(ve.defaults),ve};ve.getDefaults=ku;ve.defaults=rn;ve.use=function(...r){return tn.use(...r),ve.defaults=tn.defaults,dm(ve.defaults),ve};ve.walkTokens=function(r,e){return tn.walkTokens(r,e)};ve.parseInline=tn.parseInline;ve.Parser=$t;ve.parser=$t.parse;ve.Renderer=ha;ve.TextRenderer=$u;ve.Lexer=It;ve.lexer=It.lex;ve.Tokenizer=pa;ve.Hooks=ws;ve.parse=ve;var WT=ve.options,UT=ve.setOptions,zT=ve.use,qT=ve.walkTokens,ZT=ve.parseInline;var GT=$t.parse,KT=It.lex;var We={container:{fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"800px",margin:"0 auto"},searchWrapper:{marginBottom:"8px"},searchInput:{width:"100%",padding:"12px 16px",borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.15s ease",backgroundColor:"var(--sc-content-search-background)",color:"var(--sc-content-search-color)"},accordion:{display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"},item:{borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.15s ease"},question:{width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:500,textAlign:"left",transition:"background-color 0.15s ease"},chevron:{fontSize:"20px",transition:"transform 0.2s ease",color:"var(--sc-content-chevron-color, currentColor)"},answer:{padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:1.6,overflow:"hidden",transition:"max-height 0.2s ease, padding 0.2s ease"},category:{display:"inline-block",fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",padding:"4px 8px",borderRadius:"4px",marginBottom:"8px"},categoryHeader:{fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",marginTop:"var(--sc-content-category-gap, 4px)"},feedback:{display:"flex",alignItems:"center",gap:"8px",marginTop:"12px",paddingTop:"10px",borderTop:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"13px"},feedbackButton:{background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"4px 8px",borderRadius:"4px",transition:"background-color 0.15s ease, border-color 0.15s ease"},feedbackButtonSelected:{borderColor:"rgba(0, 0, 0, 0.2)",backgroundColor:"rgba(0, 0, 0, 0.04)"},emptyState:{textAlign:"center",padding:"48px 24px",fontSize:"14px"},noResults:{textAlign:"center",padding:"32px 16px",fontSize:"14px"}},ma={light:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[11]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:ft[8],color:ft[2]},categoryHeader:{color:S[7]},emptyState:{color:S[8]},feedbackPrompt:{color:S[7]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${S[5]}`},item:{backgroundColor:"var(--sc-content-background)",borderTop:"var(--sc-content-border)",borderRight:"var(--sc-content-border)",borderBottom:"var(--sc-content-border)",borderLeft:"var(--sc-content-border)"},itemExpanded:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},question:{backgroundColor:"transparent",color:"var(--sc-content-text-color)"},questionHover:{backgroundColor:"var(--sc-content-background-hover)"},answer:{color:"var(--sc-content-text-secondary-color)"},category:{backgroundColor:ft[0],color:ft[6]},categoryHeader:{color:S[8]},emptyState:{color:S[7]},feedbackPrompt:{color:S[8]}}};var km=new Mu({async:!1,gfm:!0,breaks:!0});function Aw(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function Rw(r){return typeof r=="string"?km.parse(r):r.type==="rich"?r.html:km.parse(r.content)}function Tw(r){return r?r===!0?{style:"thumbs"}:r:null}function Iw(r){return r.prompt??"Was this helpful?"}function $w(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var va=class extends fe{constructor(){super(...arguments),this.faqConfig={expandBehavior:"single",searchable:!1,theme:"auto",actions:[]},this.runtime=null,this.instanceId="faq-widget",this._expandedIds=new Set,this._highlightId=null,this._searchQuery="",this._feedbackState=new Map,this._hoveredId=null,this._unsubContext=null,this._unsubAccumulator=null,this._unsubCta=null,this._unsubDeepLink=null,this._unsubSessionMetrics=null,this._highlightTimer=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._subscribeAll()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeAll(),this._highlightTimer!==null&&(clearTimeout(this._highlightTimer),this._highlightTimer=null)}updated(e){e.has("runtime")&&(this._unsubscribeAll(),this._subscribeAll())}_subscribeAll(){if(this.runtime){if(this._unsubContext=this.runtime.context.subscribe(()=>{this.requestUpdate()}),this.runtime.accumulator?.subscribe&&(this._unsubAccumulator=this.runtime.accumulator.subscribe(()=>{this.requestUpdate()})),this.runtime.sessionMetrics?.subscribe&&(this._unsubSessionMetrics=this.runtime.sessionMetrics.subscribe(()=>{this.requestUpdate()})),this.runtime.events.subscribe){if(this.runtime.events.getRecent){let t=this.runtime.events.getRecent({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},10).filter(n=>{let i=n.props?.actionId;return typeof i=="string"&&i.startsWith("faq:open:")}).pop();if(t&&Date.now()-t.ts<1e4){let n=t.props.actionId.replace("faq:open:","");this._expandedIds=new Set([n]),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})})}}this._unsubCta=this.runtime.events.subscribe({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},e=>{let t=e.props?.actionId;if(typeof t!="string"||!t.startsWith("faq:open:"))return;let n=t.replace("faq:open:","");this._expandedIds=new Set([n]),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})}),this.runtime?.events.publish("canvas.requestOpen")})}if(this.runtime.events.subscribe){let e=t=>{let n=t.props?.tileId,i=t.props?.itemId;n===this.instanceId&&i&&(this._expandedIds=new Set([i]),this._highlightId=i,this._highlightTimer!==null&&clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout(()=>{this._highlightId=null,this._highlightTimer=null},1500),requestAnimationFrame(()=>{let s=document.querySelector(`[data-faq-item-id="${i}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})}))};if(this.runtime.events.getRecent){let n=this.runtime.events.getRecent({names:["notification.deep_link"]},5).filter(i=>i.props?.tileId===this.instanceId&&i.props?.itemId).pop();n&&Date.now()-n.ts<1e4&&e(n)}this._unsubDeepLink=this.runtime.events.subscribe({names:["notification.deep_link"]},e)}}}_unsubscribeAll(){this._unsubContext?.(),this._unsubAccumulator?.(),this._unsubSessionMetrics?.(),this._unsubCta?.(),this._unsubDeepLink?.(),this._unsubContext=null,this._unsubAccumulator=null,this._unsubSessionMetrics=null,this._unsubCta=null,this._unsubDeepLink=null}_handleToggle(e){let t=this._expandedIds,n;this.faqConfig.expandBehavior==="single"?n=t.has(e)?new Set:new Set([e]):(n=new Set(t),t.has(e)?n.delete(e):n.add(e));let i=!t.has(e);this._expandedIds=n,this.runtime?.events.publish("faq:toggled",{instanceId:this.instanceId,questionId:e,expanded:i,timestamp:Date.now()})}_handleFeedback(e,t,n){let i=new Map(this._feedbackState);i.set(e,n),this._feedbackState=i,this.runtime?.events.publish("faq:feedback",{itemId:e,question:t,value:n})}_visibleQuestions(){return(this.faqConfig.actions??[]).filter(e=>!e.triggerWhen||!this.runtime?!0:this.runtime.evaluateSync(e.triggerWhen).value)}_orderedQuestions(e){return this.faqConfig.ordering==="priority"?[...e].sort((t,n)=>(n.config.priority??0)-(t.config.priority??0)):e}_filteredQuestions(e){let t=this._searchQuery.trim().toLowerCase();return!this.faqConfig.searchable||!t?e:e.filter(n=>n.config.question.toLowerCase().includes(t)||Aw(n.config.answer).toLowerCase().includes(t)||n.config.category?.toLowerCase().includes(t))}_categoryGroups(e){let t=new Map;for(let n of e){let i=n.config.category;t.has(i)||t.set(i,[]),t.get(i).push(n)}return t}_renderAnswer(e){let t=Rw(e);return j`<div style="margin:0" data-faq-markdown="">${la(t)}</div>`}_renderFeedback(e,t,n,i){let s=ma[i],o={...We.feedback,...s.feedbackPrompt};return j`
205
205
  <div style=${I(o)}>
206
- <span>${Aw(t)}</span>
206
+ <span>${Iw(t)}</span>
207
207
  <button
208
208
  type="button"
209
209
  style=${I({...We.feedbackButton,...n==="up"?We.feedbackButtonSelected:{}})}
@@ -217,7 +217,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
217
217
  @click=${()=>this._handleFeedback(e.config.id,e.config.question,"down")}
218
218
  >\uD83D\uDC4E</button>
219
219
  </div>
220
- `}_renderItem(e,t,n,i){let s=ha[n],o=this._expandedIds.has(e.config.id),a=this._highlightId===e.config.id,l=this._hoveredId===e.config.id,c={...We.item,...s.item,...o?s.itemExpanded:{},...a?{boxShadow:`0 0 0 2px ${ht[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,transition:"box-shadow 0.3s ease"}:{},...t?{}:{borderBottom:"var(--sc-content-item-divider, none)"}},u={...We.question,...s.question,...l?s.questionHover:{}},p={...We.chevron,transform:o?"rotate(90deg)":"rotate(0deg)"},h={...We.answer,...s.answer,maxHeight:o?"500px":"0",paddingBottom:o?"16px":"0"};return j`
220
+ `}_renderItem(e,t,n,i){let s=ma[n],o=this._expandedIds.has(e.config.id),a=this._highlightId===e.config.id,l=this._hoveredId===e.config.id,c={...We.item,...s.item,...o?s.itemExpanded:{},...a?{boxShadow:`0 0 0 2px ${ft[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,transition:"box-shadow 0.3s ease"}:{},...t?{}:{borderBottom:"var(--sc-content-item-divider, none)"}},u={...We.question,...s.question,...l?s.questionHover:{}},p={...We.chevron,transform:o?"rotate(90deg)":"rotate(0deg)"},h={...We.answer,...s.answer,maxHeight:o?"500px":"0",paddingBottom:o?"16px":"0"};return j`
221
221
  <div
222
222
  style=${I(c)}
223
223
  data-faq-item-id=${e.config.id}
@@ -242,7 +242,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
242
242
  ${o&&i?this._renderFeedback(e,i,this._feedbackState.get(e.config.id),n):J}
243
243
  </div>
244
244
  </div>
245
- `}_renderItems(e,t,n){return e.map((i,s)=>this._renderItem(i,s===e.length-1,t,n))}render(){let e=Rw(this.faqConfig.theme),t=ha[e],n=Cw(this.faqConfig.feedback),i=this._visibleQuestions(),s=this._orderedQuestions(i),o=this._filteredQuestions(s),l=o.some(f=>f.config.category)?this._categoryGroups(o):null,c={...We.container,...t.container},u={...We.emptyState,...t.emptyState},p={...We.categoryHeader,...t.categoryHeader},h={...We.searchInput,...t.searchInput};return i.length===0?j`
245
+ `}_renderItems(e,t,n){return e.map((i,s)=>this._renderItem(i,s===e.length-1,t,n))}render(){let e=$w(this.faqConfig.theme),t=ma[e],n=Tw(this.faqConfig.feedback),i=this._visibleQuestions(),s=this._orderedQuestions(i),o=this._filteredQuestions(s),l=o.some(f=>f.config.category)?this._categoryGroups(o):null,c={...We.container,...t.container},u={...We.emptyState,...t.emptyState},p={...We.categoryHeader,...t.categoryHeader},h={...We.searchInput,...t.searchInput};return i.length===0?j`
246
246
  <div
247
247
  style=${I(c)}
248
248
  data-adaptive-id=${this.instanceId}
@@ -299,7 +299,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
299
299
  </div>
300
300
  `:J}
301
301
  </div>
302
- `}};fa.properties={faqConfig:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_highlightId:{state:!0},_searchQuery:{state:!0},_feedbackState:{state:!0},_hoveredId:{state:!0}};customElements.get("syntro-faq-accordion")||customElements.define("syntro-faq-accordion",fa);var Tw={mount(r,e){let{runtime:t,instanceId:n="faq-widget",...i}=e??{expandBehavior:"single",searchable:!1,theme:"auto",actions:[]},s=document.createElement("syntro-faq-accordion");return Object.assign(s,{faqConfig:i,runtime:t??null,instanceId:n}),r.appendChild(s),()=>s.remove()}},xm={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:tm,widgets:[{id:"adaptive-faq:accordion",component:Tw,metadata:{name:"FAQ Accordion",description:"Collapsible Q&A accordion with search, categories, and feedback",icon:"\u2753",subtitle:"Curated just for you."}}],notifyWatchers(r){return(r.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`faq:${t.config.id}`,strategy:t.triggerWhen,eventName:"faq:question_revealed",eventProps:{questionId:t.config.id,question:t.config.question,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var Iw='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"',wm={"\u{1F4B5}":['<rect width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F3DB}\uFE0F":['<line x1="3" x2="21" y1="22" y2="22"/>','<line x1="6" x2="6" y1="18" y2="11"/>','<line x1="10" x2="10" y1="18" y2="11"/>','<line x1="14" x2="14" y1="18" y2="11"/>','<line x1="18" x2="18" y1="18" y2="11"/>','<polygon points="12 2 20 7 4 7"/>'],"\u23ED\uFE0F":['<polygon points="5 4 15 12 5 20 5 4"/>','<line x1="19" x2="19" y1="5" y2="19"/>'],"\u27A1\uFE0F":['<path d="M5 12h14"/>','<path d="m12 5 7 7-7 7"/>'],"\u{1F4A1}":['<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/>','<path d="M9 18h6"/>','<path d="M10 22h4"/>'],"\u{1F4B0}":['<rect width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F4CB}":['<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>','<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>','<path d="M12 11h4"/>','<path d="M12 16h4"/>','<path d="M8 11h.01"/>','<path d="M8 16h.01"/>'],"\u2705":['<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>','<path d="m9 11 3 3L22 4"/>'],"\u26A0\uFE0F":['<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/>','<path d="M12 9v4"/>','<path d="M12 17h.01"/>'],"\u{1F6E1}\uFE0F":['<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>'],"\u{1F4C8}":['<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/>','<polyline points="16 7 22 7 22 13"/>'],"\u{1F52C}":['<path d="M6 18h8"/>','<path d="M3 22h18"/>','<path d="M14 22a7 7 0 1 0 0-14h-1"/>','<path d="M9 14h2"/>','<path d="M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z"/>','<path d="M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3"/>'],"\u{1F48A}":['<path d="m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"/>','<path d="m8.5 8.5 7 7"/>'],"\u{1F4C4}":['<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/>','<path d="M14 2v4a2 2 0 0 0 2 2h4"/>','<path d="M10 9H8"/>','<path d="M16 13H8"/>','<path d="M16 17H8"/>'],"\u{1F9EA}":['<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/>','<path d="M6.453 15h11.094"/>','<path d="M8.5 2h7"/>'],"\u{1F501}":['<path d="m17 2 4 4-4 4"/>','<path d="M3 11v-1a4 4 0 0 1 4-4h14"/>','<path d="m7 22-4-4 4-4"/>','<path d="M21 13v1a4 4 0 0 1-4 4H3"/>'],"\u{1F9E0}":['<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/>','<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/>','<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/>','<path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/>','<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/>','<path d="M3.477 10.896a4 4 0 0 1 .585-.396"/>','<path d="M19.938 10.5a4 4 0 0 1 .585.396"/>','<path d="M6 18a4 4 0 0 1-1.967-.516"/>','<path d="M19.967 17.484A4 4 0 0 1 18 18"/>'],"\u{1F319}":['<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>'],"\u{1F4E6}":['<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/>','<path d="M12 22V12"/>','<path d="m3.3 7 8.7 5 8.7-5"/>','<path d="m7.5 4.27 9 5.15"/>'],"\u{1F331}":['<path d="M7 20h10"/>','<path d="M10 20c5.5-2.5.8-6.4 3-10"/>','<path d="M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z"/>','<path d="M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z"/>'],"\u26A1":['<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>'],"\u{1F525}":['<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>'],"\u{1F333}":['<path d="M12 22V8"/>','<path d="m17 8-5-6-5 6"/>','<path d="M12 12c-2-2-4-2-4-2 0 0 0 4 2 6 1.5 1.5 3 1 4 0"/>','<path d="M12 12c2-2 4-2 4-2 0 0 0 4-2 6-1.5 1.5-3 1-4 0"/>'],"\u{1F33F}":['<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19.2 2.96a1 1 0 0 1 1.8.5c0 6-2 11-9 16.5"/>','<path d="M2 21c0-3 1.85-5.36 5.08-6"/>'],"\u2753":['<circle cx="12" cy="12" r="10"/>','<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>','<path d="M12 17h.01"/>'],"\u{1F9ED}":['<circle cx="12" cy="12" r="10"/>','<polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/>'],"\u{1F4DD}":['<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>','<polyline points="14 2 14 8 20 8"/>','<line x1="16" y1="13" x2="8" y2="13"/>','<line x1="16" y1="17" x2="8" y2="17"/>','<line x1="10" y1="9" x2="8" y2="9"/>'],"\u{1F3AF}":['<polygon points="12 2 2 7 12 12 22 7 12 2"/>','<polyline points="2 17 12 22 22 17"/>','<polyline points="2 12 12 17 22 12"/>'],"\u{1F3C6}":['<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/>','<path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/>','<path d="M4 22h16"/>','<path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/>','<path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/>','<path d="M18 2H6v7a6 6 0 0 0 12 0V2Z"/>'],"\u2728":['<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>','<path d="M5 3v4"/>','<path d="M19 17v4"/>','<path d="M3 5h4"/>','<path d="M17 19h4"/>'],"\u{1F4AC}":['<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>'],"\u{1F3AE}":['<line x1="6" y1="11" x2="10" y2="11"/>','<line x1="8" y1="9" x2="8" y2="13"/>','<line x1="15" y1="12" x2="15.01" y2="12"/>','<line x1="18" y1="10" x2="18.01" y2="10"/>','<path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>'],"\u23F1\uFE0F":['<line x1="10" y1="2" x2="14" y2="2"/>','<line x1="12" y1="14" x2="12" y2="8"/>','<circle cx="12" cy="14" r="8"/>'],"\u{1F4D6}":['<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/>','<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>'],"\u{1F514}":['<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/>','<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>'],"\u{1F393}":['<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/>','<path d="M22 10v6"/>','<path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>'],"\u23F0":['<circle cx="12" cy="13" r="8"/>','<path d="M12 9v4l2 2"/>','<path d="M5 3 2 6"/>','<path d="m22 6-3-3"/>','<path d="M6.38 18.7 4 21"/>','<path d="M17.64 18.67 20 21"/>'],"\u{1F504}":['<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/>','<path d="M21 3v5h-5"/>','<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/>','<path d="M8 16H3v5"/>'],"\u{1F464}":['<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/>','<circle cx="12" cy="7" r="4"/>'],"\u{1F3E0}":['<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>','<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'],"\u{1F6D2}":['<circle cx="8" cy="21" r="1"/>','<circle cx="19" cy="21" r="1"/>','<path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>'],"\u{1F4CA}":['<path d="M3 3v18h18"/>','<path d="M18 17V9"/>','<path d="M13 17V5"/>','<path d="M8 17v-3"/>'],"\u{1F4C9}":['<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/>','<polyline points="16 17 22 17 22 11"/>'],"\u{1F967}":['<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"/>','<path d="M21.21 15.89A10 10 0 1 1 8 2.83"/>'],"\u{1F4B9}":['<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.5.5 0 0 1-.96 0L9.24 2.18a.5.5 0 0 0-.96 0l-2.35 8.36A2 2 0 0 1 4.02 12H2"/>'],"\u{1F321}\uFE0F":['<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>']};function nn(r,e={}){let t=wm[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${Iw} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var d={};Rf(d,{BRAND:()=>rk,DIRTY:()=>sn,EMPTY_PATH:()=>Pw,INVALID:()=>Q,NEVER:()=>Bk,OK:()=>Ge,ParseStatus:()=>Ue,Schema:()=>oe,ZodAny:()=>Cr,ZodArray:()=>rr,ZodBigInt:()=>an,ZodBoolean:()=>ln,ZodBranded:()=>Es,ZodCatch:()=>_n,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>va,ZodEffects:()=>yt,ZodEnum:()=>mn,ZodError:()=>rt,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>_a,ZodIntersection:()=>hn,ZodIssueCode:()=>T,ZodLazy:()=>fn,ZodLiteral:()=>gn,ZodMap:()=>ti,ZodNaN:()=>ni,ZodNativeEnum:()=>vn,ZodNever:()=>Mt,ZodNull:()=>dn,ZodNullable:()=>Vt,ZodNumber:()=>on,ZodObject:()=>nt,ZodOptional:()=>mt,ZodParsedType:()=>W,ZodPipeline:()=>Cs,ZodPromise:()=>Ar,ZodReadonly:()=>bn,ZodRecord:()=>ya,ZodSchema:()=>oe,ZodSet:()=>ri,ZodString:()=>Er,ZodSymbol:()=>Qn,ZodTransformer:()=>yt,ZodTuple:()=>Bt,ZodType:()=>oe,ZodUndefined:()=>un,ZodUnion:()=>pn,ZodUnknown:()=>tr,ZodVoid:()=>ei,addIssueToContext:()=>F,any:()=>dk,array:()=>gk,bigint:()=>ok,boolean:()=>Om,coerce:()=>Hk,custom:()=>Im,date:()=>ak,datetimeRegex:()=>Rm,defaultErrorMap:()=>Qt,discriminatedUnion:()=>_k,effect:()=>$k,enum:()=>Rk,function:()=>Ek,getErrorMap:()=>Yn,getParsedType:()=>Ht,instanceof:()=>ik,intersection:()=>bk,isAborted:()=>ga,isAsync:()=>Xn,isDirty:()=>ma,isValid:()=>Sr,late:()=>nk,lazy:()=>Ck,literal:()=>Ak,makeIssue:()=>Ss,map:()=>kk,nan:()=>sk,nativeEnum:()=>Tk,never:()=>hk,null:()=>uk,nullable:()=>Ok,number:()=>Mm,object:()=>mk,objectUtil:()=>Iu,oboolean:()=>Dk,onumber:()=>Fk,optional:()=>Mk,ostring:()=>Lk,pipeline:()=>Nk,preprocess:()=>Pk,promise:()=>Ik,quotelessJson:()=>$w,record:()=>wk,set:()=>Sk,setErrorMap:()=>Ow,strictObject:()=>vk,string:()=>$m,symbol:()=>lk,transformer:()=>$k,tuple:()=>xk,undefined:()=>ck,union:()=>yk,unknown:()=>pk,util:()=>ae,void:()=>fk});var ae;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},r.getValidEnumValues=i=>{let s=r.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},r.find=(i,s)=>{for(let o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ae||(ae={}));var Iu;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Iu||(Iu={}));var W=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=r=>{switch(typeof r){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(r)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(r)?W.array:r===null?W.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?W.promise:typeof Map<"u"&&r instanceof Map?W.map:typeof Set<"u"&&r instanceof Set?W.set:typeof Date<"u"&&r instanceof Date?W.date:W.object;default:return W.unknown}};var T=ae.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),$w=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),rt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];t[s]=t[s]||[],t[s].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};rt.create=r=>new rt(r);var Mw=(r,e)=>{let t;switch(r.code){case T.invalid_type:r.received===W.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ae.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${ae.joinValues(r.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ae.joinValues(r.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${ae.joinValues(r.options)}, received '${r.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:ae.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case T.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case T.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,ae.assertNever(r)}return{message:t}},Qt=Mw;var km=Qt;function Ow(r){km=r}function Yn(){return km}var Ss=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},Pw=[];function F(r,e){let t=Yn(),n=Ss({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Qt?void 0:Qt].filter(i=>!!i)});r.common.issues.push(n)}var Ue=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),sn=r=>({status:"dirty",value:r}),Ge=r=>({status:"valid",value:r}),ga=r=>r.status==="aborted",ma=r=>r.status==="dirty",Sr=r=>r.status==="valid",Xn=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}));var vt=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Sm=(r,e)=>{if(Sr(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new rt(r.common.issues);return this._error=t,this._error}}};function ie(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var oe=class{get description(){return this._def.description}_getType(e){return Ht(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ue,ctx:{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Xn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Sm(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Sr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Sr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(Xn(i)?i:Promise.resolve(i));return Sm(n,s)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{let o=e(i),a=()=>s.addIssue({code:T.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new yt({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return mt.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rr.create(this)}promise(){return Ar.create(this,this._def)}or(e){return pn.create([this,e],this._def)}and(e){return hn.create(this,e,this._def)}transform(e){return new yt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new yn({...ie(this._def),innerType:this,defaultValue:t,typeName:ee.ZodDefault})}brand(){return new Es({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new _n({...ie(this._def),innerType:this,catchValue:t,typeName:ee.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Cs.create(this,e)}readonly(){return bn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Nw=/^c[^\s-]{8,}$/i,Lw=/^[0-9a-z]+$/,Fw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dw=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hw=/^[a-z0-9_-]{21}$/i,Bw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ww="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$u,Uw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Zw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cm="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Yw=new RegExp(`^${Cm}$`);function Am(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Xw(r){return new RegExp(`^${Am(r)}$`)}function Rm(r){let e=`${Cm}T${Am(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Jw(r,e){return!!((e==="v4"||!e)&&Uw.test(r)||(e==="v6"||!e)&&qw.test(r))}function Qw(r,e){if(!Bw.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function ek(r,e){return!!((e==="v4"||!e)&&zw.test(r)||(e==="v6"||!e)&&Zw.test(r))}var Er=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.string,received:s.parsedType}),Q}let n=new Ue,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")jw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")$u||($u=new RegExp(Ww,"u")),$u.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Dw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Hw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Nw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Lw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Fw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),F(i,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Rm(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Yw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Xw(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Vw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Jw(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Qw(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ek(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Gw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Kw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):ae.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Er.create=r=>new Er({checks:[],typeName:ee.ZodString,coerce:r?.coerce??!1,...ie(r)});function tk(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=Number.parseInt(r.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var on=class r extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.number,received:s.parsedType}),Q}let n,i=new Ue;for(let s of this._def.checks)s.kind==="int"?ae.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?tk(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_finite,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ae.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};on.create=r=>new on({checks:[],typeName:ee.ZodNumber,coerce:r?.coerce||!1,...ie(r)});var an=class r extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,i=new Ue;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};an.create=r=>new an({checks:[],typeName:ee.ZodBigInt,coerce:r?.coerce??!1,...ie(r)});var ln=class extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.boolean,received:n.parsedType}),Q}return Ge(e.data)}};ln.create=r=>new ln({typeName:ee.ZodBoolean,coerce:r?.coerce||!1,...ie(r)});var cn=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_date}),Q}let n=new Ue,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ae.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};cn.create=r=>new cn({checks:[],coerce:r?.coerce||!1,typeName:ee.ZodDate,...ie(r)});var Qn=class extends oe{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.symbol,received:n.parsedType}),Q}return Ge(e.data)}};Qn.create=r=>new Qn({typeName:ee.ZodSymbol,...ie(r)});var un=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.undefined,received:n.parsedType}),Q}return Ge(e.data)}};un.create=r=>new un({typeName:ee.ZodUndefined,...ie(r)});var dn=class extends oe{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.null,received:n.parsedType}),Q}return Ge(e.data)}};dn.create=r=>new dn({typeName:ee.ZodNull,...ie(r)});var Cr=class extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Cr.create=r=>new Cr({typeName:ee.ZodAny,...ie(r)});var tr=class extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};tr.create=r=>new tr({typeName:ee.ZodUnknown,...ie(r)});var Mt=class extends oe{_parse(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.never,received:t.parsedType}),Q}};Mt.create=r=>new Mt({typeName:ee.ZodNever,...ie(r)});var ei=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.void,received:n.parsedType}),Q}return Ge(e.data)}};ei.create=r=>new ei({typeName:ee.ZodVoid,...ie(r)});var rr=class r extends oe{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==W.array)return F(t,{code:T.invalid_type,expected:W.array,received:t.parsedType}),Q;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(F(t,{code:o?T.too_big:T.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(F(t,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(F(t,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new vt(t,o,t.path,a)))).then(o=>Ue.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new vt(t,o,t.path,a)));return Ue.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}};rr.create=(r,e)=>new rr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Jn(r){if(r instanceof nt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=mt.create(Jn(n))}return new nt({...r._def,shape:()=>e})}else return r instanceof rr?new rr({...r._def,type:Jn(r.element)}):r instanceof mt?mt.create(Jn(r.unwrap())):r instanceof Vt?Vt.create(Jn(r.unwrap())):r instanceof Bt?Bt.create(r.items.map(e=>Jn(e))):r}var nt=class r extends oe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ae.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return F(c,{code:T.invalid_type,expected:W.object,received:c.parsedType}),Q}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=s[c],p=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new vt(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Mt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(F(i,{code:T.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let p=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new vt(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,h=await u.value;c.push({key:p,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Ue.mergeObjectSync(n,c)):Ue.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:Z.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ee.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of ae.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of ae.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Jn(this)}partial(e){let t={};for(let n of ae.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of ae.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof mt;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Tm(ae.objectKeys(this.shape))}};nt.create=(r,e)=>new nt({shape:()=>r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.strictCreate=(r,e)=>new nt({shape:()=>r,unknownKeys:"strict",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.lazycreate=(r,e)=>new nt({shape:r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});var pn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new rt(a.ctx.common.issues));return F(t,{code:T.invalid_union,unionErrors:o}),Q}if(t.common.async)return Promise.all(n.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of n){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new rt(l));return F(t,{code:T.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};pn.create=(r,e)=>new pn({options:r,typeName:ee.ZodUnion,...ie(e)});var er=r=>r instanceof fn?er(r.schema):r instanceof yt?er(r.innerType()):r instanceof gn?[r.value]:r instanceof mn?r.options:r instanceof vn?ae.objectValues(r.enum):r instanceof yn?er(r._def.innerType):r instanceof un?[void 0]:r instanceof dn?[null]:r instanceof mt?[void 0,...er(r.unwrap())]:r instanceof Vt?[null,...er(r.unwrap())]:r instanceof Es||r instanceof bn?er(r.unwrap()):r instanceof _n?er(r._def.innerType):[],va=class r extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return F(t,{code:T.invalid_type,expected:W.object,received:t.parsedType}),Q;let n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(F(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let s of t){let o=er(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new r({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ie(n)})}};function Mu(r,e){let t=Ht(r),n=Ht(e);if(r===e)return{valid:!0,data:r};if(t===W.object&&n===W.object){let i=ae.objectKeys(e),s=ae.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Mu(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===W.array&&n===W.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let o=r[s],a=e[s],l=Mu(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===W.date&&n===W.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var hn=class extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(ga(s)||ga(o))return Q;let a=Mu(s.value,o.value);return a.valid?((ma(s)||ma(o))&&t.dirty(),{status:t.value,value:a.data}):(F(n,{code:T.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hn.create=(r,e,t)=>new hn({left:r,right:e,typeName:ee.ZodIntersection,...ie(t)});var Bt=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return F(n,{code:T.invalid_type,expected:W.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return F(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new vt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Ue.mergeArray(t,o)):Ue.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Bt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bt({items:r,typeName:ee.ZodTuple,rest:null,...ie(e)})};var ya=class r extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return F(n,{code:T.invalid_type,expected:W.object,received:n.parsedType}),Q;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new vt(n,a,n.path,a)),value:o._parse(new vt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ue.mergeObjectAsync(t,i):Ue.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof oe?new r({keyType:e,valueType:t,typeName:ee.ZodRecord,...ie(n)}):new r({keyType:Er.create(),valueType:e,typeName:ee.ZodRecord,...ie(t)})}},ti=class extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return F(n,{code:T.invalid_type,expected:W.map,received:n.parsedType}),Q;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new vt(n,a,n.path,[c,"key"])),value:s._parse(new vt(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};ti.create=(r,e,t)=>new ti({valueType:e,keyType:r,typeName:ee.ZodMap,...ie(t)});var ri=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return F(n,{code:T.invalid_type,expected:W.set,received:n.parsedType}),Q;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(F(n,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(F(n,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Q;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...n.data.values()].map((l,c)=>s._parse(new vt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ri.create=(r,e)=>new ri({valueType:r,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var _a=class r extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return F(t,{code:T.invalid_type,expected:W.function,received:t.parsedType}),Q;function n(a,l){return Ss({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yn(),Qt].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ss({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yn(),Qt].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ar){let a=this;return Ge(async function(...l){let c=new rt([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(n(l,f)),c}),p=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(p,s).catch(f=>{throw c.addIssue(i(p,f)),c})})}else{let a=this;return Ge(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new rt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new rt([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Bt.create(e).rest(tr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Bt.create([]).rest(tr.create()),returns:t||tr.create(),typeName:ee.ZodFunction,...ie(n)})}},fn=class extends oe{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};fn.create=(r,e)=>new fn({getter:r,typeName:ee.ZodLazy,...ie(e)});var gn=class extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};gn.create=(r,e)=>new gn({value:r,typeName:ee.ZodLiteral,...ie(e)});function Tm(r,e){return new mn({values:r,typeName:ee.ZodEnum,...ie(e)})}var mn=class r extends oe{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{expected:ae.joinValues(n),received:t.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{received:t.data,code:T.invalid_enum_value,options:n}),Q}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};mn.create=Tm;var vn=class extends oe{_parse(e){let t=ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=ae.objectValues(t);return F(n,{expected:ae.joinValues(i),received:n.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ae.objectValues(t);return F(n,{received:n.data,code:T.invalid_enum_value,options:i}),Q}return Ge(e.data)}get enum(){return this._def.values}};vn.create=(r,e)=>new vn({values:r,typeName:ee.ZodNativeEnum,...ie(e)});var Ar=class extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return F(t,{code:T.invalid_type,expected:W.promise,received:t.parsedType}),Q;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ar.create=(r,e)=>new Ar({type:r,typeName:ee.ZodPromise,...ie(e)});var yt=class extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{F(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return Q;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Q:l.status==="dirty"?sn(l.value):t.value==="dirty"?sn(l.value):l});{if(t.value==="aborted")return Q;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Q:a.status==="dirty"?sn(a.value):t.value==="dirty"?sn(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Sr(o))return Q;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Sr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):Q);ae.assertNever(i)}};yt.create=(r,e,t)=>new yt({schema:r,typeName:ee.ZodEffects,effect:e,...ie(t)});yt.createWithPreprocess=(r,e,t)=>new yt({schema:e,effect:{type:"preprocess",transform:r},typeName:ee.ZodEffects,...ie(t)});var mt=class extends oe{_parse(e){return this._getType(e)===W.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mt.create=(r,e)=>new mt({innerType:r,typeName:ee.ZodOptional,...ie(e)});var Vt=class extends oe{_parse(e){return this._getType(e)===W.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vt.create=(r,e)=>new Vt({innerType:r,typeName:ee.ZodNullable,...ie(e)});var yn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};yn.create=(r,e)=>new yn({innerType:r,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var _n=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_n.create=(r,e)=>new _n({innerType:r,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var ni=class extends oe{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};ni.create=r=>new ni({typeName:ee.ZodNaN,...ie(r)});var rk=Symbol("zod_brand"),Es=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Cs=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(t.dirty(),sn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:ee.ZodPipeline})}},bn=class extends oe{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Sr(i)&&(i.value=Object.freeze(i.value)),i);return Xn(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};bn.create=(r,e)=>new bn({innerType:r,typeName:ee.ZodReadonly,...ie(e)});function Em(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Im(r,e={},t){return r?Cr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Em(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Em(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Cr.create()}var nk={object:nt.lazycreate},ee;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ee||(ee={}));var ik=(r,e={message:`Input not instance of ${r.name}`})=>Im(t=>t instanceof r,e),$m=Er.create,Mm=on.create,sk=ni.create,ok=an.create,Om=ln.create,ak=cn.create,lk=Qn.create,ck=un.create,uk=dn.create,dk=Cr.create,pk=tr.create,hk=Mt.create,fk=ei.create,gk=rr.create,mk=nt.create,vk=nt.strictCreate,yk=pn.create,_k=va.create,bk=hn.create,xk=Bt.create,wk=ya.create,kk=ti.create,Sk=ri.create,Ek=_a.create,Ck=fn.create,Ak=gn.create,Rk=mn.create,Tk=vn.create,Ik=Ar.create,$k=yt.create,Mk=mt.create,Ok=Vt.create,Pk=yt.createWithPreprocess,Nk=Cs.create,Lk=()=>$m().optional(),Fk=()=>Mm().optional(),Dk=()=>Om().optional(),Hk={string:(r=>Er.create({...r,coerce:!0})),number:(r=>on.create({...r,coerce:!0})),boolean:(r=>ln.create({...r,coerce:!0})),bigint:(r=>an.create({...r,coerce:!0})),date:(r=>cn.create({...r,coerce:!0}))};var Bk=Q;var Vk=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Pm=["ui.click","ui.scroll","ui.input","ui.change","ui.submit","ui.hover","ui.idle","ui.scroll_thrash","ui.focus_bounce","nav.page_view","nav.page_leave","behavior.rage_click","behavior.hesitation","behavior.confusion"],Nm=d.enum(Pm).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Lm=["time_on_page","page_views","scroll_depth"],Fm=d.enum(Lm).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var ba=d.object({type:d.literal("page_url"),url:d.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')}).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}'),xa=d.object({type:d.literal("route"),routeId:d.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),wa=d.object({type:d.literal("anchor_visible"),anchorId:d.string().describe("CSS selector of the anchor element"),state:d.enum(["visible","present","absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')}).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`),ka=d.object({type:d.literal("event_occurred"),eventName:d.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:d.number().optional().describe("Time window in ms. Omit = any time this session.")}).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}'),Sa=d.object({type:d.literal("state_equals"),key:d.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:d.unknown().describe("Expected value to match against")}).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type."),Ea=d.object({type:d.literal("viewport"),minWidth:d.number().optional().describe("Minimum viewport width in pixels"),maxWidth:d.number().optional().describe("Maximum viewport width in pixels"),minHeight:d.number().optional().describe("Minimum viewport height in pixels"),maxHeight:d.number().optional().describe("Maximum viewport height in pixels")}).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.'),Ca=d.object({type:d.literal("session_metric"),key:Fm,operator:d.enum(["gte","lte","eq","gt","lt"]),threshold:d.number().describe("Numeric threshold to compare against")}).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}'),Aa=d.object({type:d.literal("dismissed"),key:d.string().describe("Dismissal key (usually a tile or action ID)"),inverted:d.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")}).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed."),Ra=d.object({type:d.literal("cooldown_active"),key:d.string().describe("Cooldown key"),inverted:d.boolean().optional().describe("When true, fires if cooldown is NOT active")}).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently."),Ta=d.object({type:d.literal("frequency_limit"),key:d.string().describe("Frequency counter key"),limit:d.number().describe("Maximum allowed count"),inverted:d.boolean().optional().describe("When true, fires if limit NOT reached")}).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session."),ii=d.object({equals:d.union([d.string(),d.number(),d.boolean()]).optional(),contains:d.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),si=d.object({events:d.array(Nm).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),ii).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")}).describe("Defines what events to count. Registered as an accumulator predicate at config-load time."),Ia=d.object({type:d.literal("event_count"),key:d.string().describe("Unique key for this counter (used for accumulator registration)"),operator:d.enum(["gte","lte","eq","gt","lt"]),count:d.number().int().min(0).describe("Target count threshold"),withinMs:d.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:si.optional().describe("Inline counter definition. Defines what events to count.")}).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}'),nr=d.discriminatedUnion("type",[ba,xa,wa,ka,Sa,Ea,Ca,Aa,Ra,Ta,Ia]),oi=d.object({conditions:d.array(nr).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:d.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")}).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value."),ai=d.object({type:d.literal("rules"),rules:d.array(oi).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:d.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")}).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false."),li=d.object({type:d.literal("score"),field:d.string(),threshold:d.number(),above:d.unknown(),below:d.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),ci=d.object({type:d.literal("model"),modelId:d.string(),inputs:d.array(d.string()),outputMapping:d.record(d.string(),d.unknown()),default:d.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),ui=d.object({type:d.literal("external"),endpoint:d.string(),method:d.enum(["GET","POST"]).optional(),default:d.unknown(),timeoutMs:d.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),di=d.discriminatedUnion("type",[ai,li,ci,ui]),As=di.nullable().optional();var jk=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),Wk=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function Dm(r){let{href:e,external:t,windowOrigin:n,isIframe:i}=r;if(i||n==="null")return{kind:"open",url:e};if(t)return{kind:"open",url:e};let o;try{o=new URL(e,n)}catch{return{kind:"fullnav",url:e}}return o.origin!==n?{kind:"fullnav",url:o.toString()}:{kind:"spa",url:o}}function Hm(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$a=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},De,Ts,Is,Ou,Pu,Zm,Nu,Bm,Vm,jm,Rs,Lu,Uk="#6a59ce",Wm="#677384",Um="#87919f";function zk(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function qk(r){return nn(r)||zk(r)}function zm(r){if(typeof window>"u")return!1;let e=window.location.pathname;return r.some(t=>{let n=t.split("?")[0].split("#")[0];return n.endsWith("/**")?e.startsWith(n.slice(0,-3)):e===n})}function Zk(r){let e=[{boxShadow:"0 0 0 0 rgba(13, 148, 136, 0.5)"},{boxShadow:"0 0 0 8px rgba(13, 148, 136, 0)"}];r.animate(e,{duration:600,iterations:3,easing:"ease-out"})}function Gk(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ma=class extends he{constructor(){super(...arguments),De.add(this),this.config={expandBehavior:"single",theme:"auto",actions:[]},this.runtime=void 0,this.instanceId="nav-widget",this._expandedIds=new Set,this._renderTick=0,this._hoveredId=null,Ts.set(this,null),Is.set(this,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Fe(this,De,"m",Ou).call(this)}disconnectedCallback(){super.disconnectedCallback(),Fe(this,De,"m",Pu).call(this)}updated(e){e.has("runtime")&&(Fe(this,De,"m",Pu).call(this),Fe(this,De,"m",Ou).call(this))}render(){let e=Fe(this,De,"m",Zm).call(this),t=Fe(this,De,"m",Nu).call(this),n=I({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),i=I({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),s=I({fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",color:t==="dark"?Um:Wm}),o=I({fontSize:"13px",padding:"16px",textAlign:"center",color:t==="dark"?Wm:Um});if(e.length===0)return j`
302
+ `}};va.properties={faqConfig:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_highlightId:{state:!0},_searchQuery:{state:!0},_feedbackState:{state:!0},_hoveredId:{state:!0}};customElements.get("syntro-faq-accordion")||customElements.define("syntro-faq-accordion",va);var Mw={mount(r,e){let{runtime:t,instanceId:n="faq-widget",...i}=e??{expandBehavior:"single",searchable:!1,theme:"auto",actions:[]},s=document.createElement("syntro-faq-accordion");return Object.assign(s,{faqConfig:i,runtime:t??null,instanceId:n}),r.appendChild(s),()=>s.remove()}},Sm={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:im,widgets:[{id:"adaptive-faq:accordion",component:Mw,metadata:{name:"FAQ Accordion",description:"Collapsible Q&A accordion with search, categories, and feedback",icon:"\u2753",subtitle:"Curated just for you."}}],notifyWatchers(r){return(r.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`faq:${t.config.id}`,strategy:t.triggerWhen,eventName:"faq:question_revealed",eventProps:{questionId:t.config.id,question:t.config.question,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var Ow='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"',Em={"\u{1F4B5}":['<rect width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F3DB}\uFE0F":['<line x1="3" x2="21" y1="22" y2="22"/>','<line x1="6" x2="6" y1="18" y2="11"/>','<line x1="10" x2="10" y1="18" y2="11"/>','<line x1="14" x2="14" y1="18" y2="11"/>','<line x1="18" x2="18" y1="18" y2="11"/>','<polygon points="12 2 20 7 4 7"/>'],"\u23ED\uFE0F":['<polygon points="5 4 15 12 5 20 5 4"/>','<line x1="19" x2="19" y1="5" y2="19"/>'],"\u27A1\uFE0F":['<path d="M5 12h14"/>','<path d="m12 5 7 7-7 7"/>'],"\u{1F4A1}":['<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/>','<path d="M9 18h6"/>','<path d="M10 22h4"/>'],"\u{1F4B0}":['<rect width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\u{1F4CB}":['<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>','<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>','<path d="M12 11h4"/>','<path d="M12 16h4"/>','<path d="M8 11h.01"/>','<path d="M8 16h.01"/>'],"\u2705":['<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>','<path d="m9 11 3 3L22 4"/>'],"\u26A0\uFE0F":['<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/>','<path d="M12 9v4"/>','<path d="M12 17h.01"/>'],"\u{1F6E1}\uFE0F":['<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>'],"\u{1F4C8}":['<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/>','<polyline points="16 7 22 7 22 13"/>'],"\u{1F52C}":['<path d="M6 18h8"/>','<path d="M3 22h18"/>','<path d="M14 22a7 7 0 1 0 0-14h-1"/>','<path d="M9 14h2"/>','<path d="M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z"/>','<path d="M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3"/>'],"\u{1F48A}":['<path d="m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"/>','<path d="m8.5 8.5 7 7"/>'],"\u{1F4C4}":['<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/>','<path d="M14 2v4a2 2 0 0 0 2 2h4"/>','<path d="M10 9H8"/>','<path d="M16 13H8"/>','<path d="M16 17H8"/>'],"\u{1F9EA}":['<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/>','<path d="M6.453 15h11.094"/>','<path d="M8.5 2h7"/>'],"\u{1F501}":['<path d="m17 2 4 4-4 4"/>','<path d="M3 11v-1a4 4 0 0 1 4-4h14"/>','<path d="m7 22-4-4 4-4"/>','<path d="M21 13v1a4 4 0 0 1-4 4H3"/>'],"\u{1F9E0}":['<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/>','<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/>','<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/>','<path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/>','<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/>','<path d="M3.477 10.896a4 4 0 0 1 .585-.396"/>','<path d="M19.938 10.5a4 4 0 0 1 .585.396"/>','<path d="M6 18a4 4 0 0 1-1.967-.516"/>','<path d="M19.967 17.484A4 4 0 0 1 18 18"/>'],"\u{1F319}":['<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>'],"\u{1F4E6}":['<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/>','<path d="M12 22V12"/>','<path d="m3.3 7 8.7 5 8.7-5"/>','<path d="m7.5 4.27 9 5.15"/>'],"\u{1F69A}":['<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"/>','<path d="M15 18H9"/>','<path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"/>','<circle cx="17" cy="18" r="2"/>','<circle cx="7" cy="18" r="2"/>'],"\u{1F331}":['<path d="M7 20h10"/>','<path d="M10 20c5.5-2.5.8-6.4 3-10"/>','<path d="M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z"/>','<path d="M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z"/>'],"\u26A1":['<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>'],"\u{1F525}":['<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>'],"\u{1F333}":['<path d="M12 22V8"/>','<path d="m17 8-5-6-5 6"/>','<path d="M12 12c-2-2-4-2-4-2 0 0 0 4 2 6 1.5 1.5 3 1 4 0"/>','<path d="M12 12c2-2 4-2 4-2 0 0 0 4-2 6-1.5 1.5-3 1-4 0"/>'],"\u{1F33F}":['<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19.2 2.96a1 1 0 0 1 1.8.5c0 6-2 11-9 16.5"/>','<path d="M2 21c0-3 1.85-5.36 5.08-6"/>'],"\u2753":['<circle cx="12" cy="12" r="10"/>','<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>','<path d="M12 17h.01"/>'],"\u{1F9ED}":['<circle cx="12" cy="12" r="10"/>','<polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/>'],"\u{1F4DD}":['<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>','<polyline points="14 2 14 8 20 8"/>','<line x1="16" y1="13" x2="8" y2="13"/>','<line x1="16" y1="17" x2="8" y2="17"/>','<line x1="10" y1="9" x2="8" y2="9"/>'],"\u{1F3AF}":['<polygon points="12 2 2 7 12 12 22 7 12 2"/>','<polyline points="2 17 12 22 22 17"/>','<polyline points="2 12 12 17 22 12"/>'],"\u{1F3C6}":['<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/>','<path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/>','<path d="M4 22h16"/>','<path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/>','<path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/>','<path d="M18 2H6v7a6 6 0 0 0 12 0V2Z"/>'],"\u2728":['<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>','<path d="M5 3v4"/>','<path d="M19 17v4"/>','<path d="M3 5h4"/>','<path d="M17 19h4"/>'],"\u{1F4AC}":['<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>'],"\u{1F3AE}":['<line x1="6" y1="11" x2="10" y2="11"/>','<line x1="8" y1="9" x2="8" y2="13"/>','<line x1="15" y1="12" x2="15.01" y2="12"/>','<line x1="18" y1="10" x2="18.01" y2="10"/>','<path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>'],"\u23F1\uFE0F":['<line x1="10" y1="2" x2="14" y2="2"/>','<line x1="12" y1="14" x2="12" y2="8"/>','<circle cx="12" cy="14" r="8"/>'],"\u{1F4D6}":['<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/>','<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>'],"\u{1F514}":['<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/>','<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>'],"\u{1F393}":['<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/>','<path d="M22 10v6"/>','<path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>'],"\u23F0":['<circle cx="12" cy="13" r="8"/>','<path d="M12 9v4l2 2"/>','<path d="M5 3 2 6"/>','<path d="m22 6-3-3"/>','<path d="M6.38 18.7 4 21"/>','<path d="M17.64 18.67 20 21"/>'],"\u{1F504}":['<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/>','<path d="M21 3v5h-5"/>','<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/>','<path d="M8 16H3v5"/>'],"\u{1F464}":['<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/>','<circle cx="12" cy="7" r="4"/>'],"\u{1F3E0}":['<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>','<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'],"\u{1F6D2}":['<circle cx="8" cy="21" r="1"/>','<circle cx="19" cy="21" r="1"/>','<path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>'],"\u{1F4CA}":['<path d="M3 3v18h18"/>','<path d="M18 17V9"/>','<path d="M13 17V5"/>','<path d="M8 17v-3"/>'],"\u{1F4C9}":['<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/>','<polyline points="16 17 22 17 22 11"/>'],"\u{1F967}":['<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"/>','<path d="M21.21 15.89A10 10 0 1 1 8 2.83"/>'],"\u{1F4B9}":['<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.5.5 0 0 1-.96 0L9.24 2.18a.5.5 0 0 0-.96 0l-2.35 8.36A2 2 0 0 1 4.02 12H2"/>'],"\u{1F321}\uFE0F":['<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>']};function nn(r,e={}){let t=Em[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${Ow} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var d={};$f(d,{BRAND:()=>sk,DIRTY:()=>sn,EMPTY_PATH:()=>Fw,INVALID:()=>Q,NEVER:()=>Wk,OK:()=>Ge,ParseStatus:()=>Ue,Schema:()=>oe,ZodAny:()=>Cr,ZodArray:()=>rr,ZodBigInt:()=>an,ZodBoolean:()=>ln,ZodBranded:()=>Es,ZodCatch:()=>_n,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>ba,ZodEffects:()=>_t,ZodEnum:()=>mn,ZodError:()=>nt,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>wa,ZodIntersection:()=>hn,ZodIssueCode:()=>T,ZodLazy:()=>fn,ZodLiteral:()=>gn,ZodMap:()=>ti,ZodNaN:()=>ni,ZodNativeEnum:()=>vn,ZodNever:()=>Mt,ZodNull:()=>dn,ZodNullable:()=>Vt,ZodNumber:()=>on,ZodObject:()=>it,ZodOptional:()=>vt,ZodParsedType:()=>W,ZodPipeline:()=>Cs,ZodPromise:()=>Ar,ZodReadonly:()=>bn,ZodRecord:()=>xa,ZodSchema:()=>oe,ZodSet:()=>ri,ZodString:()=>Er,ZodSymbol:()=>Qn,ZodTransformer:()=>_t,ZodTuple:()=>Bt,ZodType:()=>oe,ZodUndefined:()=>un,ZodUnion:()=>pn,ZodUnknown:()=>tr,ZodVoid:()=>ei,addIssueToContext:()=>F,any:()=>fk,array:()=>yk,bigint:()=>ck,boolean:()=>Lm,coerce:()=>jk,custom:()=>Om,date:()=>uk,datetimeRegex:()=>$m,defaultErrorMap:()=>Qt,discriminatedUnion:()=>wk,effect:()=>Pk,enum:()=>$k,function:()=>Rk,getErrorMap:()=>Yn,getParsedType:()=>Ht,instanceof:()=>ak,intersection:()=>kk,isAborted:()=>ya,isAsync:()=>Xn,isDirty:()=>_a,isValid:()=>Sr,late:()=>ok,lazy:()=>Tk,literal:()=>Ik,makeIssue:()=>Ss,map:()=>Ck,nan:()=>lk,nativeEnum:()=>Mk,never:()=>mk,null:()=>hk,nullable:()=>Lk,number:()=>Nm,object:()=>_k,objectUtil:()=>Ou,oboolean:()=>Vk,onumber:()=>Bk,optional:()=>Nk,ostring:()=>Hk,pipeline:()=>Dk,preprocess:()=>Fk,promise:()=>Ok,quotelessJson:()=>Pw,record:()=>Ek,set:()=>Ak,setErrorMap:()=>Lw,strictObject:()=>bk,string:()=>Pm,symbol:()=>dk,transformer:()=>Pk,tuple:()=>Sk,undefined:()=>pk,union:()=>xk,unknown:()=>gk,util:()=>le,void:()=>vk});var le;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},r.getValidEnumValues=i=>{let s=r.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},r.find=(i,s)=>{for(let o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(le||(le={}));var Ou;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ou||(Ou={}));var W=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=r=>{switch(typeof r){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(r)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(r)?W.array:r===null?W.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?W.promise:typeof Map<"u"&&r instanceof Map?W.map:typeof Set<"u"&&r instanceof Set?W.set:typeof Date<"u"&&r instanceof Date?W.date:W.object;default:return W.unknown}};var T=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Pw=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),nt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},n={_errors:[]},i=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];t[s]=t[s]||[],t[s].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};nt.create=r=>new nt(r);var Nw=(r,e)=>{let t;switch(r.code){case T.invalid_type:r.received===W.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,le.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${le.joinValues(r.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${le.joinValues(r.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${le.joinValues(r.options)}, received '${r.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:le.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case T.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case T.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,le.assertNever(r)}return{message:t}},Qt=Nw;var Cm=Qt;function Lw(r){Cm=r}function Yn(){return Cm}var Ss=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},Fw=[];function F(r,e){let t=Yn(),n=Ss({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Qt?void 0:Qt].filter(i=>!!i)});r.common.issues.push(n)}var Ue=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),sn=r=>({status:"dirty",value:r}),Ge=r=>({status:"valid",value:r}),ya=r=>r.status==="aborted",_a=r=>r.status==="dirty",Sr=r=>r.status==="valid",Xn=r=>typeof Promise<"u"&&r instanceof Promise;var G;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(G||(G={}));var yt=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Am=(r,e)=>{if(Sr(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new nt(r.common.issues);return this._error=t,this._error}}};function se(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var oe=class{get description(){return this._def.description}_getType(e){return Ht(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ue,ctx:{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Xn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Am(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Sr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Sr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(Xn(i)?i:Promise.resolve(i));return Am(n,s)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{let o=e(i),a=()=>s.addIssue({code:T.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new _t({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return vt.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rr.create(this)}promise(){return Ar.create(this,this._def)}or(e){return pn.create([this,e],this._def)}and(e){return hn.create(this,e,this._def)}transform(e){return new _t({...se(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new yn({...se(this._def),innerType:this,defaultValue:t,typeName:ee.ZodDefault})}brand(){return new Es({typeName:ee.ZodBranded,type:this,...se(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new _n({...se(this._def),innerType:this,catchValue:t,typeName:ee.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Cs.create(this,e)}readonly(){return bn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dw=/^c[^\s-]{8,}$/i,Hw=/^[0-9a-z]+$/,Bw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Vw=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,jw=/^[a-z0-9_-]{21}$/i,Ww=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Uw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pu,Zw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Kw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Yw=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Tm="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Qw=new RegExp(`^${Tm}$`);function Im(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ek(r){return new RegExp(`^${Im(r)}$`)}function $m(r){let e=`${Tm}T${Im(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function tk(r,e){return!!((e==="v4"||!e)&&Zw.test(r)||(e==="v6"||!e)&&Kw.test(r))}function rk(r,e){if(!Ww.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function nk(r,e){return!!((e==="v4"||!e)&&Gw.test(r)||(e==="v6"||!e)&&Yw.test(r))}var Er=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.string,received:s.parsedType}),Q}let n=new Ue,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")zw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Pu||(Pu=new RegExp(qw,"u")),Pu.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Vw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")jw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Dw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Bw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),F(i,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?$m(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Qw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ek(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Uw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?tk(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?rk(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?nk(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Xw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Jw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):le.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...G.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...G.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...G.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...G.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...G.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...G.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...G.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...G.errToObj(t)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Er.create=r=>new Er({checks:[],typeName:ee.ZodString,coerce:r?.coerce??!1,...se(r)});function ik(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=Number.parseInt(r.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var on=class r extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.number,received:s.parsedType}),Q}let n,i=new Ue;for(let s of this._def.checks)s.kind==="int"?le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?ik(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_finite,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,G.toString(t))}gt(e,t){return this.setLimit("min",e,!1,G.toString(t))}lte(e,t){return this.setLimit("max",e,!0,G.toString(t))}lt(e,t){return this.setLimit("max",e,!1,G.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};on.create=r=>new on({checks:[],typeName:ee.ZodNumber,coerce:r?.coerce||!1,...se(r)});var an=class r extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n,i=new Ue;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit("min",e,!0,G.toString(t))}gt(e,t){return this.setLimit("min",e,!1,G.toString(t))}lte(e,t){return this.setLimit("max",e,!0,G.toString(t))}lt(e,t){return this.setLimit("max",e,!1,G.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};an.create=r=>new an({checks:[],typeName:ee.ZodBigInt,coerce:r?.coerce??!1,...se(r)});var ln=class extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.boolean,received:n.parsedType}),Q}return Ge(e.data)}};ln.create=r=>new ln({typeName:ee.ZodBoolean,coerce:r?.coerce||!1,...se(r)});var cn=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_date}),Q}let n=new Ue,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):le.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};cn.create=r=>new cn({checks:[],coerce:r?.coerce||!1,typeName:ee.ZodDate,...se(r)});var Qn=class extends oe{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.symbol,received:n.parsedType}),Q}return Ge(e.data)}};Qn.create=r=>new Qn({typeName:ee.ZodSymbol,...se(r)});var un=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.undefined,received:n.parsedType}),Q}return Ge(e.data)}};un.create=r=>new un({typeName:ee.ZodUndefined,...se(r)});var dn=class extends oe{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.null,received:n.parsedType}),Q}return Ge(e.data)}};dn.create=r=>new dn({typeName:ee.ZodNull,...se(r)});var Cr=class extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Cr.create=r=>new Cr({typeName:ee.ZodAny,...se(r)});var tr=class extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};tr.create=r=>new tr({typeName:ee.ZodUnknown,...se(r)});var Mt=class extends oe{_parse(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.never,received:t.parsedType}),Q}};Mt.create=r=>new Mt({typeName:ee.ZodNever,...se(r)});var ei=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.void,received:n.parsedType}),Q}return Ge(e.data)}};ei.create=r=>new ei({typeName:ee.ZodVoid,...se(r)});var rr=class r extends oe{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==W.array)return F(t,{code:T.invalid_type,expected:W.array,received:t.parsedType}),Q;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(F(t,{code:o?T.too_big:T.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(F(t,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(F(t,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new yt(t,o,t.path,a)))).then(o=>Ue.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new yt(t,o,t.path,a)));return Ue.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:G.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:G.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:G.toString(t)}})}nonempty(e){return this.min(1,e)}};rr.create=(r,e)=>new rr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...se(e)});function Jn(r){if(r instanceof it){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=vt.create(Jn(n))}return new it({...r._def,shape:()=>e})}else return r instanceof rr?new rr({...r._def,type:Jn(r.element)}):r instanceof vt?vt.create(Jn(r.unwrap())):r instanceof Vt?Vt.create(Jn(r.unwrap())):r instanceof Bt?Bt.create(r.items.map(e=>Jn(e))):r}var it=class r extends oe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=le.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return F(c,{code:T.invalid_type,expected:W.object,received:c.parsedType}),Q}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip"))for(let c in i.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=s[c],p=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new yt(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Mt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(F(i,{code:T.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let p=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new yt(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,h=await u.value;c.push({key:p,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Ue.mergeObjectSync(n,c)):Ue.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:G.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ee.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of le.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of le.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Jn(this)}partial(e){let t={};for(let n of le.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of le.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof vt;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Mm(le.objectKeys(this.shape))}};it.create=(r,e)=>new it({shape:()=>r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...se(e)});it.strictCreate=(r,e)=>new it({shape:()=>r,unknownKeys:"strict",catchall:Mt.create(),typeName:ee.ZodObject,...se(e)});it.lazycreate=(r,e)=>new it({shape:r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...se(e)});var pn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new nt(a.ctx.common.issues));return F(t,{code:T.invalid_union,unionErrors:o}),Q}if(t.common.async)return Promise.all(n.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s,o=[];for(let l of n){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(l=>new nt(l));return F(t,{code:T.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};pn.create=(r,e)=>new pn({options:r,typeName:ee.ZodUnion,...se(e)});var er=r=>r instanceof fn?er(r.schema):r instanceof _t?er(r.innerType()):r instanceof gn?[r.value]:r instanceof mn?r.options:r instanceof vn?le.objectValues(r.enum):r instanceof yn?er(r._def.innerType):r instanceof un?[void 0]:r instanceof dn?[null]:r instanceof vt?[void 0,...er(r.unwrap())]:r instanceof Vt?[null,...er(r.unwrap())]:r instanceof Es||r instanceof bn?er(r.unwrap()):r instanceof _n?er(r._def.innerType):[],ba=class r extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return F(t,{code:T.invalid_type,expected:W.object,received:t.parsedType}),Q;let n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(F(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let s of t){let o=er(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new r({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...se(n)})}};function Nu(r,e){let t=Ht(r),n=Ht(e);if(r===e)return{valid:!0,data:r};if(t===W.object&&n===W.object){let i=le.objectKeys(e),s=le.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Nu(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===W.array&&n===W.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let o=r[s],a=e[s],l=Nu(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===W.date&&n===W.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var hn=class extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(ya(s)||ya(o))return Q;let a=Nu(s.value,o.value);return a.valid?((_a(s)||_a(o))&&t.dirty(),{status:t.value,value:a.data}):(F(n,{code:T.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hn.create=(r,e,t)=>new hn({left:r,right:e,typeName:ee.ZodIntersection,...se(t)});var Bt=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return F(n,{code:T.invalid_type,expected:W.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return F(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new yt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Ue.mergeArray(t,o)):Ue.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Bt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bt({items:r,typeName:ee.ZodTuple,rest:null,...se(e)})};var xa=class r extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return F(n,{code:T.invalid_type,expected:W.object,received:n.parsedType}),Q;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new yt(n,a,n.path,a)),value:o._parse(new yt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ue.mergeObjectAsync(t,i):Ue.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof oe?new r({keyType:e,valueType:t,typeName:ee.ZodRecord,...se(n)}):new r({keyType:Er.create(),valueType:e,typeName:ee.ZodRecord,...se(t)})}},ti=class extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return F(n,{code:T.invalid_type,expected:W.map,received:n.parsedType}),Q;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new yt(n,a,n.path,[c,"key"])),value:s._parse(new yt(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};ti.create=(r,e,t)=>new ti({valueType:e,keyType:r,typeName:ee.ZodMap,...se(t)});var ri=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return F(n,{code:T.invalid_type,expected:W.set,received:n.parsedType}),Q;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(F(n,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(F(n,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Q;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...n.data.values()].map((l,c)=>s._parse(new yt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:G.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:G.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ri.create=(r,e)=>new ri({valueType:r,minSize:null,maxSize:null,typeName:ee.ZodSet,...se(e)});var wa=class r extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return F(t,{code:T.invalid_type,expected:W.function,received:t.parsedType}),Q;function n(a,l){return Ss({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yn(),Qt].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ss({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yn(),Qt].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ar){let a=this;return Ge(async function(...l){let c=new nt([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(n(l,f)),c}),p=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(p,s).catch(f=>{throw c.addIssue(i(p,f)),c})})}else{let a=this;return Ge(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new nt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new nt([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Bt.create(e).rest(tr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Bt.create([]).rest(tr.create()),returns:t||tr.create(),typeName:ee.ZodFunction,...se(n)})}},fn=class extends oe{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};fn.create=(r,e)=>new fn({getter:r,typeName:ee.ZodLazy,...se(e)});var gn=class extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};gn.create=(r,e)=>new gn({value:r,typeName:ee.ZodLiteral,...se(e)});function Mm(r,e){return new mn({values:r,typeName:ee.ZodEnum,...se(e)})}var mn=class r extends oe{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{expected:le.joinValues(n),received:t.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{received:t.data,code:T.invalid_enum_value,options:n}),Q}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};mn.create=Mm;var vn=class extends oe{_parse(e){let t=le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=le.objectValues(t);return F(n,{expected:le.joinValues(i),received:n.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=le.objectValues(t);return F(n,{received:n.data,code:T.invalid_enum_value,options:i}),Q}return Ge(e.data)}get enum(){return this._def.values}};vn.create=(r,e)=>new vn({values:r,typeName:ee.ZodNativeEnum,...se(e)});var Ar=class extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return F(t,{code:T.invalid_type,expected:W.promise,received:t.parsedType}),Q;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ar.create=(r,e)=>new Ar({type:r,typeName:ee.ZodPromise,...se(e)});var _t=class extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{F(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return Q;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Q:l.status==="dirty"?sn(l.value):t.value==="dirty"?sn(l.value):l});{if(t.value==="aborted")return Q;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Q:a.status==="dirty"?sn(a.value):t.value==="dirty"?sn(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Sr(o))return Q;let a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Sr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):Q);le.assertNever(i)}};_t.create=(r,e,t)=>new _t({schema:r,typeName:ee.ZodEffects,effect:e,...se(t)});_t.createWithPreprocess=(r,e,t)=>new _t({schema:e,effect:{type:"preprocess",transform:r},typeName:ee.ZodEffects,...se(t)});var vt=class extends oe{_parse(e){return this._getType(e)===W.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vt.create=(r,e)=>new vt({innerType:r,typeName:ee.ZodOptional,...se(e)});var Vt=class extends oe{_parse(e){return this._getType(e)===W.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vt.create=(r,e)=>new Vt({innerType:r,typeName:ee.ZodNullable,...se(e)});var yn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};yn.create=(r,e)=>new yn({innerType:r,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...se(e)});var _n=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new nt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new nt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_n.create=(r,e)=>new _n({innerType:r,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...se(e)});var ni=class extends oe{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};ni.create=r=>new ni({typeName:ee.ZodNaN,...se(r)});var sk=Symbol("zod_brand"),Es=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Cs=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(t.dirty(),sn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:ee.ZodPipeline})}},bn=class extends oe{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Sr(i)&&(i.value=Object.freeze(i.value)),i);return Xn(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};bn.create=(r,e)=>new bn({innerType:r,typeName:ee.ZodReadonly,...se(e)});function Rm(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Om(r,e={},t){return r?Cr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Rm(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Rm(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Cr.create()}var ok={object:it.lazycreate},ee;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ee||(ee={}));var ak=(r,e={message:`Input not instance of ${r.name}`})=>Om(t=>t instanceof r,e),Pm=Er.create,Nm=on.create,lk=ni.create,ck=an.create,Lm=ln.create,uk=cn.create,dk=Qn.create,pk=un.create,hk=dn.create,fk=Cr.create,gk=tr.create,mk=Mt.create,vk=ei.create,yk=rr.create,_k=it.create,bk=it.strictCreate,xk=pn.create,wk=ba.create,kk=hn.create,Sk=Bt.create,Ek=xa.create,Ck=ti.create,Ak=ri.create,Rk=wa.create,Tk=fn.create,Ik=gn.create,$k=mn.create,Mk=vn.create,Ok=Ar.create,Pk=_t.create,Nk=vt.create,Lk=Vt.create,Fk=_t.createWithPreprocess,Dk=Cs.create,Hk=()=>Pm().optional(),Bk=()=>Nm().optional(),Vk=()=>Lm().optional(),jk={string:(r=>Er.create({...r,coerce:!0})),number:(r=>on.create({...r,coerce:!0})),boolean:(r=>ln.create({...r,coerce:!0})),bigint:(r=>an.create({...r,coerce:!0})),date:(r=>cn.create({...r,coerce:!0}))};var Wk=Q;var Uk=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Fm=["ui.click","ui.scroll","ui.input","ui.change","ui.submit","ui.hover","ui.idle","ui.scroll_thrash","ui.focus_bounce","nav.page_view","nav.page_leave","behavior.rage_click","behavior.hesitation","behavior.confusion"],Dm=d.enum(Fm).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Hm=["time_on_page","page_views","scroll_depth"],Bm=d.enum(Hm).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var ka=d.object({type:d.literal("page_url"),url:d.string().describe('URL path to match (e.g. "/pricing", "/dashboard")')}).describe('Fires when the current page URL matches. Use for page-specific actions. Example: {"type": "page_url", "url": "/pricing"}'),Sa=d.object({type:d.literal("route"),routeId:d.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),Ea=d.object({type:d.literal("anchor_visible"),anchorId:d.string().describe("CSS selector of the anchor element"),state:d.enum(["visible","present","absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')}).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`),Ca=d.object({type:d.literal("event_occurred"),eventName:d.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:d.number().optional().describe("Time window in ms. Omit = any time this session.")}).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}'),Aa=d.object({type:d.literal("state_equals"),key:d.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:d.unknown().describe("Expected value to match against")}).describe("Checks the SDK persistent state store (localStorage). ONLY for host-app state set via syntro.state.set() \u2014 NOT for user attributes like region, device, or UTM params (those are handled by segment targeting). Do NOT use this for targeting. If you do not know the valid state keys, do not use this condition type."),Ra=d.object({type:d.literal("viewport"),minWidth:d.number().optional().describe("Minimum viewport width in pixels"),maxWidth:d.number().optional().describe("Maximum viewport width in pixels"),minHeight:d.number().optional().describe("Minimum viewport height in pixels"),maxHeight:d.number().optional().describe("Maximum viewport height in pixels")}).describe('Fires based on viewport (screen) size. Use for responsive behavior. Example: {"type": "viewport", "minWidth": 768} \u2014 fires on tablet and larger.'),Ta=d.object({type:d.literal("session_metric"),key:Bm,operator:d.enum(["gte","lte","eq","gt","lt"]),threshold:d.number().describe("Numeric threshold to compare against")}).describe('Fires when a session metric crosses a threshold. Valid keys: "time_on_page" (seconds), "page_views" (count), "scroll_depth" (0-100). Example: {"type": "session_metric", "key": "time_on_page", "operator": "gte", "threshold": 30}'),Ia=d.object({type:d.literal("dismissed"),key:d.string().describe("Dismissal key (usually a tile or action ID)"),inverted:d.boolean().optional().describe("When true, fires if NOT dismissed (default behavior)")}).describe("Checks if an item has been dismissed by the user. Use with inverted: true to show only if not dismissed."),$a=d.object({type:d.literal("cooldown_active"),key:d.string().describe("Cooldown key"),inverted:d.boolean().optional().describe("When true, fires if cooldown is NOT active")}).describe("Checks if a cooldown timer is currently active. Use to prevent showing the same intervention too frequently."),Ma=d.object({type:d.literal("frequency_limit"),key:d.string().describe("Frequency counter key"),limit:d.number().describe("Maximum allowed count"),inverted:d.boolean().optional().describe("When true, fires if limit NOT reached")}).describe("Checks if a frequency limit has been reached. Use to cap how many times an action fires per session."),ii=d.object({equals:d.union([d.string(),d.number(),d.boolean()]).optional(),contains:d.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),si=d.object({events:d.array(Dm).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),ii).optional().describe("Property filters. Keys are event prop names or element-chain fields (tag_name, $el_text, attr__*). All entries AND together.")}).describe("Defines what events to count. Registered as an accumulator predicate at config-load time."),Oa=d.object({type:d.literal("event_count"),key:d.string().describe("Unique key for this counter (used for accumulator registration)"),operator:d.enum(["gte","lte","eq","gt","lt"]),count:d.number().int().min(0).describe("Target count threshold"),withinMs:d.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:si.optional().describe("Inline counter definition. Defines what events to count.")}).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}'),nr=d.discriminatedUnion("type",[ka,Sa,Ea,Ca,Aa,Ra,Ta,Ia,$a,Ma,Oa]),oi=d.object({conditions:d.array(nr).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:d.unknown().describe("Value returned when all conditions match. For triggerWhen: true = fire the action.")}).describe("A single rule. ALL conditions must match (AND logic). Rules in a strategy are evaluated top-to-bottom \u2014 first rule where all conditions match wins and returns its value."),ai=d.object({type:d.literal("rules"),rules:d.array(oi).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:d.unknown().describe("Fallback value when no rule matches. For triggerWhen: false = do not fire by default.")}).describe("Rule-based strategy. Evaluates rules top-to-bottom. First rule where ALL conditions match returns its value. If no rule matches, returns default. For triggerWhen: set value=true on matching rules, default=false."),li=d.object({type:d.literal("score"),field:d.string(),threshold:d.number(),above:d.unknown(),below:d.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),ci=d.object({type:d.literal("model"),modelId:d.string(),inputs:d.array(d.string()),outputMapping:d.record(d.string(),d.unknown()),default:d.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),ui=d.object({type:d.literal("external"),endpoint:d.string(),method:d.enum(["GET","POST"]).optional(),default:d.unknown(),timeoutMs:d.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),di=d.discriminatedUnion("type",[ai,li,ci,ui]),As=di.nullable().optional();var zk=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),qk=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function Vm(r){let{href:e,external:t,windowOrigin:n,isIframe:i}=r;if(i||n==="null")return{kind:"open",url:e};if(t)return{kind:"open",url:e};let o;try{o=new URL(e,n)}catch{return{kind:"fullnav",url:e}}return o.origin!==n?{kind:"fullnav",url:o.toString()}:{kind:"spa",url:o}}function jm(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var De=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Pa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},He,Ts,Is,Lu,Fu,Ym,Du,Wm,Um,zm,Rs,Hu,Zk="#6a59ce",qm="#677384",Zm="#87919f";function Gk(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Kk(r){return nn(r)||Gk(r)}function Gm(r){if(typeof window>"u")return!1;let e=window.location.pathname;return r.some(t=>{let n=t.split("?")[0].split("#")[0];return n.endsWith("/**")?e.startsWith(n.slice(0,-3)):e===n})}function Yk(r){let e=[{boxShadow:"0 0 0 0 rgba(13, 148, 136, 0.5)"},{boxShadow:"0 0 0 8px rgba(13, 148, 136, 0)"}];r.animate(e,{duration:600,iterations:3,easing:"ease-out"})}function Xk(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Na=class extends fe{constructor(){super(...arguments),He.add(this),this.config={expandBehavior:"single",theme:"auto",actions:[]},this.runtime=void 0,this.instanceId="nav-widget",this._expandedIds=new Set,this._renderTick=0,this._hoveredId=null,Ts.set(this,null),Is.set(this,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),De(this,He,"m",Lu).call(this)}disconnectedCallback(){super.disconnectedCallback(),De(this,He,"m",Fu).call(this)}updated(e){e.has("runtime")&&(De(this,He,"m",Fu).call(this),De(this,He,"m",Lu).call(this))}render(){let e=De(this,He,"m",Ym).call(this),t=De(this,He,"m",Du).call(this),n=I({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),i=I({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),s=I({fontSize:"var(--sc-content-category-font-size, 12px)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",padding:"var(--sc-content-category-padding, 8px 4px 4px 4px)",color:t==="dark"?Zm:qm}),o=I({fontSize:"13px",padding:"16px",textAlign:"center",color:t==="dark"?qm:Zm});if(e.length===0)return j`
303
303
  <div
304
304
  style=${n}
305
305
  data-adaptive-id=${this.instanceId}
@@ -319,11 +319,11 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
319
319
  <div style=${i}>
320
320
  ${l?Array.from(a.entries()).map(([c,u])=>j`
321
321
  ${c?j`<div style=${s} data-category-header=${c}>${c}</div>`:J}
322
- ${u.map((p,h)=>Fe(this,De,"m",Lu).call(this,p,h,u.length))}
323
- `):e.map((c,u)=>Fe(this,De,"m",Lu).call(this,c,u,e.length))}
322
+ ${u.map((p,h)=>De(this,He,"m",Hu).call(this,p,h,u.length))}
323
+ `):e.map((c,u)=>De(this,He,"m",Hu).call(this,c,u,e.length))}
324
324
  </div>
325
325
  </div>
326
- `}};Ts=new WeakMap,Is=new WeakMap,De=new WeakSet,Ou=function(){this.runtime&&($a(this,Ts,this.runtime.context.subscribe(()=>{this._renderTick+=1}),"f"),this.runtime.accumulator?.subscribe&&$a(this,Is,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1}),"f"))},Pu=function(){Fe(this,Ts,"f")?.call(this),$a(this,Ts,null,"f"),Fe(this,Is,"f")?.call(this),$a(this,Is,null,"f")},Zm=function(){return this._renderTick,this.runtime?this.config.actions.filter(e=>{if(!e.triggerWhen)return!0;try{return this.runtime.evaluateSync(e.triggerWhen).value}catch{return!1}}):this.config.actions},Nu=function(){return Gk(this.config.theme)},Bm=function(e){let t=this._expandedIds.has(e),n;if(this.config.expandBehavior==="single"){for(let i of this._expandedIds)i!==e&&Fe(this,De,"m",Rs).call(this,"nav:toggled",{tipId:i,expanded:!1});n=t?new Set:new Set([e])}else n=new Set(this._expandedIds),t?n.delete(e):n.add(e);Fe(this,De,"m",Rs).call(this,"nav:toggled",{tipId:e,expanded:!t}),this._expandedIds=n},Vm=function(e,t){let n=e.trim().toLowerCase();if(n.startsWith("javascript:")||n.startsWith("data:"))return;Fe(this,De,"m",Rs).call(this,"nav:tip_clicked",{href:e,external:t}),this.dispatchEvent(new CustomEvent("nav-tip-clicked",{bubbles:!0,detail:{href:e,external:t,instanceId:this.instanceId}}));let i=Dm({href:e,external:t,windowOrigin:typeof window<"u"?window.location.origin:"",isIframe:Hm()});if(i.kind==="open"){window.open(i.url,"_blank","noopener,noreferrer");return}if(i.kind==="fullnav"){window.location.href=i.url;return}i.url.search=window.location.search,Fu(i.url.toString())||(window.history.pushState(null,"",i.url.toString()),window.dispatchEvent(new PopStateEvent("popstate")))},jm=function(e){let t=document.querySelector(e.selector);t instanceof HTMLElement&&(Fe(this,De,"m",Rs).call(this,"nav:tip_focused",{selector:e.selector,route:e.route}),this.dispatchEvent(new CustomEvent("nav-tip-focused",{bubbles:!0,detail:{selector:e.selector,instanceId:this.instanceId}})),t.scrollIntoView({behavior:"smooth",block:"center"}),Zk(t),setTimeout(()=>t.focus(),400))},Rs=function(e,t){this.runtime?.events.publish(e,{instanceId:this.instanceId,timestamp:Date.now(),...t})},Lu=function(e,t,n){let{id:i,title:s,description:o,href:a,icon:l,external:c,anchor:u,category:p}=e.config,h=this._expandedIds.has(i),f=t===n-1,v=this._hoveredId===i,m=Fe(this,De,"m",Nu).call(this),g=u?Array.isArray(u.route)?u.route[0]:u.route:a,y=u?zm(Array.isArray(u.route)?u.route:[u.route]):g?zm([g]):!1,x=u?.selector&&u.selector!=="*",k=y&&x,_=!!g||k,w=k?"Focus \u2192":c?"Go \u2197":"Go \u2192",R=I({borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.2s ease",backgroundColor:"var(--sc-content-background)",border:"var(--sc-content-border)",...h?{boxShadow:m==="dark"?"0 4px 12px rgba(0, 0, 0, 0.15)":"0 4px 12px rgba(0, 0, 0, 0.08)"}:{},...f?{}:{borderBottom:"var(--sc-content-item-divider, none)"}}),b=I({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:"500",fontFamily:"inherit",textAlign:"left",transition:"background-color 0.15s ease",backgroundColor:v?"var(--sc-content-background-hover)":"transparent",color:"var(--sc-content-text-color)"}),A=I({fontSize:"20px",transition:"transform 0.2s ease",marginLeft:"auto",flexShrink:"0",color:"var(--sc-content-chevron-color, currentColor)",transform:h?"rotate(90deg)":"rotate(0deg)"}),$=I({overflow:"hidden",transition:"max-height 0.25s ease, padding-bottom 0.25s ease",padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",color:"var(--sc-content-text-secondary-color)",maxHeight:h?"500px":"0",paddingBottom:h?"16px":"0"}),N=I({fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:"1.5",margin:"0"}),M=I({display:"inline-flex",alignItems:"center",gap:"4px",marginTop:"10px",padding:"6px 12px",borderRadius:"6px",textDecoration:"none",fontSize:"13px",fontWeight:"500",cursor:"pointer",border:"none",transition:"background-color 0.15s ease",backgroundColor:`var(--sc-color-primary, ${Uk})`,color:"#ffffff"}),K=I({fontSize:"16px",flexShrink:"0"}),L=O=>{O.preventDefault(),O.stopPropagation(),k&&u?Fe(this,De,"m",jm).call(this,u):g&&Fe(this,De,"m",Vm).call(this,g,c??!1)};return j`
326
+ `}};Ts=new WeakMap,Is=new WeakMap,He=new WeakSet,Lu=function(){this.runtime&&(Pa(this,Ts,this.runtime.context.subscribe(()=>{this._renderTick+=1}),"f"),this.runtime.accumulator?.subscribe&&Pa(this,Is,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1}),"f"))},Fu=function(){De(this,Ts,"f")?.call(this),Pa(this,Ts,null,"f"),De(this,Is,"f")?.call(this),Pa(this,Is,null,"f")},Ym=function(){return this._renderTick,this.runtime?this.config.actions.filter(e=>{if(!e.triggerWhen)return!0;try{return this.runtime.evaluateSync(e.triggerWhen).value}catch{return!1}}):this.config.actions},Du=function(){return Xk(this.config.theme)},Wm=function(e){let t=this._expandedIds.has(e),n;if(this.config.expandBehavior==="single"){for(let i of this._expandedIds)i!==e&&De(this,He,"m",Rs).call(this,"nav:toggled",{tipId:i,expanded:!1});n=t?new Set:new Set([e])}else n=new Set(this._expandedIds),t?n.delete(e):n.add(e);De(this,He,"m",Rs).call(this,"nav:toggled",{tipId:e,expanded:!t}),this._expandedIds=n},Um=function(e,t){let n=e.trim().toLowerCase();if(n.startsWith("javascript:")||n.startsWith("data:"))return;De(this,He,"m",Rs).call(this,"nav:tip_clicked",{href:e,external:t}),this.dispatchEvent(new CustomEvent("nav-tip-clicked",{bubbles:!0,detail:{href:e,external:t,instanceId:this.instanceId}}));let i=Vm({href:e,external:t,windowOrigin:typeof window<"u"?window.location.origin:"",isIframe:jm()});if(i.kind==="open"){window.open(i.url,"_blank","noopener,noreferrer");return}if(i.kind==="fullnav"){window.location.href=i.url;return}i.url.search=window.location.search,Bu(i.url.toString())||(window.history.pushState(null,"",i.url.toString()),window.dispatchEvent(new PopStateEvent("popstate")))},zm=function(e){let t=document.querySelector(e.selector);t instanceof HTMLElement&&(De(this,He,"m",Rs).call(this,"nav:tip_focused",{selector:e.selector,route:e.route}),this.dispatchEvent(new CustomEvent("nav-tip-focused",{bubbles:!0,detail:{selector:e.selector,instanceId:this.instanceId}})),t.scrollIntoView({behavior:"smooth",block:"center"}),Yk(t),setTimeout(()=>t.focus(),400))},Rs=function(e,t){this.runtime?.events.publish(e,{instanceId:this.instanceId,timestamp:Date.now(),...t})},Hu=function(e,t,n){let{id:i,title:s,description:o,href:a,icon:l,external:c,anchor:u,category:p}=e.config,h=this._expandedIds.has(i),f=t===n-1,v=this._hoveredId===i,g=De(this,He,"m",Du).call(this),m=u?Array.isArray(u.route)?u.route[0]:u.route:a,y=u?Gm(Array.isArray(u.route)?u.route:[u.route]):m?Gm([m]):!1,x=u?.selector&&u.selector!=="*",k=y&&x,_=!!m||k,w=k?"Focus \u2192":c?"Go \u2197":"Go \u2192",R=I({borderRadius:"var(--sc-content-border-radius, 8px)",overflow:"hidden",transition:"box-shadow 0.2s ease",backgroundColor:"var(--sc-content-background)",border:"var(--sc-content-border)",...h?{boxShadow:g==="dark"?"0 4px 12px rgba(0, 0, 0, 0.15)":"0 4px 12px rgba(0, 0, 0, 0.08)"}:{},...f?{}:{borderBottom:"var(--sc-content-item-divider, none)"}}),b=I({display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"var(--sc-content-item-padding, 12px 16px)",border:"none",cursor:"pointer",fontSize:"var(--sc-content-item-font-size, 15px)",fontWeight:"500",fontFamily:"inherit",textAlign:"left",transition:"background-color 0.15s ease",backgroundColor:v?"var(--sc-content-background-hover)":"transparent",color:"var(--sc-content-text-color)"}),A=I({fontSize:"20px",transition:"transform 0.2s ease",marginLeft:"auto",flexShrink:"0",color:"var(--sc-content-chevron-color, currentColor)",transform:h?"rotate(90deg)":"rotate(0deg)"}),$=I({overflow:"hidden",transition:"max-height 0.25s ease, padding-bottom 0.25s ease",padding:"var(--sc-content-body-padding, 0 16px 12px 16px)",color:"var(--sc-content-text-secondary-color)",maxHeight:h?"500px":"0",paddingBottom:h?"16px":"0"}),N=I({fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:"1.5",margin:"0"}),M=I({display:"inline-flex",alignItems:"center",gap:"4px",marginTop:"10px",padding:"6px 12px",borderRadius:"6px",textDecoration:"none",fontSize:"13px",fontWeight:"500",cursor:"pointer",border:"none",transition:"background-color 0.15s ease",backgroundColor:`var(--sc-color-primary, ${Zk})`,color:"#ffffff"}),K=I({fontSize:"16px",flexShrink:"0"}),L=P=>{P.preventDefault(),P.stopPropagation(),k&&u?De(this,He,"m",zm).call(this,u):m&&De(this,He,"m",Um).call(this,m,c??!1)};return j`
327
327
  <div
328
328
  style=${R}
329
329
  data-nav-tip-id=${i}
@@ -332,11 +332,11 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
332
332
  type="button"
333
333
  style=${b}
334
334
  aria-expanded=${h}
335
- @click=${()=>Fe(this,De,"m",Bm).call(this,i)}
335
+ @click=${()=>De(this,He,"m",Wm).call(this,i)}
336
336
  @mouseenter=${()=>{this._hoveredId=i}}
337
337
  @mouseleave=${()=>{this._hoveredId=null}}
338
338
  >
339
- ${l?j`<span style=${K}>${sa(qk(l))}</span>`:J}
339
+ ${l?j`<span style=${K}>${la(Kk(l))}</span>`:J}
340
340
  <span>${s}</span>
341
341
  <span style=${A}>${"\u203A"}</span>
342
342
  </button>
@@ -344,7 +344,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
344
344
  <p style=${N}>${o}</p>
345
345
  ${_?j`
346
346
  <a
347
- href=${g||"#"}
347
+ href=${m||"#"}
348
348
  style=${M}
349
349
  target=${c?"_blank":J}
350
350
  rel=${c?"noopener noreferrer":J}
@@ -353,7 +353,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
353
353
  `:J}
354
354
  </div>
355
355
  </div>
356
- `};Ma.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var qm="syntro-nav-tips";function Gm(){typeof window>"u"||customElements.get(qm)||customElements.define(qm,Ma)}var Kk=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);return t?(t.scrollIntoView({behavior:r.behavior??"smooth",block:r.block??"center",inline:r.inline??"nearest"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:scrollTo",anchorId:r.anchorId,behavior:r.behavior??"smooth"}),{cleanup:()=>{}}):(console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${r.anchorId.selector}`),{cleanup:()=>{}})};function Fu(r){if(typeof window>"u")return!1;let e=window;try{let t=e.next?.router;if(t?.push)return t.push(r),!0}catch{}try{if(e.$nuxt?.$router?.push)return e.$nuxt.$router.push(r),!0}catch{}return e.ng||e.getAllAngularRootElements||document.querySelector("[ng-version]")||e.__SVELTEKIT_DATA__||document.body?.hasAttribute("data-sveltekit")||document.querySelector("[data-astro-transition-fallback]")?(window.location.href=r,!0):!1}function Yk(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var Xk=async(r,e)=>{let t=r.url.trim();if(t.toLowerCase().startsWith("javascript:"))throw new Error("javascript: URLs are not allowed");let n=r.target??"_self";return e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:navigate",url:r.url,target:n}),n==="_blank"?window.open(t,"_blank","noopener,noreferrer"):!r.forceFullNavigation&&Yk(t)?Fu(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},Jk={mount(r,e){Gm();let t=document.createElement("syntro-nav-tips"),{runtime:n,instanceId:i="nav-widget",...s}=e??{expandBehavior:"single",theme:"auto",actions:[]};return Object.assign(t,{config:s,runtime:n,instanceId:i}),r.appendChild(t),()=>t.remove()}},Qk=[{kind:"navigation:scrollTo",executor:Kk},{kind:"navigation:navigate",executor:Xk}],Km={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:Qk,widgets:[{id:"adaptive-nav:tips",component:Jk,metadata:{name:"Navigation Tips",description:"Accordion of contextual navigation tips with per-item visibility",icon:"\u{1F9ED}"}}],notifyWatchers(r){return(r.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`nav:${t.config.id}`,strategy:t.triggerWhen,eventName:"nav:tip_revealed",eventProps:{tipId:t.config.id,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var eS=[Wc,xm,Km,pu],tS=eS.map(r=>({id:r.id,version:r.version,name:r.name,description:r.description,runtime:{actions:(r.executors||[]).map(({kind:e,executor:t})=>({kind:e,executor:t})),widgets:r.widgets,notifyWatchers:r.notifyWatchers,events:r.eventHandlers},editor:void 0,metadata:{isBuiltIn:!0}}));function Ym(r){let e=0;for(let t of tS)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var xn=class extends Event{constructor(e,t,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=i??!1}};var Oa=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:n}]of this.subscriptions)t(this.o,n)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Du=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},pi=class extends Oa{constructor(e,t,n){super(t.context!==void 0?t.initialValue:n),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)s.has(o)||(s.add(o),a.dispatchEvent(new xn(this.context,a,o,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Du(this.context,this.host))}};var Te="1.0.0",ke={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",UI_HESITATE:"ui.hesitate",UI_RAGE_CLICK:"ui.rage_click",UI_SCROLL_THRASH:"ui.scroll_thrash",UI_FOCUS_BOUNCE:"ui.focus_bounce",UI_IDLE:"ui.idle",UI_HOVER:"ui.hover"},Xe={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},$s={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},Hu={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var Pa=class{constructor(e,t){this.config=e,this.emit=t,this.focused=new Map}ingest(e){if(e.type!==3)return;let t=e.timestamp;if(e.data.source===Xe.MouseInteraction){let n=e.data.id??0;if(e.data.type===$s.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===$s.Blur){let i=this.focused.get(n);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:ke.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Te,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===Xe.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var Na=class{constructor(e,t){this.config=e,this.emit=t,this.anchorX=0,this.anchorY=0,this.anchorTs=0,this.emitted=!1,this.hasPosition=!1}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let n=t[t.length-1],i=e.timestamp+(n.timeOffset??0);if(!this.hasPosition){this.anchorX=n.x,this.anchorY=n.y,this.anchorTs=i,this.hasPosition=!0,this.emitted=!1;return}let s=n.x-this.anchorX,o=n.y-this.anchorY;Math.sqrt(s*s+o*o)>this.config.hesitationRadiusPx&&(this.anchorX=n.x,this.anchorY=n.y,this.anchorTs=i,this.emitted=!1)}tick(e){if(!this.hasPosition||this.emitted)return;let t=e-this.anchorTs;t>=this.config.hesitationMs&&(this.emit({ts:e,name:ke.UI_HESITATE,source:"rrweb",schemaVersion:Te,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var La=class{constructor(e,t,n){this.config=e,this.emit=t,this.elementResolver=n,this.currentElement=null,this.hoverStartTs=null,this.lastX=0,this.lastY=0,this.lastSampleTs=-1/0}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let n=t[t.length-1];this.lastX=n.x,this.lastY=n.y}tick(e){if(!this.elementResolver||e-this.lastSampleTs<this.config.hoverSampleMs)return;this.lastSampleTs=e;let t=this.elementResolver(this.lastX,this.lastY),n=t?Xm(t):null,i=this.currentElement?Xm(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:ke.UI_HOVER,source:"rrweb",schemaVersion:Te,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function Xm(r){return`${r.tag_name??""}|${r.attr__id??""}|${(r.classes??[]).join(",")}`}var Fa=class{constructor(e,t){this.config=e,this.emit=t,this.lastActivityTs=null,this.emitted=!1}ingest(e){if(e.type!==3)return;let t=e.data.source;(t===Xe.MouseMove||t===Xe.MouseInteraction||t===Xe.Scroll)&&(this.lastActivityTs=e.timestamp,this.emitted=!1)}tick(e){this.lastActivityTs===null||this.emitted||e-this.lastActivityTs>=this.config.idleMs&&(this.emit({ts:e,name:ke.UI_IDLE,source:"rrweb",schemaVersion:Te,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Da=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==Xe.MouseInteraction||e.data.type!==$s.Click)return;let t=e.data.x??0,n=e.data.y??0,i=e.timestamp,s=i-this.config.rageClickWindowMs;this.clicks=this.clicks.filter(a=>a.ts>=s),this.clicks.push({ts:i,x:t,y:n});let o=this.clicks.filter(a=>{let l=a.x-t,c=a.y-n;return Math.sqrt(l*l+c*c)<=this.config.rageClickRadiusPx});o.length>=this.config.rageClickCount&&(this.emit({ts:i,name:ke.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Te,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Ha=class{constructor(e,t){this.config=e,this.emit=t,this.lastY=null,this.lastDirection=null,this.reversals=[]}ingest(e){if(e.type!==3||e.data.source!==Xe.Scroll)return;let t=e.data.y??0,n=e.timestamp;if(this.lastY!==null){let i=t>this.lastY?"down":t<this.lastY?"up":this.lastDirection;if(i&&i!==this.lastDirection){let s=n-this.config.scrollThrashWindowMs;this.reversals=this.reversals.filter(o=>o>s),this.reversals.push(n),this.reversals.length>=this.config.scrollThrashReversals&&(this.emit({ts:n,name:ke.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:Te,props:{reversals:this.reversals.length,duration_ms:n-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var Jm={$click:ke.UI_CLICK,$scroll:ke.UI_SCROLL,$input:ke.UI_INPUT,$change:ke.UI_CHANGE,$submit:ke.UI_SUBMIT,$pageview:ke.NAV_PAGE_VIEW,$pageleave:ke.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function iS(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(Jm[e])return Jm[e];if(e==="$autocapture"){let t=r.properties?.$tag_name,n=r.properties?.$event_type;return n==="submit"?ke.UI_SUBMIT:n==="change"?ke.UI_CHANGE:t==="input"||t==="textarea"?ke.UI_INPUT:ke.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var Qm=new Set(["a","button","input","select","textarea"]);function sS(r){if(r)return r.split(";").map(e=>{let t={},n=e.indexOf(":"),i=n>=0?e.slice(0,n):e,s=n>=0?e.slice(n+1):"",o=i.indexOf(".");if(o>=0?(t.tag_name=i.slice(0,o),t.attr__class=i.slice(o+1).replace(/\./g," ")):t.tag_name=i,!/^[a-zA-Z][a-zA-Z0-9-]*$/.test(String(t.tag_name??"")))return null;let a=/([\w$]+)="([^"]*)"/g,l;for(;(l=a.exec(s))!==null;){let[,c,u]=l;c==="nth-child"||c==="nth-of-type"||(t[c]=u)}return t.text&&(t.$el_text=t.text,delete t.text),t}).filter(e=>e!==null)}function oS(r,e){if(e&&Qm.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&Qm.has(n))return n}return e}function aS(r){let e={},t=r.properties||{},n=t.$elements??(typeof t.$elements_chain=="string"?sS(t.$elements_chain):void 0),i=t.$tag_name??n?.[0]?.tag_name,s=r.event==="$autocapture"||r.event==="$click";return e.tagName=s?oS(n,i):i,t.$el_text&&(e.elementText=t.$el_text),n&&(e.elements=n),s&&!n&&console.warn(`[PostHogNormalizer] $autocapture click has no element chain. PostHog may have changed wire format. Properties: $elements=${!!t.$elements}, $elements_chain=${typeof t.$elements_chain}`),t.$current_url&&(e.url=t.$current_url),t.$pathname&&(e.pathname=t.$pathname),t.$host&&(e.host=t.$host),t.$viewport_width&&(e.viewportWidth=t.$viewport_width),t.$viewport_height&&(e.viewportHeight=t.$viewport_height),t.$session_id&&(e.sessionId=t.$session_id),t.$scroll_depth&&(e.scrollDepth=t.$scroll_depth),t.$scroll_percentage&&(e.scrollPercentage=t.$scroll_percentage),e.originalEvent=r.event,e}function hi(r){let e;return typeof r.timestamp=="number"?e=r.timestamp:typeof r.timestamp=="string"?e=new Date(r.timestamp).getTime():e=Date.now(),{ts:e,name:iS(r),source:"posthog",props:aS(r),schemaVersion:Te}}function fi(r){let e=r.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function Bu(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if(fi(n)){let i=hi(n);r(i)}}}function Vu(r){let e={...Hu,...r?.config},t=[];function n(p){for(let h of t)h(p)}let i=new Na(e,n),s=new Da(e,n),o=new Ha(e,n),a=new Pa(e,n),l=new Fa(e,n),c=new La(e,n,r?.elementResolver),u=[];return{ingest(p){if(p.kind==="posthog"){let{kind:h,...f}=p;fi(f)&&n(hi(f))}else p.kind==="rrweb"&&(i.ingest(p),s.ingest(p),o.ingest(p),a.ingest(p),l.ingest(p),c.ingest(p))},onEvent(p){t.push(p)},tick(p){i.tick(p),l.tick(p),c.tick(p)},enrichClickAttributes(p,h){u.push({ts:p,elements:h});let f=p-500;for(;u.length>0&&u[0].ts<f;)u.shift()}}}var He={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",CANVAS_OPENED:"canvas.opened",CANVAS_CLOSED:"canvas.closed",TILE_VIEWED:"tile.viewed",TILE_EXPANDED:"tile.expanded",TILE_COLLAPSED:"tile.collapsed",TILE_ACTION:"tile.action",OVERLAY_STARTED:"overlay.started",OVERLAY_COMPLETED:"overlay.completed",OVERLAY_DISMISSED:"overlay.dismissed",OVERLAY_STEP_VIEWED:"overlay.step_viewed",BEHAVIOR_RAGE_CLICK:"behavior.rage_click",BEHAVIOR_HESITATION:"behavior.hesitation",BEHAVIOR_CONFUSION:"behavior.confusion",ACTION_APPLIED:"action.applied",ACTION_REVERTED:"action.reverted",ACTION_FAILED:"action.failed",ACTION_CTA_CLICKED:"action.cta_clicked",NOTIFICATION_SHOWN:"notification.shown",NOTIFICATION_CLICKED:"notification.clicked",NOTIFICATION_DISMISSED:"notification.dismissed",NOTIFICATION_DEEP_LINK:"notification.deep_link",SURFACE_MOUNTED:"surface.mounted",SURFACE_UNMOUNTED:"surface.unmounted"};var Ba=3;var Va=3e4;var cS=0;function ju(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function uS(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function ev(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!uS(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++cS}-${s}`,title:ju(i.title,r.props),body:i.body?ju(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?ju(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var gi=class{constructor(e,t,n){this._notifications=[];this._cooldownMap=new Map;this._timerIds=new Map;this._unsubscribe=null;this.host=e,this.eventBus=t,this.tiles=n,e.addController(this)}get notifications(){return this._notifications}setTiles(e){this.tiles=e}setEventBus(e){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null),this.eventBus=e,this.eventBus&&this.hostConnected()}hostConnected(){this.eventBus&&(this._unsubscribe=this.eventBus.subscribe(e=>{let t=ev(e,this.tiles);if(!t)return;let{notification:n,rule:i}=t,s=n.itemId?`${n.tileId}:${e.name}:${n.itemId}`:`${n.tileId}:${e.name}`,o=this._cooldownMap.get(s),a=Date.now(),l=i.cooldown??3e4;if(o!==void 0&&a-o<l||(this._cooldownMap.set(s,a),n.itemId&&this._notifications.some(p=>p.tileId===n.tileId&&p.itemId===n.itemId)))return;let c=[...this._notifications,n];if(c.length>3){let u=c.shift(),p=this._timerIds.get(u.id);p&&(clearTimeout(p),this._timerIds.delete(u.id))}this._notifications=c,this.host.requestUpdate(),this.eventBus.publish(He.NOTIFICATION_SHOWN,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId,title:n.title}),this._scheduleDismiss(n)}))}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null);for(let e of this._timerIds.values())clearTimeout(e);this._timerIds.clear()}dismiss(e){let t=this._notifications.find(i=>i.id===e);t&&this._publishDismissed(t),this._notifications=this._notifications.filter(i=>i.id!==e);let n=this._timerIds.get(e);n&&(clearTimeout(n),this._timerIds.delete(e)),this.host.requestUpdate()}_publishDismissed(e){this.eventBus?.publish(He.NOTIFICATION_DISMISSED,{notificationId:e.id,tileId:e.tileId,itemId:e.itemId})}_scheduleDismiss(e){let t=setTimeout(()=>{this._notifications=this._notifications.filter(n=>n.id!==e.id),this._timerIds.delete(e.id),this._publishDismissed(e),this.host.requestUpdate()},e.ttl);this._timerIds.set(e.id,t)}};function Ot(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:Te}}function dS(r){return Ot(He.CANVAS_OPENED,{surface:r})}function pS(r){return Ot(He.CANVAS_CLOSED,{surface:r})}function hS(r,e){return Ot(He.TILE_VIEWED,{tileId:r,surface:e})}function fS(r,e){return Ot(He.TILE_EXPANDED,{tileId:r,surface:e})}function gS(r,e){return Ot(He.TILE_COLLAPSED,{tileId:r,surface:e})}function mS(r,e,t){return Ot(He.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function vS(r,e){return Ot(He.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function yS(r,e){return Ot(He.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function _S(r,e,t){return Ot(He.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function bS(r,e,t){return Ot(He.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function xS(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return Ot(t,e)}var mi={canvasOpened:dS,canvasClosed:pS,tileViewed:hS,tileExpanded:fS,tileCollapsed:gS,tileAction:mS,overlayStarted:vS,overlayCompleted:yS,overlayDismissed:_S,overlayStepViewed:bS,custom:xS};function wS(r,e){let t=[];for(let n of r){let i=n.widget.split(":")[0],o=e.get(i)?.manifest.runtime?.notifyWatchers;o&&t.push(...o(n.props??{}))}return t}var ja=class extends he{constructor(){super();this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={};this.launcherAnimate=!1;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new gi(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher()}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher()),t.has("isOpen")&&this.isOpen&&this._trackTilesViewed()}_syncNotificationsController(){this._notifications.setEventBus(this.runtimeRef?.events??null),this._notifications.setTiles(this.tiles)}_startNotifyWatcher(){let t=this.runtimeRef;if(!t?.events||!t.apps)return;let n=wS(this.tiles,t.apps);if(n.length===0)return;let i=t.state.ns("notified");for(let o of n)if(!this._notifyPrevState.has(o.id)){let a=t.evaluateSync(o.strategy);this._notifyPrevState.set(o.id,a.value),a.value&&!i.has(o.id)&&(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps))}let s=()=>{for(let o of n){let a=t.evaluateSync(o.strategy),l=this._notifyPrevState.get(o.id)??!1;this._notifyPrevState.set(o.id,a.value),!l&&a.value?(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps)):l&&!a.value&&i.remove(o.id)}};this._notifyUnsub=t.events.subscribe(s),this._notifyUnsubMetrics=t.sessionMetrics?.subscribe(s)??null}_stopNotifyWatcher(){this._notifyUnsub&&(this._notifyUnsub(),this._notifyUnsub=null),this._notifyUnsubMetrics&&(this._notifyUnsubMetrics(),this._notifyUnsubMetrics=null),this._notifyPrevState.clear()}_restartNotifyWatcher(){this._stopNotifyWatcher(),this._startNotifyWatcher()}_trackTilesViewed(){for(let t of this.tiles)if(this.telemetry?.trackRectangleViewed(t.id,"overlay"),this.runtimeRef){let n=mi.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}}_toggle(){let t=!this.isOpen;if(t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let n=t?mi.canvasOpened("overlay"):mi.canvasClosed("overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}this.dispatchEvent(new CustomEvent("canvas-toggle",{bubbles:!0,composed:!0,detail:{isOpen:t}}))}_handleNotificationClick(t){let n=t.detail?.notification;n&&(this.runtimeRef&&this.runtimeRef.events.publish(He.NOTIFICATION_CLICKED,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&n.tileId&&this.runtimeRef.events.publish(He.NOTIFICATION_DEEP_LINK,{tileId:n.tileId,itemId:n.itemId}),this._notifications.dismiss(n.id))}_handleNotificationDismiss(t){let n=t.detail?.id;n&&this._notifications.dismiss(n)}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,n=this.themeConfig?.canvas?.position==="left"?"left":"right";return j`
356
+ `};Na.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var Km="syntro-nav-tips";function Xm(){typeof window>"u"||customElements.get(Km)||customElements.define(Km,Na)}var Jk=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);return t?(t.scrollIntoView({behavior:r.behavior??"smooth",block:r.block??"center",inline:r.inline??"nearest"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:scrollTo",anchorId:r.anchorId,behavior:r.behavior??"smooth"}),{cleanup:()=>{}}):(console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${r.anchorId.selector}`),{cleanup:()=>{}})};function Bu(r){if(typeof window>"u")return!1;let e=window;try{let t=e.next?.router;if(t?.push)return t.push(r),!0}catch{}try{if(e.$nuxt?.$router?.push)return e.$nuxt.$router.push(r),!0}catch{}return e.ng||e.getAllAngularRootElements||document.querySelector("[ng-version]")||e.__SVELTEKIT_DATA__||document.body?.hasAttribute("data-sveltekit")||document.querySelector("[data-astro-transition-fallback]")?(window.location.href=r,!0):!1}function Qk(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var eS=async(r,e)=>{let t=r.url.trim();if(t.toLowerCase().startsWith("javascript:"))throw new Error("javascript: URLs are not allowed");let n=r.target??"_self";return e.publishEvent("action.applied",{id:e.generateId(),kind:"navigation:navigate",url:r.url,target:n}),n==="_blank"?window.open(t,"_blank","noopener,noreferrer"):!r.forceFullNavigation&&Qk(t)?Bu(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},tS={mount(r,e){Xm();let t=document.createElement("syntro-nav-tips"),{runtime:n,instanceId:i="nav-widget",...s}=e??{expandBehavior:"single",theme:"auto",actions:[]};return Object.assign(t,{config:s,runtime:n,instanceId:i}),r.appendChild(t),()=>t.remove()}},rS=[{kind:"navigation:scrollTo",executor:Jk},{kind:"navigation:navigate",executor:eS}],Jm={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:rS,widgets:[{id:"adaptive-nav:tips",component:tS,metadata:{name:"Navigation Tips",description:"Accordion of contextual navigation tips with per-item visibility",icon:"\u{1F9ED}"}}],notifyWatchers(r){return(r.actions??[]).filter(t=>t.notify&&t.triggerWhen).map(t=>({id:`nav:${t.config.id}`,strategy:t.triggerWhen,eventName:"nav:tip_revealed",eventProps:{tipId:t.config.id,title:t.notify.title,body:t.notify.body,icon:t.notify.icon}}))}};var nS=[qc,Sm,Jm,gu],iS=nS.map(r=>({id:r.id,version:r.version,name:r.name,description:r.description,runtime:{actions:(r.executors||[]).map(({kind:e,executor:t})=>({kind:e,executor:t})),widgets:r.widgets,notifyWatchers:r.notifyWatchers,events:r.eventHandlers},editor:void 0,metadata:{isBuiltIn:!0}}));function Qm(r){let e=0;for(let t of iS)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var xn=class extends Event{constructor(e,t,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=i??!1}};var La=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:n}]of this.subscriptions)t(this.o,n)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Vu=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},pi=class extends La{constructor(e,t,n){super(t.context!==void 0?t.initialValue:n),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)s.has(o)||(s.add(o),a.dispatchEvent(new xn(this.context,a,o,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Vu(this.context,this.host))}};var Te="1.0.0",Se={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",UI_HESITATE:"ui.hesitate",UI_RAGE_CLICK:"ui.rage_click",UI_SCROLL_THRASH:"ui.scroll_thrash",UI_FOCUS_BOUNCE:"ui.focus_bounce",UI_IDLE:"ui.idle",UI_HOVER:"ui.hover"},Je={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},$s={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},ju={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var Fa=class{constructor(e,t){this.config=e,this.emit=t,this.focused=new Map}ingest(e){if(e.type!==3)return;let t=e.timestamp;if(e.data.source===Je.MouseInteraction){let n=e.data.id??0;if(e.data.type===$s.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===$s.Blur){let i=this.focused.get(n);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Se.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Te,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===Je.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var Da=class{constructor(e,t){this.config=e,this.emit=t,this.anchorX=0,this.anchorY=0,this.anchorTs=0,this.emitted=!1,this.hasPosition=!1}ingest(e){if(e.type!==3||e.data.source!==Je.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let n=t[t.length-1],i=e.timestamp+(n.timeOffset??0);if(!this.hasPosition){this.anchorX=n.x,this.anchorY=n.y,this.anchorTs=i,this.hasPosition=!0,this.emitted=!1;return}let s=n.x-this.anchorX,o=n.y-this.anchorY;Math.sqrt(s*s+o*o)>this.config.hesitationRadiusPx&&(this.anchorX=n.x,this.anchorY=n.y,this.anchorTs=i,this.emitted=!1)}tick(e){if(!this.hasPosition||this.emitted)return;let t=e-this.anchorTs;t>=this.config.hesitationMs&&(this.emit({ts:e,name:Se.UI_HESITATE,source:"rrweb",schemaVersion:Te,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var Ha=class{constructor(e,t,n){this.config=e,this.emit=t,this.elementResolver=n,this.currentElement=null,this.hoverStartTs=null,this.lastX=0,this.lastY=0,this.lastSampleTs=-1/0}ingest(e){if(e.type!==3||e.data.source!==Je.MouseMove)return;let t=e.data.positions;if(!t||t.length===0)return;let n=t[t.length-1];this.lastX=n.x,this.lastY=n.y}tick(e){if(!this.elementResolver||e-this.lastSampleTs<this.config.hoverSampleMs)return;this.lastSampleTs=e;let t=this.elementResolver(this.lastX,this.lastY),n=t?ev(t):null,i=this.currentElement?ev(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Se.UI_HOVER,source:"rrweb",schemaVersion:Te,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function ev(r){return`${r.tag_name??""}|${r.attr__id??""}|${(r.classes??[]).join(",")}`}var Ba=class{constructor(e,t){this.config=e,this.emit=t,this.lastActivityTs=null,this.emitted=!1}ingest(e){if(e.type!==3)return;let t=e.data.source;(t===Je.MouseMove||t===Je.MouseInteraction||t===Je.Scroll)&&(this.lastActivityTs=e.timestamp,this.emitted=!1)}tick(e){this.lastActivityTs===null||this.emitted||e-this.lastActivityTs>=this.config.idleMs&&(this.emit({ts:e,name:Se.UI_IDLE,source:"rrweb",schemaVersion:Te,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Va=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==Je.MouseInteraction||e.data.type!==$s.Click)return;let t=e.data.x??0,n=e.data.y??0,i=e.timestamp,s=i-this.config.rageClickWindowMs;this.clicks=this.clicks.filter(a=>a.ts>=s),this.clicks.push({ts:i,x:t,y:n});let o=this.clicks.filter(a=>{let l=a.x-t,c=a.y-n;return Math.sqrt(l*l+c*c)<=this.config.rageClickRadiusPx});o.length>=this.config.rageClickCount&&(this.emit({ts:i,name:Se.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Te,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var ja=class{constructor(e,t){this.config=e,this.emit=t,this.lastY=null,this.lastDirection=null,this.reversals=[]}ingest(e){if(e.type!==3||e.data.source!==Je.Scroll)return;let t=e.data.y??0,n=e.timestamp;if(this.lastY!==null){let i=t>this.lastY?"down":t<this.lastY?"up":this.lastDirection;if(i&&i!==this.lastDirection){let s=n-this.config.scrollThrashWindowMs;this.reversals=this.reversals.filter(o=>o>s),this.reversals.push(n),this.reversals.length>=this.config.scrollThrashReversals&&(this.emit({ts:n,name:Se.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:Te,props:{reversals:this.reversals.length,duration_ms:n-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var tv={$click:Se.UI_CLICK,$scroll:Se.UI_SCROLL,$input:Se.UI_INPUT,$change:Se.UI_CHANGE,$submit:Se.UI_SUBMIT,$pageview:Se.NAV_PAGE_VIEW,$pageleave:Se.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function aS(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(tv[e])return tv[e];if(e==="$autocapture"){let t=r.properties?.$tag_name,n=r.properties?.$event_type;return n==="submit"?Se.UI_SUBMIT:n==="change"?Se.UI_CHANGE:t==="input"||t==="textarea"?Se.UI_INPUT:Se.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var rv=new Set(["a","button","input","select","textarea"]);function lS(r){if(r)return r.split(";").map(e=>{let t={},n=e.indexOf(":"),i=n>=0?e.slice(0,n):e,s=n>=0?e.slice(n+1):"",o=i.indexOf(".");if(o>=0?(t.tag_name=i.slice(0,o),t.attr__class=i.slice(o+1).replace(/\./g," ")):t.tag_name=i,!/^[a-zA-Z][a-zA-Z0-9-]*$/.test(String(t.tag_name??"")))return null;let a=/([\w$-]+)="([^"]*)"/g,l;for(;(l=a.exec(s))!==null;){let[,c,u]=l;c==="nth-child"||c==="nth-of-type"||(t[c]=u)}return t.text&&(t.$el_text=t.text,delete t.text),t}).filter(e=>e!==null)}function cS(r,e){if(e&&rv.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&rv.has(n))return n}return e}function uS(r,e){return r.map((t,n)=>{let i=e[n];return!i||t.tag_name!==i.tag_name?t:{...i,...t}})}function dS(r,e){let t={},n=r.properties||{},i=n.$elements??(typeof n.$elements_chain=="string"?lS(n.$elements_chain):void 0),s=i&&e?uS(i,e):i,o=n.$tag_name??s?.[0]?.tag_name,a=r.event==="$autocapture"||r.event==="$click";return t.tagName=a?cS(s,o):o,n.$el_text&&(t.elementText=n.$el_text),s&&(t.elements=s),a&&!s&&console.warn(`[PostHogNormalizer] $autocapture click has no element chain. PostHog may have changed wire format. Properties: $elements=${!!n.$elements}, $elements_chain=${typeof n.$elements_chain}`),n.$current_url&&(t.url=n.$current_url),n.$pathname&&(t.pathname=n.$pathname),n.$host&&(t.host=n.$host),n.$viewport_width&&(t.viewportWidth=n.$viewport_width),n.$viewport_height&&(t.viewportHeight=n.$viewport_height),n.$session_id&&(t.sessionId=n.$session_id),n.$scroll_depth&&(t.scrollDepth=n.$scroll_depth),n.$scroll_percentage&&(t.scrollPercentage=n.$scroll_percentage),t.originalEvent=r.event,t}function hi(r,e){let t;return typeof r.timestamp=="number"?t=r.timestamp:typeof r.timestamp=="string"?t=new Date(r.timestamp).getTime():t=Date.now(),{ts:t,name:aS(r),source:"posthog",props:dS(r,e),schemaVersion:Te}}function fi(r){let e=r.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function Wu(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if(fi(n)){let i=hi(n);r(i)}}}function Uu(r){let e={...ju,...r?.config},t=[];function n(v){for(let g of t)g(v)}let i=new Da(e,n),s=new Va(e,n),o=new ja(e,n),a=new Fa(e,n),l=new Ba(e,n),c=new Ha(e,n,r?.elementResolver),u=[],p=500;function h(v){if(v.event==="$click")return!0;if(v.event!=="$autocapture")return!1;let g=v.properties?.$event_type;return g===void 0||g==="click"}function f(v){let g=v-p;for(;u.length>0&&u[0].ts<g;)u.shift();return u.shift()?.elements}return{ingest(v){if(v.kind==="posthog"){let{kind:g,...m}=v;if(fi(m)){let y=h(m)?f(typeof m.timestamp=="number"?m.timestamp:Date.now()):void 0;n(hi(m,y))}}else v.kind==="rrweb"&&(i.ingest(v),s.ingest(v),o.ingest(v),a.ingest(v),l.ingest(v),c.ingest(v))},onEvent(v){t.push(v)},tick(v){i.tick(v),l.tick(v),c.tick(v)},enrichClickAttributes(v,g){u.push({ts:v,elements:g});let m=v-p;for(;u.length>0&&u[0].ts<m;)u.shift()}}}var Be={UI_CLICK:"ui.click",UI_SCROLL:"ui.scroll",UI_INPUT:"ui.input",UI_CHANGE:"ui.change",UI_SUBMIT:"ui.submit",NAV_PAGE_VIEW:"nav.page_view",NAV_PAGE_LEAVE:"nav.page_leave",CANVAS_OPENED:"canvas.opened",CANVAS_CLOSED:"canvas.closed",TILE_VIEWED:"tile.viewed",TILE_EXPANDED:"tile.expanded",TILE_COLLAPSED:"tile.collapsed",TILE_ACTION:"tile.action",OVERLAY_STARTED:"overlay.started",OVERLAY_COMPLETED:"overlay.completed",OVERLAY_DISMISSED:"overlay.dismissed",OVERLAY_STEP_VIEWED:"overlay.step_viewed",BEHAVIOR_RAGE_CLICK:"behavior.rage_click",BEHAVIOR_HESITATION:"behavior.hesitation",BEHAVIOR_CONFUSION:"behavior.confusion",ACTION_APPLIED:"action.applied",ACTION_REVERTED:"action.reverted",ACTION_FAILED:"action.failed",ACTION_CTA_CLICKED:"action.cta_clicked",NOTIFICATION_SHOWN:"notification.shown",NOTIFICATION_CLICKED:"notification.clicked",NOTIFICATION_DISMISSED:"notification.dismissed",NOTIFICATION_DEEP_LINK:"notification.deep_link",SURFACE_MOUNTED:"surface.mounted",SURFACE_UNMOUNTED:"surface.unmounted"};var Wa=3;var Ua=3e4;var hS=0;function zu(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function fS(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function nv(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!fS(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++hS}-${s}`,title:zu(i.title,r.props),body:i.body?zu(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?zu(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var gi=class{constructor(e,t,n){this._notifications=[];this._cooldownMap=new Map;this._timerIds=new Map;this._unsubscribe=null;this.host=e,this.eventBus=t,this.tiles=n,e.addController(this)}get notifications(){return this._notifications}setTiles(e){this.tiles=e}setEventBus(e){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null),this.eventBus=e,this.eventBus&&this.hostConnected()}hostConnected(){this.eventBus&&(this._unsubscribe=this.eventBus.subscribe(e=>{let t=nv(e,this.tiles);if(!t)return;let{notification:n,rule:i}=t,s=n.itemId?`${n.tileId}:${e.name}:${n.itemId}`:`${n.tileId}:${e.name}`,o=this._cooldownMap.get(s),a=Date.now(),l=i.cooldown??3e4;if(o!==void 0&&a-o<l||(this._cooldownMap.set(s,a),n.itemId&&this._notifications.some(p=>p.tileId===n.tileId&&p.itemId===n.itemId)))return;let c=[...this._notifications,n];if(c.length>3){let u=c.shift(),p=this._timerIds.get(u.id);p&&(clearTimeout(p),this._timerIds.delete(u.id))}this._notifications=c,this.host.requestUpdate(),this.eventBus.publish(Be.NOTIFICATION_SHOWN,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId,title:n.title}),this._scheduleDismiss(n)}))}hostDisconnected(){this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null);for(let e of this._timerIds.values())clearTimeout(e);this._timerIds.clear()}dismiss(e){let t=this._notifications.find(i=>i.id===e);t&&this._publishDismissed(t),this._notifications=this._notifications.filter(i=>i.id!==e);let n=this._timerIds.get(e);n&&(clearTimeout(n),this._timerIds.delete(e)),this.host.requestUpdate()}_publishDismissed(e){this.eventBus?.publish(Be.NOTIFICATION_DISMISSED,{notificationId:e.id,tileId:e.tileId,itemId:e.itemId})}_scheduleDismiss(e){let t=setTimeout(()=>{this._notifications=this._notifications.filter(n=>n.id!==e.id),this._timerIds.delete(e.id),this._publishDismissed(e),this.host.requestUpdate()},e.ttl);this._timerIds.set(e.id,t)}};function Ot(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:Te}}function gS(r){return Ot(Be.CANVAS_OPENED,{surface:r})}function mS(r){return Ot(Be.CANVAS_CLOSED,{surface:r})}function vS(r,e){return Ot(Be.TILE_VIEWED,{tileId:r,surface:e})}function yS(r,e){return Ot(Be.TILE_EXPANDED,{tileId:r,surface:e})}function _S(r,e){return Ot(Be.TILE_COLLAPSED,{tileId:r,surface:e})}function bS(r,e,t){return Ot(Be.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function xS(r,e){return Ot(Be.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function wS(r,e){return Ot(Be.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function kS(r,e,t){return Ot(Be.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function SS(r,e,t){return Ot(Be.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function ES(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return Ot(t,e)}var mi={canvasOpened:gS,canvasClosed:mS,tileViewed:vS,tileExpanded:yS,tileCollapsed:_S,tileAction:bS,overlayStarted:xS,overlayCompleted:wS,overlayDismissed:kS,overlayStepViewed:SS,custom:ES};function CS(r,e){let t=[];for(let n of r){let i=n.widget.split(":")[0],o=e.get(i)?.manifest.runtime?.notifyWatchers;o&&t.push(...o(n.props??{}))}return t}var za=class extends fe{constructor(){super();this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={};this.launcherAnimate=!1;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new gi(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher()}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher()),t.has("isOpen")&&this.isOpen&&this._trackTilesViewed()}_syncNotificationsController(){this._notifications.setEventBus(this.runtimeRef?.events??null),this._notifications.setTiles(this.tiles)}_startNotifyWatcher(){let t=this.runtimeRef;if(!t?.events||!t.apps)return;let n=CS(this.tiles,t.apps);if(n.length===0)return;let i=t.state.ns("notified");for(let o of n)if(!this._notifyPrevState.has(o.id)){let a=t.evaluateSync(o.strategy);this._notifyPrevState.set(o.id,a.value),a.value&&!i.has(o.id)&&(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps))}let s=()=>{for(let o of n){let a=t.evaluateSync(o.strategy),l=this._notifyPrevState.get(o.id)??!1;this._notifyPrevState.set(o.id,a.value),!l&&a.value?(i.set(o.id,!0),t.events.publish(o.eventName,o.eventProps)):l&&!a.value&&i.remove(o.id)}};this._notifyUnsub=t.events.subscribe(s),this._notifyUnsubMetrics=t.sessionMetrics?.subscribe(s)??null}_stopNotifyWatcher(){this._notifyUnsub&&(this._notifyUnsub(),this._notifyUnsub=null),this._notifyUnsubMetrics&&(this._notifyUnsubMetrics(),this._notifyUnsubMetrics=null),this._notifyPrevState.clear()}_restartNotifyWatcher(){this._stopNotifyWatcher(),this._startNotifyWatcher()}_trackTilesViewed(){for(let t of this.tiles)if(this.telemetry?.trackRectangleViewed(t.id,"overlay"),this.runtimeRef){let n=mi.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}}_toggle(){let t=!this.isOpen;if(t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let n=t?mi.canvasOpened("overlay"):mi.canvasClosed("overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}this.dispatchEvent(new CustomEvent("canvas-toggle",{bubbles:!0,composed:!0,detail:{isOpen:t}}))}_handleNotificationClick(t){let n=t.detail?.notification;n&&(this.runtimeRef&&this.runtimeRef.events.publish(Be.NOTIFICATION_CLICKED,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&n.tileId&&this.runtimeRef.events.publish(Be.NOTIFICATION_DEEP_LINK,{tileId:n.tileId,itemId:n.itemId}),this._notifications.dismiss(n.id))}_handleNotificationDismiss(t){let n=t.detail?.id;n&&this._notifications.dismiss(n)}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,n=this.themeConfig?.canvas?.position==="left"?"left":"right";return j`
357
357
  <div data-shadow-canvas-id="overlay-launcher" style="position:fixed;inset:0;pointer-events:none;z-index:2147483647">
358
358
  ${t.length>0?j`<syntro-toast-stack
359
359
  data-testid="notification-toast-stack"
@@ -383,7 +383,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
383
383
  .themeConfig=${this.themeConfig}
384
384
  @drawer-close=${this._onDrawerClose}
385
385
  ></syntro-drawer>
386
- `}};ja.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},launcherAnimate:{type:Boolean}};customElements.define("syntro-canvas-overlay",ja);function kS(r,e,t="currentColor"){let n=nn(r,{size:e,color:t});if(!n)return j`<span style=${I({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,j`${i}`}var SS=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],Wa=class extends he{constructor(){super(...arguments);this.config=null;this.surface="overlay";this.runtimeRef=null;this._hovered=!1;this._widgetHandle=null;this._widgetContainer=null;this._mountedWidgetId=null;this._registryUnsub=null;this._eventBusUnsub=null;this._intersectionObserver=null;this._prevPropsJson=null;this._onMouseEnter=()=>{this._hovered=!0};this._onMouseLeave=()=>{this._hovered=!1}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._setupEventBusSubscription(),this._setupRegistrySubscription(),this.updateComplete.then(()=>{this._mountWidgetIfReady(),this._setupIntersectionObserver()})}updated(t){(t.has("runtimeRef")||t.has("config"))&&(t.has("runtimeRef")&&(this._teardownSubscriptions(),this._setupEventBusSubscription(),this._setupRegistrySubscription()),(this.config?.widget??null)!==this._mountedWidgetId?(this._unmountWidget(),this._mountWidgetIfReady()):this._forwardPropUpdates())}disconnectedCallback(){super.disconnectedCallback(),this._unmountWidget(),this._teardownSubscriptions(),this._intersectionObserver?.disconnect(),this._intersectionObserver=null}_mountWidgetIfReady(){if(this._mountedWidgetId)return;let t=this.runtimeRef?.widgets,n=this.config?.widget;if(!t||!n||!t.has(n))return;let i=this.querySelector("[data-widget-mount-parent]");if(!i)return;let s=document.createElement("div");s.style.width="100%",s.style.minHeight="40px",i.appendChild(s);let o={...this.config?.props,instanceId:this.config?.id},a=t.mount(n,s,o);this._widgetContainer=s,this._widgetHandle=a,this._mountedWidgetId=n,this._prevPropsJson=JSON.stringify(o)}_unmountWidget(){this._widgetHandle&&(this._widgetHandle.unmount(),this._widgetHandle=null),this._widgetContainer&&(this._widgetContainer.remove(),this._widgetContainer=null),this._mountedWidgetId=null,this._prevPropsJson=null}_forwardPropUpdates(){if(!this._widgetHandle||!this.config)return;let t={...this.config.props,instanceId:this.config.id},n=JSON.stringify(t);n!==this._prevPropsJson&&(this._prevPropsJson=n,this._widgetHandle.update(t))}_setupRegistrySubscription(){let t=this.runtimeRef?.widgets,n=this.config?.widget;!t||!n||t.has(n)&&this._mountedWidgetId===n||(this._registryUnsub=t.subscribe(i=>{i.type==="registered"&&i.widgetId===n&&(this.requestUpdate(),queueMicrotask(()=>{this._mountedWidgetId||this._mountWidgetIfReady()}))}))}_setupIntersectionObserver(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;if(!t||!this.config)return;let n=this.querySelector("article");n&&(this._intersectionObserver=new IntersectionObserver(([i])=>{i.isIntersecting&&(t.trackSeen(this.config.id,this.config.widget??"unknown"),this._intersectionObserver?.disconnect())},{threshold:.5}),this._intersectionObserver.observe(n))}_setupEventBusSubscription(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;!this.runtimeRef?.events||!t||!this.config||(this._eventBusUnsub=this.runtimeRef.events.subscribe(n=>{SS.some(i=>n.name?.includes(i))&&n.props?.instanceId===this.config.id&&t.trackInteracted(this.config.id,this.config.widget??"unknown",n.name)}))}_teardownSubscriptions(){this._registryUnsub?.(),this._registryUnsub=null,this._eventBusUnsub?.(),this._eventBusUnsub=null}get _registration(){let t=this.config?.widget;if(!(!t||!this.runtimeRef?.widgets))return this.runtimeRef.widgets.getRegistration?.(t)}get _resolvedIcon(){return this.config?.icon?this.config.icon:this._registration?.metadata?.icon??"+"}get _resolvedSubtitle(){return this.config?.subtitle?this.config.subtitle:this._registration?.metadata?.subtitle}render(){if(!this.config)return J;let{title:t,widget:n}=this.config,i=this._resolvedSubtitle,s=this._resolvedIcon,o=i?36:24,l=this.runtimeRef?.widgets?.has(n)??!1,c={display:"flex",flexDirection:"column",borderRadius:"var(--sc-tile-border-radius)",background:this._hovered?"var(--sc-tile-background-hover)":"var(--sc-tile-background)",backdropFilter:"blur(16px) saturate(1.2)",WebkitBackdropFilter:"blur(16px) saturate(1.2)",border:"var(--sc-tile-border)",boxShadow:"var(--sc-tile-shadow)",color:"var(--sc-tile-title-color)",fontFamily:"var(--sc-font-family)",overflow:"hidden",cursor:"default",transition:"all 0.25s ease",transform:this._hovered?"scale(1.01)":"scale(1)"},u={display:"flex",alignItems:"center",gap:"var(--sc-tile-gap, 0.25rem)",padding:"var(--sc-tile-header-padding, 0.375rem 0.75rem)",minHeight:"44px"},p={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},h={fontSize:"1.14rem",fontWeight:"600",color:"var(--sc-tile-title-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},f={fontSize:"0.8rem",fontWeight:"400",color:"var(--sc-tile-text-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},v={padding:"var(--sc-tile-body-padding, 0 0.75rem 0.5rem)",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},m={paddingTop:"var(--sc-tile-gap, 0.25rem)"},g={padding:"0.75rem",fontSize:"0.8rem",color:"var(--sc-tile-text-color)",fontStyle:"italic"};return j`
386
+ `}};za.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},launcherAnimate:{type:Boolean}};customElements.define("syntro-canvas-overlay",za);function AS(r,e,t="currentColor"){let n=nn(r,{size:e,color:t});if(!n)return j`<span style=${I({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,j`${i}`}var RS=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],qa=class extends fe{constructor(){super(...arguments);this.config=null;this.surface="overlay";this.runtimeRef=null;this._hovered=!1;this._widgetHandle=null;this._widgetContainer=null;this._mountedWidgetId=null;this._registryUnsub=null;this._eventBusUnsub=null;this._intersectionObserver=null;this._prevPropsJson=null;this._onMouseEnter=()=>{this._hovered=!0};this._onMouseLeave=()=>{this._hovered=!1}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._setupEventBusSubscription(),this._setupRegistrySubscription(),this.updateComplete.then(()=>{this._mountWidgetIfReady(),this._setupIntersectionObserver()})}updated(t){(t.has("runtimeRef")||t.has("config"))&&(t.has("runtimeRef")&&(this._teardownSubscriptions(),this._setupEventBusSubscription(),this._setupRegistrySubscription()),(this.config?.widget??null)!==this._mountedWidgetId?(this._unmountWidget(),this._mountWidgetIfReady()):this._forwardPropUpdates())}disconnectedCallback(){super.disconnectedCallback(),this._unmountWidget(),this._teardownSubscriptions(),this._intersectionObserver?.disconnect(),this._intersectionObserver=null}_mountWidgetIfReady(){if(this._mountedWidgetId)return;let t=this.runtimeRef?.widgets,n=this.config?.widget;if(!t||!n||!t.has(n))return;let i=this.querySelector("[data-widget-mount-parent]");if(!i)return;let s=document.createElement("div");s.style.width="100%",s.style.minHeight="40px",i.appendChild(s);let o={...this.config?.props,instanceId:this.config?.id},a=t.mount(n,s,o);this._widgetContainer=s,this._widgetHandle=a,this._mountedWidgetId=n,this._prevPropsJson=JSON.stringify(o)}_unmountWidget(){this._widgetHandle&&(this._widgetHandle.unmount(),this._widgetHandle=null),this._widgetContainer&&(this._widgetContainer.remove(),this._widgetContainer=null),this._mountedWidgetId=null,this._prevPropsJson=null}_forwardPropUpdates(){if(!this._widgetHandle||!this.config)return;let t={...this.config.props,instanceId:this.config.id},n=JSON.stringify(t);n!==this._prevPropsJson&&(this._prevPropsJson=n,this._widgetHandle.update(t))}_setupRegistrySubscription(){let t=this.runtimeRef?.widgets,n=this.config?.widget;!t||!n||t.has(n)&&this._mountedWidgetId===n||(this._registryUnsub=t.subscribe(i=>{i.type==="registered"&&i.widgetId===n&&(this.requestUpdate(),queueMicrotask(()=>{this._mountedWidgetId||this._mountWidgetIfReady()}))}))}_setupIntersectionObserver(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;if(!t||!this.config)return;let n=this.querySelector("article");n&&(this._intersectionObserver=new IntersectionObserver(([i])=>{i.isIntersecting&&(t.trackSeen(this.config.id,this.config.widget??"unknown"),this._intersectionObserver?.disconnect())},{threshold:.5}),this._intersectionObserver.observe(n))}_setupEventBusSubscription(){let t=typeof window<"u"?window.SynOS?.interventionTracker:null;!this.runtimeRef?.events||!t||!this.config||(this._eventBusUnsub=this.runtimeRef.events.subscribe(n=>{RS.some(i=>n.name?.includes(i))&&n.props?.instanceId===this.config.id&&t.trackInteracted(this.config.id,this.config.widget??"unknown",n.name)}))}_teardownSubscriptions(){this._registryUnsub?.(),this._registryUnsub=null,this._eventBusUnsub?.(),this._eventBusUnsub=null}get _registration(){let t=this.config?.widget;if(!(!t||!this.runtimeRef?.widgets))return this.runtimeRef.widgets.getRegistration?.(t)}get _resolvedIcon(){return this.config?.icon?this.config.icon:this._registration?.metadata?.icon??"+"}get _resolvedSubtitle(){return this.config?.subtitle?this.config.subtitle:this._registration?.metadata?.subtitle}render(){if(!this.config)return J;let{title:t,widget:n}=this.config,i=this._resolvedSubtitle,s=this._resolvedIcon,o=i?36:24,l=this.runtimeRef?.widgets?.has(n)??!1,c={display:"flex",flexDirection:"column",borderRadius:"var(--sc-tile-border-radius)",background:this._hovered?"var(--sc-tile-background-hover)":"var(--sc-tile-background)",backdropFilter:"blur(16px) saturate(1.2)",WebkitBackdropFilter:"blur(16px) saturate(1.2)",border:"var(--sc-tile-border)",boxShadow:"var(--sc-tile-shadow)",color:"var(--sc-tile-title-color)",fontFamily:"var(--sc-font-family)",overflow:"hidden",cursor:"default",transition:"all 0.25s ease",transform:this._hovered?"scale(1.01)":"scale(1)"},u={display:"flex",alignItems:"center",gap:"var(--sc-tile-gap, 0.25rem)",padding:"var(--sc-tile-header-padding, 0.375rem 0.75rem)",minHeight:"44px"},p={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},h={fontSize:"1.14rem",fontWeight:"600",color:"var(--sc-tile-title-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},f={fontSize:"0.8rem",fontWeight:"400",color:"var(--sc-tile-text-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},v={padding:"var(--sc-tile-body-padding, 0 0.75rem 0.5rem)",borderTop:"1px solid rgba(255, 255, 255, 0.06)"},g={paddingTop:"var(--sc-tile-gap, 0.25rem)"},m={padding:"0.75rem",fontSize:"0.8rem",color:"var(--sc-tile-text-color)",fontStyle:"italic"};return j`
387
387
  <article
388
388
  data-shadow-canvas-id=${`tile-${this.config.id}`}
389
389
  style=${I(c)}
@@ -393,7 +393,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
393
393
  <!-- Header -->
394
394
  <div style=${I(u)}>
395
395
  <div style=${I(p)}>
396
- ${kS(s,o)}
396
+ ${AS(s,o)}
397
397
  </div>
398
398
  <div style=${I({flex:"1",minWidth:"0"})}>
399
399
  <h3 style=${I(h)}>
@@ -405,14 +405,14 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
405
405
 
406
406
  <!-- Widget Content -->
407
407
  <div style=${I(v)}>
408
- <div style=${I(m)}>
409
- ${l?j`<div data-widget-mount-parent></div>`:j`<div style=${I(g)}>
408
+ <div style=${I(g)}>
409
+ ${l?j`<div data-widget-mount-parent></div>`:j`<div style=${I(m)}>
410
410
  Widget not available: ${n}
411
411
  </div>`}
412
412
  </div>
413
413
  </div>
414
414
  </article>
415
- `}};Wa.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",Wa);var Ua=class extends he{constructor(){super(...arguments);this.tiles=[];this.runtimeRef=null;this.surface="overlay"}createRenderRoot(){return this}render(){return j`
415
+ `}};qa.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",qa);var Za=class extends fe{constructor(){super(...arguments);this.tiles=[];this.runtimeRef=null;this.surface="overlay"}createRenderRoot(){return this}render(){return j`
416
416
  <div data-syntro-tile-stack style=${I({display:"flex",flexDirection:"column",gap:"0.75rem",width:"100%"})}>
417
417
  ${this.tiles.map(n=>j`
418
418
  <syntro-tile-card
@@ -422,7 +422,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
422
422
  ></syntro-tile-card>
423
423
  `)}
424
424
  </div>
425
- `}};Ua.properties={tiles:{attribute:!1},runtimeRef:{attribute:!1},surface:{type:String}};customElements.define("syntro-tile-stack",Ua);var za=class extends he{constructor(){super(...arguments);this.tiles=[];this.isLoading=!1;this.error=void 0;this.runtimeRef=null}createRenderRoot(){return this}render(){return j`
425
+ `}};Za.properties={tiles:{attribute:!1},runtimeRef:{attribute:!1},surface:{type:String}};customElements.define("syntro-tile-stack",Za);var Ga=class extends fe{constructor(){super(...arguments);this.tiles=[];this.isLoading=!1;this.error=void 0;this.runtimeRef=null}createRenderRoot(){return this}render(){return j`
426
426
  <div data-syntro-inline-shell="container" style=${I({position:"relative",width:"100%",height:"100%",overflowY:"auto",color:"var(--sc-overlay-text-color)",background:"var(--sc-canvas-background)",padding:"var(--sc-canvas-padding, 0)",boxSizing:"border-box"})}>
427
427
  ${this.isLoading?j`<div data-syntro-inline-shell="loading">Loading...</div>`:this.error?j`<div
428
428
  data-syntro-inline-shell="error"
@@ -433,10 +433,10 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
433
433
  .runtimeRef=${this.runtimeRef}
434
434
  ></syntro-tile-stack>`:J}
435
435
  </div>
436
- `}};za.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",za);function qa(r,e,t="merge"){return t==="first-match"?ES(r,e):CS(r,e)}function ES(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 tv([i])}return null}function CS(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:tv(t)}function tv(r){let e=[],t=[],n,i,s,o,a,l,c,u;for(let p of r)p.tiles&&e.push(...p.tiles),p.actions&&t.push(...p.actions),n??(n=p.fetchedAt),i??(i=p.schemaVersion),s??(s=p.configVersion),o??(o=p.canvasTitle),a??(a=p.displayMode),l??(l=p.theme),c??(c=p.launcher),u??(u=p.meta);return{tiles:e,actions:t,fetchedAt:n??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{displayMode:a},...l&&{theme:l},...c&&{launcher:c},...u&&{meta:u}}}var Wu=!1;function rv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Uu(r){if(rv()){Wu=!0;return}Wu=r??!1}function AS(){return rv()?!0:Wu}function z(r,e,t){AS()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Je(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function Za(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var Ga="2.8.0-canary.152";var ir="2.0";var RS=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function TS(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):RS.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 IS(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var nv="syntro_config_cache",$S=1440*60*1e3;function iv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function MS(r,e){if(iv())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(nv,JSON.stringify(t))}catch{}}function OS(r){if(!iv())return null;try{let e=localStorage.getItem(nv);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>$S?null:t.config}catch{return null}}var Ka=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function PS(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 wn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return z("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=PS(e,s,o);if(u.length>0){let p=qa(e,u);if(p)return z("SmartCanvas Config","Resolved config from variant flags",p),p}}let l=Ka({configUri:r,experiments:e,featureKey:t});if(!l)return z("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!TS(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(IS(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":Ga,"X-SDK-Schema-Version":ir}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return z("SmartCanvas Config","Fetched config from URI",p),a&&MS(p,a),p}catch(u){if(a){let p=OS(a);if(p)return z("SmartCanvas Config","Serving config from offline cache"),p}throw u}};var Ya=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)}},zu=r=>new Ya(r);function re(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var q2={colorPrimary:te[3],colorPrimaryHover:te[4],colorPrimaryMuted:te[0],colorBackground:re(S[1],.95),colorBackgroundElevated:re(S[3],.95),colorBackgroundSubtle:re(S[0],.2),colorSurface:re(S[4],.8),colorSurfaceHover:re(S[5],.8),colorText:at.primary,colorTextSecondary:at.secondary,colorTextMuted:at.tertiary,colorTextInverse:S[1],colorBorder:Zc.primary,colorBorderSubtle:Zc.secondary,colorSuccess:_e[4],colorSuccessMuted:_e[0],colorWarning:je[4],colorWarningMuted:je[0],colorError:Re[4],colorErrorMuted:Re[0],colorInfo:ot[4],colorInfoMuted:ot[0],colorNotification:te[4],colorNotificationMuted:re(te[4],.4),glassBackground:re(S[1],.6),glassBackgroundHover:re(S[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"},Z2={colorPrimary:te[3],colorPrimaryHover:te[2],colorPrimaryMuted:re(te[5],.1),colorBackground:re(S[12],.95),colorBackgroundElevated:re(S[11],.95),colorBackgroundSubtle:re(S[0],.02),colorSurface:re(S[11],.6),colorSurfaceHover:re(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:re(S[0],.12),colorBorderSubtle:re(S[0],.06),colorSuccess:_e[4],colorSuccessMuted:re(_e[4],.12),colorWarning:je[4],colorWarningMuted:re(je[4],.12),colorError:Re[4],colorErrorMuted:re(Re[4],.12),colorInfo:ot[4],colorInfoMuted:re(ot[4],.12),colorNotification:te[3],colorNotificationMuted:re(te[3],.4),glassBackground:re(S[12],.7),glassBackgroundHover:re(S[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 NS(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var sv={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(S[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%",padding:"0"},launcher:{background:Do.primary.backgroundDefault,backgroundHover:Do.primary.backgroundHover,color:Do.primary.icon,size:"56px",shadow:`0 8px 32px ${re(S[0],.6)}`,borderRadius:"9999px"},tile:{background:re(S[1],.6),backgroundHover:re(S[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:at.primary,textColor:at.secondary,iconBackground:`linear-gradient(135deg, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[1],.6),textColor:at.primary,titleColor:at.primary,arrowColor:re(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[0],.95),textColor:at.primary,textSecondaryColor:at.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:_e[4],warningColor:je[4],errorColor:Re[4],iconBackground:re(te[3],.15),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[4]})`},content:{background:re(S[3],.8),backgroundHover:re(S[5],.6),border:`1px solid ${re(S[5],.5)}`,borderRadius:"8px",textColor:at.primary,textSecondaryColor:at.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:re(S[3],.8),searchColor:at.primary,chevronColor:"currentColor"}},ov={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(S[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%",padding:"0"},launcher:{background:te[3],backgroundHover:te[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:re(S[12],.7),backgroundHover:re(S[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:S[1],textColor:S[6],iconBackground:`linear-gradient(135deg, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:re(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${re(S[0],.12)}`,borderRadius:"12px",successColor:_e[4],warningColor:je[4],errorColor:Re[4],iconBackground:re(te[3],.1),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[2]})`},content:{background:re(S[12],.8),backgroundHover:re(S[11],.6),border:`1px solid ${S[11]}`,borderRadius:"8px",textColor:S[1],textSecondaryColor:S[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:S[12],searchColor:S[1],chevronColor:"currentColor"}};function av(r){let e=r.mode==="light"?ov:sv;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}}}function lv(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?ov:sv;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}}}var LS=["canvas","launcher","tile","overlay","notification","content"];function cv(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 LS){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&(e[`--sc-${t}-${NS(i)}`]=s)}return e}var Rr,kn,Sn,sr,or,qu,Xa,vi=class{constructor(e,t,n){ge(this,or);ge(this,Rr);ge(this,kn);ge(this,Sn);ge(this,sr);ne(this,Rr,e),ne(this,kn,t??{}),ne(this,Sn,n),ne(this,sr,ye(this,or,qu).call(this)),e.addController(this)}get config(){return U(this,sr).config}get mode(){return U(this,sr).mode}get cssVariables(){return U(this,sr).cssVariables}hostConnected(){ye(this,or,Xa).call(this)}hostDisconnected(){}hostUpdated(){ye(this,or,Xa).call(this)}setThemeConfig(e,t){ne(this,kn,e),ne(this,Sn,t),ne(this,sr,ye(this,or,qu).call(this)),ye(this,or,Xa).call(this),U(this,Rr).requestUpdate()}};Rr=new WeakMap,kn=new WeakMap,Sn=new WeakMap,sr=new WeakMap,or=new WeakSet,qu=function(){let e=U(this,Sn)?lv(U(this,Sn),U(this,kn)):av(U(this,kn)),t=cv(e);return{config:e,mode:e.mode,cssVariables:t}},Xa=function(){let e=U(this,Rr).shadowRoot??("renderRoot"in U(this,Rr)?U(this,Rr).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(U(this,sr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
436
+ `}};Ga.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",Ga);function Ka(r,e,t="merge"){return t==="first-match"?TS(r,e):IS(r,e)}function TS(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 iv([i])}return null}function IS(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:iv(t)}function iv(r){let e=[],t=[],n,i,s,o,a,l,c,u;for(let p of r)p.tiles&&e.push(...p.tiles),p.actions&&t.push(...p.actions),n??(n=p.fetchedAt),i??(i=p.schemaVersion),s??(s=p.configVersion),o??(o=p.canvasTitle),a??(a=p.displayMode),l??(l=p.theme),c??(c=p.launcher),u??(u=p.meta);return{tiles:e,actions:t,fetchedAt:n??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{displayMode:a},...l&&{theme:l},...c&&{launcher:c},...u&&{meta:u}}}var qu=!1;function sv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Zu(r){if(sv()){qu=!0;return}qu=r??!1}function $S(){return sv()?!0:qu}function z(r,e,t){$S()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Qe(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function Ya(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var Xa="2.8.0-canary.154";var ir="2.0";var MS=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function OS(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):MS.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 PS(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var ov="syntro_config_cache",NS=1440*60*1e3;function av(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function LS(r,e){if(av())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(ov,JSON.stringify(t))}catch{}}function FS(r){if(!av())return null;try{let e=localStorage.getItem(ov);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>NS?null:t.config}catch{return null}}var Ja=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function DS(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 wn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return z("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=DS(e,s,o);if(u.length>0){let p=Ka(e,u);if(p)return z("SmartCanvas Config","Resolved config from variant flags",p),p}}let l=Ja({configUri:r,experiments:e,featureKey:t});if(!l)return z("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!OS(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(PS(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":Xa,"X-SDK-Schema-Version":ir}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return z("SmartCanvas Config","Fetched config from URI",p),a&&LS(p,a),p}catch(u){if(a){let p=FS(a);if(p)return z("SmartCanvas Config","Serving config from offline cache"),p}throw u}};var Qa=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)}},Gu=r=>new Qa(r);function ie(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var Y2={colorPrimary:te[3],colorPrimaryHover:te[4],colorPrimaryMuted:te[0],colorBackground:ie(S[1],.95),colorBackgroundElevated:ie(S[3],.95),colorBackgroundSubtle:ie(S[0],.2),colorSurface:ie(S[4],.8),colorSurfaceHover:ie(S[5],.8),colorText:lt.primary,colorTextSecondary:lt.secondary,colorTextMuted:lt.tertiary,colorTextInverse:S[1],colorBorder:Yc.primary,colorBorderSubtle:Yc.secondary,colorSuccess:_e[4],colorSuccessMuted:_e[0],colorWarning:je[4],colorWarningMuted:je[0],colorError:Re[4],colorErrorMuted:Re[0],colorInfo:at[4],colorInfoMuted:at[0],colorNotification:te[4],colorNotificationMuted:ie(te[4],.4),glassBackground:ie(S[1],.6),glassBackgroundHover:ie(S[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"},X2={colorPrimary:te[3],colorPrimaryHover:te[2],colorPrimaryMuted:ie(te[5],.1),colorBackground:ie(S[12],.95),colorBackgroundElevated:ie(S[11],.95),colorBackgroundSubtle:ie(S[0],.02),colorSurface:ie(S[11],.6),colorSurfaceHover:ie(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:ie(S[0],.12),colorBorderSubtle:ie(S[0],.06),colorSuccess:_e[4],colorSuccessMuted:ie(_e[4],.12),colorWarning:je[4],colorWarningMuted:ie(je[4],.12),colorError:Re[4],colorErrorMuted:ie(Re[4],.12),colorInfo:at[4],colorInfoMuted:ie(at[4],.12),colorNotification:te[3],colorNotificationMuted:ie(te[3],.4),glassBackground:ie(S[12],.7),glassBackgroundHover:ie(S[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 HS(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var lv={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ie(S[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%",padding:"0"},launcher:{background:Vo.primary.backgroundDefault,backgroundHover:Vo.primary.backgroundHover,color:Vo.primary.icon,size:"56px",shadow:`0 8px 32px ${ie(S[0],.6)}`,borderRadius:"9999px"},tile:{background:ie(S[1],.6),backgroundHover:ie(S[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:lt.primary,textColor:lt.secondary,iconBackground:`linear-gradient(135deg, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ie(S[1],.6),textColor:lt.primary,titleColor:lt.primary,arrowColor:ie(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:ie(S[0],.95),textColor:lt.primary,textSecondaryColor:lt.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:_e[4],warningColor:je[4],errorColor:Re[4],iconBackground:ie(te[3],.15),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[4]})`},content:{background:ie(S[3],.8),backgroundHover:ie(S[5],.6),border:`1px solid ${ie(S[5],.5)}`,borderRadius:"8px",textColor:lt.primary,textSecondaryColor:lt.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:ie(S[3],.8),searchColor:lt.primary,chevronColor:"currentColor"}},cv={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ie(S[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%",padding:"0"},launcher:{background:te[3],backgroundHover:te[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:ie(S[12],.7),backgroundHover:ie(S[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:S[1],textColor:S[6],iconBackground:`linear-gradient(135deg, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ie(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:ie(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:ie(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${ie(S[0],.12)}`,borderRadius:"12px",successColor:_e[4],warningColor:je[4],errorColor:Re[4],iconBackground:ie(te[3],.1),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[2]})`},content:{background:ie(S[12],.8),backgroundHover:ie(S[11],.6),border:`1px solid ${S[11]}`,borderRadius:"8px",textColor:S[1],textSecondaryColor:S[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:S[12],searchColor:S[1],chevronColor:"currentColor"}};function uv(r){let e=r.mode==="light"?cv:lv;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}}}function dv(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?cv:lv;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}}}var BS=["canvas","launcher","tile","overlay","notification","content"];function pv(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 BS){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&(e[`--sc-${t}-${HS(i)}`]=s)}return e}var Rr,kn,Sn,sr,or,Ku,el,vi=class{constructor(e,t,n){he(this,or);he(this,Rr);he(this,kn);he(this,Sn);he(this,sr);ne(this,Rr,e),ne(this,kn,t??{}),ne(this,Sn,n),ne(this,sr,ye(this,or,Ku).call(this)),e.addController(this)}get config(){return U(this,sr).config}get mode(){return U(this,sr).mode}get cssVariables(){return U(this,sr).cssVariables}hostConnected(){ye(this,or,el).call(this)}hostDisconnected(){}hostUpdated(){ye(this,or,el).call(this)}setThemeConfig(e,t){ne(this,kn,e),ne(this,Sn,t),ne(this,sr,ye(this,or,Ku).call(this)),ye(this,or,el).call(this),U(this,Rr).requestUpdate()}};Rr=new WeakMap,kn=new WeakMap,Sn=new WeakMap,sr=new WeakMap,or=new WeakSet,Ku=function(){let e=U(this,Sn)?dv(U(this,Sn),U(this,kn)):uv(U(this,kn)),t=pv(e);return{config:e,mode:e.mode,cssVariables:t}},el=function(){let e=U(this,Rr).shadowRoot??("renderRoot"in U(this,Rr)?U(this,Rr).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(U(this,sr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
437
437
  `);t.textContent=`:host {
438
438
  ${n}
439
- }`};var FS=new Set(["tag_name","$el_text"]);function DS(r){return FS.has(r)||r.startsWith("attr__")}function uv(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function HS(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(DS(i)){let o=n.props?.elements;if(!o||!o.some(l=>uv(s,l[i])))return!1}else if(!uv(s,n.props?.[i]))return!1}return!0}}function dv(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?HS(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function En(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"&&dv(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&dv(i.triggerWhen,e)}}var gv="syntro-runtime",pv="smart-canvas",hv=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function fv(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 it,yi,jt,ar,Pt,An,Ms,Os,Rn,Tn,In,Tr,Ir,$r,$n,_i,Ps,Se,mv,vv,bi,Zu,yv,Gu,Ku,Yu,_v,Xu,Ja,Cn=class extends he{constructor(){super();ge(this,Se);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:"/";ge(this,it);ge(this,yi,null);ge(this,jt,null);ge(this,ar,null);ge(this,Pt,null);ge(this,An);ge(this,Ms,0);ge(this,Os,null);ge(this,Rn,"[]");ge(this,Tn,null);ge(this,In,null);ge(this,Tr,null);ge(this,Ir,null);ge(this,$r,null);ge(this,$n,()=>{this._pageUrl=window.location.href});ge(this,_i);ge(this,Ps);ge(this,bi,0);ge(this,Ja,t=>{U(this,it).toggle()});ne(this,it,zu()),ne(this,An,!1),ne(this,_i,new vi(this)),ne(this,Ps,new pi(this,{context:gv,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),ne(this,yi,U(this,it).subscribe(t=>{this._isOpen=t.open})),this._isOpen=U(this,it).getState().open,ne(this,jt,document.createElement("div")),U(this,jt).id="overlayContainer",Object.assign(U(this,jt).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(U(this,jt)),ne(this,ar,document.createElement("div")),U(this,ar).id="portalRoot",this.shadowRoot.appendChild(U(this,ar)),ye(this,Se,Gu).call(this),ye(this,Se,Xu).call(this),ye(this,Se,Yu).call(this)}disconnectedCallback(){var t,n,i,s,o;super.disconnectedCallback(),(t=U(this,yi))==null||t.call(this),ne(this,yi,null),(n=U(this,In))==null||n.call(this),ne(this,In,null),(i=U(this,Tr))==null||i.call(this),ne(this,Tr,null),(s=U(this,Ir))==null||s.call(this),ne(this,Ir,null),(o=U(this,$r))==null||o.call(this),ne(this,$r,null),ye(this,Se,Ku).call(this),U(this,Pt)&&(U(this,Pt).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),ne(this,Pt,null)),U(this,jt)?.remove(),ne(this,jt,null),U(this,ar)?.remove(),ne(this,ar,null)}updated(t){var i;t.has("runtime")&&(U(this,Ps).setValue(this.runtime??null),ye(this,Se,_v).call(this),ye(this,Se,Yu).call(this),ye(this,Se,Xu).call(this),ye(this,Se,Ku).call(this),ye(this,Se,Gu).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&&(ye(this,Se,mv).call(this),(i=U(this,In))==null||i.call(this),this.experiments?.onFeaturesChanged&&ne(this,In,this.experiments.onFeaturesChanged(()=>this._loadConfig()))),(n||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&U(this,_i).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&ye(this,Se,yv).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&U(this,it).getState().open&&U(this,it).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(ne(this,Pt,this.initialBatchHandle),ne(this,An,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,ne(this,Rn,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error;return this._isLoading||t?this._displayMode==="inline"?j`
439
+ }`};var VS=new Set(["tag_name","$el_text"]);function jS(r){return VS.has(r)||r.startsWith("attr__")}function hv(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function WS(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(jS(i)){let o=n.props?.elements;if(!o||!o.some(l=>hv(s,l[i])))return!1}else if(!hv(s,n.props?.[i]))return!1}return!0}}function fv(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?WS(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function En(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"&&fv(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&fv(i.triggerWhen,e)}}var yv="syntro-runtime",gv="smart-canvas",mv=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function vv(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 st,yi,jt,ar,Pt,An,Ms,Os,Rn,Ps,Ns,Ls,Tn,In,Tr,Ir,$r,$n,_i,Fs,Ee,_v,bv,bi,Yu,xv,Xu,Ju,Qu,wv,ed,tl,Cn=class extends fe{constructor(){super();he(this,Ee);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:"/";he(this,st);he(this,yi,null);he(this,jt,null);he(this,ar,null);he(this,Pt,null);he(this,An);he(this,Ms,0);he(this,Os,null);he(this,Rn,"[]");he(this,Ps,"[]");he(this,Ns,"null");he(this,Ls,"null");he(this,Tn,null);he(this,In,null);he(this,Tr,null);he(this,Ir,null);he(this,$r,null);he(this,$n,()=>{this._pageUrl=window.location.href});he(this,_i);he(this,Fs);he(this,bi,0);he(this,tl,t=>{U(this,st).toggle()});ne(this,st,Gu()),ne(this,An,!1),ne(this,_i,new vi(this)),ne(this,Fs,new pi(this,{context:yv,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),ne(this,yi,U(this,st).subscribe(t=>{this._isOpen=t.open})),this._isOpen=U(this,st).getState().open,ne(this,jt,document.createElement("div")),U(this,jt).id="overlayContainer",Object.assign(U(this,jt).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(U(this,jt)),ne(this,ar,document.createElement("div")),U(this,ar).id="portalRoot",this.shadowRoot.appendChild(U(this,ar)),ye(this,Ee,Xu).call(this),ye(this,Ee,ed).call(this),ye(this,Ee,Qu).call(this)}disconnectedCallback(){var t,n,i,s,o;super.disconnectedCallback(),(t=U(this,yi))==null||t.call(this),ne(this,yi,null),(n=U(this,In))==null||n.call(this),ne(this,In,null),(i=U(this,Tr))==null||i.call(this),ne(this,Tr,null),(s=U(this,Ir))==null||s.call(this),ne(this,Ir,null),(o=U(this,$r))==null||o.call(this),ne(this,$r,null),ye(this,Ee,Ju).call(this),U(this,Pt)&&(U(this,Pt).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),ne(this,Pt,null)),U(this,jt)?.remove(),ne(this,jt,null),U(this,ar)?.remove(),ne(this,ar,null)}updated(t){var i;t.has("runtime")&&(U(this,Fs).setValue(this.runtime??null),ye(this,Ee,wv).call(this),ye(this,Ee,Qu).call(this),ye(this,Ee,ed).call(this),ye(this,Ee,Ju).call(this),ye(this,Ee,Xu).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&&(ye(this,Ee,_v).call(this),(i=U(this,In))==null||i.call(this),this.experiments?.onFeaturesChanged&&ne(this,In,this.experiments.onFeaturesChanged(()=>this._loadConfig({silent:!0})))),(n||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&U(this,_i).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&ye(this,Ee,xv).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&U(this,st).getState().open&&U(this,st).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(ne(this,Pt,this.initialBatchHandle),ne(this,An,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,ne(this,Rn,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error;return this._isLoading||t?this._displayMode==="inline"?j`
440
440
  <syntro-inline-shell
441
441
  .tiles=${this._tiles}
442
442
  ?isLoading=${this._isLoading}
@@ -455,9 +455,9 @@ ${n}
455
455
  .telemetry=${this.telemetry??null}
456
456
  .themeConfig=${U(this,_i).config}
457
457
  ?launcherAnimate=${!!this._launcher?.animate}
458
- @canvas-toggle=${U(this,Ja)}
458
+ @canvas-toggle=${U(this,tl)}
459
459
  ></syntro-canvas-overlay>
460
- `:J}open(){this._displayMode!=="inline"&&U(this,it).setOpen(!0)}close(){this._displayMode!=="inline"&&U(this,it).setOpen(!1)}toggle(){this._displayMode!=="inline"&&U(this,it).toggle()}setOverrideFetcher(t){this.fetcher=t}getMountNode(){return this.renderRoot}getController(){return U(this,it)}getPortalRoot(){return U(this,ar)}getOverlayContainer(){return U(this,jt)}getShadowRoot(){return this.shadowRoot}mountLitApp(t){t.fetcher!==void 0&&(this.fetcher=t.fetcher),t.configUri!==void 0&&(this.configUri=t.configUri),t.configUriFeatureKey!==void 0&&(this.configUriFeatureKey=t.configUriFeatureKey),t.configFeatureKey!==void 0&&(this.configFeatureKey=t.configFeatureKey),t.fetchCredentials!==void 0&&(this.fetchCredentials=t.fetchCredentials),t.experiments!==void 0&&(this.experiments=t.experiments),t.telemetry!==void 0&&(this.telemetry=t.telemetry),t.runtime!==void 0&&(this.runtime=t.runtime),t.launcherLabel!==void 0&&(this.launcherLabel=t.launcherLabel),t.initialBatchHandle!==void 0&&(this.initialBatchHandle=t.initialBatchHandle),t.initialBatchActions!==void 0&&(this.initialBatchActions=t.initialBatchActions),t.workspaceTheme!==void 0&&(this.workspaceTheme=t.workspaceTheme)}async _loadConfig(){if(!U(this,Tn))return;let t=++Bc(this,bi)._;try{this._isLoading=!0,this._error=void 0;let n=await U(this,Tn).call(this);if(t!==U(this,bi))return;z("SmartCanvas Config","Raw config response",n),ne(this,Os,n);let i=n.tiles||[];if(i.length>0&&this.runtime?.accumulator&&En(i,this.runtime.accumulator,n.actions),this.runtime){if(i=await this.runtime.filterTiles(i),t!==U(this,bi))return;this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)))}else this.experiments&&(i=i.filter(l=>this.experiments.shouldRenderRectangle(l)));fv(i),z("SmartCanvas Config",`Tile count after filtering: ${i.length}`);let s=n.actions||[],o=JSON.stringify(s),a=o!==U(this,Rn);a&&ne(this,Rn,o),this._tiles=hv(i),a&&(this._configActions=s),this._isLoading=!1,this._canvasTitle=n.canvasTitle,this._theme=n.theme,this._launcher=n.launcher,this._displayMode=n.displayMode??"standard"}catch(n){let i=n instanceof Error?n.message:"Unknown error";console.error("[SmartCanvas Config] Failed to fetch/filter config:",i,n),this._isLoading=!1,this._error=i}}};it=new WeakMap,yi=new WeakMap,jt=new WeakMap,ar=new WeakMap,Pt=new WeakMap,An=new WeakMap,Ms=new WeakMap,Os=new WeakMap,Rn=new WeakMap,Tn=new WeakMap,In=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,$r=new WeakMap,$n=new WeakMap,_i=new WeakMap,Ps=new WeakMap,Se=new WeakSet,mv=function(){if(this.fetcher)ne(this,Tn,this.fetcher);else{let t=ye(this,Se,vv).call(this);ne(this,Tn,wn(t))}},vv=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},bi=new WeakMap,Zu=async function(){let t=U(this,Os);if(!t||!this.runtime)return;let n=t.tiles||[];n=await this.runtime.filterTiles(n),this.experiments&&(n=n.filter(i=>this.experiments.shouldRenderRectangle(i))),fv(n),this._tiles=hv(n)},yv=async function(){if(!this.runtime?.actions||U(this,An)&&(ne(this,An,!1),JSON.stringify(this._configActions)===U(this,Rn)))return;let t=++Bc(this,Ms)._,n=()=>t!==U(this,Ms);if(U(this,Pt)){try{await U(this,Pt).revertAll()}catch(i){console.error("[SmartCanvasElementLit] Failed to revert actions:",i)}ne(this,Pt,null)}if(!n()&&this._configActions.length>0)try{let i=await this.runtime.actions.applyBatch(this._configActions);n()?await i.revertAll():ne(this,Pt,i)}catch(i){n()||console.error("[SmartCanvasElementLit] Failed to apply actions:",i)}},Gu=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",U(this,$n)),window.addEventListener("hashchange",U(this,$n)))},Ku=function(){typeof window>"u"||(window.removeEventListener("popstate",U(this,$n)),window.removeEventListener("hashchange",U(this,$n)))},Yu=function(){this.runtime&&(this.runtime.accumulator&&ne(this,Tr,this.runtime.accumulator.subscribe(()=>{ye(this,Se,Zu).call(this)})),this.runtime.context&&ne(this,Ir,this.runtime.context.subscribe(t=>{let n=t.page?.url;n&&n!==this._pageUrl&&(this._pageUrl=n),ye(this,Se,Zu).call(this)})))},_v=function(){var t,n;(t=U(this,Tr))==null||t.call(this),ne(this,Tr,null),(n=U(this,Ir))==null||n.call(this),ne(this,Ir,null)},Xu=function(){var t;(t=U(this,$r))==null||t.call(this),ne(this,$r,null),this.runtime&&ne(this,$r,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>{this._displayMode!=="inline"&&U(this,it).setOpen(!0)}))},Ja=new WeakMap,Cn.shadowRootOptions={mode:"open",delegatesFocus:!0},Cn.styles=Yr`
460
+ `:J}open(){this._displayMode!=="inline"&&U(this,st).setOpen(!0)}close(){this._displayMode!=="inline"&&U(this,st).setOpen(!1)}toggle(){this._displayMode!=="inline"&&U(this,st).toggle()}setOverrideFetcher(t){this.fetcher=t}getMountNode(){return this.renderRoot}getController(){return U(this,st)}getPortalRoot(){return U(this,ar)}getOverlayContainer(){return U(this,jt)}getShadowRoot(){return this.shadowRoot}mountLitApp(t){t.fetcher!==void 0&&(this.fetcher=t.fetcher),t.configUri!==void 0&&(this.configUri=t.configUri),t.configUriFeatureKey!==void 0&&(this.configUriFeatureKey=t.configUriFeatureKey),t.configFeatureKey!==void 0&&(this.configFeatureKey=t.configFeatureKey),t.fetchCredentials!==void 0&&(this.fetchCredentials=t.fetchCredentials),t.experiments!==void 0&&(this.experiments=t.experiments),t.telemetry!==void 0&&(this.telemetry=t.telemetry),t.runtime!==void 0&&(this.runtime=t.runtime),t.launcherLabel!==void 0&&(this.launcherLabel=t.launcherLabel),t.initialBatchHandle!==void 0&&(this.initialBatchHandle=t.initialBatchHandle),t.initialBatchActions!==void 0&&(this.initialBatchActions=t.initialBatchActions),t.workspaceTheme!==void 0&&(this.workspaceTheme=t.workspaceTheme)}async _loadConfig({silent:t=!1}={}){if(!U(this,Tn))return;let n=++Wc(this,bi)._;try{t||(this._isLoading=!0),this._error=void 0;let i=await U(this,Tn).call(this);if(n!==U(this,bi))return;z("SmartCanvas Config","Raw config response",i),ne(this,Os,i);let s=i.tiles||[];if(s.length>0&&this.runtime?.accumulator&&En(s,this.runtime.accumulator,i.actions),this.runtime){if(s=await this.runtime.filterTiles(s),n!==U(this,bi))return;this.experiments&&(s=s.filter(v=>this.experiments.shouldRenderRectangle(v)))}else this.experiments&&(s=s.filter(v=>this.experiments.shouldRenderRectangle(v)));vv(s),z("SmartCanvas Config",`Tile count after filtering: ${s.length}`);let o=i.actions||[],a=JSON.stringify(o),l=a!==U(this,Rn);l&&ne(this,Rn,a);let c=mv(s),u=JSON.stringify(c);u!==U(this,Ps)&&(ne(this,Ps,u),this._tiles=c),l&&(this._configActions=o),t||(this._isLoading=!1);let p=JSON.stringify(i.theme??null);p!==U(this,Ns)&&(ne(this,Ns,p),this._theme=i.theme);let h=JSON.stringify(i.launcher??null);h!==U(this,Ls)&&(ne(this,Ls,h),this._launcher=i.launcher),i.canvasTitle!==this._canvasTitle&&(this._canvasTitle=i.canvasTitle);let f=i.displayMode??"standard";f!==this._displayMode&&(this._displayMode=f)}catch(i){let s=i instanceof Error?i.message:"Unknown error";console.error("[SmartCanvas Config] Failed to fetch/filter config:",s,i),t||(this._isLoading=!1),this._error=s}}};st=new WeakMap,yi=new WeakMap,jt=new WeakMap,ar=new WeakMap,Pt=new WeakMap,An=new WeakMap,Ms=new WeakMap,Os=new WeakMap,Rn=new WeakMap,Ps=new WeakMap,Ns=new WeakMap,Ls=new WeakMap,Tn=new WeakMap,In=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,$r=new WeakMap,$n=new WeakMap,_i=new WeakMap,Fs=new WeakMap,Ee=new WeakSet,_v=function(){if(this.fetcher)ne(this,Tn,this.fetcher);else{let t=ye(this,Ee,bv).call(this);ne(this,Tn,wn(t))}},bv=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},bi=new WeakMap,Yu=async function(){let t=U(this,Os);if(!t||!this.runtime)return;let n=t.tiles||[];n=await this.runtime.filterTiles(n),this.experiments&&(n=n.filter(i=>this.experiments.shouldRenderRectangle(i))),vv(n),this._tiles=mv(n)},xv=async function(){if(!this.runtime?.actions||U(this,An)&&(ne(this,An,!1),JSON.stringify(this._configActions)===U(this,Rn)))return;let t=++Wc(this,Ms)._,n=()=>t!==U(this,Ms);if(U(this,Pt)){try{await U(this,Pt).revertAll()}catch(i){console.error("[SmartCanvasElementLit] Failed to revert actions:",i)}ne(this,Pt,null)}if(!n()&&this._configActions.length>0)try{let i=await this.runtime.actions.applyBatch(this._configActions);n()?await i.revertAll():ne(this,Pt,i)}catch(i){n()||console.error("[SmartCanvasElementLit] Failed to apply actions:",i)}},Xu=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",U(this,$n)),window.addEventListener("hashchange",U(this,$n)))},Ju=function(){typeof window>"u"||(window.removeEventListener("popstate",U(this,$n)),window.removeEventListener("hashchange",U(this,$n)))},Qu=function(){this.runtime&&(this.runtime.accumulator&&ne(this,Tr,this.runtime.accumulator.subscribe(()=>{ye(this,Ee,Yu).call(this)})),this.runtime.context&&ne(this,Ir,this.runtime.context.subscribe(t=>{let n=t.page?.url;n&&n!==this._pageUrl&&(this._pageUrl=n),ye(this,Ee,Yu).call(this)})))},wv=function(){var t,n;(t=U(this,Tr))==null||t.call(this),ne(this,Tr,null),(n=U(this,Ir))==null||n.call(this),ne(this,Ir,null)},ed=function(){var t;(t=U(this,$r))==null||t.call(this),ne(this,$r,null),this.runtime&&ne(this,$r,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>{this._displayMode!=="inline"&&U(this,st).setOpen(!0)}))},tl=new WeakMap,Cn.shadowRootOptions={mode:"open",delegatesFocus:!0},Cn.styles=Yr`
461
461
  :host {
462
462
  font: inherit;
463
463
  color: inherit;
@@ -476,7 +476,7 @@ ${n}
476
476
  *::after {
477
477
  box-sizing: border-box;
478
478
  }
479
- `,Cn.properties={fetcher:{attribute:!1},configUri:{type:String},configUriFeatureKey:{type:String},configFeatureKey:{type:String},fetchCredentials:{type:String},experiments:{attribute:!1},telemetry:{attribute:!1},runtime:{attribute:!1},launcherLabel:{type:String},initialBatchHandle:{attribute:!1},initialBatchActions:{attribute:!1},workspaceTheme:{attribute:!1},_tiles:{state:!0},_configActions:{state:!0},_isLoading:{state:!0},_error:{state:!0},_theme:{state:!0},_launcher:{state:!0},_canvasTitle:{state:!0},_displayMode:{state:!0},_isOpen:{state:!0},_pageUrl:{state:!0}};var Ns=()=>{typeof window>"u"||customElements.get(pv)||customElements.define(pv,Cn)};var Qa=class extends he{constructor(){super(...arguments);this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={canvas:{}};this._containerEl=null;this._resizeObserver=null;this._onDocumentMousedown=t=>{if(!this.isOpen)return;let n=t.composedPath();n.some(s=>s instanceof HTMLElement&&s.closest?.('[data-shadow-canvas-id="overlay-launcher"]')!=null)||this._containerEl&&!n.includes(this._containerEl)&&this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}}createRenderRoot(){return this}get _canvas(){return this.themeConfig?.canvas??{}}get _isRight(){return(this._canvas.position??"right")==="right"}get _isPush(){return this._canvas.layout==="push"}get _isFocused(){return this.displayMode==="focused"}get _canvasBorder(){return this._canvas.border??"none"}get _duration(){return this._canvas.transitionDuration??"300ms"}get _easing(){return this._canvas.transitionEasing??"cubic-bezier(0.16, 1, 0.3, 1)"}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentMousedown)}updated(t){if(this._containerEl=this.querySelector('[data-shadow-canvas-id="overlay-container"]')??null,this._isPush){let n=document.documentElement,i=this._isRight?"marginRight":"marginLeft";if(n.style.transition=`${i} ${this._duration} ${this._easing}`,this.isOpen){let s=this._containerEl?.offsetWidth??380;n.style[i]=`${s}px`}else n.style[i]="0px"}if((t.has("isOpen")||t.has("themeConfig"))&&(this._teardownResizeObserver(),this._isPush&&this.isOpen&&this._containerEl)){let n=this._isRight?"marginRight":"marginLeft";this._resizeObserver=new ResizeObserver(([i])=>{document.documentElement.style[n]=`${i.contentRect.width}px`}),this._resizeObserver.observe(this._containerEl)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._onDocumentMousedown),this._teardownResizeObserver(),this._cleanupPushMargin()}_teardownResizeObserver(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_cleanupPushMargin(){if(this._isPush){let t=document.documentElement,n=this._isRight?"marginRight":"marginLeft";t.style[n]="",t.style.transition=""}}render(){let t=this._isFocused,n=this._isRight,i=this._canvasBorder,s=this._duration,o=this._easing,a=2147483600,l=this._canvas.blur??"blur(24px)",c=t&&l!=="none"?`${l} saturate(1.2)`:l,u={};if(!t&&(!i||i==="none")){let m=this._canvas.transitionFade??"6%",g=n?`linear-gradient(to right, transparent, black ${m})`:`linear-gradient(to left, transparent, black ${m})`;u={maskImage:g,WebkitMaskImage:g}}let p={display:"flex",flexDirection:"column",width:t?"40vw":this._canvas.width??"380px",minWidth:"320px",height:"100%",maxHeight:"100%",pointerEvents:"auto",opacity:this.isOpen?"1":"0",transition:this.isOpen?`transform ${s} ${o}, opacity ${s} ease-out`:`transform ${s} ${o}, opacity ${s} ease-in`,color:"var(--sc-overlay-text-color)",background:"var(--sc-canvas-background)",backdropFilter:c,WebkitBackdropFilter:c,...u,border:i,borderRadius:"var(--sc-overlay-border-radius, 0)",boxShadow:"none",transform:this.isOpen?"translateX(0)":n?"translateX(120%)":"translateX(-120%)"},h={position:"absolute",inset:"0",display:"flex",flexDirection:n?"row-reverse":"row",alignItems:"stretch",pointerEvents:"none",padding:"0"},f={position:"fixed",inset:"0",pointerEvents:"none",zIndex:String(a)},v={flex:"1",overflowY:"auto",padding:t?"0":"1rem"};return j`
479
+ `,Cn.properties={fetcher:{attribute:!1},configUri:{type:String},configUriFeatureKey:{type:String},configFeatureKey:{type:String},fetchCredentials:{type:String},experiments:{attribute:!1},telemetry:{attribute:!1},runtime:{attribute:!1},launcherLabel:{type:String},initialBatchHandle:{attribute:!1},initialBatchActions:{attribute:!1},workspaceTheme:{attribute:!1},_tiles:{state:!0},_configActions:{state:!0},_isLoading:{state:!0},_error:{state:!0},_theme:{state:!0},_launcher:{state:!0},_canvasTitle:{state:!0},_displayMode:{state:!0},_isOpen:{state:!0},_pageUrl:{state:!0}};var Ds=()=>{typeof window>"u"||customElements.get(gv)||customElements.define(gv,Cn)};var rl=class extends fe{constructor(){super(...arguments);this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.displayMode="standard";this.runtimeRef=null;this.telemetry=null;this.themeConfig={canvas:{}};this._containerEl=null;this._resizeObserver=null;this._onDocumentMousedown=t=>{if(!this.isOpen)return;let n=t.composedPath();n.some(s=>s instanceof HTMLElement&&s.closest?.('[data-shadow-canvas-id="overlay-launcher"]')!=null)||this._containerEl&&!n.includes(this._containerEl)&&this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}}createRenderRoot(){return this}get _canvas(){return this.themeConfig?.canvas??{}}get _isRight(){return(this._canvas.position??"right")==="right"}get _isPush(){return this._canvas.layout==="push"}get _isFocused(){return this.displayMode==="focused"}get _canvasBorder(){return this._canvas.border??"none"}get _duration(){return this._canvas.transitionDuration??"300ms"}get _easing(){return this._canvas.transitionEasing??"cubic-bezier(0.16, 1, 0.3, 1)"}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentMousedown)}updated(t){if(this._containerEl=this.querySelector('[data-shadow-canvas-id="overlay-container"]')??null,this._isPush){let n=document.documentElement,i=this._isRight?"marginRight":"marginLeft";if(n.style.transition=`${i} ${this._duration} ${this._easing}`,this.isOpen){let s=this._containerEl?.offsetWidth??380;n.style[i]=`${s}px`}else n.style[i]="0px"}if((t.has("isOpen")||t.has("themeConfig"))&&(this._teardownResizeObserver(),this._isPush&&this.isOpen&&this._containerEl)){let n=this._isRight?"marginRight":"marginLeft";this._resizeObserver=new ResizeObserver(([i])=>{document.documentElement.style[n]=`${i.contentRect.width}px`}),this._resizeObserver.observe(this._containerEl)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._onDocumentMousedown),this._teardownResizeObserver(),this._cleanupPushMargin()}_teardownResizeObserver(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_cleanupPushMargin(){if(this._isPush){let t=document.documentElement,n=this._isRight?"marginRight":"marginLeft";t.style[n]="",t.style.transition=""}}render(){let t=this._isFocused,n=this._isRight,i=this._canvasBorder,s=this._duration,o=this._easing,a=2147483600,l=this._canvas.blur??"blur(24px)",c=t&&l!=="none"?`${l} saturate(1.2)`:l,u={};if(!t&&(!i||i==="none")){let g=this._canvas.transitionFade??"6%",m=n?`linear-gradient(to right, transparent, black ${g})`:`linear-gradient(to left, transparent, black ${g})`;u={maskImage:m,WebkitMaskImage:m}}let p={display:"flex",flexDirection:"column",width:t?"40vw":this._canvas.width??"380px",minWidth:"320px",height:"100%",maxHeight:"100%",pointerEvents:"auto",opacity:this.isOpen?"1":"0",transition:this.isOpen?`transform ${s} ${o}, opacity ${s} ease-out`:`transform ${s} ${o}, opacity ${s} ease-in`,color:"var(--sc-overlay-text-color)",background:"var(--sc-canvas-background)",backdropFilter:c,WebkitBackdropFilter:c,...u,border:i,borderRadius:"var(--sc-overlay-border-radius, 0)",boxShadow:"none",transform:this.isOpen?"translateX(0)":n?"translateX(120%)":"translateX(-120%)"},h={position:"absolute",inset:"0",display:"flex",flexDirection:n?"row-reverse":"row",alignItems:"stretch",pointerEvents:"none",padding:"0"},f={position:"fixed",inset:"0",pointerEvents:"none",zIndex:String(a)},v={flex:"1",overflowY:"auto",padding:t?"0":"1rem"};return j`
480
480
  <div data-shadow-canvas-id="overlay-root" style=${I(f)}>
481
481
  <div style=${I(h)}>
482
482
  <div data-shadow-canvas-id="overlay-container" style=${I(p)}>
@@ -507,7 +507,7 @@ ${n}
507
507
  <div style=${I({flex:"1 1 auto"})}></div>
508
508
  </div>
509
509
  </div>
510
- `}};Qa.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1}};customElements.define("syntro-drawer",Qa);var BS="#6a59ce",VS="#887ad8",jS="#ffffff",el=class extends he{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=BS;this.colorPrimaryHover=VS;this.launcherConfig={};this._launcherPos=null;this._hovered=!1;this._drag=null;this._styleEl=null;this._onPointerDown=t=>{let n=t.currentTarget,i=n.getBoundingClientRect();this._drag={startX:t.clientX,startY:t.clientY,startElX:i.left,startElY:i.top,dragged:!1},n.setPointerCapture(t.pointerId)};this._onPointerMove=t=>{let n=this._drag;if(!n)return;let i=t.clientX-n.startX,s=t.clientY-n.startY;(Math.abs(i)>5||Math.abs(s)>5)&&(n.dragged=!0),n.dragged&&(this._launcherPos={x:n.startElX+i,y:n.startElY+s})};this._onPointerUp=t=>{let n=this._drag;this._drag=null,n&&!n.dragged&&this.dispatchEvent(new CustomEvent("launcher-toggle",{bubbles:!0,composed:!0}))};this._onMouseEnter=t=>{this._drag?.dragged||(this._hovered=!0,t.currentTarget.style.backgroundColor=this.launcherConfig.backgroundHover??"var(--sc-launcher-background-hover)")};this._onMouseLeave=t=>{this._drag?.dragged||(this._hovered=!1,t.currentTarget.style.backgroundColor=this.launcherConfig.background??"var(--sc-launcher-background)")}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._ensureDynamicStyles()}updated(t){(t.has("colorPrimary")||t.has("colorPrimaryHover"))&&this._ensureDynamicStyles()}disconnectedCallback(){super.disconnectedCallback(),this._styleEl&&(this._styleEl.remove(),this._styleEl=null)}_ensureDynamicStyles(){let t=`
510
+ `}};rl.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1}};customElements.define("syntro-drawer",rl);var US="#6a59ce",zS="#887ad8",qS="#ffffff",nl=class extends fe{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=US;this.colorPrimaryHover=zS;this.launcherConfig={};this._launcherPos=null;this._hovered=!1;this._drag=null;this._styleEl=null;this._onPointerDown=t=>{let n=t.currentTarget,i=n.getBoundingClientRect();this._drag={startX:t.clientX,startY:t.clientY,startElX:i.left,startElY:i.top,dragged:!1},n.setPointerCapture(t.pointerId)};this._onPointerMove=t=>{let n=this._drag;if(!n)return;let i=t.clientX-n.startX,s=t.clientY-n.startY;(Math.abs(i)>5||Math.abs(s)>5)&&(n.dragged=!0),n.dragged&&(this._launcherPos={x:n.startElX+i,y:n.startElY+s})};this._onPointerUp=t=>{let n=this._drag;this._drag=null,n&&!n.dragged&&this.dispatchEvent(new CustomEvent("launcher-toggle",{bubbles:!0,composed:!0}))};this._onMouseEnter=t=>{this._drag?.dragged||(this._hovered=!0,t.currentTarget.style.backgroundColor=this.launcherConfig.backgroundHover??"var(--sc-launcher-background-hover)")};this._onMouseLeave=t=>{this._drag?.dragged||(this._hovered=!1,t.currentTarget.style.backgroundColor=this.launcherConfig.background??"var(--sc-launcher-background)")}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._ensureDynamicStyles()}updated(t){(t.has("colorPrimary")||t.has("colorPrimaryHover"))&&this._ensureDynamicStyles()}disconnectedCallback(){super.disconnectedCallback(),this._styleEl&&(this._styleEl.remove(),this._styleEl=null)}_ensureDynamicStyles(){let t=`
511
511
  @keyframes syntro-launcher-pulse {
512
512
  0%, 100% {
513
513
  box-shadow: 0 20px 45px rgba(0,0,0,0.35), 0 0 0 0 ${this.colorPrimary}66;
@@ -602,10 +602,10 @@ ${n}
602
602
  <!-- Layer 3: Bouncing count badge -->
603
603
  <span
604
604
  class="syntro-badge-bounce"
605
- style=${I({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:jS,fontSize:"11px",fontWeight:"700"})}
605
+ style=${I({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:qS,fontSize:"11px",fontWeight:"700"})}
606
606
  >${n}</span>
607
607
  </div>
608
- `}};el.properties={isOpen:{type:Boolean},launcherAnimate:{type:Boolean},notificationCount:{type:Number},position:{type:String},launcherIcon:{attribute:!1},colorPrimary:{type:String},colorPrimaryHover:{type:String},launcherConfig:{attribute:!1},_launcherPos:{state:!0},_hovered:{state:!0}};customElements.define("syntro-launcher",el);var Ls=class extends he{constructor(){super(...arguments);this.tiles=[];this.intervalMs=7e3;this.telemetry=null;this.runtimeRef=null;this._index=0;this._ordered=[];this._intervalId=null;this._canvasOpenedTracked=!1}connectedCallback(){super.connectedCallback(),this._syncOrdered(),this._trackCanvasOpened(),this._trackRectangleViewed(),this._startInterval()}disconnectedCallback(){super.disconnectedCallback(),this._stopInterval(),this._canvasOpenedTracked=!1}updated(t){let n=!1;t.has("tiles")&&(this._syncOrdered(),this._index=0,n=!0),t.has("intervalMs")&&(n=!0),n&&(this._stopInterval(),this._startInterval()),(t.has("_index")||t.has("tiles"))&&this._trackRectangleViewed(),t.has("telemetry")&&!this._canvasOpenedTracked&&this._trackCanvasOpened()}_syncOrdered(){this._ordered=[...this.tiles].sort((t,n)=>(t.priority??0)-(n.priority??0))}_trackCanvasOpened(){this._canvasOpenedTracked||this.telemetry&&(this.telemetry.trackCanvasOpened("wheel"),this._canvasOpenedTracked=!0)}_trackRectangleViewed(){let t=this._ordered[this._index];t&&this.telemetry?.trackRectangleViewed(t.id,"wheel")}_startInterval(){this._ordered.length<=1||(this._intervalId=setInterval(()=>{this._index=(this._index+1)%this._ordered.length},this.intervalMs))}_stopInterval(){this._intervalId!==null&&(clearInterval(this._intervalId),this._intervalId=null)}_goTo(t){this._stopInterval(),this._index=t,this._startInterval()}render(){if(!this._ordered.length)return J;let t=I({transform:`translateX(-${this._index*100}%)`,width:`${this._ordered.length*100}%`}),n=I({width:`${100/this._ordered.length}%`});return j`
608
+ `}};nl.properties={isOpen:{type:Boolean},launcherAnimate:{type:Boolean},notificationCount:{type:Number},position:{type:String},launcherIcon:{attribute:!1},colorPrimary:{type:String},colorPrimaryHover:{type:String},launcherConfig:{attribute:!1},_launcherPos:{state:!0},_hovered:{state:!0}};customElements.define("syntro-launcher",nl);var Hs=class extends fe{constructor(){super(...arguments);this.tiles=[];this.intervalMs=7e3;this.telemetry=null;this.runtimeRef=null;this._index=0;this._ordered=[];this._intervalId=null;this._canvasOpenedTracked=!1}connectedCallback(){super.connectedCallback(),this._syncOrdered(),this._trackCanvasOpened(),this._trackRectangleViewed(),this._startInterval()}disconnectedCallback(){super.disconnectedCallback(),this._stopInterval(),this._canvasOpenedTracked=!1}updated(t){let n=!1;t.has("tiles")&&(this._syncOrdered(),this._index=0,n=!0),t.has("intervalMs")&&(n=!0),n&&(this._stopInterval(),this._startInterval()),(t.has("_index")||t.has("tiles"))&&this._trackRectangleViewed(),t.has("telemetry")&&!this._canvasOpenedTracked&&this._trackCanvasOpened()}_syncOrdered(){this._ordered=[...this.tiles].sort((t,n)=>(t.priority??0)-(n.priority??0))}_trackCanvasOpened(){this._canvasOpenedTracked||this.telemetry&&(this.telemetry.trackCanvasOpened("wheel"),this._canvasOpenedTracked=!0)}_trackRectangleViewed(){let t=this._ordered[this._index];t&&this.telemetry?.trackRectangleViewed(t.id,"wheel")}_startInterval(){this._ordered.length<=1||(this._intervalId=setInterval(()=>{this._index=(this._index+1)%this._ordered.length},this.intervalMs))}_stopInterval(){this._intervalId!==null&&(clearInterval(this._intervalId),this._intervalId=null)}_goTo(t){this._stopInterval(),this._index=t,this._startInterval()}render(){if(!this._ordered.length)return J;let t=I({transform:`translateX(-${this._index*100}%)`,width:`${this._ordered.length*100}%`}),n=I({width:`${100/this._ordered.length}%`});return j`
609
609
  <div class="wheel-root" data-shadow-canvas-id="wheel">
610
610
  <div class="slide-track" style=${t}>
611
611
  ${this._ordered.map(i=>j`
@@ -633,7 +633,7 @@ ${n}
633
633
  `)}
634
634
  </div>
635
635
  </div>
636
- `}};Ls.styles=Yr`
636
+ `}};Hs.styles=Yr`
637
637
  :host {
638
638
  display: block;
639
639
  }
@@ -673,23 +673,23 @@ ${n}
673
673
  cursor: pointer;
674
674
  padding: 0;
675
675
  }
676
- `,Ls.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",Ls);function WS(r,e){let t=nn(r,{size:e});return t||`<span style="line-height:1;">${r}</span>`}var _t,bv,xv,wv,kv,Sv,Fs=class extends he{constructor(){super(...arguments);ge(this,_t);this.notifications=[];this.position="right"}render(){if(this.notifications.length===0)return j``;let t=I({position:"fixed",bottom:"6rem",[this.position==="right"?"right":"left"]:"2.5rem",display:"flex",flexDirection:"column",gap:"8px",zIndex:"2147483648",pointerEvents:"auto",width:"280px"});return j`
676
+ `,Hs.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",Hs);function ZS(r,e){let t=nn(r,{size:e});return t||`<span style="line-height:1;">${r}</span>`}var bt,kv,Sv,Ev,Cv,Av,Bs=class extends fe{constructor(){super(...arguments);he(this,bt);this.notifications=[];this.position="right"}render(){if(this.notifications.length===0)return j``;let t=I({position:"fixed",bottom:"6rem",[this.position==="right"?"right":"left"]:"2.5rem",display:"flex",flexDirection:"column",gap:"8px",zIndex:"2147483648",pointerEvents:"auto",width:"280px"});return j`
677
677
  <div
678
678
  data-testid="notification-toast-stack"
679
679
  style=${t}
680
680
  >
681
- ${this.notifications.map(n=>ye(this,_t,Sv).call(this,n))}
681
+ ${this.notifications.map(n=>ye(this,bt,Av).call(this,n))}
682
682
  </div>
683
- `}};_t=new WeakSet,bv=function(t,n){n.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},xv=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},wv=function(t){let n=t.currentTarget;n.style.transform="translateY(-1px)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},kv=function(t){let n=t.currentTarget;n.style.transform="translateY(0)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},Sv=function(t){let n=I({background:"var(--sc-notification-background)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"var(--sc-notification-border)",borderRadius:"var(--sc-notification-border-radius)",overflow:"hidden",cursor:"pointer",transition:"transform 0.15s ease"}),i=I({display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px"}),s=I({width:"28px",height:"28px",borderRadius:"8px",background:"var(--sc-notification-icon-background)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",fontSize:"14px",color:"var(--sc-notification-text-color)"}),o=I({flex:"1",minWidth:"0"}),a=I({fontSize:"13px",fontWeight:"600",color:"var(--sc-notification-text-color)",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),l=I({fontSize:"12px",color:"var(--sc-notification-text-secondary-color)",lineHeight:"1.3",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),c=I({background:"none",border:"none",color:"var(--sc-notification-text-secondary-color)",cursor:"pointer",padding:"2px",fontSize:"14px",lineHeight:"1",flexShrink:"0"}),u=I({height:"2px",background:"rgba(0, 0, 0, 0.08)"}),p=I({height:"100%",background:"var(--sc-notification-progress-gradient)",animationDuration:`${t.ttl}ms`}),h=WS(t.icon??"\u{1F514}",14);return j`
683
+ `}};bt=new WeakSet,kv=function(t,n){n.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},Sv=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},Ev=function(t){let n=t.currentTarget;n.style.transform="translateY(-1px)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},Cv=function(t){let n=t.currentTarget;n.style.transform="translateY(0)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},Av=function(t){let n=I({background:"var(--sc-notification-background)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"var(--sc-notification-border)",borderRadius:"var(--sc-notification-border-radius)",overflow:"hidden",cursor:"pointer",transition:"transform 0.15s ease"}),i=I({display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px"}),s=I({width:"28px",height:"28px",borderRadius:"8px",background:"var(--sc-notification-icon-background)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",fontSize:"14px",color:"var(--sc-notification-text-color)"}),o=I({flex:"1",minWidth:"0"}),a=I({fontSize:"13px",fontWeight:"600",color:"var(--sc-notification-text-color)",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),l=I({fontSize:"12px",color:"var(--sc-notification-text-secondary-color)",lineHeight:"1.3",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),c=I({background:"none",border:"none",color:"var(--sc-notification-text-secondary-color)",cursor:"pointer",padding:"2px",fontSize:"14px",lineHeight:"1",flexShrink:"0"}),u=I({height:"2px",background:"rgba(0, 0, 0, 0.08)"}),p=I({height:"100%",background:"var(--sc-notification-progress-gradient)",animationDuration:`${t.ttl}ms`}),h=ZS(t.icon??"\u{1F514}",14);return j`
684
684
  <div
685
685
  class="syntro-toast-enter"
686
686
  style=${n}
687
- @mouseenter=${ye(this,_t,wv)}
688
- @mouseleave=${ye(this,_t,kv)}
687
+ @mouseenter=${ye(this,bt,Ev)}
688
+ @mouseleave=${ye(this,bt,Cv)}
689
689
  >
690
690
  <div
691
691
  style=${i}
692
- @click=${()=>ye(this,_t,xv).call(this,t)}
692
+ @click=${()=>ye(this,bt,Sv).call(this,t)}
693
693
  >
694
694
  <div
695
695
  style=${s}
@@ -705,7 +705,7 @@ ${n}
705
705
  type="button"
706
706
  aria-label="Dismiss notification"
707
707
  style=${c}
708
- @click=${f=>ye(this,_t,bv).call(this,t.id,f)}
708
+ @click=${f=>ye(this,bt,kv).call(this,t.id,f)}
709
709
  >&#215;</button>
710
710
  </div>
711
711
 
@@ -716,7 +716,7 @@ ${n}
716
716
  ></div>
717
717
  </div>
718
718
  </div>
719
- `},Fs.properties={notifications:{attribute:!1},position:{type:String}},Fs.styles=Yr`
719
+ `},Bs.properties={notifications:{attribute:!1},position:{type:String}},Bs.styles=Yr`
720
720
  @keyframes syntro-toast-slide-in {
721
721
  from { opacity: 0; transform: translateY(12px); }
722
722
  to { opacity: 1; transform: translateY(0); }
@@ -734,15 +734,15 @@ ${n}
734
734
  .syntro-toast-progress.paused {
735
735
  animation-play-state: paused;
736
736
  }
737
- `;customElements.define("syntro-toast-stack",Fs);var Ju=async(r,e)=>{let t=[];if(e.applyAction)for(let n of r.actions){let i=await e.applyAction(n);t.push(i)}return{cleanup:async()=>{for(let n=t.length-1;n>=0;n--)try{await t[n].revert()}catch{}}}},Qu=async(r,e)=>{let t=[];if(e.applyAction){let n=r.actions.map(i=>e.applyAction(i));if(r.waitFor==="any"){let i=await Promise.race(n);t.push(i);let s=await Promise.allSettled(n);for(let o of s)o.status==="fulfilled"&&o.value!==i&&t.push(o.value)}else{let i=await Promise.all(n);t.push(...i)}}return{cleanup:async()=>{for(let n of t)try{await n.revert()}catch{}}}},ed=async(r,e)=>{let t,n,i=!1,s={cleanup:()=>{i=!0,n&&clearTimeout(n),t&&t()}};return r.event&&e.subscribeEvent?await new Promise(o=>{t=e.subscribeEvent(r.event,()=>{i||o()}),r.durationMs!==void 0&&(n=setTimeout(()=>{i||o()},r.durationMs))}):r.durationMs!==void 0&&await new Promise(o=>{n=setTimeout(()=>{i||o()},r.durationMs)}),s};var Ds=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of jc)this.registerCore(e,t);for(let{kind:e,executor:t}of du)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Ju),this.registerCore("core:parallel",Qu),this.registerCore("core:wait",ed)}registerCore(e,t,n){this.executors.set(e,{kind:e,executor:t,schema:n,source:"core",isBuiltIn:!0})}register(e,t,n,i="custom",s=!1){if(this.executors.has(e)){if(this.executors.get(e).isBuiltIn)return;console.warn(`[ExecutorRegistry] Overriding executor for kind: ${e} (source: ${i})`)}console.log(`[ExecutorRegistry] Registered executor: ${e} (source: ${i})`),this.executors.set(e,{kind:e,executor:t,schema:n,source:i,isBuiltIn:s})}unregister(e){let t=this.executors.get(e);return t?t.isBuiltIn?(console.warn(`[ExecutorRegistry] Cannot unregister built-in executor: ${e}`),!1):(this.executors.delete(e),!0):!1}unregisterBySource(e){for(let[t,n]of this.executors.entries())n.source===e&&this.executors.delete(t)}get(e){return this.executors.get(e)?.executor}getRegistration(e){return this.executors.get(e)}has(e){return this.executors.has(e)}validate(e){let t=[];if(!e||typeof e!="object")return t.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:t,warnings:[]};let{kind:n}=e;if(!n||typeof n!="string")return t.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:t,warnings:[]};let i=this.executors.get(n);if(!i)return t.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${n}`,field:"kind"}),{valid:!1,errors:t,warnings:[]};if(i.schema){let s=i.schema.safeParse(e);if(!s.success){for(let o of s.error.issues)t.push({code:"SCHEMA_VALIDATION_ERROR",message:o.message,field:o.path.join(".")});return{valid:!1,errors:t,warnings:[]}}}return{valid:!0,errors:[],warnings:[]}}list(){return Array.from(this.executors.keys())}listRegistrations(){return Array.from(this.executors.values())}getBuiltInKinds(){return Array.from(this.executors.entries()).filter(([,e])=>e.isBuiltIn).map(([e])=>e)}getCustomKinds(){return Array.from(this.executors.entries()).filter(([,e])=>!e.isBuiltIn).map(([e])=>e)}},Wt=new Ds;function Ev(r){return Wt.get(r)}function tl(r){return Wt.has(r)}function td(r,e,t){!r.content||typeof r.content!="string"?e.push({code:"MISSING_CONTENT",message:"Badge action requires 'content' property",field:"content"}):r.content.length>100&&t.push({code:"LONG_BADGE_CONTENT",message:"Badge content is quite long",suggestion:"Keep badge content short (under 100 characters)"})}function rd(r,e,t){if(!r.content||typeof r.content!="object"){e.push({code:"MISSING_CONTENT",message:"Tooltip action requires 'content' object",field:"content"});return}(!r.content.body||typeof r.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Tooltip content requires 'body' property",field:"content.body"})}function nd(r,e,t){!r.html||typeof r.html!="string"?e.push({code:"MISSING_HTML",message:"insertHtml action requires 'html' property",field:"html"}):r.html.length>rl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${rl}`,field:"html"});let n=["before","after","prepend","append","replace"];(!r.position||!n.includes(r.position))&&e.push({code:"INVALID_POSITION",message:`Position must be one of: ${n.join(", ")}`,field:"position"})}function id(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function sd(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(gd.has(r.attr.toLowerCase())||r.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${r.attr}`,field:"attr"}),(r.value===void 0||r.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function od(r,e,t){!r.className||typeof r.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(r.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function ad(r,e,t){if(!r.styles||typeof r.styles!="object")e.push({code:"MISSING_STYLES",message:"setStyle action requires 'styles' object",field:"styles"});else{let n=Object.keys(r.styles).length;n>nl&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${nl}`,field:"styles"});for(let[i,s]of Object.entries(r.styles))typeof s=="string"&&s.includes("expression(")&&e.push({code:"DANGEROUS_STYLE",message:`Style expressions are not allowed: ${i}`,field:`styles.${i}`})}}function ld(r,e,t){(!r.slot||typeof r.slot!="string")&&e.push({code:"MISSING_SLOT",message:"mountWidget action requires 'slot' property",field:"slot"}),!r.widget||typeof r.widget!="object"?e.push({code:"MISSING_WIDGET",message:"mountWidget action requires 'widget' object",field:"widget"}):(!r.widget.widgetId||typeof r.widget.widgetId!="string")&&e.push({code:"MISSING_WIDGET_ID",message:"Widget must have a 'widgetId' property",field:"widget.widgetId"})}function cd(r,e,t){r.durationMs===void 0&&!r.event&&e.push({code:"MISSING_WAIT_CONFIG",message:"wait action requires either 'durationMs' or 'event' property"}),r.durationMs!==void 0&&r.durationMs<0&&e.push({code:"INVALID_DURATION",message:"durationMs must be a positive number",field:"durationMs"}),r.event!==void 0&&typeof r.event!="string"&&e.push({code:"INVALID_EVENT",message:"event must be a string",field:"event"})}function ud(r,e,t){if(!r.actions||!Array.isArray(r.actions)){e.push({code:"MISSING_ACTIONS",message:"sequence action requires 'actions' array",field:"actions"});return}r.actions.length===0&&t.push({code:"EMPTY_SEQUENCE",message:"sequence has no actions",suggestion:"Add at least one action to the sequence"});for(let n=0;n<r.actions.length;n++){let i=Nt(r.actions[n]);for(let s of i.errors)e.push({...s,field:`actions[${n}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function dd(r,e,t){if(!r.actions||!Array.isArray(r.actions)){e.push({code:"MISSING_ACTIONS",message:"parallel action requires 'actions' array",field:"actions"});return}r.actions.length===0&&t.push({code:"EMPTY_PARALLEL",message:"parallel has no actions",suggestion:"Add at least one action to the parallel group"}),r.waitFor&&!["all","any"].includes(r.waitFor)&&e.push({code:"INVALID_WAIT_FOR",message:"waitFor must be 'all' or 'any'",field:"waitFor"});for(let n=0;n<r.actions.length;n++){let i=Nt(r.actions[n]);for(let s of i.errors)e.push({...s,field:`actions[${n}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function pd(r,e,t){if(!r.url||typeof r.url!="string")e.push({code:"MISSING_URL",message:"navigate action requires 'url' property",field:"url"});else{let n=r.url.trim().toLowerCase();n.startsWith("javascript:")&&e.push({code:"DANGEROUS_URL",message:"javascript: URLs are not allowed",field:"url"}),n.startsWith("data:")&&t.push({code:"DATA_URL",message:"data: URLs may have limited support",suggestion:"Consider using a regular URL instead"})}}function hd(r,e,t){if(!r.content||typeof r.content!="object"){e.push({code:"MISSING_CONTENT",message:"Modal action requires 'content' object",field:"content"});return}if((!r.content.body||typeof r.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Modal content requires 'body' property",field:"content.body"}),r.size&&!["sm","md","lg"].includes(r.size)&&e.push({code:"INVALID_SIZE",message:"Modal size must be 'sm', 'md', or 'lg'",field:"size"}),r.ctaButtons)if(!Array.isArray(r.ctaButtons))e.push({code:"INVALID_CTA_BUTTONS",message:"ctaButtons must be an array",field:"ctaButtons"});else for(let n=0;n<r.ctaButtons.length;n++){let i=r.ctaButtons[n];(!i.label||typeof i.label!="string")&&e.push({code:"MISSING_BUTTON_LABEL",message:`CTA button at index ${n} requires 'label' property`,field:`ctaButtons[${n}].label`}),(!i.actionId||typeof i.actionId!="string")&&e.push({code:"MISSING_BUTTON_ACTION_ID",message:`CTA button at index ${n} requires 'actionId' property`,field:`ctaButtons[${n}].actionId`})}}function fd(r,e,t){if((!r.tourId||typeof r.tourId!="string")&&e.push({code:"MISSING_TOUR_ID",message:"Tour action requires 'tourId' property",field:"tourId"}),!r.steps||!Array.isArray(r.steps)){e.push({code:"MISSING_STEPS",message:"Tour action requires 'steps' array",field:"steps"});return}r.steps.length===0&&e.push({code:"EMPTY_STEPS",message:"Tour must have at least one step",field:"steps"});let n=new Set;for(let i=0;i<r.steps.length;i++){let s=r.steps[i];if(!s.id||typeof s.id!="string"?e.push({code:"MISSING_STEP_ID",message:`Step at index ${i} requires 'id' property`,field:`steps[${i}].id`}):(n.has(s.id)&&e.push({code:"DUPLICATE_STEP_ID",message:`Duplicate step ID: ${s.id}`,field:`steps[${i}].id`}),n.add(s.id)),!s.action)e.push({code:"MISSING_STEP_ACTION",message:`Step at index ${i} requires 'action' property`,field:`steps[${i}].action`});else{let o=Nt(s.action);for(let a of o.errors)e.push({...a,field:`steps[${i}].action${a.field?`.${a.field}`:""}`});for(let a of o.warnings)t.push(a)}if(s.onAction)for(let[o,a]of Object.entries(s.onAction))a!=="end"&&!r.steps.some(l=>l.id===a)&&t.push({code:"UNKNOWN_TARGET_STEP",message:`Step "${s.id}" references unknown target step: ${a}`,suggestion:`Make sure step "${a}" exists in the tour`})}}var gd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),rl=5e4,nl=50;function Nt(r){let e=[],t=[];if(!r||typeof r!="object")return e.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:e,warnings:t};let{kind:n}=r;if(!n||typeof n!="string")return e.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:e,warnings:t};if(!tl(n)&&n!=="core:mountWidget"){let i=Wt.list();return console.error(`[ActionValidation] Unknown action kind: "${n}". Registered kinds (${i.length}): [${i.join(", ")}]. This usually means the app that provides "${n}" hasn't been activated yet, or the executor was never registered in ExecutorRegistry.`),e.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${n}`,field:"kind"}),{valid:!1,errors:e,warnings:t}}switch(n){case"overlays:highlight":case"overlays:pulse":case"navigation:scrollTo":lr(r,e,t);break;case"overlays:badge":lr(r,e,t),td(r,e,t);break;case"overlays:tooltip":lr(r,e,t),rd(r,e,t);break;case"overlays:modal":hd(r,e,t);break;case"content:insertHtml":lr(r,e,t),nd(r,e,t);break;case"content:setText":lr(r,e,t),id(r,e,t);break;case"content:setAttr":lr(r,e,t),sd(r,e,t);break;case"content:addClass":case"content:removeClass":lr(r,e,t),od(r,e,t);break;case"content:setStyle":lr(r,e,t),ad(r,e,t);break;case"core:mountWidget":ld(r,e,t);break;case"core:wait":cd(r,e,t);break;case"core:sequence":ud(r,e,t);break;case"core:parallel":dd(r,e,t);break;case"overlays:tour":fd(r,e,t);break;case"navigation:navigate":pd(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function lr(r,e,t){let n=r.anchorId;if(!n||typeof n!="object"){e.push({code:"MISSING_ANCHOR_ID",message:"Action requires an 'anchorId' object with a 'selector' string",field:"anchorId"});return}if(!n.selector||typeof n.selector!="string"?e.push({code:"MISSING_ANCHOR_SELECTOR",message:"anchorId requires a 'selector' string",field:"anchorId.selector"}):n.selector.length>200&&t.push({code:"LONG_ANCHOR_ID",message:"Anchor selector is unusually long",suggestion:"Consider using a shorter, more descriptive selector"}),n.route===void 0||n.route===null)e.push({code:"MISSING_ANCHOR_ROUTE",message:`anchorId requires a 'route' (string or array of strings). Use "**" for all routes.`,field:"anchorId.route"});else{let i=Array.isArray(n.route)?n.route:[n.route];for(let s of i)if(typeof s!="string"){e.push({code:"INVALID_ANCHOR_ROUTE",message:"anchorId.route must be a string or array of strings",field:"anchorId.route"});break}}}function Hs(r){let e=[],t=[];if(!Array.isArray(r))return console.error("[ActionValidation] validateActions called with non-array:",typeof r),e.push({code:"INVALID_ACTIONS",message:"Actions must be an array"}),{valid:!1,errors:e,warnings:t};for(let n=0;n<r.length;n++){let i=Nt(r[n]);if(!i.valid){let s=r[n];console.error(`[ActionValidation] Action [${n}] failed validation:`,`kind="${s?.kind??"undefined"}"`,i.errors.map(o=>`${o.code}: ${o.message}`).join("; "),s)}for(let s of i.errors)e.push({...s,field:s.field?`[${n}].${s.field}`:`[${n}]`});for(let s of i.warnings)t.push({...s,suggestion:s.suggestion?`Action ${n}: ${s.suggestion}`:void 0})}return e.length>0&&console.error(`[ActionValidation] Batch validation failed: ${e.length} error(s) in ${r.length} action(s).`,e.map(n=>`${n.field??"?"}: ${n.message}`).join(" | ")),{valid:e.length===0,errors:e,warnings:t}}var US=0;function il(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=Wt,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++US}`}function f(b,A){t&&t.publish(b,A)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(b,A)=>t.subscribe({names:[b]},$=>A($.props)):void 0,subscribeNavigation:l}}async function m(b,A){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let $=n.mount(b.slot,{type:"widget",widgetId:b.widget.widgetId,config:b.widget.props},{priority:b.widget.priority});return A.publishEvent("action.applied",{id:A.generateId(),kind:"core:mountWidget",slot:b.slot,widgetId:b.widget.widgetId}),{cleanup:()=>{$.unmount()},updateFn:N=>{if("widget"in N&&N.widget){let M=N.widget;M.props&&$.update({type:"widget",widgetId:b.widget.widgetId,config:M.props})}}}}async function g(b,A){if(b.kind==="core:mountWidget")return m(b,A);let $=a.get(b.kind);if(!$){let N="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${b.kind}".`,`Registered: [${N}]`),new Error(`No executor for action kind: ${b.kind}`)}return $(b,A)}function y(b,A,$,N){if(!c)return;let M=[],K=!1,L=async()=>{if(K)return;let O=u.get(b);if(O){K=!0;try{let Y=c.evaluateSync($).value;if(O.state==="applied"&&!Y){try{await O.cleanup()}catch(se){console.error(`[ActionEngine] Error reverting conditional action ${b}:`,se)}O.state="deferred",O.cleanup=()=>{},O.updateFn=void 0,f("action.deferred",{id:b,kind:A.kind})}else if(O.state==="deferred"&&Y)try{let se=v(),C=await g(A,se);O.state="applied",O.cleanup=C.cleanup,O.updateFn=C.updateFn,O.appliedTs=Date.now()}catch(se){console.error(`[ActionEngine] Error applying deferred action ${b}:`,se),O.state="failed"}}finally{K=!1}}};c.context&&M.push(c.context.subscribe(L)),c.accumulator&&M.push(c.accumulator.subscribe(L)),c.sessionMetrics&&M.push(c.sessionMetrics.subscribe(L)),c.events&&M.push(c.events.subscribe(L)),p.set(b,M)}async function x(b){let A=Nt(b);if(!A.valid){let q=A.errors.map(Y=>Y.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${b?.kind}":`,q,b),new Error(`Action validation failed: ${q}`)}let $=h(),N=b.triggerWhen;if(N&&c&&!c.evaluateSync(N).value){let Y={id:$,action:b,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set($,Y);let se={id:$,action:b,async revert(){let C=u.get($);if(!C)return;let P=p.get($);if(P){for(let G of P)G();p.delete($)}C.state="reverted",u.delete($)},isApplied(){return u.get($)?.state==="applied"},async update(C){let P=u.get($);if(!P||P.state!=="applied")throw new Error("Cannot update action that is not applied");if(P.updateFn)await P.updateFn(C);else throw new Error(`Action kind ${b.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return y($,b,N,se),se}let M=v(),K=await g(b,M),L={id:$,action:b,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:K.cleanup,updateFn:K.updateFn};u.set($,L);let O={id:$,action:b,async revert(){let q=u.get($);if(!q||q.state!=="applied")return;let Y=p.get($);if(Y){for(let se of Y)se();p.delete($)}try{await q.cleanup(),q.state="reverted",f("action.reverted",{id:$,kind:b.kind})}catch(se){console.warn(`[ActionEngine] Cleanup error for ${b.kind} (${$}), ignoring:`,se),q.state="reverted",f("action.reverted",{id:$,kind:b.kind})}finally{u.delete($)}},isApplied(){return u.get($)?.state==="applied"},async update(q){let Y=u.get($);if(!Y||Y.state!=="applied")throw new Error("Cannot update action that is not applied");if(Y.updateFn)await Y.updateFn(q);else throw new Error(`Action kind ${b.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return N&&c&&y($,b,N,O),O}async function k(b){console.log(`[ActionEngine] applyBatch: ${b.length} action(s)`,b.map(L=>L.kind).join(", "));let A=Hs(b);if(!A.valid){let L=A.errors.map(O=>O.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${b.length} action(s):`,L,`
738
- Actions:`,b.map((O,q)=>` [${q}] ${O.kind} ${O.anchorId?`anchor="${O.anchorId.selector}"`:""} ${O.label?`label="${O.label}"`:""}`).join(`
739
- `)),new Error(`Batch validation failed: ${L}`)}let $=h(),N=[],M=[];try{let L=await Promise.allSettled(b.map(q=>x(q))),O=[];for(let q of L)q.status==="fulfilled"?(N.push(q.value),M.push(q.value)):O.push(q.reason instanceof Error?q.reason:new Error(String(q.reason)));if(O.length>0&&M.length===0)throw O[0];O.length>0&&console.warn(`[ActionEngine] ${O.length}/${b.length} action(s) failed in batch:`,O.map(q=>q.message).join("; "))}catch(L){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${M.length}. Rolling back...`,L);for(let O of M)try{await O.revert()}catch{}throw L}return{id:$,handles:N,async revertAll(){for(let L=N.length-1;L>=0;L--)try{await N[L].revert()}catch(O){console.error(`[ActionEngine] Error reverting action ${N[L].id}:`,O)}},isApplied(){return N.every(L=>L.isApplied())}}}function _(b){return Nt(b)}function w(){return Array.from(u.values()).map(b=>({id:b.id,action:b.action,adaptiveId:b.adaptiveId,appliedTs:b.appliedTs,state:b.state}))}async function R(){for(let A of p.values())for(let $ of A)try{$()}catch{}p.clear();let b=[];for(let A of u.values())if(A.state==="applied")try{let $=A.cleanup();$&&typeof $.then=="function"&&b.push($.catch(N=>{console.error("[ActionEngine] Error during async cleanup:",N)}))}catch($){console.error("[ActionEngine] Error during cleanup:",$)}u.clear(),b.length>0&&await Promise.all(b)}return{apply:x,applyBatch:k,validate:_,getActive:w,destroy:R}}var md=d.object({include:d.array(d.string()).optional().describe("URL patterns where this tile appears. Supports *, **, :param wildcards. Use sparingly \u2014 mostly to isolate to specific webapp functionality. Omit to appear on all routes."),exclude:d.array(d.string()).optional().describe("URL patterns where this tile should NOT appear. Evaluated before include.")}),Bs=d.object({routes:md,onlyIfPopulated:d.boolean().optional().describe("When true, tile is hidden if none of its props.actions[] have an active triggerWhen. Useful for tiles with all-deferred FAQ questions or nav tips. Default: false.")});function zS(r){return nr.safeParse(r)}function qS(r){return di.safeParse(r)}function ZS(r){return Bs.safeParse(r)}var GS=[{defName:"matchOp",schema:ii},{defName:"counterDef",schema:si},{defName:"activationConfig",schema:Bs},{defName:"routeFilter",schema:md},{defName:"ruleStrategy",schema:ai},{defName:"scoreStrategy",schema:li},{defName:"modelStrategy",schema:ci},{defName:"externalStrategy",schema:ui},{defName:"rule",schema:oi},{defName:"condition",schema:nr}];var vd=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),KS=d.object({on:d.string(),title:d.string(),body:d.string().optional(),icon:d.string().optional(),ttl:d.number().optional(),cooldown:d.number().optional(),deepLink:vd.optional()}).strict(),YS=d.object({id:d.string(),title:d.string().optional(),subtitle:d.string().optional(),icon:d.string().optional(),priority:d.number().optional(),widget:d.string(),props:d.record(d.unknown()).optional(),activation:Bs.optional(),notifications:d.array(KS).optional()}).strict(),XS=d.object({position:d.enum(["left","right"]).optional(),layout:d.enum(["overlay","push"]).optional(),background:d.string().optional(),blur:d.string().optional(),border:d.string().optional(),width:d.string().optional(),padding:d.string().optional(),transitionDuration:d.string().optional(),transitionEasing:d.string().optional(),transitionFade:d.string().optional()}),JS=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),color:d.string().optional(),size:d.string().optional(),shadow:d.string().optional(),borderRadius:d.string().optional(),icon:d.string().optional()}),QS=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),shadow:d.string().optional(),titleColor:d.string().optional(),textColor:d.string().optional(),iconBackground:d.string().optional(),iconShadow:d.string().optional(),headerPadding:d.string().optional(),bodyPadding:d.string().optional(),gap:d.string().optional()}),eE=d.object({background:d.string().optional(),textColor:d.string().optional(),titleColor:d.string().optional(),arrowColor:d.string().optional(),arrowSize:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),scrimOpacity:d.string().optional(),highlightRing:d.string().optional()}),tE=d.object({background:d.string().optional(),textColor:d.string().optional(),textSecondaryColor:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),successColor:d.string().optional(),warningColor:d.string().optional(),errorColor:d.string().optional(),iconBackground:d.string().optional(),progressGradient:d.string().optional()}),rE=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),textColor:d.string().optional(),textSecondaryColor:d.string().optional(),itemDivider:d.string().optional(),itemGap:d.string().optional(),itemPadding:d.string().optional(),itemFontSize:d.string().optional(),bodyPadding:d.string().optional(),bodyFontSize:d.string().optional(),categoryPadding:d.string().optional(),categoryGap:d.string().optional(),categoryFontSize:d.string().optional(),searchBackground:d.string().optional(),searchColor:d.string().optional(),chevronColor:d.string().optional()}),nE=d.object({mode:d.enum(["dark","light"]).optional(),fontFamily:d.string().optional(),colorPrimary:d.string().optional(),colorPrimaryHover:d.string().optional(),borderRadius:d.string().optional(),canvas:XS.optional(),launcher:JS.optional(),tile:QS.optional(),overlay:eE.optional(),notification:tE.optional(),content:rE.optional()}).strict(),iE=d.object({enabled:d.boolean().optional(),label:d.string().optional(),position:d.string().optional(),animate:d.boolean().optional(),animationStyle:d.enum(["pulse","bounce","glow"]).optional(),notificationCount:d.number().optional()}).strict(),YM=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).optional(),tiles:d.array(YS),actions:d.array(d.any()),theme:nE.optional(),launcher:iE.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:nr.optional()})])).optional()}).passthrough().optional()}).strict();var Be={triggerWhen:As},ct=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),yd=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),_d=d.enum(["top-left","top-right","bottom-left","bottom-right"]),bd=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),ol=d.object({label:d.string(),actionId:d.string(),primary:d.boolean().optional()}).strict(),xd=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(ol).optional()}).strict(),wd=d.object({title:d.string().optional(),body:d.string()}).strict(),kd=d.enum(["before","after","prepend","append","replace"]),Sd=d.enum(["immediate","hover","click"]),Ed=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),Cd=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),Ad=d.enum(["auto","smooth","instant"]),sl=d.enum(["start","center","end","nearest"]),Rd=d.object({kind:d.literal("content:setText"),anchorId:ct,text:d.string(),label:d.string().optional()}).extend(Be).strict(),Td=d.object({kind:d.literal("content:setAttr"),anchorId:ct,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(Be).strict(),Id=d.object({kind:d.literal("content:addClass"),anchorId:ct,className:d.string(),label:d.string().optional()}).extend(Be).strict(),$d=d.object({kind:d.literal("content:removeClass"),anchorId:ct,className:d.string(),label:d.string().optional()}).extend(Be).strict(),Md=d.object({kind:d.literal("content:setStyle"),anchorId:ct,styles:d.record(d.string()),label:d.string().optional()}).extend(Be).strict(),Od=d.object({kind:d.literal("content:insertHtml"),anchorId:ct,html:d.string(),position:kd,deepLink:vd.optional(),label:d.string().optional()}).extend(Be).strict(),Pd=d.object({kind:d.literal("overlays:highlight"),anchorId:ct,style:yd.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(Be).strict(),Nd=d.object({kind:d.literal("overlays:pulse"),anchorId:ct,duration:d.number().optional(),label:d.string().optional()}).extend(Be).strict(),Ld=d.object({kind:d.literal("overlays:badge"),anchorId:ct,content:d.string(),position:_d.optional(),label:d.string().optional()}).extend(Be).strict(),Fd=d.object({kind:d.literal("overlays:tooltip"),anchorId:ct,content:xd,trigger:Sd.optional(),placement:bd.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Be).strict(),Dd=d.object({kind:d.literal("overlays:modal"),content:wd,size:d.enum(["sm","md","lg"]).optional(),blocking:d.boolean().optional(),scrim:d.object({opacity:d.number().min(0).max(1).optional()}).strict().optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().min(0).optional()}).strict().optional(),ctaButtons:d.array(ol).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Be).strict(),Hd=d.object({kind:d.literal("navigation:scrollTo"),anchorId:ct,behavior:Ad.optional(),block:sl.optional(),inline:sl.optional(),label:d.string().optional()}).extend(Be).strict(),Bd=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(Be).strict(),Vd=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:Ed,label:d.string().optional()}).extend(Be).strict(),jd=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(Be).strict(),Wd=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(Be).strict(),Ud=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(Be).strict(),zd=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(Cd).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(Be).passthrough(),Cv=[{defName:"setText",schema:Rd},{defName:"setAttr",schema:Td},{defName:"addClass",schema:Id},{defName:"removeClass",schema:$d},{defName:"setStyle",schema:Md},{defName:"insertHtml",schema:Od},{defName:"highlight",schema:Pd},{defName:"pulse",schema:Nd},{defName:"badge",schema:Ld},{defName:"tooltip",schema:Fd},{defName:"modal",schema:Dd},{defName:"scrollTo",schema:Hd},{defName:"navigate",schema:Bd},{defName:"mountWidget",schema:Vd},{defName:"wait",schema:jd},{defName:"sequence",schema:Wd},{defName:"parallel",schema:Ud},{defName:"tour",schema:zd}];function al(r){let e=r?.root??(typeof document<"u"?document.body:null),t=r?.defaultTimeoutMs??5e3,n=new Map,i=new Map,s=null,o=!1;function a(g){if(!e)return null;try{return e.matches(g)?e:e.querySelector(g)}catch{return null}}function l(){for(let[g,y]of n){let x=a(g);if(x){for(let k of y)clearTimeout(k.timer),k.resolve(x);n.delete(g)}}for(let[g,y]of i){let x=a(g);if(x){for(let k of y)k.cancelled||k.cb(x);i.delete(g)}}n.size===0&&i.size===0&&u()}function c(){s||o||typeof MutationObserver>"u"||!e||(s=new MutationObserver(()=>{l()}),s.observe(e,{childList:!0,subtree:!0}))}function u(){s&&(s.disconnect(),s=null)}function p(g,y){let x=n.get(g);x&&(x.delete(y),x.size===0&&n.delete(g)),n.size===0&&i.size===0&&u()}function h(g,y){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let x=a(g);if(x)return Promise.resolve(x);let k=y??t;return new Promise((_,w)=>{let R={resolve:_,reject:w,timer:setTimeout(()=>{p(g,R),w(new Error(`waitFor("${g}") timed out after ${k}ms`))},k)},b=n.get(g);b||(b=new Set,n.set(g,b)),b.add(R),c()})}function f(g,y){if(o)return()=>{};let x=a(g);if(x)return y(x),()=>{};let k={cb:y,cancelled:!1},_=i.get(g);return _||(_=new Set,i.set(g,_)),_.add(k),c(),()=>{k.cancelled=!0;let w=i.get(g);w&&(w.delete(k),w.size===0&&i.delete(g)),n.size===0&&i.size===0&&u()}}function v(){let g=0;for(let y of n.values())g+=y.size;return g}function m(){o=!0,u();let g=new Error("AnchorResolver destroyed");for(let y of n.values())for(let x of y)clearTimeout(x.timer),x.reject(g);n.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:f,pendingCount:v,destroy:m}}var Av={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function Rv(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...Av,...r};if(i&&document.querySelector(i))return()=>{};let o=document.createElement("style");o.textContent=`.${t} { ${n} }`,document.head.appendChild(o),document.documentElement.classList.add(t);let a=!1,l=()=>{a||(a=!0,clearTimeout(u),document.documentElement.classList.remove(t),o.remove(),s&&c&&document.removeEventListener(s,c))},c;s&&(c=()=>l(),document.addEventListener(s,c));let u=setTimeout(()=>{l()},e);return()=>{l()}}function Tv(r={}){let{className:e,style:t}={...Av,...r};return`
737
+ `;customElements.define("syntro-toast-stack",Bs);var td=async(r,e)=>{let t=[];if(e.applyAction)for(let n of r.actions){let i=await e.applyAction(n);t.push(i)}return{cleanup:async()=>{for(let n=t.length-1;n>=0;n--)try{await t[n].revert()}catch{}}}},rd=async(r,e)=>{let t=[];if(e.applyAction){let n=r.actions.map(i=>e.applyAction(i));if(r.waitFor==="any"){let i=await Promise.race(n);t.push(i);let s=await Promise.allSettled(n);for(let o of s)o.status==="fulfilled"&&o.value!==i&&t.push(o.value)}else{let i=await Promise.all(n);t.push(...i)}}return{cleanup:async()=>{for(let n of t)try{await n.revert()}catch{}}}},nd=async(r,e)=>{let t,n,i=!1,s={cleanup:()=>{i=!0,n&&clearTimeout(n),t&&t()}};return r.event&&e.subscribeEvent?await new Promise(o=>{t=e.subscribeEvent(r.event,()=>{i||o()}),r.durationMs!==void 0&&(n=setTimeout(()=>{i||o()},r.durationMs))}):r.durationMs!==void 0&&await new Promise(o=>{n=setTimeout(()=>{i||o()},r.durationMs)}),s};var Vs=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of zc)this.registerCore(e,t);for(let{kind:e,executor:t}of fu)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",td),this.registerCore("core:parallel",rd),this.registerCore("core:wait",nd)}registerCore(e,t,n){this.executors.set(e,{kind:e,executor:t,schema:n,source:"core",isBuiltIn:!0})}register(e,t,n,i="custom",s=!1){if(this.executors.has(e)){if(this.executors.get(e).isBuiltIn)return;console.warn(`[ExecutorRegistry] Overriding executor for kind: ${e} (source: ${i})`)}console.log(`[ExecutorRegistry] Registered executor: ${e} (source: ${i})`),this.executors.set(e,{kind:e,executor:t,schema:n,source:i,isBuiltIn:s})}unregister(e){let t=this.executors.get(e);return t?t.isBuiltIn?(console.warn(`[ExecutorRegistry] Cannot unregister built-in executor: ${e}`),!1):(this.executors.delete(e),!0):!1}unregisterBySource(e){for(let[t,n]of this.executors.entries())n.source===e&&this.executors.delete(t)}get(e){return this.executors.get(e)?.executor}getRegistration(e){return this.executors.get(e)}has(e){return this.executors.has(e)}validate(e){let t=[];if(!e||typeof e!="object")return t.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:t,warnings:[]};let{kind:n}=e;if(!n||typeof n!="string")return t.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:t,warnings:[]};let i=this.executors.get(n);if(!i)return t.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${n}`,field:"kind"}),{valid:!1,errors:t,warnings:[]};if(i.schema){let s=i.schema.safeParse(e);if(!s.success){for(let o of s.error.issues)t.push({code:"SCHEMA_VALIDATION_ERROR",message:o.message,field:o.path.join(".")});return{valid:!1,errors:t,warnings:[]}}}return{valid:!0,errors:[],warnings:[]}}list(){return Array.from(this.executors.keys())}listRegistrations(){return Array.from(this.executors.values())}getBuiltInKinds(){return Array.from(this.executors.entries()).filter(([,e])=>e.isBuiltIn).map(([e])=>e)}getCustomKinds(){return Array.from(this.executors.entries()).filter(([,e])=>!e.isBuiltIn).map(([e])=>e)}},Wt=new Vs;function Rv(r){return Wt.get(r)}function il(r){return Wt.has(r)}function id(r,e,t){!r.content||typeof r.content!="string"?e.push({code:"MISSING_CONTENT",message:"Badge action requires 'content' property",field:"content"}):r.content.length>100&&t.push({code:"LONG_BADGE_CONTENT",message:"Badge content is quite long",suggestion:"Keep badge content short (under 100 characters)"})}function sd(r,e,t){if(!r.content||typeof r.content!="object"){e.push({code:"MISSING_CONTENT",message:"Tooltip action requires 'content' object",field:"content"});return}(!r.content.body||typeof r.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Tooltip content requires 'body' property",field:"content.body"})}function od(r,e,t){!r.html||typeof r.html!="string"?e.push({code:"MISSING_HTML",message:"insertHtml action requires 'html' property",field:"html"}):r.html.length>sl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${sl}`,field:"html"});let n=["before","after","prepend","append","replace"];(!r.position||!n.includes(r.position))&&e.push({code:"INVALID_POSITION",message:`Position must be one of: ${n.join(", ")}`,field:"position"})}function ad(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function ld(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(yd.has(r.attr.toLowerCase())||r.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${r.attr}`,field:"attr"}),(r.value===void 0||r.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function cd(r,e,t){!r.className||typeof r.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(r.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function ud(r,e,t){if(!r.styles||typeof r.styles!="object")e.push({code:"MISSING_STYLES",message:"setStyle action requires 'styles' object",field:"styles"});else{let n=Object.keys(r.styles).length;n>ol&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${ol}`,field:"styles"});for(let[i,s]of Object.entries(r.styles))typeof s=="string"&&s.includes("expression(")&&e.push({code:"DANGEROUS_STYLE",message:`Style expressions are not allowed: ${i}`,field:`styles.${i}`})}}function dd(r,e,t){(!r.slot||typeof r.slot!="string")&&e.push({code:"MISSING_SLOT",message:"mountWidget action requires 'slot' property",field:"slot"}),!r.widget||typeof r.widget!="object"?e.push({code:"MISSING_WIDGET",message:"mountWidget action requires 'widget' object",field:"widget"}):(!r.widget.widgetId||typeof r.widget.widgetId!="string")&&e.push({code:"MISSING_WIDGET_ID",message:"Widget must have a 'widgetId' property",field:"widget.widgetId"})}function pd(r,e,t){r.durationMs===void 0&&!r.event&&e.push({code:"MISSING_WAIT_CONFIG",message:"wait action requires either 'durationMs' or 'event' property"}),r.durationMs!==void 0&&r.durationMs<0&&e.push({code:"INVALID_DURATION",message:"durationMs must be a positive number",field:"durationMs"}),r.event!==void 0&&typeof r.event!="string"&&e.push({code:"INVALID_EVENT",message:"event must be a string",field:"event"})}function hd(r,e,t){if(!r.actions||!Array.isArray(r.actions)){e.push({code:"MISSING_ACTIONS",message:"sequence action requires 'actions' array",field:"actions"});return}r.actions.length===0&&t.push({code:"EMPTY_SEQUENCE",message:"sequence has no actions",suggestion:"Add at least one action to the sequence"});for(let n=0;n<r.actions.length;n++){let i=Nt(r.actions[n]);for(let s of i.errors)e.push({...s,field:`actions[${n}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function fd(r,e,t){if(!r.actions||!Array.isArray(r.actions)){e.push({code:"MISSING_ACTIONS",message:"parallel action requires 'actions' array",field:"actions"});return}r.actions.length===0&&t.push({code:"EMPTY_PARALLEL",message:"parallel has no actions",suggestion:"Add at least one action to the parallel group"}),r.waitFor&&!["all","any"].includes(r.waitFor)&&e.push({code:"INVALID_WAIT_FOR",message:"waitFor must be 'all' or 'any'",field:"waitFor"});for(let n=0;n<r.actions.length;n++){let i=Nt(r.actions[n]);for(let s of i.errors)e.push({...s,field:`actions[${n}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function gd(r,e,t){if(!r.url||typeof r.url!="string")e.push({code:"MISSING_URL",message:"navigate action requires 'url' property",field:"url"});else{let n=r.url.trim().toLowerCase();n.startsWith("javascript:")&&e.push({code:"DANGEROUS_URL",message:"javascript: URLs are not allowed",field:"url"}),n.startsWith("data:")&&t.push({code:"DATA_URL",message:"data: URLs may have limited support",suggestion:"Consider using a regular URL instead"})}}function md(r,e,t){if(!r.content||typeof r.content!="object"){e.push({code:"MISSING_CONTENT",message:"Modal action requires 'content' object",field:"content"});return}if((!r.content.body||typeof r.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Modal content requires 'body' property",field:"content.body"}),r.size&&!["sm","md","lg"].includes(r.size)&&e.push({code:"INVALID_SIZE",message:"Modal size must be 'sm', 'md', or 'lg'",field:"size"}),r.ctaButtons)if(!Array.isArray(r.ctaButtons))e.push({code:"INVALID_CTA_BUTTONS",message:"ctaButtons must be an array",field:"ctaButtons"});else for(let n=0;n<r.ctaButtons.length;n++){let i=r.ctaButtons[n];(!i.label||typeof i.label!="string")&&e.push({code:"MISSING_BUTTON_LABEL",message:`CTA button at index ${n} requires 'label' property`,field:`ctaButtons[${n}].label`}),(!i.actionId||typeof i.actionId!="string")&&e.push({code:"MISSING_BUTTON_ACTION_ID",message:`CTA button at index ${n} requires 'actionId' property`,field:`ctaButtons[${n}].actionId`})}}function vd(r,e,t){if((!r.tourId||typeof r.tourId!="string")&&e.push({code:"MISSING_TOUR_ID",message:"Tour action requires 'tourId' property",field:"tourId"}),!r.steps||!Array.isArray(r.steps)){e.push({code:"MISSING_STEPS",message:"Tour action requires 'steps' array",field:"steps"});return}r.steps.length===0&&e.push({code:"EMPTY_STEPS",message:"Tour must have at least one step",field:"steps"});let n=new Set;for(let i=0;i<r.steps.length;i++){let s=r.steps[i];if(!s.id||typeof s.id!="string"?e.push({code:"MISSING_STEP_ID",message:`Step at index ${i} requires 'id' property`,field:`steps[${i}].id`}):(n.has(s.id)&&e.push({code:"DUPLICATE_STEP_ID",message:`Duplicate step ID: ${s.id}`,field:`steps[${i}].id`}),n.add(s.id)),!s.action)e.push({code:"MISSING_STEP_ACTION",message:`Step at index ${i} requires 'action' property`,field:`steps[${i}].action`});else{let o=Nt(s.action);for(let a of o.errors)e.push({...a,field:`steps[${i}].action${a.field?`.${a.field}`:""}`});for(let a of o.warnings)t.push(a)}if(s.onAction)for(let[o,a]of Object.entries(s.onAction))a!=="end"&&!r.steps.some(l=>l.id===a)&&t.push({code:"UNKNOWN_TARGET_STEP",message:`Step "${s.id}" references unknown target step: ${a}`,suggestion:`Make sure step "${a}" exists in the tour`})}}var yd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),sl=5e4,ol=50;function Nt(r){let e=[],t=[];if(!r||typeof r!="object")return e.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:e,warnings:t};let{kind:n}=r;if(!n||typeof n!="string")return e.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:e,warnings:t};if(!il(n)&&n!=="core:mountWidget"){let i=Wt.list();return console.error(`[ActionValidation] Unknown action kind: "${n}". Registered kinds (${i.length}): [${i.join(", ")}]. This usually means the app that provides "${n}" hasn't been activated yet, or the executor was never registered in ExecutorRegistry.`),e.push({code:"UNKNOWN_KIND",message:`Unknown action kind: ${n}`,field:"kind"}),{valid:!1,errors:e,warnings:t}}switch(n){case"overlays:highlight":case"overlays:pulse":case"navigation:scrollTo":lr(r,e,t);break;case"overlays:badge":lr(r,e,t),id(r,e,t);break;case"overlays:tooltip":lr(r,e,t),sd(r,e,t);break;case"overlays:modal":md(r,e,t);break;case"content:insertHtml":lr(r,e,t),od(r,e,t);break;case"content:setText":lr(r,e,t),ad(r,e,t);break;case"content:setAttr":lr(r,e,t),ld(r,e,t);break;case"content:addClass":case"content:removeClass":lr(r,e,t),cd(r,e,t);break;case"content:setStyle":lr(r,e,t),ud(r,e,t);break;case"core:mountWidget":dd(r,e,t);break;case"core:wait":pd(r,e,t);break;case"core:sequence":hd(r,e,t);break;case"core:parallel":fd(r,e,t);break;case"overlays:tour":vd(r,e,t);break;case"navigation:navigate":gd(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function lr(r,e,t){let n=r.anchorId;if(!n||typeof n!="object"){e.push({code:"MISSING_ANCHOR_ID",message:"Action requires an 'anchorId' object with a 'selector' string",field:"anchorId"});return}if(!n.selector||typeof n.selector!="string"?e.push({code:"MISSING_ANCHOR_SELECTOR",message:"anchorId requires a 'selector' string",field:"anchorId.selector"}):n.selector.length>200&&t.push({code:"LONG_ANCHOR_ID",message:"Anchor selector is unusually long",suggestion:"Consider using a shorter, more descriptive selector"}),n.route===void 0||n.route===null)e.push({code:"MISSING_ANCHOR_ROUTE",message:`anchorId requires a 'route' (string or array of strings). Use "**" for all routes.`,field:"anchorId.route"});else{let i=Array.isArray(n.route)?n.route:[n.route];for(let s of i)if(typeof s!="string"){e.push({code:"INVALID_ANCHOR_ROUTE",message:"anchorId.route must be a string or array of strings",field:"anchorId.route"});break}}}function js(r){let e=[],t=[];if(!Array.isArray(r))return console.error("[ActionValidation] validateActions called with non-array:",typeof r),e.push({code:"INVALID_ACTIONS",message:"Actions must be an array"}),{valid:!1,errors:e,warnings:t};for(let n=0;n<r.length;n++){let i=Nt(r[n]);if(!i.valid){let s=r[n];console.error(`[ActionValidation] Action [${n}] failed validation:`,`kind="${s?.kind??"undefined"}"`,i.errors.map(o=>`${o.code}: ${o.message}`).join("; "),s)}for(let s of i.errors)e.push({...s,field:s.field?`[${n}].${s.field}`:`[${n}]`});for(let s of i.warnings)t.push({...s,suggestion:s.suggestion?`Action ${n}: ${s.suggestion}`:void 0})}return e.length>0&&console.error(`[ActionValidation] Batch validation failed: ${e.length} error(s) in ${r.length} action(s).`,e.map(n=>`${n.field??"?"}: ${n.message}`).join(" | ")),{valid:e.length===0,errors:e,warnings:t}}var GS=0;function al(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=Wt,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++GS}`}function f(b,A){t&&t.publish(b,A)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(b,A)=>t.subscribe({names:[b]},$=>A($.props)):void 0,subscribeNavigation:l}}async function g(b,A){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let $=n.mount(b.slot,{type:"widget",widgetId:b.widget.widgetId,config:b.widget.props},{priority:b.widget.priority});return A.publishEvent("action.applied",{id:A.generateId(),kind:"core:mountWidget",slot:b.slot,widgetId:b.widget.widgetId}),{cleanup:()=>{$.unmount()},updateFn:N=>{if("widget"in N&&N.widget){let M=N.widget;M.props&&$.update({type:"widget",widgetId:b.widget.widgetId,config:M.props})}}}}async function m(b,A){if(b.kind==="core:mountWidget")return g(b,A);let $=a.get(b.kind);if(!$){let N="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${b.kind}".`,`Registered: [${N}]`),new Error(`No executor for action kind: ${b.kind}`)}return $(b,A)}function y(b,A,$,N){if(!c)return;let M=[],K=!1,L=async()=>{if(K)return;let P=u.get(b);if(P){K=!0;try{let Y=c.evaluateSync($).value;if(P.state==="applied"&&!Y){try{await P.cleanup()}catch(re){console.error(`[ActionEngine] Error reverting conditional action ${b}:`,re)}P.state="deferred",P.cleanup=()=>{},P.updateFn=void 0,f("action.deferred",{id:b,kind:A.kind})}else if(P.state==="deferred"&&Y)try{let re=v(),C=await m(A,re);P.state="applied",P.cleanup=C.cleanup,P.updateFn=C.updateFn,P.appliedTs=Date.now()}catch(re){console.error(`[ActionEngine] Error applying deferred action ${b}:`,re),P.state="failed"}}finally{K=!1}}};c.context&&M.push(c.context.subscribe(L)),c.accumulator&&M.push(c.accumulator.subscribe(L)),c.sessionMetrics&&M.push(c.sessionMetrics.subscribe(L)),c.events&&M.push(c.events.subscribe(L)),p.set(b,M)}async function x(b){let A=Nt(b);if(!A.valid){let q=A.errors.map(Y=>Y.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${b?.kind}":`,q,b),new Error(`Action validation failed: ${q}`)}let $=h(),N=b.triggerWhen;if(N&&c&&!c.evaluateSync(N).value){let Y={id:$,action:b,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set($,Y);let re={id:$,action:b,async revert(){let C=u.get($);if(!C)return;let O=p.get($);if(O){for(let Z of O)Z();p.delete($)}C.state="reverted",u.delete($)},isApplied(){return u.get($)?.state==="applied"},async update(C){let O=u.get($);if(!O||O.state!=="applied")throw new Error("Cannot update action that is not applied");if(O.updateFn)await O.updateFn(C);else throw new Error(`Action kind ${b.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return y($,b,N,re),re}let M=v(),K=await m(b,M),L={id:$,action:b,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:K.cleanup,updateFn:K.updateFn};u.set($,L);let P={id:$,action:b,async revert(){let q=u.get($);if(!q||q.state!=="applied")return;let Y=p.get($);if(Y){for(let re of Y)re();p.delete($)}try{await q.cleanup(),q.state="reverted",f("action.reverted",{id:$,kind:b.kind})}catch(re){console.warn(`[ActionEngine] Cleanup error for ${b.kind} (${$}), ignoring:`,re),q.state="reverted",f("action.reverted",{id:$,kind:b.kind})}finally{u.delete($)}},isApplied(){return u.get($)?.state==="applied"},async update(q){let Y=u.get($);if(!Y||Y.state!=="applied")throw new Error("Cannot update action that is not applied");if(Y.updateFn)await Y.updateFn(q);else throw new Error(`Action kind ${b.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return N&&c&&y($,b,N,P),P}async function k(b){console.log(`[ActionEngine] applyBatch: ${b.length} action(s)`,b.map(L=>L.kind).join(", "));let A=js(b);if(!A.valid){let L=A.errors.map(P=>P.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${b.length} action(s):`,L,`
738
+ Actions:`,b.map((P,q)=>` [${q}] ${P.kind} ${P.anchorId?`anchor="${P.anchorId.selector}"`:""} ${P.label?`label="${P.label}"`:""}`).join(`
739
+ `)),new Error(`Batch validation failed: ${L}`)}let $=h(),N=[],M=[];try{let L=await Promise.allSettled(b.map(q=>x(q))),P=[];for(let q of L)q.status==="fulfilled"?(N.push(q.value),M.push(q.value)):P.push(q.reason instanceof Error?q.reason:new Error(String(q.reason)));if(P.length>0&&M.length===0)throw P[0];P.length>0&&console.warn(`[ActionEngine] ${P.length}/${b.length} action(s) failed in batch:`,P.map(q=>q.message).join("; "))}catch(L){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${M.length}. Rolling back...`,L);for(let P of M)try{await P.revert()}catch{}throw L}return{id:$,handles:N,async revertAll(){for(let L=N.length-1;L>=0;L--)try{await N[L].revert()}catch(P){console.error(`[ActionEngine] Error reverting action ${N[L].id}:`,P)}},isApplied(){return N.every(L=>L.isApplied())}}}function _(b){return Nt(b)}function w(){return Array.from(u.values()).map(b=>({id:b.id,action:b.action,adaptiveId:b.adaptiveId,appliedTs:b.appliedTs,state:b.state}))}async function R(){for(let A of p.values())for(let $ of A)try{$()}catch{}p.clear();let b=[];for(let A of u.values())if(A.state==="applied")try{let $=A.cleanup();$&&typeof $.then=="function"&&b.push($.catch(N=>{console.error("[ActionEngine] Error during async cleanup:",N)}))}catch($){console.error("[ActionEngine] Error during cleanup:",$)}u.clear(),b.length>0&&await Promise.all(b)}return{apply:x,applyBatch:k,validate:_,getActive:w,destroy:R}}var _d=d.object({include:d.array(d.string()).optional().describe("URL patterns where this tile appears. Supports *, **, :param wildcards. Use sparingly \u2014 mostly to isolate to specific webapp functionality. Omit to appear on all routes."),exclude:d.array(d.string()).optional().describe("URL patterns where this tile should NOT appear. Evaluated before include.")}),Ws=d.object({routes:_d,onlyIfPopulated:d.boolean().optional().describe("When true, tile is hidden if none of its props.actions[] have an active triggerWhen. Useful for tiles with all-deferred FAQ questions or nav tips. Default: false.")});function KS(r){return nr.safeParse(r)}function YS(r){return di.safeParse(r)}function XS(r){return Ws.safeParse(r)}var JS=[{defName:"matchOp",schema:ii},{defName:"counterDef",schema:si},{defName:"activationConfig",schema:Ws},{defName:"routeFilter",schema:_d},{defName:"ruleStrategy",schema:ai},{defName:"scoreStrategy",schema:li},{defName:"modelStrategy",schema:ci},{defName:"externalStrategy",schema:ui},{defName:"rule",schema:oi},{defName:"condition",schema:nr}];var bd=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),QS=d.object({on:d.string(),title:d.string(),body:d.string().optional(),icon:d.string().optional(),ttl:d.number().optional(),cooldown:d.number().optional(),deepLink:bd.optional()}).strict(),eE=d.object({id:d.string(),title:d.string().optional(),subtitle:d.string().optional(),icon:d.string().optional(),priority:d.number().optional(),widget:d.string(),props:d.record(d.unknown()).optional(),activation:Ws.optional(),notifications:d.array(QS).optional()}).strict(),tE=d.object({position:d.enum(["left","right"]).optional(),layout:d.enum(["overlay","push"]).optional(),background:d.string().optional(),blur:d.string().optional(),border:d.string().optional(),width:d.string().optional(),padding:d.string().optional(),transitionDuration:d.string().optional(),transitionEasing:d.string().optional(),transitionFade:d.string().optional()}),rE=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),color:d.string().optional(),size:d.string().optional(),shadow:d.string().optional(),borderRadius:d.string().optional(),icon:d.string().optional()}),nE=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),shadow:d.string().optional(),titleColor:d.string().optional(),textColor:d.string().optional(),iconBackground:d.string().optional(),iconShadow:d.string().optional(),headerPadding:d.string().optional(),bodyPadding:d.string().optional(),gap:d.string().optional()}),iE=d.object({background:d.string().optional(),textColor:d.string().optional(),titleColor:d.string().optional(),arrowColor:d.string().optional(),arrowSize:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),scrimOpacity:d.string().optional(),highlightRing:d.string().optional()}),sE=d.object({background:d.string().optional(),textColor:d.string().optional(),textSecondaryColor:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),successColor:d.string().optional(),warningColor:d.string().optional(),errorColor:d.string().optional(),iconBackground:d.string().optional(),progressGradient:d.string().optional()}),oE=d.object({background:d.string().optional(),backgroundHover:d.string().optional(),border:d.string().optional(),borderRadius:d.string().optional(),textColor:d.string().optional(),textSecondaryColor:d.string().optional(),itemDivider:d.string().optional(),itemGap:d.string().optional(),itemPadding:d.string().optional(),itemFontSize:d.string().optional(),bodyPadding:d.string().optional(),bodyFontSize:d.string().optional(),categoryPadding:d.string().optional(),categoryGap:d.string().optional(),categoryFontSize:d.string().optional(),searchBackground:d.string().optional(),searchColor:d.string().optional(),chevronColor:d.string().optional()}),aE=d.object({mode:d.enum(["dark","light"]).optional(),fontFamily:d.string().optional(),colorPrimary:d.string().optional(),colorPrimaryHover:d.string().optional(),borderRadius:d.string().optional(),canvas:tE.optional(),launcher:rE.optional(),tile:nE.optional(),overlay:iE.optional(),notification:sE.optional(),content:oE.optional()}).strict(),lE=d.object({enabled:d.boolean().optional(),label:d.string().optional(),position:d.string().optional(),animate:d.boolean().optional(),animationStyle:d.enum(["pulse","bounce","glow"]).optional(),notificationCount:d.number().optional()}).strict(),eO=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).optional(),tiles:d.array(eE),actions:d.array(d.any()),theme:aE.optional(),launcher:lE.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:nr.optional()})])).optional()}).passthrough().optional()}).strict();var Ve={triggerWhen:As},ut=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),xd=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),wd=d.enum(["top-left","top-right","bottom-left","bottom-right"]),kd=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),cl=d.object({label:d.string(),actionId:d.string(),primary:d.boolean().optional()}).strict(),Sd=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(cl).optional()}).strict(),Ed=d.object({title:d.string().optional(),body:d.string()}).strict(),Cd=d.enum(["before","after","prepend","append","replace"]),Ad=d.enum(["immediate","hover","click"]),Rd=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),Td=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),Id=d.enum(["auto","smooth","instant"]),ll=d.enum(["start","center","end","nearest"]),$d=d.object({kind:d.literal("content:setText"),anchorId:ut,text:d.string(),label:d.string().optional()}).extend(Ve).strict(),Md=d.object({kind:d.literal("content:setAttr"),anchorId:ut,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(Ve).strict(),Od=d.object({kind:d.literal("content:addClass"),anchorId:ut,className:d.string(),label:d.string().optional()}).extend(Ve).strict(),Pd=d.object({kind:d.literal("content:removeClass"),anchorId:ut,className:d.string(),label:d.string().optional()}).extend(Ve).strict(),Nd=d.object({kind:d.literal("content:setStyle"),anchorId:ut,styles:d.record(d.string()),label:d.string().optional()}).extend(Ve).strict(),Ld=d.object({kind:d.literal("content:insertHtml"),anchorId:ut,html:d.string(),position:Cd,deepLink:bd.optional(),label:d.string().optional()}).extend(Ve).strict(),Fd=d.object({kind:d.literal("overlays:highlight"),anchorId:ut,style:xd.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(Ve).strict(),Dd=d.object({kind:d.literal("overlays:pulse"),anchorId:ut,duration:d.number().optional(),label:d.string().optional()}).extend(Ve).strict(),Hd=d.object({kind:d.literal("overlays:badge"),anchorId:ut,content:d.string(),position:wd.optional(),label:d.string().optional()}).extend(Ve).strict(),Bd=d.object({kind:d.literal("overlays:tooltip"),anchorId:ut,content:Sd,trigger:Ad.optional(),placement:kd.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ve).strict(),Vd=d.object({kind:d.literal("overlays:modal"),content:Ed,size:d.enum(["sm","md","lg"]).optional(),blocking:d.boolean().optional(),scrim:d.object({opacity:d.number().min(0).max(1).optional()}).strict().optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().min(0).optional()}).strict().optional(),ctaButtons:d.array(cl).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ve).strict(),jd=d.object({kind:d.literal("navigation:scrollTo"),anchorId:ut,behavior:Id.optional(),block:ll.optional(),inline:ll.optional(),label:d.string().optional()}).extend(Ve).strict(),Wd=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(Ve).strict(),Ud=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:Rd,label:d.string().optional()}).extend(Ve).strict(),zd=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(Ve).strict(),qd=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(Ve).strict(),Zd=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(Ve).strict(),Gd=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(Td).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(Ve).passthrough(),Tv=[{defName:"setText",schema:$d},{defName:"setAttr",schema:Md},{defName:"addClass",schema:Od},{defName:"removeClass",schema:Pd},{defName:"setStyle",schema:Nd},{defName:"insertHtml",schema:Ld},{defName:"highlight",schema:Fd},{defName:"pulse",schema:Dd},{defName:"badge",schema:Hd},{defName:"tooltip",schema:Bd},{defName:"modal",schema:Vd},{defName:"scrollTo",schema:jd},{defName:"navigate",schema:Wd},{defName:"mountWidget",schema:Ud},{defName:"wait",schema:zd},{defName:"sequence",schema:qd},{defName:"parallel",schema:Zd},{defName:"tour",schema:Gd}];function ul(r){let e=r?.root??(typeof document<"u"?document.body:null),t=r?.defaultTimeoutMs??5e3,n=new Map,i=new Map,s=null,o=!1;function a(m){if(!e)return null;try{return e.matches(m)?e:e.querySelector(m)}catch{return null}}function l(){for(let[m,y]of n){let x=a(m);if(x){for(let k of y)clearTimeout(k.timer),k.resolve(x);n.delete(m)}}for(let[m,y]of i){let x=a(m);if(x){for(let k of y)k.cancelled||k.cb(x);i.delete(m)}}n.size===0&&i.size===0&&u()}function c(){s||o||typeof MutationObserver>"u"||!e||(s=new MutationObserver(()=>{l()}),s.observe(e,{childList:!0,subtree:!0}))}function u(){s&&(s.disconnect(),s=null)}function p(m,y){let x=n.get(m);x&&(x.delete(y),x.size===0&&n.delete(m)),n.size===0&&i.size===0&&u()}function h(m,y){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let x=a(m);if(x)return Promise.resolve(x);let k=y??t;return new Promise((_,w)=>{let R={resolve:_,reject:w,timer:setTimeout(()=>{p(m,R),w(new Error(`waitFor("${m}") timed out after ${k}ms`))},k)},b=n.get(m);b||(b=new Set,n.set(m,b)),b.add(R),c()})}function f(m,y){if(o)return()=>{};let x=a(m);if(x)return y(x),()=>{};let k={cb:y,cancelled:!1},_=i.get(m);return _||(_=new Set,i.set(m,_)),_.add(k),c(),()=>{k.cancelled=!0;let w=i.get(m);w&&(w.delete(k),w.size===0&&i.delete(m)),n.size===0&&i.size===0&&u()}}function v(){let m=0;for(let y of n.values())m+=y.size;return m}function g(){o=!0,u();let m=new Error("AnchorResolver destroyed");for(let y of n.values())for(let x of y)clearTimeout(x.timer),x.reject(m);n.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:f,pendingCount:v,destroy:g}}var Iv={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function $v(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...Iv,...r};if(i&&document.querySelector(i))return()=>{};let o=document.createElement("style");o.textContent=`.${t} { ${n} }`,document.head.appendChild(o),document.documentElement.classList.add(t);let a=!1,l=()=>{a||(a=!0,clearTimeout(u),document.documentElement.classList.remove(t),o.remove(),s&&c&&document.removeEventListener(s,c))},c;s&&(c=()=>l(),document.addEventListener(s,c));let u=setTimeout(()=>{l()},e);return()=>{l()}}function Mv(r={}){let{className:e,style:t}={...Iv,...r};return`
740
740
  (function() {
741
741
  var s = document.createElement('style');
742
742
  s.textContent = '.${e} { ${t} }';
743
743
  document.head.appendChild(s);
744
744
  document.documentElement.className += ' ${e}';
745
- })();`}var sE=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function Iv(r){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search).get(r);if(!t)return null;try{let n=t.replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(n))}catch(n){return Je("Syntro Runtime",`Failed to decode ${r}:`,n),null}}var qd="__syntro_rt_editor_source",Zd="__syntro_rt_editor_conf";function ll(r,e){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}}function $v(r){try{let e=sessionStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}var Mr,Or;function js(){if(Mr==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.token)Mr={token:r.token,api_base:r.apiBase||""},ll(qd,Mr),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${Mr.token.slice(0,15)}...)`);else{let e=Iv("editor_source");if(e)Mr=e,ll(qd,e);else{let t=$v(qd);t?.token&&(Mr=t,console.log(`[DIAG] getEditorSource: restored from sessionStorage (token=${t.token.slice(0,15)}...)`))}console.log(`[DIAG] getEditorSource: from URL param \u2192 ${e?`token=${e.token?.slice(0,15)}...`:"NULL"}`),!e&&typeof window<"u"&&console.log(`[DIAG] getEditorSource: URL search = ${window.location.search.slice(0,200)}`)}}return Mr??null}function cl(){if(Or==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.mode)Or={mode:r.mode,audit_session_id:r.auditSessionId,syntro_token:r.syntroToken,workspace_id:r.workspaceId},ll(Zd,Or),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${Or.mode})`);else{let e=Iv("editor_conf");if(e)Or=e,ll(Zd,e);else{let t=$v(Zd);t?.mode&&(Or=t,console.log(`[DIAG] getEditorConf: restored from sessionStorage (mode=${t.mode})`))}console.log(`[DIAG] getEditorConf: from URL param \u2192 ${e?`mode=${e.mode}`:"NULL"}`)}}return Or??null}function oE(r){z("Syntro Runtime","Validating editor URL:",r);try{if(r.startsWith("/"))return z("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",r),!0;let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(Je("Syntro Runtime","\u274C Editor URL must use HTTPS:",r),!1):sE.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i)?(z("Syntro Runtime","\u2713 Editor URL validated"),!0):(Je("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return Je("Syntro Runtime",`\u274C Invalid editor URL: ${r}`,e),!1}}var ul=()=>{let r=cl();return!js()?.token||!r?.mode?null:r.mode};function aE(){return js()?.token??null}function lE(){return js()?.api_base??null}var Vs=null,Mv=async r=>{if(z("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){z("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){z("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}if(Vs)return z("Syntro Runtime","Editor SDK load already in progress, waiting..."),Vs;let e=typeof r=="string"?{editorUrl:r}:r??{};if(e.editorUrl==="skip"){z("Syntro Runtime",'editorUrl="skip" \u2014 deferring to caller'),z("Syntro Runtime","================================");return}let t=lE(),i=(t?`${t}/api/editor/sdk/editor-sdk.js`:null)||e.editorUrl;if(!i){Je("Syntro Runtime","\u274C No editor SDK URL available (no api_base, no editorUrl option)"),z("Syntro Runtime","================================");return}let s=aE(),o=s?`${i}?token=${encodeURIComponent(s)}`:i;if(z("Syntro Runtime","Editor URL:",o),z("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,hasEditorUrl:!!i,hasApiBase:!!t,tokenPrefix:s?`${s.slice(0,10)}...`:"none"}),!oE(i)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",i),z("Syntro Runtime","================================");return}return z("Syntro Runtime","\u2713 URL validated, injecting script tag..."),Vs=new Promise((a,l)=>{let c=document.createElement("script");c.src=o,c.async=!0,e.integrity&&(c.integrity=e.integrity,c.crossOrigin="anonymous",z("Syntro Runtime","SRI integrity check enabled")),c.onload=()=>{z("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),z("Syntro Runtime","================================"),a()},c.onerror=u=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",u),console.error("[Syntro Runtime] URL attempted:",o),z("Syntro Runtime","================================"),Vs=null,l(u)},document.head.appendChild(c),z("Syntro Runtime","Script tag appended to <head>")}),Vs};var Ut=null;function Pv(r){Ut&&Ut!==r?r.appendChild(Ut):Ut=r;let e=r.getRootNode();e instanceof ShadowRoot&&cE(e)}function Nv(){return Ut||(Ut=document.createElement("div"),Ut.id="syntro-overlays",Object.assign(Ut.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(Ut)),Ut}var Ov=!1;function cE(r){if(Ov)return;let e=`
745
+ })();`}var cE=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function Ov(r){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search).get(r);if(!t)return null;try{let n=t.replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(n))}catch(n){return Qe("Syntro Runtime",`Failed to decode ${r}:`,n),null}}var Kd="__syntro_rt_editor_source",Yd="__syntro_rt_editor_conf";function dl(r,e){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}}function Pv(r){try{let e=sessionStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}var Mr,Or;function zs(){if(Mr==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.token)Mr={token:r.token,api_base:r.apiBase||""},dl(Kd,Mr),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${Mr.token.slice(0,15)}...)`);else{let e=Ov("editor_source");if(e)Mr=e,dl(Kd,e);else{let t=Pv(Kd);t?.token&&(Mr=t,console.log(`[DIAG] getEditorSource: restored from sessionStorage (token=${t.token.slice(0,15)}...)`))}console.log(`[DIAG] getEditorSource: from URL param \u2192 ${e?`token=${e.token?.slice(0,15)}...`:"NULL"}`),!e&&typeof window<"u"&&console.log(`[DIAG] getEditorSource: URL search = ${window.location.search.slice(0,200)}`)}}return Mr??null}function pl(){if(Or==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.mode)Or={mode:r.mode,audit_session_id:r.auditSessionId,syntro_token:r.syntroToken,workspace_id:r.workspaceId},dl(Yd,Or),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${Or.mode})`);else{let e=Ov("editor_conf");if(e)Or=e,dl(Yd,e);else{let t=Pv(Yd);t?.mode&&(Or=t,console.log(`[DIAG] getEditorConf: restored from sessionStorage (mode=${t.mode})`))}console.log(`[DIAG] getEditorConf: from URL param \u2192 ${e?`mode=${e.mode}`:"NULL"}`)}}return Or??null}function uE(r){z("Syntro Runtime","Validating editor URL:",r);try{if(r.startsWith("/"))return z("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",r),!0;let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(Qe("Syntro Runtime","\u274C Editor URL must use HTTPS:",r),!1):cE.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i)?(z("Syntro Runtime","\u2713 Editor URL validated"),!0):(Qe("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return Qe("Syntro Runtime",`\u274C Invalid editor URL: ${r}`,e),!1}}var hl=()=>{let r=pl();return!zs()?.token||!r?.mode?null:r.mode};function dE(){return zs()?.token??null}function pE(){return zs()?.api_base??null}var Us=null,Nv=async r=>{if(z("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){z("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){z("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}if(Us)return z("Syntro Runtime","Editor SDK load already in progress, waiting..."),Us;let e=typeof r=="string"?{editorUrl:r}:r??{};if(e.editorUrl==="skip"){z("Syntro Runtime",'editorUrl="skip" \u2014 deferring to caller'),z("Syntro Runtime","================================");return}let t=pE(),i=(t?`${t}/api/editor/sdk/editor-sdk.js`:null)||e.editorUrl;if(!i){Qe("Syntro Runtime","\u274C No editor SDK URL available (no api_base, no editorUrl option)"),z("Syntro Runtime","================================");return}let s=dE(),o=s?`${i}?token=${encodeURIComponent(s)}`:i;if(z("Syntro Runtime","Editor URL:",o),z("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,hasEditorUrl:!!i,hasApiBase:!!t,tokenPrefix:s?`${s.slice(0,10)}...`:"none"}),!uE(i)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",i),z("Syntro Runtime","================================");return}return z("Syntro Runtime","\u2713 URL validated, injecting script tag..."),Us=new Promise((a,l)=>{let c=document.createElement("script");c.src=o,c.async=!0,e.integrity&&(c.integrity=e.integrity,c.crossOrigin="anonymous",z("Syntro Runtime","SRI integrity check enabled")),c.onload=()=>{z("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),z("Syntro Runtime","================================"),a()},c.onerror=u=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",u),console.error("[Syntro Runtime] URL attempted:",o),z("Syntro Runtime","================================"),Us=null,l(u)},document.head.appendChild(c),z("Syntro Runtime","Script tag appended to <head>")}),Us};var Ut=null;function Fv(r){Ut&&Ut!==r?r.appendChild(Ut):Ut=r;let e=r.getRootNode();e instanceof ShadowRoot&&hE(e)}function Dv(){return Ut||(Ut=document.createElement("div"),Ut.id="syntro-overlays",Object.assign(Ut.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(Ut)),Ut}var Lv=!1;function hE(r){if(Lv)return;let e=`
746
746
  :host {
747
747
  --syntro-surface: var(--sc-overlay-background, #0f1318);
748
748
  --syntro-fg: var(--sc-overlay-text-color, #cbd0d7);
@@ -1004,10 +1004,10 @@ Actions:`,b.map((O,q)=>` [${q}] ${O.kind} ${O.anchorId?`anchor="${O.anchorId.se
1004
1004
  .syntro-modal-btn-primary:hover {
1005
1005
  background: var(--syntro-accent-hover, #d44844);
1006
1006
  }
1007
- `,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),Ov=!0}var dl=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=Rv(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((y,x)=>`[${x}] ${y.kind}${y.anchorId?` anchor="${y.anchorId.selector}"`:""}${y.label?` "${y.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&&En(g.tiles,s.accumulator,g.actions)}catch(g){console.error("[SmartCanvas] Error fetching/applying initial config:",g)}e&&e();let l=ul();Ns();let c=document.createElement("smart-canvas");if(r.tokens)for(let[g,y]of Object.entries(r.tokens))c.style.setProperty(g,y);let u=r.integrations?.experiments,p=r.integrations?.telemetry,h=r.fetcher??wn({configUri:r.configUri,experiments:u,featureKey:r.configUriFeatureKey,credentials:r.fetchCredentials});n||(n=h);let f={fetcher:h,configUri:r.configUri,configUriFeatureKey:r.configUriFeatureKey,fetchCredentials:r.fetchCredentials,experiments:u,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 y=c.getOverlayContainer();y&&Pv(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),Mv(r.editorUrl).catch(console.error));let m={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:g=>{for(let[y,x]of Object.entries(g))c.style.setProperty(y,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(y=>{y?.tiles&&En(y.tiles,s.accumulator,y.actions)}).catch(()=>{})},registerTelemetryProperties:g=>{p?.register?.(g)},getSessionId:()=>p?.getSessionId?.(),startSessionRecording:()=>{p?.startSessionRecording?.()},track:(g,y)=>p?.track?(p.track(g,y),!0):!1,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 dl(r)}});var Gd="syn_";function xi(r){if(!r.startsWith(Gd))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(Gd.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 pl(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Gd+t}function bt(r){if(typeof process<"u"&&process.env)return process.env[r]}var Fv="syntro_segment_attributes";function Dv(){if(typeof window>"u")return{};try{let r=localStorage.getItem(Fv);if(r){let e=JSON.parse(r);return z("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){Je("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function Hv(r){if(!(typeof window>"u"))try{localStorage.setItem(Fv,JSON.stringify(r)),z("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){Je("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Bv(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 Kd(){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"}return r}var Lv="syntro_geo",Vv="https://geo.syntrologie.com";async function Yd(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(Lv);if(e){let t=JSON.parse(e);return z("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(Lv,JSON.stringify(n))}catch{}return z("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var Xd=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(/\/[^/]*$/,"");Xd=`${e.origin}${t}`}}catch{Xd=null}function jv(){return Xd}var Wv="app:",uE="syntro:",dE=/^[a-z][a-z0-9_]*$/;function hl(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(uE))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(Wv))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(Wv.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(!dE.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function pE(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Uv(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)&&!Uv(n,e,t+1))return!1;return!0}function fl(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(!Uv(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"||pE(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function gl(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 Ws=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:Te};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(gl(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=hl(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=fl(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:Te};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(gl(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=>gl(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=>gl(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 wi(r={}){return new Ws(r)}var ki=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 qv={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Zv(){return qv}function Jd(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 Us(r,e,t){return t===2?Jd(Jd(r+e)+"")%1e4/1e4:t===1?Jd(e+r)%1e3/1e3:null}function hE(r){return r<=0?[]:new Array(r).fill(1/r)}function ml(r,e){return r>=e[0]&&r<e[1]}function Gv(r,e){let t=Us("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Kv(r,e){for(let t=0;t<e.length;t++)if(ml(r,e[t]))return t;return-1}function ep(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function vl(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=mE(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 fE(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 gE(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=>!fE(i[0],i[1],i[2]))}catch{return!1}}function mE(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=ep(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return gE(n,t);return!1}catch{return!1}}function Yv(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=hE(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 Xv(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 Jv(r){try{return r()}catch(e){return console.error(e),!1}}var Qd=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function Mn(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||qv.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Qd(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Qd(i)},n,Qd(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function zs(r){return typeof r=="string"?r:JSON.stringify(r)}function ut(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 Qv(){let r;try{r="1.6.4"}catch{r=""}return r}function ey(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 zv(r){return typeof r=="object"&&r!==null}function yl(r){return r.urlPatterns&&r.variations.some(e=>zv(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>zv(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function _l(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 Ke={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},zt=Zv(),Si={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>zt.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 zt.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new zt.EventSource(`${r}/sub/${e}`,{headers:t}):new zt.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),_E()):document.visibilityState==="hidden"&&(r=window.setTimeout(yE,Ke.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(zt.localStorage=globalThis.localStorage)}catch{}var Ei=new Map,ty=!1,cr=new Map,bl=new Map,Ci=new Map,Ai=new Set;function ny(r){Object.assign(Ke,r),Ke.backgroundSync||op()}async function iy({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(Ke.backgroundSync=!1),bE({instance:r,allowStale:n,timeout:e,skipCache:t})}function vE(r){let e=qs(r),t=Ei.get(e)||new Set;t.add(r),Ei.set(e,t)}function sy(r){Ei.forEach(e=>e.delete(r))}function yE(){Ci.forEach(r=>{r&&(r.state="idle",ip(r))})}function _E(){Ci.forEach(r=>{r&&r.state==="idle"&&sp(r)})}async function ry(){try{if(!zt.localStorage)return;await zt.localStorage.setItem(Ke.cacheKey,JSON.stringify(Array.from(cr.entries())))}catch{}}async function bE({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=qs(r),s=rp(r),o=new Date,a=new Date(o.getTime()-Ke.maxAge+Ke.staleTTL);await xE();let l=!Ke.disableCache&&!n?cr.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Ai.add(i),l.staleAt<o?tp(r):np(r),{data:l.data,success:!0,source:"cache"}):await _l(tp(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function qs(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function rp(r){let e=qs(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 xE(){if(!ty){ty=!0;try{if(zt.localStorage){let r=await zt.localStorage.getItem(Ke.cacheKey);if(!Ke.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{cr.set(t,{...n,staleAt:new Date(n.staleAt)})}),oy()}}}catch{}if(!Ke.disableIdleStreams){let r=Si.startIdleListener();r&&(Si.stopIdleListener=r)}}}function oy(){let r=Array.from(cr.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,cr.size-Ke.maxEntries),cr.size);for(let t=0;t<e;t++)cr.delete(r[t].key)}function ay(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+Ke.staleTTL),s=Ke.disableCache?void 0:cr.get(e);if(s&&n&&s.version===n){s.staleAt=i,ry();return}Ke.disableCache||(cr.set(e,{data:t,version:n,staleAt:i,sse:Ai.has(r)}),oy()),ry();let o=Ei.get(r);o&&o.forEach(a=>wE(a,t))}async function wE(r,e){await r.setPayload(e||r.getPayload())}async function tp(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=qs(r),o=rp(r),a=bl.get(o);return a||(a=(i?Si.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Si.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"&&Ai.add(s),c.json()}).then(c=>(ay(s,o,c),np(r),bl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(bl.delete(o),{data:null,source:"error",success:!1,error:c})),bl.set(o,a)),a}function np(r,e=!1){let t=qs(r),n=rp(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Ai.add(t),Ke.backgroundSync&&Ai.has(t)&&zt.EventSource){if(Ci.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ei.get(t);c&&c.forEach(u=>{tp(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);ay(t,n,c)}a.errors=0}catch{ly(a)}},errors:0,state:"active"};Ci.set(t,a),sp(a)}}function ly(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);ip(r),setTimeout(()=>{["idle","active"].includes(r.state)||sp(r)},Math.min(e,3e5))}}function ip(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function sp(r){r.src=Si.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=()=>ly(r),r.src.onopen=()=>{r.errors=0}}function kE(r,e){ip(r),Ci.delete(e)}function op(){Ai.clear(),Ci.forEach(kE),Ei.clear(),Si.stopIdleListener()}function xl(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&np(r,!0),vE(r)}}var SE=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,cp={revert:function(){}},El=new Map,up=new Set;function EE(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function Cl(r){var e=El.get(r);return e||(e={element:r,attributes:{}},El.set(r,e)),e}function Al(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,EE(e)),o}function Rl(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,cy()):r!==t&&(e.isDirty=!0,cy())}function CE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Rl(BE(e),r)}function AE(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),Rl(Array.from(e).filter(Boolean).join(" "),r)}function RE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Rl(e,r)}function TE(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 IE(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=TE(n);e=i||e}),Rl(e,r)}var $E=function(e){return e.innerHTML},ME=function(e,t){return e.innerHTML=t};function dy(r){var e=Cl(r);return e.html||(e.html=Al(r,"html",$E,ME,CE)),e.html}var OE=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},PE=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function py(r){var e=Cl(r);return e.position||(e.position=Al(r,"position",OE,PE,IE)),e.position}var NE=function(e,t){return t?e.className=t:e.removeAttribute("class")},LE=function(e){return e.className};function hy(r){var e=Cl(r);return e.classes||(e.classes=Al(r,"class",LE,NE,AE)),e.classes}var FE=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},DE=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function fy(r,e){var t=Cl(r);return t.attributes[e]||(t.attributes[e]=Al(r,e,FE(e),DE(e),RE)),t.attributes[e]}function HE(r,e){var t=El.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,u,p;(c=t.attributes)==null||(u=c[e])==null||(p=u.observer)==null||p.disconnect(),delete t.attributes[e]}}var wl;function BE(r){return wl||(wl=document.createElement("div")),wl.innerHTML=r,wl.innerHTML}function kl(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||HE(r,e),t.setValue(r,n)}}function VE(r,e){r.html&&kl(e,"html",r.html),r.classes&&kl(e,"class",r.classes),r.position&&kl(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){kl(e,t,r.attributes[t])})}function cy(){El.forEach(VE)}function jE(r,e){var t=null;r.kind==="html"?t=dy(e):r.kind==="class"?t=hy(e):r.kind==="attribute"?t=fy(e,r.attribute):r.kind==="position"&&(t=py(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function WE(r,e){var t=null;if(r.kind==="html"?t=dy(e):r.kind==="class"?t=hy(e):r.kind==="attribute"?t=fy(e,r.attribute):r.kind==="position"&&(t=py(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function gy(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),jE(r,n))})}}function UE(r){r.elements.forEach(function(e){return WE(r,e)}),r.elements.clear(),up.delete(r)}function uy(){up.forEach(gy)}var ap;function zE(){typeof document>"u"||(ap||(ap=new MutationObserver(function(){uy()})),uy(),ap.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}zE();function Tl(r){return typeof document>"u"?cp:(up.add(r),gy(r),{revert:function(){UE(r)}})}function lp(r,e){return Tl({kind:"html",elements:new Set,mutate:e,selector:r})}function my(r,e){return Tl({kind:"position",elements:new Set,mutate:e,selector:r})}function Zs(r,e){return Tl({kind:"class",elements:new Set,mutate:e,selector:r})}function Sl(r,e,t){return SE.test(e)?e==="class"||e==="className"?Zs(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)})}):Tl({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):cp}function qE(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 lp(e,function(a){return a+(n??"")});if(t==="set")return lp(e,function(){return n??""})}else if(i==="class"){if(t==="append")return Zs(e,function(a){n&&a.add(n)});if(t==="remove")return Zs(e,function(a){n&&a.delete(n)});if(t==="set")return Zs(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return my(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return Sl(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return Sl(e,i,function(){return n??""});if(t==="remove")return Sl(e,i,function(){return null})}return cp}var ZE={html:lp,classes:Zs,attribute:Sl,position:my,declarative:qE},vy=ZE;var dp={};function Pr(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!by(r,i,t))return!1;break;case"$nor":if(by(r,i,t))return!1;break;case"$and":if(!JE(r,i,t))return!1;break;case"$not":if(Pr(r,i,t))return!1;break;default:if(!Gs(i,GE(r,n),t))return!1}return!0}function GE(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 yy(r,e=!1){let t=`${r}${e?"/i":""}`;return dp[t]||(dp[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),dp[t]}function Gs(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)||!xy(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!XE(i,e,r[i],t))return!1;return!0}function xy(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function KE(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 YE(r,e,t){if(!Array.isArray(r))return!1;let n=xy(e)?i=>Gs(e,i,t):i=>Pr(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function Ri(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 _y(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(Gs(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function XE(r,e,t,n){switch(r){case"$veq":return ut(e)===ut(t);case"$vne":return ut(e)!==ut(t);case"$vgt":return ut(e)>ut(t);case"$vgte":return ut(e)>=ut(t);case"$vlt":return ut(e)<ut(t);case"$vlte":return ut(e)<=ut(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)?Ri(e,t):!1;case"$ini":return Array.isArray(t)?Ri(e,t,!0):!1;case"$inGroup":return Ri(e,n[t]||[]);case"$notInGroup":return!Ri(e,n[t]||[]);case"$nin":return Array.isArray(t)?!Ri(e,t):!1;case"$nini":return Array.isArray(t)?!Ri(e,t,!0):!1;case"$not":return!Gs(t,e,n);case"$size":return Array.isArray(e)?Gs(t,e.length,n):!1;case"$elemMatch":return YE(e,t,n);case"$all":return Array.isArray(t)?_y(e,t,n):!1;case"$alli":return Array.isArray(t)?_y(e,t,n,!0):!1;case"$regex":try{return yy(t).test(e)}catch{return!1}case"$regexi":try{return yy(t,!0).test(e)}catch{return!1}case"$type":return KE(e)===t;default:return console.error("Unknown operator: "+r),!1}}function by(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(Pr(r,e[n],t))return!0;return!1}function JE(r,e,t){for(let n=0;n<e.length;n++)if(!Pr(r,e[n],t))return!1;return!0}var QE="Feature Evaluated",eC="Experiment Viewed";function tC(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 rC(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 Ti(r){try{await r()}catch{}}function wy(r,e,t){if(r.user.trackedExperiments){let i=Ml(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(Ti(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(Ti(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(Ti(()=>i(eC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function nC(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;Ti(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;Ti(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;Ti(()=>n(QE,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function Il(r,e){if(e.stack.evaluatedFeatures.has(r))return Nr(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=tC(e);if(t.has(r))return Nr(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return Nr(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=Il(l.id,e);if(c.source==="cyclicPrerequisite")return Nr(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!Pr(u,l.condition||{})){if(l.gate)return Nr(e,r,null,"prerequisite");continue e}}if(s.filters&&Ey(s.filters,e))continue;if("force"in s){if(s.condition&&!Sy(s.condition,e)||!iC(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=>{!wy(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Nr(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}=$l(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Nr(e,r,a.value,"experiment",s.id,o,a)}}return Nr(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function $l(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:Ce(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Ce(t,r,-1,!1,e)};if(r=sC(r,t),r.urlPatterns&&!vl(t.user.url||"",r.urlPatterns))return{result:Ce(t,r,-1,!1,e)};let s=Xv(n,t.user.url||"",i);if(s!==null)return{result:Ce(t,r,s,!1,e)};let o=rC(t);if(n in o){let g=o[n];return{result:Ce(t,r,g,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:Ce(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=On(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:Ce(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:g,versionIsBlocked:y}=lC({ctx:t,expKey:r.key,expBucketVersion:r.bucketVersion,expHashAttribute:r.hashAttribute,expFallbackAttribute:r.fallbackAttribute,expMinBucketVersion:r.minBucketVersion,expMeta:r.meta});u=g>=0,c=g,p=!!y}if(!u){if(r.filters){if(Ey(r.filters,t))return{result:Ce(t,r,-1,!1,e)}}else if(r.namespace&&!Gv(l,r.namespace))return{result:Ce(t,r,-1,!1,e)};if(r.include&&!Jv(r.include))return{result:Ce(t,r,-1,!1,e)};if(r.condition&&!Sy(r.condition,t))return{result:Ce(t,r,-1,!1,e)};if(r.parentConditions){let g=new Set(t.stack.evaluatedFeatures);for(let y of r.parentConditions){t.stack.evaluatedFeatures=new Set(g);let x=Il(y.id,t);if(x.source==="cyclicPrerequisite")return{result:Ce(t,r,-1,!1,e)};let k={value:x.value};if(!Pr(k,y.condition||{}))return{result:Ce(t,r,-1,!1,e)}}}if(r.groups&&!aC(r.groups,t))return{result:Ce(t,r,-1,!1,e)}}if(r.url&&!oC(r.url,t))return{result:Ce(t,r,-1,!1,e)};let h=Us(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:Ce(t,r,-1,!1,e)};if(!u){let g=r.ranges||Yv(i,r.coverage===void 0?1:r.coverage,r.weights);c=Kv(h,g)}if(p)return{result:Ce(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:Ce(t,r,-1,!1,e)};if("force"in r)return{result:Ce(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Ce(t,r,-1,!1,e)};if(r.status==="stopped")return{result:Ce(t,r,-1,!1,e)};let f=Ce(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:g,key:y,doc:x}=uC(t,a,zs(l),{[pp(r.key,r.bucketVersion)]:f.key});g&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=wy(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 Nr(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"&&nC(r,e,a),a}function ky(r){return{...r.user.attributes,...r.user.attributeOverrides}}function Sy(r,e){return Pr(ky(e),r,e.global.savedGroups||{})}function Ey(r,e){return r.some(t=>{let{hashValue:n}=On(e,t.attribute);if(!n)return!0;let i=Us(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>ml(i,s))})}function iC(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=On(r,t,n);if(!a)return!1;let l=Us(e,a,o||1);return l===null?!1:i?ml(l,i):s!==void 0?l<=s:!0}function Ce(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}=On(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},p={key:u.key||""+t,featureId:i,inExperiment:a,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return u.name&&(p.name=u.name),s!==void 0&&(p.bucket=s),u.passthrough&&(p.passthrough=u.passthrough),p}function sC(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=ep(r.url))),r}function On(r,e,t){let n=e||"id",i="",s=ky(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function oC(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 aC(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function lC({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=pp(e,t),l=cC(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=pp(e,p);if(l[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let c=l[a];if(c===void 0)return{variation:-1};let u=o.findIndex(p=>p.key===c);return u<0?{variation:-1}:{variation:u}}function pp(r,e){return e=e||0,`${r}__${e}`}function hp(r,e){return`${r}||${e}`}function cC(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=On(r,e),s=hp(n,zs(i)),{hashAttribute:o,hashValue:a}=On(r,t),l=a?hp(o,zs(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 uC(r,e,t,n){let i=hp(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 dC(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 Cy(r,e,t){let n=fp(r,t);return e.getAllAssignments(n)}function fp(r,e){let t={};return dC(r,e).forEach(i=>{let{hashValue:s}=On(r,i);t[i]=zs(s)}),t}async function Ay(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await Mn(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await Mn(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await Mn(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function Ry(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 Ml(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var Ii=typeof window<"u"&&typeof document<"u",pC=Qv(),Ks=class{constructor(e){if(e=e||{},this.version=pC,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),Ii&&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 Ay(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,xl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&ny(e.cacheSettings),e.payload)return await this.setPayload(e.payload),xl(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return xl(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 Ry(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 iy({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 Mn(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 Mn(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,sy(this),e.destroyAllStreams&&op(),this.logs=[],Ii&&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}=$l(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=Ce(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=$l(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=yl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?ey(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(vl(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:u,delay:p}=this._getNavigateFunction();if(u)if(Ii)Promise.all([...o?[_l(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??p))]).then(()=>{try{u(c)}catch(h){console.error(h)}});else try{u(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&&yl(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 Il(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=>[Ml(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(Ml(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Ii?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=yl(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}:Ii?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Ii)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(vy.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await Cy(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=fp(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var hC="https://experiment.syntrologie.com",gp=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 Ks({...e,apiHost:e.apiHost??hC,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 Ol(r={}){return new gp(r)}var Ty={growthbook:r=>Ol({...r,autoInit:!0})};function Iy(r,e){let t=Ty[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(Ty).join(", ")}`);return t(e)}var fC=["cdn.syntrologie.com","localhost","127.0.0.1"];function gC(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):fC.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 mp=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!gC(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 mC(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 mC(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 $y(r){return new mp(r)}var vC="syntro_exp",yC="syntro_var",vp=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(vC),o=i.get(yC);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:qa(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 My(r){return new vp(r)}var _C="https://cdn.syntrologie.com/configs",Oy={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return $y({baseUrl:r.baseUrl??_C,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return My({featureKey:r.featureKey})}};function Py(r,e={}){let t=Oy[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(Oy).join(", ")}`);return t(e)}var Ny="syntro_session_metrics",Ys=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(Ny);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(Ny,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Pl(r={}){return new Ys(r)}var Nl=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 Ll=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 Nl(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 bC=[()=>new Ll];function Ly(){for(let r of bC){let e=r();if(e.detect())return e}return null}var yp="syntro_experiments";var wC=720*60*60,Fl=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}destroy(){document.cookie=`${yp}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`}writeCookie(){let e={version:1,distinct_id:this.context.distinctId,telemetry_host:this.context.telemetryHost,telemetry_key:this.context.telemetryKey},t=encodeURIComponent(JSON.stringify(e)),n=`${yp}=${t}; max-age=${wC}; path=/; SameSite=Lax`;document.cookie=n}};function kC(){let r=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:r,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function _p(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(Fy(t,n))return}if(e.include){for(let n of e.include)if(Fy(t,n))return n;return}return t}function Fy(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 Xs=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=kC(),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=_p(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=_p(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}})}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};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,{title:t}=document,n=_p(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 Dl(r){return new Xs(r)}function bp(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 xp(r,e){let t=[];for(let n of r.conditions){let i=bp(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Js(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=xp(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 Qs(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 Dy(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 wp(r,e,t={}){let n=Dy(e,t);switch(r.type){case"rules":return Js(r,n);case"score":return Qs(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 kp(r,e,t={}){let n=Dy(e,t);switch(r.type){case"rules":return Js(r,n);case"score":return Qs(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 Hl(r){return{evaluate:(e,t)=>wp(e,t,r),evaluateSync:(e,t)=>kp(e,t,r)}}function Bl(r){let{eventBus:e,stateStore:t}=r,n=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let u=!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),u=!0}if(u)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,u,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:u}),l()},getCount(c,u){let p=`ev:${c}`,h=o.get(p);if(!h)return 0;if(u===void 0||!h.timestamps)return h.count;let f=Date.now()-u;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 $i=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 Sp="cooldown:";function Hy(r){return{set(e,t){let n=Sp+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Sp+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=Sp+e;r.remove(t)}}}var eo="dismissed:";function By(r,e){return{mark(t,n=!1){let i=eo+t;(n?e:r).set(i,!0)},isDismissed(t){let n=eo+t;return r.has(n)||e.has(n)},clear(t){let n=eo+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(eo)&&r.remove(t);for(let t of e.keys())t.startsWith(eo)&&e.remove(t)}}}var Ep="freq:";function Vy(r){function e(t){let n=Ep+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=Ep+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=Ep+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var SC="syntro";function Cp(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 to(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 ro=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??SC;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?Cp(window.sessionStorage,this.namespace):to(this.namespace),this.user=t(window.localStorage)?Cp(window.localStorage,this.namespace):to(this.namespace)):(this.session=to(this.namespace),this.user=to(this.namespace)),this.dismissals=By(this.session,this.user),this.cooldowns=Hy(this.user),this.frequency=Vy(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?Cp(sessionStorage,t):to(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function Vl(r={}){return new ro(r)}function Mi(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function no(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var Ap={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"}},Oi={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:[]},jy={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function jl(r,e,t){let n=Ap[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 Wl(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Ko(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Xo()),t.shift!==!1&&i.push(Yo({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Go(e,r,async()=>{let{x:o,y:a,strategy:l}=await Jo(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function Ul(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 zl(r,e){return e==="none"||Oi[e].length===0?null:r.animate(Oi[e],jy)}function ql(r,e){if(e==="none"||Oi[e].length===0)return Promise.resolve();let t=[...Oi[e]].reverse(),n=r.animate(t,jy);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Zl(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 Gl(r){switch(Mi(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 Wy(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 u=c.name.toLowerCase(),p=c.value.trim().toLowerCase(),h=u.startsWith("on"),f=(u==="href"||u==="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 EC=0;function Kl(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-${++EC}`}function u(_,w){t&&t.publish(_,w)}function p(_){let w=l.get(_);if(w){let R=g(_);for(let b of w)try{b(R)}catch(A){console.error("[Surfaces] State callback error:",A)}}}let h=new Map;function f(_,w,R){switch(w.type){case"html":_.innerHTML=Wy(w.content);return;case"widget":{if(s?.has(w.widgetId)){let b=s.mount(w.widgetId,_,w.config);return R&&h.set(R,b),()=>{b.unmount(),R&&h.delete(R)}}console.warn(`[Surfaces] Widget not found: ${w.widgetId}`),_.innerHTML=`<div data-widget-id="${w.widgetId}" data-widget-missing="true">Widget: ${w.widgetId}</div>`;return}case"custom":return w.mount(_);case"react":_.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(_,w,R){let b=c(),A=Mi(_),$=R?.priority??0,N=R?.animation??i,M=R?.exclusive??!0,K=o.get(_);if(K&&M){if(K.options.priority>$)throw new Error(`Slot ${_} is occupied by higher priority content (${K.options.priority} > ${$})`);m(K)}let L=Zl(_,b);L.style.zIndex=String(Gl(_));let O;if(A==="static")jl(L,_,R?.constraints),e.appendChild(L);else if(A==="inline"){let C=no(_);if(!C)throw new Error(`Invalid inline slot: ${_}`);if(!n)throw new Error("Anchor resolver required for inline slots");let P=n({selector:C,route:"**"});if(!P)throw new Error(`Anchor not found for inline slot: ${C}`);O=Ul(L,P)}else if(A==="adjacent"){let C=no(_);if(!C)throw new Error(`Invalid adjacent slot: ${_}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let P=n({selector:C,route:"**"});if(!P)throw new Error(`Anchor not found for adjacent slot: ${C}`);e.appendChild(L),O=Wl(L,P,R?.position??{placement:"bottom"})}let q=f(L,w,b);zl(L,N);let Y={id:b,slot:_,content:w,options:{priority:$,exclusive:M,animation:N,position:R?.position??{placement:"auto"},constraints:R?.constraints??{},adaptiveId:R?.adaptiveId,autoUnmountOnRouteChange:R?.autoUnmountOnRouteChange??!0},container:L,cleanup:()=>{O?.(),q?.()},mountedAt:Date.now()};return o.set(_,Y),a.set(_,(a.get(_)??0)+1),u("surface.mounted",{slot:_,id:b,adaptiveId:R?.adaptiveId}),p(_),{id:b,update(C){let P=o.get(_);if(!P||P.id!==b)throw new Error("Mount no longer active");let G=h.get(b);if(G){if(C.type==="widget"){G.update(C.config),P.content=C;return}G.unmount(),h.delete(b)}P.container.innerHTML="";let pe=f(P.container,C,b);if(P.content=C,pe){let ce=P.cleanup;P.cleanup=()=>{ce?.(),pe()}}},setOptions(C){let P=o.get(_);if(!P||P.id!==b)throw new Error("Mount no longer active");C.priority!==void 0&&(P.options.priority=C.priority),C.animation!==void 0&&(P.options.animation=C.animation),C.constraints&&A==="static"&&(C.constraints.maxWidth&&(P.container.style.maxWidth=C.constraints.maxWidth),C.constraints.maxHeight&&(P.container.style.maxHeight=C.constraints.maxHeight),C.constraints.minWidth&&(P.container.style.minWidth=C.constraints.minWidth),C.constraints.minHeight&&(P.container.style.minHeight=C.constraints.minHeight)),p(_)},async unmount(){let C=o.get(_);!C||C.id!==b||await m(C)},isMounted(){return o.get(_)?.id===b},getContainer(){let C=o.get(_);return C?.id===b?C.container:null}}}async function m(_){_.container.isConnected&&await ql(_.container,_.options.animation);try{_.cleanup?.()}catch(w){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",w)}try{_.container.remove()}catch{}o.delete(_.slot),u("surface.unmounted",{slot:_.slot,id:_.id}),p(_.slot)}function g(_){let w=o.get(_);return{slot:_,occupied:!!w,currentPriority:w?.options.priority,currentAdaptiveId:w?.options.adaptiveId,mountCount:a.get(_)??0,currentMountId:w?.id}}function y(_,w){let R=l.get(_);return R||(R=new Set,l.set(_,R)),R.add(w),()=>{R?.delete(w),R?.size===0&&l.delete(_)}}function x(_,w){let R=o.get(_);return R?w!==void 0?w>=R.options.priority:!1:!0}function k(){for(let _ of o.values())try{_.cleanup?.(),_.container.remove()}catch(w){console.error("[Surfaces] Error during cleanup:",w)}o.clear(),l.clear()}return{mount:v,getState:g,onStateChange:y,canMount:x,destroy:k}}var io=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 u=this.mountedWidgets.get(s);if(u){u.cleanup?.(),t.innerHTML="";let p={...c,runtime:this.runtimeRef},h=i.widget.mount(t,p);u.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()}},Yl=new io;var Tp="2.0.0";function CC(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(Rp(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(Rp(n,i))return!0;return!1}return!0}function Rp(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 Uy(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 Rp(t,s)})}function Xl(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??Yl,a=r.executors??Wt,l=r.apps??ys,c=new $i,u=Dl({telemetry:e,routes:n,navigation:c}),p=r.events??wi(),h=Vl({namespace:s}),f=Bl({eventBus:p,stateStore:h}),v=Hl({state:h,events:p,sessionMetrics:t,accumulator:f}),m=Nv(),g=al(),y=M=>Uy(M)?g.resolve(M.selector):null,x=async(M,K)=>{if(!Uy(M))return null;try{return await g.waitFor(M.selector,K)}catch{return null}},k=Kl({overlayRoot:m,eventBus:p,anchorResolver:y,widgetRegistry:o}),_=il({overlayRoot:m,eventBus:p,surfaces:k,anchorResolver:y,waitForAnchor:x,executorRegistry:a,subscribeNavigation:M=>c.subscribe(M),runtime:{evaluateSync:M=>v.evaluateSync(M,u.get()),context:u,accumulator:f,sessionMetrics:t,events:p?{subscribe:M=>p.subscribe(()=>M())}:void 0}}),w;if(t){let M=t;M.increment("page_views");let K=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((L,O)=>{if(O!=="replaceState")try{let q=new URL(L).pathname;q!==K&&(K=q,M.increment("page_views"),R=0,M.set("time_on_page",0),M.set("scroll_depth",0))}catch{}})}let R=0,b,A;if(t){let M=t;b=setInterval(()=>{R++},1e3),A=setInterval(()=>{M.set("time_on_page",R)},5e3)}let $;if(t&&p){let M=t;$=p.subscribe({names:["ui.scroll"]},K=>{let L=K.props?.scrollPercentage;typeof L=="number"&&L>M.get("scroll_depth")&&M.set("scroll_depth",L)})}let N={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:_,surfaces:k,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:g,navigation:c,version:Tp,mode:i,async evaluate(M){return v.evaluate(M,u.get())},evaluateSync(M){return v.evaluateSync(M,u.get())},async filterTiles(M){let K=u.get().page.url,L=[];for(let O of M){let q=O.activation;if(!q){L.push(O);continue}if(CC(K,q.routes)){if(q.onlyIfPopulated){let Y=O.props?.actions??[];if(Y.length>0&&!Y.some(C=>C.triggerWhen?v.evaluateSync(C.triggerWhen,u.get()).value:!0))continue}L.push(O)}}return L},setRoutes(M){u.setRoutes(M)},destroy(){l.unbind().catch(M=>{console.error("[Runtime] Error unbinding apps registry:",M)}),w?.(),$?.(),b&&clearInterval(b),A&&clearInterval(A),g.destroy(),f.destroy(),c.destroy(),u.destroy(),_.destroy(),k.destroy()}};return l.bind(N),o.bindRuntime(N),N}var Pi=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 AC(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var Ip=class{constructor(){this.sessionId=AC(),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){}};function Jl(){return new Ip}var E=typeof window<"u"?window:void 0,Ze=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Ze.self=Ze),typeof File>"u"&&(Ze.File=function(){});var B_=Array.prototype,zy=B_.forEach,qy=B_.indexOf,pt=Ze?.navigator,D=Ze?.document,qe=Ze?.location,Gp=Ze?.fetch,Kp=Ze!=null&&Ze.XMLHttpRequest&&"withCredentials"in new Ze.XMLHttpRequest?Ze.XMLHttpRequest:void 0,Zy=Ze?.AbortController,st=pt?.userAgent,X=E??{},pr={DEBUG:!1,LIB_VERSION:"1.341.0"};function Gy(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 Hi(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){Gy(s,n,i,o,a,"next",l)}function a(l){Gy(s,n,i,o,a,"throw",l)}o(void 0)}))}}function V(){return V=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},V.apply(null,arguments)}function V_(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 RC=["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"],Ky=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return RC.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},TC=["$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 le(r,e){return r.indexOf(e)!==-1}var Rc=function(r){return r.trim()},Yp=function(r){return r.replace(/^\$/,"")},IC=Array.isArray,j_=Object.prototype,W_=j_.hasOwnProperty,Tc=j_.toString,fe=IC||function(r){return Tc.call(r)==="[object Array]"},Vr=r=>typeof r=="function",Pe=r=>r===Object(r)&&!fe(r),Bi=r=>{if(Pe(r)){for(var e in r)if(W_.call(r,e))return!1;return!0}return!1},H=r=>r===void 0,Ne=r=>Tc.call(r)=="[object String]",Xp=r=>Ne(r)&&r.trim().length===0,Lt=r=>r===null,ue=r=>H(r)||Lt(r),yr=r=>Tc.call(r)=="[object Number]"&&r==r,Fi=r=>yr(r)&&r>0,vr=r=>Tc.call(r)==="[object Boolean]",$C=r=>r instanceof FormData,MC=r=>le(TC,r);function Jp(r){return r===null||typeof r!="object"}function oc(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function U_(r){return!H(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var OC=[!0,"true",1,"1","yes"],$p=r=>le(OC,r),PC=[!1,"false",0,"0","no"];function Zt(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),yr(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),Zt(i||t,e,t,n))}var Qp=class{constructor(e){this.t={},this.i=e.i,this.o=Zt(e.bucketSize,0,100,e.h),this.m=Zt(e.refillRate,0,this.o,e.h),this.$=Zt(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={}}},xt="Mobile",ac="iOS",mr="Android",Co="Tablet",z_=mr+" "+Co,q_="iPad",Z_="Apple",G_=Z_+" Watch",Ao="Safari",Ui="BlackBerry",K_="Samsung",Y_=K_+"Browser",X_=K_+" Internet",Fn="Chrome",NC=Fn+" OS",J_=Fn+" "+ac,lf="Internet Explorer",Q_=lf+" "+xt,cf="Opera",LC=cf+" Mini",uf="Edge",eb="Microsoft "+uf,ji="Firefox",tb=ji+" "+ac,Ro="Nintendo",To="PlayStation",Wi="Xbox",rb=mr+" "+xt,nb=xt+" "+Ao,go="Windows",eh=go+" Phone",Yy="Nokia",th="Ouya",ib="Generic",FC=ib+" "+xt.toLowerCase(),sb=ib+" "+Co.toLowerCase(),rh="Konqueror",Qe="(\\d+(\\.\\d+)?)",Mp=new RegExp("Version/"+Qe),DC=new RegExp(Wi,"i"),HC=new RegExp(To+" \\w+","i"),BC=new RegExp(Ro+" \\w+","i"),df=new RegExp(Ui+"|PlayBook|BB10","i"),VC={"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"},Ql,Xy,Op,jC=(r,e)=>e&&le(e,Z_)||(function(t){return le(t,Ao)&&!le(t,Fn)&&!le(t,mr)})(r),ob=function(r,e){return e=e||"",le(r," OPR/")&&le(r,"Mini")?LC:le(r," OPR/")?cf:df.test(r)?Ui:le(r,"IE"+xt)||le(r,"WPDesktop")?Q_:le(r,Y_)?X_:le(r,uf)||le(r,"Edg/")?eb:le(r,"FBIOS")?"Facebook "+xt:le(r,"UCWEB")||le(r,"UCBrowser")?"UC Browser":le(r,"CriOS")?J_:le(r,"CrMo")||le(r,Fn)?Fn:le(r,mr)&&le(r,Ao)?rb:le(r,"FxiOS")?tb:le(r.toLowerCase(),rh.toLowerCase())?rh:jC(r,e)?le(r,xt)?nb:Ao:le(r,ji)?ji:le(r,"MSIE")||le(r,"Trident/")?lf:le(r,"Gecko")?ji:""},WC={[Q_]:[new RegExp("rv:"+Qe)],[eb]:[new RegExp(uf+"?\\/"+Qe)],[Fn]:[new RegExp("("+Fn+"|CrMo)\\/"+Qe)],[J_]:[new RegExp("CriOS\\/"+Qe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qe)],[Ao]:[Mp],[nb]:[Mp],[cf]:[new RegExp("(Opera|OPR)\\/"+Qe)],[ji]:[new RegExp(ji+"\\/"+Qe)],[tb]:[new RegExp("FxiOS\\/"+Qe)],[rh]:[new RegExp("Konqueror[:/]?"+Qe,"i")],[Ui]:[new RegExp(Ui+" "+Qe),Mp],[rb]:[new RegExp("android\\s"+Qe,"i")],[X_]:[new RegExp(Y_+"\\/"+Qe)],[lf]:[new RegExp("(rv:|MSIE )"+Qe)],Mozilla:[new RegExp("rv:"+Qe)]},UC=function(r,e){var t=ob(r,e),n=WC[t];if(H(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},Jy=[[new RegExp(Wi+"; "+Wi+" (.*?)[);]","i"),r=>[Wi,r&&r[1]||""]],[new RegExp(Ro,"i"),[Ro,""]],[new RegExp(To,"i"),[To,""]],[df,[Ui,""]],[new RegExp(go,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[eh,""];if(new RegExp(xt).test(e)&&!/IEMobile\b/.test(e))return[go+" "+xt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=VC[n]||"";return/arm/i.test(e)&&(i="RT"),[go,i]}return[go,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[ac,e.join(".")]}return[ac,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=H(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+mr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+mr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[mr,e.join(".")]}return[mr,""]}],[/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/,[NC,""]],[/Linux|debian/i,["Linux",""]]],Qy=function(r){return BC.test(r)?Ro:HC.test(r)?To:DC.test(r)?Wi:new RegExp(th,"i").test(r)?th:new RegExp("("+eh+"|WPDesktop)","i").test(r)?eh:/iPad/.test(r)?q_:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?G_:df.test(r)?Ui:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Yy,"i").test(r)?Yy:/(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(xt).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)?mr:z_:new RegExp("(pda|"+xt+")","i").test(r)?FC:new RegExp(Co,"i").test(r)&&!new RegExp(Co+" pc","i").test(r)?sb:""},zC=r=>r instanceof Error;function qC(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Op&&t.length===Xy||(Xy=t.length,Op=t.reduce(((n,i)=>{Ql||(Ql={});var s=Ql[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,u=e[i];if(c&&u){n[c]=u,Ql[i]=[c,u];break}}return n}),{})),Op}}var nh=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 Hi((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&fe(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)),V({},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 Hi((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,V({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:qC(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 V({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},zi="?";function ih(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?zi:t,in_app:!0};return H(n)||(s.lineno=n),H(i)||(s.colno=i),s}var ab=(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]:zi,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},ZC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,GC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,KC=/\((\S*)(?::(\d+))(?::(\d+))\)/,YC=(r,e)=>{var t=ZC.exec(r);if(t){var[,n,i,s]=t;return ih(e,n,zi,+i,+s)}var o=GC.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=KC.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=ab(o[1]||zi,o[2]);return ih(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},XC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,JC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,QC=(r,e)=>{var t=XC.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=JC.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]||zi;return[s,i]=ab(s,i),ih(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},e_=/\(error: (.*)\)/,t_=50;function e1(){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(`
1008
- `),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=e_.test(c)?c.replace(e_,"$1"):c;if(!u.match(/\S*Error: /)){for(var p of t){var h=p(u,r);if(h){o.push(h);break}}if(o.length>=t_)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,t_).map((m=>{return V({},m,{filename:m.filename||(g=v,g[g.length-1]||{}).filename,function:m.function||zi});var g}))})(o)}})("web:javascript",YC,QC)}var sh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Ne(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 oc(e,"DOMException")}isDOMError(e){return oc(e,"DOMError")}},oh=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}},ah=class{constructor(){}match(e){return oc(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}}},t1=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,lh=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(t1);return i&&(t=i[1],n=i[2]),[t,n]}},r1=["fatal","error","warning","log","info","debug"];function lb(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 ch=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 U_(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: "+lb(e)}isSeverityLevel(e){return Ne(e)&&!Xp(e)&&r1.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(zC(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},uh=class{match(e){return U_(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+lb(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},dh=class{match(e){return Jp(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}}},ph=class{match(e){return oc(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Jp(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(Jp(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}},cb=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(pr.DEBUG||X.POSTHOG_DEBUG||t)&&!H(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)=>cb(r+" "+i,s)};return n},B=cb("[PostHog.js]"),Ie=B.createLogger,n1=Ie("[ExternalScriptsLoader]"),r_=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return n1.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=D?.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(!D)return t("document not found");var l=D.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")D.head.appendChild(l);else{var c,u=D.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):D.body.appendChild(l)}};D!=null&&D.body?a():D?.addEventListener("DOMContentLoaded",a)};X.__PosthogExtensions__=X.__PosthogExtensions__||{},X.__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);r_(r,s,t)},X.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);r_(r,n,t)};var lc={};function jr(r,e,t){if(fe(r)){if(zy&&r.forEach===zy)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)===lc)return}}}function xe(r,e,t){if(!ue(r)){if(fe(r))return jr(r,e,t);if($C(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===lc)return}else for(var i in r)if(W_.call(r,i)&&e.call(t,r[i],i)===lc)return}}var $e=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 jr(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},Zi=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 jr(t,(function(i){jr(i,(function(s){r.push(s)}))})),r};function ic(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 n_=function(r){try{return r()}catch{return}},i1=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){B.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),B.critical(i)}}},pf=function(r){var e={};return xe(r,(function(t,n){(Ne(t)&&t.length>0||yr(t))&&(e[n]=t)})),e};function s1(r,e){return t=r,n=s=>Ne(s)&&!Lt(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),fe(o)?(l=[],jr(o,(c=>{l.push(s(c))}))):(l={},xe(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var o1=["herokuapp.com","vercel.app","netlify.app"];function a1(r){var e=r?.hostname;if(!Ne(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of o1)if(t===n)return!1;return!0}function ub(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Oe(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var db="$people_distinct_id",mo="__alias",vo="__timers",i_="$autocapture_disabled_server_side",hh="$heatmaps_enabled_server_side",s_="$exception_capture_enabled_server_side",fh="$error_tracking_suppression_rules",o_="$error_tracking_capture_extension_exceptions",a_="$web_vitals_enabled_server_side",pb="$dead_clicks_enabled_server_side",l_="$product_tours_enabled_server_side",c_="$web_vitals_allowed_metrics",Pp="$session_recording_remote_config",cc="$sesid",hb="$session_is_sampled",Vi="$enabled_feature_flags",yo="$early_access_features",gh="$feature_flag_details",_o="$stored_person_properties",Ln="$stored_group_properties",mh="$surveys",uc="$flag_call_reported",hr="$user_state",vh="$client_session_props",yh="$capture_rate_limit",_h="$initial_campaign_params",bh="$initial_referrer_info",dc="$initial_person_info",pc="$epp",fb="__POSTHOG_TOOLBAR__",so="$posthog_cookieless",l1=[db,mo,"__cmpns",vo,"$session_recording_enabled_server_side",hh,cc,Vi,fh,hr,yo,gh,Ln,_o,mh,uc,vh,yh,_h,bh,pc,dc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function u_(r){return r instanceof Element&&(r.id===fb||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Ic(r){return!!r&&r.nodeType===1}function Wr(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function gb(r){return!!r&&r.nodeType===3}function mb(r){return!!r&&r.nodeType===11}function hf(r){return r?Rc(r).split(/\s+/):[]}function d_(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function hc(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 hf(e)}function vb(r){return ue(r)?null:Rc(r).split(/(\s+)/).filter((e=>Io(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Mo(r){var e="";return xh(r)&&!wb(r)&&r.childNodes&&r.childNodes.length&&xe(r.childNodes,(function(t){var n;gb(t)&&t.textContent&&(e+=(n=vb(t.textContent))!==null&&n!==void 0?n:"")})),Rc(e)}function yb(r){return H(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var ff=["a","button","form","input","select","textarea","label"];function _b(r,e){if(H(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 bb(r){var e=r.parentNode;return!(!e||!Ic(e))&&e}var c1=["next","previous","prev",">","<"],p_=10,h_=[".ph-no-rageclick",".ph-no-capture"];function u1(r,e){if(!E||gf(r))return!1;var t,n,i;if(vr(e)?(t=!!e&&h_,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:h_,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=xb(r,!1);return!(function(o,a){if(o===!1||H(o))return!1;var l;if(o===!0)l=c1;else{if(!fe(o))return!1;if(o.length>p_)return B.error("[PostHog] content_ignorelist array cannot exceed "+p_+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:p}=c;return l.some((h=>u.includes(h)||p.includes(h)))}))})(n,s.map((o=>{var a;return{safeText:Mo(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!_b(s,t)}var gf=r=>!r||Wr(r,"html")||!Ic(r),xb=(r,e)=>{if(!E||gf(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!Wr(i,"body");)if(mb(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=bb(i);if(!s)break;if(e||ff.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 d1(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||gf(r)||(s=t)!=null&&s.url_allowlist&&!d_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&d_(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:u,targetElementList:p}=xb(r,n);if(!(function(v,m){var g=m?.element_allowlist;if(H(g))return!0;var y,x=function(_){if(g.some((w=>_.tagName.toLowerCase()===w)))return{v:!0}};for(var k of v)if(y=x(k))return y.v;return!1})(p,t)||!_b(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 u?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(ff.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function xh(r){for(var e=r;e.parentNode&&!Wr(e,"body");e=e.parentNode){var t=hc(e);if(le(t,"ph-sensitive")||le(t,"ph-no-capture"))return!1}if(le(hc(r),"ph-include"))return!0;var n=r.type||"";if(Ne(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(Ne(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 wb(r){return!!(Wr(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Wr(r,"select")||Wr(r,"textarea")||r.getAttribute("contenteditable")==="true")}var kb="(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})",p1=new RegExp("^(?:"+kb+")$"),h1=new RegExp(kb),Sb="\\d{3}-?\\d{2}-?\\d{4}",f1=new RegExp("^("+Sb+")$"),g1=new RegExp("("+Sb+")");function Io(r,e){return e===void 0&&(e=!0),!(ue(r)||Ne(r)&&(r=Rc(r),(e?p1:h1).test((r||"").replace(/[- ]/g,""))||(e?f1:g1).test(r)))}function Eb(r){var e=Mo(r);return Io(e=(e+" "+Cb(r)).trim())?e:""}function Cb(r){var e="";return r&&r.childNodes&&r.childNodes.length&&xe(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=Mo(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Cb(t)).trim())}catch(s){B.error("[AutoCapture]",s)}})),e}function m1(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=V({},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 ic(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[f_(p.toString())]=f_(h.toString())})),o+=":",o+=ic(c).map((u=>{var[p,h]=u;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:v1(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ic(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 f_(r){return r.replace(/"|\\"/g,'\\"')}function v1(r){var e=r.attr__class;return e?fe(e)?e:hf(e):void 0}var fc=class{constructor(e){this.disabled=e===!1;var t=Pe(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}},gc=r=>{var e=D?.createElement("a");return H(e)?null:(e.href=r,e)},y1=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return xe(r,(function(s,o){H(s)||H(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)},mc=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(!fe(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{B.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Oo=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("&"),u=[],p=0;p<c.length;p++){var h=c[p].split("=");fe(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(c[p]))}var f=l;return a!=null&&(f+="?"+u.join("&")),s!=null&&(f+="#"+s),f},vc=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Np="$copy_autocapture",g_=Ie("[AutoCapture]");function Lp(r,e){return e.length>r?e.slice(0,r)+"...":e}function _1(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Ic(e));return e}function b1(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};ff.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Lp(1024,Eb(r)):s.$el_text=Lp(1024,Mo(r)));var o=hc(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),xe(r.attributes,(function(u){var p;if((!wb(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&Io(u.value)&&(p=u.name,!Ne(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=hf(h).join(" ")),s["attr__"+u.name]=Lp(1024,h)}}));for(var a=1,l=1,c=r;c=_1(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function x1(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Wr(u,"body");)mb(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var p,h=[],f={},v=!1,m=!1;if(xe(c,(_=>{var w=xh(_);_.tagName.toLowerCase()==="a"&&(v=_.getAttribute("href"),v=w&&v&&Io(v)&&v),le(hc(_),"ph-no-capture")&&(m=!0),h.push(b1(_,s,o,a));var R=(function(b){if(!xh(b))return{};var A={};return xe(b.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var N=$.name.replace("data-ph-capture-attribute-",""),M=$.value;N&&M&&Io(M)&&(A[N]=M)}})),A})(_);$e(f,R)})),m)return{props:{},explicitNoCapture:m};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Eb(r):h[0].$el_text=Mo(r)),v){var g,y;h[0].attr__href=v;var x=(g=gc(v))==null?void 0:g.host,k=E==null||(y=E.location)==null?void 0:y.host;x&&k&&x!==k&&(p=v)}return{props:$e({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:m1(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 wh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new fc(e.config.rageclick),this.C=null}get R(){var e,t,n=Pe(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&&D){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){g_.error("Failed to capture event",i)}};if(Oe(D,"submit",e,{capture:!0}),Oe(D,"change",e,{capture:!0}),Oe(D,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,Np)};Oe(D,"copy",t,{capture:!0}),Oe(D,"cut",t,{capture:!0})}}}else g_.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({[i_]:!!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=D?.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[i_],i=this.T;if(Lt(i)&&!vr(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=yb(e);gb(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())&&u1(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===Np;if(i&&d1(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=x1(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===Np){var c,u=vb(E==null||(c=E.getSelection())==null?void 0:c.toString()),p=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=p}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Vr(D?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return yr(r)&&isFinite(r)&&Math.floor(r)===r});var m_="0123456789abcdef",kh=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+m_.charAt(this.bytes[t]>>>4)+m_.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}},Sh=class{constructor(){this.A=0,this.j=0,this.D=new Eh}generate(){var e=this.generateOrAbort();if(H(e)){this.A=0;var t=this.generateOrAbort();if(H(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 kh.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())}},v_,Ab=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&&!H(E.crypto)&&crypto.getRandomValues&&(Ab=r=>crypto.getRandomValues(r));var Eh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Ab(this.N),this.U=0),this.N[this.U++]}},Br=()=>w1().toString(),w1=()=>(v_||(v_=new Sh)).generate(),oo="",k1=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function S1(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=D),oo)return oo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Br();!oo&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";s.cookie=u+";max-age=3",s.cookie.includes(l)&&(s.cookie=u+";max-age=0",oo=c)}return oo})(r);if(!t){var n=(i=>{var s=i.match(k1);return s?s[0]:""})(r);n!==t&&B.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var qt={H:()=>!!D,B:function(r){B.error("cookieStore error: "+r)},q:function(r){if(D){try{for(var e=r+"=",t=D.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(qt.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(D)try{var s="",o="",a=S1(D.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&&B.warn("cookieStore warning: large cookie, len="+c.length),D.cookie=c,c}catch{return}},V:function(r,e){if(D!=null&&D.cookie)try{qt.G(r,"",-1,e)}catch{return}}},Fp=null,Ae={H:function(){if(!Lt(Fp))return Fp;var r=!0;if(H(E))r=!1;else try{var e="__mplssupport__";Ae.G(e,"xyz"),Ae.q(e)!=='"xyz"'&&(r=!1),Ae.V(e)}catch{r=!1}return r||B.error("localStorage unsupported; falling back to cookie store"),Fp=r,r},B:function(r){B.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Ae.B(e)}return null},W:function(r){try{return JSON.parse(Ae.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Ae.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Ae.B(e)}}},E1=["$device_id","distinct_id",cc,hb,pc,dc],ec={},C1={H:function(){return!0},B:function(r){B.error("memoryStorage error: "+r)},q:function(r){return ec[r]||null},W:function(r){return ec[r]||null},G:function(r,e){ec[r]=e},V:function(r){delete ec[r]}},Pn=null,ze={H:function(){if(!Lt(Pn))return Pn;if(Pn=!0,H(E))Pn=!1;else try{var r="__support__";ze.G(r,"xyz"),ze.q(r)!=='"xyz"'&&(Pn=!1),ze.V(r)}catch{Pn=!1}return Pn},B:function(r){B.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){ze.B(e)}return null},W:function(r){try{return JSON.parse(ze.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){ze.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){ze.B(e)}}},fr=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),Ch=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?fr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===fr.DENIED||this.consent===fr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===fr.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 $p(e)?fr.GRANTED:le(PC,e)?fr.DENIED:fr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ae:qt;var t=e==="localStorage"?qt:Ae;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut($p(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!ub([pt?.doNotTrack,pt?.msDoNotTrack,X.doNotTrack],(e=>$p(e)))}},tc=Ie("[Dead Clicks]"),A1=()=>!0,R1=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(pb)),n=r.instance.config.capture_dead_clicks;return vr(n)?n:!!Pe(n)||t},yc=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({[pb]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?tc.error("failed to load script",i):e()}))}et(){var e;if(D){if(!this.tt&&(e=X.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Pe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=X.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(D),tc.info("starting...")}}else tc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,tc.info("stopping..."))}},ao=Ie("[ExceptionAutocapture]"),Ah=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=X.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=X.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=X.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=X.__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){ao.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[s_]),this.dt=new Qp({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:ao}),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 Pe(e)?t=V({},t,e):(H(e)?this.ht:e)&&(t=V({},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?(ao.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return ao.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({[s_]: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)?ao.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function y_(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return Vr(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var Rh=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&&(B.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,B.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||y_(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__||y_(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){B.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Oe(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},Dp=Ie("[SegmentIntegration]");function T1(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()||Br();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(hr,"identified")),i()},a=s.user();"then"in a&&Vr(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||Dp.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()||(Dp.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(Dp.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 Rb="posthog-js";function Tb(r,e){var{organization:t,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,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((y=>V({},y,{stacktrace:y.stacktrace?V({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((x=>V({},x,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:((c=v[0])==null?void 0:c.value)||a.message,$exception_type:(u=v[0])==null?void 0:u.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 Th=class{constructor(e,t,n,i,s,o){this.name=Rb,this.setupOnce=function(a){a(Tb(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},I1=E!=null&&E.location?vc(E.location.hash,"__posthog")||vc(location.hash,"state"):null,__="_postHogToolbarParams",b_=Ie("[Toolbar]"),Hr=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Hr||{}),Ih=class{constructor(e){this.instance=e}yt(e){X.ph_toolbar_state=e}wt(){var e;return(e=X.ph_toolbar_state)!==null&&e!==void 0?e:Hr.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||!D)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=I1||vc(e.hash,"__posthog")||vc(e.hash,"state"),o=s?n_((()=>JSON.parse(atob(decodeURIComponent(s)))))||n_((()=>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(__)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=X.ph_load_toolbar||X.ph_load_editor;!ue(t)&&Vr(t)?t(e,this.instance):b_.warn("No toolbar load function found")}loadToolbar(e){var t=!(D==null||!D.getElementById(fb));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=V({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(__,JSON.stringify(V({},i,{source:void 0}))),this.wt()===Hr.LOADED)this.xt(i);else if(this.wt()===Hr.UNINITIALIZED){var s;this.yt(Hr.LOADING),(s=X.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return b_.error("[Toolbar] Failed to load",o),void this.yt(Hr.UNINITIALIZED);this.yt(Hr.LOADED),this.xt(i)})),Oe(E,"turbolinks:load",(()=>{this.yt(Hr.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)}},$1=Ie("[TracingHeaders]"),$h=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;H(this.$t)&&((t=X.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),H(this.St)&&((n=X.__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=X.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return $1.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)}},rc="https?://(.*)",Gi=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],M1=Zi(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Gi),Po="<masked>",O1=["li_fat_id"];function Ib(r,e,t){if(!D)return{};var n,i=e?Zi([],Gi,t||[]):[],s=$b(Oo(D.URL,i,Po),r),o=(n={},xe(O1,(function(a){var l=qt.q(a);n[a]=l||null})),n);return $e(o,s)}function $b(r,e){var t=M1.concat(e||[]),n={};return xe(t,(function(i){var s=mc(r,i);n[i]=s||null})),n}function Mb(r){var e=(function(s){return s?s.search(rc+"google.([^/?]*)")===0?"google":s.search(rc+"bing.com")===0?"bing":s.search(rc+"yahoo.com")===0?"yahoo":s.search(rc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Lt(e)){n.$search_engine=e;var i=D?mc(D.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function x_(){return navigator.language||navigator.userLanguage}function Ob(){return D?.referrer||"$direct"}function Pb(r,e){var t=r?Zi([],Gi,e||[]):[],n=qe?.href.substring(0,1e3);return{r:Ob().substring(0,1e3),u:n?Oo(n,t,Po):void 0}}function Nb(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=gc(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=gc(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=$b(n);$e(i,o)}if(t){var a=Mb(t);$e(i,a)}return i}function Lb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function P1(){try{return new Date().getTimezoneOffset()}catch{return}}function N1(r,e){if(!st)return{};var t,n,i,s=r?Zi([],Gi,e||[]):[],[o,a]=(function(l){for(var c=0;c<Jy.length;c++){var[u,p]=Jy[c],h=u.exec(l),f=h&&(Vr(p)?p(h,l):p);if(f)return f}return["",""]})(st);return $e(pf({$os:o,$os_version:a,$browser:ob(st,navigator.vendor),$device:Qy(st),$device_type:(n=st,i=Qy(n),i===q_||i===z_||i==="Kobo"||i==="Kindle Fire"||i===sb?Co:i===Ro||i===Wi||i===To||i===th?"Console":i===G_?"Wearable":i?xt:"Desktop"),$timezone:Lb(),$timezone_offset:P1()}),{$current_url:Oo(qe?.href,s,Po),$host:qe?.host,$pathname:qe?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:UC(st,navigator.vendor),$browser_language:x_(),$browser_language_prefix:(t=x_(),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:pr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Lr=Ie("[Web Vitals]"),w_=9e5,Mh=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)=>V({},n,{["$web_vitals_"+i.name+"_event"]:V({},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(H(s))Lr.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();H(o)||(ue(n?.name)||ue(n?.value)?Lr.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?Lr.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),H(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=H(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(V({},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=X.__PosthogExtensions__;H(a)||H(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):Lr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[a_]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=Pe(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ue(n)?((t=this._instance.persistence)==null?void 0:t.props[c_])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=Pe(this._instance.config.capture_performance)&&yr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:w_;return 0<e&&e<=6e4?w_:e}get isEnabled(){var e=qe?.protocol;if(e!=="http:"&&e!=="https:")return Lr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:vr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return vr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Lr.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[a_]:t}),this._instance.persistence.register({[c_]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=X.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?Lr.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?Zi([],Gi,n||[]):[];return Oo(e,i,Po)}Lr.error("Could not determine current URL")}},L1=Ie("[Heatmaps]");function k_(r){return Pe(r)&&"clientX"in r&&"clientY"in r&&yr(r.clientX)&&yr(r.clientY)}var Oh=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[hh]),this.rageclicks=new fc(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Pe(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 ue(this.instance.config.capture_heatmaps)?ue(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;L1.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({[hh]: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"})(D)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&D&&(this.Nt=this.Lt.bind(this),Oe(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Oe(D,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Oe(D,"mousemove",this.zt,{capture:!0}),this.Bt=new yc(this.instance,A1,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Oe(D,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&D&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&D.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&D.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&D.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 u=a;u&&Ic(u)&&!Wr(u,"body");){if(u===c)return!1;if(le(l,E?.getComputedStyle(u).position))return!0;u=bb(u)}return!1})(yb(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"),!u_(e.target)&&k_(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(V({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!u_(e.target)&&k_(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?Zi([],Gi,i||[]):[],o=Oo(t,s,Po);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Bi(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},_c=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(B.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:u,maxContentY:p}=s;if(!(H(o)||H(a)||H(l)||H(c)||H(u)||H(p))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),p=Math.ceil(p);var h=o<=1?1:Zt(a/o,0,1,B),f=o<=1?1:Zt(l/o,0,1,B),v=c<=1?1:Zt(u/c,0,1,B),m=c<=1?1:Zt(p/c,0,1,B);i=$e(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:u,$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 gr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),wt=Uint8Array,et=Uint16Array,qi=Uint32Array,mf=new wt([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]),vf=new wt([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]),S_=new wt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fb=function(r,e){for(var t=new et(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new qi(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]},Db=Fb(mf,2),F1=Db[0],Ph=Db[1];F1[28]=258,Ph[258]=28;for(Nh=Fb(vf,0)[1],bc=new et(32768),we=0;we<32768;++we)Fr=(43690&we)>>>1|(21845&we)<<1,Fr=(61680&(Fr=(52428&Fr)>>>2|(13107&Fr)<<2))>>>4|(3855&Fr)<<4,bc[we]=((65280&Fr)>>>8|(255&Fr)<<8)>>>1;var Fr,Nh,bc,we,ko=function(r,e,t){for(var n=r.length,i=0,s=new et(e);i<n;++i)++s[r[i]-1];var o,a=new et(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new et(1<<e);var l=15-e;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],u=e-r[i],p=a[r[i]-1]++<<u,h=p|(1<<u)-1;p<=h;++p)o[bc[p]>>>l]=c}else for(o=new et(n),i=0;i<n;++i)o[i]=bc[a[r[i]-1]++]>>>15-r[i];return o},Dn=new wt(288);for(we=0;we<144;++we)Dn[we]=8;for(we=144;we<256;++we)Dn[we]=9;for(we=256;we<280;++we)Dn[we]=7;for(we=280;we<288;++we)Dn[we]=8;var xc=new wt(32);for(we=0;we<32;++we)xc[we]=5;var D1=ko(Dn,9,0),H1=ko(xc,5,0),Hb=function(r){return(r/8>>0)+(7&r&&1)},Bb=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof et?et:r instanceof qi?qi:wt)(t-e);return n.set(r.subarray(e,t)),n},ur=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},lo=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},Hp=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 wt(0),0];if(i==1){var o=new wt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(w,R){return w.f-R.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,p=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=t[t[c].f<t[p].f?c++:p++],l=t[c!=u&&t[c].f<t[p].f?c++:p++],t[u++]={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 et(h+1),v=Lh(t[u-1],f,0);if(v>e){n=0;var m=0,g=v-e,y=1<<g;for(s.sort((function(w,R){return f[R.s]-f[w.s]||w.f-R.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;m+=y-(1<<v-f[x]),f[x]=e}for(m>>>=g;m>0;){var k=s[n].s;f[k]<e?m-=1<<e-f[k]++-1:++n}for(;n>=0&&m;--n){var _=s[n].s;f[_]==e&&(--f[_],++m)}v=e}return[new wt(f),v]},Lh=function(r,e,t){return r.s==-1?Math.max(Lh(r.l,e,t+1),Lh(r.r,e,t+1)):e[r.s]=t},E_=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new et(++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]},co=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Fh=function(r,e,t){var n=t.length,i=Hb(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)},C_=function(r,e,t,n,i,s,o,a,l,c,u){ur(e,u++,t),++i[256];for(var p=Hp(i,15),h=p[0],f=p[1],v=Hp(s,15),m=v[0],g=v[1],y=E_(h),x=y[0],k=y[1],_=E_(m),w=_[0],R=_[1],b=new et(19),A=0;A<x.length;++A)b[31&x[A]]++;for(A=0;A<w.length;++A)b[31&w[A]]++;for(var $=Hp(b,7),N=$[0],M=$[1],K=19;K>4&&!N[S_[K-1]];--K);var L,O,q,Y,se=c+5<<3,C=co(i,Dn)+co(s,xc)+o,P=co(i,h)+co(s,m)+o+14+3*K+co(b,N)+(2*b[16]+3*b[17]+7*b[18]);if(se<=C&&se<=P)return Fh(e,u,r.subarray(l,l+c));if(ur(e,u,1+(P<C)),u+=2,P<C){L=ko(h,f,0),O=h,q=ko(m,g,0),Y=m;var G=ko(N,M,0);for(ur(e,u,k-257),ur(e,u+5,R-1),ur(e,u+10,K-4),u+=14,A=0;A<K;++A)ur(e,u+3*A,N[S_[A]]);u+=3*K;for(var pe=[x,w],ce=0;ce<2;++ce){var Ve=pe[ce];for(A=0;A<Ve.length;++A){var Ee=31&Ve[A];ur(e,u,G[Ee]),u+=N[Ee],Ee>15&&(ur(e,u,Ve[A]>>>5&127),u+=Ve[A]>>>12)}}}else L=D1,O=Dn,q=H1,Y=xc;for(A=0;A<a;++A)if(n[A]>255){Ee=n[A]>>>18&31,lo(e,u,L[Ee+257]),u+=O[Ee+257],Ee>7&&(ur(e,u,n[A]>>>23&31),u+=mf[Ee]);var kt=31&n[A];lo(e,u,q[kt]),u+=Y[kt],kt>3&&(lo(e,u,n[A]>>>5&8191),u+=vf[kt])}else lo(e,u,L[n[A]]),u+=O[n[A]];return lo(e,u,L[256]),u+O[256]},B1=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),V1=(function(){for(var r=new qi(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),j1=function(r,e,t,n,i){return(function(s,o,a,l,c,u){var p=s.length,h=new wt(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=Fh(f,v,s.subarray(m,g)):(f[m]=u,v=Fh(f,v,s.subarray(m,p)))}else{for(var y=B1[o-1],x=y>>>13,k=8191&y,_=(1<<a)-1,w=new et(32768),R=new et(_+1),b=Math.ceil(a/3),A=2*b,$=function(Dc){return(s[Dc]^s[Dc+1]<<b^s[Dc+2]<<A)&_},N=new qi(25e3),M=new et(288),K=new et(32),L=0,O=0,q=(m=0,0),Y=0,se=0;m<p;++m){var C=$(m),P=32767&m,G=R[C];if(w[P]=G,R[C]=P,Y<=m){var pe=p-m;if((L>7e3||q>24576)&&pe>423){v=C_(s,f,0,N,M,K,O,q,se,m-se,v),q=L=O=0,se=m;for(var ce=0;ce<286;++ce)M[ce]=0;for(ce=0;ce<30;++ce)K[ce]=0}var Ve=2,Ee=0,kt=k,St=P-G&32767;if(pe>2&&C==$(m-St))for(var Lc=Math.min(x,pe)-1,Yi=Math.min(32767,m),Me=Math.min(258,pe);St<=Yi&&--kt&&P!=G;){if(s[m+Ve]==s[m+Ve-St]){for(var Ft=0;Ft<Me&&s[m+Ft]==s[m+Ft-St];++Ft);if(Ft>Ve){if(Ve=Ft,Ee=St,Ft>Lc)break;var u0=Math.min(St,Ft-2),kf=0;for(ce=0;ce<u0;++ce){var Fc=m-St+ce+32768&32767,Sf=Fc-w[Fc]+32768&32767;Sf>kf&&(kf=Sf,G=Fc)}}}St+=(P=G)-(G=w[P])+32768&32767}if(Ee){N[q++]=268435456|Ph[Ve]<<18|Nh[Ee];var Ef=31&Ph[Ve],Cf=31&Nh[Ee];O+=mf[Ef]+vf[Cf],++M[257+Ef],++K[Cf],Y=m+Ve,++L}else N[q++]=s[m],++M[s[m]]}}v=C_(s,f,u,N,M,K,O,q,se,m-se,v)}return Bb(h,0,l+Hb(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)},Bp=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function W1(r,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u<l.length;++u)c=V1[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=j1(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&&Bp(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}})(s,e),Bp(s,o-8,t.d()),Bp(s,o-4,n),s}var U1=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
1007
+ `,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),Lv=!0}var fl=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 m=typeof r.antiFlicker=="object"?r.antiFlicker:{};e=$v(m)}let t=null,n=null,i=null,{runtime:s}=r;async function o(m){!s?.actions||m.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(m))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(r.fetcher)try{n=r.fetcher,console.log("[SmartCanvas] Fetching initial config...");let m=await r.fetcher();t=m,console.log("[SmartCanvas] Config fetched:",`tiles=${m.tiles?.length??0},`,`actions=${m.actions?.length??0},`,`theme=${m.theme?.mode??"default"}`),m.actions?.length&&console.log("[SmartCanvas] Actions to apply:",m.actions.map((y,x)=>`[${x}] ${y.kind}${y.anchorId?` anchor="${y.anchorId.selector}"`:""}${y.label?` "${y.label}"`:""}`).join(", ")),m.actions&&m.actions.length>0&&s?.actions&&(await o(m.actions),console.log("[SmartCanvas] Initial actions applied successfully")),m.tiles&&s?.accumulator&&En(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=hl();Ds();let c=document.createElement("smart-canvas");if(r.tokens)for(let[m,y]of Object.entries(r.tokens))c.style.setProperty(m,y);let u=r.integrations?.experiments,p=r.integrations?.telemetry,h=r.fetcher??wn({configUri:r.configUri,experiments:u,featureKey:r.configUriFeatureKey,credentials:r.fetchCredentials});n||(n=h);let f={fetcher:h,configUri:r.configUri,configUriFeatureKey:r.configUriFeatureKey,fetchCredentials:r.fetchCredentials,experiments:u,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 m=r.target??document.body;if(m){m.appendChild(c);let y=c.getOverlayContainer();y&&Fv(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),Nv(r.editorUrl).catch(console.error));let g={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:m=>{for(let[y,x]of Object.entries(m))c.style.setProperty(y,x)},getConfig:async()=>{if(n)try{let m=await n();return t=m,m}catch(m){console.error("[SmartCanvas] Error fetching config:",m)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async m=>{m?t&&await o(t.actions):await a()},setOverrideFetcher:m=>{n=m,c.setOverrideFetcher(m),s?.accumulator&&m().then(y=>{y?.tiles&&En(y.tiles,s.accumulator,y.actions)}).catch(()=>{})},registerTelemetryProperties:m=>{p?.register?.(m)},getSessionId:()=>p?.getSessionId?.(),startSessionRecording:()=>{p?.startSessionRecording?.()},track:(m,y)=>p?.track?(p.track(m,y),!0):!1,runtime:s};if(typeof window<"u"){let m=window.SynOS;m&&(m.handle=g)}return g};typeof window<"u"&&(window.SmartCanvas={async create(r){return fl(r)}});var Xd="syn_";function xi(r){if(!r.startsWith(Xd))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(Xd.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 gl(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Xd+t}function xt(r){if(typeof process<"u"&&process.env)return process.env[r]}var Bv="syntro_segment_attributes";function Vv(){if(typeof window>"u")return{};try{let r=localStorage.getItem(Bv);if(r){let e=JSON.parse(r);return z("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){Qe("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function jv(r){if(!(typeof window>"u"))try{localStorage.setItem(Bv,JSON.stringify(r)),z("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){Qe("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Wv(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 Jd(){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"}return r}var Hv="syntro_geo",Uv="https://geo.syntrologie.com";async function Qd(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(Hv);if(e){let t=JSON.parse(e);return z("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(Hv,JSON.stringify(n))}catch{}return z("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var ep=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(/\/[^/]*$/,"");ep=`${e.origin}${t}`}}catch{ep=null}function zv(){return ep}var qv="app:",fE="syntro:",gE=/^[a-z][a-z0-9_]*$/;function ml(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(fE))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(qv))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(qv.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(!gE.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function mE(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Zv(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)&&!Zv(n,e,t+1))return!1;return!0}function vl(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(!Zv(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"||mE(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function yl(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 qs=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:Te};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(yl(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=ml(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=vl(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:Te};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(yl(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=>yl(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=>yl(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 wi(r={}){return new qs(r)}var ki=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 Kv={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Yv(){return Kv}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 Zs(r,e,t){return t===2?tp(tp(r+e)+"")%1e4/1e4:t===1?tp(e+r)%1e3/1e3:null}function vE(r){return r<=0?[]:new Array(r).fill(1/r)}function _l(r,e){return r>=e[0]&&r<e[1]}function Xv(r,e){let t=Zs("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Jv(r,e){for(let t=0;t<e.length;t++)if(_l(r,e[t]))return t;return-1}function np(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function bl(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=bE(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 yE(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 _E(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=>!yE(i[0],i[1],i[2]))}catch{return!1}}function bE(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=np(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return _E(n,t);return!1}catch{return!1}}function Qv(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=vE(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 ey(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 ty(r){try{return r()}catch(e){return console.error(e),!1}}var rp=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function Mn(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Kv.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 Gs(r){return typeof r=="string"?r:JSON.stringify(r)}function dt(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 ry(){let r;try{r="1.6.4"}catch{r=""}return r}function ny(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 Gv(r){return typeof r=="object"&&r!==null}function xl(r){return r.urlPatterns&&r.variations.some(e=>Gv(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>Gv(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 Ke={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},zt=Yv(),Si={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>zt.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 zt.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new zt.EventSource(`${r}/sub/${e}`,{headers:t}):new zt.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),kE()):document.visibilityState==="hidden"&&(r=window.setTimeout(wE,Ke.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(zt.localStorage=globalThis.localStorage)}catch{}var Ei=new Map,iy=!1,cr=new Map,kl=new Map,Ci=new Map,Ai=new Set;function oy(r){Object.assign(Ke,r),Ke.backgroundSync||cp()}async function ay({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(Ke.backgroundSync=!1),SE({instance:r,allowStale:n,timeout:e,skipCache:t})}function xE(r){let e=Ks(r),t=Ei.get(e)||new Set;t.add(r),Ei.set(e,t)}function ly(r){Ei.forEach(e=>e.delete(r))}function wE(){Ci.forEach(r=>{r&&(r.state="idle",ap(r))})}function kE(){Ci.forEach(r=>{r&&r.state==="idle"&&lp(r)})}async function sy(){try{if(!zt.localStorage)return;await zt.localStorage.setItem(Ke.cacheKey,JSON.stringify(Array.from(cr.entries())))}catch{}}async function SE({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=Ks(r),s=sp(r),o=new Date,a=new Date(o.getTime()-Ke.maxAge+Ke.staleTTL);await EE();let l=!Ke.disableCache&&!n?cr.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Ai.add(i),l.staleAt<o?ip(r):op(r),{data:l.data,success:!0,source:"cache"}):await wl(ip(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function Ks(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function sp(r){let e=Ks(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 EE(){if(!iy){iy=!0;try{if(zt.localStorage){let r=await zt.localStorage.getItem(Ke.cacheKey);if(!Ke.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{cr.set(t,{...n,staleAt:new Date(n.staleAt)})}),cy()}}}catch{}if(!Ke.disableIdleStreams){let r=Si.startIdleListener();r&&(Si.stopIdleListener=r)}}}function cy(){let r=Array.from(cr.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,cr.size-Ke.maxEntries),cr.size);for(let t=0;t<e;t++)cr.delete(r[t].key)}function uy(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+Ke.staleTTL),s=Ke.disableCache?void 0:cr.get(e);if(s&&n&&s.version===n){s.staleAt=i,sy();return}Ke.disableCache||(cr.set(e,{data:t,version:n,staleAt:i,sse:Ai.has(r)}),cy()),sy();let o=Ei.get(r);o&&o.forEach(a=>CE(a,t))}async function CE(r,e){await r.setPayload(e||r.getPayload())}async function ip(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=Ks(r),o=sp(r),a=kl.get(o);return a||(a=(i?Si.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Si.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"&&Ai.add(s),c.json()}).then(c=>(uy(s,o,c),op(r),kl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(kl.delete(o),{data:null,source:"error",success:!1,error:c})),kl.set(o,a)),a}function op(r,e=!1){let t=Ks(r),n=sp(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Ai.add(t),Ke.backgroundSync&&Ai.has(t)&&zt.EventSource){if(Ci.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ei.get(t);c&&c.forEach(u=>{ip(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);uy(t,n,c)}a.errors=0}catch{dy(a)}},errors:0,state:"active"};Ci.set(t,a),lp(a)}}function dy(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);ap(r),setTimeout(()=>{["idle","active"].includes(r.state)||lp(r)},Math.min(e,3e5))}}function ap(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=Si.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=()=>dy(r),r.src.onopen=()=>{r.errors=0}}function AE(r,e){ap(r),Ci.delete(e)}function cp(){Ai.clear(),Ci.forEach(AE),Ei.clear(),Si.stopIdleListener()}function Sl(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&op(r,!0),xE(r)}}var RE=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,pp={revert:function(){}},Rl=new Map,hp=new Set;function TE(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function Tl(r){var e=Rl.get(r);return e||(e={element:r,attributes:{}},Rl.set(r,e)),e}function Il(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,TE(e)),o}function $l(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,py()):r!==t&&(e.isDirty=!0,py())}function IE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),$l(UE(e),r)}function $E(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),$l(Array.from(e).filter(Boolean).join(" "),r)}function ME(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),$l(e,r)}function OE(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 PE(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=OE(n);e=i||e}),$l(e,r)}var NE=function(e){return e.innerHTML},LE=function(e,t){return e.innerHTML=t};function fy(r){var e=Tl(r);return e.html||(e.html=Il(r,"html",NE,LE,IE)),e.html}var FE=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},DE=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function gy(r){var e=Tl(r);return e.position||(e.position=Il(r,"position",FE,DE,PE)),e.position}var HE=function(e,t){return t?e.className=t:e.removeAttribute("class")},BE=function(e){return e.className};function my(r){var e=Tl(r);return e.classes||(e.classes=Il(r,"class",BE,HE,$E)),e.classes}var VE=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},jE=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function vy(r,e){var t=Tl(r);return t.attributes[e]||(t.attributes[e]=Il(r,e,VE(e),jE(e),ME)),t.attributes[e]}function WE(r,e){var t=Rl.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,u,p;(c=t.attributes)==null||(u=c[e])==null||(p=u.observer)==null||p.disconnect(),delete t.attributes[e]}}var El;function UE(r){return El||(El=document.createElement("div")),El.innerHTML=r,El.innerHTML}function Cl(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||WE(r,e),t.setValue(r,n)}}function zE(r,e){r.html&&Cl(e,"html",r.html),r.classes&&Cl(e,"class",r.classes),r.position&&Cl(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){Cl(e,t,r.attributes[t])})}function py(){Rl.forEach(zE)}function qE(r,e){var t=null;r.kind==="html"?t=fy(e):r.kind==="class"?t=my(e):r.kind==="attribute"?t=vy(e,r.attribute):r.kind==="position"&&(t=gy(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function ZE(r,e){var t=null;if(r.kind==="html"?t=fy(e):r.kind==="class"?t=my(e):r.kind==="attribute"?t=vy(e,r.attribute):r.kind==="position"&&(t=gy(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function yy(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),qE(r,n))})}}function GE(r){r.elements.forEach(function(e){return ZE(r,e)}),r.elements.clear(),hp.delete(r)}function hy(){hp.forEach(yy)}var up;function KE(){typeof document>"u"||(up||(up=new MutationObserver(function(){hy()})),hy(),up.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}KE();function Ml(r){return typeof document>"u"?pp:(hp.add(r),yy(r),{revert:function(){GE(r)}})}function dp(r,e){return Ml({kind:"html",elements:new Set,mutate:e,selector:r})}function _y(r,e){return Ml({kind:"position",elements:new Set,mutate:e,selector:r})}function Ys(r,e){return Ml({kind:"class",elements:new Set,mutate:e,selector:r})}function Al(r,e,t){return RE.test(e)?e==="class"||e==="className"?Ys(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)})}):Ml({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):pp}function YE(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 Ys(e,function(a){n&&a.add(n)});if(t==="remove")return Ys(e,function(a){n&&a.delete(n)});if(t==="set")return Ys(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return _y(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return Al(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return Al(e,i,function(){return n??""});if(t==="remove")return Al(e,i,function(){return null})}return pp}var XE={html:dp,classes:Ys,attribute:Al,position:_y,declarative:YE},by=XE;var fp={};function Pr(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!ky(r,i,t))return!1;break;case"$nor":if(ky(r,i,t))return!1;break;case"$and":if(!rC(r,i,t))return!1;break;case"$not":if(Pr(r,i,t))return!1;break;default:if(!Xs(i,JE(r,n),t))return!1}return!0}function JE(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 xy(r,e=!1){let t=`${r}${e?"/i":""}`;return fp[t]||(fp[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),fp[t]}function Xs(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)||!Sy(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!tC(i,e,r[i],t))return!1;return!0}function Sy(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function QE(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 eC(r,e,t){if(!Array.isArray(r))return!1;let n=Sy(e)?i=>Xs(e,i,t):i=>Pr(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function Ri(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 wy(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(Xs(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function tC(r,e,t,n){switch(r){case"$veq":return dt(e)===dt(t);case"$vne":return dt(e)!==dt(t);case"$vgt":return dt(e)>dt(t);case"$vgte":return dt(e)>=dt(t);case"$vlt":return dt(e)<dt(t);case"$vlte":return dt(e)<=dt(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)?Ri(e,t):!1;case"$ini":return Array.isArray(t)?Ri(e,t,!0):!1;case"$inGroup":return Ri(e,n[t]||[]);case"$notInGroup":return!Ri(e,n[t]||[]);case"$nin":return Array.isArray(t)?!Ri(e,t):!1;case"$nini":return Array.isArray(t)?!Ri(e,t,!0):!1;case"$not":return!Xs(t,e,n);case"$size":return Array.isArray(e)?Xs(t,e.length,n):!1;case"$elemMatch":return eC(e,t,n);case"$all":return Array.isArray(t)?wy(e,t,n):!1;case"$alli":return Array.isArray(t)?wy(e,t,n,!0):!1;case"$regex":try{return xy(t).test(e)}catch{return!1}case"$regexi":try{return xy(t,!0).test(e)}catch{return!1}case"$type":return QE(e)===t;default:return console.error("Unknown operator: "+r),!1}}function ky(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(Pr(r,e[n],t))return!0;return!1}function rC(r,e,t){for(let n=0;n<e.length;n++)if(!Pr(r,e[n],t))return!1;return!0}var nC="Feature Evaluated",iC="Experiment Viewed";function sC(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 oC(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 Ti(r){try{await r()}catch{}}function Ey(r,e,t){if(r.user.trackedExperiments){let i=Nl(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(Ti(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(Ti(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(Ti(()=>i(iC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function aC(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;Ti(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;Ti(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;Ti(()=>n(nC,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function Ol(r,e){if(e.stack.evaluatedFeatures.has(r))return Nr(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=sC(e);if(t.has(r))return Nr(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return Nr(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=Ol(l.id,e);if(c.source==="cyclicPrerequisite")return Nr(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!Pr(u,l.condition||{})){if(l.gate)return Nr(e,r,null,"prerequisite");continue e}}if(s.filters&&Ry(s.filters,e))continue;if("force"in s){if(s.condition&&!Ay(s.condition,e)||!lC(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=>{!Ey(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Nr(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}=Pl(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Nr(e,r,a.value,"experiment",s.id,o,a)}}return Nr(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function Pl(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:Ce(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Ce(t,r,-1,!1,e)};if(r=cC(r,t),r.urlPatterns&&!bl(t.user.url||"",r.urlPatterns))return{result:Ce(t,r,-1,!1,e)};let s=ey(n,t.user.url||"",i);if(s!==null)return{result:Ce(t,r,s,!1,e)};let o=oC(t);if(n in o){let m=o[n];return{result:Ce(t,r,m,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:Ce(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=On(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:Ce(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:m,versionIsBlocked:y}=pC({ctx:t,expKey:r.key,expBucketVersion:r.bucketVersion,expHashAttribute:r.hashAttribute,expFallbackAttribute:r.fallbackAttribute,expMinBucketVersion:r.minBucketVersion,expMeta:r.meta});u=m>=0,c=m,p=!!y}if(!u){if(r.filters){if(Ry(r.filters,t))return{result:Ce(t,r,-1,!1,e)}}else if(r.namespace&&!Xv(l,r.namespace))return{result:Ce(t,r,-1,!1,e)};if(r.include&&!ty(r.include))return{result:Ce(t,r,-1,!1,e)};if(r.condition&&!Ay(r.condition,t))return{result:Ce(t,r,-1,!1,e)};if(r.parentConditions){let m=new Set(t.stack.evaluatedFeatures);for(let y of r.parentConditions){t.stack.evaluatedFeatures=new Set(m);let x=Ol(y.id,t);if(x.source==="cyclicPrerequisite")return{result:Ce(t,r,-1,!1,e)};let k={value:x.value};if(!Pr(k,y.condition||{}))return{result:Ce(t,r,-1,!1,e)}}}if(r.groups&&!dC(r.groups,t))return{result:Ce(t,r,-1,!1,e)}}if(r.url&&!uC(r.url,t))return{result:Ce(t,r,-1,!1,e)};let h=Zs(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:Ce(t,r,-1,!1,e)};if(!u){let m=r.ranges||Qv(i,r.coverage===void 0?1:r.coverage,r.weights);c=Jv(h,m)}if(p)return{result:Ce(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:Ce(t,r,-1,!1,e)};if("force"in r)return{result:Ce(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Ce(t,r,-1,!1,e)};if(r.status==="stopped")return{result:Ce(t,r,-1,!1,e)};let f=Ce(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:m,key:y,doc:x}=fC(t,a,Gs(l),{[gp(r.key,r.bucketVersion)]:f.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=Ey(t,r,f);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:r,result:f});let g=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:g}}function Nr(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"&&aC(r,e,a),a}function Cy(r){return{...r.user.attributes,...r.user.attributeOverrides}}function Ay(r,e){return Pr(Cy(e),r,e.global.savedGroups||{})}function Ry(r,e){return r.some(t=>{let{hashValue:n}=On(e,t.attribute);if(!n)return!0;let i=Zs(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>_l(i,s))})}function lC(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=On(r,t,n);if(!a)return!1;let l=Zs(e,a,o||1);return l===null?!1:i?_l(l,i):s!==void 0?l<=s:!0}function Ce(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}=On(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},p={key:u.key||""+t,featureId:i,inExperiment:a,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return u.name&&(p.name=u.name),s!==void 0&&(p.bucket=s),u.passthrough&&(p.passthrough=u.passthrough),p}function cC(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=np(r.url))),r}function On(r,e,t){let n=e||"id",i="",s=Cy(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function uC(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 dC(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function pC({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=gp(e,t),l=hC(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=gp(e,p);if(l[h]!==void 0)return{variation:-1,versionIsBlocked:!0}}let c=l[a];if(c===void 0)return{variation:-1};let u=o.findIndex(p=>p.key===c);return u<0?{variation:-1}:{variation:u}}function gp(r,e){return e=e||0,`${r}__${e}`}function mp(r,e){return`${r}||${e}`}function hC(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=On(r,e),s=mp(n,Gs(i)),{hashAttribute:o,hashValue:a}=On(r,t),l=a?mp(o,Gs(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 fC(r,e,t,n){let i=mp(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 gC(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 Ty(r,e,t){let n=vp(r,t);return e.getAllAssignments(n)}function vp(r,e){let t={};return gC(r,e).forEach(i=>{let{hashValue:s}=On(r,i);t[i]=Gs(s)}),t}async function Iy(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await Mn(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await Mn(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await Mn(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function $y(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 Nl(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var Ii=typeof window<"u"&&typeof document<"u",mC=ry(),Js=class{constructor(e){if(e=e||{},this.version=mC,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),Ii&&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 Iy(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,Sl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&oy(e.cacheSettings),e.payload)return await this.setPayload(e.payload),Sl(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return Sl(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 $y(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 ay({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 Mn(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 Mn(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,ly(this),e.destroyAllStreams&&cp(),this.logs=[],Ii&&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}=Pl(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=Ce(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=Pl(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=xl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?ny(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(bl(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:u,delay:p}=this._getNavigateFunction();if(u)if(Ii)Promise.all([...o?[wl(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??p))]).then(()=>{try{u(c)}catch(h){console.error(h)}});else try{u(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&&xl(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 Ol(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=>[Nl(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(Nl(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Ii?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=xl(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}:Ii?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Ii)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(by.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await Ty(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=vp(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var vC="https://experiment.syntrologie.com",yp=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 Js({...e,apiHost:e.apiHost??vC,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 Ll(r={}){return new yp(r)}var My={growthbook:r=>Ll({...r,autoInit:!0})};function Oy(r,e){let t=My[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(My).join(", ")}`);return t(e)}var yC=["cdn.syntrologie.com","localhost","127.0.0.1"];function _C(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):yC.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 _p=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!_C(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 bC(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 bC(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 Py(r){return new _p(r)}var xC="syntro_exp",wC="syntro_var",bp=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(xC),o=i.get(wC);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:Ka(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 Ny(r){return new bp(r)}var kC="https://cdn.syntrologie.com/configs",Ly={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return Py({baseUrl:r.baseUrl??kC,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return Ny({featureKey:r.featureKey})}};function Fy(r,e={}){let t=Ly[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(Ly).join(", ")}`);return t(e)}var Dy="syntro_session_metrics",Qs=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(Dy);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(Dy,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Fl(r={}){return new Qs(r)}var Dl=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 Hl=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 Dl(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 SC=[()=>new Hl];function Hy(){for(let r of SC){let e=r();if(e.detect())return e}return null}var xp="syntro_experiments";var CC=720*60*60,Bl=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}destroy(){document.cookie=`${xp}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; SameSite=Lax`}writeCookie(){let e={version:1,distinct_id:this.context.distinctId,telemetry_host:this.context.telemetryHost,telemetry_key:this.context.telemetryKey},t=encodeURIComponent(JSON.stringify(e)),n=`${xp}=${t}; max-age=${CC}; path=/; SameSite=Lax`;document.cookie=n}};function AC(){let r=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:r,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function wp(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(By(t,n))return}if(e.include){for(let n of e.include)if(By(t,n))return n;return}return t}function By(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 eo=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=AC(),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=wp(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=wp(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}})}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};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,{title:t}=document,n=wp(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 Vl(r){return new eo(r)}function kp(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 Sp(r,e){let t=[];for(let n of r.conditions){let i=kp(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function to(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=Sp(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 ro(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 Vy(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 Ep(r,e,t={}){let n=Vy(e,t);switch(r.type){case"rules":return to(r,n);case"score":return ro(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 Cp(r,e,t={}){let n=Vy(e,t);switch(r.type){case"rules":return to(r,n);case"score":return ro(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 jl(r){return{evaluate:(e,t)=>Ep(e,t,r),evaluateSync:(e,t)=>Cp(e,t,r)}}function Wl(r){let{eventBus:e,stateStore:t}=r,n=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let u=!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),u=!0}if(u)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,u,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:u}),l()},getCount(c,u){let p=`ev:${c}`,h=o.get(p);if(!h)return 0;if(u===void 0||!h.timestamps)return h.count;let f=Date.now()-u;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 $i=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 Ap="cooldown:";function jy(r){return{set(e,t){let n=Ap+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Ap+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=Ap+e;r.remove(t)}}}var no="dismissed:";function Wy(r,e){return{mark(t,n=!1){let i=no+t;(n?e:r).set(i,!0)},isDismissed(t){let n=no+t;return r.has(n)||e.has(n)},clear(t){let n=no+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(no)&&r.remove(t);for(let t of e.keys())t.startsWith(no)&&e.remove(t)}}}var Rp="freq:";function Uy(r){function e(t){let n=Rp+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=Rp+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=Rp+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var RC="syntro";function Tp(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 io(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 so=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??RC;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?Tp(window.sessionStorage,this.namespace):io(this.namespace),this.user=t(window.localStorage)?Tp(window.localStorage,this.namespace):io(this.namespace)):(this.session=io(this.namespace),this.user=io(this.namespace)),this.dismissals=Wy(this.session,this.user),this.cooldowns=jy(this.user),this.frequency=Uy(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?Tp(sessionStorage,t):io(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function Ul(r={}){return new so(r)}function Mi(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function oo(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var Ip={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"}},Oi={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:[]},zy={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function zl(r,e,t){let n=Ip[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 ql(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Jo(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(ea()),t.shift!==!1&&i.push(Qo({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Xo(e,r,async()=>{let{x:o,y:a,strategy:l}=await ta(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function Zl(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 Gl(r,e){return e==="none"||Oi[e].length===0?null:r.animate(Oi[e],zy)}function Kl(r,e){if(e==="none"||Oi[e].length===0)return Promise.resolve();let t=[...Oi[e]].reverse(),n=r.animate(t,zy);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Yl(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 Xl(r){switch(Mi(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 qy(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 u=c.name.toLowerCase(),p=c.value.trim().toLowerCase(),h=u.startsWith("on"),f=(u==="href"||u==="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 TC=0;function Jl(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-${++TC}`}function u(_,w){t&&t.publish(_,w)}function p(_){let w=l.get(_);if(w){let R=m(_);for(let b of w)try{b(R)}catch(A){console.error("[Surfaces] State callback error:",A)}}}let h=new Map;function f(_,w,R){switch(w.type){case"html":_.innerHTML=qy(w.content);return;case"widget":{if(s?.has(w.widgetId)){let b=s.mount(w.widgetId,_,w.config);return R&&h.set(R,b),()=>{b.unmount(),R&&h.delete(R)}}console.warn(`[Surfaces] Widget not found: ${w.widgetId}`),_.innerHTML=`<div data-widget-id="${w.widgetId}" data-widget-missing="true">Widget: ${w.widgetId}</div>`;return}case"custom":return w.mount(_);case"react":_.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(_,w,R){let b=c(),A=Mi(_),$=R?.priority??0,N=R?.animation??i,M=R?.exclusive??!0,K=o.get(_);if(K&&M){if(K.options.priority>$)throw new Error(`Slot ${_} is occupied by higher priority content (${K.options.priority} > ${$})`);g(K)}let L=Yl(_,b);L.style.zIndex=String(Xl(_));let P;if(A==="static")zl(L,_,R?.constraints),e.appendChild(L);else if(A==="inline"){let C=oo(_);if(!C)throw new Error(`Invalid inline slot: ${_}`);if(!n)throw new Error("Anchor resolver required for inline slots");let O=n({selector:C,route:"**"});if(!O)throw new Error(`Anchor not found for inline slot: ${C}`);P=Zl(L,O)}else if(A==="adjacent"){let C=oo(_);if(!C)throw new Error(`Invalid adjacent slot: ${_}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let O=n({selector:C,route:"**"});if(!O)throw new Error(`Anchor not found for adjacent slot: ${C}`);e.appendChild(L),P=ql(L,O,R?.position??{placement:"bottom"})}let q=f(L,w,b);Gl(L,N);let Y={id:b,slot:_,content:w,options:{priority:$,exclusive:M,animation:N,position:R?.position??{placement:"auto"},constraints:R?.constraints??{},adaptiveId:R?.adaptiveId,autoUnmountOnRouteChange:R?.autoUnmountOnRouteChange??!0},container:L,cleanup:()=>{P?.(),q?.()},mountedAt:Date.now()};return o.set(_,Y),a.set(_,(a.get(_)??0)+1),u("surface.mounted",{slot:_,id:b,adaptiveId:R?.adaptiveId}),p(_),{id:b,update(C){let O=o.get(_);if(!O||O.id!==b)throw new Error("Mount no longer active");let Z=h.get(b);if(Z){if(C.type==="widget"){Z.update(C.config),O.content=C;return}Z.unmount(),h.delete(b)}O.container.innerHTML="";let de=f(O.container,C,b);if(O.content=C,de){let ae=O.cleanup;O.cleanup=()=>{ae?.(),de()}}},setOptions(C){let O=o.get(_);if(!O||O.id!==b)throw new Error("Mount no longer active");C.priority!==void 0&&(O.options.priority=C.priority),C.animation!==void 0&&(O.options.animation=C.animation),C.constraints&&A==="static"&&(C.constraints.maxWidth&&(O.container.style.maxWidth=C.constraints.maxWidth),C.constraints.maxHeight&&(O.container.style.maxHeight=C.constraints.maxHeight),C.constraints.minWidth&&(O.container.style.minWidth=C.constraints.minWidth),C.constraints.minHeight&&(O.container.style.minHeight=C.constraints.minHeight)),p(_)},async unmount(){let C=o.get(_);!C||C.id!==b||await g(C)},isMounted(){return o.get(_)?.id===b},getContainer(){let C=o.get(_);return C?.id===b?C.container:null}}}async function g(_){_.container.isConnected&&await Kl(_.container,_.options.animation);try{_.cleanup?.()}catch(w){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",w)}try{_.container.remove()}catch{}o.delete(_.slot),u("surface.unmounted",{slot:_.slot,id:_.id}),p(_.slot)}function m(_){let w=o.get(_);return{slot:_,occupied:!!w,currentPriority:w?.options.priority,currentAdaptiveId:w?.options.adaptiveId,mountCount:a.get(_)??0,currentMountId:w?.id}}function y(_,w){let R=l.get(_);return R||(R=new Set,l.set(_,R)),R.add(w),()=>{R?.delete(w),R?.size===0&&l.delete(_)}}function x(_,w){let R=o.get(_);return R?w!==void 0?w>=R.options.priority:!1:!0}function k(){for(let _ of o.values())try{_.cleanup?.(),_.container.remove()}catch(w){console.error("[Surfaces] Error during cleanup:",w)}o.clear(),l.clear()}return{mount:v,getState:m,onStateChange:y,canMount:x,destroy:k}}var ao=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 u=this.mountedWidgets.get(s);if(u){u.cleanup?.(),t.innerHTML="";let p={...c,runtime:this.runtimeRef},h=i.widget.mount(t,p);u.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()}},Ql=new ao;var Mp="2.0.0";function IC(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($p(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if($p(n,i))return!0;return!1}return!0}function $p(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 Zy(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 $p(t,s)})}function ec(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??Ql,a=r.executors??Wt,l=r.apps??ys,c=new $i,u=Vl({telemetry:e,routes:n,navigation:c}),p=r.events??wi(),h=Ul({namespace:s}),f=Wl({eventBus:p,stateStore:h}),v=jl({state:h,events:p,sessionMetrics:t,accumulator:f}),g=Dv(),m=ul(),y=M=>Zy(M)?m.resolve(M.selector):null,x=async(M,K)=>{if(!Zy(M))return null;try{return await m.waitFor(M.selector,K)}catch{return null}},k=Jl({overlayRoot:g,eventBus:p,anchorResolver:y,widgetRegistry:o}),_=al({overlayRoot:g,eventBus:p,surfaces:k,anchorResolver:y,waitForAnchor:x,executorRegistry:a,subscribeNavigation:M=>c.subscribe(M),runtime:{evaluateSync:M=>v.evaluateSync(M,u.get()),context:u,accumulator:f,sessionMetrics:t,events:p?{subscribe:M=>p.subscribe(()=>M())}:void 0}}),w;if(t){let M=t;M.increment("page_views");let K=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((L,P)=>{if(P!=="replaceState")try{let q=new URL(L).pathname;q!==K&&(K=q,M.increment("page_views"),R=0,M.set("time_on_page",0),M.set("scroll_depth",0))}catch{}})}let R=0,b,A;if(t){let M=t;b=setInterval(()=>{R++},1e3),A=setInterval(()=>{M.set("time_on_page",R)},5e3)}let $;if(t&&p){let M=t;$=p.subscribe({names:["ui.scroll"]},K=>{let L=K.props?.scrollPercentage;typeof L=="number"&&L>M.get("scroll_depth")&&M.set("scroll_depth",L)})}let N={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:_,surfaces:k,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:m,navigation:c,version:Mp,mode:i,async evaluate(M){return v.evaluate(M,u.get())},evaluateSync(M){return v.evaluateSync(M,u.get())},async filterTiles(M){let K=u.get().page.url,L=[];for(let P of M){let q=P.activation;if(!q){L.push(P);continue}if(IC(K,q.routes)){if(q.onlyIfPopulated){let Y=P.props?.actions??[];if(Y.length>0&&!Y.some(C=>C.triggerWhen?v.evaluateSync(C.triggerWhen,u.get()).value:!0))continue}L.push(P)}}return L},setRoutes(M){u.setRoutes(M)},destroy(){l.unbind().catch(M=>{console.error("[Runtime] Error unbinding apps registry:",M)}),w?.(),$?.(),b&&clearInterval(b),A&&clearInterval(A),m.destroy(),f.destroy(),c.destroy(),u.destroy(),_.destroy(),k.destroy()}};return l.bind(N),o.bindRuntime(N),N}var Pi=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 $C(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var Op=class{constructor(){this.sessionId=$C(),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){}};function tc(){return new Op}var E=typeof window<"u"?window:void 0,Ze=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Ze.self=Ze),typeof File>"u"&&(Ze.File=function(){});var W_=Array.prototype,Gy=W_.forEach,Ky=W_.indexOf,ht=Ze?.navigator,D=Ze?.document,qe=Ze?.location,Xp=Ze?.fetch,Jp=Ze!=null&&Ze.XMLHttpRequest&&"withCredentials"in new Ze.XMLHttpRequest?Ze.XMLHttpRequest:void 0,Yy=Ze?.AbortController,ot=ht?.userAgent,X=E??{},pr={DEBUG:!1,LIB_VERSION:"1.341.0"};function Xy(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 Hi(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){Xy(s,n,i,o,a,"next",l)}function a(l){Xy(s,n,i,o,a,"throw",l)}o(void 0)}))}}function V(){return V=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},V.apply(null,arguments)}function U_(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 MC=["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"],Jy=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return MC.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},OC=["$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 ce(r,e){return r.indexOf(e)!==-1}var $c=function(r){return r.trim()},Qp=function(r){return r.replace(/^\$/,"")},PC=Array.isArray,z_=Object.prototype,q_=z_.hasOwnProperty,Mc=z_.toString,ge=PC||function(r){return Mc.call(r)==="[object Array]"},Vr=r=>typeof r=="function",Pe=r=>r===Object(r)&&!ge(r),Bi=r=>{if(Pe(r)){for(var e in r)if(q_.call(r,e))return!1;return!0}return!1},H=r=>r===void 0,Ne=r=>Mc.call(r)=="[object String]",eh=r=>Ne(r)&&r.trim().length===0,Lt=r=>r===null,ue=r=>H(r)||Lt(r),yr=r=>Mc.call(r)=="[object Number]"&&r==r,Fi=r=>yr(r)&&r>0,vr=r=>Mc.call(r)==="[object Boolean]",NC=r=>r instanceof FormData,LC=r=>ce(OC,r);function th(r){return r===null||typeof r!="object"}function cc(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function Z_(r){return!H(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var FC=[!0,"true",1,"1","yes"],Pp=r=>ce(FC,r),DC=[!1,"false",0,"0","no"];function Zt(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),yr(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),Zt(i||t,e,t,n))}var rh=class{constructor(e){this.t={},this.i=e.i,this.o=Zt(e.bucketSize,0,100,e.h),this.m=Zt(e.refillRate,0,this.o,e.h),this.$=Zt(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={}}},wt="Mobile",uc="iOS",mr="Android",To="Tablet",G_=mr+" "+To,K_="iPad",Y_="Apple",X_=Y_+" Watch",Io="Safari",Ui="BlackBerry",J_="Samsung",Q_=J_+"Browser",eb=J_+" Internet",Fn="Chrome",HC=Fn+" OS",tb=Fn+" "+uc,df="Internet Explorer",rb=df+" "+wt,pf="Opera",BC=pf+" Mini",hf="Edge",nb="Microsoft "+hf,ji="Firefox",ib=ji+" "+uc,$o="Nintendo",Mo="PlayStation",Wi="Xbox",sb=mr+" "+wt,ob=wt+" "+Io,yo="Windows",nh=yo+" Phone",Qy="Nokia",ih="Ouya",ab="Generic",VC=ab+" "+wt.toLowerCase(),lb=ab+" "+To.toLowerCase(),sh="Konqueror",et="(\\d+(\\.\\d+)?)",Np=new RegExp("Version/"+et),jC=new RegExp(Wi,"i"),WC=new RegExp(Mo+" \\w+","i"),UC=new RegExp($o+" \\w+","i"),ff=new RegExp(Ui+"|PlayBook|BB10","i"),zC={"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"},rc,e_,Lp,qC=(r,e)=>e&&ce(e,Y_)||(function(t){return ce(t,Io)&&!ce(t,Fn)&&!ce(t,mr)})(r),cb=function(r,e){return e=e||"",ce(r," OPR/")&&ce(r,"Mini")?BC:ce(r," OPR/")?pf:ff.test(r)?Ui:ce(r,"IE"+wt)||ce(r,"WPDesktop")?rb:ce(r,Q_)?eb:ce(r,hf)||ce(r,"Edg/")?nb:ce(r,"FBIOS")?"Facebook "+wt:ce(r,"UCWEB")||ce(r,"UCBrowser")?"UC Browser":ce(r,"CriOS")?tb:ce(r,"CrMo")||ce(r,Fn)?Fn:ce(r,mr)&&ce(r,Io)?sb:ce(r,"FxiOS")?ib:ce(r.toLowerCase(),sh.toLowerCase())?sh:qC(r,e)?ce(r,wt)?ob:Io:ce(r,ji)?ji:ce(r,"MSIE")||ce(r,"Trident/")?df:ce(r,"Gecko")?ji:""},ZC={[rb]:[new RegExp("rv:"+et)],[nb]:[new RegExp(hf+"?\\/"+et)],[Fn]:[new RegExp("("+Fn+"|CrMo)\\/"+et)],[tb]:[new RegExp("CriOS\\/"+et)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+et)],[Io]:[Np],[ob]:[Np],[pf]:[new RegExp("(Opera|OPR)\\/"+et)],[ji]:[new RegExp(ji+"\\/"+et)],[ib]:[new RegExp("FxiOS\\/"+et)],[sh]:[new RegExp("Konqueror[:/]?"+et,"i")],[Ui]:[new RegExp(Ui+" "+et),Np],[sb]:[new RegExp("android\\s"+et,"i")],[eb]:[new RegExp(Q_+"\\/"+et)],[df]:[new RegExp("(rv:|MSIE )"+et)],Mozilla:[new RegExp("rv:"+et)]},GC=function(r,e){var t=cb(r,e),n=ZC[t];if(H(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},t_=[[new RegExp(Wi+"; "+Wi+" (.*?)[);]","i"),r=>[Wi,r&&r[1]||""]],[new RegExp($o,"i"),[$o,""]],[new RegExp(Mo,"i"),[Mo,""]],[ff,[Ui,""]],[new RegExp(yo,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[nh,""];if(new RegExp(wt).test(e)&&!/IEMobile\b/.test(e))return[yo+" "+wt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=zC[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[uc,e.join(".")]}return[uc,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=H(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+mr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+mr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[mr,e.join(".")]}return[mr,""]}],[/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/,[HC,""]],[/Linux|debian/i,["Linux",""]]],r_=function(r){return UC.test(r)?$o:WC.test(r)?Mo:jC.test(r)?Wi:new RegExp(ih,"i").test(r)?ih:new RegExp("("+nh+"|WPDesktop)","i").test(r)?nh:/iPad/.test(r)?K_:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?X_:ff.test(r)?Ui:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Qy,"i").test(r)?Qy:/(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(wt).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)?mr:G_:new RegExp("(pda|"+wt+")","i").test(r)?VC:new RegExp(To,"i").test(r)&&!new RegExp(To+" pc","i").test(r)?lb:""},KC=r=>r instanceof Error;function YC(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Lp&&t.length===e_||(e_=t.length,Lp=t.reduce(((n,i)=>{rc||(rc={});var s=rc[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,u=e[i];if(c&&u){n[c]=u,rc[i]=[c,u];break}}return n}),{})),Lp}}var oh=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 Hi((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&ge(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)),V({},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 Hi((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,V({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:YC(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 V({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},zi="?";function ah(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?zi:t,in_app:!0};return H(n)||(s.lineno=n),H(i)||(s.colno=i),s}var ub=(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]:zi,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},XC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,JC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,QC=/\((\S*)(?::(\d+))(?::(\d+))\)/,e1=(r,e)=>{var t=XC.exec(r);if(t){var[,n,i,s]=t;return ah(e,n,zi,+i,+s)}var o=JC.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=QC.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=ub(o[1]||zi,o[2]);return ah(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},t1=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,r1=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,n1=(r,e)=>{var t=t1.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=r1.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]||zi;return[s,i]=ub(s,i),ah(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},n_=/\(error: (.*)\)/,i_=50;function i1(){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(`
1008
+ `),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=n_.test(c)?c.replace(n_,"$1"):c;if(!u.match(/\S*Error: /)){for(var p of t){var h=p(u,r);if(h){o.push(h);break}}if(o.length>=i_)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,i_).map((g=>{return V({},g,{filename:g.filename||(m=v,m[m.length-1]||{}).filename,function:g.function||zi});var m}))})(o)}})("web:javascript",e1,n1)}var lh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Ne(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 cc(e,"DOMException")}isDOMError(e){return cc(e,"DOMError")}},ch=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}},uh=class{constructor(){}match(e){return cc(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}}},s1=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,dh=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(s1);return i&&(t=i[1],n=i[2]),[t,n]}},o1=["fatal","error","warning","log","info","debug"];function db(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 ph=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 Z_(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: "+db(e)}isSeverityLevel(e){return Ne(e)&&!eh(e)&&o1.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(KC(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},hh=class{match(e){return Z_(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+db(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},fh=class{match(e){return th(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}}},gh=class{match(e){return cc(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return th(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(th(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}},pb=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(pr.DEBUG||X.POSTHOG_DEBUG||t)&&!H(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)=>pb(r+" "+i,s)};return n},B=pb("[PostHog.js]"),Ie=B.createLogger,a1=Ie("[ExternalScriptsLoader]"),s_=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return a1.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=D?.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(!D)return t("document not found");var l=D.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")D.head.appendChild(l);else{var c,u=D.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):D.body.appendChild(l)}};D!=null&&D.body?a():D?.addEventListener("DOMContentLoaded",a)};X.__PosthogExtensions__=X.__PosthogExtensions__||{},X.__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);s_(r,s,t)},X.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);s_(r,n,t)};var dc={};function jr(r,e,t){if(ge(r)){if(Gy&&r.forEach===Gy)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)===dc)return}}}function we(r,e,t){if(!ue(r)){if(ge(r))return jr(r,e,t);if(NC(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===dc)return}else for(var i in r)if(q_.call(r,i)&&e.call(t,r[i],i)===dc)return}}var $e=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 jr(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},Zi=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 jr(t,(function(i){jr(i,(function(s){r.push(s)}))})),r};function ac(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 o_=function(r){try{return r()}catch{return}},l1=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){B.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),B.critical(i)}}},gf=function(r){var e={};return we(r,(function(t,n){(Ne(t)&&t.length>0||yr(t))&&(e[n]=t)})),e};function c1(r,e){return t=r,n=s=>Ne(s)&&!Lt(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),ge(o)?(l=[],jr(o,(c=>{l.push(s(c))}))):(l={},we(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var u1=["herokuapp.com","vercel.app","netlify.app"];function d1(r){var e=r?.hostname;if(!Ne(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of u1)if(t===n)return!1;return!0}function hb(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Oe(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var fb="$people_distinct_id",_o="__alias",bo="__timers",a_="$autocapture_disabled_server_side",mh="$heatmaps_enabled_server_side",l_="$exception_capture_enabled_server_side",vh="$error_tracking_suppression_rules",c_="$error_tracking_capture_extension_exceptions",u_="$web_vitals_enabled_server_side",gb="$dead_clicks_enabled_server_side",d_="$product_tours_enabled_server_side",p_="$web_vitals_allowed_metrics",Fp="$session_recording_remote_config",pc="$sesid",mb="$session_is_sampled",Vi="$enabled_feature_flags",xo="$early_access_features",yh="$feature_flag_details",wo="$stored_person_properties",Ln="$stored_group_properties",_h="$surveys",hc="$flag_call_reported",hr="$user_state",bh="$client_session_props",xh="$capture_rate_limit",wh="$initial_campaign_params",kh="$initial_referrer_info",fc="$initial_person_info",gc="$epp",vb="__POSTHOG_TOOLBAR__",lo="$posthog_cookieless",p1=[fb,_o,"__cmpns",bo,"$session_recording_enabled_server_side",mh,pc,Vi,vh,hr,xo,yh,Ln,wo,_h,hc,bh,xh,wh,kh,gc,fc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function h_(r){return r instanceof Element&&(r.id===vb||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Oc(r){return!!r&&r.nodeType===1}function Wr(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function yb(r){return!!r&&r.nodeType===3}function _b(r){return!!r&&r.nodeType===11}function mf(r){return r?$c(r).split(/\s+/):[]}function f_(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function mc(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 mf(e)}function bb(r){return ue(r)?null:$c(r).split(/(\s+)/).filter((e=>Oo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function No(r){var e="";return Sh(r)&&!Eb(r)&&r.childNodes&&r.childNodes.length&&we(r.childNodes,(function(t){var n;yb(t)&&t.textContent&&(e+=(n=bb(t.textContent))!==null&&n!==void 0?n:"")})),$c(e)}function xb(r){return H(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var vf=["a","button","form","input","select","textarea","label"];function wb(r,e){if(H(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 kb(r){var e=r.parentNode;return!(!e||!Oc(e))&&e}var h1=["next","previous","prev",">","<"],g_=10,m_=[".ph-no-rageclick",".ph-no-capture"];function f1(r,e){if(!E||yf(r))return!1;var t,n,i;if(vr(e)?(t=!!e&&m_,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:m_,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=Sb(r,!1);return!(function(o,a){if(o===!1||H(o))return!1;var l;if(o===!0)l=h1;else{if(!ge(o))return!1;if(o.length>g_)return B.error("[PostHog] content_ignorelist array cannot exceed "+g_+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:p}=c;return l.some((h=>u.includes(h)||p.includes(h)))}))})(n,s.map((o=>{var a;return{safeText:No(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!wb(s,t)}var yf=r=>!r||Wr(r,"html")||!Oc(r),Sb=(r,e)=>{if(!E||yf(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!Wr(i,"body");)if(_b(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=kb(i);if(!s)break;if(e||vf.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 g1(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||yf(r)||(s=t)!=null&&s.url_allowlist&&!f_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&f_(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:u,targetElementList:p}=Sb(r,n);if(!(function(v,g){var m=g?.element_allowlist;if(H(m))return!0;var y,x=function(_){if(m.some((w=>_.tagName.toLowerCase()===w)))return{v:!0}};for(var k of v)if(y=x(k))return y.v;return!1})(p,t)||!wb(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 u?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(vf.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Sh(r){for(var e=r;e.parentNode&&!Wr(e,"body");e=e.parentNode){var t=mc(e);if(ce(t,"ph-sensitive")||ce(t,"ph-no-capture"))return!1}if(ce(mc(r),"ph-include"))return!0;var n=r.type||"";if(Ne(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(Ne(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 Eb(r){return!!(Wr(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Wr(r,"select")||Wr(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Cb="(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})",m1=new RegExp("^(?:"+Cb+")$"),v1=new RegExp(Cb),Ab="\\d{3}-?\\d{2}-?\\d{4}",y1=new RegExp("^("+Ab+")$"),_1=new RegExp("("+Ab+")");function Oo(r,e){return e===void 0&&(e=!0),!(ue(r)||Ne(r)&&(r=$c(r),(e?m1:v1).test((r||"").replace(/[- ]/g,""))||(e?y1:_1).test(r)))}function Rb(r){var e=No(r);return Oo(e=(e+" "+Tb(r)).trim())?e:""}function Tb(r){var e="";return r&&r.childNodes&&r.childNodes.length&&we(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=No(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Tb(t)).trim())}catch(s){B.error("[AutoCapture]",s)}})),e}function b1(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=V({},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 ac(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[v_(p.toString())]=v_(h.toString())})),o+=":",o+=ac(c).map((u=>{var[p,h]=u;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:x1(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ac(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 v_(r){return r.replace(/"|\\"/g,'\\"')}function x1(r){var e=r.attr__class;return e?ge(e)?e:mf(e):void 0}var vc=class{constructor(e){this.disabled=e===!1;var t=Pe(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}},yc=r=>{var e=D?.createElement("a");return H(e)?null:(e.href=r,e)},w1=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return we(r,(function(s,o){H(s)||H(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)},_c=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(!ge(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{B.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Lo=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("&"),u=[],p=0;p<c.length;p++){var h=c[p].split("=");ge(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(c[p]))}var f=l;return a!=null&&(f+="?"+u.join("&")),s!=null&&(f+="#"+s),f},bc=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Dp="$copy_autocapture",y_=Ie("[AutoCapture]");function Hp(r,e){return e.length>r?e.slice(0,r)+"...":e}function k1(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Oc(e));return e}function S1(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};vf.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Hp(1024,Rb(r)):s.$el_text=Hp(1024,No(r)));var o=mc(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),we(r.attributes,(function(u){var p;if((!Eb(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&Oo(u.value)&&(p=u.name,!Ne(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=mf(h).join(" ")),s["attr__"+u.name]=Hp(1024,h)}}));for(var a=1,l=1,c=r;c=k1(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function E1(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Wr(u,"body");)_b(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var p,h=[],f={},v=!1,g=!1;if(we(c,(_=>{var w=Sh(_);_.tagName.toLowerCase()==="a"&&(v=_.getAttribute("href"),v=w&&v&&Oo(v)&&v),ce(mc(_),"ph-no-capture")&&(g=!0),h.push(S1(_,s,o,a));var R=(function(b){if(!Sh(b))return{};var A={};return we(b.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var N=$.name.replace("data-ph-capture-attribute-",""),M=$.value;N&&M&&Oo(M)&&(A[N]=M)}})),A})(_);$e(f,R)})),g)return{props:{},explicitNoCapture:g};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Rb(r):h[0].$el_text=No(r)),v){var m,y;h[0].attr__href=v;var x=(m=yc(v))==null?void 0:m.host,k=E==null||(y=E.location)==null?void 0:y.host;x&&k&&x!==k&&(p=v)}return{props:$e({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:b1(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 Eh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new vc(e.config.rageclick),this.C=null}get R(){var e,t,n=Pe(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&&D){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){y_.error("Failed to capture event",i)}};if(Oe(D,"submit",e,{capture:!0}),Oe(D,"change",e,{capture:!0}),Oe(D,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,Dp)};Oe(D,"copy",t,{capture:!0}),Oe(D,"cut",t,{capture:!0})}}}else y_.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({[a_]:!!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=D?.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[a_],i=this.T;if(Lt(i)&&!vr(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=xb(e);yb(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())&&f1(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===Dp;if(i&&g1(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=E1(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===Dp){var c,u=bb(E==null||(c=E.getSelection())==null?void 0:c.toString()),p=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=p}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Vr(D?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return yr(r)&&isFinite(r)&&Math.floor(r)===r});var __="0123456789abcdef",Ch=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+__.charAt(this.bytes[t]>>>4)+__.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}},Ah=class{constructor(){this.A=0,this.j=0,this.D=new Rh}generate(){var e=this.generateOrAbort();if(H(e)){this.A=0;var t=this.generateOrAbort();if(H(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 Ch.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())}},b_,Ib=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&&!H(E.crypto)&&crypto.getRandomValues&&(Ib=r=>crypto.getRandomValues(r));var Rh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Ib(this.N),this.U=0),this.N[this.U++]}},Br=()=>C1().toString(),C1=()=>(b_||(b_=new Ah)).generate(),co="",A1=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function R1(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=D),co)return co;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Br();!co&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";s.cookie=u+";max-age=3",s.cookie.includes(l)&&(s.cookie=u+";max-age=0",co=c)}return co})(r);if(!t){var n=(i=>{var s=i.match(A1);return s?s[0]:""})(r);n!==t&&B.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var qt={H:()=>!!D,B:function(r){B.error("cookieStore error: "+r)},q:function(r){if(D){try{for(var e=r+"=",t=D.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(qt.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(D)try{var s="",o="",a=R1(D.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&&B.warn("cookieStore warning: large cookie, len="+c.length),D.cookie=c,c}catch{return}},V:function(r,e){if(D!=null&&D.cookie)try{qt.G(r,"",-1,e)}catch{return}}},Bp=null,Ae={H:function(){if(!Lt(Bp))return Bp;var r=!0;if(H(E))r=!1;else try{var e="__mplssupport__";Ae.G(e,"xyz"),Ae.q(e)!=='"xyz"'&&(r=!1),Ae.V(e)}catch{r=!1}return r||B.error("localStorage unsupported; falling back to cookie store"),Bp=r,r},B:function(r){B.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Ae.B(e)}return null},W:function(r){try{return JSON.parse(Ae.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Ae.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Ae.B(e)}}},T1=["$device_id","distinct_id",pc,mb,gc,fc],nc={},I1={H:function(){return!0},B:function(r){B.error("memoryStorage error: "+r)},q:function(r){return nc[r]||null},W:function(r){return nc[r]||null},G:function(r,e){nc[r]=e},V:function(r){delete nc[r]}},Pn=null,ze={H:function(){if(!Lt(Pn))return Pn;if(Pn=!0,H(E))Pn=!1;else try{var r="__support__";ze.G(r,"xyz"),ze.q(r)!=='"xyz"'&&(Pn=!1),ze.V(r)}catch{Pn=!1}return Pn},B:function(r){B.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){ze.B(e)}return null},W:function(r){try{return JSON.parse(ze.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){ze.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){ze.B(e)}}},fr=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),Th=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?fr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===fr.DENIED||this.consent===fr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===fr.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 Pp(e)?fr.GRANTED:ce(DC,e)?fr.DENIED:fr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ae:qt;var t=e==="localStorage"?qt:Ae;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Pp(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!hb([ht?.doNotTrack,ht?.msDoNotTrack,X.doNotTrack],(e=>Pp(e)))}},ic=Ie("[Dead Clicks]"),$1=()=>!0,M1=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(gb)),n=r.instance.config.capture_dead_clicks;return vr(n)?n:!!Pe(n)||t},xc=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({[gb]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?ic.error("failed to load script",i):e()}))}et(){var e;if(D){if(!this.tt&&(e=X.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Pe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=X.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(D),ic.info("starting...")}}else ic.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,ic.info("stopping..."))}},uo=Ie("[ExceptionAutocapture]"),Ih=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=X.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=X.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=X.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=X.__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){uo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[l_]),this.dt=new rh({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:uo}),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 Pe(e)?t=V({},t,e):(H(e)?this.ht:e)&&(t=V({},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?(uo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return uo.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({[l_]: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)?uo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function x_(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return Vr(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var $h=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&&(B.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,B.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||x_(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__||x_(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){B.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Oe(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},Vp=Ie("[SegmentIntegration]");function O1(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()||Br();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(hr,"identified")),i()},a=s.user();"then"in a&&Vr(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||Vp.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()||(Vp.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(Vp.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 $b="posthog-js";function Mb(r,e){var{organization:t,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,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)||[],g=v.map((y=>V({},y,{stacktrace:y.stacktrace?V({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((x=>V({},x,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((c=v[0])==null?void 0:c.value)||a.message,$exception_type:(u=v[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:g,$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&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(m),a}}var Mh=class{constructor(e,t,n,i,s,o){this.name=$b,this.setupOnce=function(a){a(Mb(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},P1=E!=null&&E.location?bc(E.location.hash,"__posthog")||bc(location.hash,"state"):null,w_="_postHogToolbarParams",k_=Ie("[Toolbar]"),Hr=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Hr||{}),Oh=class{constructor(e){this.instance=e}yt(e){X.ph_toolbar_state=e}wt(){var e;return(e=X.ph_toolbar_state)!==null&&e!==void 0?e:Hr.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||!D)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=P1||bc(e.hash,"__posthog")||bc(e.hash,"state"),o=s?o_((()=>JSON.parse(atob(decodeURIComponent(s)))))||o_((()=>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(w_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=X.ph_load_toolbar||X.ph_load_editor;!ue(t)&&Vr(t)?t(e,this.instance):k_.warn("No toolbar load function found")}loadToolbar(e){var t=!(D==null||!D.getElementById(vb));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=V({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(w_,JSON.stringify(V({},i,{source:void 0}))),this.wt()===Hr.LOADED)this.xt(i);else if(this.wt()===Hr.UNINITIALIZED){var s;this.yt(Hr.LOADING),(s=X.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return k_.error("[Toolbar] Failed to load",o),void this.yt(Hr.UNINITIALIZED);this.yt(Hr.LOADED),this.xt(i)})),Oe(E,"turbolinks:load",(()=>{this.yt(Hr.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)}},N1=Ie("[TracingHeaders]"),Ph=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;H(this.$t)&&((t=X.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),H(this.St)&&((n=X.__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=X.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return N1.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)}},sc="https?://(.*)",Gi=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],L1=Zi(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Gi),Fo="<masked>",F1=["li_fat_id"];function Ob(r,e,t){if(!D)return{};var n,i=e?Zi([],Gi,t||[]):[],s=Pb(Lo(D.URL,i,Fo),r),o=(n={},we(F1,(function(a){var l=qt.q(a);n[a]=l||null})),n);return $e(o,s)}function Pb(r,e){var t=L1.concat(e||[]),n={};return we(t,(function(i){var s=_c(r,i);n[i]=s||null})),n}function Nb(r){var e=(function(s){return s?s.search(sc+"google.([^/?]*)")===0?"google":s.search(sc+"bing.com")===0?"bing":s.search(sc+"yahoo.com")===0?"yahoo":s.search(sc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Lt(e)){n.$search_engine=e;var i=D?_c(D.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function S_(){return navigator.language||navigator.userLanguage}function Lb(){return D?.referrer||"$direct"}function Fb(r,e){var t=r?Zi([],Gi,e||[]):[],n=qe?.href.substring(0,1e3);return{r:Lb().substring(0,1e3),u:n?Lo(n,t,Fo):void 0}}function Db(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=yc(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=yc(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=Pb(n);$e(i,o)}if(t){var a=Nb(t);$e(i,a)}return i}function Hb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function D1(){try{return new Date().getTimezoneOffset()}catch{return}}function H1(r,e){if(!ot)return{};var t,n,i,s=r?Zi([],Gi,e||[]):[],[o,a]=(function(l){for(var c=0;c<t_.length;c++){var[u,p]=t_[c],h=u.exec(l),f=h&&(Vr(p)?p(h,l):p);if(f)return f}return["",""]})(ot);return $e(gf({$os:o,$os_version:a,$browser:cb(ot,navigator.vendor),$device:r_(ot),$device_type:(n=ot,i=r_(n),i===K_||i===G_||i==="Kobo"||i==="Kindle Fire"||i===lb?To:i===$o||i===Wi||i===Mo||i===ih?"Console":i===X_?"Wearable":i?wt:"Desktop"),$timezone:Hb(),$timezone_offset:D1()}),{$current_url:Lo(qe?.href,s,Fo),$host:qe?.host,$pathname:qe?.pathname,$raw_user_agent:ot.length>1e3?ot.substring(0,997)+"...":ot,$browser_version:GC(ot,navigator.vendor),$browser_language:S_(),$browser_language_prefix:(t=S_(),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:pr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Lr=Ie("[Web Vitals]"),E_=9e5,Nh=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)=>V({},n,{["$web_vitals_"+i.name+"_event"]:V({},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(H(s))Lr.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();H(o)||(ue(n?.name)||ue(n?.value)?Lr.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?Lr.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),H(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=H(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(V({},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=X.__PosthogExtensions__;H(a)||H(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):Lr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[u_]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=Pe(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ue(n)?((t=this._instance.persistence)==null?void 0:t.props[p_])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=Pe(this._instance.config.capture_performance)&&yr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:E_;return 0<e&&e<=6e4?E_:e}get isEnabled(){var e=qe?.protocol;if(e!=="http:"&&e!=="https:")return Lr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Pe(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:vr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return vr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Lr.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[u_]:t}),this._instance.persistence.register({[p_]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=X.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?Lr.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?Zi([],Gi,n||[]):[];return Lo(e,i,Fo)}Lr.error("Could not determine current URL")}},B1=Ie("[Heatmaps]");function C_(r){return Pe(r)&&"clientX"in r&&"clientY"in r&&yr(r.clientX)&&yr(r.clientY)}var Lh=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[mh]),this.rageclicks=new vc(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return Pe(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 ue(this.instance.config.capture_heatmaps)?ue(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;B1.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({[mh]: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"})(D)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&D&&(this.Nt=this.Lt.bind(this),Oe(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Oe(D,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Oe(D,"mousemove",this.zt,{capture:!0}),this.Bt=new xc(this.instance,$1,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Oe(D,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&D&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&D.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&D.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&D.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 u=a;u&&Oc(u)&&!Wr(u,"body");){if(u===c)return!1;if(ce(l,E?.getComputedStyle(u).position))return!0;u=kb(u)}return!1})(xb(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"),!h_(e.target)&&C_(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(V({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!h_(e.target)&&C_(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?Zi([],Gi,i||[]):[],o=Lo(t,s,Fo);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Bi(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},wc=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(B.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:u,maxContentY:p}=s;if(!(H(o)||H(a)||H(l)||H(c)||H(u)||H(p))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),p=Math.ceil(p);var h=o<=1?1:Zt(a/o,0,1,B),f=o<=1?1:Zt(l/o,0,1,B),v=c<=1?1:Zt(u/c,0,1,B),g=c<=1?1:Zt(p/c,0,1,B);i=$e(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:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:g})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};var gr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),kt=Uint8Array,tt=Uint16Array,qi=Uint32Array,_f=new kt([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]),bf=new kt([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]),A_=new kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bb=function(r,e){for(var t=new tt(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new qi(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]},Vb=Bb(_f,2),V1=Vb[0],Fh=Vb[1];V1[28]=258,Fh[258]=28;for(Dh=Bb(bf,0)[1],kc=new tt(32768),ke=0;ke<32768;++ke)Fr=(43690&ke)>>>1|(21845&ke)<<1,Fr=(61680&(Fr=(52428&Fr)>>>2|(13107&Fr)<<2))>>>4|(3855&Fr)<<4,kc[ke]=((65280&Fr)>>>8|(255&Fr)<<8)>>>1;var Fr,Dh,kc,ke,Co=function(r,e,t){for(var n=r.length,i=0,s=new tt(e);i<n;++i)++s[r[i]-1];var o,a=new tt(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new tt(1<<e);var l=15-e;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],u=e-r[i],p=a[r[i]-1]++<<u,h=p|(1<<u)-1;p<=h;++p)o[kc[p]>>>l]=c}else for(o=new tt(n),i=0;i<n;++i)o[i]=kc[a[r[i]-1]++]>>>15-r[i];return o},Dn=new kt(288);for(ke=0;ke<144;++ke)Dn[ke]=8;for(ke=144;ke<256;++ke)Dn[ke]=9;for(ke=256;ke<280;++ke)Dn[ke]=7;for(ke=280;ke<288;++ke)Dn[ke]=8;var Sc=new kt(32);for(ke=0;ke<32;++ke)Sc[ke]=5;var j1=Co(Dn,9,0),W1=Co(Sc,5,0),jb=function(r){return(r/8>>0)+(7&r&&1)},Wb=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof tt?tt:r instanceof qi?qi:kt)(t-e);return n.set(r.subarray(e,t)),n},ur=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},po=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},jp=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 kt(0),0];if(i==1){var o=new kt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(w,R){return w.f-R.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,p=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=t[t[c].f<t[p].f?c++:p++],l=t[c!=u&&t[c].f<t[p].f?c++:p++],t[u++]={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 tt(h+1),v=Hh(t[u-1],f,0);if(v>e){n=0;var g=0,m=v-e,y=1<<m;for(s.sort((function(w,R){return f[R.s]-f[w.s]||w.f-R.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;g+=y-(1<<v-f[x]),f[x]=e}for(g>>>=m;g>0;){var k=s[n].s;f[k]<e?g-=1<<e-f[k]++-1:++n}for(;n>=0&&g;--n){var _=s[n].s;f[_]==e&&(--f[_],++g)}v=e}return[new kt(f),v]},Hh=function(r,e,t){return r.s==-1?Math.max(Hh(r.l,e,t+1),Hh(r.r,e,t+1)):e[r.s]=t},R_=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new tt(++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]},ho=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Bh=function(r,e,t){var n=t.length,i=jb(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)},T_=function(r,e,t,n,i,s,o,a,l,c,u){ur(e,u++,t),++i[256];for(var p=jp(i,15),h=p[0],f=p[1],v=jp(s,15),g=v[0],m=v[1],y=R_(h),x=y[0],k=y[1],_=R_(g),w=_[0],R=_[1],b=new tt(19),A=0;A<x.length;++A)b[31&x[A]]++;for(A=0;A<w.length;++A)b[31&w[A]]++;for(var $=jp(b,7),N=$[0],M=$[1],K=19;K>4&&!N[A_[K-1]];--K);var L,P,q,Y,re=c+5<<3,C=ho(i,Dn)+ho(s,Sc)+o,O=ho(i,h)+ho(s,g)+o+14+3*K+ho(b,N)+(2*b[16]+3*b[17]+7*b[18]);if(re<=C&&re<=O)return Bh(e,u,r.subarray(l,l+c));if(ur(e,u,1+(O<C)),u+=2,O<C){L=Co(h,f,0),P=h,q=Co(g,m,0),Y=g;var Z=Co(N,M,0);for(ur(e,u,k-257),ur(e,u+5,R-1),ur(e,u+10,K-4),u+=14,A=0;A<K;++A)ur(e,u+3*A,N[A_[A]]);u+=3*K;for(var de=[x,w],ae=0;ae<2;++ae){var Le=de[ae];for(A=0;A<Le.length;++A){var xe=31&Le[A];ur(e,u,Z[xe]),u+=N[xe],xe>15&&(ur(e,u,Le[A]>>>5&127),u+=Le[A]>>>12)}}}else L=j1,P=Dn,q=W1,Y=Sc;for(A=0;A<a;++A)if(n[A]>255){xe=n[A]>>>18&31,po(e,u,L[xe+257]),u+=P[xe+257],xe>7&&(ur(e,u,n[A]>>>23&31),u+=_f[xe]);var Ye=31&n[A];po(e,u,q[Ye]),u+=Y[Ye],Ye>3&&(po(e,u,n[A]>>>5&8191),u+=bf[Ye])}else po(e,u,L[n[A]]),u+=P[n[A]];return po(e,u,L[256]),u+P[256]},U1=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),z1=(function(){for(var r=new qi(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),q1=function(r,e,t,n,i){return(function(s,o,a,l,c,u){var p=s.length,h=new kt(l+p+5*(1+Math.floor(p/7e3))+c),f=h.subarray(l,h.length-c),v=0;if(!o||p<8)for(var g=0;g<=p;g+=65535){var m=g+65535;m<p?v=Bh(f,v,s.subarray(g,m)):(f[g]=u,v=Bh(f,v,s.subarray(g,p)))}else{for(var y=U1[o-1],x=y>>>13,k=8191&y,_=(1<<a)-1,w=new tt(32768),R=new tt(_+1),b=Math.ceil(a/3),A=2*b,$=function(Vc){return(s[Vc]^s[Vc+1]<<b^s[Vc+2]<<A)&_},N=new qi(25e3),M=new tt(288),K=new tt(32),L=0,P=0,q=(g=0,0),Y=0,re=0;g<p;++g){var C=$(g),O=32767&g,Z=R[C];if(w[O]=Z,R[C]=O,Y<=g){var de=p-g;if((L>7e3||q>24576)&&de>423){v=T_(s,f,0,N,M,K,P,q,re,g-re,v),q=L=P=0,re=g;for(var ae=0;ae<286;++ae)M[ae]=0;for(ae=0;ae<30;++ae)K[ae]=0}var Le=2,xe=0,Ye=k,St=O-Z&32767;if(de>2&&C==$(g-St))for(var Hc=Math.min(x,de)-1,Yi=Math.min(32767,g),Me=Math.min(258,de);St<=Yi&&--Ye&&O!=Z;){if(s[g+Le]==s[g+Le-St]){for(var Ft=0;Ft<Me&&s[g+Ft]==s[g+Ft-St];++Ft);if(Ft>Le){if(Le=Ft,xe=St,Ft>Hc)break;var h0=Math.min(St,Ft-2),Cf=0;for(ae=0;ae<h0;++ae){var Bc=g-St+ae+32768&32767,Af=Bc-w[Bc]+32768&32767;Af>Cf&&(Cf=Af,Z=Bc)}}}St+=(O=Z)-(Z=w[O])+32768&32767}if(xe){N[q++]=268435456|Fh[Le]<<18|Dh[xe];var Rf=31&Fh[Le],Tf=31&Dh[xe];P+=_f[Rf]+bf[Tf],++M[257+Rf],++K[Tf],Y=g+Le,++L}else N[q++]=s[g],++M[s[g]]}}v=T_(s,f,u,N,M,K,P,q,re,g-re,v)}return Wb(h,0,l+jb(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)},Wp=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Z1(r,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u<l.length;++u)c=z1[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=q1(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&&Wp(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}})(s,e),Wp(s,o-8,t.d()),Wp(s,o-4,n),s}var G1=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
1009
1009
  `).replace(/\r/g,`
1010
- `)).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),Lt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},z1=!!Kp||!!Gp,A_="text/plain",wc=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=V({},e),a=(n=s?.split("&").map((c=>{var u,[p,h]=c.split("="),f=t&&(u=o[p])!==null&&u!==void 0?u:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=y1(o);return l&&a.push(l),i+"?"+a.join("&")},bo=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Vp=r=>{var{data:e,compression:t}=r;if(e){if(t===gr.GZipJS){var n=W1((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new wt(l.length+(l.length>>>1)),h=0,f=function(y){p[h++]=y},v=0;v<u;++v){if(h+5>p.length){var m=new wt(h+8+(u-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 Bb(p,0,h)})(bo(e)),{mtime:0}),i=new Blob([n],{type:A_});return{contentType:A_,body:i,estimatedSize:i.size}}if(t===gr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,y="",x=[];if(!l)return l;l=U1(l);do c=(f=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,u=f>>12&63,p=f>>6&63,h=63&f,x[g++]=v.charAt(c)+v.charAt(u)+v.charAt(p)+v.charAt(h);while(m<l.length);switch(y=x.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})(bo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:bo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=bo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},sc=[];Gp&&sc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Vp(r))!==null&&e!==void 0?e:{},o=new Headers;xe(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(Zy){var c=new Zy;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Gp(a,V({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((u=>u.text().then((p=>{var h={statusCode:u.status,text:p};if(u.status===200)try{h.json=JSON.parse(p)}catch(f){B.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{B.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Kp&&sc.push({transport:"XHR",method:r=>{var e,t=new Kp;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Vp(r))!==null&&e!==void 0?e:{};xe(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)}}),pt!=null&&pt.sendBeacon&&sc.push({transport:"sendBeacon",method:r=>{var e=wc(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Vp(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;pt.sendBeacon(e,s)}catch{}}});var kc=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 R_(r,e,t){return bo({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Vb={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=>kc(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!kc(t,n))))),icontains:(r,e)=>e.map(nc).some((t=>r.map(nc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(nc).every((t=>r.map(nc).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)))}))},nc=r=>r.toLowerCase();function jb(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(H(s)||Lt(s))return!1;var o=[String(s)],a=Vb[i.operator];return!!a&&a(i.values,o)}))}var jp=Ie("[Error tracking]"),Dh=class{constructor(e){var t,n;this.Zt=[],this.ti=new nh([new sh,new ph,new ah,new oh,new uh,new ch,new lh,new dh],e1()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(fh))!==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({[fh]:this.Zt,[o_]:o})}get ii(){var e,t=!!this._instance.get_property(o_),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 jp.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void jp.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void jp.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 Ne(s)&&s.length>0&&n.$exception_types.push(s),Ne(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=Vb[s.operator],l=fe(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!ue(e)&&fe(e)}},dt=Ie("[FeatureFlags]"),uo=Ie("[FeatureFlags]",{debugEnabled:!0}),Wp="$active_feature_flags",Ni="$override_feature_flags",T_="$feature_flag_payloads",po="$override_feature_flag_payloads",I_="$feature_flag_request_id",$_="$feature_flag_evaluated_at",M_=r=>{var e={};for(var[t,n]of ic(r||{}))n&&(e[t]=n);return e},q1=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]})))):dt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},Z1=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),Hh=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||(dt.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||dt.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(gh),t=this._instance.get_property(Ni),n=this._instance.get_property(po);if(!n&&!t)return e||{};var i=$e({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],p=H(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=H(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=V({},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=V({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(dt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Vi),t=this._instance.get_property(Ni);if(!t)return e||{};for(var n=$e({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(dt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(T_),t=this._instance.get_property(po);if(!t)return e||{};for(var n=$e({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(dt.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:V({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(_o)||{}),group_properties:this._instance.get_property(Ln)};Lt(i)||H(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=Lb()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:gr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var p,h,f=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=u.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!f,u.json&&(p=u.json.quotaLimited)!=null&&p.includes(Z1.FeatureFlags))dt.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=u.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}dt.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(I_)||void 0,c=this._instance.get_property($_)||void 0,u=this._instance.get_property(uc)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,m,g,y,x,k;fe(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[uc]:u});var _=this.getFeatureFlagDetails(e),w={$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};H(_==null||(v=_.metadata)==null?void 0:v.version)||(w.$feature_flag_version=_.metadata.version);var R,b=(m=_==null||(g=_.reason)==null?void 0:g.description)!==null&&m!==void 0?m:_==null||(y=_.reason)==null?void 0:y.code;b&&(w.$feature_flag_reason=b),_!=null&&(x=_.metadata)!=null&&x.id&&(w.$feature_flag_id=_.metadata.id),H(_?.original_variant)&&H(_?.original_enabled)||(w.$feature_flag_original_response=H(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(k=_.metadata)!=null&&k.original_payload&&(w.$feature_flag_original_payload=_==null||(R=_.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!H(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else dt.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:gr.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 H(n)?void 0:!!n}dt.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,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var p=q1(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(fe(f)){dt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var x=0;x<f.length;x++)y[f[x]]=!0;a&&a.register({[Wp]:f,[Vi]:y})}else{var k=f,_=v,w=h;if(o.errorsWhileComputingFlags)if(h){var R=new Set(Object.keys(h).filter((b=>{var A;return!((A=h[b])!=null&&A.failed)})));k=V({},l,Object.fromEntries(Object.entries(k).filter((b=>{var[A]=b;return R.has(A)})))),_=V({},c,Object.fromEntries(Object.entries(_||{}).filter((b=>{var[A]=b;return R.has(A)})))),w=V({},u,Object.fromEntries(Object.entries(w||{}).filter((b=>{var[A]=b;return R.has(A)}))))}else k=V({},l,k),_=V({},c,_),w=V({},u,w);a&&a.register(V({[Wp]:Object.keys(M_(k)),[Vi]:k||{},[T_]:_||{},[gh]:w||{}},m?{[I_]:m}:{},g?{[$_]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),dt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return dt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ni),this._instance.persistence.unregister(po),this.wi(),uo.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(Ni),uo.info("Flag overrides cleared");else if(n.flags){if(fe(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[Ni]:i})}else this._instance.persistence.register({[Ni]:n.flags});uo.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(po),uo.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[po]:n.payloads}),uo.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(yo)||[]).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=V({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Wp]:Object.keys(M_(l)),[Vi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(yo),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(yo),(l=this._instance.persistence)==null||l.register({[yo]: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(_o)||{};this._instance.register({[_o]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(_o)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Ln)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=V({},n[i],e[i]),delete e[i]})),this._instance.register({[Ln]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ln)||{};this._instance.register({[Ln]:V({},t,{[e]:{}})})}else this._instance.unregister(Ln)}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}},G1=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],So=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&&B.info("Persistence loaded",e.persistence,V({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){G1.indexOf(e.persistence.toLowerCase())===-1&&(B.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=[...E1,...i];return V({},Ae,{W:function(o){try{var a={};try{a=qt.W(o)||{}}catch{}var l=$e(a,JSON.parse(Ae.q(o)||"{}"));return Ae.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Ae.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&qt.G(o,h,l,c,u,p)}catch(f){Ae.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),qt.V(o,a)}catch(l){Ae.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Ae.H()?Ae:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&ze.H()?ze:n==="memory"?C1:n==="cookie"?qt:t.H()?t:qt}properties(){var e={};return xe(this.props,(function(t,n){if(n===Vi&&Pe(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,(Lt(o=l1)?l:qy&&o.indexOf===qy?o.indexOf(a)!=-1:(xe(o,(function(c){if(l||(l=c===a))return lc})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=$e({},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(Pe(e)){H(t)&&(t="None"),this.Pi=H(n)?this.Ci:n;var i=!1;if(xe(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(Pe(e)){this.Pi=H(t)?this.Ci:t;var n=!1;if(xe(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=Ib(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Bi(pf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=D?.referrer)?Mb(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ob(),$referring_domain:D!=null&&D.referrer&&((e=gc(D.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[_h]||this.props[bh]||this.register_once({[dc]:Pb(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};xe([bh,_h],(o=>{var a=this.props[o];a&&xe(a,(function(l,c){e["$initial_"+Yp(c)]=l}))}));var t,n,i=this.props[dc];if(i){var s=(t=Nb(i),n={},xe(t,(function(o,a){n["$initial_"+Yp(a)]=o})),n);$e(e,s)}return e}safe_merge(e){return xe(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(((u,p)=>u===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[vo]||{};n[e]=t,this.props[vo]=n,this.save()}remove_event_timer(e){var t=(this.props[vo]||{})[e];return H(t)||(delete this.props[vo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},O_=Ie("[Product Tours]"),Up="ph_product_tours",Bh=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[l_]:!(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(l_)||this.it((()=>this.Oi()))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?O_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=X.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=X.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!fe(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[Up];if(fe(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 O_.error(a),void e([],{isLoaded:!1,error:a})}var l=fe(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[Up]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ue(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(Up)}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)}},ho=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),aN=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),lN=(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})({}),cN=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),zp=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),uN=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),dN=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),pN=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),xo=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),qp=(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})({}),Vh=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),be=Ie("[Surveys]"),Wb="seenSurvey_",K1=(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},P_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Wb,r),Y1=[zp.Popover,zp.Widget,zp.API],X1={ignoreConditions:!1,ignoreDelay:!1,displayType:Vh.Popover},$o=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 Li(r,e,t){if(ue(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 jh=class{constructor(e){this.Ai=new $o,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(!H((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(!H((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 u;(u=this.zi)==null||u.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"||!Li(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=>Li(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&Li((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=>Li(c.text,t.text,t.text_matching||"exact")||Li(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 u,p=[],h=/(?::|")text="(.*?)"/g;!ue(u=h.exec(c));)p.includes(u[1])||p.push(u[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>Li(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||jb(t.properties.reduce(((n,i)=>{var s=fe(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)}},Wh=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&jb(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===ho.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;H((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 jh(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 u=this.Xi.get(c.name);u&&u.push(n.id),this.Xi.set(c.name,u||[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,ho.Activation),this.Yi=this.Zi(e,ho.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 u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var p=a.indexOf(u);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,ho.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,ho.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}},Uh=class extends Wh{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return xo.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 be}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},zh=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(ue(t))return be.warn("Flags not loaded yet. Not loading surveys.");var n=fe(t);this.ve=n?t.length>0:t,be.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(Wb)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)be.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)be.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())be.info("Not loading surveys in cookieless mode without consent.");else{var e=X?.__PosthogExtensions__;if(e){if(!H(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 be.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Uh(this._instance),be.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){be.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 be.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(mh);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;be.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,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&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[mh]: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){be.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);be.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(ue(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(ue(this._surveyManager))return be.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 ue(this._surveyManager)?(be.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(ue(this._surveyManager))be.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(Y1.includes(s.type)){var o=D?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(be.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;be.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),be.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);be.warn("Survey element not found")}else be.warn("Surveys of type "+s.type+" cannot be rendered in the app");else be.warn("Survey not found")}}displaySurvey(e,t){var n;if(ue(this._surveyManager))be.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=V({},i,{appearance:V({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Vh.Popover&&t.initialResponses&&be.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 be.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Vh.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?be.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},dr=Ie("[Conversations]"),qh=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;ue(t)||(vr(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=X?.__PosthogExtensions__;if(e&&!H(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 dr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),dr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else dr.error("Cannot complete initialization: remote config is null")}Se(e,t){dr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():dr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Lt(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 Hi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(dr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return Hi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(dr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Hi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(dr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Hi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(dr.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}},Zh=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;!ue(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Ie("[logs]"),t=X?.__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.")}}},N_=Ie("[RateLimiter]"),Gh=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=>{N_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void N_.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(yh))!==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(yh,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Nn=Ie("[RemoteConfig]"),Kh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=X._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Nn.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 Nn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Nn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Nn.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){Nn.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()):Nn.info("__preview_remote_config is disabled. Logging config instead",e):Nn.error("Failed to fetch remote config from PostHog.")}},Yh=3e3,Xh=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Zt(t?.flush_interval_ms||Yh,250,5e3,B.createLogger("flush interval"),Yh),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(V({},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&&fe(s.data)&&xe(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 xe(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;H(e[s])&&(e[s]=V({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},J1=["retriesPerformedSoFar"],Jh=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!H(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Oe(E,"online",this.ze),Oe(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=V_(e,J1);Fi(t)&&(n.url=wc(n.url,{retry_count:t})),this._instance._send_request(V({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(V({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),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(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)"),B.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,H(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(V({},e,{transport:"sendBeacon"}))}catch(t){B.error(t)}this.Re=[]}},Qh=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),u=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(u,(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(){Oe(E,"scroll",this.Ge,{capture:!0}),Oe(E,"scrollend",this.Ge,{capture:!0}),Oe(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=fe(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}},Q1=r=>Pb(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Sc=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({[vh]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||Q1,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[vh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Nb(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 xe(pf(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Yp(n)]=t})),e}},Zp=Ie("[SessionId]"),Ec=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 $o,this.er=(u,p)=>!(!Fi(u)||!Fi(p))&&Math.abs(u-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||Br,this.ar=n||Br;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zt(o,60,36e3,Zp.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=ze.W(this.ur),l=ze.W(this.hr);a&&!l?this.rr=a:ze.V(this.ur),ze.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var p=u.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(u){Zp.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(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&&ze.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&ze.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?ze.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({[cc]:[t,e,n]}))}_r(){var e=this.Xe.props[cc];return fe(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()&&ze.V(this.hr)},Oe(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=Fi(o)&&Math.abs(n-o)>864e5,c=!1,u=!s,p=!u&&!e&&this.er(n,i);u||p||l?(s=this.nr(),a=this.ar(),Zp.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=Fi(i)&&e&&!l?i:n,f=Fi(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:u,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,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)}},eA=["$set_once","$set"],Dr=Ie("[SiteApps]"),ef=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=X._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={},u=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:u[h],type:h,properties:f};var{$set_once:v,$set:m}=e;return{event:V({},V_(e,eA),{properties:V({},e.properties,m?{$set:V({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:V({},(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&&(Dr.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,Dr.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){Dr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){Dr.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){Dr.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 Dr.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 u;X["__$$ph_site_app_"+c]=s._instance,(u=X.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return Dr.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Ub=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Ky(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>Ky(i?.brand,e))))return!0}catch{}return!!r.webdriver},wo=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),L_="i.posthog.com",tf=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("."+L_,".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]=wo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=wo.EU:this.Sr[this.apiHost]=wo.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===wo.CUSTOM)return this.apiHost+t;var n=L_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},tA={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&&kc(e.href,r),not_regex:(r,e)=>!!E&&!kc(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},rf=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);Ne(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(ue(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=mc(e?.search,"__experiment_id"),n=mc(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!ue(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ue(e.conditions)||ue((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||tA[(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(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.utm))return!0;var n=Ib();if(n.utm_source){var i,s,o,a,l,c,u,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=(u=e.conditions)==null||(u=u.utm)==null||!u.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];B.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 pt&&this._instance?Ub(pt,this._instance.config.custom_blocked_useragents):void 0}},rA=Ie("[PostHog ExternalIntegrations]"),nA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},nf=class{constructor(e){this._instance=e}it(e,t){var n;(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return rA.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=X.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(nA[o],(()=>{var u;(u=X.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=X.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=X.__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)}}},sf="[SessionRecording]",fo=Ie(sf),Cc=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 fo.error("started without valid sessionManager"),new Error(sf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(sf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(Pp))==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=!H(Object.assign)&&!H(Array.from);this.Ar&&n?(this.Dr(e),fo.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(X!=null&&(t=X.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=X.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=X.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return fo.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(hb)}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=ue(a)?null:parseFloat(a);ue(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[Pp]:V({enabled:!!o},o,{networkPayloadCapture:V({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:H(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:fo.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):fo.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(Pp);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=X.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=X.__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))}},Eo={},of=()=>{},Di="posthog",zb=!z1&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,F_=r=>{var e;return V({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:a1(D?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:of,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:qe&&Ne(qe?.search)&&qe.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;B.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:Yh},error_tracking:{},_onCapture:of,__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))},D_=r=>{var e={};H(r.process_person)||(e.person_profiles=r.process_person),H(r.xhr_headers)||(e.request_headers=r.xhr_headers),H(r.cookie_name)||(e.persistence_name=r.cookie_name),H(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),H(r.store_google)||(e.save_campaign_params=r.store_google),H(r.verbose)||(e.debug=r.verbose);var t=$e({},e,r);return fe(r.property_blacklist)&&(H(r.property_denylist)?t.property_denylist=r.property_blacklist:fe(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:B.error("Invalid value for property_denylist config: "+r.property_denylist)),t},af=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ac=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 af,this.Br=!1,this.version=pr.LIB_VERSION,this.qr=new $o,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=F_(),this.SentryIntegration=Th,this.sentryIntegration=e=>(function(t,n){var i=Tb(t,n);return{name:Rb,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 Hh(this),this.toolbar=new Ih(this),this.scrollManager=new Qh(this),this.pageViewManager=new _c(this),this.surveys=new zh(this),this.conversations=new qh(this),this.logs=new Zh(this),this.experiments=new rf(this),this.exceptions=new Dh(this),this.rateLimiter=new Gh(this),this.requestRouter=new tf(this),this.consent=new Ch(this),this.externalIntegrations=new nf(this),this.people={set:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>B.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==Di){var i,s=(i=Eo[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),Eo[n]=s,Eo[Di][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),H(e)||Xp(e))return B.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($e({},F_(t.defaults),D_(t),{name:n,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:gr.GZipJS;var s=this.Qr();this.persistence=new So(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new So(V({},this.config,{persistence:"sessionStorage"}),s);var o=V({},this.persistence.props),a=V({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Xh((x=>this.ts(x)),this.config.request_queue_config),this.es=new Jh(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 Ec(this),this.sessionPropsManager=new Sc(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(B.info("Initializing extensions synchronously"),this.rs(l)),pr.DEBUG=pr.DEBUG||this.config.debug,pr.DEBUG&&B.info("Starting in debug mode",{this:this,config:t,thisC:V({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,p=this.config.get_device_id(Br()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(hr,(u=t.bootstrap)!=null&&u.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 k;return!((k=t.bootstrap)==null||(k=k.featureFlags)==null||!k[x])})).reduce(((x,k)=>{var _;return x[k]=((_=t.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[k])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,k)=>{var _,w;return(_=t.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[k]&&(x[k]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[k]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:so,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Br());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(hr,"anonymous")}return Oe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?T1(this,(()=>this.ns())):this.ns(),Vr(this.config._onCapture)&&this.config._onCapture!==of&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&B.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 Rh(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new $h(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new ef(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Cc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new wh(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Bh(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Oh(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Mh(this)})),n.push((()=>{this.exceptionObserver=new Ah(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new yc(this,R1),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){B.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&&B.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!D||!D.body)return B.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=le(e.supportedCompression,gr.GZipJS)?gr.GZipJS:le(e.supportedCompression,gr.Base64)?gr.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),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(n){B.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&qe!=null&&qe.hostname){var e=qe.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 Kh(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()&&jr(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&&(zb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=wc(e.url,{ip:this.config.ip?1:0}),e.headers=V({},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=V({},t);o.timeout=o.timeout||6e4,o.url=wc(o.url,{_:new Date().getTime().toString(),ver:pr.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=sc.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=ub(l,(u=>u.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)})(V({},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=[];jr(e,(a=>{a&&(t=a[0],fe(t)?s.push(a):Vr(a)?a.call(this):fe(a)&&t==="alias"?n.push(a):fe(a)&&t.indexOf("capture")!==-1&&Vr(this[t])?s.push(a):i.push(a))}));var o=function(a,l){jr(a,(function(c){if(fe(c[0])){var u=l;xe(c,(function(p){u=u[p[0]].apply(u,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(!H(e)&&Ne(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&&!Ne(t?.$current_url)&&(B.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=Br(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n?.$set&&(u.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(u.$set_once=f),(u=s1(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,H(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===xo.DISMISSED||e===xo.SENT){var v=t?.[qp.SURVEY_ID],m=t?.[qp.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(P_(p))||localStorage.setItem(P_(p),"true"),u.$set=V({},u.$set,{[K1({id:v,current_iteration:m},e===xo.SENT?"responded":"dismissed")]:!0})}else e===xo.SHOWN&&(u.$set=V({},u.$set,{[qp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=V({},u.properties.$set,u.$set);if(Bi(g)||this.setPersonPropertiesForFlags(g),!ue(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,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),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.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=V({},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=V({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ne(a.distinct_id)&&!yr(a.distinct_id)||Xp(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=N1(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&&$e(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===wo.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=$e(a,c),e==="$pageview"&&D&&(a.title=D.title),!H(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}st&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=$e({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),fe(this.config.property_denylist)?xe(this.config.property_denylist,(function(y){delete a[y]})):B.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&&(B.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=$e({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(B.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Bi(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=V({},i,e),a=V({},s,t),l={};for(var[c,u]of Object.entries(o)){var p=typeof u=="string";l[c]={key:c,enabled:!!p||!!u,variant:p?u:void 0,reason:void 0,metadata:H(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=X1),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 B.uninitializedWarning("posthog.identify");if(yr(e)&&(e=e.toString(),B.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()))B.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!==so){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(mo)&&(this.unregister(mo),this.register({distinct_id:e}));var o=(this.persistence.get_property(hr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(hr,"identified"),this.setPersonPropertiesForFlags(V({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=R_(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(uc))}}else B.critical('The string "'+so+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=R_(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(V({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):B.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:V({},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 B.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(B.info("reset"),!this.__loaded)return B.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(hr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:so,$device_id:null},"");else{var a=this.config.get_device_id(Br());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(db)?(B.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(mo,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=V({},this.config);if(Pe(e)){var n,i,s,o,a,l,c;$e(this.config,D_(e));var u=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new So(V({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);vr(p)&&(this.config.debug=p),vr(this.config.debug)&&(this.config.debug?(pr.DEBUG=!0,Ae.H()&&Ae.G("ph_debug","true"),B.info("set_config",{config:e,oldConfig:t,newConfig:V({},this.config)})):(pr.DEBUG=!1,Ae.H()&&Ae.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(V({},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:Di;return t!==Di&&(t=Di+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(hr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(hr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Bi(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[mo])&&((t=this.persistence)==null||(t=t.props)==null||!t[pc]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(pc,!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 Ec(this),this.pageViewManager=new _c(this),this.persistence&&(this.sessionPropsManager=new Sc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Cc(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(),(H(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 B.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:so,$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())):B.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===fr.GRANTED?"granted":e===fr.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 pt?Ub(pt,this.config.custom_blocked_useragents):void 0}hs(){D&&(D.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:D.title},{send_instantly:!0}),this.Gr&&(D.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Oe(D,"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?(B.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=B,o=(t="advanced_disable_flags")in(e=l)&&!ue(e[t]),a=n in e&&!ue(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(ue(this.config.before_send))return e;var t=fe(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ue(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return MC(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}n.properties&&!Bi(n.properties)||B.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=vr(e)&&!e,n=Ae.H()&&Ae.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=i1(r.prototype[e[t]])})(Ac,["identify"]);var H_;var qb=(H_=Eo[Di]=new Ac,(function(){function r(){r.done||(r.done=!0,zb=!1,xe(Eo,(function(e){e._dom_loaded()})))}D!=null&&D.addEventListener?D.readyState==="complete"?r():Oe(D,"DOMContentLoaded",r,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),H_);var yf=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},a=qb.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],u=typeof c=="string"?c:c?.event,p=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,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)}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 $c(r={}){return new yf(r)}var Zb={posthog:r=>$c(r),noop:()=>Jl()};function Gb(r,e){let t=Zb[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Zb).join(", ")}`);return t(e)}async function Kb(r){Uu(),z("Syntro Bootstrap","====== INIT ======"),z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=ul();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",js()),console.log("[DIAG] editorConf:",cl()),z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let C=!!window.__SYNTRO_EDITOR_PARAMS__,P=!!window.__SYNTRO_AUDIT_LEGEND__,G=!!window.__SYNTRO_REVIEW_DATA__;if(C||P||G){let pe=[C&&"__SYNTRO_EDITOR_PARAMS__",P&&"__SYNTRO_AUDIT_LEGEND__",G&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${pe.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 P=cl()?.syntro_token;P?.startsWith("syn_")&&(t=P,z("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))z("Syntro Bootstrap","Token starts with syn_, decoding..."),n=xi(t),Uu(n.d);else if(e)z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Za("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Za("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)z("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw Za("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=bt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||bt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=bt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||bt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th,o=bt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||bt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||bt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||bt("VITE_SYNTRO_GEO_HOST")||Vv,l=Dv(),c=Kd(),u=r.appSignalsInit??{},p={...c,...l,...u};z("Syntro Bootstrap","Phase 1: Browser metadata:",c),z("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&z("Syntro Bootstrap","Phase 1: App signals:",u);let h=Yd(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(C=>{let P=setTimeout(()=>{window.removeEventListener("message",G),C(null)},500);function G(pe){let ce=pe.data;ce?.jsonrpc==="2.0"&&ce?.id===1&&ce?.result?.hostInfo&&(clearTimeout(P),window.removeEventListener("message",G),C(ce.result.hostInfo))}window.addEventListener("message",G);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(P),window.removeEventListener("message",G),C(null)}})})(),v,m=r.debug||r.testMode,g=wi({debug:r.debug,history:m?new ki(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=Vu({elementResolver:typeof window<"u"?(C,P)=>{let G=document.elementFromPoint(C,P);if(!G)return null;let pe={tag_name:G.tagName.toLowerCase()};G.id&&(pe.attr__id=G.id),G.className&&typeof G.className=="string"&&(pe.classes=G.className.split(" ").filter(Boolean));for(let ce of G.attributes)ce.name.startsWith("data-")&&(pe[`attr__${ce.name}`]=ce.value);return pe}:void 0});y.onEvent(C=>g.publishEvent(C)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",C=>{let P=[],G=C.target;for(;G&&G!==document.body;){let pe={tag_name:G.tagName.toLowerCase()};for(let ce of G.attributes)(ce.name.startsWith("data-")||ce.name==="id"||ce.name==="class"||ce.name==="aria-label")&&(pe[`attr__${ce.name}`]=ce.value);P.push(pe),G=G.parentElement}y.enrichClickAttributes(Date.now(),P)},!0));let x=Ly(),k,_=C=>{z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let P=Bv(C);if(z("Syntro Bootstrap","Segment flags from PostHog:",P),Hv(P),v){let G=R?.getAll?.()??{},pe={...c,...G,...P,...u};z("Syntro Bootstrap","Updating GrowthBook with attributes:",pe),v.setAttributes?.(pe)}if(k&&w?.getDistinctId){let G=w.getDistinctId();G&&s&&n?.t&&k.updateContext({distinctId:G,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let C=n.t==="noop"?"noop":"posthog";w=Gb(C,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:_,onCapture:(G,pe)=>{y.ingest({kind:"posthog",event:G,properties:pe,timestamp:Date.now()})},onRRWebEvent:G=>{y.ingest(G)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${C}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),z("Syntro Bootstrap","Tracked app signals event:",u));let P=w;if(g.setPosthogCapture((G,pe)=>{P.track?.(G,pe)}),x?.name==="shopify"&&s)try{k=new Fl({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(G){Je("Syntro Bootstrap","ShopifyPixelBridge init failed",G)}}let R;n?.e&&(v=Iy("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(C,P,G)=>{w.trackExperiment(C,P,G)}:void 0})),R=Pl({experiments:v,onMetricChange:(C,P)=>{z("Syntro Bootstrap",`Session metric changed: ${C} = ${P}`)}}),z("Syntro Bootstrap","SessionMetricTracker created");let b="production";e==="editor"?b="editor":e==="audit"?b="audit":bt("NODE_ENV")==="development"&&(b="development");let A=Xl({telemetry:w,sessionMetrics:R,mode:b,events:g});z("Syntro Bootstrap","Runtime created:",{version:A.version,mode:A.mode,hasContext:!!A.context,hasEvents:!!A.events,hasState:!!A.state}),z("Syntro Bootstrap","Core app executors already registered");let $=r.cdnBase||bt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||bt("VITE_SYNTRO_CDN_BASE")||jv()||"https://cdn.syntrologie.com",N=mu({cdnBase:$,registry:A.apps,onLoadStart:C=>{z("Syntro Bootstrap",`Loading app from CDN: ${C}`)},onLoadEnd:(C,P,G)=>{P?z("Syntro Bootstrap",`App loaded successfully: ${C}`):Je("Syntro Bootstrap",`Failed to load app: ${C}`,G)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:A.apps,appLoader:N,runtime:A,version:A.version},z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&N.loadApp("adaptive-mcp").catch(C=>{z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",C)});let M=A.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${M.length} apps in registry:`,M.map(C=>`${C.manifest.id}(${C.state})`).join(", "));for(let C of M)if(C.state==="registered")try{await A.apps.activate(C.manifest.id),console.log(`[DIAG] Activated: ${C.manifest.id} \u2192 widgets: [${A.widgets.list().join(", ")}]`)}catch(P){console.error(`[DIAG] FAILED to activate: ${C.manifest.id}`,P),Je("Syntro Bootstrap",`Failed to auto-activate built-in app: ${C.manifest.id}`,P)}if(console.log(`[DIAG] Activation complete. Total widgets: [${A.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),z("Syntro Bootstrap","GrowthBook features loaded")}catch(C){Je("Syntro Bootstrap","Failed to load GrowthBook features:",C)}let K=await h;if(v&&Object.keys(K).length>0){let C={...c,...K,...u};z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",K),v.setAttributes?.(C)}let L=await f;L&&v&&(c.surface_type="mcp-app",c.surface_host=L.name,v.setAttributes?.({...c,...K}),z("Syntro Bootstrap","MCP App detected:",L.name));let O;if(r.fetcher)O=r.fetcher;else if(n?.f){let C=Py(n.f,n.o??{});O=async()=>{let P=await C.fetch();return{...P.config,tiles:P.config.tiles??[]}}}else v&&(O=wn({experiments:v}));let q=new Set,Y=O?async()=>{let C=await O(),P=C.tiles?.length??0,G=C.actions?.length??0,pe=C.meta?.variant_id;if((P>0||G>0)&&(pe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&pe){let Ee=new Pi(w,pe);Ee.trackServed(P,G),typeof window<"u"&&(window.SynOS.interventionTracker=Ee),A.navigation.subscribe(()=>{Ee.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${C.tiles?.length??0},`,`actions=${C.actions?.length??0},`,`theme=${C.theme?.name??"none"}`),C.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",C.actions.map((Ee,kt)=>`[${kt}] ${Ee.kind}${Ee.anchorId?` anchor="${Ee.anchorId.selector}"`:""}${Ee.label?` "${Ee.label}"`:""}`).join(", "));let ce=C,Ve=N.getRequiredApps(ce);return Ve.length>0?console.log("[Syntro Bootstrap] Required external apps:",Ve.join(", ")):z("Syntro Bootstrap","No external apps required (all executors are built-in)"),Ve.length>0&&await N.loadAppsForConfig(ce).then(async kt=>{let St=kt.filter(Me=>Me.success),Lc=kt.filter(Me=>!Me.success);St.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${St.map(Me=>Me.appId).join(", ")}`);let Yi=Lc.filter(Me=>!q.has(Me.appId));Yi.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",Yi.map(Me=>`${Me.appId} (${Me.error})`).join(", ")),Yi.forEach(Me=>q.add(Me.appId)));for(let Me of Ve)if(A.apps.has(Me))try{await A.apps.activate(Me),console.log(`[Syntro Bootstrap] App activated: ${Me}`)}catch(Ft){console.error(`[Syntro Bootstrap] Failed to activate app: ${Me}`,Ft)}else console.error(`[Syntro Bootstrap] App "${Me}" required by config but NOT registered.`,`Available apps: [${Array.from(A.apps.list?.()??[]).join(", ")}]`)}),C}:void 0;if(x){z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(C){Je("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,C)}}return{canvas:await dl({...r.canvas,fetcher:Y,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:A}),runtime:A,experiments:v,telemetry:w,sessionMetrics:R,appLoader:N}}async function iA(r){try{return await Kb(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function sA(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 oA(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 _f={init:iA,loadAdaptive:oA,encodeToken:pl,decodeToken:xi,events:{emit:sA}};typeof window<"u"&&(window.Syntro=_f);function Ki(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function aA(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=Ki(i),o=Ki(ir);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${ir}. 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${ir}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:lA(n,i)}):{valid:!0,warnings:e,errors:t}}function lA(r,e){let t={...r};return Ki(e).major===1&&(t=cA(t)),t.schemaVersion=ir,t}function cA(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 uA(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=Ki(t),i=Ki(ir);return n.major<i.major||!e.schemaVersion}var Yb=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),Xb=d.object({url:d.string(),ts:d.number()}),Jb=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(Xb).optional()}),Qb=d.object({width:d.number(),height:d.number()}),e0=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),t0=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:e0.optional()}),r0=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),n0=d.object({page:Yb,session:Jb,viewport:Qb,anchors:d.array(t0).optional(),augmented:r0.optional()});function dA(r){return n0.safeParse(r)}var Mc=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 Oc=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 Pc=class{constructor(e,t,n,i){this._host=e,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 bf=d.enum(["posthog","canvas","derived"]),i0=d.object({ts:d.number(),name:d.string(),source:bf,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),s0=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(bf).optional()});function pA(r){return i0.safeParse(r)}function hA(r){return s0.safeParse(r)}var xf=d.union([d.object({type:d.literal("data"),key:d.string(),value:d.string().optional()}),d.object({type:d.literal("css"),value:d.string()}),d.object({type:d.literal("aria"),role:d.string().optional(),label:d.string().optional()}),d.object({type:d.literal("shadow-css"),value:d.string()}),d.object({type:d.literal("ref"),el:d.any()})]),o0=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:xf,content:d.object({title:d.string().optional(),body:d.string()}),placement:d.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:d.number().optional(),blocking:d.boolean().optional(),trigger:d.enum(["immediate","hover","click"]).optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),a0=d.object({kind:d.literal("highlight"),id:d.string(),anchor:xf,copy:d.string().optional(),ring:d.object({paddingPx:d.number().optional(),radiusPx:d.number().optional()}).optional(),scrim:d.object({opacity:d.number().optional()}).optional(),ringColor:d.string().optional(),blocking:d.boolean().optional(),dismiss:d.object({onClickOutside:d.boolean().optional(),onEsc:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),Nc=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([o0,a0]))});function fA(r){return Nc.parse(r)}var gA=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Ka({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 Nc.parse(o)};var l0=d.object({value:d.unknown(),expiresAt:d.number().optional()}),c0=d.object({count:d.number(),resetAt:d.number().optional()});function mA(r){return l0.safeParse(r)}function vA(r){return c0.safeParse(r)}var wf="2026-04-27T21:12:51.466Z (2ae6c4be4f5)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${wf} (Lit)`);let r=window.SynOS,e=r?.appRegistry||ys;window.SynOS={...r,appRegistry:e,_runtimeBuild:wf,_renderer:"lit"},Ns(),Ym(e)}return m0(yA);})();
1010
+ `)).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),Lt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},K1=!!Jp||!!Xp,I_="text/plain",Ec=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=V({},e),a=(n=s?.split("&").map((c=>{var u,[p,h]=c.split("="),f=t&&(u=o[p])!==null&&u!==void 0?u:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=w1(o);return l&&a.push(l),i+"?"+a.join("&")},ko=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Up=r=>{var{data:e,compression:t}=r;if(e){if(t===gr.GZipJS){var n=Z1((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new kt(l.length+(l.length>>>1)),h=0,f=function(y){p[h++]=y},v=0;v<u;++v){if(h+5>p.length){var g=new kt(h+8+(u-v<<1));g.set(p),p=g}var m=l.charCodeAt(v);m<128||c?f(m):m<2048?(f(192|m>>>6),f(128|63&m)):m>55295&&m<57344?(f(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),f(128|m>>>12&63),f(128|m>>>6&63),f(128|63&m)):(f(224|m>>>12),f(128|m>>>6&63),f(128|63&m))}return Wb(p,0,h)})(ko(e)),{mtime:0}),i=new Blob([n],{type:I_});return{contentType:I_,body:i,estimatedSize:i.size}}if(t===gr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,y="",x=[];if(!l)return l;l=G1(l);do c=(f=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,u=f>>12&63,p=f>>6&63,h=63&f,x[m++]=v.charAt(c)+v.charAt(u)+v.charAt(p)+v.charAt(h);while(g<l.length);switch(y=x.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})(ko(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:ko(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ko(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},lc=[];Xp&&lc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Up(r))!==null&&e!==void 0?e:{},o=new Headers;we(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(Yy){var c=new Yy;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Xp(a,V({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((u=>u.text().then((p=>{var h={statusCode:u.status,text:p};if(u.status===200)try{h.json=JSON.parse(p)}catch(f){B.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{B.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Jp&&lc.push({transport:"XHR",method:r=>{var e,t=new Jp;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Up(r))!==null&&e!==void 0?e:{};we(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)}}),ht!=null&&ht.sendBeacon&&lc.push({transport:"sendBeacon",method:r=>{var e=Ec(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Up(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;ht.sendBeacon(e,s)}catch{}}});var Cc=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 $_(r,e,t){return ko({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Ub={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=>Cc(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Cc(t,n))))),icontains:(r,e)=>e.map(oc).some((t=>r.map(oc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(oc).every((t=>r.map(oc).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)))}))},oc=r=>r.toLowerCase();function zb(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(H(s)||Lt(s))return!1;var o=[String(s)],a=Ub[i.operator];return!!a&&a(i.values,o)}))}var zp=Ie("[Error tracking]"),Vh=class{constructor(e){var t,n;this.Zt=[],this.ti=new oh([new lh,new gh,new uh,new ch,new hh,new ph,new dh,new fh],i1()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(vh))!==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({[vh]:this.Zt,[c_]:o})}get ii(){var e,t=!!this._instance.get_property(c_),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 zp.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void zp.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void zp.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 Ne(s)&&s.length>0&&n.$exception_types.push(s),Ne(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=Ub[s.operator],l=ge(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!ue(e)&&ge(e)}},pt=Ie("[FeatureFlags]"),fo=Ie("[FeatureFlags]",{debugEnabled:!0}),qp="$active_feature_flags",Ni="$override_feature_flags",M_="$feature_flag_payloads",go="$override_feature_flag_payloads",O_="$feature_flag_request_id",P_="$feature_flag_evaluated_at",N_=r=>{var e={};for(var[t,n]of ac(r||{}))n&&(e[t]=n);return e},Y1=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]})))):pt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},X1=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),jh=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||(pt.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||pt.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(yh),t=this._instance.get_property(Ni),n=this._instance.get_property(go);if(!n&&!t)return e||{};var i=$e({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],p=H(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=H(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=V({},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=V({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(pt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(Vi),t=this._instance.get_property(Ni);if(!t)return e||{};for(var n=$e({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(pt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(M_),t=this._instance.get_property(go);if(!t)return e||{};for(var n=$e({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(pt.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:V({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(wo)||{}),group_properties:this._instance.get_property(Ln)};Lt(i)||H(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=Hb()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:gr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var p,h,f=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((h=u.json)!==null&&h!==void 0?h:{})),!s.disable_flags||this.hi)if(this.vi=!f,u.json&&(p=u.json.quotaLimited)!=null&&p.includes(X1.FeatureFlags))pt.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=u.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}pt.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(O_)||void 0,c=this._instance.get_property(P_)||void 0,u=this._instance.get_property(hc)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,g,m,y,x,k;ge(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[hc]:u});var _=this.getFeatureFlagDetails(e),w={$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};H(_==null||(v=_.metadata)==null?void 0:v.version)||(w.$feature_flag_version=_.metadata.version);var R,b=(g=_==null||(m=_.reason)==null?void 0:m.description)!==null&&g!==void 0?g:_==null||(y=_.reason)==null?void 0:y.code;b&&(w.$feature_flag_reason=b),_!=null&&(x=_.metadata)!=null&&x.id&&(w.$feature_flag_id=_.metadata.id),H(_?.original_variant)&&H(_?.original_enabled)||(w.$feature_flag_original_response=H(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(k=_.metadata)!=null&&k.original_payload&&(w.$feature_flag_original_payload=_==null||(R=_.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!H(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else pt.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:gr.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 H(n)?void 0:!!n}pt.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,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var p=Y1(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var g=o.requestId,m=o.evaluatedAt;if(ge(f)){pt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var x=0;x<f.length;x++)y[f[x]]=!0;a&&a.register({[qp]:f,[Vi]:y})}else{var k=f,_=v,w=h;if(o.errorsWhileComputingFlags)if(h){var R=new Set(Object.keys(h).filter((b=>{var A;return!((A=h[b])!=null&&A.failed)})));k=V({},l,Object.fromEntries(Object.entries(k).filter((b=>{var[A]=b;return R.has(A)})))),_=V({},c,Object.fromEntries(Object.entries(_||{}).filter((b=>{var[A]=b;return R.has(A)})))),w=V({},u,Object.fromEntries(Object.entries(w||{}).filter((b=>{var[A]=b;return R.has(A)}))))}else k=V({},l,k),_=V({},c,_),w=V({},u,w);a&&a.register(V({[qp]:Object.keys(N_(k)),[Vi]:k||{},[M_]:_||{},[yh]:w||{}},g?{[O_]:g}:{},m?{[P_]:m}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),pt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return pt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ni),this._instance.persistence.unregister(go),this.wi(),fo.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(Ni),fo.info("Flag overrides cleared");else if(n.flags){if(ge(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[Ni]:i})}else this._instance.persistence.register({[Ni]:n.flags});fo.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(go),fo.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[go]:n.payloads}),fo.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(xo)||[]).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=V({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[qp]:Object.keys(N_(l)),[Vi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(xo),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(xo),(l=this._instance.persistence)==null||l.register({[xo]: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(wo)||{};this._instance.register({[wo]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(wo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Ln)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=V({},n[i],e[i]),delete e[i]})),this._instance.register({[Ln]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ln)||{};this._instance.register({[Ln]:V({},t,{[e]:{}})})}else this._instance.unregister(Ln)}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}},J1=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ao=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&&B.info("Persistence loaded",e.persistence,V({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){J1.indexOf(e.persistence.toLowerCase())===-1&&(B.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=[...T1,...i];return V({},Ae,{W:function(o){try{var a={};try{a=qt.W(o)||{}}catch{}var l=$e(a,JSON.parse(Ae.q(o)||"{}"));return Ae.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Ae.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&qt.G(o,h,l,c,u,p)}catch(f){Ae.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),qt.V(o,a)}catch(l){Ae.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Ae.H()?Ae:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&ze.H()?ze:n==="memory"?I1:n==="cookie"?qt:t.H()?t:qt}properties(){var e={};return we(this.props,(function(t,n){if(n===Vi&&Pe(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,(Lt(o=p1)?l:Ky&&o.indexOf===Ky?o.indexOf(a)!=-1:(we(o,(function(c){if(l||(l=c===a))return dc})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=$e({},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(Pe(e)){H(t)&&(t="None"),this.Pi=H(n)?this.Ci:n;var i=!1;if(we(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(Pe(e)){this.Pi=H(t)?this.Ci:t;var n=!1;if(we(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=Ob(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Bi(gf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=D?.referrer)?Nb(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Lb(),$referring_domain:D!=null&&D.referrer&&((e=yc(D.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[wh]||this.props[kh]||this.register_once({[fc]:Fb(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};we([kh,wh],(o=>{var a=this.props[o];a&&we(a,(function(l,c){e["$initial_"+Qp(c)]=l}))}));var t,n,i=this.props[fc];if(i){var s=(t=Db(i),n={},we(t,(function(o,a){n["$initial_"+Qp(a)]=o})),n);$e(e,s)}return e}safe_merge(e){return we(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(((u,p)=>u===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[bo]||{};n[e]=t,this.props[bo]=n,this.save()}remove_event_timer(e){var t=(this.props[bo]||{})[e];return H(t)||(delete this.props[bo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},L_=Ie("[Product Tours]"),Zp="ph_product_tours",Wh=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[d_]:!(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(d_)||this.it((()=>this.Oi()))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?L_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=X.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=X.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!ge(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[Zp];if(ge(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 L_.error(a),void e([],{isLoaded:!1,error:a})}var l=ge(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[Zp]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ue(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(Zp)}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)}},mo=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),dN=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),pN=(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})({}),hN=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),Gp=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),fN=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),gN=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),mN=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),So=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Kp=(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})({}),Uh=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),be=Ie("[Surveys]"),qb="seenSurvey_",Q1=(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},F_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(qb,r),eA=[Gp.Popover,Gp.Widget,Gp.API],tA={ignoreConditions:!1,ignoreDelay:!1,displayType:Uh.Popover},Po=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 Li(r,e,t){if(ue(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 zh=class{constructor(e){this.Ai=new Po,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(!H((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(!H((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 u;(u=this.zi)==null||u.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"||!Li(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=>Li(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&Li((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=>Li(c.text,t.text,t.text_matching||"exact")||Li(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 u,p=[],h=/(?::|")text="(.*?)"/g;!ue(u=h.exec(c));)p.includes(u[1])||p.push(u[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>Li(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||zb(t.properties.reduce(((n,i)=>{var s=ge(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)}},qh=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&zb(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===mo.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;H((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 zh(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 u=this.Xi.get(c.name);u&&u.push(n.id),this.Xi.set(c.name,u||[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,mo.Activation),this.Yi=this.Zi(e,mo.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 u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var p=a.indexOf(u);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,mo.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var g=a.indexOf(v.id);g>=0&&a.splice(g,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,mo.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}},Zh=class extends qh{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return So.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 be}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Gh=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(ue(t))return be.warn("Flags not loaded yet. Not loading surveys.");var n=ge(t);this.ve=n?t.length>0:t,be.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(qb)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)be.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)be.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())be.info("Not loading surveys in cookieless mode without consent.");else{var e=X?.__PosthogExtensions__;if(e){if(!H(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 be.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Zh(this._instance),be.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){be.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 be.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(_h);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;be.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,p=s.json.surveys||[],h=p.filter((v=>(function(g){return!(!g.start_date||g.end_date)})(v)&&((function(g){var m;return!((m=g.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(g){var m;return!((m=g.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[_h]: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){be.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);be.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(ue(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(ue(this._surveyManager))return be.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 ue(this._surveyManager)?(be.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(ue(this._surveyManager))be.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(eA.includes(s.type)){var o=D?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(be.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;be.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),be.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);be.warn("Survey element not found")}else be.warn("Surveys of type "+s.type+" cannot be rendered in the app");else be.warn("Survey not found")}}displaySurvey(e,t){var n;if(ue(this._surveyManager))be.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=V({},i,{appearance:V({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Uh.Popover&&t.initialResponses&&be.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 be.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Uh.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?be.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},dr=Ie("[Conversations]"),Kh=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;ue(t)||(vr(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=X?.__PosthogExtensions__;if(e&&!H(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 dr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),dr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else dr.error("Cannot complete initialization: remote config is null")}Se(e,t){dr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():dr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Lt(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 Hi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(dr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return Hi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(dr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Hi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(dr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Hi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(dr.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}},Yh=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;!ue(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Ie("[logs]"),t=X?.__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.")}}},D_=Ie("[RateLimiter]"),Xh=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=>{D_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void D_.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(xh))!==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(xh,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Nn=Ie("[RemoteConfig]"),Jh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=X._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Nn.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 Nn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Nn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Nn.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){Nn.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()):Nn.info("__preview_remote_config is disabled. Logging config instead",e):Nn.error("Failed to fetch remote config from PostHog.")}},Qh=3e3,ef=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Zt(t?.flush_interval_ms||Qh,250,5e3,B.createLogger("flush interval"),Qh),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(V({},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&&ge(s.data)&&we(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 we(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;H(e[s])&&(e[s]=V({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},rA=["retriesPerformedSoFar"],tf=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!H(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Oe(E,"online",this.ze),Oe(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=U_(e,rA);Fi(t)&&(n.url=Ec(n.url,{retry_count:t})),this._instance._send_request(V({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(V({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),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(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)"),B.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,H(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(V({},e,{transport:"sendBeacon"}))}catch(t){B.error(t)}this.Re=[]}},rf=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),u=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(u,(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(){Oe(E,"scroll",this.Ge,{capture:!0}),Oe(E,"scrollend",this.Ge,{capture:!0}),Oe(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=ge(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}},nA=r=>Fb(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Ac=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({[bh]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||nA,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[bh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Db(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 we(gf(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Qp(n)]=t})),e}},Yp=Ie("[SessionId]"),Rc=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 Po,this.er=(u,p)=>!(!Fi(u)||!Fi(p))&&Math.abs(u-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||Br,this.ar=n||Br;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zt(o,60,36e3,Yp.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=ze.W(this.ur),l=ze.W(this.hr);a&&!l?this.rr=a:ze.V(this.ur),ze.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var p=u.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(u){Yp.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(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&&ze.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&ze.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?ze.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({[pc]:[t,e,n]}))}_r(){var e=this.Xe.props[pc];return ge(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()&&ze.V(this.hr)},Oe(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=Fi(o)&&Math.abs(n-o)>864e5,c=!1,u=!s,p=!u&&!e&&this.er(n,i);u||p||l?(s=this.nr(),a=this.ar(),Yp.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=Fi(i)&&e&&!l?i:n,f=Fi(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:u,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,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)}},iA=["$set_once","$set"],Dr=Ie("[SiteApps]"),nf=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=X._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={},u=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:u[h],type:h,properties:f};var{$set_once:v,$set:g}=e;return{event:V({},U_(e,iA),{properties:V({},e.properties,g?{$set:V({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},g)}:{},v?{$set_once:V({},(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&&(Dr.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,Dr.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){Dr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){Dr.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){Dr.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 Dr.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 u;X["__$$ph_site_app_"+c]=s._instance,(u=X.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return Dr.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Zb=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Jy(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>Jy(i?.brand,e))))return!0}catch{}return!!r.webdriver},Eo=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),H_="i.posthog.com",sf=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("."+H_,".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]=Eo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Eo.EU:this.Sr[this.apiHost]=Eo.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===Eo.CUSTOM)return this.apiHost+t;var n=H_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},sA={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&&Cc(e.href,r),not_regex:(r,e)=>!!E&&!Cc(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},of=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);Ne(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(ue(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=_c(e?.search,"__experiment_id"),n=_c(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!ue(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ue(e.conditions)||ue((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||sA[(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(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.utm))return!0;var n=Ob();if(n.utm_source){var i,s,o,a,l,c,u,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,g=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return h&&v&&g&&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];B.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 ht&&this._instance?Zb(ht,this._instance.config.custom_blocked_useragents):void 0}},oA=Ie("[PostHog ExternalIntegrations]"),aA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},af=class{constructor(e){this._instance=e}it(e,t){var n;(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return oA.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=X.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(aA[o],(()=>{var u;(u=X.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=X.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=X.__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)}}},lf="[SessionRecording]",vo=Ie(lf),Tc=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 vo.error("started without valid sessionManager"),new Error(lf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(lf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(Fp))==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=!H(Object.assign)&&!H(Array.from);this.Ar&&n?(this.Dr(e),vo.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(X!=null&&(t=X.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=X.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=X.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return vo.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(mb)}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=ue(a)?null:parseFloat(a);ue(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[Fp]:V({enabled:!!o},o,{networkPayloadCapture:V({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:H(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:vo.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):vo.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(Fp);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=X.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=X.__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))}},Ro={},cf=()=>{},Di="posthog",Gb=!K1&&ot?.indexOf("MSIE")===-1&&ot?.indexOf("Mozilla")===-1,B_=r=>{var e;return V({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:d1(D?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:cf,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:qe&&Ne(qe?.search)&&qe.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;B.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:Qh},error_tracking:{},_onCapture:cf,__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))},V_=r=>{var e={};H(r.process_person)||(e.person_profiles=r.process_person),H(r.xhr_headers)||(e.request_headers=r.xhr_headers),H(r.cookie_name)||(e.persistence_name=r.cookie_name),H(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),H(r.store_google)||(e.save_campaign_params=r.store_google),H(r.verbose)||(e.debug=r.verbose);var t=$e({},e,r);return ge(r.property_blacklist)&&(H(r.property_denylist)?t.property_denylist=r.property_blacklist:ge(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:B.error("Invalid value for property_denylist config: "+r.property_denylist)),t},uf=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ic=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 uf,this.Br=!1,this.version=pr.LIB_VERSION,this.qr=new Po,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=B_(),this.SentryIntegration=Mh,this.sentryIntegration=e=>(function(t,n){var i=Mb(t,n);return{name:$b,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 jh(this),this.toolbar=new Oh(this),this.scrollManager=new rf(this),this.pageViewManager=new wc(this),this.surveys=new Gh(this),this.conversations=new Kh(this),this.logs=new Yh(this),this.experiments=new of(this),this.exceptions=new Vh(this),this.rateLimiter=new Xh(this),this.requestRouter=new sf(this),this.consent=new Th(this),this.externalIntegrations=new af(this),this.people={set:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>B.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==Di){var i,s=(i=Ro[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),Ro[n]=s,Ro[Di][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),H(e)||eh(e))return B.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($e({},B_(t.defaults),V_(t),{name:n,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:gr.GZipJS;var s=this.Qr();this.persistence=new Ao(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ao(V({},this.config,{persistence:"sessionStorage"}),s);var o=V({},this.persistence.props),a=V({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new ef((x=>this.ts(x)),this.config.request_queue_config),this.es=new tf(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 Rc(this),this.sessionPropsManager=new Ac(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(B.info("Initializing extensions synchronously"),this.rs(l)),pr.DEBUG=pr.DEBUG||this.config.debug,pr.DEBUG&&B.info("Starting in debug mode",{this:this,config:t,thisC:V({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,p=this.config.get_device_id(Br()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(hr,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,g=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var k;return!((k=t.bootstrap)==null||(k=k.featureFlags)==null||!k[x])})).reduce(((x,k)=>{var _;return x[k]=((_=t.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[k])||!1,x}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>g[x])).reduce(((x,k)=>{var _,w;return(_=t.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[k]&&(x[k]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[k]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:lo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Br());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(hr,"anonymous")}return Oe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?O1(this,(()=>this.ns())):this.ns(),Vr(this.config._onCapture)&&this.config._onCapture!==cf&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&B.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 $h(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new Ph(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new nf(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Tc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Eh(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Wh(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Lh(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Nh(this)})),n.push((()=>{this.exceptionObserver=new Ih(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new xc(this,M1),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){B.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&&B.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!D||!D.body)return B.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=ce(e.supportedCompression,gr.GZipJS)?gr.GZipJS:ce(e.supportedCompression,gr.Base64)?gr.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),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(n){B.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&qe!=null&&qe.hostname){var e=qe.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 Jh(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()&&jr(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&&(Gb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ec(e.url,{ip:this.config.ip?1:0}),e.headers=V({},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=V({},t);o.timeout=o.timeout||6e4,o.url=Ec(o.url,{_:new Date().getTime().toString(),ver:pr.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=lc.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=hb(l,(u=>u.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)})(V({},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=[];jr(e,(a=>{a&&(t=a[0],ge(t)?s.push(a):Vr(a)?a.call(this):ge(a)&&t==="alias"?n.push(a):ge(a)&&t.indexOf("capture")!==-1&&Vr(this[t])?s.push(a):i.push(a))}));var o=function(a,l){jr(a,(function(c){if(ge(c[0])){var u=l;we(c,(function(p){u=u[p[0]].apply(u,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(!H(e)&&Ne(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&&!Ne(t?.$current_url)&&(B.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=Br(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n?.$set&&(u.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(u.$set_once=f),(u=c1(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,H(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===So.DISMISSED||e===So.SENT){var v=t?.[Kp.SURVEY_ID],g=t?.[Kp.SURVEY_ITERATION];p={id:v,current_iteration:g},localStorage.getItem(F_(p))||localStorage.setItem(F_(p),"true"),u.$set=V({},u.$set,{[Q1({id:v,current_iteration:g},e===So.SENT?"responded":"dismissed")]:!0})}else e===So.SHOWN&&(u.$set=V({},u.$set,{[Kp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=V({},u.properties.$set,u.$set);if(Bi(m)||this.setPersonPropertiesForFlags(m),!ue(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,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),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.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=V({},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=V({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ne(a.distinct_id)&&!yr(a.distinct_id)||eh(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=H1(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&&$e(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===Eo.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=$e(a,c),e==="$pageview"&&D&&(a.title=D.title),!H(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}ot&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=$e({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),ge(this.config.property_denylist)?we(this.config.property_denylist,(function(y){delete a[y]})):B.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(B.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,e));var m=this.fs();return a.$process_person_profile=m,m&&!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=$e({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(B.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),Bi(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=V({},i,e),a=V({},s,t),l={};for(var[c,u]of Object.entries(o)){var p=typeof u=="string";l[c]={key:c,enabled:!!p||!!u,variant:p?u:void 0,reason:void 0,metadata:H(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=tA),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 B.uninitializedWarning("posthog.identify");if(yr(e)&&(e=e.toString(),B.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()))B.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!==lo){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(_o)&&(this.unregister(_o),this.register({distinct_id:e}));var o=(this.persistence.get_property(hr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(hr,"identified"),this.setPersonPropertiesForFlags(V({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=$_(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(hc))}}else B.critical('The string "'+lo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=$_(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(V({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):B.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:V({},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 B.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(B.info("reset"),!this.__loaded)return B.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(hr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:lo,$device_id:null},"");else{var a=this.config.get_device_id(Br());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(fb)?(B.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(_o,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=V({},this.config);if(Pe(e)){var n,i,s,o,a,l,c;$e(this.config,V_(e));var u=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ao(V({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);vr(p)&&(this.config.debug=p),vr(this.config.debug)&&(this.config.debug?(pr.DEBUG=!0,Ae.H()&&Ae.G("ph_debug","true"),B.info("set_config",{config:e,oldConfig:t,newConfig:V({},this.config)})):(pr.DEBUG=!1,Ae.H()&&Ae.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(V({},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:Di;return t!==Di&&(t=Di+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(hr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(hr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Bi(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[_o])&&((t=this.persistence)==null||(t=t.props)==null||!t[gc]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(gc,!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 Rc(this),this.pageViewManager=new wc(this),this.persistence&&(this.sessionPropsManager=new Ac(this,this.sessionManager,this.persistence)),this.sessionRecording=new Tc(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(),(H(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 B.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:lo,$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())):B.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===fr.GRANTED?"granted":e===fr.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 ht?Zb(ht,this.config.custom_blocked_useragents):void 0}hs(){D&&(D.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:D.title},{send_instantly:!0}),this.Gr&&(D.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Oe(D,"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?(B.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=B,o=(t="advanced_disable_flags")in(e=l)&&!ue(e[t]),a=n in e&&!ue(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(ue(this.config.before_send))return e;var t=ge(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ue(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return LC(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}n.properties&&!Bi(n.properties)||B.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=vr(e)&&!e,n=Ae.H()&&Ae.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=l1(r.prototype[e[t]])})(Ic,["identify"]);var j_;var Kb=(j_=Ro[Di]=new Ic,(function(){function r(){r.done||(r.done=!0,Gb=!1,we(Ro,(function(e){e._dom_loaded()})))}D!=null&&D.addEventListener?D.readyState==="complete"?r():Oe(D,"DOMContentLoaded",r,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),j_);var xf=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},a=Kb.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],u=typeof c=="string"?c:c?.event,p=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,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)}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 Pc(r={}){return new xf(r)}var Yb={posthog:r=>Pc(r),noop:()=>tc()};function Xb(r,e){let t=Yb[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Yb).join(", ")}`);return t(e)}async function Jb(r){Zu(),z("Syntro Bootstrap","====== INIT ======"),z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=hl();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",zs()),console.log("[DIAG] editorConf:",pl()),z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let C=!!window.__SYNTRO_EDITOR_PARAMS__,O=!!window.__SYNTRO_AUDIT_LEGEND__,Z=!!window.__SYNTRO_REVIEW_DATA__;if(C||O||Z){let de=[C&&"__SYNTRO_EDITOR_PARAMS__",O&&"__SYNTRO_AUDIT_LEGEND__",Z&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${de.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 O=pl()?.syntro_token;O?.startsWith("syn_")&&(t=O,z("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))z("Syntro Bootstrap","Token starts with syn_, decoding..."),n=xi(t),Zu(n.d);else if(e)z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Ya("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Ya("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)z("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw Ya("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=xt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||xt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=xt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||xt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th,o=xt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||xt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||xt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||xt("VITE_SYNTRO_GEO_HOST")||Uv,l=Vv(),c=Jd(),u=r.appSignalsInit??{},p={...c,...l,...u};z("Syntro Bootstrap","Phase 1: Browser metadata:",c),z("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&z("Syntro Bootstrap","Phase 1: App signals:",u);let h=Qd(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(C=>{let O=setTimeout(()=>{window.removeEventListener("message",Z),C(null)},500);function Z(de){let ae=de.data;ae?.jsonrpc==="2.0"&&ae?.id===1&&ae?.result?.hostInfo&&(clearTimeout(O),window.removeEventListener("message",Z),C(ae.result.hostInfo))}window.addEventListener("message",Z);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(O),window.removeEventListener("message",Z),C(null)}})})(),v,g=r.debug||r.testMode,m=wi({debug:r.debug,history:g?new ki(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=Uu({elementResolver:typeof window<"u"?(C,O)=>{let Z=document.elementFromPoint(C,O);if(!Z)return null;let de={tag_name:Z.tagName.toLowerCase()};Z.id&&(de.attr__id=Z.id),Z.className&&typeof Z.className=="string"&&(de.classes=Z.className.split(" ").filter(Boolean));for(let ae of Z.attributes)ae.name.startsWith("data-")&&(de[`attr__${ae.name}`]=ae.value);return de}:void 0});y.onEvent(C=>m.publishEvent(C)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",C=>{let O=[],Z=C.target;for(;Z&&Z!==document.body;){let de={tag_name:Z.tagName.toLowerCase()};for(let ae of Z.attributes)(ae.name.startsWith("data-")||ae.name==="id"||ae.name==="class"||ae.name==="aria-label")&&(de[`attr__${ae.name}`]=ae.value);O.push(de),Z=Z.parentElement}y.enrichClickAttributes(Date.now(),O)},!0));let x=Hy(),k,_=C=>{z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let O=Wv(C);if(z("Syntro Bootstrap","Segment flags from PostHog:",O),jv(O),v){let Z=R?.getAll?.()??{},de={...c,...Z,...O,...u};z("Syntro Bootstrap","Updating GrowthBook with attributes:",de),v.setAttributes?.(de)}if(k&&w?.getDistinctId){let Z=w.getDistinctId();Z&&s&&n?.t&&k.updateContext({distinctId:Z,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let C=n.t==="noop"?"noop":"posthog";w=Xb(C,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:_,onCapture:(Z,de)=>{y.ingest({kind:"posthog",event:Z,properties:de,timestamp:Date.now()})},onRRWebEvent:Z=>{y.ingest(Z)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${C}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),z("Syntro Bootstrap","Tracked app signals event:",u));let O=w;if(m.setPosthogCapture((Z,de)=>{O.track?.(Z,de)}),x?.name==="shopify"&&s)try{k=new Bl({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(Z){Qe("Syntro Bootstrap","ShopifyPixelBridge init failed",Z)}}let R;n?.e&&(v=Oy("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(C,O,Z)=>{w.trackExperiment(C,O,Z)}:void 0})),R=Fl({experiments:v,onMetricChange:(C,O)=>{z("Syntro Bootstrap",`Session metric changed: ${C} = ${O}`)}}),z("Syntro Bootstrap","SessionMetricTracker created");let b="production";e==="editor"?b="editor":e==="audit"?b="audit":xt("NODE_ENV")==="development"&&(b="development");let A=ec({telemetry:w,sessionMetrics:R,mode:b,events:m});z("Syntro Bootstrap","Runtime created:",{version:A.version,mode:A.mode,hasContext:!!A.context,hasEvents:!!A.events,hasState:!!A.state}),z("Syntro Bootstrap","Core app executors already registered");let $=r.cdnBase||xt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||xt("VITE_SYNTRO_CDN_BASE")||zv()||"https://cdn.syntrologie.com",N=_u({cdnBase:$,registry:A.apps,onLoadStart:C=>{z("Syntro Bootstrap",`Loading app from CDN: ${C}`)},onLoadEnd:(C,O,Z)=>{O?z("Syntro Bootstrap",`App loaded successfully: ${C}`):Qe("Syntro Bootstrap",`Failed to load app: ${C}`,Z)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:A.apps,appLoader:N,runtime:A,version:A.version},z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&N.loadApp("adaptive-mcp").catch(C=>{z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",C)});let M=A.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${M.length} apps in registry:`,M.map(C=>`${C.manifest.id}(${C.state})`).join(", "));for(let C of M)if(C.state==="registered")try{await A.apps.activate(C.manifest.id),console.log(`[DIAG] Activated: ${C.manifest.id} \u2192 widgets: [${A.widgets.list().join(", ")}]`)}catch(O){console.error(`[DIAG] FAILED to activate: ${C.manifest.id}`,O),Qe("Syntro Bootstrap",`Failed to auto-activate built-in app: ${C.manifest.id}`,O)}if(console.log(`[DIAG] Activation complete. Total widgets: [${A.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),z("Syntro Bootstrap","GrowthBook features loaded")}catch(C){Qe("Syntro Bootstrap","Failed to load GrowthBook features:",C)}let K=await h;if(v&&Object.keys(K).length>0){let C={...c,...K,...u};z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",K),v.setAttributes?.(C)}let L=await f;L&&v&&(c.surface_type="mcp-app",c.surface_host=L.name,v.setAttributes?.({...c,...K}),z("Syntro Bootstrap","MCP App detected:",L.name));let P;if(r.fetcher)P=r.fetcher;else if(n?.f){let C=Fy(n.f,n.o??{});P=async()=>{let O=await C.fetch();return{...O.config,tiles:O.config.tiles??[]}}}else v&&(P=wn({experiments:v}));let q=new Set,Y=P?async()=>{let C=await P(),O=C.tiles?.length??0,Z=C.actions?.length??0,de=C.meta?.variant_id;if((O>0||Z>0)&&(de||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&de){let xe=new Pi(w,de);xe.trackServed(O,Z),typeof window<"u"&&(window.SynOS.interventionTracker=xe),A.navigation.subscribe(()=>{xe.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${C.tiles?.length??0},`,`actions=${C.actions?.length??0},`,`theme=${C.theme?.name??"none"}`),C.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",C.actions.map((xe,Ye)=>`[${Ye}] ${xe.kind}${xe.anchorId?` anchor="${xe.anchorId.selector}"`:""}${xe.label?` "${xe.label}"`:""}`).join(", "));let ae=C,Le=N.getRequiredApps(ae);return Le.length>0?console.log("[Syntro Bootstrap] Required external apps:",Le.join(", ")):z("Syntro Bootstrap","No external apps required (all executors are built-in)"),Le.length>0&&await N.loadAppsForConfig(ae).then(async Ye=>{let St=Ye.filter(Me=>Me.success),Hc=Ye.filter(Me=>!Me.success);St.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${St.map(Me=>Me.appId).join(", ")}`);let Yi=Hc.filter(Me=>!q.has(Me.appId));Yi.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",Yi.map(Me=>`${Me.appId} (${Me.error})`).join(", ")),Yi.forEach(Me=>q.add(Me.appId)));for(let Me of Le)if(A.apps.has(Me))try{await A.apps.activate(Me),console.log(`[Syntro Bootstrap] App activated: ${Me}`)}catch(Ft){console.error(`[Syntro Bootstrap] Failed to activate app: ${Me}`,Ft)}else console.error(`[Syntro Bootstrap] App "${Me}" required by config but NOT registered.`,`Available apps: [${Array.from(A.apps.list?.()??[]).join(", ")}]`)}),C}:void 0;if(x){z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(C){Qe("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,C)}}let re=await fl({...r.canvas,fetcher:Y,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:A});if(re.setOverrideFetcher){let C=re.setOverrideFetcher.bind(re);re.setOverrideFetcher=O=>{C(async()=>{let de=await O(),ae=de;if(N.getRequiredApps(ae).length>0){let xe=await N.loadAppsForConfig(ae);for(let Ye of xe)if(Ye.success&&A.apps.has(Ye.appId))try{await A.apps.activate(Ye.appId)}catch{}}return de})}}return{canvas:re,runtime:A,experiments:v,telemetry:w,sessionMetrics:R,appLoader:N}}async function lA(r){try{return await Jb(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function cA(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 uA(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 wf={init:lA,loadAdaptive:uA,encodeToken:gl,decodeToken:xi,events:{emit:cA}};typeof window<"u"&&(window.Syntro=wf);function Ki(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function dA(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=Ki(i),o=Ki(ir);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${ir}. 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${ir}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:pA(n,i)}):{valid:!0,warnings:e,errors:t}}function pA(r,e){let t={...r};return Ki(e).major===1&&(t=hA(t)),t.schemaVersion=ir,t}function hA(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 fA(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=Ki(t),i=Ki(ir);return n.major<i.major||!e.schemaVersion}var Qb=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),e0=d.object({url:d.string(),ts:d.number()}),t0=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(e0).optional()}),r0=d.object({width:d.number(),height:d.number()}),n0=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),i0=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:n0.optional()}),s0=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),o0=d.object({page:Qb,session:t0,viewport:r0,anchors:d.array(i0).optional(),augmented:s0.optional()});function gA(r){return o0.safeParse(r)}var Nc=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 Lc=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 Fc=class{constructor(e,t,n,i){this._host=e,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 kf=d.enum(["posthog","canvas","derived"]),a0=d.object({ts:d.number(),name:d.string(),source:kf,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),l0=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(kf).optional()});function mA(r){return a0.safeParse(r)}function vA(r){return l0.safeParse(r)}var Sf=d.union([d.object({type:d.literal("data"),key:d.string(),value:d.string().optional()}),d.object({type:d.literal("css"),value:d.string()}),d.object({type:d.literal("aria"),role:d.string().optional(),label:d.string().optional()}),d.object({type:d.literal("shadow-css"),value:d.string()}),d.object({type:d.literal("ref"),el:d.any()})]),c0=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:Sf,content:d.object({title:d.string().optional(),body:d.string()}),placement:d.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:d.number().optional(),blocking:d.boolean().optional(),trigger:d.enum(["immediate","hover","click"]).optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),u0=d.object({kind:d.literal("highlight"),id:d.string(),anchor:Sf,copy:d.string().optional(),ring:d.object({paddingPx:d.number().optional(),radiusPx:d.number().optional()}).optional(),scrim:d.object({opacity:d.number().optional()}).optional(),ringColor:d.string().optional(),blocking:d.boolean().optional(),dismiss:d.object({onClickOutside:d.boolean().optional(),onEsc:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),Dc=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([c0,u0]))});function yA(r){return Dc.parse(r)}var _A=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Ja({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 Dc.parse(o)};var d0=d.object({value:d.unknown(),expiresAt:d.number().optional()}),p0=d.object({count:d.number(),resetAt:d.number().optional()});function bA(r){return d0.safeParse(r)}function xA(r){return p0.safeParse(r)}var Ef="2026-04-28T01:38:03.462Z (0aa655e94e5)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Ef} (Lit)`);let r=window.SynOS,e=r?.appRegistry||ys;window.SynOS={...r,appRegistry:e,_runtimeBuild:Ef,_renderer:"lit"},Ds(),Qm(e)}return _0(wA);})();
1011
1011
  /*! Bundled license information:
1012
1012
 
1013
1013
  @lit/reactive-element/css-tag.js: