UNPKG

@sammy-labs/walkthroughs

Version:
49 lines (47 loc) 117 kB
import { createContext, useState, useEffect, useCallback, useContext } from 'react'; import { v4 } from 'uuid'; import { jsx } from 'react/jsx-runtime'; var Fe={},Vt;function We(e={}){Fe={animate:!0,allowClose:!0,overlayClickBehavior:"close",overlayOpacity:.7,smoothScroll:!1,disableActiveInteraction:!1,showProgress:!1,stagePadding:8,stageRadius:12,popoverOffset:30,showButtons:["next","previous","close"],disableButtons:[],overlayColor:"#000",askInput:!0,...e};}function b(e){return e==="askInput"?Fe[e]??!0:e?Fe[e]:Fe}function Kt(e){Vt=e;}function H(){return Vt}var mt={};function me(e,t){mt[e]=t;}function X(e){mt[e]?.();}function qt(){mt={};}var Be={};function v(e,t){Be[e]=t;}function p(e){return e?Be[e]:Be}function ft(){Be={};}function fn(e,t,o){let n=document.createElement("div");return n.id="sammy-labs-dummy-fallback",n.setAttribute("data-sammy-labs-fallback","true"),t&&n.setAttribute("data-error-fallback","true"),n.style.position="fixed",n.style.bottom="20px",n.style.left="20px",n.style.width="1px",n.style.height="1px",n.style.opacity="0",n.style.pointerEvents="none",n.style.zIndex="99998",document.body.appendChild(n),n}function fe(e,t,o){let n=fn(e,t);return v("__didFallback",!0),Xt(),n}var pn=new Set(["role","name","aria-label","rel","href"]);function hn(e,t){let o=pn.has(e);o||=e.startsWith("data-")&&Ie(e);let n=Ie(t)&&t.length<100;return n||=t.startsWith("#")&&Ie(t.slice(1)),o&&n}function yn(e){return Ie(e)}function vn(e){return Ie(e)}function bn(e){return !0}function Ge(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return "html";let o={root:document.body,idName:yn,className:vn,tagName:bn,attr:hn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},n=new Date,r={...o,...t},i=Tn(r.root,o),s,a=0;for(let c of En(e,r,i)){if(new Date().getTime()-n.getTime()>r.timeoutMs||a>=r.maxNumberOfPathChecks){let f=wn(e,i);if(!f)throw new Error(`Timeout: Can't find a unique selector after ${r.timeoutMs}ms`);return Ce(f)}if(a++,yt(c,i)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Qt(s,e,r,i,n)];return l.sort(pt),l.length>0?Ce(l[0]):Ce(s)}function*En(e,t,o){let n=[],r=[],i=e,s=0;for(;i&&i!==o;){let a=_n(i,t);for(let l of a)l.level=s;if(n.push(a),i=i.parentElement,s++,r.push(...jt(n)),s>=t.seedMinLength){r.sort(pt);for(let l of r)yield l;r=[];}}r.sort(pt);for(let a of r)yield a;}function Ie(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let o of t)if(o.length<=2||/[^aeiou]{4,}/i.test(o))return !1;return !0}return !1}function _n(e,t){let o=[],n=e.getAttribute("id");n&&t.idName(n)&&o.push({name:"#"+CSS.escape(n),penalty:0});for(let s=0;s<e.classList.length;s++){let a=e.classList[s];t.className(a)&&o.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<e.attributes.length;s++){let a=e.attributes[s];t.attr(a.name,a.value)&&o.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let r=e.tagName.toLowerCase();if(t.tagName(r)){o.push({name:r,penalty:5});let s=ht(e,r);s!==void 0&&o.push({name:Yt(r,s),penalty:10});}let i=ht(e);return i!==void 0&&o.push({name:Sn(r,i),penalty:50}),o}function Ce(e){let t=e[0],o=t.name;for(let n=1;n<e.length;n++){let r=e[n].level||0;t.level===r-1?o=`${e[n].name} > ${o}`:o=`${e[n].name} ${o}`,t=e[n];}return o}function zt(e){return e.map(t=>t.penalty).reduce((t,o)=>t+o,0)}function pt(e,t){return zt(e)-zt(t)}function ht(e,t){let o=e.parentNode;if(!o)return;let n=o.firstChild;if(!n)return;let r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&(t===void 0||n.tagName.toLowerCase()===t)&&r++,n!==e);)n=n.nextSibling;return r}function wn(e,t){let o=0,n=e,r=[];for(;n&&n!==t;){let i=n.tagName.toLowerCase(),s=ht(n,i);if(s===void 0)return;r.push({name:Yt(i,s),penalty:NaN,level:o}),n=n.parentElement,o++;}if(yt(r,t))return r}function Sn(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function Yt(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*jt(e,t=[]){if(e.length>0)for(let o of e[0])yield*jt(e.slice(1,e.length),t.concat(o));else yield t;}function Tn(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function yt(e,t){let o=Ce(e);switch(t.querySelectorAll(o).length){case 0:throw new Error(`Can't select any node with this selector: ${o}`);case 1:return !0;default:return !1}}function*Qt(e,t,o,n,r){if(e.length>2&&e.length>o.optimizedMinLength)for(let i=1;i<e.length-1;i++){if(new Date().getTime()-r.getTime()>o.timeoutMs)return;let a=[...e];a.splice(i,1),yt(a,n)&&n.querySelector(Ce(a))===t&&(yield a,yield*Qt(a,t,o,n,r));}}var pe=new Set(["role","name","aria-label","rel","href","id"]);var J={["Parent Link"]:100,["XPath"]:60,["ID"]:20,["Link"]:70,["Parent Path"]:20,["Attributes"]:10,["Text"]:10,["Selector"]:1e3};function Z(e){if(!e)return !1;if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let o of t)if(o.length<=2||/[^aeiou]{4,}/i.test(o))return !1;return !0}return !1}function $e(e){return e.endsWith("_")?e.slice(0,-1):e.startsWith("data_")?e.replace(/_/g,"-"):e.startsWith("aria_")?e.replace(/_/g,"-"):e}var ce=e=>{try{let t=e;return e&&!e.startsWith("/")&&e.startsWith("html")&&(t="/"+e),document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue||null}catch{return null}};function Zt(e){return e?e.join(" > "):""}var Jt=e=>{if(!e||e.length===0)return null;let t=e.join(" > ");return document.querySelector(t)},vt=(e,t=!1)=>{if(!e||Object.keys(e).length===0)return null;let o={};for(let[r,i]of Object.entries(e)){let s=$e(r);t?(pe.has(s)||s.startsWith("data-")||s==="id"&&Z(i))&&(o[s]=i):o[s]=i;}if(Object.keys(o).length===0)return null;let n=Object.entries(o).map(([r,i])=>`[${r}="${i}"]`).join("");return document.querySelector(n)};function ee(e,t,o=0){if(e===null)return 0;let n=o,r=window.getComputedStyle(e),s=["input","select","textarea","button"].includes(e.tagName.toLowerCase())&&r.opacity==="0"&&r.display!=="none"&&r.visibility!=="hidden"&&!e.hasAttribute("disabled")&&r.pointerEvents!=="none";if((r.opacity==="1"||s)&&r.display!=="none"&&r.visibility!=="hidden"?s&&(n-=10):n-=50,e.tagName.toLowerCase()===t.tag_name?.toLowerCase()&&(n+=10),t.attributes)for(let[l,c]of Object.entries(t.attributes)){let d=$e(l);(d==="id"||d==="class")&&!Z(c)||(pe.has(d)||d.startsWith("data-")?e.getAttribute(d)===c&&(n+=15):e.getAttribute(d)===c&&(n+=2));}if(t.el_text&&e.textContent)if(e.textContent.includes(t.el_text))n+=50;else {let l=xn(e.textContent,t.el_text);l>25?n+=l:n-=10;}return n}function xn(e,t){let o=e.toLowerCase(),n=t.toLowerCase(),r=o.includes(n)?40:0,i=Math.max(o.length,n.length),s=(1-In(o,n)/i)*40;return Math.max(r,s)}function In(e,t){let o=Array.from({length:e.length+1},()=>Array(t.length+1).fill(0));for(let n=0;n<=e.length;n++)for(let r=0;r<=t.length;r++)n===0?o[n][r]=r:r===0?o[n][r]=n:e[n-1]===t[r-1]?o[n][r]=o[n-1][r-1]:o[n][r]=1+Math.min(o[n-1][r],o[n][r-1],o[n-1][r-1]);return o[e.length][t.length]}function eo(e){try{return Ge(e,{root:document.body,idName:t=>Z(t),className:t=>Z(t),attr:(t,o)=>pe.has(t)||t.startsWith("data-")||Z(o)&&o.length<100,seedMinLength:2,optimizedMinLength:2})}catch(t){throw t}}var bt=90,to=50,Cn=500,An=250,he=(e,t=1e4,o)=>new Promise((n,r)=>{try{let s=Date.now(),a=ie(e),l=Ae(a,bt);if(l){let u=l[0];if(u)try{let g=Et(u);}catch{}n(l[0]);return}let c=null,d=null,f=()=>{d&&clearInterval(d),c&&c.disconnect();};d=setInterval(()=>{let u=ie(e),g=Ae(u,bt);if(g){f();let m=g[0];if(m)try{let h=Et(m);}catch{}n(g[0]);return}else if(Date.now()-s>Cn){let m=Ae(u,to);if(m){f();let h=m[0];if(h)try{let y=Et(h);}catch{}n(m[0]);return}}},An),c=new MutationObserver((u,g)=>{s=Date.now();let m=ie(e),h=Ae(m,bt);if(h){g.disconnect(),n(h[0]);return}Rn(a,m)||(a=m,s=Date.now());}),c.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{f();let u=ie(e),g=Ae(u,to);if(g){n(g[0]);return}let m=fe(`Could not locate real DOM element for step #${o||"unknown"}. Using fallback popover.`,null,o);n(m);},t);}catch(i){let s=fe("Exception occurred while searching for element",i);n(s);}});function ie(e){if(typeof e=="string")return [[document.querySelector(e),1e3,"Selector"]];let t=[],o=ce(e.xpath),n=ee(o,e,J["XPath"]);if(t.push([o,n,"XPath"]),e?.attributes?.id&&Z(e.attributes.id)){let s=document.getElementById(e.attributes.id),a=ee(s,e,J["ID"]);t.push([s,a,"ID"]);}if(e?.tag_name?.toLowerCase()==="a"&&e?.attributes?.href){let a=`${Zt(e.entire_parent_branch_path)}[href="${e.attributes.href}"]`,l=document.querySelector(`${a}`),c=ee(l,e,J["Parent Link"]);t.push([l,c,"Parent Link"]);let d=`${e.tag_name}[href="${e.attributes.href}"]`,f=document.querySelector(d),u=ee(f,e,J["Link"]);t.push([f,u,"Link"]);}let r=e?.entire_parent_branch_path?Jt(e.entire_parent_branch_path):null,i=ee(r,e,J["Parent Path"]);if(t.push([r,i,"Parent Path"]),e?.attributes){let s={};for(let[d,f]of Object.entries(e.attributes)){let u=$e(d);pe.has(u)||u.startsWith("data-")||u==="id"&&Z(f)?s[d]=f:f;}if(Object.keys(s).length>0){let d=vt(s),f=ee(d,e,J["Attributes"]+15);t.push([d,f,"Attributes"]);}let l=vt(e.attributes),c=ee(l,e,J["Attributes"]);t.push([l,c,"Attributes"]);}if(e.el_text){let s=Ln(e.el_text);for(let a of s){let l=ee(a,e,J["Text"]);t.push([a,l,"Text"]);}}return t=t.sort((s,a)=>a[1]-s[1]),t}function oo(e){if(!e)return !1;if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let o of t)if(o.length<=2||/[^aeiou]{4,}/i.test(o))return !1;return !0}return !1}function Ln(e,t={}){let{tag:o="*",caseSensitive:n=!1,trimText:r=!0}=t,i=n?`//${o}[text()='${e}']`:`//${o}[translate(text(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='${e.toLowerCase()}']`,s=[],a=document.evaluate(i,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let l=0;l<a.snapshotLength;l++){let c=a.snapshotItem(l);s.push(c);}return s}function Ae(e,t){for(let o of e)if(o[0]!==null&&o[1]>t)return o}function Rn(e,t){return e.length===t.length&&e.every((o,n)=>On(o,t[n]))}function On(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Et(e){try{return Ge(e,{root:document.body,idName:t=>oo(t),className:t=>oo(t),attr:(t,o)=>pe.has(t)||t.startsWith("data-")||Z(o)&&o.length<100,seedMinLength:2,optimizedMinLength:2})}catch(t){throw t}}function de(e=1e3,t=1e4){return new Promise((o,n)=>{let i=Date.now(),s=null,a=null,l=setTimeout(()=>{f(),o();},t),c=()=>{Date.now()-i>=e&&(f(),o());},d=()=>{i=Date.now(),a&&clearTimeout(a),a=setTimeout(c,e);};function f(){s&&(s.disconnect(),s=null),a&&clearTimeout(a),clearTimeout(l);}s=new MutationObserver(d),s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),a=setTimeout(c,e);})}var I={ACTIVE:"sammy-labs-active",INFORMATIONAL_STEP:"sammy-labs-informational-step",FADE:"sammy-labs-fade",SIMPLE:"sammy-labs-simple",MENU_OPEN:"sammy-labs-menu-open",ACTIVE_ELEMENT:"sammy-labs-active-element",DUMMY_ELEMENT:"sammy-labs-dummy-element",FALLBACK:"sammy-labs-fallback-popover",DRAGGING:"sammy-labs-dragging",POPOVER:"sammy-labs-popover",POPOVER_ARROW:"sammy-labs-popover-arrow",POPOVER_ARROW_NONE:"sammy-labs-popover-arrow-none",POPOVER_TITLE:"sammy-labs-popover-title",POPOVER_DESCRIPTION:"sammy-labs-popover-description",POPOVER_FOOTER:"sammy-labs-popover-footer",POPOVER_PROGRESS_TEXT:"sammy-labs-popover-progress-text",POPOVER_NAVIGATION_BTNS:"sammy-labs-popover-navigation-btns",POPOVER_PREV_BTN:"sammy-labs-popover-prev-btn",POPOVER_NEXT_BTN:"sammy-labs-popover-next-btn",POPOVER_CLOSE_BTN:"sammy-labs-popover-close-btn",POPOVER_BTN_DISABLED:"sammy-labs-popover-btn-disabled",POPOVER_VIDEO_CONTAINER:"sammy-labs-popover-video-container",POPOVER_VIDEO:"sammy-labs-popover-video",POPOVER_HEADER:"sammy-labs-popover-header",POPOVER_REACTION_CONTAINER:"sammy-labs-popover-reaction-container",POPOVER_REACTION_TEXT:"sammy-labs-popover-reaction-text",POPOVER_REACTION_BUTTONS:"sammy-labs-popover-reaction-buttons",POPOVER_REACTION_BTN:"sammy-labs-popover-reaction-btn",POPOVER_REACTION_BTN_ACTIVE:"sammy-labs-popover-reaction-btn-active",POPOVER_DRAG_HANDLE:"sammy-labs-popover-drag-handle",INFO_HIGHLIGHT:"sammy-labs-info-highlight",INFORMATIONAL_CORNER:"sammy-informational-corner",OVERLAY:"sammy-labs-overlay"},F={DUMMY_ELEMENT:"sammy-labs-dummy-element",DUMMY_FALLBACK:"sammy-labs-dummy-fallback",POPOVER_STYLES:"sammy-labs-popover-styles",POPOVER_CONTENT:"sammy-labs-popover-content",POPOVER_TITLE:"sammy-labs-popover-title",POPOVER_DESCRIPTION:"sammy-labs-popover-description"},se={FALLBACK:"data-sammy-labs-fallback",MANAGED:"data-sammy-labs-managed",SPECIAL_MODE:"data-is-special-mode",HAS_BEEN_MOVED:"data-has-been-moved"},Ve={FALLBACK:1e4,MAX_WAIT:5e3,DOM_STABILITY:1e3,MAX_DOM_STABILITY_WAIT:5e3,HIGHLIGHT_DISPLAY:2e3,AUTO_FOCUS:200,SCROLL_DEBOUNCE:100,POPOVER_REFOCUS:50,NEXT_STEP_DELAY:300,REDRIVE_DELAY:1e3,REFRESH_CHECK:500,REFRESH_WAIT:1e3},Ke={INTERACTIVE:"interactive",INFORMATIONAL:"informational"};var B={PENDING_WALKTHROUGH:"sammy_pending_walkthrough",PENDING_WALKTHROUGH_TIMESTAMP:"sammy_pending_walkthrough_timestamp"},j={PENDING:"sammy_pending",FLOW_ID:"sammy_flow_id",TIMESTAMP:"sammy_timestamp"},Y={RESIZE_TIMEOUT:"__resizeTimeout",ACTIVE_STEP:"__activeStep",ACTIVE_ELEMENT:"__activeElement",ACTIVE_INDEX:"activeIndex",PREVIOUS_ELEMENT:"previousElement",PREVIOUS_STEP:"previousStep",ACTIVE_ON_DESTROYED:"__activeOnDestroyed",INFO_HIGHLIGHT_TARGET:"__infoHighlightTarget",INFO_HIGHLIGHT_SVG:"__infoHighlightSvg",ACTIVE_STAGE_POSITION:"__activeStagePosition",OVERLAY_SVG:"__overlaySvg",DID_FIRST_HIGHLIGHT:"__didFirstHighlight",IS_REDIRECTING:"__isRedirecting",DID_FALLBACK:"__didFallback",TRANSITION_CALLBACK:"__transitionCallback",USER_REPLAY_ID:"__userReplayId",ACTIVE_STEP_ID:"__activeStepId",STEP_INDEX:"__stepIndex",IS_INITIALIZED:"isInitialized",POPOVER:"popover"};function Le(e,t,o,n){return (e/=n/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t}function qe(e){let t='a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])';return e.flatMap(o=>{let n=o.matches(t),r=Array.from(o.querySelectorAll(t));return [...n?[o]:[],...r]}).filter(o=>getComputedStyle(o).pointerEvents!=="none"&&no(o))}function Re(e){if(!e||Hn(e))return;let t=b("smoothScroll")||!1,o=e.offsetHeight>window.innerHeight;if(kn(e)){let r=Ve.DOM_STABILITY+500,i=Ve.MAX_DOM_STABILITY_WAIT+1e3;de(r,i).then(()=>{setTimeout(()=>{_t(e,t,o,3);},200);}).catch(s=>{Pn(e,t,o);});}else _t(e,t,o,2);}function Dn(e){let t=e.parentElement;for(;t&&t!==document.body;){let n=window.getComputedStyle(t).overflowY;if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function _t(e,t,o,n){let r=Dn(e);r?e.scrollIntoView({behavior:t?"smooth":"auto",block:"nearest",inline:"nearest"}):e.scrollIntoView({behavior:t?"smooth":"auto",inline:"center",block:o?"start":"center"}),setTimeout(()=>{let s=0;if(r&&r.classList.contains("DeelUISidebar-root")){let d=r.querySelector(".MuiStack-root.sidebarMainSection.css-ctrk61");d&&d instanceof HTMLElement&&(s=d.offsetHeight);}let a=e.getBoundingClientRect(),l=r?r.getBoundingClientRect():{bottom:window.innerHeight},c=a.bottom+s-l.bottom;c>0&&r?r.scrollTop+=c+8:c>0&&window.scrollBy({top:c+8,behavior:"auto"}),n>0&&setTimeout(()=>{let d=e.getBoundingClientRect(),f=r?r.getBoundingClientRect():{bottom:window.innerHeight},u=d.bottom+s>f.bottom;(!no(e)||u)&&_t(e,t,o,n-1);},600);},100);}function Pn(e,t,o){let n=Nn(e);e.scrollIntoView({behavior:!t||n?"auto":"smooth",inline:"center",block:o?"start":"center"});}function kn(e){let t=e,o=[];for(;t&&t!==document.body;){let n=window.getComputedStyle(t);if(n.transitionDuration!=="0s"&&n.transitionDuration!==""&&o.push(`${t.className} (${n.transitionDuration})`),t.classList.contains("MuiCollapse-root")){let r=t.classList.contains("MuiCollapse-entered");if(o.push(`MuiCollapse-root (entered: ${r})`),!r)return !0}t=t.parentElement;}return o.length>0}function Nn(e){if(!e)return !1;let t=e.parentElement;for(;t&&t!==document.body;){let n=window.getComputedStyle(t),r=n.overflowY,i=n.overflowX,s=n.overflow,a=r==="auto"||r==="scroll"||i==="auto"||i==="scroll"||s==="auto"||s==="scroll",l=t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth,c=t.classList.contains("sidebarMainSection")||t.classList.contains("MuiBox-root")||/scrollable|scroll|overflow/i.test(t.className);({element:`${t.tagName}.${t.className.split(" ").slice(0,2).join(".")}`,scrollable:!1,reason:""});if(a&&l)return !0;if(c&&l)return !0;t=t.parentElement;}return !1}function Hn(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function no(e){return !!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function io(e,t,o){let n=o.getBoundingClientRect(),r=n.x+n.width/2,i=n.y+n.height/2,s=2,a={x:r-s/2,y:i-s/2,width:s,height:s},l=Le(e,a.x,n.x-a.x,t),c=Le(e,a.y,n.y-a.y,t),d=Le(e,a.width,n.width-a.width,t),f=Le(e,a.height,n.height-a.height,t),u={x:l,y:c,width:d,height:f};ze(u),v("__activeStagePosition",u);}function Xe(e){let t=e.getAttribute("data-sammy-labs-fallback")==="true";document.body.classList.contains("sammy-labs-informational-step");if(t){wt(),document.body.classList.remove("sammy-labs-active"),v("__activeStagePosition",void 0);return}if(document.body.classList.contains("sammy-labs-active")||document.body.classList.add("sammy-labs-active"),!e)return;let n=e.getBoundingClientRect(),r={x:n.x,y:n.y,width:n.width,height:n.height};v("__activeStagePosition",r),ze(r);}function so(){let e=p("__activeStagePosition"),t=p("__overlaySvg");if(!e||!t)return;let o=window.innerWidth,n=window.innerHeight;t.setAttribute("viewBox",`0 0 ${o} ${n}`);}function Mn(e){let t=ao(e);document.body.appendChild(t),je(t,o=>{o.target.tagName==="path"&&X("overlayClick");}),v("__overlaySvg",t);}function ze(e){let t=p("__overlaySvg");if(!t){Mn(e);return}let o=t.querySelector("path:first-of-type");o&&o.setAttribute("d",lo(e));let n=t.querySelector("g");if(n){let r=e.x+e.width/2,i=e.y+e.height/2;n.setAttribute("transform-origin",`${r}px ${i}px`);let s=n.querySelector("path");if(s){let a=b("stagePadding")||5,l=b("stageRadius")||12;s.setAttribute("d",Ye(e,a,l));}}}function ao(e){let t=window.innerWidth,o=window.innerHeight,n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.classList.add("sammy-labs-overlay","sammy-labs-overlay-animated"),n.setAttribute("viewBox",`0 0 ${t} ${o}`),n.setAttribute("xmlSpace","preserve"),n.setAttribute("xmlnsXlink","http://www.w3.org/1999/xlink"),n.setAttribute("version","1.1"),n.setAttribute("preserveAspectRatio","xMinYMin slice"),n.style.fillRule="evenodd",n.style.clipRule="evenodd",n.style.strokeLinejoin="round",n.style.strokeMiterlimit="2",n.style.zIndex="10000",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%";let r=document.createElementNS("http://www.w3.org/2000/svg","path");if(r.setAttribute("d",lo(e)),r.style.fill=b("overlayColor")||"rgb(0,0,0)",r.style.opacity=`${b("overlayOpacity")}`,b("overlayOpacity")===0&&(r.style.pointerEvents="none"),n.appendChild(r),e.hideHighlight)return n;let i=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");i.id="orangeGradient",i.setAttribute("gradientTransform","rotate(45)");let s=document.createElementNS("http://www.w3.org/2000/svg","stop");s.setAttribute("offset","0%"),s.setAttribute("stop-color","#5938B7");let a=document.createElementNS("http://www.w3.org/2000/svg","stop");a.setAttribute("offset","100%"),a.setAttribute("stop-color","#C4B1F9"),i.appendChild(s),i.appendChild(a);let l=document.createElementNS("http://www.w3.org/2000/svg","defs");l.appendChild(i),n.appendChild(l);let c=document.createElementNS("http://www.w3.org/2000/svg","g"),d=e.x+e.width/2,f=e.y+e.height/2;c.setAttribute("transform-origin",`${d}px ${f}px`);let u=document.createElementNS("http://www.w3.org/2000/svg","path"),g=b("stagePadding")||5,m=b("stageRadius")||12;u.setAttribute("d",Ye(e,g,m)),u.setAttribute("fill","url(#orangeGradient)"),u.style.filter="drop-shadow(0 0 4px rgba(89, 56, 183, 0.6))",c.appendChild(u);let h=document.createElement("style");return h.textContent=` @keyframes sammyPing { 0% { transform: scale(1); opacity: 1; } 70% { opacity: 0.3; } 100% { transform: scale(1.15); opacity: 0; } } `,h.setAttribute("data-sammy-pulse","true"),document.head.appendChild(h),c.style.animation="sammyPing 2s cubic-bezier(0.1, 0, 0.3, 1) infinite",n.appendChild(c),n}function Ye(e,t,o){if(e.hideHighlight)return "";let n=2,r=e.x-t,i=e.y-t,s=e.width+t*2,a=e.height+t*2,l=r-n,c=i-n,d=s+n*2,f=a+n*2,u=Math.min(o,s/2,a/2),g=Math.floor(Math.max(u,0)),m=g+n;return ` M ${l+m},${c} h ${d-2*m} a ${m},${m} 0 0 1 ${m},${m} v ${f-2*m} a ${m},${m} 0 0 1 -${m},${m} h -${d-2*m} a ${m},${m} 0 0 1 -${m},-${m} v -${f-2*m} a ${m},${m} 0 0 1 ${m},-${m} z M ${r+g},${i} h ${s-2*g} a ${g},${g} 0 0 1 ${g},${g} v ${a-2*g} a ${g},${g} 0 0 1 -${g},${g} h -${s-2*g} a ${g},${g} 0 0 1 -${g},-${g} v -${a-2*g} a ${g},${g} 0 0 1 ${g},-${g} z `}function lo(e){let t=window.innerWidth,o=window.innerHeight;if(e.hideHighlight)return `M0,0 H${t} V${o} H0 V0 Z`;let n=b("stagePadding")||5,r=b("stageRadius")||12,i=e.width+n*2,s=e.height+n*2,a=Math.min(r,i/2,s/2),l=Math.floor(Math.max(a,0)),c=e.x-n,d=e.y-n,f=i,u=s;return ` M0,0 H${t} V${o} H0 V0 Z M${c+l},${d} h${f-2*l} a${l},${l} 0 0 1 ${l},${l} v${u-2*l} a${l},${l} 0 0 1 -${l},${l} h-${f-2*l} a${l},${l} 0 0 1 -${l},-${l} v-${u-2*l} a${l},${l} 0 0 1 ${l},-${l} z`}function wt(){let e=p("__overlaySvg");e&&e.remove();let t=p("__infoHighlightSvg");t&&t.remove();let o=document.querySelector("style[data-sammy-pulse]");o&&o.remove();}function ro(e){if(e.id)return `#${e.id}`;let t=Array.from(e.attributes).filter(i=>i.name.startsWith("data-")).map(i=>`[${i.name}="${i.value}"]`);if(t.length>0)return `${e.tagName.toLowerCase()}${t.join("")}`;if(e.classList.length>0){let i=Array.from(e.classList).map(s=>`.${s}`).join("");if(e.parentElement){let s=Array.from(e.parentElement.children).filter(a=>a.tagName===e.tagName);if(s.length>1){let a=s.indexOf(e)+1;return `${e.tagName.toLowerCase()}${i}:nth-of-type(${a})`}}return `${e.tagName.toLowerCase()}${i}`}let o=e.textContent?.trim();if(o&&o.length<50)return `${e.tagName.toLowerCase()}:contains("${o}")`;let n="",r=e;for(;r&&r.nodeType===Node.ELEMENT_NODE;){let i=r.nodeName.toLowerCase(),s=1,a=r.previousElementSibling;for(;a;)a.nodeName.toLowerCase()===i&&s++,a=a.previousElementSibling;n=`/${i}[${s}]${n}`,r=r.parentElement;}return `xpath:${n}`}function Oe(e){try{if(typeof ro=="function"){let s=ro(e);v("__originalElementDefinition",s);}}catch{}let t=e.getBoundingClientRect(),o={x:t.x,y:t.y,width:t.width,height:t.height},n=p("__overlaySvg");n&&n.remove();let r=ao(o);if(r.classList.add("sammy-labs-info-highlight"),e.id===F.DUMMY_ELEMENT){let s=r.querySelector("g");s&&s.remove();}r.style.pointerEvents="none";let i=r.querySelector("path:first-of-type");return i&&(i.style.opacity="0",i.style.fill="transparent"),document.body.appendChild(r),r}var ue=null,Qe=new Set,De=null,St=new Set,Pe={PEOPLE:["/people"],PAYROLL:["/payments","/payments/due"],ENGAGE:["/engage"],IT:["/it","/it/assets/list/all"],KNOWLEDGE:["/knowledge","/knowledge/personalized"],MORE:["/app-store","/analytics","/developer-center","/services/","/deelai"]};function Tt(){return document.querySelector(".top-navigation")}function ke(e){let t=Tt();if(!t)return !1;let o=t.children[0];if(!o)return !1;let n=o.children[0];if(!n)return !1;let r=n.children;return r.length<3?!1:r[1].contains(e)}function Je(e){if(!e||!ke(e))return;et();let t=Un(e);if(!t)return;let o=Gn(e,t);if(!o){Ze(t),uo(e,t);return}mo(o);let n=Tt();if(!n)return;let i=Array.from(n.querySelectorAll('.MuiBox-root[tabindex="-1"]')).find(s=>s.contains(e))??t;i&&(Ze(i),uo(e,i),Kn(i),Vn(o));}function Un(e){if(!ke(e))return null;let t=e;for(;t&&!t.classList.contains("top-navigation");){if(t.classList.contains("MuiBox-root")&&t.getAttribute("tabindex")==="-1")return t;t=t.parentElement;}return Fn(e),co(e)}function Fn(e){if(!ke(e))return !1;if(e.getAttribute("role")==="tab"||e.closest('[role="tab"]')||e.closest('[role="menu"]')||e.classList.contains("anchor")&&e.getAttribute("tabindex")==="-1")return !0;let t=e.getAttribute("href");return t?Object.values(Pe).flat().some(o=>t.startsWith(o)):!1}function co(e){if(!ke(e))return null;let t=e,o=10;for(;t&&o>0&&!t.classList.contains("top-navigation");){if(t.classList.contains("MuiBox-root")&&t.getAttribute("tabindex")==="-1")return t;if(t.getAttribute("role")==="menu"||t.classList.contains("navigation-menu-hover-list")){let n=t.parentElement;for(;n&&!n.classList.contains("top-navigation");){if(n.classList.contains("MuiBox-root")&&n.getAttribute("tabindex")==="-1")return n;n=n.parentElement;}return t}t=t.parentElement,o--;}return null}function uo(e,t){try{let o=Wn(t);if(o.length>0){for(let n of o)if(n.contains(e)){e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),setTimeout(()=>{Bn(e,n);},100);break}}else e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});}catch{}}function Wn(e){let t=[];go(e)&&t.push(e);let o=e.querySelectorAll("*");for(let n of o)go(n)&&t.push(n);return t}function go(e){let o=window.getComputedStyle(e).overflowY;return o!=="auto"&&o!=="scroll"?!1:e.scrollHeight>e.clientHeight}function Bn(e,t){let o=e.getBoundingClientRect(),n=t.getBoundingClientRect(),r=o.top<n.top,i=o.bottom>n.bottom;if(r){let s=o.top-n.top;t.scrollTop+=s-20;}else if(i){let s=o.bottom-n.bottom;t.scrollTop+=s+20;}}function Gn(e,t){if(!ke(e))return null;let o=$n(e),n=Tt(),r=n?.querySelector(".MuiStack-root");if(!r)return null;let i=r.querySelectorAll('.MuiBox-root[tabindex="-1"]'),s=i[i.length-1];if(o==="MORE")return n?.querySelector('[data-role="more-navigation-button"]')??null;let a=r.querySelectorAll('a[tabindex="0"], button[tabindex="0"]');if(o){let l=Pe[o];for(let c of Array.from(a)){let d=c.getAttribute("href");if(d&&l.some(f=>d.startsWith(f)))return c}}if(t===s){let c=Array.from(a).find(d=>{let f=d.classList.contains("Mui-selected")||d.getAttribute("aria-selected")==="true"||d.getAttribute("aria-expanded")==="true";return f});if(c)return c}return null}function $n(e){let t=e,o=5;for(;t&&o>0;){let n=t.getAttribute("href");if(n){for(let[i,s]of Object.entries(Pe))if(s.includes(n))return i;for(let[i,s]of Object.entries(Pe))if(i!=="MORE"&&s.some(a=>n.startsWith(a)))return i;if(Pe.MORE.includes(n))return "MORE"}t=t.parentElement,o--;}return null}function Ze(e){e&&(e.style.opacity="1",e.style.visibility="visible",e.style.display="block",e.style.pointerEvents="auto",e.setAttribute("data-sammy-labs-managed","true"),Qe.add(e));}function mo(e){try{let t=new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(t);let o=new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(o),e.classList.add("sammy-labs-menu-open"),St.add(e);}catch{}}function Vn(e){let t=o=>{p("__activeElement")&&(o.preventDefault(),o.stopPropagation(),mo(e));};e.addEventListener("mouseleave",t,!0),e.addEventListener("mouseout",t,!0);}function Kn(e){ue&&ue.disconnect(),ue=new MutationObserver(t=>{for(let o of t)if(o.type==="attributes"&&o.attributeName==="style"){let n=o.target.style;(n.opacity==="0"||n.display==="none"||n.visibility==="hidden")&&Ze(e);}}),ue.observe(e,{attributes:!0,attributeFilter:["style"]}),De===null&&(De=window.setInterval(()=>{Qe.forEach(Ze);},100));}function et(){ue&&(ue.disconnect(),ue=null),De!==null&&(window.clearInterval(De),De=null),Qe.forEach(e=>{e.style.opacity="",e.style.visibility="",e.style.display="",e.style.pointerEvents="",e.removeAttribute("data-sammy-labs-managed");}),Qe.clear(),St.forEach(e=>{e.classList.remove("sammy-labs-menu-open");}),St.clear();}async function te(e,t,o){let n=typeof window<"u"?window.__WALKTHROUGH_CONTEXT__:void 0;if(n&&typeof n.onWalkthroughEvent=="function")try{n.onWalkthroughEvent(e);}catch{}try{let r=await fetch(`${o}/public/walkthrough/log`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({event:e})});if(!r.ok)throw new Error(`Failed to log event: ${r.statusText}`);return await r.json()}catch{}}function po(){return v4()}function ye(){return v4()}async function ho(e,t,o){try{let n=await fetch(`${o}/public/walkthrough/step-reaction`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to submit reaction: ${n.statusText}`);return await n.json()}catch{}}function ve(e,t,o={}){if(!e||e.trim()==="")return !0;let{ignoreQueryParams:n=!0,ignoreProtocol:r=!1,ignoreHash:i=!1,strictQueryParams:s=!1}=o;try{let a=new URL(e),l=new URL(t);if(r&&a.protocol!==l.protocol&&(a.protocol=l.protocol),a.pathname!==l.pathname||!i&&a.hash!==l.hash)return !1;if(n)return !0;if(s)return a.search===l.search;{let c=new URLSearchParams(a.search),d=new URLSearchParams(l.search);for(let[f,u]of c.entries())if(d.get(f)!==u)return !1;return !0}}catch{return e===t}}function ae(e,t,o={}){try{let n=o.overrideDomainUrl&&o.overrideDomainUrl!=="",r=i=>{let s=new URL(i);if(o.ignoreTrailingSlash!==!1&&(s.pathname=s.pathname.replace(/\/+$/,"")),n)return o.ignoreQueryParams!==!1?s.pathname+s.hash:s.pathname+s.search+s.hash;let a=o.ignoreQueryParams?s.pathname+s.hash:s.pathname+s.search+s.hash;return s.origin+a};return r(e)===r(t)}catch{return e===t}}function G(e){if(!e)return !1;let t=e.step_type===Ke.INFORMATIONAL,o="popover"in e&&e.popover?.popoverClass?.includes(I.INFORMATIONAL_CORNER);return !!(t||o)}function yo(e){return !e||G(e)?!1:!!p("__hasDeoptedToInformational")}function vo(){v("__hasDeoptedToInformational",!1);}function qn(){let e=document.getElementById(F.DUMMY_ELEMENT);if(e)return e;let t=document.createElement("div");return t.id=F.DUMMY_ELEMENT,t.style.width="0",t.style.height="0",t.style.pointerEvents="none",t.style.opacity="0",t.style.position="fixed",t.style.top="50%",t.style.left="50%",document.body.appendChild(t),t}var bo=qn;function Xn(e){typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&(e.url?window.__WALKTHROUGH_CONTEXT__.originalStepUrl=e.url:window.__WALKTHROUGH_CONTEXT__.originalStepUrl=window.location.href);}var Eo=Xn;function zn(){document.body.classList.remove("sammy-labs-active"),document.body.classList.add("sammy-labs-informational-step");try{(()=>{let t=document.querySelector(".sammy-labs-overlay");t&&t.remove();})();}catch{}}var _o=zn;function Yn(e){return {...e,disableActiveInteraction:!1,popover:{...e.popover,popoverClass:(e.popover?.popoverClass||"")+` ${I.INFORMATIONAL_CORNER}`}}}var wo=Yn;function So(){let t=(o=>({__infoHighlightSvg:document.querySelector(".sammy-labs-info-highlight")})[o])("__infoHighlightSvg");t&&(t.remove(),v("__infoHighlightSvg",void 0));}function Qn(e){let{element:t}=e;if(!t)return !0;let o=typeof t=="function"?t():typeof t=="string"?document.querySelector(t):t;return !o||o.getAttribute("data-sammy-labs-fallback")==="true"}function Zn(e){let{element:t}=e;return t?typeof t=="function"?t():typeof t=="string"?document.querySelector(t):t:null}function It(e){if(G(e)){rr(e);return}if(yo(e)){er(e);return}if(Qn(e)){xo(e);return}Jn(e);}function xo(e){let t=fe("Could not locate target element");v("__didFallback",!0),tt(),At(t,e);}function Jn(e){document.body.classList.remove("sammy-labs-informational-step"),So();let t=Zn(e);if(!t){xo(e);return}tt(),At(t,e);}function er(e){let t=fe("Searching for element...");v("__didFallback",!0),tt(),At(t,e),tr(e);}async function tr(e,t){let o=5e3;try{if(typeof e.element=="string"){let n={xpath:e.element.startsWith("xpath:")?e.element.substring(6):e.element,el_text:"",attributes:{},tag_name:""},r=await he(n,o,-1);r&&r.getAttribute("data-sammy-labs-fallback");}}catch{}}function or(e,t){let{element:o}=e;if(e.disableHighlight||e.disable_highlight)return null;if(o)if(o instanceof Element){let i=xr(o);v("__originalElementDefinition",i);}else v("__originalElementDefinition",o);let r=typeof o=="function"?o():typeof o=="string"?document.querySelector(o):o;return !(r instanceof HTMLElement)||!document.body.contains(r)?null:(Re(r),r)}function nr(e,t,o){let n=wo(t);tt(),v("previousStep",p("__activeStep")),v("previousElement",p("__activeElement")||e),v("activeStep",n),v("activeElement",e),v("__activeStep",n),v("__activeElement",e);let r=t.disableHighlight||t.disable_highlight;if(o&&!r){let i=Oe(o);v("__infoHighlightSvg",i),v("__infoHighlightTarget",o);}else v("__infoHighlightTarget",void 0);rt(e,n);}function rr(e){v("__hasDeoptedToInformational",!0),Eo(e),_o();let t=bo(),o=or(e);nr(t,e,o);}function tt(e){let o=b().enableLogging,n=p("__userReplayId"),r=p("activeIndex")??0,i=ye();if(v("__activeStepId",i),v("__stepIndex",r),o&&n)try{let s="",a="http://localhost:8000";if(typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__){let d=window.__WALKTHROUGH_CONTEXT__;s=d.token||"",a=d.baseUrl||a;}let l={event_type:"step",user_replay_id:n,user_replay_step_id:i,status:"seen",step_number:r+1,step_initiated_at:new Date().toISOString()},c=!1;typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&(c=window.__WALKTHROUGH_CONTEXT__.config?.debug||!1),te(l,s,a);}catch{}}function ot(){let e=p("__activeElement"),t=p("__activeStep"),o=t?.url;if(!o&&typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&(o=window.__WALKTHROUGH_CONTEXT__.originalStepUrl),!!e&&t){if(t.step_type==="informational"){ir(e,t,o);return}lr(e,t);}}function Io(e){let t={...e.getBoundingClientRect(),hideHighlight:!0};ze(t);}function ir(e,t,o){let n=p("__infoHighlightTarget"),r=n&&document.body.contains(n),i=t.disableHighlight||t.disable_highlight,s=sr(t);if(i){document.body.classList.add("sammy-labs-informational-step");return}if((!r||!n)&&s&&document.body.contains(s)){v("__infoHighlightTarget",s),To(e,s);return}if(r){To(e,n);return}if(document.body.classList.contains("sammy-labs-informational-step")&&o&&ve(o,window.location.href)){let l=ar();if(l&&document.body.contains(l)){v("__infoHighlightTarget",l),document.body.classList.add("sammy-labs-informational-step");let c=Oe(l);v("__infoHighlightSvg",c);return}}be();}function Co(){let e=p("__activeElement"),t=p("__activeStep");!e||!t||(Xe(e),t.popover&&it(e,t));}function sr(e){let t=null;if(typeof e.element=="string")t=document.querySelector(e.element);else if(typeof e.element=="function")try{t=e.element();}catch{}return t}function ar(){let e=p("__originalElementDefinition");if(!e)return null;let t=null;if(typeof e=="string")if(e.startsWith("xpath:")){let o=e.substring(6);t=ce(o);}else if(e.includes(":contains(")){let[o,n]=e.split(":contains("),r=n.substring(1,n.length-2);t=Array.from(document.querySelectorAll(o)).find(s=>s.textContent?.trim().includes(r))||null;}else t=document.querySelector(e);else if(typeof e=="function")try{t=e();}catch{}return t}function To(e,t){if(document.body.classList.add("sammy-labs-informational-step"),document.querySelector("svg.sammy-labs-info-highlight"))Ct(e);else {let o=Oe(t);v("__infoHighlightSvg",o);}}function lr(e,t){Xe(e),so(),it(e,t);}function Ct(e){let t=cr(e);if(!t||!document.body.contains(t)){be();return}let o=p("__infoHighlightSvg");if(!(o&&document.body.contains(o))){xt(t);return}dr(o,t);}function cr(e){if(e.id===F.DUMMY_ELEMENT){let t=p("__infoHighlightTarget");return t instanceof Element?t:null}return e}function xt(e){document.querySelectorAll("svg.sammy-labs-info-highlight").forEach(o=>{o.remove();}),v("__infoHighlightSvg",void 0);let t=Oe(e);v("__infoHighlightSvg",t),v("__infoHighlightTarget",e),document.body.classList.contains("sammy-labs-informational-step")||document.body.classList.add("sammy-labs-informational-step"),setTimeout(()=>{},0);}function dr(e,t){try{let o=t.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height},r=e.querySelector("g"),i=r?.querySelector("path");if(!r||!i){xt(t);return}let s=n.x+n.width/2,a=n.y+n.height/2;r.setAttribute("transform-origin",`${s}px ${a}px`);let l=b("stagePadding")||5,c=b("stageRadius")||12;i.setAttribute("d",Ye(n,l,c)),e.setAttribute("viewBox",`0 0 ${window.innerWidth} ${window.innerHeight}`);}catch{xt(t);}}function At(e,t){document.body.classList.remove("sammy-labs-informational-step");let o=p("__activeStep"),n=p("__activeElement")||e;v("__activeStep",t),v("__activeElement",e),v("activeStep",t),v("activeElement",e);let r=200,i=Date.now(),s=b(),a=p(),l=!n||n===e,c=e.id===F.DUMMY_ELEMENT,d=n.id===F.DUMMY_ELEMENT,f=s.animate,u=G(t),g=ur(o,t,s);!l&&g.deselectedHook&&g.deselectedHook(d?void 0:n,o,{config:s,state:a,driver:H()}),g.highlightStartedHook&&g.highlightStartedHook(c?void 0:e,t,{config:s,state:a,driver:H()});let m=!l&&f,h=!1;gr(e,n,o,t),l&&t.popover&&(rt(e,t),h=!0);let y=mr(i,r,n,e,t,m||!1,h,c,l,g,o);v("__transitionCallback",y),window.requestAnimationFrame(y),pr(n,e,u,t);}function ur(e,t,o){return {highlightStartedHook:t.onHighlightStarted||o.onHighlightStarted,highlightedHook:t?.onHighlighted||o.onHighlighted,deselectedHook:e?.onDeselected||o.onDeselected,onFirstStepActive:o.onFirstStepActive}}function gr(e,t,o,n){Je(e),Lo(),v("previousStep",o),v("previousElement",t),v("activeStep",n),v("activeElement",e),Re(e);}function mr(e,t,o,n,r,i,s,a,l,c,d){let f={isPopoverRendered:s};return function u(){if(p("__transitionCallback")!==u)return;let m=Date.now()-e,y=t-m<=t/2;if(r.popover&&y&&!f.isPopoverRendered&&i&&(rt(n,r),f.isPopoverRendered=!0),b("animate")&&m<t)io(m,t,n);else {fr(n,r,a,l,c,o,d);return}window.requestAnimationFrame(u);}}function fr(e,t,o,n,r,i,s){G(t)||Xe(e),r.highlightedHook&&r.highlightedHook(o?void 0:e,t,{config:b(),state:p(),driver:H()});let l=p("__didFirstHighlight");n&&!l&&r.onFirstStepActive&&(v("__didFirstHighlight",!0),r.onFirstStepActive(o?void 0:e,t,{config:b(),state:p(),driver:H()})),v("__transitionCallback",void 0),v("__previousStep",s),v("__previousElement",i),v("__activeStep",t),v("__activeElement",e),window.setTimeout(()=>{let c=p("popover");c?.wrapper&&c.wrapper.style.visibility==="visible"&&c.wrapper.style.opacity==="1"||ot();},100);}function pr(e,t,o,n){e.classList.remove("sammy-labs-active-element","sammy-labs-no-interaction"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-controls"),(o?!1:n.disableActiveInteraction??b("disableActiveInteraction"))&&t.classList.add("sammy-labs-no-interaction"),t.classList.add("sammy-labs-active-element"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","true"),t.setAttribute("aria-controls","sammy-labs-popover-content"),o&&document.body.classList.add("sammy-labs-informational-step");}function Ao(){hr(),yr(),vr(),be();}function hr(){typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&delete window.__WALKTHROUGH_CONTEXT__.originalStepUrl;}function yr(){document.getElementById(F.DUMMY_ELEMENT)?.remove();}function vr(){document.querySelectorAll(".sammy-labs-active-element").forEach(e=>{e.classList.remove("sammy-labs-active-element","sammy-labs-no-interaction"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-controls");});}function be(){document.body.classList.remove("sammy-labs-informational-step"),br(),Er(),_r();}function br(){let e=p("__infoHighlightSvg");e&&(e.remove(),v("__infoHighlightSvg",void 0));}function Er(){let e=document.querySelectorAll("svg.sammy-labs-info-highlight");e.length>0&&e.forEach(t=>t.remove());}function _r(){v("__infoHighlightTarget",void 0),v("__activeStagePosition",void 0);}function nt(){let e=H();if(!e||!e.isActive())return;let t=e.getActiveIndex();typeof t=="number"&&(wr(e),Tr(e,t));}function wr(e){let t=e.getActiveStep();!t||t.step_type!=="informational"||(document.body.classList.remove("sammy-labs-informational-step"),Sr());}function Sr(){let e=p("__infoHighlightSvg");e&&(e.remove(),v("__infoHighlightSvg",void 0)),document.querySelectorAll("svg.sammy-labs-info-highlight").forEach(t=>{t.remove();});}function Tr(e,t){setTimeout(()=>{try{e.moveTo(t);}catch{}},100);}function xr(e){try{return eo(e)}catch{if(e.id)return `#${e.id}`;let o=Array.from(e.attributes).filter(s=>s.name.startsWith("data-")).map(s=>`[${s.name}="${s.value}"]`);if(o.length>0)return `${e.tagName.toLowerCase()}${o.join("")}`;if(e.classList.length>0){let s=Array.from(e.classList).map(a=>`.${a}`).join("");if(e.parentElement){let a=Array.from(e.parentElement.children).filter(l=>l.tagName===e.tagName);if(a.length>1){let l=a.indexOf(e)+1;return `${e.tagName.toLowerCase()}${s}:nth-of-type(${l})`}}return `${e.tagName.toLowerCase()}${s}`}let n=e.textContent?.trim();if(n&&n.length<50)return `${e.tagName.toLowerCase()}:contains("${n}")`;let r="",i=e;for(;i&&i.nodeType===Node.ELEMENT_NODE;){let s=i.nodeName.toLowerCase(),a=1,l=i.previousElementSibling;for(;l;)l.nodeName.toLowerCase()===s&&a++,l=l.previousElementSibling;r=`/${s}[${a}]${r}`,i=i.parentElement;}return `xpath:${r}`}}function Q(){let e=p(Y.RESIZE_TIMEOUT);e&&window.cancelAnimationFrame(e);let t=p(Y.ACTIVE_STEP),o=document.body.classList.contains(I.INFORMATIONAL_STEP);if(t&&G(t)&&o){if(p("draggedPopoverPosition"))return;v(Y.RESIZE_TIMEOUT,window.requestAnimationFrame(()=>{let r=p(Y.INFO_HIGHLIGHT_TARGET),i=p(Y.INFO_HIGHLIGHT_SVG);r&&i&&document.body.contains(r)&&document.body.contains(i)?Ct(r):ot();}));}else {let n=p(Y.ACTIVE_ELEMENT),r=p("draggedPopoverPosition");if(n?.getAttribute(se.FALLBACK)==="true"&&r)return;v(Y.RESIZE_TIMEOUT,window.requestAnimationFrame(()=>{Co(),ot();}));}}function Ro(e){if(!p(Y.IS_INITIALIZED)||!(e.key==="Tab"||e.keyCode===9))return;let n=p(Y.ACTIVE_ELEMENT),i=p(Y.POPOVER)?.wrapper,s=qe([...i?[i]:[],...n?[n]:[]]),a=s[0],l=s[s.length-1];e.preventDefault(),e.shiftKey?(s[s.indexOf(document.activeElement)-1]||l)?.focus():(s[s.indexOf(document.activeElement)+1]||a)?.focus();}function Oo(e){(b("allowKeyboardControl")??!0)&&(e.key==="Escape"?X("escapePress"):e.key==="ArrowRight"?X("arrowRightPress"):e.key==="ArrowLeft"&&X("arrowLeftPress"));}function je(e,t,o){let n=(i,s)=>{let a=i.target;e.contains(a)&&((!o||o(a))&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation()),s?.(i));};document.addEventListener("pointerdown",n,!0),document.addEventListener("mousedown",n,!0),document.addEventListener("pointerup",n,!0),document.addEventListener("mouseup",n,!0),document.addEventListener("click",i=>{n(i,t);},!0);}function Ir(){document.addEventListener("click",e=>{let t=p("__activeElement");if(!t||!t.contains(e.target)||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t.querySelector("input, textarea")||e.target.matches("input, textarea"))return;Io(t);let o=p("popover");o?.wrapper&&(o.wrapper.style.transition=o.wrapper.style.transition||"opacity 200ms ease-in, transform 200ms ease-in",o.wrapper.offsetWidth,o.wrapper.style.opacity="0",o.wrapper.style.transform="scale(0.95)",setTimeout(()=>{o.wrapper&&o.wrapper.parentElement&&(o.wrapper.style.display="none");},200));},{capture:!0,passive:!0});}var Ne=null,Cr=()=>{return ()=>{let o=H();if(!o||!o.isActive())return;let n=o.getActiveStep();if(n&&G(n)){let r=n.url;!r&&typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&(r=window.__WALKTHROUGH_CONTEXT__.originalStepUrl);let i=window.location.href;if(typeof r=="string"&&r.length>0)ve(r,i)?setTimeout(()=>{let a=H(),l=a.getActiveStep();if(l&&l.element){let c=null;if(typeof l.element=="string")if(l.element.startsWith("xpath:")){let d=l.element.substring(6);c=ce(d);}else c=document.querySelector(l.element);else if(typeof l.element=="function")try{c=l.element();}catch{}else if(l.interactiveElements&&l.interactiveElements.length>0)try{let d=l.interactiveElements[0];if(d&&d.xpath&&a.waitForElement){a.waitForElement(d,5e3,a.getActiveIndex()||0).then(f=>{f&&nt();}).catch(console.error);return}}catch{}if(!c&&typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__){let d=window.__WALKTHROUGH_CONTEXT__.__originalElementDefinition;if(d&&typeof d=="string")if(d.startsWith("xpath:")){let f=d.substring(6);c=ce(f);}else if(d.includes(":contains(")){let[f,u]=d.split(":contains("),g=u.substring(1,u.length-2);c=Array.from(document.querySelectorAll(f)).find(h=>h.textContent?.trim().includes(g))||null;}else c=document.querySelector(d);}if(c&&document.body.contains(c)){v("__infoHighlightTarget",c),document.body.classList.contains(I.INFORMATIONAL_STEP)||document.body.classList.add(I.INFORMATIONAL_STEP),nt();return}}Q(),setTimeout(()=>{let c=!!document.querySelector("svg.sammy-labs-info-highlight"),d=p("__infoHighlightTarget");d instanceof Element&&document.body.contains(d);c||nt();},500);},1e3):(be(),setTimeout(()=>{},0));else {let s=p("__infoHighlightTarget"),a=s&&document.body.contains(s);document.body.classList.contains(I.INFORMATIONAL_STEP)&&(a?setTimeout(()=>{Q(),setTimeout(()=>{let l=!!document.querySelector("svg.sammy-labs-info-highlight"),c=s instanceof Element&&document.body.contains(s);!l&&c&&o.moveTo(o.getActiveIndex()||0);},500);},1e3):be());}}}};function Do(){window.addEventListener("keyup",Oo,!1),window.addEventListener("keydown",Ro,!1),window.addEventListener("resize",Q),window.addEventListener("scroll",Q),document.addEventListener("scroll",Q,!0),typeof window<"u"&&window.__WALKTHROUGH_CONTEXT__&&(window.__WALKTHROUGH_CONTEXT__.locationChangeEvents||window.__WALKTHROUGH_CONTEXT__.config?.enableLocationChangeEvents)&&(Ne=Cr(),window.addEventListener("locationchange",Ne)),Ir();}function Po(){window.removeEventListener("keyup",Oo),window.removeEventListener("keydown",Ro),window.removeEventListener("resize",Q),window.removeEventListener("scroll",Q),document.removeEventListener("scroll",Q,!0),Ne&&(window.removeEventListener("locationchange",Ne),Ne=null);}var Rt=null,Ot=null;function ko(e){try{if(!e)return !1;let t="__sammy_test_storage__";return e.setItem(t,"test"),e.removeItem(t),!0}catch{return !1}}function Dt(){return Rt===null&&(Rt=ko(typeof window<"u"?window.localStorage:null)),Rt}function Pt(){return Ot===null&&(Ot=ko(typeof window<"u"?window.sessionStorage:null)),Ot}var oe={getItem(e){try{return typeof window>"u"||!Dt()?null:window.localStorage.getItem(e)}catch{return null}},setItem(e,t){try{return typeof window>"u"||!Dt()?!1:(window.localStorage.setItem(e,t),!0)}catch{return !1}},removeItem(e){try{return typeof window>"u"||!Dt()?!1:(window.localStorage.removeItem(e),!0)}catch{return !1}}},z={getItem(e){try{return typeof window>"u"||!Pt()?null:window.sessionStorage.getItem(e)}catch{return null}},setItem(e,t){try{return typeof window>"u"||!Pt()?!1:(window.sessionStorage.setItem(e,t),!0)}catch{return !1}},removeItem(e){try{return typeof window>"u"||!Pt()?!1:(window.sessionStorage.removeItem(e),!0)}catch{return !1}}};var Ar=5*60*1e3,kt="sammy_redirect_in_progress";function Lr(e){return {flow_id:e.flow_id,flow_run_id:e.flow_run_id,flow_version_id:e.flow_version_id,title:e.title,history:e.history}}function Ee(e,t=!1){try{let o=Lr(e),n=JSON.stringify(o);oe.setItem(B.PENDING_WALKTHROUGH,n),z.setItem(B.PENDING_WALKTHROUGH,n);let r=Date.now().toString();return oe.setItem(B.PENDING_WALKTHROUGH_TIMESTAMP,r),z.setItem(B.PENDING_WALKTHROUGH_TIMESTAMP,r),r}catch{return Date.now().toString()}}function No(){try{let e=oe.getItem(B.PENDING_WALKTHROUGH)||z.getItem(B.PENDING_WALKTHROUGH),t=oe.getItem(B.PENDING_WALKTHROUGH_TIMESTAMP)||z.getItem(B.PENDING_WALKTHROUGH_TIMESTAMP);if(!e||!t)return null;let o=parseInt(t,10);return Date.now()-o>Ar?(ne(),null):JSON.parse(e)}catch{return ne(),null}}function ne(){if(oe.removeItem(B.PENDING_WALKTHROUGH),oe.removeItem(B.PENDING_WALKTHROUGH_TIMESTAMP),z.removeItem(B.PENDING_WALKTHROUGH),z.removeItem(B.PENDING_WALKTHROUGH_TIMESTAMP),typeof window<"u")try{let e=new URL(window.location.href);e.searchParams.delete(j.PENDING),e.searchParams.delete(j.FLOW_ID),e.searchParams.delete("has_stored_data"),e.searchParams.delete(j.TIMESTAMP),window.history&&window.history.replaceState&&window.history.replaceState({},document.title,e.toString());}catch{}}function _e(e,t){try{let o=new URL(e);return o.searchParams.set(j.PENDING,"true"),t.flow_id&&o.searchParams.set(j.FLOW_ID,t.flow_id),o.searchParams.set(j.TIMESTAMP,Date.now().toString()),o.toString()}catch{return e}}function Ho(){try{let e=new URLSearchParams(window.location.search);return {isPending:e.get(j.PENDING)==="true",flowId:e.get(j.FLOW_ID),timestamp:e.get(j.TIMESTAMP)}}catch{return {isPending:!1,flowId:null,timestamp:null}}}function Mo(){try{z.setItem(kt,"true");}catch{}}function ge(){try{return z.getItem(kt)==="true"}catch{return !1}}function st(){try{z.removeItem(kt);}catch{}}function Nt(e,t,o){let n=document.createElement("div");n.className="sammy-labs-popover-header",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="space-between",n.style.marginBottom="12px";let r=document.createElement("span");return r.textContent=`Step ${e} of ${t}`,r.style.fontSize="14px",r.style.color="#71717a",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",n.appendChild(r),n.appendChild(o),n}function Rr(){let e=document.createElement("div");e.className="sammy-labs-popover-ask-container",e.style.marginTop="16px",e.style.borderTop="1px solid rgba(0,0,0,0.1)",e.style.paddingTop="16px",e.style.display="flex",e.style.gap="8px";let t=document.createElement("input");t.type="text",t.placeholder="Ask a question about this step...",t.className="sammy-labs-popover-ask-input",t.style.width="100%",t.style.padding="8px 12px",t.style.borderRadius="6px",t.style.border="1px solid #e2e8f0",t.style.fontSize="14px",t.style.boxSizing="border-box",t.style.outline="none";let o=document.createElement("button");return o.textContent="Ask",o.className="sammy-labs-popover-ask-button",o.style.padding="6px 12px",o.style.borderRadius="6px",o.style.backgroundColor="#C4B1F9",o.style.color="#5938B7",o.style.border="none",o.style.cursor="pointer",o.style.fo