@syntrologie/runtime-sdk 2.8.0-canary.207 → 2.8.0-canary.209
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.
- package/dist/bootstrap-init.d.ts +12 -0
- package/dist/bootstrap.d.ts +1 -1
- package/dist/index.js +88 -23
- package/dist/index.js.map +3 -3
- package/dist/smart-canvas.esm.js +198 -198
- package/dist/smart-canvas.esm.js.map +3 -3
- package/dist/smart-canvas.js +89 -24
- package/dist/smart-canvas.js.map +3 -3
- package/dist/smart-canvas.min.js +198 -198
- package/dist/smart-canvas.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/smart-canvas.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var SyntrologieSDK=(()=>{var Ca=Object.defineProperty;var lw=Object.getOwnPropertyDescriptor;var cw=Object.getOwnPropertyNames;var uw=Object.prototype.hasOwnProperty;var Yg=r=>{throw TypeError(r)};var dw=(r,e,t)=>e in r?Ca(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Xg=(r,e)=>{for(var t in e)Ca(r,t,{get:e[t],enumerable:!0})},pw=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cw(e))!uw.call(r,i)&&i!==t&&Ca(r,i,{get:()=>e[i],enumerable:!(n=lw(e,i))||n.enumerable});return r};var hw=r=>pw(Ca({},"__esModule",{value:!0}),r);var pe=(r,e,t)=>dw(r,typeof e!="symbol"?e+"":e,t),Mu=(r,e,t)=>e.has(r)||Yg("Cannot "+t);var q=(r,e,t)=>(Mu(r,e,"read from private field"),t?t.call(r):e.get(r)),ye=(r,e,t)=>e.has(r)?Yg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),oe=(r,e,t,n)=>(Mu(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),we=(r,e,t)=>(Mu(r,e,"access private method"),t);var Pu=(r,e,t,n)=>({set _(i){oe(r,e,i,t)},get _(){return q(r,e,n)}});var SR={};Xg(SR,{ANIMATION_KEYFRAMES:()=>is,ActivationConfigZ:()=>Ao,AddClassZ:()=>zp,AnchorIdZ:()=>_t,AnchorStateZ:()=>Qx,AnchorVisibleConditionZ:()=>dl,AppRegistry:()=>vi,AugmentationZ:()=>ew,BadgePositionZ:()=>Op,BadgeZ:()=>Xp,BoundingBoxZ:()=>Jx,CanvasEvents:()=>Di,CanvasRecipeZ:()=>Iu,ConditionZ:()=>Sr,ContextManager:()=>Do,CooldownActiveConditionZ:()=>vl,CounterDefZ:()=>Ti,CtaButtonZ:()=>Xl,DEFAULT_COOLDOWN:()=>Rl,DecisionController:()=>Au,DecisionStrategyZ:()=>Oi,DismissedConditionZ:()=>ml,EVENT_SCHEMA_VERSION:()=>Pe,EventBus:()=>Io,EventCountConditionZ:()=>bl,EventFilterZ:()=>nw,EventHistory:()=>Gi,EventOccurredConditionZ:()=>pl,EventSourceZ:()=>Wg,ExecutorRegistry:()=>Eo,ExternalStrategyZ:()=>Pi,FrequencyEntryZ:()=>aw,FrequencyLimitConditionZ:()=>yl,HighlightStepZ:()=>sw,HighlightStyleZ:()=>Pp,HighlightZ:()=>Kp,InsertHtmlZ:()=>Gp,InsertPositionZ:()=>Dp,InterventionTracker:()=>ss,MAX_VISIBLE_TOASTS:()=>co,MatchOpZ:()=>Ai,ModalContentZ:()=>Fp,ModalZ:()=>Qp,ModelStrategyZ:()=>Mi,MountWidgetZ:()=>rh,NavigateZ:()=>th,NavigationMonitor:()=>rs,NormalizedEventZ:()=>rw,NotificationsController:()=>Fi,PageContextZ:()=>Gx,PageHistoryEntryZ:()=>Kx,PageUrlConditionZ:()=>cl,ParallelZ:()=>sh,PlacementZ:()=>Lp,PulseZ:()=>Yp,RUNTIME_SDK_BUILD:()=>qg,RUNTIME_VERSION:()=>Jh,RemoveClassZ:()=>qp,RouteConditionZ:()=>ul,RouteFilterZ:()=>$p,RuleStrategyZ:()=>Ii,RuleZ:()=>Ri,RuntimeContextZ:()=>tw,RuntimeController:()=>Tu,RuntimeEventsController:()=>Ru,SDK_SCHEMA_VERSION:()=>Er,SDK_VERSION:()=>Vi,STATIC_SLOT_STYLES:()=>Yh,ScoreStrategyZ:()=>$i,ScrollBehaviorZ:()=>Up,ScrollLogicalPositionZ:()=>Yl,ScrollToZ:()=>eh,SelectorZ:()=>zg,SequenceZ:()=>ih,SessionContextZ:()=>Yx,SessionMetricConditionZ:()=>gl,SessionMetricTracker:()=>Fo,SetAttrZ:()=>Wp,SetStyleZ:()=>Zp,SetTextZ:()=>jp,SmartCanvasController:()=>Bl,SmartCanvasElementLit:()=>Zn,StandardEvents:()=>Ze,StateEqualsConditionZ:()=>hl,StateStore:()=>jo,StoredValueZ:()=>ow,Syntro:()=>jg,ThemeController:()=>Ui,TooltipContentZ:()=>Np,TooltipStepZ:()=>iw,TooltipTriggerZ:()=>Hp,TooltipZ:()=>Jp,TourStepForSchemaZ:()=>Vp,TourZ:()=>oh,TriggerWhenZ:()=>ao,ViewportConditionZ:()=>fl,ViewportContextZ:()=>Xx,WaitZ:()=>nh,WidgetConfigZ:()=>Bp,WidgetRegistry:()=>zo,applyStaticSlotStyles:()=>Fc,coreActionStepSchemas:()=>gb,createActionEngine:()=>Kl,createAnchorResolver:()=>Jl,createCanvasConfigFetcher:()=>jn,createContextManager:()=>Pc,createDecisionEngine:()=>Oc,createEventAccumulator:()=>Lc,createEventBus:()=>Zi,createGrowthBookClient:()=>Ac,createNoopClient:()=>Zc,createOverlayRecipeFetcher:()=>_R,createPostHogClient:()=>Cu,createPostHogNormalizer:()=>Od,createSessionMetricTracker:()=>Tc,createSmartCanvas:()=>rc,createSmartCanvasController:()=>ip,createSmartCanvasRuntime:()=>qc,createStateStore:()=>Nc,createSurfaceContainer:()=>Uc,createSurfaces:()=>Wc,decisionSchemas:()=>HC,decodeToken:()=>qi,encodeToken:()=>nc,evaluate:()=>zh,evaluateCondition:()=>jh,evaluateRule:()=>Wh,evaluateRuleStrategy:()=>Ho,evaluateScoreStrategy:()=>Bo,evaluateSync:()=>qh,executorRegistry:()=>lr,getAntiFlickerSnippet:()=>yb,getExecutor:()=>hb,getSlotAnchorId:()=>Wo,getSlotType:()=>ns,getSlotZIndex:()=>jc,hasExecutor:()=>ql,needsMigration:()=>gR,normalizePostHogEvent:()=>Li,parseVersion:()=>_s,playEnterAnimation:()=>Bc,playExitAnimation:()=>Vc,registerConfigPredicates:()=>qn,registerSmartCanvasElement:()=>wo,resolveConfigUri:()=>Hl,runtimeContext:()=>nb,setupAdjacentPositioning:()=>Dc,setupInlinePositioning:()=>Hc,shouldNormalizeEvent:()=>Ni,validateAction:()=>Wt,validateActions:()=>Co,validateActivationConfig:()=>DC,validateCondition:()=>NC,validateConfig:()=>pR,validateEventFilter:()=>yR,validateEventName:()=>ac,validateFrequencyEntry:()=>wR,validateNormalizedEvent:()=>vR,validateProps:()=>lc,validateRecipe:()=>bR,validateRuntimeContext:()=>mR,validateStoredValue:()=>xR,validateStrategy:()=>FC,widgetRegistry:()=>zc});function fw(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 gw=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 Jg(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(!gw.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 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-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=Jg(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=fw(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=Jg(p.html))}}};function em(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 em(t)}return r}var tm=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=em(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)}}},rm=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)}}},nm=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))}}},im=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)}}},sm=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)}}},Ou=[{kind:"content:insertHtml",executor:Qg},{kind:"content:setText",executor:tm},{kind:"content:setAttr",executor:rm},{kind:"content:addClass",executor:nm},{kind:"content:removeClass",executor:im},{kind:"content:setStyle",executor:sm}],Lu={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:Ou};var om=r=>{throw TypeError(r)},am=(r,e,t)=>e.has(r)||om("Cannot "+t),je=(r,e,t)=>(am(r,e,"read from private field"),t?t.call(r):e.get(r)),Br=(r,e,t)=>e.has(r)?om("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),hr=(r,e,t,n)=>(am(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var um=["top","right","bottom","left"];var Vr=Math.min,fr=Math.max,ks=Math.round,Es=Math.floor,Pt=r=>({x:r,y:r}),mw={left:"right",right:"left",bottom:"top",top:"bottom"},vw={start:"end",end:"start"};function Ta(r,e,t){return fr(r,Vr(e,t))}function pn(r,e){return typeof r=="function"?r(e):r}function Ur(r){return r.split("-")[0]}function ai(r){return r.split("-")[1]}function Nu(r){return r==="x"?"y":"x"}function Ra(r){return r==="y"?"height":"width"}var yw=new Set(["top","bottom"]);function gr(r){return yw.has(Ur(r))?"y":"x"}function Ia(r){return Nu(gr(r))}function dm(r,e,t){t===void 0&&(t=!1);let n=ai(r),i=Ia(r),s=Ra(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ss(o)),[o,Ss(o)]}function pm(r){let e=Ss(r);return[Aa(r),e,Aa(e)]}function Aa(r){return r.replace(/start|end/g,e=>vw[e])}var lm=["left","right"],cm=["right","left"],bw=["top","bottom"],_w=["bottom","top"];function xw(r,e,t){switch(r){case"top":case"bottom":return t?e?cm:lm:e?lm:cm;case"left":case"right":return e?bw:_w;default:return[]}}function hm(r,e,t,n){let i=ai(r),s=xw(Ur(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Aa)))),s}function Ss(r){return r.replace(/left|right|bottom|top/g,e=>mw[e])}function ww(r){return{top:0,right:0,bottom:0,left:0,...r}}function Fu(r){return typeof r!="number"?ww(r):{top:r,right:r,bottom:r,left:r}}function hn(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 fm(r,e,t){let{reference:n,floating:i}=r,s=gr(e),o=Ia(e),a=Ra(o),l=Ur(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(ai(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 vm(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}=pn(e,r),v=Fu(f),m=a[h?p==="floating"?"reference":"floating":p],y=hn(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,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},w=hn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:S,strategy:l}):x);return{top:(y.top-w.top+v.top)/b.y,bottom:(w.bottom-y.bottom+v.bottom)/b.y,left:(y.left-w.left+v.left)/b.x,right:(w.right-y.right+v.right)/b.x}}var ym=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}=fm(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:S,y:b,data:w,reset:A}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:vm},elements:{reference:r,floating:e}});u=S??u,p=b??p,f={...f,[y]:{...f[y],...w}},A&&v<=50&&(v++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):A.rects),{x:u,y:p}=fm(c,h,l)),m=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},bm=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}=pn(r,e)||{};if(c==null)return{};let p=Fu(u),h={x:t,y:n},f=Ia(i),v=Ra(f),g=await o.getDimensions(c),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",S=m?"clientHeight":"clientWidth",b=s.reference[v]+s.reference[f]-h[f]-s.floating[v],w=h[f]-s.reference[f],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),_=A?A[S]:0;(!_||!await(o.isElement==null?void 0:o.isElement(A)))&&(_=a.floating[S]||s.floating[v]);let C=b/2-w/2,I=_/2-g[v]/2-1,R=Vr(p[y],I),P=Vr(p[x],I),Y=R,F=_-g[v]-P,L=_/2-g[v]/2+C,G=Ta(Y,L,F),K=!l.arrow&&ai(i)!=null&&L!==G&&s.reference[v]/2-(L<Y?R:P)-g[v]/2<0,le=K?L<Y?L-Y:L-F:0;return{[f]:h[f]+le,data:{[f]:G,centerOffset:L-G-le,...K&&{alignmentOffset:le}},reset:K}}});var _m=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}=pn(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=Ur(i),x=gr(a),S=Ur(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(S||!g?[Ss(a)]:pm(a)),A=v!=="none";!h&&A&&w.push(...hm(a,g,v,b));let _=[a,...w],C=await l.detectOverflow(e,m),I=[],R=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&I.push(C[y]),p){let L=dm(i,o,b);I.push(C[L[0]],C[L[1]])}if(R=[...R,{placement:i,overflows:I}],!I.every(L=>L<=0)){var P,Y;let L=(((P=s.flip)==null?void 0:P.index)||0)+1,G=_[L];if(G&&(!(p==="alignment"?x!==gr(G):!1)||R.every(j=>gr(j.placement)===x?j.overflows[0]>0:!0)))return{data:{index:L,overflows:R},reset:{placement:G}};let K=(Y=R.filter(le=>le.overflows[0]<=0).sort((le,j)=>le.overflows[1]-j.overflows[1])[0])==null?void 0:Y.placement;if(!K)switch(f){case"bestFit":{var F;let le=(F=R.filter(j=>{if(A){let te=gr(j.placement);return te===x||te==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(te=>te>0).reduce((te,De)=>te+De,0)]).sort((j,te)=>j[1]-te[1])[0])==null?void 0:F[0];le&&(K=le);break}case"initialPlacement":K=a;break}if(i!==K)return{reset:{placement:K}}}return{}}}};function gm(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function mm(r){return um.some(e=>r[e]>=0)}var xm=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=pn(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=gm(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:mm(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=gm(o,t.floating);return{data:{escapedOffsets:a,escaped:mm(a)}}}default:return{}}}}};var Sw=new Set(["left","top"]);async function kw(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ur(t),a=ai(t),l=gr(t)==="y",c=Sw.has(o)?-1:1,u=s&&l?-1:1,p=pn(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 wm=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 kw(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}}}}},Sm=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:S}=y;return{x,y:S}}},...c}=pn(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=gr(Ur(i)),f=Nu(h),v=u[f],g=u[h];if(o){let y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",S=v+p[y],b=v-p[x];v=Ta(S,v,b)}if(a){let y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",S=g+p[y],b=g-p[x];g=Ta(S,g,b)}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 $a(){return typeof window<"u"}function fn(r){return Em(r)?(r.nodeName||"").toLowerCase():"#document"}function pt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Ot(r){var e;return(e=(Em(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Em(r){return $a()?r instanceof Node||r instanceof pt(r).Node:!1}function kt(r){return $a()?r instanceof Element||r instanceof pt(r).Element:!1}function Lt(r){return $a()?r instanceof HTMLElement||r instanceof pt(r).HTMLElement:!1}function km(r){return!$a()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof pt(r).ShadowRoot}var Ew=new Set(["inline","contents"]);function ci(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=Et(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!Ew.has(i)}var Cw=new Set(["table","td","th"]);function Cm(r){return Cw.has(fn(r))}var Aw=[":popover-open",":modal"];function Cs(r){return Aw.some(e=>{try{return r.matches(e)}catch{return!1}})}var Tw=["transform","translate","scale","rotate","perspective"],Rw=["transform","translate","scale","rotate","perspective","filter"],Iw=["paint","layout","strict","content"];function Ma(r){let e=Pa(),t=kt(r)?Et(r):r;return Tw.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)||Rw.some(n=>(t.willChange||"").includes(n))||Iw.some(n=>(t.contain||"").includes(n))}function Am(r){let e=mr(r);for(;Lt(e)&&!gn(e);){if(Ma(e))return e;if(Cs(e))return null;e=mr(e)}return null}function Pa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var $w=new Set(["html","body","#document"]);function gn(r){return $w.has(fn(r))}function Et(r){return pt(r).getComputedStyle(r)}function As(r){return kt(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function mr(r){if(fn(r)==="html")return r;let e=r.assignedSlot||r.parentNode||km(r)&&r.host||Ot(r);return km(e)?e.host:e}function Tm(r){let e=mr(r);return gn(e)?r.ownerDocument?r.ownerDocument.body:r.body:Lt(e)&&ci(e)?e:Tm(e)}function li(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Tm(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=pt(i);if(s){let a=Oa(o);return e.concat(o,o.visualViewport||[],ci(i)?i:[],a&&t?li(a):[])}return e.concat(i,li(i,[],t))}function Oa(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Mm(r){let e=Et(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=Lt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=ks(t)!==s||ks(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function Hu(r){return kt(r)?r:r.contextElement}function ui(r){let e=Hu(r);if(!Lt(e))return Pt(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Mm(e),o=(s?ks(t.width):t.width)/n,a=(s?ks(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Mw=Pt(0);function Pm(r){let e=pt(r);return!Pa()||!e.visualViewport?Mw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Pw(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==pt(r)?!1:e}function mn(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=Hu(r),o=Pt(1);e&&(n?kt(n)&&(o=ui(n)):o=ui(r));let a=Pw(s,t,n)?Pm(s):Pt(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=pt(s),f=n&&kt(n)?pt(n):n,v=h,g=Oa(v);for(;g&&n&&f!==v;){let m=ui(g),y=g.getBoundingClientRect(),x=Et(g),S=y.left+(g.clientLeft+parseFloat(x.paddingLeft))*m.x,b=y.top+(g.clientTop+parseFloat(x.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,p*=m.y,l+=S,c+=b,v=pt(g),g=Oa(v)}}return hn({width:u,height:p,x:l,y:c})}function La(r,e){let t=As(r).scrollLeft;return e?e.left+t:mn(Ot(r)).left+t}function Om(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-La(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function Ow(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=Ot(n),a=e?Cs(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Pt(1),u=Pt(0),p=Lt(n);if((p||!p&&!s)&&((fn(n)!=="body"||ci(o))&&(l=As(n)),Lt(n))){let f=mn(n);c=ui(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?Om(o,l):Pt(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 Lw(r){return Array.from(r.getClientRects())}function Nw(r){let e=Ot(r),t=As(r),n=r.ownerDocument.body,i=fr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=fr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+La(r),a=-t.scrollTop;return Et(n).direction==="rtl"&&(o+=fr(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Rm=25;function Fw(r,e){let t=pt(r),n=Ot(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=Pa();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=La(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<=Rm&&(s-=v)}else c<=Rm&&(s+=c);return{width:s,height:o,x:a,y:l}}var Dw=new Set(["absolute","fixed"]);function Hw(r,e){let t=mn(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Lt(r)?ui(r):Pt(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 Im(r,e,t){let n;if(e==="viewport")n=Fw(r,t);else if(e==="document")n=Nw(Ot(r));else if(kt(e))n=Hw(e,t);else{let i=Pm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return hn(n)}function Lm(r,e){let t=mr(r);return t===e||!kt(t)||gn(t)?!1:Et(t).position==="fixed"||Lm(t,e)}function Bw(r,e){let t=e.get(r);if(t)return t;let n=li(r,[],!1).filter(a=>kt(a)&&fn(a)!=="body"),i=null,s=Et(r).position==="fixed",o=s?mr(r):r;for(;kt(o)&&!gn(o);){let a=Et(o),l=Ma(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Dw.has(i.position)||ci(o)&&!l&&Lm(r,o))?n=n.filter(u=>u!==o):i=a,o=mr(o)}return e.set(r,n),n}function Vw(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?Cs(e)?[]:Bw(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=Im(e,u,i);return c.top=fr(p.top,c.top),c.right=Vr(p.right,c.right),c.bottom=Vr(p.bottom,c.bottom),c.left=fr(p.left,c.left),c},Im(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Uw(r){let{width:e,height:t}=Mm(r);return{width:e,height:t}}function jw(r,e,t){let n=Lt(e),i=Ot(e),s=t==="fixed",o=mn(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Pt(0);function c(){l.x=La(i)}if(n||!n&&!s)if((fn(e)!=="body"||ci(i))&&(a=As(e)),n){let f=mn(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?Om(i,a):Pt(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 Du(r){return Et(r).position==="static"}function $m(r,e){if(!Lt(r)||Et(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Ot(r)===t&&(t=t.ownerDocument.body),t}function Nm(r,e){let t=pt(r);if(Cs(r))return t;if(!Lt(r)){let i=mr(r);for(;i&&!gn(i);){if(kt(i)&&!Du(i))return i;i=mr(i)}return t}let n=$m(r,e);for(;n&&Cm(n)&&Du(n);)n=$m(n,e);return n&&gn(n)&&Du(n)&&!Ma(n)?t:n||Am(r)||t}var Ww=async function(r){let e=this.getOffsetParent||Nm,t=this.getDimensions,n=await t(r.floating);return{reference:jw(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function zw(r){return Et(r).direction==="rtl"}var qw={convertOffsetParentRelativeRectToViewportRelativeRect:Ow,getDocumentElement:Ot,getClippingRect:Vw,getOffsetParent:Nm,getElementRects:Ww,getClientRects:Lw,getDimensions:Uw,getScale:ui,isElement:kt,isRTL:zw};function Fm(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Zw(r,e){let t=null,n,i=Ot(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=Es(p),g=Es(i.clientWidth-(u+h)),m=Es(i.clientHeight-(p+f)),y=Es(u),S={rootMargin:-v+"px "+-g+"px "+-m+"px "+-y+"px",threshold:fr(0,Vr(1,l))||1},b=!0;function w(A){let _=A[0].intersectionRatio;if(_!==l){if(!b)return o();_?o(!1,_):n=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!Fm(c,r.getBoundingClientRect())&&o(),b=!1}try{t=new IntersectionObserver(w,{...S,root:i.ownerDocument})}catch{t=new IntersectionObserver(w,S)}t.observe(r)}return o(!0),s}function Na(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=Hu(r),u=i||s?[...c?li(c):[],...li(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let p=c&&a?Zw(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 S;(S=f)==null||S.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let v,g=l?mn(r):null;l&&m();function m(){let y=mn(r);g&&!Fm(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 Fa=wm;var Da=Sm,Ha=_m;var Dm=xm,Hm=bm;var Ba=(r,e,t)=>{let n=new Map,i={platform:qw,...t},s={...i.platform,_c:n};return ym(r,e,{...i,platform:s})};var Va=globalThis,Ua=Va.ShadowRoot&&(Va.ShadyCSS===void 0||Va.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bu=Symbol(),Bm=new WeakMap,Ts=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Bu)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(Ua&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Bm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Bm.set(t,e))}return e}toString(){return this.cssText}},Vm=r=>new Ts(typeof r=="string"?r:r+"",void 0,Bu),vn=(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 Ts(t,r,Bu)},Um=(r,e)=>{if(Ua)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Va.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Vu=Ua?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Vm(t)})(r):r;var{is:Gw,defineProperty:Kw,getOwnPropertyDescriptor:Yw,getOwnPropertyNames:Xw,getOwnPropertySymbols:Jw,getPrototypeOf:Qw}=Object,jr=globalThis,jm=jr.trustedTypes,e1=jm?jm.emptyScript:"",t1=jr.reactiveElementPolyfillSupport,Rs=(r,e)=>r,Uu={toAttribute(r,e){switch(e){case Boolean:r=r?e1: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}},zm=(r,e)=>!Gw(r,e),Wm={attribute:!0,type:String,converter:Uu,reflect:!1,useDefault:!1,hasChanged:zm};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),jr.litPropertyMetadata??(jr.litPropertyMetadata=new WeakMap);var vr=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=Wm){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&&Kw(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=Yw(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)??Wm}static _$Ei(){if(this.hasOwnProperty(Rs("elementProperties")))return;let e=Qw(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Rs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Rs("properties"))){let t=this.properties,n=[...Xw(t),...Jw(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(Vu(i))}else e!==void 0&&t.push(Vu(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 Um(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:Uu).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:Uu;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??zm)(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){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[Rs("elementProperties")]=new Map,vr[Rs("finalized")]=new Map,t1?.({ReactiveElement:vr}),(jr.reactiveElementVersions??(jr.reactiveElementVersions=[])).push("2.1.2");var $s=globalThis,qm=r=>r,ja=$s.trustedTypes,Zm=ja?ja.createPolicy("lit-html",{createHTML:r=>r}):void 0,Qm="$lit$",Wr=`lit$${Math.random().toFixed(9).slice(2)}$`,ev="?"+Wr,r1=`<${ev}>`,_n=document,Ms=()=>_n.createComment(""),Ps=r=>r===null||typeof r!="object"&&typeof r!="function",Ku=Array.isArray,n1=r=>Ku(r)||typeof r?.[Symbol.iterator]=="function",ju=`[
|
|
2
|
-
\f\r]`,Is=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ym=/'/g,Xm=/"/g,tv=/^(?:script|style|textarea|title)$/i,Yu=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),N=Yu(1),zR=Yu(2),qR=Yu(3),Nt=Symbol.for("lit-noChange"),ee=Symbol.for("lit-nothing"),Jm=new WeakMap,bn=_n.createTreeWalker(_n,129);function rv(r,e){if(!Ku(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Zm!==void 0?Zm.createHTML(e):e}var i1=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=Is;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===Is?u[1]==="!--"?o=Gm:u[1]!==void 0?o=Km:u[2]!==void 0?(tv.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=yn):u[3]!==void 0&&(o=yn):o===yn?u[0]===">"?(o=i??Is,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?yn:u[3]==='"'?Xm:Ym):o===Xm||o===Ym?o=yn:o===Gm||o===Km?o=Is:(o=yn,i=void 0);let f=o===yn&&r[a+1].startsWith("/>")?" ":"";s+=o===Is?l+r1:p>=0?(n.push(c),l.slice(0,p)+Qm+l.slice(p)+Wr+f):l+Wr+(p===-2?a:f)}return[rv(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Os=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]=i1(e,t);if(this.el=r.createElement(c,n),bn.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=bn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(Qm)){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]==="."?zu:v[1]==="?"?qu:v[1]==="@"?Zu:pi}),i.removeAttribute(p)}else p.startsWith(Wr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(tv.test(i.tagName)){let p=i.textContent.split(Wr),h=p.length-1;if(h>0){i.textContent=ja?ja.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],Ms()),bn.nextNode(),l.push({type:2,index:++s});i.append(p[h],Ms())}}}else if(i.nodeType===8)if(i.data===ev)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=_n.createElement("template");return n.innerHTML=e,n}};function di(r,e,t=r,n){if(e===Nt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=Ps(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=di(r,i._$AS(r,e.values),i,n)),e}var Wu=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??_n).importNode(t,!0);bn.currentNode=i;let s=bn.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Ls(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Gu(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=bn.nextNode(),o++)}return bn.currentNode=_n,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++}},Ls=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=ee,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=di(this,e,t),Ps(e)?e===ee||e==null||e===""?(this._$AH!==ee&&this._$AR(),this._$AH=ee):e!==this._$AH&&e!==Nt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):n1(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!==ee&&Ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(_n.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=Os.createElement(rv(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Wu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Jm.get(e.strings);return t===void 0&&Jm.set(e.strings,t=new Os(e)),t}k(e){Ku(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(Ms()),this.O(Ms()),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=qm(e).nextSibling;qm(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},pi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=ee,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=ee}_$AI(e,t=this,n,i){let s=this.strings,o=!1;if(s===void 0)e=di(this,e,t,0),o=!Ps(e)||e!==this._$AH&&e!==Nt,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=di(this,a[n+l],t,l),c===Nt&&(c=this._$AH[l]),o||(o=!Ps(c)||c!==this._$AH[l]),c===ee?e=ee:e!==ee&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},zu=class extends pi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ee?void 0:e}},qu=class extends pi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ee)}},Zu=class extends pi{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=di(this,e,t,0)??ee)===Nt)return;let n=this._$AH,i=e===ee&&n!==ee||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==ee&&(n===ee||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)}},Gu=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){di(this,e)}};var s1=$s.litHtmlPolyfillSupport;s1?.(Os,Ls),($s.litHtmlVersions??($s.litHtmlVersions=[])).push("3.3.2");var nv=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new Ls(e.insertBefore(Ms(),s),s,void 0,t??{})}return i._$AI(r),i};var Ns=globalThis,be=class extends vr{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=nv(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Nt}};be._$litElement$=!0,be.finalized=!0,Ns.litElementHydrateSupport?.({LitElement:be});var o1=Ns.litElementPolyfillSupport;o1?.({LitElement:be});(Ns.litElementVersions??(Ns.litElementVersions=[])).push("4.2.2");var Wa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},za=r=>(...e)=>({_$litDirective$:r,values:e}),hi=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 iv="important",a1=" !"+iv,T=za(class extends hi{constructor(r){if(super(r),r.type!==Wa.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(a1);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?iv:""):t[n]=i}}return Nt}});var l1={light:50,medium:100,heavy:200},c1=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],u1={init(r,e,t){let n=l1[t.intensity],i=t.colors.length>0?t.colors:c1,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())}},d1={light:20,medium:40,heavy:80},p1="\u{1F389}",h1={init(r,e,t){let n=d1[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:p1,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())}},f1={light:20,medium:40,heavy:80},g1={light:3,medium:4,heavy:5},m1={init(r,e,t){let n=f1[t.intensity],i=g1[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())}},v1={light:30,medium:60,heavy:120},y1={init(r,e,t){let n=v1[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()}}},b1=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(r,e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=r,this.effect=e,this.duration=t.duration;let i=document.createElement("canvas");i.setAttribute("data-syntro-celebrate",""),Object.assign(i.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let s=window.devicePixelRatio||1,o=window.innerWidth,a=window.innerHeight;i.width=o*s,i.height=a*s,i.style.width=`${o}px`,i.style.height=`${a}px`;let l=i.getContext("2d");l&&(l.scale(s,s),this.canvas=i,this.ctx=l,r.appendChild(i),this.particles=e.init(o,a,t),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(r){if(!this.ctx||!this.canvas||!this.effect)return;let e=r-this.startTime,t=r-this.lastFrame;if(this.lastFrame=r,e>=this.duration){this.stop();return}let n=this.canvas.width/(window.devicePixelRatio||1),i=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,n,i),!this.effect.update(this.particles,t,e)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}},_1=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function x1(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function w1(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 x1(t,n||t)}catch{}return null}var sv=new Map([["confetti",u1],["fireworks",m1],["sparkles",y1],["emoji-rain",h1]]),S1=async(r,e)=>{let t=sv.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...sv.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??w1(e.overlayRoot)??_1,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new b1;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}},k1=new Set(["http:","https:","mailto:","tel:"]);function E1(r){if(typeof r!="string"||r.trim().length===0)return!1;let e;try{e=new URL(r,"https://syntro.local/")}catch{return!1}return k1.has(e.protocol)}function uv(r){if(r.actionId==="dismiss"||!r.href||!E1(r.href))return!1;let e=r.href;return r.target==="_blank"?window.open(e,"_blank","noopener,noreferrer"):window.location.assign(e),!0}var Qu="syntro_active_tour",qa=new Map;function C1(r){try{let e=localStorage.getItem(Qu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Xu(r){try{localStorage.setItem(Qu,JSON.stringify(r))}catch{}}function A1(){try{localStorage.removeItem(Qu)}catch{}}function Bs(){return window.location.pathname}function T1(r){if(!r.route)return!0;let e=Bs();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var dv=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(qa.has(t))return{cleanup:async()=>{let S=qa.get(t);S&&await S.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=C1(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Xu(o));let l=n.findIndex(S=>S.id===o.currentStepId);if(l===-1){let S=i||n[0].id;l=n.findIndex(b=>b.id===S),l===-1&&(l=0),o.currentStepId=n[l].id,Xu(o)}let c=n[l];if(!T1(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Bs()}),{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 S=>{if(u)return;if(await v(),S==="end"){A1(),e.publishEvent("tour.completed",{tourId:t,totalSteps:n.length}),u=!0;return}let b=n.find(w=>w.id===S);if(!b){console.error(`[Tour] Step "${S}" not found`);return}if(o.currentStepId=S,Xu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:S}),b.route&&b.route!==Bs()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:S,targetRoute:b.route});return}await m(b)},m=async S=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:S.id,stepIndex:n.findIndex(b=>b.id===S.id),totalSteps:n.length});try{p=await e.applyAction(S.action)}catch(b){console.error(`[Tour] Failed to execute step "${S.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:S.id,error:String(b)});return}if(S.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",A=>{let _=A?.actionId;if(_&&S.onAction){let C=S.onAction[_];C&&g(C)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",A=>{let _=A?.actionId;if(_&&S.onAction){let C=S.onAction[_];C&&g(C)}}),w=h;h=()=>{w(),b()}}}};f=(()=>{let S=Bs(),b=()=>{let _=Bs();_!==S&&(S=_,e.publishEvent("tour.route_changed",{tourId:t,newRoute:_}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>b());window.addEventListener("popstate",b);let w=history.pushState.bind(history),A=history.replaceState.bind(history);return history.pushState=(..._)=>{w(..._),queueMicrotask(b)},history.replaceState=(..._)=>{A(..._),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=w,history.replaceState=A}})(),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,qa.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return qa.set(t,{cleanup:x}),{cleanup:x}},Gt={white:"#ffffff",black:"#000000"},ht={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},O={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"},He={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Kt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},st={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},wn={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Fs={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Ds={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Hs={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},hI={primary:O[10],secondary:O[9],tertiary:O[8]},fI={primary:O[2],secondary:O[0]},gI={primary:O[4],secondary:O[3]},mI={primary:{text:Gt.white,icon:Gt.white,border:ht[3],backgroundDefault:ht[3],backgroundHover:ht[2]},neutral:{text:O[10],textHover:Gt.white,icon:O[10],iconHover:Gt.white,border:O[4],background:O[2]},link:{text:Gt.white,icon:Gt.white,hover:ht[5]},error:{text:st[5],hover:st[6]},success:{text:He[5],hover:He[6]}},vI={slateGrey:{content:O[10],pillOutline:O[10],borderPrimary:O[5],borderSecondary:O[5],background:O[3]},brand:{content:ht[9],pillOutline:ht[9],borderPrimary:ht[6],borderSecondary:ht[6],background:ht[0]},red:{content:st[8],pillOutline:st[4],borderPrimary:st[2],borderSecondary:st[2],background:st[0]},yellow:{content:Kt[8],pillOutline:Kt[4],borderPrimary:Kt[2],borderSecondary:Kt[2],background:Kt[0]},green:{content:He[8],pillOutline:He[4],borderPrimary:He[2],borderSecondary:He[2],background:He[0]},purple:{content:Ds[8],pillOutline:Ds[4],borderPrimary:Ds[2],borderSecondary:Ds[2],background:Ds[0]},blue:{content:wn[8],pillOutline:wn[4],borderPrimary:wn[2],borderSecondary:wn[2],background:wn[0]},orange:{content:Fs[8],pillOutline:Fs[4],borderPrimary:Fs[2],borderSecondary:Fs[2],background:Fs[0]},pink:{content:Hs[8],pillOutline:Hs[4],borderPrimary:Hs[2],borderSecondary:Hs[2],background:Hs[0]}},yI={green:{content:He[8],border:He[2],background:He[0]},yellow:{content:Kt[8],border:Kt[2],background:Kt[0]},red:{content:st[8],border:st[2],background:st[0]}},bI={green:{content:He[1],background:He[9]},yellow:{content:Kt[1],background:Kt[9]},red:{content:st[1],background:st[9]}},_I={content:O[10],border:O[4],background:O[3]},xI={backgroundDefault:O[2],backgroundHover:O[1],selected:O[3]},wI={background:O[2],icon:O[10],borderDefault:O[4],borderSelected:ht[3],textLabel:O[9],textPlaceholder:O[8],textHint:O[8]},SI={backgroundDefault:O[2],backgroundDisabled:O[0],textLabel:O[9],textPlaceholder:O[8],textHint:O[8],textError:st[5],iconDefault:O[9],iconPlaceholder:O[10],iconError:st[5],borderDefault:O[4],borderSelected:ht[3],borderError:st[5]},kI={handleDefault:Gt.white,handleDisabled:O[10],off:{backgroundDefault:O[4],backgroundHover:O[5],backgroundDisabled:O[4]},on:{backgroundDefault:He[3],backgroundHover:He[2],backgroundDisabled:O[4]}},EI={off:{backgroundDefault:"#00000000",backgroundHover:O[5],backgroundDisabled:O[2],border:O[6]},on:{backgroundDefault:He[0],backgroundHover:He[1],backgroundDisabled:O[2],border:He[3]}},CI={content:O[10],background:O[4]},AI={background:O[4],active:He[3]},TI={background:O[1],content:O[9],border:O[4]},RI={backgroundDefault:O[1],backgroundHover:O[3],backgroundActive:O[4],border:O[4],contentPrimary:O[10],contentSecondary:O[9],contentTertiary:O[8]},II={background:O[1],content:O[9],border:O[4]},$I={activeBackground:O[3],activeContent:ht[5],inactiveContent:O[9],border:O[4]},MI={header:{textDefault:O[9],textHover:O[8],backgroundDefault:O[1]},border:O[4],cell:{textPrimary:O[10],textSecondary:O[9],backgroundDefault:O[2],backgroundHover:O[1]}},PI={textPrimaryDefault:O[10],textPrimaryHover:O[10],textSecondaryDefault:O[8],textSecondaryHover:O[9],iconPrimary:O[10],iconSecondary:O[8]},OI={background:He[1],active:He[5]},LI={textDefault:O[10],textSelected:Gt.white,textDisabled:O[7],backgroundDefault:O[2],backgroundMiddle:O[3],backgroundSelected:ht[3],border:O[4]},NI=O[9],FI={size:56,inset:12,background:Gt.black,color:Gt.white,border:`2px solid ${ht[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)"},ov=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function R1(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, ${wn[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||wn[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(!ov)for(let I=0;I<4;I++){let R=document.createElement("div");R.style.position="fixed",R.style.background="inherit",m.push(R),f.appendChild(R)}let y=I=>{f.style.clipPath=I,f.style.webkitClipPath=I},x=()=>{if(!r.isConnected){C.destroy();return}let I=r.getBoundingClientRect(),R=I.left-n,P=I.top-n,Y=I.width+n*2,F=I.height+n*2;if(Object.assign(g.style,{left:`${R}px`,top:`${P}px`,width:`${Y}px`,height:`${F}px`}),ov){let L=window.innerWidth,G=window.innerHeight,K=Math.min(i,Y/2,F/2),le=`M 0 0 L ${L} 0 L ${L} ${G} L 0 ${G} Z`,j=`M ${R+K} ${P} A ${K} ${K} 0 0 0 ${R} ${P+K} L ${R} ${P+F-K} A ${K} ${K} 0 0 0 ${R+K} ${P+F} L ${R+Y-K} ${P+F} A ${K} ${K} 0 0 0 ${R+Y} ${P+F-K} L ${R+Y} ${P+K} A ${K} ${K} 0 0 0 ${R+Y-K} ${P} L ${R+K} ${P} Z`;y(`path('${le} ${j}')`)}else{let[L,G,K,le]=m;Object.assign(L.style,{left:"0px",top:"0px",width:"100vw",height:`${P}px`}),Object.assign(K.style,{left:"0px",top:`${P+F}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(P+F))}px`}),Object.assign(le.style,{left:"0px",top:`${P}px`,width:`${R}px`,height:`${F}px`}),Object.assign(G.style,{left:`${R+Y}px`,top:`${P}px`,width:`${Math.max(0,window.innerWidth-(R+Y))}px`,height:`${F}px`})}},S=new ResizeObserver(()=>requestAnimationFrame(x));S.observe(r);let b=()=>requestAnimationFrame(x),w=()=>requestAnimationFrame(x);window.addEventListener("scroll",b,!0),window.addEventListener("resize",w);let A=I=>{I.key==="Escape"&&c&&(t?.onDismiss?.(),C.destroy())};c&&window.addEventListener("keydown",A);let _=I=>{a?(I.preventDefault(),I.stopPropagation()):l&&(t?.onDismiss?.(),C.destroy())};f.addEventListener("click",_);let C={destroy(){S.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",A),f.removeEventListener("click",_),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{g.remove()}catch{}},220)}};return x(),C}var I1=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 Yt(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(!I1.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 xn={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)"},pv=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 Ta=Object.defineProperty;var gw=Object.getOwnPropertyDescriptor;var mw=Object.getOwnPropertyNames;var vw=Object.prototype.hasOwnProperty;var Qg=r=>{throw TypeError(r)};var yw=(r,e,t)=>e in r?Ta(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var em=(r,e)=>{for(var t in e)Ta(r,t,{get:e[t],enumerable:!0})},bw=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mw(e))!vw.call(r,i)&&i!==t&&Ta(r,i,{get:()=>e[i],enumerable:!(n=gw(e,i))||n.enumerable});return r};var _w=r=>bw(Ta({},"__esModule",{value:!0}),r);var de=(r,e,t)=>yw(r,typeof e!="symbol"?e+"":e,t),Ou=(r,e,t)=>e.has(r)||Qg("Cannot "+t);var Z=(r,e,t)=>(Ou(r,e,"read from private field"),t?t.call(r):e.get(r)),ve=(r,e,t)=>e.has(r)?Qg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),oe=(r,e,t,n)=>(Ou(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),_e=(r,e,t)=>(Ou(r,e,"access private method"),t);var Lu=(r,e,t,n)=>({set _(i){oe(r,e,i,t)},get _(){return Z(r,e,n)}});var MR={};em(MR,{ANIMATION_KEYFRAMES:()=>os,ActivationConfigZ:()=>Ao,AddClassZ:()=>Zp,AnchorIdZ:()=>wt,AnchorStateZ:()=>ow,AnchorVisibleConditionZ:()=>hl,AppRegistry:()=>bi,AugmentationZ:()=>aw,BadgePositionZ:()=>Np,BadgeZ:()=>Qp,BoundingBoxZ:()=>sw,CanvasEvents:()=>Bi,CanvasRecipeZ:()=>Mu,ConditionZ:()=>kr,ContextManager:()=>Do,CooldownActiveConditionZ:()=>bl,CounterDefZ:()=>Ii,CtaButtonZ:()=>Ql,DEFAULT_COOLDOWN:()=>$l,DecisionController:()=>Ru,DecisionStrategyZ:()=>Ni,DismissedConditionZ:()=>yl,EVENT_SCHEMA_VERSION:()=>Pe,EventBus:()=>Io,EventCountConditionZ:()=>xl,EventFilterZ:()=>uw,EventHistory:()=>Yi,EventOccurredConditionZ:()=>fl,EventSourceZ:()=>Kg,ExecutorRegistry:()=>Eo,ExternalStrategyZ:()=>Li,FrequencyEntryZ:()=>fw,FrequencyLimitConditionZ:()=>_l,HighlightStepZ:()=>pw,HighlightStyleZ:()=>Lp,HighlightZ:()=>Xp,InsertHtmlZ:()=>Yp,InsertPositionZ:()=>Bp,InterventionTracker:()=>as,MAX_VISIBLE_TOASTS:()=>co,MatchOpZ:()=>Ri,ModalContentZ:()=>Hp,ModalZ:()=>th,ModelStrategyZ:()=>Oi,MountWidgetZ:()=>ih,NavigateZ:()=>nh,NavigationMonitor:()=>is,NormalizedEventZ:()=>cw,NotificationsController:()=>Hi,PageContextZ:()=>tw,PageHistoryEntryZ:()=>rw,PageUrlConditionZ:()=>dl,ParallelZ:()=>ah,PlacementZ:()=>Fp,PulseZ:()=>Jp,RUNTIME_SDK_BUILD:()=>Xg,RUNTIME_VERSION:()=>nf,RemoveClassZ:()=>Gp,RouteConditionZ:()=>pl,RouteFilterZ:()=>Pp,RuleStrategyZ:()=>Mi,RuleZ:()=>$i,RuntimeContextZ:()=>lw,RuntimeController:()=>Iu,RuntimeEventsController:()=>$u,SDK_SCHEMA_VERSION:()=>Cr,SDK_VERSION:()=>ji,STATIC_SLOT_STYLES:()=>tf,ScoreStrategyZ:()=>Pi,ScrollBehaviorZ:()=>Wp,ScrollLogicalPositionZ:()=>Jl,ScrollToZ:()=>rh,SelectorZ:()=>Yg,SequenceZ:()=>oh,SessionContextZ:()=>nw,SessionMetricConditionZ:()=>vl,SessionMetricTracker:()=>Fo,SetAttrZ:()=>qp,SetStyleZ:()=>Kp,SetTextZ:()=>zp,SmartCanvasController:()=>Ul,SmartCanvasElementLit:()=>Kn,StandardEvents:()=>Ke,StateEqualsConditionZ:()=>gl,StateStore:()=>jo,StoredValueZ:()=>hw,Syntro:()=>Gg,ThemeController:()=>Wi,TooltipContentZ:()=>Dp,TooltipStepZ:()=>dw,TooltipTriggerZ:()=>Vp,TooltipZ:()=>eh,TourStepForSchemaZ:()=>jp,TourZ:()=>lh,TriggerWhenZ:()=>ao,ViewportConditionZ:()=>ml,ViewportContextZ:()=>iw,WaitZ:()=>sh,WidgetConfigZ:()=>Up,WidgetRegistry:()=>zo,applyStaticSlotStyles:()=>Hc,coreActionStepSchemas:()=>yb,createActionEngine:()=>Xl,createAnchorResolver:()=>ec,createCanvasConfigFetcher:()=>zn,createContextManager:()=>Lc,createDecisionEngine:()=>Nc,createEventAccumulator:()=>Fc,createEventBus:()=>Ki,createGrowthBookClient:()=>Rc,createNoopClient:()=>Kc,createOverlayRecipeFetcher:()=>RR,createPostHogClient:()=>Tu,createPostHogNormalizer:()=>Nd,createSessionMetricTracker:()=>Ic,createSmartCanvas:()=>ic,createSmartCanvasController:()=>op,createSmartCanvasRuntime:()=>Gc,createStateStore:()=>Dc,createSurfaceContainer:()=>Wc,createSurfaces:()=>qc,decisionSchemas:()=>qC,decodeToken:()=>Gi,encodeToken:()=>sc,evaluate:()=>Yh,evaluateCondition:()=>Gh,evaluateRule:()=>Kh,evaluateRuleStrategy:()=>Ho,evaluateScoreStrategy:()=>Bo,evaluateSync:()=>Xh,executorRegistry:()=>cr,getAntiFlickerSnippet:()=>xb,getExecutor:()=>mb,getSlotAnchorId:()=>Wo,getSlotType:()=>ss,getSlotZIndex:()=>zc,hasExecutor:()=>Gl,needsMigration:()=>kR,normalizePostHogEvent:()=>Fi,parseVersion:()=>ws,playEnterAnimation:()=>Uc,playExitAnimation:()=>jc,registerConfigPredicates:()=>Gn,registerSmartCanvasElement:()=>wo,resolveConfigUri:()=>Vl,runtimeContext:()=>ob,setupAdjacentPositioning:()=>Bc,setupInlinePositioning:()=>Vc,shouldNormalizeEvent:()=>Di,validateAction:()=>qt,validateActions:()=>Co,validateActivationConfig:()=>zC,validateCondition:()=>jC,validateConfig:()=>xR,validateEventFilter:()=>AR,validateEventName:()=>cc,validateFrequencyEntry:()=>$R,validateNormalizedEvent:()=>CR,validateProps:()=>uc,validateRecipe:()=>TR,validateRuntimeContext:()=>ER,validateStoredValue:()=>IR,validateStrategy:()=>WC,widgetRegistry:()=>Zc});function xw(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 ww=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 tm(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(!ww.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 rm=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=tm(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=xw(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=tm(p.html))}}};function nm(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 nm(t)}return r}var im=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=nm(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)}}},sm=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)}}},om=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))}}},am=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)}}},lm=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)}}},Nu=[{kind:"content:insertHtml",executor:rm},{kind:"content:setText",executor:im},{kind:"content:setAttr",executor:sm},{kind:"content:addClass",executor:om},{kind:"content:removeClass",executor:am},{kind:"content:setStyle",executor:lm}],Fu={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:Nu};var cm=r=>{throw TypeError(r)},um=(r,e,t)=>e.has(r)||cm("Cannot "+t),We=(r,e,t)=>(um(r,e,"read from private field"),t?t.call(r):e.get(r)),Vr=(r,e,t)=>e.has(r)?cm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),fr=(r,e,t,n)=>(um(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var hm=["top","right","bottom","left"];var Ur=Math.min,gr=Math.max,ks=Math.round,Es=Math.floor,Lt=r=>({x:r,y:r}),Sw={left:"right",right:"left",bottom:"top",top:"bottom"},kw={start:"end",end:"start"};function Ia(r,e,t){return gr(r,Ur(e,t))}function fn(r,e){return typeof r=="function"?r(e):r}function jr(r){return r.split("-")[0]}function ci(r){return r.split("-")[1]}function Du(r){return r==="x"?"y":"x"}function $a(r){return r==="y"?"height":"width"}var Ew=new Set(["top","bottom"]);function mr(r){return Ew.has(jr(r))?"y":"x"}function Ma(r){return Du(mr(r))}function fm(r,e,t){t===void 0&&(t=!1);let n=ci(r),i=Ma(r),s=$a(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ss(o)),[o,Ss(o)]}function gm(r){let e=Ss(r);return[Ra(r),e,Ra(e)]}function Ra(r){return r.replace(/start|end/g,e=>kw[e])}var dm=["left","right"],pm=["right","left"],Cw=["top","bottom"],Aw=["bottom","top"];function Tw(r,e,t){switch(r){case"top":case"bottom":return t?e?pm:dm:e?dm:pm;case"left":case"right":return e?Cw:Aw;default:return[]}}function mm(r,e,t,n){let i=ci(r),s=Tw(jr(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Ra)))),s}function Ss(r){return r.replace(/left|right|bottom|top/g,e=>Sw[e])}function Rw(r){return{top:0,right:0,bottom:0,left:0,...r}}function Hu(r){return typeof r!="number"?Rw(r):{top:r,right:r,bottom:r,left:r}}function gn(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 vm(r,e,t){let{reference:n,floating:i}=r,s=mr(e),o=Ma(e),a=$a(o),l=jr(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(ci(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 _m(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}=fn(e,r),v=Hu(f),g=a[h?p==="floating"?"reference":"floating":p],b=gn(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,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),y=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},S=gn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:w,strategy:l}):x);return{top:(b.top-S.top+v.top)/y.y,bottom:(S.bottom-b.bottom+v.bottom)/y.y,left:(b.left-S.left+v.left)/y.x,right:(S.right-b.right+v.right)/y.x}}var xm=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}=vm(c,n,l),h=n,f={},v=0;for(let g=0;g<a.length;g++){var m;let{name:b,fn:x}=a[g],{x:w,y,data:S,reset:T}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(m=o.detectOverflow)!=null?m:_m},elements:{reference:r,floating:e}});u=w??u,p=y??p,f={...f,[b]:{...f[b],...S}},T&&v<=50&&(v++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):T.rects),{x:u,y:p}=vm(c,h,l)),g=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},wm=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}=fn(r,e)||{};if(c==null)return{};let p=Hu(u),h={x:t,y:n},f=Ma(i),v=$a(f),m=await o.getDimensions(c),g=f==="y",b=g?"top":"left",x=g?"bottom":"right",w=g?"clientHeight":"clientWidth",y=s.reference[v]+s.reference[f]-h[f]-s.floating[v],S=h[f]-s.reference[f],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),_=T?T[w]:0;(!_||!await(o.isElement==null?void 0:o.isElement(T)))&&(_=a.floating[w]||s.floating[v]);let C=y/2-S/2,R=_/2-m[v]/2-1,N=Ur(p[b],R),M=Ur(p[x],R),F=N,V=_-m[v]-M,P=_/2-m[v]/2+C,K=Ia(F,P,V),Y=!l.arrow&&ci(i)!=null&&P!==K&&s.reference[v]/2-(P<F?N:M)-m[v]/2<0,le=Y?P<F?P-F:P-V:0;return{[f]:h[f]+le,data:{[f]:K,centerOffset:P-K-le,...Y&&{alignmentOffset:le}},reset:Y}}});var Sm=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}=fn(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let b=jr(i),x=mr(a),w=jr(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=h||(w||!m?[Ss(a)]:gm(a)),T=v!=="none";!h&&T&&S.push(...mm(a,m,v,y));let _=[a,...S],C=await l.detectOverflow(e,g),R=[],N=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&R.push(C[b]),p){let P=fm(i,o,y);R.push(C[P[0]],C[P[1]])}if(N=[...N,{placement:i,overflows:R}],!R.every(P=>P<=0)){var M,F;let P=(((M=s.flip)==null?void 0:M.index)||0)+1,K=_[P];if(K&&(!(p==="alignment"?x!==mr(K):!1)||N.every(D=>mr(D.placement)===x?D.overflows[0]>0:!0)))return{data:{index:P,overflows:N},reset:{placement:K}};let Y=(F=N.filter(le=>le.overflows[0]<=0).sort((le,D)=>le.overflows[1]-D.overflows[1])[0])==null?void 0:F.placement;if(!Y)switch(f){case"bestFit":{var V;let le=(V=N.filter(D=>{if(T){let te=mr(D.placement);return te===x||te==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(te=>te>0).reduce((te,Ze)=>te+Ze,0)]).sort((D,te)=>D[1]-te[1])[0])==null?void 0:V[0];le&&(Y=le);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function ym(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function bm(r){return hm.some(e=>r[e]>=0)}var km=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=fn(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=ym(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:bm(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=ym(o,t.floating);return{data:{escapedOffsets:a,escaped:bm(a)}}}default:return{}}}}};var Iw=new Set(["left","top"]);async function $w(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=jr(t),a=ci(t),l=mr(t)==="y",c=Iw.has(o)?-1:1,u=s&&l?-1:1,p=fn(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 Em=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 $w(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}}}}},Cm=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:b=>{let{x,y:w}=b;return{x,y:w}}},...c}=fn(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=mr(jr(i)),f=Du(h),v=u[f],m=u[h];if(o){let b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",w=v+p[b],y=v-p[x];v=Ia(w,v,y)}if(a){let b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",w=m+p[b],y=m-p[x];m=Ia(w,m,y)}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 Pa(){return typeof window<"u"}function mn(r){return Tm(r)?(r.nodeName||"").toLowerCase():"#document"}function ft(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Nt(r){var e;return(e=(Tm(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Tm(r){return Pa()?r instanceof Node||r instanceof ft(r).Node:!1}function Ct(r){return Pa()?r instanceof Element||r instanceof ft(r).Element:!1}function Ft(r){return Pa()?r instanceof HTMLElement||r instanceof ft(r).HTMLElement:!1}function Am(r){return!Pa()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ft(r).ShadowRoot}var Mw=new Set(["inline","contents"]);function di(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=At(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!Mw.has(i)}var Pw=new Set(["table","td","th"]);function Rm(r){return Pw.has(mn(r))}var Ow=[":popover-open",":modal"];function Cs(r){return Ow.some(e=>{try{return r.matches(e)}catch{return!1}})}var Lw=["transform","translate","scale","rotate","perspective"],Nw=["transform","translate","scale","rotate","perspective","filter"],Fw=["paint","layout","strict","content"];function Oa(r){let e=La(),t=Ct(r)?At(r):r;return Lw.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)||Nw.some(n=>(t.willChange||"").includes(n))||Fw.some(n=>(t.contain||"").includes(n))}function Im(r){let e=vr(r);for(;Ft(e)&&!vn(e);){if(Oa(e))return e;if(Cs(e))return null;e=vr(e)}return null}function La(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Dw=new Set(["html","body","#document"]);function vn(r){return Dw.has(mn(r))}function At(r){return ft(r).getComputedStyle(r)}function As(r){return Ct(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function vr(r){if(mn(r)==="html")return r;let e=r.assignedSlot||r.parentNode||Am(r)&&r.host||Nt(r);return Am(e)?e.host:e}function $m(r){let e=vr(r);return vn(e)?r.ownerDocument?r.ownerDocument.body:r.body:Ft(e)&&di(e)?e:$m(e)}function ui(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=$m(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=ft(i);if(s){let a=Na(o);return e.concat(o,o.visualViewport||[],di(i)?i:[],a&&t?ui(a):[])}return e.concat(i,ui(i,[],t))}function Na(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Lm(r){let e=At(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=Ft(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=ks(t)!==s||ks(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function Vu(r){return Ct(r)?r:r.contextElement}function pi(r){let e=Vu(r);if(!Ft(e))return Lt(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Lm(e),o=(s?ks(t.width):t.width)/n,a=(s?ks(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Hw=Lt(0);function Nm(r){let e=ft(r);return!La()||!e.visualViewport?Hw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Bw(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==ft(r)?!1:e}function yn(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=Vu(r),o=Lt(1);e&&(n?Ct(n)&&(o=pi(n)):o=pi(r));let a=Bw(s,t,n)?Nm(s):Lt(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=ft(s),f=n&&Ct(n)?ft(n):n,v=h,m=Na(v);for(;m&&n&&f!==v;){let g=pi(m),b=m.getBoundingClientRect(),x=At(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*g.x,y=b.top+(m.clientTop+parseFloat(x.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,p*=g.y,l+=w,c+=y,v=ft(m),m=Na(v)}}return gn({width:u,height:p,x:l,y:c})}function Fa(r,e){let t=As(r).scrollLeft;return e?e.left+t:yn(Nt(r)).left+t}function Fm(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Fa(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function Vw(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=Nt(n),a=e?Cs(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Lt(1),u=Lt(0),p=Ft(n);if((p||!p&&!s)&&((mn(n)!=="body"||di(o))&&(l=As(n)),Ft(n))){let f=yn(n);c=pi(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?Fm(o,l):Lt(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 Uw(r){return Array.from(r.getClientRects())}function jw(r){let e=Nt(r),t=As(r),n=r.ownerDocument.body,i=gr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=gr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+Fa(r),a=-t.scrollTop;return At(n).direction==="rtl"&&(o+=gr(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Mm=25;function Ww(r,e){let t=ft(r),n=Nt(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=La();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Fa(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<=Mm&&(s-=v)}else c<=Mm&&(s+=c);return{width:s,height:o,x:a,y:l}}var zw=new Set(["absolute","fixed"]);function qw(r,e){let t=yn(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Ft(r)?pi(r):Lt(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 Pm(r,e,t){let n;if(e==="viewport")n=Ww(r,t);else if(e==="document")n=jw(Nt(r));else if(Ct(e))n=qw(e,t);else{let i=Nm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return gn(n)}function Dm(r,e){let t=vr(r);return t===e||!Ct(t)||vn(t)?!1:At(t).position==="fixed"||Dm(t,e)}function Zw(r,e){let t=e.get(r);if(t)return t;let n=ui(r,[],!1).filter(a=>Ct(a)&&mn(a)!=="body"),i=null,s=At(r).position==="fixed",o=s?vr(r):r;for(;Ct(o)&&!vn(o);){let a=At(o),l=Oa(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&zw.has(i.position)||di(o)&&!l&&Dm(r,o))?n=n.filter(u=>u!==o):i=a,o=vr(o)}return e.set(r,n),n}function Gw(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?Cs(e)?[]:Zw(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=Pm(e,u,i);return c.top=gr(p.top,c.top),c.right=Ur(p.right,c.right),c.bottom=Ur(p.bottom,c.bottom),c.left=gr(p.left,c.left),c},Pm(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Kw(r){let{width:e,height:t}=Lm(r);return{width:e,height:t}}function Yw(r,e,t){let n=Ft(e),i=Nt(e),s=t==="fixed",o=yn(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Lt(0);function c(){l.x=Fa(i)}if(n||!n&&!s)if((mn(e)!=="body"||di(i))&&(a=As(e)),n){let f=yn(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?Fm(i,a):Lt(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 Bu(r){return At(r).position==="static"}function Om(r,e){if(!Ft(r)||At(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Nt(r)===t&&(t=t.ownerDocument.body),t}function Hm(r,e){let t=ft(r);if(Cs(r))return t;if(!Ft(r)){let i=vr(r);for(;i&&!vn(i);){if(Ct(i)&&!Bu(i))return i;i=vr(i)}return t}let n=Om(r,e);for(;n&&Rm(n)&&Bu(n);)n=Om(n,e);return n&&vn(n)&&Bu(n)&&!Oa(n)?t:n||Im(r)||t}var Xw=async function(r){let e=this.getOffsetParent||Hm,t=this.getDimensions,n=await t(r.floating);return{reference:Yw(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Jw(r){return At(r).direction==="rtl"}var Qw={convertOffsetParentRelativeRectToViewportRelativeRect:Vw,getDocumentElement:Nt,getClippingRect:Gw,getOffsetParent:Hm,getElementRects:Xw,getClientRects:Uw,getDimensions:Kw,getScale:pi,isElement:Ct,isRTL:Jw};function Bm(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function e1(r,e){let t=null,n,i=Nt(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=Es(p),m=Es(i.clientWidth-(u+h)),g=Es(i.clientHeight-(p+f)),b=Es(u),w={rootMargin:-v+"px "+-m+"px "+-g+"px "+-b+"px",threshold:gr(0,Ur(1,l))||1},y=!0;function S(T){let _=T[0].intersectionRatio;if(_!==l){if(!y)return o();_?o(!1,_):n=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!Bm(c,r.getBoundingClientRect())&&o(),y=!1}try{t=new IntersectionObserver(S,{...w,root:i.ownerDocument})}catch{t=new IntersectionObserver(S,w)}t.observe(r)}return o(!0),s}function Da(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=Vu(r),u=i||s?[...c?ui(c):[],...ui(e)]:[];u.forEach(b=>{i&&b.addEventListener("scroll",t,{passive:!0}),s&&b.addEventListener("resize",t)});let p=c&&a?e1(c,t):null,h=-1,f=null;o&&(f=new ResizeObserver(b=>{let[x]=b;x&&x.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let v,m=l?yn(r):null;l&&g();function g(){let b=yn(r);m&&!Bm(m,b)&&t(),m=b,v=requestAnimationFrame(g)}return t(),()=>{var b;u.forEach(x=>{i&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),p?.(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(v)}}var Ha=Em;var Ba=Cm,Va=Sm;var Vm=km,Um=wm;var Ua=(r,e,t)=>{let n=new Map,i={platform:Qw,...t},s={...i.platform,_c:n};return xm(r,e,{...i,platform:s})};var ja=globalThis,Wa=ja.ShadowRoot&&(ja.ShadyCSS===void 0||ja.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Uu=Symbol(),jm=new WeakMap,Ts=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Uu)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(Wa&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=jm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&jm.set(t,e))}return e}toString(){return this.cssText}},Wm=r=>new Ts(typeof r=="string"?r:r+"",void 0,Uu),bn=(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 Ts(t,r,Uu)},zm=(r,e)=>{if(Wa)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=ja.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ju=Wa?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Wm(t)})(r):r;var{is:t1,defineProperty:r1,getOwnPropertyDescriptor:n1,getOwnPropertyNames:i1,getOwnPropertySymbols:s1,getPrototypeOf:o1}=Object,Wr=globalThis,qm=Wr.trustedTypes,a1=qm?qm.emptyScript:"",l1=Wr.reactiveElementPolyfillSupport,Rs=(r,e)=>r,Wu={toAttribute(r,e){switch(e){case Boolean:r=r?a1: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}},Gm=(r,e)=>!t1(r,e),Zm={attribute:!0,type:String,converter:Wu,reflect:!1,useDefault:!1,hasChanged:Gm};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Wr.litPropertyMetadata??(Wr.litPropertyMetadata=new WeakMap);var yr=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=Zm){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&&r1(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=n1(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)??Zm}static _$Ei(){if(this.hasOwnProperty(Rs("elementProperties")))return;let e=o1(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Rs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Rs("properties"))){let t=this.properties,n=[...i1(t),...s1(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(ju(i))}else e!==void 0&&t.push(ju(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 zm(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:Wu).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:Wu;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??Gm)(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){}};yr.elementStyles=[],yr.shadowRootOptions={mode:"open"},yr[Rs("elementProperties")]=new Map,yr[Rs("finalized")]=new Map,l1?.({ReactiveElement:yr}),(Wr.reactiveElementVersions??(Wr.reactiveElementVersions=[])).push("2.1.2");var $s=globalThis,Km=r=>r,za=$s.trustedTypes,Ym=za?za.createPolicy("lit-html",{createHTML:r=>r}):void 0,rv="$lit$",zr=`lit$${Math.random().toFixed(9).slice(2)}$`,nv="?"+zr,c1=`<${nv}>`,wn=document,Ms=()=>wn.createComment(""),Ps=r=>r===null||typeof r!="object"&&typeof r!="function",Xu=Array.isArray,u1=r=>Xu(r)||typeof r?.[Symbol.iterator]=="function",zu=`[
|
|
2
|
+
\f\r]`,Is=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xm=/-->/g,Jm=/>/g,_n=RegExp(`>|${zu}(?:([^\\s"'>=/]+)(${zu}*=${zu}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Qm=/'/g,ev=/"/g,iv=/^(?:script|style|textarea|title)$/i,Ju=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),L=Ju(1),eI=Ju(2),tI=Ju(3),Dt=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),tv=new WeakMap,xn=wn.createTreeWalker(wn,129);function sv(r,e){if(!Xu(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ym!==void 0?Ym.createHTML(e):e}var d1=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=Is;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===Is?u[1]==="!--"?o=Xm:u[1]!==void 0?o=Jm:u[2]!==void 0?(iv.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=_n):u[3]!==void 0&&(o=_n):o===_n?u[0]===">"?(o=i??Is,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?_n:u[3]==='"'?ev:Qm):o===ev||o===Qm?o=_n:o===Xm||o===Jm?o=Is:(o=_n,i=void 0);let f=o===_n&&r[a+1].startsWith("/>")?" ":"";s+=o===Is?l+c1:p>=0?(n.push(c),l.slice(0,p)+rv+l.slice(p)+zr+f):l+zr+(p===-2?a:f)}return[sv(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Os=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]=d1(e,t);if(this.el=r.createElement(c,n),xn.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=xn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(rv)){let h=u[o++],f=i.getAttribute(p).split(zr),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?Zu:v[1]==="?"?Gu:v[1]==="@"?Ku:fi}),i.removeAttribute(p)}else p.startsWith(zr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(iv.test(i.tagName)){let p=i.textContent.split(zr),h=p.length-1;if(h>0){i.textContent=za?za.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],Ms()),xn.nextNode(),l.push({type:2,index:++s});i.append(p[h],Ms())}}}else if(i.nodeType===8)if(i.data===nv)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(zr,p+1))!==-1;)l.push({type:7,index:s}),p+=zr.length-1}s++}}static createElement(e,t){let n=wn.createElement("template");return n.innerHTML=e,n}};function hi(r,e,t=r,n){if(e===Dt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=Ps(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=hi(r,i._$AS(r,e.values),i,n)),e}var qu=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??wn).importNode(t,!0);xn.currentNode=i;let s=xn.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Ls(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Yu(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=xn.nextNode(),o++)}return xn.currentNode=wn,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++}},Ls=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=hi(this,e,t),Ps(e)?e===J||e==null||e===""?(this._$AH!==J&&this._$AR(),this._$AH=J):e!==this._$AH&&e!==Dt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):u1(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&&Ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(wn.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=Os.createElement(sv(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new qu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=tv.get(e.strings);return t===void 0&&tv.set(e.strings,t=new Os(e)),t}k(e){Xu(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(Ms()),this.O(Ms()),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=Km(e).nextSibling;Km(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},fi=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=hi(this,e,t,0),o=!Ps(e)||e!==this._$AH&&e!==Dt,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=hi(this,a[n+l],t,l),c===Dt&&(c=this._$AH[l]),o||(o=!Ps(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??"")}},Zu=class extends fi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},Gu=class extends fi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},Ku=class extends fi{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=hi(this,e,t,0)??J)===Dt)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)}},Yu=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){hi(this,e)}};var p1=$s.litHtmlPolyfillSupport;p1?.(Os,Ls),($s.litHtmlVersions??($s.litHtmlVersions=[])).push("3.3.2");var ov=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new Ls(e.insertBefore(Ms(),s),s,void 0,t??{})}return i._$AI(r),i};var Ns=globalThis,ye=class extends yr{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=ov(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Dt}};ye._$litElement$=!0,ye.finalized=!0,Ns.litElementHydrateSupport?.({LitElement:ye});var h1=Ns.litElementPolyfillSupport;h1?.({LitElement:ye});(Ns.litElementVersions??(Ns.litElementVersions=[])).push("4.2.2");var qa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Za=r=>(...e)=>({_$litDirective$:r,values:e}),gi=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 av="important",f1=" !"+av,A=Za(class extends gi{constructor(r){if(super(r),r.type!==qa.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(f1);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?av:""):t[n]=i}}return Dt}});var g1={light:50,medium:100,heavy:200},m1=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],v1={init(r,e,t){let n=g1[t.intensity],i=t.colors.length>0?t.colors:m1,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())}},y1={light:20,medium:40,heavy:80},b1="\u{1F389}",_1={init(r,e,t){let n=y1[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:b1,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())}},x1={light:20,medium:40,heavy:80},w1={light:3,medium:4,heavy:5},S1={init(r,e,t){let n=x1[t.intensity],i=w1[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())}},k1={light:30,medium:60,heavy:120},E1={init(r,e,t){let n=k1[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()}}},C1=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(r,e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;this.container=r,this.effect=e,this.duration=t.duration;let i=document.createElement("canvas");i.setAttribute("data-syntro-celebrate",""),Object.assign(i.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"2147483646"});let s=window.devicePixelRatio||1,o=window.innerWidth,a=window.innerHeight;i.width=o*s,i.height=a*s,i.style.width=`${o}px`,i.style.height=`${a}px`;let l=i.getContext("2d");l&&(l.scale(s,s),this.canvas=i,this.ctx=l,r.appendChild(i),this.particles=e.init(o,a,t),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(r){if(!this.ctx||!this.canvas||!this.effect)return;let e=r-this.startTime,t=r-this.lastFrame;if(this.lastFrame=r,e>=this.duration){this.stop();return}let n=this.canvas.width/(window.devicePixelRatio||1),i=this.canvas.height/(window.devicePixelRatio||1);if(this.ctx.clearRect(0,0,n,i),!this.effect.update(this.particles,t,e)){this.stop();return}this.effect.render(this.ctx,this.particles),this.rafId=requestAnimationFrame(this.tick)}},A1=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function T1(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function R1(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 T1(t,n||t)}catch{}return null}var lv=new Map([["confetti",v1],["fireworks",S1],["sparkles",E1],["emoji-rain",_1]]),I1=async(r,e)=>{let t=lv.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...lv.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??R1(e.overlayRoot)??A1,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new C1;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}},$1=new Set(["http:","https:","mailto:","tel:"]);function M1(r){if(typeof r!="string"||r.trim().length===0)return!1;let e;try{e=new URL(r,"https://syntro.local/")}catch{return!1}return $1.has(e.protocol)}function hv(r){if(r.actionId==="dismiss"||!r.href||!M1(r.href))return!1;let e=r.href;return r.target==="_blank"?window.open(e,"_blank","noopener,noreferrer"):window.location.assign(e),!0}var td="syntro_active_tour",Ga=new Map;function P1(r){try{let e=localStorage.getItem(td);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Qu(r){try{localStorage.setItem(td,JSON.stringify(r))}catch{}}function O1(){try{localStorage.removeItem(td)}catch{}}function Bs(){return window.location.pathname}function L1(r){if(!r.route)return!0;let e=Bs();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var fv=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(Ga.has(t))return{cleanup:async()=>{let w=Ga.get(t);w&&await w.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=P1(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Qu(o));let l=n.findIndex(w=>w.id===o.currentStepId);if(l===-1){let w=i||n[0].id;l=n.findIndex(y=>y.id===w),l===-1&&(l=0),o.currentStepId=n[l].id,Qu(o)}let c=n[l];if(!L1(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Bs()}),{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 w=>{if(u)return;if(await v(),w==="end"){O1(),e.publishEvent("tour.completed",{tourId:t,totalSteps:n.length}),u=!0;return}let y=n.find(S=>S.id===w);if(!y){console.error(`[Tour] Step "${w}" not found`);return}if(o.currentStepId=w,Qu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:w}),y.route&&y.route!==Bs()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:w,targetRoute:y.route});return}await g(y)},g=async w=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:w.id,stepIndex:n.findIndex(y=>y.id===w.id),totalSteps:n.length});try{p=await e.applyAction(w.action)}catch(y){console.error(`[Tour] Failed to execute step "${w.id}":`,y),e.publishEvent("tour.step_failed",{tourId:t,stepId:w.id,error:String(y)});return}if(w.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",T=>{let _=T?.actionId;if(_&&w.onAction){let C=w.onAction[_];C&&m(C)}});let y=e.subscribeEvent("action.tooltip_cta_clicked",T=>{let _=T?.actionId;if(_&&w.onAction){let C=w.onAction[_];C&&m(C)}}),S=h;h=()=>{S(),y()}}}};f=(()=>{let w=Bs(),y=()=>{let _=Bs();_!==w&&(w=_,e.publishEvent("tour.route_changed",{tourId:t,newRoute:_}))};if(e.subscribeNavigation)return e.subscribeNavigation(()=>y());window.addEventListener("popstate",y);let S=history.pushState.bind(history),T=history.replaceState.bind(history);return history.pushState=(..._)=>{S(..._),queueMicrotask(y)},history.replaceState=(..._)=>{T(..._),queueMicrotask(y)},()=>{window.removeEventListener("popstate",y),history.pushState=S,history.replaceState=T}})(),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,Ga.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Ga.set(t,{cleanup:x}),{cleanup:x}},Kt={white:"#ffffff",black:"#000000"},gt={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},O={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"},Be={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Yt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},at={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},kn={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Fs={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Ds={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Hs={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},wI={primary:O[10],secondary:O[9],tertiary:O[8]},SI={primary:O[2],secondary:O[0]},kI={primary:O[4],secondary:O[3]},EI={primary:{text:Kt.white,icon:Kt.white,border:gt[3],backgroundDefault:gt[3],backgroundHover:gt[2]},neutral:{text:O[10],textHover:Kt.white,icon:O[10],iconHover:Kt.white,border:O[4],background:O[2]},link:{text:Kt.white,icon:Kt.white,hover:gt[5]},error:{text:at[5],hover:at[6]},success:{text:Be[5],hover:Be[6]}},CI={slateGrey:{content:O[10],pillOutline:O[10],borderPrimary:O[5],borderSecondary:O[5],background:O[3]},brand:{content:gt[9],pillOutline:gt[9],borderPrimary:gt[6],borderSecondary:gt[6],background:gt[0]},red:{content:at[8],pillOutline:at[4],borderPrimary:at[2],borderSecondary:at[2],background:at[0]},yellow:{content:Yt[8],pillOutline:Yt[4],borderPrimary:Yt[2],borderSecondary:Yt[2],background:Yt[0]},green:{content:Be[8],pillOutline:Be[4],borderPrimary:Be[2],borderSecondary:Be[2],background:Be[0]},purple:{content:Ds[8],pillOutline:Ds[4],borderPrimary:Ds[2],borderSecondary:Ds[2],background:Ds[0]},blue:{content:kn[8],pillOutline:kn[4],borderPrimary:kn[2],borderSecondary:kn[2],background:kn[0]},orange:{content:Fs[8],pillOutline:Fs[4],borderPrimary:Fs[2],borderSecondary:Fs[2],background:Fs[0]},pink:{content:Hs[8],pillOutline:Hs[4],borderPrimary:Hs[2],borderSecondary:Hs[2],background:Hs[0]}},AI={green:{content:Be[8],border:Be[2],background:Be[0]},yellow:{content:Yt[8],border:Yt[2],background:Yt[0]},red:{content:at[8],border:at[2],background:at[0]}},TI={green:{content:Be[1],background:Be[9]},yellow:{content:Yt[1],background:Yt[9]},red:{content:at[1],background:at[9]}},RI={content:O[10],border:O[4],background:O[3]},II={backgroundDefault:O[2],backgroundHover:O[1],selected:O[3]},$I={background:O[2],icon:O[10],borderDefault:O[4],borderSelected:gt[3],textLabel:O[9],textPlaceholder:O[8],textHint:O[8]},MI={backgroundDefault:O[2],backgroundDisabled:O[0],textLabel:O[9],textPlaceholder:O[8],textHint:O[8],textError:at[5],iconDefault:O[9],iconPlaceholder:O[10],iconError:at[5],borderDefault:O[4],borderSelected:gt[3],borderError:at[5]},PI={handleDefault:Kt.white,handleDisabled:O[10],off:{backgroundDefault:O[4],backgroundHover:O[5],backgroundDisabled:O[4]},on:{backgroundDefault:Be[3],backgroundHover:Be[2],backgroundDisabled:O[4]}},OI={off:{backgroundDefault:"#00000000",backgroundHover:O[5],backgroundDisabled:O[2],border:O[6]},on:{backgroundDefault:Be[0],backgroundHover:Be[1],backgroundDisabled:O[2],border:Be[3]}},LI={content:O[10],background:O[4]},NI={background:O[4],active:Be[3]},FI={background:O[1],content:O[9],border:O[4]},DI={backgroundDefault:O[1],backgroundHover:O[3],backgroundActive:O[4],border:O[4],contentPrimary:O[10],contentSecondary:O[9],contentTertiary:O[8]},HI={background:O[1],content:O[9],border:O[4]},BI={activeBackground:O[3],activeContent:gt[5],inactiveContent:O[9],border:O[4]},VI={header:{textDefault:O[9],textHover:O[8],backgroundDefault:O[1]},border:O[4],cell:{textPrimary:O[10],textSecondary:O[9],backgroundDefault:O[2],backgroundHover:O[1]}},UI={textPrimaryDefault:O[10],textPrimaryHover:O[10],textSecondaryDefault:O[8],textSecondaryHover:O[9],iconPrimary:O[10],iconSecondary:O[8]},jI={background:Be[1],active:Be[5]},WI={textDefault:O[10],textSelected:Kt.white,textDisabled:O[7],backgroundDefault:O[2],backgroundMiddle:O[3],backgroundSelected:gt[3],border:O[4]},zI=O[9],qI={size:56,inset:12,background:Kt.black,color:Kt.white,border:`2px solid ${gt[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)"},cv=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function N1(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, ${kn[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||kn[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(!cv)for(let R=0;R<4;R++){let N=document.createElement("div");N.style.position="fixed",N.style.background="inherit",g.push(N),f.appendChild(N)}let b=R=>{f.style.clipPath=R,f.style.webkitClipPath=R},x=()=>{if(!r.isConnected){C.destroy();return}let R=r.getBoundingClientRect(),N=R.left-n,M=R.top-n,F=R.width+n*2,V=R.height+n*2;if(Object.assign(m.style,{left:`${N}px`,top:`${M}px`,width:`${F}px`,height:`${V}px`}),cv){let P=window.innerWidth,K=window.innerHeight,Y=Math.min(i,F/2,V/2),le=`M 0 0 L ${P} 0 L ${P} ${K} L 0 ${K} Z`,D=`M ${N+Y} ${M} A ${Y} ${Y} 0 0 0 ${N} ${M+Y} L ${N} ${M+V-Y} A ${Y} ${Y} 0 0 0 ${N+Y} ${M+V} L ${N+F-Y} ${M+V} A ${Y} ${Y} 0 0 0 ${N+F} ${M+V-Y} L ${N+F} ${M+Y} A ${Y} ${Y} 0 0 0 ${N+F-Y} ${M} L ${N+Y} ${M} Z`;b(`path('${le} ${D}')`)}else{let[P,K,Y,le]=g;Object.assign(P.style,{left:"0px",top:"0px",width:"100vw",height:`${M}px`}),Object.assign(Y.style,{left:"0px",top:`${M+V}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(M+V))}px`}),Object.assign(le.style,{left:"0px",top:`${M}px`,width:`${N}px`,height:`${V}px`}),Object.assign(K.style,{left:`${N+F}px`,top:`${M}px`,width:`${Math.max(0,window.innerWidth-(N+F))}px`,height:`${V}px`})}},w=new ResizeObserver(()=>requestAnimationFrame(x));w.observe(r);let y=()=>requestAnimationFrame(x),S=()=>requestAnimationFrame(x);window.addEventListener("scroll",y,!0),window.addEventListener("resize",S);let T=R=>{R.key==="Escape"&&c&&(t?.onDismiss?.(),C.destroy())};c&&window.addEventListener("keydown",T);let _=R=>{a?(R.preventDefault(),R.stopPropagation()):l&&(t?.onDismiss?.(),C.destroy())};f.addEventListener("click",_);let C={destroy(){w.disconnect(),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",S),c&&window.removeEventListener("keydown",T),f.removeEventListener("click",_),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{m.remove()}catch{}},220)}};return x(),C}var F1=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 Xt(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(!F1.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 Sn={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)"},gv=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=`
|
|
4
4
|
position: fixed;
|
|
5
5
|
inset: 0;
|
|
6
6
|
background: rgba(0, 0, 0, ${s?.opacity??.6});
|
|
@@ -14,14 +14,14 @@ var SyntrologieSDK=(()=>{var Ca=Object.defineProperty;var lw=Object.getOwnProper
|
|
|
14
14
|
transform: translate(-50%, -50%) scale(0.95);
|
|
15
15
|
max-width: ${u[n]};
|
|
16
16
|
width: 90%;
|
|
17
|
-
background: ${
|
|
18
|
-
border-radius: ${
|
|
17
|
+
background: ${Sn.bg};
|
|
18
|
+
border-radius: ${Sn.radius};
|
|
19
19
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
20
20
|
z-index: 2147483646;
|
|
21
21
|
opacity: 0;
|
|
22
22
|
transition: opacity 200ms ease-out, transform 200ms ease-out;
|
|
23
23
|
padding: 24px;
|
|
24
|
-
`;let p="";if(t.title&&(p+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${
|
|
24
|
+
`;let p="";if(t.title&&(p+=`<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${Sn.title};">${Xt(t.title)}</h2>`),p+=`<div class="syntro-modal-body" style="color: ${Sn.text}; line-height: 1.5;">${Xt(t.body)}</div>`,o?.closeButton!==!1&&(p+=`
|
|
25
25
|
<button class="syntro-modal-close" data-syntro-action="dismiss" style="
|
|
26
26
|
position: absolute;
|
|
27
27
|
top: 16px;
|
|
@@ -30,17 +30,17 @@ var SyntrologieSDK=(()=>{var Ca=Object.defineProperty;var lw=Object.getOwnProper
|
|
|
30
30
|
border: none;
|
|
31
31
|
cursor: pointer;
|
|
32
32
|
padding: 4px;
|
|
33
|
-
color: ${
|
|
33
|
+
color: ${Sn.text};
|
|
34
34
|
opacity: 0.6;
|
|
35
35
|
" aria-label="Close">
|
|
36
36
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
37
37
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
38
38
|
</svg>
|
|
39
39
|
</button>
|
|
40
|
-
`),a&&a.length>0){p+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let
|
|
40
|
+
`),a&&a.length>0){p+='<div class="syntro-modal-actions" style="display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end;">';for(let S of a){let T=S.primary??!1;p+=`
|
|
41
41
|
<button
|
|
42
|
-
class="syntro-modal-btn ${
|
|
43
|
-
data-syntro-action="${
|
|
42
|
+
class="syntro-modal-btn ${T?"syntro-modal-btn-primary":""}"
|
|
43
|
+
data-syntro-action="${Xt(S.actionId)}"
|
|
44
44
|
style="
|
|
45
45
|
padding: 10px 20px;
|
|
46
46
|
border-radius: 8px;
|
|
@@ -48,67 +48,67 @@ var SyntrologieSDK=(()=>{var Ca=Object.defineProperty;var lw=Object.getOwnProper
|
|
|
48
48
|
font-weight: 500;
|
|
49
49
|
cursor: pointer;
|
|
50
50
|
transition: background 150ms ease;
|
|
51
|
-
${
|
|
51
|
+
${T?`background: ${Sn.accent}; color: white; border: none;`:`background: transparent; color: ${Sn.accent}; border: 1px solid currentColor; opacity: 0.7;`}
|
|
52
52
|
"
|
|
53
53
|
>
|
|
54
|
-
${
|
|
54
|
+
${Xt(S.label)}
|
|
55
55
|
</button>
|
|
56
|
-
`}p+="</div>"}c.innerHTML=p,e.overlayRoot.appendChild(c);let h=null,f=c.querySelectorAll("[data-syntro-action]"),v=w=>{let _=w.currentTarget.getAttribute("data-syntro-action");if(_){h=_;let C=a?.find(R=>R.actionId===_),I=C?.href;e.publishEvent("action.modal_cta_clicked",{actionId:_,...I?{href:I}:{}}),b.destroy(),C&&uv(C)}};f.forEach(w=>w.addEventListener("click",v));let g=w=>{w.key==="Escape"&&o?.onEsc!==!1&&b.destroy()};window.addEventListener("keydown",g);let m=()=>{i||b.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(()=>{b.destroy()},o.timeoutMs));let S=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');S.length>0&&requestAnimationFrame(()=>S[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 b={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:()=>{b.destroy()}}};function $1(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 M1(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=Yt(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=[Fa(t.offsetPx??8),Ha(),Da({padding:8}),Dm(),Hm({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Na(r,n,async()=>{if(!r.isConnected){v.destroy();return}let g=$1(r),m=await Ba(g,n,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:x,strategy:S,middlewareData:b,placement:w}=m;if(Object.assign(n.style,{left:`${y}px`,top:`${x}px`,position:S}),b.arrow){let{x:A,y:_}=b.arrow,C=w.split("-")[0],I={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:A!=null?`${A}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",[I[C]]:"-4px"});let R={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${R[C]||"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=S=>{S.key==="Tab"&&(S.shiftKey?document.activeElement===m&&(y.focus(),S.preventDefault()):document.activeElement===y&&(m.focus(),S.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 av="#1969fe",P1="#24ad32",O1="#0e1114",Ju="#677384",L1="#a8afba",lv="#f6f7f9",N1="#ffffff";function cv(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, ${N1})`,color:`var(--se-color-text-primary, ${O1})`,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 F1(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 mi="syntro-workflow-tracker",Vs,Us,fi,yr,js,Za,gi,ed=class extends be{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Br(this,Vs,null),Br(this,Us,null),Br(this,fi,[]),Br(this,yr,new Set),Br(this,js,{}),Br(this,Za,!1),Br(this,gi,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let r=this.runtimeRef?.actions?.getActive?.()??[],e=F1(r);if(hr(this,gi,e),e.size===0)return;let t=this._stateNs,n=t?.get("dismissed")??[],i=t?.get("completed")??{};this._workflowEntries=(()=>{let s=new Set(this._workflowEntries.map(a=>a.tourId)),o=[];for(let[a,{meta:l,steps:c}]of e){if(s.has(a))continue;let u="active";n.includes(a)?u="dismissed":i[a]&&(u="completed"),o.push({tourId:a,meta:l,steps:c,currentStepId:null,completedSteps:[],status:u,completedAt:i[a]||void 0})}return o.length>0?[...this._workflowEntries,...o]:this._workflowEntries})();for(let[s,{meta:o}]of e){let a=t?.get("dismissed")??[],l=t?.get("completed")??{};if(!je(this,yr).has(s)&&o.notification&&!a.includes(s)&&!l[s]){je(this,yr).add(s),t?.set("notified",[...je(this,yr)]);let c=cv(o.notification);je(this,fi).push(c)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let r of je(this,fi))r();hr(this,fi,[])}updated(r){r.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),r.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!je(this,Za)&&this._stateNs){let r=this._stateNs.get("notified")??[];for(let t of r)je(this,yr).add(t);let e=this._stateNs.get("completed")??{};hr(this,js,{...e}),hr(this,Za,!0)}hr(this,Vs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),hr(this,Us,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},r=>{this._handleTourEvent(r)})),this._rescanWorkflows()}}_teardownSubscriptions(){var r,e;(r=je(this,Vs))==null||r.call(this),hr(this,Vs,null),(e=je(this,Us))==null||e.call(this),hr(this,Us,null)}_handleTourEvent(r){let e=r.props?.tourId;if(!e)return;if(!je(this,gi).has(e)&&r.name==="tour.started"){this._actionVersion+=1;return}if(!je(this,gi).has(e))return;let t=this._stateNs;this._workflowEntries=this._workflowEntries.map(n=>{if(n.tourId!==e)return n;switch(r.name){case"tour.started":{let i=r.props?.startStepId||n.steps[0]?.id||null;if(!je(this,yr).has(e)){je(this,yr).add(e),t?.set("notified",[...je(this,yr)]);let o=je(this,gi).get(e);if(o?.meta.notification){let a=cv(o.meta.notification);je(this,fi).push(a)}}let s=this._workflowEntries.filter(o=>o.status==="active"||o.tourId===e).map(o=>o.tourId);return s.includes(e)||s.push(e),t?.set("active",[...new Set(s)]),{...n,status:"active",currentStepId:i,completedSteps:n.status==="active"?n.completedSteps:[]}}case"tour.step_started":{let i=r.props?.stepId;return{...n,currentStepId:i||n.currentStepId}}case"tour.step_changed":{let i=r.props?.previousStepId,s=r.props?.nextStepId,o=i&&!n.completedSteps.includes(i)?[...n.completedSteps,i]:n.completedSteps;return{...n,currentStepId:s||n.currentStepId,completedSteps:o}}case"tour.completed":{let i=Date.now();return je(this,js)[e]=i,t?.set("completed",{...je(this,js)}),{...n,status:"completed",currentStepId:null,completedSteps:n.steps.map(s=>s.id),completedAt:i}}case"tour.paused":return n;default:return n}})}_handleStepClick(r,e){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:r,stepId:e}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:r,stepId:e}}))}_handleDismiss(r){this._workflowEntries=this._workflowEntries.map(t=>t.tourId===r?{...t,status:"dismissed"}:t);let e=this._workflowEntries.filter(t=>t.status==="dismissed").map(t=>t.tourId);this._stateNs?.set("dismissed",e),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:r}}))}_renderProgressBar(r,e){let t=e>0?Math.round(r/e*100):0,n={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},i={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${av})`,transition:"width 0.3s ease",width:`${t}%`};return N`
|
|
57
|
-
<div style=${
|
|
56
|
+
`}p+="</div>"}c.innerHTML=p,e.overlayRoot.appendChild(c);let h=null,f=c.querySelectorAll("[data-syntro-action]"),v=S=>{let _=S.currentTarget.getAttribute("data-syntro-action");if(_){h=_;let C=a?.find(N=>N.actionId===_),R=C?.href;e.publishEvent("action.modal_cta_clicked",{actionId:_,...R?{href:R}:{}}),y.destroy(),C&&hv(C)}};f.forEach(S=>S.addEventListener("click",v));let m=S=>{S.key==="Escape"&&o?.onEsc!==!1&&y.destroy()};window.addEventListener("keydown",m);let g=()=>{i||y.destroy()};l.addEventListener("click",g);let b=[];i&&Array.from(document.body.children).forEach(S=>{S!==e.overlayRoot&&S.getAttribute("inert")===null&&!S.querySelector("[data-syntro-editor-panel]")&&!S.hasAttribute("data-syntro-editor-panel")&&(S.setAttribute("inert",""),b.push(S))});let x;o?.timeoutMs&&(x=setTimeout(()=>{y.destroy()},o.timeoutMs));let w=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');w.length>0&&requestAnimationFrame(()=>w[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 y={destroy(){x&&clearTimeout(x),window.removeEventListener("keydown",m),l.removeEventListener("click",g),f.forEach(S=>S.removeEventListener("click",v)),b.forEach(S=>S.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:()=>{y.destroy()}}};function D1(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 H1(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=Xt(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 b=m.currentTarget.getAttribute("data-syntro-action");b&&t.onAction&&t.onAction(b)};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=[Ha(t.offsetPx??8),Va(),Ba({padding:8}),Vm(),Um({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=Da(r,n,async()=>{if(!r.isConnected){v.destroy();return}let m=D1(r),g=await Ua(m,n,{placement:l,strategy:"fixed",middleware:a}),{x:b,y:x,strategy:w,middlewareData:y,placement:S}=g;if(Object.assign(n.style,{left:`${b}px`,top:`${x}px`,position:w}),y.arrow){let{x:T,y:_}=y.arrow,C=S.split("-")[0],R={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:T!=null?`${T}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",[R[C]]:"-4px"});let N={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${N[C]||"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],b=m[m.length-1],x=w=>{w.key==="Tab"&&(w.shiftKey?document.activeElement===g&&(b.focus(),w.preventDefault()):document.activeElement===b&&(g.focus(),w.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"},b=()=>{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",b),n.addEventListener("mouseenter",g),n.addEventListener("mouseleave",b),r.addEventListener("focus",g),r.addEventListener("blur",b),()=>{m&&clearTimeout(m),r.removeEventListener("mouseenter",g),r.removeEventListener("mouseleave",b),n.removeEventListener("mouseenter",g),n.removeEventListener("mouseleave",b),r.removeEventListener("focus",g),r.removeEventListener("blur",b)}}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 uv="#1969fe",B1="#24ad32",V1="#0e1114",ed="#677384",U1="#a8afba",dv="#f6f7f9",j1="#ffffff";function pv(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, ${j1})`,color:`var(--se-color-text-primary, ${V1})`,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 W1(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 yi="syntro-workflow-tracker",Vs,Us,mi,br,js,Ka,vi,rd=class extends ye{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Vr(this,Vs,null),Vr(this,Us,null),Vr(this,mi,[]),Vr(this,br,new Set),Vr(this,js,{}),Vr(this,Ka,!1),Vr(this,vi,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let r=this.runtimeRef?.actions?.getActive?.()??[],e=W1(r);if(fr(this,vi,e),e.size===0)return;let t=this._stateNs,n=t?.get("dismissed")??[],i=t?.get("completed")??{};this._workflowEntries=(()=>{let s=new Set(this._workflowEntries.map(a=>a.tourId)),o=[];for(let[a,{meta:l,steps:c}]of e){if(s.has(a))continue;let u="active";n.includes(a)?u="dismissed":i[a]&&(u="completed"),o.push({tourId:a,meta:l,steps:c,currentStepId:null,completedSteps:[],status:u,completedAt:i[a]||void 0})}return o.length>0?[...this._workflowEntries,...o]:this._workflowEntries})();for(let[s,{meta:o}]of e){let a=t?.get("dismissed")??[],l=t?.get("completed")??{};if(!We(this,br).has(s)&&o.notification&&!a.includes(s)&&!l[s]){We(this,br).add(s),t?.set("notified",[...We(this,br)]);let c=pv(o.notification);We(this,mi).push(c)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let r of We(this,mi))r();fr(this,mi,[])}updated(r){r.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),r.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!We(this,Ka)&&this._stateNs){let r=this._stateNs.get("notified")??[];for(let t of r)We(this,br).add(t);let e=this._stateNs.get("completed")??{};fr(this,js,{...e}),fr(this,Ka,!0)}fr(this,Vs,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),fr(this,Us,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},r=>{this._handleTourEvent(r)})),this._rescanWorkflows()}}_teardownSubscriptions(){var r,e;(r=We(this,Vs))==null||r.call(this),fr(this,Vs,null),(e=We(this,Us))==null||e.call(this),fr(this,Us,null)}_handleTourEvent(r){let e=r.props?.tourId;if(!e)return;if(!We(this,vi).has(e)&&r.name==="tour.started"){this._actionVersion+=1;return}if(!We(this,vi).has(e))return;let t=this._stateNs;this._workflowEntries=this._workflowEntries.map(n=>{if(n.tourId!==e)return n;switch(r.name){case"tour.started":{let i=r.props?.startStepId||n.steps[0]?.id||null;if(!We(this,br).has(e)){We(this,br).add(e),t?.set("notified",[...We(this,br)]);let o=We(this,vi).get(e);if(o?.meta.notification){let a=pv(o.meta.notification);We(this,mi).push(a)}}let s=this._workflowEntries.filter(o=>o.status==="active"||o.tourId===e).map(o=>o.tourId);return s.includes(e)||s.push(e),t?.set("active",[...new Set(s)]),{...n,status:"active",currentStepId:i,completedSteps:n.status==="active"?n.completedSteps:[]}}case"tour.step_started":{let i=r.props?.stepId;return{...n,currentStepId:i||n.currentStepId}}case"tour.step_changed":{let i=r.props?.previousStepId,s=r.props?.nextStepId,o=i&&!n.completedSteps.includes(i)?[...n.completedSteps,i]:n.completedSteps;return{...n,currentStepId:s||n.currentStepId,completedSteps:o}}case"tour.completed":{let i=Date.now();return We(this,js)[e]=i,t?.set("completed",{...We(this,js)}),{...n,status:"completed",currentStepId:null,completedSteps:n.steps.map(s=>s.id),completedAt:i}}case"tour.paused":return n;default:return n}})}_handleStepClick(r,e){this.runtimeRef?.events?.publish("workflow:jump_to_step",{tourId:r,stepId:e}),this.dispatchEvent(new CustomEvent("workflow-step-click",{bubbles:!0,detail:{tourId:r,stepId:e}}))}_handleDismiss(r){this._workflowEntries=this._workflowEntries.map(t=>t.tourId===r?{...t,status:"dismissed"}:t);let e=this._workflowEntries.filter(t=>t.status==="dismissed").map(t=>t.tourId);this._stateNs?.set("dismissed",e),this.dispatchEvent(new CustomEvent("workflow-dismissed",{bubbles:!0,detail:{tourId:r}}))}_renderProgressBar(r,e){let t=e>0?Math.round(r/e*100):0,n={width:"100%",height:"6px",borderRadius:"9999px",background:"rgba(255,255,255,0.08)",overflow:"hidden"},i={height:"100%",borderRadius:"9999px",background:`var(--se-color-primary, ${uv})`,transition:"width 0.3s ease",width:`${t}%`};return L`
|
|
57
|
+
<div style=${A(n)}>
|
|
58
58
|
<div
|
|
59
59
|
role="progressbar"
|
|
60
60
|
aria-valuenow=${t}
|
|
61
61
|
aria-valuemin="0"
|
|
62
62
|
aria-valuemax="100"
|
|
63
|
-
style=${
|
|
63
|
+
style=${A(i)}
|
|
64
64
|
></div>
|
|
65
65
|
</div>
|
|
66
|
-
`}_renderStepItem(r,e,t,n){let i={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:t?`var(--se-color-text-primary, ${
|
|
66
|
+
`}_renderStepItem(r,e,t,n){let i={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:t?`var(--se-color-text-primary, ${dv})`:`var(--se-color-text-secondary, ${U1})`,fontWeight:t?"600":"400"},s={flexShrink:"0",width:"16px",textAlign:"center"},o={display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",background:t?`var(--se-color-primary, ${uv})`:"rgba(255,255,255,0.12)"},a={color:`var(--se-color-success, ${B1})`},l={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},c=e?L`<span role="img" aria-label="completed" style=${A(a)}>✓</span>`:t?L`<span style=${A(o)}></span>`:L`<span style=${A(o)}></span>`;return L`
|
|
67
67
|
<button
|
|
68
68
|
type="button"
|
|
69
69
|
data-testid=${`step-${r.id}`}
|
|
70
|
-
data-current=${t?"true":
|
|
71
|
-
data-completed=${e?"true":
|
|
72
|
-
aria-current=${t?"step":
|
|
73
|
-
style=${
|
|
70
|
+
data-current=${t?"true":J}
|
|
71
|
+
data-completed=${e?"true":J}
|
|
72
|
+
aria-current=${t?"step":J}
|
|
73
|
+
style=${A(i)}
|
|
74
74
|
@click=${()=>this._handleStepClick(n,r.id)}
|
|
75
75
|
>
|
|
76
|
-
<span style=${
|
|
77
|
-
<span style=${
|
|
76
|
+
<span style=${A(s)}>${c}</span>
|
|
77
|
+
<span style=${A(l)}>${r.title}</span>
|
|
78
78
|
</button>
|
|
79
|
-
`}_renderWorkflowCard(r){let e=r.completedSteps.length,t=r.steps.length,n={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},i={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},s={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${
|
|
80
|
-
<div style=${
|
|
79
|
+
`}_renderWorkflowCard(r){let e=r.completedSteps.length,t=r.steps.length,n={padding:"12px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)"},i={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},s={flex:"1",fontSize:"13px",fontWeight:"600",color:`var(--se-color-text-primary, ${dv})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${ed})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},a={marginBottom:"8px"},l={fontSize:"10px",color:`var(--se-color-text-tertiary, ${ed})`,marginTop:"4px"},c={display:"flex",flexDirection:"column"};return L`
|
|
80
|
+
<div style=${A(n)}>
|
|
81
81
|
<!-- Header: icon + title + dismiss -->
|
|
82
|
-
<div style=${
|
|
83
|
-
${r.meta.icon?
|
|
84
|
-
<span style=${
|
|
82
|
+
<div style=${A(i)}>
|
|
83
|
+
${r.meta.icon?L`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${r.meta.icon}</span>`:J}
|
|
84
|
+
<span style=${A(s)}>${r.meta.title}</span>
|
|
85
85
|
<button
|
|
86
86
|
type="button"
|
|
87
87
|
data-testid=${`dismiss-${r.tourId}`}
|
|
88
|
-
style=${
|
|
88
|
+
style=${A(o)}
|
|
89
89
|
aria-label=${`Dismiss ${r.meta.title}`}
|
|
90
90
|
@click=${()=>this._handleDismiss(r.tourId)}
|
|
91
91
|
>✕</button>
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
94
|
<!-- Progress bar + label -->
|
|
95
|
-
<div style=${
|
|
95
|
+
<div style=${A(a)}>
|
|
96
96
|
${this._renderProgressBar(e,t)}
|
|
97
|
-
<div style=${
|
|
97
|
+
<div style=${A(l)}>
|
|
98
98
|
${e} of ${t} steps
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
|
|
102
102
|
<!-- Step list -->
|
|
103
|
-
<div style=${
|
|
103
|
+
<div style=${A(c)}>
|
|
104
104
|
${r.steps.map(u=>this._renderStepItem(u,r.completedSteps.includes(u.id),r.currentStepId===u.id,r.tourId))}
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
|
-
`}render(){let r=this._workflowEntries.filter(t=>t.status==="active");if(r.length===0){let t={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${
|
|
108
|
-
<div style=${
|
|
107
|
+
`}render(){let r=this._workflowEntries.filter(t=>t.status==="active");if(r.length===0){let t={display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 0",fontSize:"12px",color:`var(--se-color-text-tertiary, ${ed})`};return L`<div style=${A(t)}>No active workflows</div>`}return L`
|
|
108
|
+
<div style=${A({display:"flex",flexDirection:"column",gap:"8px"})}>
|
|
109
109
|
${r.map(t=>this._renderWorkflowCard(t))}
|
|
110
110
|
</div>
|
|
111
|
-
`}};Vs=new WeakMap;Us=new WeakMap;
|
|
111
|
+
`}};Vs=new WeakMap;Us=new WeakMap;mi=new WeakMap;br=new WeakMap;js=new WeakMap;Ka=new WeakMap;vi=new WeakMap;rd.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(yi)&&customElements.define(yi,rd);var z1={mount(r,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(yi)&&customElements.define(yi,rd);let n=document.createElement(yi);return n.runtimeRef=t,r.appendChild(n),()=>{n.remove()}},update(r,e){let t=r.querySelector(yi);if(!t)return;let n=e?.runtime??null;t.runtimeRef=n}},mv=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=N1(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")}}},vv=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(),b=m.getPropertyValue("--sc-color-primary-hover")?.trim();g?.startsWith("#")&&g.length>=7&&(o=i(g)),b?.startsWith("#")&&b.length>=7&&(a=i(b))}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}=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 Ca=Object.defineProperty;var lw=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(${
|
|
120
|
+
box-shadow: 0 0 0 0 rgba(${m}, ${g}, ${b}, 0.35);
|
|
121
121
|
}
|
|
122
122
|
75% {
|
|
123
|
-
box-shadow: 0 0 0 12px rgba(${
|
|
123
|
+
box-shadow: 0 0 0 12px rgba(${m}, ${g}, ${b}, 0);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
`}else c.textContent=`
|
|
@@ -132,22 +132,22 @@ var SyntrologieSDK=(()=>{var Ca=Object.defineProperty;var lw=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"))}}},
|
|
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"))}}},yv=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)}}},bv=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">${Xt(n.title)}</div>`),i+=`<div class="syntro-tt-body">${Xt(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="${
|
|
138
|
+
data-syntro-action="${Xt(o.actionId)}"
|
|
139
139
|
>
|
|
140
|
-
${
|
|
140
|
+
${Xt(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
|
-
${
|
|
144
|
+
${Xt(n.cta.label)}
|
|
145
145
|
</button>
|
|
146
|
-
</div>`);let s=M1(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);if(a){e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label,...a.href?{href:a.href}:{}}),s.destroy(),uv(a);return}}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},td=[{kind:"overlays:highlight",executor:hv},{kind:"overlays:pulse",executor:fv},{kind:"overlays:badge",executor:gv},{kind:"overlays:tooltip",executor:mv},{kind:"overlays:modal",executor:pv},{kind:"overlays:tour",executor:dv},{kind:"overlays:celebrate",executor:S1}],rd={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:td,widgets:[{id:"adaptive-overlays:workflow-tracker",component:D1,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function nd(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 id(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var H1=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"]),B1=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),V1={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function vv(r){return V1[r]??r}function yv(r){return H1.has(r)}function bv(r){if(yv(r))return null;let e=r.indexOf(":");return e===-1?null:vv(r.slice(0,e))}function sd(r){let e=r.indexOf(":");return e===-1?null:vv(r.slice(0,e))}function od(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,A)=>{setTimeout(()=>A(new Error(`Timeout loading app: ${g}`)),n)}),S=p(y,g);await Promise.race([S,x]),a.add(y);let b=t.get(g);if(!b)throw new Error(`App ${g} did not register after loading`);return s?.(g,!0),{appId:g,success:!0,manifest:b.manifest}}catch(y){let x=y instanceof Error?y.message:String(y);s?.(g,!1,x);let S={appId:g,success:!1,error:x};return l.set(g,S),S}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 S=document.createElement("script");S.src=g,S.async=!0,S.onload=()=>{t.get(m)?y():x(new Error(`App ${m} did not self-register`))},S.onerror=()=>{x(new Error(`Failed to load app script: ${g}`))},document.head.appendChild(S)})}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=bv(y.kind);if(x&&m.add(x),y.kind==="core:mountWidget"){let S=y.widget?.widgetId;if(S){let b=sd(S);b&&m.add(b)}}}if(g.tiles){for(let y of g.tiles)if(y.widget){let x=sd(y.widget);x&&m.add(x)}}for(let y of B1)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 vi=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=nd({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)}id(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()}},Ws=new vi;var Xt={white:"#ffffff",black:"#000000"},ft={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},M={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"},Be={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Jt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},ot={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},zs={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},qs={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"},Zs={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var e$={primary:M[10],secondary:M[9],tertiary:M[8]},t$={primary:M[2],secondary:M[0]},r$={primary:M[4],secondary:M[3]},n$={primary:{text:Xt.white,icon:Xt.white,border:ft[3],backgroundDefault:ft[3],backgroundHover:ft[2]},neutral:{text:M[10],textHover:Xt.white,icon:M[10],iconHover:Xt.white,border:M[4],background:M[2]},link:{text:Xt.white,icon:Xt.white,hover:ft[5]},error:{text:ot[5],hover:ot[6]},success:{text:Be[5],hover:Be[6]}},i$={slateGrey:{content:M[10],pillOutline:M[10],borderPrimary:M[5],borderSecondary:M[5],background:M[3]},brand:{content:ft[9],pillOutline:ft[9],borderPrimary:ft[6],borderSecondary:ft[6],background:ft[0]},red:{content:ot[8],pillOutline:ot[4],borderPrimary:ot[2],borderSecondary:ot[2],background:ot[0]},yellow:{content:Jt[8],pillOutline:Jt[4],borderPrimary:Jt[2],borderSecondary:Jt[2],background:Jt[0]},green:{content:Be[8],pillOutline:Be[4],borderPrimary:Be[2],borderSecondary:Be[2],background:Be[0]},purple:{content:Ft[8],pillOutline:Ft[4],borderPrimary:Ft[2],borderSecondary:Ft[2],background:Ft[0]},blue:{content:zs[8],pillOutline:zs[4],borderPrimary:zs[2],borderSecondary:zs[2],background:zs[0]},orange:{content:qs[8],pillOutline:qs[4],borderPrimary:qs[2],borderSecondary:qs[2],background:qs[0]},pink:{content:Zs[8],pillOutline:Zs[4],borderPrimary:Zs[2],borderSecondary:Zs[2],background:Zs[0]}},s$={green:{content:Be[8],border:Be[2],background:Be[0]},yellow:{content:Jt[8],border:Jt[2],background:Jt[0]},red:{content:ot[8],border:ot[2],background:ot[0]}},o$={green:{content:Be[1],background:Be[9]},yellow:{content:Jt[1],background:Jt[9]},red:{content:ot[1],background:ot[9]}},a$={content:M[10],border:M[4],background:M[3]},l$={backgroundDefault:M[2],backgroundHover:M[1],selected:M[3]},c$={background:M[2],icon:M[10],borderDefault:M[4],borderSelected:ft[3],textLabel:M[9],textPlaceholder:M[8],textHint:M[8]},u$={backgroundDefault:M[2],backgroundDisabled:M[0],textLabel:M[9],textPlaceholder:M[8],textHint:M[8],textError:ot[5],iconDefault:M[9],iconPlaceholder:M[10],iconError:ot[5],borderDefault:M[4],borderSelected:ft[3],borderError:ot[5]},d$={handleDefault:Xt.white,handleDisabled:M[10],off:{backgroundDefault:M[4],backgroundHover:M[5],backgroundDisabled:M[4]},on:{backgroundDefault:Be[3],backgroundHover:Be[2],backgroundDisabled:M[4]}},p$={off:{backgroundDefault:"#00000000",backgroundHover:M[5],backgroundDisabled:M[2],border:M[6]},on:{backgroundDefault:Be[0],backgroundHover:Be[1],backgroundDisabled:M[2],border:Be[3]}},h$={content:M[10],background:M[4]},f$={background:M[4],active:Be[3]},g$={background:M[1],content:M[9],border:M[4]},m$={backgroundDefault:M[1],backgroundHover:M[3],backgroundActive:M[4],border:M[4],contentPrimary:M[10],contentSecondary:M[9],contentTertiary:M[8]},v$={background:M[1],content:M[9],border:M[4]},y$={activeBackground:M[3],activeContent:ft[5],inactiveContent:M[9],border:M[4]},b$={header:{textDefault:M[9],textHover:M[8],backgroundDefault:M[1]},border:M[4],cell:{textPrimary:M[10],textSecondary:M[9],backgroundDefault:M[2],backgroundHover:M[1]}},_$={textPrimaryDefault:M[10],textPrimaryHover:M[10],textSecondaryDefault:M[8],textSecondaryHover:M[9],iconPrimary:M[10],iconSecondary:M[8]},x$={background:Be[1],active:Be[5]},w$={textDefault:M[10],textSelected:Xt.white,textDisabled:M[7],backgroundDefault:M[2],backgroundMiddle:M[3],backgroundSelected:ft[3],border:M[4]},S$=M[9];var k$={size:56,inset:12,background:Xt.black,color:Xt.white,border:`2px solid ${ft[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 Gs=class extends hi{constructor(e){if(super(e),this.it=ee,e.type!==Wa.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ee||e==null)return this._t=void 0,this.it=e;if(e===Nt)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:[]}}};Gs.directiveName="unsafeHTML",Gs.resultType=1;var Ga=za(Gs);function ud(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var En=ud();function Cv(r){En=r}var Sn={exec:()=>null};function ve(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(at.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var U1=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),at={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)}}>`)},j1=/^(?:[ \t]*(?:\n|$))+/,W1=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,z1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Js=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,q1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Av=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Tv=ve(Av).replace(/bull/g,dd).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(),Z1=ve(Av).replace(/bull/g,dd).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(),pd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,G1=/^[^\n]+/,hd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,K1=ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Y1=ve(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dd).getRegex(),el="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",fd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,X1=ve("^ {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",fd).replace("tag",el).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Rv=ve(pd).replace("hr",Js).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",el).getRegex(),J1=ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Rv).getRegex(),gd={blockquote:J1,code:W1,def:K1,fences:z1,heading:q1,hr:Js,html:X1,lheading:Tv,list:Y1,newline:j1,paragraph:Rv,table:Sn,text:G1},_v=ve("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Js).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",el).getRegex(),Q1={...gd,lheading:Z1,table:_v,paragraph:ve(pd).replace("hr",Js).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_v).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",el).getRegex()},eS={...gd,html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fd).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:Sn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ve(pd).replace("hr",Js).replace("heading",` *#{1,6} *[^
|
|
147
|
-
]`).replace("lheading"
|
|
146
|
+
</div>`);let s=H1(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);if(a){e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label,...a.href?{href:a.href}:{}}),s.destroy(),hv(a);return}}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},nd=[{kind:"overlays:highlight",executor:mv},{kind:"overlays:pulse",executor:vv},{kind:"overlays:badge",executor:yv},{kind:"overlays:tooltip",executor:bv},{kind:"overlays:modal",executor:gv},{kind:"overlays:tour",executor:fv},{kind:"overlays:celebrate",executor:I1}],id={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:nd,widgets:[{id:"adaptive-overlays:workflow-tracker",component:z1,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function sd(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 od(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var q1=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"]),Z1=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),G1={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function _v(r){return G1[r]??r}function xv(r){return q1.has(r)}function wv(r){if(xv(r))return null;let e=r.indexOf(":");return e===-1?null:_v(r.slice(0,e))}function ad(r){let e=r.indexOf(":");return e===-1?null:_v(r.slice(0,e))}function ld(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 b=c(m);if(a.has(b)){let S=t.get(m);if(S)return s?.(m,!0),{appId:m,success:!0,manifest:S.manifest}}let x=new Promise((S,T)=>{setTimeout(()=>T(new Error(`Timeout loading app: ${m}`)),n)}),w=p(b,m);await Promise.race([w,x]),a.add(b);let y=t.get(m);if(!y)throw new Error(`App ${m} did not register after loading`);return s?.(m,!0),{appId:m,success:!0,manifest:y.manifest}}catch(b){let x=b instanceof Error?b.message:String(b);s?.(m,!1,x);let w={appId:m,success:!1,error:x};return l.set(m,w),w}finally{o.delete(m)}})();return o.set(m,g),g}async function p(m,g){if(typeof window<"u"){try{let b=await import(m);b.manifest?t.register(b.manifest):b.default?.manifest?t.register(b.default.manifest):b.default&&t.register(b.default);return}catch{}return new Promise((b,x)=>{let w=document.createElement("script");w.src=m,w.async=!0,w.onload=()=>{t.get(g)?b():x(new Error(`App ${g} did not self-register`))},w.onerror=()=>{x(new Error(`Failed to load app script: ${m}`))},document.head.appendChild(w)})}throw new Error("Dynamic app loading not supported in SSR")}function h(m){let g=new Set;if(m.apps)for(let b of m.apps)g.add(b);if(m.actions)for(let b of m.actions){let x=wv(b.kind);if(x&&g.add(x),b.kind==="core:mountWidget"){let w=b.widget?.widgetId;if(w){let y=ad(w);y&&g.add(y)}}}if(m.tiles){for(let b of m.tiles)if(b.widget){let x=ad(b.widget);x&&g.add(x)}}for(let b of Z1)g.delete(b);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 bi=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=sd({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)}od(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()}},Ws=new bi;var Jt={white:"#ffffff",black:"#000000"},mt={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},$={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"},Ve={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Qt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},lt={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},zs={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},qs={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"},Zs={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var c$={primary:$[10],secondary:$[9],tertiary:$[8]},u$={primary:$[2],secondary:$[0]},d$={primary:$[4],secondary:$[3]},p$={primary:{text:Jt.white,icon:Jt.white,border:mt[3],backgroundDefault:mt[3],backgroundHover:mt[2]},neutral:{text:$[10],textHover:Jt.white,icon:$[10],iconHover:Jt.white,border:$[4],background:$[2]},link:{text:Jt.white,icon:Jt.white,hover:mt[5]},error:{text:lt[5],hover:lt[6]},success:{text:Ve[5],hover:Ve[6]}},h$={slateGrey:{content:$[10],pillOutline:$[10],borderPrimary:$[5],borderSecondary:$[5],background:$[3]},brand:{content:mt[9],pillOutline:mt[9],borderPrimary:mt[6],borderSecondary:mt[6],background:mt[0]},red:{content:lt[8],pillOutline:lt[4],borderPrimary:lt[2],borderSecondary:lt[2],background:lt[0]},yellow:{content:Qt[8],pillOutline:Qt[4],borderPrimary:Qt[2],borderSecondary:Qt[2],background:Qt[0]},green:{content:Ve[8],pillOutline:Ve[4],borderPrimary:Ve[2],borderSecondary:Ve[2],background:Ve[0]},purple:{content:Ht[8],pillOutline:Ht[4],borderPrimary:Ht[2],borderSecondary:Ht[2],background:Ht[0]},blue:{content:zs[8],pillOutline:zs[4],borderPrimary:zs[2],borderSecondary:zs[2],background:zs[0]},orange:{content:qs[8],pillOutline:qs[4],borderPrimary:qs[2],borderSecondary:qs[2],background:qs[0]},pink:{content:Zs[8],pillOutline:Zs[4],borderPrimary:Zs[2],borderSecondary:Zs[2],background:Zs[0]}},f$={green:{content:Ve[8],border:Ve[2],background:Ve[0]},yellow:{content:Qt[8],border:Qt[2],background:Qt[0]},red:{content:lt[8],border:lt[2],background:lt[0]}},g$={green:{content:Ve[1],background:Ve[9]},yellow:{content:Qt[1],background:Qt[9]},red:{content:lt[1],background:lt[9]}},m$={content:$[10],border:$[4],background:$[3]},v$={backgroundDefault:$[2],backgroundHover:$[1],selected:$[3]},y$={background:$[2],icon:$[10],borderDefault:$[4],borderSelected:mt[3],textLabel:$[9],textPlaceholder:$[8],textHint:$[8]},b$={backgroundDefault:$[2],backgroundDisabled:$[0],textLabel:$[9],textPlaceholder:$[8],textHint:$[8],textError:lt[5],iconDefault:$[9],iconPlaceholder:$[10],iconError:lt[5],borderDefault:$[4],borderSelected:mt[3],borderError:lt[5]},_$={handleDefault:Jt.white,handleDisabled:$[10],off:{backgroundDefault:$[4],backgroundHover:$[5],backgroundDisabled:$[4]},on:{backgroundDefault:Ve[3],backgroundHover:Ve[2],backgroundDisabled:$[4]}},x$={off:{backgroundDefault:"#00000000",backgroundHover:$[5],backgroundDisabled:$[2],border:$[6]},on:{backgroundDefault:Ve[0],backgroundHover:Ve[1],backgroundDisabled:$[2],border:Ve[3]}},w$={content:$[10],background:$[4]},S$={background:$[4],active:Ve[3]},k$={background:$[1],content:$[9],border:$[4]},E$={backgroundDefault:$[1],backgroundHover:$[3],backgroundActive:$[4],border:$[4],contentPrimary:$[10],contentSecondary:$[9],contentTertiary:$[8]},C$={background:$[1],content:$[9],border:$[4]},A$={activeBackground:$[3],activeContent:mt[5],inactiveContent:$[9],border:$[4]},T$={header:{textDefault:$[9],textHover:$[8],backgroundDefault:$[1]},border:$[4],cell:{textPrimary:$[10],textSecondary:$[9],backgroundDefault:$[2],backgroundHover:$[1]}},R$={textPrimaryDefault:$[10],textPrimaryHover:$[10],textSecondaryDefault:$[8],textSecondaryHover:$[9],iconPrimary:$[10],iconSecondary:$[8]},I$={background:Ve[1],active:Ve[5]},$$={textDefault:$[10],textSelected:Jt.white,textDisabled:$[7],backgroundDefault:$[2],backgroundMiddle:$[3],backgroundSelected:mt[3],border:$[4]},M$=$[9];var P$={size:56,inset:12,background:Jt.black,color:Jt.white,border:`2px solid ${mt[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 Gs=class extends gi{constructor(e){if(super(e),this.it=J,e.type!==qa.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===Dt)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:[]}}};Gs.directiveName="unsafeHTML",Gs.resultType=1;var Ya=Za(Gs);function pd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var An=pd();function Rv(r){An=r}var En={exec:()=>null};function me(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(ct.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var K1=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ct={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)}}>`)},Y1=/^(?:[ \t]*(?:\n|$))+/,X1=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,J1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Js=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Q1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Iv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$v=me(Iv).replace(/bull/g,hd).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(),eS=me(Iv).replace(/bull/g,hd).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(),fd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tS=/^[^\n]+/,gd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rS=me(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",gd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nS=me(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hd).getRegex(),rl="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",md=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,iS=me("^ {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",md).replace("tag",rl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mv=me(fd).replace("hr",Js).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",rl).getRegex(),sS=me(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Mv).getRegex(),vd={blockquote:sS,code:X1,def:rS,fences:J1,heading:Q1,hr:Js,html:iS,lheading:$v,list:nS,newline:Y1,paragraph:Mv,table:En,text:tS},Sv=me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Js).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",rl).getRegex(),oS={...vd,lheading:eS,table:Sv,paragraph:me(fd).replace("hr",Js).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sv).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",rl).getRegex()},aS={...vd,html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",md).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:me(fd).replace("hr",Js).replace("heading",` *#{1,6} *[^
|
|
147
|
+
]`).replace("lheading",$v).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pv=/^( {2,}|\\)\n(?!\s*$)/,uS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nl=/[\p{P}\p{S}]/u,yd=/[\s\p{P}\p{S}]/u,Ov=/[^\s\p{P}\p{S}]/u,dS=me(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yd).getRegex(),Lv=/(?!~)[\p{P}\p{S}]/u,pS=/(?!~)[\s\p{P}\p{S}]/u,hS=/(?:[^\s\p{P}\p{S}]|~)/u,Nv=/(?![*_])[\p{P}\p{S}]/u,fS=/(?![*_])[\s\p{P}\p{S}]/u,gS=/(?:[^\s\p{P}\p{S}]|[*_])/u,mS=me(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",K1?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Fv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vS=me(Fv,"u").replace(/punct/g,nl).getRegex(),yS=me(Fv,"u").replace(/punct/g,Lv).getRegex(),Dv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bS=me(Dv,"gu").replace(/notPunctSpace/g,Ov).replace(/punctSpace/g,yd).replace(/punct/g,nl).getRegex(),_S=me(Dv,"gu").replace(/notPunctSpace/g,hS).replace(/punctSpace/g,pS).replace(/punct/g,Lv).getRegex(),xS=me("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ov).replace(/punctSpace/g,yd).replace(/punct/g,nl).getRegex(),wS=me(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Nv).getRegex(),SS="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",kS=me(SS,"gu").replace(/notPunctSpace/g,gS).replace(/punctSpace/g,fS).replace(/punct/g,Nv).getRegex(),ES=me(/\\(punct)/,"gu").replace(/punct/g,nl).getRegex(),CS=me(/^<(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(),AS=me(md).replace("(?:-->|$)","-->").getRegex(),TS=me("^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",AS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,RS=me(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Qa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Hv=me(/^!?\[(label)\]\[(ref)\]/).replace("label",Qa).replace("ref",gd).getRegex(),Bv=me(/^!?\[(ref)\](?:\[\])?/).replace("ref",gd).getRegex(),IS=me("reflink|nolink(?!\\()","g").replace("reflink",Hv).replace("nolink",Bv).getRegex(),kv=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bd={_backpedal:En,anyPunctuation:ES,autolink:CS,blockSkip:mS,br:Pv,code:cS,del:En,delLDelim:En,delRDelim:En,emStrongLDelim:vS,emStrongRDelimAst:bS,emStrongRDelimUnd:xS,escape:lS,link:RS,nolink:Bv,punctuation:dS,reflink:Hv,reflinkSearch:IS,tag:TS,text:uS,url:En},$S={...bd,link:me(/^!?\[(label)\]\((.*?)\)/).replace("label",Qa).getRegex(),reflink:me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qa).getRegex()},cd={...bd,emStrongRDelimAst:_S,emStrongLDelim:yS,delLDelim:wS,delRDelim:kS,url:me(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",kv).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:me(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",kv).getRegex()},MS={...cd,br:me(Pv).replace("{2,}","*").getRegex(),text:me(cd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Xa={normal:vd,gfm:oS,pedantic:aS},Ks={normal:bd,gfm:cd,breaks:MS,pedantic:$S},PS={"&":"&","<":"<",">":">",'"':""","'":"'"},Ev=r=>PS[r];function er(r,e){if(e){if(ct.escapeTest.test(r))return r.replace(ct.escapeReplace,Ev)}else if(ct.escapeTestNoEncode.test(r))return r.replace(ct.escapeReplaceNoEncode,Ev);return r}function Cv(r){try{r=encodeURI(r).replace(ct.percentDecode,"%")}catch{return null}return r}function Av(r,e){let t=r.replace(ct.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(ct.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(ct.slashPipe,"|");return n}function Ys(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 OS(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 LS(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 Tv(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 NS(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
|
|
150
|
-
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=
|
|
149
|
+
`)}var el=class{constructor(r){de(this,"options");de(this,"rules");de(this,"lexer");this.options=r||An}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:Ys(t,`
|
|
150
|
+
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=NS(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=Ys(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:Ys(e[0],`
|
|
151
151
|
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=Ys(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 Ca=Object.defineProperty;var lw=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
|
-
`),
|
|
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+`
|
|
160
160
|
`+t.join(`
|
|
161
|
-
`),
|
|
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=
|
|
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=LS(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
|
|
166
|
-
`,1)[0],
|
|
167
|
-
`+
|
|
168
|
-
`+h}f=!h.trim(),c+=
|
|
169
|
-
`,r=r.substring(
|
|
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(
|
|
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=Ys(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=
|
|
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(
|
|
165
|
+
`,r=r.substring(h.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(v),g=this.rules.other.hrRegex(v),b=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),w=this.rules.other.htmlBeginRegex(v),y=this.rules.other.blockquoteBeginRegex(v);for(;r;){let S=r.split(`
|
|
166
|
+
`,1)[0],T;if(h=S,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),b.test(h)||x.test(h)||w.test(h)||y.test(h)||m.test(h)||g.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
|
|
167
|
+
`+T.slice(v);else{if(f||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(p)||x.test(p)||g.test(p))break;u+=`
|
|
168
|
+
`+h}f=!h.trim(),c+=S+`
|
|
169
|
+
`,r=r.substring(S.length+1),p=T.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=Av(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(Av(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=Ys(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=OS(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)),Tv(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 Tv(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}}}},Bt=class ud{constructor(e){de(this,"tokens");de(this,"options");de(this,"state");de(this,"inlineQueue");de(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||An,this.options.tokenizer=this.options.tokenizer||new el,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:ct,block:Xa.normal,inline:Ks.normal};this.options.pedantic?(t.block=Xa.pedantic,t.inline=Ks.pedantic):this.options.gfm&&(t.block=Xa.gfm,this.options.breaks?t.inline=Ks.breaks:t.inline=Ks.gfm),this.tokenizer.rules=t}static get rules(){return{block:Xa,inline:Ks}}static lex(e,t){return new ud(t).lex(e)}static lexInline(e,t){return new ud(t).inlineTokens(e)}lex(e){e=e.replace(ct.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(ct.tabCharGlobal," ").replace(ct.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,9 +182,9 @@ ${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}},
|
|
186
|
-
`;return n?'<pre><code class="language-'+
|
|
187
|
-
`:"<pre><code>"+(t?i:
|
|
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}},tl=class{constructor(r){de(this,"options");de(this,"parser");this.options=r||An}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(ct.notSpaceStart)?.[0],i=r.replace(ct.endingNewline,"")+`
|
|
186
|
+
`;return n?'<pre><code class="language-'+er(n)+'">'+(t?i:er(i,!0))+`</code></pre>
|
|
187
|
+
`:"<pre><code>"+(t?i:er(i,!0))+`</code></pre>
|
|
188
188
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
189
189
|
${this.parser.parse(r)}</blockquote>
|
|
190
190
|
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
@@ -200,67 +200,67 @@ ${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>${
|
|
204
|
-
Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+Qt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},kn=new bd;function Se(r,e){return kn.parse(r,e)}Se.options=Se.setOptions=function(r){return kn.setOptions(r),Se.defaults=kn.defaults,Cv(Se.defaults),Se};Se.getDefaults=ud;Se.defaults=En;Se.use=function(...r){return kn.use(...r),Se.defaults=kn.defaults,Cv(Se.defaults),Se};Se.walkTokens=function(r,e){return kn.walkTokens(r,e)};Se.parseInline=kn.parseInline;Se.Parser=Ht;Se.parser=Ht.parse;Se.Renderer=Qa;Se.TextRenderer=yd;Se.Lexer=Dt;Se.lexer=Dt.lex;Se.Tokenizer=Ja;Se.Hooks=Xs;Se.parse=Se;var M$=Se.options,P$=Se.setOptions,O$=Se.use,L$=Se.walkTokens,N$=Se.parseInline;var F$=Ht.parse,D$=Dt.lex;function Hv(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 IS(r,e,t){let n=Hv(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 $S(r,e,t){let n=Hv(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 MS(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 PS=[{kind:"faq:scroll_to",executor:IS},{kind:"faq:toggle_item",executor:$S},{kind:"faq:update",executor:MS}],rt={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"}},_d={light:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${M[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:M[7]},emptyState:{color:M[8]},feedbackPrompt:{color:M[7]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${M[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:M[8]},emptyState:{color:M[7]},feedbackPrompt:{color:M[8]}}};var Dv=new bd({async:!1,gfm:!0,breaks:!0});function OS(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function LS(r){return typeof r=="string"?Dv.parse(r):r.type==="rich"?r.html:Dv.parse(r.content)}function NS(r){return r?r===!0?{style:"thumbs"}:r:null}function FS(r){return r.prompt??"Was this helpful?"}function DS(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Bv=class extends be{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(r){r.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 e=this.runtime.events.getRecent({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},10).filter(t=>{let n=t.props?.actionId;return typeof n=="string"&&n.startsWith("faq:open:")}).pop();if(e&&Date.now()-e.ts<1e4){let t=e.props.actionId.replace("faq:open:","");this._expandedIds=new Set([t]),requestAnimationFrame(()=>{let n=document.querySelector(`[data-faq-item-id="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"})})}}this._unsubCta=this.runtime.events.subscribe({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},r=>{let e=r.props?.actionId;if(typeof e!="string"||!e.startsWith("faq:open:"))return;let t=e.replace("faq:open:","");this._expandedIds=new Set([t]),requestAnimationFrame(()=>{let n=document.querySelector(`[data-faq-item-id="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"})}),this.runtime?.events.publish("canvas.requestOpen")})}if(this.runtime.events.subscribe){let r=e=>{let t=e.props?.tileId,n=e.props?.itemId;t===this.instanceId&&n&&(this._expandedIds=new Set([n]),this._highlightId=n,this._highlightTimer!==null&&clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout(()=>{this._highlightId=null,this._highlightTimer=null},1500),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})}))};if(this.runtime.events.getRecent){let t=this.runtime.events.getRecent({names:["notification.deep_link"]},5).filter(n=>n.props?.tileId===this.instanceId&&n.props?.itemId).pop();t&&Date.now()-t.ts<1e4&&r(t)}this._unsubDeepLink=this.runtime.events.subscribe({names:["notification.deep_link"]},r)}}}_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(r){let e=this._expandedIds,t;this.faqConfig.expandBehavior==="single"?t=e.has(r)?new Set:new Set([r]):(t=new Set(e),e.has(r)?t.delete(r):t.add(r));let n=!e.has(r);this._expandedIds=t,this.runtime?.events.publish("faq:toggled",{instanceId:this.instanceId,questionId:r,expanded:n,timestamp:Date.now()})}_handleFeedback(r,e,t){let n=new Map(this._feedbackState);n.set(r,t),this._feedbackState=n,this.runtime?.events.publish("faq:feedback",{itemId:r,question:e,value:t})}_visibleQuestions(){return(this.faqConfig.actions??[]).filter(r=>!r.triggerWhen||!this.runtime?!0:this.runtime.evaluateSync(r.triggerWhen).value)}_orderedQuestions(r){return this.faqConfig.ordering==="priority"?[...r].sort((e,t)=>(t.config.priority??0)-(e.config.priority??0)):r}_filteredQuestions(r){let e=this._searchQuery.trim().toLowerCase();return!this.faqConfig.searchable||!e?r:r.filter(t=>t.config.question.toLowerCase().includes(e)||OS(t.config.answer).toLowerCase().includes(e)||t.config.category?.toLowerCase().includes(e))}_categoryGroups(r){let e=new Map;for(let t of r){let n=t.config.category;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}_renderAnswer(r){let e=LS(r);return N`<div style="margin:0" data-faq-markdown="">${Ga(e)}</div>`}_renderFeedback(r,e,t,n){let i=_d[n],s={...rt.feedback,...i.feedbackPrompt};return N`
|
|
205
|
-
<div style=${
|
|
206
|
-
<span>${
|
|
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>${er(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=Cv(r);if(i===null)return n;r=i;let s='<a href="'+r+'"';return e&&(s+=' title="'+er(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=Cv(r);if(i===null)return er(t);r=i;let s=`<img src="${r}" alt="${er(t)}"`;return e&&(s+=` title="${er(e)}"`),s+=">",s}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:er(r.text)}},_d=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}},Vt=class dd{constructor(e){de(this,"options");de(this,"renderer");de(this,"textRenderer");this.options=e||An,this.options.renderer=this.options.renderer||new tl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _d}static parse(e,t){return new dd(t).parse(e)}static parseInline(e,t){return new dd(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}},Ja,Xs=(Ja=class{constructor(r){de(this,"options");de(this,"block");this.options=r||An}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?Vt.parse:Vt.parseInline}},de(Ja,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),de(Ja,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ja),xd=class{constructor(...r){de(this,"defaults",pd());de(this,"options",this.setOptions);de(this,"parse",this.parseMarkdown(!0));de(this,"parseInline",this.parseMarkdown(!1));de(this,"Parser",Vt);de(this,"Renderer",tl);de(this,"TextRenderer",_d);de(this,"Lexer",Bt);de(this,"Tokenizer",el);de(this,"Hooks",Xs);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 tl(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 el(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 Xs;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];Xs.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&Xs.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 Bt.lex(r,e??this.defaults)}parser(r,e){return Vt.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?Bt.lex:Bt.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?Vt.parse:Vt.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?Bt.lex:Bt.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?Vt.parse:Vt.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>"+er(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Cn=new xd;function xe(r,e){return Cn.parse(r,e)}xe.options=xe.setOptions=function(r){return Cn.setOptions(r),xe.defaults=Cn.defaults,Rv(xe.defaults),xe};xe.getDefaults=pd;xe.defaults=An;xe.use=function(...r){return Cn.use(...r),xe.defaults=Cn.defaults,Rv(xe.defaults),xe};xe.walkTokens=function(r,e){return Cn.walkTokens(r,e)};xe.parseInline=Cn.parseInline;xe.Parser=Vt;xe.parser=Vt.parse;xe.Renderer=tl;xe.TextRenderer=_d;xe.Lexer=Bt;xe.lexer=Bt.lex;xe.Tokenizer=el;xe.Hooks=Xs;xe.parse=xe;var V$=xe.options,U$=xe.setOptions,j$=xe.use,W$=xe.walkTokens,z$=xe.parseInline;var q$=Vt.parse,Z$=Bt.lex;function Uv(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 FS(r,e,t){let n=Uv(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 DS(r,e,t){let n=Uv(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 HS(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 BS=[{kind:"faq:scroll_to",executor:FS},{kind:"faq:toggle_item",executor:DS},{kind:"faq:update",executor:HS}],nt={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"}},wd={light:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${$[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:$[7]},emptyState:{color:$[8]},feedbackPrompt:{color:$[7]}},dark:{container:{backgroundColor:"transparent",color:"inherit"},searchInput:{border:`1px solid ${$[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:$[8]},emptyState:{color:$[7]},feedbackPrompt:{color:$[8]}}};var Vv=new xd({async:!1,gfm:!0,breaks:!0});function VS(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function US(r){return typeof r=="string"?Vv.parse(r):r.type==="rich"?r.html:Vv.parse(r.content)}function jS(r){return r?r===!0?{style:"thumbs"}:r:null}function WS(r){return r.prompt??"Was this helpful?"}function zS(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var jv=class extends ye{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(r){r.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 e=this.runtime.events.getRecent({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},10).filter(t=>{let n=t.props?.actionId;return typeof n=="string"&&n.startsWith("faq:open:")}).pop();if(e&&Date.now()-e.ts<1e4){let t=e.props.actionId.replace("faq:open:","");this._expandedIds=new Set([t]),requestAnimationFrame(()=>{let n=document.querySelector(`[data-faq-item-id="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"})})}}this._unsubCta=this.runtime.events.subscribe({patterns:["^action\\.tooltip_cta_clicked$","^action\\.modal_cta_clicked$"]},r=>{let e=r.props?.actionId;if(typeof e!="string"||!e.startsWith("faq:open:"))return;let t=e.replace("faq:open:","");this._expandedIds=new Set([t]),requestAnimationFrame(()=>{let n=document.querySelector(`[data-faq-item-id="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"})}),this.runtime?.events.publish("canvas.requestOpen")})}if(this.runtime.events.subscribe){let r=e=>{let t=e.props?.tileId,n=e.props?.itemId;t===this.instanceId&&n&&(this._expandedIds=new Set([n]),this._highlightId=n,this._highlightTimer!==null&&clearTimeout(this._highlightTimer),this._highlightTimer=setTimeout(()=>{this._highlightId=null,this._highlightTimer=null},1500),requestAnimationFrame(()=>{let i=document.querySelector(`[data-faq-item-id="${n}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"center"})}))};if(this.runtime.events.getRecent){let t=this.runtime.events.getRecent({names:["notification.deep_link"]},5).filter(n=>n.props?.tileId===this.instanceId&&n.props?.itemId).pop();t&&Date.now()-t.ts<1e4&&r(t)}this._unsubDeepLink=this.runtime.events.subscribe({names:["notification.deep_link"]},r)}}}_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(r){let e=this._expandedIds,t;this.faqConfig.expandBehavior==="single"?t=e.has(r)?new Set:new Set([r]):(t=new Set(e),e.has(r)?t.delete(r):t.add(r));let n=!e.has(r);this._expandedIds=t,this.runtime?.events.publish("faq:toggled",{instanceId:this.instanceId,questionId:r,expanded:n,timestamp:Date.now()})}_handleFeedback(r,e,t){let n=new Map(this._feedbackState);n.set(r,t),this._feedbackState=n,this.runtime?.events.publish("faq:feedback",{itemId:r,question:e,value:t})}_visibleQuestions(){return(this.faqConfig.actions??[]).filter(r=>!r.triggerWhen||!this.runtime?!0:this.runtime.evaluateSync(r.triggerWhen).value)}_orderedQuestions(r){return this.faqConfig.ordering==="priority"?[...r].sort((e,t)=>(t.config.priority??0)-(e.config.priority??0)):r}_filteredQuestions(r){let e=this._searchQuery.trim().toLowerCase();return!this.faqConfig.searchable||!e?r:r.filter(t=>t.config.question.toLowerCase().includes(e)||VS(t.config.answer).toLowerCase().includes(e)||t.config.category?.toLowerCase().includes(e))}_categoryGroups(r){let e=new Map;for(let t of r){let n=t.config.category;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}_renderAnswer(r){let e=US(r);return L`<div style="margin:0" data-faq-markdown="">${Ya(e)}</div>`}_renderFeedback(r,e,t,n){let i=wd[n],s={...nt.feedback,...i.feedbackPrompt};return L`
|
|
205
|
+
<div style=${A(s)}>
|
|
206
|
+
<span>${WS(e)}</span>
|
|
207
207
|
<button
|
|
208
208
|
type="button"
|
|
209
|
-
style=${
|
|
209
|
+
style=${A({...nt.feedbackButton,...t==="up"?nt.feedbackButtonSelected:{}})}
|
|
210
210
|
aria-label="Thumbs up"
|
|
211
211
|
@click=${()=>this._handleFeedback(r.config.id,r.config.question,"up")}
|
|
212
212
|
>\uD83D\uDC4D</button>
|
|
213
213
|
<button
|
|
214
214
|
type="button"
|
|
215
|
-
style=${
|
|
215
|
+
style=${A({...nt.feedbackButton,...t==="down"?nt.feedbackButtonSelected:{}})}
|
|
216
216
|
aria-label="Thumbs down"
|
|
217
217
|
@click=${()=>this._handleFeedback(r.config.id,r.config.question,"down")}
|
|
218
218
|
>\uD83D\uDC4E</button>
|
|
219
219
|
</div>
|
|
220
|
-
`}_renderItem(r,e,t,n){let i=
|
|
220
|
+
`}_renderItem(r,e,t,n){let i=wd[t],s=this._expandedIds.has(r.config.id),o=this._highlightId===r.config.id,a=this._hoveredId===r.config.id,l={...nt.item,...i.item,...s?i.itemExpanded:{},...o?{boxShadow:`0 0 0 2px ${Ht[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,transition:"box-shadow 0.3s ease"}:{},...e?{}:{borderBottom:"var(--sc-content-item-divider, none)"}},c={...nt.question,...i.question,...a?i.questionHover:{}},u={...nt.chevron,transform:s?"rotate(90deg)":"rotate(0deg)"},p={...nt.answer,...i.answer,maxHeight:s?"500px":"0",paddingBottom:s?"16px":"0"};return L`
|
|
221
221
|
<div
|
|
222
|
-
style=${
|
|
222
|
+
style=${A(l)}
|
|
223
223
|
data-faq-item-id=${r.config.id}
|
|
224
224
|
>
|
|
225
225
|
<button
|
|
226
226
|
type="button"
|
|
227
|
-
style=${
|
|
227
|
+
style=${A(c)}
|
|
228
228
|
aria-expanded=${s}
|
|
229
229
|
@click=${()=>this._handleToggle(r.config.id)}
|
|
230
230
|
@mouseenter=${()=>{this._hoveredId=r.config.id}}
|
|
231
231
|
@mouseleave=${()=>{this._hoveredId=null}}
|
|
232
232
|
>
|
|
233
233
|
<span>${r.config.question}</span>
|
|
234
|
-
<span style=${
|
|
234
|
+
<span style=${A(u)}>\u203A</span>
|
|
235
235
|
</button>
|
|
236
236
|
|
|
237
237
|
<div
|
|
238
|
-
style=${
|
|
238
|
+
style=${A(p)}
|
|
239
239
|
aria-hidden=${!s}
|
|
240
240
|
>
|
|
241
241
|
${this._renderAnswer(r.config.answer)}
|
|
242
|
-
${s&&n?this._renderFeedback(r,n,this._feedbackState.get(r.config.id),t):
|
|
242
|
+
${s&&n?this._renderFeedback(r,n,this._feedbackState.get(r.config.id),t):J}
|
|
243
243
|
</div>
|
|
244
244
|
</div>
|
|
245
|
-
`}_renderItems(r,e,t){return r.map((n,i)=>this._renderItem(n,i===r.length-1,e,t))}render(){let r=
|
|
245
|
+
`}_renderItems(r,e,t){return r.map((n,i)=>this._renderItem(n,i===r.length-1,e,t))}render(){let r=zS(this.faqConfig.theme),e=wd[r],t=jS(this.faqConfig.feedback),n=this._visibleQuestions(),i=this._orderedQuestions(n),s=this._filteredQuestions(i),a=s.some(h=>h.config.category)?this._categoryGroups(s):null,l={...nt.container,...e.container},c={...nt.emptyState,...e.emptyState},u={...nt.categoryHeader,...e.categoryHeader},p={...nt.searchInput,...e.searchInput};return n.length===0?L`
|
|
246
246
|
<div
|
|
247
|
-
style=${
|
|
247
|
+
style=${A(l)}
|
|
248
248
|
data-adaptive-id=${this.instanceId}
|
|
249
249
|
data-adaptive-type="adaptive-faq"
|
|
250
250
|
>
|
|
251
|
-
<div style=${
|
|
251
|
+
<div style=${A(c)}>
|
|
252
252
|
You're all set for now! We'll surface answers here when they're relevant to what
|
|
253
253
|
you're doing.
|
|
254
254
|
</div>
|
|
255
255
|
</div>
|
|
256
|
-
`:
|
|
256
|
+
`:L`
|
|
257
257
|
<div
|
|
258
|
-
style=${
|
|
258
|
+
style=${A(l)}
|
|
259
259
|
data-adaptive-id=${this.instanceId}
|
|
260
260
|
data-adaptive-type="adaptive-faq"
|
|
261
261
|
>
|
|
262
|
-
${this.faqConfig.searchable?
|
|
263
|
-
<div style=${
|
|
262
|
+
${this.faqConfig.searchable?L`
|
|
263
|
+
<div style=${A(nt.searchWrapper)}>
|
|
264
264
|
<style>
|
|
265
265
|
[data-adaptive-id="${this.instanceId}"] input::placeholder {
|
|
266
266
|
color: var(--sc-content-search-color, inherit);
|
|
@@ -271,35 +271,35 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
271
271
|
type="text"
|
|
272
272
|
placeholder="Search questions..."
|
|
273
273
|
.value=${this._searchQuery}
|
|
274
|
-
style=${
|
|
274
|
+
style=${A(p)}
|
|
275
275
|
@input=${h=>{this._searchQuery=h.target.value}}
|
|
276
276
|
/>
|
|
277
277
|
</div>
|
|
278
|
-
`:
|
|
278
|
+
`:J}
|
|
279
279
|
|
|
280
|
-
<div style=${
|
|
281
|
-
${a?Array.from(a.entries()).map(([h,f])=>
|
|
282
|
-
${h?
|
|
280
|
+
<div style=${A(nt.accordion)}>
|
|
281
|
+
${a?Array.from(a.entries()).map(([h,f])=>L`
|
|
282
|
+
${h?L`
|
|
283
283
|
<div
|
|
284
|
-
style=${
|
|
284
|
+
style=${A(u)}
|
|
285
285
|
data-category-header=${h}
|
|
286
286
|
>
|
|
287
287
|
${h}
|
|
288
288
|
</div>
|
|
289
|
-
`:
|
|
289
|
+
`:J}
|
|
290
290
|
${this._renderItems(f,r,t)}
|
|
291
291
|
`):this._renderItems(s,r,t)}
|
|
292
292
|
</div>
|
|
293
293
|
|
|
294
|
-
${this.faqConfig.searchable&&s.length===0&&this._searchQuery?
|
|
294
|
+
${this.faqConfig.searchable&&s.length===0&&this._searchQuery?L`
|
|
295
295
|
<div
|
|
296
|
-
style=${
|
|
296
|
+
style=${A({...nt.noResults,...e.emptyState})}
|
|
297
297
|
>
|
|
298
298
|
No questions found matching "${this._searchQuery}"
|
|
299
299
|
</div>
|
|
300
|
-
`:
|
|
300
|
+
`:J}
|
|
301
301
|
</div>
|
|
302
|
-
`}};Bv.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",Bv);var HS={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()}},Vv={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:PS,widgets:[{id:"adaptive-faq:accordion",component:HS,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 d={};Xg(d,{BRAND:()=>dk,DIRTY:()=>Cn,EMPTY_PATH:()=>jS,INVALID:()=>ne,NEVER:()=>Kk,OK:()=>nt,ParseStatus:()=>Ye,Schema:()=>de,ZodAny:()=>Zr,ZodArray:()=>wr,ZodBigInt:()=>Tn,ZodBoolean:()=>Rn,ZodBranded:()=>eo,ZodCatch:()=>Bn,ZodDate:()=>In,ZodDefault:()=>Hn,ZodDiscriminatedUnion:()=>il,ZodEffects:()=>Tt,ZodEnum:()=>Fn,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>ie,ZodFunction:()=>ol,ZodIntersection:()=>On,ZodIssueCode:()=>$,ZodLazy:()=>Ln,ZodLiteral:()=>Nn,ZodMap:()=>Si,ZodNaN:()=>Ei,ZodNativeEnum:()=>Dn,ZodNever:()=>Bt,ZodNull:()=>Mn,ZodNullable:()=>rr,ZodNumber:()=>An,ZodObject:()=>mt,ZodOptional:()=>Ct,ZodParsedType:()=>z,ZodPipeline:()=>to,ZodPromise:()=>Gr,ZodReadonly:()=>Vn,ZodRecord:()=>sl,ZodSchema:()=>de,ZodSet:()=>ki,ZodString:()=>qr,ZodSymbol:()=>xi,ZodTransformer:()=>Tt,ZodTuple:()=>tr,ZodType:()=>de,ZodUndefined:()=>$n,ZodUnion:()=>Pn,ZodUnknown:()=>xr,ZodVoid:()=>wi,addIssueToContext:()=>D,any:()=>_k,array:()=>kk,bigint:()=>gk,boolean:()=>Jv,coerce:()=>Gk,custom:()=>Kv,date:()=>mk,datetimeRegex:()=>Zv,defaultErrorMap:()=>br,discriminatedUnion:()=>Tk,effect:()=>Bk,enum:()=>Fk,function:()=>Ok,getErrorMap:()=>yi,getParsedType:()=>er,instanceof:()=>hk,intersection:()=>Rk,isAborted:()=>rl,isAsync:()=>bi,isDirty:()=>nl,isValid:()=>zr,late:()=>pk,lazy:()=>Lk,literal:()=>Nk,makeIssue:()=>Qs,map:()=>Mk,nan:()=>fk,nativeEnum:()=>Dk,never:()=>wk,null:()=>bk,nullable:()=>Uk,number:()=>Xv,object:()=>Ek,objectUtil:()=>xd,oboolean:()=>Zk,onumber:()=>qk,optional:()=>Vk,ostring:()=>zk,pipeline:()=>Wk,preprocess:()=>jk,promise:()=>Hk,quotelessJson:()=>BS,record:()=>$k,set:()=>Pk,setErrorMap:()=>US,strictObject:()=>Ck,string:()=>Yv,symbol:()=>vk,transformer:()=>Bk,tuple:()=>Ik,undefined:()=>yk,union:()=>Ak,unknown:()=>xk,util:()=>he,void:()=>Sk});var he;(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})(he||(he={}));var xd;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(xd||(xd={}));var z=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),er=r=>{switch(typeof r){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(r)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(r)?z.array:r===null?z.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?z.promise:typeof Map<"u"&&r instanceof Map?z.map:typeof Set<"u"&&r instanceof Set?z.set:typeof Date<"u"&&r instanceof Date?z.date:z.object;default:return z.unknown}};var $=he.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"]),BS=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),gt=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,he.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()}};gt.create=r=>new gt(r);var VS=(r,e)=>{let t;switch(r.code){case $.invalid_type:r.received===z.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case $.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,he.jsonStringifyReplacer)}`;break;case $.unrecognized_keys:t=`Unrecognized key(s) in object: ${he.joinValues(r.keys,", ")}`;break;case $.invalid_union:t="Invalid input";break;case $.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${he.joinValues(r.options)}`;break;case $.invalid_enum_value:t=`Invalid enum value. Expected ${he.joinValues(r.options)}, received '${r.received}'`;break;case $.invalid_arguments:t="Invalid function arguments";break;case $.invalid_return_type:t="Invalid function return type";break;case $.invalid_date:t="Invalid date";break;case $.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}"`:he.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case $.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 $.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 $.custom:t="Invalid input";break;case $.invalid_intersection_types:t="Intersection results could not be merged";break;case $.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case $.not_finite:t="Number must be finite";break;default:t=e.defaultError,he.assertNever(r)}return{message:t}},br=VS;var Uv=br;function US(r){Uv=r}function yi(){return Uv}var Qs=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}},jS=[];function D(r,e){let t=yi(),n=Qs({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===br?void 0:br].filter(i=>!!i)});r.common.issues.push(n)}var Ye=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 ne;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 ne;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}}},ne=Object.freeze({status:"aborted"}),Cn=r=>({status:"dirty",value:r}),nt=r=>({status:"valid",value:r}),rl=r=>r.status==="aborted",nl=r=>r.status==="dirty",zr=r=>r.status==="valid",bi=r=>typeof Promise<"u"&&r instanceof Promise;var X;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(X||(X={}));var At=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}},jv=(r,e)=>{if(zr(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 gt(r.common.issues);return this._error=t,this._error}}};function ce(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 de=class{get description(){return this._def.description}_getType(e){return er(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ye,ctx:{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(bi(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:er(e)},i=this._parseSync({data:e,path:n.path,parent:n});return jv(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return zr(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=>zr(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:er(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(bi(i)?i:Promise.resolve(i));return jv(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:$.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 Tt({schema:this,typeName:ie.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 Ct.create(this,this._def)}nullable(){return rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wr.create(this)}promise(){return Gr.create(this,this._def)}or(e){return Pn.create([this,e],this._def)}and(e){return On.create(this,e,this._def)}transform(e){return new Tt({...ce(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Hn({...ce(this._def),innerType:this,defaultValue:t,typeName:ie.ZodDefault})}brand(){return new eo({typeName:ie.ZodBranded,type:this,...ce(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Bn({...ce(this._def),innerType:this,catchValue:t,typeName:ie.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return Vn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},WS=/^c[^\s-]{8,}$/i,zS=/^[0-9a-z]+$/,qS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ZS=/^[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,GS=/^[a-z0-9_-]{21}$/i,KS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,YS=/^[-+]?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)?)??$/,XS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wd,QS=/^(?:(?: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])$/,ek=/^(?:(?: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])$/,tk=/^(([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]))$/,rk=/^(([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])$/,nk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ik=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zv="((\\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])))",sk=new RegExp(`^${zv}$`);function qv(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 ok(r){return new RegExp(`^${qv(r)}$`)}function Zv(r){let e=`${zv}T${qv(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 ak(r,e){return!!((e==="v4"||!e)&&QS.test(r)||(e==="v6"||!e)&&tk.test(r))}function lk(r,e){if(!KS.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 ck(r,e){return!!((e==="v4"||!e)&&ek.test(r)||(e==="v6"||!e)&&rk.test(r))}var qr=class r extends de{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return D(s,{code:$.invalid_type,expected:z.string,received:s.parsedType}),ne}let n=new Ye,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),D(i,{code:$.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),D(i,{code:$.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?D(i,{code:$.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&D(i,{code:$.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")XS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"email",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")wd||(wd=new RegExp(JS,"u")),wd.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"emoji",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ZS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"uuid",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")GS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"nanoid",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")WS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"cuid",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")zS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"cuid2",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")qS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"ulid",code:$.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),D(i,{validation:"url",code:$.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),D(i,{validation:"regex",code:$.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),D(i,{code:$.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),D(i,{code:$.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),D(i,{code:$.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Zv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{code:$.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?sk.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{code:$.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ok(s).test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{code:$.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?YS.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"duration",code:$.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?ak(e.data,s.version)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"ip",code:$.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?lk(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"jwt",code:$.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ck(e.data,s.version)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"cidr",code:$.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?nk.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"base64",code:$.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?ik.test(e.data)||(i=this._getOrReturnCtx(e,i),D(i,{validation:"base64url",code:$.invalid_string,message:s.message}),n.dirty()):he.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:$.invalid_string,...X.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.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,...X.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,...X.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...X.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...X.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...X.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...X.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...X.errToObj(t)})}nonempty(e){return this.min(1,X.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}};qr.create=r=>new qr({checks:[],typeName:ie.ZodString,coerce:r?.coerce??!1,...ce(r)});function uk(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 An=class r extends de{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)!==z.number){let s=this._getOrReturnCtx(e);return D(s,{code:$.invalid_type,expected:z.number,received:s.parsedType}),ne}let n,i=new Ye;for(let s of this._def.checks)s.kind==="int"?he.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),D(n,{code:$.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),D(n,{code:$.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),D(n,{code:$.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?uk(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),D(n,{code:$.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),D(n,{code:$.not_finite,message:s.message}),i.dirty()):he.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.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"&&he.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)}};An.create=r=>new An({checks:[],typeName:ie.ZodNumber,coerce:r?.coerce||!1,...ce(r)});var Tn=class r extends de{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)!==z.bigint)return this._getInvalidInput(e);let n,i=new Ye;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),D(n,{code:$.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),D(n,{code:$.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),D(n,{code:$.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):he.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:$.invalid_type,expected:z.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.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:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.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}};Tn.create=r=>new Tn({checks:[],typeName:ie.ZodBigInt,coerce:r?.coerce??!1,...ce(r)});var Rn=class extends de{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.boolean,received:n.parsedType}),ne}return nt(e.data)}};Rn.create=r=>new Rn({typeName:ie.ZodBoolean,coerce:r?.coerce||!1,...ce(r)});var In=class r extends de{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return D(s,{code:$.invalid_type,expected:z.date,received:s.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return D(s,{code:$.invalid_date}),ne}let n=new Ye,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),D(i,{code:$.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),D(i,{code:$.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):he.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:X.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.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}};In.create=r=>new In({checks:[],coerce:r?.coerce||!1,typeName:ie.ZodDate,...ce(r)});var xi=class extends de{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.symbol,received:n.parsedType}),ne}return nt(e.data)}};xi.create=r=>new xi({typeName:ie.ZodSymbol,...ce(r)});var $n=class extends de{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.undefined,received:n.parsedType}),ne}return nt(e.data)}};$n.create=r=>new $n({typeName:ie.ZodUndefined,...ce(r)});var Mn=class extends de{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.null,received:n.parsedType}),ne}return nt(e.data)}};Mn.create=r=>new Mn({typeName:ie.ZodNull,...ce(r)});var Zr=class extends de{constructor(){super(...arguments),this._any=!0}_parse(e){return nt(e.data)}};Zr.create=r=>new Zr({typeName:ie.ZodAny,...ce(r)});var xr=class extends de{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nt(e.data)}};xr.create=r=>new xr({typeName:ie.ZodUnknown,...ce(r)});var Bt=class extends de{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:$.invalid_type,expected:z.never,received:t.parsedType}),ne}};Bt.create=r=>new Bt({typeName:ie.ZodNever,...ce(r)});var wi=class extends de{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.void,received:n.parsedType}),ne}return nt(e.data)}};wi.create=r=>new wi({typeName:ie.ZodVoid,...ce(r)});var wr=class r extends de{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==z.array)return D(t,{code:$.invalid_type,expected:z.array,received:t.parsedType}),ne;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(D(t,{code:o?$.too_big:$.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&&(D(t,{code:$.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&&(D(t,{code:$.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 At(t,o,t.path,a)))).then(o=>Ye.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new At(t,o,t.path,a)));return Ye.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:X.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:X.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:X.toString(t)}})}nonempty(e){return this.min(1,e)}};wr.create=(r,e)=>new wr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...ce(e)});function _i(r){if(r instanceof mt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Ct.create(_i(n))}return new mt({...r._def,shape:()=>e})}else return r instanceof wr?new wr({...r._def,type:_i(r.element)}):r instanceof Ct?Ct.create(_i(r.unwrap())):r instanceof rr?rr.create(_i(r.unwrap())):r instanceof tr?tr.create(r.items.map(e=>_i(e))):r}var mt=class r extends de{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=he.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==z.object){let c=this._getOrReturnCtx(e);return D(c,{code:$.invalid_type,expected:z.object,received:c.parsedType}),ne}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Bt&&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 At(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Bt){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&&(D(i,{code:$.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 At(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=>Ye.mergeObjectSync(n,c)):Ye.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return X.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:X.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:ie.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 he.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 he.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return _i(this)}partial(e){let t={};for(let n of he.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 he.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ct;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Gv(he.objectKeys(this.shape))}};mt.create=(r,e)=>new mt({shape:()=>r,unknownKeys:"strip",catchall:Bt.create(),typeName:ie.ZodObject,...ce(e)});mt.strictCreate=(r,e)=>new mt({shape:()=>r,unknownKeys:"strict",catchall:Bt.create(),typeName:ie.ZodObject,...ce(e)});mt.lazycreate=(r,e)=>new mt({shape:r,unknownKeys:"strip",catchall:Bt.create(),typeName:ie.ZodObject,...ce(e)});var Pn=class extends de{_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 gt(a.ctx.common.issues));return D(t,{code:$.invalid_union,unionErrors:o}),ne}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 gt(l));return D(t,{code:$.invalid_union,unionErrors:a}),ne}}get options(){return this._def.options}};Pn.create=(r,e)=>new Pn({options:r,typeName:ie.ZodUnion,...ce(e)});var _r=r=>r instanceof Ln?_r(r.schema):r instanceof Tt?_r(r.innerType()):r instanceof Nn?[r.value]:r instanceof Fn?r.options:r instanceof Dn?he.objectValues(r.enum):r instanceof Hn?_r(r._def.innerType):r instanceof $n?[void 0]:r instanceof Mn?[null]:r instanceof Ct?[void 0,..._r(r.unwrap())]:r instanceof rr?[null,..._r(r.unwrap())]:r instanceof eo||r instanceof Vn?_r(r.unwrap()):r instanceof Bn?_r(r._def.innerType):[],il=class r extends de{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.object)return D(t,{code:$.invalid_type,expected:z.object,received:t.parsedType}),ne;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}):(D(t,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}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=_r(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:ie.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ce(n)})}};function Sd(r,e){let t=er(r),n=er(e);if(r===e)return{valid:!0,data:r};if(t===z.object&&n===z.object){let i=he.objectKeys(e),s=he.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Sd(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===z.array&&n===z.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=Sd(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===z.date&&n===z.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var On=class extends de{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(rl(s)||rl(o))return ne;let a=Sd(s.value,o.value);return a.valid?((nl(s)||nl(o))&&t.dirty(),{status:t.value,value:a.data}):(D(n,{code:$.invalid_intersection_types}),ne)};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}))}};On.create=(r,e,t)=>new On({left:r,right:e,typeName:ie.ZodIntersection,...ce(t)});var tr=class r extends de{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return D(n,{code:$.invalid_type,expected:z.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return D(n,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(D(n,{code:$.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 At(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Ye.mergeArray(t,o)):Ye.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};tr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tr({items:r,typeName:ie.ZodTuple,rest:null,...ce(e)})};var sl=class r extends de{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!==z.object)return D(n,{code:$.invalid_type,expected:z.object,received:n.parsedType}),ne;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new At(n,a,n.path,a)),value:o._parse(new At(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ye.mergeObjectAsync(t,i):Ye.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof de?new r({keyType:e,valueType:t,typeName:ie.ZodRecord,...ce(n)}):new r({keyType:qr.create(),valueType:e,typeName:ie.ZodRecord,...ce(t)})}},Si=class extends de{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!==z.map)return D(n,{code:$.invalid_type,expected:z.map,received:n.parsedType}),ne;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new At(n,a,n.path,[c,"key"])),value:s._parse(new At(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 ne;(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 ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Si.create=(r,e,t)=>new Si({valueType:e,keyType:r,typeName:ie.ZodMap,...ce(t)});var ki=class r extends de{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return D(n,{code:$.invalid_type,expected:z.set,received:n.parsedType}),ne;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(D(n,{code:$.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&&(D(n,{code:$.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 ne;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 At(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:X.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:X.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ki.create=(r,e)=>new ki({valueType:r,minSize:null,maxSize:null,typeName:ie.ZodSet,...ce(e)});var ol=class r extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.function)return D(t,{code:$.invalid_type,expected:z.function,received:t.parsedType}),ne;function n(a,l){return Qs({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,yi(),br].filter(c=>!!c),issueData:{code:$.invalid_arguments,argumentsError:l}})}function i(a,l){return Qs({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,yi(),br].filter(c=>!!c),issueData:{code:$.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Gr){let a=this;return nt(async function(...l){let c=new gt([]),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 nt(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new gt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new gt([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:tr.create(e).rest(xr.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||tr.create([]).rest(xr.create()),returns:t||xr.create(),typeName:ie.ZodFunction,...ce(n)})}},Ln=class extends de{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})}};Ln.create=(r,e)=>new Ln({getter:r,typeName:ie.ZodLazy,...ce(e)});var Nn=class extends de{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:$.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Nn.create=(r,e)=>new Nn({value:r,typeName:ie.ZodLiteral,...ce(e)});function Gv(r,e){return new Fn({values:r,typeName:ie.ZodEnum,...ce(e)})}var Fn=class r extends de{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return D(t,{expected:he.joinValues(n),received:t.parsedType,code:$.invalid_type}),ne}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 D(t,{received:t.data,code:$.invalid_enum_value,options:n}),ne}return nt(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})}};Fn.create=Gv;var Dn=class extends de{_parse(e){let t=he.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let i=he.objectValues(t);return D(n,{expected:he.joinValues(i),received:n.parsedType,code:$.invalid_type}),ne}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=he.objectValues(t);return D(n,{received:n.data,code:$.invalid_enum_value,options:i}),ne}return nt(e.data)}get enum(){return this._def.values}};Dn.create=(r,e)=>new Dn({values:r,typeName:ie.ZodNativeEnum,...ce(e)});var Gr=class extends de{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.promise&&t.common.async===!1)return D(t,{code:$.invalid_type,expected:z.promise,received:t.parsedType}),ne;let n=t.parsedType===z.promise?t.data:Promise.resolve(t.data);return nt(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Gr.create=(r,e)=>new Gr({type:r,typeName:ie.ZodPromise,...ce(e)});var Tt=class extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.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=>{D(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 ne;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ne:l.status==="dirty"?Cn(l.value):t.value==="dirty"?Cn(l.value):l});{if(t.value==="aborted")return ne;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?ne:a.status==="dirty"?Cn(a.value):t.value==="dirty"?Cn(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"?ne:(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"?ne:(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(!zr(o))return ne;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=>zr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);he.assertNever(i)}};Tt.create=(r,e,t)=>new Tt({schema:r,typeName:ie.ZodEffects,effect:e,...ce(t)});Tt.createWithPreprocess=(r,e,t)=>new Tt({schema:e,effect:{type:"preprocess",transform:r},typeName:ie.ZodEffects,...ce(t)});var Ct=class extends de{_parse(e){return this._getType(e)===z.undefined?nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(r,e)=>new Ct({innerType:r,typeName:ie.ZodOptional,...ce(e)});var rr=class extends de{_parse(e){return this._getType(e)===z.null?nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};rr.create=(r,e)=>new rr({innerType:r,typeName:ie.ZodNullable,...ce(e)});var Hn=class extends de{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Hn.create=(r,e)=>new Hn({innerType:r,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var Bn=class extends de{_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 bi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Bn.create=(r,e)=>new Bn({innerType:r,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var Ei=class extends de{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return D(n,{code:$.invalid_type,expected:z.nan,received:n.parsedType}),ne}return{status:"valid",value:e.data}}};Ei.create=r=>new Ei({typeName:ie.ZodNaN,...ce(r)});var dk=Symbol("zod_brand"),eo=class extends de{_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}},to=class r extends de{_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"?ne:s.status==="dirty"?(t.dirty(),Cn(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"?ne: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:ie.ZodPipeline})}},Vn=class extends de{_parse(e){let t=this._def.innerType._parse(e),n=i=>(zr(i)&&(i.value=Object.freeze(i.value)),i);return bi(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Vn.create=(r,e)=>new Vn({innerType:r,typeName:ie.ZodReadonly,...ce(e)});function Wv(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Kv(r,e={},t){return r?Zr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Wv(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Wv(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Zr.create()}var pk={object:mt.lazycreate},ie;(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"})(ie||(ie={}));var hk=(r,e={message:`Input not instance of ${r.name}`})=>Kv(t=>t instanceof r,e),Yv=qr.create,Xv=An.create,fk=Ei.create,gk=Tn.create,Jv=Rn.create,mk=In.create,vk=xi.create,yk=$n.create,bk=Mn.create,_k=Zr.create,xk=xr.create,wk=Bt.create,Sk=wi.create,kk=wr.create,Ek=mt.create,Ck=mt.strictCreate,Ak=Pn.create,Tk=il.create,Rk=On.create,Ik=tr.create,$k=sl.create,Mk=Si.create,Pk=ki.create,Ok=ol.create,Lk=Ln.create,Nk=Nn.create,Fk=Fn.create,Dk=Dn.create,Hk=Gr.create,Bk=Tt.create,Vk=Ct.create,Uk=rr.create,jk=Tt.createWithPreprocess,Wk=to.create,zk=()=>Yv().optional(),qk=()=>Xv().optional(),Zk=()=>Jv().optional(),Gk={string:(r=>qr.create({...r,coerce:!0})),number:(r=>An.create({...r,coerce:!0})),boolean:(r=>Rn.create({...r,coerce:!0})),bigint:(r=>Tn.create({...r,coerce:!0})),date:(r=>In.create({...r,coerce:!0}))};var Kk=ne;var AM=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),TM={title:d.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),description:d.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),validation:d.array(d.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")},Yk=["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"],Xk=d.enum(Yk).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Jk=["time_on_page","page_views","scroll_depth"],Qk=d.enum(Jk).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage."),eE=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"}'),tE=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."),rE=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"}`),nE=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}'),iE=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."),sE=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.'),oE=d.object({type:d.literal("session_metric"),key:Qk,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}'),aE=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."),lE=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."),cE=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."),uE=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."),dE=d.object({events:d.array(Xk).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),uE).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."),pE=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:dE.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"}}}}'),hE=d.discriminatedUnion("type",[eE,tE,rE,nE,iE,sE,oE,aE,lE,cE,pE]),fE=d.object({conditions:d.array(hE).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."),gE=d.object({type:d.literal("rules"),rules:d.array(fE).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."),mE=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."),vE=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."),yE=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."),bE=d.discriminatedUnion("type",[gE,mE,vE,yE]),RM=bE.nullable().optional(),IM=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),$M=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional(),_E='<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"',xE={"\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 Qv(r,e={}){let t=xE[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${_E} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var ey=r=>{throw TypeError(r)};var kd=(r,e,t)=>e.has(r)||ey("Cannot "+t),Ed=(r,e,t)=>(kd(r,e,"read from private field"),t?t.call(r):e.get(r)),al=(r,e,t)=>e.has(r)?ey("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ro=(r,e,t,n)=>(kd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Xe=(r,e,t)=>(kd(r,e,"access private method"),t);function wE(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 SE(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var kE="#6a59ce",ty="#677384",ry="#87919f";function EE(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function CE(r){return Qv(r)||EE(r)}function ny(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 AE(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 TE(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var no,io,qe,Cd,Ad,sy,Rd,oy,ay,ly,so,Td,cy=class extends be{constructor(){super(...arguments),al(this,qe),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,al(this,no,null),al(this,io,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Xe(this,qe,Cd).call(this)}disconnectedCallback(){super.disconnectedCallback(),Xe(this,qe,Ad).call(this)}updated(r){r.has("runtime")&&(Xe(this,qe,Ad).call(this),Xe(this,qe,Cd).call(this))}render(){let r=Xe(this,qe,sy).call(this),e=Xe(this,qe,Rd).call(this),t=T({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),n=T({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),i=T({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:e==="dark"?ry:ty}),s=T({fontSize:"13px",padding:"16px",textAlign:"center",color:e==="dark"?ty:ry});if(r.length===0)return N`
|
|
302
|
+
`}};jv.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",jv);var qS={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()}},Wv={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:BS,widgets:[{id:"adaptive-faq:accordion",component:qS,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 d={};em(d,{BRAND:()=>yk,DIRTY:()=>Tn,EMPTY_PATH:()=>YS,INVALID:()=>ne,NEVER:()=>rE,OK:()=>it,ParseStatus:()=>Xe,Schema:()=>ue,ZodAny:()=>Gr,ZodArray:()=>Sr,ZodBigInt:()=>In,ZodBoolean:()=>$n,ZodBranded:()=>eo,ZodCatch:()=>Un,ZodDate:()=>Mn,ZodDefault:()=>Vn,ZodDiscriminatedUnion:()=>ol,ZodEffects:()=>It,ZodEnum:()=>Hn,ZodError:()=>vt,ZodFirstPartyTypeKind:()=>ie,ZodFunction:()=>ll,ZodIntersection:()=>Nn,ZodIssueCode:()=>I,ZodLazy:()=>Fn,ZodLiteral:()=>Dn,ZodMap:()=>Ei,ZodNaN:()=>Ai,ZodNativeEnum:()=>Bn,ZodNever:()=>Ut,ZodNull:()=>On,ZodNullable:()=>nr,ZodNumber:()=>Rn,ZodObject:()=>yt,ZodOptional:()=>Tt,ZodParsedType:()=>q,ZodPipeline:()=>to,ZodPromise:()=>Kr,ZodReadonly:()=>jn,ZodRecord:()=>al,ZodSchema:()=>ue,ZodSet:()=>Ci,ZodString:()=>Zr,ZodSymbol:()=>Si,ZodTransformer:()=>It,ZodTuple:()=>rr,ZodType:()=>ue,ZodUndefined:()=>Pn,ZodUnion:()=>Ln,ZodUnknown:()=>wr,ZodVoid:()=>ki,addIssueToContext:()=>B,any:()=>Ak,array:()=>$k,bigint:()=>wk,boolean:()=>ty,coerce:()=>tE,custom:()=>Jv,date:()=>Sk,datetimeRegex:()=>Yv,defaultErrorMap:()=>_r,discriminatedUnion:()=>Lk,effect:()=>Zk,enum:()=>Wk,function:()=>Vk,getErrorMap:()=>_i,getParsedType:()=>tr,instanceof:()=>_k,intersection:()=>Nk,isAborted:()=>il,isAsync:()=>xi,isDirty:()=>sl,isValid:()=>qr,late:()=>bk,lazy:()=>Uk,literal:()=>jk,makeIssue:()=>Qs,map:()=>Hk,nan:()=>xk,nativeEnum:()=>zk,never:()=>Rk,null:()=>Ck,nullable:()=>Kk,number:()=>ey,object:()=>Mk,objectUtil:()=>Sd,oboolean:()=>eE,onumber:()=>Qk,optional:()=>Gk,ostring:()=>Jk,pipeline:()=>Xk,preprocess:()=>Yk,promise:()=>qk,quotelessJson:()=>ZS,record:()=>Dk,set:()=>Bk,setErrorMap:()=>KS,strictObject:()=>Pk,string:()=>Qv,symbol:()=>kk,transformer:()=>Zk,tuple:()=>Fk,undefined:()=>Ek,union:()=>Ok,unknown:()=>Tk,util:()=>pe,void:()=>Ik});var pe;(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})(pe||(pe={}));var Sd;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Sd||(Sd={}));var q=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tr=r=>{switch(typeof r){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(r)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(r)?q.array:r===null?q.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?q.promise:typeof Map<"u"&&r instanceof Map?q.map:typeof Set<"u"&&r instanceof Set?q.set:typeof Date<"u"&&r instanceof Date?q.date:q.object;default:return q.unknown}};var I=pe.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"]),ZS=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),vt=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,pe.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()}};vt.create=r=>new vt(r);var GS=(r,e)=>{let t;switch(r.code){case I.invalid_type:r.received===q.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case I.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,pe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:t=`Unrecognized key(s) in object: ${pe.joinValues(r.keys,", ")}`;break;case I.invalid_union:t="Invalid input";break;case I.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${pe.joinValues(r.options)}`;break;case I.invalid_enum_value:t=`Invalid enum value. Expected ${pe.joinValues(r.options)}, received '${r.received}'`;break;case I.invalid_arguments:t="Invalid function arguments";break;case I.invalid_return_type:t="Invalid function return type";break;case I.invalid_date:t="Invalid date";break;case I.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}"`:pe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case I.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 I.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 I.custom:t="Invalid input";break;case I.invalid_intersection_types:t="Intersection results could not be merged";break;case I.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case I.not_finite:t="Number must be finite";break;default:t=e.defaultError,pe.assertNever(r)}return{message:t}},_r=GS;var zv=_r;function KS(r){zv=r}function _i(){return zv}var Qs=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}},YS=[];function B(r,e){let t=_i(),n=Qs({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===_r?void 0:_r].filter(i=>!!i)});r.common.issues.push(n)}var Xe=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 ne;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 ne;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}}},ne=Object.freeze({status:"aborted"}),Tn=r=>({status:"dirty",value:r}),it=r=>({status:"valid",value:r}),il=r=>r.status==="aborted",sl=r=>r.status==="dirty",qr=r=>r.status==="valid",xi=r=>typeof Promise<"u"&&r instanceof Promise;var X;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(X||(X={}));var Rt=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}},qv=(r,e)=>{if(qr(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 vt(r.common.issues);return this._error=t,this._error}}};function ce(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 ue=class{get description(){return this._def.description}_getType(e){return tr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Xe,ctx:{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xi(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:tr(e)},i=this._parseSync({data:e,path:n.path,parent:n});return qv(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return qr(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=>qr(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:tr(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(xi(i)?i:Promise.resolve(i));return qv(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:I.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 It({schema:this,typeName:ie.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 Tt.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Kr.create(this,this._def)}or(e){return Ln.create([this,e],this._def)}and(e){return Nn.create(this,e,this._def)}transform(e){return new It({...ce(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Vn({...ce(this._def),innerType:this,defaultValue:t,typeName:ie.ZodDefault})}brand(){return new eo({typeName:ie.ZodBranded,type:this,...ce(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Un({...ce(this._def),innerType:this,catchValue:t,typeName:ie.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return jn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},XS=/^c[^\s-]{8,}$/i,JS=/^[0-9a-z]+$/,QS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ek=/^[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,tk=/^[a-z0-9_-]{21}$/i,rk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nk=/^[-+]?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)?)??$/,ik=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kd,ok=/^(?:(?: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])$/,ak=/^(?:(?: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])$/,lk=/^(([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]))$/,ck=/^(([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])$/,uk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gv="((\\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])))",pk=new RegExp(`^${Gv}$`);function Kv(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 hk(r){return new RegExp(`^${Kv(r)}$`)}function Yv(r){let e=`${Gv}T${Kv(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 fk(r,e){return!!((e==="v4"||!e)&&ok.test(r)||(e==="v6"||!e)&&lk.test(r))}function gk(r,e){if(!rk.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 mk(r,e){return!!((e==="v4"||!e)&&ak.test(r)||(e==="v6"||!e)&&ck.test(r))}var Zr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let s=this._getOrReturnCtx(e);return B(s,{code:I.invalid_type,expected:q.string,received:s.parsedType}),ne}let n=new Xe,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:I.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),B(i,{code:I.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?B(i,{code:I.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&B(i,{code:I.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ik.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"email",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")kd||(kd=new RegExp(sk,"u")),kd.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"emoji",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ek.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"uuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")tk.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"nanoid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")XS.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")JS.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid2",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")QS.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ulid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),B(i,{validation:"url",code:I.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),B(i,{validation:"regex",code:I.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),B(i,{code:I.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),B(i,{code:I.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:I.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Yv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:I.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?pk.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:I.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?hk(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:I.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?nk.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?fk(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ip",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?gk(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"jwt",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?mk(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cidr",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?uk.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?dk.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64url",code:I.invalid_string,message:s.message}),n.dirty()):pe.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:I.invalid_string,...X.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.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,...X.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,...X.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...X.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...X.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...X.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...X.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...X.errToObj(t)})}nonempty(e){return this.min(1,X.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}};Zr.create=r=>new Zr({checks:[],typeName:ie.ZodString,coerce:r?.coerce??!1,...ce(r)});function vk(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 Rn=class r extends ue{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)!==q.number){let s=this._getOrReturnCtx(e);return B(s,{code:I.invalid_type,expected:q.number,received:s.parsedType}),ne}let n,i=new Xe;for(let s of this._def.checks)s.kind==="int"?pe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?vk(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_finite,message:s.message}),i.dirty()):pe.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.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"&&pe.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)}};Rn.create=r=>new Rn({checks:[],typeName:ie.ZodNumber,coerce:r?.coerce||!1,...ce(r)});var In=class r extends ue{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)!==q.bigint)return this._getInvalidInput(e);let n,i=new Xe;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),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):pe.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return B(t,{code:I.invalid_type,expected:q.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.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:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.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}};In.create=r=>new In({checks:[],typeName:ie.ZodBigInt,coerce:r?.coerce??!1,...ce(r)});var $n=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.boolean,received:n.parsedType}),ne}return it(e.data)}};$n.create=r=>new $n({typeName:ie.ZodBoolean,coerce:r?.coerce||!1,...ce(r)});var Mn=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let s=this._getOrReturnCtx(e);return B(s,{code:I.invalid_type,expected:q.date,received:s.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return B(s,{code:I.invalid_date}),ne}let n=new Xe,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:I.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),B(i,{code:I.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):pe.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:X.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.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}};Mn.create=r=>new Mn({checks:[],coerce:r?.coerce||!1,typeName:ie.ZodDate,...ce(r)});var Si=class extends ue{_parse(e){if(this._getType(e)!==q.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.symbol,received:n.parsedType}),ne}return it(e.data)}};Si.create=r=>new Si({typeName:ie.ZodSymbol,...ce(r)});var Pn=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.undefined,received:n.parsedType}),ne}return it(e.data)}};Pn.create=r=>new Pn({typeName:ie.ZodUndefined,...ce(r)});var On=class extends ue{_parse(e){if(this._getType(e)!==q.null){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.null,received:n.parsedType}),ne}return it(e.data)}};On.create=r=>new On({typeName:ie.ZodNull,...ce(r)});var Gr=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return it(e.data)}};Gr.create=r=>new Gr({typeName:ie.ZodAny,...ce(r)});var wr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return it(e.data)}};wr.create=r=>new wr({typeName:ie.ZodUnknown,...ce(r)});var Ut=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return B(t,{code:I.invalid_type,expected:q.never,received:t.parsedType}),ne}};Ut.create=r=>new Ut({typeName:ie.ZodNever,...ce(r)});var ki=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.void,received:n.parsedType}),ne}return it(e.data)}};ki.create=r=>new ki({typeName:ie.ZodVoid,...ce(r)});var Sr=class r extends ue{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==q.array)return B(t,{code:I.invalid_type,expected:q.array,received:t.parsedType}),ne;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(B(t,{code:o?I.too_big:I.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&&(B(t,{code:I.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&&(B(t,{code:I.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 Rt(t,o,t.path,a)))).then(o=>Xe.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new Rt(t,o,t.path,a)));return Xe.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:X.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:X.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:X.toString(t)}})}nonempty(e){return this.min(1,e)}};Sr.create=(r,e)=>new Sr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...ce(e)});function wi(r){if(r instanceof yt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Tt.create(wi(n))}return new yt({...r._def,shape:()=>e})}else return r instanceof Sr?new Sr({...r._def,type:wi(r.element)}):r instanceof Tt?Tt.create(wi(r.unwrap())):r instanceof nr?nr.create(wi(r.unwrap())):r instanceof rr?rr.create(r.items.map(e=>wi(e))):r}var yt=class r extends ue{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=pe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let c=this._getOrReturnCtx(e);return B(c,{code:I.invalid_type,expected:q.object,received:c.parsedType}),ne}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ut&&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 Rt(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ut){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&&(B(i,{code:I.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 Rt(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=>Xe.mergeObjectSync(n,c)):Xe.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return X.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:X.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:ie.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 pe.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 pe.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return wi(this)}partial(e){let t={};for(let n of pe.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 pe.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Tt;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Xv(pe.objectKeys(this.shape))}};yt.create=(r,e)=>new yt({shape:()=>r,unknownKeys:"strip",catchall:Ut.create(),typeName:ie.ZodObject,...ce(e)});yt.strictCreate=(r,e)=>new yt({shape:()=>r,unknownKeys:"strict",catchall:Ut.create(),typeName:ie.ZodObject,...ce(e)});yt.lazycreate=(r,e)=>new yt({shape:r,unknownKeys:"strip",catchall:Ut.create(),typeName:ie.ZodObject,...ce(e)});var Ln=class extends ue{_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 vt(a.ctx.common.issues));return B(t,{code:I.invalid_union,unionErrors:o}),ne}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 vt(l));return B(t,{code:I.invalid_union,unionErrors:a}),ne}}get options(){return this._def.options}};Ln.create=(r,e)=>new Ln({options:r,typeName:ie.ZodUnion,...ce(e)});var xr=r=>r instanceof Fn?xr(r.schema):r instanceof It?xr(r.innerType()):r instanceof Dn?[r.value]:r instanceof Hn?r.options:r instanceof Bn?pe.objectValues(r.enum):r instanceof Vn?xr(r._def.innerType):r instanceof Pn?[void 0]:r instanceof On?[null]:r instanceof Tt?[void 0,...xr(r.unwrap())]:r instanceof nr?[null,...xr(r.unwrap())]:r instanceof eo||r instanceof jn?xr(r.unwrap()):r instanceof Un?xr(r._def.innerType):[],ol=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return B(t,{code:I.invalid_type,expected:q.object,received:t.parsedType}),ne;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}):(B(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}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=xr(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:ie.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ce(n)})}};function Ed(r,e){let t=tr(r),n=tr(e);if(r===e)return{valid:!0,data:r};if(t===q.object&&n===q.object){let i=pe.objectKeys(e),s=pe.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Ed(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===q.array&&n===q.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=Ed(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===q.date&&n===q.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Nn=class extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(il(s)||il(o))return ne;let a=Ed(s.value,o.value);return a.valid?((sl(s)||sl(o))&&t.dirty(),{status:t.value,value:a.data}):(B(n,{code:I.invalid_intersection_types}),ne)};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}))}};Nn.create=(r,e,t)=>new Nn({left:r,right:e,typeName:ie.ZodIntersection,...ce(t)});var rr=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return B(n,{code:I.invalid_type,expected:q.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return B(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:I.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 Rt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Xe.mergeArray(t,o)):Xe.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};rr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rr({items:r,typeName:ie.ZodTuple,rest:null,...ce(e)})};var al=class r extends ue{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!==q.object)return B(n,{code:I.invalid_type,expected:q.object,received:n.parsedType}),ne;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new Rt(n,a,n.path,a)),value:o._parse(new Rt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(t,i):Xe.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ue?new r({keyType:e,valueType:t,typeName:ie.ZodRecord,...ce(n)}):new r({keyType:Zr.create(),valueType:e,typeName:ie.ZodRecord,...ce(t)})}},Ei=class extends ue{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!==q.map)return B(n,{code:I.invalid_type,expected:q.map,received:n.parsedType}),ne;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new Rt(n,a,n.path,[c,"key"])),value:s._parse(new Rt(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 ne;(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 ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Ei.create=(r,e,t)=>new Ei({valueType:e,keyType:r,typeName:ie.ZodMap,...ce(t)});var Ci=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return B(n,{code:I.invalid_type,expected:q.set,received:n.parsedType}),ne;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(B(n,{code:I.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&&(B(n,{code:I.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 ne;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 Rt(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:X.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:X.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ci.create=(r,e)=>new Ci({valueType:r,minSize:null,maxSize:null,typeName:ie.ZodSet,...ce(e)});var ll=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return B(t,{code:I.invalid_type,expected:q.function,received:t.parsedType}),ne;function n(a,l){return Qs({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_i(),_r].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function i(a,l){return Qs({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_i(),_r].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Kr){let a=this;return it(async function(...l){let c=new vt([]),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 it(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new vt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new vt([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:rr.create(e).rest(wr.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||rr.create([]).rest(wr.create()),returns:t||wr.create(),typeName:ie.ZodFunction,...ce(n)})}},Fn=class extends ue{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:ie.ZodLazy,...ce(e)});var Dn=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Dn.create=(r,e)=>new Dn({value:r,typeName:ie.ZodLiteral,...ce(e)});function Xv(r,e){return new Hn({values:r,typeName:ie.ZodEnum,...ce(e)})}var Hn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{expected:pe.joinValues(n),received:t.parsedType,code:I.invalid_type}),ne}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 B(t,{received:t.data,code:I.invalid_enum_value,options:n}),ne}return it(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})}};Hn.create=Xv;var Bn=class extends ue{_parse(e){let t=pe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let i=pe.objectValues(t);return B(n,{expected:pe.joinValues(i),received:n.parsedType,code:I.invalid_type}),ne}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=pe.objectValues(t);return B(n,{received:n.data,code:I.invalid_enum_value,options:i}),ne}return it(e.data)}get enum(){return this._def.values}};Bn.create=(r,e)=>new Bn({values:r,typeName:ie.ZodNativeEnum,...ce(e)});var Kr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.promise&&t.common.async===!1)return B(t,{code:I.invalid_type,expected:q.promise,received:t.parsedType}),ne;let n=t.parsedType===q.promise?t.data:Promise.resolve(t.data);return it(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Kr.create=(r,e)=>new Kr({type:r,typeName:ie.ZodPromise,...ce(e)});var It=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.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=>{B(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 ne;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ne:l.status==="dirty"?Tn(l.value):t.value==="dirty"?Tn(l.value):l});{if(t.value==="aborted")return ne;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?ne:a.status==="dirty"?Tn(a.value):t.value==="dirty"?Tn(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"?ne:(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"?ne:(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(!qr(o))return ne;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=>qr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):ne);pe.assertNever(i)}};It.create=(r,e,t)=>new It({schema:r,typeName:ie.ZodEffects,effect:e,...ce(t)});It.createWithPreprocess=(r,e,t)=>new It({schema:e,effect:{type:"preprocess",transform:r},typeName:ie.ZodEffects,...ce(t)});var Tt=class extends ue{_parse(e){return this._getType(e)===q.undefined?it(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tt.create=(r,e)=>new Tt({innerType:r,typeName:ie.ZodOptional,...ce(e)});var nr=class extends ue{_parse(e){return this._getType(e)===q.null?it(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(r,e)=>new nr({innerType:r,typeName:ie.ZodNullable,...ce(e)});var Vn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Vn.create=(r,e)=>new Vn({innerType:r,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var Un=class extends ue{_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 xi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Un.create=(r,e)=>new Un({innerType:r,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var Ai=class extends ue{_parse(e){if(this._getType(e)!==q.nan){let n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:q.nan,received:n.parsedType}),ne}return{status:"valid",value:e.data}}};Ai.create=r=>new Ai({typeName:ie.ZodNaN,...ce(r)});var yk=Symbol("zod_brand"),eo=class extends ue{_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}},to=class r extends ue{_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"?ne:s.status==="dirty"?(t.dirty(),Tn(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"?ne: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:ie.ZodPipeline})}},jn=class extends ue{_parse(e){let t=this._def.innerType._parse(e),n=i=>(qr(i)&&(i.value=Object.freeze(i.value)),i);return xi(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};jn.create=(r,e)=>new jn({innerType:r,typeName:ie.ZodReadonly,...ce(e)});function Zv(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Jv(r,e={},t){return r?Gr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Zv(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Zv(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Gr.create()}var bk={object:yt.lazycreate},ie;(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"})(ie||(ie={}));var _k=(r,e={message:`Input not instance of ${r.name}`})=>Jv(t=>t instanceof r,e),Qv=Zr.create,ey=Rn.create,xk=Ai.create,wk=In.create,ty=$n.create,Sk=Mn.create,kk=Si.create,Ek=Pn.create,Ck=On.create,Ak=Gr.create,Tk=wr.create,Rk=Ut.create,Ik=ki.create,$k=Sr.create,Mk=yt.create,Pk=yt.strictCreate,Ok=Ln.create,Lk=ol.create,Nk=Nn.create,Fk=rr.create,Dk=al.create,Hk=Ei.create,Bk=Ci.create,Vk=ll.create,Uk=Fn.create,jk=Dn.create,Wk=Hn.create,zk=Bn.create,qk=Kr.create,Zk=It.create,Gk=Tt.create,Kk=nr.create,Yk=It.createWithPreprocess,Xk=to.create,Jk=()=>Qv().optional(),Qk=()=>ey().optional(),eE=()=>ty().optional(),tE={string:(r=>Zr.create({...r,coerce:!0})),number:(r=>Rn.create({...r,coerce:!0})),boolean:(r=>$n.create({...r,coerce:!0})),bigint:(r=>In.create({...r,coerce:!0})),date:(r=>Mn.create({...r,coerce:!0}))};var rE=ne;var NM=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),FM={title:d.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),description:d.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),validation:d.array(d.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")},nE=["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"],iE=d.enum(nE).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),sE=["time_on_page","page_views","scroll_depth"],oE=d.enum(sE).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage."),aE=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"}'),lE=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."),cE=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"}`),uE=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}'),dE=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."),pE=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.'),hE=d.object({type:d.literal("session_metric"),key:oE,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}'),fE=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."),gE=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."),mE=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."),vE=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."),yE=d.object({events:d.array(iE).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),vE).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."),bE=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:yE.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"}}}}'),_E=d.discriminatedUnion("type",[aE,lE,cE,uE,dE,pE,hE,fE,gE,mE,bE]),xE=d.object({conditions:d.array(_E).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."),wE=d.object({type:d.literal("rules"),rules:d.array(xE).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."),SE=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."),kE=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."),EE=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."),CE=d.discriminatedUnion("type",[wE,SE,kE,EE]),DM=CE.nullable().optional(),HM=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),BM=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional(),AE='<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"',TE={"\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 ry(r,e={}){let t=TE[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${AE} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var ny=r=>{throw TypeError(r)};var Cd=(r,e,t)=>e.has(r)||ny("Cannot "+t),Ad=(r,e,t)=>(Cd(r,e,"read from private field"),t?t.call(r):e.get(r)),cl=(r,e,t)=>e.has(r)?ny("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ro=(r,e,t,n)=>(Cd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Je=(r,e,t)=>(Cd(r,e,"access private method"),t);function RE(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 IE(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var $E="#6a59ce",iy="#677384",sy="#87919f";function ME(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function PE(r){return ry(r)||ME(r)}function oy(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 OE(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 LE(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var no,io,Ge,Td,Rd,ly,$d,cy,uy,dy,so,Id,py=class extends ye{constructor(){super(...arguments),cl(this,Ge),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,cl(this,no,null),cl(this,io,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Je(this,Ge,Td).call(this)}disconnectedCallback(){super.disconnectedCallback(),Je(this,Ge,Rd).call(this)}updated(r){r.has("runtime")&&(Je(this,Ge,Rd).call(this),Je(this,Ge,Td).call(this))}render(){let r=Je(this,Ge,ly).call(this),e=Je(this,Ge,$d).call(this),t=A({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),n=A({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),i=A({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:e==="dark"?sy:iy}),s=A({fontSize:"13px",padding:"16px",textAlign:"center",color:e==="dark"?iy:sy});if(r.length===0)return L`
|
|
303
303
|
<div
|
|
304
304
|
style=${t}
|
|
305
305
|
data-adaptive-id=${this.instanceId}
|
|
@@ -310,81 +310,81 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
310
310
|
you're doing.
|
|
311
311
|
</div>
|
|
312
312
|
</div>
|
|
313
|
-
`;let o=new Map;for(let l of r){let c=l.config.category;o.has(c)||o.set(c,[]),o.get(c).push(l)}let a=r.some(l=>l.config.category);return
|
|
313
|
+
`;let o=new Map;for(let l of r){let c=l.config.category;o.has(c)||o.set(c,[]),o.get(c).push(l)}let a=r.some(l=>l.config.category);return L`
|
|
314
314
|
<div
|
|
315
315
|
style=${t}
|
|
316
316
|
data-adaptive-id=${this.instanceId}
|
|
317
317
|
data-adaptive-type="adaptive-nav"
|
|
318
318
|
>
|
|
319
319
|
<div style=${n}>
|
|
320
|
-
${a?Array.from(o.entries()).map(([l,c])=>
|
|
321
|
-
${l?
|
|
322
|
-
${c.map((u,p)=>
|
|
323
|
-
`):r.map((l,c)=>
|
|
320
|
+
${a?Array.from(o.entries()).map(([l,c])=>L`
|
|
321
|
+
${l?L`<div style=${i} data-category-header=${l}>${l}</div>`:J}
|
|
322
|
+
${c.map((u,p)=>Je(this,Ge,Id).call(this,u,p,c.length))}
|
|
323
|
+
`):r.map((l,c)=>Je(this,Ge,Id).call(this,l,c,r.length))}
|
|
324
324
|
</div>
|
|
325
325
|
</div>
|
|
326
|
-
`}};no=new WeakMap;io=new WeakMap;
|
|
326
|
+
`}};no=new WeakMap;io=new WeakMap;Ge=new WeakSet;Td=function(){this.runtime&&(ro(this,no,this.runtime.context.subscribe(()=>{this._renderTick+=1})),this.runtime.accumulator?.subscribe&&ro(this,io,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1})))};Rd=function(){var r,e;(r=Ad(this,no))==null||r.call(this),ro(this,no,null),(e=Ad(this,io))==null||e.call(this),ro(this,io,null)};ly=function(){return this._renderTick,this.runtime?this.config.actions.filter(r=>{if(!r.triggerWhen)return!0;try{return this.runtime.evaluateSync(r.triggerWhen).value}catch{return!1}}):this.config.actions};$d=function(){return LE(this.config.theme)};cy=function(r){let e=this._expandedIds.has(r),t;if(this.config.expandBehavior==="single"){for(let n of this._expandedIds)n!==r&&Je(this,Ge,so).call(this,"nav:toggled",{tipId:n,expanded:!1});t=e?new Set:new Set([r])}else t=new Set(this._expandedIds),e?t.delete(r):t.add(r);Je(this,Ge,so).call(this,"nav:toggled",{tipId:r,expanded:!e}),this._expandedIds=t};uy=function(r,e){let t=r.trim().toLowerCase();if(t.startsWith("javascript:")||t.startsWith("data:"))return;Je(this,Ge,so).call(this,"nav:tip_clicked",{href:r,external:e}),this.dispatchEvent(new CustomEvent("nav-tip-clicked",{bubbles:!0,detail:{href:r,external:e,instanceId:this.instanceId}}));let n=RE({href:r,external:e,windowOrigin:typeof window<"u"?window.location.origin:"",isIframe:IE()});if(n.kind==="open"){window.open(n.url,"_blank","noopener,noreferrer");return}if(n.kind==="fullnav"){window.location.href=n.url;return}n.url.search=window.location.search,hy(n.url.toString())||(window.history.pushState(null,"",n.url.toString()),window.dispatchEvent(new PopStateEvent("popstate")))};dy=function(r){let e=document.querySelector(r.selector);e instanceof HTMLElement&&(Je(this,Ge,so).call(this,"nav:tip_focused",{selector:r.selector,route:r.route}),this.dispatchEvent(new CustomEvent("nav-tip-focused",{bubbles:!0,detail:{selector:r.selector,instanceId:this.instanceId}})),e.scrollIntoView({behavior:"smooth",block:"center"}),OE(e),setTimeout(()=>e.focus(),400))};so=function(r,e){this.runtime?.events.publish(r,{instanceId:this.instanceId,timestamp:Date.now(),...e})};Id=function(r,e,t){let{id:n,title:i,description:s,href:o,icon:a,external:l,anchor:c,category:u}=r.config,p=this._expandedIds.has(n),h=e===t-1,f=this._hoveredId===n,v=Je(this,Ge,$d).call(this),m=c?Array.isArray(c.route)?c.route[0]:c.route:o,g=c?oy(Array.isArray(c.route)?c.route:[c.route]):m?oy([m]):!1,b=c?.selector&&c.selector!=="*",x=g&&b,w=!!m||x,y=x?"Focus \u2192":l?"Go \u2197":"Go \u2192",S=A({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)",...p?{boxShadow:v==="dark"?"0 4px 12px rgba(0, 0, 0, 0.15)":"0 4px 12px rgba(0, 0, 0, 0.08)"}:{},...h?{}:{borderBottom:"var(--sc-content-item-divider, none)"}}),T=A({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:f?"var(--sc-content-background-hover)":"transparent",color:"var(--sc-content-text-color)"}),_=A({fontSize:"20px",transition:"transform 0.2s ease",marginLeft:"auto",flexShrink:"0",color:"var(--sc-content-chevron-color, currentColor)",transform:p?"rotate(90deg)":"rotate(0deg)"}),C=A({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:p?"500px":"0",paddingBottom:p?"16px":"0"}),R=A({fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:"1.5",margin:"0"}),N=A({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, ${$E})`,color:"#ffffff"}),M=A({fontSize:"16px",flexShrink:"0"}),F=V=>{V.preventDefault(),V.stopPropagation(),x&&c?Je(this,Ge,dy).call(this,c):m&&Je(this,Ge,uy).call(this,m,l??!1)};return L`
|
|
327
327
|
<div
|
|
328
|
-
style=${
|
|
328
|
+
style=${S}
|
|
329
329
|
data-nav-tip-id=${n}
|
|
330
330
|
>
|
|
331
331
|
<button
|
|
332
332
|
type="button"
|
|
333
|
-
style=${
|
|
333
|
+
style=${T}
|
|
334
334
|
aria-expanded=${p}
|
|
335
|
-
@click=${()=>
|
|
335
|
+
@click=${()=>Je(this,Ge,cy).call(this,n)}
|
|
336
336
|
@mouseenter=${()=>{this._hoveredId=n}}
|
|
337
337
|
@mouseleave=${()=>{this._hoveredId=null}}
|
|
338
338
|
>
|
|
339
|
-
${a?
|
|
339
|
+
${a?L`<span style=${M}>${Ya(PE(a))}</span>`:J}
|
|
340
340
|
<span>${i}</span>
|
|
341
341
|
<span style=${_}>${"\u203A"}</span>
|
|
342
342
|
</button>
|
|
343
343
|
<div style=${C} aria-hidden=${!p}>
|
|
344
|
-
<p style=${
|
|
345
|
-
${
|
|
344
|
+
<p style=${R}>${s}</p>
|
|
345
|
+
${w?L`
|
|
346
346
|
<a
|
|
347
|
-
href=${
|
|
348
|
-
style=${
|
|
349
|
-
target=${l?"_blank":
|
|
350
|
-
rel=${l?"noopener noreferrer":
|
|
351
|
-
@click=${
|
|
352
|
-
>${
|
|
353
|
-
`:
|
|
347
|
+
href=${m||"#"}
|
|
348
|
+
style=${N}
|
|
349
|
+
target=${l?"_blank":J}
|
|
350
|
+
rel=${l?"noopener noreferrer":J}
|
|
351
|
+
@click=${F}
|
|
352
|
+
>${y}</a>
|
|
353
|
+
`:J}
|
|
354
354
|
</div>
|
|
355
355
|
</div>
|
|
356
|
-
`};cy.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var iy="syntro-nav-tips";function RE(){typeof window>"u"||customElements.get(iy)||customElements.define(iy,cy)}var IE=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 uy(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 $E(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var ME=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&&$E(t)?uy(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},PE={mount(r,e){RE();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()}},OE=[{kind:"navigation:scrollTo",executor:IE},{kind:"navigation:navigate",executor:ME}],dy={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:OE,widgets:[{id:"adaptive-nav:tips",component:PE,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 LE=[Lu,Vv,dy,rd],NE=LE.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 py(r){let e=0;for(let t of NE)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var Un=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 ll=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 Id=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Ci=class extends ll{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 Un(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 Id(this.context,this.host))}};var HE='<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"',hy={"\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 oo(r,e={}){let t=hy[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${HE} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var BE=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Ve={title:d.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),description:d.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),validation:d.array(d.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")},fy=["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"],gy=d.enum(fy).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),my=["time_on_page","page_views","scroll_depth"],vy=d.enum(my).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var cl=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"}'),ul=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."),dl=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"}`),pl=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}'),hl=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."),fl=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.'),gl=d.object({type:d.literal("session_metric"),key:vy,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}'),ml=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."),vl=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."),yl=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."),Ai=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."),Ti=d.object({events:d.array(gy).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),Ai).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."),bl=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:Ti.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"}}}}'),Sr=d.discriminatedUnion("type",[cl,ul,dl,pl,hl,fl,gl,ml,vl,yl,bl]),Ri=d.object({conditions:d.array(Sr).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."),Ii=d.object({type:d.literal("rules"),rules:d.array(Ri).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."),$i=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."),Mi=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."),Pi=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."),Oi=d.discriminatedUnion("type",[Ii,$i,Mi,Pi]),ao=Oi.nullable().optional();var VE=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),UE=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function jE(r,e,t="currentColor"){let n=oo(r,{size:e,color:t});if(!n)return N`<span style=${T({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,N`${i}`}var WE=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],_l=class extends be{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=>{WE.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 ee;let{title:t,widget:n}=this.config,i=this._resolvedSubtitle,s=this._resolvedIcon,o=i?36:24,l=this.runtimeRef?.widgets?.has(n)??!1,u={display:"flex",flexDirection:"column",borderRadius:"var(--sc-tile-border-radius)",background:this._hovered?"linear-gradient(0deg, var(--sc-tile-background-hover), var(--sc-tile-background-hover)), var(--sc-tile-background)":"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)"},p={display:"flex",alignItems:"center",gap:"var(--sc-tile-gap, 0.25rem)",padding:"var(--sc-tile-header-padding, 0.375rem 0.75rem)",minHeight:"44px"},h={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},f={fontSize:"1.14rem",fontWeight:"600",color:"var(--sc-tile-title-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},v={fontSize:"0.8rem",fontWeight:"400",color:"var(--sc-tile-text-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},g={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)"},y={padding:"0.75rem",fontSize:"0.8rem",color:"var(--sc-tile-text-color)",fontStyle:"italic"};return N`
|
|
356
|
+
`};py.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var ay="syntro-nav-tips";function NE(){typeof window>"u"||customElements.get(ay)||customElements.define(ay,py)}var FE=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 hy(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 DE(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var HE=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&&DE(t)?hy(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},BE={mount(r,e){NE();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()}},VE=[{kind:"navigation:scrollTo",executor:FE},{kind:"navigation:navigate",executor:HE}],fy={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:VE,widgets:[{id:"adaptive-nav:tips",component:BE,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 UE=[Fu,Wv,fy,id],jE=UE.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 gy(r){let e=0;for(let t of jE)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var Wn=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 ul=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 Md=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Ti=class extends ul{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 Wn(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 Md(this.context,this.host))}};var qE='<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"',my={"\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 oo(r,e={}){let t=my[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${qE} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var ZE=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Ue={title:d.string().max(200).optional().describe("Authoring-only: short label shown on the action plan dashboard. Stripped before serving to the runtime SDK."),description:d.string().max(1e3).optional().describe("Authoring-only: one-sentence explanation of what this action does and why. Stripped before serving to the runtime SDK."),validation:d.array(d.string().max(500)).max(10).optional().describe("Authoring-only: ordered steps a reviewer can follow to trigger this action and visually confirm it works. Each entry is one step. Stripped before serving to the runtime SDK.")},vy=["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"],yy=d.enum(vy).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),by=["time_on_page","page_views","scroll_depth"],_y=d.enum(by).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var dl=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"}'),pl=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."),hl=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"}`),fl=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}'),gl=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."),ml=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.'),vl=d.object({type:d.literal("session_metric"),key:_y,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}'),yl=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."),bl=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."),_l=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."),Ri=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."),Ii=d.object({events:d.array(yy).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),Ri).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."),xl=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:Ii.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"}}}}'),kr=d.discriminatedUnion("type",[dl,pl,hl,fl,gl,ml,vl,yl,bl,_l,xl]),$i=d.object({conditions:d.array(kr).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."),Mi=d.object({type:d.literal("rules"),rules:d.array($i).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."),Pi=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."),Oi=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."),Li=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."),Ni=d.discriminatedUnion("type",[Mi,Pi,Oi,Li]),ao=Ni.nullable().optional();var GE=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),KE=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function YE(r,e,t="currentColor"){let n=oo(r,{size:e,color:t});if(!n)return L`<span style=${A({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,L`${i}`}var XE=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],wl=class extends ye{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=>{XE.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,u={display:"flex",flexDirection:"column",borderRadius:"var(--sc-tile-border-radius)",background:this._hovered?"linear-gradient(0deg, var(--sc-tile-background-hover), var(--sc-tile-background-hover)), var(--sc-tile-background)":"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)"},p={display:"flex",alignItems:"center",gap:"var(--sc-tile-gap, 0.25rem)",padding:"var(--sc-tile-header-padding, 0.375rem 0.75rem)",minHeight:"44px"},h={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},f={fontSize:"1.14rem",fontWeight:"600",color:"var(--sc-tile-title-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},v={fontSize:"0.8rem",fontWeight:"400",color:"var(--sc-tile-text-color)",margin:"0.125rem 0 0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},m={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)"},b={padding:"0.75rem",fontSize:"0.8rem",color:"var(--sc-tile-text-color)",fontStyle:"italic"};return L`
|
|
357
357
|
<article
|
|
358
358
|
data-shadow-canvas-id=${`tile-${this.config.id}`}
|
|
359
|
-
style=${
|
|
359
|
+
style=${A(u)}
|
|
360
360
|
@mouseenter=${this._onMouseEnter}
|
|
361
361
|
@mouseleave=${this._onMouseLeave}
|
|
362
362
|
>
|
|
363
363
|
<!-- Header -->
|
|
364
|
-
<div style=${
|
|
365
|
-
<div style=${
|
|
366
|
-
${
|
|
364
|
+
<div style=${A(p)}>
|
|
365
|
+
<div style=${A(h)}>
|
|
366
|
+
${YE(s,o)}
|
|
367
367
|
</div>
|
|
368
|
-
<div style=${
|
|
369
|
-
<h3 style=${
|
|
368
|
+
<div style=${A({flex:"1",minWidth:"0"})}>
|
|
369
|
+
<h3 style=${A(f)}>
|
|
370
370
|
${t??n}
|
|
371
371
|
</h3>
|
|
372
|
-
${i?
|
|
372
|
+
${i?L`<p style=${A(v)}>${i}</p>`:J}
|
|
373
373
|
</div>
|
|
374
374
|
</div>
|
|
375
375
|
|
|
376
376
|
<!-- Widget Content -->
|
|
377
|
-
<div style=${
|
|
378
|
-
<div style=${
|
|
379
|
-
${l?
|
|
377
|
+
<div style=${A(m)}>
|
|
378
|
+
<div style=${A(g)}>
|
|
379
|
+
${l?L`<div data-widget-mount-parent></div>`:L`<div style=${A(b)}>
|
|
380
380
|
Widget not available: ${n}
|
|
381
381
|
</div>`}
|
|
382
382
|
</div>
|
|
383
383
|
</div>
|
|
384
384
|
</article>
|
|
385
|
-
`}};
|
|
386
|
-
<div data-syntro-tile-stack style=${
|
|
387
|
-
${this.tiles.map(n=>
|
|
385
|
+
`}};wl.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",wl);var Sl=class extends ye{constructor(){super(...arguments);this.tiles=[];this.runtimeRef=null;this.surface="overlay"}createRenderRoot(){return this}render(){return L`
|
|
386
|
+
<div data-syntro-tile-stack style=${A({display:"flex",flexDirection:"column",gap:"0.75rem",width:"100%"})}>
|
|
387
|
+
${this.tiles.map(n=>L`
|
|
388
388
|
<syntro-tile-card
|
|
389
389
|
.config=${n}
|
|
390
390
|
.surface=${this.surface}
|
|
@@ -392,42 +392,42 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
392
392
|
></syntro-tile-card>
|
|
393
393
|
`)}
|
|
394
394
|
</div>
|
|
395
|
-
`}};
|
|
396
|
-
<div data-syntro-bottom-sheet="root" style=${
|
|
397
|
-
${o?
|
|
395
|
+
`}};Sl.properties={tiles:{attribute:!1},runtimeRef:{attribute:!1},surface:{type:String}};customElements.define("syntro-tile-stack",Sl);var Pd={peek:30,mid:70,full:95},JE=.5,Od=8,xy=100,wy=8,kl=class extends ye{constructor(){super(...arguments);this.isOpen=!1;this.tiles=[];this.isLoading=!1;this.error=void 0;this.canvasTitle=void 0;this.runtimeRef=null;this.telemetry=null;this.themeConfig={canvas:{}};this.snap="mid";this.dragOffsetVh=0;this.isDragging=!1;this._visible=!1;this._activePointerId=null;this._dragStartY=0;this._dragStartSnap="mid";this._samples=[];this._gestureCommitted=!1;this._gestureFromHandle=!1;this._scrollEl=null;this._savedBodyOverflow=null;this._entryRafId=0;this._exitTimer=null;this._onDocumentMousedown=t=>{if(!this.isOpen)return;let n=t.composedPath();if(n.some(o=>o instanceof HTMLElement&&o.closest?.('[data-shadow-canvas-id="overlay-launcher"]')!=null))return;let s=this.querySelector('[data-syntro-bottom-sheet="container"]');s&&!n.includes(s)&&this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))};this._onScrimClick=()=>{this.snap="mid"}}createRenderRoot(){return this}get _canvas(){return this.themeConfig?.canvas??{}}get _duration(){return this._canvas.transitionDuration??"300ms"}get _easing(){return this._canvas.transitionEasing??"cubic-bezier(0.32, 0.72, 0, 1)"}get _border(){return this._canvas.border??"1px solid rgba(255, 255, 255, 0.08)"}get _blur(){let t=this._canvas.blur;return!t||t==="none"?"blur(24px)":t}get _background(){let t=this._canvas.background;return!t||t==="transparent"||t==="none"?this.themeConfig?.overlay?.background??"rgba(0, 0, 0, 0.85)":t}get _backdrop(){return this._canvas.backdrop??!1}get _backdropColor(){return this._canvas.backdropColor??"rgba(0, 0, 0, 0.4)"}get snapPoints(){let t=this._canvas.snapPoints??{};return{peek:t.peek??Pd.peek,mid:t.mid??Pd.mid,full:t.full??Pd.full}}get _topEdgeVh(){return 100-this.snapPoints[this.snap]+this.dragOffsetVh}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._onDocumentMousedown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._onDocumentMousedown),cancelAnimationFrame(this._entryRafId),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._unlockBodyScroll()}updated(t){this._scrollEl=this.querySelector('[data-syntro-bottom-sheet="scroll-area"]')??null,t.has("isOpen")&&(this.isOpen?(this._cancelExitTransition(),this._visible=!0,this.snap="mid",this._lockBodyScroll(),this._scheduleEntryTransition()):this._visible&&(this._scheduleExitTransition(),this._unlockBodyScroll()),this.dragOffsetVh=0,this.isDragging=!1,this._activePointerId=null,this._samples=[])}_lockBodyScroll(){typeof document>"u"||(this._savedBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){typeof document>"u"||this._savedBodyOverflow!==null&&(document.body.style.overflow=this._savedBodyOverflow,this._savedBodyOverflow=null)}_scheduleEntryTransition(){typeof window>"u"||(cancelAnimationFrame(this._entryRafId),this._entryRafId=requestAnimationFrame(()=>{let t=this.querySelector('[data-syntro-bottom-sheet="container"]');if(!t)return;let n=t.style.transform,i=t.style.transition;t.style.transition="none",t.style.transform="translateY(100svh)",this._entryRafId=requestAnimationFrame(()=>{t.style.transition=i,t.style.transform=n})}))}_scheduleExitTransition(){let t=this.querySelector('[data-syntro-bottom-sheet="container"]');if(!t){this._visible=!1;return}t.style.transform="translateY(100svh)",this._exitTimer=setTimeout(()=>{this._exitTimer=null,this._visible=!1},350)}_cancelExitTransition(){this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null)}_pxToVh(t){return typeof window>"u"||window.innerHeight<=0?0:t/window.innerHeight*100}_computeVelocityVhPerMs(){if(this._samples.length<2)return 0;let t=this._samples[this._samples.length-1],n=t.ts-xy,i=this._samples.find(o=>o.ts>=n)??this._samples[0],s=t.ts-i.ts;return s<=0?0:this._pxToVh(t.y-i.y)/s}_decideSnapOnRelease(){let t=this.snapPoints,n=t[this._dragStartSnap]-this.dragOffsetVh,i=this._computeVelocityVhPerMs(),s=i>0;if(Math.abs(this._pxToVelocityForDecision(i))>JE)return s?n<t.peek-Od?null:this._dragStartSnap==="full"?"mid":this._dragStartSnap==="mid"?"peek":null:this._dragStartSnap==="peek"?"mid":(this._dragStartSnap==="mid","full");if(this.dragOffsetVh>wy)return n<t.peek-Od?null:this._dragStartSnap==="full"?"mid":this._dragStartSnap==="mid"?"peek":null;if(this.dragOffsetVh<-wy)return this._dragStartSnap==="peek"?"mid":(this._dragStartSnap==="mid","full");if(n<t.peek-Od&&s)return null;let o=[["peek",Math.abs(n-t.peek)],["mid",Math.abs(n-t.mid)],["full",Math.abs(n-t.full)]];return o.sort((a,l)=>a[1]-l[1]),o[0][0]}_pxToVelocityForDecision(t){return typeof window>"u"?0:t/100*window.innerHeight}_onPointerDown(t,n){if(this._activePointerId===null&&!(!n&&this.snap!=="full")&&(this._activePointerId=t.pointerId,this._dragStartY=t.clientY,this._dragStartSnap=this.snap,this._samples=[{ts:t.timeStamp,y:t.clientY}],this._gestureFromHandle=n,this._gestureCommitted=n,n)){this.isDragging=!0;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}}}_onPointerMove(t){if(this._activePointerId!==t.pointerId)return;let n=t.clientY-this._dragStartY;this._samples.push({ts:t.timeStamp,y:t.clientY});let i=t.timeStamp-xy*2;for(;this._samples.length>2&&this._samples[0].ts<i;)this._samples.shift();if(!this._gestureCommitted){if(Math.abs(n)<6)return;if(this.snap!=="full"){this._activePointerId=null,this._samples=[];return}let c=n>0,p=(this._scrollEl?.scrollTop??0)<=0;if(!(c&&p)){this._activePointerId=null,this._samples=[];return}this._gestureCommitted=!0,this.isDragging=!0;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}}let s=this._pxToVh(n),o=this.snapPoints,l=o[this._dragStartSnap]-o.full;this.dragOffsetVh=Math.max(s,l),t.preventDefault()}_onPointerUp(t){if(this._activePointerId!==t.pointerId)return;if(this._activePointerId=null,!this._gestureCommitted){this._samples=[];return}let n=this._decideSnapOnRelease();this.isDragging=!1,this.dragOffsetVh=0,this._gestureCommitted=!1,this._gestureFromHandle=!1,this._samples=[];try{t.currentTarget.releasePointerCapture?.(t.pointerId)}catch{}if(n===null){this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}));return}this.snap=n}render(){if(!this._visible)return J;let t=this._duration,n=this._easing,i=this._topEdgeVh,s=2147483600,o=this._backdrop&&this.snap==="full",a={position:"fixed",inset:"0",pointerEvents:"none",zIndex:String(s)},l={position:"fixed",left:"0",right:"0",bottom:"0",height:"100svh",pointerEvents:"auto",transform:`translateY(${i}svh)`,transition:this.isDragging?"none":`transform ${t} ${n}, opacity ${t} ease-out`,display:"flex",flexDirection:"column",color:"var(--sc-overlay-text-color)",background:this._background,backdropFilter:this._blur,WebkitBackdropFilter:this._blur,borderTop:this._border,borderTopLeftRadius:"var(--sc-overlay-border-radius, 16px)",borderTopRightRadius:"var(--sc-overlay-border-radius, 16px)",boxShadow:"0 -8px 32px rgba(0, 0, 0, 0.25)",overflow:"hidden",paddingBottom:"env(safe-area-inset-bottom, 0px)"},c={flex:"0 0 auto",height:"56px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",touchAction:"none"},u={width:"48px",height:"5px",borderRadius:"3px",background:"rgba(255, 255, 255, 0.4)"},h={flex:"1 1 auto",overflowY:"auto",padding:"0 1rem 1rem",touchAction:"pan-y",maxHeight:`calc(${this.snapPoints[this.snap]}svh - 56px)`};return L`
|
|
396
|
+
<div data-syntro-bottom-sheet="root" style=${A(a)}>
|
|
397
|
+
${o?L`<div
|
|
398
398
|
data-syntro-bottom-sheet="scrim"
|
|
399
|
-
style=${
|
|
399
|
+
style=${A({position:"fixed",inset:"0",background:this._backdropColor,pointerEvents:"auto",transition:`opacity ${t} ease-out`,zIndex:String(s)})}
|
|
400
400
|
@click=${this._onScrimClick}
|
|
401
|
-
></div>`:
|
|
401
|
+
></div>`:J}
|
|
402
402
|
<div
|
|
403
403
|
data-syntro-bottom-sheet="container"
|
|
404
|
-
style=${
|
|
404
|
+
style=${A({...l,zIndex:String(s+1)})}
|
|
405
405
|
>
|
|
406
406
|
<div
|
|
407
407
|
data-syntro-bottom-sheet="handle"
|
|
408
|
-
style=${
|
|
408
|
+
style=${A(c)}
|
|
409
409
|
@pointerdown=${f=>this._onPointerDown(f,!0)}
|
|
410
410
|
@pointermove=${f=>this._onPointerMove(f)}
|
|
411
411
|
@pointerup=${f=>this._onPointerUp(f)}
|
|
412
412
|
@pointercancel=${f=>this._onPointerUp(f)}
|
|
413
413
|
>
|
|
414
|
-
<div data-syntro-bottom-sheet="grabber" style=${
|
|
414
|
+
<div data-syntro-bottom-sheet="grabber" style=${A(u)}></div>
|
|
415
415
|
</div>
|
|
416
416
|
|
|
417
|
-
${this.canvasTitle?
|
|
417
|
+
${this.canvasTitle?L`<header style=${A({padding:"0 1rem 0.5rem",margin:"0",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.5em",color:"var(--sc-notification-text-secondary-color)"})}>${this.canvasTitle}</header>`:J}
|
|
418
418
|
|
|
419
419
|
<div
|
|
420
420
|
data-syntro-bottom-sheet="scroll-area"
|
|
421
|
-
style=${
|
|
421
|
+
style=${A(h)}
|
|
422
422
|
@pointerdown=${f=>this._onPointerDown(f,!1)}
|
|
423
423
|
@pointermove=${f=>this._onPointerMove(f)}
|
|
424
424
|
@pointerup=${f=>this._onPointerUp(f)}
|
|
425
425
|
@pointercancel=${f=>this._onPointerUp(f)}
|
|
426
426
|
>
|
|
427
|
-
${this.isLoading?
|
|
427
|
+
${this.isLoading?L`<div data-syntro-bottom-sheet="loading">Loading...</div>`:this.error?L`<div
|
|
428
428
|
data-syntro-bottom-sheet="error"
|
|
429
|
-
style=${
|
|
430
|
-
>Failed to load: ${this.error}</div>`:
|
|
429
|
+
style=${A({color:"var(--sc-notification-error-color)"})}
|
|
430
|
+
>Failed to load: ${this.error}</div>`:L`<syntro-tile-stack
|
|
431
431
|
.tiles=${this.tiles}
|
|
432
432
|
.surface=${"overlay"}
|
|
433
433
|
.runtimeRef=${this.runtimeRef}
|
|
@@ -435,15 +435,15 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
435
435
|
</div>
|
|
436
436
|
</div>
|
|
437
437
|
</div>
|
|
438
|
-
`}};wl.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},snap:{attribute:!1},dragOffsetVh:{attribute:!1},isDragging:{attribute:!1},_visible:{attribute:!1}};customElements.define("syntro-bottom-sheet",wl);var Pe="1.0.0",Re={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"},lt={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},lo={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},Pd={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var Sl=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===lt.MouseInteraction){let n=e.data.id??0;if(e.data.type===lo.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===lo.Blur){let i=this.focused.get(n);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Re.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Pe,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===lt.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var kl=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!==lt.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:Re.UI_HESITATE,source:"rrweb",schemaVersion:Pe,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var El=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!==lt.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?_y(t):null,i=this.currentElement?_y(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Re.UI_HOVER,source:"rrweb",schemaVersion:Pe,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function _y(r){return`${r.tag_name??""}|${r.attr__id??""}|${(r.classes??[]).join(",")}`}var Cl=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===lt.MouseMove||t===lt.MouseInteraction||t===lt.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:Re.UI_IDLE,source:"rrweb",schemaVersion:Pe,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Al=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==lt.MouseInteraction||e.data.type!==lo.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:Re.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Pe,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Tl=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!==lt.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:Re.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:Pe,props:{reversals:this.reversals.length,duration_ms:n-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var xy={$click:Re.UI_CLICK,$scroll:Re.UI_SCROLL,$input:Re.UI_INPUT,$change:Re.UI_CHANGE,$submit:Re.UI_SUBMIT,$pageview:Re.NAV_PAGE_VIEW,$pageleave:Re.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function qE(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(xy[e])return xy[e];if(e==="$autocapture"){let t=r.properties?.$tag_name,n=r.properties?.$event_type;return n==="submit"?Re.UI_SUBMIT:n==="change"?Re.UI_CHANGE:t==="input"||t==="textarea"?Re.UI_INPUT:Re.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var wy=new Set(["a","button","input","select","textarea"]);function ZE(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 GE(r,e){if(e&&wy.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&wy.has(n))return n}return e}function KE(r,e){return r.map((t,n)=>{let i=e[n];return!i||t.tag_name!==i.tag_name?t:{...i,...t}})}function YE(r,e){let t={},n=r.properties||{},i=n.$elements??(typeof n.$elements_chain=="string"?ZE(n.$elements_chain):void 0),s=i&&e?KE(i,e):i,o=n.$tag_name??s?.[0]?.tag_name,a=r.event==="$autocapture"||r.event==="$click";return t.tagName=a?GE(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 Li(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:qE(r),source:"posthog",props:YE(r,e),schemaVersion:Pe}}function Ni(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 Od(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if(Ni(n)){let i=Li(n);r(i)}}}function Ld(r){let e={...Pd,...r?.config},t=[];function n(v){for(let g of t)g(v)}let i=new kl(e,n),s=new Al(e,n),o=new Tl(e,n),a=new Sl(e,n),l=new Cl(e,n),c=new El(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(Ni(m)){let y=h(m)?f(typeof m.timestamp=="number"?m.timestamp:Date.now()):void 0;n(Li(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 Ze={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 co=3;var Rl=3e4;var JE=0;function Nd(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function QE(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function Sy(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!QE(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++JE}-${s}`,title:Nd(i.title,r.props),body:i.body?Nd(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?Nd(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Fi=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=Sy(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(Ze.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()}push(e){let t=[...this._notifications,e];if(t.length>3){let n=t.shift(),i=this._timerIds.get(n.id);i&&(clearTimeout(i),this._timerIds.delete(n.id))}this._notifications=t,this.host.requestUpdate(),this._scheduleDismiss(e)}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(Ze.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 Vt(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:Pe}}function eC(r,e){return Vt(Ze.CANVAS_OPENED,{surface:r,...e})}function tC(r,e){return Vt(Ze.CANVAS_CLOSED,{surface:r,...e})}function rC(r,e){return Vt(Ze.TILE_VIEWED,{tileId:r,surface:e})}function nC(r,e){return Vt(Ze.TILE_EXPANDED,{tileId:r,surface:e})}function iC(r,e){return Vt(Ze.TILE_COLLAPSED,{tileId:r,surface:e})}function sC(r,e,t){return Vt(Ze.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function oC(r,e){return Vt(Ze.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function aC(r,e){return Vt(Ze.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function lC(r,e,t){return Vt(Ze.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function cC(r,e,t){return Vt(Ze.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function uC(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return Vt(t,e)}var Di={canvasOpened:eC,canvasClosed:tC,tileViewed:rC,tileExpanded:nC,tileCollapsed:iC,tileAction:sC,overlayStarted:oC,overlayCompleted:aC,overlayDismissed:lC,overlayStepViewed:cC,custom:uC};function dC(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 Il=class extends be{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.isMobileMode=!1;this._surfaceUnsub=null;this._toggleCooldown=!1;this._toggleCooldownTimer=null;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new Fi(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher(),this._subscribeSurface()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher(),this._surfaceUnsub?.(),this._surfaceUnsub=null,this._toggleCooldownTimer!==null&&(clearTimeout(this._toggleCooldownTimer),this._toggleCooldownTimer=null)}_subscribeSurface(){let t=this.runtimeRef?.context;if(!t)return;let n=()=>{let i=t.get()?.surface?.mode==="mobile";i!==this.isMobileMode&&(this.isMobileMode=i)};n(),this._surfaceUnsub=t.subscribe(n)}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher(),t.has("runtimeRef")&&(this._surfaceUnsub?.(),this._surfaceUnsub=null,this._subscribeSurface())),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=dC(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=Di.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}}get _resolvedThemeConfig(){return!this.isMobileMode||!this.themeConfig?.mobile?.canvas?this.themeConfig:{...this.themeConfig,canvas:{...this.themeConfig.canvas,...this.themeConfig.mobile.canvas}}}_surfaceMeta(){return this.runtimeRef?.context.get()?.surface}_toggle(){if(this._toggleCooldown)return;let t=!this.isOpen;if(this.isOpen=t,this._toggleCooldown=!0,this._toggleCooldownTimer=setTimeout(()=>{this._toggleCooldown=!1,this._toggleCooldownTimer=null},300),t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let n=this._surfaceMeta(),i=t?Di.canvasOpened("overlay",n):Di.canvasClosed("overlay",n);this.runtimeRef.events.publish(i.name,i.props,i.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(Ze.NOTIFICATION_CLICKED,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&n.tileId&&this.runtimeRef.events.publish(Ze.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)}previewNotification(t){let n=t.ttl??6e3;this._notifications.push({id:`preview-${Date.now()}`,title:t.title,body:t.body,icon:t.icon??"\u{1F514}",tileId:"__preview__",createdAt:Date.now(),expiresAt:Date.now()+n,ttl:n})}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,n=this.themeConfig?.canvas?.position==="left"?"left":"right";return N`
|
|
438
|
+
`}};kl.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1},snap:{attribute:!1},dragOffsetVh:{attribute:!1},isDragging:{attribute:!1},_visible:{attribute:!1}};customElements.define("syntro-bottom-sheet",kl);var Pe="1.0.0",Re={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"},ut={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},lo={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},Ld={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var El=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===ut.MouseInteraction){let n=e.data.id??0;if(e.data.type===lo.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===lo.Blur){let i=this.focused.get(n);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Re.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Pe,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===ut.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var Cl=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!==ut.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:Re.UI_HESITATE,source:"rrweb",schemaVersion:Pe,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var Al=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!==ut.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?Sy(t):null,i=this.currentElement?Sy(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Re.UI_HOVER,source:"rrweb",schemaVersion:Pe,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function Sy(r){return`${r.tag_name??""}|${r.attr__id??""}|${(r.classes??[]).join(",")}`}var Tl=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===ut.MouseMove||t===ut.MouseInteraction||t===ut.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:Re.UI_IDLE,source:"rrweb",schemaVersion:Pe,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var Rl=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==ut.MouseInteraction||e.data.type!==lo.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:Re.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Pe,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var Il=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!==ut.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:Re.UI_SCROLL_THRASH,source:"rrweb",schemaVersion:Pe,props:{reversals:this.reversals.length,duration_ms:n-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var ky={$click:Re.UI_CLICK,$scroll:Re.UI_SCROLL,$input:Re.UI_INPUT,$change:Re.UI_CHANGE,$submit:Re.UI_SUBMIT,$pageview:Re.NAV_PAGE_VIEW,$pageleave:Re.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function QE(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(ky[e])return ky[e];if(e==="$autocapture"){let t=r.properties?.$tag_name,n=r.properties?.$event_type;return n==="submit"?Re.UI_SUBMIT:n==="change"?Re.UI_CHANGE:t==="input"||t==="textarea"?Re.UI_INPUT:Re.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var Ey=new Set(["a","button","input","select","textarea"]);function eC(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 tC(r,e){if(e&&Ey.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&Ey.has(n))return n}return e}function rC(r,e){return r.map((t,n)=>{let i=e[n];return!i||t.tag_name!==i.tag_name?t:{...i,...t}})}function nC(r,e){let t={},n=r.properties||{},i=n.$elements??(typeof n.$elements_chain=="string"?eC(n.$elements_chain):void 0),s=i&&e?rC(i,e):i,o=n.$tag_name??s?.[0]?.tag_name,a=r.event==="$autocapture"||r.event==="$click";return t.tagName=a?tC(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 Fi(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:QE(r),source:"posthog",props:nC(r,e),schemaVersion:Pe}}function Di(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 Nd(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if(Di(n)){let i=Fi(n);r(i)}}}function Fd(r){let e={...Ld,...r?.config},t=[];function n(v){for(let m of t)m(v)}let i=new Cl(e,n),s=new Rl(e,n),o=new Il(e,n),a=new El(e,n),l=new Tl(e,n),c=new Al(e,n,r?.elementResolver),u=[],p=500;function h(v){if(v.event==="$click")return!0;if(v.event!=="$autocapture")return!1;let m=v.properties?.$event_type;return m===void 0||m==="click"}function f(v){let m=v-p;for(;u.length>0&&u[0].ts<m;)u.shift();return u.shift()?.elements}return{ingest(v){if(v.kind==="posthog"){let{kind:m,...g}=v;if(Di(g)){let b=h(g)?f(typeof g.timestamp=="number"?g.timestamp:Date.now()):void 0;n(Fi(g,b))}}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,m){u.push({ts:v,elements:m});let g=v-p;for(;u.length>0&&u[0].ts<g;)u.shift()}}}var 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",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 co=3;var $l=3e4;var sC=0;function Dd(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function oC(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function Cy(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!oC(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++sC}-${s}`,title:Dd(i.title,r.props),body:i.body?Dd(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?Dd(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Hi=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=Cy(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(Ke.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()}push(e){let t=[...this._notifications,e];if(t.length>3){let n=t.shift(),i=this._timerIds.get(n.id);i&&(clearTimeout(i),this._timerIds.delete(n.id))}this._notifications=t,this.host.requestUpdate(),this._scheduleDismiss(e)}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(Ke.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 jt(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:Pe}}function aC(r,e){return jt(Ke.CANVAS_OPENED,{surface:r,...e})}function lC(r,e){return jt(Ke.CANVAS_CLOSED,{surface:r,...e})}function cC(r,e){return jt(Ke.TILE_VIEWED,{tileId:r,surface:e})}function uC(r,e){return jt(Ke.TILE_EXPANDED,{tileId:r,surface:e})}function dC(r,e){return jt(Ke.TILE_COLLAPSED,{tileId:r,surface:e})}function pC(r,e,t){return jt(Ke.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function hC(r,e){return jt(Ke.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function fC(r,e){return jt(Ke.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function gC(r,e,t){return jt(Ke.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function mC(r,e,t){return jt(Ke.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function vC(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return jt(t,e)}var Bi={canvasOpened:aC,canvasClosed:lC,tileViewed:cC,tileExpanded:uC,tileCollapsed:dC,tileAction:pC,overlayStarted:hC,overlayCompleted:fC,overlayDismissed:gC,overlayStepViewed:mC,custom:vC};function yC(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 Ml=class extends ye{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.isMobileMode=!1;this._surfaceUnsub=null;this._toggleCooldown=!1;this._toggleCooldownTimer=null;this._notifyPrevState=new Map;this._notifyUnsub=null;this._notifyUnsubMetrics=null;this._notifications=new Hi(this,null,[])}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._syncNotificationsController(),this._startNotifyWatcher(),this._subscribeSurface()}disconnectedCallback(){super.disconnectedCallback(),this._stopNotifyWatcher(),this._surfaceUnsub?.(),this._surfaceUnsub=null,this._toggleCooldownTimer!==null&&(clearTimeout(this._toggleCooldownTimer),this._toggleCooldownTimer=null)}_subscribeSurface(){let t=this.runtimeRef?.context;if(!t)return;let n=()=>{let i=t.get()?.surface?.mode==="mobile";i!==this.isMobileMode&&(this.isMobileMode=i)};n(),this._surfaceUnsub=t.subscribe(n)}updated(t){(t.has("runtimeRef")||t.has("tiles"))&&(this._syncNotificationsController(),this._restartNotifyWatcher(),t.has("runtimeRef")&&(this._surfaceUnsub?.(),this._surfaceUnsub=null,this._subscribeSurface())),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=yC(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=Bi.tileViewed(t.id,"overlay");this.runtimeRef.events.publish(n.name,n.props,n.source)}}get _resolvedThemeConfig(){return!this.isMobileMode||!this.themeConfig?.mobile?.canvas?this.themeConfig:{...this.themeConfig,canvas:{...this.themeConfig.canvas,...this.themeConfig.mobile.canvas}}}_surfaceMeta(){return this.runtimeRef?.context.get()?.surface}_toggle(){if(this._toggleCooldown)return;let t=!this.isOpen;if(this.isOpen=t,this._toggleCooldown=!0,this._toggleCooldownTimer=setTimeout(()=>{this._toggleCooldown=!1,this._toggleCooldownTimer=null},300),t?this.telemetry?.trackCanvasOpened("overlay"):this.telemetry?.trackCanvasClosed("overlay"),this.runtimeRef){let n=this._surfaceMeta(),i=t?Bi.canvasOpened("overlay",n):Bi.canvasClosed("overlay",n);this.runtimeRef.events.publish(i.name,i.props,i.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(Ke.NOTIFICATION_CLICKED,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&n.tileId&&this.runtimeRef.events.publish(Ke.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)}previewNotification(t){let n=t.ttl??6e3;this._notifications.push({id:`preview-${Date.now()}`,title:t.title,body:t.body,icon:t.icon??"\u{1F514}",tileId:"__preview__",createdAt:Date.now(),expiresAt:Date.now()+n,ttl:n})}_onLauncherToggle(){this._toggle()}_onDrawerClose(){this.isOpen&&this._toggle()}render(){let t=this._notifications.notifications,n=this.themeConfig?.canvas?.position==="left"?"left":"right";return L`
|
|
439
439
|
<div data-shadow-canvas-id="overlay-launcher" style="position:fixed;inset:0;pointer-events:none;z-index:2147483647">
|
|
440
|
-
${t.length>0?
|
|
440
|
+
${t.length>0?L`<syntro-toast-stack
|
|
441
441
|
data-testid="notification-toast-stack"
|
|
442
442
|
.notifications=${t}
|
|
443
443
|
.position=${n}
|
|
444
444
|
@notification-click=${this._handleNotificationClick}
|
|
445
445
|
@notification-dismiss=${this._handleNotificationDismiss}
|
|
446
|
-
></syntro-toast-stack>`:
|
|
446
|
+
></syntro-toast-stack>`:J}
|
|
447
447
|
<syntro-launcher
|
|
448
448
|
.isOpen=${this.isOpen}
|
|
449
449
|
.notifications=${t}
|
|
@@ -455,7 +455,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
455
455
|
></syntro-launcher>
|
|
456
456
|
</div>
|
|
457
457
|
|
|
458
|
-
${this.isMobileMode?
|
|
458
|
+
${this.isMobileMode?L`<syntro-bottom-sheet
|
|
459
459
|
.isOpen=${this.isOpen}
|
|
460
460
|
.tiles=${this.tiles}
|
|
461
461
|
.isLoading=${this.isLoading}
|
|
@@ -465,7 +465,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
465
465
|
.telemetry=${this.telemetry}
|
|
466
466
|
.themeConfig=${this._resolvedThemeConfig}
|
|
467
467
|
@drawer-close=${this._onDrawerClose}
|
|
468
|
-
></syntro-bottom-sheet>`:
|
|
468
|
+
></syntro-bottom-sheet>`:L`<syntro-drawer
|
|
469
469
|
.isOpen=${this.isOpen}
|
|
470
470
|
.tiles=${this.tiles}
|
|
471
471
|
.isLoading=${this.isLoading}
|
|
@@ -477,28 +477,28 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
477
477
|
.themeConfig=${this.themeConfig}
|
|
478
478
|
@drawer-close=${this._onDrawerClose}
|
|
479
479
|
></syntro-drawer>`}
|
|
480
|
-
`}};
|
|
481
|
-
<div data-syntro-inline-shell="container" style=${
|
|
482
|
-
${this.isLoading?
|
|
480
|
+
`}};Ml.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},isMobileMode:{attribute:!1}};customElements.define("syntro-canvas-overlay",Ml);var Pl=class extends ye{constructor(){super(...arguments);this.tiles=[];this.isLoading=!1;this.error=void 0;this.runtimeRef=null}createRenderRoot(){return this}render(){return L`
|
|
481
|
+
<div data-syntro-inline-shell="container" style=${A({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"})}>
|
|
482
|
+
${this.isLoading?L`<div data-syntro-inline-shell="loading">Loading...</div>`:this.error?L`<div
|
|
483
483
|
data-syntro-inline-shell="error"
|
|
484
|
-
style=${
|
|
485
|
-
>Failed to load: ${this.error}</div>`:this.tiles.length>0?
|
|
484
|
+
style=${A({color:"var(--sc-notification-error-color)"})}
|
|
485
|
+
>Failed to load: ${this.error}</div>`:this.tiles.length>0?L`<syntro-tile-stack
|
|
486
486
|
.tiles=${this.tiles}
|
|
487
487
|
.surface=${"inline"}
|
|
488
488
|
.runtimeRef=${this.runtimeRef}
|
|
489
|
-
></syntro-tile-stack>`:
|
|
489
|
+
></syntro-tile-stack>`:J}
|
|
490
490
|
</div>
|
|
491
|
-
`}};$l.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",$l);function Ml(r,e,t="merge"){return t==="first-match"?pC(r,e):hC(r,e)}function pC(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 ky([i])}return null}function hC(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:ky(t)}function ky(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 Fd=!1;function Ey(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Dd(r){if(Ey()){Fd=!0;return}Fd=r??!1}function fC(){return Ey()?!0:Fd}function Z(r,e,t){fC()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Ge(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function Pl(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var Ol=class{constructor(e){this.config=e;this.counters=new Map;this.histograms=new Map;this.windowStartMs=Date.now();this.timer=null;this.pagehideHandler=null;this.runtime=null;this.adapterCleanup=null;this.resource=e.resource,this.flushIntervalMs=e.flushIntervalMs??6e4}bindRuntime(e){this.runtime=e}attachAdapterCleanup(e){this.adapterCleanup=e}increment(e,t=1){this.counters.set(e,(this.counters.get(e)??0)+t)}snapshotCounters(){let e={};for(let[t,n]of this.counters)e[t]=n;return e}recordHistogram(e,t){let n=this.histograms.get(e)??[];n.push(t),this.histograms.set(e,n)}snapshotHistograms(){let e={};for(let[t,n]of this.histograms){if(n.length===0)continue;let i=[...n].sort((s,o)=>s-o);e[t]={count:i.length,p50:Cy(i,.5),p95:Cy(i,.95)}}return e}async flush(){let e=this.snapshotCounters(),t=this.snapshotHistograms();if(!(Object.keys(e).length>0||Object.keys(t).length>0))return;let i=null,s="";try{i=this.runtime?.getSurface()??null}catch{}try{s=this.runtime?.getSessionId()??""}catch{}let o={resource:{...this.resource,sessionId:s,surfaceType:i?.type??"unknown",surfaceHost:i?.host??"unknown",surfaceDevice:i?.device??"unknown",surfaceMode:i?.mode??"unknown"},windowSeconds:Math.max(1,Math.round((Date.now()-this.windowStartMs)/1e3)),windowStartUnixMs:this.windowStartMs,counters:e,histograms:t};this.counters.clear(),this.histograms.clear(),this.windowStartMs=Date.now();try{await this.config.emit(o)}catch{}}start(){this.timer===null&&(this.timer=setInterval(()=>{this.flush()},this.flushIntervalMs),typeof window<"u"&&(this.pagehideHandler=()=>{this.flush()},window.addEventListener("pagehide",this.pagehideHandler)))}stop(){if(this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.pagehideHandler!==null&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pagehideHandler),this.pagehideHandler=null),this.adapterCleanup!==null){try{this.adapterCleanup()}catch{}this.adapterCleanup=null}}};function Cy(r,e){if(r.length===0)return 0;let t=(r.length-1)*e,n=Math.floor(t),i=Math.ceil(t);return n===i?r[n]:r[n]+(r[i]-r[n])*(t-n)}var uo=null;function Hd(r){return uo?.stop(),uo=new Ol(r),uo.start(),uo}function nr(){return uo}var kr=(r,e)=>({key:r,value:{stringValue:e}}),Bd=(r,e)=>({key:r,value:{intValue:Math.round(e)}}),Ay=(r,e)=>({key:r,value:{doubleValue:e}});function gC(r){let{resource:e,counters:t,histograms:n,windowSeconds:i,windowStartUnixMs:s}=r,o=[kr("service.name",e.serviceName),kr("service.version",e.serviceVersion),kr("syntro.posthog_key",e.posthogKey),kr("syntro.session_id",e.sessionId),kr("syntro.surface_type",e.surfaceType),kr("syntro.surface_host",e.surfaceHost),kr("syntro.surface_device",e.surfaceDevice),kr("syntro.surface_mode",e.surfaceMode),kr("syntro.host_origin",e.hostOrigin)],a=[Bd("window_seconds",i)];for(let[u,p]of Object.entries(t))p!==void 0&&a.push(Bd(u,p));for(let[u,p]of Object.entries(n))p!==void 0&&(a.push(Bd(`${u}_count`,p.count)),a.push(Ay(`${u}_p50`,p.p50)),a.push(Ay(`${u}_p95`,p.p95)));let l=`${Date.now()}000000`,c=`${s}000000`;return{resourceLogs:[{resource:{attributes:o},scopeLogs:[{scope:{name:"syntro.sdk.health"},logRecords:[{timeUnixNano:c,observedTimeUnixNano:l,severityText:"INFO",body:{stringValue:"sdk_health_window"},attributes:a}]}]}]}}function Vd(r){let e=r.fetchImpl??fetch;return async t=>{let n=JSON.stringify(gC(t)),i=()=>e(r.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0,mode:"cors"});try{let s=await i();if(!s.ok&&s.status>=500)try{await i()}catch{}}catch{try{await i()}catch{}}}}function mC(){if(typeof document>"u")return;let r=document.currentScript;if(r&&r.src)return r.src;try{let e=Array.from(document.scripts);for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.src;if(typeof n=="string"&&(n.includes("runtime-sdk")||n.includes("smart-canvas")))return n}}catch{}}var Ud=mC();function jd(){if(!Ud)return;let r=Ud.lastIndexOf("/");if(r!==-1)return Ud.substring(0,r+1)}var Ny=-1,Bi=r=>{addEventListener("pageshow",(e=>{e.persisted&&(Ny=e.timeStamp,r(e))}),!0)},ir=(r,e,t,n)=>{let i,s;return o=>{e.value>=0&&(o||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(e.value,t),r(e)))}},Jd=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},Qd=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},po=()=>Qd()?.activationStart??0,sr=(r,e=-1)=>{let t=Qd(),n="navigate";return Ny>=0?n="back-forward-cache":t&&(document.prerendering||po()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},Wd=new WeakMap;function ep(r,e){return Wd.get(r)||Wd.set(r,new e),Wd.get(r)}var qd=class{constructor(){pe(this,"t");pe(this,"i",0);pe(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},ho=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},tp=r=>{let e=!1;return()=>{e||(r(),e=!0)}},Hi=-1,Fy=new Set,Ty=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Zd=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of Fy)e();isFinite(Hi)||(Hi=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",Zd,!0))}},Nl=()=>{if(Hi<0){let r=po();Hi=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??Ty(),addEventListener("visibilitychange",Zd,!0),addEventListener("prerenderingchange",Zd,!0),Bi((()=>{setTimeout((()=>{Hi=Ty()}))}))}return{get firstHiddenTime(){return Hi},onHidden(r){Fy.add(r)}}},Fl=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},Ry=[1800,3e3],rp=(r,e={})=>{Fl((()=>{let t=Nl(),n,i=sr("FCP"),s=ho("paint",(o=>{for(let a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime<t.firstHiddenTime&&(i.value=Math.max(a.startTime-po(),0),i.entries.push(a),n(!0)))}));s&&(n=ir(r,i,Ry,e.reportAllChanges),Bi((o=>{i=sr("FCP"),n=ir(r,i,Ry,e.reportAllChanges),Jd((()=>{i.value=performance.now()-o.timeStamp,n(!0)}))})))}))},Iy=[.1,.25],Dy=(r,e={})=>{let t=Nl();rp(tp((()=>{let n,i=sr("CLS",0),s=ep(e,qd),o=l=>{for(let c of l)s.h(c);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},a=ho("layout-shift",o);a&&(n=ir(r,i,Iy,e.reportAllChanges),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Bi((()=>{s.i=0,i=sr("CLS",0),n=ir(r,i,Iy,e.reportAllChanges),Jd((()=>n()))})),setTimeout(n))})))},Hy=0,zd=1/0,Ll=0,vC=r=>{for(let e of r)e.interactionId&&(zd=Math.min(zd,e.interactionId),Ll=Math.max(Ll,e.interactionId),Hy=Ll?(Ll-zd)/7+1:0)},Gd,$y=()=>Gd?Hy:performance.interactionCount??0,yC=()=>{"interactionCount"in performance||Gd||(Gd=ho("event",vC,{type:"event",buffered:!0,durationThreshold:0}))},My=0,Kd=class{constructor(){pe(this,"u",[]);pe(this,"l",new Map);pe(this,"m");pe(this,"p")}v(){My=$y(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor(($y()-My)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},By=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=tp(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},Py=[200,500],Vy=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=Nl();Fl((()=>{yC();let n,i=sr("INP"),s=ep(e,Kd),o=l=>{By((()=>{for(let u of l)s.h(u);let c=s.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=ho("event",o,{durationThreshold:e.durationThreshold??40});n=ir(r,i,Py,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Bi((()=>{s.v(),i=sr("INP"),n=ir(r,i,Py,e.reportAllChanges)})))}))},Yd=class{constructor(){pe(this,"m")}h(e){this.m?.(e)}},Oy=[2500,4e3],Uy=(r,e={})=>{Fl((()=>{let t=Nl(),n,i=sr("LCP"),s=ep(e,Yd),o=l=>{e.reportAllChanges||(l=l.slice(-1));for(let c of l)s.h(c),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-po(),0),i.entries=[c],n())},a=ho("largest-contentful-paint",o);if(a){n=ir(r,i,Oy,e.reportAllChanges);let l=tp((()=>{o(a.takeRecords()),a.disconnect(),n(!0)})),c=u=>{u.isTrusted&&(By(l),removeEventListener(u.type,c,{capture:!0}))};for(let u of["keydown","click","visibilitychange"])addEventListener(u,c,{capture:!0});Bi((u=>{i=sr("LCP"),n=ir(r,i,Oy,e.reportAllChanges),Jd((()=>{i.value=performance.now()-u.timeStamp,n(!0)}))}))}}))},Ly=[800,1800],Xd=r=>{document.prerendering?Fl((()=>Xd(r))):document.readyState!=="complete"?addEventListener("load",(()=>Xd(r)),!0):setTimeout(r)},jy=(r,e={})=>{let t=sr("TTFB"),n=ir(r,t,Ly,e.reportAllChanges);Xd((()=>{let i=Qd();i&&(t.value=Math.max(i.responseStart-po(),0),t.entries=[i],n(!0),Bi((()=>{t=sr("TTFB",0),n=ir(r,t,Ly,e.reportAllChanges),n(!0)})))}))};var Wy="__syntro_vitals_bound",Dl="__syntro_vitals_current_reporter";function np(r,e){if(typeof window>"u")return()=>{};let t=window;t[Dl]=r;let n=null,i=e?.attributedScriptUrlPrefix;if(i&&"PerformanceObserver"in window)try{n=new PerformanceObserver(s=>{let o=t[Dl];if(o)for(let a of s.getEntries()){let l=a.attribution;if(!l)continue;l.some(u=>(u.containerSrc??u.name??"").startsWith(i))&&(o.increment("longtasks_self_count"),o.increment("longtasks_self_blocking_ms",Math.round(a.duration)))}}),n.observe({type:"longtask",buffered:!0})}catch{n=null}if(!t[Wy]){t[Wy]=!0;let s=o=>a=>{t[Dl]?.recordHistogram(o,a.value)};Uy(s("lcp_ms")),Vy(s("inp_ms")),rp(s("fcp_ms")),jy(s("ttfb_ms")),Dy(o=>{t[Dl]?.recordHistogram("cls_score",o.value)})}return()=>{n?.disconnect()}}var Vi="2.8.0-canary.207";var Er="2.0";var bC=["api.syntrologie.com","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] Config URI must use HTTPS:",r),!1):bC.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 xC(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var zy="syntro_config_cache",wC=1440*60*1e3;function qy(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function SC(r,e){if(qy())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(zy,JSON.stringify(t))}catch{}}function kC(r){if(!qy())return null;try{let e=localStorage.getItem(zy);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>wC?null:t.config}catch{return null}}var Hl=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function EC(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 jn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let h=e.getFeatureValue?.(i,null);if(h&&typeof h=="object")return Z("SmartCanvas Config","Resolved config directly from feature flag",h),h}if(e&&(s||o||e.getAllFeatures)){let h=EC(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",h.length,"keys found"),h.length>0){let f=Ml(e,h);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",f?`tiles=${f.tiles?.length}`:"null"),f)return Z("SmartCanvas Config","Resolved config from variant flags",f),f}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=Hl({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(!_C(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(xC(l)?"include":"omit"),u=performance.now(),p=!1;try{let h=await fetch(l,{credentials:c,headers:{"X-SDK-Version":Vi,"X-SDK-Schema-Version":Er}});if(!h.ok)throw nr()?.increment("flag_fetch_errors"),p=!0,new Error(`SmartCanvas: failed to fetch config (${h.status})`);let f=await h.json(),v=performance.now()-u;return nr()?.increment("flag_fetch_count"),nr()?.recordHistogram("flag_fetch_latency_ms",v),Z("SmartCanvas Config","Fetched config from URI",f),a&&SC(f,a),f}catch(h){if(p||nr()?.increment("flag_fetch_errors"),a){let f=kC(a);if(f)return Z("SmartCanvas Config","Serving config from offline cache"),f}throw h}};var Bl=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)}},ip=r=>new Bl(r);var Ut={white:"#ffffff",black:"#000000"},se={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},k={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},Ee={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"},Oe={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},or={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},fo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},go={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},mo={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var bt={primary:k[10],secondary:k[9],tertiary:k[8]},i4={primary:k[2],secondary:k[0]},sp={primary:k[4],secondary:k[3]},Vl={primary:{text:Ut.white,icon:Ut.white,border:se[3],backgroundDefault:se[3],backgroundHover:se[2]},neutral:{text:k[10],textHover:Ut.white,icon:k[10],iconHover:Ut.white,border:k[4],background:k[2]},link:{text:Ut.white,icon:Ut.white,hover:se[5]},error:{text:Oe[5],hover:Oe[6]},success:{text:Ee[5],hover:Ee[6]}},s4={slateGrey:{content:k[10],pillOutline:k[10],borderPrimary:k[5],borderSecondary:k[5],background:k[3]},brand:{content:se[9],pillOutline:se[9],borderPrimary:se[6],borderSecondary:se[6],background:se[0]},red:{content:Oe[8],pillOutline:Oe[4],borderPrimary:Oe[2],borderSecondary:Oe[2],background:Oe[0]},yellow:{content:Je[8],pillOutline:Je[4],borderPrimary:Je[2],borderSecondary:Je[2],background:Je[0]},green:{content:Ee[8],pillOutline:Ee[4],borderPrimary:Ee[2],borderSecondary:Ee[2],background:Ee[0]},purple:{content:go[8],pillOutline:go[4],borderPrimary:go[2],borderSecondary:go[2],background:go[0]},blue:{content:or[8],pillOutline:or[4],borderPrimary:or[2],borderSecondary:or[2],background:or[0]},orange:{content:fo[8],pillOutline:fo[4],borderPrimary:fo[2],borderSecondary:fo[2],background:fo[0]},pink:{content:mo[8],pillOutline:mo[4],borderPrimary:mo[2],borderSecondary:mo[2],background:mo[0]}},o4={green:{content:Ee[8],border:Ee[2],background:Ee[0]},yellow:{content:Je[8],border:Je[2],background:Je[0]},red:{content:Oe[8],border:Oe[2],background:Oe[0]}},a4={green:{content:Ee[1],background:Ee[9]},yellow:{content:Je[1],background:Je[9]},red:{content:Oe[1],background:Oe[9]}},l4={content:k[10],border:k[4],background:k[3]},c4={backgroundDefault:k[2],backgroundHover:k[1],selected:k[3]},u4={background:k[2],icon:k[10],borderDefault:k[4],borderSelected:se[3],textLabel:k[9],textPlaceholder:k[8],textHint:k[8]},d4={backgroundDefault:k[2],backgroundDisabled:k[0],textLabel:k[9],textPlaceholder:k[8],textHint:k[8],textError:Oe[5],iconDefault:k[9],iconPlaceholder:k[10],iconError:Oe[5],borderDefault:k[4],borderSelected:se[3],borderError:Oe[5]},p4={handleDefault:Ut.white,handleDisabled:k[10],off:{backgroundDefault:k[4],backgroundHover:k[5],backgroundDisabled:k[4]},on:{backgroundDefault:Ee[3],backgroundHover:Ee[2],backgroundDisabled:k[4]}},h4={off:{backgroundDefault:"#00000000",backgroundHover:k[5],backgroundDisabled:k[2],border:k[6]},on:{backgroundDefault:Ee[0],backgroundHover:Ee[1],backgroundDisabled:k[2],border:Ee[3]}},f4={content:k[10],background:k[4]},g4={background:k[4],active:Ee[3]},m4={background:k[1],content:k[9],border:k[4]},v4={backgroundDefault:k[1],backgroundHover:k[3],backgroundActive:k[4],border:k[4],contentPrimary:k[10],contentSecondary:k[9],contentTertiary:k[8]},y4={background:k[1],content:k[9],border:k[4]},b4={activeBackground:k[3],activeContent:se[5],inactiveContent:k[9],border:k[4]},_4={header:{textDefault:k[9],textHover:k[8],backgroundDefault:k[1]},border:k[4],cell:{textPrimary:k[10],textSecondary:k[9],backgroundDefault:k[2],backgroundHover:k[1]}},x4={textPrimaryDefault:k[10],textPrimaryHover:k[10],textSecondaryDefault:k[8],textSecondaryHover:k[9],iconPrimary:k[10],iconSecondary:k[8]},w4={background:Ee[1],active:Ee[5]},S4={textDefault:k[10],textSelected:Ut.white,textDisabled:k[7],backgroundDefault:k[2],backgroundMiddle:k[3],backgroundSelected:se[3],border:k[4]},k4=k[9];var T4={size:56,inset:12,background:Ut.black,color:Ut.white,border:`2px solid ${se[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};function ae(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var V4={colorPrimary:se[3],colorPrimaryHover:se[4],colorPrimaryMuted:se[0],colorBackground:ae(k[1],.95),colorBackgroundElevated:ae(k[3],.95),colorBackgroundSubtle:ae(k[0],.2),colorSurface:ae(k[4],.8),colorSurfaceHover:ae(k[5],.8),colorText:bt.primary,colorTextSecondary:bt.secondary,colorTextMuted:bt.tertiary,colorTextInverse:k[1],colorBorder:sp.primary,colorBorderSubtle:sp.secondary,colorSuccess:Ee[4],colorSuccessMuted:Ee[0],colorWarning:Je[4],colorWarningMuted:Je[0],colorError:Oe[4],colorErrorMuted:Oe[0],colorInfo:or[4],colorInfoMuted:or[0],colorNotification:se[4],colorNotificationMuted:ae(se[4],.4),glassBackground:ae(k[1],.6),glassBackgroundHover:ae(k[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},U4={colorPrimary:se[3],colorPrimaryHover:se[2],colorPrimaryMuted:ae(se[5],.1),colorBackground:ae(k[12],.95),colorBackgroundElevated:ae(k[11],.95),colorBackgroundSubtle:ae(k[0],.02),colorSurface:ae(k[11],.6),colorSurfaceHover:ae(k[10],.6),colorText:k[1],colorTextSecondary:k[6],colorTextMuted:k[8],colorTextInverse:k[12],colorBorder:ae(k[0],.12),colorBorderSubtle:ae(k[0],.06),colorSuccess:Ee[4],colorSuccessMuted:ae(Ee[4],.12),colorWarning:Je[4],colorWarningMuted:ae(Je[4],.12),colorError:Oe[4],colorErrorMuted:ae(Oe[4],.12),colorInfo:or[4],colorInfoMuted:ae(or[4],.12),colorNotification:se[3],colorNotificationMuted:ae(se[3],.4),glassBackground:ae(k[12],.7),glassBackgroundHover:ae(k[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function CC(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Zy={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:se[3],colorPrimaryHover:se[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",padding:"0"},launcher:{background:Vl.primary.backgroundDefault,backgroundHover:Vl.primary.backgroundHover,color:Vl.primary.icon,size:"56px",shadow:`0 8px 32px ${ae(k[0],.6)}`,borderRadius:"9999px"},tile:{background:ae(k[1],.6),backgroundHover:ae(k[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:bt.primary,textColor:bt.secondary,iconBackground:`linear-gradient(135deg, ${se[3]} 0%, ${se[3]}cc 100%)`,iconShadow:`0 2px 8px ${se[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[1],.6),textColor:bt.primary,titleColor:bt.primary,arrowColor:ae(k[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(k[0],.95),textColor:bt.primary,textSecondaryColor:bt.secondary,border:`1px solid ${k[5]}`,borderRadius:"12px",successColor:Ee[4],warningColor:Je[4],errorColor:Oe[4],iconBackground:ae(se[3],.15),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[4]})`},content:{background:ae(k[3],.8),backgroundHover:ae(k[5],.6),border:`1px solid ${ae(k[5],.5)}`,borderRadius:"8px",textColor:bt.primary,textSecondaryColor:bt.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:ae(k[3],.8),searchColor:bt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},Gy={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:se[3],colorPrimaryHover:se[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.3)",padding:"0"},launcher:{background:se[3],backgroundHover:se[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:ae(k[12],.7),backgroundHover:ae(k[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:k[1],textColor:k[6],iconBackground:`linear-gradient(135deg, ${se[3]} 0%, ${se[3]}cc 100%)`,iconShadow:`0 2px 8px ${se[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[12],.7),textColor:k[1],titleColor:k[1],arrowColor:ae(k[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(k[12],.95),textColor:k[1],textSecondaryColor:k[6],border:`1px solid ${ae(k[0],.12)}`,borderRadius:"12px",successColor:Ee[4],warningColor:Je[4],errorColor:Oe[4],iconBackground:ae(se[3],.1),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[2]})`},content:{background:ae(k[12],.8),backgroundHover:ae(k[11],.6),border:`1px solid ${k[11]}`,borderRadius:"8px",textColor:k[1],textSecondaryColor:k[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:k[12],searchColor:k[1],chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}};function Ky(r){let e=r.mode==="light"?Gy:Zy;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content},mobile:{canvas:{...e.mobile.canvas,...r.mobile?.canvas}}}}function Yy(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?Gy:Zy;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content},mobile:{canvas:{...n.mobile.canvas,...r.mobile?.canvas,...e.mobile?.canvas}}}}var AC=["canvas","launcher","tile","overlay","notification","content"];function Xy(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 AC){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${CC(i)}`]=s)}return e}var Kr,Wn,zn,Cr,Ar,op,Ul,Ui=class{constructor(e,t,n){ye(this,Ar);ye(this,Kr);ye(this,Wn);ye(this,zn);ye(this,Cr);oe(this,Kr,e),oe(this,Wn,t??{}),oe(this,zn,n),oe(this,Cr,we(this,Ar,op).call(this)),e.addController(this)}get config(){return q(this,Cr).config}get mode(){return q(this,Cr).mode}get cssVariables(){return q(this,Cr).cssVariables}hostConnected(){we(this,Ar,Ul).call(this)}hostDisconnected(){}hostUpdated(){we(this,Ar,Ul).call(this)}setThemeConfig(e,t){oe(this,Wn,e),oe(this,zn,t),oe(this,Cr,we(this,Ar,op).call(this)),we(this,Ar,Ul).call(this),q(this,Kr).requestUpdate()}};Kr=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Cr=new WeakMap,Ar=new WeakSet,op=function(){let e=q(this,zn)?Yy(q(this,zn),q(this,Wn)):Ky(q(this,Wn)),t=Xy(e);return{config:e,mode:e.mode,cssVariables:t}},Ul=function(){let e=q(this,Kr).shadowRoot??("renderRoot"in q(this,Kr)?q(this,Kr).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(q(this,Cr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
491
|
+
`}};Pl.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",Pl);function Ol(r,e,t="merge"){return t==="first-match"?bC(r,e):_C(r,e)}function bC(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 Ay([i])}return null}function _C(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:Ay(t)}function Ay(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 Hd=!1;function Ty(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Bd(r){if(Ty()){Hd=!0;return}Hd=r??!1}function xC(){return Ty()?!0:Hd}function G(r,e,t){xC()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function dt(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function Ll(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var Nl=class{constructor(e){this.config=e;this.counters=new Map;this.histograms=new Map;this.windowStartMs=Date.now();this.timer=null;this.pagehideHandler=null;this.runtime=null;this.adapterCleanup=null;this.resource=e.resource,this.flushIntervalMs=e.flushIntervalMs??6e4}bindRuntime(e){this.runtime=e}attachAdapterCleanup(e){this.adapterCleanup=e}increment(e,t=1){this.counters.set(e,(this.counters.get(e)??0)+t)}snapshotCounters(){let e={};for(let[t,n]of this.counters)e[t]=n;return e}recordHistogram(e,t){let n=this.histograms.get(e)??[];n.push(t),this.histograms.set(e,n)}snapshotHistograms(){let e={};for(let[t,n]of this.histograms){if(n.length===0)continue;let i=[...n].sort((s,o)=>s-o);e[t]={count:i.length,p50:Ry(i,.5),p95:Ry(i,.95)}}return e}async flush(){let e=this.snapshotCounters(),t=this.snapshotHistograms();if(!(Object.keys(e).length>0||Object.keys(t).length>0))return;let i=null,s="";try{i=this.runtime?.getSurface()??null}catch{}try{s=this.runtime?.getSessionId()??""}catch{}let o={resource:{...this.resource,sessionId:s,surfaceType:i?.type??"unknown",surfaceHost:i?.host??"unknown",surfaceDevice:i?.device??"unknown",surfaceMode:i?.mode??"unknown"},windowSeconds:Math.max(1,Math.round((Date.now()-this.windowStartMs)/1e3)),windowStartUnixMs:this.windowStartMs,counters:e,histograms:t};this.counters.clear(),this.histograms.clear(),this.windowStartMs=Date.now();try{await this.config.emit(o)}catch{}}start(){this.timer===null&&(this.timer=setInterval(()=>{this.flush()},this.flushIntervalMs),typeof window<"u"&&(this.pagehideHandler=()=>{this.flush()},window.addEventListener("pagehide",this.pagehideHandler)))}stop(){if(this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.pagehideHandler!==null&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pagehideHandler),this.pagehideHandler=null),this.adapterCleanup!==null){try{this.adapterCleanup()}catch{}this.adapterCleanup=null}}};function Ry(r,e){if(r.length===0)return 0;let t=(r.length-1)*e,n=Math.floor(t),i=Math.ceil(t);return n===i?r[n]:r[n]+(r[i]-r[n])*(t-n)}var uo=null;function Vd(r){return uo?.stop(),uo=new Nl(r),uo.start(),uo}function ir(){return uo}var Er=(r,e)=>({key:r,value:{stringValue:e}}),Ud=(r,e)=>({key:r,value:{intValue:Math.round(e)}}),Iy=(r,e)=>({key:r,value:{doubleValue:e}});function wC(r){let{resource:e,counters:t,histograms:n,windowSeconds:i,windowStartUnixMs:s}=r,o=[Er("service.name",e.serviceName),Er("service.version",e.serviceVersion),Er("syntro.posthog_key",e.posthogKey),Er("syntro.session_id",e.sessionId),Er("syntro.surface_type",e.surfaceType),Er("syntro.surface_host",e.surfaceHost),Er("syntro.surface_device",e.surfaceDevice),Er("syntro.surface_mode",e.surfaceMode),Er("syntro.host_origin",e.hostOrigin)],a=[Ud("window_seconds",i)];for(let[u,p]of Object.entries(t))p!==void 0&&a.push(Ud(u,p));for(let[u,p]of Object.entries(n))p!==void 0&&(a.push(Ud(`${u}_count`,p.count)),a.push(Iy(`${u}_p50`,p.p50)),a.push(Iy(`${u}_p95`,p.p95)));let l=`${Date.now()}000000`,c=`${s}000000`;return{resourceLogs:[{resource:{attributes:o},scopeLogs:[{scope:{name:"syntro.sdk.health"},logRecords:[{timeUnixNano:c,observedTimeUnixNano:l,severityText:"INFO",body:{stringValue:"sdk_health_window"},attributes:a}]}]}]}}function jd(r){let e=r.fetchImpl??fetch;return async t=>{let n=JSON.stringify(wC(t)),i=()=>e(r.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0,mode:"cors"});try{let s=await i();if(!s.ok&&s.status>=500)try{await i()}catch{}}catch{try{await i()}catch{}}}}function SC(){if(typeof document>"u")return;let r=document.currentScript;if(r&&r.src)return r.src;try{let e=Array.from(document.scripts);for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.src;if(typeof n=="string"&&(n.includes("runtime-sdk")||n.includes("smart-canvas")))return n}}catch{}}var Wd=SC();function zd(){if(!Wd)return;let r=Wd.lastIndexOf("/");if(r!==-1)return Wd.substring(0,r+1)}var Hy=-1,Ui=r=>{addEventListener("pageshow",(e=>{e.persisted&&(Hy=e.timeStamp,r(e))}),!0)},sr=(r,e,t,n)=>{let i,s;return o=>{e.value>=0&&(o||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(e.value,t),r(e)))}},ep=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},tp=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},po=()=>tp()?.activationStart??0,or=(r,e=-1)=>{let t=tp(),n="navigate";return Hy>=0?n="back-forward-cache":t&&(document.prerendering||po()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},qd=new WeakMap;function rp(r,e){return qd.get(r)||qd.set(r,new e),qd.get(r)}var Gd=class{constructor(){de(this,"t");de(this,"i",0);de(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},ho=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},np=r=>{let e=!1;return()=>{e||(r(),e=!0)}},Vi=-1,By=new Set,$y=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Kd=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of By)e();isFinite(Vi)||(Vi=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",Kd,!0))}},Dl=()=>{if(Vi<0){let r=po();Vi=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??$y(),addEventListener("visibilitychange",Kd,!0),addEventListener("prerenderingchange",Kd,!0),Ui((()=>{setTimeout((()=>{Vi=$y()}))}))}return{get firstHiddenTime(){return Vi},onHidden(r){By.add(r)}}},Hl=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},My=[1800,3e3],ip=(r,e={})=>{Hl((()=>{let t=Dl(),n,i=or("FCP"),s=ho("paint",(o=>{for(let a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime<t.firstHiddenTime&&(i.value=Math.max(a.startTime-po(),0),i.entries.push(a),n(!0)))}));s&&(n=sr(r,i,My,e.reportAllChanges),Ui((o=>{i=or("FCP"),n=sr(r,i,My,e.reportAllChanges),ep((()=>{i.value=performance.now()-o.timeStamp,n(!0)}))})))}))},Py=[.1,.25],Vy=(r,e={})=>{let t=Dl();ip(np((()=>{let n,i=or("CLS",0),s=rp(e,Gd),o=l=>{for(let c of l)s.h(c);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},a=ho("layout-shift",o);a&&(n=sr(r,i,Py,e.reportAllChanges),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ui((()=>{s.i=0,i=or("CLS",0),n=sr(r,i,Py,e.reportAllChanges),ep((()=>n()))})),setTimeout(n))})))},Uy=0,Zd=1/0,Fl=0,kC=r=>{for(let e of r)e.interactionId&&(Zd=Math.min(Zd,e.interactionId),Fl=Math.max(Fl,e.interactionId),Uy=Fl?(Fl-Zd)/7+1:0)},Yd,Oy=()=>Yd?Uy:performance.interactionCount??0,EC=()=>{"interactionCount"in performance||Yd||(Yd=ho("event",kC,{type:"event",buffered:!0,durationThreshold:0}))},Ly=0,Xd=class{constructor(){de(this,"u",[]);de(this,"l",new Map);de(this,"m");de(this,"p")}v(){Ly=Oy(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Oy()-Ly)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},jy=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=np(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},Ny=[200,500],Wy=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=Dl();Hl((()=>{EC();let n,i=or("INP"),s=rp(e,Xd),o=l=>{jy((()=>{for(let u of l)s.h(u);let c=s.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=ho("event",o,{durationThreshold:e.durationThreshold??40});n=sr(r,i,Ny,e.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(a.takeRecords()),n(!0)})),Ui((()=>{s.v(),i=or("INP"),n=sr(r,i,Ny,e.reportAllChanges)})))}))},Jd=class{constructor(){de(this,"m")}h(e){this.m?.(e)}},Fy=[2500,4e3],zy=(r,e={})=>{Hl((()=>{let t=Dl(),n,i=or("LCP"),s=rp(e,Jd),o=l=>{e.reportAllChanges||(l=l.slice(-1));for(let c of l)s.h(c),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-po(),0),i.entries=[c],n())},a=ho("largest-contentful-paint",o);if(a){n=sr(r,i,Fy,e.reportAllChanges);let l=np((()=>{o(a.takeRecords()),a.disconnect(),n(!0)})),c=u=>{u.isTrusted&&(jy(l),removeEventListener(u.type,c,{capture:!0}))};for(let u of["keydown","click","visibilitychange"])addEventListener(u,c,{capture:!0});Ui((u=>{i=or("LCP"),n=sr(r,i,Fy,e.reportAllChanges),ep((()=>{i.value=performance.now()-u.timeStamp,n(!0)}))}))}}))},Dy=[800,1800],Qd=r=>{document.prerendering?Hl((()=>Qd(r))):document.readyState!=="complete"?addEventListener("load",(()=>Qd(r)),!0):setTimeout(r)},qy=(r,e={})=>{let t=or("TTFB"),n=sr(r,t,Dy,e.reportAllChanges);Qd((()=>{let i=tp();i&&(t.value=Math.max(i.responseStart-po(),0),t.entries=[i],n(!0),Ui((()=>{t=or("TTFB",0),n=sr(r,t,Dy,e.reportAllChanges),n(!0)})))}))};var Zy="__syntro_vitals_bound",Bl="__syntro_vitals_current_reporter";function sp(r,e){if(typeof window>"u")return()=>{};let t=window;t[Bl]=r;let n=null,i=e?.attributedScriptUrlPrefix;if(i&&"PerformanceObserver"in window)try{n=new PerformanceObserver(s=>{let o=t[Bl];if(o)for(let a of s.getEntries()){let l=a.attribution;if(!l)continue;l.some(u=>(u.containerSrc??u.name??"").startsWith(i))&&(o.increment("longtasks_self_count"),o.increment("longtasks_self_blocking_ms",Math.round(a.duration)))}}),n.observe({type:"longtask",buffered:!0})}catch{n=null}if(!t[Zy]){t[Zy]=!0;let s=o=>a=>{t[Bl]?.recordHistogram(o,a.value)};zy(s("lcp_ms")),Wy(s("inp_ms")),ip(s("fcp_ms")),qy(s("ttfb_ms")),Vy(o=>{t[Bl]?.recordHistogram("cls_score",o.value)})}return()=>{n?.disconnect()}}var ji="2.8.0-canary.209";var Cr="2.0";var CC=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function AC(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):CC.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 TC(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var Gy="syntro_config_cache",RC=1440*60*1e3;function Ky(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function IC(r,e){if(Ky())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(Gy,JSON.stringify(t))}catch{}}function $C(r){if(!Ky())return null;try{let e=localStorage.getItem(Gy);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>RC?null:t.config}catch{return null}}var Vl=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function MC(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 zn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let h=e.getFeatureValue?.(i,null);if(h&&typeof h=="object")return G("SmartCanvas Config","Resolved config directly from feature flag",h),h}if(e&&(s||o||e.getAllFeatures)){let h=MC(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",h.length,"keys found"),h.length>0){let f=Ol(e,h);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",f?`tiles=${f.tiles?.length}`:"null"),f)return G("SmartCanvas Config","Resolved config from variant flags",f),f}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=Vl({configUri:r,experiments:e,featureKey:t});if(!l)return G("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!AC(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(TC(l)?"include":"omit"),u=performance.now(),p=!1;try{let h=await fetch(l,{credentials:c,headers:{"X-SDK-Version":ji,"X-SDK-Schema-Version":Cr}});if(!h.ok)throw ir()?.increment("flag_fetch_errors"),p=!0,new Error(`SmartCanvas: failed to fetch config (${h.status})`);let f=await h.json(),v=performance.now()-u;return ir()?.increment("flag_fetch_count"),ir()?.recordHistogram("flag_fetch_latency_ms",v),G("SmartCanvas Config","Fetched config from URI",f),a&&IC(f,a),f}catch(h){if(p||ir()?.increment("flag_fetch_errors"),a){let f=$C(a);if(f)return G("SmartCanvas Config","Serving config from offline cache"),f}throw h}};var Ul=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)}},op=r=>new Ul(r);var Wt={white:"#ffffff",black:"#000000"},se={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},k={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},ke={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Qe={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Oe={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},ar={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},fo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},go={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},mo={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var xt={primary:k[10],secondary:k[9],tertiary:k[8]},h4={primary:k[2],secondary:k[0]},ap={primary:k[4],secondary:k[3]},jl={primary:{text:Wt.white,icon:Wt.white,border:se[3],backgroundDefault:se[3],backgroundHover:se[2]},neutral:{text:k[10],textHover:Wt.white,icon:k[10],iconHover:Wt.white,border:k[4],background:k[2]},link:{text:Wt.white,icon:Wt.white,hover:se[5]},error:{text:Oe[5],hover:Oe[6]},success:{text:ke[5],hover:ke[6]}},f4={slateGrey:{content:k[10],pillOutline:k[10],borderPrimary:k[5],borderSecondary:k[5],background:k[3]},brand:{content:se[9],pillOutline:se[9],borderPrimary:se[6],borderSecondary:se[6],background:se[0]},red:{content:Oe[8],pillOutline:Oe[4],borderPrimary:Oe[2],borderSecondary:Oe[2],background:Oe[0]},yellow:{content:Qe[8],pillOutline:Qe[4],borderPrimary:Qe[2],borderSecondary:Qe[2],background:Qe[0]},green:{content:ke[8],pillOutline:ke[4],borderPrimary:ke[2],borderSecondary:ke[2],background:ke[0]},purple:{content:go[8],pillOutline:go[4],borderPrimary:go[2],borderSecondary:go[2],background:go[0]},blue:{content:ar[8],pillOutline:ar[4],borderPrimary:ar[2],borderSecondary:ar[2],background:ar[0]},orange:{content:fo[8],pillOutline:fo[4],borderPrimary:fo[2],borderSecondary:fo[2],background:fo[0]},pink:{content:mo[8],pillOutline:mo[4],borderPrimary:mo[2],borderSecondary:mo[2],background:mo[0]}},g4={green:{content:ke[8],border:ke[2],background:ke[0]},yellow:{content:Qe[8],border:Qe[2],background:Qe[0]},red:{content:Oe[8],border:Oe[2],background:Oe[0]}},m4={green:{content:ke[1],background:ke[9]},yellow:{content:Qe[1],background:Qe[9]},red:{content:Oe[1],background:Oe[9]}},v4={content:k[10],border:k[4],background:k[3]},y4={backgroundDefault:k[2],backgroundHover:k[1],selected:k[3]},b4={background:k[2],icon:k[10],borderDefault:k[4],borderSelected:se[3],textLabel:k[9],textPlaceholder:k[8],textHint:k[8]},_4={backgroundDefault:k[2],backgroundDisabled:k[0],textLabel:k[9],textPlaceholder:k[8],textHint:k[8],textError:Oe[5],iconDefault:k[9],iconPlaceholder:k[10],iconError:Oe[5],borderDefault:k[4],borderSelected:se[3],borderError:Oe[5]},x4={handleDefault:Wt.white,handleDisabled:k[10],off:{backgroundDefault:k[4],backgroundHover:k[5],backgroundDisabled:k[4]},on:{backgroundDefault:ke[3],backgroundHover:ke[2],backgroundDisabled:k[4]}},w4={off:{backgroundDefault:"#00000000",backgroundHover:k[5],backgroundDisabled:k[2],border:k[6]},on:{backgroundDefault:ke[0],backgroundHover:ke[1],backgroundDisabled:k[2],border:ke[3]}},S4={content:k[10],background:k[4]},k4={background:k[4],active:ke[3]},E4={background:k[1],content:k[9],border:k[4]},C4={backgroundDefault:k[1],backgroundHover:k[3],backgroundActive:k[4],border:k[4],contentPrimary:k[10],contentSecondary:k[9],contentTertiary:k[8]},A4={background:k[1],content:k[9],border:k[4]},T4={activeBackground:k[3],activeContent:se[5],inactiveContent:k[9],border:k[4]},R4={header:{textDefault:k[9],textHover:k[8],backgroundDefault:k[1]},border:k[4],cell:{textPrimary:k[10],textSecondary:k[9],backgroundDefault:k[2],backgroundHover:k[1]}},I4={textPrimaryDefault:k[10],textPrimaryHover:k[10],textSecondaryDefault:k[8],textSecondaryHover:k[9],iconPrimary:k[10],iconSecondary:k[8]},$4={background:ke[1],active:ke[5]},M4={textDefault:k[10],textSelected:Wt.white,textDisabled:k[7],backgroundDefault:k[2],backgroundMiddle:k[3],backgroundSelected:se[3],border:k[4]},P4=k[9];var F4={size:56,inset:12,background:Wt.black,color:Wt.white,border:`2px solid ${se[3]}`,shadowOpen:"0 4px 24px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,255,255,0.08)",shadowClosed:"0 4px 24px rgba(0,0,0,0.6)"};function ae(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var Y4={colorPrimary:se[3],colorPrimaryHover:se[4],colorPrimaryMuted:se[0],colorBackground:ae(k[1],.95),colorBackgroundElevated:ae(k[3],.95),colorBackgroundSubtle:ae(k[0],.2),colorSurface:ae(k[4],.8),colorSurfaceHover:ae(k[5],.8),colorText:xt.primary,colorTextSecondary:xt.secondary,colorTextMuted:xt.tertiary,colorTextInverse:k[1],colorBorder:ap.primary,colorBorderSubtle:ap.secondary,colorSuccess:ke[4],colorSuccessMuted:ke[0],colorWarning:Qe[4],colorWarningMuted:Qe[0],colorError:Oe[4],colorErrorMuted:Oe[0],colorInfo:ar[4],colorInfoMuted:ar[0],colorNotification:se[4],colorNotificationMuted:ae(se[4],.4),glassBackground:ae(k[1],.6),glassBackgroundHover:ae(k[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},X4={colorPrimary:se[3],colorPrimaryHover:se[2],colorPrimaryMuted:ae(se[5],.1),colorBackground:ae(k[12],.95),colorBackgroundElevated:ae(k[11],.95),colorBackgroundSubtle:ae(k[0],.02),colorSurface:ae(k[11],.6),colorSurfaceHover:ae(k[10],.6),colorText:k[1],colorTextSecondary:k[6],colorTextMuted:k[8],colorTextInverse:k[12],colorBorder:ae(k[0],.12),colorBorderSubtle:ae(k[0],.06),colorSuccess:ke[4],colorSuccessMuted:ae(ke[4],.12),colorWarning:Qe[4],colorWarningMuted:ae(Qe[4],.12),colorError:Oe[4],colorErrorMuted:ae(Oe[4],.12),colorInfo:ar[4],colorInfoMuted:ae(ar[4],.12),colorNotification:se[3],colorNotificationMuted:ae(se[3],.4),glassBackground:ae(k[12],.7),glassBackgroundHover:ae(k[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function PC(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Yy={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:se[3],colorPrimaryHover:se[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",padding:"0"},launcher:{background:jl.primary.backgroundDefault,backgroundHover:jl.primary.backgroundHover,color:jl.primary.icon,size:"56px",shadow:`0 8px 32px ${ae(k[0],.6)}`,borderRadius:"9999px"},tile:{background:ae(k[1],.6),backgroundHover:ae(k[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:xt.primary,textColor:xt.secondary,iconBackground:`linear-gradient(135deg, ${se[3]} 0%, ${se[3]}cc 100%)`,iconShadow:`0 2px 8px ${se[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[1],.6),textColor:xt.primary,titleColor:xt.primary,arrowColor:ae(k[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(k[0],.95),textColor:xt.primary,textSecondaryColor:xt.secondary,border:`1px solid ${k[5]}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Oe[4],iconBackground:ae(se[3],.15),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[4]})`},content:{background:ae(k[3],.8),backgroundHover:ae(k[5],.6),border:`1px solid ${ae(k[5],.5)}`,borderRadius:"8px",textColor:xt.primary,textSecondaryColor:xt.secondary,itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:ae(k[3],.8),searchColor:xt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},Xy={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:se[3],colorPrimaryHover:se[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:ae(k[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.3)",padding:"0"},launcher:{background:se[3],backgroundHover:se[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:ae(k[12],.7),backgroundHover:ae(k[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:k[1],textColor:k[6],iconBackground:`linear-gradient(135deg, ${se[3]} 0%, ${se[3]}cc 100%)`,iconShadow:`0 2px 8px ${se[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:ae(k[12],.7),textColor:k[1],titleColor:k[1],arrowColor:ae(k[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(k[12],.95),textColor:k[1],textSecondaryColor:k[6],border:`1px solid ${ae(k[0],.12)}`,borderRadius:"12px",successColor:ke[4],warningColor:Qe[4],errorColor:Oe[4],iconBackground:ae(se[3],.1),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[2]})`},content:{background:ae(k[12],.8),backgroundHover:ae(k[11],.6),border:`1px solid ${k[11]}`,borderRadius:"8px",textColor:k[1],textSecondaryColor:k[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:k[12],searchColor:k[1],chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}};function Jy(r){let e=r.mode==="light"?Xy:Yy;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content},mobile:{canvas:{...e.mobile.canvas,...r.mobile?.canvas}}}}function Qy(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?Xy:Yy;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content},mobile:{canvas:{...n.mobile.canvas,...r.mobile?.canvas,...e.mobile?.canvas}}}}var OC=["canvas","launcher","tile","overlay","notification","content"];function eb(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 OC){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${PC(i)}`]=s)}return e}var Yr,qn,Zn,Ar,Tr,lp,Wl,Wi=class{constructor(e,t,n){ve(this,Tr);ve(this,Yr);ve(this,qn);ve(this,Zn);ve(this,Ar);oe(this,Yr,e),oe(this,qn,t??{}),oe(this,Zn,n),oe(this,Ar,_e(this,Tr,lp).call(this)),e.addController(this)}get config(){return Z(this,Ar).config}get mode(){return Z(this,Ar).mode}get cssVariables(){return Z(this,Ar).cssVariables}hostConnected(){_e(this,Tr,Wl).call(this)}hostDisconnected(){}hostUpdated(){_e(this,Tr,Wl).call(this)}setThemeConfig(e,t){oe(this,qn,e),oe(this,Zn,t),oe(this,Ar,_e(this,Tr,lp).call(this)),_e(this,Tr,Wl).call(this),Z(this,Yr).requestUpdate()}};Yr=new WeakMap,qn=new WeakMap,Zn=new WeakMap,Ar=new WeakMap,Tr=new WeakSet,lp=function(){let e=Z(this,Zn)?Qy(Z(this,Zn),Z(this,qn)):Jy(Z(this,qn)),t=eb(e);return{config:e,mode:e.mode,cssVariables:t}},Wl=function(){let e=Z(this,Yr).shadowRoot??("renderRoot"in Z(this,Yr)?Z(this,Yr).renderRoot:null);if(!e||!(e instanceof ShadowRoot))return;let t=e.querySelector("#sc-theme-vars");t||(t=document.createElement("style"),t.id="sc-theme-vars",e.insertBefore(t,e.firstChild));let n=Object.entries(Z(this,Ar).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
492
492
|
`);t.textContent=`:host {
|
|
493
493
|
${n}
|
|
494
|
-
}`};var
|
|
494
|
+
}`};var LC=new Set(["tag_name","$el_text"]);function NC(r){return LC.has(r)||r.startsWith("attr__")}function tb(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function FC(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(NC(i)){let o=n.props?.elements;if(!o||!o.some(l=>tb(s,l[i])))return!1}else if(!tb(s,n.props?.[i]))return!1}return!0}}function rb(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?FC(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function Gn(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"&&rb(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&rb(i.triggerWhen,e)}}var ob="syntro-runtime",nb="smart-canvas",ib=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function sb(r){let e=typeof window<"u"?window.SynOS?.interventionTracker:null;if(e)for(let t of r)e.trackTriggered(t.id,t.widget??"unknown")}var bt,zi,lr,Rr,zt,Yn,vo,Xn,Jn,yo,bo,_o,Qn,ei,Xr,Jr,Qr,ti,qi,xo,we,ab,lb,Zi,cp,cb,up,dp,pp,hp,ub,fp,zl,Kn=class extends ye{constructor(){super();ve(this,we);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:"/";ve(this,bt);ve(this,zi,null);ve(this,lr,null);ve(this,Rr,null);ve(this,zt,null);ve(this,Yn);ve(this,vo,0);ve(this,Xn,null);ve(this,Jn,"[]");ve(this,yo,"[]");ve(this,bo,"null");ve(this,_o,"null");ve(this,Qn,null);ve(this,ei,null);ve(this,Xr,null);ve(this,Jr,null);ve(this,Qr,null);ve(this,ti,()=>{this._pageUrl=window.location.href});ve(this,qi);ve(this,xo);ve(this,Zi,0);ve(this,zl,t=>{Z(this,bt).toggle()});oe(this,bt,op()),oe(this,Yn,!1),oe(this,qi,new Wi(this)),oe(this,xo,new Ti(this,{context:ob,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),oe(this,zi,Z(this,bt).subscribe(t=>{this._isOpen=t.open})),this._isOpen=Z(this,bt).getState().open,oe(this,lr,document.createElement("div")),Z(this,lr).id="overlayContainer",Object.assign(Z(this,lr).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(Z(this,lr)),oe(this,Rr,document.createElement("div")),Z(this,Rr).id="portalRoot",this.shadowRoot.appendChild(Z(this,Rr)),_e(this,we,up).call(this),_e(this,we,fp).call(this),_e(this,we,pp).call(this)}disconnectedCallback(){var t,n,i,s,o;super.disconnectedCallback(),(t=Z(this,zi))==null||t.call(this),oe(this,zi,null),(n=Z(this,ei))==null||n.call(this),oe(this,ei,null),(i=Z(this,Xr))==null||i.call(this),oe(this,Xr,null),(s=Z(this,Jr))==null||s.call(this),oe(this,Jr,null),(o=Z(this,Qr))==null||o.call(this),oe(this,Qr,null),_e(this,we,dp).call(this),Z(this,zt)&&(Z(this,zt).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),oe(this,zt,null)),Z(this,lr)?.remove(),oe(this,lr,null),Z(this,Rr)?.remove(),oe(this,Rr,null)}updated(t){var i;t.has("runtime")&&(Z(this,xo).setValue(this.runtime??null),_e(this,we,ub).call(this),_e(this,we,pp).call(this),_e(this,we,fp).call(this),_e(this,we,dp).call(this),_e(this,we,up).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&&(_e(this,we,ab).call(this),(i=Z(this,ei))==null||i.call(this),this.experiments?.onFeaturesChanged&&oe(this,ei,this.experiments.onFeaturesChanged(()=>this._loadConfig({silent:!0})))),(n||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&Z(this,qi).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&_e(this,we,cb).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&Z(this,bt).getState().open&&Z(this,bt).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(oe(this,zt,this.initialBatchHandle),oe(this,Yn,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,oe(this,Jn,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error,n=this._isLoading||t;if(this._displayMode==="inline")return n?L`
|
|
495
495
|
<syntro-inline-shell
|
|
496
496
|
.tiles=${this._tiles}
|
|
497
497
|
?isLoading=${this._isLoading}
|
|
498
498
|
.error=${this._error}
|
|
499
499
|
.runtimeRef=${this.runtime??null}
|
|
500
500
|
></syntro-inline-shell>
|
|
501
|
-
`:
|
|
501
|
+
`:J;let i=(Z(this,Xn)?.tiles?.length??0)>0,s=this._launcher?.enabled===!0;return!n&&!i&&!s?J:L`
|
|
502
502
|
<syntro-canvas-overlay
|
|
503
503
|
.isOpen=${this._isOpen}
|
|
504
504
|
.tiles=${this._tiles}
|
|
@@ -508,11 +508,11 @@ ${n}
|
|
|
508
508
|
.displayMode=${this._displayMode}
|
|
509
509
|
.runtimeRef=${this.runtime??null}
|
|
510
510
|
.telemetry=${this.telemetry??null}
|
|
511
|
-
.themeConfig=${
|
|
511
|
+
.themeConfig=${Z(this,qi).config}
|
|
512
512
|
?launcherAnimate=${!!this._launcher?.animate}
|
|
513
|
-
@canvas-toggle=${
|
|
513
|
+
@canvas-toggle=${Z(this,zl)}
|
|
514
514
|
></syntro-canvas-overlay>
|
|
515
|
-
`}open(){this._displayMode!=="inline"&&
|
|
515
|
+
`}open(){this._displayMode!=="inline"&&Z(this,bt).setOpen(!0)}close(){this._displayMode!=="inline"&&Z(this,bt).setOpen(!1)}toggle(){this._displayMode!=="inline"&&Z(this,bt).toggle()}setOverrideFetcher(t){this.fetcher=t}getMountNode(){return this.renderRoot}getController(){return Z(this,bt)}getPortalRoot(){return Z(this,Rr)}getOverlayContainer(){return Z(this,lr)}getShadowRoot(){return this.shadowRoot}previewNotification(t){this.shadowRoot?.querySelector("syntro-canvas-overlay")?.previewNotification?.(t)}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(!Z(this,Qn))return;let n=++Lu(this,Zi)._;try{t||(this._isLoading=!0),this._error=void 0;let i=await Z(this,Qn).call(this);if(n!==Z(this,Zi))return;G("SmartCanvas Config","Raw config response",i);let s=Object.keys(i).length===0;oe(this,Xn,s?null:i);let o=i.tiles||[];if(o.length>0&&this.runtime?.accumulator&&Gn(o,this.runtime.accumulator,i.actions),this.runtime){if(o=await this.runtime.filterTiles(o),n!==Z(this,Zi))return;this.experiments&&(o=o.filter(v=>this.experiments.shouldRenderRectangle(v)))}else this.experiments&&(o=o.filter(v=>this.experiments.shouldRenderRectangle(v)));sb(o),G("SmartCanvas Config",`Tile count after filtering: ${o.length}`);let a=i.actions||[],l=JSON.stringify(a),c=l!==Z(this,Jn);c&&oe(this,Jn,l);let u=ib(o),p=JSON.stringify(u);p!==Z(this,yo)&&(oe(this,yo,p),this._tiles=u),c&&(this._configActions=a),t||(this._isLoading=!1);let h=JSON.stringify(i.theme??null);h!==Z(this,bo)&&(oe(this,bo,h),this._theme=i.theme);let f=JSON.stringify(i.launcher??null);f!==Z(this,_o)&&(oe(this,_o,f),this._launcher=i.launcher),i.canvasTitle!==this._canvasTitle&&(this._canvasTitle=i.canvasTitle),_e(this,we,hp).call(this)}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}}};bt=new WeakMap,zi=new WeakMap,lr=new WeakMap,Rr=new WeakMap,zt=new WeakMap,Yn=new WeakMap,vo=new WeakMap,Xn=new WeakMap,Jn=new WeakMap,yo=new WeakMap,bo=new WeakMap,_o=new WeakMap,Qn=new WeakMap,ei=new WeakMap,Xr=new WeakMap,Jr=new WeakMap,Qr=new WeakMap,ti=new WeakMap,qi=new WeakMap,xo=new WeakMap,we=new WeakSet,ab=function(){if(this.fetcher)oe(this,Qn,this.fetcher);else{let t=_e(this,we,lb).call(this);oe(this,Qn,zn(t))}},lb=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},Zi=new WeakMap,cp=async function(){let t=Z(this,Xn);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))),sb(n),this._tiles=ib(n)},cb=async function(){if(!this.runtime?.actions||Z(this,Yn)&&(oe(this,Yn,!1),JSON.stringify(this._configActions)===Z(this,Jn)))return;let t=++Lu(this,vo)._,n=()=>t!==Z(this,vo);if(Z(this,zt)){try{await Z(this,zt).revertAll()}catch(i){console.error("[SmartCanvasElementLit] Failed to revert actions:",i)}oe(this,zt,null)}if(!n()&&this._configActions.length>0)try{let i=await this.runtime.actions.applyBatch(this._configActions);n()?await i.revertAll():oe(this,zt,i)}catch(i){n()||console.error("[SmartCanvasElementLit] Failed to apply actions:",i)}},up=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",Z(this,ti)),window.addEventListener("hashchange",Z(this,ti)))},dp=function(){typeof window>"u"||(window.removeEventListener("popstate",Z(this,ti)),window.removeEventListener("hashchange",Z(this,ti)))},pp=function(){this.runtime&&(this.runtime.accumulator&&oe(this,Xr,this.runtime.accumulator.subscribe(()=>{_e(this,we,cp).call(this)})),this.runtime.context&&oe(this,Jr,this.runtime.context.subscribe(t=>{let n=t.page?.url;n&&n!==this._pageUrl&&(this._pageUrl=n),_e(this,we,hp).call(this),_e(this,we,cp).call(this)})))},hp=function(){let t=this.runtime?.context.get()?.surface?.mode,n=Z(this,Xn)?.displayMode??"standard",i=t==="agent"?"inline":n;i!==this._displayMode&&(this._displayMode=i)},ub=function(){var t,n;(t=Z(this,Xr))==null||t.call(this),oe(this,Xr,null),(n=Z(this,Jr))==null||n.call(this),oe(this,Jr,null)},fp=function(){var t;(t=Z(this,Qr))==null||t.call(this),oe(this,Qr,null),this.runtime&&oe(this,Qr,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>{this._displayMode!=="inline"&&Z(this,bt).setOpen(!0)}))},zl=new WeakMap,Kn.shadowRootOptions={mode:"open",delegatesFocus:!0},Kn.styles=bn`
|
|
516
516
|
:host {
|
|
517
517
|
font: inherit;
|
|
518
518
|
color: inherit;
|
|
@@ -531,25 +531,25 @@ ${n}
|
|
|
531
531
|
*::after {
|
|
532
532
|
box-sizing: border-box;
|
|
533
533
|
}
|
|
534
|
-
`,
|
|
535
|
-
<div data-shadow-canvas-id="overlay-root" style=${
|
|
536
|
-
<div style=${
|
|
537
|
-
<div data-shadow-canvas-id="overlay-container" style=${
|
|
534
|
+
`,Kn.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 wo=()=>{typeof window>"u"||customElements.get(nb)||customElements.define(nb,Kn)};var ql=class extends ye{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(o=>o instanceof HTMLElement&&o.closest?.('[data-shadow-canvas-id="overlay-launcher"]')!=null)||n.some(o=>o instanceof HTMLElement&&(o.closest?.("[data-syntro-editor-panel]")!=null||o.closest?.("[data-syntro-tool-panel]")!=null||o.closest?.("[data-syntro-fab]")!=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 L`
|
|
535
|
+
<div data-shadow-canvas-id="overlay-root" style=${A(f)}>
|
|
536
|
+
<div style=${A(h)}>
|
|
537
|
+
<div data-shadow-canvas-id="overlay-container" style=${A(p)}>
|
|
538
538
|
|
|
539
|
-
${t&&this.canvasTitle?
|
|
540
|
-
<header style=${
|
|
541
|
-
<p style=${
|
|
539
|
+
${t&&this.canvasTitle?L`
|
|
540
|
+
<header style=${A({color:"white",padding:"1.5rem 1.5rem 0"})}>
|
|
541
|
+
<p style=${A({margin:"0",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.5em",color:"var(--sc-notification-text-secondary-color)"})}>
|
|
542
542
|
${this.canvasTitle}
|
|
543
543
|
</p>
|
|
544
|
-
</header>`:
|
|
544
|
+
</header>`:J}
|
|
545
545
|
|
|
546
|
-
<div style=${
|
|
547
|
-
${this.isLoading?
|
|
546
|
+
<div style=${A(v)}>
|
|
547
|
+
${this.isLoading?L`<div style=${A({color:"var(--sc-overlay-text-color)",padding:t?"1rem":"0"})}>Loading...</div>`:this.error?L`<div style=${A({color:"var(--sc-notification-error-color)",padding:t?"1rem":"0"})}>Failed to load: ${this.error}</div>`:t?this.tiles.length>0?L`<syntro-tile-card
|
|
548
548
|
.config=${this.tiles[0]}
|
|
549
549
|
.surface=${"overlay"}
|
|
550
550
|
.runtimeRef=${this.runtimeRef}
|
|
551
|
-
style=${
|
|
552
|
-
></syntro-tile-card>`:
|
|
551
|
+
style=${A({width:"100%",height:"100%"})}
|
|
552
|
+
></syntro-tile-card>`:J:L`<syntro-tile-stack
|
|
553
553
|
.tiles=${this.tiles}
|
|
554
554
|
.surface=${"overlay"}
|
|
555
555
|
.runtimeRef=${this.runtimeRef}
|
|
@@ -559,10 +559,10 @@ ${n}
|
|
|
559
559
|
</div>
|
|
560
560
|
|
|
561
561
|
<!-- Flex spacer -->
|
|
562
|
-
<div style=${
|
|
562
|
+
<div style=${A({flex:"1 1 auto"})}></div>
|
|
563
563
|
</div>
|
|
564
564
|
</div>
|
|
565
|
-
`}};
|
|
565
|
+
`}};ql.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",ql);var DC="#6a59ce",HC="#887ad8",BC="#ffffff",Zl=class extends ye{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=DC;this.colorPrimaryHover=HC;this.launcherConfig={};this.hasActiveTiles=!0;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=`
|
|
566
566
|
@keyframes syntro-launcher-pulse {
|
|
567
567
|
0%, 100% {
|
|
568
568
|
box-shadow: 0 20px 45px rgba(0,0,0,0.35), 0 0 0 0 ${this.colorPrimary}66;
|
|
@@ -595,12 +595,12 @@ ${n}
|
|
|
595
595
|
.syntro-badge-ping { animation: syntro-badge-ping 1.5s cubic-bezier(0,0,0.2,1) infinite; }
|
|
596
596
|
.syntro-badge-glow { animation: syntro-badge-glow 2s ease-in-out infinite; }
|
|
597
597
|
.syntro-badge-bounce { animation: syntro-badge-bounce 2s ease-in-out infinite; }
|
|
598
|
-
`,n=this.getRootNode(),i=n instanceof ShadowRoot?n:n instanceof Document?n.head:null;i&&(this._styleEl||(this._styleEl=document.createElement("style"),this._styleEl.id="syntro-launcher-styles",i.appendChild(this._styleEl)),this._styleEl.textContent=t)}render(){let t=this.position==="right",i={position:"fixed",...this._launcherPos?{top:`${this._launcherPos.y}px`,left:`${this._launcherPos.x}px`}:{bottom:"calc(2.5rem + env(safe-area-inset-bottom, 0px))",right:t?"2.5rem":void 0,left:t?void 0:"2.5rem"},pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:"var(--sc-launcher-size, 56px)",height:"var(--sc-launcher-size, 56px)",borderRadius:"var(--sc-launcher-border-radius, 9999px)",color:"var(--sc-launcher-color)",boxShadow:"var(--sc-launcher-shadow)",transition:this._drag?"none":"transform 0.2s ease, opacity 0.3s ease, background-color 0.2s ease",outline:"none",padding:"0",border:"none",backgroundColor:"var(--sc-launcher-background)",cursor:this._drag?.dragged?"grabbing":"pointer",touchAction:"none",opacity:!this.hasActiveTiles&&!this.isOpen?"0.3":void 0},s=this.launcherAnimate&&!this.isOpen?"syntro-launcher-animate":"",o=!this.isOpen&&this.notificationCount>0;return
|
|
598
|
+
`,n=this.getRootNode(),i=n instanceof ShadowRoot?n:n instanceof Document?n.head:null;i&&(this._styleEl||(this._styleEl=document.createElement("style"),this._styleEl.id="syntro-launcher-styles",i.appendChild(this._styleEl)),this._styleEl.textContent=t)}render(){let t=this.position==="right",i={position:"fixed",...this._launcherPos?{top:`${this._launcherPos.y}px`,left:`${this._launcherPos.x}px`}:{bottom:"calc(2.5rem + env(safe-area-inset-bottom, 0px))",right:t?"2.5rem":void 0,left:t?void 0:"2.5rem"},pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:"var(--sc-launcher-size, 56px)",height:"var(--sc-launcher-size, 56px)",borderRadius:"var(--sc-launcher-border-radius, 9999px)",color:"var(--sc-launcher-color)",boxShadow:"var(--sc-launcher-shadow)",transition:this._drag?"none":"transform 0.2s ease, opacity 0.3s ease, background-color 0.2s ease",outline:"none",padding:"0",border:"none",backgroundColor:"var(--sc-launcher-background)",cursor:this._drag?.dragged?"grabbing":"pointer",touchAction:"none",opacity:!this.hasActiveTiles&&!this.isOpen?"0.3":void 0},s=this.launcherAnimate&&!this.isOpen?"syntro-launcher-animate":"",o=!this.isOpen&&this.notificationCount>0;return L`
|
|
599
599
|
<button
|
|
600
600
|
type="button"
|
|
601
601
|
aria-label="Toggle shadow canvas"
|
|
602
602
|
class=${s}
|
|
603
|
-
style=${
|
|
603
|
+
style=${A(i)}
|
|
604
604
|
@pointerdown=${this._onPointerDown}
|
|
605
605
|
@pointermove=${this._onPointerMove}
|
|
606
606
|
@pointerup=${this._onPointerUp}
|
|
@@ -608,9 +608,9 @@ ${n}
|
|
|
608
608
|
@mouseleave=${this._onMouseLeave}
|
|
609
609
|
>
|
|
610
610
|
${this._renderIcon()}
|
|
611
|
-
${o?this._renderBadge():
|
|
611
|
+
${o?this._renderBadge():J}
|
|
612
612
|
</button>
|
|
613
|
-
`}_renderIcon(){let t="transition: transform 200ms ease;";return this.isOpen?
|
|
613
|
+
`}_renderIcon(){let t="transition: transform 200ms ease;";return this.isOpen?L`
|
|
614
614
|
<svg
|
|
615
615
|
width="24" height="24" viewBox="0 0 24 24"
|
|
616
616
|
fill="none" stroke="currentColor"
|
|
@@ -621,14 +621,14 @@ ${n}
|
|
|
621
621
|
<path d="M18 6L6 18" />
|
|
622
622
|
<path d="M6 6l12 12" />
|
|
623
623
|
</svg>
|
|
624
|
-
`:this.launcherIcon?
|
|
624
|
+
`:this.launcherIcon?L`
|
|
625
625
|
<img
|
|
626
626
|
src=${this.launcherIcon}
|
|
627
627
|
alt=""
|
|
628
628
|
aria-hidden="true"
|
|
629
|
-
style=${
|
|
629
|
+
style=${A({width:"60%",height:"60%",objectFit:"contain",pointerEvents:"none"})}
|
|
630
630
|
/>
|
|
631
|
-
`:
|
|
631
|
+
`:L`
|
|
632
632
|
<svg
|
|
633
633
|
width="24" height="24" viewBox="0 0 24 24"
|
|
634
634
|
fill="none" stroke="currentColor"
|
|
@@ -642,28 +642,28 @@ ${n}
|
|
|
642
642
|
<path d="M19 17v4" />
|
|
643
643
|
<path d="M17 19h4" />
|
|
644
644
|
</svg>
|
|
645
|
-
`}_renderBadge(){let t=this.notificationCount,n=t>99?"99+":String(t);return
|
|
646
|
-
<div style=${
|
|
645
|
+
`}_renderBadge(){let t=this.notificationCount,n=t>99?"99+":String(t);return L`
|
|
646
|
+
<div style=${A({position:"absolute",top:"-2px",right:"-2px",pointerEvents:"none"})}>
|
|
647
647
|
<!-- Layer 1: Expanding ping ring -->
|
|
648
648
|
<span
|
|
649
649
|
class="syntro-badge-ping"
|
|
650
|
-
style=${
|
|
650
|
+
style=${A({position:"absolute",inset:"0",borderRadius:"9999px",background:`${this.colorPrimaryHover}66`})}
|
|
651
651
|
></span>
|
|
652
652
|
<!-- Layer 2: Glow pulse -->
|
|
653
653
|
<span
|
|
654
654
|
class="syntro-badge-glow"
|
|
655
|
-
style=${
|
|
655
|
+
style=${A({position:"absolute",inset:"-4px",borderRadius:"9999px"})}
|
|
656
656
|
></span>
|
|
657
657
|
<!-- Layer 3: Bouncing count badge -->
|
|
658
658
|
<span
|
|
659
659
|
class="syntro-badge-bounce"
|
|
660
|
-
style=${
|
|
660
|
+
style=${A({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:BC,fontSize:"11px",fontWeight:"700"})}
|
|
661
661
|
>${n}</span>
|
|
662
662
|
</div>
|
|
663
|
-
`}};
|
|
663
|
+
`}};Zl.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},hasActiveTiles:{type:Boolean},_launcherPos:{state:!0},_hovered:{state:!0}};customElements.define("syntro-launcher",Zl);var So=class extends ye{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=A({transform:`translateX(-${this._index*100}%)`,width:`${this._ordered.length*100}%`}),n=A({width:`${100/this._ordered.length}%`});return L`
|
|
664
664
|
<div class="wheel-root" data-shadow-canvas-id="wheel">
|
|
665
665
|
<div class="slide-track" style=${t}>
|
|
666
|
-
${this._ordered.map(i=>
|
|
666
|
+
${this._ordered.map(i=>L`
|
|
667
667
|
<div class="slide-item" style=${n}>
|
|
668
668
|
<syntro-tile-card
|
|
669
669
|
.config=${i}
|
|
@@ -676,11 +676,11 @@ ${n}
|
|
|
676
676
|
</div>
|
|
677
677
|
|
|
678
678
|
<div class="dot-row">
|
|
679
|
-
${this._ordered.map((i,s)=>
|
|
679
|
+
${this._ordered.map((i,s)=>L`
|
|
680
680
|
<button
|
|
681
681
|
type="button"
|
|
682
682
|
class="dot"
|
|
683
|
-
style=${
|
|
683
|
+
style=${A({background:s===this._index?"var(--sc-color-primary)":"var(--sc-tile-text-color)"})}
|
|
684
684
|
aria-label="Go to tile ${s+1}"
|
|
685
685
|
aria-pressed=${s===this._index?"true":"false"}
|
|
686
686
|
@click=${()=>this._goTo(s)}
|
|
@@ -688,7 +688,7 @@ ${n}
|
|
|
688
688
|
`)}
|
|
689
689
|
</div>
|
|
690
690
|
</div>
|
|
691
|
-
`}};So.styles=
|
|
691
|
+
`}};So.styles=bn`
|
|
692
692
|
:host {
|
|
693
693
|
display: block;
|
|
694
694
|
}
|
|
@@ -728,23 +728,23 @@ ${n}
|
|
|
728
728
|
cursor: pointer;
|
|
729
729
|
padding: 0;
|
|
730
730
|
}
|
|
731
|
-
`,So.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",So);function
|
|
731
|
+
`,So.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",So);function VC(r,e){let t=oo(r,{size:e});return t||`<span style="line-height:1;">${r}</span>`}var $t,db,pb,hb,fb,gb,ko=class extends ye{constructor(){super(...arguments);ve(this,$t);this.notifications=[];this.position="right"}render(){if(this.notifications.length===0)return L``;let t=A({position:"fixed",bottom:"6rem",[this.position==="right"?"right":"left"]:"2.5rem",display:"flex",flexDirection:"column",gap:"8px",zIndex:"2147483648",pointerEvents:"auto",width:"280px"});return L`
|
|
732
732
|
<div
|
|
733
733
|
data-testid="notification-toast-stack"
|
|
734
734
|
style=${t}
|
|
735
735
|
>
|
|
736
|
-
${this.notifications.map(n=>
|
|
736
|
+
${this.notifications.map(n=>_e(this,$t,gb).call(this,n))}
|
|
737
737
|
</div>
|
|
738
|
-
`}}
|
|
738
|
+
`}};$t=new WeakSet,db=function(t,n){n.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},pb=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},hb=function(t){let n=t.currentTarget;n.style.transform="translateY(-1px)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},fb=function(t){let n=t.currentTarget;n.style.transform="translateY(0)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},gb=function(t){let n=A({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=A({display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px"}),s=A({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=A({flex:"1",minWidth:"0"}),a=A({fontSize:"13px",fontWeight:"600",color:"var(--sc-notification-text-color)",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),l=A({fontSize:"12px",color:"var(--sc-notification-text-secondary-color)",lineHeight:"1.3",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),c=A({background:"none",border:"none",color:"var(--sc-notification-text-secondary-color)",cursor:"pointer",padding:"2px",fontSize:"14px",lineHeight:"1",flexShrink:"0"}),u=A({height:"2px",background:"rgba(0, 0, 0, 0.08)"}),p=A({height:"100%",background:"var(--sc-notification-progress-gradient)",animationDuration:`${t.ttl}ms`}),h=VC(t.icon??"\u{1F514}",14);return L`
|
|
739
739
|
<div
|
|
740
740
|
class="syntro-toast-enter"
|
|
741
741
|
style=${n}
|
|
742
|
-
@mouseenter=${
|
|
743
|
-
@mouseleave=${
|
|
742
|
+
@mouseenter=${_e(this,$t,hb)}
|
|
743
|
+
@mouseleave=${_e(this,$t,fb)}
|
|
744
744
|
>
|
|
745
745
|
<div
|
|
746
746
|
style=${i}
|
|
747
|
-
@click=${()=>
|
|
747
|
+
@click=${()=>_e(this,$t,pb).call(this,t)}
|
|
748
748
|
>
|
|
749
749
|
<div
|
|
750
750
|
style=${s}
|
|
@@ -753,14 +753,14 @@ ${n}
|
|
|
753
753
|
|
|
754
754
|
<div style=${o}>
|
|
755
755
|
<div style=${a}>${t.title}</div>
|
|
756
|
-
${t.body?
|
|
756
|
+
${t.body?L`<div style=${l}>${t.body}</div>`:""}
|
|
757
757
|
</div>
|
|
758
758
|
|
|
759
759
|
<button
|
|
760
760
|
type="button"
|
|
761
761
|
aria-label="Dismiss notification"
|
|
762
762
|
style=${c}
|
|
763
|
-
@click=${f=>
|
|
763
|
+
@click=${f=>_e(this,$t,db).call(this,t.id,f)}
|
|
764
764
|
>×</button>
|
|
765
765
|
</div>
|
|
766
766
|
|
|
@@ -771,7 +771,7 @@ ${n}
|
|
|
771
771
|
></div>
|
|
772
772
|
</div>
|
|
773
773
|
</div>
|
|
774
|
-
`},ko.properties={notifications:{attribute:!1},position:{type:String}},ko.styles=
|
|
774
|
+
`},ko.properties={notifications:{attribute:!1},position:{type:String}},ko.styles=bn`
|
|
775
775
|
@keyframes syntro-toast-slide-in {
|
|
776
776
|
from { opacity: 0; transform: translateY(12px); }
|
|
777
777
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -789,15 +789,15 @@ ${n}
|
|
|
789
789
|
.syntro-toast-progress.paused {
|
|
790
790
|
animation-play-state: paused;
|
|
791
791
|
}
|
|
792
|
-
`;customElements.define("syntro-toast-stack",ko);var hp=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{}}}},fp=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{}}}},gp=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 Eo=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of Ou)this.registerCore(e,t);for(let{kind:e,executor:t}of td)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",hp),this.registerCore("core:parallel",fp),this.registerCore("core:wait",gp)}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)}},lr=new Eo;function hb(r){return lr.get(r)}function ql(r){return lr.has(r)}function mp(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 vp(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 yp(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>Zl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${Zl}`,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 bp(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function _p(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(Ip.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 xp(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 wp(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>Gl&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${Gl}`,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 Sp(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 kp(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 Ep(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=Wt(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 Cp(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=Wt(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 Ap(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 Tp(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 Rp(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=Wt(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 Ip=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),Zl=5e4,Gl=50;function Wt(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(!ql(n)&&n!=="core:mountWidget"){let i=lr.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":Rr(r,e,t);break;case"overlays:badge":Rr(r,e,t),mp(r,e,t);break;case"overlays:tooltip":Rr(r,e,t),vp(r,e,t);break;case"overlays:modal":Tp(r,e,t);break;case"content:insertHtml":Rr(r,e,t),yp(r,e,t);break;case"content:setText":Rr(r,e,t),bp(r,e,t);break;case"content:setAttr":Rr(r,e,t),_p(r,e,t);break;case"content:addClass":case"content:removeClass":Rr(r,e,t),xp(r,e,t);break;case"content:setStyle":Rr(r,e,t),wp(r,e,t);break;case"core:mountWidget":Sp(r,e,t);break;case"core:wait":kp(r,e,t);break;case"core:sequence":Ep(r,e,t);break;case"core:parallel":Cp(r,e,t);break;case"overlays:tour":Rp(r,e,t);break;case"navigation:navigate":Ap(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function Rr(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 Co(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=Wt(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 LC=0;function Kl(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=lr,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++LC}`}function f(_,C){t&&t.publish(_,C)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(_,C)=>t.subscribe({names:[_]},I=>C(I.props)):void 0,subscribeNavigation:l}}async function g(_,C){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let I=n.mount(_.slot,{type:"widget",widgetId:_.widget.widgetId,config:_.widget.props},{priority:_.widget.priority});return C.publishEvent("action.applied",{id:C.generateId(),kind:"core:mountWidget",slot:_.slot,widgetId:_.widget.widgetId}),{cleanup:()=>{I.unmount()},updateFn:R=>{if("widget"in R&&R.widget){let P=R.widget;P.props&&I.update({type:"widget",widgetId:_.widget.widgetId,config:P.props})}}}}async function m(_,C){if(_.kind==="core:mountWidget")return g(_,C);let I=a.get(_.kind);if(!I){let R="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${_.kind}".`,`Registered: [${R}]`),new Error(`No executor for action kind: ${_.kind}`)}return I(_,C)}function y(_,C,I,R){if(!c)return;let P=[],Y=!1,F=async()=>{if(Y)return;let L=u.get(_);if(L){Y=!0;try{let K=c.evaluateSync(I).value;if(L.state==="applied"&&!K){try{await L.cleanup()}catch(le){console.error(`[ActionEngine] Error reverting conditional action ${_}:`,le)}L.state="deferred",L.cleanup=()=>{},L.updateFn=void 0,f("action.deferred",{id:_,kind:C.kind})}else if(L.state==="deferred"&&K)try{let le=v(),j=await m(C,le);L.state="applied",L.cleanup=j.cleanup,L.updateFn=j.updateFn,L.appliedTs=Date.now()}catch(le){console.error(`[ActionEngine] Error applying deferred action ${_}:`,le),L.state="failed"}}finally{Y=!1}}};c.context&&P.push(c.context.subscribe(F)),c.accumulator&&P.push(c.accumulator.subscribe(F)),c.sessionMetrics&&P.push(c.sessionMetrics.subscribe(F)),c.events&&P.push(c.events.subscribe(F)),p.set(_,P)}async function x(_){let C=Wt(_);if(!C.valid){let G=C.errors.map(K=>K.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${_?.kind}":`,G,_),new Error(`Action validation failed: ${G}`)}let I=h(),R=_.triggerWhen;if(R&&c&&!c.evaluateSync(R).value){let K={id:I,action:_,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set(I,K);let le={id:I,action:_,async revert(){let j=u.get(I);if(!j)return;let te=p.get(I);if(te){for(let De of te)De();p.delete(I)}j.state="reverted",u.delete(I)},isApplied(){return u.get(I)?.state==="applied"},async update(j){let te=u.get(I);if(!te||te.state!=="applied")throw new Error("Cannot update action that is not applied");if(te.updateFn)await te.updateFn(j);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get(I)?.state??"reverted"}};return y(I,_,R,le),le}let P=v(),Y=await m(_,P),F={id:I,action:_,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:Y.cleanup,updateFn:Y.updateFn};u.set(I,F);let L={id:I,action:_,async revert(){let G=u.get(I);if(!G||G.state!=="applied")return;let K=p.get(I);if(K){for(let le of K)le();p.delete(I)}try{await G.cleanup(),G.state="reverted",f("action.reverted",{id:I,kind:_.kind})}catch(le){console.warn(`[ActionEngine] Cleanup error for ${_.kind} (${I}), ignoring:`,le),G.state="reverted",f("action.reverted",{id:I,kind:_.kind})}finally{u.delete(I)}},isApplied(){return u.get(I)?.state==="applied"},async update(G){let K=u.get(I);if(!K||K.state!=="applied")throw new Error("Cannot update action that is not applied");if(K.updateFn)await K.updateFn(G);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get(I)?.state??"reverted"}};return R&&c&&y(I,_,R,L),L}async function S(_){console.log(`[ActionEngine] applyBatch: ${_.length} action(s)`,_.map(F=>F.kind).join(", "));let C=Co(_);if(!C.valid){let F=C.errors.map(L=>L.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${_.length} action(s):`,F,`
|
|
793
|
-
Actions:`,_.map((
|
|
794
|
-
`)),new Error(`Batch validation failed: ${F}`)}let I=h(),R=[],P=[];try{let F=await Promise.allSettled(_.map(G=>x(G))),L=[];for(let G of F)G.status==="fulfilled"?(R.push(G.value),P.push(G.value)):L.push(G.reason instanceof Error?G.reason:new Error(String(G.reason)));if(L.length>0&&P.length===0)throw L[0];L.length>0&&console.warn(`[ActionEngine] ${L.length}/${_.length} action(s) failed in batch:`,L.map(G=>G.message).join("; "))}catch(F){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${P.length}. Rolling back...`,F);for(let L of P)try{await L.revert()}catch{}throw F}return{id:I,handles:R,async revertAll(){for(let F=R.length-1;F>=0;F--)try{await R[F].revert()}catch(L){console.error(`[ActionEngine] Error reverting action ${R[F].id}:`,L)}},isApplied(){return R.every(F=>F.isApplied())}}}function b(_){return Wt(_)}function w(){return Array.from(u.values()).map(_=>({id:_.id,action:_.action,adaptiveId:_.adaptiveId,appliedTs:_.appliedTs,state:_.state}))}async function A(){for(let C of p.values())for(let I of C)try{I()}catch{}p.clear();let _=[];for(let C of u.values())if(C.state==="applied")try{let I=C.cleanup();I&&typeof I.then=="function"&&_.push(I.catch(R=>{console.error("[ActionEngine] Error during async cleanup:",R)}))}catch(I){console.error("[ActionEngine] Error during cleanup:",I)}u.clear(),_.length>0&&await Promise.all(_)}return{apply:x,applyBatch:S,validate:b,getActive:w,destroy:A}}var $p=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.")}),Ao=d.object({routes:$p,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 NC(r){return Sr.safeParse(r)}function FC(r){return Oi.safeParse(r)}function DC(r){return Ao.safeParse(r)}var HC=[{defName:"matchOp",schema:Ai},{defName:"counterDef",schema:Ti},{defName:"activationConfig",schema:Ao},{defName:"routeFilter",schema:$p},{defName:"ruleStrategy",schema:Ii},{defName:"scoreStrategy",schema:$i},{defName:"modelStrategy",schema:Mi},{defName:"externalStrategy",schema:Pi},{defName:"rule",schema:Ri},{defName:"condition",schema:Sr}];var Mp=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),BC=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:Mp.optional()}).strict(),VC=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:Ao.optional(),notifications:d.array(BC).optional()}).strict(),fb=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(),backdrop:d.boolean().optional(),backdropColor:d.string().optional()}),UC=d.object({canvas:fb.optional()}),jC=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()}),WC=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()}),zC=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()}),qC=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()}),ZC=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()}),GC=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:fb.optional(),launcher:jC.optional(),tile:WC.optional(),overlay:zC.optional(),notification:qC.optional(),content:ZC.optional(),mobile:UC.optional()}).strict(),KC=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(),z5=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).describe("DO NOT SET \u2014 determined automatically by the runtime based on the surface type (web \u2192 standard, agent/MCP \u2192 inline). Setting this field will be stripped by the config fixer.").optional(),tiles:d.array(VC),actions:d.array(d.any()),theme:GC.optional(),launcher:KC.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:Sr.optional()})])).optional()}).passthrough().optional()}).strict();var Ke={triggerWhen:ao},_t=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Pp=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),Op=d.enum(["top-left","top-right","bottom-left","bottom-right"]),Lp=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),YC=/^(?:[/.#?]|[hH][tT][tT][pP][sS]?:\/\/|[mM][aA][iI][lL][tT][oO]:|[tT][eE][lL]:)/,XC=d.string().min(1).regex(YC,{message:"href must start with /, ./, ../, #, ?, http(s)://, mailto:, or tel: \u2014 javascript:, data:, and vbscript: are not allowed"}).refine(r=>{try{let e=new URL(r,"https://syntro.local/");return["http:","https:","mailto:","tel:"].includes(e.protocol)}catch{return!1}},{message:"href resolves to an unsupported protocol"}),Xl=d.object({label:d.string().describe("Visible button label."),actionId:d.string().describe('Identifier emitted on action.modal_cta_clicked / action.tooltip_cta_clicked. Use "dismiss" to close the overlay without publishing an event or navigating, even if href is set.'),primary:d.boolean().optional().describe("When true, renders as the primary (filled) button. Defaults to false."),href:XC.optional().describe('URL to navigate to when the button is clicked. Use this to drive users to a destination (product page, signup, etc.) \u2014 set href on a non-dismiss button rather than relying on actionId conventions or content:setAttr tricks. Accepts relative paths ("/product/x"), fragments ("#section"), query strings, and absolute http(s) URLs. javascript:/data:/vbscript: are rejected.'),target:d.enum(["_self","_blank"]).optional().describe('Navigation target. "_self" (default) replaces the current tab; "_blank" opens a new tab with noopener,noreferrer.')}).strict(),Np=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(Xl).optional()}).strict(),Fp=d.object({title:d.string().optional(),body:d.string()}).strict(),Dp=d.enum(["before","after","prepend","append","replace"]),Hp=d.enum(["immediate","hover","click"]),Bp=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),Vp=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),Up=d.enum(["auto","smooth","instant"]),Yl=d.enum(["start","center","end","nearest"]),jp=d.object({kind:d.literal("content:setText"),anchorId:_t,text:d.string(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Wp=d.object({kind:d.literal("content:setAttr"),anchorId:_t,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),zp=d.object({kind:d.literal("content:addClass"),anchorId:_t,className:d.string(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),qp=d.object({kind:d.literal("content:removeClass"),anchorId:_t,className:d.string(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Zp=d.object({kind:d.literal("content:setStyle"),anchorId:_t,styles:d.record(d.string()),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Gp=d.object({kind:d.literal("content:insertHtml"),anchorId:_t,html:d.string(),position:Dp,deepLink:Mp.optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Kp=d.object({kind:d.literal("overlays:highlight"),anchorId:_t,style:Pp.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Yp=d.object({kind:d.literal("overlays:pulse"),anchorId:_t,duration:d.number().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Xp=d.object({kind:d.literal("overlays:badge"),anchorId:_t,content:d.string(),position:Op.optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Jp=d.object({kind:d.literal("overlays:tooltip"),anchorId:_t,content:Np,trigger:Hp.optional(),placement:Lp.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),Qp=d.object({kind:d.literal("overlays:modal"),content:Fp,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(Xl).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),eh=d.object({kind:d.literal("navigation:scrollTo"),anchorId:_t,behavior:Up.optional(),block:Yl.optional(),inline:Yl.optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),th=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),rh=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:Bp,label:d.string().optional()}).extend(Ke).extend(Ve).strict(),nh=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),ih=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),sh=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(Ke).extend(Ve).strict(),oh=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(Vp).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(Ke).extend(Ve).passthrough(),gb=[{defName:"setText",schema:jp},{defName:"setAttr",schema:Wp},{defName:"addClass",schema:zp},{defName:"removeClass",schema:qp},{defName:"setStyle",schema:Zp},{defName:"insertHtml",schema:Gp},{defName:"highlight",schema:Kp},{defName:"pulse",schema:Yp},{defName:"badge",schema:Xp},{defName:"tooltip",schema:Jp},{defName:"modal",schema:Qp},{defName:"scrollTo",schema:eh},{defName:"navigate",schema:th},{defName:"mountWidget",schema:rh},{defName:"wait",schema:nh},{defName:"sequence",schema:ih},{defName:"parallel",schema:sh},{defName:"tour",schema:oh}];function Jl(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 S of y)clearTimeout(S.timer),S.resolve(x);n.delete(m)}}for(let[m,y]of i){let x=a(m);if(x){for(let S of y)S.cancelled||S.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 S=y??t;return new Promise((b,w)=>{let A={resolve:b,reject:w,timer:setTimeout(()=>{p(m,A),w(new Error(`waitFor("${m}") timed out after ${S}ms`))},S)},_=n.get(m);_||(_=new Set,n.set(m,_)),_.add(A),c()})}function f(m,y){if(o)return()=>{};let x=a(m);if(x)return y(x),()=>{};let S={cb:y,cancelled:!1},b=i.get(m);return b||(b=new Set,i.set(m,b)),b.add(S),c(),()=>{S.cancelled=!0;let w=i.get(m);w&&(w.delete(S),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 mb={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function vb(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...mb,...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 yb(r={}){let{className:e,style:t}={...mb,...r};return`
|
|
792
|
+
`;customElements.define("syntro-toast-stack",ko);var gp=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{}}}},mp=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{}}}},vp=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 Eo=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of Nu)this.registerCore(e,t);for(let{kind:e,executor:t}of nd)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",gp),this.registerCore("core:parallel",mp),this.registerCore("core:wait",vp)}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)}},cr=new Eo;function mb(r){return cr.get(r)}function Gl(r){return cr.has(r)}function yp(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 bp(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 _p(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>Kl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${Kl}`,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 xp(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function wp(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(Mp.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 Sp(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 kp(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>Yl&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${Yl}`,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 Ep(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 Cp(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 Ap(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=qt(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 Tp(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=qt(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 Rp(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 Ip(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 $p(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=qt(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 Mp=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),Kl=5e4,Yl=50;function qt(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(!Gl(n)&&n!=="core:mountWidget"){let i=cr.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":Ir(r,e,t);break;case"overlays:badge":Ir(r,e,t),yp(r,e,t);break;case"overlays:tooltip":Ir(r,e,t),bp(r,e,t);break;case"overlays:modal":Ip(r,e,t);break;case"content:insertHtml":Ir(r,e,t),_p(r,e,t);break;case"content:setText":Ir(r,e,t),xp(r,e,t);break;case"content:setAttr":Ir(r,e,t),wp(r,e,t);break;case"content:addClass":case"content:removeClass":Ir(r,e,t),Sp(r,e,t);break;case"content:setStyle":Ir(r,e,t),kp(r,e,t);break;case"core:mountWidget":Ep(r,e,t);break;case"core:wait":Cp(r,e,t);break;case"core:sequence":Ap(r,e,t);break;case"core:parallel":Tp(r,e,t);break;case"overlays:tour":$p(r,e,t);break;case"navigation:navigate":Rp(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function Ir(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 Co(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=qt(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 UC=0;function Xl(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=cr,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++UC}`}function f(_,C){t&&t.publish(_,C)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(_,C)=>t.subscribe({names:[_]},R=>C(R.props)):void 0,subscribeNavigation:l}}async function m(_,C){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let R=n.mount(_.slot,{type:"widget",widgetId:_.widget.widgetId,config:_.widget.props},{priority:_.widget.priority});return C.publishEvent("action.applied",{id:C.generateId(),kind:"core:mountWidget",slot:_.slot,widgetId:_.widget.widgetId}),{cleanup:()=>{R.unmount()},updateFn:N=>{if("widget"in N&&N.widget){let M=N.widget;M.props&&R.update({type:"widget",widgetId:_.widget.widgetId,config:M.props})}}}}async function g(_,C){if(_.kind==="core:mountWidget")return m(_,C);let R=a.get(_.kind);if(!R){let N="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${_.kind}".`,`Registered: [${N}]`),new Error(`No executor for action kind: ${_.kind}`)}return R(_,C)}function b(_,C,R,N){if(!c)return;let M=[],F=!1,V=async()=>{if(F)return;let P=u.get(_);if(P){F=!0;try{let Y=c.evaluateSync(R).value;if(P.state==="applied"&&!Y){try{await P.cleanup()}catch(le){console.error(`[ActionEngine] Error reverting conditional action ${_}:`,le)}P.state="deferred",P.cleanup=()=>{},P.updateFn=void 0,f("action.deferred",{id:_,kind:C.kind})}else if(P.state==="deferred"&&Y)try{let le=v(),D=await g(C,le);P.state="applied",P.cleanup=D.cleanup,P.updateFn=D.updateFn,P.appliedTs=Date.now()}catch(le){console.error(`[ActionEngine] Error applying deferred action ${_}:`,le),P.state="failed"}}finally{F=!1}}};c.context&&M.push(c.context.subscribe(V)),c.accumulator&&M.push(c.accumulator.subscribe(V)),c.sessionMetrics&&M.push(c.sessionMetrics.subscribe(V)),c.events&&M.push(c.events.subscribe(V)),p.set(_,M)}async function x(_){let C=qt(_);if(!C.valid){let K=C.errors.map(Y=>Y.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${_?.kind}":`,K,_),new Error(`Action validation failed: ${K}`)}let R=h(),N=_.triggerWhen;if(N&&c&&!c.evaluateSync(N).value){let Y={id:R,action:_,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set(R,Y);let le={id:R,action:_,async revert(){let D=u.get(R);if(!D)return;let te=p.get(R);if(te){for(let Ze of te)Ze();p.delete(R)}D.state="reverted",u.delete(R)},isApplied(){return u.get(R)?.state==="applied"},async update(D){let te=u.get(R);if(!te||te.state!=="applied")throw new Error("Cannot update action that is not applied");if(te.updateFn)await te.updateFn(D);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get(R)?.state??"reverted"}};return b(R,_,N,le),le}let M=v(),F=await g(_,M),V={id:R,action:_,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:F.cleanup,updateFn:F.updateFn};u.set(R,V);let P={id:R,action:_,async revert(){let K=u.get(R);if(!K||K.state!=="applied")return;let Y=p.get(R);if(Y){for(let le of Y)le();p.delete(R)}try{await K.cleanup(),K.state="reverted",f("action.reverted",{id:R,kind:_.kind})}catch(le){console.warn(`[ActionEngine] Cleanup error for ${_.kind} (${R}), ignoring:`,le),K.state="reverted",f("action.reverted",{id:R,kind:_.kind})}finally{u.delete(R)}},isApplied(){return u.get(R)?.state==="applied"},async update(K){let Y=u.get(R);if(!Y||Y.state!=="applied")throw new Error("Cannot update action that is not applied");if(Y.updateFn)await Y.updateFn(K);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get(R)?.state??"reverted"}};return N&&c&&b(R,_,N,P),P}async function w(_){console.log(`[ActionEngine] applyBatch: ${_.length} action(s)`,_.map(V=>V.kind).join(", "));let C=Co(_);if(!C.valid){let V=C.errors.map(P=>P.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${_.length} action(s):`,V,`
|
|
793
|
+
Actions:`,_.map((P,K)=>` [${K}] ${P.kind} ${P.anchorId?`anchor="${P.anchorId.selector}"`:""} ${P.label?`label="${P.label}"`:""}`).join(`
|
|
794
|
+
`)),new Error(`Batch validation failed: ${V}`)}let R=h(),N=[],M=[];try{let V=await Promise.allSettled(_.map(K=>x(K))),P=[];for(let K of V)K.status==="fulfilled"?(N.push(K.value),M.push(K.value)):P.push(K.reason instanceof Error?K.reason:new Error(String(K.reason)));if(P.length>0&&M.length===0)throw P[0];P.length>0&&console.warn(`[ActionEngine] ${P.length}/${_.length} action(s) failed in batch:`,P.map(K=>K.message).join("; "))}catch(V){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${M.length}. Rolling back...`,V);for(let P of M)try{await P.revert()}catch{}throw V}return{id:R,handles:N,async revertAll(){for(let V=N.length-1;V>=0;V--)try{await N[V].revert()}catch(P){console.error(`[ActionEngine] Error reverting action ${N[V].id}:`,P)}},isApplied(){return N.every(V=>V.isApplied())}}}function y(_){return qt(_)}function S(){return Array.from(u.values()).map(_=>({id:_.id,action:_.action,adaptiveId:_.adaptiveId,appliedTs:_.appliedTs,state:_.state}))}async function T(){for(let C of p.values())for(let R of C)try{R()}catch{}p.clear();let _=[];for(let C of u.values())if(C.state==="applied")try{let R=C.cleanup();R&&typeof R.then=="function"&&_.push(R.catch(N=>{console.error("[ActionEngine] Error during async cleanup:",N)}))}catch(R){console.error("[ActionEngine] Error during cleanup:",R)}u.clear(),_.length>0&&await Promise.all(_)}return{apply:x,applyBatch:w,validate:y,getActive:S,destroy:T}}var Pp=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.")}),Ao=d.object({routes:Pp,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 jC(r){return kr.safeParse(r)}function WC(r){return Ni.safeParse(r)}function zC(r){return Ao.safeParse(r)}var qC=[{defName:"matchOp",schema:Ri},{defName:"counterDef",schema:Ii},{defName:"activationConfig",schema:Ao},{defName:"routeFilter",schema:Pp},{defName:"ruleStrategy",schema:Mi},{defName:"scoreStrategy",schema:Pi},{defName:"modelStrategy",schema:Oi},{defName:"externalStrategy",schema:Li},{defName:"rule",schema:$i},{defName:"condition",schema:kr}];var Op=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),ZC=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:Op.optional()}).strict(),GC=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:Ao.optional(),notifications:d.array(ZC).optional()}).strict(),vb=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(),backdrop:d.boolean().optional(),backdropColor:d.string().optional()}),KC=d.object({canvas:vb.optional()}),YC=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()}),XC=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()}),JC=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()}),QC=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()}),eA=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()}),tA=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:vb.optional(),launcher:YC.optional(),tile:XC.optional(),overlay:JC.optional(),notification:QC.optional(),content:eA.optional(),mobile:KC.optional()}).strict(),rA=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(),eL=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).describe("DO NOT SET \u2014 determined automatically by the runtime based on the surface type (web \u2192 standard, agent/MCP \u2192 inline). Setting this field will be stripped by the config fixer.").optional(),tiles:d.array(GC),actions:d.array(d.any()),theme:tA.optional(),launcher:rA.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:kr.optional()})])).optional()}).passthrough().optional()}).strict();var Ye={triggerWhen:ao},wt=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Lp=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),Np=d.enum(["top-left","top-right","bottom-left","bottom-right"]),Fp=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),nA=/^(?:[/.#?]|[hH][tT][tT][pP][sS]?:\/\/|[mM][aA][iI][lL][tT][oO]:|[tT][eE][lL]:)/,iA=d.string().min(1).regex(nA,{message:"href must start with /, ./, ../, #, ?, http(s)://, mailto:, or tel: \u2014 javascript:, data:, and vbscript: are not allowed"}).refine(r=>{try{let e=new URL(r,"https://syntro.local/");return["http:","https:","mailto:","tel:"].includes(e.protocol)}catch{return!1}},{message:"href resolves to an unsupported protocol"}),Ql=d.object({label:d.string().describe("Visible button label."),actionId:d.string().describe('Identifier emitted on action.modal_cta_clicked / action.tooltip_cta_clicked. Use "dismiss" to close the overlay without publishing an event or navigating, even if href is set.'),primary:d.boolean().optional().describe("When true, renders as the primary (filled) button. Defaults to false."),href:iA.optional().describe('URL to navigate to when the button is clicked. Use this to drive users to a destination (product page, signup, etc.) \u2014 set href on a non-dismiss button rather than relying on actionId conventions or content:setAttr tricks. Accepts relative paths ("/product/x"), fragments ("#section"), query strings, and absolute http(s) URLs. javascript:/data:/vbscript: are rejected.'),target:d.enum(["_self","_blank"]).optional().describe('Navigation target. "_self" (default) replaces the current tab; "_blank" opens a new tab with noopener,noreferrer.')}).strict(),Dp=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(Ql).optional()}).strict(),Hp=d.object({title:d.string().optional(),body:d.string()}).strict(),Bp=d.enum(["before","after","prepend","append","replace"]),Vp=d.enum(["immediate","hover","click"]),Up=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),jp=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),Wp=d.enum(["auto","smooth","instant"]),Jl=d.enum(["start","center","end","nearest"]),zp=d.object({kind:d.literal("content:setText"),anchorId:wt,text:d.string(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),qp=d.object({kind:d.literal("content:setAttr"),anchorId:wt,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Zp=d.object({kind:d.literal("content:addClass"),anchorId:wt,className:d.string(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Gp=d.object({kind:d.literal("content:removeClass"),anchorId:wt,className:d.string(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Kp=d.object({kind:d.literal("content:setStyle"),anchorId:wt,styles:d.record(d.string()),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Yp=d.object({kind:d.literal("content:insertHtml"),anchorId:wt,html:d.string(),position:Bp,deepLink:Op.optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Xp=d.object({kind:d.literal("overlays:highlight"),anchorId:wt,style:Lp.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Jp=d.object({kind:d.literal("overlays:pulse"),anchorId:wt,duration:d.number().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),Qp=d.object({kind:d.literal("overlays:badge"),anchorId:wt,content:d.string(),position:Np.optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),eh=d.object({kind:d.literal("overlays:tooltip"),anchorId:wt,content:Dp,trigger:Vp.optional(),placement:Fp.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),th=d.object({kind:d.literal("overlays:modal"),content:Hp,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(Ql).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),rh=d.object({kind:d.literal("navigation:scrollTo"),anchorId:wt,behavior:Wp.optional(),block:Jl.optional(),inline:Jl.optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),nh=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),ih=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:Up,label:d.string().optional()}).extend(Ye).extend(Ue).strict(),sh=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),oh=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),ah=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(Ye).extend(Ue).strict(),lh=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(jp).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(Ye).extend(Ue).passthrough(),yb=[{defName:"setText",schema:zp},{defName:"setAttr",schema:qp},{defName:"addClass",schema:Zp},{defName:"removeClass",schema:Gp},{defName:"setStyle",schema:Kp},{defName:"insertHtml",schema:Yp},{defName:"highlight",schema:Xp},{defName:"pulse",schema:Jp},{defName:"badge",schema:Qp},{defName:"tooltip",schema:eh},{defName:"modal",schema:th},{defName:"scrollTo",schema:rh},{defName:"navigate",schema:nh},{defName:"mountWidget",schema:ih},{defName:"wait",schema:sh},{defName:"sequence",schema:oh},{defName:"parallel",schema:ah},{defName:"tour",schema:lh}];function ec(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,b]of n){let x=a(g);if(x){for(let w of b)clearTimeout(w.timer),w.resolve(x);n.delete(g)}}for(let[g,b]of i){let x=a(g);if(x){for(let w of b)w.cancelled||w.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,b){let x=n.get(g);x&&(x.delete(b),x.size===0&&n.delete(g)),n.size===0&&i.size===0&&u()}function h(g,b){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let x=a(g);if(x)return Promise.resolve(x);let w=b??t;return new Promise((y,S)=>{let T={resolve:y,reject:S,timer:setTimeout(()=>{p(g,T),S(new Error(`waitFor("${g}") timed out after ${w}ms`))},w)},_=n.get(g);_||(_=new Set,n.set(g,_)),_.add(T),c()})}function f(g,b){if(o)return()=>{};let x=a(g);if(x)return b(x),()=>{};let w={cb:b,cancelled:!1},y=i.get(g);return y||(y=new Set,i.set(g,y)),y.add(w),c(),()=>{w.cancelled=!0;let S=i.get(g);S&&(S.delete(w),S.size===0&&i.delete(g)),n.size===0&&i.size===0&&u()}}function v(){let g=0;for(let b of n.values())g+=b.size;return g}function m(){o=!0,u();let g=new Error("AnchorResolver destroyed");for(let b of n.values())for(let x of b)clearTimeout(x.timer),x.reject(g);n.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:f,pendingCount:v,destroy:m}}var bb={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function _b(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...bb,...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 xb(r={}){let{className:e,style:t}={...bb,...r};return`
|
|
795
795
|
(function() {
|
|
796
796
|
var s = document.createElement('style');
|
|
797
797
|
s.textContent = '.${e} { ${t} }';
|
|
798
798
|
document.head.appendChild(s);
|
|
799
799
|
document.documentElement.className += ' ${e}';
|
|
800
|
-
})();`}var
|
|
800
|
+
})();`}var sA=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function wb(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 dt("Syntro Runtime",`Failed to decode ${r}:`,n),null}}var ch="__syntro_rt_editor_source",uh="__syntro_rt_editor_conf";function tc(r,e){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}}function Sb(r){try{let e=sessionStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}var en,tn;function Ro(){if(en==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.token)en={token:r.token,api_base:r.apiBase||""},tc(ch,en),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${en.token.slice(0,15)}...)`);else{let e=wb("editor_source");if(e)en=e,tc(ch,e);else{let t=Sb(ch);t?.token&&(en=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 en??null}function rc(){if(tn==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.mode)tn={mode:r.mode,audit_session_id:r.auditSessionId,syntro_token:r.syntroToken,workspace_id:r.workspaceId},tc(uh,tn),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${tn.mode})`);else{let e=wb("editor_conf");if(e)tn=e,tc(uh,e);else{let t=Sb(uh);t?.mode&&(tn=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 tn??null}function oA(r){G("Syntro Runtime","Validating editor URL:",r);try{if(r.startsWith("/"))return G("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?(dt("Syntro Runtime","\u274C Editor URL must use HTTPS:",r),!1):sA.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i)?(G("Syntro Runtime","\u2713 Editor URL validated"),!0):(dt("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return dt("Syntro Runtime",`\u274C Invalid editor URL: ${r}`,e),!1}}var nc=()=>{let r=rc();return!Ro()?.token||!r?.mode?null:r.mode};function aA(){return Ro()?.token??null}function lA(){return Ro()?.api_base??null}var To=null,kb=async r=>{if(G("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){G("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){G("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}if(To)return G("Syntro Runtime","Editor SDK load already in progress, waiting..."),To;let e=typeof r=="string"?{editorUrl:r}:r??{};if(e.editorUrl==="skip"){G("Syntro Runtime",'editorUrl="skip" \u2014 deferring to caller'),G("Syntro Runtime","================================");return}let t=lA(),i=(t?`${t}/api/editor/sdk/editor-sdk.js`:null)||e.editorUrl;if(!i){dt("Syntro Runtime","\u274C No editor SDK URL available (no api_base, no editorUrl option)"),G("Syntro Runtime","================================");return}let s=aA(),o=s?`${i}?token=${encodeURIComponent(s)}`:i;if(G("Syntro Runtime","Editor URL:",o),G("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,hasEditorUrl:!!i,hasApiBase:!!t,tokenPrefix:s?`${s.slice(0,10)}...`:"none"}),!oA(i)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",i),G("Syntro Runtime","================================");return}return G("Syntro Runtime","\u2713 URL validated, injecting script tag..."),To=new Promise((a,l)=>{let c=document.createElement("script");c.src=o,c.async=!0,e.integrity&&(c.integrity=e.integrity,c.crossOrigin="anonymous",G("Syntro Runtime","SRI integrity check enabled")),c.onload=()=>{G("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),G("Syntro Runtime","================================"),a()},c.onerror=u=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",u),console.error("[Syntro Runtime] URL attempted:",o),G("Syntro Runtime","================================"),To=null,l(u)},document.head.appendChild(c),G("Syntro Runtime","Script tag appended to <head>")}),To};var ur=null;function Cb(r){ur&&ur!==r?r.appendChild(ur):ur=r;let e=r.getRootNode();e instanceof ShadowRoot&&cA(e)}function Ab(){return ur||(ur=document.createElement("div"),ur.id="syntro-overlays",Object.assign(ur.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(ur)),ur}var Eb=!1;function cA(r){if(Eb)return;let e=`
|
|
801
801
|
:host {
|
|
802
802
|
--syntro-surface: var(--sc-overlay-background, #0f1318);
|
|
803
803
|
--syntro-fg: var(--sc-overlay-text-color, #cbd0d7);
|
|
@@ -1059,10 +1059,10 @@ Actions:`,_.map((L,G)=>` [${G}] ${L.kind} ${L.anchorId?`anchor="${L.anchorId.se
|
|
|
1059
1059
|
.syntro-modal-btn-primary:hover {
|
|
1060
1060
|
background: var(--syntro-accent-hover, #d44844);
|
|
1061
1061
|
}
|
|
1062
|
-
`,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),wb=!0}var rc=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=vb(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&&qn(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=tc();wo();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??jn({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&&Sb(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),xb(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&&qn(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,previewNotification:m=>c.previewNotification(m),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 rc(r)}});var ch="syn_";function qi(r){if(!r.startsWith(ch))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(ch.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 nc(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return ch+t}function It(r){if(typeof process<"u"&&process.env)return process.env[r]}var Cb="syntro_segment_attributes";function Ab(){if(typeof window>"u")return{};try{let r=localStorage.getItem(Cb);if(r){let e=JSON.parse(r);return Z("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){Ge("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function Tb(r){if(!(typeof window>"u"))try{localStorage.setItem(Cb,JSON.stringify(r)),Z("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){Ge("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Rb(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 uh(){if(typeof window>"u")return{};let r={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let n=e.get(t);n&&(r[t]=n)}}catch{}try{navigator.language&&(r.browser_language=navigator.language),navigator.languages?.length&&(r.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;r.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){r.referrer=document.referrer;try{r.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?r.browser="Edge":e.includes("OPR/")||e.includes("Opera")?r.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?r.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?r.browser="Safari":e.includes("Firefox/")&&(r.browser="Firefox"),e.includes("Windows")?r.os="Windows":e.includes("iPhone")||e.includes("iPad")?r.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?r.os="macOS":e.includes("Android")?r.os="Android":e.includes("Linux")&&(r.os="Linux")}catch{}try{r.page_url=window.location.href,r.page_path=window.location.pathname,r.page_host=window.location.hostname,window.location.search&&(r.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(r.surface_type="telegram",r.surface_host=e.platform||"unknown"):(r.surface_type="web",r.surface_host="web")}catch{r.surface_type="web",r.surface_host="web"}try{let e=r.surface_type;e==="telegram"||e==="mcp-app"?r.surface="personal_agent":r.device_type==="mobile"?r.surface="mobile":r.surface="desktop"}catch{r.surface="desktop"}return r}var Eb="syntro_geo",Ib="https://geo.syntrologie.com";async function dh(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(Eb);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(Eb,JSON.stringify(n))}catch{}return Z("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var ph=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(/\/[^/]*$/,"");ph=`${e.origin}${t}`}}catch{ph=null}function $b(){return ph}var Mb=["fbclid","ttclid","gclid","gbraid","wbraid","msclkid","twclid","li_fat_id","epik","ScCid","yclid","_kx","mc_eid","mc_cid"];function hh(r){if(typeof window>"u"||!r.setPersonPropertiesOnce)return;let e=new URLSearchParams(window.location.search),t={};for(let n of Mb){let i=e.get(n);i&&(t[`$initial_${n}`]=i)}Object.keys(t).length>0&&r.setPersonPropertiesOnce(t)}var nA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,iA=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,sA=[/@yopmail\.com$/i,/@mailinator\.com$/i,/@guerrillamail\.(com|info|net|org|biz)$/i,/@10minutemail\.com$/i,/^test@/i,/^noreply@/i,/^no-reply@/i];function ic(r){return r?iA.test(r):!1}function Pb(r){return sA.some(e=>e.test(r))}function oA(r){if(r.type==="email")return!0;let e=(r.name||"").toLowerCase(),t=(r.id||"").toLowerCase();return!!(/email/.test(e)||/email/.test(t))}function aA(r){return r.closest("[data-syntro-no-identify]")!==null}function lA(r){return r?nA.test(r):!0}function fh(r,e){if(typeof document>"u")return()=>{};if(!r.identify&&!r.alias)return()=>{};let t=new Set,n=s=>{let o=r.getDistinctId?.();if(o===s){t.add(s);return}lA(o)?r.identify?.(s,{email:s}):r.alias?.(s),t.add(s)},i=s=>{let o=s.target;if(!(o instanceof HTMLInputElement)||aA(o)||!oA(o))return;let a=(o.value??"").trim().toLowerCase();if(!ic(a)||Pb(a)||t.has(a))return;if(!e){n(a);return}let l=e.getStatus();if(l==="granted"){n(a);return}l!=="denied"&&e.resolvePending().then(c=>{c==="granted"&&n(a)})};return document.addEventListener("change",i,!0),()=>{document.removeEventListener("change",i,!0),t.clear()}}var Ob="_syu",cA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function uA(r){return r?cA.test(r):!0}function gh(r,e){if(typeof window>"u"||!r.identify&&!r.alias)return;let t=new URLSearchParams(window.location.search).get(Ob);if(!t)return;let n=t.trim();if(!n)return;let i=()=>{let a=r.getDistinctId?.();if(a===n)return;let l=ic(n)?{email:n}:void 0;uA(a)?r.identify?.(n,l):r.alias?.(n)};if(!e){i();return}if(e.getStatus()==="granted"){i();return}let s=!1,o=e.subscribe(a=>{s||a==="granted"&&(s=!0,o(),i())})}var dA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function pA(r){return r.is_eu==="true"||r.country_code==="GB"||r.country_code==="CH"||!r.is_eu&&!r.country_code}function hA(r){if(!r)return"";try{return new URL(r).hostname}catch{return""}}function mh(){return typeof window>"u"?"":`${window.location.origin}${window.location.pathname}`}function vh(r,e){if(typeof window>"u"||typeof document>"u"||!r.setPersonPropertiesOnce)return;let t=document.referrer||"",n=new URLSearchParams(window.location.search),i={$initial_pathname:window.location.pathname,$initial_referrer:t,$initial_referring_domain:hA(t)};for(let s of dA){let o=n.get(s);o&&(i[`$initial_${s}`]=o)}if(r.setPersonPropertiesOnce(i),!e){r.setPersonPropertiesOnce({$initial_url:mh()});return}e.then(s=>{let o=pA(s)?mh():window.location.href;r.setPersonPropertiesOnce?.({$initial_url:o})}).catch(()=>{r.setPersonPropertiesOnce?.({$initial_url:mh()})})}var Lb=new Set(["email","telephone","streetAddress","addressLocality","addressRegion","postalCode","givenName","familyName"]),Nb=500,yh=3;function sc(r){if(Array.isArray(r))return r.map(sc);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Lb.has(t)||(e[t]=sc(n));return e}return r}function oc(r){if(Array.isArray(r))return r.map(oc);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))if(!(t==="description"&&typeof n=="string"&&n.length>Nb)){if(t==="image"&&Array.isArray(n)&&n.length>yh){e[t]=n.slice(0,yh);continue}e[t]=oc(n)}return e}return r}function fA(){return typeof document>"u"?[]:Array.from(document.querySelectorAll('script[type="application/ld+json"]')).filter(r=>!r.hasAttribute("data-syntro-no-jsonld")).map(r=>{try{return JSON.parse(r.textContent??"")}catch{return null}}).filter(r=>r!==null)}function bh(r){if(!r.register)return;let e=fA().map(oc).map(sc);e.length!==0&&r.register({json_ld:e})}function Fb(r,e,t={}){vh(r,t.geoPromise),hh(r),bh(r),gh(r,e);let n=fh(r,e);return()=>{n()}}var Db="app:",gA="syntro:",mA=/^[a-z][a-z0-9_]*$/;function ac(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(gA))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(Db))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(Db.length).split(":");if(e.length<2)return{valid:!1,reason:`Event name must have at least 2 segments after "app:" (app:{category}:{action}). Got: "${r}"`};for(let t of e)if(!mA.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function vA(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Hb(r,e,t=0){if(t>=e)return!1;for(let n of Object.values(r))if(n!==null&&typeof n=="object"&&!Array.isArray(n)&&!Hb(n,e,t+1))return!1;return!0}function lc(r){if(r===void 0)return{valid:!0};if(r===null||typeof r!="object"||Array.isArray(r))return{valid:!1,reason:"Props must be a plain object"};if(!Hb(r,2))return{valid:!1,reason:"Props nesting depth exceeds 2 levels"};let e=[];for(let[t,n]of Object.entries(r))n!==null&&typeof n=="object"||vA(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function cc(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 Io=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:Pe};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(cc(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=ac(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=lc(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:Pe};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(cc(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=>cc(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=>cc(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 Zi(r={}){return new Io(r)}var Gi=class{constructor(e=100){this.entries=[];this.maxSize=e}record(e){this.entries.push(e),this.maxSize>0&&this.entries.length>this.maxSize&&this.entries.shift()}getAll(){return[...this.entries]}clear(){this.entries=[]}};var Vb={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Ub(){return Vb}function _h(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 $o(r,e,t){return t===2?_h(_h(r+e)+"")%1e4/1e4:t===1?_h(e+r)%1e3/1e3:null}function yA(r){return r<=0?[]:new Array(r).fill(1/r)}function uc(r,e){return r>=e[0]&&r<e[1]}function jb(r,e){let t=$o("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Wb(r,e){for(let t=0;t<e.length;t++)if(uc(r,e[t]))return t;return-1}function wh(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function dc(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=xA(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 bA(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 _A(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=>!bA(i[0],i[1],i[2]))}catch{return!1}}function xA(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=wh(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return _A(n,t);return!1}catch{return!1}}function zb(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=yA(r);t=t||n,t.length!==r&&(t=n);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=n);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function qb(r,e,t){if(!e)return null;let n=e.split("?")[1];if(!n)return null;let i=n.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===r).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function Zb(r){try{return r()}catch(e){return console.error(e),!1}}var xh=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function ei(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Vb.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",xh(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:xh(i)},n,xh(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function Mo(r){return typeof r=="string"?r:JSON.stringify(r)}function xt(r){typeof r=="number"&&(r=r+""),(!r||typeof r!="string")&&(r="0");let e=r.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function Gb(){let r;try{r="1.6.4"}catch{r=""}return r}function Kb(r,e){let t,n;try{t=new URL(r),n=new URL(e)}catch(i){return console.error(`Unable to merge query strings: ${i}`),e}return t.searchParams.forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),n.toString()}function Bb(r){return typeof r=="object"&&r!==null}function pc(r){return r.urlPatterns&&r.variations.some(e=>Bb(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>Bb(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function hc(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 it={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},ur=Ub(),Ki={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>ur.fetch(`${r}/api/features/${e}`,{headers:t}),fetchRemoteEvalCall:({host:r,clientKey:e,payload:t,headers:n})=>{let i={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)};return ur.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new ur.EventSource(`${r}/sub/${e}`,{headers:t}):new ur.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),kA()):document.visibilityState==="hidden"&&(r=window.setTimeout(SA,it.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(ur.localStorage=globalThis.localStorage)}catch{}var Yi=new Map,Yb=!1,Ir=new Map,fc=new Map,Xi=new Map,Ji=new Set;function Jb(r){Object.assign(it,r),it.backgroundSync||Th()}async function Qb({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(it.backgroundSync=!1),EA({instance:r,allowStale:n,timeout:e,skipCache:t})}function wA(r){let e=Po(r),t=Yi.get(e)||new Set;t.add(r),Yi.set(e,t)}function e_(r){Yi.forEach(e=>e.delete(r))}function SA(){Xi.forEach(r=>{r&&(r.state="idle",Ch(r))})}function kA(){Xi.forEach(r=>{r&&r.state==="idle"&&Ah(r)})}async function Xb(){try{if(!ur.localStorage)return;await ur.localStorage.setItem(it.cacheKey,JSON.stringify(Array.from(Ir.entries())))}catch{}}async function EA({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=Po(r),s=kh(r),o=new Date,a=new Date(o.getTime()-it.maxAge+it.staleTTL);await CA();let l=!it.disableCache&&!n?Ir.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Ji.add(i),l.staleAt<o?Sh(r):Eh(r),{data:l.data,success:!0,source:"cache"}):await hc(Sh(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function Po(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function kh(r){let e=Po(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 CA(){if(!Yb){Yb=!0;try{if(ur.localStorage){let r=await ur.localStorage.getItem(it.cacheKey);if(!it.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{Ir.set(t,{...n,staleAt:new Date(n.staleAt)})}),t_()}}}catch{}if(!it.disableIdleStreams){let r=Ki.startIdleListener();r&&(Ki.stopIdleListener=r)}}}function t_(){let r=Array.from(Ir.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,Ir.size-it.maxEntries),Ir.size);for(let t=0;t<e;t++)Ir.delete(r[t].key)}function r_(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+it.staleTTL),s=it.disableCache?void 0:Ir.get(e);if(s&&n&&s.version===n){s.staleAt=i,Xb();return}it.disableCache||(Ir.set(e,{data:t,version:n,staleAt:i,sse:Ji.has(r)}),t_()),Xb();let o=Yi.get(r);o&&o.forEach(a=>AA(a,t))}async function AA(r,e){await r.setPayload(e||r.getPayload())}async function Sh(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=Po(r),o=kh(r),a=fc.get(o);return a||(a=(i?Ki.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Ki.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"&&Ji.add(s),c.json()}).then(c=>(r_(s,o,c),Eh(r),fc.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(fc.delete(o),{data:null,source:"error",success:!1,error:c})),fc.set(o,a)),a}function Eh(r,e=!1){let t=Po(r),n=kh(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Ji.add(t),it.backgroundSync&&Ji.has(t)&&ur.EventSource){if(Xi.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Yi.get(t);c&&c.forEach(u=>{Sh(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);r_(t,n,c)}a.errors=0}catch{n_(a)}},errors:0,state:"active"};Xi.set(t,a),Ah(a)}}function n_(r){if(r.state!=="idle"&&(r.errors++,r.errors>3||r.src&&r.src.readyState===2)){let e=Math.pow(3,r.errors-3)*(1e3+Math.random()*1e3);Ch(r),setTimeout(()=>{["idle","active"].includes(r.state)||Ah(r)},Math.min(e,3e5))}}function Ch(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function Ah(r){r.src=Ki.eventSourceCall({host:r.host,clientKey:r.clientKey,headers:r.headers}),r.state="active",r.src.addEventListener("features",r.cb),r.src.addEventListener("features-updated",r.cb),r.src.onerror=()=>n_(r),r.src.onopen=()=>{r.errors=0}}function TA(r,e){Ch(r),Xi.delete(e)}function Th(){Ji.clear(),Xi.forEach(TA),Yi.clear(),Ki.stopIdleListener()}function gc(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Eh(r,!0),wA(r)}}var RA=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,$h={revert:function(){}},bc=new Map,Mh=new Set;function IA(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function _c(r){var e=bc.get(r);return e||(e={element:r,attributes:{}},bc.set(r,e)),e}function xc(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,IA(e)),o}function wc(r,e){var t=e.getCurrentValue(e.el);e.virtualValue=r,r&&typeof r!="string"?(!t||r.parentNode!==t.parentNode||r.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,i_()):r!==t&&(e.isDirty=!0,i_())}function $A(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),wc(zA(e),r)}function MA(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),wc(Array.from(e).filter(Boolean).join(" "),r)}function PA(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),wc(e,r)}function OA(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 LA(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=OA(n);e=i||e}),wc(e,r)}var NA=function(e){return e.innerHTML},FA=function(e,t){return e.innerHTML=t};function o_(r){var e=_c(r);return e.html||(e.html=xc(r,"html",NA,FA,$A)),e.html}var DA=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},HA=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function a_(r){var e=_c(r);return e.position||(e.position=xc(r,"position",DA,HA,LA)),e.position}var BA=function(e,t){return t?e.className=t:e.removeAttribute("class")},VA=function(e){return e.className};function l_(r){var e=_c(r);return e.classes||(e.classes=xc(r,"class",VA,BA,MA)),e.classes}var UA=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},jA=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function c_(r,e){var t=_c(r);return t.attributes[e]||(t.attributes[e]=xc(r,e,UA(e),jA(e),PA)),t.attributes[e]}function WA(r,e){var t=bc.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 mc;function zA(r){return mc||(mc=document.createElement("div")),mc.innerHTML=r,mc.innerHTML}function vc(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||WA(r,e),t.setValue(r,n)}}function qA(r,e){r.html&&vc(e,"html",r.html),r.classes&&vc(e,"class",r.classes),r.position&&vc(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){vc(e,t,r.attributes[t])})}function i_(){bc.forEach(qA)}function ZA(r,e){var t=null;r.kind==="html"?t=o_(e):r.kind==="class"?t=l_(e):r.kind==="attribute"?t=c_(e,r.attribute):r.kind==="position"&&(t=a_(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function GA(r,e){var t=null;if(r.kind==="html"?t=o_(e):r.kind==="class"?t=l_(e):r.kind==="attribute"?t=c_(e,r.attribute):r.kind==="position"&&(t=a_(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function u_(r){if(!(r.kind==="position"&&r.elements.size===1)){var e=new Set(r.elements),t=document.querySelectorAll(r.selector);t.forEach(function(n){e.has(n)||(r.elements.add(n),ZA(r,n))})}}function KA(r){r.elements.forEach(function(e){return GA(r,e)}),r.elements.clear(),Mh.delete(r)}function s_(){Mh.forEach(u_)}var Rh;function YA(){typeof document>"u"||(Rh||(Rh=new MutationObserver(function(){s_()})),s_(),Rh.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}YA();function Sc(r){return typeof document>"u"?$h:(Mh.add(r),u_(r),{revert:function(){KA(r)}})}function Ih(r,e){return Sc({kind:"html",elements:new Set,mutate:e,selector:r})}function d_(r,e){return Sc({kind:"position",elements:new Set,mutate:e,selector:r})}function Oo(r,e){return Sc({kind:"class",elements:new Set,mutate:e,selector:r})}function yc(r,e,t){return RA.test(e)?e==="class"||e==="className"?Oo(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)})}):Sc({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):$h}function XA(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 Ih(e,function(a){return a+(n??"")});if(t==="set")return Ih(e,function(){return n??""})}else if(i==="class"){if(t==="append")return Oo(e,function(a){n&&a.add(n)});if(t==="remove")return Oo(e,function(a){n&&a.delete(n)});if(t==="set")return Oo(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return d_(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return yc(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return yc(e,i,function(){return n??""});if(t==="remove")return yc(e,i,function(){return null})}return $h}var JA={html:Ih,classes:Oo,attribute:yc,position:d_,declarative:XA},p_=JA;var Ph={};function tn(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!g_(r,i,t))return!1;break;case"$nor":if(g_(r,i,t))return!1;break;case"$and":if(!n2(r,i,t))return!1;break;case"$not":if(tn(r,i,t))return!1;break;default:if(!Lo(i,QA(r,n),t))return!1}return!0}function QA(r,e){let t=e.split("."),n=r;for(let i=0;i<t.length;i++)if(n&&typeof n=="object"&&t[i]in n)n=n[t[i]];else return null;return n}function h_(r,e=!1){let t=`${r}${e?"/i":""}`;return Ph[t]||(Ph[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Ph[t]}function Lo(r,e,t,n=!1){if(typeof r=="string")return n?String(e).toLowerCase()===r.toLowerCase():e+""===r;if(typeof r=="number")return e*1===r;if(typeof r=="boolean")return e!==null&&!!e===r;if(r===null)return e===null;if(Array.isArray(r)||!m_(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!r2(i,e,r[i],t))return!1;return!0}function m_(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function e2(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 t2(r,e,t){if(!Array.isArray(r))return!1;let n=m_(e)?i=>Lo(e,i,t):i=>tn(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function Qi(r,e,t=!1){if(t){let n=i=>typeof i=="string"?i.toLowerCase():i;return Array.isArray(r)?r.some(i=>e.some(s=>n(i)===n(s))):e.some(i=>n(r)===n(i))}return Array.isArray(r)?r.some(n=>e.includes(n)):e.includes(r)}function f_(r,e,t,n=!1){if(!Array.isArray(r))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<r.length;o++)if(Lo(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function r2(r,e,t,n){switch(r){case"$veq":return xt(e)===xt(t);case"$vne":return xt(e)!==xt(t);case"$vgt":return xt(e)>xt(t);case"$vgte":return xt(e)>=xt(t);case"$vlt":return xt(e)<xt(t);case"$vlte":return xt(e)<=xt(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)?Qi(e,t):!1;case"$ini":return Array.isArray(t)?Qi(e,t,!0):!1;case"$inGroup":return Qi(e,n[t]||[]);case"$notInGroup":return!Qi(e,n[t]||[]);case"$nin":return Array.isArray(t)?!Qi(e,t):!1;case"$nini":return Array.isArray(t)?!Qi(e,t,!0):!1;case"$not":return!Lo(t,e,n);case"$size":return Array.isArray(e)?Lo(t,e.length,n):!1;case"$elemMatch":return t2(e,t,n);case"$all":return Array.isArray(t)?f_(e,t,n):!1;case"$alli":return Array.isArray(t)?f_(e,t,n,!0):!1;case"$regex":try{return h_(t).test(e)}catch{return!1}case"$regexi":try{return h_(t,!0).test(e)}catch{return!1}case"$type":return e2(e)===t;default:return console.error("Unknown operator: "+r),!1}}function g_(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(tn(r,e[n],t))return!0;return!1}function n2(r,e,t){for(let n=0;n<e.length;n++)if(!tn(r,e[n],t))return!1;return!0}var i2="Feature Evaluated",s2="Experiment Viewed";function o2(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 a2(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 es(r){try{await r()}catch{}}function v_(r,e,t){if(r.user.trackedExperiments){let i=Cc(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(es(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(es(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(es(()=>i(s2,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function l2(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;es(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;es(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;es(()=>n(i2,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function kc(r,e){if(e.stack.evaluatedFeatures.has(r))return rn(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=o2(e);if(t.has(r))return rn(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return rn(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=kc(l.id,e);if(c.source==="cyclicPrerequisite")return rn(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!tn(u,l.condition||{})){if(l.gate)return rn(e,r,null,"prerequisite");continue e}}if(s.filters&&__(s.filters,e))continue;if("force"in s){if(s.condition&&!b_(s.condition,e)||!c2(e,s.seed||r,s.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!s.disableStickyBucketing?s.fallbackAttribute:void 0,s.range,s.coverage,s.hashVersion))continue;return s.tracks&&s.tracks.forEach(l=>{!v_(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),rn(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}=Ec(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return rn(e,r,a.value,"experiment",s.id,o,a)}}return rn(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function Ec(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:$e(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:$e(t,r,-1,!1,e)};if(r=u2(r,t),r.urlPatterns&&!dc(t.user.url||"",r.urlPatterns))return{result:$e(t,r,-1,!1,e)};let s=qb(n,t.user.url||"",i);if(s!==null)return{result:$e(t,r,s,!1,e)};let o=a2(t);if(n in o){let m=o[n];return{result:$e(t,r,m,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:$e(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=ti(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:$e(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:m,versionIsBlocked:y}=h2({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(__(r.filters,t))return{result:$e(t,r,-1,!1,e)}}else if(r.namespace&&!jb(l,r.namespace))return{result:$e(t,r,-1,!1,e)};if(r.include&&!Zb(r.include))return{result:$e(t,r,-1,!1,e)};if(r.condition&&!b_(r.condition,t))return{result:$e(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=kc(y.id,t);if(x.source==="cyclicPrerequisite")return{result:$e(t,r,-1,!1,e)};let S={value:x.value};if(!tn(S,y.condition||{}))return{result:$e(t,r,-1,!1,e)}}}if(r.groups&&!p2(r.groups,t))return{result:$e(t,r,-1,!1,e)}}if(r.url&&!d2(r.url,t))return{result:$e(t,r,-1,!1,e)};let h=$o(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:$e(t,r,-1,!1,e)};if(!u){let m=r.ranges||zb(i,r.coverage===void 0?1:r.coverage,r.weights);c=Wb(h,m)}if(p)return{result:$e(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:$e(t,r,-1,!1,e)};if("force"in r)return{result:$e(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:$e(t,r,-1,!1,e)};if(r.status==="stopped")return{result:$e(t,r,-1,!1,e)};let f=$e(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:m,key:y,doc:x}=g2(t,a,Mo(l),{[Oh(r.key,r.bucketVersion)]:f.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=v_(t,r,f);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:r,result:f});let 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 rn(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"&&l2(r,e,a),a}function y_(r){return{...r.user.attributes,...r.user.attributeOverrides}}function b_(r,e){return tn(y_(e),r,e.global.savedGroups||{})}function __(r,e){return r.some(t=>{let{hashValue:n}=ti(e,t.attribute);if(!n)return!0;let i=$o(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>uc(i,s))})}function c2(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=ti(r,t,n);if(!a)return!1;let l=$o(e,a,o||1);return l===null?!1:i?uc(l,i):s!==void 0?l<=s:!0}function $e(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}=ti(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 u2(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=wh(r.url))),r}function ti(r,e,t){let n=e||"id",i="",s=y_(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function d2(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 p2(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function h2({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=Oh(e,t),l=f2(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=Oh(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 Oh(r,e){return e=e||0,`${r}__${e}`}function Lh(r,e){return`${r}||${e}`}function f2(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=ti(r,e),s=Lh(n,Mo(i)),{hashAttribute:o,hashValue:a}=ti(r,t),l=a?Lh(o,Mo(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 g2(r,e,t,n){let i=Lh(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 m2(r,e){let t=new Set,n=e&&e.features?e.features:r.global.features||{},i=e&&e.experiments?e.experiments:r.global.experiments||[];return Object.keys(n).forEach(s=>{let o=n[s];if(o.rules)for(let a of o.rules)a.variations&&(t.add(a.hashAttribute||"id"),a.fallbackAttribute&&t.add(a.fallbackAttribute))}),i.map(s=>{t.add(s.hashAttribute||"id"),s.fallbackAttribute&&t.add(s.fallbackAttribute)}),Array.from(t)}async function x_(r,e,t){let n=Nh(r,t);return e.getAllAssignments(n)}function Nh(r,e){let t={};return m2(r,e).forEach(i=>{let{hashValue:s}=ti(r,i);t[i]=Mo(s)}),t}async function w_(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await ei(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await ei(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await ei(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function S_(r){let e=r.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(r.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:r.apiHostRequestHeaders,streamingHostRequestHeaders:r.streamingHostRequestHeaders}}function Cc(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var ts=typeof window<"u"&&typeof document<"u",v2=Gb(),No=class{constructor(e){if(e=e||{},this.version=v2,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),ts&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let t in this._options.stickyBucketAssignmentDocs){let n=this._options.stickyBucketAssignmentDocs[t];n&&this._options.stickyBucketService.saveAssignments(n).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await w_(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,gc(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Jb(e.cacheSettings),e.payload)return await this.setPayload(e.payload),gc(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return gc(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return S_(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:n,streaming:i}){if(!this._options.clientKey)throw new Error("Missing clientKey");return Qb({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,backgroundSync:i??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){let i=await ei(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 ei(e,t||this._options.decryptionKey,n);this.setExperiments(JSON.parse(i))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(t=>{try{t()}catch(n){console.error(n)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,e_(this),e.destroyAllStreams&&Th(),this.logs=[],ts&&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}=Ec(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=$e(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=Ec(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=pc(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Kb(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(dc(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(ts)Promise.all([...o?[hc(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&&pc(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 kc(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=>[Cc(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(Cc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(ts?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=pc(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}:ts?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!ts)return;let t=[];if(e.css){let n=document.createElement("style");n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement("script");n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(n=>{t.push(p_.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await x_(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let n=this._getEvalContext(),i=Nh(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var y2="https://experiment.syntrologie.com",Fh=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 No({...e,apiHost:e.apiHost??y2,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 Ac(r={}){return new Fh(r)}var k_={growthbook:r=>Ac({...r,autoInit:!0})};function E_(r,e){let t=k_[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(k_).join(", ")}`);return t(e)}var b2=["cdn.syntrologie.com","localhost","127.0.0.1"];function _2(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):b2.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 Dh=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!_2(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 x2(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 x2(r){let t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-384",t),i=new Uint8Array(n);return btoa(String.fromCharCode(...i))}function C_(r){return new Dh(r)}var w2="syntro_exp",S2="syntro_var",Hh=class{constructor(e){this.name="experiments";this.client=e.client,this.featureKey=e.featureKey,this.manifestKey=e.manifestKey,this.variantFlagPrefix=e.variantFlagPrefix}async fetch(){let e=performance.now();if(typeof window<"u"){let i=new URLSearchParams(window.location.search),s=i.get(w2),o=i.get(S2);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:Ml(this.client,e)}getVariantFlagKeys(){if(this.manifestKey){let e=this.client.getFeatureValue?.(this.manifestKey,null);if(e&&typeof e=="object"){let t=e.variant_flags;if(t&&t.length>0)return t}}if(this.client.getAllFeatures){let e=this.client.getAllFeatures();return this.variantFlagPrefix?Object.keys(e).filter(t=>t.startsWith(this.variantFlagPrefix)):Object.keys(e)}return[]}};function A_(r){return new Hh(r)}var k2="https://cdn.syntrologie.com/configs",T_={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return C_({baseUrl:r.baseUrl??k2,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return A_({featureKey:r.featureKey})}};function R_(r,e={}){let t=T_[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(T_).join(", ")}`);return t(e)}var I_="syntro_session_metrics",Fo=class{constructor(e={}){this.metrics=new Map;this.subscribers=new Set;this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,t=1){let i=(this.metrics.get(e)??0)+t;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),this.notifySubscribers(),i}set(e,t){this.metrics.set(e,t),this.saveToStorage(),this.updateExperimentAttributes(e,t),this.onMetricChange?.(e,t),this.notifySubscribers()}get(e){return this.metrics.get(e)??0}meetsThreshold(e,t){return this.get(e)>=t}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0),this.notifySubscribers()}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let t={};for(let n of e)t[`${this.attributePrefix}${n}`]=0,this.onMetricChange?.(n,0);this.experiments?.setAttributes?.(t),this.notifySubscribers()}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}destroy(){this.subscribers.clear()}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,t){if(!this.experiments?.setAttributes)return;let n=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[n]:t})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[t,n]of this.metrics)e[`${this.attributePrefix}${t}`]=n;this.experiments.setAttributes(e)}notifySubscribers(){for(let e of this.subscribers)try{e()}catch{}}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(I_);if(e){let t=JSON.parse(e);for(let[n,i]of Object.entries(t))this.metrics.set(n,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[t,n]of this.metrics)e[t]={count:n,lastUpdated:Date.now()};sessionStorage.setItem(I_,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Tc(r={}){return new Fo(r)}var Rc=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 Ic=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 Rc(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 E2=[()=>new Ic];function $_(){for(let r of E2){let e=r();if(e.detect())return e}return null}var Bh="syntro_experiments";var $c={distinctId:"_syntro_distinct_id",telemetryHost:"_syntro_telemetry_host",telemetryKey:"_syntro_telemetry_key"};var A2=720*60*60,Mc=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie(),this.writeCartAttributes()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie(),this.writeCartAttributes()}destroy(){document.cookie=`${Bh}=; 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=`${Bh}=${t}; max-age=${A2}; path=/; SameSite=Lax`;document.cookie=n}writeCartAttributes(){let{distinctId:e,telemetryHost:t,telemetryKey:n}=this.context;if(!e)return;let i={};i[$c.distinctId]=e,i[$c.telemetryHost]=t,i[$c.telemetryKey]=n;let s=JSON.stringify({attributes:i});try{fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:s}).then(o=>{o.ok||console.warn(`[shopify-pixel-bridge] /cart/update.js returned ${o.status}; checkout_completed events will fall back to cookie (likely to drop).`)}).catch(o=>{console.warn("[shopify-pixel-bridge] /cart/update.js request failed; checkout_completed events will fall back to cookie (likely to drop).",o)})}catch{}}};function P_(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Uh(r,e){return r==="telegram"||r==="mcp-app"?"agent":e==="mobile"?"mobile":"desktop"}function T2(r="web",e="web"){let t=Date.now(),n=typeof window<"u"?window.innerWidth:0,i=typeof window<"u"?window.innerHeight:0,s=P_(n);return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:t,pageHistory:[]},viewport:{width:n,height:i},surface:{type:r,host:e,device:s,mode:Uh(r,s)}}}function Vh(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(M_(t,n))return}if(e.include){for(let n of e.include)if(M_(t,n))return n;return}return t}function M_(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 Do=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=T2(e.initialSurfaceType,e.initialSurfaceHost),this.previousContext={...this.context},e.telemetry?.getSessionId){let t=e.telemetry.getSessionId();t&&(this.context.session.sessionId=t)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=Vh(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=Vh(this.context.page.url,this.routes);t!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:t}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}setSurfaceType(e){if(e===this.context.surface.type)return;let t=Uh(e,this.context.surface.device);this.updateContext({surface:{...this.context.surface,type:e,mode:t}})}setSurfaceHost(e){e!==this.context.surface.host&&this.updateContext({surface:{...this.context.surface,host:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",t),this.cleanupFns.push(()=>window.removeEventListener("resize",t));let n=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(n)}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight},t=e.width!==this.context.viewport.width,n=e.height!==this.context.viewport.height;if(!t&&!n)return;let i={viewport:e};if(t){let s=P_(e.width);if(s!==this.context.surface.device){let o=Uh(this.context.surface.type,s);i.surface={...this.context.surface,device:s,mode:o}}}this.updateContext(i)}updatePage(){let e=window.location.href,{title:t}=document,n=Vh(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 Pc(r){return new Do(r)}function jh(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 Wh(r,e){let t=[];for(let n of r.conditions){let i=jh(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Ho(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=Wh(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 Bo(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 O_(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 zh(r,e,t={}){let n=O_(e,t);switch(r.type){case"rules":return Ho(r,n);case"score":return Bo(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 qh(r,e,t={}){let n=O_(e,t);switch(r.type){case"rules":return Ho(r,n);case"score":return Bo(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 Oc(r){return{evaluate:(e,t)=>zh(e,t,r),evaluateSync:(e,t)=>qh(e,t,r)}}function Lc(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 rs=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 Zh="cooldown:";function L_(r){return{set(e,t){let n=Zh+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Zh+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=Zh+e;r.remove(t)}}}var Vo="dismissed:";function N_(r,e){return{mark(t,n=!1){let i=Vo+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Vo+t;return r.has(n)||e.has(n)},clear(t){let n=Vo+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Vo)&&r.remove(t);for(let t of e.keys())t.startsWith(Vo)&&e.remove(t)}}}var Gh="freq:";function F_(r){function e(t){let n=Gh+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=Gh+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=Gh+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var R2="syntro";function Kh(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 Uo(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 jo=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??R2;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?Kh(window.sessionStorage,this.namespace):Uo(this.namespace),this.user=t(window.localStorage)?Kh(window.localStorage,this.namespace):Uo(this.namespace)):(this.session=Uo(this.namespace),this.user=Uo(this.namespace)),this.dismissals=N_(this.session,this.user),this.cooldowns=L_(this.user),this.frequency=F_(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?Kh(sessionStorage,t):Uo(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function Nc(r={}){return new jo(r)}function ns(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function Wo(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var Yh={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"}},is={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:[]},D_={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function Fc(r,e,t){let n=Yh[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 Dc(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Fa(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Ha()),t.shift!==!1&&i.push(Da({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Na(e,r,async()=>{let{x:o,y:a,strategy:l}=await Ba(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function Hc(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 Bc(r,e){return e==="none"||is[e].length===0?null:r.animate(is[e],D_)}function Vc(r,e){if(e==="none"||is[e].length===0)return Promise.resolve();let t=[...is[e]].reverse(),n=r.animate(t,D_);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Uc(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 jc(r){switch(ns(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 H_(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 I2=0;function Wc(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-${++I2}`}function u(b,w){t&&t.publish(b,w)}function p(b){let w=l.get(b);if(w){let A=m(b);for(let _ of w)try{_(A)}catch(C){console.error("[Surfaces] State callback error:",C)}}}let h=new Map;function f(b,w,A){switch(w.type){case"html":b.innerHTML=H_(w.content);return;case"widget":{if(s?.has(w.widgetId)){let _=s.mount(w.widgetId,b,w.config);return A&&h.set(A,_),()=>{_.unmount(),A&&h.delete(A)}}console.warn(`[Surfaces] Widget not found: ${w.widgetId}`),b.innerHTML=`<div data-widget-id="${w.widgetId}" data-widget-missing="true">Widget: ${w.widgetId}</div>`;return}case"custom":return w.mount(b);case"react":b.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(b,w,A){let _=c(),C=ns(b),I=A?.priority??0,R=A?.animation??i,P=A?.exclusive??!0,Y=o.get(b);if(Y&&P){if(Y.options.priority>I)throw new Error(`Slot ${b} is occupied by higher priority content (${Y.options.priority} > ${I})`);g(Y)}let F=Uc(b,_);F.style.zIndex=String(jc(b));let L;if(C==="static")Fc(F,b,A?.constraints),e.appendChild(F);else if(C==="inline"){let j=Wo(b);if(!j)throw new Error(`Invalid inline slot: ${b}`);if(!n)throw new Error("Anchor resolver required for inline slots");let te=n({selector:j,route:"**"});if(!te)throw new Error(`Anchor not found for inline slot: ${j}`);L=Hc(F,te)}else if(C==="adjacent"){let j=Wo(b);if(!j)throw new Error(`Invalid adjacent slot: ${b}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let te=n({selector:j,route:"**"});if(!te)throw new Error(`Anchor not found for adjacent slot: ${j}`);e.appendChild(F),L=Dc(F,te,A?.position??{placement:"bottom"})}let G=f(F,w,_);Bc(F,R);let K={id:_,slot:b,content:w,options:{priority:I,exclusive:P,animation:R,position:A?.position??{placement:"auto"},constraints:A?.constraints??{},adaptiveId:A?.adaptiveId,autoUnmountOnRouteChange:A?.autoUnmountOnRouteChange??!0},container:F,cleanup:()=>{L?.(),G?.()},mountedAt:Date.now()};return o.set(b,K),a.set(b,(a.get(b)??0)+1),u("surface.mounted",{slot:b,id:_,adaptiveId:A?.adaptiveId}),p(b),{id:_,update(j){let te=o.get(b);if(!te||te.id!==_)throw new Error("Mount no longer active");let De=h.get(_);if(De){if(j.type==="widget"){De.update(j.config),te.content=j;return}De.unmount(),h.delete(_)}te.container.innerHTML="";let V=f(te.container,j,_);if(te.content=j,V){let J=te.cleanup;te.cleanup=()=>{J?.(),V()}}},setOptions(j){let te=o.get(b);if(!te||te.id!==_)throw new Error("Mount no longer active");j.priority!==void 0&&(te.options.priority=j.priority),j.animation!==void 0&&(te.options.animation=j.animation),j.constraints&&C==="static"&&(j.constraints.maxWidth&&(te.container.style.maxWidth=j.constraints.maxWidth),j.constraints.maxHeight&&(te.container.style.maxHeight=j.constraints.maxHeight),j.constraints.minWidth&&(te.container.style.minWidth=j.constraints.minWidth),j.constraints.minHeight&&(te.container.style.minHeight=j.constraints.minHeight)),p(b)},async unmount(){let j=o.get(b);!j||j.id!==_||await g(j)},isMounted(){return o.get(b)?.id===_},getContainer(){let j=o.get(b);return j?.id===_?j.container:null}}}async function g(b){b.container.isConnected&&await Vc(b.container,b.options.animation);try{b.cleanup?.()}catch(w){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",w)}try{b.container.remove()}catch{}o.delete(b.slot),u("surface.unmounted",{slot:b.slot,id:b.id}),p(b.slot)}function m(b){let w=o.get(b);return{slot:b,occupied:!!w,currentPriority:w?.options.priority,currentAdaptiveId:w?.options.adaptiveId,mountCount:a.get(b)??0,currentMountId:w?.id}}function y(b,w){let A=l.get(b);return A||(A=new Set,l.set(b,A)),A.add(w),()=>{A?.delete(w),A?.size===0&&l.delete(b)}}function x(b,w){let A=o.get(b);return A?w!==void 0?w>=A.options.priority:!1:!0}function S(){for(let b of o.values())try{b.cleanup?.(),b.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:S}}var zo=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()}},zc=new zo;var Jh="2.0.0";function $2(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(Xh(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(Xh(n,i))return!0;return!1}return!0}function Xh(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 B_(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 Xh(t,s)})}function qc(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??zc,a=r.executors??lr,l=r.apps??Ws,c=new rs,u=Pc({telemetry:e,routes:n,navigation:c,initialSurfaceType:r.initialSurfaceType,initialSurfaceHost:r.initialSurfaceHost}),p=r.events??Zi(),h=Nc({namespace:s}),f=Lc({eventBus:p,stateStore:h}),v=Oc({state:h,events:p,sessionMetrics:t,accumulator:f}),g=kb(),m=Jl(),y=P=>B_(P)?m.resolve(P.selector):null,x=async(P,Y)=>{if(!B_(P))return null;try{return await m.waitFor(P.selector,Y)}catch{return null}},S=Wc({overlayRoot:g,eventBus:p,anchorResolver:y,widgetRegistry:o}),b=Kl({overlayRoot:g,eventBus:p,surfaces:S,anchorResolver:y,waitForAnchor:x,executorRegistry:a,subscribeNavigation:P=>c.subscribe(P),runtime:{evaluateSync:P=>v.evaluateSync(P,u.get()),context:u,accumulator:f,sessionMetrics:t,events:p?{subscribe:P=>p.subscribe(()=>P())}:void 0}}),w;if(t){let P=t;P.increment("page_views");let Y=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((F,L)=>{if(L!=="replaceState")try{let G=new URL(F).pathname;G!==Y&&(Y=G,P.increment("page_views"),A=0,P.set("time_on_page",0),P.set("scroll_depth",0))}catch{}})}let A=0,_,C;if(t){let P=t;_=setInterval(()=>{A++},1e3),C=setInterval(()=>{P.set("time_on_page",A)},5e3)}let I;if(t&&p){let P=t;I=p.subscribe({names:["ui.scroll"]},Y=>{let F=Y.props?.scrollPercentage;typeof F=="number"&&F>P.get("scroll_depth")&&P.set("scroll_depth",F)})}let R={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:b,surfaces:S,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:m,navigation:c,version:Jh,mode:i,async evaluate(P){return v.evaluate(P,u.get())},evaluateSync(P){return v.evaluateSync(P,u.get())},async filterTiles(P){let Y=u.get().page.url,F=[];for(let L of P){let G=L.activation;if(!G){F.push(L);continue}if($2(Y,G.routes)){if(G.onlyIfPopulated){let K=L.props?.actions??[];if(K.length>0&&!K.some(j=>j.triggerWhen?v.evaluateSync(j.triggerWhen,u.get()).value:!0))continue}F.push(L)}}return F},setRoutes(P){u.setRoutes(P)},destroy(){l.unbind().catch(P=>{console.error("[Runtime] Error unbinding apps registry:",P)}),w?.(),I?.(),_&&clearInterval(_),C&&clearInterval(C),m.destroy(),f.destroy(),c.destroy(),u.destroy(),b.destroy(),S.destroy()}};return l.bind(R),o.bindRuntime(R),R}function V_(r){return r==="granted"?"granted":r==="denied"?"denied":"pending"}function Qh(r){return r?Array.isArray(r)&&r[0]==="consent"?r[2]?.analytics_storage??null:typeof r=="object"&&r.event==="consent_update"?r.analytics_storage??null:null:null}var qo=class{constructor(){this.name="gtm-consent-mode-v2"}detect(){if(typeof window>"u")return!1;let e=window.dataLayer;if(!Array.isArray(e))return!1;for(let t of e)if(Qh(t)!==null)return!0;return!1}initialize(e){if(typeof window>"u")return e("pending"),()=>{};Array.isArray(window.dataLayer)||(window.dataLayer=[]),e(this.readCurrentState());let t=window.dataLayer,n=t.push.bind(t),i=(...s)=>{let o=n(...s);for(let a of s){let l=Qh(a);l!==null&&e(V_(l))}return o};return t.push=i,()=>{t.push===i&&(t.push=n)}}readCurrentState(){if(typeof window>"u")return"pending";let e=window.dataLayer;if(!Array.isArray(e))return"pending";for(let t=e.length-1;t>=0;t--){let n=Qh(e[t]);if(n!==null)return V_(n)}return"pending"}};var Zo=class{constructor(){this.name="iab-tcf-v2"}detect(){return typeof window>"u"?!1:typeof window.__tcfapi=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.__tcfapi;if(typeof t!="function")return()=>{};let n;return t("addEventListener",2,(i,s)=>{if(!s||!i||(n===void 0&&typeof i.listenerId=="number"&&(n=i.listenerId),!(i.eventStatus==="tcloaded"||i.eventStatus==="useractioncomplete")))return;if(i.gdprApplies===!1){e("granted");return}let a=i.purpose?.consents??{},l=a[1]===!0,c=a[8]===!0;e(l&&c?"granted":"denied")}),()=>{if(n!==void 0)try{t("removeEventListener",2,()=>{},n)}catch{}}}};var U_="visitorConsentCollected",Go=class{constructor(){this.name="shopify-customer-privacy"}detect(){return typeof window>"u"?!1:typeof window.Shopify?.loadFeatures=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.Shopify;if(!t?.loadFeatures)return()=>{};let n;return t.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],i=>{if(i)return;let s=t.customerPrivacy?.userCanBeTracked()??!0;e(s?"granted":"denied"),n=o=>{let a=o.detail;e(a?.analyticsAllowed?"granted":"denied")},document.addEventListener(U_,n)}),()=>{n&&document.removeEventListener(U_,n)}}};var Ko=class{constructor(e){this.options=e}async start(e){for(let n of this.options.adapters){let i=!1;try{i=n.detect()}catch{continue}if(i)try{let s=n.initialize(o=>e.setStatus(o));return this.options.onAdapterSelected?.(n.name),s}catch(s){console.warn(`[Syntro consent] Adapter "${n.name}" failed:`,s)}}this.options.onAdapterSelected?.(null);let t=await this.resolveFallback();return e.setStatus(t),()=>{}}async resolveFallback(){if(!this.options.fallbackStatus)return"pending";try{return await this.options.fallbackStatus()}catch{return"pending"}}};var Yo=class{constructor(e={}){this.listeners=new Set;this.destroyed=!1;this.status=e.initialStatus??"pending",this.configCallback=e.onConsentChange,this.gtmEnabled=e.readFromGtmConsentMode??!1,this.pendingResolverFn=e.pendingResolver}grant(){this.setStatus("granted")}deny(){this.setStatus("denied")}getStatus(){return this.status}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}subscribeOnce(e){if(this.status!=="pending")return queueMicrotask(()=>e(this.status)),()=>{};let t=this.subscribe(n=>{n!=="pending"&&(t(),e(n))});return t}async resolvePending(){if(this.status!=="pending")return this.status;if(!this.pendingResolverFn)return"denied";try{return await this.pendingResolverFn()}catch{return"denied"}}setStatus(e){this.applyStatus(e)}pollGtmConsent(){if(!this.gtmEnabled||typeof window>"u")return;let e=window.dataLayer;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n)continue;if(n[0]==="consent"&&n[1]==="update"&&n[2]){let s=n[2].analytics_storage;s==="granted"?this.setStatus("granted"):s==="denied"&&this.setStatus("denied");return}}}destroy(){this.destroyed=!0,this.listeners.clear()}applyStatus(e){this.destroyed||this.status!==e&&(this.status=e,this.notify(e))}notify(e){if(this.configCallback)try{this.configCallback(e)}catch{}for(let t of this.listeners)try{t(e)}catch{}}};var ss=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 M2(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var ef=class{constructor(){this.sessionId=M2(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,n){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,n){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}identify(e,t){}alias(e,t){}optInCapturing(){}optOutCapturing(){}};function Zc(){return new ef}var E=typeof window<"u"?window:void 0,tt=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(tt.self=tt),typeof File>"u"&&(tt.File=function(){});var D0=Array.prototype,j_=D0.forEach,W_=D0.indexOf,St=tt?.navigator,H=tt?.document,et=tt?.location,bf=tt?.fetch,_f=tt!=null&&tt.XMLHttpRequest&&"withCredentials"in new tt.XMLHttpRequest?tt.XMLHttpRequest:void 0,z_=tt?.AbortController,yt=St?.userAgent,re=E??{},Pr={DEBUG:!1,LIB_VERSION:"1.341.0"};function q_(r,e,t,n,i,s,o){try{var a=r[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,i)}function us(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){q_(s,n,i,o,a,"next",l)}function a(l){q_(s,n,i,o,a,"throw",l)}o(void 0)}))}}function W(){return W=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},W.apply(null,arguments)}function H0(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 P2=["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"],Z_=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return P2.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},O2=["$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 fe(r,e){return r.indexOf(e)!==-1}var Su=function(r){return r.trim()},xf=function(r){return r.replace(/^\$/,"")},L2=Array.isArray,B0=Object.prototype,V0=B0.hasOwnProperty,ku=B0.toString,xe=L2||function(r){return ku.call(r)==="[object Array]"},cn=r=>typeof r=="function",We=r=>r===Object(r)&&!xe(r),ds=r=>{if(We(r)){for(var e in r)if(V0.call(r,e))return!1;return!0}return!1},B=r=>r===void 0,ze=r=>ku.call(r)=="[object String]",wf=r=>ze(r)&&r.trim().length===0,zt=r=>r===null,ge=r=>B(r)||zt(r),Hr=r=>ku.call(r)=="[object Number]"&&r==r,ls=r=>Hr(r)&&r>0,Dr=r=>ku.call(r)==="[object Boolean]",N2=r=>r instanceof FormData,F2=r=>fe(O2,r);function Sf(r){return r===null||typeof r!="object"}function tu(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function U0(r){return!B(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var D2=[!0,"true",1,"1","yes"],tf=r=>fe(D2,r),H2=[!1,"false",0,"0","no"];function pr(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),Hr(r)?r>t?(n.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(n.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+i),pr(i||t,e,t,n))}var kf=class{constructor(e){this.t={},this.i=e.i,this.o=pr(e.bucketSize,0,100,e.h),this.m=pr(e.refillRate,0,this.o,e.h),this.$=pr(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,i=Math.floor(n/this.$);if(i>0){var s=i*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+i*this.$}}consumeRateLimit(e){var t,n=Date.now(),i=String(e),s=this.t[i];return s?this.S(s,n):(s={tokens:this.o,lastAccess:n},this.t[i]=s),s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.i)==null||t.call(this,e)),s.tokens===0)}stop(){this.t={}}},$t="Mobile",ru="iOS",Fr="Android",va="Tablet",j0=Fr+" "+va,W0="iPad",z0="Apple",q0=z0+" Watch",ya="Safari",gs="BlackBerry",Z0="Samsung",G0=Z0+"Browser",K0=Z0+" Internet",si="Chrome",B2=si+" OS",Y0=si+" "+ru,Mg="Internet Explorer",X0=Mg+" "+$t,Pg="Opera",V2=Pg+" Mini",Og="Edge",J0="Microsoft "+Og,hs="Firefox",Q0=hs+" "+ru,ba="Nintendo",_a="PlayStation",fs="Xbox",ex=Fr+" "+$t,tx=$t+" "+ya,oa="Windows",Ef=oa+" Phone",G_="Nokia",Cf="Ouya",rx="Generic",U2=rx+" "+$t.toLowerCase(),nx=rx+" "+va.toLowerCase(),Af="Konqueror",ct="(\\d+(\\.\\d+)?)",rf=new RegExp("Version/"+ct),j2=new RegExp(fs,"i"),W2=new RegExp(_a+" \\w+","i"),z2=new RegExp(ba+" \\w+","i"),Lg=new RegExp(gs+"|PlayBook|BB10","i"),q2={"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"},Gc,K_,nf,Z2=(r,e)=>e&&fe(e,z0)||(function(t){return fe(t,ya)&&!fe(t,si)&&!fe(t,Fr)})(r),ix=function(r,e){return e=e||"",fe(r," OPR/")&&fe(r,"Mini")?V2:fe(r," OPR/")?Pg:Lg.test(r)?gs:fe(r,"IE"+$t)||fe(r,"WPDesktop")?X0:fe(r,G0)?K0:fe(r,Og)||fe(r,"Edg/")?J0:fe(r,"FBIOS")?"Facebook "+$t:fe(r,"UCWEB")||fe(r,"UCBrowser")?"UC Browser":fe(r,"CriOS")?Y0:fe(r,"CrMo")||fe(r,si)?si:fe(r,Fr)&&fe(r,ya)?ex:fe(r,"FxiOS")?Q0:fe(r.toLowerCase(),Af.toLowerCase())?Af:Z2(r,e)?fe(r,$t)?tx:ya:fe(r,hs)?hs:fe(r,"MSIE")||fe(r,"Trident/")?Mg:fe(r,"Gecko")?hs:""},G2={[X0]:[new RegExp("rv:"+ct)],[J0]:[new RegExp(Og+"?\\/"+ct)],[si]:[new RegExp("("+si+"|CrMo)\\/"+ct)],[Y0]:[new RegExp("CriOS\\/"+ct)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ct)],[ya]:[rf],[tx]:[rf],[Pg]:[new RegExp("(Opera|OPR)\\/"+ct)],[hs]:[new RegExp(hs+"\\/"+ct)],[Q0]:[new RegExp("FxiOS\\/"+ct)],[Af]:[new RegExp("Konqueror[:/]?"+ct,"i")],[gs]:[new RegExp(gs+" "+ct),rf],[ex]:[new RegExp("android\\s"+ct,"i")],[K0]:[new RegExp(G0+"\\/"+ct)],[Mg]:[new RegExp("(rv:|MSIE )"+ct)],Mozilla:[new RegExp("rv:"+ct)]},K2=function(r,e){var t=ix(r,e),n=G2[t];if(B(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},Y_=[[new RegExp(fs+"; "+fs+" (.*?)[);]","i"),r=>[fs,r&&r[1]||""]],[new RegExp(ba,"i"),[ba,""]],[new RegExp(_a,"i"),[_a,""]],[Lg,[gs,""]],[new RegExp(oa,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ef,""];if(new RegExp($t).test(e)&&!/IEMobile\b/.test(e))return[oa+" "+$t,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=q2[n]||"";return/arm/i.test(e)&&(i="RT"),[oa,i]}return[oa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[ru,e.join(".")]}return[ru,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=B(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Fr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Fr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Fr,e.join(".")]}return[Fr,""]}],[/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/,[B2,""]],[/Linux|debian/i,["Linux",""]]],X_=function(r){return z2.test(r)?ba:W2.test(r)?_a:j2.test(r)?fs:new RegExp(Cf,"i").test(r)?Cf:new RegExp("("+Ef+"|WPDesktop)","i").test(r)?Ef:/iPad/.test(r)?W0:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?q0:Lg.test(r)?gs:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(G_,"i").test(r)?G_:/(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($t).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)?Fr:j0:new RegExp("(pda|"+$t+")","i").test(r)?U2:new RegExp(va,"i").test(r)&&!new RegExp(va+" pc","i").test(r)?nx:""},Y2=r=>r instanceof Error;function X2(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return nf&&t.length===K_||(K_=t.length,nf=t.reduce(((n,i)=>{Gc||(Gc={});var s=Gc[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,Gc[i]=[c,u];break}}return n}),{})),nf}}var Tf=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 us((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&xe(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)),W({},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 us((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,W({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:X2(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 W({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},ms="?";function Rf(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?ms:t,in_app:!0};return B(n)||(s.lineno=n),B(i)||(s.colno=i),s}var sx=(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]:ms,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},J2=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Q2=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eT=/\((\S*)(?::(\d+))(?::(\d+))\)/,tT=(r,e)=>{var t=J2.exec(r);if(t){var[,n,i,s]=t;return Rf(e,n,ms,+i,+s)}var o=Q2.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=eT.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=sx(o[1]||ms,o[2]);return Rf(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},rT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,iT=(r,e)=>{var t=rT.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=nT.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]||ms;return[s,i]=sx(s,i),Rf(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},J_=/\(error: (.*)\)/,Q_=50;function sT(){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(`
|
|
1063
|
-
`),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=J_.test(c)?c.replace(J_,"$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>=Q_)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,Q_).map((g=>{return W({},g,{filename:g.filename||(m=v,m[m.length-1]||{}).filename,function:g.function||ms});var m}))})(o)}})("web:javascript",tT,iT)}var If=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=ze(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 tu(e,"DOMException")}isDOMError(e){return tu(e,"DOMError")}},$f=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}},Mf=class{constructor(){}match(e){return tu(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}}},oT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Pf=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(oT);return i&&(t=i[1],n=i[2]),[t,n]}},aT=["fatal","error","warning","log","info","debug"];function ox(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 Of=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 U0(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: "+ox(e)}isSeverityLevel(e){return ze(e)&&!wf(e)&&aT.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(Y2(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Lf=class{match(e){return U0(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+ox(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Nf=class{match(e){return Sf(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}}},Ff=class{match(e){return tu(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Sf(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(Sf(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}},ax=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(Pr.DEBUG||re.POSTHOG_DEBUG||t)&&!B(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)=>ax(r+" "+i,s)};return n},U=ax("[PostHog.js]"),Le=U.createLogger,lT=Le("[ExternalScriptsLoader]"),e0=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return lT.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=H?.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(!H)return t("document not found");var l=H.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")H.head.appendChild(l);else{var c,u=H.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):H.body.appendChild(l)}};H!=null&&H.body?a():H?.addEventListener("DOMContentLoaded",a)};re.__PosthogExtensions__=re.__PosthogExtensions__||{},re.__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);e0(r,s,t)},re.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);e0(r,n,t)};var nu={};function un(r,e,t){if(xe(r)){if(j_&&r.forEach===j_)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)===nu)return}}}function Ae(r,e,t){if(!ge(r)){if(xe(r))return un(r,e,t);if(N2(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===nu)return}else for(var i in r)if(V0.call(r,i)&&e.call(t,r[i],i)===nu)return}}var Fe=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 un(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},ys=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 un(t,(function(i){un(i,(function(s){r.push(s)}))})),r};function Qc(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 t0=function(r){try{return r()}catch{return}},cT=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){U.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),U.critical(i)}}},Ng=function(r){var e={};return Ae(r,(function(t,n){(ze(t)&&t.length>0||Hr(t))&&(e[n]=t)})),e};function uT(r,e){return t=r,n=s=>ze(s)&&!zt(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),xe(o)?(l=[],un(o,(c=>{l.push(s(c))}))):(l={},Ae(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var dT=["herokuapp.com","vercel.app","netlify.app"];function pT(r){var e=r?.hostname;if(!ze(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of dT)if(t===n)return!1;return!0}function lx(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Ue(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var cx="$people_distinct_id",aa="__alias",la="__timers",r0="$autocapture_disabled_server_side",Df="$heatmaps_enabled_server_side",n0="$exception_capture_enabled_server_side",Hf="$error_tracking_suppression_rules",i0="$error_tracking_capture_extension_exceptions",s0="$web_vitals_enabled_server_side",ux="$dead_clicks_enabled_server_side",o0="$product_tours_enabled_server_side",a0="$web_vitals_allowed_metrics",sf="$session_recording_remote_config",iu="$sesid",dx="$session_is_sampled",ps="$enabled_feature_flags",ca="$early_access_features",Bf="$feature_flag_details",ua="$stored_person_properties",ii="$stored_group_properties",Vf="$surveys",su="$flag_call_reported",Or="$user_state",Uf="$client_session_props",jf="$capture_rate_limit",Wf="$initial_campaign_params",zf="$initial_referrer_info",ou="$initial_person_info",au="$epp",px="__POSTHOG_TOOLBAR__",Xo="$posthog_cookieless",hT=[cx,aa,"__cmpns",la,"$session_recording_enabled_server_side",Df,iu,ps,Hf,Or,ca,Bf,ii,ua,Vf,su,Uf,jf,Wf,zf,au,ou,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function l0(r){return r instanceof Element&&(r.id===px||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Eu(r){return!!r&&r.nodeType===1}function dn(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function hx(r){return!!r&&r.nodeType===3}function fx(r){return!!r&&r.nodeType===11}function Fg(r){return r?Su(r).split(/\s+/):[]}function c0(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function lu(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 Fg(e)}function gx(r){return ge(r)?null:Su(r).split(/(\s+)/).filter((e=>xa(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Sa(r){var e="";return qf(r)&&!_x(r)&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;hx(t)&&t.textContent&&(e+=(n=gx(t.textContent))!==null&&n!==void 0?n:"")})),Su(e)}function mx(r){return B(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Dg=["a","button","form","input","select","textarea","label"];function vx(r,e){if(B(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 yx(r){var e=r.parentNode;return!(!e||!Eu(e))&&e}var fT=["next","previous","prev",">","<"],u0=10,d0=[".ph-no-rageclick",".ph-no-capture"];function gT(r,e){if(!E||Hg(r))return!1;var t,n,i;if(Dr(e)?(t=!!e&&d0,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:d0,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=bx(r,!1);return!(function(o,a){if(o===!1||B(o))return!1;var l;if(o===!0)l=fT;else{if(!xe(o))return!1;if(o.length>u0)return U.error("[PostHog] content_ignorelist array cannot exceed "+u0+" 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:Sa(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!vx(s,t)}var Hg=r=>!r||dn(r,"html")||!Eu(r),bx=(r,e)=>{if(!E||Hg(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!dn(i,"body");)if(fx(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=yx(i);if(!s)break;if(e||Dg.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 mT(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||Hg(r)||(s=t)!=null&&s.url_allowlist&&!c0(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&c0(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}=bx(r,n);if(!(function(v,g){var m=g?.element_allowlist;if(B(m))return!0;var y,x=function(b){if(m.some((w=>b.tagName.toLowerCase()===w)))return{v:!0}};for(var S of v)if(y=x(S))return y.v;return!1})(p,t)||!vx(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&&(Dg.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function qf(r){for(var e=r;e.parentNode&&!dn(e,"body");e=e.parentNode){var t=lu(e);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(lu(r),"ph-include"))return!0;var n=r.type||"";if(ze(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(ze(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 _x(r){return!!(dn(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||dn(r,"select")||dn(r,"textarea")||r.getAttribute("contenteditable")==="true")}var xx="(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})",vT=new RegExp("^(?:"+xx+")$"),yT=new RegExp(xx),wx="\\d{3}-?\\d{2}-?\\d{4}",bT=new RegExp("^("+wx+")$"),_T=new RegExp("("+wx+")");function xa(r,e){return e===void 0&&(e=!0),!(ge(r)||ze(r)&&(r=Su(r),(e?vT:yT).test((r||"").replace(/[- ]/g,""))||(e?bT:_T).test(r)))}function Sx(r){var e=Sa(r);return xa(e=(e+" "+kx(r)).trim())?e:""}function kx(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=Sa(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+kx(t)).trim())}catch(s){U.error("[AutoCapture]",s)}})),e}function xT(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=W({},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 Qc(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[p0(p.toString())]=p0(h.toString())})),o+=":",o+=Qc(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:wT(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qc(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 p0(r){return r.replace(/"|\\"/g,'\\"')}function wT(r){var e=r.attr__class;return e?xe(e)?e:Fg(e):void 0}var cu=class{constructor(e){this.disabled=e===!1;var t=We(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}},uu=r=>{var e=H?.createElement("a");return B(e)?null:(e.href=r,e)},ST=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return Ae(r,(function(s,o){B(s)||B(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)},du=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(!xe(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{U.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ka=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("=");xe(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},pu=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},of="$copy_autocapture",h0=Le("[AutoCapture]");function af(r,e){return e.length>r?e.slice(0,r)+"...":e}function kT(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Eu(e));return e}function ET(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};Dg.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=af(1024,Sx(r)):s.$el_text=af(1024,Sa(r)));var o=lu(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),Ae(r.attributes,(function(u){var p;if((!_x(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&xa(u.value)&&(p=u.name,!ze(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=Fg(h).join(" ")),s["attr__"+u.name]=af(1024,h)}}));for(var a=1,l=1,c=r;c=kT(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function CT(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!dn(u,"body");)fx(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(Ae(c,(b=>{var w=qf(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=w&&v&&xa(v)&&v),fe(lu(b),"ph-no-capture")&&(g=!0),h.push(ET(b,s,o,a));var A=(function(_){if(!qf(_))return{};var C={};return Ae(_.attributes,(function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){var R=I.name.replace("data-ph-capture-attribute-",""),P=I.value;R&&P&&xa(P)&&(C[R]=P)}})),C})(b);Fe(f,A)})),g)return{props:{},explicitNoCapture:g};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Sx(r):h[0].$el_text=Sa(r)),v){var m,y;h[0].attr__href=v;var x=(m=uu(v))==null?void 0:m.host,S=E==null||(y=E.location)==null?void 0:y.host;x&&S&&x!==S&&(p=v)}return{props:Fe({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:xT(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 Zf=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new cu(e.config.rageclick),this.C=null}get R(){var e,t,n=We(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&&H){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){h0.error("Failed to capture event",i)}};if(Ue(H,"submit",e,{capture:!0}),Ue(H,"change",e,{capture:!0}),Ue(H,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,of)};Ue(H,"copy",t,{capture:!0}),Ue(H,"cut",t,{capture:!0})}}}else h0.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({[r0]:!!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=H?.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[r0],i=this.T;if(zt(i)&&!Dr(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=mx(e);hx(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())&&gT(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===of;if(i&&mT(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=CT(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===of){var c,u=gx(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 cn(H?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Hr(r)&&isFinite(r)&&Math.floor(r)===r});var f0="0123456789abcdef",Gf=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+f0.charAt(this.bytes[t]>>>4)+f0.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}},Kf=class{constructor(){this.A=0,this.j=0,this.D=new Yf}generate(){var e=this.generateOrAbort();if(B(e)){this.A=0;var t=this.generateOrAbort();if(B(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 Gf.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())}},g0,Ex=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&&!B(E.crypto)&&crypto.getRandomValues&&(Ex=r=>crypto.getRandomValues(r));var Yf=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Ex(this.N),this.U=0),this.N[this.U++]}},ln=()=>AT().toString(),AT=()=>(g0||(g0=new Kf)).generate(),Jo="",TT=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function RT(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=H),Jo)return Jo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+ln();!Jo&&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",Jo=c)}return Jo})(r);if(!t){var n=(i=>{var s=i.match(TT);return s?s[0]:""})(r);n!==t&&U.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var dr={H:()=>!!H,B:function(r){U.error("cookieStore error: "+r)},q:function(r){if(H){try{for(var e=r+"=",t=H.cookie.split(";").filter((s=>s.length)),n=0;n<t.length;n++){for(var i=t[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(dr.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(H)try{var s="",o="",a=RT(H.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&&U.warn("cookieStore warning: large cookie, len="+c.length),H.cookie=c,c}catch{return}},V:function(r,e){if(H!=null&&H.cookie)try{dr.G(r,"",-1,e)}catch{return}}},lf=null,Me={H:function(){if(!zt(lf))return lf;var r=!0;if(B(E))r=!1;else try{var e="__mplssupport__";Me.G(e,"xyz"),Me.q(e)!=='"xyz"'&&(r=!1),Me.V(e)}catch{r=!1}return r||U.error("localStorage unsupported; falling back to cookie store"),lf=r,r},B:function(r){U.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Me.B(e)}return null},W:function(r){try{return JSON.parse(Me.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Me.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Me.B(e)}}},IT=["$device_id","distinct_id",iu,dx,au,ou],Kc={},$T={H:function(){return!0},B:function(r){U.error("memoryStorage error: "+r)},q:function(r){return Kc[r]||null},W:function(r){return Kc[r]||null},G:function(r,e){Kc[r]=e},V:function(r){delete Kc[r]}},ri=null,Qe={H:function(){if(!zt(ri))return ri;if(ri=!0,B(E))ri=!1;else try{var r="__support__";Qe.G(r,"xyz"),Qe.q(r)!=='"xyz"'&&(ri=!1),Qe.V(r)}catch{ri=!1}return ri},B:function(r){U.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){Qe.B(e)}return null},W:function(r){try{return JSON.parse(Qe.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){Qe.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){Qe.B(e)}}},Lr=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),Xf=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Lr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Lr.DENIED||this.consent===Lr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Lr.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 tf(e)?Lr.GRANTED:fe(H2,e)?Lr.DENIED:Lr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Me:dr;var t=e==="localStorage"?dr:Me;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(tf(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!lx([St?.doNotTrack,St?.msDoNotTrack,re.doNotTrack],(e=>tf(e)))}},Yc=Le("[Dead Clicks]"),MT=()=>!0,PT=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(ux)),n=r.instance.config.capture_dead_clicks;return Dr(n)?n:!!We(n)||t},hu=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({[ux]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=re.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Yc.error("failed to load script",i):e()}))}et(){var e;if(H){if(!this.tt&&(e=re.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=We(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=re.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(H),Yc.info("starting...")}}else Yc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Yc.info("stopping..."))}},Qo=Le("[ExceptionAutocapture]"),Jf=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=re.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=re.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=re.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=re.__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){Qo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[n0]),this.dt=new kf({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:Qo}),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 We(e)?t=W({},t,e):(B(e)?this.ht:e)&&(t=W({},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?(Qo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=re.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Qo.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({[n0]: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)?Qo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function m0(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return cn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var Qf=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&&(U.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,U.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||m0(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__||m0(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){U.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Ue(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},cf=Le("[SegmentIntegration]");function OT(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()||ln();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(Or,"identified")),i()},a=s.user();"then"in a&&cn(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||cf.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()||(cf.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(cf.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 Cx="posthog-js";function Ax(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=>W({},y,{stacktrace:y.stacktrace?W({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((x=>W({},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 eg=class{constructor(e,t,n,i,s,o){this.name=Cx,this.setupOnce=function(a){a(Ax(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},LT=E!=null&&E.location?pu(E.location.hash,"__posthog")||pu(location.hash,"state"):null,v0="_postHogToolbarParams",y0=Le("[Toolbar]"),an=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(an||{}),tg=class{constructor(e){this.instance=e}yt(e){re.ph_toolbar_state=e}wt(){var e;return(e=re.ph_toolbar_state)!==null&&e!==void 0?e:an.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||!H)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=LT||pu(e.hash,"__posthog")||pu(e.hash,"state"),o=s?t0((()=>JSON.parse(atob(decodeURIComponent(s)))))||t0((()=>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(v0)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=re.ph_load_toolbar||re.ph_load_editor;!ge(t)&&cn(t)?t(e,this.instance):y0.warn("No toolbar load function found")}loadToolbar(e){var t=!(H==null||!H.getElementById(px));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=W({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(v0,JSON.stringify(W({},i,{source:void 0}))),this.wt()===an.LOADED)this.xt(i);else if(this.wt()===an.UNINITIALIZED){var s;this.yt(an.LOADING),(s=re.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return y0.error("[Toolbar] Failed to load",o),void this.yt(an.UNINITIALIZED);this.yt(an.LOADED),this.xt(i)})),Ue(E,"turbolinks:load",(()=>{this.yt(an.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)}},NT=Le("[TracingHeaders]"),rg=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;B(this.$t)&&((t=re.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),B(this.St)&&((n=re.__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=re.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return NT.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)}},Xc="https?://(.*)",bs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FT=ys(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],bs),Ea="<masked>",DT=["li_fat_id"];function Tx(r,e,t){if(!H)return{};var n,i=e?ys([],bs,t||[]):[],s=Rx(ka(H.URL,i,Ea),r),o=(n={},Ae(DT,(function(a){var l=dr.q(a);n[a]=l||null})),n);return Fe(o,s)}function Rx(r,e){var t=FT.concat(e||[]),n={};return Ae(t,(function(i){var s=du(r,i);n[i]=s||null})),n}function Ix(r){var e=(function(s){return s?s.search(Xc+"google.([^/?]*)")===0?"google":s.search(Xc+"bing.com")===0?"bing":s.search(Xc+"yahoo.com")===0?"yahoo":s.search(Xc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!zt(e)){n.$search_engine=e;var i=H?du(H.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function b0(){return navigator.language||navigator.userLanguage}function $x(){return H?.referrer||"$direct"}function Mx(r,e){var t=r?ys([],bs,e||[]):[],n=et?.href.substring(0,1e3);return{r:$x().substring(0,1e3),u:n?ka(n,t,Ea):void 0}}function Px(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=uu(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=uu(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=Rx(n);Fe(i,o)}if(t){var a=Ix(t);Fe(i,a)}return i}function Ox(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function HT(){try{return new Date().getTimezoneOffset()}catch{return}}function BT(r,e){if(!yt)return{};var t,n,i,s=r?ys([],bs,e||[]):[],[o,a]=(function(l){for(var c=0;c<Y_.length;c++){var[u,p]=Y_[c],h=u.exec(l),f=h&&(cn(p)?p(h,l):p);if(f)return f}return["",""]})(yt);return Fe(Ng({$os:o,$os_version:a,$browser:ix(yt,navigator.vendor),$device:X_(yt),$device_type:(n=yt,i=X_(n),i===W0||i===j0||i==="Kobo"||i==="Kindle Fire"||i===nx?va:i===ba||i===fs||i===_a||i===Cf?"Console":i===q0?"Wearable":i?$t:"Desktop"),$timezone:Ox(),$timezone_offset:HT()}),{$current_url:ka(et?.href,s,Ea),$host:et?.host,$pathname:et?.pathname,$raw_user_agent:yt.length>1e3?yt.substring(0,997)+"...":yt,$browser_version:K2(yt,navigator.vendor),$browser_language:b0(),$browser_language_prefix:(t=b0(),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 nn=Le("[Web Vitals]"),_0=9e5,ng=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)=>W({},n,{["$web_vitals_"+i.name+"_event"]:W({},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(B(s))nn.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();B(o)||(ge(n?.name)||ge(n?.value)?nn.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?nn.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),B(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=B(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(W({},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=re.__PosthogExtensions__;B(a)||B(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):nn.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[s0]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=We(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ge(n)?((t=this._instance.persistence)==null?void 0:t.props[a0])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(We(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=We(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=We(this._instance.config.capture_performance)&&Hr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:_0;return 0<e&&e<=6e4?_0:e}get isEnabled(){var e=et?.protocol;if(e!=="http:"&&e!=="https:")return nn.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=We(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Dr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Dr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(nn.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=We(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=We(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[s0]:t}),this._instance.persistence.register({[a0]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=re.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?nn.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?ys([],bs,n||[]):[];return ka(e,i,Ea)}nn.error("Could not determine current URL")}},VT=Le("[Heatmaps]");function x0(r){return We(r)&&"clientX"in r&&"clientY"in r&&Hr(r.clientX)&&Hr(r.clientY)}var ig=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[Df]),this.rageclicks=new cu(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return We(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ge(this.instance.config.capture_heatmaps)?ge(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;VT.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({[Df]: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"})(H)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&H&&(this.Nt=this.Lt.bind(this),Ue(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Ue(H,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Ue(H,"mousemove",this.zt,{capture:!0}),this.Bt=new hu(this.instance,MT,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Ue(H,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&H&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&H.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&H.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&H.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&&Eu(u)&&!dn(u,"body");){if(u===c)return!1;if(fe(l,E?.getComputedStyle(u).position))return!0;u=yx(u)}return!1})(mx(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"),!l0(e.target)&&x0(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(W({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!l0(e.target)&&x0(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?ys([],bs,i||[]):[],o=ka(t,s,Ea);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!ds(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},fu=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(U.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(!(B(o)||B(a)||B(l)||B(c)||B(u)||B(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:pr(a/o,0,1,U),f=o<=1?1:pr(l/o,0,1,U),v=c<=1?1:pr(u/c,0,1,U),g=c<=1?1:pr(p/c,0,1,U);i=Fe(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 Nr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Mt=Uint8Array,ut=Uint16Array,vs=Uint32Array,Bg=new Mt([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]),Vg=new Mt([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]),w0=new Mt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lx=function(r,e){for(var t=new ut(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new vs(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]},Nx=Lx(Bg,2),UT=Nx[0],sg=Nx[1];UT[28]=258,sg[258]=28;for(og=Lx(Vg,0)[1],gu=new ut(32768),Te=0;Te<32768;++Te)sn=(43690&Te)>>>1|(21845&Te)<<1,sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4,gu[Te]=((65280&sn)>>>8|(255&sn)<<8)>>>1;var sn,og,gu,Te,fa=function(r,e,t){for(var n=r.length,i=0,s=new ut(e);i<n;++i)++s[r[i]-1];var o,a=new ut(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new ut(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[gu[p]>>>l]=c}else for(o=new ut(n),i=0;i<n;++i)o[i]=gu[a[r[i]-1]++]>>>15-r[i];return o},oi=new Mt(288);for(Te=0;Te<144;++Te)oi[Te]=8;for(Te=144;Te<256;++Te)oi[Te]=9;for(Te=256;Te<280;++Te)oi[Te]=7;for(Te=280;Te<288;++Te)oi[Te]=8;var mu=new Mt(32);for(Te=0;Te<32;++Te)mu[Te]=5;var jT=fa(oi,9,0),WT=fa(mu,5,0),Fx=function(r){return(r/8>>0)+(7&r&&1)},Dx=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof ut?ut:r instanceof vs?vs:Mt)(t-e);return n.set(r.subarray(e,t)),n},$r=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},ea=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},uf=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 Mt(0),0];if(i==1){var o=new Mt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(w,A){return w.f-A.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 ut(h+1),v=ag(t[u-1],f,0);if(v>e){n=0;var g=0,m=v-e,y=1<<m;for(s.sort((function(w,A){return f[A.s]-f[w.s]||w.f-A.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 S=s[n].s;f[S]<e?g-=1<<e-f[S]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;f[b]==e&&(--f[b],++g)}v=e}return[new Mt(f),v]},ag=function(r,e,t){return r.s==-1?Math.max(ag(r.l,e,t+1),ag(r.r,e,t+1)):e[r.s]=t},S0=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new ut(++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]},ta=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},lg=function(r,e,t){var n=t.length,i=Fx(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)},k0=function(r,e,t,n,i,s,o,a,l,c,u){$r(e,u++,t),++i[256];for(var p=uf(i,15),h=p[0],f=p[1],v=uf(s,15),g=v[0],m=v[1],y=S0(h),x=y[0],S=y[1],b=S0(g),w=b[0],A=b[1],_=new ut(19),C=0;C<x.length;++C)_[31&x[C]]++;for(C=0;C<w.length;++C)_[31&w[C]]++;for(var I=uf(_,7),R=I[0],P=I[1],Y=19;Y>4&&!R[w0[Y-1]];--Y);var F,L,G,K,le=c+5<<3,j=ta(i,oi)+ta(s,mu)+o,te=ta(i,h)+ta(s,g)+o+14+3*Y+ta(_,R)+(2*_[16]+3*_[17]+7*_[18]);if(le<=j&&le<=te)return lg(e,u,r.subarray(l,l+c));if($r(e,u,1+(te<j)),u+=2,te<j){F=fa(h,f,0),L=h,G=fa(g,m,0),K=g;var De=fa(R,P,0);for($r(e,u,S-257),$r(e,u+5,A-1),$r(e,u+10,Y-4),u+=14,C=0;C<Y;++C)$r(e,u+3*C,R[w0[C]]);u+=3*Y;for(var V=[x,w],J=0;J<2;++J){var Q=V[J];for(C=0;C<Q.length;++C){var ue=31&Q[C];$r(e,u,De[ue]),u+=R[ue],ue>15&&($r(e,u,Q[C]>>>5&127),u+=Q[C]>>>12)}}}else F=jT,L=oi,G=WT,K=mu;for(C=0;C<a;++C)if(n[C]>255){ue=n[C]>>>18&31,ea(e,u,F[ue+257]),u+=L[ue+257],ue>7&&($r(e,u,n[C]>>>23&31),u+=Bg[ue]);var _e=31&n[C];ea(e,u,G[_e]),u+=K[_e],_e>3&&(ea(e,u,n[C]>>>5&8191),u+=Vg[_e])}else ea(e,u,F[n[C]]),u+=L[n[C]];return ea(e,u,F[256]),u+L[256]},zT=new vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qT=(function(){for(var r=new vs(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),ZT=function(r,e,t,n,i){return(function(s,o,a,l,c,u){var p=s.length,h=new Mt(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=lg(f,v,s.subarray(g,m)):(f[g]=u,v=lg(f,v,s.subarray(g,p)))}else{for(var y=zT[o-1],x=y>>>13,S=8191&y,b=(1<<a)-1,w=new ut(32768),A=new ut(b+1),_=Math.ceil(a/3),C=2*_,I=function($u){return(s[$u]^s[$u+1]<<_^s[$u+2]<<C)&b},R=new vs(25e3),P=new ut(288),Y=new ut(32),F=0,L=0,G=(g=0,0),K=0,le=0;g<p;++g){var j=I(g),te=32767&g,De=A[j];if(w[te]=De,A[j]=te,K<=g){var V=p-g;if((F>7e3||G>24576)&&V>423){v=k0(s,f,0,R,P,Y,L,G,le,g-le,v),G=F=L=0,le=g;for(var J=0;J<286;++J)P[J]=0;for(J=0;J<30;++J)Y[J]=0}var Q=2,ue=0,_e=S,me=te-De&32767;if(V>2&&j==I(g-me))for(var Ie=Math.min(x,V)-1,dt=Math.min(32767,g),qt=Math.min(258,V);me<=dt&&--_e&&te!=De;){if(s[g+Q]==s[g+Q-me]){for(var Zt=0;Zt<qt&&s[g+Zt]==s[g+Zt-me];++Zt);if(Zt>Q){if(Q=Zt,ue=me,Zt>Ie)break;var xs=Math.min(me,Zt-2),Ne=0;for(J=0;J<xs;++J){var ws=g-me+J+32768&32767,Zg=ws-w[ws]+32768&32767;Zg>Ne&&(Ne=Zg,De=ws)}}}me+=(te=De)-(De=w[te])+32768&32767}if(ue){R[G++]=268435456|sg[Q]<<18|og[ue];var Gg=31&sg[Q],Kg=31&og[ue];L+=Bg[Gg]+Vg[Kg],++P[257+Gg],++Y[Kg],K=g+Q,++F}else R[G++]=s[g],++P[s[g]]}}v=k0(s,f,u,R,P,Y,L,G,le,g-le,v)}return Dx(h,0,l+Fx(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)},df=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function GT(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=qT[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=ZT(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&&df(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),df(s,o-8,t.d()),df(s,o-4,n),s}var KT=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
|
|
1062
|
+
`,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),Eb=!0}var ic=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=_b(g)}let t=null,n=null,i=null,{runtime:s}=r;async function o(g){!s?.actions||g.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(g))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(r.fetcher)try{n=r.fetcher,console.log("[SmartCanvas] Fetching initial config...");let g=await r.fetcher();t=g,console.log("[SmartCanvas] Config fetched:",`tiles=${g.tiles?.length??0},`,`actions=${g.actions?.length??0},`,`theme=${g.theme?.mode??"default"}`),g.actions?.length&&console.log("[SmartCanvas] Actions to apply:",g.actions.map((b,x)=>`[${x}] ${b.kind}${b.anchorId?` anchor="${b.anchorId.selector}"`:""}${b.label?` "${b.label}"`:""}`).join(", ")),g.actions&&g.actions.length>0&&s?.actions&&(await o(g.actions),console.log("[SmartCanvas] Initial actions applied successfully")),g.tiles&&s?.accumulator&&Gn(g.tiles,s.accumulator,g.actions)}catch(g){console.error("[SmartCanvas] Error fetching/applying initial config:",g)}e&&e();let l=nc();wo();let c=document.createElement("smart-canvas");if(r.tokens)for(let[g,b]of Object.entries(r.tokens))c.style.setProperty(g,b);let u=r.integrations?.experiments,p=r.integrations?.telemetry,h=r.fetcher??zn({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 b=c.getOverlayContainer();b&&Cb(b)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),kb(r.editorUrl).catch(console.error));let m={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:g=>{for(let[b,x]of Object.entries(g))c.style.setProperty(b,x)},getConfig:async()=>{if(n)try{let g=await n();return t=g,g}catch(g){console.error("[SmartCanvas] Error fetching config:",g)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async g=>{g?t&&await o(t.actions):await a()},setOverrideFetcher:g=>{n=g,c.setOverrideFetcher(g),s?.accumulator&&g().then(b=>{b?.tiles&&Gn(b.tiles,s.accumulator,b.actions)}).catch(()=>{})},registerTelemetryProperties:g=>{p?.register?.(g)},getSessionId:()=>p?.getSessionId?.(),startSessionRecording:()=>{p?.startSessionRecording?.()},track:(g,b)=>p?.track?(p.track(g,b),!0):!1,previewNotification:g=>c.previewNotification(g),runtime:s};if(typeof window<"u"){let g=window.SynOS;g&&(g.handle=m)}return m};typeof window<"u"&&(window.SmartCanvas={async create(r){return ic(r)}});var dh="syn_";function Gi(r){if(!r.startsWith(dh))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(dh.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 sc(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return dh+t}function Mt(r){if(typeof process<"u"&&process.env)return process.env[r]}function ph(r,e){if(typeof window>"u")return null;try{let t=localStorage.getItem(r);if(!t)return null;let n=JSON.parse(t);return!n||typeof n.ts!="number"||!("data"in n)||e!=null&&Date.now()-n.ts>e?null:n.data}catch{return null}}function hh(r,e){if(!(typeof window>"u"))try{let t={ts:Date.now(),data:e};localStorage.setItem(r,JSON.stringify(t))}catch{}}var Ib="syntro_segment_attributes";function $b(){let r=ph(Ib);return r?(G("Syntro Bootstrap","Loaded cached segment attributes:",r),r):{}}function Mb(r){hh(Ib,r),G("Syntro Bootstrap","Cached segment attributes:",r)}function Pb(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 fh(){if(typeof window>"u")return{};let r={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let n=e.get(t);n&&(r[t]=n)}}catch{}try{navigator.language&&(r.browser_language=navigator.language),navigator.languages?.length&&(r.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;r.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){r.referrer=document.referrer;try{r.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?r.browser="Edge":e.includes("OPR/")||e.includes("Opera")?r.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?r.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?r.browser="Safari":e.includes("Firefox/")&&(r.browser="Firefox"),e.includes("Windows")?r.os="Windows":e.includes("iPhone")||e.includes("iPad")?r.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?r.os="macOS":e.includes("Android")?r.os="Android":e.includes("Linux")&&(r.os="Linux")}catch{}try{r.page_url=window.location.href,r.page_path=window.location.pathname,r.page_host=window.location.hostname,window.location.search&&(r.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(r.surface_type="telegram",r.surface_host=e.platform||"unknown"):(r.surface_type="web",r.surface_host="web")}catch{r.surface_type="web",r.surface_host="web"}try{let e=r.surface_type;e==="telegram"||e==="mcp-app"?r.surface="personal_agent":r.device_type==="mobile"?r.surface="mobile":r.surface="desktop"}catch{r.surface="desktop"}return r}var Ob="syntro_initial_attrs",uA=1800*1e3,Tb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function dA(r){if(typeof window>"u")return!1;try{return r===window.location.hostname}catch{return!1}}function gh(r,e){let t={},n=Tb.some(o=>typeof r[o]=="string");for(let o of Tb){let a=n?r[o]:e?.[o];a&&(t[o]=a)}let i=typeof r.referrer_hostname=="string"?r.referrer_hostname:void 0;return!(i?dA(i):!0)&&typeof r.referrer=="string"?(t.referrer=r.referrer,i&&(t.referrer_hostname=i)):e?.referrer&&(t.referrer=e.referrer,e.referrer_hostname&&(t.referrer_hostname=e.referrer_hostname)),e?.initial_page_url?(t.initial_page_url=e.initial_page_url,e.initial_page_path&&(t.initial_page_path=e.initial_page_path),e.initial_page_query&&(t.initial_page_query=e.initial_page_query)):(typeof r.page_url=="string"&&(t.initial_page_url=r.page_url),typeof r.page_path=="string"&&(t.initial_page_path=r.page_path),typeof r.page_query=="string"&&(t.initial_page_query=r.page_query)),t}function Lb(){return ph(Ob,uA)}function Nb(r){hh(Ob,r),G("Syntro Bootstrap","Cached initial attrs:",r)}var Rb="syntro_geo",Fb="https://geo.syntrologie.com";async function mh(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(Rb);if(e){let t=JSON.parse(e);return G("Syntro Bootstrap","Geo: using cached data:",t),t}}catch{}try{let e=await fetch(r,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json(),n={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s&&(n[i]=s);try{localStorage.setItem(Rb,JSON.stringify(n))}catch{}return G("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var vh=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(/\/[^/]*$/,"");vh=`${e.origin}${t}`}}catch{vh=null}function Db(){return vh}var Hb=["fbclid","ttclid","gclid","gbraid","wbraid","msclkid","twclid","li_fat_id","epik","ScCid","yclid","_kx","mc_eid","mc_cid"];function yh(r){if(typeof window>"u"||!r.setPersonPropertiesOnce)return;let e=new URLSearchParams(window.location.search),t={};for(let n of Hb){let i=e.get(n);i&&(t[`$initial_${n}`]=i)}Object.keys(t).length>0&&r.setPersonPropertiesOnce(t)}var pA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,hA=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,fA=[/@yopmail\.com$/i,/@mailinator\.com$/i,/@guerrillamail\.(com|info|net|org|biz)$/i,/@10minutemail\.com$/i,/^test@/i,/^noreply@/i,/^no-reply@/i];function oc(r){return r?hA.test(r):!1}function Bb(r){return fA.some(e=>e.test(r))}function gA(r){if(r.type==="email")return!0;let e=(r.name||"").toLowerCase(),t=(r.id||"").toLowerCase();return!!(/email/.test(e)||/email/.test(t))}function mA(r){return r.closest("[data-syntro-no-identify]")!==null}function vA(r){return r?pA.test(r):!0}function bh(r,e){if(typeof document>"u")return()=>{};if(!r.identify&&!r.alias)return()=>{};let t=new Set,n=s=>{let o=r.getDistinctId?.();if(o===s){t.add(s);return}vA(o)?r.identify?.(s,{email:s}):r.alias?.(s),t.add(s)},i=s=>{let o=s.target;if(!(o instanceof HTMLInputElement)||mA(o)||!gA(o))return;let a=(o.value??"").trim().toLowerCase();if(!oc(a)||Bb(a)||t.has(a))return;if(!e){n(a);return}let l=e.getStatus();if(l==="granted"){n(a);return}l!=="denied"&&e.resolvePending().then(c=>{c==="granted"&&n(a)})};return document.addEventListener("change",i,!0),()=>{document.removeEventListener("change",i,!0),t.clear()}}var Vb="_syu",yA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function bA(r){return r?yA.test(r):!0}function _h(r,e){if(typeof window>"u"||!r.identify&&!r.alias)return;let t=new URLSearchParams(window.location.search).get(Vb);if(!t)return;let n=t.trim();if(!n)return;let i=()=>{let a=r.getDistinctId?.();if(a===n)return;let l=oc(n)?{email:n}:void 0;bA(a)?r.identify?.(n,l):r.alias?.(n)};if(!e){i();return}if(e.getStatus()==="granted"){i();return}let s=!1,o=e.subscribe(a=>{s||a==="granted"&&(s=!0,o(),i())})}var _A=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function xA(r){return r.is_eu==="true"||r.country_code==="GB"||r.country_code==="CH"||!r.is_eu&&!r.country_code}function wA(r){if(!r)return"";try{return new URL(r).hostname}catch{return""}}function xh(){return typeof window>"u"?"":`${window.location.origin}${window.location.pathname}`}function wh(r,e){if(typeof window>"u"||typeof document>"u"||!r.setPersonPropertiesOnce)return;let t=document.referrer||"",n=new URLSearchParams(window.location.search),i={$initial_pathname:window.location.pathname,$initial_referrer:t,$initial_referring_domain:wA(t)};for(let s of _A){let o=n.get(s);o&&(i[`$initial_${s}`]=o)}if(r.setPersonPropertiesOnce(i),!e){r.setPersonPropertiesOnce({$initial_url:xh()});return}e.then(s=>{let o=xA(s)?xh():window.location.href;r.setPersonPropertiesOnce?.({$initial_url:o})}).catch(()=>{r.setPersonPropertiesOnce?.({$initial_url:xh()})})}var Ub=new Set(["email","telephone","streetAddress","addressLocality","addressRegion","postalCode","givenName","familyName"]),jb=500,Sh=3;function ac(r){if(Array.isArray(r))return r.map(ac);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Ub.has(t)||(e[t]=ac(n));return e}return r}function lc(r){if(Array.isArray(r))return r.map(lc);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))if(!(t==="description"&&typeof n=="string"&&n.length>jb)){if(t==="image"&&Array.isArray(n)&&n.length>Sh){e[t]=n.slice(0,Sh);continue}e[t]=lc(n)}return e}return r}function SA(){return typeof document>"u"?[]:Array.from(document.querySelectorAll('script[type="application/ld+json"]')).filter(r=>!r.hasAttribute("data-syntro-no-jsonld")).map(r=>{try{return JSON.parse(r.textContent??"")}catch{return null}}).filter(r=>r!==null)}function kh(r){if(!r.register)return;let e=SA().map(lc).map(ac);e.length!==0&&r.register({json_ld:e})}function Wb(r,e,t={}){wh(r,t.geoPromise),yh(r),kh(r),_h(r,e);let n=bh(r,e);return()=>{n()}}var zb="app:",kA="syntro:",EA=/^[a-z][a-z0-9_]*$/;function cc(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(kA))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(zb))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(zb.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(!EA.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function CA(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function qb(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)&&!qb(n,e,t+1))return!1;return!0}function uc(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(!qb(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"||CA(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function dc(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 Io=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:Pe};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(dc(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=cc(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=uc(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:Pe};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(dc(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=>dc(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=>dc(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 Ki(r={}){return new Io(r)}var Yi=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 Gb={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Kb(){return Gb}function Eh(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 $o(r,e,t){return t===2?Eh(Eh(r+e)+"")%1e4/1e4:t===1?Eh(e+r)%1e3/1e3:null}function AA(r){return r<=0?[]:new Array(r).fill(1/r)}function pc(r,e){return r>=e[0]&&r<e[1]}function Yb(r,e){let t=$o("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Xb(r,e){for(let t=0;t<e.length;t++)if(pc(r,e[t]))return t;return-1}function Ah(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function hc(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=IA(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 TA(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 RA(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=>!TA(i[0],i[1],i[2]))}catch{return!1}}function IA(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=Ah(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return RA(n,t);return!1}catch{return!1}}function Jb(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=AA(r);t=t||n,t.length!==r&&(t=n);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=n);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function Qb(r,e,t){if(!e)return null;let n=e.split("?")[1];if(!n)return null;let i=n.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===r).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function e_(r){try{return r()}catch(e){return console.error(e),!1}}var Ch=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function ri(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Gb.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Ch(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Ch(i)},n,Ch(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function Mo(r){return typeof r=="string"?r:JSON.stringify(r)}function St(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 t_(){let r;try{r="1.6.4"}catch{r=""}return r}function r_(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 Zb(r){return typeof r=="object"&&r!==null}function fc(r){return r.urlPatterns&&r.variations.some(e=>Zb(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>Zb(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function gc(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 st={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},dr=Kb(),Xi={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>dr.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 dr.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new dr.EventSource(`${r}/sub/${e}`,{headers:t}):new dr.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),PA()):document.visibilityState==="hidden"&&(r=window.setTimeout(MA,st.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(dr.localStorage=globalThis.localStorage)}catch{}var Ji=new Map,n_=!1,$r=new Map,mc=new Map,Qi=new Map,es=new Set;function s_(r){Object.assign(st,r),st.backgroundSync||Ph()}async function o_({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(st.backgroundSync=!1),OA({instance:r,allowStale:n,timeout:e,skipCache:t})}function $A(r){let e=Po(r),t=Ji.get(e)||new Set;t.add(r),Ji.set(e,t)}function a_(r){Ji.forEach(e=>e.delete(r))}function MA(){Qi.forEach(r=>{r&&(r.state="idle",$h(r))})}function PA(){Qi.forEach(r=>{r&&r.state==="idle"&&Mh(r)})}async function i_(){try{if(!dr.localStorage)return;await dr.localStorage.setItem(st.cacheKey,JSON.stringify(Array.from($r.entries())))}catch{}}async function OA({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=Po(r),s=Rh(r),o=new Date,a=new Date(o.getTime()-st.maxAge+st.staleTTL);await LA();let l=!st.disableCache&&!n?$r.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&es.add(i),l.staleAt<o?Th(r):Ih(r),{data:l.data,success:!0,source:"cache"}):await gc(Th(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function Po(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function Rh(r){let e=Po(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 LA(){if(!n_){n_=!0;try{if(dr.localStorage){let r=await dr.localStorage.getItem(st.cacheKey);if(!st.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{$r.set(t,{...n,staleAt:new Date(n.staleAt)})}),l_()}}}catch{}if(!st.disableIdleStreams){let r=Xi.startIdleListener();r&&(Xi.stopIdleListener=r)}}}function l_(){let r=Array.from($r.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,$r.size-st.maxEntries),$r.size);for(let t=0;t<e;t++)$r.delete(r[t].key)}function c_(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+st.staleTTL),s=st.disableCache?void 0:$r.get(e);if(s&&n&&s.version===n){s.staleAt=i,i_();return}st.disableCache||($r.set(e,{data:t,version:n,staleAt:i,sse:es.has(r)}),l_()),i_();let o=Ji.get(r);o&&o.forEach(a=>NA(a,t))}async function NA(r,e){await r.setPayload(e||r.getPayload())}async function Th(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=Po(r),o=Rh(r),a=mc.get(o);return a||(a=(i?Xi.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Xi.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"&&es.add(s),c.json()}).then(c=>(c_(s,o,c),Ih(r),mc.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(mc.delete(o),{data:null,source:"error",success:!1,error:c})),mc.set(o,a)),a}function Ih(r,e=!1){let t=Po(r),n=Rh(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&es.add(t),st.backgroundSync&&es.has(t)&&dr.EventSource){if(Qi.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ji.get(t);c&&c.forEach(u=>{Th(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);c_(t,n,c)}a.errors=0}catch{u_(a)}},errors:0,state:"active"};Qi.set(t,a),Mh(a)}}function u_(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);$h(r),setTimeout(()=>{["idle","active"].includes(r.state)||Mh(r)},Math.min(e,3e5))}}function $h(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function Mh(r){r.src=Xi.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=()=>u_(r),r.src.onopen=()=>{r.errors=0}}function FA(r,e){$h(r),Qi.delete(e)}function Ph(){es.clear(),Qi.forEach(FA),Ji.clear(),Xi.stopIdleListener()}function vc(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Ih(r,!0),$A(r)}}var DA=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Nh={revert:function(){}},xc=new Map,Fh=new Set;function HA(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function wc(r){var e=xc.get(r);return e||(e={element:r,attributes:{}},xc.set(r,e)),e}function Sc(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,HA(e)),o}function kc(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,d_()):r!==t&&(e.isDirty=!0,d_())}function BA(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),kc(e2(e),r)}function VA(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),kc(Array.from(e).filter(Boolean).join(" "),r)}function UA(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),kc(e,r)}function jA(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 WA(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=jA(n);e=i||e}),kc(e,r)}var zA=function(e){return e.innerHTML},qA=function(e,t){return e.innerHTML=t};function h_(r){var e=wc(r);return e.html||(e.html=Sc(r,"html",zA,qA,BA)),e.html}var ZA=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},GA=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function f_(r){var e=wc(r);return e.position||(e.position=Sc(r,"position",ZA,GA,WA)),e.position}var KA=function(e,t){return t?e.className=t:e.removeAttribute("class")},YA=function(e){return e.className};function g_(r){var e=wc(r);return e.classes||(e.classes=Sc(r,"class",YA,KA,VA)),e.classes}var XA=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},JA=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function m_(r,e){var t=wc(r);return t.attributes[e]||(t.attributes[e]=Sc(r,e,XA(e),JA(e),UA)),t.attributes[e]}function QA(r,e){var t=xc.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 yc;function e2(r){return yc||(yc=document.createElement("div")),yc.innerHTML=r,yc.innerHTML}function bc(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||QA(r,e),t.setValue(r,n)}}function t2(r,e){r.html&&bc(e,"html",r.html),r.classes&&bc(e,"class",r.classes),r.position&&bc(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){bc(e,t,r.attributes[t])})}function d_(){xc.forEach(t2)}function r2(r,e){var t=null;r.kind==="html"?t=h_(e):r.kind==="class"?t=g_(e):r.kind==="attribute"?t=m_(e,r.attribute):r.kind==="position"&&(t=f_(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function n2(r,e){var t=null;if(r.kind==="html"?t=h_(e):r.kind==="class"?t=g_(e):r.kind==="attribute"?t=m_(e,r.attribute):r.kind==="position"&&(t=f_(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function v_(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),r2(r,n))})}}function i2(r){r.elements.forEach(function(e){return n2(r,e)}),r.elements.clear(),Fh.delete(r)}function p_(){Fh.forEach(v_)}var Oh;function s2(){typeof document>"u"||(Oh||(Oh=new MutationObserver(function(){p_()})),p_(),Oh.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}s2();function Ec(r){return typeof document>"u"?Nh:(Fh.add(r),v_(r),{revert:function(){i2(r)}})}function Lh(r,e){return Ec({kind:"html",elements:new Set,mutate:e,selector:r})}function y_(r,e){return Ec({kind:"position",elements:new Set,mutate:e,selector:r})}function Oo(r,e){return Ec({kind:"class",elements:new Set,mutate:e,selector:r})}function _c(r,e,t){return DA.test(e)?e==="class"||e==="className"?Oo(r,function(n){var i=t(Array.from(n).join(" "));n.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return n.add(s)})}):Ec({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):Nh}function o2(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 Lh(e,function(a){return a+(n??"")});if(t==="set")return Lh(e,function(){return n??""})}else if(i==="class"){if(t==="append")return Oo(e,function(a){n&&a.add(n)});if(t==="remove")return Oo(e,function(a){n&&a.delete(n)});if(t==="set")return Oo(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 _c(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return _c(e,i,function(){return n??""});if(t==="remove")return _c(e,i,function(){return null})}return Nh}var a2={html:Lh,classes:Oo,attribute:_c,position:y_,declarative:o2},b_=a2;var Dh={};function rn(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!w_(r,i,t))return!1;break;case"$nor":if(w_(r,i,t))return!1;break;case"$and":if(!p2(r,i,t))return!1;break;case"$not":if(rn(r,i,t))return!1;break;default:if(!Lo(i,l2(r,n),t))return!1}return!0}function l2(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 __(r,e=!1){let t=`${r}${e?"/i":""}`;return Dh[t]||(Dh[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Dh[t]}function Lo(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)||!S_(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!d2(i,e,r[i],t))return!1;return!0}function S_(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function c2(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 u2(r,e,t){if(!Array.isArray(r))return!1;let n=S_(e)?i=>Lo(e,i,t):i=>rn(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function ts(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 x_(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(Lo(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function d2(r,e,t,n){switch(r){case"$veq":return St(e)===St(t);case"$vne":return St(e)!==St(t);case"$vgt":return St(e)>St(t);case"$vgte":return St(e)>=St(t);case"$vlt":return St(e)<St(t);case"$vlte":return St(e)<=St(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)?ts(e,t):!1;case"$ini":return Array.isArray(t)?ts(e,t,!0):!1;case"$inGroup":return ts(e,n[t]||[]);case"$notInGroup":return!ts(e,n[t]||[]);case"$nin":return Array.isArray(t)?!ts(e,t):!1;case"$nini":return Array.isArray(t)?!ts(e,t,!0):!1;case"$not":return!Lo(t,e,n);case"$size":return Array.isArray(e)?Lo(t,e.length,n):!1;case"$elemMatch":return u2(e,t,n);case"$all":return Array.isArray(t)?x_(e,t,n):!1;case"$alli":return Array.isArray(t)?x_(e,t,n,!0):!1;case"$regex":try{return __(t).test(e)}catch{return!1}case"$regexi":try{return __(t,!0).test(e)}catch{return!1}case"$type":return c2(e)===t;default:return console.error("Unknown operator: "+r),!1}}function w_(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(rn(r,e[n],t))return!0;return!1}function p2(r,e,t){for(let n=0;n<e.length;n++)if(!rn(r,e[n],t))return!1;return!0}var h2="Feature Evaluated",f2="Experiment Viewed";function g2(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 m2(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 rs(r){try{await r()}catch{}}function k_(r,e,t){if(r.user.trackedExperiments){let i=Tc(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(rs(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(rs(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(rs(()=>i(f2,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function v2(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;rs(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;rs(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;rs(()=>n(h2,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function Cc(r,e){if(e.stack.evaluatedFeatures.has(r))return nn(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=g2(e);if(t.has(r))return nn(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return nn(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=Cc(l.id,e);if(c.source==="cyclicPrerequisite")return nn(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!rn(u,l.condition||{})){if(l.gate)return nn(e,r,null,"prerequisite");continue e}}if(s.filters&&A_(s.filters,e))continue;if("force"in s){if(s.condition&&!C_(s.condition,e)||!y2(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=>{!k_(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),nn(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}=Ac(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return nn(e,r,a.value,"experiment",s.id,o,a)}}return nn(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function Ac(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:$e(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:$e(t,r,-1,!1,e)};if(r=b2(r,t),r.urlPatterns&&!hc(t.user.url||"",r.urlPatterns))return{result:$e(t,r,-1,!1,e)};let s=Qb(n,t.user.url||"",i);if(s!==null)return{result:$e(t,r,s,!1,e)};let o=m2(t);if(n in o){let g=o[n];return{result:$e(t,r,g,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:$e(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=ni(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:$e(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:g,versionIsBlocked:b}=w2({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=!!b}if(!u){if(r.filters){if(A_(r.filters,t))return{result:$e(t,r,-1,!1,e)}}else if(r.namespace&&!Yb(l,r.namespace))return{result:$e(t,r,-1,!1,e)};if(r.include&&!e_(r.include))return{result:$e(t,r,-1,!1,e)};if(r.condition&&!C_(r.condition,t))return{result:$e(t,r,-1,!1,e)};if(r.parentConditions){let g=new Set(t.stack.evaluatedFeatures);for(let b of r.parentConditions){t.stack.evaluatedFeatures=new Set(g);let x=Cc(b.id,t);if(x.source==="cyclicPrerequisite")return{result:$e(t,r,-1,!1,e)};let w={value:x.value};if(!rn(w,b.condition||{}))return{result:$e(t,r,-1,!1,e)}}}if(r.groups&&!x2(r.groups,t))return{result:$e(t,r,-1,!1,e)}}if(r.url&&!_2(r.url,t))return{result:$e(t,r,-1,!1,e)};let h=$o(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:$e(t,r,-1,!1,e)};if(!u){let g=r.ranges||Jb(i,r.coverage===void 0?1:r.coverage,r.weights);c=Xb(h,g)}if(p)return{result:$e(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:$e(t,r,-1,!1,e)};if("force"in r)return{result:$e(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:$e(t,r,-1,!1,e)};if(r.status==="stopped")return{result:$e(t,r,-1,!1,e)};let f=$e(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:g,key:b,doc:x}=k2(t,a,Mo(l),{[Hh(r.key,r.bucketVersion)]:f.key});g&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[b]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=k_(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 nn(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"&&v2(r,e,a),a}function E_(r){return{...r.user.attributes,...r.user.attributeOverrides}}function C_(r,e){return rn(E_(e),r,e.global.savedGroups||{})}function A_(r,e){return r.some(t=>{let{hashValue:n}=ni(e,t.attribute);if(!n)return!0;let i=$o(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>pc(i,s))})}function y2(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=ni(r,t,n);if(!a)return!1;let l=$o(e,a,o||1);return l===null?!1:i?pc(l,i):s!==void 0?l<=s:!0}function $e(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}=ni(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 b2(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=Ah(r.url))),r}function ni(r,e,t){let n=e||"id",i="",s=E_(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function _2(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 x2(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function w2({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=Hh(e,t),l=S2(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=Hh(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 Hh(r,e){return e=e||0,`${r}__${e}`}function Bh(r,e){return`${r}||${e}`}function S2(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=ni(r,e),s=Bh(n,Mo(i)),{hashAttribute:o,hashValue:a}=ni(r,t),l=a?Bh(o,Mo(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 k2(r,e,t,n){let i=Bh(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 E2(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 T_(r,e,t){let n=Vh(r,t);return e.getAllAssignments(n)}function Vh(r,e){let t={};return E2(r,e).forEach(i=>{let{hashValue:s}=ni(r,i);t[i]=Mo(s)}),t}async function R_(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await ri(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await ri(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await ri(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function I_(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 Tc(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var ns=typeof window<"u"&&typeof document<"u",C2=t_(),No=class{constructor(e){if(e=e||{},this.version=C2,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),ns&&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 R_(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,vc(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&s_(e.cacheSettings),e.payload)return await this.setPayload(e.payload),vc(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return vc(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 I_(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 o_({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 ri(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 ri(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,a_(this),e.destroyAllStreams&&Ph(),this.logs=[],ns&&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}=Ac(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=$e(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=Ac(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=fc(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?r_(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(hc(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(ns)Promise.all([...o?[gc(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&&fc(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 Cc(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=>[Tc(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(Tc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(ns?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=fc(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}:ns?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!ns)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(b_.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await T_(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=Vh(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var A2="https://experiment.syntrologie.com",Uh=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 No({...e,apiHost:e.apiHost??A2,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 Rc(r={}){return new Uh(r)}var $_={growthbook:r=>Rc({...r,autoInit:!0})};function M_(r,e){let t=$_[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys($_).join(", ")}`);return t(e)}var T2=["cdn.syntrologie.com","localhost","127.0.0.1"];function R2(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):T2.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 jh=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!R2(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 I2(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 I2(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 P_(r){return new jh(r)}var $2="syntro_exp",M2="syntro_var",Wh=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($2),o=i.get(M2);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:Ol(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 O_(r){return new Wh(r)}var P2="https://cdn.syntrologie.com/configs",L_={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return P_({baseUrl:r.baseUrl??P2,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return O_({featureKey:r.featureKey})}};function N_(r,e={}){let t=L_[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(L_).join(", ")}`);return t(e)}var F_="syntro_session_metrics",Fo=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(F_);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(F_,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Ic(r={}){return new Fo(r)}var $c=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 Mc=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 $c(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 O2=[()=>new Mc];function D_(){for(let r of O2){let e=r();if(e.detect())return e}return null}var zh="syntro_experiments";var Pc={distinctId:"_syntro_distinct_id",telemetryHost:"_syntro_telemetry_host",telemetryKey:"_syntro_telemetry_key"};var N2=720*60*60,Oc=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie(),this.writeCartAttributes()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie(),this.writeCartAttributes()}destroy(){document.cookie=`${zh}=; 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=`${zh}=${t}; max-age=${N2}; path=/; SameSite=Lax`;document.cookie=n}writeCartAttributes(){let{distinctId:e,telemetryHost:t,telemetryKey:n}=this.context;if(!e)return;let i={};i[Pc.distinctId]=e,i[Pc.telemetryHost]=t,i[Pc.telemetryKey]=n;let s=JSON.stringify({attributes:i});try{fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:s}).then(o=>{o.ok||console.warn(`[shopify-pixel-bridge] /cart/update.js returned ${o.status}; checkout_completed events will fall back to cookie (likely to drop).`)}).catch(o=>{console.warn("[shopify-pixel-bridge] /cart/update.js request failed; checkout_completed events will fall back to cookie (likely to drop).",o)})}catch{}}};function B_(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Zh(r,e){return r==="telegram"||r==="mcp-app"?"agent":e==="mobile"?"mobile":"desktop"}function F2(r="web",e="web"){let t=Date.now(),n=typeof window<"u"?window.innerWidth:0,i=typeof window<"u"?window.innerHeight:0,s=B_(n);return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:t,pageHistory:[]},viewport:{width:n,height:i},surface:{type:r,host:e,device:s,mode:Zh(r,s)}}}function qh(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(H_(t,n))return}if(e.include){for(let n of e.include)if(H_(t,n))return n;return}return t}function H_(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 Do=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=F2(e.initialSurfaceType,e.initialSurfaceHost),this.previousContext={...this.context},e.telemetry?.getSessionId){let t=e.telemetry.getSessionId();t&&(this.context.session.sessionId=t)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=qh(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=qh(this.context.page.url,this.routes);t!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:t}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}setSurfaceType(e){if(e===this.context.surface.type)return;let t=Zh(e,this.context.surface.device);this.updateContext({surface:{...this.context.surface,type:e,mode:t}})}setSurfaceHost(e){e!==this.context.surface.host&&this.updateContext({surface:{...this.context.surface,host:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",t),this.cleanupFns.push(()=>window.removeEventListener("resize",t));let n=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(n)}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight},t=e.width!==this.context.viewport.width,n=e.height!==this.context.viewport.height;if(!t&&!n)return;let i={viewport:e};if(t){let s=B_(e.width);if(s!==this.context.surface.device){let o=Zh(this.context.surface.type,s);i.surface={...this.context.surface,device:s,mode:o}}}this.updateContext(i)}updatePage(){let e=window.location.href,{title:t}=document,n=qh(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 Lc(r){return new Do(r)}function Gh(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 Kh(r,e){let t=[];for(let n of r.conditions){let i=Gh(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Ho(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=Kh(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 Bo(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 V_(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 Yh(r,e,t={}){let n=V_(e,t);switch(r.type){case"rules":return Ho(r,n);case"score":return Bo(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 Xh(r,e,t={}){let n=V_(e,t);switch(r.type){case"rules":return Ho(r,n);case"score":return Bo(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 Nc(r){return{evaluate:(e,t)=>Yh(e,t,r),evaluateSync:(e,t)=>Xh(e,t,r)}}function Fc(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 is=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 Jh="cooldown:";function U_(r){return{set(e,t){let n=Jh+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Jh+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=Jh+e;r.remove(t)}}}var Vo="dismissed:";function j_(r,e){return{mark(t,n=!1){let i=Vo+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Vo+t;return r.has(n)||e.has(n)},clear(t){let n=Vo+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Vo)&&r.remove(t);for(let t of e.keys())t.startsWith(Vo)&&e.remove(t)}}}var Qh="freq:";function W_(r){function e(t){let n=Qh+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=Qh+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=Qh+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var D2="syntro";function ef(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 Uo(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 jo=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??D2;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?ef(window.sessionStorage,this.namespace):Uo(this.namespace),this.user=t(window.localStorage)?ef(window.localStorage,this.namespace):Uo(this.namespace)):(this.session=Uo(this.namespace),this.user=Uo(this.namespace)),this.dismissals=j_(this.session,this.user),this.cooldowns=U_(this.user),this.frequency=W_(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?ef(sessionStorage,t):Uo(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function Dc(r={}){return new jo(r)}function ss(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function Wo(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var tf={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"}},os={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:[]},z_={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function Hc(r,e,t){let n=tf[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 Bc(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Ha(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Va()),t.shift!==!1&&i.push(Ba({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Da(e,r,async()=>{let{x:o,y:a,strategy:l}=await Ua(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function Vc(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 Uc(r,e){return e==="none"||os[e].length===0?null:r.animate(os[e],z_)}function jc(r,e){if(e==="none"||os[e].length===0)return Promise.resolve();let t=[...os[e]].reverse(),n=r.animate(t,z_);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Wc(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 zc(r){switch(ss(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 q_(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 H2=0;function qc(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-${++H2}`}function u(y,S){t&&t.publish(y,S)}function p(y){let S=l.get(y);if(S){let T=g(y);for(let _ of S)try{_(T)}catch(C){console.error("[Surfaces] State callback error:",C)}}}let h=new Map;function f(y,S,T){switch(S.type){case"html":y.innerHTML=q_(S.content);return;case"widget":{if(s?.has(S.widgetId)){let _=s.mount(S.widgetId,y,S.config);return T&&h.set(T,_),()=>{_.unmount(),T&&h.delete(T)}}console.warn(`[Surfaces] Widget not found: ${S.widgetId}`),y.innerHTML=`<div data-widget-id="${S.widgetId}" data-widget-missing="true">Widget: ${S.widgetId}</div>`;return}case"custom":return S.mount(y);case"react":y.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(y,S,T){let _=c(),C=ss(y),R=T?.priority??0,N=T?.animation??i,M=T?.exclusive??!0,F=o.get(y);if(F&&M){if(F.options.priority>R)throw new Error(`Slot ${y} is occupied by higher priority content (${F.options.priority} > ${R})`);m(F)}let V=Wc(y,_);V.style.zIndex=String(zc(y));let P;if(C==="static")Hc(V,y,T?.constraints),e.appendChild(V);else if(C==="inline"){let D=Wo(y);if(!D)throw new Error(`Invalid inline slot: ${y}`);if(!n)throw new Error("Anchor resolver required for inline slots");let te=n({selector:D,route:"**"});if(!te)throw new Error(`Anchor not found for inline slot: ${D}`);P=Vc(V,te)}else if(C==="adjacent"){let D=Wo(y);if(!D)throw new Error(`Invalid adjacent slot: ${y}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let te=n({selector:D,route:"**"});if(!te)throw new Error(`Anchor not found for adjacent slot: ${D}`);e.appendChild(V),P=Bc(V,te,T?.position??{placement:"bottom"})}let K=f(V,S,_);Uc(V,N);let Y={id:_,slot:y,content:S,options:{priority:R,exclusive:M,animation:N,position:T?.position??{placement:"auto"},constraints:T?.constraints??{},adaptiveId:T?.adaptiveId,autoUnmountOnRouteChange:T?.autoUnmountOnRouteChange??!0},container:V,cleanup:()=>{P?.(),K?.()},mountedAt:Date.now()};return o.set(y,Y),a.set(y,(a.get(y)??0)+1),u("surface.mounted",{slot:y,id:_,adaptiveId:T?.adaptiveId}),p(y),{id:_,update(D){let te=o.get(y);if(!te||te.id!==_)throw new Error("Mount no longer active");let Ze=h.get(_);if(Ze){if(D.type==="widget"){Ze.update(D.config),te.content=D;return}Ze.unmount(),h.delete(_)}te.container.innerHTML="";let ot=f(te.container,D,_);if(te.content=D,ot){let Ne=te.cleanup;te.cleanup=()=>{Ne?.(),ot()}}},setOptions(D){let te=o.get(y);if(!te||te.id!==_)throw new Error("Mount no longer active");D.priority!==void 0&&(te.options.priority=D.priority),D.animation!==void 0&&(te.options.animation=D.animation),D.constraints&&C==="static"&&(D.constraints.maxWidth&&(te.container.style.maxWidth=D.constraints.maxWidth),D.constraints.maxHeight&&(te.container.style.maxHeight=D.constraints.maxHeight),D.constraints.minWidth&&(te.container.style.minWidth=D.constraints.minWidth),D.constraints.minHeight&&(te.container.style.minHeight=D.constraints.minHeight)),p(y)},async unmount(){let D=o.get(y);!D||D.id!==_||await m(D)},isMounted(){return o.get(y)?.id===_},getContainer(){let D=o.get(y);return D?.id===_?D.container:null}}}async function m(y){y.container.isConnected&&await jc(y.container,y.options.animation);try{y.cleanup?.()}catch(S){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",S)}try{y.container.remove()}catch{}o.delete(y.slot),u("surface.unmounted",{slot:y.slot,id:y.id}),p(y.slot)}function g(y){let S=o.get(y);return{slot:y,occupied:!!S,currentPriority:S?.options.priority,currentAdaptiveId:S?.options.adaptiveId,mountCount:a.get(y)??0,currentMountId:S?.id}}function b(y,S){let T=l.get(y);return T||(T=new Set,l.set(y,T)),T.add(S),()=>{T?.delete(S),T?.size===0&&l.delete(y)}}function x(y,S){let T=o.get(y);return T?S!==void 0?S>=T.options.priority:!1:!0}function w(){for(let y of o.values())try{y.cleanup?.(),y.container.remove()}catch(S){console.error("[Surfaces] Error during cleanup:",S)}o.clear(),l.clear()}return{mount:v,getState:g,onStateChange:b,canMount:x,destroy:w}}var zo=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()}},Zc=new zo;var nf="2.0.0";function B2(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(rf(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(rf(n,i))return!0;return!1}return!0}function rf(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 Z_(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 rf(t,s)})}function Gc(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??Zc,a=r.executors??cr,l=r.apps??Ws,c=new is,u=Lc({telemetry:e,routes:n,navigation:c,initialSurfaceType:r.initialSurfaceType,initialSurfaceHost:r.initialSurfaceHost}),p=r.events??Ki(),h=Dc({namespace:s}),f=Fc({eventBus:p,stateStore:h}),v=Nc({state:h,events:p,sessionMetrics:t,accumulator:f}),m=Ab(),g=ec(),b=M=>Z_(M)?g.resolve(M.selector):null,x=async(M,F)=>{if(!Z_(M))return null;try{return await g.waitFor(M.selector,F)}catch{return null}},w=qc({overlayRoot:m,eventBus:p,anchorResolver:b,widgetRegistry:o}),y=Xl({overlayRoot:m,eventBus:p,surfaces:w,anchorResolver:b,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}}),S;if(t){let M=t;M.increment("page_views");let F=typeof window<"u"?window.location.pathname:"/";S=c.subscribe((V,P)=>{if(P!=="replaceState")try{let K=new URL(V).pathname;K!==F&&(F=K,M.increment("page_views"),T=0,M.set("time_on_page",0),M.set("scroll_depth",0))}catch{}})}let T=0,_,C;if(t){let M=t;_=setInterval(()=>{T++},1e3),C=setInterval(()=>{M.set("time_on_page",T)},5e3)}let R;if(t&&p){let M=t;R=p.subscribe({names:["ui.scroll"]},F=>{let V=F.props?.scrollPercentage;typeof V=="number"&&V>M.get("scroll_depth")&&M.set("scroll_depth",V)})}let N={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:y,surfaces:w,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:g,navigation:c,version:nf,mode:i,async evaluate(M){return v.evaluate(M,u.get())},evaluateSync(M){return v.evaluateSync(M,u.get())},async filterTiles(M){let F=u.get().page.url,V=[];for(let P of M){let K=P.activation;if(!K){V.push(P);continue}if(B2(F,K.routes)){if(K.onlyIfPopulated){let Y=P.props?.actions??[];if(Y.length>0&&!Y.some(D=>D.triggerWhen?v.evaluateSync(D.triggerWhen,u.get()).value:!0))continue}V.push(P)}}return V},setRoutes(M){u.setRoutes(M)},destroy(){l.unbind().catch(M=>{console.error("[Runtime] Error unbinding apps registry:",M)}),S?.(),R?.(),_&&clearInterval(_),C&&clearInterval(C),g.destroy(),f.destroy(),c.destroy(),u.destroy(),y.destroy(),w.destroy()}};return l.bind(N),o.bindRuntime(N),N}function G_(r){return r==="granted"?"granted":r==="denied"?"denied":"pending"}function sf(r){return r?Array.isArray(r)&&r[0]==="consent"?r[2]?.analytics_storage??null:typeof r=="object"&&r.event==="consent_update"?r.analytics_storage??null:null:null}var qo=class{constructor(){this.name="gtm-consent-mode-v2"}detect(){if(typeof window>"u")return!1;let e=window.dataLayer;if(!Array.isArray(e))return!1;for(let t of e)if(sf(t)!==null)return!0;return!1}initialize(e){if(typeof window>"u")return e("pending"),()=>{};Array.isArray(window.dataLayer)||(window.dataLayer=[]),e(this.readCurrentState());let t=window.dataLayer,n=t.push.bind(t),i=(...s)=>{let o=n(...s);for(let a of s){let l=sf(a);l!==null&&e(G_(l))}return o};return t.push=i,()=>{t.push===i&&(t.push=n)}}readCurrentState(){if(typeof window>"u")return"pending";let e=window.dataLayer;if(!Array.isArray(e))return"pending";for(let t=e.length-1;t>=0;t--){let n=sf(e[t]);if(n!==null)return G_(n)}return"pending"}};var Zo=class{constructor(){this.name="iab-tcf-v2"}detect(){return typeof window>"u"?!1:typeof window.__tcfapi=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.__tcfapi;if(typeof t!="function")return()=>{};let n;return t("addEventListener",2,(i,s)=>{if(!s||!i||(n===void 0&&typeof i.listenerId=="number"&&(n=i.listenerId),!(i.eventStatus==="tcloaded"||i.eventStatus==="useractioncomplete")))return;if(i.gdprApplies===!1){e("granted");return}let a=i.purpose?.consents??{},l=a[1]===!0,c=a[8]===!0;e(l&&c?"granted":"denied")}),()=>{if(n!==void 0)try{t("removeEventListener",2,()=>{},n)}catch{}}}};var K_="visitorConsentCollected",Go=class{constructor(){this.name="shopify-customer-privacy"}detect(){return typeof window>"u"?!1:typeof window.Shopify?.loadFeatures=="function"}initialize(e){if(e("pending"),typeof window>"u")return()=>{};let t=window.Shopify;if(!t?.loadFeatures)return()=>{};let n;return t.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],i=>{if(i)return;let s=t.customerPrivacy?.userCanBeTracked()??!0;e(s?"granted":"denied"),n=o=>{let a=o.detail;e(a?.analyticsAllowed?"granted":"denied")},document.addEventListener(K_,n)}),()=>{n&&document.removeEventListener(K_,n)}}};var Ko=class{constructor(e){this.options=e}async start(e){for(let n of this.options.adapters){let i=!1;try{i=n.detect()}catch{continue}if(i)try{let s=n.initialize(o=>e.setStatus(o));return this.options.onAdapterSelected?.(n.name),s}catch(s){console.warn(`[Syntro consent] Adapter "${n.name}" failed:`,s)}}this.options.onAdapterSelected?.(null);let t=await this.resolveFallback();return e.setStatus(t),()=>{}}async resolveFallback(){if(!this.options.fallbackStatus)return"pending";try{return await this.options.fallbackStatus()}catch{return"pending"}}};var Yo=class{constructor(e={}){this.listeners=new Set;this.destroyed=!1;this.status=e.initialStatus??"pending",this.configCallback=e.onConsentChange,this.gtmEnabled=e.readFromGtmConsentMode??!1,this.pendingResolverFn=e.pendingResolver}grant(){this.setStatus("granted")}deny(){this.setStatus("denied")}getStatus(){return this.status}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}subscribeOnce(e){if(this.status!=="pending")return queueMicrotask(()=>e(this.status)),()=>{};let t=this.subscribe(n=>{n!=="pending"&&(t(),e(n))});return t}async resolvePending(){if(this.status!=="pending")return this.status;if(!this.pendingResolverFn)return"denied";try{return await this.pendingResolverFn()}catch{return"denied"}}setStatus(e){this.applyStatus(e)}pollGtmConsent(){if(!this.gtmEnabled||typeof window>"u")return;let e=window.dataLayer;if(Array.isArray(e))for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n)continue;if(n[0]==="consent"&&n[1]==="update"&&n[2]){let s=n[2].analytics_storage;s==="granted"?this.setStatus("granted"):s==="denied"&&this.setStatus("denied");return}}}destroy(){this.destroyed=!0,this.listeners.clear()}applyStatus(e){this.destroyed||this.status!==e&&(this.status=e,this.notify(e))}notify(e){if(this.configCallback)try{this.configCallback(e)}catch{}for(let t of this.listeners)try{t(e)}catch{}}};var as=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 V2(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var of=class{constructor(){this.sessionId=V2(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,n){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,n){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}identify(e,t){}alias(e,t){}optInCapturing(){}optOutCapturing(){}};function Kc(){return new of}var E=typeof window<"u"?window:void 0,rt=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(rt.self=rt),typeof File>"u"&&(rt.File=function(){});var z0=Array.prototype,Y_=z0.forEach,X_=z0.indexOf,Et=rt?.navigator,U=rt?.document,tt=rt?.location,kf=rt?.fetch,Ef=rt!=null&&rt.XMLHttpRequest&&"withCredentials"in new rt.XMLHttpRequest?rt.XMLHttpRequest:void 0,J_=rt?.AbortController,_t=Et?.userAgent,ee=E??{},Or={DEBUG:!1,LIB_VERSION:"1.341.0"};function Q_(r,e,t,n,i,s,o){try{var a=r[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,i)}function ps(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){Q_(s,n,i,o,a,"next",l)}function a(l){Q_(s,n,i,o,a,"throw",l)}o(void 0)}))}}function z(){return z=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},z.apply(null,arguments)}function q0(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var U2=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],e0=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return U2.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},j2=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function he(r,e){return r.indexOf(e)!==-1}var Eu=function(r){return r.trim()},Cf=function(r){return r.replace(/^\$/,"")},W2=Array.isArray,Z0=Object.prototype,G0=Z0.hasOwnProperty,Cu=Z0.toString,be=W2||function(r){return Cu.call(r)==="[object Array]"},un=r=>typeof r=="function",ze=r=>r===Object(r)&&!be(r),hs=r=>{if(ze(r)){for(var e in r)if(G0.call(r,e))return!1;return!0}return!1},j=r=>r===void 0,qe=r=>Cu.call(r)=="[object String]",Af=r=>qe(r)&&r.trim().length===0,Zt=r=>r===null,ge=r=>j(r)||Zt(r),Br=r=>Cu.call(r)=="[object Number]"&&r==r,us=r=>Br(r)&&r>0,Hr=r=>Cu.call(r)==="[object Boolean]",z2=r=>r instanceof FormData,q2=r=>he(j2,r);function Tf(r){return r===null||typeof r!="object"}function nu(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function K0(r){return!j(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var Z2=[!0,"true",1,"1","yes"],af=r=>he(Z2,r),G2=[!1,"false",0,"0","no"];function hr(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),Br(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),hr(i||t,e,t,n))}var Rf=class{constructor(e){this.t={},this.i=e.i,this.o=hr(e.bucketSize,0,100,e.h),this.m=hr(e.refillRate,0,this.o,e.h),this.$=hr(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={}}},Pt="Mobile",iu="iOS",Dr="Android",va="Tablet",Y0=Dr+" "+va,X0="iPad",J0="Apple",Q0=J0+" Watch",ya="Safari",vs="BlackBerry",ex="Samsung",tx=ex+"Browser",rx=ex+" Internet",ai="Chrome",K2=ai+" OS",nx=ai+" "+iu,Fg="Internet Explorer",ix=Fg+" "+Pt,Dg="Opera",Y2=Dg+" Mini",Hg="Edge",sx="Microsoft "+Hg,gs="Firefox",ox=gs+" "+iu,ba="Nintendo",_a="PlayStation",ms="Xbox",ax=Dr+" "+Pt,lx=Pt+" "+ya,oa="Windows",If=oa+" Phone",t0="Nokia",$f="Ouya",cx="Generic",X2=cx+" "+Pt.toLowerCase(),ux=cx+" "+va.toLowerCase(),Mf="Konqueror",pt="(\\d+(\\.\\d+)?)",lf=new RegExp("Version/"+pt),J2=new RegExp(ms,"i"),Q2=new RegExp(_a+" \\w+","i"),eT=new RegExp(ba+" \\w+","i"),Bg=new RegExp(vs+"|PlayBook|BB10","i"),tT={"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"},Yc,r0,cf,rT=(r,e)=>e&&he(e,J0)||(function(t){return he(t,ya)&&!he(t,ai)&&!he(t,Dr)})(r),dx=function(r,e){return e=e||"",he(r," OPR/")&&he(r,"Mini")?Y2:he(r," OPR/")?Dg:Bg.test(r)?vs:he(r,"IE"+Pt)||he(r,"WPDesktop")?ix:he(r,tx)?rx:he(r,Hg)||he(r,"Edg/")?sx:he(r,"FBIOS")?"Facebook "+Pt:he(r,"UCWEB")||he(r,"UCBrowser")?"UC Browser":he(r,"CriOS")?nx:he(r,"CrMo")||he(r,ai)?ai:he(r,Dr)&&he(r,ya)?ax:he(r,"FxiOS")?ox:he(r.toLowerCase(),Mf.toLowerCase())?Mf:rT(r,e)?he(r,Pt)?lx:ya:he(r,gs)?gs:he(r,"MSIE")||he(r,"Trident/")?Fg:he(r,"Gecko")?gs:""},nT={[ix]:[new RegExp("rv:"+pt)],[sx]:[new RegExp(Hg+"?\\/"+pt)],[ai]:[new RegExp("("+ai+"|CrMo)\\/"+pt)],[nx]:[new RegExp("CriOS\\/"+pt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pt)],[ya]:[lf],[lx]:[lf],[Dg]:[new RegExp("(Opera|OPR)\\/"+pt)],[gs]:[new RegExp(gs+"\\/"+pt)],[ox]:[new RegExp("FxiOS\\/"+pt)],[Mf]:[new RegExp("Konqueror[:/]?"+pt,"i")],[vs]:[new RegExp(vs+" "+pt),lf],[ax]:[new RegExp("android\\s"+pt,"i")],[rx]:[new RegExp(tx+"\\/"+pt)],[Fg]:[new RegExp("(rv:|MSIE )"+pt)],Mozilla:[new RegExp("rv:"+pt)]},iT=function(r,e){var t=dx(r,e),n=nT[t];if(j(n))return null;for(var i=0;i<n.length;i++){var s=n[i],o=r.match(s);if(o)return parseFloat(o[o.length-2])}return null},n0=[[new RegExp(ms+"; "+ms+" (.*?)[);]","i"),r=>[ms,r&&r[1]||""]],[new RegExp(ba,"i"),[ba,""]],[new RegExp(_a,"i"),[_a,""]],[Bg,[vs,""]],[new RegExp(oa,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[If,""];if(new RegExp(Pt).test(e)&&!/IEMobile\b/.test(e))return[oa+" "+Pt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=tT[n]||"";return/arm/i.test(e)&&(i="RT"),[oa,i]}return[oa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[iu,e.join(".")]}return[iu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=j(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Dr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Dr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Dr,e.join(".")]}return[Dr,""]}],[/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/,[K2,""]],[/Linux|debian/i,["Linux",""]]],i0=function(r){return eT.test(r)?ba:Q2.test(r)?_a:J2.test(r)?ms:new RegExp($f,"i").test(r)?$f:new RegExp("("+If+"|WPDesktop)","i").test(r)?If:/iPad/.test(r)?X0:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Q0:Bg.test(r)?vs:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(t0,"i").test(r)?t0:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(Pt).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)?Dr:Y0:new RegExp("(pda|"+Pt+")","i").test(r)?X2:new RegExp(va,"i").test(r)&&!new RegExp(va+" pc","i").test(r)?ux:""},sT=r=>r instanceof Error;function oT(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return cf&&t.length===r0||(r0=t.length,cf=t.reduce(((n,i)=>{Yc||(Yc={});var s=Yc[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,Yc[i]=[c,u];break}}return n}),{})),cf}}var Pf=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 ps((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&be(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)),z({},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 ps((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,z({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:oT(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 z({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},ys="?";function Of(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?ys:t,in_app:!0};return j(n)||(s.lineno=n),j(i)||(s.colno=i),s}var px=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,n=r.indexOf("safari-web-extension")!==-1;return t||n?[r.indexOf("@")!==-1?r.split("@")[0]:ys,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},aT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,lT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cT=/\((\S*)(?::(\d+))(?::(\d+))\)/,uT=(r,e)=>{var t=aT.exec(r);if(t){var[,n,i,s]=t;return Of(e,n,ys,+i,+s)}var o=lT.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=cT.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=px(o[1]||ys,o[2]);return Of(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},dT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hT=(r,e)=>{var t=dT.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=pT.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]||ys;return[s,i]=px(s,i),Of(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},s0=/\(error: (.*)\)/,o0=50;function fT(){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(`
|
|
1063
|
+
`),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=s0.test(c)?c.replace(s0,"$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>=o0)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,o0).map((m=>{return z({},m,{filename:m.filename||(g=v,g[g.length-1]||{}).filename,function:m.function||ys});var g}))})(o)}})("web:javascript",uT,hT)}var Lf=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=qe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return nu(e,"DOMException")}isDOMError(e){return nu(e,"DOMError")}},Nf=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}},Ff=class{constructor(){}match(e){return nu(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}}},gT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Df=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(gT);return i&&(t=i[1],n=i[2]),[t,n]}},mT=["fatal","error","warning","log","info","debug"];function hx(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var n=t.length;n>0;n--){var i=t.slice(0,n).join(", ");if(!(i.length>e))return n===t.length||i.length<=e?i:i.slice(0,e)+"..."}return""}var Hf=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=t.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return K0(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+hx(e)}isSeverityLevel(e){return qe(e)&&!Af(e)&&mT.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(sT(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Bf=class{match(e){return K0(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+hx(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Vf=class{match(e){return Tf(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}}},Uf=class{match(e){return nu(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Tf(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(Tf(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},fx=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(Or.DEBUG||ee.POSTHOG_DEBUG||t)&&!j(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];s(r,...a)}},info:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("log",...s)},warn:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("warn",...s)},error:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("error",...s)},critical:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];console.error(r,...s)},uninitializedWarning:i=>{n.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>fx(r+" "+i,s)};return n},W=fx("[PostHog.js]"),Le=W.createLogger,vT=Le("[ExternalScriptsLoader]"),a0=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return vT.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=U?.querySelectorAll("script");if(n){for(var i,s=function(){if(n[o].src===e){var l=n[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;o<n.length;o++)if(i=s())return i.v}var a=()=>{if(!U)return t("document not found");var l=U.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=p=>{l.__posthog_loading_callback_fired=!0,t(void 0,p)},l.onerror=p=>t(p),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")U.head.appendChild(l);else{var c,u=U.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):U.body.appendChild(l)}};U!=null&&U.body?a():U?.addEventListener("DOMContentLoaded",a)};ee.__PosthogExtensions__=ee.__PosthogExtensions__||{},ee.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var n="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(n="/array/"+r.config.token+"/config.js"),e==="toolbar"){var i=3e5;n=n+"&t="+Math.floor(Date.now()/i)*i}var s=r.requestRouter.endpointFor("assets",n);a0(r,s,t)},ee.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);a0(r,n,t)};var su={};function dn(r,e,t){if(be(r)){if(Y_&&r.forEach===Y_)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var n=0,i=r.length;n<i;n++)if(n in r&&e.call(t,r[n],n)===su)return}}}function Ae(r,e,t){if(!ge(r)){if(be(r))return dn(r,e,t);if(z2(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===su)return}else for(var i in r)if(G0.call(r,i)&&e.call(t,r[i],i)===su)return}}var He=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return dn(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},_s=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 dn(t,(function(i){dn(i,(function(s){r.push(s)}))})),r};function tu(r){for(var e=Object.keys(r),t=e.length,n=new Array(t);t--;)n[t]=[e[t],r[e[t]]];return n}var l0=function(r){try{return r()}catch{return}},yT=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){W.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),W.critical(i)}}},Vg=function(r){var e={};return Ae(r,(function(t,n){(qe(t)&&t.length>0||Br(t))&&(e[n]=t)})),e};function bT(r,e){return t=r,n=s=>qe(s)&&!Zt(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),be(o)?(l=[],dn(o,(c=>{l.push(s(c))}))):(l={},Ae(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var _T=["herokuapp.com","vercel.app","netlify.app"];function xT(r){var e=r?.hostname;if(!qe(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of _T)if(t===n)return!1;return!0}function gx(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function je(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var mx="$people_distinct_id",aa="__alias",la="__timers",c0="$autocapture_disabled_server_side",jf="$heatmaps_enabled_server_side",u0="$exception_capture_enabled_server_side",Wf="$error_tracking_suppression_rules",d0="$error_tracking_capture_extension_exceptions",p0="$web_vitals_enabled_server_side",vx="$dead_clicks_enabled_server_side",h0="$product_tours_enabled_server_side",f0="$web_vitals_allowed_metrics",uf="$session_recording_remote_config",ou="$sesid",yx="$session_is_sampled",fs="$enabled_feature_flags",ca="$early_access_features",zf="$feature_flag_details",ua="$stored_person_properties",oi="$stored_group_properties",qf="$surveys",au="$flag_call_reported",Lr="$user_state",Zf="$client_session_props",Gf="$capture_rate_limit",Kf="$initial_campaign_params",Yf="$initial_referrer_info",lu="$initial_person_info",cu="$epp",bx="__POSTHOG_TOOLBAR__",Xo="$posthog_cookieless",wT=[mx,aa,"__cmpns",la,"$session_recording_enabled_server_side",jf,ou,fs,Wf,Lr,ca,zf,oi,ua,qf,au,Zf,Gf,Kf,Yf,cu,lu,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function g0(r){return r instanceof Element&&(r.id===bx||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Au(r){return!!r&&r.nodeType===1}function pn(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function _x(r){return!!r&&r.nodeType===3}function xx(r){return!!r&&r.nodeType===11}function Ug(r){return r?Eu(r).split(/\s+/):[]}function m0(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function uu(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 Ug(e)}function wx(r){return ge(r)?null:Eu(r).split(/(\s+)/).filter((e=>xa(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Sa(r){var e="";return Xf(r)&&!Ax(r)&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;_x(t)&&t.textContent&&(e+=(n=wx(t.textContent))!==null&&n!==void 0?n:"")})),Eu(e)}function Sx(r){return j(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var jg=["a","button","form","input","select","textarea","label"];function kx(r,e){if(j(e))return!0;var t,n=function(s){if(e.some((o=>s.matches(o))))return{v:!0}};for(var i of r)if(t=n(i))return t.v;return!1}function Ex(r){var e=r.parentNode;return!(!e||!Au(e))&&e}var ST=["next","previous","prev",">","<"],v0=10,y0=[".ph-no-rageclick",".ph-no-capture"];function kT(r,e){if(!E||Wg(r))return!1;var t,n,i;if(Hr(e)?(t=!!e&&y0,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:y0,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=Cx(r,!1);return!(function(o,a){if(o===!1||j(o))return!1;var l;if(o===!0)l=ST;else{if(!be(o))return!1;if(o.length>v0)return W.error("[PostHog] content_ignorelist array cannot exceed "+v0+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:p}=c;return l.some((h=>u.includes(h)||p.includes(h)))}))})(n,s.map((o=>{var a;return{safeText:Sa(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!kx(s,t)}var Wg=r=>!r||pn(r,"html")||!Au(r),Cx=(r,e)=>{if(!E||Wg(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!pn(i,"body");)if(xx(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=Ex(i);if(!s)break;if(e||jg.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 ET(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||Wg(r)||(s=t)!=null&&s.url_allowlist&&!m0(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&m0(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:u,targetElementList:p}=Cx(r,n);if(!(function(v,m){var g=m?.element_allowlist;if(j(g))return!0;var b,x=function(y){if(g.some((S=>y.tagName.toLowerCase()===S)))return{v:!0}};for(var w of v)if(b=x(w))return b.v;return!1})(p,t)||!kx(p,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var h=E.getComputedStyle(r);if(h&&h.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return u?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(jg.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Xf(r){for(var e=r;e.parentNode&&!pn(e,"body");e=e.parentNode){var t=uu(e);if(he(t,"ph-sensitive")||he(t,"ph-no-capture"))return!1}if(he(uu(r),"ph-include"))return!0;var n=r.type||"";if(qe(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(qe(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function Ax(r){return!!(pn(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||pn(r,"select")||pn(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Tx="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",CT=new RegExp("^(?:"+Tx+")$"),AT=new RegExp(Tx),Rx="\\d{3}-?\\d{2}-?\\d{4}",TT=new RegExp("^("+Rx+")$"),RT=new RegExp("("+Rx+")");function xa(r,e){return e===void 0&&(e=!0),!(ge(r)||qe(r)&&(r=Eu(r),(e?CT:AT).test((r||"").replace(/[- ]/g,""))||(e?TT:RT).test(r)))}function Ix(r){var e=Sa(r);return xa(e=(e+" "+$x(r)).trim())?e:""}function $x(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Ae(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=Sa(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+$x(t)).trim())}catch(s){W.error("[AutoCapture]",s)}})),e}function IT(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=z({},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 tu(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[b0(p.toString())]=b0(h.toString())})),o+=":",o+=tu(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:$T(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return tu(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return s.attributes[a]=l})),s}))})(r))}function b0(r){return r.replace(/"|\\"/g,'\\"')}function $T(r){var e=r.attr__class;return e?be(e)?e:Ug(e):void 0}var du=class{constructor(e){this.disabled=e===!1;var t=ze(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&n-i.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},pu=r=>{var e=U?.createElement("a");return j(e)?null:(e.href=r,e)},MT=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return Ae(r,(function(s,o){j(s)||j(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),n=encodeURIComponent(o),i[i.length]=n+"="+t)})),i.join(e)},hu=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(!be(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{W.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ka=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("=");be(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},fu=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},df="$copy_autocapture",_0=Le("[AutoCapture]");function pf(r,e){return e.length>r?e.slice(0,r)+"...":e}function PT(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Au(e));return e}function OT(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};jg.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=pf(1024,Ix(r)):s.$el_text=pf(1024,Sa(r)));var o=uu(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),Ae(r.attributes,(function(u){var p;if((!Ax(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&xa(u.value)&&(p=u.name,!qe(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=Ug(h).join(" ")),s["attr__"+u.name]=pf(1024,h)}}));for(var a=1,l=1,c=r;c=PT(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function LT(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!pn(u,"body");)xx(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(Ae(c,(y=>{var S=Xf(y);y.tagName.toLowerCase()==="a"&&(v=y.getAttribute("href"),v=S&&v&&xa(v)&&v),he(uu(y),"ph-no-capture")&&(m=!0),h.push(OT(y,s,o,a));var T=(function(_){if(!Xf(_))return{};var C={};return Ae(_.attributes,(function(R){if(R.name&&R.name.indexOf("data-ph-capture-attribute")===0){var N=R.name.replace("data-ph-capture-attribute-",""),M=R.value;N&&M&&xa(M)&&(C[N]=M)}})),C})(y);He(f,T)})),m)return{props:{},explicitNoCapture:m};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Ix(r):h[0].$el_text=Sa(r)),v){var g,b;h[0].attr__href=v;var x=(g=pu(v))==null?void 0:g.host,w=E==null||(b=E.location)==null?void 0:b.host;x&&w&&x!==w&&(p=v)}return{props:He({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:IT(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 Jf=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new du(e.config.rageclick),this.C=null}get R(){var e,t,n=ze(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}F(){if(this.isBrowserSupported()){if(E&&U){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){_0.error("Failed to capture event",i)}};if(je(U,"submit",e,{capture:!0}),je(U,"change",e,{capture:!0}),je(U,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,df)};je(U,"copy",t,{capture:!0}),je(U,"cut",t,{capture:!0})}}}else _0.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c0]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((i=>{var s=U?.querySelectorAll(i);s?.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[c0],i=this.T;if(Zt(i)&&!Hr(n)&&!this.instance.M())return!1;var s=(t=this.T)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Sx(e);_x(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&kT(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===df;if(i&&ET(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=LT(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===df){var c,u=wx(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 un(U?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Br(r)&&isFinite(r)&&Math.floor(r)===r});var x0="0123456789abcdef",Qf=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||e<0||t<0||n<0||i<0||e>0xffffffffffff||t>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new r(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+x0.charAt(this.bytes[t]>>>4)+x0.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},eg=class{constructor(){this.A=0,this.j=0,this.D=new tg}generate(){var e=this.generateOrAbort();if(j(e)){this.A=0;var t=this.generateOrAbort();if(j(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return Qf.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},w0,Mx=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};E&&!j(E.crypto)&&crypto.getRandomValues&&(Mx=r=>crypto.getRandomValues(r));var tg=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Mx(this.N),this.U=0),this.N[this.U++]}},cn=()=>NT().toString(),NT=()=>(w0||(w0=new eg)).generate(),Jo="",FT=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function DT(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=U),Jo)return Jo;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+cn();!Jo&&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",Jo=c)}return Jo})(r);if(!t){var n=(i=>{var s=i.match(FT);return s?s[0]:""})(r);n!==t&&W.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var pr={H:()=>!!U,B:function(r){W.error("cookieStore error: "+r)},q:function(r){if(U){try{for(var e=r+"=",t=U.cookie.split(";").filter((s=>s.length)),n=0;n<t.length;n++){for(var i=t[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(pr.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(U)try{var s="",o="",a=DT(U.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&W.warn("cookieStore warning: large cookie, len="+c.length),U.cookie=c,c}catch{return}},V:function(r,e){if(U!=null&&U.cookie)try{pr.G(r,"",-1,e)}catch{return}}},hf=null,Me={H:function(){if(!Zt(hf))return hf;var r=!0;if(j(E))r=!1;else try{var e="__mplssupport__";Me.G(e,"xyz"),Me.q(e)!=='"xyz"'&&(r=!1),Me.V(e)}catch{r=!1}return r||W.error("localStorage unsupported; falling back to cookie store"),hf=r,r},B:function(r){W.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Me.B(e)}return null},W:function(r){try{return JSON.parse(Me.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Me.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Me.B(e)}}},HT=["$device_id","distinct_id",ou,yx,cu,lu],Xc={},BT={H:function(){return!0},B:function(r){W.error("memoryStorage error: "+r)},q:function(r){return Xc[r]||null},W:function(r){return Xc[r]||null},G:function(r,e){Xc[r]=e},V:function(r){delete Xc[r]}},ii=null,et={H:function(){if(!Zt(ii))return ii;if(ii=!0,j(E))ii=!1;else try{var r="__support__";et.G(r,"xyz"),et.q(r)!=='"xyz"'&&(ii=!1),et.V(r)}catch{ii=!1}return ii},B:function(r){W.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){et.B(e)}return null},W:function(r){try{return JSON.parse(et.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){et.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){et.B(e)}}},Nr=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),rg=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Nr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Nr.DENIED||this.consent===Nr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Nr.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 af(e)?Nr.GRANTED:he(G2,e)?Nr.DENIED:Nr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Me:pr;var t=e==="localStorage"?pr:Me;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(af(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!gx([Et?.doNotTrack,Et?.msDoNotTrack,ee.doNotTrack],(e=>af(e)))}},Jc=Le("[Dead Clicks]"),VT=()=>!0,UT=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(vx)),n=r.instance.config.capture_dead_clicks;return Hr(n)?n:!!ze(n)||t},gu=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[vx]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Jc.error("failed to load script",i):e()}))}et(){var e;if(U){if(!this.tt&&(e=ee.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=ze(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=ee.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(U),Jc.info("starting...")}}else Jc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Jc.info("stopping..."))}},Qo=Le("[ExceptionAutocapture]"),ng=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=ee.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=ee.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=ee.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=ee.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(c){Qo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[u0]),this.dt=new Rf({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:Qo}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ze(e)?t=z({},t,e):(j(e)?this.ht:e)&&(t=z({},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?(Qo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Qo.error("failed to load script",i);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[u0]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,n,i=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(i)?Qo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function S0(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return un(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var ig=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&&(W.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,W.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||S0(E.history,"pushState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("pushState")})),(t=E.history.replaceState)!=null&&t.__posthog_wrapped__||S0(E.history,"replaceState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("replaceState")})),this.bt()}}_t(e){try{var t,n=E==null||(t=E.location)==null?void 0:t.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=n}catch(i){W.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};je(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},ff=Le("[SegmentIntegration]");function jT(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()||cn();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(Lr,"identified")),i()},a=s.user();"then"in a&&un(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||ff.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()||(ff.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(ff.info("UserId set, identifying with PostHog"),n.identify(s.event.userId));var a=n.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(r)).then((()=>{e()}))}))}var Px="posthog-js";function Ox(r,e){var{organization:t,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,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((b=>z({},b,{stacktrace:b.stacktrace?z({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map((x=>z({},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 sg=class{constructor(e,t,n,i,s,o){this.name=Px,this.setupOnce=function(a){a(Ox(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},WT=E!=null&&E.location?fu(E.location.hash,"__posthog")||fu(location.hash,"state"):null,k0="_postHogToolbarParams",E0=Le("[Toolbar]"),ln=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(ln||{}),og=class{constructor(e){this.instance=e}yt(e){ee.ph_toolbar_state=e}wt(){var e;return(e=ee.ph_toolbar_state)!==null&&e!==void 0?e:ln.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!E||!U)return!1;e=e??E.location,n=n??E.history;try{if(!t){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}t=E?.localStorage}var i,s=WT||fu(e.hash,"__posthog")||fu(e.hash,"state"),o=s?l0((()=>JSON.parse(atob(decodeURIComponent(s)))))||l0((()=>JSON.parse(decodeURIComponent(s)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(k0)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=ee.ph_load_toolbar||ee.ph_load_editor;!ge(t)&&un(t)?t(e,this.instance):E0.warn("No toolbar load function found")}loadToolbar(e){var t=!(U==null||!U.getElementById(bx));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=z({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(k0,JSON.stringify(z({},i,{source:void 0}))),this.wt()===ln.LOADED)this.xt(i);else if(this.wt()===ln.UNINITIALIZED){var s;this.yt(ln.LOADING),(s=ee.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return E0.error("[Toolbar] Failed to load",o),void this.yt(ln.UNINITIALIZED);this.yt(ln.LOADED),this.xt(i)})),je(E,"turbolinks:load",(()=>{this.yt(ln.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)}},zT=Le("[TracingHeaders]"),ag=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;j(this.$t)&&((t=ee.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.St)&&((n=ee.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return zT.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)}},Qc="https?://(.*)",xs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],qT=_s(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],xs),Ea="<masked>",ZT=["li_fat_id"];function Lx(r,e,t){if(!U)return{};var n,i=e?_s([],xs,t||[]):[],s=Nx(ka(U.URL,i,Ea),r),o=(n={},Ae(ZT,(function(a){var l=pr.q(a);n[a]=l||null})),n);return He(o,s)}function Nx(r,e){var t=qT.concat(e||[]),n={};return Ae(t,(function(i){var s=hu(r,i);n[i]=s||null})),n}function Fx(r){var e=(function(s){return s?s.search(Qc+"google.([^/?]*)")===0?"google":s.search(Qc+"bing.com")===0?"bing":s.search(Qc+"yahoo.com")===0?"yahoo":s.search(Qc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Zt(e)){n.$search_engine=e;var i=U?hu(U.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function C0(){return navigator.language||navigator.userLanguage}function Dx(){return U?.referrer||"$direct"}function Hx(r,e){var t=r?_s([],xs,e||[]):[],n=tt?.href.substring(0,1e3);return{r:Dx().substring(0,1e3),u:n?ka(n,t,Ea):void 0}}function Bx(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=pu(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=pu(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=Nx(n);He(i,o)}if(t){var a=Fx(t);He(i,a)}return i}function Vx(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function GT(){try{return new Date().getTimezoneOffset()}catch{return}}function KT(r,e){if(!_t)return{};var t,n,i,s=r?_s([],xs,e||[]):[],[o,a]=(function(l){for(var c=0;c<n0.length;c++){var[u,p]=n0[c],h=u.exec(l),f=h&&(un(p)?p(h,l):p);if(f)return f}return["",""]})(_t);return He(Vg({$os:o,$os_version:a,$browser:dx(_t,navigator.vendor),$device:i0(_t),$device_type:(n=_t,i=i0(n),i===X0||i===Y0||i==="Kobo"||i==="Kindle Fire"||i===ux?va:i===ba||i===ms||i===_a||i===$f?"Console":i===Q0?"Wearable":i?Pt:"Desktop"),$timezone:Vx(),$timezone_offset:GT()}),{$current_url:ka(tt?.href,s,Ea),$host:tt?.host,$pathname:tt?.pathname,$raw_user_agent:_t.length>1e3?_t.substring(0,997)+"...":_t,$browser_version:iT(_t,navigator.vendor),$browser_language:C0(),$browser_language_prefix:(t=C0(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:"web",$lib_version:Or.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var sn=Le("[Web Vitals]"),A0=9e5,lg=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)=>z({},n,{["$web_vitals_"+i.name+"_event"]:z({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=n=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(j(s))sn.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();j(o)||(ge(n?.name)||ge(n?.value)?sn.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?sn.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),j(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=j(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(z({},n,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var n,i,s,o,a=ee.__PosthogExtensions__;j(a)||j(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),n&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):sn.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[p0]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=ze(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ge(n)?((t=this._instance.persistence)==null?void 0:t.props[f0])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=ze(this._instance.config.capture_performance)&&Br(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:A0;return 0<e&&e<=6e4?A0:e}get isEnabled(){var e=tt?.protocol;if(e!=="http:"&&e!=="https:")return sn.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Hr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Hr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(sn.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=ze(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=ze(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p0]:t}),this._instance.persistence.register({[f0]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=ee.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?sn.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?_s([],xs,n||[]):[];return ka(e,i,Ea)}sn.error("Could not determine current URL")}},YT=Le("[Heatmaps]");function T0(r){return ze(r)&&"clientX"in r&&"clientY"in r&&Br(r.clientX)&&Br(r.clientY)}var cg=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[jf]),this.rageclicks=new du(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return ze(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ge(this.instance.config.capture_heatmaps)?ge(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;YT.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({[jf]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(U)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&U&&(this.Nt=this.Lt.bind(this),je(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),je(U,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),je(U,"mousemove",this.zt,{capture:!0}),this.Bt=new gu(this.instance,VT,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),je(U,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&U&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&U.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&U.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&U.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=(function(a,l,c){for(var u=a;u&&Au(u)&&!pn(u,"body");){if(u===c)return!1;if(he(l,E?.getComputedStyle(u).position))return!0;u=Ex(u)}return!1})(Sx(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Dt(e,t){var n;if(t===void 0&&(t="click"),!g0(e.target)&&T0(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(z({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!g0(e.target)&&T0(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(E){var t=E.location.href,n=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,s=n?_s([],xs,i||[]):[],o=ka(t,s,Ea);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!hs(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},mu=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(W.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(!(j(o)||j(a)||j(l)||j(c)||j(u)||j(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:hr(a/o,0,1,W),f=o<=1?1:hr(l/o,0,1,W),v=c<=1?1:hr(u/c,0,1,W),m=c<=1?1:hr(p/c,0,1,W);i=He(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content: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 Fr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Ot=Uint8Array,ht=Uint16Array,bs=Uint32Array,zg=new Ot([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]),qg=new Ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),R0=new Ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ux=function(r,e){for(var t=new ht(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new bs(t[30]);for(n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},jx=Ux(zg,2),XT=jx[0],ug=jx[1];XT[28]=258,ug[258]=28;for(dg=Ux(qg,0)[1],vu=new ht(32768),Te=0;Te<32768;++Te)on=(43690&Te)>>>1|(21845&Te)<<1,on=(61680&(on=(52428&on)>>>2|(13107&on)<<2))>>>4|(3855&on)<<4,vu[Te]=((65280&on)>>>8|(255&on)<<8)>>>1;var on,dg,vu,Te,fa=function(r,e,t){for(var n=r.length,i=0,s=new ht(e);i<n;++i)++s[r[i]-1];var o,a=new ht(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new ht(1<<e);var l=15-e;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],u=e-r[i],p=a[r[i]-1]++<<u,h=p|(1<<u)-1;p<=h;++p)o[vu[p]>>>l]=c}else for(o=new ht(n),i=0;i<n;++i)o[i]=vu[a[r[i]-1]++]>>>15-r[i];return o},li=new Ot(288);for(Te=0;Te<144;++Te)li[Te]=8;for(Te=144;Te<256;++Te)li[Te]=9;for(Te=256;Te<280;++Te)li[Te]=7;for(Te=280;Te<288;++Te)li[Te]=8;var yu=new Ot(32);for(Te=0;Te<32;++Te)yu[Te]=5;var JT=fa(li,9,0),QT=fa(yu,5,0),Wx=function(r){return(r/8>>0)+(7&r&&1)},zx=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof ht?ht:r instanceof bs?bs:Ot)(t-e);return n.set(r.subarray(e,t)),n},Mr=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},ea=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},gf=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 Ot(0),0];if(i==1){var o=new Ot(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(S,T){return S.f-T.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,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 ht(h+1),v=pg(t[u-1],f,0);if(v>e){n=0;var m=0,g=v-e,b=1<<g;for(s.sort((function(S,T){return f[T.s]-f[S.s]||S.f-T.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;m+=b-(1<<v-f[x]),f[x]=e}for(m>>>=g;m>0;){var w=s[n].s;f[w]<e?m-=1<<e-f[w]++-1:++n}for(;n>=0&&m;--n){var y=s[n].s;f[y]==e&&(--f[y],++m)}v=e}return[new Ot(f),v]},pg=function(r,e,t){return r.s==-1?Math.max(pg(r.l,e,t+1),pg(r.r,e,t+1)):e[r.s]=t},I0=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new ht(++e),n=0,i=r[0],s=1,o=function(l){t[n++]=l},a=1;a<=e;++a)if(r[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=r[a]}return[t.subarray(0,n),e]},ta=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},hg=function(r,e,t){var n=t.length,i=Wx(e+2);r[i]=255&n,r[i+1]=n>>>8,r[i+2]=255^r[i],r[i+3]=255^r[i+1];for(var s=0;s<n;++s)r[i+s+4]=t[s];return 8*(i+4+n)},$0=function(r,e,t,n,i,s,o,a,l,c,u){Mr(e,u++,t),++i[256];for(var p=gf(i,15),h=p[0],f=p[1],v=gf(s,15),m=v[0],g=v[1],b=I0(h),x=b[0],w=b[1],y=I0(m),S=y[0],T=y[1],_=new ht(19),C=0;C<x.length;++C)_[31&x[C]]++;for(C=0;C<S.length;++C)_[31&S[C]]++;for(var R=gf(_,7),N=R[0],M=R[1],F=19;F>4&&!N[R0[F-1]];--F);var V,P,K,Y,le=c+5<<3,D=ta(i,li)+ta(s,yu)+o,te=ta(i,h)+ta(s,m)+o+14+3*F+ta(_,N)+(2*_[16]+3*_[17]+7*_[18]);if(le<=D&&le<=te)return hg(e,u,r.subarray(l,l+c));if(Mr(e,u,1+(te<D)),u+=2,te<D){V=fa(h,f,0),P=h,K=fa(m,g,0),Y=m;var Ze=fa(N,M,0);for(Mr(e,u,w-257),Mr(e,u+5,T-1),Mr(e,u+10,F-4),u+=14,C=0;C<F;++C)Mr(e,u+3*C,N[R0[C]]);u+=3*F;for(var ot=[x,S],Ne=0;Ne<2;++Ne){var H=ot[Ne];for(C=0;C<H.length;++C){var Q=31&H[C];Mr(e,u,Ze[Q]),u+=N[Q],Q>15&&(Mr(e,u,H[C]>>>5&127),u+=H[C]>>>12)}}}else V=JT,P=li,K=QT,Y=yu;for(C=0;C<a;++C)if(n[C]>255){Q=n[C]>>>18&31,ea(e,u,V[Q+257]),u+=P[Q+257],Q>7&&(Mr(e,u,n[C]>>>23&31),u+=zg[Q]);var re=31&n[C];ea(e,u,K[re]),u+=Y[re],re>3&&(ea(e,u,n[C]>>>5&8191),u+=qg[re])}else ea(e,u,V[n[C]]),u+=P[n[C]];return ea(e,u,V[256]),u+P[256]},eR=new bs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tR=(function(){for(var r=new bs(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),rR=function(r,e,t,n,i){return(function(s,o,a,l,c,u){var p=s.length,h=new Ot(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=hg(f,v,s.subarray(m,g)):(f[m]=u,v=hg(f,v,s.subarray(m,p)))}else{for(var b=eR[o-1],x=b>>>13,w=8191&b,y=(1<<a)-1,S=new ht(32768),T=new ht(y+1),_=Math.ceil(a/3),C=2*_,R=function(Pu){return(s[Pu]^s[Pu+1]<<_^s[Pu+2]<<C)&y},N=new bs(25e3),M=new ht(288),F=new ht(32),V=0,P=0,K=(m=0,0),Y=0,le=0;m<p;++m){var D=R(m),te=32767&m,Ze=T[D];if(S[te]=Ze,T[D]=te,Y<=m){var ot=p-m;if((V>7e3||K>24576)&&ot>423){v=$0(s,f,0,N,M,F,P,K,le,m-le,v),K=V=P=0,le=m;for(var Ne=0;Ne<286;++Ne)M[Ne]=0;for(Ne=0;Ne<30;++Ne)F[Ne]=0}var H=2,Q=0,re=w,fe=te-Ze&32767;if(ot>2&&D==R(m-fe))for(var Ce=Math.min(x,ot)-1,Se=Math.min(32767,m),Ie=Math.min(258,ot);fe<=Se&&--re&&te!=Ze;){if(s[m+H]==s[m+H-fe]){for(var Fe=0;Fe<Ie&&s[m+Fe]==s[m+Fe-fe];++Fe);if(Fe>H){if(H=Fe,Q=fe,Fe>Ce)break;var Gt=Math.min(fe,Fe-2),Ca=0;for(Ne=0;Ne<Gt;++Ne){var hn=m-fe+Ne+32768&32767,De=hn-S[hn]+32768&32767;De>Ca&&(Ca=De,Ze=hn)}}}fe+=(te=Ze)-(Ze=S[te])+32768&32767}if(Q){N[K++]=268435456|ug[H]<<18|dg[Q];var Aa=31&ug[H],Jg=31&dg[Q];P+=zg[Aa]+qg[Jg],++M[257+Aa],++F[Jg],Y=m+H,++V}else N[K++]=s[m],++M[s[m]]}}v=$0(s,f,u,N,M,F,P,K,le,m-le,v)}return zx(h,0,l+Wx(v)+c)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,n,!0)},mf=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function nR(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=tR[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=rR(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&&mf(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),mf(s,o-8,t.d()),mf(s,o-4,n),s}var iR=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
|
|
1064
1064
|
`).replace(/\r/g,`
|
|
1065
|
-
`)).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),zt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},YT=!!_f||!!bf,E0="text/plain",vu=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=W({},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=ST(o);return l&&a.push(l),i+"?"+a.join("&")},da=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),pf=r=>{var{data:e,compression:t}=r;if(e){if(t===Nr.GZipJS){var n=GT((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new Mt(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 Mt(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 Dx(p,0,h)})(da(e)),{mtime:0}),i=new Blob([n],{type:E0});return{contentType:E0,body:i,estimatedSize:i.size}}if(t===Nr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,y="",x=[];if(!l)return l;l=KT(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})(da(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:da(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=da(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},eu=[];bf&&eu.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=pf(r))!==null&&e!==void 0?e:{},o=new Headers;Ae(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(z_){var c=new z_;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}bf(a,W({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){U.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{U.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),_f&&eu.push({transport:"XHR",method:r=>{var e,t=new _f;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=pf(r))!==null&&e!==void 0?e:{};Ae(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(s)}},t.send(i)}}),St!=null&&St.sendBeacon&&eu.push({transport:"sendBeacon",method:r=>{var e=vu(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=pf(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;St.sendBeacon(e,s)}catch{}}});var yu=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 C0(r,e,t){return da({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Hx={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=>yu(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!yu(t,n))))),icontains:(r,e)=>e.map(Jc).some((t=>r.map(Jc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(Jc).every((t=>r.map(Jc).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)))}))},Jc=r=>r.toLowerCase();function Bx(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(B(s)||zt(s))return!1;var o=[String(s)],a=Hx[i.operator];return!!a&&a(i.values,o)}))}var hf=Le("[Error tracking]"),cg=class{constructor(e){var t,n;this.Zt=[],this.ti=new Tf([new If,new Ff,new Mf,new $f,new Lf,new Of,new Pf,new Nf],sT()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Hf))!==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({[Hf]:this.Zt,[i0]:o})}get ii(){var e,t=!!this._instance.get_property(i0),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 hf.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void hf.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void hf.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 ze(s)&&s.length>0&&n.$exception_types.push(s),ze(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=Hx[s.operator],l=xe(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!ge(e)&&xe(e)}},wt=Le("[FeatureFlags]"),ra=Le("[FeatureFlags]",{debugEnabled:!0}),ff="$active_feature_flags",os="$override_feature_flags",A0="$feature_flag_payloads",na="$override_feature_flag_payloads",T0="$feature_flag_request_id",R0="$feature_flag_evaluated_at",I0=r=>{var e={};for(var[t,n]of Qc(r||{}))n&&(e[t]=n);return e},XT=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]})))):wt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},JT=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),ug=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||(wt.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||wt.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(Bf),t=this._instance.get_property(os),n=this._instance.get_property(na);if(!n&&!t)return e||{};var i=Fe({},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=B(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=B(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=W({},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=W({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(wt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(ps),t=this._instance.get_property(os);if(!t)return e||{};for(var n=Fe({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(wt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(A0),t=this._instance.get_property(na);if(!t)return e||{};for(var n=Fe({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(wt.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:W({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(ua)||{}),group_properties:this._instance.get_property(ii)};zt(i)||B(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=Ox()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:Nr.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(JT.FeatureFlags))wt.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}wt.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(T0)||void 0,c=this._instance.get_property(R0)||void 0,u=this._instance.get_property(su)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,g,m,y,x,S;xe(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[su]:u});var b=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};B(b==null||(v=b.metadata)==null?void 0:v.version)||(w.$feature_flag_version=b.metadata.version);var A,_=(g=b==null||(m=b.reason)==null?void 0:m.description)!==null&&g!==void 0?g:b==null||(y=b.reason)==null?void 0:y.code;_&&(w.$feature_flag_reason=_),b!=null&&(x=b.metadata)!=null&&x.id&&(w.$feature_flag_id=b.metadata.id),B(b?.original_variant)&&B(b?.original_enabled)||(w.$feature_flag_original_response=B(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(S=b.metadata)!=null&&S.original_payload&&(w.$feature_flag_original_payload=b==null||(A=b.metadata)==null?void 0:A.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var C=o;if(!B(o))try{C=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:C}}}else wt.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:Nr.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 B(n)?void 0:!!n}wt.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=XT(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var g=o.requestId,m=o.evaluatedAt;if(xe(f)){wt.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({[ff]:f,[ps]:y})}else{var S=f,b=v,w=h;if(o.errorsWhileComputingFlags)if(h){var A=new Set(Object.keys(h).filter((_=>{var C;return!((C=h[_])!=null&&C.failed)})));S=W({},l,Object.fromEntries(Object.entries(S).filter((_=>{var[C]=_;return A.has(C)})))),b=W({},c,Object.fromEntries(Object.entries(b||{}).filter((_=>{var[C]=_;return A.has(C)})))),w=W({},u,Object.fromEntries(Object.entries(w||{}).filter((_=>{var[C]=_;return A.has(C)}))))}else S=W({},l,S),b=W({},c,b),w=W({},u,w);a&&a.register(W({[ff]:Object.keys(I0(S)),[ps]:S||{},[A0]:b||{},[Bf]:w||{}},g?{[T0]:g}:{},m?{[R0]:m}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),wt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return wt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(os),this._instance.persistence.unregister(na),this.wi(),ra.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(os),ra.info("Flag overrides cleared");else if(n.flags){if(xe(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[os]:i})}else this._instance.persistence.register({[os]:n.flags});ra.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(na),ra.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[na]:n.payloads}),ra.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(ca)||[]).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=W({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[ff]:Object.keys(I0(l)),[ps]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(ca),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(ca),(l=this._instance.persistence)==null||l.register({[ca]: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(ua)||{};this._instance.register({[ua]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ua)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(ii)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=W({},n[i],e[i]),delete e[i]})),this._instance.register({[ii]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ii)||{};this._instance.register({[ii]:W({},t,{[e]:{}})})}else this._instance.unregister(ii)}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}},QT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ga=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&&U.info("Persistence loaded",e.persistence,W({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){QT.indexOf(e.persistence.toLowerCase())===-1&&(U.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=[...IT,...i];return W({},Me,{W:function(o){try{var a={};try{a=dr.W(o)||{}}catch{}var l=Fe(a,JSON.parse(Me.q(o)||"{}"));return Me.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Me.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&dr.G(o,h,l,c,u,p)}catch(f){Me.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),dr.V(o,a)}catch(l){Me.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Me.H()?Me:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&Qe.H()?Qe:n==="memory"?$T:n==="cookie"?dr:t.H()?t:dr}properties(){var e={};return Ae(this.props,(function(t,n){if(n===ps&&We(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,(zt(o=hT)?l:W_&&o.indexOf===W_?o.indexOf(a)!=-1:(Ae(o,(function(c){if(l||(l=c===a))return nu})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Fe({},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(We(e)){B(t)&&(t="None"),this.Pi=B(n)?this.Ci:n;var i=!1;if(Ae(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(We(e)){this.Pi=B(t)?this.Ci:t;var n=!1;if(Ae(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=Tx(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ds(Ng(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=H?.referrer)?Ix(e):{})}update_referrer_info(){var e;this.register_once({$referrer:$x(),$referring_domain:H!=null&&H.referrer&&((e=uu(H.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Wf]||this.props[zf]||this.register_once({[ou]:Mx(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ae([zf,Wf],(o=>{var a=this.props[o];a&&Ae(a,(function(l,c){e["$initial_"+xf(c)]=l}))}));var t,n,i=this.props[ou];if(i){var s=(t=Px(i),n={},Ae(t,(function(o,a){n["$initial_"+xf(a)]=o})),n);Fe(e,s)}return e}safe_merge(e){return Ae(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((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[la]||{};n[e]=t,this.props[la]=n,this.save()}remove_event_timer(e){var t=(this.props[la]||{})[e];return B(t)||(delete this.props[la][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},$0=Le("[Product Tours]"),gf="ph_product_tours",dg=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[o0]:!(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(o0)||this.it((()=>this.Oi()))}it(e){var t,n;(t=re.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?$0.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=re.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=re.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!xe(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[gf];if(xe(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 $0.error(a),void e([],{isLoaded:!1,error:a})}var l=xe(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[gf]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ge(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(gf)}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)}},ia=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),$F=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),MF=(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})({}),PF=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),mf=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),OF=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),LF=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),NF=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),pa=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),vf=(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})({}),pg=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ce=Le("[Surveys]"),Vx="seenSurvey_",eR=(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},M0=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Vx,r),tR=[mf.Popover,mf.Widget,mf.API],rR={ignoreConditions:!1,ignoreDelay:!1,displayType:pg.Popover},wa=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 as(r,e,t){if(ge(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var hg=class{constructor(e){this.Ai=new wa,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(!B((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(!B((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"||!as(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=>as(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&as((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=>as(c.text,t.text,t.text_matching||"exact")||as(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;!ge(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=>as(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||Bx(t.properties.reduce(((n,i)=>{var s=xe(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)}},fg=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Bx(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===ia.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;B((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 hg(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,ia.Activation),this.Yi=this.Zi(e,ia.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,ia.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,ia.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}},gg=class extends fg{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return pa.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 Ce}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},mg=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ge(t))return Ce.warn("Flags not loaded yet. Not loading surveys.");var n=xe(t);this.ve=n?t.length>0:t,Ce.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(Vx)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Ce.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ce.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ce.info("Not loading surveys in cookieless mode without consent.");else{var e=re?.__PosthogExtensions__;if(e){if(!B(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 Ce.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new gg(this._instance),Ce.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Ce.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 Ce.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(Vf);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;Ce.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({[Vf]: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){Ce.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ce.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Ce.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(Ce.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ge(this._surveyManager))Ce.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(tR.includes(s.type)){var o=H?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(Ce.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;Ce.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),Ce.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ce.warn("Survey element not found")}else Ce.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ce.warn("Survey not found")}}displaySurvey(e,t){var n;if(ge(this._surveyManager))Ce.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=W({},i,{appearance:W({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==pg.Popover&&t.initialResponses&&Ce.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 Ce.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==pg.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ce.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?Ce.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Mr=Le("[Conversations]"),vg=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ge(t)||(Dr(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=re?.__PosthogExtensions__;if(e&&!B(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Mr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}Se(e,t){Mr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!zt(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 us((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Mr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return us((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return us((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return us((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},yg=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ge(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Le("[logs]"),t=re?.__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.")}}},P0=Le("[RateLimiter]"),bg=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=>{P0.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void P0.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(jf))!==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(jf,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},ni=Le("[RemoteConfig]"),_g=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=re._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=re.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(ni.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 ni.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void ni.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return ni.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){ni.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()):ni.info("__preview_remote_config is disabled. Logging config instead",e):ni.error("Failed to fetch remote config from PostHog.")}},xg=3e3,wg=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=pr(t?.flush_interval_ms||xg,250,5e3,U.createLogger("flush interval"),xg),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(W({},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&&xe(s.data)&&Ae(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return Ae(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;B(e[s])&&(e[s]=W({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},nR=["retriesPerformedSoFar"],Sg=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!B(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Ue(E,"online",this.ze),Ue(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=H0(e,nR);ls(t)&&(n.url=vu(n.url,{retry_count:t})),this._instance._send_request(W({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(W({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)"),U.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,B(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(W({},e,{transport:"sendBeacon"}))}catch(t){U.error(t)}this.Re=[]}},kg=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(){Ue(E,"scroll",this.Ge,{capture:!0}),Ue(E,"scrollend",this.Ge,{capture:!0}),Ue(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=xe(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}},iR=r=>Mx(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),bu=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({[Uf]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||iR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Uf]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Px(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ae(Ng(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+xf(n)]=t})),e}},yf=Le("[SessionId]"),_u=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 wa,this.er=(u,p)=>!(!ls(u)||!ls(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||ln,this.ar=n||ln;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pr(o,60,36e3,yf.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=Qe.W(this.ur),l=Qe.W(this.hr);a&&!l?this.rr=a:Qe.V(this.ur),Qe.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){yf.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return B(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&&Qe.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Qe.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Qe.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({[iu]:[t,e,n]}))}_r(){var e=this.Xe.props[iu];return xe(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()&&Qe.V(this.hr)},Ue(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=ls(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(),yf.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=ls(i)&&e&&!l?i:n,f=ls(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)}},sR=["$set_once","$set"],on=Le("[SiteApps]"),Eg=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=re._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:W({},H0(e,sR),{properties:W({},e.properties,g?{$set:W({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},g)}:{},v?{$set_once:W({},(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&&(on.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,on.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){on.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){on.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){on.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 on.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;re["__$$ph_site_app_"+c]=s._instance,(u=re.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return on.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else on.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Ux=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Z_(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>Z_(i?.brand,e))))return!0}catch{}return!!r.webdriver},ha=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),O0="i.posthog.com",Cg=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("."+O0,".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]=ha.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ha.EU:this.Sr[this.apiHost]=ha.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===ha.CUSTOM)return this.apiHost+t;var n=O0+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},oR={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&&yu(e.href,r),not_regex:(r,e)=>!!E&&!yu(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Ag=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);ze(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=du(e?.search,"__experiment_id"),n=du(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!ge(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||oR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.utm))return!0;var n=Tx();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];U.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 St&&this._instance?Ux(St,this._instance.config.custom_blocked_useragents):void 0}},aR=Le("[PostHog ExternalIntegrations]"),lR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Tg=class{constructor(e){this._instance=e}it(e,t){var n;(n=re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return aR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=re.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(lR[o],(()=>{var u;(u=re.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=re.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=re.__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)}}},Rg="[SessionRecording]",sa=Le(Rg),xu=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 sa.error("started without valid sessionManager"),new Error(Rg+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Rg+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(sf))==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=!B(Object.assign)&&!B(Array.from);this.Ar&&n?(this.Dr(e),sa.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(re!=null&&(t=re.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=re.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=re.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return sa.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(dx)}zr(e){if(this._instance.persistence){var t,n,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[sf]:W({enabled:!!o},o,{networkPayloadCapture:W({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:B(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:sa.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):sa.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(sf);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=re.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=re.__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))}},ma={},Ig=()=>{},cs="posthog",jx=!YT&&yt?.indexOf("MSIE")===-1&&yt?.indexOf("Mozilla")===-1,L0=r=>{var e;return W({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:pT(H?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ig,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:et&&ze(et?.search)&&et.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;U.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:xg},error_tracking:{},_onCapture:Ig,__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))},N0=r=>{var e={};B(r.process_person)||(e.person_profiles=r.process_person),B(r.xhr_headers)||(e.request_headers=r.xhr_headers),B(r.cookie_name)||(e.persistence_name=r.cookie_name),B(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),B(r.store_google)||(e.save_campaign_params=r.store_google),B(r.verbose)||(e.debug=r.verbose);var t=Fe({},e,r);return xe(r.property_blacklist)&&(B(r.property_denylist)?t.property_denylist=r.property_blacklist:xe(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:U.error("Invalid value for property_denylist config: "+r.property_denylist)),t},$g=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},wu=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 $g,this.Br=!1,this.version=Pr.LIB_VERSION,this.qr=new wa,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=L0(),this.SentryIntegration=eg,this.sentryIntegration=e=>(function(t,n){var i=Ax(t,n);return{name:Cx,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 ug(this),this.toolbar=new tg(this),this.scrollManager=new kg(this),this.pageViewManager=new fu(this),this.surveys=new mg(this),this.conversations=new vg(this),this.logs=new yg(this),this.experiments=new Ag(this),this.exceptions=new cg(this),this.rateLimiter=new bg(this),this.requestRouter=new Cg(this),this.consent=new Xf(this),this.externalIntegrations=new Tg(this),this.people={set:(e,t,n)=>{var i=ze(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=ze(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>U.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==cs){var i,s=(i=ma[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),ma[n]=s,ma[cs][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),B(e)||wf(e))return U.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(Fe({},L0(t.defaults),N0(t),{name:n,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Nr.GZipJS;var s=this.Qr();this.persistence=new ga(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ga(W({},this.config,{persistence:"sessionStorage"}),s);var o=W({},this.persistence.props),a=W({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new wg((x=>this.ts(x)),this.config.request_queue_config),this.es=new Sg(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 _u(this),this.sessionPropsManager=new bu(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(U.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(U.info("Initializing extensions synchronously"),this.rs(l)),Pr.DEBUG=Pr.DEBUG||this.config.debug,Pr.DEBUG&&U.info("Starting in debug mode",{this:this,config:t,thisC:W({},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(ln()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Or,(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 S;return!((S=t.bootstrap)==null||(S=S.featureFlags)==null||!S[x])})).reduce(((x,S)=>{var b;return x[S]=((b=t.bootstrap)==null||(b=b.featureFlags)==null?void 0:b[S])||!1,x}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>g[x])).reduce(((x,S)=>{var b,w;return(b=t.bootstrap)!=null&&(b=b.featureFlagPayloads)!=null&&b[S]&&(x[S]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[S]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:Xo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(ln());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Or,"anonymous")}return Ue(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?OT(this,(()=>this.ns())):this.ns(),cn(this.config._onCapture)&&this.config._onCapture!==Ig&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&U.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 Qf(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new rg(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new Eg(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new xu(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Zf(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new dg(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new ig(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new ng(this)})),n.push((()=>{this.exceptionObserver=new Jf(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new hu(this,PT),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){U.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&&U.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!H||!H.body)return U.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=fe(e.supportedCompression,Nr.GZipJS)?Nr.GZipJS:fe(e.supportedCompression,Nr.Base64)?Nr.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){U.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&et!=null&&et.hostname){var e=et.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 _g(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()&&un(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&&(jx?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=vu(e.url,{ip:this.config.ip?1:0}),e.headers=W({},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=W({},t);o.timeout=o.timeout||6e4,o.url=vu(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=eu.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=lx(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)})(W({},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=[];un(e,(a=>{a&&(t=a[0],xe(t)?s.push(a):cn(a)?a.call(this):xe(a)&&t==="alias"?n.push(a):xe(a)&&t.indexOf("capture")!==-1&&cn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){un(a,(function(c){if(xe(c[0])){var u=l;Ae(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(!B(e)&&ze(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&&!ze(t?.$current_url)&&(U.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=ln(),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=uT(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,B(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===pa.DISMISSED||e===pa.SENT){var v=t?.[vf.SURVEY_ID],g=t?.[vf.SURVEY_ITERATION];p={id:v,current_iteration:g},localStorage.getItem(M0(p))||localStorage.setItem(M0(p),"true"),u.$set=W({},u.$set,{[eR({id:v,current_iteration:g},e===pa.SENT?"responded":"dismissed")]:!0})}else e===pa.SHOWN&&(u.$set=W({},u.$set,{[vf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=W({},u.properties.$set,u.$set);if(ds(m)||this.setPersonPropertiesForFlags(m),!ge(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}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.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=W({},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=W({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!ze(a.distinct_id)&&!Hr(a.distinct_id)||wf(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=BT(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&&Fe(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Fe(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===ha.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=Fe(a,c),e==="$pageview"&&H&&(a.title=H.title),!B(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}yt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Fe({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),xe(this.config.property_denylist)?Ae(this.config.property_denylist,(function(y){delete a[y]})):U.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&&(U.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=Fe({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(U.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),ds(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=W({},i,e),a=W({},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:B(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=rR),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 U.uninitializedWarning("posthog.identify");if(Hr(e)&&(e=e.toString(),U.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()))U.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!==Xo){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(aa)&&(this.unregister(aa),this.register({distinct_id:e}));var o=(this.persistence.get_property(Or)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Or,"identified"),this.setPersonPropertiesForFlags(W({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=C0(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(su))}}else U.critical('The string "'+Xo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=C0(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(W({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):U.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:W({},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 U.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(U.info("reset"),!this.__loaded)return U.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(Or,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Xo,$device_id:null},"");else{var a=this.config.get_device_id(ln());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(cx)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(B(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(aa,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=W({},this.config);if(We(e)){var n,i,s,o,a,l,c;Fe(this.config,N0(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 ga(W({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);Dr(p)&&(this.config.debug=p),Dr(this.config.debug)&&(this.config.debug?(Pr.DEBUG=!0,Me.H()&&Me.G("ph_debug","true"),U.info("set_config",{config:e,oldConfig:t,newConfig:W({},this.config)})):(Pr.DEBUG=!1,Me.H()&&Me.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(W({},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:cs;return t!==cs&&(t=cs+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Or))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Or))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ds(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[aa])&&((t=this.persistence)==null||(t=t.props)==null||!t[au]))}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"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(au,!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 _u(this),this.pageViewManager=new fu(this),this.persistence&&(this.sessionPropsManager=new bu(this,this.sessionManager,this.persistence)),this.sessionRecording=new xu(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(),(B(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 U.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:Xo,$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())):U.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===Lr.GRANTED?"granted":e===Lr.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 St?Ux(St,this.config.custom_blocked_useragents):void 0}hs(){H&&(H.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:H.title},{send_instantly:!0}),this.Gr&&(H.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Ue(H,"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?(U.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=U,o=(t="advanced_disable_flags")in(e=l)&&!ge(e[t]),a=n in e&&!ge(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):i)}cs(e){if(ge(this.config.before_send))return e;var t=xe(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ge(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return F2(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}n.properties&&!ds(n.properties)||U.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=Dr(e)&&!e,n=Me.H()&&Me.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=cT(r.prototype[e[t]])})(wu,["identify"]);var F0;var Wx=(F0=ma[cs]=new wu,(function(){function r(){r.done||(r.done=!0,jx=!1,Ae(ma,(function(e){e._dom_loaded()})))}H!=null&&H.addEventListener?H.readyState==="complete"?r():Ue(H,"DOMContentLoaded",r,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),F0);var Ug=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,n=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0};e.cookieless_mode&&(o.cookieless_mode=e.cookieless_mode);let a=Wx.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)}optInCapturing(){this.client?.opt_in_capturing()}optOutCapturing(){this.client?.opt_out_capturing()}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function Cu(r={}){return new Ug(r)}var zx={posthog:r=>Cu(r),noop:()=>Zc()};function qx(r,e){let t=zx[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(zx).join(", ")}`);return t(e)}async function Zx(r){Dd(),Z("Syntro Bootstrap","====== INIT ======"),Z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=tc();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",Ro()),console.log("[DIAG] editorConf:",ec()),Z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let V=!!window.__SYNTRO_EDITOR_PARAMS__,J=!!window.__SYNTRO_AUDIT_LEGEND__,Q=!!window.__SYNTRO_REVIEW_DATA__;if(V||J||Q){let ue=[V&&"__SYNTRO_EDITOR_PARAMS__",J&&"__SYNTRO_AUDIT_LEGEND__",Q&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${ue.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 J=ec()?.syntro_token;J?.startsWith("syn_")&&(t=J,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=qi(t),Dd(n.d);else if(e)Z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Pl("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Pl("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 Pl("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=It("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||It("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=It("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||It("VITE_SYNTRO_TELEMETRY_HOST")||n?.th;if(n!=null&&n.obd!==!0&&s)try{let V=`${s.replace(/\/$/,"")}/sdk-otel/v1/logs`,J=Hd({resource:{serviceName:"syntro-runtime-sdk",serviceVersion:Vi,posthogKey:n.t??"",hostOrigin:typeof window<"u"?window.location.origin:""},emit:Vd({endpoint:V})}),Q=jd()??"https://cdn.syntrologie.com/runtime-sdk/",ue=np(J,{attributedScriptUrlPrefix:Q});J.attachAdapterCleanup(ue)}catch{}let o=It("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||It("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||It("NEXT_PUBLIC_SYNTRO_GEO_HOST")||It("VITE_SYNTRO_GEO_HOST")||Ib,l=Ab(),c=uh(),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=dh(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(V=>{let J=setTimeout(()=>{window.removeEventListener("message",Q),V(null)},500);function Q(ue){let _e=ue.data;_e?.jsonrpc==="2.0"&&_e?.id===1&&_e?.result?.hostInfo&&(clearTimeout(J),window.removeEventListener("message",Q),V(_e.result.hostInfo))}window.addEventListener("message",Q);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(J),window.removeEventListener("message",Q),V(null)}})})(),v,g=r.debug||r.testMode,m=Zi({debug:r.debug,history:g?new Gi(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=Ld({elementResolver:typeof window<"u"?(V,J)=>{let Q=document.elementFromPoint(V,J);if(!Q)return null;let ue={tag_name:Q.tagName.toLowerCase()};Q.id&&(ue.attr__id=Q.id),Q.className&&typeof Q.className=="string"&&(ue.classes=Q.className.split(" ").filter(Boolean));for(let _e of Q.attributes)_e.name.startsWith("data-")&&(ue[`attr__${_e.name}`]=_e.value);return ue}:void 0});y.onEvent(V=>m.publishEvent(V)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",V=>{let J=[],Q=V.target;for(;Q&&Q!==document.body;){let ue={tag_name:Q.tagName.toLowerCase()};for(let _e of Q.attributes)(_e.name.startsWith("data-")||_e.name==="id"||_e.name==="class"||_e.name==="aria-label")&&(ue[`attr__${_e.name}`]=_e.value);J.push(ue),Q=Q.parentElement}y.enrichClickAttributes(Date.now(),J)},!0));let x=$_(),S,b=V=>{Z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let J=Rb(V);if(Z("Syntro Bootstrap","Segment flags from PostHog:",J),Tb(J),v){let Q=A?.getAll?.()??{},ue={...c,...Q,...J,...u};Z("Syntro Bootstrap","Updating GrowthBook with attributes:",ue),v.setAttributes?.(ue)}if(S&&w?.getDistinctId){let Q=w.getDistinctId();Q&&s&&n?.t&&S.updateContext({distinctId:Q,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let V=n.t==="noop"?"noop":"posthog";w=qx(V,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,cookieless_mode:"on_reject",onFeatureFlagsLoaded:b,onCapture:(me,Ie)=>{y.ingest({kind:"posthog",event:me,properties:Ie,timestamp:Date.now()})},onRRWebEvent:me=>{y.ingest(me)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${V}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),Z("Syntro Bootstrap","Tracked app signals event:",u));let J=w;m.setPosthogCapture((me,Ie)=>{J.track?.(me,Ie)});let Q=w,ue=async()=>{let me=await h;return me.is_eu==="true"||me.country_code==="GB"||me.country_code==="CH"?"denied":"granted"},_e=new Yo({initialStatus:"pending",pendingResolver:ue,onConsentChange:me=>{me==="granted"?Q.optInCapturing?.():me==="denied"&&Q.optOutCapturing?.()}});try{Fb(w,_e,{geoPromise:h}),Z("Syntro Bootstrap","SDK defaults installed (D-1..D-5) with consent gate")}catch(me){Ge("Syntro Bootstrap","installDefaults failed",me)}try{new Ko({adapters:[new Go,new Zo,new qo],fallbackStatus:ue,onAdapterSelected:Ie=>{Q.track?.("syntro_consent_adapter_selected",{adapter:Ie??"none"}),Z("Syntro Bootstrap",`Consent adapter selected: ${Ie??"none"}`)}}).start(_e).catch(Ie=>{Ge("Syntro Bootstrap","Consent detector failed to start",Ie)})}catch(me){Ge("Syntro Bootstrap","Consent detector setup failed",me)}if(x?.name==="shopify"&&s)try{S=new Mc({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),Z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(me){Ge("Syntro Bootstrap","ShopifyPixelBridge init failed",me)}}let A;n?.e&&(v=E_("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(V,J,Q)=>{w.trackExperiment(V,J,Q)}:void 0})),A=Tc({experiments:v,onMetricChange:(V,J)=>{Z("Syntro Bootstrap",`Session metric changed: ${V} = ${J}`)}}),Z("Syntro Bootstrap","SessionMetricTracker created");let _="production";e==="editor"?_="editor":e==="audit"?_="audit":It("NODE_ENV")==="development"&&(_="development");let C=typeof c.surface_type=="string"?c.surface_type:"web",I=typeof c.surface_host=="string"?c.surface_host:"web",R=qc({telemetry:w,sessionMetrics:A,mode:_,events:m,initialSurfaceType:C,initialSurfaceHost:I});Z("Syntro Bootstrap","Runtime created:",{version:R.version,mode:R.mode,hasContext:!!R.context,hasEvents:!!R.events,hasState:!!R.state}),Z("Syntro Bootstrap","Core app executors already registered");let P=r.cdnBase||It("NEXT_PUBLIC_SYNTRO_CDN_BASE")||It("VITE_SYNTRO_CDN_BASE")||$b()||"https://cdn.syntrologie.com",Y=od({cdnBase:P,registry:R.apps,onLoadStart:V=>{Z("Syntro Bootstrap",`Loading app from CDN: ${V}`)},onLoadEnd:(V,J,Q)=>{J?Z("Syntro Bootstrap",`App loaded successfully: ${V}`):Ge("Syntro Bootstrap",`Failed to load app: ${V}`,Q)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:R.apps,appLoader:Y,runtime:R,version:R.version},Z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&Y.loadApp("adaptive-mcp").catch(V=>{Z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",V)});let F=R.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${F.length} apps in registry:`,F.map(V=>`${V.manifest.id}(${V.state})`).join(", "));for(let V of F)if(V.state==="registered")try{await R.apps.activate(V.manifest.id),console.log(`[DIAG] Activated: ${V.manifest.id} \u2192 widgets: [${R.widgets.list().join(", ")}]`)}catch(J){console.error(`[DIAG] FAILED to activate: ${V.manifest.id}`,J),Ge("Syntro Bootstrap",`Failed to auto-activate built-in app: ${V.manifest.id}`,J)}if(console.log(`[DIAG] Activation complete. Total widgets: [${R.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),Z("Syntro Bootstrap","GrowthBook features loaded")}catch(V){Ge("Syntro Bootstrap","Failed to load GrowthBook features:",V)}let L=await h;if(v&&Object.keys(L).length>0){let V={...c,...L,...u};Z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",L),v.setAttributes?.(V)}let G=await f;G&&v&&(c.surface_type="mcp-app",c.surface_host=G.name,v.setAttributes?.({...c,...L}),R.context.setSurfaceType("mcp-app"),R.context.setSurfaceHost(G.name),Z("Syntro Bootstrap","MCP App detected:",G.name));let K;if(r.fetcher)K=r.fetcher;else if(n?.f){let V=R_(n.f,n.o??{});K=async()=>{let J=await V.fetch();return{...J.config,tiles:J.config.tiles??[]}}}else v&&(K=jn({experiments:v}));let le=new Set,j=K?async()=>{let V=await K(),J=V.tiles?.length??0,Q=V.actions?.length??0,ue=V.meta?.variant_id;if((J>0||Q>0)&&(ue||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&ue){let Ie=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,dt=Ie?.interventionTracker,qt;dt&&dt.variantId===ue?qt=dt:(qt=new ss(w,ue),Ie&&(Ie.interventionTracker=qt),R.navigation.subscribe(()=>{qt.resetPage()})),qt.trackServed(J,Q)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${V.tiles?.length??0},`,`actions=${V.actions?.length??0},`,`theme=${V.theme?.name??"none"}`),V.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",V.actions.map((Ie,dt)=>`[${dt}] ${Ie.kind}${Ie.anchorId?` anchor="${Ie.anchorId.selector}"`:""}${Ie.label?` "${Ie.label}"`:""}`).join(", "));let _e=V,me=Y.getRequiredApps(_e);return me.length>0?console.log("[Syntro Bootstrap] Required external apps:",me.join(", ")):Z("Syntro Bootstrap","No external apps required (all executors are built-in)"),me.length>0&&await Y.loadAppsForConfig(_e).then(async dt=>{let qt=dt.filter(Ne=>Ne.success),Zt=dt.filter(Ne=>!Ne.success);qt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${qt.map(Ne=>Ne.appId).join(", ")}`);let xs=Zt.filter(Ne=>!le.has(Ne.appId));xs.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",xs.map(Ne=>`${Ne.appId} (${Ne.error})`).join(", ")),xs.forEach(Ne=>le.add(Ne.appId)));for(let Ne of me)if(R.apps.has(Ne))try{await R.apps.activate(Ne),console.log(`[Syntro Bootstrap] App activated: ${Ne}`)}catch(ws){console.error(`[Syntro Bootstrap] Failed to activate app: ${Ne}`,ws)}else console.error(`[Syntro Bootstrap] App "${Ne}" required by config but NOT registered.`,`Available apps: [${Array.from(R.apps.list?.()??[]).join(", ")}]`)}),V}:void 0;if(x){Z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),Z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(V){Ge("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,V)}}let te=await rc({...r.canvas,fetcher:j,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:R});if(te.setOverrideFetcher){let V=te.setOverrideFetcher.bind(te);te.setOverrideFetcher=J=>{V(async()=>{let ue=await J(),_e=ue;if(Y.getRequiredApps(_e).length>0){let Ie=await Y.loadAppsForConfig(_e);for(let dt of Ie)if(dt.success&&R.apps.has(dt.appId))try{await R.apps.activate(dt.appId)}catch{}}return ue})}}let De=nr();if(De!==null)try{let V=w,J=R;De.bindRuntime({getSessionId:()=>{try{return V?.getSessionId?.()??""}catch{return""}},getSurface:()=>{try{let Q=J.context.get().surface;return Q?{...Q}:null}catch{return null}}})}catch{}return De?.increment("bootstrap_ok"),{canvas:te,runtime:R,experiments:v,telemetry:w,sessionMetrics:A,appLoader:Y}}async function cR(r){try{return await Zx(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),nr()?.increment("bootstrap_errors"),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function uR(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 dR(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 jg={init:cR,loadAdaptive:dR,encodeToken:nc,decodeToken:qi,events:{emit:uR}};typeof window<"u"&&(window.Syntro=jg);function _s(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function pR(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=_s(i),o=_s(Er);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Er}. 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${Er}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:hR(n,i)}):{valid:!0,warnings:e,errors:t}}function hR(r,e){let t={...r};return _s(e).major===1&&(t=fR(t)),t.schemaVersion=Er,t}function fR(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 gR(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=_s(t),i=_s(Er);return n.major<i.major||!e.schemaVersion}var Gx=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),Kx=d.object({url:d.string(),ts:d.number()}),Yx=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(Kx).optional()}),Xx=d.object({width:d.number(),height:d.number()}),Jx=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),Qx=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:Jx.optional()}),ew=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),tw=d.object({page:Gx,session:Yx,viewport:Xx,anchors:d.array(Qx).optional(),augmented:ew.optional()});function mR(r){return tw.safeParse(r)}var Au=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 Tu=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 Ru=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 Wg=d.enum(["posthog","canvas","derived"]),rw=d.object({ts:d.number(),name:d.string(),source:Wg,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),nw=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(Wg).optional()});function vR(r){return rw.safeParse(r)}function yR(r){return nw.safeParse(r)}var zg=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()})]),iw=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:zg,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()}),sw=d.object({kind:d.literal("highlight"),id:d.string(),anchor:zg,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()}),Iu=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([iw,sw]))});function bR(r){return Iu.parse(r)}var _R=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Hl({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 Iu.parse(o)};var ow=d.object({value:d.unknown(),expiresAt:d.number().optional()}),aw=d.object({count:d.number(),resetAt:d.number().optional()});function xR(r){return ow.safeParse(r)}function wR(r){return aw.safeParse(r)}var qg="2026-05-07T22:01:24.367Z (38910bd5fad)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${qg} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Ws;window.SynOS={...r,appRegistry:e,_runtimeBuild:qg,_renderer:"lit"},wo(),py(e)}return hw(SR);})();
|
|
1065
|
+
`)).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),Zt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},sR=!!Ef||!!kf,M0="text/plain",bu=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=z({},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=MT(o);return l&&a.push(l),i+"?"+a.join("&")},da=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),vf=r=>{var{data:e,compression:t}=r;if(e){if(t===Fr.GZipJS){var n=nR((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new Ot(l.length+(l.length>>>1)),h=0,f=function(b){p[h++]=b},v=0;v<u;++v){if(h+5>p.length){var m=new Ot(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 zx(p,0,h)})(da(e)),{mtime:0}),i=new Blob([n],{type:M0});return{contentType:M0,body:i,estimatedSize:i.size}}if(t===Fr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,b="",x=[];if(!l)return l;l=iR(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(b=x.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b})(da(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:da(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=da(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ru=[];kf&&ru.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=vf(r))!==null&&e!==void 0?e:{},o=new Headers;Ae(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(J_){var c=new J_;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}kf(a,z({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){W.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{W.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Ef&&ru.push({transport:"XHR",method:r=>{var e,t=new Ef;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=vf(r))!==null&&e!==void 0?e:{};Ae(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(s)}},t.send(i)}}),Et!=null&&Et.sendBeacon&&ru.push({transport:"sendBeacon",method:r=>{var e=bu(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=vf(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;Et.sendBeacon(e,s)}catch{}}});var _u=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function P0(r,e,t){return da({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var qx={exact:(r,e)=>e.some((t=>r.some((n=>t===n)))),is_not:(r,e)=>e.every((t=>r.every((n=>t!==n)))),regex:(r,e)=>e.some((t=>r.some((n=>_u(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!_u(t,n))))),icontains:(r,e)=>e.map(eu).some((t=>r.map(eu).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(eu).every((t=>r.map(eu).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)))}))},eu=r=>r.toLowerCase();function Zx(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(j(s)||Zt(s))return!1;var o=[String(s)],a=qx[i.operator];return!!a&&a(i.values,o)}))}var yf=Le("[Error tracking]"),fg=class{constructor(e){var t,n;this.Zt=[],this.ti=new Pf([new Lf,new Uf,new Ff,new Nf,new Bf,new Hf,new Df,new Vf],fT()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Wf))!==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({[Wf]:this.Zt,[d0]:o})}get ii(){var e,t=!!this._instance.get_property(d0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void yf.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void yf.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void yf.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:s,value:o}=i;return qe(s)&&s.length>0&&n.$exception_types.push(s),qe(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Zt.some((n=>{var i=n.values.map((s=>{var o,a=qx[s.operator],l=be(s.value)?s.value:[s.value],c=(o=t[s.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(i=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}ei(e){return!ge(e)&&be(e)}},kt=Le("[FeatureFlags]"),ra=Le("[FeatureFlags]",{debugEnabled:!0}),bf="$active_feature_flags",ls="$override_feature_flags",O0="$feature_flag_payloads",na="$override_feature_flag_payloads",L0="$feature_flag_request_id",N0="$feature_flag_evaluated_at",F0=r=>{var e={};for(var[t,n]of tu(r||{}))n&&(e[t]=n);return e},oR=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]})))):kt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},aR=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),gg=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||(kt.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||kt.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(zf),t=this._instance.get_property(ls),n=this._instance.get_property(na);if(!n&&!t)return e||{};var i=He({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],p=j(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=j(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=z({},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=z({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(kt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(fs),t=this._instance.get_property(ls);if(!t)return e||{};for(var n=He({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(kt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(O0),t=this._instance.get_property(na);if(!t)return e||{};for(var n=He({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(kt.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:z({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(ua)||{}),group_properties:this._instance.get_property(oi)};Zt(i)||j(i)||(s.$device_id=i),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.pi()&&(s.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",c=this._instance.requestRouter.endpointFor("flags",a+l);o&&(s.timezone=Vx()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:Fr.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(aR.FeatureFlags))kt.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}kt.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(L0)||void 0,c=this._instance.get_property(N0)||void 0,u=this._instance.get_property(au)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,m,g,b,x,w;be(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[au]:u});var y=this.getFeatureFlagDetails(e),S={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((h=this._instance.config.bootstrap)==null||(h=h.featureFlags)==null?void 0:h[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};j(y==null||(v=y.metadata)==null?void 0:v.version)||(S.$feature_flag_version=y.metadata.version);var T,_=(m=y==null||(g=y.reason)==null?void 0:g.description)!==null&&m!==void 0?m:y==null||(b=y.reason)==null?void 0:b.code;_&&(S.$feature_flag_reason=_),y!=null&&(x=y.metadata)!=null&&x.id&&(S.$feature_flag_id=y.metadata.id),j(y?.original_variant)&&j(y?.original_enabled)||(S.$feature_flag_original_response=j(y.original_variant)?y.original_enabled:y.original_variant),y!=null&&(w=y.metadata)!=null&&w.original_payload&&(S.$feature_flag_original_payload=y==null||(T=y.metadata)==null?void 0:T.original_payload),this._instance.capture("$feature_flag_called",S)}if(i){var C=o;if(!j(o))try{C=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:C}}}else kt.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:Fr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return j(n)?void 0:!!n}kt.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=oR(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(be(f)){kt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(f)for(var x=0;x<f.length;x++)b[f[x]]=!0;a&&a.register({[bf]:f,[fs]:b})}else{var w=f,y=v,S=h;if(o.errorsWhileComputingFlags)if(h){var T=new Set(Object.keys(h).filter((_=>{var C;return!((C=h[_])!=null&&C.failed)})));w=z({},l,Object.fromEntries(Object.entries(w).filter((_=>{var[C]=_;return T.has(C)})))),y=z({},c,Object.fromEntries(Object.entries(y||{}).filter((_=>{var[C]=_;return T.has(C)})))),S=z({},u,Object.fromEntries(Object.entries(S||{}).filter((_=>{var[C]=_;return T.has(C)}))))}else w=z({},l,w),y=z({},c,y),S=z({},u,S);a&&a.register(z({[bf]:Object.keys(F0(w)),[fs]:w||{},[O0]:y||{},[zf]:S||{}},m?{[L0]:m}:{},g?{[N0]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),kt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return kt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(ls),this._instance.persistence.unregister(na),this.wi(),ra.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(ls),ra.info("Flag overrides cleared");else if(n.flags){if(be(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[ls]:i})}else this._instance.persistence.register({[ls]:n.flags});ra.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(na),ra.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[na]:n.payloads}),ra.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(ca)||[]).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=z({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[bf]:Object.keys(F0(l)),[fs]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(ca),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(ca),(l=this._instance.persistence)==null||l.register({[ca]: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(ua)||{};this._instance.register({[ua]:z({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ua)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(oi)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=z({},n[i],e[i]),delete e[i]})),this._instance.register({[oi]:z({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(oi)||{};this._instance.register({[oi]:z({},t,{[e]:{}})})}else this._instance.unregister(oi)}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}},lR=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ga=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&&W.info("Persistence loaded",e.persistence,z({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){lR.indexOf(e.persistence.toLowerCase())===-1&&(W.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=[...HT,...i];return z({},Me,{W:function(o){try{var a={};try{a=pr.W(o)||{}}catch{}var l=He(a,JSON.parse(Me.q(o)||"{}"));return Me.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Me.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&pr.G(o,h,l,c,u,p)}catch(f){Me.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),pr.V(o,a)}catch(l){Me.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Me.H()?Me:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&et.H()?et:n==="memory"?BT:n==="cookie"?pr:t.H()?t:pr}properties(){var e={};return Ae(this.props,(function(t,n){if(n===fs&&ze(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=n,l=!1,(Zt(o=wT)?l:X_&&o.indexOf===X_?o.indexOf(a)!=-1:(Ae(o,(function(c){if(l||(l=c===a))return su})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=He({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(ze(e)){j(t)&&(t="None"),this.Pi=j(n)?this.Ci:n;var i=!1;if(Ae(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(ze(e)){this.Pi=j(t)?this.Ci:t;var n=!1;if(Ae(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=Lx(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);hs(Vg(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=U?.referrer)?Fx(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Dx(),$referring_domain:U!=null&&U.referrer&&((e=pu(U.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Kf]||this.props[Yf]||this.register_once({[lu]:Hx(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ae([Yf,Kf],(o=>{var a=this.props[o];a&&Ae(a,(function(l,c){e["$initial_"+Cf(c)]=l}))}));var t,n,i=this.props[lu];if(i){var s=(t=Bx(i),n={},Ae(t,(function(o,a){n["$initial_"+Cf(a)]=o})),n);He(e,s)}return e}safe_merge(e){return Ae(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((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[la]||{};n[e]=t,this.props[la]=n,this.save()}remove_event_timer(e){var t=(this.props[la]||{})[e];return j(t)||(delete this.props[la][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},D0=Le("[Product Tours]"),_f="ph_product_tours",mg=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[h0]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(h0)||this.it((()=>this.Oi()))}it(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?D0.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=ee.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=ee.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!be(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[_f];if(be(i)&&!t)return this.Fi=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var o=s.statusCode;if(o!==200||!s.json){var a="Product Tours API could not be loaded, status: "+o;return D0.error(a),void e([],{isLoaded:!1,error:a})}var l=be(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[_f]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){ge(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(_f)}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)}},ia=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),BF=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),VF=(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})({}),UF=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),xf=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),jF=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),WF=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),zF=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),pa=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),wf=(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})({}),vg=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ee=Le("[Surveys]"),Gx="seenSurvey_",cR=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},H0=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Gx,r),uR=[xf.Popover,xf.Widget,xf.API],dR={ignoreConditions:!1,ignoreDelay:!1,displayType:vg.Popover},wa=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 cs(r,e,t){if(ge(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var yg=class{constructor(e){this.Ai=new wa,this.ji=(t,n)=>this.Di(t,n)&&this.Li(t,n)&&this.Ni(t,n)&&this.Ui(t,n),this.Di=(t,n)=>n==null||!n.event||t?.event===n?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!j((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((n,i)=>{this.on(n,i)}))}}register(e){var t,n;if(!j((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Hi)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var 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"||!cs(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=>cs(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&cs((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=>cs(c.text,t.text,t.text_matching||"exact")||cs(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;!ge(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=>cs(c,o,a))))}Vi(e,t){var n,i;if(t==null||!t.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||Zx(t.properties.reduce(((n,i)=>{var s=be(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)}},bg=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Zx(e.propertyFilters,t?.properties)}Zi(e,t){var n=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}te(e,t,n){var i=(n===ia.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;j((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new yg(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,ia.Activation),this.Yi=this.Zi(e,ia.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,ia.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,ia.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}},_g=class extends bg{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return pa.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return Ee}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},xg=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ge(t))return Ee.warn("Flags not loaded yet. Not loading surveys.");var n=be(t);this.ve=n?t.length>0:t,Ee.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Gx)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Ee.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ee.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ee.info("Not loading surveys in cookieless mode without consent.");else{var e=ee?.__PosthogExtensions__;if(e){if(!j(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,t);var i=e.loadExternalDependency;if(!i)return void this._e("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(s=>{s||!e.generateSurveys?this._e("Could not load surveys script",s):this.ge(e.generateSurveys,t)}))}catch(s){throw this._e("Error initializing surveys",s),s}finally{this.ce=!1}}}else Ee.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new _g(this._instance),Ee.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Ee.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Ee.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(qf);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then((s=>{var{surveys:o,context:a}=s;return e(o,a)})):(typeof Promise<"u"&&(this.pe=new Promise((s=>{n=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var o;this.pe=null;var a=s.statusCode;if(a!==200||!s.json){var l="Surveys API could not be loaded, status: "+a;Ee.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var 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({[qf]:p});var f={isLoaded:!0};e(p,f),n?.({surveys:p,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Ee.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ee.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((s=>s.id===e)))!==null&&i!==void 0?i:null})),t}ye(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Ee.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(Ee.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((i=>{var s,o=(s=i.find((l=>l.id===e)))!==null&&s!==void 0?s:null;if(o){var a=this.ye(o);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ge(this._surveyManager))Ee.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(uR.includes(s.type)){var o=U?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(Ee.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;Ee.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(s,o,n),Ee.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ee.warn("Survey element not found")}else Ee.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ee.warn("Survey not found")}}displaySurvey(e,t){var n;if(ge(this._surveyManager))Ee.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=z({},i,{appearance:z({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==vg.Popover&&t.initialResponses&&Ee.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Ee.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==vg.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ee.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?Ee.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Pr=Le("[Conversations]"),wg=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;ge(t)||(Hr(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=ee?.__PosthogExtensions__;if(e&&!j(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Se("Could not load conversations script",i):this.$e(e.initConversations),this.xe=!1}))}catch(i){this.Se("Error initializing conversations",i),this.xe=!1}}else Pr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Pr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Pr.error("Cannot complete initialization: remote config is null")}Se(e,t){Pr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Pr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Zt(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 ps((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Pr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return ps((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Pr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return ps((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Pr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return ps((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Pr.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}},Sg=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ge(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Le("[logs]"),t=ee?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",(i=>{var s;i||(s=t.logs)==null||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},B0=Le("[RateLimiter]"),kg=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{B0.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void B0.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(n=this.instance.persistence)==null?void 0:n.get_property(Gf))!==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(Gf,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},si=Le("[RemoteConfig]"),Eg=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=ee.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(si.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 si.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void si.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return si.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){si.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()):si.info("__preview_remote_config is disabled. Logging config instead",e):si.error("Failed to fetch remote config from PostHog.")}},Cg=3e3,Ag=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=hr(t?.flush_interval_ms||Cg,250,5e3,W.createLogger("flush interval"),Cg),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(z({},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&&be(s.data)&&Ae(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return Ae(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;j(e[s])&&(e[s]=z({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},pR=["retriesPerformedSoFar"],Tg=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!j(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},je(E,"online",this.ze),je(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=q0(e,pR);us(t)&&(n.url=bu(n.url,{retry_count:t})),this._instance._send_request(z({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(z({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)"),W.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout((()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()}),this.Ne)}Lt(){var e=Date.now(),t=[],n=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,j(E)||(this.ze&&(E.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(E.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(z({},e,{transport:"sendBeacon"}))}catch(t){W.error(t)}this.Re=[]}},Rg=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(){je(E,"scroll",this.Ge,{capture:!0}),je(E,"scrollend",this.Ge,{capture:!0}),je(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.document.documentElement;var e=be(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}},hR=r=>Hx(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),xu=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({[Zf]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||hR,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Zf]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Bx(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ae(Vg(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Cf(n)]=t})),e}},Sf=Le("[SessionId]"),wu=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 wa,this.er=(u,p)=>!(!us(u)||!us(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||cn,this.ar=n||cn;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*hr(o,60,36e3,Sf.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var a=et.W(this.ur),l=et.W(this.hr);a&&!l?this.rr=a:et.V(this.ur),et.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(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){Sf.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&et.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&et.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?et.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[ou]:[t,e,n]}))}_r(){var e=this.Xe.props[ou];return be(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&E&&(E.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&et.V(this.hr)},je(E,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=us(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(),Sf.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=us(i)&&e&&!l?i:n,f=us(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)}},fR=["$set_once","$set"],an=Le("[SiteApps]"),Ig=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var n=this.globalsForEvent(t);this.br.push(n),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,n,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},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:z({},q0(e,fR),{properties:z({},e.properties,m?{$set:z({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:z({},(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&&(an.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,an.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){an.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){an.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){an.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 an.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;ee["__$$ph_site_app_"+c]=s._instance,(u=ee.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return an.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else an.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Kx=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&e0(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>e0(i?.brand,e))))return!0}catch{}return!!r.webdriver},ha=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),V0="i.posthog.com",$g=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+V0,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ha.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ha.EU:this.Sr[this.apiHost]=ha.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===ha.CUSTOM)return this.apiHost+t;var n=V0+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},gR={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&&_u(e.href,r),not_regex:(r,e)=>!!E&&!_u(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Mg=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);qe(a)&&s.variants[a]&&t.Tr(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.has(t)){var i,s=this._instance.getFeatureFlag(t),o=(i=this.Pr)==null?void 0:i.get(t);s&&o!=null&&o.variants[s]&&this.Tr(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=hu(e?.search,"__experiment_id"),n=hu(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Cr(e,t,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.kr("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Tr(i[0].name,t,i[0].variants[t].transforms))}static Ir(e){return!ge(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||gR[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ge(e.conditions)||ge((t=e.conditions)==null?void 0:t.utm))return!0;var n=Lx();if(n.utm_source){var i,s,o,a,l,c,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];W.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 Et&&this._instance?Kx(Et,this._instance.config.custom_blocked_useragents):void 0}},mR=Le("[PostHog ExternalIntegrations]"),vR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Pg=class{constructor(e){this._instance=e}it(e,t){var n;(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return mR.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=ee.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(vR[o],(()=>{var u;(u=ee.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=ee.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=ee.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[n,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(n)}}},Og="[SessionRecording]",sa=Le(Og),Su=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 sa.error("started without valid sessionManager"),new Error(Og+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Og+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(uf))==null||!e.enabled),n=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var n=!j(Object.assign)&&!j(Array.from);this.Ar&&n?(this.Dr(e),sa.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(ee!=null&&(t=ee.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=ee.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=ee.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return sa.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(yx)}zr(e){if(this._instance.persistence){var t,n,i=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[uf]:z({enabled:!!o},o,{networkPayloadCapture:z({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:j(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:sa.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):sa.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(uf);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=ee.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=ee.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Or||(n=this._instance.persistence)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Or)==null||!n.tryAddCustomEvent(e,t))}},ma={},Lg=()=>{},ds="posthog",Yx=!sR&&_t?.indexOf("MSIE")===-1&&_t?.indexOf("Mozilla")===-1,U0=r=>{var e;return z({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xT(U?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Lg,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:tt&&qe(tt?.search)&&tt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;W.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:Cg},error_tracking:{},_onCapture:Lg,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(r))},j0=r=>{var e={};j(r.process_person)||(e.person_profiles=r.process_person),j(r.xhr_headers)||(e.request_headers=r.xhr_headers),j(r.cookie_name)||(e.persistence_name=r.cookie_name),j(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),j(r.store_google)||(e.save_campaign_params=r.store_google),j(r.verbose)||(e.debug=r.verbose);var t=He({},e,r);return be(r.property_blacklist)&&(j(r.property_denylist)?t.property_denylist=r.property_blacklist:be(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:W.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Ng=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){W.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ku=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 Ng,this.Br=!1,this.version=Or.LIB_VERSION,this.qr=new wa,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=U0(),this.SentryIntegration=sg,this.sentryIntegration=e=>(function(t,n){var i=Ox(t,n);return{name:Px,processEvent:s=>i(s)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new gg(this),this.toolbar=new og(this),this.scrollManager=new Rg(this),this.pageViewManager=new mu(this),this.surveys=new xg(this),this.conversations=new wg(this),this.logs=new Sg(this),this.experiments=new Mg(this),this.exceptions=new fg(this),this.rateLimiter=new kg(this),this.requestRouter=new $g(this),this.consent=new rg(this),this.externalIntegrations=new Pg(this),this.people={set:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=qe(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>W.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==ds){var i,s=(i=ma[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),ma[n]=s,ma[ds][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),j(e)||Af(e))return W.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(He({},U0(t.defaults),j0(t),{name:n,token:e})),this.config.on_xhr_error&&W.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Fr.GZipJS;var s=this.Qr();this.persistence=new ga(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ga(z({},this.config,{persistence:"sessionStorage"}),s);var o=z({},this.persistence.props),a=z({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Ag((x=>this.ts(x)),this.config.request_queue_config),this.es=new Tg(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 wu(this),this.sessionPropsManager=new xu(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(W.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(W.info("Initializing extensions synchronously"),this.rs(l)),Or.DEBUG=Or.DEBUG||this.config.debug,Or.DEBUG&&W.info("Starting in debug mode",{this:this,config:t,thisC:z({},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(cn()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Lr,(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 w;return!((w=t.bootstrap)==null||(w=w.featureFlags)==null||!w[x])})).reduce(((x,w)=>{var y;return x[w]=((y=t.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[w])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,w)=>{var y,S;return(y=t.bootstrap)!=null&&(y=y.featureFlagPayloads)!=null&&y[w]&&(x[w]=(S=t.bootstrap)==null||(S=S.featureFlagPayloads)==null?void 0:S[w]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:Xo,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(cn());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Lr,"anonymous")}return je(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?jT(this,(()=>this.ns())):this.ns(),un(this.config._onCapture)&&this.config._onCapture!==Lg&&(W.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&W.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 ig(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new ag(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new Ig(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Su(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Jf(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new mg(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new cg(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new lg(this)})),n.push((()=>{this.exceptionObserver=new ng(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new gu(this,UT),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){W.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&&W.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!U||!U.body)return W.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=he(e.supportedCompression,Fr.GZipJS)?Fr.GZipJS:he(e.supportedCompression,Fr.Base64)?Fr.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){W.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&tt!=null&&tt.hostname){var e=tt.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Eg(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()&&dn(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Yx?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=bu(e.url,{ip:this.config.ip?1:0}),e.headers=z({},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=z({},t);o.timeout=o.timeout||6e4,o.url=bu(o.url,{_:new Date().getTime().toString(),ver:Or.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=ru.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=gx(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)})(z({},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=[];dn(e,(a=>{a&&(t=a[0],be(t)?s.push(a):un(a)?a.call(this):be(a)&&t==="alias"?n.push(a):be(a)&&t.indexOf("capture")!==-1&&un(this[t])?s.push(a):i.push(a))}));var o=function(a,l){dn(a,(function(c){if(be(c[0])){var u=l;Ae(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(!j(e)&&qe(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!qe(t?.$current_url)&&(W.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=cn(),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=bT(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,j(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===pa.DISMISSED||e===pa.SENT){var v=t?.[wf.SURVEY_ID],m=t?.[wf.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(H0(p))||localStorage.setItem(H0(p),"true"),u.$set=z({},u.$set,{[cR({id:v,current_iteration:m},e===pa.SENT?"responded":"dismissed")]:!0})}else e===pa.SHOWN&&(u.$set=z({},u.$set,{[wf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=z({},u.properties.$set,u.$set);if(hs(g)||this.setPersonPropertiesForFlags(g),!ge(this.config.before_send)){var b=this.cs(u);if(!b)return;u=b}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}W.critical("This capture call is ignored due to client rate limiting.")}}else W.error("No event name provided to posthog.capture")}else W.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=z({},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=z({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!qe(a.distinct_id)&&!Br(a.distinct_id)||Af(a.distinct_id))&&W.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=KT(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&He(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&He(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===ha.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=He(a,c),e==="$pageview"&&U&&(a.title=U.title),!j(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}_t&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=He({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),be(this.config.property_denylist)?Ae(this.config.property_denylist,(function(b){delete a[b]})):W.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&&(W.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var g=this.fs();return a.$process_person_profile=g,g&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),o=He({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(W.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),hs(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=z({},i,e),a=z({},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:j(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=dR),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 W.uninitializedWarning("posthog.identify");if(Br(e)&&(e=e.toString(),W.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()))W.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!==Xo){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(aa)&&(this.unregister(aa),this.register({distinct_id:e}));var o=(this.persistence.get_property(Lr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Lr,"identified"),this.setPersonPropertiesForFlags(z({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=P0(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(au))}}else W.critical('The string "'+Xo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else W.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=P0(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(z({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):W.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:z({},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 W.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(W.info("reset"),!this.__loaded)return W.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(Lr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Xo,$device_id:null},"");else{var a=this.config.get_device_id(cn());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(mx)?(W.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(aa,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(W.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=z({},this.config);if(ze(e)){var n,i,s,o,a,l,c;He(this.config,j0(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 ga(z({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);Hr(p)&&(this.config.debug=p),Hr(this.config.debug)&&(this.config.debug?(Or.DEBUG=!0,Me.H()&&Me.G("ph_debug","true"),W.info("set_config",{config:e,oldConfig:t,newConfig:z({},this.config)})):(Or.DEBUG=!1,Me.H()&&Me.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(z({},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:ds;return t!==ds&&(t=ds+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Lr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Lr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&hs(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[aa])&&((t=this.persistence)==null||(t=t.props)==null||!t[cu]))}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"?(W.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(cu,!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 wu(this),this.pageViewManager=new mu(this),this.persistence&&(this.sessionPropsManager=new xu(this,this.sessionManager,this.persistence)),this.sessionRecording=new Su(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(j(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((s=e?.captureEventName)!==null&&s!==void 0?s:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else W.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:Xo,$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())):W.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===Nr.GRANTED?"granted":e===Nr.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 Et?Kx(Et,this.config.custom_blocked_useragents):void 0}hs(){U&&(U.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:U.title},{send_instantly:!0}),this.Gr&&(U.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),je(U,"visibilitychange",this.Gr)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,n,i,s,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(W.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=W,o=(t="advanced_disable_flags")in(e=l)&&!ge(e[t]),a=n in e&&!ge(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):i)}cs(e){if(ge(this.config.before_send))return e;var t=be(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var i of t){if(n=i(n),ge(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return q2(e.event)?W.warn(s+". This can cause unexpected behavior."):W.info(s),null}n.properties&&!hs(n.properties)||W.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=Hr(e)&&!e,n=Me.H()&&Me.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=yT(r.prototype[e[t]])})(ku,["identify"]);var W0;var Xx=(W0=ma[ds]=new ku,(function(){function r(){r.done||(r.done=!0,Yx=!1,Ae(ma,(function(e){e._dom_loaded()})))}U!=null&&U.addEventListener?U.readyState==="complete"?r():je(U,"DOMContentLoaded",r,{capture:!1}):E&&W.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),W0);var Zg=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,n=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0};e.cookieless_mode&&(o.cookieless_mode=e.cookieless_mode);let a=Xx.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],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)}optInCapturing(){this.client?.opt_in_capturing()}optOutCapturing(){this.client?.opt_out_capturing()}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function Tu(r={}){return new Zg(r)}var Jx={posthog:r=>Tu(r),noop:()=>Kc()};function Qx(r,e){let t=Jx[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Jx).join(", ")}`);return t(e)}async function ew(r){Bd(),G("Syntro Bootstrap","====== INIT ======"),G("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=nc();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",Ro()),console.log("[DIAG] editorConf:",rc()),G("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let H=!!window.__SYNTRO_EDITOR_PARAMS__,Q=!!window.__SYNTRO_AUDIT_LEGEND__,re=!!window.__SYNTRO_REVIEW_DATA__;if(H||Q||re){let fe=[H&&"__SYNTRO_EDITOR_PARAMS__",Q&&"__SYNTRO_AUDIT_LEGEND__",re&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${fe.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let Q=rc()?.syntro_token;Q?.startsWith("syn_")&&(t=Q,G("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))G("Syntro Bootstrap","Token starts with syn_, decoding..."),n=Gi(t),Bd(n.d);else if(e)G("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw Ll("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),Ll("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)G("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw Ll("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=Mt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||Mt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=Mt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||Mt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th;if(n!=null&&n.obd!==!0&&s)try{let H=`${s.replace(/\/$/,"")}/sdk-otel/v1/logs`,Q=Vd({resource:{serviceName:"syntro-runtime-sdk",serviceVersion:ji,posthogKey:n.t??"",hostOrigin:typeof window<"u"?window.location.origin:""},emit:jd({endpoint:H})}),re=zd()??"https://cdn.syntrologie.com/runtime-sdk/",fe=sp(Q,{attributedScriptUrlPrefix:re});Q.attachAdapterCleanup(fe)}catch{}let o=Mt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||Mt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||Mt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||Mt("VITE_SYNTRO_GEO_HOST")||Fb,l=$b(),c=fh(),u=r.appSignalsInit??{},p=Lb(),h=gh(c,p);Nb(h);let f={...c,...h,...l,...u};G("Syntro Bootstrap","Phase 1: Browser metadata:",c),G("Syntro Bootstrap","Phase 1: Initial attrs:",h),G("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&G("Syntro Bootstrap","Phase 1: App signals:",u);let v=mh(a),m=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(H=>{let Q=setTimeout(()=>{window.removeEventListener("message",re),H(null)},500);function re(fe){let Ce=fe.data;Ce?.jsonrpc==="2.0"&&Ce?.id===1&&Ce?.result?.hostInfo&&(clearTimeout(Q),window.removeEventListener("message",re),H(Ce.result.hostInfo))}window.addEventListener("message",re);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(Q),window.removeEventListener("message",re),H(null)}})})(),g,b=r.debug||r.testMode,x=Ki({debug:r.debug,history:b?new Yi(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let w=Fd({elementResolver:typeof window<"u"?(H,Q)=>{let re=document.elementFromPoint(H,Q);if(!re)return null;let fe={tag_name:re.tagName.toLowerCase()};re.id&&(fe.attr__id=re.id),re.className&&typeof re.className=="string"&&(fe.classes=re.className.split(" ").filter(Boolean));for(let Ce of re.attributes)Ce.name.startsWith("data-")&&(fe[`attr__${Ce.name}`]=Ce.value);return fe}:void 0});w.onEvent(H=>x.publishEvent(H)),typeof window<"u"&&(setInterval(()=>w.tick(Date.now()),1e3),document.addEventListener("click",H=>{let Q=[],re=H.target;for(;re&&re!==document.body;){let fe={tag_name:re.tagName.toLowerCase()};for(let Ce of re.attributes)(Ce.name.startsWith("data-")||Ce.name==="id"||Ce.name==="class"||Ce.name==="aria-label")&&(fe[`attr__${Ce.name}`]=Ce.value);Q.push(fe),re=re.parentElement}w.enrichClickAttributes(Date.now(),Q)},!0));let y=D_(),S,T=H=>{G("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let Q=Pb(H);if(G("Syntro Bootstrap","Segment flags from PostHog:",Q),Mb(Q),g){let re=C?.getAll?.()??{},fe={...c,...h,...re,...Q,...u};G("Syntro Bootstrap","Updating GrowthBook with attributes:",fe),g.setAttributes?.(fe)}if(S&&_?.getDistinctId){let re=_.getDistinctId();re&&s&&n?.t&&S.updateContext({distinctId:re,telemetryHost:s,telemetryKey:n.t})}},_;if(n?.t){let H=n.t==="noop"?"noop":"posthog";_=Qx(H,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,cookieless_mode:"on_reject",onFeatureFlagsLoaded:T,onCapture:(Se,Ie)=>{w.ingest({kind:"posthog",event:Se,properties:Ie,timestamp:Date.now()})},onRRWebEvent:Se=>{w.ingest(Se)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${H}) with EventBus wiring`),Object.keys(u).length>0&&(_.track?.("app_signals_init",u),G("Syntro Bootstrap","Tracked app signals event:",u));let Q=_;x.setPosthogCapture((Se,Ie)=>{Q.track?.(Se,Ie)});let re=_,fe=async()=>{let Se=await v;return Se.is_eu==="true"||Se.country_code==="GB"||Se.country_code==="CH"?"denied":"granted"},Ce=new Yo({initialStatus:"pending",pendingResolver:fe,onConsentChange:Se=>{Se==="granted"?re.optInCapturing?.():Se==="denied"&&re.optOutCapturing?.()}});try{Wb(_,Ce,{geoPromise:v}),G("Syntro Bootstrap","SDK defaults installed (D-1..D-5) with consent gate")}catch(Se){dt("Syntro Bootstrap","installDefaults failed",Se)}try{new Ko({adapters:[new Go,new Zo,new qo],fallbackStatus:fe,onAdapterSelected:Ie=>{re.track?.("syntro_consent_adapter_selected",{adapter:Ie??"none"}),G("Syntro Bootstrap",`Consent adapter selected: ${Ie??"none"}`)}}).start(Ce).catch(Ie=>{dt("Syntro Bootstrap","Consent detector failed to start",Ie)})}catch(Se){dt("Syntro Bootstrap","Consent detector setup failed",Se)}if(y?.name==="shopify"&&s)try{S=new Oc({distinctId:_.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),G("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(Se){dt("Syntro Bootstrap","ShopifyPixelBridge init failed",Se)}}let C;n?.e&&(g=M_("growthbook",{clientKey:n.e,apiHost:i,attributes:f,onExperimentViewed:_?.trackExperiment?(H,Q,re)=>{_.trackExperiment(H,Q,re)}:void 0})),C=Ic({experiments:g,onMetricChange:(H,Q)=>{G("Syntro Bootstrap",`Session metric changed: ${H} = ${Q}`)}}),G("Syntro Bootstrap","SessionMetricTracker created");let R="production";e==="editor"?R="editor":e==="audit"?R="audit":Mt("NODE_ENV")==="development"&&(R="development");let N=typeof c.surface_type=="string"?c.surface_type:"web",M=typeof c.surface_host=="string"?c.surface_host:"web",F=Gc({telemetry:_,sessionMetrics:C,mode:R,events:x,initialSurfaceType:N,initialSurfaceHost:M});G("Syntro Bootstrap","Runtime created:",{version:F.version,mode:F.mode,hasContext:!!F.context,hasEvents:!!F.events,hasState:!!F.state}),G("Syntro Bootstrap","Core app executors already registered");let V=r.cdnBase||Mt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||Mt("VITE_SYNTRO_CDN_BASE")||Db()||"https://cdn.syntrologie.com",P=ld({cdnBase:V,registry:F.apps,onLoadStart:H=>{G("Syntro Bootstrap",`Loading app from CDN: ${H}`)},onLoadEnd:(H,Q,re)=>{Q?G("Syntro Bootstrap",`App loaded successfully: ${H}`):dt("Syntro Bootstrap",`Failed to load app: ${H}`,re)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:F.apps,appLoader:P,runtime:F,version:F.version},G("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&P.loadApp("adaptive-mcp").catch(H=>{G("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",H)});let K=F.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${K.length} apps in registry:`,K.map(H=>`${H.manifest.id}(${H.state})`).join(", "));for(let H of K)if(H.state==="registered")try{await F.apps.activate(H.manifest.id),console.log(`[DIAG] Activated: ${H.manifest.id} \u2192 widgets: [${F.widgets.list().join(", ")}]`)}catch(Q){console.error(`[DIAG] FAILED to activate: ${H.manifest.id}`,Q),dt("Syntro Bootstrap",`Failed to auto-activate built-in app: ${H.manifest.id}`,Q)}if(console.log(`[DIAG] Activation complete. Total widgets: [${F.widgets.list().join(", ")}]`),g?.refreshFeatures)try{await g.refreshFeatures(),G("Syntro Bootstrap","GrowthBook features loaded")}catch(H){dt("Syntro Bootstrap","Failed to load GrowthBook features:",H)}let Y=await v;if(g&&Object.keys(Y).length>0){let H={...c,...h,...Y,...u};G("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",Y),g.setAttributes?.(H)}let le=await m;le&&g&&(c.surface_type="mcp-app",c.surface_host=le.name,g.setAttributes?.({...c,...h,...Y}),F.context.setSurfaceType("mcp-app"),F.context.setSurfaceHost(le.name),G("Syntro Bootstrap","MCP App detected:",le.name));let D;if(r.fetcher)D=r.fetcher;else if(n?.f){let H=N_(n.f,n.o??{});D=async()=>{let Q=await H.fetch();return{...Q.config,tiles:Q.config.tiles??[]}}}else g&&(D=zn({experiments:g}));let te=new Set,Ze=D?async()=>{let H=await D(),Q=H.tiles?.length??0,re=H.actions?.length??0,fe=H.meta?.variant_id;if((Q>0||re>0)&&(fe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),_&&fe){let Ie=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,Fe=Ie?.interventionTracker,Gt;Fe&&Fe.variantId===fe?Gt=Fe:(Gt=new as(_,fe),Ie&&(Ie.interventionTracker=Gt),F.navigation.subscribe(()=>{Gt.resetPage()})),Gt.trackServed(Q,re)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${H.tiles?.length??0},`,`actions=${H.actions?.length??0},`,`theme=${H.theme?.name??"none"}`),H.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",H.actions.map((Ie,Fe)=>`[${Fe}] ${Ie.kind}${Ie.anchorId?` anchor="${Ie.anchorId.selector}"`:""}${Ie.label?` "${Ie.label}"`:""}`).join(", "));let Ce=H,Se=P.getRequiredApps(Ce);return Se.length>0?console.log("[Syntro Bootstrap] Required external apps:",Se.join(", ")):G("Syntro Bootstrap","No external apps required (all executors are built-in)"),Se.length>0&&await P.loadAppsForConfig(Ce).then(async Fe=>{let Gt=Fe.filter(De=>De.success),Ca=Fe.filter(De=>!De.success);Gt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${Gt.map(De=>De.appId).join(", ")}`);let hn=Ca.filter(De=>!te.has(De.appId));hn.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",hn.map(De=>`${De.appId} (${De.error})`).join(", ")),hn.forEach(De=>te.add(De.appId)));for(let De of Se)if(F.apps.has(De))try{await F.apps.activate(De),console.log(`[Syntro Bootstrap] App activated: ${De}`)}catch(Aa){console.error(`[Syntro Bootstrap] Failed to activate app: ${De}`,Aa)}else console.error(`[Syntro Bootstrap] App "${De}" required by config but NOT registered.`,`Available apps: [${Array.from(F.apps.list?.()??[]).join(", ")}]`)}),H}:void 0;if(y){G("Syntro Bootstrap",`Detected platform: ${y.name}`);try{await y.onInit(),G("Syntro Bootstrap",`Platform adapter initialized: ${y.name}`)}catch(H){dt("Syntro Bootstrap",`Platform adapter init failed: ${y.name}`,H)}}let ot=await ic({...r.canvas,fetcher:Ze,integrations:{experiments:g,telemetry:_},editorUrl:o,runtime:F});if(ot.setOverrideFetcher){let H=ot.setOverrideFetcher.bind(ot);ot.setOverrideFetcher=Q=>{H(async()=>{let fe=await Q(),Ce=fe;if(P.getRequiredApps(Ce).length>0){let Ie=await P.loadAppsForConfig(Ce);for(let Fe of Ie)if(Fe.success&&F.apps.has(Fe.appId))try{await F.apps.activate(Fe.appId)}catch{}}return fe})}}let Ne=ir();if(Ne!==null)try{let H=_,Q=F;Ne.bindRuntime({getSessionId:()=>{try{return H?.getSessionId?.()??""}catch{return""}},getSurface:()=>{try{let re=Q.context.get().surface;return re?{...re}:null}catch{return null}}})}catch{}return Ne?.increment("bootstrap_ok"),{canvas:ot,runtime:F,experiments:g,telemetry:_,sessionMetrics:C,appLoader:P}}async function yR(r){try{return await ew(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),ir()?.increment("bootstrap_errors"),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function bR(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 _R(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 Gg={init:yR,loadAdaptive:_R,encodeToken:sc,decodeToken:Gi,events:{emit:bR}};typeof window<"u"&&(window.Syntro=Gg);function ws(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function xR(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=ws(i),o=ws(Cr);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Cr}. 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${Cr}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:wR(n,i)}):{valid:!0,warnings:e,errors:t}}function wR(r,e){let t={...r};return ws(e).major===1&&(t=SR(t)),t.schemaVersion=Cr,t}function SR(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 kR(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=ws(t),i=ws(Cr);return n.major<i.major||!e.schemaVersion}var tw=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),rw=d.object({url:d.string(),ts:d.number()}),nw=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(rw).optional()}),iw=d.object({width:d.number(),height:d.number()}),sw=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),ow=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:sw.optional()}),aw=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),lw=d.object({page:tw,session:nw,viewport:iw,anchors:d.array(ow).optional(),augmented:aw.optional()});function ER(r){return lw.safeParse(r)}var Ru=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 Iu=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 $u=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 Kg=d.enum(["posthog","canvas","derived"]),cw=d.object({ts:d.number(),name:d.string(),source:Kg,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),uw=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(Kg).optional()});function CR(r){return cw.safeParse(r)}function AR(r){return uw.safeParse(r)}var Yg=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()})]),dw=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:Yg,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()}),pw=d.object({kind:d.literal("highlight"),id:d.string(),anchor:Yg,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()}),Mu=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([dw,pw]))});function TR(r){return Mu.parse(r)}var RR=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Vl({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 Mu.parse(o)};var hw=d.object({value:d.unknown(),expiresAt:d.number().optional()}),fw=d.object({count:d.number(),resetAt:d.number().optional()});function IR(r){return hw.safeParse(r)}function $R(r){return fw.safeParse(r)}var Xg="2026-05-08T20:29:05.447Z (38b78b3f250)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Xg} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Ws;window.SynOS={...r,appRegistry:e,_runtimeBuild:Xg,_renderer:"lit"},wo(),gy(e)}return _w(MR);})();
|
|
1066
1066
|
/*! Bundled license information:
|
|
1067
1067
|
|
|
1068
1068
|
@lit/reactive-element/css-tag.js:
|