@syntrologie/runtime-sdk 2.8.0-canary.183 → 2.8.0-canary.185
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/defaults/clickIds.d.ts +14 -0
- package/dist/defaults/identifyOnEmail.d.ts +23 -0
- package/dist/defaults/identifyOnUrlParam.d.ts +29 -0
- package/dist/defaults/index.d.ts +51 -0
- package/dist/defaults/initialProperties.d.ts +26 -0
- package/dist/defaults/jsonLd.d.ts +17 -0
- package/dist/index.js +729 -1
- package/dist/index.js.map +4 -4
- package/dist/smart-canvas.esm.js +100 -100
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +711 -2
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +101 -101
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/telemetry/adapters/posthog.d.ts +26 -0
- package/dist/telemetry/consent/ConsentDetector.d.ts +26 -0
- package/dist/telemetry/{consent.d.ts → consent/ConsentGate.d.ts} +33 -1
- package/dist/telemetry/consent/adapters/gtmConsentMode.d.ts +18 -0
- package/dist/telemetry/consent/adapters/iabTcf.d.ts +21 -0
- package/dist/telemetry/consent/adapters/shopify.d.ts +17 -0
- package/dist/telemetry/consent/index.d.ts +17 -0
- package/dist/telemetry/consent/types.d.ts +47 -0
- package/dist/telemetry/types.d.ts +24 -0
- package/dist/version.d.ts +1 -1
- package/package.json +3 -5
- package/schema/canvas-config.schema.json +352 -1
- package/CAPABILITIES.md +0 -1450
package/dist/smart-canvas.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnPropertyDescriptor;var H0=Object.getOwnPropertyNames;var B0=Object.prototype.hasOwnProperty;var eg=r=>{throw TypeError(r)};var V0=(r,e,t)=>e in r?ca(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var tg=(r,e)=>{for(var t in e)ca(r,t,{get:e[t],enumerable:!0})},j0=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of H0(e))!B0.call(r,i)&&i!==t&&ca(r,i,{get:()=>e[i],enumerable:!(n=D0(e,i))||n.enumerable});return r};var U0=r=>j0(ca({},"__esModule",{value:!0}),r);var xe=(r,e,t)=>V0(r,typeof e!="symbol"?e+"":e,t),cu=(r,e,t)=>e.has(r)||eg("Cannot "+t);var q=(r,e,t)=>(cu(r,e,"read from private field"),t?t.call(r):e.get(r)),ve=(r,e,t)=>e.has(r)?eg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),oe=(r,e,t,n)=>(cu(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),_e=(r,e,t)=>(cu(r,e,"access private method"),t);var uu=(r,e,t,n)=>({set _(i){oe(r,e,i,t)},get _(){return q(r,e,n)}});var O2={};tg(O2,{ANIMATION_KEYFRAMES:()=>Yi,ActivationConfigZ:()=>fo,AddClassZ:()=>np,AnchorIdZ:()=>yt,AnchorStateZ:()=>T0,AnchorVisibleConditionZ:()=>Ga,AppRegistry:()=>pi,AugmentationZ:()=>I0,BadgePositionZ:()=>qd,BadgeZ:()=>cp,BoundingBoxZ:()=>R0,CanvasEvents:()=>Oi,CanvasRecipeZ:()=>su,ConditionZ:()=>br,ContextManager:()=>Eo,CooldownActiveConditionZ:()=>el,CounterDefZ:()=>ki,CtaButtonZ:()=>Il,DEFAULT_COOLDOWN:()=>pl,DecisionController:()=>ru,DecisionStrategyZ:()=>Ti,DismissedConditionZ:()=>Qa,EVENT_SCHEMA_VERSION:()=>$e,EventBus:()=>vo,EventCountConditionZ:()=>rl,EventFilterZ:()=>O0,EventHistory:()=>Bi,EventOccurredConditionZ:()=>Ka,EventSourceZ:()=>Gf,ExecutorRegistry:()=>po,ExternalStrategyZ:()=>Ri,FrequencyEntryZ:()=>F0,FrequencyLimitConditionZ:()=>tl,HighlightStepZ:()=>N0,HighlightStyleZ:()=>zd,HighlightZ:()=>ap,InsertHtmlZ:()=>op,InsertPositionZ:()=>Yd,InterventionTracker:()=>Xi,MAX_VISIBLE_TOASTS:()=>Qs,MatchOpZ:()=>wi,ModalContentZ:()=>Kd,ModalZ:()=>dp,ModelStrategyZ:()=>Ai,MountWidgetZ:()=>fp,NavigateZ:()=>hp,NavigationMonitor:()=>Gi,NormalizedEventZ:()=>M0,NotificationsController:()=>Mi,PageContextZ:()=>S0,PageHistoryEntryZ:()=>E0,PageUrlConditionZ:()=>qa,ParallelZ:()=>vp,PlacementZ:()=>Zd,PulseZ:()=>lp,RUNTIME_SDK_BUILD:()=>Yf,RUNTIME_VERSION:()=>nh,RemoveClassZ:()=>ip,RouteConditionZ:()=>Za,RouteFilterZ:()=>Ud,RuleStrategyZ:()=>Ei,RuleZ:()=>Si,RuntimeContextZ:()=>$0,RuntimeController:()=>nu,RuntimeEventsController:()=>iu,SDK_SCHEMA_VERSION:()=>_r,SDK_VERSION:()=>vl,STATIC_SLOT_STYLES:()=>th,ScoreStrategyZ:()=>Ci,ScrollBehaviorZ:()=>ep,ScrollLogicalPositionZ:()=>Tl,ScrollToZ:()=>pp,SelectorZ:()=>Kf,SequenceZ:()=>mp,SessionContextZ:()=>C0,SessionMetricConditionZ:()=>Ja,SessionMetricTracker:()=>So,SetAttrZ:()=>rp,SetStyleZ:()=>sp,SetTextZ:()=>tp,SmartCanvasController:()=>bl,SmartCanvasElementLit:()=>jn,StandardEvents:()=>ze,StateEqualsConditionZ:()=>Ya,StateStore:()=>Io,StoredValueZ:()=>L0,Syntro:()=>Zf,ThemeController:()=>Pi,TooltipContentZ:()=>Gd,TooltipStepZ:()=>P0,TooltipTriggerZ:()=>Xd,TooltipZ:()=>up,TourStepForSchemaZ:()=>Qd,TourZ:()=>yp,TriggerWhenZ:()=>Xs,ViewportConditionZ:()=>Xa,ViewportContextZ:()=>A0,WaitZ:()=>gp,WidgetConfigZ:()=>Jd,WidgetRegistry:()=>Mo,applyStaticSlotStyles:()=>pc,coreActionStepSchemas:()=>Qv,createActionEngine:()=>Rl,createAnchorResolver:()=>$l,createCanvasConfigFetcher:()=>Dn,createContextManager:()=>lc,createDecisionEngine:()=>cc,createEventAccumulator:()=>uc,createEventBus:()=>Hi,createGrowthBookClient:()=>nc,createNoopClient:()=>wc,createOverlayRecipeFetcher:()=>I2,createPostHogClient:()=>tu,createPostHogNormalizer:()=>dd,createSessionMetricTracker:()=>ic,createSmartCanvas:()=>Nl,createSmartCanvasController:()=>md,createSmartCanvasRuntime:()=>xc,createStateStore:()=>dc,createSurfaceContainer:()=>vc,createSurfaces:()=>bc,decisionSchemas:()=>cE,decodeToken:()=>Di,encodeToken:()=>Ll,evaluate:()=>Yp,evaluateCondition:()=>Gp,evaluateRule:()=>Kp,evaluateRuleStrategy:()=>Co,evaluateScoreStrategy:()=>Ao,evaluateSync:()=>Xp,executorRegistry:()=>ir,getAntiFlickerSnippet:()=>ry,getExecutor:()=>Xv,getSlotAnchorId:()=>$o,getSlotType:()=>Ki,getSlotZIndex:()=>yc,hasExecutor:()=>El,needsMigration:()=>E2,normalizePostHogEvent:()=>Ii,parseVersion:()=>ps,playEnterAnimation:()=>gc,playExitAnimation:()=>mc,registerConfigPredicates:()=>Vn,registerSmartCanvasElement:()=>lo,resolveConfigUri:()=>yl,runtimeContext:()=>Vv,setupAdjacentPositioning:()=>hc,setupInlinePositioning:()=>fc,shouldNormalizeEvent:()=>$i,validateAction:()=>Ut,validateActions:()=>ho,validateActivationConfig:()=>lE,validateCondition:()=>oE,validateConfig:()=>w2,validateEventFilter:()=>R2,validateEventName:()=>Fl,validateFrequencyEntry:()=>M2,validateNormalizedEvent:()=>A2,validateProps:()=>Dl,validateRecipe:()=>T2,validateRuntimeContext:()=>C2,validateStoredValue:()=>$2,validateStrategy:()=>aE,widgetRegistry:()=>_c});function W0(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 z0=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 rg(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(!z0.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 ng=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=rg(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=W0(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=rg(p.html))}}};function ig(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 ig(t)}return r}var sg=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=ig(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)}}},og=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)}}},ag=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))}}},lg=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)}}},cg=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)}}},du=[{kind:"content:insertHtml",executor:ng},{kind:"content:setText",executor:sg},{kind:"content:setAttr",executor:og},{kind:"content:addClass",executor:ag},{kind:"content:removeClass",executor:lg},{kind:"content:setStyle",executor:cg}],pu={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:du};var ug=r=>{throw TypeError(r)},dg=(r,e,t)=>e.has(r)||ug("Cannot "+t),Ve=(r,e,t)=>(dg(r,e,"read from private field"),t?t.call(r):e.get(r)),Nr=(r,e,t)=>e.has(r)?ug("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),cr=(r,e,t,n)=>(dg(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var fg=["top","right","bottom","left"];var Lr=Math.min,ur=Math.max,fs=Math.round,gs=Math.floor,Ot=r=>({x:r,y:r}),q0={left:"right",right:"left",bottom:"top",top:"bottom"},Z0={start:"end",end:"start"};function da(r,e,t){return ur(r,Lr(e,t))}function an(r,e){return typeof r=="function"?r(e):r}function Fr(r){return r.split("-")[0]}function ri(r){return r.split("-")[1]}function hu(r){return r==="x"?"y":"x"}function pa(r){return r==="y"?"height":"width"}var G0=new Set(["top","bottom"]);function dr(r){return G0.has(Fr(r))?"y":"x"}function ha(r){return hu(dr(r))}function gg(r,e,t){t===void 0&&(t=!1);let n=ri(r),i=ha(r),s=pa(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=hs(o)),[o,hs(o)]}function mg(r){let e=hs(r);return[ua(r),e,ua(e)]}function ua(r){return r.replace(/start|end/g,e=>Z0[e])}var pg=["left","right"],hg=["right","left"],K0=["top","bottom"],Y0=["bottom","top"];function X0(r,e,t){switch(r){case"top":case"bottom":return t?e?hg:pg:e?pg:hg;case"left":case"right":return e?K0:Y0;default:return[]}}function vg(r,e,t,n){let i=ri(r),s=X0(Fr(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(ua)))),s}function hs(r){return r.replace(/left|right|bottom|top/g,e=>q0[e])}function J0(r){return{top:0,right:0,bottom:0,left:0,...r}}function fu(r){return typeof r!="number"?J0(r):{top:r,right:r,bottom:r,left:r}}function ln(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 yg(r,e,t){let{reference:n,floating:i}=r,s=dr(e),o=ha(e),a=pa(o),l=Fr(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(ri(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 xg(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}=an(e,r),v=fu(f),m=a[h?p==="floating"?"reference":"floating":p],y=ln(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(m)))==null||t?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=p==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},w=ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,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 wg=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}=yg(c,n,l),h=n,f={},v=0;for(let m=0;m<a.length;m++){var g;let{name:y,fn:x}=a[m],{x:k,y:b,data:w,reset:C}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:xg},elements:{reference:r,floating:e}});u=k??u,p=b??p,f={...f,[y]:{...f[y],...w}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):C.rects),{x:u,y:p}=yg(c,h,l)),m=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},kg=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}=an(r,e)||{};if(c==null)return{};let p=fu(u),h={x:t,y:n},f=ha(i),v=pa(f),g=await o.getDimensions(c),m=f==="y",y=m?"top":"left",x=m?"bottom":"right",k=m?"clientHeight":"clientWidth",b=s.reference[v]+s.reference[f]-h[f]-s.floating[v],w=h[f]-s.reference[f],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),_=C?C[k]:0;(!_||!await(o.isElement==null?void 0:o.isElement(C)))&&(_=a.floating[k]||s.floating[v]);let A=b/2-w/2,$=_/2-g[v]/2-1,T=Lr(p[y],$),O=Lr(p[x],$),X=T,F=_-g[v]-O,N=_/2-g[v]/2+A,Z=da(X,N,F),K=!l.arrow&&ri(i)!=null&&N!==Z&&s.reference[v]/2-(N<X?T:O)-g[v]/2<0,le=K?N<X?N-X:N-F:0;return{[f]:h[f]+le,data:{[f]:Z,centerOffset:N-Z-le,...K&&{alignmentOffset:le}},reset:K}}});var Sg=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}=an(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=Fr(i),x=dr(a),k=Fr(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(k||!g?[hs(a)]:mg(a)),C=v!=="none";!h&&C&&w.push(...vg(a,g,v,b));let _=[a,...w],A=await l.detectOverflow(e,m),$=[],T=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&$.push(A[y]),p){let N=gg(i,o,b);$.push(A[N[0]],A[N[1]])}if(T=[...T,{placement:i,overflows:$}],!$.every(N=>N<=0)){var O,X;let N=(((O=s.flip)==null?void 0:O.index)||0)+1,Z=_[N];if(Z&&(!(p==="alignment"?x!==dr(Z):!1)||T.every(U=>dr(U.placement)===x?U.overflows[0]>0:!0)))return{data:{index:N,overflows:T},reset:{placement:Z}};let K=(X=T.filter(le=>le.overflows[0]<=0).sort((le,U)=>le.overflows[1]-U.overflows[1])[0])==null?void 0:X.placement;if(!K)switch(f){case"bestFit":{var F;let le=(F=T.filter(U=>{if(C){let ee=dr(U.placement);return ee===x||ee==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(ee=>ee>0).reduce((ee,D)=>ee+D,0)]).sort((U,ee)=>U[1]-ee[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 bg(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function _g(r){return fg.some(e=>r[e]>=0)}var Eg=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=an(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=bg(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:_g(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=bg(o,t.floating);return{data:{escapedOffsets:a,escaped:_g(a)}}}default:return{}}}}};var Q0=new Set(["left","top"]);async function ex(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Fr(t),a=ri(t),l=dr(t)==="y",c=Q0.has(o)?-1:1,u=s&&l?-1:1,p=an(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 Cg=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 ex(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}}}}},Ag=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){let{x:t,y:n,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x,y:k}=y;return{x,y:k}}},...c}=an(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=dr(Fr(i)),f=hu(h),v=u[f],g=u[h];if(o){let y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=v+p[y],b=v-p[x];v=da(k,v,b)}if(a){let y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=g+p[y],b=g-p[x];g=da(k,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 fa(){return typeof window<"u"}function cn(r){return Tg(r)?(r.nodeName||"").toLowerCase():"#document"}function ut(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Pt(r){var e;return(e=(Tg(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Tg(r){return fa()?r instanceof Node||r instanceof ut(r).Node:!1}function St(r){return fa()?r instanceof Element||r instanceof ut(r).Element:!1}function Nt(r){return fa()?r instanceof HTMLElement||r instanceof ut(r).HTMLElement:!1}function Rg(r){return!fa()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ut(r).ShadowRoot}var tx=new Set(["inline","contents"]);function ii(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=Et(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!tx.has(i)}var rx=new Set(["table","td","th"]);function Ig(r){return rx.has(cn(r))}var nx=[":popover-open",":modal"];function ms(r){return nx.some(e=>{try{return r.matches(e)}catch{return!1}})}var ix=["transform","translate","scale","rotate","perspective"],sx=["transform","translate","scale","rotate","perspective","filter"],ox=["paint","layout","strict","content"];function ga(r){let e=ma(),t=St(r)?Et(r):r;return ix.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)||sx.some(n=>(t.willChange||"").includes(n))||ox.some(n=>(t.contain||"").includes(n))}function $g(r){let e=pr(r);for(;Nt(e)&&!un(e);){if(ga(e))return e;if(ms(e))return null;e=pr(e)}return null}function ma(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var ax=new Set(["html","body","#document"]);function un(r){return ax.has(cn(r))}function Et(r){return ut(r).getComputedStyle(r)}function vs(r){return St(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function pr(r){if(cn(r)==="html")return r;let e=r.assignedSlot||r.parentNode||Rg(r)&&r.host||Pt(r);return Rg(e)?e.host:e}function Mg(r){let e=pr(r);return un(e)?r.ownerDocument?r.ownerDocument.body:r.body:Nt(e)&&ii(e)?e:Mg(e)}function ni(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Mg(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=ut(i);if(s){let a=va(o);return e.concat(o,o.visualViewport||[],ii(i)?i:[],a&&t?ni(a):[])}return e.concat(i,ni(i,[],t))}function va(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Lg(r){let e=Et(r),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=Nt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=fs(t)!==s||fs(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function mu(r){return St(r)?r:r.contextElement}function si(r){let e=mu(r);if(!Nt(e))return Ot(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Lg(e),o=(s?fs(t.width):t.width)/n,a=(s?fs(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var lx=Ot(0);function Fg(r){let e=ut(r);return!ma()||!e.visualViewport?lx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function cx(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==ut(r)?!1:e}function dn(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=mu(r),o=Ot(1);e&&(n?St(n)&&(o=si(n)):o=si(r));let a=cx(s,t,n)?Fg(s):Ot(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=ut(s),f=n&&St(n)?ut(n):n,v=h,g=va(v);for(;g&&n&&f!==v;){let m=si(g),y=g.getBoundingClientRect(),x=Et(g),k=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+=k,c+=b,v=ut(g),g=va(v)}}return ln({width:u,height:p,x:l,y:c})}function ya(r,e){let t=vs(r).scrollLeft;return e?e.left+t:dn(Pt(r)).left+t}function Dg(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-ya(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function ux(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=Pt(n),a=e?ms(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Ot(1),u=Ot(0),p=Nt(n);if((p||!p&&!s)&&((cn(n)!=="body"||ii(o))&&(l=vs(n)),Nt(n))){let f=dn(n);c=si(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?Dg(o,l):Ot(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 dx(r){return Array.from(r.getClientRects())}function px(r){let e=Pt(r),t=vs(r),n=r.ownerDocument.body,i=ur(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ur(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+ya(r),a=-t.scrollTop;return Et(n).direction==="rtl"&&(o+=ur(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Og=25;function hx(r,e){let t=ut(r),n=Pt(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let u=ma();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=ya(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<=Og&&(s-=v)}else c<=Og&&(s+=c);return{width:s,height:o,x:a,y:l}}var fx=new Set(["absolute","fixed"]);function gx(r,e){let t=dn(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Nt(r)?si(r):Ot(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 Pg(r,e,t){let n;if(e==="viewport")n=hx(r,t);else if(e==="document")n=px(Pt(r));else if(St(e))n=gx(e,t);else{let i=Fg(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ln(n)}function Hg(r,e){let t=pr(r);return t===e||!St(t)||un(t)?!1:Et(t).position==="fixed"||Hg(t,e)}function mx(r,e){let t=e.get(r);if(t)return t;let n=ni(r,[],!1).filter(a=>St(a)&&cn(a)!=="body"),i=null,s=Et(r).position==="fixed",o=s?pr(r):r;for(;St(o)&&!un(o);){let a=Et(o),l=ga(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&fx.has(i.position)||ii(o)&&!l&&Hg(r,o))?n=n.filter(u=>u!==o):i=a,o=pr(o)}return e.set(r,n),n}function vx(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?ms(e)?[]:mx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=Pg(e,u,i);return c.top=ur(p.top,c.top),c.right=Lr(p.right,c.right),c.bottom=Lr(p.bottom,c.bottom),c.left=ur(p.left,c.left),c},Pg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function yx(r){let{width:e,height:t}=Lg(r);return{width:e,height:t}}function bx(r,e,t){let n=Nt(e),i=Pt(e),s=t==="fixed",o=dn(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Ot(0);function c(){l.x=ya(i)}if(n||!n&&!s)if((cn(e)!=="body"||ii(i))&&(a=vs(e)),n){let f=dn(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?Dg(i,a):Ot(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 gu(r){return Et(r).position==="static"}function Ng(r,e){if(!Nt(r)||Et(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Pt(r)===t&&(t=t.ownerDocument.body),t}function Bg(r,e){let t=ut(r);if(ms(r))return t;if(!Nt(r)){let i=pr(r);for(;i&&!un(i);){if(St(i)&&!gu(i))return i;i=pr(i)}return t}let n=Ng(r,e);for(;n&&Ig(n)&&gu(n);)n=Ng(n,e);return n&&un(n)&&gu(n)&&!ga(n)?t:n||$g(r)||t}var _x=async function(r){let e=this.getOffsetParent||Bg,t=this.getDimensions,n=await t(r.floating);return{reference:bx(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function xx(r){return Et(r).direction==="rtl"}var wx={convertOffsetParentRelativeRectToViewportRelativeRect:ux,getDocumentElement:Pt,getClippingRect:vx,getOffsetParent:Bg,getElementRects:_x,getClientRects:dx,getDimensions:yx,getScale:si,isElement:St,isRTL:xx};function Vg(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function kx(r,e){let t=null,n,i=Pt(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=gs(p),g=gs(i.clientWidth-(u+h)),m=gs(i.clientHeight-(p+f)),y=gs(u),k={rootMargin:-v+"px "+-g+"px "+-m+"px "+-y+"px",threshold:ur(0,Lr(1,l))||1},b=!0;function w(C){let _=C[0].intersectionRatio;if(_!==l){if(!b)return o();_?o(!1,_):n=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!Vg(c,r.getBoundingClientRect())&&o(),b=!1}try{t=new IntersectionObserver(w,{...k,root:i.ownerDocument})}catch{t=new IntersectionObserver(w,k)}t.observe(r)}return o(!0),s}function ba(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=mu(r),u=i||s?[...c?ni(c):[],...ni(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let p=c&&a?kx(c,t):null,h=-1,f=null;o&&(f=new ResizeObserver(y=>{let[x]=y;x&&x.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let v,g=l?dn(r):null;l&&m();function m(){let y=dn(r);g&&!Vg(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 _a=Cg;var xa=Ag,wa=Sg;var jg=Eg,Ug=kg;var ka=(r,e,t)=>{let n=new Map,i={platform:wx,...t},s={...i.platform,_c:n};return wg(r,e,{...i,platform:s})};var Sa=globalThis,Ea=Sa.ShadowRoot&&(Sa.ShadyCSS===void 0||Sa.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vu=Symbol(),Wg=new WeakMap,ys=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==vu)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ea&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Wg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Wg.set(t,e))}return e}toString(){return this.cssText}},zg=r=>new ys(typeof r=="string"?r:r+"",void 0,vu),pn=(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 ys(t,r,vu)},qg=(r,e)=>{if(Ea)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Sa.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},yu=Ea?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return zg(t)})(r):r;var{is:Sx,defineProperty:Ex,getOwnPropertyDescriptor:Cx,getOwnPropertyNames:Ax,getOwnPropertySymbols:Rx,getPrototypeOf:Tx}=Object,Dr=globalThis,Zg=Dr.trustedTypes,Ix=Zg?Zg.emptyScript:"",$x=Dr.reactiveElementPolyfillSupport,bs=(r,e)=>r,bu={toAttribute(r,e){switch(e){case Boolean:r=r?Ix: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}},Kg=(r,e)=>!Sx(r,e),Gg={attribute:!0,type:String,converter:bu,reflect:!1,useDefault:!1,hasChanged:Kg};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Dr.litPropertyMetadata??(Dr.litPropertyMetadata=new WeakMap);var hr=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=Gg){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&&Ex(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=Cx(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)??Gg}static _$Ei(){if(this.hasOwnProperty(bs("elementProperties")))return;let e=Tx(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(bs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bs("properties"))){let t=this.properties,n=[...Ax(t),...Rx(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(yu(i))}else e!==void 0&&t.push(yu(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 qg(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:bu).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:bu;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??Kg)(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){}};hr.elementStyles=[],hr.shadowRootOptions={mode:"open"},hr[bs("elementProperties")]=new Map,hr[bs("finalized")]=new Map,$x?.({ReactiveElement:hr}),(Dr.reactiveElementVersions??(Dr.reactiveElementVersions=[])).push("2.1.2");var xs=globalThis,Yg=r=>r,Ca=xs.trustedTypes,Xg=Ca?Ca.createPolicy("lit-html",{createHTML:r=>r}):void 0,nm="$lit$",Hr=`lit$${Math.random().toFixed(9).slice(2)}$`,im="?"+Hr,Mx=`<${im}>`,gn=document,ws=()=>gn.createComment(""),ks=r=>r===null||typeof r!="object"&&typeof r!="function",Cu=Array.isArray,Ox=r=>Cu(r)||typeof r?.[Symbol.iterator]=="function",_u=`[
|
|
2
|
-
\f\r]`,_s=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),em=/'/g,tm=/"/g,sm=/^(?:script|style|textarea|title)$/i,Au=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),L=Au(1),tR=Au(2),rR=Au(3),Lt=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),rm=new WeakMap,fn=gn.createTreeWalker(gn,129);function om(r,e){if(!Cu(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Xg!==void 0?Xg.createHTML(e):e}var Px=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=_s;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===_s?u[1]==="!--"?o=Jg:u[1]!==void 0?o=Qg:u[2]!==void 0?(sm.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=hn):u[3]!==void 0&&(o=hn):o===hn?u[0]===">"?(o=i??_s,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?hn:u[3]==='"'?tm:em):o===tm||o===em?o=hn:o===Jg||o===Qg?o=_s:(o=hn,i=void 0);let f=o===hn&&r[a+1].startsWith("/>")?" ":"";s+=o===_s?l+Mx:p>=0?(n.push(c),l.slice(0,p)+nm+l.slice(p)+Hr+f):l+Hr+(p===-2?a:f)}return[om(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Ss=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]=Px(e,t);if(this.el=r.createElement(c,n),fn.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=fn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(nm)){let h=u[o++],f=i.getAttribute(p).split(Hr),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?wu:v[1]==="?"?ku:v[1]==="@"?Su:ai}),i.removeAttribute(p)}else p.startsWith(Hr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(sm.test(i.tagName)){let p=i.textContent.split(Hr),h=p.length-1;if(h>0){i.textContent=Ca?Ca.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],ws()),fn.nextNode(),l.push({type:2,index:++s});i.append(p[h],ws())}}}else if(i.nodeType===8)if(i.data===im)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(Hr,p+1))!==-1;)l.push({type:7,index:s}),p+=Hr.length-1}s++}}static createElement(e,t){let n=gn.createElement("template");return n.innerHTML=e,n}};function oi(r,e,t=r,n){if(e===Lt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=ks(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=oi(r,i._$AS(r,e.values),i,n)),e}var xu=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??gn).importNode(t,!0);fn.currentNode=i;let s=fn.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Es(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Eu(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=fn.nextNode(),o++)}return fn.currentNode=gn,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++}},Es=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Q,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=oi(this,e,t),ks(e)?e===Q||e==null||e===""?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==Lt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ox(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!==Q&&ks(this._$AH)?this._$AA.nextSibling.data=e:this.T(gn.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=Ss.createElement(om(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new xu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=rm.get(e.strings);return t===void 0&&rm.set(e.strings,t=new Ss(e)),t}k(e){Cu(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(ws()),this.O(ws()),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=Yg(e).nextSibling;Yg(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Q,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=Q}_$AI(e,t=this,n,i){let s=this.strings,o=!1;if(s===void 0)e=oi(this,e,t,0),o=!ks(e)||e!==this._$AH&&e!==Lt,o&&(this._$AH=e);else{let a=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=oi(this,a[n+l],t,l),c===Lt&&(c=this._$AH[l]),o||(o=!ks(c)||c!==this._$AH[l]),c===Q?e=Q:e!==Q&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},wu=class extends ai{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}},ku=class extends ai{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}},Su=class extends ai{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=oi(this,e,t,0)??Q)===Lt)return;let n=this._$AH,i=e===Q&&n!==Q||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Q&&(n===Q||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)}},Eu=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){oi(this,e)}};var Nx=xs.litHtmlPolyfillSupport;Nx?.(Ss,Es),(xs.litHtmlVersions??(xs.litHtmlVersions=[])).push("3.3.2");var am=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new Es(e.insertBefore(ws(),s),s,void 0,t??{})}return i._$AI(r),i};var Cs=globalThis,ye=class extends hr{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=am(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Lt}};ye._$litElement$=!0,ye.finalized=!0,Cs.litElementHydrateSupport?.({LitElement:ye});var Lx=Cs.litElementPolyfillSupport;Lx?.({LitElement:ye});(Cs.litElementVersions??(Cs.litElementVersions=[])).push("4.2.2");var Aa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ra=r=>(...e)=>({_$litDirective$:r,values:e}),li=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 lm="important",Fx=" !"+lm,R=Ra(class extends li{constructor(r){if(super(r),r.type!==Aa.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(Fx);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?lm:""):t[n]=i}}return Lt}});var Dx={light:50,medium:100,heavy:200},Hx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],Bx={init(r,e,t){let n=Dx[t.intensity],i=t.colors.length>0?t.colors:Hx,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())}},Vx={light:20,medium:40,heavy:80},jx="\u{1F389}",Ux={init(r,e,t){let n=Vx[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:jx,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())}},Wx={light:20,medium:40,heavy:80},zx={light:3,medium:4,heavy:5},qx={init(r,e,t){let n=Wx[t.intensity],i=zx[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())}},Zx={light:30,medium:60,heavy:120},Gx={init(r,e,t){let n=Zx[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()}}},Kx=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)}},Yx=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function Xx(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function Jx(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 Xx(t,n||t)}catch{}return null}var cm=new Map([["confetti",Bx],["fireworks",qx],["sparkles",Gx],["emoji-rain",Ux]]),Qx=async(r,e)=>{let t=cm.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...cm.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??Jx(e.overlayRoot)??Yx,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new Kx;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}},Iu="syntro_active_tour",Ta=new Map;function ew(r){try{let e=localStorage.getItem(Iu);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Ru(r){try{localStorage.setItem(Iu,JSON.stringify(r))}catch{}}function tw(){try{localStorage.removeItem(Iu)}catch{}}function Is(){return window.location.pathname}function rw(r){if(!r.route)return!0;let e=Is();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var fm=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(Ta.has(t))return{cleanup:async()=>{let k=Ta.get(t);k&&await k.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=ew(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Ru(o));let l=n.findIndex(k=>k.id===o.currentStepId);if(l===-1){let k=i||n[0].id;l=n.findIndex(b=>b.id===k),l===-1&&(l=0),o.currentStepId=n[l].id,Ru(o)}let c=n[l];if(!rw(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Is()}),{cleanup:()=>{}};let u=!1,p=null,h=null,f=null,v=async()=>{h&&(h(),h=null),p?.isApplied()&&(await p.revert(),p=null)},g=async k=>{if(u)return;if(await v(),k==="end"){tw(),e.publishEvent("tour.completed",{tourId:t,totalSteps:n.length}),u=!0;return}let b=n.find(w=>w.id===k);if(!b){console.error(`[Tour] Step "${k}" not found`);return}if(o.currentStepId=k,Ru(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:k}),b.route&&b.route!==Is()){e.publishEvent("tour.awaiting_navigation",{tourId:t,stepId:k,targetRoute:b.route});return}await m(b)},m=async k=>{if(!u){e.publishEvent("tour.step_started",{tourId:t,stepId:k.id,stepIndex:n.findIndex(b=>b.id===k.id),totalSteps:n.length});try{p=await e.applyAction(k.action)}catch(b){console.error(`[Tour] Failed to execute step "${k.id}":`,b),e.publishEvent("tour.step_failed",{tourId:t,stepId:k.id,error:String(b)});return}if(k.onAction&&e.subscribeEvent){h=e.subscribeEvent("action.modal_cta_clicked",C=>{let _=C?.actionId;if(_&&k.onAction){let A=k.onAction[_];A&&g(A)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",C=>{let _=C?.actionId;if(_&&k.onAction){let A=k.onAction[_];A&&g(A)}}),w=h;h=()=>{w(),b()}}}};f=(()=>{let k=Is(),b=()=>{let _=Is();_!==k&&(k=_,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),C=history.replaceState.bind(history);return history.pushState=(..._)=>{w(..._),queueMicrotask(b)},history.replaceState=(..._)=>{C(..._),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=w,history.replaceState=C}})(),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,Ta.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Ta.set(t,{cleanup:x}),{cleanup:x}},qt={white:"#ffffff",black:"#000000"},dt={0:"#2c0b0a",1:"#5b1715",2:"#89221f",3:"#b72e2a",4:"#d44844",5:"#dd6d69",6:"#e5918f",7:"#eeb6b4",8:"#f6dada",9:"#faebea"},P={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"},Fe={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Zt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},rt={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},vn={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},As={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Rs={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Ts={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},kR={primary:P[10],secondary:P[9],tertiary:P[8]},SR={primary:P[2],secondary:P[0]},ER={primary:P[4],secondary:P[3]},CR={primary:{text:qt.white,icon:qt.white,border:dt[3],backgroundDefault:dt[3],backgroundHover:dt[2]},neutral:{text:P[10],textHover:qt.white,icon:P[10],iconHover:qt.white,border:P[4],background:P[2]},link:{text:qt.white,icon:qt.white,hover:dt[5]},error:{text:rt[5],hover:rt[6]},success:{text:Fe[5],hover:Fe[6]}},AR={slateGrey:{content:P[10],pillOutline:P[10],borderPrimary:P[5],borderSecondary:P[5],background:P[3]},brand:{content:dt[9],pillOutline:dt[9],borderPrimary:dt[6],borderSecondary:dt[6],background:dt[0]},red:{content:rt[8],pillOutline:rt[4],borderPrimary:rt[2],borderSecondary:rt[2],background:rt[0]},yellow:{content:Zt[8],pillOutline:Zt[4],borderPrimary:Zt[2],borderSecondary:Zt[2],background:Zt[0]},green:{content:Fe[8],pillOutline:Fe[4],borderPrimary:Fe[2],borderSecondary:Fe[2],background:Fe[0]},purple:{content:Rs[8],pillOutline:Rs[4],borderPrimary:Rs[2],borderSecondary:Rs[2],background:Rs[0]},blue:{content:vn[8],pillOutline:vn[4],borderPrimary:vn[2],borderSecondary:vn[2],background:vn[0]},orange:{content:As[8],pillOutline:As[4],borderPrimary:As[2],borderSecondary:As[2],background:As[0]},pink:{content:Ts[8],pillOutline:Ts[4],borderPrimary:Ts[2],borderSecondary:Ts[2],background:Ts[0]}},RR={green:{content:Fe[8],border:Fe[2],background:Fe[0]},yellow:{content:Zt[8],border:Zt[2],background:Zt[0]},red:{content:rt[8],border:rt[2],background:rt[0]}},TR={green:{content:Fe[1],background:Fe[9]},yellow:{content:Zt[1],background:Zt[9]},red:{content:rt[1],background:rt[9]}},IR={content:P[10],border:P[4],background:P[3]},$R={backgroundDefault:P[2],backgroundHover:P[1],selected:P[3]},MR={background:P[2],icon:P[10],borderDefault:P[4],borderSelected:dt[3],textLabel:P[9],textPlaceholder:P[8],textHint:P[8]},OR={backgroundDefault:P[2],backgroundDisabled:P[0],textLabel:P[9],textPlaceholder:P[8],textHint:P[8],textError:rt[5],iconDefault:P[9],iconPlaceholder:P[10],iconError:rt[5],borderDefault:P[4],borderSelected:dt[3],borderError:rt[5]},PR={handleDefault:qt.white,handleDisabled:P[10],off:{backgroundDefault:P[4],backgroundHover:P[5],backgroundDisabled:P[4]},on:{backgroundDefault:Fe[3],backgroundHover:Fe[2],backgroundDisabled:P[4]}},NR={off:{backgroundDefault:"#00000000",backgroundHover:P[5],backgroundDisabled:P[2],border:P[6]},on:{backgroundDefault:Fe[0],backgroundHover:Fe[1],backgroundDisabled:P[2],border:Fe[3]}},LR={content:P[10],background:P[4]},FR={background:P[4],active:Fe[3]},DR={background:P[1],content:P[9],border:P[4]},HR={backgroundDefault:P[1],backgroundHover:P[3],backgroundActive:P[4],border:P[4],contentPrimary:P[10],contentSecondary:P[9],contentTertiary:P[8]},BR={background:P[1],content:P[9],border:P[4]},VR={activeBackground:P[3],activeContent:dt[5],inactiveContent:P[9],border:P[4]},jR={header:{textDefault:P[9],textHover:P[8],backgroundDefault:P[1]},border:P[4],cell:{textPrimary:P[10],textSecondary:P[9],backgroundDefault:P[2],backgroundHover:P[1]}},UR={textPrimaryDefault:P[10],textPrimaryHover:P[10],textSecondaryDefault:P[8],textSecondaryHover:P[9],iconPrimary:P[10],iconSecondary:P[8]},WR={background:Fe[1],active:Fe[5]},zR={textDefault:P[10],textSelected:qt.white,textDisabled:P[7],backgroundDefault:P[2],backgroundMiddle:P[3],backgroundSelected:dt[3],border:P[4]},qR=P[9],ZR={size:56,inset:12,background:qt.black,color:qt.white,border:`2px solid ${dt[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)"},um=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function nw(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, ${vn[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||vn[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(!um)for(let $=0;$<4;$++){let T=document.createElement("div");T.style.position="fixed",T.style.background="inherit",m.push(T),f.appendChild(T)}let y=$=>{f.style.clipPath=$,f.style.webkitClipPath=$},x=()=>{if(!r.isConnected){A.destroy();return}let $=r.getBoundingClientRect(),T=$.left-n,O=$.top-n,X=$.width+n*2,F=$.height+n*2;if(Object.assign(g.style,{left:`${T}px`,top:`${O}px`,width:`${X}px`,height:`${F}px`}),um){let N=window.innerWidth,Z=window.innerHeight,K=Math.min(i,X/2,F/2),le=`M 0 0 L ${N} 0 L ${N} ${Z} L 0 ${Z} Z`,U=`M ${T+K} ${O} A ${K} ${K} 0 0 0 ${T} ${O+K} L ${T} ${O+F-K} A ${K} ${K} 0 0 0 ${T+K} ${O+F} L ${T+X-K} ${O+F} A ${K} ${K} 0 0 0 ${T+X} ${O+F-K} L ${T+X} ${O+K} A ${K} ${K} 0 0 0 ${T+X-K} ${O} L ${T+K} ${O} Z`;y(`path('${le} ${U}')`)}else{let[N,Z,K,le]=m;Object.assign(N.style,{left:"0px",top:"0px",width:"100vw",height:`${O}px`}),Object.assign(K.style,{left:"0px",top:`${O+F}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(O+F))}px`}),Object.assign(le.style,{left:"0px",top:`${O}px`,width:`${T}px`,height:`${F}px`}),Object.assign(Z.style,{left:`${T+X}px`,top:`${O}px`,width:`${Math.max(0,window.innerWidth-(T+X))}px`,height:`${F}px`})}},k=new ResizeObserver(()=>requestAnimationFrame(x));k.observe(r);let b=()=>requestAnimationFrame(x),w=()=>requestAnimationFrame(x);window.addEventListener("scroll",b,!0),window.addEventListener("resize",w);let C=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),A.destroy())};c&&window.addEventListener("keydown",C);let _=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),A.destroy())};f.addEventListener("click",_);let A={destroy(){k.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",C),f.removeEventListener("click",_),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{g.remove()}catch{}},220)}};return x(),A}var iw=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 Gt(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(!iw.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 mn={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)"},gm=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 fa=Object.defineProperty;var lx=Object.getOwnPropertyDescriptor;var cx=Object.getOwnPropertyNames;var ux=Object.prototype.hasOwnProperty;var mg=r=>{throw TypeError(r)};var dx=(r,e,t)=>e in r?fa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var vg=(r,e)=>{for(var t in e)fa(r,t,{get:e[t],enumerable:!0})},px=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cx(e))!ux.call(r,i)&&i!==t&&fa(r,i,{get:()=>e[i],enumerable:!(n=lx(e,i))||n.enumerable});return r};var hx=r=>px(fa({},"__esModule",{value:!0}),r);var Se=(r,e,t)=>dx(r,typeof e!="symbol"?e+"":e,t),vu=(r,e,t)=>e.has(r)||mg("Cannot "+t);var q=(r,e,t)=>(vu(r,e,"read from private field"),t?t.call(r):e.get(r)),ye=(r,e,t)=>e.has(r)?mg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),oe=(r,e,t,n)=>(vu(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),we=(r,e,t)=>(vu(r,e,"access private method"),t);var yu=(r,e,t,n)=>({set _(i){oe(r,e,i,t)},get _(){return q(r,e,n)}});var gR={};vg(gR,{ANIMATION_KEYFRAMES:()=>Yi,ActivationConfigZ:()=>fo,AddClassZ:()=>dp,AnchorIdZ:()=>bt,AnchorStateZ:()=>Q0,AnchorVisibleConditionZ:()=>Qa,AppRegistry:()=>pi,AugmentationZ:()=>ex,BadgePositionZ:()=>ep,BadgeZ:()=>vp,BoundingBoxZ:()=>J0,CanvasEvents:()=>Pi,CanvasRecipeZ:()=>hu,ConditionZ:()=>br,ContextManager:()=>Eo,CooldownActiveConditionZ:()=>sl,CounterDefZ:()=>Si,CtaButtonZ:()=>Ll,DEFAULT_COOLDOWN:()=>vl,DecisionController:()=>uu,DecisionStrategyZ:()=>Ti,DismissedConditionZ:()=>il,EVENT_SCHEMA_VERSION:()=>Pe,EventBus:()=>vo,EventCountConditionZ:()=>al,EventFilterZ:()=>nx,EventHistory:()=>Bi,EventOccurredConditionZ:()=>el,EventSourceZ:()=>ug,ExecutorRegistry:()=>po,ExternalStrategyZ:()=>Ri,FrequencyEntryZ:()=>ax,FrequencyLimitConditionZ:()=>ol,HighlightStepZ:()=>sx,HighlightStyleZ:()=>Qd,HighlightZ:()=>gp,InsertHtmlZ:()=>fp,InsertPositionZ:()=>ip,InterventionTracker:()=>Xi,MAX_VISIBLE_TOASTS:()=>Qs,MatchOpZ:()=>wi,ModalContentZ:()=>np,ModalZ:()=>bp,ModelStrategyZ:()=>Ai,MountWidgetZ:()=>wp,NavigateZ:()=>xp,NavigationMonitor:()=>Gi,NormalizedEventZ:()=>rx,NotificationsController:()=>Mi,PageContextZ:()=>G0,PageHistoryEntryZ:()=>K0,PageUrlConditionZ:()=>Xa,ParallelZ:()=>Ep,PlacementZ:()=>tp,PulseZ:()=>mp,RUNTIME_SDK_BUILD:()=>pg,RUNTIME_VERSION:()=>yh,RemoveClassZ:()=>pp,RouteConditionZ:()=>Ja,RouteFilterZ:()=>Xd,RuleStrategyZ:()=>Ei,RuleZ:()=>ki,RuntimeContextZ:()=>tx,RuntimeController:()=>du,RuntimeEventsController:()=>pu,SDK_SCHEMA_VERSION:()=>_r,SDK_VERSION:()=>wl,STATIC_SLOT_STYLES:()=>mh,ScoreStrategyZ:()=>Ci,ScrollBehaviorZ:()=>lp,ScrollLogicalPositionZ:()=>Ol,ScrollToZ:()=>_p,SelectorZ:()=>dg,SequenceZ:()=>kp,SessionContextZ:()=>Y0,SessionMetricConditionZ:()=>nl,SessionMetricTracker:()=>ko,SetAttrZ:()=>up,SetStyleZ:()=>hp,SetTextZ:()=>cp,SmartCanvasController:()=>kl,SmartCanvasElementLit:()=>Un,StandardEvents:()=>qe,StateEqualsConditionZ:()=>tl,StateStore:()=>Io,StoredValueZ:()=>ox,Syntro:()=>cg,ThemeController:()=>Oi,TooltipContentZ:()=>rp,TooltipStepZ:()=>ix,TooltipTriggerZ:()=>sp,TooltipZ:()=>yp,TourStepForSchemaZ:()=>ap,TourZ:()=>Cp,TriggerWhenZ:()=>Xs,ViewportConditionZ:()=>rl,ViewportContextZ:()=>X0,WaitZ:()=>Sp,WidgetConfigZ:()=>op,WidgetRegistry:()=>Mo,applyStaticSlotStyles:()=>_c,coreActionStepSchemas:()=>gy,createActionEngine:()=>Pl,createAnchorResolver:()=>Nl,createCanvasConfigFetcher:()=>Dn,createContextManager:()=>mc,createDecisionEngine:()=>vc,createEventAccumulator:()=>yc,createEventBus:()=>Hi,createGrowthBookClient:()=>dc,createNoopClient:()=>Ic,createOverlayRecipeFetcher:()=>pR,createPostHogClient:()=>cu,createPostHogNormalizer:()=>bd,createSessionMetricTracker:()=>pc,createSmartCanvas:()=>Bl,createSmartCanvasController:()=>kd,createSmartCanvasRuntime:()=>Tc,createStateStore:()=>bc,createSurfaceContainer:()=>Ec,createSurfaces:()=>Ac,decisionSchemas:()=>PE,decodeToken:()=>Di,encodeToken:()=>Vl,evaluate:()=>dh,evaluateCondition:()=>ch,evaluateRule:()=>uh,evaluateRuleStrategy:()=>Co,evaluateScoreStrategy:()=>Ao,evaluateSync:()=>ph,executorRegistry:()=>ir,getAntiFlickerSnippet:()=>yy,getExecutor:()=>hy,getSlotAnchorId:()=>$o,getSlotType:()=>Ki,getSlotZIndex:()=>Cc,hasExecutor:()=>Il,needsMigration:()=>aR,normalizePostHogEvent:()=>Ii,parseVersion:()=>ps,playEnterAnimation:()=>Sc,playExitAnimation:()=>kc,registerConfigPredicates:()=>Vn,registerSmartCanvasElement:()=>lo,resolveConfigUri:()=>Sl,runtimeContext:()=>ny,setupAdjacentPositioning:()=>xc,setupInlinePositioning:()=>wc,shouldNormalizeEvent:()=>$i,validateAction:()=>jt,validateActions:()=>ho,validateActivationConfig:()=>ME,validateCondition:()=>IE,validateConfig:()=>iR,validateEventFilter:()=>uR,validateEventName:()=>zl,validateFrequencyEntry:()=>fR,validateNormalizedEvent:()=>cR,validateProps:()=>ql,validateRecipe:()=>dR,validateRuntimeContext:()=>lR,validateStoredValue:()=>hR,validateStrategy:()=>$E,widgetRegistry:()=>Rc});function fx(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 gx=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 yg(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(!gx.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 bg=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=yg(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=fx(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=yg(p.html))}}};function _g(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 _g(t)}return r}var xg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-content] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=_g(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)}}},wg=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)}}},Sg=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))}}},kg=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-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)}}},Eg=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)}}},bu=[{kind:"content:insertHtml",executor:bg},{kind:"content:setText",executor:xg},{kind:"content:setAttr",executor:wg},{kind:"content:addClass",executor:Sg},{kind:"content:removeClass",executor:kg},{kind:"content:setStyle",executor:Eg}],_u={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:bu};var Cg=r=>{throw TypeError(r)},Ag=(r,e,t)=>e.has(r)||Cg("Cannot "+t),Ue=(r,e,t)=>(Ag(r,e,"read from private field"),t?t.call(r):e.get(r)),Lr=(r,e,t)=>e.has(r)?Cg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),cr=(r,e,t,n)=>(Ag(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var Ig=["top","right","bottom","left"];var Nr=Math.min,ur=Math.max,fs=Math.round,gs=Math.floor,Pt=r=>({x:r,y:r}),mx={left:"right",right:"left",bottom:"top",top:"bottom"},vx={start:"end",end:"start"};function ma(r,e,t){return ur(r,Nr(e,t))}function an(r,e){return typeof r=="function"?r(e):r}function Fr(r){return r.split("-")[0]}function ri(r){return r.split("-")[1]}function xu(r){return r==="x"?"y":"x"}function va(r){return r==="y"?"height":"width"}var yx=new Set(["top","bottom"]);function dr(r){return yx.has(Fr(r))?"y":"x"}function ya(r){return xu(dr(r))}function $g(r,e,t){t===void 0&&(t=!1);let n=ri(r),i=ya(r),s=va(i),o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=hs(o)),[o,hs(o)]}function Mg(r){let e=hs(r);return[ga(r),e,ga(e)]}function ga(r){return r.replace(/start|end/g,e=>vx[e])}var Rg=["left","right"],Tg=["right","left"],bx=["top","bottom"],_x=["bottom","top"];function xx(r,e,t){switch(r){case"top":case"bottom":return t?e?Tg:Rg:e?Rg:Tg;case"left":case"right":return e?bx:_x;default:return[]}}function Pg(r,e,t,n){let i=ri(r),s=xx(Fr(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(ga)))),s}function hs(r){return r.replace(/left|right|bottom|top/g,e=>mx[e])}function wx(r){return{top:0,right:0,bottom:0,left:0,...r}}function wu(r){return typeof r!="number"?wx(r):{top:r,right:r,bottom:r,left:r}}function ln(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 Og(r,e,t){let{reference:n,floating:i}=r,s=dr(e),o=ya(e),a=va(o),l=Fr(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(ri(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 Fg(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}=an(e,r),v=wu(f),m=a[h?p==="floating"?"reference":"floating":p],y=ln(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=ln(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 Dg=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}=Og(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:C}=await x({x:u,y:p,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:Fg},elements:{reference:r,floating:e}});u=S??u,p=b??p,f={...f,[y]:{...f[y],...w}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):C.rects),{x:u,y:p}=Og(c,h,l)),m=-1)}return{x:u,y:p,placement:h,strategy:i,middlewareData:f}},Hg=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}=an(r,e)||{};if(c==null)return{};let p=wu(u),h={x:t,y:n},f=ya(i),v=va(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],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),_=C?C[S]:0;(!_||!await(o.isElement==null?void 0:o.isElement(C)))&&(_=a.floating[S]||s.floating[v]);let A=b/2-w/2,$=_/2-g[v]/2-1,T=Nr(p[y],$),P=Nr(p[x],$),Y=T,F=_-g[v]-P,L=_/2-g[v]/2+A,G=ma(Y,L,F),K=!l.arrow&&ri(i)!=null&&L!==G&&s.reference[v]/2-(L<Y?T: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 Bg=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}=an(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};let y=Fr(i),x=dr(a),S=Fr(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(S||!g?[hs(a)]:Mg(a)),C=v!=="none";!h&&C&&w.push(...Pg(a,g,v,b));let _=[a,...w],A=await l.detectOverflow(e,m),$=[],T=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&$.push(A[y]),p){let L=$g(i,o,b);$.push(A[L[0]],A[L[1]])}if(T=[...T,{placement:i,overflows:$}],!$.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!==dr(G):!1)||T.every(j=>dr(j.placement)===x?j.overflows[0]>0:!0)))return{data:{index:L,overflows:T},reset:{placement:G}};let K=(Y=T.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=T.filter(j=>{if(C){let ee=dr(j.placement);return ee===x||ee==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(ee=>ee>0).reduce((ee,D)=>ee+D,0)]).sort((j,ee)=>j[1]-ee[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 Lg(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Ng(r){return Ig.some(e=>r[e]>=0)}var Vg=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t,platform:n}=e,{strategy:i="referenceHidden",...s}=an(r,e);switch(i){case"referenceHidden":{let o=await n.detectOverflow(e,{...s,elementContext:"reference"}),a=Lg(o,t.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ng(a)}}}case"escaped":{let o=await n.detectOverflow(e,{...s,altBoundary:!0}),a=Lg(o,t.floating);return{data:{escapedOffsets:a,escaped:Ng(a)}}}default:return{}}}}};var Sx=new Set(["left","top"]);async function kx(r,e){let{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Fr(t),a=ri(t),l=dr(t)==="y",c=Sx.has(o)?-1:1,u=s&&l?-1:1,p=an(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 Ug=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 kx(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}}}}},jg=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}=an(r,e),u={x:t,y:n},p=await s.detectOverflow(e,c),h=dr(Fr(i)),f=xu(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=ma(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=ma(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 ba(){return typeof window<"u"}function cn(r){return zg(r)?(r.nodeName||"").toLowerCase():"#document"}function dt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Ot(r){var e;return(e=(zg(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function zg(r){return ba()?r instanceof Node||r instanceof dt(r).Node:!1}function kt(r){return ba()?r instanceof Element||r instanceof dt(r).Element:!1}function Lt(r){return ba()?r instanceof HTMLElement||r instanceof dt(r).HTMLElement:!1}function Wg(r){return!ba()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof dt(r).ShadowRoot}var Ex=new Set(["inline","contents"]);function ii(r){let{overflow:e,overflowX:t,overflowY:n,display:i}=Et(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!Ex.has(i)}var Cx=new Set(["table","td","th"]);function qg(r){return Cx.has(cn(r))}var Ax=[":popover-open",":modal"];function ms(r){return Ax.some(e=>{try{return r.matches(e)}catch{return!1}})}var Rx=["transform","translate","scale","rotate","perspective"],Tx=["transform","translate","scale","rotate","perspective","filter"],Ix=["paint","layout","strict","content"];function _a(r){let e=xa(),t=kt(r)?Et(r):r;return Rx.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)||Tx.some(n=>(t.willChange||"").includes(n))||Ix.some(n=>(t.contain||"").includes(n))}function Zg(r){let e=pr(r);for(;Lt(e)&&!un(e);){if(_a(e))return e;if(ms(e))return null;e=pr(e)}return null}function xa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var $x=new Set(["html","body","#document"]);function un(r){return $x.has(cn(r))}function Et(r){return dt(r).getComputedStyle(r)}function vs(r){return kt(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function pr(r){if(cn(r)==="html")return r;let e=r.assignedSlot||r.parentNode||Wg(r)&&r.host||Ot(r);return Wg(e)?e.host:e}function Gg(r){let e=pr(r);return un(e)?r.ownerDocument?r.ownerDocument.body:r.body:Lt(e)&&ii(e)?e:Gg(e)}function ni(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);let i=Gg(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=dt(i);if(s){let a=wa(o);return e.concat(o,o.visualViewport||[],ii(i)?i:[],a&&t?ni(a):[])}return e.concat(i,ni(i,[],t))}function wa(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Jg(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=fs(t)!==s||fs(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function ku(r){return kt(r)?r:r.contextElement}function si(r){let e=ku(r);if(!Lt(e))return Pt(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Jg(e),o=(s?fs(t.width):t.width)/n,a=(s?fs(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Mx=Pt(0);function Qg(r){let e=dt(r);return!xa()||!e.visualViewport?Mx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Px(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==dt(r)?!1:e}function dn(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);let i=r.getBoundingClientRect(),s=ku(r),o=Pt(1);e&&(n?kt(n)&&(o=si(n)):o=si(r));let a=Px(s,t,n)?Qg(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=dt(s),f=n&&kt(n)?dt(n):n,v=h,g=wa(v);for(;g&&n&&f!==v;){let m=si(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=dt(g),g=wa(v)}}return ln({width:u,height:p,x:l,y:c})}function Sa(r,e){let t=vs(r).scrollLeft;return e?e.left+t:dn(Ot(r)).left+t}function em(r,e){let t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Sa(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function Ox(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r,s=i==="fixed",o=Ot(n),a=e?ms(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)&&((cn(n)!=="body"||ii(o))&&(l=vs(n)),Lt(n))){let f=dn(n);c=si(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}let h=o&&!p&&!s?em(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 Lx(r){return Array.from(r.getClientRects())}function Nx(r){let e=Ot(r),t=vs(r),n=r.ownerDocument.body,i=ur(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ur(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+Sa(r),a=-t.scrollTop;return Et(n).direction==="rtl"&&(o+=ur(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}var Kg=25;function Fx(r,e){let t=dt(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=xa();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Sa(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<=Kg&&(s-=v)}else c<=Kg&&(s+=c);return{width:s,height:o,x:a,y:l}}var Dx=new Set(["absolute","fixed"]);function Hx(r,e){let t=dn(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Lt(r)?si(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 Yg(r,e,t){let n;if(e==="viewport")n=Fx(r,t);else if(e==="document")n=Nx(Ot(r));else if(kt(e))n=Hx(e,t);else{let i=Qg(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ln(n)}function tm(r,e){let t=pr(r);return t===e||!kt(t)||un(t)?!1:Et(t).position==="fixed"||tm(t,e)}function Bx(r,e){let t=e.get(r);if(t)return t;let n=ni(r,[],!1).filter(a=>kt(a)&&cn(a)!=="body"),i=null,s=Et(r).position==="fixed",o=s?pr(r):r;for(;kt(o)&&!un(o);){let a=Et(o),l=_a(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Dx.has(i.position)||ii(o)&&!l&&tm(r,o))?n=n.filter(u=>u!==o):i=a,o=pr(o)}return e.set(r,n),n}function Vx(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r,o=[...t==="clippingAncestors"?ms(e)?[]:Bx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{let p=Yg(e,u,i);return c.top=ur(p.top,c.top),c.right=Nr(p.right,c.right),c.bottom=Nr(p.bottom,c.bottom),c.left=ur(p.left,c.left),c},Yg(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ux(r){let{width:e,height:t}=Jg(r);return{width:e,height:t}}function jx(r,e,t){let n=Lt(e),i=Ot(e),s=t==="fixed",o=dn(r,!0,s,e),a={scrollLeft:0,scrollTop:0},l=Pt(0);function c(){l.x=Sa(i)}if(n||!n&&!s)if((cn(e)!=="body"||ii(i))&&(a=vs(e)),n){let f=dn(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?em(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 Su(r){return Et(r).position==="static"}function Xg(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 rm(r,e){let t=dt(r);if(ms(r))return t;if(!Lt(r)){let i=pr(r);for(;i&&!un(i);){if(kt(i)&&!Su(i))return i;i=pr(i)}return t}let n=Xg(r,e);for(;n&&qg(n)&&Su(n);)n=Xg(n,e);return n&&un(n)&&Su(n)&&!_a(n)?t:n||Zg(r)||t}var Wx=async function(r){let e=this.getOffsetParent||rm,t=this.getDimensions,n=await t(r.floating);return{reference:jx(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function zx(r){return Et(r).direction==="rtl"}var qx={convertOffsetParentRelativeRectToViewportRelativeRect:Ox,getDocumentElement:Ot,getClippingRect:Vx,getOffsetParent:rm,getElementRects:Wx,getClientRects:Lx,getDimensions:Ux,getScale:si,isElement:kt,isRTL:zx};function nm(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Zx(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=gs(p),g=gs(i.clientWidth-(u+h)),m=gs(i.clientHeight-(p+f)),y=gs(u),S={rootMargin:-v+"px "+-g+"px "+-m+"px "+-y+"px",threshold:ur(0,Nr(1,l))||1},b=!0;function w(C){let _=C[0].intersectionRatio;if(_!==l){if(!b)return o();_?o(!1,_):n=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!nm(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 ka(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=ku(r),u=i||s?[...c?ni(c):[],...ni(e)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});let p=c&&a?Zx(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?dn(r):null;l&&m();function m(){let y=dn(r);g&&!nm(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 Ea=Ug;var Ca=jg,Aa=Bg;var im=Vg,sm=Hg;var Ra=(r,e,t)=>{let n=new Map,i={platform:qx,...t},s={...i.platform,_c:n};return Dg(r,e,{...i,platform:s})};var Ta=globalThis,Ia=Ta.ShadowRoot&&(Ta.ShadyCSS===void 0||Ta.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Eu=Symbol(),om=new WeakMap,ys=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Eu)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(Ia&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=om.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&om.set(t,e))}return e}toString(){return this.cssText}},am=r=>new ys(typeof r=="string"?r:r+"",void 0,Eu),pn=(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 ys(t,r,Eu)},lm=(r,e)=>{if(Ia)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Ta.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Cu=Ia?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return am(t)})(r):r;var{is:Gx,defineProperty:Kx,getOwnPropertyDescriptor:Yx,getOwnPropertyNames:Xx,getOwnPropertySymbols:Jx,getPrototypeOf:Qx}=Object,Dr=globalThis,cm=Dr.trustedTypes,ew=cm?cm.emptyScript:"",tw=Dr.reactiveElementPolyfillSupport,bs=(r,e)=>r,Au={toAttribute(r,e){switch(e){case Boolean:r=r?ew: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}},dm=(r,e)=>!Gx(r,e),um={attribute:!0,type:String,converter:Au,reflect:!1,useDefault:!1,hasChanged:dm};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Dr.litPropertyMetadata??(Dr.litPropertyMetadata=new WeakMap);var hr=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=um){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&&Kx(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=Yx(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)??um}static _$Ei(){if(this.hasOwnProperty(bs("elementProperties")))return;let e=Qx(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(bs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bs("properties"))){let t=this.properties,n=[...Xx(t),...Jx(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(Cu(i))}else e!==void 0&&t.push(Cu(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 lm(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:Au).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:Au;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??dm)(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){}};hr.elementStyles=[],hr.shadowRootOptions={mode:"open"},hr[bs("elementProperties")]=new Map,hr[bs("finalized")]=new Map,tw?.({ReactiveElement:hr}),(Dr.reactiveElementVersions??(Dr.reactiveElementVersions=[])).push("2.1.2");var xs=globalThis,pm=r=>r,$a=xs.trustedTypes,hm=$a?$a.createPolicy("lit-html",{createHTML:r=>r}):void 0,bm="$lit$",Hr=`lit$${Math.random().toFixed(9).slice(2)}$`,_m="?"+Hr,rw=`<${_m}>`,gn=document,ws=()=>gn.createComment(""),Ss=r=>r===null||typeof r!="object"&&typeof r!="function",Ou=Array.isArray,nw=r=>Ou(r)||typeof r?.[Symbol.iterator]=="function",Ru=`[
|
|
2
|
+
\f\r]`,_s=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fm=/-->/g,gm=/>/g,hn=RegExp(`>|${Ru}(?:([^\\s"'>=/]+)(${Ru}*=${Ru}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),mm=/'/g,vm=/"/g,xm=/^(?:script|style|textarea|title)$/i,Lu=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),N=Lu(1),FR=Lu(2),DR=Lu(3),Nt=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),ym=new WeakMap,fn=gn.createTreeWalker(gn,129);function wm(r,e){if(!Ou(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return hm!==void 0?hm.createHTML(e):e}var iw=(r,e)=>{let t=r.length-1,n=[],i,s=e===2?"<svg>":e===3?"<math>":"",o=_s;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===_s?u[1]==="!--"?o=fm:u[1]!==void 0?o=gm:u[2]!==void 0?(xm.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=hn):u[3]!==void 0&&(o=hn):o===hn?u[0]===">"?(o=i??_s,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,c=u[1],o=u[3]===void 0?hn:u[3]==='"'?vm:mm):o===vm||o===mm?o=hn:o===fm||o===gm?o=_s:(o=hn,i=void 0);let f=o===hn&&r[a+1].startsWith("/>")?" ":"";s+=o===_s?l+rw:p>=0?(n.push(c),l.slice(0,p)+bm+l.slice(p)+Hr+f):l+Hr+(p===-2?a:f)}return[wm(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ks=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]=iw(e,t);if(this.el=r.createElement(c,n),fn.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=fn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(bm)){let h=u[o++],f=i.getAttribute(p).split(Hr),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?Iu:v[1]==="?"?$u:v[1]==="@"?Mu:ai}),i.removeAttribute(p)}else p.startsWith(Hr)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(xm.test(i.tagName)){let p=i.textContent.split(Hr),h=p.length-1;if(h>0){i.textContent=$a?$a.emptyScript:"";for(let f=0;f<h;f++)i.append(p[f],ws()),fn.nextNode(),l.push({type:2,index:++s});i.append(p[h],ws())}}}else if(i.nodeType===8)if(i.data===_m)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(Hr,p+1))!==-1;)l.push({type:7,index:s}),p+=Hr.length-1}s++}}static createElement(e,t){let n=gn.createElement("template");return n.innerHTML=e,n}};function oi(r,e,t=r,n){if(e===Nt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,s=Ss(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=oi(r,i._$AS(r,e.values),i,n)),e}var Tu=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??gn).importNode(t,!0);fn.currentNode=i;let s=fn.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Es(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new Pu(s,this,e)),this._$AV.push(c),l=n[++a]}o!==l?.index&&(s=fn.nextNode(),o++)}return fn.currentNode=gn,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++}},Es=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Q,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=oi(this,e,t),Ss(e)?e===Q||e==null||e===""?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==Nt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):nw(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!==Q&&Ss(this._$AH)?this._$AA.nextSibling.data=e:this.T(gn.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=ks.createElement(wm(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let s=new Tu(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=ym.get(e.strings);return t===void 0&&ym.set(e.strings,t=new ks(e)),t}k(e){Ou(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(ws()),this.O(ws()),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=pm(e).nextSibling;pm(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Q,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=Q}_$AI(e,t=this,n,i){let s=this.strings,o=!1;if(s===void 0)e=oi(this,e,t,0),o=!Ss(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=oi(this,a[n+l],t,l),c===Nt&&(c=this._$AH[l]),o||(o=!Ss(c)||c!==this._$AH[l]),c===Q?e=Q:e!==Q&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Iu=class extends ai{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}},$u=class extends ai{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}},Mu=class extends ai{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=oi(this,e,t,0)??Q)===Nt)return;let n=this._$AH,i=e===Q&&n!==Q||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Q&&(n===Q||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)}},Pu=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){oi(this,e)}};var sw=xs.litHtmlPolyfillSupport;sw?.(ks,Es),(xs.litHtmlVersions??(xs.litHtmlVersions=[])).push("3.3.2");var Sm=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let s=t?.renderBefore??null;n._$litPart$=i=new Es(e.insertBefore(ws(),s),s,void 0,t??{})}return i._$AI(r),i};var Cs=globalThis,be=class extends hr{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=Sm(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,Cs.litElementHydrateSupport?.({LitElement:be});var ow=Cs.litElementPolyfillSupport;ow?.({LitElement:be});(Cs.litElementVersions??(Cs.litElementVersions=[])).push("4.2.2");var Ma={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Pa=r=>(...e)=>({_$litDirective$:r,values:e}),li=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 km="important",aw=" !"+km,R=Pa(class extends li{constructor(r){if(super(r),r.type!==Ma.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(aw);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?km:""):t[n]=i}}return Nt}});var lw={light:50,medium:100,heavy:200},cw=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"],uw={init(r,e,t){let n=lw[t.intensity],i=t.colors.length>0?t.colors:cw,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())}},dw={light:20,medium:40,heavy:80},pw="\u{1F389}",hw={init(r,e,t){let n=dw[t.intensity],i=typeof t.props?.emoji=="string"?t.props.emoji:pw,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())}},fw={light:20,medium:40,heavy:80},gw={light:3,medium:4,heavy:5},mw={init(r,e,t){let n=fw[t.intensity],i=gw[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())}},vw={light:30,medium:60,heavy:120},yw={init(r,e,t){let n=vw[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()}}},bw=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)}},_w=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff"];function xw(r,e){return[r,e,`${r}cc`,`${e}cc`,"#ffffff",`${r}80`]}function ww(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 xw(t,n||t)}catch{}return null}var Em=new Map([["confetti",uw],["fireworks",mw],["sparkles",yw],["emoji-rain",hw]]),Sw=async(r,e)=>{let t=Em.get(r.effect);if(!t)return console.warn(`[adaptive-overlays] Unknown celebration effect: "${r.effect}". Available: ${[...Em.keys()].join(", ")}`),{cleanup:()=>{}};let n=r.colors??ww(e.overlayRoot)??_w,i={duration:r.duration??3e3,intensity:r.intensity??"medium",colors:n,props:r.props},s=new bw;return s.start(e.overlayRoot,t,i),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:celebrate",effect:r.effect}),{cleanup:()=>{s.stop()}}},Du="syntro_active_tour",Oa=new Map;function kw(r){try{let e=localStorage.getItem(Du);if(!e)return null;let t=JSON.parse(e);return t.tourId!==r?null:t}catch{return null}}function Nu(r){try{localStorage.setItem(Du,JSON.stringify(r))}catch{}}function Ew(){try{localStorage.removeItem(Du)}catch{}}function Is(){return window.location.pathname}function Cw(r){if(!r.route)return!0;let e=Is();return r.route.includes("*")?new RegExp(`^${r.route.replace(/\*/g,".*")}$`).test(e):e===r.route}var Im=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(Oa.has(t))return{cleanup:async()=>{let S=Oa.get(t);S&&await S.cleanup()}};if(!e.applyAction)throw new Error("Tour executor requires applyAction in context");let o=kw(t),a=!!o;if(!a&&!s)return{cleanup:()=>{}};o||(o={tourId:t,currentStepId:i||n[0].id,startedAt:Date.now()},Nu(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,Nu(o)}let c=n[l];if(!Cw(c))return e.publishEvent("tour.waiting_for_route",{tourId:t,stepId:c.id,expectedRoute:c.route,currentRoute:Is()}),{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"){Ew(),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,Nu(o),e.publishEvent("tour.step_changed",{tourId:t,previousStepId:c.id,nextStepId:S}),b.route&&b.route!==Is()){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",C=>{let _=C?.actionId;if(_&&S.onAction){let A=S.onAction[_];A&&g(A)}});let b=e.subscribeEvent("action.tooltip_cta_clicked",C=>{let _=C?.actionId;if(_&&S.onAction){let A=S.onAction[_];A&&g(A)}}),w=h;h=()=>{w(),b()}}}};f=(()=>{let S=Is(),b=()=>{let _=Is();_!==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),C=history.replaceState.bind(history);return history.pushState=(..._)=>{w(..._),queueMicrotask(b)},history.replaceState=(..._)=>{C(..._),queueMicrotask(b)},()=>{window.removeEventListener("popstate",b),history.pushState=w,history.replaceState=C}})(),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,Oa.delete(t),await v(),f&&f(),e.publishEvent("tour.paused",{tourId:t,stepId:o.currentStepId})};return Oa.set(t,{cleanup:x}),{cleanup:x}},qt={white:"#ffffff",black:"#000000"},pt={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"},De={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Zt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},it={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},vn={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},As={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Rs={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Ts={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},sT={primary:O[10],secondary:O[9],tertiary:O[8]},oT={primary:O[2],secondary:O[0]},aT={primary:O[4],secondary:O[3]},lT={primary:{text:qt.white,icon:qt.white,border:pt[3],backgroundDefault:pt[3],backgroundHover:pt[2]},neutral:{text:O[10],textHover:qt.white,icon:O[10],iconHover:qt.white,border:O[4],background:O[2]},link:{text:qt.white,icon:qt.white,hover:pt[5]},error:{text:it[5],hover:it[6]},success:{text:De[5],hover:De[6]}},cT={slateGrey:{content:O[10],pillOutline:O[10],borderPrimary:O[5],borderSecondary:O[5],background:O[3]},brand:{content:pt[9],pillOutline:pt[9],borderPrimary:pt[6],borderSecondary:pt[6],background:pt[0]},red:{content:it[8],pillOutline:it[4],borderPrimary:it[2],borderSecondary:it[2],background:it[0]},yellow:{content:Zt[8],pillOutline:Zt[4],borderPrimary:Zt[2],borderSecondary:Zt[2],background:Zt[0]},green:{content:De[8],pillOutline:De[4],borderPrimary:De[2],borderSecondary:De[2],background:De[0]},purple:{content:Rs[8],pillOutline:Rs[4],borderPrimary:Rs[2],borderSecondary:Rs[2],background:Rs[0]},blue:{content:vn[8],pillOutline:vn[4],borderPrimary:vn[2],borderSecondary:vn[2],background:vn[0]},orange:{content:As[8],pillOutline:As[4],borderPrimary:As[2],borderSecondary:As[2],background:As[0]},pink:{content:Ts[8],pillOutline:Ts[4],borderPrimary:Ts[2],borderSecondary:Ts[2],background:Ts[0]}},uT={green:{content:De[8],border:De[2],background:De[0]},yellow:{content:Zt[8],border:Zt[2],background:Zt[0]},red:{content:it[8],border:it[2],background:it[0]}},dT={green:{content:De[1],background:De[9]},yellow:{content:Zt[1],background:Zt[9]},red:{content:it[1],background:it[9]}},pT={content:O[10],border:O[4],background:O[3]},hT={backgroundDefault:O[2],backgroundHover:O[1],selected:O[3]},fT={background:O[2],icon:O[10],borderDefault:O[4],borderSelected:pt[3],textLabel:O[9],textPlaceholder:O[8],textHint:O[8]},gT={backgroundDefault:O[2],backgroundDisabled:O[0],textLabel:O[9],textPlaceholder:O[8],textHint:O[8],textError:it[5],iconDefault:O[9],iconPlaceholder:O[10],iconError:it[5],borderDefault:O[4],borderSelected:pt[3],borderError:it[5]},mT={handleDefault:qt.white,handleDisabled:O[10],off:{backgroundDefault:O[4],backgroundHover:O[5],backgroundDisabled:O[4]},on:{backgroundDefault:De[3],backgroundHover:De[2],backgroundDisabled:O[4]}},vT={off:{backgroundDefault:"#00000000",backgroundHover:O[5],backgroundDisabled:O[2],border:O[6]},on:{backgroundDefault:De[0],backgroundHover:De[1],backgroundDisabled:O[2],border:De[3]}},yT={content:O[10],background:O[4]},bT={background:O[4],active:De[3]},_T={background:O[1],content:O[9],border:O[4]},xT={backgroundDefault:O[1],backgroundHover:O[3],backgroundActive:O[4],border:O[4],contentPrimary:O[10],contentSecondary:O[9],contentTertiary:O[8]},wT={background:O[1],content:O[9],border:O[4]},ST={activeBackground:O[3],activeContent:pt[5],inactiveContent:O[9],border:O[4]},kT={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]}},ET={textPrimaryDefault:O[10],textPrimaryHover:O[10],textSecondaryDefault:O[8],textSecondaryHover:O[9],iconPrimary:O[10],iconSecondary:O[8]},CT={background:De[1],active:De[5]},AT={textDefault:O[10],textSelected:qt.white,textDisabled:O[7],backgroundDefault:O[2],backgroundMiddle:O[3],backgroundSelected:pt[3],border:O[4]},RT=O[9],TT={size:56,inset:12,background:qt.black,color:qt.white,border:`2px solid ${pt[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)"},Cm=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function Aw(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, ${vn[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||vn[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(!Cm)for(let $=0;$<4;$++){let T=document.createElement("div");T.style.position="fixed",T.style.background="inherit",m.push(T),f.appendChild(T)}let y=$=>{f.style.clipPath=$,f.style.webkitClipPath=$},x=()=>{if(!r.isConnected){A.destroy();return}let $=r.getBoundingClientRect(),T=$.left-n,P=$.top-n,Y=$.width+n*2,F=$.height+n*2;if(Object.assign(g.style,{left:`${T}px`,top:`${P}px`,width:`${Y}px`,height:`${F}px`}),Cm){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 ${T+K} ${P} A ${K} ${K} 0 0 0 ${T} ${P+K} L ${T} ${P+F-K} A ${K} ${K} 0 0 0 ${T+K} ${P+F} L ${T+Y-K} ${P+F} A ${K} ${K} 0 0 0 ${T+Y} ${P+F-K} L ${T+Y} ${P+K} A ${K} ${K} 0 0 0 ${T+Y-K} ${P} L ${T+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:`${T}px`,height:`${F}px`}),Object.assign(G.style,{left:`${T+Y}px`,top:`${P}px`,width:`${Math.max(0,window.innerWidth-(T+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 C=$=>{$.key==="Escape"&&c&&(t?.onDismiss?.(),A.destroy())};c&&window.addEventListener("keydown",C);let _=$=>{a?($.preventDefault(),$.stopPropagation()):l&&(t?.onDismiss?.(),A.destroy())};f.addEventListener("click",_);let A={destroy(){S.disconnect(),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",C),f.removeEventListener("click",_),f.style.pointerEvents="none",f.style.opacity="0",setTimeout(()=>{try{f.remove()}catch{}try{g.remove()}catch{}},220)}};return x(),A}var Rw=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 Gt(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(!Rw.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 mn={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)"},$m=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});
|
|
@@ -53,7 +53,7 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
53
53
|
>
|
|
54
54
|
${Gt(w.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");_&&(h=_,e.publishEvent("action.modal_cta_clicked",{actionId:_}),b.destroy())};f.forEach(w=>w.addEventListener("click",v));let g=w=>{w.key==="Escape"&&o?.onEsc!==!1&&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 k=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');k.length>0&&requestAnimationFrame(()=>k[0].focus()),requestAnimationFrame(()=>{l.style.opacity="1",c.style.opacity="1",c.style.transform="translate(-50%, -50%) scale(1)"}),e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:modal",size:n,blocking:i});let 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 sw(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 ow(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=Gt(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=[_a(t.offsetPx??8),wa(),xa({padding:8}),jg(),Ug({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=ba(r,n,async()=>{if(!r.isConnected){v.destroy();return}let g=sw(r),m=await ka(g,n,{placement:l,strategy:"fixed",middleware:a}),{x:y,y:x,strategy:k,middlewareData:b,placement:w}=m;if(Object.assign(n.style,{left:`${y}px`,top:`${x}px`,position:k}),b.arrow){let{x:C,y:_}=b.arrow,A=w.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:C!=null?`${C}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",[$[A]]:"-4px"});let T={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${T[A]||"0deg"})`}}),u=g=>{g.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let p=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),p.push(m.id||m.tagName))});let g=Array.from(n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(g.length>0){let m=g[0],y=g[g.length-1],x=k=>{k.key==="Tab"&&(k.shiftKey?document.activeElement===m&&(y.focus(),k.preventDefault()):document.activeElement===y&&(m.focus(),k.preventDefault()))};n.addEventListener("keydown",x),requestAnimationFrame(()=>m.focus())}}let f=(()=>{if(t.trigger==="hover"){let g=null,m=()=>{g&&(clearTimeout(g),g=null),n.style.visibility="visible",n.style.opacity="1"},y=()=>{g=setTimeout(()=>{n.style.visibility="hidden",n.style.opacity="0",g=null},100)};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",y),n.addEventListener("mouseenter",m),n.addEventListener("mouseleave",y),r.addEventListener("focus",m),r.addEventListener("blur",y),()=>{g&&clearTimeout(g),r.removeEventListener("mouseenter",m),r.removeEventListener("mouseleave",y),n.removeEventListener("mouseenter",m),n.removeEventListener("mouseleave",y),r.removeEventListener("focus",m),r.removeEventListener("blur",y)}}if(t.trigger==="click"){let g=()=>{n.style.visibility==="visible"?v.destroy():(n.style.visibility="visible",n.style.opacity="1")};return n.style.visibility="hidden",n.style.opacity="0",n.style.transition="opacity 200ms ease, visibility 200ms",r.addEventListener("click",g),()=>r.removeEventListener("click",g)}return n.style.opacity="0",n.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{n.style.opacity="1"}),()=>{}})(),v={el:n,destroy(){c(),f(),window.removeEventListener("keydown",u),i.forEach(g=>g.removeEventListener("click",s)),t.blocking&&Array.from(document.body.children).forEach(g=>{g!==e&&g.removeAttribute("inert")}),n.style.pointerEvents="none",n.style.opacity="0",setTimeout(()=>{try{n.remove()}catch{}},200)}};return v}var dm="#1969fe",aw="#24ad32",lw="#0e1114",Tu="#677384",cw="#a8afba",pm="#f6f7f9",uw="#ffffff";function hm(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, ${uw})`,color:`var(--se-color-text-primary, ${lw})`,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 dw(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 di="syntro-workflow-tracker",$s,Ms,ci,fr,Os,Ia,ui,$u=class extends ye{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Nr(this,$s,null),Nr(this,Ms,null),Nr(this,ci,[]),Nr(this,fr,new Set),Nr(this,Os,{}),Nr(this,Ia,!1),Nr(this,ui,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let r=this.runtimeRef?.actions?.getActive?.()??[],e=dw(r);if(cr(this,ui,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(!Ve(this,fr).has(s)&&o.notification&&!a.includes(s)&&!l[s]){Ve(this,fr).add(s),t?.set("notified",[...Ve(this,fr)]);let c=hm(o.notification);Ve(this,ci).push(c)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let r of Ve(this,ci))r();cr(this,ci,[])}updated(r){r.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),r.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Ve(this,Ia)&&this._stateNs){let r=this._stateNs.get("notified")??[];for(let t of r)Ve(this,fr).add(t);let e=this._stateNs.get("completed")??{};cr(this,Os,{...e}),cr(this,Ia,!0)}cr(this,$s,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),cr(this,Ms,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},r=>{this._handleTourEvent(r)})),this._rescanWorkflows()}}_teardownSubscriptions(){var r,e;(r=Ve(this,$s))==null||r.call(this),cr(this,$s,null),(e=Ve(this,Ms))==null||e.call(this),cr(this,Ms,null)}_handleTourEvent(r){let e=r.props?.tourId;if(!e)return;if(!Ve(this,ui).has(e)&&r.name==="tour.started"){this._actionVersion+=1;return}if(!Ve(this,ui).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(!Ve(this,fr).has(e)){Ve(this,fr).add(e),t?.set("notified",[...Ve(this,fr)]);let o=Ve(this,ui).get(e);if(o?.meta.notification){let a=hm(o.meta.notification);Ve(this,ci).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 Ve(this,Os)[e]=i,t?.set("completed",{...Ve(this,Os)}),{...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, ${dm})`,transition:"width 0.3s ease",width:`${t}%`};return L`
|
|
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");_&&(h=_,e.publishEvent("action.modal_cta_clicked",{actionId:_}),b.destroy())};f.forEach(w=>w.addEventListener("click",v));let g=w=>{w.key==="Escape"&&o?.onEsc!==!1&&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 Tw(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 Iw(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=Gt(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=[Ea(t.offsetPx??8),Aa(),Ca({padding:8}),im(),sm({element:o})],l=t.placement&&t.placement!=="auto"?t.placement:"top",c=ka(r,n,async()=>{if(!r.isConnected){v.destroy();return}let g=Tw(r),m=await Ra(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:C,y:_}=b.arrow,A=w.split("-")[0],$={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(o.style,{left:C!=null?`${C}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",[$[A]]:"-4px"});let T={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};o.style.transform=`rotate(${T[A]||"0deg"})`}}),u=g=>{g.key==="Escape"&&v.destroy()};window.addEventListener("keydown",u);let p=[];if(t.blocking){Array.from(document.body.children).forEach(m=>{m!==e&&m.getAttribute("inert")===null&&(m.setAttribute("inert",""),p.push(m.id||m.tagName))});let g=Array.from(n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(g.length>0){let m=g[0],y=g[g.length-1],x=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 Am="#1969fe",$w="#24ad32",Mw="#0e1114",Fu="#677384",Pw="#a8afba",Rm="#f6f7f9",Ow="#ffffff";function Tm(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, ${Ow})`,color:`var(--se-color-text-primary, ${Mw})`,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 Lw(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 di="syntro-workflow-tracker",$s,Ms,ci,fr,Ps,La,ui,Hu=class extends be{constructor(){super(...arguments),this.runtimeRef=null,this._workflowEntries=[],this._actionVersion=0,Lr(this,$s,null),Lr(this,Ms,null),Lr(this,ci,[]),Lr(this,fr,new Set),Lr(this,Ps,{}),Lr(this,La,!1),Lr(this,ui,new Map)}createRenderRoot(){return this}get _stateNs(){return this.runtimeRef?.state?.user?.ns?.("workflows")??null}_rescanWorkflows(){let r=this.runtimeRef?.actions?.getActive?.()??[],e=Lw(r);if(cr(this,ui,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(!Ue(this,fr).has(s)&&o.notification&&!a.includes(s)&&!l[s]){Ue(this,fr).add(s),t?.set("notified",[...Ue(this,fr)]);let c=Tm(o.notification);Ue(this,ci).push(c)}}}connectedCallback(){super.connectedCallback(),this._initSubscriptions()}disconnectedCallback(){super.disconnectedCallback(),this._teardownSubscriptions();for(let r of Ue(this,ci))r();cr(this,ci,[])}updated(r){r.has("runtimeRef")&&(this._teardownSubscriptions(),this._initSubscriptions()),r.has("_actionVersion")&&this._rescanWorkflows()}_initSubscriptions(){if(this.runtimeRef?.events?.subscribe){if(!Ue(this,La)&&this._stateNs){let r=this._stateNs.get("notified")??[];for(let t of r)Ue(this,fr).add(t);let e=this._stateNs.get("completed")??{};cr(this,Ps,{...e}),cr(this,La,!0)}cr(this,$s,this.runtimeRef.events.subscribe({names:["tour.started","tour.resumed"]},()=>{this._actionVersion+=1})),cr(this,Ms,this.runtimeRef.events.subscribe({patterns:["^tour\\."]},r=>{this._handleTourEvent(r)})),this._rescanWorkflows()}}_teardownSubscriptions(){var r,e;(r=Ue(this,$s))==null||r.call(this),cr(this,$s,null),(e=Ue(this,Ms))==null||e.call(this),cr(this,Ms,null)}_handleTourEvent(r){let e=r.props?.tourId;if(!e)return;if(!Ue(this,ui).has(e)&&r.name==="tour.started"){this._actionVersion+=1;return}if(!Ue(this,ui).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(!Ue(this,fr).has(e)){Ue(this,fr).add(e),t?.set("notified",[...Ue(this,fr)]);let o=Ue(this,ui).get(e);if(o?.meta.notification){let a=Tm(o.meta.notification);Ue(this,ci).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 Ue(this,Ps)[e]=i,t?.set("completed",{...Ue(this,Ps)}),{...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, ${Am})`,transition:"width 0.3s ease",width:`${t}%`};return N`
|
|
57
57
|
<div style=${R(n)}>
|
|
58
58
|
<div
|
|
59
59
|
role="progressbar"
|
|
@@ -63,7 +63,7 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
63
63
|
style=${R(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, ${Rm})`:`var(--se-color-text-secondary, ${Pw})`,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, ${Am})`:"rgba(255,255,255,0.12)"},a={color:`var(--se-color-success, ${$w})`},l={flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},c=e?N`<span role="img" aria-label="completed" style=${R(a)}>✓</span>`:t?N`<span style=${R(o)}></span>`:N`<span style=${R(o)}></span>`;return N`
|
|
67
67
|
<button
|
|
68
68
|
type="button"
|
|
69
69
|
data-testid=${`step-${r.id}`}
|
|
@@ -76,11 +76,11 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
76
76
|
<span style=${R(s)}>${c}</span>
|
|
77
77
|
<span style=${R(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, ${
|
|
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, ${Rm})`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o={flexShrink:"0",padding:"2px 6px",border:"none",borderRadius:"4px",background:"transparent",color:`var(--se-color-text-tertiary, ${Fu})`,fontSize:"12px",cursor:"pointer",lineHeight:"1"},a={marginBottom:"8px"},l={fontSize:"10px",color:`var(--se-color-text-tertiary, ${Fu})`,marginTop:"4px"},c={display:"flex",flexDirection:"column"};return N`
|
|
80
80
|
<div style=${R(n)}>
|
|
81
81
|
<!-- Header: icon + title + dismiss -->
|
|
82
82
|
<div style=${R(i)}>
|
|
83
|
-
${r.meta.icon?
|
|
83
|
+
${r.meta.icon?N`<span data-testid="workflow-icon" style="flex-shrink:0;font-size:14px">${r.meta.icon}</span>`:Q}
|
|
84
84
|
<span style=${R(s)}>${r.meta.title}</span>
|
|
85
85
|
<button
|
|
86
86
|
type="button"
|
|
@@ -104,11 +104,11 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
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, ${
|
|
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, ${Fu})`};return N`<div style=${R(t)}>No active workflows</div>`}return N`
|
|
108
108
|
<div style=${R({display:"flex",flexDirection:"column",gap:"8px"})}>
|
|
109
109
|
${r.map(t=>this._renderWorkflowCard(t))}
|
|
110
110
|
</div>
|
|
111
|
-
`}};$s=new WeakMap;Ms=new WeakMap;ci=new WeakMap;fr=new WeakMap;
|
|
111
|
+
`}};$s=new WeakMap;Ms=new WeakMap;ci=new WeakMap;fr=new WeakMap;Ps=new WeakMap;La=new WeakMap;ui=new WeakMap;Hu.properties={runtimeRef:{attribute:!1},_workflowEntries:{state:!0},_actionVersion:{state:!0}};typeof window<"u"&&!customElements.get(di)&&customElements.define(di,Hu);var Nw={mount(r,e){let t=e?.runtime??null;typeof window<"u"&&!customElements.get(di)&&customElements.define(di,Hu);let n=document.createElement(di);return n.runtimeRef=t,r.appendChild(n),()=>{n.remove()}},update(r,e){let t=r.querySelector(di);if(!t)return;let n=e?.runtime??null;t.runtimeRef=n}},Mm=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=Aw(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")}}},Pm=async(r,e)=>{let t=e.resolveAnchor(r.anchorId);if(!t&&e.waitForAnchor&&(t=await e.waitForAnchor(r.anchorId,3e3)),!t)return console.warn(`[adaptive-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let n=r.duration??4e3;await new Promise(g=>requestAnimationFrame(g));let i=g=>({r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16)}),o={r:79,g:70,b:229},a=null;try{let g=getComputedStyle(e.overlayRoot),m=g.getPropertyValue("--sc-color-primary")?.trim(),y=g.getPropertyValue("--sc-color-primary-hover")?.trim();m?.startsWith("#")&&m.length>=7&&(o=i(m)),y?.startsWith("#")&&y.length>=7&&(a=i(y))}catch{}let l=document.querySelector("[data-syntro-pulse-styles]");l&&l.remove();let c=document.createElement("style");c.setAttribute("data-syntro-pulse-styles","");let{r:u,g:p,b:h}=o;if(a){let{r:g,g:m,b:y}=a;c.textContent=`
|
|
112
112
|
@keyframes syntro-pulse-anim {
|
|
113
113
|
0%, 100% {
|
|
114
114
|
box-shadow: 0 0 0 0 rgba(${u}, ${p}, ${h}, 0.35);
|
|
@@ -132,7 +132,7 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
132
132
|
box-shadow: 0 0 0 12px rgba(${u}, ${p}, ${h}, 0);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
`;document.head.appendChild(c);let f=t.style.animation;t.style.animation="syntro-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite",t.setAttribute("data-syntro-pulse","true");let v=setTimeout(()=>{t.style.animation=f,t.removeAttribute("data-syntro-pulse")},n);return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:pulse",anchorId:r.anchorId,duration:n}),{cleanup:()=>{clearTimeout(v),t.isConnected&&(t.style.animation=f,t.removeAttribute("data-syntro-pulse"))}}},
|
|
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"))}}},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-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)}}},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-overlays] Anchor not found after waiting: ${r.anchorId.selector}`),{cleanup:()=>{}};let{content:n}=r,i="";if(n.title&&(i+=`<div class="syntro-tt-title">${Gt(n.title)}</div>`),i+=`<div class="syntro-tt-body">${Gt(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
138
|
data-syntro-action="${Gt(o.actionId)}"
|
|
@@ -143,11 +143,11 @@ var SyntrologieSDK=(()=>{var ca=Object.defineProperty;var D0=Object.getOwnProper
|
|
|
143
143
|
<button class="syntro-tt-btn syntro-tt-btn-primary" data-syntro-action="cta">
|
|
144
144
|
${Gt(n.cta.label)}
|
|
145
145
|
</button>
|
|
146
|
-
</div>`);let s=ow(t,e.overlayRoot,{html:i,placement:r.placement??"top",trigger:r.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&n.cta)e.publishEvent("action.cta_clicked",{anchorId:r.anchorId,ctaLabel:n.cta.label});else if(n.ctaButtons){let a=n.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},Mu=[{kind:"overlays:highlight",executor:mm},{kind:"overlays:pulse",executor:vm},{kind:"overlays:badge",executor:ym},{kind:"overlays:tooltip",executor:bm},{kind:"overlays:modal",executor:gm},{kind:"overlays:tour",executor:fm},{kind:"overlays:celebrate",executor:Qx}],Ou={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:Mu,widgets:[{id:"adaptive-overlays:workflow-tracker",component:pw,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function Pu(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 Nu(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var hw=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"]),fw=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),gw={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function _m(r){return gw[r]??r}function xm(r){return hw.has(r)}function wm(r){if(xm(r))return null;let e=r.indexOf(":");return e===-1?null:_m(r.slice(0,e))}function Lu(r){let e=r.indexOf(":");return e===-1?null:_m(r.slice(0,e))}function Fu(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,C)=>{setTimeout(()=>C(new Error(`Timeout loading app: ${g}`)),n)}),k=p(y,g);await Promise.race([k,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 k={appId:g,success:!1,error:x};return l.set(g,k),k}finally{o.delete(g)}})();return o.set(g,m),m}async function p(g,m){if(typeof window<"u"){try{let y=await import(g);y.manifest?t.register(y.manifest):y.default?.manifest?t.register(y.default.manifest):y.default&&t.register(y.default);return}catch{}return new Promise((y,x)=>{let k=document.createElement("script");k.src=g,k.async=!0,k.onload=()=>{t.get(m)?y():x(new Error(`App ${m} did not self-register`))},k.onerror=()=>{x(new Error(`Failed to load app script: ${g}`))},document.head.appendChild(k)})}throw new Error("Dynamic app loading not supported in SSR")}function h(g){let m=new Set;if(g.apps)for(let y of g.apps)m.add(y);if(g.actions)for(let y of g.actions){let x=wm(y.kind);if(x&&m.add(x),y.kind==="core:mountWidget"){let k=y.widget?.widgetId;if(k){let b=Lu(k);b&&m.add(b)}}}if(g.tiles){for(let y of g.tiles)if(y.widget){let x=Lu(y.widget);x&&m.add(x)}}for(let y of fw)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 pi=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=Pu({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)}Nu(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()}},Ps=new pi;var Ns=class extends li{constructor(e){if(super(e),this.it=Q,e.type!==Aa.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Q||e==null)return this._t=void 0,this.it=e;if(e===Lt)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:[]}}};Ns.directiveName="unsafeHTML",Ns.resultType=1;var $a=Ra(Ns);function Vu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _n=Vu();function Tm(r){_n=r}var yn={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(nt.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var mw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),nt={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)}}>`)},vw=/^(?:[ \t]*(?:\n|$))+/,yw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,bw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_w=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ju=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Im=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$m=me(Im).replace(/bull/g,ju).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(),xw=me(Im).replace(/bull/g,ju).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(),Uu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ww=/^[^\n]+/,Wu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kw=me(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Sw=me(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ju).getRegex(),Fa="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ew=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",zu).replace("tag",Fa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mm=me(Uu).replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fa).getRegex(),Cw=me(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Mm).getRegex(),qu={blockquote:Cw,code:yw,def:kw,fences:bw,heading:_w,hr:Hs,html:Ew,lheading:$m,list:Sw,newline:vw,paragraph:Mm,table:yn,text:ww},km=me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fa).getRegex(),Aw={...qu,lheading:xw,table:km,paragraph:me(Uu).replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",km).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fa).getRegex()},Rw={...qu,html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",zu).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:yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:me(Uu).replace("hr",Hs).replace("heading",` *#{1,6} *[^
|
|
147
|
-
]`).replace("lheading"
|
|
146
|
+
</div>`);let s=Iw(t,e.overlayRoot,{html:i,placement:r.placement??"top",trigger:r.trigger??"immediate",onAction:o=>{if(o==="dismiss"){s.destroy();return}if(o==="cta"&&n.cta)e.publishEvent("action.cta_clicked",{anchorId:r.anchorId,ctaLabel:n.cta.label});else if(n.ctaButtons){let a=n.ctaButtons.find(l=>l.actionId===o);a&&e.publishEvent("action.tooltip_cta_clicked",{anchorId:r.anchorId,actionId:o,label:a.label})}s.destroy()}});return e.publishEvent("action.applied",{id:e.generateId(),kind:"overlays:tooltip",anchorId:r.anchorId,trigger:r.trigger??"immediate"}),{cleanup:()=>{s.destroy()}}},Bu=[{kind:"overlays:highlight",executor:Mm},{kind:"overlays:pulse",executor:Pm},{kind:"overlays:badge",executor:Om},{kind:"overlays:tooltip",executor:Lm},{kind:"overlays:modal",executor:$m},{kind:"overlays:tour",executor:Im},{kind:"overlays:celebrate",executor:Sw}],Vu={id:"adaptive-overlays",version:"1.0.0",name:"Overlays",description:"Tooltips, highlights, badges, modals, celebrations, visual overlays, and workflow tracking",executors:Bu,widgets:[{id:"adaptive-overlays:workflow-tracker",component:Nw,metadata:{name:"Workflow Tracker",icon:"\u{1F4CB}",description:"Tracks multi-step workflow progress across tours"}}]};function Uu(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 ju(r,e){e.executors.unregisterBySource(r),e.widgets.unregisterBySource(r)}var Fw=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"]),Dw=new Set(["adaptive-content","adaptive-faq","adaptive-nav","adaptive-overlays"]),Hw={faq:"adaptive-faq",nav:"adaptive-nav",gamification:"adaptive-gamification",overlays:"adaptive-overlays",content:"adaptive-content","adaptive-viz":"adaptive-viz"};function Nm(r){return Hw[r]??r}function Fm(r){return Fw.has(r)}function Dm(r){if(Fm(r))return null;let e=r.indexOf(":");return e===-1?null:Nm(r.slice(0,e))}function Wu(r){let e=r.indexOf(":");return e===-1?null:Nm(r.slice(0,e))}function zu(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,C)=>{setTimeout(()=>C(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=Dm(y.kind);if(x&&m.add(x),y.kind==="core:mountWidget"){let S=y.widget?.widgetId;if(S){let b=Wu(S);b&&m.add(b)}}}if(g.tiles){for(let y of g.tiles)if(y.widget){let x=Wu(y.widget);x&&m.add(x)}}for(let y of Dw)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 pi=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=Uu({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)}ju(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()}},Os=new pi;var Ls=class extends li{constructor(e){if(super(e),this.it=Q,e.type!==Ma.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Q||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:[]}}};Ls.directiveName="unsafeHTML",Ls.resultType=1;var Na=Pa(Ls);function Ku(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _n=Ku();function zm(r){_n=r}var yn={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(st.caret,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}var Bw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),st={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)}}>`)},Vw=/^(?:[ \t]*(?:\n|$))+/,Uw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ww=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Yu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,qm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zm=me(qm).replace(/bull/g,Yu).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(),zw=me(qm).replace(/bull/g,Yu).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(),Xu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qw=/^[^\n]+/,Ju=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zw=me(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ju).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gw=me(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Yu).getRegex(),Ua="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",Qu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kw=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",Qu).replace("tag",Ua).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gm=me(Xu).replace("hr",Hs).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",Ua).getRegex(),Yw=me(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Gm).getRegex(),ed={blockquote:Yw,code:Uw,def:Zw,fences:jw,heading:Ww,hr:Hs,html:Kw,lheading:Zm,list:Gw,newline:Vw,paragraph:Gm,table:yn,text:qw},Hm=me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hs).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",Ua).getRegex(),Xw={...ed,lheading:zw,table:Hm,paragraph:me(Xu).replace("hr",Hs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Hm).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",Ua).getRegex()},Jw={...ed,html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Qu).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:yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:me(Xu).replace("hr",Hs).replace("heading",` *#{1,6} *[^
|
|
147
|
+
]`).replace("lheading",Zm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Qw=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,e1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Km=/^( {2,}|\\)\n(?!\s*$)/,t1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ja=/[\p{P}\p{S}]/u,td=/[\s\p{P}\p{S}]/u,Ym=/[^\s\p{P}\p{S}]/u,r1=me(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,td).getRegex(),Xm=/(?!~)[\p{P}\p{S}]/u,n1=/(?!~)[\s\p{P}\p{S}]/u,i1=/(?:[^\s\p{P}\p{S}]|~)/u,Jm=/(?![*_])[\p{P}\p{S}]/u,s1=/(?![*_])[\s\p{P}\p{S}]/u,o1=/(?:[^\s\p{P}\p{S}]|[*_])/u,a1=me(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Qm=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,l1=me(Qm,"u").replace(/punct/g,ja).getRegex(),c1=me(Qm,"u").replace(/punct/g,Xm).getRegex(),ev="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",u1=me(ev,"gu").replace(/notPunctSpace/g,Ym).replace(/punctSpace/g,td).replace(/punct/g,ja).getRegex(),d1=me(ev,"gu").replace(/notPunctSpace/g,i1).replace(/punctSpace/g,n1).replace(/punct/g,Xm).getRegex(),p1=me("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ym).replace(/punctSpace/g,td).replace(/punct/g,ja).getRegex(),h1=me(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Jm).getRegex(),f1="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",g1=me(f1,"gu").replace(/notPunctSpace/g,o1).replace(/punctSpace/g,s1).replace(/punct/g,Jm).getRegex(),m1=me(/\\(punct)/,"gu").replace(/punct/g,ja).getRegex(),v1=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(),y1=me(Qu).replace("(?:-->|$)","-->").getRegex(),b1=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",y1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ha=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,_1=me(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ha).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tv=me(/^!?\[(label)\]\[(ref)\]/).replace("label",Ha).replace("ref",Ju).getRegex(),rv=me(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ju).getRegex(),x1=me("reflink|nolink(?!\\()","g").replace("reflink",tv).replace("nolink",rv).getRegex(),Bm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,rd={_backpedal:yn,anyPunctuation:m1,autolink:v1,blockSkip:a1,br:Km,code:e1,del:yn,delLDelim:yn,delRDelim:yn,emStrongLDelim:l1,emStrongRDelimAst:u1,emStrongRDelimUnd:p1,escape:Qw,link:_1,nolink:rv,punctuation:r1,reflink:tv,reflinkSearch:x1,tag:b1,text:t1,url:yn},w1={...rd,link:me(/^!?\[(label)\]\((.*?)\)/).replace("label",Ha).getRegex(),reflink:me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ha).getRegex()},qu={...rd,emStrongRDelimAst:d1,emStrongLDelim:c1,delLDelim:h1,delRDelim:g1,url:me(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Bm).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",Bm).getRegex()},S1={...qu,br:me(Km).replace("{2,}","*").getRegex(),text:me(qu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fa={normal:ed,gfm:Xw,pedantic:Jw},Ns={normal:rd,gfm:qu,breaks:S1,pedantic:w1},k1={"&":"&","<":"<",">":">",'"':""","'":"'"},Vm=r=>k1[r];function Kt(r,e){if(e){if(st.escapeTest.test(r))return r.replace(st.escapeReplace,Vm)}else if(st.escapeTestNoEncode.test(r))return r.replace(st.escapeReplaceNoEncode,Vm);return r}function Um(r){try{r=encodeURI(r).replace(st.percentDecode,"%")}catch{return null}return r}function jm(r,e){let t=r.replace(st.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(st.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(st.slashPipe,"|");return n}function Fs(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 E1(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 C1(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 Wm(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 A1(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 Ba=class{constructor(r){Se(this,"options");Se(this,"rules");Se(this,"lexer");this.options=r||_n}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:Fs(t,`
|
|
150
|
+
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=A1(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=Fs(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:Fs(e[0],`
|
|
151
151
|
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=Fs(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(`
|
|
@@ -159,17 +159,17 @@ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
159
159
|
`),g=this.blockquote(v);s[s.length-1]=g,n=n.substring(0,n.length-f.raw.length)+g.raw,i=i.substring(0,i.length-f.text.length)+g.text;break}else if(h?.type==="list"){let f=h,v=f.raw+`
|
|
160
160
|
`+t.join(`
|
|
161
161
|
`),g=this.list(v);s[s.length-1]=g,n=n.substring(0,n.length-h.raw.length)+g.raw,i=i.substring(0,i.length-f.raw.length)+g.raw,t=v.substring(s.at(-1).raw.length).split(`
|
|
162
|
-
`);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,i={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let s=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",u="";if(!(e=s.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let p=
|
|
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=C1(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 g=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),
|
|
166
|
-
`,1)[0],C;if(h=w,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),C=h):C=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||x.test(h)||
|
|
165
|
+
`,r=r.substring(h.length+1),l=!0),!l){let g=this.rules.other.nextBulletRegex(v),m=this.rules.other.hrRegex(v),y=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),S=this.rules.other.htmlBeginRegex(v),b=this.rules.other.blockquoteBeginRegex(v);for(;r;){let w=r.split(`
|
|
166
|
+
`,1)[0],C;if(h=w,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),C=h):C=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||x.test(h)||S.test(h)||b.test(h)||g.test(h)||m.test(h))break;if(C.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
|
|
167
167
|
`+C.slice(v);else{if(f||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(p)||x.test(p)||m.test(p))break;u+=`
|
|
168
168
|
`+h}f=!h.trim(),c+=w+`
|
|
169
|
-
`,r=r.substring(w.length+1),p=C.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=
|
|
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=Fs(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(
|
|
169
|
+
`,r=r.substring(w.length+1),p=C.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=jm(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(jm(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=Fs(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=E1(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)),Wm(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 Wm(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}}}},Ft=class Zu{constructor(e){Se(this,"tokens");Se(this,"options");Se(this,"state");Se(this,"inlineQueue");Se(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_n,this.options.tokenizer=this.options.tokenizer||new Ba,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:st,block:Fa.normal,inline:Ns.normal};this.options.pedantic?(t.block=Fa.pedantic,t.inline=Ns.pedantic):this.options.gfm&&(t.block=Fa.gfm,this.options.breaks?t.inline=Ns.breaks:t.inline=Ns.gfm),this.tokenizer.rules=t}static get rules(){return{block:Fa,inline:Ns}}static lex(e,t){return new Zu(t).lex(e)}static lexInline(e,t){return new Zu(t).inlineTokens(e)}lex(e){e=e.replace(st.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(st.tabCharGlobal," ").replace(st.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=t.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
173
173
|
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
174
174
|
`)?"":`
|
|
175
175
|
`)+i.raw,o.text+=`
|
|
@@ -182,7 +182,7 @@ ${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
182
182
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i),n=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
183
183
|
`)?"":`
|
|
184
184
|
`)+i.raw,o.text+=`
|
|
185
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=t.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,n,a)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):t.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}},
|
|
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}},Va=class{constructor(r){Se(this,"options");Se(this,"parser");this.options=r||_n}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(st.notSpaceStart)?.[0],i=r.replace(st.endingNewline,"")+`
|
|
186
186
|
`;return n?'<pre><code class="language-'+Kt(n)+'">'+(t?i:Kt(i,!0))+`</code></pre>
|
|
187
187
|
`:"<pre><code>"+(t?i:Kt(i,!0))+`</code></pre>
|
|
188
188
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
@@ -200,24 +200,24 @@ ${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>${Kt(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=
|
|
204
|
-
Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+Kt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},bn=new Yu;function we(r,e){return bn.parse(r,e)}we.options=we.setOptions=function(r){return bn.setOptions(r),we.defaults=bn.defaults,Tm(we.defaults),we};we.getDefaults=Vu;we.defaults=_n;we.use=function(...r){return bn.use(...r),we.defaults=bn.defaults,Tm(we.defaults),we};we.walkTokens=function(r,e){return bn.walkTokens(r,e)};we.parseInline=bn.parseInline;we.Parser=Dt;we.parser=Dt.parse;we.Renderer=La;we.TextRenderer=Ku;we.Lexer=Ft;we.lexer=Ft.lex;we.Tokenizer=Na;we.Hooks=Ds;we.parse=we;var gT=we.options,mT=we.setOptions,vT=we.use,yT=we.walkTokens,bT=we.parseInline;var _T=Dt.parse,xT=Ft.lex;function jm(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 i1(r,e,t){let n=jm(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 s1(r,e,t){let n=jm(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 o1(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 a1=[{kind:"faq:scroll_to",executor:i1},{kind:"faq:toggle_item",executor:s1},{kind:"faq:update",executor:o1}],Yt={white:"#ffffff",black:"#000000"},pt={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"},De={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Xt={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},it={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},Bs={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Vs={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Jt={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},js={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},TT={primary:M[10],secondary:M[9],tertiary:M[8]},IT={primary:M[2],secondary:M[0]},$T={primary:M[4],secondary:M[3]},MT={primary:{text:Yt.white,icon:Yt.white,border:pt[3],backgroundDefault:pt[3],backgroundHover:pt[2]},neutral:{text:M[10],textHover:Yt.white,icon:M[10],iconHover:Yt.white,border:M[4],background:M[2]},link:{text:Yt.white,icon:Yt.white,hover:pt[5]},error:{text:it[5],hover:it[6]},success:{text:De[5],hover:De[6]}},OT={slateGrey:{content:M[10],pillOutline:M[10],borderPrimary:M[5],borderSecondary:M[5],background:M[3]},brand:{content:pt[9],pillOutline:pt[9],borderPrimary:pt[6],borderSecondary:pt[6],background:pt[0]},red:{content:it[8],pillOutline:it[4],borderPrimary:it[2],borderSecondary:it[2],background:it[0]},yellow:{content:Xt[8],pillOutline:Xt[4],borderPrimary:Xt[2],borderSecondary:Xt[2],background:Xt[0]},green:{content:De[8],pillOutline:De[4],borderPrimary:De[2],borderSecondary:De[2],background:De[0]},purple:{content:Jt[8],pillOutline:Jt[4],borderPrimary:Jt[2],borderSecondary:Jt[2],background:Jt[0]},blue:{content:Bs[8],pillOutline:Bs[4],borderPrimary:Bs[2],borderSecondary:Bs[2],background:Bs[0]},orange:{content:Vs[8],pillOutline:Vs[4],borderPrimary:Vs[2],borderSecondary:Vs[2],background:Vs[0]},pink:{content:js[8],pillOutline:js[4],borderPrimary:js[2],borderSecondary:js[2],background:js[0]}},PT={green:{content:De[8],border:De[2],background:De[0]},yellow:{content:Xt[8],border:Xt[2],background:Xt[0]},red:{content:it[8],border:it[2],background:it[0]}},NT={green:{content:De[1],background:De[9]},yellow:{content:Xt[1],background:Xt[9]},red:{content:it[1],background:it[9]}},LT={content:M[10],border:M[4],background:M[3]},FT={backgroundDefault:M[2],backgroundHover:M[1],selected:M[3]},DT={background:M[2],icon:M[10],borderDefault:M[4],borderSelected:pt[3],textLabel:M[9],textPlaceholder:M[8],textHint:M[8]},HT={backgroundDefault:M[2],backgroundDisabled:M[0],textLabel:M[9],textPlaceholder:M[8],textHint:M[8],textError:it[5],iconDefault:M[9],iconPlaceholder:M[10],iconError:it[5],borderDefault:M[4],borderSelected:pt[3],borderError:it[5]},BT={handleDefault:Yt.white,handleDisabled:M[10],off:{backgroundDefault:M[4],backgroundHover:M[5],backgroundDisabled:M[4]},on:{backgroundDefault:De[3],backgroundHover:De[2],backgroundDisabled:M[4]}},VT={off:{backgroundDefault:"#00000000",backgroundHover:M[5],backgroundDisabled:M[2],border:M[6]},on:{backgroundDefault:De[0],backgroundHover:De[1],backgroundDisabled:M[2],border:De[3]}},jT={content:M[10],background:M[4]},UT={background:M[4],active:De[3]},WT={background:M[1],content:M[9],border:M[4]},zT={backgroundDefault:M[1],backgroundHover:M[3],backgroundActive:M[4],border:M[4],contentPrimary:M[10],contentSecondary:M[9],contentTertiary:M[8]},qT={background:M[1],content:M[9],border:M[4]},ZT={activeBackground:M[3],activeContent:pt[5],inactiveContent:M[9],border:M[4]},GT={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]}},KT={textPrimaryDefault:M[10],textPrimaryHover:M[10],textSecondaryDefault:M[8],textSecondaryHover:M[9],iconPrimary:M[10],iconSecondary:M[8]},YT={background:De[1],active:De[5]},XT={textDefault:M[10],textSelected:Yt.white,textDisabled:M[7],backgroundDefault:M[2],backgroundMiddle:M[3],backgroundSelected:pt[3],border:M[4]},JT=M[9],QT={size:56,inset:12,background:Yt.black,color:Yt.white,border:`2px solid ${pt[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)"},Qe={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"}},Xu={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:Jt[8],color:Jt[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:Jt[0],color:Jt[6]},categoryHeader:{color:M[8]},emptyState:{color:M[7]},feedbackPrompt:{color:M[8]}}};var Vm=new Yu({async:!1,gfm:!0,breaks:!0});function l1(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function c1(r){return typeof r=="string"?Vm.parse(r):r.type==="rich"?r.html:Vm.parse(r.content)}function u1(r){return r?r===!0?{style:"thumbs"}:r:null}function d1(r){return r.prompt??"Was this helpful?"}function p1(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Um=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)||l1(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=c1(r);return L`<div style="margin:0" data-faq-markdown="">${$a(e)}</div>`}_renderFeedback(r,e,t,n){let i=Xu[n],s={...Qe.feedback,...i.feedbackPrompt};return L`
|
|
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>${Kt(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=Um(r);if(i===null)return n;r=i;let s='<a href="'+r+'"';return e&&(s+=' title="'+Kt(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=Um(r);if(i===null)return Kt(t);r=i;let s=`<img src="${r}" alt="${Kt(t)}"`;return e&&(s+=` title="${Kt(e)}"`),s+=">",s}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:Kt(r.text)}},nd=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}},Dt=class Gu{constructor(e){Se(this,"options");Se(this,"renderer");Se(this,"textRenderer");this.options=e||_n,this.options.renderer=this.options.renderer||new Va,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new nd}static parse(e,t){return new Gu(t).parse(e)}static parseInline(e,t){return new Gu(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}},Da,Ds=(Da=class{constructor(r){Se(this,"options");Se(this,"block");this.options=r||_n}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?Ft.lex:Ft.lexInline}provideParser(){return this.block?Dt.parse:Dt.parseInline}},Se(Da,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Se(Da,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Da),id=class{constructor(...r){Se(this,"defaults",Ku());Se(this,"options",this.setOptions);Se(this,"parse",this.parseMarkdown(!0));Se(this,"parseInline",this.parseMarkdown(!1));Se(this,"Parser",Dt);Se(this,"Renderer",Va);Se(this,"TextRenderer",nd);Se(this,"Lexer",Ft);Se(this,"Tokenizer",Ba);Se(this,"Hooks",Ds);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 Va(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 Ba(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 Ds;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];Ds.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&Ds.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 Ft.lex(r,e??this.defaults)}parser(r,e){return Dt.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?Ft.lex:Ft.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?Dt.parse:Dt.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?Ft.lex:Ft.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?Dt.parse:Dt.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>"+Kt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},bn=new id;function ke(r,e){return bn.parse(r,e)}ke.options=ke.setOptions=function(r){return bn.setOptions(r),ke.defaults=bn.defaults,zm(ke.defaults),ke};ke.getDefaults=Ku;ke.defaults=_n;ke.use=function(...r){return bn.use(...r),ke.defaults=bn.defaults,zm(ke.defaults),ke};ke.walkTokens=function(r,e){return bn.walkTokens(r,e)};ke.parseInline=bn.parseInline;ke.Parser=Dt;ke.parser=Dt.parse;ke.Renderer=Va;ke.TextRenderer=nd;ke.Lexer=Ft;ke.lexer=Ft.lex;ke.Tokenizer=Ba;ke.Hooks=Ds;ke.parse=ke;var XT=ke.options,JT=ke.setOptions,QT=ke.use,eI=ke.walkTokens,tI=ke.parseInline;var rI=Dt.parse,nI=Ft.lex;function iv(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 R1(r,e,t){let n=iv(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 T1(r,e,t){let n=iv(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 I1(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 $1=[{kind:"faq:scroll_to",executor:R1},{kind:"faq:toggle_item",executor:T1},{kind:"faq:update",executor:I1}],Yt={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"},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"},He={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Xt={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"},Bs={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},Vs={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},Jt={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},Us={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"},dI={primary:M[10],secondary:M[9],tertiary:M[8]},pI={primary:M[2],secondary:M[0]},hI={primary:M[4],secondary:M[3]},fI={primary:{text:Yt.white,icon:Yt.white,border:ht[3],backgroundDefault:ht[3],backgroundHover:ht[2]},neutral:{text:M[10],textHover:Yt.white,icon:M[10],iconHover:Yt.white,border:M[4],background:M[2]},link:{text:Yt.white,icon:Yt.white,hover:ht[5]},error:{text:ot[5],hover:ot[6]},success:{text:He[5],hover:He[6]}},gI={slateGrey:{content:M[10],pillOutline:M[10],borderPrimary:M[5],borderSecondary:M[5],background:M[3]},brand:{content:ht[9],pillOutline:ht[9],borderPrimary:ht[6],borderSecondary:ht[6],background:ht[0]},red:{content:ot[8],pillOutline:ot[4],borderPrimary:ot[2],borderSecondary:ot[2],background:ot[0]},yellow:{content:Xt[8],pillOutline:Xt[4],borderPrimary:Xt[2],borderSecondary:Xt[2],background:Xt[0]},green:{content:He[8],pillOutline:He[4],borderPrimary:He[2],borderSecondary:He[2],background:He[0]},purple:{content:Jt[8],pillOutline:Jt[4],borderPrimary:Jt[2],borderSecondary:Jt[2],background:Jt[0]},blue:{content:Bs[8],pillOutline:Bs[4],borderPrimary:Bs[2],borderSecondary:Bs[2],background:Bs[0]},orange:{content:Vs[8],pillOutline:Vs[4],borderPrimary:Vs[2],borderSecondary:Vs[2],background:Vs[0]},pink:{content:Us[8],pillOutline:Us[4],borderPrimary:Us[2],borderSecondary:Us[2],background:Us[0]}},mI={green:{content:He[8],border:He[2],background:He[0]},yellow:{content:Xt[8],border:Xt[2],background:Xt[0]},red:{content:ot[8],border:ot[2],background:ot[0]}},vI={green:{content:He[1],background:He[9]},yellow:{content:Xt[1],background:Xt[9]},red:{content:ot[1],background:ot[9]}},yI={content:M[10],border:M[4],background:M[3]},bI={backgroundDefault:M[2],backgroundHover:M[1],selected:M[3]},_I={background:M[2],icon:M[10],borderDefault:M[4],borderSelected:ht[3],textLabel:M[9],textPlaceholder:M[8],textHint:M[8]},xI={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:ht[3],borderError:ot[5]},wI={handleDefault:Yt.white,handleDisabled:M[10],off:{backgroundDefault:M[4],backgroundHover:M[5],backgroundDisabled:M[4]},on:{backgroundDefault:He[3],backgroundHover:He[2],backgroundDisabled:M[4]}},SI={off:{backgroundDefault:"#00000000",backgroundHover:M[5],backgroundDisabled:M[2],border:M[6]},on:{backgroundDefault:He[0],backgroundHover:He[1],backgroundDisabled:M[2],border:He[3]}},kI={content:M[10],background:M[4]},EI={background:M[4],active:He[3]},CI={background:M[1],content:M[9],border:M[4]},AI={backgroundDefault:M[1],backgroundHover:M[3],backgroundActive:M[4],border:M[4],contentPrimary:M[10],contentSecondary:M[9],contentTertiary:M[8]},RI={background:M[1],content:M[9],border:M[4]},TI={activeBackground:M[3],activeContent:ht[5],inactiveContent:M[9],border:M[4]},II={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]}},$I={textPrimaryDefault:M[10],textPrimaryHover:M[10],textSecondaryDefault:M[8],textSecondaryHover:M[9],iconPrimary:M[10],iconSecondary:M[8]},MI={background:He[1],active:He[5]},PI={textDefault:M[10],textSelected:Yt.white,textDisabled:M[7],backgroundDefault:M[2],backgroundMiddle:M[3],backgroundSelected:ht[3],border:M[4]},OI=M[9],LI={size:56,inset:12,background:Yt.black,color:Yt.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)"},tt={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"}},sd={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:Jt[8],color:Jt[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:Jt[0],color:Jt[6]},categoryHeader:{color:M[8]},emptyState:{color:M[7]},feedbackPrompt:{color:M[8]}}};var nv=new id({async:!1,gfm:!0,breaks:!0});function M1(r){return typeof r=="string"?r:r.type==="rich"?r.html:r.content}function P1(r){return typeof r=="string"?nv.parse(r):r.type==="rich"?r.html:nv.parse(r.content)}function O1(r){return r?r===!0?{style:"thumbs"}:r:null}function L1(r){return r.prompt??"Was this helpful?"}function N1(r){return r&&r!=="auto"?r:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var sv=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)||M1(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=P1(r);return N`<div style="margin:0" data-faq-markdown="">${Na(e)}</div>`}_renderFeedback(r,e,t,n){let i=sd[n],s={...tt.feedback,...i.feedbackPrompt};return N`
|
|
205
205
|
<div style=${R(s)}>
|
|
206
|
-
<span>${
|
|
206
|
+
<span>${L1(e)}</span>
|
|
207
207
|
<button
|
|
208
208
|
type="button"
|
|
209
|
-
style=${R({...
|
|
209
|
+
style=${R({...tt.feedbackButton,...t==="up"?tt.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=${R({...
|
|
215
|
+
style=${R({...tt.feedbackButton,...t==="down"?tt.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=sd[t],s=this._expandedIds.has(r.config.id),o=this._highlightId===r.config.id,a=this._hoveredId===r.config.id,l={...tt.item,...i.item,...s?i.itemExpanded:{},...o?{boxShadow:`0 0 0 2px ${Jt[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={...tt.question,...i.question,...a?i.questionHover:{}},u={...tt.chevron,transform:s?"rotate(90deg)":"rotate(0deg)"},p={...tt.answer,...i.answer,maxHeight:s?"500px":"0",paddingBottom:s?"16px":"0"};return N`
|
|
221
221
|
<div
|
|
222
222
|
style=${R(l)}
|
|
223
223
|
data-faq-item-id=${r.config.id}
|
|
@@ -242,7 +242,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
242
242
|
${s&&n?this._renderFeedback(r,n,this._feedbackState.get(r.config.id),t):Q}
|
|
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=N1(this.faqConfig.theme),e=sd[r],t=O1(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={...tt.container,...e.container},c={...tt.emptyState,...e.emptyState},u={...tt.categoryHeader,...e.categoryHeader},p={...tt.searchInput,...e.searchInput};return n.length===0?N`
|
|
246
246
|
<div
|
|
247
247
|
style=${R(l)}
|
|
248
248
|
data-adaptive-id=${this.instanceId}
|
|
@@ -253,14 +253,14 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
253
253
|
you're doing.
|
|
254
254
|
</div>
|
|
255
255
|
</div>
|
|
256
|
-
`:
|
|
256
|
+
`:N`
|
|
257
257
|
<div
|
|
258
258
|
style=${R(l)}
|
|
259
259
|
data-adaptive-id=${this.instanceId}
|
|
260
260
|
data-adaptive-type="adaptive-faq"
|
|
261
261
|
>
|
|
262
|
-
${this.faqConfig.searchable?
|
|
263
|
-
<div style=${R(
|
|
262
|
+
${this.faqConfig.searchable?N`
|
|
263
|
+
<div style=${R(tt.searchWrapper)}>
|
|
264
264
|
<style>
|
|
265
265
|
[data-adaptive-id="${this.instanceId}"] input::placeholder {
|
|
266
266
|
color: var(--sc-content-search-color, inherit);
|
|
@@ -277,9 +277,9 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
277
277
|
</div>
|
|
278
278
|
`:Q}
|
|
279
279
|
|
|
280
|
-
<div style=${R(
|
|
281
|
-
${a?Array.from(a.entries()).map(([h,f])=>
|
|
282
|
-
${h?
|
|
280
|
+
<div style=${R(tt.accordion)}>
|
|
281
|
+
${a?Array.from(a.entries()).map(([h,f])=>N`
|
|
282
|
+
${h?N`
|
|
283
283
|
<div
|
|
284
284
|
style=${R(u)}
|
|
285
285
|
data-category-header=${h}
|
|
@@ -291,15 +291,15 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
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?N`
|
|
295
295
|
<div
|
|
296
|
-
style=${R({...
|
|
296
|
+
style=${R({...tt.noResults,...e.emptyState})}
|
|
297
297
|
>
|
|
298
298
|
No questions found matching "${this._searchQuery}"
|
|
299
299
|
</div>
|
|
300
300
|
`:Q}
|
|
301
301
|
</div>
|
|
302
|
-
`}};Um.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",Um);var h1={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()}},Wm={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:a1,widgets:[{id:"adaptive-faq:accordion",component:h1,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={};tg(d,{BRAND:()=>H1,DIRTY:()=>xn,EMPTY_PATH:()=>v1,INVALID:()=>re,NEVER:()=>kk,OK:()=>et,ParseStatus:()=>Ze,Schema:()=>ue,ZodAny:()=>jr,ZodArray:()=>yr,ZodBigInt:()=>kn,ZodBoolean:()=>Sn,ZodBranded:()=>Ws,ZodCatch:()=>Nn,ZodDate:()=>En,ZodDefault:()=>Pn,ZodDiscriminatedUnion:()=>Va,ZodEffects:()=>Rt,ZodEnum:()=>Mn,ZodError:()=>ht,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Ua,ZodIntersection:()=>Tn,ZodIssueCode:()=>I,ZodLazy:()=>In,ZodLiteral:()=>$n,ZodMap:()=>yi,ZodNaN:()=>_i,ZodNativeEnum:()=>On,ZodNever:()=>Ht,ZodNull:()=>An,ZodNullable:()=>tr,ZodNumber:()=>wn,ZodObject:()=>ft,ZodOptional:()=>Ct,ZodParsedType:()=>z,ZodPipeline:()=>zs,ZodPromise:()=>Ur,ZodReadonly:()=>Ln,ZodRecord:()=>ja,ZodSchema:()=>ue,ZodSet:()=>bi,ZodString:()=>Vr,ZodSymbol:()=>mi,ZodTransformer:()=>Rt,ZodTuple:()=>er,ZodType:()=>ue,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>vr,ZodVoid:()=>vi,addIssueToContext:()=>H,any:()=>G1,array:()=>J1,bigint:()=>U1,boolean:()=>tv,coerce:()=>wk,custom:()=>Jm,date:()=>W1,datetimeRegex:()=>Ym,defaultErrorMap:()=>gr,discriminatedUnion:()=>rk,effect:()=>fk,enum:()=>dk,function:()=>lk,getErrorMap:()=>hi,getParsedType:()=>Qt,instanceof:()=>V1,intersection:()=>nk,isAborted:()=>Ha,isAsync:()=>fi,isDirty:()=>Ba,isValid:()=>Br,late:()=>B1,lazy:()=>ck,literal:()=>uk,makeIssue:()=>Us,map:()=>ok,nan:()=>j1,nativeEnum:()=>pk,never:()=>Y1,null:()=>Z1,nullable:()=>mk,number:()=>ev,object:()=>Q1,objectUtil:()=>Ju,oboolean:()=>xk,onumber:()=>_k,optional:()=>gk,ostring:()=>bk,pipeline:()=>yk,preprocess:()=>vk,promise:()=>hk,quotelessJson:()=>f1,record:()=>sk,set:()=>ak,setErrorMap:()=>m1,strictObject:()=>ek,string:()=>Qm,symbol:()=>z1,transformer:()=>fk,tuple:()=>ik,undefined:()=>q1,union:()=>tk,unknown:()=>K1,util:()=>pe,void:()=>X1});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 Ju;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ju||(Ju={}));var z=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=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 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"]),f1=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),ht=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()}};ht.create=r=>new ht(r);var g1=(r,e)=>{let t;switch(r.code){case I.invalid_type:r.received===z.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}},gr=g1;var zm=gr;function m1(r){zm=r}function hi(){return zm}var Us=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}},v1=[];function H(r,e){let t=hi(),n=Us({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===gr?void 0:gr].filter(i=>!!i)});r.common.issues.push(n)}var Ze=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 re;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 re;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}}},re=Object.freeze({status:"aborted"}),xn=r=>({status:"dirty",value:r}),et=r=>({status:"valid",value:r}),Ha=r=>r.status==="aborted",Ba=r=>r.status==="dirty",Br=r=>r.status==="valid",fi=r=>typeof Promise<"u"&&r instanceof Promise;var J;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(J||(J={}));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}},qm=(r,e)=>{if(Br(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 ht(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 Qt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ze,ctx:{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(fi(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:Qt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return qm(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Br(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=>Br(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:Qt(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(fi(i)?i:Promise.resolve(i));return qm(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 Rt({schema:this,typeName:ne.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 tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return Ur.create(this,this._def)}or(e){return Rn.create([this,e],this._def)}and(e){return Tn.create(this,e,this._def)}transform(e){return new Rt({...ce(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Pn({...ce(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new Ws({typeName:ne.ZodBranded,type:this,...ce(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Nn({...ce(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zs.create(this,e)}readonly(){return Ln.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},y1=/^c[^\s-]{8,}$/i,b1=/^[0-9a-z]+$/,_1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,x1=/^[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,w1=/^[a-z0-9_-]{21}$/i,k1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,S1=/^[-+]?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)?)??$/,E1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,C1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qu,A1=/^(?:(?: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])$/,R1=/^(?:(?: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])$/,T1=/^(([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]))$/,I1=/^(([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])$/,$1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gm="((\\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])))",O1=new RegExp(`^${Gm}$`);function Km(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 P1(r){return new RegExp(`^${Km(r)}$`)}function Ym(r){let e=`${Gm}T${Km(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 N1(r,e){return!!((e==="v4"||!e)&&A1.test(r)||(e==="v6"||!e)&&T1.test(r))}function L1(r,e){if(!k1.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 F1(r,e){return!!((e==="v4"||!e)&&R1.test(r)||(e==="v6"||!e)&&I1.test(r))}var Vr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.string,received:s.parsedType}),re}let n=new Ze,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),H(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),H(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?H(i,{code:I.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&H(i,{code:I.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")E1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"email",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Qu||(Qu=new RegExp(C1,"u")),Qu.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"emoji",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")x1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"uuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")w1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"nanoid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")y1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")b1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid2",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")_1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(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),H(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),H(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),H(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),H(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),H(i,{code:I.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ym(s).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?O1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?P1(s).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?S1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"duration",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?N1(e.data,s.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ip",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?L1(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"jwt",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?F1(e.data,s.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cidr",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?$1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?M1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(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,...J.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...J.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...J.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,...J.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,...J.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...J.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.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}};Vr.create=r=>new Vr({checks:[],typeName:ne.ZodString,coerce:r?.coerce??!1,...ce(r)});function D1(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 wn=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)!==z.number){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.number,received:s.parsedType}),re}let n,i=new Ze;for(let s of this._def.checks)s.kind==="int"?pe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),H(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),H(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),H(n,{code:I.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?D1(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),H(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),H(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,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.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)}};wn.create=r=>new wn({checks:[],typeName:ne.ZodNumber,coerce:r?.coerce||!1,...ce(r)});var kn=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)!==z.bigint)return this._getInvalidInput(e);let n,i=new Ze;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),H(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),H(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),H(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 H(t,{code:I.invalid_type,expected:z.bigint,received:t.parsedType}),re}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.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:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.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}};kn.create=r=>new kn({checks:[],typeName:ne.ZodBigInt,coerce:r?.coerce??!1,...ce(r)});var Sn=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.boolean,received:n.parsedType}),re}return et(e.data)}};Sn.create=r=>new Sn({typeName:ne.ZodBoolean,coerce:r?.coerce||!1,...ce(r)});var En=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.date,received:s.parsedType}),re}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_date}),re}let n=new Ze,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),H(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),H(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:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.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}};En.create=r=>new En({checks:[],coerce:r?.coerce||!1,typeName:ne.ZodDate,...ce(r)});var mi=class extends ue{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.symbol,received:n.parsedType}),re}return et(e.data)}};mi.create=r=>new mi({typeName:ne.ZodSymbol,...ce(r)});var Cn=class extends ue{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.undefined,received:n.parsedType}),re}return et(e.data)}};Cn.create=r=>new Cn({typeName:ne.ZodUndefined,...ce(r)});var An=class extends ue{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.null,received:n.parsedType}),re}return et(e.data)}};An.create=r=>new An({typeName:ne.ZodNull,...ce(r)});var jr=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return et(e.data)}};jr.create=r=>new jr({typeName:ne.ZodAny,...ce(r)});var vr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return et(e.data)}};vr.create=r=>new vr({typeName:ne.ZodUnknown,...ce(r)});var Ht=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return H(t,{code:I.invalid_type,expected:z.never,received:t.parsedType}),re}};Ht.create=r=>new Ht({typeName:ne.ZodNever,...ce(r)});var vi=class extends ue{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.void,received:n.parsedType}),re}return et(e.data)}};vi.create=r=>new vi({typeName:ne.ZodVoid,...ce(r)});var yr=class r extends ue{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==z.array)return H(t,{code:I.invalid_type,expected:z.array,received:t.parsedType}),re;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(H(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&&(H(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&&(H(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 At(t,o,t.path,a)))).then(o=>Ze.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new At(t,o,t.path,a)));return Ze.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}};yr.create=(r,e)=>new yr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ce(e)});function gi(r){if(r instanceof ft){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Ct.create(gi(n))}return new ft({...r._def,shape:()=>e})}else return r instanceof yr?new yr({...r._def,type:gi(r.element)}):r instanceof Ct?Ct.create(gi(r.unwrap())):r instanceof tr?tr.create(gi(r.unwrap())):r instanceof er?er.create(r.items.map(e=>gi(e))):r}var ft=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)!==z.object){let c=this._getOrReturnCtx(e);return H(c,{code:I.invalid_type,expected:z.object,received:c.parsedType}),re}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ht&&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 Ht){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&&(H(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 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=>Ze.mergeObjectSync(n,c)):Ze.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return J.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:J.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:ne.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 gi(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 Ct;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Xm(pe.objectKeys(this.shape))}};ft.create=(r,e)=>new ft({shape:()=>r,unknownKeys:"strip",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});ft.strictCreate=(r,e)=>new ft({shape:()=>r,unknownKeys:"strict",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});ft.lazycreate=(r,e)=>new ft({shape:r,unknownKeys:"strip",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});var Rn=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 ht(a.ctx.common.issues));return H(t,{code:I.invalid_union,unionErrors:o}),re}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 ht(l));return H(t,{code:I.invalid_union,unionErrors:a}),re}}get options(){return this._def.options}};Rn.create=(r,e)=>new Rn({options:r,typeName:ne.ZodUnion,...ce(e)});var mr=r=>r instanceof In?mr(r.schema):r instanceof Rt?mr(r.innerType()):r instanceof $n?[r.value]:r instanceof Mn?r.options:r instanceof On?pe.objectValues(r.enum):r instanceof Pn?mr(r._def.innerType):r instanceof Cn?[void 0]:r instanceof An?[null]:r instanceof Ct?[void 0,...mr(r.unwrap())]:r instanceof tr?[null,...mr(r.unwrap())]:r instanceof Ws||r instanceof Ln?mr(r.unwrap()):r instanceof Nn?mr(r._def.innerType):[],Va=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.object)return H(t,{code:I.invalid_type,expected:z.object,received:t.parsedType}),re;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}):(H(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}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=mr(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:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ce(n)})}};function ed(r,e){let t=Qt(r),n=Qt(e);if(r===e)return{valid:!0,data:r};if(t===z.object&&n===z.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===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=ed(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 Tn=class extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(Ha(s)||Ha(o))return re;let a=ed(s.value,o.value);return a.valid?((Ba(s)||Ba(o))&&t.dirty(),{status:t.value,value:a.data}):(H(n,{code:I.invalid_intersection_types}),re)};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}))}};Tn.create=(r,e,t)=>new Tn({left:r,right:e,typeName:ne.ZodIntersection,...ce(t)});var er=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return H(n,{code:I.invalid_type,expected:z.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return H(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(H(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 At(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Ze.mergeArray(t,o)):Ze.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};er.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:r,typeName:ne.ZodTuple,rest:null,...ce(e)})};var ja=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!==z.object)return H(n,{code:I.invalid_type,expected:z.object,received:n.parsedType}),re;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?Ze.mergeObjectAsync(t,i):Ze.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:ne.ZodRecord,...ce(n)}):new r({keyType:Vr.create(),valueType:e,typeName:ne.ZodRecord,...ce(t)})}},yi=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!==z.map)return H(n,{code:I.invalid_type,expected:z.map,received:n.parsedType}),re;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 re;(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 re;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};yi.create=(r,e,t)=>new yi({valueType:e,keyType:r,typeName:ne.ZodMap,...ce(t)});var bi=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return H(n,{code:I.invalid_type,expected:z.set,received:n.parsedType}),re;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(H(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&&(H(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 re;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:J.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};bi.create=(r,e)=>new bi({valueType:r,minSize:null,maxSize:null,typeName:ne.ZodSet,...ce(e)});var Ua=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.function)return H(t,{code:I.invalid_type,expected:z.function,received:t.parsedType}),re;function n(a,l){return Us({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hi(),gr].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function i(a,l){return Us({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hi(),gr].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 Ur){let a=this;return et(async function(...l){let c=new ht([]),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 et(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new ht([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new ht([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:er.create(e).rest(vr.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||er.create([]).rest(vr.create()),returns:t||vr.create(),typeName:ne.ZodFunction,...ce(n)})}},In=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})}};In.create=(r,e)=>new In({getter:r,typeName:ne.ZodLazy,...ce(e)});var $n=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return H(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};$n.create=(r,e)=>new $n({value:r,typeName:ne.ZodLiteral,...ce(e)});function Xm(r,e){return new Mn({values:r,typeName:ne.ZodEnum,...ce(e)})}var Mn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return H(t,{expected:pe.joinValues(n),received:t.parsedType,code:I.invalid_type}),re}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 H(t,{received:t.data,code:I.invalid_enum_value,options:n}),re}return et(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Mn.create=Xm;var On=class extends ue{_parse(e){let t=pe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let i=pe.objectValues(t);return H(n,{expected:pe.joinValues(i),received:n.parsedType,code:I.invalid_type}),re}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=pe.objectValues(t);return H(n,{received:n.data,code:I.invalid_enum_value,options:i}),re}return et(e.data)}get enum(){return this._def.values}};On.create=(r,e)=>new On({values:r,typeName:ne.ZodNativeEnum,...ce(e)});var Ur=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.promise&&t.common.async===!1)return H(t,{code:I.invalid_type,expected:z.promise,received:t.parsedType}),re;let n=t.parsedType===z.promise?t.data:Promise.resolve(t.data);return et(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ur.create=(r,e)=>new Ur({type:r,typeName:ne.ZodPromise,...ce(e)});var Rt=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.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=>{H(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 re;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?re:l.status==="dirty"?xn(l.value):t.value==="dirty"?xn(l.value):l});{if(t.value==="aborted")return re;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?xn(a.value):t.value==="dirty"?xn(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"?re:(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"?re:(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(!Br(o))return re;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=>Br(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):re);pe.assertNever(i)}};Rt.create=(r,e,t)=>new Rt({schema:r,typeName:ne.ZodEffects,effect:e,...ce(t)});Rt.createWithPreprocess=(r,e,t)=>new Rt({schema:e,effect:{type:"preprocess",transform:r},typeName:ne.ZodEffects,...ce(t)});var Ct=class extends ue{_parse(e){return this._getType(e)===z.undefined?et(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(r,e)=>new Ct({innerType:r,typeName:ne.ZodOptional,...ce(e)});var tr=class extends ue{_parse(e){return this._getType(e)===z.null?et(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tr.create=(r,e)=>new tr({innerType:r,typeName:ne.ZodNullable,...ce(e)});var Pn=class extends ue{_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}};Pn.create=(r,e)=>new Pn({innerType:r,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var Nn=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 fi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ht(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ht(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nn.create=(r,e)=>new Nn({innerType:r,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var _i=class extends ue{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};_i.create=r=>new _i({typeName:ne.ZodNaN,...ce(r)});var H1=Symbol("zod_brand"),Ws=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}},zs=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"?re:s.status==="dirty"?(t.dirty(),xn(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"?re: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:ne.ZodPipeline})}},Ln=class extends ue{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Br(i)&&(i.value=Object.freeze(i.value)),i);return fi(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Ln.create=(r,e)=>new Ln({innerType:r,typeName:ne.ZodReadonly,...ce(e)});function Zm(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Jm(r,e={},t){return r?jr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Zm(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Zm(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):jr.create()}var B1={object:ft.lazycreate},ne;(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"})(ne||(ne={}));var V1=(r,e={message:`Input not instance of ${r.name}`})=>Jm(t=>t instanceof r,e),Qm=Vr.create,ev=wn.create,j1=_i.create,U1=kn.create,tv=Sn.create,W1=En.create,z1=mi.create,q1=Cn.create,Z1=An.create,G1=jr.create,K1=vr.create,Y1=Ht.create,X1=vi.create,J1=yr.create,Q1=ft.create,ek=ft.strictCreate,tk=Rn.create,rk=Va.create,nk=Tn.create,ik=er.create,sk=ja.create,ok=yi.create,ak=bi.create,lk=Ua.create,ck=In.create,uk=$n.create,dk=Mn.create,pk=On.create,hk=Ur.create,fk=Rt.create,gk=Ct.create,mk=tr.create,vk=Rt.createWithPreprocess,yk=zs.create,bk=()=>Qm().optional(),_k=()=>ev().optional(),xk=()=>tv().optional(),wk={string:(r=>Vr.create({...r,coerce:!0})),number:(r=>wn.create({...r,coerce:!0})),boolean:(r=>Sn.create({...r,coerce:!0})),bigint:(r=>kn.create({...r,coerce:!0})),date:(r=>En.create({...r,coerce:!0}))};var kk=re;var OI=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),PI={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.")},Sk=["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"],Ek=d.enum(Sk).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Ck=["time_on_page","page_views","scroll_depth"],Ak=d.enum(Ck).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage."),Rk=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"}'),Tk=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."),Ik=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"}`),$k=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}'),Mk=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."),Ok=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.'),Pk=d.object({type:d.literal("session_metric"),key:Ak,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}'),Nk=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."),Lk=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."),Fk=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."),Dk=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."),Hk=d.object({events:d.array(Ek).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),Dk).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."),Bk=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:Hk.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"}}}}'),Vk=d.discriminatedUnion("type",[Rk,Tk,Ik,$k,Mk,Ok,Pk,Nk,Lk,Fk,Bk]),jk=d.object({conditions:d.array(Vk).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."),Uk=d.object({type:d.literal("rules"),rules:d.array(jk).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."),Wk=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."),zk=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."),qk=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."),Zk=d.discriminatedUnion("type",[Uk,Wk,zk,qk]),NI=Zk.nullable().optional(),LI=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),FI=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional(),Gk='<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"',Kk={"\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 rv(r,e={}){let t=Kk[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${Gk} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var nv=r=>{throw TypeError(r)},td=(r,e,t)=>e.has(r)||nv("Cannot "+t),rd=(r,e,t)=>(td(r,e,"read from private field"),t?t.call(r):e.get(r)),Wa=(r,e,t)=>e.has(r)?nv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),qs=(r,e,t,n)=>(td(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Ge=(r,e,t)=>(td(r,e,"access private method"),t);function Yk(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 Xk(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var Jk="#6a59ce",iv="#677384",sv="#87919f";function Qk(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function eS(r){return rv(r)||Qk(r)}function ov(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 tS(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 rS(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Zs,Gs,We,nd,id,lv,od,cv,uv,dv,Ks,sd,pv=class extends ye{constructor(){super(...arguments),Wa(this,We),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,Wa(this,Zs,null),Wa(this,Gs,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ge(this,We,nd).call(this)}disconnectedCallback(){super.disconnectedCallback(),Ge(this,We,id).call(this)}updated(r){r.has("runtime")&&(Ge(this,We,id).call(this),Ge(this,We,nd).call(this))}render(){let r=Ge(this,We,lv).call(this),e=Ge(this,We,od).call(this),t=R({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),n=R({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),i=R({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"?sv:iv}),s=R({fontSize:"13px",padding:"16px",textAlign:"center",color:e==="dark"?iv:sv});if(r.length===0)return L`
|
|
302
|
+
`}};sv.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",sv);var F1={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()}},ov={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:$1,widgets:[{id:"adaptive-faq:accordion",component:F1,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={};vg(d,{BRAND:()=>cS,DIRTY:()=>xn,EMPTY_PATH:()=>V1,INVALID:()=>re,NEVER:()=>ZS,OK:()=>rt,ParseStatus:()=>Ke,Schema:()=>ue,ZodAny:()=>Ur,ZodArray:()=>yr,ZodBigInt:()=>Sn,ZodBoolean:()=>kn,ZodBranded:()=>Ws,ZodCatch:()=>Ln,ZodDate:()=>En,ZodDefault:()=>On,ZodDiscriminatedUnion:()=>qa,ZodEffects:()=>Rt,ZodEnum:()=>Mn,ZodError:()=>ft,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Ga,ZodIntersection:()=>Tn,ZodIssueCode:()=>I,ZodLazy:()=>In,ZodLiteral:()=>$n,ZodMap:()=>yi,ZodNaN:()=>_i,ZodNativeEnum:()=>Pn,ZodNever:()=>Ht,ZodNull:()=>An,ZodNullable:()=>tr,ZodNumber:()=>wn,ZodObject:()=>gt,ZodOptional:()=>Ct,ZodParsedType:()=>z,ZodPipeline:()=>zs,ZodPromise:()=>jr,ZodReadonly:()=>Nn,ZodRecord:()=>Za,ZodSchema:()=>ue,ZodSet:()=>bi,ZodString:()=>Vr,ZodSymbol:()=>mi,ZodTransformer:()=>Rt,ZodTuple:()=>er,ZodType:()=>ue,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>vr,ZodVoid:()=>vi,addIssueToContext:()=>H,any:()=>yS,array:()=>wS,bigint:()=>hS,boolean:()=>vv,coerce:()=>qS,custom:()=>fv,date:()=>fS,datetimeRegex:()=>pv,defaultErrorMap:()=>gr,discriminatedUnion:()=>CS,effect:()=>DS,enum:()=>LS,function:()=>MS,getErrorMap:()=>hi,getParsedType:()=>Qt,instanceof:()=>dS,intersection:()=>AS,isAborted:()=>Wa,isAsync:()=>fi,isDirty:()=>za,isValid:()=>Br,late:()=>uS,lazy:()=>PS,literal:()=>OS,makeIssue:()=>js,map:()=>IS,nan:()=>pS,nativeEnum:()=>NS,never:()=>_S,null:()=>vS,nullable:()=>BS,number:()=>mv,object:()=>SS,objectUtil:()=>od,oboolean:()=>zS,onumber:()=>WS,optional:()=>HS,ostring:()=>jS,pipeline:()=>US,preprocess:()=>VS,promise:()=>FS,quotelessJson:()=>D1,record:()=>TS,set:()=>$S,setErrorMap:()=>B1,strictObject:()=>kS,string:()=>gv,symbol:()=>gS,transformer:()=>DS,tuple:()=>RS,undefined:()=>mS,union:()=>ES,unknown:()=>bS,util:()=>he,void:()=>xS});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 od;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(od||(od={}));var z=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=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 I=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"]),D1=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),ft=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()}};ft.create=r=>new ft(r);var H1=(r,e)=>{let t;switch(r.code){case I.invalid_type:r.received===z.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case I.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,he.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:t=`Unrecognized key(s) in object: ${he.joinValues(r.keys,", ")}`;break;case I.invalid_union:t="Invalid input";break;case I.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${he.joinValues(r.options)}`;break;case I.invalid_enum_value:t=`Invalid enum value. Expected ${he.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}"`:he.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,he.assertNever(r)}return{message:t}},gr=H1;var av=gr;function B1(r){av=r}function hi(){return av}var js=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}},V1=[];function H(r,e){let t=hi(),n=js({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===gr?void 0:gr].filter(i=>!!i)});r.common.issues.push(n)}var Ke=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 re;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 re;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}}},re=Object.freeze({status:"aborted"}),xn=r=>({status:"dirty",value:r}),rt=r=>({status:"valid",value:r}),Wa=r=>r.status==="aborted",za=r=>r.status==="dirty",Br=r=>r.status==="valid",fi=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}},lv=(r,e)=>{if(Br(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 ft(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 Qt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ke,ctx:{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(fi(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:Qt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return lv(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Br(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=>Br(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:Qt(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(fi(i)?i:Promise.resolve(i));return lv(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 Rt({schema:this,typeName:ne.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 tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return jr.create(this,this._def)}or(e){return Rn.create([this,e],this._def)}and(e){return Tn.create(this,e,this._def)}transform(e){return new Rt({...ce(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new On({...ce(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new Ws({typeName:ne.ZodBranded,type:this,...ce(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ln({...ce(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zs.create(this,e)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},U1=/^c[^\s-]{8,}$/i,j1=/^[0-9a-z]+$/,W1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,z1=/^[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,q1=/^[a-z0-9_-]{21}$/i,Z1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G1=/^[-+]?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)?)??$/,K1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ad,X1=/^(?:(?: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])$/,J1=/^(?:(?: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])$/,Q1=/^(([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]))$/,eS=/^(([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])$/,tS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uv="((\\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])))",nS=new RegExp(`^${uv}$`);function dv(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 iS(r){return new RegExp(`^${dv(r)}$`)}function pv(r){let e=`${uv}T${dv(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 sS(r,e){return!!((e==="v4"||!e)&&X1.test(r)||(e==="v6"||!e)&&Q1.test(r))}function oS(r,e){if(!Z1.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 aS(r,e){return!!((e==="v4"||!e)&&J1.test(r)||(e==="v6"||!e)&&eS.test(r))}var Vr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.string,received:s.parsedType}),re}let n=new Ke,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),H(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),H(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?H(i,{code:I.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&H(i,{code:I.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")K1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"email",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ad||(ad=new RegExp(Y1,"u")),ad.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"emoji",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")z1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"uuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")q1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"nanoid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")U1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")j1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid2",code:I.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")W1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(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),H(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),H(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),H(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),H(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),H(i,{code:I.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?pv(s).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?nS.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?iS(s).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:I.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?G1.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"duration",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?sS(e.data,s.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ip",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?oS(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"jwt",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?aS(e.data,s.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cidr",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?tS.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64",code:I.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?rS.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64url",code:I.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: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}};Vr.create=r=>new Vr({checks:[],typeName:ne.ZodString,coerce:r?.coerce??!1,...ce(r)});function lS(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 wn=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)!==z.number){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.number,received:s.parsedType}),re}let n,i=new Ke;for(let s of this._def.checks)s.kind==="int"?he.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),H(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),H(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),H(n,{code:I.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?lS(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),H(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),H(n,{code:I.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)}};wn.create=r=>new wn({checks:[],typeName:ne.ZodNumber,coerce:r?.coerce||!1,...ce(r)});var Sn=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)!==z.bigint)return this._getInvalidInput(e);let n,i=new Ke;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),H(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),H(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),H(n,{code:I.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 H(t,{code:I.invalid_type,expected:z.bigint,received:t.parsedType}),re}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}};Sn.create=r=>new Sn({checks:[],typeName:ne.ZodBigInt,coerce:r?.coerce??!1,...ce(r)});var kn=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.boolean,received:n.parsedType}),re}return rt(e.data)}};kn.create=r=>new kn({typeName:ne.ZodBoolean,coerce:r?.coerce||!1,...ce(r)});var En=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_type,expected:z.date,received:s.parsedType}),re}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return H(s,{code:I.invalid_date}),re}let n=new Ke,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),H(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),H(i,{code:I.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}};En.create=r=>new En({checks:[],coerce:r?.coerce||!1,typeName:ne.ZodDate,...ce(r)});var mi=class extends ue{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.symbol,received:n.parsedType}),re}return rt(e.data)}};mi.create=r=>new mi({typeName:ne.ZodSymbol,...ce(r)});var Cn=class extends ue{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.undefined,received:n.parsedType}),re}return rt(e.data)}};Cn.create=r=>new Cn({typeName:ne.ZodUndefined,...ce(r)});var An=class extends ue{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.null,received:n.parsedType}),re}return rt(e.data)}};An.create=r=>new An({typeName:ne.ZodNull,...ce(r)});var Ur=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return rt(e.data)}};Ur.create=r=>new Ur({typeName:ne.ZodAny,...ce(r)});var vr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rt(e.data)}};vr.create=r=>new vr({typeName:ne.ZodUnknown,...ce(r)});var Ht=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return H(t,{code:I.invalid_type,expected:z.never,received:t.parsedType}),re}};Ht.create=r=>new Ht({typeName:ne.ZodNever,...ce(r)});var vi=class extends ue{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.void,received:n.parsedType}),re}return rt(e.data)}};vi.create=r=>new vi({typeName:ne.ZodVoid,...ce(r)});var yr=class r extends ue{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==z.array)return H(t,{code:I.invalid_type,expected:z.array,received:t.parsedType}),re;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(H(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&&(H(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&&(H(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 At(t,o,t.path,a)))).then(o=>Ke.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new At(t,o,t.path,a)));return Ke.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)}};yr.create=(r,e)=>new yr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ce(e)});function gi(r){if(r instanceof gt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Ct.create(gi(n))}return new gt({...r._def,shape:()=>e})}else return r instanceof yr?new yr({...r._def,type:gi(r.element)}):r instanceof Ct?Ct.create(gi(r.unwrap())):r instanceof tr?tr.create(gi(r.unwrap())):r instanceof er?er.create(r.items.map(e=>gi(e))):r}var gt=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=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 H(c,{code:I.invalid_type,expected:z.object,received:c.parsedType}),re}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ht&&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 Ht){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&&(H(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 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=>Ke.mergeObjectSync(n,c)):Ke.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:ne.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 gi(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 hv(he.objectKeys(this.shape))}};gt.create=(r,e)=>new gt({shape:()=>r,unknownKeys:"strip",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});gt.strictCreate=(r,e)=>new gt({shape:()=>r,unknownKeys:"strict",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});gt.lazycreate=(r,e)=>new gt({shape:r,unknownKeys:"strip",catchall:Ht.create(),typeName:ne.ZodObject,...ce(e)});var Rn=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 ft(a.ctx.common.issues));return H(t,{code:I.invalid_union,unionErrors:o}),re}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 ft(l));return H(t,{code:I.invalid_union,unionErrors:a}),re}}get options(){return this._def.options}};Rn.create=(r,e)=>new Rn({options:r,typeName:ne.ZodUnion,...ce(e)});var mr=r=>r instanceof In?mr(r.schema):r instanceof Rt?mr(r.innerType()):r instanceof $n?[r.value]:r instanceof Mn?r.options:r instanceof Pn?he.objectValues(r.enum):r instanceof On?mr(r._def.innerType):r instanceof Cn?[void 0]:r instanceof An?[null]:r instanceof Ct?[void 0,...mr(r.unwrap())]:r instanceof tr?[null,...mr(r.unwrap())]:r instanceof Ws||r instanceof Nn?mr(r.unwrap()):r instanceof Ln?mr(r._def.innerType):[],qa=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.object)return H(t,{code:I.invalid_type,expected:z.object,received:t.parsedType}),re;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}):(H(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}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=mr(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:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ce(n)})}};function ld(r,e){let t=Qt(r),n=Qt(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=ld(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=ld(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 Tn=class extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(Wa(s)||Wa(o))return re;let a=ld(s.value,o.value);return a.valid?((za(s)||za(o))&&t.dirty(),{status:t.value,value:a.data}):(H(n,{code:I.invalid_intersection_types}),re)};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}))}};Tn.create=(r,e,t)=>new Tn({left:r,right:e,typeName:ne.ZodIntersection,...ce(t)});var er=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return H(n,{code:I.invalid_type,expected:z.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return H(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(H(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 At(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Ke.mergeArray(t,o)):Ke.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};er.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:r,typeName:ne.ZodTuple,rest:null,...ce(e)})};var Za=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!==z.object)return H(n,{code:I.invalid_type,expected:z.object,received:n.parsedType}),re;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?Ke.mergeObjectAsync(t,i):Ke.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:ne.ZodRecord,...ce(n)}):new r({keyType:Vr.create(),valueType:e,typeName:ne.ZodRecord,...ce(t)})}},yi=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!==z.map)return H(n,{code:I.invalid_type,expected:z.map,received:n.parsedType}),re;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 re;(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 re;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};yi.create=(r,e,t)=>new yi({valueType:e,keyType:r,typeName:ne.ZodMap,...ce(t)});var bi=class r extends ue{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return H(n,{code:I.invalid_type,expected:z.set,received:n.parsedType}),re;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(H(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&&(H(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 re;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)}};bi.create=(r,e)=>new bi({valueType:r,minSize:null,maxSize:null,typeName:ne.ZodSet,...ce(e)});var Ga=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.function)return H(t,{code:I.invalid_type,expected:z.function,received:t.parsedType}),re;function n(a,l){return js({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hi(),gr].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function i(a,l){return js({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hi(),gr].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 jr){let a=this;return rt(async function(...l){let c=new ft([]),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 rt(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new ft([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new ft([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:er.create(e).rest(vr.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||er.create([]).rest(vr.create()),returns:t||vr.create(),typeName:ne.ZodFunction,...ce(n)})}},In=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})}};In.create=(r,e)=>new In({getter:r,typeName:ne.ZodLazy,...ce(e)});var $n=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return H(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};$n.create=(r,e)=>new $n({value:r,typeName:ne.ZodLiteral,...ce(e)});function hv(r,e){return new Mn({values:r,typeName:ne.ZodEnum,...ce(e)})}var Mn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return H(t,{expected:he.joinValues(n),received:t.parsedType,code:I.invalid_type}),re}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 H(t,{received:t.data,code:I.invalid_enum_value,options:n}),re}return rt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Mn.create=hv;var Pn=class extends ue{_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 H(n,{expected:he.joinValues(i),received:n.parsedType,code:I.invalid_type}),re}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=he.objectValues(t);return H(n,{received:n.data,code:I.invalid_enum_value,options:i}),re}return rt(e.data)}get enum(){return this._def.values}};Pn.create=(r,e)=>new Pn({values:r,typeName:ne.ZodNativeEnum,...ce(e)});var jr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==z.promise&&t.common.async===!1)return H(t,{code:I.invalid_type,expected:z.promise,received:t.parsedType}),re;let n=t.parsedType===z.promise?t.data:Promise.resolve(t.data);return rt(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};jr.create=(r,e)=>new jr({type:r,typeName:ne.ZodPromise,...ce(e)});var Rt=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.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=>{H(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 re;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?re:l.status==="dirty"?xn(l.value):t.value==="dirty"?xn(l.value):l});{if(t.value==="aborted")return re;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?xn(a.value):t.value==="dirty"?xn(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"?re:(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"?re:(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(!Br(o))return re;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=>Br(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):re);he.assertNever(i)}};Rt.create=(r,e,t)=>new Rt({schema:r,typeName:ne.ZodEffects,effect:e,...ce(t)});Rt.createWithPreprocess=(r,e,t)=>new Rt({schema:e,effect:{type:"preprocess",transform:r},typeName:ne.ZodEffects,...ce(t)});var Ct=class extends ue{_parse(e){return this._getType(e)===z.undefined?rt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(r,e)=>new Ct({innerType:r,typeName:ne.ZodOptional,...ce(e)});var tr=class extends ue{_parse(e){return this._getType(e)===z.null?rt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tr.create=(r,e)=>new tr({innerType:r,typeName:ne.ZodNullable,...ce(e)});var On=class extends ue{_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}};On.create=(r,e)=>new On({innerType:r,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var Ln=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 fi(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ft(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ft(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ln.create=(r,e)=>new Ln({innerType:r,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var _i=class extends ue{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return H(n,{code:I.invalid_type,expected:z.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};_i.create=r=>new _i({typeName:ne.ZodNaN,...ce(r)});var cS=Symbol("zod_brand"),Ws=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}},zs=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"?re:s.status==="dirty"?(t.dirty(),xn(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"?re: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:ne.ZodPipeline})}},Nn=class extends ue{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Br(i)&&(i.value=Object.freeze(i.value)),i);return fi(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Nn.create=(r,e)=>new Nn({innerType:r,typeName:ne.ZodReadonly,...ce(e)});function cv(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function fv(r,e={},t){return r?Ur.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=cv(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=cv(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Ur.create()}var uS={object:gt.lazycreate},ne;(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"})(ne||(ne={}));var dS=(r,e={message:`Input not instance of ${r.name}`})=>fv(t=>t instanceof r,e),gv=Vr.create,mv=wn.create,pS=_i.create,hS=Sn.create,vv=kn.create,fS=En.create,gS=mi.create,mS=Cn.create,vS=An.create,yS=Ur.create,bS=vr.create,_S=Ht.create,xS=vi.create,wS=yr.create,SS=gt.create,kS=gt.strictCreate,ES=Rn.create,CS=qa.create,AS=Tn.create,RS=er.create,TS=Za.create,IS=yi.create,$S=bi.create,MS=Ga.create,PS=In.create,OS=$n.create,LS=Mn.create,NS=Pn.create,FS=jr.create,DS=Rt.create,HS=Ct.create,BS=tr.create,VS=Rt.createWithPreprocess,US=zs.create,jS=()=>gv().optional(),WS=()=>mv().optional(),zS=()=>vv().optional(),qS={string:(r=>Vr.create({...r,coerce:!0})),number:(r=>wn.create({...r,coerce:!0})),boolean:(r=>kn.create({...r,coerce:!0})),bigint:(r=>Sn.create({...r,coerce:!0})),date:(r=>En.create({...r,coerce:!0}))};var ZS=re;var g$=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),m$={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.")},GS=["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"],KS=d.enum(GS).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),YS=["time_on_page","page_views","scroll_depth"],XS=d.enum(YS).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage."),JS=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"}'),QS=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."),ek=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"}`),tk=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}'),rk=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."),nk=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.'),ik=d.object({type:d.literal("session_metric"),key:XS,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}'),sk=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."),ok=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."),ak=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."),lk=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."),ck=d.object({events:d.array(KS).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),lk).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."),uk=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:ck.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"}}}}'),dk=d.discriminatedUnion("type",[JS,QS,ek,tk,rk,nk,ik,sk,ok,ak,uk]),pk=d.object({conditions:d.array(dk).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."),hk=d.object({type:d.literal("rules"),rules:d.array(pk).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."),fk=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."),gk=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."),mk=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."),vk=d.discriminatedUnion("type",[hk,fk,gk,mk]),v$=vk.nullable().optional(),y$=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),b$=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional(),yk='<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"',bk={"\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 yv(r,e={}){let t=bk[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${yk} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var bv=r=>{throw TypeError(r)},cd=(r,e,t)=>e.has(r)||bv("Cannot "+t),ud=(r,e,t)=>(cd(r,e,"read from private field"),t?t.call(r):e.get(r)),Ka=(r,e,t)=>e.has(r)?bv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),qs=(r,e,t,n)=>(cd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Ye=(r,e,t)=>(cd(r,e,"access private method"),t);function _k(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 xk(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var wk="#6a59ce",_v="#677384",xv="#87919f";function Sk(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kk(r){return yv(r)||Sk(r)}function wv(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 Ek(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 Ck(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var Zs,Gs,ze,dd,pd,kv,fd,Ev,Cv,Av,Ks,hd,Rv=class extends be{constructor(){super(...arguments),Ka(this,ze),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,Ka(this,Zs,null),Ka(this,Gs,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ye(this,ze,dd).call(this)}disconnectedCallback(){super.disconnectedCallback(),Ye(this,ze,pd).call(this)}updated(r){r.has("runtime")&&(Ye(this,ze,pd).call(this),Ye(this,ze,dd).call(this))}render(){let r=Ye(this,ze,kv).call(this),e=Ye(this,ze,fd).call(this),t=R({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),n=R({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),i=R({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"?xv:_v}),s=R({fontSize:"13px",padding:"16px",textAlign:"center",color:e==="dark"?_v:xv});if(r.length===0)return N`
|
|
303
303
|
<div
|
|
304
304
|
style=${t}
|
|
305
305
|
data-adaptive-id=${this.instanceId}
|
|
@@ -310,20 +310,20 @@ 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 N`
|
|
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])=>N`
|
|
321
|
+
${l?N`<div style=${i} data-category-header=${l}>${l}</div>`:Q}
|
|
322
|
+
${c.map((u,p)=>Ye(this,ze,hd).call(this,u,p,c.length))}
|
|
323
|
+
`):r.map((l,c)=>Ye(this,ze,hd).call(this,l,c,r.length))}
|
|
324
324
|
</div>
|
|
325
325
|
</div>
|
|
326
|
-
`}};Zs=new WeakMap;Gs=new WeakMap;
|
|
326
|
+
`}};Zs=new WeakMap;Gs=new WeakMap;ze=new WeakSet;dd=function(){this.runtime&&(qs(this,Zs,this.runtime.context.subscribe(()=>{this._renderTick+=1})),this.runtime.accumulator?.subscribe&&qs(this,Gs,this.runtime.accumulator.subscribe(()=>{this._renderTick+=1})))};pd=function(){var r,e;(r=ud(this,Zs))==null||r.call(this),qs(this,Zs,null),(e=ud(this,Gs))==null||e.call(this),qs(this,Gs,null)};kv=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};fd=function(){return Ck(this.config.theme)};Ev=function(r){let e=this._expandedIds.has(r),t;if(this.config.expandBehavior==="single"){for(let n of this._expandedIds)n!==r&&Ye(this,ze,Ks).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);Ye(this,ze,Ks).call(this,"nav:toggled",{tipId:r,expanded:!e}),this._expandedIds=t};Cv=function(r,e){let t=r.trim().toLowerCase();if(t.startsWith("javascript:")||t.startsWith("data:"))return;Ye(this,ze,Ks).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=_k({href:r,external:e,windowOrigin:typeof window<"u"?window.location.origin:"",isIframe:xk()});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,Tv(n.url.toString())||(window.history.pushState(null,"",n.url.toString()),window.dispatchEvent(new PopStateEvent("popstate")))};Av=function(r){let e=document.querySelector(r.selector);e instanceof HTMLElement&&(Ye(this,ze,Ks).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"}),Ek(e),setTimeout(()=>e.focus(),400))};Ks=function(r,e){this.runtime?.events.publish(r,{instanceId:this.instanceId,timestamp:Date.now(),...e})};hd=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=Ye(this,ze,fd).call(this),g=c?Array.isArray(c.route)?c.route[0]:c.route:o,m=c?wv(Array.isArray(c.route)?c.route:[c.route]):g?wv([g]):!1,y=c?.selector&&c.selector!=="*",x=m&&y,S=!!g||x,b=x?"Focus \u2192":l?"Go \u2197":"Go \u2192",w=R({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)"}}),C=R({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)"}),_=R({fontSize:"20px",transition:"transform 0.2s ease",marginLeft:"auto",flexShrink:"0",color:"var(--sc-content-chevron-color, currentColor)",transform:p?"rotate(90deg)":"rotate(0deg)"}),A=R({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({fontSize:"var(--sc-content-body-font-size, 14px)",lineHeight:"1.5",margin:"0"}),T=R({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, ${wk})`,color:"#ffffff"}),P=R({fontSize:"16px",flexShrink:"0"}),Y=F=>{F.preventDefault(),F.stopPropagation(),x&&c?Ye(this,ze,Av).call(this,c):g&&Ye(this,ze,Cv).call(this,g,l??!1)};return N`
|
|
327
327
|
<div
|
|
328
328
|
style=${w}
|
|
329
329
|
data-nav-tip-id=${n}
|
|
@@ -332,28 +332,28 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
332
332
|
type="button"
|
|
333
333
|
style=${C}
|
|
334
334
|
aria-expanded=${p}
|
|
335
|
-
@click=${()=>
|
|
335
|
+
@click=${()=>Ye(this,ze,Ev).call(this,n)}
|
|
336
336
|
@mouseenter=${()=>{this._hoveredId=n}}
|
|
337
337
|
@mouseleave=${()=>{this._hoveredId=null}}
|
|
338
338
|
>
|
|
339
|
-
${a?
|
|
339
|
+
${a?N`<span style=${P}>${Na(kk(a))}</span>`:Q}
|
|
340
340
|
<span>${i}</span>
|
|
341
341
|
<span style=${_}>${"\u203A"}</span>
|
|
342
342
|
</button>
|
|
343
343
|
<div style=${A} aria-hidden=${!p}>
|
|
344
344
|
<p style=${$}>${s}</p>
|
|
345
|
-
${
|
|
345
|
+
${S?N`
|
|
346
346
|
<a
|
|
347
347
|
href=${g||"#"}
|
|
348
348
|
style=${T}
|
|
349
349
|
target=${l?"_blank":Q}
|
|
350
350
|
rel=${l?"noopener noreferrer":Q}
|
|
351
|
-
@click=${
|
|
351
|
+
@click=${Y}
|
|
352
352
|
>${b}</a>
|
|
353
353
|
`:Q}
|
|
354
354
|
</div>
|
|
355
355
|
</div>
|
|
356
|
-
`};pv.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var av="syntro-nav-tips";function nS(){typeof window>"u"||customElements.get(av)||customElements.define(av,pv)}var iS=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 hv(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 sS(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var oS=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&&sS(t)?hv(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},aS={mount(r,e){nS();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()}},lS=[{kind:"navigation:scrollTo",executor:iS},{kind:"navigation:navigate",executor:oS}],fv={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:lS,widgets:[{id:"adaptive-nav:tips",component:aS,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 cS=[pu,Wm,fv,Ou],uS=cS.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 gv(r){let e=0;for(let t of uS)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var Fn=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 za=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 ad=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},xi=class extends za{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 Fn(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 ad(this.context,this.host))}};var hS='<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"',mv={"\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 Ys(r,e={}){let t=mv[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${hS} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var fS=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),He={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.")},vv=["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"],yv=d.enum(vv).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),bv=["time_on_page","page_views","scroll_depth"],_v=d.enum(bv).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var qa=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"}'),Za=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."),Ga=d.object({type:d.literal("anchor_visible"),anchorId:d.string().describe("CSS selector of the anchor element"),state:d.enum(["visible","present","absent"]).describe('"visible" = in viewport, "present" = in DOM, "absent" = not in DOM')}).describe(`Fires based on a DOM element's visibility state. Example: {"type": "anchor_visible", "anchorId": "#cta-button", "state": "visible"}`),Ka=d.object({type:d.literal("event_occurred"),eventName:d.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:d.number().optional().describe("Time window in ms. Omit = any time this session.")}).describe('Fires when a specific event has occurred during this session. Example: {"type": "event_occurred", "eventName": "ui.click", "withinMs": 5000}'),Ya=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."),Xa=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.'),Ja=d.object({type:d.literal("session_metric"),key:_v,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}'),Qa=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."),el=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."),tl=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."),wi=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."),ki=d.object({events:d.array(yv).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),wi).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."),rl=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:ki.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"}}}}'),br=d.discriminatedUnion("type",[qa,Za,Ga,Ka,Ya,Xa,Ja,Qa,el,tl,rl]),Si=d.object({conditions:d.array(br).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."),Ei=d.object({type:d.literal("rules"),rules:d.array(Si).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."),Ci=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."),Ai=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."),Ri=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."),Ti=d.discriminatedUnion("type",[Ei,Ci,Ai,Ri]),Xs=Ti.nullable().optional();var gS=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),mS=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function vS(r,e,t="currentColor"){let n=Ys(r,{size:e,color:t});if(!n)return L`<span style=${R({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,L`${i}`}var yS=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],nl=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=>{yS.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 Q;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 L`
|
|
356
|
+
`};Rv.properties={config:{attribute:!1},runtime:{attribute:!1},instanceId:{type:String},_expandedIds:{state:!0},_renderTick:{state:!0},_hoveredId:{state:!0}};var Sv="syntro-nav-tips";function Ak(){typeof window>"u"||customElements.get(Sv)||customElements.define(Sv,Rv)}var Rk=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 Tv(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 Tk(r){try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return!1}}var Ik=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&&Tk(t)?Tv(t)||(window.history.pushState(null,"",t),window.dispatchEvent(new PopStateEvent("popstate"))):window.location.href=t,{cleanup:()=>{}}},$k={mount(r,e){Ak();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()}},Mk=[{kind:"navigation:scrollTo",executor:Rk},{kind:"navigation:navigate",executor:Ik}],Iv={id:"adaptive-nav",version:"2.0.0",name:"Navigation Tips",description:"Navigation actions and accordion-based tips with per-item conditional visibility",executors:Mk,widgets:[{id:"adaptive-nav:tips",component:$k,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 Pk=[_u,ov,Iv,Vu],Ok=Pk.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 $v(r){let e=0;for(let t of Ok)r.has(t.id)||(r.register(t),e++);console.log("[Syntro Runtime] Registered",e,"built-in runtime modules")}var Fn=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 Ya=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 gd=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},xi=class extends Ya{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 Fn(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 gd(this.context,this.host))}};var Fk='<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"',Mv={"\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 Ys(r,e={}){let t=Mv[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${Fk} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var Dk=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Be={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.")},Pv=["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"],Ov=d.enum(Pv).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Lv=["time_on_page","page_views","scroll_depth"],Nv=d.enum(Lv).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var Xa=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"}'),Ja=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."),Qa=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"}`),el=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}'),tl=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."),rl=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.'),nl=d.object({type:d.literal("session_metric"),key:Nv,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}'),il=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."),sl=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."),ol=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."),wi=d.object({equals:d.union([d.string(),d.number(),d.boolean()]).optional(),contains:d.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),Si=d.object({events:d.array(Ov).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),wi).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."),al=d.object({type:d.literal("event_count"),key:d.string().describe("Unique key for this counter (used for accumulator registration)"),operator:d.enum(["gte","lte","eq","gt","lt"]),count:d.number().int().min(0).describe("Target count threshold"),withinMs:d.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:Si.optional().describe("Inline counter definition. Defines what events to count.")}).describe('Fires when accumulated event count crosses a threshold. Most powerful trigger type. Example: {"type": "event_count", "key": "pricing-clicks", "operator": "gte", "count": 3, "counter": {"events": ["ui.click"], "match": {"attr__data-cta": {"contains": "pricing"}}}}'),br=d.discriminatedUnion("type",[Xa,Ja,Qa,el,tl,rl,nl,il,sl,ol,al]),ki=d.object({conditions:d.array(br).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."),Ei=d.object({type:d.literal("rules"),rules:d.array(ki).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."),Ci=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."),Ai=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."),Ri=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."),Ti=d.discriminatedUnion("type",[Ei,Ci,Ai,Ri]),Xs=Ti.nullable().optional();var Hk=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),Bk=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function Vk(r,e,t="currentColor"){let n=Ys(r,{size:e,color:t});if(!n)return N`<span style=${R({fontSize:`${e}px`,lineHeight:"1"})}>${r}</span>`;let i=document.createElement("span");return i.style.display="flex",i.innerHTML=n,N`${i}`}var Uk=[":toggled",":clicked",":feedback",":navigate",":expanded",":collapsed",":dismissed",":submitted",":interacted",":tip_clicked",":tip_focused"],ll=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=>{Uk.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 Q;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`
|
|
357
357
|
<article
|
|
358
358
|
data-shadow-canvas-id=${`tile-${this.config.id}`}
|
|
359
359
|
style=${R(u)}
|
|
@@ -363,28 +363,28 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
363
363
|
<!-- Header -->
|
|
364
364
|
<div style=${R(p)}>
|
|
365
365
|
<div style=${R(h)}>
|
|
366
|
-
${
|
|
366
|
+
${Vk(s,o)}
|
|
367
367
|
</div>
|
|
368
368
|
<div style=${R({flex:"1",minWidth:"0"})}>
|
|
369
369
|
<h3 style=${R(f)}>
|
|
370
370
|
${t??n}
|
|
371
371
|
</h3>
|
|
372
|
-
${i?
|
|
372
|
+
${i?N`<p style=${R(v)}>${i}</p>`:Q}
|
|
373
373
|
</div>
|
|
374
374
|
</div>
|
|
375
375
|
|
|
376
376
|
<!-- Widget Content -->
|
|
377
377
|
<div style=${R(g)}>
|
|
378
378
|
<div style=${R(m)}>
|
|
379
|
-
${l?
|
|
379
|
+
${l?N`<div data-widget-mount-parent></div>`:N`<div style=${R(y)}>
|
|
380
380
|
Widget not available: ${n}
|
|
381
381
|
</div>`}
|
|
382
382
|
</div>
|
|
383
383
|
</div>
|
|
384
384
|
</article>
|
|
385
|
-
`}};
|
|
385
|
+
`}};ll.properties={config:{attribute:!1},surface:{type:String},runtimeRef:{attribute:!1},_hovered:{state:!0}};customElements.define("syntro-tile-card",ll);var cl=class extends be{constructor(){super(...arguments);this.tiles=[];this.runtimeRef=null;this.surface="overlay"}createRenderRoot(){return this}render(){return N`
|
|
386
386
|
<div data-syntro-tile-stack style=${R({display:"flex",flexDirection:"column",gap:"0.75rem",width:"100%"})}>
|
|
387
|
-
${this.tiles.map(n=>
|
|
387
|
+
${this.tiles.map(n=>N`
|
|
388
388
|
<syntro-tile-card
|
|
389
389
|
.config=${n}
|
|
390
390
|
.surface=${this.surface}
|
|
@@ -392,9 +392,9 @@ 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
|
-
`}};
|
|
395
|
+
`}};cl.properties={tiles:{attribute:!1},runtimeRef:{attribute:!1},surface:{type:String}};customElements.define("syntro-tile-stack",cl);var md={peek:30,mid:70,full:95},jk=.5,vd=8,Fv=100,Dv=8,ul=class extends be{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??md.peek,mid:t.mid??md.mid,full:t.full??md.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-Fv,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))>jk)return s?n<t.peek-vd?null:this._dragStartSnap==="full"?"mid":this._dragStartSnap==="mid"?"peek":null:this._dragStartSnap==="peek"?"mid":(this._dragStartSnap==="mid","full");if(this.dragOffsetVh>Dv)return n<t.peek-vd?null:this._dragStartSnap==="full"?"mid":this._dragStartSnap==="mid"?"peek":null;if(this.dragOffsetVh<-Dv)return this._dragStartSnap==="peek"?"mid":(this._dragStartSnap==="mid","full");if(n<t.peek-vd&&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-Fv*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 Q;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 N`
|
|
396
396
|
<div data-syntro-bottom-sheet="root" style=${R(a)}>
|
|
397
|
-
${o?
|
|
397
|
+
${o?N`<div
|
|
398
398
|
data-syntro-bottom-sheet="scrim"
|
|
399
399
|
style=${R({position:"fixed",inset:"0",background:this._backdropColor,pointerEvents:"auto",transition:`opacity ${t} ease-out`,zIndex:String(s)})}
|
|
400
400
|
@click=${this._onScrimClick}
|
|
@@ -414,7 +414,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
414
414
|
<div data-syntro-bottom-sheet="grabber" style=${R(u)}></div>
|
|
415
415
|
</div>
|
|
416
416
|
|
|
417
|
-
${this.canvasTitle?
|
|
417
|
+
${this.canvasTitle?N`<header style=${R({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>`:Q}
|
|
418
418
|
|
|
419
419
|
<div
|
|
420
420
|
data-syntro-bottom-sheet="scroll-area"
|
|
@@ -424,10 +424,10 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
424
424
|
@pointerup=${f=>this._onPointerUp(f)}
|
|
425
425
|
@pointercancel=${f=>this._onPointerUp(f)}
|
|
426
426
|
>
|
|
427
|
-
${this.isLoading?
|
|
427
|
+
${this.isLoading?N`<div data-syntro-bottom-sheet="loading">Loading...</div>`:this.error?N`<div
|
|
428
428
|
data-syntro-bottom-sheet="error"
|
|
429
429
|
style=${R({color:"var(--sc-notification-error-color)"})}
|
|
430
|
-
>Failed to load: ${this.error}</div>`:
|
|
430
|
+
>Failed to load: ${this.error}</div>`:N`<syntro-tile-stack
|
|
431
431
|
.tiles=${this.tiles}
|
|
432
432
|
.surface=${"overlay"}
|
|
433
433
|
.runtimeRef=${this.runtimeRef}
|
|
@@ -435,9 +435,9 @@ 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
|
-
`}};sl.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",sl);var $e="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"},st={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},Js={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},ud={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var ol=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===st.MouseInteraction){let n=e.data.id??0;if(e.data.type===Js.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===Js.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:$e,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===st.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var al=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!==st.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:$e,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var ll=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!==st.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?kv(t):null,i=this.currentElement?kv(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Re.UI_HOVER,source:"rrweb",schemaVersion:$e,props:{x:this.lastX,y:this.lastY,duration_ms:e-this.hoverStartTs,element:this.currentElement}}),this.currentElement=t,this.hoverStartTs=e)}};function kv(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===st.MouseMove||t===st.MouseInteraction||t===st.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:$e,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var ul=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==st.MouseInteraction||e.data.type!==Js.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:$e,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var dl=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!==st.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:$e,props:{reversals:this.reversals.length,duration_ms:n-this.reversals[0]}}),this.reversals=[])}this.lastDirection=i}this.lastY=t}};var Sv={$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 _S(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(Sv[e])return Sv[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 Ev=new Set(["a","button","input","select","textarea"]);function xS(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 wS(r,e){if(e&&Ev.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&Ev.has(n))return n}return e}function kS(r,e){return r.map((t,n)=>{let i=e[n];return!i||t.tag_name!==i.tag_name?t:{...i,...t}})}function SS(r,e){let t={},n=r.properties||{},i=n.$elements??(typeof n.$elements_chain=="string"?xS(n.$elements_chain):void 0),s=i&&e?kS(i,e):i,o=n.$tag_name??s?.[0]?.tag_name,a=r.event==="$autocapture"||r.event==="$click";return t.tagName=a?wS(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 Ii(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:_S(r),source:"posthog",props:SS(r,e),schemaVersion:$e}}function $i(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 dd(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if($i(n)){let i=Ii(n);r(i)}}}function pd(r){let e={...ud,...r?.config},t=[];function n(v){for(let g of t)g(v)}let i=new al(e,n),s=new ul(e,n),o=new dl(e,n),a=new ol(e,n),l=new cl(e,n),c=new ll(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($i(m)){let y=h(m)?f(typeof m.timestamp=="number"?m.timestamp:Date.now()):void 0;n(Ii(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 Qs=3;var pl=3e4;var CS=0;function hd(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function AS(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function Cv(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!AS(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++CS}-${s}`,title:hd(i.title,r.props),body:i.body?hd(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?hd(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Mi=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=Cv(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 Bt(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:$e}}function RS(r,e){return Bt(ze.CANVAS_OPENED,{surface:r,...e})}function TS(r,e){return Bt(ze.CANVAS_CLOSED,{surface:r,...e})}function IS(r,e){return Bt(ze.TILE_VIEWED,{tileId:r,surface:e})}function $S(r,e){return Bt(ze.TILE_EXPANDED,{tileId:r,surface:e})}function MS(r,e){return Bt(ze.TILE_COLLAPSED,{tileId:r,surface:e})}function OS(r,e,t){return Bt(ze.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function PS(r,e){return Bt(ze.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function NS(r,e){return Bt(ze.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function LS(r,e,t){return Bt(ze.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function FS(r,e,t){return Bt(ze.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function DS(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return Bt(t,e)}var Oi={canvasOpened:RS,canvasClosed:TS,tileViewed:IS,tileExpanded:$S,tileCollapsed:MS,tileAction:OS,overlayStarted:PS,overlayCompleted:NS,overlayDismissed:LS,overlayStepViewed:FS,custom:DS};function HS(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 hl=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 Mi(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=HS(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=Oi.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?Oi.canvasOpened("overlay",n):Oi.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 L`
|
|
438
|
+
`}};ul.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",ul);var Pe="1.0.0",Ie={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"},at={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,Drag:12},Js={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},yd={hesitationMs:3e3,hesitationRadiusPx:10,rageClickCount:3,rageClickWindowMs:1e3,rageClickRadiusPx:30,scrollThrashReversals:3,scrollThrashWindowMs:2e3,focusBounceMaxInputs:0,idleMs:5e3,hoverSampleMs:100};var dl=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===at.MouseInteraction){let n=e.data.id??0;if(e.data.type===Js.Focus)this.focused.set(n,{id:n,focusTs:t,inputCount:0});else if(e.data.type===Js.Blur){let i=this.focused.get(n);i&&i.inputCount<=this.config.focusBounceMaxInputs&&this.emit({ts:t,name:Ie.UI_FOCUS_BOUNCE,source:"rrweb",schemaVersion:Pe,props:{elementId:n,duration_ms:t-i.focusTs}}),this.focused.delete(n)}}else if(e.data.source===at.Input){let n=e.data.id??0,i=this.focused.get(n);i&&i.inputCount++}}};var pl=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!==at.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:Ie.UI_HESITATE,source:"rrweb",schemaVersion:Pe,props:{x:this.anchorX,y:this.anchorY,duration_ms:t}}),this.emitted=!0)}};var hl=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!==at.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?Hv(t):null,i=this.currentElement?Hv(this.currentElement):null;n!==i&&(this.currentElement&&this.hoverStartTs!==null&&this.emit({ts:e,name:Ie.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 Hv(r){return`${r.tag_name??""}|${r.attr__id??""}|${(r.classes??[]).join(",")}`}var fl=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===at.MouseMove||t===at.MouseInteraction||t===at.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:Ie.UI_IDLE,source:"rrweb",schemaVersion:Pe,props:{idle_ms:e-this.lastActivityTs}}),this.emitted=!0)}};var gl=class{constructor(e,t){this.config=e,this.emit=t,this.clicks=[]}ingest(e){if(e.type!==3||e.data.source!==at.MouseInteraction||e.data.type!==Js.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:Ie.UI_RAGE_CLICK,source:"rrweb",schemaVersion:Pe,props:{x:t,y:n,clickCount:o.length,duration_ms:i-o[0].ts}}),this.clicks=[])}};var ml=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!==at.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:Ie.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 Bv={$click:Ie.UI_CLICK,$scroll:Ie.UI_SCROLL,$input:Ie.UI_INPUT,$change:Ie.UI_CHANGE,$submit:Ie.UI_SUBMIT,$pageview:Ie.NAV_PAGE_VIEW,$pageleave:Ie.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function Wk(r){let e=r.event;if(typeof e!="string")return"posthog.unknown";if(Bv[e])return Bv[e];if(e==="$autocapture"){let t=r.properties?.$tag_name,n=r.properties?.$event_type;return n==="submit"?Ie.UI_SUBMIT:n==="change"?Ie.UI_CHANGE:t==="input"||t==="textarea"?Ie.UI_INPUT:Ie.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}var Vv=new Set(["a","button","input","select","textarea"]);function zk(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 qk(r,e){if(e&&Vv.has(e)||!r)return e;for(let t of r){let n=t.tag_name;if(n&&Vv.has(n))return n}return e}function Zk(r,e){return r.map((t,n)=>{let i=e[n];return!i||t.tag_name!==i.tag_name?t:{...i,...t}})}function Gk(r,e){let t={},n=r.properties||{},i=n.$elements??(typeof n.$elements_chain=="string"?zk(n.$elements_chain):void 0),s=i&&e?Zk(i,e):i,o=n.$tag_name??s?.[0]?.tag_name,a=r.event==="$autocapture"||r.event==="$click";return t.tagName=a?qk(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 Ii(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:Wk(r),source:"posthog",props:Gk(r,e),schemaVersion:Pe}}function $i(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 bd(r){return(e,t)=>{if(typeof e!="string")return;let n={event:e,properties:t,timestamp:Date.now()};if($i(n)){let i=Ii(n);r(i)}}}function _d(r){let e={...yd,...r?.config},t=[];function n(v){for(let g of t)g(v)}let i=new pl(e,n),s=new gl(e,n),o=new ml(e,n),a=new dl(e,n),l=new fl(e,n),c=new hl(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($i(m)){let y=h(m)?f(typeof m.timestamp=="number"?m.timestamp:Date.now()):void 0;n(Ii(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 qe={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 Qs=3;var vl=3e4;var Yk=0;function xd(r,e){return r.replace(/\{\{props\.(\w+)\}\}/g,(t,n)=>!e||!(n in e)?t:String(e[n]))}function Xk(r,e){if(r===e)return!0;try{return new RegExp(e).test(r)}catch{return!1}}function Uv(r,e){for(let t of e){let n=t.notifications;if(!(!n||n.length===0))for(let i of n){if(!Xk(r.name,i.on))continue;let s=Date.now(),o=i.ttl??8e3;return{notification:{id:`notif-${++Yk}-${s}`,title:xd(i.title,r.props),body:i.body?xd(i.body,r.props):void 0,icon:i.icon,tileId:t.id,itemId:i.deepLink?.itemId?xd(i.deepLink.itemId,r.props):void 0,expiresAt:s+o,createdAt:s,ttl:o},rule:i}}}return null}var Mi=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=Uv(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(qe.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(qe.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 Bt(r,e){return{ts:Date.now(),name:r,source:"canvas",props:e,schemaVersion:Pe}}function Jk(r,e){return Bt(qe.CANVAS_OPENED,{surface:r,...e})}function Qk(r,e){return Bt(qe.CANVAS_CLOSED,{surface:r,...e})}function eE(r,e){return Bt(qe.TILE_VIEWED,{tileId:r,surface:e})}function tE(r,e){return Bt(qe.TILE_EXPANDED,{tileId:r,surface:e})}function rE(r,e){return Bt(qe.TILE_COLLAPSED,{tileId:r,surface:e})}function nE(r,e,t){return Bt(qe.TILE_ACTION,{tileId:r,actionId:e,surface:t})}function iE(r,e){return Bt(qe.OVERLAY_STARTED,{recipeId:r,recipeName:e})}function sE(r,e){return Bt(qe.OVERLAY_COMPLETED,{recipeId:r,recipeName:e})}function oE(r,e,t){return Bt(qe.OVERLAY_DISMISSED,{recipeId:r,recipeName:e,stepIndex:t})}function aE(r,e,t){return Bt(qe.OVERLAY_STEP_VIEWED,{recipeId:r,stepIndex:e,stepTitle:t})}function lE(r,e){let t=r.startsWith("canvas.")?r:`canvas.${r}`;return Bt(t,e)}var Pi={canvasOpened:Jk,canvasClosed:Qk,tileViewed:eE,tileExpanded:tE,tileCollapsed:rE,tileAction:nE,overlayStarted:iE,overlayCompleted:sE,overlayDismissed:oE,overlayStepViewed:aE,custom:lE};function cE(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 yl=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 Mi(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=cE(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=Pi.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?Pi.canvasOpened("overlay",n):Pi.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(qe.NOTIFICATION_CLICKED,{notificationId:n.id,tileId:n.tileId,itemId:n.itemId}),this.isOpen||this._toggle(),this.runtimeRef&&n.tileId&&this.runtimeRef.events.publish(qe.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`
|
|
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?N`<syntro-toast-stack
|
|
441
441
|
data-testid="notification-toast-stack"
|
|
442
442
|
.notifications=${t}
|
|
443
443
|
.position=${n}
|
|
@@ -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?N`<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>`:N`<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
|
-
`}};
|
|
480
|
+
`}};yl.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",yl);var bl=class extends be{constructor(){super(...arguments);this.tiles=[];this.isLoading=!1;this.error=void 0;this.runtimeRef=null}createRenderRoot(){return this}render(){return N`
|
|
481
481
|
<div data-syntro-inline-shell="container" style=${R({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?
|
|
482
|
+
${this.isLoading?N`<div data-syntro-inline-shell="loading">Loading...</div>`:this.error?N`<div
|
|
483
483
|
data-syntro-inline-shell="error"
|
|
484
484
|
style=${R({color:"var(--sc-notification-error-color)"})}
|
|
485
|
-
>Failed to load: ${this.error}</div>`:this.tiles.length>0?
|
|
485
|
+
>Failed to load: ${this.error}</div>`:this.tiles.length>0?N`<syntro-tile-stack
|
|
486
486
|
.tiles=${this.tiles}
|
|
487
487
|
.surface=${"inline"}
|
|
488
488
|
.runtimeRef=${this.runtimeRef}
|
|
489
489
|
></syntro-tile-stack>`:Q}
|
|
490
490
|
</div>
|
|
491
|
-
`}};fl.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",fl);function gl(r,e,t="merge"){return t==="first-match"?BS(r,e):VS(r,e)}function BS(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 Av([i])}return null}function VS(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:Av(t)}function Av(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 Rv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function gd(r){if(Rv()){fd=!0;return}fd=r??!1}function jS(){return Rv()?!0:fd}function G(r,e,t){jS()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function ot(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function ml(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var vl="2.8.0-canary.183";var _r="2.0";var US=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function WS(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):US.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 zS(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var Tv="syntro_config_cache",qS=1440*60*1e3;function Iv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function ZS(r,e){if(Iv())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(Tv,JSON.stringify(t))}catch{}}function GS(r){if(!Iv())return null;try{let e=localStorage.getItem(Tv);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>qS?null:t.config}catch{return null}}var yl=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function KS(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 Dn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return G("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=KS(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",u.length,"keys found"),u.length>0){let p=gl(e,u);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",p?`tiles=${p.tiles?.length}`:"null"),p)return G("SmartCanvas Config","Resolved config from variant flags",p),p}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=yl({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(!WS(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(zS(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":vl,"X-SDK-Schema-Version":_r}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return G("SmartCanvas Config","Fetched config from URI",p),a&&ZS(p,a),p}catch(u){if(a){let p=GS(a);if(p)return G("SmartCanvas Config","Serving config from offline cache"),p}throw u}};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)}},md=r=>new bl(r);var Vt={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"},S={0:"#07080a",1:"#0f1318",2:"#0e1114",3:"#1c222a",4:"#2b333f",5:"#394454",6:"#475569",7:"#677384",8:"#87919f",9:"#a8afba",10:"#cbd0d7",11:"#e8eaee",12:"#f6f7f9"},Se={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Ke={0:"#301f09",1:"#5f3e12",2:"#8f5e1b",3:"#be7d24",4:"#ee9c2d",5:"#f1b057",6:"#f5c481",7:"#f8d7ab",8:"#fcebd5",9:"#fdf5ea"},Me={0:"#330707",1:"#660f0e",2:"#991616",3:"#cc1e1d",4:"#ff2524",5:"#ff5150",6:"#ff7c7c",7:"#ffa8a7",8:"#ffd3d3",9:"#ffe9e9"},rr={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},eo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},to={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},ro={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var vt={primary:S[10],secondary:S[9],tertiary:S[8]},YM={primary:S[2],secondary:S[0]},vd={primary:S[4],secondary:S[3]},_l={primary:{text:Vt.white,icon:Vt.white,border:se[3],backgroundDefault:se[3],backgroundHover:se[2]},neutral:{text:S[10],textHover:Vt.white,icon:S[10],iconHover:Vt.white,border:S[4],background:S[2]},link:{text:Vt.white,icon:Vt.white,hover:se[5]},error:{text:Me[5],hover:Me[6]},success:{text:Se[5],hover:Se[6]}},XM={slateGrey:{content:S[10],pillOutline:S[10],borderPrimary:S[5],borderSecondary:S[5],background:S[3]},brand:{content:se[9],pillOutline:se[9],borderPrimary:se[6],borderSecondary:se[6],background:se[0]},red:{content:Me[8],pillOutline:Me[4],borderPrimary:Me[2],borderSecondary:Me[2],background:Me[0]},yellow:{content:Ke[8],pillOutline:Ke[4],borderPrimary:Ke[2],borderSecondary:Ke[2],background:Ke[0]},green:{content:Se[8],pillOutline:Se[4],borderPrimary:Se[2],borderSecondary:Se[2],background:Se[0]},purple:{content:to[8],pillOutline:to[4],borderPrimary:to[2],borderSecondary:to[2],background:to[0]},blue:{content:rr[8],pillOutline:rr[4],borderPrimary:rr[2],borderSecondary:rr[2],background:rr[0]},orange:{content:eo[8],pillOutline:eo[4],borderPrimary:eo[2],borderSecondary:eo[2],background:eo[0]},pink:{content:ro[8],pillOutline:ro[4],borderPrimary:ro[2],borderSecondary:ro[2],background:ro[0]}},JM={green:{content:Se[8],border:Se[2],background:Se[0]},yellow:{content:Ke[8],border:Ke[2],background:Ke[0]},red:{content:Me[8],border:Me[2],background:Me[0]}},QM={green:{content:Se[1],background:Se[9]},yellow:{content:Ke[1],background:Ke[9]},red:{content:Me[1],background:Me[9]}},eO={content:S[10],border:S[4],background:S[3]},tO={backgroundDefault:S[2],backgroundHover:S[1],selected:S[3]},rO={background:S[2],icon:S[10],borderDefault:S[4],borderSelected:se[3],textLabel:S[9],textPlaceholder:S[8],textHint:S[8]},nO={backgroundDefault:S[2],backgroundDisabled:S[0],textLabel:S[9],textPlaceholder:S[8],textHint:S[8],textError:Me[5],iconDefault:S[9],iconPlaceholder:S[10],iconError:Me[5],borderDefault:S[4],borderSelected:se[3],borderError:Me[5]},iO={handleDefault:Vt.white,handleDisabled:S[10],off:{backgroundDefault:S[4],backgroundHover:S[5],backgroundDisabled:S[4]},on:{backgroundDefault:Se[3],backgroundHover:Se[2],backgroundDisabled:S[4]}},sO={off:{backgroundDefault:"#00000000",backgroundHover:S[5],backgroundDisabled:S[2],border:S[6]},on:{backgroundDefault:Se[0],backgroundHover:Se[1],backgroundDisabled:S[2],border:Se[3]}},oO={content:S[10],background:S[4]},aO={background:S[4],active:Se[3]},lO={background:S[1],content:S[9],border:S[4]},cO={backgroundDefault:S[1],backgroundHover:S[3],backgroundActive:S[4],border:S[4],contentPrimary:S[10],contentSecondary:S[9],contentTertiary:S[8]},uO={background:S[1],content:S[9],border:S[4]},dO={activeBackground:S[3],activeContent:se[5],inactiveContent:S[9],border:S[4]},pO={header:{textDefault:S[9],textHover:S[8],backgroundDefault:S[1]},border:S[4],cell:{textPrimary:S[10],textSecondary:S[9],backgroundDefault:S[2],backgroundHover:S[1]}},hO={textPrimaryDefault:S[10],textPrimaryHover:S[10],textSecondaryDefault:S[8],textSecondaryHover:S[9],iconPrimary:S[10],iconSecondary:S[8]},fO={background:Se[1],active:Se[5]},gO={textDefault:S[10],textSelected:Vt.white,textDisabled:S[7],backgroundDefault:S[2],backgroundMiddle:S[3],backgroundSelected:se[3],border:S[4]},mO=S[9];var _O={size:56,inset:12,background:Vt.black,color:Vt.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 OO={colorPrimary:se[3],colorPrimaryHover:se[4],colorPrimaryMuted:se[0],colorBackground:ae(S[1],.95),colorBackgroundElevated:ae(S[3],.95),colorBackgroundSubtle:ae(S[0],.2),colorSurface:ae(S[4],.8),colorSurfaceHover:ae(S[5],.8),colorText:vt.primary,colorTextSecondary:vt.secondary,colorTextMuted:vt.tertiary,colorTextInverse:S[1],colorBorder:vd.primary,colorBorderSubtle:vd.secondary,colorSuccess:Se[4],colorSuccessMuted:Se[0],colorWarning:Ke[4],colorWarningMuted:Ke[0],colorError:Me[4],colorErrorMuted:Me[0],colorInfo:rr[4],colorInfoMuted:rr[0],colorNotification:se[4],colorNotificationMuted:ae(se[4],.4),glassBackground:ae(S[1],.6),glassBackgroundHover:ae(S[1],.7),glassBorder:"rgba(255, 255, 255, 0.08)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.2)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.3)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.4)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.5)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"},PO={colorPrimary:se[3],colorPrimaryHover:se[2],colorPrimaryMuted:ae(se[5],.1),colorBackground:ae(S[12],.95),colorBackgroundElevated:ae(S[11],.95),colorBackgroundSubtle:ae(S[0],.02),colorSurface:ae(S[11],.6),colorSurfaceHover:ae(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:ae(S[0],.12),colorBorderSubtle:ae(S[0],.06),colorSuccess:Se[4],colorSuccessMuted:ae(Se[4],.12),colorWarning:Ke[4],colorWarningMuted:ae(Ke[4],.12),colorError:Me[4],colorErrorMuted:ae(Me[4],.12),colorInfo:rr[4],colorInfoMuted:ae(rr[4],.12),colorNotification:se[3],colorNotificationMuted:ae(se[3],.4),glassBackground:ae(S[12],.7),glassBackgroundHover:ae(S[12],.8),glassBorder:"rgba(0, 0, 0, 0.06)",glassBlur:"blur(24px)",glassSaturate:"saturate(1.2)",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",fontFamilyMono:"'SF Mono', 'Fira Code', Consolas, monospace",fontSizeXs:"0.7rem",fontSizeSm:"0.8rem",fontSizeMd:"0.9rem",fontSizeLg:"1rem",fontSizeXl:"1.25rem",fontSizeXxl:"1.5rem",fontWeightNormal:"400",fontWeightMedium:"500",fontWeightSemibold:"600",fontWeightBold:"700",lineHeightTight:"1.25",lineHeightNormal:"1.5",lineHeightRelaxed:"1.75",spacingXs:"0.25rem",spacingSm:"0.5rem",spacingMd:"0.75rem",spacingLg:"1rem",spacingXl:"1.5rem",borderRadiusSm:"6px",borderRadiusMd:"10px",borderRadiusLg:"14px",borderRadiusXl:"20px",borderRadiusFull:"9999px",shadowSm:"0 1px 2px rgba(0, 0, 0, 0.08)",shadowMd:"0 2px 12px rgba(0, 0, 0, 0.12)",shadowLg:"0 8px 24px rgba(0, 0, 0, 0.16)",shadowXl:"0 16px 48px rgba(0, 0, 0, 0.2)",backdropBlur:"blur(20px)",backdropSaturate:"saturate(180%)",transitionFast:"0.1s ease",transitionNormal:"0.25s ease",transitionSlow:"0.4s ease"};function YS(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var $v={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(S[1],.6),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",padding:"0"},launcher:{background:_l.primary.backgroundDefault,backgroundHover:_l.primary.backgroundHover,color:_l.primary.icon,size:"56px",shadow:`0 8px 32px ${ae(S[0],.6)}`,borderRadius:"9999px"},tile:{background:ae(S[1],.6),backgroundHover:ae(S[1],.7),border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.3)",titleColor:vt.primary,textColor:vt.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(S[1],.6),textColor:vt.primary,titleColor:vt.primary,arrowColor:ae(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(S[0],.95),textColor:vt.primary,textSecondaryColor:vt.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:Se[4],warningColor:Ke[4],errorColor:Me[4],iconBackground:ae(se[3],.15),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[4]})`},content:{background:ae(S[3],.8),backgroundHover:ae(S[5],.6),border:`1px solid ${ae(S[5],.5)}`,borderRadius:"8px",textColor:vt.primary,textSecondaryColor:vt.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(S[3],.8),searchColor:vt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},Mv={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(S[12],.7),blur:"blur(24px)",border:"none",width:"clamp(380px, 25vw, 520px)",transitionDuration:"300ms",transitionEasing:"cubic-bezier(0.16, 1, 0.3, 1)",transitionFade:"6%",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(S[12],.7),backgroundHover:ae(S[12],.8),border:"1px solid rgba(0, 0, 0, 0.06)",borderRadius:"14px",shadow:"0 2px 12px rgba(0, 0, 0, 0.12)",titleColor:S[1],textColor:S[6],iconBackground:`linear-gradient(135deg, ${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(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:ae(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${se[3]}`},notification:{background:ae(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${ae(S[0],.12)}`,borderRadius:"12px",successColor:Se[4],warningColor:Ke[4],errorColor:Me[4],iconBackground:ae(se[3],.1),progressGradient:`linear-gradient(90deg, ${se[3]}, ${se[2]})`},content:{background:ae(S[12],.8),backgroundHover:ae(S[11],.6),border:`1px solid ${S[11]}`,borderRadius:"8px",textColor:S[1],textSecondaryColor:S[6],itemDivider:"none",itemGap:"6px",itemPadding:"12px 16px",itemFontSize:"15px",bodyPadding:"0 16px 12px 16px",bodyFontSize:"14px",categoryPadding:"8px 4px 4px 4px",categoryGap:"4px",categoryFontSize:"12px",searchBackground:S[12],searchColor:S[1],chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}};function Ov(r){let e=r.mode==="light"?Mv:$v;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 Pv(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?Mv:$v;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 XS=["canvas","launcher","tile","overlay","notification","content"];function Nv(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 XS){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${YS(i)}`]=s)}return e}var Wr,Hn,Bn,xr,wr,yd,xl,Pi=class{constructor(e,t,n){ve(this,wr);ve(this,Wr);ve(this,Hn);ve(this,Bn);ve(this,xr);oe(this,Wr,e),oe(this,Hn,t??{}),oe(this,Bn,n),oe(this,xr,_e(this,wr,yd).call(this)),e.addController(this)}get config(){return q(this,xr).config}get mode(){return q(this,xr).mode}get cssVariables(){return q(this,xr).cssVariables}hostConnected(){_e(this,wr,xl).call(this)}hostDisconnected(){}hostUpdated(){_e(this,wr,xl).call(this)}setThemeConfig(e,t){oe(this,Hn,e),oe(this,Bn,t),oe(this,xr,_e(this,wr,yd).call(this)),_e(this,wr,xl).call(this),q(this,Wr).requestUpdate()}};Wr=new WeakMap,Hn=new WeakMap,Bn=new WeakMap,xr=new WeakMap,wr=new WeakSet,yd=function(){let e=q(this,Bn)?Pv(q(this,Bn),q(this,Hn)):Ov(q(this,Hn)),t=Nv(e);return{config:e,mode:e.mode,cssVariables:t}},xl=function(){let e=q(this,Wr).shadowRoot??("renderRoot"in q(this,Wr)?q(this,Wr).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,xr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
491
|
+
`}};bl.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",bl);function _l(r,e,t="merge"){return t==="first-match"?uE(r,e):dE(r,e)}function uE(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 jv([i])}return null}function dE(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:jv(t)}function jv(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 wd=!1;function Wv(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function Sd(r){if(Wv()){wd=!0;return}wd=r??!1}function pE(){return Wv()?!0:wd}function Z(r,e,t){pE()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Ze(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function xl(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var wl="2.8.0-canary.185";var _r="2.0";var hE=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function fE(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):hE.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 gE(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var zv="syntro_config_cache",mE=1440*60*1e3;function qv(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function vE(r,e){if(qv())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(zv,JSON.stringify(t))}catch{}}function yE(r){if(!qv())return null;try{let e=localStorage.getItem(zv);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>mE?null:t.config}catch{return null}}var Sl=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function bE(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 Dn=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return Z("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=bE(e,s,o);if(console.log("[SmartCanvas Config] Variant key discovery:",u.length,"keys found"),u.length>0){let p=_l(e,u);if(console.log("[SmartCanvas Config] resolveVariantConfigs result:",p?`tiles=${p.tiles?.length}`:"null"),p)return Z("SmartCanvas Config","Resolved config from variant flags",p),p}}else console.log("[SmartCanvas Config] Skipping multi-flag mode:",{hasExperiments:!!e,manifestKey:s,variantFlagPrefix:o,hasGetAllFeatures:!!e?.getAllFeatures});let l=Sl({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(!fE(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(gE(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":wl,"X-SDK-Schema-Version":_r}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return Z("SmartCanvas Config","Fetched config from URI",p),a&&vE(p,a),p}catch(u){if(a){let p=yE(a);if(p)return Z("SmartCanvas Config","Serving config from offline cache"),p}throw u}};var kl=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)}},kd=r=>new kl(r);var Vt={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"},Ce={0:"#07230a",1:"#0e4514",2:"#16681e",3:"#1d8a28",4:"#24ad32",5:"#4fbd5a",6:"#7acd82",7:"#a5deab",8:"#d0eed3",9:"#e5f6e7"},Xe={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"},rr={0:"#051533",1:"#0a2a66",2:"#0f3f98",3:"#1454cb",4:"#1969fe",5:"#4787fe",6:"#75a5fe",7:"#a3c3ff",8:"#d1e1ff",9:"#e8f0ff"},eo={0:"#662500",1:"#993d00",2:"#cc5800",3:"#ff7700",4:"#fea85d",5:"#fec58f",6:"#ffd6ae",7:"#fee6cd",8:"#fff1e1",9:"#fff8f0"},to={0:"#151229",1:"#2a2452",2:"#40357c",3:"#5547a5",4:"#6a59ce",5:"#887ad8",6:"#a69be2",7:"#c3bdeb",8:"#e1def5",9:"#f0eefa"},ro={0:"#37091f",1:"#69123c",2:"#9b1c58",3:"#cd2575",4:"#ff2e92",5:"#ff58a8",6:"#ff82be",7:"#ffabd3",8:"#ffd5e9",9:"#ffeaf4"};var yt={primary:k[10],secondary:k[9],tertiary:k[8]},MP={primary:k[2],secondary:k[0]},Ed={primary:k[4],secondary:k[3]},El={primary:{text:Vt.white,icon:Vt.white,border:se[3],backgroundDefault:se[3],backgroundHover:se[2]},neutral:{text:k[10],textHover:Vt.white,icon:k[10],iconHover:Vt.white,border:k[4],background:k[2]},link:{text:Vt.white,icon:Vt.white,hover:se[5]},error:{text:Oe[5],hover:Oe[6]},success:{text:Ce[5],hover:Ce[6]}},PP={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:Xe[8],pillOutline:Xe[4],borderPrimary:Xe[2],borderSecondary:Xe[2],background:Xe[0]},green:{content:Ce[8],pillOutline:Ce[4],borderPrimary:Ce[2],borderSecondary:Ce[2],background:Ce[0]},purple:{content:to[8],pillOutline:to[4],borderPrimary:to[2],borderSecondary:to[2],background:to[0]},blue:{content:rr[8],pillOutline:rr[4],borderPrimary:rr[2],borderSecondary:rr[2],background:rr[0]},orange:{content:eo[8],pillOutline:eo[4],borderPrimary:eo[2],borderSecondary:eo[2],background:eo[0]},pink:{content:ro[8],pillOutline:ro[4],borderPrimary:ro[2],borderSecondary:ro[2],background:ro[0]}},OP={green:{content:Ce[8],border:Ce[2],background:Ce[0]},yellow:{content:Xe[8],border:Xe[2],background:Xe[0]},red:{content:Oe[8],border:Oe[2],background:Oe[0]}},LP={green:{content:Ce[1],background:Ce[9]},yellow:{content:Xe[1],background:Xe[9]},red:{content:Oe[1],background:Oe[9]}},NP={content:k[10],border:k[4],background:k[3]},FP={backgroundDefault:k[2],backgroundHover:k[1],selected:k[3]},DP={background:k[2],icon:k[10],borderDefault:k[4],borderSelected:se[3],textLabel:k[9],textPlaceholder:k[8],textHint:k[8]},HP={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]},BP={handleDefault:Vt.white,handleDisabled:k[10],off:{backgroundDefault:k[4],backgroundHover:k[5],backgroundDisabled:k[4]},on:{backgroundDefault:Ce[3],backgroundHover:Ce[2],backgroundDisabled:k[4]}},VP={off:{backgroundDefault:"#00000000",backgroundHover:k[5],backgroundDisabled:k[2],border:k[6]},on:{backgroundDefault:Ce[0],backgroundHover:Ce[1],backgroundDisabled:k[2],border:Ce[3]}},UP={content:k[10],background:k[4]},jP={background:k[4],active:Ce[3]},WP={background:k[1],content:k[9],border:k[4]},zP={backgroundDefault:k[1],backgroundHover:k[3],backgroundActive:k[4],border:k[4],contentPrimary:k[10],contentSecondary:k[9],contentTertiary:k[8]},qP={background:k[1],content:k[9],border:k[4]},ZP={activeBackground:k[3],activeContent:se[5],inactiveContent:k[9],border:k[4]},GP={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]}},KP={textPrimaryDefault:k[10],textPrimaryHover:k[10],textSecondaryDefault:k[8],textSecondaryHover:k[9],iconPrimary:k[10],iconSecondary:k[8]},YP={background:Ce[1],active:Ce[5]},XP={textDefault:k[10],textSelected:Vt.white,textDisabled:k[7],backgroundDefault:k[2],backgroundMiddle:k[3],backgroundSelected:se[3],border:k[4]},JP=k[9];var rO={size:56,inset:12,background:Vt.black,color:Vt.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 gO={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:yt.primary,colorTextSecondary:yt.secondary,colorTextMuted:yt.tertiary,colorTextInverse:k[1],colorBorder:Ed.primary,colorBorderSubtle:Ed.secondary,colorSuccess:Ce[4],colorSuccessMuted:Ce[0],colorWarning:Xe[4],colorWarningMuted:Xe[0],colorError:Oe[4],colorErrorMuted:Oe[0],colorInfo:rr[4],colorInfoMuted:rr[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"},mO={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:Ce[4],colorSuccessMuted:ae(Ce[4],.12),colorWarning:Xe[4],colorWarningMuted:ae(Xe[4],.12),colorError:Oe[4],colorErrorMuted:ae(Oe[4],.12),colorInfo:rr[4],colorInfoMuted:ae(rr[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 _E(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Zv={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:El.primary.backgroundDefault,backgroundHover:El.primary.backgroundHover,color:El.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:yt.primary,textColor:yt.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:yt.primary,titleColor:yt.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:yt.primary,textSecondaryColor:yt.secondary,border:`1px solid ${k[5]}`,borderRadius:"12px",successColor:Ce[4],warningColor:Xe[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:yt.primary,textSecondaryColor:yt.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:yt.primary,chevronColor:"currentColor"},mobile:{canvas:{backdrop:!0}}},Gv={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:Ce[4],warningColor:Xe[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 Kv(r){let e=r.mode==="light"?Gv:Zv;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 Yv(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?Gv:Zv;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 xE=["canvas","launcher","tile","overlay","notification","content"];function Xv(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 xE){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&typeof s=="string"&&(e[`--sc-${t}-${_E(i)}`]=s)}return e}var Wr,Hn,Bn,xr,wr,Cd,Cl,Oi=class{constructor(e,t,n){ye(this,wr);ye(this,Wr);ye(this,Hn);ye(this,Bn);ye(this,xr);oe(this,Wr,e),oe(this,Hn,t??{}),oe(this,Bn,n),oe(this,xr,we(this,wr,Cd).call(this)),e.addController(this)}get config(){return q(this,xr).config}get mode(){return q(this,xr).mode}get cssVariables(){return q(this,xr).cssVariables}hostConnected(){we(this,wr,Cl).call(this)}hostDisconnected(){}hostUpdated(){we(this,wr,Cl).call(this)}setThemeConfig(e,t){oe(this,Hn,e),oe(this,Bn,t),oe(this,xr,we(this,wr,Cd).call(this)),we(this,wr,Cl).call(this),q(this,Wr).requestUpdate()}};Wr=new WeakMap,Hn=new WeakMap,Bn=new WeakMap,xr=new WeakMap,wr=new WeakSet,Cd=function(){let e=q(this,Bn)?Yv(q(this,Bn),q(this,Hn)):Kv(q(this,Hn)),t=Xv(e);return{config:e,mode:e.mode,cssVariables:t}},Cl=function(){let e=q(this,Wr).shadowRoot??("renderRoot"in q(this,Wr)?q(this,Wr).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,xr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
|
|
492
492
|
`);t.textContent=`:host {
|
|
493
493
|
${n}
|
|
494
|
-
}`};var
|
|
494
|
+
}`};var wE=new Set(["tag_name","$el_text"]);function SE(r){return wE.has(r)||r.startsWith("attr__")}function Jv(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function kE(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(SE(i)){let o=n.props?.elements;if(!o||!o.some(l=>Jv(s,l[i])))return!1}else if(!Jv(s,n.props?.[i]))return!1}return!0}}function Qv(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?kE(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function Vn(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"&&Qv(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&Qv(i.triggerWhen,e)}}var ny="syntro-runtime",ey="smart-canvas",ty=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function ry(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 mt,Li,nr,Sr,Ut,jn,no,Wn,zn,io,so,oo,qn,Zn,zr,qr,Zr,Gn,Ni,ao,Ee,iy,sy,Fi,Ad,oy,Rd,Td,Id,$d,ay,Md,Al,Un=class extends be{constructor(){super();ye(this,Ee);this.fetcher=void 0;this.configUri=void 0;this.configUriFeatureKey=void 0;this.configFeatureKey=void 0;this.fetchCredentials="include";this.experiments=void 0;this.telemetry=void 0;this.runtime=void 0;this.launcherLabel=void 0;this.initialBatchHandle=null;this.initialBatchActions=void 0;this.workspaceTheme=void 0;this._tiles=[];this._configActions=[];this._isLoading=!0;this._error=void 0;this._theme=void 0;this._launcher=void 0;this._canvasTitle=void 0;this._displayMode="standard";this._isOpen=!1;this._pageUrl=typeof window<"u"?window.location.href:"/";ye(this,mt);ye(this,Li,null);ye(this,nr,null);ye(this,Sr,null);ye(this,Ut,null);ye(this,jn);ye(this,no,0);ye(this,Wn,null);ye(this,zn,"[]");ye(this,io,"[]");ye(this,so,"null");ye(this,oo,"null");ye(this,qn,null);ye(this,Zn,null);ye(this,zr,null);ye(this,qr,null);ye(this,Zr,null);ye(this,Gn,()=>{this._pageUrl=window.location.href});ye(this,Ni);ye(this,ao);ye(this,Fi,0);ye(this,Al,t=>{q(this,mt).toggle()});oe(this,mt,kd()),oe(this,jn,!1),oe(this,Ni,new Oi(this)),oe(this,ao,new xi(this,{context:ny,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),oe(this,Li,q(this,mt).subscribe(t=>{this._isOpen=t.open})),this._isOpen=q(this,mt).getState().open,oe(this,nr,document.createElement("div")),q(this,nr).id="overlayContainer",Object.assign(q(this,nr).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(q(this,nr)),oe(this,Sr,document.createElement("div")),q(this,Sr).id="portalRoot",this.shadowRoot.appendChild(q(this,Sr)),we(this,Ee,Rd).call(this),we(this,Ee,Md).call(this),we(this,Ee,Id).call(this)}disconnectedCallback(){var t,n,i,s,o;super.disconnectedCallback(),(t=q(this,Li))==null||t.call(this),oe(this,Li,null),(n=q(this,Zn))==null||n.call(this),oe(this,Zn,null),(i=q(this,zr))==null||i.call(this),oe(this,zr,null),(s=q(this,qr))==null||s.call(this),oe(this,qr,null),(o=q(this,Zr))==null||o.call(this),oe(this,Zr,null),we(this,Ee,Td).call(this),q(this,Ut)&&(q(this,Ut).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),oe(this,Ut,null)),q(this,nr)?.remove(),oe(this,nr,null),q(this,Sr)?.remove(),oe(this,Sr,null)}updated(t){var i;t.has("runtime")&&(q(this,ao).setValue(this.runtime??null),we(this,Ee,ay).call(this),we(this,Ee,Id).call(this),we(this,Ee,Md).call(this),we(this,Ee,Td).call(this),we(this,Ee,Rd).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&&(we(this,Ee,iy).call(this),(i=q(this,Zn))==null||i.call(this),this.experiments?.onFeaturesChanged&&oe(this,Zn,this.experiments.onFeaturesChanged(()=>this._loadConfig({silent:!0})))),(n||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&q(this,Ni).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&we(this,Ee,oy).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&q(this,mt).getState().open&&q(this,mt).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(oe(this,Ut,this.initialBatchHandle),oe(this,jn,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,oe(this,zn,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error,n=this._isLoading||t;if(this._displayMode==="inline")return n?N`
|
|
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
|
-
`:Q;let i=(q(this,Wn)?.tiles?.length??0)>0;return!n&&!i?Q:
|
|
501
|
+
`:Q;let i=(q(this,Wn)?.tiles?.length??0)>0;return!n&&!i?Q:N`
|
|
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=${q(this,
|
|
511
|
+
.themeConfig=${q(this,Ni).config}
|
|
512
512
|
?launcherAnimate=${!!this._launcher?.animate}
|
|
513
|
-
@canvas-toggle=${q(this,
|
|
513
|
+
@canvas-toggle=${q(this,Al)}
|
|
514
514
|
></syntro-canvas-overlay>
|
|
515
|
-
`}open(){this._displayMode!=="inline"&&q(this,
|
|
515
|
+
`}open(){this._displayMode!=="inline"&&q(this,mt).setOpen(!0)}close(){this._displayMode!=="inline"&&q(this,mt).setOpen(!1)}toggle(){this._displayMode!=="inline"&&q(this,mt).toggle()}setOverrideFetcher(t){this.fetcher=t}getMountNode(){return this.renderRoot}getController(){return q(this,mt)}getPortalRoot(){return q(this,Sr)}getOverlayContainer(){return q(this,nr)}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(!q(this,qn))return;let n=++yu(this,Fi)._;try{t||(this._isLoading=!0),this._error=void 0;let i=await q(this,qn).call(this);if(n!==q(this,Fi))return;Z("SmartCanvas Config","Raw config response",i);let s=Object.keys(i).length===0;oe(this,Wn,s?null:i);let o=i.tiles||[];if(o.length>0&&this.runtime?.accumulator&&Vn(o,this.runtime.accumulator,i.actions),this.runtime){if(o=await this.runtime.filterTiles(o),n!==q(this,Fi))return;this.experiments&&(o=o.filter(v=>this.experiments.shouldRenderRectangle(v)))}else this.experiments&&(o=o.filter(v=>this.experiments.shouldRenderRectangle(v)));ry(o),Z("SmartCanvas Config",`Tile count after filtering: ${o.length}`);let a=i.actions||[],l=JSON.stringify(a),c=l!==q(this,zn);c&&oe(this,zn,l);let u=ty(o),p=JSON.stringify(u);p!==q(this,io)&&(oe(this,io,p),this._tiles=u),c&&(this._configActions=a),t||(this._isLoading=!1);let h=JSON.stringify(i.theme??null);h!==q(this,so)&&(oe(this,so,h),this._theme=i.theme);let f=JSON.stringify(i.launcher??null);f!==q(this,oo)&&(oe(this,oo,f),this._launcher=i.launcher),i.canvasTitle!==this._canvasTitle&&(this._canvasTitle=i.canvasTitle),we(this,Ee,$d).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}}};mt=new WeakMap,Li=new WeakMap,nr=new WeakMap,Sr=new WeakMap,Ut=new WeakMap,jn=new WeakMap,no=new WeakMap,Wn=new WeakMap,zn=new WeakMap,io=new WeakMap,so=new WeakMap,oo=new WeakMap,qn=new WeakMap,Zn=new WeakMap,zr=new WeakMap,qr=new WeakMap,Zr=new WeakMap,Gn=new WeakMap,Ni=new WeakMap,ao=new WeakMap,Ee=new WeakSet,iy=function(){if(this.fetcher)oe(this,qn,this.fetcher);else{let t=we(this,Ee,sy).call(this);oe(this,qn,Dn(t))}},sy=function(){return{configUri:this.configUri,experiments:this.experiments,featureKey:this.configUriFeatureKey,configFeatureKey:this.configFeatureKey,credentials:this.fetchCredentials}},Fi=new WeakMap,Ad=async function(){let t=q(this,Wn);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))),ry(n),this._tiles=ty(n)},oy=async function(){if(!this.runtime?.actions||q(this,jn)&&(oe(this,jn,!1),JSON.stringify(this._configActions)===q(this,zn)))return;let t=++yu(this,no)._,n=()=>t!==q(this,no);if(q(this,Ut)){try{await q(this,Ut).revertAll()}catch(i){console.error("[SmartCanvasElementLit] Failed to revert actions:",i)}oe(this,Ut,null)}if(!n()&&this._configActions.length>0)try{let i=await this.runtime.actions.applyBatch(this._configActions);n()?await i.revertAll():oe(this,Ut,i)}catch(i){n()||console.error("[SmartCanvasElementLit] Failed to apply actions:",i)}},Rd=function(){this.runtime||typeof window>"u"||(window.addEventListener("popstate",q(this,Gn)),window.addEventListener("hashchange",q(this,Gn)))},Td=function(){typeof window>"u"||(window.removeEventListener("popstate",q(this,Gn)),window.removeEventListener("hashchange",q(this,Gn)))},Id=function(){this.runtime&&(this.runtime.accumulator&&oe(this,zr,this.runtime.accumulator.subscribe(()=>{we(this,Ee,Ad).call(this)})),this.runtime.context&&oe(this,qr,this.runtime.context.subscribe(t=>{let n=t.page?.url;n&&n!==this._pageUrl&&(this._pageUrl=n),we(this,Ee,$d).call(this),we(this,Ee,Ad).call(this)})))},$d=function(){let t=this.runtime?.context.get()?.surface?.mode,n=q(this,Wn)?.displayMode??"standard",i=t==="agent"?"inline":n;i!==this._displayMode&&(this._displayMode=i)},ay=function(){var t,n;(t=q(this,zr))==null||t.call(this),oe(this,zr,null),(n=q(this,qr))==null||n.call(this),oe(this,qr,null)},Md=function(){var t;(t=q(this,Zr))==null||t.call(this),oe(this,Zr,null),this.runtime&&oe(this,Zr,this.runtime.events.subscribe({names:["canvas.requestOpen"]},()=>{this._displayMode!=="inline"&&q(this,mt).setOpen(!0)}))},Al=new WeakMap,Un.shadowRootOptions={mode:"open",delegatesFocus:!0},Un.styles=pn`
|
|
516
516
|
:host {
|
|
517
517
|
font: inherit;
|
|
518
518
|
color: inherit;
|
|
@@ -531,12 +531,12 @@ ${n}
|
|
|
531
531
|
*::after {
|
|
532
532
|
box-sizing: border-box;
|
|
533
533
|
}
|
|
534
|
-
`,
|
|
534
|
+
`,Un.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 lo=()=>{typeof window>"u"||customElements.get(ey)||customElements.define(ey,Un)};var Rl=class extends be{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 g=this._canvas.transitionFade??"6%",m=n?`linear-gradient(to right, transparent, black ${g})`:`linear-gradient(to left, transparent, black ${g})`;u={maskImage:m,WebkitMaskImage:m}}let p={display:"flex",flexDirection:"column",width:t?"40vw":this._canvas.width??"380px",minWidth:"320px",height:"100%",maxHeight:"100%",pointerEvents:"auto",opacity:this.isOpen?"1":"0",transition:this.isOpen?`transform ${s} ${o}, opacity ${s} ease-out`:`transform ${s} ${o}, opacity ${s} ease-in`,color:"var(--sc-overlay-text-color)",background:"var(--sc-canvas-background)",backdropFilter:c,WebkitBackdropFilter:c,...u,border:i,borderRadius:"var(--sc-overlay-border-radius, 0)",boxShadow:"none",transform:this.isOpen?"translateX(0)":n?"translateX(120%)":"translateX(-120%)"},h={position:"absolute",inset:"0",display:"flex",flexDirection:n?"row-reverse":"row",alignItems:"stretch",pointerEvents:"none",padding:"0"},f={position:"fixed",inset:"0",pointerEvents:"none",zIndex:String(a)},v={flex:"1",overflowY:"auto",padding:t?"0":"1rem"};return N`
|
|
535
535
|
<div data-shadow-canvas-id="overlay-root" style=${R(f)}>
|
|
536
536
|
<div style=${R(h)}>
|
|
537
537
|
<div data-shadow-canvas-id="overlay-container" style=${R(p)}>
|
|
538
538
|
|
|
539
|
-
${t&&this.canvasTitle?
|
|
539
|
+
${t&&this.canvasTitle?N`
|
|
540
540
|
<header style=${R({color:"white",padding:"1.5rem 1.5rem 0"})}>
|
|
541
541
|
<p style=${R({margin:"0",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.5em",color:"var(--sc-notification-text-secondary-color)"})}>
|
|
542
542
|
${this.canvasTitle}
|
|
@@ -544,12 +544,12 @@ ${n}
|
|
|
544
544
|
</header>`:Q}
|
|
545
545
|
|
|
546
546
|
<div style=${R(v)}>
|
|
547
|
-
${this.isLoading?
|
|
547
|
+
${this.isLoading?N`<div style=${R({color:"var(--sc-overlay-text-color)",padding:t?"1rem":"0"})}>Loading...</div>`:this.error?N`<div style=${R({color:"var(--sc-notification-error-color)",padding:t?"1rem":"0"})}>Failed to load: ${this.error}</div>`:t?this.tiles.length>0?N`<syntro-tile-card
|
|
548
548
|
.config=${this.tiles[0]}
|
|
549
549
|
.surface=${"overlay"}
|
|
550
550
|
.runtimeRef=${this.runtimeRef}
|
|
551
551
|
style=${R({width:"100%",height:"100%"})}
|
|
552
|
-
></syntro-tile-card>`:Q:
|
|
552
|
+
></syntro-tile-card>`:Q:N`<syntro-tile-stack
|
|
553
553
|
.tiles=${this.tiles}
|
|
554
554
|
.surface=${"overlay"}
|
|
555
555
|
.runtimeRef=${this.runtimeRef}
|
|
@@ -562,7 +562,7 @@ ${n}
|
|
|
562
562
|
<div style=${R({flex:"1 1 auto"})}></div>
|
|
563
563
|
</div>
|
|
564
564
|
</div>
|
|
565
|
-
`}};
|
|
565
|
+
`}};Rl.properties={isOpen:{type:Boolean},tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},canvasTitle:{type:String},displayMode:{type:String},runtimeRef:{attribute:!1},telemetry:{attribute:!1},themeConfig:{attribute:!1}};customElements.define("syntro-drawer",Rl);var EE="#6a59ce",CE="#887ad8",AE="#ffffff",Tl=class extends be{constructor(){super(...arguments);this.isOpen=!1;this.launcherAnimate=!1;this.notificationCount=0;this.position="right";this.launcherIcon=null;this.colorPrimary=EE;this.colorPrimaryHover=CE;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,7 +595,7 @@ ${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 N`
|
|
599
599
|
<button
|
|
600
600
|
type="button"
|
|
601
601
|
aria-label="Toggle shadow canvas"
|
|
@@ -610,7 +610,7 @@ ${n}
|
|
|
610
610
|
${this._renderIcon()}
|
|
611
611
|
${o?this._renderBadge():Q}
|
|
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?N`
|
|
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?N`
|
|
625
625
|
<img
|
|
626
626
|
src=${this.launcherIcon}
|
|
627
627
|
alt=""
|
|
628
628
|
aria-hidden="true"
|
|
629
629
|
style=${R({width:"60%",height:"60%",objectFit:"contain",pointerEvents:"none"})}
|
|
630
630
|
/>
|
|
631
|
-
`:
|
|
631
|
+
`:N`
|
|
632
632
|
<svg
|
|
633
633
|
width="24" height="24" viewBox="0 0 24 24"
|
|
634
634
|
fill="none" stroke="currentColor"
|
|
@@ -642,7 +642,7 @@ ${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
|
|
645
|
+
`}_renderBadge(){let t=this.notificationCount,n=t>99?"99+":String(t);return N`
|
|
646
646
|
<div style=${R({position:"absolute",top:"-2px",right:"-2px",pointerEvents:"none"})}>
|
|
647
647
|
<!-- Layer 1: Expanding ping ring -->
|
|
648
648
|
<span
|
|
@@ -657,13 +657,13 @@ ${n}
|
|
|
657
657
|
<!-- Layer 3: Bouncing count badge -->
|
|
658
658
|
<span
|
|
659
659
|
class="syntro-badge-bounce"
|
|
660
|
-
style=${R({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:
|
|
660
|
+
style=${R({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"9999px",background:this.colorPrimaryHover,color:AE,fontSize:"11px",fontWeight:"700"})}
|
|
661
661
|
>${n}</span>
|
|
662
662
|
</div>
|
|
663
|
-
`}};
|
|
663
|
+
`}};Tl.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",Tl);var co=class extends be{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 Q;let t=R({transform:`translateX(-${this._index*100}%)`,width:`${this._ordered.length*100}%`}),n=R({width:`${100/this._ordered.length}%`});return N`
|
|
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=>N`
|
|
667
667
|
<div class="slide-item" style=${n}>
|
|
668
668
|
<syntro-tile-card
|
|
669
669
|
.config=${i}
|
|
@@ -676,7 +676,7 @@ ${n}
|
|
|
676
676
|
</div>
|
|
677
677
|
|
|
678
678
|
<div class="dot-row">
|
|
679
|
-
${this._ordered.map((i,s)=>
|
|
679
|
+
${this._ordered.map((i,s)=>N`
|
|
680
680
|
<button
|
|
681
681
|
type="button"
|
|
682
682
|
class="dot"
|
|
@@ -728,23 +728,23 @@ ${n}
|
|
|
728
728
|
cursor: pointer;
|
|
729
729
|
padding: 0;
|
|
730
730
|
}
|
|
731
|
-
`,co.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",co);function
|
|
731
|
+
`,co.properties={tiles:{type:Array},intervalMs:{type:Number},telemetry:{type:Object},runtimeRef:{type:Object},_index:{type:Number,state:!0}};customElements.define("syntro-tile-wheel",co);function RE(r,e){let t=Ys(r,{size:e});return t||`<span style="line-height:1;">${r}</span>`}var Tt,ly,cy,uy,dy,py,uo=class extends be{constructor(){super(...arguments);ye(this,Tt);this.notifications=[];this.position="right"}render(){if(this.notifications.length===0)return N``;let t=R({position:"fixed",bottom:"6rem",[this.position==="right"?"right":"left"]:"2.5rem",display:"flex",flexDirection:"column",gap:"8px",zIndex:"2147483648",pointerEvents:"auto",width:"280px"});return N`
|
|
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=>we(this,Tt,py).call(this,n))}
|
|
737
737
|
</div>
|
|
738
|
-
`}};Tt=new WeakSet,
|
|
738
|
+
`}};Tt=new WeakSet,ly=function(t,n){n.stopPropagation(),this.dispatchEvent(new CustomEvent("notification-dismiss",{detail:{id:t},bubbles:!0,composed:!0}))},cy=function(t){this.dispatchEvent(new CustomEvent("notification-click",{detail:{notification:t},bubbles:!0,composed:!0}))},uy=function(t){let n=t.currentTarget;n.style.transform="translateY(-1px)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.add("paused")},dy=function(t){let n=t.currentTarget;n.style.transform="translateY(0)";let i=n.querySelector(".syntro-toast-progress");i&&i.classList.remove("paused")},py=function(t){let n=R({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=R({display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px"}),s=R({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=R({flex:"1",minWidth:"0"}),a=R({fontSize:"13px",fontWeight:"600",color:"var(--sc-notification-text-color)",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),l=R({fontSize:"12px",color:"var(--sc-notification-text-secondary-color)",lineHeight:"1.3",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),c=R({background:"none",border:"none",color:"var(--sc-notification-text-secondary-color)",cursor:"pointer",padding:"2px",fontSize:"14px",lineHeight:"1",flexShrink:"0"}),u=R({height:"2px",background:"rgba(0, 0, 0, 0.08)"}),p=R({height:"100%",background:"var(--sc-notification-progress-gradient)",animationDuration:`${t.ttl}ms`}),h=RE(t.icon??"\u{1F514}",14);return N`
|
|
739
739
|
<div
|
|
740
740
|
class="syntro-toast-enter"
|
|
741
741
|
style=${n}
|
|
742
|
-
@mouseenter=${
|
|
743
|
-
@mouseleave=${
|
|
742
|
+
@mouseenter=${we(this,Tt,uy)}
|
|
743
|
+
@mouseleave=${we(this,Tt,dy)}
|
|
744
744
|
>
|
|
745
745
|
<div
|
|
746
746
|
style=${i}
|
|
747
|
-
@click=${()=>
|
|
747
|
+
@click=${()=>we(this,Tt,cy).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?N`<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=>we(this,Tt,ly).call(this,t.id,f)}
|
|
764
764
|
>×</button>
|
|
765
765
|
</div>
|
|
766
766
|
|
|
@@ -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",uo);var Ed=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{}}}},Cd=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{}}}},Ad=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 po=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of du)this.registerCore(e,t);for(let{kind:e,executor:t}of Mu)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Ed),this.registerCore("core:parallel",Cd),this.registerCore("core:wait",Ad)}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)}},ir=new po;function Xv(r){return ir.get(r)}function El(r){return ir.has(r)}function Rd(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 Td(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 Id(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>Cl&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${Cl}`,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 $d(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function Md(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(jd.has(r.attr.toLowerCase())||r.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${r.attr}`,field:"attr"}),(r.value===void 0||r.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function Od(r,e,t){!r.className||typeof r.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(r.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function Pd(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>Al&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${Al}`,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 Nd(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 Ld(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 Fd(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=Ut(r.actions[n]);for(let s of i.errors)e.push({...s,field:`actions[${n}]${s.field?`.${s.field}`:""}`});for(let s of i.warnings)t.push(s)}}function Dd(r,e,t){if(!r.actions||!Array.isArray(r.actions)){e.push({code:"MISSING_ACTIONS",message:"parallel action requires 'actions' array",field:"actions"});return}r.actions.length===0&&t.push({code:"EMPTY_PARALLEL",message:"parallel has no actions",suggestion:"Add at least one action to the parallel group"}),r.waitFor&&!["all","any"].includes(r.waitFor)&&e.push({code:"INVALID_WAIT_FOR",message:"waitFor must be 'all' or 'any'",field:"waitFor"});for(let n=0;n<r.actions.length;n++){let i=Ut(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 Hd(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 Bd(r,e,t){if(!r.content||typeof r.content!="object"){e.push({code:"MISSING_CONTENT",message:"Modal action requires 'content' object",field:"content"});return}if((!r.content.body||typeof r.content.body!="string")&&e.push({code:"MISSING_BODY",message:"Modal content requires 'body' property",field:"content.body"}),r.size&&!["sm","md","lg"].includes(r.size)&&e.push({code:"INVALID_SIZE",message:"Modal size must be 'sm', 'md', or 'lg'",field:"size"}),r.ctaButtons)if(!Array.isArray(r.ctaButtons))e.push({code:"INVALID_CTA_BUTTONS",message:"ctaButtons must be an array",field:"ctaButtons"});else for(let n=0;n<r.ctaButtons.length;n++){let i=r.ctaButtons[n];(!i.label||typeof i.label!="string")&&e.push({code:"MISSING_BUTTON_LABEL",message:`CTA button at index ${n} requires 'label' property`,field:`ctaButtons[${n}].label`}),(!i.actionId||typeof i.actionId!="string")&&e.push({code:"MISSING_BUTTON_ACTION_ID",message:`CTA button at index ${n} requires 'actionId' property`,field:`ctaButtons[${n}].actionId`})}}function Vd(r,e,t){if((!r.tourId||typeof r.tourId!="string")&&e.push({code:"MISSING_TOUR_ID",message:"Tour action requires 'tourId' property",field:"tourId"}),!r.steps||!Array.isArray(r.steps)){e.push({code:"MISSING_STEPS",message:"Tour action requires 'steps' array",field:"steps"});return}r.steps.length===0&&e.push({code:"EMPTY_STEPS",message:"Tour must have at least one step",field:"steps"});let n=new Set;for(let i=0;i<r.steps.length;i++){let s=r.steps[i];if(!s.id||typeof s.id!="string"?e.push({code:"MISSING_STEP_ID",message:`Step at index ${i} requires 'id' property`,field:`steps[${i}].id`}):(n.has(s.id)&&e.push({code:"DUPLICATE_STEP_ID",message:`Duplicate step ID: ${s.id}`,field:`steps[${i}].id`}),n.add(s.id)),!s.action)e.push({code:"MISSING_STEP_ACTION",message:`Step at index ${i} requires 'action' property`,field:`steps[${i}].action`});else{let o=Ut(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 jd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),Cl=5e4,Al=50;function Ut(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(!El(n)&&n!=="core:mountWidget"){let i=ir.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":Sr(r,e,t);break;case"overlays:badge":Sr(r,e,t),Rd(r,e,t);break;case"overlays:tooltip":Sr(r,e,t),Td(r,e,t);break;case"overlays:modal":Bd(r,e,t);break;case"content:insertHtml":Sr(r,e,t),Id(r,e,t);break;case"content:setText":Sr(r,e,t),$d(r,e,t);break;case"content:setAttr":Sr(r,e,t),Md(r,e,t);break;case"content:addClass":case"content:removeClass":Sr(r,e,t),Od(r,e,t);break;case"content:setStyle":Sr(r,e,t),Pd(r,e,t);break;case"core:mountWidget":Nd(r,e,t);break;case"core:wait":Ld(r,e,t);break;case"core:sequence":Fd(r,e,t);break;case"core:parallel":Dd(r,e,t);break;case"overlays:tour":Vd(r,e,t);break;case"navigation:navigate":Hd(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function Sr(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 ho(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=Ut(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 sE=0;function Rl(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=ir,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++sE}`}function f(_,A){t&&t.publish(_,A)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(_,A)=>t.subscribe({names:[_]},$=>A($.props)):void 0,subscribeNavigation:l}}async function g(_,A){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let $=n.mount(_.slot,{type:"widget",widgetId:_.widget.widgetId,config:_.widget.props},{priority:_.widget.priority});return A.publishEvent("action.applied",{id:A.generateId(),kind:"core:mountWidget",slot:_.slot,widgetId:_.widget.widgetId}),{cleanup:()=>{$.unmount()},updateFn:T=>{if("widget"in T&&T.widget){let O=T.widget;O.props&&$.update({type:"widget",widgetId:_.widget.widgetId,config:O.props})}}}}async function m(_,A){if(_.kind==="core:mountWidget")return g(_,A);let $=a.get(_.kind);if(!$){let T="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${_.kind}".`,`Registered: [${T}]`),new Error(`No executor for action kind: ${_.kind}`)}return $(_,A)}function y(_,A,$,T){if(!c)return;let O=[],X=!1,F=async()=>{if(X)return;let N=u.get(_);if(N){X=!0;try{let K=c.evaluateSync($).value;if(N.state==="applied"&&!K){try{await N.cleanup()}catch(le){console.error(`[ActionEngine] Error reverting conditional action ${_}:`,le)}N.state="deferred",N.cleanup=()=>{},N.updateFn=void 0,f("action.deferred",{id:_,kind:A.kind})}else if(N.state==="deferred"&&K)try{let le=v(),U=await m(A,le);N.state="applied",N.cleanup=U.cleanup,N.updateFn=U.updateFn,N.appliedTs=Date.now()}catch(le){console.error(`[ActionEngine] Error applying deferred action ${_}:`,le),N.state="failed"}}finally{X=!1}}};c.context&&O.push(c.context.subscribe(F)),c.accumulator&&O.push(c.accumulator.subscribe(F)),c.sessionMetrics&&O.push(c.sessionMetrics.subscribe(F)),c.events&&O.push(c.events.subscribe(F)),p.set(_,O)}async function x(_){let A=Ut(_);if(!A.valid){let Z=A.errors.map(K=>K.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${_?.kind}":`,Z,_),new Error(`Action validation failed: ${Z}`)}let $=h(),T=_.triggerWhen;if(T&&c&&!c.evaluateSync(T).value){let K={id:$,action:_,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set($,K);let le={id:$,action:_,async revert(){let U=u.get($);if(!U)return;let ee=p.get($);if(ee){for(let D of ee)D();p.delete($)}U.state="reverted",u.delete($)},isApplied(){return u.get($)?.state==="applied"},async update(U){let ee=u.get($);if(!ee||ee.state!=="applied")throw new Error("Cannot update action that is not applied");if(ee.updateFn)await ee.updateFn(U);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return y($,_,T,le),le}let O=v(),X=await m(_,O),F={id:$,action:_,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:X.cleanup,updateFn:X.updateFn};u.set($,F);let N={id:$,action:_,async revert(){let Z=u.get($);if(!Z||Z.state!=="applied")return;let K=p.get($);if(K){for(let le of K)le();p.delete($)}try{await Z.cleanup(),Z.state="reverted",f("action.reverted",{id:$,kind:_.kind})}catch(le){console.warn(`[ActionEngine] Cleanup error for ${_.kind} (${$}), ignoring:`,le),Z.state="reverted",f("action.reverted",{id:$,kind:_.kind})}finally{u.delete($)}},isApplied(){return u.get($)?.state==="applied"},async update(Z){let K=u.get($);if(!K||K.state!=="applied")throw new Error("Cannot update action that is not applied");if(K.updateFn)await K.updateFn(Z);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return T&&c&&y($,_,T,N),N}async function k(_){console.log(`[ActionEngine] applyBatch: ${_.length} action(s)`,_.map(F=>F.kind).join(", "));let A=ho(_);if(!A.valid){let F=A.errors.map(N=>N.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 $=h(),T=[],O=[];try{let F=await Promise.allSettled(_.map(Z=>x(Z))),N=[];for(let Z of F)Z.status==="fulfilled"?(T.push(Z.value),O.push(Z.value)):N.push(Z.reason instanceof Error?Z.reason:new Error(String(Z.reason)));if(N.length>0&&O.length===0)throw N[0];N.length>0&&console.warn(`[ActionEngine] ${N.length}/${_.length} action(s) failed in batch:`,N.map(Z=>Z.message).join("; "))}catch(F){console.error(`[ActionEngine] Batch apply FAILED. Successfully applied: ${O.length}. Rolling back...`,F);for(let N of O)try{await N.revert()}catch{}throw F}return{id:$,handles:T,async revertAll(){for(let F=T.length-1;F>=0;F--)try{await T[F].revert()}catch(N){console.error(`[ActionEngine] Error reverting action ${T[F].id}:`,N)}},isApplied(){return T.every(F=>F.isApplied())}}}function b(_){return Ut(_)}function w(){return Array.from(u.values()).map(_=>({id:_.id,action:_.action,adaptiveId:_.adaptiveId,appliedTs:_.appliedTs,state:_.state}))}async function C(){for(let A of p.values())for(let $ of A)try{$()}catch{}p.clear();let _=[];for(let A of u.values())if(A.state==="applied")try{let $=A.cleanup();$&&typeof $.then=="function"&&_.push($.catch(T=>{console.error("[ActionEngine] Error during async cleanup:",T)}))}catch($){console.error("[ActionEngine] Error during cleanup:",$)}u.clear(),_.length>0&&await Promise.all(_)}return{apply:x,applyBatch:k,validate:b,getActive:w,destroy:C}}var Ud=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.")}),fo=d.object({routes:Ud,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 oE(r){return br.safeParse(r)}function aE(r){return Ti.safeParse(r)}function lE(r){return fo.safeParse(r)}var cE=[{defName:"matchOp",schema:wi},{defName:"counterDef",schema:ki},{defName:"activationConfig",schema:fo},{defName:"routeFilter",schema:Ud},{defName:"ruleStrategy",schema:Ei},{defName:"scoreStrategy",schema:Ci},{defName:"modelStrategy",schema:Ai},{defName:"externalStrategy",schema:Ri},{defName:"rule",schema:Si},{defName:"condition",schema:br}];var Wd=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),uE=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:Wd.optional()}).strict(),dE=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:fo.optional(),notifications:d.array(uE).optional()}).strict(),Jv=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()}),pE=d.object({canvas:Jv.optional()}),hE=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()}),fE=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()}),gE=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()}),mE=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()}),vE=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()}),yE=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:Jv.optional(),launcher:hE.optional(),tile:fE.optional(),overlay:gE.optional(),notification:mE.optional(),content:vE.optional(),mobile:pE.optional()}).strict(),bE=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(),FP=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).optional(),tiles:d.array(dE),actions:d.array(d.any()),theme:yE.optional(),launcher:bE.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:br.optional()})])).optional()}).passthrough().optional()}).strict();var qe={triggerWhen:Xs},yt=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),zd=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),qd=d.enum(["top-left","top-right","bottom-left","bottom-right"]),Zd=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),Il=d.object({label:d.string(),actionId:d.string(),primary:d.boolean().optional()}).strict(),Gd=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(Il).optional()}).strict(),Kd=d.object({title:d.string().optional(),body:d.string()}).strict(),Yd=d.enum(["before","after","prepend","append","replace"]),Xd=d.enum(["immediate","hover","click"]),Jd=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),Qd=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),ep=d.enum(["auto","smooth","instant"]),Tl=d.enum(["start","center","end","nearest"]),tp=d.object({kind:d.literal("content:setText"),anchorId:yt,text:d.string(),label:d.string().optional()}).extend(qe).extend(He).strict(),rp=d.object({kind:d.literal("content:setAttr"),anchorId:yt,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(qe).extend(He).strict(),np=d.object({kind:d.literal("content:addClass"),anchorId:yt,className:d.string(),label:d.string().optional()}).extend(qe).extend(He).strict(),ip=d.object({kind:d.literal("content:removeClass"),anchorId:yt,className:d.string(),label:d.string().optional()}).extend(qe).extend(He).strict(),sp=d.object({kind:d.literal("content:setStyle"),anchorId:yt,styles:d.record(d.string()),label:d.string().optional()}).extend(qe).extend(He).strict(),op=d.object({kind:d.literal("content:insertHtml"),anchorId:yt,html:d.string(),position:Yd,deepLink:Wd.optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),ap=d.object({kind:d.literal("overlays:highlight"),anchorId:yt,style:zd.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),lp=d.object({kind:d.literal("overlays:pulse"),anchorId:yt,duration:d.number().optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),cp=d.object({kind:d.literal("overlays:badge"),anchorId:yt,content:d.string(),position:qd.optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),up=d.object({kind:d.literal("overlays:tooltip"),anchorId:yt,content:Gd,trigger:Xd.optional(),placement:Zd.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),dp=d.object({kind:d.literal("overlays:modal"),content:Kd,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(Il).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),pp=d.object({kind:d.literal("navigation:scrollTo"),anchorId:yt,behavior:ep.optional(),block:Tl.optional(),inline:Tl.optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),hp=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),fp=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:Jd,label:d.string().optional()}).extend(qe).extend(He).strict(),gp=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),mp=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(qe).extend(He).strict(),vp=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(qe).extend(He).strict(),yp=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(Qd).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(qe).extend(He).passthrough(),Qv=[{defName:"setText",schema:tp},{defName:"setAttr",schema:rp},{defName:"addClass",schema:np},{defName:"removeClass",schema:ip},{defName:"setStyle",schema:sp},{defName:"insertHtml",schema:op},{defName:"highlight",schema:ap},{defName:"pulse",schema:lp},{defName:"badge",schema:cp},{defName:"tooltip",schema:up},{defName:"modal",schema:dp},{defName:"scrollTo",schema:pp},{defName:"navigate",schema:hp},{defName:"mountWidget",schema:fp},{defName:"wait",schema:gp},{defName:"sequence",schema:mp},{defName:"parallel",schema:vp},{defName:"tour",schema:yp}];function $l(r){let e=r?.root??(typeof document<"u"?document.body:null),t=r?.defaultTimeoutMs??5e3,n=new Map,i=new Map,s=null,o=!1;function a(m){if(!e)return null;try{return e.matches(m)?e:e.querySelector(m)}catch{return null}}function l(){for(let[m,y]of n){let x=a(m);if(x){for(let k of y)clearTimeout(k.timer),k.resolve(x);n.delete(m)}}for(let[m,y]of i){let x=a(m);if(x){for(let k of y)k.cancelled||k.cb(x);i.delete(m)}}n.size===0&&i.size===0&&u()}function c(){s||o||typeof MutationObserver>"u"||!e||(s=new MutationObserver(()=>{l()}),s.observe(e,{childList:!0,subtree:!0}))}function u(){s&&(s.disconnect(),s=null)}function p(m,y){let x=n.get(m);x&&(x.delete(y),x.size===0&&n.delete(m)),n.size===0&&i.size===0&&u()}function h(m,y){if(o)return Promise.reject(new Error("AnchorResolver destroyed"));let x=a(m);if(x)return Promise.resolve(x);let k=y??t;return new Promise((b,w)=>{let C={resolve:b,reject:w,timer:setTimeout(()=>{p(m,C),w(new Error(`waitFor("${m}") timed out after ${k}ms`))},k)},_=n.get(m);_||(_=new Set,n.set(m,_)),_.add(C),c()})}function f(m,y){if(o)return()=>{};let x=a(m);if(x)return y(x),()=>{};let k={cb:y,cancelled:!1},b=i.get(m);return b||(b=new Set,i.set(m,b)),b.add(k),c(),()=>{k.cancelled=!0;let w=i.get(m);w&&(w.delete(k),w.size===0&&i.delete(m)),n.size===0&&i.size===0&&u()}}function v(){let m=0;for(let y of n.values())m+=y.size;return m}function g(){o=!0,u();let m=new Error("AnchorResolver destroyed");for(let y of n.values())for(let x of y)clearTimeout(x.timer),x.reject(m);n.clear(),i.clear()}return{resolve:a,waitFor:h,onAppear:f,pendingCount:v,destroy:g}}var ey={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function ty(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...ey,...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 ry(r={}){let{className:e,style:t}={...ey,...r};return`
|
|
792
|
+
`;customElements.define("syntro-toast-stack",uo);var Pd=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{}}}},Od=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{}}}},Ld=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 po=class{constructor(){this.executors=new Map;for(let{kind:e,executor:t}of bu)this.registerCore(e,t);for(let{kind:e,executor:t}of Bu)this.registerCore(e,t);this.registerCore("core:mountWidget",async()=>{throw new Error("core:mountWidget must be handled by ActionEngine")}),this.registerCore("core:sequence",Pd),this.registerCore("core:parallel",Od),this.registerCore("core:wait",Ld)}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)}},ir=new po;function hy(r){return ir.get(r)}function Il(r){return ir.has(r)}function Nd(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 Fd(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 Dd(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>$l&&e.push({code:"HTML_TOO_LONG",message:`HTML content exceeds maximum length of ${$l}`,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 Hd(r,e,t){(r.text===void 0||r.text===null)&&e.push({code:"MISSING_TEXT",message:"setText action requires 'text' property",field:"text"})}function Bd(r,e,t){!r.attr||typeof r.attr!="string"?e.push({code:"MISSING_ATTR",message:"setAttr action requires 'attr' property",field:"attr"}):(Yd.has(r.attr.toLowerCase())||r.attr.toLowerCase().startsWith("on"))&&e.push({code:"DANGEROUS_ATTR",message:`Event handler attributes are not allowed: ${r.attr}`,field:"attr"}),(r.value===void 0||r.value===null)&&e.push({code:"MISSING_VALUE",message:"setAttr action requires 'value' property",field:"value"})}function Vd(r,e,t){!r.className||typeof r.className!="string"?e.push({code:"MISSING_CLASS_NAME",message:"Class action requires 'className' property",field:"className"}):/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(r.className)||t.push({code:"INVALID_CLASS_NAME",message:"Class name contains unusual characters",suggestion:"Use alphanumeric characters, hyphens, and underscores"})}function Ud(r,e,t){if(!r.styles||typeof r.styles!="object")e.push({code:"MISSING_STYLES",message:"setStyle action requires 'styles' object",field:"styles"});else{let n=Object.keys(r.styles).length;n>Ml&&e.push({code:"TOO_MANY_STYLES",message:`Too many styles (${n}). Maximum is ${Ml}`,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 jd(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 Wd(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 zd(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=jt(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 qd(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=jt(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 Zd(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 Gd(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 Kd(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=jt(s.action);for(let a of o.errors)e.push({...a,field:`steps[${i}].action${a.field?`.${a.field}`:""}`});for(let a of o.warnings)t.push(a)}if(s.onAction)for(let[o,a]of Object.entries(s.onAction))a!=="end"&&!r.steps.some(l=>l.id===a)&&t.push({code:"UNKNOWN_TARGET_STEP",message:`Step "${s.id}" references unknown target step: ${a}`,suggestion:`Make sure step "${a}" exists in the tour`})}}var Yd=new Set(["onclick","onerror","onload","onmouseover","onfocus","onblur","onchange","onsubmit","onkeydown","onkeyup","onkeypress"]),$l=5e4,Ml=50;function jt(r){let e=[],t=[];if(!r||typeof r!="object")return e.push({code:"INVALID_ACTION",message:"Action must be an object"}),{valid:!1,errors:e,warnings:t};let{kind:n}=r;if(!n||typeof n!="string")return e.push({code:"MISSING_KIND",message:"Action must have a 'kind' property"}),{valid:!1,errors:e,warnings:t};if(!Il(n)&&n!=="core:mountWidget"){let i=ir.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":kr(r,e,t);break;case"overlays:badge":kr(r,e,t),Nd(r,e,t);break;case"overlays:tooltip":kr(r,e,t),Fd(r,e,t);break;case"overlays:modal":Gd(r,e,t);break;case"content:insertHtml":kr(r,e,t),Dd(r,e,t);break;case"content:setText":kr(r,e,t),Hd(r,e,t);break;case"content:setAttr":kr(r,e,t),Bd(r,e,t);break;case"content:addClass":case"content:removeClass":kr(r,e,t),Vd(r,e,t);break;case"content:setStyle":kr(r,e,t),Ud(r,e,t);break;case"core:mountWidget":jd(r,e,t);break;case"core:wait":Wd(r,e,t);break;case"core:sequence":zd(r,e,t);break;case"core:parallel":qd(r,e,t);break;case"overlays:tour":Kd(r,e,t);break;case"navigation:navigate":Zd(r,e,t);break}return{valid:e.length===0,errors:e,warnings:t}}function kr(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 ho(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=jt(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 TE=0;function Pl(r){let{overlayRoot:e,eventBus:t,surfaces:n,anchorResolver:i,waitForAnchor:s,adaptiveId:o,executorRegistry:a=ir,subscribeNavigation:l,runtime:c}=r,u=new Map,p=new Map;function h(){return`action-${++TE}`}function f(_,A){t&&t.publish(_,A)}function v(){return{overlayRoot:e,resolveAnchor:i,waitForAnchor:s,generateId:h,publishEvent:f,adaptiveId:o,applyAction:x,subscribeEvent:t?(_,A)=>t.subscribe({names:[_]},$=>A($.props)):void 0,subscribeNavigation:l}}async function g(_,A){if(!n)throw new Error("Surfaces provider required for core:mountWidget actions");let $=n.mount(_.slot,{type:"widget",widgetId:_.widget.widgetId,config:_.widget.props},{priority:_.widget.priority});return A.publishEvent("action.applied",{id:A.generateId(),kind:"core:mountWidget",slot:_.slot,widgetId:_.widget.widgetId}),{cleanup:()=>{$.unmount()},updateFn:T=>{if("widget"in T&&T.widget){let P=T.widget;P.props&&$.update({type:"widget",widgetId:_.widget.widgetId,config:P.props})}}}}async function m(_,A){if(_.kind==="core:mountWidget")return g(_,A);let $=a.get(_.kind);if(!$){let T="list"in a?a.list():"(list unavailable)";throw console.error(`[ActionEngine] No executor for kind="${_.kind}".`,`Registered: [${T}]`),new Error(`No executor for action kind: ${_.kind}`)}return $(_,A)}function y(_,A,$,T){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($).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:A.kind})}else if(L.state==="deferred"&&K)try{let le=v(),j=await m(A,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 A=jt(_);if(!A.valid){let G=A.errors.map(K=>K.message).join("; ");throw console.error(`[ActionEngine] Validation failed for action kind="${_?.kind}":`,G,_),new Error(`Action validation failed: ${G}`)}let $=h(),T=_.triggerWhen;if(T&&c&&!c.evaluateSync(T).value){let K={id:$,action:_,adaptiveId:o,appliedTs:Date.now(),state:"deferred",cleanup:()=>{}};u.set($,K);let le={id:$,action:_,async revert(){let j=u.get($);if(!j)return;let ee=p.get($);if(ee){for(let D of ee)D();p.delete($)}j.state="reverted",u.delete($)},isApplied(){return u.get($)?.state==="applied"},async update(j){let ee=u.get($);if(!ee||ee.state!=="applied")throw new Error("Cannot update action that is not applied");if(ee.updateFn)await ee.updateFn(j);else throw new Error(`Action kind ${_.kind} does not support updates`)},getState(){return u.get($)?.state??"reverted"}};return y($,_,T,le),le}let P=v(),Y=await m(_,P),F={id:$,action:_,adaptiveId:o,appliedTs:Date.now(),state:"applied",cleanup:Y.cleanup,updateFn:Y.updateFn};u.set($,F);let L={id:$,action:_,async revert(){let G=u.get($);if(!G||G.state!=="applied")return;let K=p.get($);if(K){for(let le of K)le();p.delete($)}try{await G.cleanup(),G.state="reverted",f("action.reverted",{id:$,kind:_.kind})}catch(le){console.warn(`[ActionEngine] Cleanup error for ${_.kind} (${$}), ignoring:`,le),G.state="reverted",f("action.reverted",{id:$,kind:_.kind})}finally{u.delete($)}},isApplied(){return u.get($)?.state==="applied"},async update(G){let K=u.get($);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($)?.state??"reverted"}};return T&&c&&y($,_,T,L),L}async function S(_){console.log(`[ActionEngine] applyBatch: ${_.length} action(s)`,_.map(F=>F.kind).join(", "));let A=ho(_);if(!A.valid){let F=A.errors.map(L=>L.message).join("; ");throw console.error(`[ActionEngine] Batch validation FAILED for ${_.length} action(s):`,F,`
|
|
793
|
+
Actions:`,_.map((L,G)=>` [${G}] ${L.kind} ${L.anchorId?`anchor="${L.anchorId.selector}"`:""} ${L.label?`label="${L.label}"`:""}`).join(`
|
|
794
|
+
`)),new Error(`Batch validation failed: ${F}`)}let $=h(),T=[],P=[];try{let F=await Promise.allSettled(_.map(G=>x(G))),L=[];for(let G of F)G.status==="fulfilled"?(T.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:$,handles:T,async revertAll(){for(let F=T.length-1;F>=0;F--)try{await T[F].revert()}catch(L){console.error(`[ActionEngine] Error reverting action ${T[F].id}:`,L)}},isApplied(){return T.every(F=>F.isApplied())}}}function b(_){return jt(_)}function w(){return Array.from(u.values()).map(_=>({id:_.id,action:_.action,adaptiveId:_.adaptiveId,appliedTs:_.appliedTs,state:_.state}))}async function C(){for(let A of p.values())for(let $ of A)try{$()}catch{}p.clear();let _=[];for(let A of u.values())if(A.state==="applied")try{let $=A.cleanup();$&&typeof $.then=="function"&&_.push($.catch(T=>{console.error("[ActionEngine] Error during async cleanup:",T)}))}catch($){console.error("[ActionEngine] Error during cleanup:",$)}u.clear(),_.length>0&&await Promise.all(_)}return{apply:x,applyBatch:S,validate:b,getActive:w,destroy:C}}var Xd=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.")}),fo=d.object({routes:Xd,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 IE(r){return br.safeParse(r)}function $E(r){return Ti.safeParse(r)}function ME(r){return fo.safeParse(r)}var PE=[{defName:"matchOp",schema:wi},{defName:"counterDef",schema:Si},{defName:"activationConfig",schema:fo},{defName:"routeFilter",schema:Xd},{defName:"ruleStrategy",schema:Ei},{defName:"scoreStrategy",schema:Ci},{defName:"modelStrategy",schema:Ai},{defName:"externalStrategy",schema:Ri},{defName:"rule",schema:ki},{defName:"condition",schema:br}];var Jd=d.object({tileId:d.string(),itemId:d.string().optional()}).strict(),OE=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:Jd.optional()}).strict(),LE=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:fo.optional(),notifications:d.array(OE).optional()}).strict(),fy=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()}),NE=d.object({canvas:fy.optional()}),FE=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()}),DE=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()}),HE=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()}),BE=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()}),VE=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()}),UE=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:fy.optional(),launcher:FE.optional(),tile:DE.optional(),overlay:HE.optional(),notification:BE.optional(),content:VE.optional(),mobile:NE.optional()}).strict(),jE=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(),b4=d.object({schemaVersion:d.string().optional(),fetchedAt:d.string().datetime(),configVersion:d.string().optional(),canvasTitle:d.string().optional(),displayMode:d.enum(["standard","focused","inline"]).optional(),tiles:d.array(LE),actions:d.array(d.any()),theme:UE.optional(),launcher:jE.optional(),meta:d.object({verificationSteps:d.array(d.union([d.string(),d.object({text:d.string(),check:br.optional()})])).optional()}).passthrough().optional()}).strict();var Ge={triggerWhen:Xs},bt=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),Qd=d.object({color:d.string().optional(),scrimOpacity:d.number().min(0).max(1).optional(),paddingPx:d.number().optional(),radiusPx:d.number().optional()}).strict(),ep=d.enum(["top-left","top-right","bottom-left","bottom-right"]),tp=d.enum(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"]),Ll=d.object({label:d.string(),actionId:d.string(),primary:d.boolean().optional()}).strict(),rp=d.object({title:d.string().optional(),body:d.string(),ctaButtons:d.array(Ll).optional()}).strict(),np=d.object({title:d.string().optional(),body:d.string()}).strict(),ip=d.enum(["before","after","prepend","append","replace"]),sp=d.enum(["immediate","hover","click"]),op=d.object({widgetId:d.string(),props:d.record(d.unknown()).optional(),priority:d.number().optional()}).strict(),ap=d.object({id:d.string(),action:d.any(),route:d.string().optional(),onAction:d.record(d.string()).optional()}).passthrough(),lp=d.enum(["auto","smooth","instant"]),Ol=d.enum(["start","center","end","nearest"]),cp=d.object({kind:d.literal("content:setText"),anchorId:bt,text:d.string(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),up=d.object({kind:d.literal("content:setAttr"),anchorId:bt,attr:d.string(),value:d.string(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),dp=d.object({kind:d.literal("content:addClass"),anchorId:bt,className:d.string(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),pp=d.object({kind:d.literal("content:removeClass"),anchorId:bt,className:d.string(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),hp=d.object({kind:d.literal("content:setStyle"),anchorId:bt,styles:d.record(d.string()),label:d.string().optional()}).extend(Ge).extend(Be).strict(),fp=d.object({kind:d.literal("content:insertHtml"),anchorId:bt,html:d.string(),position:ip,deepLink:Jd.optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),gp=d.object({kind:d.literal("overlays:highlight"),anchorId:bt,style:Qd.optional(),duration:d.number().optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),mp=d.object({kind:d.literal("overlays:pulse"),anchorId:bt,duration:d.number().optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),vp=d.object({kind:d.literal("overlays:badge"),anchorId:bt,content:d.string(),position:ep.optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),yp=d.object({kind:d.literal("overlays:tooltip"),anchorId:bt,content:rp,trigger:sp.optional(),placement:tp.optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),bp=d.object({kind:d.literal("overlays:modal"),content:np,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(Ll).optional(),waitFor:d.string().optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),_p=d.object({kind:d.literal("navigation:scrollTo"),anchorId:bt,behavior:lp.optional(),block:Ol.optional(),inline:Ol.optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),xp=d.object({kind:d.literal("navigation:navigate"),url:d.string(),target:d.enum(["_self","_blank"]).optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),wp=d.object({kind:d.literal("core:mountWidget"),slot:d.string(),widget:op,label:d.string().optional()}).extend(Ge).extend(Be).strict(),Sp=d.object({kind:d.literal("core:wait"),durationMs:d.number().min(0).optional(),event:d.string().optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),kp=d.object({kind:d.literal("core:sequence"),actions:d.array(d.any()),label:d.string().optional()}).extend(Ge).extend(Be).strict(),Ep=d.object({kind:d.literal("core:parallel"),actions:d.array(d.any()),waitFor:d.enum(["all","any"]).optional(),label:d.string().optional()}).extend(Ge).extend(Be).strict(),Cp=d.object({kind:d.literal("overlays:tour"),tourId:d.string(),steps:d.array(ap).min(1),startStep:d.string().optional(),autoStart:d.boolean().optional(),label:d.string().optional()}).extend(Ge).extend(Be).passthrough(),gy=[{defName:"setText",schema:cp},{defName:"setAttr",schema:up},{defName:"addClass",schema:dp},{defName:"removeClass",schema:pp},{defName:"setStyle",schema:hp},{defName:"insertHtml",schema:fp},{defName:"highlight",schema:gp},{defName:"pulse",schema:mp},{defName:"badge",schema:vp},{defName:"tooltip",schema:yp},{defName:"modal",schema:bp},{defName:"scrollTo",schema:_p},{defName:"navigate",schema:xp},{defName:"mountWidget",schema:wp},{defName:"wait",schema:Sp},{defName:"sequence",schema:kp},{defName:"parallel",schema:Ep},{defName:"tour",schema:Cp}];function Nl(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 C={resolve:b,reject:w,timer:setTimeout(()=>{p(m,C),w(new Error(`waitFor("${m}") timed out after ${S}ms`))},S)},_=n.get(m);_||(_=new Set,n.set(m,_)),_.add(C),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 my={timeout:300,className:"sc-anti-flicker",style:"opacity: 0 !important",hostLoadingSelector:"",waitForHostReady:""};function vy(r={}){let{timeout:e,className:t,style:n,hostLoadingSelector:i,waitForHostReady:s}={...my,...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 yy(r={}){let{className:e,style:t}={...my,...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 WE=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function by(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 Ze("Syntro Runtime",`Failed to decode ${r}:`,n),null}}var Ap="__syntro_rt_editor_source",Rp="__syntro_rt_editor_conf";function Fl(r,e){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}}function _y(r){try{let e=sessionStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}var Gr,Kr;function mo(){if(Gr==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.token)Gr={token:r.token,api_base:r.apiBase||""},Fl(Ap,Gr),console.log(`[DIAG] getEditorSource: from __SYNTRO_EDITOR_PARAMS__ (token=${Gr.token.slice(0,15)}...)`);else{let e=by("editor_source");if(e)Gr=e,Fl(Ap,e);else{let t=_y(Ap);t?.token&&(Gr=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 Gr??null}function Dl(){if(Kr==null){let r=typeof window<"u"?window.__SYNTRO_EDITOR_PARAMS__:null;if(r?.mode)Kr={mode:r.mode,audit_session_id:r.auditSessionId,syntro_token:r.syntroToken,workspace_id:r.workspaceId},Fl(Rp,Kr),console.log(`[DIAG] getEditorConf: from __SYNTRO_EDITOR_PARAMS__ (mode=${Kr.mode})`);else{let e=by("editor_conf");if(e)Kr=e,Fl(Rp,e);else{let t=_y(Rp);t?.mode&&(Kr=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 Kr??null}function zE(r){Z("Syntro Runtime","Validating editor URL:",r);try{if(r.startsWith("/"))return Z("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",r),!0;let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(Ze("Syntro Runtime","\u274C Editor URL must use HTTPS:",r),!1):WE.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i)?(Z("Syntro Runtime","\u2713 Editor URL validated"),!0):(Ze("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return Ze("Syntro Runtime",`\u274C Invalid editor URL: ${r}`,e),!1}}var Hl=()=>{let r=Dl();return!mo()?.token||!r?.mode?null:r.mode};function qE(){return mo()?.token??null}function ZE(){return mo()?.api_base??null}var go=null,xy=async r=>{if(Z("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){Z("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){Z("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}if(go)return Z("Syntro Runtime","Editor SDK load already in progress, waiting..."),go;let e=typeof r=="string"?{editorUrl:r}:r??{};if(e.editorUrl==="skip"){Z("Syntro Runtime",'editorUrl="skip" \u2014 deferring to caller'),Z("Syntro Runtime","================================");return}let t=ZE(),i=(t?`${t}/api/editor/sdk/editor-sdk.js`:null)||e.editorUrl;if(!i){Ze("Syntro Runtime","\u274C No editor SDK URL available (no api_base, no editorUrl option)"),Z("Syntro Runtime","================================");return}let s=qE(),o=s?`${i}?token=${encodeURIComponent(s)}`:i;if(Z("Syntro Runtime","Editor URL:",o),Z("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,hasEditorUrl:!!i,hasApiBase:!!t,tokenPrefix:s?`${s.slice(0,10)}...`:"none"}),!zE(i)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",i),Z("Syntro Runtime","================================");return}return Z("Syntro Runtime","\u2713 URL validated, injecting script tag..."),go=new Promise((a,l)=>{let c=document.createElement("script");c.src=o,c.async=!0,e.integrity&&(c.integrity=e.integrity,c.crossOrigin="anonymous",Z("Syntro Runtime","SRI integrity check enabled")),c.onload=()=>{Z("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),Z("Syntro Runtime","================================"),a()},c.onerror=u=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",u),console.error("[Syntro Runtime] URL attempted:",o),Z("Syntro Runtime","================================"),go=null,l(u)},document.head.appendChild(c),Z("Syntro Runtime","Script tag appended to <head>")}),go};var sr=null;function Sy(r){sr&&sr!==r?r.appendChild(sr):sr=r;let e=r.getRootNode();e instanceof ShadowRoot&&GE(e)}function ky(){return sr||(sr=document.createElement("div"),sr.id="syntro-overlays",Object.assign(sr.style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),document.body.appendChild(sr)),sr}var wy=!1;function GE(r){if(wy)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((N,Z)=>` [${Z}] ${N.kind} ${N.anchorId?`anchor="${N.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),oy=!0}var Nl=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=ty(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&&Vn(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=Pl();lo();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??Dn({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&&ay(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),sy(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&&Vn(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 Nl(r)}});var xp="syn_";function Di(r){if(!r.startsWith(xp))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(xp.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 Ll(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return xp+t}function It(r){if(typeof process<"u"&&process.env)return process.env[r]}var uy="syntro_segment_attributes";function dy(){if(typeof window>"u")return{};try{let r=localStorage.getItem(uy);if(r){let e=JSON.parse(r);return G("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){ot("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function py(r){if(!(typeof window>"u"))try{localStorage.setItem(uy,JSON.stringify(r)),G("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){ot("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function hy(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 wp(){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 cy="syntro_geo",fy="https://geo.syntrologie.com";async function kp(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(cy);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(cy,JSON.stringify(n))}catch{}return G("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var Sp=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(/\/[^/]*$/,"");Sp=`${e.origin}${t}`}}catch{Sp=null}function gy(){return Sp}var my="app:",EE="syntro:",CE=/^[a-z][a-z0-9_]*$/;function Fl(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(EE))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(my))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(my.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(!CE.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function AE(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function vy(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)&&!vy(n,e,t+1))return!1;return!0}function Dl(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(!vy(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"||AE(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Hl(r,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(r.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(n=>{try{return new RegExp(n).test(r.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(r.source)):!0}var vo=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:$e};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let t of this.subscriptions)if(Hl(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=Fl(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=Dl(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:$e};this.history.push(s),this.history.length>this.maxHistorySize&&this.history.shift();let o=0;for(let l of this.subscriptions)if(Hl(s,l.filter))try{l.callback(s),o++}catch(c){console.error("[EventBus] Subscriber error:",c),o++}let a=!1;if(this.posthogCapture&&!this.testMode)try{this.posthogCapture(e,t),a=!0}catch(l){console.error("[EventBus] PostHog capture error:",l)}if(this.emitHistory&&this.emitHistory.record({name:e,props:t,source:"custom",timestamp:s.ts,matchedRules:[]}),this.debug)return console.debug("[EventBus] emit()",{name:e,props:t,listenersNotified:o,posthogCaptured:a}),{delivered:!0,matchedRules:[],posthogCaptured:a,listenersNotified:o}}setPosthogCapture(e){this.posthogCapture=e}getRecent(e,t){let n=this.history;return e&&(n=n.filter(i=>Hl(i,e))),t&&t>0&&(n=n.slice(-t)),n}hasRecentEvent(e,t,n){let i=Date.now()-t;return this.history.some(s=>s.name===e&&s.ts>=i&&(n===void 0||s.source===n))}countRecentEvents(e,t){let n=this.history.filter(i=>Hl(i,e));if(t!==void 0){let i=Date.now()-t;n=n.filter(s=>s.ts>=i)}return n.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function Hi(r={}){return new vo(r)}var Bi=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 by={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function _y(){return by}function Ep(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 yo(r,e,t){return t===2?Ep(Ep(r+e)+"")%1e4/1e4:t===1?Ep(e+r)%1e3/1e3:null}function RE(r){return r<=0?[]:new Array(r).fill(1/r)}function Bl(r,e){return r>=e[0]&&r<e[1]}function xy(r,e){let t=yo("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function wy(r,e){for(let t=0;t<e.length;t++)if(Bl(r,e[t]))return t;return-1}function Ap(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function Vl(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=$E(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 TE(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 IE(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=>!TE(i[0],i[1],i[2]))}catch{return!1}}function $E(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=Ap(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return IE(n,t);return!1}catch{return!1}}function ky(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=RE(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 Sy(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 Ey(r){try{return r()}catch(e){return console.error(e),!1}}var Cp=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function Kn(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||by.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Cp(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Cp(i)},n,Cp(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function bo(r){return typeof r=="string"?r:JSON.stringify(r)}function bt(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 Cy(){let r;try{r="1.6.4"}catch{r=""}return r}function Ay(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 yy(r){return typeof r=="object"&&r!==null}function jl(r){return r.urlPatterns&&r.variations.some(e=>yy(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>yy(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Ul(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 tt={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},or=_y(),Vi={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>or.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 or.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new or.EventSource(`${r}/sub/${e}`,{headers:t}):new or.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),PE()):document.visibilityState==="hidden"&&(r=window.setTimeout(OE,tt.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(or.localStorage=globalThis.localStorage)}catch{}var ji=new Map,Ry=!1,Er=new Map,Wl=new Map,Ui=new Map,Wi=new Set;function Iy(r){Object.assign(tt,r),tt.backgroundSync||Op()}async function $y({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(tt.backgroundSync=!1),NE({instance:r,allowStale:n,timeout:e,skipCache:t})}function ME(r){let e=_o(r),t=ji.get(e)||new Set;t.add(r),ji.set(e,t)}function My(r){ji.forEach(e=>e.delete(r))}function OE(){Ui.forEach(r=>{r&&(r.state="idle",$p(r))})}function PE(){Ui.forEach(r=>{r&&r.state==="idle"&&Mp(r)})}async function Ty(){try{if(!or.localStorage)return;await or.localStorage.setItem(tt.cacheKey,JSON.stringify(Array.from(Er.entries())))}catch{}}async function NE({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=_o(r),s=Tp(r),o=new Date,a=new Date(o.getTime()-tt.maxAge+tt.staleTTL);await LE();let l=!tt.disableCache&&!n?Er.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Wi.add(i),l.staleAt<o?Rp(r):Ip(r),{data:l.data,success:!0,source:"cache"}):await Ul(Rp(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function _o(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function Tp(r){let e=_o(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 LE(){if(!Ry){Ry=!0;try{if(or.localStorage){let r=await or.localStorage.getItem(tt.cacheKey);if(!tt.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{Er.set(t,{...n,staleAt:new Date(n.staleAt)})}),Oy()}}}catch{}if(!tt.disableIdleStreams){let r=Vi.startIdleListener();r&&(Vi.stopIdleListener=r)}}}function Oy(){let r=Array.from(Er.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,Er.size-tt.maxEntries),Er.size);for(let t=0;t<e;t++)Er.delete(r[t].key)}function Py(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+tt.staleTTL),s=tt.disableCache?void 0:Er.get(e);if(s&&n&&s.version===n){s.staleAt=i,Ty();return}tt.disableCache||(Er.set(e,{data:t,version:n,staleAt:i,sse:Wi.has(r)}),Oy()),Ty();let o=ji.get(r);o&&o.forEach(a=>FE(a,t))}async function FE(r,e){await r.setPayload(e||r.getPayload())}async function Rp(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=_o(r),o=Tp(r),a=Wl.get(o);return a||(a=(i?Vi.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Vi.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"&&Wi.add(s),c.json()}).then(c=>(Py(s,o,c),Ip(r),Wl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(Wl.delete(o),{data:null,source:"error",success:!1,error:c})),Wl.set(o,a)),a}function Ip(r,e=!1){let t=_o(r),n=Tp(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Wi.add(t),tt.backgroundSync&&Wi.has(t)&&or.EventSource){if(Ui.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=>{Rp(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);Py(t,n,c)}a.errors=0}catch{Ny(a)}},errors:0,state:"active"};Ui.set(t,a),Mp(a)}}function Ny(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);$p(r),setTimeout(()=>{["idle","active"].includes(r.state)||Mp(r)},Math.min(e,3e5))}}function $p(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function Mp(r){r.src=Vi.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=()=>Ny(r),r.src.onopen=()=>{r.errors=0}}function DE(r,e){$p(r),Ui.delete(e)}function Op(){Wi.clear(),Ui.forEach(DE),ji.clear(),Vi.stopIdleListener()}function zl(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&Ip(r,!0),ME(r)}}var HE=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Lp={revert:function(){}},Kl=new Map,Fp=new Set;function BE(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function Yl(r){var e=Kl.get(r);return e||(e={element:r,attributes:{}},Kl.set(r,e)),e}function Xl(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,BE(e)),o}function Jl(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,Ly()):r!==t&&(e.isDirty=!0,Ly())}function VE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Jl(tC(e),r)}function jE(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),Jl(Array.from(e).filter(Boolean).join(" "),r)}function UE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Jl(e,r)}function WE(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 zE(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=WE(n);e=i||e}),Jl(e,r)}var qE=function(e){return e.innerHTML},ZE=function(e,t){return e.innerHTML=t};function Dy(r){var e=Yl(r);return e.html||(e.html=Xl(r,"html",qE,ZE,VE)),e.html}var GE=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},KE=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function Hy(r){var e=Yl(r);return e.position||(e.position=Xl(r,"position",GE,KE,zE)),e.position}var YE=function(e,t){return t?e.className=t:e.removeAttribute("class")},XE=function(e){return e.className};function By(r){var e=Yl(r);return e.classes||(e.classes=Xl(r,"class",XE,YE,jE)),e.classes}var JE=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},QE=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function Vy(r,e){var t=Yl(r);return t.attributes[e]||(t.attributes[e]=Xl(r,e,JE(e),QE(e),UE)),t.attributes[e]}function eC(r,e){var t=Kl.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 ql;function tC(r){return ql||(ql=document.createElement("div")),ql.innerHTML=r,ql.innerHTML}function Zl(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||eC(r,e),t.setValue(r,n)}}function rC(r,e){r.html&&Zl(e,"html",r.html),r.classes&&Zl(e,"class",r.classes),r.position&&Zl(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){Zl(e,t,r.attributes[t])})}function Ly(){Kl.forEach(rC)}function nC(r,e){var t=null;r.kind==="html"?t=Dy(e):r.kind==="class"?t=By(e):r.kind==="attribute"?t=Vy(e,r.attribute):r.kind==="position"&&(t=Hy(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function iC(r,e){var t=null;if(r.kind==="html"?t=Dy(e):r.kind==="class"?t=By(e):r.kind==="attribute"?t=Vy(e,r.attribute):r.kind==="position"&&(t=Hy(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function jy(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),nC(r,n))})}}function sC(r){r.elements.forEach(function(e){return iC(r,e)}),r.elements.clear(),Fp.delete(r)}function Fy(){Fp.forEach(jy)}var Pp;function oC(){typeof document>"u"||(Pp||(Pp=new MutationObserver(function(){Fy()})),Fy(),Pp.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}oC();function Ql(r){return typeof document>"u"?Lp:(Fp.add(r),jy(r),{revert:function(){sC(r)}})}function Np(r,e){return Ql({kind:"html",elements:new Set,mutate:e,selector:r})}function Uy(r,e){return Ql({kind:"position",elements:new Set,mutate:e,selector:r})}function xo(r,e){return Ql({kind:"class",elements:new Set,mutate:e,selector:r})}function Gl(r,e,t){return HE.test(e)?e==="class"||e==="className"?xo(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)})}):Ql({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):Lp}function aC(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 Np(e,function(a){return a+(n??"")});if(t==="set")return Np(e,function(){return n??""})}else if(i==="class"){if(t==="append")return xo(e,function(a){n&&a.add(n)});if(t==="remove")return xo(e,function(a){n&&a.delete(n)});if(t==="set")return xo(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return Uy(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return Gl(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return Gl(e,i,function(){return n??""});if(t==="remove")return Gl(e,i,function(){return null})}return Lp}var lC={html:Np,classes:xo,attribute:Gl,position:Uy,declarative:aC},Wy=lC;var Dp={};function Yr(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!Zy(r,i,t))return!1;break;case"$nor":if(Zy(r,i,t))return!1;break;case"$and":if(!hC(r,i,t))return!1;break;case"$not":if(Yr(r,i,t))return!1;break;default:if(!wo(i,cC(r,n),t))return!1}return!0}function cC(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 zy(r,e=!1){let t=`${r}${e?"/i":""}`;return Dp[t]||(Dp[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Dp[t]}function wo(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)||!Gy(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!pC(i,e,r[i],t))return!1;return!0}function Gy(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function uC(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 dC(r,e,t){if(!Array.isArray(r))return!1;let n=Gy(e)?i=>wo(e,i,t):i=>Yr(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function zi(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 qy(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(wo(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function pC(r,e,t,n){switch(r){case"$veq":return bt(e)===bt(t);case"$vne":return bt(e)!==bt(t);case"$vgt":return bt(e)>bt(t);case"$vgte":return bt(e)>=bt(t);case"$vlt":return bt(e)<bt(t);case"$vlte":return bt(e)<=bt(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)?zi(e,t):!1;case"$ini":return Array.isArray(t)?zi(e,t,!0):!1;case"$inGroup":return zi(e,n[t]||[]);case"$notInGroup":return!zi(e,n[t]||[]);case"$nin":return Array.isArray(t)?!zi(e,t):!1;case"$nini":return Array.isArray(t)?!zi(e,t,!0):!1;case"$not":return!wo(t,e,n);case"$size":return Array.isArray(e)?wo(t,e.length,n):!1;case"$elemMatch":return dC(e,t,n);case"$all":return Array.isArray(t)?qy(e,t,n):!1;case"$alli":return Array.isArray(t)?qy(e,t,n,!0):!1;case"$regex":try{return zy(t).test(e)}catch{return!1}case"$regexi":try{return zy(t,!0).test(e)}catch{return!1}case"$type":return uC(e)===t;default:return console.error("Unknown operator: "+r),!1}}function Zy(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(Yr(r,e[n],t))return!0;return!1}function hC(r,e,t){for(let n=0;n<e.length;n++)if(!Yr(r,e[n],t))return!1;return!0}var fC="Feature Evaluated",gC="Experiment Viewed";function mC(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 vC(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 qi(r){try{await r()}catch{}}function Ky(r,e,t){if(r.user.trackedExperiments){let i=rc(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(qi(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(qi(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(qi(()=>i(gC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function yC(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;qi(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;qi(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;qi(()=>n(fC,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function ec(r,e){if(e.stack.evaluatedFeatures.has(r))return Xr(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=mC(e);if(t.has(r))return Xr(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return Xr(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=ec(l.id,e);if(c.source==="cyclicPrerequisite")return Xr(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!Yr(u,l.condition||{})){if(l.gate)return Xr(e,r,null,"prerequisite");continue e}}if(s.filters&&Jy(s.filters,e))continue;if("force"in s){if(s.condition&&!Xy(s.condition,e)||!bC(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=>{!Ky(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Xr(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}=tc(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Xr(e,r,a.value,"experiment",s.id,o,a)}}return Xr(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function tc(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:Te(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Te(t,r,-1,!1,e)};if(r=_C(r,t),r.urlPatterns&&!Vl(t.user.url||"",r.urlPatterns))return{result:Te(t,r,-1,!1,e)};let s=Sy(n,t.user.url||"",i);if(s!==null)return{result:Te(t,r,s,!1,e)};let o=vC(t);if(n in o){let m=o[n];return{result:Te(t,r,m,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:Te(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=Yn(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:Te(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:m,versionIsBlocked:y}=kC({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(Jy(r.filters,t))return{result:Te(t,r,-1,!1,e)}}else if(r.namespace&&!xy(l,r.namespace))return{result:Te(t,r,-1,!1,e)};if(r.include&&!Ey(r.include))return{result:Te(t,r,-1,!1,e)};if(r.condition&&!Xy(r.condition,t))return{result:Te(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=ec(y.id,t);if(x.source==="cyclicPrerequisite")return{result:Te(t,r,-1,!1,e)};let k={value:x.value};if(!Yr(k,y.condition||{}))return{result:Te(t,r,-1,!1,e)}}}if(r.groups&&!wC(r.groups,t))return{result:Te(t,r,-1,!1,e)}}if(r.url&&!xC(r.url,t))return{result:Te(t,r,-1,!1,e)};let h=yo(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:Te(t,r,-1,!1,e)};if(!u){let m=r.ranges||ky(i,r.coverage===void 0?1:r.coverage,r.weights);c=wy(h,m)}if(p)return{result:Te(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:Te(t,r,-1,!1,e)};if("force"in r)return{result:Te(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Te(t,r,-1,!1,e)};if(r.status==="stopped")return{result:Te(t,r,-1,!1,e)};let f=Te(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:m,key:y,doc:x}=EC(t,a,bo(l),{[Hp(r.key,r.bucketVersion)]:f.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=Ky(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 Xr(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"&&yC(r,e,a),a}function Yy(r){return{...r.user.attributes,...r.user.attributeOverrides}}function Xy(r,e){return Yr(Yy(e),r,e.global.savedGroups||{})}function Jy(r,e){return r.some(t=>{let{hashValue:n}=Yn(e,t.attribute);if(!n)return!0;let i=yo(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Bl(i,s))})}function bC(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Yn(r,t,n);if(!a)return!1;let l=yo(e,a,o||1);return l===null?!1:i?Bl(l,i):s!==void 0?l<=s:!0}function Te(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}=Yn(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 _C(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=Ap(r.url))),r}function Yn(r,e,t){let n=e||"id",i="",s=Yy(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function xC(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 wC(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function kC({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=Hp(e,t),l=SC(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=Hp(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 Hp(r,e){return e=e||0,`${r}__${e}`}function Bp(r,e){return`${r}||${e}`}function SC(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=Yn(r,e),s=Bp(n,bo(i)),{hashAttribute:o,hashValue:a}=Yn(r,t),l=a?Bp(o,bo(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 EC(r,e,t,n){let i=Bp(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 CC(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 Qy(r,e,t){let n=Vp(r,t);return e.getAllAssignments(n)}function Vp(r,e){let t={};return CC(r,e).forEach(i=>{let{hashValue:s}=Yn(r,i);t[i]=bo(s)}),t}async function eb(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await Kn(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await Kn(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await Kn(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function tb(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 rc(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var Zi=typeof window<"u"&&typeof document<"u",AC=Cy(),ko=class{constructor(e){if(e=e||{},this.version=AC,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),Zi&&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 eb(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,zl(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Iy(e.cacheSettings),e.payload)return await this.setPayload(e.payload),zl(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return zl(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 tb(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 $y({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 Kn(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 Kn(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,My(this),e.destroyAllStreams&&Op(),this.logs=[],Zi&&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}=tc(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=Te(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=tc(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&n&&n.valueHash===a)return s;if(n&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=jl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Ay(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(Vl(c,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),s;this._redirectedUrl=c;let{navigate:u,delay:p}=this._getNavigateFunction();if(u)if(Zi)Promise.all([...o?[Ul(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&&jl(i)==="redirect")break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(i=>{try{i(e,t)}catch(s){console.error(s)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return ec(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=>[rc(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(rc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Zi?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=jl(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(n=>n.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let n=new URL(this._getContextUrl());for(let i of e.variations){if(!i||!i.urlRedirect)continue;let s=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==n.protocol||s.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:e.key,error:n}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:Zi?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Zi)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(Wy.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await Qy(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let n=this._getEvalContext(),i=Vp(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var RC="https://experiment.syntrologie.com",jp=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 ko({...e,apiHost:e.apiHost??RC,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 nc(r={}){return new jp(r)}var rb={growthbook:r=>nc({...r,autoInit:!0})};function nb(r,e){let t=rb[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(rb).join(", ")}`);return t(e)}var TC=["cdn.syntrologie.com","localhost","127.0.0.1"];function IC(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):TC.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 Up=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!IC(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 $C(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 $C(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 ib(r){return new Up(r)}var MC="syntro_exp",OC="syntro_var",Wp=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(MC),o=i.get(OC);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:gl(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 sb(r){return new Wp(r)}var PC="https://cdn.syntrologie.com/configs",ob={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return ib({baseUrl:r.baseUrl??PC,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return sb({featureKey:r.featureKey})}};function ab(r,e={}){let t=ob[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(ob).join(", ")}`);return t(e)}var lb="syntro_session_metrics",So=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(lb);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(lb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function ic(r={}){return new So(r)}var sc=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 oc=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 sc(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 NC=[()=>new oc];function cb(){for(let r of NC){let e=r();if(e.detect())return e}return null}var zp="syntro_experiments";var FC=720*60*60,ac=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}destroy(){document.cookie=`${zp}=; 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=`${zp}=${t}; max-age=${FC}; path=/; SameSite=Lax`;document.cookie=n}};function db(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function Zp(r,e){return r==="telegram"||r==="mcp-app"?"agent":e==="mobile"?"mobile":"desktop"}function DC(r="web",e="web"){let t=Date.now(),n=typeof window<"u"?window.innerWidth:0,i=typeof window<"u"?window.innerHeight:0,s=db(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:Zp(r,s)}}}function qp(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(ub(t,n))return}if(e.include){for(let n of e.include)if(ub(t,n))return n;return}return t}function ub(r,e){let t=r.replace(/\/$/,"")||"/",n=e.replace(/\/$/,"")||"/";if(t===n)return!0;let i=n.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var Eo=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=DC(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=qp(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=qp(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=Zp(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=db(e.width);if(s!==this.context.surface.device){let o=Zp(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=qp(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 Eo(r)}function Gp(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 Kp(r,e){let t=[];for(let n of r.conditions){let i=Gp(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Co(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=Kp(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 Ao(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 pb(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 Yp(r,e,t={}){let n=pb(e,t);switch(r.type){case"rules":return Co(r,n);case"score":return Ao(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 Xp(r,e,t={}){let n=pb(e,t);switch(r.type){case"rules":return Co(r,n);case"score":return Ao(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 cc(r){return{evaluate:(e,t)=>Yp(e,t,r),evaluateSync:(e,t)=>Xp(e,t,r)}}function uc(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 Gi=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 Jp="cooldown:";function hb(r){return{set(e,t){let n=Jp+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Jp+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=Jp+e;r.remove(t)}}}var Ro="dismissed:";function fb(r,e){return{mark(t,n=!1){let i=Ro+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Ro+t;return r.has(n)||e.has(n)},clear(t){let n=Ro+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Ro)&&r.remove(t);for(let t of e.keys())t.startsWith(Ro)&&e.remove(t)}}}var Qp="freq:";function gb(r){function e(t){let n=Qp+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=Qp+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=Qp+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var HC="syntro";function eh(r,e){let t=`${e}:`;return{get(n){if(r)try{let i=r.getItem(t+n);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){r.removeItem(t+n);return}return s.value}catch{return}},set(n,i,s){if(r)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};r.setItem(t+n,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(n){r&&r.removeItem(t+n)},has(n){return r?this.get(n)!==void 0:!1},keys(){if(!r)return[];let n=[];for(let i=0;i<r.length;i++){let s=r.key(i);s?.startsWith(t)&&n.push(s.slice(t.length))}return n},clear(){if(!r)return;let n=this.keys();for(let i of n)r.removeItem(t+i)}}}function To(r){let e=new Map,t=`${r}:`;return{get(n){let i=e.get(t+n);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+n);return}return i.value}},set(n,i,s){e.set(t+n,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(n){e.delete(t+n)},has(n){return this.get(n)!==void 0},keys(){let n=[];for(let i of e.keys())i.startsWith(t)&&n.push(i.slice(t.length));return n},clear(){for(let n of e.keys())n.startsWith(t)&&e.delete(n)}}}var Io=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??HC;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?eh(window.sessionStorage,this.namespace):To(this.namespace),this.user=t(window.localStorage)?eh(window.localStorage,this.namespace):To(this.namespace)):(this.session=To(this.namespace),this.user=To(this.namespace)),this.dismissals=fb(this.session,this.user),this.cooldowns=hb(this.user),this.frequency=gb(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?eh(sessionStorage,t):To(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function dc(r={}){return new Io(r)}function Ki(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function $o(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var th={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"}},Yi={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:[]},mb={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function pc(r,e,t){let n=th[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 hc(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[_a(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(wa()),t.shift!==!1&&i.push(xa({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",ba(e,r,async()=>{let{x:o,y:a,strategy:l}=await ka(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function fc(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 gc(r,e){return e==="none"||Yi[e].length===0?null:r.animate(Yi[e],mb)}function mc(r,e){if(e==="none"||Yi[e].length===0)return Promise.resolve();let t=[...Yi[e]].reverse(),n=r.animate(t,mb);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function vc(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 yc(r){switch(Ki(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 vb(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 BC=0;function bc(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-${++BC}`}function u(b,w){t&&t.publish(b,w)}function p(b){let w=l.get(b);if(w){let C=m(b);for(let _ of w)try{_(C)}catch(A){console.error("[Surfaces] State callback error:",A)}}}let h=new Map;function f(b,w,C){switch(w.type){case"html":b.innerHTML=vb(w.content);return;case"widget":{if(s?.has(w.widgetId)){let _=s.mount(w.widgetId,b,w.config);return C&&h.set(C,_),()=>{_.unmount(),C&&h.delete(C)}}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,C){let _=c(),A=Ki(b),$=C?.priority??0,T=C?.animation??i,O=C?.exclusive??!0,X=o.get(b);if(X&&O){if(X.options.priority>$)throw new Error(`Slot ${b} is occupied by higher priority content (${X.options.priority} > ${$})`);g(X)}let F=vc(b,_);F.style.zIndex=String(yc(b));let N;if(A==="static")pc(F,b,C?.constraints),e.appendChild(F);else if(A==="inline"){let U=$o(b);if(!U)throw new Error(`Invalid inline slot: ${b}`);if(!n)throw new Error("Anchor resolver required for inline slots");let ee=n({selector:U,route:"**"});if(!ee)throw new Error(`Anchor not found for inline slot: ${U}`);N=fc(F,ee)}else if(A==="adjacent"){let U=$o(b);if(!U)throw new Error(`Invalid adjacent slot: ${b}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let ee=n({selector:U,route:"**"});if(!ee)throw new Error(`Anchor not found for adjacent slot: ${U}`);e.appendChild(F),N=hc(F,ee,C?.position??{placement:"bottom"})}let Z=f(F,w,_);gc(F,T);let K={id:_,slot:b,content:w,options:{priority:$,exclusive:O,animation:T,position:C?.position??{placement:"auto"},constraints:C?.constraints??{},adaptiveId:C?.adaptiveId,autoUnmountOnRouteChange:C?.autoUnmountOnRouteChange??!0},container:F,cleanup:()=>{N?.(),Z?.()},mountedAt:Date.now()};return o.set(b,K),a.set(b,(a.get(b)??0)+1),u("surface.mounted",{slot:b,id:_,adaptiveId:C?.adaptiveId}),p(b),{id:_,update(U){let ee=o.get(b);if(!ee||ee.id!==_)throw new Error("Mount no longer active");let D=h.get(_);if(D){if(U.type==="widget"){D.update(U.config),ee.content=U;return}D.unmount(),h.delete(_)}ee.container.innerHTML="";let ie=f(ee.container,U,_);if(ee.content=U,ie){let Y=ee.cleanup;ee.cleanup=()=>{Y?.(),ie()}}},setOptions(U){let ee=o.get(b);if(!ee||ee.id!==_)throw new Error("Mount no longer active");U.priority!==void 0&&(ee.options.priority=U.priority),U.animation!==void 0&&(ee.options.animation=U.animation),U.constraints&&A==="static"&&(U.constraints.maxWidth&&(ee.container.style.maxWidth=U.constraints.maxWidth),U.constraints.maxHeight&&(ee.container.style.maxHeight=U.constraints.maxHeight),U.constraints.minWidth&&(ee.container.style.minWidth=U.constraints.minWidth),U.constraints.minHeight&&(ee.container.style.minHeight=U.constraints.minHeight)),p(b)},async unmount(){let U=o.get(b);!U||U.id!==_||await g(U)},isMounted(){return o.get(b)?.id===_},getContainer(){let U=o.get(b);return U?.id===_?U.container:null}}}async function g(b){b.container.isConnected&&await mc(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 C=l.get(b);return C||(C=new Set,l.set(b,C)),C.add(w),()=>{C?.delete(w),C?.size===0&&l.delete(b)}}function x(b,w){let C=o.get(b);return C?w!==void 0?w>=C.options.priority:!1:!0}function k(){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:k}}var Mo=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()}},_c=new Mo;var nh="2.0.0";function VC(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(rh(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(rh(n,i))return!0;return!1}return!0}function rh(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 yb(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 rh(t,s)})}function xc(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??_c,a=r.executors??ir,l=r.apps??Ps,c=new Gi,u=lc({telemetry:e,routes:n,navigation:c,initialSurfaceType:r.initialSurfaceType,initialSurfaceHost:r.initialSurfaceHost}),p=r.events??Hi(),h=dc({namespace:s}),f=uc({eventBus:p,stateStore:h}),v=cc({state:h,events:p,sessionMetrics:t,accumulator:f}),g=ly(),m=$l(),y=O=>yb(O)?m.resolve(O.selector):null,x=async(O,X)=>{if(!yb(O))return null;try{return await m.waitFor(O.selector,X)}catch{return null}},k=bc({overlayRoot:g,eventBus:p,anchorResolver:y,widgetRegistry:o}),b=Rl({overlayRoot:g,eventBus:p,surfaces:k,anchorResolver:y,waitForAnchor:x,executorRegistry:a,subscribeNavigation:O=>c.subscribe(O),runtime:{evaluateSync:O=>v.evaluateSync(O,u.get()),context:u,accumulator:f,sessionMetrics:t,events:p?{subscribe:O=>p.subscribe(()=>O())}:void 0}}),w;if(t){let O=t;O.increment("page_views");let X=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((F,N)=>{if(N!=="replaceState")try{let Z=new URL(F).pathname;Z!==X&&(X=Z,O.increment("page_views"),C=0,O.set("time_on_page",0),O.set("scroll_depth",0))}catch{}})}let C=0,_,A;if(t){let O=t;_=setInterval(()=>{C++},1e3),A=setInterval(()=>{O.set("time_on_page",C)},5e3)}let $;if(t&&p){let O=t;$=p.subscribe({names:["ui.scroll"]},X=>{let F=X.props?.scrollPercentage;typeof F=="number"&&F>O.get("scroll_depth")&&O.set("scroll_depth",F)})}let T={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:b,surfaces:k,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:m,navigation:c,version:nh,mode:i,async evaluate(O){return v.evaluate(O,u.get())},evaluateSync(O){return v.evaluateSync(O,u.get())},async filterTiles(O){let X=u.get().page.url,F=[];for(let N of O){let Z=N.activation;if(!Z){F.push(N);continue}if(VC(X,Z.routes)){if(Z.onlyIfPopulated){let K=N.props?.actions??[];if(K.length>0&&!K.some(U=>U.triggerWhen?v.evaluateSync(U.triggerWhen,u.get()).value:!0))continue}F.push(N)}}return F},setRoutes(O){u.setRoutes(O)},destroy(){l.unbind().catch(O=>{console.error("[Runtime] Error unbinding apps registry:",O)}),w?.(),$?.(),_&&clearInterval(_),A&&clearInterval(A),m.destroy(),f.destroy(),c.destroy(),u.destroy(),b.destroy(),k.destroy()}};return l.bind(T),o.bindRuntime(T),T}var Xi=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 jC(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var ih=class{constructor(){this.sessionId=jC(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,n){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,n){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}};function wc(){return new ih}var E=typeof window<"u"?window:void 0,Je=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Je.self=Je),typeof File>"u"&&(Je.File=function(){});var f_=Array.prototype,bb=f_.forEach,_b=f_.indexOf,xt=Je?.navigator,B=Je?.document,Xe=Je?.location,wh=Je?.fetch,kh=Je!=null&&Je.XMLHttpRequest&&"withCredentials"in new Je.XMLHttpRequest?Je.XMLHttpRequest:void 0,xb=Je?.AbortController,mt=xt?.userAgent,te=E??{},Rr={DEBUG:!1,LIB_VERSION:"1.341.0"};function wb(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 rs(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){wb(s,n,i,o,a,"next",l)}function a(l){wb(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 g_(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 UC=["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"],kb=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return UC.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},WC=["$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 Jc=function(r){return r.trim()},Sh=function(r){return r.replace(/^\$/,"")},zC=Array.isArray,m_=Object.prototype,v_=m_.hasOwnProperty,Qc=m_.toString,be=zC||function(r){return Qc.call(r)==="[object Array]"},nn=r=>typeof r=="function",je=r=>r===Object(r)&&!be(r),ns=r=>{if(je(r)){for(var e in r)if(v_.call(r,e))return!1;return!0}return!1},V=r=>r===void 0,Ue=r=>Qc.call(r)=="[object String]",Eh=r=>Ue(r)&&r.trim().length===0,Wt=r=>r===null,fe=r=>V(r)||Wt(r),Pr=r=>Qc.call(r)=="[object Number]"&&r==r,es=r=>Pr(r)&&r>0,Or=r=>Qc.call(r)==="[object Boolean]",qC=r=>r instanceof FormData,ZC=r=>he(WC,r);function Ch(r){return r===null||typeof r!="object"}function Ic(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function y_(r){return!V(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var GC=[!0,"true",1,"1","yes"],sh=r=>he(GC,r),KC=[!1,"false",0,"0","no"];function lr(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),Pr(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),lr(i||t,e,t,n))}var Ah=class{constructor(e){this.t={},this.i=e.i,this.o=lr(e.bucketSize,0,100,e.h),this.m=lr(e.refillRate,0,this.o,e.h),this.$=lr(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",$c="iOS",Mr="Android",Qo="Tablet",b_=Mr+" "+Qo,__="iPad",x_="Apple",w_=x_+" Watch",ea="Safari",as="BlackBerry",k_="Samsung",S_=k_+"Browser",E_=k_+" Internet",ei="Chrome",YC=ei+" OS",C_=ei+" "+$c,Lf="Internet Explorer",A_=Lf+" "+$t,Ff="Opera",XC=Ff+" Mini",Df="Edge",R_="Microsoft "+Df,ss="Firefox",T_=ss+" "+$c,ta="Nintendo",ra="PlayStation",os="Xbox",I_=Mr+" "+$t,$_=$t+" "+ea,jo="Windows",Rh=jo+" Phone",Sb="Nokia",Th="Ouya",M_="Generic",JC=M_+" "+$t.toLowerCase(),O_=M_+" "+Qo.toLowerCase(),Ih="Konqueror",at="(\\d+(\\.\\d+)?)",oh=new RegExp("Version/"+at),QC=new RegExp(os,"i"),eA=new RegExp(ra+" \\w+","i"),tA=new RegExp(ta+" \\w+","i"),Hf=new RegExp(as+"|PlayBook|BB10","i"),rA={"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"},kc,Eb,ah,nA=(r,e)=>e&&he(e,x_)||(function(t){return he(t,ea)&&!he(t,ei)&&!he(t,Mr)})(r),P_=function(r,e){return e=e||"",he(r," OPR/")&&he(r,"Mini")?XC:he(r," OPR/")?Ff:Hf.test(r)?as:he(r,"IE"+$t)||he(r,"WPDesktop")?A_:he(r,S_)?E_:he(r,Df)||he(r,"Edg/")?R_:he(r,"FBIOS")?"Facebook "+$t:he(r,"UCWEB")||he(r,"UCBrowser")?"UC Browser":he(r,"CriOS")?C_:he(r,"CrMo")||he(r,ei)?ei:he(r,Mr)&&he(r,ea)?I_:he(r,"FxiOS")?T_:he(r.toLowerCase(),Ih.toLowerCase())?Ih:nA(r,e)?he(r,$t)?$_:ea:he(r,ss)?ss:he(r,"MSIE")||he(r,"Trident/")?Lf:he(r,"Gecko")?ss:""},iA={[A_]:[new RegExp("rv:"+at)],[R_]:[new RegExp(Df+"?\\/"+at)],[ei]:[new RegExp("("+ei+"|CrMo)\\/"+at)],[C_]:[new RegExp("CriOS\\/"+at)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+at)],[ea]:[oh],[$_]:[oh],[Ff]:[new RegExp("(Opera|OPR)\\/"+at)],[ss]:[new RegExp(ss+"\\/"+at)],[T_]:[new RegExp("FxiOS\\/"+at)],[Ih]:[new RegExp("Konqueror[:/]?"+at,"i")],[as]:[new RegExp(as+" "+at),oh],[I_]:[new RegExp("android\\s"+at,"i")],[E_]:[new RegExp(S_+"\\/"+at)],[Lf]:[new RegExp("(rv:|MSIE )"+at)],Mozilla:[new RegExp("rv:"+at)]},sA=function(r,e){var t=P_(r,e),n=iA[t];if(V(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},Cb=[[new RegExp(os+"; "+os+" (.*?)[);]","i"),r=>[os,r&&r[1]||""]],[new RegExp(ta,"i"),[ta,""]],[new RegExp(ra,"i"),[ra,""]],[Hf,[as,""]],[new RegExp(jo,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Rh,""];if(new RegExp($t).test(e)&&!/IEMobile\b/.test(e))return[jo+" "+$t,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=rA[n]||"";return/arm/i.test(e)&&(i="RT"),[jo,i]}return[jo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[$c,e.join(".")]}return[$c,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=V(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Mr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Mr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Mr,e.join(".")]}return[Mr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[YC,""]],[/Linux|debian/i,["Linux",""]]],Ab=function(r){return tA.test(r)?ta:eA.test(r)?ra:QC.test(r)?os:new RegExp(Th,"i").test(r)?Th:new RegExp("("+Rh+"|WPDesktop)","i").test(r)?Rh:/iPad/.test(r)?__:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?w_:Hf.test(r)?as:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Sb,"i").test(r)?Sb:/(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)?Mr:b_:new RegExp("(pda|"+$t+")","i").test(r)?JC:new RegExp(Qo,"i").test(r)&&!new RegExp(Qo+" pc","i").test(r)?O_:""},oA=r=>r instanceof Error;function aA(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ah&&t.length===Eb||(Eb=t.length,ah=t.reduce(((n,i)=>{kc||(kc={});var s=kc[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,kc[i]=[c,u];break}}return n}),{})),ah}}var $h=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 rs((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)),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 rs((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:aA(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)})}},ls="?";function Mh(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?ls:t,in_app:!0};return V(n)||(s.lineno=n),V(i)||(s.colno=i),s}var N_=(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]:ls,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},lA=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cA=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uA=/\((\S*)(?::(\d+))(?::(\d+))\)/,dA=(r,e)=>{var t=lA.exec(r);if(t){var[,n,i,s]=t;return Mh(e,n,ls,+i,+s)}var o=cA.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=uA.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=N_(o[1]||ls,o[2]);return Mh(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},pA=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hA=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fA=(r,e)=>{var t=pA.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=hA.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]||ls;return[s,i]=N_(s,i),Mh(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Rb=/\(error: (.*)\)/,Tb=50;function gA(){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=Rb.test(c)?c.replace(Rb,"$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>=Tb)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,Tb).map((g=>{return W({},g,{filename:g.filename||(m=v,m[m.length-1]||{}).filename,function:g.function||ls});var m}))})(o)}})("web:javascript",dA,fA)}var Oh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Ue(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 Ic(e,"DOMException")}isDOMError(e){return Ic(e,"DOMError")}},Ph=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}},Nh=class{constructor(){}match(e){return Ic(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}}},mA=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Lh=class{match(e){return typeof e=="string"}coerce(e,t){var n,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var t="Error",n=e,i=e.match(mA);return i&&(t=i[1],n=i[2]),[t,n]}},vA=["fatal","error","warning","log","info","debug"];function L_(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 Fh=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 y_(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: "+L_(e)}isSeverityLevel(e){return Ue(e)&&!Eh(e)&&vA.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(oA(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Dh=class{match(e){return y_(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+L_(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Hh=class{match(e){return Ch(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}}},Bh=class{match(e){return Ic(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Ch(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(Ch(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}},F_=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(Rr.DEBUG||te.POSTHOG_DEBUG||t)&&!V(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)=>F_(r+" "+i,s)};return n},j=F_("[PostHog.js]"),Oe=j.createLogger,yA=Oe("[ExternalScriptsLoader]"),Ib=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return yA.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=B?.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(!B)return t("document not found");var l=B.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")B.head.appendChild(l);else{var c,u=B.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):B.body.appendChild(l)}};B!=null&&B.body?a():B?.addEventListener("DOMContentLoaded",a)};te.__PosthogExtensions__=te.__PosthogExtensions__||{},te.__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);Ib(r,s,t)},te.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);Ib(r,n,t)};var Mc={};function sn(r,e,t){if(be(r)){if(bb&&r.forEach===bb)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)===Mc)return}}}function Ce(r,e,t){if(!fe(r)){if(be(r))return sn(r,e,t);if(qC(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===Mc)return}else for(var i in r)if(v_.call(r,i)&&e.call(t,r[i],i)===Mc)return}}var Ne=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 sn(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},us=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 sn(t,(function(i){sn(i,(function(s){r.push(s)}))})),r};function Rc(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 $b=function(r){try{return r()}catch{return}},bA=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){j.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),j.critical(i)}}},Bf=function(r){var e={};return Ce(r,(function(t,n){(Ue(t)&&t.length>0||Pr(t))&&(e[n]=t)})),e};function _A(r,e){return t=r,n=s=>Ue(s)&&!Wt(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=[],sn(o,(c=>{l.push(s(c))}))):(l={},Ce(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var xA=["herokuapp.com","vercel.app","netlify.app"];function wA(r){var e=r?.hostname;if(!Ue(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of xA)if(t===n)return!1;return!0}function D_(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Be(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var H_="$people_distinct_id",Uo="__alias",Wo="__timers",Mb="$autocapture_disabled_server_side",Vh="$heatmaps_enabled_server_side",Ob="$exception_capture_enabled_server_side",jh="$error_tracking_suppression_rules",Pb="$error_tracking_capture_extension_exceptions",Nb="$web_vitals_enabled_server_side",B_="$dead_clicks_enabled_server_side",Lb="$product_tours_enabled_server_side",Fb="$web_vitals_allowed_metrics",lh="$session_recording_remote_config",Oc="$sesid",V_="$session_is_sampled",is="$enabled_feature_flags",zo="$early_access_features",Uh="$feature_flag_details",qo="$stored_person_properties",Qn="$stored_group_properties",Wh="$surveys",Pc="$flag_call_reported",Tr="$user_state",zh="$client_session_props",qh="$capture_rate_limit",Zh="$initial_campaign_params",Gh="$initial_referrer_info",Nc="$initial_person_info",Lc="$epp",j_="__POSTHOG_TOOLBAR__",Oo="$posthog_cookieless",kA=[H_,Uo,"__cmpns",Wo,"$session_recording_enabled_server_side",Vh,Oc,is,jh,Tr,zo,Uh,Qn,qo,Wh,Pc,zh,qh,Zh,Gh,Lc,Nc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Db(r){return r instanceof Element&&(r.id===j_||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function eu(r){return!!r&&r.nodeType===1}function on(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function U_(r){return!!r&&r.nodeType===3}function W_(r){return!!r&&r.nodeType===11}function Vf(r){return r?Jc(r).split(/\s+/):[]}function Hb(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Fc(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 Vf(e)}function z_(r){return fe(r)?null:Jc(r).split(/(\s+)/).filter((e=>na(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sa(r){var e="";return Kh(r)&&!Y_(r)&&r.childNodes&&r.childNodes.length&&Ce(r.childNodes,(function(t){var n;U_(t)&&t.textContent&&(e+=(n=z_(t.textContent))!==null&&n!==void 0?n:"")})),Jc(e)}function q_(r){return V(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var jf=["a","button","form","input","select","textarea","label"];function Z_(r,e){if(V(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 G_(r){var e=r.parentNode;return!(!e||!eu(e))&&e}var SA=["next","previous","prev",">","<"],Bb=10,Vb=[".ph-no-rageclick",".ph-no-capture"];function EA(r,e){if(!E||Uf(r))return!1;var t,n,i;if(Or(e)?(t=!!e&&Vb,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:Vb,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=K_(r,!1);return!(function(o,a){if(o===!1||V(o))return!1;var l;if(o===!0)l=SA;else{if(!be(o))return!1;if(o.length>Bb)return j.error("[PostHog] content_ignorelist array cannot exceed "+Bb+" 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())||""}})))&&!Z_(s,t)}var Uf=r=>!r||on(r,"html")||!eu(r),K_=(r,e)=>{if(!E||Uf(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!on(i,"body");)if(W_(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=G_(i);if(!s)break;if(e||jf.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 CA(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||Uf(r)||(s=t)!=null&&s.url_allowlist&&!Hb(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&Hb(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}=K_(r,n);if(!(function(v,g){var m=g?.element_allowlist;if(V(m))return!0;var y,x=function(b){if(m.some((w=>b.tagName.toLowerCase()===w)))return{v:!0}};for(var k of v)if(y=x(k))return y.v;return!1})(p,t)||!Z_(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&&(jf.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Kh(r){for(var e=r;e.parentNode&&!on(e,"body");e=e.parentNode){var t=Fc(e);if(he(t,"ph-sensitive")||he(t,"ph-no-capture"))return!1}if(he(Fc(r),"ph-include"))return!0;var n=r.type||"";if(Ue(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(Ue(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 Y_(r){return!!(on(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||on(r,"select")||on(r,"textarea")||r.getAttribute("contenteditable")==="true")}var X_="(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})",AA=new RegExp("^(?:"+X_+")$"),RA=new RegExp(X_),J_="\\d{3}-?\\d{2}-?\\d{4}",TA=new RegExp("^("+J_+")$"),IA=new RegExp("("+J_+")");function na(r,e){return e===void 0&&(e=!0),!(fe(r)||Ue(r)&&(r=Jc(r),(e?AA:RA).test((r||"").replace(/[- ]/g,""))||(e?TA:IA).test(r)))}function Q_(r){var e=sa(r);return na(e=(e+" "+e0(r)).trim())?e:""}function e0(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Ce(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+" "+e0(t)).trim())}catch(s){j.error("[AutoCapture]",s)}})),e}function $A(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 Rc(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[jb(p.toString())]=jb(h.toString())})),o+=":",o+=Rc(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:MA(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Rc(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 jb(r){return r.replace(/"|\\"/g,'\\"')}function MA(r){var e=r.attr__class;return e?be(e)?e:Vf(e):void 0}var Dc=class{constructor(e){this.disabled=e===!1;var t=je(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}},Hc=r=>{var e=B?.createElement("a");return V(e)?null:(e.href=r,e)},OA=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return Ce(r,(function(s,o){V(s)||V(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)},Bc=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{j.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},oa=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},Vc=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ch="$copy_autocapture",Ub=Oe("[AutoCapture]");function uh(r,e){return e.length>r?e.slice(0,r)+"...":e}function PA(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!eu(e));return e}function NA(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};jf.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=uh(1024,Q_(r)):s.$el_text=uh(1024,sa(r)));var o=Fc(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),Ce(r.attributes,(function(u){var p;if((!Y_(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&na(u.value)&&(p=u.name,!Ue(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=Vf(h).join(" ")),s["attr__"+u.name]=uh(1024,h)}}));for(var a=1,l=1,c=r;c=PA(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function LA(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!on(u,"body");)W_(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(Ce(c,(b=>{var w=Kh(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=w&&v&&na(v)&&v),he(Fc(b),"ph-no-capture")&&(g=!0),h.push(NA(b,s,o,a));var C=(function(_){if(!Kh(_))return{};var A={};return Ce(_.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var T=$.name.replace("data-ph-capture-attribute-",""),O=$.value;T&&O&&na(O)&&(A[T]=O)}})),A})(b);Ne(f,C)})),g)return{props:{},explicitNoCapture:g};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=Q_(r):h[0].$el_text=sa(r)),v){var m,y;h[0].attr__href=v;var x=(m=Hc(v))==null?void 0:m.host,k=E==null||(y=E.location)==null?void 0:y.host;x&&k&&x!==k&&(p=v)}return{props:Ne({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:$A(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 Yh=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Dc(e.config.rageclick),this.C=null}get R(){var e,t,n=je(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&&B){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){Ub.error("Failed to capture event",i)}};if(Be(B,"submit",e,{capture:!0}),Be(B,"change",e,{capture:!0}),Be(B,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,ch)};Be(B,"copy",t,{capture:!0}),Be(B,"cut",t,{capture:!0})}}}else Ub.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({[Mb]:!!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=B?.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[Mb],i=this.T;if(Wt(i)&&!Or(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=q_(e);U_(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())&&EA(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===ch;if(i&&CA(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=LA(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===ch){var c,u=z_(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 nn(B?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Pr(r)&&isFinite(r)&&Math.floor(r)===r});var Wb="0123456789abcdef",Xh=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+Wb.charAt(this.bytes[t]>>>4)+Wb.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}},Jh=class{constructor(){this.A=0,this.j=0,this.D=new Qh}generate(){var e=this.generateOrAbort();if(V(e)){this.A=0;var t=this.generateOrAbort();if(V(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 Xh.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())}},zb,t0=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&&!V(E.crypto)&&crypto.getRandomValues&&(t0=r=>crypto.getRandomValues(r));var Qh=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(t0(this.N),this.U=0),this.N[this.U++]}},rn=()=>FA().toString(),FA=()=>(zb||(zb=new Jh)).generate(),Po="",DA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function HA(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=B),Po)return Po;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+rn();!Po&&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",Po=c)}return Po})(r);if(!t){var n=(i=>{var s=i.match(DA);return s?s[0]:""})(r);n!==t&&j.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var ar={H:()=>!!B,B:function(r){j.error("cookieStore error: "+r)},q:function(r){if(B){try{for(var e=r+"=",t=B.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(ar.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(B)try{var s="",o="",a=HA(B.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&&j.warn("cookieStore warning: large cookie, len="+c.length),B.cookie=c,c}catch{return}},V:function(r,e){if(B!=null&&B.cookie)try{ar.G(r,"",-1,e)}catch{return}}},dh=null,Ie={H:function(){if(!Wt(dh))return dh;var r=!0;if(V(E))r=!1;else try{var e="__mplssupport__";Ie.G(e,"xyz"),Ie.q(e)!=='"xyz"'&&(r=!1),Ie.V(e)}catch{r=!1}return r||j.error("localStorage unsupported; falling back to cookie store"),dh=r,r},B:function(r){j.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Ie.B(e)}return null},W:function(r){try{return JSON.parse(Ie.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Ie.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Ie.B(e)}}},BA=["$device_id","distinct_id",Oc,V_,Lc,Nc],Sc={},VA={H:function(){return!0},B:function(r){j.error("memoryStorage error: "+r)},q:function(r){return Sc[r]||null},W:function(r){return Sc[r]||null},G:function(r,e){Sc[r]=e},V:function(r){delete Sc[r]}},Xn=null,Ye={H:function(){if(!Wt(Xn))return Xn;if(Xn=!0,V(E))Xn=!1;else try{var r="__support__";Ye.G(r,"xyz"),Ye.q(r)!=='"xyz"'&&(Xn=!1),Ye.V(r)}catch{Xn=!1}return Xn},B:function(r){j.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){Ye.B(e)}return null},W:function(r){try{return JSON.parse(Ye.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){Ye.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){Ye.B(e)}}},Ir=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),ef=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Ir.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Ir.DENIED||this.consent===Ir.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ir.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 sh(e)?Ir.GRANTED:he(KC,e)?Ir.DENIED:Ir.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ie:ar;var t=e==="localStorage"?ar:Ie;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(sh(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!D_([xt?.doNotTrack,xt?.msDoNotTrack,te.doNotTrack],(e=>sh(e)))}},Ec=Oe("[Dead Clicks]"),jA=()=>!0,UA=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(B_)),n=r.instance.config.capture_dead_clicks;return Or(n)?n:!!je(n)||t},jc=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({[B_]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ec.error("failed to load script",i):e()}))}et(){var e;if(B){if(!this.tt&&(e=te.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=je(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=te.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(B),Ec.info("starting...")}}else Ec.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ec.info("stopping..."))}},No=Oe("[ExceptionAutocapture]"),tf=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=te.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=te.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=te.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=te.__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){No.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Ob]),this.dt=new Ah({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:No}),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 je(e)?t=W({},t,e):(V(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?(No.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return No.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({[Ob]: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)?No.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function qb(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return nn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var rf=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&&(j.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,j.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||qb(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__||qb(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){j.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Be(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},ph=Oe("[SegmentIntegration]");function WA(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()||rn();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(Tr,"identified")),i()},a=s.user();"then"in a&&nn(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||ph.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()||(ph.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(ph.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 r0="posthog-js";function n0(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 nf=class{constructor(e,t,n,i,s,o){this.name=r0,this.setupOnce=function(a){a(n0(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},zA=E!=null&&E.location?Vc(E.location.hash,"__posthog")||Vc(location.hash,"state"):null,Zb="_postHogToolbarParams",Gb=Oe("[Toolbar]"),tn=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(tn||{}),sf=class{constructor(e){this.instance=e}yt(e){te.ph_toolbar_state=e}wt(){var e;return(e=te.ph_toolbar_state)!==null&&e!==void 0?e:tn.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||!B)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=zA||Vc(e.hash,"__posthog")||Vc(e.hash,"state"),o=s?$b((()=>JSON.parse(atob(decodeURIComponent(s)))))||$b((()=>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(Zb)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=te.ph_load_toolbar||te.ph_load_editor;!fe(t)&&nn(t)?t(e,this.instance):Gb.warn("No toolbar load function found")}loadToolbar(e){var t=!(B==null||!B.getElementById(j_));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(Zb,JSON.stringify(W({},i,{source:void 0}))),this.wt()===tn.LOADED)this.xt(i);else if(this.wt()===tn.UNINITIALIZED){var s;this.yt(tn.LOADING),(s=te.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Gb.error("[Toolbar] Failed to load",o),void this.yt(tn.UNINITIALIZED);this.yt(tn.LOADED),this.xt(i)})),Be(E,"turbolinks:load",(()=>{this.yt(tn.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)}},qA=Oe("[TracingHeaders]"),of=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;V(this.$t)&&((t=te.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),V(this.St)&&((n=te.__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=te.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return qA.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)}},Cc="https?://(.*)",ds=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ZA=us(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ds),aa="<masked>",GA=["li_fat_id"];function i0(r,e,t){if(!B)return{};var n,i=e?us([],ds,t||[]):[],s=s0(oa(B.URL,i,aa),r),o=(n={},Ce(GA,(function(a){var l=ar.q(a);n[a]=l||null})),n);return Ne(o,s)}function s0(r,e){var t=ZA.concat(e||[]),n={};return Ce(t,(function(i){var s=Bc(r,i);n[i]=s||null})),n}function o0(r){var e=(function(s){return s?s.search(Cc+"google.([^/?]*)")===0?"google":s.search(Cc+"bing.com")===0?"bing":s.search(Cc+"yahoo.com")===0?"yahoo":s.search(Cc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Wt(e)){n.$search_engine=e;var i=B?Bc(B.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function Kb(){return navigator.language||navigator.userLanguage}function a0(){return B?.referrer||"$direct"}function l0(r,e){var t=r?us([],ds,e||[]):[],n=Xe?.href.substring(0,1e3);return{r:a0().substring(0,1e3),u:n?oa(n,t,aa):void 0}}function c0(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Hc(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=Hc(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=s0(n);Ne(i,o)}if(t){var a=o0(t);Ne(i,a)}return i}function u0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function KA(){try{return new Date().getTimezoneOffset()}catch{return}}function YA(r,e){if(!mt)return{};var t,n,i,s=r?us([],ds,e||[]):[],[o,a]=(function(l){for(var c=0;c<Cb.length;c++){var[u,p]=Cb[c],h=u.exec(l),f=h&&(nn(p)?p(h,l):p);if(f)return f}return["",""]})(mt);return Ne(Bf({$os:o,$os_version:a,$browser:P_(mt,navigator.vendor),$device:Ab(mt),$device_type:(n=mt,i=Ab(n),i===__||i===b_||i==="Kobo"||i==="Kindle Fire"||i===O_?Qo:i===ta||i===os||i===ra||i===Th?"Console":i===w_?"Wearable":i?$t:"Desktop"),$timezone:u0(),$timezone_offset:KA()}),{$current_url:oa(Xe?.href,s,aa),$host:Xe?.host,$pathname:Xe?.pathname,$raw_user_agent:mt.length>1e3?mt.substring(0,997)+"...":mt,$browser_version:sA(mt,navigator.vendor),$browser_language:Kb(),$browser_language_prefix:(t=Kb(),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:Rr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Jr=Oe("[Web Vitals]"),Yb=9e5,af=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(V(s))Jr.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();V(o)||(fe(n?.name)||fe(n?.value)?Jr.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?Jr.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),V(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=V(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=te.__PosthogExtensions__;V(a)||V(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):Jr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[Nb]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=je(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return fe(n)?((t=this._instance.persistence)==null?void 0:t.props[Fb])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=je(this._instance.config.capture_performance)&&Pr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Yb;return 0<e&&e<=6e4?Yb:e}get isEnabled(){var e=Xe?.protocol;if(e!=="http:"&&e!=="https:")return Jr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Or(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Or(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Jr.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=je(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=je(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Nb]:t}),this._instance.persistence.register({[Fb]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=te.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?Jr.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?us([],ds,n||[]):[];return oa(e,i,aa)}Jr.error("Could not determine current URL")}},XA=Oe("[Heatmaps]");function Xb(r){return je(r)&&"clientX"in r&&"clientY"in r&&Pr(r.clientX)&&Pr(r.clientY)}var lf=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[Vh]),this.rageclicks=new Dc(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return je(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 fe(this.instance.config.capture_heatmaps)?fe(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;XA.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({[Vh]: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"})(B)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&B&&(this.Nt=this.Lt.bind(this),Be(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Be(B,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Be(B,"mousemove",this.zt,{capture:!0}),this.Bt=new jc(this.instance,jA,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Be(B,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&B&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&B.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&B.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&B.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)&&!on(u,"body");){if(u===c)return!1;if(he(l,E?.getComputedStyle(u).position))return!0;u=G_(u)}return!1})(q_(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"),!Db(e.target)&&Xb(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){!Db(e.target)&&Xb(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?us([],ds,i||[]):[],o=oa(t,s,aa);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!ns(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Uc=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(j.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(!(V(o)||V(a)||V(l)||V(c)||V(u)||V(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:lr(a/o,0,1,j),f=o<=1?1:lr(l/o,0,1,j),v=c<=1?1:lr(u/c,0,1,j),g=c<=1?1:lr(p/c,0,1,j);i=Ne(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 $r=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Mt=Uint8Array,lt=Uint16Array,cs=Uint32Array,Wf=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]),zf=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]),Jb=new Mt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d0=function(r,e){for(var t=new lt(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new cs(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]},p0=d0(Wf,2),JA=p0[0],cf=p0[1];JA[28]=258,cf[258]=28;for(uf=d0(zf,0)[1],Wc=new lt(32768),Ae=0;Ae<32768;++Ae)Qr=(43690&Ae)>>>1|(21845&Ae)<<1,Qr=(61680&(Qr=(52428&Qr)>>>2|(13107&Qr)<<2))>>>4|(3855&Qr)<<4,Wc[Ae]=((65280&Qr)>>>8|(255&Qr)<<8)>>>1;var Qr,uf,Wc,Ae,Yo=function(r,e,t){for(var n=r.length,i=0,s=new lt(e);i<n;++i)++s[r[i]-1];var o,a=new lt(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new lt(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[Wc[p]>>>l]=c}else for(o=new lt(n),i=0;i<n;++i)o[i]=Wc[a[r[i]-1]++]>>>15-r[i];return o},ti=new Mt(288);for(Ae=0;Ae<144;++Ae)ti[Ae]=8;for(Ae=144;Ae<256;++Ae)ti[Ae]=9;for(Ae=256;Ae<280;++Ae)ti[Ae]=7;for(Ae=280;Ae<288;++Ae)ti[Ae]=8;var zc=new Mt(32);for(Ae=0;Ae<32;++Ae)zc[Ae]=5;var QA=Yo(ti,9,0),e2=Yo(zc,5,0),h0=function(r){return(r/8>>0)+(7&r&&1)},f0=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof lt?lt:r instanceof cs?cs:Mt)(t-e);return n.set(r.subarray(e,t)),n},Cr=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},Lo=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8,r[n+2]|=t>>>16},hh=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,C){return w.f-C.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 lt(h+1),v=df(t[u-1],f,0);if(v>e){n=0;var g=0,m=v-e,y=1<<m;for(s.sort((function(w,C){return f[C.s]-f[w.s]||w.f-C.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;g+=y-(1<<v-f[x]),f[x]=e}for(g>>>=m;g>0;){var k=s[n].s;f[k]<e?g-=1<<e-f[k]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;f[b]==e&&(--f[b],++g)}v=e}return[new Mt(f),v]},df=function(r,e,t){return r.s==-1?Math.max(df(r.l,e,t+1),df(r.r,e,t+1)):e[r.s]=t},Qb=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new lt(++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]},Fo=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},pf=function(r,e,t){var n=t.length,i=h0(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)},e_=function(r,e,t,n,i,s,o,a,l,c,u){Cr(e,u++,t),++i[256];for(var p=hh(i,15),h=p[0],f=p[1],v=hh(s,15),g=v[0],m=v[1],y=Qb(h),x=y[0],k=y[1],b=Qb(g),w=b[0],C=b[1],_=new lt(19),A=0;A<x.length;++A)_[31&x[A]]++;for(A=0;A<w.length;++A)_[31&w[A]]++;for(var $=hh(_,7),T=$[0],O=$[1],X=19;X>4&&!T[Jb[X-1]];--X);var F,N,Z,K,le=c+5<<3,U=Fo(i,ti)+Fo(s,zc)+o,ee=Fo(i,h)+Fo(s,g)+o+14+3*X+Fo(_,T)+(2*_[16]+3*_[17]+7*_[18]);if(le<=U&&le<=ee)return pf(e,u,r.subarray(l,l+c));if(Cr(e,u,1+(ee<U)),u+=2,ee<U){F=Yo(h,f,0),N=h,Z=Yo(g,m,0),K=g;var D=Yo(T,O,0);for(Cr(e,u,k-257),Cr(e,u+5,C-1),Cr(e,u+10,X-4),u+=14,A=0;A<X;++A)Cr(e,u+3*A,T[Jb[A]]);u+=3*X;for(var ie=[x,w],Y=0;Y<2;++Y){var de=ie[Y];for(A=0;A<de.length;++A){var ge=31&de[A];Cr(e,u,D[ge]),u+=T[ge],ge>15&&(Cr(e,u,de[A]>>>5&127),u+=de[A]>>>12)}}}else F=QA,N=ti,Z=e2,K=zc;for(A=0;A<a;++A)if(n[A]>255){ge=n[A]>>>18&31,Lo(e,u,F[ge+257]),u+=N[ge+257],ge>7&&(Cr(e,u,n[A]>>>23&31),u+=Wf[ge]);var wt=31&n[A];Lo(e,u,Z[wt]),u+=K[wt],wt>3&&(Lo(e,u,n[A]>>>5&8191),u+=zf[wt])}else Lo(e,u,F[n[A]]),u+=N[n[A]];return Lo(e,u,F[256]),u+N[256]},t2=new cs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),r2=(function(){for(var r=new cs(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),n2=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=pf(f,v,s.subarray(g,m)):(f[g]=u,v=pf(f,v,s.subarray(g,p)))}else{for(var y=t2[o-1],x=y>>>13,k=8191&y,b=(1<<a)-1,w=new lt(32768),C=new lt(b+1),_=Math.ceil(a/3),A=2*_,$=function(lu){return(s[lu]^s[lu+1]<<_^s[lu+2]<<A)&b},T=new cs(25e3),O=new lt(288),X=new lt(32),F=0,N=0,Z=(g=0,0),K=0,le=0;g<p;++g){var U=$(g),ee=32767&g,D=C[U];if(w[ee]=D,C[U]=ee,K<=g){var ie=p-g;if((F>7e3||Z>24576)&&ie>423){v=e_(s,f,0,T,O,X,N,Z,le,g-le,v),Z=F=N=0,le=g;for(var Y=0;Y<286;++Y)O[Y]=0;for(Y=0;Y<30;++Y)X[Y]=0}var de=2,ge=0,wt=k,Pe=ee-D&32767;if(ie>2&&U==$(g-Pe))for(var ct=Math.min(x,ie)-1,zt=Math.min(32767,g),ou=Math.min(258,ie);Pe<=zt&&--wt&&ee!=D;){if(s[g+de]==s[g+de-Pe]){for(var kt=0;kt<ou&&s[g+kt]==s[g+kt-Pe];++kt);if(kt>de){if(de=kt,ge=Pe,kt>ct)break;var Le=Math.min(Pe,kt-2),la=0;for(Y=0;Y<Le;++Y){var au=g-Pe+Y+32768&32767,Xf=au-w[au]+32768&32767;Xf>la&&(la=Xf,D=au)}}}Pe+=(ee=D)-(D=w[ee])+32768&32767}if(ge){T[Z++]=268435456|cf[de]<<18|uf[ge];var Jf=31&cf[de],Qf=31&uf[ge];N+=Wf[Jf]+zf[Qf],++O[257+Jf],++X[Qf],K=g+de,++F}else T[Z++]=s[g],++O[s[g]]}}v=e_(s,f,u,T,O,X,N,Z,le,g-le,v)}return f0(h,0,l+h0(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)},fh=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function i2(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=r2[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=n2(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&&fh(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),fh(s,o-8,t.d()),fh(s,o-4,n),s}var s2=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),wy=!0}var Bl=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=vy(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&&Vn(m.tiles,s.accumulator,m.actions)}catch(m){console.error("[SmartCanvas] Error fetching/applying initial config:",m)}e&&e();let l=Hl();lo();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??Dn({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&&Sy(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),xy(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&&Vn(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 Bl(r)}});var Tp="syn_";function Di(r){if(!r.startsWith(Tp))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(Tp.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 Vl(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return Tp+t}function It(r){if(typeof process<"u"&&process.env)return process.env[r]}var Cy="syntro_segment_attributes";function Ay(){if(typeof window>"u")return{};try{let r=localStorage.getItem(Cy);if(r){let e=JSON.parse(r);return Z("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){Ze("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function Ry(r){if(!(typeof window>"u"))try{localStorage.setItem(Cy,JSON.stringify(r)),Z("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){Ze("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Ty(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 Ip(){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 Ey="syntro_geo",Iy="https://geo.syntrologie.com";async function $p(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(Ey);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(Ey,JSON.stringify(n))}catch{}return Z("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var Mp=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(/\/[^/]*$/,"");Mp=`${e.origin}${t}`}}catch{Mp=null}function $y(){return Mp}var My=["fbclid","ttclid","gclid","gbraid","wbraid","msclkid","twclid","li_fat_id","epik","ScCid","yclid","_kx","mc_eid","mc_cid"];function Pp(r){if(typeof window>"u"||!r.setPersonPropertiesOnce)return;let e=new URLSearchParams(window.location.search),t={};for(let n of My){let i=e.get(n);i&&(t[`$initial_${n}`]=i)}Object.keys(t).length>0&&r.setPersonPropertiesOnce(t)}var KE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,YE=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,XE=[/@yopmail\.com$/i,/@mailinator\.com$/i,/@guerrillamail\.(com|info|net|org|biz)$/i,/@10minutemail\.com$/i,/^test@/i,/^noreply@/i,/^no-reply@/i];function Ul(r){return r?YE.test(r):!1}function Py(r){return XE.some(e=>e.test(r))}function JE(r){if(r.type==="email")return!0;let e=(r.name||"").toLowerCase(),t=(r.id||"").toLowerCase();return!!(/email/.test(e)||/email/.test(t))}function QE(r){return r.closest("[data-syntro-no-identify]")!==null}function eC(r){return r?KE.test(r):!0}function Op(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}eC(o)?r.identify?.(s,{email:s}):r.alias?.(s),t.add(s)},i=s=>{let o=s.target;if(!(o instanceof HTMLInputElement)||QE(o)||!JE(o))return;let a=(o.value??"").trim().toLowerCase();if(!Ul(a)||Py(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 Oy="_syu",tC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rC(r){return r?tC.test(r):!0}function Lp(r,e){if(typeof window>"u"||!r.identify&&!r.alias)return;let t=new URLSearchParams(window.location.search).get(Oy);if(!t)return;let n=t.trim();if(!n)return;let i=()=>{let a=r.getDistinctId?.();if(a===n)return;let l=Ul(n)?{email:n}:void 0;rC(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 nC=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function iC(r){return r.is_eu==="true"||r.country_code==="GB"||r.country_code==="CH"||!r.is_eu&&!r.country_code}function sC(r){if(!r)return"";try{return new URL(r).hostname}catch{return""}}function Np(){return typeof window>"u"?"":`${window.location.origin}${window.location.pathname}`}function Fp(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:sC(t)};for(let s of nC){let o=n.get(s);o&&(i[`$initial_${s}`]=o)}if(r.setPersonPropertiesOnce(i),!e){r.setPersonPropertiesOnce({$initial_url:Np()});return}e.then(s=>{let o=iC(s)?Np():window.location.href;r.setPersonPropertiesOnce?.({$initial_url:o})}).catch(()=>{r.setPersonPropertiesOnce?.({$initial_url:Np()})})}var Ly=new Set(["email","telephone","streetAddress","addressLocality","addressRegion","postalCode","givenName","familyName"]),Ny=500,Dp=3;function jl(r){if(Array.isArray(r))return r.map(jl);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))Ly.has(t)||(e[t]=jl(n));return e}return r}function Wl(r){if(Array.isArray(r))return r.map(Wl);if(r&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))if(!(t==="description"&&typeof n=="string"&&n.length>Ny)){if(t==="image"&&Array.isArray(n)&&n.length>Dp){e[t]=n.slice(0,Dp);continue}e[t]=Wl(n)}return e}return r}function oC(){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 Hp(r){if(!r.register)return;let e=oC().map(Wl).map(jl);e.length!==0&&r.register({json_ld:e})}function Fy(r,e,t={}){Fp(r,t.geoPromise),Pp(r),Hp(r),Lp(r,e);let n=Op(r,e);return()=>{n()}}var Dy="app:",aC="syntro:",lC=/^[a-z][a-z0-9_]*$/;function zl(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(aC))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(Dy))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(Dy.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(!lC.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function cC(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Hy(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)&&!Hy(n,e,t+1))return!1;return!0}function ql(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(!Hy(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"||cC(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Zl(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 vo=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(Zl(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=zl(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=ql(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(Zl(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=>Zl(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=>Zl(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 Hi(r={}){return new vo(r)}var Bi=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 Vy={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Uy(){return Vy}function Bp(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 yo(r,e,t){return t===2?Bp(Bp(r+e)+"")%1e4/1e4:t===1?Bp(e+r)%1e3/1e3:null}function uC(r){return r<=0?[]:new Array(r).fill(1/r)}function Gl(r,e){return r>=e[0]&&r<e[1]}function jy(r,e){let t=yo("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Wy(r,e){for(let t=0;t<e.length;t++)if(Gl(r,e[t]))return t;return-1}function Up(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function Kl(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=hC(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 dC(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 pC(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=>!dC(i[0],i[1],i[2]))}catch{return!1}}function hC(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=Up(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return pC(n,t);return!1}catch{return!1}}function zy(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=uC(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 qy(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 Zy(r){try{return r()}catch(e){return console.error(e),!1}}var Vp=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function Kn(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||Vy.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Vp(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Vp(i)},n,Vp(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function bo(r){return typeof r=="string"?r:JSON.stringify(r)}function _t(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 Gy(){let r;try{r="1.6.4"}catch{r=""}return r}function Ky(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 By(r){return typeof r=="object"&&r!==null}function Yl(r){return r.urlPatterns&&r.variations.some(e=>By(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>By(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Xl(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 nt={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},or=Uy(),Vi={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>or.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 or.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new or.EventSource(`${r}/sub/${e}`,{headers:t}):new or.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),mC()):document.visibilityState==="hidden"&&(r=window.setTimeout(gC,nt.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(or.localStorage=globalThis.localStorage)}catch{}var Ui=new Map,Yy=!1,Er=new Map,Jl=new Map,ji=new Map,Wi=new Set;function Jy(r){Object.assign(nt,r),nt.backgroundSync||Gp()}async function Qy({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(nt.backgroundSync=!1),vC({instance:r,allowStale:n,timeout:e,skipCache:t})}function fC(r){let e=_o(r),t=Ui.get(e)||new Set;t.add(r),Ui.set(e,t)}function eb(r){Ui.forEach(e=>e.delete(r))}function gC(){ji.forEach(r=>{r&&(r.state="idle",qp(r))})}function mC(){ji.forEach(r=>{r&&r.state==="idle"&&Zp(r)})}async function Xy(){try{if(!or.localStorage)return;await or.localStorage.setItem(nt.cacheKey,JSON.stringify(Array.from(Er.entries())))}catch{}}async function vC({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=_o(r),s=Wp(r),o=new Date,a=new Date(o.getTime()-nt.maxAge+nt.staleTTL);await yC();let l=!nt.disableCache&&!n?Er.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&Wi.add(i),l.staleAt<o?jp(r):zp(r),{data:l.data,success:!0,source:"cache"}):await Xl(jp(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function _o(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function Wp(r){let e=_o(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 yC(){if(!Yy){Yy=!0;try{if(or.localStorage){let r=await or.localStorage.getItem(nt.cacheKey);if(!nt.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{Er.set(t,{...n,staleAt:new Date(n.staleAt)})}),tb()}}}catch{}if(!nt.disableIdleStreams){let r=Vi.startIdleListener();r&&(Vi.stopIdleListener=r)}}}function tb(){let r=Array.from(Er.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,Er.size-nt.maxEntries),Er.size);for(let t=0;t<e;t++)Er.delete(r[t].key)}function rb(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+nt.staleTTL),s=nt.disableCache?void 0:Er.get(e);if(s&&n&&s.version===n){s.staleAt=i,Xy();return}nt.disableCache||(Er.set(e,{data:t,version:n,staleAt:i,sse:Wi.has(r)}),tb()),Xy();let o=Ui.get(r);o&&o.forEach(a=>bC(a,t))}async function bC(r,e){await r.setPayload(e||r.getPayload())}async function jp(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=_o(r),o=Wp(r),a=Jl.get(o);return a||(a=(i?Vi.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):Vi.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"&&Wi.add(s),c.json()}).then(c=>(rb(s,o,c),zp(r),Jl.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(Jl.delete(o),{data:null,source:"error",success:!1,error:c})),Jl.set(o,a)),a}function zp(r,e=!1){let t=_o(r),n=Wp(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&Wi.add(t),nt.backgroundSync&&Wi.has(t)&&or.EventSource){if(ji.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=Ui.get(t);c&&c.forEach(u=>{jp(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);rb(t,n,c)}a.errors=0}catch{nb(a)}},errors:0,state:"active"};ji.set(t,a),Zp(a)}}function nb(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);qp(r),setTimeout(()=>{["idle","active"].includes(r.state)||Zp(r)},Math.min(e,3e5))}}function qp(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function Zp(r){r.src=Vi.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=()=>nb(r),r.src.onopen=()=>{r.errors=0}}function _C(r,e){qp(r),ji.delete(e)}function Gp(){Wi.clear(),ji.forEach(_C),Ui.clear(),Vi.stopIdleListener()}function Ql(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&zp(r,!0),fC(r)}}var xC=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Xp={revert:function(){}},nc=new Map,Jp=new Set;function wC(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function ic(r){var e=nc.get(r);return e||(e={element:r,attributes:{}},nc.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,wC(e)),o}function oc(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,ib()):r!==t&&(e.isDirty=!0,ib())}function SC(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),oc(FC(e),r)}function kC(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),oc(Array.from(e).filter(Boolean).join(" "),r)}function EC(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),oc(e,r)}function CC(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 AC(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=CC(n);e=i||e}),oc(e,r)}var RC=function(e){return e.innerHTML},TC=function(e,t){return e.innerHTML=t};function ob(r){var e=ic(r);return e.html||(e.html=sc(r,"html",RC,TC,SC)),e.html}var IC=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},$C=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function ab(r){var e=ic(r);return e.position||(e.position=sc(r,"position",IC,$C,AC)),e.position}var MC=function(e,t){return t?e.className=t:e.removeAttribute("class")},PC=function(e){return e.className};function lb(r){var e=ic(r);return e.classes||(e.classes=sc(r,"class",PC,MC,kC)),e.classes}var OC=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},LC=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function cb(r,e){var t=ic(r);return t.attributes[e]||(t.attributes[e]=sc(r,e,OC(e),LC(e),EC)),t.attributes[e]}function NC(r,e){var t=nc.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 ec;function FC(r){return ec||(ec=document.createElement("div")),ec.innerHTML=r,ec.innerHTML}function tc(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||NC(r,e),t.setValue(r,n)}}function DC(r,e){r.html&&tc(e,"html",r.html),r.classes&&tc(e,"class",r.classes),r.position&&tc(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){tc(e,t,r.attributes[t])})}function ib(){nc.forEach(DC)}function HC(r,e){var t=null;r.kind==="html"?t=ob(e):r.kind==="class"?t=lb(e):r.kind==="attribute"?t=cb(e,r.attribute):r.kind==="position"&&(t=ab(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function BC(r,e){var t=null;if(r.kind==="html"?t=ob(e):r.kind==="class"?t=lb(e):r.kind==="attribute"?t=cb(e,r.attribute):r.kind==="position"&&(t=ab(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function ub(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),HC(r,n))})}}function VC(r){r.elements.forEach(function(e){return BC(r,e)}),r.elements.clear(),Jp.delete(r)}function sb(){Jp.forEach(ub)}var Kp;function UC(){typeof document>"u"||(Kp||(Kp=new MutationObserver(function(){sb()})),sb(),Kp.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}UC();function ac(r){return typeof document>"u"?Xp:(Jp.add(r),ub(r),{revert:function(){VC(r)}})}function Yp(r,e){return ac({kind:"html",elements:new Set,mutate:e,selector:r})}function db(r,e){return ac({kind:"position",elements:new Set,mutate:e,selector:r})}function xo(r,e){return ac({kind:"class",elements:new Set,mutate:e,selector:r})}function rc(r,e,t){return xC.test(e)?e==="class"||e==="className"?xo(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)})}):ac({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):Xp}function jC(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 Yp(e,function(a){return a+(n??"")});if(t==="set")return Yp(e,function(){return n??""})}else if(i==="class"){if(t==="append")return xo(e,function(a){n&&a.add(n)});if(t==="remove")return xo(e,function(a){n&&a.delete(n)});if(t==="set")return xo(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return db(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return rc(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return rc(e,i,function(){return n??""});if(t==="remove")return rc(e,i,function(){return null})}return Xp}var WC={html:Yp,classes:xo,attribute:rc,position:db,declarative:jC},pb=WC;var Qp={};function Yr(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!gb(r,i,t))return!1;break;case"$nor":if(gb(r,i,t))return!1;break;case"$and":if(!KC(r,i,t))return!1;break;case"$not":if(Yr(r,i,t))return!1;break;default:if(!wo(i,zC(r,n),t))return!1}return!0}function zC(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 hb(r,e=!1){let t=`${r}${e?"/i":""}`;return Qp[t]||(Qp[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),Qp[t]}function wo(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)||!mb(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!GC(i,e,r[i],t))return!1;return!0}function mb(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function qC(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 ZC(r,e,t){if(!Array.isArray(r))return!1;let n=mb(e)?i=>wo(e,i,t):i=>Yr(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function zi(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 fb(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(wo(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function GC(r,e,t,n){switch(r){case"$veq":return _t(e)===_t(t);case"$vne":return _t(e)!==_t(t);case"$vgt":return _t(e)>_t(t);case"$vgte":return _t(e)>=_t(t);case"$vlt":return _t(e)<_t(t);case"$vlte":return _t(e)<=_t(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)?zi(e,t):!1;case"$ini":return Array.isArray(t)?zi(e,t,!0):!1;case"$inGroup":return zi(e,n[t]||[]);case"$notInGroup":return!zi(e,n[t]||[]);case"$nin":return Array.isArray(t)?!zi(e,t):!1;case"$nini":return Array.isArray(t)?!zi(e,t,!0):!1;case"$not":return!wo(t,e,n);case"$size":return Array.isArray(e)?wo(t,e.length,n):!1;case"$elemMatch":return ZC(e,t,n);case"$all":return Array.isArray(t)?fb(e,t,n):!1;case"$alli":return Array.isArray(t)?fb(e,t,n,!0):!1;case"$regex":try{return hb(t).test(e)}catch{return!1}case"$regexi":try{return hb(t,!0).test(e)}catch{return!1}case"$type":return qC(e)===t;default:return console.error("Unknown operator: "+r),!1}}function gb(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(Yr(r,e[n],t))return!0;return!1}function KC(r,e,t){for(let n=0;n<e.length;n++)if(!Yr(r,e[n],t))return!1;return!0}var YC="Feature Evaluated",XC="Experiment Viewed";function JC(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 QC(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 qi(r){try{await r()}catch{}}function vb(r,e,t){if(r.user.trackedExperiments){let i=uc(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(qi(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(qi(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(qi(()=>i(XC,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function eA(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;qi(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;qi(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;qi(()=>n(YC,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function lc(r,e){if(e.stack.evaluatedFeatures.has(r))return Xr(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=JC(e);if(t.has(r))return Xr(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return Xr(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=lc(l.id,e);if(c.source==="cyclicPrerequisite")return Xr(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!Yr(u,l.condition||{})){if(l.gate)return Xr(e,r,null,"prerequisite");continue e}}if(s.filters&&_b(s.filters,e))continue;if("force"in s){if(s.condition&&!bb(s.condition,e)||!tA(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=>{!vb(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Xr(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}=cc(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Xr(e,r,a.value,"experiment",s.id,o,a)}}return Xr(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function cc(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=rA(r,t),r.urlPatterns&&!Kl(t.user.url||"",r.urlPatterns))return{result:$e(t,r,-1,!1,e)};let s=qy(n,t.user.url||"",i);if(s!==null)return{result:$e(t,r,s,!1,e)};let o=QC(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}=Yn(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}=sA({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(_b(r.filters,t))return{result:$e(t,r,-1,!1,e)}}else if(r.namespace&&!jy(l,r.namespace))return{result:$e(t,r,-1,!1,e)};if(r.include&&!Zy(r.include))return{result:$e(t,r,-1,!1,e)};if(r.condition&&!bb(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=lc(y.id,t);if(x.source==="cyclicPrerequisite")return{result:$e(t,r,-1,!1,e)};let S={value:x.value};if(!Yr(S,y.condition||{}))return{result:$e(t,r,-1,!1,e)}}}if(r.groups&&!iA(r.groups,t))return{result:$e(t,r,-1,!1,e)}}if(r.url&&!nA(r.url,t))return{result:$e(t,r,-1,!1,e)};let h=yo(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:$e(t,r,-1,!1,e)};if(!u){let m=r.ranges||zy(i,r.coverage===void 0?1:r.coverage,r.weights);c=Wy(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}=aA(t,a,bo(l),{[eh(r.key,r.bucketVersion)]:f.key});m&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=vb(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 Xr(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"&&eA(r,e,a),a}function yb(r){return{...r.user.attributes,...r.user.attributeOverrides}}function bb(r,e){return Yr(yb(e),r,e.global.savedGroups||{})}function _b(r,e){return r.some(t=>{let{hashValue:n}=Yn(e,t.attribute);if(!n)return!0;let i=yo(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Gl(i,s))})}function tA(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=Yn(r,t,n);if(!a)return!1;let l=yo(e,a,o||1);return l===null?!1:i?Gl(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}=Yn(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 rA(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=Up(r.url))),r}function Yn(r,e,t){let n=e||"id",i="",s=yb(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function nA(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 iA(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function sA({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=eh(e,t),l=oA(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=eh(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 eh(r,e){return e=e||0,`${r}__${e}`}function th(r,e){return`${r}||${e}`}function oA(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=Yn(r,e),s=th(n,bo(i)),{hashAttribute:o,hashValue:a}=Yn(r,t),l=a?th(o,bo(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 aA(r,e,t,n){let i=th(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 lA(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 xb(r,e,t){let n=rh(r,t);return e.getAllAssignments(n)}function rh(r,e){let t={};return lA(r,e).forEach(i=>{let{hashValue:s}=Yn(r,i);t[i]=bo(s)}),t}async function wb(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await Kn(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await Kn(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await Kn(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function Sb(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 uc(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var Zi=typeof window<"u"&&typeof document<"u",cA=Gy(),So=class{constructor(e){if(e=e||{},this.version=cA,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),Zi&&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 wb(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,Ql(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Jy(e.cacheSettings),e.payload)return await this.setPayload(e.payload),Ql(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return Ql(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return Sb(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 Qy({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 Kn(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 Kn(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,eb(this),e.destroyAllStreams&&Gp(),this.logs=[],Zi&&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}=cc(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}=cc(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&n&&n.valueHash===a)return s;if(n&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=Yl(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Ky(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(Kl(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(Zi)Promise.all([...o?[Xl(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??p))]).then(()=>{try{u(c)}catch(h){console.error(h)}});else try{u(c)}catch(h){console.error(h)}}else if(l==="visual"){let c=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(s.value):this._applyDOMChanges(s.value);c&&this._activeAutoExperiments.set(e,{undo:c,valueHash:a})}}return s}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{n.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(let i of t){let s=this._runAutoExperiment(i,e);if(s&&s.inExperiment&&Yl(i)==="redirect")break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(i=>{try{i(e,t)}catch(s){console.error(s)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return lc(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=>[uc(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(uc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(Zi?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=Yl(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(n=>n.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let n=new URL(this._getContextUrl());for(let i of e.variations){if(!i||!i.urlRedirect)continue;let s=new URL(i.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(s.protocol!==n.protocol||s.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:e.key,error:n}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:Zi?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!Zi)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(pb.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await xb(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=rh(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var uA="https://experiment.syntrologie.com",nh=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 So({...e,apiHost:e.apiHost??uA,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 dc(r={}){return new nh(r)}var kb={growthbook:r=>dc({...r,autoInit:!0})};function Eb(r,e){let t=kb[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(kb).join(", ")}`);return t(e)}var dA=["cdn.syntrologie.com","localhost","127.0.0.1"];function pA(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):dA.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 ih=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!pA(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 hA(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 hA(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 Cb(r){return new ih(r)}var fA="syntro_exp",gA="syntro_var",sh=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(fA),o=i.get(gA);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:_l(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 Ab(r){return new sh(r)}var mA="https://cdn.syntrologie.com/configs",Rb={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return Cb({baseUrl:r.baseUrl??mA,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return Ab({featureKey:r.featureKey})}};function Tb(r,e={}){let t=Rb[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(Rb).join(", ")}`);return t(e)}var Ib="syntro_session_metrics",ko=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(Ib);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(Ib,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function pc(r={}){return new ko(r)}var hc=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 fc=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 hc(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 vA=[()=>new fc];function $b(){for(let r of vA){let e=r();if(e.detect())return e}return null}var oh="syntro_experiments";var bA=720*60*60,gc=class{constructor(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}updateContext(e){this.context={...e,telemetryHost:e.telemetryHost.replace(/\/$/,"")},this.writeCookie()}destroy(){document.cookie=`${oh}=; 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=`${oh}=${t}; max-age=${bA}; path=/; SameSite=Lax`;document.cookie=n}};function Pb(r){return r<768?"mobile":r<1024?"tablet":"desktop"}function lh(r,e){return r==="telegram"||r==="mcp-app"?"agent":e==="mobile"?"mobile":"desktop"}function _A(r="web",e="web"){let t=Date.now(),n=typeof window<"u"?window.innerWidth:0,i=typeof window<"u"?window.innerHeight:0,s=Pb(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:lh(r,s)}}}function ah(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(Mb(t,n))return}if(e.include){for(let n of e.include)if(Mb(t,n))return n;return}return t}function Mb(r,e){let t=r.replace(/\/$/,"")||"/",n=e.replace(/\/$/,"")||"/";if(t===n)return!0;let i=n.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var Eo=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=_A(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=ah(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=ah(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=lh(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=Pb(e.width);if(s!==this.context.surface.device){let o=lh(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=ah(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 mc(r){return new Eo(r)}function ch(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 uh(r,e){let t=[];for(let n of r.conditions){let i=ch(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function Co(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=uh(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 Ao(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 Ob(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 dh(r,e,t={}){let n=Ob(e,t);switch(r.type){case"rules":return Co(r,n);case"score":return Ao(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 ph(r,e,t={}){let n=Ob(e,t);switch(r.type){case"rules":return Co(r,n);case"score":return Ao(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 vc(r){return{evaluate:(e,t)=>dh(e,t,r),evaluateSync:(e,t)=>ph(e,t,r)}}function yc(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 Gi=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 hh="cooldown:";function Lb(r){return{set(e,t){let n=hh+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=hh+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=hh+e;r.remove(t)}}}var Ro="dismissed:";function Nb(r,e){return{mark(t,n=!1){let i=Ro+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Ro+t;return r.has(n)||e.has(n)},clear(t){let n=Ro+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Ro)&&r.remove(t);for(let t of e.keys())t.startsWith(Ro)&&e.remove(t)}}}var fh="freq:";function Fb(r){function e(t){let n=fh+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=fh+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=fh+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var xA="syntro";function gh(r,e){let t=`${e}:`;return{get(n){if(r)try{let i=r.getItem(t+n);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){r.removeItem(t+n);return}return s.value}catch{return}},set(n,i,s){if(r)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};r.setItem(t+n,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(n){r&&r.removeItem(t+n)},has(n){return r?this.get(n)!==void 0:!1},keys(){if(!r)return[];let n=[];for(let i=0;i<r.length;i++){let s=r.key(i);s?.startsWith(t)&&n.push(s.slice(t.length))}return n},clear(){if(!r)return;let n=this.keys();for(let i of n)r.removeItem(t+i)}}}function To(r){let e=new Map,t=`${r}:`;return{get(n){let i=e.get(t+n);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+n);return}return i.value}},set(n,i,s){e.set(t+n,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(n){e.delete(t+n)},has(n){return this.get(n)!==void 0},keys(){let n=[];for(let i of e.keys())i.startsWith(t)&&n.push(i.slice(t.length));return n},clear(){for(let n of e.keys())n.startsWith(t)&&e.delete(n)}}}var Io=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??xA;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?gh(window.sessionStorage,this.namespace):To(this.namespace),this.user=t(window.localStorage)?gh(window.localStorage,this.namespace):To(this.namespace)):(this.session=To(this.namespace),this.user=To(this.namespace)),this.dismissals=Nb(this.session,this.user),this.cooldowns=Lb(this.user),this.frequency=Fb(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?gh(sessionStorage,t):To(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function bc(r={}){return new Io(r)}function Ki(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function $o(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var mh={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"}},Yi={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:[]},Db={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function _c(r,e,t){let n=mh[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 xc(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[Ea(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Aa()),t.shift!==!1&&i.push(Ca({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",ka(e,r,async()=>{let{x:o,y:a,strategy:l}=await Ra(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function wc(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 Sc(r,e){return e==="none"||Yi[e].length===0?null:r.animate(Yi[e],Db)}function kc(r,e){if(e==="none"||Yi[e].length===0)return Promise.resolve();let t=[...Yi[e]].reverse(),n=r.animate(t,Db);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Ec(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 Cc(r){switch(Ki(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 Hb(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 wA=0;function Ac(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-${++wA}`}function u(b,w){t&&t.publish(b,w)}function p(b){let w=l.get(b);if(w){let C=m(b);for(let _ of w)try{_(C)}catch(A){console.error("[Surfaces] State callback error:",A)}}}let h=new Map;function f(b,w,C){switch(w.type){case"html":b.innerHTML=Hb(w.content);return;case"widget":{if(s?.has(w.widgetId)){let _=s.mount(w.widgetId,b,w.config);return C&&h.set(C,_),()=>{_.unmount(),C&&h.delete(C)}}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,C){let _=c(),A=Ki(b),$=C?.priority??0,T=C?.animation??i,P=C?.exclusive??!0,Y=o.get(b);if(Y&&P){if(Y.options.priority>$)throw new Error(`Slot ${b} is occupied by higher priority content (${Y.options.priority} > ${$})`);g(Y)}let F=Ec(b,_);F.style.zIndex=String(Cc(b));let L;if(A==="static")_c(F,b,C?.constraints),e.appendChild(F);else if(A==="inline"){let j=$o(b);if(!j)throw new Error(`Invalid inline slot: ${b}`);if(!n)throw new Error("Anchor resolver required for inline slots");let ee=n({selector:j,route:"**"});if(!ee)throw new Error(`Anchor not found for inline slot: ${j}`);L=wc(F,ee)}else if(A==="adjacent"){let j=$o(b);if(!j)throw new Error(`Invalid adjacent slot: ${b}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let ee=n({selector:j,route:"**"});if(!ee)throw new Error(`Anchor not found for adjacent slot: ${j}`);e.appendChild(F),L=xc(F,ee,C?.position??{placement:"bottom"})}let G=f(F,w,_);Sc(F,T);let K={id:_,slot:b,content:w,options:{priority:$,exclusive:P,animation:T,position:C?.position??{placement:"auto"},constraints:C?.constraints??{},adaptiveId:C?.adaptiveId,autoUnmountOnRouteChange:C?.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:C?.adaptiveId}),p(b),{id:_,update(j){let ee=o.get(b);if(!ee||ee.id!==_)throw new Error("Mount no longer active");let D=h.get(_);if(D){if(j.type==="widget"){D.update(j.config),ee.content=j;return}D.unmount(),h.delete(_)}ee.container.innerHTML="";let ie=f(ee.container,j,_);if(ee.content=j,ie){let J=ee.cleanup;ee.cleanup=()=>{J?.(),ie()}}},setOptions(j){let ee=o.get(b);if(!ee||ee.id!==_)throw new Error("Mount no longer active");j.priority!==void 0&&(ee.options.priority=j.priority),j.animation!==void 0&&(ee.options.animation=j.animation),j.constraints&&A==="static"&&(j.constraints.maxWidth&&(ee.container.style.maxWidth=j.constraints.maxWidth),j.constraints.maxHeight&&(ee.container.style.maxHeight=j.constraints.maxHeight),j.constraints.minWidth&&(ee.container.style.minWidth=j.constraints.minWidth),j.constraints.minHeight&&(ee.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 kc(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 C=l.get(b);return C||(C=new Set,l.set(b,C)),C.add(w),()=>{C?.delete(w),C?.size===0&&l.delete(b)}}function x(b,w){let C=o.get(b);return C?w!==void 0?w>=C.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 Mo=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()}},Rc=new Mo;var yh="2.0.0";function SA(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(vh(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(vh(n,i))return!0;return!1}return!0}function vh(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 Bb(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 vh(t,s)})}function Tc(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??Rc,a=r.executors??ir,l=r.apps??Os,c=new Gi,u=mc({telemetry:e,routes:n,navigation:c,initialSurfaceType:r.initialSurfaceType,initialSurfaceHost:r.initialSurfaceHost}),p=r.events??Hi(),h=bc({namespace:s}),f=yc({eventBus:p,stateStore:h}),v=vc({state:h,events:p,sessionMetrics:t,accumulator:f}),g=ky(),m=Nl(),y=P=>Bb(P)?m.resolve(P.selector):null,x=async(P,Y)=>{if(!Bb(P))return null;try{return await m.waitFor(P.selector,Y)}catch{return null}},S=Ac({overlayRoot:g,eventBus:p,anchorResolver:y,widgetRegistry:o}),b=Pl({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"),C=0,P.set("time_on_page",0),P.set("scroll_depth",0))}catch{}})}let C=0,_,A;if(t){let P=t;_=setInterval(()=>{C++},1e3),A=setInterval(()=>{P.set("time_on_page",C)},5e3)}let $;if(t&&p){let P=t;$=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 T={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:yh,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(SA(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?.(),$?.(),_&&clearInterval(_),A&&clearInterval(A),m.destroy(),f.destroy(),c.destroy(),u.destroy(),b.destroy(),S.destroy()}};return l.bind(T),o.bindRuntime(T),T}function Vb(r){return r==="granted"?"granted":r==="denied"?"denied":"pending"}function bh(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 Po=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(bh(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=bh(a);l!==null&&e(Vb(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=bh(e[t]);if(n!==null)return Vb(n)}return"pending"}};var Oo=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 Ub="visitorConsentCollected",Lo=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(Ub,n)}),()=>{n&&document.removeEventListener(Ub,n)}}};var No=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 Fo=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 Xi=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 kA(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var _h=class{constructor(){this.sessionId=kA(),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 Ic(){return new _h}var E=typeof window<"u"?window:void 0,et=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(et.self=et),typeof File>"u"&&(et.File=function(){});var D_=Array.prototype,jb=D_.forEach,Wb=D_.indexOf,wt=et?.navigator,B=et?.document,Qe=et?.location,Dh=et?.fetch,Hh=et!=null&&et.XMLHttpRequest&&"withCredentials"in new et.XMLHttpRequest?et.XMLHttpRequest:void 0,zb=et?.AbortController,vt=wt?.userAgent,te=E??{},Rr={DEBUG:!1,LIB_VERSION:"1.341.0"};function qb(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 rs(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){qb(s,n,i,o,a,"next",l)}function a(l){qb(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 H_(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 EA=["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"],Zb=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return EA.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},CA=["$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 ou=function(r){return r.trim()},Bh=function(r){return r.replace(/^\$/,"")},AA=Array.isArray,B_=Object.prototype,V_=B_.hasOwnProperty,au=B_.toString,xe=AA||function(r){return au.call(r)==="[object Array]"},nn=r=>typeof r=="function",je=r=>r===Object(r)&&!xe(r),ns=r=>{if(je(r)){for(var e in r)if(V_.call(r,e))return!1;return!0}return!1},V=r=>r===void 0,We=r=>au.call(r)=="[object String]",Vh=r=>We(r)&&r.trim().length===0,Wt=r=>r===null,ge=r=>V(r)||Wt(r),Or=r=>au.call(r)=="[object Number]"&&r==r,es=r=>Or(r)&&r>0,Pr=r=>au.call(r)==="[object Boolean]",RA=r=>r instanceof FormData,TA=r=>fe(CA,r);function Uh(r){return r===null||typeof r!="object"}function Dc(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function U_(r){return!V(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var IA=[!0,"true",1,"1","yes"],xh=r=>fe(IA,r),$A=[!1,"false",0,"0","no"];function lr(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),Or(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),lr(i||t,e,t,n))}var jh=class{constructor(e){this.t={},this.i=e.i,this.o=lr(e.bucketSize,0,100,e.h),this.m=lr(e.refillRate,0,this.o,e.h),this.$=lr(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",Hc="iOS",Mr="Android",ia="Tablet",j_=Mr+" "+ia,W_="iPad",z_="Apple",q_=z_+" Watch",sa="Safari",as="BlackBerry",Z_="Samsung",G_=Z_+"Browser",K_=Z_+" Internet",ei="Chrome",MA=ei+" OS",Y_=ei+" "+Hc,Jf="Internet Explorer",X_=Jf+" "+$t,Qf="Opera",PA=Qf+" Mini",eg="Edge",J_="Microsoft "+eg,ss="Firefox",Q_=ss+" "+Hc,oa="Nintendo",aa="PlayStation",os="Xbox",e0=Mr+" "+$t,t0=$t+" "+sa,Zo="Windows",Wh=Zo+" Phone",Gb="Nokia",zh="Ouya",r0="Generic",OA=r0+" "+$t.toLowerCase(),n0=r0+" "+ia.toLowerCase(),qh="Konqueror",lt="(\\d+(\\.\\d+)?)",wh=new RegExp("Version/"+lt),LA=new RegExp(os,"i"),NA=new RegExp(aa+" \\w+","i"),FA=new RegExp(oa+" \\w+","i"),tg=new RegExp(as+"|PlayBook|BB10","i"),DA={"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"},$c,Kb,Sh,HA=(r,e)=>e&&fe(e,z_)||(function(t){return fe(t,sa)&&!fe(t,ei)&&!fe(t,Mr)})(r),i0=function(r,e){return e=e||"",fe(r," OPR/")&&fe(r,"Mini")?PA:fe(r," OPR/")?Qf:tg.test(r)?as:fe(r,"IE"+$t)||fe(r,"WPDesktop")?X_:fe(r,G_)?K_:fe(r,eg)||fe(r,"Edg/")?J_:fe(r,"FBIOS")?"Facebook "+$t:fe(r,"UCWEB")||fe(r,"UCBrowser")?"UC Browser":fe(r,"CriOS")?Y_:fe(r,"CrMo")||fe(r,ei)?ei:fe(r,Mr)&&fe(r,sa)?e0:fe(r,"FxiOS")?Q_:fe(r.toLowerCase(),qh.toLowerCase())?qh:HA(r,e)?fe(r,$t)?t0:sa:fe(r,ss)?ss:fe(r,"MSIE")||fe(r,"Trident/")?Jf:fe(r,"Gecko")?ss:""},BA={[X_]:[new RegExp("rv:"+lt)],[J_]:[new RegExp(eg+"?\\/"+lt)],[ei]:[new RegExp("("+ei+"|CrMo)\\/"+lt)],[Y_]:[new RegExp("CriOS\\/"+lt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+lt)],[sa]:[wh],[t0]:[wh],[Qf]:[new RegExp("(Opera|OPR)\\/"+lt)],[ss]:[new RegExp(ss+"\\/"+lt)],[Q_]:[new RegExp("FxiOS\\/"+lt)],[qh]:[new RegExp("Konqueror[:/]?"+lt,"i")],[as]:[new RegExp(as+" "+lt),wh],[e0]:[new RegExp("android\\s"+lt,"i")],[K_]:[new RegExp(G_+"\\/"+lt)],[Jf]:[new RegExp("(rv:|MSIE )"+lt)],Mozilla:[new RegExp("rv:"+lt)]},VA=function(r,e){var t=i0(r,e),n=BA[t];if(V(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},Yb=[[new RegExp(os+"; "+os+" (.*?)[);]","i"),r=>[os,r&&r[1]||""]],[new RegExp(oa,"i"),[oa,""]],[new RegExp(aa,"i"),[aa,""]],[tg,[as,""]],[new RegExp(Zo,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Wh,""];if(new RegExp($t).test(e)&&!/IEMobile\b/.test(e))return[Zo+" "+$t,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=DA[n]||"";return/arm/i.test(e)&&(i="RT"),[Zo,i]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Hc,e.join(".")]}return[Hc,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=V(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Mr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Mr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Mr,e.join(".")]}return[Mr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[MA,""]],[/Linux|debian/i,["Linux",""]]],Xb=function(r){return FA.test(r)?oa:NA.test(r)?aa:LA.test(r)?os:new RegExp(zh,"i").test(r)?zh:new RegExp("("+Wh+"|WPDesktop)","i").test(r)?Wh:/iPad/.test(r)?W_:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?q_:tg.test(r)?as:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Gb,"i").test(r)?Gb:/(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)?Mr:j_:new RegExp("(pda|"+$t+")","i").test(r)?OA:new RegExp(ia,"i").test(r)&&!new RegExp(ia+" pc","i").test(r)?n0:""},UA=r=>r instanceof Error;function jA(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Sh&&t.length===Kb||(Kb=t.length,Sh=t.reduce(((n,i)=>{$c||($c={});var s=$c[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,$c[i]=[c,u];break}}return n}),{})),Sh}}var Zh=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return rs((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 rs((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:jA(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)})}},ls="?";function Gh(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?ls:t,in_app:!0};return V(n)||(s.lineno=n),V(i)||(s.colno=i),s}var s0=(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]:ls,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},WA=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,zA=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qA=/\((\S*)(?::(\d+))(?::(\d+))\)/,ZA=(r,e)=>{var t=WA.exec(r);if(t){var[,n,i,s]=t;return Gh(e,n,ls,+i,+s)}var o=zA.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=qA.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=s0(o[1]||ls,o[2]);return Gh(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},GA=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KA=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YA=(r,e)=>{var t=GA.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=KA.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]||ls;return[s,i]=s0(s,i),Gh(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Jb=/\(error: (.*)\)/,Qb=50;function XA(){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=Jb.test(c)?c.replace(Jb,"$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>=Qb)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,Qb).map((g=>{return W({},g,{filename:g.filename||(m=v,m[m.length-1]||{}).filename,function:g.function||ls});var m}))})(o)}})("web:javascript",ZA,YA)}var Kh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=We(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 Dc(e,"DOMException")}isDOMError(e){return Dc(e,"DOMError")}},Yh=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}},Xh=class{constructor(){}match(e){return Dc(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}}},JA=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Jh=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(JA);return i&&(t=i[1],n=i[2]),[t,n]}},QA=["fatal","error","warning","log","info","debug"];function o0(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 Qh=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=t.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return U_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+o0(e)}isSeverityLevel(e){return We(e)&&!Vh(e)&&QA.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(UA(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},ef=class{match(e){return U_(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+o0(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},tf=class{match(e){return Uh(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}}},rf=class{match(e){return Dc(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return Uh(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(Uh(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}},a0=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(Rr.DEBUG||te.POSTHOG_DEBUG||t)&&!V(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)=>a0(r+" "+i,s)};return n},U=a0("[PostHog.js]"),Le=U.createLogger,e2=Le("[ExternalScriptsLoader]"),e_=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return e2.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=B?.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(!B)return t("document not found");var l=B.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")B.head.appendChild(l);else{var c,u=B.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):B.body.appendChild(l)}};B!=null&&B.body?a():B?.addEventListener("DOMContentLoaded",a)};te.__PosthogExtensions__=te.__PosthogExtensions__||{},te.__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);e_(r,s,t)},te.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);e_(r,n,t)};var Bc={};function sn(r,e,t){if(xe(r)){if(jb&&r.forEach===jb)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)===Bc)return}}}function Re(r,e,t){if(!ge(r)){if(xe(r))return sn(r,e,t);if(RA(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===Bc)return}else for(var i in r)if(V_.call(r,i)&&e.call(t,r[i],i)===Bc)return}}var Ne=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 sn(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},us=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 sn(t,(function(i){sn(i,(function(s){r.push(s)}))})),r};function Nc(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 t_=function(r){try{return r()}catch{return}},t2=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)}}},rg=function(r){var e={};return Re(r,(function(t,n){(We(t)&&t.length>0||Or(t))&&(e[n]=t)})),e};function r2(r,e){return t=r,n=s=>We(s)&&!Wt(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=[],sn(o,(c=>{l.push(s(c))}))):(l={},Re(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var n2=["herokuapp.com","vercel.app","netlify.app"];function i2(r){var e=r?.hostname;if(!We(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of n2)if(t===n)return!1;return!0}function l0(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Ve(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var c0="$people_distinct_id",Go="__alias",Ko="__timers",r_="$autocapture_disabled_server_side",nf="$heatmaps_enabled_server_side",n_="$exception_capture_enabled_server_side",sf="$error_tracking_suppression_rules",i_="$error_tracking_capture_extension_exceptions",s_="$web_vitals_enabled_server_side",u0="$dead_clicks_enabled_server_side",o_="$product_tours_enabled_server_side",a_="$web_vitals_allowed_metrics",kh="$session_recording_remote_config",Vc="$sesid",d0="$session_is_sampled",is="$enabled_feature_flags",Yo="$early_access_features",of="$feature_flag_details",Xo="$stored_person_properties",Qn="$stored_group_properties",af="$surveys",Uc="$flag_call_reported",Tr="$user_state",lf="$client_session_props",cf="$capture_rate_limit",uf="$initial_campaign_params",df="$initial_referrer_info",jc="$initial_person_info",Wc="$epp",p0="__POSTHOG_TOOLBAR__",Do="$posthog_cookieless",s2=[c0,Go,"__cmpns",Ko,"$session_recording_enabled_server_side",nf,Vc,is,sf,Tr,Yo,of,Qn,Xo,af,Uc,lf,cf,uf,df,Wc,jc,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function l_(r){return r instanceof Element&&(r.id===p0||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function lu(r){return!!r&&r.nodeType===1}function on(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function h0(r){return!!r&&r.nodeType===3}function f0(r){return!!r&&r.nodeType===11}function ng(r){return r?ou(r).split(/\s+/):[]}function c_(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function zc(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 ng(e)}function g0(r){return ge(r)?null:ou(r).split(/(\s+)/).filter((e=>la(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ua(r){var e="";return pf(r)&&!_0(r)&&r.childNodes&&r.childNodes.length&&Re(r.childNodes,(function(t){var n;h0(t)&&t.textContent&&(e+=(n=g0(t.textContent))!==null&&n!==void 0?n:"")})),ou(e)}function m0(r){return V(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var ig=["a","button","form","input","select","textarea","label"];function v0(r,e){if(V(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 y0(r){var e=r.parentNode;return!(!e||!lu(e))&&e}var o2=["next","previous","prev",">","<"],u_=10,d_=[".ph-no-rageclick",".ph-no-capture"];function a2(r,e){if(!E||sg(r))return!1;var t,n,i;if(Pr(e)?(t=!!e&&d_,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:d_,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=b0(r,!1);return!(function(o,a){if(o===!1||V(o))return!1;var l;if(o===!0)l=o2;else{if(!xe(o))return!1;if(o.length>u_)return U.error("[PostHog] content_ignorelist array cannot exceed "+u_+" 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:ua(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!v0(s,t)}var sg=r=>!r||on(r,"html")||!lu(r),b0=(r,e)=>{if(!E||sg(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!on(i,"body");)if(f0(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=y0(i);if(!s)break;if(e||ig.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 l2(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||sg(r)||(s=t)!=null&&s.url_allowlist&&!c_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&c_(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}=b0(r,n);if(!(function(v,g){var m=g?.element_allowlist;if(V(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)||!v0(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&&(ig.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function pf(r){for(var e=r;e.parentNode&&!on(e,"body");e=e.parentNode){var t=zc(e);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(zc(r),"ph-include"))return!0;var n=r.type||"";if(We(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(We(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 _0(r){return!!(on(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||on(r,"select")||on(r,"textarea")||r.getAttribute("contenteditable")==="true")}var x0="(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})",c2=new RegExp("^(?:"+x0+")$"),u2=new RegExp(x0),w0="\\d{3}-?\\d{2}-?\\d{4}",d2=new RegExp("^("+w0+")$"),p2=new RegExp("("+w0+")");function la(r,e){return e===void 0&&(e=!0),!(ge(r)||We(r)&&(r=ou(r),(e?c2:u2).test((r||"").replace(/[- ]/g,""))||(e?d2:p2).test(r)))}function S0(r){var e=ua(r);return la(e=(e+" "+k0(r)).trim())?e:""}function k0(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Re(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=ua(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+k0(t)).trim())}catch(s){U.error("[AutoCapture]",s)}})),e}function h2(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 Nc(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[p_(p.toString())]=p_(h.toString())})),o+=":",o+=Nc(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:f2(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Nc(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 p_(r){return r.replace(/"|\\"/g,'\\"')}function f2(r){var e=r.attr__class;return e?xe(e)?e:ng(e):void 0}var qc=class{constructor(e){this.disabled=e===!1;var t=je(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}},Zc=r=>{var e=B?.createElement("a");return V(e)?null:(e.href=r,e)},g2=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return Re(r,(function(s,o){V(s)||V(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)},Gc=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," ")},da=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},Kc=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Eh="$copy_autocapture",h_=Le("[AutoCapture]");function Ch(r,e){return e.length>r?e.slice(0,r)+"...":e}function m2(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!lu(e));return e}function v2(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};ig.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Ch(1024,S0(r)):s.$el_text=Ch(1024,ua(r)));var o=zc(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),Re(r.attributes,(function(u){var p;if((!_0(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&la(u.value)&&(p=u.name,!We(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=ng(h).join(" ")),s["attr__"+u.name]=Ch(1024,h)}}));for(var a=1,l=1,c=r;c=m2(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function y2(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!on(u,"body");)f0(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(Re(c,(b=>{var w=pf(b);b.tagName.toLowerCase()==="a"&&(v=b.getAttribute("href"),v=w&&v&&la(v)&&v),fe(zc(b),"ph-no-capture")&&(g=!0),h.push(v2(b,s,o,a));var C=(function(_){if(!pf(_))return{};var A={};return Re(_.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var T=$.name.replace("data-ph-capture-attribute-",""),P=$.value;T&&P&&la(P)&&(A[T]=P)}})),A})(b);Ne(f,C)})),g)return{props:{},explicitNoCapture:g};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=S0(r):h[0].$el_text=ua(r)),v){var m,y;h[0].attr__href=v;var x=(m=Zc(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:Ne({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:h2(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 hf=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new qc(e.config.rageclick),this.C=null}get R(){var e,t,n=je(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&&B){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){h_.error("Failed to capture event",i)}};if(Ve(B,"submit",e,{capture:!0}),Ve(B,"change",e,{capture:!0}),Ve(B,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,Eh)};Ve(B,"copy",t,{capture:!0}),Ve(B,"cut",t,{capture:!0})}}}else h_.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({[r_]:!!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=B?.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[r_],i=this.T;if(Wt(i)&&!Pr(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=m0(e);h0(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())&&a2(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===Eh;if(i&&l2(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=y2(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===Eh){var c,u=g0(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 nn(B?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Or(r)&&isFinite(r)&&Math.floor(r)===r});var f_="0123456789abcdef",ff=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+f_.charAt(this.bytes[t]>>>4)+f_.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}},gf=class{constructor(){this.A=0,this.j=0,this.D=new mf}generate(){var e=this.generateOrAbort();if(V(e)){this.A=0;var t=this.generateOrAbort();if(V(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 ff.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())}},g_,E0=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&&!V(E.crypto)&&crypto.getRandomValues&&(E0=r=>crypto.getRandomValues(r));var mf=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(E0(this.N),this.U=0),this.N[this.U++]}},rn=()=>b2().toString(),b2=()=>(g_||(g_=new gf)).generate(),Ho="",_2=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function x2(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=B),Ho)return Ho;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+rn();!Ho&&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",Ho=c)}return Ho})(r);if(!t){var n=(i=>{var s=i.match(_2);return s?s[0]:""})(r);n!==t&&U.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var ar={H:()=>!!B,B:function(r){U.error("cookieStore error: "+r)},q:function(r){if(B){try{for(var e=r+"=",t=B.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(ar.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(B)try{var s="",o="",a=x2(B.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),B.cookie=c,c}catch{return}},V:function(r,e){if(B!=null&&B.cookie)try{ar.G(r,"",-1,e)}catch{return}}},Ah=null,Me={H:function(){if(!Wt(Ah))return Ah;var r=!0;if(V(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"),Ah=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)}}},w2=["$device_id","distinct_id",Vc,d0,Wc,jc],Mc={},S2={H:function(){return!0},B:function(r){U.error("memoryStorage error: "+r)},q:function(r){return Mc[r]||null},W:function(r){return Mc[r]||null},G:function(r,e){Mc[r]=e},V:function(r){delete Mc[r]}},Xn=null,Je={H:function(){if(!Wt(Xn))return Xn;if(Xn=!0,V(E))Xn=!1;else try{var r="__support__";Je.G(r,"xyz"),Je.q(r)!=='"xyz"'&&(Xn=!1),Je.V(r)}catch{Xn=!1}return Xn},B:function(r){U.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){Je.B(e)}return null},W:function(r){try{return JSON.parse(Je.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){Je.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){Je.B(e)}}},Ir=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),vf=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Ir.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Ir.DENIED||this.consent===Ir.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ir.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 xh(e)?Ir.GRANTED:fe($A,e)?Ir.DENIED:Ir.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Me:ar;var t=e==="localStorage"?ar:Me;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(xh(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!l0([wt?.doNotTrack,wt?.msDoNotTrack,te.doNotTrack],(e=>xh(e)))}},Pc=Le("[Dead Clicks]"),k2=()=>!0,E2=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(u0)),n=r.instance.config.capture_dead_clicks;return Pr(n)?n:!!je(n)||t},Yc=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[u0]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Pc.error("failed to load script",i):e()}))}et(){var e;if(B){if(!this.tt&&(e=te.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=je(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=te.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(B),Pc.info("starting...")}}else Pc.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Pc.info("stopping..."))}},Bo=Le("[ExceptionAutocapture]"),yf=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=te.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=te.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=te.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=te.__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){Bo.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[n_]),this.dt=new jh({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:Bo}),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 je(e)?t=W({},t,e):(V(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?(Bo.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Bo.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({[n_]: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)?Bo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function m_(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return nn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var bf=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__||m_(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__||m_(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")};Ve(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},Rh=Le("[SegmentIntegration]");function C2(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()||rn();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(Tr,"identified")),i()},a=s.user();"then"in a&&nn(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||Rh.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()||(Rh.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(Rh.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 C0="posthog-js";function A0(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 _f=class{constructor(e,t,n,i,s,o){this.name=C0,this.setupOnce=function(a){a(A0(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},A2=E!=null&&E.location?Kc(E.location.hash,"__posthog")||Kc(location.hash,"state"):null,v_="_postHogToolbarParams",y_=Le("[Toolbar]"),tn=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(tn||{}),xf=class{constructor(e){this.instance=e}yt(e){te.ph_toolbar_state=e}wt(){var e;return(e=te.ph_toolbar_state)!==null&&e!==void 0?e:tn.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||!B)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=A2||Kc(e.hash,"__posthog")||Kc(e.hash,"state"),o=s?t_((()=>JSON.parse(atob(decodeURIComponent(s)))))||t_((()=>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(v_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=te.ph_load_toolbar||te.ph_load_editor;!ge(t)&&nn(t)?t(e,this.instance):y_.warn("No toolbar load function found")}loadToolbar(e){var t=!(B==null||!B.getElementById(p0));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(v_,JSON.stringify(W({},i,{source:void 0}))),this.wt()===tn.LOADED)this.xt(i);else if(this.wt()===tn.UNINITIALIZED){var s;this.yt(tn.LOADING),(s=te.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return y_.error("[Toolbar] Failed to load",o),void this.yt(tn.UNINITIALIZED);this.yt(tn.LOADED),this.xt(i)})),Ve(E,"turbolinks:load",(()=>{this.yt(tn.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)}},R2=Le("[TracingHeaders]"),wf=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;V(this.$t)&&((t=te.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),V(this.St)&&((n=te.__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=te.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return R2.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)}},Oc="https?://(.*)",ds=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],T2=us(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ds),pa="<masked>",I2=["li_fat_id"];function R0(r,e,t){if(!B)return{};var n,i=e?us([],ds,t||[]):[],s=T0(da(B.URL,i,pa),r),o=(n={},Re(I2,(function(a){var l=ar.q(a);n[a]=l||null})),n);return Ne(o,s)}function T0(r,e){var t=T2.concat(e||[]),n={};return Re(t,(function(i){var s=Gc(r,i);n[i]=s||null})),n}function I0(r){var e=(function(s){return s?s.search(Oc+"google.([^/?]*)")===0?"google":s.search(Oc+"bing.com")===0?"bing":s.search(Oc+"yahoo.com")===0?"yahoo":s.search(Oc+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Wt(e)){n.$search_engine=e;var i=B?Gc(B.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function b_(){return navigator.language||navigator.userLanguage}function $0(){return B?.referrer||"$direct"}function M0(r,e){var t=r?us([],ds,e||[]):[],n=Qe?.href.substring(0,1e3);return{r:$0().substring(0,1e3),u:n?da(n,t,pa):void 0}}function P0(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Zc(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=Zc(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=T0(n);Ne(i,o)}if(t){var a=I0(t);Ne(i,a)}return i}function O0(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function $2(){try{return new Date().getTimezoneOffset()}catch{return}}function M2(r,e){if(!vt)return{};var t,n,i,s=r?us([],ds,e||[]):[],[o,a]=(function(l){for(var c=0;c<Yb.length;c++){var[u,p]=Yb[c],h=u.exec(l),f=h&&(nn(p)?p(h,l):p);if(f)return f}return["",""]})(vt);return Ne(rg({$os:o,$os_version:a,$browser:i0(vt,navigator.vendor),$device:Xb(vt),$device_type:(n=vt,i=Xb(n),i===W_||i===j_||i==="Kobo"||i==="Kindle Fire"||i===n0?ia:i===oa||i===os||i===aa||i===zh?"Console":i===q_?"Wearable":i?$t:"Desktop"),$timezone:O0(),$timezone_offset:$2()}),{$current_url:da(Qe?.href,s,pa),$host:Qe?.host,$pathname:Qe?.pathname,$raw_user_agent:vt.length>1e3?vt.substring(0,997)+"...":vt,$browser_version:VA(vt,navigator.vendor),$browser_language:b_(),$browser_language_prefix:(t=b_(),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:Rr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Jr=Le("[Web Vitals]"),__=9e5,Sf=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(V(s))Jr.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();V(o)||(ge(n?.name)||ge(n?.value)?Jr.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?Jr.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),V(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=V(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=te.__PosthogExtensions__;V(a)||V(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):Jr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[s_]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=je(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[a_])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=je(this._instance.config.capture_performance)&&Or(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:__;return 0<e&&e<=6e4?__:e}get isEnabled(){var e=Qe?.protocol;if(e!=="http:"&&e!=="https:")return Jr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=je(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Pr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Pr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Jr.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=je(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=je(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[s_]:t}),this._instance.persistence.register({[a_]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=te.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?Jr.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?us([],ds,n||[]):[];return da(e,i,pa)}Jr.error("Could not determine current URL")}},P2=Le("[Heatmaps]");function x_(r){return je(r)&&"clientX"in r&&"clientY"in r&&Or(r.clientX)&&Or(r.clientY)}var kf=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[nf]),this.rageclicks=new qc(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return je(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;P2.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({[nf]: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"})(B)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&B&&(this.Nt=this.Lt.bind(this),Ve(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Ve(B,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Ve(B,"mousemove",this.zt,{capture:!0}),this.Bt=new Yc(this.instance,k2,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Ve(B,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&B&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&B.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&B.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&B.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&&lu(u)&&!on(u,"body");){if(u===c)return!1;if(fe(l,E?.getComputedStyle(u).position))return!0;u=y0(u)}return!1})(m0(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"),!l_(e.target)&&x_(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){!l_(e.target)&&x_(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?us([],ds,i||[]):[],o=da(t,s,pa);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!ns(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Xc=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(!(V(o)||V(a)||V(l)||V(c)||V(u)||V(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:lr(a/o,0,1,U),f=o<=1?1:lr(l/o,0,1,U),v=c<=1?1:lr(u/c,0,1,U),g=c<=1?1:lr(p/c,0,1,U);i=Ne(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 $r=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Mt=Uint8Array,ct=Uint16Array,cs=Uint32Array,og=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]),ag=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]),w_=new Mt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),L0=function(r,e){for(var t=new ct(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new cs(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]},N0=L0(og,2),O2=N0[0],Ef=N0[1];O2[28]=258,Ef[258]=28;for(Cf=L0(ag,0)[1],Jc=new ct(32768),Te=0;Te<32768;++Te)Qr=(43690&Te)>>>1|(21845&Te)<<1,Qr=(61680&(Qr=(52428&Qr)>>>2|(13107&Qr)<<2))>>>4|(3855&Qr)<<4,Jc[Te]=((65280&Qr)>>>8|(255&Qr)<<8)>>>1;var Qr,Cf,Jc,Te,ta=function(r,e,t){for(var n=r.length,i=0,s=new ct(e);i<n;++i)++s[r[i]-1];var o,a=new ct(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(t){o=new ct(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[Jc[p]>>>l]=c}else for(o=new ct(n),i=0;i<n;++i)o[i]=Jc[a[r[i]-1]++]>>>15-r[i];return o},ti=new Mt(288);for(Te=0;Te<144;++Te)ti[Te]=8;for(Te=144;Te<256;++Te)ti[Te]=9;for(Te=256;Te<280;++Te)ti[Te]=7;for(Te=280;Te<288;++Te)ti[Te]=8;var Qc=new Mt(32);for(Te=0;Te<32;++Te)Qc[Te]=5;var L2=ta(ti,9,0),N2=ta(Qc,5,0),F0=function(r){return(r/8>>0)+(7&r&&1)},D0=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof ct?ct:r instanceof cs?cs:Mt)(t-e);return n.set(r.subarray(e,t)),n},Cr=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},Vo=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},Th=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,C){return w.f-C.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 ct(h+1),v=Af(t[u-1],f,0);if(v>e){n=0;var g=0,m=v-e,y=1<<m;for(s.sort((function(w,C){return f[C.s]-f[w.s]||w.f-C.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]},Af=function(r,e,t){return r.s==-1?Math.max(Af(r.l,e,t+1),Af(r.r,e,t+1)):e[r.s]=t},S_=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new ct(++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]},Uo=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Rf=function(r,e,t){var n=t.length,i=F0(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)},k_=function(r,e,t,n,i,s,o,a,l,c,u){Cr(e,u++,t),++i[256];for(var p=Th(i,15),h=p[0],f=p[1],v=Th(s,15),g=v[0],m=v[1],y=S_(h),x=y[0],S=y[1],b=S_(g),w=b[0],C=b[1],_=new ct(19),A=0;A<x.length;++A)_[31&x[A]]++;for(A=0;A<w.length;++A)_[31&w[A]]++;for(var $=Th(_,7),T=$[0],P=$[1],Y=19;Y>4&&!T[w_[Y-1]];--Y);var F,L,G,K,le=c+5<<3,j=Uo(i,ti)+Uo(s,Qc)+o,ee=Uo(i,h)+Uo(s,g)+o+14+3*Y+Uo(_,T)+(2*_[16]+3*_[17]+7*_[18]);if(le<=j&&le<=ee)return Rf(e,u,r.subarray(l,l+c));if(Cr(e,u,1+(ee<j)),u+=2,ee<j){F=ta(h,f,0),L=h,G=ta(g,m,0),K=g;var D=ta(T,P,0);for(Cr(e,u,S-257),Cr(e,u+5,C-1),Cr(e,u+10,Y-4),u+=14,A=0;A<Y;++A)Cr(e,u+3*A,T[w_[A]]);u+=3*Y;for(var ie=[x,w],J=0;J<2;++J){var de=ie[J];for(A=0;A<de.length;++A){var pe=31&de[A];Cr(e,u,D[pe]),u+=T[pe],pe>15&&(Cr(e,u,de[A]>>>5&127),u+=de[A]>>>12)}}}else F=L2,L=ti,G=N2,K=Qc;for(A=0;A<a;++A)if(n[A]>255){pe=n[A]>>>18&31,Vo(e,u,F[pe+257]),u+=L[pe+257],pe>7&&(Cr(e,u,n[A]>>>23&31),u+=og[pe]);var ve=31&n[A];Vo(e,u,G[ve]),u+=K[ve],ve>3&&(Vo(e,u,n[A]>>>5&8191),u+=ag[ve])}else Vo(e,u,F[n[A]]),u+=L[n[A]];return Vo(e,u,F[256]),u+L[256]},F2=new cs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),D2=(function(){for(var r=new cs(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),H2=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=Rf(f,v,s.subarray(g,m)):(f[g]=u,v=Rf(f,v,s.subarray(g,p)))}else{for(var y=F2[o-1],x=y>>>13,S=8191&y,b=(1<<a)-1,w=new ct(32768),C=new ct(b+1),_=Math.ceil(a/3),A=2*_,$=function(mu){return(s[mu]^s[mu+1]<<_^s[mu+2]<<A)&b},T=new cs(25e3),P=new ct(288),Y=new ct(32),F=0,L=0,G=(g=0,0),K=0,le=0;g<p;++g){var j=$(g),ee=32767&g,D=C[j];if(w[ee]=D,C[j]=ee,K<=g){var ie=p-g;if((F>7e3||G>24576)&&ie>423){v=k_(s,f,0,T,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 de=2,pe=0,ve=S,_e=ee-D&32767;if(ie>2&&j==$(g-_e))for(var ut=Math.min(x,ie)-1,zt=Math.min(32767,g),fu=Math.min(258,ie);_e<=zt&&--ve&&ee!=D;){if(s[g+de]==s[g+de-_e]){for(var St=0;St<fu&&s[g+St]==s[g+St-_e];++St);if(St>de){if(de=St,pe=_e,St>ut)break;var Fe=Math.min(_e,St-2),ha=0;for(J=0;J<Fe;++J){var gu=g-_e+J+32768&32767,hg=gu-w[gu]+32768&32767;hg>ha&&(ha=hg,D=gu)}}}_e+=(ee=D)-(D=w[ee])+32768&32767}if(pe){T[G++]=268435456|Ef[de]<<18|Cf[pe];var fg=31&Ef[de],gg=31&Cf[pe];L+=og[fg]+ag[gg],++P[257+fg],++Y[gg],K=g+de,++F}else T[G++]=s[g],++P[s[g]]}}v=k_(s,f,u,T,P,Y,L,G,le,g-le,v)}return D0(h,0,l+F0(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)},Ih=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function B2(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=D2[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=H2(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&&Ih(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),Ih(s,o-8,t.d()),Ih(s,o-4,n),s}var V2=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),Wt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},o2=!!kh||!!wh,t_="text/plain",qc=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=OA(o);return l&&a.push(l),i+"?"+a.join("&")},Zo=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),gh=r=>{var{data:e,compression:t}=r;if(e){if(t===$r.GZipJS){var n=i2((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 f0(p,0,h)})(Zo(e)),{mtime:0}),i=new Blob([n],{type:t_});return{contentType:t_,body:i,estimatedSize:i.size}}if(t===$r.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,y="",x=[];if(!l)return l;l=s2(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})(Zo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Zo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Zo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Tc=[];wh&&Tc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=gh(r))!==null&&e!==void 0?e:{},o=new Headers;Ce(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(xb){var c=new xb;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}wh(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){j.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{j.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),kh&&Tc.push({transport:"XHR",method:r=>{var e,t=new kh;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=gh(r))!==null&&e!==void 0?e:{};Ce(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)}}),xt!=null&&xt.sendBeacon&&Tc.push({transport:"sendBeacon",method:r=>{var e=qc(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=gh(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;xt.sendBeacon(e,s)}catch{}}});var Zc=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function r_(r,e,t){return Zo({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var g0={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=>Zc(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Zc(t,n))))),icontains:(r,e)=>e.map(Ac).some((t=>r.map(Ac).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(Ac).every((t=>r.map(Ac).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)))}))},Ac=r=>r.toLowerCase();function m0(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(V(s)||Wt(s))return!1;var o=[String(s)],a=g0[i.operator];return!!a&&a(i.values,o)}))}var mh=Oe("[Error tracking]"),hf=class{constructor(e){var t,n;this.Zt=[],this.ti=new $h([new Oh,new Bh,new Nh,new Ph,new Dh,new Fh,new Lh,new Hh],gA()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(jh))!==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({[jh]:this.Zt,[Pb]:o})}get ii(){var e,t=!!this._instance.get_property(Pb),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 mh.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void mh.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void mh.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 Ue(s)&&s.length>0&&n.$exception_types.push(s),Ue(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=g0[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!fe(e)&&be(e)}},_t=Oe("[FeatureFlags]"),Do=Oe("[FeatureFlags]",{debugEnabled:!0}),vh="$active_feature_flags",Ji="$override_feature_flags",n_="$feature_flag_payloads",Ho="$override_feature_flag_payloads",i_="$feature_flag_request_id",s_="$feature_flag_evaluated_at",o_=r=>{var e={};for(var[t,n]of Rc(r||{}))n&&(e[t]=n);return e},a2=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]})))):_t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},l2=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),ff=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||(_t.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||_t.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(Uh),t=this._instance.get_property(Ji),n=this._instance.get_property(Ho);if(!n&&!t)return e||{};var i=Ne({},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=V(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=V(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||(_t.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(is),t=this._instance.get_property(Ji);if(!t)return e||{};for(var n=Ne({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(_t.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(n_),t=this._instance.get_property(Ho);if(!t)return e||{};for(var n=Ne({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(_t.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(qo)||{}),group_properties:this._instance.get_property(Qn)};Wt(i)||V(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=u0()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:$r.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(l2.FeatureFlags))_t.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}_t.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(i_)||void 0,c=this._instance.get_property(s_)||void 0,u=this._instance.get_property(Pc)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,g,m,y,x,k;be(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[Pc]: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};V(b==null||(v=b.metadata)==null?void 0:v.version)||(w.$feature_flag_version=b.metadata.version);var C,_=(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),V(b?.original_variant)&&V(b?.original_enabled)||(w.$feature_flag_original_response=V(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(k=b.metadata)!=null&&k.original_payload&&(w.$feature_flag_original_payload=b==null||(C=b.metadata)==null?void 0:C.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!V(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else _t.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:$r.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 V(n)?void 0:!!n}_t.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=a2(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var g=o.requestId,m=o.evaluatedAt;if(be(f)){_t.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({[vh]:f,[is]:y})}else{var k=f,b=v,w=h;if(o.errorsWhileComputingFlags)if(h){var C=new Set(Object.keys(h).filter((_=>{var A;return!((A=h[_])!=null&&A.failed)})));k=W({},l,Object.fromEntries(Object.entries(k).filter((_=>{var[A]=_;return C.has(A)})))),b=W({},c,Object.fromEntries(Object.entries(b||{}).filter((_=>{var[A]=_;return C.has(A)})))),w=W({},u,Object.fromEntries(Object.entries(w||{}).filter((_=>{var[A]=_;return C.has(A)}))))}else k=W({},l,k),b=W({},c,b),w=W({},u,w);a&&a.register(W({[vh]:Object.keys(o_(k)),[is]:k||{},[n_]:b||{},[Uh]:w||{}},g?{[i_]:g}:{},m?{[s_]:m}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),_t.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return _t.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ji),this._instance.persistence.unregister(Ho),this.wi(),Do.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(Ji),Do.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({[Ji]:i})}else this._instance.persistence.register({[Ji]:n.flags});Do.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Ho),Do.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Ho]:n.payloads}),Do.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(zo)||[]).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({[vh]:Object.keys(o_(l)),[is]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(zo),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(zo),(l=this._instance.persistence)==null||l.register({[zo]: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(qo)||{};this._instance.register({[qo]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(qo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Qn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=W({},n[i],e[i]),delete e[i]})),this._instance.register({[Qn]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Qn)||{};this._instance.register({[Qn]:W({},t,{[e]:{}})})}else this._instance.unregister(Qn)}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}},c2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Xo=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&&j.info("Persistence loaded",e.persistence,W({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){c2.indexOf(e.persistence.toLowerCase())===-1&&(j.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=[...BA,...i];return W({},Ie,{W:function(o){try{var a={};try{a=ar.W(o)||{}}catch{}var l=Ne(a,JSON.parse(Ie.q(o)||"{}"));return Ie.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Ie.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&ar.G(o,h,l,c,u,p)}catch(f){Ie.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),ar.V(o,a)}catch(l){Ie.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Ie.H()?Ie:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&Ye.H()?Ye:n==="memory"?VA:n==="cookie"?ar:t.H()?t:ar}properties(){var e={};return Ce(this.props,(function(t,n){if(n===is&&je(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,(Wt(o=kA)?l:_b&&o.indexOf===_b?o.indexOf(a)!=-1:(Ce(o,(function(c){if(l||(l=c===a))return Mc})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Ne({},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(je(e)){V(t)&&(t="None"),this.Pi=V(n)?this.Ci:n;var i=!1;if(Ce(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(je(e)){this.Pi=V(t)?this.Ci:t;var n=!1;if(Ce(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=i0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ns(Bf(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=B?.referrer)?o0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:a0(),$referring_domain:B!=null&&B.referrer&&((e=Hc(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Zh]||this.props[Gh]||this.register_once({[Nc]:l0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ce([Gh,Zh],(o=>{var a=this.props[o];a&&Ce(a,(function(l,c){e["$initial_"+Sh(c)]=l}))}));var t,n,i=this.props[Nc];if(i){var s=(t=c0(i),n={},Ce(t,(function(o,a){n["$initial_"+Sh(a)]=o})),n);Ne(e,s)}return e}safe_merge(e){return Ce(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[Wo]||{};n[e]=t,this.props[Wo]=n,this.save()}remove_event_timer(e){var t=(this.props[Wo]||{})[e];return V(t)||(delete this.props[Wo][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},a_=Oe("[Product Tours]"),yh="ph_product_tours",gf=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Lb]:!(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(Lb)||this.it((()=>this.Oi()))}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?a_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=te.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=te.__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[yh];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 a_.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({[yh]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){fe(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(yh)}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)}},Bo=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),K5=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),Y5=(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})({}),X5=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),bh=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),J5=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),Q5=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),eN=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),Go=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),_h=(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})({}),mf=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ee=Oe("[Surveys]"),v0="seenSurvey_",u2=(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},l_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(v0,r),d2=[bh.Popover,bh.Widget,bh.API],p2={ignoreConditions:!1,ignoreDelay:!1,displayType:mf.Popover},ia=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 Qi(r,e,t){if(fe(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 vf=class{constructor(e){this.Ai=new ia,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(!V((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(!V((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"||!Qi(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=>Qi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&Qi((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=>Qi(c.text,t.text,t.text_matching||"exact")||Qi(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;!fe(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=>Qi(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||m0(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)}},yf=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&m0(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===Bo.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;V((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 vf(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,Bo.Activation),this.Yi=this.Zi(e,Bo.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,Bo.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,Bo.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}},bf=class extends yf{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Go.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()}},_f=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(fe(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(v0)||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=te?.__PosthogExtensions__;if(e){if(!V(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 bf(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(Wh);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(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({[Wh]: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),!fe(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(fe(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(fe(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 fe(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(fe(this._surveyManager))Ee.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(d2.includes(s.type)){var o=B?.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(fe(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=W({},i,{appearance:W({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==mf.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!==mf.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ee.warn("Survey not found")}}cancelPendingSurvey(e){fe(this._surveyManager)?Ee.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Ar=Oe("[Conversations]"),xf=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;fe(t)||(Or(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=te?.__PosthogExtensions__;if(e&&!V(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 Ar.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Ar.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Ar.error("Cannot complete initialization: remote config is null")}Se(e,t){Ar.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Wt(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 rs((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Ar.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return rs((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ar.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ar.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ar.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}},wf=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;!fe(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Oe("[logs]"),t=te?.__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.")}}},c_=Oe("[RateLimiter]"),kf=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=>{c_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void c_.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(qh))!==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(qh,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Jn=Oe("[RemoteConfig]"),Sf=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=te._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Jn.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 Jn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Jn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Jn.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){Jn.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()):Jn.info("__preview_remote_config is disabled. Logging config instead",e):Jn.error("Failed to fetch remote config from PostHog.")}},Ef=3e3,Cf=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=lr(t?.flush_interval_ms||Ef,250,5e3,j.createLogger("flush interval"),Ef),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&&be(s.data)&&Ce(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 Ce(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;V(e[s])&&(e[s]=W({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},h2=["retriesPerformedSoFar"],Af=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!V(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Be(E,"online",this.ze),Be(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=g_(e,h2);es(t)&&(n.url=qc(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)"),j.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,V(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){j.error(t)}this.Re=[]}},Rf=class{constructor(e){this.Ge=()=>{var t,n,i,s;this.Ve||(this.Ve={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(a),this.Ve.maxScrollY=Math.max(a,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(n=this.Ve.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ve.lastContentY=c,this.Ve.maxContentY=Math.max(c,(i=this.Ve.maxContentY)!==null&&i!==void 0?i:0),this.Ve.maxContentHeight=Math.max(u,(s=this.Ve.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){Be(E,"scroll",this.Ge,{capture:!0}),Be(E,"scrollend",this.Ge,{capture:!0}),Be(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}},f2=r=>l0(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Gc=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({[zh]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||f2,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[zh]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?c0(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 Ce(Bf(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Sh(n)]=t})),e}},xh=Oe("[SessionId]"),Kc=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 ia,this.er=(u,p)=>!(!es(u)||!es(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||rn,this.ar=n||rn;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*lr(o,60,36e3,xh.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=Ye.W(this.ur),l=Ye.W(this.hr);a&&!l?this.rr=a:Ye.V(this.ur),Ye.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){xh.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return V(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&&Ye.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Ye.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Ye.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({[Oc]:[t,e,n]}))}_r(){var e=this.Xe.props[Oc];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()&&Ye.V(this.hr)},Be(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=es(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(),xh.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=es(i)&&e&&!l?i:n,f=es(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)}},g2=["$set_once","$set"],en=Oe("[SiteApps]"),Tf=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=te._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({},g_(e,g2),{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&&(en.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,en.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){en.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){en.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){en.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 en.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;te["__$$ph_site_app_"+c]=s._instance,(u=te.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return en.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else en.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},y0=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&kb(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>kb(i?.brand,e))))return!0}catch{}return!!r.webdriver},Ko=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),u_="i.posthog.com",If=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("."+u_,".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]=Ko.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Ko.EU:this.Sr[this.apiHost]=Ko.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===Ko.CUSTOM)return this.apiHost+t;var n=u_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},m2={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&&Zc(e.href,r),not_regex:(r,e)=>!!E&&!Zc(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},$f=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);Ue(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(fe(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=Bc(e?.search,"__experiment_id"),n=Bc(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!fe(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(fe(e.conditions)||fe((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||m2[(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(fe(e.conditions)||fe((t=e.conditions)==null?void 0:t.utm))return!0;var n=i0();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];j.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 xt&&this._instance?y0(xt,this._instance.config.custom_blocked_useragents):void 0}},v2=Oe("[PostHog ExternalIntegrations]"),y2={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Mf=class{constructor(e){this._instance=e}it(e,t){var n;(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return v2.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=te.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(y2[o],(()=>{var u;(u=te.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=te.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=te.__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)}}},Of="[SessionRecording]",Vo=Oe(Of),Yc=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Vo.error("started without valid sessionManager"),new Error(Of+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Of+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(lh))==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=!V(Object.assign)&&!V(Array.from);this.Ar&&n?(this.Dr(e),Vo.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(te!=null&&(t=te.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=te.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=te.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Vo.error("could not load recorder",s);this.Lr(e)})))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(V_)}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=fe(a)?null:parseFloat(a);fe(l)&&this.Ur();var c=o?.minimumDurationMilliseconds;i.register({[lh]:W({enabled:!!o},o,{networkPayloadCapture:W({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:V(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(t=this.jr)==null||t.call(this),this.jr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Vo.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;t===void 0&&(t="log"),(n=this.Or)!=null&&n.log?this.Or.log(e,t):Vo.warn("log called before recorder was ready")}get Nr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(lh);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=te.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=te.__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))}},Jo={},Pf=()=>{},ts="posthog",b0=!o2&&mt?.indexOf("MSIE")===-1&&mt?.indexOf("Mozilla")===-1,d_=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:wA(B?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pf,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:Xe&&Ue(Xe?.search)&&Xe.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;j.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:Ef},error_tracking:{},_onCapture:Pf,__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))},p_=r=>{var e={};V(r.process_person)||(e.person_profiles=r.process_person),V(r.xhr_headers)||(e.request_headers=r.xhr_headers),V(r.cookie_name)||(e.persistence_name=r.cookie_name),V(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),V(r.store_google)||(e.save_campaign_params=r.store_google),V(r.verbose)||(e.debug=r.verbose);var t=Ne({},e,r);return be(r.property_blacklist)&&(V(r.property_denylist)?t.property_denylist=r.property_blacklist:be(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:j.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Nf=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){j.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Xc=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 Nf,this.Br=!1,this.version=Rr.LIB_VERSION,this.qr=new ia,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=d_(),this.SentryIntegration=nf,this.sentryIntegration=e=>(function(t,n){var i=n0(t,n);return{name:r0,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 ff(this),this.toolbar=new sf(this),this.scrollManager=new Rf(this),this.pageViewManager=new Uc(this),this.surveys=new _f(this),this.conversations=new xf(this),this.logs=new wf(this),this.experiments=new $f(this),this.exceptions=new hf(this),this.rateLimiter=new kf(this),this.requestRouter=new If(this),this.consent=new ef(this),this.externalIntegrations=new Mf(this),this.people={set:(e,t,n)=>{var i=Ue(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=Ue(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>j.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==ts){var i,s=(i=Jo[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),Jo[n]=s,Jo[ts][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),V(e)||Eh(e))return j.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(Ne({},d_(t.defaults),p_(t),{name:n,token:e})),this.config.on_xhr_error&&j.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:$r.GZipJS;var s=this.Qr();this.persistence=new Xo(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xo(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 Cf((x=>this.ts(x)),this.config.request_queue_config),this.es=new Af(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 Kc(this),this.sessionPropsManager=new Gc(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(j.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(j.info("Initializing extensions synchronously"),this.rs(l)),Rr.DEBUG=Rr.DEBUG||this.config.debug,Rr.DEBUG&&j.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(rn()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Tr,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,g=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var k;return!((k=t.bootstrap)==null||(k=k.featureFlags)==null||!k[x])})).reduce(((x,k)=>{var b;return x[k]=((b=t.bootstrap)==null||(b=b.featureFlags)==null?void 0:b[k])||!1,x}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>g[x])).reduce(((x,k)=>{var b,w;return(b=t.bootstrap)!=null&&(b=b.featureFlagPayloads)!=null&&b[k]&&(x[k]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[k]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:Oo,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(rn());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Tr,"anonymous")}return Be(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?WA(this,(()=>this.ns())):this.ns(),nn(this.config._onCapture)&&this.config._onCapture!==Pf&&(j.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&j.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 rf(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new of(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new Tf(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Yc(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Yh(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new gf(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new lf(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new af(this)})),n.push((()=>{this.exceptionObserver=new tf(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new jc(this,UA),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){j.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&&j.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!B||!B.body)return j.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,$r.GZipJS)?$r.GZipJS:he(e.supportedCompression,$r.Base64)?$r.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){j.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&Xe!=null&&Xe.hostname){var e=Xe.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 Sf(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()&&sn(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&&(b0?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=qc(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=qc(o.url,{_:new Date().getTime().toString(),ver:Rr.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=Tc.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=D_(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=[];sn(e,(a=>{a&&(t=a[0],be(t)?s.push(a):nn(a)?a.call(this):be(a)&&t==="alias"?n.push(a):be(a)&&t.indexOf("capture")!==-1&&nn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){sn(a,(function(c){if(be(c[0])){var u=l;Ce(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(!V(e)&&Ue(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&&!Ue(t?.$current_url)&&(j.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=rn(),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=_A(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,V(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Go.DISMISSED||e===Go.SENT){var v=t?.[_h.SURVEY_ID],g=t?.[_h.SURVEY_ITERATION];p={id:v,current_iteration:g},localStorage.getItem(l_(p))||localStorage.setItem(l_(p),"true"),u.$set=W({},u.$set,{[u2({id:v,current_iteration:g},e===Go.SENT?"responded":"dismissed")]:!0})}else e===Go.SHOWN&&(u.$set=W({},u.$set,{[_h.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=W({},u.properties.$set,u.$set);if(ns(m)||this.setPersonPropertiesForFlags(m),!fe(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}j.critical("This capture call is ignored due to client rate limiting.")}}else j.error("No event name provided to posthog.capture")}else j.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,(!Ue(a.distinct_id)&&!Pr(a.distinct_id)||Eh(a.distinct_id))&&j.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=YA(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&&Ne(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ne(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===Ko.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=Ne(a,c),e==="$pageview"&&B&&(a.title=B.title),!V(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}mt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ne({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),be(this.config.property_denylist)?Ce(this.config.property_denylist,(function(y){delete a[y]})):j.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&&(j.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=Ne({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(j.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),ns(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:V(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=p2),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 j.uninitializedWarning("posthog.identify");if(Pr(e)&&(e=e.toString(),j.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()))j.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!==Oo){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(Uo)&&(this.unregister(Uo),this.register({distinct_id:e}));var o=(this.persistence.get_property(Tr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Tr,"identified"),this.setPersonPropertiesForFlags(W({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=r_(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(Pc))}}else j.critical('The string "'+Oo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else j.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=r_(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(W({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):j.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 j.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(j.info("reset"),!this.__loaded)return j.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(Tr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Oo,$device_id:null},"");else{var a=this.config.get_device_id(rn());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(H_)?(j.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(V(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Uo,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(j.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=W({},this.config);if(je(e)){var n,i,s,o,a,l,c;Ne(this.config,p_(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 Xo(W({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);Or(p)&&(this.config.debug=p),Or(this.config.debug)&&(this.config.debug?(Rr.DEBUG=!0,Ie.H()&&Ie.G("ph_debug","true"),j.info("set_config",{config:e,oldConfig:t,newConfig:W({},this.config)})):(Rr.DEBUG=!1,Ie.H()&&Ie.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:ts;return t!==ts&&(t=ts+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Tr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Tr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ns(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Uo])&&((t=this.persistence)==null||(t=t.props)==null||!t[Lc]))}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"?(j.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(Lc,!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 Kc(this),this.pageViewManager=new Uc(this),this.persistence&&(this.sessionPropsManager=new Gc(this,this.sessionManager,this.persistence)),this.sessionRecording=new Yc(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(),(V(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 j.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:Oo,$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())):j.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===Ir.GRANTED?"granted":e===Ir.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 xt?y0(xt,this.config.custom_blocked_useragents):void 0}hs(){B&&(B.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Gr&&(B.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Be(B,"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?(j.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=j,o=(t="advanced_disable_flags")in(e=l)&&!fe(e[t]),a=n in e&&!fe(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(fe(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),fe(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return ZC(e.event)?j.warn(s+". This can cause unexpected behavior."):j.info(s),null}n.properties&&!ns(n.properties)||j.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=Or(e)&&!e,n=Ie.H()&&Ie.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=bA(r.prototype[e[t]])})(Xc,["identify"]);var h_;var _0=(h_=Jo[ts]=new Xc,(function(){function r(){r.done||(r.done=!0,b0=!1,Ce(Jo,(function(e){e._dom_loaded()})))}B!=null&&B.addEventListener?B.readyState==="complete"?r():Be(B,"DOMContentLoaded",r,{capture:!1}):E&&j.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),h_);var qf=class{constructor(e={}){this.options=e;if(this.client=e.client,this.featureFlagsCallback=e.onFeatureFlagsLoaded,this.captureCallback=e.onCapture,this.rrwebCallback=e.onRRWebEvent,!this.client&&e.consent&&e.requireExplicitConsent&&typeof window<"u"&&e.apiKey){let t=e.consent;t.getStatus()==="granted"&&this.initPostHog(),t.subscribe(i=>{i==="granted"?this.client?this.client.opt_in_capturing():this.initPostHog():i==="denied"&&this.client&&this.client.opt_out_capturing()});return}!this.client&&typeof window<"u"&&e.apiKey&&this.initPostHog()}initPostHog(){let e=this.options;if(!e.apiKey)return;let t=e.enableFeatureFlags??!0,n=`syntro_${e.apiKey.slice(-6)||"sdk"}`,o={api_host:`${(e.apiHost??"https://telemetry.syntrologie.com").replace(/\/$/,"")}/t/${e.apiKey}`,advanced_disable_feature_flags:!t,advanced_disable_feature_flags_on_first_load:!t,autocapture:e.autocapture??!0,capture_pageview:e.capturePageview??"history_change",capture_pageleave:e.capturePageleave??!0,disable_session_recording:!(e.sessionRecording??!0),opt_out_useragent_filter:!0,session_recording:{recordCrossDomainIFrames:!0},capture_performance:!0,enable_recording_console_log:!0},a=_0.init(e.apiKey,o,n);if(a&&(this.client=a),this.captureCallback&&this.client&&this.client.on("eventCaptured",(...l)=>{let c=l[0],u=typeof c=="string"?c:c?.event,p=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,p)}),t&&this.featureFlagsCallback&&this.client){this.client.onFeatureFlags(()=>{let c=this.getAllFeatureFlags();c&&this.featureFlagsCallback&&this.featureFlagsCallback(c)});let l=this.getAllFeatureFlags();l&&Object.keys(l).length>0&&this.featureFlagsCallback(l)}this.rrwebCallback&&this.client&&this.setupRRWebIntercept()}setupRRWebIntercept(e=30){let t=this.client?.sessionRecording;if(!t){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let n=null,i=t;for(let o of Object.getOwnPropertyNames(i)){let a=i[o];if(a&&typeof a=="object"&&typeof a.onRRwebEmit=="function"&&typeof a.start=="function"&&a!==t){n=a;break}}if(!n){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=n.onRRwebEmit.bind(n);n.onRRwebEmit=o=>{this.rrwebCallback?.({kind:"rrweb",...o}),s(o)},typeof window<"u"&&(window.__RRWEB_INTERCEPT_READY__=!0)}getAllFeatureFlags(){return this.client?.featureFlags?.getFlagVariants()}getSegmentFlags(){let e=this.getAllFeatureFlags();if(!e)return{};let t={};for(let[n,i]of Object.entries(e))n.startsWith("in_segment_")&&(t[n]=i===!0);return t}identify(e,t){this.client?.identify(e,t)}alias(e,t){this.client?.alias(e,t)}track(e,t){this.client?.capture(e,t)}trackCanvasOpened(e){this.track("shadow_canvas_opened",{surface:e})}trackCanvasClosed(e){this.track("shadow_canvas_closed",{surface:e})}trackRectangleViewed(e,t){this.track("shadow_canvas_rectangle_viewed",{rectangleId:e,surface:t})}trackAction(e,t,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`variation_${t}`})}setPersonProperties(e){this.client?.capture("$set",{$set:e})}setPersonPropertiesOnce(e){this.client?.capture("$set",{$set_once:e})}getDistinctId(){return this.client?.get_distinct_id?.()}};function tu(r={}){return new qf(r)}var x0={posthog:r=>tu(r),noop:()=>wc()};function w0(r,e){let t=x0[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(x0).join(", ")}`);return t(e)}async function k0(r){gd(),G("Syntro Bootstrap","====== INIT ======"),G("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Pl();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",mo()),console.log("[DIAG] editorConf:",Ol()),G("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let D=!!window.__SYNTRO_EDITOR_PARAMS__,ie=!!window.__SYNTRO_AUDIT_LEGEND__,Y=!!window.__SYNTRO_REVIEW_DATA__;if(D||ie||Y){let de=[D&&"__SYNTRO_EDITOR_PARAMS__",ie&&"__SYNTRO_AUDIT_LEGEND__",Y&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${de.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let ie=Ol()?.syntro_token;ie?.startsWith("syn_")&&(t=ie,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=Di(t),gd(n.d);else if(e)G("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw ml("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),ml("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 ml("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,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")||fy,l=dy(),c=wp(),u=r.appSignalsInit??{},p={...c,...l,...u};G("Syntro Bootstrap","Phase 1: Browser metadata:",c),G("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&G("Syntro Bootstrap","Phase 1: App signals:",u);let h=kp(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(D=>{let ie=setTimeout(()=>{window.removeEventListener("message",Y),D(null)},500);function Y(de){let ge=de.data;ge?.jsonrpc==="2.0"&&ge?.id===1&&ge?.result?.hostInfo&&(clearTimeout(ie),window.removeEventListener("message",Y),D(ge.result.hostInfo))}window.addEventListener("message",Y);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(ie),window.removeEventListener("message",Y),D(null)}})})(),v,g=r.debug||r.testMode,m=Hi({debug:r.debug,history:g?new Bi(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=pd({elementResolver:typeof window<"u"?(D,ie)=>{let Y=document.elementFromPoint(D,ie);if(!Y)return null;let de={tag_name:Y.tagName.toLowerCase()};Y.id&&(de.attr__id=Y.id),Y.className&&typeof Y.className=="string"&&(de.classes=Y.className.split(" ").filter(Boolean));for(let ge of Y.attributes)ge.name.startsWith("data-")&&(de[`attr__${ge.name}`]=ge.value);return de}:void 0});y.onEvent(D=>m.publishEvent(D)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",D=>{let ie=[],Y=D.target;for(;Y&&Y!==document.body;){let de={tag_name:Y.tagName.toLowerCase()};for(let ge of Y.attributes)(ge.name.startsWith("data-")||ge.name==="id"||ge.name==="class"||ge.name==="aria-label")&&(de[`attr__${ge.name}`]=ge.value);ie.push(de),Y=Y.parentElement}y.enrichClickAttributes(Date.now(),ie)},!0));let x=cb(),k,b=D=>{G("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let ie=hy(D);if(G("Syntro Bootstrap","Segment flags from PostHog:",ie),py(ie),v){let Y=C?.getAll?.()??{},de={...c,...Y,...ie,...u};G("Syntro Bootstrap","Updating GrowthBook with attributes:",de),v.setAttributes?.(de)}if(k&&w?.getDistinctId){let Y=w.getDistinctId();Y&&s&&n?.t&&k.updateContext({distinctId:Y,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let D=n.t==="noop"?"noop":"posthog";w=w0(D,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:b,onCapture:(Y,de)=>{y.ingest({kind:"posthog",event:Y,properties:de,timestamp:Date.now()})},onRRWebEvent:Y=>{y.ingest(Y)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${D}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),G("Syntro Bootstrap","Tracked app signals event:",u));let ie=w;if(m.setPosthogCapture((Y,de)=>{ie.track?.(Y,de)}),x?.name==="shopify"&&s)try{k=new ac({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),G("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(Y){ot("Syntro Bootstrap","ShopifyPixelBridge init failed",Y)}}let C;n?.e&&(v=nb("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(D,ie,Y)=>{w.trackExperiment(D,ie,Y)}:void 0})),C=ic({experiments:v,onMetricChange:(D,ie)=>{G("Syntro Bootstrap",`Session metric changed: ${D} = ${ie}`)}}),G("Syntro Bootstrap","SessionMetricTracker created");let _="production";e==="editor"?_="editor":e==="audit"?_="audit":It("NODE_ENV")==="development"&&(_="development");let A=typeof c.surface_type=="string"?c.surface_type:"web",$=typeof c.surface_host=="string"?c.surface_host:"web",T=xc({telemetry:w,sessionMetrics:C,mode:_,events:m,initialSurfaceType:A,initialSurfaceHost:$});G("Syntro Bootstrap","Runtime created:",{version:T.version,mode:T.mode,hasContext:!!T.context,hasEvents:!!T.events,hasState:!!T.state}),G("Syntro Bootstrap","Core app executors already registered");let O=r.cdnBase||It("NEXT_PUBLIC_SYNTRO_CDN_BASE")||It("VITE_SYNTRO_CDN_BASE")||gy()||"https://cdn.syntrologie.com",X=Fu({cdnBase:O,registry:T.apps,onLoadStart:D=>{G("Syntro Bootstrap",`Loading app from CDN: ${D}`)},onLoadEnd:(D,ie,Y)=>{ie?G("Syntro Bootstrap",`App loaded successfully: ${D}`):ot("Syntro Bootstrap",`Failed to load app: ${D}`,Y)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:T.apps,appLoader:X,runtime:T,version:T.version},G("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&X.loadApp("adaptive-mcp").catch(D=>{G("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",D)});let F=T.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${F.length} apps in registry:`,F.map(D=>`${D.manifest.id}(${D.state})`).join(", "));for(let D of F)if(D.state==="registered")try{await T.apps.activate(D.manifest.id),console.log(`[DIAG] Activated: ${D.manifest.id} \u2192 widgets: [${T.widgets.list().join(", ")}]`)}catch(ie){console.error(`[DIAG] FAILED to activate: ${D.manifest.id}`,ie),ot("Syntro Bootstrap",`Failed to auto-activate built-in app: ${D.manifest.id}`,ie)}if(console.log(`[DIAG] Activation complete. Total widgets: [${T.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),G("Syntro Bootstrap","GrowthBook features loaded")}catch(D){ot("Syntro Bootstrap","Failed to load GrowthBook features:",D)}let N=await h;if(v&&Object.keys(N).length>0){let D={...c,...N,...u};G("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",N),v.setAttributes?.(D)}let Z=await f;Z&&v&&(c.surface_type="mcp-app",c.surface_host=Z.name,v.setAttributes?.({...c,...N}),T.context.setSurfaceType("mcp-app"),T.context.setSurfaceHost(Z.name),G("Syntro Bootstrap","MCP App detected:",Z.name));let K;if(r.fetcher)K=r.fetcher;else if(n?.f){let D=ab(n.f,n.o??{});K=async()=>{let ie=await D.fetch();return{...ie.config,tiles:ie.config.tiles??[]}}}else v&&(K=Dn({experiments:v}));let le=new Set,U=K?async()=>{let D=await K(),ie=D.tiles?.length??0,Y=D.actions?.length??0,de=D.meta?.variant_id;if((ie>0||Y>0)&&(de||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&de){let Pe=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,ct=Pe?.interventionTracker,zt;ct&&ct.variantId===de?zt=ct:(zt=new Xi(w,de),Pe&&(Pe.interventionTracker=zt),T.navigation.subscribe(()=>{zt.resetPage()})),zt.trackServed(ie,Y)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${D.tiles?.length??0},`,`actions=${D.actions?.length??0},`,`theme=${D.theme?.name??"none"}`),D.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",D.actions.map((Pe,ct)=>`[${ct}] ${Pe.kind}${Pe.anchorId?` anchor="${Pe.anchorId.selector}"`:""}${Pe.label?` "${Pe.label}"`:""}`).join(", "));let ge=D,wt=X.getRequiredApps(ge);return wt.length>0?console.log("[Syntro Bootstrap] Required external apps:",wt.join(", ")):G("Syntro Bootstrap","No external apps required (all executors are built-in)"),wt.length>0&&await X.loadAppsForConfig(ge).then(async ct=>{let zt=ct.filter(Le=>Le.success),ou=ct.filter(Le=>!Le.success);zt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${zt.map(Le=>Le.appId).join(", ")}`);let kt=ou.filter(Le=>!le.has(Le.appId));kt.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",kt.map(Le=>`${Le.appId} (${Le.error})`).join(", ")),kt.forEach(Le=>le.add(Le.appId)));for(let Le of wt)if(T.apps.has(Le))try{await T.apps.activate(Le),console.log(`[Syntro Bootstrap] App activated: ${Le}`)}catch(la){console.error(`[Syntro Bootstrap] Failed to activate app: ${Le}`,la)}else console.error(`[Syntro Bootstrap] App "${Le}" required by config but NOT registered.`,`Available apps: [${Array.from(T.apps.list?.()??[]).join(", ")}]`)}),D}:void 0;if(x){G("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),G("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(D){ot("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,D)}}let ee=await Nl({...r.canvas,fetcher:U,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:T});if(ee.setOverrideFetcher){let D=ee.setOverrideFetcher.bind(ee);ee.setOverrideFetcher=ie=>{D(async()=>{let de=await ie(),ge=de;if(X.getRequiredApps(ge).length>0){let Pe=await X.loadAppsForConfig(ge);for(let ct of Pe)if(ct.success&&T.apps.has(ct.appId))try{await T.apps.activate(ct.appId)}catch{}}return de})}}return{canvas:ee,runtime:T,experiments:v,telemetry:w,sessionMetrics:C,appLoader:X}}async function b2(r){try{return await k0(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function _2(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 x2(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 Zf={init:b2,loadAdaptive:x2,encodeToken:Ll,decodeToken:Di,events:{emit:_2}};typeof window<"u"&&(window.Syntro=Zf);function ps(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function w2(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=ps(i),o=ps(_r);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${_r}. 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${_r}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:k2(n,i)}):{valid:!0,warnings:e,errors:t}}function k2(r,e){let t={...r};return ps(e).major===1&&(t=S2(t)),t.schemaVersion=_r,t}function S2(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 E2(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=ps(t),i=ps(_r);return n.major<i.major||!e.schemaVersion}var S0=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),E0=d.object({url:d.string(),ts:d.number()}),C0=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(E0).optional()}),A0=d.object({width:d.number(),height:d.number()}),R0=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),T0=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:R0.optional()}),I0=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),$0=d.object({page:S0,session:C0,viewport:A0,anchors:d.array(T0).optional(),augmented:I0.optional()});function C2(r){return $0.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 nu=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 iu=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 Gf=d.enum(["posthog","canvas","derived"]),M0=d.object({ts:d.number(),name:d.string(),source:Gf,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),O0=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(Gf).optional()});function A2(r){return M0.safeParse(r)}function R2(r){return O0.safeParse(r)}var Kf=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()})]),P0=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:Kf,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()}),N0=d.object({kind:d.literal("highlight"),id:d.string(),anchor:Kf,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()}),su=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([P0,N0]))});function T2(r){return su.parse(r)}var I2=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=yl({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 su.parse(o)};var L0=d.object({value:d.unknown(),expiresAt:d.number().optional()}),F0=d.object({count:d.number(),resetAt:d.number().optional()});function $2(r){return L0.safeParse(r)}function M2(r){return F0.safeParse(r)}var Yf="2026-05-04T20:14:50.300Z (c39b614e594)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Yf} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Ps;window.SynOS={...r,appRegistry:e,_runtimeBuild:Yf,_renderer:"lit"},lo(),gv(e)}return U0(O2);})();
|
|
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),Wt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},U2=!!Hh||!!Dh,E_="text/plain",eu=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=g2(o);return l&&a.push(l),i+"?"+a.join("&")},Jo=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),$h=r=>{var{data:e,compression:t}=r;if(e){if(t===$r.GZipJS){var n=B2((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 D0(p,0,h)})(Jo(e)),{mtime:0}),i=new Blob([n],{type:E_});return{contentType:E_,body:i,estimatedSize:i.size}}if(t===$r.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,y="",x=[];if(!l)return l;l=V2(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})(Jo(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Jo(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Jo(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Fc=[];Dh&&Fc.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=$h(r))!==null&&e!==void 0?e:{},o=new Headers;Re(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(zb){var c=new zb;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}Dh(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))}}),Hh&&Fc.push({transport:"XHR",method:r=>{var e,t=new Hh;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=$h(r))!==null&&e!==void 0?e:{};Re(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)}}),wt!=null&&wt.sendBeacon&&Fc.push({transport:"sendBeacon",method:r=>{var e=eu(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=$h(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;wt.sendBeacon(e,s)}catch{}}});var tu=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 C_(r,e,t){return Jo({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var H0={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=>tu(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!tu(t,n))))),icontains:(r,e)=>e.map(Lc).some((t=>r.map(Lc).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(Lc).every((t=>r.map(Lc).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)))}))},Lc=r=>r.toLowerCase();function B0(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(V(s)||Wt(s))return!1;var o=[String(s)],a=H0[i.operator];return!!a&&a(i.values,o)}))}var Mh=Le("[Error tracking]"),Tf=class{constructor(e){var t,n;this.Zt=[],this.ti=new Zh([new Kh,new rf,new Xh,new Yh,new ef,new Qh,new Jh,new tf],XA()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(sf))!==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({[sf]:this.Zt,[i_]:o})}get ii(){var e,t=!!this._instance.get_property(i_),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 Mh.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Mh.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Mh.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 We(s)&&s.length>0&&n.$exception_types.push(s),We(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=H0[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)}},xt=Le("[FeatureFlags]"),jo=Le("[FeatureFlags]",{debugEnabled:!0}),Ph="$active_feature_flags",Ji="$override_feature_flags",A_="$feature_flag_payloads",Wo="$override_feature_flag_payloads",R_="$feature_flag_request_id",T_="$feature_flag_evaluated_at",I_=r=>{var e={};for(var[t,n]of Nc(r||{}))n&&(e[t]=n);return e},j2=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]})))):xt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},W2=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),If=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||(xt.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||xt.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(of),t=this._instance.get_property(Ji),n=this._instance.get_property(Wo);if(!n&&!t)return e||{};var i=Ne({},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=V(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=V(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||(xt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(is),t=this._instance.get_property(Ji);if(!t)return e||{};for(var n=Ne({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(xt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(A_),t=this._instance.get_property(Wo);if(!t)return e||{};for(var n=Ne({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(xt.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(Xo)||{}),group_properties:this._instance.get_property(Qn)};Wt(i)||V(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=O0()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:$r.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(W2.FeatureFlags))xt.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}xt.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(R_)||void 0,c=this._instance.get_property(T_)||void 0,u=this._instance.get_property(Uc)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,g,m,y,x,S;xe(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[Uc]: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};V(b==null||(v=b.metadata)==null?void 0:v.version)||(w.$feature_flag_version=b.metadata.version);var C,_=(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),V(b?.original_variant)&&V(b?.original_enabled)||(w.$feature_flag_original_response=V(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||(C=b.metadata)==null?void 0:C.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!V(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else xt.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:$r.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 V(n)?void 0:!!n}xt.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=j2(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var g=o.requestId,m=o.evaluatedAt;if(xe(f)){xt.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({[Ph]:f,[is]:y})}else{var S=f,b=v,w=h;if(o.errorsWhileComputingFlags)if(h){var C=new Set(Object.keys(h).filter((_=>{var A;return!((A=h[_])!=null&&A.failed)})));S=W({},l,Object.fromEntries(Object.entries(S).filter((_=>{var[A]=_;return C.has(A)})))),b=W({},c,Object.fromEntries(Object.entries(b||{}).filter((_=>{var[A]=_;return C.has(A)})))),w=W({},u,Object.fromEntries(Object.entries(w||{}).filter((_=>{var[A]=_;return C.has(A)}))))}else S=W({},l,S),b=W({},c,b),w=W({},u,w);a&&a.register(W({[Ph]:Object.keys(I_(S)),[is]:S||{},[A_]:b||{},[of]:w||{}},g?{[R_]:g}:{},m?{[T_]:m}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),xt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return xt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ji),this._instance.persistence.unregister(Wo),this.wi(),jo.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(Ji),jo.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({[Ji]:i})}else this._instance.persistence.register({[Ji]:n.flags});jo.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Wo),jo.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Wo]:n.payloads}),jo.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this._instance.get_property(Yo)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=W({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[Ph]:Object.keys(I_(l)),[is]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(Yo),s=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Yo),(l=this._instance.persistence)==null||l.register({[Yo]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Xo)||{};this._instance.register({[Xo]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Xo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Qn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=W({},n[i],e[i]),delete e[i]})),this._instance.register({[Qn]:W({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Qn)||{};this._instance.register({[Qn]:W({},t,{[e]:{}})})}else this._instance.unregister(Qn)}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}},z2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ra=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){z2.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=[...w2,...i];return W({},Me,{W:function(o){try{var a={};try{a=ar.W(o)||{}}catch{}var l=Ne(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&&ar.G(o,h,l,c,u,p)}catch(f){Me.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),ar.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"&&Je.H()?Je:n==="memory"?S2:n==="cookie"?ar:t.H()?t:ar}properties(){var e={};return Re(this.props,(function(t,n){if(n===is&&je(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,(Wt(o=s2)?l:Wb&&o.indexOf===Wb?o.indexOf(a)!=-1:(Re(o,(function(c){if(l||(l=c===a))return Bc})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Ne({},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(je(e)){V(t)&&(t="None"),this.Pi=V(n)?this.Ci:n;var i=!1;if(Re(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(je(e)){this.Pi=V(t)?this.Ci:t;var n=!1;if(Re(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=R0(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ns(rg(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=B?.referrer)?I0(e):{})}update_referrer_info(){var e;this.register_once({$referrer:$0(),$referring_domain:B!=null&&B.referrer&&((e=Zc(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[uf]||this.props[df]||this.register_once({[jc]:M0(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Re([df,uf],(o=>{var a=this.props[o];a&&Re(a,(function(l,c){e["$initial_"+Bh(c)]=l}))}));var t,n,i=this.props[jc];if(i){var s=(t=P0(i),n={},Re(t,(function(o,a){n["$initial_"+Bh(a)]=o})),n);Ne(e,s)}return e}safe_merge(e){return Re(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[Ko]||{};n[e]=t,this.props[Ko]=n,this.save()}remove_event_timer(e){var t=(this.props[Ko]||{})[e];return V(t)||(delete this.props[Ko][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},$_=Le("[Product Tours]"),Oh="ph_product_tours",$f=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[o_]:!(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(o_)||this.it((()=>this.Oi()))}it(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?$_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=te.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=te.__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[Oh];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 $_.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({[Oh]: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(Oh)}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)}},zo=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),s5=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),o5=(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})({}),a5=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),Lh=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),l5=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),c5=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),u5=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),Qo=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Nh=(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})({}),Mf=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),Ae=Le("[Surveys]"),V0="seenSurvey_",q2=(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},M_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(V0,r),Z2=[Lh.Popover,Lh.Widget,Lh.API],G2={ignoreConditions:!1,ignoreDelay:!1,displayType:Mf.Popover},ca=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 Qi(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 Pf=class{constructor(e){this.Ai=new ca,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(!V((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(!V((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"||!Qi(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=>Qi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&Qi((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=>Qi(c.text,t.text,t.text_matching||"exact")||Qi(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=>Qi(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||B0(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)}},Of=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&B0(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===zo.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;V((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 Pf(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,zo.Activation),this.Yi=this.Zi(e,zo.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,zo.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,zo.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}},Lf=class extends Of{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Qo.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 Ae}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Nf=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 Ae.warn("Flags not loaded yet. Not loading surveys.");var n=xe(t);this.ve=n?t.length>0:t,Ae.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(V0)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Ae.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ae.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ae.info("Not loading surveys in cookieless mode without consent.");else{var e=te?.__PosthogExtensions__;if(e){if(!V(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 Ae.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Lf(this._instance),Ae.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Ae.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 Ae.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(af);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;Ae.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({[af]: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){Ae.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ae.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 Ae.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)?(Ae.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))Ae.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(Z2.includes(s.type)){var o=B?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(Ae.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;Ae.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),Ae.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);Ae.warn("Survey element not found")}else Ae.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ae.warn("Survey not found")}}displaySurvey(e,t){var n;if(ge(this._surveyManager))Ae.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!==Mf.Popover&&t.initialResponses&&Ae.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 Ae.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Mf.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Ae.warn("Survey not found")}}cancelPendingSurvey(e){ge(this._surveyManager)?Ae.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Ar=Le("[Conversations]"),Ff=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)||(Pr(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=te?.__PosthogExtensions__;if(e&&!V(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 Ar.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Ar.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Ar.error("Cannot complete initialization: remote config is null")}Se(e,t){Ar.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Wt(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 rs((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Ar.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return rs((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ar.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ar.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ar.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}},Df=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=te?.__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.")}}},P_=Le("[RateLimiter]"),Hf=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=>{P_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void P_.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(cf))!==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(cf,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Jn=Le("[RemoteConfig]"),Bf=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=te._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=te.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Jn.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 Jn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Jn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Jn.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){Jn.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()):Jn.info("__preview_remote_config is disabled. Logging config instead",e):Jn.error("Failed to fetch remote config from PostHog.")}},Vf=3e3,Uf=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=lr(t?.flush_interval_ms||Vf,250,5e3,U.createLogger("flush interval"),Vf),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)&&Re(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 Re(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;V(e[s])&&(e[s]=W({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},K2=["retriesPerformedSoFar"],jf=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!V(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Ve(E,"online",this.ze),Ve(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=H_(e,K2);es(t)&&(n.url=eu(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,V(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=[]}},Wf=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(){Ve(E,"scroll",this.Ge,{capture:!0}),Ve(E,"scrollend",this.Ge,{capture:!0}),Ve(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}},Y2=r=>M0(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),ru=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({[lf]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||Y2,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[lf]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?P0(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 Re(rg(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+Bh(n)]=t})),e}},Fh=Le("[SessionId]"),nu=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 ca,this.er=(u,p)=>!(!es(u)||!es(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||rn,this.ar=n||rn;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*lr(o,60,36e3,Fh.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=Je.W(this.ur),l=Je.W(this.hr);a&&!l?this.rr=a:Je.V(this.ur),Je.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){Fh.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return V(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&&Je.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Je.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Je.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({[Vc]:[t,e,n]}))}_r(){var e=this.Xe.props[Vc];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()&&Je.V(this.hr)},Ve(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=es(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(),Fh.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=es(i)&&e&&!l?i:n,f=es(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)}},X2=["$set_once","$set"],en=Le("[SiteApps]"),zf=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=te._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({},H_(e,X2),{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&&(en.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,en.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){en.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){en.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){en.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 en.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;te["__$$ph_site_app_"+c]=s._instance,(u=te.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return en.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else en.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},U0=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Zb(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>Zb(i?.brand,e))))return!0}catch{}return!!r.webdriver},ea=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),O_="i.posthog.com",qf=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("."+O_,".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]=ea.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ea.EU:this.Sr[this.apiHost]=ea.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===ea.CUSTOM)return this.apiHost+t;var n=O_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},J2={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&&tu(e.href,r),not_regex:(r,e)=>!!E&&!tu(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Zf=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.kr("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Pr)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);We(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=Gc(e?.search,"__experiment_id"),n=Gc(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||J2[(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=R0();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 wt&&this._instance?U0(wt,this._instance.config.custom_blocked_useragents):void 0}},Q2=Le("[PostHog ExternalIntegrations]"),eR={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Gf=class{constructor(e){this._instance=e}it(e,t){var n;(n=te.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return Q2.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=te.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(eR[o],(()=>{var u;(u=te.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=te.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=te.__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)}}},Kf="[SessionRecording]",qo=Le(Kf),iu=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 qo.error("started without valid sessionManager"),new Error(Kf+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Kf+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(kh))==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=!V(Object.assign)&&!V(Array.from);this.Ar&&n?(this.Dr(e),qo.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(te!=null&&(t=te.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=te.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=te.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return qo.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(d0)}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({[kh]:W({enabled:!!o},o,{networkPayloadCapture:W({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:V(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:qo.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):qo.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(kh);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=te.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=te.__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))}},na={},Yf=()=>{},ts="posthog",j0=!U2&&vt?.indexOf("MSIE")===-1&&vt?.indexOf("Mozilla")===-1,L_=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:i2(B?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Yf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:Qe&&We(Qe?.search)&&Qe.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;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:Vf},error_tracking:{},_onCapture:Yf,__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))},N_=r=>{var e={};V(r.process_person)||(e.person_profiles=r.process_person),V(r.xhr_headers)||(e.request_headers=r.xhr_headers),V(r.cookie_name)||(e.persistence_name=r.cookie_name),V(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),V(r.store_google)||(e.save_campaign_params=r.store_google),V(r.verbose)||(e.debug=r.verbose);var t=Ne({},e,r);return xe(r.property_blacklist)&&(V(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},Xf=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}},su=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 Xf,this.Br=!1,this.version=Rr.LIB_VERSION,this.qr=new ca,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=L_(),this.SentryIntegration=_f,this.sentryIntegration=e=>(function(t,n){var i=A0(t,n);return{name:C0,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 If(this),this.toolbar=new xf(this),this.scrollManager=new Wf(this),this.pageViewManager=new Xc(this),this.surveys=new Nf(this),this.conversations=new Ff(this),this.logs=new Df(this),this.experiments=new Zf(this),this.exceptions=new Tf(this),this.rateLimiter=new Hf(this),this.requestRouter=new qf(this),this.consent=new vf(this),this.externalIntegrations=new Gf(this),this.people={set:(e,t,n)=>{var i=We(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=We(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!==ts){var i,s=(i=na[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),na[n]=s,na[ts][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),V(e)||Vh(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(Ne({},L_(t.defaults),N_(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:$r.GZipJS;var s=this.Qr();this.persistence=new ra(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ra(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 Uf((x=>this.ts(x)),this.config.request_queue_config),this.es=new jf(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 nu(this),this.sessionPropsManager=new ru(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)),Rr.DEBUG=Rr.DEBUG||this.config.debug,Rr.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(rn()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Tr,(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:Do,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(rn());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Tr,"anonymous")}return Ve(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?C2(this,(()=>this.ns())):this.ns(),nn(this.config._onCapture)&&this.config._onCapture!==Yf&&(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 bf(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new wf(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new zf(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new iu(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new hf(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new $f(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new kf(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Sf(this)})),n.push((()=>{this.exceptionObserver=new yf(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Yc(this,E2),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(!B||!B.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,$r.GZipJS)?$r.GZipJS:fe(e.supportedCompression,$r.Base64)?$r.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&&Qe!=null&&Qe.hostname){var e=Qe.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()}),1),new Bf(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()&&sn(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&&(j0?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=eu(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=eu(o.url,{_:new Date().getTime().toString(),ver:Rr.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=Fc.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=l0(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=[];sn(e,(a=>{a&&(t=a[0],xe(t)?s.push(a):nn(a)?a.call(this):xe(a)&&t==="alias"?n.push(a):xe(a)&&t.indexOf("capture")!==-1&&nn(this[t])?s.push(a):i.push(a))}));var o=function(a,l){sn(a,(function(c){if(xe(c[0])){var u=l;Re(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(!V(e)&&We(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&&!We(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=rn(),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=r2(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,V(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Qo.DISMISSED||e===Qo.SENT){var v=t?.[Nh.SURVEY_ID],g=t?.[Nh.SURVEY_ITERATION];p={id:v,current_iteration:g},localStorage.getItem(M_(p))||localStorage.setItem(M_(p),"true"),u.$set=W({},u.$set,{[q2({id:v,current_iteration:g},e===Qo.SENT?"responded":"dismissed")]:!0})}else e===Qo.SHOWN&&(u.$set=W({},u.$set,{[Nh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=W({},u.properties.$set,u.$set);if(ns(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,(!We(a.distinct_id)&&!Or(a.distinct_id)||Vh(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=M2(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&&Ne(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ne(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===ea.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=Ne(a,c),e==="$pageview"&&B&&(a.title=B.title),!V(o)){var v=n.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}vt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ne({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),xe(this.config.property_denylist)?Re(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=Ne({},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),ns(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:V(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=G2),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(Or(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!==Do){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(Go)&&(this.unregister(Go),this.register({distinct_id:e}));var o=(this.persistence.get_property(Tr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Tr,"identified"),this.setPersonPropertiesForFlags(W({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=C_(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(Uc))}}else U.critical('The string "'+Do+'" 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=C_(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(Tr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Do,$device_id:null},"");else{var a=this.config.get_device_id(rn());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(c0)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(V(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Go,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(je(e)){var n,i,s,o,a,l,c;Ne(this.config,N_(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 ra(W({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);Pr(p)&&(this.config.debug=p),Pr(this.config.debug)&&(this.config.debug?(Rr.DEBUG=!0,Me.H()&&Me.G("ph_debug","true"),U.info("set_config",{config:e,oldConfig:t,newConfig:W({},this.config)})):(Rr.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:ts;return t!==ts&&(t=ts+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Tr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Tr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ns(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Go])&&((t=this.persistence)==null||(t=t.props)==null||!t[Wc]))}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(Wc,!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 nu(this),this.pageViewManager=new Xc(this),this.persistence&&(this.sessionPropsManager=new ru(this,this.sessionManager,this.persistence)),this.sessionRecording=new iu(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(),(V(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:Do,$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===Ir.GRANTED?"granted":e===Ir.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 wt?U0(wt,this.config.custom_blocked_useragents):void 0}hs(){B&&(B.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Gr&&(B.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Ve(B,"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 TA(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}n.properties&&!ns(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=Pr(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]]=t2(r.prototype[e[t]])})(su,["identify"]);var F_;var W0=(F_=na[ts]=new su,(function(){function r(){r.done||(r.done=!0,j0=!1,Re(na,(function(e){e._dom_loaded()})))}B!=null&&B.addEventListener?B.readyState==="complete"?r():Ve(B,"DOMContentLoaded",r,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),F_);var lg=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=W0.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 lg(r)}var z0={posthog:r=>cu(r),noop:()=>Ic()};function q0(r,e){let t=z0[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(z0).join(", ")}`);return t(e)}async function Z0(r){Sd(),Z("Syntro Bootstrap","====== INIT ======"),Z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Hl();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",mo()),console.log("[DIAG] editorConf:",Dl()),Z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let D=!!window.__SYNTRO_EDITOR_PARAMS__,ie=!!window.__SYNTRO_AUDIT_LEGEND__,J=!!window.__SYNTRO_REVIEW_DATA__;if(D||ie||J){let de=[D&&"__SYNTRO_EDITOR_PARAMS__",ie&&"__SYNTRO_AUDIT_LEGEND__",J&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${de.join(", ")}. This suggests URL params were lost (redirect?) but the service worker injected mode data. Check if replaceState failed or if page JS changed the URL before init().`)}}console.log(`[DIAG] Token resolution: options.token=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let ie=Dl()?.syntro_token;ie?.startsWith("syn_")&&(t=ie,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=Di(t),Sd(n.d);else if(e)Z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw xl("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),xl("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 xl("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,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")||Iy,l=Ay(),c=Ip(),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=$p(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(D=>{let ie=setTimeout(()=>{window.removeEventListener("message",J),D(null)},500);function J(de){let pe=de.data;pe?.jsonrpc==="2.0"&&pe?.id===1&&pe?.result?.hostInfo&&(clearTimeout(ie),window.removeEventListener("message",J),D(pe.result.hostInfo))}window.addEventListener("message",J);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(ie),window.removeEventListener("message",J),D(null)}})})(),v,g=r.debug||r.testMode,m=Hi({debug:r.debug,history:g?new Bi(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=_d({elementResolver:typeof window<"u"?(D,ie)=>{let J=document.elementFromPoint(D,ie);if(!J)return null;let de={tag_name:J.tagName.toLowerCase()};J.id&&(de.attr__id=J.id),J.className&&typeof J.className=="string"&&(de.classes=J.className.split(" ").filter(Boolean));for(let pe of J.attributes)pe.name.startsWith("data-")&&(de[`attr__${pe.name}`]=pe.value);return de}:void 0});y.onEvent(D=>m.publishEvent(D)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",D=>{let ie=[],J=D.target;for(;J&&J!==document.body;){let de={tag_name:J.tagName.toLowerCase()};for(let pe of J.attributes)(pe.name.startsWith("data-")||pe.name==="id"||pe.name==="class"||pe.name==="aria-label")&&(de[`attr__${pe.name}`]=pe.value);ie.push(de),J=J.parentElement}y.enrichClickAttributes(Date.now(),ie)},!0));let x=$b(),S,b=D=>{Z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let ie=Ty(D);if(Z("Syntro Bootstrap","Segment flags from PostHog:",ie),Ry(ie),v){let J=C?.getAll?.()??{},de={...c,...J,...ie,...u};Z("Syntro Bootstrap","Updating GrowthBook with attributes:",de),v.setAttributes?.(de)}if(S&&w?.getDistinctId){let J=w.getDistinctId();J&&s&&n?.t&&S.updateContext({distinctId:J,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let D=n.t==="noop"?"noop":"posthog";w=q0(D,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,cookieless_mode:"on_reject",onFeatureFlagsLoaded:b,onCapture:(ve,_e)=>{y.ingest({kind:"posthog",event:ve,properties:_e,timestamp:Date.now()})},onRRWebEvent:ve=>{y.ingest(ve)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${D}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),Z("Syntro Bootstrap","Tracked app signals event:",u));let ie=w;m.setPosthogCapture((ve,_e)=>{ie.track?.(ve,_e)});let J=w,de=async()=>{let ve=await h;return ve.is_eu==="true"||ve.country_code==="GB"||ve.country_code==="CH"?"denied":"granted"},pe=new Fo({initialStatus:"pending",pendingResolver:de,onConsentChange:ve=>{ve==="granted"?J.optInCapturing?.():ve==="denied"&&J.optOutCapturing?.()}});try{Fy(w,pe,{geoPromise:h}),Z("Syntro Bootstrap","SDK defaults installed (D-1..D-5) with consent gate")}catch(ve){Ze("Syntro Bootstrap","installDefaults failed",ve)}try{new No({adapters:[new Lo,new Oo,new Po],fallbackStatus:de,onAdapterSelected:_e=>{J.track?.("syntro_consent_adapter_selected",{adapter:_e??"none"}),Z("Syntro Bootstrap",`Consent adapter selected: ${_e??"none"}`)}}).start(pe).catch(_e=>{Ze("Syntro Bootstrap","Consent detector failed to start",_e)})}catch(ve){Ze("Syntro Bootstrap","Consent detector setup failed",ve)}if(x?.name==="shopify"&&s)try{S=new gc({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),Z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(ve){Ze("Syntro Bootstrap","ShopifyPixelBridge init failed",ve)}}let C;n?.e&&(v=Eb("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(D,ie,J)=>{w.trackExperiment(D,ie,J)}:void 0})),C=pc({experiments:v,onMetricChange:(D,ie)=>{Z("Syntro Bootstrap",`Session metric changed: ${D} = ${ie}`)}}),Z("Syntro Bootstrap","SessionMetricTracker created");let _="production";e==="editor"?_="editor":e==="audit"?_="audit":It("NODE_ENV")==="development"&&(_="development");let A=typeof c.surface_type=="string"?c.surface_type:"web",$=typeof c.surface_host=="string"?c.surface_host:"web",T=Tc({telemetry:w,sessionMetrics:C,mode:_,events:m,initialSurfaceType:A,initialSurfaceHost:$});Z("Syntro Bootstrap","Runtime created:",{version:T.version,mode:T.mode,hasContext:!!T.context,hasEvents:!!T.events,hasState:!!T.state}),Z("Syntro Bootstrap","Core app executors already registered");let P=r.cdnBase||It("NEXT_PUBLIC_SYNTRO_CDN_BASE")||It("VITE_SYNTRO_CDN_BASE")||$y()||"https://cdn.syntrologie.com",Y=zu({cdnBase:P,registry:T.apps,onLoadStart:D=>{Z("Syntro Bootstrap",`Loading app from CDN: ${D}`)},onLoadEnd:(D,ie,J)=>{ie?Z("Syntro Bootstrap",`App loaded successfully: ${D}`):Ze("Syntro Bootstrap",`Failed to load app: ${D}`,J)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:T.apps,appLoader:Y,runtime:T,version:T.version},Z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&Y.loadApp("adaptive-mcp").catch(D=>{Z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",D)});let F=T.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${F.length} apps in registry:`,F.map(D=>`${D.manifest.id}(${D.state})`).join(", "));for(let D of F)if(D.state==="registered")try{await T.apps.activate(D.manifest.id),console.log(`[DIAG] Activated: ${D.manifest.id} \u2192 widgets: [${T.widgets.list().join(", ")}]`)}catch(ie){console.error(`[DIAG] FAILED to activate: ${D.manifest.id}`,ie),Ze("Syntro Bootstrap",`Failed to auto-activate built-in app: ${D.manifest.id}`,ie)}if(console.log(`[DIAG] Activation complete. Total widgets: [${T.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),Z("Syntro Bootstrap","GrowthBook features loaded")}catch(D){Ze("Syntro Bootstrap","Failed to load GrowthBook features:",D)}let L=await h;if(v&&Object.keys(L).length>0){let D={...c,...L,...u};Z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",L),v.setAttributes?.(D)}let G=await f;G&&v&&(c.surface_type="mcp-app",c.surface_host=G.name,v.setAttributes?.({...c,...L}),T.context.setSurfaceType("mcp-app"),T.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 D=Tb(n.f,n.o??{});K=async()=>{let ie=await D.fetch();return{...ie.config,tiles:ie.config.tiles??[]}}}else v&&(K=Dn({experiments:v}));let le=new Set,j=K?async()=>{let D=await K(),ie=D.tiles?.length??0,J=D.actions?.length??0,de=D.meta?.variant_id;if((ie>0||J>0)&&(de||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&de){let _e=typeof window<"u"?window.SynOS??(window.SynOS={}):void 0,ut=_e?.interventionTracker,zt;ut&&ut.variantId===de?zt=ut:(zt=new Xi(w,de),_e&&(_e.interventionTracker=zt),T.navigation.subscribe(()=>{zt.resetPage()})),zt.trackServed(ie,J)}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${D.tiles?.length??0},`,`actions=${D.actions?.length??0},`,`theme=${D.theme?.name??"none"}`),D.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",D.actions.map((_e,ut)=>`[${ut}] ${_e.kind}${_e.anchorId?` anchor="${_e.anchorId.selector}"`:""}${_e.label?` "${_e.label}"`:""}`).join(", "));let pe=D,ve=Y.getRequiredApps(pe);return ve.length>0?console.log("[Syntro Bootstrap] Required external apps:",ve.join(", ")):Z("Syntro Bootstrap","No external apps required (all executors are built-in)"),ve.length>0&&await Y.loadAppsForConfig(pe).then(async ut=>{let zt=ut.filter(Fe=>Fe.success),fu=ut.filter(Fe=>!Fe.success);zt.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${zt.map(Fe=>Fe.appId).join(", ")}`);let St=fu.filter(Fe=>!le.has(Fe.appId));St.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",St.map(Fe=>`${Fe.appId} (${Fe.error})`).join(", ")),St.forEach(Fe=>le.add(Fe.appId)));for(let Fe of ve)if(T.apps.has(Fe))try{await T.apps.activate(Fe),console.log(`[Syntro Bootstrap] App activated: ${Fe}`)}catch(ha){console.error(`[Syntro Bootstrap] Failed to activate app: ${Fe}`,ha)}else console.error(`[Syntro Bootstrap] App "${Fe}" required by config but NOT registered.`,`Available apps: [${Array.from(T.apps.list?.()??[]).join(", ")}]`)}),D}:void 0;if(x){Z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),Z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(D){Ze("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,D)}}let ee=await Bl({...r.canvas,fetcher:j,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:T});if(ee.setOverrideFetcher){let D=ee.setOverrideFetcher.bind(ee);ee.setOverrideFetcher=ie=>{D(async()=>{let de=await ie(),pe=de;if(Y.getRequiredApps(pe).length>0){let _e=await Y.loadAppsForConfig(pe);for(let ut of _e)if(ut.success&&T.apps.has(ut.appId))try{await T.apps.activate(ut.appId)}catch{}}return de})}}return{canvas:ee,runtime:T,experiments:v,telemetry:w,sessionMetrics:C,appLoader:Y}}async function tR(r){try{return await Z0(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.warn("[Syntrologie] SDK initialization failed:",t),typeof document<"u"&&document.getElementById("syntrologie-anti-flicker")?.remove();return}}function rR(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 nR(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 cg={init:tR,loadAdaptive:nR,encodeToken:Vl,decodeToken:Di,events:{emit:rR}};typeof window<"u"&&(window.Syntro=cg);function ps(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function iR(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=ps(i),o=ps(_r);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${_r}. 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${_r}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:sR(n,i)}):{valid:!0,warnings:e,errors:t}}function sR(r,e){let t={...r};return ps(e).major===1&&(t=oR(t)),t.schemaVersion=_r,t}function oR(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 aR(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=ps(t),i=ps(_r);return n.major<i.major||!e.schemaVersion}var G0=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),K0=d.object({url:d.string(),ts:d.number()}),Y0=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(K0).optional()}),X0=d.object({width:d.number(),height:d.number()}),J0=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),Q0=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:J0.optional()}),ex=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),tx=d.object({page:G0,session:Y0,viewport:X0,anchors:d.array(Q0).optional(),augmented:ex.optional()});function lR(r){return tx.safeParse(r)}var uu=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 du=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 pu=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 ug=d.enum(["posthog","canvas","derived"]),rx=d.object({ts:d.number(),name:d.string(),source:ug,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),nx=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(ug).optional()});function cR(r){return rx.safeParse(r)}function uR(r){return nx.safeParse(r)}var dg=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()})]),ix=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:dg,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()}),sx=d.object({kind:d.literal("highlight"),id:d.string(),anchor:dg,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()}),hu=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([ix,sx]))});function dR(r){return hu.parse(r)}var pR=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=Sl({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 hu.parse(o)};var ox=d.object({value:d.unknown(),expiresAt:d.number().optional()}),ax=d.object({count:d.number(),resetAt:d.number().optional()});function hR(r){return ox.safeParse(r)}function fR(r){return ax.safeParse(r)}var pg="2026-05-05T03:23:35.905Z (b84ed35ba47)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${pg} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Os;window.SynOS={...r,appRegistry:e,_runtimeBuild:pg,_renderer:"lit"},lo(),$v(e)}return hx(gR);})();
|
|
1066
1066
|
/*! Bundled license information:
|
|
1067
1067
|
|
|
1068
1068
|
@lit/reactive-element/css-tag.js:
|